[
  {
    "path": ".gitignore",
    "content": "/build\n*.o\n*.o.d\n*.so\n*.iml\n"
  },
  {
    "path": "CHANGELOG.txt",
    "content": "0.9.9.0\n- Added support for decoding and converting files from file descriptors\n\n0.9.8.7\n- Fixed converting from JPG to TIFF with CCITTRLE, CCITTFAX3, CCITTFAX4 compression schemes\n\n0.9.8.6\n- Changed binary files (rebuild)\n\n0.9.8.5\n- Added signal handling of SIGSEGV signal before open tiff images to prevent many silent crashes from libtiff\n\n0.9.8.4\n- Added possibility to cancel background processing by interrupting of worker thread as usual in Java\n\n0.9.8.3\n-Fixed impossibility to convert full image without bounds\n\n0.9.8.2\n-Added handling of SIGSEGV crashes from libtiff\n\n0.9.8\n-Added support for dirrect converting files to TIFF and from TIFF\n-Fixed bug causing crashing while saving tiff\n\n0.9.7.6\n-Added support for CCITT modified Huffman RLE (CCITTRLE) compression scheme\n\n0.9.7.5\n- Returned previous version of write bitmap to tiff algorithm with some improvements. This changes is due to an error of writing tiff data with bottom orientations\n\n0.9.7.4\n- Add converter utils\n- Improved write and read algorithms\n\n0.9.7.3\n- Add possibility to decode part of image by specify decode area\n\n0.9.7.2\n- Changed saving algorithm to use android native bitmap\n- Add progress listener for decoding process\n\n0.9.7.1\n- Added reading of various tiff tags\n- Changed enums\n\n0.9.7\n- Added possibility to stop decoding that runs in separate thread\n- Fixed crashing when decoding images with bad metadata\n\n0.9.6.2\n- Added support for TIFFTAG_XRESOLUTION, TIFFTAG_YRESOLUTION, TIFFTAG_RESOLUTIONUNIT\n\n0.9.6\n- Added support for CCITT Group 3 and CCITT Group 4 compression schemes\n\n0.9.5.1\n- Fixed decoding algorithm for stripped images\n\n0.9.5 \n- Added algorithms for efficient memory usage\n- Added switchers for throwing exceptions and using of tiff tag orientation\n\n"
  },
  {
    "path": "README.md",
    "content": "# Android-TiffBitmapFactory\nTiffBitmapFactory is an Android library that allows opening and saving images in *.tif format (See [Wikipedia](https://en.wikipedia.org/wiki/Tagged_Image_File_Format)) on Android devices.\n\nFor decoding and encoding *.tif files it uses the native library [libtiff](https://github.com/dumganhar/libtiff). Also for images that compressed with jpeg compression scheme used [libjpeg9 for android](https://github.com/Suvitruf/libjpeg-version-9-android) (the IJG code). For converting from PNG to TIFF and from TIFF to PNG used library [libpng-android](https://github.com/julienr/libpng-android).\n\nJust now it has possibility to open tif image as mutable bitmap, read count of directory in file, apply sample rate for bitmap decoding and choose directory to decode.\nWhile saving there is available few(most popular) compression mods and some additiona fields that can be writen to file, like author or copyright.\n\nMinimum Android API level 16\n\nSupported architectures: all\n\n### Installation\nJust add to your gradle dependencies :\n```\nimplementation 'io.github.beyka:Android-TiffBitmapFactory:0.9.9.1'\n```\nAnd do not forget to add WRITE_EXTERNAL_STORAGE permission to main project manifest\n\n### Build from sources\nTo build native part of library use [Android-NDK-bundle](https://developer.android.com/tools/sdk/ndk/index.html).\n<p>To start build go to tiffbitmapfactory folder and run</p>\n\n``` Gradle\nndk-build NDK_PROJECT_PATH=src/main\n```\n\n### Usage\n#### Opening tiff file\nStarting Android-Q we can't open any file from sdcar, just files from scoped storage of application\nIf you need open file somewhere in sdcardm you should use [Storage Access Framework](https://android-doc.github.io/guide/topics/providers/document-provider.html)\n\nRequest document chooser(Android system don't know image/tiff type so using */*):\n```Java\nIntent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);\nintent.addCategory(Intent.CATEGORY_OPENABLE);\nintent.setType(\"*/*\");\nstartActivityForResult(intent, requestCode);\n```\nGetting answer from chooser:\n```Java\n@Override\n    protected void onActivityResult(int requestCode, int resultCode, Intent data) {\n        super.onActivityResult(requestCode, resultCode, data);\n        if (requestCode == REQUEST_CODE) {\n            try {\n                ParcelFileDescriptor parcelFileDescriptor = getContentResolver().openFileDescriptor(data.getData(), \"r\");\n                Bitmap bmp = TiffBitmapFactory.decodeFileDescriptor(parcelFileDescriptor.getFd());\n            } catch (FileNotFoundException e) {\n                e.printStackTrace();\n            }\n        }\n    }\n```\nSame method used also for TiffSaver and TiffConverter classes\n\nFor pre Q devices and for scoped storage you can use old api:\n```Java\nFile file = new File(\"/sdcard/image.tif\");\n\n//Read data about image to Options object\nTiffBitmapFactory.Options options = new TiffBitmapFactory.Options();\noptions.inJustDecodeBounds = true;\nTiffBitmapFactory.decodeFile(file, options);\n\nint dirCount = options.outDirectoryCount;\n\n//Read and process all images in file\nfor (int i = 0; i < dirCount; i++) {\n    options.inDirectoryNumber = i;\n    TiffBitmapFactory.decodeFile(file, options);\n    int curDir = options.outCurDirectoryNumber;\n    int width = options.outWidth;\n    int height = options.outHeight;\n    //Change sample size if width or height bigger than required width or height\n    int inSampleSize = 1;\n    if (height > reqHeight || width > reqWidth) {\n\n        final int halfHeight = height / 2;\n        final int halfWidth = width / 2;\n\n        // Calculate the largest inSampleSize value that is a power of 2 and keeps both\n        // height and width larger than the requested height and width.\n        while ((halfHeight / inSampleSize) > reqHeight\n                        && (halfWidth / inSampleSize) > reqWidth) {\n            inSampleSize *= 2;\n        }\n    }\n    options.inJustDecodeBounds = false;\n    options.inSampleSize = inSampleSize;\n    \n    // Specify the amount of memory available for the final bitmap and temporary storage.\n    options.inAvailableMemory = 20000000; // bytes\n    \n    Bitmap bmp = TiffBitmapFactory.decodeFile(file, options);\n    processBitmap(bmp);\n}\n```\n\n##### Memory processing\nWhile decoding images library use native memory mechanism, so it could use all memory available for operating system. This could produce crash of your app and close other applications which are running on the device. Also in some cases it could crash operating system. \nAlso in case of using more than one thread for decoding images every thread could try to use all device memory.\nFor avoiding of memory errors, library now has option called inAvailableMemory. Default value for this variable is 8000x8000x4 that equal to 244Mb. -1 means that decoder could use all available memory, but also it could be root of application crashes. Each separate thread that decoding tiff image will estimate how many memory it will use in decoding process. If estimate memory is less than available memory, decoder will decode image. Otherwise decoder will throw error or just return NULL(see inThrowException option).\n\n\n#### Stop decoding that runs in separate thread\n```Java\n//Running decoding of big image in separate thread\nThread thread = new Thread(new Runnable() {\n        @Override\n        public void run() {\n            Bitmap bitmap = TiffBitmapFactory.decodePath(\"/sdcard/big_tiff_image.tif\");\n        }\n    });\nthread.start();\n//To stop thread just interrupt thread as usual\nthread.interrupt();\n```\n\n#### Saving tiff file\n```Java\n//Open some image\nBitmap bitmap = BitmapFactory.decodeFile(\"sdcard/image.png\");\n//Create options for saving\nTiffSaver.SaveOptions options = new TiffSaver.SaveOptions();\n//By default compression mode is none\noptions.compressionScheme = CompressionScheme.COMPRESSION_LZW;\n//By default orientation is top left\noptions.orientation = Orientation.ORIENTATION_LEFTTOP;\n//Add author tag to output file\noptions.author = \"beyka\";\n//Add copyright tag to output file\noptions.copyright = \"Some copyright\";\n//Save image as tif. If image saved succesfull true will be returned\nboolean saved = TiffSaver.saveBitmap(\"/sdcard/out.tif\", bitmap, options);\n```\n\n#### Adding page to existing tiff file\n```Java\n//Open some image\nBitmap bitmap = BitmapFactory.decodeFile(\"sdcard/image.png\");\n//Create options for saving\nTiffSaver.SaveOptions options = new TiffSaver.SaveOptions();\n//By default compression mode is none\noptions.compressionScheme = CompressionScheme.COMPRESSION_LZW;\n//By default orientation is top left\noptions.orientation = Orientation.ORIENTATION_LEFTTOP;\n//Add author tag to output file\noptions.author = \"beyka\";\n//Add copyright tag to output file\noptions.copyright = \"Some copyright\";\n//Add new directory to existing file or create new file. If image saved succesfull true will be returned\nboolean saved = TiffSaver.appendBitmap(\"/sdcard/out.tif\", bitmap, options);\n```\nEvery new page will be added as new directory to the end of file. If you trying to append directory to non-exisiting file - new file will be created\n\n\n#### Converting to tiff\nThere is possibility for dirrect convert from some formats to TIFF. This method uses as less memory as possible. Use this method if you want create TIFF form realy big image file.\n```Java\nTiffConverter.ConverterOptions options = new TiffConverter.ConverterOptions();\noptions.throwExceptions = false; //Set to true if you want use java exception mechanism;\noptions.availableMemory = 128 * 1024 * 1024; //Available 128Mb for work;\noptions.compressionScheme = CompressionScheme.LZW; //compression scheme for tiff\noptions.appendTiff = false;//If set to true - will be created one more tiff directory, otherwise file will be overwritten\nTiffConverter.convertToTiff(\"/sdcard/some_image.jpg\", \"/sdcard/out.tif\", options, progressListener);\n```\n\nIf you need convert tiff to some other format:\n```Java\nTiffConverter.ConverterOptions options = new TiffConverter.ConverterOptions();\noptions.throwExceptions = false; //Set to true if you want use java exception mechanism;\noptions.availableMemory = 128 * 1024 * 1024; //Available 128Mb for work;\noptions.readTiffDirectory = 1; //Number of tiff directory to convert;\n        \n//Convert to JPEG\nTiffConverter.convertTiffJpg(\"/sdcard/in.tif\", \"/sdcard/out.jpg\", options, progressListener);\n//Convert to PNG\nTiffConverter.convertTiffPng(\"/sdcard/in.tif\", \"/sdcard/out.png\", options, progressListener);\n//Convert to BMP\nTiffConverter.convertTiffBmp(\"/sdcard/in.tif\", \"/sdcard/out.bmp\", options, progressListener);\n```\nFor now library support JPEG, PNG and BMP formats for converting.\n\n\n#### Progress listener\nAll operations(read, create, convert) have support for progress reporting.\n```Java\nIProgressListener progressListener = new IProgressListener() {\n    @Override\n    public void reportProgress(long processedPixels, long totalPixels) {\n        Log.v(\"Progress reporter\", String.format(\"Processed %d pixels from %d\", processedPixels, totalPixels);\n    }\n};\n```\n\n### Proguard\nIf you use proguard add this to you config file:\n```Gradle\n-keep class org.beyka.tiffbitmapfactory.**{ *; }\n```\n\n### \nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\nSpecial thanks to [dennis508](https://github.com/dennis508)    for providing of incremental reading of TIFF file\n\n\n### Applications that use library:\n* [B Tiff Viewer](https://play.google.com/store/apps/details?id=com.beyka.btiffviewer)\n* Image Converter [[GitHub](https://github.com/vbresan/Image_Converter)] [[Google Play](https://play.google.com/store/apps/details?id=biz.binarysolutions.imageconverter.ggl)]\n"
  },
  {
    "path": "build.gradle",
    "content": "plugins {\n    id \"com.android.library\"\n}\n\nandroid {\n    compileSdkVersion 30\n    buildToolsVersion '30.0.3'\n\n    def softwareName\n\n    defaultConfig {\n        minSdkVersion 16\n        targetSdkVersion 30\n        versionCode 987\n        versionName \"0.9.9.0\"\n\n        softwareName = \"\\\"\" + project.name + \"-\" + versionName + \"\\\"\"\n    }\n\n    buildTypes {\n        release {\n            minifyEnabled false\n            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'\n            buildConfigField(\"String\", \"softwarename\", softwareName)\n        }\n        debug {\n            minifyEnabled false\n            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'\n            buildConfigField(\"String\", \"softwarename\", softwareName)\n        }\n    }\n\n    ndkVersion \"21.3.6528147\"\n\n    sourceSets.main {\n        jni.srcDirs = []\n        jniLibs.srcDir 'src/main/libs'\n    }\n}\n\nandroid {\n    lintOptions {\n        abortOnError false\n    }\n}\n\ndependencies {\n}\n\next {\n    PUBLISH_GROUP_ID = 'io.github.beyka'\n    PUBLISH_VERSION = '0.9.9.0'\n    PUBLISH_ARTIFACT_ID = 'Android-TiffBitmapFactory'\n}\napply from: \"${rootProject.projectDir}/publish-module.gradle\"\n"
  },
  {
    "path": "license.txt",
    "content": "The MIT License (MIT)\n\nCopyright © «2018» «Oleksii Bei aka Beyka»\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n"
  },
  {
    "path": "proguard-rules.pro",
    "content": "# Add project specific ProGuard rules here.\n# By default, the flags in this file are appended to flags specified\n# in /home/alexeyba/android-sdk-linux/tools/proguard/proguard-android.txt\n# You can edit the include path and order by changing the proguardFiles\n# directive in build.gradle.\n#\n# For more details, see\n#   http://developer.android.com/guide/developing/tools/proguard.html\n\n# Add any project specific keep options here:\n\n# If your project uses WebView with JS, uncomment the following\n# and specify the fully qualified class name to the JavaScript interface\n# class:\n#-keepclassmembers class fqcn.of.javascript.interface.for.webview {\n#   public *;\n#}\n"
  },
  {
    "path": "src/androidTest/java/org/beyka/tiffbitmapfactory/ApplicationTest.java",
    "content": "package org.beyka.tiffbitmapfactory;\n\nimport android.app.Application;\nimport android.test.ApplicationTestCase;\n\n/**\n * <a href=\"http://d.android.com/tools/testing/testing_android.html\">Testing Fundamentals</a>\n */\npublic class ApplicationTest extends ApplicationTestCase<Application> {\n    public ApplicationTest() {\n        super(Application.class);\n    }\n}"
  },
  {
    "path": "src/main/.gitignore",
    "content": "/obj/\n"
  },
  {
    "path": "src/main/AndroidManifest.xml",
    "content": "<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    package=\"org.beyka.tiffbitmapfactory\">\n\n    <application android:label=\"@string/app_name\">\n\n    </application>\n\n</manifest>\n"
  },
  {
    "path": "src/main/java/org/beyka/tiffbitmapfactory/CompressionScheme.java",
    "content": "package org.beyka.tiffbitmapfactory;\n\n/**\n * Created by beyka on 5.1.17.\n */\n\npublic enum CompressionScheme {\n    /**\n     * No compression\n     */\n    NONE(1),\n    /**\n     * CCITT modified Huffman RLE\n     */\n    CCITTRLE(2),\n    /**\n     * CCITT Group 3 fax encoding\n     */\n    CCITTFAX3(3),\n    /**\n     * CCITT Group 4 fax encoding\n     */\n    CCITTFAX4(4),\n    /**\n     * LZW\n     */\n    LZW(5),\n    /**\n     * JPEG ('new-style' JPEG)\n     */\n    JPEG(7),\n    PACKBITS(32773),\n    DEFLATE(32946),\n    ADOBE_DEFLATE(8),\n    /**\n     * All other compression schemes\n     */\n    OTHER(0);\n\n    final int ordinal;\n\n    CompressionScheme(int ordinal) {\n        this.ordinal = ordinal;\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/beyka/tiffbitmapfactory/DecodeArea.java",
    "content": "package org.beyka.tiffbitmapfactory;\n\n/**\n * Created by beyka on 10/24/17.\n */\n\n/**\n * Holder for points of decode area\n */\npublic class DecodeArea {\n    public int x;\n    public int y;\n    public int width;\n    public int height;\n\n    public DecodeArea(){}\n\n    public DecodeArea(int x, int y, int width, int height) {\n        this.x = x;\n        this.y = y;\n        this.width = width;\n        this.height = height;\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/beyka/tiffbitmapfactory/FillOrder.java",
    "content": "package org.beyka.tiffbitmapfactory;\n\n/**\n * Created by beyka on 4/16/17.\n */\n\npublic enum FillOrder {\n\n    /**\n     * Pixels with lower column values are stored in the higher-order bits of the byte.\n     */\n    MSB2LSB(1),\n\n    /**\n     * Pixels with lower column values are stored in the lower-order bits of the byte.\n     */\n    LSB2MSB(2);\n\n    final int ordinal;\n\n    FillOrder(int ordinal) {\n        this.ordinal = ordinal;\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/beyka/tiffbitmapfactory/IProgressListener.java",
    "content": "package org.beyka.tiffbitmapfactory;\n\n/**\n * Created by beyka on 4/26/17.\n */\n\npublic interface IProgressListener {\n    public void reportProgress(long processedPixels, long totalPixels);\n}\n"
  },
  {
    "path": "src/main/java/org/beyka/tiffbitmapfactory/ImageFormat.java",
    "content": "package org.beyka.tiffbitmapfactory;\n\n/**\n * Supported image formats\n */\n\npublic enum ImageFormat {\n    UNKNOWN(0),\n    JPEG(1),\n    PNG(2),\n    TIFF(4),\n    BMP(5);\n\n    final int ordinal;\n\n    ImageFormat(int ordinal) {\n        this.ordinal = ordinal;\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/beyka/tiffbitmapfactory/Orientation.java",
    "content": "package org.beyka.tiffbitmapfactory;\n\n/**\n * Created by beyka on 5.1.17.\n */\n\npublic enum Orientation {\n    TOP_LEFT(1),\n    TOP_RIGHT(2),\n    BOT_RIGHT(3),\n    BOT_LEFT(4),\n    LEFT_TOP(5),\n    RIGHT_TOP(6),\n    RIGHT_BOT(7),\n    LEFT_BOT(8),\n    UNAVAILABLE(0);\n\n    final int ordinal;\n\n    Orientation(int ordinal) {\n        this.ordinal = ordinal;\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/beyka/tiffbitmapfactory/Photometric.java",
    "content": "package org.beyka.tiffbitmapfactory;\n\n/**\n * Created by beyka on 4/16/17.\n */\n\npublic enum Photometric {\n\n    /**\n     * WhiteIsZero. For bilevel and grayscale images: 0 is imaged as white.\n     */\n    MINISWHITE(0),\n\n    /**\n     * BlackIsZero. For bilevel and grayscale images: 0 is imaged as black.\n     */\n    MINISBLACK(1),\n\n    /**\n     * RGB value of (0,0,0) represents black, and (255,255,255) represents white, assuming 8-bit components. The components are stored in the indicated order: first Red, then Green, then Blue.\n     */\n    RGB(2),\n\n    /**\n     * Palette color. In this model, a color is described with a single component. The value of the component is used as an index into the red, green and blue curves in the ColorMap field to retrieve an RGB triplet that defines the color. When PhotometricInterpretation=3 is used, ColorMap must be present and SamplesPerPixel must be 1.\n     */\n    PALETTE(3),\n\n    /**\n     * Transparency Mask. This means that the image is used to define an irregularly shaped region of another image in the same TIFF file. SamplesPerPixel and BitsPerSample must be 1. PackBits compression is recommended. The 1-bits define the interior of the region; the 0-bits define the exterior of the region.\n     */\n    MASK(4),\n\n    /**\n     * Seperated, usually CMYK.\n     */\n    SEPARATED(5),\n\n    /**\n     * YCbCr\n     */\n    YCBCR(6),\n\n    /**\n     * CIE L*a*b*\n     */\n    CIELAB(8),\n\n    /**\n     * CIE L*a*b*, alternate encoding also known as ICC L*a*b*\n     */\n    ICCLAB(9),\n\n    /**\n     * CIE L*a*b*, alternate encoding also known as ITU L*a*b*, defined in ITU-T Rec. T.42, used in the TIFF-F and TIFF-FX standard (RFC 2301). The Decode tag, if present, holds information about this particular CIE L*a*b* encoding.\n     */\n    ITULAB(10),\n\n    /**\n     * LOGL\n     */\n    LOGL(32844),\n\n    /**\n     * LOGLUV\n     */\n    LOGLUV(32845),\n\n    /**\n     * Some unknown photometric\n     */\n    OTHER(-1);\n\n    final int ordinal;\n\n    Photometric(int ordinal) {\n        this.ordinal = ordinal;\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/beyka/tiffbitmapfactory/PlanarConfig.java",
    "content": "package org.beyka.tiffbitmapfactory;\n\n/**\n * Created by beyka on 4/16/17.\n */\n\npublic enum PlanarConfig {\n    CONTIG(1),\n    SEPARATE(2);\n\n    final int ordinal;\n\n    PlanarConfig(int ordinal) {\n        this.ordinal = ordinal;\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/beyka/tiffbitmapfactory/ResolutionUnit.java",
    "content": "package org.beyka.tiffbitmapfactory;\n\n/**\n * Created by beyka on 13.3.17.\n */\n\npublic enum ResolutionUnit {\n    NONE(1),\n    INCH(2),\n    CENTIMETER(3);\n\n    final int ordinal;\n\n    ResolutionUnit(int ordinal) {\n        this.ordinal = ordinal;\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/beyka/tiffbitmapfactory/TiffBitmapFactory.java",
    "content": "package org.beyka.tiffbitmapfactory;\n\nimport android.graphics.Bitmap;\nimport android.util.Log;\n\nimport org.beyka.tiffbitmapfactory.exceptions.CantOpenFileException;\nimport org.beyka.tiffbitmapfactory.exceptions.NotEnoughtMemoryException;\nimport org.beyka.tiffbitmapfactory.exceptions.DecodeTiffException;\n\nimport java.io.File;\n\n/**\n * Created by alexeyba on 7/17/15.\n */\npublic class TiffBitmapFactory {\n\n    static {\n        System.loadLibrary(\"tiff\");\n        System.loadLibrary(\"tifffactory\");\n    }\n\n    public enum ImageConfig {\n        /**\n         * Each pixel is stored on 4 bytes. Each channel (RGB and alpha\n         * for translucency) is stored with 8 bits of precision (256\n         * possible values.)\n         *\n         * This configuration is very flexible and offers the best\n         * quality. It should be used whenever possible.\n         */\n        ARGB_8888 (2),\n        /**\n         * Each pixel is stored on 2 bytes and only the RGB channels are\n         * encoded: red is stored with 5 bits of precision (32 possible\n         * values), green is stored with 6 bits of precision (64 possible\n         * values) and blue is stored with 5 bits of precision.\n         *\n         * This configuration can produce slight visual artifacts depending\n         * on the configuration of the source. For instance, without\n         * dithering, the result might show a greenish tint. To get better\n         * results dithering should be applied.\n         *\n         * This configuration may be useful when using opaque bitmaps\n         * that do not require high color fidelity.\n         */\n        RGB_565 (4),\n        /**\n         * Each pixel is stored as a single translucency (alpha) channel.\n         * This is very useful to efficiently store masks for instance.\n         * No color information is stored.\n         * With this configuration, each pixel requires 1 byte of memory.\n         */\n        ALPHA_8 (8);\n\n\n        final int ordinal;\n        ImageConfig(int ordinal) {\n            this.ordinal = ordinal;\n        }\n    }\n\n    /**\n     * @deprecated Since Android Q is released. You can use this method with scoped storage.\n     * Otherwise use {@link TiffBitmapFactory#decodeFileDescriptor(int)}.\n     * <p></p>\n     * Decode file to bitmap with default options. If the specified file name is null,\n     * or cannot be decoded into a bitmap, the function returns null.\n     * @param file - file to decode\n     * @return The decoded bitmap, or null if the image data could not be\n     *         decoded\n     *\n     * @throws org.beyka.tiffbitmapfactory.exceptions.DecodeTiffException when error occure while decoding image\n     * @throws org.beyka.tiffbitmapfactory.exceptions.CantOpenFileException when {@code file} not exist or {@code file} is not tiff image\n     * @throws org.beyka.tiffbitmapfactory.exceptions.NotEnoughtMemoryException when for decoding of image system need more memory than {@link Options#inAvailableMemory} or default value\n     */\n    public static Bitmap decodeFile(File file) throws CantOpenFileException, DecodeTiffException, NotEnoughtMemoryException {\n        return decodeFile(file, new Options(), null);\n    }\n\n    /**\n     * @deprecated Since Android Q is released. You can use this method with scoped storage.\n     * Otherwise use {@link TiffBitmapFactory#decodeFileDescriptor(int, Options)}.\n     * <p></p>\n     * Decode file to bitmap with specified options. If the specified file name is null,\n     * or cannot be decoded into a bitmap, the function returns null.\n     * @param file - file to decode\n     * @param options - options for decoding\n     * @return The decoded bitmap, or null if the image data could not be\n     *         decoded, or, if options is non-null, if options requested only the\n     *         size be returned (in {@link Options#outWidth}, {@link Options#outHeight}, {@link Options#outDirectoryCount})\n     * @throws org.beyka.tiffbitmapfactory.exceptions.DecodeTiffException when error occure while decoding image\n     * @throws org.beyka.tiffbitmapfactory.exceptions.CantOpenFileException when {@code file} not exist or {@code file} is not tiff image\n     * @throws org.beyka.tiffbitmapfactory.exceptions.NotEnoughtMemoryException when {@link Options#inAvailableMemory} not enought to decode image\n     */\n    public static Bitmap decodeFile(File file, Options options) throws CantOpenFileException, DecodeTiffException, NotEnoughtMemoryException {\n        return decodeFile(file, options, null);\n    }\n\n    /**\n     * @deprecated Since Android Q is released. You can use this method with scoped storage.\n     * Otherwise use {@link TiffBitmapFactory#decodeFileDescriptor(int, Options, IProgressListener)}.\n     * <p></p>\n     * Decode file to bitmap with specified options. If the specified file name is null,\n     * or cannot be decoded into a bitmap, the function returns null.\n     * @param file - file to decode\n     * @param options - options for decoding\n     * @param listener - listener which will receive decoding progress\n     * @return The decoded bitmap, or null if the image data could not be\n     *         decoded, or, if options is non-null, if options requested only the\n     *         size be returned (in {@link Options#outWidth}, {@link Options#outHeight}, {@link Options#outDirectoryCount})\n     * @throws org.beyka.tiffbitmapfactory.exceptions.DecodeTiffException when error occure while decoding image\n     * @throws org.beyka.tiffbitmapfactory.exceptions.CantOpenFileException when {@code file} not exist or {@code file} is not tiff image\n     * @throws org.beyka.tiffbitmapfactory.exceptions.NotEnoughtMemoryException when {@link Options#inAvailableMemory} not enought to decode image\n     */\n    public static Bitmap decodeFile(File file, Options options, IProgressListener listener) throws CantOpenFileException, DecodeTiffException, NotEnoughtMemoryException {\n        long time = System.currentTimeMillis();\n        Log.i(\"THREAD\", \"Starting decode \" + file.getAbsolutePath());\n        Bitmap mbp = nativeDecodePath(file.getAbsolutePath(), options, listener);\n        Log.w(\"THREAD\", \"elapsed ms: \" + (System.currentTimeMillis() - time) + \" for \" + file.getAbsolutePath());\n        return mbp;\n    }\n\n    /**\n     * @deprecated Since Android Q is released. You can use this method with scoped storage.\n     * Otherwise use {@link TiffBitmapFactory#decodeFileDescriptor(int)}.\n     * <p></p>\n     * Decode path to bitmap with default options. If the specified file name is null,\n     * or cannot be decoded into a bitmap, the function returns null.\n     * @param path - file to decode\n     * @return The decoded bitmap, or null if the image data could not be\n     *         decoded\n     *\n     * @throws org.beyka.tiffbitmapfactory.exceptions.DecodeTiffException when error occure while decoding image\n     * @throws org.beyka.tiffbitmapfactory.exceptions.CantOpenFileException when {@code file} not exist or {@code file} is not tiff image\n     * @throws org.beyka.tiffbitmapfactory.exceptions.NotEnoughtMemoryException when for decoding of image system need more memory than {@link Options#inAvailableMemory} or default value\n     */\n    public static Bitmap decodePath(String path) throws CantOpenFileException, DecodeTiffException, NotEnoughtMemoryException {\n        return decodePath(path, new Options(), null);\n    }\n\n    /**\n     * @deprecated Since Android Q is released. You can use this method with scoped storage.\n     * Otherwise use {@link TiffBitmapFactory#decodeFileDescriptor(int, Options)}.\n     * <p></p>\n     * Decode path to bitmap with specified options. If the specified file name is null,\n     * or cannot be decoded into a bitmap, the function returns null.\n     * @param path - file to decode\n     * @param options - options for decoding\n     * @return The decoded bitmap, or null if the image data could not be\n     *         decoded, or, if options is non-null, if options requested only the\n     *         size be returned (in {@link Options#outWidth}, {@link Options#outHeight}, {@link Options#outDirectoryCount})\n     *\n     * @throws org.beyka.tiffbitmapfactory.exceptions.DecodeTiffException when error occure while decoding image\n     * @throws org.beyka.tiffbitmapfactory.exceptions.CantOpenFileException when {@code file} not exist or {@code file} is not tiff image\n     * @throws org.beyka.tiffbitmapfactory.exceptions.NotEnoughtMemoryException when for decoding of image system need more memory than {@link Options#inAvailableMemory} or default value\n     */\n    public static Bitmap decodePath(String path, Options options) throws CantOpenFileException, DecodeTiffException, NotEnoughtMemoryException {\n        return decodePath(path, options);\n    }\n\n    /**\n     * @deprecated Since Android Q is released. You can use this method with scoped storage.\n     * Otherwise use {@link TiffBitmapFactory#decodeFileDescriptor(int, Options, IProgressListener)}.\n     * <p></p>\n     * Decode path to bitmap with specified options. If the specified file name is null,\n     * or cannot be decoded into a bitmap, the function returns null.\n     * @param path - file to decode\n     * @param options - options for decoding\n     * @param listener - listener which will receive decoding progress\n     * @return The decoded bitmap, or null if the image data could not be\n     *         decoded, or, if options is non-null, if options requested only the\n     *         size be returned (in {@link Options#outWidth}, {@link Options#outHeight}, {@link Options#outDirectoryCount})\n     *\n     * @throws org.beyka.tiffbitmapfactory.exceptions.DecodeTiffException when error occure while decoding image\n     * @throws org.beyka.tiffbitmapfactory.exceptions.CantOpenFileException when {@code file} not exist or {@code file} is not tiff image\n     * @throws org.beyka.tiffbitmapfactory.exceptions.NotEnoughtMemoryException when for decoding of image system need more memory than {@link Options#inAvailableMemory} or default value\n     */\n    public static Bitmap decodePath(String path, Options options, IProgressListener listener) throws CantOpenFileException, DecodeTiffException, NotEnoughtMemoryException {\n        long time = System.currentTimeMillis();\n        Log.i(\"THREAD\", \"Starting decode \" + path);\n        Bitmap mbp = nativeDecodePath(path, options, listener);\n        Log.w(\"THREAD\", \"elapsed ms: \" + (System.currentTimeMillis() - time) + \" for \" + path);\n        return mbp;\n    }\n\n    /**\n     * Decode file descriptor to bitmap with specified options. If the specified file name is null,\n     * or cannot be decoded into a bitmap, the function returns null.\n     * @param fileDescriptor - file descriptor that represent file to decode\n     * @return The decoded bitmap, or null if the image data could not be\n     *         decoded, or, if options is non-null, if options requested only the\n     *         size be returned (in {@link Options#outWidth}, {@link Options#outHeight}, {@link Options#outDirectoryCount})\n     *\n     * @throws org.beyka.tiffbitmapfactory.exceptions.DecodeTiffException when error occure while decoding image\n     * @throws org.beyka.tiffbitmapfactory.exceptions.CantOpenFileException when {@code file} not exist or {@code file} is not tiff image\n     * @throws org.beyka.tiffbitmapfactory.exceptions.NotEnoughtMemoryException when for decoding of image system need more memory than {@link Options#inAvailableMemory} or default value\n     */\n    public static Bitmap decodeFileDescriptor(int fileDescriptor) throws CantOpenFileException, DecodeTiffException, NotEnoughtMemoryException {\n        return decodeFileDescriptor(fileDescriptor, new Options(), null);\n    }\n\n    /**\n     * Decode file descriptor to bitmap with specified options. If the specified file name is null,\n     * or cannot be decoded into a bitmap, the function returns null.\n     * @param fileDescriptor - file descriptor that represent file to decode\n     * @param options - options for decoding\n     * @return The decoded bitmap, or null if the image data could not be\n     *         decoded, or, if options is non-null, if options requested only the\n     *         size be returned (in {@link Options#outWidth}, {@link Options#outHeight}, {@link Options#outDirectoryCount})\n     *\n     * @throws org.beyka.tiffbitmapfactory.exceptions.DecodeTiffException when error occure while decoding image\n     * @throws org.beyka.tiffbitmapfactory.exceptions.CantOpenFileException when {@code file} not exist or {@code file} is not tiff image\n     * @throws org.beyka.tiffbitmapfactory.exceptions.NotEnoughtMemoryException when for decoding of image system need more memory than {@link Options#inAvailableMemory} or default value\n     */\n    public static Bitmap decodeFileDescriptor(int fileDescriptor, Options options) throws CantOpenFileException, DecodeTiffException, NotEnoughtMemoryException {\n        return decodeFileDescriptor(fileDescriptor, options, null);\n    }\n\n    /**\n     * Decode file descriptor to bitmap with specified options. If the specified file name is null,\n     * or cannot be decoded into a bitmap, the function returns null.\n     * @param fileDescriptor - file descriptor that represent file to decode\n     * @param options - options for decoding\n     * @param listener - listener which will receive decoding progress\n     * @return The decoded bitmap, or null if the image data could not be\n     *         decoded, or, if options is non-null, if options requested only the\n     *         size be returned (in {@link Options#outWidth}, {@link Options#outHeight}, {@link Options#outDirectoryCount})\n     *\n     * @throws org.beyka.tiffbitmapfactory.exceptions.DecodeTiffException when error occure while decoding image\n     * @throws org.beyka.tiffbitmapfactory.exceptions.CantOpenFileException when {@code file} not exist or {@code file} is not tiff image\n     * @throws org.beyka.tiffbitmapfactory.exceptions.NotEnoughtMemoryException when for decoding of image system need more memory than {@link Options#inAvailableMemory} or default value\n     */\n    public static Bitmap decodeFileDescriptor(int fileDescriptor, Options options, IProgressListener listener) throws CantOpenFileException, DecodeTiffException, NotEnoughtMemoryException {\n        long time = System.currentTimeMillis();\n        Log.i(\"THREAD\", \"Starting decode descriptor \" + fileDescriptor);\n        Bitmap mbp = nativeDecodeFD(fileDescriptor, options, listener);\n        Log.w(\"THREAD\", \"elapsed ms: \" + (System.currentTimeMillis() - time) + \" for descriptor \" + fileDescriptor);\n        return mbp;\n    }\n\n    private static native Bitmap nativeDecodePath(String path, Options options, IProgressListener listener);\n\n    private static native Bitmap nativeDecodeFD(int fd, Options options, IProgressListener listener);\n\n    /**\n     * Close detached file descriptor\n     * @param fd\n     */\n    public static native void closeFd(int fd);\n\n    /**\n     * Options class to specify decoding parameterMs\n     */\n    public static final class Options {\n\n        /**\n         * Create a default Options object, which if left unchanged will give\n         * the same result from the decoder as if null were passed.\n         */\n        public Options() {\n            isStoped = false;\n\n            inThrowException = false;\n            inUseOrientationTag = false;\n            inSwapRedBlueColors = false;\n            inJustDecodeBounds = false;\n            inSampleSize = 1;\n            inDirectoryNumber = 0;\n            inAvailableMemory = 8000*8000*4;\n\n            outWidth = -1;\n            outHeight = -1;\n            outDirectoryCount = -1;\n            outImageOrientation = Orientation.UNAVAILABLE;\n        }\n\n        /**\n         * Uses for stoping of native thread\n         * @deprecated As of release 0.9.8.4, replaced by {@link Thread#interrupt()}\n         */\n        private volatile boolean isStoped;\n\n        /**\n         * Stop native decoding thread\n         * If decoding is started in any thread except main, calling of this method will cause force stop of decoding and returning of null object.\n         * @deprecated As of release 0.9.8.4, replaced by {@link Thread#interrupt()}\n         */\n        public void stop() {\n            isStoped = true;\n        }\n\n        /**\n         * If set to true decoder will rotate and flip image according to TIFFTAG_ORIENTATION.\n         * Otherwise image will be returned as it decoded.\n         * <p>The specification considers this a baseline tag, but does add that support for orientations other than 1 is not a Baseline TIFF requirement.</p>\n         * So for almost all cases this variable may be false.\n         * <p>Default value is false</p>\n         */\n        public boolean inUseOrientationTag;\n\n        /**\n         * If set to true, decoder will throw exceptions if some errors appeared while decoding.\n         * Otherwise  decoder will just return null.\n         * Default value is false\n         */\n        public boolean inThrowException;\n\n        /**\n         * If set to true, the decoder will swap red and blue colors.\n         * <p>Note: If you use this option then your image has wrong encoding</p>\n         * <p>Default value is false</p>\n         */\n        public boolean inSwapRedBlueColors;\n\n        /**\n         * If set to true, the decoder will return null (no bitmap), but\n         * the out... fields will still be set, allowing the caller to query\n         * the bitmap without having to allocate the memory for its pixels.\n         */\n        public boolean inJustDecodeBounds;\n\n        /**\n         * If set to a value &gt; 1, requests the decoder to subsample the original\n         * image, returning a smaller image to save memory. The sample size is\n         * the number of pixels in either dimension that correspond to a single\n         * pixel in the decoded bitmap. For example, inSampleSize == 4 returns\n         * an image that is 1/4 the width/height of the original, and 1/16 the\n         * number of pixels. Any value &lt;= 1 is treated the same as 1. Note: the\n         * decoder uses a final value based on powers of 2, any other value will\n         * be rounded down to the nearest power of 2.\n         */\n        public int inSampleSize;\n\n        /**\n         * Set directory to extract from image. Default value is 0.\n         * To get number of directories in file see {@link #outDirectoryCount}\n         */\n        public int inDirectoryNumber;\n        \n        /**\n         * Number of bytes that may be allocated during the Tiff file operations.\n         * <p>-1 means memory is unlimited.</p>\n         * <p>Default value is 244Mb</p>\n         */\n        public long inAvailableMemory;\n\n        /**\n         * If this is non-null, the decoder will try to decode into this\n         * internal configuration. If it is null, or the request cannot be met,\n         * the decoder will use {@link ImageConfig#ARGB_8888} configuration.\n         *\n         * <p>Numeration starts with 0</p>\n         *\n         * <p>Image are loaded with the {@link ImageConfig#ARGB_8888} config by\n         * default.</p>\n         *\n         * <p>In current version supported are {@link ImageConfig#ARGB_8888}, {@link ImageConfig#ALPHA_8} and {@link ImageConfig#RGB_565}</p>\n         */\n        public ImageConfig inPreferredConfig = ImageConfig.ARGB_8888;\n\n        /**\n         * If this field is non-null - Decoder will decode and return only area specified in {@link DecodeArea} object\n         * For decoding not full bitmap, but only part of it - create new {@link DecodeArea} object and specify:\n         * <p>{@link DecodeArea#x x}, {@link DecodeArea#y y} - left top corner of decoding area </p>\n         * <p>{@link DecodeArea#width width} - width of decoding area </p>\n         * <p>{@link DecodeArea#height height} - height of decoding area </p>\n         */\n        public DecodeArea inDecodeArea;\n\n        /**\n         * The resulting width of the bitmap. If {@link #inJustDecodeBounds} is\n         * set to false, this will be width of the output bitmap after any\n         * scaling is applied. If true, it will be the width of the input image\n         * without any accounting for scaling.\n         *\n         * <p>outWidth will be set to -1 if there is an error trying to decode.</p>\n         */\n        public int outWidth;\n\n        /**\n         * The resulting height of the bitmap. If {@link #inJustDecodeBounds} is\n         * set to false, this will be height of the output bitmap after any\n         * scaling is applied. If true, it will be the height of the input image\n         * without any accounting for scaling.\n         *\n         * <p>outHeight will be set to -1 if there is an error trying to decode.</p>\n         */\n        public int outHeight;\n\n        /**\n         * The number of current directory.\n         * <p>curDirectoryNumber will be set to -1 if there is an error trying to decode.</p>\n         */\n        public int outCurDirectoryNumber;\n\n        /**\n         * The count of directory in image file.\n         * <p>outDirectoryCount will be set to -1 if there is an error trying to decode.</p>\n         */\n        public int outDirectoryCount;\n\n        /**\n         * This parameter returns orientation of decoded image\n         * <p>For storing orientation uses {@link org.beyka.tiffbitmapfactory.Orientation ImageOrientation} enum</p>\n         * <p>If image wasn't decoded successful this parameter will be equal to {@link Orientation#UNAVAILABLE}</p>\n         * <p>This parameter is link to TIFFTAG_ORIENTATION tag</p>\n         */\n        public Orientation outImageOrientation;\n\n        /**\n         * This parameter returns compression scheme of decoded image\n         * <p>For storing compression mode uses {@link CompressionScheme CompressionScheme} enum</p>\n         * <p>This parameter is link to TIFFTAG_COMPRESSION tag</p>\n         */\n        public CompressionScheme outCompressionScheme;\n\n        /**\n         * How the components of each pixel are stored.\n         * <p>The specification defines these values:</p>\n         * <ul>\n         *  <li>1 = Chunky format. The component values for each pixel are stored contiguously. For example, for RGB data, the data is stored as RGBRGBRGB</li>\n         *  <li>2 = Planar format. The components are stored in separate component planes. For example, RGB data is stored with the Red components in one component plane, the Green in another, and the Blue in another.</li>\n         * </ul>\n         * <p>This parameter is link to TIFFTAG_PLANARCONFIG tag</p>\n         */\n        public PlanarConfig outPlanarConfig;\n\n        /**\n         * The number of components per pixel.\n         * <p>SamplesPerPixel is usually 1 for bilevel, grayscale, and palette-color images. SamplesPerPixel is usually 3 for RGB images. If this value is higher, ExtraSamples should give an indication of the meaning of the additional channels.</p>\n         */\n        public int outSamplePerPixel;\n\n        /**\n         * Number of bits per component.\n         */\n        public int outBitsPerSample;\n\n        /**\n         * The number of pixels per {@link org.beyka.tiffbitmapfactory.TiffBitmapFactory.Options#outResolutionUnit} in the ImageWidth direction.\n         */\n        public float outXResolution;\n\n        /**\n         * The number of pixels per {@link org.beyka.tiffbitmapfactory.TiffBitmapFactory.Options#outResolutionUnit} in the ImageHeight direction.\n         */\n        public float outYResolution;\n\n        /**\n         * The unit of measurement for XResolution and YResolution.\n         * <p>The specification defines these values: </p>\n         * <ul>\n         *     <li>RESUNIT_NONE</li>\n         *     <li>RESUNIT_INCH</li>\n         *     <li>RESUNIT_CENTIMETER</li>\n         * </ul>\n         * <p>This parameter is link to TIFFTAG_RESOLUTIONUNIT tag</p>\n         */\n        public ResolutionUnit outResolutionUnit;\n\n        /**\n         * The tile width in pixels. This is the number of columns in each tile.\n         */\n        public int outTileWidth;\n\n        /**\n         * The tile height in pixels. This is the number of rows in each tile.\n         */\n        public int outTileHeight;\n\n        /**\n         * The number of rows per strip.\n         * <p>RowsPerStrip and ImageLength together tell us the number of strips in the entire image.</p>\n         */\n        public int outRowPerStrip;\n\n        /**\n         * Size for a strip of data in bytes.\n         */\n        public int outStripSize;\n\n        /**\n         * Number of strips in the image.\n         */\n        public int outNumberOfStrips;\n\n        /**\n         * The color space of the image data.\n         * <p>This parameter is link to TIFFTAG_PHOTOMETRIC tag</p>\n         */\n        public Photometric outPhotometric;\n\n        /**\n         *  The logical order of bits within a byte.\n         * <p>The specification defines these values:</p>\n         * <ul>\n         *  <li>1 = Pixels with lower column values are stored in the higher-order bits of the byte.</li>\n         *  <li>2 = Pixels with lower column values are stored in the lower-order bits of the byte.</li>\n         * </ul>\n         * <p>This parameter is link to TIFFTAG_PLANARCONFIG tag</p>\n         */\n        public FillOrder outFillOrder;\n\n        /**\n         * Author of file.\n         * <p>This parameter is link to TIFFTAG_ARTIST tag</p>\n         */\n        public String outAuthor = \"\";\n\n        /**\n         * Copyright of file\n         * <p>This parameter is link to TIFFTAG_COPYRIGHT tag</p>\n         */\n        public String outCopyright = \"\";\n\n        /**\n         * A string that describes the subject of the image.\n         * <p>This parameter is link to TIFFTAG_IMAGEDESCRIPTION tag</p>\n         */\n        public String outImageDescription = \"\";\n\n        /**\n         * Name and version number of the software package(s) used to create the image.\n         * <p>This parameter is link to TIFFTAG_SOFTWARE tag</p>\n         */\n        public String outSoftware = \"\";\n\n        /**\n         * Date and time of image creation. The format is: \"YYYY:MM:DD HH:MM:SS\", with hours like those on a 24-hour clock.\n         * <p>This parameter is link to TIFFTAG_DATETIME tag</p>\n         */\n        public String outDatetime = \"\";\n\n        /**\n         * The computer and/or operating system in use at the time of image creation.\n         * <p>This parameter is link to TIFFTAG_HOSTCOMPUTER tag</p>\n         */\n        public String outHostComputer = \"\";\n\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/beyka/tiffbitmapfactory/TiffConverter.java",
    "content": "package org.beyka.tiffbitmapfactory;\n\nimport org.beyka.tiffbitmapfactory.exceptions.CantOpenFileException;\nimport org.beyka.tiffbitmapfactory.exceptions.DecodeTiffException;\nimport org.beyka.tiffbitmapfactory.exceptions.NotEnoughtMemoryException;\n\nimport java.io.File;\n\n/**\n * Created by beyka on 5/9/17.\n */\n\npublic class TiffConverter {\n    static {\n        System.loadLibrary(\"tiff\");\n        System.loadLibrary(\"tiffconverter\");\n    }\n\n    /**\n     * @deprecated Since Android Q is released. You can use this method with scoped storage.\n     * Otherwise use {@link TiffConverter#convertToTiff(int, int, ConverterOptions, IProgressListener)}.\n     * <p></p>\n     * Convert any of supported formats from {@link ImageFormat} to tiff\n     * @param inFile path to income tiff file\n     * @param outFile path to outcome tiff file\n     * @param options converter options\n     * @param listener listener which will receive converting progress\n     *\n     * @return true if convert process have been successful\n     */\n    public static boolean convertToTiff(File inFile, File outFile, ConverterOptions options, IProgressListener listener) throws CantOpenFileException, DecodeTiffException, NotEnoughtMemoryException {\n        return convertToTiff(inFile.getAbsolutePath(), outFile.getAbsolutePath(), options, listener);\n    }\n\n    /**\n     * @deprecated Since Android Q is released. You can use this method with scoped storage.\n     * Otherwise use {@link TiffConverter#convertToTiff(int, int, ConverterOptions, IProgressListener)}.\n     * <p></p>\n     * Convert any of supported formats from {@link ImageFormat} to tiff\n     * @param inPath path to income tiff file\n     * @param outPath path to outcome tiff file\n     * @param options converter options\n     * @param listener listener which will receive converting progress\n     *\n     * @return true if convert process have been successful\n     */\n    public static boolean convertToTiff(String inPath, String outPath, ConverterOptions options, IProgressListener listener) throws CantOpenFileException, DecodeTiffException, NotEnoughtMemoryException {\n        switch (getImageType(inPath)) {\n            case JPEG:\n                return convertJpgTiff(inPath, outPath, options, listener);\n            case PNG:\n                return convertPngTiff(inPath, outPath, options, listener);\n            case BMP:\n                return convertBmpTiff(inPath, outPath, options, listener);\n            case TIFF:\n                // TODO: 9/19/17 make convert tiff to tiff method\n                break;\n        }\n        return false;\n    }\n\n    /**\n     * Convert any of supported formats from {@link ImageFormat} to tiff\n     * This method don't close file descriptor\n     * @param inFd file descriptor that represent income file\n     * @param outFd file descriptor that represent outcome tiff file\n     * @param options converter options\n     * @param listener listener which will receive converting progress\n     *\n     * @return true if convert process have been successful\n     */\n    public static boolean convertToTiff(int inFd, int outFd, ConverterOptions options, IProgressListener listener) throws CantOpenFileException, DecodeTiffException, NotEnoughtMemoryException {\n        switch (getImageTypeFd(inFd)) {\n            case JPEG:\n                return convertJpgTiffFd(inFd, outFd, options, listener);\n            case PNG:\n                return convertPngTiffFd(inFd, outFd, options, listener);\n            case BMP:\n                return convertBmpTiffFd(inFd, outFd, options, listener);\n            case TIFF:\n                // TODO: 9/19/17 make convert tiff to tiff method\n                break;\n        }\n        return false;\n    }\n\n\n    /**\n     * @deprecated Since Android Q is released. You can use this method with scoped storage.\n     * Otherwise use {@link TiffConverter#convertTiffPngFd(int, int, ConverterOptions, IProgressListener)}.\n     * <p></p>\n     * Convert tiff to png file. Uses direct data read method, that decrease memory usage\n     * @param tiff path to income tiff file\n     * @param png path to outcome png file\n     * @param options converter options\n     * @param listener listener which will receive converting progress\n     * @return true if convert process have been successful\n     */\n    public static native boolean convertTiffPng(String tiff, String png, ConverterOptions options, IProgressListener listener) throws CantOpenFileException, DecodeTiffException, NotEnoughtMemoryException;\n\n    /**\n     * Convert tiff to png file. Uses direct data read method, that decrease memory usage\n     * @param tiff file descriptor that represent income tiff file\n     * @param png file descriptor that represent outcome png file\n     * @param options converter options\n     * @param listener listener which will receive converting progress\n     * @return true if convert process have been successful\n     */\n    public static native boolean convertTiffPngFd(int tiff, int png, ConverterOptions options, IProgressListener listener) throws CantOpenFileException, DecodeTiffException, NotEnoughtMemoryException;\n\n    /**\n     * @deprecated Since Android Q is released. You can use this method with scoped storage.\n     * Otherwise use {@link TiffConverter#convertPngTiffFd(int, int, ConverterOptions, IProgressListener)}.\n     * <p></p>\n     * Convert png to tiff file. Uses direct data read method, that decrease memory usage.\n     * @param png path to income png file\n     * @param tiff path to outcome tiff file\n     * @param options converter options\n     * @param listener listener which will receive converting progress\n     * @return true if convert process have been successful\n     */\n    public static native boolean convertPngTiff(String png, String tiff, ConverterOptions options, IProgressListener listener) throws CantOpenFileException, DecodeTiffException, NotEnoughtMemoryException;\n\n    /**\n     * Convert png to tiff file. Uses direct data read method, that decrease memory usage.\n     * This method don't close file descriptor\n     * @param png file descriptor that represent income png file\n     * @param tiff file descriptor that represent outcome tiff file\n     * @param options converter options\n     * @param listener listener which will receive converting progress\n     * @return true if convert process have been successful\n     */\n    public static native boolean convertPngTiffFd(int png, int tiff, ConverterOptions options, IProgressListener listener) throws CantOpenFileException, DecodeTiffException, NotEnoughtMemoryException;\n\n    /**\n     * @deprecated Since Android Q is released. You can use this method with scoped storage.\n     * Otherwise use {@link TiffConverter#convertTiffJpgFd(int, int, ConverterOptions, IProgressListener)}.\n     * <p></p>\n     * Convert tiff to jpeg file. Uses direct data read method, that decrease memory usage\n     * @param tiff path to income tiff file\n     * @param jpg path to outcome jpeg file\n     * @param options converter options\n     * @param listener listener which will receive converting progress\n     * @return true if convert process have been successful\n     */\n    public static native boolean convertTiffJpg(String tiff, String jpg, ConverterOptions options, IProgressListener listener) throws CantOpenFileException, DecodeTiffException, NotEnoughtMemoryException;\n\n    /**\n     * Convert tiff to jpg file. Uses direct data read method, that decrease memory usage\n     * @param tiff file descriptor that represent income tiff file\n     * @param jpg file descriptor that represent outcome jpg file\n     * @param options converter options\n     * @param listener listener which will receive converting progress\n     * @return true if convert process have been successful\n     */\n    public static native boolean convertTiffJpgFd(int tiff, int jpg, ConverterOptions options, IProgressListener listener) throws CantOpenFileException, DecodeTiffException, NotEnoughtMemoryException;\n\n    /**\n     * @deprecated Since Android Q is released. You can use this method with scoped storage.\n     * Otherwise use {@link TiffConverter#convertJpgTiffFd(int, int, ConverterOptions, IProgressListener)}.\n     * <p></p>\n     * Convert jpeg to tiff file. Uses direct data read method, that decrease memory usage.\n     * @param jpg path to income jpeg file\n     * @param tiff path to outcome tiff file\n     * @param options converter options\n     * @param listener listener which will receive converting progress\n     * @return true if convert process have been successful\n     */\n    public static native boolean convertJpgTiff(String jpg, String tiff, ConverterOptions options, IProgressListener listener) throws CantOpenFileException, DecodeTiffException, NotEnoughtMemoryException;\n\n    /**\n     * Convert jpeg to tiff file. Uses direct data read method, that decrease memory usage.\n     * This method don't close file descriptor\n     * @param jpg file descriptor that represent income jpeg file\n     * @param tiff file descriptor that represent outcome tiff file\n     * @param options converter options\n     * @param listener listener which will receive converting progress\n     * @return true if convert process have been successful\n     */\n    public static native boolean convertJpgTiffFd(int jpg, int tiff, ConverterOptions options, IProgressListener listener) throws CantOpenFileException, DecodeTiffException, NotEnoughtMemoryException;\n\n    /**\n     * @deprecated Since Android Q is released. You can use this method with scoped storage.\n     * Otherwise use {@link TiffConverter#convertTiffBmpFd(int, int, ConverterOptions, IProgressListener)}.\n     * <p></p>\n     * Convert tiff to bmp file. Uses direct data read method, that decrease memory usage\n     * @param tiff path to income tiff file\n     * @param bmp path to outcome jpeg file\n     * @param options converter options\n     * @param listener listener which will receive converting progress\n     * @return true if convert process have been successful\n     */\n    public static native boolean convertTiffBmp(String tiff, String bmp, ConverterOptions options, IProgressListener listener) throws CantOpenFileException, DecodeTiffException, NotEnoughtMemoryException;\n\n    /**\n     * Convert tiff to bmp file. Uses direct data read method, that decrease memory usage\n     * @param tiff file descriptor that represent income tiff file\n     * @param bmp file descriptor that represent outcome bmp file\n     * @param options converter options\n     * @param listener listener which will receive converting progress\n     * @return true if convert process have been successful\n     */\n    public static native boolean convertTiffBmpFd(int tiff, int bmp, ConverterOptions options, IProgressListener listener) throws CantOpenFileException, DecodeTiffException, NotEnoughtMemoryException;\n\n    /**\n     * @deprecated Since Android Q is released. You can use this method with scoped storage.\n     * Otherwise use {@link TiffConverter#convertBmpTiffFd(int, int, ConverterOptions, IProgressListener)}.\n     * <p></p>\n     * Convert bmp to tiff file. Uses direct data read method, that decrease memory usage.\n     * @param bmp path to income bmp file\n     * @param tiff path to outcome tiff file\n     * @param options converter options\n     * @param listener listener which will receive converting progress\n     * @return true if convert process have been successful\n     */\n    public static native boolean convertBmpTiff(String bmp, String tiff, ConverterOptions options, IProgressListener listener) throws CantOpenFileException, DecodeTiffException, NotEnoughtMemoryException;\n\n    /**\n     * Convert bmp to tiff file. Uses direct data read method, that decrease memory usage.\n     * This method don't close file descriptor\n     * @param bmp file descriptor that represent income bmp file\n     * @param tiff file descriptor that represent outcome tiff file\n     * @param options converter options\n     * @param listener listener which will receive converting progress\n     * @return true if convert process have been successful\n     */\n    public static native boolean convertBmpTiffFd(int bmp, int tiff, ConverterOptions options, IProgressListener listener) throws CantOpenFileException, DecodeTiffException, NotEnoughtMemoryException;\n\n    /**\n     * @deprecated Since Android Q is released. You can use this method with scoped storage.\n     * Otherwise use {@link TiffConverter#getImageTypeFd(int)}.\n     * <p></p>\n     * Return type of file.\n     * @param path - file path\n     * @return one of {@link ImageFormat} or {@link ImageFormat#UNKNOWN}\n     */\n    public static native ImageFormat getImageType(String path);\n\n    /**\n     * Return type of file. This method don't close file descriptor\n     * @param fd - file descriptor for file\n     * @return one of {@link ImageFormat} or {@link ImageFormat#UNKNOWN}\n     */\n    public static native ImageFormat getImageTypeFd(int fd);\n\n    /**\n     * Close detached file descriptor\n     * @param fd\n     */\n    public static native void closeFd(int fd);\n\n    public static final class ConverterOptions {\n\n        public ConverterOptions() {\n            availableMemory = 8000*8000*4;\n            appendTiff = false;\n            resUnit = ResolutionUnit.NONE;\n            compressionScheme = CompressionScheme.NONE;\n            //orientation = Orientation.TOP_LEFT;\n            throwExceptions = false;\n            isStoped = false;\n        }\n\n        /**\n         * Uses for stoping of native thread\n         * @deprecated As of release 0.9.8.4, replaced by {@link Thread#interrupt()}\n         */\n        private volatile boolean isStoped;\n\n        /**\n         * Stop native convert thread\n         * If converting is started in any thread except main, calling of this method will cause force stop of converting and returning of false.\n         * @deprecated As of release 0.9.8.4, replaced by {@link Thread#interrupt()}\n         */\n        public void stop() {\n            isStoped = true;\n        }\n\n        /**\n         * Number of bytes that may be allocated during the file operations.\n         * <p>-1 means memory is unlimited.</p>\n         * <p>Default value is 244Mb</p>\n         */\n        public long availableMemory;\n\n        /**\n         * If set to true, converter will throw exceptions if some errors appeared while converting.\n         * Otherwise converter will just return false.\n         * Default value is false\n         */\n        public boolean throwExceptions;\n\n        /**\n         * <b>For converting from TIFF to ANY cases</b>\n         * <p>Tiff directory that should be converted</p>\n         */\n        public int readTiffDirectory;\n\n        /**\n         * <b>For converting from ANY to TIFF cases</b>\n         * <p>If this value set to true while converting any to tiff - new tiff directory will be created\n         * and added to existed tiff file.</p>\n         * Otherwise file will be overwritten.\n         * <p>Default value is false</p>\n         */\n        public boolean appendTiff;\n\n        /**\n         * <b>For converting from ANY to TIFF cases</b>\n         * Compression scheme used on the image data.\n         * <p>Default value is {@link CompressionScheme#NONE COMPRESSION_NONE}</p>\n         * <p>This parameter is link to TIFFTAG_COMPRESSION tag</p>\n         */\n        public CompressionScheme compressionScheme;\n\n        /**\n         * <b>For converting from ANY to TIFF cases</b>\n         * {@link org.beyka.tiffbitmapfactory.Orientation Orientation} that will used for saving image\n         * <p>By default uses {@link org.beyka.tiffbitmapfactory.Orientation#TOP_LEFT ORIENTATION_TOPLEFT} </p>\n         * <p>This parameter is link to TIFFTAG_ORIENTATION tag</p>\n         */\n        //public Orientation orientation;\n\n        /**\n         * If this field is non-null - Converter will use only area specified in {@link DecodeArea} object to convert.\n         * <p><b>This field works only when convert from TIFF.</b></p>\n         * <p>For decoding not full bitmap, but only part of it - create new {@link DecodeArea} object and specify:</p>\n         * <p>{@link DecodeArea#x x}, {@link DecodeArea#y y} - left top corner of decoding area </p>\n         * <p>{@link DecodeArea#width width} - width of decoding area </p>\n         * <p>{@link DecodeArea#height height} - height of decoding area </p>\n         */\n        public DecodeArea inTiffDecodeArea;\n\n        /**\n         * <b>For converting from ANY to TIFF cases</b>\n         * The number of pixels per {@link org.beyka.tiffbitmapfactory.TiffConverter.ConverterOptions#resUnit} in the ImageWidth direction.\n         * <p> It is not mandatory that the image be actually displayed or printed at the size implied by this parameter.\n         * It is up to the application to use this information as it wishes.</p>\n         * <p>Defualt value is 0</p>\n         */\n        public float xResolution;\n\n        /**\n         * <b>For converting from ANY to TIFF cases</b>\n         * The number of pixels per {@link org.beyka.tiffbitmapfactory.TiffConverter.ConverterOptions#resUnit} in the ImageHeight direction.\n         * <p> It is not mandatory that the image be actually displayed or printed at the size implied by this parameter.\n         * It is up to the application to use this information as it wishes.</p>\n         * <p>Defualt value is 0</p>\n         */\n        public float yResolution;\n\n        /**\n         * <b>For converting from ANY to TIFF cases</b>\n         * The unit of measurement for XResolution and YResolution.\n         * <p>To be used with xResolution and yResolution. </p>\n         * <p>The specification defines these values: </p>\n         * <ul>\n         *     <li>RESUNIT_NONE</li>\n         *     <li>RESUNIT_INCH</li>\n         *     <li>RESUNIT_CENTIMETER</li>\n         * </ul>\n         * <p>Default value is {@link org.beyka.tiffbitmapfactory.ResolutionUnit#NONE}</p>\n         */\n        public ResolutionUnit resUnit;\n\n        /**\n         * <b>For converting from ANY to TIFF cases</b>\n         * A string that describes the subject of the image.\n         * <p>This parameter is link to TIFFTAG_IMAGEDESCRIPTION tag</p>\n         */\n        public String imageDescription;\n\n        /**\n         * <b>For converting from ANY to TIFF cases</b>\n         * Software that used for creating of image.\n         * <p>This parameter is link to TIFFTAG_SOFTWARE tag</p>\n         */\n        public String software;\n\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/beyka/tiffbitmapfactory/TiffSaver.java",
    "content": "package org.beyka.tiffbitmapfactory;\n\nimport android.graphics.Bitmap;\n\nimport org.beyka.tiffbitmapfactory.exceptions.CantOpenFileException;\nimport org.beyka.tiffbitmapfactory.exceptions.NotEnoughtMemoryException;\n\nimport java.io.File;\n\n/**\n * Created by beyka on 18.2.16.\n */\npublic class TiffSaver {\n\n    static {\n        System.loadLibrary(\"tiff\");\n        System.loadLibrary(\"tiffsaver\");\n    }\n\n    /**\n     * Save bitmap to file with default {@link TiffSaver.SaveOptions options}.\n     *\n     * @param destination - file to write bitmap\n     * @param bmp         - Bitmap for saving\n     * @return true if bitmap was saved successful or false otherwise\n     * @throws CantOpenFileException when {@code destination} not exist or can't be opened for writing\n     * @throws org.beyka.tiffbitmapfactory.exceptions.NotEnoughtMemoryException when there is no avalable memory for processing bitmap\n     * @throws org.beyka.tiffbitmapfactory.exceptions.DecodeTiffException when error occure while saving image\n     */\n    public static boolean saveBitmap(File destination, Bitmap bmp) throws CantOpenFileException, NotEnoughtMemoryException {\n        return saveBitmap(destination.getAbsolutePath(), bmp, new SaveOptions());\n    }\n\n    /**\n     * Save bitmap to file.\n     *\n     * @param destination - file to write bitmap\n     * @param bmp         - Bitmap for saving\n     * @param options     - options for saving\n     * @return true if bitmap was saved successful or false otherwise\n     * @throws CantOpenFileException when {@code destinationPath} not exist or can't be opened for writing\n     * @throws org.beyka.tiffbitmapfactory.exceptions.NotEnoughtMemoryException when there is no avalable memory for processing bitmap\n     * @throws org.beyka.tiffbitmapfactory.exceptions.DecodeTiffException when error occure while saving image\n     */\n    public static boolean saveBitmap(File destination, Bitmap bmp, SaveOptions options) throws CantOpenFileException {\n        return saveBitmap(destination.getAbsolutePath(), bmp, options);\n    }\n\n    /**\n     * Save bitmap to file with default {@link TiffSaver.SaveOptions options}.\n     *\n     * @param destinationPath - file path to write bitmap\n     * @param bmp             - Bitmap for saving\n     * @return true if bitmap was saved successful or false otherwise\n     * @throws CantOpenFileException when {@code destinationPath} not exist or can't be opened for writing\n     * @throws org.beyka.tiffbitmapfactory.exceptions.NotEnoughtMemoryException when there is no avalable memory for processing bitmap\n     * @throws org.beyka.tiffbitmapfactory.exceptions.DecodeTiffException when error occure while saving image\n     */\n    public static boolean saveBitmap(String destinationPath, Bitmap bmp) throws CantOpenFileException {\n        return saveBitmap(destinationPath, bmp, new SaveOptions());\n    }\n\n    /**\n     * Save bitmap to file.\n     *\n     * @param destinationPath - file path to write bitmap\n     * @param bmp             - Bitmap for saving\n     * @param options         - options for saving\n     * @return true if bitmap was saved successful or false otherwise\n     * @throws CantOpenFileException when {@code destinationPath} not exist or can't be opened for writing\n     * @throws org.beyka.tiffbitmapfactory.exceptions.NotEnoughtMemoryException when there is no avalable memory for processing bitmap\n     * @throws org.beyka.tiffbitmapfactory.exceptions.DecodeTiffException when error occure while saving image\n     */\n    public static boolean saveBitmap(String destinationPath, Bitmap bmp, SaveOptions options) throws CantOpenFileException {\n//        int pixels[] = new int[bmp.getWidth() * bmp.getHeight()];\n//        bmp.getPixels(pixels, 0, bmp.getWidth(), 0, 0, bmp.getWidth(), bmp.getHeight());\n\n        return save(destinationPath, -1, bmp, options, false);\n    }\n\n    /**\n     * Append bitmap to the end of existing file or create new file with default {@link TiffSaver.SaveOptions options}.\n     *\n     * @param destination - file to write bitmap\n     * @param bmp         - Bitmap for saving\n     * @return true if bitmap was saved successful or false otherwise\n     * @throws CantOpenFileException when {@code destination} not exist or can't be opened for writing\n     * @throws org.beyka.tiffbitmapfactory.exceptions.NotEnoughtMemoryException when there is no avalable memory for processing bitmap\n     * @throws org.beyka.tiffbitmapfactory.exceptions.DecodeTiffException when error occure while saving image\n     */\n    public static boolean appendBitmap(File destination, Bitmap bmp) throws CantOpenFileException, NotEnoughtMemoryException {\n        return appendBitmap(destination.getAbsolutePath(), bmp, new SaveOptions());\n    }\n\n    /**\n     * append bitmap to the end of existing file or create new file.\n     *\n     * @param destination - file to write bitmap\n     * @param bmp         - Bitmap for saving\n     * @param options     - options for saving\n     * @return true if bitmap was saved successful or false otherwise\n     * @throws CantOpenFileException when {@code destinationPath} not exist or can't be opened for writing\n     * @throws org.beyka.tiffbitmapfactory.exceptions.NotEnoughtMemoryException when there is no avalable memory for processing bitmap\n     * @throws org.beyka.tiffbitmapfactory.exceptions.DecodeTiffException when error occure while saving image\n     */\n    public static boolean appendBitmap(File destination, Bitmap bmp, SaveOptions options) throws CantOpenFileException {\n        return appendBitmap(destination.getAbsolutePath(), bmp, options);\n    }\n\n    /**\n     * append bitmap to the end of existing file or create new file with default {@link TiffSaver.SaveOptions options}.\n     *\n     * @param destinationPath - file path to write bitmap\n     * @param bmp             - Bitmap for saving\n     * @return true if bitmap was saved successful or false otherwise\n     * @throws CantOpenFileException when {@code destinationPath} not exist or can't be opened for writing\n     * @throws org.beyka.tiffbitmapfactory.exceptions.NotEnoughtMemoryException when there is no avalable memory for processing bitmap\n     * @throws org.beyka.tiffbitmapfactory.exceptions.DecodeTiffException when error occure while saving image\n     */\n    public static boolean appendBitmap(String destinationPath, int page, Bitmap bmp) throws CantOpenFileException {\n        return appendBitmap(destinationPath, bmp, new SaveOptions());\n    }\n\n    /**\n     * append bitmap to the end of existing file or create new file.\n     *\n     * @param destinationPath - file path to write bitmap\n     * @param bmp             - Bitmap for saving\n     * @param options         - options for saving\n     * @return true if bitmap was saved successful or false otherwise\n     * @throws CantOpenFileException when {@code destinationPath} not exist or can't be opened for writing\n     * @throws org.beyka.tiffbitmapfactory.exceptions.NotEnoughtMemoryException when there is no avalable memory for processing bitmap\n     * @throws org.beyka.tiffbitmapfactory.exceptions.DecodeTiffException when error occure while saving image\n     */\n    public static boolean appendBitmap(String destinationPath, Bitmap bmp,SaveOptions options) throws CantOpenFileException {\n//        int pixels[] = new int[bmp.getWidth() * bmp.getHeight()];\n//        bmp.getPixels(pixels, 0, bmp.getWidth(), 0, 0, bmp.getWidth(), bmp.getHeight());\n\n        return save(destinationPath, -1, bmp, options, true);\n    }\n\n    /**\n     * Save bitmap to file with default {@link TiffSaver.SaveOptions options}.\n     *\n     * @param fileDescriptor - file descriptor that represent file to write bitmap\n     * @param bmp         - Bitmap for saving\n     * @return true if bitmap was saved successful or false otherwise\n     * @throws CantOpenFileException when {@code destination} not exist or can't be opened for writing\n     * @throws org.beyka.tiffbitmapfactory.exceptions.NotEnoughtMemoryException when there is no avalable memory for processing bitmap\n     * @throws org.beyka.tiffbitmapfactory.exceptions.DecodeTiffException when error occure while saving image\n     */\n    public static boolean saveBitmap(int fileDescriptor, Bitmap bmp) throws CantOpenFileException, NotEnoughtMemoryException {\n        return saveBitmap(fileDescriptor, bmp, new SaveOptions());\n    }\n\n    /**\n     * Save bitmap to file with default {@link TiffSaver.SaveOptions options}.\n     *\n     * @param fileDescriptor - file descriptor that represent file to write bitmap\n     * @param bmp         - Bitmap for saving\n     * @param options     - options for saving\n     * @return true if bitmap was saved successful or false otherwise\n     * @throws CantOpenFileException when {@code destination} not exist or can't be opened for writing\n     * @throws org.beyka.tiffbitmapfactory.exceptions.NotEnoughtMemoryException when there is no avalable memory for processing bitmap\n     * @throws org.beyka.tiffbitmapfactory.exceptions.DecodeTiffException when error occure while saving image\n     */\n    public static boolean saveBitmap(int fileDescriptor, Bitmap bmp, SaveOptions options) throws CantOpenFileException, NotEnoughtMemoryException {\n        return save(null, fileDescriptor, bmp, options, false);\n    }\n\n    /**\n     * Save bitmap to file with default {@link TiffSaver.SaveOptions options}.\n     *\n     * @param fileDescriptor - file descriptor that represent file to write bitmap\n     * @param bmp         - Bitmap for saving\n     * @return true if bitmap was saved successful or false otherwise\n     * @throws CantOpenFileException when {@code destination} not exist or can't be opened for writing\n     * @throws org.beyka.tiffbitmapfactory.exceptions.NotEnoughtMemoryException when there is no avalable memory for processing bitmap\n     * @throws org.beyka.tiffbitmapfactory.exceptions.DecodeTiffException when error occure while saving image\n     */\n    public static boolean appendBitmap(int fileDescriptor, Bitmap bmp) throws CantOpenFileException, NotEnoughtMemoryException {\n        return appendBitmap(fileDescriptor, bmp, new SaveOptions());\n    }\n\n    /**\n     * Save bitmap to file with default {@link TiffSaver.SaveOptions options}.\n     *\n     * @param fileDescriptor - file descriptor that represent file to write bitmap\n     * @param bmp         - Bitmap for saving\n     * @param options     - options for saving\n     * @return true if bitmap was saved successful or false otherwise\n     * @throws CantOpenFileException when {@code destination} not exist or can't be opened for writing\n     * @throws org.beyka.tiffbitmapfactory.exceptions.NotEnoughtMemoryException when there is no avalable memory for processing bitmap\n     * @throws org.beyka.tiffbitmapfactory.exceptions.DecodeTiffException when error occure while saving image\n     */\n    public static boolean appendBitmap(int fileDescriptor, Bitmap bmp, SaveOptions options) throws CantOpenFileException, NotEnoughtMemoryException {\n        return save(null, fileDescriptor, bmp, options, true);\n    }\n\n    private static synchronized native boolean save(String filePath, int fileDescriptor, Bitmap bmp, SaveOptions options, boolean append);\n\n    /**\n     * Close detached file descriptor\n     * @param fd\n     */\n    public static native void closeFd(int fd);\n\n    /**\n     * Options class to specify saving parameters\n     */\n    public static final class SaveOptions {\n\n        public SaveOptions() {\n            inAvailableMemory = 8000*8000*4;\n            inThrowException = false;\n            compressionScheme = CompressionScheme.NONE;\n            orientation = Orientation.TOP_LEFT;\n            xResolution = 0;\n            yResolution = 0;\n            resUnit = ResolutionUnit.NONE;\n        }\n\n        /**\n         * Number of bytes that may be allocated during the Tiff file operations.\n         * <p>-1 means memory is unlimited.</p>\n         * <p>Default value is 244Mb</p>\n         */\n        public long inAvailableMemory;\n\n        /**\n         * If set to true, saver will throw exceptions if some errors appeared while writing tiff.\n         * Otherwise  saver will just return false.\n         * Default value is false\n         */\n        public boolean inThrowException;\n\n        /**\n         * Compression scheme used on the image data.\n         * <p>Default value is {@link CompressionScheme#NONE COMPRESSION_NONE}</p>\n         * <p>This parameter is link to TIFFTAG_COMPRESSION tag</p>\n         */\n        public CompressionScheme compressionScheme;\n\n        /**\n         * {@link org.beyka.tiffbitmapfactory.Orientation Orientation} that will used for saving image\n         * <p>By default uses {@link org.beyka.tiffbitmapfactory.Orientation#TOP_LEFT ORIENTATION_TOPLEFT} </p>\n         * <p>This parameter is link to TIFFTAG_ORIENTATION tag</p>\n         */\n        public Orientation orientation;\n\n        /**\n         * The number of pixels per {@link org.beyka.tiffbitmapfactory.TiffSaver.SaveOptions#resUnit} in the ImageWidth direction.\n         * <p> It is not mandatory that the image be actually displayed or printed at the size implied by this parameter.\n         * It is up to the application to use this information as it wishes.</p>\n         * <p>Defualt value is 0</p>\n         */\n        public float xResolution;\n\n        /**\n         * The number of pixels per {@link org.beyka.tiffbitmapfactory.TiffSaver.SaveOptions#resUnit} in the ImageHeight direction.\n         * <p> It is not mandatory that the image be actually displayed or printed at the size implied by this parameter.\n         * It is up to the application to use this information as it wishes.</p>\n         * <p>Defualt value is 0</p>\n         */\n        public float yResolution;\n\n        /**\n         * The unit of measurement for XResolution and YResolution.\n         * <p>To be used with xResolution and yResolution. </p>\n         * <p>The specification defines these values: </p>\n         * <ul>\n         *     <li>RESUNIT_NONE</li>\n         *     <li>RESUNIT_INCH</li>\n         *     <li>RESUNIT_CENTIMETER</li>\n         * </ul>\n         * <p>Default value is {@link org.beyka.tiffbitmapfactory.ResolutionUnit#NONE}</p>\n         */\n        public ResolutionUnit resUnit;\n\n        /**\n         * Author for writing to file.\n         * <p>This parameter is link to TIFFTAG_ARTIST tag</p>\n         */\n        public String author;\n\n        /**\n         * Copyright for writing to file\n         * <p>This parameter is link to TIFFTAG_COPYRIGHT tag</p>\n         */\n        public String copyright;\n\n        /**\n         * A string that describes the subject of the image.\n         * <p>This parameter is link to TIFFTAG_IMAGEDESCRIPTION tag</p>\n         */\n        public String imageDescription;\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/beyka/tiffbitmapfactory/exceptions/CantOpenFileException.java",
    "content": "package org.beyka.tiffbitmapfactory.exceptions;\n\n/**\n * Created by alexeyba on 09.11.15.\n */\npublic class CantOpenFileException extends RuntimeException {\n    private String fileName;\n    private int fileDescriptor = -1;\n\n    public CantOpenFileException(String fileName){\n        super(\"Can\\'t open file \" + fileName);\n        this.fileName = fileName;\n    }\n\n    public CantOpenFileException(int fileDescriptor){\n        super(\"Can\\'t open file with file descriptor \" + fileDescriptor);\n        this.fileDescriptor = fileDescriptor;\n    }\n\n    public String getFileName(){\n        return fileName;\n    }\n\n    public int getFileDescriptor() {\n        return fileDescriptor;\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/beyka/tiffbitmapfactory/exceptions/DecodeTiffException.java",
    "content": "package org.beyka.tiffbitmapfactory.exceptions;\n\n/**\n * Created by alexeyba on 09.11.15.\n */\npublic class DecodeTiffException extends RuntimeException {\n\n    private String fileName;\n    private String aditionalInfo;\n    private int fileDescriptor = -1;\n\n    public DecodeTiffException(String fileName){\n        super(\"Could not decode tiff file \" + fileName);\n        this.fileName = fileName;\n    }\n\n    public DecodeTiffException(int fileDescriptor) {\n        super(\"Could not decode tiff file with file descriptor \" + fileDescriptor);\n        this.fileDescriptor = fileDescriptor;\n    }\n\n    public DecodeTiffException(String fileName, String aditionaInfo){\n        super(\"Could not decode tiff file \" + fileName + \"\\n\" + aditionaInfo);\n        this.fileName = fileName;\n        this.aditionalInfo = aditionaInfo;\n    }\n\n    public DecodeTiffException(int fileDescriptor, String aditionaInfo){\n        super(\"Could not decode tiff file with file descriptor\" + fileDescriptor + \"\\n\" + aditionaInfo);\n        this.fileDescriptor = fileDescriptor;\n        this.aditionalInfo = aditionaInfo;\n    }\n\n    public String getFileName(){\n        return fileName;\n    }\n\n    public String getAditionalInfo() {\n        return aditionalInfo;\n    }\n\n    public int getFileDescriptor() {\n        return fileDescriptor;\n    }\n}\n"
  },
  {
    "path": "src/main/java/org/beyka/tiffbitmapfactory/exceptions/NotEnoughtMemoryException.java",
    "content": "package org.beyka.tiffbitmapfactory.exceptions;\n\n/**\n * Created by alexeyba on 09.11.15.\n */\npublic class NotEnoughtMemoryException extends RuntimeException {\n\n    private int availableMemory;\n    private int needMemory;\n\n    public NotEnoughtMemoryException(int availableMemory, int needMemory){\n        super(\"Available memory is not enought to decode image. Available \" + availableMemory + \" bytes. Need \" + needMemory + \" bytes.\");\n        this.availableMemory = availableMemory;\n        this.needMemory = needMemory;\n    }\n\n    public int getAvailableMemory() {\n        return availableMemory;\n    }\n\n    public int getNeedMemory() {\n        return needMemory;\n    }\n}\n"
  },
  {
    "path": "src/main/jni/Android.mk",
    "content": "LOCAL_PATH := $(call my-dir)\n\ninclude $(CLEAR_VARS)\n\nLOCAL_ARM_MODE := arm\n\nLOCAL_TIFF_SRC_FILES := \\\n\ttiff/libtiff/tif_dirread.c \\\n\ttiff/libtiff/tif_zip.c \\\n\ttiff/libtiff/tif_flush.c \\\n\ttiff/libtiff/tif_next.c \\\n\ttiff/libtiff/tif_ojpeg.c \\\n\ttiff/libtiff/tif_dirwrite.c \\\n\ttiff/libtiff/tif_dirinfo.c \\\n\ttiff/libtiff/tif_dir.c \\\n\ttiff/libtiff/tif_compress.c \\\n\ttiff/libtiff/tif_close.c \\\n\ttiff/libtiff/tif_tile.c \\\n\ttiff/libtiff/tif_open.c \\\n\ttiff/libtiff/tif_getimage.c \\\n\ttiff/libtiff/tif_pixarlog.c \\\n\ttiff/libtiff/tif_warning.c \\\n\ttiff/libtiff/tif_dumpmode.c \\\n\ttiff/libtiff/tif_jpeg.c \\\n\ttiff/libtiff/tif_jbig.c \\\n\ttiff/libtiff/tif_predict.c \\\n\ttiff/libtiff/mkg3states.c \\\n\ttiff/libtiff/tif_write.c \\\n\ttiff/libtiff/tif_error.c \\\n\ttiff/libtiff/tif_version.c \\\n\ttiff/libtiff/tif_print.c \\\n\ttiff/libtiff/tif_color.c \\\n\ttiff/libtiff/tif_read.c \\\n\ttiff/libtiff/tif_extension.c \\\n\ttiff/libtiff/tif_thunder.c \\\n\ttiff/libtiff/tif_lzw.c \\\n\ttiff/libtiff/tif_fax3.c \\\n\ttiff/libtiff/tif_luv.c \\\n\ttiff/libtiff/tif_codec.c \\\n\ttiff/libtiff/tif_unix.c \\\n\ttiff/libtiff/tif_packbits.c \\\n\ttiff/libtiff/tif_aux.c \\\n\ttiff/libtiff/tif_fax3sm.c \\\n\ttiff/libtiff/tif_swab.c \\\n\ttiff/libtiff/tif_strip.c\n\nLOCAL_TIFF_SRC_FILES += tiff/port/lfind.c \n#######################LIBTIFF#################################\n\nLOCAL_SRC_FILES:= $(LOCAL_TIFF_SRC_FILES)\nLOCAL_C_INCLUDES += \\\n\t\t\t\t\t$(LOCAL_PATH)/tiff/libtiff \\\n\t\t\t\t\t$(LOCAL_PATH)/jpeg\n\n\nLOCAL_CFLAGS += -DAVOID_TABLES\nLOCAL_CFLAGS += -O3 -fstrict-aliasing -fprefetch-loop-arrays\nLOCAL_MODULE:= libtiff\nLOCAL_LDLIBS := -lz\n\nLOCAL_LDLIBS += $(LOCAL_PATH)/libs/$(TARGET_ARCH_ABI)/libjpeg.a\n\ninclude $(BUILD_SHARED_LIBRARY)\n###############################################################\ninclude $(CLEAR_VARS)\nLOCAL_MODULE := libpng\nLOCAL_SRC_FILES := libs/$(TARGET_ARCH_ABI)/libpng.a\ninclude $(PREBUILT_STATIC_LIBRARY)\n###############################################################\ninclude $(CLEAR_VARS)\nLOCAL_MODULE := libjpeg\nLOCAL_SRC_FILES := libs/$(TARGET_ARCH_ABI)/libjpeg.a\ninclude $(PREBUILT_STATIC_LIBRARY)\n###############################################################\ninclude $(CLEAR_VARS)\nLOCAL_MODULE := tifffactory\nLOCAL_CFLAGS := -DANDROID_NDK\nLOCAL_SRC_FILES := \\\n\tNativeExceptions.cpp \\\n\tNativeTiffBitmapFactory.cpp \\\n\tNativeDecoder.cpp\nLOCAL_LDLIBS := -ldl -llog -ljnigraphics\nLOCAL_LDFLAGS +=-ljnigraphics\nLOCAL_SHARED_LIBRARIES := tiff\ninclude $(BUILD_SHARED_LIBRARY)\n\n###############################################################\ninclude $(CLEAR_VARS)\nLOCAL_MODULE := tiffsaver\nLOCAL_CFLAGS := -DANDROID_NDK\nLOCAL_SRC_FILES := \\\n\tNativeExceptions.cpp \\\n\tNativeTiffSaver.cpp\nLOCAL_LDLIBS := -ldl -llog -ljnigraphics\nLOCAL_LDFLAGS +=-ljnigraphics\nLOCAL_SHARED_LIBRARIES := tiff\ninclude $(BUILD_SHARED_LIBRARY)\n\n###############################################################\ninclude $(CLEAR_VARS)\nLOCAL_MODULE := tiffconverter\nLOCAL_CFLAGS := -DANDROID_NDK\nLOCAL_SRC_FILES := \\\n\tNativeExceptions.cpp \\\n\tNativeTiffConverter.cpp \\\n\tTiffToPngConverter.cpp \\\n\tTiffToJpgConverter.cpp \\\n\tBaseTiffConverter.cpp \\\n\tPngToTiffConverter.cpp \\\n\tJpgToTiffConverter.cpp \\\n\tBmpToTiffConverter.cpp \\\n\tTiffToBmpConverter.cpp \\\n\tBitmapReader.cpp\n\n#LOCAL_C_INCLUDES := libs/$(TARGET_ARCH_ABI)/libpng.a\nLOCAL_C_INCLUDES := \\\n\t\t\t\t\t$(LOCAL_PATH)/png \\\n\t\t\t\t\t$(LOCAL_PATH)/jpeg\n\nLOCAL_LDLIBS := -lz -ldl -llog -ljnigraphics\nLOCAL_LDFLAGS +=-ljnigraphics\nLOCAL_STATIC_LIBRARIES := png\nLOCAL_STATIC_LIBRARIES += jpeg\nLOCAL_SHARED_LIBRARIES := tiff\ninclude $(BUILD_SHARED_LIBRARY)"
  },
  {
    "path": "src/main/jni/Application.mk",
    "content": "APP_STL := c++_static\n\nAPP_MODULES      := tiff png jpeg tifffactory tiffsaver tiffconverter\n\nAPP_PLATFORM=android-16\n\nAPP_ABI := arm64-v8a, armeabi-v7a\n\n#APP_OPTIM := debug"
  },
  {
    "path": "src/main/jni/BMP.h",
    "content": "//\n// Created by beyka on 9/21/17.\n//\n\n#ifndef __BMP_H_INCLUDED__   // if x.h hasn't been included yet...\n#define __BMP_H_INCLUDED__\n\n#pragma pack(2)\ntypedef struct BITMAPFILEHEADER\n{\n    BITMAPFILEHEADER() : bfReserved1(0), bfReserved2(0) {}\n    unsigned char bfType[2];\n    unsigned int   bfSize;\n    unsigned short bfReserved1;\n    unsigned short bfReserved2;\n    unsigned int   bfOffBits;\n} BITMAPFILEHEADER;\n\ntypedef struct                       /**** BMP file info structure ****/\n{\n    unsigned int   biSize;           /* Size of info header */\n    int            biWidth;          /* Width of image */\n    int            biHeight;         /* Height of image */\n    unsigned short biPlanes;         /* Number of color planes */\n    unsigned short biBitCount;       /* Number of bits per pixel */\n    unsigned int   biCompression;    /* Type of compression to use 0 - none, 1 - rle 8 bit, 2 - rle 4 but, 3 - bi_bitfields*/\n    unsigned int   biSizeImage;      /* Size of image data */\n    int            biXPelsPerMeter;  /* X pixels per meter */\n    int            biYPelsPerMeter;  /* Y pixels per meter */\n    unsigned int   biClrUsed;        /* Number of colors used */\n    unsigned int   biClrImportant;   /* Number of important colors */\n    unsigned int biPalete[3] ;\n    unsigned char reserved[56];\n    /* Palete (masks for 16 bit bmps)*/\n    /*a 5-5-5 16-bit image, where the blue mask is 0x001f, the green mask is 0x03e0, and the red mask is 0x7c00; and a 5-6-5 16-bit image, where the blue mask is 0x001f, the green mask is 0x07e0, and the red mask is 0xf800*/\n} BITMAPINFOHEADER;\n\n\n#pragma pack()\n\n#endif"
  },
  {
    "path": "src/main/jni/BaseTiffConverter.cpp",
    "content": "//\n// Created by beyka on 5/11/17.\n//\n\n#include \"BaseTiffConverter.h\"\n\nBaseTiffConverter::BaseTiffConverter(JNIEnv *e, jclass clazz, jstring in, jstring out, jobject opts, jobject listener)\n{\n    boundX = boundY = boundWidth = boundHeight = -1;\n    hasBounds = 0;\n    availableMemory = 8000 * 8000 * 4;\n    env = e;\n    inPath = in;\n    outPath = out;\n    optionsObj = opts;\n    this->listener = listener;\n    throwException = JNI_FALSE;\n    appendTiff = JNI_FALSE;\n    tiffDirectory = 0;\n    jIProgressListenerClass = env->FindClass(\"org/beyka/tiffbitmapfactory/IProgressListener\");\n    jConvertOptionsClass = env->FindClass(\"org/beyka/tiffbitmapfactory/TiffConverter$ConverterOptions\");\n    jThreadClass = env->FindClass(\"java/lang/Thread\");\n\n    compressionInt = 5;\n\n    inFd = -1;\n    outFd = -1;\n}\n\nBaseTiffConverter::BaseTiffConverter(JNIEnv *e, jclass clazz, jint in, jint out, jobject opts, jobject listener)\n{\n    boundX = boundY = boundWidth = boundHeight = -1;\n    hasBounds = 0;\n    availableMemory = 8000 * 8000 * 4;\n    env = e;\n    inFd = in;\n    outFd = out;\n    optionsObj = opts;\n    this->listener = listener;\n    throwException = JNI_FALSE;\n    appendTiff = JNI_FALSE;\n    tiffDirectory = 0;\n    jIProgressListenerClass = env->FindClass(\"org/beyka/tiffbitmapfactory/IProgressListener\");\n    jConvertOptionsClass = env->FindClass(\"org/beyka/tiffbitmapfactory/TiffConverter$ConverterOptions\");\n    jThreadClass = env->FindClass(\"java/lang/Thread\");\n\n    compressionInt = 5;\n}\n\nBaseTiffConverter::~BaseTiffConverter()\n{\n    LOGI(\"base destructor\");\n\n    if (cdescription) {\n        env->ReleaseStringUTFChars(description, cdescription);\n    }\n\n    if (csoftware) {\n        env->ReleaseStringUTFChars(software, csoftware);\n    }\n\n    if (jIProgressListenerClass) {\n        env->DeleteLocalRef(jIProgressListenerClass);\n        jIProgressListenerClass = NULL;\n    }\n\n    if (jThreadClass) {\n        env->DeleteLocalRef(jThreadClass);\n        jThreadClass = NULL;\n    }\n}\n\nvoid BaseTiffConverter::readOptions()\n{\n    if (optionsObj == NULL) return;\n\n    jfieldID tiffdirfield = env->GetFieldID(jConvertOptionsClass, \"readTiffDirectory\", \"I\");\n    tiffDirectory = env->GetIntField(optionsObj, tiffdirfield);\n\n    jfieldID availablememfield = env->GetFieldID(jConvertOptionsClass, \"availableMemory\", \"J\");\n    jlong am = env->GetLongField(optionsObj, availablememfield);\n    if (am > 0 || am == -1) availableMemory = am;\n\n    jfieldID throwexceptionsfield = env->GetFieldID(jConvertOptionsClass, \"throwExceptions\", \"Z\");\n    throwException = env->GetBooleanField(optionsObj, throwexceptionsfield);\n\n    jfieldID appentifffield = env->GetFieldID(jConvertOptionsClass, \"appendTiff\", \"Z\");\n    appendTiff = env->GetBooleanField(optionsObj, appentifffield);\n\n    //read compression\n    jfieldID gOptions_CompressionModeFieldID = env->GetFieldID(jConvertOptionsClass,\n            \"compressionScheme\",\n            \"Lorg/beyka/tiffbitmapfactory/CompressionScheme;\");\n    jobject compressionMode = env->GetObjectField(optionsObj, gOptions_CompressionModeFieldID);\n    jclass compressionModeClass = env->FindClass(\"org/beyka/tiffbitmapfactory/CompressionScheme\");\n    jfieldID ordinalFieldID = env->GetFieldID(compressionModeClass, \"ordinal\", \"I\");\n    jint ci = env->GetIntField(compressionMode, ordinalFieldID);\n    LOGII(\"ci\", ci);\n    //check is compression scheme is right. if not - set default LZW\n    if (ci == 1 || ci == 2 || ci == 3 || ci == 4 || ci == 5 || ci == 7 || ci == 8 || ci == 32773 || ci == 32946)\n        compressionInt = ci;\n    else\n        compressionInt = 5;\n\n    LOGII(\"compressionInt \", compressionInt );\n    env->DeleteLocalRef(compressionModeClass);\n\n    //Get image orientation from options object\n    /*jfieldID orientationFieldID = env->GetFieldID(jConvertOptionsClass,\n            \"orientation\",\n            \"Lorg/beyka/tiffbitmapfactory/Orientation;\");\n    jobject orientation = env->GetObjectField(optionsObj, orientationFieldID);\n\n    jclass orientationClass = env->FindClass(\"org/beyka/tiffbitmapfactory/Orientation\");\n    jfieldID orientationOrdinalFieldID = env->GetFieldID(orientationClass, \"ordinal\", \"I\");\n    orientationInt = env->GetIntField(orientation, orientationOrdinalFieldID);\n    env->DeleteLocalRef(orientationClass);*/\n    orientationInt = ORIENTATION_TOPLEFT;\n\n    //Get image description field if exist\n    jfieldID imgDescrFieldID = env->GetFieldID(jConvertOptionsClass, \"imageDescription\", \"Ljava/lang/String;\");\n    description = (jstring)env->GetObjectField(optionsObj, imgDescrFieldID);\n    if (description) {\n        cdescription = env->GetStringUTFChars(description, 0);\n        LOGIS(\"Image Description: \", cdescription);\n    }\n\n    //Get software field if exist\n    jfieldID softwareFieldID = env->GetFieldID(jConvertOptionsClass, \"software\", \"Ljava/lang/String;\");\n    software = (jstring)env->GetObjectField(optionsObj, softwareFieldID);\n    if (software) {\n        csoftware = env->GetStringUTFChars(software, 0);\n        LOGIS(\"Software tag: \", csoftware);\n    }\n\n    // variables for resolution\n    jfieldID gOptions_xResolutionFieldID = env->GetFieldID(jConvertOptionsClass, \"xResolution\", \"F\");\n    xRes = env->GetFloatField(optionsObj, gOptions_xResolutionFieldID);\n    jfieldID gOptions_yResolutionFieldID = env->GetFieldID(jConvertOptionsClass, \"yResolution\", \"F\");\n    yRes = env->GetFloatField(optionsObj, gOptions_yResolutionFieldID);\n    jfieldID gOptions_resUnitFieldID = env->GetFieldID(jConvertOptionsClass,\n                                                       \"resUnit\",\n                                                       \"Lorg/beyka/tiffbitmapfactory/ResolutionUnit;\");\n    jobject resUnitObject = env->GetObjectField(optionsObj, gOptions_resUnitFieldID);\n    //Get res int from resUnitObject\n    jclass resolutionUnitClass = env->FindClass(\"org/beyka/tiffbitmapfactory/ResolutionUnit\");\n    jfieldID resUnitOrdinalFieldID = env->GetFieldID(resolutionUnitClass, \"ordinal\", \"I\");\n    resUnit = env->GetIntField(resUnitObject, resUnitOrdinalFieldID);\n    env->DeleteLocalRef(resolutionUnitClass);\n\n    //Get decode are\n    jfieldID gOptions_decodeAreaFieldID = env->GetFieldID(jConvertOptionsClass,\n                                                           \"inTiffDecodeArea\",\n                                                           \"Lorg/beyka/tiffbitmapfactory/DecodeArea;\");\n    jobject decodeAreaObj = env->GetObjectField(optionsObj, gOptions_decodeAreaFieldID);\n    if (decodeAreaObj) {\n        LOGI(\"Decode bounds present\");\n        jclass decodeAreaClass = env->FindClass(\"org/beyka/tiffbitmapfactory/DecodeArea\");\n        jfieldID xFieldID = env->GetFieldID(decodeAreaClass, \"x\", \"I\");\n        jfieldID yFieldID = env->GetFieldID(decodeAreaClass, \"y\", \"I\");\n        jfieldID widthFieldID = env->GetFieldID(decodeAreaClass, \"width\", \"I\");\n        jfieldID heightFieldID = env->GetFieldID(decodeAreaClass, \"height\", \"I\");\n\n        boundX = env->GetIntField(decodeAreaObj, xFieldID);\n        boundY = env->GetIntField(decodeAreaObj, yFieldID);\n        boundWidth = env->GetIntField(decodeAreaObj, widthFieldID);\n        boundHeight = env->GetIntField(decodeAreaObj, heightFieldID);\n\n\n        LOGII(\"Decode X\", boundX);\n        LOGII(\"Decode Y\", boundY);\n        LOGII(\"Decode width\", boundWidth);\n        LOGII(\"Decode height\", boundHeight);\n\n        hasBounds = 1;\n        env->DeleteLocalRef(decodeAreaClass);\n    }\n}\n\nchar BaseTiffConverter::normalizeDecodeArea() {\n    if (hasBounds) {\n        if (boundX >= width-1) {\n                const char *message = \"X of left top corner of decode area should be less than image width\";\n                LOGE(*message);\n                if (throwException) {\n                    jstring adinf = env->NewStringUTF(message);\n                    if (inPath) {\n                        throw_decode_file_exception(env, inPath, adinf);\n                    } else {\n                        throw_decode_file_exception_fd(env, inFd, adinf);\n                    }\n                    env->DeleteLocalRef(adinf);\n                }\n                return 0;\n            }\n            if (boundY >= height-1) {\n                const char *message = \"Y of left top corner of decode area should be less than image height\";\n                LOGE(*message);\n                if (throwException) {\n                    jstring adinf = env->NewStringUTF(message);\n                    if (inPath) {\n                        throw_decode_file_exception(env, inPath, adinf);\n                    } else {\n                        throw_decode_file_exception_fd(env, inFd, adinf);\n                    }\n                    env->DeleteLocalRef(adinf);\n                }\n                return 0;\n            }\n\n            if (boundX < 0) boundX = 0;\n            if (boundY < 0) boundY = 0;\n            if (boundX + boundWidth >= width) boundWidth = width - boundX -1;\n            if (boundY + boundHeight >= height) boundHeight = height - boundY -1;\n\n            if (boundWidth < 1) {\n                const char *message = \"Width of decode area can\\'t be less than 1\";\n                LOGE(*message);\n                if (throwException) {\n                    jstring adinf = env->NewStringUTF(message);\n                    if (inPath) {\n                        throw_decode_file_exception(env, inPath, adinf);\n                    } else {\n                        throw_decode_file_exception_fd(env, inFd, adinf);\n                    }\n                    env->DeleteLocalRef(adinf);\n                }\n                return 0;\n            }\n            if (boundHeight < 1) {\n                const char *message = \"Height of decode area can\\'t be less than 1\";\n                LOGE(*message);\n                if (throwException) {\n                    jstring adinf = env->NewStringUTF(message);\n                    if (inPath) {\n                        throw_decode_file_exception(env, inPath, adinf);\n                    } else {\n                        throw_decode_file_exception_fd(env, inFd, adinf);\n                    }\n                    env->DeleteLocalRef(adinf);\n                }\n                return 0;\n            }\n\n            outWidth = boundWidth;\n            outHeight = boundHeight;\n            outStartX = boundX;\n            outStartY = boundY;\n\n            return 1;\n    } else {\n            outWidth = width;\n            outHeight = height;\n            outStartX = 0;\n            outStartY = 0;\n\n            return 1;\n    }\n}\n\nchar *BaseTiffConverter::getCreationDate() {\n    char * datestr = (char *) malloc(sizeof(char) * 20);\n    time_t rawtime;\n    struct tm * timeinfo;\n    time (&rawtime);\n    timeinfo = localtime (&rawtime);\n    strftime (datestr,20,/*\"Now it's %I:%M%p.\"*/\"%Y:%m:%d %H:%M:%S\",timeinfo);\n\n    return datestr;\n}\n\nvoid BaseTiffConverter::sendProgress(jlong current, jlong total) {\n    if (listener != NULL) {\n        jmethodID methodid = env->GetMethodID(jIProgressListenerClass, \"reportProgress\", \"(JJ)V\");\n        env->CallVoidMethod(listener, methodid, current, total);\n    }\n}\n\njboolean BaseTiffConverter::checkStop() {\n    jmethodID methodID = env->GetStaticMethodID(jThreadClass, \"interrupted\", \"()Z\");\n    jboolean interupted = env->CallStaticBooleanMethod(jThreadClass, methodID);\n\n    jboolean stop;\n\n    if (optionsObj) {\n        jfieldID stopFieldId = env->GetFieldID(jConvertOptionsClass,\n                                               \"isStoped\",\n                                               \"Z\");\n        stop = env->GetBooleanField(optionsObj, stopFieldId);\n\n    } else {\n        stop = JNI_FALSE;\n    }\n\n    return interupted || stop;\n}\n\nvoid BaseTiffConverter::rotateTileLinesVertical(uint32 tileHeight, uint32 tileWidth, uint32* whatRotate, uint32 *bufferLine) {\n    for (int line = 0; line < tileHeight / 2; line++) {\n        unsigned int  *top_line, *bottom_line;\n        top_line = whatRotate + tileWidth * line;\n        bottom_line = whatRotate + tileWidth * (tileHeight - line -1);\n        _TIFFmemcpy(bufferLine, top_line, sizeof(unsigned int) * tileWidth);\n        _TIFFmemcpy(top_line, bottom_line, sizeof(unsigned int) * tileWidth);\n        _TIFFmemcpy(bottom_line, bufferLine, sizeof(unsigned int) * tileWidth);\n    }\n}\n\nvoid BaseTiffConverter::rotateTileLinesHorizontal(uint32 tileHeight, uint32 tileWidth, uint32* whatRotate, uint32 *bufferLine) {\n    uint32 buf;\n    for (int y = 0; y < tileHeight; y++) {\n        for (int x = 0; x < tileWidth / 2; x++) {\n            buf = whatRotate[y * tileWidth + x];\n            whatRotate[y * tileWidth + x] = whatRotate[y * tileWidth + tileWidth - x - 1];\n            whatRotate[y * tileWidth + tileWidth - x - 1] = buf;\n        }\n    }\n}\n\nvoid BaseTiffConverter::normalizeTile(uint32 tileHeight, uint32 tileWidth, uint32* rasterTile) {\n    //normalize tile\n    //find start and end pixels\n    int sx = -1, ex= -1, sy= -1, ey= -1;\n    for (int y = 0; y < tileHeight; y++) {\n        for (int x = 0; x < tileWidth; x++) {\n            if (rasterTile[y * tileWidth + x] != 0) {\n                sx = x;\n                sy = y;\n                break;\n            }\n        }\n        if (sx != -1) break;\n    }\n    for (int y = tileHeight -1; y >= 0; y--) {\n        for (int x = tileWidth -1; x >= 0; x--) {\n            if (rasterTile[y * tileWidth + x] != 0) {\n                ex = x;\n                ey = y;\n                break;\n            }\n        }\n        if (ex != -1) break;\n    }\n    if (sy != 0) {\n        for (int y = 0; y < tileHeight - sy -1; y++) {\n            memcpy(rasterTile + (y * tileWidth), rasterTile + ((y+sy)*tileWidth), tileWidth * sizeof(uint32));\n        }\n    }\n    if (sx != 0) {\n        for (int y = 0; y < tileHeight; y++) {\n           for (int x = 0; x < tileWidth - sx -1; x++) {\n               rasterTile[y * tileWidth + x] = rasterTile[y * tileWidth + x + sx];\n           }\n        }\n    }\n}\n"
  },
  {
    "path": "src/main/jni/BaseTiffConverter.h",
    "content": "//\n// Created by beyka on 5/11/17.\n//\n\n#ifndef TIFFSAMPLE_BASETIFFCONVERTER_H\n#define TIFFSAMPLE_BASETIFFCONVERTER_H\n\n#include <stdlib.h>\n#include <stdio.h>\n#include <tiffio.h>\n#include \"NativeExceptions.h\"\n#include <jni.h>\n#include <android/log.h>\n#include \"unistd.h\"\n#include <ctime>\n#include \"string.h\"\n\n#ifdef NDEBUG\n    #define LOGI(x)\n    #define LOGII(x, y)\n    #define LOGIF(x, y)\n    #define LOGIS(x, y)\n    #define LOGE(x)\n    #define LOGES(x, y)\n#else\n    #define LOGI(x) __android_log_print(ANDROID_LOG_DEBUG, \"BaseTiffConverter\", \"%s\", x)\n    #define LOGII(x, y) __android_log_print(ANDROID_LOG_DEBUG, \"BaseTiffConverter\", \"%s %d\", x, y)\n    #define LOGIF(x, y) __android_log_print(ANDROID_LOG_DEBUG, \"BaseTiffConverter\", \"%s %f\", x, y)\n    #define LOGIS(x, y) __android_log_print(ANDROID_LOG_DEBUG, \"BaseTiffConverter\", \"%s %s\", x, y)\n    #define LOGE(x) __android_log_print(ANDROID_LOG_ERROR, \"BaseTiffConverter\", \"%s\", x)\n    #define LOGES(x, y) __android_log_print(ANDROID_LOG_ERROR, \"BaseTiffConverter\", \"%s %s\", x, y)\n#endif\n\n\nclass BaseTiffConverter {\n    public:\n        explicit BaseTiffConverter(JNIEnv *, jclass, jstring, jstring, jobject, jobject);\n        explicit BaseTiffConverter(JNIEnv *, jclass, jint, jint, jobject, jobject);\n        ~BaseTiffConverter();\n        virtual jboolean convert() = 0;\n\n    protected:\n        static const int colorMask = 0xFF;\n\n        jboolean conversion_result = JNI_FALSE;\n\n        JNIEnv *env;\n        jstring inPath;\n        jstring outPath;\n        jint inFd;\n        jint outFd;\n        jobject optionsObj = NULL;\n        jobject listener = NULL;\n        jclass jConvertOptionsClass = NULL;\n        jclass jIProgressListenerClass = NULL;\n        jclass jThreadClass = NULL;\n\n        uint32 width;\n        uint32 height;\n        uint32 outWidth;\n        uint32 outHeight;\n        uint32 outStartX;\n        uint32 outStartY;\n\n        jlong availableMemory;\n        jboolean throwException;\n\n        jint tiffDirectory;\n\n        jboolean appendTiff;\n        jint compressionInt;\n        jint orientationInt;\n        uint16 resUnit;\n        float xRes;\n        float yRes;\n        jstring description;\n        const char *cdescription = NULL;\n        jstring software;\n        const char *csoftware = NULL;\n        int boundX;\n        int boundY;\n        int boundWidth;\n        int boundHeight;\n        char hasBounds;\n\n        void readOptions();\n        char normalizeDecodeArea();\n        char *getCreationDate();\n        void sendProgress(jlong, jlong);\n        jboolean checkStop();\n        void rotateTileLinesVertical(uint32, uint32, uint32*, uint32*);\n        void rotateTileLinesHorizontal(uint32, uint32, uint32*, uint32*);\n        void normalizeTile(uint32, uint32, uint32*);\n\n};\n\n#endif //TIFFSAMPLE_BASETOTIFFCONVERTER_H\n"
  },
  {
    "path": "src/main/jni/BitmapReader.cpp",
    "content": "//\n// Created by beyka on 9/21/17.\n//\nusing namespace std;\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#include \"BitmapReader.h\"\n#include \"BMP.h\"\n#include <android/bitmap.h>\n\n\njobject readBmp\n  (JNIEnv *env, jclass clazz, jstring tiffPath, jstring inPath, jobject options, jobject listener)\n  {\n    FILE *inFile;\n       //open bmp file fow reading\n            const char *inCPath = NULL;\n            inCPath = env->GetStringUTFChars(inPath, 0);\n            LOGIS(\"IN path\", inCPath);\n            inFile = fopen(inCPath, \"rb\");\n            if (!inFile) {\n                //if (throwException) {\n                    throw_cant_open_file_exception(env, inPath);\n                //}\n                LOGES(\"Can\\'t open out file\", inCPath);\n                env->ReleaseStringUTFChars(inPath, inCPath);\n                return JNI_FALSE;\n            } else {\n                env->ReleaseStringUTFChars(inPath, inCPath);\n            }\n\n            //read file header\n            size_t byte_count = 54;\n            unsigned char *header = (unsigned char *)malloc(sizeof(unsigned char) * byte_count);\n            fread(header, 1, byte_count, inFile);\n            rewind(inFile);\n\n            //Check is file is JPG image\n            bool is_bmp = !strncmp( (const char*)header, \"BM\", 2 );\n            //seek file to begin\n            //rewind(inFile);\n            if (!is_bmp) {\n                LOGE(\"Not bmp file\");\n//                if (throwException) {\n                    throw_cant_open_file_exception(env, inPath);\n  //              }\n                return JNI_FALSE;\n            } else {\n                LOGI(\"IS BMP\");\n            }\n\n\n        unsigned char *buf;\n            BITMAPFILEHEADER bmp;\n            BITMAPINFOHEADER inf;\n            int size;\n            int width, height;\n\n            fread(&bmp, sizeof(BITMAPFILEHEADER), 1, inFile);\n            //read(fd, &bmp, sizeof(BITMAPFILEHEADER));\n            //read(fd, &inf,sizeof(BITMAPINFOHEADER));\n            fread(&inf, sizeof(BITMAPINFOHEADER), 1, inFile);\n\n            width = inf.biWidth;\n            height = inf.biHeight;\n            LOGII(\"width = \", inf.biWidth);\n            LOGII(\"height = \", inf.biHeight);\n\n            LOGII(\"bfType\",bmp.bfType);\n            LOGII(\"bfSize\",bmp.bfSize);\n            LOGII(\"bfOffBits\",bmp.bfOffBits);\n\n            LOGII(\"biSize\",inf.biSize);\n            LOGII(\"biPlanes\",inf.biPlanes);\n            LOGII(\"biBitCount\",inf.biBitCount);\n            LOGII(\"biCompression\",inf.biCompression);\n            LOGII(\"biSizeImage\",inf.biSizeImage);\n\n            //check if bitnap not 24 bits - throw exception\n\n            /*if (inf.biBitCount != 24) {\n                LOGE(\"Not 24 bits file\");\n                if (throwException) {\n                    throw_cant_open_file_exception(env, inPath);\n                }\n                return NULL;\n            }*/\n\n            LOGII(\"biSizeImage\", inf.biSizeImage);\n            if(inf.biSizeImage == 0)  {\n                size = width * 3 + width % 4;\n                size = size * height;\n            } else {\n                size = inf.biSizeImage;\n            }\n\n            buf = (unsigned char *)malloc(size);\n            if (buf == NULL) {\n                LOGE(\"Cant allocate buffer\");\n                return NULL;\n            }\n\n            fseek(inFile, bmp.bfOffBits, SEEK_SET);\n\n            //fread(pixels, sizeof(unsigned char), rowPerStrip * rowSize, inFile);\n\n            int n = fread(buf, sizeof(unsigned char), size, inFile);\n            //int n = read(inFile, buf, size);\n            LOGII(\"Read bytes\", n);\n\n             int temp, line, i, j, numImgBytes, iw, ih, ind = 0, new_ind = 0;\n                uint32 *pixels;\n\n                temp = width * 3;\n                line = temp + width % 4;\n                numImgBytes = (4 * (width * height));\n                pixels = (uint32*)malloc(numImgBytes);\n\n                //memcpy(pixels, buf, numImgBytes);\n                numImgBytes = line * height;\n                for (i = 0; i < numImgBytes; i++) {\n                    unsigned int r, g, b;\n                    if (i > temp && (i % line) >= temp) continue;\n\n                    b = buf[i];\n                    i++;\n                    g = buf[i];\n                    i++;\n                    r = buf[i];\n\n                    /*iw = ind % width;\n                    ih = ind / width;\n                    new_ind = iw + (height - ih - 1) * width;*/\n\n\n\n                    unsigned int alpha = 255;\n                    pixels[ind] = (r| g << 8 | b << 16 | alpha << 24) ;\n                    ind++;\n                }\n\n                for (i = 0; i < height/2 ;i++) {\n                    uint32 *tmp = new uint32[width];\n                    memcpy(tmp, pixels + i * width, width * sizeof(uint32));\n                    memcpy(pixels + i * width, pixels + (height - 1- i) * width , width * sizeof(uint32));\n                    memcpy(pixels + (height - 1- i) * width , tmp, width * sizeof(uint32));\n                    free (tmp);\n                }\n\n                free(buf);\n\n\n            jclass bitmapClass = env->FindClass(\"android/graphics/Bitmap\");\n                jmethodID methodid = env->GetStaticMethodID(bitmapClass, \"createBitmap\",\n                                                            \"(IILandroid/graphics/Bitmap$Config;)Landroid/graphics/Bitmap;\");\n\n            jclass bitmapConfigClass = env->FindClass(\"android/graphics/Bitmap$Config\");\n            jfieldID bitmapConfigField = env->GetStaticFieldID(bitmapConfigClass, \"ARGB_8888\",\n                                                              \"Landroid/graphics/Bitmap$Config;\");\n                //BitmapConfig\n                jobject config = env->GetStaticObjectField(bitmapConfigClass, bitmapConfigField);\n\n\n               jobject java_bitmap = env->CallStaticObjectMethod(bitmapClass, methodid, width,\n                                                                      height, config);\n\nint ret;\nvoid *bitmapPixels;\nif ((ret = AndroidBitmap_lockPixels(env, java_bitmap, &bitmapPixels)) < 0) {\n        //error\n        LOGE(\"Lock pixels failed\");\n        return NULL;\n    }\n    int pixelsCount = width * height;\n\n        memcpy(bitmapPixels, (jint *) pixels, sizeof(jint) * pixelsCount);\n\nAndroidBitmap_unlockPixels(env, java_bitmap);\n\nfree(pixels);\n\n                                                                      return java_bitmap;\n  }\n\n#ifdef __cplusplus\n}\n#endif\n\n"
  },
  {
    "path": "src/main/jni/BitmapReader.h",
    "content": "//\n// Created by beyka on 9/21/17.\n//\n\n#ifndef TIFFSAMPLE_BITMAPREADER_H\n#define TIFFSAMPLE_BITMAPREADER_H\n\n#include <stdlib.h>\n#include <stdio.h>\n#include <tiffio.h>\n#include \"string.h\"\n#include \"NativeExceptions.h\"\n#include <jni.h>\n#include <android/log.h>\n#include \"unistd.h\"\n#include <ctime>\n\n#ifdef NDEBUG\n    #define LOGI(x)\n    #define LOGII(x, y)\n    #define LOGIF(x, y)\n    #define LOGIS(x, y)\n    #define LOGE(x)\n    #define LOGES(x, y)\n#else\n    #define LOGI(x) __android_log_print(ANDROID_LOG_DEBUG, \"BMPReader\", \"%s\", x)\n    #define LOGII(x, y) __android_log_print(ANDROID_LOG_DEBUG, \"BMPReader\", \"%s %d\", x, y)\n    #define LOGIF(x, y) __android_log_print(ANDROID_LOG_DEBUG, \"BMPReader\", \"%s %f\", x, y)\n    #define LOGIS(x, y) __android_log_print(ANDROID_LOG_DEBUG, \"BMPReader\", \"%s %s\", x, y)\n    #define LOGE(x) __android_log_print(ANDROID_LOG_ERROR, \"BMPReader\", \"%s\", x)\n    #define LOGES(x, y) __android_log_print(ANDROID_LOG_ERROR, \"BMPReader\", \"%s %s\", x, y)\n#endif\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\njobject readBmp\n  (JNIEnv *env, jclass clazz, jstring tiffPath, jstring pngPath, jobject options, jobject listener);\n\n#ifdef __cplusplus\n}\n#endif\n#endif //TIFFSAMPLE_BITMAPREADER_H\n"
  },
  {
    "path": "src/main/jni/BmpToTiffConverter.cpp",
    "content": "//\n// Created by beyka on 9/20/17.\n//\n#include \"BmpToTiffConverter.h\"\n\nBmpToTiffConverter::BmpToTiffConverter(JNIEnv *e, jclass clazz, jstring in, jstring out, jobject opts, jobject listener)\n    : BaseTiffConverter(e, clazz, in, out, opts, listener)\n{\n}\n\nBmpToTiffConverter::BmpToTiffConverter(JNIEnv *e, jclass clazz, jint in, jint out, jobject opts, jobject listener)\n    : BaseTiffConverter(e, clazz, in, out, opts, listener)\n{\n}\n\nBmpToTiffConverter::~BmpToTiffConverter()\n{\n    LOGI(\"Destructor\");\n    if (tiffImage) {\n        TIFFClose(tiffImage);\n        tiffImage = NULL;\n    }\n    LOGI(\"Tiff removed\");\n\n    if (inf) {\n        delete inf;\n    }\n    LOGI(\"Inf deleted\");\n\n    if (bmp) {\n        delete bmp;\n    }\n    LOGI(\"header deleted\");\n}\n\njboolean BmpToTiffConverter::convert()\n{\n    LOGI(\"CONVERT\");\n    readOptions();\n\n    if(outFd < 0) {\n        //open tiff file for writing or appending\n        const char *outCPath = NULL;\n        outCPath = env->GetStringUTFChars(outPath, 0);\n        LOGIS(\"OUT path\", outCPath);\n        LOGIS(\"nativeTiffOpenForSave\", outCPath);\n        int mode = O_RDWR | O_CREAT | O_TRUNC | 0;\n        if (appendTiff) {\n            mode = O_RDWR | O_CREAT;\n        }\n         outFd = open(outCPath, mode, 0666);\n         if (outFd < 0) {\n            throw_cant_open_file_exception(env, outPath);\n            env->ReleaseStringUTFChars(outPath, outCPath);\n            return JNI_FALSE;\n         }\n         env->ReleaseStringUTFChars(outPath, outCPath);\n    }\n\n    if (!appendTiff) {\n        if ((tiffImage = TIFFFdOpen(outFd, \"\", \"w\")) == NULL) {\n            LOGE(\"Unable to open tif file\");\n            if (throwException) {\n                throw_cant_open_file_exception_fd(env, outFd);\n            }\n            return JNI_FALSE;\n        }\n    } else {\n         if ((tiffImage = TIFFFdOpen(outFd, \"\", \"a\")) == NULL) {\n            LOGE(\"Unable to open tif file\");\n            if (throwException) {\n                throw_cant_open_file_exception_fd(env, outFd);\n            }\n            return JNI_FALSE;\n         }\n    }\n\n    //open bmp file fow reading\n    if(inFd < 0) {\n        const char *inCPath = NULL;\n        inCPath = env->GetStringUTFChars(inPath, 0);\n        LOGIS(\"IN path\", inCPath);\n        int mode = O_RDONLY;\n        inFd = open(inCPath, mode, 0666);\n        if (inFd < 0) {\n            LOGES(\"Can\\'t open in file\", inCPath);\n            throw_cant_open_file_exception(env, inPath);\n            env->ReleaseStringUTFChars(inPath, inCPath);\n            return JNI_FALSE;\n        }\n        env->ReleaseStringUTFChars(inPath, inCPath);\n    }\n\n    //Read header of bitmap file\n    readHeaders();\n\n    //Check is file is BMP image\n    bool is_bmp = !strncmp( (const char*)&bmp->bfType, \"BM\", 2 );\n    if (!is_bmp) {\n        LOGE(\"Not bmp file\");\n        if (throwException) {\n            throw_cant_open_file_exception_fd(env, inFd);\n        }\n        return JNI_FALSE;\n    }\n\n    //check is bitmap has 24  bit per pixel. other format not supported\n    if (inf->biBitCount != 16 && inf->biBitCount != 24 && inf->biBitCount != 32 && inf->biBitCount != 0) {\n        LOGE(\"Support only 24bpp bitmaps\");\n        if (throwException) {\n            throw_cant_open_file_exception_fd(env, inFd);\n        }\n        return JNI_FALSE;\n    }\n    LOGII(\"Bits per pixel\", inf->biBitCount);\n\n    int compression = inf->biCompression;\n    LOGII(\"compression\", inf->biCompression);\n    for (int i = 0; i < 3; i++) {\n        LOGII(\"mask\", inf->biPalete[i]);\n    }\n\n    //Component per pixel will be always 4. Alpha will be always 0xff\n    int componentsPerPixel = 4;//inf->biBitCount / 8;\n\n    int width = inf->biWidth;\n    int height = inf->biHeight;\n    LOGII(\"width\", width);\n    LOGII(\"height\", height);\n\n    //Create tiff structure\n    TIFFSetField(tiffImage, TIFFTAG_IMAGEWIDTH, width);\n    TIFFSetField(tiffImage, TIFFTAG_IMAGELENGTH, height);\n    TIFFSetField(tiffImage, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);\n    TIFFSetField(tiffImage, TIFFTAG_COMPRESSION, compressionInt);\n    TIFFSetField(tiffImage, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);\n    TIFFSetField(tiffImage, TIFFTAG_XRESOLUTION, xRes);\n    TIFFSetField(tiffImage, TIFFTAG_YRESOLUTION, yRes);\n    TIFFSetField(tiffImage, TIFFTAG_RESOLUTIONUNIT, resUnit);\n\n    if (compressionInt == COMPRESSION_CCITTRLE || compressionInt == COMPRESSION_CCITTFAX3 || compressionInt == COMPRESSION_CCITTFAX4) {\n        TIFFSetField(tiffImage, TIFFTAG_BITSPERSAMPLE,\t1);\n        TIFFSetField(tiffImage, TIFFTAG_SAMPLESPERPIXEL,\t1);\n        TIFFSetField(tiffImage, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISBLACK);\n        TIFFSetField(tiffImage, TIFFTAG_FILLORDER, FILLORDER_MSB2LSB);\n    } else {\n        TIFFSetField(tiffImage, TIFFTAG_BITSPERSAMPLE, 8);\n        TIFFSetField(tiffImage, TIFFTAG_SAMPLESPERPIXEL, componentsPerPixel);\n        TIFFSetField(tiffImage, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB);\n    }\n\n    //creation date\n    char *date = getCreationDate();\n    TIFFSetField(tiffImage, TIFFTAG_DATETIME, date);\n    free(date);\n    //image description\n    if (cdescription) {\n        TIFFSetField(tiffImage, TIFFTAG_IMAGEDESCRIPTION, cdescription);\n    }\n    //software tag\n    if (csoftware) {\n        TIFFSetField(tiffImage, TIFFTAG_SOFTWARE, csoftware);\n    }\n\n    //progress reporter\n    jlong total = width * height;\n    sendProgress(0, total);\n\n    int rowSize = width * componentsPerPixel;\n    //Calculate row per strip\n    //maximum size for strip should be less than 2Mb if memory available\n    unsigned long MB2 = (availableMemory == -1 || availableMemory > 3 * 1024 * 1024) ? 2 * 1024 * 1024 : width * 4;\n    int rowPerStrip = MB2/rowSize;\n    if (rowPerStrip >= height) {\n        rowPerStrip = height / 4;\n    }\n    if (rowPerStrip < 1) rowPerStrip = 1;\n    LOGII(\"rowPerStrip\", rowPerStrip);\n\n    unsigned long estimateMem = rowPerStrip * width * 4 * 2;//need 2 buffers for read data from bitmap. Check getPixelsFromBmp method\n\n    if (compressionInt == COMPRESSION_JPEG) {\n        estimateMem += width * sizeof(uint32);//temp array for writing JPEG lines\n        estimateMem += width * sizeof(uint32);//temp array for fliping bitmap data in getPixelsFromBmp method\n    } else if (compressionInt == COMPRESSION_CCITTRLE || compressionInt == COMPRESSION_CCITTFAX3 || compressionInt == COMPRESSION_CCITTFAX4) {\n        estimateMem += (width/8 + 0.5) * rowPerStrip; // bilevel array\n    } else {\n        estimateMem += 0;\n    }\n    LOGII(\"estimateMem\", estimateMem);\n    if (estimateMem > availableMemory && availableMemory != -1) {\n        LOGEI(\"Not enough memory\", availableMemory);\n        if (throwException) {\n            throw_not_enought_memory_exception(env, availableMemory, estimateMem);\n        }\n        return JNI_FALSE;\n    }\n\n    if (checkStop()) {\n        conversion_result = JNI_FALSE;\n        return conversion_result;\n    }\n\n    int ret;\n\n    if (compressionInt == COMPRESSION_CCITTRLE || compressionInt == COMPRESSION_CCITTFAX3 || compressionInt == COMPRESSION_CCITTFAX4) {\n        TIFFSetField(tiffImage, TIFFTAG_ROWSPERSTRIP, rowPerStrip);\n        int compressedWidth = (width/8 + 0.5);\n        for (int y = 0; y < height; y+=rowPerStrip) {\n            if (checkStop()) {\n                conversion_result = JNI_FALSE;\n                return conversion_result;\n            }\n            int rowToRead = rowPerStrip;\n            if (rowToRead + y >= height) {\n                rowToRead = height - y;\n            }\n            sendProgress(y * width, total);\n            uint32 *pixels = getPixelsFromBmp(y, rowToRead);\n            unsigned char *bilevel = convertArgbToBilevel(pixels, width, rowToRead);\n            free(pixels);\n            ret = TIFFWriteEncodedStrip(tiffImage, y/rowToRead, bilevel, compressedWidth * sizeof(unsigned char) * rowToRead);\n            free(bilevel);\n        }\n    } else if (compressionInt == COMPRESSION_JPEG) {\n        for (int ys = 0; ys < height; ys+=rowPerStrip) {\n        if (checkStop()) {\n            return JNI_FALSE;\n        }\n        int rowToRead = rowPerStrip;\n        if (rowToRead + ys >= height) {\n            rowToRead = height - ys;\n        }\n        sendProgress(ys * width, total);\n        uint32 *pixels = getPixelsFromBmp(ys, rowToRead);\n        uint32 *pixelsline = new uint32[width];\n        for (int k = 0; k < rowToRead; k++) {\n            memcpy(pixelsline, &pixels [k * width], width * sizeof(uint32));\n            ret = TIFFWriteScanline(tiffImage, pixelsline, ys + k, 0);\n        }\n        delete[] pixelsline;\n        free(pixels);\n        }\n    } else {\n        TIFFSetField(tiffImage, TIFFTAG_ROWSPERSTRIP, rowPerStrip);\n        for (int y = 0; y < height; y+=rowPerStrip) {\n            if (checkStop()) {\n                return JNI_FALSE;\n            }\n            int rowToRead = rowPerStrip;\n            if (rowToRead + y >= height) {\n                rowToRead = height - y;\n            }\n            //LOGII(\"rowToRead\", rowToRead);\n            sendProgress(y * width, total);\n            uint32 *pixels = getPixelsFromBmp(y, rowToRead);\n            TIFFWriteEncodedStrip(tiffImage, y/rowPerStrip, pixels, width * sizeof(uint32) * rowToRead);\n            free(pixels);\n        }\n    }\n\n    ret = TIFFWriteDirectory(tiffImage);\n    LOGII(\"ret = \", ret);\n\n    sendProgress(total, total);\n    conversion_result = JNI_TRUE;\n    return conversion_result;\n}\n\nvoid BmpToTiffConverter::readHeaders()\n{\n    bmp = new BITMAPFILEHEADER;\n    inf = new BITMAPINFOHEADER;\n    int br = read(inFd, bmp, sizeof(BITMAPFILEHEADER));\n    LOGII(\"Read bytes \", br);\n    LOGIS(\"bmp read \", bmp);\n    int bi = read(inFd, inf, sizeof(BITMAPINFOHEADER));\n    LOGII(\"Read bytes \", bi);\n    LOGIS(\"inf read \", (char*)inf);\n}\n\nuint32 *BmpToTiffConverter::getPixelsFromBmp(int offset, int limit)\n{\n    int componentPerPixel = inf->biBitCount/8;\n    LOGII(\"componentPerPixel\", inf->biBitCount);\n    LOGII(\"componentPerPixel\", componentPerPixel);\n\n    if (componentPerPixel == 2) {\n        return getPixelsFrom16Bmp(offset, limit);\n    } else if (componentPerPixel == 3) {\n        return getPixelsFrom24Bmp(offset, limit);\n    } else if (componentPerPixel == 4) {\n        return getPixelsFrom32Bmp(offset, limit);\n    }\n\n    return NULL;\n}\n\nuint32 *BmpToTiffConverter::getPixelsFrom16Bmp(int offset, int limit)\n{\n    unsigned char *buf;\n    int size;\n    int width = inf->biWidth;\n    int height = inf->biHeight;\n\n    LOGII(\"compr\", inf->biCompression);\n\n    if (offset + limit >= height) {\n        limit = height - offset;\n    }\n\n    //width of bitmap should be multiple 4\n    size = width * 2 + (width * 2) % 4;\n    size = size * limit;\n\n    buf = (unsigned char *)malloc(size);\n    if (buf == NULL) {\n        LOGE(\"Can\\'t allocate buffer\");\n        return NULL;\n    }\n\n    //in bitmap picture stored fliped from up to down.\n    //when need read 0 row - should read height-1 row\n    //seek file to position from the end of file to read\n    lseek(inFd, bmp->bfOffBits + (height - offset - limit) * (width * 2 + (width * 2) % 4) , SEEK_SET);\n    int n = read(inFd, buf, size);\n    LOGII(\"Read bytes\", n);\n\n    int temp, line, i, j, numImgBytes, ind = 0;\n    uint32 *pixels;\n\n    temp = width * 2;\n    line = temp + (width * 2) % 4;//width % 4;\n    numImgBytes = (4 * (width * limit));\n    pixels = (uint32*)malloc(numImgBytes);\n\n    int pixelss = 0;\n\n    numImgBytes = line * limit;\n    for (i = 0; i < numImgBytes; i+=2) {\n\n        if (i > temp && (i % line) >= temp) continue;\n\n        uint16_t r, g, b, a = 0b11111111;\n\n        uint16_t* pix = (uint16_t*) (buf + i);\n\n        r = inf->biPalete[0] & *pix;\n        g = inf->biPalete[1] & *pix;\n        b = inf->biPalete[2] & *pix;\n\n        //Use one of palete mask to determine which type of 1 bpp used 555 or 565\n        char greenShiftBits;\n        g = g >> 5;\n        if (inf->biPalete[1] == 0x03E0) {\n            greenShiftBits = 3;\n            r = r >> 10;\n        } else {\n            greenShiftBits = 2;\n            r = r >> 11;\n        }\n\n        pixels[ind] = (r<<3) | (g << greenShiftBits << 8) | (b << 3 << 16)  | a << 24 ;//(r| g << 8 | b << 16 | a << 24) ;\n\n        ind++;\n    }\n\n    uint32 *tmp = new uint32[width];\n    for (i = 0; i < limit/2 ;i++) {\n        memcpy(tmp, pixels + i * width, width * sizeof(uint32));\n        memcpy(pixels + i * width, pixels + (limit - 1- i) * width , width * sizeof(uint32));\n        memcpy(pixels + (limit - 1- i) * width , tmp, width * sizeof(uint32));\n    }\n    free (tmp);\n\n    free(buf);\n\n    return pixels;\n}\n\nuint32 *BmpToTiffConverter::getPixelsFrom24Bmp(int offset, int limit)\n{\n    unsigned char *buf;\n    int size;\n    int width = inf->biWidth;\n    int height = inf->biHeight;\n\n    if (offset + limit >= height) {\n        limit = height - offset;\n    }\n\n    //width of bitmap should be multiple 4\n    size = width * 3 + width % 4;\n    size = size * limit;\n\n    buf = (unsigned char *)malloc(size);\n    if (buf == NULL) {\n        LOGE(\"Can\\'t allocate buffer\");\n        return NULL;\n    }\n\n    //in bitmap picture stored fliped from up to down.\n    //when need read 0 row - should read height-1 row\n    //seek file to position from the end of file to read\n    lseek(inFd, bmp->bfOffBits + (height - offset - limit) * (width * 3 + width % 4) , SEEK_SET);\n    int n = read(inFd, buf, size);\n\n    LOGII(\"Read bytes\", n);\n\n    int temp, line, i, j, numImgBytes, ind = 0;\n    uint32 *pixels;\n\n    temp = width * 3;\n    line = temp + width % 4;//width % 4;\n    numImgBytes = (4 * (width * limit));\n    pixels = (uint32*)malloc(numImgBytes);\n\n    numImgBytes = line * limit;\n    for (i = 0; i < numImgBytes; i++) {\n        unsigned char r, g, b, a = 0b11111111;\n        //width of bitmap should be multiple 4\n        //here skip pixels that haven't data\n        //but if bitmap is 32 bpp - it is laready multiple to 4\n        if (i > temp && (i % line) >= temp) continue;\n\n        //read colors. alpha always 255lf because 24bpp bitmap hasn't alpha chanel\n\n        b = buf[i];\n        i++;\n        g = buf[i];\n        i++;\n        r = buf[i];\n\n\n        pixels[ind] = (r| g << 8 | b << 16 | a << 24) ;\n        ind++;\n    }\n\n    uint32 *tmp = new uint32[width];\n    for (i = 0; i < limit/2 ;i++) {\n        memcpy(tmp, pixels + i * width, width * sizeof(uint32));\n        memcpy(pixels + i * width, pixels + (limit - 1- i) * width , width * sizeof(uint32));\n        memcpy(pixels + (limit - 1- i) * width , tmp, width * sizeof(uint32));\n    }\n    free (tmp);\n\n    free(buf);\n\n    return pixels;\n}\n\nuint32 *BmpToTiffConverter::getPixelsFrom32Bmp(int offset, int limit)\n{\n    unsigned char *buf;\n    int size;\n    int width = inf->biWidth;\n    int height = inf->biHeight;\n\n    if (offset + limit >= height) {\n        limit = height - offset;\n    }\n\n    //width of bitmap should be multiple 4\n    size = width * 4;\n    size = size * limit;\n\n    buf = (unsigned char *)malloc(size);\n    if (buf == NULL) {\n        LOGE(\"Can\\'t allocate buffer\");\n        return NULL;\n    }\n\n\n    //in bitmap picture stored fliped from up to down.\n    //when need read 0 row - should read height-1 row\n    //seek file to position from the end of file to read\n    lseek(inFd, bmp->bfOffBits + (height - offset - limit) * width * 4, SEEK_SET);\n    int n = read(inFd, buf, size);\n\n    LOGII(\"Read bytes\", n);\n\n    int temp, line, i, j, numImgBytes, ind = 0;\n    uint32 *pixels;\n\n    line = width * 4;//width % 4;\n    numImgBytes = (4 * (width * limit));\n    pixels = (uint32*)malloc(numImgBytes);\n\n    for (i = 0; i < numImgBytes; i++) {\n        unsigned char r, g, b, a = 0b11111111;\n\n        //read colors. alpha always 255lf because 24bpp bitmap hasn't alpha chanel\n        //a = buf[i];\n        i++;\n\n        b = buf[i];\n        i++;\n        g = buf[i];\n        i++;\n        r = buf[i];\n\n        pixels[ind] = (r| g << 8 | b << 16 | a << 24) ;\n        ind++;\n    }\n\n    uint32 *tmp = new uint32[width];\n    for (i = 0; i < limit/2 ;i++) {\n        memcpy(tmp, pixels + i * width, width * sizeof(uint32));\n        memcpy(pixels + i * width, pixels + (limit - 1- i) * width , width * sizeof(uint32));\n        memcpy(pixels + (limit - 1- i) * width , tmp, width * sizeof(uint32));\n    }\n    free (tmp);\n\n    free(buf);\n\n    return pixels;\n}\n\nunsigned char * BmpToTiffConverter::convertArgbToBilevel(uint32 *data, uint32 width, uint32 height)\n{\n    unsigned char red;\n    unsigned char green;\n    unsigned char blue;\n\n    uint32 crPix;\n    uint32 grayPix;\n    int bilevelWidth = (width / 8 + 0.5);\n\n    unsigned char *dest = (unsigned char *) malloc(sizeof(unsigned char) * bilevelWidth * height);\n\n    uint32 maxGrey = 0.2125 * 255 + 0.7154 * 255 + 0.0721 * 255;\n    uint32 halfGrey = maxGrey/2;\n\n    uint32 shift = 0;\n    unsigned char charsum = 0;\n    int k = 7;\n    for (int y = 0; y < height; y++) {\n        shift = 0;\n        charsum = 0;\n        k = 7;\n        for (int i = 0; i < width; i++) {\n            uint32 *px = &data[y * width + i];\n                red = px[0];\n                green = px[1];\n                blue = px[2];\n                grayPix = (0.2125 * red + 0.7154 * green + 0.0721 * blue);\n\n            if (grayPix < halfGrey) charsum &= ~(1 << k);\n            else charsum |= 1 << k;\n\n            if (k == 0) {\n                dest[y * bilevelWidth + shift] = charsum;\n                shift++;\n                k = 7;\n                charsum = 0;\n            } else {\n               k--;\n            }\n         }\n    }\n    return dest;\n}\n\n\n\n"
  },
  {
    "path": "src/main/jni/BmpToTiffConverter.h",
    "content": "//\n// Created by beyka on 9/20/17.\n//\n\n#ifndef TIFFSAMPLE_BMPTOTIFFCONVERTER_H\n#define TIFFSAMPLE_BMPTOTIFFCONVERTER_H\n\n#include <stdlib.h>\n#include <stdio.h>\n#include <tiffio.h>\n#include \"fcntl.h\"\n#include \"unistd.h\"\n#include <jpeglib.h>\n#include <setjmp.h>\n#include \"BaseTiffConverter.h\"\n#include \"BMP.h\"\n\n#ifdef NDEBUG\n    #define LOGI(x)\n    #define LOGII(x, y)\n    #define LOGIF(x, y)\n    #define LOGIS(x, y)\n    #define LOGE(x)\n    #define LOGES(x, y)\n    #define LOGEI(x, y)\n#else\n    #define LOGI(x) __android_log_print(ANDROID_LOG_DEBUG, \"BmpToTiffConverter\", \"%s\", x)\n    #define LOGII(x, y) __android_log_print(ANDROID_LOG_DEBUG, \"BmpToTiffConverter\", \"%s %d\", x, y)\n    #define LOGIF(x, y) __android_log_print(ANDROID_LOG_DEBUG, \"BmpToTiffConverter\", \"%s %f\", x, y)\n    #define LOGIS(x, y) __android_log_print(ANDROID_LOG_DEBUG, \"BmpToTiffConverter\", \"%s %s\", x, y)\n    #define LOGE(x) __android_log_print(ANDROID_LOG_ERROR, \"BmpToTiffConverter\", \"%s\", x)\n    #define LOGES(x, y) __android_log_print(ANDROID_LOG_ERROR, \"BmpToTiffConverter\", \"%s %s\", x, y)\n    #define LOGEI(x, y) __android_log_print(ANDROID_LOG_ERROR, \"BmpToTiffConverter\", \"%s %d\", x, y)\n#endif\n\nclass BmpToTiffConverter : public BaseTiffConverter\n{\n    public:\n        explicit BmpToTiffConverter(JNIEnv *, jclass, jstring, jstring, jobject, jobject);\n        explicit BmpToTiffConverter(JNIEnv *, jclass, jint, jint, jobject, jobject);\n        ~BmpToTiffConverter();\n        virtual jboolean convert();\n\n    private:\n        TIFF *tiffImage;\n        BITMAPFILEHEADER *bmp;\n        BITMAPINFOHEADER *inf;\n\n        void readHeaders();\n\n        uint32 * getPixelsFromBmp(int offset, int limit);\n        uint32 * getPixelsFrom16Bmp(int offset, int limit);\n        uint32 * getPixelsFrom24Bmp(int offset, int limit);\n        uint32 * getPixelsFrom32Bmp(int offset, int limit);\n\n        unsigned char * convertArgbToBilevel(uint32 *, uint32, uint32);\n\n};\n\n#endif //TIFFSAMPLE_BMPTOTIFFCONVERTER_H\n"
  },
  {
    "path": "src/main/jni/JpgToTiffConverter.cpp",
    "content": "//\n// Created by beyka on 5/15/17.\n//\n\n#include \"JpgToTiffConverter.h\"\n\nJpgToTiffConverter::JpgToTiffConverter(JNIEnv *e, jclass clazz, jstring in, jstring out, jobject opts, jobject listener)\n    : BaseTiffConverter(e, clazz, in, out, opts, listener)\n{\n    jpeg_struct_init = 0;\n\n    compressionInt = 5;\n}\n\nJpgToTiffConverter::JpgToTiffConverter(JNIEnv *e, jclass clazz, jint in, jint out, jobject opts, jobject listener)\n    : BaseTiffConverter(e, clazz, in, out, opts, listener)\n{\n    jpeg_struct_init = 0;\n\n    compressionInt = 5;\n}\n\nJpgToTiffConverter::~JpgToTiffConverter()\n{\n    LOGI(\"Destructor\");\n    if (tiffImage) {\n        TIFFClose(tiffImage);\n        tiffImage = NULL;\n    }\n    LOGI(\"Tiff removed\");\n\n    if (jpeg_struct_init) {\n        jpeg_destroy_decompress(&cinfo);\n    }\n    LOGI(\"JPEG destroyed\");\n\n    if (inFile) {\n        fclose(inFile);\n    }\n    LOGI(\"IN file closed\");\n}\n\njboolean JpgToTiffConverter::convert()\n{\n    readOptions();\n\n    if(outFd < 0) {\n        //open tiff file for writing or appending\n        const char *outCPath = NULL;\n        outCPath = env->GetStringUTFChars(outPath, 0);\n        LOGIS(\"OUT path\", outCPath);\n        LOGIS(\"nativeTiffOpenForSave\", outCPath);\n        int mode = O_RDWR | O_CREAT | O_TRUNC | 0;\n        if (appendTiff) {\n            mode = O_RDWR | O_CREAT;\n        }\n        outFd = open(outCPath, mode, 0666);\n        if (outFd < 0) {\n            throw_cant_open_file_exception(env, outPath);\n            env->ReleaseStringUTFChars(outPath, outCPath);\n            return JNI_FALSE;\n        }\n        env->ReleaseStringUTFChars(outPath, outCPath);\n    }\n\n    if (!appendTiff) {\n        if ((tiffImage = TIFFFdOpen(outFd, \"\", \"w\")) == NULL) {\n        LOGE(\"Unable to open tif file\");\n            if (throwException) {\n                throw_cant_open_file_exception_fd(env, outFd);\n            }\n            return JNI_FALSE;\n        }\n    } else {\n        if ((tiffImage = TIFFFdOpen(outFd, \"\", \"a\")) == NULL) {\n            LOGE(\"Unable to open tif file\");\n            if (throwException) {\n                throw_cant_open_file_exception_fd(env, outFd);\n            }\n            return JNI_FALSE;\n        }\n    }\n\n    //open jpg file fow reading\n    if (inFd < 0) {\n        const char *inCPath = NULL;\n        inCPath = env->GetStringUTFChars(inPath, 0);\n        LOGIS(\"IN path\", inCPath);\n        inFile = fopen(inCPath, \"rb\");\n        if (!inFile) {\n            if (throwException) {\n                throw_cant_open_file_exception(env, inPath);\n            }\n            LOGES(\"Can\\'t open out file\", inCPath);\n            env->ReleaseStringUTFChars(inPath, inCPath);\n            return JNI_FALSE;\n        }\n        env->ReleaseStringUTFChars(inPath, inCPath);\n    } else {\n        inFile = fdopen(inFd, \"rb\");\n        if (!inFile) {\n            if (throwException) {\n                throw_cant_open_file_exception_fd(env, inFd);\n            }\n            LOGES(\"Can\\'t open out file descriptor\", inFd);\n            return JNI_FALSE;\n        }\n    }\n\n    //read file header\n    size_t byte_count = 8;\n    unsigned char *header = (unsigned char *)malloc(sizeof(unsigned char) * byte_count);\n    fread(header, 1, byte_count, inFile);\n\n    //Check is file is JPG image\n    bool is_jpg = !strncmp( (const char*)header, \"\\xFF\\xD8\\xFF\", 3 );\n    //seek file to begin\n    rewind(inFile);\n    if (!is_jpg) {\n        LOGE(\"Not jpeg file\");\n        if (throwException) {\n            if (inFd < 0) {\n                throw_cant_open_file_exception(env, inPath);\n            } else {\n                throw_cant_open_file_exception_fd(env, inFd);\n            }\n        }\n        return JNI_FALSE;\n    } else {\n        LOGI(\"IS JPEG\");\n    }\n\n    /* We set up the normal JPEG error routines, then override error_exit. */\n    cinfo.err = jpeg_std_error(&jerr);\n\n    jpeg_create_decompress(&cinfo);\n    jpeg_struct_init = 1;\n    LOGI(\"decompress created\");\n\n    jpeg_stdio_src(&cinfo, inFile);\n    LOGI(\"set file\");\n\n    //read file parameters\n    int readHeader = jpeg_read_header(&cinfo, TRUE);\n    LOGII(\"read jpeg header\", readHeader);\n\n    //start decompress\n    int startDecompress = jpeg_start_decompress(&cinfo);\n    LOGII(\"start decompress\", startDecompress);\n\n    width = cinfo.image_width;\n    height = cinfo.image_height;\n    LOGII(\"width\", width);\n    LOGII(\"height\", height);\n\n    componentsPerPixel = cinfo.output_components;\n\n    //Create tiff structure\n    TIFFSetField(tiffImage, TIFFTAG_IMAGEWIDTH, width);\n    TIFFSetField(tiffImage, TIFFTAG_IMAGELENGTH, height);\n    TIFFSetField(tiffImage, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);\n    TIFFSetField(tiffImage, TIFFTAG_COMPRESSION, compressionInt);\n    TIFFSetField(tiffImage, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);\n    TIFFSetField(tiffImage, TIFFTAG_XRESOLUTION, xRes);\n    TIFFSetField(tiffImage, TIFFTAG_YRESOLUTION, yRes);\n    TIFFSetField(tiffImage, TIFFTAG_RESOLUTIONUNIT, resUnit);\n\n    if (compressionInt == COMPRESSION_CCITTRLE || compressionInt == COMPRESSION_CCITTFAX3 || compressionInt == COMPRESSION_CCITTFAX4) {\n        TIFFSetField(tiffImage, TIFFTAG_BITSPERSAMPLE,\t1);\n        TIFFSetField(tiffImage, TIFFTAG_SAMPLESPERPIXEL,\t1);\n        TIFFSetField(tiffImage, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISBLACK);\n        TIFFSetField(tiffImage, TIFFTAG_FILLORDER, FILLORDER_MSB2LSB);\n    } else {\n        TIFFSetField(tiffImage, TIFFTAG_BITSPERSAMPLE, 8);\n        TIFFSetField(tiffImage, TIFFTAG_SAMPLESPERPIXEL, componentsPerPixel);\n        if (componentsPerPixel == 1) {\n            TIFFSetField(tiffImage, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISBLACK);\n        } else {\n            TIFFSetField(tiffImage, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB);\n        }\n    }\n    //creation date\n    char *date = getCreationDate();\n    TIFFSetField(tiffImage, TIFFTAG_DATETIME, date);\n    free(date);\n    //image description\n    if (cdescription) {\n        TIFFSetField(tiffImage, TIFFTAG_IMAGEDESCRIPTION, cdescription);\n    }\n    //software tag\n    if (csoftware) {\n        TIFFSetField(tiffImage, TIFFTAG_SOFTWARE, csoftware);\n    }\n\n    //progress reporter\n    jlong total = width * height;\n    sendProgress(0, total);\n\n    int rowSize = width * componentsPerPixel;\n    LOGII(\"jpg samples\", componentsPerPixel);\n\n    //Calculate row per strip\n    //maximum size for strip should be less than 2Mb if memory available\n    unsigned long MB2 = (availableMemory == -1 || availableMemory > 3 * 1024 * 1024) ? 2 * 1024 * 1024 : width * 4;\n    int rowPerStrip = MB2/rowSize;\n    //TODO This is workaround. Need to understand why FAX compression schemes have shift in strips.\n    if (compressionInt == COMPRESSION_CCITTRLE || compressionInt == COMPRESSION_CCITTFAX3 || compressionInt == COMPRESSION_CCITTFAX4) {\n        rowPerStrip = 1;\n    }\n\n    if (rowPerStrip >= height) {\n        rowPerStrip = height / 4;\n    }\n    if (rowPerStrip < 1) rowPerStrip = 1;\n    LOGII(\"rowPerStrip\", rowPerStrip);\n\n    unsigned long estimateMem = rowPerStrip * width * 4;\n    estimateMem += sizeof(JSAMPLE) * rowSize;//jpg buffer\n    if (compressionInt == COMPRESSION_JPEG) {\n        estimateMem += 0;\n    } else if (compressionInt == COMPRESSION_CCITTRLE || compressionInt == COMPRESSION_CCITTFAX3 || compressionInt == COMPRESSION_CCITTFAX4) {\n        estimateMem += (width/8 + 0.5) * rowPerStrip;\n    } else {\n        estimateMem += rowPerStrip * rowSize;\n    }\n    LOGII(\"estimateMem\", estimateMem);\n    if (estimateMem > availableMemory && availableMemory != -1) {\n        LOGEI(\"Not enough memory\", availableMemory);\n        if (throwException) {\n            throw_not_enought_memory_exception(env, availableMemory, estimateMem);\n        }\n        return JNI_FALSE;\n    }\n\n    if (checkStop()) {\n        //jpeg_finish_decompress(&cinfo);\n        conversion_result = JNI_FALSE;\n        return conversion_result;\n    }\n\n    //Buffer for read jpeg image line by line\n    int buffer_height = 1;\n    JSAMPARRAY buffer = (JSAMPARRAY)malloc(sizeof(JSAMPROW) * buffer_height);\n    buffer[0] = (JSAMPROW)malloc(sizeof(JSAMPLE) * rowSize);\n\n    //buffer for format strips for tiff\n\n\n    int ret;\n    if (compressionInt == COMPRESSION_JPEG) {\n        int line = 0;\n        while (cinfo.output_scanline < height) {\n            if (checkStop()) {\n                free(buffer[0]);\n                free(buffer);\n                conversion_result = JNI_FALSE;\n                return conversion_result;\n            }\n            if (line % rowPerStrip == 0) {\n                sendProgress(line * width, total);\n            }\n            jpeg_read_scanlines(&cinfo, buffer, 1);\n            ret = TIFFWriteScanline(tiffImage, buffer[0], line, 0);\n            line++;\n        }\n    } else {\n        TIFFSetField(tiffImage, TIFFTAG_ROWSPERSTRIP, rowPerStrip);\n        unsigned char *data = new unsigned char[rowSize * rowPerStrip];\n        int totalRowCounter = 0;\n        int rowCounter = 0;\n        bool shouldWrite = false;\n        while (cinfo.output_scanline < height) {\n            shouldWrite = true;\n            jpeg_read_scanlines(&cinfo, buffer, 1);\n            memcpy(data + rowCounter * rowSize, buffer[0], rowSize);\n            rowCounter++;\n            totalRowCounter++;\n            if (rowCounter == rowPerStrip) {\n                if (checkStop()) {\n                    //jpeg_finish_decompress(&cinfo);\n                    delete[] data;\n                    free(buffer[0]);\n                    free(buffer);\n                    conversion_result = JNI_FALSE;\n                    return conversion_result;\n                }\n                if (compressionInt == COMPRESSION_CCITTRLE || compressionInt == COMPRESSION_CCITTFAX3 || compressionInt == COMPRESSION_CCITTFAX4) {\n                    int compressedWidth = (width/8 + 0.5);\n                    unsigned char *bilevel = convertArgbToBilevel(data, componentsPerPixel, width, rowPerStrip);\n                    ret = TIFFWriteEncodedStrip(tiffImage, totalRowCounter/rowPerStrip - 1, bilevel, compressedWidth * sizeof(unsigned char) * rowPerStrip);\n                    free(bilevel);\n                } else {\n                    ret = TIFFWriteEncodedStrip(tiffImage, totalRowCounter/rowPerStrip - 1, data, rowPerStrip * rowSize);\n                }\n                rowCounter = 0;\n                shouldWrite = false;\n                sendProgress(totalRowCounter * width, total);\n            }\n        }\n        if (shouldWrite) {  LOGI(\"last stage\");\n            if (checkStop()) {\n                //jpeg_finish_decompress(&cinfo);\n                delete[] data;\n                free(buffer[0]);\n                free(buffer);\n                conversion_result = JNI_FALSE;\n                return conversion_result;\n            }\n            if (compressionInt == COMPRESSION_CCITTRLE || compressionInt == COMPRESSION_CCITTFAX3 || compressionInt == COMPRESSION_CCITTFAX4) {\n                int compressedWidth = (width/8 + 0.5);\n                unsigned char *bilevel = convertArgbToBilevel(data, componentsPerPixel, width, rowPerStrip);\n                ret = TIFFWriteEncodedStrip(tiffImage, totalRowCounter/rowPerStrip, bilevel, compressedWidth * sizeof(unsigned char) * rowPerStrip);\n                free(bilevel);\n            } else {\n                ret = TIFFWriteEncodedStrip(tiffImage, totalRowCounter/rowPerStrip, data, rowPerStrip * rowSize);\n            }\n        }\n        delete[] data;\n    }\n\n    ret = TIFFWriteDirectory(tiffImage);\n    LOGII(\"ret = \", ret);\n\n    jpeg_finish_decompress(&cinfo);\n\n\n    free(buffer[0]);\n    free(buffer);\n\n    sendProgress(total, total);\n    conversion_result = JNI_TRUE;\n    return conversion_result;\n}\n\nunsigned char * JpgToTiffConverter::convertArgbToBilevel(unsigned char *data, int components, uint32 width, uint32 height)\n{\n    unsigned char red;\n    unsigned char green;\n    unsigned char blue;\n\n    uint32 crPix;\n    uint32 grayPix;\n    int bilevelWidth = (width / 8 + 0.5);\n\n    unsigned char *dest = (unsigned char *) malloc(sizeof(unsigned char) * bilevelWidth * height);\n\n    uint32 maxGrey = (components > 1) ? (0.2125 * 255 + 0.7154 * 255 + 0.0721 * 255) : 255;\n    uint32 halfGrey = maxGrey/2;\n\n    uint32 shift = 0;\n    unsigned char charsum = 0;\n    int k = 7;\n    for (int y = 0; y < height; y++) {\n        shift = 0;\n        charsum = 0;\n        k = 7;\n        for (int i = 0; i < width * components; i+=components) {\n            unsigned char *px = &data[y * width * components + i];\n            if (components == 1) {\n                grayPix = (*px);\n            } else {\n                red = px[0];\n                green = px[1];\n                blue = px[2];\n                grayPix = (0.2125 * red + 0.7154 * green + 0.0721 * blue);\n            }\n\n            if (grayPix < halfGrey) charsum &= ~(1 << k);\n            else charsum |= 1 << k;\n\n            if (k == 0) {\n                dest[y * bilevelWidth + shift] = charsum;\n                shift++;\n                k = 7;\n                charsum = 0;\n            } else {\n               k--;\n            }\n         }\n    }\n    return dest;\n}\n\n"
  },
  {
    "path": "src/main/jni/JpgToTiffConverter.h",
    "content": "//\n// Created by beyka on 5/15/17.\n//\n\n#ifndef TIFFSAMPLE_JPGTOTIFFCONVERTER_H\n#define TIFFSAMPLE_JPGTOTIFFCONVERTER_H\n\n#include <stdlib.h>\n#include <stdio.h>\n#include <tiffio.h>\n#include \"fcntl.h\"\n#include \"unistd.h\"\n#include <jpeglib.h>\n#include <setjmp.h>\n#include \"BaseTiffConverter.h\"\n\n#ifdef NDEBUG\n    #define LOGI(x)\n    #define LOGII(x, y)\n    #define LOGIF(x, y)\n    #define LOGIS(x, y)\n    #define LOGE(x)\n    #define LOGES(x, y)\n    #define LOGEI(x, y);\n#else\n    #define LOGI(x) __android_log_print(ANDROID_LOG_DEBUG, \"JpgToTiffConverter\", \"%s\", x)\n    #define LOGII(x, y) __android_log_print(ANDROID_LOG_DEBUG, \"JpgToTiffConverter\", \"%s %d\", x, y)\n    #define LOGIF(x, y) __android_log_print(ANDROID_LOG_DEBUG, \"JpgToTiffConverter\", \"%s %f\", x, y)\n    #define LOGIS(x, y) __android_log_print(ANDROID_LOG_DEBUG, \"JpgToTiffConverter\", \"%s %s\", x, y)\n    #define LOGE(x) __android_log_print(ANDROID_LOG_ERROR, \"JpgToTiffConverter\", \"%s\", x)\n    #define LOGES(x, y) __android_log_print(ANDROID_LOG_ERROR, \"JpgToTiffConverter\", \"%s %s\", x, y)\n    #define LOGEI(x, y) __android_log_print(ANDROID_LOG_ERROR, \"JpgToTiffConverter\", \"%s %d\", x, y)\n#endif\n\nclass JpgToTiffConverter : public BaseTiffConverter\n{\n    public:\n        explicit JpgToTiffConverter(JNIEnv *, jclass, jstring, jstring, jobject, jobject);\n        explicit JpgToTiffConverter(JNIEnv *, jclass, jint, jint, jobject, jobject);\n        ~JpgToTiffConverter();\n        virtual jboolean convert();\n\n    private:\n        TIFF *tiffImage;\n        FILE *inFile;\n\n        int componentsPerPixel;\n\n        char jpeg_struct_init;\n        struct jpeg_decompress_struct cinfo;\n        struct jpeg_error_mgr jerr;\n\n        //METHODDEF(void) JpgToTiffConverter::my_error_exit (j_common_ptr)\n        unsigned char * convertArgbToBilevel(unsigned char *, int, uint32, uint32);\n\n};\n\n\n#endif //TIFFSAMPLE_JPGTOTIFFCONVERTER_H\n"
  },
  {
    "path": "src/main/jni/NativeDecoder.cpp",
    "content": "//\n// Created by beyka on 3.2.17.\n//\n\n#include \"NativeDecoder.h\"\n#include <string>\n\njmp_buf NativeDecoder::tile_buf;\njmp_buf NativeDecoder::strip_buf;\njmp_buf NativeDecoder::image_buf;\njmp_buf NativeDecoder::general_buf;\n\n//Constructor for decoding from file descriptor\nNativeDecoder::NativeDecoder(JNIEnv *e, jclass c, jint fd, jobject opts, jobject listener)\n{\n\n    decodingMode = DECODE_MODE_FILE_DESCRIPTOR;\n\n    availableMemory = 8000*8000*4; // use 244Mb restriction for decoding full image\n    env = e;\n    clazz = c;\n    optionsObject = opts;\n    listenerObject = listener;\n    jFd = fd;\n\n    origwidth = 0;\n    origheight = 0;\n    origorientation = 0;\n    origcompressionscheme = 0;\n    progressTotal = 0;\n    invertRedAndBlue = false;\n\n    boundX = boundY = boundWidth = boundHeight = -1;\n    hasBounds = 0;\n\n    preferedConfig = NULL;\n    image = NULL;\n\n    jBitmapOptionsClass = env->FindClass(\n                        \"org/beyka/tiffbitmapfactory/TiffBitmapFactory$Options\");\n    jIProgressListenerClass = env->FindClass(\"org/beyka/tiffbitmapfactory/IProgressListener\");\n    jThreadClass = env->FindClass(\"java/lang/Thread\");\n}\n\n//Constructor for decoding from file path\nNativeDecoder::NativeDecoder(JNIEnv *e, jclass c, jstring path, jobject opts, jobject listener)\n{\n\n    decodingMode = DECODE_MODE_FILE_PATH;\n\n    availableMemory = 8000*8000*4; // use 244Mb restriction for decoding full image\n    env = e;\n    clazz = c;\n    optionsObject = opts;\n    listenerObject = listener;\n    jPath = path;\n\n    origwidth = 0;\n    origheight = 0;\n    origorientation = 0;\n    origcompressionscheme = 0;\n    progressTotal = 0;\n    invertRedAndBlue = false;\n\n    boundX = boundY = boundWidth = boundHeight = -1;\n    hasBounds = 0;\n\n    preferedConfig = NULL;\n    image = NULL;\n\n    jBitmapOptionsClass = env->FindClass(\n                        \"org/beyka/tiffbitmapfactory/TiffBitmapFactory$Options\");\n    jIProgressListenerClass = env->FindClass(\"org/beyka/tiffbitmapfactory/IProgressListener\");\n    jThreadClass = env->FindClass(\"java/lang/Thread\");\n}\n\nNativeDecoder::~NativeDecoder()\n{\n    LOGI(\"Destructor\");\n    if (image) {\n        TIFFClose(image);\n        image = NULL;\n    }\n\n    //Release global reference for Bitmap.Config\n    if (preferedConfig) {\n        env->DeleteGlobalRef(preferedConfig);\n        preferedConfig = NULL;\n    }\n\n    if (jBitmapOptionsClass) {\n        env->DeleteLocalRef(jBitmapOptionsClass);\n        jBitmapOptionsClass = NULL;\n    }\n\n    if (jIProgressListenerClass) {\n        env->DeleteLocalRef(jIProgressListenerClass);\n        jIProgressListenerClass = NULL;\n    }\n\n    if (jThreadClass) {\n            env->DeleteLocalRef(jThreadClass);\n            jThreadClass = NULL;\n        }\n}\n\njobject NativeDecoder::getBitmap()\n{\n        //init signal handler for catch SIGSEGV error that could be raised in libtiff\n        struct sigaction act;\n        memset(&act, 0, sizeof(act));\n        sigemptyset(&act.sa_mask);\n        act.sa_sigaction = generalErrorHandler;\n        act.sa_flags = SA_SIGINFO | SA_ONSTACK;\n        if(sigaction(SIGSEGV, &act, 0) < 0) {\n            LOGE(\"Can\\'t setup signal handler. Working without errors catching mechanism\");\n        }\n\n        //check for error\n        if (setjmp(NativeDecoder::general_buf)) {\n             const char * err = \"Caught SIGSEGV signal(Segmentation fault or invalid memory reference)\";\n             LOGE(err);\n             if (throwException) {\n                 throwDecodeFileException(err);\n             }\n            return NULL;\n        }\n\n        //Get options from TiffBitmapFactory$Options\n        jfieldID gOptions_ThrowExceptionFieldID = env->GetFieldID(jBitmapOptionsClass,\n                                                                          \"inThrowException\",\n                                                                          \"Z\");\n        throwException = env->GetBooleanField(optionsObject, gOptions_ThrowExceptionFieldID);\n\n        jfieldID gOptions_UseOrientationTagFieldID = env->GetFieldID(jBitmapOptionsClass,\n                                                                                  \"inUseOrientationTag\",\n                                                                                  \"Z\");\n        useOrientationTag = env->GetBooleanField(optionsObject, gOptions_UseOrientationTagFieldID);\n\n        jfieldID gOptions_sampleSizeFieldID = env->GetFieldID(jBitmapOptionsClass, \"inSampleSize\", \"I\");\n        jint inSampleSize = env->GetIntField(optionsObject, gOptions_sampleSizeFieldID);\n        if (inSampleSize != 1 && inSampleSize % 2 != 0) {\n            const char *message = \"inSampleSize should be power of 2\\0\";\n            LOGE(message);\n            if (throwException) {\n                throwDecodeFileException(message);\n            }\n            return NULL;\n        }\n\n        jfieldID gOptions_justDecodeBoundsFieldID = env->GetFieldID(jBitmapOptionsClass,\n                                                                    \"inJustDecodeBounds\", \"Z\");\n        jboolean inJustDecodeBounds = env->GetBooleanField(optionsObject, gOptions_justDecodeBoundsFieldID);\n\n        jfieldID gOptions_invertRedAndBlueFieldID = env->GetFieldID(jBitmapOptionsClass,\n                                                                    \"inSwapRedBlueColors\", \"Z\");\n        invertRedAndBlue = env->GetBooleanField(optionsObject, gOptions_invertRedAndBlueFieldID);\n\n        jfieldID gOptions_DirectoryCountFieldID = env->GetFieldID(jBitmapOptionsClass,\n                                                                  \"inDirectoryNumber\",\n                                                                  \"I\");\n        jint inDirectoryNumber = env->GetIntField(optionsObject, gOptions_DirectoryCountFieldID);\n        LOGII(\"param directoryCount\", inDirectoryNumber);\n\n        jfieldID gOptions_AvailableMemoryFieldID = env->GetFieldID(jBitmapOptionsClass,\n                                                                  \"inAvailableMemory\",\n                                                                  \"J\");\n        unsigned long inAvailableMemory = env->GetLongField(optionsObject, gOptions_AvailableMemoryFieldID);\n\n        jfieldID gOptions_PreferedConfigFieldID = env->GetFieldID(jBitmapOptionsClass,\n                                                                  \"inPreferredConfig\",\n                                                                  \"Lorg/beyka/tiffbitmapfactory/TiffBitmapFactory$ImageConfig;\");\n        jobject config = env->GetObjectField(optionsObject, gOptions_PreferedConfigFieldID);\n\n        if (inAvailableMemory > 0) {\n            availableMemory = inAvailableMemory;\n        }\n\n        if (config == NULL) {\n            LOGI(\"config is NULL, creating default options\");\n            jclass bitmapConfig = env->FindClass(\n                    \"org/beyka/tiffbitmapfactory/TiffBitmapFactory$ImageConfig\");\n            jfieldID argb8888FieldID = env->GetStaticFieldID(bitmapConfig, \"ARGB_8888\",\n                                                             \"Lorg/beyka/tiffbitmapfactory/TiffBitmapFactory$ImageConfig;\");\n            config = env->GetStaticObjectField(bitmapConfig, argb8888FieldID);\n            env->DeleteLocalRef(bitmapConfig);\n        }\n        preferedConfig = env->NewGlobalRef(config);\n        env->DeleteLocalRef(config);\n\n        jfieldID gOptions_DecodeAreaFieldId = env->GetFieldID(jBitmapOptionsClass, \"inDecodeArea\",\n                                                                \"Lorg/beyka/tiffbitmapfactory/DecodeArea;\");\n        jobject decodeArea = env->GetObjectField(optionsObject, gOptions_DecodeAreaFieldId);\n\n        //if directory number < 0 set it to 0\n        if (inDirectoryNumber < 0) inDirectoryNumber = 0;\n\n        //Open tiff file\n        LOGIS(\"nativeTiffOpen\", strPath);\n        const char *strPath = NULL;\n        if (decodingMode == DECODE_MODE_FILE_DESCRIPTOR) {\n            image = TIFFFdOpen(jFd, \"\", \"r\");\n        } else if (decodingMode == DECODE_MODE_FILE_PATH) {\n            strPath = env->GetStringUTFChars(jPath, 0);\n            image = TIFFOpen(strPath, \"r\");\n        }\n\n        if (image == NULL) {\n            if (throwException) {\n                throwCantOpenFileException();\n            }\n\n            if (decodingMode == DECODE_MODE_FILE_PATH) {\n                LOGES(\"Can\\'t open bitmap\", strPath);\n                env->ReleaseStringUTFChars(jPath, strPath);\n            } else {\n                LOGEI(\"Can\\'t open file descriptor\", jFd);\n            }\n            return NULL;\n        } else {\n            if (decodingMode == DECODE_MODE_FILE_PATH) {\n                env->ReleaseStringUTFChars(jPath, strPath);\n            }\n        }\n        LOGI(\"Tiff is open\");\n\n        TIFFSetDirectory(image, inDirectoryNumber);\n        TIFFGetField(image, TIFFTAG_IMAGEWIDTH, &origwidth);\n        TIFFGetField(image, TIFFTAG_IMAGELENGTH, &origheight);\n\n        //Read decode bounds if exists\n        if (decodeArea) {\n            LOGI(\"Decode bounds present\");\n            jclass decodeAreaClass = env->FindClass(\"org/beyka/tiffbitmapfactory/DecodeArea\");\n            jfieldID xFieldID = env->GetFieldID(decodeAreaClass, \"x\", \"I\");\n            jfieldID yFieldID = env->GetFieldID(decodeAreaClass, \"y\", \"I\");\n            jfieldID widthFieldID = env->GetFieldID(decodeAreaClass, \"width\", \"I\");\n            jfieldID heightFieldID = env->GetFieldID(decodeAreaClass, \"height\", \"I\");\n\n            boundX = env->GetIntField(decodeArea, xFieldID);\n            boundY = env->GetIntField(decodeArea, yFieldID);\n            boundWidth = env->GetIntField(decodeArea, widthFieldID);\n            boundHeight = env->GetIntField(decodeArea, heightFieldID);\n            if (boundX >= origwidth-1) {\n                const char *message = \"X of left top corner of decode area should be less than image width\";\n                LOGE(*message);\n                if (throwException) {\n                    throwDecodeFileException(message);\n                }\n                env->DeleteLocalRef(decodeAreaClass);\n                return NULL;\n            }\n            if (boundY >= origheight-1) {\n                const char *message = \"Y of left top corner of decode area should be less than image height\";\n                LOGE(*message);\n                if (throwException) {\n                    throwDecodeFileException(message);\n                }\n                env->DeleteLocalRef(decodeAreaClass);\n                return NULL;\n            }\n\n            if (boundX < 0) boundX = 0;\n            if (boundY < 0) boundY = 0;\n            if (boundX + boundWidth >= origwidth) boundWidth = origwidth - boundX -1;\n            if (boundY + boundHeight >= origheight) boundHeight = origheight - boundY -1;\n\n            if (boundWidth < 1) {\n                const char *message = \"Width of decode area can\\'t be less than 1\";\n                LOGE(*message);\n                if (throwException) {\n                    throwDecodeFileException(message);\n                }\n                env->DeleteLocalRef(decodeAreaClass);\n                return NULL;\n            }\n            if (boundHeight < 1) {\n                const char *message = \"Height of decode area can\\'t be less than 1\";\n                LOGE(*message);\n                if (throwException) {\n                    throwDecodeFileException(message);\n                }\n                env->DeleteLocalRef(decodeAreaClass);\n                return NULL;\n            }\n\n            LOGII(\"Decode X\", boundX);\n            LOGII(\"Decode Y\", boundY);\n            LOGII(\"Decode width\", boundWidth);\n            LOGII(\"Decode height\", boundHeight);\n\n            hasBounds = 1;\n            env->DeleteLocalRef(decodeAreaClass);\n            env->DeleteLocalRef(decodeArea);\n        }\n\n        jobject java_bitmap = NULL;\n\n        writeDataToOptions(inDirectoryNumber);\n\n        if (!inJustDecodeBounds) {\n            progressTotal = origwidth * origheight;\n            sendProgress(0, progressTotal);\n            java_bitmap = createBitmap(inSampleSize, inDirectoryNumber);\n        }\n\n        return java_bitmap;\n}\n\njobject NativeDecoder::createBitmap(int inSampleSize, int directoryNumber)\n{\n//Read Config from options. Use ordinal field from ImageConfig class\n    jint configInt = ARGB_8888;\n    if(preferedConfig) {\n        jclass configClass = env->FindClass(\n            \"org/beyka/tiffbitmapfactory/TiffBitmapFactory$ImageConfig\");\n        jfieldID ordinalFieldID = env->GetFieldID(configClass, \"ordinal\", \"I\");\n        configInt = env->GetIntField(preferedConfig, ordinalFieldID);\n        env->DeleteLocalRef(configClass);\n    }\n\n    int bitdepth = 1;\n    TIFFGetField(image, TIFFTAG_BITSPERSAMPLE, &bitdepth);\n    if (bitdepth != 1 && bitdepth != 4 && bitdepth != 8 && bitdepth != 16) {\n        const char * err = \"Only 1, 4, 8 and 16 bits per sample are supported\";\n        LOGE(err);\n        if (throwException) {\n            throwDecodeFileException(err);\n        }\n        return NULL;\n    }\n\n    int newBitmapWidth = 0;\n    int newBitmapHeight = 0;\n\n    jint *raster = NULL;\n\n    if (!hasBounds) {\n        switch(getDecodeMethod()) {\n            case DECODE_METHOD_IMAGE:\n                raster = getSampledRasterFromImage(inSampleSize, &newBitmapWidth, &newBitmapHeight);\n                break;\n            case DECODE_METHOD_TILE:\n                raster = getSampledRasterFromTile(inSampleSize, &newBitmapWidth, &newBitmapHeight);\n                break;\n            case DECODE_METHOD_STRIP:\n                raster = getSampledRasterFromStrip(inSampleSize,  &newBitmapWidth, &newBitmapHeight);\n                break;\n        }\n    } else {\n        switch(getDecodeMethod()) {\n            case DECODE_METHOD_IMAGE:\n                raster = getSampledRasterFromImageWithBounds(inSampleSize, &newBitmapWidth, &newBitmapHeight);\n                break;\n            case DECODE_METHOD_TILE:\n                raster = getSampledRasterFromTileWithBounds(inSampleSize, &newBitmapWidth, &newBitmapHeight);\n                break;\n            case DECODE_METHOD_STRIP:\n                raster = getSampledRasterFromStripWithBounds(inSampleSize,  &newBitmapWidth, &newBitmapHeight);\n                break;\n        }\n\n    }\n\n    if (raster == NULL) {\n        return NULL;\n    }\n\n    // Convert ABGR to ARGB\n    if (invertRedAndBlue) {\n        int i = 0;\n        int j = 0;\n        int tmp = 0;\n        for (i = 0; i < newBitmapHeight; i++) {\n            for (j = 0; j < newBitmapWidth; j++) {\n                tmp = raster[j + newBitmapWidth * i];\n                raster[j + newBitmapWidth * i] =\n                        (tmp & 0xff000000) | ((tmp & 0x00ff0000) >> 16) | (tmp & 0x0000ff00) |\n                        ((tmp & 0xff) << 16);\n            }\n        }\n    }\n\n    sendProgress(progressTotal, progressTotal);\n\n    if(checkStop()) {\n        if (raster) {\n            free(raster);\n        }\n        LOGI(\"Thread stopped\");\n        return NULL;\n    }\n\n    //Class and field for Bitmap.Config\n    jclass bitmapConfigClass = env->FindClass(\"android/graphics/Bitmap$Config\");\n    jfieldID bitmapConfigField = NULL;\n    void *processedBuffer = NULL;\n    if (configInt == ARGB_8888) {\n        processedBuffer = raster;\n        bitmapConfigField = env->GetStaticFieldID(bitmapConfigClass, \"ARGB_8888\",\n                                                  \"Landroid/graphics/Bitmap$Config;\");\n    } else if (configInt == ALPHA_8) {\n        processedBuffer = createBitmapAlpha8(raster, newBitmapWidth,\n                                             newBitmapHeight);\n        bitmapConfigField = env->GetStaticFieldID(bitmapConfigClass, \"ALPHA_8\",\n                                                  \"Landroid/graphics/Bitmap$Config;\");\n    } else if (configInt == RGB_565) {\n        processedBuffer = createBitmapRGB565(raster, newBitmapWidth,\n                                             newBitmapHeight);\n        bitmapConfigField = env->GetStaticFieldID(bitmapConfigClass, \"RGB_565\",\n                                                  \"Landroid/graphics/Bitmap$Config;\");\n    }\n\n    if (processedBuffer == NULL) {\n        LOGE(\"Error while decoding image\");\n        return NULL;\n    }\n\n    //Create mutable bitmap\n    jclass bitmapClass = env->FindClass(\"android/graphics/Bitmap\");\n    jmethodID methodid = env->GetStaticMethodID(bitmapClass, \"createBitmap\",\n                                                \"(IILandroid/graphics/Bitmap$Config;)Landroid/graphics/Bitmap;\");\n\n    //BitmapConfig\n    jobject config = env->GetStaticObjectField(bitmapConfigClass, bitmapConfigField);\n\n    env->DeleteLocalRef(bitmapConfigClass);\n\n    jobject java_bitmap = NULL;\n\n    if(checkStop()) {\n        env->DeleteLocalRef(config);\n        env->DeleteLocalRef(bitmapClass);\n        if (processedBuffer) {\n            free(processedBuffer);\n        }\n        LOGI(\"Thread stopped\");\n        return NULL;\n    }\n\n    if (!useOrientationTag) {\n        java_bitmap = env->CallStaticObjectMethod(bitmapClass, methodid, newBitmapWidth,\n                                                      newBitmapHeight, config);\n    } else if (origorientation > 4) {\n        java_bitmap = env->CallStaticObjectMethod(bitmapClass, methodid, newBitmapHeight,\n                                                  newBitmapWidth, config);\n    } else {\n        java_bitmap = env->CallStaticObjectMethod(bitmapClass, methodid, newBitmapWidth,\n                                                  newBitmapHeight, config);\n    }\n\n    //remove not used references\n    env->DeleteLocalRef(config);\n    env->DeleteLocalRef(bitmapClass);\n\n    //Copy data to bitmap\n    int ret;\n    void *bitmapPixels;\n    if ((ret = AndroidBitmap_lockPixels(env, java_bitmap, &bitmapPixels)) < 0) {\n        //error\n        LOGE(\"Lock pixels failed\");\n        return NULL;\n    }\n    int pixelsCount = newBitmapWidth * newBitmapHeight;\n\n    if (configInt == ARGB_8888) {\n        memcpy(bitmapPixels, (jint *) processedBuffer, sizeof(jint) * pixelsCount);\n    } else if (configInt == ALPHA_8) {\n        memcpy(bitmapPixels, (jbyte *) processedBuffer, sizeof(jbyte) * pixelsCount);\n    } else if (configInt == RGB_565) {\n        memcpy(bitmapPixels, (unsigned short *) processedBuffer,\n               sizeof(unsigned short) * pixelsCount);\n    }\n\n    AndroidBitmap_unlockPixels(env, java_bitmap);\n\n    //remove array\n    free(processedBuffer);\n\n    return java_bitmap;\n}\n\njint * NativeDecoder::getSampledRasterFromStrip(int inSampleSize, int *bitmapwidth, int *bitmapheight) {\n\n    //init signal handler for catch SIGSEGV error that could be raised in libtiff\n    struct sigaction act;\n    memset(&act, 0, sizeof(act));\n    sigemptyset(&act.sa_mask);\n    act.sa_sigaction = stripErrorHandler;\n    act.sa_flags = SA_SIGINFO | SA_ONSTACK;\n    if(sigaction(SIGSEGV, &act, 0) < 0) {\n        LOGE(\"Can\\'t setup signal handler. Working without errors catching mechanism\");\n    }\n\n    LOGII(\"width\", origwidth);\n    LOGII(\"height\", origheight);\n\n    jint *pixels = NULL;\n    *bitmapwidth = origwidth / inSampleSize;\n    *bitmapheight = origheight / inSampleSize;\n    uint32 pixelsBufferSize = *bitmapwidth * *bitmapheight;\n    int origImageBufferSize = origwidth * origheight;\n\n    LOGII(\"new width\", *bitmapwidth);\n    LOGII(\"new height\", *bitmapheight);\n\n    uint32 stripSize = TIFFStripSize (image);\n    uint32 stripMax = TIFFNumberOfStrips (image);\n    LOGII(\"strip size \", stripSize);\n    LOGII(\"stripMax  \", stripMax);\n    int rowPerStrip = -1;\n    TIFFGetField(image, TIFFTAG_ROWSPERSTRIP, &rowPerStrip);\n    LOGII(\"rowsperstrip\", rowPerStrip);\n\n    unsigned long estimateMem = 0;\n    estimateMem += (sizeof(jint) * pixelsBufferSize); //buffer for decoded pixels\n    estimateMem += (origwidth * sizeof(uint32)); //work line for rotate strip\n    estimateMem += (origwidth * rowPerStrip * sizeof (uint32) * 2); //current and next strips\n    estimateMem += (sizeof(jint) * origwidth * 2); //bottom and top lines for reading pixel(matrixBottomLine, matrixTopLine)\n    LOGII(\"estimateMem\", estimateMem);\n    if (estimateMem > availableMemory) {\n        if (throwException) {\n            throw_not_enought_memory_exception(env, availableMemory, estimateMem);\n        }\n        return NULL;\n    }\n\n    pixels = (jint *) malloc(sizeof(jint) * pixelsBufferSize);\n    if (pixels == NULL) {\n        LOGE(\"Can\\'t allocate memory for temp buffer\");\n        return NULL;\n    }\n\n    uint32* work_line_buf = (uint32 *)_TIFFmalloc(origwidth * sizeof(uint32));\n\n    uint32* raster;\n    uint32* rasterForBottomLine; // in this raster copy next strip for getting bottom line in matrix color selection\n    if (rowPerStrip == -1 && stripMax == 1) {\n            raster = (uint32 *)_TIFFmalloc(origImageBufferSize * sizeof (uint32));\n            rasterForBottomLine = (uint32 *)_TIFFmalloc(origImageBufferSize * sizeof (uint32));\n    } else {\n            raster = (uint32 *)_TIFFmalloc(origwidth * rowPerStrip * sizeof (uint32));\n            rasterForBottomLine = (uint32 *)_TIFFmalloc(origwidth * rowPerStrip * sizeof (uint32));\n    }\n    if (rowPerStrip == -1) {\n            rowPerStrip = origheight;\n    }\n\n    int writedLines = 0;\n    int nextStripOffset = 0;\n    int globalLineCounter = 0;\n\n    unsigned int *matrixTopLine = (uint32 *) malloc(sizeof(jint) * origwidth);\n    unsigned int *matrixBottomLine = (uint32 *) malloc(sizeof(jint) * origwidth);\n\n    int isSecondRasterExist = 0;\n    int ok = 1;\n    uint32 rows_to_write = 0;\n\n    //check for error\n    if (setjmp(NativeDecoder::strip_buf)) {\n        if (raster) {\n            _TIFFfree(raster);\n            raster = NULL;\n        }\n        if (rasterForBottomLine) {\n            _TIFFfree(rasterForBottomLine);\n            rasterForBottomLine = NULL;\n        }\n        if (matrixTopLine) {\n            _TIFFfree(matrixTopLine);\n            matrixTopLine = NULL;\n        }\n        if (matrixBottomLine) {\n            _TIFFfree(matrixBottomLine);\n            matrixBottomLine = NULL;\n        }\n\n        const char * err = \"Caught SIGSEGV signal(Segmentation fault or invalid memory reference)\";\n        LOGE(err);\n        if (throwException) {\n            throwDecodeFileException(err);\n        }\n\n        return NULL;\n    }\n\n    for (int i = 0; i < stripMax*rowPerStrip; i += rowPerStrip) {\n\n            sendProgress(i * origwidth, progressTotal);\n\n            //if second raster is exist - copy it to work raster end decode next strip\n            if (isSecondRasterExist) {\n                _TIFFmemcpy(raster, rasterForBottomLine, origwidth * rowPerStrip * sizeof (uint32));\n\n                //If next strip is exist - decode it, invert lines\n                if (i + rowPerStrip < stripMax*rowPerStrip) {\n                    TIFFReadRGBAStrip(image, i+rowPerStrip, rasterForBottomLine);\n                    isSecondRasterExist = 1;\n\n                    rows_to_write = 0;\n                    if ( i + rowPerStrip * 2 > origheight )\n                        rows_to_write = origheight - i - rowPerStrip;\n                    else\n                        rows_to_write = rowPerStrip;\n\n                    if (origorientation <= 4) {\n                        for (int line = 0; line < rows_to_write / 2; line++) {\n                            unsigned int  *top_line, *bottom_line;\n\n                            top_line = rasterForBottomLine + origwidth * line;\n                            bottom_line = rasterForBottomLine + origwidth * (rows_to_write - line - 1);\n\n                            _TIFFmemcpy(work_line_buf, top_line, sizeof(unsigned int) * origwidth);\n                            _TIFFmemcpy(top_line, bottom_line, sizeof(unsigned int) * origwidth);\n                            _TIFFmemcpy(bottom_line, work_line_buf, sizeof(unsigned int) * origwidth);\n                        }\n                    }\n                } else {\n                    isSecondRasterExist = 0;\n                }\n            } else {\n                //if second raster is not exist - first processing - read first and second raster\n                 TIFFReadRGBAStrip(image, i, raster);\n                 //invert lines, because libtiff origin is bottom left instead of top left\n                 rows_to_write = 0;\n                 if( i + rowPerStrip > origheight )\n                    rows_to_write = origheight - i;\n                 else\n                    rows_to_write = rowPerStrip;\n\n                 if (origorientation <= 4) {\n                     for (int line = 0; line < rows_to_write / 2; line++) {\n                         unsigned int  *top_line, *bottom_line;\n\n                         top_line = raster + origwidth * line;\n                         bottom_line = raster + origwidth * (rows_to_write - line - 1);\n\n                         _TIFFmemcpy(work_line_buf, top_line, sizeof(unsigned int) * origwidth);\n                         _TIFFmemcpy(top_line, bottom_line, sizeof(unsigned int) * origwidth);\n                         _TIFFmemcpy(bottom_line, work_line_buf, sizeof(unsigned int) * origwidth);\n                     }\n                 }\n\n                 //if next strip is exist - read it and invert lines\n                 if (i + rowPerStrip < origheight) {\n                    TIFFReadRGBAStrip(image, i+rowPerStrip, rasterForBottomLine);\n                    isSecondRasterExist = 1;\n\n                    //invert lines, because libtiff origin is bottom left instead of top left\n                    rows_to_write = 0;\n                    if ( i + rowPerStrip * 2 > origheight )\n                        rows_to_write = origheight - i - rowPerStrip;\n                    else\n                        rows_to_write = rowPerStrip;\n                    if (origorientation <= 4) {\n                        for (int line = 0; line < rows_to_write / 2; line++) {\n                            unsigned int  *top_line, *bottom_line;\n\n                            top_line = rasterForBottomLine + origwidth * line;\n                            bottom_line = rasterForBottomLine + origwidth * (rows_to_write - line - 1);\n\n                            _TIFFmemcpy(work_line_buf, top_line, sizeof(unsigned int) * origwidth);\n                            _TIFFmemcpy(top_line, bottom_line, sizeof(unsigned int) * origwidth);\n                            _TIFFmemcpy(bottom_line, work_line_buf, sizeof(unsigned int) * origwidth);\n                        }\n                    }\n                 }\n\n            }\n\n            if (inSampleSize == 1) {\n                int byteToCopy = 0;\n                if (i + rowPerStrip < origheight) {\n                    byteToCopy = sizeof(unsigned int) * rowPerStrip * origwidth;\n                } else {\n                    byteToCopy = sizeof(unsigned int) * rows_to_write * origwidth;\n                }\n                int position = i * origwidth;\n                memcpy(&pixels[position], raster, byteToCopy);\n                //sendProgress(position, progressTotal);\n            } else {\n                if (isSecondRasterExist) {\n                    _TIFFmemcpy(matrixBottomLine, rasterForBottomLine /*+ lineAddrToCopyBottomLine * origwidth*/, sizeof(unsigned int) * origwidth);\n                }\n                 int workWritedLines = writedLines;\n                 for (int resBmpY = workWritedLines, workY = 0; resBmpY < *bitmapheight && workY < rowPerStrip; /*wj++,*/ workY ++/*= inSampleSize*/) {\n\n                 if (checkStop()) {\n                     if (raster) {\n                         _TIFFfree(raster);\n                         raster = NULL;\n                     }\n                     if (rasterForBottomLine) {\n                         _TIFFfree(rasterForBottomLine);\n                         rasterForBottomLine = NULL;\n                     }\n                     if (matrixTopLine) {\n                         _TIFFfree(matrixTopLine);\n                         matrixTopLine = NULL;\n                     }\n                     if (matrixBottomLine) {\n                         _TIFFfree(matrixBottomLine);\n                         matrixBottomLine = NULL;\n                     }\n                     LOGI(\"Thread stopped\");\n                     return NULL;\n                 }\n\n                    // if total line of source image is equal to inSampleSize*N then process this line\n                    if (globalLineCounter % inSampleSize == 0) {\n                        for (int resBmpX = 0, workX = 0; resBmpX < *bitmapwidth; resBmpX++, workX += inSampleSize) {\n\n                            //Apply filter to pixel\n                            jint crPix = raster[workY * origwidth + workX];\n                            int sum = 1;\n\n\n                            int alpha = colorMask & crPix >> 24;\n                            int red = colorMask & crPix >> 16;\n                            int green = colorMask & crPix >> 8;\n                            int blue = colorMask & crPix;\n\n\n                            //topleft\n                            if (workX - 1 >= 0 && workY - 1 >= 0) {\n                                crPix = raster[(workY - 1) * origwidth + workX - 1];\n                                red += colorMask & crPix >> 16;\n                                green += colorMask & crPix >> 8;\n                                blue += colorMask & crPix;\n                                alpha += colorMask & crPix >> 24;\n                                sum++;\n                            } else if (workX - 1 >= 0 && workY - 1 == -1 && globalLineCounter > 0) {\n                                crPix = matrixTopLine[workX - 1];\n                                red += colorMask & crPix >> 16;\n                                green += colorMask & crPix >> 8;\n                                blue += colorMask & crPix;\n                                alpha += colorMask & crPix >> 24;\n                                sum++;\n                            }\n                            //top\n                            if (workY - 1 >= 0) {\n                                crPix = raster[(workY - 1) * origwidth + workX];\n                                red += colorMask & crPix >> 16;\n                                green += colorMask & crPix >> 8;\n                                blue += colorMask & crPix;\n                                alpha += colorMask & crPix >> 24;\n                                sum++;\n                            } else if (workY - 1 == -1 && globalLineCounter > 0) {\n                                crPix = matrixTopLine[workX];\n                                red += colorMask & crPix >> 16;\n                                green += colorMask & crPix >> 8;\n                                blue += colorMask & crPix;\n                                alpha += colorMask & crPix >> 24;\n                                sum++;\n                            }\n\n                            // topright\n                            if (workX + 1 < origwidth && workY - 1 >= 0) {\n                                crPix = raster[(workY - 1) * origwidth + workX + 1];\n                                red += colorMask & crPix >> 16;\n                                green += colorMask & crPix >> 8;\n                                blue += colorMask & crPix;\n                                alpha += colorMask & crPix >> 24;\n                                sum++;\n                            } else if (workX + 1 < origwidth && workY - 1 == -1 && globalLineCounter > 0) {\n                                crPix = matrixTopLine[workX + 1];\n                                red += colorMask & crPix >> 16;\n                                green += colorMask & crPix >> 8;\n                                blue += colorMask & crPix;\n                                alpha += colorMask & crPix >> 24;\n                                sum++;\n                            }\n\n                            //right\n                            if (workX + 1 < origwidth) {\n                                crPix = raster[workY * origwidth + workX + 1];\n                                red += colorMask & crPix >> 16;\n                                green += colorMask & crPix >> 8;\n                                blue += colorMask & crPix;\n                                alpha += colorMask & crPix >> 24;\n                                sum++;\n                            }\n\n                            //bottomright\n                            if (workX + 1 < origwidth && workY + 1 < rowPerStrip) {\n                                crPix = raster[(workY + 1) * origwidth + workX + 1];\n                                red += colorMask & crPix >> 16;\n                                green += colorMask & crPix >> 8;\n                                blue += colorMask & crPix;\n                                alpha += colorMask & crPix >> 24;\n                                sum++;\n                            } else if (workX + 1 < origwidth && workY + 1 == rowPerStrip && isSecondRasterExist) {\n                                crPix = matrixBottomLine[workX + 1];\n                                red += colorMask & crPix >> 16;\n                                green += colorMask & crPix >> 8;\n                                blue += colorMask & crPix;\n                                alpha += colorMask & crPix >> 24;\n                                sum++;\n                            }\n\n                            //bottom\n                            if (workY + 1 < rowPerStrip) {\n                                crPix = raster[(workY + 1) * origwidth + workX + 1];\n                                red += colorMask & crPix >> 16;\n                                green += colorMask & crPix >> 8;\n                                blue += colorMask & crPix;\n                                alpha += colorMask & crPix >> 24;\n                                sum++;\n                            } else if (workY + 1 == rowPerStrip && isSecondRasterExist) {\n                                crPix = matrixBottomLine[workX + 1];\n                                red += colorMask & crPix >> 16;\n                                green += colorMask & crPix >> 8;\n                                blue += colorMask & crPix;\n                                alpha += colorMask & crPix >> 24;\n                                sum++;\n                            }\n\n                            //bottomleft\n                            if (workX - 1 >= 0 && workY + 1 < rowPerStrip) {\n                                crPix = raster[(workY + 1) * origwidth + workX - 1];\n                                red += colorMask & crPix >> 16;\n                                green += colorMask & crPix >> 8;\n                                blue += colorMask & crPix;\n                                alpha += colorMask & crPix >> 24;\n                                sum++;\n                            } else if (workX - 1 >= 0 && workY + 1 == rowPerStrip  && isSecondRasterExist) {\n                                crPix = matrixBottomLine[workX - 1];\n                                red += colorMask & crPix >> 16;\n                                green += colorMask & crPix >> 8;\n                                blue += colorMask & crPix;\n                                alpha += colorMask & crPix >> 24;\n                                sum++;\n                            }\n\n\n                            //left\n                            if (workX - 1 >= 0) {\n                                crPix = raster[workY * origwidth + workX - 1];\n                                red += colorMask & crPix >> 16;\n                                green += colorMask & crPix >> 8;\n                                blue += colorMask & crPix;\n                                alpha += colorMask & crPix >> 24;\n                                sum++;\n                            }\n\n                            red /= sum;\n                            if (red > 255) red = 255;\n                            if (red < 0) red = 0;\n\n                            green /= sum;\n                            if (green > 255) green = 255;\n                            if (green < 0) green = 0;\n\n                            blue /= sum;\n                            if (blue > 255) blue = 255;\n                            if (blue < 0) blue = 0;\n\n                            alpha /= sum;///= sum;\n                            if (alpha > 255) alpha = 255;\n                            if (alpha < 0) alpha = 0;\n\n                            crPix = (alpha << 24) | (red << 16) | (green << 8) | (blue);\n\n                            pixels[resBmpY * *bitmapwidth + resBmpX] = crPix;\n                        }\n                        //if line was processed - increment counter of lines that was writed to result image\n                        writedLines++;\n                        //and incremetncounter of current Y for writing\n                        resBmpY++;\n                    }\n                    if (workY == rowPerStrip - 1 && i + rowPerStrip < origheight) {\n                        _TIFFmemcpy(matrixTopLine, raster + workY * origwidth, sizeof(unsigned int) * origwidth);\n                    }\n                    //incremetn global source image line counter\n                    globalLineCounter++;\n\n                }\n            }\n        }\n        LOGI(\"Decoding finished. Free memmory\");\n\n        //Close Buffers\n        if (raster) {\n            _TIFFfree(raster);\n            raster = NULL;\n        }\n\n        if (rasterForBottomLine) {\n            _TIFFfree(rasterForBottomLine);\n            rasterForBottomLine = NULL;\n        }\n\n        if (matrixTopLine) {\n            _TIFFfree(matrixTopLine);\n            matrixTopLine = NULL;\n        }\n\n        if (matrixBottomLine) {\n            _TIFFfree(matrixBottomLine);\n            matrixBottomLine = NULL;\n        }\n\n        if (useOrientationTag) {\n            uint32 buf;\n            //fixOrientation(pixels, pixelsBufferSize, *bitmapwidth, *bitmapheight);\n            switch(origorientation) {\n                 case ORIENTATION_TOPLEFT:\n                 case ORIENTATION_TOPRIGHT:\n                    break;\n                 case ORIENTATION_BOTRIGHT:\n                 case ORIENTATION_BOTLEFT:\n                    flipPixelsVertical(*bitmapwidth, *bitmapheight, pixels);\n                    break;\n                 case ORIENTATION_LEFTTOP:\n                    rotateRaster(pixels, 90, bitmapwidth, bitmapheight);\n                    flipPixelsHorizontal(*bitmapwidth, *bitmapheight, pixels);\n                    buf = *bitmapwidth;\n                    *bitmapwidth = *bitmapheight;\n                    *bitmapheight = buf;\n                    break;\n                 case ORIENTATION_RIGHTTOP:\n                    rotateRaster(pixels, 270, bitmapwidth, bitmapheight);\n                    flipPixelsHorizontal(*bitmapwidth, *bitmapheight, pixels);\n                    buf = *bitmapwidth;\n                    *bitmapwidth = *bitmapheight;\n                    *bitmapheight = buf;\n                    break;\n                 case ORIENTATION_RIGHTBOT:\n                    rotateRaster(pixels, 90, bitmapwidth, bitmapheight);\n                    buf= *bitmapwidth;\n                    *bitmapwidth = *bitmapheight;\n                    *bitmapheight = buf;\n                    break;\n                 case ORIENTATION_LEFTBOT:\n                    rotateRaster(pixels, 270, bitmapwidth, bitmapheight);\n                    buf = *bitmapwidth;\n                    *bitmapwidth = *bitmapheight;\n                    *bitmapheight = buf;\n                    break;\n            }\n\n        } else if (origorientation == 2 || origorientation == 3 || origorientation == 6 || origorientation == 7) {\n            flipPixelsHorizontal(*bitmapwidth, *bitmapheight, pixels);\n        }\n\n        return pixels;\n}\n\njint * NativeDecoder::getSampledRasterFromStripWithBounds(int inSampleSize, int *bitmapwidth, int *bitmapheight) {\n\n    //init signal handler for catch SIGSEGV error that could be raised in libtiff\n    struct sigaction act;\n    memset(&act, 0, sizeof(act));\n    sigemptyset(&act.sa_mask);\n    act.sa_sigaction = stripErrorHandler;\n    act.sa_flags = SA_SIGINFO | SA_ONSTACK;\n    if(sigaction(SIGSEGV, &act, 0) < 0) {\n        LOGE(\"Can\\'t setup signal handler. Working without errors catching mechanism\");\n    }\n\n    LOGII(\"width\", origwidth);\n    LOGII(\"height\", origheight);\n\n    jint *pixels = NULL;\n    *bitmapwidth = origwidth / inSampleSize;\n    *bitmapheight = boundHeight / inSampleSize;//origheight / inSampleSize;\n    uint32 pixelsBufferSize = *bitmapwidth * *bitmapheight;\n    int origImageBufferSize = origwidth * origheight;\n\n    LOGII(\"new width\", *bitmapwidth);\n    LOGII(\"new height\", *bitmapheight);\n\n    uint32 stripSize = TIFFStripSize (image);\n    uint32 stripMax = TIFFNumberOfStrips (image);\n    LOGII(\"strip size \", stripSize);\n    LOGII(\"stripMax  \", stripMax);\n    int rowPerStrip = -1;\n    TIFFGetField(image, TIFFTAG_ROWSPERSTRIP, &rowPerStrip);\n    LOGII(\"rowsperstrip\", rowPerStrip);\n\n    unsigned long estimateMem = 0;\n    estimateMem += (sizeof(jint) * pixelsBufferSize); //temp buffer for decoded pixels\n    estimateMem += (sizeof(jint) * (boundWidth / inSampleSize) * (boundHeight/inSampleSize)); //final buffer that will store original image\n    estimateMem += (origwidth * sizeof(uint32)); //work line for rotate strip\n    estimateMem += (origwidth * rowPerStrip * sizeof (uint32) * 2); //current and next strips\n    estimateMem += (sizeof(jint) * origwidth * 2); //bottom and top lines for reading pixel(matrixBottomLine, matrixTopLine)\n    LOGII(\"estimateMem\", estimateMem);\n    if (estimateMem > availableMemory) {\n        if (throwException) {\n            throw_not_enought_memory_exception(env, availableMemory, estimateMem);\n        }\n        return NULL;\n    }\n\n    progressTotal = pixelsBufferSize + (boundWidth/inSampleSize) * (boundHeight / inSampleSize);\n    sendProgress(0, progressTotal);\n    jlong processedProgress = 0;\n\n    pixels = (jint *) malloc(sizeof(jint) * pixelsBufferSize);\n    if (pixels == NULL) {\n        LOGE(\"Can\\'t allocate memory for temp buffer\");\n        return NULL;\n    }\n\n    uint32* work_line_buf = (uint32 *)_TIFFmalloc(origwidth * sizeof(uint32));\n\n    uint32* raster;\n    uint32* rasterForBottomLine; // in this raster copy next strip for getting bottom line in matrix color selection\n    if (rowPerStrip == -1 && stripMax == 1) {\n            raster = (uint32 *)_TIFFmalloc(origImageBufferSize * sizeof (uint32));\n            rasterForBottomLine = (uint32 *)_TIFFmalloc(origImageBufferSize * sizeof (uint32));\n    } else {\n            raster = (uint32 *)_TIFFmalloc(origwidth * rowPerStrip * sizeof (uint32));\n            rasterForBottomLine = (uint32 *)_TIFFmalloc(origwidth * rowPerStrip * sizeof (uint32));\n    }\n    if (rowPerStrip == -1) {\n            rowPerStrip = origheight;\n    }\n\n    int writedLines = 0;\n    int nextStripOffset = 0;\n    int globalLineCounter = 0;\n\n    unsigned int *matrixTopLine = (uint32 *) malloc(sizeof(jint) * origwidth);\n    unsigned int *matrixBottomLine = (uint32 *) malloc(sizeof(jint) * origwidth);\n\n    int isSecondRasterExist = 0;\n    int ok = 1;\n    uint32 rows_to_write = 0;\n\n    //check for error\n    if (setjmp(NativeDecoder::strip_buf)) {\n        if (raster) {\n            _TIFFfree(raster);\n            raster = NULL;\n        }\n        if (rasterForBottomLine) {\n            _TIFFfree(rasterForBottomLine);\n            rasterForBottomLine = NULL;\n        }\n        if (matrixTopLine) {\n            _TIFFfree(matrixTopLine);\n            matrixTopLine = NULL;\n        }\n        if (matrixBottomLine) {\n            _TIFFfree(matrixBottomLine);\n            matrixBottomLine = NULL;\n        }\n\n        const char * err = \"Caught SIGSEGV signal(Segmentation fault or invalid memory reference)\";\n        LOGE(err);\n        if (throwException) {\n            throwDecodeFileException(err);\n        }\n\n        return NULL;\n    }\n\n    for (int i = 0; (i < stripMax*rowPerStrip || i > boundY + boundHeight) ; i += rowPerStrip) {\n\n            if (i + rowPerStrip <= boundY) {\n                continue;\n            }\n            if (i > boundY + boundHeight) {\n                break;\n            }\n\n            sendProgress(processedProgress * *bitmapwidth, progressTotal);\n            processedProgress += rowPerStrip/inSampleSize;\n\n            //if second raster is exist - copy it to work raster end decode next strip\n            if (isSecondRasterExist) {\n                _TIFFmemcpy(raster, rasterForBottomLine, origwidth * rowPerStrip * sizeof (uint32));\n\n                //If next strip is exist - decode it, invert lines\n                if (i + rowPerStrip < stripMax*rowPerStrip) {\n                    TIFFReadRGBAStrip(image, i+rowPerStrip, rasterForBottomLine);\n                    isSecondRasterExist = 1;\n\n                    rows_to_write = 0;\n                    if ( i + rowPerStrip * 2 > origheight )\n                        rows_to_write = origheight - i - rowPerStrip;\n                    else\n                        rows_to_write = rowPerStrip;\n\n                    if (origorientation <= 4) {\n                        for (int line = 0; line < rows_to_write / 2; line++) {\n                            unsigned int  *top_line, *bottom_line;\n\n                            top_line = rasterForBottomLine + origwidth * line;\n                            bottom_line = rasterForBottomLine + origwidth * (rows_to_write - line - 1);\n\n                            _TIFFmemcpy(work_line_buf, top_line, sizeof(unsigned int) * origwidth);\n                            _TIFFmemcpy(top_line, bottom_line, sizeof(unsigned int) * origwidth);\n                            _TIFFmemcpy(bottom_line, work_line_buf, sizeof(unsigned int) * origwidth);\n                        }\n                    }\n                } else {\n                    isSecondRasterExist = 0;\n                }\n            } else {\n                //if second raster is not exist - first processing - read first and second raster\n                 TIFFReadRGBAStrip(image, i, raster);\n                 //invert lines, because libtiff origin is bottom left instead of top left\n                 rows_to_write = 0;\n                 if( i + rowPerStrip > origheight )\n                    rows_to_write = origheight - i;\n                 else\n                    rows_to_write = rowPerStrip;\n\n                 if (origorientation <= 4) {\n                     for (int line = 0; line < rows_to_write / 2; line++) {\n                         unsigned int  *top_line, *bottom_line;\n\n                         top_line = raster + origwidth * line;\n                         bottom_line = raster + origwidth * (rows_to_write - line - 1);\n\n                         _TIFFmemcpy(work_line_buf, top_line, sizeof(unsigned int) * origwidth);\n                         _TIFFmemcpy(top_line, bottom_line, sizeof(unsigned int) * origwidth);\n                         _TIFFmemcpy(bottom_line, work_line_buf, sizeof(unsigned int) * origwidth);\n                     }\n                 }\n\n                 //if next strip is exist - read it and invert lines\n                 if (i + rowPerStrip < origheight) {\n                    TIFFReadRGBAStrip(image, i+rowPerStrip, rasterForBottomLine);\n                    isSecondRasterExist = 1;\n\n                    //invert lines, because libtiff origin is bottom left instead of top left\n                    rows_to_write = 0;\n                    if ( i + rowPerStrip * 2 > origheight )\n                        rows_to_write = origheight - i - rowPerStrip;\n                    else\n                        rows_to_write = rowPerStrip;\n                    if (origorientation <= 4) {\n                        for (int line = 0; line < rows_to_write / 2; line++) {\n                            unsigned int  *top_line, *bottom_line;\n\n                            top_line = rasterForBottomLine + origwidth * line;\n                            bottom_line = rasterForBottomLine + origwidth * (rows_to_write - line - 1);\n\n                            _TIFFmemcpy(work_line_buf, top_line, sizeof(unsigned int) * origwidth);\n                            _TIFFmemcpy(top_line, bottom_line, sizeof(unsigned int) * origwidth);\n                            _TIFFmemcpy(bottom_line, work_line_buf, sizeof(unsigned int) * origwidth);\n                        }\n                    }\n                 }\n\n            }\n\n            /*if (inSampleSize == 1) {\n                int byteToCopy = 0;\n                if (i + rowPerStrip < origheight) {\n                    byteToCopy = sizeof(unsigned int) * rowPerStrip * origwidth;\n                } else {\n                    byteToCopy = sizeof(unsigned int) * rows_to_write * origwidth;\n                }\n                int position = i * origwidth;\n                memcpy(&pixels[position], raster, byteToCopy);\n                //sendProgress(position, progressTotal);\n            } else {*/\n                if (isSecondRasterExist) {\n                    _TIFFmemcpy(matrixBottomLine, rasterForBottomLine /*+ lineAddrToCopyBottomLine * origwidth*/, sizeof(unsigned int) * origwidth);\n                }\n                 int workWritedLines = writedLines;\n                 for (int resBmpY = workWritedLines, workY = 0; resBmpY < *bitmapheight && workY < rowPerStrip; /*wj++,*/ workY ++/*= inSampleSize*/) {\n\n                 if (checkStop()) {\n                     if (raster) {\n                         _TIFFfree(raster);\n                         raster = NULL;\n                     }\n                     if (rasterForBottomLine) {\n                         _TIFFfree(rasterForBottomLine);\n                         rasterForBottomLine = NULL;\n                     }\n                     if (matrixTopLine) {\n                         _TIFFfree(matrixTopLine);\n                         matrixTopLine = NULL;\n                     }\n                     if (matrixBottomLine) {\n                         _TIFFfree(matrixBottomLine);\n                         matrixBottomLine = NULL;\n                     }\n                     LOGI(\"Thread stopped\");\n                     return NULL;\n                 }\n\n                    // if total line of source image is equal to inSampleSize*N then process this line\n                    if (globalLineCounter % inSampleSize == 0) {\n                        for (int resBmpX = 0, workX = 0; resBmpX < *bitmapwidth; workX += inSampleSize) {\n\n                            /*if (workX <= boundX) {\n                                continue;\n                            }\n                            if (workX > boundX + boundWidth) {\n                                break;\n                            }\n                            LOGII(\"J\", workX);*/\n\n                            //Apply filter to pixel\n                            jint crPix = raster[workY * origwidth + workX];\n                            int sum = 1;\n\n\n                            int alpha = colorMask & crPix >> 24;\n                            int red = colorMask & crPix >> 16;\n                            int green = colorMask & crPix >> 8;\n                            int blue = colorMask & crPix;\n\n\n                            //topleft\n                            if (workX - 1 >= 0 && workY - 1 >= 0) {\n                                crPix = raster[(workY - 1) * origwidth + workX - 1];\n                                red += colorMask & crPix >> 16;\n                                green += colorMask & crPix >> 8;\n                                blue += colorMask & crPix;\n                                alpha += colorMask & crPix >> 24;\n                                sum++;\n                            } else if (workX - 1 >= 0 && workY - 1 == -1 && globalLineCounter > 0) {\n                                crPix = matrixTopLine[workX - 1];\n                                red += colorMask & crPix >> 16;\n                                green += colorMask & crPix >> 8;\n                                blue += colorMask & crPix;\n                                alpha += colorMask & crPix >> 24;\n                                sum++;\n                            }\n                            //top\n                            if (workY - 1 >= 0) {\n                                crPix = raster[(workY - 1) * origwidth + workX];\n                                red += colorMask & crPix >> 16;\n                                green += colorMask & crPix >> 8;\n                                blue += colorMask & crPix;\n                                alpha += colorMask & crPix >> 24;\n                                sum++;\n                            } else if (workY - 1 == -1 && globalLineCounter > 0) {\n                                crPix = matrixTopLine[workX];\n                                red += colorMask & crPix >> 16;\n                                green += colorMask & crPix >> 8;\n                                blue += colorMask & crPix;\n                                alpha += colorMask & crPix >> 24;\n                                sum++;\n                            }\n\n                            // topright\n                            if (workX + 1 < origwidth && workY - 1 >= 0) {\n                                crPix = raster[(workY - 1) * origwidth + workX + 1];\n                                red += colorMask & crPix >> 16;\n                                green += colorMask & crPix >> 8;\n                                blue += colorMask & crPix;\n                                alpha += colorMask & crPix >> 24;\n                                sum++;\n                            } else if (workX + 1 < origwidth && workY - 1 == -1 && globalLineCounter > 0) {\n                                crPix = matrixTopLine[workX + 1];\n                                red += colorMask & crPix >> 16;\n                                green += colorMask & crPix >> 8;\n                                blue += colorMask & crPix;\n                                alpha += colorMask & crPix >> 24;\n                                sum++;\n                            }\n\n                            //right\n                            if (workX + 1 < origwidth) {\n                                crPix = raster[workY * origwidth + workX + 1];\n                                red += colorMask & crPix >> 16;\n                                green += colorMask & crPix >> 8;\n                                blue += colorMask & crPix;\n                                alpha += colorMask & crPix >> 24;\n                                sum++;\n                            }\n\n                            //bottomright\n                            if (workX + 1 < origwidth && workY + 1 < rowPerStrip) {\n                                crPix = raster[(workY + 1) * origwidth + workX + 1];\n                                red += colorMask & crPix >> 16;\n                                green += colorMask & crPix >> 8;\n                                blue += colorMask & crPix;\n                                alpha += colorMask & crPix >> 24;\n                                sum++;\n                            } else if (workX + 1 < origwidth && workY + 1 == rowPerStrip && isSecondRasterExist) {\n                                crPix = matrixBottomLine[workX + 1];\n                                red += colorMask & crPix >> 16;\n                                green += colorMask & crPix >> 8;\n                                blue += colorMask & crPix;\n                                alpha += colorMask & crPix >> 24;\n                                sum++;\n                            }\n\n                            //bottom\n                            if (workY + 1 < rowPerStrip) {\n                                crPix = raster[(workY + 1) * origwidth + workX + 1];\n                                red += colorMask & crPix >> 16;\n                                green += colorMask & crPix >> 8;\n                                blue += colorMask & crPix;\n                                alpha += colorMask & crPix >> 24;\n                                sum++;\n                            } else if (workY + 1 == rowPerStrip && isSecondRasterExist) {\n                                crPix = matrixBottomLine[workX + 1];\n                                red += colorMask & crPix >> 16;\n                                green += colorMask & crPix >> 8;\n                                blue += colorMask & crPix;\n                                alpha += colorMask & crPix >> 24;\n                                sum++;\n                            }\n\n                            //bottomleft\n                            if (workX - 1 >= 0 && workY + 1 < rowPerStrip) {\n                                crPix = raster[(workY + 1) * origwidth + workX - 1];\n                                red += colorMask & crPix >> 16;\n                                green += colorMask & crPix >> 8;\n                                blue += colorMask & crPix;\n                                alpha += colorMask & crPix >> 24;\n                                sum++;\n                            } else if (workX - 1 >= 0 && workY + 1 == rowPerStrip  && isSecondRasterExist) {\n                                crPix = matrixBottomLine[workX - 1];\n                                red += colorMask & crPix >> 16;\n                                green += colorMask & crPix >> 8;\n                                blue += colorMask & crPix;\n                                alpha += colorMask & crPix >> 24;\n                                sum++;\n                            }\n\n\n                            //left\n                            if (workX - 1 >= 0) {\n                                crPix = raster[workY * origwidth + workX - 1];\n                                red += colorMask & crPix >> 16;\n                                green += colorMask & crPix >> 8;\n                                blue += colorMask & crPix;\n                                alpha += colorMask & crPix >> 24;\n                                sum++;\n                            }\n\n                            red /= sum;\n                            if (red > 255) red = 255;\n                            if (red < 0) red = 0;\n\n                            green /= sum;\n                            if (green > 255) green = 255;\n                            if (green < 0) green = 0;\n\n                            blue /= sum;\n                            if (blue > 255) blue = 255;\n                            if (blue < 0) blue = 0;\n\n                            alpha /= sum;///= sum;\n                            if (alpha > 255) alpha = 255;\n                            if (alpha < 0) alpha = 0;\n\n                            crPix = (alpha << 24) | (red << 16) | (green << 8) | (blue);\n\n                            pixels[resBmpY * *bitmapwidth + resBmpX] = crPix;\n\n                            resBmpX++;\n                        }\n                        //if line was processed - increment counter of lines that was writed to result image\n                        writedLines++;\n                        //and incremetncounter of current Y for writing\n                        resBmpY++;\n                    }\n                    if (workY == rowPerStrip - 1 && i + rowPerStrip < origheight) {\n                        _TIFFmemcpy(matrixTopLine, raster + workY * origwidth, sizeof(unsigned int) * origwidth);\n                    }\n                    //incremetn global source image line counter\n                    globalLineCounter++;\n\n                }\n            /*}*/\n        }\n        LOGI(\"Decoding finished. Free memmory\");\n\n        //Close Buffers\n        if (raster) {\n            _TIFFfree(raster);\n            raster = NULL;\n        }\n\n        if (rasterForBottomLine) {\n            _TIFFfree(rasterForBottomLine);\n            rasterForBottomLine = NULL;\n        }\n\n        if (matrixTopLine) {\n            _TIFFfree(matrixTopLine);\n            matrixTopLine = NULL;\n        }\n\n        if (matrixBottomLine) {\n            _TIFFfree(matrixBottomLine);\n            matrixBottomLine = NULL;\n        }\n\n        processedProgress *= *bitmapwidth;\n\n        if (useOrientationTag) {\n            uint32 buf;\n            switch(origorientation) {\n                 case ORIENTATION_TOPLEFT:\n                 case ORIENTATION_TOPRIGHT:\n                    break;\n                 case ORIENTATION_BOTRIGHT:\n                 case ORIENTATION_BOTLEFT:\n                    flipPixelsVertical(*bitmapwidth, *bitmapheight, pixels);\n                    break;\n                 case ORIENTATION_LEFTTOP:\n                    rotateRaster(pixels, 90, bitmapwidth, bitmapheight);\n                    flipPixelsHorizontal(*bitmapwidth, *bitmapheight, pixels);\n                    buf = *bitmapwidth;\n                    *bitmapwidth = *bitmapheight;\n                    *bitmapheight = buf;\n                    break;\n                 case ORIENTATION_RIGHTTOP:\n                    rotateRaster(pixels, 270, bitmapwidth, bitmapheight);\n                    flipPixelsHorizontal(*bitmapwidth, *bitmapheight, pixels);\n                    buf = *bitmapwidth;\n                    *bitmapwidth = *bitmapheight;\n                    *bitmapheight = buf;\n                    break;\n                 case ORIENTATION_RIGHTBOT:\n                    rotateRaster(pixels, 90, bitmapwidth, bitmapheight);\n                    buf= *bitmapwidth;\n                    *bitmapwidth = *bitmapheight;\n                    *bitmapheight = buf;\n                    break;\n                 case ORIENTATION_LEFTBOT:\n                    rotateRaster(pixels, 270, bitmapwidth, bitmapheight);\n                    buf = *bitmapwidth;\n                    *bitmapwidth = *bitmapheight;\n                    *bitmapheight = buf;\n                    break;\n            }\n\n        } else if (origorientation == 2 || origorientation == 3 || origorientation == 6 || origorientation == 7) {\n            flipPixelsHorizontal(*bitmapwidth, *bitmapheight, pixels);\n        }\n\n        uint32 tmpPixelBufferSize = (boundWidth / inSampleSize) * (boundHeight / inSampleSize);\n\n        estimateMem = (sizeof(jint) * pixelsBufferSize); //temp buffer for decoded pixels\n        estimateMem += (sizeof(jint) * tmpPixelBufferSize); //final buffer that will store original image\n        LOGII(\"estimateMem\", estimateMem);\n        if (estimateMem > availableMemory) {\n            if (throwException) {\n                throw_not_enought_memory_exception(env, availableMemory, estimateMem);\n            }\n            return NULL;\n        }\n\n        jint* tmpPixels = (jint *) malloc(sizeof(jint) * tmpPixelBufferSize);\n        uint32 startPosX = 0;\n\n        if (useOrientationTag && (origorientation == ORIENTATION_TOPRIGHT || origorientation == ORIENTATION_BOTRIGHT\n                                    || origorientation == ORIENTATION_LEFTBOT || origorientation == ORIENTATION_RIGHTBOT)) {\n            startPosX = *bitmapwidth - boundX/inSampleSize;\n            for (int ox = startPosX, nx = 0; nx < boundWidth/inSampleSize; ox--, nx++) {\n                sendProgress(processedProgress + nx * boundWidth/inSampleSize, progressTotal);\n                for (int oy = 0, ny = 0; ny < boundHeight/inSampleSize; oy++, ny++) {\n                    if (useOrientationTag && (origorientation > 4)) {\n                        tmpPixels[nx * (boundHeight/inSampleSize) + ny] = pixels[ox * *bitmapheight + oy];\n                    } else {\n                        tmpPixels[ny * (boundWidth/inSampleSize) + nx] = pixels[oy * *bitmapwidth + ox];\n                    }\n                }\n            }\n        } else {\n            startPosX = boundX/inSampleSize;\n            for (int ox = startPosX, nx = 0; nx < boundWidth/inSampleSize; ox++, nx++) {\n                sendProgress(processedProgress + nx * boundWidth/inSampleSize, progressTotal);\n                for (int oy = 0, ny = 0; ny < boundHeight/inSampleSize; oy++, ny++) {\n                    if (useOrientationTag && (origorientation > 4)) {\n                        tmpPixels[nx * (boundHeight/inSampleSize) + ny] = pixels[ox * *bitmapheight + oy];\n                    } else {\n                        tmpPixels[ny * (boundWidth/inSampleSize) + nx] = pixels[oy * *bitmapwidth + ox];\n                    }\n                }\n            }\n        }\n\n        free(pixels);\n        pixels = tmpPixels;\n        *bitmapwidth = boundWidth/inSampleSize;\n        *bitmapheight = boundHeight/inSampleSize;\n\n        return pixels;\n}\n\nvoid NativeDecoder::rotateTileLinesVertical(uint32 tileHeight, uint32 tileWidth, uint32* whatRotate, uint32 *bufferLine) {\n    for (int line = 0; line < tileHeight / 2; line++) {\n        unsigned int  *top_line, *bottom_line;\n        top_line = whatRotate + tileWidth * line;\n        bottom_line = whatRotate + tileWidth * (tileHeight - line -1);\n        _TIFFmemcpy(bufferLine, top_line, sizeof(unsigned int) * tileWidth);\n        _TIFFmemcpy(top_line, bottom_line, sizeof(unsigned int) * tileWidth);\n        _TIFFmemcpy(bottom_line, bufferLine, sizeof(unsigned int) * tileWidth);\n    }\n}\n\nvoid NativeDecoder::rotateTileLinesHorizontal(uint32 tileHeight, uint32 tileWidth, uint32* whatRotate, uint32 *bufferLine) {\n    uint32 buf;\n    for (int y = 0; y < tileHeight; y++) {\n        for (int x = 0; x < tileWidth / 2; x++) {\n            buf = whatRotate[y * tileWidth + x];\n            whatRotate[y * tileWidth + x] = whatRotate[y * tileWidth + tileWidth - x - 1];\n            whatRotate[y * tileWidth + tileWidth - x - 1] = buf;\n        }\n    }\n}\n\njint * NativeDecoder::getSampledRasterFromTile(int inSampleSize, int *bitmapwidth, int *bitmapheight) {\n\n        //init signal handler for catch SIGSEGV error that could be raised in libtiff\n        struct sigaction act;\n        memset(&act, 0, sizeof(act));\n        sigemptyset(&act.sa_mask);\n        act.sa_sigaction = tileErrorHandler;\n        act.sa_flags = SA_SIGINFO | SA_ONSTACK;\n        if(sigaction(SIGSEGV, &act, 0) < 0) {\n            LOGE(\"Can\\'t setup signal handler. Working without errors catching mechanism\");\n        }\n\n        jint *pixels = NULL;\n        *bitmapwidth = origwidth / inSampleSize;\n        *bitmapheight = origheight / inSampleSize;\n        uint32 pixelsBufferSize = *bitmapwidth * *bitmapheight;\n\n        uint32 tileWidth = 0, tileHeight = 0;\n        TIFFGetField(image, TIFFTAG_TILEWIDTH, &tileWidth);\n        TIFFGetField(image, TIFFTAG_TILEWIDTH, &tileHeight);\n\n        unsigned long estimateMem = 0;\n        estimateMem += (sizeof(jint) * pixelsBufferSize); //buffer for decoded pixels\n        estimateMem += (tileWidth * tileHeight * sizeof(uint32)) * 3; //current, left and right tiles buffers\n        estimateMem += (tileWidth * sizeof(uint32)); //work line for rotate tile\n        LOGII(\"estimateMem\", estimateMem);\n        if (estimateMem > availableMemory) {\n            if (throwException) {\n                throw_not_enought_memory_exception(env, availableMemory, estimateMem);\n            }\n            return NULL;\n        }\n\n        pixels = (jint *) malloc(sizeof(jint) * pixelsBufferSize);\n        if (pixels == NULL) {\n            LOGE(\"Can\\'t allocate memory for temp buffer\");\n            return NULL;\n        }\n\n        uint32 row, column;\n\n        //main worker tile\n        uint32 *rasterTile = (uint32 *)_TIFFmalloc(tileWidth * tileHeight * sizeof(uint32));\n        //left tile\n        uint32 *rasterTileLeft = (uint32 *)_TIFFmalloc(tileWidth * tileHeight * sizeof(uint32));\n        //right tile\n        uint32 *rasterTileRight = (uint32 *)_TIFFmalloc(tileWidth * tileHeight * sizeof(uint32));\n\n        uint32 *work_line_buf = (uint32*)_TIFFmalloc(tileWidth * sizeof (uint32));\n\n        //this variable calculate processed pixels for x and y direction to make right offsets at the begining of next tile\n        //offset calculated from condition globalProcessed % inSampleSize should be 0\n        uint32 globalProcessedX = 0;\n        uint32 globalProcessedY = 0;\n\n        //check for error\n        if (setjmp(NativeDecoder::tile_buf)) {\n            if (rasterTile) {\n                _TIFFfree(rasterTile);\n                rasterTile = NULL;\n            }\n            if (rasterTileLeft) {\n                _TIFFfree(rasterTileLeft);\n                rasterTileLeft = NULL;\n            }\n            if (rasterTileRight) {\n                _TIFFfree(rasterTileRight);\n                rasterTileRight = NULL;\n            }\n            if (work_line_buf) {\n                _TIFFfree(work_line_buf);\n                work_line_buf = NULL;\n            }\n\n            const char * err = \"Caught SIGSEGV signal(Segmentation fault or invalid memory reference)\";\n            LOGE(err);\n            if (throwException) {\n                throwDecodeFileException(err);\n            }\n\n            return NULL;\n        }\n\n        for (row = 0; row < origheight; row += tileHeight) {\n            short leftTileExists = 0;\n            short rightTileExists = 0;\n            for (column = 0; column < origwidth; column += tileWidth) {\n                sendProgress(row * origwidth + column, progressTotal);\n\n                //If not first column - we should have previous tile - copy it to left tile buffer\n                if (column != 0) {\n                    _TIFFmemcpy(rasterTileLeft, rasterTile, tileWidth * tileHeight * sizeof(uint32));\n                    leftTileExists = 1;\n                } else {\n                    leftTileExists = 0;\n                }\n\n                //if current column + tile width is less than origin width - we have right tile - copy it to current tile and read next tile to rasterTileRight buffer\n                if (column + tileWidth < origwidth && rightTileExists) {\n                    _TIFFmemcpy(rasterTile, rasterTileRight, tileWidth * tileHeight * sizeof(uint32));\n                    TIFFReadRGBATile(image, column + tileWidth, row, rasterTileRight);\n                    rightTileExists = 1;\n                } else if (column + tileWidth < origwidth) {\n                    //have right tile but this is first tile in row, so need to read raster and right raster\n                    TIFFReadRGBATile(image, column + tileWidth, row, rasterTileRight);\n                    TIFFReadRGBATile(image, column, row, rasterTile);\n                    rightTileExists = 1;\n\n                    //in that case we also need to invert lines in rasterTile\n                    switch(origorientation) {\n                        case 1:\n                        case 5:\n                            rotateTileLinesVertical(tileHeight, tileWidth, rasterTile, work_line_buf);\n                            break;\n                        case 2:\n                        case 6:\n                            rotateTileLinesVertical(tileHeight, tileWidth, rasterTile, work_line_buf);\n                            rotateTileLinesHorizontal(tileHeight, tileWidth, rasterTile, work_line_buf);\n                            break;\n                        case 3:\n                        case 7:\n                            rotateTileLinesHorizontal(tileHeight, tileWidth, rasterTile, work_line_buf);\n                            break;\n                    }\n                } else {\n                    //otherwise we haven't right tile buffer, so we should read tile to current buffer\n                    TIFFReadRGBATile(image, column, row, rasterTile);\n                    rightTileExists = 0;\n                }\n\n                //if we have right tile - current tile already rotated and we need to rotate only right tile\n                if (rightTileExists) {\n                    switch(origorientation) {\n                        case 1:\n                        case 5:\n                            rotateTileLinesVertical(tileHeight, tileWidth, rasterTileRight, work_line_buf);\n                            break;\n                        case 2:\n                        case 6:\n                            rotateTileLinesVertical(tileHeight, tileWidth, rasterTileRight, work_line_buf);\n                            rotateTileLinesHorizontal(tileHeight, tileWidth, rasterTileRight, work_line_buf);\n                            break;\n                        case 3:\n                        case 7:\n                            rotateTileLinesHorizontal(tileHeight, tileWidth, rasterTileRight, work_line_buf);\n                            break;\n                    }\n                } else {\n                    //otherwise - current tile not rotated so rotate it\n                    //tile orig is on bottom left - should change lines\n                     switch(origorientation) {\n                        case 1:\n                        case 5:\n                            rotateTileLinesVertical(tileHeight, tileWidth, rasterTile, work_line_buf);\n                            break;\n                        case 2:\n                        case 6:\n                            rotateTileLinesVertical(tileHeight, tileWidth, rasterTile, work_line_buf);\n                            rotateTileLinesHorizontal(tileHeight, tileWidth, rasterTile, work_line_buf);\n                            break;\n                        case 3:\n                        case 7:\n                            rotateTileLinesHorizontal(tileHeight, tileWidth, rasterTile, work_line_buf);\n                            break;\n                    }\n                }\n\n                if (inSampleSize > 1 )\n                {\n                    //Tile could begin from not filled pixel(pixel[x,y] == 0). This variables allow to calculate begining of filled pixels\n                    int tileStartDataX = -1;\n                    int tileStartDataY = -1;\n\n                    for (int origTileY = 0, pixY = row/inSampleSize; origTileY < tileHeight && pixY < *bitmapheight; origTileY++) {\n\n                        if (checkStop()) {\n                            if (rasterTile) {\n                                _TIFFfree(rasterTile);\n                                rasterTile = NULL;\n                            }\n                            if (rasterTileLeft) {\n                                _TIFFfree(rasterTileLeft);\n                                rasterTileLeft = NULL;\n                            }\n                            if (rasterTileRight) {\n                                _TIFFfree(rasterTileRight);\n                                rasterTileRight = NULL;\n                            }\n                            if (work_line_buf) {\n                                _TIFFfree(work_line_buf);\n                                work_line_buf = NULL;\n                            }\n                            LOGI(\"Thread stopped\");\n                            return NULL;\n                        }\n\n                        if (tileStartDataY != -1 && globalProcessedY % inSampleSize != 0) {\n                            if (tileStartDataY != -1) {\n                                globalProcessedY++;\n                            }\n                        }\n                        else\n                        {\n                            for (int origTileX = 0, pixX = column/inSampleSize; origTileX < tileWidth && pixX < *bitmapwidth; origTileX++) {\n                                if (tileStartDataX != -1 && globalProcessedX % inSampleSize != 0)\n                                {\n                                    if (tileStartDataX != -1) {\n                                        globalProcessedX++;\n                                    }\n                                }\n                                else\n                                {\n                                    uint32 srcPosition = origTileY * tileWidth + origTileX;\n                                    if (rasterTile[srcPosition] != 0) {\n                                        if (tileStartDataX == -1) {\n                                            tileStartDataX = origTileX;\n                                        }\n                                        if (tileStartDataY == -1) {\n                                            tileStartDataY = origTileY;\n                                        }\n\n                                        //Apply filter to pixel\n                                        jint crPix = rasterTile[srcPosition];//origBuffer[j1 * origwidth + i1];\n                                        int sum = 1;\n\n                                        int alpha = colorMask & crPix >> 24;\n                                        int red = colorMask & crPix >> 16;\n                                        int green = colorMask & crPix >> 8;\n                                        int blue = colorMask & crPix;\n\n                                        //using kernel 3x3\n\n                                        //topleft\n                                        if (origTileX - 1 >= 0 && origTileY - 1 >= 0) {\n                                            crPix = rasterTile[(origTileY - 1) * tileWidth + origTileX - 1];\n                                            if (crPix != 0) {\n                                                red += colorMask & crPix >> 16;\n                                                green += colorMask & crPix >> 8;\n                                                blue += colorMask & crPix;\n                                                alpha += colorMask & crPix >> 24;\n                                                sum++;\n                                            }\n                                        } else if (origTileY - 1 >= 0 && leftTileExists) {\n                                            crPix = rasterTileLeft[(origTileY - 1) * tileWidth + tileWidth - 1];\n                                            if (crPix != 0) {\n                                                red += colorMask & crPix >> 16;\n                                                green += colorMask & crPix >> 8;\n                                                blue += colorMask & crPix;\n                                                alpha += colorMask & crPix >> 24;\n                                                sum++;\n                                            }\n                                        }\n\n                                        //top\n                                        if (origTileY - 1 >= 0) {\n                                            crPix = rasterTile[(origTileY - 1) * tileWidth + origTileX];\n                                            if (crPix != 0) {\n                                                red += colorMask & crPix >> 16;\n                                                green += colorMask & crPix >> 8;\n                                                blue += colorMask & crPix;\n                                                alpha += colorMask & crPix >> 24;\n                                                sum++;\n                                            }\n                                        }\n\n                                        // topright\n                                        if (origTileX + 1 < tileWidth && origTileY - 1 >= 0) {\n                                            crPix = rasterTile[(origTileY - 1) * tileWidth + origTileX + 1];\n                                            if (crPix != 0) {\n                                                red += colorMask & crPix >> 16;\n                                                green += colorMask & crPix >> 8;\n                                                blue += colorMask & crPix;\n                                                alpha += colorMask & crPix >> 24;\n                                                sum++;\n                                            }\n                                        } else if (origTileY - 1 >= 0 && rightTileExists) {\n                                            crPix = rasterTileRight[(origTileY - 1) * tileWidth];\n                                            if (crPix != 0) {\n                                                red += colorMask & crPix >> 16;\n                                                green += colorMask & crPix >> 8;\n                                                blue += colorMask & crPix;\n                                                alpha += colorMask & crPix >> 24;\n                                                sum++;\n                                            }\n                                        }\n\n                                        //right\n                                        if (origTileX + 1 < tileWidth) {\n                                            crPix = rasterTile[origTileY * tileWidth + origTileX + 1];\n                                            if (crPix != 0) {\n                                                red += colorMask & crPix >> 16;\n                                                green += colorMask & crPix >> 8;\n                                                blue += colorMask & crPix;\n                                                alpha += colorMask & crPix >> 24;\n                                                sum++;\n                                            }\n                                        } else if (rightTileExists) {\n                                            crPix = rasterTileRight[origTileY * tileWidth];\n                                            if (crPix != 0) {\n                                                red += colorMask & crPix >> 16;\n                                                green += colorMask & crPix >> 8;\n                                                blue += colorMask & crPix;\n                                                alpha += colorMask & crPix >> 24;\n                                                sum++;\n                                            }\n                                        }\n\n                                        //bottomright\n                                        if (origTileX + 1 < tileWidth && origTileY + 1 < tileHeight) {\n                                            crPix = rasterTile[(origTileY + 1) * tileWidth + origTileX + 1];\n                                            if (crPix != 0) {\n                                                red += colorMask & crPix >> 16;\n                                                green += colorMask & crPix >> 8;\n                                                blue += colorMask & crPix;\n                                                alpha += colorMask & crPix >> 24;\n                                                sum++;\n                                            }\n                                        } else if (origTileY + 1 < tileHeight && rightTileExists) {\n                                            crPix = rasterTileRight[(origTileY + 1) * tileWidth];\n                                            if (crPix != 0) {\n                                                red += colorMask & crPix >> 16;\n                                                green += colorMask & crPix >> 8;\n                                                blue += colorMask & crPix;\n                                                alpha += colorMask & crPix >> 24;\n                                                sum++;\n                                            }\n                                        }\n\n                                        //bottom\n                                        if (origTileY + 1 < tileHeight) {\n                                            crPix = rasterTile[(origTileY + 1) * tileWidth + origTileX];\n                                            if (crPix != 0) {\n                                                red += colorMask & crPix >> 16;\n                                                green += colorMask & crPix >> 8;\n                                                blue += colorMask & crPix;\n                                                alpha += colorMask & crPix >> 24;\n                                                sum++;\n                                            }\n                                        }\n\n                                        //bottomleft\n                                        if (origTileX - 1 >= 0 && origTileY + 1 < tileHeight) {\n                                            crPix = rasterTile[(origTileY + 1) * tileWidth + origTileX - 1];\n                                            if (crPix != 0) {\n                                                red += colorMask & crPix >> 16;\n                                                green += colorMask & crPix >> 8;\n                                                blue += colorMask & crPix;\n                                                alpha += colorMask & crPix >> 24;\n                                                sum++;\n                                            }\n                                        } else if (origTileY + 1 < tileHeight && leftTileExists) {\n                                            crPix = rasterTileLeft[(origTileY + 1) * tileWidth + tileWidth - 1];\n                                            if (crPix != 0) {\n                                                red += colorMask & crPix >> 16;\n                                                green += colorMask & crPix >> 8;\n                                                blue += colorMask & crPix;\n                                                alpha += colorMask & crPix >> 24;\n                                                sum++;\n                                            }\n                                        }\n\n                                        //left\n                                        if (origTileX - 1 >= 0) {\n                                            crPix = rasterTile[origTileY * tileWidth + origTileX - 1];\n                                            if (crPix != 0) {\n                                                red += colorMask & crPix >> 16;\n                                                green += colorMask & crPix >> 8;\n                                                blue += colorMask & crPix;\n                                                alpha += colorMask & crPix >> 24;\n                                                sum++;\n                                            }\n                                        } else if (leftTileExists) {\n                                            crPix = rasterTileLeft[origTileY * tileWidth + tileWidth - 1];\n                                            if (crPix != 0) {\n                                                red += colorMask & crPix >> 16;\n                                                green += colorMask & crPix >> 8;\n                                                blue += colorMask & crPix;\n                                                alpha += colorMask & crPix >> 24;\n                                                sum++;\n                                            }\n                                        }\n\n                                        red /= sum;\n                                        if (red > 255) red = 255;\n                                        if (red < 0) red = 0;\n\n                                        green /= sum;\n                                        if (green > 255) green = 255;\n                                        if (green < 0) green = 0;\n\n                                        blue /= sum;\n                                        if (blue > 255) blue = 255;\n                                        if (blue < 0) blue = 0;\n\n                                        alpha /= sum;///= sum;\n                                        if (alpha > 255) alpha = 255;\n                                        if (alpha < 0) alpha = 0;\n\n                                        crPix = (alpha << 24) | (red << 16) | (green << 8) | (blue);\n\n                                        int position;\n                                        if (origorientation <= 4) {\n                                            position = pixY * *bitmapwidth + pixX;\n                                        } else {\n                                            position = pixX * *bitmapheight + pixY;\n                                        }\n                                        pixels[position] = crPix;\n                                    } else {\n                                        if (tileStartDataX != -1) tileStartDataX = -1;\n                                        if (tileStartDataY != -1) tileStartDataY = -1;\n                                    }\n\n                                    if (tileStartDataX != -1) {\n                                        pixX++;\n                                        globalProcessedX++;\n                                    }\n\n                                }\n                            }\n                            if (tileStartDataY != -1) {\n                                pixY++;\n                                globalProcessedY++;\n                            }\n                        }\n                    }\n                } else {\n                    int rowHasPixels = 0;\n                        for (int th = 0, bh = 0; th < tileHeight; th++) {\n                            for (int tw = 0, bw = 0; tw < tileWidth; tw++) {\n                                uint32 srcPosition = th * tileWidth + tw;\n                                if (rasterTile[srcPosition] != 0) {\n                                    int position = 0;\n                                    if (origorientation <= 4) {\n                                        position = (row + bh) * *bitmapwidth + column + bw;\n                                    } else {\n                                        position = (column + bw) * *bitmapheight + row + bh;\n                                    }\n                                    pixels[position] = rasterTile[srcPosition];\n                                    rowHasPixels = 1;\n                                    bw++;\n                                }\n                            }\n                            if (rowHasPixels) {\n                                bh++;\n                                rowHasPixels = 0;\n                            }\n                        }\n                }\n            }\n        }\n\n        if (rasterTile) {\n            _TIFFfree(rasterTile);\n            rasterTile = NULL;\n        }\n        if (rasterTileLeft) {\n            _TIFFfree(rasterTileLeft);\n            rasterTileLeft = NULL;\n        }\n        if (rasterTileRight) {\n            _TIFFfree(rasterTileRight);\n            rasterTileRight = NULL;\n        }\n        if (work_line_buf) {\n            _TIFFfree(work_line_buf);\n            work_line_buf = NULL;\n        }\n\n        if (useOrientationTag) {\n            switch (origorientation) {\n                case ORIENTATION_TOPLEFT:\n                case ORIENTATION_LEFTTOP:\n                    break;\n                case ORIENTATION_TOPRIGHT:\n                    flipPixelsHorizontal(*bitmapwidth, *bitmapheight, pixels);\n                    break;\n                case ORIENTATION_RIGHTTOP:\n                    flipPixelsHorizontal(*bitmapheight, *bitmapwidth, pixels);\n                    break;\n                case ORIENTATION_BOTRIGHT:\n                case ORIENTATION_RIGHTBOT:\n                    rotateRaster(pixels, 180, bitmapwidth, bitmapheight);\n                    break;\n                case ORIENTATION_BOTLEFT:\n                    flipPixelsVertical(*bitmapwidth, *bitmapheight, pixels);\n                    break;\n                case ORIENTATION_LEFTBOT:\n                    flipPixelsVertical(*bitmapheight, *bitmapwidth, pixels);\n                    break;\n            }\n        } else {\n            if (origorientation > 4) {\n                uint32 buf = *bitmapwidth;\n                *bitmapwidth = *bitmapheight;\n                *bitmapheight = buf;\n                rotateRaster(pixels, 90, bitmapwidth, bitmapheight);\n                flipPixelsHorizontal(*bitmapwidth, *bitmapheight, pixels);\n            }\n        }\n\n        return pixels;\n}\n\njint * NativeDecoder::getSampledRasterFromTileWithBounds(int inSampleSize, int *bitmapwidth, int *bitmapheight) {\n\n        //init signal handler for catch SIGSEGV error that could be raised in libtiff\n        struct sigaction act;\n        memset(&act, 0, sizeof(act));\n        sigemptyset(&act.sa_mask);\n        act.sa_sigaction = tileErrorHandler;\n        act.sa_flags = SA_SIGINFO | SA_ONSTACK;\n        if(sigaction(SIGSEGV, &act, 0) < 0) {\n            LOGE(\"Can\\'t setup signal handler. Working without errors catching mechanism\");\n        }\n\n\n        //First read all tiles that are on necessary area\n\n        uint32 tileWidth = 0, tileHeight = 0;\n        TIFFGetField(image, TIFFTAG_TILEWIDTH, &tileWidth);\n        TIFFGetField(image, TIFFTAG_TILEWIDTH, &tileHeight);\n\n        //find first and last tile to process\n        uint32 firstTileX = (uint32)(boundX / tileWidth);\n        uint32 firstTileY = (uint32)(boundY / tileHeight);\n\n        uint32 lastTileX = (uint32)((boundX + boundWidth) / tileWidth) + 1;\n        uint32 lastTileY = (uint32)((boundY + boundHeight) / tileHeight) + 1;\n\n        jint *pixels = NULL;\n        *bitmapwidth = /*boundWidth*/ (lastTileX - firstTileX) * tileWidth / inSampleSize;//origwidth / inSampleSize;\n        *bitmapheight = /*boundHeight*/ (lastTileY - firstTileY) * tileHeight / inSampleSize;//origheight / inSampleSize;\n        uint32 pixelsBufferSize = *bitmapwidth * *bitmapheight;\n\n         unsigned long estimateMem = 0;\n         estimateMem += (sizeof(jint) * pixelsBufferSize); //buffer for decoded pixels\n         estimateMem += (tileWidth * tileHeight * sizeof(uint32)) * 3; //current, left and right tiles buffers\n         estimateMem += (tileWidth * sizeof(uint32)); //work line for rotate tile\n         LOGII(\"estimateMem\", estimateMem);\n         if (estimateMem > availableMemory) {\n            if (throwException) {\n                throw_not_enought_memory_exception(env, availableMemory, estimateMem);\n            }\n            return NULL;\n         }\n\n        pixels = (jint *) malloc(sizeof(jint) * pixelsBufferSize);\n        if (pixels == NULL) {\n            LOGE(\"Can\\'t allocate memory for temp buffer\");\n            return NULL;\n        }\n\n        progressTotal = pixelsBufferSize + (boundWidth/inSampleSize) * (boundHeight/inSampleSize);\n        sendProgress(0, progressTotal);\n        jlong processedProgress = 0;\n\n        uint32 row, column, rowDest, columnDest;\n\n        //main worker tile\n        uint32 *rasterTile = (uint32 *)_TIFFmalloc(tileWidth * tileHeight * sizeof(uint32));\n        //left tile\n        uint32 *rasterTileLeft = (uint32 *)_TIFFmalloc(tileWidth * tileHeight * sizeof(uint32));\n        //right tile\n        uint32 *rasterTileRight = (uint32 *)_TIFFmalloc(tileWidth * tileHeight * sizeof(uint32));\n\n        uint32 *work_line_buf = (uint32*)_TIFFmalloc(tileWidth * sizeof (uint32));\n\n        //check for error\n        if (setjmp(NativeDecoder::tile_buf)) {\n            if (rasterTile) {\n                _TIFFfree(rasterTile);\n                rasterTile = NULL;\n            }\n            if (rasterTileLeft) {\n                _TIFFfree(rasterTileLeft);\n                rasterTileLeft = NULL;\n            }\n            if (rasterTileRight) {\n                _TIFFfree(rasterTileRight);\n                rasterTileRight = NULL;\n            }\n            if (work_line_buf) {\n                _TIFFfree(work_line_buf);\n                work_line_buf = NULL;\n            }\n\n        const char * err = \"Caught SIGSEGV signal(Segmentation fault or invalid memory reference)\";\n        LOGE(err);\n        if (throwException) {\n            throwDecodeFileException(err);\n        }\n\n            return NULL;\n        }\n\n        //this variable calculate processed pixels for x and y direction to make right offsets at the begining of next tile\n        //offset calculated from condition globalProcessed % inSampleSize should be 0\n        uint32 globalProcessedX = 0;\n        uint32 globalProcessedY = 0;\n\n        uint32 progressRow = 0;\n        uint32 progressColumn = 0;\n\n        rowDest = columnDest = 0;\n        for (row = firstTileY * tileHeight; row < lastTileY * tileHeight; row += tileHeight, progressRow += tileHeight) {\n            columnDest = 0;\n            short leftTileExists = 0;\n            short rightTileExists = 0;\n            for (column = firstTileX * tileWidth; column < lastTileX * tileWidth; column += tileWidth, progressColumn += tileWidth) {\n                processedProgress = progressRow * *bitmapwidth + progressColumn;\n                sendProgress(processedProgress, progressTotal);\n\n                //If not first column - we should have previous tile - copy it to left tile buffer\n                if (column != firstTileY) {\n                    _TIFFmemcpy(rasterTileLeft, rasterTile, tileWidth * tileHeight * sizeof(uint32));\n                    leftTileExists = 1;\n                } else {\n                    leftTileExists = 0;\n                }\n                //if current column + tile width is less than origin width - we have right tile - copy it to current tile and read next tile to rasterTileRight buffer\n                if (column + tileWidth < origwidth && rightTileExists) {\n                    _TIFFmemcpy(rasterTile, rasterTileRight, tileWidth * tileHeight * sizeof(uint32));\n                    TIFFReadRGBATile(image, column + tileWidth, row, rasterTileRight);\n                    rightTileExists = 1;\n                } else if (column + tileWidth < origwidth) {\n                    //have right tile but this is first tile in row, so need to read raster and right raster\n                    TIFFReadRGBATile(image, column + tileWidth, row, rasterTileRight);\n                    TIFFReadRGBATile(image, column, row, rasterTile);\n                    rightTileExists = 1;\n\n                    //in that case we also need to invert lines in rasterTile\n                    switch(origorientation) {\n                        case 1:\n                        case 5:\n                            rotateTileLinesVertical(tileHeight, tileWidth, rasterTile, work_line_buf);\n                            break;\n                        case 2:\n                        case 6:\n                            rotateTileLinesVertical(tileHeight, tileWidth, rasterTile, work_line_buf);\n                            rotateTileLinesHorizontal(tileHeight, tileWidth, rasterTile, work_line_buf);\n                            break;\n                        case 3:\n                        case 7:\n                            rotateTileLinesHorizontal(tileHeight, tileWidth, rasterTile, work_line_buf);\n                            break;\n                    }\n                } else {\n                    //otherwise we haven't right tile buffer, so we should read tile to current buffer\n                    TIFFReadRGBATile(image, column, row, rasterTile);\n                    rightTileExists = 0;\n                }\n\n                //if we have right tile - current tile already rotated and we need to rotate only right tile\n                if (rightTileExists) {\n                    switch(origorientation) {\n                        case 1:\n                        case 5:\n                            rotateTileLinesVertical(tileHeight, tileWidth, rasterTileRight, work_line_buf);\n                            break;\n                        case 2:\n                        case 6:\n                            rotateTileLinesVertical(tileHeight, tileWidth, rasterTileRight, work_line_buf);\n                            rotateTileLinesHorizontal(tileHeight, tileWidth, rasterTileRight, work_line_buf);\n                            break;\n                        case 3:\n                        case 7:\n                            rotateTileLinesHorizontal(tileHeight, tileWidth, rasterTileRight, work_line_buf);\n                            break;\n                    }\n                } else {\n                    //otherwise - current tile not rotated so rotate it\n                    //tile orig is on bottom left - should change lines\n                     switch(origorientation) {\n                        case 1:\n                        case 5:\n                            rotateTileLinesVertical(tileHeight, tileWidth, rasterTile, work_line_buf);\n                            break;\n                        case 2:\n                        case 6:\n                            rotateTileLinesVertical(tileHeight, tileWidth, rasterTile, work_line_buf);\n                            rotateTileLinesHorizontal(tileHeight, tileWidth, rasterTile, work_line_buf);\n                            break;\n                        case 3:\n                        case 7:\n                            rotateTileLinesHorizontal(tileHeight, tileWidth, rasterTile, work_line_buf);\n                            break;\n                    }\n                }\n\n                    //Tile could begin from not filled pixel(pixel[x,y] == 0). This variables allow to calculate begining of filled pixels\n                    int tileStartDataX = -1;\n                    int tileStartDataY = -1;\n\n                    for (int origTileY = 0, pixY = rowDest/inSampleSize; origTileY < tileHeight && pixY < *bitmapheight; origTileY++) {\n                        if (checkStop()) {\n                            if (rasterTile) {\n                                _TIFFfree(rasterTile);\n                                rasterTile = NULL;\n                            }\n                            if (rasterTileLeft) {\n                                _TIFFfree(rasterTileLeft);\n                                rasterTileLeft = NULL;\n                            }\n                            if (rasterTileRight) {\n                                _TIFFfree(rasterTileRight);\n                                rasterTileRight = NULL;\n                            }\n                            if (work_line_buf) {\n                                _TIFFfree(work_line_buf);\n                                work_line_buf = NULL;\n                            }\n                            LOGI(\"Thread stopped\");\n                            return NULL;\n                        }\n\n                        if (tileStartDataY != -1 && globalProcessedY % inSampleSize != 0) {\n                            if (tileStartDataY != -1) {\n                                globalProcessedY++;\n                            }\n                        }\n                        else\n                        {\n\n                            for (int origTileX = 0, pixX = columnDest/inSampleSize; origTileX < tileWidth && pixX < *bitmapwidth; origTileX++) {\n\n\n                                if (tileStartDataX != -1 && globalProcessedX % inSampleSize != 0)\n                                {\n                                    if (tileStartDataX != -1) {\n                                        globalProcessedX++;\n                                    }\n                                }\n                                else\n                                {\n                                    uint32 srcPosition = origTileY * tileWidth + origTileX;\n                                    if (rasterTile[srcPosition] != 0) {\n\n                                        if (tileStartDataX == -1) {\n                                            tileStartDataX = origTileX;\n                                        }\n                                        if (tileStartDataY == -1) {\n                                            tileStartDataY = origTileY;\n                                        }\n\n                                        //Apply filter to pixel\n                                        jint crPix = rasterTile[srcPosition];//origBuffer[j1 * origwidth + i1];\n                                        int sum = 1;\n\n                                        int alpha = colorMask & crPix >> 24;\n                                        int red = colorMask & crPix >> 16;\n                                        int green = colorMask & crPix >> 8;\n                                        int blue = colorMask & crPix;\n\n                                        //using kernel 3x3\n\n                                        //topleft\n                                        if (origTileX - 1 >= 0 && origTileY - 1 >= 0) {\n                                            crPix = rasterTile[(origTileY - 1) * tileWidth + origTileX - 1];\n                                            if (crPix != 0) {\n                                                red += colorMask & crPix >> 16;\n                                                green += colorMask & crPix >> 8;\n                                                blue += colorMask & crPix;\n                                                alpha += colorMask & crPix >> 24;\n                                                sum++;\n                                            }\n                                        } else if (origTileY - 1 >= 0 && leftTileExists) {\n                                            crPix = rasterTileLeft[(origTileY - 1) * tileWidth + tileWidth - 1];\n                                            if (crPix != 0) {\n                                                red += colorMask & crPix >> 16;\n                                                green += colorMask & crPix >> 8;\n                                                blue += colorMask & crPix;\n                                                alpha += colorMask & crPix >> 24;\n                                                sum++;\n                                            }\n                                        }\n\n                                        //top\n                                        if (origTileY - 1 >= 0) {\n                                            crPix = rasterTile[(origTileY - 1) * tileWidth + origTileX];\n                                            if (crPix != 0) {\n                                                red += colorMask & crPix >> 16;\n                                                green += colorMask & crPix >> 8;\n                                                blue += colorMask & crPix;\n                                                alpha += colorMask & crPix >> 24;\n                                                sum++;\n                                            }\n                                        }\n\n                                        // topright\n                                        if (origTileX + 1 < tileWidth && origTileY - 1 >= 0) {\n                                            crPix = rasterTile[(origTileY - 1) * tileWidth + origTileX + 1];\n                                            if (crPix != 0) {\n                                                red += colorMask & crPix >> 16;\n                                                green += colorMask & crPix >> 8;\n                                                blue += colorMask & crPix;\n                                                alpha += colorMask & crPix >> 24;\n                                                sum++;\n                                            }\n                                        } else if (origTileY - 1 >= 0 && rightTileExists) {\n                                            crPix = rasterTileRight[(origTileY - 1) * tileWidth];\n                                            if (crPix != 0) {\n                                                red += colorMask & crPix >> 16;\n                                                green += colorMask & crPix >> 8;\n                                                blue += colorMask & crPix;\n                                                alpha += colorMask & crPix >> 24;\n                                                sum++;\n                                            }\n                                        }\n\n                                        //right\n                                        if (origTileX + 1 < tileWidth) {\n                                            crPix = rasterTile[origTileY * tileWidth + origTileX + 1];\n                                            if (crPix != 0) {\n                                                red += colorMask & crPix >> 16;\n                                                green += colorMask & crPix >> 8;\n                                                blue += colorMask & crPix;\n                                                alpha += colorMask & crPix >> 24;\n                                                sum++;\n                                            }\n                                        } else if (rightTileExists) {\n                                            crPix = rasterTileRight[origTileY * tileWidth];\n                                            if (crPix != 0) {\n                                                red += colorMask & crPix >> 16;\n                                                green += colorMask & crPix >> 8;\n                                                blue += colorMask & crPix;\n                                                alpha += colorMask & crPix >> 24;\n                                                sum++;\n                                            }\n                                        }\n\n                                        //bottomright\n                                        if (origTileX + 1 < tileWidth && origTileY + 1 < tileHeight) {\n                                            crPix = rasterTile[(origTileY + 1) * tileWidth + origTileX + 1];\n                                            if (crPix != 0) {\n                                                red += colorMask & crPix >> 16;\n                                                green += colorMask & crPix >> 8;\n                                                blue += colorMask & crPix;\n                                                alpha += colorMask & crPix >> 24;\n                                                sum++;\n                                            }\n                                        } else if (origTileY + 1 < tileHeight && rightTileExists) {\n                                            crPix = rasterTileRight[(origTileY + 1) * tileWidth];\n                                            if (crPix != 0) {\n                                                red += colorMask & crPix >> 16;\n                                                green += colorMask & crPix >> 8;\n                                                blue += colorMask & crPix;\n                                                alpha += colorMask & crPix >> 24;\n                                                sum++;\n                                            }\n                                        }\n\n                                        //bottom\n                                        if (origTileY + 1 < tileHeight) {\n                                            crPix = rasterTile[(origTileY + 1) * tileWidth + origTileX];\n                                            if (crPix != 0) {\n                                                red += colorMask & crPix >> 16;\n                                                green += colorMask & crPix >> 8;\n                                                blue += colorMask & crPix;\n                                                alpha += colorMask & crPix >> 24;\n                                                sum++;\n                                            }\n                                        }\n\n                                        //bottomleft\n                                        if (origTileX - 1 >= 0 && origTileY + 1 < tileHeight) {\n                                            crPix = rasterTile[(origTileY + 1) * tileWidth + origTileX - 1];\n                                            if (crPix != 0) {\n                                                red += colorMask & crPix >> 16;\n                                                green += colorMask & crPix >> 8;\n                                                blue += colorMask & crPix;\n                                                alpha += colorMask & crPix >> 24;\n                                                sum++;\n                                            }\n                                        } else if (origTileY + 1 < tileHeight && leftTileExists) {\n                                            crPix = rasterTileLeft[(origTileY + 1) * tileWidth + tileWidth - 1];\n                                            if (crPix != 0) {\n                                                red += colorMask & crPix >> 16;\n                                                green += colorMask & crPix >> 8;\n                                                blue += colorMask & crPix;\n                                                alpha += colorMask & crPix >> 24;\n                                                sum++;\n                                            }\n                                        }\n\n                                        //left\n                                        if (origTileX - 1 >= 0) {\n                                            crPix = rasterTile[origTileY * tileWidth + origTileX - 1];\n                                            if (crPix != 0) {\n                                                red += colorMask & crPix >> 16;\n                                                green += colorMask & crPix >> 8;\n                                                blue += colorMask & crPix;\n                                                alpha += colorMask & crPix >> 24;\n                                                sum++;\n                                            }\n                                        } else if (leftTileExists) {\n                                            crPix = rasterTileLeft[origTileY * tileWidth + tileWidth - 1];\n                                            if (crPix != 0) {\n                                                red += colorMask & crPix >> 16;\n                                                green += colorMask & crPix >> 8;\n                                                blue += colorMask & crPix;\n                                                alpha += colorMask & crPix >> 24;\n                                                sum++;\n                                            }\n                                        }\n\n                                        red /= sum;\n                                        if (red > 255) red = 255;\n                                        if (red < 0) red = 0;\n\n                                        green /= sum;\n                                        if (green > 255) green = 255;\n                                        if (green < 0) green = 0;\n\n                                        blue /= sum;\n                                        if (blue > 255) blue = 255;\n                                        if (blue < 0) blue = 0;\n\n                                        alpha /= sum;///= sum;\n                                        if (alpha > 255) alpha = 255;\n                                        if (alpha < 0) alpha = 0;\n\n                                        crPix = (alpha << 24) | (red << 16) | (green << 8) | (blue);\n\n                                        int position;\n                                        if (origorientation <= 4) {\n                                            position = pixY * *bitmapwidth + pixX;\n                                        } else {\n                                            position = pixX * *bitmapheight + pixY;\n                                        }\n                                        pixels[position] = crPix;\n                                    } else {\n                                        if (tileStartDataX != -1) tileStartDataX = -1;\n                                        if (tileStartDataY != -1) tileStartDataY = -1;\n                                    }\n\n                                    if (tileStartDataX != -1) {\n                                        pixX++;\n                                        globalProcessedX++;\n                                    }\n\n                                }\n                            }\n                            if (tileStartDataY != -1) {\n                                pixY++;\n                                globalProcessedY++;\n                            }\n                        }\n                    }\n                columnDest += tileWidth;\n            }\n            rowDest += tileHeight;\n        }\n\n        if (rasterTile) {\n            _TIFFfree(rasterTile);\n            rasterTile = NULL;\n        }\n        if (rasterTileLeft) {\n            _TIFFfree(rasterTileLeft);\n            rasterTileLeft = NULL;\n        }\n        if (rasterTileRight) {\n            _TIFFfree(rasterTileRight);\n            rasterTileRight = NULL;\n        }\n        if (work_line_buf) {\n            _TIFFfree(work_line_buf);\n            work_line_buf = NULL;\n        }\n\n        //Copy necessary pixels to new array if orientation <=4\n        uint32 tmpPixelBufferSize = (boundWidth / inSampleSize) * (boundHeight / inSampleSize);\n\n        estimateMem = (sizeof(jint) * pixelsBufferSize); //buffer for decoded pixels\n        estimateMem += (sizeof(jint) * tmpPixelBufferSize); //finall buffer\n        LOGII(\"estimateMem\", estimateMem);\n        if (estimateMem > availableMemory) {\n            if (throwException) {\n                throw_not_enought_memory_exception(env, availableMemory, estimateMem);\n            }\n            return NULL;\n        }\n\n        if (origorientation <= 4) {\n\n            jint* tmpPixels = (jint *) malloc(sizeof(jint) * tmpPixelBufferSize);\n            uint32 startPosX = boundX%tileWidth /inSampleSize;//(firstTileX * tileWidth - tileWidth + boundX) / inSampleSize;\n            uint32 startPosY = boundY%tileHeight /inSampleSize;//(firstTileY * tileHeight - tileHeight + boundY) /inSampleSize;\n            for (int ox = startPosX, nx = 0; nx < boundWidth/inSampleSize; ox++, nx++) {\n                sendProgress(processedProgress + nx * (boundHeight/inSampleSize), progressTotal);\n                for (int oy = startPosY, ny = 0; ny < boundHeight/inSampleSize; oy++, ny++) {\n                    tmpPixels[ny * (boundWidth/inSampleSize) + nx] = pixels[oy * *bitmapwidth + ox];\n                }\n            }\n\n            free(pixels);\n            pixels = tmpPixels;\n            *bitmapwidth = boundWidth/inSampleSize;\n            *bitmapheight = boundHeight/inSampleSize;\n        }\n\n        if (useOrientationTag) {\n            switch (origorientation) {\n                case ORIENTATION_TOPLEFT:\n                case ORIENTATION_LEFTTOP:\n                    break;\n                case ORIENTATION_TOPRIGHT:\n                    flipPixelsHorizontal(*bitmapwidth, *bitmapheight, pixels);\n                    break;\n                case ORIENTATION_RIGHTTOP:\n                    flipPixelsHorizontal(*bitmapheight, *bitmapwidth, pixels);\n                    break;\n                case ORIENTATION_BOTRIGHT:\n                case ORIENTATION_RIGHTBOT:\n                    rotateRaster(pixels, 180, bitmapwidth, bitmapheight);\n                    break;\n                case ORIENTATION_BOTLEFT:\n                    flipPixelsVertical(*bitmapwidth, *bitmapheight, pixels);\n                    break;\n                case ORIENTATION_LEFTBOT:\n                    flipPixelsVertical(*bitmapheight, *bitmapwidth, pixels);\n                    break;\n            }\n        } else {\n            if (origorientation > 4) {\n                uint32 buf = *bitmapwidth;\n                *bitmapwidth = *bitmapheight;\n                *bitmapheight = buf;\n                rotateRaster(pixels, 90, bitmapwidth, bitmapheight);\n                flipPixelsHorizontal(*bitmapwidth, *bitmapheight, pixels);\n            }\n        }\n\n        //Copy necessary pixels to new array if orientation >4\n        if (origorientation > 4) {\n            jint* tmpPixels = (jint *) malloc(sizeof(jint) * tmpPixelBufferSize);\n            uint32 startPosX = boundX%tileWidth /inSampleSize;\n            uint32 startPosY = boundY%tileHeight /inSampleSize;\n            for (int ox = startPosX, nx = 0; nx < boundWidth/inSampleSize; ox++, nx++) {\n                sendProgress(processedProgress + nx * (boundHeight/inSampleSize), progressTotal);\n                for (int oy = startPosY, ny = 0; ny < boundHeight/inSampleSize; oy++, ny++) {\n                    if (useOrientationTag) {\n                        tmpPixels[nx * (boundHeight/inSampleSize) + ny] = pixels[ox * *bitmapheight + oy];\n                    } else {\n                        tmpPixels[ny * (boundWidth/inSampleSize) + nx] = pixels[oy * *bitmapwidth + ox];\n                    }\n                }\n            }\n\n            free(pixels);\n            pixels = tmpPixels;\n            *bitmapwidth = boundWidth/inSampleSize;\n            *bitmapheight = boundHeight/inSampleSize;\n        }\n\n        return pixels;\n}\n\n\n\njint * NativeDecoder::getSampledRasterFromImage(int inSampleSize, int *bitmapwidth, int *bitmapheight)\n{\n    //init signal handler for catch SIGSEGV error that could be raised in libtiff\n    struct sigaction act;\n    memset(&act, 0, sizeof(act));\n    sigemptyset(&act.sa_mask);\n    act.sa_sigaction = imageErrorHandler;\n    act.sa_flags = SA_SIGINFO | SA_ONSTACK;\n    if(sigaction(SIGSEGV, &act, 0) < 0) {\n        LOGE(\"Can\\'t setup signal handler. Working without errors catching mechanism\");\n    }\n\n    //buffer size for decoding tiff image in RGBA format\n    int origBufferSize = origwidth * origheight * sizeof(unsigned int);\n\n    *bitmapwidth = origwidth / inSampleSize;\n    *bitmapheight = origheight / inSampleSize;\n    //buffer size for creating scaled image;\n    uint32 pixelsBufferSize = *bitmapwidth * *bitmapheight * sizeof(jint);\n\n    /**Estimate usage of memory for decoding*/\n    unsigned long estimateMem = origBufferSize;//origBufferSize - size of decoded RGBA image\n    if (inSampleSize > 1) {\n        estimateMem += pixelsBufferSize; //if inSmapleSize greater than 1 we need aditional vevory for scaled image\n    }\n    LOGII(\"estimateMem\", estimateMem);\n\n    if (estimateMem > availableMemory) {\n        if (throwException) {\n            throw_not_enought_memory_exception(env, availableMemory, estimateMem);\n        }\n        return NULL;\n    }\n\n    unsigned int *origBuffer = NULL;\n\n    origBuffer = (unsigned int *) _TIFFmalloc(origBufferSize);\n    if (origBuffer == NULL) {\n        LOGE(\"Can\\'t allocate memory for origBuffer\");\n        return NULL;\n    }\n\n    jint *pixels = NULL;\n\n    //check for error\n    if (setjmp(NativeDecoder::image_buf)) {\n        if (origBuffer) {\n            _TIFFfree(origBuffer);\n            origBuffer = NULL;\n        }\n        if (pixels) {\n            free(pixels);\n            pixels = NULL;\n        }\n\n        const char * err = \"Caught SIGSEGV signal(Segmentation fault or invalid memory reference)\";\n        LOGE(err);\n        if (throwException) {\n            throwDecodeFileException(err);\n        }\n\n        return NULL;\n    }\n\n\n\tif (0 ==\n        TIFFReadRGBAImageOriented(image, origwidth, origheight, origBuffer, ORIENTATION_TOPLEFT, 0)) {\n\t    free(origBuffer);\n\t    const char *message = \"Error reading image\";\n        LOGE(*message);\n        if (throwException) {\n            throwDecodeFileException(message);\n        }\n        return NULL;\n    }\n\n    if (inSampleSize == 1) {\n        // Use buffer as is.\n        pixels = (jint*) origBuffer;\n    }\n    else {\n        // Sample the buffer.\n        pixels = (jint *) malloc(pixelsBufferSize);\n        if (pixels == NULL) {\n            LOGE(\"Can\\'t allocate memory for temp buffer\");\n            return NULL;\n        }\n        else {\n            for (int j = 0, j1 = 0; j < *bitmapheight; j++, j1 += inSampleSize) {\n\n                sendProgress(j1 * origwidth, progressTotal);\n\n                if (checkStop()) {\n                    //TODO clear memory\n                    if (origBuffer) {\n                        _TIFFfree(origBuffer);\n                        origBuffer = NULL;\n                    }\n                    if (pixels) {\n                        free(pixels);\n                        pixels = NULL;\n                    }\n                    LOGI(\"Thread stopped\");\n                    return NULL;\n                }\n\n                for (int i = 0, i1 = 0; i < *bitmapwidth; i++, i1 += inSampleSize) {\n                    //Apply filter to pixel\n                    jint crPix = origBuffer[j1 * origwidth + i1];\n                    int sum = 1;\n\n                    int alpha = colorMask & crPix >> 24;\n                    int red = colorMask & crPix >> 16;\n                    int green = colorMask & crPix >> 8;\n                    int blue = colorMask & crPix;\n\n                    //using kernel 3x3\n\n                    //topleft\n                    if (i1 - 1 >= 0 && j1 - 1 >= 0) {\n                        crPix = origBuffer[(j1 - 1) * origwidth + i1 - 1];\n                        red += colorMask & crPix >> 16;\n                        green += colorMask & crPix >> 8;\n                        blue += colorMask & crPix;\n                        alpha += colorMask & crPix >> 24;\n                        sum++;\n                    }\n                    //top\n                    if (j1 - 1 >= 0) {\n                        crPix = origBuffer[(j1 - 1) * origwidth + i1];\n                        red += colorMask & crPix >> 16;\n                        green += colorMask & crPix >> 8;\n                        blue += colorMask & crPix;\n                        alpha += colorMask & crPix >> 24;\n                        sum++;\n                    }\n                    // topright\n                    if (i1 + 1 < origwidth && j1 - 1 >= 0) {\n                        crPix = origBuffer[(j1 - 1) * origwidth + i1 + 1];\n                        red += colorMask & crPix >> 16;\n                        green += colorMask & crPix >> 8;\n                        blue += colorMask & crPix;\n                        alpha += colorMask & crPix >> 24;\n                        sum++;\n                    }\n                    //right\n                    if (i1 + 1 < origwidth) {\n                        crPix = origBuffer[j1 * origwidth + i1 + 1];\n                        red += colorMask & crPix >> 16;\n                        green += colorMask & crPix >> 8;\n                        blue += colorMask & crPix;\n                        alpha += colorMask & crPix >> 24;\n                        sum++;\n                    }\n                    //bottomright\n                    if (i1 + 1 < origwidth && j1 + 1 < origheight) {\n                        crPix = origBuffer[(j1 + 1) * origwidth + i1 + 1];\n                        red += colorMask & crPix >> 16;\n                        green += colorMask & crPix >> 8;\n                        blue += colorMask & crPix;\n                        alpha += colorMask & crPix >> 24;\n                        sum++;\n                    }\n                    //bottom\n                    if (j1 + 1 < origheight) {\n                        crPix = origBuffer[(j1 + 1) * origwidth + i1 + 1];\n                        red += colorMask & crPix >> 16;\n                        green += colorMask & crPix >> 8;\n                        blue += colorMask & crPix;\n                        alpha += colorMask & crPix >> 24;\n                        sum++;\n                    }\n                    //bottomleft\n                    if (i1 - 1 >= 0 && j1 + 1 < origheight) {\n                        crPix = origBuffer[(j1 + 1) * origwidth + i1 - 1];\n                        red += colorMask & crPix >> 16;\n                        green += colorMask & crPix >> 8;\n                        blue += colorMask & crPix;\n                        alpha += colorMask & crPix >> 24;\n                        sum++;\n                    }\n                    //left\n                    if (i1 - 1 >= 0) {\n                        crPix = origBuffer[j1 * origwidth + i1 - 1];\n                        red += colorMask & crPix >> 16;\n                        green += colorMask & crPix >> 8;\n                        blue += colorMask & crPix;\n                        alpha += colorMask & crPix >> 24;\n                        sum++;\n                    }\n\n                    red /= sum;\n                    if (red > 255) red = 255;\n                    if (red < 0) red = 0;\n\n                    green /= sum;\n                    if (green > 255) green = 255;\n                    if (green < 0) green = 0;\n\n                    blue /= sum;\n                    if (blue > 255) blue = 255;\n                    if (blue < 0) blue = 0;\n\n                    alpha /= sum;///= sum;\n                    if (alpha > 255) alpha = 255;\n                    if (alpha < 0) alpha = 0;\n\n                    crPix = (alpha << 24) | (red << 16) | (green << 8) | (blue);\n\n                    pixels[j * *bitmapwidth + i] = crPix;\n                }\n            }\n        }\n\n        //Close Buffer\n        if (origBuffer) {\n            _TIFFfree(origBuffer);\n            origBuffer = NULL;\n        }\n    }\n\n    if (useOrientationTag) {\n        fixOrientation(pixels, pixelsBufferSize, *bitmapwidth, *bitmapheight);\n    } else {\n        uint32 buf;\n        switch(origorientation) {\n                         case ORIENTATION_TOPLEFT:\n                         case ORIENTATION_LEFTTOP:\n                            break;\n                         case ORIENTATION_TOPRIGHT:\n                         case ORIENTATION_RIGHTTOP:\n                            flipPixelsHorizontal(*bitmapwidth, *bitmapheight, pixels);\n                            break;\n                         case ORIENTATION_BOTRIGHT:\n                         case ORIENTATION_RIGHTBOT:\n                            rotateRaster(pixels, 180, bitmapwidth, bitmapheight);\n                            break;\n                         case ORIENTATION_BOTLEFT:\n                         case ORIENTATION_LEFTBOT:\n                            rotateRaster(pixels, 180, bitmapwidth, bitmapheight);\n                            flipPixelsHorizontal(*bitmapwidth, *bitmapheight, pixels);\n                            break;\n                         }\n    }\n\n    return pixels;\n}\n\njint * NativeDecoder::getSampledRasterFromImageWithBounds(int inSampleSize, int *bitmapwidth, int *bitmapheight)\n{\n    //init signal handler for catch SIGSEGV error that could be raised in libtiff\n    struct sigaction act;\n    memset(&act, 0, sizeof(act));\n    sigemptyset(&act.sa_mask);\n    act.sa_sigaction = imageErrorHandler;\n    act.sa_flags = SA_SIGINFO | SA_ONSTACK;\n    if(sigaction(SIGSEGV, &act, 0) < 0) {\n        LOGE(\"Can\\'t setup signal handler. Working without errors catching mechanism\");\n    }\n\n    //buffer size for decoding tiff image in RGBA format\n    int origBufferSize = origwidth * origheight * sizeof(unsigned int);\n\n    *bitmapwidth = boundWidth / inSampleSize;//origwidth / inSampleSize;\n    *bitmapheight = boundHeight / inSampleSize;//origheight / inSampleSize;\n    //buffer size for creating scaled image;\n    uint32 pixelsBufferSize = *bitmapwidth * *bitmapheight * sizeof(jint);\n\n    /**Estimate usage of memory for decoding*/\n    unsigned long estimateMem = origBufferSize;//origBufferSize - size of decoded RGBA image\n    //if (inSampleSize > 1) {\n        estimateMem += pixelsBufferSize; //if inSmapleSize greater than 1 we need aditional vevory for scaled image\n    //}\n    LOGII(\"estimateMem\", estimateMem);\n\n    if (estimateMem > availableMemory) {\n        if (throwException) {\n            throw_not_enought_memory_exception(env, availableMemory, estimateMem);\n        }\n        return NULL;\n    }\n\n    unsigned int *origBuffer = NULL;\n    jint *pixels = NULL;\n\n    //check for error\n    if (setjmp(NativeDecoder::image_buf)) {\n        if (origBuffer) {\n            _TIFFfree(origBuffer);\n            origBuffer = NULL;\n        }\n        if (pixels) {\n            free(pixels);\n            pixels = NULL;\n        }\n\n        const char * err = \"Caught SIGSEGV signal(Segmentation fault or invalid memory reference)\";\n        LOGE(err);\n        if (throwException) {\n            throwDecodeFileException(err);\n        }\n\n        return NULL;\n    }\n\n    origBuffer = (unsigned int *) _TIFFmalloc(origBufferSize);\n    if (origBuffer == NULL) {\n        LOGE(\"Can\\'t allocate memory for origBuffer\");\n        return NULL;\n    }\n\n\tif (0 ==\n        TIFFReadRGBAImageOriented(image, origwidth, origheight, origBuffer, ORIENTATION_TOPLEFT, 0)) {\n\t    free(origBuffer);\n\t    const char *message = \"Error reading image\";\n        LOGE(*message);\n        if (throwException) {\n            throwDecodeFileException(message);\n        }\n        return NULL;\n    }\n\n    progressTotal = boundWidth/inSampleSize * boundHeight/inSampleSize;\n\n    // Sample the buffer.\n    pixels = (jint *) malloc(pixelsBufferSize);\n    if (pixels == NULL) {\n        LOGE(\"Can\\'t allocate memory for temp buffer\");\n        return NULL;\n    } else {\n        for (int y = 0, y1 = boundY; y < *bitmapheight; y++, y1 += inSampleSize) {\n\n            sendProgress(y1 * boundWidth, progressTotal);\n\n                if (checkStop()) {\n                    //TODO clear memory\n                    if (origBuffer) {\n                        _TIFFfree(origBuffer);\n                        origBuffer = NULL;\n                    }\n                    if (pixels) {\n                        free(pixels);\n                        pixels = NULL;\n                    }\n                    LOGI(\"Thread stopped\");\n                    return NULL;\n                }\n\n                for (int x = 0, x1 = boundX; x < *bitmapwidth; x++, x1 += inSampleSize) {\n                    //Apply filter to pixel\n                    jint crPix = origBuffer[y1 * origwidth + x1];\n                    int sum = 1;\n\n                    int alpha = colorMask & crPix >> 24;\n                    int red = colorMask & crPix >> 16;\n                    int green = colorMask & crPix >> 8;\n                    int blue = colorMask & crPix;\n\n                    //using kernel 3x3\n\n                    //topleft\n                    if (x1 - 1 >= 0 && y1 - 1 >= 0) {\n                        crPix = origBuffer[(y1 - 1) * origwidth + x1 - 1];\n                        red += colorMask & crPix >> 16;\n                        green += colorMask & crPix >> 8;\n                        blue += colorMask & crPix;\n                        alpha += colorMask & crPix >> 24;\n                        sum++;\n                    }\n                    //top\n                    if (y1 - 1 >= 0) {\n                        crPix = origBuffer[(y1 - 1) * origwidth + x1];\n                        red += colorMask & crPix >> 16;\n                        green += colorMask & crPix >> 8;\n                        blue += colorMask & crPix;\n                        alpha += colorMask & crPix >> 24;\n                        sum++;\n                    }\n                    // topright\n                    if (x1 + 1 < origwidth && y1 - 1 >= 0) {\n                        crPix = origBuffer[(y1 - 1) * origwidth + x1 + 1];\n                        red += colorMask & crPix >> 16;\n                        green += colorMask & crPix >> 8;\n                        blue += colorMask & crPix;\n                        alpha += colorMask & crPix >> 24;\n                        sum++;\n                    }\n                    //right\n                    if (x1 + 1 < origwidth) {\n                        crPix = origBuffer[y1 * origwidth + x1 + 1];\n                        red += colorMask & crPix >> 16;\n                        green += colorMask & crPix >> 8;\n                        blue += colorMask & crPix;\n                        alpha += colorMask & crPix >> 24;\n                        sum++;\n                    }\n                    //bottomright\n                    if (x1 + 1 < origwidth && y1 + 1 < origheight) {\n                        crPix = origBuffer[(y1 + 1) * origwidth + x1 + 1];\n                        red += colorMask & crPix >> 16;\n                        green += colorMask & crPix >> 8;\n                        blue += colorMask & crPix;\n                        alpha += colorMask & crPix >> 24;\n                        sum++;\n                    }\n                    //bottom\n                    if (y1 + 1 < origheight) {\n                        crPix = origBuffer[(y1 + 1) * origwidth + x1 + 1];\n                        red += colorMask & crPix >> 16;\n                        green += colorMask & crPix >> 8;\n                        blue += colorMask & crPix;\n                        alpha += colorMask & crPix >> 24;\n                        sum++;\n                    }\n                    //bottomleft\n                    if (x1 - 1 >= 0 && y1 + 1 < origheight) {\n                        crPix = origBuffer[(y1 + 1) * origwidth + x1 - 1];\n                        red += colorMask & crPix >> 16;\n                        green += colorMask & crPix >> 8;\n                        blue += colorMask & crPix;\n                        alpha += colorMask & crPix >> 24;\n                        sum++;\n                    }\n                    //left\n                    if (x1 - 1 >= 0) {\n                        crPix = origBuffer[y1 * origwidth + x1 - 1];\n                        red += colorMask & crPix >> 16;\n                        green += colorMask & crPix >> 8;\n                        blue += colorMask & crPix;\n                        alpha += colorMask & crPix >> 24;\n                        sum++;\n                    }\n\n                    red /= sum;\n                    if (red > 255) red = 255;\n                    if (red < 0) red = 0;\n\n                    green /= sum;\n                    if (green > 255) green = 255;\n                    if (green < 0) green = 0;\n\n                    blue /= sum;\n                    if (blue > 255) blue = 255;\n                    if (blue < 0) blue = 0;\n\n                    alpha /= sum;///= sum;\n                    if (alpha > 255) alpha = 255;\n                    if (alpha < 0) alpha = 0;\n\n                    crPix = (alpha << 24) | (red << 16) | (green << 8) | (blue);\n\n                    pixels[y * *bitmapwidth + x] = crPix;\n                }\n            }\n    }\n\n        //Close Buffer\n        if (origBuffer) {\n            _TIFFfree(origBuffer);\n            origBuffer = NULL;\n        }\n\n\n    if (useOrientationTag) {\n        fixOrientation(pixels, pixelsBufferSize, *bitmapwidth, *bitmapheight);\n    } else {\n        uint32 buf;\n        switch(origorientation) {\n                         case ORIENTATION_TOPLEFT:\n                         case ORIENTATION_LEFTTOP:\n                            break;\n                         case ORIENTATION_TOPRIGHT:\n                         case ORIENTATION_RIGHTTOP:\n                            flipPixelsHorizontal(*bitmapwidth, *bitmapheight, pixels);\n                            break;\n                         case ORIENTATION_BOTRIGHT:\n                         case ORIENTATION_RIGHTBOT:\n                            rotateRaster(pixels, 180, bitmapwidth, bitmapheight);\n                            break;\n                         case ORIENTATION_BOTLEFT:\n                         case ORIENTATION_LEFTBOT:\n                            rotateRaster(pixels, 180, bitmapwidth, bitmapheight);\n                            flipPixelsHorizontal(*bitmapwidth, *bitmapheight, pixels);\n                            break;\n                         }\n    }\n\n    return pixels;\n}\n\nint NativeDecoder::getDecodeMethod()\n{\n\tint method = -1;\n\tuint32 tileWidth, tileHeight;\n\tint readTW = 0, readTH = 0;\n    readTW = TIFFGetField(image, TIFFTAG_TILEWIDTH, &tileWidth);\n    readTH = TIFFGetField(image, TIFFTAG_TILELENGTH, &tileHeight);\n    if (tileWidth > 0 && tileHeight > 0 && readTH > 0 && readTW > 0) {\n        method = DECODE_METHOD_TILE;\n    } else {\n        int rowPerStrip = -1;\n    \tTIFFGetField(image, TIFFTAG_ROWSPERSTRIP, &rowPerStrip);\n    \tuint32 stripSize = TIFFStripSize (image);\n    \tuint32 stripMax = TIFFNumberOfStrips (image);\n    \tint estimate = origwidth * 3;\n    \tLOGII(\"RPS\", rowPerStrip);\n    \tLOGII(\"stripSize\", stripSize);\n    \tLOGII(\"stripMax\", stripMax);\n    \tif (rowPerStrip != -1 && stripSize > 0 && stripMax > 1 && rowPerStrip < origheight) {\n    \t    method = DECODE_METHOD_STRIP;\n    \t} else {\n    \tmethod = DECODE_METHOD_IMAGE;\n    \t}\n    }\n\n\tLOGII(\"Decode method\", method);\n\treturn method;\n}\n\nvoid NativeDecoder::flipPixelsVertical(uint32 width, uint32 height, jint* raster) {\n    jint *bufferLine = (jint *) malloc(sizeof(jint) * width);\n    for (int line = 0; line < height / 2; line++) {\n        jint  *top_line, *bottom_line;\n        top_line = raster + width * line;\n        bottom_line = raster + width * (height - line -1);\n        _TIFFmemcpy(bufferLine, top_line, sizeof(jint) * width);\n        _TIFFmemcpy(top_line, bottom_line, sizeof(jint) * width);\n        _TIFFmemcpy(bottom_line, bufferLine, sizeof(jint) * width);\n    }\n    free(bufferLine);\n}\n\nvoid NativeDecoder::flipPixelsHorizontal(uint32 width, uint32 height, jint* raster) {\n    jint buf;\n    for (int y = 0; y < height; y++) {\n        for (int x = 0; x < width / 2; x++) {\n            buf = raster[y * width + x];\n            raster[y * width + x] = raster[y * width + width - x - 1];\n            raster[y * width + width - x - 1] = buf;\n        }\n    }\n}\n\nvoid NativeDecoder::rotateRaster(jint *raster, int angle, int *width, int *height)\n        {\n            int rotatedWidth = *width;\n            int rotatedHeight = *height;\n            int numberOf90s = angle / 90;\n            if (numberOf90s % 2 != 0)\n            {\n                int tmp = rotatedWidth;\n                rotatedWidth = rotatedHeight;\n                rotatedHeight = tmp;\n            }\n\n            jint *rotated = (jint *) malloc(sizeof(jint) * rotatedWidth * rotatedHeight);//new int[rotatedWidth * rotatedHeight];\n\n            for (int h = 0; h < *height; ++h)\n            {\n                for (int w = 0; w < *width; ++w)\n                {\n                    uint32 item = raster[h * *width + w];\n                    int x = 0;\n                    int y = 0;\n                    switch (numberOf90s % 4)\n                    {\n                        case 0:\n                            x = w;\n                            y = h;\n                            break;\n                        case 1:\n                            x = (*height - h - 1);\n                            y = (rotatedHeight - 1) - (*width - w - 1);\n                            break;\n                        case 2:\n                            x = (*width - w - 1);\n                            y = (*height - h - 1);\n                            break;\n                        case 3:\n                            x = (rotatedWidth - 1) - (*height - h - 1);\n                            y = (*width - w - 1);\n                            break;\n                    }\n\n                    rotated[y * rotatedWidth + x] = item;\n                }\n            }\n\n            *width = rotatedWidth;\n            *height = rotatedHeight;\n\n            memcpy(raster, rotated, sizeof(jint) * *width * *height);\n\n            free(rotated);\n\n        }\n\nvoid NativeDecoder::fixOrientation(jint *pixels, uint32 pixelsBufferSize, int bitmapwidth, int bitmapheight)\n{\n\tif (origorientation > 4) {\n        unsigned int size = bitmapheight * bitmapwidth - 1;\n        jint t;\n        unsigned long long next;\n        unsigned long long cycleBegin;\n        bool *barray = (bool *) malloc(sizeof(bool) * pixelsBufferSize);\n\tfor (int x = 0; x < size; x++) { barray[x] = false; }\n        barray[0] = barray[size] = true;\n        unsigned long long k = 1;\n\n        switch (origorientation) {\n            case ORIENTATION_LEFTTOP:\n            case ORIENTATION_RIGHTBOT:\n                while (k < size) {\n                    cycleBegin = k;\n                    t = pixels[k];\n                    do {\n                        next = (k * bitmapheight) % size;\n                        jint buf = pixels[next];\n                        pixels[next] = t;\n                        t = buf;\n                        barray[k] = true;\n                        k = next;\n                    } while (k != cycleBegin);\n                    for (k = 1; k < size && barray[k]; k++);\n                }\n                break;\n            case ORIENTATION_LEFTBOT:\n            case ORIENTATION_RIGHTTOP:\n                while (k < size) {\n                    cycleBegin = k;\n                    t = pixels[k];\n                    do {\n                        next = (k * bitmapheight) % size;\n                        jint buf = pixels[next];\n                        pixels[next] = t;\n                        t = buf;\n                        barray[k] = true;\n                        k = next;\n                    } while (k != cycleBegin);\n                    for (k = 1; k < size && barray[k]; k++);\n                }\n                //flip horizontally\n                for (int j = 0, j1 = bitmapwidth - 1; j < bitmapwidth / 2; j++, j1--) {\n                    for (int i = 0; i < bitmapheight; i++) {\n                        jint tmp = pixels[j * bitmapheight + i];\n                        pixels[j * bitmapheight + i] = pixels[j1 * bitmapheight + i];\n                        pixels[j1 * bitmapheight + i] = tmp;\n                    }\n                }\n                //flip vertically\n                for (int i = 0, i1 = bitmapheight - 1; i < bitmapheight / 2; i++, i1--) {\n                    for (int j = 0; j < bitmapwidth; j++) {\n                        jint tmp = pixels[j * bitmapheight + i];\n                        pixels[j * bitmapheight + i] = pixels[j * bitmapheight + i1];\n                        pixels[j * bitmapheight + i1] = tmp;\n                    }\n                }\n                break;\n        }\n        free(barray);\n    }\n}\n\njbyte * NativeDecoder::createBitmapAlpha8(jint *raster, int bitmapwidth, int bitmapheight)\n{\n    jbyte *pixels = NULL;\n\tint pixelsBufferSize = bitmapwidth * bitmapheight;\n\tpixels = (jbyte *) malloc(sizeof(jbyte) * pixelsBufferSize);\n    if (pixels == NULL) {\n        LOGE(\"Can\\'t allocate memory for temp buffer\");\n        return NULL;\n    }\n\n\tfor (int i = 0; i < bitmapwidth; i++) {\n\n\t    if (checkStop()) {\n            if (pixels) {\n                free(pixels);\n                pixels = NULL;\n            }\n            LOGI(\"Thread stopped\");\n            return NULL;\n        }\n    \t\tfor (int j = 0; j < bitmapheight; j++) {\n    \t\t\tuint32 crPix = raster[j * bitmapwidth + i];\n    \t\t\tint alpha = colorMask & crPix >> 24;\n    \t\t\tpixels[j * bitmapwidth + i] = alpha;\n    \t\t}\n    \t}\n\n    \t//Close Buffer\n        if (raster) {\n            _TIFFfree(raster);\n            raster = NULL;\n        }\n\n\treturn pixels;\n}\n\nunsigned short * NativeDecoder::createBitmapRGB565(jint *buffer, int bitmapwidth, int bitmapheight)\n{\n    unsigned short *pixels = NULL;\n\tint pixelsBufferSize = bitmapwidth * bitmapheight;\n\tpixels = (unsigned short *) malloc(sizeof(unsigned short) * pixelsBufferSize);\n    if (pixels == NULL) {\n        LOGE(\"Can\\'t allocate memory for temp buffer\");\n        return NULL;\n    }\n\n    for (int i = 0; i < bitmapwidth; i++) {\n\n        if (checkStop()) {\n            if (pixels) {\n                free(pixels);\n                pixels = NULL;\n            }\n            LOGI(\"Thread stopped\");\n            return NULL;\n        }\n\n\t\tfor (int j = 0; j < bitmapheight; j++) {\n\n\n\t\t\tjint crPix = buffer[j * bitmapwidth + i];\n\t\t\tint blue = colorMask & crPix >> 16;\n            int green = colorMask & crPix >> 8;\n            int red = colorMask & crPix;\n\n            unsigned char B = (blue >> 3);\n            unsigned char G = (green >> 2);\n            unsigned char R = (red >> 3);\n\n            jint curPix = (R << 11) | (G << 5) | B;\n\n\t\t\tpixels[j * bitmapwidth + i] = curPix;\n\t\t}\n\t}\n\n\t//Close Buffer\n    if (buffer) {\n        _TIFFfree(buffer);\n        buffer = NULL;\n    }\n    return pixels;\n}\n\nint NativeDecoder::getDyrectoryCount()\n{\n    int dircount = 0;\n    do {\n        dircount++;\n    } while (TIFFReadDirectory(image));\n    return dircount;\n}\n\nvoid NativeDecoder::writeDataToOptions(int directoryNumber)\n{\n    TIFFSetDirectory(image, directoryNumber);\n        jfieldID gOptions_outDirectoryCountFieldId = env->GetFieldID(jBitmapOptionsClass,\n            \"outDirectoryCount\", \"I\");\n        int dircount = getDyrectoryCount();\n        env->SetIntField(optionsObject, gOptions_outDirectoryCountFieldId, dircount);\n\n        TIFFSetDirectory(image, directoryNumber);\n        TIFFGetField(image, TIFFTAG_IMAGEWIDTH, & origwidth);\n        TIFFGetField(image, TIFFTAG_IMAGELENGTH, & origheight);\n\n        //Getting image orientation and createing ImageOrientation enum\n        TIFFGetField(image, TIFFTAG_ORIENTATION, & origorientation);\n        //If orientation field is empty - use ORIENTATION_TOPLEFT\n        if (origorientation == 0) {\n            origorientation = ORIENTATION_TOPLEFT;\n        }\n        jclass gOptions_ImageOrientationClass = env->FindClass(\n            \"org/beyka/tiffbitmapfactory/Orientation\");\n        jfieldID gOptions_ImageOrientationFieldId = NULL;\n        bool flipHW = false;\n        LOGII(\"Orientation\", origorientation);\n        switch (origorientation) {\n            case ORIENTATION_TOPLEFT:\n                gOptions_ImageOrientationFieldId = env->GetStaticFieldID(gOptions_ImageOrientationClass,\n                    \"TOP_LEFT\",\n                    \"Lorg/beyka/tiffbitmapfactory/Orientation;\");\n                break;\n            case ORIENTATION_TOPRIGHT:\n                gOptions_ImageOrientationFieldId = env->GetStaticFieldID(gOptions_ImageOrientationClass,\n                    \"TOP_RIGHT\",\n                    \"Lorg/beyka/tiffbitmapfactory/Orientation;\");\n                break;\n            case ORIENTATION_BOTRIGHT:\n                gOptions_ImageOrientationFieldId = env->GetStaticFieldID(gOptions_ImageOrientationClass,\n                    \"BOT_RIGHT\",\n                    \"Lorg/beyka/tiffbitmapfactory/Orientation;\");\n                break;\n            case ORIENTATION_BOTLEFT:\n                gOptions_ImageOrientationFieldId = env->GetStaticFieldID(gOptions_ImageOrientationClass,\n                    \"BOT_LEFT\",\n                    \"Lorg/beyka/tiffbitmapfactory/Orientation;\");\n                break;\n            case ORIENTATION_LEFTTOP:\n                flipHW = true;\n                gOptions_ImageOrientationFieldId = env->GetStaticFieldID(gOptions_ImageOrientationClass,\n                    \"LEFT_TOP\",\n                    \"Lorg/beyka/tiffbitmapfactory/Orientation;\");\n                break;\n            case ORIENTATION_RIGHTTOP:\n                flipHW = true;\n                gOptions_ImageOrientationFieldId = env->GetStaticFieldID(gOptions_ImageOrientationClass,\n                    \"RIGHT_TOP\",\n                    \"Lorg/beyka/tiffbitmapfactory/Orientation;\");\n                break;\n            case ORIENTATION_RIGHTBOT:\n                flipHW = true;\n                gOptions_ImageOrientationFieldId = env->GetStaticFieldID(gOptions_ImageOrientationClass,\n                    \"RIGHT_BOT\",\n                    \"Lorg/beyka/tiffbitmapfactory/Orientation;\");\n                break;\n            case ORIENTATION_LEFTBOT:\n                flipHW = true;\n                gOptions_ImageOrientationFieldId = env->GetStaticFieldID(gOptions_ImageOrientationClass,\n                    \"LEFT_BOT\",\n                    \"Lorg/beyka/tiffbitmapfactory/Orientation;\");\n                break;\n        }\n        if (gOptions_ImageOrientationFieldId != NULL) {\n            jobject gOptions_ImageOrientationObj = env->GetStaticObjectField(\n                gOptions_ImageOrientationClass,\n                gOptions_ImageOrientationFieldId);\n\n            //Set outImageOrientation field to options object\n            jfieldID gOptions_outImageOrientationField = env->GetFieldID(jBitmapOptionsClass,\n                \"outImageOrientation\",\n                \"Lorg/beyka/tiffbitmapfactory/Orientation;\");\n            env->SetObjectField(optionsObject, gOptions_outImageOrientationField,\n                gOptions_ImageOrientationObj);\n        }\n\n        //Get resolution variables\n        /*\n        jfieldID gOptions_outDirectoryCountFieldId = env->GetFieldID(jOptionsClass,\n                    \"outDirectoryCount\", \"I\");\n                int dircount = getDyrectoryCount();\n                env->SetIntField(optionsObject, gOptions_outDirectoryCountFieldId, dircount);\n        */\n        float xresolution, yresolution;\n        uint16 resunit;\n        TIFFGetField(image, TIFFTAG_XRESOLUTION, &xresolution);\n        LOGIF(\"xres\", xresolution);\n        jfieldID gOptions_outXResolutionFieldID = env->GetFieldID(jBitmapOptionsClass, \"outXResolution\", \"F\");\n        env->SetFloatField(optionsObject, gOptions_outXResolutionFieldID, xresolution);\n        TIFFGetField(image, TIFFTAG_YRESOLUTION, &yresolution);\n        LOGIF(\"yres\", yresolution);\n        jfieldID gOptions_outYResolutionFieldID = env->GetFieldID(jBitmapOptionsClass, \"outYResolution\", \"F\");\n        env->SetFloatField(optionsObject, gOptions_outYResolutionFieldID, yresolution);\n        TIFFGetField(image, TIFFTAG_RESOLUTIONUNIT, &resunit);\n        LOGII(\"resunit\", resunit);\n        jclass gOptions_ResolutionUnitClass = env->FindClass(\"org/beyka/tiffbitmapfactory/ResolutionUnit\");\n        jfieldID gOptions_ResolutionUnitFieldId = NULL;\n        switch(resunit) {\n            case RESUNIT_INCH:\n                gOptions_ResolutionUnitFieldId = env->GetStaticFieldID(gOptions_ResolutionUnitClass,\n                            \"INCH\",\n                            \"Lorg/beyka/tiffbitmapfactory/ResolutionUnit;\");\n                break;\n            case RESUNIT_CENTIMETER:\n                gOptions_ResolutionUnitFieldId = env->GetStaticFieldID(gOptions_ResolutionUnitClass,\n                            \"CENTIMETER\",\n                            \"Lorg/beyka/tiffbitmapfactory/ResolutionUnit;\");\n                break;\n            case RESUNIT_NONE:\n            default:\n                gOptions_ResolutionUnitFieldId = env->GetStaticFieldID(gOptions_ResolutionUnitClass,\n                            \"NONE\",\n                            \"Lorg/beyka/tiffbitmapfactory/ResolutionUnit;\");\n                break;\n        }\n        if (gOptions_ResolutionUnitFieldId != NULL) {\n            jobject gOptions_ResolutionUnitObj = env->GetStaticObjectField(\n                        gOptions_ResolutionUnitClass,\n                        gOptions_ResolutionUnitFieldId);\n\n            //Set resolution unit field to options object\n            jfieldID gOptions_outResUnitField = env->GetFieldID(jBitmapOptionsClass,\n                        \"outResolutionUnit\",\n                        \"Lorg/beyka/tiffbitmapfactory/ResolutionUnit;\");\n            env->SetObjectField(optionsObject, gOptions_outResUnitField,\n                        gOptions_ResolutionUnitObj);\n        }\n\n        //Get image planar config\n        int planarConfig = 0;\n        TIFFGetField(image, TIFFTAG_PLANARCONFIG, &planarConfig);\n        LOGII(\"planar config\", planarConfig);\n        jclass gOptions_PlanarConfigClass = env->FindClass(\"org/beyka/tiffbitmapfactory/PlanarConfig\");\n        jfieldID gOptions_PlanarConfigFieldId = NULL;\n        switch(planarConfig) {\n            case PLANARCONFIG_CONTIG:\n                gOptions_PlanarConfigFieldId = env->GetStaticFieldID(gOptions_PlanarConfigClass,\n                \"CONTIG\",\n                \"Lorg/beyka/tiffbitmapfactory/PlanarConfig;\");\n                break;\n            case PLANARCONFIG_SEPARATE:\n                gOptions_PlanarConfigFieldId = env->GetStaticFieldID(gOptions_PlanarConfigClass,\n                \"SEPARATE\",\n                \"Lorg/beyka/tiffbitmapfactory/PlanarConfig;\");\n                break;\n        }\n        if (gOptions_PlanarConfigFieldId != NULL) {\n            jobject gOptions_PlanarConfigObj = env->GetStaticObjectField(\n                    gOptions_PlanarConfigClass,\n                    gOptions_PlanarConfigFieldId);\n\n            jfieldID gOptions_outPlanarConfigField = env->GetFieldID(jBitmapOptionsClass,\n                    \"outPlanarConfig\",\n                    \"Lorg/beyka/tiffbitmapfactory/PlanarConfig;\");\n            env->SetObjectField(optionsObject, gOptions_outPlanarConfigField,\n                    gOptions_PlanarConfigObj);\n        }\n\n        //Getting image compression scheme and createing CompressionScheme enum\n        TIFFGetField(image, TIFFTAG_COMPRESSION, & origcompressionscheme);\n        LOGII(\"compression\", origcompressionscheme);\n\n        jclass gOptions_ImageCompressionClass = env->FindClass(\n            \"org/beyka/tiffbitmapfactory/CompressionScheme\");\n        jfieldID gOptions_ImageCompressionFieldId = NULL;\n        switch (origcompressionscheme) {\n        case COMPRESSION_NONE:\n            gOptions_ImageCompressionFieldId = env->GetStaticFieldID(gOptions_ImageCompressionClass,\n                \"NONE\",\n                \"Lorg/beyka/tiffbitmapfactory/CompressionScheme;\");\n            break;\n        case COMPRESSION_CCITTRLE:\n            gOptions_ImageCompressionFieldId = env->GetStaticFieldID(gOptions_ImageCompressionClass,\n                \"CCITTRLE\",\n                \"Lorg/beyka/tiffbitmapfactory/CompressionScheme;\");\n            break;\n        case COMPRESSION_CCITTFAX3:\n            gOptions_ImageCompressionFieldId = env->GetStaticFieldID(gOptions_ImageCompressionClass,\n                \"CCITTFAX3\",\n                \"Lorg/beyka/tiffbitmapfactory/CompressionScheme;\");\n                break;\n        case COMPRESSION_CCITTFAX4:\n            gOptions_ImageCompressionFieldId = env->GetStaticFieldID(gOptions_ImageCompressionClass,\n            \"CCITTFAX4\",\n            \"Lorg/beyka/tiffbitmapfactory/CompressionScheme;\");\n            break;\n        case COMPRESSION_LZW:\n            gOptions_ImageCompressionFieldId = env->GetStaticFieldID(gOptions_ImageCompressionClass,\n                \"LZW\",\n                \"Lorg/beyka/tiffbitmapfactory/CompressionScheme;\");\n            break;\n        case COMPRESSION_JPEG:\n            gOptions_ImageCompressionFieldId = env->GetStaticFieldID(gOptions_ImageCompressionClass,\n                \"JPEG\",\n                \"Lorg/beyka/tiffbitmapfactory/CompressionScheme;\");\n            break;\n        case COMPRESSION_PACKBITS:\n            gOptions_ImageCompressionFieldId = env->GetStaticFieldID(gOptions_ImageCompressionClass,\n                \"PACKBITS\",\n                \"Lorg/beyka/tiffbitmapfactory/CompressionScheme;\");\n            break;\n        case COMPRESSION_DEFLATE:\n            gOptions_ImageCompressionFieldId = env->GetStaticFieldID(gOptions_ImageCompressionClass,\n                \"DEFLATE\",\n                \"Lorg/beyka/tiffbitmapfactory/CompressionScheme;\");\n            break;\n        case COMPRESSION_ADOBE_DEFLATE:\n            gOptions_ImageCompressionFieldId = env->GetStaticFieldID(gOptions_ImageCompressionClass,\n                \"ADOBE_DEFLATE\",\n                \"Lorg/beyka/tiffbitmapfactory/CompressionScheme;\");\n            break;\n        default:\n            gOptions_ImageCompressionFieldId = env->GetStaticFieldID(gOptions_ImageCompressionClass,\n                \"OTHER\",\n                \"Lorg/beyka/tiffbitmapfactory/CompressionScheme;\");\n\n        }\n        if (gOptions_ImageCompressionFieldId != NULL) {\n            jobject gOptions_ImageCompressionObj = env->GetStaticObjectField(\n                gOptions_ImageCompressionClass,\n                gOptions_ImageCompressionFieldId);\n\n            //Set outImageOrientation field to options object\n            jfieldID gOptions_outCompressionSchemeField = env->GetFieldID(jBitmapOptionsClass,\n                \"outCompressionScheme\",\n                \"Lorg/beyka/tiffbitmapfactory/CompressionScheme;\");\n            env->SetObjectField(optionsObject, gOptions_outCompressionSchemeField,\n                gOptions_ImageCompressionObj);\n        }\n\n        jfieldID gOptions_OutCurDirNumberFieldID = env->GetFieldID(jBitmapOptionsClass,\n            \"outCurDirectoryNumber\",\n            \"I\");\n        env->SetIntField(optionsObject, gOptions_OutCurDirNumberFieldID, directoryNumber);\n        if (!flipHW) {\n            jfieldID gOptions_outWidthFieldId = env->GetFieldID(jBitmapOptionsClass, \"outWidth\", \"I\");\n            env->SetIntField(optionsObject, gOptions_outWidthFieldId, origwidth);\n\n            jfieldID gOptions_outHeightFieldId = env->GetFieldID(jBitmapOptionsClass, \"outHeight\", \"I\");\n            env->SetIntField(optionsObject, gOptions_outHeightFieldId, origheight);\n        } else {\n            jfieldID gOptions_outWidthFieldId = env->GetFieldID(jBitmapOptionsClass, \"outWidth\", \"I\");\n            env->SetIntField(optionsObject, gOptions_outWidthFieldId, origheight);\n\n            jfieldID gOptions_outHeightFieldId = env->GetFieldID(jBitmapOptionsClass, \"outHeight\", \"I\");\n            env->SetIntField(optionsObject, gOptions_outHeightFieldId, origwidth);\n        }\n\n        int tagRead = 0;\n\n        int bitPerSample = 0;\n        tagRead = TIFFGetField(image, TIFFTAG_BITSPERSAMPLE, &bitPerSample);\n        if (tagRead == 1) {\n            LOGII(\"bit per sample\", bitPerSample);\n            jfieldID gOptions_outBitPerSampleFieldID = env->GetFieldID(jBitmapOptionsClass, \"outBitsPerSample\", \"I\");\n            env->SetIntField(optionsObject, gOptions_outBitPerSampleFieldID, bitPerSample);\n        }\n\n        int samplePerPixel = 0;\n        tagRead = TIFFGetField(image, TIFFTAG_SAMPLESPERPIXEL, &samplePerPixel);\n        if (tagRead == 1) {\n            LOGII(\"sample per pixel\", samplePerPixel);\n            jfieldID gOptions_outSamplePerPixelFieldID = env->GetFieldID(jBitmapOptionsClass, \"outSamplePerPixel\", \"I\");\n            env->SetIntField(optionsObject, gOptions_outSamplePerPixelFieldID, samplePerPixel);\n        }\n\n        //Tile size\n        int tileWidth = 0;\n        tagRead = TIFFGetField(image, TIFFTAG_TILEWIDTH, &tileWidth);\n            if (tagRead == 1) {\n            LOGII(\"tile width\", tileWidth);\n            jfieldID gOptions_outTileWidthFieldID = env->GetFieldID(jBitmapOptionsClass, \"outTileWidth\", \"I\");\n            env->SetIntField(optionsObject, gOptions_outTileWidthFieldID, tileWidth);\n        }\n        int tileHeight = 0;\n        tagRead = TIFFGetField(image, TIFFTAG_TILELENGTH, &tileHeight);\n        if (tagRead == 1) {\n            LOGII(\"tile height\", tileHeight);\n            jfieldID gOptions_outTileHeightFieldID = env->GetFieldID(jBitmapOptionsClass, \"outTileHeight\", \"I\");\n            env->SetIntField(optionsObject, gOptions_outTileHeightFieldID, tileHeight);\n        }\n\n        //row per strip\n        int rowPerStrip = 0;\n        tagRead = TIFFGetField(image, TIFFTAG_ROWSPERSTRIP, &rowPerStrip);\n        if (tagRead == 1) {\n            LOGII(\"row per strip\", rowPerStrip);\n            jfieldID gOptions_outRowPerStripFieldID = env->GetFieldID(jBitmapOptionsClass, \"outRowPerStrip\", \"I\");\n            env->SetIntField(optionsObject, gOptions_outRowPerStripFieldID, rowPerStrip);\n        }\n\n        //strip size\n        uint32 stripSize = TIFFStripSize (image);\n        LOGII(\"strip size\", stripSize);\n        jfieldID gOptions_outStripSizeFieldID = env->GetFieldID(jBitmapOptionsClass, \"outStripSize\", \"I\");\n        env->SetIntField(optionsObject, gOptions_outStripSizeFieldID, stripSize);\n\n        //strip max\n        uint32 stripMax = TIFFNumberOfStrips (image);\n        LOGII(\"number of strips\", stripMax);\n        jfieldID gOptions_outStripMaxFieldID = env->GetFieldID(jBitmapOptionsClass, \"outNumberOfStrips\", \"I\");\n        env->SetIntField(optionsObject, gOptions_outStripMaxFieldID, stripMax);\n\n        //photometric\n        int photometric = 0;\n        TIFFGetField(image, TIFFTAG_PHOTOMETRIC, &photometric);\n        LOGII(\"photometric\", photometric);\n        jclass gOptions_PhotometricClass = env->FindClass(\"org/beyka/tiffbitmapfactory/Photometric\");\n        jfieldID gOptions_PhotometricFieldId = NULL;\n                switch(photometric) {\n                    case PHOTOMETRIC_MINISWHITE:\n                        gOptions_PhotometricFieldId = env->GetStaticFieldID(gOptions_PhotometricClass,\n                        \"MINISWHITE\",\n                        \"Lorg/beyka/tiffbitmapfactory/Photometric;\");\n                        break;\n                    case PHOTOMETRIC_MINISBLACK:\n                        gOptions_PhotometricFieldId = env->GetStaticFieldID(gOptions_PhotometricClass,\n                        \"MINISBLACK\",\n                        \"Lorg/beyka/tiffbitmapfactory/Photometric;\");\n                    case PHOTOMETRIC_RGB:\n                         gOptions_PhotometricFieldId = env->GetStaticFieldID(gOptions_PhotometricClass,\n                         \"RGB\",\n                         \"Lorg/beyka/tiffbitmapfactory/Photometric;\");\n                    case PHOTOMETRIC_PALETTE:\n                         gOptions_PhotometricFieldId = env->GetStaticFieldID(gOptions_PhotometricClass,\n                         \"PALETTE\",\n                         \"Lorg/beyka/tiffbitmapfactory/Photometric;\");\n                    case PHOTOMETRIC_MASK:\n                         gOptions_PhotometricFieldId = env->GetStaticFieldID(gOptions_PhotometricClass,\n                         \"MASK\",\n                         \"Lorg/beyka/tiffbitmapfactory/Photometric;\");\n                    case PHOTOMETRIC_SEPARATED:\n                         gOptions_PhotometricFieldId = env->GetStaticFieldID(gOptions_PhotometricClass,\n                         \"SEPARATED\",\n                         \"Lorg/beyka/tiffbitmapfactory/Photometric;\");\n                    case PHOTOMETRIC_YCBCR:\n                         gOptions_PhotometricFieldId = env->GetStaticFieldID(gOptions_PhotometricClass,\n                         \"YCBCR\",\n                         \"Lorg/beyka/tiffbitmapfactory/Photometric;\");\n                    case PHOTOMETRIC_CIELAB:\n                         gOptions_PhotometricFieldId = env->GetStaticFieldID(gOptions_PhotometricClass,\n                         \"CIELAB\",\n                         \"Lorg/beyka/tiffbitmapfactory/Photometric;\");\n                    case PHOTOMETRIC_ICCLAB:\n                         gOptions_PhotometricFieldId = env->GetStaticFieldID(gOptions_PhotometricClass,\n                         \"ICCLAB\",\n                         \"Lorg/beyka/tiffbitmapfactory/Photometric;\");\n                    case PHOTOMETRIC_ITULAB:\n                         gOptions_PhotometricFieldId = env->GetStaticFieldID(gOptions_PhotometricClass,\n                         \"ITULAB\",\n                         \"Lorg/beyka/tiffbitmapfactory/Photometric;\");\n                    case PHOTOMETRIC_LOGL:\n                         gOptions_PhotometricFieldId = env->GetStaticFieldID(gOptions_PhotometricClass,\n                         \"LOGL\",\n                         \"Lorg/beyka/tiffbitmapfactory/Photometric;\");\n                    case PHOTOMETRIC_LOGLUV:\n                         gOptions_PhotometricFieldId = env->GetStaticFieldID(gOptions_PhotometricClass,\n                         \"LOGLUV\",\n                         \"Lorg/beyka/tiffbitmapfactory/Photometric;\");\n                    default:\n                        gOptions_PhotometricFieldId = env->GetStaticFieldID(gOptions_PhotometricClass,\n                        \"OTHER\",\n                        \"Lorg/beyka/tiffbitmapfactory/Photometric;\");\n                }\n        if (gOptions_PhotometricFieldId != NULL) {\n                    jobject gOptions_PhotometricObj = env->GetStaticObjectField(\n                            gOptions_PhotometricClass,\n                            gOptions_PhotometricFieldId);\n\n                    jfieldID gOptions_outPhotometricField = env->GetFieldID(jBitmapOptionsClass,\n                            \"outPhotometric\",\n                            \"Lorg/beyka/tiffbitmapfactory/Photometric;\");\n                    env->SetObjectField(optionsObject, gOptions_outPhotometricField,\n                            gOptions_PhotometricObj);\n        }\n\n        //FillOrder\n        int fillOrder = 0;\n        TIFFGetField(image, TIFFTAG_FILLORDER, &fillOrder);\n        LOGII(\"fill Order\", fillOrder);\n        jclass gOptions_FillOrderClass = env->FindClass(\"org/beyka/tiffbitmapfactory/FillOrder\");\n        jfieldID gOptions_FillOrderFieldId = NULL;\n        switch(fillOrder) {\n        case FILLORDER_MSB2LSB:\n            gOptions_FillOrderFieldId = env->GetStaticFieldID(gOptions_FillOrderClass,\n            \"MSB2LSB\",\n            \"Lorg/beyka/tiffbitmapfactory/FillOrder;\");\n            break;\n        case PLANARCONFIG_SEPARATE:\n            gOptions_FillOrderFieldId = env->GetStaticFieldID(gOptions_FillOrderClass,\n            \"LSB2MSB\",\n            \"Lorg/beyka/tiffbitmapfactory/FillOrder;\");\n            break;\n        }\n        if (gOptions_FillOrderFieldId != NULL) {\n            jobject gOptions_FillOrderObj = env->GetStaticObjectField(\n            gOptions_FillOrderClass,\n            gOptions_FillOrderFieldId);\n\n            jfieldID gOptions_outFillOrderField = env->GetFieldID(jBitmapOptionsClass,\n            \"outFillOrder\",\n            \"Lorg/beyka/tiffbitmapfactory/FillOrder;\");\n            env->SetObjectField(optionsObject, gOptions_outFillOrderField,\n            gOptions_FillOrderObj);\n        }\n\n        //Author\n        const char * artist;\n        tagRead = TIFFGetField(image, TIFFTAG_ARTIST, & artist);\n        if (tagRead == 1) {\n            LOGI(artist);\n            jstring jauthor = charsToJString(artist);//env->NewStringUTF(artist);\n            jfieldID gOptions_outAuthorFieldId = env->GetFieldID(jBitmapOptionsClass, \"outAuthor\", \"Ljava/lang/String;\");\n            env->SetObjectField(optionsObject, gOptions_outAuthorFieldId, jauthor);\n            env->DeleteLocalRef(jauthor);\n            //free(artist);\n        }\n\n        //Copyright\n        const char * copyright;\n        tagRead = TIFFGetField(image, TIFFTAG_COPYRIGHT, & copyright);\n        if (tagRead == 1) {\n            LOGI(copyright);\n            jstring jcopyright = charsToJString(copyright);//env->NewStringUTF(copyright);\n            jfieldID gOptions_outCopyrightFieldId = env->GetFieldID(jBitmapOptionsClass, \"outCopyright\", \"Ljava/lang/String;\");\n            env->SetObjectField(optionsObject, gOptions_outCopyrightFieldId, jcopyright);\n            env->DeleteLocalRef(jcopyright);\n            //free(copyright);\n        }\n\n        //ImageDescription\n        const char * imgDescr;\n        tagRead = TIFFGetField(image, TIFFTAG_IMAGEDESCRIPTION, & imgDescr);\n        if (tagRead == 1) {\n            LOGI(imgDescr);\n            jstring jimgDescr = charsToJString(imgDescr);//env->NewStringUTF(imgDescr);\n            jfieldID gOptions_outimgDescrFieldId = env->GetFieldID(jBitmapOptionsClass, \"outImageDescription\", \"Ljava/lang/String;\");\n            env->SetObjectField(optionsObject, gOptions_outimgDescrFieldId, jimgDescr);\n            env->DeleteLocalRef(jimgDescr);\n            //free(imgDescr);\n        }\n\n        //Software\n        const char * software;\n        tagRead = TIFFGetField(image, TIFFTAG_SOFTWARE, & software);\n        if (tagRead == 1) {\n            LOGI(software);\n            jstring jsoftware = charsToJString(software);//env->NewStringUTF(software);\n            jfieldID gOptions_outsoftwareFieldId = env->GetFieldID(jBitmapOptionsClass, \"outSoftware\", \"Ljava/lang/String;\");\n            env->SetObjectField(optionsObject, gOptions_outsoftwareFieldId, jsoftware);\n            env->DeleteLocalRef(jsoftware);\n            //free(software);\n        }\n\n        //DateTime\n        const char * datetime;\n        tagRead = TIFFGetField(image, TIFFTAG_DATETIME, & datetime);\n        if (tagRead == 1) {\n            LOGI(datetime);\n            jstring jdatetime = charsToJString(datetime);//env->NewStringUTF(datetime);\n            jfieldID gOptions_outdatetimeFieldId = env->GetFieldID(jBitmapOptionsClass, \"outDatetime\", \"Ljava/lang/String;\");\n            env->SetObjectField(optionsObject, gOptions_outdatetimeFieldId, jdatetime);\n            env->DeleteLocalRef(jdatetime);\n            //free(datetime);\n        }\n\n        //Host Computer\n        const char * host;\n        tagRead = TIFFGetField(image, TIFFTAG_HOSTCOMPUTER, & host);\n        if (tagRead == 1) {\n            LOGI(host);\n            jstring jhost = charsToJString(host);//env->NewStringUTF(host);\n            jfieldID gOptions_outhostFieldId = env->GetFieldID(jBitmapOptionsClass, \"outHostComputer\", \"Ljava/lang/String;\");\n            env->SetObjectField(optionsObject, gOptions_outhostFieldId, jhost);\n            env->DeleteLocalRef(jhost);\n            //free(host);\n        }\n}\n\njstring NativeDecoder::charsToJString(const char *chars) {\n    std::string str(chars);\n    jbyteArray array = env->NewByteArray(str.size());\n    env->SetByteArrayRegion(array, 0, str.size(), (const jbyte*)str.c_str());\n    jstring strEncode = env->NewStringUTF(\"UTF-8\");\n    jclass cls = env->FindClass(\"java/lang/String\");\n    jmethodID ctor = env->GetMethodID(cls, \"<init>\", \"([BLjava/lang/String;)V\");\n    jstring object = (jstring) env->NewObject(cls, ctor, array, strEncode);\n    return object;\n //return NULL;\n}\n\njboolean NativeDecoder::checkStop() {\n    jmethodID methodID = env->GetStaticMethodID(jThreadClass, \"interrupted\", \"()Z\");\n    jboolean interupted = env->CallStaticBooleanMethod(jThreadClass, methodID);\n\n    jboolean stop;\n\n    if (optionsObject) {\n        jfieldID stopFieldId = env->GetFieldID(jBitmapOptionsClass,\n                                               \"isStoped\",\n                                               \"Z\");\n        stop = env->GetBooleanField(optionsObject, stopFieldId);\n\n    } else {\n        stop = JNI_FALSE;\n    }\n\n    return interupted || stop;\n}\n\nvoid NativeDecoder::sendProgress(jlong current, jlong total) {\n    if (listenerObject != NULL) {\n        jmethodID methodid = env->GetMethodID(jIProgressListenerClass, \"reportProgress\", \"(JJ)V\");\n        env->CallVoidMethod(listenerObject, methodid, current, total);\n    }\n}\n\nvoid NativeDecoder::tileErrorHandler(int code, siginfo_t *siginfo, void *sc) {\n    LOGE(\"tileErrorHandler\");\n    longjmp(tile_buf, 1);\n}\n\nvoid NativeDecoder::stripErrorHandler(int code, siginfo_t *siginfo, void *sc) {\n    LOGE(\"stripErrorHandler\");\n    longjmp(strip_buf, 1);\n}\n\nvoid NativeDecoder::imageErrorHandler(int code, siginfo_t *siginfo, void *sc) {\n    LOGE(\"imageErrorHandler\");\n    longjmp(image_buf, 1);\n}\n\nvoid NativeDecoder::generalErrorHandler(int code, siginfo_t *siginfo, void *sc) {\n    LOGE(\"generalErrorHandler\");\n    longjmp(general_buf, 1);\n}\n\nvoid NativeDecoder::throwDecodeFileException(const char *message) {\n    jstring adinf = env->NewStringUTF(message);\n    if (decodingMode == DECODE_MODE_FILE_PATH) {\n        throw_decode_file_exception(env, jPath, adinf);\n    } else if (decodingMode == DECODE_MODE_FILE_DESCRIPTOR) {\n        throw_decode_file_exception_fd(env, jFd, adinf);\n    }\n    env->DeleteLocalRef(adinf);\n}\n\nvoid NativeDecoder::throwCantOpenFileException() {\n    if (decodingMode == DECODE_MODE_FILE_PATH) {\n        throw_cant_open_file_exception(env, jPath);\n    } else if (decodingMode == DECODE_MODE_FILE_DESCRIPTOR) {\n        throw_cant_open_file_exception_fd(env, jFd);\n    }\n}\n\n\n\n\n\n\n\n"
  },
  {
    "path": "src/main/jni/NativeDecoder.h",
    "content": "//\n// Created by beyka on 3.2.17.\n//\n\n#ifndef TIFFSAMPLE_NATIVEDECODER_H\n#define TIFFSAMPLE_NATIVEDECODER_H\n\n#include <jni.h>\n#include <android/log.h>\n#include <android/bitmap.h>\n#include <stdlib.h>\n#include <stdio.h>\n#include <tiffio.h>\n#include <signal.h>\n#include <setjmp.h>\n#include \"NativeExceptions.h\"\n\n#ifdef NDEBUG\n    #define LOGI(x)\n    #define LOGII(x, y)\n    #define LOGIF(x, y)\n    #define LOGIS(x, y)\n    #define LOGE(x)\n    #define LOGES(x, y)\n    #define LOGEI(x, y)\n#else\n    #define LOGI(x) __android_log_print(ANDROID_LOG_DEBUG, \"NativeDecoder\", \"%s\", x)\n    #define LOGII(x, y) __android_log_print(ANDROID_LOG_DEBUG, \"NativeDecoder\", \"%s %d\", x, y)\n    #define LOGIF(x, y) __android_log_print(ANDROID_LOG_DEBUG, \"NativeDecoder\", \"%s %f\", x, y)\n    #define LOGIS(x, y) __android_log_print(ANDROID_LOG_DEBUG, \"NativeDecoder\", \"%s %s\", x, y)\n    #define LOGE(x) __android_log_print(ANDROID_LOG_ERROR, \"NativeDecoder\", \"%s\", x)\n    #define LOGES(x, y) __android_log_print(ANDROID_LOG_ERROR, \"NativeDecoder\", \"%s %s\", x, y)\n    #define LOGES(x, y) __android_log_print(ANDROID_LOG_ERROR, \"NativeDecoder\", \"%s %d\", x, y)\n#endif\n\nclass NativeDecoder\n{\n    public:\n        explicit NativeDecoder(JNIEnv *, jclass, jint, jobject, jobject);\n        explicit NativeDecoder(JNIEnv *, jclass, jstring, jobject, jobject);\n        ~NativeDecoder();\n        jobject getBitmap();\n\n    private:\n        //constants\n        static int const colorMask = 0xFF;\n        static int const ARGB_8888 = 2;\n        static int const RGB_565 = 4;\n        static int const ALPHA_8 = 8;\n\n        static int const DECODE_METHOD_IMAGE = 1;\n        static int const DECODE_METHOD_TILE = 2;\n        static int const DECODE_METHOD_STRIP = 3;\n\n        static int const DECODE_MODE_FILE_PATH = 1;\n        static int const DECODE_MODE_FILE_DESCRIPTOR = 2;\n\n        //decoding mode\n        int decodingMode;\n\n        //fields\n        JNIEnv *env;\n        jclass clazz;\n\n        static jmp_buf tile_buf;\n        static jmp_buf strip_buf;\n        static jmp_buf image_buf;\n        static jmp_buf general_buf;\n\n        jobject optionsObject;\n        jobject listenerObject;\n        jclass jIProgressListenerClass;\n        jclass jBitmapOptionsClass;\n        jclass jThreadClass = NULL;\n        jint jFd;\n        jstring jPath;\n        jboolean throwException;\n        jboolean useOrientationTag;\n        TIFF *image;\n        jlong progressTotal;\n        int origwidth;\n        int origheight;\n        short origorientation;\n        int origcompressionscheme;\n        jobject preferedConfig;\n        jboolean invertRedAndBlue;\n        jint boundX;\n        jint boundY;\n        jint boundWidth;\n        jint boundHeight;\n        char hasBounds;\n        unsigned long availableMemory;\n        //methods\n        int getDyrectoryCount();\n        void writeDataToOptions(int);\n        jobject createBitmap(int, int);\n        jint *getSampledRasterFromImage(int, int *, int *);\n        jint *getSampledRasterFromImageWithBounds(int , int *, int *);\n        jint *getSampledRasterFromStrip(int, int *, int *);\n        jint *getSampledRasterFromStripWithBounds(int, int *, int *);\n        void rotateTileLinesVertical(uint32, uint32, uint32 *, uint32 *);\n        void rotateTileLinesHorizontal(uint32, uint32, uint32 *, uint32 *);\n        void flipPixelsVertical(uint32, uint32, jint *);\n        void flipPixelsHorizontal(uint32, uint32, jint *);\n        jint *getSampledRasterFromTile(int, int *, int *);\n        jint *getSampledRasterFromTileWithBounds(int, int *, int *);\n        int getDecodeMethod();\n        void fixOrientation(jint *, uint32, int, int);\n        void rotateRaster(jint *, int, int *, int *);\n        jbyte * createBitmapAlpha8(jint *, int, int);\n        unsigned short *createBitmapRGB565(jint *, int, int);\n        jstring charsToJString(const char *);\n        jboolean checkStop();\n        void sendProgress(jlong, jlong);\n        //functions for catching SIGSEGV from libtiff methods\n        void signalFromTileHandler(int code, siginfo_t *siginfo, void *sc);\n        void signalFromStripHandler(int code, siginfo_t *siginfo, void *sc);\n\n        //throwing exceptions\n        void throwDecodeFileException(const char *);\n        void throwCantOpenFileException();\n\n        static void tileErrorHandler(int code, siginfo_t *siginfo, void *sc);\n        static void stripErrorHandler(int code, siginfo_t *siginfo, void *sc);\n        static void imageErrorHandler(int code, siginfo_t *siginfo, void *sc);\n        static void generalErrorHandler(int code, siginfo_t *siginfo, void *sc);\n};\n\n\n\n#endif //TIFFSAMPLE_NATIVEDECODER_H\n"
  },
  {
    "path": "src/main/jni/NativeExceptions.cpp",
    "content": "//\n// Created by alexeyba on 09.11.15.\n//\nusing namespace std;\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#include \"NativeExceptions.h\"\n\nvoid throw_not_enought_memory_exception(JNIEnv *env, int available, int need)\n{\n    jclass exClass;\n    jmethodID exConstructorID;\n    jobject exObj;\n    const char *className = \"org/beyka/tiffbitmapfactory/exceptions/NotEnoughtMemoryException\" ;\n\n    exClass = env->FindClass(className);\n\n    exConstructorID = env->GetMethodID(exClass, \"<init>\", \"(II)V\");\n\n    exObj = env->NewObject(exClass, exConstructorID, available, need);\n\n    env->Throw((jthrowable)exObj);\n}\n\nvoid throw_decode_file_exception(JNIEnv *env, jstring str, jstring additionalInfo)\n{\n    jclass exClass;\n    jmethodID exConstructorID;\n    jobject exObj;\n    const char *className = \"org/beyka/tiffbitmapfactory/exceptions/DecodeTiffException\" ;\n\n    exClass = env->FindClass(className);\n\n    exConstructorID = env->GetMethodID(exClass, \"<init>\", \"(Ljava/lang/String;Ljava/lang/String;)V\");\n\n    exObj = env->NewObject(exClass, exConstructorID, str, additionalInfo);\n\n    env->Throw((jthrowable)exObj);\n}\n\nvoid throw_decode_file_exception_fd(JNIEnv *env, jint fd, jstring additionalInfo)\n{\n    jclass exClass;\n    jmethodID exConstructorID;\n    jobject exObj;\n    const char *className = \"org/beyka/tiffbitmapfactory/exceptions/DecodeTiffException\" ;\n\n    exClass = env->FindClass(className);\n\n    exConstructorID = env->GetMethodID(exClass, \"<init>\", \"(ILjava/lang/String;)V\");\n\n    exObj = env->NewObject(exClass, exConstructorID, fd, additionalInfo);\n\n    env->Throw((jthrowable)exObj);\n}\n\nvoid throw_cant_open_file_exception(JNIEnv *env, jstring str)\n {\n     jclass exClass;\n     jmethodID exConstructorID;\n     jobject exObj;\n     const char *className = \"org/beyka/tiffbitmapfactory/exceptions/CantOpenFileException\" ;\n\n     exClass = env->FindClass(className);\n\n     exConstructorID = env->GetMethodID(exClass, \"<init>\", \"(Ljava/lang/String;)V\");\n\n     exObj = env->NewObject(exClass, exConstructorID, str);\n\n     env->Throw((jthrowable)exObj);\n }\n\nvoid throw_cant_open_file_exception_fd(JNIEnv *env, jint fd)\n{\n    jclass exClass;\n    jmethodID exConstructorID;\n    jobject exObj;\n    const char *className = \"org/beyka/tiffbitmapfactory/exceptions/CantOpenFileException\" ;\n\n    exClass = env->FindClass(className);\n\n    exConstructorID = env->GetMethodID(exClass, \"<init>\", \"(I)V\");\n\n    exObj = env->NewObject(exClass, exConstructorID, fd);\n\n    env->Throw((jthrowable)exObj);\n}\n\n#ifdef __cplusplus\n}\n#endif\n\n"
  },
  {
    "path": "src/main/jni/NativeExceptions.h",
    "content": "//\n// Created by alexeyba on 09.11.15.\n//\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#ifndef TIFFEXAMPLE_NATIVEEXCEPTIONS_H\n#define TIFFEXAMPLE_NATIVEEXCEPTIONS_H\n\n\n\n#include <jni.h>\n#include <android/log.h>\n\n#ifdef NDEBUG\n    #define LOGI(x)\n    #define LOGII(x, y)\n    #define LOGIS(x, y)\n#else\n    #define LOGI(x) __android_log_print(ANDROID_LOG_DEBUG, \"NativeDecoder\", \"%s\", x)\n    #define LOGII(x, y) __android_log_print(ANDROID_LOG_DEBUG, \"NativeDecoder\", \"%s %d\", x, y)\n    #define LOGIS(x, y) __android_log_print(ANDROID_LOG_DEBUG, \"NativeDecoder\", \"%s %s\", x, y)\n#endif\n\nvoid throw_not_enought_memory_exception(JNIEnv *, int, int);\nvoid throw_decode_file_exception(JNIEnv *, jstring, jstring);\nvoid throw_decode_file_exception_fd(JNIEnv *, jint, jstring);\nvoid throw_cant_open_file_exception(JNIEnv *, jstring);\nvoid throw_cant_open_file_exception_fd(JNIEnv *, jint);\n\n#endif //TIFFEXAMPLE_NATIVEEXCEPTIONS_H\n\n#ifdef __cplusplus\n}\n#endif\n\n\n\n"
  },
  {
    "path": "src/main/jni/NativeTiffBitmapFactory.cpp",
    "content": "using namespace std;\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#include \"NativeTiffBitmapFactory.h\"\n\nJNIEXPORT jobject\nJNICALL Java_org_beyka_tiffbitmapfactory_TiffBitmapFactory_nativeDecodePath\n        (JNIEnv *env, jclass clazz, jstring path, jobject options, jobject listener) {\n\n    NativeDecoder *decoder = new NativeDecoder(env, clazz, path, options, listener);\n    jobject java_bitmap = decoder->getBitmap();\n    delete(decoder);\n\n    return java_bitmap;\n}\n\nJNIEXPORT jobject\nJNICALL Java_org_beyka_tiffbitmapfactory_TiffBitmapFactory_nativeDecodeFD\n        (JNIEnv *env, jclass clazz, jint fd, jobject options, jobject listener) {\n\n    NativeDecoder *decoder = new NativeDecoder(env, clazz, fd, options, listener);\n    jobject java_bitmap = decoder->getBitmap();\n    delete(decoder);\n\n    return java_bitmap;\n}\n\nJNIEXPORT jobject\nJNICALL Java_org_beyka_tiffbitmapfactory_TiffBitmapFactory_nativeCloseFd\n        (JNIEnv *env, jclass clazz, jint fd) {\n    close(fd);\n}\n\n#ifdef __cplusplus\n}\n#endif\n"
  },
  {
    "path": "src/main/jni/NativeTiffBitmapFactory.h",
    "content": "/* DO NOT EDIT THIS FILE - it is machine generated */\n#include <jni.h>\n#include <android/log.h>\n#include <android/bitmap.h>\n#include <stdlib.h>\n#include <stdio.h>\n#include <tiffio.h>\n#include <unistd.h>\n#include \"NativeExceptions.h\"\n#include \"NativeDecoder.h\"\n/* Header for class NativeTiffBitmapFactory */\n\n#ifdef NDEBUG\n    #define LOGI(x)\n    #define LOGII(x, y)\n    #define LOGIS(x, y)\n    #define LOGE(x)\n    #define LOGES(x, y)\n#else\n    #define LOGI(x) __android_log_print(ANDROID_LOG_DEBUG, \"NativeTiffBitmapFactory\", \"%s\", x)\n    #define LOGII(x, y) __android_log_print(ANDROID_LOG_DEBUG, \"NativeTiffBitmapFactory\", \"%s %d\", x, y)\n    #define LOGIS(x, y) __android_log_print(ANDROID_LOG_DEBUG, \"NativeTiffBitmapFactory\", \"%s %s\", x, y)\n    #define LOGE(x) __android_log_print(ANDROID_LOG_ERROR, \"NativeTiffBitmapFactory\", \"%s\", x)\n    #define LOGES(x, y) __android_log_print(ANDROID_LOG_ERROR, \"NativeTiffBitmapFactory\", \"%s %s\", x, y)\n#endif\n\n#ifndef _Included_org_beyka_tiffbitmapfactory_TiffBitmapFactory\n#define _Included_org_beyka_tiffbitmapfactory_TiffBitmapFactory\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n/*\n * Class:     com_example_beyka_tiffexample_TiffBitmapFactory\n * Method:    nativeDecodePath\n * Signature: (Ljava/lang/String;I)Landroid/graphics/Bitmap;\n */\nJNIEXPORT jobject JNICALL Java_org_beyka_tiffbitmapfactory_TiffBitmapFactory_nativeDecodePath\n  (JNIEnv *, jclass, jstring, jobject, jobject);\n\n/*\n * Class:     com_example_beyka_tiffexample_TiffBitmapFactory\n * Method:    nativeDecodePath\n * Signature: (Ljava/lang/String;I)Landroid/graphics/Bitmap;\n */\nJNIEXPORT jobject JNICALL Java_org_beyka_tiffbitmapfactory_TiffBitmapFactory_nativeDecodeFD\n  (JNIEnv *, jclass, jint, jobject, jobject);\n\n/*\n * Class:     com_example_beyka_tiffexample_TiffBitmapFactory\n * Method:    nativeCloseFd\n * Signature: (Ljava/lang/String;I)Landroid/graphics/Bitmap;\n */\nJNIEXPORT jobject JNICALL Java_org_beyka_tiffbitmapfactory_TiffBitmapFactory_nativeCloseFd\n        (JNIEnv *, jclass, jint);\n\n\n#ifdef __cplusplus\n}\n#endif\n#endif\n"
  },
  {
    "path": "src/main/jni/NativeTiffConverter.cpp",
    "content": "//\n// Created by beyka on 5/9/17.\n//\nusing namespace std;\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#include \"NativeTiffConverter.h\"\n#include \"png.h\"\n\nJNIEXPORT jboolean JNICALL Java_org_beyka_tiffbitmapfactory_TiffConverter_convertTiffPng\n  (JNIEnv *env, jclass clazz, jstring tiffPath, jstring pngPath, jobject options, jobject listener)\n  {\n\n    TiffToPngConverter *converter = new TiffToPngConverter(env, clazz, tiffPath, pngPath, options, listener);\n    jboolean result = converter->convert();\n    delete(converter);\n    return result;\n  }\n\nJNIEXPORT jboolean JNICALL Java_org_beyka_tiffbitmapfactory_TiffConverter_convertTiffPngFd\n  (JNIEnv *env, jclass clazz, jint tiffFd, jint pngFd, jobject options, jobject listener)\n  {\n\n    TiffToPngConverter *converter = new TiffToPngConverter(env, clazz, tiffFd, pngFd, options, listener);\n    jboolean result = converter->convert();\n    delete(converter);\n    return result;\n  }\n\nJNIEXPORT jboolean JNICALL Java_org_beyka_tiffbitmapfactory_TiffConverter_convertTiffJpg\n  (JNIEnv *env, jclass clazz, jstring tiffPath, jstring jpgPath, jobject options, jobject listener)\n  {\n\n    TiffToJpgConverter *converter = new TiffToJpgConverter(env, clazz, tiffPath, jpgPath, options, listener);\n    jboolean result = converter->convert();\n    delete(converter);\n    return result;\n  }\n\nJNIEXPORT jboolean JNICALL Java_org_beyka_tiffbitmapfactory_TiffConverter_convertTiffJpgFd\n  (JNIEnv *env, jclass clazz, jint tiffFd, jint jpgFd, jobject options, jobject listener)\n  {\n\n    TiffToJpgConverter *converter = new TiffToJpgConverter(env, clazz, tiffFd, jpgFd, options, listener);\n    jboolean result = converter->convert();\n    delete(converter);\n    return result;\n  }\n\nJNIEXPORT jboolean JNICALL Java_org_beyka_tiffbitmapfactory_TiffConverter_convertTiffBmp\n  (JNIEnv *env, jclass clazz, jstring tiffPath, jstring outPath, jobject options, jobject listener)\n  {\n\n    TiffToBmpConverter *converter = new TiffToBmpConverter(env, clazz, tiffPath, outPath, options, listener);\n    jboolean result = converter->convert();\n    delete(converter);\n    return result;\n  }\n\nJNIEXPORT jboolean JNICALL Java_org_beyka_tiffbitmapfactory_TiffConverter_convertTiffBmpFd\n  (JNIEnv *env, jclass clazz, jint tiffFd, jint bmpFd, jobject options, jobject listener)\n  {\n\n    TiffToBmpConverter *converter = new TiffToBmpConverter(env, clazz, tiffFd, bmpFd, options, listener);\n    jboolean result = converter->convert();\n    delete(converter);\n    return result;\n  }\n\nJNIEXPORT jboolean JNICALL Java_org_beyka_tiffbitmapfactory_TiffConverter_convertPngTiff\n  (JNIEnv *env, jclass clazz, jstring pngPath, jstring tiffPath, jobject options, jobject listener)\n  {\n    PngToTiffConverter *converter = new PngToTiffConverter(env, clazz, pngPath, tiffPath, options, listener);\n    jboolean result = converter->convert();\n    delete(converter);\n    return result;\n  }\n\nJNIEXPORT jboolean JNICALL Java_org_beyka_tiffbitmapfactory_TiffConverter_convertPngTiffFd\n  (JNIEnv *env, jclass clazz, jint pngFd, jint tiffFd, jobject options, jobject listener)\n  {\n    PngToTiffConverter *converter = new PngToTiffConverter(env, clazz, pngFd, tiffFd, options, listener);\n    jboolean result = converter->convert();\n    delete(converter);\n    return result;\n  }\n\nJNIEXPORT jboolean JNICALL Java_org_beyka_tiffbitmapfactory_TiffConverter_convertJpgTiff\n  (JNIEnv *env, jclass clazz, jstring pngPath, jstring tiffPath, jobject options, jobject listener)\n  {\n    JpgToTiffConverter *converter = new JpgToTiffConverter(env, clazz, pngPath, tiffPath, options, listener);\n    jboolean result = converter->convert();\n    delete(converter);\n    return result;\n  }\n\nJNIEXPORT jboolean JNICALL Java_org_beyka_tiffbitmapfactory_TiffConverter_convertJpgTiffFd\n  (JNIEnv *env, jclass clazz, jint jpgFd, jint tiffFd, jobject options, jobject listener)\n  {\n    JpgToTiffConverter *converter = new JpgToTiffConverter(env, clazz, jpgFd, tiffFd, options, listener);\n    jboolean result = converter->convert();\n    delete(converter);\n    return result;\n  }\n\nJNIEXPORT jboolean JNICALL Java_org_beyka_tiffbitmapfactory_TiffConverter_convertBmpTiff\n  (JNIEnv *env, jclass clazz, jstring bmpPath, jstring tiffPath, jobject options, jobject listener)\n  {\n    BmpToTiffConverter *converter = new BmpToTiffConverter(env, clazz, bmpPath, tiffPath, options, listener);\n    jboolean result = converter->convert();\n    delete(converter);\n    return result;\n  }\n\nJNIEXPORT jboolean JNICALL Java_org_beyka_tiffbitmapfactory_TiffConverter_convertBmpTiffFd\n  (JNIEnv *env, jclass clazz, jint bmpFd, jint tiffFd, jobject options, jobject listener)\n  {\n    BmpToTiffConverter *converter = new BmpToTiffConverter(env, clazz, bmpFd, tiffFd, options, listener);\n    jboolean result = converter->convert();\n    delete(converter);\n    return result;\n  }\n\n  JNIEXPORT jobject JNICALL Java_org_beyka_tiffbitmapfactory_TiffConverter_readBmp\n    (JNIEnv *env, jclass clazz, jstring tiffPath, jstring bmpPath, jobject options, jobject listener)\n    {\n      return readBmp(env, clazz, tiffPath, bmpPath, options, listener);\n    }\n\nJNIEXPORT jobject JNICALL Java_org_beyka_tiffbitmapfactory_TiffConverter_getImageType\n  (JNIEnv *env, jclass clazz, jstring path)\n  {\n\n\n    const char *strPath = NULL;\n    strPath = env->GetStringUTFChars(path, 0);\n    LOGIS(\"path\", strPath);\n\n    int imageformat;\n\n    FILE *inFile = fopen(strPath, \"rb\");\n    if (inFile) {\n        //read file header\n        size_t byte_count = 8;\n        unsigned char *data = (unsigned char *)malloc(sizeof(unsigned char) * byte_count);\n        fread(data, 1, byte_count, inFile);\n\n        LOGIS(\"header\", data);\n\n        switch(data[0]) {\n            case (unsigned char)'\\xFF':\n                 imageformat =  ( !strncmp( (const char*)data, \"\\xFF\\xD8\\xFF\", 3 )) ?\n                    IMAGE_FILE_JPG : IMAGE_FILE_INVALID;\n                 break;\n\n              case (unsigned char)'\\x89':\n                 imageformat = ( !strncmp( (const char*)data,\n                                    \"\\x89\\x50\\x4E\\x47\\x0D\\x0A\\x1A\\x0A\", 8 )) ?\n                    IMAGE_FILE_PNG : IMAGE_FILE_INVALID;\n                 break;\n\n              case 'G':\n                 imageformat = ( !strncmp( (const char*)data, \"GIF87a\", 6 ) ||\n                          !strncmp( (const char*)data, \"GIF89a\", 6 ) ) ?\n                    IMAGE_FILE_GIF : IMAGE_FILE_INVALID;\n                 break;\n\n              case 'I':\n                 imageformat = ( !strncmp( (const char*)data, \"\\x49\\x49\\x2A\\x00\", 4 )) ?\n                    IMAGE_FILE_TIFF : IMAGE_FILE_INVALID;\n                 break;\n\n              case 'M':\n                 imageformat = ( !strncmp( (const char*)data, \"\\x4D\\x4D\\x00\\x2A\", 4 )) ?\n                     IMAGE_FILE_TIFF : IMAGE_FILE_INVALID;\n                     break;\n\n              case 'B':\n                 imageformat = (( data[1] == 'M' )) ?\n                     IMAGE_FILE_BMP : IMAGE_FILE_INVALID;\n                 break;\n\n              case 'R':\n                 if ( strncmp( (const char*)data,     \"RIFF\", 4 )) {\n                        imageformat = IMAGE_FILE_INVALID;\n                        break;\n                    }\n                 if ( strncmp( (const char*)(data+8), \"WEBP\", 4 )) {\n                        imageformat = IMAGE_FILE_INVALID;\n                        break;\n                    }\n                 imageformat = IMAGE_FILE_WEBP;\n                 break;\n\n              case '\\0':\n                 if ( !strncmp( (const char*)data, \"\\x00\\x00\\x01\\x00\", 4 )) {\n                        imageformat = IMAGE_FILE_ICO;\n                        break;\n                    }\n                 if ( !strncmp( (const char*)data, \"\\x00\\x00\\x02\\x00\", 4 )) {\n                        imageformat = IMAGE_FILE_ICO;\n                        break;\n                    }\n                 imageformat =  IMAGE_FILE_INVALID;\n                    break;\n              default:\n                 imageformat = IMAGE_FILE_INVALID;\n        }\n\n        fclose(inFile);\n    } else {\n        imageformat = IMAGE_FILE_INVALID;\n    }\n    \n    jclass imageFormatClass = env->FindClass(\n                \"org/beyka/tiffbitmapfactory/ImageFormat\");\n    jfieldID imageFormatFieldId = NULL;\n    switch (imageformat) {\n        case IMAGE_FILE_JPG:\n            imageFormatFieldId = env->GetStaticFieldID(imageFormatClass,\n                                           \"JPEG\",\n                                           \"Lorg/beyka/tiffbitmapfactory/ImageFormat;\");\n            break;\n        case IMAGE_FILE_PNG:\n            imageFormatFieldId = env->GetStaticFieldID(imageFormatClass,\n                                           \"PNG\",\n                                           \"Lorg/beyka/tiffbitmapfactory/ImageFormat;\");\n            break;\n        case IMAGE_FILE_TIFF:\n            imageFormatFieldId = env->GetStaticFieldID(imageFormatClass,\n                                           \"TIFF\",\n                                           \"Lorg/beyka/tiffbitmapfactory/ImageFormat;\");\n            break;\n         case IMAGE_FILE_BMP:\n            imageFormatFieldId = env->GetStaticFieldID(imageFormatClass,\n                                           \"BMP\",\n                                           \"Lorg/beyka/tiffbitmapfactory/ImageFormat;\");\n            break;\n        default:\n            imageFormatFieldId = env->GetStaticFieldID(imageFormatClass,\n                                           \"UNKNOWN\",\n                                           \"Lorg/beyka/tiffbitmapfactory/ImageFormat;\");\n    }\n    \n    jobject imageFormatObj = env->GetStaticObjectField(\n                    imageFormatClass,\n                    imageFormatFieldId);\n\n    return imageFormatObj;\n\n  }\n\nJNIEXPORT jobject JNICALL Java_org_beyka_tiffbitmapfactory_TiffConverter_getImageTypeFd\n  (JNIEnv *env, jclass clazz, jint fd)\n  {\n\n    int imageformat;\n\n    LOGII(\"fd \", fd);\n\n    if (fd != -1) {\n        LOGI(\"Start check\");\n        //read file header\n        int i= 0;\n        size_t byte_count = 8;\n        /*while( i < byte_count) {\n            char c;\n            read(fd, &c, 1);\n            LOGII(\"Read \", c);\n            i++;\n        }*/\n        unsigned char *data = (unsigned char *)malloc(sizeof(unsigned char) * byte_count);\n        int b = read(fd, data, byte_count);\n        LOGII(\"Read bytes: \", b);\n\n        LOGIS(\"header\", data);\n\n        lseek(fd, 0, SEEK_SET);\n\n        switch(data[0]) {\n            case (unsigned char)'\\xFF':\n                 imageformat =  ( !strncmp( (const char*)data, \"\\xFF\\xD8\\xFF\", 3 )) ?\n                    IMAGE_FILE_JPG : IMAGE_FILE_INVALID;\n                 break;\n\n              case (unsigned char)'\\x89':\n                 imageformat = ( !strncmp( (const char*)data,\n                                    \"\\x89\\x50\\x4E\\x47\\x0D\\x0A\\x1A\\x0A\", 8 )) ?\n                    IMAGE_FILE_PNG : IMAGE_FILE_INVALID;\n                 break;\n\n              case 'G':\n                 imageformat = ( !strncmp( (const char*)data, \"GIF87a\", 6 ) ||\n                          !strncmp( (const char*)data, \"GIF89a\", 6 ) ) ?\n                    IMAGE_FILE_GIF : IMAGE_FILE_INVALID;\n                 break;\n\n              case 'I':\n                 imageformat = ( !strncmp( (const char*)data, \"\\x49\\x49\\x2A\\x00\", 4 )) ?\n                    IMAGE_FILE_TIFF : IMAGE_FILE_INVALID;\n                 break;\n\n              case 'M':\n                 imageformat = ( !strncmp( (const char*)data, \"\\x4D\\x4D\\x00\\x2A\", 4 )) ?\n                     IMAGE_FILE_TIFF : IMAGE_FILE_INVALID;\n                     break;\n\n              case 'B':\n                 imageformat = (( data[1] == 'M' )) ?\n                     IMAGE_FILE_BMP : IMAGE_FILE_INVALID;\n                 break;\n\n              case 'R':\n                 if ( strncmp( (const char*)data,     \"RIFF\", 4 )) {\n                        imageformat = IMAGE_FILE_INVALID;\n                        break;\n                    }\n                 if ( strncmp( (const char*)(data+8), \"WEBP\", 4 )) {\n                        imageformat = IMAGE_FILE_INVALID;\n                        break;\n                    }\n                 imageformat = IMAGE_FILE_WEBP;\n                 break;\n\n              case '\\0':\n                 if ( !strncmp( (const char*)data, \"\\x00\\x00\\x01\\x00\", 4 )) {\n                        imageformat = IMAGE_FILE_ICO;\n                        break;\n                    }\n                 if ( !strncmp( (const char*)data, \"\\x00\\x00\\x02\\x00\", 4 )) {\n                        imageformat = IMAGE_FILE_ICO;\n                        break;\n                    }\n                 imageformat =  IMAGE_FILE_INVALID;\n                    break;\n              default:\n                 imageformat = IMAGE_FILE_INVALID;\n        }\n\n    } else {\n        imageformat = IMAGE_FILE_INVALID;\n    }\n\n    jclass imageFormatClass = env->FindClass(\n                \"org/beyka/tiffbitmapfactory/ImageFormat\");\n    jfieldID imageFormatFieldId = NULL;\n    switch (imageformat) {\n        case IMAGE_FILE_JPG:\n            imageFormatFieldId = env->GetStaticFieldID(imageFormatClass,\n                                           \"JPEG\",\n                                           \"Lorg/beyka/tiffbitmapfactory/ImageFormat;\");\n            break;\n        case IMAGE_FILE_PNG:\n            imageFormatFieldId = env->GetStaticFieldID(imageFormatClass,\n                                           \"PNG\",\n                                           \"Lorg/beyka/tiffbitmapfactory/ImageFormat;\");\n            break;\n        case IMAGE_FILE_TIFF:\n            imageFormatFieldId = env->GetStaticFieldID(imageFormatClass,\n                                           \"TIFF\",\n                                           \"Lorg/beyka/tiffbitmapfactory/ImageFormat;\");\n            break;\n         case IMAGE_FILE_BMP:\n            imageFormatFieldId = env->GetStaticFieldID(imageFormatClass,\n                                           \"BMP\",\n                                           \"Lorg/beyka/tiffbitmapfactory/ImageFormat;\");\n            break;\n        default:\n            imageFormatFieldId = env->GetStaticFieldID(imageFormatClass,\n                                           \"UNKNOWN\",\n                                           \"Lorg/beyka/tiffbitmapfactory/ImageFormat;\");\n    }\n\n    jobject imageFormatObj = env->GetStaticObjectField(\n                    imageFormatClass,\n                    imageFormatFieldId);\n\n    return imageFormatObj;\n\n  }\n\nJNIEXPORT jobject\nJNICALL Java_org_beyka_tiffbitmapfactory_TiffConverter_nativeCloseFd\n        (JNIEnv *env, jclass clazz, jint fd) {\n    close(fd);\n}\n\n#ifdef __cplusplus\n}\n#endif"
  },
  {
    "path": "src/main/jni/NativeTiffConverter.h",
    "content": "//\n// Created by beyka on 5/9/17.\n//\n#include <jni.h>\n#include <android/log.h>\n#include <stdlib.h>\n#include <stdio.h>\n\n#include \"jpeglib.h\"\n#include <setjmp.h>\n#include <unistd.h>\n\n#include \"TiffToPngConverter.h\"\n#include \"TiffToJpgConverter.h\"\n#include \"TiffToBmpConverter.h\"\n#include \"PngToTiffConverter.h\"\n#include \"JpgToTiffConverter.h\"\n#include \"BmpToTiffConverter.h\"\n#include \"BitmapReader.h\"\n\n#ifdef NDEBUG\n    #define LOGI(x)\n    #define LOGII(x, y)\n    #define LOGIF(x, y)\n    #define LOGIS(x, y)\n    #define LOGE(x)\n    #define LOGES(x, y)\n#else\n    #define LOGI(x) __android_log_print(ANDROID_LOG_DEBUG, \"NativeTiffConverter\", \"%s\", x)\n    #define LOGII(x, y) __android_log_print(ANDROID_LOG_DEBUG, \"NativeTiffConverter\", \"%s %d\", x, y)\n    #define LOGIF(x, y) __android_log_print(ANDROID_LOG_DEBUG, \"NativeTiffConverter\", \"%s %f\", x, y)\n    #define LOGIS(x, y) __android_log_print(ANDROID_LOG_DEBUG, \"NativeTiffConverter\", \"%s %s\", x, y)\n    #define LOGE(x) __android_log_print(ANDROID_LOG_ERROR, \"NativeTiffConverter\", \"%s\", x)\n    #define LOGES(x, y) __android_log_print(ANDROID_LOG_ERROR, \"NativeTiffConverter\", \"%s %s\", x, y)\n#endif\n\n#ifndef TIFFSAMPLE_NATIVETIFFCONVERTER_H\n#define TIFFSAMPLE_NATIVETIFFCONVERTER_H\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\nJNIEXPORT jboolean JNICALL Java_org_beyka_tiffbitmapfactory_TiffConverter_convertTiffPng\n  (JNIEnv *, jclass, jstring, jstring, jobject, jobject);\n\nJNIEXPORT jboolean JNICALL Java_org_beyka_tiffbitmapfactory_TiffConverter_convertTiffPngFd\n  (JNIEnv *, jclass, jint, jint, jobject, jobject);\n\nJNIEXPORT jboolean JNICALL Java_org_beyka_tiffbitmapfactory_TiffConverter_convertTiffJpg\n  (JNIEnv *, jclass, jstring, jstring, jobject, jobject);\n\nJNIEXPORT jboolean JNICALL Java_org_beyka_tiffbitmapfactory_TiffConverter_convertTiffJpgFd\n  (JNIEnv *, jclass, jint, jint, jobject, jobject);\n\nJNIEXPORT jboolean JNICALL Java_org_beyka_tiffbitmapfactory_TiffConverter_convertTiffbmp\n  (JNIEnv *, jclass, jstring, jstring, jobject, jobject);\n\nJNIEXPORT jboolean JNICALL Java_org_beyka_tiffbitmapfactory_TiffConverter_convertTiffbmpFd\n  (JNIEnv *, jclass, jint, jint, jobject, jobject);\n\nJNIEXPORT jboolean JNICALL Java_org_beyka_tiffbitmapfactory_TiffConverter_convertPngTiff\n  (JNIEnv *, jclass, jstring, jstring, jobject, jobject);\n\nJNIEXPORT jboolean JNICALL Java_org_beyka_tiffbitmapfactory_TiffConverter_convertPngTiffFd\n  (JNIEnv *, jclass, jint, jint, jobject, jobject);\n\nJNIEXPORT jboolean JNICALL Java_org_beyka_tiffbitmapfactory_TiffConverter_convertJpgTiff\n  (JNIEnv *, jclass, jstring, jstring, jobject, jobject);\n\nJNIEXPORT jboolean JNICALL Java_org_beyka_tiffbitmapfactory_TiffConverter_convertJpgTiffFd\n  (JNIEnv *, jclass, jint, jint, jobject, jobject);\n\nJNIEXPORT jboolean JNICALL Java_org_beyka_tiffbitmapfactory_TiffConverter_convertBmpTiff\n  (JNIEnv *, jclass, jstring, jstring, jobject, jobject);\n\nJNIEXPORT jboolean JNICALL Java_org_beyka_tiffbitmapfactory_TiffConverter_convertBmpTiffFd\n  (JNIEnv *, jclass, jint, jint, jobject, jobject);\n\nJNIEXPORT jobject JNICALL Java_org_beyka_tiffbitmapfactory_TiffConverter_readBmp\n  (JNIEnv *, jclass, jstring, jstring, jobject, jobject);\n\n   // .jpg:  FF D8 FF\n   // .png:  89 50 4E 47 0D 0A 1A 0A\n   // .gif:  GIF87a\n   //        GIF89a\n   // .tiff: 49 49 2A 00\n   //        4D 4D 00 2A\n   // .bmp:  BM\n   // .webp: RIFF ???? WEBP\n   // .ico   00 00 01 00\n   //        00 00 02 00 ( cursor files )\nJNIEXPORT jobject JNICALL Java_org_beyka_tiffbitmapfactory_TiffConverter_getImageType\n  (JNIEnv *, jclass, jstring);\n\nJNIEXPORT jobject JNICALL Java_org_beyka_tiffbitmapfactory_TiffConverter_getImageTypeFd\n  (JNIEnv *, jclass, jint);\n\nJNIEXPORT jobject JNICALL Java_org_beyka_tiffbitmapfactory_TiffConverter_nativeCloseFd\n        (JNIEnv *, jclass, jint);\n\n//constants for check files\nconst jint IMAGE_FILE_INVALID = 0;\nconst jint IMAGE_FILE_JPG = 1;\nconst jint IMAGE_FILE_PNG = 2;\nconst jint IMAGE_FILE_GIF = 3;\nconst jint IMAGE_FILE_TIFF = 4;\nconst jint IMAGE_FILE_BMP = 5;\nconst jint IMAGE_FILE_WEBP = 6;\nconst jint IMAGE_FILE_ICO = 7;\n\n#ifdef __cplusplus\n}\n#endif\n#endif //TIFFSAMPLE_NATIVETIFFCONVERTER_H\n"
  },
  {
    "path": "src/main/jni/NativeTiffSaver.cpp",
    "content": "//\n// Created by beyka on 18.2.16.\n//\nusing namespace std;\n\n#ifdef __cplusplus\nextern \"C\" {\n    #endif\n\n    #include \"NativeTiffSaver.h\"\n\n    int const colorMask = 0xFF;\n\n    int const paramCompression = 0;\n    int const paramOrientation = 1;\n\n    JNIEXPORT jboolean JNICALL Java_org_beyka_tiffbitmapfactory_TiffSaver_save\n    (JNIEnv *env, jclass clazz, jstring filePath, jint fileDescriptor, jobject bitmap, jobject options, jboolean append) {\n\n__android_log_write(ANDROID_LOG_ERROR, \"NativeTiffSaver\", \"Test Error here\");\n\n        //Options class\n        jclass jSaveOptionsClass = env->FindClass(\"org/beyka/tiffbitmapfactory/TiffSaver$SaveOptions\");\n\n        //How much memory can we use?\n        jfieldID availableMemoryFieldID = env->GetFieldID(jSaveOptionsClass,\n                                                                          \"inAvailableMemory\",\n                                                                          \"J\");\n        unsigned long inAvailableMemory = env->GetLongField(options, availableMemoryFieldID);\n\n        //If we need to throw exceptions\n        jfieldID throwExceptionFieldID = env->GetFieldID(jSaveOptionsClass,\n                                                                           \"inThrowException\",\n                                                                           \"Z\");\n        jboolean throwException = env->GetBooleanField(options, throwExceptionFieldID);\n\n        // check is bitmap null\n        if (bitmap == NULL) {\n            const char *message = \"Bitmap is null\\0\";\n            LOGE(message);\n            if (throwException) {\n                jstring jmessage = env->NewStringUTF(message);\n                throw_decode_file_exception(env, filePath, jmessage);\n                env->DeleteLocalRef(jmessage);\n            }\n            return JNI_FALSE;\n        }\n\n\n        jclass bitmapClass = env->FindClass(\"android/graphics/Bitmap\");\n\n        //check is bitmap recycled\n        jmethodID isRecycledMethodid = env->GetMethodID(bitmapClass, \"isRecycled\", \"()Z\");\n        jboolean isRecycled = env->CallBooleanMethod(bitmap, isRecycledMethodid);\n        if (isRecycled) {\n            const char *message = \"Bitmap is recycled\\0\";\n            LOGE(message);\n            if (throwException) {\n                jstring jmessage = env->NewStringUTF(message);\n                throw_decode_file_exception(env, filePath, jmessage);\n                env->DeleteLocalRef(jmessage);\n            }\n            return JNI_FALSE;\n        }\n\n        //Read pixels from bitmap\n\n        AndroidBitmapInfo  info;\n        void* pixels;\n        int ret;\n\n\n\n        if ((ret = AndroidBitmap_getInfo(env, bitmap, &info)) < 0) {\n            LOGE(\"AndroidBitmap_getInfo() failed ! error=\");\n            return JNI_FALSE;\n        }\n\n        if ((ret = AndroidBitmap_lockPixels(env, bitmap, &pixels)) < 0) {\n                LOGE(\"AndroidBitmap_lockPixels() failed ! error=\");\n                return JNI_FALSE;\n        }\n\n        uint32 img_width = info.width;\n        uint32 img_height= info.height;\n\n/*\n        //Get array of jint from jintArray\n        jint *c_array;\n        c_array = env->GetIntArrayElements(img, NULL);\n        if (c_array == NULL) {\n            //if array is null - nothing to save\n            LOGE(\"array is null\");\n            return JNI_FALSE;\n        }\n*/\n\n\n        //Get options\n\n        //Get compression mode from options object\n        jfieldID gOptions_CompressionModeFieldID = env->GetFieldID(jSaveOptionsClass,\n        \"compressionScheme\",\n        \"Lorg/beyka/tiffbitmapfactory/CompressionScheme;\");\n        jobject compressionMode = env->GetObjectField(options, gOptions_CompressionModeFieldID);\n\n        jclass compressionModeClass = env->FindClass(\n        \"org/beyka/tiffbitmapfactory/CompressionScheme\");\n        jfieldID ordinalFieldID = env->GetFieldID(compressionModeClass, \"ordinal\", \"I\");\n        jint compressionInt = env->GetIntField(compressionMode, ordinalFieldID);\n\n        //Get image orientation from options object\n        jfieldID gOptions_OrientationFieldID = env->GetFieldID(jSaveOptionsClass,\n        \"orientation\",\n        \"Lorg/beyka/tiffbitmapfactory/Orientation;\");\n        jobject orientation = env->GetObjectField(options, gOptions_OrientationFieldID);\n\n        jclass orientationClass = env->FindClass(\n        \"org/beyka/tiffbitmapfactory/Orientation\");\n        jfieldID orientationOrdinalFieldID = env->GetFieldID(orientationClass, \"ordinal\", \"I\");\n        jint orientationInt = env->GetIntField(orientation, orientationOrdinalFieldID);\n        env->DeleteLocalRef(orientationClass);\n\n        // variables for resolution\n        jfieldID gOptions_xResolutionFieldID = env->GetFieldID(jSaveOptionsClass, \"xResolution\", \"F\");\n        float xRes = env->GetFloatField(options, gOptions_xResolutionFieldID);\n        jfieldID gOptions_yResolutionFieldID = env->GetFieldID(jSaveOptionsClass, \"yResolution\", \"F\");\n        float yRes = env->GetFloatField(options, gOptions_yResolutionFieldID);\n        jfieldID gOptions_resUnitFieldID = env->GetFieldID(jSaveOptionsClass,\n                                                           \"resUnit\",\n                                                           \"Lorg/beyka/tiffbitmapfactory/ResolutionUnit;\");\n        jobject resUnitObject = env->GetObjectField(options, gOptions_resUnitFieldID);\n        //Get res int from resUnitObject\n        jclass resolutionUnitClass = env->FindClass(\"org/beyka/tiffbitmapfactory/ResolutionUnit\");\n        jfieldID resUnitOrdinalFieldID = env->GetFieldID(resolutionUnitClass, \"ordinal\", \"I\");\n        uint16 resUnit = env->GetIntField(resUnitObject, resUnitOrdinalFieldID);\n        env->DeleteLocalRef(resolutionUnitClass);\n\n        //Get author field if exist\n        jfieldID gOptions_authorFieldID = env->GetFieldID(jSaveOptionsClass, \"author\", \"Ljava/lang/String;\");\n        jstring jAuthor = (jstring)env->GetObjectField(options, gOptions_authorFieldID);\n        const char *authorString = NULL;\n        if (jAuthor) {\n            authorString = env->GetStringUTFChars(jAuthor, 0);\n            LOGIS(\"Author: \", authorString);\n        }\n\n        //Get copyright field if exist\n        jfieldID gOptions_copyrightFieldID = env->GetFieldID(jSaveOptionsClass, \"copyright\", \"Ljava/lang/String;\");\n        jstring jCopyright = (jstring)env->GetObjectField(options, gOptions_copyrightFieldID);\n        const char *copyrightString = NULL;\n        if (jCopyright) {\n            copyrightString = env->GetStringUTFChars(jCopyright, 0);\n            LOGIS(\"Copyright: \", copyrightString);\n        }\n\n        //Get image description field if exist\n        jfieldID gOptions_imgDescrFieldID = env->GetFieldID(jSaveOptionsClass, \"imageDescription\", \"Ljava/lang/String;\");\n        jstring jImgDescr = (jstring)env->GetObjectField(options, gOptions_imgDescrFieldID);\n        const char *imgDescrString = NULL;\n        if (jImgDescr) {\n            imgDescrString = env->GetStringUTFChars(jImgDescr, 0);\n            LOGIS(\"Image Description: \", imgDescrString);\n        }\n\n        //Get software name and number from buildconfig\n        jclass jBuildConfigClass = env->FindClass(\n                \"org/beyka/tiffbitmapfactory/BuildConfig\");\n        jfieldID softwareNameFieldID = env->GetStaticFieldID(jBuildConfigClass, \"softwarename\", \"Ljava/lang/String;\");\n        jstring jsoftwarename = (jstring)env->GetStaticObjectField(jBuildConfigClass, softwareNameFieldID);\n        const char *softwareNameString = NULL;\n        if (jsoftwarename) {\n            softwareNameString = env->GetStringUTFChars(jsoftwarename, 0);\n            LOGIS(\"Software Name: \", softwareNameString);\n        }\n\n        //Get android version\n        jclass build_class = env->FindClass(\"android/os/Build$VERSION\");\n        jfieldID releaseFieldID = env->GetStaticFieldID(build_class, \"RELEASE\", \"Ljava/lang/String;\");\n        jstring jrelease = (jstring)env->GetStaticObjectField(build_class, releaseFieldID);\n        const char *releaseString = NULL;\n        if (jrelease) {\n            releaseString = env->GetStringUTFChars(jrelease, 0);\n            LOGIS(\"Release: \", releaseString);\n        }\n        char *fullReleaseName = concat(\"Android \", releaseString);\n        LOGIS(\"Full Release: \", fullReleaseName);\n\n\n        uint32 pixelsBufferSize = img_width * img_height;\n        uint32* img = NULL;\n        int tmpImgArrayCreated = 0;\n        switch (info.format) {\n            case ANDROID_BITMAP_FORMAT_RGBA_8888:\n            {\n                LOGI(\"ANDROID_BITMAP_FORMAT_RGBA_8888\");\n                img = (uint32*)pixels;\n                break;\n            }\n            case ANDROID_BITMAP_FORMAT_RGBA_4444:\n            {\n                LOGI(\"ANDROID_BITMAP_FORMAT_RGBA_4444\");\n                uint16_t* tmp4444 = (uint16_t*)pixels;\n                img = (uint32*) malloc(sizeof(uint32) * pixelsBufferSize);\n                for (int x = 0; x < img_width; x++) {\n                    for (int y = 0; y < img_height; y++) {\n                        uint16_t pix = tmp4444[y * img_width + x];\n                        int alpha = colorMask & pix >> 16;\n                        int red = colorMask & pix >> 8;\n                        int green = colorMask & pix >> 4;\n                        int blue = colorMask & pix;\n                        uint32 crPix = (alpha << 24) | (blue << 16) | (green << 8) | (red);\n                        img[y * img_width + x] = crPix;\n                    }\n                }\n                tmpImgArrayCreated = 1;\n                break;\n            }\n            case ANDROID_BITMAP_FORMAT_RGB_565:\n            {\n                LOGI(\"ANDROID_BITMAP_FORMAT_RGB_565\");\n                uint16_t* tmp565 = (uint16_t*)pixels;\n                img = (uint32*) malloc(sizeof(uint32) * pixelsBufferSize);\n                for (int x = 0; x < img_width; x++) {\n                    for (int y = 0; y < img_height; y++) {\n                        uint16_t pix = tmp565[y * img_width + x];\n                        unsigned char red = 0b11111 & pix >> 11;\n                        unsigned char green = 0b111111 & pix >> 5;\n                        unsigned char blue = 0b11111 & pix;\n                        uint32 crPix = (blue << 3 << 16) | (green << 2 << 8) | (red<<3);\n                        img[y * img_width + x] = crPix;\n                    }\n                }\n                tmpImgArrayCreated = 1;\n                break;\n            }\n            case ANDROID_BITMAP_FORMAT_A_8:\n            {\n                LOGI(\"ANDROID_BITMAP_FORMAT_A_8\");\n                uint8_t* tmp8 = (uint8_t*)pixels;\n                img = (uint32*) malloc(sizeof(uint32) * pixelsBufferSize);\n                for (int x = 0; x < img_width; x++) {\n                    for (int y = 0; y < img_height; y++) {\n                        uint8_t pix = tmp8[y * img_width + x];\n                        img[y * img_width + x] = pix << 24;\n                    }\n                }\n                tmpImgArrayCreated = 1;\n                break;\n            }\n        }\n\n/*\n        int pixelsBufferSize = img_width * img_height;\n        uint32 *array = (uint32 *) malloc(sizeof(uint32) * pixelsBufferSize);\n        if (!array) {\n            throw_not_enought_memory_exception(env, sizeof(uint32) * pixelsBufferSize, 0);//todo change for estimating memory\n            return JNI_FALSE;\n        }\n\n        uint32_t* img = (uint32_t*)pixels;\n        for (int y = 0; y < img_height; y++) {\n            for (int x = 0; x < img_width; x++) {\n                uint32_t pix = img[y * img_width + x];\n                int alpha = colorMask & pix >> 24;\n                int red = colorMask & pix >> 16;\n                int green = colorMask & pix >> 8;\n                int blue = colorMask & pix;\n                uint32 crPix = (alpha << 24) | (blue << 16) | (green << 8) | (red);\n                array[y * img_width + x] = crPix;\n            }\n        }\n*/\n\n/*\n        for (int i = 0; i < img_width; i++) {\n            for (int j = 0; j < img_height; j++) {\n\n                uint32 crPix = getPixel(pixels,info,i,j);\n\n                //jint crPix = c_array[j * img_width + i];\n                int alpha = colorMask & crPix >> 24;\n                int red = colorMask & crPix >> 16;\n                int green = colorMask & crPix >> 8;\n                int blue = colorMask & crPix;\n\n                crPix = (alpha << 24) | (blue << 16) | (green << 8) | (red);\n                array[j * img_width + i] = crPix;\n            }\n        }\n*/\n        TIFF *output_image;\n\n        LOGII(\"Check file descripor\", fileDescriptor);\n\n        const char *strPath = NULL;\n        if (fileDescriptor == -1) {\n            strPath = env->GetStringUTFChars(filePath, 0);\n            LOGIS(\"nativeTiffOpenForSave\", strPath);\n            int mode = O_RDWR | O_CREAT | O_TRUNC | 0;\n            if (append) {\n                mode = O_RDWR | O_CREAT;\n            }\n            fileDescriptor = open(strPath, mode, 0666);\n            if (fileDescriptor < 0) {\n                throw_cant_open_file_exception(env, filePath);\n                return JNI_FALSE;\n            }\n        }\n\n        // Open the TIFF file\n        if (!append) {\n            if ((output_image = TIFFFdOpen(fileDescriptor, \"\", \"w\")) == NULL) {\n                LOGE(\"Unable to write tif file\");\n                if (strPath) {\n                    throw_cant_open_file_exception(env, filePath);\n                } else {\n                    throw_cant_open_file_exception_fd(env, fileDescriptor);\n                }\n                return JNI_FALSE;\n            }\n        } else {\n            if ((output_image = TIFFFdOpen(fileDescriptor, \"\", \"a\")) == NULL) {\n                LOGE(\"Unable to write tif file\");\n                if (strPath) {\n                    throw_cant_open_file_exception(env, filePath);\n                } else {\n                    throw_cant_open_file_exception_fd(env, fileDescriptor);\n                return JNI_FALSE;\n                }\n            }\n        }\n\n        TIFFSetField(output_image, TIFFTAG_IMAGEWIDTH, img_width);\n        TIFFSetField(output_image, TIFFTAG_IMAGELENGTH, img_height);\n        TIFFSetField(output_image, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);\n        TIFFSetField(output_image, TIFFTAG_COMPRESSION, compressionInt);\n        TIFFSetField(output_image, TIFFTAG_ORIENTATION, orientationInt);\n        TIFFSetField(output_image, TIFFTAG_XRESOLUTION, xRes);\n        TIFFSetField(output_image, TIFFTAG_YRESOLUTION, yRes);\n        TIFFSetField(output_image, TIFFTAG_RESOLUTIONUNIT, resUnit);\n\n        if (compressionInt == COMPRESSION_CCITTRLE ||compressionInt == COMPRESSION_CCITTFAX3 || compressionInt == COMPRESSION_CCITTFAX4) {\n            TIFFSetField(output_image, TIFFTAG_BITSPERSAMPLE,\t1);\n            TIFFSetField(output_image, TIFFTAG_SAMPLESPERPIXEL,\t1);\n            TIFFSetField(output_image, TIFFTAG_ROWSPERSTRIP, 1);\n            TIFFSetField(output_image, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISBLACK);\n            TIFFSetField(output_image, TIFFTAG_FILLORDER, FILLORDER_MSB2LSB);\n        } else {\n            TIFFSetField(output_image, TIFFTAG_BITSPERSAMPLE, 8);\n            TIFFSetField(output_image, TIFFTAG_SAMPLESPERPIXEL, 4);\n            TIFFSetField(output_image, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB);\n        }\n\n        //Write additiona tags\n        //CreationDate tag\n        char *date = getCreationDate();\n        TIFFSetField(output_image, TIFFTAG_DATETIME, date);\n        free(date);\n        //Host system\n        TIFFSetField(output_image, TIFFTAG_HOSTCOMPUTER, fullReleaseName);\n\n        //software\n        if (softwareNameString) {\n            TIFFSetField(output_image, TIFFTAG_SOFTWARE, softwareNameString);\n        }\n        //image description\n        if (imgDescrString) {\n            TIFFSetField(output_image, TIFFTAG_IMAGEDESCRIPTION, imgDescrString);\n        }\n        //author\n        if (authorString) {\n            TIFFSetField(output_image, TIFFTAG_ARTIST, authorString);\n        }\n        //copyright\n        if (copyrightString) {\n            TIFFSetField(output_image, TIFFTAG_COPYRIGHT, copyrightString);\n        }\n\n        // Write the information to the file\n        if (compressionInt == COMPRESSION_CCITTRLE || compressionInt == COMPRESSION_CCITTFAX3 || compressionInt == COMPRESSION_CCITTFAX4) {\n            unsigned char *bilevel = convertArgbToBilevel(img, img_width, img_height);\n            int compressedWidth = (img_width/8 + 0.5);\n            for (int i = 0; i < img_height; i++) {\n                TIFFWriteEncodedStrip(output_image, i, &bilevel[i * compressedWidth], (compressedWidth));\n            }\n            free(bilevel);\n        } else if (compressionInt == COMPRESSION_JPEG) {\n            for (int row = 0; row < img_height; row++) {\n                TIFFWriteScanline(output_image, &img[row * img_width], row, 0);\n            }\n        } else {\n            TIFFSetField(output_image, TIFFTAG_ROWSPERSTRIP, 1);\n            for (int row = 0; row < img_height; row++) {\n                TIFFWriteEncodedStrip(output_image, row, &img[row * img_width], img_width * sizeof(uint32));\n                //TIFFWriteScanline(output_image, &img[row * img_width], row, 0);\n            }\n        }\n       ret = TIFFWriteDirectory(output_image);\n        LOGII(\"ret = \", ret);\n\n        // Close the file\n        TIFFClose(output_image);\n/*\n        //free temp array\n        free (array);\n*/\n        if (tmpImgArrayCreated) {\n            free(img);\n        }\n\n        //Now we don't need android pixels, so unlock\n                 AndroidBitmap_unlockPixels(env, bitmap);\n\n        //Remove variables\n        if (releaseString) {\n            env->ReleaseStringUTFChars(jrelease, releaseString);\n        }\n        free(fullReleaseName);\n        if (softwareNameString) {\n            env->ReleaseStringUTFChars(jsoftwarename, softwareNameString);\n        }\n        if (imgDescrString) {\n            env->ReleaseStringUTFChars(jImgDescr, imgDescrString);\n        }\n        if (authorString) {\n            env->ReleaseStringUTFChars(jAuthor, authorString);\n        }\n        if (copyrightString) {\n            env->ReleaseStringUTFChars(jCopyright, copyrightString);\n        }\n        if (strPath) {\n            env->ReleaseStringUTFChars(filePath, strPath);\n        }\n//        env->ReleaseIntArrayElements(img, c_array, 0);\n\n        if (ret == -1) return JNI_FALSE;\n        return JNI_TRUE;\n    }\n\n    unsigned char *convertArgbToBilevel(uint32 *source, jint width, jint height) {\n        long long threshold = 0;\n        uint32 crPix;\n        uint32 grayPix;\n        int bilevelWidth = (width / 8 + 0.5);\n\n        unsigned char *dest = (unsigned char *) malloc(sizeof(unsigned char) * bilevelWidth * height);\n\n        uint32 maxGrey = (0.2125 * 255 + 0.7154 * 255 + 0.0721 * 255);\n        uint32 halfGrey = maxGrey/2;\n\n        uint32 shift = 0;\n        unsigned char charsum = 0;\n        int k = 7;\n        for (int j = 0; j < height; j++) {\n            shift = 0;\n            charsum = 0;\n            k = 7;\n            for (int i = 0; i < width; i++) {\n                crPix = source[j * width + i];\n                grayPix = (0.2125 * (colorMask & crPix >> 16) + 0.7154 * (colorMask & crPix >> 8) + 0.0721 * (colorMask & crPix));\n\n                if (grayPix < halfGrey) charsum &= ~(1 << k);\n                else charsum |= 1 << k;\n\n                if (k == 0) {\n                    dest[j * bilevelWidth + shift] = charsum;\n                    shift++;\n                    k = 7;\n\n                    charsum = 0;\n                } else {\n                    k--;\n                }\n            }\n        }\n        return dest;\n    }\n\n    char *getCreationDate() {\n        char * datestr = (char *) malloc(sizeof(char) * 20);\n        time_t rawtime;\n        struct tm * timeinfo;\n        time (&rawtime);\n        timeinfo = localtime (&rawtime);\n        strftime (datestr,20,/*\"Now it's %I:%M%p.\"*/\"%Y:%m:%d %H:%M:%S\",timeinfo);\n\n        return datestr;\n    }\n\n    char* concat(const char *s1, const char *s2)\n    {\n        char *result = (char *)malloc(strlen(s1)+strlen(s2)+1);//+1 for the zero-terminator\n        //in real code you would check for errors in malloc here\n        strcpy(result, s1);\n        strcat(result, s2);\n        return result;\n    }\n\nJNIEXPORT jobject\nJNICALL Java_org_beyka_tiffbitmapfactory_TiffSaver_nativeCloseFd\n        (JNIEnv *env, jclass clazz, jint fd) {\n    close(fd);\n}\n\n    #ifdef __cplusplus\n}\n#endif"
  },
  {
    "path": "src/main/jni/NativeTiffSaver.h",
    "content": "#include <jni.h>\n#include <android/log.h>\n#include <android/bitmap.h>\n#include <stdlib.h>\n#include <stdio.h>\n#include <tiffio.h>\n#include \"fcntl.h\"\n#include \"unistd.h\"\n#include <ctime>\n#include \"string.h\"\n#include \"NativeExceptions.h\"\n\n#ifdef NDEBUG\n    #define LOGI(x)\n    #define LOGII(x, y)\n    #define LOGIF(x, y)\n    #define LOGIS(x, y)\n    #define LOGE(x)\n    #define LOGES(x, y)\n#else\n    #define LOGI(x) __android_log_print(ANDROID_LOG_DEBUG, \"NativeTiffSaver\", \"%s\", x)\n    #define LOGII(x, y) __android_log_print(ANDROID_LOG_DEBUG, \"NativeTiffSaver\", \"%s %d\", x, y)\n    #define LOGIF(x, y) __android_log_print(ANDROID_LOG_DEBUG, \"NativeTiffSaver\", \"%s %f\", x, y)\n    #define LOGIS(x, y) __android_log_print(ANDROID_LOG_DEBUG, \"NativeTiffSaver\", \"%s %s\", x, y)\n    #define LOGE(x) __android_log_print(ANDROID_LOG_ERROR, \"NativeTiffSaver\", \"%s\", x)\n    #define LOGES(x, y) __android_log_print(ANDROID_LOG_ERROR, \"NativeTiffSaver\", \"%s %s\", x, y)\n#endif\n\n#ifndef _Included_org_beyka_tiffbitmapfactory_TiffSaver\n#define _Included_org_beyka_tiffbitmapfactory_TiffSaver\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n/*\n * Class:     org_beyka_tiffbitmapfactory_TiffSaver\n * Method:    save\n * Signature: (Ljava/lang/String;)V\n */\nJNIEXPORT jboolean JNICALL Java_org_beyka_tiffbitmapfactory_TiffSaver_save\n  (JNIEnv *, jclass, jstring, jint, jobject, jobject, jboolean);\n\nJNIEXPORT jobject JNICALL Java_org_beyka_tiffbitmapfactory_TiffSaver_nativeCloseFd\n        (JNIEnv *, jclass, jint);\n\nunsigned char *convertArgbToBilevel(uint32 *, jint, jint);\n\nchar *getCreationDate();\n\nchar *concat(const char *, const char *);\n\n#ifdef __cplusplus\n}\n#endif\n#endif\n"
  },
  {
    "path": "src/main/jni/PngToTiffConverter.cpp",
    "content": "//\n// Created by beyka on 5/12/17.\n//\n\n#include \"PngToTiffConverter.h\"\n\nPngToTiffConverter::PngToTiffConverter(JNIEnv *e, jclass clazz, jstring in, jstring out, jobject opts, jobject listener)\n    : BaseTiffConverter(e, clazz, in, out, opts, listener)\n{\n    png_ptr_init = 0;\n    png_info_init = 0;\n\n    compressionInt = 5;\n}\n\nPngToTiffConverter::PngToTiffConverter(JNIEnv *e, jclass clazz, jint in, jint out, jobject opts, jobject listener)\n    : BaseTiffConverter(e, clazz, in, out, opts, listener)\n{\n    png_ptr_init = 0;\n    png_info_init = 0;\n\n    compressionInt = 5;\n}\n\nPngToTiffConverter::~PngToTiffConverter() {\n    if (tiffImage) {\n        TIFFClose(tiffImage);\n        tiffImage = NULL;\n    }\n\n    if (png_info_init) {\n        png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1);\n    }\n\n    if (png_ptr_init) {\n        png_destroy_read_struct(&png_ptr, NULL, NULL);\n    }\n\n    if (inFile) {\n        fclose(inFile);\n    }\n}\n\njboolean PngToTiffConverter::convert()\n{\n    readOptions();\n\n    //open tiff file for writing or appending\n    if(outFd < 0) {\n        //open tiff file for writing or appending\n        const char *outCPath = NULL;\n        outCPath = env->GetStringUTFChars(outPath, 0);\n        LOGIS(\"OUT path\", outCPath);\n        LOGIS(\"nativeTiffOpenForSave\", outCPath);\n        int mode = O_RDWR | O_CREAT | O_TRUNC | 0;\n        if (appendTiff) {\n            mode = O_RDWR | O_CREAT;\n        }\n        outFd = open(outCPath, mode, 0666);\n        if (outFd < 0) {\n            throw_cant_open_file_exception(env, outPath);\n            env->ReleaseStringUTFChars(outPath, outCPath);\n            return JNI_FALSE;\n        }\n        env->ReleaseStringUTFChars(outPath, outCPath);\n    }\n\n    if (!appendTiff) {\n        if ((tiffImage = TIFFFdOpen(outFd, \"\", \"w\")) == NULL) {\n            LOGE(\"Unable to open tif file\");\n            if (throwException) {\n                throw_cant_open_file_exception_fd(env, outFd);\n            }\n            return JNI_FALSE;\n        }\n    } else {\n        if ((tiffImage = TIFFFdOpen(outFd, \"\", \"a\")) == NULL) {\n            LOGE(\"Unable to open tif file\");\n            if (throwException) {\n                throw_cant_open_file_exception_fd(env, outFd);\n            }\n            return JNI_FALSE;\n        }\n    }\n\n    //open png file fow reading\n    if (inFd == -1) {\n        const char *inCPath = NULL;\n        inCPath = env->GetStringUTFChars(inPath, 0);\n        LOGIS(\"IN path\", inCPath);\n        inFile = fopen(inCPath, \"rb\");\n        if (!inFile) {\n            if (throwException) {\n                throw_cant_open_file_exception(env, inPath);\n            }\n            LOGES(\"Can\\'t open in file\", inCPath);\n            env->ReleaseStringUTFChars(inPath, inCPath);\n            return JNI_FALSE;\n        }\n        env->ReleaseStringUTFChars(inPath, inCPath);\n    } else {\n        inFile = fdopen(inFd, \"rb\");\n        if (!inFile) {\n            if (throwException) {\n                throw_cant_open_file_exception_fd(env, inFd);\n            }\n            LOGES(\"Can\\'t open out file descriptor\", inFd);\n            return JNI_FALSE;\n        }\n    }\n\n    //read file header\n    size_t byte_count = 8;\n    unsigned char *header = (unsigned char *)malloc(sizeof(unsigned char) * byte_count);\n    fread(header, 1, byte_count, inFile);\n\n    //check is file is PNG or not\n    bool is_png = !png_sig_cmp(header, 0, byte_count);\n    if (!is_png) {\n        LOGE(\"Not png file\");\n        if (throwException) {\n            if (inFd == -1) {\n                throw_cant_open_file_exception(env, inPath);\n            } else {\n                throw_cant_open_file_exception_fd(env, inFd);\n            }\n        }\n        return JNI_FALSE;\n    } else {\n        LOGI(\"Is png\");\n    }\n\n    //init png struct\n    png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);\n    if (!png_ptr) {\n        const char *message = \"Can\\'t create PNG structure\";\n        LOGE(*message);\n        if (throwException) {\n            jstring er = env->NewStringUTF(message);\n            if (inFd < 0) {\n                throw_decode_file_exception(env, inPath, er);\n            } else {\n                throw_decode_file_exception_fd(env, inFd, er);\n            }\n            env->DeleteLocalRef(er);\n        }\n        return JNI_FALSE;\n    }\n    png_ptr_init = 1;\n\n    png_set_sig_bytes(png_ptr, byte_count);\n\n    //create png info pointer\n    info_ptr = png_create_info_struct(png_ptr);\n    if (!info_ptr) {\n        const char *message = \"Can\\'t create PNG info structure\";\n        LOGE(*message);\n        if (throwException) {\n            jstring er = env->NewStringUTF(message);\n            if (inFd < 0) {\n                throw_decode_file_exception(env, inPath, er);\n            } else {\n                throw_decode_file_exception_fd(env, inFd, er);\n            }\n            env->DeleteLocalRef(er);\n        }\n        return JNI_FALSE;\n    }\n    png_info_init = 1;\n\n    //png error handler\n    if (setjmp(png_jmpbuf(png_ptr))) {\n        const char *message = \"Error reading PNG\";\n        LOGE(message);\n        if (throwException) {\n            jstring er = env->NewStringUTF(message);\n            if (inFd < 0) {\n                throw_decode_file_exception(env, inPath, er);\n            } else {\n                throw_decode_file_exception_fd(env, inFd, er);\n            }\n            env->DeleteLocalRef(er);\n        }\n        return JNI_FALSE;\n    }\n\n    //Init PNG IO\n    png_init_io(png_ptr, inFile);\n    //seek file header\n    png_set_sig_bytes(png_ptr, byte_count);\n\n    png_read_info(png_ptr, info_ptr);\n    png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, NULL, NULL, NULL);\n\n    LOGII(\"width\", width);\n    LOGII(\"height\", height);\n    LOGII(\"bit_depth\", bit_depth);\n    LOGII(\"color_type\", color_type);\n\n\n\n    // cast any pixel data to RGBA data for simplest reading\n    if(bit_depth == 16)\n        png_set_strip_16(png_ptr);\n\n    if(color_type == PNG_COLOR_TYPE_PALETTE)\n        png_set_palette_to_rgb(png_ptr);\n\n      // PNG_COLOR_TYPE_GRAY_ALPHA is always 8 or 16bit depth.\n    if(color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8)\n        png_set_expand_gray_1_2_4_to_8(png_ptr);\n\n    if(png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))\n        png_set_tRNS_to_alpha(png_ptr);\n\n      // These color_type don't have an alpha channel then fill it with 0xff.\n    if(color_type == PNG_COLOR_TYPE_RGB ||\n         color_type == PNG_COLOR_TYPE_GRAY ||\n         color_type == PNG_COLOR_TYPE_PALETTE)\n        png_set_filler(png_ptr, 0xFF, PNG_FILLER_AFTER);\n\n    if(color_type == PNG_COLOR_TYPE_GRAY ||\n         color_type == PNG_COLOR_TYPE_GRAY_ALPHA)\n        png_set_gray_to_rgb(png_ptr);\n\n    int number_passes = png_set_interlace_handling(png_ptr);\n    LOGII(\"number_passes\", number_passes);\n\n    png_read_update_info(png_ptr, info_ptr);\n\n\n    LOGII(\"compression\", compressionInt);\n    //Set tiff parameters\n    //Set various text parameters\n    //Set image parameters\n    TIFFSetField(tiffImage, TIFFTAG_IMAGEWIDTH, width);\n    TIFFSetField(tiffImage, TIFFTAG_IMAGELENGTH, height);\n    TIFFSetField(tiffImage, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);\n    TIFFSetField(tiffImage, TIFFTAG_COMPRESSION, compressionInt);\n    TIFFSetField(tiffImage, TIFFTAG_ORIENTATION, orientationInt);\n    TIFFSetField(tiffImage, TIFFTAG_XRESOLUTION, xRes);\n    TIFFSetField(tiffImage, TIFFTAG_YRESOLUTION, yRes);\n    TIFFSetField(tiffImage, TIFFTAG_RESOLUTIONUNIT, resUnit);\n\n    if (compressionInt == COMPRESSION_CCITTRLE || compressionInt == COMPRESSION_CCITTFAX3 || compressionInt == COMPRESSION_CCITTFAX4) {\n        TIFFSetField(tiffImage, TIFFTAG_BITSPERSAMPLE,\t1);\n        TIFFSetField(tiffImage, TIFFTAG_SAMPLESPERPIXEL,\t1);\n        TIFFSetField(tiffImage, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISBLACK);\n        TIFFSetField(tiffImage, TIFFTAG_FILLORDER, FILLORDER_MSB2LSB);\n    } else {\n        TIFFSetField(tiffImage, TIFFTAG_BITSPERSAMPLE, 8);\n        TIFFSetField(tiffImage, TIFFTAG_SAMPLESPERPIXEL, 4);\n        TIFFSetField(tiffImage, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB);\n    }\n    //creation date\n    char *date = getCreationDate();\n    TIFFSetField(tiffImage, TIFFTAG_DATETIME, date);\n    free(date);\n    //image description\n    if (cdescription) {\n        TIFFSetField(tiffImage, TIFFTAG_IMAGEDESCRIPTION, cdescription);\n    }\n    //software tag\n    if (csoftware) {\n        TIFFSetField(tiffImage, TIFFTAG_SOFTWARE, csoftware);\n    }\n\n    //Calculate row per strip\n    //maximum size for strip should be less than 2Mb if memory available\n    unsigned long MB2 = (availableMemory == -1 || availableMemory > 3 * 1024 * 1024) ? 2 * 1024 * 1024 : width * 4;\n    unsigned long rowSizeBytes = width * 4;\n    int rowPerStrip = MB2/rowSizeBytes;\n    if (rowPerStrip >= height) {\n        rowPerStrip = height / 4;\n    }\n    if (rowPerStrip < 1) rowPerStrip = 1;\n    LOGII(\"rowPerStrip\", rowPerStrip);\n\n    //check available memory and estimate memory\n    unsigned long estimateMem = rowPerStrip * width * 4;\n    estimateMem += (compressionInt == COMPRESSION_CCITTRLE || compressionInt == COMPRESSION_CCITTFAX3 || compressionInt == COMPRESSION_CCITTFAX4) ? (width/8 + 0.5) * rowPerStrip : 0;\n    LOGII(\"estimateMem\", estimateMem);\n    if (estimateMem > availableMemory && availableMemory != -1) {\n        LOGEI(\"Not enough memory\", availableMemory);\n        if (throwException) {\n            throw_not_enought_memory_exception(env, availableMemory, estimateMem);\n        }\n        return JNI_FALSE;\n    }\n\n    if (checkStop()) {\n        conversion_result = JNI_FALSE;\n        return conversion_result;\n    }\n\n    //progress reporter\n    jlong total = width * height;\n    sendProgress(0, total);\n\n\n    int rowbytes = png_get_rowbytes(png_ptr,info_ptr);\n    png_bytep row_pointers[rowPerStrip];\n    for (int sy = 0; sy < rowPerStrip; sy++) {\n        row_pointers[sy] = (png_byte*)malloc(rowbytes);\n    }\n\n    int ret;\n\n    // Write the information to the file\n    if (compressionInt == COMPRESSION_CCITTRLE || compressionInt == COMPRESSION_CCITTFAX3 || compressionInt == COMPRESSION_CCITTFAX4) {\n        TIFFSetField(tiffImage, TIFFTAG_ROWSPERSTRIP, rowPerStrip);\n        int compressedWidth = (width/8 + 0.5);\n        for (int y = 0; y < height; y+=rowPerStrip) {\n            if (checkStop()) {\n                for (int sy = 0; sy < rowPerStrip; sy++) {\n                    free(row_pointers[sy]);\n                }\n                conversion_result = JNI_FALSE;\n                return conversion_result;\n            }\n            int rowToRead = rowPerStrip;\n            if (rowToRead + y >= height) {\n                rowToRead = height - y;\n            }\n            sendProgress(y * width, total);\n            png_read_rows(png_ptr, &row_pointers[0], NULL, rowToRead);\n            unsigned char *bilevel = convertArgbToBilevel(&row_pointers[0], 4, width, rowToRead);\n            TIFFWriteEncodedStrip(tiffImage, y/rowPerStrip, bilevel, compressedWidth * sizeof(unsigned char) * rowToRead);\n            free(bilevel);\n        }\n    } else if (compressionInt == COMPRESSION_JPEG) {\n        for (int ys = 0; ys < height; ys+=rowPerStrip) {\n            if (checkStop()) {\n                for (int sy = 0; sy < rowPerStrip; sy++) {\n                    free(row_pointers[sy]);\n                }\n                conversion_result = JNI_FALSE;\n                return conversion_result;\n            }\n            int rowToRead = rowPerStrip;\n            if (rowToRead + ys >= height) {\n                rowToRead = height - ys;\n            }\n            LOGII(\"rowToRead\", rowToRead);\n            sendProgress(ys * width, total);\n            png_read_rows(png_ptr, &row_pointers[0], NULL, rowToRead);\n            uint32 *pixels = new uint32[width];\n            for (int k = 0; k < rowToRead; k++) {\n                memcpy(pixels, row_pointers[k], width * sizeof(uint32));\n                ret = TIFFWriteScanline(tiffImage, pixels, ys + k, 0);\n            }\n            //TIFFWriteEncodedStrip(tiffImage, y/rowPerStrip, pixels, width * sizeof(uint32) * rowToRead);\n            delete[] pixels;\n\n        }\n    } else {\n        TIFFSetField(tiffImage, TIFFTAG_ROWSPERSTRIP, rowPerStrip);\n        for (int y = 0; y < height; y+=rowPerStrip) {\n            if (checkStop()) {\n                for (int sy = 0; sy < rowPerStrip; sy++) {\n                    free(row_pointers[sy]);\n                }\n                conversion_result = JNI_FALSE;\n                return conversion_result;\n            }\n            int rowToRead = rowPerStrip;\n            if (rowToRead + y >= height) {\n                rowToRead = height - y;\n            }\n            LOGII(\"rowToRead\", rowToRead);\n            sendProgress(y * width, total);\n            png_read_rows(png_ptr, &row_pointers[0], NULL, rowToRead);\n            uint32 *pixels = new uint32[width * rowPerStrip];\n            for (int k = 0; k < rowToRead; k++) {\n                memcpy(pixels+k*width, row_pointers[k], width * sizeof(uint32));\n            }\n            TIFFWriteEncodedStrip(tiffImage, y/rowPerStrip, pixels, width * sizeof(uint32) * rowToRead);\n            delete[] pixels;\n        }\n    }\n    //free memory allocated for png rows\n    for (int sy = 0; sy < rowPerStrip; sy++) {\n        free(row_pointers[sy]);\n    }\n    ret = TIFFWriteDirectory(tiffImage);\n    LOGII(\"ret = \", ret);\n\n\n    sendProgress(total, total);\n    conversion_result = JNI_TRUE;\n    return conversion_result;\n}\n\nunsigned char * PngToTiffConverter::convertArgbToBilevel(png_bytep *data, int samplePerPixel, uint32 width, uint32 height) {\n        unsigned char red;\n        unsigned char green;\n        unsigned char blue;\n        unsigned char alpha;\n\n\n        uint32 crPix;\n        uint32 grayPix;\n        int bilevelWidth = (width / 8 + 0.5);\n\n        unsigned char *dest = (unsigned char *) malloc(sizeof(unsigned char) * bilevelWidth * height);\n\n        uint32 maxGrey = (0.2125 * 255 + 0.7154 * 255 + 0.0721 * 255);\n        uint32 halfGrey = maxGrey/2;\n\n        uint32 shift = 0;\n        unsigned char charsum = 0;\n        int k = 7;\n        for (int y = 0; y < height; y++) {\n            shift = 0;\n            charsum = 0;\n            k = 7;\n            png_bytep row = data[y];\n            for (int i = 0; i < width; i++) {\n                png_bytep px = &(row[i * samplePerPixel]);\n                red = px[0];\n                green = px[1];\n                blue = px[2];\n                grayPix = (0.2125 * red + 0.7154 * green + 0.0721 * blue);\n\n                if (grayPix < halfGrey) charsum &= ~(1 << k);\n                else charsum |= 1 << k;\n\n                if (k == 0) {\n                    dest[y * bilevelWidth + shift] = charsum;\n                    shift++;\n                    k = 7;\n                    charsum = 0;\n                } else {\n                   k--;\n                }\n             }\n        }\n        return dest;\n}"
  },
  {
    "path": "src/main/jni/PngToTiffConverter.h",
    "content": "//\n// Created by beyka on 5/12/17.\n//\n\n#ifndef TIFFSAMPLE_PNGTOTIFFCONVERTER_H\n#define TIFFSAMPLE_PNGTOTIFFCONVERTER_H\n\n#include <stdlib.h>\n#include <stdio.h>\n#include <tiffio.h>\n#include \"fcntl.h\"\n#include \"unistd.h\"\n#include <png.h>\n#include <setjmp.h>\n#include \"BaseTiffConverter.h\"\n\n#ifdef NDEBUG\n    #define LOGI(x)\n    #define LOGII(x, y)\n    #define LOGIF(x, y)\n    #define LOGIS(x, y)\n    #define LOGE(x)\n    #define LOGES(x, y)\n    #define LOGEI(x, y)\n#else\n    #define LOGI(x) __android_log_print(ANDROID_LOG_DEBUG, \"PngToTiffConverter\", \"%s\", x)\n    #define LOGII(x, y) __android_log_print(ANDROID_LOG_DEBUG, \"PngToTiffConverter\", \"%s %d\", x, y)\n    #define LOGIF(x, y) __android_log_print(ANDROID_LOG_DEBUG, \"PngToTiffConverter\", \"%s %f\", x, y)\n    #define LOGIS(x, y) __android_log_print(ANDROID_LOG_DEBUG, \"PngToTiffConverter\", \"%s %s\", x, y)\n    #define LOGE(x) __android_log_print(ANDROID_LOG_ERROR, \"PngToTiffConverter\", \"%s\", x)\n    #define LOGES(x, y) __android_log_print(ANDROID_LOG_ERROR, \"PngToTiffConverter\", \"%s %s\", x, y)\n    #define LOGEI(x, y) __android_log_print(ANDROID_LOG_ERROR, \"PngToTiffConverter\", \"%s %d\", x, y)\n#endif\n\nclass PngToTiffConverter : public BaseTiffConverter\n{\n    public:\n        explicit PngToTiffConverter(JNIEnv *, jclass, jstring, jstring, jobject, jobject);\n        explicit PngToTiffConverter(JNIEnv *, jclass, jint, jint, jobject, jobject);\n        ~PngToTiffConverter();\n        virtual jboolean convert();\n\n     private:\n         TIFF *tiffImage;\n         FILE *inFile;\n         char png_ptr_init;\n         png_structp png_ptr;\n         char png_info_init;\n         png_infop info_ptr;\n\n         int bit_depth;\n         int color_type;\n\n         //unsigned char * convertArgbToBilevel(png_byte *, int, uint32, uint32);\n         unsigned char * convertArgbToBilevel(png_bytep *, int, uint32, uint32);\n};\n\n#endif //TIFFSAMPLE_PNGTOTIFFCONVERTER_H\n"
  },
  {
    "path": "src/main/jni/TiffToBmpConverter.cpp",
    "content": "//\n// Created by beyka on 9/22/17.\n//\n#include \"TiffToBmpConverter.h\"\n#include \"BMP.h\"\n\nTiffToBmpConverter::TiffToBmpConverter(JNIEnv *e, jclass clazz, jstring in, jstring out, jobject opts, jobject listener)\n    : BaseTiffConverter(e, clazz, in, out, opts, listener)\n{\n    bmpHeader = new BITMAPFILEHEADER;\n    bmpInfo = new BITMAPINFOHEADER;\n}\n\nTiffToBmpConverter::TiffToBmpConverter(JNIEnv *e, jclass clazz, jint in, jint out, jobject opts, jobject listener)\n    : BaseTiffConverter(e, clazz, in, out, opts, listener)\n{\n    bmpHeader = new BITMAPFILEHEADER;\n    bmpInfo = new BITMAPINFOHEADER;\n}\n\nTiffToBmpConverter::~TiffToBmpConverter()\n{\n    if (bmpHeader)\n        free(bmpHeader);\n    if (bmpInfo)\n        free(bmpInfo);\n}\n\njboolean TiffToBmpConverter::convert()\n{\n    readOptions();\n    LOGI(\"Optioons read done\");\n\n    LOGII(\"inFd=\", inFd);\n    if (inFd == -1) {\n        const char *inCPath = NULL;\n        inCPath = env->GetStringUTFChars(inPath, 0);\n        LOGIS(\"IN path\", inCPath);\n        inFd = open(inCPath, O_RDWR, 0666);\n        if (inFd == -1) {\n            if (throwException) {\n                throw_cant_open_file_exception(env, inPath);\n            }\n            LOGES(\"Can\\'t open in file\", inCPath);\n            env->ReleaseStringUTFChars(inPath, inCPath);\n            return JNI_FALSE;\n        }\n        env->ReleaseStringUTFChars(inPath, inCPath);\n    }\n\n    //open tiff image for reading\n    tiffImage = TIFFFdOpen(inFd, \"\", \"r\");\n    if (tiffImage == NULL) {\n        if (throwException) {\n            if (inFd < 0) {\n                throw_cant_open_file_exception(env, inPath);\n            } else {\n                throw_cant_open_file_exception_fd(env, inFd);\n            }\n        }\n        return JNI_FALSE;\n    }\n    LOGI(\"Tiff file opened for reading\");\n\n    //open bmp file for writing\n    LOGII(\"outFd=\", outFd);\n    if(outFd == -1) {\n    LOGI(\"Opening bmp as File\");\n        //open tiff file for writing or appending\n        const char *outCPath = NULL;\n        outCPath = env->GetStringUTFChars(outPath, 0);\n        LOGIS(\"OUT path\", outCPath);\n        outFIle = fopen(outCPath, \"w\");\n        if (!outFIle) {\n            throw_cant_open_file_exception(env, outPath);\n            env->ReleaseStringUTFChars(outPath, outCPath);\n            return JNI_FALSE;\n        }\n    } else {\n    LOGI(\"Opening bmp as FD\");\n        outFIle = fdopen(outFd, \"w\");\n        if (!outFIle) {\n            LOGI(\"BMP file is null\");\n            if (throwException) {\n                throw_cant_open_file_exception_fd(env, inFd);\n            }\n            LOGES(\"Can\\'t open out file descriptor\", inFd);\n            return JNI_FALSE;\n        }\n    }\n    LOGI(\"BMP file opened\");\n\n    //set tiff directory and read image dimensions\n    TIFFSetDirectory(tiffImage, tiffDirectory);\n    TIFFGetField(tiffImage, TIFFTAG_IMAGEWIDTH, &width);\n    TIFFGetField(tiffImage, TIFFTAG_IMAGELENGTH, &height);\n    //Getting image orientation and createing ImageOrientation enum\n    TIFFGetField(tiffImage, TIFFTAG_ORIENTATION, &origorientation);\n    //If orientation field is empty - use ORIENTATION_TOPLEFT\n    if (origorientation == 0) {\n        origorientation = ORIENTATION_TOPLEFT;\n    }\n\n    if (!normalizeDecodeArea()) {\n        fclose(outFIle);\n        return JNI_FALSE;\n    }\n\n    LOGII(\"image width\", width);\n    LOGII(\"image height\", height);\n    LOGII(\"image bound width\", boundWidth);\n    LOGII(\"image bound height\", boundHeight);\n\n    unsigned long long imageDataSize = (outWidth * 3 + outWidth % 4) * outHeight;\n\n    LOGII(\"image out width\", outWidth);\n    LOGII(\"image out height\", outHeight);\n\n\n    LOGII(\"image data size\", imageDataSize);\n\n    LOGII(\"size\", sizeof(BITMAPINFOHEADER));\n\n    //char *bm = \"BM\";\n     //memcpy(&bmpHeader->bfType, bm, sizeof(short));\n    bmpHeader->bfType[0] = 0x42;\n    bmpHeader->bfType[1] = 0x4d;\n    bmpHeader->bfSize = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) + imageDataSize;//sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) + 3 * width * height;\n    bmpHeader->bfOffBits = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER);//sizeof(BITMAPFILEHEADER) + 108;\n\n    bmpInfo->biSize = 108;\n    bmpInfo->biWidth = outWidth;\n    bmpInfo->biHeight = outHeight;\n    bmpInfo->biBitCount = 24;\n    bmpInfo->biPlanes = 1;\n    bmpInfo->biCompression = 0;\n\n    bmpInfo->biSizeImage = 0;//imageDataSize;\n\n    bmpInfo->biClrUsed = 0;\n    bmpInfo->biClrImportant = 0;\n\n    bmpInfo->biPalete[0] = 0;\n    bmpInfo->biPalete[1] = 0;\n    bmpInfo->biPalete[2] = 0;\n\n    for (int i = 0; i < 55; i++) {\n        bmpInfo->reserved[i] = 0;\n    }\n\n    fwrite(bmpHeader,sizeof(BITMAPFILEHEADER),1,outFIle);\n    fseek(outFIle, sizeof(BITMAPFILEHEADER) , SEEK_SET);\n    fwrite(bmpInfo,sizeof(BITMAPINFOHEADER),1,outFIle);\n    fseek(outFIle, sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) , SEEK_SET);\n\n    jboolean result = JNI_FALSE;\n\n    switch(getDecodeMethod()) {\n        case DECODE_METHOD_IMAGE:\n            result = convertFromImage();\n            break;\n        case DECODE_METHOD_TILE:\n           result = convertFromTile();\n           break;\n       case DECODE_METHOD_STRIP:\n           result = convertFromStrip();\n           break;\n    }\n\n    fclose(outFIle);\n    if (!result) {\n        //maybe shold delete file?\n    }\n\n    LOGI(\"fille closed\");\n    conversion_result = result;\n    return conversion_result;\n    //return JNI_FALSE;\n}\n\njboolean TiffToBmpConverter::convertFromImage() {\n    int origBufferSize = width * height * sizeof(uint32);\n\n    unsigned long estimateMem = origBufferSize;\n    estimateMem += outWidth * 3 + outWidth % 4; //working buf to write to file\n    LOGII(\"estimateMem\", estimateMem);\n    if (estimateMem > availableMemory && availableMemory != -1) {\n        LOGEI(\"Not enough memory\", availableMemory);\n        if (throwException) {\n            throw_not_enought_memory_exception(env, availableMemory, estimateMem);\n        }\n        return JNI_FALSE;\n    }\n\n    uint32 *origBuffer = NULL;\n    origBuffer = (uint32 *) _TIFFmalloc(origBufferSize);\n    if (origBuffer == NULL) {\n        const char *message = \"Can\\'t allocate buffer\";\n        LOGE(*message);\n        if (throwException) {\n            throw_not_enought_memory_exception(env, availableMemory, origBufferSize);\n        }\n        return JNI_FALSE;\n    }\n\n    if (0 == TIFFReadRGBAImageOriented(tiffImage, width, height, origBuffer, ORIENTATION_TOPLEFT, 0)) {\n        free(origBuffer);\n        const char *message = \"Can\\'t read tiff\";\n        if (throwException) {\n            jstring er = env->NewStringUTF(message);\n            if (outFd == -1) {\n                throw_decode_file_exception(env, outPath, er);\n            } else {\n                throw_decode_file_exception_fd(env, outFd, er);\n            }\n            env->DeleteLocalRef(er);\n        }\n        LOGE(message);\n        return JNI_FALSE;\n    }\n    LOGI(\"tiff read\");\n\n    jlong total = outWidth * outHeight;\n    int outY, outX;\n    sendProgress(0, total);\n\n    //24 bpp bmp should has with multiple 4\n    int rowSize = outWidth * 3 + outWidth % 4;\n    unsigned char *row = new unsigned char[rowSize];\n\n    for (int y = 0; y < height ; y++) {\n        if (y < outStartY || y >= outStartY + outHeight) continue;\n        if (checkStop()) {\n            free(origBuffer);\n            return JNI_FALSE;\n        }\n        outY = y - outStartY;\n        sendProgress(outY * outWidth, total);\n\n        for (int x = 0; x < width * 3; x += 3) {\n            if (x < outStartX * 3 || x >= (outStartX + outWidth) * 3) continue;\n            outX = x - (outStartX*3);\n            uint32 pix = origBuffer[y * width + x/3];\n            unsigned char *vp = (unsigned char *)&pix;\n            //in bmp colors stores as bgr\n            row[outX] = vp[2]; //red\n            row[outX+1] = vp[1]; //green\n            row[outX+2] = vp[0];   //blue\n        }\n\n        //in bmp lines stored fliped verticaly. Write lines from bottom to top\n        fseek(outFIle, 122 + (outHeight - outY - 1) * rowSize , SEEK_SET);\n        fwrite(row,rowSize,1,outFIle);\n    }\n    free(row);\n    LOGI(\"exit for\");\n    if (origBuffer) {\n        _TIFFfree(origBuffer);\n    }\n    LOGI(\"free orig\");\n    sendProgress(total, total);\n    LOGI(\"dend progress\");\n    return JNI_TRUE;\n}\n\njboolean TiffToBmpConverter::convertFromTile() {\n    uint32 tileWidth = 0, tileHeight = 0;\n    TIFFGetField(tiffImage, TIFFTAG_TILEWIDTH, &tileWidth);\n    TIFFGetField(tiffImage, TIFFTAG_TILEWIDTH, &tileHeight);\n    LOGII(\"Tile width\", tileWidth);\n    LOGII(\"Tile height\", tileHeight);\n\n    uint32 workingWidth = (width/tileWidth + (width%tileWidth == 0 ? 0 : 1)) * tileWidth;\n    LOGII(\"workingWidth \", workingWidth );\n    uint32 rasterSize =  workingWidth  * tileHeight ;\n    LOGII(\"rasterSize \", rasterSize );\n\n\n    unsigned long estimateMem = rasterSize * sizeof(uint32); //raster\n    estimateMem += tileWidth * tileHeight * sizeof(uint32); //tile raster\n    estimateMem += tileWidth * sizeof (uint32); //working buf\n    estimateMem += width * 3 + width % 4; //bufer for writing scanline to bmp\n    LOGII(\"estimateMem\", estimateMem);\n    if (estimateMem > availableMemory && availableMemory != -1) {\n        LOGEI(\"Not enought memory\", availableMemory);\n        if (throwException) {\n            throw_not_enought_memory_exception(env, availableMemory, estimateMem);\n        }\n        return JNI_FALSE;\n    }\n\n    uint32 *rasterTile = (uint32 *)_TIFFmalloc(tileWidth * tileHeight * sizeof(uint32));\n    uint32 *work_line_buf = (uint32*)_TIFFmalloc(tileWidth * sizeof (uint32));\n\n     jlong total = ((width/tileWidth + (width%tileWidth == 0 ? 0 : 1)) * tileWidth)\n                * ((height/tileHeight + (height%tileHeight == 0 ? 0 : 1)) * tileHeight);\n        sendProgress(0, total);\n\n    uint32 row, column;\n\n    int startx = -1, starty = -1, endx = -1, endy = -1;\n    uint32 imageWritedLines = 0;\n\n    //24 bpp bmp should has with multiple 4\n    int scanlineSize = outWidth * 3 + outWidth % 4;\n    unsigned char *scanline = new unsigned char[scanlineSize];\n\n    for (row = 0; row < height; row += tileHeight) {\n        sendProgress(row * width, total);\n        endy = -1;\n        starty = -1;\n        uint32 *raster = (uint32 *)_TIFFmalloc(rasterSize * sizeof(uint32));\n\n        for (column = 0; column < width; column += tileWidth) {\n            if (checkStop()) {\n                free(raster);\n                raster = NULL;\n                if (rasterTile) {\n                    _TIFFfree(rasterTile);\n                    rasterTile = NULL;\n                }\n                if (work_line_buf) {\n                    _TIFFfree(rasterTile);\n                    work_line_buf = NULL;\n                }\n                return JNI_FALSE;\n            }\n            endx = -1;\n            startx = -1;\n            TIFFReadRGBATile(tiffImage, column , row, rasterTile);\n            switch(origorientation) {\n                case 1:\n                case 5:\n                    rotateTileLinesVertical(tileHeight, tileWidth, rasterTile, work_line_buf);\n                    break;\n                case 2:\n                case 6:\n                    rotateTileLinesVertical(tileHeight, tileWidth, rasterTile, work_line_buf);\n                    rotateTileLinesHorizontal(tileHeight, tileWidth, rasterTile, work_line_buf);\n                    break;\n                case 3:\n                case 7:\n                    rotateTileLinesHorizontal(tileHeight, tileWidth, rasterTile, work_line_buf);\n                    break;\n            }\n\n            normalizeTile(tileHeight, tileWidth, rasterTile);\n\n            //find start and end position\n            for (int ty = 0; ty < tileHeight; ty++) {\n\n                for (int tx = 0; tx < tileWidth; tx++) {\n                    if (rasterTile[ty * tileWidth + tx] != 0) {\n                        if (startx == -1) {\n                            startx = tx;\n                        }\n                        if (starty == -1) {\n                            starty = ty;\n                        }\n\n                        if (tx > endx)\n                            endx = tx;\n                        if (ty > endy)\n                            endy = ty;\n\n                        uint32 rasterPos = (ty ) * workingWidth + (tx + column);\n                        //LOGII(\"rp\", rasterPos);\n                        raster[rasterPos] = rasterTile[ty * tileWidth + tx];\n                    }\n\n                }\n            }\n        }\n\n        int outY, outX;\n        int tileShift = 0;\n        for (int y = starty; y < tileHeight; y++) {\n            if (imageWritedLines == height) break;\n            if (y + row < outStartY || y + row >= outStartY + outHeight) continue;\n            outY = y + row - outStartY;\n            for (int x = 0; x < width * 3; x += 3) {\n                if (x < outStartX * 3 || x >= (outStartX + outWidth) * 3) continue;\n                outX = x - (outStartX*3);\n                uint32 pix = raster[y * workingWidth + x/3];\n                unsigned char *vp = (unsigned char *)&pix;\n                scanline[outX] = vp[2];\n                scanline[outX+1] = vp[1];\n                scanline[outX+2] = vp[0];\n            }\n\n            //in bmp lines stored fliped verticaly. Write lines from bottom to top\n            fseek(outFIle, 122 + (/*height - tileShift - row*/outHeight - outY - 1) * scanlineSize , SEEK_SET);\n            fwrite(scanline,scanlineSize,1,outFIle);\n            tileShift++;\n            imageWritedLines++;\n        }\n        //LOGII(\"imageWritedLines\", imageWritedLines);\n        free(raster);\n    }\n    free(scanline);\n\n    if (rasterTile) {\n        _TIFFfree(rasterTile);\n        rasterTile = NULL;\n    }\n\n    if (work_line_buf) {\n        _TIFFfree(rasterTile);\n        work_line_buf = NULL;\n    }\n\n    sendProgress(total, total);\n    return JNI_TRUE;\n\n}\n\njboolean TiffToBmpConverter::convertFromStrip() {\n    uint32 stripSize = TIFFStripSize (tiffImage);\n    uint32 stripMax = TIFFNumberOfStrips (tiffImage);\n    int rowPerStrip = -1;\n    TIFFGetField(tiffImage, TIFFTAG_ROWSPERSTRIP, &rowPerStrip);\n\n    unsigned long estimateMem = width * sizeof(uint32);//working buf\n    estimateMem += width * rowPerStrip * sizeof (uint32);//raster\n    estimateMem += outWidth * 3 + outWidth % 4;\n    //estimateMem += 4 * width * sizeof(png_bytep); //buf for writing to png\n    LOGII(\"estimateMem\", estimateMem);\n    if (estimateMem > availableMemory && availableMemory != -1) {\n        LOGEI(\"Not enought memory\", availableMemory);\n        if (throwException) {\n            throw_not_enought_memory_exception(env, availableMemory, estimateMem);\n        }\n        return JNI_FALSE;\n    }\n\n    LOGII(\"rps\", rowPerStrip);\n    LOGII(\"sm\", stripMax);\n\n    jlong total = stripMax * rowPerStrip * width;\n    sendProgress(0, total);\n\n    uint32* work_line_buf = (uint32 *)_TIFFmalloc(width * sizeof(uint32));\n    uint32* raster = (uint32 *)_TIFFmalloc(width * rowPerStrip * sizeof (uint32));\n\n    uint32 rows_to_write = 0;\n\n    //24 bpp bmp should has with multiple 4\n    int rowSize = outWidth * 3 + outWidth % 4;\n    unsigned char *row = new unsigned char[rowSize];\n    for (int i = 0; i < stripMax*rowPerStrip; i += rowPerStrip) {\n        if (checkStop()) {\n            if (raster) {\n                _TIFFfree(raster);\n                raster = NULL;\n            }\n            if (work_line_buf) {\n                _TIFFfree(work_line_buf);\n                work_line_buf = NULL;\n            }\n            return JNI_FALSE;\n        }\n\n        if ((i < outStartY && i + rowPerStrip < outStartY) || (i >= outStartY + outHeight && i + rowPerStrip >= outStartY + outHeight)) continue;\n        LOGII(\"i\", i);\n\n        sendProgress(i * width, total);\n        TIFFReadRGBAStrip(tiffImage, i, raster);\n\n        rows_to_write = 0;\n        if( i + rowPerStrip > height )\n            rows_to_write = height - i;\n        else\n            rows_to_write = rowPerStrip;\n\n        if (origorientation <= 4) {\n            for (int line = 0; line < rows_to_write / 2; line++) {\n                unsigned int  *top_line, *bottom_line;\n                top_line = raster + width * line;\n                bottom_line = raster + width * (rows_to_write - line - 1);\n\n                _TIFFmemcpy(work_line_buf, top_line, sizeof(unsigned int) * width);\n                _TIFFmemcpy(top_line, bottom_line, sizeof(unsigned int) * width);\n                _TIFFmemcpy(bottom_line, work_line_buf, sizeof(unsigned int) * width);\n            }\n        }\n\n        if (origorientation == ORIENTATION_TOPRIGHT || origorientation == ORIENTATION_BOTRIGHT\n                || origorientation == ORIENTATION_RIGHTTOP || origorientation == ORIENTATION_RIGHTBOT) {\n\n                for (int y = 0; y < rows_to_write; y++) {\n                    for (int x = 0; x < width/2; x++) {\n                        uint32 buf = raster[y * width + x];\n                        raster[y * width + x] = raster[y * width + width - 1 - x];\n                        raster[y * width + width - 1 - x] = buf;\n                    }\n                }\n        }\n\n        int outY, outX;\n        for (int y = 0; y < rows_to_write; y++) {\n            if (i + y < outStartY || i + y >= outStartY + outHeight) continue;\n            outY = i + y - outStartY;\n            for (int x = 0; x < width * 3; x += 3) {\n                if (x < outStartX * 3 || x >= (outStartX + outWidth) * 3) continue;\n                outX = x - (outStartX*3);\n                uint32 pix = raster[y * width + x/3];\n                unsigned char *vp = (unsigned char *)&pix;\n                //in bmp colors stores as bgr\n                row[outX] = vp[2]; //red\n                row[outX+1] = vp[1]; //green\n                row[outX+2] = vp[0];   //blue\n            }\n\n            //in bmp lines stored fliped verticaly. Write lines from bottom to top\n            fseek(outFIle, 122 + (outHeight - outY - 1) * rowSize , SEEK_SET);\n            fwrite(row,rowSize,1,outFIle);\n        }\n    }\n    free(row);\n\n    if (raster) {\n        _TIFFfree(raster);\n        raster = NULL;\n    }\n\n    if (work_line_buf) {\n        _TIFFfree(work_line_buf);\n        work_line_buf = NULL;\n    }\n\n    sendProgress(total, total);\n\n    return JNI_TRUE;\n}\n\nint TiffToBmpConverter::getDecodeMethod() {\n    int method = -1;\n\tuint32 tileWidth, tileHeight;\n\tint readTW = 0, readTH = 0;\n    readTW = TIFFGetField(tiffImage, TIFFTAG_TILEWIDTH, &tileWidth);\n    readTH = TIFFGetField(tiffImage, TIFFTAG_TILELENGTH, &tileHeight);\n    if (tileWidth > 0 && tileHeight > 0 && readTH > 0 && readTW > 0) {\n        method = DECODE_METHOD_TILE;\n    } else {\n        int rowPerStrip = -1;\n    \tTIFFGetField(tiffImage, TIFFTAG_ROWSPERSTRIP, &rowPerStrip);\n    \tuint32 stripSize = TIFFStripSize (tiffImage);\n    \tuint32 stripMax = TIFFNumberOfStrips (tiffImage);\n    \tint estimate = width * 3;\n    \tLOGII(\"RPS\", rowPerStrip);\n    \tLOGII(\"stripSize\", stripSize);\n    \tLOGII(\"stripMax\", stripMax);\n    \tif (rowPerStrip != -1 && stripSize > 0 && stripMax > 1 && rowPerStrip < height) {\n    \t    method = DECODE_METHOD_STRIP;\n    \t} else {\n    \tmethod = DECODE_METHOD_IMAGE;\n    \t}\n    }\n\n\tLOGII(\"Decode method\", method);\n\treturn method;\n\n}\n"
  },
  {
    "path": "src/main/jni/TiffToBmpConverter.h",
    "content": "//\n// Created by beyka on 9/22/17.\n//\n\n#ifndef TIFFSAMPLE_TIFFTOBMPCONVERTER_H\n#define TIFFSAMPLE_TIFFTOBMPCONVERTER_H\n\n#include <stdlib.h>\n#include <stdio.h>\n#include <tiffio.h>\n#include \"fcntl.h\"\n#include \"unistd.h\"\n#include \"jpeglib.h\"\n#include <setjmp.h>\n#include \"BaseTiffConverter.h\"\n#include \"BMP.h\"\n\n#ifdef NDEBUG\n    #define LOGI(x)\n    #define LOGII(x, y)\n    #define LOGIF(x, y)\n    #define LOGIS(x, y)\n    #define LOGE(x)\n    #define LOGES(x, y)\n    #define LOGEI(x, y)\n#else\n    #define LOGI(x) __android_log_print(ANDROID_LOG_DEBUG, \"TiffToBmpConverter\", \"%s\", x)\n    #define LOGII(x, y) __android_log_print(ANDROID_LOG_DEBUG, \"TiffToBmpConverter\", \"%s %d\", x, y)\n    #define LOGIF(x, y) __android_log_print(ANDROID_LOG_DEBUG, \"TiffToBmpConverter\", \"%s %f\", x, y)\n    #define LOGIS(x, y) __android_log_print(ANDROID_LOG_DEBUG, \"TiffToBmpConverter\", \"%s %s\", x, y)\n    #define LOGE(x) __android_log_print(ANDROID_LOG_ERROR, \"TiffToBmpConverter\", \"%s\", x)\n    #define LOGES(x, y) __android_log_print(ANDROID_LOG_ERROR, \"TiffToBmpConverter\", \"%s %s\", x, y)\n    #define LOGEI(x, y) __android_log_print(ANDROID_LOG_ERROR, \"TiffToBmpConverter\", \"%s %d\", x, y)\n#endif\n\nclass TiffToBmpConverter : public BaseTiffConverter\n{\n    public:\n        explicit TiffToBmpConverter(JNIEnv *, jclass, jstring, jstring, jobject, jobject);\n        explicit TiffToBmpConverter(JNIEnv *, jclass, jint, jint, jobject, jobject);\n        ~TiffToBmpConverter();\n        virtual jboolean convert();\n\n    private:\n        static int const DECODE_METHOD_IMAGE = 1;\n        static int const DECODE_METHOD_TILE = 2;\n        static int const DECODE_METHOD_STRIP = 3;\n\n        int getDecodeMethod();\n        jboolean convertFromImage();\n        jboolean convertFromTile();\n        jboolean convertFromStrip();\n        //jboolean convertFromImageWithBounds();\n        //jboolean convertFromTileWithBounds();\n        //jboolean convertFromStripWithBounds();\n\n        TIFF *tiffImage;\n        short origorientation;\n        FILE *outFIle = NULL;\n\n        BITMAPFILEHEADER *bmpHeader;\n        BITMAPINFOHEADER *bmpInfo;\n\n\n\n};\n\n#endif //TIFFSAMPLE_TIFFTOBMPCONVERTER_H\n"
  },
  {
    "path": "src/main/jni/TiffToJpgConverter.cpp",
    "content": "//\n// Created by beyka on 5/10/17.\n//\n\n#include \"TiffToJpgConverter.h\"\n\nTiffToJpgConverter::TiffToJpgConverter(JNIEnv *e, jclass clazz, jstring in, jstring out, jobject opts, jobject listener)\n    : BaseTiffConverter(e, clazz, in, out, opts, listener)\n{\n    jpeg_struct_init = 0;\n}\n\nTiffToJpgConverter::TiffToJpgConverter(JNIEnv *e, jclass clazz, jint in, jint out, jobject opts, jobject listener)\n    : BaseTiffConverter(e, clazz, in, out, opts, listener)\n{\n    jpeg_struct_init = 0;\n}\n\nTiffToJpgConverter::~TiffToJpgConverter()\n{\n    LOGI(\"destructor\");\n    if (tiffImage) {\n        TIFFClose(tiffImage);\n        tiffImage = NULL;\n    }\n        LOGI(\"tiff\");\n\n    if (jpegFile) {\n        /*if (!conversion_result) {\n            const char *strPngPath = NULL;\n            strPngPath = env->GetStringUTFChars(outPath, 0);\n            remove(strPngPath);\n            env->ReleaseStringUTFChars(outPath, strPngPath);\n        }*/\n        fclose(jpegFile);\n    }\n    LOGI(\"file\");\n    if (jpeg_struct_init) {\n        jpeg_destroy_compress(&cinfo);\n    }\n    LOGI(\"destructor finish\");\n\n}\n\njboolean TiffToJpgConverter::convert()\n{\n    readOptions();\n    LOGI(\"Optioons read done\");\n\n    LOGII(\"inFd=\", inFd);\n    if (inFd == -1) {\n        const char *inCPath = NULL;\n        inCPath = env->GetStringUTFChars(inPath, 0);\n        LOGIS(\"IN path\", inCPath);\n        inFd = open(inCPath, O_RDWR, 0666);\n        if (inFd == -1) {\n            if (throwException) {\n                throw_cant_open_file_exception(env, inPath);\n            }\n            LOGES(\"Can\\'t open in file\", inCPath);\n            env->ReleaseStringUTFChars(inPath, inCPath);\n            return JNI_FALSE;\n        }\n        env->ReleaseStringUTFChars(inPath, inCPath);\n    }\n\n    //open tiff image for reading\n    tiffImage = TIFFFdOpen(inFd, \"\", \"r\");\n    if (tiffImage == NULL) {\n        if (throwException) {\n            if (inFd < 0) {\n                throw_cant_open_file_exception(env, inPath);\n            } else {\n                throw_cant_open_file_exception_fd(env, inFd);\n            }\n        }\n        return JNI_FALSE;\n    }\n    LOGI(\"Tiff file opened for reading\");\n\n\n    //in c++ path\n    /*const char *strTiffPath = NULL;\n    strTiffPath = env->GetStringUTFChars(inPath, 0);\n    LOGIS(\"IN path\", strTiffPath);\n\n    //open tiff image for reading\n    tiffImage = TIFFOpen(strTiffPath, \"r\");\n    if (tiffImage == NULL) {\n        if (throwException) {\n            throw_cant_open_file_exception(env, inPath);\n        }\n        LOGES(\"Can\\'t open in file\", strTiffPath);\n        env->ReleaseStringUTFChars(inPath, strTiffPath);\n        return JNI_FALSE;\n    } else {\n        env->ReleaseStringUTFChars(inPath, strTiffPath);\n    }\n    LOGI(\"Tiff file opened for reading\");*/\n\n    //open jpg file for writing\n    LOGII(\"outFd=\", outFd);\n    if(outFd == -1) {\n    LOGI(\"Opening jpg as File\");\n        //open tiff file for writing or appending\n        const char *outCPath = NULL;\n        outCPath = env->GetStringUTFChars(outPath, 0);\n        LOGIS(\"OUT path\", outCPath);\n        jpegFile = fopen(outCPath, \"w\");\n        if (!jpegFile) {\n            throw_cant_open_file_exception(env, outPath);\n            env->ReleaseStringUTFChars(outPath, outCPath);\n            return JNI_FALSE;\n        }\n    } else {\n    LOGI(\"Opening jpg as FD\");\n        jpegFile = fdopen(outFd, \"w\");\n        if (!jpegFile) {\n            LOGI(\"JPG file is null\");\n            if (throwException) {\n                throw_cant_open_file_exception_fd(env, inFd);\n            }\n            LOGES(\"Can\\'t open out file descriptor\", inFd);\n            return JNI_FALSE;\n        }\n    }\n    LOGI(\"JPG file opened\");\n    /*const char *strPngPath = NULL;\n    strPngPath = env->GetStringUTFChars(outPath, 0);\n    LOGIS(\"OUT path\", strPngPath);\n    jpegFile = fopen(strPngPath, \"wb\");\n    if (!jpegFile) {\n        if (throwException) {\n            throw_cant_open_file_exception(env, outPath);\n        }\n        LOGES(\"Can\\'t open out file\", strPngPath);\n        env->ReleaseStringUTFChars(outPath, strPngPath);\n        return JNI_FALSE;\n    } else {\n        env->ReleaseStringUTFChars(outPath, strPngPath);\n    }*/\n\n\n    LOGI(\"initialize jpeg structure\");\n    //set error handling\n    cinfo.err = jpeg_std_error(&jerr);\n    LOGI(\"initialize error handling done\");\n    //initialize jpeg compression object\n    jpeg_create_compress(&cinfo);\n    jpeg_struct_init = 1;\n    LOGI(\"initialize compress done\");\n    //set phisical file for jpeg\n    jpeg_stdio_dest(&cinfo, jpegFile);\n    LOGI(\"initialize dest file done\");\n\n    //set tiff directory and read image dimensions\n    TIFFSetDirectory(tiffImage, tiffDirectory);\n    TIFFGetField(tiffImage, TIFFTAG_IMAGEWIDTH, &width);\n    TIFFGetField(tiffImage, TIFFTAG_IMAGELENGTH, &height);\n    //Getting image orientation and createing ImageOrientation enum\n    TIFFGetField(tiffImage, TIFFTAG_ORIENTATION, &origorientation);\n    //If orientation field is empty - use ORIENTATION_TOPLEFT\n    if (origorientation == 0) {\n        origorientation = ORIENTATION_TOPLEFT;\n    }\n\n    if (!normalizeDecodeArea()) {\n        return JNI_FALSE;\n    }\n\n    LOGII(\"image width\", width);\n    LOGII(\"image height\", height);\n    LOGII(\"image bound width\", boundWidth);\n    LOGII(\"image bound height\", boundHeight);\n    LOGII(\"image out width\", outWidth);\n    LOGII(\"image out height\", outHeight);\n\n    cinfo.image_width = outWidth;\n    cinfo.image_height = outHeight;\n    cinfo.input_components = 3;\n    cinfo.in_color_space = JCS_RGB;\n\n    LOGI(\"writing img parameters done\");\n\n    jpeg_set_defaults(&cinfo);\n    LOGI(\"set defaults done\");\n    jpeg_set_quality(&cinfo, JPEG_QUALITY, TRUE /* limit to baseline-JPEG values */);\n    LOGI(\"set quality done\");\n\n    //write file header\n    jpeg_start_compress(&cinfo, TRUE);\n    LOGI(\"start compressing\");\n\n    jboolean result = JNI_FALSE;\n\n    switch(getDecodeMethod()) {\n        case DECODE_METHOD_IMAGE:\n            result = convertFromImage();\n            break;\n        case DECODE_METHOD_TILE:\n            result = convertFromTile();\n            break;\n        case DECODE_METHOD_STRIP:\n            result = convertFromStrip();\n            break;\n    }\n\n    if (result) {\n        jpeg_finish_compress(&cinfo);\n    }\n    conversion_result = result;\n    return conversion_result;\n}\n\njboolean TiffToJpgConverter::convertFromImage() {\n    int origBufferSize = width * height * sizeof(uint32);\n\n    unsigned long estimateMem = origBufferSize;\n    estimateMem += outWidth * sizeof(unsigned char) * 3;//working buf\n    LOGII(\"estimateMem\", estimateMem);\n    if (estimateMem > availableMemory && availableMemory != -1) {\n        LOGEI(\"Not enough memory\", availableMemory);\n        if (throwException) {\n            throw_not_enought_memory_exception(env, availableMemory, estimateMem);\n        }\n        return JNI_FALSE;\n    }\n\n    uint32 *origBuffer = NULL;\n    origBuffer = (uint32 *) _TIFFmalloc(origBufferSize);\n    if (origBuffer == NULL) {\n        const char *message = \"Can\\'t allocate buffer\";\n        LOGE(*message);\n        if (throwException) {\n            throw_not_enought_memory_exception(env, availableMemory, origBufferSize);\n        }\n        return JNI_FALSE;\n    }\n\n    if (0 == TIFFReadRGBAImageOriented(tiffImage, width, height, origBuffer, ORIENTATION_TOPLEFT, 0)) {\n        free(origBuffer);\n        const char *message = \"Can\\'t read tiff\";\n        if (throwException) {\n            jstring er = env->NewStringUTF(message);\n            if (outFd == -1) {\n                throw_decode_file_exception(env, outPath, er);\n            } else {\n                throw_decode_file_exception_fd(env, outFd, er);\n            }\n            env->DeleteLocalRef(er);\n        }\n        LOGE(message);\n        return JNI_FALSE;\n    }\n\n    jlong total = width * height;\n    sendProgress(0, total);\n\n    int outY, outX;\n    JSAMPROW row_pointer[1];\n    for (int y = 0; y < height; y++) {\n        if (checkStop()) {\n            free(origBuffer);\n            return JNI_FALSE;\n        }\n        sendProgress(y * width, total);\n        if (y < outStartY || y >= outStartY + outHeight) continue;\n        outY = y - outStartY;\n\n        unsigned char *row = (unsigned char*)malloc(outWidth * sizeof(unsigned char) * 3);\n\n        for (int x = 0; x < width * 3; x += 3) {\n            if (x < outStartX * 3 || x >= (outStartX + outWidth) * 3) continue;\n            outX = x - (outStartX*3);\n            uint32 pix = origBuffer[y * width + x/3];\n            unsigned char *vp = (unsigned char *)&pix;\n            row[outX] = vp[0];\n            row[outX+1] = vp[1];\n            row[outX+2] = vp[2];\n        }\n        row_pointer[0] = row;\n        jpeg_write_scanlines(&cinfo, row_pointer, 1);\n        delete(row);\n    }\n    free(origBuffer);\n    sendProgress(total, total);\n    return JNI_TRUE;\n}\n\njboolean TiffToJpgConverter::convertFromTile() {\n    uint32 tileWidth = 0, tileHeight = 0;\n    TIFFGetField(tiffImage, TIFFTAG_TILEWIDTH, &tileWidth);\n    TIFFGetField(tiffImage, TIFFTAG_TILEWIDTH, &tileHeight);\n    LOGII(\"Tile width\", tileWidth);\n    LOGII(\"Tile height\", tileHeight);\n\n    //uint32 *raster = (uint32 *)_TIFFmalloc(width * tileHeight * sizeof(uint32));\n    uint32 workingWidth = (width/tileWidth + (width%tileWidth == 0 ? 0 : 1)) * tileWidth;\n    LOGII(\"workingWidth \", workingWidth );\n    uint32 rasterSize =  workingWidth  * tileHeight ;\n    LOGII(\"rasterSize \", rasterSize );\n    //uint32 *raster = (uint32 *)_TIFFmalloc(rasterSize * sizeof(uint32));\n\n\n    unsigned long estimateMem = rasterSize * sizeof(uint32); //raster\n    estimateMem += tileWidth * tileHeight * sizeof(uint32); //tile raster\n    estimateMem += tileWidth * sizeof (uint32); //working buf\n    estimateMem += outWidth * sizeof(unsigned char) * 3; //bufer for writing to jpg\n    LOGII(\"estimateMem\", estimateMem);\n    if (estimateMem > availableMemory && availableMemory != -1) {\n        LOGEI(\"Not enought memory\", availableMemory);\n        if (throwException) {\n            throw_not_enought_memory_exception(env, availableMemory, estimateMem);\n        }\n        return JNI_FALSE;\n    }\n\n    uint32 *rasterTile = (uint32 *)_TIFFmalloc(tileWidth * tileHeight * sizeof(uint32));\n    uint32 *work_line_buf = (uint32*)_TIFFmalloc(tileWidth * sizeof (uint32));\n\n     jlong total = ((width/tileWidth + (width%tileWidth == 0 ? 0 : 1)) * tileWidth)\n                * ((height/tileHeight + (height%tileHeight == 0 ? 0 : 1)) * tileHeight);\n        sendProgress(0, total);\n\n    uint32 row, column;\n\n    int startx = -1, starty = -1, endx = -1, endy = -1;\n    uint32 imageWritedLines = 0;\n\n    for (row = 0; row < height; row += tileHeight) {\n        sendProgress(row * width, total);\n        endy = -1;\n        starty = -1;\n        uint32 *raster = (uint32 *)_TIFFmalloc(rasterSize * sizeof(uint32));\n\n        for (column = 0; column < width; column += tileWidth) {\n            if (checkStop()) {\n                free(raster);\n                raster = NULL;\n                if (rasterTile) {\n                    _TIFFfree(rasterTile);\n                    rasterTile = NULL;\n                }\n                if (work_line_buf) {\n                    _TIFFfree(rasterTile);\n                    work_line_buf = NULL;\n                }\n                return JNI_FALSE;\n            }\n            endx = -1;\n            startx = -1;\n            TIFFReadRGBATile(tiffImage, column , row, rasterTile);\n            switch(origorientation) {\n                case 1:\n                case 5:\n                    rotateTileLinesVertical(tileHeight, tileWidth, rasterTile, work_line_buf);\n                    break;\n                case 2:\n                case 6:\n                    rotateTileLinesVertical(tileHeight, tileWidth, rasterTile, work_line_buf);\n                    rotateTileLinesHorizontal(tileHeight, tileWidth, rasterTile, work_line_buf);\n                    break;\n                case 3:\n                case 7:\n                    rotateTileLinesHorizontal(tileHeight, tileWidth, rasterTile, work_line_buf);\n                    break;\n            }\n\n            normalizeTile(tileHeight, tileWidth, rasterTile);\n\n            //find start and end position\n            for (int ty = 0; ty < tileHeight; ty++) {\n\n                for (int tx = 0; tx < tileWidth; tx++) {\n                    if (rasterTile[ty * tileWidth + tx] != 0) {\n                        if (startx == -1) {\n                            startx = tx;\n                        }\n                        if (starty == -1) {\n                            starty = ty;\n                        }\n\n                        if (tx > endx)\n                            endx = tx;\n                        if (ty > endy)\n                            endy = ty;\n\n                        uint32 rasterPos = (ty ) * workingWidth + (tx + column);\n                        //LOGII(\"rp\", rasterPos);\n                        raster[rasterPos] = rasterTile[ty * tileWidth + tx];\n                    }\n\n                }\n            }\n        }\n\n        int outY, outX;\n        JSAMPROW row_pointer[1];\n        for (int y = starty; y < tileHeight; y++) {\n            if (imageWritedLines == height) break;\n            if (y + row < outStartY || y + row >= outStartY + outHeight) continue;\n            outY = y + row - outStartY;\n            unsigned char *jpgrow = (unsigned char*)malloc(outWidth * sizeof(unsigned char) * 3);\n\n           // uint32 *rasterLine = (uint32 *)malloc(width * sizeof(uint32));\n\n            //for (int x = startx, x2 = 0; x2 < width; x++, x2++) {\n            //   rasterLine[x2] = raster[y * workingWidth + x];\n            //}\n\n            for (int x = 0; x < width * 3; x += 3) {\n                if (x < outStartX * 3 || x >= (outStartX + outWidth) * 3) continue;\n                outX = x - (outStartX*3);\n                uint32 pix = raster[y * workingWidth + x/3];\n                unsigned char *vp = (unsigned char *)&pix;\n                jpgrow[outX] = vp[0];\n                jpgrow[outX+1] = vp[1];\n                jpgrow[outX+2] = vp[2];\n            }\n            row_pointer[0] = jpgrow;\n            jpeg_write_scanlines(&cinfo, row_pointer, 1);\n            delete(jpgrow);\n            //delete(rasterLine);\n\n            imageWritedLines++;\n        }\n        //LOGII(\"imageWritedLines\", imageWritedLines);\n        free(raster);\n    }\n\n    /*if (raster) {\n        _TIFFfree(raster);\n        raster = NULL;\n    }*/\n\n    if (rasterTile) {\n        _TIFFfree(rasterTile);\n        rasterTile = NULL;\n    }\n\n    if (work_line_buf) {\n        _TIFFfree(rasterTile);\n        work_line_buf = NULL;\n    }\n\n    sendProgress(total, total);\n    return JNI_TRUE;\n\n}\n\njboolean TiffToJpgConverter::convertFromStrip() {\n    uint32 stripSize = TIFFStripSize (tiffImage);\n    uint32 stripMax = TIFFNumberOfStrips (tiffImage);\n    int rowPerStrip = -1;\n    TIFFGetField(tiffImage, TIFFTAG_ROWSPERSTRIP, &rowPerStrip);\n\n    unsigned long estimateMem = width * sizeof(uint32);//working buf\n    estimateMem += width * rowPerStrip * sizeof (uint32);//raster\n    estimateMem += outWidth * sizeof(unsigned char) * 3; //buf for writing to jpg\n    LOGII(\"estimateMem\", estimateMem);\n    if (estimateMem > availableMemory && availableMemory != -1) {\n        LOGEI(\"Not enought memory\", availableMemory);\n        if (throwException) {\n            throw_not_enought_memory_exception(env, availableMemory, estimateMem);\n        }\n        return JNI_FALSE;\n    }\n\n    jlong total = stripMax * rowPerStrip * width;\n    sendProgress(0, total);\n\n    uint32* work_line_buf = (uint32 *)_TIFFmalloc(width * sizeof(uint32));\n    uint32* raster = (uint32 *)_TIFFmalloc(width * rowPerStrip * sizeof (uint32));\n\n    uint32 rows_to_write = 0;\n\n    for (int i = 0; i < stripMax*rowPerStrip; i += rowPerStrip) {\n        if (checkStop()) {\n            if (raster) {\n                _TIFFfree(raster);\n                raster = NULL;\n            }\n            if (work_line_buf) {\n                _TIFFfree(work_line_buf);\n                work_line_buf = NULL;\n            }\n            return JNI_FALSE;\n        }\n        sendProgress(i * width, total);\n        TIFFReadRGBAStrip(tiffImage, i, raster);\n\n        rows_to_write = 0;\n        if( i + rowPerStrip > height )\n            rows_to_write = height - i;\n        else\n            rows_to_write = rowPerStrip;\n\n        if (origorientation <= 4) {\n            for (int line = 0; line < rows_to_write / 2; line++) {\n                unsigned int  *top_line, *bottom_line;\n                top_line = raster + width * line;\n                bottom_line = raster + width * (rows_to_write - line - 1);\n\n                _TIFFmemcpy(work_line_buf, top_line, sizeof(unsigned int) * width);\n                _TIFFmemcpy(top_line, bottom_line, sizeof(unsigned int) * width);\n                _TIFFmemcpy(bottom_line, work_line_buf, sizeof(unsigned int) * width);\n            }\n        }\n\n        if (origorientation == ORIENTATION_TOPRIGHT || origorientation == ORIENTATION_BOTRIGHT\n                || origorientation == ORIENTATION_RIGHTTOP || origorientation == ORIENTATION_RIGHTBOT) {\n\n                for (int y = 0; y < rows_to_write; y++) {\n                    for (int x = 0; x < width/2; x++) {\n                        uint32 buf = raster[y * width + x];\n                        raster[y * width + x] = raster[y * width + width - 1 - x];\n                        raster[y * width + width - 1 - x] = buf;\n                    }\n                }\n\n        }\n        int outY, outX;\n        JSAMPROW row_pointer[1];\n        for (int y = 0; y < rows_to_write; y++) {\n            if (i + y < outStartY || i + y >= outStartY + outHeight) continue;\n            outY = i + y - outStartY;\n\n            unsigned char *jpgrow = (unsigned char*)malloc(outWidth * sizeof(unsigned char) * 3);\n\n            for (int x = 0; x < width * 3; x += 3) {\n                if (x < outStartX * 3 || x >= (outStartX + outWidth) * 3) continue;\n                outX = x - (outStartX*3);\n                uint32 pix = raster[y * width + x/3];\n                unsigned char *vp = (unsigned char *)&pix;\n                jpgrow[outX] = vp[0];\n                jpgrow[outX+1] = vp[1];\n                jpgrow[outX+2] = vp[2];\n            }\n            row_pointer[0] = jpgrow;\n            jpeg_write_scanlines(&cinfo, row_pointer, 1);\n            delete(jpgrow);\n\n            /*png_bytep row = (png_bytep)malloc(4 * width * sizeof(png_bytep));\n            memcpy(row, raster + (y * width), width * 4);\n            png_write_row(png_ptr, row);\n            delete(row);*/\n        }\n\n    }\n\n    if (raster) {\n        _TIFFfree(raster);\n        raster = NULL;\n    }\n\n    if (work_line_buf) {\n        _TIFFfree(work_line_buf);\n        work_line_buf = NULL;\n    }\n\n    sendProgress(total, total);\n\n    return JNI_TRUE;\n}\n\nint TiffToJpgConverter::getDecodeMethod() {\n    int method = -1;\n\tuint32 tileWidth, tileHeight;\n\tint readTW = 0, readTH = 0;\n    readTW = TIFFGetField(tiffImage, TIFFTAG_TILEWIDTH, &tileWidth);\n    readTH = TIFFGetField(tiffImage, TIFFTAG_TILELENGTH, &tileHeight);\n    if (tileWidth > 0 && tileHeight > 0 && readTH > 0 && readTW > 0) {\n        method = DECODE_METHOD_TILE;\n    } else {\n        int rowPerStrip = -1;\n    \tTIFFGetField(tiffImage, TIFFTAG_ROWSPERSTRIP, &rowPerStrip);\n    \tuint32 stripSize = TIFFStripSize (tiffImage);\n    \tuint32 stripMax = TIFFNumberOfStrips (tiffImage);\n    \tint estimate = width * 3;\n    \tLOGII(\"RPS\", rowPerStrip);\n    \tLOGII(\"stripSize\", stripSize);\n    \tLOGII(\"stripMax\", stripMax);\n    \tif (rowPerStrip != -1 && stripSize > 0 && stripMax > 1 && rowPerStrip < height) {\n    \t    method = DECODE_METHOD_STRIP;\n    \t} else {\n    \tmethod = DECODE_METHOD_IMAGE;\n    \t}\n    }\n\n\tLOGII(\"Decode method\", method);\n\treturn method;\n    /*int method = -1;\n\tuint32 tileWidth, tileHeight;\n\tint readTW = 0, readTH = 0;\n    readTW = TIFFGetField(tiffImage, TIFFTAG_TILEWIDTH, &tileWidth);\n    readTH = TIFFGetField(tiffImage, TIFFTAG_TILELENGTH, &tileHeight);\n    int rowPerStrip = -1;\n    TIFFGetField(tiffImage, TIFFTAG_ROWSPERSTRIP, &rowPerStrip);\n    uint32 stripSize = TIFFStripSize (tiffImage);\n    uint32 stripMax = TIFFNumberOfStrips (tiffImage);\n    int estimate = width * 3;\n    LOGII(\"RPS\", rowPerStrip);\n    LOGII(\"stripSize\", stripSize);\n    LOGII(\"stripMax\", stripMax);\n\n    if (rowPerStrip != -1 && stripSize > 0 && stripMax > 1 && rowPerStrip < height) {\n        method = DECODE_METHOD_STRIP;\n    } else if (tileWidth > 0 && tileHeight > 0 && readTH > 0 && readTW > 0) {\n        method = DECODE_METHOD_TILE;\n    } else {\n        method = DECODE_METHOD_IMAGE;\n    }\n\tLOGII(\"Decode method\", method);\n\treturn method;*/\n}\n"
  },
  {
    "path": "src/main/jni/TiffToJpgConverter.h",
    "content": "//\n// Created by beyka on 5/10/17.\n//\n\n#ifndef TIFFSAMPLE_TIFFTOJPGCONVERTER_H\n#define TIFFSAMPLE_TIFFTOJPGCONVERTER_H\n\n#include <stdlib.h>\n#include <stdio.h>\n#include <tiffio.h>\n#include \"fcntl.h\"\n#include \"unistd.h\"\n#include \"jpeglib.h\"\n#include <setjmp.h>\n#include \"BaseTiffConverter.h\"\n\n//extern \"C\" {\n//#include \"jpeglib.h\"\n//}\n\n#ifdef NDEBUG\n    #define LOGI(x)\n    #define LOGII(x, y)\n    #define LOGIF(x, y)\n    #define LOGIS(x, y)\n    #define LOGE(x)\n    #define LOGES(x, y)\n    #define LOGEI(x, y)\n#else\n    #define LOGI(x) __android_log_print(ANDROID_LOG_DEBUG, \"TiffToJpgConverter\", \"%s\", x)\n    #define LOGII(x, y) __android_log_print(ANDROID_LOG_DEBUG, \"TiffToJpgConverter\", \"%s %d\", x, y)\n    #define LOGIF(x, y) __android_log_print(ANDROID_LOG_DEBUG, \"TiffToJpgConverter\", \"%s %f\", x, y)\n    #define LOGIS(x, y) __android_log_print(ANDROID_LOG_DEBUG, \"TiffToJpgConverter\", \"%s %s\", x, y)\n    #define LOGE(x) __android_log_print(ANDROID_LOG_ERROR, \"TiffToJpgConverter\", \"%s\", x)\n    #define LOGES(x, y) __android_log_print(ANDROID_LOG_ERROR, \"TiffToJpgConverter\", \"%s %s\", x, y)\n    #define LOGEI(x, y) __android_log_print(ANDROID_LOG_ERROR, \"TiffToJpgConverter\", \"%s %d\", x, y)\n#endif\n\nclass TiffToJpgConverter : public BaseTiffConverter\n{\n    public:\n        explicit TiffToJpgConverter(JNIEnv *, jclass, jstring, jstring, jobject, jobject);\n        explicit TiffToJpgConverter(JNIEnv *, jclass, jint, jint, jobject, jobject);\n        ~TiffToJpgConverter();\n        virtual jboolean convert();\n\n    private:\n        static int const DECODE_METHOD_IMAGE = 1;\n        static int const DECODE_METHOD_TILE = 2;\n        static int const DECODE_METHOD_STRIP = 3;\n\n        static int const JPEG_QUALITY = 90;\n\n        int getDecodeMethod();\n        jboolean convertFromImage();\n        jboolean convertFromTile();\n        jboolean convertFromStrip();\n\n        TIFF *tiffImage;\n        short origorientation;\n        FILE *jpegFile = NULL;\n        char jpeg_struct_init;\n        struct jpeg_compress_struct cinfo;\n        struct jpeg_error_mgr jerr;\n\n\n\n};\n\n#endif //TIFFSAMPLE_TIFFTOJPGCONVERTER_H"
  },
  {
    "path": "src/main/jni/TiffToPngConverter.cpp",
    "content": "//\n// Created by beyka on 5/10/17.\n//\n\n#include \"TiffToPngConverter.h\"\n\nTiffToPngConverter::TiffToPngConverter(JNIEnv *e, jclass clazz, jstring in, jstring out, jobject opts, jobject listener)\n    : BaseTiffConverter(e, clazz, in, out, opts, listener)\n{\n    png_ptr_init = 0;\n    png_info_init = 0;\n}\n\nTiffToPngConverter::TiffToPngConverter(JNIEnv *e, jclass clazz, jint in, jint out, jobject opts, jobject listener)\n    : BaseTiffConverter(e, clazz, in, out, opts, listener)\n{\n    png_ptr_init = 0;\n    png_info_init = 0;\n}\n\nTiffToPngConverter::~TiffToPngConverter()\n{\n    LOGI(\"destructor start\");\n    if (tiffImage) {\n        TIFFClose(tiffImage);\n        tiffImage = NULL;\n    }\n    LOGI(\"tiff free\");\n\n    if (png_info_init) {\n        png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1);\n    }\n    LOGI(\"info_ptr free\");\n\n    if (png_ptr_init) {\n        png_destroy_write_struct(&png_ptr, NULL);\n    }\n    LOGI(\"png_ptr free\");\n\n    if (pngFile) {\n        LOGI(\"pngFile != NULL\");\n        fclose(pngFile);\n    }\n    LOGI(\"png file free\");\n}\n\njboolean TiffToPngConverter::convert()\n{\n    readOptions();\n    LOGI(\"Optioons read done\");\n\n    LOGII(\"inFd=\", inFd);\n    if (inFd == -1) {\n        const char *inCPath = NULL;\n        inCPath = env->GetStringUTFChars(inPath, 0);\n        LOGIS(\"IN path\", inCPath);\n        inFd = open(inCPath, O_RDWR, 0666);\n        if (inFd < 0) {\n            if (throwException) {\n                throw_cant_open_file_exception(env, inPath);\n            }\n            LOGES(\"Can\\'t open in file\", inCPath);\n            env->ReleaseStringUTFChars(inPath, inCPath);\n            return JNI_FALSE;\n        }\n        env->ReleaseStringUTFChars(inPath, inCPath);\n    }\n\n    //open tiff image for reading\n    tiffImage = TIFFFdOpen(inFd, \"\", \"r\");\n    if (tiffImage == NULL) {\n        if (throwException) {\n            if (inFd < 0) {\n                throw_cant_open_file_exception(env, inPath);\n            } else {\n                throw_cant_open_file_exception_fd(env, inFd);\n            }\n        }\n        return JNI_FALSE;\n    }\n    LOGI(\"Tiff file opened for reading\");\n\n    //open png file fow writing\n    LOGII(\"outFd=\", outFd);\n    if(outFd == -1) {\n    LOGI(\"Opening png as File\");\n        //open tiff file for writing or appending\n        const char *outCPath = NULL;\n        outCPath = env->GetStringUTFChars(outPath, 0);\n        LOGIS(\"OUT path\", outCPath);\n        LOGIS(\"nativeTiffOpenForSave\", outCPath);\n\n        pngFile = fopen(outCPath, \"w\");\n        if (!pngFile) {\n            throw_cant_open_file_exception(env, outPath);\n            env->ReleaseStringUTFChars(outPath, outCPath);\n            return JNI_FALSE;\n        }\n    } else {\n    LOGI(\"Opening png as FD\");\n        pngFile = fdopen(outFd, \"w\");\n        if (!pngFile) {\n            LOGI(\"PNG file is null\");\n            if (throwException) {\n                throw_cant_open_file_exception_fd(env, inFd);\n            }\n            LOGES(\"Can\\'t open out file descriptor\", inFd);\n            return JNI_FALSE;\n        }\n    }\n    LOGI(\"PNG file opened\");\n\n    //create png structure pointer\n    png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);\n    if (!png_ptr) {\n        const char *message = \"Can\\'t create PNG structure\";\n        LOGE(*message);\n        if (throwException) {\n            jstring er = env->NewStringUTF(message);\n            if (outFd == -1) {\n                throw_decode_file_exception(env, outPath, er);\n            } else {\n                throw_decode_file_exception_fd(env, outFd, er);\n            }\n            env->DeleteLocalRef(er);\n        }\n        return JNI_FALSE;\n    }\n    png_ptr_init = 1;\n\n    //create png info pointer\n    info_ptr = png_create_info_struct(png_ptr);\n    if (!info_ptr) {\n        const char *message = \"Can\\'t create PNG info structure\";\n        LOGE(*message);\n        if (throwException) {\n            jstring er = env->NewStringUTF(message);\n            if  (outFd == -1) {\n                throw_decode_file_exception(env, outPath, er);\n            } else {\n                throw_decode_file_exception_fd(env, outFd, er);\n            }\n            env->DeleteLocalRef(er);\n        }\n        return JNI_FALSE;\n    }\n    png_info_init = 1;\n\n    //png error handler\n    if (setjmp(png_jmpbuf(png_ptr))) {\n        const char *message = \"Error creating PNG\";\n        LOGE(message);\n        if (throwException) {\n            jstring er = env->NewStringUTF(message);\n            if (outFd == -1) {\n                throw_decode_file_exception(env, outPath, er);\n            } else {\n                throw_decode_file_exception_fd(env, outFd, er);\n            }\n            env->DeleteLocalRef(er);\n        }\n        return JNI_FALSE;\n    }\n\n    //Init PNG IO\n    png_init_io(png_ptr, pngFile);\n\n    //set tiff directory and read image dimensions\n    TIFFSetDirectory(tiffImage, tiffDirectory);\n    TIFFGetField(tiffImage, TIFFTAG_IMAGEWIDTH, &width);\n    TIFFGetField(tiffImage, TIFFTAG_IMAGELENGTH, &height);\n    //Getting image orientation and createing ImageOrientation enum\n    TIFFGetField(tiffImage, TIFFTAG_ORIENTATION, &origorientation);\n    //If orientation field is empty - use ORIENTATION_TOPLEFT\n    if (origorientation == 0) {\n        origorientation = ORIENTATION_TOPLEFT;\n    }\n    LOGII(\"image width\", width);\n    LOGII(\"image height\", height);\n\n    if (!normalizeDecodeArea()) {\n        return JNI_FALSE;\n    }\n\n    //set png data\n    png_set_IHDR(png_ptr, info_ptr, outWidth, outHeight, 8, PNG_COLOR_TYPE_RGB_ALPHA,\n                PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT,\n                PNG_FILTER_TYPE_DEFAULT);\n\n                LOGI(\"png_set_IHDR done\");\n\n    //write file header\n    png_write_info(png_ptr, info_ptr);\n    LOGI(\"png_write_info done\");\n\n    png_set_flush(png_ptr, 32);\n\n    jboolean result = JNI_FALSE;\n\n    switch(getDecodeMethod()) {\n        case DECODE_METHOD_IMAGE:\n            result = convertFromImage();\n            break;\n        case DECODE_METHOD_TILE:\n            result = convertFromTile();\n            break;\n        case DECODE_METHOD_STRIP:\n            result = convertFromStrip();\n            break;\n    }\n\n    if (result) {\n        png_write_end(png_ptr, info_ptr);\n    }\n    conversion_result = result;\n    return conversion_result;\n}\n\njboolean TiffToPngConverter::convertFromImage() {\n    int origBufferSize = width * height * sizeof(uint32);\n\n    unsigned long estimateMem = origBufferSize;\n    estimateMem += 4 * outWidth * sizeof(png_bytep);//working buf\n    LOGII(\"estimateMem\", estimateMem);\n    if (estimateMem > availableMemory && availableMemory != -1) {\n        LOGEI(\"Not enough memory\", availableMemory);\n        if (throwException) {\n            throw_not_enought_memory_exception(env, availableMemory, estimateMem);\n        }\n        return JNI_FALSE;\n    }\n\n    uint32 *origBuffer = NULL;\n    origBuffer = (uint32 *) _TIFFmalloc(origBufferSize);\n    if (origBuffer == NULL) {\n        const char *message = \"Can\\'t allocate buffer\";\n        LOGE(*message);\n        if (throwException) {\n            throw_not_enought_memory_exception(env, availableMemory, origBufferSize);\n        }\n        return JNI_FALSE;\n    }\n\n    if (0 == TIFFReadRGBAImageOriented(tiffImage, width, height, origBuffer, ORIENTATION_TOPLEFT, 0)) {\n        free(origBuffer);\n        const char *message = \"Can\\'t read tiff\";\n        if (throwException) {\n            jstring er = env->NewStringUTF(message);\n            if (outFd == -1) {\n                throw_decode_file_exception(env, outPath, er);\n            } else {\n                throw_decode_file_exception_fd(env, outFd, er);\n            }\n            env->DeleteLocalRef(er);\n        }\n        LOGE(message);\n        return JNI_FALSE;\n    }\n\n    jlong total = width * height;\n    sendProgress(0, total);\n\n    int outY, outX;\n\n    for (int y = 0; y < height; y++) {\n        if (y < outStartY || y >= outStartY + outHeight) continue;\n        if (checkStop()) {\n            free(origBuffer);\n            return JNI_FALSE;\n        }\n        outY = y - outStartY;\n        sendProgress(y * width, total);\n\n        png_bytep row = (png_bytep)malloc(4 * outWidth * sizeof(png_bytep));\n        memcpy(row, origBuffer + (y * width + outStartX), outWidth * 4);\n        png_write_row(png_ptr, row);\n        delete(row);\n    }\n    free(origBuffer);\n    sendProgress(total, total);\n    return JNI_TRUE;\n}\n\njboolean TiffToPngConverter::convertFromTile() {\n    uint32 tileWidth = 0, tileHeight = 0;\n    TIFFGetField(tiffImage, TIFFTAG_TILEWIDTH, &tileWidth);\n    TIFFGetField(tiffImage, TIFFTAG_TILEWIDTH, &tileHeight);\n    LOGII(\"Tile width\", tileWidth);\n    LOGII(\"Tile height\", tileHeight);\n\n    //uint32 *raster = (uint32 *)_TIFFmalloc(width * tileHeight * sizeof(uint32));\n    uint32 workingWidth = (width/tileWidth + (width%tileWidth == 0 ? 0 : 1)) * tileWidth;\n    LOGII(\"workingWidth \", workingWidth );\n    uint32 rasterSize =  workingWidth  * tileHeight ;\n    LOGII(\"rasterSize \", rasterSize );\n    //uint32 *raster = (uint32 *)_TIFFmalloc(rasterSize * sizeof(uint32));\n\n\n    unsigned long estimateMem = rasterSize * sizeof(uint32); //raster\n    estimateMem += tileWidth * tileHeight * sizeof(uint32); //tile raster\n    estimateMem += tileWidth * sizeof (uint32); //working buf\n    estimateMem += 4 * outWidth * sizeof(png_bytep); //bufer for writing to png\n    LOGII(\"estimateMem\", estimateMem);\n    if (estimateMem > availableMemory && availableMemory != -1) {\n        LOGEI(\"Not enought memory\", availableMemory);\n        if (throwException) {\n            throw_not_enought_memory_exception(env, availableMemory, estimateMem);\n        }\n        return JNI_FALSE;\n    }\n\n    uint32 *rasterTile = (uint32 *)_TIFFmalloc(tileWidth * tileHeight * sizeof(uint32));\n    uint32 *work_line_buf = (uint32*)_TIFFmalloc(tileWidth * sizeof (uint32));\n\n    jlong total = ((width/tileWidth + (width%tileWidth == 0 ? 0 : 1)) * tileWidth)\n                * ((height/tileHeight + (height%tileHeight == 0 ? 0 : 1)) * tileHeight);\n        sendProgress(0, total);\n\n    uint32 row, column;\n\n    int startx = -1, starty = -1, endx = -1, endy = -1;\n    uint32 imageWritedLines = 0;\n\n    for (row = 0; row < height; row += tileHeight) {\n        sendProgress(row * width, total);\n        endy = -1;\n        starty = -1;\n        uint32 *raster = (uint32 *)_TIFFmalloc(rasterSize * sizeof(uint32));\n\n        for (column = 0; column < width; column += tileWidth) {\n            if (checkStop()) {\n                free(raster);\n                raster = NULL;\n                if (rasterTile) {\n                    _TIFFfree(rasterTile);\n                    rasterTile = NULL;\n                }\n                if (work_line_buf) {\n                    _TIFFfree(rasterTile);\n                    work_line_buf = NULL;\n                }\n                return JNI_FALSE;\n            }\n            endx = -1;\n            startx = -1;\n            TIFFReadRGBATile(tiffImage, column , row, rasterTile);\n            switch(origorientation) {\n                case 1:\n                case 5:\n                    rotateTileLinesVertical(tileHeight, tileWidth, rasterTile, work_line_buf);\n                    break;\n                case 2:\n                case 6:\n                    rotateTileLinesVertical(tileHeight, tileWidth, rasterTile, work_line_buf);\n                    rotateTileLinesHorizontal(tileHeight, tileWidth, rasterTile, work_line_buf);\n                    break;\n                case 3:\n                case 7:\n                {\n                    rotateTileLinesHorizontal(tileHeight, tileWidth, rasterTile, work_line_buf);\n\n                    break;\n                    }\n            }\n\n            normalizeTile(tileHeight, tileWidth, rasterTile);\n\n\n            //find start and end position\n            for (int ty = 0; ty < tileHeight; ty++) {\n\n                for (int tx = 0; tx < tileWidth; tx++) {\n                    if (rasterTile[ty * tileWidth + tx] != 0) {\n                        if (startx == -1) {\n                            startx = tx;\n                        }\n                        if (starty == -1) {\n                            starty = ty;\n                        }\n\n                        if (tx > endx)\n                            endx = tx;\n                        if (ty > endy)\n                            endy = ty;\n\n                        uint32 rasterPos = (ty ) * workingWidth + (tx + column);\n                        //LOGII(\"rp\", rasterPos);\n                        raster[rasterPos] = rasterTile[ty * tileWidth + tx];\n                    }\n\n                }\n            }\n        }\n\n        int outY, outX;\n        for (int y = starty; y < tileHeight; y++) {\n            if (imageWritedLines == height) break;\n            if (y + row < outStartY || y + row >= outStartY + outHeight) continue;\n            outY = y + row - outStartY;\n            //create temp raster and write there pixels than not null\n            png_bytep pngrow = (png_bytep)malloc(4 * outWidth * sizeof(png_bytep));\n            memcpy(pngrow, raster + y * workingWidth + outStartX, outWidth * 4);\n            //memcpy(pngrow, rasterLine, width * 4);\n            png_write_row(png_ptr, pngrow);\n            free(pngrow);\n            //delete(rasterLine);\n            imageWritedLines++;\n        }\n        //LOGII(\"imageWritedLines\", imageWritedLines);\n\n        free(raster);\n\n    }\n\n    /*if (raster) {\n        _TIFFfree(raster);\n        raster = NULL;\n    }*/\n\n    if (rasterTile) {\n        _TIFFfree(rasterTile);\n        rasterTile = NULL;\n    }\n\n    if (work_line_buf) {\n        _TIFFfree(rasterTile);\n        work_line_buf = NULL;\n    }\n\n    sendProgress(total, total);\n\n    return JNI_TRUE;\n\n}\n\njboolean TiffToPngConverter::convertFromStrip() {\n    uint32 stripSize = TIFFStripSize (tiffImage);\n    uint32 stripMax = TIFFNumberOfStrips (tiffImage);\n    int rowPerStrip = -1;\n    TIFFGetField(tiffImage, TIFFTAG_ROWSPERSTRIP, &rowPerStrip);\n    LOGII(\"RPS\", rowPerStrip);\n\n    unsigned long estimateMem = width * sizeof(uint32);//working buf\n    estimateMem += width * rowPerStrip * sizeof (uint32);//raster\n    estimateMem += 4 * outWidth * sizeof(png_bytep); //buf for writing to png\n    LOGII(\"estimateMem\", estimateMem);\n    if (estimateMem > availableMemory && availableMemory != -1) {\n        LOGEI(\"Not enought memory\", availableMemory);\n        if (throwException) {\n            throw_not_enought_memory_exception(env, availableMemory, estimateMem);\n        }\n        return JNI_FALSE;\n    }\n\n    jlong total = stripMax * rowPerStrip * width;\n    sendProgress(0, total);\n\n    uint32* work_line_buf = (uint32 *)_TIFFmalloc(width * sizeof(uint32));\n    uint32* raster = (uint32 *)_TIFFmalloc(width * rowPerStrip * sizeof (uint32));\n\n    uint32 rows_to_write = 0;\n\n    for (int i = 0; i < stripMax*rowPerStrip; i += rowPerStrip) {\n        if (checkStop()) {\n            if (raster) {\n                _TIFFfree(raster);\n                raster = NULL;\n            }\n            if (work_line_buf) {\n                _TIFFfree(work_line_buf);\n                work_line_buf = NULL;\n            }\n            return JNI_FALSE;\n        }\n        sendProgress(i * width, total);\n        TIFFReadRGBAStrip(tiffImage, i, raster);\n\n        rows_to_write = 0;\n        if( i + rowPerStrip > height )\n            rows_to_write = height - i;\n        else\n            rows_to_write = rowPerStrip;\n\n        if (origorientation <= 4) {\n            for (int line = 0; line < rows_to_write / 2; line++) {\n                unsigned int  *top_line, *bottom_line;\n                top_line = raster + width * line;\n                bottom_line = raster + width * (rows_to_write - line - 1);\n\n                _TIFFmemcpy(work_line_buf, top_line, sizeof(unsigned int) * width);\n                _TIFFmemcpy(top_line, bottom_line, sizeof(unsigned int) * width);\n                _TIFFmemcpy(bottom_line, work_line_buf, sizeof(unsigned int) * width);\n            }\n        }\n\n        if (origorientation == ORIENTATION_TOPRIGHT || origorientation == ORIENTATION_BOTRIGHT\n                || origorientation == ORIENTATION_RIGHTTOP || origorientation == ORIENTATION_RIGHTBOT) {\n\n                for (int y = 0; y < rows_to_write; y++) {\n                    for (int x = 0; x < width/2; x++) {\n                        uint32 buf = raster[y * width + x];\n                        raster[y * width + x] = raster[y * width + width - 1 - x];\n                        raster[y * width + width - 1 - x] = buf;\n                    }\n                }\n\n        }\n\n        int outY, outX;\n        for (int y = 0; y < rows_to_write; y++) {\n            if (i + y < outStartY || i + y >= outStartY + outHeight) continue;\n            outY = i + y - outStartY;\n            LOGII(\"out Y\", outY);\n            png_bytep pngrow = (png_bytep)malloc(4 * outWidth * sizeof(png_bytep));\n            memcpy(pngrow, raster + y * width + outStartX, outWidth * 4);\n            png_write_row(png_ptr, pngrow);\n            free(pngrow);\n        }\n\n    }\n\n    if (raster) {\n        _TIFFfree(raster);\n        raster = NULL;\n    }\n\n    if (work_line_buf) {\n        _TIFFfree(work_line_buf);\n        work_line_buf = NULL;\n    }\n\n    sendProgress(total, total);\n\n    return JNI_TRUE;\n}\n\nint TiffToPngConverter::getDecodeMethod() {\n    int method = -1;\n\tuint32 tileWidth, tileHeight;\n\tint readTW = 0, readTH = 0;\n    readTW = TIFFGetField(tiffImage, TIFFTAG_TILEWIDTH, &tileWidth);\n    readTH = TIFFGetField(tiffImage, TIFFTAG_TILELENGTH, &tileHeight);\n    if (tileWidth > 0 && tileHeight > 0 && readTH > 0 && readTW > 0) {\n        method = DECODE_METHOD_TILE;\n    } else {\n        int rowPerStrip = -1;\n    \tTIFFGetField(tiffImage, TIFFTAG_ROWSPERSTRIP, &rowPerStrip);\n    \tuint32 stripSize = TIFFStripSize (tiffImage);\n    \tuint32 stripMax = TIFFNumberOfStrips (tiffImage);\n    \tint estimate = width * 3;\n    \tLOGII(\"RPS\", rowPerStrip);\n    \tLOGII(\"stripSize\", stripSize);\n    \tLOGII(\"stripMax\", stripMax);\n    \tif (rowPerStrip != -1 && stripSize > 0 && stripMax > 1 && rowPerStrip < height) {\n    \t    method = DECODE_METHOD_STRIP;\n    \t} else {\n    \tmethod = DECODE_METHOD_IMAGE;\n    \t}\n    }\n\n\tLOGII(\"Decode method\", method);\n\treturn method;\n}\n"
  },
  {
    "path": "src/main/jni/TiffToPngConverter.h",
    "content": "//\n// Created by beyka on 5/10/17.\n//\n\n#ifndef TIFFSAMPLE_TIFFTOPNGCONVERTER_H\n#define TIFFSAMPLE_TIFFTOPNGCONVERTER_H\n\n#include <stdlib.h>\n#include <stdio.h>\n#include <tiffio.h>\n#include \"fcntl.h\"\n#include \"unistd.h\"\n#include <png.h>\n#include <setjmp.h>\n#include \"BaseTiffConverter.h\"\n\n#ifdef NDEBUG\n    #define LOGI(x)\n    #define LOGII(x, y)\n    #define LOGIF(x, y)\n    #define LOGIS(x, y)\n    #define LOGE(x)\n    #define LOGES(x, y)\n    #define LOGEI(x, y)\n#else\n    #define LOGI(x) __android_log_print(ANDROID_LOG_DEBUG, \"TiffToPngConverter\", \"%s\", x)\n    #define LOGII(x, y) __android_log_print(ANDROID_LOG_DEBUG, \"TiffToPngConverter\", \"%s %d\", x, y)\n    #define LOGIF(x, y) __android_log_print(ANDROID_LOG_DEBUG, \"TiffToPngConverter\", \"%s %f\", x, y)\n    #define LOGIS(x, y) __android_log_print(ANDROID_LOG_DEBUG, \"TiffToPngConverter\", \"%s %s\", x, y)\n    #define LOGE(x) __android_log_print(ANDROID_LOG_ERROR, \"TiffToPngConverter\", \"%s\", x)\n    #define LOGES(x, y) __android_log_print(ANDROID_LOG_ERROR, \"TiffToPngConverter\", \"%s %s\", x, y)\n    #define LOGEI(x, y) __android_log_print(ANDROID_LOG_ERROR, \"TiffToPngConverter\", \"%s %d\", x, y)\n#endif\n\nclass TiffToPngConverter : public BaseTiffConverter\n{\n    public:\n        explicit TiffToPngConverter(JNIEnv *, jclass, jstring, jstring, jobject, jobject);\n        explicit TiffToPngConverter(JNIEnv *, jclass, jint, jint, jobject, jobject);\n        ~TiffToPngConverter();\n        virtual jboolean convert();\n\n    private:\n        static int const DECODE_METHOD_IMAGE = 1;\n        static int const DECODE_METHOD_TILE = 2;\n        static int const DECODE_METHOD_STRIP = 3;\n\n        int getDecodeMethod();\n        jboolean convertFromImage();\n        jboolean convertFromTile();\n        jboolean convertFromStrip();\n\n\n        TIFF *tiffImage;\n        short origorientation;\n        FILE *pngFile = NULL;;\n        char png_ptr_init;\n        png_structp png_ptr;\n        char png_info_init;\n        png_infop info_ptr;\n\n};\n\n#endif //TIFFSAMPLE_TIFFTOPNGCONVERTER_H"
  },
  {
    "path": "src/main/jni/jpeg/jconfig.h",
    "content": "/* android jconfig.h */\n/*\n * jconfig.doc\n *\n * Copyright (C) 1991-1994, Thomas G. Lane.\n * This file is part of the Independent JPEG Group's software.\n * For conditions of distribution and use, see the accompanying README file.\n *\n * This file documents the configuration options that are required to\n * customize the JPEG software for a particular system.\n *\n * The actual configuration options for a particular installation are stored\n * in jconfig.h.  On many machines, jconfig.h can be generated automatically\n * or copied from one of the \"canned\" jconfig files that we supply.  But if\n * you need to generate a jconfig.h file by hand, this file tells you how.\n *\n * DO NOT EDIT THIS FILE --- IT WON'T ACCOMPLISH ANYTHING.\n * EDIT A COPY NAMED JCONFIG.H.\n */\n\n\n/*\n * These symbols indicate the properties of your machine or compiler.\n * #define the symbol if yes, #undef it if no.\n */\n\n/* Does your compiler support function prototypes?\n * (If not, you also need to use ansi2knr, see install.doc)\n */\n#define HAVE_PROTOTYPES\n\n/* Does your compiler support the declaration \"unsigned char\" ?\n * How about \"unsigned short\" ?\n */\n#define HAVE_UNSIGNED_CHAR\n#define HAVE_UNSIGNED_SHORT\n\n/* Define \"void\" as \"char\" if your compiler doesn't know about type void.\n * NOTE: be sure to define void such that \"void *\" represents the most general\n * pointer type, e.g., that returned by malloc().\n */\n/* #define void char */\n\n/* Define \"const\" as empty if your compiler doesn't know the \"const\" keyword.\n */\n/* #define const */\n\n/* Define this if an ordinary \"char\" type is unsigned.\n * If you're not sure, leaving it undefined will work at some cost in speed.\n * If you defined HAVE_UNSIGNED_CHAR then the speed difference is minimal.\n */\n#undef CHAR_IS_UNSIGNED\n\n/* Define this if your system has an ANSI-conforming <stddef.h> file.\n */\n#define HAVE_STDDEF_H\n\n/* Define this if your system has an ANSI-conforming <stdlib.h> file.\n */\n#define HAVE_STDLIB_H\n\n/* Define this if your system does not have an ANSI/SysV <string.h>,\n * but does have a BSD-style <strings.h>.\n */\n#undef NEED_BSD_STRINGS\n\n/* Define this if your system does not provide typedef size_t in any of the\n * ANSI-standard places (stddef.h, stdlib.h, or stdio.h), but places it in\n * <sys/types.h> instead.\n */\n#undef NEED_SYS_TYPES_H\n\n/* For 80x86 machines, you need to define NEED_FAR_POINTERS,\n * unless you are using a large-data memory model or 80386 flat-memory mode.\n * On less brain-damaged CPUs this symbol must not be defined.\n * (Defining this symbol causes large data structures to be referenced through\n * \"far\" pointers and to be allocated with a special version of malloc.)\n */\n#undef NEED_FAR_POINTERS\n\n/* Define this if your linker needs global names to be unique in less\n * than the first 15 characters.\n */\n#undef NEED_SHORT_EXTERNAL_NAMES\n\n/* Although a real ANSI C compiler can deal perfectly well with pointers to\n * unspecified structures (see \"incomplete types\" in the spec), a few pre-ANSI\n * and pseudo-ANSI compilers get confused.  To keep one of these bozos happy,\n * define INCOMPLETE_TYPES_BROKEN.  This is not recommended unless you\n * actually get \"missing structure definition\" warnings or errors while\n * compiling the JPEG code.\n */\n#undef INCOMPLETE_TYPES_BROKEN\n\n\n/*\n * The following options affect code selection within the JPEG library,\n * but they don't need to be visible to applications using the library.\n * To minimize application namespace pollution, the symbols won't be\n * defined unless JPEG_INTERNALS has been defined.\n */\n\n#ifdef JPEG_INTERNALS\n\n/* Define this if your compiler implements \">>\" on signed values as a logical\n * (unsigned) shift; leave it undefined if \">>\" is a signed (arithmetic) shift,\n * which is the normal and rational definition.\n */\n#undef RIGHT_SHIFT_IS_UNSIGNED\n\n\n#endif /* JPEG_INTERNALS */\n\n\n/*\n * The remaining options do not affect the JPEG library proper,\n * but only the sample applications cjpeg/djpeg (see cjpeg.c, djpeg.c).\n * Other applications can ignore these.\n */\n\n#ifdef JPEG_CJPEG_DJPEG\n\n/* These defines indicate which image (non-JPEG) file formats are allowed. */\n\n#define BMP_SUPPORTED\t\t/* BMP image file format */\n#define GIF_SUPPORTED\t\t/* GIF image file format */\n#define PPM_SUPPORTED\t\t/* PBMPLUS PPM/PGM image file format */\n#undef RLE_SUPPORTED\t\t/* Utah RLE image file format */\n#define TARGA_SUPPORTED\t\t/* Targa image file format */\n\n/* Define this if you want to name both input and output files on the command\n * line, rather than using stdout and optionally stdin.  You MUST do this if\n * your system can't cope with binary I/O to stdin/stdout.  See comments at\n * head of cjpeg.c or djpeg.c.\n */\n#undef TWO_FILE_COMMANDLINE\n\n/* Define this if your system needs explicit cleanup of temporary files.\n * This is crucial under MS-DOS, where the temporary \"files\" may be areas\n * of extended memory; on most other systems it's not as important.\n */\n#undef NEED_SIGNAL_CATCHER\n\n/* By default, we open image files with fopen(...,\"rb\") or fopen(...,\"wb\").\n * This is necessary on systems that distinguish text files from binary files,\n * and is harmless on most systems that don't.  If you have one of the rare\n * systems that complains about the \"b\" spec, define this symbol.\n */\n#undef DONT_USE_B_MODE\n\n/* Define this if you want percent-done progress reports from cjpeg/djpeg.\n */\n#undef PROGRESS_REPORT\n\n\n#endif /* JPEG_CJPEG_DJPEG */\n"
  },
  {
    "path": "src/main/jni/jpeg/jerror.h",
    "content": "/*\n * jerror.h\n *\n * Copyright (C) 1994-1997, Thomas G. Lane.\n * Modified 1997-2012 by Guido Vollbeding.\n * This file is part of the Independent JPEG Group's software.\n * For conditions of distribution and use, see the accompanying README file.\n *\n * This file defines the error and message codes for the JPEG library.\n * Edit this file to add new codes, or to translate the message strings to\n * some other language.\n * A set of error-reporting macros are defined too.  Some applications using\n * the JPEG library may wish to include this file to get the error codes\n * and/or the macros.\n */\n\n/*\n * To define the enum list of message codes, include this file without\n * defining macro JMESSAGE.  To create a message string table, include it\n * again with a suitable JMESSAGE definition (see jerror.c for an example).\n */\n#ifndef JMESSAGE\n#ifndef JERROR_H\n/* First time through, define the enum list */\n#define JMAKE_ENUM_LIST\n#else\n/* Repeated inclusions of this file are no-ops unless JMESSAGE is defined */\n#define JMESSAGE(code,string)\n#endif /* JERROR_H */\n#endif /* JMESSAGE */\n\n#ifdef JMAKE_ENUM_LIST\n\ntypedef enum {\n\n#define JMESSAGE(code,string)\tcode ,\n\n#endif /* JMAKE_ENUM_LIST */\n\nJMESSAGE(JMSG_NOMESSAGE, \"Bogus message code %d\") /* Must be first entry! */\n\n/* For maintenance convenience, list is alphabetical by message code name */\nJMESSAGE(JERR_BAD_ALIGN_TYPE, \"ALIGN_TYPE is wrong, please fix\")\nJMESSAGE(JERR_BAD_ALLOC_CHUNK, \"MAX_ALLOC_CHUNK is wrong, please fix\")\nJMESSAGE(JERR_BAD_BUFFER_MODE, \"Bogus buffer control mode\")\nJMESSAGE(JERR_BAD_COMPONENT_ID, \"Invalid component ID %d in SOS\")\nJMESSAGE(JERR_BAD_CROP_SPEC, \"Invalid crop request\")\nJMESSAGE(JERR_BAD_DCT_COEF, \"DCT coefficient out of range\")\nJMESSAGE(JERR_BAD_DCTSIZE, \"DCT scaled block size %dx%d not supported\")\nJMESSAGE(JERR_BAD_DROP_SAMPLING,\n\t \"Component index %d: mismatching sampling ratio %d:%d, %d:%d, %c\")\nJMESSAGE(JERR_BAD_HUFF_TABLE, \"Bogus Huffman table definition\")\nJMESSAGE(JERR_BAD_IN_COLORSPACE, \"Bogus input colorspace\")\nJMESSAGE(JERR_BAD_J_COLORSPACE, \"Bogus JPEG colorspace\")\nJMESSAGE(JERR_BAD_LENGTH, \"Bogus marker length\")\nJMESSAGE(JERR_BAD_LIB_VERSION,\n\t \"Wrong JPEG library version: library is %d, caller expects %d\")\nJMESSAGE(JERR_BAD_MCU_SIZE, \"Sampling factors too large for interleaved scan\")\nJMESSAGE(JERR_BAD_POOL_ID, \"Invalid memory pool code %d\")\nJMESSAGE(JERR_BAD_PRECISION, \"Unsupported JPEG data precision %d\")\nJMESSAGE(JERR_BAD_PROGRESSION,\n\t \"Invalid progressive parameters Ss=%d Se=%d Ah=%d Al=%d\")\nJMESSAGE(JERR_BAD_PROG_SCRIPT,\n\t \"Invalid progressive parameters at scan script entry %d\")\nJMESSAGE(JERR_BAD_SAMPLING, \"Bogus sampling factors\")\nJMESSAGE(JERR_BAD_SCAN_SCRIPT, \"Invalid scan script at entry %d\")\nJMESSAGE(JERR_BAD_STATE, \"Improper call to JPEG library in state %d\")\nJMESSAGE(JERR_BAD_STRUCT_SIZE,\n\t \"JPEG parameter struct mismatch: library thinks size is %u, caller expects %u\")\nJMESSAGE(JERR_BAD_VIRTUAL_ACCESS, \"Bogus virtual array access\")\nJMESSAGE(JERR_BUFFER_SIZE, \"Buffer passed to JPEG library is too small\")\nJMESSAGE(JERR_CANT_SUSPEND, \"Suspension not allowed here\")\nJMESSAGE(JERR_CCIR601_NOTIMPL, \"CCIR601 sampling not implemented yet\")\nJMESSAGE(JERR_COMPONENT_COUNT, \"Too many color components: %d, max %d\")\nJMESSAGE(JERR_CONVERSION_NOTIMPL, \"Unsupported color conversion request\")\nJMESSAGE(JERR_DAC_INDEX, \"Bogus DAC index %d\")\nJMESSAGE(JERR_DAC_VALUE, \"Bogus DAC value 0x%x\")\nJMESSAGE(JERR_DHT_INDEX, \"Bogus DHT index %d\")\nJMESSAGE(JERR_DQT_INDEX, \"Bogus DQT index %d\")\nJMESSAGE(JERR_EMPTY_IMAGE, \"Empty JPEG image (DNL not supported)\")\nJMESSAGE(JERR_EMS_READ, \"Read from EMS failed\")\nJMESSAGE(JERR_EMS_WRITE, \"Write to EMS failed\")\nJMESSAGE(JERR_EOI_EXPECTED, \"Didn't expect more than one scan\")\nJMESSAGE(JERR_FILE_READ, \"Input file read error\")\nJMESSAGE(JERR_FILE_WRITE, \"Output file write error --- out of disk space?\")\nJMESSAGE(JERR_FRACT_SAMPLE_NOTIMPL, \"Fractional sampling not implemented yet\")\nJMESSAGE(JERR_HUFF_CLEN_OVERFLOW, \"Huffman code size table overflow\")\nJMESSAGE(JERR_HUFF_MISSING_CODE, \"Missing Huffman code table entry\")\nJMESSAGE(JERR_IMAGE_TOO_BIG, \"Maximum supported image dimension is %u pixels\")\nJMESSAGE(JERR_INPUT_EMPTY, \"Empty input file\")\nJMESSAGE(JERR_INPUT_EOF, \"Premature end of input file\")\nJMESSAGE(JERR_MISMATCHED_QUANT_TABLE,\n\t \"Cannot transcode due to multiple use of quantization table %d\")\nJMESSAGE(JERR_MISSING_DATA, \"Scan script does not transmit all data\")\nJMESSAGE(JERR_MODE_CHANGE, \"Invalid color quantization mode change\")\nJMESSAGE(JERR_NOTIMPL, \"Not implemented yet\")\nJMESSAGE(JERR_NOT_COMPILED, \"Requested feature was omitted at compile time\")\nJMESSAGE(JERR_NO_ARITH_TABLE, \"Arithmetic table 0x%02x was not defined\")\nJMESSAGE(JERR_NO_BACKING_STORE, \"Backing store not supported\")\nJMESSAGE(JERR_NO_HUFF_TABLE, \"Huffman table 0x%02x was not defined\")\nJMESSAGE(JERR_NO_IMAGE, \"JPEG datastream contains no image\")\nJMESSAGE(JERR_NO_QUANT_TABLE, \"Quantization table 0x%02x was not defined\")\nJMESSAGE(JERR_NO_SOI, \"Not a JPEG file: starts with 0x%02x 0x%02x\")\nJMESSAGE(JERR_OUT_OF_MEMORY, \"Insufficient memory (case %d)\")\nJMESSAGE(JERR_QUANT_COMPONENTS,\n\t \"Cannot quantize more than %d color components\")\nJMESSAGE(JERR_QUANT_FEW_COLORS, \"Cannot quantize to fewer than %d colors\")\nJMESSAGE(JERR_QUANT_MANY_COLORS, \"Cannot quantize to more than %d colors\")\nJMESSAGE(JERR_SOF_BEFORE, \"Invalid JPEG file structure: %s before SOF\")\nJMESSAGE(JERR_SOF_DUPLICATE, \"Invalid JPEG file structure: two SOF markers\")\nJMESSAGE(JERR_SOF_NO_SOS, \"Invalid JPEG file structure: missing SOS marker\")\nJMESSAGE(JERR_SOF_UNSUPPORTED, \"Unsupported JPEG process: SOF type 0x%02x\")\nJMESSAGE(JERR_SOI_DUPLICATE, \"Invalid JPEG file structure: two SOI markers\")\nJMESSAGE(JERR_TFILE_CREATE, \"Failed to create temporary file %s\")\nJMESSAGE(JERR_TFILE_READ, \"Read failed on temporary file\")\nJMESSAGE(JERR_TFILE_SEEK, \"Seek failed on temporary file\")\nJMESSAGE(JERR_TFILE_WRITE,\n\t \"Write failed on temporary file --- out of disk space?\")\nJMESSAGE(JERR_TOO_LITTLE_DATA, \"Application transferred too few scanlines\")\nJMESSAGE(JERR_UNKNOWN_MARKER, \"Unsupported marker type 0x%02x\")\nJMESSAGE(JERR_VIRTUAL_BUG, \"Virtual array controller messed up\")\nJMESSAGE(JERR_WIDTH_OVERFLOW, \"Image too wide for this implementation\")\nJMESSAGE(JERR_XMS_READ, \"Read from XMS failed\")\nJMESSAGE(JERR_XMS_WRITE, \"Write to XMS failed\")\nJMESSAGE(JMSG_COPYRIGHT, JCOPYRIGHT)\nJMESSAGE(JMSG_VERSION, JVERSION)\nJMESSAGE(JTRC_16BIT_TABLES,\n\t \"Caution: quantization tables are too coarse for baseline JPEG\")\nJMESSAGE(JTRC_ADOBE,\n\t \"Adobe APP14 marker: version %d, flags 0x%04x 0x%04x, transform %d\")\nJMESSAGE(JTRC_APP0, \"Unknown APP0 marker (not JFIF), length %u\")\nJMESSAGE(JTRC_APP14, \"Unknown APP14 marker (not Adobe), length %u\")\nJMESSAGE(JTRC_DAC, \"Define Arithmetic Table 0x%02x: 0x%02x\")\nJMESSAGE(JTRC_DHT, \"Define Huffman Table 0x%02x\")\nJMESSAGE(JTRC_DQT, \"Define Quantization Table %d  precision %d\")\nJMESSAGE(JTRC_DRI, \"Define Restart Interval %u\")\nJMESSAGE(JTRC_EMS_CLOSE, \"Freed EMS handle %u\")\nJMESSAGE(JTRC_EMS_OPEN, \"Obtained EMS handle %u\")\nJMESSAGE(JTRC_EOI, \"End Of Image\")\nJMESSAGE(JTRC_HUFFBITS, \"        %3d %3d %3d %3d %3d %3d %3d %3d\")\nJMESSAGE(JTRC_JFIF, \"JFIF APP0 marker: version %d.%02d, density %dx%d  %d\")\nJMESSAGE(JTRC_JFIF_BADTHUMBNAILSIZE,\n\t \"Warning: thumbnail image size does not match data length %u\")\nJMESSAGE(JTRC_JFIF_EXTENSION,\n\t \"JFIF extension marker: type 0x%02x, length %u\")\nJMESSAGE(JTRC_JFIF_THUMBNAIL, \"    with %d x %d thumbnail image\")\nJMESSAGE(JTRC_MISC_MARKER, \"Miscellaneous marker 0x%02x, length %u\")\nJMESSAGE(JTRC_PARMLESS_MARKER, \"Unexpected marker 0x%02x\")\nJMESSAGE(JTRC_QUANTVALS, \"        %4u %4u %4u %4u %4u %4u %4u %4u\")\nJMESSAGE(JTRC_QUANT_3_NCOLORS, \"Quantizing to %d = %d*%d*%d colors\")\nJMESSAGE(JTRC_QUANT_NCOLORS, \"Quantizing to %d colors\")\nJMESSAGE(JTRC_QUANT_SELECTED, \"Selected %d colors for quantization\")\nJMESSAGE(JTRC_RECOVERY_ACTION, \"At marker 0x%02x, recovery action %d\")\nJMESSAGE(JTRC_RST, \"RST%d\")\nJMESSAGE(JTRC_SMOOTH_NOTIMPL,\n\t \"Smoothing not supported with nonstandard sampling ratios\")\nJMESSAGE(JTRC_SOF, \"Start Of Frame 0x%02x: width=%u, height=%u, components=%d\")\nJMESSAGE(JTRC_SOF_COMPONENT, \"    Component %d: %dhx%dv q=%d\")\nJMESSAGE(JTRC_SOI, \"Start of Image\")\nJMESSAGE(JTRC_SOS, \"Start Of Scan: %d components\")\nJMESSAGE(JTRC_SOS_COMPONENT, \"    Component %d: dc=%d ac=%d\")\nJMESSAGE(JTRC_SOS_PARAMS, \"  Ss=%d, Se=%d, Ah=%d, Al=%d\")\nJMESSAGE(JTRC_TFILE_CLOSE, \"Closed temporary file %s\")\nJMESSAGE(JTRC_TFILE_OPEN, \"Opened temporary file %s\")\nJMESSAGE(JTRC_THUMB_JPEG,\n\t \"JFIF extension marker: JPEG-compressed thumbnail image, length %u\")\nJMESSAGE(JTRC_THUMB_PALETTE,\n\t \"JFIF extension marker: palette thumbnail image, length %u\")\nJMESSAGE(JTRC_THUMB_RGB,\n\t \"JFIF extension marker: RGB thumbnail image, length %u\")\nJMESSAGE(JTRC_UNKNOWN_IDS,\n\t \"Unrecognized component IDs %d %d %d, assuming YCbCr\")\nJMESSAGE(JTRC_XMS_CLOSE, \"Freed XMS handle %u\")\nJMESSAGE(JTRC_XMS_OPEN, \"Obtained XMS handle %u\")\nJMESSAGE(JWRN_ADOBE_XFORM, \"Unknown Adobe color transform code %d\")\nJMESSAGE(JWRN_ARITH_BAD_CODE, \"Corrupt JPEG data: bad arithmetic code\")\nJMESSAGE(JWRN_BOGUS_PROGRESSION,\n\t \"Inconsistent progression sequence for component %d coefficient %d\")\nJMESSAGE(JWRN_EXTRANEOUS_DATA,\n\t \"Corrupt JPEG data: %u extraneous bytes before marker 0x%02x\")\nJMESSAGE(JWRN_HIT_MARKER, \"Corrupt JPEG data: premature end of data segment\")\nJMESSAGE(JWRN_HUFF_BAD_CODE, \"Corrupt JPEG data: bad Huffman code\")\nJMESSAGE(JWRN_JFIF_MAJOR, \"Warning: unknown JFIF revision number %d.%02d\")\nJMESSAGE(JWRN_JPEG_EOF, \"Premature end of JPEG file\")\nJMESSAGE(JWRN_MUST_RESYNC,\n\t \"Corrupt JPEG data: found marker 0x%02x instead of RST%d\")\nJMESSAGE(JWRN_NOT_SEQUENTIAL, \"Invalid SOS parameters for sequential JPEG\")\nJMESSAGE(JWRN_TOO_MUCH_DATA, \"Application transferred too many scanlines\")\n\n#ifdef JMAKE_ENUM_LIST\n\n  JMSG_LASTMSGCODE\n} J_MESSAGE_CODE;\n\n#undef JMAKE_ENUM_LIST\n#endif /* JMAKE_ENUM_LIST */\n\n/* Zap JMESSAGE macro so that future re-inclusions do nothing by default */\n#undef JMESSAGE\n\n\n#ifndef JERROR_H\n#define JERROR_H\n\n/* Macros to simplify using the error and trace message stuff */\n/* The first parameter is either type of cinfo pointer */\n\n/* Fatal errors (print message and exit) */\n#define ERREXIT(cinfo,code)  \\\n  ((cinfo)->err->msg_code = (code), \\\n   (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))\n#define ERREXIT1(cinfo,code,p1)  \\\n  ((cinfo)->err->msg_code = (code), \\\n   (cinfo)->err->msg_parm.i[0] = (p1), \\\n   (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))\n#define ERREXIT2(cinfo,code,p1,p2)  \\\n  ((cinfo)->err->msg_code = (code), \\\n   (cinfo)->err->msg_parm.i[0] = (p1), \\\n   (cinfo)->err->msg_parm.i[1] = (p2), \\\n   (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))\n#define ERREXIT3(cinfo,code,p1,p2,p3)  \\\n  ((cinfo)->err->msg_code = (code), \\\n   (cinfo)->err->msg_parm.i[0] = (p1), \\\n   (cinfo)->err->msg_parm.i[1] = (p2), \\\n   (cinfo)->err->msg_parm.i[2] = (p3), \\\n   (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))\n#define ERREXIT4(cinfo,code,p1,p2,p3,p4)  \\\n  ((cinfo)->err->msg_code = (code), \\\n   (cinfo)->err->msg_parm.i[0] = (p1), \\\n   (cinfo)->err->msg_parm.i[1] = (p2), \\\n   (cinfo)->err->msg_parm.i[2] = (p3), \\\n   (cinfo)->err->msg_parm.i[3] = (p4), \\\n   (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))\n#define ERREXIT6(cinfo,code,p1,p2,p3,p4,p5,p6)  \\\n  ((cinfo)->err->msg_code = (code), \\\n   (cinfo)->err->msg_parm.i[0] = (p1), \\\n   (cinfo)->err->msg_parm.i[1] = (p2), \\\n   (cinfo)->err->msg_parm.i[2] = (p3), \\\n   (cinfo)->err->msg_parm.i[3] = (p4), \\\n   (cinfo)->err->msg_parm.i[4] = (p5), \\\n   (cinfo)->err->msg_parm.i[5] = (p6), \\\n   (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))\n#define ERREXITS(cinfo,code,str)  \\\n  ((cinfo)->err->msg_code = (code), \\\n   strncpy((cinfo)->err->msg_parm.s, (str), JMSG_STR_PARM_MAX), \\\n   (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))\n\n#define MAKESTMT(stuff)\t\tdo { stuff } while (0)\n\n/* Nonfatal errors (we can keep going, but the data is probably corrupt) */\n#define WARNMS(cinfo,code)  \\\n  ((cinfo)->err->msg_code = (code), \\\n   (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), -1))\n#define WARNMS1(cinfo,code,p1)  \\\n  ((cinfo)->err->msg_code = (code), \\\n   (cinfo)->err->msg_parm.i[0] = (p1), \\\n   (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), -1))\n#define WARNMS2(cinfo,code,p1,p2)  \\\n  ((cinfo)->err->msg_code = (code), \\\n   (cinfo)->err->msg_parm.i[0] = (p1), \\\n   (cinfo)->err->msg_parm.i[1] = (p2), \\\n   (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), -1))\n\n/* Informational/debugging messages */\n#define TRACEMS(cinfo,lvl,code)  \\\n  ((cinfo)->err->msg_code = (code), \\\n   (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)))\n#define TRACEMS1(cinfo,lvl,code,p1)  \\\n  ((cinfo)->err->msg_code = (code), \\\n   (cinfo)->err->msg_parm.i[0] = (p1), \\\n   (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)))\n#define TRACEMS2(cinfo,lvl,code,p1,p2)  \\\n  ((cinfo)->err->msg_code = (code), \\\n   (cinfo)->err->msg_parm.i[0] = (p1), \\\n   (cinfo)->err->msg_parm.i[1] = (p2), \\\n   (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)))\n#define TRACEMS3(cinfo,lvl,code,p1,p2,p3)  \\\n  MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \\\n\t   _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); \\\n\t   (cinfo)->err->msg_code = (code); \\\n\t   (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); )\n#define TRACEMS4(cinfo,lvl,code,p1,p2,p3,p4)  \\\n  MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \\\n\t   _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \\\n\t   (cinfo)->err->msg_code = (code); \\\n\t   (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); )\n#define TRACEMS5(cinfo,lvl,code,p1,p2,p3,p4,p5)  \\\n  MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \\\n\t   _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \\\n\t   _mp[4] = (p5); \\\n\t   (cinfo)->err->msg_code = (code); \\\n\t   (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); )\n#define TRACEMS8(cinfo,lvl,code,p1,p2,p3,p4,p5,p6,p7,p8)  \\\n  MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \\\n\t   _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \\\n\t   _mp[4] = (p5); _mp[5] = (p6); _mp[6] = (p7); _mp[7] = (p8); \\\n\t   (cinfo)->err->msg_code = (code); \\\n\t   (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); )\n#define TRACEMSS(cinfo,lvl,code,str)  \\\n  ((cinfo)->err->msg_code = (code), \\\n   strncpy((cinfo)->err->msg_parm.s, (str), JMSG_STR_PARM_MAX), \\\n   (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)))\n\n#endif /* JERROR_H */\n"
  },
  {
    "path": "src/main/jni/jpeg/jmorecfg.h",
    "content": "/*\n * jmorecfg.h\n *\n * Copyright (C) 1991-1997, Thomas G. Lane.\n * Modified 1997-2012 by Guido Vollbeding.\n * This file is part of the Independent JPEG Group's software.\n * For conditions of distribution and use, see the accompanying README file.\n *\n * This file contains additional configuration options that customize the\n * JPEG software for special applications or support machine-dependent\n * optimizations.  Most users will not need to touch this file.\n */\n\n\n/*\n * Define BITS_IN_JSAMPLE as either\n *   8   for 8-bit sample values (the usual setting)\n *   12  for 12-bit sample values\n * Only 8 and 12 are legal data precisions for lossy JPEG according to the\n * JPEG standard, and the IJG code does not support anything else!\n * We do not support run-time selection of data precision, sorry.\n */\n\n#define BITS_IN_JSAMPLE  8\t/* use 8 or 12 */\n\n\n/*\n * Maximum number of components (color channels) allowed in JPEG image.\n * To meet the letter of the JPEG spec, set this to 255.  However, darn\n * few applications need more than 4 channels (maybe 5 for CMYK + alpha\n * mask).  We recommend 10 as a reasonable compromise; use 4 if you are\n * really short on memory.  (Each allowed component costs a hundred or so\n * bytes of storage, whether actually used in an image or not.)\n */\n\n#define MAX_COMPONENTS  10\t/* maximum number of image components */\n\n\n/*\n * Basic data types.\n * You may need to change these if you have a machine with unusual data\n * type sizes; for example, \"char\" not 8 bits, \"short\" not 16 bits,\n * or \"long\" not 32 bits.  We don't care whether \"int\" is 16 or 32 bits,\n * but it had better be at least 16.\n */\n\n/* Representation of a single sample (pixel element value).\n * We frequently allocate large arrays of these, so it's important to keep\n * them small.  But if you have memory to burn and access to char or short\n * arrays is very slow on your hardware, you might want to change these.\n */\n\n#if BITS_IN_JSAMPLE == 8\n/* JSAMPLE should be the smallest type that will hold the values 0..255.\n * You can use a signed char by having GETJSAMPLE mask it with 0xFF.\n */\n\n#ifdef HAVE_UNSIGNED_CHAR\n\ntypedef unsigned char JSAMPLE;\n#define GETJSAMPLE(value)  ((int) (value))\n\n#else /* not HAVE_UNSIGNED_CHAR */\n\ntypedef char JSAMPLE;\n#ifdef CHAR_IS_UNSIGNED\n#define GETJSAMPLE(value)  ((int) (value))\n#else\n#define GETJSAMPLE(value)  ((int) (value) & 0xFF)\n#endif /* CHAR_IS_UNSIGNED */\n\n#endif /* HAVE_UNSIGNED_CHAR */\n\n#define MAXJSAMPLE\t255\n#define CENTERJSAMPLE\t128\n\n#endif /* BITS_IN_JSAMPLE == 8 */\n\n\n#if BITS_IN_JSAMPLE == 12\n/* JSAMPLE should be the smallest type that will hold the values 0..4095.\n * On nearly all machines \"short\" will do nicely.\n */\n\ntypedef short JSAMPLE;\n#define GETJSAMPLE(value)  ((int) (value))\n\n#define MAXJSAMPLE\t4095\n#define CENTERJSAMPLE\t2048\n\n#endif /* BITS_IN_JSAMPLE == 12 */\n\n\n/* Representation of a DCT frequency coefficient.\n * This should be a signed value of at least 16 bits; \"short\" is usually OK.\n * Again, we allocate large arrays of these, but you can change to int\n * if you have memory to burn and \"short\" is really slow.\n */\n\ntypedef short JCOEF;\n\n\n/* Compressed datastreams are represented as arrays of JOCTET.\n * These must be EXACTLY 8 bits wide, at least once they are written to\n * external storage.  Note that when using the stdio data source/destination\n * managers, this is also the data type passed to fread/fwrite.\n */\n\n#ifdef HAVE_UNSIGNED_CHAR\n\ntypedef unsigned char JOCTET;\n#define GETJOCTET(value)  (value)\n\n#else /* not HAVE_UNSIGNED_CHAR */\n\ntypedef char JOCTET;\n#ifdef CHAR_IS_UNSIGNED\n#define GETJOCTET(value)  (value)\n#else\n#define GETJOCTET(value)  ((value) & 0xFF)\n#endif /* CHAR_IS_UNSIGNED */\n\n#endif /* HAVE_UNSIGNED_CHAR */\n\n\n/* These typedefs are used for various table entries and so forth.\n * They must be at least as wide as specified; but making them too big\n * won't cost a huge amount of memory, so we don't provide special\n * extraction code like we did for JSAMPLE.  (In other words, these\n * typedefs live at a different point on the speed/space tradeoff curve.)\n */\n\n/* UINT8 must hold at least the values 0..255. */\n\n#ifdef HAVE_UNSIGNED_CHAR\ntypedef unsigned char UINT8;\n#else /* not HAVE_UNSIGNED_CHAR */\n#ifdef CHAR_IS_UNSIGNED\ntypedef char UINT8;\n#else /* not CHAR_IS_UNSIGNED */\ntypedef short UINT8;\n#endif /* CHAR_IS_UNSIGNED */\n#endif /* HAVE_UNSIGNED_CHAR */\n\n/* UINT16 must hold at least the values 0..65535. */\n\n#ifdef HAVE_UNSIGNED_SHORT\ntypedef unsigned short UINT16;\n#else /* not HAVE_UNSIGNED_SHORT */\ntypedef unsigned int UINT16;\n#endif /* HAVE_UNSIGNED_SHORT */\n\n/* INT16 must hold at least the values -32768..32767. */\n\n#ifndef XMD_H\t\t\t/* X11/xmd.h correctly defines INT16 */\ntypedef short INT16;\n#endif\n\n/* INT32 must hold at least signed 32-bit values. */\n\n#ifndef XMD_H\t\t\t/* X11/xmd.h correctly defines INT32 */\n#ifndef _BASETSD_H_\t\t/* Microsoft defines it in basetsd.h */\n#ifndef _BASETSD_H\t\t/* MinGW is slightly different */\n#ifndef QGLOBAL_H\t\t/* Qt defines it in qglobal.h */\ntypedef long INT32;\n#endif\n#endif\n#endif\n#endif\n\n/* Datatype used for image dimensions.  The JPEG standard only supports\n * images up to 64K*64K due to 16-bit fields in SOF markers.  Therefore\n * \"unsigned int\" is sufficient on all machines.  However, if you need to\n * handle larger images and you don't mind deviating from the spec, you\n * can change this datatype.\n */\n\ntypedef unsigned int JDIMENSION;\n\n#define JPEG_MAX_DIMENSION  65500L  /* a tad under 64K to prevent overflows */\n\n\n/* These macros are used in all function definitions and extern declarations.\n * You could modify them if you need to change function linkage conventions;\n * in particular, you'll need to do that to make the library a Windows DLL.\n * Another application is to make all functions global for use with debuggers\n * or code profilers that require it.\n */\n\n/* a function called through method pointers: */\n#define METHODDEF(type)\t\tstatic type\n/* a function used only in its module: */\n#define LOCAL(type)\t\tstatic type\n/* a function referenced thru EXTERNs: */\n#define GLOBAL(type)\t\ttype\n/* a reference to a GLOBAL function: */\n#define EXTERN(type)\t\textern type\n\n\n/* This macro is used to declare a \"method\", that is, a function pointer.\n * We want to supply prototype parameters if the compiler can cope.\n * Note that the arglist parameter must be parenthesized!\n * Again, you can customize this if you need special linkage keywords.\n */\n\n#ifdef HAVE_PROTOTYPES\n#define JMETHOD(type,methodname,arglist)  type (*methodname) arglist\n#else\n#define JMETHOD(type,methodname,arglist)  type (*methodname) ()\n#endif\n\n\n/* The noreturn type identifier is used to declare functions\n * which cannot return.\n * Compilers can thus create more optimized code and perform\n * better checks for warnings and errors.\n * Static analyzer tools can make improved inferences about\n * execution paths and are prevented from giving false alerts.\n *\n * Unfortunately, the proposed specifications of corresponding\n * extensions in the Dec 2011 ISO C standard revision (C11),\n * GCC, MSVC, etc. are not viable.\n * Thus we introduce a user defined type to declare noreturn\n * functions at least for clarity.  A proper compiler would\n * have a suitable noreturn type to match in place of void.\n */\n\n#ifndef HAVE_NORETURN_T\ntypedef void noreturn_t;\n#endif\n\n\n/* Here is the pseudo-keyword for declaring pointers that must be \"far\"\n * on 80x86 machines.  Most of the specialized coding for 80x86 is handled\n * by just saying \"FAR *\" where such a pointer is needed.  In a few places\n * explicit coding is needed; see uses of the NEED_FAR_POINTERS symbol.\n */\n\n#ifndef FAR\n#ifdef NEED_FAR_POINTERS\n#define FAR  far\n#else\n#define FAR\n#endif\n#endif\n\n\n/*\n * On a few systems, type boolean and/or its values FALSE, TRUE may appear\n * in standard header files.  Or you may have conflicts with application-\n * specific header files that you want to include together with these files.\n * Defining HAVE_BOOLEAN before including jpeglib.h should make it work.\n */\n\n#ifndef HAVE_BOOLEAN\ntypedef int boolean;\n#endif\n#ifndef FALSE\t\t\t/* in case these macros already exist */\n#define FALSE\t0\t\t/* values of boolean */\n#endif\n#ifndef TRUE\n#define TRUE\t1\n#endif\n\n\n/*\n * The remaining options affect code selection within the JPEG library,\n * but they don't need to be visible to most applications using the library.\n * To minimize application namespace pollution, the symbols won't be\n * defined unless JPEG_INTERNALS or JPEG_INTERNAL_OPTIONS has been defined.\n */\n\n#ifdef JPEG_INTERNALS\n#define JPEG_INTERNAL_OPTIONS\n#endif\n\n#ifdef JPEG_INTERNAL_OPTIONS\n\n\n/*\n * These defines indicate whether to include various optional functions.\n * Undefining some of these symbols will produce a smaller but less capable\n * library.  Note that you can leave certain source files out of the\n * compilation/linking process if you've #undef'd the corresponding symbols.\n * (You may HAVE to do that if your compiler doesn't like null source files.)\n */\n\n/* Capability options common to encoder and decoder: */\n\n#define DCT_ISLOW_SUPPORTED\t/* slow but accurate integer algorithm */\n#define DCT_IFAST_SUPPORTED\t/* faster, less accurate integer method */\n#define DCT_FLOAT_SUPPORTED\t/* floating-point: accurate, fast on fast HW */\n\n/* Encoder capability options: */\n\n#define C_ARITH_CODING_SUPPORTED    /* Arithmetic coding back end? */\n#define C_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */\n#define C_PROGRESSIVE_SUPPORTED\t    /* Progressive JPEG? (Requires MULTISCAN)*/\n#define DCT_SCALING_SUPPORTED\t    /* Input rescaling via DCT? (Requires DCT_ISLOW)*/\n#define ENTROPY_OPT_SUPPORTED\t    /* Optimization of entropy coding parms? */\n/* Note: if you selected 12-bit data precision, it is dangerous to turn off\n * ENTROPY_OPT_SUPPORTED.  The standard Huffman tables are only good for 8-bit\n * precision, so jchuff.c normally uses entropy optimization to compute\n * usable tables for higher precision.  If you don't want to do optimization,\n * you'll have to supply different default Huffman tables.\n * The exact same statements apply for progressive JPEG: the default tables\n * don't work for progressive mode.  (This may get fixed, however.)\n */\n#define INPUT_SMOOTHING_SUPPORTED   /* Input image smoothing option? */\n\n/* Decoder capability options: */\n\n#define D_ARITH_CODING_SUPPORTED    /* Arithmetic coding back end? */\n#define D_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */\n#define D_PROGRESSIVE_SUPPORTED\t    /* Progressive JPEG? (Requires MULTISCAN)*/\n#define IDCT_SCALING_SUPPORTED\t    /* Output rescaling via IDCT? */\n#define SAVE_MARKERS_SUPPORTED\t    /* jpeg_save_markers() needed? */\n#define BLOCK_SMOOTHING_SUPPORTED   /* Block smoothing? (Progressive only) */\n#undef  UPSAMPLE_SCALING_SUPPORTED  /* Output rescaling at upsample stage? */\n#define UPSAMPLE_MERGING_SUPPORTED  /* Fast path for sloppy upsampling? */\n#define QUANT_1PASS_SUPPORTED\t    /* 1-pass color quantization? */\n#define QUANT_2PASS_SUPPORTED\t    /* 2-pass color quantization? */\n\n/* more capability options later, no doubt */\n\n\n/*\n * Ordering of RGB data in scanlines passed to or from the application.\n * If your application wants to deal with data in the order B,G,R, just\n * change these macros.  You can also deal with formats such as R,G,B,X\n * (one extra byte per pixel) by changing RGB_PIXELSIZE.  Note that changing\n * the offsets will also change the order in which colormap data is organized.\n * RESTRICTIONS:\n * 1. The sample applications cjpeg,djpeg do NOT support modified RGB formats.\n * 2. The color quantizer modules will not behave desirably if RGB_PIXELSIZE\n *    is not 3 (they don't understand about dummy color components!).  So you\n *    can't use color quantization if you change that value.\n */\n\n#define RGB_RED\t\t0\t/* Offset of Red in an RGB scanline element */\n#define RGB_GREEN\t1\t/* Offset of Green */\n#define RGB_BLUE\t2\t/* Offset of Blue */\n#define RGB_PIXELSIZE\t3\t/* JSAMPLEs per RGB scanline element */\n\n\n/* Definitions for speed-related optimizations. */\n\n\n/* If your compiler supports inline functions, define INLINE\n * as the inline keyword; otherwise define it as empty.\n */\n\n#ifndef INLINE\n#ifdef __GNUC__\t\t\t/* for instance, GNU C knows about inline */\n#define INLINE __inline__\n#endif\n#ifndef INLINE\n#define INLINE\t\t\t/* default is to define it as empty */\n#endif\n#endif\n\n\n/* On some machines (notably 68000 series) \"int\" is 32 bits, but multiplying\n * two 16-bit shorts is faster than multiplying two ints.  Define MULTIPLIER\n * as short on such a machine.  MULTIPLIER must be at least 16 bits wide.\n */\n\n#ifndef MULTIPLIER\n#define MULTIPLIER  int\t\t/* type for fastest integer multiply */\n#endif\n\n\n/* FAST_FLOAT should be either float or double, whichever is done faster\n * by your compiler.  (Note that this type is only used in the floating point\n * DCT routines, so it only matters if you've defined DCT_FLOAT_SUPPORTED.)\n * Typically, float is faster in ANSI C compilers, while double is faster in\n * pre-ANSI compilers (because they insist on converting to double anyway).\n * The code below therefore chooses float if we have ANSI-style prototypes.\n */\n\n#ifndef FAST_FLOAT\n#ifdef HAVE_PROTOTYPES\n#define FAST_FLOAT  float\n#else\n#define FAST_FLOAT  double\n#endif\n#endif\n\n#endif /* JPEG_INTERNAL_OPTIONS */\n"
  },
  {
    "path": "src/main/jni/jpeg/jpeglib.h",
    "content": "/*\n * jpeglib.h\n *\n * Copyright (C) 1991-1998, Thomas G. Lane.\n * Modified 2002-2012 by Guido Vollbeding.\n * This file is part of the Independent JPEG Group's software.\n * For conditions of distribution and use, see the accompanying README file.\n *\n * This file defines the application interface for the JPEG library.\n * Most applications using the library need only include this file,\n * and perhaps jerror.h if they want to know the exact error codes.\n */\n\n#ifndef JPEGLIB_H\n#define JPEGLIB_H\n\n/*\n * First we include the configuration files that record how this\n * installation of the JPEG library is set up.  jconfig.h can be\n * generated automatically for many systems.  jmorecfg.h contains\n * manual configuration options that most people need not worry about.\n */\n\n#ifndef JCONFIG_INCLUDED\t/* in case jinclude.h already did */\n#include \"jconfig.h\"\t\t/* widely used configuration options */\n#endif\n#include \"jmorecfg.h\"\t\t/* seldom changed options */\n\n\n#ifdef __cplusplus\n#ifndef DONT_USE_EXTERN_C\nextern \"C\" {\n#endif\n#endif\n\n/* Version IDs for the JPEG library.\n * Might be useful for tests like \"#if JPEG_LIB_VERSION >= 90\".\n */\n\n#define JPEG_LIB_VERSION        90\t/* Compatibility version 9.0 */\n#define JPEG_LIB_VERSION_MAJOR  9\n#define JPEG_LIB_VERSION_MINOR  0\n\n\n/* Various constants determining the sizes of things.\n * All of these are specified by the JPEG standard, so don't change them\n * if you want to be compatible.\n */\n\n#define DCTSIZE\t\t    8\t/* The basic DCT block is 8x8 coefficients */\n#define DCTSIZE2\t    64\t/* DCTSIZE squared; # of elements in a block */\n#define NUM_QUANT_TBLS      4\t/* Quantization tables are numbered 0..3 */\n#define NUM_HUFF_TBLS       4\t/* Huffman tables are numbered 0..3 */\n#define NUM_ARITH_TBLS      16\t/* Arith-coding tables are numbered 0..15 */\n#define MAX_COMPS_IN_SCAN   4\t/* JPEG limit on # of components in one scan */\n#define MAX_SAMP_FACTOR     4\t/* JPEG limit on sampling factors */\n/* Unfortunately, some bozo at Adobe saw no reason to be bound by the standard;\n * the PostScript DCT filter can emit files with many more than 10 blocks/MCU.\n * If you happen to run across such a file, you can up D_MAX_BLOCKS_IN_MCU\n * to handle it.  We even let you do this from the jconfig.h file.  However,\n * we strongly discourage changing C_MAX_BLOCKS_IN_MCU; just because Adobe\n * sometimes emits noncompliant files doesn't mean you should too.\n */\n#define C_MAX_BLOCKS_IN_MCU   10 /* compressor's limit on blocks per MCU */\n#ifndef D_MAX_BLOCKS_IN_MCU\n#define D_MAX_BLOCKS_IN_MCU   10 /* decompressor's limit on blocks per MCU */\n#endif\n\n\n/* Data structures for images (arrays of samples and of DCT coefficients).\n * On 80x86 machines, the image arrays are too big for near pointers,\n * but the pointer arrays can fit in near memory.\n */\n\ntypedef JSAMPLE FAR *JSAMPROW;\t/* ptr to one image row of pixel samples. */\ntypedef JSAMPROW *JSAMPARRAY;\t/* ptr to some rows (a 2-D sample array) */\ntypedef JSAMPARRAY *JSAMPIMAGE;\t/* a 3-D sample array: top index is color */\n\ntypedef JCOEF JBLOCK[DCTSIZE2];\t/* one block of coefficients */\ntypedef JBLOCK FAR *JBLOCKROW;\t/* pointer to one row of coefficient blocks */\ntypedef JBLOCKROW *JBLOCKARRAY;\t\t/* a 2-D array of coefficient blocks */\ntypedef JBLOCKARRAY *JBLOCKIMAGE;\t/* a 3-D array of coefficient blocks */\n\ntypedef JCOEF FAR *JCOEFPTR;\t/* useful in a couple of places */\n\n\n/* Types for JPEG compression parameters and working tables. */\n\n\n/* DCT coefficient quantization tables. */\n\ntypedef struct {\n  /* This array gives the coefficient quantizers in natural array order\n   * (not the zigzag order in which they are stored in a JPEG DQT marker).\n   * CAUTION: IJG versions prior to v6a kept this array in zigzag order.\n   */\n  UINT16 quantval[DCTSIZE2];\t/* quantization step for each coefficient */\n  /* This field is used only during compression.  It's initialized FALSE when\n   * the table is created, and set TRUE when it's been output to the file.\n   * You could suppress output of a table by setting this to TRUE.\n   * (See jpeg_suppress_tables for an example.)\n   */\n  boolean sent_table;\t\t/* TRUE when table has been output */\n} JQUANT_TBL;\n\n\n/* Huffman coding tables. */\n\ntypedef struct {\n  /* These two fields directly represent the contents of a JPEG DHT marker */\n  UINT8 bits[17];\t\t/* bits[k] = # of symbols with codes of */\n\t\t\t\t/* length k bits; bits[0] is unused */\n  UINT8 huffval[256];\t\t/* The symbols, in order of incr code length */\n  /* This field is used only during compression.  It's initialized FALSE when\n   * the table is created, and set TRUE when it's been output to the file.\n   * You could suppress output of a table by setting this to TRUE.\n   * (See jpeg_suppress_tables for an example.)\n   */\n  boolean sent_table;\t\t/* TRUE when table has been output */\n} JHUFF_TBL;\n\n\n/* Basic info about one component (color channel). */\n\ntypedef struct {\n  /* These values are fixed over the whole image. */\n  /* For compression, they must be supplied by parameter setup; */\n  /* for decompression, they are read from the SOF marker. */\n  int component_id;\t\t/* identifier for this component (0..255) */\n  int component_index;\t\t/* its index in SOF or cinfo->comp_info[] */\n  int h_samp_factor;\t\t/* horizontal sampling factor (1..4) */\n  int v_samp_factor;\t\t/* vertical sampling factor (1..4) */\n  int quant_tbl_no;\t\t/* quantization table selector (0..3) */\n  /* These values may vary between scans. */\n  /* For compression, they must be supplied by parameter setup; */\n  /* for decompression, they are read from the SOS marker. */\n  /* The decompressor output side may not use these variables. */\n  int dc_tbl_no;\t\t/* DC entropy table selector (0..3) */\n  int ac_tbl_no;\t\t/* AC entropy table selector (0..3) */\n  \n  /* Remaining fields should be treated as private by applications. */\n  \n  /* These values are computed during compression or decompression startup: */\n  /* Component's size in DCT blocks.\n   * Any dummy blocks added to complete an MCU are not counted; therefore\n   * these values do not depend on whether a scan is interleaved or not.\n   */\n  JDIMENSION width_in_blocks;\n  JDIMENSION height_in_blocks;\n  /* Size of a DCT block in samples,\n   * reflecting any scaling we choose to apply during the DCT step.\n   * Values from 1 to 16 are supported.\n   * Note that different components may receive different DCT scalings.\n   */\n  int DCT_h_scaled_size;\n  int DCT_v_scaled_size;\n  /* The downsampled dimensions are the component's actual, unpadded number\n   * of samples at the main buffer (preprocessing/compression interface);\n   * DCT scaling is included, so\n   * downsampled_width = ceil(image_width * Hi/Hmax * DCT_h_scaled_size/DCTSIZE)\n   * and similarly for height.\n   */\n  JDIMENSION downsampled_width;\t /* actual width in samples */\n  JDIMENSION downsampled_height; /* actual height in samples */\n  /* This flag is used only for decompression.  In cases where some of the\n   * components will be ignored (eg grayscale output from YCbCr image),\n   * we can skip most computations for the unused components.\n   */\n  boolean component_needed;\t/* do we need the value of this component? */\n\n  /* These values are computed before starting a scan of the component. */\n  /* The decompressor output side may not use these variables. */\n  int MCU_width;\t\t/* number of blocks per MCU, horizontally */\n  int MCU_height;\t\t/* number of blocks per MCU, vertically */\n  int MCU_blocks;\t\t/* MCU_width * MCU_height */\n  int MCU_sample_width;\t/* MCU width in samples: MCU_width * DCT_h_scaled_size */\n  int last_col_width;\t\t/* # of non-dummy blocks across in last MCU */\n  int last_row_height;\t\t/* # of non-dummy blocks down in last MCU */\n\n  /* Saved quantization table for component; NULL if none yet saved.\n   * See jdinput.c comments about the need for this information.\n   * This field is currently used only for decompression.\n   */\n  JQUANT_TBL * quant_table;\n\n  /* Private per-component storage for DCT or IDCT subsystem. */\n  void * dct_table;\n} jpeg_component_info;\n\n\n/* The script for encoding a multiple-scan file is an array of these: */\n\ntypedef struct {\n  int comps_in_scan;\t\t/* number of components encoded in this scan */\n  int component_index[MAX_COMPS_IN_SCAN]; /* their SOF/comp_info[] indexes */\n  int Ss, Se;\t\t\t/* progressive JPEG spectral selection parms */\n  int Ah, Al;\t\t\t/* progressive JPEG successive approx. parms */\n} jpeg_scan_info;\n\n/* The decompressor can save APPn and COM markers in a list of these: */\n\ntypedef struct jpeg_marker_struct FAR * jpeg_saved_marker_ptr;\n\nstruct jpeg_marker_struct {\n  jpeg_saved_marker_ptr next;\t/* next in list, or NULL */\n  UINT8 marker;\t\t\t/* marker code: JPEG_COM, or JPEG_APP0+n */\n  unsigned int original_length;\t/* # bytes of data in the file */\n  unsigned int data_length;\t/* # bytes of data saved at data[] */\n  JOCTET FAR * data;\t\t/* the data contained in the marker */\n  /* the marker length word is not counted in data_length or original_length */\n};\n\n/* Known color spaces. */\n\ntypedef enum {\n\tJCS_UNKNOWN,\t\t/* error/unspecified */\n\tJCS_GRAYSCALE,\t\t/* monochrome */\n\tJCS_RGB,\t\t/* red/green/blue */\n\tJCS_YCbCr,\t\t/* Y/Cb/Cr (also known as YUV) */\n\tJCS_CMYK,\t\t/* C/M/Y/K */\n\tJCS_YCCK\t\t/* Y/Cb/Cr/K */\n} J_COLOR_SPACE;\n\n/* Supported color transforms. */\n\ntypedef enum {\n\tJCT_NONE           = 0,\n\tJCT_SUBTRACT_GREEN = 1\n} J_COLOR_TRANSFORM;\n\n/* DCT/IDCT algorithm options. */\n\ntypedef enum {\n\tJDCT_ISLOW,\t\t/* slow but accurate integer algorithm */\n\tJDCT_IFAST,\t\t/* faster, less accurate integer method */\n\tJDCT_FLOAT\t\t/* floating-point: accurate, fast on fast HW */\n} J_DCT_METHOD;\n\n#ifndef JDCT_DEFAULT\t\t/* may be overridden in jconfig.h */\n#define JDCT_DEFAULT  JDCT_ISLOW\n#endif\n#ifndef JDCT_FASTEST\t\t/* may be overridden in jconfig.h */\n#define JDCT_FASTEST  JDCT_IFAST\n#endif\n\n/* Dithering options for decompression. */\n\ntypedef enum {\n\tJDITHER_NONE,\t\t/* no dithering */\n\tJDITHER_ORDERED,\t/* simple ordered dither */\n\tJDITHER_FS\t\t/* Floyd-Steinberg error diffusion dither */\n} J_DITHER_MODE;\n\n\n/* Common fields between JPEG compression and decompression master structs. */\n\n#define jpeg_common_fields \\\n  struct jpeg_error_mgr * err;\t/* Error handler module */\\\n  struct jpeg_memory_mgr * mem;\t/* Memory manager module */\\\n  struct jpeg_progress_mgr * progress; /* Progress monitor, or NULL if none */\\\n  void * client_data;\t\t/* Available for use by application */\\\n  boolean is_decompressor;\t/* So common code can tell which is which */\\\n  int global_state\t\t/* For checking call sequence validity */\n\n/* Routines that are to be used by both halves of the library are declared\n * to receive a pointer to this structure.  There are no actual instances of\n * jpeg_common_struct, only of jpeg_compress_struct and jpeg_decompress_struct.\n */\nstruct jpeg_common_struct {\n  jpeg_common_fields;\t\t/* Fields common to both master struct types */\n  /* Additional fields follow in an actual jpeg_compress_struct or\n   * jpeg_decompress_struct.  All three structs must agree on these\n   * initial fields!  (This would be a lot cleaner in C++.)\n   */\n};\n\ntypedef struct jpeg_common_struct * j_common_ptr;\ntypedef struct jpeg_compress_struct * j_compress_ptr;\ntypedef struct jpeg_decompress_struct * j_decompress_ptr;\n\n\n/* Master record for a compression instance */\n\nstruct jpeg_compress_struct {\n  jpeg_common_fields;\t\t/* Fields shared with jpeg_decompress_struct */\n\n  /* Destination for compressed data */\n  struct jpeg_destination_mgr * dest;\n\n  /* Description of source image --- these fields must be filled in by\n   * outer application before starting compression.  in_color_space must\n   * be correct before you can even call jpeg_set_defaults().\n   */\n\n  JDIMENSION image_width;\t/* input image width */\n  JDIMENSION image_height;\t/* input image height */\n  int input_components;\t\t/* # of color components in input image */\n  J_COLOR_SPACE in_color_space;\t/* colorspace of input image */\n\n  double input_gamma;\t\t/* image gamma of input image */\n\n  /* Compression parameters --- these fields must be set before calling\n   * jpeg_start_compress().  We recommend calling jpeg_set_defaults() to\n   * initialize everything to reasonable defaults, then changing anything\n   * the application specifically wants to change.  That way you won't get\n   * burnt when new parameters are added.  Also note that there are several\n   * helper routines to simplify changing parameters.\n   */\n\n  unsigned int scale_num, scale_denom; /* fraction by which to scale image */\n\n  JDIMENSION jpeg_width;\t/* scaled JPEG image width */\n  JDIMENSION jpeg_height;\t/* scaled JPEG image height */\n  /* Dimensions of actual JPEG image that will be written to file,\n   * derived from input dimensions by scaling factors above.\n   * These fields are computed by jpeg_start_compress().\n   * You can also use jpeg_calc_jpeg_dimensions() to determine these values\n   * in advance of calling jpeg_start_compress().\n   */\n\n  int data_precision;\t\t/* bits of precision in image data */\n\n  int num_components;\t\t/* # of color components in JPEG image */\n  J_COLOR_SPACE jpeg_color_space; /* colorspace of JPEG image */\n\n  jpeg_component_info * comp_info;\n  /* comp_info[i] describes component that appears i'th in SOF */\n\n  JQUANT_TBL * quant_tbl_ptrs[NUM_QUANT_TBLS];\n  int q_scale_factor[NUM_QUANT_TBLS];\n  /* ptrs to coefficient quantization tables, or NULL if not defined,\n   * and corresponding scale factors (percentage, initialized 100).\n   */\n\n  JHUFF_TBL * dc_huff_tbl_ptrs[NUM_HUFF_TBLS];\n  JHUFF_TBL * ac_huff_tbl_ptrs[NUM_HUFF_TBLS];\n  /* ptrs to Huffman coding tables, or NULL if not defined */\n\n  UINT8 arith_dc_L[NUM_ARITH_TBLS]; /* L values for DC arith-coding tables */\n  UINT8 arith_dc_U[NUM_ARITH_TBLS]; /* U values for DC arith-coding tables */\n  UINT8 arith_ac_K[NUM_ARITH_TBLS]; /* Kx values for AC arith-coding tables */\n\n  int num_scans;\t\t/* # of entries in scan_info array */\n  const jpeg_scan_info * scan_info; /* script for multi-scan file, or NULL */\n  /* The default value of scan_info is NULL, which causes a single-scan\n   * sequential JPEG file to be emitted.  To create a multi-scan file,\n   * set num_scans and scan_info to point to an array of scan definitions.\n   */\n\n  boolean raw_data_in;\t\t/* TRUE=caller supplies downsampled data */\n  boolean arith_code;\t\t/* TRUE=arithmetic coding, FALSE=Huffman */\n  boolean optimize_coding;\t/* TRUE=optimize entropy encoding parms */\n  boolean CCIR601_sampling;\t/* TRUE=first samples are cosited */\n  boolean do_fancy_downsampling; /* TRUE=apply fancy downsampling */\n  int smoothing_factor;\t\t/* 1..100, or 0 for no input smoothing */\n  J_DCT_METHOD dct_method;\t/* DCT algorithm selector */\n\n  /* The restart interval can be specified in absolute MCUs by setting\n   * restart_interval, or in MCU rows by setting restart_in_rows\n   * (in which case the correct restart_interval will be figured\n   * for each scan).\n   */\n  unsigned int restart_interval; /* MCUs per restart, or 0 for no restart */\n  int restart_in_rows;\t\t/* if > 0, MCU rows per restart interval */\n\n  /* Parameters controlling emission of special markers. */\n\n  boolean write_JFIF_header;\t/* should a JFIF marker be written? */\n  UINT8 JFIF_major_version;\t/* What to write for the JFIF version number */\n  UINT8 JFIF_minor_version;\n  /* These three values are not used by the JPEG code, merely copied */\n  /* into the JFIF APP0 marker.  density_unit can be 0 for unknown, */\n  /* 1 for dots/inch, or 2 for dots/cm.  Note that the pixel aspect */\n  /* ratio is defined by X_density/Y_density even when density_unit=0. */\n  UINT8 density_unit;\t\t/* JFIF code for pixel size units */\n  UINT16 X_density;\t\t/* Horizontal pixel density */\n  UINT16 Y_density;\t\t/* Vertical pixel density */\n  boolean write_Adobe_marker;\t/* should an Adobe marker be written? */\n\n  J_COLOR_TRANSFORM color_transform;\n  /* Color transform identifier, writes LSE marker if nonzero */\n\n  /* State variable: index of next scanline to be written to\n   * jpeg_write_scanlines().  Application may use this to control its\n   * processing loop, e.g., \"while (next_scanline < image_height)\".\n   */\n\n  JDIMENSION next_scanline;\t/* 0 .. image_height-1  */\n\n  /* Remaining fields are known throughout compressor, but generally\n   * should not be touched by a surrounding application.\n   */\n\n  /*\n   * These fields are computed during compression startup\n   */\n  boolean progressive_mode;\t/* TRUE if scan script uses progressive mode */\n  int max_h_samp_factor;\t/* largest h_samp_factor */\n  int max_v_samp_factor;\t/* largest v_samp_factor */\n\n  int min_DCT_h_scaled_size;\t/* smallest DCT_h_scaled_size of any component */\n  int min_DCT_v_scaled_size;\t/* smallest DCT_v_scaled_size of any component */\n\n  JDIMENSION total_iMCU_rows;\t/* # of iMCU rows to be input to coef ctlr */\n  /* The coefficient controller receives data in units of MCU rows as defined\n   * for fully interleaved scans (whether the JPEG file is interleaved or not).\n   * There are v_samp_factor * DCTSIZE sample rows of each component in an\n   * \"iMCU\" (interleaved MCU) row.\n   */\n  \n  /*\n   * These fields are valid during any one scan.\n   * They describe the components and MCUs actually appearing in the scan.\n   */\n  int comps_in_scan;\t\t/* # of JPEG components in this scan */\n  jpeg_component_info * cur_comp_info[MAX_COMPS_IN_SCAN];\n  /* *cur_comp_info[i] describes component that appears i'th in SOS */\n  \n  JDIMENSION MCUs_per_row;\t/* # of MCUs across the image */\n  JDIMENSION MCU_rows_in_scan;\t/* # of MCU rows in the image */\n  \n  int blocks_in_MCU;\t\t/* # of DCT blocks per MCU */\n  int MCU_membership[C_MAX_BLOCKS_IN_MCU];\n  /* MCU_membership[i] is index in cur_comp_info of component owning */\n  /* i'th block in an MCU */\n\n  int Ss, Se, Ah, Al;\t\t/* progressive JPEG parameters for scan */\n\n  int block_size;\t\t/* the basic DCT block size: 1..16 */\n  const int * natural_order;\t/* natural-order position array */\n  int lim_Se;\t\t\t/* min( Se, DCTSIZE2-1 ) */\n\n  /*\n   * Links to compression subobjects (methods and private variables of modules)\n   */\n  struct jpeg_comp_master * master;\n  struct jpeg_c_main_controller * main;\n  struct jpeg_c_prep_controller * prep;\n  struct jpeg_c_coef_controller * coef;\n  struct jpeg_marker_writer * marker;\n  struct jpeg_color_converter * cconvert;\n  struct jpeg_downsampler * downsample;\n  struct jpeg_forward_dct * fdct;\n  struct jpeg_entropy_encoder * entropy;\n  jpeg_scan_info * script_space; /* workspace for jpeg_simple_progression */\n  int script_space_size;\n};\n\n\n/* Master record for a decompression instance */\n\nstruct jpeg_decompress_struct {\n  jpeg_common_fields;\t\t/* Fields shared with jpeg_compress_struct */\n\n  /* Source of compressed data */\n  struct jpeg_source_mgr * src;\n\n  /* Basic description of image --- filled in by jpeg_read_header(). */\n  /* Application may inspect these values to decide how to process image. */\n\n  JDIMENSION image_width;\t/* nominal image width (from SOF marker) */\n  JDIMENSION image_height;\t/* nominal image height */\n  int num_components;\t\t/* # of color components in JPEG image */\n  J_COLOR_SPACE jpeg_color_space; /* colorspace of JPEG image */\n\n  /* Decompression processing parameters --- these fields must be set before\n   * calling jpeg_start_decompress().  Note that jpeg_read_header() initializes\n   * them to default values.\n   */\n\n  J_COLOR_SPACE out_color_space; /* colorspace for output */\n\n  unsigned int scale_num, scale_denom; /* fraction by which to scale image */\n\n  double output_gamma;\t\t/* image gamma wanted in output */\n\n  boolean buffered_image;\t/* TRUE=multiple output passes */\n  boolean raw_data_out;\t\t/* TRUE=downsampled data wanted */\n\n  J_DCT_METHOD dct_method;\t/* IDCT algorithm selector */\n  boolean do_fancy_upsampling;\t/* TRUE=apply fancy upsampling */\n  boolean do_block_smoothing;\t/* TRUE=apply interblock smoothing */\n\n  boolean quantize_colors;\t/* TRUE=colormapped output wanted */\n  /* the following are ignored if not quantize_colors: */\n  J_DITHER_MODE dither_mode;\t/* type of color dithering to use */\n  boolean two_pass_quantize;\t/* TRUE=use two-pass color quantization */\n  int desired_number_of_colors;\t/* max # colors to use in created colormap */\n  /* these are significant only in buffered-image mode: */\n  boolean enable_1pass_quant;\t/* enable future use of 1-pass quantizer */\n  boolean enable_external_quant;/* enable future use of external colormap */\n  boolean enable_2pass_quant;\t/* enable future use of 2-pass quantizer */\n\n  /* Description of actual output image that will be returned to application.\n   * These fields are computed by jpeg_start_decompress().\n   * You can also use jpeg_calc_output_dimensions() to determine these values\n   * in advance of calling jpeg_start_decompress().\n   */\n\n  JDIMENSION output_width;\t/* scaled image width */\n  JDIMENSION output_height;\t/* scaled image height */\n  int out_color_components;\t/* # of color components in out_color_space */\n  int output_components;\t/* # of color components returned */\n  /* output_components is 1 (a colormap index) when quantizing colors;\n   * otherwise it equals out_color_components.\n   */\n  int rec_outbuf_height;\t/* min recommended height of scanline buffer */\n  /* If the buffer passed to jpeg_read_scanlines() is less than this many rows\n   * high, space and time will be wasted due to unnecessary data copying.\n   * Usually rec_outbuf_height will be 1 or 2, at most 4.\n   */\n\n  /* When quantizing colors, the output colormap is described by these fields.\n   * The application can supply a colormap by setting colormap non-NULL before\n   * calling jpeg_start_decompress; otherwise a colormap is created during\n   * jpeg_start_decompress or jpeg_start_output.\n   * The map has out_color_components rows and actual_number_of_colors columns.\n   */\n  int actual_number_of_colors;\t/* number of entries in use */\n  JSAMPARRAY colormap;\t\t/* The color map as a 2-D pixel array */\n\n  /* State variables: these variables indicate the progress of decompression.\n   * The application may examine these but must not modify them.\n   */\n\n  /* Row index of next scanline to be read from jpeg_read_scanlines().\n   * Application may use this to control its processing loop, e.g.,\n   * \"while (output_scanline < output_height)\".\n   */\n  JDIMENSION output_scanline;\t/* 0 .. output_height-1  */\n\n  /* Current input scan number and number of iMCU rows completed in scan.\n   * These indicate the progress of the decompressor input side.\n   */\n  int input_scan_number;\t/* Number of SOS markers seen so far */\n  JDIMENSION input_iMCU_row;\t/* Number of iMCU rows completed */\n\n  /* The \"output scan number\" is the notional scan being displayed by the\n   * output side.  The decompressor will not allow output scan/row number\n   * to get ahead of input scan/row, but it can fall arbitrarily far behind.\n   */\n  int output_scan_number;\t/* Nominal scan number being displayed */\n  JDIMENSION output_iMCU_row;\t/* Number of iMCU rows read */\n\n  /* Current progression status.  coef_bits[c][i] indicates the precision\n   * with which component c's DCT coefficient i (in zigzag order) is known.\n   * It is -1 when no data has yet been received, otherwise it is the point\n   * transform (shift) value for the most recent scan of the coefficient\n   * (thus, 0 at completion of the progression).\n   * This pointer is NULL when reading a non-progressive file.\n   */\n  int (*coef_bits)[DCTSIZE2];\t/* -1 or current Al value for each coef */\n\n  /* Internal JPEG parameters --- the application usually need not look at\n   * these fields.  Note that the decompressor output side may not use\n   * any parameters that can change between scans.\n   */\n\n  /* Quantization and Huffman tables are carried forward across input\n   * datastreams when processing abbreviated JPEG datastreams.\n   */\n\n  JQUANT_TBL * quant_tbl_ptrs[NUM_QUANT_TBLS];\n  /* ptrs to coefficient quantization tables, or NULL if not defined */\n\n  JHUFF_TBL * dc_huff_tbl_ptrs[NUM_HUFF_TBLS];\n  JHUFF_TBL * ac_huff_tbl_ptrs[NUM_HUFF_TBLS];\n  /* ptrs to Huffman coding tables, or NULL if not defined */\n\n  /* These parameters are never carried across datastreams, since they\n   * are given in SOF/SOS markers or defined to be reset by SOI.\n   */\n\n  int data_precision;\t\t/* bits of precision in image data */\n\n  jpeg_component_info * comp_info;\n  /* comp_info[i] describes component that appears i'th in SOF */\n\n  boolean is_baseline;\t\t/* TRUE if Baseline SOF0 encountered */\n  boolean progressive_mode;\t/* TRUE if SOFn specifies progressive mode */\n  boolean arith_code;\t\t/* TRUE=arithmetic coding, FALSE=Huffman */\n\n  UINT8 arith_dc_L[NUM_ARITH_TBLS]; /* L values for DC arith-coding tables */\n  UINT8 arith_dc_U[NUM_ARITH_TBLS]; /* U values for DC arith-coding tables */\n  UINT8 arith_ac_K[NUM_ARITH_TBLS]; /* Kx values for AC arith-coding tables */\n\n  unsigned int restart_interval; /* MCUs per restart interval, or 0 for no restart */\n\n  /* These fields record data obtained from optional markers recognized by\n   * the JPEG library.\n   */\n  boolean saw_JFIF_marker;\t/* TRUE iff a JFIF APP0 marker was found */\n  /* Data copied from JFIF marker; only valid if saw_JFIF_marker is TRUE: */\n  UINT8 JFIF_major_version;\t/* JFIF version number */\n  UINT8 JFIF_minor_version;\n  UINT8 density_unit;\t\t/* JFIF code for pixel size units */\n  UINT16 X_density;\t\t/* Horizontal pixel density */\n  UINT16 Y_density;\t\t/* Vertical pixel density */\n  boolean saw_Adobe_marker;\t/* TRUE iff an Adobe APP14 marker was found */\n  UINT8 Adobe_transform;\t/* Color transform code from Adobe marker */\n\n  J_COLOR_TRANSFORM color_transform;\n  /* Color transform identifier derived from LSE marker, otherwise zero */\n\n  boolean CCIR601_sampling;\t/* TRUE=first samples are cosited */\n\n  /* Aside from the specific data retained from APPn markers known to the\n   * library, the uninterpreted contents of any or all APPn and COM markers\n   * can be saved in a list for examination by the application.\n   */\n  jpeg_saved_marker_ptr marker_list; /* Head of list of saved markers */\n\n  /* Remaining fields are known throughout decompressor, but generally\n   * should not be touched by a surrounding application.\n   */\n\n  /*\n   * These fields are computed during decompression startup\n   */\n  int max_h_samp_factor;\t/* largest h_samp_factor */\n  int max_v_samp_factor;\t/* largest v_samp_factor */\n\n  int min_DCT_h_scaled_size;\t/* smallest DCT_h_scaled_size of any component */\n  int min_DCT_v_scaled_size;\t/* smallest DCT_v_scaled_size of any component */\n\n  JDIMENSION total_iMCU_rows;\t/* # of iMCU rows in image */\n  /* The coefficient controller's input and output progress is measured in\n   * units of \"iMCU\" (interleaved MCU) rows.  These are the same as MCU rows\n   * in fully interleaved JPEG scans, but are used whether the scan is\n   * interleaved or not.  We define an iMCU row as v_samp_factor DCT block\n   * rows of each component.  Therefore, the IDCT output contains\n   * v_samp_factor*DCT_v_scaled_size sample rows of a component per iMCU row.\n   */\n\n  JSAMPLE * sample_range_limit; /* table for fast range-limiting */\n\n  /*\n   * These fields are valid during any one scan.\n   * They describe the components and MCUs actually appearing in the scan.\n   * Note that the decompressor output side must not use these fields.\n   */\n  int comps_in_scan;\t\t/* # of JPEG components in this scan */\n  jpeg_component_info * cur_comp_info[MAX_COMPS_IN_SCAN];\n  /* *cur_comp_info[i] describes component that appears i'th in SOS */\n\n  JDIMENSION MCUs_per_row;\t/* # of MCUs across the image */\n  JDIMENSION MCU_rows_in_scan;\t/* # of MCU rows in the image */\n\n  int blocks_in_MCU;\t\t/* # of DCT blocks per MCU */\n  int MCU_membership[D_MAX_BLOCKS_IN_MCU];\n  /* MCU_membership[i] is index in cur_comp_info of component owning */\n  /* i'th block in an MCU */\n\n  int Ss, Se, Ah, Al;\t\t/* progressive JPEG parameters for scan */\n\n  /* These fields are derived from Se of first SOS marker.\n   */\n  int block_size;\t\t/* the basic DCT block size: 1..16 */\n  const int * natural_order; /* natural-order position array for entropy decode */\n  int lim_Se;\t\t\t/* min( Se, DCTSIZE2-1 ) for entropy decode */\n\n  /* This field is shared between entropy decoder and marker parser.\n   * It is either zero or the code of a JPEG marker that has been\n   * read from the data source, but has not yet been processed.\n   */\n  int unread_marker;\n\n  /*\n   * Links to decompression subobjects (methods, private variables of modules)\n   */\n  struct jpeg_decomp_master * master;\n  struct jpeg_d_main_controller * main;\n  struct jpeg_d_coef_controller * coef;\n  struct jpeg_d_post_controller * post;\n  struct jpeg_input_controller * inputctl;\n  struct jpeg_marker_reader * marker;\n  struct jpeg_entropy_decoder * entropy;\n  struct jpeg_inverse_dct * idct;\n  struct jpeg_upsampler * upsample;\n  struct jpeg_color_deconverter * cconvert;\n  struct jpeg_color_quantizer * cquantize;\n};\n\n\n/* \"Object\" declarations for JPEG modules that may be supplied or called\n * directly by the surrounding application.\n * As with all objects in the JPEG library, these structs only define the\n * publicly visible methods and state variables of a module.  Additional\n * private fields may exist after the public ones.\n */\n\n\n/* Error handler object */\n\nstruct jpeg_error_mgr {\n  /* Error exit handler: does not return to caller */\n  JMETHOD(noreturn_t, error_exit, (j_common_ptr cinfo));\n  /* Conditionally emit a trace or warning message */\n  JMETHOD(void, emit_message, (j_common_ptr cinfo, int msg_level));\n  /* Routine that actually outputs a trace or error message */\n  JMETHOD(void, output_message, (j_common_ptr cinfo));\n  /* Format a message string for the most recent JPEG error or message */\n  JMETHOD(void, format_message, (j_common_ptr cinfo, char * buffer));\n#define JMSG_LENGTH_MAX  200\t/* recommended size of format_message buffer */\n  /* Reset error state variables at start of a new image */\n  JMETHOD(void, reset_error_mgr, (j_common_ptr cinfo));\n  \n  /* The message ID code and any parameters are saved here.\n   * A message can have one string parameter or up to 8 int parameters.\n   */\n  int msg_code;\n#define JMSG_STR_PARM_MAX  80\n  union {\n    int i[8];\n    char s[JMSG_STR_PARM_MAX];\n  } msg_parm;\n  \n  /* Standard state variables for error facility */\n  \n  int trace_level;\t\t/* max msg_level that will be displayed */\n  \n  /* For recoverable corrupt-data errors, we emit a warning message,\n   * but keep going unless emit_message chooses to abort.  emit_message\n   * should count warnings in num_warnings.  The surrounding application\n   * can check for bad data by seeing if num_warnings is nonzero at the\n   * end of processing.\n   */\n  long num_warnings;\t\t/* number of corrupt-data warnings */\n\n  /* These fields point to the table(s) of error message strings.\n   * An application can change the table pointer to switch to a different\n   * message list (typically, to change the language in which errors are\n   * reported).  Some applications may wish to add additional error codes\n   * that will be handled by the JPEG library error mechanism; the second\n   * table pointer is used for this purpose.\n   *\n   * First table includes all errors generated by JPEG library itself.\n   * Error code 0 is reserved for a \"no such error string\" message.\n   */\n  const char * const * jpeg_message_table; /* Library errors */\n  int last_jpeg_message;    /* Table contains strings 0..last_jpeg_message */\n  /* Second table can be added by application (see cjpeg/djpeg for example).\n   * It contains strings numbered first_addon_message..last_addon_message.\n   */\n  const char * const * addon_message_table; /* Non-library errors */\n  int first_addon_message;\t/* code for first string in addon table */\n  int last_addon_message;\t/* code for last string in addon table */\n};\n\n\n/* Progress monitor object */\n\nstruct jpeg_progress_mgr {\n  JMETHOD(void, progress_monitor, (j_common_ptr cinfo));\n\n  long pass_counter;\t\t/* work units completed in this pass */\n  long pass_limit;\t\t/* total number of work units in this pass */\n  int completed_passes;\t\t/* passes completed so far */\n  int total_passes;\t\t/* total number of passes expected */\n};\n\n\n/* Data destination object for compression */\n\nstruct jpeg_destination_mgr {\n  JOCTET * next_output_byte;\t/* => next byte to write in buffer */\n  size_t free_in_buffer;\t/* # of byte spaces remaining in buffer */\n\n  JMETHOD(void, init_destination, (j_compress_ptr cinfo));\n  JMETHOD(boolean, empty_output_buffer, (j_compress_ptr cinfo));\n  JMETHOD(void, term_destination, (j_compress_ptr cinfo));\n};\n\n\n/* Data source object for decompression */\n\nstruct jpeg_source_mgr {\n  const JOCTET * next_input_byte; /* => next byte to read from buffer */\n  size_t bytes_in_buffer;\t/* # of bytes remaining in buffer */\n\n  JMETHOD(void, init_source, (j_decompress_ptr cinfo));\n  JMETHOD(boolean, fill_input_buffer, (j_decompress_ptr cinfo));\n  JMETHOD(void, skip_input_data, (j_decompress_ptr cinfo, long num_bytes));\n  JMETHOD(boolean, resync_to_restart, (j_decompress_ptr cinfo, int desired));\n  JMETHOD(void, term_source, (j_decompress_ptr cinfo));\n};\n\n\n/* Memory manager object.\n * Allocates \"small\" objects (a few K total), \"large\" objects (tens of K),\n * and \"really big\" objects (virtual arrays with backing store if needed).\n * The memory manager does not allow individual objects to be freed; rather,\n * each created object is assigned to a pool, and whole pools can be freed\n * at once.  This is faster and more convenient than remembering exactly what\n * to free, especially where malloc()/free() are not too speedy.\n * NB: alloc routines never return NULL.  They exit to error_exit if not\n * successful.\n */\n\n#define JPOOL_PERMANENT\t0\t/* lasts until master record is destroyed */\n#define JPOOL_IMAGE\t1\t/* lasts until done with image/datastream */\n#define JPOOL_NUMPOOLS\t2\n\ntypedef struct jvirt_sarray_control * jvirt_sarray_ptr;\ntypedef struct jvirt_barray_control * jvirt_barray_ptr;\n\n\nstruct jpeg_memory_mgr {\n  /* Method pointers */\n  JMETHOD(void *, alloc_small, (j_common_ptr cinfo, int pool_id,\n\t\t\t\tsize_t sizeofobject));\n  JMETHOD(void FAR *, alloc_large, (j_common_ptr cinfo, int pool_id,\n\t\t\t\t     size_t sizeofobject));\n  JMETHOD(JSAMPARRAY, alloc_sarray, (j_common_ptr cinfo, int pool_id,\n\t\t\t\t     JDIMENSION samplesperrow,\n\t\t\t\t     JDIMENSION numrows));\n  JMETHOD(JBLOCKARRAY, alloc_barray, (j_common_ptr cinfo, int pool_id,\n\t\t\t\t      JDIMENSION blocksperrow,\n\t\t\t\t      JDIMENSION numrows));\n  JMETHOD(jvirt_sarray_ptr, request_virt_sarray, (j_common_ptr cinfo,\n\t\t\t\t\t\t  int pool_id,\n\t\t\t\t\t\t  boolean pre_zero,\n\t\t\t\t\t\t  JDIMENSION samplesperrow,\n\t\t\t\t\t\t  JDIMENSION numrows,\n\t\t\t\t\t\t  JDIMENSION maxaccess));\n  JMETHOD(jvirt_barray_ptr, request_virt_barray, (j_common_ptr cinfo,\n\t\t\t\t\t\t  int pool_id,\n\t\t\t\t\t\t  boolean pre_zero,\n\t\t\t\t\t\t  JDIMENSION blocksperrow,\n\t\t\t\t\t\t  JDIMENSION numrows,\n\t\t\t\t\t\t  JDIMENSION maxaccess));\n  JMETHOD(void, realize_virt_arrays, (j_common_ptr cinfo));\n  JMETHOD(JSAMPARRAY, access_virt_sarray, (j_common_ptr cinfo,\n\t\t\t\t\t   jvirt_sarray_ptr ptr,\n\t\t\t\t\t   JDIMENSION start_row,\n\t\t\t\t\t   JDIMENSION num_rows,\n\t\t\t\t\t   boolean writable));\n  JMETHOD(JBLOCKARRAY, access_virt_barray, (j_common_ptr cinfo,\n\t\t\t\t\t    jvirt_barray_ptr ptr,\n\t\t\t\t\t    JDIMENSION start_row,\n\t\t\t\t\t    JDIMENSION num_rows,\n\t\t\t\t\t    boolean writable));\n  JMETHOD(void, free_pool, (j_common_ptr cinfo, int pool_id));\n  JMETHOD(void, self_destruct, (j_common_ptr cinfo));\n\n  /* Limit on memory allocation for this JPEG object.  (Note that this is\n   * merely advisory, not a guaranteed maximum; it only affects the space\n   * used for virtual-array buffers.)  May be changed by outer application\n   * after creating the JPEG object.\n   */\n  long max_memory_to_use;\n\n  /* Maximum allocation request accepted by alloc_large. */\n  long max_alloc_chunk;\n};\n\n\n/* Routine signature for application-supplied marker processing methods.\n * Need not pass marker code since it is stored in cinfo->unread_marker.\n */\ntypedef JMETHOD(boolean, jpeg_marker_parser_method, (j_decompress_ptr cinfo));\n\n\n/* Declarations for routines called by application.\n * The JPP macro hides prototype parameters from compilers that can't cope.\n * Note JPP requires double parentheses.\n */\n\n#ifdef HAVE_PROTOTYPES\n#define JPP(arglist)\targlist\n#else\n#define JPP(arglist)\t()\n#endif\n\n\n/* Short forms of external names for systems with brain-damaged linkers.\n * We shorten external names to be unique in the first six letters, which\n * is good enough for all known systems.\n * (If your compiler itself needs names to be unique in less than 15 \n * characters, you are out of luck.  Get a better compiler.)\n */\n\n#ifdef NEED_SHORT_EXTERNAL_NAMES\n#define jpeg_std_error\t\tjStdError\n#define jpeg_CreateCompress\tjCreaCompress\n#define jpeg_CreateDecompress\tjCreaDecompress\n#define jpeg_destroy_compress\tjDestCompress\n#define jpeg_destroy_decompress\tjDestDecompress\n#define jpeg_stdio_dest\t\tjStdDest\n#define jpeg_stdio_src\t\tjStdSrc\n#define jpeg_mem_dest\t\tjMemDest\n#define jpeg_mem_src\t\tjMemSrc\n#define jpeg_set_defaults\tjSetDefaults\n#define jpeg_set_colorspace\tjSetColorspace\n#define jpeg_default_colorspace\tjDefColorspace\n#define jpeg_set_quality\tjSetQuality\n#define jpeg_set_linear_quality\tjSetLQuality\n#define jpeg_default_qtables\tjDefQTables\n#define jpeg_add_quant_table\tjAddQuantTable\n#define jpeg_quality_scaling\tjQualityScaling\n#define jpeg_simple_progression\tjSimProgress\n#define jpeg_suppress_tables\tjSuppressTables\n#define jpeg_alloc_quant_table\tjAlcQTable\n#define jpeg_alloc_huff_table\tjAlcHTable\n#define jpeg_start_compress\tjStrtCompress\n#define jpeg_write_scanlines\tjWrtScanlines\n#define jpeg_finish_compress\tjFinCompress\n#define jpeg_calc_jpeg_dimensions\tjCjpegDimensions\n#define jpeg_write_raw_data\tjWrtRawData\n#define jpeg_write_marker\tjWrtMarker\n#define jpeg_write_m_header\tjWrtMHeader\n#define jpeg_write_m_byte\tjWrtMByte\n#define jpeg_write_tables\tjWrtTables\n#define jpeg_read_header\tjReadHeader\n#define jpeg_start_decompress\tjStrtDecompress\n#define jpeg_read_scanlines\tjReadScanlines\n#define jpeg_finish_decompress\tjFinDecompress\n#define jpeg_read_raw_data\tjReadRawData\n#define jpeg_has_multiple_scans\tjHasMultScn\n#define jpeg_start_output\tjStrtOutput\n#define jpeg_finish_output\tjFinOutput\n#define jpeg_input_complete\tjInComplete\n#define jpeg_new_colormap\tjNewCMap\n#define jpeg_consume_input\tjConsumeInput\n#define jpeg_core_output_dimensions\tjCoreDimensions\n#define jpeg_calc_output_dimensions\tjCalcDimensions\n#define jpeg_save_markers\tjSaveMarkers\n#define jpeg_set_marker_processor\tjSetMarker\n#define jpeg_read_coefficients\tjReadCoefs\n#define jpeg_write_coefficients\tjWrtCoefs\n#define jpeg_copy_critical_parameters\tjCopyCrit\n#define jpeg_abort_compress\tjAbrtCompress\n#define jpeg_abort_decompress\tjAbrtDecompress\n#define jpeg_abort\t\tjAbort\n#define jpeg_destroy\t\tjDestroy\n#define jpeg_resync_to_restart\tjResyncRestart\n#endif /* NEED_SHORT_EXTERNAL_NAMES */\n\n\n/* Default error-management setup */\nEXTERN(struct jpeg_error_mgr *) jpeg_std_error\n\tJPP((struct jpeg_error_mgr * err));\n\n/* Initialization of JPEG compression objects.\n * jpeg_create_compress() and jpeg_create_decompress() are the exported\n * names that applications should call.  These expand to calls on\n * jpeg_CreateCompress and jpeg_CreateDecompress with additional information\n * passed for version mismatch checking.\n * NB: you must set up the error-manager BEFORE calling jpeg_create_xxx.\n */\n#define jpeg_create_compress(cinfo) \\\n    jpeg_CreateCompress((cinfo), JPEG_LIB_VERSION, \\\n\t\t\t(size_t) sizeof(struct jpeg_compress_struct))\n#define jpeg_create_decompress(cinfo) \\\n    jpeg_CreateDecompress((cinfo), JPEG_LIB_VERSION, \\\n\t\t\t  (size_t) sizeof(struct jpeg_decompress_struct))\nEXTERN(void) jpeg_CreateCompress JPP((j_compress_ptr cinfo,\n\t\t\t\t      int version, size_t structsize));\nEXTERN(void) jpeg_CreateDecompress JPP((j_decompress_ptr cinfo,\n\t\t\t\t\tint version, size_t structsize));\n/* Destruction of JPEG compression objects */\nEXTERN(void) jpeg_destroy_compress JPP((j_compress_ptr cinfo));\nEXTERN(void) jpeg_destroy_decompress JPP((j_decompress_ptr cinfo));\n\n/* Standard data source and destination managers: stdio streams. */\n/* Caller is responsible for opening the file before and closing after. */\nEXTERN(void) jpeg_stdio_dest JPP((j_compress_ptr cinfo, FILE * outfile));\nEXTERN(void) jpeg_stdio_src JPP((j_decompress_ptr cinfo, FILE * infile));\n\n/* Data source and destination managers: memory buffers. */\nEXTERN(void) jpeg_mem_dest JPP((j_compress_ptr cinfo,\n\t\t\t       unsigned char ** outbuffer,\n\t\t\t       unsigned long * outsize));\nEXTERN(void) jpeg_mem_src JPP((j_decompress_ptr cinfo,\n\t\t\t      unsigned char * inbuffer,\n\t\t\t      unsigned long insize));\n\n/* Default parameter setup for compression */\nEXTERN(void) jpeg_set_defaults JPP((j_compress_ptr cinfo));\n/* Compression parameter setup aids */\nEXTERN(void) jpeg_set_colorspace JPP((j_compress_ptr cinfo,\n\t\t\t\t      J_COLOR_SPACE colorspace));\nEXTERN(void) jpeg_default_colorspace JPP((j_compress_ptr cinfo));\nEXTERN(void) jpeg_set_quality JPP((j_compress_ptr cinfo, int quality,\n\t\t\t\t   boolean force_baseline));\nEXTERN(void) jpeg_set_linear_quality JPP((j_compress_ptr cinfo,\n\t\t\t\t\t  int scale_factor,\n\t\t\t\t\t  boolean force_baseline));\nEXTERN(void) jpeg_default_qtables JPP((j_compress_ptr cinfo,\n\t\t\t\t       boolean force_baseline));\nEXTERN(void) jpeg_add_quant_table JPP((j_compress_ptr cinfo, int which_tbl,\n\t\t\t\t       const unsigned int *basic_table,\n\t\t\t\t       int scale_factor,\n\t\t\t\t       boolean force_baseline));\nEXTERN(int) jpeg_quality_scaling JPP((int quality));\nEXTERN(void) jpeg_simple_progression JPP((j_compress_ptr cinfo));\nEXTERN(void) jpeg_suppress_tables JPP((j_compress_ptr cinfo,\n\t\t\t\t       boolean suppress));\nEXTERN(JQUANT_TBL *) jpeg_alloc_quant_table JPP((j_common_ptr cinfo));\nEXTERN(JHUFF_TBL *) jpeg_alloc_huff_table JPP((j_common_ptr cinfo));\n\n/* Main entry points for compression */\nEXTERN(void) jpeg_start_compress JPP((j_compress_ptr cinfo,\n\t\t\t\t      boolean write_all_tables));\nEXTERN(JDIMENSION) jpeg_write_scanlines JPP((j_compress_ptr cinfo,\n\t\t\t\t\t     JSAMPARRAY scanlines,\n\t\t\t\t\t     JDIMENSION num_lines));\nEXTERN(void) jpeg_finish_compress JPP((j_compress_ptr cinfo));\n\n/* Precalculate JPEG dimensions for current compression parameters. */\nEXTERN(void) jpeg_calc_jpeg_dimensions JPP((j_compress_ptr cinfo));\n\n/* Replaces jpeg_write_scanlines when writing raw downsampled data. */\nEXTERN(JDIMENSION) jpeg_write_raw_data JPP((j_compress_ptr cinfo,\n\t\t\t\t\t    JSAMPIMAGE data,\n\t\t\t\t\t    JDIMENSION num_lines));\n\n/* Write a special marker.  See libjpeg.txt concerning safe usage. */\nEXTERN(void) jpeg_write_marker\n\tJPP((j_compress_ptr cinfo, int marker,\n\t     const JOCTET * dataptr, unsigned int datalen));\n/* Same, but piecemeal. */\nEXTERN(void) jpeg_write_m_header\n\tJPP((j_compress_ptr cinfo, int marker, unsigned int datalen));\nEXTERN(void) jpeg_write_m_byte\n\tJPP((j_compress_ptr cinfo, int val));\n\n/* Alternate compression function: just write an abbreviated table file */\nEXTERN(void) jpeg_write_tables JPP((j_compress_ptr cinfo));\n\n/* Decompression startup: read start of JPEG datastream to see what's there */\nEXTERN(int) jpeg_read_header JPP((j_decompress_ptr cinfo,\n\t\t\t\t  boolean require_image));\n/* Return value is one of: */\n#define JPEG_SUSPENDED\t\t0 /* Suspended due to lack of input data */\n#define JPEG_HEADER_OK\t\t1 /* Found valid image datastream */\n#define JPEG_HEADER_TABLES_ONLY\t2 /* Found valid table-specs-only datastream */\n/* If you pass require_image = TRUE (normal case), you need not check for\n * a TABLES_ONLY return code; an abbreviated file will cause an error exit.\n * JPEG_SUSPENDED is only possible if you use a data source module that can\n * give a suspension return (the stdio source module doesn't).\n */\n\n/* Main entry points for decompression */\nEXTERN(boolean) jpeg_start_decompress JPP((j_decompress_ptr cinfo));\nEXTERN(JDIMENSION) jpeg_read_scanlines JPP((j_decompress_ptr cinfo,\n\t\t\t\t\t    JSAMPARRAY scanlines,\n\t\t\t\t\t    JDIMENSION max_lines));\nEXTERN(boolean) jpeg_finish_decompress JPP((j_decompress_ptr cinfo));\n\n/* Replaces jpeg_read_scanlines when reading raw downsampled data. */\nEXTERN(JDIMENSION) jpeg_read_raw_data JPP((j_decompress_ptr cinfo,\n\t\t\t\t\t   JSAMPIMAGE data,\n\t\t\t\t\t   JDIMENSION max_lines));\n\n/* Additional entry points for buffered-image mode. */\nEXTERN(boolean) jpeg_has_multiple_scans JPP((j_decompress_ptr cinfo));\nEXTERN(boolean) jpeg_start_output JPP((j_decompress_ptr cinfo,\n\t\t\t\t       int scan_number));\nEXTERN(boolean) jpeg_finish_output JPP((j_decompress_ptr cinfo));\nEXTERN(boolean) jpeg_input_complete JPP((j_decompress_ptr cinfo));\nEXTERN(void) jpeg_new_colormap JPP((j_decompress_ptr cinfo));\nEXTERN(int) jpeg_consume_input JPP((j_decompress_ptr cinfo));\n/* Return value is one of: */\n/* #define JPEG_SUSPENDED\t0    Suspended due to lack of input data */\n#define JPEG_REACHED_SOS\t1 /* Reached start of new scan */\n#define JPEG_REACHED_EOI\t2 /* Reached end of image */\n#define JPEG_ROW_COMPLETED\t3 /* Completed one iMCU row */\n#define JPEG_SCAN_COMPLETED\t4 /* Completed last iMCU row of a scan */\n\n/* Precalculate output dimensions for current decompression parameters. */\nEXTERN(void) jpeg_core_output_dimensions JPP((j_decompress_ptr cinfo));\nEXTERN(void) jpeg_calc_output_dimensions JPP((j_decompress_ptr cinfo));\n\n/* Control saving of COM and APPn markers into marker_list. */\nEXTERN(void) jpeg_save_markers\n\tJPP((j_decompress_ptr cinfo, int marker_code,\n\t     unsigned int length_limit));\n\n/* Install a special processing method for COM or APPn markers. */\nEXTERN(void) jpeg_set_marker_processor\n\tJPP((j_decompress_ptr cinfo, int marker_code,\n\t     jpeg_marker_parser_method routine));\n\n/* Read or write raw DCT coefficients --- useful for lossless transcoding. */\nEXTERN(jvirt_barray_ptr *) jpeg_read_coefficients JPP((j_decompress_ptr cinfo));\nEXTERN(void) jpeg_write_coefficients JPP((j_compress_ptr cinfo,\n\t\t\t\t\t  jvirt_barray_ptr * coef_arrays));\nEXTERN(void) jpeg_copy_critical_parameters JPP((j_decompress_ptr srcinfo,\n\t\t\t\t\t\tj_compress_ptr dstinfo));\n\n/* If you choose to abort compression or decompression before completing\n * jpeg_finish_(de)compress, then you need to clean up to release memory,\n * temporary files, etc.  You can just call jpeg_destroy_(de)compress\n * if you're done with the JPEG object, but if you want to clean it up and\n * reuse it, call this:\n */\nEXTERN(void) jpeg_abort_compress JPP((j_compress_ptr cinfo));\nEXTERN(void) jpeg_abort_decompress JPP((j_decompress_ptr cinfo));\n\n/* Generic versions of jpeg_abort and jpeg_destroy that work on either\n * flavor of JPEG object.  These may be more convenient in some places.\n */\nEXTERN(void) jpeg_abort JPP((j_common_ptr cinfo));\nEXTERN(void) jpeg_destroy JPP((j_common_ptr cinfo));\n\n/* Default restart-marker-resync procedure for use by data source modules */\nEXTERN(boolean) jpeg_resync_to_restart JPP((j_decompress_ptr cinfo,\n\t\t\t\t\t    int desired));\n\n\n/* These marker codes are exported since applications and data source modules\n * are likely to want to use them.\n */\n\n#define JPEG_RST0\t0xD0\t/* RST0 marker code */\n#define JPEG_EOI\t0xD9\t/* EOI marker code */\n#define JPEG_APP0\t0xE0\t/* APP0 marker code */\n#define JPEG_COM\t0xFE\t/* COM marker code */\n\n\n/* If we have a brain-damaged compiler that emits warnings (or worse, errors)\n * for structure definitions that are never filled in, keep it quiet by\n * supplying dummy definitions for the various substructures.\n */\n\n#ifdef INCOMPLETE_TYPES_BROKEN\n#ifndef JPEG_INTERNALS\t\t/* will be defined in jpegint.h */\nstruct jvirt_sarray_control { long dummy; };\nstruct jvirt_barray_control { long dummy; };\nstruct jpeg_comp_master { long dummy; };\nstruct jpeg_c_main_controller { long dummy; };\nstruct jpeg_c_prep_controller { long dummy; };\nstruct jpeg_c_coef_controller { long dummy; };\nstruct jpeg_marker_writer { long dummy; };\nstruct jpeg_color_converter { long dummy; };\nstruct jpeg_downsampler { long dummy; };\nstruct jpeg_forward_dct { long dummy; };\nstruct jpeg_entropy_encoder { long dummy; };\nstruct jpeg_decomp_master { long dummy; };\nstruct jpeg_d_main_controller { long dummy; };\nstruct jpeg_d_coef_controller { long dummy; };\nstruct jpeg_d_post_controller { long dummy; };\nstruct jpeg_input_controller { long dummy; };\nstruct jpeg_marker_reader { long dummy; };\nstruct jpeg_entropy_decoder { long dummy; };\nstruct jpeg_inverse_dct { long dummy; };\nstruct jpeg_upsampler { long dummy; };\nstruct jpeg_color_deconverter { long dummy; };\nstruct jpeg_color_quantizer { long dummy; };\n#endif /* JPEG_INTERNALS */\n#endif /* INCOMPLETE_TYPES_BROKEN */\n\n\n/*\n * The JPEG library modules define JPEG_INTERNALS before including this file.\n * The internal structure declarations are read only when that is true.\n * Applications using the library should not include jpegint.h, but may wish\n * to include jerror.h.\n */\n\n#ifdef JPEG_INTERNALS\n#include \"jpegint.h\"\t\t/* fetch private declarations */\n#include \"jerror.h\"\t\t/* fetch error codes too */\n#endif\n\n#ifdef __cplusplus\n#ifndef DONT_USE_EXTERN_C\n}\n#endif\n#endif\n\n#endif /* JPEGLIB_H */\n"
  },
  {
    "path": "src/main/jni/png/config.h",
    "content": "/* config.h.  Generated from config.h.in by configure.  */\n/* config.h.in.  Generated from configure.ac by autoheader.  */\n\n/* Define to 1 if you have the <dlfcn.h> header file. */\n#define HAVE_DLFCN_H 0\n\n/* Define to 1 if you have the <inttypes.h> header file. */\n#define HAVE_INTTYPES_H 0\n\n/* Define to 1 if you have the `m' library (-lm). */\n#define HAVE_LIBM 1\n\n/* Define to 1 if you have the `z' library (-lz). */\n#define HAVE_LIBZ 1\n\n/* Define to 1 if you have the <malloc.h> header file. */\n#define HAVE_MALLOC_H 1\n\n/* Define to 1 if you have the <memory.h> header file. */\n#define HAVE_MEMORY_H 0\n\n/* Define to 1 if you have the `memset' function. */\n#define HAVE_MEMSET 1\n\n/* Define to 1 if you have the `pow' function. */\n/* #undef HAVE_POW */\n\n/* Define to 1 if you have the <stdint.h> header file. */\n#define HAVE_STDINT_H 1\n\n/* Define to 1 if you have the <stdlib.h> header file. */\n#define HAVE_STDLIB_H 1\n\n/* Define to 1 if you have the <strings.h> header file. */\n#define HAVE_STRINGS_H 1\n\n/* Define to 1 if you have the <string.h> header file. */\n#define HAVE_STRING_H 1\n\n/* Define to 1 if you have the <sys/stat.h> header file. */\n#define HAVE_SYS_STAT_H 1\n\n/* Define to 1 if you have the <sys/types.h> header file. */\n#define HAVE_SYS_TYPES_H 1\n\n/* Define to 1 if you have the <unistd.h> header file. */\n#define HAVE_UNISTD_H 1\n\n/* Define to the sub-directory in which libtool stores uninstalled libraries.\n   */\n#define LT_OBJDIR \".libs/\"\n\n/* Name of package */\n#define PACKAGE \"libpng\"\n\n/* Define to the address where bug reports for this package should be sent. */\n#define PACKAGE_BUGREPORT \"png-mng-implement@lists.sourceforge.net\"\n\n/* Define to the full name of this package. */\n#define PACKAGE_NAME \"libpng\"\n\n/* Define to the full name and version of this package. */\n#define PACKAGE_STRING \"libpng 1.4.19\"\n\n/* Define to the one symbol short name of this package. */\n#define PACKAGE_TARNAME \"libpng\"\n\n/* Define to the home page for this package. */\n#define PACKAGE_URL \"\"\n\n/* Define to the version of this package. */\n#define PACKAGE_VERSION \"1.4.19\"\n\n/* Define to 1 if you have the ANSI C header files. */\n#define STDC_HEADERS 1\n\n/* Define to 1 if your <sys/time.h> declares `struct tm'. */\n/* #undef TM_IN_SYS_TIME */\n\n/* Version number of package */\n#define VERSION \"1.4.19\"\n\n/* Define to empty if `const' does not conform to ANSI C. */\n/* #undef const */\n\n/* Define to `unsigned int' if <sys/types.h> does not define. */\n/* #undef size_t */\n"
  },
  {
    "path": "src/main/jni/png/png.h",
    "content": "\n/* png.h - header file for PNG reference library\n *\n * libpng version 1.4.19, December 17, 2015\n *\n * Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson\n * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)\n * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)\n *\n * This code is released under the libpng license (See LICENSE, below)\n *\n * Authors and maintainers:\n *  libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat\n *  libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger\n *  libpng versions 0.97, January 1998, through 1.4.19, December 17, 2015: Glenn\n *  See also \"Contributing Authors\", below.\n */\n\n/*\n * COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:\n *\n * If you modify libpng you may insert additional notices immediately following\n * this sentence.\n *\n * This code is released under the libpng license.\n *\n * libpng versions 1.0.7, July 1, 2000, through 1.4.19, December 17, 2015, are\n * Copyright (c) 2000-2002, 2004, 2006-2015 Glenn Randers-Pehrson, are\n * derived from libpng-1.0.6, and are distributed according to the same\n * disclaimer and license as libpng-1.0.6 with the following individuals\n * added to the list of Contributing Authors:\n *\n *    Simon-Pierre Cadieux\n *    Eric S. Raymond\n *    Cosmin Truta\n *    Gilles Vollant\n *\n * and with the following additions to the disclaimer:\n *\n *    There is no warranty against interference with your enjoyment of the\n *    library or against infringement.  There is no warranty that our\n *    efforts or the library will fulfill any of your particular purposes\n *    or needs.  This library is provided with all faults, and the entire\n *    risk of satisfactory quality, performance, accuracy, and effort is with\n *    the user.\n *\n * libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are\n * Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from\n * libpng-0.96, and are distributed according to the same disclaimer and\n * license as libpng-0.96, with the following individuals added to the list\n * of Contributing Authors:\n *\n *    Tom Lane\n *    Glenn Randers-Pehrson\n *    Willem van Schaik\n *\n * libpng versions 0.89, June 1996, through 0.96, May 1997, are\n * Copyright (c) 1996-1997 Andreas Dilger, are derived from libpng-0.88,\n * and are distributed according to the same disclaimer and license as\n * libpng-0.88, with the following individuals added to the list of\n * Contributing Authors:\n *\n *    John Bowler\n *    Kevin Bracey\n *    Sam Bushell\n *    Magnus Holmgren\n *    Greg Roelofs\n *    Tom Tanner\n *\n * libpng versions 0.5, May 1995, through 0.88, January 1996, are\n * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.\n *\n * For the purposes of this copyright and license, \"Contributing Authors\"\n * is defined as the following set of individuals:\n *\n *    Andreas Dilger\n *    Dave Martindale\n *    Guy Eric Schalnat\n *    Paul Schmidt\n *    Tim Wegner\n *\n * The PNG Reference Library is supplied \"AS IS\".  The Contributing Authors\n * and Group 42, Inc. disclaim all warranties, expressed or implied,\n * including, without limitation, the warranties of merchantability and of\n * fitness for any purpose.  The Contributing Authors and Group 42, Inc.\n * assume no liability for direct, indirect, incidental, special, exemplary,\n * or consequential damages, which may result from the use of the PNG\n * Reference Library, even if advised of the possibility of such damage.\n *\n * Permission is hereby granted to use, copy, modify, and distribute this\n * source code, or portions hereof, for any purpose, without fee, subject\n * to the following restrictions:\n *\n *   1. The origin of this source code must not be misrepresented.\n *\n *   2. Altered versions must be plainly marked as such and must not\n *      be misrepresented as being the original source.\n *\n *   3. This Copyright notice may not be removed or altered from any\n *      source or altered source distribution.\n *\n * The Contributing Authors and Group 42, Inc. specifically permit, without\n * fee, and encourage the use of this source code as a component to\n * supporting the PNG file format in commercial products.  If you use this\n * source code in a product, acknowledgment is not required but would be\n * appreciated.\n *\n * END OF COPYRIGHT NOTICE, DISCLAIMER, and LICENSE.\n */\n\n/*\n * A \"png_get_copyright\" function is available, for convenient use in \"about\"\n * boxes and the like:\n *\n *    printf(\"%s\", png_get_copyright(NULL));\n *\n * Also, the PNG logo (in PNG format, of course) is supplied in the\n * files \"pngbar.png\" and \"pngbar.jpg (88x31) and \"pngnow.png\" (98x31).\n */\n\n/*\n * Libpng is OSI Certified Open Source Software.  OSI Certified Open Source is\n * a certification mark of the Open Source Initiative. OSI has not addressed\n * the additional disclaimers inserted at version 1.0.7.\n */\n\n/*\n * The contributing authors would like to thank all those who helped\n * with testing, bug fixes, and patience.  This wouldn't have been\n * possible without all of you.\n *\n * Thanks to Frank J. T. Wojcik for helping with the documentation.\n */\n\n/* Note about libpng version numbers:\n *\n *    Due to various miscommunications, unforeseen code incompatibilities\n *    and occasional factors outside the authors' control, version numbering\n *    on the library has not always been consistent and straightforward.\n *    The following table summarizes matters since version 0.89c, which was\n *    the first widely used release:\n *\n *    source                 png.h  png.h  shared-lib\n *    version                string   int  version\n *    -------                ------ -----  ----------\n *    0.89c \"1.0 beta 3\"     0.89      89  1.0.89\n *    0.90  \"1.0 beta 4\"     0.90      90  0.90  [should have been 2.0.90]\n *    0.95  \"1.0 beta 5\"     0.95      95  0.95  [should have been 2.0.95]\n *    0.96  \"1.0 beta 6\"     0.96      96  0.96  [should have been 2.0.96]\n *    0.97b \"1.00.97 beta 7\" 1.00.97   97  1.0.1 [should have been 2.0.97]\n *    0.97c                  0.97      97  2.0.97\n *    0.98                   0.98      98  2.0.98\n *    0.99                   0.99      98  2.0.99\n *    0.99a-m                0.99      99  2.0.99\n *    1.00                   1.00     100  2.1.0 [100 should be 10000]\n *    1.0.0      (from here on, the   100  2.1.0 [100 should be 10000]\n *    1.0.1       png.h string is   10001  2.1.0\n *    1.0.1a-e    identical to the  10002  from here on, the shared library\n *    1.0.2       source version)   10002  is 2.V where V is the source code\n *    1.0.2a-b                      10003  version, except as noted.\n *    1.0.3                         10003\n *    1.0.3a-d                      10004\n *    1.0.4                         10004\n *    1.0.4a-f                      10005\n *    1.0.5 (+ 2 patches)           10005\n *    1.0.5a-d                      10006\n *    1.0.5e-r                      10100 (not source compatible)\n *    1.0.5s-v                      10006 (not binary compatible)\n *    1.0.6 (+ 3 patches)           10006 (still binary incompatible)\n *    1.0.6d-f                      10007 (still binary incompatible)\n *    1.0.6g                        10007\n *    1.0.6h                        10007  10.6h (testing xy.z so-numbering)\n *    1.0.6i                        10007  10.6i\n *    1.0.6j                        10007  2.1.0.6j (incompatible with 1.0.0)\n *    1.0.7beta11-14        DLLNUM  10007  2.1.0.7beta11-14 (binary compatible)\n *    1.0.7beta15-18           1    10007  2.1.0.7beta15-18 (binary compatible)\n *    1.0.7rc1-2               1    10007  2.1.0.7rc1-2 (binary compatible)\n *    1.0.7                    1    10007  (still compatible)\n *    ...\n *    1.0.19                  10    10019  10.so.0.19[.0]\n *    ...\n *    1.4.19                  14    10419  14.so.14.19[.0]\n *\n *    Henceforth the source version will match the shared-library major\n *    and minor numbers; the shared-library major version number will be\n *    used for changes in backward compatibility, as it is intended.  The\n *    PNG_LIBPNG_VER macro, which is not used within libpng but is available\n *    for applications, is an unsigned integer of the form xyyzz corresponding\n *    to the source version x.y.z (leading zeros in y and z).  Beta versions\n *    were given the previous public release number plus a letter, until\n *    version 1.0.6j; from then on they were given the upcoming public\n *    release number plus \"betaNN\" or \"rcNN\".\n *\n *    Binary incompatibility exists only when applications make direct access\n *    to the info_ptr or png_ptr members through png.h, and the compiled\n *    application is loaded with a different version of the library.\n *\n *    DLLNUM will change each time there are forward or backward changes\n *    in binary compatibility (e.g., when a new feature is added).\n *\n * See libpng.txt or libpng.3 for more information.  The PNG specification\n * is available as a W3C Recommendation and as an ISO Specification,\n * <http://www.w3.org/TR/2003/REC-PNG-20031110/\n */\n\n/*\n * Y2K compliance in libpng:\n * =========================\n *\n *    December 17, 2015\n *\n *    Since the PNG Development group is an ad-hoc body, we can't make\n *    an official declaration.\n *\n *    This is your unofficial assurance that libpng from version 0.71 and\n *    upward through 1.4.19 are Y2K compliant.  It is my belief that earlier\n *    versions were also Y2K compliant.\n *\n *    Libpng only has three year fields.  One is a 2-byte unsigned integer\n *    that will hold years up to 65535.  The other two hold the date in text\n *    format, and will hold years up to 9999.\n *\n *    The integer is\n *        \"png_uint_16 year\" in png_time_struct.\n *\n *    The strings are\n *        \"png_charp time_buffer\" in png_struct and\n *        \"near_time_buffer\", which is a local character string in png.c.\n *\n *    There are seven time-related functions:\n *        png.c: png_convert_to_rfc_1123() in png.c\n *          (formerly png_convert_to_rfc_1152() in error)\n *        png_convert_from_struct_tm() in pngwrite.c, called in pngwrite.c\n *        png_convert_from_time_t() in pngwrite.c\n *        png_get_tIME() in pngget.c\n *        png_handle_tIME() in pngrutil.c, called in pngread.c\n *        png_set_tIME() in pngset.c\n *        png_write_tIME() in pngwutil.c, called in pngwrite.c\n *\n *    All handle dates properly in a Y2K environment.  The\n *    png_convert_from_time_t() function calls gmtime() to convert from system\n *    clock time, which returns (year - 1900), which we properly convert to\n *    the full 4-digit year.  There is a possibility that applications using\n *    libpng are not passing 4-digit years into the png_convert_to_rfc_1123()\n *    function, or that they are incorrectly passing only a 2-digit year\n *    instead of \"year - 1900\" into the png_convert_from_struct_tm() function,\n *    but this is not under our control.  The libpng documentation has always\n *    stated that it works with 4-digit years, and the APIs have been\n *    documented as such.\n *\n *    The tIME chunk itself is also Y2K compliant.  It uses a 2-byte unsigned\n *    integer to hold the year, and can hold years as large as 65535.\n *\n *    zlib, upon which libpng depends, is also Y2K compliant.  It contains\n *    no date-related code.\n *\n *       Glenn Randers-Pehrson\n *       libpng maintainer\n *       PNG Development Group\n */\n\n#ifndef PNG_H\n#define PNG_H\n\n/* This is not the place to learn how to use libpng.  The file libpng.txt\n * describes how to use libpng, and the file example.c summarizes it\n * with some code on which to build.  This file is useful for looking\n * at the actual function definitions and structure components.\n */\n\n/* Version information for png.h - this should match the version in png.c */\n#define PNG_LIBPNG_VER_STRING \"1.4.19\"\n#define PNG_HEADER_VERSION_STRING \\\n   \" libpng version 1.4.19 - December 17, 2015\\n\"\n\n#define PNG_LIBPNG_VER_SONUM   14\n#define PNG_LIBPNG_VER_DLLNUM  14\n\n/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */\n#define PNG_LIBPNG_VER_MAJOR   1\n#define PNG_LIBPNG_VER_MINOR   4\n#define PNG_LIBPNG_VER_RELEASE 19\n/* This should match the numeric part of the final component of\n * PNG_LIBPNG_VER_STRING, omitting any leading zero:\n */\n\n#define PNG_LIBPNG_VER_BUILD  0\n\n/* Release Status */\n#define PNG_LIBPNG_BUILD_ALPHA    1\n#define PNG_LIBPNG_BUILD_BETA     2\n#define PNG_LIBPNG_BUILD_RC       3\n#define PNG_LIBPNG_BUILD_STABLE   4\n#define PNG_LIBPNG_BUILD_RELEASE_STATUS_MASK 7\n\n/* Release-Specific Flags */\n#define PNG_LIBPNG_BUILD_PATCH    8 /* Can be OR'ed with\n                                       PNG_LIBPNG_BUILD_STABLE only */\n#define PNG_LIBPNG_BUILD_PRIVATE 16 /* Cannot be OR'ed with\n                                       PNG_LIBPNG_BUILD_SPECIAL */\n#define PNG_LIBPNG_BUILD_SPECIAL 32 /* Cannot be OR'ed with\n                                       PNG_LIBPNG_BUILD_PRIVATE */\n\n#define PNG_LIBPNG_BUILD_BASE_TYPE PNG_LIBPNG_BUILD_STABLE\n\n/* Careful here.  At one time, Guy wanted to use 082, but that would be octal.\n * We must not include leading zeros.\n * Versions 0.7 through 1.0.0 were in the range 0 to 100 here (only\n * version 1.0.0 was mis-numbered 100 instead of 10000).  From\n * version 1.0.1 it's    xxyyzz, where x=major, y=minor, z=release\n */\n#define PNG_LIBPNG_VER 10419 /* 1.4.19 */\n\n#ifndef PNG_VERSION_INFO_ONLY\n/* Include the compression library's header */\n#include \"zlib.h\"\n#endif\n\n/* Include all user configurable info, including optional assembler routines */\n#include \"pngconf.h\"\n\n/*\n * Added at libpng-1.2.8\n *\n * Ref MSDN: Private as priority over Special\n * VS_FF_PRIVATEBUILD File *was not* built using standard release\n * procedures. If this value is given, the StringFileInfo block must\n * contain a PrivateBuild string.\n *\n * VS_FF_SPECIALBUILD File *was* built by the original company using\n * standard release procedures but is a variation of the standard\n * file of the same version number. If this value is given, the\n * StringFileInfo block must contain a SpecialBuild string.\n */\n\n#ifdef PNG_USER_PRIVATEBUILD\n#  define PNG_LIBPNG_BUILD_TYPE \\\n          (PNG_LIBPNG_BUILD_BASE_TYPE | PNG_LIBPNG_BUILD_PRIVATE)\n#else\n#  ifdef PNG_LIBPNG_SPECIALBUILD\n#    define PNG_LIBPNG_BUILD_TYPE \\\n            (PNG_LIBPNG_BUILD_BASE_TYPE | PNG_LIBPNG_BUILD_SPECIAL)\n#  else\n#    define PNG_LIBPNG_BUILD_TYPE (PNG_LIBPNG_BUILD_BASE_TYPE)\n#  endif\n#endif\n\n#ifndef PNG_VERSION_INFO_ONLY\n\n/* Inhibit C++ name-mangling for libpng functions but not for system calls. */\n#ifdef __cplusplus\nextern \"C\" {\n#endif /* __cplusplus */\n\n/* This file is arranged in several sections.  The first section contains\n * structure and type definitions.  The second section contains the external\n * library functions, while the third has the internal library functions,\n * which applications aren't expected to use directly.\n */\n\n/* Variables declared in png.c - only it needs to define PNG_NO_EXTERN */\n#if !defined(PNG_NO_EXTERN) || defined(PNG_ALWAYS_EXTERN)\n/* Version information for C files, stored in png.c.  This had better match\n * the version above.\n */\n#define png_libpng_ver png_get_header_ver(NULL)\n\n#endif /* PNG_NO_EXTERN */\n\n/* Three color definitions.  The order of the red, green, and blue, (and the\n * exact size) is not important, although the size of the fields need to\n * be png_byte or png_uint_16 (as defined below).\n */\ntypedef struct png_color_struct\n{\n   png_byte red;\n   png_byte green;\n   png_byte blue;\n} png_color;\ntypedef png_color FAR * png_colorp;\ntypedef png_color FAR * FAR * png_colorpp;\n\ntypedef struct png_color_16_struct\n{\n   png_byte index;    /* used for palette files */\n   png_uint_16 red;   /* for use in red green blue files */\n   png_uint_16 green;\n   png_uint_16 blue;\n   png_uint_16 gray;  /* for use in grayscale files */\n} png_color_16;\ntypedef png_color_16 FAR * png_color_16p;\ntypedef png_color_16 FAR * FAR * png_color_16pp;\n\ntypedef struct png_color_8_struct\n{\n   png_byte red;   /* for use in red green blue files */\n   png_byte green;\n   png_byte blue;\n   png_byte gray;  /* for use in grayscale files */\n   png_byte alpha; /* for alpha channel files */\n} png_color_8;\ntypedef png_color_8 FAR * png_color_8p;\ntypedef png_color_8 FAR * FAR * png_color_8pp;\n\n/*\n * The following two structures are used for the in-core representation\n * of sPLT chunks.\n */\ntypedef struct png_sPLT_entry_struct\n{\n   png_uint_16 red;\n   png_uint_16 green;\n   png_uint_16 blue;\n   png_uint_16 alpha;\n   png_uint_16 frequency;\n} png_sPLT_entry;\ntypedef png_sPLT_entry FAR * png_sPLT_entryp;\ntypedef png_sPLT_entry FAR * FAR * png_sPLT_entrypp;\n\n/*  When the depth of the sPLT palette is 8 bits, the color and alpha samples\n *  occupy the LSB of their respective members, and the MSB of each member\n *  is zero-filled.  The frequency member always occupies the full 16 bits.\n */\n\ntypedef struct png_sPLT_struct\n{\n   png_charp name;           /* palette name */\n   png_byte depth;           /* depth of palette samples */\n   png_sPLT_entryp entries;  /* palette entries */\n   png_int_32 nentries;      /* number of palette entries */\n} png_sPLT_t;\ntypedef png_sPLT_t FAR * png_sPLT_tp;\ntypedef png_sPLT_t FAR * FAR * png_sPLT_tpp;\n\n#ifdef PNG_TEXT_SUPPORTED\n/* png_text holds the contents of a text/ztxt/itxt chunk in a PNG file,\n * and whether that contents is compressed or not.  The \"key\" field\n * points to a regular zero-terminated C string.  The \"text\", \"lang\", and\n * \"lang_key\" fields can be regular C strings, empty strings, or NULL pointers.\n * However, the * structure returned by png_get_text() will always contain\n * regular zero-terminated C strings (possibly empty), never NULL pointers,\n * so they can be safely used in printf() and other string-handling functions.\n */\ntypedef struct png_text_struct\n{\n   int  compression;       /* compression value:\n                             -1: tEXt, none\n                              0: zTXt, deflate\n                              1: iTXt, none\n                              2: iTXt, deflate  */\n   png_charp key;          /* keyword, 1-79 character description of \"text\" */\n   png_charp text;         /* comment, may be an empty string (ie \"\")\n                              or a NULL pointer */\n   png_size_t text_length; /* length of the text string */\n#ifdef PNG_iTXt_SUPPORTED\n   png_size_t itxt_length; /* length of the itxt string */\n   png_charp lang;         /* language code, 0-79 characters\n                              or a NULL pointer */\n   png_charp lang_key;     /* keyword translated UTF-8 string, 0 or more\n                              chars or a NULL pointer */\n#endif\n} png_text;\ntypedef png_text FAR * png_textp;\ntypedef png_text FAR * FAR * png_textpp;\n#endif\n\n/* Supported compression types for text in PNG files (tEXt, and zTXt).\n * The values of the PNG_TEXT_COMPRESSION_ defines should NOT be changed. */\n#define PNG_TEXT_COMPRESSION_NONE_WR -3\n#define PNG_TEXT_COMPRESSION_zTXt_WR -2\n#define PNG_TEXT_COMPRESSION_NONE    -1\n#define PNG_TEXT_COMPRESSION_zTXt     0\n#define PNG_ITXT_COMPRESSION_NONE     1\n#define PNG_ITXT_COMPRESSION_zTXt     2\n#define PNG_TEXT_COMPRESSION_LAST     3  /* Not a valid value */\n\n/* png_time is a way to hold the time in an machine independent way.\n * Two conversions are provided, both from time_t and struct tm.  There\n * is no portable way to convert to either of these structures, as far\n * as I know.  If you know of a portable way, send it to me.  As a side\n * note - PNG has always been Year 2000 compliant!\n */\ntypedef struct png_time_struct\n{\n   png_uint_16 year; /* full year, as in, 1995 */\n   png_byte month;   /* month of year, 1 - 12 */\n   png_byte day;     /* day of month, 1 - 31 */\n   png_byte hour;    /* hour of day, 0 - 23 */\n   png_byte minute;  /* minute of hour, 0 - 59 */\n   png_byte second;  /* second of minute, 0 - 60 (for leap seconds) */\n} png_time;\ntypedef png_time FAR * png_timep;\ntypedef png_time FAR * FAR * png_timepp;\n\n#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) || \\\n defined(PNG_HANDLE_AS_UNKNOWN_SUPPORTED)\n/* png_unknown_chunk is a structure to hold queued chunks for which there is\n * no specific support.  The idea is that we can use this to queue\n * up private chunks for output even though the library doesn't actually\n * know about their semantics.\n */\ntypedef struct png_unknown_chunk_t\n{\n    png_byte name[5];\n    png_byte *data;\n    png_size_t size;\n\n    /* libpng-using applications should NOT directly modify this byte. */\n    png_byte location; /* mode of operation at read time */\n}\npng_unknown_chunk;\ntypedef png_unknown_chunk FAR * png_unknown_chunkp;\ntypedef png_unknown_chunk FAR * FAR * png_unknown_chunkpp;\n#endif\n\n/* png_info is a structure that holds the information in a PNG file so\n * that the application can find out the characteristics of the image.\n * If you are reading the file, this structure will tell you what is\n * in the PNG file.  If you are writing the file, fill in the information\n * you want to put into the PNG file, then call png_write_info().\n * The names chosen should be very close to the PNG specification, so\n * consult that document for information about the meaning of each field.\n *\n * With libpng < 0.95, it was only possible to directly set and read the\n * the values in the png_info_struct, which meant that the contents and\n * order of the values had to remain fixed.  With libpng 0.95 and later,\n * however, there are now functions that abstract the contents of\n * png_info_struct from the application, so this makes it easier to use\n * libpng with dynamic libraries, and even makes it possible to use\n * libraries that don't have all of the libpng ancillary chunk-handing\n * functionality.\n *\n * In any case, the order of the parameters in png_info_struct should NOT\n * be changed for as long as possible to keep compatibility with applications\n * that use the old direct-access method with png_info_struct.\n *\n * The following members may have allocated storage attached that should be\n * cleaned up before the structure is discarded: palette, trans, text,\n * pcal_purpose, pcal_units, pcal_params, hist, iccp_name, iccp_profile,\n * splt_palettes, scal_unit, row_pointers, and unknowns.   By default, these\n * are automatically freed when the info structure is deallocated, if they were\n * allocated internally by libpng.  This behavior can be changed by means\n * of the png_data_freer() function.\n *\n * More allocation details: all the chunk-reading functions that\n * change these members go through the corresponding png_set_*\n * functions.  A function to clear these members is available: see\n * png_free_data().  The png_set_* functions do not depend on being\n * able to point info structure members to any of the storage they are\n * passed (they make their own copies), EXCEPT that the png_set_text\n * functions use the same storage passed to them in the text_ptr or\n * itxt_ptr structure argument, and the png_set_rows and png_set_unknowns\n * functions do not make their own copies.\n */\ntypedef struct png_info_struct\n{\n   /* the following are necessary for every PNG file */\n   png_uint_32 width PNG_DEPSTRUCT;  /* width of image in pixels (from IHDR) */\n   png_uint_32 height PNG_DEPSTRUCT; /* height of image in pixels (from IHDR) */\n   png_uint_32 valid PNG_DEPSTRUCT;  /* valid chunk data (see PNG_INFO_\n                                        below) */\n   png_size_t rowbytes PNG_DEPSTRUCT; /* bytes needed to hold an untransformed\n                                         row */\n   png_colorp palette PNG_DEPSTRUCT;      /* array of color values\n                                             (valid & PNG_INFO_PLTE) */\n   png_uint_16 num_palette PNG_DEPSTRUCT; /* number of color entries in\n                                             \"palette\" (PLTE) */\n   png_uint_16 num_trans PNG_DEPSTRUCT;   /* number of transparent palette\n                                             color (tRNS) */\n   png_byte bit_depth PNG_DEPSTRUCT;      /* 1, 2, 4, 8, or 16 bits/channel\n                                             (from IHDR) */\n   png_byte color_type PNG_DEPSTRUCT;     /* see PNG_COLOR_TYPE_ below\n                                             (from IHDR) */\n   /* The following three should have been named *_method not *_type */\n   png_byte compression_type PNG_DEPSTRUCT; /* must be\n                                             PNG_COMPRESSION_TYPE_BASE (IHDR) */\n   png_byte filter_type PNG_DEPSTRUCT;    /* must be PNG_FILTER_TYPE_BASE\n                                             (from IHDR) */\n   png_byte interlace_type PNG_DEPSTRUCT; /* One of PNG_INTERLACE_NONE,\n                                             PNG_INTERLACE_ADAM7 */\n\n   /* The following is informational only on read, and not used on writes. */\n   png_byte channels PNG_DEPSTRUCT;       /* number of data channels per\n                                             pixel (1, 2, 3, 4) */\n   png_byte pixel_depth PNG_DEPSTRUCT;    /* number of bits per pixel */\n   png_byte spare_byte PNG_DEPSTRUCT;     /* to align the data, and for\n                                             future use */\n   png_byte signature[8] PNG_DEPSTRUCT;   /* magic bytes read by libpng\n                                             from start of file */\n\n   /* The rest of the data is optional.  If you are reading, check the\n    * valid field to see if the information in these are valid.  If you\n    * are writing, set the valid field to those chunks you want written,\n    * and initialize the appropriate fields below.\n    */\n\n#if defined(PNG_gAMA_SUPPORTED) && defined(PNG_FLOATING_POINT_SUPPORTED)\n   /* The gAMA chunk describes the gamma characteristics of the system\n    * on which the image was created, normally in the range [1.0, 2.5].\n    * Data is valid if (valid & PNG_INFO_gAMA) is non-zero.\n    */\n   float gamma PNG_DEPSTRUCT; /* gamma value of image,\n                                 if (valid & PNG_INFO_gAMA) */\n#endif\n\n#ifdef PNG_sRGB_SUPPORTED\n    /* GR-P, 0.96a */\n    /* Data valid if (valid & PNG_INFO_sRGB) non-zero. */\n   png_byte srgb_intent PNG_DEPSTRUCT; /* sRGB rendering intent\n                                          [0, 1, 2, or 3] */\n#endif\n\n#ifdef PNG_TEXT_SUPPORTED\n   /* The tEXt, and zTXt chunks contain human-readable textual data in\n    * uncompressed, compressed, and optionally compressed forms, respectively.\n    * The data in \"text\" is an array of pointers to uncompressed,\n    * null-terminated C strings. Each chunk has a keyword that describes the\n    * textual data contained in that chunk.  Keywords are not required to be\n    * unique, and the text string may be empty.  Any number of text chunks may\n    * be in an image.\n    */\n   int num_text PNG_DEPSTRUCT; /* number of comments read/to write */\n   int max_text PNG_DEPSTRUCT; /* current size of text array */\n   png_textp text PNG_DEPSTRUCT; /* array of comments read/to write */\n#endif /* PNG_TEXT_SUPPORTED */\n\n#ifdef PNG_tIME_SUPPORTED\n   /* The tIME chunk holds the last time the displayed image data was\n    * modified.  See the png_time struct for the contents of this struct.\n    */\n   png_time mod_time PNG_DEPSTRUCT;\n#endif\n\n#ifdef PNG_sBIT_SUPPORTED\n   /* The sBIT chunk specifies the number of significant high-order bits\n    * in the pixel data.  Values are in the range [1, bit_depth], and are\n    * only specified for the channels in the pixel data.  The contents of\n    * the low-order bits is not specified.  Data is valid if\n    * (valid & PNG_INFO_sBIT) is non-zero.\n    */\n   png_color_8 sig_bit PNG_DEPSTRUCT; /* significant bits in color channels */\n#endif\n\n#if defined(PNG_tRNS_SUPPORTED) || defined(PNG_READ_EXPAND_SUPPORTED) || \\\ndefined(PNG_READ_BACKGROUND_SUPPORTED)\n   /* The tRNS chunk supplies transparency data for paletted images and\n    * other image types that don't need a full alpha channel.  There are\n    * \"num_trans\" transparency values for a paletted image, stored in the\n    * same order as the palette colors, starting from index 0.  Values\n    * for the data are in the range [0, 255], ranging from fully transparent\n    * to fully opaque, respectively.  For non-paletted images, there is a\n    * single color specified that should be treated as fully transparent.\n    * Data is valid if (valid & PNG_INFO_tRNS) is non-zero.\n    */\n   png_bytep trans_alpha PNG_DEPSTRUCT;    /* alpha values for paletted\n                                              image */\n   png_color_16 trans_color PNG_DEPSTRUCT; /* transparent color for\n                                              non-palette image */\n#endif\n\n#if defined(PNG_bKGD_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)\n   /* The bKGD chunk gives the suggested image background color if the\n    * display program does not have its own background color and the image\n    * is needs to composited onto a background before display.  The colors\n    * in \"background\" are normally in the same color space/depth as the\n    * pixel data.  Data is valid if (valid & PNG_INFO_bKGD) is non-zero.\n    */\n   png_color_16 background PNG_DEPSTRUCT;\n#endif\n\n#ifdef PNG_oFFs_SUPPORTED\n   /* The oFFs chunk gives the offset in \"offset_unit_type\" units rightwards\n    * and downwards from the top-left corner of the display, page, or other\n    * application-specific co-ordinate space.  See the PNG_OFFSET_ defines\n    * below for the unit types.  Valid if (valid & PNG_INFO_oFFs) non-zero.\n    */\n   png_int_32 x_offset PNG_DEPSTRUCT; /* x offset on page */\n   png_int_32 y_offset PNG_DEPSTRUCT; /* y offset on page */\n   png_byte offset_unit_type PNG_DEPSTRUCT; /* offset units type */\n#endif\n\n#ifdef PNG_pHYs_SUPPORTED\n   /* The pHYs chunk gives the physical pixel density of the image for\n    * display or printing in \"phys_unit_type\" units (see PNG_RESOLUTION_\n    * defines below).  Data is valid if (valid & PNG_INFO_pHYs) is non-zero.\n    */\n   png_uint_32 x_pixels_per_unit PNG_DEPSTRUCT; /* horizontal pixel density */\n   png_uint_32 y_pixels_per_unit PNG_DEPSTRUCT; /* vertical pixel density */\n   png_byte phys_unit_type PNG_DEPSTRUCT; /* resolution type (see\n                                             PNG_RESOLUTION_ below) */\n#endif\n\n#ifdef PNG_hIST_SUPPORTED\n   /* The hIST chunk contains the relative frequency or importance of the\n    * various palette entries, so that a viewer can intelligently select a\n    * reduced-color palette, if required.  Data is an array of \"num_palette\"\n    * values in the range [0,65535]. Data valid if (valid & PNG_INFO_hIST)\n    * is non-zero.\n    */\n   png_uint_16p hist PNG_DEPSTRUCT;\n#endif\n\n#ifdef PNG_cHRM_SUPPORTED\n   /* The cHRM chunk describes the CIE color characteristics of the monitor\n    * on which the PNG was created.  This data allows the viewer to do gamut\n    * mapping of the input image to ensure that the viewer sees the same\n    * colors in the image as the creator.  Values are in the range\n    * [0.0, 0.8].  Data valid if (valid & PNG_INFO_cHRM) non-zero.\n    */\n#ifdef PNG_FLOATING_POINT_SUPPORTED\n   float x_white PNG_DEPSTRUCT;\n   float y_white PNG_DEPSTRUCT;\n   float x_red PNG_DEPSTRUCT;\n   float y_red PNG_DEPSTRUCT;\n   float x_green PNG_DEPSTRUCT;\n   float y_green PNG_DEPSTRUCT;\n   float x_blue PNG_DEPSTRUCT;\n   float y_blue PNG_DEPSTRUCT;\n#endif\n#endif\n\n#ifdef PNG_pCAL_SUPPORTED\n   /* The pCAL chunk describes a transformation between the stored pixel\n    * values and original physical data values used to create the image.\n    * The integer range [0, 2^bit_depth - 1] maps to the floating-point\n    * range given by [pcal_X0, pcal_X1], and are further transformed by a\n    * (possibly non-linear) transformation function given by \"pcal_type\"\n    * and \"pcal_params\" into \"pcal_units\".  Please see the PNG_EQUATION_\n    * defines below, and the PNG-Group's PNG extensions document for a\n    * complete description of the transformations and how they should be\n    * implemented, and for a description of the ASCII parameter strings.\n    * Data values are valid if (valid & PNG_INFO_pCAL) non-zero.\n    */\n   png_charp pcal_purpose PNG_DEPSTRUCT;  /* pCAL chunk description string */\n   png_int_32 pcal_X0 PNG_DEPSTRUCT;      /* minimum value */\n   png_int_32 pcal_X1 PNG_DEPSTRUCT;      /* maximum value */\n   png_charp pcal_units PNG_DEPSTRUCT;    /* Latin-1 string giving physical\n                                             units */\n   png_charpp pcal_params PNG_DEPSTRUCT;  /* ASCII strings containing\n                                             parameter values */\n   png_byte pcal_type PNG_DEPSTRUCT;      /* equation type\n                                             (see PNG_EQUATION_ below) */\n   png_byte pcal_nparams PNG_DEPSTRUCT;   /* number of parameters given\n                                             in pcal_params */\n#endif\n\n/* New members added in libpng-1.0.6 */\n   png_uint_32 free_me PNG_DEPSTRUCT;     /* flags items libpng is\n                                             responsible for freeing */\n\n#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) || \\\n defined(PNG_HANDLE_AS_UNKNOWN_SUPPORTED)\n   /* Storage for unknown chunks that the library doesn't recognize. */\n   png_unknown_chunkp unknown_chunks PNG_DEPSTRUCT;\n   png_size_t unknown_chunks_num PNG_DEPSTRUCT;\n#endif\n\n#ifdef PNG_iCCP_SUPPORTED\n   /* iCCP chunk data. */\n   png_charp iccp_name PNG_DEPSTRUCT;     /* profile name */\n   png_charp iccp_profile PNG_DEPSTRUCT;  /* International Color Consortium\n                                             profile data */\n                            /* Note to maintainer: should be png_bytep */\n   png_uint_32 iccp_proflen PNG_DEPSTRUCT;  /* ICC profile data length */\n   png_byte iccp_compression PNG_DEPSTRUCT; /* Always zero */\n#endif\n\n#ifdef PNG_sPLT_SUPPORTED\n   /* Data on sPLT chunks (there may be more than one). */\n   png_sPLT_tp splt_palettes PNG_DEPSTRUCT;\n   png_uint_32 splt_palettes_num PNG_DEPSTRUCT;\n#endif\n\n#ifdef PNG_sCAL_SUPPORTED\n   /* The sCAL chunk describes the actual physical dimensions of the\n    * subject matter of the graphic.  The chunk contains a unit specification\n    * a byte value, and two ASCII strings representing floating-point\n    * values.  The values are width and height corresponsing to one pixel\n    * in the image.  This external representation is converted to double\n    * here.  Data values are valid if (valid & PNG_INFO_sCAL) is non-zero.\n    */\n   png_byte scal_unit PNG_DEPSTRUCT;         /* unit of physical scale */\n#ifdef PNG_FLOATING_POINT_SUPPORTED\n   double scal_pixel_width PNG_DEPSTRUCT;    /* width of one pixel */\n   double scal_pixel_height PNG_DEPSTRUCT;   /* height of one pixel */\n#endif\n#ifdef PNG_FIXED_POINT_SUPPORTED\n   png_charp scal_s_width PNG_DEPSTRUCT;     /* string containing height */\n   png_charp scal_s_height PNG_DEPSTRUCT;    /* string containing width */\n#endif\n#endif\n\n#ifdef PNG_INFO_IMAGE_SUPPORTED\n   /* Memory has been allocated if (valid & PNG_ALLOCATED_INFO_ROWS)\n      non-zero */\n   /* Data valid if (valid & PNG_INFO_IDAT) non-zero */\n   png_bytepp row_pointers PNG_DEPSTRUCT;        /* the image bits */\n#endif\n\n#if defined(PNG_FIXED_POINT_SUPPORTED) && defined(PNG_gAMA_SUPPORTED)\n   png_fixed_point int_gamma PNG_DEPSTRUCT; /* gamma of image,\n                                               if (valid & PNG_INFO_gAMA) */\n#endif\n\n#if defined(PNG_cHRM_SUPPORTED) && defined(PNG_FIXED_POINT_SUPPORTED)\n   png_fixed_point int_x_white PNG_DEPSTRUCT;\n   png_fixed_point int_y_white PNG_DEPSTRUCT;\n   png_fixed_point int_x_red PNG_DEPSTRUCT;\n   png_fixed_point int_y_red PNG_DEPSTRUCT;\n   png_fixed_point int_x_green PNG_DEPSTRUCT;\n   png_fixed_point int_y_green PNG_DEPSTRUCT;\n   png_fixed_point int_x_blue PNG_DEPSTRUCT;\n   png_fixed_point int_y_blue PNG_DEPSTRUCT;\n#endif\n\n} png_info;\n\ntypedef png_info FAR * png_infop;\ntypedef PNG_CONST png_info FAR * png_const_infop;\ntypedef png_info FAR * FAR * png_infopp;\n\n/* Maximum positive integer used in PNG is (2^31)-1 */\n#define PNG_UINT_31_MAX ((png_uint_32)0x7fffffffL)\n#define PNG_UINT_32_MAX ((png_uint_32)(-1))\n#define PNG_SIZE_MAX ((png_size_t)(-1))\n\n/* These describe the color_type field in png_info. */\n/* color type masks */\n#define PNG_COLOR_MASK_PALETTE    1\n#define PNG_COLOR_MASK_COLOR      2\n#define PNG_COLOR_MASK_ALPHA      4\n\n/* color types.  Note that not all combinations are legal */\n#define PNG_COLOR_TYPE_GRAY 0\n#define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)\n#define PNG_COLOR_TYPE_RGB        (PNG_COLOR_MASK_COLOR)\n#define PNG_COLOR_TYPE_RGB_ALPHA  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_ALPHA)\n#define PNG_COLOR_TYPE_GRAY_ALPHA (PNG_COLOR_MASK_ALPHA)\n/* aliases */\n#define PNG_COLOR_TYPE_RGBA  PNG_COLOR_TYPE_RGB_ALPHA\n#define PNG_COLOR_TYPE_GA  PNG_COLOR_TYPE_GRAY_ALPHA\n\n/* This is for compression type. PNG 1.0-1.2 only define the single type. */\n#define PNG_COMPRESSION_TYPE_BASE 0 /* Deflate method 8, 32K window */\n#define PNG_COMPRESSION_TYPE_DEFAULT PNG_COMPRESSION_TYPE_BASE\n\n/* This is for filter type. PNG 1.0-1.2 only define the single type. */\n#define PNG_FILTER_TYPE_BASE      0 /* Single row per-byte filtering */\n#define PNG_INTRAPIXEL_DIFFERENCING 64 /* Used only in MNG datastreams */\n#define PNG_FILTER_TYPE_DEFAULT   PNG_FILTER_TYPE_BASE\n\n/* These are for the interlacing type.  These values should NOT be changed. */\n#define PNG_INTERLACE_NONE        0 /* Non-interlaced image */\n#define PNG_INTERLACE_ADAM7       1 /* Adam7 interlacing */\n#define PNG_INTERLACE_LAST        2 /* Not a valid value */\n\n/* These are for the oFFs chunk.  These values should NOT be changed. */\n#define PNG_OFFSET_PIXEL          0 /* Offset in pixels */\n#define PNG_OFFSET_MICROMETER     1 /* Offset in micrometers (1/10^6 meter) */\n#define PNG_OFFSET_LAST           2 /* Not a valid value */\n\n/* These are for the pCAL chunk.  These values should NOT be changed. */\n#define PNG_EQUATION_LINEAR       0 /* Linear transformation */\n#define PNG_EQUATION_BASE_E       1 /* Exponential base e transform */\n#define PNG_EQUATION_ARBITRARY    2 /* Arbitrary base exponential transform */\n#define PNG_EQUATION_HYPERBOLIC   3 /* Hyperbolic sine transformation */\n#define PNG_EQUATION_LAST         4 /* Not a valid value */\n\n/* These are for the sCAL chunk.  These values should NOT be changed. */\n#define PNG_SCALE_UNKNOWN         0 /* unknown unit (image scale) */\n#define PNG_SCALE_METER           1 /* meters per pixel */\n#define PNG_SCALE_RADIAN          2 /* radians per pixel */\n#define PNG_SCALE_LAST            3 /* Not a valid value */\n\n/* These are for the pHYs chunk.  These values should NOT be changed. */\n#define PNG_RESOLUTION_UNKNOWN    0 /* pixels/unknown unit (aspect ratio) */\n#define PNG_RESOLUTION_METER      1 /* pixels/meter */\n#define PNG_RESOLUTION_LAST       2 /* Not a valid value */\n\n/* These are for the sRGB chunk.  These values should NOT be changed. */\n#define PNG_sRGB_INTENT_PERCEPTUAL 0\n#define PNG_sRGB_INTENT_RELATIVE   1\n#define PNG_sRGB_INTENT_SATURATION 2\n#define PNG_sRGB_INTENT_ABSOLUTE   3\n#define PNG_sRGB_INTENT_LAST       4 /* Not a valid value */\n\n/* This is for text chunks */\n#define PNG_KEYWORD_MAX_LENGTH     79\n\n/* Maximum number of entries in PLTE/sPLT/tRNS arrays */\n#define PNG_MAX_PALETTE_LENGTH    256\n\n/* These determine if an ancillary chunk's data has been successfully read\n * from the PNG header, or if the application has filled in the corresponding\n * data in the info_struct to be written into the output file.  The values\n * of the PNG_INFO_<chunk> defines should NOT be changed.\n */\n#define PNG_INFO_gAMA 0x0001\n#define PNG_INFO_sBIT 0x0002\n#define PNG_INFO_cHRM 0x0004\n#define PNG_INFO_PLTE 0x0008\n#define PNG_INFO_tRNS 0x0010\n#define PNG_INFO_bKGD 0x0020\n#define PNG_INFO_hIST 0x0040\n#define PNG_INFO_pHYs 0x0080\n#define PNG_INFO_oFFs 0x0100\n#define PNG_INFO_tIME 0x0200\n#define PNG_INFO_pCAL 0x0400\n#define PNG_INFO_sRGB 0x0800   /* GR-P, 0.96a */\n#define PNG_INFO_iCCP 0x1000   /* ESR, 1.0.6 */\n#define PNG_INFO_sPLT 0x2000   /* ESR, 1.0.6 */\n#define PNG_INFO_sCAL 0x4000   /* ESR, 1.0.6 */\n#define PNG_INFO_IDAT 0x8000L  /* ESR, 1.0.6 */\n\n/* This is used for the transformation routines, as some of them\n * change these values for the row.  It also should enable using\n * the routines for other purposes.\n */\ntypedef struct png_row_info_struct\n{\n   png_uint_32 width; /* width of row */\n   png_size_t rowbytes; /* number of bytes in row */\n   png_byte color_type; /* color type of row */\n   png_byte bit_depth; /* bit depth of row */\n   png_byte channels; /* number of channels (1, 2, 3, or 4) */\n   png_byte pixel_depth; /* bits per pixel (depth * channels) */\n} png_row_info;\n\ntypedef png_row_info FAR * png_row_infop;\ntypedef png_row_info FAR * FAR * png_row_infopp;\n\n/* These are the function types for the I/O functions and for the functions\n * that allow the user to override the default I/O functions with his or her\n * own.  The png_error_ptr type should match that of user-supplied warning\n * and error functions, while the png_rw_ptr type should match that of the\n * user read/write data functions.\n */\ntypedef struct png_struct_def png_struct;\ntypedef png_struct FAR * png_structp;\ntypedef PNG_CONST png_struct FAR * png_const_structp;\n\ntypedef void (PNGAPI *png_error_ptr) PNGARG((png_structp, png_const_charp));\ntypedef void (PNGAPI *png_rw_ptr) PNGARG((png_structp, png_bytep, png_size_t));\ntypedef void (PNGAPI *png_flush_ptr) PNGARG((png_structp));\ntypedef void (PNGAPI *png_read_status_ptr) PNGARG((png_structp, png_uint_32,\n   int));\ntypedef void (PNGAPI *png_write_status_ptr) PNGARG((png_structp, png_uint_32,\n   int));\n\n#ifdef PNG_PROGRESSIVE_READ_SUPPORTED\ntypedef void (PNGAPI *png_progressive_info_ptr) PNGARG((png_structp,\n   png_infop));\ntypedef void (PNGAPI *png_progressive_end_ptr) PNGARG((png_structp, png_infop));\ntypedef void (PNGAPI *png_progressive_row_ptr) PNGARG((png_structp, png_bytep,\n   png_uint_32, int));\n#endif\n\n#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \\\n    defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)\ntypedef void (PNGAPI *png_user_transform_ptr) PNGARG((png_structp,\n    png_row_infop, png_bytep));\n#endif\n\n#ifdef PNG_USER_CHUNKS_SUPPORTED\ntypedef int (PNGAPI *png_user_chunk_ptr) PNGARG((png_structp,\n   png_unknown_chunkp));\n#endif\n#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED\ntypedef void (PNGAPI *png_unknown_chunk_ptr) PNGARG((png_structp));\n#endif\n#ifdef PNG_SETJMP_SUPPORTED\n/* This must match the function definition in <setjmp.h>, and the\n * application must include this before png.h to obtain the definition\n * of jmp_buf.\n */\ntypedef void (PNGAPI *png_longjmp_ptr) PNGARG((jmp_buf, int));\n#endif\n\n/* Transform masks for the high-level interface */\n#define PNG_TRANSFORM_IDENTITY       0x0000    /* read and write */\n#define PNG_TRANSFORM_STRIP_16       0x0001    /* read only */\n#define PNG_TRANSFORM_STRIP_ALPHA    0x0002    /* read only */\n#define PNG_TRANSFORM_PACKING        0x0004    /* read and write */\n#define PNG_TRANSFORM_PACKSWAP       0x0008    /* read and write */\n#define PNG_TRANSFORM_EXPAND         0x0010    /* read only */\n#define PNG_TRANSFORM_INVERT_MONO    0x0020    /* read and write */\n#define PNG_TRANSFORM_SHIFT          0x0040    /* read and write */\n#define PNG_TRANSFORM_BGR            0x0080    /* read and write */\n#define PNG_TRANSFORM_SWAP_ALPHA     0x0100    /* read and write */\n#define PNG_TRANSFORM_SWAP_ENDIAN    0x0200    /* read and write */\n#define PNG_TRANSFORM_INVERT_ALPHA   0x0400    /* read and write */\n#define PNG_TRANSFORM_STRIP_FILLER   0x0800    /* write only */\n/* Added to libpng-1.2.34 */\n#define PNG_TRANSFORM_STRIP_FILLER_BEFORE PNG_TRANSFORM_STRIP_FILLER\n#define PNG_TRANSFORM_STRIP_FILLER_AFTER 0x1000 /* write only */\n/* Added to libpng-1.4.0 */\n#define PNG_TRANSFORM_GRAY_TO_RGB   0x2000      /* read only */\n\n/* Flags for MNG supported features */\n#define PNG_FLAG_MNG_EMPTY_PLTE     0x01\n#define PNG_FLAG_MNG_FILTER_64      0x04\n#define PNG_ALL_MNG_FEATURES        0x05\n\ntypedef png_voidp (*png_malloc_ptr) PNGARG((png_structp, png_alloc_size_t));\ntypedef void (*png_free_ptr) PNGARG((png_structp, png_voidp));\n\n/* The structure that holds the information to read and write PNG files.\n * The only people who need to care about what is inside of this are the\n * people who will be modifying the library for their own special needs.\n * It should NOT be accessed directly by an application, except to store\n * the jmp_buf.\n */\n\nstruct png_struct_def\n{\n#ifdef PNG_SETJMP_SUPPORTED\n   jmp_buf jmpbuf PNG_DEPSTRUCT;            /* used in png_error */\n   png_longjmp_ptr longjmp_fn PNG_DEPSTRUCT;/* setjmp non-local goto\n                                               function. */\n#endif\n   png_error_ptr error_fn PNG_DEPSTRUCT;    /* function for printing\n                                               errors and aborting */\n   png_error_ptr warning_fn PNG_DEPSTRUCT;  /* function for printing\n                                               warnings */\n   png_voidp error_ptr PNG_DEPSTRUCT;       /* user supplied struct for\n                                               error functions */\n   png_rw_ptr write_data_fn PNG_DEPSTRUCT;  /* function for writing\n                                               output data */\n   png_rw_ptr read_data_fn PNG_DEPSTRUCT;   /* function for reading\n                                               input data */\n   png_voidp io_ptr PNG_DEPSTRUCT;          /* ptr to application struct\n                                               for I/O functions */\n\n#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED\n   png_user_transform_ptr read_user_transform_fn PNG_DEPSTRUCT; /* user read\n                                                                 transform */\n#endif\n\n#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED\n   png_user_transform_ptr write_user_transform_fn PNG_DEPSTRUCT; /* user write\n                                                                  transform */\n#endif\n\n/* These were added in libpng-1.0.2 */\n#ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED\n#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \\\n    defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)\n   png_voidp user_transform_ptr PNG_DEPSTRUCT; /* user supplied struct\n                                                  for user transform */\n   png_byte user_transform_depth PNG_DEPSTRUCT;    /* bit depth of user\n                                                      transformed pixels */\n   png_byte user_transform_channels PNG_DEPSTRUCT; /* channels in user\n                                                      transformed pixels */\n#endif\n#endif\n\n   png_uint_32 mode PNG_DEPSTRUCT;          /* tells us where we are in\n                                               the PNG file */\n   png_uint_32 flags PNG_DEPSTRUCT;         /* flags indicating various\n                                               things to libpng */\n   png_uint_32 transformations PNG_DEPSTRUCT; /* which transformations\n                                                 to perform */\n\n   z_stream zstream PNG_DEPSTRUCT;          /* pointer to decompression\n                                               structure (below) */\n   png_bytep zbuf PNG_DEPSTRUCT;            /* buffer for zlib */\n   png_size_t zbuf_size PNG_DEPSTRUCT;      /* size of zbuf */\n   int zlib_level PNG_DEPSTRUCT;            /* holds zlib compression level */\n   int zlib_method PNG_DEPSTRUCT;           /* holds zlib compression method */\n   int zlib_window_bits PNG_DEPSTRUCT;      /* holds zlib compression window\n                                               bits */\n   int zlib_mem_level PNG_DEPSTRUCT;        /* holds zlib compression memory\n                                               level */\n   int zlib_strategy PNG_DEPSTRUCT;         /* holds zlib compression\n                                               strategy */\n\n   png_uint_32 width PNG_DEPSTRUCT;         /* width of image in pixels */\n   png_uint_32 height PNG_DEPSTRUCT;        /* height of image in pixels */\n   png_uint_32 num_rows PNG_DEPSTRUCT;      /* number of rows in current pass */\n   png_uint_32 usr_width PNG_DEPSTRUCT;     /* width of row at start of write */\n   png_size_t rowbytes PNG_DEPSTRUCT;       /* size of row in bytes */\n#if 0 /* Replaced with the following in libpng-1.4.1 */\n   png_size_t irowbytes PNG_DEPSTRUCT;\n#endif\n/* Added in libpng-1.4.1 */\n#ifdef PNG_USER_LIMITS_SUPPORTED\n   /* Total memory that a zTXt, sPLT, iTXt, iCCP, or unknown chunk\n    * can occupy when decompressed.  0 means unlimited.\n    * We will change the typedef from png_size_t to png_alloc_size_t\n    * in libpng-1.6.0\n    */\n   png_alloc_size_t user_chunk_malloc_max PNG_DEPSTRUCT;\n#endif\n   png_uint_32 iwidth PNG_DEPSTRUCT;        /* width of current interlaced\n                                               row in pixels */\n   png_uint_32 row_number PNG_DEPSTRUCT;    /* current row in interlace pass */\n   png_bytep prev_row PNG_DEPSTRUCT;        /* buffer to save previous\n                                               (unfiltered) row */\n   png_bytep row_buf PNG_DEPSTRUCT;         /* buffer to save current\n                                               (unfiltered) row */\n   png_bytep sub_row PNG_DEPSTRUCT;         /* buffer to save \"sub\" row\n                                               when filtering */\n   png_bytep up_row PNG_DEPSTRUCT;          /* buffer to save \"up\" row\n                                               when filtering */\n   png_bytep avg_row PNG_DEPSTRUCT;         /* buffer to save \"avg\" row\n                                               when filtering */\n   png_bytep paeth_row PNG_DEPSTRUCT;       /* buffer to save \"Paeth\" row\n                                               when filtering */\n   png_row_info row_info PNG_DEPSTRUCT;     /* used for transformation\n                                               routines */\n\n   png_uint_32 idat_size PNG_DEPSTRUCT;     /* current IDAT size for read */\n   png_uint_32 crc PNG_DEPSTRUCT;           /* current chunk CRC value */\n   png_colorp palette PNG_DEPSTRUCT;        /* palette from the input file */\n   png_uint_16 num_palette PNG_DEPSTRUCT;   /* number of color entries in\n                                               palette */\n   png_uint_16 num_trans PNG_DEPSTRUCT;     /* number of transparency values */\n   png_byte chunk_name[5] PNG_DEPSTRUCT;    /* null-terminated name of current\n                                               chunk */\n   png_byte compression PNG_DEPSTRUCT;      /* file compression type\n                                               (always 0) */\n   png_byte filter PNG_DEPSTRUCT;           /* file filter type (always 0) */\n   png_byte interlaced PNG_DEPSTRUCT;       /* PNG_INTERLACE_NONE,\n                                               PNG_INTERLACE_ADAM7 */\n   png_byte pass PNG_DEPSTRUCT;             /* current interlace pass (0 - 6) */\n   png_byte do_filter PNG_DEPSTRUCT;        /* row filter flags (see\n                                               PNG_FILTER_ below ) */\n   png_byte color_type PNG_DEPSTRUCT;       /* color type of file */\n   png_byte bit_depth PNG_DEPSTRUCT;        /* bit depth of file */\n   png_byte usr_bit_depth PNG_DEPSTRUCT;    /* bit depth of users row */\n   png_byte pixel_depth PNG_DEPSTRUCT;      /* number of bits per pixel */\n   png_byte channels PNG_DEPSTRUCT;         /* number of channels in file */\n   png_byte usr_channels PNG_DEPSTRUCT;     /* channels at start of write */\n   png_byte sig_bytes PNG_DEPSTRUCT;        /* magic bytes read/written from\n                                               start of file */\n\n#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)\n   png_uint_16 filler PNG_DEPSTRUCT;           /* filler bytes for pixel\n                                                  expansion */\n#endif\n\n#ifdef PNG_bKGD_SUPPORTED\n   png_byte background_gamma_type PNG_DEPSTRUCT;\n#  ifdef PNG_FLOATING_POINT_SUPPORTED\n   float background_gamma PNG_DEPSTRUCT;\n#  endif\n   png_color_16 background PNG_DEPSTRUCT;   /* background color in\n                                               screen gamma space */\n#ifdef PNG_READ_GAMMA_SUPPORTED\n   png_color_16 background_1 PNG_DEPSTRUCT; /* background normalized\n                                               to gamma 1.0 */\n#endif\n#endif /* PNG_bKGD_SUPPORTED */\n\n#ifdef PNG_WRITE_FLUSH_SUPPORTED\n   png_flush_ptr output_flush_fn PNG_DEPSTRUCT; /* Function for flushing\n                                               output */\n   png_uint_32 flush_dist PNG_DEPSTRUCT;    /* how many rows apart to flush,\n                                               0 - no flush */\n   png_uint_32 flush_rows PNG_DEPSTRUCT;    /* number of rows written since\n                                               last flush */\n#endif\n\n#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)\n   int gamma_shift PNG_DEPSTRUCT;      /* number of \"insignificant\" bits\n                                          16-bit gamma */\n#ifdef PNG_FLOATING_POINT_SUPPORTED\n   float gamma PNG_DEPSTRUCT;          /* file gamma value */\n   float screen_gamma PNG_DEPSTRUCT;   /* screen gamma value\n                                          (display_exponent) */\n#endif\n#endif\n\n#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)\n   png_bytep gamma_table PNG_DEPSTRUCT;     /* gamma table for 8-bit\n                                               depth files */\n   png_bytep gamma_from_1 PNG_DEPSTRUCT;    /* converts from 1.0 to screen */\n   png_bytep gamma_to_1 PNG_DEPSTRUCT;      /* converts from file to 1.0 */\n   png_uint_16pp gamma_16_table PNG_DEPSTRUCT; /* gamma table for 16-bit\n                                                  depth files */\n   png_uint_16pp gamma_16_from_1 PNG_DEPSTRUCT; /* converts from 1.0 to\n                                                   screen */\n   png_uint_16pp gamma_16_to_1 PNG_DEPSTRUCT; /* converts from file to 1.0 */\n#endif\n\n#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_sBIT_SUPPORTED)\n   png_color_8 sig_bit PNG_DEPSTRUCT;       /* significant bits in each\n                                               available channel */\n#endif\n\n#if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)\n   png_color_8 shift PNG_DEPSTRUCT;         /* shift for significant bit\n                                               tranformation */\n#endif\n\n#if defined(PNG_tRNS_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) \\\n || defined(PNG_READ_EXPAND_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)\n   png_bytep trans_alpha PNG_DEPSTRUCT;           /* alpha values for\n                                                     paletted files */\n   png_color_16 trans_color PNG_DEPSTRUCT;  /* transparent color for\n                                               non-paletted files */\n#endif\n\n   png_read_status_ptr read_row_fn PNG_DEPSTRUCT;   /* called after each\n                                                       row is decoded */\n   png_write_status_ptr write_row_fn PNG_DEPSTRUCT; /* called after each\n                                                       row is encoded */\n#ifdef PNG_PROGRESSIVE_READ_SUPPORTED\n   png_progressive_info_ptr info_fn PNG_DEPSTRUCT; /* called after header\n                                                      data fully read */\n   png_progressive_row_ptr row_fn PNG_DEPSTRUCT;   /* called after each\n                                                      prog. row is decoded */\n   png_progressive_end_ptr end_fn PNG_DEPSTRUCT;   /* called after image\n                                                      is complete */\n   png_bytep save_buffer_ptr PNG_DEPSTRUCT;        /* current location in\n                                                      save_buffer */\n   png_bytep save_buffer PNG_DEPSTRUCT;            /* buffer for previously\n                                                      read data */\n   png_bytep current_buffer_ptr PNG_DEPSTRUCT;     /* current location in\n                                                      current_buffer */\n   png_bytep current_buffer PNG_DEPSTRUCT;         /* buffer for recently\n                                                      used data */\n   png_uint_32 push_length PNG_DEPSTRUCT;          /* size of current input\n                                                      chunk */\n   png_uint_32 skip_length PNG_DEPSTRUCT;          /* bytes to skip in\n                                                      input data */\n   png_size_t save_buffer_size PNG_DEPSTRUCT;      /* amount of data now\n                                                      in save_buffer */\n   png_size_t save_buffer_max PNG_DEPSTRUCT;       /* total size of\n                                                      save_buffer */\n   png_size_t buffer_size PNG_DEPSTRUCT;           /* total amount of\n                                                      available input data */\n   png_size_t current_buffer_size PNG_DEPSTRUCT;   /* amount of data now\n                                                      in current_buffer */\n   int process_mode PNG_DEPSTRUCT;                 /* what push library\n                                                      is currently doing */\n   int cur_palette PNG_DEPSTRUCT;                  /* current push library\n                                                      palette index */\n\n#  ifdef PNG_TEXT_SUPPORTED\n     png_size_t current_text_size PNG_DEPSTRUCT;   /* current size of\n                                                      text input data */\n     png_size_t current_text_left PNG_DEPSTRUCT;   /* how much text left\n                                                      to read in input */\n     png_charp current_text PNG_DEPSTRUCT;         /* current text chunk\n                                                      buffer */\n     png_charp current_text_ptr PNG_DEPSTRUCT;     /* current location\n                                                      in current_text */\n#  endif /* PNG_PROGRESSIVE_READ_SUPPORTED && PNG_TEXT_SUPPORTED */\n\n#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */\n\n#if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__)\n/* For the Borland special 64K segment handler */\n   png_bytepp offset_table_ptr PNG_DEPSTRUCT;\n   png_bytep offset_table PNG_DEPSTRUCT;\n   png_uint_16 offset_table_number PNG_DEPSTRUCT;\n   png_uint_16 offset_table_count PNG_DEPSTRUCT;\n   png_uint_16 offset_table_count_free PNG_DEPSTRUCT;\n#endif\n\n#ifdef PNG_READ_QUANTIZE_SUPPORTED\n   png_bytep palette_lookup PNG_DEPSTRUCT; /* lookup table for quantizing */\n   png_bytep quantize_index PNG_DEPSTRUCT; /* index translation for palette\n                                              files */\n#endif\n\n#if defined(PNG_READ_QUANTIZE_SUPPORTED) || defined(PNG_hIST_SUPPORTED)\n   png_uint_16p hist PNG_DEPSTRUCT;                /* histogram */\n#endif\n\n#ifdef PNG_TIME_RFC1123_SUPPORTED\n   png_charp time_buffer PNG_DEPSTRUCT; /* String to hold RFC 1123 time text */\n#endif\n\n/* New members added in libpng-1.0.6 */\n\n   png_uint_32 free_me PNG_DEPSTRUCT;    /* flags items libpng is\n                                            responsible for freeing */\n\n#ifdef PNG_USER_CHUNKS_SUPPORTED\n   png_voidp user_chunk_ptr PNG_DEPSTRUCT;\n   png_user_chunk_ptr read_user_chunk_fn PNG_DEPSTRUCT; /* user read\n                                                           chunk handler */\n#endif\n\n#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED\n   int num_chunk_list PNG_DEPSTRUCT;\n   png_bytep chunk_list PNG_DEPSTRUCT;\n#endif\n\n/* New members added in libpng-1.0.3 */\n#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED\n   png_byte rgb_to_gray_status PNG_DEPSTRUCT;\n   /* These were changed from png_byte in libpng-1.0.6 */\n   png_uint_16 rgb_to_gray_red_coeff PNG_DEPSTRUCT;\n   png_uint_16 rgb_to_gray_green_coeff PNG_DEPSTRUCT;\n   png_uint_16 rgb_to_gray_blue_coeff PNG_DEPSTRUCT;\n#endif\n\n/* New member added in libpng-1.0.4 (renamed in 1.0.9) */\n#if defined(PNG_MNG_FEATURES_SUPPORTED) || \\\n    defined(PNG_READ_EMPTY_PLTE_SUPPORTED) || \\\n    defined(PNG_WRITE_EMPTY_PLTE_SUPPORTED)\n/* Changed from png_byte to png_uint_32 at version 1.2.0 */\n   png_uint_32 mng_features_permitted PNG_DEPSTRUCT;\n#endif\n\n/* New member added in libpng-1.0.7 */\n#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)\n   png_fixed_point int_gamma PNG_DEPSTRUCT;\n#endif\n\n/* New member added in libpng-1.0.9, ifdef'ed out in 1.0.12, enabled in 1.2.0 */\n#ifdef PNG_MNG_FEATURES_SUPPORTED\n   png_byte filter_type PNG_DEPSTRUCT;\n#endif\n\n/* New members added in libpng-1.2.0 */\n\n/* New members added in libpng-1.0.2 but first enabled by default in 1.2.0 */\n#ifdef PNG_USER_MEM_SUPPORTED\n   png_voidp mem_ptr PNG_DEPSTRUCT;             /* user supplied struct for\n                                                   mem functions */\n   png_malloc_ptr malloc_fn PNG_DEPSTRUCT;      /* function for\n                                                   allocating memory */\n   png_free_ptr free_fn PNG_DEPSTRUCT;          /* function for\n                                                   freeing memory */\n#endif\n\n/* New member added in libpng-1.0.13 and 1.2.0 */\n   png_bytep big_row_buf PNG_DEPSTRUCT;         /* buffer to save current\n                                                   (unfiltered) row */\n\n#ifdef PNG_READ_QUANTIZE_SUPPORTED\n/* The following three members were added at version 1.0.14 and 1.2.4 */\n   png_bytep quantize_sort PNG_DEPSTRUCT;          /* working sort array */\n   png_bytep index_to_palette PNG_DEPSTRUCT;       /* where the original\n                                                     index currently is\n                                                     in the palette */\n   png_bytep palette_to_index PNG_DEPSTRUCT;       /* which original index\n                                                      points to this\n                                                      palette color */\n#endif\n\n/* New members added in libpng-1.0.16 and 1.2.6 */\n   png_byte compression_type PNG_DEPSTRUCT;\n\n#ifdef PNG_USER_LIMITS_SUPPORTED\n   png_uint_32 user_width_max PNG_DEPSTRUCT;\n   png_uint_32 user_height_max PNG_DEPSTRUCT;\n   /* Added in libpng-1.4.0: Total number of sPLT, text, and unknown\n    * chunks that can be stored (0 means unlimited).\n    */\n   png_uint_32 user_chunk_cache_max PNG_DEPSTRUCT;\n#endif\n\n/* New member added in libpng-1.0.25 and 1.2.17 */\n#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED\n   /* Storage for unknown chunk that the library doesn't recognize. */\n   png_unknown_chunk unknown_chunk PNG_DEPSTRUCT;\n#endif\n\n/* New members added in libpng-1.2.26 */\n  png_uint_32 old_big_row_buf_size PNG_DEPSTRUCT;\n  png_uint_32 old_prev_row_size PNG_DEPSTRUCT;\n\n/* New member added in libpng-1.2.30 */\n  png_charp chunkdata PNG_DEPSTRUCT;  /* buffer for reading chunk data */\n\n#ifdef PNG_IO_STATE_SUPPORTED\n/* New member added in libpng-1.4.0 */\n   png_uint_32 io_state PNG_DEPSTRUCT;\n#endif\n};\n\n\n/* This triggers a compiler error in png.c, if png.c and png.h\n * do not agree upon the version number.\n */\ntypedef png_structp version_1_4_19;\n\ntypedef png_struct FAR * FAR * png_structpp;\n\n/* Here are the function definitions most commonly used.  This is not\n * the place to find out how to use libpng.  See libpng.txt for the\n * full explanation, see example.c for the summary.  This just provides\n * a simple one line description of the use of each function.\n */\n\n/* Returns the version number of the library */\nPNG_EXPORT(png_uint_32,png_access_version_number) PNGARG((void));\n\n/* Tell lib we have already handled the first <num_bytes> magic bytes.\n * Handling more than 8 bytes from the beginning of the file is an error.\n */\nPNG_EXPORT(void,png_set_sig_bytes) PNGARG((png_structp png_ptr,\n   int num_bytes));\n\n/* Check sig[start] through sig[start + num_to_check - 1] to see if it's a\n * PNG file.  Returns zero if the supplied bytes match the 8-byte PNG\n * signature, and non-zero otherwise.  Having num_to_check == 0 or\n * start > 7 will always fail (ie return non-zero).\n */\nPNG_EXPORT(int,png_sig_cmp) PNGARG((png_bytep sig, png_size_t start,\n   png_size_t num_to_check));\n\n/* Simple signature checking function.  This is the same as calling\n * png_check_sig(sig, n) := !png_sig_cmp(sig, 0, n).\n */\n#define png_check_sig(sig,n) !png_sig_cmp((sig), 0, (n))\n\n/* Allocate and initialize png_ptr struct for reading, and any other memory. */\nPNG_EXPORT(png_structp,png_create_read_struct)\n   PNGARG((png_const_charp user_png_ver, png_voidp error_ptr,\n   png_error_ptr error_fn, png_error_ptr warn_fn)) PNG_ALLOCATED;\n\n/* Allocate and initialize png_ptr struct for writing, and any other memory */\nPNG_EXPORT(png_structp,png_create_write_struct)\n   PNGARG((png_const_charp user_png_ver, png_voidp error_ptr,\n   png_error_ptr error_fn, png_error_ptr warn_fn)) PNG_ALLOCATED;\n\nPNG_EXPORT(png_size_t,png_get_compression_buffer_size)\n   PNGARG((png_const_structp png_ptr));\n\nPNG_EXPORT(void,png_set_compression_buffer_size)\n   PNGARG((png_structp png_ptr, png_size_t size));\n\n/* Moved from pngconf.h in 1.4.0 and modified to ensure setjmp/longjmp\n * match up.\n */\n#ifdef PNG_SETJMP_SUPPORTED\n/* This function returns the jmp_buf built in to *png_ptr.  It must be\n * supplied with an appropriate 'longjmp' function to use on that jmp_buf\n * unless the default error function is overridden in which case NULL is\n * acceptable.  The size of the jmp_buf is checked against the actual size\n * allocated by the library - the call will return NULL on a mismatch\n * indicating an ABI mismatch.\n */\nPNG_EXPORT(jmp_buf*, png_set_longjmp_fn)\n   PNGARG((png_structp png_ptr, png_longjmp_ptr longjmp_fn, size_t\n       jmp_buf_size));\n#  define png_jmpbuf(png_ptr) \\\n   (*png_set_longjmp_fn((png_ptr), longjmp, sizeof (jmp_buf)))\n#else\n#  define png_jmpbuf(png_ptr) \\\n   (LIBPNG_WAS_COMPILED_WITH__PNG_NO_SETJMP)\n#endif\n\n#ifdef PNG_READ_SUPPORTED\n/* Reset the compression stream */\nPNG_EXPORT(int,png_reset_zstream) PNGARG((png_structp png_ptr));\n#endif\n\n/* New functions added in libpng-1.0.2 (not enabled by default until 1.2.0) */\n#ifdef PNG_USER_MEM_SUPPORTED\nPNG_EXPORT(png_structp,png_create_read_struct_2)\n   PNGARG((png_const_charp user_png_ver, png_voidp error_ptr,\n   png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr,\n   png_malloc_ptr malloc_fn, png_free_ptr free_fn)) PNG_ALLOCATED;\nPNG_EXPORT(png_structp,png_create_write_struct_2)\n   PNGARG((png_const_charp user_png_ver, png_voidp error_ptr,\n   png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr,\n   png_malloc_ptr malloc_fn, png_free_ptr free_fn)) PNG_ALLOCATED;\n#endif\n\n/* Write the PNG file signature. */\nPNG_EXPORT(void,png_write_sig) PNGARG((png_structp png_ptr));\n\n/* Write a PNG chunk - size, type, (optional) data, CRC. */\nPNG_EXPORT(void,png_write_chunk) PNGARG((png_structp png_ptr,\n   png_bytep chunk_name, png_bytep data, png_size_t length));\n\n/* Write the start of a PNG chunk - length and chunk name. */\nPNG_EXPORT(void,png_write_chunk_start) PNGARG((png_structp png_ptr,\n   png_bytep chunk_name, png_uint_32 length));\n\n/* Write the data of a PNG chunk started with png_write_chunk_start(). */\nPNG_EXPORT(void,png_write_chunk_data) PNGARG((png_structp png_ptr,\n   png_bytep data, png_size_t length));\n\n/* Finish a chunk started with png_write_chunk_start() (includes CRC). */\nPNG_EXPORT(void,png_write_chunk_end) PNGARG((png_structp png_ptr));\n\n/* Allocate and initialize the info structure */\nPNG_EXPORT(png_infop,png_create_info_struct)\n   PNGARG((png_structp png_ptr)) PNG_ALLOCATED;\n\nPNG_EXPORT(void,png_info_init_3) PNGARG((png_infopp info_ptr,\n    png_size_t png_info_struct_size));\n\n/* Writes all the PNG information before the image. */\nPNG_EXPORT(void,png_write_info_before_PLTE) PNGARG((png_structp png_ptr,\n   png_infop info_ptr));\nPNG_EXPORT(void,png_write_info) PNGARG((png_structp png_ptr,\n   png_infop info_ptr));\n\n#ifdef PNG_SEQUENTIAL_READ_SUPPORTED\n/* Read the information before the actual image data. */\nPNG_EXPORT(void,png_read_info) PNGARG((png_structp png_ptr,\n   png_infop info_ptr));\n#endif\n\n#ifdef PNG_TIME_RFC1123_SUPPORTED\nPNG_EXPORT(png_charp,png_convert_to_rfc1123)\n   PNGARG((png_structp png_ptr, png_timep ptime));\n#endif\n\n#ifdef PNG_CONVERT_tIME_SUPPORTED\n/* Convert from a struct tm to png_time */\nPNG_EXPORT(void,png_convert_from_struct_tm) PNGARG((png_timep ptime,\n   struct tm FAR * ttime));\n\n/* Convert from time_t to png_time.  Uses gmtime() */\nPNG_EXPORT(void,png_convert_from_time_t) PNGARG((png_timep ptime,\n   time_t ttime));\n#endif /* PNG_CONVERT_tIME_SUPPORTED */\n\n#ifdef PNG_READ_EXPAND_SUPPORTED\n/* Expand data to 24-bit RGB, or 8-bit grayscale, with alpha if available. */\nPNG_EXPORT(void,png_set_expand) PNGARG((png_structp png_ptr));\nPNG_EXPORT(void,png_set_expand_gray_1_2_4_to_8) PNGARG((png_structp\n  png_ptr));\nPNG_EXPORT(void,png_set_palette_to_rgb) PNGARG((png_structp png_ptr));\nPNG_EXPORT(void,png_set_tRNS_to_alpha) PNGARG((png_structp png_ptr));\n#endif\n\n#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)\n/* Use blue, green, red order for pixels. */\nPNG_EXPORT(void,png_set_bgr) PNGARG((png_structp png_ptr));\n#endif\n\n#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED\n/* Expand the grayscale to 24-bit RGB if necessary. */\nPNG_EXPORT(void,png_set_gray_to_rgb) PNGARG((png_structp png_ptr));\n#endif\n\n#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED\n/* Reduce RGB to grayscale. */\n#ifdef PNG_FLOATING_POINT_SUPPORTED\nPNG_EXPORT(void,png_set_rgb_to_gray) PNGARG((png_structp png_ptr,\n   int error_action, double red, double green ));\n#endif\nPNG_EXPORT(void,png_set_rgb_to_gray_fixed) PNGARG((png_structp png_ptr,\n   int error_action, png_fixed_point red, png_fixed_point green ));\nPNG_EXPORT(png_byte,png_get_rgb_to_gray_status) PNGARG((png_const_structp\n   png_ptr));\n#endif\n\nPNG_EXPORT(void,png_build_grayscale_palette) PNGARG((int bit_depth,\n   png_colorp palette));\n\n#ifdef PNG_READ_STRIP_ALPHA_SUPPORTED\nPNG_EXPORT(void,png_set_strip_alpha) PNGARG((png_structp png_ptr));\n#endif\n\n#if defined(PNG_READ_SWAP_ALPHA_SUPPORTED) || \\\n    defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED)\nPNG_EXPORT(void,png_set_swap_alpha) PNGARG((png_structp png_ptr));\n#endif\n\n#if defined(PNG_READ_INVERT_ALPHA_SUPPORTED) || \\\n    defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED)\nPNG_EXPORT(void,png_set_invert_alpha) PNGARG((png_structp png_ptr));\n#endif\n\n#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)\n/* Add a filler byte to 8-bit Gray or 24-bit RGB images. */\nPNG_EXPORT(void,png_set_filler) PNGARG((png_structp png_ptr,\n   png_uint_32 filler, int flags));\n/* The values of the PNG_FILLER_ defines should NOT be changed */\n#define PNG_FILLER_BEFORE 0\n#define PNG_FILLER_AFTER 1\n/* Add an alpha byte to 8-bit Gray or 24-bit RGB images. */\nPNG_EXPORT(void,png_set_add_alpha) PNGARG((png_structp png_ptr,\n   png_uint_32 filler, int flags));\n#endif /* PNG_READ_FILLER_SUPPORTED || PNG_WRITE_FILLER_SUPPORTED */\n\n#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)\n/* Swap bytes in 16-bit depth files. */\nPNG_EXPORT(void,png_set_swap) PNGARG((png_structp png_ptr));\n#endif\n\n#if defined(PNG_READ_PACK_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)\n/* Use 1 byte per pixel in 1, 2, or 4-bit depth files. */\nPNG_EXPORT(void,png_set_packing) PNGARG((png_structp png_ptr));\n#endif\n\n#if defined(PNG_READ_PACKSWAP_SUPPORTED) || \\\n    defined(PNG_WRITE_PACKSWAP_SUPPORTED)\n/* Swap packing order of pixels in bytes. */\nPNG_EXPORT(void,png_set_packswap) PNGARG((png_structp png_ptr));\n#endif\n\n#if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)\n/* Converts files to legal bit depths. */\nPNG_EXPORT(void,png_set_shift) PNGARG((png_structp png_ptr,\n   png_color_8p true_bits));\n#endif\n\n#if defined(PNG_READ_INTERLACING_SUPPORTED) || \\\n    defined(PNG_WRITE_INTERLACING_SUPPORTED)\n/* Have the code handle the interlacing.  Returns the number of passes. */\nPNG_EXPORT(int,png_set_interlace_handling) PNGARG((png_structp png_ptr));\n#endif\n\n#if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED)\n/* Invert monochrome files */\nPNG_EXPORT(void,png_set_invert_mono) PNGARG((png_structp png_ptr));\n#endif\n\n#ifdef PNG_READ_BACKGROUND_SUPPORTED\n/* Handle alpha and tRNS by replacing with a background color. */\n#ifdef PNG_FLOATING_POINT_SUPPORTED\nPNG_EXPORT(void,png_set_background) PNGARG((png_structp png_ptr,\n   png_color_16p background_color, int background_gamma_code,\n   int need_expand, double background_gamma));\n#endif\n#define PNG_BACKGROUND_GAMMA_UNKNOWN 0\n#define PNG_BACKGROUND_GAMMA_SCREEN  1\n#define PNG_BACKGROUND_GAMMA_FILE    2\n#define PNG_BACKGROUND_GAMMA_UNIQUE  3\n#endif\n\n#ifdef PNG_READ_16_TO_8_SUPPORTED\n/* Strip the second byte of information from a 16-bit depth file. */\nPNG_EXPORT(void,png_set_strip_16) PNGARG((png_structp png_ptr));\n#endif\n\n#ifdef PNG_READ_QUANTIZE_SUPPORTED\n/* Turn on quantizing, and reduce the palette to the number of colors\n * available.  Prior to libpng-1.4.2, this was png_set_dither().\n */\nPNG_EXPORT(void,png_set_quantize) PNGARG((png_structp png_ptr,\n   png_colorp palette, int num_palette, int maximum_colors,\n   png_uint_16p histogram, int full_quantize));\n#endif\n/* This migration aid will be removed from libpng-1.5.0 */\n#define png_set_dither png_set_quantize\n\n#ifdef PNG_READ_GAMMA_SUPPORTED\n/* Handle gamma correction. Screen_gamma=(display_exponent) */\n#ifdef PNG_FLOATING_POINT_SUPPORTED\nPNG_EXPORT(void,png_set_gamma) PNGARG((png_structp png_ptr,\n   double screen_gamma, double default_file_gamma));\n#endif\n#endif\n\n\n#ifdef PNG_WRITE_FLUSH_SUPPORTED\n/* Set how many lines between output flushes - 0 for no flushing */\nPNG_EXPORT(void,png_set_flush) PNGARG((png_structp png_ptr, int nrows));\n/* Flush the current PNG output buffer */\nPNG_EXPORT(void,png_write_flush) PNGARG((png_structp png_ptr));\n#endif\n\n/* Optional update palette with requested transformations */\nPNG_EXPORT(void,png_start_read_image) PNGARG((png_structp png_ptr));\n\n/* Optional call to update the users info structure */\nPNG_EXPORT(void,png_read_update_info) PNGARG((png_structp png_ptr,\n   png_infop info_ptr));\n\n#ifdef PNG_SEQUENTIAL_READ_SUPPORTED\n/* Read one or more rows of image data. */\nPNG_EXPORT(void,png_read_rows) PNGARG((png_structp png_ptr,\n   png_bytepp row, png_bytepp display_row, png_uint_32 num_rows));\n#endif\n\n#ifdef PNG_SEQUENTIAL_READ_SUPPORTED\n/* Read a row of data. */\nPNG_EXPORT(void,png_read_row) PNGARG((png_structp png_ptr,\n   png_bytep row,\n   png_bytep display_row));\n#endif\n\n#ifdef PNG_SEQUENTIAL_READ_SUPPORTED\n/* Read the whole image into memory at once. */\nPNG_EXPORT(void,png_read_image) PNGARG((png_structp png_ptr,\n   png_bytepp image));\n#endif\n\n/* Write a row of image data */\nPNG_EXPORT(void,png_write_row) PNGARG((png_structp png_ptr,\n   png_bytep row));\n\n/* Write a few rows of image data */\nPNG_EXPORT(void,png_write_rows) PNGARG((png_structp png_ptr,\n   png_bytepp row, png_uint_32 num_rows));\n\n/* Write the image data */\nPNG_EXPORT(void,png_write_image) PNGARG((png_structp png_ptr,\n   png_bytepp image));\n\n/* Write the end of the PNG file. */\nPNG_EXPORT(void,png_write_end) PNGARG((png_structp png_ptr,\n   png_infop info_ptr));\n\n#ifdef PNG_SEQUENTIAL_READ_SUPPORTED\n/* Read the end of the PNG file. */\nPNG_EXPORT(void,png_read_end) PNGARG((png_structp png_ptr,\n   png_infop info_ptr));\n#endif\n\n/* Free any memory associated with the png_info_struct */\nPNG_EXPORT(void,png_destroy_info_struct) PNGARG((png_structp png_ptr,\n   png_infopp info_ptr_ptr));\n\n/* Free any memory associated with the png_struct and the png_info_structs */\nPNG_EXPORT(void,png_destroy_read_struct) PNGARG((png_structpp\n   png_ptr_ptr, png_infopp info_ptr_ptr, png_infopp end_info_ptr_ptr));\n\n/* Free any memory associated with the png_struct and the png_info_structs */\nPNG_EXPORT(void,png_destroy_write_struct)\n   PNGARG((png_structpp png_ptr_ptr, png_infopp info_ptr_ptr));\n\n/* Set the libpng method of handling chunk CRC errors */\nPNG_EXPORT(void,png_set_crc_action) PNGARG((png_structp png_ptr,\n   int crit_action, int ancil_action));\n\n/* Values for png_set_crc_action() to say how to handle CRC errors in\n * ancillary and critical chunks, and whether to use the data contained\n * therein.  Note that it is impossible to \"discard\" data in a critical\n * chunk.  For versions prior to 0.90, the action was always error/quit,\n * whereas in version 0.90 and later, the action for CRC errors in ancillary\n * chunks is warn/discard.  These values should NOT be changed.\n *\n *      value                       action:critical     action:ancillary\n */\n#define PNG_CRC_DEFAULT       0  /* error/quit          warn/discard data */\n#define PNG_CRC_ERROR_QUIT    1  /* error/quit          error/quit        */\n#define PNG_CRC_WARN_DISCARD  2  /* (INVALID)           warn/discard data */\n#define PNG_CRC_WARN_USE      3  /* warn/use data       warn/use data     */\n#define PNG_CRC_QUIET_USE     4  /* quiet/use data      quiet/use data    */\n#define PNG_CRC_NO_CHANGE     5  /* use current value   use current value */\n\n/* These functions give the user control over the scan-line filtering in\n * libpng and the compression methods used by zlib.  These functions are\n * mainly useful for testing, as the defaults should work with most users.\n * Those users who are tight on memory or want faster performance at the\n * expense of compression can modify them.  See the compression library\n * header file (zlib.h) for an explination of the compression functions.\n */\n\n/* Set the filtering method(s) used by libpng.  Currently, the only valid\n * value for \"method\" is 0.\n */\nPNG_EXPORT(void,png_set_filter) PNGARG((png_structp png_ptr, int method,\n   int filters));\n\n/* Flags for png_set_filter() to say which filters to use.  The flags\n * are chosen so that they don't conflict with real filter types\n * below, in case they are supplied instead of the #defined constants.\n * These values should NOT be changed.\n */\n#define PNG_NO_FILTERS     0x00\n#define PNG_FILTER_NONE    0x08\n#define PNG_FILTER_SUB     0x10\n#define PNG_FILTER_UP      0x20\n#define PNG_FILTER_AVG     0x40\n#define PNG_FILTER_PAETH   0x80\n#define PNG_ALL_FILTERS (PNG_FILTER_NONE | PNG_FILTER_SUB | PNG_FILTER_UP | \\\n                         PNG_FILTER_AVG | PNG_FILTER_PAETH)\n\n/* Filter values (not flags) - used in pngwrite.c, pngwutil.c for now.\n * These defines should NOT be changed.\n */\n#define PNG_FILTER_VALUE_NONE  0\n#define PNG_FILTER_VALUE_SUB   1\n#define PNG_FILTER_VALUE_UP    2\n#define PNG_FILTER_VALUE_AVG   3\n#define PNG_FILTER_VALUE_PAETH 4\n#define PNG_FILTER_VALUE_LAST  5\n\n#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED /* DEPRECATED */\n#ifdef PNG_FLOATING_POINT_SUPPORTED\nPNG_EXPORT(void,png_set_filter_heuristics) PNGARG((png_structp png_ptr,\n   int heuristic_method, int num_weights, png_doublep filter_weights,\n   png_doublep filter_costs));\n#endif\n#endif /*  PNG_WRITE_WEIGHTED_FILTER_SUPPORTED */\n\n/* The following are no longer used and will be removed from libpng-1.7: */\n#define PNG_FILTER_HEURISTIC_DEFAULT    0  /* Currently \"UNWEIGHTED\" */\n#define PNG_FILTER_HEURISTIC_UNWEIGHTED 1  /* Used by libpng < 0.95 */\n#define PNG_FILTER_HEURISTIC_WEIGHTED   2  /* Experimental feature */\n#define PNG_FILTER_HEURISTIC_LAST       3  /* Not a valid value */\n\n/* Set the library compression level.  Currently, valid values range from\n * 0 - 9, corresponding directly to the zlib compression levels 0 - 9\n * (0 - no compression, 9 - \"maximal\" compression).  Note that tests have\n * shown that zlib compression levels 3-6 usually perform as well as level 9\n * for PNG images, and do considerably fewer caclulations.  In the future,\n * these values may not correspond directly to the zlib compression levels.\n */\nPNG_EXPORT(void,png_set_compression_level) PNGARG((png_structp png_ptr,\n   int level));\n\nPNG_EXPORT(void,png_set_compression_mem_level)\n   PNGARG((png_structp png_ptr, int mem_level));\n\nPNG_EXPORT(void,png_set_compression_strategy)\n   PNGARG((png_structp png_ptr, int strategy));\n\nPNG_EXPORT(void,png_set_compression_window_bits)\n   PNGARG((png_structp png_ptr, int window_bits));\n\nPNG_EXPORT(void,png_set_compression_method) PNGARG((png_structp png_ptr,\n   int method));\n\n/* These next functions are called for input/output, memory, and error\n * handling.  They are in the file pngrio.c, pngwio.c, and pngerror.c,\n * and call standard C I/O routines such as fread(), fwrite(), and\n * fprintf().  These functions can be made to use other I/O routines\n * at run time for those applications that need to handle I/O in a\n * different manner by calling png_set_???_fn().  See libpng.txt for\n * more information.\n */\n\n#ifdef PNG_STDIO_SUPPORTED\n/* Initialize the input/output for the PNG file to the default functions. */\nPNG_EXPORT(void,png_init_io) PNGARG((png_structp png_ptr,\n    png_FILE_p fp));\n#endif\n\n/* Replace the (error and abort), and warning functions with user\n * supplied functions.  If no messages are to be printed you must still\n * write and use replacement functions. The replacement error_fn should\n * still do a longjmp to the last setjmp location if you are using this\n * method of error handling.  If error_fn or warning_fn is NULL, the\n * default function will be used.\n */\n\nPNG_EXPORT(void,png_set_error_fn) PNGARG((png_structp png_ptr,\n   png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warning_fn));\n\n/* Return the user pointer associated with the error functions */\nPNG_EXPORT(png_voidp,png_get_error_ptr) PNGARG((png_const_structp png_ptr));\n\n/* Replace the default data output functions with a user supplied one(s).\n * If buffered output is not used, then output_flush_fn can be set to NULL.\n * If PNG_WRITE_FLUSH_SUPPORTED is not defined at libpng compile time\n * output_flush_fn will be ignored (and thus can be NULL).\n * It is probably a mistake to use NULL for output_flush_fn if\n * write_data_fn is not also NULL unless you have built libpng with\n * PNG_WRITE_FLUSH_SUPPORTED undefined, because in this case libpng's\n * default flush function, which uses the standard *FILE structure, will\n * be used.\n */\nPNG_EXPORT(void,png_set_write_fn) PNGARG((png_structp png_ptr,\n   png_voidp io_ptr, png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn));\n\n/* Replace the default data input function with a user supplied one. */\nPNG_EXPORT(void,png_set_read_fn) PNGARG((png_structp png_ptr,\n   png_voidp io_ptr, png_rw_ptr read_data_fn));\n\n/* Return the user pointer associated with the I/O functions */\nPNG_EXPORT(png_voidp,png_get_io_ptr) PNGARG((png_structp png_ptr));\n\nPNG_EXPORT(void,png_set_read_status_fn) PNGARG((png_structp png_ptr,\n   png_read_status_ptr read_row_fn));\n\nPNG_EXPORT(void,png_set_write_status_fn) PNGARG((png_structp png_ptr,\n   png_write_status_ptr write_row_fn));\n\n#ifdef PNG_USER_MEM_SUPPORTED\n/* Replace the default memory allocation functions with user supplied one(s). */\nPNG_EXPORT(void,png_set_mem_fn) PNGARG((png_structp png_ptr,\n   png_voidp mem_ptr, png_malloc_ptr malloc_fn, png_free_ptr free_fn));\n/* Return the user pointer associated with the memory functions */\nPNG_EXPORT(png_voidp,png_get_mem_ptr) PNGARG((png_const_structp png_ptr));\n#endif\n\n#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED\nPNG_EXPORT(void,png_set_read_user_transform_fn) PNGARG((png_structp\n   png_ptr, png_user_transform_ptr read_user_transform_fn));\n#endif\n\n#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED\nPNG_EXPORT(void,png_set_write_user_transform_fn) PNGARG((png_structp\n   png_ptr, png_user_transform_ptr write_user_transform_fn));\n#endif\n\n#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \\\n    defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)\nPNG_EXPORT(void,png_set_user_transform_info) PNGARG((png_structp\n   png_ptr, png_voidp user_transform_ptr, int user_transform_depth,\n   int user_transform_channels));\n/* Return the user pointer associated with the user transform functions */\nPNG_EXPORT(png_voidp,png_get_user_transform_ptr)\n   PNGARG((png_const_structp png_ptr));\n#endif\n\n#ifdef PNG_USER_CHUNKS_SUPPORTED\nPNG_EXPORT(void,png_set_read_user_chunk_fn) PNGARG((png_structp png_ptr,\n   png_voidp user_chunk_ptr, png_user_chunk_ptr read_user_chunk_fn));\nPNG_EXPORT(png_voidp,png_get_user_chunk_ptr) PNGARG((png_const_structp\n   png_ptr));\n#endif\n\n#ifdef PNG_PROGRESSIVE_READ_SUPPORTED\n/* Sets the function callbacks for the push reader, and a pointer to a\n * user-defined structure available to the callback functions.\n */\nPNG_EXPORT(void,png_set_progressive_read_fn) PNGARG((png_structp png_ptr,\n   png_voidp progressive_ptr,\n   png_progressive_info_ptr info_fn, png_progressive_row_ptr row_fn,\n   png_progressive_end_ptr end_fn));\n\n/* Returns the user pointer associated with the push read functions */\nPNG_EXPORT(png_voidp,png_get_progressive_ptr)\n   PNGARG((png_const_structp png_ptr));\n\n/* Function to be called when data becomes available */\nPNG_EXPORT(void,png_process_data) PNGARG((png_structp png_ptr,\n   png_infop info_ptr, png_bytep buffer, png_size_t buffer_size));\n\n/* Function that combines rows.  Not very much different than the\n * png_combine_row() call.  Is this even used?????\n */\nPNG_EXPORT(void,png_progressive_combine_row) PNGARG((png_structp png_ptr,\n   png_bytep old_row, png_bytep new_row));\n#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */\n\nPNG_EXPORT(png_voidp,png_malloc) PNGARG((png_structp png_ptr,\n   png_alloc_size_t size)) PNG_ALLOCATED;\n/* Added at libpng version 1.4.0 */\nPNG_EXPORT(png_voidp,png_calloc) PNGARG((png_structp png_ptr,\n   png_alloc_size_t size)) PNG_ALLOCATED;\n\n/* Added at libpng version 1.2.4 */\nPNG_EXPORT(png_voidp,png_malloc_warn) PNGARG((png_structp png_ptr,\n   png_alloc_size_t size)) PNG_ALLOCATED;\n\n/* Frees a pointer allocated by png_malloc() */\nPNG_EXPORT(void,png_free) PNGARG((png_structp png_ptr, png_voidp ptr));\n\n/* Free data that was allocated internally */\nPNG_EXPORT(void,png_free_data) PNGARG((png_structp png_ptr,\n   png_infop info_ptr, png_uint_32 free_me, int num));\n/* Reassign responsibility for freeing existing data, whether allocated\n * by libpng or by the application */\nPNG_EXPORT(void,png_data_freer) PNGARG((png_structp png_ptr,\n   png_infop info_ptr, int freer, png_uint_32 mask));\n/* Assignments for png_data_freer */\n#define PNG_DESTROY_WILL_FREE_DATA 1\n#define PNG_SET_WILL_FREE_DATA 1\n#define PNG_USER_WILL_FREE_DATA 2\n/* Flags for png_ptr->free_me and info_ptr->free_me */\n#define PNG_FREE_HIST 0x0008\n#define PNG_FREE_ICCP 0x0010\n#define PNG_FREE_SPLT 0x0020\n#define PNG_FREE_ROWS 0x0040\n#define PNG_FREE_PCAL 0x0080\n#define PNG_FREE_SCAL 0x0100\n#define PNG_FREE_UNKN 0x0200\n#define PNG_FREE_LIST 0x0400\n#define PNG_FREE_PLTE 0x1000\n#define PNG_FREE_TRNS 0x2000\n#define PNG_FREE_TEXT 0x4000\n#define PNG_FREE_ALL  0x7fff\n#define PNG_FREE_MUL  0x4220 /* PNG_FREE_SPLT|PNG_FREE_TEXT|PNG_FREE_UNKN */\n\n#ifdef PNG_USER_MEM_SUPPORTED\nPNG_EXPORT(png_voidp,png_malloc_default) PNGARG((png_structp png_ptr,\n   png_alloc_size_t size)) PNG_ALLOCATED;\nPNG_EXPORT(void,png_free_default) PNGARG((png_structp png_ptr,\n   png_voidp ptr));\n#endif\n\n#ifndef PNG_NO_ERROR_TEXT\n/* Fatal error in PNG image of libpng - can't continue */\nPNG_EXPORT(void,png_error) PNGARG((png_structp png_ptr,\n   png_const_charp error_message)) PNG_NORETURN;\n\n/* The same, but the chunk name is prepended to the error string. */\nPNG_EXPORT(void,png_chunk_error) PNGARG((png_structp png_ptr,\n   png_const_charp error_message)) PNG_NORETURN;\n\n#else\n/* Fatal error in PNG image of libpng - can't continue */\nPNG_EXPORT(void,png_err) PNGARG((png_structp png_ptr)) PNG_NORETURN;\n#endif\n\n/* Non-fatal error in libpng.  Can continue, but may have a problem. */\nPNG_EXPORT(void,png_warning) PNGARG((png_structp png_ptr,\n   png_const_charp warning_message));\n\n/* Non-fatal error in libpng, chunk name is prepended to message. */\nPNG_EXPORT(void,png_chunk_warning) PNGARG((png_structp png_ptr,\n   png_const_charp warning_message));\n\n#ifdef PNG_BENIGN_ERRORS_SUPPORTED\n/* Benign error in libpng.  Can continue, but may have a problem.\n * User can choose whether to handle as a fatal error or as a warning. */\nPNG_EXPORT(void,png_benign_error) PNGARG((png_structp png_ptr,\n   png_const_charp warning_message));\n\n/* Same, chunk name is prepended to message. */\nPNG_EXPORT(void,png_chunk_benign_error) PNGARG((png_structp png_ptr,\n   png_const_charp warning_message));\n\nPNG_EXPORT(void,png_set_benign_errors) PNGARG((png_structp\n   png_ptr, int allowed));\n#endif\n\n/* The png_set_<chunk> functions are for storing values in the png_info_struct.\n * Similarly, the png_get_<chunk> calls are used to read values from the\n * png_info_struct, either storing the parameters in the passed variables, or\n * setting pointers into the png_info_struct where the data is stored.  The\n * png_get_<chunk> functions return a non-zero value if the data was available\n * in info_ptr, or return zero and do not change any of the parameters if the\n * data was not available.\n *\n * These functions should be used instead of directly accessing png_info\n * to avoid problems with future changes in the size and internal layout of\n * png_info_struct.\n */\n/* Returns \"flag\" if chunk data is valid in info_ptr. */\nPNG_EXPORT(png_uint_32,png_get_valid) PNGARG((png_const_structp png_ptr,\n   png_const_infop info_ptr, png_uint_32 flag));\n\n/* Returns number of bytes needed to hold a transformed row. */\nPNG_EXPORT(png_size_t,png_get_rowbytes) PNGARG((png_const_structp png_ptr,\n   png_const_infop info_ptr));\n\n#ifdef PNG_INFO_IMAGE_SUPPORTED\n/* Returns row_pointers, which is an array of pointers to scanlines that was\n * returned from png_read_png().\n */\nPNG_EXPORT(png_bytepp,png_get_rows) PNGARG((png_const_structp png_ptr,\n   png_const_infop info_ptr));\n/* Set row_pointers, which is an array of pointers to scanlines for use\n * by png_write_png().\n */\nPNG_EXPORT(void,png_set_rows) PNGARG((png_structp png_ptr,\n   png_infop info_ptr, png_bytepp row_pointers));\n#endif\n\n/* Returns number of color channels in image. */\nPNG_EXPORT(png_byte,png_get_channels) PNGARG((png_const_structp png_ptr,\n   png_const_infop info_ptr));\n\n#ifdef PNG_EASY_ACCESS_SUPPORTED\n/* Returns image width in pixels. */\nPNG_EXPORT(png_uint_32, png_get_image_width) PNGARG((png_const_structp\n   png_ptr, png_const_infop info_ptr));\n\n/* Returns image height in pixels. */\nPNG_EXPORT(png_uint_32, png_get_image_height) PNGARG((png_const_structp\n   png_ptr, png_const_infop info_ptr));\n\n/* Returns image bit_depth. */\nPNG_EXPORT(png_byte, png_get_bit_depth) PNGARG((png_const_structp\n   png_ptr, png_const_infop info_ptr));\n\n/* Returns image color_type. */\nPNG_EXPORT(png_byte, png_get_color_type) PNGARG((png_const_structp\n   png_ptr, png_const_infop info_ptr));\n\n/* Returns image filter_type. */\nPNG_EXPORT(png_byte, png_get_filter_type) PNGARG((png_const_structp\n   png_ptr, png_const_infop info_ptr));\n\n/* Returns image interlace_type. */\nPNG_EXPORT(png_byte, png_get_interlace_type) PNGARG((png_const_structp\n   png_ptr, png_const_infop info_ptr));\n\n/* Returns image compression_type. */\nPNG_EXPORT(png_byte, png_get_compression_type) PNGARG((png_const_structp\n   png_ptr, png_const_infop info_ptr));\n\n/* Returns image resolution in pixels per meter, from pHYs chunk data. */\nPNG_EXPORT(png_uint_32, png_get_pixels_per_meter) PNGARG((png_const_structp\n   png_ptr, png_const_infop info_ptr));\nPNG_EXPORT(png_uint_32, png_get_x_pixels_per_meter) PNGARG((png_const_structp\n   png_ptr, png_const_infop info_ptr));\nPNG_EXPORT(png_uint_32, png_get_y_pixels_per_meter) PNGARG((png_const_structp\n   png_ptr, png_const_infop info_ptr));\n\n/* Returns pixel aspect ratio, computed from pHYs chunk data.  */\n#ifdef PNG_FLOATING_POINT_SUPPORTED\nPNG_EXPORT(float, png_get_pixel_aspect_ratio) PNGARG((png_const_structp\n   png_ptr, png_const_infop info_ptr));\n#endif\n\n/* Returns image x, y offset in pixels or microns, from oFFs chunk data. */\nPNG_EXPORT(png_int_32, png_get_x_offset_pixels) PNGARG((png_const_structp\n   png_ptr, png_const_infop info_ptr));\nPNG_EXPORT(png_int_32, png_get_y_offset_pixels) PNGARG((png_const_structp\n   png_ptr, png_const_infop info_ptr));\nPNG_EXPORT(png_int_32, png_get_x_offset_microns) PNGARG((png_const_structp\n   png_ptr, png_const_infop info_ptr));\nPNG_EXPORT(png_int_32, png_get_y_offset_microns) PNGARG((png_const_structp\n   png_ptr, png_const_infop info_ptr));\n\n#endif /* PNG_EASY_ACCESS_SUPPORTED */\n\n/* Returns pointer to signature string read from PNG header */\nPNG_EXPORT(png_bytep,png_get_signature) PNGARG((png_const_structp png_ptr,\n   png_infop info_ptr));\n\n#ifdef PNG_bKGD_SUPPORTED\nPNG_EXPORT(png_uint_32,png_get_bKGD) PNGARG((png_const_structp png_ptr,\n   png_infop info_ptr, png_color_16p *background));\n#endif\n\n#ifdef PNG_bKGD_SUPPORTED\nPNG_EXPORT(void,png_set_bKGD) PNGARG((png_structp png_ptr,\n   png_infop info_ptr, png_color_16p background));\n#endif\n\n#ifdef PNG_cHRM_SUPPORTED\n#ifdef PNG_FLOATING_POINT_SUPPORTED\nPNG_EXPORT(png_uint_32,png_get_cHRM) PNGARG((png_const_structp png_ptr,\n   png_const_infop info_ptr, double *white_x, double *white_y, double *red_x,\n   double *red_y, double *green_x, double *green_y, double *blue_x,\n   double *blue_y));\n#endif\n#ifdef PNG_FIXED_POINT_SUPPORTED\nPNG_EXPORT(png_uint_32,png_get_cHRM_fixed) PNGARG((png_const_structp png_ptr,\n   png_const_infop info_ptr, png_fixed_point *int_white_x, png_fixed_point\n   *int_white_y, png_fixed_point *int_red_x, png_fixed_point *int_red_y,\n   png_fixed_point *int_green_x, png_fixed_point *int_green_y, png_fixed_point\n   *int_blue_x, png_fixed_point *int_blue_y));\n#endif\n#endif\n\n#ifdef PNG_cHRM_SUPPORTED\n#ifdef PNG_FLOATING_POINT_SUPPORTED\nPNG_EXPORT(void,png_set_cHRM) PNGARG((png_structp png_ptr,\n   png_infop info_ptr, double white_x, double white_y, double red_x,\n   double red_y, double green_x, double green_y, double blue_x, double blue_y));\n#endif\n#ifdef PNG_FIXED_POINT_SUPPORTED\nPNG_EXPORT(void,png_set_cHRM_fixed) PNGARG((png_structp png_ptr,\n   png_infop info_ptr, png_fixed_point int_white_x, png_fixed_point int_white_y,\n   png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point\n   int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x,\n   png_fixed_point int_blue_y));\n#endif\n#endif\n\n#ifdef PNG_gAMA_SUPPORTED\n#ifdef PNG_FLOATING_POINT_SUPPORTED\nPNG_EXPORT(png_uint_32,png_get_gAMA) PNGARG((png_const_structp png_ptr,\n   png_const_infop info_ptr, double *file_gamma));\n#endif\nPNG_EXPORT(png_uint_32,png_get_gAMA_fixed) PNGARG((png_const_structp png_ptr,\n   png_const_infop info_ptr, png_fixed_point *int_file_gamma));\n#endif\n\n#ifdef PNG_gAMA_SUPPORTED\n#ifdef PNG_FLOATING_POINT_SUPPORTED\nPNG_EXPORT(void,png_set_gAMA) PNGARG((png_structp png_ptr,\n   png_infop info_ptr, double file_gamma));\n#endif\nPNG_EXPORT(void,png_set_gAMA_fixed) PNGARG((png_structp png_ptr,\n   png_infop info_ptr, png_fixed_point int_file_gamma));\n#endif\n\n#ifdef PNG_hIST_SUPPORTED\nPNG_EXPORT(png_uint_32,png_get_hIST) PNGARG((png_const_structp png_ptr,\n   png_const_infop info_ptr, png_uint_16p *hist));\n#endif\n\n#ifdef PNG_hIST_SUPPORTED\nPNG_EXPORT(void,png_set_hIST) PNGARG((png_structp png_ptr,\n   png_infop info_ptr, png_uint_16p hist));\n#endif\n\nPNG_EXPORT(png_uint_32,png_get_IHDR) PNGARG((png_structp png_ptr,\n   png_infop info_ptr, png_uint_32 *width, png_uint_32 *height,\n   int *bit_depth, int *color_type, int *interlace_method,\n   int *compression_method, int *filter_method));\n\nPNG_EXPORT(void,png_set_IHDR) PNGARG((png_structp png_ptr,\n   png_infop info_ptr, png_uint_32 width, png_uint_32 height, int bit_depth,\n   int color_type, int interlace_method, int compression_method,\n   int filter_method));\n\n#ifdef PNG_oFFs_SUPPORTED\nPNG_EXPORT(png_uint_32,png_get_oFFs) PNGARG((png_const_structp png_ptr,\n   png_const_infop info_ptr, png_int_32 *offset_x, png_int_32 *offset_y,\n   int *unit_type));\n#endif\n\n#ifdef PNG_oFFs_SUPPORTED\nPNG_EXPORT(void,png_set_oFFs) PNGARG((png_structp png_ptr,\n   png_infop info_ptr, png_int_32 offset_x, png_int_32 offset_y,\n   int unit_type));\n#endif\n\n#ifdef PNG_pCAL_SUPPORTED\nPNG_EXPORT(png_uint_32,png_get_pCAL) PNGARG((png_const_structp png_ptr,\n   png_const_infop info_ptr, png_charp *purpose, png_int_32 *X0, png_int_32 *X1,\n   int *type, int *nparams, png_charp *units, png_charpp *params));\n#endif\n\n#ifdef PNG_pCAL_SUPPORTED\nPNG_EXPORT(void,png_set_pCAL) PNGARG((png_structp png_ptr,\n   png_infop info_ptr, png_charp purpose, png_int_32 X0, png_int_32 X1,\n   int type, int nparams, png_charp units, png_charpp params));\n#endif\n\n#ifdef PNG_pHYs_SUPPORTED\nPNG_EXPORT(png_uint_32,png_get_pHYs) PNGARG((png_const_structp png_ptr,\n   png_const_infop info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type));\n#endif\n\n#ifdef PNG_pHYs_SUPPORTED\nPNG_EXPORT(void,png_set_pHYs) PNGARG((png_structp png_ptr,\n   png_infop info_ptr, png_uint_32 res_x, png_uint_32 res_y, int unit_type));\n#endif\n\nPNG_EXPORT(png_uint_32,png_get_PLTE) PNGARG((png_const_structp png_ptr,\n   png_const_infop info_ptr, png_colorp *palette, int *num_palette));\n\nPNG_EXPORT(void,png_set_PLTE) PNGARG((png_structp png_ptr,\n   png_infop info_ptr, png_colorp palette, int num_palette));\n\n#ifdef PNG_sBIT_SUPPORTED\nPNG_EXPORT(png_uint_32,png_get_sBIT) PNGARG((png_const_structp png_ptr,\n   png_infop info_ptr, png_color_8p *sig_bit));\n#endif\n\n#ifdef PNG_sBIT_SUPPORTED\nPNG_EXPORT(void,png_set_sBIT) PNGARG((png_structp png_ptr,\n   png_infop info_ptr, png_color_8p sig_bit));\n#endif\n\n#ifdef PNG_sRGB_SUPPORTED\nPNG_EXPORT(png_uint_32,png_get_sRGB) PNGARG((png_const_structp png_ptr,\n   png_const_infop info_ptr, int *intent));\n#endif\n\n#ifdef PNG_sRGB_SUPPORTED\nPNG_EXPORT(void,png_set_sRGB) PNGARG((png_structp png_ptr,\n   png_infop info_ptr, int intent));\nPNG_EXPORT(void,png_set_sRGB_gAMA_and_cHRM) PNGARG((png_structp png_ptr,\n   png_infop info_ptr, int intent));\n#endif\n\n#ifdef PNG_iCCP_SUPPORTED\nPNG_EXPORT(png_uint_32,png_get_iCCP) PNGARG((png_const_structp png_ptr,\n   png_const_infop info_ptr, png_charpp name, int *compression_type,\n   png_charpp profile, png_uint_32 *proflen));\n   /* Note to maintainer: profile should be png_bytepp */\n#endif\n\n#ifdef PNG_iCCP_SUPPORTED\nPNG_EXPORT(void,png_set_iCCP) PNGARG((png_structp png_ptr,\n   png_infop info_ptr, png_charp name, int compression_type,\n   png_charp profile, png_uint_32 proflen));\n   /* Note to maintainer: profile should be png_bytep */\n#endif\n\n#ifdef PNG_sPLT_SUPPORTED\nPNG_EXPORT(png_uint_32,png_get_sPLT) PNGARG((png_const_structp png_ptr,\n   png_const_infop info_ptr, png_sPLT_tpp entries));\n#endif\n\n#ifdef PNG_sPLT_SUPPORTED\nPNG_EXPORT(void,png_set_sPLT) PNGARG((png_structp png_ptr,\n   png_infop info_ptr, png_sPLT_tp entries, int nentries));\n#endif\n\n#ifdef PNG_TEXT_SUPPORTED\n/* png_get_text also returns the number of text chunks in *num_text */\nPNG_EXPORT(png_uint_32,png_get_text) PNGARG((png_const_structp png_ptr,\n   png_const_infop info_ptr, png_textp *text_ptr, int *num_text));\n#endif\n\n/* Note while png_set_text() will accept a structure whose text,\n * language, and  translated keywords are NULL pointers, the structure\n * returned by png_get_text will always contain regular\n * zero-terminated C strings.  They might be empty strings but\n * they will never be NULL pointers.\n */\n\n#ifdef PNG_TEXT_SUPPORTED\nPNG_EXPORT(void,png_set_text) PNGARG((png_structp png_ptr,\n   png_infop info_ptr, png_textp text_ptr, int num_text));\n#endif\n\n#ifdef PNG_tIME_SUPPORTED\nPNG_EXPORT(png_uint_32,png_get_tIME) PNGARG((png_const_structp png_ptr,\n   png_infop info_ptr, png_timep *mod_time));\n#endif\n\n#ifdef PNG_tIME_SUPPORTED\nPNG_EXPORT(void,png_set_tIME) PNGARG((png_structp png_ptr,\n   png_infop info_ptr, png_timep mod_time));\n#endif\n\n#ifdef PNG_tRNS_SUPPORTED\nPNG_EXPORT(png_uint_32,png_get_tRNS) PNGARG((png_const_structp png_ptr,\n   png_infop info_ptr, png_bytep *trans_alpha, int *num_trans,\n   png_color_16p *trans_color));\n#endif\n\n#ifdef PNG_tRNS_SUPPORTED\nPNG_EXPORT(void,png_set_tRNS) PNGARG((png_structp png_ptr,\n   png_infop info_ptr, png_bytep trans_alpha, int num_trans,\n   png_color_16p trans_color));\n#endif\n\n#ifdef PNG_tRNS_SUPPORTED\n#endif\n\n#ifdef PNG_sCAL_SUPPORTED\n#ifdef PNG_FLOATING_POINT_SUPPORTED\nPNG_EXPORT(png_uint_32,png_get_sCAL) PNGARG((png_const_structp png_ptr,\n   png_const_infop info_ptr, int *unit, double *width, double *height));\n#else\n#ifdef PNG_FIXED_POINT_SUPPORTED\nPNG_EXPORT(png_uint_32,png_get_sCAL_s) PNGARG((png_const_structp png_ptr,\n   png_const_infop info_ptr, int *unit, png_charpp swidth, png_charpp sheight));\n#endif\n#endif\n#endif /* PNG_sCAL_SUPPORTED */\n\n#ifdef PNG_sCAL_SUPPORTED\n#ifdef PNG_FLOATING_POINT_SUPPORTED\nPNG_EXPORT(void,png_set_sCAL) PNGARG((png_structp png_ptr,\n   png_infop info_ptr, int unit, double width, double height));\n#else\n#ifdef PNG_FIXED_POINT_SUPPORTED\nPNG_EXPORT(void,png_set_sCAL_s) PNGARG((png_structp png_ptr,\n   png_infop info_ptr, int unit, png_charp swidth, png_charp sheight));\n#endif\n#endif\n#endif /* PNG_sCAL_SUPPORTED || PNG_WRITE_sCAL_SUPPORTED */\n\n#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED\n/* Provide a list of chunks and how they are to be handled, if the built-in\n   handling or default unknown chunk handling is not desired.  Any chunks not\n   listed will be handled in the default manner.  The IHDR and IEND chunks\n   must not be listed.\n      keep = 0: follow default behaviour\n           = 1: do not keep\n           = 2: keep only if safe-to-copy\n           = 3: keep even if unsafe-to-copy\n*/\nPNG_EXPORT(void, png_set_keep_unknown_chunks) PNGARG((png_structp\n   png_ptr, int keep, png_bytep chunk_list, int num_chunks));\nPNG_EXPORT(int,png_handle_as_unknown) PNGARG((png_structp png_ptr, png_bytep\n   chunk_name));\n#endif\n#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED\nPNG_EXPORT(void, png_set_unknown_chunks) PNGARG((png_structp png_ptr,\n   png_infop info_ptr, png_unknown_chunkp unknowns, int num_unknowns));\nPNG_EXPORT(void, png_set_unknown_chunk_location)\n   PNGARG((png_structp png_ptr, png_infop info_ptr, int chunk, int location));\nPNG_EXPORT(png_uint_32,png_get_unknown_chunks) PNGARG((png_const_structp\n   png_ptr, png_const_infop info_ptr, png_unknown_chunkpp entries));\n#endif\n\n/* Png_free_data() will turn off the \"valid\" flag for anything it frees.\n * If you need to turn it off for a chunk that your application has freed,\n * you can use png_set_invalid(png_ptr, info_ptr, PNG_INFO_CHNK);\n */\nPNG_EXPORT(void, png_set_invalid) PNGARG((png_structp png_ptr,\n   png_infop info_ptr, int mask));\n\n#ifdef PNG_INFO_IMAGE_SUPPORTED\n/* The \"params\" pointer is currently not used and is for future expansion. */\nPNG_EXPORT(void, png_read_png) PNGARG((png_structp png_ptr,\n                        png_infop info_ptr,\n                        int transforms,\n                        png_voidp params));\nPNG_EXPORT(void, png_write_png) PNGARG((png_structp png_ptr,\n                        png_infop info_ptr,\n                        int transforms,\n                        png_voidp params));\n#endif\n\nPNG_EXPORT(png_charp,png_get_copyright) PNGARG((png_const_structp png_ptr));\nPNG_EXPORT(png_charp,png_get_header_ver) PNGARG((png_const_structp png_ptr));\nPNG_EXPORT(png_charp,png_get_header_version) PNGARG((png_const_structp\n    png_ptr));\nPNG_EXPORT(png_charp,png_get_libpng_ver) PNGARG((png_const_structp png_ptr));\n\n#ifdef PNG_MNG_FEATURES_SUPPORTED\nPNG_EXPORT(png_uint_32,png_permit_mng_features) PNGARG((png_structp\n   png_ptr, png_uint_32 mng_features_permitted));\n#endif\n\n/* For use in png_set_keep_unknown, added to version 1.2.6 */\n#define PNG_HANDLE_CHUNK_AS_DEFAULT   0\n#define PNG_HANDLE_CHUNK_NEVER        1\n#define PNG_HANDLE_CHUNK_IF_SAFE      2\n#define PNG_HANDLE_CHUNK_ALWAYS       3\n\n/* Strip the prepended error numbers (\"#nnn \") from error and warning\n * messages before passing them to the error or warning handler.\n */\n#ifdef PNG_ERROR_NUMBERS_SUPPORTED\nPNG_EXPORT(void,png_set_strip_error_numbers) PNGARG((png_structp\n   png_ptr, png_uint_32 strip_mode));\n#endif\n\n/* Added in libpng-1.2.6 */\n#ifdef PNG_SET_USER_LIMITS_SUPPORTED\nPNG_EXPORT(void,png_set_user_limits) PNGARG((png_structp\n   png_ptr, png_uint_32 user_width_max, png_uint_32 user_height_max));\nPNG_EXPORT(png_uint_32,png_get_user_width_max) PNGARG((png_const_structp\n   png_ptr));\nPNG_EXPORT(png_uint_32,png_get_user_height_max) PNGARG((png_const_structp\n   png_ptr));\n/* Added in libpng-1.4.0 */\nPNG_EXPORT(void,png_set_chunk_cache_max) PNGARG((png_structp\n   png_ptr, png_uint_32 user_chunk_cache_max));\nPNG_EXPORT(png_uint_32,png_get_chunk_cache_max)\n   PNGARG((png_const_structp png_ptr));\n/* Added in libpng-1.4.1 */\nPNG_EXPORT(void,png_set_chunk_malloc_max) PNGARG((png_structp\n   png_ptr, png_alloc_size_t user_chunk_cache_max));\nPNG_EXPORT(png_alloc_size_t,png_get_chunk_malloc_max)\n   PNGARG((png_const_structp png_ptr));\n#endif\n\n#if defined(PNG_INCH_CONVERSIONS) && defined(PNG_FLOATING_POINT_SUPPORTED)\nPNG_EXPORT(png_uint_32,png_get_pixels_per_inch)\n   PNGARG((png_const_structp png_ptr, png_const_infop info_ptr));\n\nPNG_EXPORT(png_uint_32,png_get_x_pixels_per_inch)\n   PNGARG((png_const_structp png_ptr, png_const_infop info_ptr));\n\nPNG_EXPORT(png_uint_32,png_get_y_pixels_per_inch)\n   PNGARG((png_const_structp png_ptr, png_const_infop info_ptr));\n\nPNG_EXPORT(float,png_get_x_offset_inches) PNGARG((png_const_structp png_ptr,\n   png_const_infop info_ptr));\n\nPNG_EXPORT(float,png_get_y_offset_inches) PNGARG((png_const_structp png_ptr,\n   png_const_infop info_ptr));\n\n#ifdef PNG_pHYs_SUPPORTED\nPNG_EXPORT(png_uint_32,png_get_pHYs_dpi) PNGARG((png_const_structp png_ptr,\n   png_const_infop info_ptr, png_uint_32 *res_x, png_uint_32 *res_y,\n   int *unit_type));\n#endif /* PNG_pHYs_SUPPORTED */\n#endif  /* PNG_INCH_CONVERSIONS && PNG_FLOATING_POINT_SUPPORTED */\n\n/* Added in libpng-1.4.0 */\n#ifdef PNG_IO_STATE_SUPPORTED\nPNG_EXPORT(png_uint_32,png_get_io_state) PNGARG((png_const_structp png_ptr));\n\nPNG_EXPORT(png_bytep,png_get_io_chunk_name)\n   PNGARG((png_structp png_ptr));\n\n/* The flags returned by png_get_io_state() are the following: */\n#define PNG_IO_NONE        0x0000   /* no I/O at this moment */\n#define PNG_IO_READING     0x0001   /* currently reading */\n#define PNG_IO_WRITING     0x0002   /* currently writing */\n#define PNG_IO_SIGNATURE   0x0010   /* currently at the file signature */\n#define PNG_IO_CHUNK_HDR   0x0020   /* currently at the chunk header */\n#define PNG_IO_CHUNK_DATA  0x0040   /* currently at the chunk data */\n#define PNG_IO_CHUNK_CRC   0x0080   /* currently at the chunk crc */\n#define PNG_IO_MASK_OP     0x000f   /* current operation: reading/writing */\n#define PNG_IO_MASK_LOC    0x00f0   /* current location: sig/hdr/data/crc */\n#endif /* ?PNG_IO_STATE_SUPPORTED */\n\n/* Maintainer: Put new public prototypes here ^, in libpng.3, and project\n * defs\n */\n\n#ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED\n/* With these routines we avoid an integer divide, which will be slower on\n * most machines.  However, it does take more operations than the corresponding\n * divide method, so it may be slower on a few RISC systems.  There are two\n * shifts (by 8 or 16 bits) and an addition, versus a single integer divide.\n *\n * Note that the rounding factors are NOT supposed to be the same!  128 and\n * 32768 are correct for the NODIV code; 127 and 32767 are correct for the\n * standard method.\n *\n * [Optimized code by Greg Roelofs and Mark Adler...blame us for bugs. :-) ]\n */\n\n /* fg and bg should be in `gamma 1.0' space; alpha is the opacity          */\n\n#  define png_composite(composite, fg, alpha, bg)         \\\n     { png_uint_16 temp = (png_uint_16)((png_uint_16)(fg) \\\n           * (png_uint_16)(alpha)                         \\\n           + (png_uint_16)(bg)*(png_uint_16)(255          \\\n           - (png_uint_16)(alpha)) + (png_uint_16)128);   \\\n       (composite) = (png_byte)((temp + (temp >> 8)) >> 8); }\n\n#  define png_composite_16(composite, fg, alpha, bg)       \\\n     { png_uint_32 temp = (png_uint_32)((png_uint_32)(fg)  \\\n           * (png_uint_32)(alpha)                          \\\n           + (png_uint_32)(bg)*(png_uint_32)(65535L        \\\n           - (png_uint_32)(alpha)) + (png_uint_32)32768L); \\\n       (composite) = (png_uint_16)((temp + (temp >> 16)) >> 16); }\n\n#else  /* Standard method using integer division */\n\n#  define png_composite(composite, fg, alpha, bg)                            \\\n     (composite) = (png_byte)(((png_uint_16)(fg) * (png_uint_16)(alpha) +    \\\n       (png_uint_16)(bg) * (png_uint_16)(255 - (png_uint_16)(alpha)) +       \\\n       (png_uint_16)127) / 255)\n\n#  define png_composite_16(composite, fg, alpha, bg)                         \\\n     (composite) = (png_uint_16)(((png_uint_32)(fg) * (png_uint_32)(alpha) + \\\n       (png_uint_32)(bg)*(png_uint_32)(65535L - (png_uint_32)(alpha)) +      \\\n       (png_uint_32)32767) / (png_uint_32)65535L)\n#endif /* PNG_READ_COMPOSITE_NODIV_SUPPORTED */\n\n#ifdef PNG_USE_READ_MACROS\n/* Inline macros to do direct reads of bytes from the input buffer.\n * The png_get_int_32() routine assumes we are using two's complement\n * format for negative values, which is almost certainly true.\n */\n#  define png_get_uint_32(buf) \\\n     (((png_uint_32)((*(buf)) & 0xff) << 24) + \\\n      ((png_uint_32)((*((buf) + 1)) & 0xff) << 16) + \\\n      ((png_uint_32)((*((buf) + 2)) & 0xff) << 8) + \\\n      ((png_uint_32)((*((buf) + 3)) & 0xff)))\n\n  /* The following definition introduces an API incompatibility (but not\n   * an ABI incompatibility) with libpng-1.4.0 through 1.4.4.  Prior to\n   * libpng-1.4.5 the macro, which is used by default, returned (incorrectly)\n   * a (png_uint_32), while the function, if used instead, correctly returned\n   * a (png_uint_16).\n   *\n   * Libpng versions 1.0.x and 1.2.x only used a function so are not affected\n   * by this potential API incompatibility between macros.\n   */\n#  define png_get_uint_16(buf) \\\n     ((png_uint_16) \\\n       (((unsigned int)(*(buf)) << 8) + \\\n        ((unsigned int)(*((buf) + 1)))))\n\n#  define png_get_int_32(buf) \\\n     ((png_int_32)((*(buf) & 0x80) \\\n      ? -((png_int_32)(((png_get_uint_32(buf)^0xffffffffU)+1U)&0x7fffffffU)) \\\n      : (png_int_32)png_get_uint_32(buf)))\n#else\nPNG_EXPORT(png_uint_32,png_get_uint_32) PNGARG((png_bytep buf));\nPNG_EXPORT(png_uint_16,png_get_uint_16) PNGARG((png_bytep buf));\n#ifdef PNG_GET_INT_32_SUPPORTED\nPNG_EXPORT(png_int_32,png_get_int_32) PNGARG((png_bytep buf));\n#endif\n#endif\nPNG_EXPORT(png_uint_32,png_get_uint_31)\n  PNGARG((png_structp png_ptr, png_bytep buf));\n/* No png_get_int_16 -- may be added if there's a real need for it. */\n\n/* Place a 32-bit number into a buffer in PNG byte order (big-endian). */\nPNG_EXPORT(void,png_save_uint_32)\n   PNGARG((png_bytep buf, png_uint_32 i));\nPNG_EXPORT(void,png_save_int_32)\n   PNGARG((png_bytep buf, png_int_32 i));\n\n/* Place a 16-bit number into a buffer in PNG byte order.\n * The parameter is declared unsigned int, not png_uint_16,\n * just to avoid potential problems on pre-ANSI C compilers.\n */\nPNG_EXPORT(void,png_save_uint_16)\n   PNGARG((png_bytep buf, unsigned int i));\n/* No png_save_int_16 -- may be added if there's a real need for it. */\n\n/* ************************************************************************* */\n\n/* Various modes of operation.  Note that after an init, mode is set to\n * zero automatically when the structure is created.\n */\n#define PNG_HAVE_IHDR               0x01\n#define PNG_HAVE_PLTE               0x02\n#define PNG_HAVE_IDAT               0x04\n#define PNG_AFTER_IDAT              0x08 /* Have complete zlib datastream */\n#define PNG_HAVE_IEND               0x10\n#define PNG_HAVE_gAMA               0x20\n#define PNG_HAVE_cHRM               0x40\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* PNG_VERSION_INFO_ONLY */\n/* Do not put anything past this line */\n#endif /* PNG_H */\n"
  },
  {
    "path": "src/main/jni/png/pngconf.h",
    "content": "\n/* pngconf.h - machine configurable file for libpng\n *\n * libpng version 1.4.19, December 17, 2015\n *\n * Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson\n * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)\n * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)\n *\n * This code is released under the libpng license.\n * For conditions of distribution and use, see the disclaimer\n * and license in png.h\n *\n * Any machine specific code is near the front of this file, so if you\n * are configuring libpng for a machine, you may want to read the section\n * starting here down to where it starts to typedef png_color, png_text,\n * and png_info.\n */\n\n#ifndef PNGCONF_H\n#define PNGCONF_H\n\n#ifndef PNG_NO_LIMITS_H\n#  include <limits.h>\n#endif\n\n/* Added at libpng-1.2.9 */\n\n/* config.h is created by and PNG_CONFIGURE_LIBPNG is set by the \"configure\"\n * script.\n */\n#ifdef PNG_CONFIGURE_LIBPNG\n#  ifdef HAVE_CONFIG_H\n#    include \"config.h\"\n#  endif\n#endif\n\n/*\n * Added at libpng-1.2.8\n *\n * PNG_USER_CONFIG has to be defined on the compiler command line. This\n * includes the resource compiler for Windows DLL configurations.\n */\n#ifdef PNG_USER_CONFIG\n#  include \"pngusr.h\"\n#  ifndef PNG_USER_PRIVATEBUILD\n#    define PNG_USER_PRIVATEBUILD\n#  endif\n#endif\n\n/*\n * If you create a private DLL you should define in \"pngusr.h\" the following:\n * #define PNG_USER_PRIVATEBUILD <Describes by whom and why this version of\n *        the DLL was built>\n *  e.g. #define PNG_USER_PRIVATEBUILD \"Build by MyCompany for xyz reasons.\"\n * #define PNG_USER_DLLFNAME_POSTFIX <two-letter postfix that serve to\n *        distinguish your DLL from those of the official release. These\n *        correspond to the trailing letters that come after the version\n *        number and must match your private DLL name>\n *  e.g. // private DLL \"libpng14gx.dll\"\n *       #define PNG_USER_DLLFNAME_POSTFIX \"gx\"\n *\n * The following macros are also at your disposal if you want to complete the\n * DLL VERSIONINFO structure.\n * - PNG_USER_VERSIONINFO_COMMENTS\n * - PNG_USER_VERSIONINFO_COMPANYNAME\n * - PNG_USER_VERSIONINFO_LEGALTRADEMARKS\n */\n\n#ifdef __STDC__\n#  ifdef SPECIALBUILD\n#    pragma message(\"PNG_LIBPNG_SPECIALBUILD (and deprecated SPECIALBUILD)\\\n     are now LIBPNG reserved macros. Use PNG_USER_PRIVATEBUILD instead.\")\n#  endif\n\n#  ifdef PRIVATEBUILD\n#    pragma message(\"PRIVATEBUILD is deprecated.\\\n     Use PNG_USER_PRIVATEBUILD instead.\")\n#    define PNG_USER_PRIVATEBUILD PRIVATEBUILD\n#  endif\n#endif /* __STDC__ */\n\n/* End of material added to libpng-1.2.8 */\n\n/* Added at libpng-1.4.6 */\n#ifndef PNG_UNUSED\n/* Unused formal parameter warnings are silenced using the following macro\n * which is expected to have no bad effects on performance (optimizing\n * compilers will probably remove it entirely).  Note that if you replace\n * it with something other than whitespace, you must include the terminating\n * semicolon.\n */\n#  define PNG_UNUSED(param) (void)param;\n#endif\n/* End of material added to libpng-1.4.6 */\n\n#ifndef PNG_VERSION_INFO_ONLY\n\n/* This is the size of the compression buffer, and thus the size of\n * an IDAT chunk.  Make this whatever size you feel is best for your\n * machine.  One of these will be allocated per png_struct.  When this\n * is full, it writes the data to the disk, and does some other\n * calculations.  Making this an extremely small size will slow\n * the library down, but you may want to experiment to determine\n * where it becomes significant, if you are concerned with memory\n * usage.  Note that zlib allocates at least 32Kb also.  For readers,\n * this describes the size of the buffer available to read the data in.\n * Unless this gets smaller than the size of a row (compressed),\n * it should not make much difference how big this is.\n */\n\n#ifndef PNG_ZBUF_SIZE\n#  define PNG_ZBUF_SIZE 8192\n#endif\n\n/* Enable if you want a write-only libpng */\n\n#ifndef PNG_NO_READ_SUPPORTED\n#  define PNG_READ_SUPPORTED\n#endif\n\n/* Enable if you want a read-only libpng */\n\n#ifndef PNG_NO_WRITE_SUPPORTED\n#  define PNG_WRITE_SUPPORTED\n#endif\n\n/* Enabled in 1.4.0. */\n#ifdef PNG_ALLOW_BENIGN_ERRORS\n#  define png_benign_error png_warning\n#  define png_chunk_benign_error png_chunk_warning\n#else\n#  ifndef PNG_BENIGN_ERRORS_SUPPORTED\n#    define png_benign_error png_error\n#    define png_chunk_benign_error png_chunk_error\n#  endif\n#endif\n\n/* Added at libpng version 1.4.0 */\n#if !defined(PNG_NO_WARNINGS) && !defined(PNG_WARNINGS_SUPPORTED)\n#  define PNG_WARNINGS_SUPPORTED\n#endif\n\n/* Added at libpng version 1.4.0 */\n#if !defined(PNG_NO_ERROR_TEXT) && !defined(PNG_ERROR_TEXT_SUPPORTED)\n#  define PNG_ERROR_TEXT_SUPPORTED\n#endif\n\n/* Added at libpng version 1.4.0 */\n#if !defined(PNG_NO_CHECK_cHRM) && !defined(PNG_CHECK_cHRM_SUPPORTED)\n#  define PNG_CHECK_cHRM_SUPPORTED\n#endif\n\n/* Added at libpng version 1.4.0 */\n#if !defined(PNG_NO_ALIGNED_MEMORY) && !defined(PNG_ALIGNED_MEMORY_SUPPORTED)\n#  define PNG_ALIGNED_MEMORY_SUPPORTED\n#endif\n\n/* Enabled by default in 1.2.0.  You can disable this if you don't need to\n   support PNGs that are embedded in MNG datastreams */\n#ifndef PNG_NO_MNG_FEATURES\n#  ifndef PNG_MNG_FEATURES_SUPPORTED\n#    define PNG_MNG_FEATURES_SUPPORTED\n#  endif\n#endif\n\n/* Added at libpng version 1.4.0 */\n#ifndef PNG_NO_FLOATING_POINT_SUPPORTED\n#  ifndef PNG_FLOATING_POINT_SUPPORTED\n#    define PNG_FLOATING_POINT_SUPPORTED\n#  endif\n#endif\n\n/* Added at libpng-1.4.0beta49 for testing (this test is no longer used\n   in libpng and png_calloc() is always present)\n */\n#define PNG_CALLOC_SUPPORTED\n\n/* If you are running on a machine where you cannot allocate more\n * than 64K of memory at once, uncomment this.  While libpng will not\n * normally need that much memory in a chunk (unless you load up a very\n * large file), zlib needs to know how big of a chunk it can use, and\n * libpng thus makes sure to check any memory allocation to verify it\n * will fit into memory.\n#define PNG_MAX_MALLOC_64K\n */\n#if defined(MAXSEG_64K) && !defined(PNG_MAX_MALLOC_64K)\n#  define PNG_MAX_MALLOC_64K\n#endif\n\n/* Special munging to support doing things the 'cygwin' way:\n * 'Normal' png-on-win32 defines/defaults:\n *   PNG_BUILD_DLL -- building dll\n *   PNG_USE_DLL   -- building an application, linking to dll\n *   (no define)   -- building static library, or building an\n *                    application and linking to the static lib\n * 'Cygwin' defines/defaults:\n *   PNG_BUILD_DLL -- (ignored) building the dll\n *   (no define)   -- (ignored) building an application, linking to the dll\n *   PNG_STATIC    -- (ignored) building the static lib, or building an\n *                    application that links to the static lib.\n *   ALL_STATIC    -- (ignored) building various static libs, or building an\n *                    application that links to the static libs.\n * Thus,\n * a cygwin user should define either PNG_BUILD_DLL or PNG_STATIC, and\n * this bit of #ifdefs will define the 'correct' config variables based on\n * that. If a cygwin user *wants* to define 'PNG_USE_DLL' that's okay, but\n * unnecessary.\n *\n * Also, the precedence order is:\n *   ALL_STATIC (since we can't #undef something outside our namespace)\n *   PNG_BUILD_DLL\n *   PNG_STATIC\n *   (nothing) == PNG_USE_DLL\n *\n * CYGWIN (2002-01-20): The preceding is now obsolete. With the advent\n *   of auto-import in binutils, we no longer need to worry about\n *   __declspec(dllexport) / __declspec(dllimport) and friends.  Therefore,\n *   we don't need to worry about PNG_STATIC or ALL_STATIC when it comes\n *   to __declspec() stuff.  However, we DO need to worry about\n *   PNG_BUILD_DLL and PNG_STATIC because those change some defaults\n *   such as CONSOLE_IO.\n */\n#ifdef __CYGWIN__\n#  ifdef ALL_STATIC\n#    ifdef PNG_BUILD_DLL\n#      undef PNG_BUILD_DLL\n#    endif\n#    ifdef PNG_USE_DLL\n#      undef PNG_USE_DLL\n#    endif\n#    ifdef PNG_DLL\n#      undef PNG_DLL\n#    endif\n#    ifndef PNG_STATIC\n#      define PNG_STATIC\n#    endif\n#  else\n#    ifdef PNG_BUILD_DLL\n#      ifdef PNG_STATIC\n#        undef PNG_STATIC\n#      endif\n#      ifdef PNG_USE_DLL\n#        undef PNG_USE_DLL\n#      endif\n#      ifndef PNG_DLL\n#        define PNG_DLL\n#      endif\n#    else\n#      ifdef PNG_STATIC\n#        ifdef PNG_USE_DLL\n#          undef PNG_USE_DLL\n#        endif\n#        ifdef PNG_DLL\n#          undef PNG_DLL\n#        endif\n#      else\n#        ifndef PNG_USE_DLL\n#          define PNG_USE_DLL\n#        endif\n#        ifndef PNG_DLL\n#          define PNG_DLL\n#        endif\n#      endif\n#    endif\n#  endif\n#endif\n\n/* This protects us against compilers that run on a windowing system\n * and thus don't have or would rather us not use the stdio types:\n * stdin, stdout, and stderr.  The only one currently used is stderr\n * in png_error() and png_warning().  #defining PNG_NO_CONSOLE_IO will\n * prevent these from being compiled and used. #defining PNG_NO_STDIO\n * will also prevent these, plus will prevent the entire set of stdio\n * macros and functions (FILE *, printf, etc.) from being compiled and used,\n * unless (PNG_DEBUG > 0) has been #defined.\n *\n * #define PNG_NO_CONSOLE_IO\n * #define PNG_NO_STDIO\n */\n\n#ifdef _WIN32_WCE\n#  define PNG_NO_CONSOLE_IO\n#  define PNG_NO_STDIO\n#  define PNG_NO_TIME_RFC1123\n#  ifdef PNG_DEBUG\n#    undef PNG_DEBUG\n#  endif\n#endif\n\n#if !defined(PNG_NO_STDIO) && !defined(PNG_STDIO_SUPPORTED)\n#  define PNG_STDIO_SUPPORTED\n#endif\n\n#ifdef PNG_BUILD_DLL\n#  if !defined(PNG_CONSOLE_IO_SUPPORTED) && !defined(PNG_NO_CONSOLE_IO)\n#    define PNG_NO_CONSOLE_IO\n#  endif\n#endif\n\n#  ifdef PNG_NO_STDIO\n#    ifndef PNG_NO_CONSOLE_IO\n#      define PNG_NO_CONSOLE_IO\n#    endif\n#    ifdef PNG_DEBUG\n#      if (PNG_DEBUG > 0)\n#        include <stdio.h>\n#      endif\n#    endif\n#  else\n#    include <stdio.h>\n#  endif\n\n#if !(defined PNG_NO_CONSOLE_IO) && !defined(PNG_CONSOLE_IO_SUPPORTED)\n#  define PNG_CONSOLE_IO_SUPPORTED\n#endif\n\n/* This macro protects us against machines that don't have function\n * prototypes (ie K&R style headers).  If your compiler does not handle\n * function prototypes, define this macro and use the included ansi2knr.\n * I've always been able to use _NO_PROTO as the indicator, but you may\n * need to drag the empty declaration out in front of here, or change the\n * ifdef to suit your own needs.\n */\n#ifndef PNGARG\n\n#ifdef OF /* zlib prototype munger */\n#  define PNGARG(arglist) OF(arglist)\n#else\n\n#ifdef _NO_PROTO\n#  define PNGARG(arglist) ()\n#else\n#  define PNGARG(arglist) arglist\n#endif /* _NO_PROTO */\n\n#endif /* OF */\n\n#endif /* PNGARG */\n\n/* Try to determine if we are compiling on a Mac.  Note that testing for\n * just __MWERKS__ is not good enough, because the Codewarrior is now used\n * on non-Mac platforms.\n */\n#ifndef MACOS\n#  if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \\\n      defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC)\n#    define MACOS\n#  endif\n#endif\n\n/* Enough people need this for various reasons to include it here */\n#if !defined(MACOS) && !defined(RISCOS)\n#  include <sys/types.h>\n#endif\n\n/* PNG_SETJMP_NOT_SUPPORTED and PNG_NO_SETJMP_SUPPORTED are deprecated. */\n#if !defined(PNG_NO_SETJMP) && \\\n    !defined(PNG_SETJMP_NOT_SUPPORTED) && !defined(PNG_NO_SETJMP_SUPPORTED)\n#  define PNG_SETJMP_SUPPORTED\n#endif\n\n#ifdef PNG_SETJMP_SUPPORTED\n/* This is an attempt to force a single setjmp behaviour on Linux.  If\n * the X config stuff didn't define _BSD_SOURCE we wouldn't need this.\n *\n * You can bypass this test if you know that your application uses exactly\n * the same setjmp.h that was included when libpng was built.  Only define\n * PNG_SKIP_SETJMP_CHECK while building your application, prior to the\n * application's '#include \"png.h\"'. Don't define PNG_SKIP_SETJMP_CHECK\n * while building a separate libpng library for general use.\n */\n\n#  ifndef PNG_SKIP_SETJMP_CHECK\n#    ifdef __linux__\n#      ifdef _BSD_SOURCE\n#        define PNG_SAVE_BSD_SOURCE\n#        undef _BSD_SOURCE\n#      endif\n#      ifdef _SETJMP_H\n       /* If you encounter a compiler error here, see the explanation\n        * near the end of INSTALL.\n        */\n           __pngconf.h__ in libpng already includes setjmp.h;\n           __dont__ include it again.;\n#      endif\n#    endif /* __linux__ */\n#  endif /* PNG_SKIP_SETJMP_CHECK */\n\n   /* Include setjmp.h for error handling */\n#  include <setjmp.h>\n\n#  ifdef __linux__\n#    ifdef PNG_SAVE_BSD_SOURCE\n#      ifdef _BSD_SOURCE\n#        undef _BSD_SOURCE\n#      endif\n#      define _BSD_SOURCE\n#      undef PNG_SAVE_BSD_SOURCE\n#    endif\n#  endif /* __linux__ */\n#endif /* PNG_SETJMP_SUPPORTED */\n\n#ifdef BSD\n#  include <strings.h>\n#else\n#  include <string.h>\n#endif\n\n/* Other defines for things like memory and the like can go here.  */\n\n/* This controls how fine the quantizing gets.  As this allocates\n * a largish chunk of memory (32K), those who are not as concerned\n * with quantizing quality can decrease some or all of these.\n */\n\n/* Prior to libpng-1.4.2, these were PNG_DITHER_*_BITS\n * These migration aids will be removed from libpng-1.5.0.\n */\n#ifdef PNG_DITHER_RED_BITS\n#  define PNG_QUANTIZE_RED_BITS PNG_DITHER_RED_BITS\n#endif\n#ifdef PNG_DITHER_GREEN_BITS\n#  define PNG_QUANTIZE_GREEN_BITS PNG_DITHER_GREEN_BITS\n#endif\n#ifdef PNG_DITHER_BLUE_BITS\n#  define PNG_QUANTIZE_BLUE_BITS PNG_DITHER_BLUE_BITS\n#endif\n\n#ifndef PNG_QUANTIZE_RED_BITS\n#  define PNG_QUANTIZE_RED_BITS 5\n#endif\n#ifndef PNG_QUANTIZE_GREEN_BITS\n#  define PNG_QUANTIZE_GREEN_BITS 5\n#endif\n#ifndef PNG_QUANTIZE_BLUE_BITS\n#  define PNG_QUANTIZE_BLUE_BITS 5\n#endif\n\n/* This controls how fine the gamma correction becomes when you\n * are only interested in 8 bits anyway.  Increasing this value\n * results in more memory being used, and more pow() functions\n * being called to fill in the gamma tables.  Don't set this value\n * less then 8, and even that may not work (I haven't tested it).\n */\n\n#ifndef PNG_MAX_GAMMA_8\n#  define PNG_MAX_GAMMA_8 11\n#endif\n\n/* This controls how much a difference in gamma we can tolerate before\n * we actually start doing gamma conversion.\n */\n#ifndef PNG_GAMMA_THRESHOLD\n#  define PNG_GAMMA_THRESHOLD 0.05\n#endif\n\n/* The following uses const char * instead of char * for error\n * and warning message functions, so some compilers won't complain.\n * If you do not want to use const, define PNG_NO_CONST.\n */\n\n#ifndef PNG_CONST\n#  ifndef PNG_NO_CONST\n#    define PNG_CONST const\n#  else\n#    define PNG_CONST\n#  endif\n#endif\n\n/* The following defines give you the ability to remove code from the\n * library that you will not be using.  I wish I could figure out how to\n * automate this, but I can't do that without making it seriously hard\n * on the users.  So if you are not using an ability, change the #define\n * to an #undef, or pass in PNG_NO_feature and that part of the library\n * will not be compiled.\n\n * If your linker can't find a function, you may want to make sure the\n * ability is defined here.  Some of these depend upon some others being\n * defined.  I haven't figured out all the interactions here, so you may\n * have to experiment awhile to get everything to compile.  If you are\n * creating or using a shared library, you probably shouldn't touch this,\n * as it will affect the size of the structures, and this will cause bad\n * things to happen if the library and/or application ever change.\n */\n\n/* Any features you will not be using can be undef'ed here */\n\n/* GR-P, 0.96a: Set \"*TRANSFORMS_SUPPORTED as default but allow user\n * to turn it off with PNG_NO_READ|WRITE_TRANSFORMS on the compile line,\n * then pick and choose which ones to define without having to edit this\n * file. It is safe to use the PNG_NO_READ|WRITE_TRANSFORMS\n * if you only want to have a png-compliant reader/writer but don't need\n * any of the extra transformations.  This saves about 80 kbytes in a\n * typical installation of the library. (PNG_NO_* form added in version\n * 1.0.1c, for consistency; PNG_*_TRANSFORMS_NOT_SUPPORTED deprecated in\n * 1.4.0)\n */\n\n/* Ignore attempt to turn off both floating and fixed point support */\n#if !defined(PNG_FLOATING_POINT_SUPPORTED) || \\\n    !defined(PNG_NO_FIXED_POINT_SUPPORTED)\n#  define PNG_FIXED_POINT_SUPPORTED\n#endif\n\n#ifdef PNG_READ_SUPPORTED\n\n/* PNG_READ_TRANSFORMS_NOT_SUPPORTED is deprecated. */\n#if !defined(PNG_READ_TRANSFORMS_NOT_SUPPORTED) && \\\n      !defined(PNG_NO_READ_TRANSFORMS)\n#  define PNG_READ_TRANSFORMS_SUPPORTED\n#endif\n\n#ifdef PNG_READ_TRANSFORMS_SUPPORTED\n#  ifndef PNG_NO_READ_EXPAND\n#    define PNG_READ_EXPAND_SUPPORTED\n#  endif\n#  ifndef PNG_NO_READ_SHIFT\n#    define PNG_READ_SHIFT_SUPPORTED\n#  endif\n#  ifndef PNG_NO_READ_PACK\n#    define PNG_READ_PACK_SUPPORTED\n#  endif\n#  ifndef PNG_NO_READ_BGR\n#    define PNG_READ_BGR_SUPPORTED\n#  endif\n#  ifndef PNG_NO_READ_SWAP\n#    define PNG_READ_SWAP_SUPPORTED\n#  endif\n#  ifndef PNG_NO_READ_PACKSWAP\n#    define PNG_READ_PACKSWAP_SUPPORTED\n#  endif\n#  ifndef PNG_NO_READ_INVERT\n#    define PNG_READ_INVERT_SUPPORTED\n#  endif\n#  ifndef PNG_NO_READ_QUANTIZE\n     /* Prior to libpng-1.4.0 this was PNG_READ_DITHER_SUPPORTED */\n#    ifndef PNG_NO_READ_DITHER  /* This migration aid will be removed */\n#      define PNG_READ_QUANTIZE_SUPPORTED\n#    endif\n#  endif\n#  ifndef PNG_NO_READ_BACKGROUND\n#    define PNG_READ_BACKGROUND_SUPPORTED\n#  endif\n#  ifndef PNG_NO_READ_16_TO_8\n#    define PNG_READ_16_TO_8_SUPPORTED\n#  endif\n#  ifndef PNG_NO_READ_FILLER\n#    define PNG_READ_FILLER_SUPPORTED\n#  endif\n#  ifndef PNG_NO_READ_GAMMA\n#    define PNG_READ_GAMMA_SUPPORTED\n#  endif\n#  ifndef PNG_NO_READ_GRAY_TO_RGB\n#    define PNG_READ_GRAY_TO_RGB_SUPPORTED\n#  endif\n#  ifndef PNG_NO_READ_SWAP_ALPHA\n#    define PNG_READ_SWAP_ALPHA_SUPPORTED\n#  endif\n#  ifndef PNG_NO_READ_INVERT_ALPHA\n#    define PNG_READ_INVERT_ALPHA_SUPPORTED\n#  endif\n#  ifndef PNG_NO_READ_STRIP_ALPHA\n#    define PNG_READ_STRIP_ALPHA_SUPPORTED\n#  endif\n#  ifndef PNG_NO_READ_USER_TRANSFORM\n#    define PNG_READ_USER_TRANSFORM_SUPPORTED\n#  endif\n#  ifndef PNG_NO_READ_RGB_TO_GRAY\n#    define PNG_READ_RGB_TO_GRAY_SUPPORTED\n#  endif\n#endif /* PNG_READ_TRANSFORMS_SUPPORTED */\n\n/* PNG_PROGRESSIVE_READ_NOT_SUPPORTED is deprecated. */\n#if !defined(PNG_NO_PROGRESSIVE_READ) && \\\n !defined(PNG_PROGRESSIVE_READ_NOT_SUPPORTED)  /* if you don't do progressive */\n#  define PNG_PROGRESSIVE_READ_SUPPORTED     /* reading.  This is not talking */\n#endif                               /* about interlacing capability!  You'll */\n            /* still have interlacing unless you change the following define: */\n\n#define PNG_READ_INTERLACING_SUPPORTED /* required for PNG-compliant decoders */\n\n/* PNG_NO_SEQUENTIAL_READ_SUPPORTED is deprecated. */\n#if !defined(PNG_NO_SEQUENTIAL_READ) && \\\n    !defined(PNG_SEQUENTIAL_READ_SUPPORTED) && \\\n    !defined(PNG_NO_SEQUENTIAL_READ_SUPPORTED)\n#  define PNG_SEQUENTIAL_READ_SUPPORTED\n#endif\n\n#ifndef PNG_NO_READ_COMPOSITE_NODIV\n#  ifndef PNG_NO_READ_COMPOSITED_NODIV  /* libpng-1.0.x misspelling */\n#    define PNG_READ_COMPOSITE_NODIV_SUPPORTED   /* well tested on Intel, SGI */\n#  endif\n#endif\n\n#if !defined(PNG_NO_GET_INT_32) || defined(PNG_READ_oFFS_SUPPORTED) || \\\n    defined(PNG_READ_pCAL_SUPPORTED)\n#  ifndef PNG_GET_INT_32_SUPPORTED\n#    define PNG_GET_INT_32_SUPPORTED\n#  endif\n#endif\n\n#endif /* PNG_READ_SUPPORTED */\n\n#ifdef PNG_WRITE_SUPPORTED\n\n/* PNG_WRITE_TRANSFORMS_NOT_SUPPORTED is deprecated. */\n#if !defined(PNG_WRITE_TRANSFORMS_NOT_SUPPORTED) && \\\n    !defined(PNG_NO_WRITE_TRANSFORMS)\n#  define PNG_WRITE_TRANSFORMS_SUPPORTED\n#endif\n\n#ifdef PNG_WRITE_TRANSFORMS_SUPPORTED\n#  ifndef PNG_NO_WRITE_SHIFT\n#    define PNG_WRITE_SHIFT_SUPPORTED\n#  endif\n#  ifndef PNG_NO_WRITE_PACK\n#    define PNG_WRITE_PACK_SUPPORTED\n#  endif\n#  ifndef PNG_NO_WRITE_BGR\n#    define PNG_WRITE_BGR_SUPPORTED\n#  endif\n#  ifndef PNG_NO_WRITE_SWAP\n#    define PNG_WRITE_SWAP_SUPPORTED\n#  endif\n#  ifndef PNG_NO_WRITE_PACKSWAP\n#    define PNG_WRITE_PACKSWAP_SUPPORTED\n#  endif\n#  ifndef PNG_NO_WRITE_INVERT\n#    define PNG_WRITE_INVERT_SUPPORTED\n#  endif\n#  ifndef PNG_NO_WRITE_FILLER\n#    define PNG_WRITE_FILLER_SUPPORTED   /* same as WRITE_STRIP_ALPHA */\n#  endif\n#  ifndef PNG_NO_WRITE_SWAP_ALPHA\n#    define PNG_WRITE_SWAP_ALPHA_SUPPORTED\n#  endif\n#  ifndef PNG_NO_WRITE_INVERT_ALPHA\n#    define PNG_WRITE_INVERT_ALPHA_SUPPORTED\n#  endif\n#  ifndef PNG_NO_WRITE_USER_TRANSFORM\n#    define PNG_WRITE_USER_TRANSFORM_SUPPORTED\n#  endif\n#endif /* PNG_WRITE_TRANSFORMS_SUPPORTED */\n\n#if !defined(PNG_NO_WRITE_INTERLACING_SUPPORTED) && \\\n    !defined(PNG_WRITE_INTERLACING_SUPPORTED)\n    /* This is not required for PNG-compliant encoders, but can cause\n     * trouble if left undefined\n    */\n#  define PNG_WRITE_INTERLACING_SUPPORTED\n#endif\n\n#if !defined(PNG_NO_WRITE_WEIGHTED_FILTER) && \\\n    !defined(PNG_WRITE_WEIGHTED_FILTER) && \\\n     defined(PNG_FLOATING_POINT_SUPPORTED)\n#  define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED\n#endif\n\n#ifndef PNG_NO_WRITE_FLUSH\n#  define PNG_WRITE_FLUSH_SUPPORTED\n#endif\n\n#if !defined(PNG_NO_SAVE_INT_32) || defined(PNG_WRITE_oFFS_SUPPORTED) || \\\n    defined(PNG_WRITE_pCAL_SUPPORTED)\n#  ifndef PNG_SAVE_INT_32_SUPPORTED\n#    define PNG_SAVE_INT_32_SUPPORTED\n#  endif\n#endif\n\n#endif /* PNG_WRITE_SUPPORTED */\n\n#define PNG_NO_ERROR_NUMBERS\n\n#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \\\n    defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)\n#  ifndef PNG_NO_USER_TRANSFORM_PTR\n#    define PNG_USER_TRANSFORM_PTR_SUPPORTED\n#  endif\n#endif\n\n#if defined(PNG_STDIO_SUPPORTED) && !defined(PNG_TIME_RFC1123_SUPPORTED)\n#  define PNG_TIME_RFC1123_SUPPORTED\n#endif\n\n/* This adds extra functions in pngget.c for accessing data from the\n * info pointer (added in version 0.99)\n * png_get_image_width()\n * png_get_image_height()\n * png_get_bit_depth()\n * png_get_color_type()\n * png_get_compression_type()\n * png_get_filter_type()\n * png_get_interlace_type()\n * png_get_pixel_aspect_ratio()\n * png_get_pixels_per_meter()\n * png_get_x_offset_pixels()\n * png_get_y_offset_pixels()\n * png_get_x_offset_microns()\n * png_get_y_offset_microns()\n */\n#if !defined(PNG_NO_EASY_ACCESS) && !defined(PNG_EASY_ACCESS_SUPPORTED)\n#  define PNG_EASY_ACCESS_SUPPORTED\n#endif\n\n/* Added at libpng-1.2.0 */\n#if !defined(PNG_NO_USER_MEM) && !defined(PNG_USER_MEM_SUPPORTED)\n#  define PNG_USER_MEM_SUPPORTED\n#endif\n\n/* Added at libpng-1.2.6 */\n#ifndef PNG_NO_SET_USER_LIMITS\n#  ifndef PNG_SET_USER_LIMITS_SUPPORTED\n#    define PNG_SET_USER_LIMITS_SUPPORTED\n#  endif\n  /* Feature added at libpng-1.4.0, this flag added at 1.4.1 */\n#  ifndef PNG_SET_CHUNK_CACHE_LIMIT_SUPPORTED\n#    define PNG_SET_CHUNK_CACHE_LIMIT_SUPPORTED\n#  endif\n  /* Feature added at libpng-1.4.1, this flag added at 1.4.1 */\n#  ifndef PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED\n#    define PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED\n#  endif\n#endif\n\n/* Added at libpng-1.2.43 */\n#ifndef PNG_USER_LIMITS_SUPPORTED\n#  ifndef PNG_NO_USER_LIMITS\n#    define PNG_USER_LIMITS_SUPPORTED\n#  endif\n#endif\n\n/* Added at libpng-1.0.16 and 1.2.6.  To accept all valid PNGs no matter\n * how large, set these two limits to 0x7fffffffL\n */\n#ifndef PNG_USER_WIDTH_MAX\n#  define PNG_USER_WIDTH_MAX 1000000L\n#endif\n#ifndef PNG_USER_HEIGHT_MAX\n#  define PNG_USER_HEIGHT_MAX 1000000L\n#endif\n\n/* Added at libpng-1.2.43.  To accept all valid PNGs no matter\n * how large, set these two limits to 0.\n */\n#ifndef PNG_USER_CHUNK_CACHE_MAX\n#  define PNG_USER_CHUNK_CACHE_MAX 32767\n#endif\n\n/* Added at libpng-1.2.43 */\n#ifndef PNG_USER_CHUNK_MALLOC_MAX\n#  define PNG_USER_CHUNK_MALLOC_MAX 8000000\n#endif\n\n/* Added at libpng-1.4.0 */\n#if !defined(PNG_NO_IO_STATE) && !defined(PNG_IO_STATE_SUPPORTED)\n#  define PNG_IO_STATE_SUPPORTED\n#endif\n\n#ifndef PNG_LITERAL_SHARP\n#  define PNG_LITERAL_SHARP 0x23\n#endif\n#ifndef PNG_LITERAL_LEFT_SQUARE_BRACKET\n#  define PNG_LITERAL_LEFT_SQUARE_BRACKET 0x5b\n#endif\n#ifndef PNG_LITERAL_RIGHT_SQUARE_BRACKET\n#  define PNG_LITERAL_RIGHT_SQUARE_BRACKET 0x5d\n#endif\n#ifndef PNG_STRING_NEWLINE\n#define PNG_STRING_NEWLINE \"\\n\"\n#endif\n\n/* These are currently experimental features, define them if you want */\n\n/* Very little testing */\n/*\n#ifdef PNG_READ_SUPPORTED\n#  ifndef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED\n#    define PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED\n#  endif\n#endif\n*/\n\n/* This is only for PowerPC big-endian and 680x0 systems */\n/* some testing */\n/*\n#ifndef PNG_READ_BIG_ENDIAN_SUPPORTED\n#  define PNG_READ_BIG_ENDIAN_SUPPORTED\n#endif\n*/\n\n#if !defined(PNG_NO_USE_READ_MACROS) && !defined(PNG_USE_READ_MACROS)\n#  define PNG_USE_READ_MACROS\n#endif\n\n/* Buggy compilers (e.g., gcc 2.7.2.2) need PNG_NO_POINTER_INDEXING */\n\n#if !defined(PNG_NO_POINTER_INDEXING) && \\\n    !defined(PNG_POINTER_INDEXING_SUPPORTED)\n#  define PNG_POINTER_INDEXING_SUPPORTED\n#endif\n\n\n/* Any chunks you are not interested in, you can undef here.  The\n * ones that allocate memory may be expecially important (hIST,\n * tEXt, zTXt, tRNS, pCAL).  Others will just save time and make png_info\n * a bit smaller.\n */\n\n/* The size of the png_text structure changed in libpng-1.0.6 when\n * iTXt support was added.  iTXt support was turned off by default through\n * libpng-1.2.x, to support old apps that malloc the png_text structure\n * instead of calling png_set_text() and letting libpng malloc it.  It\n * was turned on by default in libpng-1.4.0.\n */\n\n/* PNG_READ_ANCILLARY_CHUNKS_NOT_SUPPORTED is deprecated. */\n#if defined(PNG_READ_SUPPORTED) && \\\n    !defined(PNG_READ_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \\\n    !defined(PNG_NO_READ_ANCILLARY_CHUNKS)\n#  define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED\n#endif\n\n/* PNG_WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED is deprecated. */\n#if defined(PNG_WRITE_SUPPORTED) && \\\n    !defined(PNG_WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \\\n    !defined(PNG_NO_WRITE_ANCILLARY_CHUNKS)\n#  define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED\n#endif\n\n#ifdef PNG_READ_ANCILLARY_CHUNKS_SUPPORTED\n\n#ifdef PNG_NO_READ_TEXT\n#  define PNG_NO_READ_iTXt\n#  define PNG_NO_READ_tEXt\n#  define PNG_NO_READ_zTXt\n#endif\n\n#ifndef PNG_NO_READ_bKGD\n#  define PNG_READ_bKGD_SUPPORTED\n#  define PNG_bKGD_SUPPORTED\n#endif\n#ifndef PNG_NO_READ_cHRM\n#  define PNG_READ_cHRM_SUPPORTED\n#  define PNG_cHRM_SUPPORTED\n#endif\n#ifndef PNG_NO_READ_gAMA\n#  define PNG_READ_gAMA_SUPPORTED\n#  define PNG_gAMA_SUPPORTED\n#endif\n#ifndef PNG_NO_READ_hIST\n#  define PNG_READ_hIST_SUPPORTED\n#  define PNG_hIST_SUPPORTED\n#endif\n#ifndef PNG_NO_READ_iCCP\n#  define PNG_READ_iCCP_SUPPORTED\n#  define PNG_iCCP_SUPPORTED\n#endif\n#ifndef PNG_NO_READ_iTXt\n#  ifndef PNG_READ_iTXt_SUPPORTED\n#    define PNG_READ_iTXt_SUPPORTED\n#  endif\n#  ifndef PNG_iTXt_SUPPORTED\n#    define PNG_iTXt_SUPPORTED\n#  endif\n#endif\n#ifndef PNG_NO_READ_oFFs\n#  define PNG_READ_oFFs_SUPPORTED\n#  define PNG_oFFs_SUPPORTED\n#endif\n#ifndef PNG_NO_READ_pCAL\n#  define PNG_READ_pCAL_SUPPORTED\n#  define PNG_pCAL_SUPPORTED\n#endif\n#ifndef PNG_NO_READ_sCAL\n#  define PNG_READ_sCAL_SUPPORTED\n#  define PNG_sCAL_SUPPORTED\n#endif\n#ifndef PNG_NO_READ_pHYs\n#  define PNG_READ_pHYs_SUPPORTED\n#  define PNG_pHYs_SUPPORTED\n#endif\n#ifndef PNG_NO_READ_sBIT\n#  define PNG_READ_sBIT_SUPPORTED\n#  define PNG_sBIT_SUPPORTED\n#endif\n#ifndef PNG_NO_READ_sPLT\n#  define PNG_READ_sPLT_SUPPORTED\n#  define PNG_sPLT_SUPPORTED\n#endif\n#ifndef PNG_NO_READ_sRGB\n#  define PNG_READ_sRGB_SUPPORTED\n#  define PNG_sRGB_SUPPORTED\n#endif\n#ifndef PNG_NO_READ_tEXt\n#  define PNG_READ_tEXt_SUPPORTED\n#  define PNG_tEXt_SUPPORTED\n#endif\n#ifndef PNG_NO_READ_tIME\n#  define PNG_READ_tIME_SUPPORTED\n#  define PNG_tIME_SUPPORTED\n#endif\n#ifndef PNG_NO_READ_tRNS\n#  define PNG_READ_tRNS_SUPPORTED\n#  define PNG_tRNS_SUPPORTED\n#endif\n#ifndef PNG_NO_READ_zTXt\n#  define PNG_READ_zTXt_SUPPORTED\n#  define PNG_zTXt_SUPPORTED\n#endif\n#ifndef PNG_NO_READ_OPT_PLTE\n#  define PNG_READ_OPT_PLTE_SUPPORTED /* only affects support of the */\n#endif                      /* optional PLTE chunk in RGB and RGBA images */\n#if defined(PNG_READ_iTXt_SUPPORTED) || defined(PNG_READ_tEXt_SUPPORTED) || \\\n    defined(PNG_READ_zTXt_SUPPORTED)\n#  define PNG_READ_TEXT_SUPPORTED\n#  define PNG_TEXT_SUPPORTED\n#endif\n\n#endif /* PNG_READ_ANCILLARY_CHUNKS_SUPPORTED */\n\n#ifndef PNG_NO_READ_UNKNOWN_CHUNKS\n#  ifndef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED\n#    define PNG_READ_UNKNOWN_CHUNKS_SUPPORTED\n#  endif\n#  ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED\n#    define PNG_UNKNOWN_CHUNKS_SUPPORTED\n#  endif\n#  ifndef PNG_READ_USER_CHUNKS_SUPPORTED\n#    define PNG_READ_USER_CHUNKS_SUPPORTED\n#  endif\n#endif\n#ifndef PNG_NO_READ_USER_CHUNKS\n#  ifndef PNG_READ_USER_CHUNKS_SUPPORTED\n#    define PNG_READ_USER_CHUNKS_SUPPORTED\n#  endif\n#  ifndef PNG_USER_CHUNKS_SUPPORTED\n#    define PNG_USER_CHUNKS_SUPPORTED\n#  endif\n#endif\n#ifndef PNG_NO_HANDLE_AS_UNKNOWN\n#  ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED\n#    define PNG_HANDLE_AS_UNKNOWN_SUPPORTED\n#  endif\n#endif\n\n#ifdef PNG_WRITE_SUPPORTED\n#ifdef PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED\n\n#ifdef PNG_NO_WRITE_TEXT\n#  define PNG_NO_WRITE_iTXt\n#  define PNG_NO_WRITE_tEXt\n#  define PNG_NO_WRITE_zTXt\n#endif\n#ifndef PNG_NO_WRITE_bKGD\n#  define PNG_WRITE_bKGD_SUPPORTED\n#  ifndef PNG_bKGD_SUPPORTED\n#    define PNG_bKGD_SUPPORTED\n#  endif\n#endif\n#ifndef PNG_NO_WRITE_cHRM\n#  define PNG_WRITE_cHRM_SUPPORTED\n#  ifndef PNG_cHRM_SUPPORTED\n#    define PNG_cHRM_SUPPORTED\n#  endif\n#endif\n#ifndef PNG_NO_WRITE_gAMA\n#  define PNG_WRITE_gAMA_SUPPORTED\n#  ifndef PNG_gAMA_SUPPORTED\n#    define PNG_gAMA_SUPPORTED\n#  endif\n#endif\n#ifndef PNG_NO_WRITE_hIST\n#  define PNG_WRITE_hIST_SUPPORTED\n#  ifndef PNG_hIST_SUPPORTED\n#    define PNG_hIST_SUPPORTED\n#  endif\n#endif\n#ifndef PNG_NO_WRITE_iCCP\n#  define PNG_WRITE_iCCP_SUPPORTED\n#  ifndef PNG_iCCP_SUPPORTED\n#    define PNG_iCCP_SUPPORTED\n#  endif\n#endif\n#ifndef PNG_NO_WRITE_iTXt\n#  ifndef PNG_WRITE_iTXt_SUPPORTED\n#    define PNG_WRITE_iTXt_SUPPORTED\n#  endif\n#  ifndef PNG_iTXt_SUPPORTED\n#    define PNG_iTXt_SUPPORTED\n#  endif\n#endif\n#ifndef PNG_NO_WRITE_oFFs\n#  define PNG_WRITE_oFFs_SUPPORTED\n#  ifndef PNG_oFFs_SUPPORTED\n#    define PNG_oFFs_SUPPORTED\n#  endif\n#endif\n#ifndef PNG_NO_WRITE_pCAL\n#  define PNG_WRITE_pCAL_SUPPORTED\n#  ifndef PNG_pCAL_SUPPORTED\n#    define PNG_pCAL_SUPPORTED\n#  endif\n#endif\n#ifndef PNG_NO_WRITE_sCAL\n#  define PNG_WRITE_sCAL_SUPPORTED\n#  ifndef PNG_sCAL_SUPPORTED\n#    define PNG_sCAL_SUPPORTED\n#  endif\n#endif\n#ifndef PNG_NO_WRITE_pHYs\n#  define PNG_WRITE_pHYs_SUPPORTED\n#  ifndef PNG_pHYs_SUPPORTED\n#    define PNG_pHYs_SUPPORTED\n#  endif\n#endif\n#ifndef PNG_NO_WRITE_sBIT\n#  define PNG_WRITE_sBIT_SUPPORTED\n#  ifndef PNG_sBIT_SUPPORTED\n#    define PNG_sBIT_SUPPORTED\n#  endif\n#endif\n#ifndef PNG_NO_WRITE_sPLT\n#  define PNG_WRITE_sPLT_SUPPORTED\n#  ifndef PNG_sPLT_SUPPORTED\n#    define PNG_sPLT_SUPPORTED\n#  endif\n#endif\n#ifndef PNG_NO_WRITE_sRGB\n#  define PNG_WRITE_sRGB_SUPPORTED\n#  ifndef PNG_sRGB_SUPPORTED\n#    define PNG_sRGB_SUPPORTED\n#  endif\n#endif\n#ifndef PNG_NO_WRITE_tEXt\n#  define PNG_WRITE_tEXt_SUPPORTED\n#  ifndef PNG_tEXt_SUPPORTED\n#    define PNG_tEXt_SUPPORTED\n#  endif\n#endif\n#ifndef PNG_NO_WRITE_tIME\n#  define PNG_WRITE_tIME_SUPPORTED\n#  ifndef PNG_tIME_SUPPORTED\n#    define PNG_tIME_SUPPORTED\n#  endif\n#endif\n#ifndef PNG_NO_WRITE_tRNS\n#  define PNG_WRITE_tRNS_SUPPORTED\n#  ifndef PNG_tRNS_SUPPORTED\n#    define PNG_tRNS_SUPPORTED\n#  endif\n#endif\n#ifndef PNG_NO_WRITE_zTXt\n#  define PNG_WRITE_zTXt_SUPPORTED\n#  ifndef PNG_zTXt_SUPPORTED\n#    define PNG_zTXt_SUPPORTED\n#  endif\n#endif\n#if defined(PNG_WRITE_iTXt_SUPPORTED) || defined(PNG_WRITE_tEXt_SUPPORTED) || \\\n    defined(PNG_WRITE_zTXt_SUPPORTED)\n#  define PNG_WRITE_TEXT_SUPPORTED\n#  ifndef PNG_TEXT_SUPPORTED\n#    define PNG_TEXT_SUPPORTED\n#  endif\n#endif\n\n#ifdef PNG_WRITE_tIME_SUPPORTED\n#  ifndef PNG_NO_CONVERT_tIME\n#    ifndef _WIN32_WCE\n/*   The \"tm\" structure is not supported on WindowsCE */\n#      ifndef PNG_CONVERT_tIME_SUPPORTED\n#        define PNG_CONVERT_tIME_SUPPORTED\n#      endif\n#   endif\n#  endif\n#endif\n\n#endif /* PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED */\n\n#ifndef PNG_NO_WRITE_FILTER\n#  ifndef PNG_WRITE_FILTER_SUPPORTED\n#    define PNG_WRITE_FILTER_SUPPORTED\n#  endif\n#endif\n\n#ifndef PNG_NO_WRITE_UNKNOWN_CHUNKS\n#  define PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED\n#  ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED\n#    define PNG_UNKNOWN_CHUNKS_SUPPORTED\n#  endif\n#endif\n#ifndef PNG_NO_HANDLE_AS_UNKNOWN\n#  ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED\n#    define PNG_HANDLE_AS_UNKNOWN_SUPPORTED\n#  endif\n#endif\n#endif /* PNG_WRITE_SUPPORTED */\n\n/* Turn this off to disable png_read_png() and\n * png_write_png() and leave the row_pointers member\n * out of the info structure.\n */\n#ifndef PNG_NO_INFO_IMAGE\n#  define PNG_INFO_IMAGE_SUPPORTED\n#endif\n\n/* Need the time information for converting tIME chunks */\n#ifdef PNG_CONVERT_tIME_SUPPORTED\n     /* \"time.h\" functions are not supported on WindowsCE */\n#    include <time.h>\n#endif\n\n/* Some typedefs to get us started.  These should be safe on most of the\n * common platforms.  The typedefs should be at least as large as the\n * numbers suggest (a png_uint_32 must be at least 32 bits long), but they\n * don't have to be exactly that size.  Some compilers dislike passing\n * unsigned shorts as function parameters, so you may be better off using\n * unsigned int for png_uint_16.\n */\n\n#if defined(INT_MAX) && (INT_MAX > 0x7ffffffeL)\ntypedef unsigned int png_uint_32;\ntypedef int png_int_32;\n#else\ntypedef unsigned long png_uint_32;\ntypedef long png_int_32;\n#endif\ntypedef unsigned short png_uint_16;\ntypedef short png_int_16;\ntypedef unsigned char png_byte;\n\n#ifdef PNG_NO_SIZE_T\n   typedef unsigned int png_size_t;\n#else\n   typedef size_t png_size_t;\n#endif\n#define png_sizeof(x) (sizeof (x))\n\n/* The following is needed for medium model support.  It cannot be in the\n * pngpriv.h header.  Needs modification for other compilers besides\n * MSC.  Model independent support declares all arrays and pointers to be\n * large using the far keyword.  The zlib version used must also support\n * model independent data.  As of version zlib 1.0.4, the necessary changes\n * have been made in zlib.  The USE_FAR_KEYWORD define triggers other\n * changes that are needed. (Tim Wegner)\n */\n\n/* Separate compiler dependencies (problem here is that zlib.h always\n * defines FAR. (SJT)\n */\n#ifdef __BORLANDC__\n#  if defined(__LARGE__) || defined(__HUGE__) || defined(__COMPACT__)\n#    define LDATA 1\n#  else\n#    define LDATA 0\n#  endif\n   /* GRR:  why is Cygwin in here?  Cygwin is not Borland C... */\n#  if !defined(__WIN32__) && !defined(__FLAT__) && !defined(__CYGWIN__)\n#    define PNG_MAX_MALLOC_64K\n#    if (LDATA != 1)\n#      ifndef FAR\n#        define FAR __far\n#      endif\n#      define USE_FAR_KEYWORD\n#    endif   /* LDATA != 1 */\n     /* Possibly useful for moving data out of default segment.\n      * Uncomment it if you want. Could also define FARDATA as\n      * const if your compiler supports it. (SJT)\n#    define FARDATA FAR\n      */\n#  endif  /* __WIN32__, __FLAT__, __CYGWIN__ */\n#endif   /* __BORLANDC__ */\n\n\n/* Suggest testing for specific compiler first before testing for\n * FAR.  The Watcom compiler defines both __MEDIUM__ and M_I86MM,\n * making reliance oncertain keywords suspect. (SJT)\n */\n\n/* MSC Medium model */\n#ifdef FAR\n#  ifdef M_I86MM\n#    define USE_FAR_KEYWORD\n#    define FARDATA FAR\n#    include <dos.h>\n#  endif\n#endif\n\n/* SJT: default case */\n#ifndef FAR\n#  define FAR\n#endif\n\n/* At this point FAR is always defined */\n#ifndef FARDATA\n#  define FARDATA\n#endif\n\n/* Typedef for floating-point numbers that are converted\n   to fixed-point with a multiple of 100,000, e.g., int_gamma */\ntypedef png_int_32 png_fixed_point;\n\n/* Add typedefs for pointers */\ntypedef void            FAR * png_voidp;\ntypedef png_byte        FAR * png_bytep;\ntypedef png_uint_32     FAR * png_uint_32p;\ntypedef png_int_32      FAR * png_int_32p;\ntypedef png_uint_16     FAR * png_uint_16p;\ntypedef png_int_16      FAR * png_int_16p;\ntypedef PNG_CONST char  FAR * png_const_charp;\ntypedef char            FAR * png_charp;\ntypedef png_fixed_point FAR * png_fixed_point_p;\n\n#ifndef PNG_NO_STDIO\ntypedef FILE                * png_FILE_p;\n#endif\n\n#ifdef PNG_FLOATING_POINT_SUPPORTED\ntypedef double          FAR * png_doublep;\n#endif\n\n/* Pointers to pointers; i.e. arrays */\ntypedef png_byte        FAR * FAR * png_bytepp;\ntypedef png_uint_32     FAR * FAR * png_uint_32pp;\ntypedef png_int_32      FAR * FAR * png_int_32pp;\ntypedef png_uint_16     FAR * FAR * png_uint_16pp;\ntypedef png_int_16      FAR * FAR * png_int_16pp;\ntypedef PNG_CONST char  FAR * FAR * png_const_charpp;\ntypedef char            FAR * FAR * png_charpp;\ntypedef png_fixed_point FAR * FAR * png_fixed_point_pp;\n#ifdef PNG_FLOATING_POINT_SUPPORTED\ntypedef double          FAR * FAR * png_doublepp;\n#endif\n\n/* Pointers to pointers to pointers; i.e., pointer to array */\ntypedef char            FAR * FAR * FAR * png_charppp;\n\n/* Define PNG_BUILD_DLL if the module being built is a Windows\n * LIBPNG DLL.\n *\n * Define PNG_USE_DLL if you want to *link* to the Windows LIBPNG DLL.\n * It is equivalent to Microsoft predefined macro _DLL that is\n * automatically defined when you compile using the share\n * version of the CRT (C Run-Time library)\n *\n * The cygwin mods make this behavior a little different:\n * Define PNG_BUILD_DLL if you are building a dll for use with cygwin\n * Define PNG_STATIC if you are building a static library for use with cygwin,\n *   -or- if you are building an application that you want to link to the\n *   static library.\n * PNG_USE_DLL is defined by default (no user action needed) unless one of\n *   the other flags is defined.\n */\n\n#if !defined(PNG_DLL) && (defined(PNG_BUILD_DLL) || defined(PNG_USE_DLL))\n#  define PNG_DLL\n#endif\n\n/* If you define PNGAPI, e.g., with compiler option \"-DPNGAPI=__stdcall\",\n * you may get warnings regarding the linkage of png_zalloc and png_zfree.\n * Don't ignore those warnings; you must also reset the default calling\n * convention in your compiler to match your PNGAPI, and you must build\n * zlib and your applications the same way you build libpng.\n */\n\n#ifdef __CYGWIN__\n#  undef PNGAPI\n#  define PNGAPI __cdecl\n#  undef PNG_IMPEXP\n#  define PNG_IMPEXP\n#endif\n\n#ifdef __WATCOMC__\n#  ifndef PNGAPI\n#    define PNGAPI\n#  endif\n#endif\n\n#if defined(__MINGW32__) && !defined(PNG_MODULEDEF)\n#  ifndef PNG_NO_MODULEDEF\n#    define PNG_NO_MODULEDEF\n#  endif\n#endif\n\n#if !defined(PNG_IMPEXP) && defined(PNG_BUILD_DLL) && !defined(PNG_NO_MODULEDEF)\n#  define PNG_IMPEXP\n#endif\n\n#if defined(PNG_DLL) || defined(_DLL) || defined(__DLL__ ) || \\\n    (( defined(_Windows) || defined(_WINDOWS) || \\\n       defined(WIN32) || defined(_WIN32) || defined(__WIN32__) ))\n\n#  ifndef PNGAPI\n#     if defined(__GNUC__) || (defined (_MSC_VER) && (_MSC_VER >= 800))\n#        define PNGAPI __cdecl\n#     else\n#        define PNGAPI _cdecl\n#     endif\n#  endif\n\n#  if !defined(PNG_IMPEXP) && (!defined(PNG_DLL) || \\\n       0 /* WINCOMPILER_WITH_NO_SUPPORT_FOR_DECLIMPEXP */)\n#     define PNG_IMPEXP\n#  endif\n\n#  ifndef PNG_IMPEXP\n\n#    define PNG_EXPORT_TYPE1(type,symbol)  PNG_IMPEXP type PNGAPI symbol\n#    define PNG_EXPORT_TYPE2(type,symbol)  type PNG_IMPEXP PNGAPI symbol\n\n     /* Borland/Microsoft */\n#    if defined(_MSC_VER) || defined(__BORLANDC__)\n#      if (_MSC_VER >= 800) || (__BORLANDC__ >= 0x500)\n#         define PNG_EXPORT PNG_EXPORT_TYPE1\n#      else\n#         define PNG_EXPORT PNG_EXPORT_TYPE2\n#         ifdef PNG_BUILD_DLL\n#            define PNG_IMPEXP __export\n#         else\n#            define PNG_IMPEXP /*__import */ /* doesn't exist AFAIK in VC++ */\n#         endif                              /* Exists in Borland C++ for\n                                                C++ classes (== huge) */\n#      endif\n#    endif\n\n#    ifndef PNG_IMPEXP\n#      ifdef PNG_BUILD_DLL\n#        define PNG_IMPEXP __declspec(dllexport)\n#      else\n#        define PNG_IMPEXP __declspec(dllimport)\n#      endif\n#    endif\n#  endif  /* PNG_IMPEXP */\n#else /* !(DLL || non-cygwin WINDOWS) */\n#   if (defined(__IBMC__) || defined(__IBMCPP__)) && defined(__OS2__)\n#     ifndef PNGAPI\n#       define PNGAPI _System\n#     endif\n#   else\n#     if 0 /* ... other platforms, with other meanings */\n#     endif\n#   endif\n#endif\n\n#ifndef PNGAPI\n#  define PNGAPI\n#endif\n#ifndef PNG_IMPEXP\n#  define PNG_IMPEXP\n#endif\n\n#ifdef PNG_BUILDSYMS\n#  ifndef PNG_EXPORT\n#    define PNG_EXPORT(type,symbol) PNG_FUNCTION_EXPORT symbol END\n#  endif\n#endif\n\n#ifndef PNG_EXPORT\n#  define PNG_EXPORT(type,symbol) PNG_IMPEXP type PNGAPI symbol\n#endif\n\n#define PNG_USE_LOCAL_ARRAYS /* Not used in libpng, defined for legacy apps */\n\n/* Support for compiler specific function attributes.  These are used\n * so that where compiler support is available incorrect use of API\n * functions in png.h will generate compiler warnings.\n *\n * Added at libpng-1.2.41.\n */\n\n#ifndef PNG_NO_PEDANTIC_WARNINGS\n#  ifndef PNG_PEDANTIC_WARNINGS_SUPPORTED\n#    define PNG_PEDANTIC_WARNINGS_SUPPORTED\n#  endif\n#endif\n\n#ifdef PNG_PEDANTIC_WARNINGS_SUPPORTED\n/* Support for compiler specific function attributes.  These are used\n * so that where compiler support is available incorrect use of API\n * functions in png.h will generate compiler warnings.  Added at libpng\n * version 1.2.41.\n */\n#  ifdef __GNUC__\n#    ifndef PNG_USE_RESULT\n#      define PNG_USE_RESULT __attribute__((__warn_unused_result__))\n#    endif\n#    ifndef PNG_NORETURN\n#      define PNG_NORETURN   __attribute__((__noreturn__))\n#    endif\n#    if __GNUC__ >= 3\n#      ifndef PNG_ALLOCATED\n#        define PNG_ALLOCATED  __attribute__((__malloc__))\n#      endif\n#      ifndef PNG_DEPRECATED\n#        define PNG_DEPRECATED __attribute__((__deprecated__))\n#      endif\n#      ifndef PNG_PRIVATE\n#        if 0 /* Doesn't work so we use deprecated instead*/\n#          define PNG_PRIVATE \\\n            __attribute__((warning(\"This function is not exported by libpng.\")))\n#        else\n#          define PNG_PRIVATE \\\n            __attribute__((__deprecated__))\n#        endif\n#      endif\n#    endif /*  __GNUC__ >= 3 */\n#  endif /* __GNUC__ */\n#endif /* PNG_PEDANTIC_WARNINGS */\n\n#ifndef PNG_DEPRECATED\n#  define PNG_DEPRECATED  /* Use of this function is deprecated */\n#endif\n#ifndef PNG_USE_RESULT\n#  define PNG_USE_RESULT  /* The result of this function must be checked */\n#endif\n#ifndef PNG_NORETURN\n#  define PNG_NORETURN    /* This function does not return */\n#endif\n#ifndef PNG_ALLOCATED\n#  define PNG_ALLOCATED   /* The result of the function is new memory */\n#endif\n#ifndef PNG_DEPSTRUCT\n#  define PNG_DEPSTRUCT   /* Access to this struct member is deprecated */\n#endif\n#ifndef PNG_PRIVATE\n#  define PNG_PRIVATE     /* This is a private libpng function */\n#endif\n\n/* Users may want to use these so they are not private.  Any library\n * functions that are passed far data must be model-independent.\n */\n\n/* memory model/platform independent fns */\n#ifndef PNG_ABORT\n#  if (defined(_Windows) || defined(_WINDOWS) || defined(_WINDOWS_))\n#     define PNG_ABORT() ExitProcess(0)\n#  else\n#     define PNG_ABORT() abort()\n#  endif\n#endif\n\n#ifdef USE_FAR_KEYWORD\n/* Use this to make far-to-near assignments */\n#  define CHECK   1\n#  define NOCHECK 0\n#  define CVT_PTR(ptr) (png_far_to_near(png_ptr,ptr,CHECK))\n#  define CVT_PTR_NOCHECK(ptr) (png_far_to_near(png_ptr,ptr,NOCHECK))\n#  define png_strcpy  _fstrcpy\n#  define png_strncpy _fstrncpy   /* Added to v 1.2.6 */\n#  define png_strlen  _fstrlen\n#  define png_memcmp  _fmemcmp    /* SJT: added */\n#  define png_memcpy  _fmemcpy\n#  define png_memset  _fmemset\n#  define png_sprintf sprintf\n#else\n#  if (defined(_Windows) || defined(_WINDOWS) || defined(_WINDOWS_))\n#    /* Favor Windows over C runtime fns */\n#    define CVT_PTR(ptr)         (ptr)\n#    define CVT_PTR_NOCHECK(ptr) (ptr)\n#    define png_strcpy  lstrcpyA\n#    define png_strncpy lstrcpynA\n#    define png_strlen  lstrlenA\n#    define png_memcmp  memcmp\n#    define png_memcpy  memcpy\n#    define png_memset  memset\n#    define png_sprintf wsprintfA\n#  else\n#    define CVT_PTR(ptr)         (ptr)\n#    define CVT_PTR_NOCHECK(ptr) (ptr)\n#    define png_strcpy  strcpy\n#    define png_strncpy strncpy     /* Added to v 1.2.6 */\n#    define png_strlen  strlen\n#    define png_memcmp  memcmp      /* SJT: added */\n#    define png_memcpy  memcpy\n#    define png_memset  memset\n#    define png_sprintf sprintf\n#  endif\n#endif\n\n#ifndef PNG_NO_SNPRINTF\n#  ifdef _MSC_VER\n#    define png_snprintf _snprintf   /* Added to v 1.2.19 */\n#    define png_snprintf2 _snprintf\n#    define png_snprintf6 _snprintf\n#  else\n#    define png_snprintf snprintf   /* Added to v 1.2.19 */\n#    define png_snprintf2 snprintf\n#    define png_snprintf6 snprintf\n#  endif\n#else\n   /* You don't have or don't want to use snprintf().  Caution: Using\n    * sprintf instead of snprintf exposes your application to accidental\n    * or malevolent buffer overflows.  If you don't have snprintf()\n    * as a general rule you should provide one (you can get one from\n    * Portable OpenSSH).\n    */\n#  define png_snprintf(s1,n,fmt,x1) png_sprintf(s1,fmt,x1)\n#  define png_snprintf2(s1,n,fmt,x1,x2) png_sprintf(s1,fmt,x1,x2)\n#  define png_snprintf6(s1,n,fmt,x1,x2,x3,x4,x5,x6) \\\n      png_sprintf(s1,fmt,x1,x2,x3,x4,x5,x6)\n#endif\n\n/* png_alloc_size_t is guaranteed to be no smaller than png_size_t,\n * and no smaller than png_uint_32.  Casts from png_size_t or png_uint_32\n * to png_alloc_size_t are not necessary; in fact, it is recommended\n * not to use them at all so that the compiler can complain when something\n * turns out to be problematic.\n * Casts in the other direction (from png_alloc_size_t to png_size_t or\n * png_uint_32) should be explicitly applied; however, we do not expect\n * to encounter practical situations that require such conversions.\n */\n#if defined(__TURBOC__) && !defined(__FLAT__)\n   typedef unsigned long png_alloc_size_t;\n#else\n#  if defined(_MSC_VER) && defined(MAXSEG_64K)\n     typedef unsigned long    png_alloc_size_t;\n#  else\n     /* This is an attempt to detect an old Windows system where (int) is\n      * actually 16 bits, in that case png_malloc must have an argument with a\n      * bigger size to accomodate the requirements of the library.\n      */\n#    if (defined(_Windows) || defined(_WINDOWS) || defined(_WINDOWS_)) && \\\n        (!defined(INT_MAX) || INT_MAX <= 0x7ffffffeL)\n       typedef DWORD         png_alloc_size_t;\n#    else\n       typedef png_size_t    png_alloc_size_t;\n#    endif\n#  endif\n#endif\n/* End of memory model/platform independent support */\n\n/* Just a little check that someone hasn't tried to define something\n * contradictory.\n */\n#if (PNG_ZBUF_SIZE > 65536L) && defined(PNG_MAX_MALLOC_64K)\n#  undef PNG_ZBUF_SIZE\n#  define PNG_ZBUF_SIZE 65536L\n#endif\n\n\n/* Added at libpng-1.2.8 */\n#endif /* PNG_VERSION_INFO_ONLY */\n\n#endif /* PNGCONF_H */\n"
  },
  {
    "path": "src/main/jni/png/pngpriv.h",
    "content": "\n/* pngpriv.h - private declarations for use inside libpng\n *\n * libpng version 1.4.19 - December 17, 2015\n * For conditions of distribution and use, see copyright notice in png.h\n * Copyright (c) 1998-2002,2004,2006-2014 Glenn Randers-Pehrson\n * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)\n * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)\n *\n * This code is released under the libpng license.\n * For conditions of distribution and use, see the disclaimer\n * and license in png.h\n */\n\n/* The symbols declared in this file (including the functions declared\n * as PNG_EXTERN) are PRIVATE.  They are not part of the libpng public\n * interface, and are not recommended for use by regular applications.\n * Some of them may become public in the future; others may stay private,\n * change in an incompatible way, or even disappear.\n * Although the libpng users are not forbidden to include this header,\n * they should be well aware of the issues that may arise from doing so.\n */\n\n#ifndef PNGPRIV_H\n#define PNGPRIV_H\n\n#ifndef PNG_VERSION_INFO_ONLY\n\n#if defined(_AIX) && defined(_ALL_SOURCE)\n   /* On AIX if _ALL_SOURCE is defined standard header files (including\n    * stdlib.h) define identifiers that are not permitted by the ANSI and\n    * POSIX standards.  In particular 'jmpbuf' is #defined and this will\n    * prevent compilation of libpng.  The following prevents this:\n    */\n#  undef _ALL_SOURCE\n#endif\n\n#include <stdlib.h>\n\n#ifndef PNG_EXTERN\n/* The functions exported by PNG_EXTERN are internal functions, which\n * aren't usually used outside the library (as far as I know), so it is\n * debatable if they should be exported at all.  In the future, when it\n * is possible to have run-time registry of chunk-handling functions,\n * some of these will be made available again.\n#  define PNG_EXTERN extern\n */\n#  define PNG_EXTERN\n#endif\n\n/* Other defines specific to compilers can go here.  Try to keep\n * them inside an appropriate ifdef/endif pair for portability.\n */\n\n#ifdef PNG_FLOATING_POINT_SUPPORTED\n#  ifdef MACOS\n     /* We need to check that <math.h> hasn't already been included earlier\n      * as it seems it doesn't agree with <fp.h>, yet we should really use\n      * <fp.h> if possible.\n      */\n#    if !defined(__MATH_H__) && !defined(__MATH_H) && !defined(__cmath__)\n#      include <fp.h>\n#    endif\n#  else\n#    include <math.h>\n#  endif\n#  if defined(_AMIGA) && defined(__SASC) && defined(_M68881)\n     /* Amiga SAS/C: We must include builtin FPU functions when compiling using\n      * MATH=68881\n      */\n#    include <m68881.h>\n#  endif\n#endif\n\n/* Codewarrior on NT has linking problems without this. */\n#if (defined(__MWERKS__) && defined(WIN32)) || defined(__STDC__)\n#  define PNG_ALWAYS_EXTERN\n#endif\n\n/* This provides the non-ANSI (far) memory allocation routines. */\n#if defined(__TURBOC__) && defined(__MSDOS__)\n#  include <mem.h>\n#  include <alloc.h>\n#endif\n\n#if defined(WIN32) || defined(_Windows) || defined(_WINDOWS) || \\\n    defined(_WIN32) || defined(__WIN32__)\n#  include <windows.h>  /* defines _WINDOWS_ macro */\n#endif\n\n/* Various modes of operation.  Note that after an init, mode is set to\n * zero automatically when the structure is created.\n */\n#define PNG_HAVE_IHDR               0x01\n#define PNG_HAVE_PLTE               0x02\n#define PNG_HAVE_IDAT               0x04\n#define PNG_AFTER_IDAT              0x08 /* Have complete zlib datastream */\n#define PNG_HAVE_IEND               0x10\n#define PNG_HAVE_gAMA               0x20\n#define PNG_HAVE_cHRM               0x40\n#define PNG_HAVE_sRGB               0x80\n#define PNG_HAVE_CHUNK_HEADER      0x100\n#define PNG_WROTE_tIME             0x200\n#define PNG_WROTE_INFO_BEFORE_PLTE 0x400\n#define PNG_BACKGROUND_IS_GRAY     0x800\n#define PNG_HAVE_PNG_SIGNATURE    0x1000\n#define PNG_HAVE_CHUNK_AFTER_IDAT 0x2000 /* Have another chunk after IDAT */\n\n/* Flags for the transformations the PNG library does on the image data */\n#define PNG_BGR                 0x0001\n#define PNG_INTERLACE           0x0002\n#define PNG_PACK                0x0004\n#define PNG_SHIFT               0x0008\n#define PNG_SWAP_BYTES          0x0010\n#define PNG_INVERT_MONO         0x0020\n#define PNG_QUANTIZE            0x0040 /* formerly PNG_DITHER */\n#define PNG_BACKGROUND          0x0080\n#define PNG_BACKGROUND_EXPAND   0x0100\n                          /*    0x0200 unused */\n#define PNG_16_TO_8             0x0400\n#define PNG_RGBA                0x0800\n#define PNG_EXPAND              0x1000\n#define PNG_GAMMA               0x2000\n#define PNG_GRAY_TO_RGB         0x4000\n#define PNG_FILLER              0x8000L\n#define PNG_PACKSWAP           0x10000L\n#define PNG_SWAP_ALPHA         0x20000L\n#define PNG_STRIP_ALPHA        0x40000L\n#define PNG_INVERT_ALPHA       0x80000L\n#define PNG_USER_TRANSFORM    0x100000L\n#define PNG_RGB_TO_GRAY_ERR   0x200000L\n#define PNG_RGB_TO_GRAY_WARN  0x400000L\n#define PNG_RGB_TO_GRAY       0x600000L  /* two bits, RGB_TO_GRAY_ERR|WARN */\n                       /*     0x800000L     Unused */\n#define PNG_ADD_ALPHA         0x1000000L  /* Added to libpng-1.2.7 */\n#define PNG_EXPAND_tRNS       0x2000000L  /* Added to libpng-1.2.9 */\n                       /*   0x4000000L  unused */\n                       /*   0x8000000L  unused */\n                       /*  0x10000000L  unused */\n                       /*  0x20000000L  unused */\n                       /*  0x40000000L  unused */\n\n/* Flags for png_create_struct */\n#define PNG_STRUCT_PNG   0x0001\n#define PNG_STRUCT_INFO  0x0002\n\n/* Scaling factor for filter heuristic weighting calculations */\n#define PNG_WEIGHT_SHIFT 8\n#define PNG_WEIGHT_FACTOR (1<<(PNG_WEIGHT_SHIFT))\n#define PNG_COST_SHIFT 3\n#define PNG_COST_FACTOR (1<<(PNG_COST_SHIFT))\n\n/* Flags for the png_ptr->flags rather than declaring a byte for each one */\n#define PNG_FLAG_ZLIB_CUSTOM_STRATEGY     0x0001\n#define PNG_FLAG_ZLIB_CUSTOM_LEVEL        0x0002\n#define PNG_FLAG_ZLIB_CUSTOM_MEM_LEVEL    0x0004\n#define PNG_FLAG_ZLIB_CUSTOM_WINDOW_BITS  0x0008\n#define PNG_FLAG_ZLIB_CUSTOM_METHOD       0x0010\n#define PNG_FLAG_ZLIB_FINISHED            0x0020\n#define PNG_FLAG_ROW_INIT                 0x0040\n#define PNG_FLAG_FILLER_AFTER             0x0080\n#define PNG_FLAG_CRC_ANCILLARY_USE        0x0100\n#define PNG_FLAG_CRC_ANCILLARY_NOWARN     0x0200\n#define PNG_FLAG_CRC_CRITICAL_USE         0x0400\n#define PNG_FLAG_CRC_CRITICAL_IGNORE      0x0800\n                                /*        0x1000  unused */\n                                /*        0x2000  unused */\n                                /*        0x4000  unused */\n#define PNG_FLAG_KEEP_UNKNOWN_CHUNKS      0x8000L\n#define PNG_FLAG_KEEP_UNSAFE_CHUNKS       0x10000L\n#define PNG_FLAG_LIBRARY_MISMATCH         0x20000L\n#define PNG_FLAG_STRIP_ERROR_NUMBERS      0x40000L\n#define PNG_FLAG_STRIP_ERROR_TEXT         0x80000L\n#define PNG_FLAG_MALLOC_NULL_MEM_OK       0x100000L\n#define PNG_FLAG_ADD_ALPHA                0x200000L  /* Added to libpng-1.2.8 */\n#define PNG_FLAG_STRIP_ALPHA              0x400000L  /* Added to libpng-1.2.8 */\n#define PNG_FLAG_BENIGN_ERRORS_WARN       0x800000L  /* Added to libpng-1.4.0 */\n                                  /*     0x1000000L  unused */\n                                  /*     0x2000000L  unused */\n                                  /*     0x4000000L  unused */\n                                  /*     0x8000000L  unused */\n                                  /*    0x10000000L  unused */\n                                  /*    0x20000000L  unused */\n                                  /*    0x40000000L  unused */\n\n#define PNG_FLAG_CRC_ANCILLARY_MASK (PNG_FLAG_CRC_ANCILLARY_USE | \\\n                                     PNG_FLAG_CRC_ANCILLARY_NOWARN)\n\n#define PNG_FLAG_CRC_CRITICAL_MASK  (PNG_FLAG_CRC_CRITICAL_USE | \\\n                                     PNG_FLAG_CRC_CRITICAL_IGNORE)\n\n#define PNG_FLAG_CRC_MASK           (PNG_FLAG_CRC_ANCILLARY_MASK | \\\n                                     PNG_FLAG_CRC_CRITICAL_MASK)\n\n/* Save typing and make code easier to understand */\n\n#define PNG_COLOR_DIST(c1, c2) (abs((int)((c1).red) - (int)((c2).red)) + \\\n   abs((int)((c1).green) - (int)((c2).green)) + \\\n   abs((int)((c1).blue) - (int)((c2).blue)))\n\n/* Added to libpng-1.2.6 JB */\n#define PNG_ROWBYTES(pixel_bits, width) \\\n    ((pixel_bits) >= 8 ? \\\n    ((png_size_t)(width) * (((png_size_t)(pixel_bits)) >> 3)) : \\\n    (( ((png_size_t)(width) * ((png_size_t)(pixel_bits))) + 7) >> 3) )\n\n/* PNG_OUT_OF_RANGE returns true if value is outside the range\n * ideal-delta..ideal+delta.  Each argument is evaluated twice.\n * \"ideal\" and \"delta\" should be constants, normally simple\n * integers, \"value\" a variable. Added to libpng-1.2.6 JB\n */\n#define PNG_OUT_OF_RANGE(value, ideal, delta) \\\n        ( (value) < (ideal)-(delta) || (value) > (ideal)+(delta) )\n\n/* Constant strings for known chunk types.  If you need to add a chunk,\n * define the name here, and add an invocation of the macro wherever it's\n * needed.\n */\n#define PNG_IHDR PNG_CONST png_byte png_IHDR[5] = { 73,  72,  68,  82, '\\0'}\n#define PNG_IDAT PNG_CONST png_byte png_IDAT[5] = { 73,  68,  65,  84, '\\0'}\n#define PNG_IEND PNG_CONST png_byte png_IEND[5] = { 73,  69,  78,  68, '\\0'}\n#define PNG_PLTE PNG_CONST png_byte png_PLTE[5] = { 80,  76,  84,  69, '\\0'}\n#define PNG_bKGD PNG_CONST png_byte png_bKGD[5] = { 98,  75,  71,  68, '\\0'}\n#define PNG_cHRM PNG_CONST png_byte png_cHRM[5] = { 99,  72,  82,  77, '\\0'}\n#define PNG_gAMA PNG_CONST png_byte png_gAMA[5] = {103,  65,  77,  65, '\\0'}\n#define PNG_hIST PNG_CONST png_byte png_hIST[5] = {104,  73,  83,  84, '\\0'}\n#define PNG_iCCP PNG_CONST png_byte png_iCCP[5] = {105,  67,  67,  80, '\\0'}\n#define PNG_iTXt PNG_CONST png_byte png_iTXt[5] = {105,  84,  88, 116, '\\0'}\n#define PNG_oFFs PNG_CONST png_byte png_oFFs[5] = {111,  70,  70, 115, '\\0'}\n#define PNG_pCAL PNG_CONST png_byte png_pCAL[5] = {112,  67,  65,  76, '\\0'}\n#define PNG_sCAL PNG_CONST png_byte png_sCAL[5] = {115,  67,  65,  76, '\\0'}\n#define PNG_pHYs PNG_CONST png_byte png_pHYs[5] = {112,  72,  89, 115, '\\0'}\n#define PNG_sBIT PNG_CONST png_byte png_sBIT[5] = {115,  66,  73,  84, '\\0'}\n#define PNG_sPLT PNG_CONST png_byte png_sPLT[5] = {115,  80,  76,  84, '\\0'}\n#define PNG_sRGB PNG_CONST png_byte png_sRGB[5] = {115,  82,  71,  66, '\\0'}\n#define PNG_sTER PNG_CONST png_byte png_sTER[5] = {115,  84,  69,  82, '\\0'}\n#define PNG_tEXt PNG_CONST png_byte png_tEXt[5] = {116,  69,  88, 116, '\\0'}\n#define PNG_tIME PNG_CONST png_byte png_tIME[5] = {116,  73,  77,  69, '\\0'}\n#define PNG_tRNS PNG_CONST png_byte png_tRNS[5] = {116,  82,  78,  83, '\\0'}\n#define PNG_zTXt PNG_CONST png_byte png_zTXt[5] = {122,  84,  88, 116, '\\0'}\n\n\n/* Inhibit C++ name-mangling for libpng functions but not for system calls. */\n#ifdef __cplusplus\nextern \"C\" {\n#endif /* __cplusplus */\n\n/* These functions are used internally in the code.  They generally\n * shouldn't be used unless you are writing code to add or replace some\n * functionality in libpng.  More information about most functions can\n * be found in the files where the functions are located.\n */\n\n/* Allocate memory for an internal libpng struct */\nPNG_EXTERN png_voidp png_create_struct PNGARG((int type));\n\n/* Free memory from internal libpng struct */\nPNG_EXTERN void png_destroy_struct PNGARG((png_voidp struct_ptr));\n\nPNG_EXTERN png_voidp png_create_struct_2 PNGARG((int type, png_malloc_ptr\n  malloc_fn, png_voidp mem_ptr));\nPNG_EXTERN void png_destroy_struct_2 PNGARG((png_voidp struct_ptr,\n   png_free_ptr free_fn, png_voidp mem_ptr));\n\n/* Free any memory that info_ptr points to and reset struct. */\nPNG_EXTERN void png_info_destroy PNGARG((png_structp png_ptr,\n   png_infop info_ptr));\n\n/* Function to allocate memory for zlib.  PNGAPI is disallowed. */\nPNG_EXTERN voidpf png_zalloc PNGARG((voidpf png_ptr, uInt items, uInt size));\n\n/* Function to free memory for zlib.  PNGAPI is disallowed. */\nPNG_EXTERN void png_zfree PNGARG((voidpf png_ptr, voidpf ptr));\n\n/* Next four functions are used internally as callbacks.  PNGAPI is required\n * but not PNG_EXPORT.  PNGAPI added at libpng version 1.2.3. */\n\nPNG_EXTERN void PNGAPI png_default_read_data PNGARG((png_structp png_ptr,\n   png_bytep data, png_size_t length));\n\n#ifdef PNG_PROGRESSIVE_READ_SUPPORTED\nPNG_EXTERN void PNGAPI png_push_fill_buffer PNGARG((png_structp png_ptr,\n   png_bytep buffer, png_size_t length));\n#endif\n\nPNG_EXTERN void PNGAPI png_default_write_data PNGARG((png_structp png_ptr,\n   png_bytep data, png_size_t length));\n\n#ifdef PNG_WRITE_FLUSH_SUPPORTED\n#ifdef PNG_STDIO_SUPPORTED\nPNG_EXTERN void PNGAPI png_default_flush PNGARG((png_structp png_ptr));\n#endif\n#endif\n\n/* Reset the CRC variable */\nPNG_EXTERN void png_reset_crc PNGARG((png_structp png_ptr));\n\n/* Write the \"data\" buffer to whatever output you are using */\nPNG_EXTERN void png_write_data PNGARG((png_structp png_ptr, png_bytep data,\n   png_size_t length));\n\n/* Read and check the PNG file signature */\nPNG_EXTERN void png_read_sig PNGARG((png_structp png_ptr, png_infop info_ptr));\n\n/* Read the chunk header (length + type name) */\nPNG_EXTERN png_uint_32 png_read_chunk_header PNGARG((png_structp png_ptr));\n\n/* Read data from whatever input you are using into the \"data\" buffer */\nPNG_EXTERN void png_read_data PNGARG((png_structp png_ptr, png_bytep data,\n   png_size_t length));\n\n/* Read bytes into buf, and update png_ptr->crc */\nPNG_EXTERN void png_crc_read PNGARG((png_structp png_ptr, png_bytep buf,\n   png_size_t length));\n\n/* Decompress data in a chunk that uses compression */\n#if defined(PNG_zTXt_SUPPORTED) || defined(PNG_iTXt_SUPPORTED) || \\\n    defined(PNG_iCCP_SUPPORTED) || defined(PNG_sPLT_SUPPORTED)\nPNG_EXTERN void png_decompress_chunk PNGARG((png_structp png_ptr,\n   int comp_type, png_size_t chunklength, png_size_t prefix_length,\n   png_size_t *data_length));\n#endif\n\n/* Read \"skip\" bytes, read the file crc, and (optionally) verify png_ptr->crc */\nPNG_EXTERN int png_crc_finish PNGARG((png_structp png_ptr, png_uint_32 skip));\n\n/* Read the CRC from the file and compare it to the libpng calculated CRC */\nPNG_EXTERN int png_crc_error PNGARG((png_structp png_ptr));\n\n/* Calculate the CRC over a section of data.  Note that we are only\n * passing a maximum of 64K on systems that have this as a memory limit,\n * since this is the maximum buffer size we can specify.\n */\nPNG_EXTERN void png_calculate_crc PNGARG((png_structp png_ptr, png_bytep ptr,\n   png_size_t length));\n\n#ifdef PNG_WRITE_FLUSH_SUPPORTED\nPNG_EXTERN void png_flush PNGARG((png_structp png_ptr));\n#endif\n\n/* Write various chunks */\n\n/* Write the IHDR chunk, and update the png_struct with the necessary\n * information.\n */\nPNG_EXTERN void png_write_IHDR PNGARG((png_structp png_ptr, png_uint_32 width,\n   png_uint_32 height,\n   int bit_depth, int color_type, int compression_method, int filter_method,\n   int interlace_method));\n\nPNG_EXTERN void png_write_PLTE PNGARG((png_structp png_ptr, png_colorp palette,\n   png_uint_32 num_pal));\n\nPNG_EXTERN void png_write_IDAT PNGARG((png_structp png_ptr, png_bytep data,\n   png_size_t length));\n\nPNG_EXTERN void png_write_IEND PNGARG((png_structp png_ptr));\n\n#ifdef PNG_WRITE_gAMA_SUPPORTED\n#ifdef PNG_FLOATING_POINT_SUPPORTED\nPNG_EXTERN void png_write_gAMA PNGARG((png_structp png_ptr, double file_gamma));\n#endif\n#ifdef PNG_FIXED_POINT_SUPPORTED\nPNG_EXTERN void png_write_gAMA_fixed PNGARG((png_structp png_ptr,\n    png_fixed_point file_gamma));\n#endif\n#endif\n\n#ifdef PNG_WRITE_sBIT_SUPPORTED\nPNG_EXTERN void png_write_sBIT PNGARG((png_structp png_ptr, png_color_8p sbit,\n   int color_type));\n#endif\n\n#ifdef PNG_WRITE_cHRM_SUPPORTED\n#ifdef PNG_FLOATING_POINT_SUPPORTED\nPNG_EXTERN void png_write_cHRM PNGARG((png_structp png_ptr,\n   double white_x, double white_y,\n   double red_x, double red_y, double green_x, double green_y,\n   double blue_x, double blue_y));\n#endif\nPNG_EXTERN void png_write_cHRM_fixed PNGARG((png_structp png_ptr,\n   png_fixed_point int_white_x, png_fixed_point int_white_y,\n   png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point\n   int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x,\n   png_fixed_point int_blue_y));\n#endif\n\n#ifdef PNG_WRITE_sRGB_SUPPORTED\nPNG_EXTERN void png_write_sRGB PNGARG((png_structp png_ptr,\n   int intent));\n#endif\n\n#ifdef PNG_WRITE_iCCP_SUPPORTED\nPNG_EXTERN void png_write_iCCP PNGARG((png_structp png_ptr,\n   png_charp name, int compression_type,\n   png_charp profile, int proflen));\n   /* Note to maintainer: profile should be png_bytep */\n#endif\n\n#ifdef PNG_WRITE_sPLT_SUPPORTED\nPNG_EXTERN void png_write_sPLT PNGARG((png_structp png_ptr,\n   png_sPLT_tp palette));\n#endif\n\n#ifdef PNG_WRITE_tRNS_SUPPORTED\nPNG_EXTERN void png_write_tRNS PNGARG((png_structp png_ptr, png_bytep trans,\n   png_color_16p values, int number, int color_type));\n#endif\n\n#ifdef PNG_WRITE_bKGD_SUPPORTED\nPNG_EXTERN void png_write_bKGD PNGARG((png_structp png_ptr,\n   png_color_16p values, int color_type));\n#endif\n\n#ifdef PNG_WRITE_hIST_SUPPORTED\nPNG_EXTERN void png_write_hIST PNGARG((png_structp png_ptr, png_uint_16p hist,\n   int num_hist));\n#endif\n\n#if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_pCAL_SUPPORTED) || \\\n    defined(PNG_WRITE_iCCP_SUPPORTED) || defined(PNG_WRITE_sPLT_SUPPORTED)\nPNG_EXTERN png_size_t png_check_keyword PNGARG((png_structp png_ptr,\n   png_charp key, png_charpp new_key));\n#endif\n\n#ifdef PNG_WRITE_tEXt_SUPPORTED\nPNG_EXTERN void png_write_tEXt PNGARG((png_structp png_ptr, png_charp key,\n   png_charp text, png_size_t text_len));\n#endif\n\n#ifdef PNG_WRITE_zTXt_SUPPORTED\nPNG_EXTERN void png_write_zTXt PNGARG((png_structp png_ptr, png_charp key,\n   png_charp text, png_size_t text_len, int compression));\n#endif\n\n#ifdef PNG_WRITE_iTXt_SUPPORTED\nPNG_EXTERN void png_write_iTXt PNGARG((png_structp png_ptr,\n   int compression, png_charp key, png_charp lang, png_charp lang_key,\n   png_charp text));\n#endif\n\n#ifdef PNG_TEXT_SUPPORTED  /* Added at version 1.0.14 and 1.2.4 */\nPNG_EXTERN int png_set_text_2 PNGARG((png_structp png_ptr,\n   png_infop info_ptr, png_textp text_ptr, int num_text));\n#endif\n\n#ifdef PNG_WRITE_oFFs_SUPPORTED\nPNG_EXTERN void png_write_oFFs PNGARG((png_structp png_ptr,\n   png_int_32 x_offset, png_int_32 y_offset, int unit_type));\n#endif\n\n#ifdef PNG_WRITE_pCAL_SUPPORTED\nPNG_EXTERN void png_write_pCAL PNGARG((png_structp png_ptr, png_charp purpose,\n   png_int_32 X0, png_int_32 X1, int type, int nparams,\n   png_charp units, png_charpp params));\n#endif\n\n#ifdef PNG_WRITE_pHYs_SUPPORTED\nPNG_EXTERN void png_write_pHYs PNGARG((png_structp png_ptr,\n   png_uint_32 x_pixels_per_unit, png_uint_32 y_pixels_per_unit,\n   int unit_type));\n#endif\n\n#ifdef PNG_WRITE_tIME_SUPPORTED\nPNG_EXTERN void png_write_tIME PNGARG((png_structp png_ptr,\n   png_timep mod_time));\n#endif\n\n#ifdef PNG_WRITE_sCAL_SUPPORTED\n#if defined(PNG_FLOATING_POINT_SUPPORTED) && defined(PNG_STDIO_SUPPORTED)\nPNG_EXTERN void png_write_sCAL PNGARG((png_structp png_ptr,\n   int unit, double width, double height));\n#else\n#ifdef PNG_FIXED_POINT_SUPPORTED\nPNG_EXTERN void png_write_sCAL_s PNGARG((png_structp png_ptr,\n   int unit, png_charp width, png_charp height));\n#endif\n#endif\n#endif\n\n/* Called when finished processing a row of data */\nPNG_EXTERN void png_write_finish_row PNGARG((png_structp png_ptr));\n\n/* Internal use only.   Called before first row of data */\nPNG_EXTERN void png_write_start_row PNGARG((png_structp png_ptr));\n\n#ifdef PNG_READ_GAMMA_SUPPORTED\nPNG_EXTERN void png_build_gamma_table PNGARG((png_structp png_ptr,\n   png_byte bit_depth));\n#endif\n\n/* Combine a row of data, dealing with alpha, etc. if requested */\nPNG_EXTERN void png_combine_row PNGARG((png_structp png_ptr, png_bytep row,\n   int mask));\n\n#ifdef PNG_READ_INTERLACING_SUPPORTED\n/* Expand an interlaced row */\n/* OLD pre-1.0.9 interface:\nPNG_EXTERN void png_do_read_interlace PNGARG((png_row_infop row_info,\n   png_bytep row, int pass, png_uint_32 transformations));\n */\nPNG_EXTERN void png_do_read_interlace PNGARG((png_structp png_ptr));\n#endif\n\n/* GRR TO DO (2.0 or whenever):  simplify other internal calling interfaces */\n\n#ifdef PNG_WRITE_INTERLACING_SUPPORTED\n/* Grab pixels out of a row for an interlaced pass */\nPNG_EXTERN void png_do_write_interlace PNGARG((png_row_infop row_info,\n   png_bytep row, int pass));\n#endif\n\n/* Unfilter a row */\nPNG_EXTERN void png_read_filter_row PNGARG((png_structp png_ptr,\n   png_row_infop row_info, png_bytep row, png_bytep prev_row, int filter));\n\n/* Choose the best filter to use and filter the row data */\nPNG_EXTERN void png_write_find_filter PNGARG((png_structp png_ptr,\n   png_row_infop row_info));\n\n/* Write out the filtered row. */\nPNG_EXTERN void png_write_filtered_row PNGARG((png_structp png_ptr,\n   png_bytep filtered_row));\n/* Finish a row while reading, dealing with interlacing passes, etc. */\nPNG_EXTERN void png_read_finish_row PNGARG((png_structp png_ptr));\n\n/* Initialize the row buffers, etc. */\nPNG_EXTERN void png_read_start_row PNGARG((png_structp png_ptr));\n/* Optional call to update the users info structure */\nPNG_EXTERN void png_read_transform_info PNGARG((png_structp png_ptr,\n   png_infop info_ptr));\n\n/* These are the functions that do the transformations */\n#ifdef PNG_READ_FILLER_SUPPORTED\nPNG_EXTERN void png_do_read_filler PNGARG((png_row_infop row_info,\n   png_bytep row, png_uint_32 filler, png_uint_32 flags));\n#endif\n\n#ifdef PNG_READ_SWAP_ALPHA_SUPPORTED\nPNG_EXTERN void png_do_read_swap_alpha PNGARG((png_row_infop row_info,\n   png_bytep row));\n#endif\n\n#ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED\nPNG_EXTERN void png_do_write_swap_alpha PNGARG((png_row_infop row_info,\n   png_bytep row));\n#endif\n\n#ifdef PNG_READ_INVERT_ALPHA_SUPPORTED\nPNG_EXTERN void png_do_read_invert_alpha PNGARG((png_row_infop row_info,\n   png_bytep row));\n#endif\n\n#ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED\nPNG_EXTERN void png_do_write_invert_alpha PNGARG((png_row_infop row_info,\n   png_bytep row));\n#endif\n\n#if defined(PNG_WRITE_FILLER_SUPPORTED) || \\\n    defined(PNG_READ_STRIP_ALPHA_SUPPORTED)\nPNG_EXTERN void png_do_strip_filler PNGARG((png_row_infop row_info,\n   png_bytep row, png_uint_32 flags));\n#endif\n\n#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)\nPNG_EXTERN void png_do_swap PNGARG((png_row_infop row_info, png_bytep row));\n#endif\n\n#if defined(PNG_READ_PACKSWAP_SUPPORTED) || \\\n    defined(PNG_WRITE_PACKSWAP_SUPPORTED)\nPNG_EXTERN void png_do_packswap PNGARG((png_row_infop row_info, png_bytep row));\n#endif\n\n#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED\nPNG_EXTERN int png_do_rgb_to_gray PNGARG((png_structp png_ptr, png_row_infop\n   row_info, png_bytep row));\n#endif\n\n#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED\nPNG_EXTERN void png_do_gray_to_rgb PNGARG((png_row_infop row_info,\n   png_bytep row));\n#endif\n\n#ifdef PNG_READ_PACK_SUPPORTED\nPNG_EXTERN void png_do_unpack PNGARG((png_row_infop row_info, png_bytep row));\n#endif\n\n#ifdef PNG_READ_SHIFT_SUPPORTED\nPNG_EXTERN void png_do_unshift PNGARG((png_row_infop row_info, png_bytep row,\n   png_color_8p sig_bits));\n#endif\n\n#if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED)\nPNG_EXTERN void png_do_invert PNGARG((png_row_infop row_info, png_bytep row));\n#endif\n\n#ifdef PNG_READ_16_TO_8_SUPPORTED\nPNG_EXTERN void png_do_chop PNGARG((png_row_infop row_info, png_bytep row));\n#endif\n\n#ifdef PNG_READ_QUANTIZE_SUPPORTED\nPNG_EXTERN void png_do_quantize PNGARG((png_row_infop row_info,\n   png_bytep row, png_bytep palette_lookup, png_bytep quantize_lookup));\n\n#  ifdef PNG_CORRECT_PALETTE_SUPPORTED\nPNG_EXTERN void png_correct_palette PNGARG((png_structp png_ptr,\n   png_colorp palette, int num_palette));\n#  endif\n#endif\n\n#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)\nPNG_EXTERN void png_do_bgr PNGARG((png_row_infop row_info, png_bytep row));\n#endif\n\n#ifdef PNG_WRITE_PACK_SUPPORTED\nPNG_EXTERN void png_do_pack PNGARG((png_row_infop row_info,\n   png_bytep row, png_uint_32 bit_depth));\n#endif\n\n#ifdef PNG_WRITE_SHIFT_SUPPORTED\nPNG_EXTERN void png_do_shift PNGARG((png_row_infop row_info, png_bytep row,\n   png_color_8p bit_depth));\n#endif\n\n#ifdef PNG_READ_BACKGROUND_SUPPORTED\n#ifdef PNG_READ_GAMMA_SUPPORTED\nPNG_EXTERN void png_do_background PNGARG((png_row_infop row_info, png_bytep row,\n   png_color_16p trans_color, png_color_16p background,\n   png_color_16p background_1,\n   png_bytep gamma_table, png_bytep gamma_from_1, png_bytep gamma_to_1,\n   png_uint_16pp gamma_16, png_uint_16pp gamma_16_from_1,\n   png_uint_16pp gamma_16_to_1, int gamma_shift));\n#else\nPNG_EXTERN void png_do_background PNGARG((png_row_infop row_info, png_bytep row,\n   png_color_16p trans_color, png_color_16p background));\n#endif\n#endif\n\n#ifdef PNG_READ_GAMMA_SUPPORTED\nPNG_EXTERN void png_do_gamma PNGARG((png_row_infop row_info, png_bytep row,\n   png_bytep gamma_table, png_uint_16pp gamma_16_table,\n   int gamma_shift));\n#endif\n\n#ifdef PNG_READ_EXPAND_SUPPORTED\nPNG_EXTERN void png_do_expand_palette PNGARG((png_row_infop row_info,\n   png_bytep row, png_colorp palette, png_bytep trans, int num_trans));\nPNG_EXTERN void png_do_expand PNGARG((png_row_infop row_info,\n   png_bytep row, png_color_16p trans_value));\n#endif\n\n/* The following decodes the appropriate chunks, and does error correction,\n * then calls the appropriate callback for the chunk if it is valid.\n */\n\n/* Decode the IHDR chunk */\nPNG_EXTERN void png_handle_IHDR PNGARG((png_structp png_ptr, png_infop info_ptr,\n   png_uint_32 length));\nPNG_EXTERN void png_handle_PLTE PNGARG((png_structp png_ptr, png_infop info_ptr,\n   png_uint_32 length));\nPNG_EXTERN void png_handle_IEND PNGARG((png_structp png_ptr, png_infop info_ptr,\n   png_uint_32 length));\n\n#ifdef PNG_READ_bKGD_SUPPORTED\nPNG_EXTERN void png_handle_bKGD PNGARG((png_structp png_ptr, png_infop info_ptr,\n   png_uint_32 length));\n#endif\n\n#ifdef PNG_READ_cHRM_SUPPORTED\nPNG_EXTERN void png_handle_cHRM PNGARG((png_structp png_ptr, png_infop info_ptr,\n   png_uint_32 length));\n#endif\n\n#ifdef PNG_READ_gAMA_SUPPORTED\nPNG_EXTERN void png_handle_gAMA PNGARG((png_structp png_ptr, png_infop info_ptr,\n   png_uint_32 length));\n#endif\n\n#ifdef PNG_READ_hIST_SUPPORTED\nPNG_EXTERN void png_handle_hIST PNGARG((png_structp png_ptr, png_infop info_ptr,\n   png_uint_32 length));\n#endif\n\n#ifdef PNG_READ_iCCP_SUPPORTED\nPNG_EXTERN void png_handle_iCCP PNGARG((png_structp png_ptr, png_infop info_ptr,\n   png_uint_32 length));\n#endif /* PNG_READ_iCCP_SUPPORTED */\n\n#ifdef PNG_READ_iTXt_SUPPORTED\nPNG_EXTERN void png_handle_iTXt PNGARG((png_structp png_ptr, png_infop info_ptr,\n   png_uint_32 length));\n#endif\n\n#ifdef PNG_READ_oFFs_SUPPORTED\nPNG_EXTERN void png_handle_oFFs PNGARG((png_structp png_ptr, png_infop info_ptr,\n   png_uint_32 length));\n#endif\n\n#ifdef PNG_READ_pCAL_SUPPORTED\nPNG_EXTERN void png_handle_pCAL PNGARG((png_structp png_ptr, png_infop info_ptr,\n   png_uint_32 length));\n#endif\n\n#ifdef PNG_READ_pHYs_SUPPORTED\nPNG_EXTERN void png_handle_pHYs PNGARG((png_structp png_ptr, png_infop info_ptr,\n   png_uint_32 length));\n#endif\n\n#ifdef PNG_READ_sBIT_SUPPORTED\nPNG_EXTERN void png_handle_sBIT PNGARG((png_structp png_ptr, png_infop info_ptr,\n   png_uint_32 length));\n#endif\n\n#ifdef PNG_READ_sCAL_SUPPORTED\nPNG_EXTERN void png_handle_sCAL PNGARG((png_structp png_ptr, png_infop info_ptr,\n   png_uint_32 length));\n#endif\n\n#ifdef PNG_READ_sPLT_SUPPORTED\nPNG_EXTERN void png_handle_sPLT PNGARG((png_structp png_ptr, png_infop info_ptr,\n   png_uint_32 length));\n#endif /* PNG_READ_sPLT_SUPPORTED */\n\n#ifdef PNG_READ_sRGB_SUPPORTED\nPNG_EXTERN void png_handle_sRGB PNGARG((png_structp png_ptr, png_infop info_ptr,\n   png_uint_32 length));\n#endif\n\n#ifdef PNG_READ_tEXt_SUPPORTED\nPNG_EXTERN void png_handle_tEXt PNGARG((png_structp png_ptr, png_infop info_ptr,\n   png_uint_32 length));\n#endif\n\n#ifdef PNG_READ_tIME_SUPPORTED\nPNG_EXTERN void png_handle_tIME PNGARG((png_structp png_ptr, png_infop info_ptr,\n   png_uint_32 length));\n#endif\n\n#ifdef PNG_READ_tRNS_SUPPORTED\nPNG_EXTERN void png_handle_tRNS PNGARG((png_structp png_ptr, png_infop info_ptr,\n   png_uint_32 length));\n#endif\n\n#ifdef PNG_READ_zTXt_SUPPORTED\nPNG_EXTERN void png_handle_zTXt PNGARG((png_structp png_ptr, png_infop info_ptr,\n   png_uint_32 length));\n#endif\n\nPNG_EXTERN void png_handle_unknown PNGARG((png_structp png_ptr,\n   png_infop info_ptr, png_uint_32 length));\n\nPNG_EXTERN void png_check_chunk_name PNGARG((png_structp png_ptr,\n   png_bytep chunk_name));\n\n/* Handle the transformations for reading and writing */\nPNG_EXTERN void png_do_read_transformations PNGARG((png_structp png_ptr));\nPNG_EXTERN void png_do_write_transformations PNGARG((png_structp png_ptr));\n\nPNG_EXTERN void png_init_read_transformations PNGARG((png_structp png_ptr));\n\n#ifdef PNG_PROGRESSIVE_READ_SUPPORTED\nPNG_EXTERN void png_push_read_chunk PNGARG((png_structp png_ptr,\n   png_infop info_ptr));\nPNG_EXTERN void png_push_read_sig PNGARG((png_structp png_ptr,\n   png_infop info_ptr));\nPNG_EXTERN void png_push_check_crc PNGARG((png_structp png_ptr));\nPNG_EXTERN void png_push_crc_skip PNGARG((png_structp png_ptr,\n   png_uint_32 length));\nPNG_EXTERN void png_push_crc_finish PNGARG((png_structp png_ptr));\nPNG_EXTERN void png_push_save_buffer PNGARG((png_structp png_ptr));\nPNG_EXTERN void png_push_restore_buffer PNGARG((png_structp png_ptr,\n   png_bytep buffer, png_size_t buffer_length));\nPNG_EXTERN void png_push_read_IDAT PNGARG((png_structp png_ptr));\nPNG_EXTERN void png_process_IDAT_data PNGARG((png_structp png_ptr,\n   png_bytep buffer, png_size_t buffer_length));\nPNG_EXTERN void png_push_process_row PNGARG((png_structp png_ptr));\nPNG_EXTERN void png_push_handle_unknown PNGARG((png_structp png_ptr,\n   png_infop info_ptr, png_uint_32 length));\nPNG_EXTERN void png_push_have_info PNGARG((png_structp png_ptr,\n   png_infop info_ptr));\nPNG_EXTERN void png_push_have_end PNGARG((png_structp png_ptr,\n   png_infop info_ptr));\nPNG_EXTERN void png_push_have_row PNGARG((png_structp png_ptr, png_bytep row));\nPNG_EXTERN void png_push_read_end PNGARG((png_structp png_ptr,\n   png_infop info_ptr));\nPNG_EXTERN void png_process_some_data PNGARG((png_structp png_ptr,\n   png_infop info_ptr));\nPNG_EXTERN void png_read_push_finish_row PNGARG((png_structp png_ptr));\n#ifdef PNG_READ_tEXt_SUPPORTED\nPNG_EXTERN void png_push_handle_tEXt PNGARG((png_structp png_ptr,\n   png_infop info_ptr, png_uint_32 length));\nPNG_EXTERN void png_push_read_tEXt PNGARG((png_structp png_ptr,\n   png_infop info_ptr));\n#endif\n#ifdef PNG_READ_zTXt_SUPPORTED\nPNG_EXTERN void png_push_handle_zTXt PNGARG((png_structp png_ptr,\n   png_infop info_ptr, png_uint_32 length));\nPNG_EXTERN void png_push_read_zTXt PNGARG((png_structp png_ptr,\n   png_infop info_ptr));\n#endif\n#ifdef PNG_READ_iTXt_SUPPORTED\nPNG_EXTERN void png_push_handle_iTXt PNGARG((png_structp png_ptr,\n   png_infop info_ptr, png_uint_32 length));\nPNG_EXTERN void png_push_read_iTXt PNGARG((png_structp png_ptr,\n   png_infop info_ptr));\n#endif\n\n#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */\n\n#ifdef PNG_MNG_FEATURES_SUPPORTED\nPNG_EXTERN void png_do_read_intrapixel PNGARG((png_row_infop row_info,\n   png_bytep row));\nPNG_EXTERN void png_do_write_intrapixel PNGARG((png_row_infop row_info,\n   png_bytep row));\n#endif\n\n/* Added at libpng version 1.4.0 */\n#ifdef PNG_cHRM_SUPPORTED\nPNG_EXTERN int png_check_cHRM_fixed PNGARG((png_structp png_ptr,\n   png_fixed_point int_white_x, png_fixed_point int_white_y,\n   png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point\n   int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x,\n   png_fixed_point int_blue_y));\n#endif\n\n#ifdef PNG_cHRM_SUPPORTED\n#ifdef PNG_CHECK_cHRM_SUPPORTED\n/* Added at libpng version 1.2.34 and 1.4.0 */\nPNG_EXTERN void png_64bit_product PNGARG((long v1, long v2,\n   unsigned long *hi_product, unsigned long *lo_product));\n#endif\n#endif\n\n/* Added at libpng version 1.4.0 */\nPNG_EXTERN void png_check_IHDR PNGARG((png_structp png_ptr,\n   png_uint_32 width, png_uint_32 height, int bit_depth,\n   int color_type, int interlace_type, int compression_type,\n   int filter_type));\n\n/* Free all memory used by the read (old method - NOT DLL EXPORTED) */\nPNG_EXTERN void png_read_destroy PNGARG((png_structp png_ptr, png_infop info_ptr,\n   png_infop end_info_ptr));\n\n/* Free any memory used in png_ptr struct (old method - NOT DLL EXPORTED) */\nPNG_EXTERN void png_write_destroy PNGARG((png_structp png_ptr));\n\n#ifdef USE_FAR_KEYWORD  /* memory model conversion function */\nPNG_EXTERN void *png_far_to_near PNGARG((png_structp png_ptr,png_voidp ptr,\n   int check));\n#endif /* USE_FAR_KEYWORD */\n\n/* Define PNG_DEBUG at compile time for debugging information.  Higher\n * numbers for PNG_DEBUG mean more debugging information.  This has\n * only been added since version 0.95 so it is not implemented throughout\n * libpng yet, but more support will be added as needed.\n */\n#ifdef PNG_DEBUG\n#if (PNG_DEBUG > 0)\n#if !defined(PNG_DEBUG_FILE) && defined(_MSC_VER)\n#include <crtdbg.h>\n#if (PNG_DEBUG > 1)\n#ifndef _DEBUG\n#  define _DEBUG\n#endif\n#ifndef png_debug\n#define png_debug(l,m)  _RPT0(_CRT_WARN,m PNG_STRING_NEWLINE)\n#endif\n#ifndef png_debug1\n#define png_debug1(l,m,p1)  _RPT1(_CRT_WARN,m PNG_STRING_NEWLINE,p1)\n#endif\n#ifndef png_debug2\n#define png_debug2(l,m,p1,p2) _RPT2(_CRT_WARN,m PNG_STRING_NEWLINE,p1,p2)\n#endif\n#endif\n#else /* PNG_DEBUG_FILE || !_MSC_VER */\n#ifndef PNG_DEBUG_FILE\n#define PNG_DEBUG_FILE stderr\n#endif /* PNG_DEBUG_FILE */\n\n#if (PNG_DEBUG > 1)\n/* Note: [\"%s\"m PNG_STRING_NEWLINE] probably does not work on\n * non-ISO compilers\n */\n#  ifdef __STDC__\n#    ifndef png_debug\n#      define png_debug(l,m) \\\n       { \\\n       int num_tabs=l; \\\n       fprintf(PNG_DEBUG_FILE,\"%s\" m PNG_STRING_NEWLINE,(num_tabs==1 ? \"\\t\" : \\\n         (num_tabs==2 ? \"\\t\\t\":(num_tabs>2 ? \"\\t\\t\\t\":\"\")))); \\\n       }\n#    endif\n#    ifndef png_debug1\n#      define png_debug1(l,m,p1) \\\n       { \\\n       int num_tabs=l; \\\n       fprintf(PNG_DEBUG_FILE,\"%s\" m PNG_STRING_NEWLINE,(num_tabs==1 ? \"\\t\" : \\\n         (num_tabs==2 ? \"\\t\\t\":(num_tabs>2 ? \"\\t\\t\\t\":\"\"))),p1); \\\n       }\n#    endif\n#    ifndef png_debug2\n#      define png_debug2(l,m,p1,p2) \\\n       { \\\n       int num_tabs=l; \\\n       fprintf(PNG_DEBUG_FILE,\"%s\" m PNG_STRING_NEWLINE,(num_tabs==1 ? \"\\t\" : \\\n         (num_tabs==2 ? \"\\t\\t\":(num_tabs>2 ? \"\\t\\t\\t\":\"\"))),p1,p2); \\\n       }\n#    endif\n#  else /* __STDC __ */\n#    ifndef png_debug\n#      define png_debug(l,m) \\\n       { \\\n       int num_tabs=l; \\\n       char format[256]; \\\n       snprintf(format,256,\"%s%s%s\",(num_tabs==1 ? \"\\t\" : \\\n         (num_tabs==2 ? \"\\t\\t\":(num_tabs>2 ? \"\\t\\t\\t\":\"\"))), \\\n         m,PNG_STRING_NEWLINE); \\\n       fprintf(PNG_DEBUG_FILE,format); \\\n       }\n#    endif\n#    ifndef png_debug1\n#      define png_debug1(l,m,p1) \\\n       { \\\n       int num_tabs=l; \\\n       char format[256]; \\\n       snprintf(format,256,\"%s%s%s\",(num_tabs==1 ? \"\\t\" : \\\n         (num_tabs==2 ? \"\\t\\t\":(num_tabs>2 ? \"\\t\\t\\t\":\"\"))), \\\n         m,PNG_STRING_NEWLINE); \\\n       fprintf(PNG_DEBUG_FILE,format,p1); \\\n       }\n#    endif\n#    ifndef png_debug2\n#      define png_debug2(l,m,p1,p2) \\\n       { \\\n       int num_tabs=l; \\\n       char format[256]; \\\n       snprintf(format,256,\"%s%s%s\",(num_tabs==1 ? \"\\t\" : \\\n         (num_tabs==2 ? \"\\t\\t\":(num_tabs>2 ? \"\\t\\t\\t\":\"\"))), \\\n         m,PNG_STRING_NEWLINE); \\\n       fprintf(PNG_DEBUG_FILE,format,p1,p2); \\\n       }\n#    endif\n#  endif /* __STDC __ */\n#endif /* (PNG_DEBUG > 1) */\n\n#endif /* _MSC_VER */\n#endif /* (PNG_DEBUG > 0) */\n#endif /* PNG_DEBUG */\n#ifndef png_debug\n#define png_debug(l, m)\n#endif\n#ifndef png_debug1\n#define png_debug1(l, m, p1)\n#endif\n#ifndef png_debug2\n#define png_debug2(l, m, p1, p2)\n#endif\n\n/* Maintainer: Put new private prototypes here ^ and in libpngpf.3 */\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* PNG_VERSION_INFO_ONLY */\n#endif /* PNGPRIV_H */\n"
  },
  {
    "path": "src/main/jni/tiff/Android.mk",
    "content": "LOCAL_PATH:= $(call my-dir)\ninclude $(CLEAR_VARS)\n\nLOCAL_ARM_MODE := arm\n\nLOCAL_TIFF_SRC_FILES := \\\n\tlibtiff/tif_dirread.c \\\n\tlibtiff/tif_zip.c \\\n\tlibtiff/tif_flush.c \\\n\tlibtiff/tif_next.c \\\n\tlibtiff/tif_ojpeg.c \\\n\tlibtiff/tif_dirwrite.c \\\n\tlibtiff/tif_dirinfo.c \\\n\tlibtiff/tif_dir.c \\\n\tlibtiff/tif_compress.c \\\n\tlibtiff/tif_close.c \\\n\tlibtiff/tif_tile.c \\\n\tlibtiff/tif_open.c \\\n\tlibtiff/tif_getimage.c \\\n\tlibtiff/tif_pixarlog.c \\\n\tlibtiff/tif_warning.c \\\n\tlibtiff/tif_dumpmode.c \\\n\tlibtiff/tif_jpeg.c \\\n\tlibtiff/tif_jbig.c \\\n\tlibtiff/tif_predict.c \\\n\tlibtiff/mkg3states.c \\\n\tlibtiff/tif_write.c \\\n\tlibtiff/tif_error.c \\\n\tlibtiff/tif_version.c \\\n\tlibtiff/tif_print.c \\\n\tlibtiff/tif_color.c \\\n\tlibtiff/tif_read.c \\\n\tlibtiff/tif_extension.c \\\n\tlibtiff/tif_thunder.c \\\n\tlibtiff/tif_lzw.c \\\n\tlibtiff/tif_fax3.c \\\n\tlibtiff/tif_luv.c \\\n\tlibtiff/tif_codec.c \\\n\tlibtiff/tif_unix.c \\\n\tlibtiff/tif_packbits.c \\\n\tlibtiff/tif_aux.c \\\n\tlibtiff/tif_fax3sm.c \\\n\tlibtiff/tif_swab.c \\\n\tlibtiff/tif_strip.c\n\nLOCAL_TIFF_SRC_FILES += port/lfind.c \n###########################################################\n\nLOCAL_SRC_FILES:= $(LOCAL_TIFF_SRC_FILES)\nLOCAL_C_INCLUDES += \\\n\t\t\t\t\t$(LOCAL_PATH)/libtiff \\\n\t\t\t\t\texternal/zlib \\\n\t\t\t\t\texternal/jpeg\nLOCAL_CFLAGS += -DAVOID_TABLES \nLOCAL_CFLAGS += -O3 -fstrict-aliasing -fprefetch-loop-arrays\nLOCAL_STATIC_LIBRARIES := \\\n\tlibjpeg\nLOCAL_SHARED_LIBRARIES := \\\n\tlibz\nLOCAL_MODULE:= libtiff\nLOCAL_PRELINK_MODULE:=false\ninclude $(BUILD_SHARED_LIBRARY)\n\n###########################################################\n\ninclude $(CLEAR_VARS)\nLOCAL_ARM_MODE := arm\nLOCAL_SRC_FILES:= $(LOCAL_TIFF_SRC_FILES)\nLOCAL_C_INCLUDES += \\\n\t\t\t\t\t$(LOCAL_PATH)/libtiff \\\n\t\t\t\t\texternal/zlib \\\n\t\t\t\t\texternal/jpeg\nLOCAL_CFLAGS += -DAVOID_TABLES\nLOCAL_CFLAGS += -O3 -fstrict-aliasing -fprefetch-loop-arrays\nLOCAL_STATIC_LIBRARIES := \\\n\tlibjpeg\nLOCAL_SHARED_LIBRARIES := \\\n\tlibz\nLOCAL_MODULE:= libtiff\ninclude $(BUILD_STATIC_LIBRARY)\n\n###########################################################\n\ninclude $(CLEAR_VARS)\n\nLOCAL_SRC_FILES = tools/tiffinfo.c\n\nLOCAL_C_INCLUDES += \\\n\t\t\t\t\t$(LOCAL_PATH)/libtiff\n\nLOCAL_SHARED_LIBRARIES = \\\n\t\t\t\t\t\t libtiff\nLOCAL_MODULE:= tiffinfo\n\ninclude $(BUILD_EXECUTABLE)\n"
  },
  {
    "path": "src/main/jni/tiff/COPYRIGHT",
    "content": "Copyright (c) 1988-1997 Sam Leffler\nCopyright (c) 1991-1997 Silicon Graphics, Inc.\n\nPermission to use, copy, modify, distribute, and sell this software and \nits documentation for any purpose is hereby granted without fee, provided\nthat (i) the above copyright notices and this permission notice appear in\nall copies of the software and related documentation, and (ii) the names of\nSam Leffler and Silicon Graphics may not be used in any advertising or\npublicity relating to the software without the specific, prior written\npermission of Sam Leffler and Silicon Graphics.\n\nTHE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \nEXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \nWARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n\nIN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\nANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\nOR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\nWHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \nLIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \nOF THIS SOFTWARE.\n"
  },
  {
    "path": "src/main/jni/tiff/ChangeLog",
    "content": "2009-11-04  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>\n\n\t* libtiff 3.9.2 released.\n\n2009-11-03  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>\n\n\t* tools/tiffcrop.c: Updated tiffcrop from Richard Nolde.  This\n\tversion has undergone substantial testing with arbitrary sample\n\tbit depths.  Also eliminates GCC compilation warnings.\n\n2009-11-02  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>\n\n\t* port/libport.h: Added header file for porting prototypes and\n\textern declarations.\n\n2009-10-31  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>\n\n\t* libtiff/tif_dirwrite.c (TIFFWriteAnyArray): Add missing break\n\tstatement so writing an array of TIFF_DOUBLE works.\n\n2009-10-29  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>\n\n\t* libtiff/tif_dirread.c: Eliminate GCC \"dereferencing type-punned\n\tpointer\" warnings.\n\n2009-10-28  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>\n\n\t* html/tools.html: Add manual page links, and a summary\n\tdescription of tiffcrop.\n\n2009-10-07  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>\n\n\t* configure.ac: x86_64 should use the same fill order as i386.\n\n2009-09-24  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>\n\n\t* tools/tiffcrop.c, man/tiffcrop.1: New tiffcrop from Richard\n\tNolde.  Major updates to add significant functionality for reading\n\tand writing tile based images with bit depths not a multiple of 8\n\twhich cannot be handled by tiffcp.\n\n2009-09-03  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>\n\n\t* libtiff/tif_ojpeg.c (OJPEGWriteHeaderInfo): IJG JPEG 7 needs\n\tdo_fancy_upsampling=FALSE in order to read raw data.  Resolves\n\t\"Bug 2090 - OJPEG crash with libjpeg v7\".\n\thttp://bugzilla.maptools.org/show_bug.cgi?id=2090\n\n2009-08-30  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>\n\n\t* contrib/iptcutil/iptcutil.c,\n\tlibtiff/tif_getimage.c,libtiff/tif_jpeg.c,libtiff/tif_ojpeg.c,tools/tiffcrop.c,tools/tiffgt.c:\n\tApplied patch from Oden Eriksson to allow building with GCC using\n\tthe \"-Wformat -Werror=format-security\" flags.\n\n2009-08-28  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>\n\n\t* libtiff 3.9.1 released.\n\n2009-08-28  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_dirwrite.c: Back out changes from 2007-11-22 that\n\tresulted in the final strip not being written in some circumstances.\n\thttp://bugzilla.maptools.org/show_bug.cgi?id=2088\n\n2009-08-27  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>\n\n\t* libtiff/tif_write.c (TIFFAppendToStrip): Remove cast which\n\tcaused libtiff to output a wrong last strip with byte-count and\n\tstrip-offset of zero.  This cast was added on the day of the 3.9.0\n\trelease.\n\n\t* libtiff/tif_config.vc.h: tiffiop.h needs the TIFF_INT64_T and\n\tTIFF_UINT64_T defines in order to compile.  Copy existing\n\tdefinitions from tiffconf.vc.h.\n\n2009-08-21  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>\n\n\t* test/Makefile.am (AUTOMAKE_OPTIONS): Colorized tests was not\n\tactually activated since it needed to be enabled in this\n\tMakefile.am.  Also activated parallel-tests mode since it offers\n\tuseful features such as per-test .log files and a summary test\n\treport .log file.\n\n2009-08-20  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>\n\n\t* libtiff 3.9.0 released.\n\n\t* libtiff/tif_print.c (TIFFPrintDirectory): Applied patch for \"tag\n\terror may cause segfault in tif_print.c.\"\n\thttp://bugzilla.maptools.org/show_bug.cgi?id=1896\n\n\t* tools/{rgb2ycbcr.c, tiff2rgba.c}: Applied patch for\n\tCVE-2009-2347 libtiff: integer overflows in various inter-color\n\tspace conversion tools.\n\thttp://bugzilla.maptools.org/show_bug.cgi?id=2079\n\n\t* configure.ac: Updated autotools.  Autoconf 2.64, Automake 1.11,\n\tlibtool 2.2.6.  Enabled support for silent build rules\n\t(--enable-silent-rules or 'make V=0') and colorized tests.\n\n2009-06-30  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_luv.c: correct return codes from encoderow to be\n\t1 on success instead of zero.\n\thttp://bugzilla.maptools.org/show_bug.cgi?id=2069\n\n2009-06-22  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_lzw.c: Fix buffer underflow bug. \n\thttp://bugzilla.maptools.org/show_bug.cgi?id=2065\n\n2009-06-03  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_write.c: do not override the planar configuration to be\n\tcontig for one sample files if planar configuration is already set.\n\thttp://bugzilla.maptools.org/show_bug.cgi?id=2057\n\n2009-02-12  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_luv.c: Fix handling of tiled logluv images. \n\thttp://bugzilla.maptools.org/show_bug.cgi?id=2005\n\n2009-01-23  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_predict.c: Add support for 32bit integer horz. predictors.\n\thttp://bugzilla.maptools.org/show_bug.cgi?id=1911\n\n2009-01-20  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* tools/tiffsplit.c: fix sampleformat to be shortv instead of longv.\n\n2009-01-12  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>\n\n\t* tools/tiff2ps.c: Remove spurious message printed to stderr. \n\n2009-01-11  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>\n\n\t* tools/tiff2ps.c: Incorporated significant functionality update\n\tfrom Richard Nolde.  In particular, support for rotating the image\n\tby 90, 180, 270, and 'auto' has been added.\n\n\t* tools/tiffcrop.c: Incorporated significant functionality update\n\tfrom Richard Nolde.\n\n2009-01-06  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>\n\n\t* libtiff/tiffiop.h: Add private type declarations for int64, and\n\tuint64 so that bundled utilities (like tiffcrop) can use it when\n\tnecessary.\n\n2009-01-01  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>\n\n\t* configure.ac: Updated to test for 64-bit types.  This version of\n\tthe library does not require a 64-bit type, but tiffcrop needs it.\n\n2008-12-31  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>\n\n\t* Update to use current FSF autotools versions.\n\t* libtiff/tiffio.h: GCC will now validate format specifications\n\tfor TIFFError(), TIFFErrorExt(), TIFFWarning(), and\n\tTIFFWarningExt() in order to reveal bugs.  Cleaned up resulting\n\twarnings throughout for 32 bit build only.\n\n2008-12-31  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* tools/tiffcrop.c, man/tiffcrop.1: A major update from Richard\n\tNolde.  \n\n2008-12-21  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_jpeg.c: Avoid errors if the application writes a full\n\tstrip for the last partial strip in a jpeg compressed file.\n\thttp://bugzilla.maptools.org/show_bug.cgi?id=1981\n\n2008-12-21  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_getimage.c, tiffio.h: More ABI corrections. \n\tRemoved SubsamplingHor/Ver from TIFFRGBAImage structure.\n\t  http://bugzilla.maptools.org/show_bug.cgi?id=1980\n\n2008-12-18  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_getimage.c,tiffio.h: removed all use of UaToAa and\n\tBitmap16to8 arrays in TIFFRGBAImage structure to restore ABI\n\tcompatability.  These were just an attempt to speed up processing\n\twith precalculated tables.\n\t  http://bugzilla.maptools.org/show_bug.cgi?id=1979\n\n\t* libtiff/tif_codec.c: Avoid printing c->name if it does not exist.\n\n2008-10-21  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_jbig.c: Support the JBIG-KIT 2.0 (compatibility with\n\tthe older versions retained).\n\n2008-09-05  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tools/tiffsplit.c: Use dynamically allocated array instead of static\n\twhen constructing output file names.\n\n2008-09-03  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tools/tiffsplit.c: Get rid of unsafe strcpy()/strcat() calls when\n\tdoing the filename/path construction.\n\n\t* tools/tiff2pdf.c: More appropriate format string in\n\tt2p_write_pdf_string(); avoid signed/unsigned mismatch.\n\n\t* libtiff/tif_lzw.c: Properly zero out the codetable. As per bug\n\n\thttp://bugzilla.maptools.org/show_bug.cgi?id=1929\n\n\t* libtiff/tif_lzw.c: Properly zero out the string table. Fixes\n\tCVE-2008-2327 security issue.\n\n2008-05-24  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* tif_codec.c: Avoid NULL pointer dereferencing for exotic \n\tcompression codec codes.\n\n\t* tif_dirread.c: zero tif->tif_dir after freeing the directory\n\tin TIFFReadCustomDirectory().  I don't exactly remember why this\n\twas important. \n\n\t* tif_dirwrite.c: Fix potential memory leak writing large double\n\ttags. \n\n\t* tif_dirread.c: Fix unchecked malloc result.\n\n2008-01-30  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tif_fax3.c: Make find0span() and find1span() non-inline to\n\tmake MSVC 6.0 compiler happy.\n\n2007-11-26  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* tif_fax3.c: fix leak of FAXCS state (per bug 1603).\n\n2007-11-23  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* configure.com, libtiff/tif_vms.c: Better OpenVMS support. Patches\n\tfrom Alexey Chupahin.\n\n2007-11-22  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* tif_write.c: Rip out the fancy logic in TIFFAppendToStrip() for \n\testablishing if an existing tile can be rewritten to the same location \n\tby comparing the current size to all the other blocks in the same \n\tdirectory.  This is dangerous in many situations and can easily \n\tcorrupt a file.  (observed in esoteric GDAL situation that's hard to\n\tdocument).  This change involves leaving the stripbytecount[] values \n\tunaltered till TIFFAppendToStrip().  Now we only write a block back\n\tto the same location it used to be at if the new data is the same\n\tsize or smaller - otherwise we move it to the end of file.\n\n\t* tif_dirwrite.c: Try to avoid writing out a full readbuffer of tile\n\tdata when writing the directory just because we have BEENWRITING at\n\tsome point in the past.  This was causing odd junk to be written out\n\tin a tile of data when a single tile had an interleaving of reading \n\tand writing with reading last.  (highlighted by gdal \n\tautotest/gcore/tif_write.py test 7. \n\n\t* tif_predict.c: use working buffer in PredictorEncodeTile to avoid\n\tmodifying callers buffer. \n\thttp://trac.osgeo.org/gdal/ticket/1965\n\n\t* tif_predict.c/h, tif_lzw.c, tif_zip.c: Improvements so that \n\tpredictor based encoding and decoding works in read-write update\n\tmode properly. \n\thttp://trac.osgeo.org/gdal/ticket/1948\n\n2007-10-05  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* tools/tiff2pdf.c: Fixed setting of alpha value per report on list.\n\n2007-09-13  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* tif_dirinfo.c:  _TIFFMergeFields() now only merges in field\n\tdefinitions that are missing.  Existing definitions are silently\n\tignored.  (Bug #1585)\n\n2007-07-18  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/{Makefile.am, Makefile.v}: Do not distribute tiffconf.h, \n\tremove tif_config.h/tiffconf.h during cleaning. As per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1573\n\n2007-07-13  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff 3.9.0beta released.\n\n2007-07-12  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tools/tiff2pdf.c: Added missed extern optind as per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1567\n\n2007-07-03  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tools/tiff2ps.c:  Added support 16-bit images as per bug\n\t\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1566\n\n\tPatch from William Bader.\n\n\t* tools/tiff2pdf.c: Fix for TIFFTAG_JPEGTABLES tag fetching and\n\tsignificant upgrade of the whole utility as per bug\n\t\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1560\n\n\tNow we don't need tiffiop.h in tiff2pdf anymore and will open output\n\tPDF file using TIFFClientOpen() machinery as it is implemented\n\tby Leon Bottou.\n\n2007-06-29  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>\n\n\t* libtiff/tif_dirinfo.c (_TIFFFindFieldInfo): Don't attempt to\n\tbsearch() on a NULL fieldinfo list.\n\t(_TIFFFindFieldInfoByName): Don't attempt to\n\tlfind() on a NULL fieldinfo list.\n\n2007-05-01  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_dirwrite.c: Fixed problem introduced with a fix for a\n\tbyte swapping issue\n\t\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1363\n\n\tAs per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1550\n\n2007-04-27  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tools/tiff2pdf.c: Check the tmpfile() return status as per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=154\n\n2007-04-07  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/{tif_dir.h, tif_dirread.c, tif_dirinfo.c, tif_jpeg.c,\n\ttif_fax3.c, tif_jbig.c, tif_luv.c, tif_ojpeg.c, tif_pixarlog.c,\n\ttif_predict.c, tif_zip.c}: Finally fix bug\n\t\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1274\n\n\tby introducing _TIFFMergeFieldInfo() returning integer error status\n\tinstead of void in case of problems with field merging (e.g., if the\n\tfield with such a tag already registered). TIFFMergeFieldInfo() in\n\tpublic API remains void. Use _TIFFMergeFieldInfo() everywhere and\n\tcheck returned value.\n\n2007-04-07  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* contrib/addtiffo/tif_overview.c: Fix problems with odd sized output \n\tblocks in TIFF_DownSample_Subsampled() (bug 1542).\n\n2007-04-06  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_jpeg.c: Changed JPEGInitializeLibJPEG() so that it\n\twill convert from decompressor to compressor or compress to decompress\n\tif required by the force arguments.  This works around a problem in\n\twhere the JPEGFixupTestSubsampling() may cause a decompressor to \n\tbe setup on a directory when later a compressor is required with the\n\tforce flag set.  Occurs with the addtiffo program for instance. \n\n2007-04-06  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_dirwrite.c: Fixed swapping of byte arrays stored\n\tin-place in tag offsets as per bug\n\t\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1363\n\n\t* tools/tiffcrop.c, man/tiffcrop.1: Significant update in\n\tfunctionality from Richard Nolde. As per bug\n\t\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1525\n\n2007-03-28  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_fax3.c: \"inline static\" -> \"static inline\" for IRIC CC.\n\n2007-03-07  Joris Van Damme  <joris.at.lebbeke@skynet.be>\n\t\n\t* libtiff/tif_getimage.c: workaround for 'Fractional scanline' error reading\n\tOJPEG images with rowsperstrip that is not a multiple of vertical subsampling\n\tfactor. This bug is mentioned in:\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1390\n\thttp://www.asmail.be/msg0054766825.html \n\n2007-03-07  Joris Van Damme  <joris.at.lebbeke@skynet.be>\n\t\n\t* libtiff/tif_win32.c: made inclusion of windows.h unconditional\n\n\t* libtiff/tif_win32.c: replaced preprocessor indication for consiously\n\tunused arguments by standard C indication for the same\n\n2007-02-27  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_dirread.c: Use uint32 type instead of tsize_t in byte\n\tcounters in TIFFFetchData(). Should finally fix the issue\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=890\n\n2007-02-24  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tools/tiffset.c: Properly handle tags with TIFF_VARIABLE writecount.\n\tAs per bug http://bugzilla.remotesensing.org/show_bug.cgi?id=1350\n\n\t* libtiff/tif_dirread.c: Added special function to handle\n\tSubjectDistance EXIF tag as per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1362\n\n\t* tools/tiff2pdf.c: Do not assume inches when the resolution units\n\tdo not specified. As per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1366\n\n\t* tools/{tiffcp.c, tiffcrop.c}: Do not change RowsPerStrip value if\n\tit was set as infinite. As per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1368\n\n\t* tools/tiffcrop.c, man/tiffcrop.1: New tiffcrop utility contributed\n\tby Richard Nolde. As per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1383\n\n2007-02-22  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_dir.c: Workaround for incorrect TIFFs with\n\tExtraSamples == 999 produced by Corel Draw. As per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1490\n\n\t* libtiff/{tif_dirread.c, tif_read.c}: Type of the byte counters\n\tchanged from tsize_t to uint32 to be able to work with data arrays\n\tlarger than 2GB. Fixes bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=890\n\t\n\tIdea submitted by Matt Hancher.\n\n2007-01-31  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tools/tif2rgba.c: This utility does not work properly on big-endian\n\tarchitectures. It was fixed including the bug\n\t\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1149\n\n2007-01-15  Mateusz Loskot <mateusz@loskot.net>\n\n\t* Submitted libtiff port for Windows CE platform\n\t* libtiff/tif_config.wince.h: Added configuration header for WinCE.\n\t* libtiff/tiffconf.wince.h: Ported old configuration header for WinCE.\n\t* libtiff/tif_wince.c: Added WinCE-specific implementation of some\n\tfunctons from tif_win32.c.\n\t* libtiff/tif_win32.c: Disabled some functions already reimplemented in tif_wince.c.\n\t* libtiff/tiffiop.h, port/lfind.c: Added conditional include of some\n\tstandard header files for Windows CE build.\n\t* tools/tiffinfoce.c: Ported tiffinfo utility for Windows CE.\n\n2006-11-19  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_write.c: TIFFAppendToStrip() - clear sorted flag if \n\twe move a strip. \n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1359\t\n\n2006-10-13  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_dir.c: More fixes for vulnerabilities, reported\n\tin Gentoo bug ():\n\t\n\thttp://bugs.gentoo.org/show_bug.cgi?id=142383\n\n\t* libtiff/contrib/dbs/xtiff/xtiff.c: Make xtiff utility compilable.\n\tThough it is still far from the state of being working and useful.\n\n2006-10-12  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_fax3.c: Save the state of printdir codec dependent\n\tmethod.\n\n\t* libtiff/tif_jpeg.c: Save the state of printdir codec dependent method\n\tas per bug http://bugzilla.remotesensing.org/show_bug.cgi?id=1273\n\n\t* libtiff/tif_win32.c: Fixed problem with offset value manipulation\n\tas per bug http://bugzilla.remotesensing.org/show_bug.cgi?id=1322\n\n\t* libtiff/{tif_read.c, tif_jpeg.c, tif_dir.c}: More fixes for\n\tvulnerabilities, reported in Gentoo bug ():\n\n\thttp://bugs.gentoo.org/show_bug.cgi?id=142383\n\n2006-09-28  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/{tif_fax3.c, tif_next.c, tif_pixarlog.c}: Fixed multiple\n\tvulnerabilities, as per\tGentoo bug ():\n\n\thttp://bugs.gentoo.org/show_bug.cgi?id=142383\n\n2006-09-27  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_lzw.c, libtiff/tif_zip.c: Fixed problems with mixing\n\tencoding and decoding on the same read-write TIFF handle.  The LZW\n\tcode can now maintain encode and decode state at the same time. The\n\tZIP code will switch back and forth as needed.  \n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=757\n\n2006-09-20  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff: Rename config.h.vc and tif_config.h.vc to config.vc.h and \n\ttif_config.vc.h for easier identification by folks using an IDE.\n\n2006-07-25  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* tif_msdos.c: Avoid handle leak for failed opens.  c/o Thierry Pierron\n\n2006-07-19  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* tif_dirwrite.c: take care not to flush out buffer of strip/tile\n\tdata in _TIFFWriteDirectory if TIFF_BEENWRITING not set.  Relates\n\tto bug report by Peng Gao with black strip at bottom of images.\n\n2006-07-12  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* tif_dirwrite.c: make sure to use uint32 for wordcount in \n\tTIFFWriteNormanTag if writecount is VARIABLE2 for ASCII fields.\n\tIt already seems to have been done for other field types.  Needed\n\tfor \"tiffset\" on files with geotiff ascii text.\n\n2006-07-04  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>\n\n\t* {configure.ac, libtiff/tif_config.h.vc, libtiff/tif_jbig.c}\n\t(JBIGDecode): jbg_newlen is not available in older JBIG-KIT and\n\tits use does not appear to be required, so use it only when it is\n\tavailable.\n\n2006-06-24  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_dirinfo.c: Added missed EXIF tag ColorSpace (40961).\n\n\t* libtiff/tif_dirread.c: Move IFD fetching code in the separate\n\tfunction TIFFFetchDirectory() avoiding code duplication in\n\tTIFFReadDirectory() and TIFFReadCustomDirectory().\n\n2006-06-19  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* tools/tiff2pdf.c: Fix handling of -q values.\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=587\n\n2006-06-17  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* tif_readdir.c: Added case in EstimateStripByteCounts() for tiled\n\tfiles.  Modified TIFFReadDirectory() to not invoke \n\tEstimateStripByteCounts() for case where entry 0 and 1 are unequal\n\tbut one of them is zero. \n\t  http://bugzilla.remotesensing.org/show_bug.cgi?id=1204\n\n2006-06-08  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/{tif_open.c, tif_dirread.c, tiffiop.h}: Move IFD looping\n\tchecking code in the separate function TIFFCheckDirOffset().\n\n\t* libtiff/tif_aux.c: Added _TIFFCheckRealloc() function.\n\n\t* tools/tiffcmp.c: Fixed floating point comparison logic as per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1191\n\n\t* libtiff/tif_fax3.c: Fixed problems in fax decoder as per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1194\n\n\t* tools/tiff2pdf.c: Fixed buffer overflow condition in\n\tt2p_write_pdf_string() as per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1196\n\n2006-06-07  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* {configure, configure.ac, libtiff/tif_jbig.c, tools/tiffcp.c}: Added\n\tsupport for JBIG compression scheme (34661 code) contributed by Lee\n\tHoward. As per bug\n\t\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=896\n\n\t* configure, configure.ac: OJPEG support enabled by default.\n\n\t* contrib/ojpeg/: Removed. New OJPEG support does not need this patch.\n\n2006-06-03  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>\n\n\t* libtiff/{tif_dirinfo.c, tif_print.c} : Fix crash in\n\tTIFFPrintDirectory().  Joris Van Damme authored the fix.\n\n2006-04-21  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tools/tiff2pdf.c: Unified line ending characters (always use '\\n')\n\tas per bug http://bugzilla.remotesensing.org/show_bug.cgi?id=1163\n\n\t* README.vms, Makefile.am, configure.com, libtiff/{Makefile.am,\n\ttif_config.h-vms, tif_stream.cxx, tif_vms.c, tiffconf.h-vms}:\n\tAdded support for OpenVMS by Alexey Chupahin, elvis_75@mail.ru.\n\n2006-04-20  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tools/{fax2ps.c, fax2tiff.c, ppm2tiff.c, ras2tiff.c, tiff2pdf.c}:\n\tProperly set the binary mode for stdin stream as per bug\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1141\n\n\t* man/{bmp2tiff.1, fax2ps.1, fax2tiff.1, gif2tiff.1, ras2tiff.1,\n\traw2tiff.1, rgb2ycbcr.1, sgi2tiff.1, tiff2bw.1, tiff2pdf.1, tiff2ps.1,\n\ttiff2rgba.1, tiffcmp.1, tiffcp.1, tiffdither.1,\ttiffdump.1, tiffgt.1,\n\ttiffset.1}: Improvements in page formatting as per bug\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1140\n\n\t* html/tools.html, html/man/Makefile.am, tools/tiff2pdf.c: Fixed\n\ttypos as per bug http://bugzilla.remotesensing.org/show_bug.cgi?id=1139\n\n2006-04-18  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* nmake.opt: use /EHsc for VS2005 compatibility.  Also define\n\t_CRT_SECURE_NO_DEPRECATE to avoid noise on VS2005. \n\n2006-04-12  Joris Van Damme  <joris.at.lebbeke@skynet.be>\n\n\t* libtiff/tif_getimage.c: Added support for planarconfig separate\n\tnon-subsampled YCbCr (i.e. separate YCbCr with subsampling [1,1])\n\n2006-04-11  Joris Van Damme  <joris.at.lebbeke@skynet.be>\n\t\n\t* libtiff/tif_getimage.c: Revision of all RGB(A) put routines\n\t- Conversion of unassociated alpha to associated alpha now done with\n\t  more performant LUT, and calculation more correct\n\t- Conversion of 16bit data to 8bit data now done with\n\t  more performant LUT, and calculation more correct\n\t- Bugfix of handling of 16bit RGB with unassociated alpha\n\n2006-04-11  Joris Van Damme  <joris.at.lebbeke@skynet.be>\n\t\n\t* libtiff/tif_getimage.c: \n\t- When there is no alpha, gtTileSeparate and gtStripSeparate allocated \n\t  buffer for alpha strile and filled it, only to never read it back. \n\t  Removed allocation and fill.\n\t- Minor rename of vars in gtTileSeparate and gtStripSeparate \n\t  anticipating planned functionality extension\n\n2006-04-08  Joris Van Damme  <joris.at.lebbeke@skynet.be>\n\n\t* libtiff/tif_getimage.c: renamed pickTileContigCase to PickContigCase \n\tand pickTileSeparateCase to PickSeparateCase as both work on strips as \n\twell\n\n\t* libtiff/tif_getimage.c: moved img->get selection from \n\tTIFFRGBAImageBegin into PickContigCase and PickSeparateCase to create\n\tlogical hook for planned functionality extension\n\n2006-04-08  Joris Van Damme  <joris.at.lebbeke@skynet.be>\n\n\t* libtiff/tif_ojpeg.c: resolved memory leak that was a consequence\n\tof inappropriate use of jpeg_abort instead of jpeg_destroy\n\n2006-04-07  Joris Van Damme  <joris.at.lebbeke@skynet.be>\n\n\t* libtiff/tif_getimage.c: replaced usage of TIFFScanlineSize in \n\tgtStripContig with TIFFNewScanlineSize so as to fix buggy behaviour\n\ton subsampled images - this ought to get sorted when we feel brave \n\tenough to replace TIFFScanlineSize alltogether\n\n\t* libtiff/tif_ojpeg.c: fixed bug in OJPEGReadSkip\n\n2006-04-04  Joris Van Damme  <joris.at.lebbeke@skynet.be>\n\n\t* libtiff/tiffio.h: added new type tstrile_t\n\n\t* libtiff/tif_dir.h: changed types of td_stripsperimage and td_nstrips \n\tto new tstrile_t, types of td_stripoffset and td_stripbytecount to \n\ttoff_t*\n\n\t* libtiff/tif_ojpeg.c: totally new implementation\n\n\t* libtiff/tif_dirread.c: added several hacks to suit new support of \n\tOJPEG\n\n\t* libtiff/tif_getimage.c: removed TIFFTAG_JPEGCOLORMODE handling\n\tof OJPEG images in favor of tif_getimage.c native handling of\n\tYCbCr and desubsampling\n\n2006-03-29  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_jpeg.c: JPEGVSetField() so that altering the photometric\n\tinterpretation causes the \"upsampled\" flag to be recomputed.  Fixes\n\tpeculiar bug where photometric flag had to be set before jpegcolormode\n\tflag.\n\n2006-03-25  Joris Van Damme  <joris.at.lebbeke@skynet.be>\n\n\t* libtiff/tif_jpeg.c: strip size related bugfix in encode raw\n\n\t* libtiff/tif_strip.c: temporarilly added two new versions of\n\tTIFFScanlineSize\n\t  - TIFFNewScanlineSize: proposed new version, after all related\n\t    issues and side-effects are sorted out\n\t  - TIFFOldScanlineSize: old version, from prior to 2006-03-21 change\n\tThis needs further sorting out.\n\n2006-03-25  Joris Van Damme  <joris.at.lebbeke@skynet.be>\n\n\t* contrib/addtiffo/tif_ovrcache.c: bugfix to correctly pass size\n\tof last truncated strip data to TIFFWriteEncodedStrip\n\n2006-03-25  Joris Van Damme  <joris.at.lebbeke@skynet.be>\n\n\t* libtiff/{tif_jpeg.c, tif_strip.c}: bugfix of tif_jpeg decode raw\n\n2006-03-25  Joris Van Damme  <joris.at.lebbeke@skynet.be>\n\n\t* libtiff/tif_getimage.c: bugfix/rewrite of putcontig8bitYCbCr22tile\n\n\t* libtiff/tif_getimage.c: added putcontig8bitYCbCr12tile\n\n\t* libtiff/tif_read.c: added support for new TIFF_NOREADRAW flag to \n\tprepare\tthe path for new tif_ojpeg.c\n\n2006-03-23  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff 3.8.2 released.\n\n\t* tools/Makefile.am: Use runtime paths linker flags when rpath\n\toption enabled.\n\n2006-03-21  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/libtiff.def: Added missed exports as per bug\n\thttp://bugzilla.remotesensing.org/attachment.cgi?id=337\n\n\t* contrib/addtiffo/Makefile.vc, libtiff/Makefile.vc, port/Makefile.vc,\n\ttools/Makefile.vc: Makefiles improvements as per bug\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1128\n\n\t* nmake.opt libtiff/{tif_config.h.vc, tif_unix.c, tiffio.h},\n\ttools/{fax2ps.c, fax2tiff.c, tiff2pdf.c}: Fixed win32 I/O functions\n\tusage as per bug http://bugzilla.remotesensing.org/show_bug.cgi?id=1127\n\n\t* libtiff/tif_strip.c: Take subsampling in account when calculating\n\tTIFFScanlineSize().\n\n\t* tools/tiffcp.c: Do not set RowsPerStrip bigger than image length.\n\n2006-03-17  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tools/fax2tiff.c: Fixed wrong TIFFerror() invocations as per bug\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1125\n\n\t* tools/fax2ps.c: Fixed reading the input stream from stdin as per bug\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1124\n\n2006-03-16  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tiffiop.h: Added decalration for\n\t_TIFFSetDefaultCompressionState().\n\n\t* libtiff/{tif_jpeg.c, tif_fax3.c, tif_zip.c, tif_pixarlog.c,\n\ttif_lzw.c, tif_luv.c}: Use _TIFFSetDefaultCompressionState() in all\n\tcodec cleanup methods. As per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1120\n\n2006-03-15  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_jpeg.c: Do not cleanup codec state in TIFFInitJPEG(). As\n\tper bug http://bugzilla.remotesensing.org/show_bug.cgi?id=1119\n\n\t* tools/raw2tiff.c: Do not set RowsPerStrip larger than ImageLength.\n\tAs per bug http://bugzilla.remotesensing.org/show_bug.cgi?id=1110\n\n\t* libtiff/tiffiop.h: dblparam_t typedef removed; GLOBALDATA macro\n\tremoved; move here the STRIP_SIZE_DEFAULT macro definition.\n\n\t* libtiff/{tif_dirread.c, tif_strip.c}: Removed STRIP_SIZE_DEFAULT\n\tmacro definition.\n\n\t* libtiff/tif_dir.c: Use double type instead of dblparam_t.\n\n2006-03-14  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_dirread.c: Do not check the PlanarConfig tag presence\n\tin TIFFReadDirectory, because it is always set at the start of\n\tfunction and we allow TIFFs without that tag set.\n\n2005-03-13  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff 3.8.1 released.\n\n2006-03-07  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_dirread.c: Fixed error reporting in TIFFFetchAnyArray()\n\tfunction as per bug\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1102\n\n\t* libtiff/tif_dirread.c: More wise check for integer overflow\n\tcondition as per bug\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1102\n\n\t* libtiff/{tif_jpeg.c, tif_pixarlog.c, tif_fax3.c, tif_zip.c}:\n\tProperly restore setfield/getfield methods in cleanup functions. As\n\tper bug http://bugzilla.remotesensing.org/show_bug.cgi?id=1102\n\n2006-03-03  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/{tif_predict.c, tif_predict.h}: Added new function\n\tTIFFPredictorCleanup() to restore parent decode/encode/field methods.\n\n\t* libtiff/{tif_lzw.c, tif_pixarlog.c, tif_zip.c}: Use\n\tTIFFPredictorCleanup() in codec cleanup methods. As per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1102\n\n\t* libtiff/tif_dirread.c: Fixed integer overflow condition in\n\tTIFFFetchData() function. As per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1102\n\n2006-03-01  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_ojpeg.c: Set the ReferenceBlackWhite with the\n\tTIFFSetField() method, not directly. As per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1043\n\n\t* tools/ppm2tiff.c: Added support for PBM files as per bug\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1044\n\n2006-02-27  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_write.c: Small code rearrangement in TIFFWriteScanline()\n\tto avoid crash as per bug\n\t\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1081.\n\n2006-02-26  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tools/tiff2pdf.c: Functions t2p_sample_rgbaa_to_rgb() and\n\tt2p_sample_rgba_to_rgb() was used in place of each other, that was\n\tresulted in problems with RGBA images with associated alpha.\n\tAs per bug http://bugzilla.remotesensing.org/show_bug.cgi?id=1097\n\n2006-02-23  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_dirwrite.c: Properly write TIFFTAG_DOTRANGE tag as per\n\tbug http://bugzilla.remotesensing.org/show_bug.cgi?id=1088.\n\n\t* libtiff/tif_print.c: Properly read TIFFTAG_PAGENUMBER,\n\tTIFFTAG_HALFTONEHINTS, TIFFTAG_YCBCRSUBSAMPLING and TIFFTAG_DOTRANGE\n\ttags as per bug http://bugzilla.remotesensing.org/show_bug.cgi?id=1088.\n\n\t* tools/tiff2ps.c: Properly scale all the pages when converting\n\tmultipage TIFF with /width/height/center options set. As per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1080\n\n2006-02-15  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tools/tiff2pdf.c: Do not create output file until all option checks\n\twill be done. As per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1072\n\n\t* tools/bmp2tiff.c: Added ability to create multipage TIFFs from the\n\tlist of input files as per bug:\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1077\n\n2006-02-09  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_tile.c: Fix error reporting in TIFFCheckTile() as per\n\tbug http://bugzilla.remotesensing.org/show_bug.cgi?id=1063.\n\n\t* tools/tiffgt.c: Avoid crashing in case of image unsupported by\n\tTIFFRGBAImage interface.\n\n\t* libtiff/tif_color.c: Avoid overflow in case of wrong input as per\n\tbug http://bugzilla.remotesensing.org/show_bug.cgi?id=1065.\n\n2006-02-07  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* tools/tiff2pdf.c: Fixed support for non-YCbCr encoded JPEG\n\tcompressed TIFF files, per submission from Dan Cobra. \n\n2006-02-07  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/{tif_dirread.c, tif_packbits.c, tif_win32.c}: Properly\n\tcast values to avoid warnings. As per bug\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1033.\n\n\t* libtiff/tif_dirinfo.c: Use TIFF_NOTYPE instead of 0 when\n\tappropriate. As per bug\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1033.\n\n\t* libtiff/tif_aux.c: Fixed type of temporary variable in\n\t_TIFFCheckMalloc() as per bug\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1033.\n\n2006-02-06  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_aux.c: Return static array when fetching default\n\tYCbCrCoefficients (another problem, reported a the\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1029 entry).\n\n2006-02-03  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_dir.c: Special handling for PageNumber, HalftoneHints,\n\tYCbCrSubsampling and DotRange tags as per bugs\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1029\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1034\n\n\t* libtiff/tif_dirread.c: Use _TIFFGetExifFieldInfo() instead of\n\t_TIFFGetFieldInfo() in TIFFReadEXIFDirectory() call as per bug\n\t\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1026.\n\n2006-01-23  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtool related stuff updated from the 2.1a branch.\n\n2006-01-11  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* tools/bmp2tiff,pal2rgb,ppm2tiff,ras2tiff,raw2tiff,sgi2tiff,\n\ttiff2bw,tiffcp: Fixed jpeg option processing so -c jpeg:r:50 works\n\tproperly as per bug:\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1025\n\n2006-01-09  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>\n\n\t* configure.ac: Fix with_default_strip_size comparison as reported\n\tby Norihiko Murase.\n\n2006-01-08  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>\n\n\t* test/Makefile.am (LIBTIFF): Due to linking against libtiff\n\tincorrectly, tests were not actually testing the uninstalled\n\tlibtiff.  Now they are.\n\n2006-01-04  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_dirinfo.c: Change definitions for TIFFTAG_ICCPROFILE,\n\tTIFFTAG_PHOTOSHOP, TIFFTAG_RICHTIFFIPTC, TIFFTAG_XMLPACKET: readcount\n\tshould be uint32 value.\n\n2006-01-02  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>\n\n\t* html/man/Makefile.am (htmldoc): Fix htmldoc rule so that it can\n\tbe used if build directory is not the same as source directory.\n\t* man/{TIFFGetField.3tiff, TIFFSetField.3tiff}: Documented\n\tTIFFTAG_PHOTOSHOP, TIFFTAG_RICHTIFFIPTC, and TIFFTAG_XMLPACKET,\n\tand re-sorted tag names in alphabetical order.\n\n2005-12-29  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff 3.8.0 released.\n\n2005-12-28  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>\n\n\t* tools/bmp2tiff.c (main): Fixed warning regarding returning\n\tinconsistent types from a condition.\n\t* tools/tiffcmp.c (CheckLongTag): Eliminate warning due to printf\n\tformat.\n\t* tools/bmp2tiff.c: Reduce compilation warnings on big-endian CPUs.\n\n2005-12-28  Joris Van Damme  <joris.at.lebbeke@skynet.be>\n\n\t* html/{index.html, support.hml, libtiff.html}: Cleaned up HTML\n\n2005-12-27  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tiffio.h: Added VC_EXTRALEAN definition before including\n\twindows.h, to reduce the compile time.\n\n2005-12-26  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>\n\n\t* libtiff/tif_jpeg.c: Improve compilation under MinGW.\n\n2005-12-26  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/{tif_dir.c, tif_dir.h, tif_dirread.c, tif_dirinfo.c}: \n\ttiffFieldInfo and exifFieldInfo arrays definitions moved back to\n\ttif_dirinfo.c; added _TIFFGetFieldInfo() and _TIFFGetExifFieldInfo()\n\tprivate functions to retrieve FieldInfo arrays.\n\n2005-12-24  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>\n\n\t* html/build.html: Added some additional instructions for when\n\tbuilding using MSVC under Windows.  Also fixed two HTML syntax\n\terrors and used HTML Tidy to tidy up the HTML syntax and\n\tformatting.\n\n2005-12-24  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/{tif_aux.c, tif_dir.c, tif_dir.h, tif_dirwrite.c,\n\ttif_print.c, tif_getimage.c}: Make InkSet, NumberOfInks, DotRange and\n\tStoNits tags custom.\n\n2005-12-23  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/{tif_aux.c, tif_dir.c, tif_dir.h, tif_print.c}: Make\n\tWhitePoint tag custom.\n\n\t* libtiff/{tif_dir.h, tiff.h}: More EXIF tags added.\n\n2005-12-23  Joris Van Damme  <joris.at.lebbeke@skynet.be>\n\n\t* libtiff/tiffio.h: fixed typo that potentially resulted in \n\tredefininition of USE_WIN32_FILEIO\n\n\t* libtiff/*: Added more 'dual-mode' error handling: Done TIFFWarning \n\tcalls in core LibTiff.\n\n2005-12-21  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/{tif_dir.c, tif_dir.h, tif_print.c}: Make RichTIFFIPTC,\n\tPhotoshop and ICCProfile tags custom.\n\n2005-12-21  Joris Van Damme  <joris.at.lebbeke@skynet.be>\n\n\t* libtiff/*, contrib/*: Added 'dual-mode' error handling, enabling \n\tnewer code to get context indicator in error handler and still\n\tremain compatible with older code: Done TIFFError calls everywhere \n\texcept in tools   \n\n2005-12-20  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tools/tiffcp.c: Added many error reporting messages; fixed integer\n\toverflow as per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=789\n\n2005-12-16  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* contrib/addtiffo/*: Major upgrade by Joris to support subsampled\n\tYCbCr images in jpeg compressed TIFF files.\n\n2005-12-14  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tools/tiffcp.c: Return non-zero status when reading fails (again).\n\n2005-12-13  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tools/tiffcp.c: Return non-zero status when reading fails.\n\n2005-12-12  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/{tif_dir.h, tiff.h}: Added more EXIF tags.\n\n2005-12-09  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/{tif_dir.c, tif_dir.h, tif_print.c}: Make XMLPacket tag\n\tcustom.\n\n\t* tools/tiffinfo.c: Print EXIF directory contents if exist.\n\n\t* libtiff/tiff.h: Few EXIF tag numbers added.\n\n\t* libtiff/{tif_dirinfo.c, tif_dirread.c, tif_dir.h, tif_dir.c,\n\ttiffio.h}: Preliminary support to read custom directories. New\n\tfunctions: TIFFReadCustomDirectory() and TIFFReadEXIFDirectory().\n\n2005-12-07  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/{tif_dirinfo.c, tif_dirread.c, tif_dir.h, tif_dir.c}:\n\tMore work to implement custom directory read support.\n\n\t* libtiff/{tif_aux.c, tif_dirinfo.c, tif_dirread.c, tif_dir.h,\n\ttif_dir.c, tif_print.c}: Make YCbCrCoefficients and ReferenceBlackWhite\n\ttags custom.\n\n2005-12-05  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_dirread.c: One more workaround for broken\n\tStripByteCounts tag. Handle the case when StripByteCounts array filled\n\twith completely wrong values.\n\n2005-11-30  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_dirinfo.c: Release file descriptor in case of failure\n\tin the TIFFOpenW() function as per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1003\n\n\t* libtiff/tif_dirinfo.c: Correctly yse bsearch() and lfind()\n\tfunctions as per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1008\n\n2005-11-20  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* tif_open.c, tiff.h, tiffdump.c: Incorporate preliminary support\n\tfor MS MDI format.\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1002\n\n\t* .cvsignore: many files added, and a few update according\n\tto suggestion of Brad HArds on tiff mailing list. \n\n2005-11-03  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/libtiff.def, tiffiop.h, tiffio.h: Made TIFFFreeDirectory\n\tpublic.\n\n2005-10-31  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tools/fax2tiff.c: Properly calculate sizes of temporary arrays\n\tas per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=943\n\n\t* tools/fax2tiff.c: Added option '-r' to set RowsPerStrip parameter\n\tas per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=944\n\n\t* tools/tiffdump.c: Fixed typeshift and typemask arrays initialization\n\tproblem as per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=946\n\n\t* tools/bmp2tiff.c: Fixed possible integer overflow error as per bug\n\t\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=965\n\n\t* libtiff/tif_dirinfo.c: Make XResolution, YResolution and\n\tResolutionUnit tags modifiable during write process. As per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=977\n\n\t* tools/tiffsplit.c: Copy fax related fields over splitted parts\n\tas per bug\n\t\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=983\n\n2005-10-21  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* tif_dirread.c: Don't try and split single strips into \"0\" strips\n\tin ChopUpSingleUncompressedStrip.  This happens in some degenerate\n\tcases (like 1x1 files with stripbytecounts==0 (gtsmall.jp2 embed tiff)\n\n2005-10-20  Joris Van Damme  <joris.at.lebbeke@skynet.be>\n\n\t* tif_fax3.c: changed 'at scanline ...' style warning/errors\n\twith incorrect use of tif_row, to 'at line ... of\n\tstrip/tile ...' style\n\n2005-10-15  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* tif_write.c: fixed setting of planarconfig as per bug report\n\ton the mailing list from Joris.\n\n2005-10-07  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* configure.ac, configure, nmake.opt, libtiff/{tif_config.h,\n\ttif_dirread.c}: Make the default strip size configurable via the\n\t--with-default-strip-size and STRIP_SIZE_DEFAULT options.\n\n2005-09-30  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>\n\n\t* html/support.html: Fixed link to documentation on Greg Ward's\n\tLogLuv TIFF format.\n\n2005-09-28  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tools/tiffdump.c: Fixed crash when reading malformed tags.\n\n2005-09-20  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tools/tiff2pdf.c: Added missed 'break' statement as per bug\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=932\n\n2005-09-12  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff 3.7.4 released.\n\n\t* {configure, configure.ac, Makefile.am, autogen.sh}: Applied patch\n\tfrom Patrick Welche (all scripts moved in the 'config' and 'm4'\n\tdirectories).\n\n2005-09-12  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_open.c: reintroduce seek to avoid problem on solaris.\n\n2005-09-05  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_dir.c: When prefreeing tv->value in TIFFSetFieldV\n\talso set it to NULL to avoid double free when re-setting custom\n\tstring fields as per: \n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=922\n\n2005-08-12  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_print.c: avoid signed/unsigned warning.\n\n\t* libtiff/tif_dirread.c: removed unused variable.\n\n2005-07-30  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_dir.c: Fixed up support for swapping \"double complex\"\n\tvalues (128 bits as 2 64 bits doubles).  GDAL gcore tests now\n\tpass on bigendian (macosx) system.\n\n2005-07-28  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/{tif_aux.c, tif_dirread.c, tif_fax3.c, tiffiop.h}: Rename\n\tCheckMalloc() function to _TIFFCheckMalloc() and make it available\n\tglobally as an internal helper routine.\n\n2005-07-27  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_dir.c: More improvements in the \"pass by value\" part of\n\tthe custom tags handling code.\n\n2005-07-26  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/{tif_dirread.c, tif_dirinfo.c}: Do not upcast BYTEs to\n\tSHORTs in the TIFFFetchByteArray(). Remove TIFFFetchExtraSamples()\n\tfunction, use TIFFFetchNormalTag() instead as per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=831\n\n\tRemove TIFFFetchExtraSamples() function, use TIFFFetchNormalTag()\n\tinstead. \n\n\t* libtiff/tiffconf.h.in: One more attempt to fix the AIX bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=39\n\n2005-07-25  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_print.c: Fixed printing of the BYTE and SBYTE arrays.\n\n\t* tools/tiffdump.c: Added support for TIFF_IFD datatype.\n\n2005-07-21  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_write.c: Do not check the PlanarConfiguration field in\n\tthe TIFFWriteCheck() function in case of single band images (as per\n\tTIFF spec).\n\n2005-07-12  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* SConstruct, libtiff/SConstruct: Added the first very preliminary\n\tsupport for SCons software building tool (http://www.scons.org/).\n\tThis is experimental infrastructure and it will exist along with the\n\tautotools mechanics.\n\n2005-07-07  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* port/{getopt.c, strcasecmp.c, strtoul.c}: Update modules from\n\tthe NetBSD source tree (the old\t4-clause BSD license changed to\n\tthe new 3-clause one).\n\n\t* configure.ac, port/lfind.c, libtiff/tiffiop.h: Added lfind()\n\treplacement module.\n\n\t* port/dummy.c: Make the dummy function static.\n\n2005-07-06  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tools/tiffcp.c: Fixed WhitePoint tag copying.\n\n\t* libtiff/{tif_dir.c, tif_dir.h, tif_dirinfo.c, tif_print.c}:\n\tMake FieldOfViewCotangent, MatrixWorldToScreen, MatrixWorldToCamera,\n\tImageFullWidth, ImageFullLength and PrimaryChromaticities tags custom.\n\n2005-07-04  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff 3.7.3 released.\n\n\t* configure, configure.ac: Do not use empty -R option when linking\n\twith --enable-rpath.\n\n2005-07-01  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/{tiffiop.h, tif_open.c}: Added open option 'h' to avoid\n\treading the first IFD when needed. As per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=875\n\n\t* libtiff/tif_color.c: Better use of TIFFmin() macro to avoid side\n\teffects.\n\n2005-06-23  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tools/tiff2pdf.c: Print two characters per loop in the\n\tt2p_write_pdf_trailer(). As per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=594\n\n\t* tools/tiffgt.c: Use MacOS X OpenGL framework when appropriate. As\n\tper bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=844\n\n\t* acinclude.m4: Updated to latest OpenGL test macros versions.\n\n\t* libtiff/tiff.h: Use correct int size on Sparc 64bit/Sun compiler\n\tplatform. As per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=855\n\n2005-06-14  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_dirinfo.c: Added support for ClipPath, XClipPathUnits\n\tand YClipPathUnits tags.\n\n2005-06-07  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* contrib/addtiffo/tif_ovrcache.c: Properly extract tile/strip size;\n\tuse pixel sized shift in contigous case.\n\n2005-06-06  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* contrib/addtiffo/{tif_overview.c, tif_ovrcache.c, tif_ovrcache.h}:\n\tMake overviews working for contiguos images.\n\n2005-06-03  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_open.c: Replace runtime endianess check with the compile\n\ttime one.\n\n\t* libtiff/tif_predict.c: Floating point predictor now works on\n\tbig-endian hosts.\n\n2005-06-01  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_dir.c: Use _TIFFsetString() function when read custom\n\tASCII values.\n\n\t* libtiff/{tif_dirinfo.c, tif_dir.h, tif_dir.c, tif_print.c}: Make\n\tDocumentName, Artist, HostComputer, ImageDescription, Make, Model,\n\tCopyright, DateTime, PageName, TextureFormat, TextureWrapModes and\n\tTargetPrinter tags custom.\n\n\t* libtiff/tif_jpeg.c: Cleanup the codec state depending on\n\tTIFF_CODERSETUP flag (to fix memry leaks).\n\n\t* libtiff/tif_jpeg.c: Initialize JPEGTables array with zero after\n\tallocating.\n\n2005-05-26  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* configure.ac, libtiff/Makefile.am: Added workaround for\n\tOpenBSD/MirOS soname problem as per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=838\n\n\t* libtiff/tif_dirwrite.c: Use tdir_count when calling\n\tTIFFCvtNativeToIEEEDouble() in the TIFFWriteDoubleArray() function as\n\tper bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=845\n\n2005-05-25  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tools/ppm2tiff.c: Fixed format string when read PPM file header with\n\tthe fscanf() function. As per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=861\n\n\t* libtiff/{tif_dirinfo.c, tif_print.c}: TIFFFetchByteArray() returns\n\tuint16 array when fetching the BYTE and SBYTE filds, so we should\n\tconsider result as pointer to uint16 array and not as array of chars.\n\tAs per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=831\n\n\t* libtiff/tif_dir.c: More efficient custom tags retrieval as per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=830\n\n\t* libtiff/tif_win32.c: Use FILE_SHARE_READ | FILE_SHARE_WRITE share\n\tmode in CreateFile() call as per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=829\n\n\t* libtiff/Makefile.am: Fixed parallel compilation of the libtiff and\n\tlibtiffxx libraries as per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=826\n\n\t* contrib/addtiffo/{tif_overview.c, tif_ovrcache.h}: Sinchronized with\n\tGDAL.\n\n2005-05-23  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_jpeg.c: Substantial fix for addtiffo problems with\n\tJPEG encoded TIFF files.  Pre-allocate lots of space for jpegtables\n\tin directory.\n\n2005-05-22  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_dirread.c: Changed the code that computes \n\tstripbytecount[0] if it appears bogus to ignore if stripoffset[0] is\n\tzero. This is a common case with GDAL indicating a \"null\" tile/strip.\n\n2005-05-17  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tools/tiffsplit.c: Check for JPEGTables tag presence before copying.\n\n2005-05-06  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_dirread.c: Applied similar change to \n\tTIFFFetchPerSampleLongs and TIFFFetchPerSampleAnys. \n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=843\n\n\t* libtiff/tif_jpeg.c: added LIB_JPEG_MK1 support in JPEGDecodeRaw().\n\n2005-05-06  Andrey Kiselev  <dron@ak4719.spb.edu>\n\t* tools/tiff2pdfr.c, man/tiff2pdf.1: Calculate the tile width properly;\n\tadded new option '-b' to use interpolation in output PDF files (Bruno\n\tLedoux).\n\n2005-05-05  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_dirread.c: Ensure that broken files with too many\n\tvalues in PerSampleShorts work ok instead of crashing.\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=843\n\n2005-04-27  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tools/tiffdither.c: Copy the PhotometricInterpretation tag from the\n\tinput file.\n\n2005-04-15  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_predict.c: Added ability to encode floating point\n\tpredictor, as per TIFF Technical Note 3.\n\n2005-04-14  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/{tif_predict.h, tif_predict.c}: Added ability to decode\n\tfloating point predictor, as per TIFF Technical Note 3.\n\n2005-04-13  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/{tiffio.h, tiffiop.h, tif_dir.c, tif_read.c, tif_swab.c}:\n\tAdded _TIFFSwab24BitData() and TIFFSwabArrayOfLong() functions used to\n\tswap 24-bit floating point values.\n\n\t* libtiff/tiff.h: Added predictor constants.\n\n2005-04-08  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/{tiffiop.h, tif_dir.c}: Use uint32 type for appropriate\n\tvalues in _TIFFVSetField() function. Inspired by the bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=816\n\n\t* man/TIFFSetField.3tiff: Fixed definition of the TIFFTAG_INKNAMES tag\n\tas per bug\n\t\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=816\n\n2005-03-30  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_open.c: Do not read header in case the output file\n\tshould be truncated (Ron).\n\n\t* libtiff/{tif_dirinfo.c, tif_config.h.vc}: Use lfind() instead\n\tof bsearch() in _TIFFFindFieldInfoByName() function (Ron).\n\n\t* libtiff/{tiff.h, tif_dirinfo.c}: Fixes in EXIF tag ordering (Ron).\n\n2005-03-22  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* configure.ac, libtiff/Makefile.am: Use libtool machinery to pass\n\trpath option.\n\n2005-03-21  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/{tif_dir.c, tif_print.c}: Handle all data types in custom\n\ttags.\n\n2005-03-18  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/dirinfo.c: Added DNG tags.\n\n\t* libtiff/{tif_dir.c, tif_print.c}: More improvements in custom tag\n\thandling code.\n\n\t* libtiff/tiff.h: More comments; added missed DNG tag (LensInfo);\n\tadded DNG 1.1.0.0 tags.\n\n\t* tools/tif2pdf.c: Fixed problem with alpha channel handling as per\n\tbug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=794\n\n\t* man/TIFFGetField.3tiff: Add a note about autoregistered tags.\n\n2005-03-17  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* nmake.opt: Build with Win32 CRT library by default.\n\n\t* tools/tiff2ps.c: Fixed typo in page size handling code.\n\n\t* libtiff/{tif_dir.c, tif_print.c}: Support for custom tags, passed\n\tby value.\n\n\t* libtiff/{tiff.h, tif_dirinfo.c, tiffiop.h}: Added EXIF related tags.\n\n2005-03-15  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff 3.7.2 released.\n\n2005-03-09  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tools/tiffcmp.c: Added ability to compare the 32-bit integer and\n\tfloating point data; complain on unsupported bit depths.\n\n2005-03-05  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tif_stream.cxx: Use ios namespace instead of ios_base to support\n\tGCC 2.95.\n\n\t* libtiff/{tiff.h, tif_fax3.tif, tif_jpeg.c}: Applied correct patch from\n\tLee Howard for HylaFax DCS tag\n\t(see http://bugzilla.remotesensing.org/show_bug.cgi?id=771)\n\n2005-03-04  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* configure, configure.ac: Use -rpath option instead of -R as per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=732\n\n\t* libtiff/{tiff.h, tif_fax3.tif, tif_jpeg.c}: Applied patch from Lee\n\tHoward to support a new tag TIFFTAG_FAXDCS (34911) used in HylaFax\n\tsoftware. As per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=771\n\n\t* nmake.opt, html/build.html: Add more comments, change the config\n\tfile organization a bit as per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=764\n\n\t* tools/tiffcmp.c: Use properly sized buffer in short arrays comparison\n\tas per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=785\n\n2005-03-03  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_dirread.c: More logic to guess missed strip size as per\n\tbug http://bugzilla.remotesensing.org/show_bug.cgi?id=705\n\n\t* tools/fax2ps.c: Replace insecure mktemp() function with the\n\ttmpfile() as per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=786\n\n2005-02-04  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tiff.h: Changed the int8 definition to be always signed char\n\tas per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=727\n\n\t* libtiff/tiffio.h: Move TIFFOpenW() function into the extern \"C\"{}\n\tblock as per bug\n\t\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=763\n\n2005-02-03  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>\n\n\t* tools/tiffgt.c: Fix problem on big-endian CPUs so that images\n\tdisplay more correctly.  Images display brighter than they should\n\ton a Sun workstation.\n\n2005-02-03  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_dirread.c: Estimate strip size in case of wrong or\n\tsuspicious values in the tags. As per bugs\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=705\n\n\tand\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=320\n\n\t* tools/tiff2ps.c: Fixed problem with page sizes as per bug\n\t\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=742\n\n2005-01-31  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>\n\n\t* libtiff/tiff.h (TIFFTAG_TILEWIDTH): Corrected description.\n\t(TIFFTAG_TILELENGTH): Corrected description.\n\n2005-01-30  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* configure.ac: Fixes for --with-docdir option as per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=759\n\n\t* libtiff/tif_open.c: Remove unnesessary TIFFSeekFile() call as per\n\tbug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=756\n\n\t* libtiff/tif_stream.cxx: Fixes for C++ stream interface from\n\tMichael Rinne and Edward Lam.\n\n2005-01-15  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* configure.ac: Make the documentation directory location configurable\n\tvia the --with-docdir option (as suggested by Jeremy C. Reed).\n\n\t* libtiff/tif_color.c: Use double as the second argument of pow()\n\tfunction in TIFFCIELabToRGBInit(). As per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=741\n\n\t* libtiff/tif_pixarlog.c: Avoid warnings when converting float to\n\tinteger as per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=740\n\n\t* libtiff/tif_getimage.c: Always fill the error message buffer in\n\tTIFFRGBAImageBegin() as per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=739\n\t\n2005-01-12  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_jpeg.c: Added ability to read/write the fax specific\n\tTIFFTAG_FAXRECVPARAMS, TIFFTAG_FAXSUBADDRESS and TIFFTAG_FAXRECVTIME\n\ttags as per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=736\n\n\t* libtiff/tif_win32.c: Fixed message formatting in functions\n\tWin32WarningHandler() and Win32ErrorHandler() as per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=735\n\n\t* tools/tiff2ps.c: Interpret the -w and -h options independently. As\n\tper bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=689\n\n2005-01-11  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tiffio.h: Move the color conversion routines in the 'extern\n\t\"C\"' section as per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=727\n\n\t* libtiff/tiff.h: Restore back the workaround for AIX Visual Age C\n\tcompiler to avoid double definition of BSD types as per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=39\t\n\n\t* libtiff/Makefile.am: Place the C++ stream API in the separate\n\tlibrary called libtiffxx to avoid unneeded dependencies. Probably\n\tthere will be more C++ API in the future. As per bugs\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=733\n\n\tand\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=730\n\n2005-01-05  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tools/tiffdump.c: Fixed problem when read broken TIFFs with the\n\twrong tag counts (Dmitry V. Levin, Martin Pitt).\n\n\t* configure.ac: Replace --disable-c++ with the --disable-cxx option as\n\tper bug http://bugzilla.remotesensing.org/show_bug.cgi?id=730\n\n2004-12-25  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_getimage.c: More fixes for multiple-alpha-channelled\n\tRGB-images as per bug\n\t\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=713\n\n\n\t* tools/tiffset.c: Convert character option to integer value as per\n\tbug http://bugzilla.remotesensing.org/show_bug.cgi?id=725\n\n2004-12-20  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff 3.7.1 released.\n\n\t* html/tiffset.1.html: Add missed manual page as per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=678\n\n\t* libtiff/tiff.h: Revert back libtiff data type definitions as per\n\tbug http://bugzilla.remotesensing.org/show_bug.cgi?id=687\n\n2004-12-19  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_dirread.c: Do not forget about TIFF_VARIABLE2 when\n\tchecking for tag count in TIFFReadDirectory() function. As per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=713\n\n\t* libtiff/{tif_dirread.c, tif_fax3.c}: More argument checking in\n\tCheckMallock() function.\n\n\t* libtiff/tif_getimage.c: Support for multiple-alpha-channelled\n\tRGB-images as per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=718\n\n2004-12-15  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_getimage.c: #define A1 bracketing for clean build on\n\tSunPro compiler. \n\n2004-12-11  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>\n\n\t* autogen.sh: aclocal and autoheader should be executed after\n\tlibtoolize.  Also add '-I .' to aclocal invocation to check\n\tcurrent directory for macros.\n\n2004-12-10  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_dirwrite.c: Always write TIFFTAG_SUBIFD using LONG type\n\tas per bugs\n\t\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=703\n\n\tand\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=704\n\n2004-12-04  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* nmake.opt: Link with the user32.lib in windowed mode. As per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=697\n\n\t* libtiff/tif_win32.c: Use char* strings instead of TCHAR in windowed\n\tmode as per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=697\n\n\t* libtiff/tif_config.in.vc: Removed unneded definitions for\n\tread/open/close/lseek functions to fix the\n\t\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=680\n\t\n2004-12-03  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/{tif_dir.c, tif_dirread.c}: Remove TIFFReassignTagToIgnore()\n\tcall from the TIFFReadDirectory() function. TIFFReassignTagToIgnore\n\tmust be removed in the future, as it was never used properly. As per\n\tbug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=692\n\n2004-11-30  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>\n\n\t* libtiff/tif_jpeg.c: Added a work-around in order to allow\n\tcompilation with the heavily modified version of libjpeg delivered\n\twith Cygwin.\n\n2004-11-29  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_dir.c: Properly handle tags, which have the uint32\n\tcounts. As per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=693\n\n\t* tools/fax2ps.c: Be able to extract the first page (#0). As per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=690\n\n2004-11-28  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_unix.c: Make UNIX module compilable (and usable)\n\ton Windows.\n\n\t* nmake.opt: Add missed DLLNAME variable.\n\n2004-11-26  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/makefile.vc: make it easier to rename the libtiff DLL. \n\n2004-11-24  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* man/libtiff.3tiff: Improvements in the \"LIST OF ROUTINES\" table as\n\tper bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=545\n\n\t* man/tiffset.1: Added manual page for tiffset tool written by Jay\n\tBerkenbilt. As per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=678\n\n2004-11-23  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_error.c: fixed TIFFerror call to be TIFFError.\n\n2004-11-21  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* html/document.html: Updated Adobe web links as per email from Joris.\n\n2004-11-21  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/{tiffio.hxx, tiffio.h}: C++ stream interface moved to new\n\tfile tiffio.hxx. We don't have any C++ in tiffio.h, those who want to\n\tuse C++ streams should #include <tiffio.hxx>.\n\n2004-11-13  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tiff.h: Added Adobe DNG tags.\n\n\t* libtiff/tif_win32.c: Typo fixed.\n\n\t* libtiff/{tif_stream.cxx, tiffio.h}: C++ stream interface updated to\n\tbe compliant with the latest standard. Appropriate additions in\n\tmakefiles now completed.\n\n2004-11-11  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tools/tiffset.c, libtiff/tif_dirinfo.c: Properly handle the\n\tdifferent tag types. As per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=600\n\n2004-11-10  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_aux.c: Set the appropriate ReferenceBlackWhite array for\n\tYCbCr image which lacks that tag (noted by Hans Petter Selasky).\n\n2004-11-09  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_color.c: Division by zero fixed (Hans Petter Selasky).\n\n2004-11-07  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/{tif_stream.cxx, tiffio.h}: Added C++ stream interface\n\tcontributed by Edward Lam (see\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=654 for details).\n\tThough no changes in any makefiles yet.\n\n2004-11-05  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_open.c: Removed close() in TIFFClientOpen() if file\n\tis bad. This is the callers responsibility.\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=651\n\n2004-11-05  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/{tiffio.h, tif_win32.c, libtiff.def}: Added TIFFOpenW()\n\tfunction to work with the double byte strings (used to represent\n\tfilenames in some locales). As per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=625\n\n\t* libtiff/tif_dirread.c: Fixed problem when fetching BitsPerSample and\n\tCompression tags of type LONG from broken TIFFS as per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=662\n\n\t* libtiff/tif_dirinfo.c: Fixed definition for TIFFTAG_RICHTIFFIPTC,\n\tthe writecount should have uint32 type. As per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=662\n\n\t* libtiff/tif_write.c: Fixed wrong if() statement in\n\tTIFFAppendToStrip() function as per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=660\n\n2004-11-04  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_dirinfo.c: Change definition for TIFFTAG_EXTRASAMPLES\n\tfield. The caller should supply a count when setting this field. As\n\tper bug\n\n\t http://bugzilla.remotesensing.org/show_bug.cgi?id=648\n\t\n\t* libtiff/{tif_jpeg.c, tif_ojpeg.c}: TIFFTAG_JPEGTABLES should have\n\tuint32 count. Use this type everywhere.\n\n2004-11-03  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_next.c: avoid use of u_long and u_char types.  Bug 653.\n\n2004-11-02  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* tools/tiff2rgba.c: removed extra newlines in usage message.\n\n2004-10-30  Andrey Kiselev  <dron@ak4719.spb.edu>\n\t\n\t* libtiff/tif_dirwrite.c: Improvements in tag writing code.\n\n\t* tools/tiff2ps.c: Fixed wrong variable data type when read Position\n\ttags (Tristan Hill).\n\n2004-10-30  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tiffiop.h: added fallback definition of assert() if we\n\tdon't have assert.h.\n\n2004-10-29  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_fax3.c: Fixed case with the wrong decode routines\n\tchoosing when the incorrect Group4Options tag set. As per bug\n\t\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=323\n\n\t* libtiff/tif_dirwrite.c: Fixed problem with passing count variable of\n\twrong type when writing the TIFF_BYTE/TIFF_SBYTE tags in\n\tTIFFWriteNormalTag().\n\n2004-10-28  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tools/tiff2ps.c: Fixed wrong variable data type when read Resolution\n\ttags (Peter Fales).\n\n\t* tools/{bmp2tiff.c, raw2tiff.c}: Get rid of stream I/O functions.\n\n2004-10-28  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* tools/tiff2pdf.c: added casts to avoid warnings.\n\n\t* libtiff/libtiff.def: Added several more entry points required\n\tto link fax2tiff.c against the DLL on windows. \n\n2004-10-27  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* configure, configure.ac: Added --enable-rpath option to embed linker\n\tpaths into library binary.\n\n2004-10-26  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tools/tiffset.c: Check the malloc return value (Dmitry V. Levin).\n\n\t* libtiff/{tif_strip.c, tif_tile.c}: Zero division problem fixed\n\t(Vladimir Nadvornik, Dmitry V. Levin).\n\n2004-10-16  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff 3.7.0 released.\n\n2004-10-15  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>\n\n\t* libtiff/tif_jpeg.c: There seems to be no need to include stdio.h\n\tin this file so its inclusion is removed.  Including stdio.h\n\tsometimes incurs an INT32 typedef conflict between MinGW's\n\tbasetsd.h and libjpeg's jmorecfg.h.\n\n2004-10-15  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* man/bmp2tiff.1: Added manual page for bmp2tiff utility.\n\n2004-10-13  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>\n\n\t* tools/tiffcmp.c (leof): Renamed from 'eof' in order to avoid\n\tconflict noticed under MinGW.\n\t* ltmain.sh: Fix for MinGW compilation.\n\n2004-10-13  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* man/tiffsplit.1: Fixed to indicate using aaa-zzz, not aa-zz.\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=635\n\n2004-10-12  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/{tif_dirread.c, tif_jpeg.c, tif_luv.c, tif_ojpeg.c,\n\ttif_pixarlog.c, tif_write.c}: Handle the zero strip/tile sizes\n\tproperly (Dmitry V. Levin, Marcus Meissner).\n\n2004-10-11  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_dirinfo.c: Type of the TIFFTAG_SUBIFD field changed\n\tto TIFF_IFD.\n\n2004-10-10  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tools/bmp2tif.c: Check the space allocation results.\n\n2004-10-09  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_dir.c: Initialize td_tilewidth and td_tilelength fields\n\tof the TIFFDirectory structure with the 0 instead of -1 to avoid\n\tconfusing integer overflows in TIFFTileRowSize() for striped images.\n\n\t* tools/tiff2pdf.c: Fixed TransferFunction tag handling reported\n\tby Ross A. Finlayson.\n\n\t* libtiff/tif_dir.c: Fixed custom tags handling as per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=629\n\n2004-10-08  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_dirinfo.c: Fix bug with tif_foundfield and reallocation\n\tof tif_fieldinfo.  \n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=630\n\n2004-10-04  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>\n\n\t* contrib/iptcutil/README: Added the missing README which goes\n\talong with iptcutil.\n\n2004-10-03  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_compress.c: Improved error reporting in\n\tTIFFGetConfiguredCODECs() (Dmitry V. Levin).\n\n2004-10-02  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff 3.7.0beta2 released.\n\n\t* libtiff/{tif_aux.c, tif_compress.c, tif_dirinfo.c, tif_dirwrite.c,\n\ttif_extension.c, tif_fax3.c, tif_luv.c, tif_packbits.c,\n\ttif_pixarlog.c, tif_write.c}: Added checks for failed memory\n\tallocations and\tinteger overflows (Dmitry V. Levin).\n\n\t* libtiff/tiff.h: Missed TIFF_BIGTIFF_VERSION constant added.\n\n2004-10-01  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_open.c: added a more informative message if a BigTIFF\n\tfile is opened.\n\n2004-09-30  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_dirinfo.c: changed type of XMLPacket (tag 700) to \n\tTIFFTAG_BYTE instead of TIFFTAG_UNDEFINED to comply with the info\n\tin the Adobe XMP Specification.\n\n2004-09-29  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/{tif_jpeg.c, tif_pixarlog.c}: Use _TIFFmemset() instead of\n\tmemset().\n\n\t* libtiff/{tif_dirread.c, tif_strip.c, tif_tile.c}: Applied patches\n\tfrom Dmitry V. Levin to fix possible integer overflow problems.\n\n2004-09-28  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_getimage.c: Check for allocated buffers before clearing\n\t(Dmitry V. Levin).\n\n2004-09-26  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/{tif_dir.h, tif_dir.c, tif_dirread.c, tif_write.c}:\n\tOptimize checking for the strip bounds. \n\n\t* libtiff/{tif_dirread.c, tif_strip.c}: TIFFScanlineSize() and\n\tTIFFRasterScanlineSize() functions report zero in the case of integer\n\toverflow now. Properly handle this case in TIFFReadDirectory()\n\t(patches from Dmitry V. Levin).\n\n2004-09-25  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/{tif_dirinfo.c, tif_strip.c, tif_tile.c}: Use TIFFhowmany8()\n\tmacro where appropriate.\n\n\t* tools/tiff2bw.c: Write ImageWidth/Height tags to output file, as\n\tnoted by Gennady Khokhorin.\n\n\t* libtiff/tif_dirread.c: Always check the return values, returned\n\tby the _TIFFmalloc() (Dmitry V. Levin).\n\n\t* libtiff/tif_dir.c: Fixed possible integer overflow _TIFFset*Array()\n\tfunctions (Dmitry V. Levin).\n\n\t* libtiff/{tif_dirread.c, tif_dir.c, tif_write.c}:\n\tPotential memory leak fixed in TIFFReadDirectory(), _TIFFVSetField(),\n\tTIFFGrowStrips() (found by Dmitry V. Levin).\n\n2004-09-24  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/{tiffio.h, tif_compress.c}: Added TIFFGetConfiguredCODECs()\n\tto get the list of configured codecs.\n\n\t* libtiff/{tiffiop.h, tif_dirread.c}: More overflow fixes from\n\tDmitry V. Levin.\n\n2004-09-23  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_dirread.c: Applied patch from Dmitry V. Levin to fix\n\tpossible integer overflow in CheckMalloc() function.\n\n2004-09-22  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/{tiffiop.h, tif_strip.c}: Use TIFFhowmany8() macro instead\n\tof plain TIFFhowmany() where appropriate.\n\n2004-09-21  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_getimage.c: Initialize arrays after space allocation.\n\n2004-09-19  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff 3.7.0beta released.\n\n\t* libtiff/{tif_luv.c, tif_next.c, tif_thunder.c}: Several buffer\n\toverruns fixed, as noted by Chris Evans.\n\n2004-09-14  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>\n\n\t* commit: Added a script to make it more convenient to commit\n\tupdates.  The CVS commit message is extracted from this ChangeLog\n\tfile.\n\n2004-09-14  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* configure.ac, configure, aclocal.m4, libtiff/{mkspans.c, tif_fax3.c,\n\ttif_getimage.c, tif_luv.c, tif_lzw.c, tif_ojpeg.c, tif_packbits.c,\n\ttif_predict.c, tif_read.c, tif_swab.c, tif_thunder.c, tif_write.c,\n\ttif_dir.c, tif_dirread.c, tif_dirwrite.c, tif_jpeg.c, tif_dirinfo.c,\n\ttif_vms.c, tif_print.c, tif_strip.c, tif_tile.c, tif_dir.h,\n\ttif_config.h.in, tiffiop.h}:\n\tGet rid of BSD data types (u_char, u_short, u_int, u_long).\n\n2004-09-13  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>\n\n\t* libtiff/tiff.h: Fix column tagging. Reference current Adobe XMP\n\tspecification. Reference libtiff bug tracking system to submit\n\tprivate tag additions.\n\n2004-09-12  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>\n\n\t* tools/tiffgt.c: Include \"tif_config.h\".\n\n\t* configure.ac: Use AM_PROG_CC_C_O since it is now needed to build\n\ttiffgt.  This results in the 'compile' script being added to the\n\tproject.\n\n\t* tools/Makefile.am (tiffgt_CFLAGS): Add extra build options\n\trequired to find OpenGL headers necessary to build tiffgt.  Also\n\tensure that the libtiff that we built is used rather than some other\n\tlibtiff installed on the system.\n\n2004-09-12  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* configure.ac, acinclude.m4, aclocal.m4: New macros to detect GLUT\n\tlibraries.\n\n2004-09-11  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>\n\n\t* configure.ac: Pass library configuration defines via\n\ttif_config.h rather than extending CPPFLAGS. Configure a\n\tlibtiff/tiffconf.h in order to satisfy application requirements\n\t(not used by library build). Do not define _POSIX_C_SOURCE=2 since\n\tthis causes failure to build on systems which properly respect\n\tthis request.\n\n\t* libtiff/tiffconf.h.in: New file to act as the template for the\n\tconfigured tiffconf.h\n\n\t* libtiff/files.lst (HDRS): Install the configured tiffconf.h.\n\n2004-09-10  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* html/internals.html: Split off a discussion of adding new tags\n\tinto addingtags.html.\n\n2004-09-10  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* test/{ascii_tag.c, long_tag.c}: Preliminary test suite added.\n\n\t* tools/tiff2pdf.c: Fixed reading TransferFunction tag as per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=590\n\n\t* libtiff/tif_print.c: Fixes in InkNames and NumberOfInks reporting.\n\n\t* libtiff/tif_dirread.c: Don't reject to read tags of the\n\tSamplesPerPixel size when the tag count is greater than number of\n\tsamples as per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=576\n\n\t* libtiff/tiff.h: Use _TIFF_DATA_TYPEDEFS_ guardian to switch off\n\tdefining int8/uint8/... etc. types. As per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=607\n\n2004-09-09  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* tools/tiff2ps.c, tools/tiffmedian.c: fiddle with include files\n\tto avoid compile warnings about getopt() and a few other things.\n\n2004-09-02  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_dirread.c: Use memcpy() function instead of pointer\n\tassigning magic in TIFFFetchFloat().\n\n2004-09-01  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/{tiffio.h, tif_open.c}: Applied patches from Joris Van Damme\n\tto avoid requirement for tiffiop.h inclusion in some applications. See\n\there\n\n\thttp://www.asmail.be/msg0054799560.html\n\t\n\tfor details.\n\n\t* tools/fax2tiff.c: Use the new functions in the code.\n\n2004-08-25  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tools/tiff2pdf.c: Initialize arrays properly.\n\n\t* tools/tiff2ps.c: Avoid zero division in setupPageState() function;\n\tproperly initialize array in PSDataBW().\n\n2004-08-24  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tools/tiff2pdf.c: More fixes for bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=590\n\n\tfrom Ross Finlayson.\n\n2004-08-23  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tools/tiff2ps.c: Fixed problem with uninitialized values.\n\n\t* libtiff/tif_dir.c: Initialize tif_foundfield data member in the\n\tTIFFDefaultDirectory() (in addition to 2004-08-19 fix).\n\n\t* tools/tiff2pdf.c: Fixed a bunch of problems as per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=590\n\n2004-08-20  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tools/tiff2pdf.c: Applied patch from Ross Finlayson that checks\n\tthat the input file has compression, photometric interpretation,\n\tetcetra, tags or if not than a more descriptive error is returned.\n\n\t* libtiff/tif_dirread.c: Fixed problem in TIFFReadDirectory() in the\n\tcode, responsible for tag data type checking.\n\n2004-08-19  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/{tiffiop.h, tif_dirinfo.c}: Fixed problem with the static\n\tvariable as per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=593\n\n2004-08-16  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tools/ras2tiff.c: Fixed issue with missed big-endian checks as per\n\tbug http://bugzilla.remotesensing.org/show_bug.cgi?id=586\n\n2004-08-01  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/{tif_config.h.in, tif_config.h.vc}: config.h.in and\n\tconfig.h.vc files renamed in the tif_config.h.in and tif_config.h.vc.\n\n2004-07-24  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_lzw.c: LZW compression code is merged back from the\n\tseparate package. All libtiff tools are updated to not advertise an\n\tabcence of LZW support.\n\n2004-07-12  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tiffio.h: Revert thandle_t back to void* type.\n\n2004-07-11  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/{tif_read.c, tif_tile.c, tif_strip.c}: Fixes in error\n\tmessages, as suggested by Bernd Herd.\n\n2004-07-03  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_dir.c: Call TIFFError() instead of producing warnings\n\twhen setting custom tags by value. Reported by Eric Fieleke.\n\n2004-06-14  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tools/bmp2tiff.c: Add missed RawsPerStrip setting.\n\n2004-06-08  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tools/bmp2tiff.c: Added new utility to convert Windows BMP files\n\tinto TIFFs.\n\n2004-06-07  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff 3.7.0alpha released.\n\n2004-06-06  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/{tiff.h, tif_dirwrite.c, tif_fax3.c, tif_packbits.c,}: Get rid\n\tof ugly 64-bit hacks, replace them with the clever (autoconf based )\n\tones :-).\n\n\t* libtiff/tiffio.h: Define thandle_t as int, not void* (may cause\n\tproblems in 64-bit environment).\n\n2004-06-05  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tools/tiffset.c: tiffset now can set any libtiff supported tags.\n\tTags can be supplied by the mnemonic name or number.\n\n\t* libtiff/{tiffio.h, tif_dir.h, tif_dirinfo.c,}: Added two new\n\tfunctions TIFFFindFieldInfoByName() and TIFFFieldWithName().\n\n2004-05-27  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_ojpeg.c: Fixed problem with duplicated SOI and SOF\n\tmarkers as per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=581\n\n2004-05-24  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tools/tiffsplit.c: Don't forget to copy Photometric\n\tInterpretation tag.\n\n2004-05-20  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/{tif_open.c, tiffio.h}: New function added:\n\tTIFFIsBigEndian(). Function returns nonzero if given was file written\n\tin big-endian order.\n\n\t* tools/tiffsplit.c: Fixed problem with unproperly written multibyte\n\tfiles. Now output files will be written using the same byte order\n\tflag as\tin the input image. See\n\t\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=574\n\t\n\tfor details.\n\t\n2004-05-19  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_print.c: added (untested) support for printing\n\tSSHORT, SLONG and SRATIONAL fields.\n\n\t* tools/tiffcp.c: close output file on normal exit.\n\n2004-05-17  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_fax3.c: Avoid reading CCITT compression options\n\tif compression type mismatches. See\n\t\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=565\n\n2004-04-30  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_strip.c: Never return 0 from the\n\tTIFFNumberOfStrips().\n\n2004-04-29  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_dirread.c: Workaround for broken TIFF writers which\n\tstore single SampleFormat value for multisampled images. See\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=562\n\n2004-04-25  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* configure.ac, libtiff/{tiff.h, config.h.in}: Added tests for int8,\n\tint16 and int32 types to avoid complains on some compilers. Details at\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=39\n\n2004-04-20  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tools/tiff2pdf.c: Fixed problem with unaligned access as per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=555\n\n2004-04-14  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_write.c: Allow in-place updating of the compressed\n\timages (don't work properly with all codecs). For details see GDAL bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=534\n\n2004-04-06  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_jpeg.c: Workaround for wrong sampling factors used\n\tin the Intergarph JPEG compressed TIFF images as per bug:\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=532\n\n2004-04-04  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_open.c: close clientdata if TIFFClientOpen() fails\n\tvia bad2. \n\n2004-03-26  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tools/tiffcp.c: Properly set Photometric Interpretation in case of\n\tJPEG compression of grayscale images.\n\n\t* tools/tiffcp.c: Don't emit warnings when Orientation tag does not\n\tpresent in the input image.\n\n2004-03-19  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* {many}: The first attempt to switch to autotools.\n\n2004-03-03  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_open.c: Use dummy mmap/munmap functions in\n\tTIFFClientOpen() when the appropriate client functions was not\n\tsupplied by user.\n\n2004-03-02  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* tools/ycbcr.c: fixed main() declaration as per:\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=513\n\n2004-02-26  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tools/tiffsplit.c: Copy JPEGTables tag contents for JPEG compressed \n\timages. Reported by Artem Mirolubov.\n\n\t* libtiff/tif_dirread.c: Fixed problem with handling TIFF_UNDEFINED \n\ttag type in TIFFFetchNormalTag() as per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=508\n\n2004-02-17  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_codec.c: Fixed typo in TIFFInitPackBits name as per:\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=494\n\n2004-02-05  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_fax3.c: Fixed problem with CCITT encoding modes as per\n\tbug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=483\n\n\tBut we need more work on fax codec to support update mode.\n\n2004-01-30  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/libtiff.def: Added TIFFCurrentDirOffset, TIFFWriteCheck,\n\tTIFFRGBAImageOK, and TIFFNumberOfDirectories as suggested by \n\tScott Reynolds. \n\n2004-01-29  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tiff.h: Fixed tag definitions for TIFFTAG_YCLIPPATHUNITS\n\tand TIFFTAG_INDEXED as per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=475\n\n\t* libtiff/{tif_win32.c, tif_unix.c}: Check whether the pointer is\n\tNULL before proceeding further as per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=474\n\n\tCheck results, returned by the TIFFFdOpen() before returning and close\n\tfile if TIFFFdOpen() failed as per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=468\n\t\n\t* libtiff/tif_open.c: More fixes for\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=468\n\n2004-01-28  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/{libtiff.def, tif_close.c, tiffio.h, tif_open.c}: Separate\n\tTIFFCleanup() from the TIFFClose() in order to fix the bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=468\n\n\t* tools/tiffcp.c: Fixed problem with wrong interpretation of the\n\tInkNames tag as per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=466\n\n\tMemory leak fixed.\n\n2004-01-21  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_dirwrite.c: Fixed handling of writable ASCII tags that\n\tare field_passcount=TRUE properly.  Arguably anonymous custom tags\n\tshould be declared as passcount=FALSE, but I don't want to change\n\tthat without a careful review. \n\n2004-01-20  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_write.c: Fixed reporting size of the buffer in case of\n\tstripped image in TIFFWriteBufferSetup(). As per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=460\n\n2004-01-11  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_dir.c: Incomplete cleanup in TIFFFreeDirectory(),\n\tpatch from Gerben Koopmans.\n\n\t* libtiff/tif_dirread.c: Check field_passcount value before setting\n\tthe value of undefined type, patch from Gerben Koopmans.\n\n2004-01-02  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tools/tiffcp.c: Fixed problem with wrong Photometric setting for\n\tnon-RGB images.\n\n2003-12-31  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_win32.c: Fixed problem with _TIFFrealloc() when the NULL\n\tpointer passed. Patch supplied by Larry Grill.\n\n\t* libtiff/{tiff.h, tif_fax3.c}:Fixes for AMD 64 platform as\n\tsuggested by Jeremy C. Reed.\n\n2003-12-26  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff 3.6.1 released.\n\n2003-12-24  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* config.guess, config.sub: Updated from the recent upstream.\n\n2003-12-22  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/{tif_color, tif_getimage.c, tiffio.h}, man/TIFFcolor.3t:\n\tMore cleanups in color conversion interface, added appropriate manual\n\tpage.\n\n2003-12-19  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/{tif_extension.c, tif_dirinfo.c, tiff.h}: Warnings fixed as\n\tper bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=357\n\n\t* tools/tiff2ps.c: Added support for alpha channel. Fixes\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=428\n\n\t* libtiff/{libtiff.def, tif_color.c, tif_getimage.c, tiffio.h}:\n\tInterface for Lab->RGB color conversion is finally cleaned up.\n\tAdded support for ReferenceBlackWhite tag handling when converted from\n\tYCbCr color space. The latter closes\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=120\n\n2003-12-07  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/{tif_getimage.c, tiffio.h}: Avoid warnings.\n\n\t* libtiff/makefile.vc, tools/makefile.vc: Support for IJG JPEG\n\tlibrary.\n\n2003-12-06  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/{tif_getimage.c, tif_aux.c}: Read WhitePoint tag from the\n\tfile and properly use it for CIE Lab->RGB transform.\n\n2003-12-04  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/{tif_getimage.c, tif_color.c, tiffio.h}: YCbCr->RGB\n\tconversion routines now in the tif_color.c module. New function\n\tTIFFYCbCrtoRGB() available in TIFF API.\n\n\t* libtiff/tif_dirwrite.c: Handle TIFF_IFD tag type correctly.\n\n2003-12-03  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/{tif_getimage.c, tif_color.c, tiffio.h}: Improvements in\n\tCIE Lab conversion code. Start moving YCbCr stuff to the tif_color.c\n\tmodule.\n\n\t* libtiff/{tif_getimage.c, tiffio.h}, man{TIFFReadRGBAImage.3t,\n\tTIFFReadRGBAStrip.3t, TIFFReadRGBATile.3t, TIFFRGBAImage.3t}:\n\tFinally resolved problems with orientation handling. TIFFRGBAImage\n\tinterface now properly supports all possible orientations, i.e. images\n\twill be flipped both in horizontal and vertical directions if\n\trequired. 'Known bugs' section now removed from the appropriate manual\n\tpages. Closed bug entry:\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=322\n\n2003-12-02  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_dir.c: Fixed order of the parameters in TIFFError()\n\tfunction calls as per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=440\n\n2003-11-28 Ross Finlayson  <libtiff@apexinternetsoftware.com>\n\n\t* tools/tiff2pdf.c:  Some bugs fixed.\n\n2003-11-27  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_luv.c: Fixed bug in 48-bit to 24-bit conversion routine,\n\treported by Antonio Scuri.\n\n\t* man/tiff2pdf.1: Few improvements in page layout.\n\n\t* Makefile.in, /man/Makefile.in, /html/man/tiff2pdf.1.html:\n\t Added support fpr tiff2pdf manual page.\n\n2003-11-26 Ross Finlayson  <libtiff@apexinternetsoftware.com>\n\n\t* /man/tiff2pdf.1:  File added to repository.\n\n2003-11-26  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* Makefile.in, /tools/{Makefile.in, makefile.vc}:\n\t Added support fpr tiff2pdf utility.\n\n2003-11-25  Ross Finlayson  <libtiff@apexinternetsoftware.com>\n\n\t* /tools/tiff2pdf.c:  File added to repository.\n\n2003-11-22  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* /tools/raw2tiff.c: sqrtf() replaced with sqrt().\n\n2003-11-21  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* /tools/raw2tiff.c: #include <getopt.h> removed.\n\n\t* tools/{Makefile.in, tiffgt.c}: Unmaintained and platform dependent\n\tsgigt utility removed and replaced with the completely rewritten\n\tportable tiffgt tool (depend on OpenGL and GLUT). Initial revision,\n\tthere is a lot of things to improve.\n\n\t* libtiff/tif_ojpeg.c: TIFFVGetField() function now can properly\n\textract the fields from the OJPEG files. Patch supplied by Ross\n\tFinlayson.\n\n\t* libtiff/{tiffio.h, tif_codec.c}, man/{libtiff.3t, TIFFcodec.3t}:\n\tAdded new function TIFFIsCODECConfigured(), suggested by Ross\n\tFinlayson.\n\n2003-11-18  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_dirinfo.c: Implemented binary search in\n\t_TIFFMergeFieldInfo(). Patch supplied by Ross Finlayson.\n\n\t* libtiff/tif_dir.h: _TIFFFindOrRegisterdInfo declaration replaced\n\twith _TIFFFindOrRegisterFieldInfo as reported by Ross Finlayson.\n\n2003-11-17  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* tif_dirread.c: do not mark all anonymously defined tags to be \n\tIGNOREd.  \n\n2003-11-17  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* contrib/pds/{tif_pdsdirread.c, tif_pdsdirwrite.c}: Use\n\tTIFFDataWidth() function insted of tiffDataWidth array.\n\n2003-11-16  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/{tiff.h, tif_dirinfo.c}: Added support for IFD (13)\n\tdatatype, intruduced in \"Adobe PageMaker TIFF Tech. Notes\".\n\n2003-11-15  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* Makefile.in: fixed missing backslash for tif_color.c in list.\n\n2003-11-13  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/{tif_color.c, tif_getimage.c, tiffio.h, Makefile.in}:\n\tNew color space conversion code: CIE L*a*b* 1976 images now supported\n\tby the TIFFRGBAImage interface. All introduced routines go to new\n\tmodule tif_color.c. Eventually all color conversion functions should\n\tbe moved there.\n\n2003-11-12  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tools/{ras2tiff.c, rasterfile.h}: Properly determine SUN Rasterfiles\n\twith the reverse byte order (it is reported by the magic header\n\tfield). Problem reported by Andreas Wiesmann.\n\n\t* tools/raw2tiff.c, man/raw2tiff.1: Few improvements in correlation\n\tcalculation function. Guessing mechanics now documented in manual page.\n\n2003-11-11  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tools/raw2tiff.c: Implemented image size guessing using\n\tcorrelation coefficient calculation between two neighbour lines.\n\n2003-11-09  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_tile.c: remove spurious use of \"s\" (sample) in the \n\tplanarconfig_contig case in TIFFComputeTile().\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=387\n\n2003-11-09  Andrey Kiselev  <dron@ak4719.spb.edu>\n\t\n\t* libtiff/tiffiop.h: New macros: TIFFmax, TIFFmin and TIFFrint.\n\t\n2003-11-07  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/{tiffio.h, tif_strip.c}, man/{TIFFstrip.3t, libtiff.3t}:\n\tAdded TIFFRawStripSize() function as suggested by Chris Hanson.\n\n2003-11-03  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/{tif_lzw.c, tif_fax3.c}: Proper support for update mode as\n\tper bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=424\n\n2003-10-29  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/libtiff.def: Added TIFFReadRGBAImageOriented.\n\n\t* html/build.html: Added note about GNU make requirement.\n\n2003-10-25  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* Makefile.in: Fixes in using MAKEFLAGS as per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=418\n\n\t* port/install.sh.in: Option -p added to the mkdir command to create\n\tall directory tree structure before installing.\n\n2003-10-18  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* /tools/tiff2ps.c: #include <strings.h> replaced with the\n\t#include <string.h>.\n\n2003-10-16  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* Makefile.in: Add an absolute path to the test_pics.sh call.\n\n2003-10-12  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tiffcomp.h: #define _BSDTYPES_DEFINED when defining BSD\n\ttypedefs.\n\n2003-10-09  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* configure, libtiff/{Makefile.in, mkversion.c}:\n\tRelative buildings fixed.\n\n\t* tools/Makefile.in: Added \"-I../libtiff\" to the tiffset building\n\trule.\n\n2003-10-07  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* Makefile.in: Added missed v3.6.0.html.\n\n\t* libtiff/tiffio.h: Typo fixed: ORIENTATION_BOTTOMLEFT replaced with\n\tORIENTATION_BOTLEFT.\n\n2003-10-04  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* 3.6.0 final release.\n\n2003-10-03  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/{tif_getimage.c, tiffio.h}, man/TIFFReadRGBAImage.3t: New\n\tfunction TIFFReadRGBAImageOriented() implemented to retrieve raster\n\tarray with user-specified origin position as suggested by Jason Frank.\n\tSee\n\t\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=322\n\n\tfor details.\n\t\n\t* tools/tiff2rgba.c: Switched to use TIFFReadRGBAImageOriented()\n\tinstead of TIFFReadRGBAImage().\n\n\t* tools/tiff2ps.c: Fixed possible endless loop as per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=404\n\n2003-09-30  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_dirread.c: Check field counter against number of fields\n\tin order to fix\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=366\n\n\t* libtiff/tif_fax3.c: Fix wrong line numbering as per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=342\n\n2003-09-25  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/{tiffiop.h, tif_dirread.c, tif_dir.c, tif_open.c,\n\ttif_close.c}: Store a list of opened IFD to prevent looping as per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=383\n\n2003-09-23  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_dirread.c: More fixes for\tEstimateStripByteCounts(). See\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=358\n\n2003-08-21  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tools/tiffmedian.c: int declaration replaced with the uint32 to\n\tsupport large images as per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=382\n\n2003-08-12  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n \t* libtiff/Makefile.in: Fixed problem with building in different\n\tdirectory.\n\n\t* tools/tiff2ps.c: Added missing #include <strings.h>.\n\n\t* libtiff/tif_dirwrite.c: More fixes for custom tags code\n\tfrom Ashley Dreier.\n\n2003-08-07  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tools/tiff2ps.c: Added page size setting when creating PS Level 2.\n\tPatch submitted by Balatoni Denes (with corrections from Tom\n\tKacvinsky).\n\n\t* tools/tiff2ps.c: Fixed PS comment emitted when FlateDecode is\n\tbeing used. Reported by Tom Kacvinsky.\n\n\t* libtiff/tif_dirwrite.c: Fixed problem with custom tags writing,\n\treported by Ashley Dreier.\n\n\t* libtiff/tif_print.c: Fixed problem with float tags reading, support\n\tfor printing RATIONAL and BYTE tags added.\n\n2003-08-05  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_lzw.c: Move LZW codec state block allocation back to\n\tTIFFInitLZW(), because its initialization in LZWSetupDecode() cause\n\tproblems with predictor initialization. Remove O_RDONLY check during\n\tstate block allocation to be able open LZW compressed files in update\n\tmode.\n\n\tProblem exist for libtiff version of the tif_lzw.c module. One from\n\tlzw-compression-kit hasn't such troubles.\n\n2003-08-04  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_write.c: modified tif_write.c so that the various\n\tencoded write functions use tif_postdecode() to apply byte order\n\tswapping (swab) to the application passed data buffer if the same\n\twould be done when reading.  This allows us to write pixel data with\n\tmore than 8 bits per sample to existing files of a non-native byte \n\torder.  One side effect of this change is the applications buffer\n\titself is altered in this case by the act of writing. \n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=171\n\n2003-07-25  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_open.c: avoid signed/unsigned casting warning\n\tinitializing typemask as per patch from J.A. Strother.\n\n\t* tools/tiffcp.c: fixed signed/unsigned casting warning.\n\n\t* libtiff/tif_print.c: dos2unix conversion.\n\n\t* tools/tiffsplit.c: increased the maximum number of pages that\n\tcan be split.  Patch provided by Andrew J. Montalenti.\n\n2003-07-11  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tools/raw2tiff.c: Added option `-p' to explicitly select color\n\tspace of input image data. Closes\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=364\n\n2003-07-08  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* tif_aux.c, tif_codec.c, tif_dir.c, tif_dirread.c, tif_extension.c,\n\ttif_fax3.c, tif_getimage.c, tif_luv.c, tif_lzw.c, tif_next.c, \n\ttif_packbits.c, tif_predict.c, tif_print.c, tif_swab.c, tif_thunder.c:\n\tavoid casting warning at /W4. \n\n2003-07-03  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tools/thumbnail.c: Memory leak fixed as reported by Robert S. Kissel.\n\n2003-06-30  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_pixarlog.c: Unused variables removed.\n\n\t* libtiff/{tif_dirread.c, tif_dir.c}: Fixed problem with\n\tEstimateStripByteCounts() as per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=358\n\n\t* libtiff/{tif_dirwrite.c, tif_packbits.c}: Fixed compilation on\n\t64-bit architectures as per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=357\n\n\t* libtiff/tif_dirinfo.c: TIFFDataWidth() returns 0 in case of\n\tunknown data type.\n\t\n2003-06-19  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_print.c: fixed some serious bugs when printing\n\tcustom tags ... almost certain to crash. \n\n\t* libtiff/tif_dirread.c: Don't ignore custom fields that are\n\tautodefined.  Not sure how this got to be like this.\n\n2003-06-18  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* 3.6.0 Beta2 released.\n\n\t* tools/tiffcmp.c, man/tiffcmp.1: Fixed problem with unused data\n\tcomparing as per bug\n\t\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=349\n\n\t`-z' option now can be used to set the number of reported different\n\tbytes.\n\t\n2003-06-09  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tools/tiffcp.c, man/tiffcp.1: Added possibility to specify value -1\n\tto -r option to get the entire image as one strip. See\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=343\n\n\tfor details.\n\n2003-06-04  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tools/tiffcp.c: Set the correct RowsPerStrip and PageNumber\n\tvalues as per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=343\n\n2003-05-27  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_jpeg.c: modified segment_height calculation to always\n\tbe a full height tile for tiled images.  Also changed error to just\n\tbe a warning.\n\n2003-05-25  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tools/fax2tiff.c: Page numbering fixed, as per bug\n\t\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=341\n\n2003-05-20  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* contrib/ojpeg/{Makefile.in, jdhuff.h, jinclude.h, ojpeg.c, README},\n\tconfigure, Makefile.in:\tSwitched back to the old behaviour. Likely\n\tbetter solution should be found for OJPEG support.\n\n2003-05-11  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/mkversion.c: Fixed problem with wrong string size when\n\treading RELEASE-DATE file.\n\n2003-05-07  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tools/tiff2ps.c: Fixed bug in Ascii85EncodeBlock() function: array\n\tindex was out of range.\n\n2003-05-06  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* contrib/ojpeg/{Makefile.in, jdhuff.h, jinclude.h, ojpeg.c, README},\n\tconfigure, Makefile.in:\tImproved libtiff compilation with OJPEG\n\tsupport. Now no need for patching IJG JPEG library, hack requred by\n\tlibtiff will be compiled and used in-place. Implemented with\n\tsuggestion and help from Bill Allombert, Debian's libjpeg maintainer.\n\n\t* libtiff/tif_aux.c: Properly handle TIFFTAG_PREDICTOR in\n\tTIFFVGetFieldDefaulted() function.\n\n2003-05-05  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tools/ppm2tiff.c: PPM header parser improved: now able to skip\n\tcomments.\n\n\t* tools/tiffdither.c: Fixed problem with bit fill order tag setting:\n\twas not copied from source image.\n\n\t* libtiff/getimage.c: Workaround for some images without correct\n\tinfo about alpha channel as per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=331\n\n2003-04-29  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tools/tiff2ps.c, man/tiff2ps.1: Add ability to generate PS Level 3.\n\tIt basically allows one to use the /flateDecode filter for ZIP\n\tcompressed TIFF images. Patch supplied by Tom Kacvinsky. Fixes\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=328\n\n\t* tools/tiff2ps.c: Force deadzone printing when EPS output specified\n\tas per bug\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=325\n\n2003-04-17  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_dirread.c: Removed additional check for StripByteCounts\n\tdue to problems with multidirectory images. Quality of error messages\n\timproved.\n\n2003-04-16  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tools/tiffcp.c: Fixed problem with colorspace conversion for JPEG\n\tencoded images. See bug entries\n\t\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=275\n\n\tand\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=23\n\n\t* libtiff/tif_dirread.c: Additional check for StripByteCounts\n\tcorrectness. Fixes\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=320\n\n2003-03-12  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tools/{fax2ps.c, fax2tiff.c, gif2tiff.c, pal2rgb.c, ppm2tiff.c,\n\tras2tiff.c, raw2tiff.c, rgb2ycbcr.c, thumbnail.c, tiff2bw.c,\n\ttiff2ps.c, tiff2rgba.c, tiffcp.c, tiffdither.c, tiffinfo.c,\n\ttiffmedian.c}: Added library version reporting facility to all tools.\n\n2003-03-06  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* port/install.sh.in: Fixed problems with install producing paths\n\tlike ///usr/local/lib on cygwin.\n\n2003-02-27  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tools/fax2tiff.c, man/fax2tiff.1: New switch (-X) to set width of\n\traw input page. Patch supplied by Julien Gaulmin. See\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=293\n\n\tfor details.\n\n2003-02-26  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_dir.c: fixed up the tif_postdecode settings\n\tresponsible for byte swapping complex image data.\n\n\t* libtiff/tif_lzw.c: fixed so that decoder state isn't allocated till\n\tLZWSetupDecode().  Needed to read LZW files in \"r+\" mode.\n\n2003-02-07  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tools/ppm2tiff.c: Fixed problem with too many arguments.\n\n2003-02-04  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tools/raw2tiff.c: Memory leak fixed.\n\n2003-02-03  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tools/fax2tiff.c, man/fax2tiff.1: Applied patch from Julien Gaulmin\n\t(thanks, Julien!). More switches for fax2tiff tool for better control\n\tof input and output. Details at\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=272\n\n2003-02-03  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_jpeg.c: Modified to defer initialization of jpeg\n\tlibrary so that we can check if there is already any tile/strip data\n\tbefore deciding between creating a compressor or a decompressor. \n\n2003-01-31  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_write.c: TIFFWriteCheck() now fails if the image is\n\ta pre-existing compressed image.  That is, image writing to \n\tpre-existing compressed images is not allowed.\n\n\t* libtiff/tif_open.c: Removed error if opening a compressed file\n\tin update mode. \n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=198\n\n2003-01-31  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* config.guess, config.sub: Updated to recent upstream versions.\n\n2003-01-15  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* cut 3.6.0 Beta release.\n\n2002-12-20  Andrey Kiselev  <dron@ak4719.spb.edu>\n\t\n\t* tools/fax2ps.c, man/fax2ps.1: Page size was determined\n\tin wrong way as per bug\n\t\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=239\n\n2002-12-17  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_dirread.c: Allow wrong sized arrays in \n\tTIFFFetchStripThing(). \n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=49\n\n2002-12-02  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_dir.c: fix problem with test on td_customValueCount.\n\tWas using realloc even first time.  Fix by Igor Venevtsev.\n\n2002-11-30  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_dir.c: fixed bug with resetting an existing custom\n\tfield value.\n\n\t* libtiff/tif_dir.c: Fixed potential problem with ascii \"custom\" \n\ttags in TIFFVGetField() ... added missing break.\n\n2002-10-14  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* tools/tiff2ps.c: fixes a problem where \"tiff2ps -1e\" did not make\n\tthe scanline buffer long enough when writing rgb triplets.\n\tThe scanline needs to be 3 X the number of dots or else it will\n\tcontain\tan incomplete triplet and programs that try to separate\n\tthe eps by redefining the colorimage operator will get messed up.\n\tPatch supplied by William Bader.\n\n\t* Makefile.in: added tif_extension.c to file list as per \n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=218.\n\n2002-10-11  Andrey Kiselev  <dron@ak4719.spb.edu>\n\t\n\t* configure, config.site, libtiff/{tif_unix.c, Makefile.in}: Fix for\n\tlarge files (>2GiB) supporting. New option in the config.site:\n\tLARGEFILE=\"yes\". Should be enough for I/O of the large files.\n\n2002-10-10  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/html/v3.6.0.html: new release notes.\n\n\t* libtiff/index.html: removed faq, cvs snapshot cruft.  Added email\n\tlink for Andrey.  Pointer to v3.6.0.html.\n\n\t* libtiff/Makefile.in: added direct rule for tiffvers.h for release.\n\n2002-10-07  Andrey Kiselev  <dron@ak4719.spb.edu>\n\t* tools/tiff2ps.c, man/tiff2ps.1: Applied patch form Sebastian Eken\n\t(thanks, Sebastian!). New switches:\n\t-b # for a bottom margin of # inches\n\t-c   center image\n\t-l # for a left margin of # inches\n\t-r   rotate the image by 180 degrees\n\tNew features merged with code for shrinking/overlapping.\n\tPreviously added -c and -n switches (for overriding PS units) renamed\n\tin -x and -y respectively.\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=200\n\n\t* html/man/*.html: Updated from actual manual pages.\n\n2002-10-06  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_jpeg.c: fixed problem with boolean defined with wrong\n\tsize on windows.  Use #define boolean hack.  \n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=188\n\n\t* libtiff/tiff.h: Don't do special type handling in tiff.h unless\n\tUSING_VISUALAGE is defined.\n\t\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=39\n\n2002-10-03  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tiff.h: added COMPRESSION_JP2000.\n\n2002-10-02  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_dirread.c: Another fix for the fetching SBYTE arrays\n\tby the TIFFFetchByteArray() function. Should finally resolve\n\t\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=52\n\t\n\t* configure: Set -DPIXARLOG_SUPPORT option along with -DZIP_SUPPORT\n\n\t* html/Makefile.in: New targets added: html and groffhtml for\n\tproducing HTML representations of the manual pages automatically.\n\thtml target uses man2html tool, groffhtml uses groff tool.\n\t\n2002-09-29  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* configure, libtiff/Makefile.in: Added SCO OpenServer 5.0.6 support\n\tfrom John H. DuBois III.  \n\n2002-09-15  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* Makefile.in, /man/{raw2tiff.1, Makefile.in, libtiff.3}: Added\n\tmanual page for raw2tiff(1) tool.\n\t\n2002-09-12  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* /libtiff/{tiffio.h, tif_dir.h}: TIFFDataWidth() declaration moved to\n\tthe tiffio.h header file.\n\t\n\t* Makefile.in, /man/{TIFFDataWidth.3t, Makefile.in, libtiff.3}: Added\n\tmanual page for TIFFDataWidth() function\n\n2002-09-08  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_dirread.c: Expand v[2] to v[4] in TIFFFetchShortPair()\n\tas per http://bugzilla.remotesensing.org/show_bug.cgi?id=196.\n\n\t* tools/tiff2ps.c: Don't emit BeginData/EndData DSC comments\n\tsince we are unable to properly include the amount to skip. \n\t\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=80\n\n2002-09-02  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* /libtiff/tif_dirread.c: Fixed problem with SBYTE type data fetching\n\tin TIFFFetchByteArray(). Problem described at\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=52\n\n2002-08-22  Andrey Kiselev  <dron@ak4719.spb.edu>\n\t\n\t* /libtiff/tif_dirinfo.c: Further additions to free custom fields\n\tin _TIFFSetupFieldInfo() function.\n\tSee http://bugzilla.remotesensing.org/show_bug.cgi?id=169 for details.\n\n\t* /libtiff/tif_lzw.c: Additional consistency checking added in\n\tLZWDecode() and LZWDecodeCompat().\n\tFixes http://bugzilla.remotesensing.org/show_bug.cgi?id=190\n\tand http://bugzilla.remotesensing.org/show_bug.cgi?id=100\n\t\n\t* /libtiff/tif_lzw.c:\n\tAdded check for valid code lengths in LZWDecode() and\n\tLZWDecodeCompat(). Fixes\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=115\n\n2002-08-16  Andrey Kiselev  <dron@ak4719.spb.edu>\n\t\n\t* /libtiff/{Makefile.vc, libtiff.def}:\n\tMissed declarations added.\n\n2002-08-15  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* tif_getimage.c: Ensure that TIFFRGBAImageBegin() returns the\n\treturn code from the underlying pick function.\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=177\n\n\t* tif_dir.h: changed FIELD_CODEC to 66 from 64 to avoid overlap \n\twith FIELD_CUSTOM as mentioned in bug 169.\n\n\t* tif_close.c: added logic to free dynamically created anonymous\n\tfield definitions to correct a small memory leak.\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=169\n\n2002-08-10  Andrey Kiselev  <dron@ak4719.spb.edu>\n\t\n\t* /tools/{raw2tiff.c, Makefile.in, Makefile.lcc, Makefile.vc}:\n\tNew tool: raw2tiff --- raw images to TIFF converter. No manual page yet.\n\n2002-07-31  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_jpeg.c: Fixed problem with setting of nrows in \n\tJPEGDecode() as per bugzilla bug (issue 1):\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=129\n\n\t* libtiff/{tif_jpeg.c,tif_strip.c,tif_print.c}: Hacked tif_jpeg.c to\n\tfetch TIFFTAG_YCBCRSUBSAMPLING from the jpeg data stream if it isn't\n\tpresent in the tiff tags. \n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=168\n\n\t* libtiff/tif_read.c, libtiff/tif_write.c: TIFFReadScanline() and\n\tTIFFWriteScanline() now set tif_row explicitly in case the codec has\n\tfooled with the value. \n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=129\n\n2002-06-22  Andrey Kiselev  <dron@ak4719.spb.edu>\n\t\n\t* /tools/tiff2ps.c: Added workaround for some software that may crash\n\twhen last strip of image contains fewer number of scanlines than\n\tspecified by the `/Height' variable. See\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=164\n\tfor explanation.\n\n2002-06-21  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tools/tiff2ps, man/tiff2ps.1: New functionality for tiff2ps utility:\n\tsplitting long images in several pages. See\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=142 for explanation.\n\tPatch granted by John Williams <williams@morinda.com>.\n\n2002-06-11  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/contrib/win95: renamed to contrib/win_dib.  Added new \n\tTiffile.cpp example of converting TIFF files into a DIB on Win32.  \n\tThis one is described in:\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=143\n\n\t* libtiff/tif_ojpeg.c: Major upgrade from Scott.  See details at:\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=156\n\n2002-05-10  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tools/tiff2ps: New commandline switches to override resolution\n\tunits obtained from the input file. Closes\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=131\n\n2002-04-26  Andrey Kiselev  <dron@ak4719.spb.edu>\n\t\n\t* libtiff/libtiff.def: Added missed declaration.\n\t\n2002-04-22  Andrey Kiselev  <dron@ak4719.spb.edu>\n\t\n\t* tools/fax2tiff.c: Updated to reflect latest changes in libtiff.\n\tCloses http://bugzilla.remotesensing.org/show_bug.cgi?id=125\n\n2002-04-20  Andrey Kiselev  <dron@ak4719.spb.edu>\n\t\n\t* libtiff/tif_open.c: Pointers to custom procedures\n\tin TIFFClientOpen() are checked to be not NULL-pointers.\n\t\n2002-04-18  Andrey Kiselev  <dron@ak4719.spb.edu>\n\t\n\t* libtiff/libtiff.def: Added missed declarations.\n\n\t* libtiff/tif_pixarlog.c: Updated for using tif_tagmethods structure.\n\n2002-04-16  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_lzw.c: Additional checks for data integrity introduced.\n\tShould finally close\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=100\n\t\n2002-04-10  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tools/tiff2ps: Division by zero fixed.\n\tCloses http://bugzilla.remotesensing.org/show_bug.cgi?id=88\n\n2002-04-09  Andrey Kiselev  <dron@ak4719.spb.edu>\n\t\n\t* libtiff/: tif_dirwrite.c, tif_write.c, tiffio.h:\n\tTIFFCheckpointDirectory() routine added.\n\tCloses http://bugzilla.remotesensing.org/show_bug.cgi?id=124\n\n\t* man/: TIFFWriteDirectory.3t,  Makefile.in: Added description\n\tfor the new function.\n\n2002-04-08  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/: tif_codec.c, tif_compress.c, tiffiop.h: Introduced\n\tadditional members tif->tif_decodestatus and tif->tif_encodestatus\n\tfor correct handling of unconfigured codecs (we should not try to read\n\tdata or to define data size without correct codecs).\n\n\t* libtiff/tif_getimage.c: The way of codecs checking in TIFFRGBAImageOK\n\tchanged. Now it has used tif->tif_decodestatus and\n\ttif->tif_encodestatus.\n\tShould fix http://bugzilla.remotesensing.org/show_bug.cgi?id=119 (in\n\tcase of __cvs_8.tif test image).\n\n\t* libtiff/: tif_dirinfo.c, tif_dirread.c: Somebody makes a bug in\n\ttif_dirread.c when TIFFCreateAnonFieldInfo was introduced.\n\tCloses http://bugzilla.remotesensing.org/show_bug.cgi?id=119 in case\n\tof _cvs_00000-00.tif, _cvs_00000-01.tif and _cvs_00000-02.tif.\n\n2002-04-04  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/: tif_lzw.c: Assertions in LZWDecode and LZWDecodeCompat\n\treplaced by warnings. Now libtiff should read corrupted LZW-compressed\n\tfiles by skipping bad strips.\n\tCloses http://bugzilla.remotesensing.org/show_bug.cgi?id=100\n\t\n2002-04-03  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_dirwrite.c: Removed some dead code.\n\n\t* libtiff/*: Cleanup some warnings.\n\n\t* libtiff/tif_dir.c: Fixed bug with count returned by TIFFGetField()\n\tfor variable length FIELD_CUSTOM values.  Was int * but should be\n\tu_short *.\n\n2002-04-01  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* tools/: tifcp.c: Added support for 'Orientation' tag in tiffcp\n\tutility (at cpStripToTile routine).\n\n2002-03-27  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* tif_dirread.c: avoid div-by-zero if rowbytes is zero in chop func.\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=111\n\n\t* tif_print.c: Fixed so that ASCII FIELD_CUSTOM values with \n\tpasscount set FALSE can be printed (such as TIFFTAG_SOFTWARE).\n\n\t* libtiff/tif_dir.c,tif_dirinfo.c,tif_dir.h,tif_ojpeg.c: modified so \n\tthat TIFFTAG_SOFTWARE uses FIELD_CUSTOM as an example.\n\n2002-03-26  Dwight Kelly  <dbmalloc@remotesensing.org>\n\n\t* libtiff/: tiff.h, tif_dir.c, tif_dir.h, tif_dirinfo.c, tif_dirread.c,\n\ttif_dirwrite.c: Added get/put code for new tag XMLPACKET as defined\n\tin Adobe XMP Technote. Added missing INKSET tag value from TIFF 6.0 spec \n\tINKSET_MULTIINK (=2). Added missing tags from Adobe TIFF technotes: \n\tCLIPPATH, XCLIPPATHUNITS, YCLIPPATHUNITS, OPIIMAGEID, OPIPROXY and\n\tINDEXED. Added PHOTOMETRIC tag value from TIFF technote 4 ICCLAB (=9).\n\n2002-03-26  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/: tif_getimage.c: TIFFReadRGBAStrip and TIFFReadRGBATile\n\tnow also uses TIFFRGBAImageOK before reading. This is additional fix\n\tfor http://bugzilla.remotesensing.org/show_bug.cgi?id=110\n\n2002-03-25  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/: tif_getimage.c: Additional check for supported\n\tcodecs added in TIFFRGBAImageOK and TIFFReadRGBAImage now uses\n\tTIFFRGBAImageOK before reading.\n\tCloses http://bugzilla.remotesensing.org/show_bug.cgi?id=110\n\n2002-03-15  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/: tif_dir.c, tif_dir.h, tif_dirinfo.c, tif_dirread.c,\n\ttif_dirwrite.c: Added routine TIFFDataWidth for detrmining\n\tTIFFDataType sizes instead of working with tiffDataWidth array\n\tdirectly. Should prevent out-of-borders bugs in case of unknown or\n\tbroken data types.  EstimateStripByteCounts routine modified, so it\n\twon't work when tags with uknown sizes founded.\n\tCloses http://bugzilla.remotesensing.org/show_bug.cgi?id=109\n\n2002-03-13  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/tif_getimage.c: Added support for correct handling\n\t`Orientation' tag in gtTileContig. Should be added in other gt*\n\tfunctions as well, but I have not images for testing yet. Partially\n\tresolves http://bugzilla.remotesensing.org/show_bug.cgi?id=23\n\n2002-03-10  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/: tif_dirinfo.c, tif_dirwrite.c: Added possibility to\n\tread broken TIFFs with LONG type used for TIFFTAG_COMPRESSION,\n\tTIFFTAG_BITSPERSAMPLE, TIFFTAG_PHOTOMETRIC.  Closes\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=99\n\n2002-03-08  Andrey Kiselev  <dron@ak4719.spb.edu>\n\n\t* libtiff/Makefile.in, tools/Makefile.in: Shared library will not\n\tbe stripped when installing, utility binaries will do.\tCloses\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=93\n\n2002-02-28  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* man/TIFFGetField: fixed type of TIFFTAG_COPYRIGHT.\n\n\t* man/libtiff.3t: added copyright tag info.\n\n2002-02-11  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/{tiff.h,tif_fax3.c}: Add support for __arch64__.\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=94\n\n\t* man/Makefile.in: Patch DESTDIR handling \n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=95\n\n\t* configure: OpenBSD changes for Sparc64 and DSO version.\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=96\n\n2002-02-05  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* config.site/configure: added support for OJPEG=yes option to enable\n\tOJPEG support from config.site.\n\n2002-01-27  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* html/document.html: fixed links for TIFf 6 docs.\n\n2002-01-18  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* config.guess, config.sub: Updated from ftp.gnu.org/pub/config.\n\n\t* libtiff/tif_read.c: Fixed TIFFReadEncodedStrip() to fail if the\n\tdecodestrip function returns anything not greater than zero as per\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=97\n\n\t* configure: Modify CheckForBigEndian so it can work in a cross\n\tcompiled situation.\n\n2002-01-16  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* tools/tiffdump.c: include TIFFTAG_JPEGTABLES in tag list.\n\n\t* tools/tiffset.c: fix bug in error reporting.\n\n\t* tools/tiffcp.c: fix several warnings that show up with -Wall.\n\n2002-01-04  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_jpeg.c: fixed computation of segment_width for \n\ttiles files to avoid error about it not matching the \n\tcinfo.d.image_width values (\"JPEGPreDecode: Improper JPEG strip/tile \n\tsize.\") for ITIFF files.  Apparently the problem was incorporated since\n\t3.5.5, presumably during the OJPEG/JPEG work recently.\n\n2001-12-15  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* configure, libtiff/Makefile.in: Changes for building on MacOS 10.1.\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=94\n\n\t* libtiff/tif_getimage.c: If DEFAULT_EXTRASAMPLE_AS_ALPHA is 1 \n\t(defined in tiffconf.h - 1 by default) then the RGBA interface\n\twill assume that a fourth extra sample is ASSOCALPHA if the\n\tEXTRASAMPLE value isn't set for it.  This changes the behaviour of\n\tthe library, but makes it work better with RGBA files produced by\n\tlots of applications that don't mark the alpha values properly.\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=93\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=65\n\n2001-12-12  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_jpeg.c: allow jpeg data stream sampling values to \n\toverride those from tiff directory.  This makes this work with \n\tImageGear generated files. \n\n2001-12-07  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* html/Makefile.in: added missing images per bug 92.\n\n\t* port/Makefile.in: fixed clean target per bug 92.\n\n2001-11-28  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* Reissue 3.5.7 release.\n\n\t* libtiff/mkversion.c: Fix output of TIFF_VERSION to be\n\tYYYYMMDD so that it is increasing over time. \n\n\t* Makefile.in: Ensure that tiffvers.h is regenerated in the\n\tmake release target.\n\n\t* Makefile.in: added libtiff/tiffvers.h to the release file list.\n\n2001-11-23  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* added html/v3.5.7.html, updated html/index.html.\n\n\t* Makefile.in: added contrib/addtiffo/tif_ovrcache.{c,h}.\n\n2001-11-15  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* configure: fixed test for -lm.\n\n2001-11-02  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* Added PHOTOMETRIC_ITULAB as per bug 90.\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=90\n\n2001-10-10  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tiff.h: I have created COMPRESSION_CCITT_T4, \n\tCOMPRESSION_CCITT_T6, TIFFTAG_T4OPTIONS and TIFFTAG_T6OPTIONS aliases \n\tin keeping with TIFF 6.0 standard in tiff.h\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=83\n\n2001-09-26  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_dirwrite.c: added TIFFRewriteDirectory() function.\n\tUpdated TIFFWriteDirectory man page to include TIFFRewriteDirectory.\n\n2001-09-24  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_lzw.c: Avoid MS VC++ 5.0 optimization bug.\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=78\n\n\t* libtiff/tif_lzw.c: added dummy LZWSetupEncode() to report an\n\terror about LZW not being available.\n\n\t* libtiff/tif_dir.c: propagate failure to initialize compression\n\tback from TIFFSetField() as an error status, so applications can \n\tdetect failure.\n\n\t* libtiff/tif_dir.c: removed the auto replacement of \n\tCOMPRESSION_LZW with COMPRESSION_NONE in _TIFFVSetField().\n\n\t* Removed Makefile, tools/Makefile, port/install.sh, man/Makefile\n\tfrom CVS as they are all supposed to be auto-generated by configure.\n\n2001-09-22  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_ojpeg.c: new update from Scott. \n\n2001-09-09  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtif/tif_fax3.c: Removed #ifdef PURIFY logic, and modified to\n\talways use the \"safe\" version, even if there is a very slight\n\tcost in performance.\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=54\n\n\t* libtiff/Makefile.in: Fixed @DSOSUB_VERSION to be @DSOSUF_VERSION@\n\tin two places.\n\n\t* libtiff/tif_getimage.c: Fixed problem with reading strips or\n\ttiles that don't start on a tile boundary.  Fix contributed by\n\tJosep Vallverdu (from HP), and further described in bug 47.\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=47\n\n\t* tools/tiff2ps.c: added OJPEG YCbCr to RGB support. \n\n\t* libtiff/tif_ojpeg.c: Applied substantial patch from Scott.\n\n2001-09-06  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_packbits.c: fixed memory overrun error.\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=77\n\t\n2001-08-31  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_getimage.c: relax handling of contig case where\n\tthere are extra samples that are supposed to be ignored.  This\n\tshould now work for 8bit greyscale or palletted images.  \n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=75\t\n\n2001-08-28  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_getimage.c: Don't complain for CMYK (separated)\n\timages with more than four samples per pixel.  See:\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=73\n\n2001-08-10  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_getimage.c: Use memmove() instead of TIFFmemcpy()\n\tin TIFFReadRGBATile() to avoid issues in cases of overlapping\n\tbuffers.  See Bug 69 in Bugzilla. \n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=69\n\t\n\t* tools/tiff2rgba.c: fixed getopt() call so that -b works again.\n\n2001-08-09  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tiff.h, libtiff/tif_fax3.c: added check for __LP64__ \n\twhen checking for 64 bit architectures as per bugzilla bug 67.\n\n2001-07-27  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* man/Makefile.in: add TIFFClientOpen link as per debian submitted\n\tbug 66.\n\n2001-07-20  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_jpeg.c: Define HAVE_BOOLEAN on windows if RPCNDR.H \n\thas been included.\n\n2001-07-19  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_open.c: Seek back to zero after failed read,\n\tbefore writing header.\n\n2001-07-18  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_ojpeg.c: updates from Scott.  Handles colors\n\tmuch better.  Now depends on having patched libjpeg as per\n\tpatch in contrib/ojpeg/*. \n\n2001-07-17  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* */Makefile.in: added DESTDIR support. \n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=60\n\n2001-07-16  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* configure, libtiff/Makefile.in: applied OpenBSD patches\n\tas per:\n\t\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=61\n\n2001-06-28  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_getimage.c: Fixed so that failure is properly\n\treported by gtTileContig, gtStripContig, gtTileSeparate and \n\tgtStripSeparate.\n\n\tSee http://bugzilla.remotesensing.org/show_bug.cgi?id=51\n\n\t* tiffcmp.c: Fixed multi samples per pixel support for ContigCompare.  \n\tUpdated bug section of tiffcmp.1 to note tiled file issues.\n\t\n\tSee http://bugzilla.remotesensing.org/show_bug.cgi?id=53\n\n2001-06-22  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* configure: Changes for DSO generation on AIX provided by\n\tJohn Marquart <jomarqua@indiana.edu>.\n\n\t* configure, libtiff/Makeifle.in: Modified to build DSOs properly\n\ton Darwin thanks to Robert Krajewski (rpk@alum.mit.edu) and\n\tKeisuke Fujii (fujiik@jlcuxf.kek.jp).\n\n2001-06-13  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* tools/tiff2rgba.c: added -n flag to avoid emitting alpha component.\n\n\t* man/tiff2rgba.1: new\n\n2001-05-22  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* Added tiffset and tif_ojpeg to the dist lists in Makefile.in.\n\n2001-05-13  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tools/thumbnail.c: changed default output compression\n\tto packbits from LZW since LZW isn't generally available.\n\n2001-05-12  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_ojpeg.c: New.\n\tlibtiff/tif_jpeg.c, tiffconf.h, tif_getimage.c: changes related\n\tto OJPEG support.\n\n\tScott Marovich <marovich@hpl.hp.com> supplied OJPEG support.\n\n2001-05-11  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* tiff.h: removed, it duplicates libtiff/tiff.h.\n\n2001-05-08  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_dirinfo.c: moved pixar and copyright flags to \n\tensure everything is in order.\n\n\t* libtiff/libtiff.def: added TIFFCreateDirectory and \n\tTIFFDefaultStripSize as per:\n\n\t  http://bugzilla.remotesensing.org/show_bug.cgi?id=46\n\n2001-05-02  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_dirinfo.c: Modified the TIFF_BYTE definition for\n\tTIFFTAG_PHOTOSHOP to use a writecount of TIFF_VARIABLE2 (-3) to\n\tforce use of uint32 counts instead of short counts. \n\n\t* libtiff/tif_dirwrite.c: Added support for TIFF_VARIABLE2 in the\n\tcase of writing TIFF_BYTE/TIFF_SBYTE fields.  \n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=43\n\n2001-05-01  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_dirinfo.c: removed duplicate TIFFTAG_PHOTOSHOP as per\n\tbug report http://bugzilla.remotesensing.org/show_bug.cgi?id=44\n\n2001-04-05  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* tiffio.h: removed C++ style comment.\n\n\t* configure: fixed up SCRIPT_SH/SHELL handling.\n\n\t* Makefile.in: Fixed SCRIPT_SH/SHELL handling.\n\n\t* config.guess: documented more variables as per bug 40.\n\n2001-04-03  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* configure, *Makefile.in: Various changes to improve configuration\n\tfor HP/UX specifically, and also in general.  They include:\n\t - Try to handle /usr/bin/sh instead of /bin/sh where necessary.\n\t - Upgrade to HP/UX 10.x+ compiler, linker and dso options.\n\t - Fixed mmap() test to avoid MMAP_FIXED ... it isn't available on HP\n\t - Use -${MAKEFLAGS} in sub makes from makefiles.\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=40\n\n2001-04-02  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tiff.h: Applied hac to try and resolve the problem\n\twith the inttypes.h include file on AIX.\n\n\tSee http://bugzilla.remotesensing.org/show_bug.cgi?id=39\n\t\n\t* VERSION: update to 3.5.7 beta in preparation for release.\n\n\t* configure/config.site: modified to check if -lm is needed for\n\tMACHDEPLIBS if not supplied by config.site.  Needed for Darwin.\n\n\t* config.guess: updated wholesale to an FSF version apparently \n\tfrom 1998 (as opposed to 1994).  This is mainly inspired by \n\tproviding for MacOS X support.\n\n2001-03-29  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* configure, Makefile.in, etc: added support for OPTIMIZER being\n\tset from config.site. \n\n2001-03-28  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* fax2ps.c: Helge (libtiff at oldach.net) submitted fix:\n\n\tHere's a fix for fax2ps that corrects behaviour for non-Letter paper\n\tsizes. It fixes two problems:\n\n\tWithout\tscaling (-S) the fax is now centered on the page size specified\n\twith -H\tand/or -W. Before, fax2ps was using an obscure and practially\n\tuseless algorithm to allocate the image relative to Letter sized paper\n\twhich sometime sled to useless whitespace on the paper, while at the\n\tsame time cutting of the faxes printable area at the opposite border.\n\n\tSecond, scaling now preserves aspect ratio, which makes unusual faxes\n\t(in particular short ones) print properly.\n\n\tSee http://bugzilla.remotesensing.org/show_bug.cgi?id=35\n\t\n\t* tiff2ps.c/tiff2ps.1: Substantial changes to tiff2ps by\n\tBruce A. Mallett.  See check message for detailed information\n\ton all the changes, including a faster encoder, fixes for level\n\t2 PostScript, and support for the imagemask operator.\n\n2001-03-27  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tiffio.h: Changed \"#if LOGLUV_PUBLIC\" to \n\t\"#ifdef LOGLUV_PUBLIC\" so it will work with VisualAge on AIX.\n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=39\n\n2001-03-16  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* tif_dirinfo.c: moved definition of copyright tag in field list.\n\tApparently they have to be in sorted order by tag id.\n\n2001-03-13  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* tif_getimage.c: Added support for 16bit minisblack/miniswhite \n\timages in RGBA interface.\n\n2001-03-02  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* Added TIFFTAG_COPYRIGHT support.\n\n2001-02-19  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* Brent Roman contributed updated tiffcp utility (and tiffcp.1)\n\twith support for extracting subimages with the ,n syntax, and also\n\tadding the -b bias removal flag. \n\n2001-02-16  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/libtiff.def: Brent Roman submitted new version adding\n\tserveral missing entry points. \n\n\t* libtiff/tif_dirinfo.c: don't declare tiffFieldInfo static on VMS.\n\tSome sort of weird VMS thing.  \n\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=31\n\n\t* tif_luv.c/tiff.h/tiffio.h: \n\tNew version of TIFF LogLuv (SGILOG) modules contributed by Greg Ward \n\t(greg@shutterfly.com).  He writes:\n\n\t1) I improved the gamut-mapping function in tif_luv.c for imaginary\n\tcolors, because some images were being super-saturated on the input \n\tside and this resulted in some strange color shifts in the output.\n\n\t2) I added a psuedotag in tiff.h to control random dithering during\n\tLogLuv encoding.  This is turned off by default for 32-bit LogLuv and \n\ton for 24-bit LogLuv output.  Dithering improves the average color \n\taccuracy over the image.\n\n\t3) I added a #define for LOG_LUV_PUBLIC, which is enabled by default in\n\ttiffio.h, to expose internal routines for converting between LogLuv and\n\tXYZ coordinates.  This is helpful for writing more efficient,\n\tspecialized conversion routines, especially for reading LogLuv files.\n\n\tChanges applied with minor edits.\n\n2001-01-23  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* tif_fax3.c: keep rw_mode flag internal to fax3 state to remember\n\twhether we are encoding or decoding.  This is to ensure graceful \n\trecovery if TIFFClientOpen() discovers an attempt to open a compressed\n\tfile for \"r+\" access, and subsequently close it, as it resets the \n\ttif_mode flag to O_RDONLY in this case to avoid writes, confusing the\n\tcompressor's concept of whether it is in encode or decode mode.\n\n2001-01-08  Mike Welles <mike@bangstate.com> \n\n\t* Makefile.in:  Now cleaning up after itself after creating the .tar.gz and .zip\n\t\n2001-01-07  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* html/libtiff.html: Fixed arguments in example for TIFFRGBAImageGet()\n\tas per bug report by Patrick Connor. \n\n2000-12-28  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* Added RELEASE-DATE file to release file list.\n\n\t* Fixed libtiff/makefile.vc to make tiffvers.h not version.h.\n\n2000-12-22  Mike Welles <mike@bangstate.com> \n        * added link to CVS mirror from index.html\n\t\n\t* updated html/internals.html to note that LZW compression is \n\t  not supported by default. \n\t\n2000-12-22  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* updated html/libtiff.html to not point at Niles' old JPL web site\n\tfor the man pages, point at www.libtiff.org.\n\n2000-12-21  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/tif_apple.c: Applied \"Carbon\" support patches supplied by\n\tLeonard Rosenthol <leonardr@lazerware.com>.  May interfere\n\twith correct building on older systems.  If so, please let me know.\n\n2000-12-19 Mike Welles <mike@bangsate.com>   \n\n\t* Took out LZW Encoding from tif_lzw.c \n\n\t* Created HOWTO-RELEASE\n\n\t* Created html/v3.5.6.html\n\n\t* updated index.html\n\t\n2000-12-01  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* Added patches for EOFB support in tif_fax3.c and tif_fax3.h. \n\tPatches supplied by Frank Cringle <fdc@cliwe.ping.de>\n\tExample file at: ftp://ftp.remotesensing.org/pub/libtiff/eofb_396.tif\n\n2000-11-24  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* libtiff/Makefile.in: Added an installPrivateHdrs and install-private\n\ttarget so that the private headers required by libgeotiff can be\n\tinstalled with the others.  They are not installed by default.\n\n\t* libtiff/Makefile.in: Added @MACHLIBDEPS@ to LINUXdso and GNULDdso\n\ttargets so libtiff.so will be built with an explicit dependency\n\ton libm.so.\n\n\t* libtiff/Makefile.in: Use softlinks to link libtiff.so.3 to \n\tlibtiff.so.3.5.5.  \n\n\t* libtiff/Makefile.in & configure: Remove all references to the ALPHA \n\tfile, or ALPHA version logic.  Added stuff about DIST_POINT in \n\tplace of DIST_TYPE and the alpha release number stuff.\n\n2000-11-22  Frank Warmerdam  <warmerdam@pobox.com>\n\n\t* I have applied a patch from Steffen Moeller <moeller@ebi.ac.uk> to\n\tthe configure script so that it now accepts the --prefix, and \n\t--exec-prefix directives. \n\n2000-11-13  Frank Warmerdam  <warmerda@cs46980-c>\n\n\t* I have made a variety of modifications in an effort to ensure the \n\tTIFFLIB_VERSION macro is automatically generated from the RELEASE-DATE\n\tfile which seems to be updated regularly.  \n\n\t o mkversion.c now reads RELEASE-DATE and emits TIFFLIB_VERSION in \n\t   version include file. \n\t o renamed version.h to tiffvers.h because we now have to install it \n\t   with the public libtiff include files.  \n\t o include tiffvers.h in tiffio.h. \n\t o updated tif_version.c to use tiffvers.h.\n\t o Updated Makefile.in accordingly.\n\n\t* As per http://bugzilla.remotesensing.org/show_bug.cgi?id=25\n\tI have updated the win32 detection rules in tiffcomp.h.\n\n2000-10-20  Frank Warmerdam  <warmerda@cs46980-c>\n\n\t* tif_getimage.c: Fixed RGBA translation for YCbCr images for which\n\tthe strip/tile width and height aren't multiples of the sampling size.\n\tSee http://bugzilla.remotesensing.org/show_bug.cgi?id=20\n\tSome patches from Rick LaMont of Dot C Software.\n\n\t* Modified tif_packbits.c encoder to avoid compressing more \n\tdata than provided if rowsize doesn't factor into provided data\n\t(such as occurs for YCbCr).\n\n2000-10-19  Frank Warmerdam  <warmerda@cs46980-c>\n\n\t* tools/rgb2ycbcr.c: fixed output strip size to account for vertical \n\troundup if rows_per_strip not a multiple of vertical sample size.\n\n2000-10-16  Frank Warmerdam  <warmerda@cs46980-c>\n\n\t* tif_dir.c: Clear TIFF_ISTILED flag in TIFFDefaultDirectory\n\tas per http://bugzilla.remotesensing.org/show_bug.cgi?id=18\n\tfrom vandrove@vc.cvut.cz.\n\n\t* Modified tif_packbits.c decoding to avoid overrunning the\n\toutput buffer, and to issue a warning if data needs to be\n\tdiscarded.  See http://bugzilla.remotesensing.org/show_bug.cgi?id=18\n\n2000-10-12  Frank Warmerdam  <warmerda@cs46980-c>\n\n\t* Modified tiff2bw to ensure portions add to 100%, and that\n\twhite is properly recovered. \n\t\n\tSee bug http://bugzilla.remotesensing.org/show_bug.cgi?id=15\n\tPatch c/o Stanislav Brabec <utx@penguin.cz>\n\n2000-09-30  Frank Warmerdam  <warmerda@cs46980-c>\n\n\t* Modified TIFFClientOpen() to emit an error on an attempt to\n\topen a comperessed file for update (O_RDWR/r+) access.  This is\n\tbecause the compressor/decompressor code gets very confused when\n\tthe mode is O_RDWR, assuming this means writing only.  See\n\tbug http://bugzilla.remotesensing.org/show_bug.cgi?id=13\n\n2000-09-27  Frank Warmerdam  <warmerda@cs46980-c>\n\n\t* Added GNULDdso target an`d switched linux and freebsd to use it. \n\n2000-09-26  Frank Warmerdam  <warmerda@cs46980-c>\n\n\t* Applied patch for 0x0000 sequences in tif_fax3.h's definition\n\tof EXPAND1D() as per bug 11 (from Roman). \n\n2000-09-25  Frank Warmerdam  <warmerda@cs46980-c>\n\t* Fixed tiffcomp.h to avoid win32 stuff if unix #defined, to improve\n\tcygwin compatibility.\n\n\t* Applied patch from Roman Shpount to tif_fax3.c.  This seems to\n\tbe a proper fix to the buffer sizing problem.  See \n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=11\n\n\t* Fixed tif_getimage.c to fix overrun bug with YCbCr images without\n\tdownsampling.  http://bugzilla.remotesensing.org/show_bug.cgi?id=10\n\tThanks to Nick Lamb <njl98r@ecs.soton.ac.uk> for reporting the\n\tbug and proving the patch.\n\t\n2000-09-18  Frank Warmerdam  <warmerda@cs46980-c>\n\n\t* Fixed tif_jpeg.c so avoid destroying the decompressor before\n\twe are done access data thanks to bug report from:\n\tMichael Eckstein <eckstein@gepro.cz>.\n\n\t* Reverted tif_flush change.\n\n2000-09-14  Frank Warmerdam  <warmerda@cs46980-c>\n\n\t* tif_flush.c: Changed so that TIFFFlushData() doesn't return an\n\terror when TIFF_BEENWRITING is not set.  This ensures that the\n\tdirectory contents can still be flushed by TIFFFlush().\n\n2000-08-14  Frank Warmerdam  <warmerda@rommel.atlsci.com>\n\n\t* tif_open.c: Don't set MMAP for O_RDWR files.\n\n\t* tif_open.c: Set STRIPCHOP_DEFAULT for O_RDWR as well as O_RDONLY\n\tso that files opened for update can be strip chopped too.\n\n\t* tif_read.c: fixed up bug with files missing rowsperstrip and\n\tthe strips per separation fix done a few weeks ago.\n\n2000-07-17  Frank Warmerdam  <warmerda@cs46980-c>\n\n\t* Tentatively added support for SAMPLEFORMAT_COMPLEXIEEEFP, and\n\tSAMPLEFORMAT_COMPLEXINT.\n\n2000-07-13  Mike Welles <mike@onshore.com> \n\n\t* index.html, bugs.html: added bugzilla info. \n\t\n2000-07-12  Frank Warmerdam  <warmerda@rommel.atlsci.com>\n\n\t* tif_read.c: fix subtle bug with determining the number of\n\trows for strips that are the last strip in a separation but\n\tnot the last strip of all in TIFFReadEncodedStrip().  \n\n\t* Applied 16/32 bit fix to tif_fax3.c.  Fix supplied by\n\tPeter Skarpetis <peters@serendipity-software.com.au>\n\n2000-06-15  Frank Warmerdam  <warmerda@rommel.atlsci.com>\n\n\t* Modified tiffio.h logic with regard to including windows.h.  It\n\twon't include it when building with __CYGWIN__.\n\n2000-05-11  Frank Warmerdam  <warmerda@cs46980-c>\n\n\t* README: update to mention www.libtiff.org, don't list Sam's old\n\temail address.\n\n\t* configure: Fixed DSO test for Linux as per patch from\n\t  Jan Van Buggenhout <chipzz@Ace.ULYSSIS.Student.KULeuven.Ac.Be>.\n\n2000-04-21  Frank Warmerdam  <warmerda@rommel.atlsci.com>\n\n\t* libtiff/tif_dirread.c: Don't use estimate strip byte count for\n\tone tile/strip images with an offset, and byte count of zero. These\n\tcould be \"unpopulated\" images. \n\n2000-04-18  Frank Warmerdam  <warmerda@rommel.atlsci.com>\n\n\t* contrib/addtiffo: Added \"averaging\" resampling option.\n\n\t* tools/tiffsplit.c: Copy TIFFTAG_SAMPLEFORMAT.\n\nTue Apr 18 16:18:08 2000  Frank Warmerdam  <warmerda@esabot.atlsci.com>\n\n\t* tools/Makefile.in: Modified to install properly on SGI.\n\n2000-04-12  Mike Welles\t     <mike@onshore.com>\n\t* configure:  Fixed stupid mistake in libc6 test on Linux\n\n2000-04-04  Mike Welles\t     <mike@onshore.com> \n\t* tif_win32.c:  Applied patch to fix overreads and ovverwrites\n\t  caught by BoundsChecker.  From Arvan Pritchard \n\t  <arvan.pritchard@infomatix.co.uk>  (untested). \n\t\n\t* tif_getimage.c:  Applied patch to silence VC6 warnings.  From \n\t  Arvan Pritchard <arvan.pritchard@informatix.co.uk>\n\t\n\t* tif_lzw.c:  Applied patch to silence VC6 warnings.  From \n\t  Arvan Pritchard <arvan.pritchard@informatix.co.uk>\n\t\n2000-03-28  Frank Warmerdam  <warmerda@cs46980-c>\n\n\t* Added contrib/stream (stream io) code submitted by Avi Bleiweiss.\n\n2000-03-28  Frank Warmerdam  <warmerda@cs46980-c>    *** 3.5.5 release ***\n\n\t* fax2ps: Fixed mixup of width and height in bounding box statement\n\tas per submission by Nalin Dahyabhai <nalin@redhat.com>.\n\n2000-03-27  Mike Welles\t     <mike@onshore.com> \n\n\t* fax2ps:  Modified printruns to take uint32 instead of uint16.  \n\tPatch courtesy of Bernt Herd <herd@herdsoft.com> \n\t\n2000-03-20  Mike Welles\t     <mike@onshore.com> \n\n\t* configure: added test for libc6 for linux targets.  Bug reported by \n        Stanislav Brabec <utx@k332.feld.cvut.cz>\n\n\t* Added 3.5 docs to html/Makefile.in.  \n\tThanks to  Stanislav Brabec <utx@k332.feld.cvut.cz>\n\n\t* configure: fixed bugs in sed scripts \n\t(applied sed script s:/@:s;@:;s:/s;;:;: to configure). \n\tfix submitted to Stanislav Brabec <utx@k332.feld.cvut.cz>\n\n\t* tools/iptcutil was not in files list, and wasn't being \n\tadded to tar archive.  Updated Makefile.in.\n\n2000-03-17  Frank Warmerdam  <warmerda@cs46980-c>\n\n\t* tif_fax3.c: Fixed serious bug introduced during the uint16->uint32\n\tconversion for the run arrays.  \n\n2000-03-03  Frank Warmerdam  <warmerda@cs46980-c.mtnk1.on.wave.home.com>\n\n\t* Set td_sampleformat default to SAMPLEFORMAT_UINT instead of \n\tSAMPLEFORMAT_VOID in TIFFDefaultDirectory() in tif_dir.c.\n\n2000-03-02  Frank Warmerdam  <warmerda@cs46980-c.mtnk1.on.wave.home.com>\n\n\t* Added \"GetDefaulted\" support for TIFFTAG_SAMPLEFORMAT in tif_aux.c.\n\n\t* Patched tif_fax3.c so that dsp->runs is allocated a bit bigger\n\tto avoid overruns encountered with frle_bug.tif.\n\nTue Feb 15 22:01:05 2000  Frank Warmerdam  <warmerda@gdal.velocet.ca>\n\n\t* Fixed tools/tiffcmp so that stopondiff testing works.\n\t  Patch care of Joseph Orost <joe@sanskrit.lz.att.com>.\n\n2000-01-28    <warmerda@CS46980-B>\n\n\t* Modified tif_unix.c to support 2-4GB seeks if USE_64BIT_API is\n\t  set to 1, and added default (off) setting in tiffconf.h.  This\n\t  should eventually be set by the configure script somehow.\n\n\t  The original work on all these 2-4GB changes was done by \n\t  Peter Smith (psmith@creo.com).\n\n\t* Modified tif_win32.c to support 2-4GB seeks.\n\n\t* tentatively changed toff_t to be unsigned instead of signed to\n\t  facilitate support for 2-4GB files. \n\n\t* Updated a variety of files to use toff_t.  Fixed some mixups\n\t  between toff_t and tsize_t.\n\nFri Jan 28 10:13:49 2000  Frank Warmerdam  <warmerda@gdal.velocet.ca>\n\n\t* Largely reimplemented contrib/addtiffo to avoid temp files, \n\tupdating the TIFF file in place.  Fixed a few other bugs to.\n\n\t* Set tif_rawdatasize to zero when freeing raw data buffer in\n\tTIFFWriteDirectory().\n\n\t* Enabled \"REWRITE_HACK\" in tif_write.c by default.\n\n\t* Fix bug in tif_write.c when switching between reading one directory\n\tand writing to another. \n\n\t* Made TIFFWriteCheck() public, and added TIFFCreateDirectory()\n\nWed Jan  5 12:37:48 2000  Frank Warmerdam  <warmerda@gdal.velocet.ca>\n\n\t* Added TIFFmemory(3t) functions to libtiff.def.\n\nTue Jan  4 13:39:00 2000  Frank Warmerdam  <warmerda@gdal.velocet.ca>\n\n\t* Added libtiff/libtiff.def to TIFFILES distribution list.\n\nMon Dec 27 12:13:39 EST 1999  Mike Welles <mike@onshore.com> \n\n\t* Created lzw compression kit, as a new module (libtiff-lzw-compression-kit). \n\n\t* Altered descriptions in tools to reflect \"by default\" lzw not supported\n\n\t* Updated index.html to note lzw compression kit. \n\t\nTue Dec 21 14:01:51 1999  Frank Warmerdam  <warmerda@gdal.velocet.ca>\n\n\t* Added fax3sm_winnt.c to distribution list in Makefile.in. \n\nTue Dec 21 11:04:45 EST 1999  Mike Welles <mike@onshore.com> *** 3.5.4 release ***\n\t\n\t* Aadded Pixar tag support.  Contributed by Phil Beffery <phil@pixar.com> \n\n\t* Made one more change to tif_dir.c for removal of LZW compression. Also added notice \n\t  when LZW compression invoked. \n\n\t* Changed default compression in tools to TIFF_PACKBITS, and changed usage descriptions\n\t  in tools to reflect removal of LZW compression\n\t  \nMon Dec 20 18:39:02 EST 1999  Mike Welles  <mike@onshore.com>\n\n        * Fixed bug that caused LZW (non) compression to segfault. Added \n\t  warning about LZW compression removed being removed, and why. \n\n\t* Added nostrip to install in tools/Makefile.in so that debugging \n\t  symbols are kept. \n\t\nTue Dec  7 12:04:47 EST 1999  Mike Welles  <mike@onshore.com>\n\n\t* Added patch from Ivo Penzar <ivo.penzar@infolink-software.com>, \n\t  supporting Adobe ZIP deflate.  Untested. \n\t\nSat Dec  4 15:47:11 1999  Frank Warmerdam  <warmerda@gdal.velocet.ca>\n\n\t* Made Packbits the default compression in tools/tiff2rgba.c instead\n\tof LZW.\n\nTue Nov 30 14:41:43 1999  Frank Warmerdam  <warmerda@gdal.velocet.ca>    *** 3.5.3. release ***\n\n\t* Added tif_luv to contrib/djgpp/Makefile.lib.\n\nTue Nov 30 14:15:32 EST 1999   Mike Welles <mike@onshore.com> \n\n        * Added zip creation to relase makefile target \n\n\t* Added html for TIFFWriteTile.3t man page. \n\t\nTue Nov 30 09:20:16 1999  Frank Warmerdam  <warmerda@gdal.velocet.ca>\n\n\t* Added some changes to tif_write.c to support rewriting existing\n\tfixed sized tiles and strips.  Code mods disabled by default, only\n\tenabled if REWRITE_HACK is defined for now.\n\nMon Nov 29 11:43:42 1999  Frank Warmerdam  <warmerda@gdal.velocet.ca>\n\n\t* Added TIFFWriteTile.3t man page.\n\nSun Nov 28 20:36:18 1999  Frank Warmerdam  <warmerda@gdal.velocet.ca>\n\n\t* Added notes on use of makefile.vc in build.html, and fixed \n\temail subscription address.\n\n199-11-28  Mike Welles <mike@onshore.com> \n\n\t*  Fixed apocalypse-inducing y2k bug in contrib/ras/ras2tiff.c \n\n\t*  Did some casts cleaning up to reduce compiler warnings in tif_fax3.c,\n\t   from Bruce Carmeron <cameron@petris.com> -- modifications of \n\t   changes made by Frank (sun cc still complained on cast). \n\n\t*  Added tiffconf.h to install target per request from Bill\n\t   Radcliffe <billr@corbis.com>: \"We need a way for ImageMagick to\n \t   know features have been compiled into the TIFF library in order to\n\t   handle things properly\".  \n\t\nSat Nov 27 16:49:21 1999  Frank Warmerdam  <warmerda@gdal.velocet.ca>\n\n\t* fixed various VC++ warnings as suggested by Gilles Vollant\n\t<info@winimage.com>.  \n\nWed Nov 24 12:08:16 1999  Frank Warmerdam  <warmerda@gdal.velocet.ca>\n\n\t* Modified TIFFquery.3t man pages info on TIFFIsByteSwapped() to\n\tnot imply applications are responsible for image data swapping.\n\n1999-11-22  Mike Welles <mike@onshore.com>\n\t*  HTML-ized the man pages, added to html/man\n\t\n\t*  Removed LZW Compression to comply with Unisys patent extortion. \n\t\n1999-09-29  Mike Welles\t\t<mike@onshore.com> \n\t*  Corrected one remaining 16 -> 32 bit value in tif_fax3.c, \n\t   From Ivo Penzar <ivo.penzar@infolink-software.com. \n\n\t*  Added patch from Ivo Penzar to have TiffAdvanceDirectory handle\n\t   memory mapped files. <ivo.penzar@infolink-software.com>\n\t\n1999-09-26  Mike Welles \t<mike@onshore.com>  *** 3.5.2 release ***\n\t* Corrected alpha versioning.  \n\n\t* Removed distinction between  alpha and release targets in Makefile.in. \n\n\t* added release.stamp target, which tags cvs tree, and updates \n\t  \"RELEASE-DATE\"\n\n\t* added releasediff target, which diffs tree with source as of \n\t  date in \"RELEASE-DATE\"\n\t  \n\t* Ticked up version to 3.5.2 (alpha 01 -- but I think we'll moving \n\t  away from alpha/non-alpha distinctions). \n\n\t* updated html to reflect release \n\t\n1999-09-23    <warmerda@CS46980-B>\n\n\t* Set O_BINARY for tif_unix.c open() ... used on cygwin for instance.\n\n\t* Added CYGWIN case in configure.\n\nFri Sep 17 00:13:51 CEST 1999  Mike Welles <mike@onshore.com> \n\n\t* Applied Francois Dagand's patch to handle fax decompression bug. \n\t  (sizes >= 65536 were failing) \n\t\nTue Sep 14 21:31:43 1999  Frank Warmerdam  <warmerda@gdal.velocet.ca>\n\n\t* Applied \"a\" mode fix to tif_win32.c/TIFFOpen() as suggested \n\t  by Christopher Lawton <clawton@mathworks.com>\n\nWed Sep  8 08:19:18 1999  Frank Warmerdam  <warmerda@gdal.velocet.ca>\n\n\t* Added IRIX/gcc, and OSF/1 4.x support on behalf of \n\t  Albert Chin-A-Young <china@thewrittenword.com>\n\n\t* Added TIFFReassignTagToIgnore() API on behalf of \n\t  Bruce Cameron <cameron@petris.com>.  Man page still pending.\n\nWed Aug 25 11:39:07 1999  Frank Warmerdam  <warmerda@gdal.velocet.ca>\n\n\t* Added test target in Makefile, test_pics.sh script and pics/*.rpt \n\tfiles to provide for a rudimentary testsuite.\n\n\t* Added contrib/tags back from old distribution ... fixed up a bit.\n\n1999-08-16    <warmerda@CS46980-B>\n\n\t* Added simple makefile.vc makefiles for building with MS VC++\n\ton Windows NT/98/95 in console mode.  Stuff in contrib/win* make give \n\tbetter solutions for some users.\n\nMon Aug 16 21:52:11 1999  Frank Warmerdam  <warmerda@gdal.velocet.ca>\n\n\t* Added addtiffo (add overviews to a TIFF file) in contrib.  Didn't\n\tput it in tools since part of it is in C++.\n\n1999-08-16  Michael L. Welles  <mike@kurtz.fake>\n\n\t* Updated html/index.html with anon CVS instructions. \n\nMon Aug 16 13:18:41 1999  Frank Warmerdam  <warmerda@gdal.velocet.ca>\n\n\t* pre-remove so link before softlink in LINUXdso action in \n\tlibtiff/Makefile.in to avoid failure on LINUXdso builds other than\n\tthe first.\n\n\t* Fixed problem with cvtcmap() in tif_getimage.c modifying the\n\tcolormaps owned by the TIFF handle itself when trying to fixup wrong\n\t(eight bit) colormaps.  Corrected by maintaining a private copy of\n\tthe colormap. \n\n\t* Added TIFFReadRGBATile()/TIFFReadRGBAStrip() support in \n\ttif_getimage.c.\n\n\t* CVS Repository placed at remotesensing.org.  ChangeLog added.\n"
  },
  {
    "path": "src/main/jni/tiff/HOWTO-RELEASE",
    "content": "HOWTO-RELEASE: \n\nNotes on releasing.\n\n0. Make sure that you have current FSF releases of autoconf, automake,\n   and libtool packages installed under a common installation prefix\n   and that these tools are in your executable search path prior to\n   any other installed versions.  Versions delivered with Linux may be\n   altered so it is best to install official FSF releases. GNU 'm4'\n   1.4.6 or later is needed in order to avoid bugs in m4. These\n   packages may be downloaded from the following ftp locations:\n\n     autoconf - ftp://ftp.gnu.org/pub/gnu/autoconf\n     automake - ftp://ftp.gnu.org/pub/gnu/automake\n     libtool  - ftp://ftp.gnu.org/pub/gnu/libtool\n\n   Release builds should only be done on a system with a functioning\n   and correctly set system clock and on a filesystem which accurately\n   records file update times.  Use of GNU make is recommended.\n\n1. Commit any unsaved changes. \n\n2. Create html/vX.X.html.  Take ChangeLog entries and html-ify in there. \n   Easist thing to do is take html/vX.(X-1).html and use it as a template.\n   Add that file to the list of EXTRA_DIST files in the html/Makefile.am.\n\n3. Update html/index.html to refer to this new page as the current release.\n\n4. Increment the release version in configure.ac.  Put 'alpha' or\n   'beta' after the version, if applicable.  For example:\n\n     3.9.1\n      or\n     3.9.1beta\n\n   Version should be updated in two places: in the second argument of the\n   AC_INIT macro and in LIBTIFF_xxx_VERSION variables.\n\n5. Add an entry to Changelog similar to:\n\n     * libtiff 3.9.1 released.\n\n6. In the source tree do\n\n     ./autogen.sh\n\n   This step may be skipped if you have already been using a\n   maintainer build with current autoconf, automake, and libtool\n   packages.  It is only needed when updating tool versions.\n\n7. It is recommended (but not required) to build outside of the source\n   tree so that the source tree is kept in a pristine state.  This\n   also allows sharing the source directory on several networked\n   systems.  For example:\n\n     mkdir libtiff-build\n     cd libtiff-build\n     /path/to/libtiff/configure --enable-maintainer-mode\n\n   otherwise do\n\n     ./configure --enable-maintainer-mode\n\n8. In the build tree do\n\n     make release\n\n   This will update \"RELEASE-DATE\", \"VERSION\", and libtiff/tiffvers.h\n   in the source tree.\n\n9. In the source tree, verify that the version info in RELEASE-DATE,\n   VERSION and libtiff/tiffvers.h is right.\n\n10. In the build tree do\n\n      make\n      make distcheck\n\n    If 'make distcheck' fails, then correct any issues until it\n    succeeds.\n\n    Two files with names tiff-version.tar.gz and tiff-version.zip will\n    be created in the top level build directory.\n\n11. In the source tree do\n\n      'cvs commit'.\n\n12. In the source tree do\n\n      cvs tag Release-v3-9-1\n\n    (or the appropriate name for the release)\n\n13. Copy release packages from the build tree to the\n    ftp.remotesensing.org ftp site.\n\n      scp tiff-*.tar.gz tiff-*.zip \\\n    \t frankw@upload.osgeo.org:/osgeo/download/libtiff\n\n14. Announce to list, tiff@lists.maptools.org\n\n15. Update libtiff page on freshmeat with new version announcement.\n\n\n"
  },
  {
    "path": "src/main/jni/tiff/Makefile.am",
    "content": "# Tag Image File Format (TIFF) Software\n#\n# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>\n#\n# Permission to use, copy, modify, distribute, and sell this software and \n# its documentation for any purpose is hereby granted without fee, provided\n# that (i) the above copyright notices and this permission notice appear in\n# all copies of the software and related documentation, and (ii) the names of\n# Sam Leffler and Silicon Graphics may not be used in any advertising or\n# publicity relating to the software without the specific, prior written\n# permission of Sam Leffler and Silicon Graphics.\n# \n# THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n# \n# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n# OF THIS SOFTWARE.\n\n# Process this file with automake to produce Makefile.in.\n\ndocdir = $(LIBTIFF_DOCDIR)\n\nAUTOMAKE_OPTIONS = 1.11 dist-zip foreign\nACLOCAL_AMFLAGS = -I m4\n\ndocfiles = \\\n\tCOPYRIGHT \\\n\tChangeLog \\\n\tREADME \\\n\tREADME.vms \\\n\tRELEASE-DATE \\\n\tTODO \\\n\tVERSION\n\nEXTRA_DIST = \\\n\tHOWTO-RELEASE \\\n\tMakefile.vc \\\n\tSConstruct \\\n\tautogen.sh \\\n\tconfigure.com \\\n\tnmake.opt\n\ndist_doc_DATA = $(docfiles)\n\nSUBDIRS = port libtiff tools build contrib test man html\n\nrelease:\n\t(rm -f $(top_srcdir)/RELEASE-DATE && echo $(LIBTIFF_RELEASE_DATE) > $(top_srcdir)/RELEASE-DATE)\n\t(rm -f $(top_srcdir)/VERSION && echo $(LIBTIFF_VERSION) > $(top_srcdir)/VERSION)\n\t(rm -f $(top_srcdir)/libtiff/tiffvers.h && sed 's,LIBTIFF_VERSION,$(LIBTIFF_VERSION),;s,LIBTIFF_RELEASE_DATE,$(LIBTIFF_RELEASE_DATE),' $(top_srcdir)/libtiff/tiffvers.h.in > $(top_srcdir)/libtiff/tiffvers.h)\n\n"
  },
  {
    "path": "src/main/jni/tiff/Makefile.in",
    "content": "# Makefile.in generated by automake 1.11 from Makefile.am.\n# @configure_input@\n\n# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,\n# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,\n# Inc.\n# This Makefile.in is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY, to the extent permitted by law; without\n# even the implied warranty of MERCHANTABILITY or FITNESS FOR A\n# PARTICULAR PURPOSE.\n\n@SET_MAKE@\n\n# Tag Image File Format (TIFF) Software\n#\n# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>\n#\n# Permission to use, copy, modify, distribute, and sell this software and \n# its documentation for any purpose is hereby granted without fee, provided\n# that (i) the above copyright notices and this permission notice appear in\n# all copies of the software and related documentation, and (ii) the names of\n# Sam Leffler and Silicon Graphics may not be used in any advertising or\n# publicity relating to the software without the specific, prior written\n# permission of Sam Leffler and Silicon Graphics.\n# \n# THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n# \n# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n# OF THIS SOFTWARE.\n\n# Process this file with automake to produce Makefile.in.\n\nVPATH = @srcdir@\npkgdatadir = $(datadir)/@PACKAGE@\npkgincludedir = $(includedir)/@PACKAGE@\npkglibdir = $(libdir)/@PACKAGE@\npkglibexecdir = $(libexecdir)/@PACKAGE@\nam__cd = CDPATH=\"$${ZSH_VERSION+.}$(PATH_SEPARATOR)\" && cd\ninstall_sh_DATA = $(install_sh) -c -m 644\ninstall_sh_PROGRAM = $(install_sh) -c\ninstall_sh_SCRIPT = $(install_sh) -c\nINSTALL_HEADER = $(INSTALL_DATA)\ntransform = $(program_transform_name)\nNORMAL_INSTALL = :\nPRE_INSTALL = :\nPOST_INSTALL = :\nNORMAL_UNINSTALL = :\nPRE_UNINSTALL = :\nPOST_UNINSTALL = :\nbuild_triplet = @build@\nhost_triplet = @host@\ntarget_triplet = @target@\nsubdir = .\nDIST_COMMON = README $(am__configure_deps) $(dist_doc_DATA) \\\n\t$(srcdir)/Makefile.am $(srcdir)/Makefile.in \\\n\t$(top_srcdir)/configure ChangeLog TODO config/compile \\\n\tconfig/config.guess config/config.sub config/depcomp \\\n\tconfig/install-sh config/ltmain.sh config/missing \\\n\tconfig/mkinstalldirs\nACLOCAL_M4 = $(top_srcdir)/aclocal.m4\nam__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \\\n\t$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \\\n\t$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \\\n\t$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac\nam__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \\\n\t$(ACLOCAL_M4)\nam__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \\\n configure.lineno config.status.lineno\nmkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs\nCONFIG_HEADER = $(top_builddir)/libtiff/tif_config.h \\\n\t$(top_builddir)/libtiff/tiffconf.h\nCONFIG_CLEAN_FILES =\nCONFIG_CLEAN_VPATH_FILES =\nAM_V_GEN = $(am__v_GEN_$(V))\nam__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))\nam__v_GEN_0 = @echo \"  GEN   \" $@;\nAM_V_at = $(am__v_at_$(V))\nam__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))\nam__v_at_0 = @\nSOURCES =\nDIST_SOURCES =\nRECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \\\n\thtml-recursive info-recursive install-data-recursive \\\n\tinstall-dvi-recursive install-exec-recursive \\\n\tinstall-html-recursive install-info-recursive \\\n\tinstall-pdf-recursive install-ps-recursive install-recursive \\\n\tinstallcheck-recursive installdirs-recursive pdf-recursive \\\n\tps-recursive uninstall-recursive\nam__vpath_adj_setup = srcdirstrip=`echo \"$(srcdir)\" | sed 's|.|.|g'`;\nam__vpath_adj = case $$p in \\\n    $(srcdir)/*) f=`echo \"$$p\" | sed \"s|^$$srcdirstrip/||\"`;; \\\n    *) f=$$p;; \\\n  esac;\nam__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;\nam__install_max = 40\nam__nobase_strip_setup = \\\n  srcdirstrip=`echo \"$(srcdir)\" | sed 's/[].[^$$\\\\*|]/\\\\\\\\&/g'`\nam__nobase_strip = \\\n  for p in $$list; do echo \"$$p\"; done | sed -e \"s|$$srcdirstrip/||\"\nam__nobase_list = $(am__nobase_strip_setup); \\\n  for p in $$list; do echo \"$$p $$p\"; done | \\\n  sed \"s| $$srcdirstrip/| |;\"' / .*\\//!s/ .*/ ./; s,\\( .*\\)/[^/]*$$,\\1,' | \\\n  $(AWK) 'BEGIN { files[\".\"] = \"\" } { files[$$2] = files[$$2] \" \" $$1; \\\n    if (++n[$$2] == $(am__install_max)) \\\n      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = \"\" } } \\\n    END { for (dir in files) print dir, files[dir] }'\nam__base_list = \\\n  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\\n/ /g' | \\\n  sed '$$!N;$$!N;$$!N;$$!N;s/\\n/ /g'\nam__installdirs = \"$(DESTDIR)$(docdir)\"\nDATA = $(dist_doc_DATA)\nRECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive\t\\\n  distclean-recursive maintainer-clean-recursive\nAM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \\\n\t$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \\\n\tdistdir dist dist-all distcheck\nETAGS = etags\nCTAGS = ctags\nDIST_SUBDIRS = $(SUBDIRS)\nDISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)\ndistdir = $(PACKAGE)-$(VERSION)\ntop_distdir = $(distdir)\nam__remove_distdir = \\\n  { test ! -d \"$(distdir)\" \\\n    || { find \"$(distdir)\" -type d ! -perm -200 -exec chmod u+w {} ';' \\\n         && rm -fr \"$(distdir)\"; }; }\nam__relativize = \\\n  dir0=`pwd`; \\\n  sed_first='s,^\\([^/]*\\)/.*$$,\\1,'; \\\n  sed_rest='s,^[^/]*/*,,'; \\\n  sed_last='s,^.*/\\([^/]*\\)$$,\\1,'; \\\n  sed_butlast='s,/*[^/]*$$,,'; \\\n  while test -n \"$$dir1\"; do \\\n    first=`echo \"$$dir1\" | sed -e \"$$sed_first\"`; \\\n    if test \"$$first\" != \".\"; then \\\n      if test \"$$first\" = \"..\"; then \\\n        dir2=`echo \"$$dir0\" | sed -e \"$$sed_last\"`/\"$$dir2\"; \\\n        dir0=`echo \"$$dir0\" | sed -e \"$$sed_butlast\"`; \\\n      else \\\n        first2=`echo \"$$dir2\" | sed -e \"$$sed_first\"`; \\\n        if test \"$$first2\" = \"$$first\"; then \\\n          dir2=`echo \"$$dir2\" | sed -e \"$$sed_rest\"`; \\\n        else \\\n          dir2=\"../$$dir2\"; \\\n        fi; \\\n        dir0=\"$$dir0\"/\"$$first\"; \\\n      fi; \\\n    fi; \\\n    dir1=`echo \"$$dir1\" | sed -e \"$$sed_rest\"`; \\\n  done; \\\n  reldir=\"$$dir2\"\nDIST_ARCHIVES = $(distdir).tar.gz $(distdir).zip\nGZIP_ENV = --best\ndistuninstallcheck_listfiles = find . -type f -print\ndistcleancheck_listfiles = find . -type f -print\nACLOCAL = @ACLOCAL@\nAMTAR = @AMTAR@\nAM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@\nAR = @AR@\nAS = @AS@\nAUTOCONF = @AUTOCONF@\nAUTOHEADER = @AUTOHEADER@\nAUTOMAKE = @AUTOMAKE@\nAWK = @AWK@\nCC = @CC@\nCCDEPMODE = @CCDEPMODE@\nCFLAGS = @CFLAGS@\nCPP = @CPP@\nCPPFLAGS = @CPPFLAGS@\nCXX = @CXX@\nCXXCPP = @CXXCPP@\nCXXDEPMODE = @CXXDEPMODE@\nCXXFLAGS = @CXXFLAGS@\nCYGPATH_W = @CYGPATH_W@\nDEFS = @DEFS@\nDEPDIR = @DEPDIR@\nDLLTOOL = @DLLTOOL@\nDSYMUTIL = @DSYMUTIL@\nDUMPBIN = @DUMPBIN@\nECHO_C = @ECHO_C@\nECHO_N = @ECHO_N@\nECHO_T = @ECHO_T@\nEGREP = @EGREP@\nEXEEXT = @EXEEXT@\nFGREP = @FGREP@\nGLUT_CFLAGS = @GLUT_CFLAGS@\nGLUT_LIBS = @GLUT_LIBS@\nGLU_CFLAGS = @GLU_CFLAGS@\nGLU_LIBS = @GLU_LIBS@\nGL_CFLAGS = @GL_CFLAGS@\nGL_LIBS = @GL_LIBS@\nGREP = @GREP@\nINSTALL = @INSTALL@\nINSTALL_DATA = @INSTALL_DATA@\nINSTALL_PROGRAM = @INSTALL_PROGRAM@\nINSTALL_SCRIPT = @INSTALL_SCRIPT@\nINSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@\nLD = @LD@\nLDFLAGS = @LDFLAGS@\nLIBDIR = @LIBDIR@\nLIBOBJS = @LIBOBJS@\nLIBS = @LIBS@\nLIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@\nLIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@\nLIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@\nLIBTIFF_MICRO_VERSION = @LIBTIFF_MICRO_VERSION@\nLIBTIFF_MINOR_VERSION = @LIBTIFF_MINOR_VERSION@\nLIBTIFF_RELEASE_DATE = @LIBTIFF_RELEASE_DATE@\nLIBTIFF_VERSION = @LIBTIFF_VERSION@\nLIBTIFF_VERSION_INFO = @LIBTIFF_VERSION_INFO@\nLIBTOOL = @LIBTOOL@\nLIPO = @LIPO@\nLN_S = @LN_S@\nLTLIBOBJS = @LTLIBOBJS@\nMAINT = @MAINT@\nMAKEINFO = @MAKEINFO@\nMKDIR_P = @MKDIR_P@\nNM = @NM@\nNMEDIT = @NMEDIT@\nOBJDUMP = @OBJDUMP@\nOBJEXT = @OBJEXT@\nOTOOL = @OTOOL@\nOTOOL64 = @OTOOL64@\nPACKAGE = @PACKAGE@\nPACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@\nPACKAGE_NAME = @PACKAGE_NAME@\nPACKAGE_STRING = @PACKAGE_STRING@\nPACKAGE_TARNAME = @PACKAGE_TARNAME@\nPACKAGE_URL = @PACKAGE_URL@\nPACKAGE_VERSION = @PACKAGE_VERSION@\nPATH_SEPARATOR = @PATH_SEPARATOR@\nPTHREAD_CC = @PTHREAD_CC@\nPTHREAD_CFLAGS = @PTHREAD_CFLAGS@\nPTHREAD_LIBS = @PTHREAD_LIBS@\nRANLIB = @RANLIB@\nSED = @SED@\nSET_MAKE = @SET_MAKE@\nSHELL = @SHELL@\nSTRIP = @STRIP@\nVERSION = @VERSION@\nXMKMF = @XMKMF@\nX_CFLAGS = @X_CFLAGS@\nX_EXTRA_LIBS = @X_EXTRA_LIBS@\nX_LIBS = @X_LIBS@\nX_PRE_LIBS = @X_PRE_LIBS@\nabs_builddir = @abs_builddir@\nabs_srcdir = @abs_srcdir@\nabs_top_builddir = @abs_top_builddir@\nabs_top_srcdir = @abs_top_srcdir@\nac_ct_CC = @ac_ct_CC@\nac_ct_CXX = @ac_ct_CXX@\nac_ct_DUMPBIN = @ac_ct_DUMPBIN@\nacx_pthread_config = @acx_pthread_config@\nam__include = @am__include@\nam__leading_dot = @am__leading_dot@\nam__quote = @am__quote@\nam__tar = @am__tar@\nam__untar = @am__untar@\nbindir = @bindir@\nbuild = @build@\nbuild_alias = @build_alias@\nbuild_cpu = @build_cpu@\nbuild_os = @build_os@\nbuild_vendor = @build_vendor@\nbuilddir = @builddir@\ndatadir = @datadir@\ndatarootdir = @datarootdir@\ndocdir = $(LIBTIFF_DOCDIR)\ndvidir = @dvidir@\nexec_prefix = @exec_prefix@\nhost = @host@\nhost_alias = @host_alias@\nhost_cpu = @host_cpu@\nhost_os = @host_os@\nhost_vendor = @host_vendor@\nhtmldir = @htmldir@\nincludedir = @includedir@\ninfodir = @infodir@\ninstall_sh = @install_sh@\nlibdir = @libdir@\nlibexecdir = @libexecdir@\nlocaledir = @localedir@\nlocalstatedir = @localstatedir@\nlt_ECHO = @lt_ECHO@\nmandir = @mandir@\nmkdir_p = @mkdir_p@\noldincludedir = @oldincludedir@\npdfdir = @pdfdir@\nprefix = @prefix@\nprogram_transform_name = @program_transform_name@\npsdir = @psdir@\nsbindir = @sbindir@\nsharedstatedir = @sharedstatedir@\nsrcdir = @srcdir@\nsysconfdir = @sysconfdir@\ntarget = @target@\ntarget_alias = @target_alias@\ntarget_cpu = @target_cpu@\ntarget_os = @target_os@\ntarget_vendor = @target_vendor@\ntop_build_prefix = @top_build_prefix@\ntop_builddir = @top_builddir@\ntop_srcdir = @top_srcdir@\nAUTOMAKE_OPTIONS = 1.11 dist-zip foreign\nACLOCAL_AMFLAGS = -I m4\ndocfiles = \\\n\tCOPYRIGHT \\\n\tChangeLog \\\n\tREADME \\\n\tREADME.vms \\\n\tRELEASE-DATE \\\n\tTODO \\\n\tVERSION\n\nEXTRA_DIST = \\\n\tHOWTO-RELEASE \\\n\tMakefile.vc \\\n\tSConstruct \\\n\tautogen.sh \\\n\tconfigure.com \\\n\tnmake.opt\n\ndist_doc_DATA = $(docfiles)\nSUBDIRS = port libtiff tools build contrib test man html\nall: all-recursive\n\n.SUFFIXES:\nam--refresh:\n\t@:\n$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)\n\t@for dep in $?; do \\\n\t  case '$(am__configure_deps)' in \\\n\t    *$$dep*) \\\n\t      echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \\\n\t      $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \\\n\t\t&& exit 0; \\\n\t      exit 1;; \\\n\t  esac; \\\n\tdone; \\\n\techo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \\\n\t$(am__cd) $(top_srcdir) && \\\n\t  $(AUTOMAKE) --foreign Makefile\n.PRECIOUS: Makefile\nMakefile: $(srcdir)/Makefile.in $(top_builddir)/config.status\n\t@case '$?' in \\\n\t  *config.status*) \\\n\t    echo ' $(SHELL) ./config.status'; \\\n\t    $(SHELL) ./config.status;; \\\n\t  *) \\\n\t    echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \\\n\t    cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \\\n\tesac;\n\n$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)\n\t$(SHELL) ./config.status --recheck\n\n$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)\n\t$(am__cd) $(srcdir) && $(AUTOCONF)\n$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)\n\t$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)\n$(am__aclocal_m4_deps):\n\nmostlyclean-libtool:\n\t-rm -f *.lo\n\nclean-libtool:\n\t-rm -rf .libs _libs\n\ndistclean-libtool:\n\t-rm -f libtool config.lt\ninstall-dist_docDATA: $(dist_doc_DATA)\n\t@$(NORMAL_INSTALL)\n\ttest -z \"$(docdir)\" || $(MKDIR_P) \"$(DESTDIR)$(docdir)\"\n\t@list='$(dist_doc_DATA)'; test -n \"$(docdir)\" || list=; \\\n\tfor p in $$list; do \\\n\t  if test -f \"$$p\"; then d=; else d=\"$(srcdir)/\"; fi; \\\n\t  echo \"$$d$$p\"; \\\n\tdone | $(am__base_list) | \\\n\twhile read files; do \\\n\t  echo \" $(INSTALL_DATA) $$files '$(DESTDIR)$(docdir)'\"; \\\n\t  $(INSTALL_DATA) $$files \"$(DESTDIR)$(docdir)\" || exit $$?; \\\n\tdone\n\nuninstall-dist_docDATA:\n\t@$(NORMAL_UNINSTALL)\n\t@list='$(dist_doc_DATA)'; test -n \"$(docdir)\" || list=; \\\n\tfiles=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \\\n\ttest -n \"$$files\" || exit 0; \\\n\techo \" ( cd '$(DESTDIR)$(docdir)' && rm -f\" $$files \")\"; \\\n\tcd \"$(DESTDIR)$(docdir)\" && rm -f $$files\n\n# This directory's subdirectories are mostly independent; you can cd\n# into them and run `make' without going through this Makefile.\n# To change the values of `make' variables: instead of editing Makefiles,\n# (1) if the variable is set in `config.status', edit `config.status'\n#     (which will cause the Makefiles to be regenerated when you run `make');\n# (2) otherwise, pass the desired values on the `make' command line.\n$(RECURSIVE_TARGETS):\n\t@failcom='exit 1'; \\\n\tfor f in x $$MAKEFLAGS; do \\\n\t  case $$f in \\\n\t    *=* | --[!k]*);; \\\n\t    *k*) failcom='fail=yes';; \\\n\t  esac; \\\n\tdone; \\\n\tdot_seen=no; \\\n\ttarget=`echo $@ | sed s/-recursive//`; \\\n\tlist='$(SUBDIRS)'; for subdir in $$list; do \\\n\t  echo \"Making $$target in $$subdir\"; \\\n\t  if test \"$$subdir\" = \".\"; then \\\n\t    dot_seen=yes; \\\n\t    local_target=\"$$target-am\"; \\\n\t  else \\\n\t    local_target=\"$$target\"; \\\n\t  fi; \\\n\t  ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \\\n\t  || eval $$failcom; \\\n\tdone; \\\n\tif test \"$$dot_seen\" = \"no\"; then \\\n\t  $(MAKE) $(AM_MAKEFLAGS) \"$$target-am\" || exit 1; \\\n\tfi; test -z \"$$fail\"\n\n$(RECURSIVE_CLEAN_TARGETS):\n\t@failcom='exit 1'; \\\n\tfor f in x $$MAKEFLAGS; do \\\n\t  case $$f in \\\n\t    *=* | --[!k]*);; \\\n\t    *k*) failcom='fail=yes';; \\\n\t  esac; \\\n\tdone; \\\n\tdot_seen=no; \\\n\tcase \"$@\" in \\\n\t  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \\\n\t  *) list='$(SUBDIRS)' ;; \\\n\tesac; \\\n\trev=''; for subdir in $$list; do \\\n\t  if test \"$$subdir\" = \".\"; then :; else \\\n\t    rev=\"$$subdir $$rev\"; \\\n\t  fi; \\\n\tdone; \\\n\trev=\"$$rev .\"; \\\n\ttarget=`echo $@ | sed s/-recursive//`; \\\n\tfor subdir in $$rev; do \\\n\t  echo \"Making $$target in $$subdir\"; \\\n\t  if test \"$$subdir\" = \".\"; then \\\n\t    local_target=\"$$target-am\"; \\\n\t  else \\\n\t    local_target=\"$$target\"; \\\n\t  fi; \\\n\t  ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \\\n\t  || eval $$failcom; \\\n\tdone && test -z \"$$fail\"\ntags-recursive:\n\tlist='$(SUBDIRS)'; for subdir in $$list; do \\\n\t  test \"$$subdir\" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \\\n\tdone\nctags-recursive:\n\tlist='$(SUBDIRS)'; for subdir in $$list; do \\\n\t  test \"$$subdir\" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \\\n\tdone\n\nID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)\n\tlist='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \\\n\tunique=`for i in $$list; do \\\n\t    if test -f \"$$i\"; then echo $$i; else echo $(srcdir)/$$i; fi; \\\n\t  done | \\\n\t  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \\\n\t      END { if (nonempty) { for (i in files) print i; }; }'`; \\\n\tmkid -fID $$unique\ntags: TAGS\n\nTAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \\\n\t\t$(TAGS_FILES) $(LISP)\n\tset x; \\\n\there=`pwd`; \\\n\tif ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \\\n\t  include_option=--etags-include; \\\n\t  empty_fix=.; \\\n\telse \\\n\t  include_option=--include; \\\n\t  empty_fix=; \\\n\tfi; \\\n\tlist='$(SUBDIRS)'; for subdir in $$list; do \\\n\t  if test \"$$subdir\" = .; then :; else \\\n\t    test ! -f $$subdir/TAGS || \\\n\t      set \"$$@\" \"$$include_option=$$here/$$subdir/TAGS\"; \\\n\t  fi; \\\n\tdone; \\\n\tlist='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \\\n\tunique=`for i in $$list; do \\\n\t    if test -f \"$$i\"; then echo $$i; else echo $(srcdir)/$$i; fi; \\\n\t  done | \\\n\t  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \\\n\t      END { if (nonempty) { for (i in files) print i; }; }'`; \\\n\tshift; \\\n\tif test -z \"$(ETAGS_ARGS)$$*$$unique\"; then :; else \\\n\t  test -n \"$$unique\" || unique=$$empty_fix; \\\n\t  if test $$# -gt 0; then \\\n\t    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \\\n\t      \"$$@\" $$unique; \\\n\t  else \\\n\t    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \\\n\t      $$unique; \\\n\t  fi; \\\n\tfi\nctags: CTAGS\nCTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \\\n\t\t$(TAGS_FILES) $(LISP)\n\tlist='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \\\n\tunique=`for i in $$list; do \\\n\t    if test -f \"$$i\"; then echo $$i; else echo $(srcdir)/$$i; fi; \\\n\t  done | \\\n\t  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \\\n\t      END { if (nonempty) { for (i in files) print i; }; }'`; \\\n\ttest -z \"$(CTAGS_ARGS)$$unique\" \\\n\t  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \\\n\t     $$unique\n\nGTAGS:\n\there=`$(am__cd) $(top_builddir) && pwd` \\\n\t  && $(am__cd) $(top_srcdir) \\\n\t  && gtags -i $(GTAGS_ARGS) \"$$here\"\n\ndistclean-tags:\n\t-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags\n\ndistdir: $(DISTFILES)\n\t$(am__remove_distdir)\n\ttest -d \"$(distdir)\" || mkdir \"$(distdir)\"\n\t@srcdirstrip=`echo \"$(srcdir)\" | sed 's/[].[^$$\\\\*]/\\\\\\\\&/g'`; \\\n\ttopsrcdirstrip=`echo \"$(top_srcdir)\" | sed 's/[].[^$$\\\\*]/\\\\\\\\&/g'`; \\\n\tlist='$(DISTFILES)'; \\\n\t  dist_files=`for file in $$list; do echo $$file; done | \\\n\t  sed -e \"s|^$$srcdirstrip/||;t\" \\\n\t      -e \"s|^$$topsrcdirstrip/|$(top_builddir)/|;t\"`; \\\n\tcase $$dist_files in \\\n\t  */*) $(MKDIR_P) `echo \"$$dist_files\" | \\\n\t\t\t   sed '/\\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \\\n\t\t\t   sort -u` ;; \\\n\tesac; \\\n\tfor file in $$dist_files; do \\\n\t  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \\\n\t  if test -d $$d/$$file; then \\\n\t    dir=`echo \"/$$file\" | sed -e 's,/[^/]*$$,,'`; \\\n\t    if test -d \"$(distdir)/$$file\"; then \\\n\t      find \"$(distdir)/$$file\" -type d ! -perm -700 -exec chmod u+rwx {} \\;; \\\n\t    fi; \\\n\t    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \\\n\t      cp -fpR $(srcdir)/$$file \"$(distdir)$$dir\" || exit 1; \\\n\t      find \"$(distdir)/$$file\" -type d ! -perm -700 -exec chmod u+rwx {} \\;; \\\n\t    fi; \\\n\t    cp -fpR $$d/$$file \"$(distdir)$$dir\" || exit 1; \\\n\t  else \\\n\t    test -f \"$(distdir)/$$file\" \\\n\t    || cp -p $$d/$$file \"$(distdir)/$$file\" \\\n\t    || exit 1; \\\n\t  fi; \\\n\tdone\n\t@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \\\n\t  if test \"$$subdir\" = .; then :; else \\\n\t    test -d \"$(distdir)/$$subdir\" \\\n\t    || $(MKDIR_P) \"$(distdir)/$$subdir\" \\\n\t    || exit 1; \\\n\t  fi; \\\n\tdone\n\t@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \\\n\t  if test \"$$subdir\" = .; then :; else \\\n\t    dir1=$$subdir; dir2=\"$(distdir)/$$subdir\"; \\\n\t    $(am__relativize); \\\n\t    new_distdir=$$reldir; \\\n\t    dir1=$$subdir; dir2=\"$(top_distdir)\"; \\\n\t    $(am__relativize); \\\n\t    new_top_distdir=$$reldir; \\\n\t    echo \" (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=\"$$new_top_distdir\" distdir=\"$$new_distdir\" \\\\\"; \\\n\t    echo \"     am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)\"; \\\n\t    ($(am__cd) $$subdir && \\\n\t      $(MAKE) $(AM_MAKEFLAGS) \\\n\t        top_distdir=\"$$new_top_distdir\" \\\n\t        distdir=\"$$new_distdir\" \\\n\t\tam__remove_distdir=: \\\n\t\tam__skip_length_check=: \\\n\t\tam__skip_mode_fix=: \\\n\t        distdir) \\\n\t      || exit 1; \\\n\t  fi; \\\n\tdone\n\t-test -n \"$(am__skip_mode_fix)\" \\\n\t|| find \"$(distdir)\" -type d ! -perm -777 -exec chmod a+rwx {} \\; -o \\\n\t  ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \\; -o \\\n\t  ! -type d ! -perm -400 -exec chmod a+r {} \\; -o \\\n\t  ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \\; \\\n\t|| chmod -R a+r \"$(distdir)\"\ndist-gzip: distdir\n\ttardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz\n\t$(am__remove_distdir)\n\ndist-bzip2: distdir\n\ttardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2\n\t$(am__remove_distdir)\n\ndist-lzma: distdir\n\ttardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma\n\t$(am__remove_distdir)\n\ndist-xz: distdir\n\ttardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz\n\t$(am__remove_distdir)\n\ndist-tarZ: distdir\n\ttardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z\n\t$(am__remove_distdir)\n\ndist-shar: distdir\n\tshar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz\n\t$(am__remove_distdir)\ndist-zip: distdir\n\t-rm -f $(distdir).zip\n\tzip -rq $(distdir).zip $(distdir)\n\t$(am__remove_distdir)\n\ndist dist-all: distdir\n\ttardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz\n\t-rm -f $(distdir).zip\n\tzip -rq $(distdir).zip $(distdir)\n\t$(am__remove_distdir)\n\n# This target untars the dist file and tries a VPATH configuration.  Then\n# it guarantees that the distribution is self-contained by making another\n# tarfile.\ndistcheck: dist\n\tcase '$(DIST_ARCHIVES)' in \\\n\t*.tar.gz*) \\\n\t  GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\\\n\t*.tar.bz2*) \\\n\t  bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\\\n\t*.tar.lzma*) \\\n\t  unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\\\n\t*.tar.xz*) \\\n\t  xz -dc $(distdir).tar.xz | $(am__untar) ;;\\\n\t*.tar.Z*) \\\n\t  uncompress -c $(distdir).tar.Z | $(am__untar) ;;\\\n\t*.shar.gz*) \\\n\t  GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\\\n\t*.zip*) \\\n\t  unzip $(distdir).zip ;;\\\n\tesac\n\tchmod -R a-w $(distdir); chmod a+w $(distdir)\n\tmkdir $(distdir)/_build\n\tmkdir $(distdir)/_inst\n\tchmod a-w $(distdir)\n\ttest -d $(distdir)/_build || exit 0; \\\n\tdc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\\\/]:[\\\\/],/,'` \\\n\t  && dc_destdir=\"$${TMPDIR-/tmp}/am-dc-$$$$/\" \\\n\t  && am__cwd=`pwd` \\\n\t  && $(am__cd) $(distdir)/_build \\\n\t  && ../configure --srcdir=.. --prefix=\"$$dc_install_base\" \\\n\t    $(DISTCHECK_CONFIGURE_FLAGS) \\\n\t  && $(MAKE) $(AM_MAKEFLAGS) \\\n\t  && $(MAKE) $(AM_MAKEFLAGS) dvi \\\n\t  && $(MAKE) $(AM_MAKEFLAGS) check \\\n\t  && $(MAKE) $(AM_MAKEFLAGS) install \\\n\t  && $(MAKE) $(AM_MAKEFLAGS) installcheck \\\n\t  && $(MAKE) $(AM_MAKEFLAGS) uninstall \\\n\t  && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir=\"$$dc_install_base\" \\\n\t        distuninstallcheck \\\n\t  && chmod -R a-w \"$$dc_install_base\" \\\n\t  && ({ \\\n\t       (cd ../.. && umask 077 && mkdir \"$$dc_destdir\") \\\n\t       && $(MAKE) $(AM_MAKEFLAGS) DESTDIR=\"$$dc_destdir\" install \\\n\t       && $(MAKE) $(AM_MAKEFLAGS) DESTDIR=\"$$dc_destdir\" uninstall \\\n\t       && $(MAKE) $(AM_MAKEFLAGS) DESTDIR=\"$$dc_destdir\" \\\n\t            distuninstallcheck_dir=\"$$dc_destdir\" distuninstallcheck; \\\n\t      } || { rm -rf \"$$dc_destdir\"; exit 1; }) \\\n\t  && rm -rf \"$$dc_destdir\" \\\n\t  && $(MAKE) $(AM_MAKEFLAGS) dist \\\n\t  && rm -rf $(DIST_ARCHIVES) \\\n\t  && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \\\n\t  && cd \"$$am__cwd\" \\\n\t  || exit 1\n\t$(am__remove_distdir)\n\t@(echo \"$(distdir) archives ready for distribution: \"; \\\n\t  list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \\\n\t  sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'\ndistuninstallcheck:\n\t@$(am__cd) '$(distuninstallcheck_dir)' \\\n\t&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \\\n\t   || { echo \"ERROR: files left after uninstall:\" ; \\\n\t        if test -n \"$(DESTDIR)\"; then \\\n\t          echo \"  (check DESTDIR support)\"; \\\n\t        fi ; \\\n\t        $(distuninstallcheck_listfiles) ; \\\n\t        exit 1; } >&2\ndistcleancheck: distclean\n\t@if test '$(srcdir)' = . ; then \\\n\t  echo \"ERROR: distcleancheck can only run from a VPATH build\" ; \\\n\t  exit 1 ; \\\n\tfi\n\t@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \\\n\t  || { echo \"ERROR: files left in build directory after distclean:\" ; \\\n\t       $(distcleancheck_listfiles) ; \\\n\t       exit 1; } >&2\ncheck-am: all-am\ncheck: check-recursive\nall-am: Makefile $(DATA)\ninstalldirs: installdirs-recursive\ninstalldirs-am:\n\tfor dir in \"$(DESTDIR)$(docdir)\"; do \\\n\t  test -z \"$$dir\" || $(MKDIR_P) \"$$dir\"; \\\n\tdone\ninstall: install-recursive\ninstall-exec: install-exec-recursive\ninstall-data: install-data-recursive\nuninstall: uninstall-recursive\n\ninstall-am: all-am\n\t@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am\n\ninstallcheck: installcheck-recursive\ninstall-strip:\n\t$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM=\"$(INSTALL_STRIP_PROGRAM)\" \\\n\t  install_sh_PROGRAM=\"$(INSTALL_STRIP_PROGRAM)\" INSTALL_STRIP_FLAG=-s \\\n\t  `test -z '$(STRIP)' || \\\n\t    echo \"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'\"` install\nmostlyclean-generic:\n\nclean-generic:\n\ndistclean-generic:\n\t-test -z \"$(CONFIG_CLEAN_FILES)\" || rm -f $(CONFIG_CLEAN_FILES)\n\t-test . = \"$(srcdir)\" || test -z \"$(CONFIG_CLEAN_VPATH_FILES)\" || rm -f $(CONFIG_CLEAN_VPATH_FILES)\n\nmaintainer-clean-generic:\n\t@echo \"This command is intended for maintainers to use\"\n\t@echo \"it deletes files that may require special tools to rebuild.\"\nclean: clean-recursive\n\nclean-am: clean-generic clean-libtool mostlyclean-am\n\ndistclean: distclean-recursive\n\t-rm -f $(am__CONFIG_DISTCLEAN_FILES)\n\t-rm -f Makefile\ndistclean-am: clean-am distclean-generic distclean-libtool \\\n\tdistclean-tags\n\ndvi: dvi-recursive\n\ndvi-am:\n\nhtml: html-recursive\n\nhtml-am:\n\ninfo: info-recursive\n\ninfo-am:\n\ninstall-data-am: install-dist_docDATA\n\ninstall-dvi: install-dvi-recursive\n\ninstall-dvi-am:\n\ninstall-exec-am:\n\ninstall-html: install-html-recursive\n\ninstall-html-am:\n\ninstall-info: install-info-recursive\n\ninstall-info-am:\n\ninstall-man:\n\ninstall-pdf: install-pdf-recursive\n\ninstall-pdf-am:\n\ninstall-ps: install-ps-recursive\n\ninstall-ps-am:\n\ninstallcheck-am:\n\nmaintainer-clean: maintainer-clean-recursive\n\t-rm -f $(am__CONFIG_DISTCLEAN_FILES)\n\t-rm -rf $(top_srcdir)/autom4te.cache\n\t-rm -f Makefile\nmaintainer-clean-am: distclean-am maintainer-clean-generic\n\nmostlyclean: mostlyclean-recursive\n\nmostlyclean-am: mostlyclean-generic mostlyclean-libtool\n\npdf: pdf-recursive\n\npdf-am:\n\nps: ps-recursive\n\nps-am:\n\nuninstall-am: uninstall-dist_docDATA\n\n.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \\\n\tinstall-am install-strip tags-recursive\n\n.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \\\n\tall all-am am--refresh check check-am clean clean-generic \\\n\tclean-libtool ctags ctags-recursive dist dist-all dist-bzip2 \\\n\tdist-gzip dist-lzma dist-shar dist-tarZ dist-xz dist-zip \\\n\tdistcheck distclean distclean-generic distclean-libtool \\\n\tdistclean-tags distcleancheck distdir distuninstallcheck dvi \\\n\tdvi-am html html-am info info-am install install-am \\\n\tinstall-data install-data-am install-dist_docDATA install-dvi \\\n\tinstall-dvi-am install-exec install-exec-am install-html \\\n\tinstall-html-am install-info install-info-am install-man \\\n\tinstall-pdf install-pdf-am install-ps install-ps-am \\\n\tinstall-strip installcheck installcheck-am installdirs \\\n\tinstalldirs-am maintainer-clean maintainer-clean-generic \\\n\tmostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \\\n\tps ps-am tags tags-recursive uninstall uninstall-am \\\n\tuninstall-dist_docDATA\n\n\nrelease:\n\t(rm -f $(top_srcdir)/RELEASE-DATE && echo $(LIBTIFF_RELEASE_DATE) > $(top_srcdir)/RELEASE-DATE)\n\t(rm -f $(top_srcdir)/VERSION && echo $(LIBTIFF_VERSION) > $(top_srcdir)/VERSION)\n\t(rm -f $(top_srcdir)/libtiff/tiffvers.h && sed 's,LIBTIFF_VERSION,$(LIBTIFF_VERSION),;s,LIBTIFF_RELEASE_DATE,$(LIBTIFF_RELEASE_DATE),' $(top_srcdir)/libtiff/tiffvers.h.in > $(top_srcdir)/libtiff/tiffvers.h)\n\n# Tell versions [3.59,3.63) of GNU make to not export all variables.\n# Otherwise a system limit (for SysV at least) may be exceeded.\n.NOEXPORT:\n"
  },
  {
    "path": "src/main/jni/tiff/Makefile.vc",
    "content": "# $Id: Makefile.vc,v 1.6 2006/10/13 10:30:21 dron Exp $\n#\n# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>\n#\n# Permission to use, copy, modify, distribute, and sell this software and \n# its documentation for any purpose is hereby granted without fee, provided\n# that (i) the above copyright notices and this permission notice appear in\n# all copies of the software and related documentation, and (ii) the names of\n# Sam Leffler and Silicon Graphics may not be used in any advertising or\n# publicity relating to the software without the specific, prior written\n# permission of Sam Leffler and Silicon Graphics.\n# \n# THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n# \n# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n# OF THIS SOFTWARE.\n#\n# Makefile for MS Visual C and Watcom C compilers.\n# Edit nmake.opt file if you want to ajust building options.\n#\n# To build:\n# C:\\libtiff> nmake /f makefile.vc \n\n!INCLUDE nmake.opt\n\nall:\tport lib tools\n\nport::\n\tcd port\n\t$(MAKE) /f Makefile.vc\n\tcd..\n\nlib:\tport\n\tcd libtiff\n\t$(MAKE) /f Makefile.vc\n\tcd..\n\ntools:\tlib\n\tcd tools\n\t$(MAKE) /f Makefile.vc\n\tcd ..\n\nclean:\n\t-del *.exe.manifest\n\tcd port\n\t$(MAKE) /f Makefile.vc clean\n\tcd..\n\tcd libtiff\n\t$(MAKE) /f Makefile.vc clean\n\tcd..\n\tcd tools\n\t$(MAKE) /f Makefile.vc clean\n\tcd ..\n\n\t-del *.ilk\n\t-del *.dll.manifest\n\t-del *.exe.manifest\n\t-del *.exp\n\t-del *.pdb\n"
  },
  {
    "path": "src/main/jni/tiff/README",
    "content": "$Header: /cvs/maptools/cvsroot/libtiff/README,v 1.5 2004/10/30 13:44:45 dron Exp $\n\n\nTIFF Software Distribution\n--------------------------\nThis file is just a placeholder; all the documentation is now in\nHTML in the html directory.  To view the documentation point your\nfavorite WWW viewer at html/index.html; e.g.\n\n    netscape html/index.html\n\nIf you don't have an HTML viewer then you can read the HTML source\nor fetch a PostScript version of this documentation from the directory\n\n    ftp://ftp.remotesensing.org/pub/libtiff/\n\nIf you can't hack either of these options then basically what you\nwant to do is:\n\n    % ./configure\n    % make\n    % su\n    # make install\n\nMore information, email contacts, and mailing list information can be \nfound online at http://www.remotesensing.org/libtiff/.\n\n\nUse and Copyright\n-----------------\nSilicon Graphics has seen fit to allow us to give this work away.  It\nis free.  There is no support or guarantee of any sort as to its\noperations, correctness, or whatever.  If you do anything useful with\nall or parts of it you need to honor the copyright notices.   I would\nalso be interested in knowing about it and, hopefully, be acknowledged.\n\nThe legal way of saying that is:\n\nCopyright (c) 1988-1997 Sam Leffler\nCopyright (c) 1991-1997 Silicon Graphics, Inc.\n\nPermission to use, copy, modify, distribute, and sell this software and \nits documentation for any purpose is hereby granted without fee, provided\nthat (i) the above copyright notices and this permission notice appear in\nall copies of the software and related documentation, and (ii) the names of\nSam Leffler and Silicon Graphics may not be used in any advertising or\npublicity relating to the software without the specific, prior written\npermission of Sam Leffler and Silicon Graphics.\n\nTHE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \nEXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \nWARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n\nIN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\nANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\nOR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\nWHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \nLIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \nOF THIS SOFTWARE.\n"
  },
  {
    "path": "src/main/jni/tiff/README.android",
    "content": "\nAdded or modified file list:\nAndroid.mk\nREADME.android\nlibtiff/tif_config.h\nlibtiff/tiffconf.h\n\nDeleted file list:\n(None)\n\nAuthor:\nfigofuture@gmail.com\n\n"
  },
  {
    "path": "src/main/jni/tiff/README.vms",
    "content": "Dear OpenVMS user\nto make this library, execute\n$@CONFIGURE\n$@BUILD\n\nBuild process should be error and warning free. When process will be finished,\nLIBTIFF$STRATUP.COM file containing all required definitions, will be  created.\nPlease call it from system startup procedure or individual user procedure LOGIN.COM\nTo link software with libtiff, use TIFF:LIBTIFF.OPT\n\nbest regards,\nAlexey Chupahin,   elvis_75@mail.ru\n"
  },
  {
    "path": "src/main/jni/tiff/RELEASE-DATE",
    "content": "20091104\n"
  },
  {
    "path": "src/main/jni/tiff/SConstruct",
    "content": "# $Id: SConstruct,v 1.4 2007/02/24 15:03:47 dron Exp $\n\n# Tag Image File Format (TIFF) Software\n#\n# Copyright (C) 2005, Andrey Kiselev <dron@ak4719.spb.edu>\n#\n# Permission to use, copy, modify, distribute, and sell this software and \n# its documentation for any purpose is hereby granted without fee, provided\n# that (i) the above copyright notices and this permission notice appear in\n# all copies of the software and related documentation, and (ii) the names of\n# Sam Leffler and Silicon Graphics may not be used in any advertising or\n# publicity relating to the software without the specific, prior written\n# permission of Sam Leffler and Silicon Graphics.\n# \n# THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n# \n# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n# OF THIS SOFTWARE.\n\n# This file contains rules to build software with the SCons tool\n# (see the http://www.scons.org/ for details on SCons).\n\nimport os\n\nenv = Environment()\n\n# Read the user supplied options\nopts = Options('libtiff.conf')\nopts.Add(PathOption('PREFIX', \\\n    'install architecture-independent files in this directory', \\\n    '/usr/local', PathOption.PathIsDirCreate))\nopts.Add(BoolOption('ccitt', \\\n    'enable support for CCITT Group 3 & 4 algorithms', \\\n    'yes'))\nopts.Add(BoolOption('packbits', \\\n    'enable support for Macintosh PackBits algorithm', \\\n    'yes'))\nopts.Add(BoolOption('lzw', \\\n    'enable support for LZW algorithm', \\\n    'yes'))\nopts.Add(BoolOption('thunder', \\\n    'enable support for ThunderScan 4-bit RLE algorithm', \\\n    'yes'))\nopts.Add(BoolOption('next', \\\n    'enable support for NeXT 2-bit RLE algorithm', \\\n    'yes'))\nopts.Add(BoolOption('logluv', \\\n    'enable support for LogLuv high dynamic range encoding', \\\n    'yes'))\nopts.Add(BoolOption('strip_chopping', \\\n    'support for strip chopping (whether or not to convert single-strip uncompressed images to mutiple strips of ~8Kb to reduce memory usage)', \\\n    'yes'))\nopts.Add(BoolOption('extrasample_as_alpha', \\\n    'the RGBA interface will treat a fourth sample with no EXTRASAMPLE_ value as being ASSOCALPHA. Many packages produce RGBA files but don\\'t mark the alpha properly', \\\n    'yes'))\nopts.Add(BoolOption('check_ycbcr_subsampling', \\\n    'disable picking up YCbCr subsampling info from the JPEG data stream to support files lacking the tag', \\\n    'yes'))\nopts.Update(env)\nopts.Save('libtiff.conf', env)\nHelp(opts.GenerateHelpText(env))\n\n# Here are our installation paths:\nidir_prefix = '$PREFIX'\nidir_lib = '$PREFIX/lib'\nidir_bin = '$PREFIX/bin'\nidir_inc = '$PREFIX/include'\nidir_doc = '$PREFIX/doc'\nExport([ 'env', 'idir_prefix', 'idir_lib', 'idir_bin', 'idir_inc', 'idir_doc' ])\n\n# Now proceed to system feature checks\ntarget_cpu, target_vendor, target_kernel, target_os = \\\n    os.popen(\"./config/config.guess\").readlines()[0].split(\"-\")\n\ndef Define(context, key, have):\n    import SCons.Conftest\n    SCons.Conftest._Have(context, key, have)\n\ndef CheckCustomOption(context, name):\n    context.Message('Checking is the ' + name + ' option set... ')\n    ret = env[name]\n    Define(context, name + '_SUPPORT', ret)\n    context.Result(ret)\n    return ret\n\ndef CheckFillorderOption(context):\n    context.Message('Checking for the native cpu bit order... ')\n    if target_cpu[0] == 'i' and target_cpu[2:] == '86':\n\tDefine(context, 'HOST_FILLORDER', 'FILLORDER_LSB2MSB')\n\tcontext.Result('lsb2msb')\n    else:\n\tDefine(context, 'HOST_FILLORDER', 'FILLORDER_MSB2LSB')\n\tcontext.Result('msb2lsb')\n    return 1\n\ndef CheckIEEEFPOption(context):\n    context.Message('Checking for the IEEE floating point format... ')\n    Define(context, 'HAVE_IEEEFP', 1)\n    context.Result(1)\n    return 1\n\ndef CheckOtherOption(context, name):\n    context.Message('Checking is the ' + name + ' option set... ')\n    ret = env[name]\n    Define(context, 'HAVE_' + name, ret)\n    context.Result(ret)\n    return ret\n\ncustom_tests = { \\\n    'CheckCustomOption' : CheckCustomOption, \\\n    'CheckFillorderOption' : CheckFillorderOption, \\\n    'CheckIEEEFPOption' : CheckIEEEFPOption, \\\n    'CheckOtherOption' : CheckOtherOption \\\n    }\nconf = Configure(env, custom_tests = custom_tests, \\\n    config_h = 'libtiff/tif_config.h')\n\n# Check for standard library\nconf.CheckLib('c')\nif target_os != 'cygwin' \\\n    and target_os != 'mingw32' \\\n    and target_os != 'beos' \\\n    and target_os != 'darwin':\n    conf.CheckLib('m')\n\n# Check for system headers\nconf.CheckCHeader('assert.h')\nconf.CheckCHeader('fcntl.h')\nconf.CheckCHeader('io.h')\nconf.CheckCHeader('limits.h')\nconf.CheckCHeader('malloc.h')\nconf.CheckCHeader('search.h')\nconf.CheckCHeader('sys/time.h')\nconf.CheckCHeader('unistd.h')\n\n# Check for standard library functions\nconf.CheckFunc('floor')\nconf.CheckFunc('isascii')\nconf.CheckFunc('memmove')\nconf.CheckFunc('memset')\nconf.CheckFunc('mmap')\nconf.CheckFunc('pow')\nconf.CheckFunc('setmode')\nconf.CheckFunc('sqrt')\nconf.CheckFunc('strchr')\nconf.CheckFunc('strrchr')\nconf.CheckFunc('strstr')\nconf.CheckFunc('strtol')\n\nconf.CheckFillorderOption()\nconf.CheckIEEEFPOption()\nconf.CheckCustomOption('ccitt')\nconf.CheckCustomOption('packbits')\nconf.CheckCustomOption('lzw')\nconf.CheckCustomOption('thunder')\nconf.CheckCustomOption('next')\nconf.CheckCustomOption('logluv')\nconf.CheckOtherOption('strip_chopping')\nconf.CheckOtherOption('extrasample_as_alpha')\nconf.CheckOtherOption('check_ycbcr_subsampling')\n\nenv = conf.Finish()\n\n# Ok, now go to build files in the subdirectories\nSConscript(dirs = [ 'libtiff' ], name = 'SConstruct')\n"
  },
  {
    "path": "src/main/jni/tiff/TODO",
    "content": "#\t$Header: /cvs/maptools/cvsroot/libtiff/TODO,v 1.6 2002/10/10 05:28:43 warmerda Exp $\n\no gif2tiff segaulting on selected images\no tiffcmp read data by strip/tile instead of scanline\no YCbCr sampling support\no extracate colorspace conversion support\no look at isolating all codecs from TIFF library\no JPEG colormode order dependency problem\no Write documentation on how do extend tags, and how the custom field\n  stuff all works. \n\n\n"
  },
  {
    "path": "src/main/jni/tiff/VERSION",
    "content": "3.9.2\n"
  },
  {
    "path": "src/main/jni/tiff/aclocal.m4",
    "content": "# generated automatically by aclocal 1.11 -*- Autoconf -*-\n\n# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,\n# 2005, 2006, 2007, 2008, 2009  Free Software Foundation, Inc.\n# This file is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY, to the extent permitted by law; without\n# even the implied warranty of MERCHANTABILITY or FITNESS FOR A\n# PARTICULAR PURPOSE.\n\nm4_ifndef([AC_AUTOCONF_VERSION],\n  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl\nm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.64],,\n[m4_warning([this file was generated for autoconf 2.64.\nYou have another version of autoconf.  It may work, but is not guaranteed to.\nIf you have problems, you may need to regenerate the build system entirely.\nTo do so, use the procedure documented by the package, typically `autoreconf'.])])\n\n# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.\n#\n# This file is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n# AM_AUTOMAKE_VERSION(VERSION)\n# ----------------------------\n# Automake X.Y traces this macro to ensure aclocal.m4 has been\n# generated from the m4 files accompanying Automake X.Y.\n# (This private macro should not be called outside this file.)\nAC_DEFUN([AM_AUTOMAKE_VERSION],\n[am__api_version='1.11'\ndnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to\ndnl require some minimum version.  Point them to the right macro.\nm4_if([$1], [1.11], [],\n      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl\n])\n\n# _AM_AUTOCONF_VERSION(VERSION)\n# -----------------------------\n# aclocal traces this macro to find the Autoconf version.\n# This is a private macro too.  Using m4_define simplifies\n# the logic in aclocal, which can simply ignore this definition.\nm4_define([_AM_AUTOCONF_VERSION], [])\n\n# AM_SET_CURRENT_AUTOMAKE_VERSION\n# -------------------------------\n# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.\n# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.\nAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],\n[AM_AUTOMAKE_VERSION([1.11])dnl\nm4_ifndef([AC_AUTOCONF_VERSION],\n  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl\n_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])\n\n# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-\n\n# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.\n#\n# This file is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets\n# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to\n# `$srcdir', `$srcdir/..', or `$srcdir/../..'.\n#\n# Of course, Automake must honor this variable whenever it calls a\n# tool from the auxiliary directory.  The problem is that $srcdir (and\n# therefore $ac_aux_dir as well) can be either absolute or relative,\n# depending on how configure is run.  This is pretty annoying, since\n# it makes $ac_aux_dir quite unusable in subdirectories: in the top\n# source directory, any form will work fine, but in subdirectories a\n# relative path needs to be adjusted first.\n#\n# $ac_aux_dir/missing\n#    fails when called from a subdirectory if $ac_aux_dir is relative\n# $top_srcdir/$ac_aux_dir/missing\n#    fails if $ac_aux_dir is absolute,\n#    fails when called from a subdirectory in a VPATH build with\n#          a relative $ac_aux_dir\n#\n# The reason of the latter failure is that $top_srcdir and $ac_aux_dir\n# are both prefixed by $srcdir.  In an in-source build this is usually\n# harmless because $srcdir is `.', but things will broke when you\n# start a VPATH build or use an absolute $srcdir.\n#\n# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,\n# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:\n#   am_aux_dir='\\$(top_srcdir)/'`expr \"$ac_aux_dir\" : \"$srcdir//*\\(.*\\)\"`\n# and then we would define $MISSING as\n#   MISSING=\"\\${SHELL} $am_aux_dir/missing\"\n# This will work as long as MISSING is not called from configure, because\n# unfortunately $(top_srcdir) has no meaning in configure.\n# However there are other variables, like CC, which are often used in\n# configure, and could therefore not use this \"fixed\" $ac_aux_dir.\n#\n# Another solution, used here, is to always expand $ac_aux_dir to an\n# absolute PATH.  The drawback is that using absolute paths prevent a\n# configured tree to be moved without reconfiguration.\n\nAC_DEFUN([AM_AUX_DIR_EXPAND],\n[dnl Rely on autoconf to set up CDPATH properly.\nAC_PREREQ([2.50])dnl\n# expand $ac_aux_dir to an absolute path\nam_aux_dir=`cd $ac_aux_dir && pwd`\n])\n\n# AM_CONDITIONAL                                            -*- Autoconf -*-\n\n# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008\n# Free Software Foundation, Inc.\n#\n# This file is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n# serial 9\n\n# AM_CONDITIONAL(NAME, SHELL-CONDITION)\n# -------------------------------------\n# Define a conditional.\nAC_DEFUN([AM_CONDITIONAL],\n[AC_PREREQ(2.52)dnl\n ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],\n\t[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl\nAC_SUBST([$1_TRUE])dnl\nAC_SUBST([$1_FALSE])dnl\n_AM_SUBST_NOTMAKE([$1_TRUE])dnl\n_AM_SUBST_NOTMAKE([$1_FALSE])dnl\nm4_define([_AM_COND_VALUE_$1], [$2])dnl\nif $2; then\n  $1_TRUE=\n  $1_FALSE='#'\nelse\n  $1_TRUE='#'\n  $1_FALSE=\nfi\nAC_CONFIG_COMMANDS_PRE(\n[if test -z \"${$1_TRUE}\" && test -z \"${$1_FALSE}\"; then\n  AC_MSG_ERROR([[conditional \"$1\" was never defined.\nUsually this means the macro was only invoked conditionally.]])\nfi])])\n\n# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009\n# Free Software Foundation, Inc.\n#\n# This file is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n# serial 10\n\n# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be\n# written in clear, in which case automake, when reading aclocal.m4,\n# will think it sees a *use*, and therefore will trigger all it's\n# C support machinery.  Also note that it means that autoscan, seeing\n# CC etc. in the Makefile, will ask for an AC_PROG_CC use...\n\n\n# _AM_DEPENDENCIES(NAME)\n# ----------------------\n# See how the compiler implements dependency checking.\n# NAME is \"CC\", \"CXX\", \"GCJ\", or \"OBJC\".\n# We try a few techniques and use that to set a single cache variable.\n#\n# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was\n# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular\n# dependency, and given that the user is not expected to run this macro,\n# just rely on AC_PROG_CC.\nAC_DEFUN([_AM_DEPENDENCIES],\n[AC_REQUIRE([AM_SET_DEPDIR])dnl\nAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl\nAC_REQUIRE([AM_MAKE_INCLUDE])dnl\nAC_REQUIRE([AM_DEP_TRACK])dnl\n\nifelse([$1], CC,   [depcc=\"$CC\"   am_compiler_list=],\n       [$1], CXX,  [depcc=\"$CXX\"  am_compiler_list=],\n       [$1], OBJC, [depcc=\"$OBJC\" am_compiler_list='gcc3 gcc'],\n       [$1], UPC,  [depcc=\"$UPC\"  am_compiler_list=],\n       [$1], GCJ,  [depcc=\"$GCJ\"  am_compiler_list='gcc3 gcc'],\n                   [depcc=\"$$1\"   am_compiler_list=])\n\nAC_CACHE_CHECK([dependency style of $depcc],\n               [am_cv_$1_dependencies_compiler_type],\n[if test -z \"$AMDEP_TRUE\" && test -f \"$am_depcomp\"; then\n  # We make a subdir and do the tests there.  Otherwise we can end up\n  # making bogus files that we don't know about and never remove.  For\n  # instance it was reported that on HP-UX the gcc test will end up\n  # making a dummy file named `D' -- because `-MD' means `put the output\n  # in D'.\n  mkdir conftest.dir\n  # Copy depcomp to subdir because otherwise we won't find it if we're\n  # using a relative directory.\n  cp \"$am_depcomp\" conftest.dir\n  cd conftest.dir\n  # We will build objects and dependencies in a subdirectory because\n  # it helps to detect inapplicable dependency modes.  For instance\n  # both Tru64's cc and ICC support -MD to output dependencies as a\n  # side effect of compilation, but ICC will put the dependencies in\n  # the current directory while Tru64 will put them in the object\n  # directory.\n  mkdir sub\n\n  am_cv_$1_dependencies_compiler_type=none\n  if test \"$am_compiler_list\" = \"\"; then\n     am_compiler_list=`sed -n ['s/^#*\\([a-zA-Z0-9]*\\))$/\\1/p'] < ./depcomp`\n  fi\n  am__universal=false\n  m4_case([$1], [CC],\n    [case \" $depcc \" in #(\n     *\\ -arch\\ *\\ -arch\\ *) am__universal=true ;;\n     esac],\n    [CXX],\n    [case \" $depcc \" in #(\n     *\\ -arch\\ *\\ -arch\\ *) am__universal=true ;;\n     esac])\n\n  for depmode in $am_compiler_list; do\n    # Setup a source with many dependencies, because some compilers\n    # like to wrap large dependency lists on column 80 (with \\), and\n    # we should not choose a depcomp mode which is confused by this.\n    #\n    # We need to recreate these files for each test, as the compiler may\n    # overwrite some of them when testing with obscure command lines.\n    # This happens at least with the AIX C compiler.\n    : > sub/conftest.c\n    for i in 1 2 3 4 5 6; do\n      echo '#include \"conftst'$i'.h\"' >> sub/conftest.c\n      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with\n      # Solaris 8's {/usr,}/bin/sh.\n      touch sub/conftst$i.h\n    done\n    echo \"${am__include} ${am__quote}sub/conftest.Po${am__quote}\" > confmf\n\n    # We check with `-c' and `-o' for the sake of the \"dashmstdout\"\n    # mode.  It turns out that the SunPro C++ compiler does not properly\n    # handle `-M -o', and we need to detect this.  Also, some Intel\n    # versions had trouble with output in subdirs\n    am__obj=sub/conftest.${OBJEXT-o}\n    am__minus_obj=\"-o $am__obj\"\n    case $depmode in\n    gcc)\n      # This depmode causes a compiler race in universal mode.\n      test \"$am__universal\" = false || continue\n      ;;\n    nosideeffect)\n      # after this tag, mechanisms are not by side-effect, so they'll\n      # only be used when explicitly requested\n      if test \"x$enable_dependency_tracking\" = xyes; then\n\tcontinue\n      else\n\tbreak\n      fi\n      ;;\n    msvisualcpp | msvcmsys)\n      # This compiler won't grok `-c -o', but also, the minuso test has\n      # not run yet.  These depmodes are late enough in the game, and\n      # so weak that their functioning should not be impacted.\n      am__obj=conftest.${OBJEXT-o}\n      am__minus_obj=\n      ;;\n    none) break ;;\n    esac\n    if depmode=$depmode \\\n       source=sub/conftest.c object=$am__obj \\\n       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \\\n       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \\\n         >/dev/null 2>conftest.err &&\n       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&\n       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&\n       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&\n       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then\n      # icc doesn't choke on unknown options, it will just issue warnings\n      # or remarks (even with -Werror).  So we grep stderr for any message\n      # that says an option was ignored or not supported.\n      # When given -MP, icc 7.0 and 7.1 complain thusly:\n      #   icc: Command line warning: ignoring option '-M'; no argument required\n      # The diagnosis changed in icc 8.0:\n      #   icc: Command line remark: option '-MP' not supported\n      if (grep 'ignoring option' conftest.err ||\n          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else\n        am_cv_$1_dependencies_compiler_type=$depmode\n        break\n      fi\n    fi\n  done\n\n  cd ..\n  rm -rf conftest.dir\nelse\n  am_cv_$1_dependencies_compiler_type=none\nfi\n])\nAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])\nAM_CONDITIONAL([am__fastdep$1], [\n  test \"x$enable_dependency_tracking\" != xno \\\n  && test \"$am_cv_$1_dependencies_compiler_type\" = gcc3])\n])\n\n\n# AM_SET_DEPDIR\n# -------------\n# Choose a directory name for dependency files.\n# This macro is AC_REQUIREd in _AM_DEPENDENCIES\nAC_DEFUN([AM_SET_DEPDIR],\n[AC_REQUIRE([AM_SET_LEADING_DOT])dnl\nAC_SUBST([DEPDIR], [\"${am__leading_dot}deps\"])dnl\n])\n\n\n# AM_DEP_TRACK\n# ------------\nAC_DEFUN([AM_DEP_TRACK],\n[AC_ARG_ENABLE(dependency-tracking,\n[  --disable-dependency-tracking  speeds up one-time build\n  --enable-dependency-tracking   do not reject slow dependency extractors])\nif test \"x$enable_dependency_tracking\" != xno; then\n  am_depcomp=\"$ac_aux_dir/depcomp\"\n  AMDEPBACKSLASH='\\'\nfi\nAM_CONDITIONAL([AMDEP], [test \"x$enable_dependency_tracking\" != xno])\nAC_SUBST([AMDEPBACKSLASH])dnl\n_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl\n])\n\n# Generate code to set up dependency tracking.              -*- Autoconf -*-\n\n# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008\n# Free Software Foundation, Inc.\n#\n# This file is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n#serial 5\n\n# _AM_OUTPUT_DEPENDENCY_COMMANDS\n# ------------------------------\nAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],\n[{\n  # Autoconf 2.62 quotes --file arguments for eval, but not when files\n  # are listed without --file.  Let's play safe and only enable the eval\n  # if we detect the quoting.\n  case $CONFIG_FILES in\n  *\\'*) eval set x \"$CONFIG_FILES\" ;;\n  *)   set x $CONFIG_FILES ;;\n  esac\n  shift\n  for mf\n  do\n    # Strip MF so we end up with the name of the file.\n    mf=`echo \"$mf\" | sed -e 's/:.*$//'`\n    # Check whether this is an Automake generated Makefile or not.\n    # We used to match only the files named `Makefile.in', but\n    # some people rename them; so instead we look at the file content.\n    # Grep'ing the first line is not enough: some people post-process\n    # each Makefile.in and add a new line on top of each file to say so.\n    # Grep'ing the whole file is not good either: AIX grep has a line\n    # limit of 2048, but all sed's we know have understand at least 4000.\n    if sed -n 's,^#.*generated by automake.*,X,p' \"$mf\" | grep X >/dev/null 2>&1; then\n      dirpart=`AS_DIRNAME(\"$mf\")`\n    else\n      continue\n    fi\n    # Extract the definition of DEPDIR, am__include, and am__quote\n    # from the Makefile without running `make'.\n    DEPDIR=`sed -n 's/^DEPDIR = //p' < \"$mf\"`\n    test -z \"$DEPDIR\" && continue\n    am__include=`sed -n 's/^am__include = //p' < \"$mf\"`\n    test -z \"am__include\" && continue\n    am__quote=`sed -n 's/^am__quote = //p' < \"$mf\"`\n    # When using ansi2knr, U may be empty or an underscore; expand it\n    U=`sed -n 's/^U = //p' < \"$mf\"`\n    # Find all dependency output files, they are included files with\n    # $(DEPDIR) in their names.  We invoke sed twice because it is the\n    # simplest approach to changing $(DEPDIR) to its actual value in the\n    # expansion.\n    for file in `sed -n \"\n      s/^$am__include $am__quote\\(.*(DEPDIR).*\\)$am__quote\"'$/\\1/p' <\"$mf\" | \\\n\t sed -e 's/\\$(DEPDIR)/'\"$DEPDIR\"'/g' -e 's/\\$U/'\"$U\"'/g'`; do\n      # Make sure the directory exists.\n      test -f \"$dirpart/$file\" && continue\n      fdir=`AS_DIRNAME([\"$file\"])`\n      AS_MKDIR_P([$dirpart/$fdir])\n      # echo \"creating $dirpart/$file\"\n      echo '# dummy' > \"$dirpart/$file\"\n    done\n  done\n}\n])# _AM_OUTPUT_DEPENDENCY_COMMANDS\n\n\n# AM_OUTPUT_DEPENDENCY_COMMANDS\n# -----------------------------\n# This macro should only be invoked once -- use via AC_REQUIRE.\n#\n# This code is only required when automatic dependency tracking\n# is enabled.  FIXME.  This creates each `.P' file that we will\n# need in order to bootstrap the dependency handling code.\nAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],\n[AC_CONFIG_COMMANDS([depfiles],\n     [test x\"$AMDEP_TRUE\" != x\"\" || _AM_OUTPUT_DEPENDENCY_COMMANDS],\n     [AMDEP_TRUE=\"$AMDEP_TRUE\" ac_aux_dir=\"$ac_aux_dir\"])\n])\n\n# Do all the work for Automake.                             -*- Autoconf -*-\n\n# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,\n# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.\n#\n# This file is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n# serial 16\n\n# This macro actually does too much.  Some checks are only needed if\n# your package does certain things.  But this isn't really a big deal.\n\n# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])\n# AM_INIT_AUTOMAKE([OPTIONS])\n# -----------------------------------------------\n# The call with PACKAGE and VERSION arguments is the old style\n# call (pre autoconf-2.50), which is being phased out.  PACKAGE\n# and VERSION should now be passed to AC_INIT and removed from\n# the call to AM_INIT_AUTOMAKE.\n# We support both call styles for the transition.  After\n# the next Automake release, Autoconf can make the AC_INIT\n# arguments mandatory, and then we can depend on a new Autoconf\n# release and drop the old call support.\nAC_DEFUN([AM_INIT_AUTOMAKE],\n[AC_PREREQ([2.62])dnl\ndnl Autoconf wants to disallow AM_ names.  We explicitly allow\ndnl the ones we care about.\nm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl\nAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl\nAC_REQUIRE([AC_PROG_INSTALL])dnl\nif test \"`cd $srcdir && pwd`\" != \"`pwd`\"; then\n  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output\n  # is not polluted with repeated \"-I.\"\n  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl\n  # test to see if srcdir already configured\n  if test -f $srcdir/config.status; then\n    AC_MSG_ERROR([source directory already configured; run \"make distclean\" there first])\n  fi\nfi\n\n# test whether we have cygpath\nif test -z \"$CYGPATH_W\"; then\n  if (cygpath --version) >/dev/null 2>/dev/null; then\n    CYGPATH_W='cygpath -w'\n  else\n    CYGPATH_W=echo\n  fi\nfi\nAC_SUBST([CYGPATH_W])\n\n# Define the identity of the package.\ndnl Distinguish between old-style and new-style calls.\nm4_ifval([$2],\n[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl\n AC_SUBST([PACKAGE], [$1])dnl\n AC_SUBST([VERSION], [$2])],\n[_AM_SET_OPTIONS([$1])dnl\ndnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.\nm4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,\n  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl\n AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl\n AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl\n\n_AM_IF_OPTION([no-define],,\n[AC_DEFINE_UNQUOTED(PACKAGE, \"$PACKAGE\", [Name of package])\n AC_DEFINE_UNQUOTED(VERSION, \"$VERSION\", [Version number of package])])dnl\n\n# Some tools Automake needs.\nAC_REQUIRE([AM_SANITY_CHECK])dnl\nAC_REQUIRE([AC_ARG_PROGRAM])dnl\nAM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})\nAM_MISSING_PROG(AUTOCONF, autoconf)\nAM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})\nAM_MISSING_PROG(AUTOHEADER, autoheader)\nAM_MISSING_PROG(MAKEINFO, makeinfo)\nAC_REQUIRE([AM_PROG_INSTALL_SH])dnl\nAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl\nAC_REQUIRE([AM_PROG_MKDIR_P])dnl\n# We need awk for the \"check\" target.  The system \"awk\" is bad on\n# some platforms.\nAC_REQUIRE([AC_PROG_AWK])dnl\nAC_REQUIRE([AC_PROG_MAKE_SET])dnl\nAC_REQUIRE([AM_SET_LEADING_DOT])dnl\n_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],\n\t      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],\n\t\t\t     [_AM_PROG_TAR([v7])])])\n_AM_IF_OPTION([no-dependencies],,\n[AC_PROVIDE_IFELSE([AC_PROG_CC],\n\t\t  [_AM_DEPENDENCIES(CC)],\n\t\t  [define([AC_PROG_CC],\n\t\t\t  defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl\nAC_PROVIDE_IFELSE([AC_PROG_CXX],\n\t\t  [_AM_DEPENDENCIES(CXX)],\n\t\t  [define([AC_PROG_CXX],\n\t\t\t  defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl\nAC_PROVIDE_IFELSE([AC_PROG_OBJC],\n\t\t  [_AM_DEPENDENCIES(OBJC)],\n\t\t  [define([AC_PROG_OBJC],\n\t\t\t  defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl\n])\n_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl\ndnl The `parallel-tests' driver may need to know about EXEEXT, so add the\ndnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro\ndnl is hooked onto _AC_COMPILER_EXEEXT early, see below.\nAC_CONFIG_COMMANDS_PRE(dnl\n[m4_provide_if([_AM_COMPILER_EXEEXT],\n  [AM_CONDITIONAL([am__EXEEXT], [test -n \"$EXEEXT\"])])])dnl\n])\n\ndnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not\ndnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further\ndnl mangled by Autoconf and run in a shell conditional statement.\nm4_define([_AC_COMPILER_EXEEXT],\nm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])\n\n\n# When config.status generates a header, we must update the stamp-h file.\n# This file resides in the same directory as the config header\n# that is generated.  The stamp files are numbered to have different names.\n\n# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the\n# loop where config.status creates the headers, so we can generate\n# our stamp files there.\nAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],\n[# Compute $1's index in $config_headers.\n_am_arg=$1\n_am_stamp_count=1\nfor _am_header in $config_headers :; do\n  case $_am_header in\n    $_am_arg | $_am_arg:* )\n      break ;;\n    * )\n      _am_stamp_count=`expr $_am_stamp_count + 1` ;;\n  esac\ndone\necho \"timestamp for $_am_arg\" >`AS_DIRNAME([\"$_am_arg\"])`/stamp-h[]$_am_stamp_count])\n\n# Copyright (C) 2001, 2003, 2005, 2008  Free Software Foundation, Inc.\n#\n# This file is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n# AM_PROG_INSTALL_SH\n# ------------------\n# Define $install_sh.\nAC_DEFUN([AM_PROG_INSTALL_SH],\n[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl\nif test x\"${install_sh}\" != xset; then\n  case $am_aux_dir in\n  *\\ * | *\\\t*)\n    install_sh=\"\\${SHELL} '$am_aux_dir/install-sh'\" ;;\n  *)\n    install_sh=\"\\${SHELL} $am_aux_dir/install-sh\"\n  esac\nfi\nAC_SUBST(install_sh)])\n\n# Copyright (C) 2003, 2005  Free Software Foundation, Inc.\n#\n# This file is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n# serial 2\n\n# Check whether the underlying file-system supports filenames\n# with a leading dot.  For instance MS-DOS doesn't.\nAC_DEFUN([AM_SET_LEADING_DOT],\n[rm -rf .tst 2>/dev/null\nmkdir .tst 2>/dev/null\nif test -d .tst; then\n  am__leading_dot=.\nelse\n  am__leading_dot=_\nfi\nrmdir .tst 2>/dev/null\nAC_SUBST([am__leading_dot])])\n\n# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-\n# From Jim Meyering\n\n# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008\n# Free Software Foundation, Inc.\n#\n# This file is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n# serial 5\n\n# AM_MAINTAINER_MODE([DEFAULT-MODE])\n# ----------------------------------\n# Control maintainer-specific portions of Makefiles.\n# Default is to disable them, unless `enable' is passed literally.\n# For symmetry, `disable' may be passed as well.  Anyway, the user\n# can override the default with the --enable/--disable switch.\nAC_DEFUN([AM_MAINTAINER_MODE],\n[m4_case(m4_default([$1], [disable]),\n       [enable], [m4_define([am_maintainer_other], [disable])],\n       [disable], [m4_define([am_maintainer_other], [enable])],\n       [m4_define([am_maintainer_other], [enable])\n        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])\nAC_MSG_CHECKING([whether to am_maintainer_other maintainer-specific portions of Makefiles])\n  dnl maintainer-mode's default is 'disable' unless 'enable' is passed\n  AC_ARG_ENABLE([maintainer-mode],\n[  --][am_maintainer_other][-maintainer-mode  am_maintainer_other make rules and dependencies not useful\n\t\t\t  (and sometimes confusing) to the casual installer],\n      [USE_MAINTAINER_MODE=$enableval],\n      [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))\n  AC_MSG_RESULT([$USE_MAINTAINER_MODE])\n  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])\n  MAINT=$MAINTAINER_MODE_TRUE\n  AC_SUBST([MAINT])dnl\n]\n)\n\nAU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])\n\n# Check to see how 'make' treats includes.\t            -*- Autoconf -*-\n\n# Copyright (C) 2001, 2002, 2003, 2005, 2009  Free Software Foundation, Inc.\n#\n# This file is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n# serial 4\n\n# AM_MAKE_INCLUDE()\n# -----------------\n# Check to see how make treats includes.\nAC_DEFUN([AM_MAKE_INCLUDE],\n[am_make=${MAKE-make}\ncat > confinc << 'END'\nam__doit:\n\t@echo this is the am__doit target\n.PHONY: am__doit\nEND\n# If we don't find an include directive, just comment out the code.\nAC_MSG_CHECKING([for style of include used by $am_make])\nam__include=\"#\"\nam__quote=\n_am_result=none\n# First try GNU make style include.\necho \"include confinc\" > confmf\n# Ignore all kinds of additional output from `make'.\ncase `$am_make -s -f confmf 2> /dev/null` in #(\n*the\\ am__doit\\ target*)\n  am__include=include\n  am__quote=\n  _am_result=GNU\n  ;;\nesac\n# Now try BSD make style include.\nif test \"$am__include\" = \"#\"; then\n   echo '.include \"confinc\"' > confmf\n   case `$am_make -s -f confmf 2> /dev/null` in #(\n   *the\\ am__doit\\ target*)\n     am__include=.include\n     am__quote=\"\\\"\"\n     _am_result=BSD\n     ;;\n   esac\nfi\nAC_SUBST([am__include])\nAC_SUBST([am__quote])\nAC_MSG_RESULT([$_am_result])\nrm -f confinc confmf\n])\n\n# Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005, 2008\n# Free Software Foundation, Inc.\n#\n# This file is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n# serial 6\n\n# AM_PROG_CC_C_O\n# --------------\n# Like AC_PROG_CC_C_O, but changed for automake.\nAC_DEFUN([AM_PROG_CC_C_O],\n[AC_REQUIRE([AC_PROG_CC_C_O])dnl\nAC_REQUIRE([AM_AUX_DIR_EXPAND])dnl\nAC_REQUIRE_AUX_FILE([compile])dnl\n# FIXME: we rely on the cache variable name because\n# there is no other way.\nset dummy $CC\nam_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']`\neval am_t=\\$ac_cv_prog_cc_${am_cc}_c_o\nif test \"$am_t\" != yes; then\n   # Losing compiler, so override with the script.\n   # FIXME: It is wrong to rewrite CC.\n   # But if we don't then we get into trouble of one sort or another.\n   # A longer-term fix would be to have automake use am__CC in this case,\n   # and then we could set am__CC=\"\\$(top_srcdir)/compile \\$(CC)\"\n   CC=\"$am_aux_dir/compile $CC\"\nfi\ndnl Make sure AC_PROG_CC is never called again, or it will override our\ndnl setting of CC.\nm4_define([AC_PROG_CC],\n          [m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])])\n])\n\n# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-\n\n# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008\n# Free Software Foundation, Inc.\n#\n# This file is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n# serial 6\n\n# AM_MISSING_PROG(NAME, PROGRAM)\n# ------------------------------\nAC_DEFUN([AM_MISSING_PROG],\n[AC_REQUIRE([AM_MISSING_HAS_RUN])\n$1=${$1-\"${am_missing_run}$2\"}\nAC_SUBST($1)])\n\n\n# AM_MISSING_HAS_RUN\n# ------------------\n# Define MISSING if not defined so far and test if it supports --run.\n# If it does, set am_missing_run to use it, otherwise, to nothing.\nAC_DEFUN([AM_MISSING_HAS_RUN],\n[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl\nAC_REQUIRE_AUX_FILE([missing])dnl\nif test x\"${MISSING+set}\" != xset; then\n  case $am_aux_dir in\n  *\\ * | *\\\t*)\n    MISSING=\"\\${SHELL} \\\"$am_aux_dir/missing\\\"\" ;;\n  *)\n    MISSING=\"\\${SHELL} $am_aux_dir/missing\" ;;\n  esac\nfi\n# Use eval to expand $SHELL\nif eval \"$MISSING --run true\"; then\n  am_missing_run=\"$MISSING --run \"\nelse\n  am_missing_run=\n  AC_MSG_WARN([`missing' script is too old or missing])\nfi\n])\n\n# Copyright (C) 2003, 2004, 2005, 2006  Free Software Foundation, Inc.\n#\n# This file is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n# AM_PROG_MKDIR_P\n# ---------------\n# Check for `mkdir -p'.\nAC_DEFUN([AM_PROG_MKDIR_P],\n[AC_PREREQ([2.60])dnl\nAC_REQUIRE([AC_PROG_MKDIR_P])dnl\ndnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,\ndnl while keeping a definition of mkdir_p for backward compatibility.\ndnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.\ndnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of\ndnl Makefile.ins that do not define MKDIR_P, so we do our own\ndnl adjustment using top_builddir (which is defined more often than\ndnl MKDIR_P).\nAC_SUBST([mkdir_p], [\"$MKDIR_P\"])dnl\ncase $mkdir_p in\n  [[\\\\/$]]* | ?:[[\\\\/]]*) ;;\n  */*) mkdir_p=\"\\$(top_builddir)/$mkdir_p\" ;;\nesac\n])\n\n# Helper functions for option handling.                     -*- Autoconf -*-\n\n# Copyright (C) 2001, 2002, 2003, 2005, 2008  Free Software Foundation, Inc.\n#\n# This file is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n# serial 4\n\n# _AM_MANGLE_OPTION(NAME)\n# -----------------------\nAC_DEFUN([_AM_MANGLE_OPTION],\n[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])\n\n# _AM_SET_OPTION(NAME)\n# ------------------------------\n# Set option NAME.  Presently that only means defining a flag for this option.\nAC_DEFUN([_AM_SET_OPTION],\n[m4_define(_AM_MANGLE_OPTION([$1]), 1)])\n\n# _AM_SET_OPTIONS(OPTIONS)\n# ----------------------------------\n# OPTIONS is a space-separated list of Automake options.\nAC_DEFUN([_AM_SET_OPTIONS],\n[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])\n\n# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])\n# -------------------------------------------\n# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.\nAC_DEFUN([_AM_IF_OPTION],\n[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])\n\n# Check to make sure that the build environment is sane.    -*- Autoconf -*-\n\n# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008\n# Free Software Foundation, Inc.\n#\n# This file is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n# serial 5\n\n# AM_SANITY_CHECK\n# ---------------\nAC_DEFUN([AM_SANITY_CHECK],\n[AC_MSG_CHECKING([whether build environment is sane])\n# Just in case\nsleep 1\necho timestamp > conftest.file\n# Reject unsafe characters in $srcdir or the absolute working directory\n# name.  Accept space and tab only in the latter.\nam_lf='\n'\ncase `pwd` in\n  *[[\\\\\\\"\\#\\$\\&\\'\\`$am_lf]]*)\n    AC_MSG_ERROR([unsafe absolute working directory name]);;\nesac\ncase $srcdir in\n  *[[\\\\\\\"\\#\\$\\&\\'\\`$am_lf\\ \\\t]]*)\n    AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;\nesac\n\n# Do `set' in a subshell so we don't clobber the current shell's\n# arguments.  Must try -L first in case configure is actually a\n# symlink; some systems play weird games with the mod time of symlinks\n# (eg FreeBSD returns the mod time of the symlink's containing\n# directory).\nif (\n   set X `ls -Lt \"$srcdir/configure\" conftest.file 2> /dev/null`\n   if test \"$[*]\" = \"X\"; then\n      # -L didn't work.\n      set X `ls -t \"$srcdir/configure\" conftest.file`\n   fi\n   rm -f conftest.file\n   if test \"$[*]\" != \"X $srcdir/configure conftest.file\" \\\n      && test \"$[*]\" != \"X conftest.file $srcdir/configure\"; then\n\n      # If neither matched, then we have a broken ls.  This can happen\n      # if, for instance, CONFIG_SHELL is bash and it inherits a\n      # broken ls alias from the environment.  This has actually\n      # happened.  Such a system could not be considered \"sane\".\n      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken\nalias in your environment])\n   fi\n\n   test \"$[2]\" = conftest.file\n   )\nthen\n   # Ok.\n   :\nelse\n   AC_MSG_ERROR([newly created file is older than distributed files!\nCheck your system clock])\nfi\nAC_MSG_RESULT(yes)])\n\n# Copyright (C) 2009  Free Software Foundation, Inc.\n#\n# This file is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n# serial 1\n\n# AM_SILENT_RULES([DEFAULT])\n# --------------------------\n# Enable less verbose build rules; with the default set to DEFAULT\n# (`yes' being less verbose, `no' or empty being verbose).\nAC_DEFUN([AM_SILENT_RULES],\n[AC_ARG_ENABLE([silent-rules],\n[  --enable-silent-rules          less verbose build output (undo: `make V=1')\n  --disable-silent-rules         verbose build output (undo: `make V=0')])\ncase $enable_silent_rules in\nyes) AM_DEFAULT_VERBOSITY=0;;\nno)  AM_DEFAULT_VERBOSITY=1;;\n*)   AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;\nesac\nAC_SUBST([AM_DEFAULT_VERBOSITY])dnl\nAM_BACKSLASH='\\'\nAC_SUBST([AM_BACKSLASH])dnl\n_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl\n])\n\n# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.\n#\n# This file is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n# AM_PROG_INSTALL_STRIP\n# ---------------------\n# One issue with vendor `install' (even GNU) is that you can't\n# specify the program used to strip binaries.  This is especially\n# annoying in cross-compiling environments, where the build's strip\n# is unlikely to handle the host's binaries.\n# Fortunately install-sh will honor a STRIPPROG variable, so we\n# always use install-sh in `make install-strip', and initialize\n# STRIPPROG with the value of the STRIP variable (set by the user).\nAC_DEFUN([AM_PROG_INSTALL_STRIP],\n[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl\n# Installed binaries are usually stripped using `strip' when the user\n# run `make install-strip'.  However `strip' might not be the right\n# tool to use in cross-compilation environments, therefore Automake\n# will honor the `STRIP' environment variable to overrule this program.\ndnl Don't test for $cross_compiling = yes, because it might be `maybe'.\nif test \"$cross_compiling\" != no; then\n  AC_CHECK_TOOL([STRIP], [strip], :)\nfi\nINSTALL_STRIP_PROGRAM=\"\\$(install_sh) -c -s\"\nAC_SUBST([INSTALL_STRIP_PROGRAM])])\n\n# Copyright (C) 2006, 2008  Free Software Foundation, Inc.\n#\n# This file is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n# serial 2\n\n# _AM_SUBST_NOTMAKE(VARIABLE)\n# ---------------------------\n# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.\n# This macro is traced by Automake.\nAC_DEFUN([_AM_SUBST_NOTMAKE])\n\n# AM_SUBST_NOTMAKE(VARIABLE)\n# ---------------------------\n# Public sister of _AM_SUBST_NOTMAKE.\nAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])\n\n# Check how to create a tarball.                            -*- Autoconf -*-\n\n# Copyright (C) 2004, 2005  Free Software Foundation, Inc.\n#\n# This file is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n# serial 2\n\n# _AM_PROG_TAR(FORMAT)\n# --------------------\n# Check how to create a tarball in format FORMAT.\n# FORMAT should be one of `v7', `ustar', or `pax'.\n#\n# Substitute a variable $(am__tar) that is a command\n# writing to stdout a FORMAT-tarball containing the directory\n# $tardir.\n#     tardir=directory && $(am__tar) > result.tar\n#\n# Substitute a variable $(am__untar) that extract such\n# a tarball read from stdin.\n#     $(am__untar) < result.tar\nAC_DEFUN([_AM_PROG_TAR],\n[# Always define AMTAR for backward compatibility.\nAM_MISSING_PROG([AMTAR], [tar])\nm4_if([$1], [v7],\n     [am__tar='${AMTAR} chof - \"$$tardir\"'; am__untar='${AMTAR} xf -'],\n     [m4_case([$1], [ustar],, [pax],,\n              [m4_fatal([Unknown tar format])])\nAC_MSG_CHECKING([how to create a $1 tar archive])\n# Loop over all known methods to create a tar archive until one works.\n_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'\n_am_tools=${am_cv_prog_tar_$1-$_am_tools}\n# Do not fold the above two line into one, because Tru64 sh and\n# Solaris sh will not grok spaces in the rhs of `-'.\nfor _am_tool in $_am_tools\ndo\n  case $_am_tool in\n  gnutar)\n    for _am_tar in tar gnutar gtar;\n    do\n      AM_RUN_LOG([$_am_tar --version]) && break\n    done\n    am__tar=\"$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - \"'\"$$tardir\"'\n    am__tar_=\"$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - \"'\"$tardir\"'\n    am__untar=\"$_am_tar -xf -\"\n    ;;\n  plaintar)\n    # Must skip GNU tar: if it does not support --format= it doesn't create\n    # ustar tarball either.\n    (tar --version) >/dev/null 2>&1 && continue\n    am__tar='tar chf - \"$$tardir\"'\n    am__tar_='tar chf - \"$tardir\"'\n    am__untar='tar xf -'\n    ;;\n  pax)\n    am__tar='pax -L -x $1 -w \"$$tardir\"'\n    am__tar_='pax -L -x $1 -w \"$tardir\"'\n    am__untar='pax -r'\n    ;;\n  cpio)\n    am__tar='find \"$$tardir\" -print | cpio -o -H $1 -L'\n    am__tar_='find \"$tardir\" -print | cpio -o -H $1 -L'\n    am__untar='cpio -i -H $1 -d'\n    ;;\n  none)\n    am__tar=false\n    am__tar_=false\n    am__untar=false\n    ;;\n  esac\n\n  # If the value was cached, stop now.  We just wanted to have am__tar\n  # and am__untar set.\n  test -n \"${am_cv_prog_tar_$1}\" && break\n\n  # tar/untar a dummy directory, and stop if the command works\n  rm -rf conftest.dir\n  mkdir conftest.dir\n  echo GrepMe > conftest.dir/file\n  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])\n  rm -rf conftest.dir\n  if test -s conftest.tar; then\n    AM_RUN_LOG([$am__untar <conftest.tar])\n    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break\n  fi\ndone\nrm -rf conftest.dir\n\nAC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])\nAC_MSG_RESULT([$am_cv_prog_tar_$1])])\nAC_SUBST([am__tar])\nAC_SUBST([am__untar])\n]) # _AM_PROG_TAR\n\nm4_include([m4/acinclude.m4])\nm4_include([m4/libtool.m4])\nm4_include([m4/ltoptions.m4])\nm4_include([m4/ltsugar.m4])\nm4_include([m4/ltversion.m4])\nm4_include([m4/lt~obsolete.m4])\n"
  },
  {
    "path": "src/main/jni/tiff/autogen.sh",
    "content": "#!/bin/sh\nset -x\n#libtoolize --force --copy\naclocal -I ./m4\nautoheader\nautomake --foreign --add-missing --copy\nautoconf\n\n"
  },
  {
    "path": "src/main/jni/tiff/build/Makefile.am",
    "content": "# $Id: Makefile.am,v 1.1 2007/02/24 15:03:49 dron Exp $\n#\n# Tag Image File Format (TIFF) Software\n#\n# Copyright (C) 2007, Andrey Kiselev <dron@ak4719.spb.edu>\n#\n# Permission to use, copy, modify, distribute, and sell this software and \n# its documentation for any purpose is hereby granted without fee, provided\n# that (i) the above copyright notices and this permission notice appear in\n# all copies of the software and related documentation, and (ii) the names of\n# Sam Leffler and Silicon Graphics may not be used in any advertising or\n# publicity relating to the software without the specific, prior written\n# permission of Sam Leffler and Silicon Graphics.\n# \n# THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n# \n# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n# OF THIS SOFTWARE.\n\n# Process this file with automake to produce Makefile.in.\n\nEXTRA_DIST = README\n\nSUBDIRS = \n\n"
  },
  {
    "path": "src/main/jni/tiff/build/Makefile.in",
    "content": "# Makefile.in generated by automake 1.11 from Makefile.am.\n# @configure_input@\n\n# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,\n# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,\n# Inc.\n# This Makefile.in is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY, to the extent permitted by law; without\n# even the implied warranty of MERCHANTABILITY or FITNESS FOR A\n# PARTICULAR PURPOSE.\n\n@SET_MAKE@\n\n# $Id: Makefile.am,v 1.1 2007/02/24 15:03:49 dron Exp $\n#\n# Tag Image File Format (TIFF) Software\n#\n# Copyright (C) 2007, Andrey Kiselev <dron@ak4719.spb.edu>\n#\n# Permission to use, copy, modify, distribute, and sell this software and \n# its documentation for any purpose is hereby granted without fee, provided\n# that (i) the above copyright notices and this permission notice appear in\n# all copies of the software and related documentation, and (ii) the names of\n# Sam Leffler and Silicon Graphics may not be used in any advertising or\n# publicity relating to the software without the specific, prior written\n# permission of Sam Leffler and Silicon Graphics.\n# \n# THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n# \n# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n# OF THIS SOFTWARE.\n\n# Process this file with automake to produce Makefile.in.\nVPATH = @srcdir@\npkgdatadir = $(datadir)/@PACKAGE@\npkgincludedir = $(includedir)/@PACKAGE@\npkglibdir = $(libdir)/@PACKAGE@\npkglibexecdir = $(libexecdir)/@PACKAGE@\nam__cd = CDPATH=\"$${ZSH_VERSION+.}$(PATH_SEPARATOR)\" && cd\ninstall_sh_DATA = $(install_sh) -c -m 644\ninstall_sh_PROGRAM = $(install_sh) -c\ninstall_sh_SCRIPT = $(install_sh) -c\nINSTALL_HEADER = $(INSTALL_DATA)\ntransform = $(program_transform_name)\nNORMAL_INSTALL = :\nPRE_INSTALL = :\nPOST_INSTALL = :\nNORMAL_UNINSTALL = :\nPRE_UNINSTALL = :\nPOST_UNINSTALL = :\nbuild_triplet = @build@\nhost_triplet = @host@\ntarget_triplet = @target@\nsubdir = build\nDIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in\nACLOCAL_M4 = $(top_srcdir)/aclocal.m4\nam__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \\\n\t$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \\\n\t$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \\\n\t$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac\nam__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \\\n\t$(ACLOCAL_M4)\nmkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs\nCONFIG_HEADER = $(top_builddir)/libtiff/tif_config.h \\\n\t$(top_builddir)/libtiff/tiffconf.h\nCONFIG_CLEAN_FILES =\nCONFIG_CLEAN_VPATH_FILES =\nAM_V_GEN = $(am__v_GEN_$(V))\nam__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))\nam__v_GEN_0 = @echo \"  GEN   \" $@;\nAM_V_at = $(am__v_at_$(V))\nam__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))\nam__v_at_0 = @\nSOURCES =\nDIST_SOURCES =\nRECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \\\n\thtml-recursive info-recursive install-data-recursive \\\n\tinstall-dvi-recursive install-exec-recursive \\\n\tinstall-html-recursive install-info-recursive \\\n\tinstall-pdf-recursive install-ps-recursive install-recursive \\\n\tinstallcheck-recursive installdirs-recursive pdf-recursive \\\n\tps-recursive uninstall-recursive\nRECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive\t\\\n  distclean-recursive maintainer-clean-recursive\nAM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \\\n\t$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \\\n\tdistdir\nETAGS = etags\nCTAGS = ctags\nDIST_SUBDIRS = $(SUBDIRS)\nDISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)\nam__relativize = \\\n  dir0=`pwd`; \\\n  sed_first='s,^\\([^/]*\\)/.*$$,\\1,'; \\\n  sed_rest='s,^[^/]*/*,,'; \\\n  sed_last='s,^.*/\\([^/]*\\)$$,\\1,'; \\\n  sed_butlast='s,/*[^/]*$$,,'; \\\n  while test -n \"$$dir1\"; do \\\n    first=`echo \"$$dir1\" | sed -e \"$$sed_first\"`; \\\n    if test \"$$first\" != \".\"; then \\\n      if test \"$$first\" = \"..\"; then \\\n        dir2=`echo \"$$dir0\" | sed -e \"$$sed_last\"`/\"$$dir2\"; \\\n        dir0=`echo \"$$dir0\" | sed -e \"$$sed_butlast\"`; \\\n      else \\\n        first2=`echo \"$$dir2\" | sed -e \"$$sed_first\"`; \\\n        if test \"$$first2\" = \"$$first\"; then \\\n          dir2=`echo \"$$dir2\" | sed -e \"$$sed_rest\"`; \\\n        else \\\n          dir2=\"../$$dir2\"; \\\n        fi; \\\n        dir0=\"$$dir0\"/\"$$first\"; \\\n      fi; \\\n    fi; \\\n    dir1=`echo \"$$dir1\" | sed -e \"$$sed_rest\"`; \\\n  done; \\\n  reldir=\"$$dir2\"\nACLOCAL = @ACLOCAL@\nAMTAR = @AMTAR@\nAM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@\nAR = @AR@\nAS = @AS@\nAUTOCONF = @AUTOCONF@\nAUTOHEADER = @AUTOHEADER@\nAUTOMAKE = @AUTOMAKE@\nAWK = @AWK@\nCC = @CC@\nCCDEPMODE = @CCDEPMODE@\nCFLAGS = @CFLAGS@\nCPP = @CPP@\nCPPFLAGS = @CPPFLAGS@\nCXX = @CXX@\nCXXCPP = @CXXCPP@\nCXXDEPMODE = @CXXDEPMODE@\nCXXFLAGS = @CXXFLAGS@\nCYGPATH_W = @CYGPATH_W@\nDEFS = @DEFS@\nDEPDIR = @DEPDIR@\nDLLTOOL = @DLLTOOL@\nDSYMUTIL = @DSYMUTIL@\nDUMPBIN = @DUMPBIN@\nECHO_C = @ECHO_C@\nECHO_N = @ECHO_N@\nECHO_T = @ECHO_T@\nEGREP = @EGREP@\nEXEEXT = @EXEEXT@\nFGREP = @FGREP@\nGLUT_CFLAGS = @GLUT_CFLAGS@\nGLUT_LIBS = @GLUT_LIBS@\nGLU_CFLAGS = @GLU_CFLAGS@\nGLU_LIBS = @GLU_LIBS@\nGL_CFLAGS = @GL_CFLAGS@\nGL_LIBS = @GL_LIBS@\nGREP = @GREP@\nINSTALL = @INSTALL@\nINSTALL_DATA = @INSTALL_DATA@\nINSTALL_PROGRAM = @INSTALL_PROGRAM@\nINSTALL_SCRIPT = @INSTALL_SCRIPT@\nINSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@\nLD = @LD@\nLDFLAGS = @LDFLAGS@\nLIBDIR = @LIBDIR@\nLIBOBJS = @LIBOBJS@\nLIBS = @LIBS@\nLIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@\nLIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@\nLIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@\nLIBTIFF_MICRO_VERSION = @LIBTIFF_MICRO_VERSION@\nLIBTIFF_MINOR_VERSION = @LIBTIFF_MINOR_VERSION@\nLIBTIFF_RELEASE_DATE = @LIBTIFF_RELEASE_DATE@\nLIBTIFF_VERSION = @LIBTIFF_VERSION@\nLIBTIFF_VERSION_INFO = @LIBTIFF_VERSION_INFO@\nLIBTOOL = @LIBTOOL@\nLIPO = @LIPO@\nLN_S = @LN_S@\nLTLIBOBJS = @LTLIBOBJS@\nMAINT = @MAINT@\nMAKEINFO = @MAKEINFO@\nMKDIR_P = @MKDIR_P@\nNM = @NM@\nNMEDIT = @NMEDIT@\nOBJDUMP = @OBJDUMP@\nOBJEXT = @OBJEXT@\nOTOOL = @OTOOL@\nOTOOL64 = @OTOOL64@\nPACKAGE = @PACKAGE@\nPACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@\nPACKAGE_NAME = @PACKAGE_NAME@\nPACKAGE_STRING = @PACKAGE_STRING@\nPACKAGE_TARNAME = @PACKAGE_TARNAME@\nPACKAGE_URL = @PACKAGE_URL@\nPACKAGE_VERSION = @PACKAGE_VERSION@\nPATH_SEPARATOR = @PATH_SEPARATOR@\nPTHREAD_CC = @PTHREAD_CC@\nPTHREAD_CFLAGS = @PTHREAD_CFLAGS@\nPTHREAD_LIBS = @PTHREAD_LIBS@\nRANLIB = @RANLIB@\nSED = @SED@\nSET_MAKE = @SET_MAKE@\nSHELL = @SHELL@\nSTRIP = @STRIP@\nVERSION = @VERSION@\nXMKMF = @XMKMF@\nX_CFLAGS = @X_CFLAGS@\nX_EXTRA_LIBS = @X_EXTRA_LIBS@\nX_LIBS = @X_LIBS@\nX_PRE_LIBS = @X_PRE_LIBS@\nabs_builddir = @abs_builddir@\nabs_srcdir = @abs_srcdir@\nabs_top_builddir = @abs_top_builddir@\nabs_top_srcdir = @abs_top_srcdir@\nac_ct_CC = @ac_ct_CC@\nac_ct_CXX = @ac_ct_CXX@\nac_ct_DUMPBIN = @ac_ct_DUMPBIN@\nacx_pthread_config = @acx_pthread_config@\nam__include = @am__include@\nam__leading_dot = @am__leading_dot@\nam__quote = @am__quote@\nam__tar = @am__tar@\nam__untar = @am__untar@\nbindir = @bindir@\nbuild = @build@\nbuild_alias = @build_alias@\nbuild_cpu = @build_cpu@\nbuild_os = @build_os@\nbuild_vendor = @build_vendor@\nbuilddir = @builddir@\ndatadir = @datadir@\ndatarootdir = @datarootdir@\ndocdir = @docdir@\ndvidir = @dvidir@\nexec_prefix = @exec_prefix@\nhost = @host@\nhost_alias = @host_alias@\nhost_cpu = @host_cpu@\nhost_os = @host_os@\nhost_vendor = @host_vendor@\nhtmldir = @htmldir@\nincludedir = @includedir@\ninfodir = @infodir@\ninstall_sh = @install_sh@\nlibdir = @libdir@\nlibexecdir = @libexecdir@\nlocaledir = @localedir@\nlocalstatedir = @localstatedir@\nlt_ECHO = @lt_ECHO@\nmandir = @mandir@\nmkdir_p = @mkdir_p@\noldincludedir = @oldincludedir@\npdfdir = @pdfdir@\nprefix = @prefix@\nprogram_transform_name = @program_transform_name@\npsdir = @psdir@\nsbindir = @sbindir@\nsharedstatedir = @sharedstatedir@\nsrcdir = @srcdir@\nsysconfdir = @sysconfdir@\ntarget = @target@\ntarget_alias = @target_alias@\ntarget_cpu = @target_cpu@\ntarget_os = @target_os@\ntarget_vendor = @target_vendor@\ntop_build_prefix = @top_build_prefix@\ntop_builddir = @top_builddir@\ntop_srcdir = @top_srcdir@\nEXTRA_DIST = README\nSUBDIRS = \nall: all-recursive\n\n.SUFFIXES:\n$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)\n\t@for dep in $?; do \\\n\t  case '$(am__configure_deps)' in \\\n\t    *$$dep*) \\\n\t      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \\\n\t        && { if test -f $@; then exit 0; else break; fi; }; \\\n\t      exit 1;; \\\n\t  esac; \\\n\tdone; \\\n\techo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign build/Makefile'; \\\n\t$(am__cd) $(top_srcdir) && \\\n\t  $(AUTOMAKE) --foreign build/Makefile\n.PRECIOUS: Makefile\nMakefile: $(srcdir)/Makefile.in $(top_builddir)/config.status\n\t@case '$?' in \\\n\t  *config.status*) \\\n\t    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \\\n\t  *) \\\n\t    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \\\n\t    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \\\n\tesac;\n\n$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n\n$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n$(am__aclocal_m4_deps):\n\nmostlyclean-libtool:\n\t-rm -f *.lo\n\nclean-libtool:\n\t-rm -rf .libs _libs\n\n# This directory's subdirectories are mostly independent; you can cd\n# into them and run `make' without going through this Makefile.\n# To change the values of `make' variables: instead of editing Makefiles,\n# (1) if the variable is set in `config.status', edit `config.status'\n#     (which will cause the Makefiles to be regenerated when you run `make');\n# (2) otherwise, pass the desired values on the `make' command line.\n$(RECURSIVE_TARGETS):\n\t@failcom='exit 1'; \\\n\tfor f in x $$MAKEFLAGS; do \\\n\t  case $$f in \\\n\t    *=* | --[!k]*);; \\\n\t    *k*) failcom='fail=yes';; \\\n\t  esac; \\\n\tdone; \\\n\tdot_seen=no; \\\n\ttarget=`echo $@ | sed s/-recursive//`; \\\n\tlist='$(SUBDIRS)'; for subdir in $$list; do \\\n\t  echo \"Making $$target in $$subdir\"; \\\n\t  if test \"$$subdir\" = \".\"; then \\\n\t    dot_seen=yes; \\\n\t    local_target=\"$$target-am\"; \\\n\t  else \\\n\t    local_target=\"$$target\"; \\\n\t  fi; \\\n\t  ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \\\n\t  || eval $$failcom; \\\n\tdone; \\\n\tif test \"$$dot_seen\" = \"no\"; then \\\n\t  $(MAKE) $(AM_MAKEFLAGS) \"$$target-am\" || exit 1; \\\n\tfi; test -z \"$$fail\"\n\n$(RECURSIVE_CLEAN_TARGETS):\n\t@failcom='exit 1'; \\\n\tfor f in x $$MAKEFLAGS; do \\\n\t  case $$f in \\\n\t    *=* | --[!k]*);; \\\n\t    *k*) failcom='fail=yes';; \\\n\t  esac; \\\n\tdone; \\\n\tdot_seen=no; \\\n\tcase \"$@\" in \\\n\t  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \\\n\t  *) list='$(SUBDIRS)' ;; \\\n\tesac; \\\n\trev=''; for subdir in $$list; do \\\n\t  if test \"$$subdir\" = \".\"; then :; else \\\n\t    rev=\"$$subdir $$rev\"; \\\n\t  fi; \\\n\tdone; \\\n\trev=\"$$rev .\"; \\\n\ttarget=`echo $@ | sed s/-recursive//`; \\\n\tfor subdir in $$rev; do \\\n\t  echo \"Making $$target in $$subdir\"; \\\n\t  if test \"$$subdir\" = \".\"; then \\\n\t    local_target=\"$$target-am\"; \\\n\t  else \\\n\t    local_target=\"$$target\"; \\\n\t  fi; \\\n\t  ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \\\n\t  || eval $$failcom; \\\n\tdone && test -z \"$$fail\"\ntags-recursive:\n\tlist='$(SUBDIRS)'; for subdir in $$list; do \\\n\t  test \"$$subdir\" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \\\n\tdone\nctags-recursive:\n\tlist='$(SUBDIRS)'; for subdir in $$list; do \\\n\t  test \"$$subdir\" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \\\n\tdone\n\nID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)\n\tlist='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \\\n\tunique=`for i in $$list; do \\\n\t    if test -f \"$$i\"; then echo $$i; else echo $(srcdir)/$$i; fi; \\\n\t  done | \\\n\t  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \\\n\t      END { if (nonempty) { for (i in files) print i; }; }'`; \\\n\tmkid -fID $$unique\ntags: TAGS\n\nTAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \\\n\t\t$(TAGS_FILES) $(LISP)\n\tset x; \\\n\there=`pwd`; \\\n\tif ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \\\n\t  include_option=--etags-include; \\\n\t  empty_fix=.; \\\n\telse \\\n\t  include_option=--include; \\\n\t  empty_fix=; \\\n\tfi; \\\n\tlist='$(SUBDIRS)'; for subdir in $$list; do \\\n\t  if test \"$$subdir\" = .; then :; else \\\n\t    test ! -f $$subdir/TAGS || \\\n\t      set \"$$@\" \"$$include_option=$$here/$$subdir/TAGS\"; \\\n\t  fi; \\\n\tdone; \\\n\tlist='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \\\n\tunique=`for i in $$list; do \\\n\t    if test -f \"$$i\"; then echo $$i; else echo $(srcdir)/$$i; fi; \\\n\t  done | \\\n\t  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \\\n\t      END { if (nonempty) { for (i in files) print i; }; }'`; \\\n\tshift; \\\n\tif test -z \"$(ETAGS_ARGS)$$*$$unique\"; then :; else \\\n\t  test -n \"$$unique\" || unique=$$empty_fix; \\\n\t  if test $$# -gt 0; then \\\n\t    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \\\n\t      \"$$@\" $$unique; \\\n\t  else \\\n\t    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \\\n\t      $$unique; \\\n\t  fi; \\\n\tfi\nctags: CTAGS\nCTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \\\n\t\t$(TAGS_FILES) $(LISP)\n\tlist='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \\\n\tunique=`for i in $$list; do \\\n\t    if test -f \"$$i\"; then echo $$i; else echo $(srcdir)/$$i; fi; \\\n\t  done | \\\n\t  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \\\n\t      END { if (nonempty) { for (i in files) print i; }; }'`; \\\n\ttest -z \"$(CTAGS_ARGS)$$unique\" \\\n\t  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \\\n\t     $$unique\n\nGTAGS:\n\there=`$(am__cd) $(top_builddir) && pwd` \\\n\t  && $(am__cd) $(top_srcdir) \\\n\t  && gtags -i $(GTAGS_ARGS) \"$$here\"\n\ndistclean-tags:\n\t-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags\n\ndistdir: $(DISTFILES)\n\t@srcdirstrip=`echo \"$(srcdir)\" | sed 's/[].[^$$\\\\*]/\\\\\\\\&/g'`; \\\n\ttopsrcdirstrip=`echo \"$(top_srcdir)\" | sed 's/[].[^$$\\\\*]/\\\\\\\\&/g'`; \\\n\tlist='$(DISTFILES)'; \\\n\t  dist_files=`for file in $$list; do echo $$file; done | \\\n\t  sed -e \"s|^$$srcdirstrip/||;t\" \\\n\t      -e \"s|^$$topsrcdirstrip/|$(top_builddir)/|;t\"`; \\\n\tcase $$dist_files in \\\n\t  */*) $(MKDIR_P) `echo \"$$dist_files\" | \\\n\t\t\t   sed '/\\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \\\n\t\t\t   sort -u` ;; \\\n\tesac; \\\n\tfor file in $$dist_files; do \\\n\t  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \\\n\t  if test -d $$d/$$file; then \\\n\t    dir=`echo \"/$$file\" | sed -e 's,/[^/]*$$,,'`; \\\n\t    if test -d \"$(distdir)/$$file\"; then \\\n\t      find \"$(distdir)/$$file\" -type d ! -perm -700 -exec chmod u+rwx {} \\;; \\\n\t    fi; \\\n\t    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \\\n\t      cp -fpR $(srcdir)/$$file \"$(distdir)$$dir\" || exit 1; \\\n\t      find \"$(distdir)/$$file\" -type d ! -perm -700 -exec chmod u+rwx {} \\;; \\\n\t    fi; \\\n\t    cp -fpR $$d/$$file \"$(distdir)$$dir\" || exit 1; \\\n\t  else \\\n\t    test -f \"$(distdir)/$$file\" \\\n\t    || cp -p $$d/$$file \"$(distdir)/$$file\" \\\n\t    || exit 1; \\\n\t  fi; \\\n\tdone\n\t@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \\\n\t  if test \"$$subdir\" = .; then :; else \\\n\t    test -d \"$(distdir)/$$subdir\" \\\n\t    || $(MKDIR_P) \"$(distdir)/$$subdir\" \\\n\t    || exit 1; \\\n\t  fi; \\\n\tdone\n\t@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \\\n\t  if test \"$$subdir\" = .; then :; else \\\n\t    dir1=$$subdir; dir2=\"$(distdir)/$$subdir\"; \\\n\t    $(am__relativize); \\\n\t    new_distdir=$$reldir; \\\n\t    dir1=$$subdir; dir2=\"$(top_distdir)\"; \\\n\t    $(am__relativize); \\\n\t    new_top_distdir=$$reldir; \\\n\t    echo \" (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=\"$$new_top_distdir\" distdir=\"$$new_distdir\" \\\\\"; \\\n\t    echo \"     am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)\"; \\\n\t    ($(am__cd) $$subdir && \\\n\t      $(MAKE) $(AM_MAKEFLAGS) \\\n\t        top_distdir=\"$$new_top_distdir\" \\\n\t        distdir=\"$$new_distdir\" \\\n\t\tam__remove_distdir=: \\\n\t\tam__skip_length_check=: \\\n\t\tam__skip_mode_fix=: \\\n\t        distdir) \\\n\t      || exit 1; \\\n\t  fi; \\\n\tdone\ncheck-am: all-am\ncheck: check-recursive\nall-am: Makefile\ninstalldirs: installdirs-recursive\ninstalldirs-am:\ninstall: install-recursive\ninstall-exec: install-exec-recursive\ninstall-data: install-data-recursive\nuninstall: uninstall-recursive\n\ninstall-am: all-am\n\t@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am\n\ninstallcheck: installcheck-recursive\ninstall-strip:\n\t$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM=\"$(INSTALL_STRIP_PROGRAM)\" \\\n\t  install_sh_PROGRAM=\"$(INSTALL_STRIP_PROGRAM)\" INSTALL_STRIP_FLAG=-s \\\n\t  `test -z '$(STRIP)' || \\\n\t    echo \"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'\"` install\nmostlyclean-generic:\n\nclean-generic:\n\ndistclean-generic:\n\t-test -z \"$(CONFIG_CLEAN_FILES)\" || rm -f $(CONFIG_CLEAN_FILES)\n\t-test . = \"$(srcdir)\" || test -z \"$(CONFIG_CLEAN_VPATH_FILES)\" || rm -f $(CONFIG_CLEAN_VPATH_FILES)\n\nmaintainer-clean-generic:\n\t@echo \"This command is intended for maintainers to use\"\n\t@echo \"it deletes files that may require special tools to rebuild.\"\nclean: clean-recursive\n\nclean-am: clean-generic clean-libtool mostlyclean-am\n\ndistclean: distclean-recursive\n\t-rm -f Makefile\ndistclean-am: clean-am distclean-generic distclean-tags\n\ndvi: dvi-recursive\n\ndvi-am:\n\nhtml: html-recursive\n\nhtml-am:\n\ninfo: info-recursive\n\ninfo-am:\n\ninstall-data-am:\n\ninstall-dvi: install-dvi-recursive\n\ninstall-dvi-am:\n\ninstall-exec-am:\n\ninstall-html: install-html-recursive\n\ninstall-html-am:\n\ninstall-info: install-info-recursive\n\ninstall-info-am:\n\ninstall-man:\n\ninstall-pdf: install-pdf-recursive\n\ninstall-pdf-am:\n\ninstall-ps: install-ps-recursive\n\ninstall-ps-am:\n\ninstallcheck-am:\n\nmaintainer-clean: maintainer-clean-recursive\n\t-rm -f Makefile\nmaintainer-clean-am: distclean-am maintainer-clean-generic\n\nmostlyclean: mostlyclean-recursive\n\nmostlyclean-am: mostlyclean-generic mostlyclean-libtool\n\npdf: pdf-recursive\n\npdf-am:\n\nps: ps-recursive\n\nps-am:\n\nuninstall-am:\n\n.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \\\n\tinstall-am install-strip tags-recursive\n\n.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \\\n\tall all-am check check-am clean clean-generic clean-libtool \\\n\tctags ctags-recursive distclean distclean-generic \\\n\tdistclean-libtool distclean-tags distdir dvi dvi-am html \\\n\thtml-am info info-am install install-am install-data \\\n\tinstall-data-am install-dvi install-dvi-am install-exec \\\n\tinstall-exec-am install-html install-html-am install-info \\\n\tinstall-info-am install-man install-pdf install-pdf-am \\\n\tinstall-ps install-ps-am install-strip installcheck \\\n\tinstallcheck-am installdirs installdirs-am maintainer-clean \\\n\tmaintainer-clean-generic mostlyclean mostlyclean-generic \\\n\tmostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \\\n\tuninstall uninstall-am\n\n\n# Tell versions [3.59,3.63) of GNU make to not export all variables.\n# Otherwise a system limit (for SysV at least) may be exceeded.\n.NOEXPORT:\n"
  },
  {
    "path": "src/main/jni/tiff/build/README",
    "content": "This directory contains scripts and tools needed to build libtiff library\nand its utilities in various environments.\n\n"
  },
  {
    "path": "src/main/jni/tiff/config/compile",
    "content": "#! /bin/sh\n# Wrapper for compilers which do not understand `-c -o'.\n\nscriptversion=2005-05-14.22\n\n# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.\n# Written by Tom Tromey <tromey@cygnus.com>.\n#\n# This program is free software; you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation; either version 2, or (at your option)\n# any later version.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program; if not, write to the Free Software\n# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n\n# As a special exception to the GNU General Public License, if you\n# distribute this file as part of a program that contains a\n# configuration script generated by Autoconf, you may include it under\n# the same distribution terms that you use for the rest of that program.\n\n# This file is maintained in Automake, please report\n# bugs to <bug-automake@gnu.org> or send patches to\n# <automake-patches@gnu.org>.\n\ncase $1 in\n  '')\n     echo \"$0: No command.  Try \\`$0 --help' for more information.\" 1>&2\n     exit 1;\n     ;;\n  -h | --h*)\n    cat <<\\EOF\nUsage: compile [--help] [--version] PROGRAM [ARGS]\n\nWrapper for compilers which do not understand `-c -o'.\nRemove `-o dest.o' from ARGS, run PROGRAM with the remaining\narguments, and rename the output as expected.\n\nIf you are trying to build a whole package this is not the\nright script to run: please start by reading the file `INSTALL'.\n\nReport bugs to <bug-automake@gnu.org>.\nEOF\n    exit $?\n    ;;\n  -v | --v*)\n    echo \"compile $scriptversion\"\n    exit $?\n    ;;\nesac\n\nofile=\ncfile=\neat=\n\nfor arg\ndo\n  if test -n \"$eat\"; then\n    eat=\n  else\n    case $1 in\n      -o)\n\t# configure might choose to run compile as `compile cc -o foo foo.c'.\n\t# So we strip `-o arg' only if arg is an object.\n\teat=1\n\tcase $2 in\n\t  *.o | *.obj)\n\t    ofile=$2\n\t    ;;\n\t  *)\n\t    set x \"$@\" -o \"$2\"\n\t    shift\n\t    ;;\n\tesac\n\t;;\n      *.c)\n\tcfile=$1\n\tset x \"$@\" \"$1\"\n\tshift\n\t;;\n      *)\n\tset x \"$@\" \"$1\"\n\tshift\n\t;;\n    esac\n  fi\n  shift\ndone\n\nif test -z \"$ofile\" || test -z \"$cfile\"; then\n  # If no `-o' option was seen then we might have been invoked from a\n  # pattern rule where we don't need one.  That is ok -- this is a\n  # normal compilation that the losing compiler can handle.  If no\n  # `.c' file was seen then we are probably linking.  That is also\n  # ok.\n  exec \"$@\"\nfi\n\n# Name of file we expect compiler to create.\ncofile=`echo \"$cfile\" | sed -e 's|^.*/||' -e 's/\\.c$/.o/'`\n\n# Create the lock directory.\n# Note: use `[/.-]' here to ensure that we don't use the same name\n# that we are using for the .o file.  Also, base the name on the expected\n# object file name, since that is what matters with a parallel build.\nlockdir=`echo \"$cofile\" | sed -e 's|[/.-]|_|g'`.d\nwhile true; do\n  if mkdir \"$lockdir\" >/dev/null 2>&1; then\n    break\n  fi\n  sleep 1\ndone\n# FIXME: race condition here if user kills between mkdir and trap.\ntrap \"rmdir '$lockdir'; exit 1\" 1 2 15\n\n# Run the compile.\n\"$@\"\nret=$?\n\nif test -f \"$cofile\"; then\n  mv \"$cofile\" \"$ofile\"\nelif test -f \"${cofile}bj\"; then\n  mv \"${cofile}bj\" \"$ofile\"\nfi\n\nrmdir \"$lockdir\"\nexit $ret\n\n# Local Variables:\n# mode: shell-script\n# sh-indentation: 2\n# eval: (add-hook 'write-file-hooks 'time-stamp)\n# time-stamp-start: \"scriptversion=\"\n# time-stamp-format: \"%:y-%02m-%02d.%02H\"\n# time-stamp-end: \"$\"\n# End:\n"
  },
  {
    "path": "src/main/jni/tiff/config/config.guess",
    "content": "#! /bin/sh\n# Attempt to guess a canonical system name.\n#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,\n#   2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,\n#   Inc.\n\ntimestamp='2007-03-06'\n\n# This file is free software; you can redistribute it and/or modify it\n# under the terms of the GNU General Public License as published by\n# the Free Software Foundation; either version 2 of the License, or\n# (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful, but\n# WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n# General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program; if not, write to the Free Software\n# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA\n# 02110-1301, USA.\n#\n# As a special exception to the GNU General Public License, if you\n# distribute this file as part of a program that contains a\n# configuration script generated by Autoconf, you may include it under\n# the same distribution terms that you use for the rest of that program.\n\n\n# Originally written by Per Bothner <per@bothner.com>.\n# Please send patches to <config-patches@gnu.org>.  Submit a context\n# diff and a properly formatted ChangeLog entry.\n#\n# This script attempts to guess a canonical system name similar to\n# config.sub.  If it succeeds, it prints the system name on stdout, and\n# exits with 0.  Otherwise, it exits with 1.\n#\n# The plan is that this can be called by configure scripts if you\n# don't specify an explicit build system type.\n\nme=`echo \"$0\" | sed -e 's,.*/,,'`\n\nusage=\"\\\nUsage: $0 [OPTION]\n\nOutput the configuration name of the system \\`$me' is run on.\n\nOperation modes:\n  -h, --help         print this help, then exit\n  -t, --time-stamp   print date of last modification, then exit\n  -v, --version      print version number, then exit\n\nReport bugs and patches to <config-patches@gnu.org>.\"\n\nversion=\"\\\nGNU config.guess ($timestamp)\n\nOriginally written by Per Bothner.\nCopyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005\nFree Software Foundation, Inc.\n\nThis is free software; see the source for copying conditions.  There is NO\nwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\"\n\nhelp=\"\nTry \\`$me --help' for more information.\"\n\n# Parse command line\nwhile test $# -gt 0 ; do\n  case $1 in\n    --time-stamp | --time* | -t )\n       echo \"$timestamp\" ; exit ;;\n    --version | -v )\n       echo \"$version\" ; exit ;;\n    --help | --h* | -h )\n       echo \"$usage\"; exit ;;\n    -- )     # Stop option processing\n       shift; break ;;\n    - )\t# Use stdin as input.\n       break ;;\n    -* )\n       echo \"$me: invalid option $1$help\" >&2\n       exit 1 ;;\n    * )\n       break ;;\n  esac\ndone\n\nif test $# != 0; then\n  echo \"$me: too many arguments$help\" >&2\n  exit 1\nfi\n\ntrap 'exit 1' 1 2 15\n\n# CC_FOR_BUILD -- compiler used by this script. Note that the use of a\n# compiler to aid in system detection is discouraged as it requires\n# temporary files to be created and, as you can see below, it is a\n# headache to deal with in a portable fashion.\n\n# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still\n# use `HOST_CC' if defined, but it is deprecated.\n\n# Portable tmp directory creation inspired by the Autoconf team.\n\nset_cc_for_build='\ntrap \"exitcode=\\$?; (rm -f \\$tmpfiles 2>/dev/null; rmdir \\$tmp 2>/dev/null) && exit \\$exitcode\" 0 ;\ntrap \"rm -f \\$tmpfiles 2>/dev/null; rmdir \\$tmp 2>/dev/null; exit 1\" 1 2 13 15 ;\n: ${TMPDIR=/tmp} ;\n { tmp=`(umask 077 && mktemp -d \"$TMPDIR/cgXXXXXX\") 2>/dev/null` && test -n \"$tmp\" && test -d \"$tmp\" ; } ||\n { test -n \"$RANDOM\" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||\n { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo \"Warning: creating insecure temp directory\" >&2 ; } ||\n { echo \"$me: cannot create a temporary directory in $TMPDIR\" >&2 ; exit 1 ; } ;\ndummy=$tmp/dummy ;\ntmpfiles=\"$dummy.c $dummy.o $dummy.rel $dummy\" ;\ncase $CC_FOR_BUILD,$HOST_CC,$CC in\n ,,)    echo \"int x;\" > $dummy.c ;\n\tfor c in cc gcc c89 c99 ; do\n\t  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then\n\t     CC_FOR_BUILD=\"$c\"; break ;\n\t  fi ;\n\tdone ;\n\tif test x\"$CC_FOR_BUILD\" = x ; then\n\t  CC_FOR_BUILD=no_compiler_found ;\n\tfi\n\t;;\n ,,*)   CC_FOR_BUILD=$CC ;;\n ,*,*)  CC_FOR_BUILD=$HOST_CC ;;\nesac ; set_cc_for_build= ;'\n\n# This is needed to find uname on a Pyramid OSx when run in the BSD universe.\n# (ghazi@noc.rutgers.edu 1994-08-24)\nif (test -f /.attbin/uname) >/dev/null 2>&1 ; then\n\tPATH=$PATH:/.attbin ; export PATH\nfi\n\nUNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown\nUNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown\nUNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown\nUNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown\n\n# Note: order is significant - the case branches are not exclusive.\n\ncase \"${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}\" in\n    *:NetBSD:*:*)\n\t# NetBSD (nbsd) targets should (where applicable) match one or\n\t# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,\n\t# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently\n\t# switched to ELF, *-*-netbsd* would select the old\n\t# object file format.  This provides both forward\n\t# compatibility and a consistent mechanism for selecting the\n\t# object file format.\n\t#\n\t# Note: NetBSD doesn't particularly care about the vendor\n\t# portion of the name.  We always set it to \"unknown\".\n\tsysctl=\"sysctl -n hw.machine_arch\"\n\tUNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \\\n\t    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`\n\tcase \"${UNAME_MACHINE_ARCH}\" in\n\t    armeb) machine=armeb-unknown ;;\n\t    arm*) machine=arm-unknown ;;\n\t    sh3el) machine=shl-unknown ;;\n\t    sh3eb) machine=sh-unknown ;;\n\t    sh5el) machine=sh5le-unknown ;;\n\t    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;\n\tesac\n\t# The Operating System including object format, if it has switched\n\t# to ELF recently, or will in the future.\n\tcase \"${UNAME_MACHINE_ARCH}\" in\n\t    arm*|i386|m68k|ns32k|sh3*|sparc|vax)\n\t\teval $set_cc_for_build\n\t\tif echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \\\n\t\t\t| grep __ELF__ >/dev/null\n\t\tthen\n\t\t    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).\n\t\t    # Return netbsd for either.  FIX?\n\t\t    os=netbsd\n\t\telse\n\t\t    os=netbsdelf\n\t\tfi\n\t\t;;\n\t    *)\n\t        os=netbsd\n\t\t;;\n\tesac\n\t# The OS release\n\t# Debian GNU/NetBSD machines have a different userland, and\n\t# thus, need a distinct triplet. However, they do not need\n\t# kernel version information, so it can be replaced with a\n\t# suitable tag, in the style of linux-gnu.\n\tcase \"${UNAME_VERSION}\" in\n\t    Debian*)\n\t\trelease='-gnu'\n\t\t;;\n\t    *)\n\t\trelease=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\\./'`\n\t\t;;\n\tesac\n\t# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:\n\t# contains redundant information, the shorter form:\n\t# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.\n\techo \"${machine}-${os}${release}\"\n\texit ;;\n    *:OpenBSD:*:*)\n\tUNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`\n\techo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}\n\texit ;;\n    *:ekkoBSD:*:*)\n\techo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}\n\texit ;;\n    *:SolidBSD:*:*)\n\techo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}\n\texit ;;\n    macppc:MirBSD:*:*)\n\techo powerpc-unknown-mirbsd${UNAME_RELEASE}\n\texit ;;\n    *:MirBSD:*:*)\n\techo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}\n\texit ;;\n    alpha:OSF1:*:*)\n\tcase $UNAME_RELEASE in\n\t*4.0)\n\t\tUNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`\n\t\t;;\n\t*5.*)\n\t        UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`\n\t\t;;\n\tesac\n\t# According to Compaq, /usr/sbin/psrinfo has been available on\n\t# OSF/1 and Tru64 systems produced since 1995.  I hope that\n\t# covers most systems running today.  This code pipes the CPU\n\t# types through head -n 1, so we only detect the type of CPU 0.\n\tALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \\(.*\\) processor.*$/\\1/p' | head -n 1`\n\tcase \"$ALPHA_CPU_TYPE\" in\n\t    \"EV4 (21064)\")\n\t\tUNAME_MACHINE=\"alpha\" ;;\n\t    \"EV4.5 (21064)\")\n\t\tUNAME_MACHINE=\"alpha\" ;;\n\t    \"LCA4 (21066/21068)\")\n\t\tUNAME_MACHINE=\"alpha\" ;;\n\t    \"EV5 (21164)\")\n\t\tUNAME_MACHINE=\"alphaev5\" ;;\n\t    \"EV5.6 (21164A)\")\n\t\tUNAME_MACHINE=\"alphaev56\" ;;\n\t    \"EV5.6 (21164PC)\")\n\t\tUNAME_MACHINE=\"alphapca56\" ;;\n\t    \"EV5.7 (21164PC)\")\n\t\tUNAME_MACHINE=\"alphapca57\" ;;\n\t    \"EV6 (21264)\")\n\t\tUNAME_MACHINE=\"alphaev6\" ;;\n\t    \"EV6.7 (21264A)\")\n\t\tUNAME_MACHINE=\"alphaev67\" ;;\n\t    \"EV6.8CB (21264C)\")\n\t\tUNAME_MACHINE=\"alphaev68\" ;;\n\t    \"EV6.8AL (21264B)\")\n\t\tUNAME_MACHINE=\"alphaev68\" ;;\n\t    \"EV6.8CX (21264D)\")\n\t\tUNAME_MACHINE=\"alphaev68\" ;;\n\t    \"EV6.9A (21264/EV69A)\")\n\t\tUNAME_MACHINE=\"alphaev69\" ;;\n\t    \"EV7 (21364)\")\n\t\tUNAME_MACHINE=\"alphaev7\" ;;\n\t    \"EV7.9 (21364A)\")\n\t\tUNAME_MACHINE=\"alphaev79\" ;;\n\tesac\n\t# A Pn.n version is a patched version.\n\t# A Vn.n version is a released version.\n\t# A Tn.n version is a released field test version.\n\t# A Xn.n version is an unreleased experimental baselevel.\n\t# 1.2 uses \"1.2\" for uname -r.\n\techo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`\n\texit ;;\n    Alpha\\ *:Windows_NT*:*)\n\t# How do we know it's Interix rather than the generic POSIX subsystem?\n\t# Should we change UNAME_MACHINE based on the output of uname instead\n\t# of the specific Alpha model?\n\techo alpha-pc-interix\n\texit ;;\n    21064:Windows_NT:50:3)\n\techo alpha-dec-winnt3.5\n\texit ;;\n    Amiga*:UNIX_System_V:4.0:*)\n\techo m68k-unknown-sysv4\n\texit ;;\n    *:[Aa]miga[Oo][Ss]:*:*)\n\techo ${UNAME_MACHINE}-unknown-amigaos\n\texit ;;\n    *:[Mm]orph[Oo][Ss]:*:*)\n\techo ${UNAME_MACHINE}-unknown-morphos\n\texit ;;\n    *:OS/390:*:*)\n\techo i370-ibm-openedition\n\texit ;;\n    *:z/VM:*:*)\n\techo s390-ibm-zvmoe\n\texit ;;\n    *:OS400:*:*)\n        echo powerpc-ibm-os400\n\texit ;;\n    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)\n\techo arm-acorn-riscix${UNAME_RELEASE}\n\texit ;;\n    arm:riscos:*:*|arm:RISCOS:*:*)\n\techo arm-unknown-riscos\n\texit ;;\n    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)\n\techo hppa1.1-hitachi-hiuxmpp\n\texit ;;\n    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)\n\t# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.\n\tif test \"`(/bin/universe) 2>/dev/null`\" = att ; then\n\t\techo pyramid-pyramid-sysv3\n\telse\n\t\techo pyramid-pyramid-bsd\n\tfi\n\texit ;;\n    NILE*:*:*:dcosx)\n\techo pyramid-pyramid-svr4\n\texit ;;\n    DRS?6000:unix:4.0:6*)\n\techo sparc-icl-nx6\n\texit ;;\n    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)\n\tcase `/usr/bin/uname -p` in\n\t    sparc) echo sparc-icl-nx7; exit ;;\n\tesac ;;\n    sun4H:SunOS:5.*:*)\n\techo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`\n\texit ;;\n    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)\n\techo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`\n\texit ;;\n    i86pc:SunOS:5.*:*)\n\techo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`\n\texit ;;\n    sun4*:SunOS:6*:*)\n\t# According to config.sub, this is the proper way to canonicalize\n\t# SunOS6.  Hard to guess exactly what SunOS6 will be like, but\n\t# it's likely to be more like Solaris than SunOS4.\n\techo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`\n\texit ;;\n    sun4*:SunOS:*:*)\n\tcase \"`/usr/bin/arch -k`\" in\n\t    Series*|S4*)\n\t\tUNAME_RELEASE=`uname -v`\n\t\t;;\n\tesac\n\t# Japanese Language versions have a version number like `4.1.3-JL'.\n\techo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`\n\texit ;;\n    sun3*:SunOS:*:*)\n\techo m68k-sun-sunos${UNAME_RELEASE}\n\texit ;;\n    sun*:*:4.2BSD:*)\n\tUNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`\n\ttest \"x${UNAME_RELEASE}\" = \"x\" && UNAME_RELEASE=3\n\tcase \"`/bin/arch`\" in\n\t    sun3)\n\t\techo m68k-sun-sunos${UNAME_RELEASE}\n\t\t;;\n\t    sun4)\n\t\techo sparc-sun-sunos${UNAME_RELEASE}\n\t\t;;\n\tesac\n\texit ;;\n    aushp:SunOS:*:*)\n\techo sparc-auspex-sunos${UNAME_RELEASE}\n\texit ;;\n    # The situation for MiNT is a little confusing.  The machine name\n    # can be virtually everything (everything which is not\n    # \"atarist\" or \"atariste\" at least should have a processor\n    # > m68000).  The system name ranges from \"MiNT\" over \"FreeMiNT\"\n    # to the lowercase version \"mint\" (or \"freemint\").  Finally\n    # the system name \"TOS\" denotes a system which is actually not\n    # MiNT.  But MiNT is downward compatible to TOS, so this should\n    # be no problem.\n    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)\n        echo m68k-atari-mint${UNAME_RELEASE}\n\texit ;;\n    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)\n\techo m68k-atari-mint${UNAME_RELEASE}\n        exit ;;\n    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)\n        echo m68k-atari-mint${UNAME_RELEASE}\n\texit ;;\n    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)\n        echo m68k-milan-mint${UNAME_RELEASE}\n        exit ;;\n    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)\n        echo m68k-hades-mint${UNAME_RELEASE}\n        exit ;;\n    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)\n        echo m68k-unknown-mint${UNAME_RELEASE}\n        exit ;;\n    m68k:machten:*:*)\n\techo m68k-apple-machten${UNAME_RELEASE}\n\texit ;;\n    powerpc:machten:*:*)\n\techo powerpc-apple-machten${UNAME_RELEASE}\n\texit ;;\n    RISC*:Mach:*:*)\n\techo mips-dec-mach_bsd4.3\n\texit ;;\n    RISC*:ULTRIX:*:*)\n\techo mips-dec-ultrix${UNAME_RELEASE}\n\texit ;;\n    VAX*:ULTRIX*:*:*)\n\techo vax-dec-ultrix${UNAME_RELEASE}\n\texit ;;\n    2020:CLIX:*:* | 2430:CLIX:*:*)\n\techo clipper-intergraph-clix${UNAME_RELEASE}\n\texit ;;\n    mips:*:*:UMIPS | mips:*:*:RISCos)\n\teval $set_cc_for_build\n\tsed 's/^\t//' << EOF >$dummy.c\n#ifdef __cplusplus\n#include <stdio.h>  /* for printf() prototype */\n\tint main (int argc, char *argv[]) {\n#else\n\tint main (argc, argv) int argc; char *argv[]; {\n#endif\n\t#if defined (host_mips) && defined (MIPSEB)\n\t#if defined (SYSTYPE_SYSV)\n\t  printf (\"mips-mips-riscos%ssysv\\n\", argv[1]); exit (0);\n\t#endif\n\t#if defined (SYSTYPE_SVR4)\n\t  printf (\"mips-mips-riscos%ssvr4\\n\", argv[1]); exit (0);\n\t#endif\n\t#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)\n\t  printf (\"mips-mips-riscos%sbsd\\n\", argv[1]); exit (0);\n\t#endif\n\t#endif\n\t  exit (-1);\n\t}\nEOF\n\t$CC_FOR_BUILD -o $dummy $dummy.c &&\n\t  dummyarg=`echo \"${UNAME_RELEASE}\" | sed -n 's/\\([0-9]*\\).*/\\1/p'` &&\n\t  SYSTEM_NAME=`$dummy $dummyarg` &&\n\t    { echo \"$SYSTEM_NAME\"; exit; }\n\techo mips-mips-riscos${UNAME_RELEASE}\n\texit ;;\n    Motorola:PowerMAX_OS:*:*)\n\techo powerpc-motorola-powermax\n\texit ;;\n    Motorola:*:4.3:PL8-*)\n\techo powerpc-harris-powermax\n\texit ;;\n    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)\n\techo powerpc-harris-powermax\n\texit ;;\n    Night_Hawk:Power_UNIX:*:*)\n\techo powerpc-harris-powerunix\n\texit ;;\n    m88k:CX/UX:7*:*)\n\techo m88k-harris-cxux7\n\texit ;;\n    m88k:*:4*:R4*)\n\techo m88k-motorola-sysv4\n\texit ;;\n    m88k:*:3*:R3*)\n\techo m88k-motorola-sysv3\n\texit ;;\n    AViiON:dgux:*:*)\n        # DG/UX returns AViiON for all architectures\n        UNAME_PROCESSOR=`/usr/bin/uname -p`\n\tif [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]\n\tthen\n\t    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \\\n\t       [ ${TARGET_BINARY_INTERFACE}x = x ]\n\t    then\n\t\techo m88k-dg-dgux${UNAME_RELEASE}\n\t    else\n\t\techo m88k-dg-dguxbcs${UNAME_RELEASE}\n\t    fi\n\telse\n\t    echo i586-dg-dgux${UNAME_RELEASE}\n\tfi\n \texit ;;\n    M88*:DolphinOS:*:*)\t# DolphinOS (SVR3)\n\techo m88k-dolphin-sysv3\n\texit ;;\n    M88*:*:R3*:*)\n\t# Delta 88k system running SVR3\n\techo m88k-motorola-sysv3\n\texit ;;\n    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)\n\techo m88k-tektronix-sysv3\n\texit ;;\n    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)\n\techo m68k-tektronix-bsd\n\texit ;;\n    *:IRIX*:*:*)\n\techo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`\n\texit ;;\n    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.\n\techo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id\n\texit ;;               # Note that: echo \"'`uname -s`'\" gives 'AIX '\n    i*86:AIX:*:*)\n\techo i386-ibm-aix\n\texit ;;\n    ia64:AIX:*:*)\n\tif [ -x /usr/bin/oslevel ] ; then\n\t\tIBM_REV=`/usr/bin/oslevel`\n\telse\n\t\tIBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}\n\tfi\n\techo ${UNAME_MACHINE}-ibm-aix${IBM_REV}\n\texit ;;\n    *:AIX:2:3)\n\tif grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then\n\t\teval $set_cc_for_build\n\t\tsed 's/^\t\t//' << EOF >$dummy.c\n\t\t#include <sys/systemcfg.h>\n\n\t\tmain()\n\t\t\t{\n\t\t\tif (!__power_pc())\n\t\t\t\texit(1);\n\t\t\tputs(\"powerpc-ibm-aix3.2.5\");\n\t\t\texit(0);\n\t\t\t}\nEOF\n\t\tif $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`\n\t\tthen\n\t\t\techo \"$SYSTEM_NAME\"\n\t\telse\n\t\t\techo rs6000-ibm-aix3.2.5\n\t\tfi\n\telif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then\n\t\techo rs6000-ibm-aix3.2.4\n\telse\n\t\techo rs6000-ibm-aix3.2\n\tfi\n\texit ;;\n    *:AIX:*:[45])\n\tIBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`\n\tif /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then\n\t\tIBM_ARCH=rs6000\n\telse\n\t\tIBM_ARCH=powerpc\n\tfi\n\tif [ -x /usr/bin/oslevel ] ; then\n\t\tIBM_REV=`/usr/bin/oslevel`\n\telse\n\t\tIBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}\n\tfi\n\techo ${IBM_ARCH}-ibm-aix${IBM_REV}\n\texit ;;\n    *:AIX:*:*)\n\techo rs6000-ibm-aix\n\texit ;;\n    ibmrt:4.4BSD:*|romp-ibm:BSD:*)\n\techo romp-ibm-bsd4.4\n\texit ;;\n    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and\n\techo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to\n\texit ;;                             # report: romp-ibm BSD 4.3\n    *:BOSX:*:*)\n\techo rs6000-bull-bosx\n\texit ;;\n    DPX/2?00:B.O.S.:*:*)\n\techo m68k-bull-sysv3\n\texit ;;\n    9000/[34]??:4.3bsd:1.*:*)\n\techo m68k-hp-bsd\n\texit ;;\n    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)\n\techo m68k-hp-bsd4.4\n\texit ;;\n    9000/[34678]??:HP-UX:*:*)\n\tHPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`\n\tcase \"${UNAME_MACHINE}\" in\n\t    9000/31? )            HP_ARCH=m68000 ;;\n\t    9000/[34]?? )         HP_ARCH=m68k ;;\n\t    9000/[678][0-9][0-9])\n\t\tif [ -x /usr/bin/getconf ]; then\n\t\t    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`\n                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`\n                    case \"${sc_cpu_version}\" in\n                      523) HP_ARCH=\"hppa1.0\" ;; # CPU_PA_RISC1_0\n                      528) HP_ARCH=\"hppa1.1\" ;; # CPU_PA_RISC1_1\n                      532)                      # CPU_PA_RISC2_0\n                        case \"${sc_kernel_bits}\" in\n                          32) HP_ARCH=\"hppa2.0n\" ;;\n                          64) HP_ARCH=\"hppa2.0w\" ;;\n\t\t\t  '') HP_ARCH=\"hppa2.0\" ;;   # HP-UX 10.20\n                        esac ;;\n                    esac\n\t\tfi\n\t\tif [ \"${HP_ARCH}\" = \"\" ]; then\n\t\t    eval $set_cc_for_build\n\t\t    sed 's/^              //' << EOF >$dummy.c\n\n              #define _HPUX_SOURCE\n              #include <stdlib.h>\n              #include <unistd.h>\n\n              int main ()\n              {\n              #if defined(_SC_KERNEL_BITS)\n                  long bits = sysconf(_SC_KERNEL_BITS);\n              #endif\n                  long cpu  = sysconf (_SC_CPU_VERSION);\n\n                  switch (cpu)\n              \t{\n              \tcase CPU_PA_RISC1_0: puts (\"hppa1.0\"); break;\n              \tcase CPU_PA_RISC1_1: puts (\"hppa1.1\"); break;\n              \tcase CPU_PA_RISC2_0:\n              #if defined(_SC_KERNEL_BITS)\n              \t    switch (bits)\n              \t\t{\n              \t\tcase 64: puts (\"hppa2.0w\"); break;\n              \t\tcase 32: puts (\"hppa2.0n\"); break;\n              \t\tdefault: puts (\"hppa2.0\"); break;\n              \t\t} break;\n              #else  /* !defined(_SC_KERNEL_BITS) */\n              \t    puts (\"hppa2.0\"); break;\n              #endif\n              \tdefault: puts (\"hppa1.0\"); break;\n              \t}\n                  exit (0);\n              }\nEOF\n\t\t    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`\n\t\t    test -z \"$HP_ARCH\" && HP_ARCH=hppa\n\t\tfi ;;\n\tesac\n\tif [ ${HP_ARCH} = \"hppa2.0w\" ]\n\tthen\n\t    eval $set_cc_for_build\n\n\t    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating\n\t    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler\n\t    # generating 64-bit code.  GNU and HP use different nomenclature:\n\t    #\n\t    # $ CC_FOR_BUILD=cc ./config.guess\n\t    # => hppa2.0w-hp-hpux11.23\n\t    # $ CC_FOR_BUILD=\"cc +DA2.0w\" ./config.guess\n\t    # => hppa64-hp-hpux11.23\n\n\t    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |\n\t\tgrep __LP64__ >/dev/null\n\t    then\n\t\tHP_ARCH=\"hppa2.0w\"\n\t    else\n\t\tHP_ARCH=\"hppa64\"\n\t    fi\n\tfi\n\techo ${HP_ARCH}-hp-hpux${HPUX_REV}\n\texit ;;\n    ia64:HP-UX:*:*)\n\tHPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`\n\techo ia64-hp-hpux${HPUX_REV}\n\texit ;;\n    3050*:HI-UX:*:*)\n\teval $set_cc_for_build\n\tsed 's/^\t//' << EOF >$dummy.c\n\t#include <unistd.h>\n\tint\n\tmain ()\n\t{\n\t  long cpu = sysconf (_SC_CPU_VERSION);\n\t  /* The order matters, because CPU_IS_HP_MC68K erroneously returns\n\t     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct\n\t     results, however.  */\n\t  if (CPU_IS_PA_RISC (cpu))\n\t    {\n\t      switch (cpu)\n\t\t{\n\t\t  case CPU_PA_RISC1_0: puts (\"hppa1.0-hitachi-hiuxwe2\"); break;\n\t\t  case CPU_PA_RISC1_1: puts (\"hppa1.1-hitachi-hiuxwe2\"); break;\n\t\t  case CPU_PA_RISC2_0: puts (\"hppa2.0-hitachi-hiuxwe2\"); break;\n\t\t  default: puts (\"hppa-hitachi-hiuxwe2\"); break;\n\t\t}\n\t    }\n\t  else if (CPU_IS_HP_MC68K (cpu))\n\t    puts (\"m68k-hitachi-hiuxwe2\");\n\t  else puts (\"unknown-hitachi-hiuxwe2\");\n\t  exit (0);\n\t}\nEOF\n\t$CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&\n\t\t{ echo \"$SYSTEM_NAME\"; exit; }\n\techo unknown-hitachi-hiuxwe2\n\texit ;;\n    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )\n\techo hppa1.1-hp-bsd\n\texit ;;\n    9000/8??:4.3bsd:*:*)\n\techo hppa1.0-hp-bsd\n\texit ;;\n    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)\n\techo hppa1.0-hp-mpeix\n\texit ;;\n    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )\n\techo hppa1.1-hp-osf\n\texit ;;\n    hp8??:OSF1:*:*)\n\techo hppa1.0-hp-osf\n\texit ;;\n    i*86:OSF1:*:*)\n\tif [ -x /usr/sbin/sysversion ] ; then\n\t    echo ${UNAME_MACHINE}-unknown-osf1mk\n\telse\n\t    echo ${UNAME_MACHINE}-unknown-osf1\n\tfi\n\texit ;;\n    parisc*:Lites*:*:*)\n\techo hppa1.1-hp-lites\n\texit ;;\n    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)\n\techo c1-convex-bsd\n        exit ;;\n    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)\n\tif getsysinfo -f scalar_acc\n\tthen echo c32-convex-bsd\n\telse echo c2-convex-bsd\n\tfi\n        exit ;;\n    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)\n\techo c34-convex-bsd\n        exit ;;\n    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)\n\techo c38-convex-bsd\n        exit ;;\n    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)\n\techo c4-convex-bsd\n        exit ;;\n    CRAY*Y-MP:*:*:*)\n\techo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\\.[^.]*$/.X/'\n\texit ;;\n    CRAY*[A-Z]90:*:*:*)\n\techo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \\\n\t| sed -e 's/CRAY.*\\([A-Z]90\\)/\\1/' \\\n\t      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \\\n\t      -e 's/\\.[^.]*$/.X/'\n\texit ;;\n    CRAY*TS:*:*:*)\n\techo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\\.[^.]*$/.X/'\n\texit ;;\n    CRAY*T3E:*:*:*)\n\techo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\\.[^.]*$/.X/'\n\texit ;;\n    CRAY*SV1:*:*:*)\n\techo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\\.[^.]*$/.X/'\n\texit ;;\n    *:UNICOS/mp:*:*)\n\techo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\\.[^.]*$/.X/'\n\texit ;;\n    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)\n\tFUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`\n        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\\///'`\n        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`\n        echo \"${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}\"\n        exit ;;\n    5000:UNIX_System_V:4.*:*)\n        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\\///'`\n        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`\n        echo \"sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}\"\n\texit ;;\n    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\\ Embedded/OS:*:*)\n\techo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}\n\texit ;;\n    sparc*:BSD/OS:*:*)\n\techo sparc-unknown-bsdi${UNAME_RELEASE}\n\texit ;;\n    *:BSD/OS:*:*)\n\techo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}\n\texit ;;\n    *:FreeBSD:*:*)\n\tcase ${UNAME_MACHINE} in\n\t    pc98)\n\t\techo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;\n\t    amd64)\n\t\techo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;\n\t    *)\n\t\techo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;\n\tesac\n\texit ;;\n    i*:CYGWIN*:*)\n\techo ${UNAME_MACHINE}-pc-cygwin\n\texit ;;\n    *:MINGW*:*)\n\techo ${UNAME_MACHINE}-pc-mingw32\n\texit ;;\n    i*:windows32*:*)\n    \t# uname -m includes \"-pc\" on this system.\n    \techo ${UNAME_MACHINE}-mingw32\n\texit ;;\n    i*:PW*:*)\n\techo ${UNAME_MACHINE}-pc-pw32\n\texit ;;\n    *:Interix*:[3456]*)\n    \tcase ${UNAME_MACHINE} in\n\t    x86) \n\t\techo i586-pc-interix${UNAME_RELEASE}\n\t\texit ;;\n\t    EM64T | authenticamd)\n\t\techo x86_64-unknown-interix${UNAME_RELEASE}\n\t\texit ;;\n\tesac ;;\n    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)\n\techo i${UNAME_MACHINE}-pc-mks\n\texit ;;\n    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)\n\t# How do we know it's Interix rather than the generic POSIX subsystem?\n\t# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we\n\t# UNAME_MACHINE based on the output of uname instead of i386?\n\techo i586-pc-interix\n\texit ;;\n    i*:UWIN*:*)\n\techo ${UNAME_MACHINE}-pc-uwin\n\texit ;;\n    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)\n\techo x86_64-unknown-cygwin\n\texit ;;\n    p*:CYGWIN*:*)\n\techo powerpcle-unknown-cygwin\n\texit ;;\n    prep*:SunOS:5.*:*)\n\techo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`\n\texit ;;\n    *:GNU:*:*)\n\t# the GNU system\n\techo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`\n\texit ;;\n    *:GNU/*:*:*)\n\t# other systems with GNU libc and userland\n\techo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu\n\texit ;;\n    i*86:Minix:*:*)\n\techo ${UNAME_MACHINE}-pc-minix\n\texit ;;\n    arm*:Linux:*:*)\n\techo ${UNAME_MACHINE}-unknown-linux-gnu\n\texit ;;\n    avr32*:Linux:*:*)\n\techo ${UNAME_MACHINE}-unknown-linux-gnu\n\texit ;;\n    cris:Linux:*:*)\n\techo cris-axis-linux-gnu\n\texit ;;\n    crisv32:Linux:*:*)\n\techo crisv32-axis-linux-gnu\n\texit ;;\n    frv:Linux:*:*)\n    \techo frv-unknown-linux-gnu\n\texit ;;\n    ia64:Linux:*:*)\n\techo ${UNAME_MACHINE}-unknown-linux-gnu\n\texit ;;\n    m32r*:Linux:*:*)\n\techo ${UNAME_MACHINE}-unknown-linux-gnu\n\texit ;;\n    m68*:Linux:*:*)\n\techo ${UNAME_MACHINE}-unknown-linux-gnu\n\texit ;;\n    mips:Linux:*:*)\n\teval $set_cc_for_build\n\tsed 's/^\t//' << EOF >$dummy.c\n\t#undef CPU\n\t#undef mips\n\t#undef mipsel\n\t#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)\n\tCPU=mipsel\n\t#else\n\t#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)\n\tCPU=mips\n\t#else\n\tCPU=\n\t#endif\n\t#endif\nEOF\n\teval \"`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '\n\t    /^CPU/{\n\t\ts: ::g\n\t\tp\n\t    }'`\"\n\ttest x\"${CPU}\" != x && { echo \"${CPU}-unknown-linux-gnu\"; exit; }\n\t;;\n    mips64:Linux:*:*)\n\teval $set_cc_for_build\n\tsed 's/^\t//' << EOF >$dummy.c\n\t#undef CPU\n\t#undef mips64\n\t#undef mips64el\n\t#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)\n\tCPU=mips64el\n\t#else\n\t#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)\n\tCPU=mips64\n\t#else\n\tCPU=\n\t#endif\n\t#endif\nEOF\n\teval \"`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '\n\t    /^CPU/{\n\t\ts: ::g\n\t\tp\n\t    }'`\"\n\ttest x\"${CPU}\" != x && { echo \"${CPU}-unknown-linux-gnu\"; exit; }\n\t;;\n    or32:Linux:*:*)\n\techo or32-unknown-linux-gnu\n\texit ;;\n    ppc:Linux:*:*)\n\techo powerpc-unknown-linux-gnu\n\texit ;;\n    ppc64:Linux:*:*)\n\techo powerpc64-unknown-linux-gnu\n\texit ;;\n    alpha:Linux:*:*)\n\tcase `sed -n '/^cpu model/s/^.*: \\(.*\\)/\\1/p' < /proc/cpuinfo` in\n\t  EV5)   UNAME_MACHINE=alphaev5 ;;\n\t  EV56)  UNAME_MACHINE=alphaev56 ;;\n\t  PCA56) UNAME_MACHINE=alphapca56 ;;\n\t  PCA57) UNAME_MACHINE=alphapca56 ;;\n\t  EV6)   UNAME_MACHINE=alphaev6 ;;\n\t  EV67)  UNAME_MACHINE=alphaev67 ;;\n\t  EV68*) UNAME_MACHINE=alphaev68 ;;\n        esac\n\tobjdump --private-headers /bin/sh | grep ld.so.1 >/dev/null\n\tif test \"$?\" = 0 ; then LIBC=\"libc1\" ; else LIBC=\"\" ; fi\n\techo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}\n\texit ;;\n    parisc:Linux:*:* | hppa:Linux:*:*)\n\t# Look for CPU level\n\tcase `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in\n\t  PA7*) echo hppa1.1-unknown-linux-gnu ;;\n\t  PA8*) echo hppa2.0-unknown-linux-gnu ;;\n\t  *)    echo hppa-unknown-linux-gnu ;;\n\tesac\n\texit ;;\n    parisc64:Linux:*:* | hppa64:Linux:*:*)\n\techo hppa64-unknown-linux-gnu\n\texit ;;\n    s390:Linux:*:* | s390x:Linux:*:*)\n\techo ${UNAME_MACHINE}-ibm-linux\n\texit ;;\n    sh64*:Linux:*:*)\n    \techo ${UNAME_MACHINE}-unknown-linux-gnu\n\texit ;;\n    sh*:Linux:*:*)\n\techo ${UNAME_MACHINE}-unknown-linux-gnu\n\texit ;;\n    sparc:Linux:*:* | sparc64:Linux:*:*)\n\techo ${UNAME_MACHINE}-unknown-linux-gnu\n\texit ;;\n    vax:Linux:*:*)\n\techo ${UNAME_MACHINE}-dec-linux-gnu\n\texit ;;\n    x86_64:Linux:*:*)\n\techo x86_64-unknown-linux-gnu\n\texit ;;\n    xtensa:Linux:*:*)\n    \techo xtensa-unknown-linux-gnu\n\texit ;;\n    i*86:Linux:*:*)\n\t# The BFD linker knows what the default object file format is, so\n\t# first see if it will tell us. cd to the root directory to prevent\n\t# problems with other programs or directories called `ld' in the path.\n\t# Set LC_ALL=C to ensure ld outputs messages in English.\n\tld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \\\n\t\t\t | sed -ne '/supported targets:/!d\n\t\t\t\t    s/[ \t][ \t]*/ /g\n\t\t\t\t    s/.*supported targets: *//\n\t\t\t\t    s/ .*//\n\t\t\t\t    p'`\n        case \"$ld_supported_targets\" in\n\t  elf32-i386)\n\t\tTENTATIVE=\"${UNAME_MACHINE}-pc-linux-gnu\"\n\t\t;;\n\t  a.out-i386-linux)\n\t\techo \"${UNAME_MACHINE}-pc-linux-gnuaout\"\n\t\texit ;;\n\t  coff-i386)\n\t\techo \"${UNAME_MACHINE}-pc-linux-gnucoff\"\n\t\texit ;;\n\t  \"\")\n\t\t# Either a pre-BFD a.out linker (linux-gnuoldld) or\n\t\t# one that does not give us useful --help.\n\t\techo \"${UNAME_MACHINE}-pc-linux-gnuoldld\"\n\t\texit ;;\n\tesac\n\t# Determine whether the default compiler is a.out or elf\n\teval $set_cc_for_build\n\tsed 's/^\t//' << EOF >$dummy.c\n\t#include <features.h>\n\t#ifdef __ELF__\n\t# ifdef __GLIBC__\n\t#  if __GLIBC__ >= 2\n\tLIBC=gnu\n\t#  else\n\tLIBC=gnulibc1\n\t#  endif\n\t# else\n\tLIBC=gnulibc1\n\t# endif\n\t#else\n\t#if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)\n\tLIBC=gnu\n\t#else\n\tLIBC=gnuaout\n\t#endif\n\t#endif\n\t#ifdef __dietlibc__\n\tLIBC=dietlibc\n\t#endif\nEOF\n\teval \"`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '\n\t    /^LIBC/{\n\t\ts: ::g\n\t\tp\n\t    }'`\"\n\ttest x\"${LIBC}\" != x && {\n\t\techo \"${UNAME_MACHINE}-pc-linux-${LIBC}\"\n\t\texit\n\t}\n\ttest x\"${TENTATIVE}\" != x && { echo \"${TENTATIVE}\"; exit; }\n\t;;\n    i*86:DYNIX/ptx:4*:*)\n\t# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.\n\t# earlier versions are messed up and put the nodename in both\n\t# sysname and nodename.\n\techo i386-sequent-sysv4\n\texit ;;\n    i*86:UNIX_SV:4.2MP:2.*)\n        # Unixware is an offshoot of SVR4, but it has its own version\n        # number series starting with 2...\n        # I am not positive that other SVR4 systems won't match this,\n\t# I just have to hope.  -- rms.\n        # Use sysv4.2uw... so that sysv4* matches it.\n\techo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}\n\texit ;;\n    i*86:OS/2:*:*)\n\t# If we were able to find `uname', then EMX Unix compatibility\n\t# is probably installed.\n\techo ${UNAME_MACHINE}-pc-os2-emx\n\texit ;;\n    i*86:XTS-300:*:STOP)\n\techo ${UNAME_MACHINE}-unknown-stop\n\texit ;;\n    i*86:atheos:*:*)\n\techo ${UNAME_MACHINE}-unknown-atheos\n\texit ;;\n    i*86:syllable:*:*)\n\techo ${UNAME_MACHINE}-pc-syllable\n\texit ;;\n    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)\n\techo i386-unknown-lynxos${UNAME_RELEASE}\n\texit ;;\n    i*86:*DOS:*:*)\n\techo ${UNAME_MACHINE}-pc-msdosdjgpp\n\texit ;;\n    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)\n\tUNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\\/MP$//'`\n\tif grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then\n\t\techo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}\n\telse\n\t\techo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}\n\tfi\n\texit ;;\n    i*86:*:5:[678]*)\n    \t# UnixWare 7.x, OpenUNIX and OpenServer 6.\n\tcase `/bin/uname -X | grep \"^Machine\"` in\n\t    *486*)\t     UNAME_MACHINE=i486 ;;\n\t    *Pentium)\t     UNAME_MACHINE=i586 ;;\n\t    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;\n\tesac\n\techo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}\n\texit ;;\n    i*86:*:3.2:*)\n\tif test -f /usr/options/cb.name; then\n\t\tUNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`\n\t\techo ${UNAME_MACHINE}-pc-isc$UNAME_REL\n\telif /bin/uname -X 2>/dev/null >/dev/null ; then\n\t\tUNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`\n\t\t(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486\n\t\t(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \\\n\t\t\t&& UNAME_MACHINE=i586\n\t\t(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \\\n\t\t\t&& UNAME_MACHINE=i686\n\t\t(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \\\n\t\t\t&& UNAME_MACHINE=i686\n\t\techo ${UNAME_MACHINE}-pc-sco$UNAME_REL\n\telse\n\t\techo ${UNAME_MACHINE}-pc-sysv32\n\tfi\n\texit ;;\n    pc:*:*:*)\n\t# Left here for compatibility:\n        # uname -m prints for DJGPP always 'pc', but it prints nothing about\n        # the processor, so we play safe by assuming i386.\n\techo i386-pc-msdosdjgpp\n        exit ;;\n    Intel:Mach:3*:*)\n\techo i386-pc-mach3\n\texit ;;\n    paragon:*:*:*)\n\techo i860-intel-osf1\n\texit ;;\n    i860:*:4.*:*) # i860-SVR4\n\tif grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then\n\t  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4\n\telse # Add other i860-SVR4 vendors below as they are discovered.\n\t  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4\n\tfi\n\texit ;;\n    mini*:CTIX:SYS*5:*)\n\t# \"miniframe\"\n\techo m68010-convergent-sysv\n\texit ;;\n    mc68k:UNIX:SYSTEM5:3.51m)\n\techo m68k-convergent-sysv\n\texit ;;\n    M680?0:D-NIX:5.3:*)\n\techo m68k-diab-dnix\n\texit ;;\n    M68*:*:R3V[5678]*:*)\n\ttest -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;\n    3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)\n\tOS_REL=''\n\ttest -r /etc/.relid \\\n\t&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \\([0-9][0-9]\\).*/\\1/p' < /etc/.relid`\n\t/bin/uname -p 2>/dev/null | grep 86 >/dev/null \\\n\t  && { echo i486-ncr-sysv4.3${OS_REL}; exit; }\n\t/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \\\n\t  && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;\n    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)\n        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \\\n          && { echo i486-ncr-sysv4; exit; } ;;\n    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)\n\techo m68k-unknown-lynxos${UNAME_RELEASE}\n\texit ;;\n    mc68030:UNIX_System_V:4.*:*)\n\techo m68k-atari-sysv4\n\texit ;;\n    TSUNAMI:LynxOS:2.*:*)\n\techo sparc-unknown-lynxos${UNAME_RELEASE}\n\texit ;;\n    rs6000:LynxOS:2.*:*)\n\techo rs6000-unknown-lynxos${UNAME_RELEASE}\n\texit ;;\n    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)\n\techo powerpc-unknown-lynxos${UNAME_RELEASE}\n\texit ;;\n    SM[BE]S:UNIX_SV:*:*)\n\techo mips-dde-sysv${UNAME_RELEASE}\n\texit ;;\n    RM*:ReliantUNIX-*:*:*)\n\techo mips-sni-sysv4\n\texit ;;\n    RM*:SINIX-*:*:*)\n\techo mips-sni-sysv4\n\texit ;;\n    *:SINIX-*:*:*)\n\tif uname -p 2>/dev/null >/dev/null ; then\n\t\tUNAME_MACHINE=`(uname -p) 2>/dev/null`\n\t\techo ${UNAME_MACHINE}-sni-sysv4\n\telse\n\t\techo ns32k-sni-sysv\n\tfi\n\texit ;;\n    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort\n                      # says <Richard.M.Bartel@ccMail.Census.GOV>\n        echo i586-unisys-sysv4\n        exit ;;\n    *:UNIX_System_V:4*:FTX*)\n\t# From Gerald Hewes <hewes@openmarket.com>.\n\t# How about differentiating between stratus architectures? -djm\n\techo hppa1.1-stratus-sysv4\n\texit ;;\n    *:*:*:FTX*)\n\t# From seanf@swdc.stratus.com.\n\techo i860-stratus-sysv4\n\texit ;;\n    i*86:VOS:*:*)\n\t# From Paul.Green@stratus.com.\n\techo ${UNAME_MACHINE}-stratus-vos\n\texit ;;\n    *:VOS:*:*)\n\t# From Paul.Green@stratus.com.\n\techo hppa1.1-stratus-vos\n\texit ;;\n    mc68*:A/UX:*:*)\n\techo m68k-apple-aux${UNAME_RELEASE}\n\texit ;;\n    news*:NEWS-OS:6*:*)\n\techo mips-sony-newsos6\n\texit ;;\n    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)\n\tif [ -d /usr/nec ]; then\n\t        echo mips-nec-sysv${UNAME_RELEASE}\n\telse\n\t        echo mips-unknown-sysv${UNAME_RELEASE}\n\tfi\n        exit ;;\n    BeBox:BeOS:*:*)\t# BeOS running on hardware made by Be, PPC only.\n\techo powerpc-be-beos\n\texit ;;\n    BeMac:BeOS:*:*)\t# BeOS running on Mac or Mac clone, PPC only.\n\techo powerpc-apple-beos\n\texit ;;\n    BePC:BeOS:*:*)\t# BeOS running on Intel PC compatible.\n\techo i586-pc-beos\n\texit ;;\n    SX-4:SUPER-UX:*:*)\n\techo sx4-nec-superux${UNAME_RELEASE}\n\texit ;;\n    SX-5:SUPER-UX:*:*)\n\techo sx5-nec-superux${UNAME_RELEASE}\n\texit ;;\n    SX-6:SUPER-UX:*:*)\n\techo sx6-nec-superux${UNAME_RELEASE}\n\texit ;;\n    SX-7:SUPER-UX:*:*)\n\techo sx7-nec-superux${UNAME_RELEASE}\n\texit ;;\n    SX-8:SUPER-UX:*:*)\n\techo sx8-nec-superux${UNAME_RELEASE}\n\texit ;;\n    SX-8R:SUPER-UX:*:*)\n\techo sx8r-nec-superux${UNAME_RELEASE}\n\texit ;;\n    Power*:Rhapsody:*:*)\n\techo powerpc-apple-rhapsody${UNAME_RELEASE}\n\texit ;;\n    *:Rhapsody:*:*)\n\techo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}\n\texit ;;\n    *:Darwin:*:*)\n\tUNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown\n\tcase $UNAME_PROCESSOR in\n\t    unknown) UNAME_PROCESSOR=powerpc ;;\n\tesac\n\techo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}\n\texit ;;\n    *:procnto*:*:* | *:QNX:[0123456789]*:*)\n\tUNAME_PROCESSOR=`uname -p`\n\tif test \"$UNAME_PROCESSOR\" = \"x86\"; then\n\t\tUNAME_PROCESSOR=i386\n\t\tUNAME_MACHINE=pc\n\tfi\n\techo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}\n\texit ;;\n    *:QNX:*:4*)\n\techo i386-pc-qnx\n\texit ;;\n    NSE-?:NONSTOP_KERNEL:*:*)\n\techo nse-tandem-nsk${UNAME_RELEASE}\n\texit ;;\n    NSR-?:NONSTOP_KERNEL:*:*)\n\techo nsr-tandem-nsk${UNAME_RELEASE}\n\texit ;;\n    *:NonStop-UX:*:*)\n\techo mips-compaq-nonstopux\n\texit ;;\n    BS2000:POSIX*:*:*)\n\techo bs2000-siemens-sysv\n\texit ;;\n    DS/*:UNIX_System_V:*:*)\n\techo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}\n\texit ;;\n    *:Plan9:*:*)\n\t# \"uname -m\" is not consistent, so use $cputype instead. 386\n\t# is converted to i386 for consistency with other x86\n\t# operating systems.\n\tif test \"$cputype\" = \"386\"; then\n\t    UNAME_MACHINE=i386\n\telse\n\t    UNAME_MACHINE=\"$cputype\"\n\tfi\n\techo ${UNAME_MACHINE}-unknown-plan9\n\texit ;;\n    *:TOPS-10:*:*)\n\techo pdp10-unknown-tops10\n\texit ;;\n    *:TENEX:*:*)\n\techo pdp10-unknown-tenex\n\texit ;;\n    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)\n\techo pdp10-dec-tops20\n\texit ;;\n    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)\n\techo pdp10-xkl-tops20\n\texit ;;\n    *:TOPS-20:*:*)\n\techo pdp10-unknown-tops20\n\texit ;;\n    *:ITS:*:*)\n\techo pdp10-unknown-its\n\texit ;;\n    SEI:*:*:SEIUX)\n        echo mips-sei-seiux${UNAME_RELEASE}\n\texit ;;\n    *:DragonFly:*:*)\n\techo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`\n\texit ;;\n    *:*VMS:*:*)\n    \tUNAME_MACHINE=`(uname -p) 2>/dev/null`\n\tcase \"${UNAME_MACHINE}\" in\n\t    A*) echo alpha-dec-vms ; exit ;;\n\t    I*) echo ia64-dec-vms ; exit ;;\n\t    V*) echo vax-dec-vms ; exit ;;\n\tesac ;;\n    *:XENIX:*:SysV)\n\techo i386-pc-xenix\n\texit ;;\n    i*86:skyos:*:*)\n\techo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'\n\texit ;;\n    i*86:rdos:*:*)\n\techo ${UNAME_MACHINE}-pc-rdos\n\texit ;;\nesac\n\n#echo '(No uname command or uname output not recognized.)' 1>&2\n#echo \"${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}\" 1>&2\n\neval $set_cc_for_build\ncat >$dummy.c <<EOF\n#ifdef _SEQUENT_\n# include <sys/types.h>\n# include <sys/utsname.h>\n#endif\nmain ()\n{\n#if defined (sony)\n#if defined (MIPSEB)\n  /* BFD wants \"bsd\" instead of \"newsos\".  Perhaps BFD should be changed,\n     I don't know....  */\n  printf (\"mips-sony-bsd\\n\"); exit (0);\n#else\n#include <sys/param.h>\n  printf (\"m68k-sony-newsos%s\\n\",\n#ifdef NEWSOS4\n          \"4\"\n#else\n\t  \"\"\n#endif\n         ); exit (0);\n#endif\n#endif\n\n#if defined (__arm) && defined (__acorn) && defined (__unix)\n  printf (\"arm-acorn-riscix\\n\"); exit (0);\n#endif\n\n#if defined (hp300) && !defined (hpux)\n  printf (\"m68k-hp-bsd\\n\"); exit (0);\n#endif\n\n#if defined (NeXT)\n#if !defined (__ARCHITECTURE__)\n#define __ARCHITECTURE__ \"m68k\"\n#endif\n  int version;\n  version=`(hostinfo | sed -n 's/.*NeXT Mach \\([0-9]*\\).*/\\1/p') 2>/dev/null`;\n  if (version < 4)\n    printf (\"%s-next-nextstep%d\\n\", __ARCHITECTURE__, version);\n  else\n    printf (\"%s-next-openstep%d\\n\", __ARCHITECTURE__, version);\n  exit (0);\n#endif\n\n#if defined (MULTIMAX) || defined (n16)\n#if defined (UMAXV)\n  printf (\"ns32k-encore-sysv\\n\"); exit (0);\n#else\n#if defined (CMU)\n  printf (\"ns32k-encore-mach\\n\"); exit (0);\n#else\n  printf (\"ns32k-encore-bsd\\n\"); exit (0);\n#endif\n#endif\n#endif\n\n#if defined (__386BSD__)\n  printf (\"i386-pc-bsd\\n\"); exit (0);\n#endif\n\n#if defined (sequent)\n#if defined (i386)\n  printf (\"i386-sequent-dynix\\n\"); exit (0);\n#endif\n#if defined (ns32000)\n  printf (\"ns32k-sequent-dynix\\n\"); exit (0);\n#endif\n#endif\n\n#if defined (_SEQUENT_)\n    struct utsname un;\n\n    uname(&un);\n\n    if (strncmp(un.version, \"V2\", 2) == 0) {\n\tprintf (\"i386-sequent-ptx2\\n\"); exit (0);\n    }\n    if (strncmp(un.version, \"V1\", 2) == 0) { /* XXX is V1 correct? */\n\tprintf (\"i386-sequent-ptx1\\n\"); exit (0);\n    }\n    printf (\"i386-sequent-ptx\\n\"); exit (0);\n\n#endif\n\n#if defined (vax)\n# if !defined (ultrix)\n#  include <sys/param.h>\n#  if defined (BSD)\n#   if BSD == 43\n      printf (\"vax-dec-bsd4.3\\n\"); exit (0);\n#   else\n#    if BSD == 199006\n      printf (\"vax-dec-bsd4.3reno\\n\"); exit (0);\n#    else\n      printf (\"vax-dec-bsd\\n\"); exit (0);\n#    endif\n#   endif\n#  else\n    printf (\"vax-dec-bsd\\n\"); exit (0);\n#  endif\n# else\n    printf (\"vax-dec-ultrix\\n\"); exit (0);\n# endif\n#endif\n\n#if defined (alliant) && defined (i860)\n  printf (\"i860-alliant-bsd\\n\"); exit (0);\n#endif\n\n  exit (1);\n}\nEOF\n\n$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&\n\t{ echo \"$SYSTEM_NAME\"; exit; }\n\n# Apollos put the system type in the environment.\n\ntest -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }\n\n# Convex versions that predate uname can use getsysinfo(1)\n\nif [ -x /usr/convex/getsysinfo ]\nthen\n    case `getsysinfo -f cpu_type` in\n    c1*)\n\techo c1-convex-bsd\n\texit ;;\n    c2*)\n\tif getsysinfo -f scalar_acc\n\tthen echo c32-convex-bsd\n\telse echo c2-convex-bsd\n\tfi\n\texit ;;\n    c34*)\n\techo c34-convex-bsd\n\texit ;;\n    c38*)\n\techo c38-convex-bsd\n\texit ;;\n    c4*)\n\techo c4-convex-bsd\n\texit ;;\n    esac\nfi\n\ncat >&2 <<EOF\n$0: unable to guess system type\n\nThis script, last modified $timestamp, has failed to recognize\nthe operating system you are using. It is advised that you\ndownload the most up to date version of the config scripts from\n\n  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess\nand\n  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub\n\nIf the version you run ($0) is already up to date, please\nsend the following data and any information you think might be\npertinent to <config-patches@gnu.org> in order to provide the needed\ninformation to handle your system.\n\nconfig.guess timestamp = $timestamp\n\nuname -m = `(uname -m) 2>/dev/null || echo unknown`\nuname -r = `(uname -r) 2>/dev/null || echo unknown`\nuname -s = `(uname -s) 2>/dev/null || echo unknown`\nuname -v = `(uname -v) 2>/dev/null || echo unknown`\n\n/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`\n/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`\n\nhostinfo               = `(hostinfo) 2>/dev/null`\n/bin/universe          = `(/bin/universe) 2>/dev/null`\n/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`\n/bin/arch              = `(/bin/arch) 2>/dev/null`\n/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`\n/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`\n\nUNAME_MACHINE = ${UNAME_MACHINE}\nUNAME_RELEASE = ${UNAME_RELEASE}\nUNAME_SYSTEM  = ${UNAME_SYSTEM}\nUNAME_VERSION = ${UNAME_VERSION}\nEOF\n\nexit 1\n\n# Local variables:\n# eval: (add-hook 'write-file-hooks 'time-stamp)\n# time-stamp-start: \"timestamp='\"\n# time-stamp-format: \"%:y-%02m-%02d\"\n# time-stamp-end: \"'\"\n# End:\n"
  },
  {
    "path": "src/main/jni/tiff/config/config.sub",
    "content": "#! /bin/sh\n# Configuration validation subroutine script.\n#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,\n#   2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,\n#   Inc.\n\ntimestamp='2007-01-18'\n\n# This file is (in principle) common to ALL GNU software.\n# The presence of a machine in this file suggests that SOME GNU software\n# can handle that machine.  It does not imply ALL GNU software can.\n#\n# This file is free software; you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation; either version 2 of the License, or\n# (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program; if not, write to the Free Software\n# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA\n# 02110-1301, USA.\n#\n# As a special exception to the GNU General Public License, if you\n# distribute this file as part of a program that contains a\n# configuration script generated by Autoconf, you may include it under\n# the same distribution terms that you use for the rest of that program.\n\n\n# Please send patches to <config-patches@gnu.org>.  Submit a context\n# diff and a properly formatted ChangeLog entry.\n#\n# Configuration subroutine to validate and canonicalize a configuration type.\n# Supply the specified configuration type as an argument.\n# If it is invalid, we print an error message on stderr and exit with code 1.\n# Otherwise, we print the canonical config type on stdout and succeed.\n\n# This file is supposed to be the same for all GNU packages\n# and recognize all the CPU types, system types and aliases\n# that are meaningful with *any* GNU software.\n# Each package is responsible for reporting which valid configurations\n# it does not support.  The user should be able to distinguish\n# a failure to support a valid configuration from a meaningless\n# configuration.\n\n# The goal of this file is to map all the various variations of a given\n# machine specification into a single specification in the form:\n#\tCPU_TYPE-MANUFACTURER-OPERATING_SYSTEM\n# or in some cases, the newer four-part form:\n#\tCPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM\n# It is wrong to echo any other type of specification.\n\nme=`echo \"$0\" | sed -e 's,.*/,,'`\n\nusage=\"\\\nUsage: $0 [OPTION] CPU-MFR-OPSYS\n       $0 [OPTION] ALIAS\n\nCanonicalize a configuration name.\n\nOperation modes:\n  -h, --help         print this help, then exit\n  -t, --time-stamp   print date of last modification, then exit\n  -v, --version      print version number, then exit\n\nReport bugs and patches to <config-patches@gnu.org>.\"\n\nversion=\"\\\nGNU config.sub ($timestamp)\n\nCopyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005\nFree Software Foundation, Inc.\n\nThis is free software; see the source for copying conditions.  There is NO\nwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\"\n\nhelp=\"\nTry \\`$me --help' for more information.\"\n\n# Parse command line\nwhile test $# -gt 0 ; do\n  case $1 in\n    --time-stamp | --time* | -t )\n       echo \"$timestamp\" ; exit ;;\n    --version | -v )\n       echo \"$version\" ; exit ;;\n    --help | --h* | -h )\n       echo \"$usage\"; exit ;;\n    -- )     # Stop option processing\n       shift; break ;;\n    - )\t# Use stdin as input.\n       break ;;\n    -* )\n       echo \"$me: invalid option $1$help\"\n       exit 1 ;;\n\n    *local*)\n       # First pass through any local machine types.\n       echo $1\n       exit ;;\n\n    * )\n       break ;;\n  esac\ndone\n\ncase $# in\n 0) echo \"$me: missing argument$help\" >&2\n    exit 1;;\n 1) ;;\n *) echo \"$me: too many arguments$help\" >&2\n    exit 1;;\nesac\n\n# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).\n# Here we must recognize all the valid KERNEL-OS combinations.\nmaybe_os=`echo $1 | sed 's/^\\(.*\\)-\\([^-]*-[^-]*\\)$/\\2/'`\ncase $maybe_os in\n  nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \\\n  uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \\\n  storm-chaos* | os2-emx* | rtmk-nova*)\n    os=-$maybe_os\n    basic_machine=`echo $1 | sed 's/^\\(.*\\)-\\([^-]*-[^-]*\\)$/\\1/'`\n    ;;\n  *)\n    basic_machine=`echo $1 | sed 's/-[^-]*$//'`\n    if [ $basic_machine != $1 ]\n    then os=`echo $1 | sed 's/.*-/-/'`\n    else os=; fi\n    ;;\nesac\n\n### Let's recognize common machines as not being operating systems so\n### that things like config.sub decstation-3100 work.  We also\n### recognize some manufacturers as not being operating systems, so we\n### can provide default operating systems below.\ncase $os in\n\t-sun*os*)\n\t\t# Prevent following clause from handling this invalid input.\n\t\t;;\n\t-dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \\\n\t-att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \\\n\t-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \\\n\t-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\\\n\t-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \\\n\t-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \\\n\t-apple | -axis | -knuth | -cray)\n\t\tos=\n\t\tbasic_machine=$1\n\t\t;;\n\t-sim | -cisco | -oki | -wec | -winbond)\n\t\tos=\n\t\tbasic_machine=$1\n\t\t;;\n\t-scout)\n\t\t;;\n\t-wrs)\n\t\tos=-vxworks\n\t\tbasic_machine=$1\n\t\t;;\n\t-chorusos*)\n\t\tos=-chorusos\n\t\tbasic_machine=$1\n\t\t;;\n \t-chorusrdb)\n \t\tos=-chorusrdb\n\t\tbasic_machine=$1\n \t\t;;\n\t-hiux*)\n\t\tos=-hiuxwe2\n\t\t;;\n\t-sco6)\n\t\tos=-sco5v6\n\t\tbasic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`\n\t\t;;\n\t-sco5)\n\t\tos=-sco3.2v5\n\t\tbasic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`\n\t\t;;\n\t-sco4)\n\t\tos=-sco3.2v4\n\t\tbasic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`\n\t\t;;\n\t-sco3.2.[4-9]*)\n\t\tos=`echo $os | sed -e 's/sco3.2./sco3.2v/'`\n\t\tbasic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`\n\t\t;;\n\t-sco3.2v[4-9]*)\n\t\t# Don't forget version if it is 3.2v4 or newer.\n\t\tbasic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`\n\t\t;;\n\t-sco5v6*)\n\t\t# Don't forget version if it is 3.2v4 or newer.\n\t\tbasic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`\n\t\t;;\n\t-sco*)\n\t\tos=-sco3.2v2\n\t\tbasic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`\n\t\t;;\n\t-udk*)\n\t\tbasic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`\n\t\t;;\n\t-isc)\n\t\tos=-isc2.2\n\t\tbasic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`\n\t\t;;\n\t-clix*)\n\t\tbasic_machine=clipper-intergraph\n\t\t;;\n\t-isc*)\n\t\tbasic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`\n\t\t;;\n\t-lynx*)\n\t\tos=-lynxos\n\t\t;;\n\t-ptx*)\n\t\tbasic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`\n\t\t;;\n\t-windowsnt*)\n\t\tos=`echo $os | sed -e 's/windowsnt/winnt/'`\n\t\t;;\n\t-psos*)\n\t\tos=-psos\n\t\t;;\n\t-mint | -mint[0-9]*)\n\t\tbasic_machine=m68k-atari\n\t\tos=-mint\n\t\t;;\nesac\n\n# Decode aliases for certain CPU-COMPANY combinations.\ncase $basic_machine in\n\t# Recognize the basic CPU types without company name.\n\t# Some are omitted here because they have special meanings below.\n\t1750a | 580 \\\n\t| a29k \\\n\t| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \\\n\t| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \\\n\t| am33_2.0 \\\n\t| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \\\n\t| bfin \\\n\t| c4x | clipper \\\n\t| d10v | d30v | dlx | dsp16xx \\\n\t| fido | fr30 | frv \\\n\t| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \\\n\t| i370 | i860 | i960 | ia64 \\\n\t| ip2k | iq2000 \\\n\t| m32c | m32r | m32rle | m68000 | m68k | m88k \\\n\t| maxq | mb | microblaze | mcore | mep \\\n\t| mips | mipsbe | mipseb | mipsel | mipsle \\\n\t| mips16 \\\n\t| mips64 | mips64el \\\n\t| mips64vr | mips64vrel \\\n\t| mips64orion | mips64orionel \\\n\t| mips64vr4100 | mips64vr4100el \\\n\t| mips64vr4300 | mips64vr4300el \\\n\t| mips64vr5000 | mips64vr5000el \\\n\t| mips64vr5900 | mips64vr5900el \\\n\t| mipsisa32 | mipsisa32el \\\n\t| mipsisa32r2 | mipsisa32r2el \\\n\t| mipsisa64 | mipsisa64el \\\n\t| mipsisa64r2 | mipsisa64r2el \\\n\t| mipsisa64sb1 | mipsisa64sb1el \\\n\t| mipsisa64sr71k | mipsisa64sr71kel \\\n\t| mipstx39 | mipstx39el \\\n\t| mn10200 | mn10300 \\\n\t| mt \\\n\t| msp430 \\\n\t| nios | nios2 \\\n\t| ns16k | ns32k \\\n\t| or32 \\\n\t| pdp10 | pdp11 | pj | pjl \\\n\t| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \\\n\t| pyramid \\\n\t| score \\\n\t| sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \\\n\t| sh64 | sh64le \\\n\t| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \\\n\t| sparcv8 | sparcv9 | sparcv9b | sparcv9v \\\n\t| spu | strongarm \\\n\t| tahoe | thumb | tic4x | tic80 | tron \\\n\t| v850 | v850e \\\n\t| we32k \\\n\t| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \\\n\t| z8k)\n\t\tbasic_machine=$basic_machine-unknown\n\t\t;;\n\tm6811 | m68hc11 | m6812 | m68hc12)\n\t\t# Motorola 68HC11/12.\n\t\tbasic_machine=$basic_machine-unknown\n\t\tos=-none\n\t\t;;\n\tm88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)\n\t\t;;\n\tms1)\n\t\tbasic_machine=mt-unknown\n\t\t;;\n\n\t# We use `pc' rather than `unknown'\n\t# because (1) that's what they normally are, and\n\t# (2) the word \"unknown\" tends to confuse beginning users.\n\ti*86 | x86_64)\n\t  basic_machine=$basic_machine-pc\n\t  ;;\n\t# Object if more than one company name word.\n\t*-*-*)\n\t\techo Invalid configuration \\`$1\\': machine \\`$basic_machine\\' not recognized 1>&2\n\t\texit 1\n\t\t;;\n\t# Recognize the basic CPU types with company name.\n\t580-* \\\n\t| a29k-* \\\n\t| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \\\n\t| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \\\n\t| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \\\n\t| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \\\n\t| avr-* | avr32-* \\\n\t| bfin-* | bs2000-* \\\n\t| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \\\n\t| clipper-* | craynv-* | cydra-* \\\n\t| d10v-* | d30v-* | dlx-* \\\n\t| elxsi-* \\\n\t| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \\\n\t| h8300-* | h8500-* \\\n\t| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \\\n\t| i*86-* | i860-* | i960-* | ia64-* \\\n\t| ip2k-* | iq2000-* \\\n\t| m32c-* | m32r-* | m32rle-* \\\n\t| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \\\n\t| m88110-* | m88k-* | maxq-* | mcore-* \\\n\t| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \\\n\t| mips16-* \\\n\t| mips64-* | mips64el-* \\\n\t| mips64vr-* | mips64vrel-* \\\n\t| mips64orion-* | mips64orionel-* \\\n\t| mips64vr4100-* | mips64vr4100el-* \\\n\t| mips64vr4300-* | mips64vr4300el-* \\\n\t| mips64vr5000-* | mips64vr5000el-* \\\n\t| mips64vr5900-* | mips64vr5900el-* \\\n\t| mipsisa32-* | mipsisa32el-* \\\n\t| mipsisa32r2-* | mipsisa32r2el-* \\\n\t| mipsisa64-* | mipsisa64el-* \\\n\t| mipsisa64r2-* | mipsisa64r2el-* \\\n\t| mipsisa64sb1-* | mipsisa64sb1el-* \\\n\t| mipsisa64sr71k-* | mipsisa64sr71kel-* \\\n\t| mipstx39-* | mipstx39el-* \\\n\t| mmix-* \\\n\t| mt-* \\\n\t| msp430-* \\\n\t| nios-* | nios2-* \\\n\t| none-* | np1-* | ns16k-* | ns32k-* \\\n\t| orion-* \\\n\t| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \\\n\t| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \\\n\t| pyramid-* \\\n\t| romp-* | rs6000-* \\\n\t| sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \\\n\t| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \\\n\t| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \\\n\t| sparclite-* \\\n\t| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \\\n\t| tahoe-* | thumb-* \\\n\t| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \\\n\t| tron-* \\\n\t| v850-* | v850e-* | vax-* \\\n\t| we32k-* \\\n\t| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \\\n\t| xstormy16-* | xtensa-* \\\n\t| ymp-* \\\n\t| z8k-*)\n\t\t;;\n\t# Recognize the various machine names and aliases which stand\n\t# for a CPU type and a company and sometimes even an OS.\n\t386bsd)\n\t\tbasic_machine=i386-unknown\n\t\tos=-bsd\n\t\t;;\n\t3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)\n\t\tbasic_machine=m68000-att\n\t\t;;\n\t3b*)\n\t\tbasic_machine=we32k-att\n\t\t;;\n\ta29khif)\n\t\tbasic_machine=a29k-amd\n\t\tos=-udi\n\t\t;;\n    \tabacus)\n\t\tbasic_machine=abacus-unknown\n\t\t;;\n\tadobe68k)\n\t\tbasic_machine=m68010-adobe\n\t\tos=-scout\n\t\t;;\n\talliant | fx80)\n\t\tbasic_machine=fx80-alliant\n\t\t;;\n\taltos | altos3068)\n\t\tbasic_machine=m68k-altos\n\t\t;;\n\tam29k)\n\t\tbasic_machine=a29k-none\n\t\tos=-bsd\n\t\t;;\n\tamd64)\n\t\tbasic_machine=x86_64-pc\n\t\t;;\n\tamd64-*)\n\t\tbasic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`\n\t\t;;\n\tamdahl)\n\t\tbasic_machine=580-amdahl\n\t\tos=-sysv\n\t\t;;\n\tamiga | amiga-*)\n\t\tbasic_machine=m68k-unknown\n\t\t;;\n\tamigaos | amigados)\n\t\tbasic_machine=m68k-unknown\n\t\tos=-amigaos\n\t\t;;\n\tamigaunix | amix)\n\t\tbasic_machine=m68k-unknown\n\t\tos=-sysv4\n\t\t;;\n\tapollo68)\n\t\tbasic_machine=m68k-apollo\n\t\tos=-sysv\n\t\t;;\n\tapollo68bsd)\n\t\tbasic_machine=m68k-apollo\n\t\tos=-bsd\n\t\t;;\n\taux)\n\t\tbasic_machine=m68k-apple\n\t\tos=-aux\n\t\t;;\n\tbalance)\n\t\tbasic_machine=ns32k-sequent\n\t\tos=-dynix\n\t\t;;\n\tc90)\n\t\tbasic_machine=c90-cray\n\t\tos=-unicos\n\t\t;;\n\tconvex-c1)\n\t\tbasic_machine=c1-convex\n\t\tos=-bsd\n\t\t;;\n\tconvex-c2)\n\t\tbasic_machine=c2-convex\n\t\tos=-bsd\n\t\t;;\n\tconvex-c32)\n\t\tbasic_machine=c32-convex\n\t\tos=-bsd\n\t\t;;\n\tconvex-c34)\n\t\tbasic_machine=c34-convex\n\t\tos=-bsd\n\t\t;;\n\tconvex-c38)\n\t\tbasic_machine=c38-convex\n\t\tos=-bsd\n\t\t;;\n\tcray | j90)\n\t\tbasic_machine=j90-cray\n\t\tos=-unicos\n\t\t;;\n\tcraynv)\n\t\tbasic_machine=craynv-cray\n\t\tos=-unicosmp\n\t\t;;\n\tcr16c)\n\t\tbasic_machine=cr16c-unknown\n\t\tos=-elf\n\t\t;;\n\tcrds | unos)\n\t\tbasic_machine=m68k-crds\n\t\t;;\n\tcrisv32 | crisv32-* | etraxfs*)\n\t\tbasic_machine=crisv32-axis\n\t\t;;\n\tcris | cris-* | etrax*)\n\t\tbasic_machine=cris-axis\n\t\t;;\n\tcrx)\n\t\tbasic_machine=crx-unknown\n\t\tos=-elf\n\t\t;;\n\tda30 | da30-*)\n\t\tbasic_machine=m68k-da30\n\t\t;;\n\tdecstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)\n\t\tbasic_machine=mips-dec\n\t\t;;\n\tdecsystem10* | dec10*)\n\t\tbasic_machine=pdp10-dec\n\t\tos=-tops10\n\t\t;;\n\tdecsystem20* | dec20*)\n\t\tbasic_machine=pdp10-dec\n\t\tos=-tops20\n\t\t;;\n\tdelta | 3300 | motorola-3300 | motorola-delta \\\n\t      | 3300-motorola | delta-motorola)\n\t\tbasic_machine=m68k-motorola\n\t\t;;\n\tdelta88)\n\t\tbasic_machine=m88k-motorola\n\t\tos=-sysv3\n\t\t;;\n\tdjgpp)\n\t\tbasic_machine=i586-pc\n\t\tos=-msdosdjgpp\n\t\t;;\n\tdpx20 | dpx20-*)\n\t\tbasic_machine=rs6000-bull\n\t\tos=-bosx\n\t\t;;\n\tdpx2* | dpx2*-bull)\n\t\tbasic_machine=m68k-bull\n\t\tos=-sysv3\n\t\t;;\n\tebmon29k)\n\t\tbasic_machine=a29k-amd\n\t\tos=-ebmon\n\t\t;;\n\telxsi)\n\t\tbasic_machine=elxsi-elxsi\n\t\tos=-bsd\n\t\t;;\n\tencore | umax | mmax)\n\t\tbasic_machine=ns32k-encore\n\t\t;;\n\tes1800 | OSE68k | ose68k | ose | OSE)\n\t\tbasic_machine=m68k-ericsson\n\t\tos=-ose\n\t\t;;\n\tfx2800)\n\t\tbasic_machine=i860-alliant\n\t\t;;\n\tgenix)\n\t\tbasic_machine=ns32k-ns\n\t\t;;\n\tgmicro)\n\t\tbasic_machine=tron-gmicro\n\t\tos=-sysv\n\t\t;;\n\tgo32)\n\t\tbasic_machine=i386-pc\n\t\tos=-go32\n\t\t;;\n\th3050r* | hiux*)\n\t\tbasic_machine=hppa1.1-hitachi\n\t\tos=-hiuxwe2\n\t\t;;\n\th8300hms)\n\t\tbasic_machine=h8300-hitachi\n\t\tos=-hms\n\t\t;;\n\th8300xray)\n\t\tbasic_machine=h8300-hitachi\n\t\tos=-xray\n\t\t;;\n\th8500hms)\n\t\tbasic_machine=h8500-hitachi\n\t\tos=-hms\n\t\t;;\n\tharris)\n\t\tbasic_machine=m88k-harris\n\t\tos=-sysv3\n\t\t;;\n\thp300-*)\n\t\tbasic_machine=m68k-hp\n\t\t;;\n\thp300bsd)\n\t\tbasic_machine=m68k-hp\n\t\tos=-bsd\n\t\t;;\n\thp300hpux)\n\t\tbasic_machine=m68k-hp\n\t\tos=-hpux\n\t\t;;\n\thp3k9[0-9][0-9] | hp9[0-9][0-9])\n\t\tbasic_machine=hppa1.0-hp\n\t\t;;\n\thp9k2[0-9][0-9] | hp9k31[0-9])\n\t\tbasic_machine=m68000-hp\n\t\t;;\n\thp9k3[2-9][0-9])\n\t\tbasic_machine=m68k-hp\n\t\t;;\n\thp9k6[0-9][0-9] | hp6[0-9][0-9])\n\t\tbasic_machine=hppa1.0-hp\n\t\t;;\n\thp9k7[0-79][0-9] | hp7[0-79][0-9])\n\t\tbasic_machine=hppa1.1-hp\n\t\t;;\n\thp9k78[0-9] | hp78[0-9])\n\t\t# FIXME: really hppa2.0-hp\n\t\tbasic_machine=hppa1.1-hp\n\t\t;;\n\thp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)\n\t\t# FIXME: really hppa2.0-hp\n\t\tbasic_machine=hppa1.1-hp\n\t\t;;\n\thp9k8[0-9][13679] | hp8[0-9][13679])\n\t\tbasic_machine=hppa1.1-hp\n\t\t;;\n\thp9k8[0-9][0-9] | hp8[0-9][0-9])\n\t\tbasic_machine=hppa1.0-hp\n\t\t;;\n\thppa-next)\n\t\tos=-nextstep3\n\t\t;;\n\thppaosf)\n\t\tbasic_machine=hppa1.1-hp\n\t\tos=-osf\n\t\t;;\n\thppro)\n\t\tbasic_machine=hppa1.1-hp\n\t\tos=-proelf\n\t\t;;\n\ti370-ibm* | ibm*)\n\t\tbasic_machine=i370-ibm\n\t\t;;\n# I'm not sure what \"Sysv32\" means.  Should this be sysv3.2?\n\ti*86v32)\n\t\tbasic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`\n\t\tos=-sysv32\n\t\t;;\n\ti*86v4*)\n\t\tbasic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`\n\t\tos=-sysv4\n\t\t;;\n\ti*86v)\n\t\tbasic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`\n\t\tos=-sysv\n\t\t;;\n\ti*86sol2)\n\t\tbasic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`\n\t\tos=-solaris2\n\t\t;;\n\ti386mach)\n\t\tbasic_machine=i386-mach\n\t\tos=-mach\n\t\t;;\n\ti386-vsta | vsta)\n\t\tbasic_machine=i386-unknown\n\t\tos=-vsta\n\t\t;;\n\tiris | iris4d)\n\t\tbasic_machine=mips-sgi\n\t\tcase $os in\n\t\t    -irix*)\n\t\t\t;;\n\t\t    *)\n\t\t\tos=-irix4\n\t\t\t;;\n\t\tesac\n\t\t;;\n\tisi68 | isi)\n\t\tbasic_machine=m68k-isi\n\t\tos=-sysv\n\t\t;;\n\tm88k-omron*)\n\t\tbasic_machine=m88k-omron\n\t\t;;\n\tmagnum | m3230)\n\t\tbasic_machine=mips-mips\n\t\tos=-sysv\n\t\t;;\n\tmerlin)\n\t\tbasic_machine=ns32k-utek\n\t\tos=-sysv\n\t\t;;\n\tmingw32)\n\t\tbasic_machine=i386-pc\n\t\tos=-mingw32\n\t\t;;\n\tminiframe)\n\t\tbasic_machine=m68000-convergent\n\t\t;;\n\t*mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)\n\t\tbasic_machine=m68k-atari\n\t\tos=-mint\n\t\t;;\n\tmips3*-*)\n\t\tbasic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`\n\t\t;;\n\tmips3*)\n\t\tbasic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown\n\t\t;;\n\tmonitor)\n\t\tbasic_machine=m68k-rom68k\n\t\tos=-coff\n\t\t;;\n\tmorphos)\n\t\tbasic_machine=powerpc-unknown\n\t\tos=-morphos\n\t\t;;\n\tmsdos)\n\t\tbasic_machine=i386-pc\n\t\tos=-msdos\n\t\t;;\n\tms1-*)\n\t\tbasic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`\n\t\t;;\n\tmvs)\n\t\tbasic_machine=i370-ibm\n\t\tos=-mvs\n\t\t;;\n\tncr3000)\n\t\tbasic_machine=i486-ncr\n\t\tos=-sysv4\n\t\t;;\n\tnetbsd386)\n\t\tbasic_machine=i386-unknown\n\t\tos=-netbsd\n\t\t;;\n\tnetwinder)\n\t\tbasic_machine=armv4l-rebel\n\t\tos=-linux\n\t\t;;\n\tnews | news700 | news800 | news900)\n\t\tbasic_machine=m68k-sony\n\t\tos=-newsos\n\t\t;;\n\tnews1000)\n\t\tbasic_machine=m68030-sony\n\t\tos=-newsos\n\t\t;;\n\tnews-3600 | risc-news)\n\t\tbasic_machine=mips-sony\n\t\tos=-newsos\n\t\t;;\n\tnecv70)\n\t\tbasic_machine=v70-nec\n\t\tos=-sysv\n\t\t;;\n\tnext | m*-next )\n\t\tbasic_machine=m68k-next\n\t\tcase $os in\n\t\t    -nextstep* )\n\t\t\t;;\n\t\t    -ns2*)\n\t\t      os=-nextstep2\n\t\t\t;;\n\t\t    *)\n\t\t      os=-nextstep3\n\t\t\t;;\n\t\tesac\n\t\t;;\n\tnh3000)\n\t\tbasic_machine=m68k-harris\n\t\tos=-cxux\n\t\t;;\n\tnh[45]000)\n\t\tbasic_machine=m88k-harris\n\t\tos=-cxux\n\t\t;;\n\tnindy960)\n\t\tbasic_machine=i960-intel\n\t\tos=-nindy\n\t\t;;\n\tmon960)\n\t\tbasic_machine=i960-intel\n\t\tos=-mon960\n\t\t;;\n\tnonstopux)\n\t\tbasic_machine=mips-compaq\n\t\tos=-nonstopux\n\t\t;;\n\tnp1)\n\t\tbasic_machine=np1-gould\n\t\t;;\n\tnsr-tandem)\n\t\tbasic_machine=nsr-tandem\n\t\t;;\n\top50n-* | op60c-*)\n\t\tbasic_machine=hppa1.1-oki\n\t\tos=-proelf\n\t\t;;\n\topenrisc | openrisc-*)\n\t\tbasic_machine=or32-unknown\n\t\t;;\n\tos400)\n\t\tbasic_machine=powerpc-ibm\n\t\tos=-os400\n\t\t;;\n\tOSE68000 | ose68000)\n\t\tbasic_machine=m68000-ericsson\n\t\tos=-ose\n\t\t;;\n\tos68k)\n\t\tbasic_machine=m68k-none\n\t\tos=-os68k\n\t\t;;\n\tpa-hitachi)\n\t\tbasic_machine=hppa1.1-hitachi\n\t\tos=-hiuxwe2\n\t\t;;\n\tparagon)\n\t\tbasic_machine=i860-intel\n\t\tos=-osf\n\t\t;;\n\tpbd)\n\t\tbasic_machine=sparc-tti\n\t\t;;\n\tpbb)\n\t\tbasic_machine=m68k-tti\n\t\t;;\n\tpc532 | pc532-*)\n\t\tbasic_machine=ns32k-pc532\n\t\t;;\n\tpc98)\n\t\tbasic_machine=i386-pc\n\t\t;;\n\tpc98-*)\n\t\tbasic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`\n\t\t;;\n\tpentium | p5 | k5 | k6 | nexgen | viac3)\n\t\tbasic_machine=i586-pc\n\t\t;;\n\tpentiumpro | p6 | 6x86 | athlon | athlon_*)\n\t\tbasic_machine=i686-pc\n\t\t;;\n\tpentiumii | pentium2 | pentiumiii | pentium3)\n\t\tbasic_machine=i686-pc\n\t\t;;\n\tpentium4)\n\t\tbasic_machine=i786-pc\n\t\t;;\n\tpentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)\n\t\tbasic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`\n\t\t;;\n\tpentiumpro-* | p6-* | 6x86-* | athlon-*)\n\t\tbasic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`\n\t\t;;\n\tpentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)\n\t\tbasic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`\n\t\t;;\n\tpentium4-*)\n\t\tbasic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`\n\t\t;;\n\tpn)\n\t\tbasic_machine=pn-gould\n\t\t;;\n\tpower)\tbasic_machine=power-ibm\n\t\t;;\n\tppc)\tbasic_machine=powerpc-unknown\n\t\t;;\n\tppc-*)\tbasic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`\n\t\t;;\n\tppcle | powerpclittle | ppc-le | powerpc-little)\n\t\tbasic_machine=powerpcle-unknown\n\t\t;;\n\tppcle-* | powerpclittle-*)\n\t\tbasic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`\n\t\t;;\n\tppc64)\tbasic_machine=powerpc64-unknown\n\t\t;;\n\tppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`\n\t\t;;\n\tppc64le | powerpc64little | ppc64-le | powerpc64-little)\n\t\tbasic_machine=powerpc64le-unknown\n\t\t;;\n\tppc64le-* | powerpc64little-*)\n\t\tbasic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`\n\t\t;;\n\tps2)\n\t\tbasic_machine=i386-ibm\n\t\t;;\n\tpw32)\n\t\tbasic_machine=i586-unknown\n\t\tos=-pw32\n\t\t;;\n\trdos)\n\t\tbasic_machine=i386-pc\n\t\tos=-rdos\n\t\t;;\n\trom68k)\n\t\tbasic_machine=m68k-rom68k\n\t\tos=-coff\n\t\t;;\n\trm[46]00)\n\t\tbasic_machine=mips-siemens\n\t\t;;\n\trtpc | rtpc-*)\n\t\tbasic_machine=romp-ibm\n\t\t;;\n\ts390 | s390-*)\n\t\tbasic_machine=s390-ibm\n\t\t;;\n\ts390x | s390x-*)\n\t\tbasic_machine=s390x-ibm\n\t\t;;\n\tsa29200)\n\t\tbasic_machine=a29k-amd\n\t\tos=-udi\n\t\t;;\n\tsb1)\n\t\tbasic_machine=mipsisa64sb1-unknown\n\t\t;;\n\tsb1el)\n\t\tbasic_machine=mipsisa64sb1el-unknown\n\t\t;;\n\tsde)\n\t\tbasic_machine=mipsisa32-sde\n\t\tos=-elf\n\t\t;;\n\tsei)\n\t\tbasic_machine=mips-sei\n\t\tos=-seiux\n\t\t;;\n\tsequent)\n\t\tbasic_machine=i386-sequent\n\t\t;;\n\tsh)\n\t\tbasic_machine=sh-hitachi\n\t\tos=-hms\n\t\t;;\n\tsh5el)\n\t\tbasic_machine=sh5le-unknown\n\t\t;;\n\tsh64)\n\t\tbasic_machine=sh64-unknown\n\t\t;;\n\tsparclite-wrs | simso-wrs)\n\t\tbasic_machine=sparclite-wrs\n\t\tos=-vxworks\n\t\t;;\n\tsps7)\n\t\tbasic_machine=m68k-bull\n\t\tos=-sysv2\n\t\t;;\n\tspur)\n\t\tbasic_machine=spur-unknown\n\t\t;;\n\tst2000)\n\t\tbasic_machine=m68k-tandem\n\t\t;;\n\tstratus)\n\t\tbasic_machine=i860-stratus\n\t\tos=-sysv4\n\t\t;;\n\tsun2)\n\t\tbasic_machine=m68000-sun\n\t\t;;\n\tsun2os3)\n\t\tbasic_machine=m68000-sun\n\t\tos=-sunos3\n\t\t;;\n\tsun2os4)\n\t\tbasic_machine=m68000-sun\n\t\tos=-sunos4\n\t\t;;\n\tsun3os3)\n\t\tbasic_machine=m68k-sun\n\t\tos=-sunos3\n\t\t;;\n\tsun3os4)\n\t\tbasic_machine=m68k-sun\n\t\tos=-sunos4\n\t\t;;\n\tsun4os3)\n\t\tbasic_machine=sparc-sun\n\t\tos=-sunos3\n\t\t;;\n\tsun4os4)\n\t\tbasic_machine=sparc-sun\n\t\tos=-sunos4\n\t\t;;\n\tsun4sol2)\n\t\tbasic_machine=sparc-sun\n\t\tos=-solaris2\n\t\t;;\n\tsun3 | sun3-*)\n\t\tbasic_machine=m68k-sun\n\t\t;;\n\tsun4)\n\t\tbasic_machine=sparc-sun\n\t\t;;\n\tsun386 | sun386i | roadrunner)\n\t\tbasic_machine=i386-sun\n\t\t;;\n\tsv1)\n\t\tbasic_machine=sv1-cray\n\t\tos=-unicos\n\t\t;;\n\tsymmetry)\n\t\tbasic_machine=i386-sequent\n\t\tos=-dynix\n\t\t;;\n\tt3e)\n\t\tbasic_machine=alphaev5-cray\n\t\tos=-unicos\n\t\t;;\n\tt90)\n\t\tbasic_machine=t90-cray\n\t\tos=-unicos\n\t\t;;\n\ttic54x | c54x*)\n\t\tbasic_machine=tic54x-unknown\n\t\tos=-coff\n\t\t;;\n\ttic55x | c55x*)\n\t\tbasic_machine=tic55x-unknown\n\t\tos=-coff\n\t\t;;\n\ttic6x | c6x*)\n\t\tbasic_machine=tic6x-unknown\n\t\tos=-coff\n\t\t;;\n\ttx39)\n\t\tbasic_machine=mipstx39-unknown\n\t\t;;\n\ttx39el)\n\t\tbasic_machine=mipstx39el-unknown\n\t\t;;\n\ttoad1)\n\t\tbasic_machine=pdp10-xkl\n\t\tos=-tops20\n\t\t;;\n\ttower | tower-32)\n\t\tbasic_machine=m68k-ncr\n\t\t;;\n\ttpf)\n\t\tbasic_machine=s390x-ibm\n\t\tos=-tpf\n\t\t;;\n\tudi29k)\n\t\tbasic_machine=a29k-amd\n\t\tos=-udi\n\t\t;;\n\tultra3)\n\t\tbasic_machine=a29k-nyu\n\t\tos=-sym1\n\t\t;;\n\tv810 | necv810)\n\t\tbasic_machine=v810-nec\n\t\tos=-none\n\t\t;;\n\tvaxv)\n\t\tbasic_machine=vax-dec\n\t\tos=-sysv\n\t\t;;\n\tvms)\n\t\tbasic_machine=vax-dec\n\t\tos=-vms\n\t\t;;\n\tvpp*|vx|vx-*)\n\t\tbasic_machine=f301-fujitsu\n\t\t;;\n\tvxworks960)\n\t\tbasic_machine=i960-wrs\n\t\tos=-vxworks\n\t\t;;\n\tvxworks68)\n\t\tbasic_machine=m68k-wrs\n\t\tos=-vxworks\n\t\t;;\n\tvxworks29k)\n\t\tbasic_machine=a29k-wrs\n\t\tos=-vxworks\n\t\t;;\n\tw65*)\n\t\tbasic_machine=w65-wdc\n\t\tos=-none\n\t\t;;\n\tw89k-*)\n\t\tbasic_machine=hppa1.1-winbond\n\t\tos=-proelf\n\t\t;;\n\txbox)\n\t\tbasic_machine=i686-pc\n\t\tos=-mingw32\n\t\t;;\n\txps | xps100)\n\t\tbasic_machine=xps100-honeywell\n\t\t;;\n\tymp)\n\t\tbasic_machine=ymp-cray\n\t\tos=-unicos\n\t\t;;\n\tz8k-*-coff)\n\t\tbasic_machine=z8k-unknown\n\t\tos=-sim\n\t\t;;\n\tnone)\n\t\tbasic_machine=none-none\n\t\tos=-none\n\t\t;;\n\n# Here we handle the default manufacturer of certain CPU types.  It is in\n# some cases the only manufacturer, in others, it is the most popular.\n\tw89k)\n\t\tbasic_machine=hppa1.1-winbond\n\t\t;;\n\top50n)\n\t\tbasic_machine=hppa1.1-oki\n\t\t;;\n\top60c)\n\t\tbasic_machine=hppa1.1-oki\n\t\t;;\n\tromp)\n\t\tbasic_machine=romp-ibm\n\t\t;;\n\tmmix)\n\t\tbasic_machine=mmix-knuth\n\t\t;;\n\trs6000)\n\t\tbasic_machine=rs6000-ibm\n\t\t;;\n\tvax)\n\t\tbasic_machine=vax-dec\n\t\t;;\n\tpdp10)\n\t\t# there are many clones, so DEC is not a safe bet\n\t\tbasic_machine=pdp10-unknown\n\t\t;;\n\tpdp11)\n\t\tbasic_machine=pdp11-dec\n\t\t;;\n\twe32k)\n\t\tbasic_machine=we32k-att\n\t\t;;\n\tsh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)\n\t\tbasic_machine=sh-unknown\n\t\t;;\n\tsparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)\n\t\tbasic_machine=sparc-sun\n\t\t;;\n\tcydra)\n\t\tbasic_machine=cydra-cydrome\n\t\t;;\n\torion)\n\t\tbasic_machine=orion-highlevel\n\t\t;;\n\torion105)\n\t\tbasic_machine=clipper-highlevel\n\t\t;;\n\tmac | mpw | mac-mpw)\n\t\tbasic_machine=m68k-apple\n\t\t;;\n\tpmac | pmac-mpw)\n\t\tbasic_machine=powerpc-apple\n\t\t;;\n\t*-unknown)\n\t\t# Make sure to match an already-canonicalized machine name.\n\t\t;;\n\t*)\n\t\techo Invalid configuration \\`$1\\': machine \\`$basic_machine\\' not recognized 1>&2\n\t\texit 1\n\t\t;;\nesac\n\n# Here we canonicalize certain aliases for manufacturers.\ncase $basic_machine in\n\t*-digital*)\n\t\tbasic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`\n\t\t;;\n\t*-commodore*)\n\t\tbasic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`\n\t\t;;\n\t*)\n\t\t;;\nesac\n\n# Decode manufacturer-specific aliases for certain operating systems.\n\nif [ x\"$os\" != x\"\" ]\nthen\ncase $os in\n        # First match some system type aliases\n        # that might get confused with valid system types.\n\t# -solaris* is a basic system type, with this one exception.\n\t-solaris1 | -solaris1.*)\n\t\tos=`echo $os | sed -e 's|solaris1|sunos4|'`\n\t\t;;\n\t-solaris)\n\t\tos=-solaris2\n\t\t;;\n\t-svr4*)\n\t\tos=-sysv4\n\t\t;;\n\t-unixware*)\n\t\tos=-sysv4.2uw\n\t\t;;\n\t-gnu/linux*)\n\t\tos=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`\n\t\t;;\n\t# First accept the basic system types.\n\t# The portable systems comes first.\n\t# Each alternative MUST END IN A *, to match a version number.\n\t# -sysv* is not here because it comes later, after sysvr4.\n\t-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \\\n\t      | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\\\n\t      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \\\n\t      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \\\n\t      | -aos* \\\n\t      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \\\n\t      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \\\n\t      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \\\n\t      | -openbsd* | -solidbsd* \\\n\t      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \\\n\t      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \\\n\t      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \\\n\t      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \\\n\t      | -chorusos* | -chorusrdb* \\\n\t      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \\\n\t      | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \\\n\t      | -uxpv* | -beos* | -mpeix* | -udk* \\\n\t      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \\\n\t      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \\\n\t      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \\\n\t      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \\\n\t      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \\\n\t      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \\\n\t      | -skyos* | -haiku* | -rdos* | -toppers* | -drops*)\n\t# Remember, each alternative MUST END IN *, to match a version number.\n\t\t;;\n\t-qnx*)\n\t\tcase $basic_machine in\n\t\t    x86-* | i*86-*)\n\t\t\t;;\n\t\t    *)\n\t\t\tos=-nto$os\n\t\t\t;;\n\t\tesac\n\t\t;;\n\t-nto-qnx*)\n\t\t;;\n\t-nto*)\n\t\tos=`echo $os | sed -e 's|nto|nto-qnx|'`\n\t\t;;\n\t-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \\\n\t      | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \\\n\t      | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)\n\t\t;;\n\t-mac*)\n\t\tos=`echo $os | sed -e 's|mac|macos|'`\n\t\t;;\n\t-linux-dietlibc)\n\t\tos=-linux-dietlibc\n\t\t;;\n\t-linux*)\n\t\tos=`echo $os | sed -e 's|linux|linux-gnu|'`\n\t\t;;\n\t-sunos5*)\n\t\tos=`echo $os | sed -e 's|sunos5|solaris2|'`\n\t\t;;\n\t-sunos6*)\n\t\tos=`echo $os | sed -e 's|sunos6|solaris3|'`\n\t\t;;\n\t-opened*)\n\t\tos=-openedition\n\t\t;;\n        -os400*)\n\t\tos=-os400\n\t\t;;\n\t-wince*)\n\t\tos=-wince\n\t\t;;\n\t-osfrose*)\n\t\tos=-osfrose\n\t\t;;\n\t-osf*)\n\t\tos=-osf\n\t\t;;\n\t-utek*)\n\t\tos=-bsd\n\t\t;;\n\t-dynix*)\n\t\tos=-bsd\n\t\t;;\n\t-acis*)\n\t\tos=-aos\n\t\t;;\n\t-atheos*)\n\t\tos=-atheos\n\t\t;;\n\t-syllable*)\n\t\tos=-syllable\n\t\t;;\n\t-386bsd)\n\t\tos=-bsd\n\t\t;;\n\t-ctix* | -uts*)\n\t\tos=-sysv\n\t\t;;\n\t-nova*)\n\t\tos=-rtmk-nova\n\t\t;;\n\t-ns2 )\n\t\tos=-nextstep2\n\t\t;;\n\t-nsk*)\n\t\tos=-nsk\n\t\t;;\n\t# Preserve the version number of sinix5.\n\t-sinix5.*)\n\t\tos=`echo $os | sed -e 's|sinix|sysv|'`\n\t\t;;\n\t-sinix*)\n\t\tos=-sysv4\n\t\t;;\n        -tpf*)\n\t\tos=-tpf\n\t\t;;\n\t-triton*)\n\t\tos=-sysv3\n\t\t;;\n\t-oss*)\n\t\tos=-sysv3\n\t\t;;\n\t-svr4)\n\t\tos=-sysv4\n\t\t;;\n\t-svr3)\n\t\tos=-sysv3\n\t\t;;\n\t-sysvr4)\n\t\tos=-sysv4\n\t\t;;\n\t# This must come after -sysvr4.\n\t-sysv*)\n\t\t;;\n\t-ose*)\n\t\tos=-ose\n\t\t;;\n\t-es1800*)\n\t\tos=-ose\n\t\t;;\n\t-xenix)\n\t\tos=-xenix\n\t\t;;\n\t-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)\n\t\tos=-mint\n\t\t;;\n\t-aros*)\n\t\tos=-aros\n\t\t;;\n\t-kaos*)\n\t\tos=-kaos\n\t\t;;\n\t-zvmoe)\n\t\tos=-zvmoe\n\t\t;;\n\t-none)\n\t\t;;\n\t*)\n\t\t# Get rid of the `-' at the beginning of $os.\n\t\tos=`echo $os | sed 's/[^-]*-//'`\n\t\techo Invalid configuration \\`$1\\': system \\`$os\\' not recognized 1>&2\n\t\texit 1\n\t\t;;\nesac\nelse\n\n# Here we handle the default operating systems that come with various machines.\n# The value should be what the vendor currently ships out the door with their\n# machine or put another way, the most popular os provided with the machine.\n\n# Note that if you're going to try to match \"-MANUFACTURER\" here (say,\n# \"-sun\"), then you have to tell the case statement up towards the top\n# that MANUFACTURER isn't an operating system.  Otherwise, code above\n# will signal an error saying that MANUFACTURER isn't an operating\n# system, and we'll never get to this point.\n\ncase $basic_machine in\n        score-*)\n\t\tos=-elf\n\t\t;;\n        spu-*)\n\t\tos=-elf\n\t\t;;\n\t*-acorn)\n\t\tos=-riscix1.2\n\t\t;;\n\tarm*-rebel)\n\t\tos=-linux\n\t\t;;\n\tarm*-semi)\n\t\tos=-aout\n\t\t;;\n        c4x-* | tic4x-*)\n        \tos=-coff\n\t\t;;\n\t# This must come before the *-dec entry.\n\tpdp10-*)\n\t\tos=-tops20\n\t\t;;\n\tpdp11-*)\n\t\tos=-none\n\t\t;;\n\t*-dec | vax-*)\n\t\tos=-ultrix4.2\n\t\t;;\n\tm68*-apollo)\n\t\tos=-domain\n\t\t;;\n\ti386-sun)\n\t\tos=-sunos4.0.2\n\t\t;;\n\tm68000-sun)\n\t\tos=-sunos3\n\t\t# This also exists in the configure program, but was not the\n\t\t# default.\n\t\t# os=-sunos4\n\t\t;;\n\tm68*-cisco)\n\t\tos=-aout\n\t\t;;\n        mep-*)\n\t\tos=-elf\n\t\t;;\n\tmips*-cisco)\n\t\tos=-elf\n\t\t;;\n\tmips*-*)\n\t\tos=-elf\n\t\t;;\n\tor32-*)\n\t\tos=-coff\n\t\t;;\n\t*-tti)\t# must be before sparc entry or we get the wrong os.\n\t\tos=-sysv3\n\t\t;;\n\tsparc-* | *-sun)\n\t\tos=-sunos4.1.1\n\t\t;;\n\t*-be)\n\t\tos=-beos\n\t\t;;\n\t*-haiku)\n\t\tos=-haiku\n\t\t;;\n\t*-ibm)\n\t\tos=-aix\n\t\t;;\n    \t*-knuth)\n\t\tos=-mmixware\n\t\t;;\n\t*-wec)\n\t\tos=-proelf\n\t\t;;\n\t*-winbond)\n\t\tos=-proelf\n\t\t;;\n\t*-oki)\n\t\tos=-proelf\n\t\t;;\n\t*-hp)\n\t\tos=-hpux\n\t\t;;\n\t*-hitachi)\n\t\tos=-hiux\n\t\t;;\n\ti860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)\n\t\tos=-sysv\n\t\t;;\n\t*-cbm)\n\t\tos=-amigaos\n\t\t;;\n\t*-dg)\n\t\tos=-dgux\n\t\t;;\n\t*-dolphin)\n\t\tos=-sysv3\n\t\t;;\n\tm68k-ccur)\n\t\tos=-rtu\n\t\t;;\n\tm88k-omron*)\n\t\tos=-luna\n\t\t;;\n\t*-next )\n\t\tos=-nextstep\n\t\t;;\n\t*-sequent)\n\t\tos=-ptx\n\t\t;;\n\t*-crds)\n\t\tos=-unos\n\t\t;;\n\t*-ns)\n\t\tos=-genix\n\t\t;;\n\ti370-*)\n\t\tos=-mvs\n\t\t;;\n\t*-next)\n\t\tos=-nextstep3\n\t\t;;\n\t*-gould)\n\t\tos=-sysv\n\t\t;;\n\t*-highlevel)\n\t\tos=-bsd\n\t\t;;\n\t*-encore)\n\t\tos=-bsd\n\t\t;;\n\t*-sgi)\n\t\tos=-irix\n\t\t;;\n\t*-siemens)\n\t\tos=-sysv4\n\t\t;;\n\t*-masscomp)\n\t\tos=-rtu\n\t\t;;\n\tf30[01]-fujitsu | f700-fujitsu)\n\t\tos=-uxpv\n\t\t;;\n\t*-rom68k)\n\t\tos=-coff\n\t\t;;\n\t*-*bug)\n\t\tos=-coff\n\t\t;;\n\t*-apple)\n\t\tos=-macos\n\t\t;;\n\t*-atari*)\n\t\tos=-mint\n\t\t;;\n\t*)\n\t\tos=-none\n\t\t;;\nesac\nfi\n\n# Here we handle the case where we know the os, and the CPU type, but not the\n# manufacturer.  We pick the logical manufacturer.\nvendor=unknown\ncase $basic_machine in\n\t*-unknown)\n\t\tcase $os in\n\t\t\t-riscix*)\n\t\t\t\tvendor=acorn\n\t\t\t\t;;\n\t\t\t-sunos*)\n\t\t\t\tvendor=sun\n\t\t\t\t;;\n\t\t\t-aix*)\n\t\t\t\tvendor=ibm\n\t\t\t\t;;\n\t\t\t-beos*)\n\t\t\t\tvendor=be\n\t\t\t\t;;\n\t\t\t-hpux*)\n\t\t\t\tvendor=hp\n\t\t\t\t;;\n\t\t\t-mpeix*)\n\t\t\t\tvendor=hp\n\t\t\t\t;;\n\t\t\t-hiux*)\n\t\t\t\tvendor=hitachi\n\t\t\t\t;;\n\t\t\t-unos*)\n\t\t\t\tvendor=crds\n\t\t\t\t;;\n\t\t\t-dgux*)\n\t\t\t\tvendor=dg\n\t\t\t\t;;\n\t\t\t-luna*)\n\t\t\t\tvendor=omron\n\t\t\t\t;;\n\t\t\t-genix*)\n\t\t\t\tvendor=ns\n\t\t\t\t;;\n\t\t\t-mvs* | -opened*)\n\t\t\t\tvendor=ibm\n\t\t\t\t;;\n\t\t\t-os400*)\n\t\t\t\tvendor=ibm\n\t\t\t\t;;\n\t\t\t-ptx*)\n\t\t\t\tvendor=sequent\n\t\t\t\t;;\n\t\t\t-tpf*)\n\t\t\t\tvendor=ibm\n\t\t\t\t;;\n\t\t\t-vxsim* | -vxworks* | -windiss*)\n\t\t\t\tvendor=wrs\n\t\t\t\t;;\n\t\t\t-aux*)\n\t\t\t\tvendor=apple\n\t\t\t\t;;\n\t\t\t-hms*)\n\t\t\t\tvendor=hitachi\n\t\t\t\t;;\n\t\t\t-mpw* | -macos*)\n\t\t\t\tvendor=apple\n\t\t\t\t;;\n\t\t\t-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)\n\t\t\t\tvendor=atari\n\t\t\t\t;;\n\t\t\t-vos*)\n\t\t\t\tvendor=stratus\n\t\t\t\t;;\n\t\tesac\n\t\tbasic_machine=`echo $basic_machine | sed \"s/unknown/$vendor/\"`\n\t\t;;\nesac\n\necho $basic_machine$os\nexit\n\n# Local variables:\n# eval: (add-hook 'write-file-hooks 'time-stamp)\n# time-stamp-start: \"timestamp='\"\n# time-stamp-format: \"%:y-%02m-%02d\"\n# time-stamp-end: \"'\"\n# End:\n"
  },
  {
    "path": "src/main/jni/tiff/config/depcomp",
    "content": "#! /bin/sh\n# depcomp - compile a program generating dependencies as side-effects\n\nscriptversion=2005-07-09.11\n\n# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.\n\n# This program is free software; you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation; either version 2, or (at your option)\n# any later version.\n\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n\n# You should have received a copy of the GNU General Public License\n# along with this program; if not, write to the Free Software\n# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\n# 02110-1301, USA.\n\n# As a special exception to the GNU General Public License, if you\n# distribute this file as part of a program that contains a\n# configuration script generated by Autoconf, you may include it under\n# the same distribution terms that you use for the rest of that program.\n\n# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.\n\ncase $1 in\n  '')\n     echo \"$0: No command.  Try \\`$0 --help' for more information.\" 1>&2\n     exit 1;\n     ;;\n  -h | --h*)\n    cat <<\\EOF\nUsage: depcomp [--help] [--version] PROGRAM [ARGS]\n\nRun PROGRAMS ARGS to compile a file, generating dependencies\nas side-effects.\n\nEnvironment variables:\n  depmode     Dependency tracking mode.\n  source      Source file read by `PROGRAMS ARGS'.\n  object      Object file output by `PROGRAMS ARGS'.\n  DEPDIR      directory where to store dependencies.\n  depfile     Dependency file to output.\n  tmpdepfile  Temporary file to use when outputing dependencies.\n  libtool     Whether libtool is used (yes/no).\n\nReport bugs to <bug-automake@gnu.org>.\nEOF\n    exit $?\n    ;;\n  -v | --v*)\n    echo \"depcomp $scriptversion\"\n    exit $?\n    ;;\nesac\n\nif test -z \"$depmode\" || test -z \"$source\" || test -z \"$object\"; then\n  echo \"depcomp: Variables source, object and depmode must be set\" 1>&2\n  exit 1\nfi\n\n# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.\ndepfile=${depfile-`echo \"$object\" |\n  sed 's|[^\\\\/]*$|'${DEPDIR-.deps}'/&|;s|\\.\\([^.]*\\)$|.P\\1|;s|Pobj$|Po|'`}\ntmpdepfile=${tmpdepfile-`echo \"$depfile\" | sed 's/\\.\\([^.]*\\)$/.T\\1/'`}\n\nrm -f \"$tmpdepfile\"\n\n# Some modes work just like other modes, but use different flags.  We\n# parameterize here, but still list the modes in the big case below,\n# to make depend.m4 easier to write.  Note that we *cannot* use a case\n# here, because this file can only contain one case statement.\nif test \"$depmode\" = hp; then\n  # HP compiler uses -M and no extra arg.\n  gccflag=-M\n  depmode=gcc\nfi\n\nif test \"$depmode\" = dashXmstdout; then\n   # This is just like dashmstdout with a different argument.\n   dashmflag=-xM\n   depmode=dashmstdout\nfi\n\ncase \"$depmode\" in\ngcc3)\n## gcc 3 implements dependency tracking that does exactly what\n## we want.  Yay!  Note: for some reason libtool 1.4 doesn't like\n## it if -MD -MP comes after the -MF stuff.  Hmm.\n  \"$@\" -MT \"$object\" -MD -MP -MF \"$tmpdepfile\"\n  stat=$?\n  if test $stat -eq 0; then :\n  else\n    rm -f \"$tmpdepfile\"\n    exit $stat\n  fi\n  mv \"$tmpdepfile\" \"$depfile\"\n  ;;\n\ngcc)\n## There are various ways to get dependency output from gcc.  Here's\n## why we pick this rather obscure method:\n## - Don't want to use -MD because we'd like the dependencies to end\n##   up in a subdir.  Having to rename by hand is ugly.\n##   (We might end up doing this anyway to support other compilers.)\n## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like\n##   -MM, not -M (despite what the docs say).\n## - Using -M directly means running the compiler twice (even worse\n##   than renaming).\n  if test -z \"$gccflag\"; then\n    gccflag=-MD,\n  fi\n  \"$@\" -Wp,\"$gccflag$tmpdepfile\"\n  stat=$?\n  if test $stat -eq 0; then :\n  else\n    rm -f \"$tmpdepfile\"\n    exit $stat\n  fi\n  rm -f \"$depfile\"\n  echo \"$object : \\\\\" > \"$depfile\"\n  alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\n## The second -e expression handles DOS-style file names with drive letters.\n  sed -e 's/^[^:]*: / /' \\\n      -e 's/^['$alpha']:\\/[^:]*: / /' < \"$tmpdepfile\" >> \"$depfile\"\n## This next piece of magic avoids the `deleted header file' problem.\n## The problem is that when a header file which appears in a .P file\n## is deleted, the dependency causes make to die (because there is\n## typically no way to rebuild the header).  We avoid this by adding\n## dummy dependencies for each header file.  Too bad gcc doesn't do\n## this for us directly.\n  tr ' ' '\n' < \"$tmpdepfile\" |\n## Some versions of gcc put a space before the `:'.  On the theory\n## that the space means something, we add a space to the output as\n## well.\n## Some versions of the HPUX 10.20 sed can't process this invocation\n## correctly.  Breaking it into two sed invocations is a workaround.\n    sed -e 's/^\\\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> \"$depfile\"\n  rm -f \"$tmpdepfile\"\n  ;;\n\nhp)\n  # This case exists only to let depend.m4 do its work.  It works by\n  # looking at the text of this script.  This case will never be run,\n  # since it is checked for above.\n  exit 1\n  ;;\n\nsgi)\n  if test \"$libtool\" = yes; then\n    \"$@\" \"-Wp,-MDupdate,$tmpdepfile\"\n  else\n    \"$@\" -MDupdate \"$tmpdepfile\"\n  fi\n  stat=$?\n  if test $stat -eq 0; then :\n  else\n    rm -f \"$tmpdepfile\"\n    exit $stat\n  fi\n  rm -f \"$depfile\"\n\n  if test -f \"$tmpdepfile\"; then  # yes, the sourcefile depend on other files\n    echo \"$object : \\\\\" > \"$depfile\"\n\n    # Clip off the initial element (the dependent).  Don't try to be\n    # clever and replace this with sed code, as IRIX sed won't handle\n    # lines with more than a fixed number of characters (4096 in\n    # IRIX 6.2 sed, 8192 in IRIX 6.5).  We also remove comment lines;\n    # the IRIX cc adds comments like `#:fec' to the end of the\n    # dependency line.\n    tr ' ' '\n' < \"$tmpdepfile\" \\\n    | sed -e 's/^.*\\.o://' -e 's/#.*$//' -e '/^$/ d' | \\\n    tr '\n' ' ' >> $depfile\n    echo >> $depfile\n\n    # The second pass generates a dummy entry for each header file.\n    tr ' ' '\n' < \"$tmpdepfile\" \\\n   | sed -e 's/^.*\\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \\\n   >> $depfile\n  else\n    # The sourcefile does not contain any dependencies, so just\n    # store a dummy comment line, to avoid errors with the Makefile\n    # \"include basename.Plo\" scheme.\n    echo \"#dummy\" > \"$depfile\"\n  fi\n  rm -f \"$tmpdepfile\"\n  ;;\n\naix)\n  # The C for AIX Compiler uses -M and outputs the dependencies\n  # in a .u file.  In older versions, this file always lives in the\n  # current directory.  Also, the AIX compiler puts `$object:' at the\n  # start of each line; $object doesn't have directory information.\n  # Version 6 uses the directory in both cases.\n  stripped=`echo \"$object\" | sed 's/\\(.*\\)\\..*$/\\1/'`\n  tmpdepfile=\"$stripped.u\"\n  if test \"$libtool\" = yes; then\n    \"$@\" -Wc,-M\n  else\n    \"$@\" -M\n  fi\n  stat=$?\n\n  if test -f \"$tmpdepfile\"; then :\n  else\n    stripped=`echo \"$stripped\" | sed 's,^.*/,,'`\n    tmpdepfile=\"$stripped.u\"\n  fi\n\n  if test $stat -eq 0; then :\n  else\n    rm -f \"$tmpdepfile\"\n    exit $stat\n  fi\n\n  if test -f \"$tmpdepfile\"; then\n    outname=\"$stripped.o\"\n    # Each line is of the form `foo.o: dependent.h'.\n    # Do two passes, one to just change these to\n    # `$object: dependent.h' and one to simply `dependent.h:'.\n    sed -e \"s,^$outname:,$object :,\" < \"$tmpdepfile\" > \"$depfile\"\n    sed -e \"s,^$outname: \\(.*\\)$,\\1:,\" < \"$tmpdepfile\" >> \"$depfile\"\n  else\n    # The sourcefile does not contain any dependencies, so just\n    # store a dummy comment line, to avoid errors with the Makefile\n    # \"include basename.Plo\" scheme.\n    echo \"#dummy\" > \"$depfile\"\n  fi\n  rm -f \"$tmpdepfile\"\n  ;;\n\nicc)\n  # Intel's C compiler understands `-MD -MF file'.  However on\n  #    icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c\n  # ICC 7.0 will fill foo.d with something like\n  #    foo.o: sub/foo.c\n  #    foo.o: sub/foo.h\n  # which is wrong.  We want:\n  #    sub/foo.o: sub/foo.c\n  #    sub/foo.o: sub/foo.h\n  #    sub/foo.c:\n  #    sub/foo.h:\n  # ICC 7.1 will output\n  #    foo.o: sub/foo.c sub/foo.h\n  # and will wrap long lines using \\ :\n  #    foo.o: sub/foo.c ... \\\n  #     sub/foo.h ... \\\n  #     ...\n\n  \"$@\" -MD -MF \"$tmpdepfile\"\n  stat=$?\n  if test $stat -eq 0; then :\n  else\n    rm -f \"$tmpdepfile\"\n    exit $stat\n  fi\n  rm -f \"$depfile\"\n  # Each line is of the form `foo.o: dependent.h',\n  # or `foo.o: dep1.h dep2.h \\', or ` dep3.h dep4.h \\'.\n  # Do two passes, one to just change these to\n  # `$object: dependent.h' and one to simply `dependent.h:'.\n  sed \"s,^[^:]*:,$object :,\" < \"$tmpdepfile\" > \"$depfile\"\n  # Some versions of the HPUX 10.20 sed can't process this invocation\n  # correctly.  Breaking it into two sed invocations is a workaround.\n  sed 's,^[^:]*: \\(.*\\)$,\\1,;s/^\\\\$//;/^$/d;/:$/d' < \"$tmpdepfile\" |\n    sed -e 's/$/ :/' >> \"$depfile\"\n  rm -f \"$tmpdepfile\"\n  ;;\n\ntru64)\n   # The Tru64 compiler uses -MD to generate dependencies as a side\n   # effect.  `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.\n   # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put\n   # dependencies in `foo.d' instead, so we check for that too.\n   # Subdirectories are respected.\n   dir=`echo \"$object\" | sed -e 's|/[^/]*$|/|'`\n   test \"x$dir\" = \"x$object\" && dir=\n   base=`echo \"$object\" | sed -e 's|^.*/||' -e 's/\\.o$//' -e 's/\\.lo$//'`\n\n   if test \"$libtool\" = yes; then\n      # With Tru64 cc, shared objects can also be used to make a\n      # static library.  This mecanism is used in libtool 1.4 series to\n      # handle both shared and static libraries in a single compilation.\n      # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.\n      #\n      # With libtool 1.5 this exception was removed, and libtool now\n      # generates 2 separate objects for the 2 libraries.  These two\n      # compilations output dependencies in in $dir.libs/$base.o.d and\n      # in $dir$base.o.d.  We have to check for both files, because\n      # one of the two compilations can be disabled.  We should prefer\n      # $dir$base.o.d over $dir.libs/$base.o.d because the latter is\n      # automatically cleaned when .libs/ is deleted, while ignoring\n      # the former would cause a distcleancheck panic.\n      tmpdepfile1=$dir.libs/$base.lo.d   # libtool 1.4\n      tmpdepfile2=$dir$base.o.d          # libtool 1.5\n      tmpdepfile3=$dir.libs/$base.o.d    # libtool 1.5\n      tmpdepfile4=$dir.libs/$base.d      # Compaq CCC V6.2-504\n      \"$@\" -Wc,-MD\n   else\n      tmpdepfile1=$dir$base.o.d\n      tmpdepfile2=$dir$base.d\n      tmpdepfile3=$dir$base.d\n      tmpdepfile4=$dir$base.d\n      \"$@\" -MD\n   fi\n\n   stat=$?\n   if test $stat -eq 0; then :\n   else\n      rm -f \"$tmpdepfile1\" \"$tmpdepfile2\" \"$tmpdepfile3\" \"$tmpdepfile4\"\n      exit $stat\n   fi\n\n   for tmpdepfile in \"$tmpdepfile1\" \"$tmpdepfile2\" \"$tmpdepfile3\" \"$tmpdepfile4\"\n   do\n     test -f \"$tmpdepfile\" && break\n   done\n   if test -f \"$tmpdepfile\"; then\n      sed -e \"s,^.*\\.[a-z]*:,$object:,\" < \"$tmpdepfile\" > \"$depfile\"\n      # That's a tab and a space in the [].\n      sed -e 's,^.*\\.[a-z]*:[\t ]*,,' -e 's,$,:,' < \"$tmpdepfile\" >> \"$depfile\"\n   else\n      echo \"#dummy\" > \"$depfile\"\n   fi\n   rm -f \"$tmpdepfile\"\n   ;;\n\n#nosideeffect)\n  # This comment above is used by automake to tell side-effect\n  # dependency tracking mechanisms from slower ones.\n\ndashmstdout)\n  # Important note: in order to support this mode, a compiler *must*\n  # always write the preprocessed file to stdout, regardless of -o.\n  \"$@\" || exit $?\n\n  # Remove the call to Libtool.\n  if test \"$libtool\" = yes; then\n    while test $1 != '--mode=compile'; do\n      shift\n    done\n    shift\n  fi\n\n  # Remove `-o $object'.\n  IFS=\" \"\n  for arg\n  do\n    case $arg in\n    -o)\n      shift\n      ;;\n    $object)\n      shift\n      ;;\n    *)\n      set fnord \"$@\" \"$arg\"\n      shift # fnord\n      shift # $arg\n      ;;\n    esac\n  done\n\n  test -z \"$dashmflag\" && dashmflag=-M\n  # Require at least two characters before searching for `:'\n  # in the target name.  This is to cope with DOS-style filenames:\n  # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.\n  \"$@\" $dashmflag |\n    sed 's:^[  ]*[^: ][^:][^:]*\\:[    ]*:'\"$object\"'\\: :' > \"$tmpdepfile\"\n  rm -f \"$depfile\"\n  cat < \"$tmpdepfile\" > \"$depfile\"\n  tr ' ' '\n' < \"$tmpdepfile\" | \\\n## Some versions of the HPUX 10.20 sed can't process this invocation\n## correctly.  Breaking it into two sed invocations is a workaround.\n    sed -e 's/^\\\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> \"$depfile\"\n  rm -f \"$tmpdepfile\"\n  ;;\n\ndashXmstdout)\n  # This case only exists to satisfy depend.m4.  It is never actually\n  # run, as this mode is specially recognized in the preamble.\n  exit 1\n  ;;\n\nmakedepend)\n  \"$@\" || exit $?\n  # Remove any Libtool call\n  if test \"$libtool\" = yes; then\n    while test $1 != '--mode=compile'; do\n      shift\n    done\n    shift\n  fi\n  # X makedepend\n  shift\n  cleared=no\n  for arg in \"$@\"; do\n    case $cleared in\n    no)\n      set \"\"; shift\n      cleared=yes ;;\n    esac\n    case \"$arg\" in\n    -D*|-I*)\n      set fnord \"$@\" \"$arg\"; shift ;;\n    # Strip any option that makedepend may not understand.  Remove\n    # the object too, otherwise makedepend will parse it as a source file.\n    -*|$object)\n      ;;\n    *)\n      set fnord \"$@\" \"$arg\"; shift ;;\n    esac\n  done\n  obj_suffix=\"`echo $object | sed 's/^.*\\././'`\"\n  touch \"$tmpdepfile\"\n  ${MAKEDEPEND-makedepend} -o\"$obj_suffix\" -f\"$tmpdepfile\" \"$@\"\n  rm -f \"$depfile\"\n  cat < \"$tmpdepfile\" > \"$depfile\"\n  sed '1,2d' \"$tmpdepfile\" | tr ' ' '\n' | \\\n## Some versions of the HPUX 10.20 sed can't process this invocation\n## correctly.  Breaking it into two sed invocations is a workaround.\n    sed -e 's/^\\\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> \"$depfile\"\n  rm -f \"$tmpdepfile\" \"$tmpdepfile\".bak\n  ;;\n\ncpp)\n  # Important note: in order to support this mode, a compiler *must*\n  # always write the preprocessed file to stdout.\n  \"$@\" || exit $?\n\n  # Remove the call to Libtool.\n  if test \"$libtool\" = yes; then\n    while test $1 != '--mode=compile'; do\n      shift\n    done\n    shift\n  fi\n\n  # Remove `-o $object'.\n  IFS=\" \"\n  for arg\n  do\n    case $arg in\n    -o)\n      shift\n      ;;\n    $object)\n      shift\n      ;;\n    *)\n      set fnord \"$@\" \"$arg\"\n      shift # fnord\n      shift # $arg\n      ;;\n    esac\n  done\n\n  \"$@\" -E |\n    sed -n -e '/^# [0-9][0-9]* \"\\([^\"]*\\)\".*/ s:: \\1 \\\\:p' \\\n       -e '/^#line [0-9][0-9]* \"\\([^\"]*\\)\".*/ s:: \\1 \\\\:p' |\n    sed '$ s: \\\\$::' > \"$tmpdepfile\"\n  rm -f \"$depfile\"\n  echo \"$object : \\\\\" > \"$depfile\"\n  cat < \"$tmpdepfile\" >> \"$depfile\"\n  sed < \"$tmpdepfile\" '/^$/d;s/^ //;s/ \\\\$//;s/$/ :/' >> \"$depfile\"\n  rm -f \"$tmpdepfile\"\n  ;;\n\nmsvisualcpp)\n  # Important note: in order to support this mode, a compiler *must*\n  # always write the preprocessed file to stdout, regardless of -o,\n  # because we must use -o when running libtool.\n  \"$@\" || exit $?\n  IFS=\" \"\n  for arg\n  do\n    case \"$arg\" in\n    \"-Gm\"|\"/Gm\"|\"-Gi\"|\"/Gi\"|\"-ZI\"|\"/ZI\")\n\tset fnord \"$@\"\n\tshift\n\tshift\n\t;;\n    *)\n\tset fnord \"$@\" \"$arg\"\n\tshift\n\tshift\n\t;;\n    esac\n  done\n  \"$@\" -E |\n  sed -n '/^#line [0-9][0-9]* \"\\([^\"]*\\)\"/ s::echo \"`cygpath -u \\\\\"\\1\\\\\"`\":p' | sort | uniq > \"$tmpdepfile\"\n  rm -f \"$depfile\"\n  echo \"$object : \\\\\" > \"$depfile\"\n  . \"$tmpdepfile\" | sed 's% %\\\\ %g' | sed -n '/^\\(.*\\)$/ s::\t\\1 \\\\:p' >> \"$depfile\"\n  echo \"\t\" >> \"$depfile\"\n  . \"$tmpdepfile\" | sed 's% %\\\\ %g' | sed -n '/^\\(.*\\)$/ s::\\1\\::p' >> \"$depfile\"\n  rm -f \"$tmpdepfile\"\n  ;;\n\nnone)\n  exec \"$@\"\n  ;;\n\n*)\n  echo \"Unknown depmode $depmode\" 1>&2\n  exit 1\n  ;;\nesac\n\nexit 0\n\n# Local Variables:\n# mode: shell-script\n# sh-indentation: 2\n# eval: (add-hook 'write-file-hooks 'time-stamp)\n# time-stamp-start: \"scriptversion=\"\n# time-stamp-format: \"%:y-%02m-%02d.%02H\"\n# time-stamp-end: \"$\"\n# End:\n"
  },
  {
    "path": "src/main/jni/tiff/config/install-sh",
    "content": "#!/bin/sh\n# install - install a program, script, or datafile\n\nscriptversion=2005-11-07.23\n\n# This originates from X11R5 (mit/util/scripts/install.sh), which was\n# later released in X11R6 (xc/config/util/install.sh) with the\n# following copyright and license.\n#\n# Copyright (C) 1994 X Consortium\n#\n# Permission is hereby granted, free of charge, to any person obtaining a copy\n# of this software and associated documentation files (the \"Software\"), to\n# deal in the Software without restriction, including without limitation the\n# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or\n# sell copies of the Software, and to permit persons to whom the Software is\n# furnished to do so, subject to the following conditions:\n#\n# The above copyright notice and this permission notice shall be included in\n# all copies or substantial portions of the Software.\n#\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE\n# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN\n# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-\n# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n#\n# Except as contained in this notice, the name of the X Consortium shall not\n# be used in advertising or otherwise to promote the sale, use or other deal-\n# ings in this Software without prior written authorization from the X Consor-\n# tium.\n#\n#\n# FSF changes to this file are in the public domain.\n#\n# Calling this script install-sh is preferred over install.sh, to prevent\n# `make' implicit rules from creating a file called install from it\n# when there is no Makefile.\n#\n# This script is compatible with the BSD install script, but was written\n# from scratch.  It can only install one file at a time, a restriction\n# shared with many OS's install programs.\n\n# set DOITPROG to echo to test this script\n\n# Don't use :- since 4.3BSD and earlier shells don't like it.\ndoit=\"${DOITPROG-}\"\n\n# put in absolute paths if you don't have them in your path; or use env. vars.\n\nmvprog=\"${MVPROG-mv}\"\ncpprog=\"${CPPROG-cp}\"\nchmodprog=\"${CHMODPROG-chmod}\"\nchownprog=\"${CHOWNPROG-chown}\"\nchgrpprog=\"${CHGRPPROG-chgrp}\"\nstripprog=\"${STRIPPROG-strip}\"\nrmprog=\"${RMPROG-rm}\"\nmkdirprog=\"${MKDIRPROG-mkdir}\"\n\nposix_glob=\nposix_mkdir=\n\n# Symbolic mode for testing mkdir with directories.\n# It is the same as 755, but also tests that \"u+\" works.\ntest_mode=u=rwx,g=rx,o=rx,u+wx\n\n# Desired mode of installed file.\nmode=0755\n\n# Desired mode of newly created intermediate directories.\n# It is empty if not known yet.\nintermediate_mode=\n\nchmodcmd=$chmodprog\nchowncmd=\nchgrpcmd=\nstripcmd=\nrmcmd=\"$rmprog -f\"\nmvcmd=\"$mvprog\"\nsrc=\ndst=\ndir_arg=\ndstarg=\nno_target_directory=\n\nusage=\"Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE\n   or: $0 [OPTION]... SRCFILES... DIRECTORY\n   or: $0 [OPTION]... -t DIRECTORY SRCFILES...\n   or: $0 [OPTION]... -d DIRECTORIES...\n\nIn the 1st form, copy SRCFILE to DSTFILE.\nIn the 2nd and 3rd, copy all SRCFILES to DIRECTORY.\nIn the 4th, create DIRECTORIES.\n\nOptions:\n-c         (ignored)\n-d         create directories instead of installing files.\n-g GROUP   $chgrpprog installed files to GROUP.\n-m MODE    $chmodprog installed files to MODE.\n-o USER    $chownprog installed files to USER.\n-s         $stripprog installed files.\n-t DIRECTORY  install into DIRECTORY.\n-T         report an error if DSTFILE is a directory.\n--help     display this help and exit.\n--version  display version info and exit.\n\nEnvironment variables override the default commands:\n  CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG\n\"\n\nwhile test -n \"$1\"; do\n  case $1 in\n    -c) shift\n        continue;;\n\n    -d) dir_arg=true\n        shift\n        continue;;\n\n    -g) chgrpcmd=\"$chgrpprog $2\"\n        shift\n        shift\n        continue;;\n\n    --help) echo \"$usage\"; exit $?;;\n\n    -m) mode=$2\n        shift\n        shift\n        continue;;\n\n    -o) chowncmd=\"$chownprog $2\"\n        shift\n        shift\n        continue;;\n\n    -s) stripcmd=$stripprog\n        shift\n        continue;;\n\n    -t) dstarg=$2\n\tshift\n\tshift\n\tcontinue;;\n\n    -T) no_target_directory=true\n\tshift\n\tcontinue;;\n\n    --version) echo \"$0 $scriptversion\"; exit $?;;\n\n    *)  # When -d is used, all remaining arguments are directories to create.\n\t# When -t is used, the destination is already specified.\n\ttest -n \"$dir_arg$dstarg\" && break\n        # Otherwise, the last argument is the destination.  Remove it from $@.\n\tfor arg\n\tdo\n          if test -n \"$dstarg\"; then\n\t    # $@ is not empty: it contains at least $arg.\n\t    set fnord \"$@\" \"$dstarg\"\n\t    shift # fnord\n\t  fi\n\t  shift # arg\n\t  dstarg=$arg\n\tdone\n\tbreak;;\n  esac\ndone\n\nif test -z \"$1\"; then\n  if test -z \"$dir_arg\"; then\n    echo \"$0: no input file specified.\" >&2\n    exit 1\n  fi\n  # It's OK to call `install-sh -d' without argument.\n  # This can happen when creating conditional directories.\n  exit 0\nfi\n\ntest -n \"$dir_arg\" || trap '(exit $?); exit' 1 2 13 15\n\nfor src\ndo\n  # Protect names starting with `-'.\n  case $src in\n    -*) src=./$src ;;\n  esac\n\n  if test -n \"$dir_arg\"; then\n    dst=$src\n    dstdir=$dst\n    test -d \"$dstdir\"\n    dstdir_status=$?\n  else\n\n    # Waiting for this to be detected by the \"$cpprog $src $dsttmp\" command\n    # might cause directories to be created, which would be especially bad\n    # if $src (and thus $dsttmp) contains '*'.\n    if test ! -f \"$src\" && test ! -d \"$src\"; then\n      echo \"$0: $src does not exist.\" >&2\n      exit 1\n    fi\n\n    if test -z \"$dstarg\"; then\n      echo \"$0: no destination specified.\" >&2\n      exit 1\n    fi\n\n    dst=$dstarg\n    # Protect names starting with `-'.\n    case $dst in\n      -*) dst=./$dst ;;\n    esac\n\n    # If destination is a directory, append the input filename; won't work\n    # if double slashes aren't ignored.\n    if test -d \"$dst\"; then\n      if test -n \"$no_target_directory\"; then\n\techo \"$0: $dstarg: Is a directory\" >&2\n\texit 1\n      fi\n      dstdir=$dst\n      dst=$dstdir/`basename \"$src\"`\n      dstdir_status=0\n    else\n      # Prefer dirname, but fall back on a substitute if dirname fails.\n      dstdir=`\n\t(dirname \"$dst\") 2>/dev/null ||\n\texpr X\"$dst\" : 'X\\(.*[^/]\\)//*[^/][^/]*/*$' \\| \\\n\t     X\"$dst\" : 'X\\(//\\)[^/]' \\| \\\n\t     X\"$dst\" : 'X\\(//\\)$' \\| \\\n\t     X\"$dst\" : 'X\\(/\\)' \\| \\\n\t     .       : '\\(.\\)' 2>/dev/null ||\n\techo X\"$dst\" |\n\t    sed '/^X\\(.*[^/]\\)\\/\\/*[^/][^/]*\\/*$/{ s//\\1/; q; }\n\t\t  /^X\\(\\/\\/\\)[^/].*/{ s//\\1/; q; }\n\t\t  /^X\\(\\/\\/\\)$/{ s//\\1/; q; }\n\t\t  /^X\\(\\/\\).*/{ s//\\1/; q; }\n\t\t  s/.*/./; q'\n      `\n\n      test -d \"$dstdir\"\n      dstdir_status=$?\n    fi\n  fi\n\n  obsolete_mkdir_used=false\n\n  if test $dstdir_status != 0; then\n    case $posix_mkdir in\n      '')\n\tposix_mkdir=false\n\tif $mkdirprog -m $test_mode -p -- / >/dev/null 2>&1; then\n\t  posix_mkdir=true\n\telse\n\t  # Remove any dirs left behind by ancient mkdir implementations.\n\t  rmdir ./-m \"$test_mode\" ./-p ./-- 2>/dev/null\n\tfi ;;\n    esac\n\n    if\n      $posix_mkdir && {\n\n\t# With -d, create the new directory with the user-specified mode.\n\t# Otherwise, create it using the same intermediate mode that\n\t# mkdir -p would use when creating intermediate directories.\n\t# POSIX says that this mode is \"$(umask -S),u+wx\", so use that\n\t# if umask -S works.\n\n\tif test -n \"$dir_arg\"; then\n\t  mkdir_mode=$mode\n\telse\n\t  case $intermediate_mode in\n\t    '')\n\t      if umask_S=`(umask -S) 2>/dev/null`; then\n\t\tintermediate_mode=$umask_S,u+wx\n\t      else\n\t\tintermediate_mode=$test_mode\n\t      fi ;;\n\t  esac\n\t  mkdir_mode=$intermediate_mode\n\tfi\n\n\t$mkdirprog -m \"$mkdir_mode\" -p -- \"$dstdir\"\n      }\n    then :\n    else\n\n      # mkdir does not conform to POSIX, or it failed possibly due to\n      # a race condition.  Create the directory the slow way, step by\n      # step, checking for races as we go.\n\n      case $dstdir in\n\t/*) pathcomp=/ ;;\n\t-*) pathcomp=./ ;;\n\t*)  pathcomp= ;;\n      esac\n\n      case $posix_glob in\n        '')\n\t  if (set -f) 2>/dev/null; then\n\t    posix_glob=true\n\t  else\n\t    posix_glob=false\n\t  fi ;;\n      esac\n\n      oIFS=$IFS\n      IFS=/\n      $posix_glob && set -f\n      set fnord $dstdir\n      shift\n      $posix_glob && set +f\n      IFS=$oIFS\n\n      for d\n      do\n\ttest \"x$d\" = x && continue\n\n\tpathcomp=$pathcomp$d\n\tif test ! -d \"$pathcomp\"; then\n\t  $mkdirprog \"$pathcomp\"\n\t  # Don't fail if two instances are running concurrently.\n\t  test -d \"$pathcomp\" || exit 1\n\tfi\n\tpathcomp=$pathcomp/\n      done\n      obsolete_mkdir_used=true\n    fi\n  fi\n\n  if test -n \"$dir_arg\"; then\n    { test -z \"$chowncmd\" || $doit $chowncmd \"$dst\"; } &&\n    { test -z \"$chgrpcmd\" || $doit $chgrpcmd \"$dst\"; } &&\n    { test \"$obsolete_mkdir_used$chowncmd$chgrpcmd\" = false ||\n      test -z \"$chmodcmd\" || $doit $chmodcmd \"$mode\" \"$dst\"; } || exit 1\n  else\n\n    # Make a couple of temp file names in the proper directory.\n    dsttmp=$dstdir/_inst.$$_\n    rmtmp=$dstdir/_rm.$$_\n\n    # Trap to clean up those temp files at exit.\n    trap 'ret=$?; rm -f \"$dsttmp\" \"$rmtmp\" && exit $ret' 0\n\n    # Copy the file name to the temp name.\n    $doit $cpprog \"$src\" \"$dsttmp\" &&\n\n    # and set any options; do chmod last to preserve setuid bits.\n    #\n    # If any of these fail, we abort the whole thing.  If we want to\n    # ignore errors from any of these, just make sure not to ignore\n    # errors from the above \"$doit $cpprog $src $dsttmp\" command.\n    #\n    { test -z \"$chowncmd\" || $doit $chowncmd \"$dsttmp\"; } \\\n      && { test -z \"$chgrpcmd\" || $doit $chgrpcmd \"$dsttmp\"; } \\\n      && { test -z \"$stripcmd\" || $doit $stripcmd \"$dsttmp\"; } \\\n      && { test -z \"$chmodcmd\" || $doit $chmodcmd \"$mode\" \"$dsttmp\"; } &&\n\n    # Now rename the file to the real destination.\n    { $doit $mvcmd -f \"$dsttmp\" \"$dst\" 2>/dev/null \\\n      || {\n\t   # The rename failed, perhaps because mv can't rename something else\n\t   # to itself, or perhaps because mv is so ancient that it does not\n\t   # support -f.\n\n\t   # Now remove or move aside any old file at destination location.\n\t   # We try this two ways since rm can't unlink itself on some\n\t   # systems and the destination file might be busy for other\n\t   # reasons.  In this case, the final cleanup might fail but the new\n\t   # file should still install successfully.\n\t   {\n\t     if test -f \"$dst\"; then\n\t       $doit $rmcmd -f \"$dst\" 2>/dev/null \\\n\t       || { $doit $mvcmd -f \"$dst\" \"$rmtmp\" 2>/dev/null \\\n\t\t     && { $doit $rmcmd -f \"$rmtmp\" 2>/dev/null; :; }; }\\\n\t       || {\n\t\t echo \"$0: cannot unlink or rename $dst\" >&2\n\t\t (exit 1); exit 1\n\t       }\n\t     else\n\t       :\n\t     fi\n\t   } &&\n\n\t   # Now rename the file to the real destination.\n\t   $doit $mvcmd \"$dsttmp\" \"$dst\"\n\t }\n    } || exit 1\n\n    trap '' 0\n  fi\ndone\n\n# Local variables:\n# eval: (add-hook 'write-file-hooks 'time-stamp)\n# time-stamp-start: \"scriptversion=\"\n# time-stamp-format: \"%:y-%02m-%02d.%02H\"\n# time-stamp-end: \"$\"\n# End:\n"
  },
  {
    "path": "src/main/jni/tiff/config/ltmain.sh",
    "content": "# Generated from ltmain.m4sh.\n\n# ltmain.sh (GNU libtool) 2.2.6\n# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996\n\n# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc.\n# This is free software; see the source for copying conditions.  There is NO\n# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n# GNU Libtool is free software; you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation; either version 2 of the License, or\n# (at your option) any later version.\n#\n# As a special exception to the GNU General Public License,\n# if you distribute this file as part of a program or library that\n# is built using GNU Libtool, you may include this file under the\n# same distribution terms that you use for the rest of that program.\n#\n# GNU Libtool is distributed in the hope that it will be useful, but\n# WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n# General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with GNU Libtool; see the file COPYING.  If not, a copy\n# can be downloaded from http://www.gnu.org/licenses/gpl.html,\n# or obtained by writing to the Free Software Foundation, Inc.,\n# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n\n# Usage: $progname [OPTION]... [MODE-ARG]...\n#\n# Provide generalized library-building support services.\n#\n#     --config             show all configuration variables\n#     --debug              enable verbose shell tracing\n# -n, --dry-run            display commands without modifying any files\n#     --features           display basic configuration information and exit\n#     --mode=MODE          use operation mode MODE\n#     --preserve-dup-deps  don't remove duplicate dependency libraries\n#     --quiet, --silent    don't print informational messages\n#     --tag=TAG            use configuration variables from tag TAG\n# -v, --verbose            print informational messages (default)\n#     --version            print version information\n# -h, --help               print short or long help message\n#\n# MODE must be one of the following:\n#\n#       clean              remove files from the build directory\n#       compile            compile a source file into a libtool object\n#       execute            automatically set library path, then run a program\n#       finish             complete the installation of libtool libraries\n#       install            install libraries or executables\n#       link               create a library or an executable\n#       uninstall          remove libraries from an installed directory\n#\n# MODE-ARGS vary depending on the MODE.\n# Try `$progname --help --mode=MODE' for a more detailed description of MODE.\n#\n# When reporting a bug, please describe a test case to reproduce it and\n# include the following information:\n#\n#       host-triplet:\t$host\n#       shell:\t\t$SHELL\n#       compiler:\t\t$LTCC\n#       compiler flags:\t\t$LTCFLAGS\n#       linker:\t\t$LD (gnu? $with_gnu_ld)\n#       $progname:\t\t(GNU libtool) 2.2.6\n#       automake:\t\t$automake_version\n#       autoconf:\t\t$autoconf_version\n#\n# Report bugs to <bug-libtool@gnu.org>.\n\nPROGRAM=ltmain.sh\nPACKAGE=libtool\nVERSION=2.2.6\nTIMESTAMP=\"\"\npackage_revision=1.3012\n\n# Be Bourne compatible\nif test -n \"${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then\n  emulate sh\n  NULLCMD=:\n  # Zsh 3.x and 4.x performs word splitting on ${1+\"$@\"}, which\n  # is contrary to our usage.  Disable this feature.\n  alias -g '${1+\"$@\"}'='\"$@\"'\n  setopt NO_GLOB_SUBST\nelse\n  case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac\nfi\nBIN_SH=xpg4; export BIN_SH # for Tru64\nDUALCASE=1; export DUALCASE # for MKS sh\n\n# NLS nuisances: We save the old values to restore during execute mode.\n# Only set LANG and LC_ALL to C if already set.\n# These must not be set unconditionally because not all systems understand\n# e.g. LANG=C (notably SCO).\nlt_user_locale=\nlt_safe_locale=\nfor lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES\ndo\n  eval \"if test \\\"\\${$lt_var+set}\\\" = set; then\n          save_$lt_var=\\$$lt_var\n          $lt_var=C\n\t  export $lt_var\n\t  lt_user_locale=\\\"$lt_var=\\\\\\$save_\\$lt_var; \\$lt_user_locale\\\"\n\t  lt_safe_locale=\\\"$lt_var=C; \\$lt_safe_locale\\\"\n\tfi\"\ndone\n\n$lt_unset CDPATH\n\n\n\n\n\n: ${CP=\"cp -f\"}\n: ${ECHO=\"echo\"}\n: ${EGREP=\"/usr/bin/grep -E\"}\n: ${FGREP=\"/usr/bin/grep -F\"}\n: ${GREP=\"/usr/bin/grep\"}\n: ${LN_S=\"ln -s\"}\n: ${MAKE=\"make\"}\n: ${MKDIR=\"mkdir\"}\n: ${MV=\"mv -f\"}\n: ${RM=\"rm -f\"}\n: ${SED=\"/opt/local/bin/gsed\"}\n: ${SHELL=\"${CONFIG_SHELL-/bin/sh}\"}\n: ${Xsed=\"$SED -e 1s/^X//\"}\n\n# Global variables:\nEXIT_SUCCESS=0\nEXIT_FAILURE=1\nEXIT_MISMATCH=63  # $? = 63 is used to indicate version mismatch to missing.\nEXIT_SKIP=77\t  # $? = 77 is used to indicate a skipped test to automake.\n\nexit_status=$EXIT_SUCCESS\n\n# Make sure IFS has a sensible default\nlt_nl='\n'\nIFS=\" \t$lt_nl\"\n\ndirname=\"s,/[^/]*$,,\"\nbasename=\"s,^.*/,,\"\n\n# func_dirname_and_basename file append nondir_replacement\n# perform func_basename and func_dirname in a single function\n# call:\n#   dirname:  Compute the dirname of FILE.  If nonempty,\n#             add APPEND to the result, otherwise set result\n#             to NONDIR_REPLACEMENT.\n#             value returned in \"$func_dirname_result\"\n#   basename: Compute filename of FILE.\n#             value retuned in \"$func_basename_result\"\n# Implementation must be kept synchronized with func_dirname\n# and func_basename. For efficiency, we do not delegate to\n# those functions but instead duplicate the functionality here.\nfunc_dirname_and_basename ()\n{\n  # Extract subdirectory from the argument.\n  func_dirname_result=`$ECHO \"X${1}\" | $Xsed -e \"$dirname\"`\n  if test \"X$func_dirname_result\" = \"X${1}\"; then\n    func_dirname_result=\"${3}\"\n  else\n    func_dirname_result=\"$func_dirname_result${2}\"\n  fi\n  func_basename_result=`$ECHO \"X${1}\" | $Xsed -e \"$basename\"`\n}\n\n# Generated shell functions inserted here.\n\n# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh\n# is ksh but when the shell is invoked as \"sh\" and the current value of\n# the _XPG environment variable is not equal to 1 (one), the special\n# positional parameter $0, within a function call, is the name of the\n# function.\nprogpath=\"$0\"\n\n# The name of this program:\n# In the unlikely event $progname began with a '-', it would play havoc with\n# func_echo (imagine progname=-n), so we prepend ./ in that case:\nfunc_dirname_and_basename \"$progpath\"\nprogname=$func_basename_result\ncase $progname in\n  -*) progname=./$progname ;;\nesac\n\n# Make sure we have an absolute path for reexecution:\ncase $progpath in\n  [\\\\/]*|[A-Za-z]:\\\\*) ;;\n  *[\\\\/]*)\n     progdir=$func_dirname_result\n     progdir=`cd \"$progdir\" && pwd`\n     progpath=\"$progdir/$progname\"\n     ;;\n  *)\n     save_IFS=\"$IFS\"\n     IFS=:\n     for progdir in $PATH; do\n       IFS=\"$save_IFS\"\n       test -x \"$progdir/$progname\" && break\n     done\n     IFS=\"$save_IFS\"\n     test -n \"$progdir\" || progdir=`pwd`\n     progpath=\"$progdir/$progname\"\n     ;;\nesac\n\n# Sed substitution that helps us do robust quoting.  It backslashifies\n# metacharacters that are still active within double-quoted strings.\nXsed=\"${SED}\"' -e 1s/^X//'\nsed_quote_subst='s/\\([`\"$\\\\]\\)/\\\\\\1/g'\n\n# Same as above, but do not quote variable references.\ndouble_quote_subst='s/\\([\"`\\\\]\\)/\\\\\\1/g'\n\n# Re-`\\' parameter expansions in output of double_quote_subst that were\n# `\\'-ed in input to the same.  If an odd number of `\\' preceded a '$'\n# in input to double_quote_subst, that '$' was protected from expansion.\n# Since each input `\\' is now two `\\'s, look for any number of runs of\n# four `\\'s followed by two `\\'s and then a '$'.  `\\' that '$'.\nbs='\\\\'\nbs2='\\\\\\\\'\nbs4='\\\\\\\\\\\\\\\\'\ndollar='\\$'\nsed_double_backslash=\"\\\n  s/$bs4/&\\\\\n/g\n  s/^$bs2$dollar/$bs&/\n  s/\\\\([^$bs]\\\\)$bs2$dollar/\\\\1$bs2$bs$dollar/g\n  s/\\n//g\"\n\n# Standard options:\nopt_dry_run=false\nopt_help=false\nopt_quiet=false\nopt_verbose=false\nopt_warning=:\n\n# func_echo arg...\n# Echo program name prefixed message, along with the current mode\n# name if it has been set yet.\nfunc_echo ()\n{\n    $ECHO \"$progname${mode+: }$mode: $*\"\n}\n\n# func_verbose arg...\n# Echo program name prefixed message in verbose mode only.\nfunc_verbose ()\n{\n    $opt_verbose && func_echo ${1+\"$@\"}\n\n    # A bug in bash halts the script if the last line of a function\n    # fails when set -e is in force, so we need another command to\n    # work around that:\n    :\n}\n\n# func_error arg...\n# Echo program name prefixed message to standard error.\nfunc_error ()\n{\n    $ECHO \"$progname${mode+: }$mode: \"${1+\"$@\"} 1>&2\n}\n\n# func_warning arg...\n# Echo program name prefixed warning message to standard error.\nfunc_warning ()\n{\n    $opt_warning && $ECHO \"$progname${mode+: }$mode: warning: \"${1+\"$@\"} 1>&2\n\n    # bash bug again:\n    :\n}\n\n# func_fatal_error arg...\n# Echo program name prefixed message to standard error, and exit.\nfunc_fatal_error ()\n{\n    func_error ${1+\"$@\"}\n    exit $EXIT_FAILURE\n}\n\n# func_fatal_help arg...\n# Echo program name prefixed message to standard error, followed by\n# a help hint, and exit.\nfunc_fatal_help ()\n{\n    func_error ${1+\"$@\"}\n    func_fatal_error \"$help\"\n}\nhelp=\"Try \\`$progname --help' for more information.\"  ## default\n\n\n# func_grep expression filename\n# Check whether EXPRESSION matches any line of FILENAME, without output.\nfunc_grep ()\n{\n    $GREP \"$1\" \"$2\" >/dev/null 2>&1\n}\n\n\n# func_mkdir_p directory-path\n# Make sure the entire path to DIRECTORY-PATH is available.\nfunc_mkdir_p ()\n{\n    my_directory_path=\"$1\"\n    my_dir_list=\n\n    if test -n \"$my_directory_path\" && test \"$opt_dry_run\" != \":\"; then\n\n      # Protect directory names starting with `-'\n      case $my_directory_path in\n        -*) my_directory_path=\"./$my_directory_path\" ;;\n      esac\n\n      # While some portion of DIR does not yet exist...\n      while test ! -d \"$my_directory_path\"; do\n        # ...make a list in topmost first order.  Use a colon delimited\n\t# list incase some portion of path contains whitespace.\n        my_dir_list=\"$my_directory_path:$my_dir_list\"\n\n        # If the last portion added has no slash in it, the list is done\n        case $my_directory_path in */*) ;; *) break ;; esac\n\n        # ...otherwise throw away the child directory and loop\n        my_directory_path=`$ECHO \"X$my_directory_path\" | $Xsed -e \"$dirname\"`\n      done\n      my_dir_list=`$ECHO \"X$my_dir_list\" | $Xsed -e 's,:*$,,'`\n\n      save_mkdir_p_IFS=\"$IFS\"; IFS=':'\n      for my_dir in $my_dir_list; do\n\tIFS=\"$save_mkdir_p_IFS\"\n        # mkdir can fail with a `File exist' error if two processes\n        # try to create one of the directories concurrently.  Don't\n        # stop in that case!\n        $MKDIR \"$my_dir\" 2>/dev/null || :\n      done\n      IFS=\"$save_mkdir_p_IFS\"\n\n      # Bail out if we (or some other process) failed to create a directory.\n      test -d \"$my_directory_path\" || \\\n        func_fatal_error \"Failed to create \\`$1'\"\n    fi\n}\n\n\n# func_mktempdir [string]\n# Make a temporary directory that won't clash with other running\n# libtool processes, and avoids race conditions if possible.  If\n# given, STRING is the basename for that directory.\nfunc_mktempdir ()\n{\n    my_template=\"${TMPDIR-/tmp}/${1-$progname}\"\n\n    if test \"$opt_dry_run\" = \":\"; then\n      # Return a directory name, but don't create it in dry-run mode\n      my_tmpdir=\"${my_template}-$$\"\n    else\n\n      # If mktemp works, use that first and foremost\n      my_tmpdir=`mktemp -d \"${my_template}-XXXXXXXX\" 2>/dev/null`\n\n      if test ! -d \"$my_tmpdir\"; then\n        # Failing that, at least try and use $RANDOM to avoid a race\n        my_tmpdir=\"${my_template}-${RANDOM-0}$$\"\n\n        save_mktempdir_umask=`umask`\n        umask 0077\n        $MKDIR \"$my_tmpdir\"\n        umask $save_mktempdir_umask\n      fi\n\n      # If we're not in dry-run mode, bomb out on failure\n      test -d \"$my_tmpdir\" || \\\n        func_fatal_error \"cannot create temporary directory \\`$my_tmpdir'\"\n    fi\n\n    $ECHO \"X$my_tmpdir\" | $Xsed\n}\n\n\n# func_quote_for_eval arg\n# Aesthetically quote ARG to be evaled later.\n# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT\n# is double-quoted, suitable for a subsequent eval, whereas\n# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters\n# which are still active within double quotes backslashified.\nfunc_quote_for_eval ()\n{\n    case $1 in\n      *[\\\\\\`\\\"\\$]*)\n\tfunc_quote_for_eval_unquoted_result=`$ECHO \"X$1\" | $Xsed -e \"$sed_quote_subst\"` ;;\n      *)\n        func_quote_for_eval_unquoted_result=\"$1\" ;;\n    esac\n\n    case $func_quote_for_eval_unquoted_result in\n      # Double-quote args containing shell metacharacters to delay\n      # word splitting, command substitution and and variable\n      # expansion for a subsequent eval.\n      # Many Bourne shells cannot handle close brackets correctly\n      # in scan sets, so we specify it separately.\n      *[\\[\\~\\#\\^\\&\\*\\(\\)\\{\\}\\|\\;\\<\\>\\?\\'\\ \\\t]*|*]*|\"\")\n        func_quote_for_eval_result=\"\\\"$func_quote_for_eval_unquoted_result\\\"\"\n        ;;\n      *)\n        func_quote_for_eval_result=\"$func_quote_for_eval_unquoted_result\"\n    esac\n}\n\n\n# func_quote_for_expand arg\n# Aesthetically quote ARG to be evaled later; same as above,\n# but do not quote variable references.\nfunc_quote_for_expand ()\n{\n    case $1 in\n      *[\\\\\\`\\\"]*)\n\tmy_arg=`$ECHO \"X$1\" | $Xsed \\\n\t    -e \"$double_quote_subst\" -e \"$sed_double_backslash\"` ;;\n      *)\n        my_arg=\"$1\" ;;\n    esac\n\n    case $my_arg in\n      # Double-quote args containing shell metacharacters to delay\n      # word splitting and command substitution for a subsequent eval.\n      # Many Bourne shells cannot handle close brackets correctly\n      # in scan sets, so we specify it separately.\n      *[\\[\\~\\#\\^\\&\\*\\(\\)\\{\\}\\|\\;\\<\\>\\?\\'\\ \\\t]*|*]*|\"\")\n        my_arg=\"\\\"$my_arg\\\"\"\n        ;;\n    esac\n\n    func_quote_for_expand_result=\"$my_arg\"\n}\n\n\n# func_show_eval cmd [fail_exp]\n# Unless opt_silent is true, then output CMD.  Then, if opt_dryrun is\n# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP\n# is given, then evaluate it.\nfunc_show_eval ()\n{\n    my_cmd=\"$1\"\n    my_fail_exp=\"${2-:}\"\n\n    ${opt_silent-false} || {\n      func_quote_for_expand \"$my_cmd\"\n      eval \"func_echo $func_quote_for_expand_result\"\n    }\n\n    if ${opt_dry_run-false}; then :; else\n      eval \"$my_cmd\"\n      my_status=$?\n      if test \"$my_status\" -eq 0; then :; else\n\teval \"(exit $my_status); $my_fail_exp\"\n      fi\n    fi\n}\n\n\n# func_show_eval_locale cmd [fail_exp]\n# Unless opt_silent is true, then output CMD.  Then, if opt_dryrun is\n# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP\n# is given, then evaluate it.  Use the saved locale for evaluation.\nfunc_show_eval_locale ()\n{\n    my_cmd=\"$1\"\n    my_fail_exp=\"${2-:}\"\n\n    ${opt_silent-false} || {\n      func_quote_for_expand \"$my_cmd\"\n      eval \"func_echo $func_quote_for_expand_result\"\n    }\n\n    if ${opt_dry_run-false}; then :; else\n      eval \"$lt_user_locale\n\t    $my_cmd\"\n      my_status=$?\n      eval \"$lt_safe_locale\"\n      if test \"$my_status\" -eq 0; then :; else\n\teval \"(exit $my_status); $my_fail_exp\"\n      fi\n    fi\n}\n\n\n\n\n\n# func_version\n# Echo version message to standard output and exit.\nfunc_version ()\n{\n    $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / {\n        s/^# //\n\ts/^# *$//\n        s/\\((C)\\)[ 0-9,-]*\\( [1-9][0-9]*\\)/\\1\\2/\n        p\n     }' < \"$progpath\"\n     exit $?\n}\n\n# func_usage\n# Echo short help message to standard output and exit.\nfunc_usage ()\n{\n    $SED -n '/^# Usage:/,/# -h/ {\n        s/^# //\n\ts/^# *$//\n\ts/\\$progname/'$progname'/\n\tp\n    }' < \"$progpath\"\n    $ECHO\n    $ECHO \"run \\`$progname --help | more' for full usage\"\n    exit $?\n}\n\n# func_help\n# Echo long help message to standard output and exit.\nfunc_help ()\n{\n    $SED -n '/^# Usage:/,/# Report bugs to/ {\n        s/^# //\n\ts/^# *$//\n\ts*\\$progname*'$progname'*\n\ts*\\$host*'\"$host\"'*\n\ts*\\$SHELL*'\"$SHELL\"'*\n\ts*\\$LTCC*'\"$LTCC\"'*\n\ts*\\$LTCFLAGS*'\"$LTCFLAGS\"'*\n\ts*\\$LD*'\"$LD\"'*\n\ts/\\$with_gnu_ld/'\"$with_gnu_ld\"'/\n\ts/\\$automake_version/'\"`(automake --version) 2>/dev/null |$SED 1q`\"'/\n\ts/\\$autoconf_version/'\"`(autoconf --version) 2>/dev/null |$SED 1q`\"'/\n\tp\n     }' < \"$progpath\"\n    exit $?\n}\n\n# func_missing_arg argname\n# Echo program name prefixed message to standard error and set global\n# exit_cmd.\nfunc_missing_arg ()\n{\n    func_error \"missing argument for $1\"\n    exit_cmd=exit\n}\n\nexit_cmd=:\n\n\n\n\n\n# Check that we have a working $ECHO.\nif test \"X$1\" = X--no-reexec; then\n  # Discard the --no-reexec flag, and continue.\n  shift\nelif test \"X$1\" = X--fallback-echo; then\n  # Avoid inline document here, it may be left over\n  :\nelif test \"X`{ $ECHO '\\t'; } 2>/dev/null`\" = 'X\\t'; then\n  # Yippee, $ECHO works!\n  :\nelse\n  # Restart under the correct shell, and then maybe $ECHO will work.\n  exec $SHELL \"$progpath\" --no-reexec ${1+\"$@\"}\nfi\n\nif test \"X$1\" = X--fallback-echo; then\n  # used as fallback echo\n  shift\n  cat <<EOF\n$*\nEOF\n  exit $EXIT_SUCCESS\nfi\n\nmagic=\"%%%MAGIC variable%%%\"\nmagic_exe=\"%%%MAGIC EXE variable%%%\"\n\n# Global variables.\n# $mode is unset\nnonopt=\nexecute_dlfiles=\npreserve_args=\nlo2o=\"s/\\\\.lo\\$/.${objext}/\"\no2lo=\"s/\\\\.${objext}\\$/.lo/\"\nextracted_archives=\nextracted_serial=0\n\nopt_dry_run=false\nopt_duplicate_deps=false\nopt_silent=false\nopt_debug=:\n\n# If this variable is set in any of the actions, the command in it\n# will be execed at the end.  This prevents here-documents from being\n# left over by shells.\nexec_cmd=\n\n# func_fatal_configuration arg...\n# Echo program name prefixed message to standard error, followed by\n# a configuration failure hint, and exit.\nfunc_fatal_configuration ()\n{\n    func_error ${1+\"$@\"}\n    func_error \"See the $PACKAGE documentation for more information.\"\n    func_fatal_error \"Fatal configuration error.\"\n}\n\n\n# func_config\n# Display the configuration for all the tags in this script.\nfunc_config ()\n{\n    re_begincf='^# ### BEGIN LIBTOOL'\n    re_endcf='^# ### END LIBTOOL'\n\n    # Default configuration.\n    $SED \"1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\\$d\" < \"$progpath\"\n\n    # Now print the configurations for the tags.\n    for tagname in $taglist; do\n      $SED -n \"/$re_begincf TAG CONFIG: $tagname\\$/,/$re_endcf TAG CONFIG: $tagname\\$/p\" < \"$progpath\"\n    done\n\n    exit $?\n}\n\n# func_features\n# Display the features supported by this script.\nfunc_features ()\n{\n    $ECHO \"host: $host\"\n    if test \"$build_libtool_libs\" = yes; then\n      $ECHO \"enable shared libraries\"\n    else\n      $ECHO \"disable shared libraries\"\n    fi\n    if test \"$build_old_libs\" = yes; then\n      $ECHO \"enable static libraries\"\n    else\n      $ECHO \"disable static libraries\"\n    fi\n\n    exit $?\n}\n\n# func_enable_tag tagname\n# Verify that TAGNAME is valid, and either flag an error and exit, or\n# enable the TAGNAME tag.  We also add TAGNAME to the global $taglist\n# variable here.\nfunc_enable_tag ()\n{\n  # Global variable:\n  tagname=\"$1\"\n\n  re_begincf=\"^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\\$\"\n  re_endcf=\"^# ### END LIBTOOL TAG CONFIG: $tagname\\$\"\n  sed_extractcf=\"/$re_begincf/,/$re_endcf/p\"\n\n  # Validate tagname.\n  case $tagname in\n    *[!-_A-Za-z0-9,/]*)\n      func_fatal_error \"invalid tag name: $tagname\"\n      ;;\n  esac\n\n  # Don't test for the \"default\" C tag, as we know it's\n  # there but not specially marked.\n  case $tagname in\n    CC) ;;\n    *)\n      if $GREP \"$re_begincf\" \"$progpath\" >/dev/null 2>&1; then\n\ttaglist=\"$taglist $tagname\"\n\n\t# Evaluate the configuration.  Be careful to quote the path\n\t# and the sed script, to avoid splitting on whitespace, but\n\t# also don't use non-portable quotes within backquotes within\n\t# quotes we have to do it in 2 steps:\n\textractedcf=`$SED -n -e \"$sed_extractcf\" < \"$progpath\"`\n\teval \"$extractedcf\"\n      else\n\tfunc_error \"ignoring unknown tag $tagname\"\n      fi\n      ;;\n  esac\n}\n\n# Parse options once, thoroughly.  This comes as soon as possible in\n# the script to make things like `libtool --version' happen quickly.\n{\n\n  # Shorthand for --mode=foo, only valid as the first argument\n  case $1 in\n  clean|clea|cle|cl)\n    shift; set dummy --mode clean ${1+\"$@\"}; shift\n    ;;\n  compile|compil|compi|comp|com|co|c)\n    shift; set dummy --mode compile ${1+\"$@\"}; shift\n    ;;\n  execute|execut|execu|exec|exe|ex|e)\n    shift; set dummy --mode execute ${1+\"$@\"}; shift\n    ;;\n  finish|finis|fini|fin|fi|f)\n    shift; set dummy --mode finish ${1+\"$@\"}; shift\n    ;;\n  install|instal|insta|inst|ins|in|i)\n    shift; set dummy --mode install ${1+\"$@\"}; shift\n    ;;\n  link|lin|li|l)\n    shift; set dummy --mode link ${1+\"$@\"}; shift\n    ;;\n  uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)\n    shift; set dummy --mode uninstall ${1+\"$@\"}; shift\n    ;;\n  esac\n\n  # Parse non-mode specific arguments:\n  while test \"$#\" -gt 0; do\n    opt=\"$1\"\n    shift\n\n    case $opt in\n      --config)\t\tfunc_config\t\t\t\t\t;;\n\n      --debug)\t\tpreserve_args=\"$preserve_args $opt\"\n\t\t\tfunc_echo \"enabling shell trace mode\"\n\t\t\topt_debug='set -x'\n\t\t\t$opt_debug\n\t\t\t;;\n\n      -dlopen)\t\ttest \"$#\" -eq 0 && func_missing_arg \"$opt\" && break\n\t\t\texecute_dlfiles=\"$execute_dlfiles $1\"\n\t\t\tshift\n\t\t\t;;\n\n      --dry-run | -n)\topt_dry_run=:\t\t\t\t\t;;\n      --features)       func_features\t\t\t\t\t;;\n      --finish)\t\tmode=\"finish\"\t\t\t\t\t;;\n\n      --mode)\t\ttest \"$#\" -eq 0 && func_missing_arg \"$opt\" && break\n\t\t\tcase $1 in\n\t\t\t  # Valid mode arguments:\n\t\t\t  clean)\t;;\n\t\t\t  compile)\t;;\n\t\t\t  execute)\t;;\n\t\t\t  finish)\t;;\n\t\t\t  install)\t;;\n\t\t\t  link)\t\t;;\n\t\t\t  relink)\t;;\n\t\t\t  uninstall)\t;;\n\n\t\t\t  # Catch anything else as an error\n\t\t\t  *) func_error \"invalid argument for $opt\"\n\t\t\t     exit_cmd=exit\n\t\t\t     break\n\t\t\t     ;;\n\t\t        esac\n\n\t\t\tmode=\"$1\"\n\t\t\tshift\n\t\t\t;;\n\n      --preserve-dup-deps)\n\t\t\topt_duplicate_deps=:\t\t\t\t;;\n\n      --quiet|--silent)\tpreserve_args=\"$preserve_args $opt\"\n\t\t\topt_silent=:\n\t\t\t;;\n\n      --verbose| -v)\tpreserve_args=\"$preserve_args $opt\"\n\t\t\topt_silent=false\n\t\t\t;;\n\n      --tag)\t\ttest \"$#\" -eq 0 && func_missing_arg \"$opt\" && break\n\t\t\tpreserve_args=\"$preserve_args $opt $1\"\n\t\t\tfunc_enable_tag \"$1\"\t# tagname is set here\n\t\t\tshift\n\t\t\t;;\n\n      # Separate optargs to long options:\n      -dlopen=*|--mode=*|--tag=*)\n\t\t\tfunc_opt_split \"$opt\"\n\t\t\tset dummy \"$func_opt_split_opt\" \"$func_opt_split_arg\" ${1+\"$@\"}\n\t\t\tshift\n\t\t\t;;\n\n      -\\?|-h)\t\tfunc_usage\t\t\t\t\t;;\n      --help)\t\topt_help=:\t\t\t\t\t;;\n      --version)\tfunc_version\t\t\t\t\t;;\n\n      -*)\t\tfunc_fatal_help \"unrecognized option \\`$opt'\"\t;;\n\n      *)\t\tnonopt=\"$opt\"\n\t\t\tbreak\n\t\t\t;;\n    esac\n  done\n\n\n  case $host in\n    *cygwin* | *mingw* | *pw32* | *cegcc*)\n      # don't eliminate duplications in $postdeps and $predeps\n      opt_duplicate_compiler_generated_deps=:\n      ;;\n    *)\n      opt_duplicate_compiler_generated_deps=$opt_duplicate_deps\n      ;;\n  esac\n\n  # Having warned about all mis-specified options, bail out if\n  # anything was wrong.\n  $exit_cmd $EXIT_FAILURE\n}\n\n# func_check_version_match\n# Ensure that we are using m4 macros, and libtool script from the same\n# release of libtool.\nfunc_check_version_match ()\n{\n  if test \"$package_revision\" != \"$macro_revision\"; then\n    if test \"$VERSION\" != \"$macro_version\"; then\n      if test -z \"$macro_version\"; then\n        cat >&2 <<_LT_EOF\n$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the\n$progname: definition of this LT_INIT comes from an older release.\n$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION\n$progname: and run autoconf again.\n_LT_EOF\n      else\n        cat >&2 <<_LT_EOF\n$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the\n$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.\n$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION\n$progname: and run autoconf again.\n_LT_EOF\n      fi\n    else\n      cat >&2 <<_LT_EOF\n$progname: Version mismatch error.  This is $PACKAGE $VERSION, revision $package_revision,\n$progname: but the definition of this LT_INIT comes from revision $macro_revision.\n$progname: You should recreate aclocal.m4 with macros from revision $package_revision\n$progname: of $PACKAGE $VERSION and run autoconf again.\n_LT_EOF\n    fi\n\n    exit $EXIT_MISMATCH\n  fi\n}\n\n\n## ----------- ##\n##    Main.    ##\n## ----------- ##\n\n$opt_help || {\n  # Sanity checks first:\n  func_check_version_match\n\n  if test \"$build_libtool_libs\" != yes && test \"$build_old_libs\" != yes; then\n    func_fatal_configuration \"not configured to build any kind of library\"\n  fi\n\n  test -z \"$mode\" && func_fatal_error \"error: you must specify a MODE.\"\n\n\n  # Darwin sucks\n  eval std_shrext=\\\"$shrext_cmds\\\"\n\n\n  # Only execute mode is allowed to have -dlopen flags.\n  if test -n \"$execute_dlfiles\" && test \"$mode\" != execute; then\n    func_error \"unrecognized option \\`-dlopen'\"\n    $ECHO \"$help\" 1>&2\n    exit $EXIT_FAILURE\n  fi\n\n  # Change the help message to a mode-specific one.\n  generic_help=\"$help\"\n  help=\"Try \\`$progname --help --mode=$mode' for more information.\"\n}\n\n\n# func_lalib_p file\n# True iff FILE is a libtool `.la' library or `.lo' object file.\n# This function is only a basic sanity check; it will hardly flush out\n# determined imposters.\nfunc_lalib_p ()\n{\n    test -f \"$1\" &&\n      $SED -e 4q \"$1\" 2>/dev/null \\\n        | $GREP \"^# Generated by .*$PACKAGE\" > /dev/null 2>&1\n}\n\n# func_lalib_unsafe_p file\n# True iff FILE is a libtool `.la' library or `.lo' object file.\n# This function implements the same check as func_lalib_p without\n# resorting to external programs.  To this end, it redirects stdin and\n# closes it afterwards, without saving the original file descriptor.\n# As a safety measure, use it only where a negative result would be\n# fatal anyway.  Works if `file' does not exist.\nfunc_lalib_unsafe_p ()\n{\n    lalib_p=no\n    if test -f \"$1\" && test -r \"$1\" && exec 5<&0 <\"$1\"; then\n\tfor lalib_p_l in 1 2 3 4\n\tdo\n\t    read lalib_p_line\n\t    case \"$lalib_p_line\" in\n\t\t\\#\\ Generated\\ by\\ *$PACKAGE* ) lalib_p=yes; break;;\n\t    esac\n\tdone\n\texec 0<&5 5<&-\n    fi\n    test \"$lalib_p\" = yes\n}\n\n# func_ltwrapper_script_p file\n# True iff FILE is a libtool wrapper script\n# This function is only a basic sanity check; it will hardly flush out\n# determined imposters.\nfunc_ltwrapper_script_p ()\n{\n    func_lalib_p \"$1\"\n}\n\n# func_ltwrapper_executable_p file\n# True iff FILE is a libtool wrapper executable\n# This function is only a basic sanity check; it will hardly flush out\n# determined imposters.\nfunc_ltwrapper_executable_p ()\n{\n    func_ltwrapper_exec_suffix=\n    case $1 in\n    *.exe) ;;\n    *) func_ltwrapper_exec_suffix=.exe ;;\n    esac\n    $GREP \"$magic_exe\" \"$1$func_ltwrapper_exec_suffix\" >/dev/null 2>&1\n}\n\n# func_ltwrapper_scriptname file\n# Assumes file is an ltwrapper_executable\n# uses $file to determine the appropriate filename for a\n# temporary ltwrapper_script.\nfunc_ltwrapper_scriptname ()\n{\n    func_ltwrapper_scriptname_result=\"\"\n    if func_ltwrapper_executable_p \"$1\"; then\n\tfunc_dirname_and_basename \"$1\" \"\" \".\"\n\tfunc_stripname '' '.exe' \"$func_basename_result\"\n\tfunc_ltwrapper_scriptname_result=\"$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper\"\n    fi\n}\n\n# func_ltwrapper_p file\n# True iff FILE is a libtool wrapper script or wrapper executable\n# This function is only a basic sanity check; it will hardly flush out\n# determined imposters.\nfunc_ltwrapper_p ()\n{\n    func_ltwrapper_script_p \"$1\" || func_ltwrapper_executable_p \"$1\"\n}\n\n\n# func_execute_cmds commands fail_cmd\n# Execute tilde-delimited COMMANDS.\n# If FAIL_CMD is given, eval that upon failure.\n# FAIL_CMD may read-access the current command in variable CMD!\nfunc_execute_cmds ()\n{\n    $opt_debug\n    save_ifs=$IFS; IFS='~'\n    for cmd in $1; do\n      IFS=$save_ifs\n      eval cmd=\\\"$cmd\\\"\n      func_show_eval \"$cmd\" \"${2-:}\"\n    done\n    IFS=$save_ifs\n}\n\n\n# func_source file\n# Source FILE, adding directory component if necessary.\n# Note that it is not necessary on cygwin/mingw to append a dot to\n# FILE even if both FILE and FILE.exe exist: automatic-append-.exe\n# behavior happens only for exec(3), not for open(2)!  Also, sourcing\n# `FILE.' does not work on cygwin managed mounts.\nfunc_source ()\n{\n    $opt_debug\n    case $1 in\n    */* | *\\\\*)\t. \"$1\" ;;\n    *)\t\t. \"./$1\" ;;\n    esac\n}\n\n\n# func_infer_tag arg\n# Infer tagged configuration to use if any are available and\n# if one wasn't chosen via the \"--tag\" command line option.\n# Only attempt this if the compiler in the base compile\n# command doesn't match the default compiler.\n# arg is usually of the form 'gcc ...'\nfunc_infer_tag ()\n{\n    $opt_debug\n    if test -n \"$available_tags\" && test -z \"$tagname\"; then\n      CC_quoted=\n      for arg in $CC; do\n        func_quote_for_eval \"$arg\"\n\tCC_quoted=\"$CC_quoted $func_quote_for_eval_result\"\n      done\n      case $@ in\n      # Blanks in the command may have been stripped by the calling shell,\n      # but not from the CC environment variable when configure was run.\n      \" $CC \"* | \"$CC \"* | \" `$ECHO $CC` \"* | \"`$ECHO $CC` \"* | \" $CC_quoted\"* | \"$CC_quoted \"* | \" `$ECHO $CC_quoted` \"* | \"`$ECHO $CC_quoted` \"*) ;;\n      # Blanks at the start of $base_compile will cause this to fail\n      # if we don't check for them as well.\n      *)\n\tfor z in $available_tags; do\n\t  if $GREP \"^# ### BEGIN LIBTOOL TAG CONFIG: $z$\" < \"$progpath\" > /dev/null; then\n\t    # Evaluate the configuration.\n\t    eval \"`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`\"\n\t    CC_quoted=\n\t    for arg in $CC; do\n\t      # Double-quote args containing other shell metacharacters.\n\t      func_quote_for_eval \"$arg\"\n\t      CC_quoted=\"$CC_quoted $func_quote_for_eval_result\"\n\t    done\n\t    case \"$@ \" in\n\t      \" $CC \"* | \"$CC \"* | \" `$ECHO $CC` \"* | \"`$ECHO $CC` \"* | \" $CC_quoted\"* | \"$CC_quoted \"* | \" `$ECHO $CC_quoted` \"* | \"`$ECHO $CC_quoted` \"*)\n\t      # The compiler in the base compile command matches\n\t      # the one in the tagged configuration.\n\t      # Assume this is the tagged configuration we want.\n\t      tagname=$z\n\t      break\n\t      ;;\n\t    esac\n\t  fi\n\tdone\n\t# If $tagname still isn't set, then no tagged configuration\n\t# was found and let the user know that the \"--tag\" command\n\t# line option must be used.\n\tif test -z \"$tagname\"; then\n\t  func_echo \"unable to infer tagged configuration\"\n\t  func_fatal_error \"specify a tag with \\`--tag'\"\n#\telse\n#\t  func_verbose \"using $tagname tagged configuration\"\n\tfi\n\t;;\n      esac\n    fi\n}\n\n\n\n# func_write_libtool_object output_name pic_name nonpic_name\n# Create a libtool object file (analogous to a \".la\" file),\n# but don't create it if we're doing a dry run.\nfunc_write_libtool_object ()\n{\n    write_libobj=${1}\n    if test \"$build_libtool_libs\" = yes; then\n      write_lobj=\\'${2}\\'\n    else\n      write_lobj=none\n    fi\n\n    if test \"$build_old_libs\" = yes; then\n      write_oldobj=\\'${3}\\'\n    else\n      write_oldobj=none\n    fi\n\n    $opt_dry_run || {\n      cat >${write_libobj}T <<EOF\n# $write_libobj - a libtool object file\n# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION\n#\n# Please DO NOT delete this file!\n# It is necessary for linking the library.\n\n# Name of the PIC object.\npic_object=$write_lobj\n\n# Name of the non-PIC object\nnon_pic_object=$write_oldobj\n\nEOF\n      $MV \"${write_libobj}T\" \"${write_libobj}\"\n    }\n}\n\n# func_mode_compile arg...\nfunc_mode_compile ()\n{\n    $opt_debug\n    # Get the compilation command and the source file.\n    base_compile=\n    srcfile=\"$nonopt\"  #  always keep a non-empty value in \"srcfile\"\n    suppress_opt=yes\n    suppress_output=\n    arg_mode=normal\n    libobj=\n    later=\n    pie_flag=\n\n    for arg\n    do\n      case $arg_mode in\n      arg  )\n\t# do not \"continue\".  Instead, add this to base_compile\n\tlastarg=\"$arg\"\n\targ_mode=normal\n\t;;\n\n      target )\n\tlibobj=\"$arg\"\n\targ_mode=normal\n\tcontinue\n\t;;\n\n      normal )\n\t# Accept any command-line options.\n\tcase $arg in\n\t-o)\n\t  test -n \"$libobj\" && \\\n\t    func_fatal_error \"you cannot specify \\`-o' more than once\"\n\t  arg_mode=target\n\t  continue\n\t  ;;\n\n\t-pie | -fpie | -fPIE)\n          pie_flag=\"$pie_flag $arg\"\n\t  continue\n\t  ;;\n\n\t-shared | -static | -prefer-pic | -prefer-non-pic)\n\t  later=\"$later $arg\"\n\t  continue\n\t  ;;\n\n\t-no-suppress)\n\t  suppress_opt=no\n\t  continue\n\t  ;;\n\n\t-Xcompiler)\n\t  arg_mode=arg  #  the next one goes into the \"base_compile\" arg list\n\t  continue      #  The current \"srcfile\" will either be retained or\n\t  ;;            #  replaced later.  I would guess that would be a bug.\n\n\t-Wc,*)\n\t  func_stripname '-Wc,' '' \"$arg\"\n\t  args=$func_stripname_result\n\t  lastarg=\n\t  save_ifs=\"$IFS\"; IFS=','\n\t  for arg in $args; do\n\t    IFS=\"$save_ifs\"\n\t    func_quote_for_eval \"$arg\"\n\t    lastarg=\"$lastarg $func_quote_for_eval_result\"\n\t  done\n\t  IFS=\"$save_ifs\"\n\t  func_stripname ' ' '' \"$lastarg\"\n\t  lastarg=$func_stripname_result\n\n\t  # Add the arguments to base_compile.\n\t  base_compile=\"$base_compile $lastarg\"\n\t  continue\n\t  ;;\n\n\t*)\n\t  # Accept the current argument as the source file.\n\t  # The previous \"srcfile\" becomes the current argument.\n\t  #\n\t  lastarg=\"$srcfile\"\n\t  srcfile=\"$arg\"\n\t  ;;\n\tesac  #  case $arg\n\t;;\n      esac    #  case $arg_mode\n\n      # Aesthetically quote the previous argument.\n      func_quote_for_eval \"$lastarg\"\n      base_compile=\"$base_compile $func_quote_for_eval_result\"\n    done # for arg\n\n    case $arg_mode in\n    arg)\n      func_fatal_error \"you must specify an argument for -Xcompile\"\n      ;;\n    target)\n      func_fatal_error \"you must specify a target with \\`-o'\"\n      ;;\n    *)\n      # Get the name of the library object.\n      test -z \"$libobj\" && {\n\tfunc_basename \"$srcfile\"\n\tlibobj=\"$func_basename_result\"\n      }\n      ;;\n    esac\n\n    # Recognize several different file suffixes.\n    # If the user specifies -o file.o, it is replaced with file.lo\n    case $libobj in\n    *.[cCFSifmso] | \\\n    *.ada | *.adb | *.ads | *.asm | \\\n    *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \\\n    *.[fF][09]? | *.for | *.java | *.obj | *.sx)\n      func_xform \"$libobj\"\n      libobj=$func_xform_result\n      ;;\n    esac\n\n    case $libobj in\n    *.lo) func_lo2o \"$libobj\"; obj=$func_lo2o_result ;;\n    *)\n      func_fatal_error \"cannot determine name of library object from \\`$libobj'\"\n      ;;\n    esac\n\n    func_infer_tag $base_compile\n\n    for arg in $later; do\n      case $arg in\n      -shared)\n\ttest \"$build_libtool_libs\" != yes && \\\n\t  func_fatal_configuration \"can not build a shared library\"\n\tbuild_old_libs=no\n\tcontinue\n\t;;\n\n      -static)\n\tbuild_libtool_libs=no\n\tbuild_old_libs=yes\n\tcontinue\n\t;;\n\n      -prefer-pic)\n\tpic_mode=yes\n\tcontinue\n\t;;\n\n      -prefer-non-pic)\n\tpic_mode=no\n\tcontinue\n\t;;\n      esac\n    done\n\n    func_quote_for_eval \"$libobj\"\n    test \"X$libobj\" != \"X$func_quote_for_eval_result\" \\\n      && $ECHO \"X$libobj\" | $GREP '[]~#^*{};<>?\"'\"'\"'\t &()|`$[]' \\\n      && func_warning \"libobj name \\`$libobj' may not contain shell special characters.\"\n    func_dirname_and_basename \"$obj\" \"/\" \"\"\n    objname=\"$func_basename_result\"\n    xdir=\"$func_dirname_result\"\n    lobj=${xdir}$objdir/$objname\n\n    test -z \"$base_compile\" && \\\n      func_fatal_help \"you must specify a compilation command\"\n\n    # Delete any leftover library objects.\n    if test \"$build_old_libs\" = yes; then\n      removelist=\"$obj $lobj $libobj ${libobj}T\"\n    else\n      removelist=\"$lobj $libobj ${libobj}T\"\n    fi\n\n    # On Cygwin there's no \"real\" PIC flag so we must build both object types\n    case $host_os in\n    cygwin* | mingw* | pw32* | os2* | cegcc*)\n      pic_mode=default\n      ;;\n    esac\n    if test \"$pic_mode\" = no && test \"$deplibs_check_method\" != pass_all; then\n      # non-PIC code in shared libraries is not supported\n      pic_mode=default\n    fi\n\n    # Calculate the filename of the output object if compiler does\n    # not support -o with -c\n    if test \"$compiler_c_o\" = no; then\n      output_obj=`$ECHO \"X$srcfile\" | $Xsed -e 's%^.*/%%' -e 's%\\.[^.]*$%%'`.${objext}\n      lockfile=\"$output_obj.lock\"\n    else\n      output_obj=\n      need_locks=no\n      lockfile=\n    fi\n\n    # Lock this critical section if it is needed\n    # We use this script file to make the link, it avoids creating a new file\n    if test \"$need_locks\" = yes; then\n      until $opt_dry_run || ln \"$progpath\" \"$lockfile\" 2>/dev/null; do\n\tfunc_echo \"Waiting for $lockfile to be removed\"\n\tsleep 2\n      done\n    elif test \"$need_locks\" = warn; then\n      if test -f \"$lockfile\"; then\n\t$ECHO \"\\\n*** ERROR, $lockfile exists and contains:\n`cat $lockfile 2>/dev/null`\n\nThis indicates that another process is trying to use the same\ntemporary object file, and libtool could not work around it because\nyour compiler does not support \\`-c' and \\`-o' together.  If you\nrepeat this compilation, it may succeed, by chance, but you had better\navoid parallel builds (make -j) in this platform, or get a better\ncompiler.\"\n\n\t$opt_dry_run || $RM $removelist\n\texit $EXIT_FAILURE\n      fi\n      removelist=\"$removelist $output_obj\"\n      $ECHO \"$srcfile\" > \"$lockfile\"\n    fi\n\n    $opt_dry_run || $RM $removelist\n    removelist=\"$removelist $lockfile\"\n    trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15\n\n    if test -n \"$fix_srcfile_path\"; then\n      eval srcfile=\\\"$fix_srcfile_path\\\"\n    fi\n    func_quote_for_eval \"$srcfile\"\n    qsrcfile=$func_quote_for_eval_result\n\n    # Only build a PIC object if we are building libtool libraries.\n    if test \"$build_libtool_libs\" = yes; then\n      # Without this assignment, base_compile gets emptied.\n      fbsd_hideous_sh_bug=$base_compile\n\n      if test \"$pic_mode\" != no; then\n\tcommand=\"$base_compile $qsrcfile $pic_flag\"\n      else\n\t# Don't build PIC code\n\tcommand=\"$base_compile $qsrcfile\"\n      fi\n\n      func_mkdir_p \"$xdir$objdir\"\n\n      if test -z \"$output_obj\"; then\n\t# Place PIC objects in $objdir\n\tcommand=\"$command -o $lobj\"\n      fi\n\n      func_show_eval_locale \"$command\"\t\\\n          'test -n \"$output_obj\" && $RM $removelist; exit $EXIT_FAILURE'\n\n      if test \"$need_locks\" = warn &&\n\t test \"X`cat $lockfile 2>/dev/null`\" != \"X$srcfile\"; then\n\t$ECHO \"\\\n*** ERROR, $lockfile contains:\n`cat $lockfile 2>/dev/null`\n\nbut it should contain:\n$srcfile\n\nThis indicates that another process is trying to use the same\ntemporary object file, and libtool could not work around it because\nyour compiler does not support \\`-c' and \\`-o' together.  If you\nrepeat this compilation, it may succeed, by chance, but you had better\navoid parallel builds (make -j) in this platform, or get a better\ncompiler.\"\n\n\t$opt_dry_run || $RM $removelist\n\texit $EXIT_FAILURE\n      fi\n\n      # Just move the object if needed, then go on to compile the next one\n      if test -n \"$output_obj\" && test \"X$output_obj\" != \"X$lobj\"; then\n\tfunc_show_eval '$MV \"$output_obj\" \"$lobj\"' \\\n\t  'error=$?; $opt_dry_run || $RM $removelist; exit $error'\n      fi\n\n      # Allow error messages only from the first compilation.\n      if test \"$suppress_opt\" = yes; then\n\tsuppress_output=' >/dev/null 2>&1'\n      fi\n    fi\n\n    # Only build a position-dependent object if we build old libraries.\n    if test \"$build_old_libs\" = yes; then\n      if test \"$pic_mode\" != yes; then\n\t# Don't build PIC code\n\tcommand=\"$base_compile $qsrcfile$pie_flag\"\n      else\n\tcommand=\"$base_compile $qsrcfile $pic_flag\"\n      fi\n      if test \"$compiler_c_o\" = yes; then\n\tcommand=\"$command -o $obj\"\n      fi\n\n      # Suppress compiler output if we already did a PIC compilation.\n      command=\"$command$suppress_output\"\n      func_show_eval_locale \"$command\" \\\n        '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'\n\n      if test \"$need_locks\" = warn &&\n\t test \"X`cat $lockfile 2>/dev/null`\" != \"X$srcfile\"; then\n\t$ECHO \"\\\n*** ERROR, $lockfile contains:\n`cat $lockfile 2>/dev/null`\n\nbut it should contain:\n$srcfile\n\nThis indicates that another process is trying to use the same\ntemporary object file, and libtool could not work around it because\nyour compiler does not support \\`-c' and \\`-o' together.  If you\nrepeat this compilation, it may succeed, by chance, but you had better\navoid parallel builds (make -j) in this platform, or get a better\ncompiler.\"\n\n\t$opt_dry_run || $RM $removelist\n\texit $EXIT_FAILURE\n      fi\n\n      # Just move the object if needed\n      if test -n \"$output_obj\" && test \"X$output_obj\" != \"X$obj\"; then\n\tfunc_show_eval '$MV \"$output_obj\" \"$obj\"' \\\n\t  'error=$?; $opt_dry_run || $RM $removelist; exit $error'\n      fi\n    fi\n\n    $opt_dry_run || {\n      func_write_libtool_object \"$libobj\" \"$objdir/$objname\" \"$objname\"\n\n      # Unlock the critical section if it was locked\n      if test \"$need_locks\" != no; then\n\tremovelist=$lockfile\n        $RM \"$lockfile\"\n      fi\n    }\n\n    exit $EXIT_SUCCESS\n}\n\n$opt_help || {\ntest \"$mode\" = compile && func_mode_compile ${1+\"$@\"}\n}\n\nfunc_mode_help ()\n{\n    # We need to display help for each of the modes.\n    case $mode in\n      \"\")\n        # Generic help is extracted from the usage comments\n        # at the start of this file.\n        func_help\n        ;;\n\n      clean)\n        $ECHO \\\n\"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...\n\nRemove files from the build directory.\n\nRM is the name of the program to use to delete files associated with each FILE\n(typically \\`/bin/rm').  RM-OPTIONS are options (such as \\`-f') to be passed\nto RM.\n\nIf FILE is a libtool library, object or program, all the files associated\nwith it are deleted. Otherwise, only FILE itself is deleted using RM.\"\n        ;;\n\n      compile)\n      $ECHO \\\n\"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE\n\nCompile a source file into a libtool library object.\n\nThis mode accepts the following additional options:\n\n  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE\n  -no-suppress      do not suppress compiler output for multiple passes\n  -prefer-pic       try to building PIC objects only\n  -prefer-non-pic   try to building non-PIC objects only\n  -shared           do not build a \\`.o' file suitable for static linking\n  -static           only build a \\`.o' file suitable for static linking\n\nCOMPILE-COMMAND is a command to be used in creating a \\`standard' object file\nfrom the given SOURCEFILE.\n\nThe output file name is determined by removing the directory component from\nSOURCEFILE, then substituting the C source code suffix \\`.c' with the\nlibrary object suffix, \\`.lo'.\"\n        ;;\n\n      execute)\n        $ECHO \\\n\"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...\n\nAutomatically set library path, then run a program.\n\nThis mode accepts the following additional options:\n\n  -dlopen FILE      add the directory containing FILE to the library path\n\nThis mode sets the library path environment variable according to \\`-dlopen'\nflags.\n\nIf any of the ARGS are libtool executable wrappers, then they are translated\ninto their corresponding uninstalled binary, and any of their required library\ndirectories are added to the library path.\n\nThen, COMMAND is executed, with ARGS as arguments.\"\n        ;;\n\n      finish)\n        $ECHO \\\n\"Usage: $progname [OPTION]... --mode=finish [LIBDIR]...\n\nComplete the installation of libtool libraries.\n\nEach LIBDIR is a directory that contains libtool libraries.\n\nThe commands that this mode executes may require superuser privileges.  Use\nthe \\`--dry-run' option if you just want to see what would be executed.\"\n        ;;\n\n      install)\n        $ECHO \\\n\"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...\n\nInstall executables or libraries.\n\nINSTALL-COMMAND is the installation command.  The first component should be\neither the \\`install' or \\`cp' program.\n\nThe following components of INSTALL-COMMAND are treated specially:\n\n  -inst-prefix PREFIX-DIR  Use PREFIX-DIR as a staging area for installation\n\nThe rest of the components are interpreted as arguments to that command (only\nBSD-compatible install options are recognized).\"\n        ;;\n\n      link)\n        $ECHO \\\n\"Usage: $progname [OPTION]... --mode=link LINK-COMMAND...\n\nLink object files or libraries together to form another library, or to\ncreate an executable program.\n\nLINK-COMMAND is a command using the C compiler that you would use to create\na program from several object files.\n\nThe following components of LINK-COMMAND are treated specially:\n\n  -all-static       do not do any dynamic linking at all\n  -avoid-version    do not add a version suffix if possible\n  -dlopen FILE      \\`-dlpreopen' FILE if it cannot be dlopened at runtime\n  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols\n  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)\n  -export-symbols SYMFILE\n                    try to export only the symbols listed in SYMFILE\n  -export-symbols-regex REGEX\n                    try to export only the symbols matching REGEX\n  -LLIBDIR          search LIBDIR for required installed libraries\n  -lNAME            OUTPUT-FILE requires the installed library libNAME\n  -module           build a library that can dlopened\n  -no-fast-install  disable the fast-install mode\n  -no-install       link a not-installable executable\n  -no-undefined     declare that a library does not refer to external symbols\n  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects\n  -objectlist FILE  Use a list of object files found in FILE to specify objects\n  -precious-files-regex REGEX\n                    don't remove output files matching REGEX\n  -release RELEASE  specify package release information\n  -rpath LIBDIR     the created library will eventually be installed in LIBDIR\n  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries\n  -shared           only do dynamic linking of libtool libraries\n  -shrext SUFFIX    override the standard shared library file extension\n  -static           do not do any dynamic linking of uninstalled libtool libraries\n  -static-libtool-libs\n                    do not do any dynamic linking of libtool libraries\n  -version-info CURRENT[:REVISION[:AGE]]\n                    specify library version info [each variable defaults to 0]\n  -weak LIBNAME     declare that the target provides the LIBNAME interface\n\nAll other options (arguments beginning with \\`-') are ignored.\n\nEvery other argument is treated as a filename.  Files ending in \\`.la' are\ntreated as uninstalled libtool libraries, other files are standard or library\nobject files.\n\nIf the OUTPUT-FILE ends in \\`.la', then a libtool library is created,\nonly library objects (\\`.lo' files) may be specified, and \\`-rpath' is\nrequired, except when creating a convenience library.\n\nIf OUTPUT-FILE ends in \\`.a' or \\`.lib', then a standard library is created\nusing \\`ar' and \\`ranlib', or on Windows using \\`lib'.\n\nIf OUTPUT-FILE ends in \\`.lo' or \\`.${objext}', then a reloadable object file\nis created, otherwise an executable program is created.\"\n        ;;\n\n      uninstall)\n        $ECHO \\\n\"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...\n\nRemove libraries from an installation directory.\n\nRM is the name of the program to use to delete files associated with each FILE\n(typically \\`/bin/rm').  RM-OPTIONS are options (such as \\`-f') to be passed\nto RM.\n\nIf FILE is a libtool library, all the files associated with it are deleted.\nOtherwise, only FILE itself is deleted using RM.\"\n        ;;\n\n      *)\n        func_fatal_help \"invalid operation mode \\`$mode'\"\n        ;;\n    esac\n\n    $ECHO\n    $ECHO \"Try \\`$progname --help' for more information about other modes.\"\n\n    exit $?\n}\n\n  # Now that we've collected a possible --mode arg, show help if necessary\n  $opt_help && func_mode_help\n\n\n# func_mode_execute arg...\nfunc_mode_execute ()\n{\n    $opt_debug\n    # The first argument is the command name.\n    cmd=\"$nonopt\"\n    test -z \"$cmd\" && \\\n      func_fatal_help \"you must specify a COMMAND\"\n\n    # Handle -dlopen flags immediately.\n    for file in $execute_dlfiles; do\n      test -f \"$file\" \\\n\t|| func_fatal_help \"\\`$file' is not a file\"\n\n      dir=\n      case $file in\n      *.la)\n\t# Check to see that this really is a libtool archive.\n\tfunc_lalib_unsafe_p \"$file\" \\\n\t  || func_fatal_help \"\\`$lib' is not a valid libtool archive\"\n\n\t# Read the libtool library.\n\tdlname=\n\tlibrary_names=\n\tfunc_source \"$file\"\n\n\t# Skip this library if it cannot be dlopened.\n\tif test -z \"$dlname\"; then\n\t  # Warn if it was a shared library.\n\t  test -n \"$library_names\" && \\\n\t    func_warning \"\\`$file' was not linked with \\`-export-dynamic'\"\n\t  continue\n\tfi\n\n\tfunc_dirname \"$file\" \"\" \".\"\n\tdir=\"$func_dirname_result\"\n\n\tif test -f \"$dir/$objdir/$dlname\"; then\n\t  dir=\"$dir/$objdir\"\n\telse\n\t  if test ! -f \"$dir/$dlname\"; then\n\t    func_fatal_error \"cannot find \\`$dlname' in \\`$dir' or \\`$dir/$objdir'\"\n\t  fi\n\tfi\n\t;;\n\n      *.lo)\n\t# Just add the directory containing the .lo file.\n\tfunc_dirname \"$file\" \"\" \".\"\n\tdir=\"$func_dirname_result\"\n\t;;\n\n      *)\n\tfunc_warning \"\\`-dlopen' is ignored for non-libtool libraries and objects\"\n\tcontinue\n\t;;\n      esac\n\n      # Get the absolute pathname.\n      absdir=`cd \"$dir\" && pwd`\n      test -n \"$absdir\" && dir=\"$absdir\"\n\n      # Now add the directory to shlibpath_var.\n      if eval \"test -z \\\"\\$$shlibpath_var\\\"\"; then\n\teval \"$shlibpath_var=\\\"\\$dir\\\"\"\n      else\n\teval \"$shlibpath_var=\\\"\\$dir:\\$$shlibpath_var\\\"\"\n      fi\n    done\n\n    # This variable tells wrapper scripts just to set shlibpath_var\n    # rather than running their programs.\n    libtool_execute_magic=\"$magic\"\n\n    # Check if any of the arguments is a wrapper script.\n    args=\n    for file\n    do\n      case $file in\n      -*) ;;\n      *)\n\t# Do a test to see if this is really a libtool program.\n\tif func_ltwrapper_script_p \"$file\"; then\n\t  func_source \"$file\"\n\t  # Transform arg to wrapped name.\n\t  file=\"$progdir/$program\"\n\telif func_ltwrapper_executable_p \"$file\"; then\n\t  func_ltwrapper_scriptname \"$file\"\n\t  func_source \"$func_ltwrapper_scriptname_result\"\n\t  # Transform arg to wrapped name.\n\t  file=\"$progdir/$program\"\n\tfi\n\t;;\n      esac\n      # Quote arguments (to preserve shell metacharacters).\n      func_quote_for_eval \"$file\"\n      args=\"$args $func_quote_for_eval_result\"\n    done\n\n    if test \"X$opt_dry_run\" = Xfalse; then\n      if test -n \"$shlibpath_var\"; then\n\t# Export the shlibpath_var.\n\teval \"export $shlibpath_var\"\n      fi\n\n      # Restore saved environment variables\n      for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES\n      do\n\teval \"if test \\\"\\${save_$lt_var+set}\\\" = set; then\n                $lt_var=\\$save_$lt_var; export $lt_var\n\t      else\n\t\t$lt_unset $lt_var\n\t      fi\"\n      done\n\n      # Now prepare to actually exec the command.\n      exec_cmd=\"\\$cmd$args\"\n    else\n      # Display what would be done.\n      if test -n \"$shlibpath_var\"; then\n\teval \"\\$ECHO \\\"\\$shlibpath_var=\\$$shlibpath_var\\\"\"\n\t$ECHO \"export $shlibpath_var\"\n      fi\n      $ECHO \"$cmd$args\"\n      exit $EXIT_SUCCESS\n    fi\n}\n\ntest \"$mode\" = execute && func_mode_execute ${1+\"$@\"}\n\n\n# func_mode_finish arg...\nfunc_mode_finish ()\n{\n    $opt_debug\n    libdirs=\"$nonopt\"\n    admincmds=\n\n    if test -n \"$finish_cmds$finish_eval\" && test -n \"$libdirs\"; then\n      for dir\n      do\n\tlibdirs=\"$libdirs $dir\"\n      done\n\n      for libdir in $libdirs; do\n\tif test -n \"$finish_cmds\"; then\n\t  # Do each command in the finish commands.\n\t  func_execute_cmds \"$finish_cmds\" 'admincmds=\"$admincmds\n'\"$cmd\"'\"'\n\tfi\n\tif test -n \"$finish_eval\"; then\n\t  # Do the single finish_eval.\n\t  eval cmds=\\\"$finish_eval\\\"\n\t  $opt_dry_run || eval \"$cmds\" || admincmds=\"$admincmds\n       $cmds\"\n\tfi\n      done\n    fi\n\n    # Exit here if they wanted silent mode.\n    $opt_silent && exit $EXIT_SUCCESS\n\n    $ECHO \"X----------------------------------------------------------------------\" | $Xsed\n    $ECHO \"Libraries have been installed in:\"\n    for libdir in $libdirs; do\n      $ECHO \"   $libdir\"\n    done\n    $ECHO\n    $ECHO \"If you ever happen to want to link against installed libraries\"\n    $ECHO \"in a given directory, LIBDIR, you must either use libtool, and\"\n    $ECHO \"specify the full pathname of the library, or use the \\`-LLIBDIR'\"\n    $ECHO \"flag during linking and do at least one of the following:\"\n    if test -n \"$shlibpath_var\"; then\n      $ECHO \"   - add LIBDIR to the \\`$shlibpath_var' environment variable\"\n      $ECHO \"     during execution\"\n    fi\n    if test -n \"$runpath_var\"; then\n      $ECHO \"   - add LIBDIR to the \\`$runpath_var' environment variable\"\n      $ECHO \"     during linking\"\n    fi\n    if test -n \"$hardcode_libdir_flag_spec\"; then\n      libdir=LIBDIR\n      eval flag=\\\"$hardcode_libdir_flag_spec\\\"\n\n      $ECHO \"   - use the \\`$flag' linker flag\"\n    fi\n    if test -n \"$admincmds\"; then\n      $ECHO \"   - have your system administrator run these commands:$admincmds\"\n    fi\n    if test -f /etc/ld.so.conf; then\n      $ECHO \"   - have your system administrator add LIBDIR to \\`/etc/ld.so.conf'\"\n    fi\n    $ECHO\n\n    $ECHO \"See any operating system documentation about shared libraries for\"\n    case $host in\n      solaris2.[6789]|solaris2.1[0-9])\n        $ECHO \"more information, such as the ld(1), crle(1) and ld.so(8) manual\"\n\t$ECHO \"pages.\"\n\t;;\n      *)\n        $ECHO \"more information, such as the ld(1) and ld.so(8) manual pages.\"\n        ;;\n    esac\n    $ECHO \"X----------------------------------------------------------------------\" | $Xsed\n    exit $EXIT_SUCCESS\n}\n\ntest \"$mode\" = finish && func_mode_finish ${1+\"$@\"}\n\n\n# func_mode_install arg...\nfunc_mode_install ()\n{\n    $opt_debug\n    # There may be an optional sh(1) argument at the beginning of\n    # install_prog (especially on Windows NT).\n    if test \"$nonopt\" = \"$SHELL\" || test \"$nonopt\" = /bin/sh ||\n       # Allow the use of GNU shtool's install command.\n       $ECHO \"X$nonopt\" | $GREP shtool >/dev/null; then\n      # Aesthetically quote it.\n      func_quote_for_eval \"$nonopt\"\n      install_prog=\"$func_quote_for_eval_result \"\n      arg=$1\n      shift\n    else\n      install_prog=\n      arg=$nonopt\n    fi\n\n    # The real first argument should be the name of the installation program.\n    # Aesthetically quote it.\n    func_quote_for_eval \"$arg\"\n    install_prog=\"$install_prog$func_quote_for_eval_result\"\n\n    # We need to accept at least all the BSD install flags.\n    dest=\n    files=\n    opts=\n    prev=\n    install_type=\n    isdir=no\n    stripme=\n    for arg\n    do\n      if test -n \"$dest\"; then\n\tfiles=\"$files $dest\"\n\tdest=$arg\n\tcontinue\n      fi\n\n      case $arg in\n      -d) isdir=yes ;;\n      -f)\n\tcase \" $install_prog \" in\n\t*[\\\\\\ /]cp\\ *) ;;\n\t*) prev=$arg ;;\n\tesac\n\t;;\n      -g | -m | -o)\n\tprev=$arg\n\t;;\n      -s)\n\tstripme=\" -s\"\n\tcontinue\n\t;;\n      -*)\n\t;;\n      *)\n\t# If the previous option needed an argument, then skip it.\n\tif test -n \"$prev\"; then\n\t  prev=\n\telse\n\t  dest=$arg\n\t  continue\n\tfi\n\t;;\n      esac\n\n      # Aesthetically quote the argument.\n      func_quote_for_eval \"$arg\"\n      install_prog=\"$install_prog $func_quote_for_eval_result\"\n    done\n\n    test -z \"$install_prog\" && \\\n      func_fatal_help \"you must specify an install program\"\n\n    test -n \"$prev\" && \\\n      func_fatal_help \"the \\`$prev' option requires an argument\"\n\n    if test -z \"$files\"; then\n      if test -z \"$dest\"; then\n\tfunc_fatal_help \"no file or destination specified\"\n      else\n\tfunc_fatal_help \"you must specify a destination\"\n      fi\n    fi\n\n    # Strip any trailing slash from the destination.\n    func_stripname '' '/' \"$dest\"\n    dest=$func_stripname_result\n\n    # Check to see that the destination is a directory.\n    test -d \"$dest\" && isdir=yes\n    if test \"$isdir\" = yes; then\n      destdir=\"$dest\"\n      destname=\n    else\n      func_dirname_and_basename \"$dest\" \"\" \".\"\n      destdir=\"$func_dirname_result\"\n      destname=\"$func_basename_result\"\n\n      # Not a directory, so check to see that there is only one file specified.\n      set dummy $files; shift\n      test \"$#\" -gt 1 && \\\n\tfunc_fatal_help \"\\`$dest' is not a directory\"\n    fi\n    case $destdir in\n    [\\\\/]* | [A-Za-z]:[\\\\/]*) ;;\n    *)\n      for file in $files; do\n\tcase $file in\n\t*.lo) ;;\n\t*)\n\t  func_fatal_help \"\\`$destdir' must be an absolute directory name\"\n\t  ;;\n\tesac\n      done\n      ;;\n    esac\n\n    # This variable tells wrapper scripts just to set variables rather\n    # than running their programs.\n    libtool_install_magic=\"$magic\"\n\n    staticlibs=\n    future_libdirs=\n    current_libdirs=\n    for file in $files; do\n\n      # Do each installation.\n      case $file in\n      *.$libext)\n\t# Do the static libraries later.\n\tstaticlibs=\"$staticlibs $file\"\n\t;;\n\n      *.la)\n\t# Check to see that this really is a libtool archive.\n\tfunc_lalib_unsafe_p \"$file\" \\\n\t  || func_fatal_help \"\\`$file' is not a valid libtool archive\"\n\n\tlibrary_names=\n\told_library=\n\trelink_command=\n\tfunc_source \"$file\"\n\n\t# Add the libdir to current_libdirs if it is the destination.\n\tif test \"X$destdir\" = \"X$libdir\"; then\n\t  case \"$current_libdirs \" in\n\t  *\" $libdir \"*) ;;\n\t  *) current_libdirs=\"$current_libdirs $libdir\" ;;\n\t  esac\n\telse\n\t  # Note the libdir as a future libdir.\n\t  case \"$future_libdirs \" in\n\t  *\" $libdir \"*) ;;\n\t  *) future_libdirs=\"$future_libdirs $libdir\" ;;\n\t  esac\n\tfi\n\n\tfunc_dirname \"$file\" \"/\" \"\"\n\tdir=\"$func_dirname_result\"\n\tdir=\"$dir$objdir\"\n\n\tif test -n \"$relink_command\"; then\n\t  # Determine the prefix the user has applied to our future dir.\n\t  inst_prefix_dir=`$ECHO \"X$destdir\" | $Xsed -e \"s%$libdir\\$%%\"`\n\n\t  # Don't allow the user to place us outside of our expected\n\t  # location b/c this prevents finding dependent libraries that\n\t  # are installed to the same prefix.\n\t  # At present, this check doesn't affect windows .dll's that\n\t  # are installed into $libdir/../bin (currently, that works fine)\n\t  # but it's something to keep an eye on.\n\t  test \"$inst_prefix_dir\" = \"$destdir\" && \\\n\t    func_fatal_error \"error: cannot install \\`$file' to a directory not ending in $libdir\"\n\n\t  if test -n \"$inst_prefix_dir\"; then\n\t    # Stick the inst_prefix_dir data into the link command.\n\t    relink_command=`$ECHO \"X$relink_command\" | $Xsed -e \"s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%\"`\n\t  else\n\t    relink_command=`$ECHO \"X$relink_command\" | $Xsed -e \"s%@inst_prefix_dir@%%\"`\n\t  fi\n\n\t  func_warning \"relinking \\`$file'\"\n\t  func_show_eval \"$relink_command\" \\\n\t    'func_fatal_error \"error: relink \\`$file'\\'' with the above command before installing it\"'\n\tfi\n\n\t# See the names of the shared library.\n\tset dummy $library_names; shift\n\tif test -n \"$1\"; then\n\t  realname=\"$1\"\n\t  shift\n\n\t  srcname=\"$realname\"\n\t  test -n \"$relink_command\" && srcname=\"$realname\"T\n\n\t  # Install the shared library and build the symlinks.\n\t  func_show_eval \"$install_prog $dir/$srcname $destdir/$realname\" \\\n\t      'exit $?'\n\t  tstripme=\"$stripme\"\n\t  case $host_os in\n\t  cygwin* | mingw* | pw32* | cegcc*)\n\t    case $realname in\n\t    *.dll.a)\n\t      tstripme=\"\"\n\t      ;;\n\t    esac\n\t    ;;\n\t  esac\n\t  if test -n \"$tstripme\" && test -n \"$striplib\"; then\n\t    func_show_eval \"$striplib $destdir/$realname\" 'exit $?'\n\t  fi\n\n\t  if test \"$#\" -gt 0; then\n\t    # Delete the old symlinks, and create new ones.\n\t    # Try `ln -sf' first, because the `ln' binary might depend on\n\t    # the symlink we replace!  Solaris /bin/ln does not understand -f,\n\t    # so we also need to try rm && ln -s.\n\t    for linkname\n\t    do\n\t      test \"$linkname\" != \"$realname\" \\\n\t\t&& func_show_eval \"(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })\"\n\t    done\n\t  fi\n\n\t  # Do each command in the postinstall commands.\n\t  lib=\"$destdir/$realname\"\n\t  func_execute_cmds \"$postinstall_cmds\" 'exit $?'\n\tfi\n\n\t# Install the pseudo-library for information purposes.\n\tfunc_basename \"$file\"\n\tname=\"$func_basename_result\"\n\tinstname=\"$dir/$name\"i\n\tfunc_show_eval \"$install_prog $instname $destdir/$name\" 'exit $?'\n\n\t# Maybe install the static library, too.\n\ttest -n \"$old_library\" && staticlibs=\"$staticlibs $dir/$old_library\"\n\t;;\n\n      *.lo)\n\t# Install (i.e. copy) a libtool object.\n\n\t# Figure out destination file name, if it wasn't already specified.\n\tif test -n \"$destname\"; then\n\t  destfile=\"$destdir/$destname\"\n\telse\n\t  func_basename \"$file\"\n\t  destfile=\"$func_basename_result\"\n\t  destfile=\"$destdir/$destfile\"\n\tfi\n\n\t# Deduce the name of the destination old-style object file.\n\tcase $destfile in\n\t*.lo)\n\t  func_lo2o \"$destfile\"\n\t  staticdest=$func_lo2o_result\n\t  ;;\n\t*.$objext)\n\t  staticdest=\"$destfile\"\n\t  destfile=\n\t  ;;\n\t*)\n\t  func_fatal_help \"cannot copy a libtool object to \\`$destfile'\"\n\t  ;;\n\tesac\n\n\t# Install the libtool object if requested.\n\ttest -n \"$destfile\" && \\\n\t  func_show_eval \"$install_prog $file $destfile\" 'exit $?'\n\n\t# Install the old object if enabled.\n\tif test \"$build_old_libs\" = yes; then\n\t  # Deduce the name of the old-style object file.\n\t  func_lo2o \"$file\"\n\t  staticobj=$func_lo2o_result\n\t  func_show_eval \"$install_prog \\$staticobj \\$staticdest\" 'exit $?'\n\tfi\n\texit $EXIT_SUCCESS\n\t;;\n\n      *)\n\t# Figure out destination file name, if it wasn't already specified.\n\tif test -n \"$destname\"; then\n\t  destfile=\"$destdir/$destname\"\n\telse\n\t  func_basename \"$file\"\n\t  destfile=\"$func_basename_result\"\n\t  destfile=\"$destdir/$destfile\"\n\tfi\n\n\t# If the file is missing, and there is a .exe on the end, strip it\n\t# because it is most likely a libtool script we actually want to\n\t# install\n\tstripped_ext=\"\"\n\tcase $file in\n\t  *.exe)\n\t    if test ! -f \"$file\"; then\n\t      func_stripname '' '.exe' \"$file\"\n\t      file=$func_stripname_result\n\t      stripped_ext=\".exe\"\n\t    fi\n\t    ;;\n\tesac\n\n\t# Do a test to see if this is really a libtool program.\n\tcase $host in\n\t*cygwin* | *mingw*)\n\t    if func_ltwrapper_executable_p \"$file\"; then\n\t      func_ltwrapper_scriptname \"$file\"\n\t      wrapper=$func_ltwrapper_scriptname_result\n\t    else\n\t      func_stripname '' '.exe' \"$file\"\n\t      wrapper=$func_stripname_result\n\t    fi\n\t    ;;\n\t*)\n\t    wrapper=$file\n\t    ;;\n\tesac\n\tif func_ltwrapper_script_p \"$wrapper\"; then\n\t  notinst_deplibs=\n\t  relink_command=\n\n\t  func_source \"$wrapper\"\n\n\t  # Check the variables that should have been set.\n\t  test -z \"$generated_by_libtool_version\" && \\\n\t    func_fatal_error \"invalid libtool wrapper script \\`$wrapper'\"\n\n\t  finalize=yes\n\t  for lib in $notinst_deplibs; do\n\t    # Check to see that each library is installed.\n\t    libdir=\n\t    if test -f \"$lib\"; then\n\t      func_source \"$lib\"\n\t    fi\n\t    libfile=\"$libdir/\"`$ECHO \"X$lib\" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test\n\t    if test -n \"$libdir\" && test ! -f \"$libfile\"; then\n\t      func_warning \"\\`$lib' has not been installed in \\`$libdir'\"\n\t      finalize=no\n\t    fi\n\t  done\n\n\t  relink_command=\n\t  func_source \"$wrapper\"\n\n\t  outputname=\n\t  if test \"$fast_install\" = no && test -n \"$relink_command\"; then\n\t    $opt_dry_run || {\n\t      if test \"$finalize\" = yes; then\n\t        tmpdir=`func_mktempdir`\n\t\tfunc_basename \"$file$stripped_ext\"\n\t\tfile=\"$func_basename_result\"\n\t        outputname=\"$tmpdir/$file\"\n\t        # Replace the output file specification.\n\t        relink_command=`$ECHO \"X$relink_command\" | $Xsed -e 's%@OUTPUT@%'\"$outputname\"'%g'`\n\n\t        $opt_silent || {\n\t          func_quote_for_expand \"$relink_command\"\n\t\t  eval \"func_echo $func_quote_for_expand_result\"\n\t        }\n\t        if eval \"$relink_command\"; then :\n\t          else\n\t\t  func_error \"error: relink \\`$file' with the above command before installing it\"\n\t\t  $opt_dry_run || ${RM}r \"$tmpdir\"\n\t\t  continue\n\t        fi\n\t        file=\"$outputname\"\n\t      else\n\t        func_warning \"cannot relink \\`$file'\"\n\t      fi\n\t    }\n\t  else\n\t    # Install the binary that we compiled earlier.\n\t    file=`$ECHO \"X$file$stripped_ext\" | $Xsed -e \"s%\\([^/]*\\)$%$objdir/\\1%\"`\n\t  fi\n\tfi\n\n\t# remove .exe since cygwin /usr/bin/install will append another\n\t# one anyway\n\tcase $install_prog,$host in\n\t*/usr/bin/install*,*cygwin*)\n\t  case $file:$destfile in\n\t  *.exe:*.exe)\n\t    # this is ok\n\t    ;;\n\t  *.exe:*)\n\t    destfile=$destfile.exe\n\t    ;;\n\t  *:*.exe)\n\t    func_stripname '' '.exe' \"$destfile\"\n\t    destfile=$func_stripname_result\n\t    ;;\n\t  esac\n\t  ;;\n\tesac\n\tfunc_show_eval \"$install_prog\\$stripme \\$file \\$destfile\" 'exit $?'\n\t$opt_dry_run || if test -n \"$outputname\"; then\n\t  ${RM}r \"$tmpdir\"\n\tfi\n\t;;\n      esac\n    done\n\n    for file in $staticlibs; do\n      func_basename \"$file\"\n      name=\"$func_basename_result\"\n\n      # Set up the ranlib parameters.\n      oldlib=\"$destdir/$name\"\n\n      func_show_eval \"$install_prog \\$file \\$oldlib\" 'exit $?'\n\n      if test -n \"$stripme\" && test -n \"$old_striplib\"; then\n\tfunc_show_eval \"$old_striplib $oldlib\" 'exit $?'\n      fi\n\n      # Do each command in the postinstall commands.\n      func_execute_cmds \"$old_postinstall_cmds\" 'exit $?'\n    done\n\n    test -n \"$future_libdirs\" && \\\n      func_warning \"remember to run \\`$progname --finish$future_libdirs'\"\n\n    if test -n \"$current_libdirs\"; then\n      # Maybe just do a dry run.\n      $opt_dry_run && current_libdirs=\" -n$current_libdirs\"\n      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'\n    else\n      exit $EXIT_SUCCESS\n    fi\n}\n\ntest \"$mode\" = install && func_mode_install ${1+\"$@\"}\n\n\n# func_generate_dlsyms outputname originator pic_p\n# Extract symbols from dlprefiles and create ${outputname}S.o with\n# a dlpreopen symbol table.\nfunc_generate_dlsyms ()\n{\n    $opt_debug\n    my_outputname=\"$1\"\n    my_originator=\"$2\"\n    my_pic_p=\"${3-no}\"\n    my_prefix=`$ECHO \"$my_originator\" | sed 's%[^a-zA-Z0-9]%_%g'`\n    my_dlsyms=\n\n    if test -n \"$dlfiles$dlprefiles\" || test \"$dlself\" != no; then\n      if test -n \"$NM\" && test -n \"$global_symbol_pipe\"; then\n\tmy_dlsyms=\"${my_outputname}S.c\"\n      else\n\tfunc_error \"not configured to extract global symbols from dlpreopened files\"\n      fi\n    fi\n\n    if test -n \"$my_dlsyms\"; then\n      case $my_dlsyms in\n      \"\") ;;\n      *.c)\n\t# Discover the nlist of each of the dlfiles.\n\tnlist=\"$output_objdir/${my_outputname}.nm\"\n\n\tfunc_show_eval \"$RM $nlist ${nlist}S ${nlist}T\"\n\n\t# Parse the name list into a source file.\n\tfunc_verbose \"creating $output_objdir/$my_dlsyms\"\n\n\t$opt_dry_run || $ECHO > \"$output_objdir/$my_dlsyms\" \"\\\n/* $my_dlsyms - symbol resolution table for \\`$my_outputname' dlsym emulation. */\n/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */\n\n#ifdef __cplusplus\nextern \\\"C\\\" {\n#endif\n\n/* External symbol declarations for the compiler. */\\\n\"\n\n\tif test \"$dlself\" = yes; then\n\t  func_verbose \"generating symbol list for \\`$output'\"\n\n\t  $opt_dry_run || echo ': @PROGRAM@ ' > \"$nlist\"\n\n\t  # Add our own program objects to the symbol list.\n\t  progfiles=`$ECHO \"X$objs$old_deplibs\" | $SP2NL | $Xsed -e \"$lo2o\" | $NL2SP`\n\t  for progfile in $progfiles; do\n\t    func_verbose \"extracting global C symbols from \\`$progfile'\"\n\t    $opt_dry_run || eval \"$NM $progfile | $global_symbol_pipe >> '$nlist'\"\n\t  done\n\n\t  if test -n \"$exclude_expsyms\"; then\n\t    $opt_dry_run || {\n\t      eval '$EGREP -v \" ($exclude_expsyms)$\" \"$nlist\" > \"$nlist\"T'\n\t      eval '$MV \"$nlist\"T \"$nlist\"'\n\t    }\n\t  fi\n\n\t  if test -n \"$export_symbols_regex\"; then\n\t    $opt_dry_run || {\n\t      eval '$EGREP -e \"$export_symbols_regex\" \"$nlist\" > \"$nlist\"T'\n\t      eval '$MV \"$nlist\"T \"$nlist\"'\n\t    }\n\t  fi\n\n\t  # Prepare the list of exported symbols\n\t  if test -z \"$export_symbols\"; then\n\t    export_symbols=\"$output_objdir/$outputname.exp\"\n\t    $opt_dry_run || {\n\t      $RM $export_symbols\n\t      eval \"${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \\(.*\\)$/\\1/p' \"'< \"$nlist\" > \"$export_symbols\"'\n\t      case $host in\n\t      *cygwin* | *mingw* | *cegcc* )\n                eval \"echo EXPORTS \"'> \"$output_objdir/$outputname.def\"'\n                eval 'cat \"$export_symbols\" >> \"$output_objdir/$outputname.def\"'\n\t        ;;\n\t      esac\n\t    }\n\t  else\n\t    $opt_dry_run || {\n\t      eval \"${SED} -e 's/\\([].[*^$]\\)/\\\\\\\\\\1/g' -e 's/^/ /' -e 's/$/$/'\"' < \"$export_symbols\" > \"$output_objdir/$outputname.exp\"'\n\t      eval '$GREP -f \"$output_objdir/$outputname.exp\" < \"$nlist\" > \"$nlist\"T'\n\t      eval '$MV \"$nlist\"T \"$nlist\"'\n\t      case $host in\n\t        *cygwin | *mingw* | *cegcc* )\n\t          eval \"echo EXPORTS \"'> \"$output_objdir/$outputname.def\"'\n\t          eval 'cat \"$nlist\" >> \"$output_objdir/$outputname.def\"'\n\t          ;;\n\t      esac\n\t    }\n\t  fi\n\tfi\n\n\tfor dlprefile in $dlprefiles; do\n\t  func_verbose \"extracting global C symbols from \\`$dlprefile'\"\n\t  func_basename \"$dlprefile\"\n\t  name=\"$func_basename_result\"\n\t  $opt_dry_run || {\n\t    eval '$ECHO \": $name \" >> \"$nlist\"'\n\t    eval \"$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'\"\n\t  }\n\tdone\n\n\t$opt_dry_run || {\n\t  # Make sure we have at least an empty file.\n\t  test -f \"$nlist\" || : > \"$nlist\"\n\n\t  if test -n \"$exclude_expsyms\"; then\n\t    $EGREP -v \" ($exclude_expsyms)$\" \"$nlist\" > \"$nlist\"T\n\t    $MV \"$nlist\"T \"$nlist\"\n\t  fi\n\n\t  # Try sorting and uniquifying the output.\n\t  if $GREP -v \"^: \" < \"$nlist\" |\n\t      if sort -k 3 </dev/null >/dev/null 2>&1; then\n\t\tsort -k 3\n\t      else\n\t\tsort +2\n\t      fi |\n\t      uniq > \"$nlist\"S; then\n\t    :\n\t  else\n\t    $GREP -v \"^: \" < \"$nlist\" > \"$nlist\"S\n\t  fi\n\n\t  if test -f \"$nlist\"S; then\n\t    eval \"$global_symbol_to_cdecl\"' < \"$nlist\"S >> \"$output_objdir/$my_dlsyms\"'\n\t  else\n\t    $ECHO '/* NONE */' >> \"$output_objdir/$my_dlsyms\"\n\t  fi\n\n\t  $ECHO >> \"$output_objdir/$my_dlsyms\" \"\\\n\n/* The mapping between symbol names and symbols.  */\ntypedef struct {\n  const char *name;\n  void *address;\n} lt_dlsymlist;\n\"\n\t  case $host in\n\t  *cygwin* | *mingw* | *cegcc* )\n\t    $ECHO >> \"$output_objdir/$my_dlsyms\" \"\\\n/* DATA imports from DLLs on WIN32 con't be const, because\n   runtime relocations are performed -- see ld's documentation\n   on pseudo-relocs.  */\"\n\t    lt_dlsym_const= ;;\n\t  *osf5*)\n\t    echo >> \"$output_objdir/$my_dlsyms\" \"\\\n/* This system does not cope well with relocations in const data */\"\n\t    lt_dlsym_const= ;;\n\t  *)\n\t    lt_dlsym_const=const ;;\n\t  esac\n\n\t  $ECHO >> \"$output_objdir/$my_dlsyms\" \"\\\nextern $lt_dlsym_const lt_dlsymlist\nlt_${my_prefix}_LTX_preloaded_symbols[];\n$lt_dlsym_const lt_dlsymlist\nlt_${my_prefix}_LTX_preloaded_symbols[] =\n{\\\n  { \\\"$my_originator\\\", (void *) 0 },\"\n\n\t  case $need_lib_prefix in\n\t  no)\n\t    eval \"$global_symbol_to_c_name_address\" < \"$nlist\" >> \"$output_objdir/$my_dlsyms\"\n\t    ;;\n\t  *)\n\t    eval \"$global_symbol_to_c_name_address_lib_prefix\" < \"$nlist\" >> \"$output_objdir/$my_dlsyms\"\n\t    ;;\n\t  esac\n\t  $ECHO >> \"$output_objdir/$my_dlsyms\" \"\\\n  {0, (void *) 0}\n};\n\n/* This works around a problem in FreeBSD linker */\n#ifdef FREEBSD_WORKAROUND\nstatic const void *lt_preloaded_setup() {\n  return lt_${my_prefix}_LTX_preloaded_symbols;\n}\n#endif\n\n#ifdef __cplusplus\n}\n#endif\\\n\"\n\t} # !$opt_dry_run\n\n\tpic_flag_for_symtable=\n\tcase \"$compile_command \" in\n\t*\" -static \"*) ;;\n\t*)\n\t  case $host in\n\t  # compiling the symbol table file with pic_flag works around\n\t  # a FreeBSD bug that causes programs to crash when -lm is\n\t  # linked before any other PIC object.  But we must not use\n\t  # pic_flag when linking with -static.  The problem exists in\n\t  # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.\n\t  *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)\n\t    pic_flag_for_symtable=\" $pic_flag -DFREEBSD_WORKAROUND\" ;;\n\t  *-*-hpux*)\n\t    pic_flag_for_symtable=\" $pic_flag\"  ;;\n\t  *)\n\t    if test \"X$my_pic_p\" != Xno; then\n\t      pic_flag_for_symtable=\" $pic_flag\"\n\t    fi\n\t    ;;\n\t  esac\n\t  ;;\n\tesac\n\tsymtab_cflags=\n\tfor arg in $LTCFLAGS; do\n\t  case $arg in\n\t  -pie | -fpie | -fPIE) ;;\n\t  *) symtab_cflags=\"$symtab_cflags $arg\" ;;\n\t  esac\n\tdone\n\n\t# Now compile the dynamic symbol file.\n\tfunc_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable \"$my_dlsyms\")' 'exit $?'\n\n\t# Clean up the generated files.\n\tfunc_show_eval '$RM \"$output_objdir/$my_dlsyms\" \"$nlist\" \"${nlist}S\" \"${nlist}T\"'\n\n\t# Transform the symbol file into the correct name.\n\tsymfileobj=\"$output_objdir/${my_outputname}S.$objext\"\n\tcase $host in\n\t*cygwin* | *mingw* | *cegcc* )\n\t  if test -f \"$output_objdir/$my_outputname.def\"; then\n\t    compile_command=`$ECHO \"X$compile_command\" | $Xsed -e \"s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%\"`\n\t    finalize_command=`$ECHO \"X$finalize_command\" | $Xsed -e \"s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%\"`\n\t  else\n\t    compile_command=`$ECHO \"X$compile_command\" | $Xsed -e \"s%@SYMFILE@%$symfileobj%\"`\n\t    finalize_command=`$ECHO \"X$finalize_command\" | $Xsed -e \"s%@SYMFILE@%$symfileobj%\"`\n\t  fi\n\t  ;;\n\t*)\n\t  compile_command=`$ECHO \"X$compile_command\" | $Xsed -e \"s%@SYMFILE@%$symfileobj%\"`\n\t  finalize_command=`$ECHO \"X$finalize_command\" | $Xsed -e \"s%@SYMFILE@%$symfileobj%\"`\n\t  ;;\n\tesac\n\t;;\n      *)\n\tfunc_fatal_error \"unknown suffix for \\`$my_dlsyms'\"\n\t;;\n      esac\n    else\n      # We keep going just in case the user didn't refer to\n      # lt_preloaded_symbols.  The linker will fail if global_symbol_pipe\n      # really was required.\n\n      # Nullify the symbol file.\n      compile_command=`$ECHO \"X$compile_command\" | $Xsed -e \"s% @SYMFILE@%%\"`\n      finalize_command=`$ECHO \"X$finalize_command\" | $Xsed -e \"s% @SYMFILE@%%\"`\n    fi\n}\n\n# func_win32_libid arg\n# return the library type of file 'arg'\n#\n# Need a lot of goo to handle *both* DLLs and import libs\n# Has to be a shell function in order to 'eat' the argument\n# that is supplied when $file_magic_command is called.\nfunc_win32_libid ()\n{\n  $opt_debug\n  win32_libid_type=\"unknown\"\n  win32_fileres=`file -L $1 2>/dev/null`\n  case $win32_fileres in\n  *ar\\ archive\\ import\\ library*) # definitely import\n    win32_libid_type=\"x86 archive import\"\n    ;;\n  *ar\\ archive*) # could be an import, or static\n    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |\n       $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then\n      win32_nmres=`eval $NM -f posix -A $1 |\n\t$SED -n -e '\n\t    1,100{\n\t\t/ I /{\n\t\t    s,.*,import,\n\t\t    p\n\t\t    q\n\t\t}\n\t    }'`\n      case $win32_nmres in\n      import*)  win32_libid_type=\"x86 archive import\";;\n      *)        win32_libid_type=\"x86 archive static\";;\n      esac\n    fi\n    ;;\n  *DLL*)\n    win32_libid_type=\"x86 DLL\"\n    ;;\n  *executable*) # but shell scripts are \"executable\" too...\n    case $win32_fileres in\n    *MS\\ Windows\\ PE\\ Intel*)\n      win32_libid_type=\"x86 DLL\"\n      ;;\n    esac\n    ;;\n  esac\n  $ECHO \"$win32_libid_type\"\n}\n\n\n\n# func_extract_an_archive dir oldlib\nfunc_extract_an_archive ()\n{\n    $opt_debug\n    f_ex_an_ar_dir=\"$1\"; shift\n    f_ex_an_ar_oldlib=\"$1\"\n    func_show_eval \"(cd \\$f_ex_an_ar_dir && $AR x \\\"\\$f_ex_an_ar_oldlib\\\")\" 'exit $?'\n    if ($AR t \"$f_ex_an_ar_oldlib\" | sort | sort -uc >/dev/null 2>&1); then\n     :\n    else\n      func_fatal_error \"object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib\"\n    fi\n}\n\n\n# func_extract_archives gentop oldlib ...\nfunc_extract_archives ()\n{\n    $opt_debug\n    my_gentop=\"$1\"; shift\n    my_oldlibs=${1+\"$@\"}\n    my_oldobjs=\"\"\n    my_xlib=\"\"\n    my_xabs=\"\"\n    my_xdir=\"\"\n\n    for my_xlib in $my_oldlibs; do\n      # Extract the objects.\n      case $my_xlib in\n\t[\\\\/]* | [A-Za-z]:[\\\\/]*) my_xabs=\"$my_xlib\" ;;\n\t*) my_xabs=`pwd`\"/$my_xlib\" ;;\n      esac\n      func_basename \"$my_xlib\"\n      my_xlib=\"$func_basename_result\"\n      my_xlib_u=$my_xlib\n      while :; do\n        case \" $extracted_archives \" in\n\t*\" $my_xlib_u \"*)\n\t  func_arith $extracted_serial + 1\n\t  extracted_serial=$func_arith_result\n\t  my_xlib_u=lt$extracted_serial-$my_xlib ;;\n\t*) break ;;\n\tesac\n      done\n      extracted_archives=\"$extracted_archives $my_xlib_u\"\n      my_xdir=\"$my_gentop/$my_xlib_u\"\n\n      func_mkdir_p \"$my_xdir\"\n\n      case $host in\n      *-darwin*)\n\tfunc_verbose \"Extracting $my_xabs\"\n\t# Do not bother doing anything if just a dry run\n\t$opt_dry_run || {\n\t  darwin_orig_dir=`pwd`\n\t  cd $my_xdir || exit $?\n\t  darwin_archive=$my_xabs\n\t  darwin_curdir=`pwd`\n\t  darwin_base_archive=`basename \"$darwin_archive\"`\n\t  darwin_arches=`$LIPO -info \"$darwin_archive\" 2>/dev/null | $GREP Architectures 2>/dev/null || true`\n\t  if test -n \"$darwin_arches\"; then\n\t    darwin_arches=`$ECHO \"$darwin_arches\" | $SED -e 's/.*are://'`\n\t    darwin_arch=\n\t    func_verbose \"$darwin_base_archive has multiple architectures $darwin_arches\"\n\t    for darwin_arch in  $darwin_arches ; do\n\t      func_mkdir_p \"unfat-$$/${darwin_base_archive}-${darwin_arch}\"\n\t      $LIPO -thin $darwin_arch -output \"unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}\" \"${darwin_archive}\"\n\t      cd \"unfat-$$/${darwin_base_archive}-${darwin_arch}\"\n\t      func_extract_an_archive \"`pwd`\" \"${darwin_base_archive}\"\n\t      cd \"$darwin_curdir\"\n\t      $RM \"unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}\"\n\t    done # $darwin_arches\n            ## Okay now we've a bunch of thin objects, gotta fatten them up :)\n\t    darwin_filelist=`find unfat-$$ -type f -name \\*.o -print -o -name \\*.lo -print | $SED -e \"$basename\" | sort -u`\n\t    darwin_file=\n\t    darwin_files=\n\t    for darwin_file in $darwin_filelist; do\n\t      darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`\n\t      $LIPO -create -output \"$darwin_file\" $darwin_files\n\t    done # $darwin_filelist\n\t    $RM -rf unfat-$$\n\t    cd \"$darwin_orig_dir\"\n\t  else\n\t    cd $darwin_orig_dir\n\t    func_extract_an_archive \"$my_xdir\" \"$my_xabs\"\n\t  fi # $darwin_arches\n\t} # !$opt_dry_run\n\t;;\n      *)\n        func_extract_an_archive \"$my_xdir\" \"$my_xabs\"\n\t;;\n      esac\n      my_oldobjs=\"$my_oldobjs \"`find $my_xdir -name \\*.$objext -print -o -name \\*.lo -print | $NL2SP`\n    done\n\n    func_extract_archives_result=\"$my_oldobjs\"\n}\n\n\n\n# func_emit_wrapper_part1 [arg=no]\n#\n# Emit the first part of a libtool wrapper script on stdout.\n# For more information, see the description associated with\n# func_emit_wrapper(), below.\nfunc_emit_wrapper_part1 ()\n{\n\tfunc_emit_wrapper_part1_arg1=no\n\tif test -n \"$1\" ; then\n\t  func_emit_wrapper_part1_arg1=$1\n\tfi\n\n\t$ECHO \"\\\n#! $SHELL\n\n# $output - temporary wrapper script for $objdir/$outputname\n# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION\n#\n# The $output program cannot be directly executed until all the libtool\n# libraries that it depends on are installed.\n#\n# This wrapper script should never be moved out of the build directory.\n# If it is, it will not operate correctly.\n\n# Sed substitution that helps us do robust quoting.  It backslashifies\n# metacharacters that are still active within double-quoted strings.\nXsed='${SED} -e 1s/^X//'\nsed_quote_subst='$sed_quote_subst'\n\n# Be Bourne compatible\nif test -n \\\"\\${ZSH_VERSION+set}\\\" && (emulate sh) >/dev/null 2>&1; then\n  emulate sh\n  NULLCMD=:\n  # Zsh 3.x and 4.x performs word splitting on \\${1+\\\"\\$@\\\"}, which\n  # is contrary to our usage.  Disable this feature.\n  alias -g '\\${1+\\\"\\$@\\\"}'='\\\"\\$@\\\"'\n  setopt NO_GLOB_SUBST\nelse\n  case \\`(set -o) 2>/dev/null\\` in *posix*) set -o posix;; esac\nfi\nBIN_SH=xpg4; export BIN_SH # for Tru64\nDUALCASE=1; export DUALCASE # for MKS sh\n\n# The HP-UX ksh and POSIX shell print the target directory to stdout\n# if CDPATH is set.\n(unset CDPATH) >/dev/null 2>&1 && unset CDPATH\n\nrelink_command=\\\"$relink_command\\\"\n\n# This environment variable determines our operation mode.\nif test \\\"\\$libtool_install_magic\\\" = \\\"$magic\\\"; then\n  # install mode needs the following variables:\n  generated_by_libtool_version='$macro_version'\n  notinst_deplibs='$notinst_deplibs'\nelse\n  # When we are sourced in execute mode, \\$file and \\$ECHO are already set.\n  if test \\\"\\$libtool_execute_magic\\\" != \\\"$magic\\\"; then\n    ECHO=\\\"$qecho\\\"\n    file=\\\"\\$0\\\"\n    # Make sure echo works.\n    if test \\\"X\\$1\\\" = X--no-reexec; then\n      # Discard the --no-reexec flag, and continue.\n      shift\n    elif test \\\"X\\`{ \\$ECHO '\\t'; } 2>/dev/null\\`\\\" = 'X\\t'; then\n      # Yippee, \\$ECHO works!\n      :\n    else\n      # Restart under the correct shell, and then maybe \\$ECHO will work.\n      exec $SHELL \\\"\\$0\\\" --no-reexec \\${1+\\\"\\$@\\\"}\n    fi\n  fi\\\n\"\n\t$ECHO \"\\\n\n  # Find the directory that this script lives in.\n  thisdir=\\`\\$ECHO \\\"X\\$file\\\" | \\$Xsed -e 's%/[^/]*$%%'\\`\n  test \\\"x\\$thisdir\\\" = \\\"x\\$file\\\" && thisdir=.\n\n  # Follow symbolic links until we get to the real thisdir.\n  file=\\`ls -ld \\\"\\$file\\\" | ${SED} -n 's/.*-> //p'\\`\n  while test -n \\\"\\$file\\\"; do\n    destdir=\\`\\$ECHO \\\"X\\$file\\\" | \\$Xsed -e 's%/[^/]*\\$%%'\\`\n\n    # If there was a directory component, then change thisdir.\n    if test \\\"x\\$destdir\\\" != \\\"x\\$file\\\"; then\n      case \\\"\\$destdir\\\" in\n      [\\\\\\\\/]* | [A-Za-z]:[\\\\\\\\/]*) thisdir=\\\"\\$destdir\\\" ;;\n      *) thisdir=\\\"\\$thisdir/\\$destdir\\\" ;;\n      esac\n    fi\n\n    file=\\`\\$ECHO \\\"X\\$file\\\" | \\$Xsed -e 's%^.*/%%'\\`\n    file=\\`ls -ld \\\"\\$thisdir/\\$file\\\" | ${SED} -n 's/.*-> //p'\\`\n  done\n\"\n}\n# end: func_emit_wrapper_part1\n\n# func_emit_wrapper_part2 [arg=no]\n#\n# Emit the second part of a libtool wrapper script on stdout.\n# For more information, see the description associated with\n# func_emit_wrapper(), below.\nfunc_emit_wrapper_part2 ()\n{\n\tfunc_emit_wrapper_part2_arg1=no\n\tif test -n \"$1\" ; then\n\t  func_emit_wrapper_part2_arg1=$1\n\tfi\n\n\t$ECHO \"\\\n\n  # Usually 'no', except on cygwin/mingw when embedded into\n  # the cwrapper.\n  WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_part2_arg1\n  if test \\\"\\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\\\" = \\\"yes\\\"; then\n    # special case for '.'\n    if test \\\"\\$thisdir\\\" = \\\".\\\"; then\n      thisdir=\\`pwd\\`\n    fi\n    # remove .libs from thisdir\n    case \\\"\\$thisdir\\\" in\n    *[\\\\\\\\/]$objdir ) thisdir=\\`\\$ECHO \\\"X\\$thisdir\\\" | \\$Xsed -e 's%[\\\\\\\\/][^\\\\\\\\/]*$%%'\\` ;;\n    $objdir )   thisdir=. ;;\n    esac\n  fi\n\n  # Try to get the absolute directory name.\n  absdir=\\`cd \\\"\\$thisdir\\\" && pwd\\`\n  test -n \\\"\\$absdir\\\" && thisdir=\\\"\\$absdir\\\"\n\"\n\n\tif test \"$fast_install\" = yes; then\n\t  $ECHO \"\\\n  program=lt-'$outputname'$exeext\n  progdir=\\\"\\$thisdir/$objdir\\\"\n\n  if test ! -f \\\"\\$progdir/\\$program\\\" ||\n     { file=\\`ls -1dt \\\"\\$progdir/\\$program\\\" \\\"\\$progdir/../\\$program\\\" 2>/dev/null | ${SED} 1q\\`; \\\\\n       test \\\"X\\$file\\\" != \\\"X\\$progdir/\\$program\\\"; }; then\n\n    file=\\\"\\$\\$-\\$program\\\"\n\n    if test ! -d \\\"\\$progdir\\\"; then\n      $MKDIR \\\"\\$progdir\\\"\n    else\n      $RM \\\"\\$progdir/\\$file\\\"\n    fi\"\n\n\t  $ECHO \"\\\n\n    # relink executable if necessary\n    if test -n \\\"\\$relink_command\\\"; then\n      if relink_command_output=\\`eval \\$relink_command 2>&1\\`; then :\n      else\n\t$ECHO \\\"\\$relink_command_output\\\" >&2\n\t$RM \\\"\\$progdir/\\$file\\\"\n\texit 1\n      fi\n    fi\n\n    $MV \\\"\\$progdir/\\$file\\\" \\\"\\$progdir/\\$program\\\" 2>/dev/null ||\n    { $RM \\\"\\$progdir/\\$program\\\";\n      $MV \\\"\\$progdir/\\$file\\\" \\\"\\$progdir/\\$program\\\"; }\n    $RM \\\"\\$progdir/\\$file\\\"\n  fi\"\n\telse\n\t  $ECHO \"\\\n  program='$outputname'\n  progdir=\\\"\\$thisdir/$objdir\\\"\n\"\n\tfi\n\n\t$ECHO \"\\\n\n  if test -f \\\"\\$progdir/\\$program\\\"; then\"\n\n\t# Export our shlibpath_var if we have one.\n\tif test \"$shlibpath_overrides_runpath\" = yes && test -n \"$shlibpath_var\" && test -n \"$temp_rpath\"; then\n\t  $ECHO \"\\\n    # Add our own library path to $shlibpath_var\n    $shlibpath_var=\\\"$temp_rpath\\$$shlibpath_var\\\"\n\n    # Some systems cannot cope with colon-terminated $shlibpath_var\n    # The second colon is a workaround for a bug in BeOS R4 sed\n    $shlibpath_var=\\`\\$ECHO \\\"X\\$$shlibpath_var\\\" | \\$Xsed -e 's/::*\\$//'\\`\n\n    export $shlibpath_var\n\"\n\tfi\n\n\t# fixup the dll searchpath if we need to.\n\tif test -n \"$dllsearchpath\"; then\n\t  $ECHO \"\\\n    # Add the dll search path components to the executable PATH\n    PATH=$dllsearchpath:\\$PATH\n\"\n\tfi\n\n\t$ECHO \"\\\n    if test \\\"\\$libtool_execute_magic\\\" != \\\"$magic\\\"; then\n      # Run the actual program with our arguments.\n\"\n\tcase $host in\n\t# Backslashes separate directories on plain windows\n\t*-*-mingw | *-*-os2* | *-cegcc*)\n\t  $ECHO \"\\\n      exec \\\"\\$progdir\\\\\\\\\\$program\\\" \\${1+\\\"\\$@\\\"}\n\"\n\t  ;;\n\n\t*)\n\t  $ECHO \"\\\n      exec \\\"\\$progdir/\\$program\\\" \\${1+\\\"\\$@\\\"}\n\"\n\t  ;;\n\tesac\n\t$ECHO \"\\\n      \\$ECHO \\\"\\$0: cannot exec \\$program \\$*\\\" 1>&2\n      exit 1\n    fi\n  else\n    # The program doesn't exist.\n    \\$ECHO \\\"\\$0: error: \\\\\\`\\$progdir/\\$program' does not exist\\\" 1>&2\n    \\$ECHO \\\"This script is just a wrapper for \\$program.\\\" 1>&2\n    $ECHO \\\"See the $PACKAGE documentation for more information.\\\" 1>&2\n    exit 1\n  fi\nfi\\\n\"\n}\n# end: func_emit_wrapper_part2\n\n\n# func_emit_wrapper [arg=no]\n#\n# Emit a libtool wrapper script on stdout.\n# Don't directly open a file because we may want to\n# incorporate the script contents within a cygwin/mingw\n# wrapper executable.  Must ONLY be called from within\n# func_mode_link because it depends on a number of variables\n# set therein.\n#\n# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\n# variable will take.  If 'yes', then the emitted script\n# will assume that the directory in which it is stored is\n# the $objdir directory.  This is a cygwin/mingw-specific\n# behavior.\nfunc_emit_wrapper ()\n{\n\tfunc_emit_wrapper_arg1=no\n\tif test -n \"$1\" ; then\n\t  func_emit_wrapper_arg1=$1\n\tfi\n\n\t# split this up so that func_emit_cwrapperexe_src\n\t# can call each part independently.\n\tfunc_emit_wrapper_part1 \"${func_emit_wrapper_arg1}\"\n\tfunc_emit_wrapper_part2 \"${func_emit_wrapper_arg1}\"\n}\n\n\n# func_to_host_path arg\n#\n# Convert paths to host format when used with build tools.\n# Intended for use with \"native\" mingw (where libtool itself\n# is running under the msys shell), or in the following cross-\n# build environments:\n#    $build          $host\n#    mingw (msys)    mingw  [e.g. native]\n#    cygwin          mingw\n#    *nix + wine     mingw\n# where wine is equipped with the `winepath' executable.\n# In the native mingw case, the (msys) shell automatically\n# converts paths for any non-msys applications it launches,\n# but that facility isn't available from inside the cwrapper.\n# Similar accommodations are necessary for $host mingw and\n# $build cygwin.  Calling this function does no harm for other\n# $host/$build combinations not listed above.\n#\n# ARG is the path (on $build) that should be converted to\n# the proper representation for $host. The result is stored\n# in $func_to_host_path_result.\nfunc_to_host_path ()\n{\n  func_to_host_path_result=\"$1\"\n  if test -n \"$1\" ; then\n    case $host in\n      *mingw* )\n        lt_sed_naive_backslashify='s|\\\\\\\\*|\\\\|g;s|/|\\\\|g;s|\\\\|\\\\\\\\|g'\n        case $build in\n          *mingw* ) # actually, msys\n            # awkward: cmd appends spaces to result\n            lt_sed_strip_trailing_spaces=\"s/[ ]*\\$//\"\n            func_to_host_path_tmp1=`( cmd //c echo \"$1\" |\\\n              $SED -e \"$lt_sed_strip_trailing_spaces\" ) 2>/dev/null || echo \"\"`\n            func_to_host_path_result=`echo \"$func_to_host_path_tmp1\" |\\\n              $SED -e \"$lt_sed_naive_backslashify\"`\n            ;;\n          *cygwin* )\n            func_to_host_path_tmp1=`cygpath -w \"$1\"`\n            func_to_host_path_result=`echo \"$func_to_host_path_tmp1\" |\\\n              $SED -e \"$lt_sed_naive_backslashify\"`\n            ;;\n          * )\n            # Unfortunately, winepath does not exit with a non-zero\n            # error code, so we are forced to check the contents of\n            # stdout. On the other hand, if the command is not\n            # found, the shell will set an exit code of 127 and print\n            # *an error message* to stdout. So we must check for both\n            # error code of zero AND non-empty stdout, which explains\n            # the odd construction:\n            func_to_host_path_tmp1=`winepath -w \"$1\" 2>/dev/null`\n            if test \"$?\" -eq 0 && test -n \"${func_to_host_path_tmp1}\"; then\n              func_to_host_path_result=`echo \"$func_to_host_path_tmp1\" |\\\n                $SED -e \"$lt_sed_naive_backslashify\"`\n            else\n              # Allow warning below.\n              func_to_host_path_result=\"\"\n            fi\n            ;;\n        esac\n        if test -z \"$func_to_host_path_result\" ; then\n          func_error \"Could not determine host path corresponding to\"\n          func_error \"  '$1'\"\n          func_error \"Continuing, but uninstalled executables may not work.\"\n          # Fallback:\n          func_to_host_path_result=\"$1\"\n        fi\n        ;;\n    esac\n  fi\n}\n# end: func_to_host_path\n\n# func_to_host_pathlist arg\n#\n# Convert pathlists to host format when used with build tools.\n# See func_to_host_path(), above. This function supports the\n# following $build/$host combinations (but does no harm for\n# combinations not listed here):\n#    $build          $host\n#    mingw (msys)    mingw  [e.g. native]\n#    cygwin          mingw\n#    *nix + wine     mingw\n#\n# Path separators are also converted from $build format to\n# $host format. If ARG begins or ends with a path separator\n# character, it is preserved (but converted to $host format)\n# on output.\n#\n# ARG is a pathlist (on $build) that should be converted to\n# the proper representation on $host. The result is stored\n# in $func_to_host_pathlist_result.\nfunc_to_host_pathlist ()\n{\n  func_to_host_pathlist_result=\"$1\"\n  if test -n \"$1\" ; then\n    case $host in\n      *mingw* )\n        lt_sed_naive_backslashify='s|\\\\\\\\*|\\\\|g;s|/|\\\\|g;s|\\\\|\\\\\\\\|g'\n        # Remove leading and trailing path separator characters from\n        # ARG. msys behavior is inconsistent here, cygpath turns them\n        # into '.;' and ';.', and winepath ignores them completely.\n        func_to_host_pathlist_tmp2=\"$1\"\n        # Once set for this call, this variable should not be\n        # reassigned. It is used in tha fallback case.\n        func_to_host_pathlist_tmp1=`echo \"$func_to_host_pathlist_tmp2\" |\\\n          $SED -e 's|^:*||' -e 's|:*$||'`\n        case $build in\n          *mingw* ) # Actually, msys.\n            # Awkward: cmd appends spaces to result.\n            lt_sed_strip_trailing_spaces=\"s/[ ]*\\$//\"\n            func_to_host_pathlist_tmp2=`( cmd //c echo \"$func_to_host_pathlist_tmp1\" |\\\n              $SED -e \"$lt_sed_strip_trailing_spaces\" ) 2>/dev/null || echo \"\"`\n            func_to_host_pathlist_result=`echo \"$func_to_host_pathlist_tmp2\" |\\\n              $SED -e \"$lt_sed_naive_backslashify\"`\n            ;;\n          *cygwin* )\n            func_to_host_pathlist_tmp2=`cygpath -w -p \"$func_to_host_pathlist_tmp1\"`\n            func_to_host_pathlist_result=`echo \"$func_to_host_pathlist_tmp2\" |\\\n              $SED -e \"$lt_sed_naive_backslashify\"`\n            ;;\n          * )\n            # unfortunately, winepath doesn't convert pathlists\n            func_to_host_pathlist_result=\"\"\n            func_to_host_pathlist_oldIFS=$IFS\n            IFS=:\n            for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do\n              IFS=$func_to_host_pathlist_oldIFS\n              if test -n \"$func_to_host_pathlist_f\" ; then\n                func_to_host_path \"$func_to_host_pathlist_f\"\n                if test -n \"$func_to_host_path_result\" ; then\n                  if test -z \"$func_to_host_pathlist_result\" ; then\n                    func_to_host_pathlist_result=\"$func_to_host_path_result\"\n                  else\n                    func_to_host_pathlist_result=\"$func_to_host_pathlist_result;$func_to_host_path_result\"\n                  fi\n                fi\n              fi\n              IFS=:\n            done\n            IFS=$func_to_host_pathlist_oldIFS\n            ;;\n        esac\n        if test -z \"$func_to_host_pathlist_result\" ; then\n          func_error \"Could not determine the host path(s) corresponding to\"\n          func_error \"  '$1'\"\n          func_error \"Continuing, but uninstalled executables may not work.\"\n          # Fallback. This may break if $1 contains DOS-style drive\n          # specifications. The fix is not to complicate the expression\n          # below, but for the user to provide a working wine installation\n          # with winepath so that path translation in the cross-to-mingw\n          # case works properly.\n          lt_replace_pathsep_nix_to_dos=\"s|:|;|g\"\n          func_to_host_pathlist_result=`echo \"$func_to_host_pathlist_tmp1\" |\\\n            $SED -e \"$lt_replace_pathsep_nix_to_dos\"`\n        fi\n        # Now, add the leading and trailing path separators back\n        case \"$1\" in\n          :* ) func_to_host_pathlist_result=\";$func_to_host_pathlist_result\"\n            ;;\n        esac\n        case \"$1\" in\n          *: ) func_to_host_pathlist_result=\"$func_to_host_pathlist_result;\"\n            ;;\n        esac\n        ;;\n    esac\n  fi\n}\n# end: func_to_host_pathlist\n\n# func_emit_cwrapperexe_src\n# emit the source code for a wrapper executable on stdout\n# Must ONLY be called from within func_mode_link because\n# it depends on a number of variable set therein.\nfunc_emit_cwrapperexe_src ()\n{\n\tcat <<EOF\n\n/* $cwrappersource - temporary wrapper executable for $objdir/$outputname\n   Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION\n\n   The $output program cannot be directly executed until all the libtool\n   libraries that it depends on are installed.\n\n   This wrapper executable should never be moved out of the build directory.\n   If it is, it will not operate correctly.\n\n   Currently, it simply execs the wrapper *script* \"$SHELL $output\",\n   but could eventually absorb all of the scripts functionality and\n   exec $objdir/$outputname directly.\n*/\nEOF\n\t    cat <<\"EOF\"\n#include <stdio.h>\n#include <stdlib.h>\n#ifdef _MSC_VER\n# include <direct.h>\n# include <process.h>\n# include <io.h>\n# define setmode _setmode\n#else\n# include <unistd.h>\n# include <stdint.h>\n# ifdef __CYGWIN__\n#  include <io.h>\n#  define HAVE_SETENV\n#  ifdef __STRICT_ANSI__\nchar *realpath (const char *, char *);\nint putenv (char *);\nint setenv (const char *, const char *, int);\n#  endif\n# endif\n#endif\n#include <malloc.h>\n#include <stdarg.h>\n#include <assert.h>\n#include <string.h>\n#include <ctype.h>\n#include <errno.h>\n#include <fcntl.h>\n#include <sys/stat.h>\n\n#if defined(PATH_MAX)\n# define LT_PATHMAX PATH_MAX\n#elif defined(MAXPATHLEN)\n# define LT_PATHMAX MAXPATHLEN\n#else\n# define LT_PATHMAX 1024\n#endif\n\n#ifndef S_IXOTH\n# define S_IXOTH 0\n#endif\n#ifndef S_IXGRP\n# define S_IXGRP 0\n#endif\n\n#ifdef _MSC_VER\n# define S_IXUSR _S_IEXEC\n# define stat _stat\n# ifndef _INTPTR_T_DEFINED\n#  define intptr_t int\n# endif\n#endif\n\n#ifndef DIR_SEPARATOR\n# define DIR_SEPARATOR '/'\n# define PATH_SEPARATOR ':'\n#endif\n\n#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \\\n  defined (__OS2__)\n# define HAVE_DOS_BASED_FILE_SYSTEM\n# define FOPEN_WB \"wb\"\n# ifndef DIR_SEPARATOR_2\n#  define DIR_SEPARATOR_2 '\\\\'\n# endif\n# ifndef PATH_SEPARATOR_2\n#  define PATH_SEPARATOR_2 ';'\n# endif\n#endif\n\n#ifndef DIR_SEPARATOR_2\n# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)\n#else /* DIR_SEPARATOR_2 */\n# define IS_DIR_SEPARATOR(ch) \\\n\t(((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))\n#endif /* DIR_SEPARATOR_2 */\n\n#ifndef PATH_SEPARATOR_2\n# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)\n#else /* PATH_SEPARATOR_2 */\n# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)\n#endif /* PATH_SEPARATOR_2 */\n\n#ifdef __CYGWIN__\n# define FOPEN_WB \"wb\"\n#endif\n\n#ifndef FOPEN_WB\n# define FOPEN_WB \"w\"\n#endif\n#ifndef _O_BINARY\n# define _O_BINARY 0\n#endif\n\n#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))\n#define XFREE(stale) do { \\\n  if (stale) { free ((void *) stale); stale = 0; } \\\n} while (0)\n\n#undef LTWRAPPER_DEBUGPRINTF\n#if defined DEBUGWRAPPER\n# define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args\nstatic void\nltwrapper_debugprintf (const char *fmt, ...)\n{\n    va_list args;\n    va_start (args, fmt);\n    (void) vfprintf (stderr, fmt, args);\n    va_end (args);\n}\n#else\n# define LTWRAPPER_DEBUGPRINTF(args)\n#endif\n\nconst char *program_name = NULL;\n\nvoid *xmalloc (size_t num);\nchar *xstrdup (const char *string);\nconst char *base_name (const char *name);\nchar *find_executable (const char *wrapper);\nchar *chase_symlinks (const char *pathspec);\nint make_executable (const char *path);\nint check_executable (const char *path);\nchar *strendzap (char *str, const char *pat);\nvoid lt_fatal (const char *message, ...);\nvoid lt_setenv (const char *name, const char *value);\nchar *lt_extend_str (const char *orig_value, const char *add, int to_end);\nvoid lt_opt_process_env_set (const char *arg);\nvoid lt_opt_process_env_prepend (const char *arg);\nvoid lt_opt_process_env_append (const char *arg);\nint lt_split_name_value (const char *arg, char** name, char** value);\nvoid lt_update_exe_path (const char *name, const char *value);\nvoid lt_update_lib_path (const char *name, const char *value);\n\nstatic const char *script_text_part1 =\nEOF\n\n\t    func_emit_wrapper_part1 yes |\n\t        $SED -e 's/\\([\\\\\"]\\)/\\\\\\1/g' \\\n\t             -e 's/^/  \"/' -e 's/$/\\\\n\"/'\n\t    echo \";\"\n\t    cat <<EOF\n\nstatic const char *script_text_part2 =\nEOF\n\t    func_emit_wrapper_part2 yes |\n\t        $SED -e 's/\\([\\\\\"]\\)/\\\\\\1/g' \\\n\t             -e 's/^/  \"/' -e 's/$/\\\\n\"/'\n\t    echo \";\"\n\n\t    cat <<EOF\nconst char * MAGIC_EXE = \"$magic_exe\";\nconst char * LIB_PATH_VARNAME = \"$shlibpath_var\";\nEOF\n\n\t    if test \"$shlibpath_overrides_runpath\" = yes && test -n \"$shlibpath_var\" && test -n \"$temp_rpath\"; then\n              func_to_host_pathlist \"$temp_rpath\"\n\t      cat <<EOF\nconst char * LIB_PATH_VALUE   = \"$func_to_host_pathlist_result\";\nEOF\n\t    else\n\t      cat <<\"EOF\"\nconst char * LIB_PATH_VALUE   = \"\";\nEOF\n\t    fi\n\n\t    if test -n \"$dllsearchpath\"; then\n              func_to_host_pathlist \"$dllsearchpath:\"\n\t      cat <<EOF\nconst char * EXE_PATH_VARNAME = \"PATH\";\nconst char * EXE_PATH_VALUE   = \"$func_to_host_pathlist_result\";\nEOF\n\t    else\n\t      cat <<\"EOF\"\nconst char * EXE_PATH_VARNAME = \"\";\nconst char * EXE_PATH_VALUE   = \"\";\nEOF\n\t    fi\n\n\t    if test \"$fast_install\" = yes; then\n\t      cat <<EOF\nconst char * TARGET_PROGRAM_NAME = \"lt-$outputname\"; /* hopefully, no .exe */\nEOF\n\t    else\n\t      cat <<EOF\nconst char * TARGET_PROGRAM_NAME = \"$outputname\"; /* hopefully, no .exe */\nEOF\n\t    fi\n\n\n\t    cat <<\"EOF\"\n\n#define LTWRAPPER_OPTION_PREFIX         \"--lt-\"\n#define LTWRAPPER_OPTION_PREFIX_LENGTH  5\n\nstatic const size_t opt_prefix_len         = LTWRAPPER_OPTION_PREFIX_LENGTH;\nstatic const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;\n\nstatic const char *dumpscript_opt       = LTWRAPPER_OPTION_PREFIX \"dump-script\";\n\nstatic const size_t env_set_opt_len     = LTWRAPPER_OPTION_PREFIX_LENGTH + 7;\nstatic const char *env_set_opt          = LTWRAPPER_OPTION_PREFIX \"env-set\";\n  /* argument is putenv-style \"foo=bar\", value of foo is set to bar */\n\nstatic const size_t env_prepend_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 11;\nstatic const char *env_prepend_opt      = LTWRAPPER_OPTION_PREFIX \"env-prepend\";\n  /* argument is putenv-style \"foo=bar\", new value of foo is bar${foo} */\n\nstatic const size_t env_append_opt_len  = LTWRAPPER_OPTION_PREFIX_LENGTH + 10;\nstatic const char *env_append_opt       = LTWRAPPER_OPTION_PREFIX \"env-append\";\n  /* argument is putenv-style \"foo=bar\", new value of foo is ${foo}bar */\n\nint\nmain (int argc, char *argv[])\n{\n  char **newargz;\n  int  newargc;\n  char *tmp_pathspec;\n  char *actual_cwrapper_path;\n  char *actual_cwrapper_name;\n  char *target_name;\n  char *lt_argv_zero;\n  intptr_t rval = 127;\n\n  int i;\n\n  program_name = (char *) xstrdup (base_name (argv[0]));\n  LTWRAPPER_DEBUGPRINTF ((\"(main) argv[0]      : %s\\n\", argv[0]));\n  LTWRAPPER_DEBUGPRINTF ((\"(main) program_name : %s\\n\", program_name));\n\n  /* very simple arg parsing; don't want to rely on getopt */\n  for (i = 1; i < argc; i++)\n    {\n      if (strcmp (argv[i], dumpscript_opt) == 0)\n\t{\nEOF\n\t    case \"$host\" in\n\t      *mingw* | *cygwin* )\n\t\t# make stdout use \"unix\" line endings\n\t\techo \"          setmode(1,_O_BINARY);\"\n\t\t;;\n\t      esac\n\n\t    cat <<\"EOF\"\n\t  printf (\"%s\", script_text_part1);\n\t  printf (\"%s\", script_text_part2);\n\t  return 0;\n\t}\n    }\n\n  newargz = XMALLOC (char *, argc + 1);\n  tmp_pathspec = find_executable (argv[0]);\n  if (tmp_pathspec == NULL)\n    lt_fatal (\"Couldn't find %s\", argv[0]);\n  LTWRAPPER_DEBUGPRINTF ((\"(main) found exe (before symlink chase) at : %s\\n\",\n\t\t\t  tmp_pathspec));\n\n  actual_cwrapper_path = chase_symlinks (tmp_pathspec);\n  LTWRAPPER_DEBUGPRINTF ((\"(main) found exe (after symlink chase) at : %s\\n\",\n\t\t\t  actual_cwrapper_path));\n  XFREE (tmp_pathspec);\n\n  actual_cwrapper_name = xstrdup( base_name (actual_cwrapper_path));\n  strendzap (actual_cwrapper_path, actual_cwrapper_name);\n\n  /* wrapper name transforms */\n  strendzap (actual_cwrapper_name, \".exe\");\n  tmp_pathspec = lt_extend_str (actual_cwrapper_name, \".exe\", 1);\n  XFREE (actual_cwrapper_name);\n  actual_cwrapper_name = tmp_pathspec;\n  tmp_pathspec = 0;\n\n  /* target_name transforms -- use actual target program name; might have lt- prefix */\n  target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));\n  strendzap (target_name, \".exe\");\n  tmp_pathspec = lt_extend_str (target_name, \".exe\", 1);\n  XFREE (target_name);\n  target_name = tmp_pathspec;\n  tmp_pathspec = 0;\n\n  LTWRAPPER_DEBUGPRINTF ((\"(main) libtool target name: %s\\n\",\n\t\t\t  target_name));\nEOF\n\n\t    cat <<EOF\n  newargz[0] =\n    XMALLOC (char, (strlen (actual_cwrapper_path) +\n\t\t    strlen (\"$objdir\") + 1 + strlen (actual_cwrapper_name) + 1));\n  strcpy (newargz[0], actual_cwrapper_path);\n  strcat (newargz[0], \"$objdir\");\n  strcat (newargz[0], \"/\");\nEOF\n\n\t    cat <<\"EOF\"\n  /* stop here, and copy so we don't have to do this twice */\n  tmp_pathspec = xstrdup (newargz[0]);\n\n  /* do NOT want the lt- prefix here, so use actual_cwrapper_name */\n  strcat (newargz[0], actual_cwrapper_name);\n\n  /* DO want the lt- prefix here if it exists, so use target_name */\n  lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);\n  XFREE (tmp_pathspec);\n  tmp_pathspec = NULL;\nEOF\n\n\t    case $host_os in\n\t      mingw*)\n\t    cat <<\"EOF\"\n  {\n    char* p;\n    while ((p = strchr (newargz[0], '\\\\')) != NULL)\n      {\n\t*p = '/';\n      }\n    while ((p = strchr (lt_argv_zero, '\\\\')) != NULL)\n      {\n\t*p = '/';\n      }\n  }\nEOF\n\t    ;;\n\t    esac\n\n\t    cat <<\"EOF\"\n  XFREE (target_name);\n  XFREE (actual_cwrapper_path);\n  XFREE (actual_cwrapper_name);\n\n  lt_setenv (\"BIN_SH\", \"xpg4\"); /* for Tru64 */\n  lt_setenv (\"DUALCASE\", \"1\");  /* for MSK sh */\n  lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);\n  lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);\n\n  newargc=0;\n  for (i = 1; i < argc; i++)\n    {\n      if (strncmp (argv[i], env_set_opt, env_set_opt_len) == 0)\n        {\n          if (argv[i][env_set_opt_len] == '=')\n            {\n              const char *p = argv[i] + env_set_opt_len + 1;\n              lt_opt_process_env_set (p);\n            }\n          else if (argv[i][env_set_opt_len] == '\\0' && i + 1 < argc)\n            {\n              lt_opt_process_env_set (argv[++i]); /* don't copy */\n            }\n          else\n            lt_fatal (\"%s missing required argument\", env_set_opt);\n          continue;\n        }\n      if (strncmp (argv[i], env_prepend_opt, env_prepend_opt_len) == 0)\n        {\n          if (argv[i][env_prepend_opt_len] == '=')\n            {\n              const char *p = argv[i] + env_prepend_opt_len + 1;\n              lt_opt_process_env_prepend (p);\n            }\n          else if (argv[i][env_prepend_opt_len] == '\\0' && i + 1 < argc)\n            {\n              lt_opt_process_env_prepend (argv[++i]); /* don't copy */\n            }\n          else\n            lt_fatal (\"%s missing required argument\", env_prepend_opt);\n          continue;\n        }\n      if (strncmp (argv[i], env_append_opt, env_append_opt_len) == 0)\n        {\n          if (argv[i][env_append_opt_len] == '=')\n            {\n              const char *p = argv[i] + env_append_opt_len + 1;\n              lt_opt_process_env_append (p);\n            }\n          else if (argv[i][env_append_opt_len] == '\\0' && i + 1 < argc)\n            {\n              lt_opt_process_env_append (argv[++i]); /* don't copy */\n            }\n          else\n            lt_fatal (\"%s missing required argument\", env_append_opt);\n          continue;\n        }\n      if (strncmp (argv[i], ltwrapper_option_prefix, opt_prefix_len) == 0)\n        {\n          /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX\n             namespace, but it is not one of the ones we know about and\n             have already dealt with, above (inluding dump-script), then\n             report an error. Otherwise, targets might begin to believe\n             they are allowed to use options in the LTWRAPPER_OPTION_PREFIX\n             namespace. The first time any user complains about this, we'll\n             need to make LTWRAPPER_OPTION_PREFIX a configure-time option\n             or a configure.ac-settable value.\n           */\n          lt_fatal (\"Unrecognized option in %s namespace: '%s'\",\n                    ltwrapper_option_prefix, argv[i]);\n        }\n      /* otherwise ... */\n      newargz[++newargc] = xstrdup (argv[i]);\n    }\n  newargz[++newargc] = NULL;\n\n  LTWRAPPER_DEBUGPRINTF     ((\"(main) lt_argv_zero : %s\\n\", (lt_argv_zero ? lt_argv_zero : \"<NULL>\")));\n  for (i = 0; i < newargc; i++)\n    {\n      LTWRAPPER_DEBUGPRINTF ((\"(main) newargz[%d]   : %s\\n\", i, (newargz[i] ? newargz[i] : \"<NULL>\")));\n    }\n\nEOF\n\n\t    case $host_os in\n\t      mingw*)\n\t\tcat <<\"EOF\"\n  /* execv doesn't actually work on mingw as expected on unix */\n  rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);\n  if (rval == -1)\n    {\n      /* failed to start process */\n      LTWRAPPER_DEBUGPRINTF ((\"(main) failed to launch target \\\"%s\\\": errno = %d\\n\", lt_argv_zero, errno));\n      return 127;\n    }\n  return rval;\nEOF\n\t\t;;\n\t      *)\n\t\tcat <<\"EOF\"\n  execv (lt_argv_zero, newargz);\n  return rval; /* =127, but avoids unused variable warning */\nEOF\n\t\t;;\n\t    esac\n\n\t    cat <<\"EOF\"\n}\n\nvoid *\nxmalloc (size_t num)\n{\n  void *p = (void *) malloc (num);\n  if (!p)\n    lt_fatal (\"Memory exhausted\");\n\n  return p;\n}\n\nchar *\nxstrdup (const char *string)\n{\n  return string ? strcpy ((char *) xmalloc (strlen (string) + 1),\n\t\t\t  string) : NULL;\n}\n\nconst char *\nbase_name (const char *name)\n{\n  const char *base;\n\n#if defined (HAVE_DOS_BASED_FILE_SYSTEM)\n  /* Skip over the disk name in MSDOS pathnames. */\n  if (isalpha ((unsigned char) name[0]) && name[1] == ':')\n    name += 2;\n#endif\n\n  for (base = name; *name; name++)\n    if (IS_DIR_SEPARATOR (*name))\n      base = name + 1;\n  return base;\n}\n\nint\ncheck_executable (const char *path)\n{\n  struct stat st;\n\n  LTWRAPPER_DEBUGPRINTF ((\"(check_executable)  : %s\\n\",\n\t\t\t  path ? (*path ? path : \"EMPTY!\") : \"NULL!\"));\n  if ((!path) || (!*path))\n    return 0;\n\n  if ((stat (path, &st) >= 0)\n      && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))\n    return 1;\n  else\n    return 0;\n}\n\nint\nmake_executable (const char *path)\n{\n  int rval = 0;\n  struct stat st;\n\n  LTWRAPPER_DEBUGPRINTF ((\"(make_executable)   : %s\\n\",\n\t\t\t  path ? (*path ? path : \"EMPTY!\") : \"NULL!\"));\n  if ((!path) || (!*path))\n    return 0;\n\n  if (stat (path, &st) >= 0)\n    {\n      rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);\n    }\n  return rval;\n}\n\n/* Searches for the full path of the wrapper.  Returns\n   newly allocated full path name if found, NULL otherwise\n   Does not chase symlinks, even on platforms that support them.\n*/\nchar *\nfind_executable (const char *wrapper)\n{\n  int has_slash = 0;\n  const char *p;\n  const char *p_next;\n  /* static buffer for getcwd */\n  char tmp[LT_PATHMAX + 1];\n  int tmp_len;\n  char *concat_name;\n\n  LTWRAPPER_DEBUGPRINTF ((\"(find_executable)   : %s\\n\",\n\t\t\t  wrapper ? (*wrapper ? wrapper : \"EMPTY!\") : \"NULL!\"));\n\n  if ((wrapper == NULL) || (*wrapper == '\\0'))\n    return NULL;\n\n  /* Absolute path? */\n#if defined (HAVE_DOS_BASED_FILE_SYSTEM)\n  if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')\n    {\n      concat_name = xstrdup (wrapper);\n      if (check_executable (concat_name))\n\treturn concat_name;\n      XFREE (concat_name);\n    }\n  else\n    {\n#endif\n      if (IS_DIR_SEPARATOR (wrapper[0]))\n\t{\n\t  concat_name = xstrdup (wrapper);\n\t  if (check_executable (concat_name))\n\t    return concat_name;\n\t  XFREE (concat_name);\n\t}\n#if defined (HAVE_DOS_BASED_FILE_SYSTEM)\n    }\n#endif\n\n  for (p = wrapper; *p; p++)\n    if (*p == '/')\n      {\n\thas_slash = 1;\n\tbreak;\n      }\n  if (!has_slash)\n    {\n      /* no slashes; search PATH */\n      const char *path = getenv (\"PATH\");\n      if (path != NULL)\n\t{\n\t  for (p = path; *p; p = p_next)\n\t    {\n\t      const char *q;\n\t      size_t p_len;\n\t      for (q = p; *q; q++)\n\t\tif (IS_PATH_SEPARATOR (*q))\n\t\t  break;\n\t      p_len = q - p;\n\t      p_next = (*q == '\\0' ? q : q + 1);\n\t      if (p_len == 0)\n\t\t{\n\t\t  /* empty path: current directory */\n\t\t  if (getcwd (tmp, LT_PATHMAX) == NULL)\n\t\t    lt_fatal (\"getcwd failed\");\n\t\t  tmp_len = strlen (tmp);\n\t\t  concat_name =\n\t\t    XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);\n\t\t  memcpy (concat_name, tmp, tmp_len);\n\t\t  concat_name[tmp_len] = '/';\n\t\t  strcpy (concat_name + tmp_len + 1, wrapper);\n\t\t}\n\t      else\n\t\t{\n\t\t  concat_name =\n\t\t    XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);\n\t\t  memcpy (concat_name, p, p_len);\n\t\t  concat_name[p_len] = '/';\n\t\t  strcpy (concat_name + p_len + 1, wrapper);\n\t\t}\n\t      if (check_executable (concat_name))\n\t\treturn concat_name;\n\t      XFREE (concat_name);\n\t    }\n\t}\n      /* not found in PATH; assume curdir */\n    }\n  /* Relative path | not found in path: prepend cwd */\n  if (getcwd (tmp, LT_PATHMAX) == NULL)\n    lt_fatal (\"getcwd failed\");\n  tmp_len = strlen (tmp);\n  concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);\n  memcpy (concat_name, tmp, tmp_len);\n  concat_name[tmp_len] = '/';\n  strcpy (concat_name + tmp_len + 1, wrapper);\n\n  if (check_executable (concat_name))\n    return concat_name;\n  XFREE (concat_name);\n  return NULL;\n}\n\nchar *\nchase_symlinks (const char *pathspec)\n{\n#ifndef S_ISLNK\n  return xstrdup (pathspec);\n#else\n  char buf[LT_PATHMAX];\n  struct stat s;\n  char *tmp_pathspec = xstrdup (pathspec);\n  char *p;\n  int has_symlinks = 0;\n  while (strlen (tmp_pathspec) && !has_symlinks)\n    {\n      LTWRAPPER_DEBUGPRINTF ((\"checking path component for symlinks: %s\\n\",\n\t\t\t      tmp_pathspec));\n      if (lstat (tmp_pathspec, &s) == 0)\n\t{\n\t  if (S_ISLNK (s.st_mode) != 0)\n\t    {\n\t      has_symlinks = 1;\n\t      break;\n\t    }\n\n\t  /* search backwards for last DIR_SEPARATOR */\n\t  p = tmp_pathspec + strlen (tmp_pathspec) - 1;\n\t  while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))\n\t    p--;\n\t  if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))\n\t    {\n\t      /* no more DIR_SEPARATORS left */\n\t      break;\n\t    }\n\t  *p = '\\0';\n\t}\n      else\n\t{\n\t  char *errstr = strerror (errno);\n\t  lt_fatal (\"Error accessing file %s (%s)\", tmp_pathspec, errstr);\n\t}\n    }\n  XFREE (tmp_pathspec);\n\n  if (!has_symlinks)\n    {\n      return xstrdup (pathspec);\n    }\n\n  tmp_pathspec = realpath (pathspec, buf);\n  if (tmp_pathspec == 0)\n    {\n      lt_fatal (\"Could not follow symlinks for %s\", pathspec);\n    }\n  return xstrdup (tmp_pathspec);\n#endif\n}\n\nchar *\nstrendzap (char *str, const char *pat)\n{\n  size_t len, patlen;\n\n  assert (str != NULL);\n  assert (pat != NULL);\n\n  len = strlen (str);\n  patlen = strlen (pat);\n\n  if (patlen <= len)\n    {\n      str += len - patlen;\n      if (strcmp (str, pat) == 0)\n\t*str = '\\0';\n    }\n  return str;\n}\n\nstatic void\nlt_error_core (int exit_status, const char *mode,\n\t       const char *message, va_list ap)\n{\n  fprintf (stderr, \"%s: %s: \", program_name, mode);\n  vfprintf (stderr, message, ap);\n  fprintf (stderr, \".\\n\");\n\n  if (exit_status >= 0)\n    exit (exit_status);\n}\n\nvoid\nlt_fatal (const char *message, ...)\n{\n  va_list ap;\n  va_start (ap, message);\n  lt_error_core (EXIT_FAILURE, \"FATAL\", message, ap);\n  va_end (ap);\n}\n\nvoid\nlt_setenv (const char *name, const char *value)\n{\n  LTWRAPPER_DEBUGPRINTF ((\"(lt_setenv) setting '%s' to '%s'\\n\",\n                          (name ? name : \"<NULL>\"),\n                          (value ? value : \"<NULL>\")));\n  {\n#ifdef HAVE_SETENV\n    /* always make a copy, for consistency with !HAVE_SETENV */\n    char *str = xstrdup (value);\n    setenv (name, str, 1);\n#else\n    int len = strlen (name) + 1 + strlen (value) + 1;\n    char *str = XMALLOC (char, len);\n    sprintf (str, \"%s=%s\", name, value);\n    if (putenv (str) != EXIT_SUCCESS)\n      {\n        XFREE (str);\n      }\n#endif\n  }\n}\n\nchar *\nlt_extend_str (const char *orig_value, const char *add, int to_end)\n{\n  char *new_value;\n  if (orig_value && *orig_value)\n    {\n      int orig_value_len = strlen (orig_value);\n      int add_len = strlen (add);\n      new_value = XMALLOC (char, add_len + orig_value_len + 1);\n      if (to_end)\n        {\n          strcpy (new_value, orig_value);\n          strcpy (new_value + orig_value_len, add);\n        }\n      else\n        {\n          strcpy (new_value, add);\n          strcpy (new_value + add_len, orig_value);\n        }\n    }\n  else\n    {\n      new_value = xstrdup (add);\n    }\n  return new_value;\n}\n\nint\nlt_split_name_value (const char *arg, char** name, char** value)\n{\n  const char *p;\n  int len;\n  if (!arg || !*arg)\n    return 1;\n\n  p = strchr (arg, (int)'=');\n\n  if (!p)\n    return 1;\n\n  *value = xstrdup (++p);\n\n  len = strlen (arg) - strlen (*value);\n  *name = XMALLOC (char, len);\n  strncpy (*name, arg, len-1);\n  (*name)[len - 1] = '\\0';\n\n  return 0;\n}\n\nvoid\nlt_opt_process_env_set (const char *arg)\n{\n  char *name = NULL;\n  char *value = NULL;\n\n  if (lt_split_name_value (arg, &name, &value) != 0)\n    {\n      XFREE (name);\n      XFREE (value);\n      lt_fatal (\"bad argument for %s: '%s'\", env_set_opt, arg);\n    }\n\n  lt_setenv (name, value);\n  XFREE (name);\n  XFREE (value);\n}\n\nvoid\nlt_opt_process_env_prepend (const char *arg)\n{\n  char *name = NULL;\n  char *value = NULL;\n  char *new_value = NULL;\n\n  if (lt_split_name_value (arg, &name, &value) != 0)\n    {\n      XFREE (name);\n      XFREE (value);\n      lt_fatal (\"bad argument for %s: '%s'\", env_prepend_opt, arg);\n    }\n\n  new_value = lt_extend_str (getenv (name), value, 0);\n  lt_setenv (name, new_value);\n  XFREE (new_value);\n  XFREE (name);\n  XFREE (value);\n}\n\nvoid\nlt_opt_process_env_append (const char *arg)\n{\n  char *name = NULL;\n  char *value = NULL;\n  char *new_value = NULL;\n\n  if (lt_split_name_value (arg, &name, &value) != 0)\n    {\n      XFREE (name);\n      XFREE (value);\n      lt_fatal (\"bad argument for %s: '%s'\", env_append_opt, arg);\n    }\n\n  new_value = lt_extend_str (getenv (name), value, 1);\n  lt_setenv (name, new_value);\n  XFREE (new_value);\n  XFREE (name);\n  XFREE (value);\n}\n\nvoid\nlt_update_exe_path (const char *name, const char *value)\n{\n  LTWRAPPER_DEBUGPRINTF ((\"(lt_update_exe_path) modifying '%s' by prepending '%s'\\n\",\n                          (name ? name : \"<NULL>\"),\n                          (value ? value : \"<NULL>\")));\n\n  if (name && *name && value && *value)\n    {\n      char *new_value = lt_extend_str (getenv (name), value, 0);\n      /* some systems can't cope with a ':'-terminated path #' */\n      int len = strlen (new_value);\n      while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))\n        {\n          new_value[len-1] = '\\0';\n        }\n      lt_setenv (name, new_value);\n      XFREE (new_value);\n    }\n}\n\nvoid\nlt_update_lib_path (const char *name, const char *value)\n{\n  LTWRAPPER_DEBUGPRINTF ((\"(lt_update_lib_path) modifying '%s' by prepending '%s'\\n\",\n                          (name ? name : \"<NULL>\"),\n                          (value ? value : \"<NULL>\")));\n\n  if (name && *name && value && *value)\n    {\n      char *new_value = lt_extend_str (getenv (name), value, 0);\n      lt_setenv (name, new_value);\n      XFREE (new_value);\n    }\n}\n\n\nEOF\n}\n# end: func_emit_cwrapperexe_src\n\n# func_mode_link arg...\nfunc_mode_link ()\n{\n    $opt_debug\n    case $host in\n    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)\n      # It is impossible to link a dll without this setting, and\n      # we shouldn't force the makefile maintainer to figure out\n      # which system we are compiling for in order to pass an extra\n      # flag for every libtool invocation.\n      # allow_undefined=no\n\n      # FIXME: Unfortunately, there are problems with the above when trying\n      # to make a dll which has undefined symbols, in which case not\n      # even a static library is built.  For now, we need to specify\n      # -no-undefined on the libtool link line when we can be certain\n      # that all symbols are satisfied, otherwise we get a static library.\n      allow_undefined=yes\n      ;;\n    *)\n      allow_undefined=yes\n      ;;\n    esac\n    libtool_args=$nonopt\n    base_compile=\"$nonopt $@\"\n    compile_command=$nonopt\n    finalize_command=$nonopt\n\n    compile_rpath=\n    finalize_rpath=\n    compile_shlibpath=\n    finalize_shlibpath=\n    convenience=\n    old_convenience=\n    deplibs=\n    old_deplibs=\n    compiler_flags=\n    linker_flags=\n    dllsearchpath=\n    lib_search_path=`pwd`\n    inst_prefix_dir=\n    new_inherited_linker_flags=\n\n    avoid_version=no\n    dlfiles=\n    dlprefiles=\n    dlself=no\n    export_dynamic=no\n    export_symbols=\n    export_symbols_regex=\n    generated=\n    libobjs=\n    ltlibs=\n    module=no\n    no_install=no\n    objs=\n    non_pic_objects=\n    precious_files_regex=\n    prefer_static_libs=no\n    preload=no\n    prev=\n    prevarg=\n    release=\n    rpath=\n    xrpath=\n    perm_rpath=\n    temp_rpath=\n    thread_safe=no\n    vinfo=\n    vinfo_number=no\n    weak_libs=\n    single_module=\"${wl}-single_module\"\n    func_infer_tag $base_compile\n\n    # We need to know -static, to get the right output filenames.\n    for arg\n    do\n      case $arg in\n      -shared)\n\ttest \"$build_libtool_libs\" != yes && \\\n\t  func_fatal_configuration \"can not build a shared library\"\n\tbuild_old_libs=no\n\tbreak\n\t;;\n      -all-static | -static | -static-libtool-libs)\n\tcase $arg in\n\t-all-static)\n\t  if test \"$build_libtool_libs\" = yes && test -z \"$link_static_flag\"; then\n\t    func_warning \"complete static linking is impossible in this configuration\"\n\t  fi\n\t  if test -n \"$link_static_flag\"; then\n\t    dlopen_self=$dlopen_self_static\n\t  fi\n\t  prefer_static_libs=yes\n\t  ;;\n\t-static)\n\t  if test -z \"$pic_flag\" && test -n \"$link_static_flag\"; then\n\t    dlopen_self=$dlopen_self_static\n\t  fi\n\t  prefer_static_libs=built\n\t  ;;\n\t-static-libtool-libs)\n\t  if test -z \"$pic_flag\" && test -n \"$link_static_flag\"; then\n\t    dlopen_self=$dlopen_self_static\n\t  fi\n\t  prefer_static_libs=yes\n\t  ;;\n\tesac\n\tbuild_libtool_libs=no\n\tbuild_old_libs=yes\n\tbreak\n\t;;\n      esac\n    done\n\n    # See if our shared archives depend on static archives.\n    test -n \"$old_archive_from_new_cmds\" && build_old_libs=yes\n\n    # Go through the arguments, transforming them on the way.\n    while test \"$#\" -gt 0; do\n      arg=\"$1\"\n      shift\n      func_quote_for_eval \"$arg\"\n      qarg=$func_quote_for_eval_unquoted_result\n      func_append libtool_args \" $func_quote_for_eval_result\"\n\n      # If the previous option needs an argument, assign it.\n      if test -n \"$prev\"; then\n\tcase $prev in\n\toutput)\n\t  func_append compile_command \" @OUTPUT@\"\n\t  func_append finalize_command \" @OUTPUT@\"\n\t  ;;\n\tesac\n\n\tcase $prev in\n\tdlfiles|dlprefiles)\n\t  if test \"$preload\" = no; then\n\t    # Add the symbol object into the linking commands.\n\t    func_append compile_command \" @SYMFILE@\"\n\t    func_append finalize_command \" @SYMFILE@\"\n\t    preload=yes\n\t  fi\n\t  case $arg in\n\t  *.la | *.lo) ;;  # We handle these cases below.\n\t  force)\n\t    if test \"$dlself\" = no; then\n\t      dlself=needless\n\t      export_dynamic=yes\n\t    fi\n\t    prev=\n\t    continue\n\t    ;;\n\t  self)\n\t    if test \"$prev\" = dlprefiles; then\n\t      dlself=yes\n\t    elif test \"$prev\" = dlfiles && test \"$dlopen_self\" != yes; then\n\t      dlself=yes\n\t    else\n\t      dlself=needless\n\t      export_dynamic=yes\n\t    fi\n\t    prev=\n\t    continue\n\t    ;;\n\t  *)\n\t    if test \"$prev\" = dlfiles; then\n\t      dlfiles=\"$dlfiles $arg\"\n\t    else\n\t      dlprefiles=\"$dlprefiles $arg\"\n\t    fi\n\t    prev=\n\t    continue\n\t    ;;\n\t  esac\n\t  ;;\n\texpsyms)\n\t  export_symbols=\"$arg\"\n\t  test -f \"$arg\" \\\n\t    || func_fatal_error \"symbol file \\`$arg' does not exist\"\n\t  prev=\n\t  continue\n\t  ;;\n\texpsyms_regex)\n\t  export_symbols_regex=\"$arg\"\n\t  prev=\n\t  continue\n\t  ;;\n\tframework)\n\t  case $host in\n\t    *-*-darwin*)\n\t      case \"$deplibs \" in\n\t\t*\" $qarg.ltframework \"*) ;;\n\t\t*) deplibs=\"$deplibs $qarg.ltframework\" # this is fixed later\n\t\t   ;;\n\t      esac\n\t      ;;\n\t  esac\n\t  prev=\n\t  continue\n\t  ;;\n\tinst_prefix)\n\t  inst_prefix_dir=\"$arg\"\n\t  prev=\n\t  continue\n\t  ;;\n\tobjectlist)\n\t  if test -f \"$arg\"; then\n\t    save_arg=$arg\n\t    moreargs=\n\t    for fil in `cat \"$save_arg\"`\n\t    do\n#\t      moreargs=\"$moreargs $fil\"\n\t      arg=$fil\n\t      # A libtool-controlled object.\n\n\t      # Check to see that this really is a libtool object.\n\t      if func_lalib_unsafe_p \"$arg\"; then\n\t\tpic_object=\n\t\tnon_pic_object=\n\n\t\t# Read the .lo file\n\t\tfunc_source \"$arg\"\n\n\t\tif test -z \"$pic_object\" ||\n\t\t   test -z \"$non_pic_object\" ||\n\t\t   test \"$pic_object\" = none &&\n\t\t   test \"$non_pic_object\" = none; then\n\t\t  func_fatal_error \"cannot find name of object for \\`$arg'\"\n\t\tfi\n\n\t\t# Extract subdirectory from the argument.\n\t\tfunc_dirname \"$arg\" \"/\" \"\"\n\t\txdir=\"$func_dirname_result\"\n\n\t\tif test \"$pic_object\" != none; then\n\t\t  # Prepend the subdirectory the object is found in.\n\t\t  pic_object=\"$xdir$pic_object\"\n\n\t\t  if test \"$prev\" = dlfiles; then\n\t\t    if test \"$build_libtool_libs\" = yes && test \"$dlopen_support\" = yes; then\n\t\t      dlfiles=\"$dlfiles $pic_object\"\n\t\t      prev=\n\t\t      continue\n\t\t    else\n\t\t      # If libtool objects are unsupported, then we need to preload.\n\t\t      prev=dlprefiles\n\t\t    fi\n\t\t  fi\n\n\t\t  # CHECK ME:  I think I busted this.  -Ossama\n\t\t  if test \"$prev\" = dlprefiles; then\n\t\t    # Preload the old-style object.\n\t\t    dlprefiles=\"$dlprefiles $pic_object\"\n\t\t    prev=\n\t\t  fi\n\n\t\t  # A PIC object.\n\t\t  func_append libobjs \" $pic_object\"\n\t\t  arg=\"$pic_object\"\n\t\tfi\n\n\t\t# Non-PIC object.\n\t\tif test \"$non_pic_object\" != none; then\n\t\t  # Prepend the subdirectory the object is found in.\n\t\t  non_pic_object=\"$xdir$non_pic_object\"\n\n\t\t  # A standard non-PIC object\n\t\t  func_append non_pic_objects \" $non_pic_object\"\n\t\t  if test -z \"$pic_object\" || test \"$pic_object\" = none ; then\n\t\t    arg=\"$non_pic_object\"\n\t\t  fi\n\t\telse\n\t\t  # If the PIC object exists, use it instead.\n\t\t  # $xdir was prepended to $pic_object above.\n\t\t  non_pic_object=\"$pic_object\"\n\t\t  func_append non_pic_objects \" $non_pic_object\"\n\t\tfi\n\t      else\n\t\t# Only an error if not doing a dry-run.\n\t\tif $opt_dry_run; then\n\t\t  # Extract subdirectory from the argument.\n\t\t  func_dirname \"$arg\" \"/\" \"\"\n\t\t  xdir=\"$func_dirname_result\"\n\n\t\t  func_lo2o \"$arg\"\n\t\t  pic_object=$xdir$objdir/$func_lo2o_result\n\t\t  non_pic_object=$xdir$func_lo2o_result\n\t\t  func_append libobjs \" $pic_object\"\n\t\t  func_append non_pic_objects \" $non_pic_object\"\n\t        else\n\t\t  func_fatal_error \"\\`$arg' is not a valid libtool object\"\n\t\tfi\n\t      fi\n\t    done\n\t  else\n\t    func_fatal_error \"link input file \\`$arg' does not exist\"\n\t  fi\n\t  arg=$save_arg\n\t  prev=\n\t  continue\n\t  ;;\n\tprecious_regex)\n\t  precious_files_regex=\"$arg\"\n\t  prev=\n\t  continue\n\t  ;;\n\trelease)\n\t  release=\"-$arg\"\n\t  prev=\n\t  continue\n\t  ;;\n\trpath | xrpath)\n\t  # We need an absolute path.\n\t  case $arg in\n\t  [\\\\/]* | [A-Za-z]:[\\\\/]*) ;;\n\t  *)\n\t    func_fatal_error \"only absolute run-paths are allowed\"\n\t    ;;\n\t  esac\n\t  if test \"$prev\" = rpath; then\n\t    case \"$rpath \" in\n\t    *\" $arg \"*) ;;\n\t    *) rpath=\"$rpath $arg\" ;;\n\t    esac\n\t  else\n\t    case \"$xrpath \" in\n\t    *\" $arg \"*) ;;\n\t    *) xrpath=\"$xrpath $arg\" ;;\n\t    esac\n\t  fi\n\t  prev=\n\t  continue\n\t  ;;\n\tshrext)\n\t  shrext_cmds=\"$arg\"\n\t  prev=\n\t  continue\n\t  ;;\n\tweak)\n\t  weak_libs=\"$weak_libs $arg\"\n\t  prev=\n\t  continue\n\t  ;;\n\txcclinker)\n\t  linker_flags=\"$linker_flags $qarg\"\n\t  compiler_flags=\"$compiler_flags $qarg\"\n\t  prev=\n\t  func_append compile_command \" $qarg\"\n\t  func_append finalize_command \" $qarg\"\n\t  continue\n\t  ;;\n\txcompiler)\n\t  compiler_flags=\"$compiler_flags $qarg\"\n\t  prev=\n\t  func_append compile_command \" $qarg\"\n\t  func_append finalize_command \" $qarg\"\n\t  continue\n\t  ;;\n\txlinker)\n\t  linker_flags=\"$linker_flags $qarg\"\n\t  compiler_flags=\"$compiler_flags $wl$qarg\"\n\t  prev=\n\t  func_append compile_command \" $wl$qarg\"\n\t  func_append finalize_command \" $wl$qarg\"\n\t  continue\n\t  ;;\n\t*)\n\t  eval \"$prev=\\\"\\$arg\\\"\"\n\t  prev=\n\t  continue\n\t  ;;\n\tesac\n      fi # test -n \"$prev\"\n\n      prevarg=\"$arg\"\n\n      case $arg in\n      -all-static)\n\tif test -n \"$link_static_flag\"; then\n\t  # See comment for -static flag below, for more details.\n\t  func_append compile_command \" $link_static_flag\"\n\t  func_append finalize_command \" $link_static_flag\"\n\tfi\n\tcontinue\n\t;;\n\n      -allow-undefined)\n\t# FIXME: remove this flag sometime in the future.\n\tfunc_fatal_error \"\\`-allow-undefined' must not be used because it is the default\"\n\t;;\n\n      -avoid-version)\n\tavoid_version=yes\n\tcontinue\n\t;;\n\n      -dlopen)\n\tprev=dlfiles\n\tcontinue\n\t;;\n\n      -dlpreopen)\n\tprev=dlprefiles\n\tcontinue\n\t;;\n\n      -export-dynamic)\n\texport_dynamic=yes\n\tcontinue\n\t;;\n\n      -export-symbols | -export-symbols-regex)\n\tif test -n \"$export_symbols\" || test -n \"$export_symbols_regex\"; then\n\t  func_fatal_error \"more than one -exported-symbols argument is not allowed\"\n\tfi\n\tif test \"X$arg\" = \"X-export-symbols\"; then\n\t  prev=expsyms\n\telse\n\t  prev=expsyms_regex\n\tfi\n\tcontinue\n\t;;\n\n      -framework)\n\tprev=framework\n\tcontinue\n\t;;\n\n      -inst-prefix-dir)\n\tprev=inst_prefix\n\tcontinue\n\t;;\n\n      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*\n      # so, if we see these flags be careful not to treat them like -L\n      -L[A-Z][A-Z]*:*)\n\tcase $with_gcc/$host in\n\tno/*-*-irix* | /*-*-irix*)\n\t  func_append compile_command \" $arg\"\n\t  func_append finalize_command \" $arg\"\n\t  ;;\n\tesac\n\tcontinue\n\t;;\n\n      -L*)\n\tfunc_stripname '-L' '' \"$arg\"\n\tdir=$func_stripname_result\n\tif test -z \"$dir\"; then\n\t  if test \"$#\" -gt 0; then\n\t    func_fatal_error \"require no space between \\`-L' and \\`$1'\"\n\t  else\n\t    func_fatal_error \"need path for \\`-L' option\"\n\t  fi\n\tfi\n\t# We need an absolute path.\n\tcase $dir in\n\t[\\\\/]* | [A-Za-z]:[\\\\/]*) ;;\n\t*)\n\t  absdir=`cd \"$dir\" && pwd`\n\t  test -z \"$absdir\" && \\\n\t    func_fatal_error \"cannot determine absolute directory name of \\`$dir'\"\n\t  dir=\"$absdir\"\n\t  ;;\n\tesac\n\tcase \"$deplibs \" in\n\t*\" -L$dir \"*) ;;\n\t*)\n\t  deplibs=\"$deplibs -L$dir\"\n\t  lib_search_path=\"$lib_search_path $dir\"\n\t  ;;\n\tesac\n\tcase $host in\n\t*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)\n\t  testbindir=`$ECHO \"X$dir\" | $Xsed -e 's*/lib$*/bin*'`\n\t  case :$dllsearchpath: in\n\t  *\":$dir:\"*) ;;\n\t  ::) dllsearchpath=$dir;;\n\t  *) dllsearchpath=\"$dllsearchpath:$dir\";;\n\t  esac\n\t  case :$dllsearchpath: in\n\t  *\":$testbindir:\"*) ;;\n\t  ::) dllsearchpath=$testbindir;;\n\t  *) dllsearchpath=\"$dllsearchpath:$testbindir\";;\n\t  esac\n\t  ;;\n\tesac\n\tcontinue\n\t;;\n\n      -l*)\n\tif test \"X$arg\" = \"X-lc\" || test \"X$arg\" = \"X-lm\"; then\n\t  case $host in\n\t  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc*)\n\t    # These systems don't actually have a C or math library (as such)\n\t    continue\n\t    ;;\n\t  *-*-os2*)\n\t    # These systems don't actually have a C library (as such)\n\t    test \"X$arg\" = \"X-lc\" && continue\n\t    ;;\n\t  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)\n\t    # Do not include libc due to us having libc/libc_r.\n\t    test \"X$arg\" = \"X-lc\" && continue\n\t    ;;\n\t  *-*-rhapsody* | *-*-darwin1.[012])\n\t    # Rhapsody C and math libraries are in the System framework\n\t    deplibs=\"$deplibs System.ltframework\"\n\t    continue\n\t    ;;\n\t  *-*-sco3.2v5* | *-*-sco5v6*)\n\t    # Causes problems with __ctype\n\t    test \"X$arg\" = \"X-lc\" && continue\n\t    ;;\n\t  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)\n\t    # Compiler inserts libc in the correct place for threads to work\n\t    test \"X$arg\" = \"X-lc\" && continue\n\t    ;;\n\t  esac\n\telif test \"X$arg\" = \"X-lc_r\"; then\n\t case $host in\n\t *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)\n\t   # Do not include libc_r directly, use -pthread flag.\n\t   continue\n\t   ;;\n\t esac\n\tfi\n\tdeplibs=\"$deplibs $arg\"\n\tcontinue\n\t;;\n\n      -module)\n\tmodule=yes\n\tcontinue\n\t;;\n\n      # Tru64 UNIX uses -model [arg] to determine the layout of C++\n      # classes, name mangling, and exception handling.\n      # Darwin uses the -arch flag to determine output architecture.\n      -model|-arch|-isysroot)\n\tcompiler_flags=\"$compiler_flags $arg\"\n\tfunc_append compile_command \" $arg\"\n\tfunc_append finalize_command \" $arg\"\n\tprev=xcompiler\n\tcontinue\n\t;;\n\n      -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)\n\tcompiler_flags=\"$compiler_flags $arg\"\n\tfunc_append compile_command \" $arg\"\n\tfunc_append finalize_command \" $arg\"\n\tcase \"$new_inherited_linker_flags \" in\n\t    *\" $arg \"*) ;;\n\t    * ) new_inherited_linker_flags=\"$new_inherited_linker_flags $arg\" ;;\n\tesac\n\tcontinue\n\t;;\n\n      -multi_module)\n\tsingle_module=\"${wl}-multi_module\"\n\tcontinue\n\t;;\n\n      -no-fast-install)\n\tfast_install=no\n\tcontinue\n\t;;\n\n      -no-install)\n\tcase $host in\n\t*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)\n\t  # The PATH hackery in wrapper scripts is required on Windows\n\t  # and Darwin in order for the loader to find any dlls it needs.\n\t  func_warning \"\\`-no-install' is ignored for $host\"\n\t  func_warning \"assuming \\`-no-fast-install' instead\"\n\t  fast_install=no\n\t  ;;\n\t*) no_install=yes ;;\n\tesac\n\tcontinue\n\t;;\n\n      -no-undefined)\n\tallow_undefined=no\n\tcontinue\n\t;;\n\n      -objectlist)\n\tprev=objectlist\n\tcontinue\n\t;;\n\n      -o) prev=output ;;\n\n      -precious-files-regex)\n\tprev=precious_regex\n\tcontinue\n\t;;\n\n      -release)\n\tprev=release\n\tcontinue\n\t;;\n\n      -rpath)\n\tprev=rpath\n\tcontinue\n\t;;\n\n      -R)\n\tprev=xrpath\n\tcontinue\n\t;;\n\n      -R*)\n\tfunc_stripname '-R' '' \"$arg\"\n\tdir=$func_stripname_result\n\t# We need an absolute path.\n\tcase $dir in\n\t[\\\\/]* | [A-Za-z]:[\\\\/]*) ;;\n\t*)\n\t  func_fatal_error \"only absolute run-paths are allowed\"\n\t  ;;\n\tesac\n\tcase \"$xrpath \" in\n\t*\" $dir \"*) ;;\n\t*) xrpath=\"$xrpath $dir\" ;;\n\tesac\n\tcontinue\n\t;;\n\n      -shared)\n\t# The effects of -shared are defined in a previous loop.\n\tcontinue\n\t;;\n\n      -shrext)\n\tprev=shrext\n\tcontinue\n\t;;\n\n      -static | -static-libtool-libs)\n\t# The effects of -static are defined in a previous loop.\n\t# We used to do the same as -all-static on platforms that\n\t# didn't have a PIC flag, but the assumption that the effects\n\t# would be equivalent was wrong.  It would break on at least\n\t# Digital Unix and AIX.\n\tcontinue\n\t;;\n\n      -thread-safe)\n\tthread_safe=yes\n\tcontinue\n\t;;\n\n      -version-info)\n\tprev=vinfo\n\tcontinue\n\t;;\n\n      -version-number)\n\tprev=vinfo\n\tvinfo_number=yes\n\tcontinue\n\t;;\n\n      -weak)\n        prev=weak\n\tcontinue\n\t;;\n\n      -Wc,*)\n\tfunc_stripname '-Wc,' '' \"$arg\"\n\targs=$func_stripname_result\n\targ=\n\tsave_ifs=\"$IFS\"; IFS=','\n\tfor flag in $args; do\n\t  IFS=\"$save_ifs\"\n          func_quote_for_eval \"$flag\"\n\t  arg=\"$arg $wl$func_quote_for_eval_result\"\n\t  compiler_flags=\"$compiler_flags $func_quote_for_eval_result\"\n\tdone\n\tIFS=\"$save_ifs\"\n\tfunc_stripname ' ' '' \"$arg\"\n\targ=$func_stripname_result\n\t;;\n\n      -Wl,*)\n\tfunc_stripname '-Wl,' '' \"$arg\"\n\targs=$func_stripname_result\n\targ=\n\tsave_ifs=\"$IFS\"; IFS=','\n\tfor flag in $args; do\n\t  IFS=\"$save_ifs\"\n          func_quote_for_eval \"$flag\"\n\t  arg=\"$arg $wl$func_quote_for_eval_result\"\n\t  compiler_flags=\"$compiler_flags $wl$func_quote_for_eval_result\"\n\t  linker_flags=\"$linker_flags $func_quote_for_eval_result\"\n\tdone\n\tIFS=\"$save_ifs\"\n\tfunc_stripname ' ' '' \"$arg\"\n\targ=$func_stripname_result\n\t;;\n\n      -Xcompiler)\n\tprev=xcompiler\n\tcontinue\n\t;;\n\n      -Xlinker)\n\tprev=xlinker\n\tcontinue\n\t;;\n\n      -XCClinker)\n\tprev=xcclinker\n\tcontinue\n\t;;\n\n      # -msg_* for osf cc\n      -msg_*)\n\tfunc_quote_for_eval \"$arg\"\n\targ=\"$func_quote_for_eval_result\"\n\t;;\n\n      # -64, -mips[0-9] enable 64-bit mode on the SGI compiler\n      # -r[0-9][0-9]* specifies the processor on the SGI compiler\n      # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler\n      # +DA*, +DD* enable 64-bit mode on the HP compiler\n      # -q* pass through compiler args for the IBM compiler\n      # -m*, -t[45]*, -txscale* pass through architecture-specific\n      # compiler args for GCC\n      # -F/path gives path to uninstalled frameworks, gcc on darwin\n      # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC\n      # @file GCC response files\n      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \\\n      -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)\n        func_quote_for_eval \"$arg\"\n\targ=\"$func_quote_for_eval_result\"\n        func_append compile_command \" $arg\"\n        func_append finalize_command \" $arg\"\n        compiler_flags=\"$compiler_flags $arg\"\n        continue\n        ;;\n\n      # Some other compiler flag.\n      -* | +*)\n        func_quote_for_eval \"$arg\"\n\targ=\"$func_quote_for_eval_result\"\n\t;;\n\n      *.$objext)\n\t# A standard object.\n\tobjs=\"$objs $arg\"\n\t;;\n\n      *.lo)\n\t# A libtool-controlled object.\n\n\t# Check to see that this really is a libtool object.\n\tif func_lalib_unsafe_p \"$arg\"; then\n\t  pic_object=\n\t  non_pic_object=\n\n\t  # Read the .lo file\n\t  func_source \"$arg\"\n\n\t  if test -z \"$pic_object\" ||\n\t     test -z \"$non_pic_object\" ||\n\t     test \"$pic_object\" = none &&\n\t     test \"$non_pic_object\" = none; then\n\t    func_fatal_error \"cannot find name of object for \\`$arg'\"\n\t  fi\n\n\t  # Extract subdirectory from the argument.\n\t  func_dirname \"$arg\" \"/\" \"\"\n\t  xdir=\"$func_dirname_result\"\n\n\t  if test \"$pic_object\" != none; then\n\t    # Prepend the subdirectory the object is found in.\n\t    pic_object=\"$xdir$pic_object\"\n\n\t    if test \"$prev\" = dlfiles; then\n\t      if test \"$build_libtool_libs\" = yes && test \"$dlopen_support\" = yes; then\n\t\tdlfiles=\"$dlfiles $pic_object\"\n\t\tprev=\n\t\tcontinue\n\t      else\n\t\t# If libtool objects are unsupported, then we need to preload.\n\t\tprev=dlprefiles\n\t      fi\n\t    fi\n\n\t    # CHECK ME:  I think I busted this.  -Ossama\n\t    if test \"$prev\" = dlprefiles; then\n\t      # Preload the old-style object.\n\t      dlprefiles=\"$dlprefiles $pic_object\"\n\t      prev=\n\t    fi\n\n\t    # A PIC object.\n\t    func_append libobjs \" $pic_object\"\n\t    arg=\"$pic_object\"\n\t  fi\n\n\t  # Non-PIC object.\n\t  if test \"$non_pic_object\" != none; then\n\t    # Prepend the subdirectory the object is found in.\n\t    non_pic_object=\"$xdir$non_pic_object\"\n\n\t    # A standard non-PIC object\n\t    func_append non_pic_objects \" $non_pic_object\"\n\t    if test -z \"$pic_object\" || test \"$pic_object\" = none ; then\n\t      arg=\"$non_pic_object\"\n\t    fi\n\t  else\n\t    # If the PIC object exists, use it instead.\n\t    # $xdir was prepended to $pic_object above.\n\t    non_pic_object=\"$pic_object\"\n\t    func_append non_pic_objects \" $non_pic_object\"\n\t  fi\n\telse\n\t  # Only an error if not doing a dry-run.\n\t  if $opt_dry_run; then\n\t    # Extract subdirectory from the argument.\n\t    func_dirname \"$arg\" \"/\" \"\"\n\t    xdir=\"$func_dirname_result\"\n\n\t    func_lo2o \"$arg\"\n\t    pic_object=$xdir$objdir/$func_lo2o_result\n\t    non_pic_object=$xdir$func_lo2o_result\n\t    func_append libobjs \" $pic_object\"\n\t    func_append non_pic_objects \" $non_pic_object\"\n\t  else\n\t    func_fatal_error \"\\`$arg' is not a valid libtool object\"\n\t  fi\n\tfi\n\t;;\n\n      *.$libext)\n\t# An archive.\n\tdeplibs=\"$deplibs $arg\"\n\told_deplibs=\"$old_deplibs $arg\"\n\tcontinue\n\t;;\n\n      *.la)\n\t# A libtool-controlled library.\n\n\tif test \"$prev\" = dlfiles; then\n\t  # This library was specified with -dlopen.\n\t  dlfiles=\"$dlfiles $arg\"\n\t  prev=\n\telif test \"$prev\" = dlprefiles; then\n\t  # The library was specified with -dlpreopen.\n\t  dlprefiles=\"$dlprefiles $arg\"\n\t  prev=\n\telse\n\t  deplibs=\"$deplibs $arg\"\n\tfi\n\tcontinue\n\t;;\n\n      # Some other compiler argument.\n      *)\n\t# Unknown arguments in both finalize_command and compile_command need\n\t# to be aesthetically quoted because they are evaled later.\n\tfunc_quote_for_eval \"$arg\"\n\targ=\"$func_quote_for_eval_result\"\n\t;;\n      esac # arg\n\n      # Now actually substitute the argument into the commands.\n      if test -n \"$arg\"; then\n\tfunc_append compile_command \" $arg\"\n\tfunc_append finalize_command \" $arg\"\n      fi\n    done # argument parsing loop\n\n    test -n \"$prev\" && \\\n      func_fatal_help \"the \\`$prevarg' option requires an argument\"\n\n    if test \"$export_dynamic\" = yes && test -n \"$export_dynamic_flag_spec\"; then\n      eval arg=\\\"$export_dynamic_flag_spec\\\"\n      func_append compile_command \" $arg\"\n      func_append finalize_command \" $arg\"\n    fi\n\n    oldlibs=\n    # calculate the name of the file, without its directory\n    func_basename \"$output\"\n    outputname=\"$func_basename_result\"\n    libobjs_save=\"$libobjs\"\n\n    if test -n \"$shlibpath_var\"; then\n      # get the directories listed in $shlibpath_var\n      eval shlib_search_path=\\`\\$ECHO \\\"X\\${$shlibpath_var}\\\" \\| \\$Xsed -e \\'s/:/ /g\\'\\`\n    else\n      shlib_search_path=\n    fi\n    eval sys_lib_search_path=\\\"$sys_lib_search_path_spec\\\"\n    eval sys_lib_dlsearch_path=\\\"$sys_lib_dlsearch_path_spec\\\"\n\n    func_dirname \"$output\" \"/\" \"\"\n    output_objdir=\"$func_dirname_result$objdir\"\n    # Create the object directory.\n    func_mkdir_p \"$output_objdir\"\n\n    # Determine the type of output\n    case $output in\n    \"\")\n      func_fatal_help \"you must specify an output file\"\n      ;;\n    *.$libext) linkmode=oldlib ;;\n    *.lo | *.$objext) linkmode=obj ;;\n    *.la) linkmode=lib ;;\n    *) linkmode=prog ;; # Anything else should be a program.\n    esac\n\n    specialdeplibs=\n\n    libs=\n    # Find all interdependent deplibs by searching for libraries\n    # that are linked more than once (e.g. -la -lb -la)\n    for deplib in $deplibs; do\n      if $opt_duplicate_deps ; then\n\tcase \"$libs \" in\n\t*\" $deplib \"*) specialdeplibs=\"$specialdeplibs $deplib\" ;;\n\tesac\n      fi\n      libs=\"$libs $deplib\"\n    done\n\n    if test \"$linkmode\" = lib; then\n      libs=\"$predeps $libs $compiler_lib_search_path $postdeps\"\n\n      # Compute libraries that are listed more than once in $predeps\n      # $postdeps and mark them as special (i.e., whose duplicates are\n      # not to be eliminated).\n      pre_post_deps=\n      if $opt_duplicate_compiler_generated_deps; then\n\tfor pre_post_dep in $predeps $postdeps; do\n\t  case \"$pre_post_deps \" in\n\t  *\" $pre_post_dep \"*) specialdeplibs=\"$specialdeplibs $pre_post_deps\" ;;\n\t  esac\n\t  pre_post_deps=\"$pre_post_deps $pre_post_dep\"\n\tdone\n      fi\n      pre_post_deps=\n    fi\n\n    deplibs=\n    newdependency_libs=\n    newlib_search_path=\n    need_relink=no # whether we're linking any uninstalled libtool libraries\n    notinst_deplibs= # not-installed libtool libraries\n    notinst_path= # paths that contain not-installed libtool libraries\n\n    case $linkmode in\n    lib)\n\tpasses=\"conv dlpreopen link\"\n\tfor file in $dlfiles $dlprefiles; do\n\t  case $file in\n\t  *.la) ;;\n\t  *)\n\t    func_fatal_help \"libraries can \\`-dlopen' only libtool libraries: $file\"\n\t    ;;\n\t  esac\n\tdone\n\t;;\n    prog)\n\tcompile_deplibs=\n\tfinalize_deplibs=\n\talldeplibs=no\n\tnewdlfiles=\n\tnewdlprefiles=\n\tpasses=\"conv scan dlopen dlpreopen link\"\n\t;;\n    *)  passes=\"conv\"\n\t;;\n    esac\n\n    for pass in $passes; do\n      # The preopen pass in lib mode reverses $deplibs; put it back here\n      # so that -L comes before libs that need it for instance...\n      if test \"$linkmode,$pass\" = \"lib,link\"; then\n\t## FIXME: Find the place where the list is rebuilt in the wrong\n\t##        order, and fix it there properly\n        tmp_deplibs=\n\tfor deplib in $deplibs; do\n\t  tmp_deplibs=\"$deplib $tmp_deplibs\"\n\tdone\n\tdeplibs=\"$tmp_deplibs\"\n      fi\n\n      if test \"$linkmode,$pass\" = \"lib,link\" ||\n\t test \"$linkmode,$pass\" = \"prog,scan\"; then\n\tlibs=\"$deplibs\"\n\tdeplibs=\n      fi\n      if test \"$linkmode\" = prog; then\n\tcase $pass in\n\tdlopen) libs=\"$dlfiles\" ;;\n\tdlpreopen) libs=\"$dlprefiles\" ;;\n\tlink) libs=\"$deplibs %DEPLIBS% $dependency_libs\" ;;\n\tesac\n      fi\n      if test \"$linkmode,$pass\" = \"lib,dlpreopen\"; then\n\t# Collect and forward deplibs of preopened libtool libs\n\tfor lib in $dlprefiles; do\n\t  # Ignore non-libtool-libs\n\t  dependency_libs=\n\t  case $lib in\n\t  *.la)\tfunc_source \"$lib\" ;;\n\t  esac\n\n\t  # Collect preopened libtool deplibs, except any this library\n\t  # has declared as weak libs\n\t  for deplib in $dependency_libs; do\n            deplib_base=`$ECHO \"X$deplib\" | $Xsed -e \"$basename\"`\n\t    case \" $weak_libs \" in\n\t    *\" $deplib_base \"*) ;;\n\t    *) deplibs=\"$deplibs $deplib\" ;;\n\t    esac\n\t  done\n\tdone\n\tlibs=\"$dlprefiles\"\n      fi\n      if test \"$pass\" = dlopen; then\n\t# Collect dlpreopened libraries\n\tsave_deplibs=\"$deplibs\"\n\tdeplibs=\n      fi\n\n      for deplib in $libs; do\n\tlib=\n\tfound=no\n\tcase $deplib in\n\t-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)\n\t  if test \"$linkmode,$pass\" = \"prog,link\"; then\n\t    compile_deplibs=\"$deplib $compile_deplibs\"\n\t    finalize_deplibs=\"$deplib $finalize_deplibs\"\n\t  else\n\t    compiler_flags=\"$compiler_flags $deplib\"\n\t    if test \"$linkmode\" = lib ; then\n\t\tcase \"$new_inherited_linker_flags \" in\n\t\t    *\" $deplib \"*) ;;\n\t\t    * ) new_inherited_linker_flags=\"$new_inherited_linker_flags $deplib\" ;;\n\t\tesac\n\t    fi\n\t  fi\n\t  continue\n\t  ;;\n\t-l*)\n\t  if test \"$linkmode\" != lib && test \"$linkmode\" != prog; then\n\t    func_warning \"\\`-l' is ignored for archives/objects\"\n\t    continue\n\t  fi\n\t  func_stripname '-l' '' \"$deplib\"\n\t  name=$func_stripname_result\n\t  if test \"$linkmode\" = lib; then\n\t    searchdirs=\"$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path\"\n\t  else\n\t    searchdirs=\"$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path\"\n\t  fi\n\t  for searchdir in $searchdirs; do\n\t    for search_ext in .la $std_shrext .so .a; do\n\t      # Search the libtool library\n\t      lib=\"$searchdir/lib${name}${search_ext}\"\n\t      if test -f \"$lib\"; then\n\t\tif test \"$search_ext\" = \".la\"; then\n\t\t  found=yes\n\t\telse\n\t\t  found=no\n\t\tfi\n\t\tbreak 2\n\t      fi\n\t    done\n\t  done\n\t  if test \"$found\" != yes; then\n\t    # deplib doesn't seem to be a libtool library\n\t    if test \"$linkmode,$pass\" = \"prog,link\"; then\n\t      compile_deplibs=\"$deplib $compile_deplibs\"\n\t      finalize_deplibs=\"$deplib $finalize_deplibs\"\n\t    else\n\t      deplibs=\"$deplib $deplibs\"\n\t      test \"$linkmode\" = lib && newdependency_libs=\"$deplib $newdependency_libs\"\n\t    fi\n\t    continue\n\t  else # deplib is a libtool library\n\t    # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,\n\t    # We need to do some special things here, and not later.\n\t    if test \"X$allow_libtool_libs_with_static_runtimes\" = \"Xyes\" ; then\n\t      case \" $predeps $postdeps \" in\n\t      *\" $deplib \"*)\n\t\tif func_lalib_p \"$lib\"; then\n\t\t  library_names=\n\t\t  old_library=\n\t\t  func_source \"$lib\"\n\t\t  for l in $old_library $library_names; do\n\t\t    ll=\"$l\"\n\t\t  done\n\t\t  if test \"X$ll\" = \"X$old_library\" ; then # only static version available\n\t\t    found=no\n\t\t    func_dirname \"$lib\" \"\" \".\"\n\t\t    ladir=\"$func_dirname_result\"\n\t\t    lib=$ladir/$old_library\n\t\t    if test \"$linkmode,$pass\" = \"prog,link\"; then\n\t\t      compile_deplibs=\"$deplib $compile_deplibs\"\n\t\t      finalize_deplibs=\"$deplib $finalize_deplibs\"\n\t\t    else\n\t\t      deplibs=\"$deplib $deplibs\"\n\t\t      test \"$linkmode\" = lib && newdependency_libs=\"$deplib $newdependency_libs\"\n\t\t    fi\n\t\t    continue\n\t\t  fi\n\t\tfi\n\t\t;;\n\t      *) ;;\n\t      esac\n\t    fi\n\t  fi\n\t  ;; # -l\n\t*.ltframework)\n\t  if test \"$linkmode,$pass\" = \"prog,link\"; then\n\t    compile_deplibs=\"$deplib $compile_deplibs\"\n\t    finalize_deplibs=\"$deplib $finalize_deplibs\"\n\t  else\n\t    deplibs=\"$deplib $deplibs\"\n\t    if test \"$linkmode\" = lib ; then\n\t\tcase \"$new_inherited_linker_flags \" in\n\t\t    *\" $deplib \"*) ;;\n\t\t    * ) new_inherited_linker_flags=\"$new_inherited_linker_flags $deplib\" ;;\n\t\tesac\n\t    fi\n\t  fi\n\t  continue\n\t  ;;\n\t-L*)\n\t  case $linkmode in\n\t  lib)\n\t    deplibs=\"$deplib $deplibs\"\n\t    test \"$pass\" = conv && continue\n\t    newdependency_libs=\"$deplib $newdependency_libs\"\n\t    func_stripname '-L' '' \"$deplib\"\n\t    newlib_search_path=\"$newlib_search_path $func_stripname_result\"\n\t    ;;\n\t  prog)\n\t    if test \"$pass\" = conv; then\n\t      deplibs=\"$deplib $deplibs\"\n\t      continue\n\t    fi\n\t    if test \"$pass\" = scan; then\n\t      deplibs=\"$deplib $deplibs\"\n\t    else\n\t      compile_deplibs=\"$deplib $compile_deplibs\"\n\t      finalize_deplibs=\"$deplib $finalize_deplibs\"\n\t    fi\n\t    func_stripname '-L' '' \"$deplib\"\n\t    newlib_search_path=\"$newlib_search_path $func_stripname_result\"\n\t    ;;\n\t  *)\n\t    func_warning \"\\`-L' is ignored for archives/objects\"\n\t    ;;\n\t  esac # linkmode\n\t  continue\n\t  ;; # -L\n\t-R*)\n\t  if test \"$pass\" = link; then\n\t    func_stripname '-R' '' \"$deplib\"\n\t    dir=$func_stripname_result\n\t    # Make sure the xrpath contains only unique directories.\n\t    case \"$xrpath \" in\n\t    *\" $dir \"*) ;;\n\t    *) xrpath=\"$xrpath $dir\" ;;\n\t    esac\n\t  fi\n\t  deplibs=\"$deplib $deplibs\"\n\t  continue\n\t  ;;\n\t*.la) lib=\"$deplib\" ;;\n\t*.$libext)\n\t  if test \"$pass\" = conv; then\n\t    deplibs=\"$deplib $deplibs\"\n\t    continue\n\t  fi\n\t  case $linkmode in\n\t  lib)\n\t    # Linking convenience modules into shared libraries is allowed,\n\t    # but linking other static libraries is non-portable.\n\t    case \" $dlpreconveniencelibs \" in\n\t    *\" $deplib \"*) ;;\n\t    *)\n\t      valid_a_lib=no\n\t      case $deplibs_check_method in\n\t\tmatch_pattern*)\n\t\t  set dummy $deplibs_check_method; shift\n\t\t  match_pattern_regex=`expr \"$deplibs_check_method\" : \"$1 \\(.*\\)\"`\n\t\t  if eval \"\\$ECHO \\\"X$deplib\\\"\" 2>/dev/null | $Xsed -e 10q \\\n\t\t    | $EGREP \"$match_pattern_regex\" > /dev/null; then\n\t\t    valid_a_lib=yes\n\t\t  fi\n\t\t;;\n\t\tpass_all)\n\t\t  valid_a_lib=yes\n\t\t;;\n\t      esac\n\t      if test \"$valid_a_lib\" != yes; then\n\t\t$ECHO\n\t\t$ECHO \"*** Warning: Trying to link with static lib archive $deplib.\"\n\t\t$ECHO \"*** I have the capability to make that library automatically link in when\"\n\t\t$ECHO \"*** you link to this library.  But I can only do this if you have a\"\n\t\t$ECHO \"*** shared version of the library, which you do not appear to have\"\n\t\t$ECHO \"*** because the file extensions .$libext of this argument makes me believe\"\n\t\t$ECHO \"*** that it is just a static archive that I should not use here.\"\n\t      else\n\t\t$ECHO\n\t\t$ECHO \"*** Warning: Linking the shared library $output against the\"\n\t\t$ECHO \"*** static library $deplib is not portable!\"\n\t\tdeplibs=\"$deplib $deplibs\"\n\t      fi\n\t      ;;\n\t    esac\n\t    continue\n\t    ;;\n\t  prog)\n\t    if test \"$pass\" != link; then\n\t      deplibs=\"$deplib $deplibs\"\n\t    else\n\t      compile_deplibs=\"$deplib $compile_deplibs\"\n\t      finalize_deplibs=\"$deplib $finalize_deplibs\"\n\t    fi\n\t    continue\n\t    ;;\n\t  esac # linkmode\n\t  ;; # *.$libext\n\t*.lo | *.$objext)\n\t  if test \"$pass\" = conv; then\n\t    deplibs=\"$deplib $deplibs\"\n\t  elif test \"$linkmode\" = prog; then\n\t    if test \"$pass\" = dlpreopen || test \"$dlopen_support\" != yes || test \"$build_libtool_libs\" = no; then\n\t      # If there is no dlopen support or we're linking statically,\n\t      # we need to preload.\n\t      newdlprefiles=\"$newdlprefiles $deplib\"\n\t      compile_deplibs=\"$deplib $compile_deplibs\"\n\t      finalize_deplibs=\"$deplib $finalize_deplibs\"\n\t    else\n\t      newdlfiles=\"$newdlfiles $deplib\"\n\t    fi\n\t  fi\n\t  continue\n\t  ;;\n\t%DEPLIBS%)\n\t  alldeplibs=yes\n\t  continue\n\t  ;;\n\tesac # case $deplib\n\n\tif test \"$found\" = yes || test -f \"$lib\"; then :\n\telse\n\t  func_fatal_error \"cannot find the library \\`$lib' or unhandled argument \\`$deplib'\"\n\tfi\n\n\t# Check to see that this really is a libtool archive.\n\tfunc_lalib_unsafe_p \"$lib\" \\\n\t  || func_fatal_error \"\\`$lib' is not a valid libtool archive\"\n\n\tfunc_dirname \"$lib\" \"\" \".\"\n\tladir=\"$func_dirname_result\"\n\n\tdlname=\n\tdlopen=\n\tdlpreopen=\n\tlibdir=\n\tlibrary_names=\n\told_library=\n\tinherited_linker_flags=\n\t# If the library was installed with an old release of libtool,\n\t# it will not redefine variables installed, or shouldnotlink\n\tinstalled=yes\n\tshouldnotlink=no\n\tavoidtemprpath=\n\n\n\t# Read the .la file\n\tfunc_source \"$lib\"\n\n\t# Convert \"-framework foo\" to \"foo.ltframework\"\n\tif test -n \"$inherited_linker_flags\"; then\n\t  tmp_inherited_linker_flags=`$ECHO \"X$inherited_linker_flags\" | $Xsed -e 's/-framework \\([^ $]*\\)/\\1.ltframework/g'`\n\t  for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do\n\t    case \" $new_inherited_linker_flags \" in\n\t      *\" $tmp_inherited_linker_flag \"*) ;;\n\t      *) new_inherited_linker_flags=\"$new_inherited_linker_flags $tmp_inherited_linker_flag\";;\n\t    esac\n\t  done\n\tfi\n\tdependency_libs=`$ECHO \"X $dependency_libs\" | $Xsed -e 's% \\([^ $]*\\).ltframework% -framework \\1%g'`\n\tif test \"$linkmode,$pass\" = \"lib,link\" ||\n\t   test \"$linkmode,$pass\" = \"prog,scan\" ||\n\t   { test \"$linkmode\" != prog && test \"$linkmode\" != lib; }; then\n\t  test -n \"$dlopen\" && dlfiles=\"$dlfiles $dlopen\"\n\t  test -n \"$dlpreopen\" && dlprefiles=\"$dlprefiles $dlpreopen\"\n\tfi\n\n\tif test \"$pass\" = conv; then\n\t  # Only check for convenience libraries\n\t  deplibs=\"$lib $deplibs\"\n\t  if test -z \"$libdir\"; then\n\t    if test -z \"$old_library\"; then\n\t      func_fatal_error \"cannot find name of link library for \\`$lib'\"\n\t    fi\n\t    # It is a libtool convenience library, so add in its objects.\n\t    convenience=\"$convenience $ladir/$objdir/$old_library\"\n\t    old_convenience=\"$old_convenience $ladir/$objdir/$old_library\"\n\t  elif test \"$linkmode\" != prog && test \"$linkmode\" != lib; then\n\t    func_fatal_error \"\\`$lib' is not a convenience library\"\n\t  fi\n\t  tmp_libs=\n\t  for deplib in $dependency_libs; do\n\t    deplibs=\"$deplib $deplibs\"\n\t    if $opt_duplicate_deps ; then\n\t      case \"$tmp_libs \" in\n\t      *\" $deplib \"*) specialdeplibs=\"$specialdeplibs $deplib\" ;;\n\t      esac\n\t    fi\n\t    tmp_libs=\"$tmp_libs $deplib\"\n\t  done\n\t  continue\n\tfi # $pass = conv\n\n\n\t# Get the name of the library we link against.\n\tlinklib=\n\tfor l in $old_library $library_names; do\n\t  linklib=\"$l\"\n\tdone\n\tif test -z \"$linklib\"; then\n\t  func_fatal_error \"cannot find name of link library for \\`$lib'\"\n\tfi\n\n\t# This library was specified with -dlopen.\n\tif test \"$pass\" = dlopen; then\n\t  if test -z \"$libdir\"; then\n\t    func_fatal_error \"cannot -dlopen a convenience library: \\`$lib'\"\n\t  fi\n\t  if test -z \"$dlname\" ||\n\t     test \"$dlopen_support\" != yes ||\n\t     test \"$build_libtool_libs\" = no; then\n\t    # If there is no dlname, no dlopen support or we're linking\n\t    # statically, we need to preload.  We also need to preload any\n\t    # dependent libraries so libltdl's deplib preloader doesn't\n\t    # bomb out in the load deplibs phase.\n\t    dlprefiles=\"$dlprefiles $lib $dependency_libs\"\n\t  else\n\t    newdlfiles=\"$newdlfiles $lib\"\n\t  fi\n\t  continue\n\tfi # $pass = dlopen\n\n\t# We need an absolute path.\n\tcase $ladir in\n\t[\\\\/]* | [A-Za-z]:[\\\\/]*) abs_ladir=\"$ladir\" ;;\n\t*)\n\t  abs_ladir=`cd \"$ladir\" && pwd`\n\t  if test -z \"$abs_ladir\"; then\n\t    func_warning \"cannot determine absolute directory name of \\`$ladir'\"\n\t    func_warning \"passing it literally to the linker, although it might fail\"\n\t    abs_ladir=\"$ladir\"\n\t  fi\n\t  ;;\n\tesac\n\tfunc_basename \"$lib\"\n\tlaname=\"$func_basename_result\"\n\n\t# Find the relevant object directory and library name.\n\tif test \"X$installed\" = Xyes; then\n\t  if test ! -f \"$libdir/$linklib\" && test -f \"$abs_ladir/$linklib\"; then\n\t    func_warning \"library \\`$lib' was moved.\"\n\t    dir=\"$ladir\"\n\t    absdir=\"$abs_ladir\"\n\t    libdir=\"$abs_ladir\"\n\t  else\n\t    dir=\"$libdir\"\n\t    absdir=\"$libdir\"\n\t  fi\n\t  test \"X$hardcode_automatic\" = Xyes && avoidtemprpath=yes\n\telse\n\t  if test ! -f \"$ladir/$objdir/$linklib\" && test -f \"$abs_ladir/$linklib\"; then\n\t    dir=\"$ladir\"\n\t    absdir=\"$abs_ladir\"\n\t    # Remove this search path later\n\t    notinst_path=\"$notinst_path $abs_ladir\"\n\t  else\n\t    dir=\"$ladir/$objdir\"\n\t    absdir=\"$abs_ladir/$objdir\"\n\t    # Remove this search path later\n\t    notinst_path=\"$notinst_path $abs_ladir\"\n\t  fi\n\tfi # $installed = yes\n\tfunc_stripname 'lib' '.la' \"$laname\"\n\tname=$func_stripname_result\n\n\t# This library was specified with -dlpreopen.\n\tif test \"$pass\" = dlpreopen; then\n\t  if test -z \"$libdir\" && test \"$linkmode\" = prog; then\n\t    func_fatal_error \"only libraries may -dlpreopen a convenience library: \\`$lib'\"\n\t  fi\n\t  # Prefer using a static library (so that no silly _DYNAMIC symbols\n\t  # are required to link).\n\t  if test -n \"$old_library\"; then\n\t    newdlprefiles=\"$newdlprefiles $dir/$old_library\"\n\t    # Keep a list of preopened convenience libraries to check\n\t    # that they are being used correctly in the link pass.\n\t    test -z \"$libdir\" && \\\n\t\tdlpreconveniencelibs=\"$dlpreconveniencelibs $dir/$old_library\"\n\t  # Otherwise, use the dlname, so that lt_dlopen finds it.\n\t  elif test -n \"$dlname\"; then\n\t    newdlprefiles=\"$newdlprefiles $dir/$dlname\"\n\t  else\n\t    newdlprefiles=\"$newdlprefiles $dir/$linklib\"\n\t  fi\n\tfi # $pass = dlpreopen\n\n\tif test -z \"$libdir\"; then\n\t  # Link the convenience library\n\t  if test \"$linkmode\" = lib; then\n\t    deplibs=\"$dir/$old_library $deplibs\"\n\t  elif test \"$linkmode,$pass\" = \"prog,link\"; then\n\t    compile_deplibs=\"$dir/$old_library $compile_deplibs\"\n\t    finalize_deplibs=\"$dir/$old_library $finalize_deplibs\"\n\t  else\n\t    deplibs=\"$lib $deplibs\" # used for prog,scan pass\n\t  fi\n\t  continue\n\tfi\n\n\n\tif test \"$linkmode\" = prog && test \"$pass\" != link; then\n\t  newlib_search_path=\"$newlib_search_path $ladir\"\n\t  deplibs=\"$lib $deplibs\"\n\n\t  linkalldeplibs=no\n\t  if test \"$link_all_deplibs\" != no || test -z \"$library_names\" ||\n\t     test \"$build_libtool_libs\" = no; then\n\t    linkalldeplibs=yes\n\t  fi\n\n\t  tmp_libs=\n\t  for deplib in $dependency_libs; do\n\t    case $deplib in\n\t    -L*) func_stripname '-L' '' \"$deplib\"\n\t         newlib_search_path=\"$newlib_search_path $func_stripname_result\"\n\t\t ;;\n\t    esac\n\t    # Need to link against all dependency_libs?\n\t    if test \"$linkalldeplibs\" = yes; then\n\t      deplibs=\"$deplib $deplibs\"\n\t    else\n\t      # Need to hardcode shared library paths\n\t      # or/and link against static libraries\n\t      newdependency_libs=\"$deplib $newdependency_libs\"\n\t    fi\n\t    if $opt_duplicate_deps ; then\n\t      case \"$tmp_libs \" in\n\t      *\" $deplib \"*) specialdeplibs=\"$specialdeplibs $deplib\" ;;\n\t      esac\n\t    fi\n\t    tmp_libs=\"$tmp_libs $deplib\"\n\t  done # for deplib\n\t  continue\n\tfi # $linkmode = prog...\n\n\tif test \"$linkmode,$pass\" = \"prog,link\"; then\n\t  if test -n \"$library_names\" &&\n\t     { { test \"$prefer_static_libs\" = no ||\n\t         test \"$prefer_static_libs,$installed\" = \"built,yes\"; } ||\n\t       test -z \"$old_library\"; }; then\n\t    # We need to hardcode the library path\n\t    if test -n \"$shlibpath_var\" && test -z \"$avoidtemprpath\" ; then\n\t      # Make sure the rpath contains only unique directories.\n\t      case \"$temp_rpath:\" in\n\t      *\"$absdir:\"*) ;;\n\t      *) temp_rpath=\"$temp_rpath$absdir:\" ;;\n\t      esac\n\t    fi\n\n\t    # Hardcode the library path.\n\t    # Skip directories that are in the system default run-time\n\t    # search path.\n\t    case \" $sys_lib_dlsearch_path \" in\n\t    *\" $absdir \"*) ;;\n\t    *)\n\t      case \"$compile_rpath \" in\n\t      *\" $absdir \"*) ;;\n\t      *) compile_rpath=\"$compile_rpath $absdir\"\n\t      esac\n\t      ;;\n\t    esac\n\t    case \" $sys_lib_dlsearch_path \" in\n\t    *\" $libdir \"*) ;;\n\t    *)\n\t      case \"$finalize_rpath \" in\n\t      *\" $libdir \"*) ;;\n\t      *) finalize_rpath=\"$finalize_rpath $libdir\"\n\t      esac\n\t      ;;\n\t    esac\n\t  fi # $linkmode,$pass = prog,link...\n\n\t  if test \"$alldeplibs\" = yes &&\n\t     { test \"$deplibs_check_method\" = pass_all ||\n\t       { test \"$build_libtool_libs\" = yes &&\n\t\t test -n \"$library_names\"; }; }; then\n\t    # We only need to search for static libraries\n\t    continue\n\t  fi\n\tfi\n\n\tlink_static=no # Whether the deplib will be linked statically\n\tuse_static_libs=$prefer_static_libs\n\tif test \"$use_static_libs\" = built && test \"$installed\" = yes; then\n\t  use_static_libs=no\n\tfi\n\tif test -n \"$library_names\" &&\n\t   { test \"$use_static_libs\" = no || test -z \"$old_library\"; }; then\n\t  case $host in\n\t  *cygwin* | *mingw* | *cegcc*)\n\t      # No point in relinking DLLs because paths are not encoded\n\t      notinst_deplibs=\"$notinst_deplibs $lib\"\n\t      need_relink=no\n\t    ;;\n\t  *)\n\t    if test \"$installed\" = no; then\n\t      notinst_deplibs=\"$notinst_deplibs $lib\"\n\t      need_relink=yes\n\t    fi\n\t    ;;\n\t  esac\n\t  # This is a shared library\n\n\t  # Warn about portability, can't link against -module's on some\n\t  # systems (darwin).  Don't bleat about dlopened modules though!\n\t  dlopenmodule=\"\"\n\t  for dlpremoduletest in $dlprefiles; do\n\t    if test \"X$dlpremoduletest\" = \"X$lib\"; then\n\t      dlopenmodule=\"$dlpremoduletest\"\n\t      break\n\t    fi\n\t  done\n\t  if test -z \"$dlopenmodule\" && test \"$shouldnotlink\" = yes && test \"$pass\" = link; then\n\t    $ECHO\n\t    if test \"$linkmode\" = prog; then\n\t      $ECHO \"*** Warning: Linking the executable $output against the loadable module\"\n\t    else\n\t      $ECHO \"*** Warning: Linking the shared library $output against the loadable module\"\n\t    fi\n\t    $ECHO \"*** $linklib is not portable!\"\n\t  fi\n\t  if test \"$linkmode\" = lib &&\n\t     test \"$hardcode_into_libs\" = yes; then\n\t    # Hardcode the library path.\n\t    # Skip directories that are in the system default run-time\n\t    # search path.\n\t    case \" $sys_lib_dlsearch_path \" in\n\t    *\" $absdir \"*) ;;\n\t    *)\n\t      case \"$compile_rpath \" in\n\t      *\" $absdir \"*) ;;\n\t      *) compile_rpath=\"$compile_rpath $absdir\"\n\t      esac\n\t      ;;\n\t    esac\n\t    case \" $sys_lib_dlsearch_path \" in\n\t    *\" $libdir \"*) ;;\n\t    *)\n\t      case \"$finalize_rpath \" in\n\t      *\" $libdir \"*) ;;\n\t      *) finalize_rpath=\"$finalize_rpath $libdir\"\n\t      esac\n\t      ;;\n\t    esac\n\t  fi\n\n\t  if test -n \"$old_archive_from_expsyms_cmds\"; then\n\t    # figure out the soname\n\t    set dummy $library_names\n\t    shift\n\t    realname=\"$1\"\n\t    shift\n\t    libname=`eval \"\\\\$ECHO \\\"$libname_spec\\\"\"`\n\t    # use dlname if we got it. it's perfectly good, no?\n\t    if test -n \"$dlname\"; then\n\t      soname=\"$dlname\"\n\t    elif test -n \"$soname_spec\"; then\n\t      # bleh windows\n\t      case $host in\n\t      *cygwin* | mingw* | *cegcc*)\n\t        func_arith $current - $age\n\t\tmajor=$func_arith_result\n\t\tversuffix=\"-$major\"\n\t\t;;\n\t      esac\n\t      eval soname=\\\"$soname_spec\\\"\n\t    else\n\t      soname=\"$realname\"\n\t    fi\n\n\t    # Make a new name for the extract_expsyms_cmds to use\n\t    soroot=\"$soname\"\n\t    func_basename \"$soroot\"\n\t    soname=\"$func_basename_result\"\n\t    func_stripname 'lib' '.dll' \"$soname\"\n\t    newlib=libimp-$func_stripname_result.a\n\n\t    # If the library has no export list, then create one now\n\t    if test -f \"$output_objdir/$soname-def\"; then :\n\t    else\n\t      func_verbose \"extracting exported symbol list from \\`$soname'\"\n\t      func_execute_cmds \"$extract_expsyms_cmds\" 'exit $?'\n\t    fi\n\n\t    # Create $newlib\n\t    if test -f \"$output_objdir/$newlib\"; then :; else\n\t      func_verbose \"generating import library for \\`$soname'\"\n\t      func_execute_cmds \"$old_archive_from_expsyms_cmds\" 'exit $?'\n\t    fi\n\t    # make sure the library variables are pointing to the new library\n\t    dir=$output_objdir\n\t    linklib=$newlib\n\t  fi # test -n \"$old_archive_from_expsyms_cmds\"\n\n\t  if test \"$linkmode\" = prog || test \"$mode\" != relink; then\n\t    add_shlibpath=\n\t    add_dir=\n\t    add=\n\t    lib_linked=yes\n\t    case $hardcode_action in\n\t    immediate | unsupported)\n\t      if test \"$hardcode_direct\" = no; then\n\t\tadd=\"$dir/$linklib\"\n\t\tcase $host in\n\t\t  *-*-sco3.2v5.0.[024]*) add_dir=\"-L$dir\" ;;\n\t\t  *-*-sysv4*uw2*) add_dir=\"-L$dir\" ;;\n\t\t  *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \\\n\t\t    *-*-unixware7*) add_dir=\"-L$dir\" ;;\n\t\t  *-*-darwin* )\n\t\t    # if the lib is a (non-dlopened) module then we can not\n\t\t    # link against it, someone is ignoring the earlier warnings\n\t\t    if /usr/bin/file -L $add 2> /dev/null |\n\t\t\t $GREP \": [^:]* bundle\" >/dev/null ; then\n\t\t      if test \"X$dlopenmodule\" != \"X$lib\"; then\n\t\t\t$ECHO \"*** Warning: lib $linklib is a module, not a shared library\"\n\t\t\tif test -z \"$old_library\" ; then\n\t\t\t  $ECHO\n\t\t\t  $ECHO \"*** And there doesn't seem to be a static archive available\"\n\t\t\t  $ECHO \"*** The link will probably fail, sorry\"\n\t\t\telse\n\t\t\t  add=\"$dir/$old_library\"\n\t\t\tfi\n\t\t      elif test -n \"$old_library\"; then\n\t\t\tadd=\"$dir/$old_library\"\n\t\t      fi\n\t\t    fi\n\t\tesac\n\t      elif test \"$hardcode_minus_L\" = no; then\n\t\tcase $host in\n\t\t*-*-sunos*) add_shlibpath=\"$dir\" ;;\n\t\tesac\n\t\tadd_dir=\"-L$dir\"\n\t\tadd=\"-l$name\"\n\t      elif test \"$hardcode_shlibpath_var\" = no; then\n\t\tadd_shlibpath=\"$dir\"\n\t\tadd=\"-l$name\"\n\t      else\n\t\tlib_linked=no\n\t      fi\n\t      ;;\n\t    relink)\n\t      if test \"$hardcode_direct\" = yes &&\n\t         test \"$hardcode_direct_absolute\" = no; then\n\t\tadd=\"$dir/$linklib\"\n\t      elif test \"$hardcode_minus_L\" = yes; then\n\t\tadd_dir=\"-L$dir\"\n\t\t# Try looking first in the location we're being installed to.\n\t\tif test -n \"$inst_prefix_dir\"; then\n\t\t  case $libdir in\n\t\t    [\\\\/]*)\n\t\t      add_dir=\"$add_dir -L$inst_prefix_dir$libdir\"\n\t\t      ;;\n\t\t  esac\n\t\tfi\n\t\tadd=\"-l$name\"\n\t      elif test \"$hardcode_shlibpath_var\" = yes; then\n\t\tadd_shlibpath=\"$dir\"\n\t\tadd=\"-l$name\"\n\t      else\n\t\tlib_linked=no\n\t      fi\n\t      ;;\n\t    *) lib_linked=no ;;\n\t    esac\n\n\t    if test \"$lib_linked\" != yes; then\n\t      func_fatal_configuration \"unsupported hardcode properties\"\n\t    fi\n\n\t    if test -n \"$add_shlibpath\"; then\n\t      case :$compile_shlibpath: in\n\t      *\":$add_shlibpath:\"*) ;;\n\t      *) compile_shlibpath=\"$compile_shlibpath$add_shlibpath:\" ;;\n\t      esac\n\t    fi\n\t    if test \"$linkmode\" = prog; then\n\t      test -n \"$add_dir\" && compile_deplibs=\"$add_dir $compile_deplibs\"\n\t      test -n \"$add\" && compile_deplibs=\"$add $compile_deplibs\"\n\t    else\n\t      test -n \"$add_dir\" && deplibs=\"$add_dir $deplibs\"\n\t      test -n \"$add\" && deplibs=\"$add $deplibs\"\n\t      if test \"$hardcode_direct\" != yes &&\n\t\t test \"$hardcode_minus_L\" != yes &&\n\t\t test \"$hardcode_shlibpath_var\" = yes; then\n\t\tcase :$finalize_shlibpath: in\n\t\t*\":$libdir:\"*) ;;\n\t\t*) finalize_shlibpath=\"$finalize_shlibpath$libdir:\" ;;\n\t\tesac\n\t      fi\n\t    fi\n\t  fi\n\n\t  if test \"$linkmode\" = prog || test \"$mode\" = relink; then\n\t    add_shlibpath=\n\t    add_dir=\n\t    add=\n\t    # Finalize command for both is simple: just hardcode it.\n\t    if test \"$hardcode_direct\" = yes &&\n\t       test \"$hardcode_direct_absolute\" = no; then\n\t      add=\"$libdir/$linklib\"\n\t    elif test \"$hardcode_minus_L\" = yes; then\n\t      add_dir=\"-L$libdir\"\n\t      add=\"-l$name\"\n\t    elif test \"$hardcode_shlibpath_var\" = yes; then\n\t      case :$finalize_shlibpath: in\n\t      *\":$libdir:\"*) ;;\n\t      *) finalize_shlibpath=\"$finalize_shlibpath$libdir:\" ;;\n\t      esac\n\t      add=\"-l$name\"\n\t    elif test \"$hardcode_automatic\" = yes; then\n\t      if test -n \"$inst_prefix_dir\" &&\n\t\t test -f \"$inst_prefix_dir$libdir/$linklib\" ; then\n\t\tadd=\"$inst_prefix_dir$libdir/$linklib\"\n\t      else\n\t\tadd=\"$libdir/$linklib\"\n\t      fi\n\t    else\n\t      # We cannot seem to hardcode it, guess we'll fake it.\n\t      add_dir=\"-L$libdir\"\n\t      # Try looking first in the location we're being installed to.\n\t      if test -n \"$inst_prefix_dir\"; then\n\t\tcase $libdir in\n\t\t  [\\\\/]*)\n\t\t    add_dir=\"$add_dir -L$inst_prefix_dir$libdir\"\n\t\t    ;;\n\t\tesac\n\t      fi\n\t      add=\"-l$name\"\n\t    fi\n\n\t    if test \"$linkmode\" = prog; then\n\t      test -n \"$add_dir\" && finalize_deplibs=\"$add_dir $finalize_deplibs\"\n\t      test -n \"$add\" && finalize_deplibs=\"$add $finalize_deplibs\"\n\t    else\n\t      test -n \"$add_dir\" && deplibs=\"$add_dir $deplibs\"\n\t      test -n \"$add\" && deplibs=\"$add $deplibs\"\n\t    fi\n\t  fi\n\telif test \"$linkmode\" = prog; then\n\t  # Here we assume that one of hardcode_direct or hardcode_minus_L\n\t  # is not unsupported.  This is valid on all known static and\n\t  # shared platforms.\n\t  if test \"$hardcode_direct\" != unsupported; then\n\t    test -n \"$old_library\" && linklib=\"$old_library\"\n\t    compile_deplibs=\"$dir/$linklib $compile_deplibs\"\n\t    finalize_deplibs=\"$dir/$linklib $finalize_deplibs\"\n\t  else\n\t    compile_deplibs=\"-l$name -L$dir $compile_deplibs\"\n\t    finalize_deplibs=\"-l$name -L$dir $finalize_deplibs\"\n\t  fi\n\telif test \"$build_libtool_libs\" = yes; then\n\t  # Not a shared library\n\t  if test \"$deplibs_check_method\" != pass_all; then\n\t    # We're trying link a shared library against a static one\n\t    # but the system doesn't support it.\n\n\t    # Just print a warning and add the library to dependency_libs so\n\t    # that the program can be linked against the static library.\n\t    $ECHO\n\t    $ECHO \"*** Warning: This system can not link to static lib archive $lib.\"\n\t    $ECHO \"*** I have the capability to make that library automatically link in when\"\n\t    $ECHO \"*** you link to this library.  But I can only do this if you have a\"\n\t    $ECHO \"*** shared version of the library, which you do not appear to have.\"\n\t    if test \"$module\" = yes; then\n\t      $ECHO \"*** But as you try to build a module library, libtool will still create \"\n\t      $ECHO \"*** a static module, that should work as long as the dlopening application\"\n\t      $ECHO \"*** is linked with the -dlopen flag to resolve symbols at runtime.\"\n\t      if test -z \"$global_symbol_pipe\"; then\n\t\t$ECHO\n\t\t$ECHO \"*** However, this would only work if libtool was able to extract symbol\"\n\t\t$ECHO \"*** lists from a program, using \\`nm' or equivalent, but libtool could\"\n\t\t$ECHO \"*** not find such a program.  So, this module is probably useless.\"\n\t\t$ECHO \"*** \\`nm' from GNU binutils and a full rebuild may help.\"\n\t      fi\n\t      if test \"$build_old_libs\" = no; then\n\t\tbuild_libtool_libs=module\n\t\tbuild_old_libs=yes\n\t      else\n\t\tbuild_libtool_libs=no\n\t      fi\n\t    fi\n\t  else\n\t    deplibs=\"$dir/$old_library $deplibs\"\n\t    link_static=yes\n\t  fi\n\tfi # link shared/static library?\n\n\tif test \"$linkmode\" = lib; then\n\t  if test -n \"$dependency_libs\" &&\n\t     { test \"$hardcode_into_libs\" != yes ||\n\t       test \"$build_old_libs\" = yes ||\n\t       test \"$link_static\" = yes; }; then\n\t    # Extract -R from dependency_libs\n\t    temp_deplibs=\n\t    for libdir in $dependency_libs; do\n\t      case $libdir in\n\t      -R*) func_stripname '-R' '' \"$libdir\"\n\t           temp_xrpath=$func_stripname_result\n\t\t   case \" $xrpath \" in\n\t\t   *\" $temp_xrpath \"*) ;;\n\t\t   *) xrpath=\"$xrpath $temp_xrpath\";;\n\t\t   esac;;\n\t      *) temp_deplibs=\"$temp_deplibs $libdir\";;\n\t      esac\n\t    done\n\t    dependency_libs=\"$temp_deplibs\"\n\t  fi\n\n\t  newlib_search_path=\"$newlib_search_path $absdir\"\n\t  # Link against this library\n\t  test \"$link_static\" = no && newdependency_libs=\"$abs_ladir/$laname $newdependency_libs\"\n\t  # ... and its dependency_libs\n\t  tmp_libs=\n\t  for deplib in $dependency_libs; do\n\t    newdependency_libs=\"$deplib $newdependency_libs\"\n\t    if $opt_duplicate_deps ; then\n\t      case \"$tmp_libs \" in\n\t      *\" $deplib \"*) specialdeplibs=\"$specialdeplibs $deplib\" ;;\n\t      esac\n\t    fi\n\t    tmp_libs=\"$tmp_libs $deplib\"\n\t  done\n\n\t  if test \"$link_all_deplibs\" != no; then\n\t    # Add the search paths of all dependency libraries\n\t    for deplib in $dependency_libs; do\n\t      case $deplib in\n\t      -L*) path=\"$deplib\" ;;\n\t      *.la)\n\t        func_dirname \"$deplib\" \"\" \".\"\n\t\tdir=\"$func_dirname_result\"\n\t\t# We need an absolute path.\n\t\tcase $dir in\n\t\t[\\\\/]* | [A-Za-z]:[\\\\/]*) absdir=\"$dir\" ;;\n\t\t*)\n\t\t  absdir=`cd \"$dir\" && pwd`\n\t\t  if test -z \"$absdir\"; then\n\t\t    func_warning \"cannot determine absolute directory name of \\`$dir'\"\n\t\t    absdir=\"$dir\"\n\t\t  fi\n\t\t  ;;\n\t\tesac\n\t\tif $GREP \"^installed=no\" $deplib > /dev/null; then\n\t\tcase $host in\n\t\t*-*-darwin*)\n\t\t  depdepl=\n\t\t  eval deplibrary_names=`${SED} -n -e 's/^library_names=\\(.*\\)$/\\1/p' $deplib`\n\t\t  if test -n \"$deplibrary_names\" ; then\n\t\t    for tmp in $deplibrary_names ; do\n\t\t      depdepl=$tmp\n\t\t    done\n\t\t    if test -f \"$absdir/$objdir/$depdepl\" ; then\n\t\t      depdepl=\"$absdir/$objdir/$depdepl\"\n\t\t      darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`\n                      if test -z \"$darwin_install_name\"; then\n                          darwin_install_name=`${OTOOL64} -L $depdepl  | awk '{if (NR == 2) {print $1;exit}}'`\n                      fi\n\t\t      compiler_flags=\"$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}\"\n\t\t      linker_flags=\"$linker_flags -dylib_file ${darwin_install_name}:${depdepl}\"\n\t\t      path=\n\t\t    fi\n\t\t  fi\n\t\t  ;;\n\t\t*)\n\t\t  path=\"-L$absdir/$objdir\"\n\t\t  ;;\n\t\tesac\n\t\telse\n\t\t  eval libdir=`${SED} -n -e 's/^libdir=\\(.*\\)$/\\1/p' $deplib`\n\t\t  test -z \"$libdir\" && \\\n\t\t    func_fatal_error \"\\`$deplib' is not a valid libtool archive\"\n\t\t  test \"$absdir\" != \"$libdir\" && \\\n\t\t    func_warning \"\\`$deplib' seems to be moved\"\n\n\t\t  path=\"-L$absdir\"\n\t\tfi\n\t\t;;\n\t      esac\n\t      case \" $deplibs \" in\n\t      *\" $path \"*) ;;\n\t      *) deplibs=\"$path $deplibs\" ;;\n\t      esac\n\t    done\n\t  fi # link_all_deplibs != no\n\tfi # linkmode = lib\n      done # for deplib in $libs\n      if test \"$pass\" = link; then\n\tif test \"$linkmode\" = \"prog\"; then\n\t  compile_deplibs=\"$new_inherited_linker_flags $compile_deplibs\"\n\t  finalize_deplibs=\"$new_inherited_linker_flags $finalize_deplibs\"\n\telse\n\t  compiler_flags=\"$compiler_flags \"`$ECHO \"X $new_inherited_linker_flags\" | $Xsed -e 's% \\([^ $]*\\).ltframework% -framework \\1%g'`\n\tfi\n      fi\n      dependency_libs=\"$newdependency_libs\"\n      if test \"$pass\" = dlpreopen; then\n\t# Link the dlpreopened libraries before other libraries\n\tfor deplib in $save_deplibs; do\n\t  deplibs=\"$deplib $deplibs\"\n\tdone\n      fi\n      if test \"$pass\" != dlopen; then\n\tif test \"$pass\" != conv; then\n\t  # Make sure lib_search_path contains only unique directories.\n\t  lib_search_path=\n\t  for dir in $newlib_search_path; do\n\t    case \"$lib_search_path \" in\n\t    *\" $dir \"*) ;;\n\t    *) lib_search_path=\"$lib_search_path $dir\" ;;\n\t    esac\n\t  done\n\t  newlib_search_path=\n\tfi\n\n\tif test \"$linkmode,$pass\" != \"prog,link\"; then\n\t  vars=\"deplibs\"\n\telse\n\t  vars=\"compile_deplibs finalize_deplibs\"\n\tfi\n\tfor var in $vars dependency_libs; do\n\t  # Add libraries to $var in reverse order\n\t  eval tmp_libs=\\\"\\$$var\\\"\n\t  new_libs=\n\t  for deplib in $tmp_libs; do\n\t    # FIXME: Pedantically, this is the right thing to do, so\n\t    #        that some nasty dependency loop isn't accidentally\n\t    #        broken:\n\t    #new_libs=\"$deplib $new_libs\"\n\t    # Pragmatically, this seems to cause very few problems in\n\t    # practice:\n\t    case $deplib in\n\t    -L*) new_libs=\"$deplib $new_libs\" ;;\n\t    -R*) ;;\n\t    *)\n\t      # And here is the reason: when a library appears more\n\t      # than once as an explicit dependence of a library, or\n\t      # is implicitly linked in more than once by the\n\t      # compiler, it is considered special, and multiple\n\t      # occurrences thereof are not removed.  Compare this\n\t      # with having the same library being listed as a\n\t      # dependency of multiple other libraries: in this case,\n\t      # we know (pedantically, we assume) the library does not\n\t      # need to be listed more than once, so we keep only the\n\t      # last copy.  This is not always right, but it is rare\n\t      # enough that we require users that really mean to play\n\t      # such unportable linking tricks to link the library\n\t      # using -Wl,-lname, so that libtool does not consider it\n\t      # for duplicate removal.\n\t      case \" $specialdeplibs \" in\n\t      *\" $deplib \"*) new_libs=\"$deplib $new_libs\" ;;\n\t      *)\n\t\tcase \" $new_libs \" in\n\t\t*\" $deplib \"*) ;;\n\t\t*) new_libs=\"$deplib $new_libs\" ;;\n\t\tesac\n\t\t;;\n\t      esac\n\t      ;;\n\t    esac\n\t  done\n\t  tmp_libs=\n\t  for deplib in $new_libs; do\n\t    case $deplib in\n\t    -L*)\n\t      case \" $tmp_libs \" in\n\t      *\" $deplib \"*) ;;\n\t      *) tmp_libs=\"$tmp_libs $deplib\" ;;\n\t      esac\n\t      ;;\n\t    *) tmp_libs=\"$tmp_libs $deplib\" ;;\n\t    esac\n\t  done\n\t  eval $var=\\\"$tmp_libs\\\"\n\tdone # for var\n      fi\n      # Last step: remove runtime libs from dependency_libs\n      # (they stay in deplibs)\n      tmp_libs=\n      for i in $dependency_libs ; do\n\tcase \" $predeps $postdeps $compiler_lib_search_path \" in\n\t*\" $i \"*)\n\t  i=\"\"\n\t  ;;\n\tesac\n\tif test -n \"$i\" ; then\n\t  tmp_libs=\"$tmp_libs $i\"\n\tfi\n      done\n      dependency_libs=$tmp_libs\n    done # for pass\n    if test \"$linkmode\" = prog; then\n      dlfiles=\"$newdlfiles\"\n    fi\n    if test \"$linkmode\" = prog || test \"$linkmode\" = lib; then\n      dlprefiles=\"$newdlprefiles\"\n    fi\n\n    case $linkmode in\n    oldlib)\n      if test -n \"$dlfiles$dlprefiles\" || test \"$dlself\" != no; then\n\tfunc_warning \"\\`-dlopen' is ignored for archives\"\n      fi\n\n      case \" $deplibs\" in\n      *\\ -l* | *\\ -L*)\n\tfunc_warning \"\\`-l' and \\`-L' are ignored for archives\" ;;\n      esac\n\n      test -n \"$rpath\" && \\\n\tfunc_warning \"\\`-rpath' is ignored for archives\"\n\n      test -n \"$xrpath\" && \\\n\tfunc_warning \"\\`-R' is ignored for archives\"\n\n      test -n \"$vinfo\" && \\\n\tfunc_warning \"\\`-version-info/-version-number' is ignored for archives\"\n\n      test -n \"$release\" && \\\n\tfunc_warning \"\\`-release' is ignored for archives\"\n\n      test -n \"$export_symbols$export_symbols_regex\" && \\\n\tfunc_warning \"\\`-export-symbols' is ignored for archives\"\n\n      # Now set the variables for building old libraries.\n      build_libtool_libs=no\n      oldlibs=\"$output\"\n      objs=\"$objs$old_deplibs\"\n      ;;\n\n    lib)\n      # Make sure we only generate libraries of the form `libNAME.la'.\n      case $outputname in\n      lib*)\n\tfunc_stripname 'lib' '.la' \"$outputname\"\n\tname=$func_stripname_result\n\teval shared_ext=\\\"$shrext_cmds\\\"\n\teval libname=\\\"$libname_spec\\\"\n\t;;\n      *)\n\ttest \"$module\" = no && \\\n\t  func_fatal_help \"libtool library \\`$output' must begin with \\`lib'\"\n\n\tif test \"$need_lib_prefix\" != no; then\n\t  # Add the \"lib\" prefix for modules if required\n\t  func_stripname '' '.la' \"$outputname\"\n\t  name=$func_stripname_result\n\t  eval shared_ext=\\\"$shrext_cmds\\\"\n\t  eval libname=\\\"$libname_spec\\\"\n\telse\n\t  func_stripname '' '.la' \"$outputname\"\n\t  libname=$func_stripname_result\n\tfi\n\t;;\n      esac\n\n      if test -n \"$objs\"; then\n\tif test \"$deplibs_check_method\" != pass_all; then\n\t  func_fatal_error \"cannot build libtool library \\`$output' from non-libtool objects on this host:$objs\"\n\telse\n\t  $ECHO\n\t  $ECHO \"*** Warning: Linking the shared library $output against the non-libtool\"\n\t  $ECHO \"*** objects $objs is not portable!\"\n\t  libobjs=\"$libobjs $objs\"\n\tfi\n      fi\n\n      test \"$dlself\" != no && \\\n\tfunc_warning \"\\`-dlopen self' is ignored for libtool libraries\"\n\n      set dummy $rpath\n      shift\n      test \"$#\" -gt 1 && \\\n\tfunc_warning \"ignoring multiple \\`-rpath's for a libtool library\"\n\n      install_libdir=\"$1\"\n\n      oldlibs=\n      if test -z \"$rpath\"; then\n\tif test \"$build_libtool_libs\" = yes; then\n\t  # Building a libtool convenience library.\n\t  # Some compilers have problems with a `.al' extension so\n\t  # convenience libraries should have the same extension an\n\t  # archive normally would.\n\t  oldlibs=\"$output_objdir/$libname.$libext $oldlibs\"\n\t  build_libtool_libs=convenience\n\t  build_old_libs=yes\n\tfi\n\n\ttest -n \"$vinfo\" && \\\n\t  func_warning \"\\`-version-info/-version-number' is ignored for convenience libraries\"\n\n\ttest -n \"$release\" && \\\n\t  func_warning \"\\`-release' is ignored for convenience libraries\"\n      else\n\n\t# Parse the version information argument.\n\tsave_ifs=\"$IFS\"; IFS=':'\n\tset dummy $vinfo 0 0 0\n\tshift\n\tIFS=\"$save_ifs\"\n\n\ttest -n \"$7\" && \\\n\t  func_fatal_help \"too many parameters to \\`-version-info'\"\n\n\t# convert absolute version numbers to libtool ages\n\t# this retains compatibility with .la files and attempts\n\t# to make the code below a bit more comprehensible\n\n\tcase $vinfo_number in\n\tyes)\n\t  number_major=\"$1\"\n\t  number_minor=\"$2\"\n\t  number_revision=\"$3\"\n\t  #\n\t  # There are really only two kinds -- those that\n\t  # use the current revision as the major version\n\t  # and those that subtract age and use age as\n\t  # a minor version.  But, then there is irix\n\t  # which has an extra 1 added just for fun\n\t  #\n\t  case $version_type in\n\t  darwin|linux|osf|windows|none)\n\t    func_arith $number_major + $number_minor\n\t    current=$func_arith_result\n\t    age=\"$number_minor\"\n\t    revision=\"$number_revision\"\n\t    ;;\n\t  freebsd-aout|freebsd-elf|sunos)\n\t    current=\"$number_major\"\n\t    revision=\"$number_minor\"\n\t    age=\"0\"\n\t    ;;\n\t  irix|nonstopux)\n\t    func_arith $number_major + $number_minor\n\t    current=$func_arith_result\n\t    age=\"$number_minor\"\n\t    revision=\"$number_minor\"\n\t    lt_irix_increment=no\n\t    ;;\n\t  esac\n\t  ;;\n\tno)\n\t  current=\"$1\"\n\t  revision=\"$2\"\n\t  age=\"$3\"\n\t  ;;\n\tesac\n\n\t# Check that each of the things are valid numbers.\n\tcase $current in\n\t0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;\n\t*)\n\t  func_error \"CURRENT \\`$current' must be a nonnegative integer\"\n\t  func_fatal_error \"\\`$vinfo' is not valid version information\"\n\t  ;;\n\tesac\n\n\tcase $revision in\n\t0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;\n\t*)\n\t  func_error \"REVISION \\`$revision' must be a nonnegative integer\"\n\t  func_fatal_error \"\\`$vinfo' is not valid version information\"\n\t  ;;\n\tesac\n\n\tcase $age in\n\t0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;\n\t*)\n\t  func_error \"AGE \\`$age' must be a nonnegative integer\"\n\t  func_fatal_error \"\\`$vinfo' is not valid version information\"\n\t  ;;\n\tesac\n\n\tif test \"$age\" -gt \"$current\"; then\n\t  func_error \"AGE \\`$age' is greater than the current interface number \\`$current'\"\n\t  func_fatal_error \"\\`$vinfo' is not valid version information\"\n\tfi\n\n\t# Calculate the version variables.\n\tmajor=\n\tversuffix=\n\tverstring=\n\tcase $version_type in\n\tnone) ;;\n\n\tdarwin)\n\t  # Like Linux, but with the current version available in\n\t  # verstring for coding it into the library header\n\t  func_arith $current - $age\n\t  major=.$func_arith_result\n\t  versuffix=\"$major.$age.$revision\"\n\t  # Darwin ld doesn't like 0 for these options...\n\t  func_arith $current + 1\n\t  minor_current=$func_arith_result\n\t  xlcverstring=\"${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision\"\n\t  verstring=\"-compatibility_version $minor_current -current_version $minor_current.$revision\"\n\t  ;;\n\n\tfreebsd-aout)\n\t  major=\".$current\"\n\t  versuffix=\".$current.$revision\";\n\t  ;;\n\n\tfreebsd-elf)\n\t  major=\".$current\"\n\t  versuffix=\".$current\"\n\t  ;;\n\n\tirix | nonstopux)\n\t  if test \"X$lt_irix_increment\" = \"Xno\"; then\n\t    func_arith $current - $age\n\t  else\n\t    func_arith $current - $age + 1\n\t  fi\n\t  major=$func_arith_result\n\n\t  case $version_type in\n\t    nonstopux) verstring_prefix=nonstopux ;;\n\t    *)         verstring_prefix=sgi ;;\n\t  esac\n\t  verstring=\"$verstring_prefix$major.$revision\"\n\n\t  # Add in all the interfaces that we are compatible with.\n\t  loop=$revision\n\t  while test \"$loop\" -ne 0; do\n\t    func_arith $revision - $loop\n\t    iface=$func_arith_result\n\t    func_arith $loop - 1\n\t    loop=$func_arith_result\n\t    verstring=\"$verstring_prefix$major.$iface:$verstring\"\n\t  done\n\n\t  # Before this point, $major must not contain `.'.\n\t  major=.$major\n\t  versuffix=\"$major.$revision\"\n\t  ;;\n\n\tlinux)\n\t  func_arith $current - $age\n\t  major=.$func_arith_result\n\t  versuffix=\"$major.$age.$revision\"\n\t  ;;\n\n\tosf)\n\t  func_arith $current - $age\n\t  major=.$func_arith_result\n\t  versuffix=\".$current.$age.$revision\"\n\t  verstring=\"$current.$age.$revision\"\n\n\t  # Add in all the interfaces that we are compatible with.\n\t  loop=$age\n\t  while test \"$loop\" -ne 0; do\n\t    func_arith $current - $loop\n\t    iface=$func_arith_result\n\t    func_arith $loop - 1\n\t    loop=$func_arith_result\n\t    verstring=\"$verstring:${iface}.0\"\n\t  done\n\n\t  # Make executables depend on our current version.\n\t  verstring=\"$verstring:${current}.0\"\n\t  ;;\n\n\tqnx)\n\t  major=\".$current\"\n\t  versuffix=\".$current\"\n\t  ;;\n\n\tsunos)\n\t  major=\".$current\"\n\t  versuffix=\".$current.$revision\"\n\t  ;;\n\n\twindows)\n\t  # Use '-' rather than '.', since we only want one\n\t  # extension on DOS 8.3 filesystems.\n\t  func_arith $current - $age\n\t  major=$func_arith_result\n\t  versuffix=\"-$major\"\n\t  ;;\n\n\t*)\n\t  func_fatal_configuration \"unknown library version type \\`$version_type'\"\n\t  ;;\n\tesac\n\n\t# Clear the version info if we defaulted, and they specified a release.\n\tif test -z \"$vinfo\" && test -n \"$release\"; then\n\t  major=\n\t  case $version_type in\n\t  darwin)\n\t    # we can't check for \"0.0\" in archive_cmds due to quoting\n\t    # problems, so we reset it completely\n\t    verstring=\n\t    ;;\n\t  *)\n\t    verstring=\"0.0\"\n\t    ;;\n\t  esac\n\t  if test \"$need_version\" = no; then\n\t    versuffix=\n\t  else\n\t    versuffix=\".0.0\"\n\t  fi\n\tfi\n\n\t# Remove version info from name if versioning should be avoided\n\tif test \"$avoid_version\" = yes && test \"$need_version\" = no; then\n\t  major=\n\t  versuffix=\n\t  verstring=\"\"\n\tfi\n\n\t# Check to see if the archive will have undefined symbols.\n\tif test \"$allow_undefined\" = yes; then\n\t  if test \"$allow_undefined_flag\" = unsupported; then\n\t    func_warning \"undefined symbols not allowed in $host shared libraries\"\n\t    build_libtool_libs=no\n\t    build_old_libs=yes\n\t  fi\n\telse\n\t  # Don't allow undefined symbols.\n\t  allow_undefined_flag=\"$no_undefined_flag\"\n\tfi\n\n      fi\n\n      func_generate_dlsyms \"$libname\" \"$libname\" \"yes\"\n      libobjs=\"$libobjs $symfileobj\"\n      test \"X$libobjs\" = \"X \" && libobjs=\n\n      if test \"$mode\" != relink; then\n\t# Remove our outputs, but don't remove object files since they\n\t# may have been created when compiling PIC objects.\n\tremovelist=\n\ttempremovelist=`$ECHO \"$output_objdir/*\"`\n\tfor p in $tempremovelist; do\n\t  case $p in\n\t    *.$objext | *.gcno)\n\t       ;;\n\t    $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)\n\t       if test \"X$precious_files_regex\" != \"X\"; then\n\t\t if $ECHO \"$p\" | $EGREP -e \"$precious_files_regex\" >/dev/null 2>&1\n\t\t then\n\t\t   continue\n\t\t fi\n\t       fi\n\t       removelist=\"$removelist $p\"\n\t       ;;\n\t    *) ;;\n\t  esac\n\tdone\n\ttest -n \"$removelist\" && \\\n\t  func_show_eval \"${RM}r \\$removelist\"\n      fi\n\n      # Now set the variables for building old libraries.\n      if test \"$build_old_libs\" = yes && test \"$build_libtool_libs\" != convenience ; then\n\toldlibs=\"$oldlibs $output_objdir/$libname.$libext\"\n\n\t# Transform .lo files to .o files.\n\toldobjs=\"$objs \"`$ECHO \"X$libobjs\" | $SP2NL | $Xsed -e '/\\.'${libext}'$/d' -e \"$lo2o\" | $NL2SP`\n      fi\n\n      # Eliminate all temporary directories.\n      #for path in $notinst_path; do\n      #\tlib_search_path=`$ECHO \"X$lib_search_path \" | $Xsed -e \"s% $path % %g\"`\n      #\tdeplibs=`$ECHO \"X$deplibs \" | $Xsed -e \"s% -L$path % %g\"`\n      #\tdependency_libs=`$ECHO \"X$dependency_libs \" | $Xsed -e \"s% -L$path % %g\"`\n      #done\n\n      if test -n \"$xrpath\"; then\n\t# If the user specified any rpath flags, then add them.\n\ttemp_xrpath=\n\tfor libdir in $xrpath; do\n\t  temp_xrpath=\"$temp_xrpath -R$libdir\"\n\t  case \"$finalize_rpath \" in\n\t  *\" $libdir \"*) ;;\n\t  *) finalize_rpath=\"$finalize_rpath $libdir\" ;;\n\t  esac\n\tdone\n\tif test \"$hardcode_into_libs\" != yes || test \"$build_old_libs\" = yes; then\n\t  dependency_libs=\"$temp_xrpath $dependency_libs\"\n\tfi\n      fi\n\n      # Make sure dlfiles contains only unique files that won't be dlpreopened\n      old_dlfiles=\"$dlfiles\"\n      dlfiles=\n      for lib in $old_dlfiles; do\n\tcase \" $dlprefiles $dlfiles \" in\n\t*\" $lib \"*) ;;\n\t*) dlfiles=\"$dlfiles $lib\" ;;\n\tesac\n      done\n\n      # Make sure dlprefiles contains only unique files\n      old_dlprefiles=\"$dlprefiles\"\n      dlprefiles=\n      for lib in $old_dlprefiles; do\n\tcase \"$dlprefiles \" in\n\t*\" $lib \"*) ;;\n\t*) dlprefiles=\"$dlprefiles $lib\" ;;\n\tesac\n      done\n\n      if test \"$build_libtool_libs\" = yes; then\n\tif test -n \"$rpath\"; then\n\t  case $host in\n\t  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc*)\n\t    # these systems don't actually have a c library (as such)!\n\t    ;;\n\t  *-*-rhapsody* | *-*-darwin1.[012])\n\t    # Rhapsody C library is in the System framework\n\t    deplibs=\"$deplibs System.ltframework\"\n\t    ;;\n\t  *-*-netbsd*)\n\t    # Don't link with libc until the a.out ld.so is fixed.\n\t    ;;\n\t  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)\n\t    # Do not include libc due to us having libc/libc_r.\n\t    ;;\n\t  *-*-sco3.2v5* | *-*-sco5v6*)\n\t    # Causes problems with __ctype\n\t    ;;\n\t  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)\n\t    # Compiler inserts libc in the correct place for threads to work\n\t    ;;\n\t  *)\n\t    # Add libc to deplibs on all other systems if necessary.\n\t    if test \"$build_libtool_need_lc\" = \"yes\"; then\n\t      deplibs=\"$deplibs -lc\"\n\t    fi\n\t    ;;\n\t  esac\n\tfi\n\n\t# Transform deplibs into only deplibs that can be linked in shared.\n\tname_save=$name\n\tlibname_save=$libname\n\trelease_save=$release\n\tversuffix_save=$versuffix\n\tmajor_save=$major\n\t# I'm not sure if I'm treating the release correctly.  I think\n\t# release should show up in the -l (ie -lgmp5) so we don't want to\n\t# add it in twice.  Is that correct?\n\trelease=\"\"\n\tversuffix=\"\"\n\tmajor=\"\"\n\tnewdeplibs=\n\tdroppeddeps=no\n\tcase $deplibs_check_method in\n\tpass_all)\n\t  # Don't check for shared/static.  Everything works.\n\t  # This might be a little naive.  We might want to check\n\t  # whether the library exists or not.  But this is on\n\t  # osf3 & osf4 and I'm not really sure... Just\n\t  # implementing what was already the behavior.\n\t  newdeplibs=$deplibs\n\t  ;;\n\ttest_compile)\n\t  # This code stresses the \"libraries are programs\" paradigm to its\n\t  # limits. Maybe even breaks it.  We compile a program, linking it\n\t  # against the deplibs as a proxy for the library.  Then we can check\n\t  # whether they linked in statically or dynamically with ldd.\n\t  $opt_dry_run || $RM conftest.c\n\t  cat > conftest.c <<EOF\n\t  int main() { return 0; }\nEOF\n\t  $opt_dry_run || $RM conftest\n\t  if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then\n\t    ldd_output=`ldd conftest`\n\t    for i in $deplibs; do\n\t      case $i in\n\t      -l*)\n\t\tfunc_stripname -l '' \"$i\"\n\t\tname=$func_stripname_result\n\t\tif test \"X$allow_libtool_libs_with_static_runtimes\" = \"Xyes\" ; then\n\t\t  case \" $predeps $postdeps \" in\n\t\t  *\" $i \"*)\n\t\t    newdeplibs=\"$newdeplibs $i\"\n\t\t    i=\"\"\n\t\t    ;;\n\t\t  esac\n\t\tfi\n\t\tif test -n \"$i\" ; then\n\t\t  libname=`eval \"\\\\$ECHO \\\"$libname_spec\\\"\"`\n\t\t  deplib_matches=`eval \"\\\\$ECHO \\\"$library_names_spec\\\"\"`\n\t\t  set dummy $deplib_matches; shift\n\t\t  deplib_match=$1\n\t\t  if test `expr \"$ldd_output\" : \".*$deplib_match\"` -ne 0 ; then\n\t\t    newdeplibs=\"$newdeplibs $i\"\n\t\t  else\n\t\t    droppeddeps=yes\n\t\t    $ECHO\n\t\t    $ECHO \"*** Warning: dynamic linker does not accept needed library $i.\"\n\t\t    $ECHO \"*** I have the capability to make that library automatically link in when\"\n\t\t    $ECHO \"*** you link to this library.  But I can only do this if you have a\"\n\t\t    $ECHO \"*** shared version of the library, which I believe you do not have\"\n\t\t    $ECHO \"*** because a test_compile did reveal that the linker did not use it for\"\n\t\t    $ECHO \"*** its dynamic dependency list that programs get resolved with at runtime.\"\n\t\t  fi\n\t\tfi\n\t\t;;\n\t      *)\n\t\tnewdeplibs=\"$newdeplibs $i\"\n\t\t;;\n\t      esac\n\t    done\n\t  else\n\t    # Error occurred in the first compile.  Let's try to salvage\n\t    # the situation: Compile a separate program for each library.\n\t    for i in $deplibs; do\n\t      case $i in\n\t      -l*)\n\t\tfunc_stripname -l '' \"$i\"\n\t\tname=$func_stripname_result\n\t\t$opt_dry_run || $RM conftest\n\t\tif $LTCC $LTCFLAGS -o conftest conftest.c $i; then\n\t\t  ldd_output=`ldd conftest`\n\t\t  if test \"X$allow_libtool_libs_with_static_runtimes\" = \"Xyes\" ; then\n\t\t    case \" $predeps $postdeps \" in\n\t\t    *\" $i \"*)\n\t\t      newdeplibs=\"$newdeplibs $i\"\n\t\t      i=\"\"\n\t\t      ;;\n\t\t    esac\n\t\t  fi\n\t\t  if test -n \"$i\" ; then\n\t\t    libname=`eval \"\\\\$ECHO \\\"$libname_spec\\\"\"`\n\t\t    deplib_matches=`eval \"\\\\$ECHO \\\"$library_names_spec\\\"\"`\n\t\t    set dummy $deplib_matches; shift\n\t\t    deplib_match=$1\n\t\t    if test `expr \"$ldd_output\" : \".*$deplib_match\"` -ne 0 ; then\n\t\t      newdeplibs=\"$newdeplibs $i\"\n\t\t    else\n\t\t      droppeddeps=yes\n\t\t      $ECHO\n\t\t      $ECHO \"*** Warning: dynamic linker does not accept needed library $i.\"\n\t\t      $ECHO \"*** I have the capability to make that library automatically link in when\"\n\t\t      $ECHO \"*** you link to this library.  But I can only do this if you have a\"\n\t\t      $ECHO \"*** shared version of the library, which you do not appear to have\"\n\t\t      $ECHO \"*** because a test_compile did reveal that the linker did not use this one\"\n\t\t      $ECHO \"*** as a dynamic dependency that programs can get resolved with at runtime.\"\n\t\t    fi\n\t\t  fi\n\t\telse\n\t\t  droppeddeps=yes\n\t\t  $ECHO\n\t\t  $ECHO \"*** Warning!  Library $i is needed by this library but I was not able to\"\n\t\t  $ECHO \"*** make it link in!  You will probably need to install it or some\"\n\t\t  $ECHO \"*** library that it depends on before this library will be fully\"\n\t\t  $ECHO \"*** functional.  Installing it before continuing would be even better.\"\n\t\tfi\n\t\t;;\n\t      *)\n\t\tnewdeplibs=\"$newdeplibs $i\"\n\t\t;;\n\t      esac\n\t    done\n\t  fi\n\t  ;;\n\tfile_magic*)\n\t  set dummy $deplibs_check_method; shift\n\t  file_magic_regex=`expr \"$deplibs_check_method\" : \"$1 \\(.*\\)\"`\n\t  for a_deplib in $deplibs; do\n\t    case $a_deplib in\n\t    -l*)\n\t      func_stripname -l '' \"$a_deplib\"\n\t      name=$func_stripname_result\n\t      if test \"X$allow_libtool_libs_with_static_runtimes\" = \"Xyes\" ; then\n\t\tcase \" $predeps $postdeps \" in\n\t\t*\" $a_deplib \"*)\n\t\t  newdeplibs=\"$newdeplibs $a_deplib\"\n\t\t  a_deplib=\"\"\n\t\t  ;;\n\t\tesac\n\t      fi\n\t      if test -n \"$a_deplib\" ; then\n\t\tlibname=`eval \"\\\\$ECHO \\\"$libname_spec\\\"\"`\n\t\tfor i in $lib_search_path $sys_lib_search_path $shlib_search_path; do\n\t\t  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`\n\t\t  for potent_lib in $potential_libs; do\n\t\t      # Follow soft links.\n\t\t      if ls -lLd \"$potent_lib\" 2>/dev/null |\n\t\t\t $GREP \" -> \" >/dev/null; then\n\t\t\tcontinue\n\t\t      fi\n\t\t      # The statement above tries to avoid entering an\n\t\t      # endless loop below, in case of cyclic links.\n\t\t      # We might still enter an endless loop, since a link\n\t\t      # loop can be closed while we follow links,\n\t\t      # but so what?\n\t\t      potlib=\"$potent_lib\"\n\t\t      while test -h \"$potlib\" 2>/dev/null; do\n\t\t\tpotliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`\n\t\t\tcase $potliblink in\n\t\t\t[\\\\/]* | [A-Za-z]:[\\\\/]*) potlib=\"$potliblink\";;\n\t\t\t*) potlib=`$ECHO \"X$potlib\" | $Xsed -e 's,[^/]*$,,'`\"$potliblink\";;\n\t\t\tesac\n\t\t      done\n\t\t      if eval $file_magic_cmd \\\"\\$potlib\\\" 2>/dev/null |\n\t\t\t $SED -e 10q |\n\t\t\t $EGREP \"$file_magic_regex\" > /dev/null; then\n\t\t\tnewdeplibs=\"$newdeplibs $a_deplib\"\n\t\t\ta_deplib=\"\"\n\t\t\tbreak 2\n\t\t      fi\n\t\t  done\n\t\tdone\n\t      fi\n\t      if test -n \"$a_deplib\" ; then\n\t\tdroppeddeps=yes\n\t\t$ECHO\n\t\t$ECHO \"*** Warning: linker path does not have real file for library $a_deplib.\"\n\t\t$ECHO \"*** I have the capability to make that library automatically link in when\"\n\t\t$ECHO \"*** you link to this library.  But I can only do this if you have a\"\n\t\t$ECHO \"*** shared version of the library, which you do not appear to have\"\n\t\t$ECHO \"*** because I did check the linker path looking for a file starting\"\n\t\tif test -z \"$potlib\" ; then\n\t\t  $ECHO \"*** with $libname but no candidates were found. (...for file magic test)\"\n\t\telse\n\t\t  $ECHO \"*** with $libname and none of the candidates passed a file format test\"\n\t\t  $ECHO \"*** using a file magic. Last file checked: $potlib\"\n\t\tfi\n\t      fi\n\t      ;;\n\t    *)\n\t      # Add a -L argument.\n\t      newdeplibs=\"$newdeplibs $a_deplib\"\n\t      ;;\n\t    esac\n\t  done # Gone through all deplibs.\n\t  ;;\n\tmatch_pattern*)\n\t  set dummy $deplibs_check_method; shift\n\t  match_pattern_regex=`expr \"$deplibs_check_method\" : \"$1 \\(.*\\)\"`\n\t  for a_deplib in $deplibs; do\n\t    case $a_deplib in\n\t    -l*)\n\t      func_stripname -l '' \"$a_deplib\"\n\t      name=$func_stripname_result\n\t      if test \"X$allow_libtool_libs_with_static_runtimes\" = \"Xyes\" ; then\n\t\tcase \" $predeps $postdeps \" in\n\t\t*\" $a_deplib \"*)\n\t\t  newdeplibs=\"$newdeplibs $a_deplib\"\n\t\t  a_deplib=\"\"\n\t\t  ;;\n\t\tesac\n\t      fi\n\t      if test -n \"$a_deplib\" ; then\n\t\tlibname=`eval \"\\\\$ECHO \\\"$libname_spec\\\"\"`\n\t\tfor i in $lib_search_path $sys_lib_search_path $shlib_search_path; do\n\t\t  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`\n\t\t  for potent_lib in $potential_libs; do\n\t\t    potlib=\"$potent_lib\" # see symlink-check above in file_magic test\n\t\t    if eval \"\\$ECHO \\\"X$potent_lib\\\"\" 2>/dev/null | $Xsed -e 10q | \\\n\t\t       $EGREP \"$match_pattern_regex\" > /dev/null; then\n\t\t      newdeplibs=\"$newdeplibs $a_deplib\"\n\t\t      a_deplib=\"\"\n\t\t      break 2\n\t\t    fi\n\t\t  done\n\t\tdone\n\t      fi\n\t      if test -n \"$a_deplib\" ; then\n\t\tdroppeddeps=yes\n\t\t$ECHO\n\t\t$ECHO \"*** Warning: linker path does not have real file for library $a_deplib.\"\n\t\t$ECHO \"*** I have the capability to make that library automatically link in when\"\n\t\t$ECHO \"*** you link to this library.  But I can only do this if you have a\"\n\t\t$ECHO \"*** shared version of the library, which you do not appear to have\"\n\t\t$ECHO \"*** because I did check the linker path looking for a file starting\"\n\t\tif test -z \"$potlib\" ; then\n\t\t  $ECHO \"*** with $libname but no candidates were found. (...for regex pattern test)\"\n\t\telse\n\t\t  $ECHO \"*** with $libname and none of the candidates passed a file format test\"\n\t\t  $ECHO \"*** using a regex pattern. Last file checked: $potlib\"\n\t\tfi\n\t      fi\n\t      ;;\n\t    *)\n\t      # Add a -L argument.\n\t      newdeplibs=\"$newdeplibs $a_deplib\"\n\t      ;;\n\t    esac\n\t  done # Gone through all deplibs.\n\t  ;;\n\tnone | unknown | *)\n\t  newdeplibs=\"\"\n\t  tmp_deplibs=`$ECHO \"X $deplibs\" | $Xsed \\\n\t      -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'`\n\t  if test \"X$allow_libtool_libs_with_static_runtimes\" = \"Xyes\" ; then\n\t    for i in $predeps $postdeps ; do\n\t      # can't use Xsed below, because $i might contain '/'\n\t      tmp_deplibs=`$ECHO \"X $tmp_deplibs\" | $Xsed -e \"s,$i,,\"`\n\t    done\n\t  fi\n\t  if $ECHO \"X $tmp_deplibs\" | $Xsed -e 's/[\t ]//g' |\n\t     $GREP . >/dev/null; then\n\t    $ECHO\n\t    if test \"X$deplibs_check_method\" = \"Xnone\"; then\n\t      $ECHO \"*** Warning: inter-library dependencies are not supported in this platform.\"\n\t    else\n\t      $ECHO \"*** Warning: inter-library dependencies are not known to be supported.\"\n\t    fi\n\t    $ECHO \"*** All declared inter-library dependencies are being dropped.\"\n\t    droppeddeps=yes\n\t  fi\n\t  ;;\n\tesac\n\tversuffix=$versuffix_save\n\tmajor=$major_save\n\trelease=$release_save\n\tlibname=$libname_save\n\tname=$name_save\n\n\tcase $host in\n\t*-*-rhapsody* | *-*-darwin1.[012])\n\t  # On Rhapsody replace the C library with the System framework\n\t  newdeplibs=`$ECHO \"X $newdeplibs\" | $Xsed -e 's/ -lc / System.ltframework /'`\n\t  ;;\n\tesac\n\n\tif test \"$droppeddeps\" = yes; then\n\t  if test \"$module\" = yes; then\n\t    $ECHO\n\t    $ECHO \"*** Warning: libtool could not satisfy all declared inter-library\"\n\t    $ECHO \"*** dependencies of module $libname.  Therefore, libtool will create\"\n\t    $ECHO \"*** a static module, that should work as long as the dlopening\"\n\t    $ECHO \"*** application is linked with the -dlopen flag.\"\n\t    if test -z \"$global_symbol_pipe\"; then\n\t      $ECHO\n\t      $ECHO \"*** However, this would only work if libtool was able to extract symbol\"\n\t      $ECHO \"*** lists from a program, using \\`nm' or equivalent, but libtool could\"\n\t      $ECHO \"*** not find such a program.  So, this module is probably useless.\"\n\t      $ECHO \"*** \\`nm' from GNU binutils and a full rebuild may help.\"\n\t    fi\n\t    if test \"$build_old_libs\" = no; then\n\t      oldlibs=\"$output_objdir/$libname.$libext\"\n\t      build_libtool_libs=module\n\t      build_old_libs=yes\n\t    else\n\t      build_libtool_libs=no\n\t    fi\n\t  else\n\t    $ECHO \"*** The inter-library dependencies that have been dropped here will be\"\n\t    $ECHO \"*** automatically added whenever a program is linked with this library\"\n\t    $ECHO \"*** or is declared to -dlopen it.\"\n\n\t    if test \"$allow_undefined\" = no; then\n\t      $ECHO\n\t      $ECHO \"*** Since this library must not contain undefined symbols,\"\n\t      $ECHO \"*** because either the platform does not support them or\"\n\t      $ECHO \"*** it was explicitly requested with -no-undefined,\"\n\t      $ECHO \"*** libtool will only create a static version of it.\"\n\t      if test \"$build_old_libs\" = no; then\n\t\toldlibs=\"$output_objdir/$libname.$libext\"\n\t\tbuild_libtool_libs=module\n\t\tbuild_old_libs=yes\n\t      else\n\t\tbuild_libtool_libs=no\n\t      fi\n\t    fi\n\t  fi\n\tfi\n\t# Done checking deplibs!\n\tdeplibs=$newdeplibs\n      fi\n      # Time to change all our \"foo.ltframework\" stuff back to \"-framework foo\"\n      case $host in\n\t*-*-darwin*)\n\t  newdeplibs=`$ECHO \"X $newdeplibs\" | $Xsed -e 's% \\([^ $]*\\).ltframework% -framework \\1%g'`\n\t  new_inherited_linker_flags=`$ECHO \"X $new_inherited_linker_flags\" | $Xsed -e 's% \\([^ $]*\\).ltframework% -framework \\1%g'`\n\t  deplibs=`$ECHO \"X $deplibs\" | $Xsed -e 's% \\([^ $]*\\).ltframework% -framework \\1%g'`\n\t  ;;\n      esac\n\n      # move library search paths that coincide with paths to not yet\n      # installed libraries to the beginning of the library search list\n      new_libs=\n      for path in $notinst_path; do\n\tcase \" $new_libs \" in\n\t*\" -L$path/$objdir \"*) ;;\n\t*)\n\t  case \" $deplibs \" in\n\t  *\" -L$path/$objdir \"*)\n\t    new_libs=\"$new_libs -L$path/$objdir\" ;;\n\t  esac\n\t  ;;\n\tesac\n      done\n      for deplib in $deplibs; do\n\tcase $deplib in\n\t-L*)\n\t  case \" $new_libs \" in\n\t  *\" $deplib \"*) ;;\n\t  *) new_libs=\"$new_libs $deplib\" ;;\n\t  esac\n\t  ;;\n\t*) new_libs=\"$new_libs $deplib\" ;;\n\tesac\n      done\n      deplibs=\"$new_libs\"\n\n      # All the library-specific variables (install_libdir is set above).\n      library_names=\n      old_library=\n      dlname=\n\n      # Test again, we may have decided not to build it any more\n      if test \"$build_libtool_libs\" = yes; then\n\tif test \"$hardcode_into_libs\" = yes; then\n\t  # Hardcode the library paths\n\t  hardcode_libdirs=\n\t  dep_rpath=\n\t  rpath=\"$finalize_rpath\"\n\t  test \"$mode\" != relink && rpath=\"$compile_rpath$rpath\"\n\t  for libdir in $rpath; do\n\t    if test -n \"$hardcode_libdir_flag_spec\"; then\n\t      if test -n \"$hardcode_libdir_separator\"; then\n\t\tif test -z \"$hardcode_libdirs\"; then\n\t\t  hardcode_libdirs=\"$libdir\"\n\t\telse\n\t\t  # Just accumulate the unique libdirs.\n\t\t  case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in\n\t\t  *\"$hardcode_libdir_separator$libdir$hardcode_libdir_separator\"*)\n\t\t    ;;\n\t\t  *)\n\t\t    hardcode_libdirs=\"$hardcode_libdirs$hardcode_libdir_separator$libdir\"\n\t\t    ;;\n\t\t  esac\n\t\tfi\n\t      else\n\t\teval flag=\\\"$hardcode_libdir_flag_spec\\\"\n\t\tdep_rpath=\"$dep_rpath $flag\"\n\t      fi\n\t    elif test -n \"$runpath_var\"; then\n\t      case \"$perm_rpath \" in\n\t      *\" $libdir \"*) ;;\n\t      *) perm_rpath=\"$perm_rpath $libdir\" ;;\n\t      esac\n\t    fi\n\t  done\n\t  # Substitute the hardcoded libdirs into the rpath.\n\t  if test -n \"$hardcode_libdir_separator\" &&\n\t     test -n \"$hardcode_libdirs\"; then\n\t    libdir=\"$hardcode_libdirs\"\n\t    if test -n \"$hardcode_libdir_flag_spec_ld\"; then\n\t      eval dep_rpath=\\\"$hardcode_libdir_flag_spec_ld\\\"\n\t    else\n\t      eval dep_rpath=\\\"$hardcode_libdir_flag_spec\\\"\n\t    fi\n\t  fi\n\t  if test -n \"$runpath_var\" && test -n \"$perm_rpath\"; then\n\t    # We should set the runpath_var.\n\t    rpath=\n\t    for dir in $perm_rpath; do\n\t      rpath=\"$rpath$dir:\"\n\t    done\n\t    eval \"$runpath_var='$rpath\\$$runpath_var'; export $runpath_var\"\n\t  fi\n\t  test -n \"$dep_rpath\" && deplibs=\"$dep_rpath $deplibs\"\n\tfi\n\n\tshlibpath=\"$finalize_shlibpath\"\n\ttest \"$mode\" != relink && shlibpath=\"$compile_shlibpath$shlibpath\"\n\tif test -n \"$shlibpath\"; then\n\t  eval \"$shlibpath_var='$shlibpath\\$$shlibpath_var'; export $shlibpath_var\"\n\tfi\n\n\t# Get the real and link names of the library.\n\teval shared_ext=\\\"$shrext_cmds\\\"\n\teval library_names=\\\"$library_names_spec\\\"\n\tset dummy $library_names\n\tshift\n\trealname=\"$1\"\n\tshift\n\n\tif test -n \"$soname_spec\"; then\n\t  eval soname=\\\"$soname_spec\\\"\n\telse\n\t  soname=\"$realname\"\n\tfi\n\tif test -z \"$dlname\"; then\n\t  dlname=$soname\n\tfi\n\n\tlib=\"$output_objdir/$realname\"\n\tlinknames=\n\tfor link\n\tdo\n\t  linknames=\"$linknames $link\"\n\tdone\n\n\t# Use standard objects if they are pic\n\ttest -z \"$pic_flag\" && libobjs=`$ECHO \"X$libobjs\" | $SP2NL | $Xsed -e \"$lo2o\" | $NL2SP`\n\ttest \"X$libobjs\" = \"X \" && libobjs=\n\n\tdelfiles=\n\tif test -n \"$export_symbols\" && test -n \"$include_expsyms\"; then\n\t  $opt_dry_run || cp \"$export_symbols\" \"$output_objdir/$libname.uexp\"\n\t  export_symbols=\"$output_objdir/$libname.uexp\"\n\t  delfiles=\"$delfiles $export_symbols\"\n\tfi\n\n\torig_export_symbols=\n\tcase $host_os in\n\tcygwin* | mingw* | cegcc*)\n\t  if test -n \"$export_symbols\" && test -z \"$export_symbols_regex\"; then\n\t    # exporting using user supplied symfile\n\t    if test \"x`$SED 1q $export_symbols`\" != xEXPORTS; then\n\t      # and it's NOT already a .def file. Must figure out\n\t      # which of the given symbols are data symbols and tag\n\t      # them as such. So, trigger use of export_symbols_cmds.\n\t      # export_symbols gets reassigned inside the \"prepare\n\t      # the list of exported symbols\" if statement, so the\n\t      # include_expsyms logic still works.\n\t      orig_export_symbols=\"$export_symbols\"\n\t      export_symbols=\n\t      always_export_symbols=yes\n\t    fi\n\t  fi\n\t  ;;\n\tesac\n\n\t# Prepare the list of exported symbols\n\tif test -z \"$export_symbols\"; then\n\t  if test \"$always_export_symbols\" = yes || test -n \"$export_symbols_regex\"; then\n\t    func_verbose \"generating symbol list for \\`$libname.la'\"\n\t    export_symbols=\"$output_objdir/$libname.exp\"\n\t    $opt_dry_run || $RM $export_symbols\n\t    cmds=$export_symbols_cmds\n\t    save_ifs=\"$IFS\"; IFS='~'\n\t    for cmd in $cmds; do\n\t      IFS=\"$save_ifs\"\n\t      eval cmd=\\\"$cmd\\\"\n\t      func_len \" $cmd\"\n\t      len=$func_len_result\n\t      if test \"$len\" -lt \"$max_cmd_len\" || test \"$max_cmd_len\" -le -1; then\n\t\tfunc_show_eval \"$cmd\" 'exit $?'\n\t\tskipped_export=false\n\t      else\n\t\t# The command line is too long to execute in one step.\n\t\tfunc_verbose \"using reloadable object file for export list...\"\n\t\tskipped_export=:\n\t\t# Break out early, otherwise skipped_export may be\n\t\t# set to false by a later but shorter cmd.\n\t\tbreak\n\t      fi\n\t    done\n\t    IFS=\"$save_ifs\"\n\t    if test -n \"$export_symbols_regex\" && test \"X$skipped_export\" != \"X:\"; then\n\t      func_show_eval '$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"'\n\t      func_show_eval '$MV \"${export_symbols}T\" \"$export_symbols\"'\n\t    fi\n\t  fi\n\tfi\n\n\tif test -n \"$export_symbols\" && test -n \"$include_expsyms\"; then\n\t  tmp_export_symbols=\"$export_symbols\"\n\t  test -n \"$orig_export_symbols\" && tmp_export_symbols=\"$orig_export_symbols\"\n\t  $opt_dry_run || eval '$ECHO \"X$include_expsyms\" | $Xsed | $SP2NL >> \"$tmp_export_symbols\"'\n\tfi\n\n\tif test \"X$skipped_export\" != \"X:\" && test -n \"$orig_export_symbols\"; then\n\t  # The given exports_symbols file has to be filtered, so filter it.\n\t  func_verbose \"filter symbol list for \\`$libname.la' to tag DATA exports\"\n\t  # FIXME: $output_objdir/$libname.filter potentially contains lots of\n\t  # 's' commands which not all seds can handle. GNU sed should be fine\n\t  # though. Also, the filter scales superlinearly with the number of\n\t  # global variables. join(1) would be nice here, but unfortunately\n\t  # isn't a blessed tool.\n\t  $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\\(.*\\)\\([ \\,].*\\),s|^\\1$|\\1\\2|,' < $export_symbols > $output_objdir/$libname.filter\n\t  delfiles=\"$delfiles $export_symbols $output_objdir/$libname.filter\"\n\t  export_symbols=$output_objdir/$libname.def\n\t  $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols\n\tfi\n\n\ttmp_deplibs=\n\tfor test_deplib in $deplibs; do\n\t  case \" $convenience \" in\n\t  *\" $test_deplib \"*) ;;\n\t  *)\n\t    tmp_deplibs=\"$tmp_deplibs $test_deplib\"\n\t    ;;\n\t  esac\n\tdone\n\tdeplibs=\"$tmp_deplibs\"\n\n\tif test -n \"$convenience\"; then\n\t  if test -n \"$whole_archive_flag_spec\" &&\n\t    test \"$compiler_needs_object\" = yes &&\n\t    test -z \"$libobjs\"; then\n\t    # extract the archives, so we have objects to list.\n\t    # TODO: could optimize this to just extract one archive.\n\t    whole_archive_flag_spec=\n\t  fi\n\t  if test -n \"$whole_archive_flag_spec\"; then\n\t    save_libobjs=$libobjs\n\t    eval libobjs=\\\"\\$libobjs $whole_archive_flag_spec\\\"\n\t    test \"X$libobjs\" = \"X \" && libobjs=\n\t  else\n\t    gentop=\"$output_objdir/${outputname}x\"\n\t    generated=\"$generated $gentop\"\n\n\t    func_extract_archives $gentop $convenience\n\t    libobjs=\"$libobjs $func_extract_archives_result\"\n\t    test \"X$libobjs\" = \"X \" && libobjs=\n\t  fi\n\tfi\n\n\tif test \"$thread_safe\" = yes && test -n \"$thread_safe_flag_spec\"; then\n\t  eval flag=\\\"$thread_safe_flag_spec\\\"\n\t  linker_flags=\"$linker_flags $flag\"\n\tfi\n\n\t# Make a backup of the uninstalled library when relinking\n\tif test \"$mode\" = relink; then\n\t  $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?\n\tfi\n\n\t# Do each of the archive commands.\n\tif test \"$module\" = yes && test -n \"$module_cmds\" ; then\n\t  if test -n \"$export_symbols\" && test -n \"$module_expsym_cmds\"; then\n\t    eval test_cmds=\\\"$module_expsym_cmds\\\"\n\t    cmds=$module_expsym_cmds\n\t  else\n\t    eval test_cmds=\\\"$module_cmds\\\"\n\t    cmds=$module_cmds\n\t  fi\n\telse\n\t  if test -n \"$export_symbols\" && test -n \"$archive_expsym_cmds\"; then\n\t    eval test_cmds=\\\"$archive_expsym_cmds\\\"\n\t    cmds=$archive_expsym_cmds\n\t  else\n\t    eval test_cmds=\\\"$archive_cmds\\\"\n\t    cmds=$archive_cmds\n\t  fi\n\tfi\n\n\tif test \"X$skipped_export\" != \"X:\" &&\n\t   func_len \" $test_cmds\" &&\n\t   len=$func_len_result &&\n\t   test \"$len\" -lt \"$max_cmd_len\" || test \"$max_cmd_len\" -le -1; then\n\t  :\n\telse\n\t  # The command line is too long to link in one step, link piecewise\n\t  # or, if using GNU ld and skipped_export is not :, use a linker\n\t  # script.\n\n\t  # Save the value of $output and $libobjs because we want to\n\t  # use them later.  If we have whole_archive_flag_spec, we\n\t  # want to use save_libobjs as it was before\n\t  # whole_archive_flag_spec was expanded, because we can't\n\t  # assume the linker understands whole_archive_flag_spec.\n\t  # This may have to be revisited, in case too many\n\t  # convenience libraries get linked in and end up exceeding\n\t  # the spec.\n\t  if test -z \"$convenience\" || test -z \"$whole_archive_flag_spec\"; then\n\t    save_libobjs=$libobjs\n\t  fi\n\t  save_output=$output\n\t  output_la=`$ECHO \"X$output\" | $Xsed -e \"$basename\"`\n\n\t  # Clear the reloadable object creation command queue and\n\t  # initialize k to one.\n\t  test_cmds=\n\t  concat_cmds=\n\t  objlist=\n\t  last_robj=\n\t  k=1\n\n\t  if test -n \"$save_libobjs\" && test \"X$skipped_export\" != \"X:\" && test \"$with_gnu_ld\" = yes; then\n\t    output=${output_objdir}/${output_la}.lnkscript\n\t    func_verbose \"creating GNU ld script: $output\"\n\t    $ECHO 'INPUT (' > $output\n\t    for obj in $save_libobjs\n\t    do\n\t      $ECHO \"$obj\" >> $output\n\t    done\n\t    $ECHO ')' >> $output\n\t    delfiles=\"$delfiles $output\"\n\t  elif test -n \"$save_libobjs\" && test \"X$skipped_export\" != \"X:\" && test \"X$file_list_spec\" != X; then\n\t    output=${output_objdir}/${output_la}.lnk\n\t    func_verbose \"creating linker input file list: $output\"\n\t    : > $output\n\t    set x $save_libobjs\n\t    shift\n\t    firstobj=\n\t    if test \"$compiler_needs_object\" = yes; then\n\t      firstobj=\"$1 \"\n\t      shift\n\t    fi\n\t    for obj\n\t    do\n\t      $ECHO \"$obj\" >> $output\n\t    done\n\t    delfiles=\"$delfiles $output\"\n\t    output=$firstobj\\\"$file_list_spec$output\\\"\n\t  else\n\t    if test -n \"$save_libobjs\"; then\n\t      func_verbose \"creating reloadable object files...\"\n\t      output=$output_objdir/$output_la-${k}.$objext\n\t      eval test_cmds=\\\"$reload_cmds\\\"\n\t      func_len \" $test_cmds\"\n\t      len0=$func_len_result\n\t      len=$len0\n\n\t      # Loop over the list of objects to be linked.\n\t      for obj in $save_libobjs\n\t      do\n\t\tfunc_len \" $obj\"\n\t\tfunc_arith $len + $func_len_result\n\t\tlen=$func_arith_result\n\t\tif test \"X$objlist\" = X ||\n\t\t   test \"$len\" -lt \"$max_cmd_len\"; then\n\t\t  func_append objlist \" $obj\"\n\t\telse\n\t\t  # The command $test_cmds is almost too long, add a\n\t\t  # command to the queue.\n\t\t  if test \"$k\" -eq 1 ; then\n\t\t    # The first file doesn't have a previous command to add.\n\t\t    eval concat_cmds=\\\"$reload_cmds $objlist $last_robj\\\"\n\t\t  else\n\t\t    # All subsequent reloadable object files will link in\n\t\t    # the last one created.\n\t\t    eval concat_cmds=\\\"\\$concat_cmds~$reload_cmds $objlist $last_robj~\\$RM $last_robj\\\"\n\t\t  fi\n\t\t  last_robj=$output_objdir/$output_la-${k}.$objext\n\t\t  func_arith $k + 1\n\t\t  k=$func_arith_result\n\t\t  output=$output_objdir/$output_la-${k}.$objext\n\t\t  objlist=$obj\n\t\t  func_len \" $last_robj\"\n\t\t  func_arith $len0 + $func_len_result\n\t\t  len=$func_arith_result\n\t\tfi\n\t      done\n\t      # Handle the remaining objects by creating one last\n\t      # reloadable object file.  All subsequent reloadable object\n\t      # files will link in the last one created.\n\t      test -z \"$concat_cmds\" || concat_cmds=$concat_cmds~\n\t      eval concat_cmds=\\\"\\${concat_cmds}$reload_cmds $objlist $last_robj\\\"\n\t      if test -n \"$last_robj\"; then\n\t        eval concat_cmds=\\\"\\${concat_cmds}~\\$RM $last_robj\\\"\n\t      fi\n\t      delfiles=\"$delfiles $output\"\n\n\t    else\n\t      output=\n\t    fi\n\n\t    if ${skipped_export-false}; then\n\t      func_verbose \"generating symbol list for \\`$libname.la'\"\n\t      export_symbols=\"$output_objdir/$libname.exp\"\n\t      $opt_dry_run || $RM $export_symbols\n\t      libobjs=$output\n\t      # Append the command to create the export file.\n\t      test -z \"$concat_cmds\" || concat_cmds=$concat_cmds~\n\t      eval concat_cmds=\\\"\\$concat_cmds$export_symbols_cmds\\\"\n\t      if test -n \"$last_robj\"; then\n\t\teval concat_cmds=\\\"\\$concat_cmds~\\$RM $last_robj\\\"\n\t      fi\n\t    fi\n\n\t    test -n \"$save_libobjs\" &&\n\t      func_verbose \"creating a temporary reloadable object file: $output\"\n\n\t    # Loop through the commands generated above and execute them.\n\t    save_ifs=\"$IFS\"; IFS='~'\n\t    for cmd in $concat_cmds; do\n\t      IFS=\"$save_ifs\"\n\t      $opt_silent || {\n\t\t  func_quote_for_expand \"$cmd\"\n\t\t  eval \"func_echo $func_quote_for_expand_result\"\n\t      }\n\t      $opt_dry_run || eval \"$cmd\" || {\n\t\tlt_exit=$?\n\n\t\t# Restore the uninstalled library and exit\n\t\tif test \"$mode\" = relink; then\n\t\t  ( cd \"$output_objdir\" && \\\n\t\t    $RM \"${realname}T\" && \\\n\t\t    $MV \"${realname}U\" \"$realname\" )\n\t\tfi\n\n\t\texit $lt_exit\n\t      }\n\t    done\n\t    IFS=\"$save_ifs\"\n\n\t    if test -n \"$export_symbols_regex\" && ${skipped_export-false}; then\n\t      func_show_eval '$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"'\n\t      func_show_eval '$MV \"${export_symbols}T\" \"$export_symbols\"'\n\t    fi\n\t  fi\n\n          if ${skipped_export-false}; then\n\t    if test -n \"$export_symbols\" && test -n \"$include_expsyms\"; then\n\t      tmp_export_symbols=\"$export_symbols\"\n\t      test -n \"$orig_export_symbols\" && tmp_export_symbols=\"$orig_export_symbols\"\n\t      $opt_dry_run || eval '$ECHO \"X$include_expsyms\" | $Xsed | $SP2NL >> \"$tmp_export_symbols\"'\n\t    fi\n\n\t    if test -n \"$orig_export_symbols\"; then\n\t      # The given exports_symbols file has to be filtered, so filter it.\n\t      func_verbose \"filter symbol list for \\`$libname.la' to tag DATA exports\"\n\t      # FIXME: $output_objdir/$libname.filter potentially contains lots of\n\t      # 's' commands which not all seds can handle. GNU sed should be fine\n\t      # though. Also, the filter scales superlinearly with the number of\n\t      # global variables. join(1) would be nice here, but unfortunately\n\t      # isn't a blessed tool.\n\t      $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\\(.*\\)\\([ \\,].*\\),s|^\\1$|\\1\\2|,' < $export_symbols > $output_objdir/$libname.filter\n\t      delfiles=\"$delfiles $export_symbols $output_objdir/$libname.filter\"\n\t      export_symbols=$output_objdir/$libname.def\n\t      $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols\n\t    fi\n\t  fi\n\n\t  libobjs=$output\n\t  # Restore the value of output.\n\t  output=$save_output\n\n\t  if test -n \"$convenience\" && test -n \"$whole_archive_flag_spec\"; then\n\t    eval libobjs=\\\"\\$libobjs $whole_archive_flag_spec\\\"\n\t    test \"X$libobjs\" = \"X \" && libobjs=\n\t  fi\n\t  # Expand the library linking commands again to reset the\n\t  # value of $libobjs for piecewise linking.\n\n\t  # Do each of the archive commands.\n\t  if test \"$module\" = yes && test -n \"$module_cmds\" ; then\n\t    if test -n \"$export_symbols\" && test -n \"$module_expsym_cmds\"; then\n\t      cmds=$module_expsym_cmds\n\t    else\n\t      cmds=$module_cmds\n\t    fi\n\t  else\n\t    if test -n \"$export_symbols\" && test -n \"$archive_expsym_cmds\"; then\n\t      cmds=$archive_expsym_cmds\n\t    else\n\t      cmds=$archive_cmds\n\t    fi\n\t  fi\n\tfi\n\n\tif test -n \"$delfiles\"; then\n\t  # Append the command to remove temporary files to $cmds.\n\t  eval cmds=\\\"\\$cmds~\\$RM $delfiles\\\"\n\tfi\n\n\t# Add any objects from preloaded convenience libraries\n\tif test -n \"$dlprefiles\"; then\n\t  gentop=\"$output_objdir/${outputname}x\"\n\t  generated=\"$generated $gentop\"\n\n\t  func_extract_archives $gentop $dlprefiles\n\t  libobjs=\"$libobjs $func_extract_archives_result\"\n\t  test \"X$libobjs\" = \"X \" && libobjs=\n\tfi\n\n\tsave_ifs=\"$IFS\"; IFS='~'\n\tfor cmd in $cmds; do\n\t  IFS=\"$save_ifs\"\n\t  eval cmd=\\\"$cmd\\\"\n\t  $opt_silent || {\n\t    func_quote_for_expand \"$cmd\"\n\t    eval \"func_echo $func_quote_for_expand_result\"\n\t  }\n\t  $opt_dry_run || eval \"$cmd\" || {\n\t    lt_exit=$?\n\n\t    # Restore the uninstalled library and exit\n\t    if test \"$mode\" = relink; then\n\t      ( cd \"$output_objdir\" && \\\n\t        $RM \"${realname}T\" && \\\n\t\t$MV \"${realname}U\" \"$realname\" )\n\t    fi\n\n\t    exit $lt_exit\n\t  }\n\tdone\n\tIFS=\"$save_ifs\"\n\n\t# Restore the uninstalled library and exit\n\tif test \"$mode\" = relink; then\n\t  $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?\n\n\t  if test -n \"$convenience\"; then\n\t    if test -z \"$whole_archive_flag_spec\"; then\n\t      func_show_eval '${RM}r \"$gentop\"'\n\t    fi\n\t  fi\n\n\t  exit $EXIT_SUCCESS\n\tfi\n\n\t# Create links to the real library.\n\tfor linkname in $linknames; do\n\t  if test \"$realname\" != \"$linkname\"; then\n\t    func_show_eval '(cd \"$output_objdir\" && $RM \"$linkname\" && $LN_S \"$realname\" \"$linkname\")' 'exit $?'\n\t  fi\n\tdone\n\n\t# If -module or -export-dynamic was specified, set the dlname.\n\tif test \"$module\" = yes || test \"$export_dynamic\" = yes; then\n\t  # On all known operating systems, these are identical.\n\t  dlname=\"$soname\"\n\tfi\n      fi\n      ;;\n\n    obj)\n      if test -n \"$dlfiles$dlprefiles\" || test \"$dlself\" != no; then\n\tfunc_warning \"\\`-dlopen' is ignored for objects\"\n      fi\n\n      case \" $deplibs\" in\n      *\\ -l* | *\\ -L*)\n\tfunc_warning \"\\`-l' and \\`-L' are ignored for objects\" ;;\n      esac\n\n      test -n \"$rpath\" && \\\n\tfunc_warning \"\\`-rpath' is ignored for objects\"\n\n      test -n \"$xrpath\" && \\\n\tfunc_warning \"\\`-R' is ignored for objects\"\n\n      test -n \"$vinfo\" && \\\n\tfunc_warning \"\\`-version-info' is ignored for objects\"\n\n      test -n \"$release\" && \\\n\tfunc_warning \"\\`-release' is ignored for objects\"\n\n      case $output in\n      *.lo)\n\ttest -n \"$objs$old_deplibs\" && \\\n\t  func_fatal_error \"cannot build library object \\`$output' from non-libtool objects\"\n\n\tlibobj=$output\n\tfunc_lo2o \"$libobj\"\n\tobj=$func_lo2o_result\n\t;;\n      *)\n\tlibobj=\n\tobj=\"$output\"\n\t;;\n      esac\n\n      # Delete the old objects.\n      $opt_dry_run || $RM $obj $libobj\n\n      # Objects from convenience libraries.  This assumes\n      # single-version convenience libraries.  Whenever we create\n      # different ones for PIC/non-PIC, this we'll have to duplicate\n      # the extraction.\n      reload_conv_objs=\n      gentop=\n      # reload_cmds runs $LD directly, so let us get rid of\n      # -Wl from whole_archive_flag_spec and hope we can get by with\n      # turning comma into space..\n      wl=\n\n      if test -n \"$convenience\"; then\n\tif test -n \"$whole_archive_flag_spec\"; then\n\t  eval tmp_whole_archive_flags=\\\"$whole_archive_flag_spec\\\"\n\t  reload_conv_objs=$reload_objs\\ `$ECHO \"X$tmp_whole_archive_flags\" | $Xsed -e 's|,| |g'`\n\telse\n\t  gentop=\"$output_objdir/${obj}x\"\n\t  generated=\"$generated $gentop\"\n\n\t  func_extract_archives $gentop $convenience\n\t  reload_conv_objs=\"$reload_objs $func_extract_archives_result\"\n\tfi\n      fi\n\n      # Create the old-style object.\n      reload_objs=\"$objs$old_deplibs \"`$ECHO \"X$libobjs\" | $SP2NL | $Xsed -e '/\\.'${libext}$'/d' -e '/\\.lib$/d' -e \"$lo2o\" | $NL2SP`\" $reload_conv_objs\" ### testsuite: skip nested quoting test\n\n      output=\"$obj\"\n      func_execute_cmds \"$reload_cmds\" 'exit $?'\n\n      # Exit if we aren't doing a library object file.\n      if test -z \"$libobj\"; then\n\tif test -n \"$gentop\"; then\n\t  func_show_eval '${RM}r \"$gentop\"'\n\tfi\n\n\texit $EXIT_SUCCESS\n      fi\n\n      if test \"$build_libtool_libs\" != yes; then\n\tif test -n \"$gentop\"; then\n\t  func_show_eval '${RM}r \"$gentop\"'\n\tfi\n\n\t# Create an invalid libtool object if no PIC, so that we don't\n\t# accidentally link it into a program.\n\t# $show \"echo timestamp > $libobj\"\n\t# $opt_dry_run || eval \"echo timestamp > $libobj\" || exit $?\n\texit $EXIT_SUCCESS\n      fi\n\n      if test -n \"$pic_flag\" || test \"$pic_mode\" != default; then\n\t# Only do commands if we really have different PIC objects.\n\treload_objs=\"$libobjs $reload_conv_objs\"\n\toutput=\"$libobj\"\n\tfunc_execute_cmds \"$reload_cmds\" 'exit $?'\n      fi\n\n      if test -n \"$gentop\"; then\n\tfunc_show_eval '${RM}r \"$gentop\"'\n      fi\n\n      exit $EXIT_SUCCESS\n      ;;\n\n    prog)\n      case $host in\n\t*cygwin*) func_stripname '' '.exe' \"$output\"\n\t          output=$func_stripname_result.exe;;\n      esac\n      test -n \"$vinfo\" && \\\n\tfunc_warning \"\\`-version-info' is ignored for programs\"\n\n      test -n \"$release\" && \\\n\tfunc_warning \"\\`-release' is ignored for programs\"\n\n      test \"$preload\" = yes \\\n        && test \"$dlopen_support\" = unknown \\\n\t&& test \"$dlopen_self\" = unknown \\\n\t&& test \"$dlopen_self_static\" = unknown && \\\n\t  func_warning \"\\`LT_INIT([dlopen])' not used. Assuming no dlopen support.\"\n\n      case $host in\n      *-*-rhapsody* | *-*-darwin1.[012])\n\t# On Rhapsody replace the C library is the System framework\n\tcompile_deplibs=`$ECHO \"X $compile_deplibs\" | $Xsed -e 's/ -lc / System.ltframework /'`\n\tfinalize_deplibs=`$ECHO \"X $finalize_deplibs\" | $Xsed -e 's/ -lc / System.ltframework /'`\n\t;;\n      esac\n\n      case $host in\n      *-*-darwin*)\n\t# Don't allow lazy linking, it breaks C++ global constructors\n\t# But is supposedly fixed on 10.4 or later (yay!).\n\tif test \"$tagname\" = CXX ; then\n\t  case ${MACOSX_DEPLOYMENT_TARGET-10.0} in\n\t    10.[0123])\n\t      compile_command=\"$compile_command ${wl}-bind_at_load\"\n\t      finalize_command=\"$finalize_command ${wl}-bind_at_load\"\n\t    ;;\n\t  esac\n\tfi\n\t# Time to change all our \"foo.ltframework\" stuff back to \"-framework foo\"\n\tcompile_deplibs=`$ECHO \"X $compile_deplibs\" | $Xsed -e 's% \\([^ $]*\\).ltframework% -framework \\1%g'`\n\tfinalize_deplibs=`$ECHO \"X $finalize_deplibs\" | $Xsed -e 's% \\([^ $]*\\).ltframework% -framework \\1%g'`\n\t;;\n      esac\n\n\n      # move library search paths that coincide with paths to not yet\n      # installed libraries to the beginning of the library search list\n      new_libs=\n      for path in $notinst_path; do\n\tcase \" $new_libs \" in\n\t*\" -L$path/$objdir \"*) ;;\n\t*)\n\t  case \" $compile_deplibs \" in\n\t  *\" -L$path/$objdir \"*)\n\t    new_libs=\"$new_libs -L$path/$objdir\" ;;\n\t  esac\n\t  ;;\n\tesac\n      done\n      for deplib in $compile_deplibs; do\n\tcase $deplib in\n\t-L*)\n\t  case \" $new_libs \" in\n\t  *\" $deplib \"*) ;;\n\t  *) new_libs=\"$new_libs $deplib\" ;;\n\t  esac\n\t  ;;\n\t*) new_libs=\"$new_libs $deplib\" ;;\n\tesac\n      done\n      compile_deplibs=\"$new_libs\"\n\n\n      compile_command=\"$compile_command $compile_deplibs\"\n      finalize_command=\"$finalize_command $finalize_deplibs\"\n\n      if test -n \"$rpath$xrpath\"; then\n\t# If the user specified any rpath flags, then add them.\n\tfor libdir in $rpath $xrpath; do\n\t  # This is the magic to use -rpath.\n\t  case \"$finalize_rpath \" in\n\t  *\" $libdir \"*) ;;\n\t  *) finalize_rpath=\"$finalize_rpath $libdir\" ;;\n\t  esac\n\tdone\n      fi\n\n      # Now hardcode the library paths\n      rpath=\n      hardcode_libdirs=\n      for libdir in $compile_rpath $finalize_rpath; do\n\tif test -n \"$hardcode_libdir_flag_spec\"; then\n\t  if test -n \"$hardcode_libdir_separator\"; then\n\t    if test -z \"$hardcode_libdirs\"; then\n\t      hardcode_libdirs=\"$libdir\"\n\t    else\n\t      # Just accumulate the unique libdirs.\n\t      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in\n\t      *\"$hardcode_libdir_separator$libdir$hardcode_libdir_separator\"*)\n\t\t;;\n\t      *)\n\t\thardcode_libdirs=\"$hardcode_libdirs$hardcode_libdir_separator$libdir\"\n\t\t;;\n\t      esac\n\t    fi\n\t  else\n\t    eval flag=\\\"$hardcode_libdir_flag_spec\\\"\n\t    rpath=\"$rpath $flag\"\n\t  fi\n\telif test -n \"$runpath_var\"; then\n\t  case \"$perm_rpath \" in\n\t  *\" $libdir \"*) ;;\n\t  *) perm_rpath=\"$perm_rpath $libdir\" ;;\n\t  esac\n\tfi\n\tcase $host in\n\t*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)\n\t  testbindir=`${ECHO} \"$libdir\" | ${SED} -e 's*/lib$*/bin*'`\n\t  case :$dllsearchpath: in\n\t  *\":$libdir:\"*) ;;\n\t  ::) dllsearchpath=$libdir;;\n\t  *) dllsearchpath=\"$dllsearchpath:$libdir\";;\n\t  esac\n\t  case :$dllsearchpath: in\n\t  *\":$testbindir:\"*) ;;\n\t  ::) dllsearchpath=$testbindir;;\n\t  *) dllsearchpath=\"$dllsearchpath:$testbindir\";;\n\t  esac\n\t  ;;\n\tesac\n      done\n      # Substitute the hardcoded libdirs into the rpath.\n      if test -n \"$hardcode_libdir_separator\" &&\n\t test -n \"$hardcode_libdirs\"; then\n\tlibdir=\"$hardcode_libdirs\"\n\teval rpath=\\\" $hardcode_libdir_flag_spec\\\"\n      fi\n      compile_rpath=\"$rpath\"\n\n      rpath=\n      hardcode_libdirs=\n      for libdir in $finalize_rpath; do\n\tif test -n \"$hardcode_libdir_flag_spec\"; then\n\t  if test -n \"$hardcode_libdir_separator\"; then\n\t    if test -z \"$hardcode_libdirs\"; then\n\t      hardcode_libdirs=\"$libdir\"\n\t    else\n\t      # Just accumulate the unique libdirs.\n\t      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in\n\t      *\"$hardcode_libdir_separator$libdir$hardcode_libdir_separator\"*)\n\t\t;;\n\t      *)\n\t\thardcode_libdirs=\"$hardcode_libdirs$hardcode_libdir_separator$libdir\"\n\t\t;;\n\t      esac\n\t    fi\n\t  else\n\t    eval flag=\\\"$hardcode_libdir_flag_spec\\\"\n\t    rpath=\"$rpath $flag\"\n\t  fi\n\telif test -n \"$runpath_var\"; then\n\t  case \"$finalize_perm_rpath \" in\n\t  *\" $libdir \"*) ;;\n\t  *) finalize_perm_rpath=\"$finalize_perm_rpath $libdir\" ;;\n\t  esac\n\tfi\n      done\n      # Substitute the hardcoded libdirs into the rpath.\n      if test -n \"$hardcode_libdir_separator\" &&\n\t test -n \"$hardcode_libdirs\"; then\n\tlibdir=\"$hardcode_libdirs\"\n\teval rpath=\\\" $hardcode_libdir_flag_spec\\\"\n      fi\n      finalize_rpath=\"$rpath\"\n\n      if test -n \"$libobjs\" && test \"$build_old_libs\" = yes; then\n\t# Transform all the library objects into standard objects.\n\tcompile_command=`$ECHO \"X$compile_command\" | $SP2NL | $Xsed -e \"$lo2o\" | $NL2SP`\n\tfinalize_command=`$ECHO \"X$finalize_command\" | $SP2NL | $Xsed -e \"$lo2o\" | $NL2SP`\n      fi\n\n      func_generate_dlsyms \"$outputname\" \"@PROGRAM@\" \"no\"\n\n      # template prelinking step\n      if test -n \"$prelink_cmds\"; then\n\tfunc_execute_cmds \"$prelink_cmds\" 'exit $?'\n      fi\n\n      wrappers_required=yes\n      case $host in\n      *cygwin* | *mingw* )\n        if test \"$build_libtool_libs\" != yes; then\n          wrappers_required=no\n        fi\n        ;;\n      *cegcc)\n        # Disable wrappers for cegcc, we are cross compiling anyway.\n        wrappers_required=no\n        ;;\n      *)\n        if test \"$need_relink\" = no || test \"$build_libtool_libs\" != yes; then\n          wrappers_required=no\n        fi\n        ;;\n      esac\n      if test \"$wrappers_required\" = no; then\n\t# Replace the output file specification.\n\tcompile_command=`$ECHO \"X$compile_command\" | $Xsed -e 's%@OUTPUT@%'\"$output\"'%g'`\n\tlink_command=\"$compile_command$compile_rpath\"\n\n\t# We have no uninstalled library dependencies, so finalize right now.\n\texit_status=0\n\tfunc_show_eval \"$link_command\" 'exit_status=$?'\n\n\t# Delete the generated files.\n\tif test -f \"$output_objdir/${outputname}S.${objext}\"; then\n\t  func_show_eval '$RM \"$output_objdir/${outputname}S.${objext}\"'\n\tfi\n\n\texit $exit_status\n      fi\n\n      if test -n \"$compile_shlibpath$finalize_shlibpath\"; then\n\tcompile_command=\"$shlibpath_var=\\\"$compile_shlibpath$finalize_shlibpath\\$$shlibpath_var\\\" $compile_command\"\n      fi\n      if test -n \"$finalize_shlibpath\"; then\n\tfinalize_command=\"$shlibpath_var=\\\"$finalize_shlibpath\\$$shlibpath_var\\\" $finalize_command\"\n      fi\n\n      compile_var=\n      finalize_var=\n      if test -n \"$runpath_var\"; then\n\tif test -n \"$perm_rpath\"; then\n\t  # We should set the runpath_var.\n\t  rpath=\n\t  for dir in $perm_rpath; do\n\t    rpath=\"$rpath$dir:\"\n\t  done\n\t  compile_var=\"$runpath_var=\\\"$rpath\\$$runpath_var\\\" \"\n\tfi\n\tif test -n \"$finalize_perm_rpath\"; then\n\t  # We should set the runpath_var.\n\t  rpath=\n\t  for dir in $finalize_perm_rpath; do\n\t    rpath=\"$rpath$dir:\"\n\t  done\n\t  finalize_var=\"$runpath_var=\\\"$rpath\\$$runpath_var\\\" \"\n\tfi\n      fi\n\n      if test \"$no_install\" = yes; then\n\t# We don't need to create a wrapper script.\n\tlink_command=\"$compile_var$compile_command$compile_rpath\"\n\t# Replace the output file specification.\n\tlink_command=`$ECHO \"X$link_command\" | $Xsed -e 's%@OUTPUT@%'\"$output\"'%g'`\n\t# Delete the old output file.\n\t$opt_dry_run || $RM $output\n\t# Link the executable and exit\n\tfunc_show_eval \"$link_command\" 'exit $?'\n\texit $EXIT_SUCCESS\n      fi\n\n      if test \"$hardcode_action\" = relink; then\n\t# Fast installation is not supported\n\tlink_command=\"$compile_var$compile_command$compile_rpath\"\n\trelink_command=\"$finalize_var$finalize_command$finalize_rpath\"\n\n\tfunc_warning \"this platform does not like uninstalled shared libraries\"\n\tfunc_warning \"\\`$output' will be relinked during installation\"\n      else\n\tif test \"$fast_install\" != no; then\n\t  link_command=\"$finalize_var$compile_command$finalize_rpath\"\n\t  if test \"$fast_install\" = yes; then\n\t    relink_command=`$ECHO \"X$compile_var$compile_command$compile_rpath\" | $Xsed -e 's%@OUTPUT@%\\$progdir/\\$file%g'`\n\t  else\n\t    # fast_install is set to needless\n\t    relink_command=\n\t  fi\n\telse\n\t  link_command=\"$compile_var$compile_command$compile_rpath\"\n\t  relink_command=\"$finalize_var$finalize_command$finalize_rpath\"\n\tfi\n      fi\n\n      # Replace the output file specification.\n      link_command=`$ECHO \"X$link_command\" | $Xsed -e 's%@OUTPUT@%'\"$output_objdir/$outputname\"'%g'`\n\n      # Delete the old output files.\n      $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname\n\n      func_show_eval \"$link_command\" 'exit $?'\n\n      # Now create the wrapper script.\n      func_verbose \"creating $output\"\n\n      # Quote the relink command for shipping.\n      if test -n \"$relink_command\"; then\n\t# Preserve any variables that may affect compiler behavior\n\tfor var in $variables_saved_for_relink; do\n\t  if eval test -z \\\"\\${$var+set}\\\"; then\n\t    relink_command=\"{ test -z \\\"\\${$var+set}\\\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command\"\n\t  elif eval var_value=\\$$var; test -z \"$var_value\"; then\n\t    relink_command=\"$var=; export $var; $relink_command\"\n\t  else\n\t    func_quote_for_eval \"$var_value\"\n\t    relink_command=\"$var=$func_quote_for_eval_result; export $var; $relink_command\"\n\t  fi\n\tdone\n\trelink_command=\"(cd `pwd`; $relink_command)\"\n\trelink_command=`$ECHO \"X$relink_command\" | $Xsed -e \"$sed_quote_subst\"`\n      fi\n\n      # Quote $ECHO for shipping.\n      if test \"X$ECHO\" = \"X$SHELL $progpath --fallback-echo\"; then\n\tcase $progpath in\n\t[\\\\/]* | [A-Za-z]:[\\\\/]*) qecho=\"$SHELL $progpath --fallback-echo\";;\n\t*) qecho=\"$SHELL `pwd`/$progpath --fallback-echo\";;\n\tesac\n\tqecho=`$ECHO \"X$qecho\" | $Xsed -e \"$sed_quote_subst\"`\n      else\n\tqecho=`$ECHO \"X$ECHO\" | $Xsed -e \"$sed_quote_subst\"`\n      fi\n\n      # Only actually do things if not in dry run mode.\n      $opt_dry_run || {\n\t# win32 will think the script is a binary if it has\n\t# a .exe suffix, so we strip it off here.\n\tcase $output in\n\t  *.exe) func_stripname '' '.exe' \"$output\"\n\t         output=$func_stripname_result ;;\n\tesac\n\t# test for cygwin because mv fails w/o .exe extensions\n\tcase $host in\n\t  *cygwin*)\n\t    exeext=.exe\n\t    func_stripname '' '.exe' \"$outputname\"\n\t    outputname=$func_stripname_result ;;\n\t  *) exeext= ;;\n\tesac\n\tcase $host in\n\t  *cygwin* | *mingw* )\n\t    func_dirname_and_basename \"$output\" \"\" \".\"\n\t    output_name=$func_basename_result\n\t    output_path=$func_dirname_result\n\t    cwrappersource=\"$output_path/$objdir/lt-$output_name.c\"\n\t    cwrapper=\"$output_path/$output_name.exe\"\n\t    $RM $cwrappersource $cwrapper\n\t    trap \"$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE\" 1 2 15\n\n\t    func_emit_cwrapperexe_src > $cwrappersource\n\n\t    # The wrapper executable is built using the $host compiler,\n\t    # because it contains $host paths and files. If cross-\n\t    # compiling, it, like the target executable, must be\n\t    # executed on the $host or under an emulation environment.\n\t    $opt_dry_run || {\n\t      $LTCC $LTCFLAGS -o $cwrapper $cwrappersource\n\t      $STRIP $cwrapper\n\t    }\n\n\t    # Now, create the wrapper script for func_source use:\n\t    func_ltwrapper_scriptname $cwrapper\n\t    $RM $func_ltwrapper_scriptname_result\n\t    trap \"$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE\" 1 2 15\n\t    $opt_dry_run || {\n\t      # note: this script will not be executed, so do not chmod.\n\t      if test \"x$build\" = \"x$host\" ; then\n\t\t$cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result\n\t      else\n\t\tfunc_emit_wrapper no > $func_ltwrapper_scriptname_result\n\t      fi\n\t    }\n\t  ;;\n\t  * )\n\t    $RM $output\n\t    trap \"$RM $output; exit $EXIT_FAILURE\" 1 2 15\n\n\t    func_emit_wrapper no > $output\n\t    chmod +x $output\n\t  ;;\n\tesac\n      }\n      exit $EXIT_SUCCESS\n      ;;\n    esac\n\n    # See if we need to build an old-fashioned archive.\n    for oldlib in $oldlibs; do\n\n      if test \"$build_libtool_libs\" = convenience; then\n\toldobjs=\"$libobjs_save $symfileobj\"\n\taddlibs=\"$convenience\"\n\tbuild_libtool_libs=no\n      else\n\tif test \"$build_libtool_libs\" = module; then\n\t  oldobjs=\"$libobjs_save\"\n\t  build_libtool_libs=no\n\telse\n\t  oldobjs=\"$old_deplibs $non_pic_objects\"\n\t  if test \"$preload\" = yes && test -f \"$symfileobj\"; then\n\t    oldobjs=\"$oldobjs $symfileobj\"\n\t  fi\n\tfi\n\taddlibs=\"$old_convenience\"\n      fi\n\n      if test -n \"$addlibs\"; then\n\tgentop=\"$output_objdir/${outputname}x\"\n\tgenerated=\"$generated $gentop\"\n\n\tfunc_extract_archives $gentop $addlibs\n\toldobjs=\"$oldobjs $func_extract_archives_result\"\n      fi\n\n      # Do each command in the archive commands.\n      if test -n \"$old_archive_from_new_cmds\" && test \"$build_libtool_libs\" = yes; then\n\tcmds=$old_archive_from_new_cmds\n      else\n\n\t# Add any objects from preloaded convenience libraries\n\tif test -n \"$dlprefiles\"; then\n\t  gentop=\"$output_objdir/${outputname}x\"\n\t  generated=\"$generated $gentop\"\n\n\t  func_extract_archives $gentop $dlprefiles\n\t  oldobjs=\"$oldobjs $func_extract_archives_result\"\n\tfi\n\n\t# POSIX demands no paths to be encoded in archives.  We have\n\t# to avoid creating archives with duplicate basenames if we\n\t# might have to extract them afterwards, e.g., when creating a\n\t# static archive out of a convenience library, or when linking\n\t# the entirety of a libtool archive into another (currently\n\t# not supported by libtool).\n\tif (for obj in $oldobjs\n\t    do\n\t      func_basename \"$obj\"\n\t      $ECHO \"$func_basename_result\"\n\t    done | sort | sort -uc >/dev/null 2>&1); then\n\t  :\n\telse\n\t  $ECHO \"copying selected object files to avoid basename conflicts...\"\n\t  gentop=\"$output_objdir/${outputname}x\"\n\t  generated=\"$generated $gentop\"\n\t  func_mkdir_p \"$gentop\"\n\t  save_oldobjs=$oldobjs\n\t  oldobjs=\n\t  counter=1\n\t  for obj in $save_oldobjs\n\t  do\n\t    func_basename \"$obj\"\n\t    objbase=\"$func_basename_result\"\n\t    case \" $oldobjs \" in\n\t    \" \") oldobjs=$obj ;;\n\t    *[\\ /]\"$objbase \"*)\n\t      while :; do\n\t\t# Make sure we don't pick an alternate name that also\n\t\t# overlaps.\n\t\tnewobj=lt$counter-$objbase\n\t\tfunc_arith $counter + 1\n\t\tcounter=$func_arith_result\n\t\tcase \" $oldobjs \" in\n\t\t*[\\ /]\"$newobj \"*) ;;\n\t\t*) if test ! -f \"$gentop/$newobj\"; then break; fi ;;\n\t\tesac\n\t      done\n\t      func_show_eval \"ln $obj $gentop/$newobj || cp $obj $gentop/$newobj\"\n\t      oldobjs=\"$oldobjs $gentop/$newobj\"\n\t      ;;\n\t    *) oldobjs=\"$oldobjs $obj\" ;;\n\t    esac\n\t  done\n\tfi\n\teval cmds=\\\"$old_archive_cmds\\\"\n\n\tfunc_len \" $cmds\"\n\tlen=$func_len_result\n\tif test \"$len\" -lt \"$max_cmd_len\" || test \"$max_cmd_len\" -le -1; then\n\t  cmds=$old_archive_cmds\n\telse\n\t  # the command line is too long to link in one step, link in parts\n\t  func_verbose \"using piecewise archive linking...\"\n\t  save_RANLIB=$RANLIB\n\t  RANLIB=:\n\t  objlist=\n\t  concat_cmds=\n\t  save_oldobjs=$oldobjs\n\t  oldobjs=\n\t  # Is there a better way of finding the last object in the list?\n\t  for obj in $save_oldobjs\n\t  do\n\t    last_oldobj=$obj\n\t  done\n\t  eval test_cmds=\\\"$old_archive_cmds\\\"\n\t  func_len \" $test_cmds\"\n\t  len0=$func_len_result\n\t  len=$len0\n\t  for obj in $save_oldobjs\n\t  do\n\t    func_len \" $obj\"\n\t    func_arith $len + $func_len_result\n\t    len=$func_arith_result\n\t    func_append objlist \" $obj\"\n\t    if test \"$len\" -lt \"$max_cmd_len\"; then\n\t      :\n\t    else\n\t      # the above command should be used before it gets too long\n\t      oldobjs=$objlist\n\t      if test \"$obj\" = \"$last_oldobj\" ; then\n\t\tRANLIB=$save_RANLIB\n\t      fi\n\t      test -z \"$concat_cmds\" || concat_cmds=$concat_cmds~\n\t      eval concat_cmds=\\\"\\${concat_cmds}$old_archive_cmds\\\"\n\t      objlist=\n\t      len=$len0\n\t    fi\n\t  done\n\t  RANLIB=$save_RANLIB\n\t  oldobjs=$objlist\n\t  if test \"X$oldobjs\" = \"X\" ; then\n\t    eval cmds=\\\"\\$concat_cmds\\\"\n\t  else\n\t    eval cmds=\\\"\\$concat_cmds~\\$old_archive_cmds\\\"\n\t  fi\n\tfi\n      fi\n      func_execute_cmds \"$cmds\" 'exit $?'\n    done\n\n    test -n \"$generated\" && \\\n      func_show_eval \"${RM}r$generated\"\n\n    # Now create the libtool archive.\n    case $output in\n    *.la)\n      old_library=\n      test \"$build_old_libs\" = yes && old_library=\"$libname.$libext\"\n      func_verbose \"creating $output\"\n\n      # Preserve any variables that may affect compiler behavior\n      for var in $variables_saved_for_relink; do\n\tif eval test -z \\\"\\${$var+set}\\\"; then\n\t  relink_command=\"{ test -z \\\"\\${$var+set}\\\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command\"\n\telif eval var_value=\\$$var; test -z \"$var_value\"; then\n\t  relink_command=\"$var=; export $var; $relink_command\"\n\telse\n\t  func_quote_for_eval \"$var_value\"\n\t  relink_command=\"$var=$func_quote_for_eval_result; export $var; $relink_command\"\n\tfi\n      done\n      # Quote the link command for shipping.\n      relink_command=\"(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)\"\n      relink_command=`$ECHO \"X$relink_command\" | $Xsed -e \"$sed_quote_subst\"`\n      if test \"$hardcode_automatic\" = yes ; then\n\trelink_command=\n      fi\n\n      # Only create the output if not a dry run.\n      $opt_dry_run || {\n\tfor installed in no yes; do\n\t  if test \"$installed\" = yes; then\n\t    if test -z \"$install_libdir\"; then\n\t      break\n\t    fi\n\t    output=\"$output_objdir/$outputname\"i\n\t    # Replace all uninstalled libtool libraries with the installed ones\n\t    newdependency_libs=\n\t    for deplib in $dependency_libs; do\n\t      case $deplib in\n\t      *.la)\n\t\tfunc_basename \"$deplib\"\n\t\tname=\"$func_basename_result\"\n\t\teval libdir=`${SED} -n -e 's/^libdir=\\(.*\\)$/\\1/p' $deplib`\n\t\ttest -z \"$libdir\" && \\\n\t\t  func_fatal_error \"\\`$deplib' is not a valid libtool archive\"\n\t\tnewdependency_libs=\"$newdependency_libs $libdir/$name\"\n\t\t;;\n\t      *) newdependency_libs=\"$newdependency_libs $deplib\" ;;\n\t      esac\n\t    done\n\t    dependency_libs=\"$newdependency_libs\"\n\t    newdlfiles=\n\n\t    for lib in $dlfiles; do\n\t      case $lib in\n\t      *.la)\n\t        func_basename \"$lib\"\n\t\tname=\"$func_basename_result\"\n\t\teval libdir=`${SED} -n -e 's/^libdir=\\(.*\\)$/\\1/p' $lib`\n\t\ttest -z \"$libdir\" && \\\n\t\t  func_fatal_error \"\\`$lib' is not a valid libtool archive\"\n\t\tnewdlfiles=\"$newdlfiles $libdir/$name\"\n\t\t;;\n\t      *) newdlfiles=\"$newdlfiles $lib\" ;;\n\t      esac\n\t    done\n\t    dlfiles=\"$newdlfiles\"\n\t    newdlprefiles=\n\t    for lib in $dlprefiles; do\n\t      case $lib in\n\t      *.la)\n\t\t# Only pass preopened files to the pseudo-archive (for\n\t\t# eventual linking with the app. that links it) if we\n\t\t# didn't already link the preopened objects directly into\n\t\t# the library:\n\t\tfunc_basename \"$lib\"\n\t\tname=\"$func_basename_result\"\n\t\teval libdir=`${SED} -n -e 's/^libdir=\\(.*\\)$/\\1/p' $lib`\n\t\ttest -z \"$libdir\" && \\\n\t\t  func_fatal_error \"\\`$lib' is not a valid libtool archive\"\n\t\tnewdlprefiles=\"$newdlprefiles $libdir/$name\"\n\t\t;;\n\t      esac\n\t    done\n\t    dlprefiles=\"$newdlprefiles\"\n\t  else\n\t    newdlfiles=\n\t    for lib in $dlfiles; do\n\t      case $lib in\n\t\t[\\\\/]* | [A-Za-z]:[\\\\/]*) abs=\"$lib\" ;;\n\t\t*) abs=`pwd`\"/$lib\" ;;\n\t      esac\n\t      newdlfiles=\"$newdlfiles $abs\"\n\t    done\n\t    dlfiles=\"$newdlfiles\"\n\t    newdlprefiles=\n\t    for lib in $dlprefiles; do\n\t      case $lib in\n\t\t[\\\\/]* | [A-Za-z]:[\\\\/]*) abs=\"$lib\" ;;\n\t\t*) abs=`pwd`\"/$lib\" ;;\n\t      esac\n\t      newdlprefiles=\"$newdlprefiles $abs\"\n\t    done\n\t    dlprefiles=\"$newdlprefiles\"\n\t  fi\n\t  $RM $output\n\t  # place dlname in correct position for cygwin\n\t  tdlname=$dlname\n\t  case $host,$output,$installed,$module,$dlname in\n\t    *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;\n\t  esac\n\t  $ECHO > $output \"\\\n# $outputname - a libtool library file\n# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION\n#\n# Please DO NOT delete this file!\n# It is necessary for linking the library.\n\n# The name that we can dlopen(3).\ndlname='$tdlname'\n\n# Names of this library.\nlibrary_names='$library_names'\n\n# The name of the static archive.\nold_library='$old_library'\n\n# Linker flags that can not go in dependency_libs.\ninherited_linker_flags='$new_inherited_linker_flags'\n\n# Libraries that this one depends upon.\ndependency_libs='$dependency_libs'\n\n# Names of additional weak libraries provided by this library\nweak_library_names='$weak_libs'\n\n# Version information for $libname.\ncurrent=$current\nage=$age\nrevision=$revision\n\n# Is this an already installed library?\ninstalled=$installed\n\n# Should we warn about portability when linking against -modules?\nshouldnotlink=$module\n\n# Files to dlopen/dlpreopen\ndlopen='$dlfiles'\ndlpreopen='$dlprefiles'\n\n# Directory that this library needs to be installed in:\nlibdir='$install_libdir'\"\n\t  if test \"$installed\" = no && test \"$need_relink\" = yes; then\n\t    $ECHO >> $output \"\\\nrelink_command=\\\"$relink_command\\\"\"\n\t  fi\n\tdone\n      }\n\n      # Do a symbolic link so that the libtool archive can be found in\n      # LD_LIBRARY_PATH before the program is installed.\n      func_show_eval '( cd \"$output_objdir\" && $RM \"$outputname\" && $LN_S \"../$outputname\" \"$outputname\" )' 'exit $?'\n      ;;\n    esac\n    exit $EXIT_SUCCESS\n}\n\n{ test \"$mode\" = link || test \"$mode\" = relink; } &&\n    func_mode_link ${1+\"$@\"}\n\n\n# func_mode_uninstall arg...\nfunc_mode_uninstall ()\n{\n    $opt_debug\n    RM=\"$nonopt\"\n    files=\n    rmforce=\n    exit_status=0\n\n    # This variable tells wrapper scripts just to set variables rather\n    # than running their programs.\n    libtool_install_magic=\"$magic\"\n\n    for arg\n    do\n      case $arg in\n      -f) RM=\"$RM $arg\"; rmforce=yes ;;\n      -*) RM=\"$RM $arg\" ;;\n      *) files=\"$files $arg\" ;;\n      esac\n    done\n\n    test -z \"$RM\" && \\\n      func_fatal_help \"you must specify an RM program\"\n\n    rmdirs=\n\n    origobjdir=\"$objdir\"\n    for file in $files; do\n      func_dirname \"$file\" \"\" \".\"\n      dir=\"$func_dirname_result\"\n      if test \"X$dir\" = X.; then\n\tobjdir=\"$origobjdir\"\n      else\n\tobjdir=\"$dir/$origobjdir\"\n      fi\n      func_basename \"$file\"\n      name=\"$func_basename_result\"\n      test \"$mode\" = uninstall && objdir=\"$dir\"\n\n      # Remember objdir for removal later, being careful to avoid duplicates\n      if test \"$mode\" = clean; then\n\tcase \" $rmdirs \" in\n\t  *\" $objdir \"*) ;;\n\t  *) rmdirs=\"$rmdirs $objdir\" ;;\n\tesac\n      fi\n\n      # Don't error if the file doesn't exist and rm -f was used.\n      if { test -L \"$file\"; } >/dev/null 2>&1 ||\n\t { test -h \"$file\"; } >/dev/null 2>&1 ||\n\t test -f \"$file\"; then\n\t:\n      elif test -d \"$file\"; then\n\texit_status=1\n\tcontinue\n      elif test \"$rmforce\" = yes; then\n\tcontinue\n      fi\n\n      rmfiles=\"$file\"\n\n      case $name in\n      *.la)\n\t# Possibly a libtool archive, so verify it.\n\tif func_lalib_p \"$file\"; then\n\t  func_source $dir/$name\n\n\t  # Delete the libtool libraries and symlinks.\n\t  for n in $library_names; do\n\t    rmfiles=\"$rmfiles $objdir/$n\"\n\t  done\n\t  test -n \"$old_library\" && rmfiles=\"$rmfiles $objdir/$old_library\"\n\n\t  case \"$mode\" in\n\t  clean)\n\t    case \"  $library_names \" in\n\t    # \"  \" in the beginning catches empty $dlname\n\t    *\" $dlname \"*) ;;\n\t    *) rmfiles=\"$rmfiles $objdir/$dlname\" ;;\n\t    esac\n\t    test -n \"$libdir\" && rmfiles=\"$rmfiles $objdir/$name $objdir/${name}i\"\n\t    ;;\n\t  uninstall)\n\t    if test -n \"$library_names\"; then\n\t      # Do each command in the postuninstall commands.\n\t      func_execute_cmds \"$postuninstall_cmds\" 'test \"$rmforce\" = yes || exit_status=1'\n\t    fi\n\n\t    if test -n \"$old_library\"; then\n\t      # Do each command in the old_postuninstall commands.\n\t      func_execute_cmds \"$old_postuninstall_cmds\" 'test \"$rmforce\" = yes || exit_status=1'\n\t    fi\n\t    # FIXME: should reinstall the best remaining shared library.\n\t    ;;\n\t  esac\n\tfi\n\t;;\n\n      *.lo)\n\t# Possibly a libtool object, so verify it.\n\tif func_lalib_p \"$file\"; then\n\n\t  # Read the .lo file\n\t  func_source $dir/$name\n\n\t  # Add PIC object to the list of files to remove.\n\t  if test -n \"$pic_object\" &&\n\t     test \"$pic_object\" != none; then\n\t    rmfiles=\"$rmfiles $dir/$pic_object\"\n\t  fi\n\n\t  # Add non-PIC object to the list of files to remove.\n\t  if test -n \"$non_pic_object\" &&\n\t     test \"$non_pic_object\" != none; then\n\t    rmfiles=\"$rmfiles $dir/$non_pic_object\"\n\t  fi\n\tfi\n\t;;\n\n      *)\n\tif test \"$mode\" = clean ; then\n\t  noexename=$name\n\t  case $file in\n\t  *.exe)\n\t    func_stripname '' '.exe' \"$file\"\n\t    file=$func_stripname_result\n\t    func_stripname '' '.exe' \"$name\"\n\t    noexename=$func_stripname_result\n\t    # $file with .exe has already been added to rmfiles,\n\t    # add $file without .exe\n\t    rmfiles=\"$rmfiles $file\"\n\t    ;;\n\t  esac\n\t  # Do a test to see if this is a libtool program.\n\t  if func_ltwrapper_p \"$file\"; then\n\t    if func_ltwrapper_executable_p \"$file\"; then\n\t      func_ltwrapper_scriptname \"$file\"\n\t      relink_command=\n\t      func_source $func_ltwrapper_scriptname_result\n\t      rmfiles=\"$rmfiles $func_ltwrapper_scriptname_result\"\n\t    else\n\t      relink_command=\n\t      func_source $dir/$noexename\n\t    fi\n\n\t    # note $name still contains .exe if it was in $file originally\n\t    # as does the version of $file that was added into $rmfiles\n\t    rmfiles=\"$rmfiles $objdir/$name $objdir/${name}S.${objext}\"\n\t    if test \"$fast_install\" = yes && test -n \"$relink_command\"; then\n\t      rmfiles=\"$rmfiles $objdir/lt-$name\"\n\t    fi\n\t    if test \"X$noexename\" != \"X$name\" ; then\n\t      rmfiles=\"$rmfiles $objdir/lt-${noexename}.c\"\n\t    fi\n\t  fi\n\tfi\n\t;;\n      esac\n      func_show_eval \"$RM $rmfiles\" 'exit_status=1'\n    done\n    objdir=\"$origobjdir\"\n\n    # Try to remove the ${objdir}s in the directories where we deleted files\n    for dir in $rmdirs; do\n      if test -d \"$dir\"; then\n\tfunc_show_eval \"rmdir $dir >/dev/null 2>&1\"\n      fi\n    done\n\n    exit $exit_status\n}\n\n{ test \"$mode\" = uninstall || test \"$mode\" = clean; } &&\n    func_mode_uninstall ${1+\"$@\"}\n\ntest -z \"$mode\" && {\n  help=\"$generic_help\"\n  func_fatal_help \"you must specify a MODE\"\n}\n\ntest -z \"$exec_cmd\" && \\\n  func_fatal_help \"invalid operation mode \\`$mode'\"\n\nif test -n \"$exec_cmd\"; then\n  eval exec \"$exec_cmd\"\n  exit $EXIT_FAILURE\nfi\n\nexit $exit_status\n\n\n# The TAGs below are defined such that we never get into a situation\n# in which we disable both kinds of libraries.  Given conflicting\n# choices, we go for a static library, that is the most portable,\n# since we can't tell whether shared libraries were disabled because\n# the user asked for that or because the platform doesn't support\n# them.  This is particularly important on AIX, because we don't\n# support having both static and shared libraries enabled at the same\n# time on that platform, so we default to a shared-only configuration.\n# If a disable-shared tag is given, we'll fallback to a static-only\n# configuration.  But we'll never go from static-only to shared-only.\n\n# ### BEGIN LIBTOOL TAG CONFIG: disable-shared\nbuild_libtool_libs=no\nbuild_old_libs=yes\n# ### END LIBTOOL TAG CONFIG: disable-shared\n\n# ### BEGIN LIBTOOL TAG CONFIG: disable-static\nbuild_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`\n# ### END LIBTOOL TAG CONFIG: disable-static\n\n# Local Variables:\n# mode:shell-script\n# sh-indentation:2\n# End:\n# vi:sw=2\n\n"
  },
  {
    "path": "src/main/jni/tiff/config/missing",
    "content": "#! /bin/sh\n# Common stub for a few missing GNU programs while installing.\n\nscriptversion=2005-06-08.21\n\n# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005\n#   Free Software Foundation, Inc.\n# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.\n\n# This program is free software; you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation; either version 2, or (at your option)\n# any later version.\n\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n\n# You should have received a copy of the GNU General Public License\n# along with this program; if not, write to the Free Software\n# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\n# 02110-1301, USA.\n\n# As a special exception to the GNU General Public License, if you\n# distribute this file as part of a program that contains a\n# configuration script generated by Autoconf, you may include it under\n# the same distribution terms that you use for the rest of that program.\n\nif test $# -eq 0; then\n  echo 1>&2 \"Try \\`$0 --help' for more information\"\n  exit 1\nfi\n\nrun=:\n\n# In the cases where this matters, `missing' is being run in the\n# srcdir already.\nif test -f configure.ac; then\n  configure_ac=configure.ac\nelse\n  configure_ac=configure.in\nfi\n\nmsg=\"missing on your system\"\n\ncase \"$1\" in\n--run)\n  # Try to run requested program, and just exit if it succeeds.\n  run=\n  shift\n  \"$@\" && exit 0\n  # Exit code 63 means version mismatch.  This often happens\n  # when the user try to use an ancient version of a tool on\n  # a file that requires a minimum version.  In this case we\n  # we should proceed has if the program had been absent, or\n  # if --run hadn't been passed.\n  if test $? = 63; then\n    run=:\n    msg=\"probably too old\"\n  fi\n  ;;\n\n  -h|--h|--he|--hel|--help)\n    echo \"\\\n$0 [OPTION]... PROGRAM [ARGUMENT]...\n\nHandle \\`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an\nerror status if there is no known handling for PROGRAM.\n\nOptions:\n  -h, --help      display this help and exit\n  -v, --version   output version information and exit\n  --run           try to run the given command, and emulate it if it fails\n\nSupported PROGRAM values:\n  aclocal      touch file \\`aclocal.m4'\n  autoconf     touch file \\`configure'\n  autoheader   touch file \\`config.h.in'\n  automake     touch all \\`Makefile.in' files\n  bison        create \\`y.tab.[ch]', if possible, from existing .[ch]\n  flex         create \\`lex.yy.c', if possible, from existing .c\n  help2man     touch the output file\n  lex          create \\`lex.yy.c', if possible, from existing .c\n  makeinfo     touch the output file\n  tar          try tar, gnutar, gtar, then tar without non-portable flags\n  yacc         create \\`y.tab.[ch]', if possible, from existing .[ch]\n\nSend bug reports to <bug-automake@gnu.org>.\"\n    exit $?\n    ;;\n\n  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)\n    echo \"missing $scriptversion (GNU Automake)\"\n    exit $?\n    ;;\n\n  -*)\n    echo 1>&2 \"$0: Unknown \\`$1' option\"\n    echo 1>&2 \"Try \\`$0 --help' for more information\"\n    exit 1\n    ;;\n\nesac\n\n# Now exit if we have it, but it failed.  Also exit now if we\n# don't have it and --version was passed (most likely to detect\n# the program).\ncase \"$1\" in\n  lex|yacc)\n    # Not GNU programs, they don't have --version.\n    ;;\n\n  tar)\n    if test -n \"$run\"; then\n       echo 1>&2 \"ERROR: \\`tar' requires --run\"\n       exit 1\n    elif test \"x$2\" = \"x--version\" || test \"x$2\" = \"x--help\"; then\n       exit 1\n    fi\n    ;;\n\n  *)\n    if test -z \"$run\" && ($1 --version) > /dev/null 2>&1; then\n       # We have it, but it failed.\n       exit 1\n    elif test \"x$2\" = \"x--version\" || test \"x$2\" = \"x--help\"; then\n       # Could not run --version or --help.  This is probably someone\n       # running `$TOOL --version' or `$TOOL --help' to check whether\n       # $TOOL exists and not knowing $TOOL uses missing.\n       exit 1\n    fi\n    ;;\nesac\n\n# If it does not exist, or fails to run (possibly an outdated version),\n# try to emulate it.\ncase \"$1\" in\n  aclocal*)\n    echo 1>&2 \"\\\nWARNING: \\`$1' is $msg.  You should only need it if\n         you modified \\`acinclude.m4' or \\`${configure_ac}'.  You might want\n         to install the \\`Automake' and \\`Perl' packages.  Grab them from\n         any GNU archive site.\"\n    touch aclocal.m4\n    ;;\n\n  autoconf)\n    echo 1>&2 \"\\\nWARNING: \\`$1' is $msg.  You should only need it if\n         you modified \\`${configure_ac}'.  You might want to install the\n         \\`Autoconf' and \\`GNU m4' packages.  Grab them from any GNU\n         archive site.\"\n    touch configure\n    ;;\n\n  autoheader)\n    echo 1>&2 \"\\\nWARNING: \\`$1' is $msg.  You should only need it if\n         you modified \\`acconfig.h' or \\`${configure_ac}'.  You might want\n         to install the \\`Autoconf' and \\`GNU m4' packages.  Grab them\n         from any GNU archive site.\"\n    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\\([^)]*\\)).*/\\1/p' ${configure_ac}`\n    test -z \"$files\" && files=\"config.h\"\n    touch_files=\n    for f in $files; do\n      case \"$f\" in\n      *:*) touch_files=\"$touch_files \"`echo \"$f\" |\n\t\t\t\t       sed -e 's/^[^:]*://' -e 's/:.*//'`;;\n      *) touch_files=\"$touch_files $f.in\";;\n      esac\n    done\n    touch $touch_files\n    ;;\n\n  automake*)\n    echo 1>&2 \"\\\nWARNING: \\`$1' is $msg.  You should only need it if\n         you modified \\`Makefile.am', \\`acinclude.m4' or \\`${configure_ac}'.\n         You might want to install the \\`Automake' and \\`Perl' packages.\n         Grab them from any GNU archive site.\"\n    find . -type f -name Makefile.am -print |\n\t   sed 's/\\.am$/.in/' |\n\t   while read f; do touch \"$f\"; done\n    ;;\n\n  autom4te)\n    echo 1>&2 \"\\\nWARNING: \\`$1' is needed, but is $msg.\n         You might have modified some files without having the\n         proper tools for further handling them.\n         You can get \\`$1' as part of \\`Autoconf' from any GNU\n         archive site.\"\n\n    file=`echo \"$*\" | sed -n 's/.*--output[ =]*\\([^ ]*\\).*/\\1/p'`\n    test -z \"$file\" && file=`echo \"$*\" | sed -n 's/.*-o[ ]*\\([^ ]*\\).*/\\1/p'`\n    if test -f \"$file\"; then\n\ttouch $file\n    else\n\ttest -z \"$file\" || exec >$file\n\techo \"#! /bin/sh\"\n\techo \"# Created by GNU Automake missing as a replacement of\"\n\techo \"#  $ $@\"\n\techo \"exit 0\"\n\tchmod +x $file\n\texit 1\n    fi\n    ;;\n\n  bison|yacc)\n    echo 1>&2 \"\\\nWARNING: \\`$1' $msg.  You should only need it if\n         you modified a \\`.y' file.  You may need the \\`Bison' package\n         in order for those modifications to take effect.  You can get\n         \\`Bison' from any GNU archive site.\"\n    rm -f y.tab.c y.tab.h\n    if [ $# -ne 1 ]; then\n        eval LASTARG=\"\\${$#}\"\n\tcase \"$LASTARG\" in\n\t*.y)\n\t    SRCFILE=`echo \"$LASTARG\" | sed 's/y$/c/'`\n\t    if [ -f \"$SRCFILE\" ]; then\n\t         cp \"$SRCFILE\" y.tab.c\n\t    fi\n\t    SRCFILE=`echo \"$LASTARG\" | sed 's/y$/h/'`\n\t    if [ -f \"$SRCFILE\" ]; then\n\t         cp \"$SRCFILE\" y.tab.h\n\t    fi\n\t  ;;\n\tesac\n    fi\n    if [ ! -f y.tab.h ]; then\n\techo >y.tab.h\n    fi\n    if [ ! -f y.tab.c ]; then\n\techo 'main() { return 0; }' >y.tab.c\n    fi\n    ;;\n\n  lex|flex)\n    echo 1>&2 \"\\\nWARNING: \\`$1' is $msg.  You should only need it if\n         you modified a \\`.l' file.  You may need the \\`Flex' package\n         in order for those modifications to take effect.  You can get\n         \\`Flex' from any GNU archive site.\"\n    rm -f lex.yy.c\n    if [ $# -ne 1 ]; then\n        eval LASTARG=\"\\${$#}\"\n\tcase \"$LASTARG\" in\n\t*.l)\n\t    SRCFILE=`echo \"$LASTARG\" | sed 's/l$/c/'`\n\t    if [ -f \"$SRCFILE\" ]; then\n\t         cp \"$SRCFILE\" lex.yy.c\n\t    fi\n\t  ;;\n\tesac\n    fi\n    if [ ! -f lex.yy.c ]; then\n\techo 'main() { return 0; }' >lex.yy.c\n    fi\n    ;;\n\n  help2man)\n    echo 1>&2 \"\\\nWARNING: \\`$1' is $msg.  You should only need it if\n\t you modified a dependency of a manual page.  You may need the\n\t \\`Help2man' package in order for those modifications to take\n\t effect.  You can get \\`Help2man' from any GNU archive site.\"\n\n    file=`echo \"$*\" | sed -n 's/.*-o \\([^ ]*\\).*/\\1/p'`\n    if test -z \"$file\"; then\n\tfile=`echo \"$*\" | sed -n 's/.*--output=\\([^ ]*\\).*/\\1/p'`\n    fi\n    if [ -f \"$file\" ]; then\n\ttouch $file\n    else\n\ttest -z \"$file\" || exec >$file\n\techo \".ab help2man is required to generate this page\"\n\texit 1\n    fi\n    ;;\n\n  makeinfo)\n    echo 1>&2 \"\\\nWARNING: \\`$1' is $msg.  You should only need it if\n         you modified a \\`.texi' or \\`.texinfo' file, or any other file\n         indirectly affecting the aspect of the manual.  The spurious\n         call might also be the consequence of using a buggy \\`make' (AIX,\n         DU, IRIX).  You might want to install the \\`Texinfo' package or\n         the \\`GNU make' package.  Grab either from any GNU archive site.\"\n    # The file to touch is that specified with -o ...\n    file=`echo \"$*\" | sed -n 's/.*-o \\([^ ]*\\).*/\\1/p'`\n    if test -z \"$file\"; then\n      # ... or it is the one specified with @setfilename ...\n      infile=`echo \"$*\" | sed 's/.* \\([^ ]*\\) *$/\\1/'`\n      file=`sed -n '/^@setfilename/ { s/.* \\([^ ]*\\) *$/\\1/; p; q; }' $infile`\n      # ... or it is derived from the source name (dir/f.texi becomes f.info)\n      test -z \"$file\" && file=`echo \"$infile\" | sed 's,.*/,,;s,.[^.]*$,,'`.info\n    fi\n    # If the file does not exist, the user really needs makeinfo;\n    # let's fail without touching anything.\n    test -f $file || exit 1\n    touch $file\n    ;;\n\n  tar)\n    shift\n\n    # We have already tried tar in the generic part.\n    # Look for gnutar/gtar before invocation to avoid ugly error\n    # messages.\n    if (gnutar --version > /dev/null 2>&1); then\n       gnutar \"$@\" && exit 0\n    fi\n    if (gtar --version > /dev/null 2>&1); then\n       gtar \"$@\" && exit 0\n    fi\n    firstarg=\"$1\"\n    if shift; then\n\tcase \"$firstarg\" in\n\t*o*)\n\t    firstarg=`echo \"$firstarg\" | sed s/o//`\n\t    tar \"$firstarg\" \"$@\" && exit 0\n\t    ;;\n\tesac\n\tcase \"$firstarg\" in\n\t*h*)\n\t    firstarg=`echo \"$firstarg\" | sed s/h//`\n\t    tar \"$firstarg\" \"$@\" && exit 0\n\t    ;;\n\tesac\n    fi\n\n    echo 1>&2 \"\\\nWARNING: I can't seem to be able to run \\`tar' with the given arguments.\n         You may want to install GNU tar or Free paxutils, or check the\n         command line arguments.\"\n    exit 1\n    ;;\n\n  *)\n    echo 1>&2 \"\\\nWARNING: \\`$1' is needed, and is $msg.\n         You might have modified some files without having the\n         proper tools for further handling them.  Check the \\`README' file,\n         it often tells you about the needed prerequisites for installing\n         this package.  You may also peek at any GNU archive site, in case\n         some other package would contain this missing \\`$1' program.\"\n    exit 1\n    ;;\nesac\n\nexit 0\n\n# Local variables:\n# eval: (add-hook 'write-file-hooks 'time-stamp)\n# time-stamp-start: \"scriptversion=\"\n# time-stamp-format: \"%:y-%02m-%02d.%02H\"\n# time-stamp-end: \"$\"\n# End:\n"
  },
  {
    "path": "src/main/jni/tiff/config/mkinstalldirs",
    "content": "#! /bin/sh\n# mkinstalldirs --- make directory hierarchy\n\nscriptversion=2005-06-29.22\n\n# Original author: Noah Friedman <friedman@prep.ai.mit.edu>\n# Created: 1993-05-16\n# Public domain.\n#\n# This file is maintained in Automake, please report\n# bugs to <bug-automake@gnu.org> or send patches to\n# <automake-patches@gnu.org>.\n\nerrstatus=0\ndirmode=\n\nusage=\"\\\nUsage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ...\n\nCreate each directory DIR (with mode MODE, if specified), including all\nleading file name components.\n\nReport bugs to <bug-automake@gnu.org>.\"\n\n# process command line arguments\nwhile test $# -gt 0 ; do\n  case $1 in\n    -h | --help | --h*)         # -h for help\n      echo \"$usage\"\n      exit $?\n      ;;\n    -m)                         # -m PERM arg\n      shift\n      test $# -eq 0 && { echo \"$usage\" 1>&2; exit 1; }\n      dirmode=$1\n      shift\n      ;;\n    --version)\n      echo \"$0 $scriptversion\"\n      exit $?\n      ;;\n    --)                         # stop option processing\n      shift\n      break\n      ;;\n    -*)                         # unknown option\n      echo \"$usage\" 1>&2\n      exit 1\n      ;;\n    *)                          # first non-opt arg\n      break\n      ;;\n  esac\ndone\n\nfor file\ndo\n  if test -d \"$file\"; then\n    shift\n  else\n    break\n  fi\ndone\n\ncase $# in\n  0) exit 0 ;;\nesac\n\n# Solaris 8's mkdir -p isn't thread-safe.  If you mkdir -p a/b and\n# mkdir -p a/c at the same time, both will detect that a is missing,\n# one will create a, then the other will try to create a and die with\n# a \"File exists\" error.  This is a problem when calling mkinstalldirs\n# from a parallel make.  We use --version in the probe to restrict\n# ourselves to GNU mkdir, which is thread-safe.\ncase $dirmode in\n  '')\n    if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then\n      echo \"mkdir -p -- $*\"\n      exec mkdir -p -- \"$@\"\n    else\n      # On NextStep and OpenStep, the `mkdir' command does not\n      # recognize any option.  It will interpret all options as\n      # directories to create, and then abort because `.' already\n      # exists.\n      test -d ./-p && rmdir ./-p\n      test -d ./--version && rmdir ./--version\n    fi\n    ;;\n  *)\n    if mkdir -m \"$dirmode\" -p --version . >/dev/null 2>&1 &&\n       test ! -d ./--version; then\n      echo \"mkdir -m $dirmode -p -- $*\"\n      exec mkdir -m \"$dirmode\" -p -- \"$@\"\n    else\n      # Clean up after NextStep and OpenStep mkdir.\n      for d in ./-m ./-p ./--version \"./$dirmode\";\n      do\n        test -d $d && rmdir $d\n      done\n    fi\n    ;;\nesac\n\nfor file\ndo\n  case $file in\n    /*) pathcomp=/ ;;\n    *)  pathcomp= ;;\n  esac\n  oIFS=$IFS\n  IFS=/\n  set fnord $file\n  shift\n  IFS=$oIFS\n\n  for d\n  do\n    test \"x$d\" = x && continue\n\n    pathcomp=$pathcomp$d\n    case $pathcomp in\n      -*) pathcomp=./$pathcomp ;;\n    esac\n\n    if test ! -d \"$pathcomp\"; then\n      echo \"mkdir $pathcomp\"\n\n      mkdir \"$pathcomp\" || lasterr=$?\n\n      if test ! -d \"$pathcomp\"; then\n\terrstatus=$lasterr\n      else\n\tif test ! -z \"$dirmode\"; then\n\t  echo \"chmod $dirmode $pathcomp\"\n\t  lasterr=\n\t  chmod \"$dirmode\" \"$pathcomp\" || lasterr=$?\n\n\t  if test ! -z \"$lasterr\"; then\n\t    errstatus=$lasterr\n\t  fi\n\tfi\n      fi\n    fi\n\n    pathcomp=$pathcomp/\n  done\ndone\n\nexit $errstatus\n\n# Local Variables:\n# mode: shell-script\n# sh-indentation: 2\n# eval: (add-hook 'write-file-hooks 'time-stamp)\n# time-stamp-start: \"scriptversion=\"\n# time-stamp-format: \"%:y-%02m-%02d.%02H\"\n# time-stamp-end: \"$\"\n# End:\n"
  },
  {
    "path": "src/main/jni/tiff/configure",
    "content": "#! /bin/sh\n# Guess values for system-dependent variables and create Makefiles.\n# Generated by GNU Autoconf 2.64 for LibTIFF Software 3.9.2.\n#\n# Report bugs to <tiff@lists.maptools.org>.\n#\n# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,\n# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software\n# Foundation, Inc.\n#\n# This configure script is free software; the Free Software Foundation\n# gives unlimited permission to copy, distribute and modify it.\n## -------------------- ##\n## M4sh Initialization. ##\n## -------------------- ##\n\n# Be more Bourne compatible\nDUALCASE=1; export DUALCASE # for MKS sh\nif test -n \"${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :\n  emulate sh\n  NULLCMD=:\n  # Pre-4.2 versions of Zsh do word splitting on ${1+\"$@\"}, which\n  # is contrary to our usage.  Disable this feature.\n  alias -g '${1+\"$@\"}'='\"$@\"'\n  setopt NO_GLOB_SUBST\nelse\n  case `(set -o) 2>/dev/null` in #(\n  *posix*) :\n    set -o posix ;; #(\n  *) :\n     ;;\nesac\nfi\n\n\nas_nl='\n'\nexport as_nl\n# Printing a long string crashes Solaris 7 /usr/bin/printf.\nas_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'\nas_echo=$as_echo$as_echo$as_echo$as_echo$as_echo\nas_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo\n# Prefer a ksh shell builtin over an external printf program on Solaris,\n# but without wasting forks for bash or zsh.\nif test -z \"$BASH_VERSION$ZSH_VERSION\" \\\n    && (test \"X`print -r -- $as_echo`\" = \"X$as_echo\") 2>/dev/null; then\n  as_echo='print -r --'\n  as_echo_n='print -rn --'\nelif (test \"X`printf %s $as_echo`\" = \"X$as_echo\") 2>/dev/null; then\n  as_echo='printf %s\\n'\n  as_echo_n='printf %s'\nelse\n  if test \"X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`\" = \"X-n $as_echo\"; then\n    as_echo_body='eval /usr/ucb/echo -n \"$1$as_nl\"'\n    as_echo_n='/usr/ucb/echo -n'\n  else\n    as_echo_body='eval expr \"X$1\" : \"X\\\\(.*\\\\)\"'\n    as_echo_n_body='eval\n      arg=$1;\n      case $arg in #(\n      *\"$as_nl\"*)\n\texpr \"X$arg\" : \"X\\\\(.*\\\\)$as_nl\";\n\targ=`expr \"X$arg\" : \".*$as_nl\\\\(.*\\\\)\"`;;\n      esac;\n      expr \"X$arg\" : \"X\\\\(.*\\\\)\" | tr -d \"$as_nl\"\n    '\n    export as_echo_n_body\n    as_echo_n='sh -c $as_echo_n_body as_echo'\n  fi\n  export as_echo_body\n  as_echo='sh -c $as_echo_body as_echo'\nfi\n\n# The user is always right.\nif test \"${PATH_SEPARATOR+set}\" != set; then\n  PATH_SEPARATOR=:\n  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {\n    (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||\n      PATH_SEPARATOR=';'\n  }\nfi\n\n\n# IFS\n# We need space, tab and new line, in precisely that order.  Quoting is\n# there to prevent editors from complaining about space-tab.\n# (If _AS_PATH_WALK were called with IFS unset, it would disable word\n# splitting by setting IFS to empty value.)\nIFS=\" \"\"\t$as_nl\"\n\n# Find who we are.  Look in the path if we contain no directory separator.\ncase $0 in #((\n  *[\\\\/]* ) as_myself=$0 ;;\n  *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    test -r \"$as_dir/$0\" && as_myself=$as_dir/$0 && break\n  done\nIFS=$as_save_IFS\n\n     ;;\nesac\n# We did not find ourselves, most probably we were run as `sh COMMAND'\n# in which case we are not to be found in the path.\nif test \"x$as_myself\" = x; then\n  as_myself=$0\nfi\nif test ! -f \"$as_myself\"; then\n  $as_echo \"$as_myself: error: cannot find myself; rerun with an absolute file name\" >&2\n  exit 1\nfi\n\n# Unset variables that we do not need and which cause bugs (e.g. in\n# pre-3.0 UWIN ksh).  But do not cause bugs in bash 2.01; the \"|| exit 1\"\n# suppresses any \"Segmentation fault\" message there.  '((' could\n# trigger a bug in pdksh 5.2.14.\nfor as_var in BASH_ENV ENV MAIL MAILPATH\ndo eval test x\\${$as_var+set} = xset \\\n  && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :\ndone\nPS1='$ '\nPS2='> '\nPS4='+ '\n\n# NLS nuisances.\nLC_ALL=C\nexport LC_ALL\nLANGUAGE=C\nexport LANGUAGE\n\n# CDPATH.\n(unset CDPATH) >/dev/null 2>&1 && unset CDPATH\n\nif test \"x$CONFIG_SHELL\" = x; then\n  as_bourne_compatible=\"if test -n \\\"\\${ZSH_VERSION+set}\\\" && (emulate sh) >/dev/null 2>&1; then :\n  emulate sh\n  NULLCMD=:\n  # Pre-4.2 versions of Zsh do word splitting on \\${1+\\\"\\$@\\\"}, which\n  # is contrary to our usage.  Disable this feature.\n  alias -g '\\${1+\\\"\\$@\\\"}'='\\\"\\$@\\\"'\n  setopt NO_GLOB_SUBST\nelse\n  case \\`(set -o) 2>/dev/null\\` in #(\n  *posix*) :\n    set -o posix ;; #(\n  *) :\n     ;;\nesac\nfi\n\"\n  as_required=\"as_fn_return () { (exit \\$1); }\nas_fn_success () { as_fn_return 0; }\nas_fn_failure () { as_fn_return 1; }\nas_fn_ret_success () { return 0; }\nas_fn_ret_failure () { return 1; }\n\nexitcode=0\nas_fn_success || { exitcode=1; echo as_fn_success failed.; }\nas_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }\nas_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }\nas_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }\nif ( set x; as_fn_ret_success y && test x = \\\"\\$1\\\" ); then :\n\nelse\n  exitcode=1; echo positional parameters were not saved.\nfi\ntest x\\$exitcode = x0 || exit 1\"\n  as_suggested=\"  as_lineno_1=\";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested\" as_lineno_1a=\\$LINENO\n  as_lineno_2=\";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested\" as_lineno_2a=\\$LINENO\n  eval 'test \\\"x\\$as_lineno_1'\\$as_run'\\\" != \\\"x\\$as_lineno_2'\\$as_run'\\\" &&\n  test \\\"x\\`expr \\$as_lineno_1'\\$as_run' + 1\\`\\\" = \\\"x\\$as_lineno_2'\\$as_run'\\\"' || exit 1\ntest \\$(( 1 + 1 )) = 2 || exit 1\"\n  if (eval \"$as_required\") 2>/dev/null; then :\n  as_have_required=yes\nelse\n  as_have_required=no\nfi\n  if test x$as_have_required = xyes && (eval \"$as_suggested\") 2>/dev/null; then :\n\nelse\n  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nas_found=false\nfor as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n  as_found=:\n  case $as_dir in #(\n\t /*)\n\t   for as_base in sh bash ksh sh5; do\n\t     # Try only shells that exist, to save several forks.\n\t     as_shell=$as_dir/$as_base\n\t     if { test -f \"$as_shell\" || test -f \"$as_shell.exe\"; } &&\n\t\t    { $as_echo \"$as_bourne_compatible\"\"$as_required\" | as_run=a \"$as_shell\"; } 2>/dev/null; then :\n  CONFIG_SHELL=$as_shell as_have_required=yes\n\t\t   if { $as_echo \"$as_bourne_compatible\"\"$as_suggested\" | as_run=a \"$as_shell\"; } 2>/dev/null; then :\n  break 2\nfi\nfi\n\t   done;;\n       esac\n  as_found=false\ndone\n$as_found || { if { test -f \"$SHELL\" || test -f \"$SHELL.exe\"; } &&\n\t      { $as_echo \"$as_bourne_compatible\"\"$as_required\" | as_run=a \"$SHELL\"; } 2>/dev/null; then :\n  CONFIG_SHELL=$SHELL as_have_required=yes\nfi; }\nIFS=$as_save_IFS\n\n\n      if test \"x$CONFIG_SHELL\" != x; then :\n  # We cannot yet assume a decent shell, so we have to provide a\n\t# neutralization value for shells without unset; and this also\n\t# works around shells that cannot unset nonexistent variables.\n\tBASH_ENV=/dev/null\n\tENV=/dev/null\n\t(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV\n\texport CONFIG_SHELL\n\texec \"$CONFIG_SHELL\" \"$as_myself\" ${1+\"$@\"}\nfi\n\n    if test x$as_have_required = xno; then :\n  $as_echo \"$0: This script requires a shell more modern than all\"\n  $as_echo \"$0: the shells that I found on your system.\"\n  if test x${ZSH_VERSION+set} = xset ; then\n    $as_echo \"$0: In particular, zsh $ZSH_VERSION has bugs and should\"\n    $as_echo \"$0: be upgraded to zsh 4.3.4 or later.\"\n  else\n    $as_echo \"$0: Please tell bug-autoconf@gnu.org and\n$0: tiff@lists.maptools.org about your system, including\n$0: any error possibly output before this message. Then\n$0: install a modern shell, or manually run the script\n$0: under such a shell if you do have one.\"\n  fi\n  exit 1\nfi\nfi\nfi\nSHELL=${CONFIG_SHELL-/bin/sh}\nexport SHELL\n# Unset more variables known to interfere with behavior of common tools.\nCLICOLOR_FORCE= GREP_OPTIONS=\nunset CLICOLOR_FORCE GREP_OPTIONS\n\n## --------------------- ##\n## M4sh Shell Functions. ##\n## --------------------- ##\n# as_fn_unset VAR\n# ---------------\n# Portably unset VAR.\nas_fn_unset ()\n{\n  { eval $1=; unset $1;}\n}\nas_unset=as_fn_unset\n\n# as_fn_set_status STATUS\n# -----------------------\n# Set $? to STATUS, without forking.\nas_fn_set_status ()\n{\n  return $1\n} # as_fn_set_status\n\n# as_fn_exit STATUS\n# -----------------\n# Exit the shell with STATUS, even in a \"trap 0\" or \"set -e\" context.\nas_fn_exit ()\n{\n  set +e\n  as_fn_set_status $1\n  exit $1\n} # as_fn_exit\n\n# as_fn_mkdir_p\n# -------------\n# Create \"$as_dir\" as a directory, including parents if necessary.\nas_fn_mkdir_p ()\n{\n\n  case $as_dir in #(\n  -*) as_dir=./$as_dir;;\n  esac\n  test -d \"$as_dir\" || eval $as_mkdir_p || {\n    as_dirs=\n    while :; do\n      case $as_dir in #(\n      *\\'*) as_qdir=`$as_echo \"$as_dir\" | sed \"s/'/'\\\\\\\\\\\\\\\\''/g\"`;; #'(\n      *) as_qdir=$as_dir;;\n      esac\n      as_dirs=\"'$as_qdir' $as_dirs\"\n      as_dir=`$as_dirname -- \"$as_dir\" ||\n$as_expr X\"$as_dir\" : 'X\\(.*[^/]\\)//*[^/][^/]*/*$' \\| \\\n\t X\"$as_dir\" : 'X\\(//\\)[^/]' \\| \\\n\t X\"$as_dir\" : 'X\\(//\\)$' \\| \\\n\t X\"$as_dir\" : 'X\\(/\\)' \\| . 2>/dev/null ||\n$as_echo X\"$as_dir\" |\n    sed '/^X\\(.*[^/]\\)\\/\\/*[^/][^/]*\\/*$/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  /^X\\(\\/\\/\\)[^/].*/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  /^X\\(\\/\\/\\)$/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  /^X\\(\\/\\).*/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  s/.*/./; q'`\n      test -d \"$as_dir\" && break\n    done\n    test -z \"$as_dirs\" || eval \"mkdir $as_dirs\"\n  } || test -d \"$as_dir\" || as_fn_error \"cannot create directory $as_dir\"\n\n\n} # as_fn_mkdir_p\n# as_fn_append VAR VALUE\n# ----------------------\n# Append the text in VALUE to the end of the definition contained in VAR. Take\n# advantage of any shell optimizations that allow amortized linear growth over\n# repeated appends, instead of the typical quadratic growth present in naive\n# implementations.\nif (eval \"as_var=1; as_var+=2; test x\\$as_var = x12\") 2>/dev/null; then :\n  eval 'as_fn_append ()\n  {\n    eval $1+=\\$2\n  }'\nelse\n  as_fn_append ()\n  {\n    eval $1=\\$$1\\$2\n  }\nfi # as_fn_append\n\n# as_fn_arith ARG...\n# ------------------\n# Perform arithmetic evaluation on the ARGs, and store the result in the\n# global $as_val. Take advantage of shells that can avoid forks. The arguments\n# must be portable across $(()) and expr.\nif (eval \"test \\$(( 1 + 1 )) = 2\") 2>/dev/null; then :\n  eval 'as_fn_arith ()\n  {\n    as_val=$(( $* ))\n  }'\nelse\n  as_fn_arith ()\n  {\n    as_val=`expr \"$@\" || test $? -eq 1`\n  }\nfi # as_fn_arith\n\n\n# as_fn_error ERROR [LINENO LOG_FD]\n# ---------------------------------\n# Output \"`basename $0`: error: ERROR\" to stderr. If LINENO and LOG_FD are\n# provided, also output the error to LOG_FD, referencing LINENO. Then exit the\n# script with status $?, using 1 if that was 0.\nas_fn_error ()\n{\n  as_status=$?; test $as_status -eq 0 && as_status=1\n  if test \"$3\"; then\n    as_lineno=${as_lineno-\"$2\"} as_lineno_stack=as_lineno_stack=$as_lineno_stack\n    $as_echo \"$as_me:${as_lineno-$LINENO}: error: $1\" >&$3\n  fi\n  $as_echo \"$as_me: error: $1\" >&2\n  as_fn_exit $as_status\n} # as_fn_error\n\nif expr a : '\\(a\\)' >/dev/null 2>&1 &&\n   test \"X`expr 00001 : '.*\\(...\\)'`\" = X001; then\n  as_expr=expr\nelse\n  as_expr=false\nfi\n\nif (basename -- /) >/dev/null 2>&1 && test \"X`basename -- / 2>&1`\" = \"X/\"; then\n  as_basename=basename\nelse\n  as_basename=false\nfi\n\nif (as_dir=`dirname -- /` && test \"X$as_dir\" = X/) >/dev/null 2>&1; then\n  as_dirname=dirname\nelse\n  as_dirname=false\nfi\n\nas_me=`$as_basename -- \"$0\" ||\n$as_expr X/\"$0\" : '.*/\\([^/][^/]*\\)/*$' \\| \\\n\t X\"$0\" : 'X\\(//\\)$' \\| \\\n\t X\"$0\" : 'X\\(/\\)' \\| . 2>/dev/null ||\n$as_echo X/\"$0\" |\n    sed '/^.*\\/\\([^/][^/]*\\)\\/*$/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  /^X\\/\\(\\/\\/\\)$/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  /^X\\/\\(\\/\\).*/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  s/.*/./; q'`\n\n# Avoid depending upon Character Ranges.\nas_cr_letters='abcdefghijklmnopqrstuvwxyz'\nas_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'\nas_cr_Letters=$as_cr_letters$as_cr_LETTERS\nas_cr_digits='0123456789'\nas_cr_alnum=$as_cr_Letters$as_cr_digits\n\n\n  as_lineno_1=$LINENO as_lineno_1a=$LINENO\n  as_lineno_2=$LINENO as_lineno_2a=$LINENO\n  eval 'test \"x$as_lineno_1'$as_run'\" != \"x$as_lineno_2'$as_run'\" &&\n  test \"x`expr $as_lineno_1'$as_run' + 1`\" = \"x$as_lineno_2'$as_run'\"' || {\n  # Blame Lee E. McMahon (1931-1989) for sed's syntax.  :-)\n  sed -n '\n    p\n    /[$]LINENO/=\n  ' <$as_myself |\n    sed '\n      s/[$]LINENO.*/&-/\n      t lineno\n      b\n      :lineno\n      N\n      :loop\n      s/[$]LINENO\\([^'$as_cr_alnum'_].*\\n\\)\\(.*\\)/\\2\\1\\2/\n      t loop\n      s/-\\n.*//\n    ' >$as_me.lineno &&\n  chmod +x \"$as_me.lineno\" ||\n    { $as_echo \"$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell\" >&2; as_fn_exit 1; }\n\n  # Don't try to exec as it changes $[0], causing all sort of problems\n  # (the dirname of $[0] is not the place where we might find the\n  # original and so on.  Autoconf is especially sensitive to this).\n  . \"./$as_me.lineno\"\n  # Exit status is that of the last command.\n  exit\n}\n\nECHO_C= ECHO_N= ECHO_T=\ncase `echo -n x` in #(((((\n-n*)\n  case `echo 'xy\\c'` in\n  *c*) ECHO_T='\t';;\t# ECHO_T is single tab character.\n  xy)  ECHO_C='\\c';;\n  *)   echo `echo ksh88 bug on AIX 6.1` > /dev/null\n       ECHO_T='\t';;\n  esac;;\n*)\n  ECHO_N='-n';;\nesac\n\nrm -f conf$$ conf$$.exe conf$$.file\nif test -d conf$$.dir; then\n  rm -f conf$$.dir/conf$$.file\nelse\n  rm -f conf$$.dir\n  mkdir conf$$.dir 2>/dev/null\nfi\nif (echo >conf$$.file) 2>/dev/null; then\n  if ln -s conf$$.file conf$$ 2>/dev/null; then\n    as_ln_s='ln -s'\n    # ... but there are two gotchas:\n    # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.\n    # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.\n    # In both cases, we have to default to `cp -p'.\n    ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||\n      as_ln_s='cp -p'\n  elif ln conf$$.file conf$$ 2>/dev/null; then\n    as_ln_s=ln\n  else\n    as_ln_s='cp -p'\n  fi\nelse\n  as_ln_s='cp -p'\nfi\nrm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file\nrmdir conf$$.dir 2>/dev/null\n\nif mkdir -p . 2>/dev/null; then\n  as_mkdir_p='mkdir -p \"$as_dir\"'\nelse\n  test -d ./-p && rmdir ./-p\n  as_mkdir_p=false\nfi\n\nif test -x / >/dev/null 2>&1; then\n  as_test_x='test -x'\nelse\n  if ls -dL / >/dev/null 2>&1; then\n    as_ls_L_option=L\n  else\n    as_ls_L_option=\n  fi\n  as_test_x='\n    eval sh -c '\\''\n      if test -d \"$1\"; then\n\ttest -d \"$1/.\";\n      else\n\tcase $1 in #(\n\t-*)set \"./$1\";;\n\tesac;\n\tcase `ls -ld'$as_ls_L_option' \"$1\" 2>/dev/null` in #((\n\t???[sx]*):;;*)false;;esac;fi\n    '\\'' sh\n  '\nfi\nas_executable_p=$as_test_x\n\n# Sed expression to map a string onto a valid CPP name.\nas_tr_cpp=\"eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'\"\n\n# Sed expression to map a string onto a valid variable name.\nas_tr_sh=\"eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'\"\n\n\n\n# Check that we are running under the correct shell.\nSHELL=${CONFIG_SHELL-/bin/sh}\n\ncase X$lt_ECHO in\nX*--fallback-echo)\n  # Remove one level of quotation (which was required for Make).\n  ECHO=`echo \"$lt_ECHO\" | sed 's,\\\\\\\\\\$\\\\$0,'$0','`\n  ;;\nesac\n\nECHO=${lt_ECHO-echo}\nif test \"X$1\" = X--no-reexec; then\n  # Discard the --no-reexec flag, and continue.\n  shift\nelif test \"X$1\" = X--fallback-echo; then\n  # Avoid inline document here, it may be left over\n  :\nelif test \"X`{ $ECHO '\\t'; } 2>/dev/null`\" = 'X\\t' ; then\n  # Yippee, $ECHO works!\n  :\nelse\n  # Restart under the correct shell.\n  exec $SHELL \"$0\" --no-reexec ${1+\"$@\"}\nfi\n\nif test \"X$1\" = X--fallback-echo; then\n  # used as fallback echo\n  shift\n  cat <<_LT_EOF\n$*\n_LT_EOF\n  exit 0\nfi\n\n# The HP-UX ksh and POSIX shell print the target directory to stdout\n# if CDPATH is set.\n(unset CDPATH) >/dev/null 2>&1 && unset CDPATH\n\nif test -z \"$lt_ECHO\"; then\n  if test \"X${echo_test_string+set}\" != Xset; then\n    # find a string as large as possible, as long as the shell can cope with it\n    for cmd in 'sed 50q \"$0\"' 'sed 20q \"$0\"' 'sed 10q \"$0\"' 'sed 2q \"$0\"' 'echo test'; do\n      # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...\n      if { echo_test_string=`eval $cmd`; } 2>/dev/null &&\n\t { test \"X$echo_test_string\" = \"X$echo_test_string\"; } 2>/dev/null\n      then\n        break\n      fi\n    done\n  fi\n\n  if test \"X`{ $ECHO '\\t'; } 2>/dev/null`\" = 'X\\t' &&\n     echo_testing_string=`{ $ECHO \"$echo_test_string\"; } 2>/dev/null` &&\n     test \"X$echo_testing_string\" = \"X$echo_test_string\"; then\n    :\n  else\n    # The Solaris, AIX, and Digital Unix default echo programs unquote\n    # backslashes.  This makes it impossible to quote backslashes using\n    #   echo \"$something\" | sed 's/\\\\/\\\\\\\\/g'\n    #\n    # So, first we look for a working echo in the user's PATH.\n\n    lt_save_ifs=\"$IFS\"; IFS=$PATH_SEPARATOR\n    for dir in $PATH /usr/ucb; do\n      IFS=\"$lt_save_ifs\"\n      if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&\n         test \"X`($dir/echo '\\t') 2>/dev/null`\" = 'X\\t' &&\n         echo_testing_string=`($dir/echo \"$echo_test_string\") 2>/dev/null` &&\n         test \"X$echo_testing_string\" = \"X$echo_test_string\"; then\n        ECHO=\"$dir/echo\"\n        break\n      fi\n    done\n    IFS=\"$lt_save_ifs\"\n\n    if test \"X$ECHO\" = Xecho; then\n      # We didn't find a better echo, so look for alternatives.\n      if test \"X`{ print -r '\\t'; } 2>/dev/null`\" = 'X\\t' &&\n         echo_testing_string=`{ print -r \"$echo_test_string\"; } 2>/dev/null` &&\n         test \"X$echo_testing_string\" = \"X$echo_test_string\"; then\n        # This shell has a builtin print -r that does the trick.\n        ECHO='print -r'\n      elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } &&\n\t   test \"X$CONFIG_SHELL\" != X/bin/ksh; then\n        # If we have ksh, try running configure again with it.\n        ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}\n        export ORIGINAL_CONFIG_SHELL\n        CONFIG_SHELL=/bin/ksh\n        export CONFIG_SHELL\n        exec $CONFIG_SHELL \"$0\" --no-reexec ${1+\"$@\"}\n      else\n        # Try using printf.\n        ECHO='printf %s\\n'\n        if test \"X`{ $ECHO '\\t'; } 2>/dev/null`\" = 'X\\t' &&\n\t   echo_testing_string=`{ $ECHO \"$echo_test_string\"; } 2>/dev/null` &&\n\t   test \"X$echo_testing_string\" = \"X$echo_test_string\"; then\n\t  # Cool, printf works\n\t  :\n        elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL \"$0\" --fallback-echo '\\t') 2>/dev/null` &&\n\t     test \"X$echo_testing_string\" = 'X\\t' &&\n\t     echo_testing_string=`($ORIGINAL_CONFIG_SHELL \"$0\" --fallback-echo \"$echo_test_string\") 2>/dev/null` &&\n\t     test \"X$echo_testing_string\" = \"X$echo_test_string\"; then\n\t  CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL\n\t  export CONFIG_SHELL\n\t  SHELL=\"$CONFIG_SHELL\"\n\t  export SHELL\n\t  ECHO=\"$CONFIG_SHELL $0 --fallback-echo\"\n        elif echo_testing_string=`($CONFIG_SHELL \"$0\" --fallback-echo '\\t') 2>/dev/null` &&\n\t     test \"X$echo_testing_string\" = 'X\\t' &&\n\t     echo_testing_string=`($CONFIG_SHELL \"$0\" --fallback-echo \"$echo_test_string\") 2>/dev/null` &&\n\t     test \"X$echo_testing_string\" = \"X$echo_test_string\"; then\n\t  ECHO=\"$CONFIG_SHELL $0 --fallback-echo\"\n        else\n\t  # maybe with a smaller string...\n\t  prev=:\n\n\t  for cmd in 'echo test' 'sed 2q \"$0\"' 'sed 10q \"$0\"' 'sed 20q \"$0\"' 'sed 50q \"$0\"'; do\n\t    if { test \"X$echo_test_string\" = \"X`eval $cmd`\"; } 2>/dev/null\n\t    then\n\t      break\n\t    fi\n\t    prev=\"$cmd\"\n\t  done\n\n\t  if test \"$prev\" != 'sed 50q \"$0\"'; then\n\t    echo_test_string=`eval $prev`\n\t    export echo_test_string\n\t    exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} \"$0\" ${1+\"$@\"}\n\t  else\n\t    # Oops.  We lost completely, so just stick with echo.\n\t    ECHO=echo\n\t  fi\n        fi\n      fi\n    fi\n  fi\nfi\n\n# Copy echo and quote the copy suitably for passing to libtool from\n# the Makefile, instead of quoting the original, which is used later.\nlt_ECHO=$ECHO\nif test \"X$lt_ECHO\" = \"X$CONFIG_SHELL $0 --fallback-echo\"; then\n   lt_ECHO=\"$CONFIG_SHELL \\\\\\$\\$0 --fallback-echo\"\nfi\n\n\n\n\nexec 7<&0 </dev/null 6>&1\n\n# Name of the host.\n# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,\n# so uname gets run too.\nac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`\n\n#\n# Initializations.\n#\nac_default_prefix=/usr/local\nac_clean_files=\nac_config_libobj_dir=.\nLIBOBJS=\ncross_compiling=no\nsubdirs=\nMFLAGS=\nMAKEFLAGS=\n\n# Identity of this package.\nPACKAGE_NAME='LibTIFF Software'\nPACKAGE_TARNAME='tiff'\nPACKAGE_VERSION='3.9.2'\nPACKAGE_STRING='LibTIFF Software 3.9.2'\nPACKAGE_BUGREPORT='tiff@lists.maptools.org'\nPACKAGE_URL=''\n\n# Factoring default headers for most tests.\nac_includes_default=\"\\\n#include <stdio.h>\n#ifdef HAVE_SYS_TYPES_H\n# include <sys/types.h>\n#endif\n#ifdef HAVE_SYS_STAT_H\n# include <sys/stat.h>\n#endif\n#ifdef STDC_HEADERS\n# include <stdlib.h>\n# include <stddef.h>\n#else\n# ifdef HAVE_STDLIB_H\n#  include <stdlib.h>\n# endif\n#endif\n#ifdef HAVE_STRING_H\n# if !defined STDC_HEADERS && defined HAVE_MEMORY_H\n#  include <memory.h>\n# endif\n# include <string.h>\n#endif\n#ifdef HAVE_STRINGS_H\n# include <strings.h>\n#endif\n#ifdef HAVE_INTTYPES_H\n# include <inttypes.h>\n#endif\n#ifdef HAVE_STDINT_H\n# include <stdint.h>\n#endif\n#ifdef HAVE_UNISTD_H\n# include <unistd.h>\n#endif\"\n\nac_subst_vars='am__EXEEXT_FALSE\nam__EXEEXT_TRUE\nLTLIBOBJS\nLIBDIR\nHAVE_OPENGL_FALSE\nHAVE_OPENGL_TRUE\nGLUT_LIBS\nGLUT_CFLAGS\nGLU_LIBS\nGLU_CFLAGS\nGL_LIBS\nGL_CFLAGS\nPTHREAD_CFLAGS\nPTHREAD_LIBS\nPTHREAD_CC\nacx_pthread_config\nX_EXTRA_LIBS\nX_LIBS\nX_PRE_LIBS\nX_CFLAGS\nXMKMF\nHAVE_CXX_FALSE\nHAVE_CXX_TRUE\nLIBTIFF_DOCDIR\nHAVE_RPATH_FALSE\nHAVE_RPATH_TRUE\nLIBOBJS\nAM_BACKSLASH\nAM_DEFAULT_VERBOSITY\nCXXCPP\nam__fastdepCXX_FALSE\nam__fastdepCXX_TRUE\nCXXDEPMODE\nac_ct_CXX\nCXXFLAGS\nCXX\nOTOOL64\nOTOOL\nLIPO\nNMEDIT\nDSYMUTIL\nlt_ECHO\nRANLIB\nAR\nNM\nac_ct_DUMPBIN\nDUMPBIN\nLIBTOOL\nOBJDUMP\nDLLTOOL\nAS\nLN_S\nLD\nFGREP\nEGREP\nGREP\nSED\nCPP\nam__fastdepCC_FALSE\nam__fastdepCC_TRUE\nCCDEPMODE\nAMDEPBACKSLASH\nAMDEP_FALSE\nAMDEP_TRUE\nam__quote\nam__include\nDEPDIR\nOBJEXT\nEXEEXT\nac_ct_CC\nCPPFLAGS\nLDFLAGS\nCFLAGS\nCC\nLIBTIFF_RELEASE_DATE\nLIBTIFF_VERSION_INFO\nLIBTIFF_VERSION\nLIBTIFF_ALPHA_VERSION\nLIBTIFF_MICRO_VERSION\nLIBTIFF_MINOR_VERSION\nLIBTIFF_MAJOR_VERSION\nMAINT\nMAINTAINER_MODE_FALSE\nMAINTAINER_MODE_TRUE\nam__untar\nam__tar\nAMTAR\nam__leading_dot\nSET_MAKE\nAWK\nmkdir_p\nMKDIR_P\nINSTALL_STRIP_PROGRAM\nSTRIP\ninstall_sh\nMAKEINFO\nAUTOHEADER\nAUTOMAKE\nAUTOCONF\nACLOCAL\nVERSION\nPACKAGE\nCYGPATH_W\nam__isrc\nINSTALL_DATA\nINSTALL_SCRIPT\nINSTALL_PROGRAM\ntarget_os\ntarget_vendor\ntarget_cpu\ntarget\nhost_os\nhost_vendor\nhost_cpu\nhost\nbuild_os\nbuild_vendor\nbuild_cpu\nbuild\ntarget_alias\nhost_alias\nbuild_alias\nLIBS\nECHO_T\nECHO_N\nECHO_C\nDEFS\nmandir\nlocaledir\nlibdir\npsdir\npdfdir\ndvidir\nhtmldir\ninfodir\ndocdir\noldincludedir\nincludedir\nlocalstatedir\nsharedstatedir\nsysconfdir\ndatadir\ndatarootdir\nlibexecdir\nsbindir\nbindir\nprogram_transform_name\nprefix\nexec_prefix\nPACKAGE_URL\nPACKAGE_BUGREPORT\nPACKAGE_STRING\nPACKAGE_VERSION\nPACKAGE_TARNAME\nPACKAGE_NAME\nPATH_SEPARATOR\nSHELL'\nac_subst_files=''\nac_user_opts='\nenable_option_checking\nenable_maintainer_mode\nenable_dependency_tracking\nwith_gnu_ld\nenable_shared\nenable_static\nwith_pic\nenable_fast_install\nenable_libtool_lock\nenable_silent_rules\nenable_rpath\nenable_largefile\nwith_docdir\nenable_ccitt\nenable_packbits\nenable_lzw\nenable_thunder\nenable_next\nenable_logluv\nenable_mdi\nenable_zlib\nwith_zlib_include_dir\nwith_zlib_lib_dir\nenable_pixarlog\nenable_jpeg\nwith_jpeg_include_dir\nwith_jpeg_lib_dir\nenable_old_jpeg\nenable_jbig\nwith_jbig_include_dir\nwith_jbig_lib_dir\nenable_cxx\nwith_x\nwith_apple_opengl_framework\nenable_strip_chopping\nwith_default_strip_size\nenable_extrasample_as_alpha\nenable_check_ycbcr_subsampling\n'\n      ac_precious_vars='build_alias\nhost_alias\ntarget_alias\nCC\nCFLAGS\nLDFLAGS\nLIBS\nCPPFLAGS\nCPP\nCXX\nCXXFLAGS\nCCC\nCXXCPP\nXMKMF'\n\n\n# Initialize some variables set by options.\nac_init_help=\nac_init_version=false\nac_unrecognized_opts=\nac_unrecognized_sep=\n# The variables have the same names as the options, with\n# dashes changed to underlines.\ncache_file=/dev/null\nexec_prefix=NONE\nno_create=\nno_recursion=\nprefix=NONE\nprogram_prefix=NONE\nprogram_suffix=NONE\nprogram_transform_name=s,x,x,\nsilent=\nsite=\nsrcdir=\nverbose=\nx_includes=NONE\nx_libraries=NONE\n\n# Installation directory options.\n# These are left unexpanded so users can \"make install exec_prefix=/foo\"\n# and all the variables that are supposed to be based on exec_prefix\n# by default will actually change.\n# Use braces instead of parens because sh, perl, etc. also accept them.\n# (The list follows the same order as the GNU Coding Standards.)\nbindir='${exec_prefix}/bin'\nsbindir='${exec_prefix}/sbin'\nlibexecdir='${exec_prefix}/libexec'\ndatarootdir='${prefix}/share'\ndatadir='${datarootdir}'\nsysconfdir='${prefix}/etc'\nsharedstatedir='${prefix}/com'\nlocalstatedir='${prefix}/var'\nincludedir='${prefix}/include'\noldincludedir='/usr/include'\ndocdir='${datarootdir}/doc/${PACKAGE_TARNAME}'\ninfodir='${datarootdir}/info'\nhtmldir='${docdir}'\ndvidir='${docdir}'\npdfdir='${docdir}'\npsdir='${docdir}'\nlibdir='${exec_prefix}/lib'\nlocaledir='${datarootdir}/locale'\nmandir='${datarootdir}/man'\n\nac_prev=\nac_dashdash=\nfor ac_option\ndo\n  # If the previous option needs an argument, assign it.\n  if test -n \"$ac_prev\"; then\n    eval $ac_prev=\\$ac_option\n    ac_prev=\n    continue\n  fi\n\n  case $ac_option in\n  *=*)\tac_optarg=`expr \"X$ac_option\" : '[^=]*=\\(.*\\)'` ;;\n  *)\tac_optarg=yes ;;\n  esac\n\n  # Accept the important Cygnus configure options, so we can diagnose typos.\n\n  case $ac_dashdash$ac_option in\n  --)\n    ac_dashdash=yes ;;\n\n  -bindir | --bindir | --bindi | --bind | --bin | --bi)\n    ac_prev=bindir ;;\n  -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)\n    bindir=$ac_optarg ;;\n\n  -build | --build | --buil | --bui | --bu)\n    ac_prev=build_alias ;;\n  -build=* | --build=* | --buil=* | --bui=* | --bu=*)\n    build_alias=$ac_optarg ;;\n\n  -cache-file | --cache-file | --cache-fil | --cache-fi \\\n  | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)\n    ac_prev=cache_file ;;\n  -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \\\n  | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)\n    cache_file=$ac_optarg ;;\n\n  --config-cache | -C)\n    cache_file=config.cache ;;\n\n  -datadir | --datadir | --datadi | --datad)\n    ac_prev=datadir ;;\n  -datadir=* | --datadir=* | --datadi=* | --datad=*)\n    datadir=$ac_optarg ;;\n\n  -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \\\n  | --dataroo | --dataro | --datar)\n    ac_prev=datarootdir ;;\n  -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \\\n  | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)\n    datarootdir=$ac_optarg ;;\n\n  -disable-* | --disable-*)\n    ac_useropt=`expr \"x$ac_option\" : 'x-*disable-\\(.*\\)'`\n    # Reject names that are not valid shell variable names.\n    expr \"x$ac_useropt\" : \".*[^-+._$as_cr_alnum]\" >/dev/null &&\n      as_fn_error \"invalid feature name: $ac_useropt\"\n    ac_useropt_orig=$ac_useropt\n    ac_useropt=`$as_echo \"$ac_useropt\" | sed 's/[-+.]/_/g'`\n    case $ac_user_opts in\n      *\"\n\"enable_$ac_useropt\"\n\"*) ;;\n      *) ac_unrecognized_opts=\"$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig\"\n\t ac_unrecognized_sep=', ';;\n    esac\n    eval enable_$ac_useropt=no ;;\n\n  -docdir | --docdir | --docdi | --doc | --do)\n    ac_prev=docdir ;;\n  -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)\n    docdir=$ac_optarg ;;\n\n  -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)\n    ac_prev=dvidir ;;\n  -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)\n    dvidir=$ac_optarg ;;\n\n  -enable-* | --enable-*)\n    ac_useropt=`expr \"x$ac_option\" : 'x-*enable-\\([^=]*\\)'`\n    # Reject names that are not valid shell variable names.\n    expr \"x$ac_useropt\" : \".*[^-+._$as_cr_alnum]\" >/dev/null &&\n      as_fn_error \"invalid feature name: $ac_useropt\"\n    ac_useropt_orig=$ac_useropt\n    ac_useropt=`$as_echo \"$ac_useropt\" | sed 's/[-+.]/_/g'`\n    case $ac_user_opts in\n      *\"\n\"enable_$ac_useropt\"\n\"*) ;;\n      *) ac_unrecognized_opts=\"$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig\"\n\t ac_unrecognized_sep=', ';;\n    esac\n    eval enable_$ac_useropt=\\$ac_optarg ;;\n\n  -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \\\n  | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \\\n  | --exec | --exe | --ex)\n    ac_prev=exec_prefix ;;\n  -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \\\n  | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \\\n  | --exec=* | --exe=* | --ex=*)\n    exec_prefix=$ac_optarg ;;\n\n  -gas | --gas | --ga | --g)\n    # Obsolete; use --with-gas.\n    with_gas=yes ;;\n\n  -help | --help | --hel | --he | -h)\n    ac_init_help=long ;;\n  -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)\n    ac_init_help=recursive ;;\n  -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)\n    ac_init_help=short ;;\n\n  -host | --host | --hos | --ho)\n    ac_prev=host_alias ;;\n  -host=* | --host=* | --hos=* | --ho=*)\n    host_alias=$ac_optarg ;;\n\n  -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)\n    ac_prev=htmldir ;;\n  -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \\\n  | --ht=*)\n    htmldir=$ac_optarg ;;\n\n  -includedir | --includedir | --includedi | --included | --include \\\n  | --includ | --inclu | --incl | --inc)\n    ac_prev=includedir ;;\n  -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \\\n  | --includ=* | --inclu=* | --incl=* | --inc=*)\n    includedir=$ac_optarg ;;\n\n  -infodir | --infodir | --infodi | --infod | --info | --inf)\n    ac_prev=infodir ;;\n  -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)\n    infodir=$ac_optarg ;;\n\n  -libdir | --libdir | --libdi | --libd)\n    ac_prev=libdir ;;\n  -libdir=* | --libdir=* | --libdi=* | --libd=*)\n    libdir=$ac_optarg ;;\n\n  -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \\\n  | --libexe | --libex | --libe)\n    ac_prev=libexecdir ;;\n  -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \\\n  | --libexe=* | --libex=* | --libe=*)\n    libexecdir=$ac_optarg ;;\n\n  -localedir | --localedir | --localedi | --localed | --locale)\n    ac_prev=localedir ;;\n  -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)\n    localedir=$ac_optarg ;;\n\n  -localstatedir | --localstatedir | --localstatedi | --localstated \\\n  | --localstate | --localstat | --localsta | --localst | --locals)\n    ac_prev=localstatedir ;;\n  -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \\\n  | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)\n    localstatedir=$ac_optarg ;;\n\n  -mandir | --mandir | --mandi | --mand | --man | --ma | --m)\n    ac_prev=mandir ;;\n  -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)\n    mandir=$ac_optarg ;;\n\n  -nfp | --nfp | --nf)\n    # Obsolete; use --without-fp.\n    with_fp=no ;;\n\n  -no-create | --no-create | --no-creat | --no-crea | --no-cre \\\n  | --no-cr | --no-c | -n)\n    no_create=yes ;;\n\n  -no-recursion | --no-recursion | --no-recursio | --no-recursi \\\n  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)\n    no_recursion=yes ;;\n\n  -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \\\n  | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \\\n  | --oldin | --oldi | --old | --ol | --o)\n    ac_prev=oldincludedir ;;\n  -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \\\n  | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \\\n  | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)\n    oldincludedir=$ac_optarg ;;\n\n  -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)\n    ac_prev=prefix ;;\n  -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)\n    prefix=$ac_optarg ;;\n\n  -program-prefix | --program-prefix | --program-prefi | --program-pref \\\n  | --program-pre | --program-pr | --program-p)\n    ac_prev=program_prefix ;;\n  -program-prefix=* | --program-prefix=* | --program-prefi=* \\\n  | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)\n    program_prefix=$ac_optarg ;;\n\n  -program-suffix | --program-suffix | --program-suffi | --program-suff \\\n  | --program-suf | --program-su | --program-s)\n    ac_prev=program_suffix ;;\n  -program-suffix=* | --program-suffix=* | --program-suffi=* \\\n  | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)\n    program_suffix=$ac_optarg ;;\n\n  -program-transform-name | --program-transform-name \\\n  | --program-transform-nam | --program-transform-na \\\n  | --program-transform-n | --program-transform- \\\n  | --program-transform | --program-transfor \\\n  | --program-transfo | --program-transf \\\n  | --program-trans | --program-tran \\\n  | --progr-tra | --program-tr | --program-t)\n    ac_prev=program_transform_name ;;\n  -program-transform-name=* | --program-transform-name=* \\\n  | --program-transform-nam=* | --program-transform-na=* \\\n  | --program-transform-n=* | --program-transform-=* \\\n  | --program-transform=* | --program-transfor=* \\\n  | --program-transfo=* | --program-transf=* \\\n  | --program-trans=* | --program-tran=* \\\n  | --progr-tra=* | --program-tr=* | --program-t=*)\n    program_transform_name=$ac_optarg ;;\n\n  -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)\n    ac_prev=pdfdir ;;\n  -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)\n    pdfdir=$ac_optarg ;;\n\n  -psdir | --psdir | --psdi | --psd | --ps)\n    ac_prev=psdir ;;\n  -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)\n    psdir=$ac_optarg ;;\n\n  -q | -quiet | --quiet | --quie | --qui | --qu | --q \\\n  | -silent | --silent | --silen | --sile | --sil)\n    silent=yes ;;\n\n  -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)\n    ac_prev=sbindir ;;\n  -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \\\n  | --sbi=* | --sb=*)\n    sbindir=$ac_optarg ;;\n\n  -sharedstatedir | --sharedstatedir | --sharedstatedi \\\n  | --sharedstated | --sharedstate | --sharedstat | --sharedsta \\\n  | --sharedst | --shareds | --shared | --share | --shar \\\n  | --sha | --sh)\n    ac_prev=sharedstatedir ;;\n  -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \\\n  | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \\\n  | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \\\n  | --sha=* | --sh=*)\n    sharedstatedir=$ac_optarg ;;\n\n  -site | --site | --sit)\n    ac_prev=site ;;\n  -site=* | --site=* | --sit=*)\n    site=$ac_optarg ;;\n\n  -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)\n    ac_prev=srcdir ;;\n  -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)\n    srcdir=$ac_optarg ;;\n\n  -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \\\n  | --syscon | --sysco | --sysc | --sys | --sy)\n    ac_prev=sysconfdir ;;\n  -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \\\n  | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)\n    sysconfdir=$ac_optarg ;;\n\n  -target | --target | --targe | --targ | --tar | --ta | --t)\n    ac_prev=target_alias ;;\n  -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)\n    target_alias=$ac_optarg ;;\n\n  -v | -verbose | --verbose | --verbos | --verbo | --verb)\n    verbose=yes ;;\n\n  -version | --version | --versio | --versi | --vers | -V)\n    ac_init_version=: ;;\n\n  -with-* | --with-*)\n    ac_useropt=`expr \"x$ac_option\" : 'x-*with-\\([^=]*\\)'`\n    # Reject names that are not valid shell variable names.\n    expr \"x$ac_useropt\" : \".*[^-+._$as_cr_alnum]\" >/dev/null &&\n      as_fn_error \"invalid package name: $ac_useropt\"\n    ac_useropt_orig=$ac_useropt\n    ac_useropt=`$as_echo \"$ac_useropt\" | sed 's/[-+.]/_/g'`\n    case $ac_user_opts in\n      *\"\n\"with_$ac_useropt\"\n\"*) ;;\n      *) ac_unrecognized_opts=\"$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig\"\n\t ac_unrecognized_sep=', ';;\n    esac\n    eval with_$ac_useropt=\\$ac_optarg ;;\n\n  -without-* | --without-*)\n    ac_useropt=`expr \"x$ac_option\" : 'x-*without-\\(.*\\)'`\n    # Reject names that are not valid shell variable names.\n    expr \"x$ac_useropt\" : \".*[^-+._$as_cr_alnum]\" >/dev/null &&\n      as_fn_error \"invalid package name: $ac_useropt\"\n    ac_useropt_orig=$ac_useropt\n    ac_useropt=`$as_echo \"$ac_useropt\" | sed 's/[-+.]/_/g'`\n    case $ac_user_opts in\n      *\"\n\"with_$ac_useropt\"\n\"*) ;;\n      *) ac_unrecognized_opts=\"$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig\"\n\t ac_unrecognized_sep=', ';;\n    esac\n    eval with_$ac_useropt=no ;;\n\n  --x)\n    # Obsolete; use --with-x.\n    with_x=yes ;;\n\n  -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \\\n  | --x-incl | --x-inc | --x-in | --x-i)\n    ac_prev=x_includes ;;\n  -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \\\n  | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)\n    x_includes=$ac_optarg ;;\n\n  -x-libraries | --x-libraries | --x-librarie | --x-librari \\\n  | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)\n    ac_prev=x_libraries ;;\n  -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \\\n  | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)\n    x_libraries=$ac_optarg ;;\n\n  -*) as_fn_error \"unrecognized option: \\`$ac_option'\nTry \\`$0 --help' for more information.\"\n    ;;\n\n  *=*)\n    ac_envvar=`expr \"x$ac_option\" : 'x\\([^=]*\\)='`\n    # Reject names that are not valid shell variable names.\n    case $ac_envvar in #(\n      '' | [0-9]* | *[!_$as_cr_alnum]* )\n      as_fn_error \"invalid variable name: \\`$ac_envvar'\" ;;\n    esac\n    eval $ac_envvar=\\$ac_optarg\n    export $ac_envvar ;;\n\n  *)\n    # FIXME: should be removed in autoconf 3.0.\n    $as_echo \"$as_me: WARNING: you should use --build, --host, --target\" >&2\n    expr \"x$ac_option\" : \".*[^-._$as_cr_alnum]\" >/dev/null &&\n      $as_echo \"$as_me: WARNING: invalid host type: $ac_option\" >&2\n    : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}\n    ;;\n\n  esac\ndone\n\nif test -n \"$ac_prev\"; then\n  ac_option=--`echo $ac_prev | sed 's/_/-/g'`\n  as_fn_error \"missing argument to $ac_option\"\nfi\n\nif test -n \"$ac_unrecognized_opts\"; then\n  case $enable_option_checking in\n    no) ;;\n    fatal) as_fn_error \"unrecognized options: $ac_unrecognized_opts\" ;;\n    *)     $as_echo \"$as_me: WARNING: unrecognized options: $ac_unrecognized_opts\" >&2 ;;\n  esac\nfi\n\n# Check all directory arguments for consistency.\nfor ac_var in\texec_prefix prefix bindir sbindir libexecdir datarootdir \\\n\t\tdatadir sysconfdir sharedstatedir localstatedir includedir \\\n\t\toldincludedir docdir infodir htmldir dvidir pdfdir psdir \\\n\t\tlibdir localedir mandir\ndo\n  eval ac_val=\\$$ac_var\n  # Remove trailing slashes.\n  case $ac_val in\n    */ )\n      ac_val=`expr \"X$ac_val\" : 'X\\(.*[^/]\\)' \\| \"X$ac_val\" : 'X\\(.*\\)'`\n      eval $ac_var=\\$ac_val;;\n  esac\n  # Be sure to have absolute directory names.\n  case $ac_val in\n    [\\\\/$]* | ?:[\\\\/]* )  continue;;\n    NONE | '' ) case $ac_var in *prefix ) continue;; esac;;\n  esac\n  as_fn_error \"expected an absolute directory name for --$ac_var: $ac_val\"\ndone\n\n# There might be people who depend on the old broken behavior: `$host'\n# used to hold the argument of --host etc.\n# FIXME: To remove some day.\nbuild=$build_alias\nhost=$host_alias\ntarget=$target_alias\n\n# FIXME: To remove some day.\nif test \"x$host_alias\" != x; then\n  if test \"x$build_alias\" = x; then\n    cross_compiling=maybe\n    $as_echo \"$as_me: WARNING: If you wanted to set the --build type, don't use --host.\n    If a cross compiler is detected then cross compile mode will be used.\" >&2\n  elif test \"x$build_alias\" != \"x$host_alias\"; then\n    cross_compiling=yes\n  fi\nfi\n\nac_tool_prefix=\ntest -n \"$host_alias\" && ac_tool_prefix=$host_alias-\n\ntest \"$silent\" = yes && exec 6>/dev/null\n\n\nac_pwd=`pwd` && test -n \"$ac_pwd\" &&\nac_ls_di=`ls -di .` &&\nac_pwd_ls_di=`cd \"$ac_pwd\" && ls -di .` ||\n  as_fn_error \"working directory cannot be determined\"\ntest \"X$ac_ls_di\" = \"X$ac_pwd_ls_di\" ||\n  as_fn_error \"pwd does not report name of working directory\"\n\n\n# Find the source files, if location was not specified.\nif test -z \"$srcdir\"; then\n  ac_srcdir_defaulted=yes\n  # Try the directory containing this script, then the parent directory.\n  ac_confdir=`$as_dirname -- \"$as_myself\" ||\n$as_expr X\"$as_myself\" : 'X\\(.*[^/]\\)//*[^/][^/]*/*$' \\| \\\n\t X\"$as_myself\" : 'X\\(//\\)[^/]' \\| \\\n\t X\"$as_myself\" : 'X\\(//\\)$' \\| \\\n\t X\"$as_myself\" : 'X\\(/\\)' \\| . 2>/dev/null ||\n$as_echo X\"$as_myself\" |\n    sed '/^X\\(.*[^/]\\)\\/\\/*[^/][^/]*\\/*$/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  /^X\\(\\/\\/\\)[^/].*/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  /^X\\(\\/\\/\\)$/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  /^X\\(\\/\\).*/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  s/.*/./; q'`\n  srcdir=$ac_confdir\n  if test ! -r \"$srcdir/$ac_unique_file\"; then\n    srcdir=..\n  fi\nelse\n  ac_srcdir_defaulted=no\nfi\nif test ! -r \"$srcdir/$ac_unique_file\"; then\n  test \"$ac_srcdir_defaulted\" = yes && srcdir=\"$ac_confdir or ..\"\n  as_fn_error \"cannot find sources ($ac_unique_file) in $srcdir\"\nfi\nac_msg=\"sources are in $srcdir, but \\`cd $srcdir' does not work\"\nac_abs_confdir=`(\n\tcd \"$srcdir\" && test -r \"./$ac_unique_file\" || as_fn_error \"$ac_msg\"\n\tpwd)`\n# When building in place, set srcdir=.\nif test \"$ac_abs_confdir\" = \"$ac_pwd\"; then\n  srcdir=.\nfi\n# Remove unnecessary trailing slashes from srcdir.\n# Double slashes in file names in object file debugging info\n# mess up M-x gdb in Emacs.\ncase $srcdir in\n*/) srcdir=`expr \"X$srcdir\" : 'X\\(.*[^/]\\)' \\| \"X$srcdir\" : 'X\\(.*\\)'`;;\nesac\nfor ac_var in $ac_precious_vars; do\n  eval ac_env_${ac_var}_set=\\${${ac_var}+set}\n  eval ac_env_${ac_var}_value=\\$${ac_var}\n  eval ac_cv_env_${ac_var}_set=\\${${ac_var}+set}\n  eval ac_cv_env_${ac_var}_value=\\$${ac_var}\ndone\n\n#\n# Report the --help message.\n#\nif test \"$ac_init_help\" = \"long\"; then\n  # Omit some internal or obsolete options to make the list less imposing.\n  # This message is too long to be a string in the A/UX 3.1 sh.\n  cat <<_ACEOF\n\\`configure' configures LibTIFF Software 3.9.2 to adapt to many kinds of systems.\n\nUsage: $0 [OPTION]... [VAR=VALUE]...\n\nTo assign environment variables (e.g., CC, CFLAGS...), specify them as\nVAR=VALUE.  See below for descriptions of some of the useful variables.\n\nDefaults for the options are specified in brackets.\n\nConfiguration:\n  -h, --help              display this help and exit\n      --help=short        display options specific to this package\n      --help=recursive    display the short help of all the included packages\n  -V, --version           display version information and exit\n  -q, --quiet, --silent   do not print \\`checking...' messages\n      --cache-file=FILE   cache test results in FILE [disabled]\n  -C, --config-cache      alias for \\`--cache-file=config.cache'\n  -n, --no-create         do not create output files\n      --srcdir=DIR        find the sources in DIR [configure dir or \\`..']\n\nInstallation directories:\n  --prefix=PREFIX         install architecture-independent files in PREFIX\n                          [$ac_default_prefix]\n  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX\n                          [PREFIX]\n\nBy default, \\`make install' will install all the files in\n\\`$ac_default_prefix/bin', \\`$ac_default_prefix/lib' etc.  You can specify\nan installation prefix other than \\`$ac_default_prefix' using \\`--prefix',\nfor instance \\`--prefix=\\$HOME'.\n\nFor better control, use the options below.\n\nFine tuning of the installation directories:\n  --bindir=DIR            user executables [EPREFIX/bin]\n  --sbindir=DIR           system admin executables [EPREFIX/sbin]\n  --libexecdir=DIR        program executables [EPREFIX/libexec]\n  --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]\n  --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]\n  --localstatedir=DIR     modifiable single-machine data [PREFIX/var]\n  --libdir=DIR            object code libraries [EPREFIX/lib]\n  --includedir=DIR        C header files [PREFIX/include]\n  --oldincludedir=DIR     C header files for non-gcc [/usr/include]\n  --datarootdir=DIR       read-only arch.-independent data root [PREFIX/share]\n  --datadir=DIR           read-only architecture-independent data [DATAROOTDIR]\n  --infodir=DIR           info documentation [DATAROOTDIR/info]\n  --localedir=DIR         locale-dependent data [DATAROOTDIR/locale]\n  --mandir=DIR            man documentation [DATAROOTDIR/man]\n  --docdir=DIR            documentation root [DATAROOTDIR/doc/tiff]\n  --htmldir=DIR           html documentation [DOCDIR]\n  --dvidir=DIR            dvi documentation [DOCDIR]\n  --pdfdir=DIR            pdf documentation [DOCDIR]\n  --psdir=DIR             ps documentation [DOCDIR]\n_ACEOF\n\n  cat <<\\_ACEOF\n\nProgram names:\n  --program-prefix=PREFIX            prepend PREFIX to installed program names\n  --program-suffix=SUFFIX            append SUFFIX to installed program names\n  --program-transform-name=PROGRAM   run sed PROGRAM on installed program names\n\nX features:\n  --x-includes=DIR    X include files are in DIR\n  --x-libraries=DIR   X library files are in DIR\n\nSystem types:\n  --build=BUILD     configure for building on BUILD [guessed]\n  --host=HOST       cross-compile to build programs to run on HOST [BUILD]\n  --target=TARGET   configure for building compilers for TARGET [HOST]\n_ACEOF\nfi\n\nif test -n \"$ac_init_help\"; then\n  case $ac_init_help in\n     short | recursive ) echo \"Configuration of LibTIFF Software 3.9.2:\";;\n   esac\n  cat <<\\_ACEOF\n\nOptional Features:\n  --disable-option-checking  ignore unrecognized --enable/--with options\n  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)\n  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]\n  --enable-maintainer-mode  enable make rules and dependencies not useful\n\t\t\t  (and sometimes confusing) to the casual installer\n  --disable-dependency-tracking  speeds up one-time build\n  --enable-dependency-tracking   do not reject slow dependency extractors\n  --enable-shared[=PKGS]  build shared libraries [default=yes]\n  --enable-static[=PKGS]  build static libraries [default=yes]\n  --enable-fast-install[=PKGS]\n                          optimize for fast installation [default=yes]\n  --disable-libtool-lock  avoid locking (might break parallel builds)\n  --enable-silent-rules          less verbose build output (undo: `make V=1')\n  --disable-silent-rules         verbose build output (undo: `make V=0')\n  --enable-rpath          Enable runtime linker paths (-R libtool option)\n  --disable-largefile     omit support for large files\n  --disable-ccitt         disable support for CCITT Group 3 & 4 algorithms\n  --disable-packbits      disable support for Macintosh PackBits algorithm\n  --disable-lzw           disable support for LZW algorithm\n  --disable-thunder       disable support for ThunderScan 4-bit RLE algorithm\n  --disable-next          disable support for NeXT 2-bit RLE algorithm\n  --disable-logluv        disable support for LogLuv high dynamic range\n                          encoding\n  --disable-mdi           disable support for Microsoft Document Imaging\n  --disable-zlib          disable Zlib usage (required for Deflate\n                          compression, enabled by default)\n  --disable-pixarlog      disable support for Pixar log-format algorithm\n                          (requires Zlib)\n  --disable-jpeg          disable IJG JPEG library usage (required for JPEG\n                          compression, enabled by default)\n  --disable-old-jpeg      disable support for Old JPEG compresson (read-only,\n                          enabled by default)\n  --disable-jbig          disable JBIG-KIT usage (required for ISO JBIG\n                          compression, enabled by default)\n  --enable-cxx            enable C++ stream API building (requires C++\n                          compiler)\n  --disable-strip-chopping\n                          disable support for strip chopping (whether or not\n                          to convert single-strip uncompressed images to\n                          mutiple strips of specified size to reduce memory\n                          usage)\n  --disable-extrasample-as-alpha\n                          the RGBA interface will treat a fourth sample with\n                          no EXTRASAMPLE_ value as being ASSOCALPHA. Many\n                          packages produce RGBA files but don't mark the alpha\n                          properly\n  --disable-check-ycbcr-subsampling\n                          disable picking up YCbCr subsampling info from the\n                          JPEG data stream to support files lacking the tag\n\nOptional Packages:\n  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]\n  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)\n  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]\n  --with-pic              try to use only PIC/non-PIC objects [default=use\n                          both]\n  --with-docdir=DIR       directory where documentation should be installed\n  --with-zlib-include-dir=DIR\n                          location of Zlib headers\n  --with-zlib-lib-dir=DIR location of Zlib library binary\n  --with-jpeg-include-dir=DIR\n                          location of IJG JPEG library headers\n  --with-jpeg-lib-dir=DIR location of IJG JPEG library binary\n  --with-jbig-include-dir=DIR\n                          location of JBIG-KIT headers\n  --with-jbig-lib-dir=DIR location of JBIG-KIT library binary\n  --with-x                use the X Window System\n  --with-apple-opengl-framework\n                          use Apple OpenGL framework (Mac OS X only)\n  --with-default-strip-size=SIZE\n                          default size of the strip in bytes (when strip\n                          chopping enabled) [default=8192]\n\nSome influential environment variables:\n  CC          C compiler command\n  CFLAGS      C compiler flags\n  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a\n              nonstandard directory <lib dir>\n  LIBS        libraries to pass to the linker, e.g. -l<library>\n  CPPFLAGS    C/C++/Objective C preprocessor flags, e.g. -I<include dir> if\n              you have headers in a nonstandard directory <include dir>\n  CPP         C preprocessor\n  CXX         C++ compiler command\n  CXXFLAGS    C++ compiler flags\n  CXXCPP      C++ preprocessor\n  XMKMF       Path to xmkmf, Makefile generator for X Window System\n\nUse these variables to override the choices made by `configure' or to help\nit to find libraries and programs with nonstandard names/locations.\n\nReport bugs to <tiff@lists.maptools.org>.\n_ACEOF\nac_status=$?\nfi\n\nif test \"$ac_init_help\" = \"recursive\"; then\n  # If there are subdirs, report their specific --help.\n  for ac_dir in : $ac_subdirs_all; do test \"x$ac_dir\" = x: && continue\n    test -d \"$ac_dir\" ||\n      { cd \"$srcdir\" && ac_pwd=`pwd` && srcdir=. && test -d \"$ac_dir\"; } ||\n      continue\n    ac_builddir=.\n\ncase \"$ac_dir\" in\n.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;\n*)\n  ac_dir_suffix=/`$as_echo \"$ac_dir\" | sed 's|^\\.[\\\\/]||'`\n  # A \"..\" for each directory in $ac_dir_suffix.\n  ac_top_builddir_sub=`$as_echo \"$ac_dir_suffix\" | sed 's|/[^\\\\/]*|/..|g;s|/||'`\n  case $ac_top_builddir_sub in\n  \"\") ac_top_builddir_sub=. ac_top_build_prefix= ;;\n  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;\n  esac ;;\nesac\nac_abs_top_builddir=$ac_pwd\nac_abs_builddir=$ac_pwd$ac_dir_suffix\n# for backward compatibility:\nac_top_builddir=$ac_top_build_prefix\n\ncase $srcdir in\n  .)  # We are building in place.\n    ac_srcdir=.\n    ac_top_srcdir=$ac_top_builddir_sub\n    ac_abs_top_srcdir=$ac_pwd ;;\n  [\\\\/]* | ?:[\\\\/]* )  # Absolute name.\n    ac_srcdir=$srcdir$ac_dir_suffix;\n    ac_top_srcdir=$srcdir\n    ac_abs_top_srcdir=$srcdir ;;\n  *) # Relative name.\n    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix\n    ac_top_srcdir=$ac_top_build_prefix$srcdir\n    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;\nesac\nac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix\n\n    cd \"$ac_dir\" || { ac_status=$?; continue; }\n    # Check for guested configure.\n    if test -f \"$ac_srcdir/configure.gnu\"; then\n      echo &&\n      $SHELL \"$ac_srcdir/configure.gnu\" --help=recursive\n    elif test -f \"$ac_srcdir/configure\"; then\n      echo &&\n      $SHELL \"$ac_srcdir/configure\" --help=recursive\n    else\n      $as_echo \"$as_me: WARNING: no configuration information is in $ac_dir\" >&2\n    fi || ac_status=$?\n    cd \"$ac_pwd\" || { ac_status=$?; break; }\n  done\nfi\n\ntest -n \"$ac_init_help\" && exit $ac_status\nif $ac_init_version; then\n  cat <<\\_ACEOF\nLibTIFF Software configure 3.9.2\ngenerated by GNU Autoconf 2.64\n\nCopyright (C) 2009 Free Software Foundation, Inc.\nThis configure script is free software; the Free Software Foundation\ngives unlimited permission to copy, distribute and modify it.\n_ACEOF\n  exit\nfi\n\n## ------------------------ ##\n## Autoconf initialization. ##\n## ------------------------ ##\n\n# ac_fn_c_try_compile LINENO\n# --------------------------\n# Try to compile conftest.$ac_ext, and return whether this succeeded.\nac_fn_c_try_compile ()\n{\n  as_lineno=${as_lineno-\"$1\"} as_lineno_stack=as_lineno_stack=$as_lineno_stack\n  rm -f conftest.$ac_objext\n  if { { ac_try=\"$ac_compile\"\ncase \"(($ac_try\" in\n  *\\\"* | *\\`* | *\\\\*) ac_try_echo=\\$ac_try;;\n  *) ac_try_echo=$ac_try;;\nesac\neval ac_try_echo=\"\\\"\\$as_me:${as_lineno-$LINENO}: $ac_try_echo\\\"\"\n$as_echo \"$ac_try_echo\"; } >&5\n  (eval \"$ac_compile\") 2>conftest.err\n  ac_status=$?\n  if test -s conftest.err; then\n    grep -v '^ *+' conftest.err >conftest.er1\n    cat conftest.er1 >&5\n    mv -f conftest.er1 conftest.err\n  fi\n  $as_echo \"$as_me:${as_lineno-$LINENO}: \\$? = $ac_status\" >&5\n  test $ac_status = 0; } && {\n\t test -z \"$ac_c_werror_flag\" ||\n\t test ! -s conftest.err\n       } && test -s conftest.$ac_objext; then :\n  ac_retval=0\nelse\n  $as_echo \"$as_me: failed program was:\" >&5\nsed 's/^/| /' conftest.$ac_ext >&5\n\n\tac_retval=1\nfi\n  eval $as_lineno_stack; test \"x$as_lineno_stack\" = x && { as_lineno=; unset as_lineno;}\n  return $ac_retval\n\n} # ac_fn_c_try_compile\n\n# ac_fn_c_try_cpp LINENO\n# ----------------------\n# Try to preprocess conftest.$ac_ext, and return whether this succeeded.\nac_fn_c_try_cpp ()\n{\n  as_lineno=${as_lineno-\"$1\"} as_lineno_stack=as_lineno_stack=$as_lineno_stack\n  if { { ac_try=\"$ac_cpp conftest.$ac_ext\"\ncase \"(($ac_try\" in\n  *\\\"* | *\\`* | *\\\\*) ac_try_echo=\\$ac_try;;\n  *) ac_try_echo=$ac_try;;\nesac\neval ac_try_echo=\"\\\"\\$as_me:${as_lineno-$LINENO}: $ac_try_echo\\\"\"\n$as_echo \"$ac_try_echo\"; } >&5\n  (eval \"$ac_cpp conftest.$ac_ext\") 2>conftest.err\n  ac_status=$?\n  if test -s conftest.err; then\n    grep -v '^ *+' conftest.err >conftest.er1\n    cat conftest.er1 >&5\n    mv -f conftest.er1 conftest.err\n  fi\n  $as_echo \"$as_me:${as_lineno-$LINENO}: \\$? = $ac_status\" >&5\n  test $ac_status = 0; } >/dev/null && {\n\t test -z \"$ac_c_preproc_warn_flag$ac_c_werror_flag\" ||\n\t test ! -s conftest.err\n       }; then :\n  ac_retval=0\nelse\n  $as_echo \"$as_me: failed program was:\" >&5\nsed 's/^/| /' conftest.$ac_ext >&5\n\n    ac_retval=1\nfi\n  eval $as_lineno_stack; test \"x$as_lineno_stack\" = x && { as_lineno=; unset as_lineno;}\n  return $ac_retval\n\n} # ac_fn_c_try_cpp\n\n# ac_fn_c_try_link LINENO\n# -----------------------\n# Try to link conftest.$ac_ext, and return whether this succeeded.\nac_fn_c_try_link ()\n{\n  as_lineno=${as_lineno-\"$1\"} as_lineno_stack=as_lineno_stack=$as_lineno_stack\n  rm -f conftest.$ac_objext conftest$ac_exeext\n  if { { ac_try=\"$ac_link\"\ncase \"(($ac_try\" in\n  *\\\"* | *\\`* | *\\\\*) ac_try_echo=\\$ac_try;;\n  *) ac_try_echo=$ac_try;;\nesac\neval ac_try_echo=\"\\\"\\$as_me:${as_lineno-$LINENO}: $ac_try_echo\\\"\"\n$as_echo \"$ac_try_echo\"; } >&5\n  (eval \"$ac_link\") 2>conftest.err\n  ac_status=$?\n  if test -s conftest.err; then\n    grep -v '^ *+' conftest.err >conftest.er1\n    cat conftest.er1 >&5\n    mv -f conftest.er1 conftest.err\n  fi\n  $as_echo \"$as_me:${as_lineno-$LINENO}: \\$? = $ac_status\" >&5\n  test $ac_status = 0; } && {\n\t test -z \"$ac_c_werror_flag\" ||\n\t test ! -s conftest.err\n       } && test -s conftest$ac_exeext && {\n\t test \"$cross_compiling\" = yes ||\n\t $as_test_x conftest$ac_exeext\n       }; then :\n  ac_retval=0\nelse\n  $as_echo \"$as_me: failed program was:\" >&5\nsed 's/^/| /' conftest.$ac_ext >&5\n\n\tac_retval=1\nfi\n  # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information\n  # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would\n  # interfere with the next link command; also delete a directory that is\n  # left behind by Apple's compiler.  We do this before executing the actions.\n  rm -rf conftest.dSYM conftest_ipa8_conftest.oo\n  eval $as_lineno_stack; test \"x$as_lineno_stack\" = x && { as_lineno=; unset as_lineno;}\n  return $ac_retval\n\n} # ac_fn_c_try_link\n\n# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES\n# -------------------------------------------------------\n# Tests whether HEADER exists and can be compiled using the include files in\n# INCLUDES, setting the cache variable VAR accordingly.\nac_fn_c_check_header_compile ()\n{\n  as_lineno=${as_lineno-\"$1\"} as_lineno_stack=as_lineno_stack=$as_lineno_stack\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $2\" >&5\n$as_echo_n \"checking for $2... \" >&6; }\nif { as_var=$3; eval \"test \\\"\\${$as_var+set}\\\" = set\"; }; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n$4\n#include <$2>\n_ACEOF\nif ac_fn_c_try_compile \"$LINENO\"; then :\n  eval \"$3=yes\"\nelse\n  eval \"$3=no\"\nfi\nrm -f core conftest.err conftest.$ac_objext conftest.$ac_ext\nfi\neval ac_res=\\$$3\n\t       { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_res\" >&5\n$as_echo \"$ac_res\" >&6; }\n  eval $as_lineno_stack; test \"x$as_lineno_stack\" = x && { as_lineno=; unset as_lineno;}\n\n} # ac_fn_c_check_header_compile\n\n# ac_fn_c_try_run LINENO\n# ----------------------\n# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes\n# that executables *can* be run.\nac_fn_c_try_run ()\n{\n  as_lineno=${as_lineno-\"$1\"} as_lineno_stack=as_lineno_stack=$as_lineno_stack\n  if { { ac_try=\"$ac_link\"\ncase \"(($ac_try\" in\n  *\\\"* | *\\`* | *\\\\*) ac_try_echo=\\$ac_try;;\n  *) ac_try_echo=$ac_try;;\nesac\neval ac_try_echo=\"\\\"\\$as_me:${as_lineno-$LINENO}: $ac_try_echo\\\"\"\n$as_echo \"$ac_try_echo\"; } >&5\n  (eval \"$ac_link\") 2>&5\n  ac_status=$?\n  $as_echo \"$as_me:${as_lineno-$LINENO}: \\$? = $ac_status\" >&5\n  test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'\n  { { case \"(($ac_try\" in\n  *\\\"* | *\\`* | *\\\\*) ac_try_echo=\\$ac_try;;\n  *) ac_try_echo=$ac_try;;\nesac\neval ac_try_echo=\"\\\"\\$as_me:${as_lineno-$LINENO}: $ac_try_echo\\\"\"\n$as_echo \"$ac_try_echo\"; } >&5\n  (eval \"$ac_try\") 2>&5\n  ac_status=$?\n  $as_echo \"$as_me:${as_lineno-$LINENO}: \\$? = $ac_status\" >&5\n  test $ac_status = 0; }; }; then :\n  ac_retval=0\nelse\n  $as_echo \"$as_me: program exited with status $ac_status\" >&5\n       $as_echo \"$as_me: failed program was:\" >&5\nsed 's/^/| /' conftest.$ac_ext >&5\n\n       ac_retval=$ac_status\nfi\n  rm -rf conftest.dSYM conftest_ipa8_conftest.oo\n  eval $as_lineno_stack; test \"x$as_lineno_stack\" = x && { as_lineno=; unset as_lineno;}\n  return $ac_retval\n\n} # ac_fn_c_try_run\n\n# ac_fn_c_check_func LINENO FUNC VAR\n# ----------------------------------\n# Tests whether FUNC exists, setting the cache variable VAR accordingly\nac_fn_c_check_func ()\n{\n  as_lineno=${as_lineno-\"$1\"} as_lineno_stack=as_lineno_stack=$as_lineno_stack\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $2\" >&5\n$as_echo_n \"checking for $2... \" >&6; }\nif { as_var=$3; eval \"test \\\"\\${$as_var+set}\\\" = set\"; }; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n/* Define $2 to an innocuous variant, in case <limits.h> declares $2.\n   For example, HP-UX 11i <limits.h> declares gettimeofday.  */\n#define $2 innocuous_$2\n\n/* System header to define __stub macros and hopefully few prototypes,\n    which can conflict with char $2 (); below.\n    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since\n    <limits.h> exists even on freestanding compilers.  */\n\n#ifdef __STDC__\n# include <limits.h>\n#else\n# include <assert.h>\n#endif\n\n#undef $2\n\n/* Override any GCC internal prototype to avoid an error.\n   Use char because int might match the return type of a GCC\n   builtin and then its argument prototype would still apply.  */\n#ifdef __cplusplus\nextern \"C\"\n#endif\nchar $2 ();\n/* The GNU C library defines this for functions which it implements\n    to always fail with ENOSYS.  Some functions are actually named\n    something starting with __ and the normal name is an alias.  */\n#if defined __stub_$2 || defined __stub___$2\nchoke me\n#endif\n\nint\nmain ()\n{\nreturn $2 ();\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_link \"$LINENO\"; then :\n  eval \"$3=yes\"\nelse\n  eval \"$3=no\"\nfi\nrm -f core conftest.err conftest.$ac_objext \\\n    conftest$ac_exeext conftest.$ac_ext\nfi\neval ac_res=\\$$3\n\t       { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_res\" >&5\n$as_echo \"$ac_res\" >&6; }\n  eval $as_lineno_stack; test \"x$as_lineno_stack\" = x && { as_lineno=; unset as_lineno;}\n\n} # ac_fn_c_check_func\n\n# ac_fn_cxx_try_compile LINENO\n# ----------------------------\n# Try to compile conftest.$ac_ext, and return whether this succeeded.\nac_fn_cxx_try_compile ()\n{\n  as_lineno=${as_lineno-\"$1\"} as_lineno_stack=as_lineno_stack=$as_lineno_stack\n  rm -f conftest.$ac_objext\n  if { { ac_try=\"$ac_compile\"\ncase \"(($ac_try\" in\n  *\\\"* | *\\`* | *\\\\*) ac_try_echo=\\$ac_try;;\n  *) ac_try_echo=$ac_try;;\nesac\neval ac_try_echo=\"\\\"\\$as_me:${as_lineno-$LINENO}: $ac_try_echo\\\"\"\n$as_echo \"$ac_try_echo\"; } >&5\n  (eval \"$ac_compile\") 2>conftest.err\n  ac_status=$?\n  if test -s conftest.err; then\n    grep -v '^ *+' conftest.err >conftest.er1\n    cat conftest.er1 >&5\n    mv -f conftest.er1 conftest.err\n  fi\n  $as_echo \"$as_me:${as_lineno-$LINENO}: \\$? = $ac_status\" >&5\n  test $ac_status = 0; } && {\n\t test -z \"$ac_cxx_werror_flag\" ||\n\t test ! -s conftest.err\n       } && test -s conftest.$ac_objext; then :\n  ac_retval=0\nelse\n  $as_echo \"$as_me: failed program was:\" >&5\nsed 's/^/| /' conftest.$ac_ext >&5\n\n\tac_retval=1\nfi\n  eval $as_lineno_stack; test \"x$as_lineno_stack\" = x && { as_lineno=; unset as_lineno;}\n  return $ac_retval\n\n} # ac_fn_cxx_try_compile\n\n# ac_fn_cxx_try_cpp LINENO\n# ------------------------\n# Try to preprocess conftest.$ac_ext, and return whether this succeeded.\nac_fn_cxx_try_cpp ()\n{\n  as_lineno=${as_lineno-\"$1\"} as_lineno_stack=as_lineno_stack=$as_lineno_stack\n  if { { ac_try=\"$ac_cpp conftest.$ac_ext\"\ncase \"(($ac_try\" in\n  *\\\"* | *\\`* | *\\\\*) ac_try_echo=\\$ac_try;;\n  *) ac_try_echo=$ac_try;;\nesac\neval ac_try_echo=\"\\\"\\$as_me:${as_lineno-$LINENO}: $ac_try_echo\\\"\"\n$as_echo \"$ac_try_echo\"; } >&5\n  (eval \"$ac_cpp conftest.$ac_ext\") 2>conftest.err\n  ac_status=$?\n  if test -s conftest.err; then\n    grep -v '^ *+' conftest.err >conftest.er1\n    cat conftest.er1 >&5\n    mv -f conftest.er1 conftest.err\n  fi\n  $as_echo \"$as_me:${as_lineno-$LINENO}: \\$? = $ac_status\" >&5\n  test $ac_status = 0; } >/dev/null && {\n\t test -z \"$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag\" ||\n\t test ! -s conftest.err\n       }; then :\n  ac_retval=0\nelse\n  $as_echo \"$as_me: failed program was:\" >&5\nsed 's/^/| /' conftest.$ac_ext >&5\n\n    ac_retval=1\nfi\n  eval $as_lineno_stack; test \"x$as_lineno_stack\" = x && { as_lineno=; unset as_lineno;}\n  return $ac_retval\n\n} # ac_fn_cxx_try_cpp\n\n# ac_fn_cxx_try_link LINENO\n# -------------------------\n# Try to link conftest.$ac_ext, and return whether this succeeded.\nac_fn_cxx_try_link ()\n{\n  as_lineno=${as_lineno-\"$1\"} as_lineno_stack=as_lineno_stack=$as_lineno_stack\n  rm -f conftest.$ac_objext conftest$ac_exeext\n  if { { ac_try=\"$ac_link\"\ncase \"(($ac_try\" in\n  *\\\"* | *\\`* | *\\\\*) ac_try_echo=\\$ac_try;;\n  *) ac_try_echo=$ac_try;;\nesac\neval ac_try_echo=\"\\\"\\$as_me:${as_lineno-$LINENO}: $ac_try_echo\\\"\"\n$as_echo \"$ac_try_echo\"; } >&5\n  (eval \"$ac_link\") 2>conftest.err\n  ac_status=$?\n  if test -s conftest.err; then\n    grep -v '^ *+' conftest.err >conftest.er1\n    cat conftest.er1 >&5\n    mv -f conftest.er1 conftest.err\n  fi\n  $as_echo \"$as_me:${as_lineno-$LINENO}: \\$? = $ac_status\" >&5\n  test $ac_status = 0; } && {\n\t test -z \"$ac_cxx_werror_flag\" ||\n\t test ! -s conftest.err\n       } && test -s conftest$ac_exeext && {\n\t test \"$cross_compiling\" = yes ||\n\t $as_test_x conftest$ac_exeext\n       }; then :\n  ac_retval=0\nelse\n  $as_echo \"$as_me: failed program was:\" >&5\nsed 's/^/| /' conftest.$ac_ext >&5\n\n\tac_retval=1\nfi\n  # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information\n  # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would\n  # interfere with the next link command; also delete a directory that is\n  # left behind by Apple's compiler.  We do this before executing the actions.\n  rm -rf conftest.dSYM conftest_ipa8_conftest.oo\n  eval $as_lineno_stack; test \"x$as_lineno_stack\" = x && { as_lineno=; unset as_lineno;}\n  return $ac_retval\n\n} # ac_fn_cxx_try_link\n\n# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES\n# -------------------------------------------------------\n# Tests whether HEADER exists, giving a warning if it cannot be compiled using\n# the include files in INCLUDES and setting the cache variable VAR\n# accordingly.\nac_fn_c_check_header_mongrel ()\n{\n  as_lineno=${as_lineno-\"$1\"} as_lineno_stack=as_lineno_stack=$as_lineno_stack\n  if { as_var=$3; eval \"test \\\"\\${$as_var+set}\\\" = set\"; }; then :\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $2\" >&5\n$as_echo_n \"checking for $2... \" >&6; }\nif { as_var=$3; eval \"test \\\"\\${$as_var+set}\\\" = set\"; }; then :\n  $as_echo_n \"(cached) \" >&6\nfi\neval ac_res=\\$$3\n\t       { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_res\" >&5\n$as_echo \"$ac_res\" >&6; }\nelse\n  # Is the header compilable?\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking $2 usability\" >&5\n$as_echo_n \"checking $2 usability... \" >&6; }\ncat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n$4\n#include <$2>\n_ACEOF\nif ac_fn_c_try_compile \"$LINENO\"; then :\n  ac_header_compiler=yes\nelse\n  ac_header_compiler=no\nfi\nrm -f core conftest.err conftest.$ac_objext conftest.$ac_ext\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler\" >&5\n$as_echo \"$ac_header_compiler\" >&6; }\n\n# Is the header present?\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking $2 presence\" >&5\n$as_echo_n \"checking $2 presence... \" >&6; }\ncat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n#include <$2>\n_ACEOF\nif ac_fn_c_try_cpp \"$LINENO\"; then :\n  ac_header_preproc=yes\nelse\n  ac_header_preproc=no\nfi\nrm -f conftest.err conftest.$ac_ext\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc\" >&5\n$as_echo \"$ac_header_preproc\" >&6; }\n\n# So?  What about this header?\ncase $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((\n  yes:no: )\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!\" >&5\n$as_echo \"$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!\" >&2;}\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result\" >&5\n$as_echo \"$as_me: WARNING: $2: proceeding with the compiler's result\" >&2;}\n    ;;\n  no:yes:* )\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled\" >&5\n$as_echo \"$as_me: WARNING: $2: present but cannot be compiled\" >&2;}\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: WARNING: $2:     check for missing prerequisite headers?\" >&5\n$as_echo \"$as_me: WARNING: $2:     check for missing prerequisite headers?\" >&2;}\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation\" >&5\n$as_echo \"$as_me: WARNING: $2: see the Autoconf documentation\" >&2;}\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: WARNING: $2:     section \\\"Present But Cannot Be Compiled\\\"\" >&5\n$as_echo \"$as_me: WARNING: $2:     section \\\"Present But Cannot Be Compiled\\\"\" >&2;}\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result\" >&5\n$as_echo \"$as_me: WARNING: $2: proceeding with the compiler's result\" >&2;}\n( cat <<\\_ASBOX\n## -------------------------------------- ##\n## Report this to tiff@lists.maptools.org ##\n## -------------------------------------- ##\n_ASBOX\n     ) | sed \"s/^/$as_me: WARNING:     /\" >&2\n    ;;\nesac\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $2\" >&5\n$as_echo_n \"checking for $2... \" >&6; }\nif { as_var=$3; eval \"test \\\"\\${$as_var+set}\\\" = set\"; }; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  eval \"$3=\\$ac_header_compiler\"\nfi\neval ac_res=\\$$3\n\t       { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_res\" >&5\n$as_echo \"$ac_res\" >&6; }\nfi\n  eval $as_lineno_stack; test \"x$as_lineno_stack\" = x && { as_lineno=; unset as_lineno;}\n\n} # ac_fn_c_check_header_mongrel\n\n# ac_fn_c_check_type LINENO TYPE VAR INCLUDES\n# -------------------------------------------\n# Tests whether TYPE exists after having included INCLUDES, setting cache\n# variable VAR accordingly.\nac_fn_c_check_type ()\n{\n  as_lineno=${as_lineno-\"$1\"} as_lineno_stack=as_lineno_stack=$as_lineno_stack\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $2\" >&5\n$as_echo_n \"checking for $2... \" >&6; }\nif { as_var=$3; eval \"test \\\"\\${$as_var+set}\\\" = set\"; }; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  eval \"$3=no\"\n  cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n$4\nint\nmain ()\n{\nif (sizeof ($2))\n\t return 0;\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_compile \"$LINENO\"; then :\n  cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n$4\nint\nmain ()\n{\nif (sizeof (($2)))\n\t    return 0;\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_compile \"$LINENO\"; then :\n\nelse\n  eval \"$3=yes\"\nfi\nrm -f core conftest.err conftest.$ac_objext conftest.$ac_ext\nfi\nrm -f core conftest.err conftest.$ac_objext conftest.$ac_ext\nfi\neval ac_res=\\$$3\n\t       { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_res\" >&5\n$as_echo \"$ac_res\" >&6; }\n  eval $as_lineno_stack; test \"x$as_lineno_stack\" = x && { as_lineno=; unset as_lineno;}\n\n} # ac_fn_c_check_type\n\n# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES\n# --------------------------------------------\n# Tries to find the compile-time value of EXPR in a program that includes\n# INCLUDES, setting VAR accordingly. Returns whether the value could be\n# computed\nac_fn_c_compute_int ()\n{\n  as_lineno=${as_lineno-\"$1\"} as_lineno_stack=as_lineno_stack=$as_lineno_stack\n  if test \"$cross_compiling\" = yes; then\n    # Depending upon the size, compute the lo and hi bounds.\ncat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n$4\nint\nmain ()\n{\nstatic int test_array [1 - 2 * !(($2) >= 0)];\ntest_array [0] = 0\n\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_compile \"$LINENO\"; then :\n  ac_lo=0 ac_mid=0\n  while :; do\n    cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n$4\nint\nmain ()\n{\nstatic int test_array [1 - 2 * !(($2) <= $ac_mid)];\ntest_array [0] = 0\n\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_compile \"$LINENO\"; then :\n  ac_hi=$ac_mid; break\nelse\n  as_fn_arith $ac_mid + 1 && ac_lo=$as_val\n\t\t\tif test $ac_lo -le $ac_mid; then\n\t\t\t  ac_lo= ac_hi=\n\t\t\t  break\n\t\t\tfi\n\t\t\tas_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val\nfi\nrm -f core conftest.err conftest.$ac_objext conftest.$ac_ext\n  done\nelse\n  cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n$4\nint\nmain ()\n{\nstatic int test_array [1 - 2 * !(($2) < 0)];\ntest_array [0] = 0\n\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_compile \"$LINENO\"; then :\n  ac_hi=-1 ac_mid=-1\n  while :; do\n    cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n$4\nint\nmain ()\n{\nstatic int test_array [1 - 2 * !(($2) >= $ac_mid)];\ntest_array [0] = 0\n\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_compile \"$LINENO\"; then :\n  ac_lo=$ac_mid; break\nelse\n  as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val\n\t\t\tif test $ac_mid -le $ac_hi; then\n\t\t\t  ac_lo= ac_hi=\n\t\t\t  break\n\t\t\tfi\n\t\t\tas_fn_arith 2 '*' $ac_mid && ac_mid=$as_val\nfi\nrm -f core conftest.err conftest.$ac_objext conftest.$ac_ext\n  done\nelse\n  ac_lo= ac_hi=\nfi\nrm -f core conftest.err conftest.$ac_objext conftest.$ac_ext\nfi\nrm -f core conftest.err conftest.$ac_objext conftest.$ac_ext\n# Binary search between lo and hi bounds.\nwhile test \"x$ac_lo\" != \"x$ac_hi\"; do\n  as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val\n  cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n$4\nint\nmain ()\n{\nstatic int test_array [1 - 2 * !(($2) <= $ac_mid)];\ntest_array [0] = 0\n\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_compile \"$LINENO\"; then :\n  ac_hi=$ac_mid\nelse\n  as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val\nfi\nrm -f core conftest.err conftest.$ac_objext conftest.$ac_ext\ndone\ncase $ac_lo in #((\n?*) eval \"$3=\\$ac_lo\"; ac_retval=0 ;;\n'') ac_retval=1 ;;\nesac\n  else\n    cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n$4\nstatic long int longval () { return $2; }\nstatic unsigned long int ulongval () { return $2; }\n#include <stdio.h>\n#include <stdlib.h>\nint\nmain ()\n{\n\n  FILE *f = fopen (\"conftest.val\", \"w\");\n  if (! f)\n    return 1;\n  if (($2) < 0)\n    {\n      long int i = longval ();\n      if (i != ($2))\n\treturn 1;\n      fprintf (f, \"%ld\", i);\n    }\n  else\n    {\n      unsigned long int i = ulongval ();\n      if (i != ($2))\n\treturn 1;\n      fprintf (f, \"%lu\", i);\n    }\n  /* Do not output a trailing newline, as this causes \\r\\n confusion\n     on some platforms.  */\n  return ferror (f) || fclose (f) != 0;\n\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_run \"$LINENO\"; then :\n  echo >>conftest.val; read $3 <conftest.val; ac_retval=0\nelse\n  ac_retval=1\nfi\nrm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \\\n  conftest.$ac_objext conftest.beam conftest.$ac_ext\nrm -f conftest.val\n\n  fi\n  eval $as_lineno_stack; test \"x$as_lineno_stack\" = x && { as_lineno=; unset as_lineno;}\n  return $ac_retval\n\n} # ac_fn_c_compute_int\ncat >config.log <<_ACEOF\nThis file contains any messages produced by compilers while\nrunning configure, to aid debugging if configure makes a mistake.\n\nIt was created by LibTIFF Software $as_me 3.9.2, which was\ngenerated by GNU Autoconf 2.64.  Invocation command line was\n\n  $ $0 $@\n\n_ACEOF\nexec 5>>config.log\n{\ncat <<_ASUNAME\n## --------- ##\n## Platform. ##\n## --------- ##\n\nhostname = `(hostname || uname -n) 2>/dev/null | sed 1q`\nuname -m = `(uname -m) 2>/dev/null || echo unknown`\nuname -r = `(uname -r) 2>/dev/null || echo unknown`\nuname -s = `(uname -s) 2>/dev/null || echo unknown`\nuname -v = `(uname -v) 2>/dev/null || echo unknown`\n\n/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`\n/bin/uname -X     = `(/bin/uname -X) 2>/dev/null     || echo unknown`\n\n/bin/arch              = `(/bin/arch) 2>/dev/null              || echo unknown`\n/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null       || echo unknown`\n/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`\n/usr/bin/hostinfo      = `(/usr/bin/hostinfo) 2>/dev/null      || echo unknown`\n/bin/machine           = `(/bin/machine) 2>/dev/null           || echo unknown`\n/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`\n/bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown`\n\n_ASUNAME\n\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    $as_echo \"PATH: $as_dir\"\n  done\nIFS=$as_save_IFS\n\n} >&5\n\ncat >&5 <<_ACEOF\n\n\n## ----------- ##\n## Core tests. ##\n## ----------- ##\n\n_ACEOF\n\n\n# Keep a trace of the command line.\n# Strip out --no-create and --no-recursion so they do not pile up.\n# Strip out --silent because we don't want to record it for future runs.\n# Also quote any args containing shell meta-characters.\n# Make two passes to allow for proper duplicate-argument suppression.\nac_configure_args=\nac_configure_args0=\nac_configure_args1=\nac_must_keep_next=false\nfor ac_pass in 1 2\ndo\n  for ac_arg\n  do\n    case $ac_arg in\n    -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;\n    -q | -quiet | --quiet | --quie | --qui | --qu | --q \\\n    | -silent | --silent | --silen | --sile | --sil)\n      continue ;;\n    *\\'*)\n      ac_arg=`$as_echo \"$ac_arg\" | sed \"s/'/'\\\\\\\\\\\\\\\\''/g\"` ;;\n    esac\n    case $ac_pass in\n    1) as_fn_append ac_configure_args0 \" '$ac_arg'\" ;;\n    2)\n      as_fn_append ac_configure_args1 \" '$ac_arg'\"\n      if test $ac_must_keep_next = true; then\n\tac_must_keep_next=false # Got value, back to normal.\n      else\n\tcase $ac_arg in\n\t  *=* | --config-cache | -C | -disable-* | --disable-* \\\n\t  | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \\\n\t  | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \\\n\t  | -with-* | --with-* | -without-* | --without-* | --x)\n\t    case \"$ac_configure_args0 \" in\n\t      \"$ac_configure_args1\"*\" '$ac_arg' \"* ) continue ;;\n\t    esac\n\t    ;;\n\t  -* ) ac_must_keep_next=true ;;\n\tesac\n      fi\n      as_fn_append ac_configure_args \" '$ac_arg'\"\n      ;;\n    esac\n  done\ndone\n{ ac_configure_args0=; unset ac_configure_args0;}\n{ ac_configure_args1=; unset ac_configure_args1;}\n\n# When interrupted or exit'd, cleanup temporary files, and complete\n# config.log.  We remove comments because anyway the quotes in there\n# would cause problems or look ugly.\n# WARNING: Use '\\'' to represent an apostrophe within the trap.\n# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.\ntrap 'exit_status=$?\n  # Save into config.log some information that might help in debugging.\n  {\n    echo\n\n    cat <<\\_ASBOX\n## ---------------- ##\n## Cache variables. ##\n## ---------------- ##\n_ASBOX\n    echo\n    # The following way of writing the cache mishandles newlines in values,\n(\n  for ac_var in `(set) 2>&1 | sed -n '\\''s/^\\([a-zA-Z_][a-zA-Z0-9_]*\\)=.*/\\1/p'\\''`; do\n    eval ac_val=\\$$ac_var\n    case $ac_val in #(\n    *${as_nl}*)\n      case $ac_var in #(\n      *_cv_*) { $as_echo \"$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline\" >&5\n$as_echo \"$as_me: WARNING: cache variable $ac_var contains a newline\" >&2;} ;;\n      esac\n      case $ac_var in #(\n      _ | IFS | as_nl) ;; #(\n      BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(\n      *) { eval $ac_var=; unset $ac_var;} ;;\n      esac ;;\n    esac\n  done\n  (set) 2>&1 |\n    case $as_nl`(ac_space='\\'' '\\''; set) 2>&1` in #(\n    *${as_nl}ac_space=\\ *)\n      sed -n \\\n\t\"s/'\\''/'\\''\\\\\\\\'\\'''\\''/g;\n\t  s/^\\\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\\\)=\\\\(.*\\\\)/\\\\1='\\''\\\\2'\\''/p\"\n      ;; #(\n    *)\n      sed -n \"/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p\"\n      ;;\n    esac |\n    sort\n)\n    echo\n\n    cat <<\\_ASBOX\n## ----------------- ##\n## Output variables. ##\n## ----------------- ##\n_ASBOX\n    echo\n    for ac_var in $ac_subst_vars\n    do\n      eval ac_val=\\$$ac_var\n      case $ac_val in\n      *\\'\\''*) ac_val=`$as_echo \"$ac_val\" | sed \"s/'\\''/'\\''\\\\\\\\\\\\\\\\'\\'''\\''/g\"`;;\n      esac\n      $as_echo \"$ac_var='\\''$ac_val'\\''\"\n    done | sort\n    echo\n\n    if test -n \"$ac_subst_files\"; then\n      cat <<\\_ASBOX\n## ------------------- ##\n## File substitutions. ##\n## ------------------- ##\n_ASBOX\n      echo\n      for ac_var in $ac_subst_files\n      do\n\teval ac_val=\\$$ac_var\n\tcase $ac_val in\n\t*\\'\\''*) ac_val=`$as_echo \"$ac_val\" | sed \"s/'\\''/'\\''\\\\\\\\\\\\\\\\'\\'''\\''/g\"`;;\n\tesac\n\t$as_echo \"$ac_var='\\''$ac_val'\\''\"\n      done | sort\n      echo\n    fi\n\n    if test -s confdefs.h; then\n      cat <<\\_ASBOX\n## ----------- ##\n## confdefs.h. ##\n## ----------- ##\n_ASBOX\n      echo\n      cat confdefs.h\n      echo\n    fi\n    test \"$ac_signal\" != 0 &&\n      $as_echo \"$as_me: caught signal $ac_signal\"\n    $as_echo \"$as_me: exit $exit_status\"\n  } >&5\n  rm -f core *.core core.conftest.* &&\n    rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&\n    exit $exit_status\n' 0\nfor ac_signal in 1 2 13 15; do\n  trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal\ndone\nac_signal=0\n\n# confdefs.h avoids OS command line length limits that DEFS can exceed.\nrm -f -r conftest* confdefs.h\n\n$as_echo \"/* confdefs.h */\" > confdefs.h\n\n# Predefined preprocessor variables.\n\ncat >>confdefs.h <<_ACEOF\n#define PACKAGE_NAME \"$PACKAGE_NAME\"\n_ACEOF\n\ncat >>confdefs.h <<_ACEOF\n#define PACKAGE_TARNAME \"$PACKAGE_TARNAME\"\n_ACEOF\n\ncat >>confdefs.h <<_ACEOF\n#define PACKAGE_VERSION \"$PACKAGE_VERSION\"\n_ACEOF\n\ncat >>confdefs.h <<_ACEOF\n#define PACKAGE_STRING \"$PACKAGE_STRING\"\n_ACEOF\n\ncat >>confdefs.h <<_ACEOF\n#define PACKAGE_BUGREPORT \"$PACKAGE_BUGREPORT\"\n_ACEOF\n\ncat >>confdefs.h <<_ACEOF\n#define PACKAGE_URL \"$PACKAGE_URL\"\n_ACEOF\n\n\n# Let the site file select an alternate cache file if it wants to.\n# Prefer an explicitly selected file to automatically selected ones.\nac_site_file1=NONE\nac_site_file2=NONE\nif test -n \"$CONFIG_SITE\"; then\n  ac_site_file1=$CONFIG_SITE\nelif test \"x$prefix\" != xNONE; then\n  ac_site_file1=$prefix/share/config.site\n  ac_site_file2=$prefix/etc/config.site\nelse\n  ac_site_file1=$ac_default_prefix/share/config.site\n  ac_site_file2=$ac_default_prefix/etc/config.site\nfi\nfor ac_site_file in \"$ac_site_file1\" \"$ac_site_file2\"\ndo\n  test \"x$ac_site_file\" = xNONE && continue\n  if test -r \"$ac_site_file\"; then\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file\" >&5\n$as_echo \"$as_me: loading site script $ac_site_file\" >&6;}\n    sed 's/^/| /' \"$ac_site_file\" >&5\n    . \"$ac_site_file\"\n  fi\ndone\n\nif test -r \"$cache_file\"; then\n  # Some versions of bash will fail to source /dev/null (special\n  # files actually), so we avoid doing that.\n  if test -f \"$cache_file\"; then\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: loading cache $cache_file\" >&5\n$as_echo \"$as_me: loading cache $cache_file\" >&6;}\n    case $cache_file in\n      [\\\\/]* | ?:[\\\\/]* ) . \"$cache_file\";;\n      *)                      . \"./$cache_file\";;\n    esac\n  fi\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: creating cache $cache_file\" >&5\n$as_echo \"$as_me: creating cache $cache_file\" >&6;}\n  >$cache_file\nfi\n\n# Check that the precious variables saved in the cache have kept the same\n# value.\nac_cache_corrupted=false\nfor ac_var in $ac_precious_vars; do\n  eval ac_old_set=\\$ac_cv_env_${ac_var}_set\n  eval ac_new_set=\\$ac_env_${ac_var}_set\n  eval ac_old_val=\\$ac_cv_env_${ac_var}_value\n  eval ac_new_val=\\$ac_env_${ac_var}_value\n  case $ac_old_set,$ac_new_set in\n    set,)\n      { $as_echo \"$as_me:${as_lineno-$LINENO}: error: \\`$ac_var' was set to \\`$ac_old_val' in the previous run\" >&5\n$as_echo \"$as_me: error: \\`$ac_var' was set to \\`$ac_old_val' in the previous run\" >&2;}\n      ac_cache_corrupted=: ;;\n    ,set)\n      { $as_echo \"$as_me:${as_lineno-$LINENO}: error: \\`$ac_var' was not set in the previous run\" >&5\n$as_echo \"$as_me: error: \\`$ac_var' was not set in the previous run\" >&2;}\n      ac_cache_corrupted=: ;;\n    ,);;\n    *)\n      if test \"x$ac_old_val\" != \"x$ac_new_val\"; then\n\t# differences in whitespace do not lead to failure.\n\tac_old_val_w=`echo x $ac_old_val`\n\tac_new_val_w=`echo x $ac_new_val`\n\tif test \"$ac_old_val_w\" != \"$ac_new_val_w\"; then\n\t  { $as_echo \"$as_me:${as_lineno-$LINENO}: error: \\`$ac_var' has changed since the previous run:\" >&5\n$as_echo \"$as_me: error: \\`$ac_var' has changed since the previous run:\" >&2;}\n\t  ac_cache_corrupted=:\n\telse\n\t  { $as_echo \"$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \\`$ac_var' since the previous run:\" >&5\n$as_echo \"$as_me: warning: ignoring whitespace changes in \\`$ac_var' since the previous run:\" >&2;}\n\t  eval $ac_var=\\$ac_old_val\n\tfi\n\t{ $as_echo \"$as_me:${as_lineno-$LINENO}:   former value:  \\`$ac_old_val'\" >&5\n$as_echo \"$as_me:   former value:  \\`$ac_old_val'\" >&2;}\n\t{ $as_echo \"$as_me:${as_lineno-$LINENO}:   current value: \\`$ac_new_val'\" >&5\n$as_echo \"$as_me:   current value: \\`$ac_new_val'\" >&2;}\n      fi;;\n  esac\n  # Pass precious variables to config.status.\n  if test \"$ac_new_set\" = set; then\n    case $ac_new_val in\n    *\\'*) ac_arg=$ac_var=`$as_echo \"$ac_new_val\" | sed \"s/'/'\\\\\\\\\\\\\\\\''/g\"` ;;\n    *) ac_arg=$ac_var=$ac_new_val ;;\n    esac\n    case \" $ac_configure_args \" in\n      *\" '$ac_arg' \"*) ;; # Avoid dups.  Use of quotes ensures accuracy.\n      *) as_fn_append ac_configure_args \" '$ac_arg'\" ;;\n    esac\n  fi\ndone\nif $ac_cache_corrupted; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: error: in \\`$ac_pwd':\" >&5\n$as_echo \"$as_me: error: in \\`$ac_pwd':\" >&2;}\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build\" >&5\n$as_echo \"$as_me: error: changes in the environment can compromise the build\" >&2;}\n  as_fn_error \"run \\`make distclean' and/or \\`rm $cache_file' and start over\" \"$LINENO\" 5\nfi\n## -------------------- ##\n## Main body of script. ##\n## -------------------- ##\n\nac_ext=c\nac_cpp='$CPP $CPPFLAGS'\nac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'\nac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'\nac_compiler_gnu=$ac_cv_c_compiler_gnu\n\n\nac_aux_dir=\nfor ac_dir in config \"$srcdir\"/config; do\n  for ac_t in install-sh install.sh shtool; do\n    if test -f \"$ac_dir/$ac_t\"; then\n      ac_aux_dir=$ac_dir\n      ac_install_sh=\"$ac_aux_dir/$ac_t -c\"\n      break 2\n    fi\n  done\ndone\nif test -z \"$ac_aux_dir\"; then\n  as_fn_error \"cannot find install-sh, install.sh, or shtool in config \\\"$srcdir\\\"/config\" \"$LINENO\" 5\nfi\n\n# These three variables are undocumented and unsupported,\n# and are intended to be withdrawn in a future Autoconf release.\n# They can cause serious problems if a builder's source tree is in a directory\n# whose full name contains unusual characters.\nac_config_guess=\"$SHELL $ac_aux_dir/config.guess\"  # Please don't use this var.\nac_config_sub=\"$SHELL $ac_aux_dir/config.sub\"  # Please don't use this var.\nac_configure=\"$SHELL $ac_aux_dir/configure\"  # Please don't use this var.\n\n\n\nac_ext=c\nac_cpp='$CPP $CPPFLAGS'\nac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'\nac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'\nac_compiler_gnu=$ac_cv_c_compiler_gnu\n\n\n# Make sure we can run config.sub.\n$SHELL \"$ac_aux_dir/config.sub\" sun4 >/dev/null 2>&1 ||\n  as_fn_error \"cannot run $SHELL $ac_aux_dir/config.sub\" \"$LINENO\" 5\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking build system type\" >&5\n$as_echo_n \"checking build system type... \" >&6; }\nif test \"${ac_cv_build+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  ac_build_alias=$build_alias\ntest \"x$ac_build_alias\" = x &&\n  ac_build_alias=`$SHELL \"$ac_aux_dir/config.guess\"`\ntest \"x$ac_build_alias\" = x &&\n  as_fn_error \"cannot guess build type; you must specify one\" \"$LINENO\" 5\nac_cv_build=`$SHELL \"$ac_aux_dir/config.sub\" $ac_build_alias` ||\n  as_fn_error \"$SHELL $ac_aux_dir/config.sub $ac_build_alias failed\" \"$LINENO\" 5\n\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_build\" >&5\n$as_echo \"$ac_cv_build\" >&6; }\ncase $ac_cv_build in\n*-*-*) ;;\n*) as_fn_error \"invalid value of canonical build\" \"$LINENO\" 5;;\nesac\nbuild=$ac_cv_build\nac_save_IFS=$IFS; IFS='-'\nset x $ac_cv_build\nshift\nbuild_cpu=$1\nbuild_vendor=$2\nshift; shift\n# Remember, the first character of IFS is used to create $*,\n# except with old shells:\nbuild_os=$*\nIFS=$ac_save_IFS\ncase $build_os in *\\ *) build_os=`echo \"$build_os\" | sed 's/ /-/g'`;; esac\n\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking host system type\" >&5\n$as_echo_n \"checking host system type... \" >&6; }\nif test \"${ac_cv_host+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test \"x$host_alias\" = x; then\n  ac_cv_host=$ac_cv_build\nelse\n  ac_cv_host=`$SHELL \"$ac_aux_dir/config.sub\" $host_alias` ||\n    as_fn_error \"$SHELL $ac_aux_dir/config.sub $host_alias failed\" \"$LINENO\" 5\nfi\n\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_host\" >&5\n$as_echo \"$ac_cv_host\" >&6; }\ncase $ac_cv_host in\n*-*-*) ;;\n*) as_fn_error \"invalid value of canonical host\" \"$LINENO\" 5;;\nesac\nhost=$ac_cv_host\nac_save_IFS=$IFS; IFS='-'\nset x $ac_cv_host\nshift\nhost_cpu=$1\nhost_vendor=$2\nshift; shift\n# Remember, the first character of IFS is used to create $*,\n# except with old shells:\nhost_os=$*\nIFS=$ac_save_IFS\ncase $host_os in *\\ *) host_os=`echo \"$host_os\" | sed 's/ /-/g'`;; esac\n\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking target system type\" >&5\n$as_echo_n \"checking target system type... \" >&6; }\nif test \"${ac_cv_target+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test \"x$target_alias\" = x; then\n  ac_cv_target=$ac_cv_host\nelse\n  ac_cv_target=`$SHELL \"$ac_aux_dir/config.sub\" $target_alias` ||\n    as_fn_error \"$SHELL $ac_aux_dir/config.sub $target_alias failed\" \"$LINENO\" 5\nfi\n\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_target\" >&5\n$as_echo \"$ac_cv_target\" >&6; }\ncase $ac_cv_target in\n*-*-*) ;;\n*) as_fn_error \"invalid value of canonical target\" \"$LINENO\" 5;;\nesac\ntarget=$ac_cv_target\nac_save_IFS=$IFS; IFS='-'\nset x $ac_cv_target\nshift\ntarget_cpu=$1\ntarget_vendor=$2\nshift; shift\n# Remember, the first character of IFS is used to create $*,\n# except with old shells:\ntarget_os=$*\nIFS=$ac_save_IFS\ncase $target_os in *\\ *) target_os=`echo \"$target_os\" | sed 's/ /-/g'`;; esac\n\n\n# The aliases save the names the user supplied, while $host etc.\n# will get canonicalized.\ntest -n \"$target_alias\" &&\n  test \"$program_prefix$program_suffix$program_transform_name\" = \\\n    NONENONEs,x,x, &&\n  program_prefix=${target_alias}-\n\nam__api_version='1.11'\n\n# Find a good install program.  We prefer a C program (faster),\n# so one script is as good as another.  But avoid the broken or\n# incompatible versions:\n# SysV /etc/install, /usr/sbin/install\n# SunOS /usr/etc/install\n# IRIX /sbin/install\n# AIX /bin/install\n# AmigaOS /C/install, which installs bootblocks on floppy discs\n# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag\n# AFS /usr/afsws/bin/install, which mishandles nonexistent args\n# SVR4 /usr/ucb/install, which tries to use the nonexistent group \"staff\"\n# OS/2's system install, which has a completely different semantic\n# ./install, which can be erroneously created by make from ./install.sh.\n# Reject install programs that cannot install multiple files.\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install\" >&5\n$as_echo_n \"checking for a BSD-compatible install... \" >&6; }\nif test -z \"$INSTALL\"; then\nif test \"${ac_cv_path_install+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    # Account for people who put trailing slashes in PATH elements.\ncase $as_dir/ in #((\n  ./ | .// | /[cC]/* | \\\n  /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \\\n  ?:[\\\\/]os2[\\\\/]install[\\\\/]* | ?:[\\\\/]OS2[\\\\/]INSTALL[\\\\/]* | \\\n  /usr/ucb/* ) ;;\n  *)\n    # OSF1 and SCO ODT 3.0 have their own names for install.\n    # Don't use installbsd from OSF since it installs stuff as root\n    # by default.\n    for ac_prog in ginstall scoinst install; do\n      for ac_exec_ext in '' $ac_executable_extensions; do\n\tif { test -f \"$as_dir/$ac_prog$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_prog$ac_exec_ext\"; }; then\n\t  if test $ac_prog = install &&\n\t    grep dspmsg \"$as_dir/$ac_prog$ac_exec_ext\" >/dev/null 2>&1; then\n\t    # AIX install.  It has an incompatible calling convention.\n\t    :\n\t  elif test $ac_prog = install &&\n\t    grep pwplus \"$as_dir/$ac_prog$ac_exec_ext\" >/dev/null 2>&1; then\n\t    # program-specific install script used by HP pwplus--don't use.\n\t    :\n\t  else\n\t    rm -rf conftest.one conftest.two conftest.dir\n\t    echo one > conftest.one\n\t    echo two > conftest.two\n\t    mkdir conftest.dir\n\t    if \"$as_dir/$ac_prog$ac_exec_ext\" -c conftest.one conftest.two \"`pwd`/conftest.dir\" &&\n\t      test -s conftest.one && test -s conftest.two &&\n\t      test -s conftest.dir/conftest.one &&\n\t      test -s conftest.dir/conftest.two\n\t    then\n\t      ac_cv_path_install=\"$as_dir/$ac_prog$ac_exec_ext -c\"\n\t      break 3\n\t    fi\n\t  fi\n\tfi\n      done\n    done\n    ;;\nesac\n\n  done\nIFS=$as_save_IFS\n\nrm -rf conftest.one conftest.two conftest.dir\n\nfi\n  if test \"${ac_cv_path_install+set}\" = set; then\n    INSTALL=$ac_cv_path_install\n  else\n    # As a last resort, use the slow shell script.  Don't cache a\n    # value for INSTALL within a source directory, because that will\n    # break other packages using the cache if that directory is\n    # removed, or if the value is a relative name.\n    INSTALL=$ac_install_sh\n  fi\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $INSTALL\" >&5\n$as_echo \"$INSTALL\" >&6; }\n\n# Use test -z because SunOS4 sh mishandles braces in ${var-val}.\n# It thinks the first close brace ends the variable substitution.\ntest -z \"$INSTALL_PROGRAM\" && INSTALL_PROGRAM='${INSTALL}'\n\ntest -z \"$INSTALL_SCRIPT\" && INSTALL_SCRIPT='${INSTALL}'\n\ntest -z \"$INSTALL_DATA\" && INSTALL_DATA='${INSTALL} -m 644'\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking whether build environment is sane\" >&5\n$as_echo_n \"checking whether build environment is sane... \" >&6; }\n# Just in case\nsleep 1\necho timestamp > conftest.file\n# Reject unsafe characters in $srcdir or the absolute working directory\n# name.  Accept space and tab only in the latter.\nam_lf='\n'\ncase `pwd` in\n  *[\\\\\\\"\\#\\$\\&\\'\\`$am_lf]*)\n    as_fn_error \"unsafe absolute working directory name\" \"$LINENO\" 5;;\nesac\ncase $srcdir in\n  *[\\\\\\\"\\#\\$\\&\\'\\`$am_lf\\ \\\t]*)\n    as_fn_error \"unsafe srcdir value: \\`$srcdir'\" \"$LINENO\" 5;;\nesac\n\n# Do `set' in a subshell so we don't clobber the current shell's\n# arguments.  Must try -L first in case configure is actually a\n# symlink; some systems play weird games with the mod time of symlinks\n# (eg FreeBSD returns the mod time of the symlink's containing\n# directory).\nif (\n   set X `ls -Lt \"$srcdir/configure\" conftest.file 2> /dev/null`\n   if test \"$*\" = \"X\"; then\n      # -L didn't work.\n      set X `ls -t \"$srcdir/configure\" conftest.file`\n   fi\n   rm -f conftest.file\n   if test \"$*\" != \"X $srcdir/configure conftest.file\" \\\n      && test \"$*\" != \"X conftest.file $srcdir/configure\"; then\n\n      # If neither matched, then we have a broken ls.  This can happen\n      # if, for instance, CONFIG_SHELL is bash and it inherits a\n      # broken ls alias from the environment.  This has actually\n      # happened.  Such a system could not be considered \"sane\".\n      as_fn_error \"ls -t appears to fail.  Make sure there is not a broken\nalias in your environment\" \"$LINENO\" 5\n   fi\n\n   test \"$2\" = conftest.file\n   )\nthen\n   # Ok.\n   :\nelse\n   as_fn_error \"newly created file is older than distributed files!\nCheck your system clock\" \"$LINENO\" 5\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: yes\" >&5\n$as_echo \"yes\" >&6; }\ntest \"$program_prefix\" != NONE &&\n  program_transform_name=\"s&^&$program_prefix&;$program_transform_name\"\n# Use a double $ so make ignores it.\ntest \"$program_suffix\" != NONE &&\n  program_transform_name=\"s&\\$&$program_suffix&;$program_transform_name\"\n# Double any \\ or $.\n# By default was `s,x,x', remove it if useless.\nac_script='s/[\\\\$]/&&/g;s/;s,x,x,$//'\nprogram_transform_name=`$as_echo \"$program_transform_name\" | sed \"$ac_script\"`\n\n# expand $ac_aux_dir to an absolute path\nam_aux_dir=`cd $ac_aux_dir && pwd`\n\nif test x\"${MISSING+set}\" != xset; then\n  case $am_aux_dir in\n  *\\ * | *\\\t*)\n    MISSING=\"\\${SHELL} \\\"$am_aux_dir/missing\\\"\" ;;\n  *)\n    MISSING=\"\\${SHELL} $am_aux_dir/missing\" ;;\n  esac\nfi\n# Use eval to expand $SHELL\nif eval \"$MISSING --run true\"; then\n  am_missing_run=\"$MISSING --run \"\nelse\n  am_missing_run=\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: WARNING: \\`missing' script is too old or missing\" >&5\n$as_echo \"$as_me: WARNING: \\`missing' script is too old or missing\" >&2;}\nfi\n\nif test x\"${install_sh}\" != xset; then\n  case $am_aux_dir in\n  *\\ * | *\\\t*)\n    install_sh=\"\\${SHELL} '$am_aux_dir/install-sh'\" ;;\n  *)\n    install_sh=\"\\${SHELL} $am_aux_dir/install-sh\"\n  esac\nfi\n\n# Installed binaries are usually stripped using `strip' when the user\n# run `make install-strip'.  However `strip' might not be the right\n# tool to use in cross-compilation environments, therefore Automake\n# will honor the `STRIP' environment variable to overrule this program.\nif test \"$cross_compiling\" != no; then\n  if test -n \"$ac_tool_prefix\"; then\n  # Extract the first word of \"${ac_tool_prefix}strip\", so it can be a program name with args.\nset dummy ${ac_tool_prefix}strip; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif test \"${ac_cv_prog_STRIP+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$STRIP\"; then\n  ac_cv_prog_STRIP=\"$STRIP\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_STRIP=\"${ac_tool_prefix}strip\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nSTRIP=$ac_cv_prog_STRIP\nif test -n \"$STRIP\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $STRIP\" >&5\n$as_echo \"$STRIP\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n\nfi\nif test -z \"$ac_cv_prog_STRIP\"; then\n  ac_ct_STRIP=$STRIP\n  # Extract the first word of \"strip\", so it can be a program name with args.\nset dummy strip; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif test \"${ac_cv_prog_ac_ct_STRIP+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$ac_ct_STRIP\"; then\n  ac_cv_prog_ac_ct_STRIP=\"$ac_ct_STRIP\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_ac_ct_STRIP=\"strip\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP\nif test -n \"$ac_ct_STRIP\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP\" >&5\n$as_echo \"$ac_ct_STRIP\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n  if test \"x$ac_ct_STRIP\" = x; then\n    STRIP=\":\"\n  else\n    case $cross_compiling:$ac_tool_warned in\nyes:)\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet\" >&5\n$as_echo \"$as_me: WARNING: using cross tools not prefixed with host triplet\" >&2;}\nac_tool_warned=yes ;;\nesac\n    STRIP=$ac_ct_STRIP\n  fi\nelse\n  STRIP=\"$ac_cv_prog_STRIP\"\nfi\n\nfi\nINSTALL_STRIP_PROGRAM=\"\\$(install_sh) -c -s\"\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p\" >&5\n$as_echo_n \"checking for a thread-safe mkdir -p... \" >&6; }\nif test -z \"$MKDIR_P\"; then\n  if test \"${ac_cv_path_mkdir+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_prog in mkdir gmkdir; do\n\t for ac_exec_ext in '' $ac_executable_extensions; do\n\t   { test -f \"$as_dir/$ac_prog$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_prog$ac_exec_ext\"; } || continue\n\t   case `\"$as_dir/$ac_prog$ac_exec_ext\" --version 2>&1` in #(\n\t     'mkdir (GNU coreutils) '* | \\\n\t     'mkdir (coreutils) '* | \\\n\t     'mkdir (fileutils) '4.1*)\n\t       ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext\n\t       break 3;;\n\t   esac\n\t done\n       done\n  done\nIFS=$as_save_IFS\n\nfi\n\n  if test \"${ac_cv_path_mkdir+set}\" = set; then\n    MKDIR_P=\"$ac_cv_path_mkdir -p\"\n  else\n    # As a last resort, use the slow shell script.  Don't cache a\n    # value for MKDIR_P within a source directory, because that will\n    # break other packages using the cache if that directory is\n    # removed, or if the value is a relative name.\n    test -d ./--version && rmdir ./--version\n    MKDIR_P=\"$ac_install_sh -d\"\n  fi\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $MKDIR_P\" >&5\n$as_echo \"$MKDIR_P\" >&6; }\n\nmkdir_p=\"$MKDIR_P\"\ncase $mkdir_p in\n  [\\\\/$]* | ?:[\\\\/]*) ;;\n  */*) mkdir_p=\"\\$(top_builddir)/$mkdir_p\" ;;\nesac\n\nfor ac_prog in gawk mawk nawk awk\ndo\n  # Extract the first word of \"$ac_prog\", so it can be a program name with args.\nset dummy $ac_prog; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif test \"${ac_cv_prog_AWK+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$AWK\"; then\n  ac_cv_prog_AWK=\"$AWK\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_AWK=\"$ac_prog\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nAWK=$ac_cv_prog_AWK\nif test -n \"$AWK\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $AWK\" >&5\n$as_echo \"$AWK\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n\n  test -n \"$AWK\" && break\ndone\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \\$(MAKE)\" >&5\n$as_echo_n \"checking whether ${MAKE-make} sets \\$(MAKE)... \" >&6; }\nset x ${MAKE-make}\nac_make=`$as_echo \"$2\" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`\nif { as_var=ac_cv_prog_make_${ac_make}_set; eval \"test \\\"\\${$as_var+set}\\\" = set\"; }; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  cat >conftest.make <<\\_ACEOF\nSHELL = /bin/sh\nall:\n\t@echo '@@@%%%=$(MAKE)=@@@%%%'\n_ACEOF\n# GNU make sometimes prints \"make[1]: Entering...\", which would confuse us.\ncase `${MAKE-make} -f conftest.make 2>/dev/null` in\n  *@@@%%%=?*=@@@%%%*)\n    eval ac_cv_prog_make_${ac_make}_set=yes;;\n  *)\n    eval ac_cv_prog_make_${ac_make}_set=no;;\nesac\nrm -f conftest.make\nfi\nif eval test \\$ac_cv_prog_make_${ac_make}_set = yes; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: yes\" >&5\n$as_echo \"yes\" >&6; }\n  SET_MAKE=\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\n  SET_MAKE=\"MAKE=${MAKE-make}\"\nfi\n\nrm -rf .tst 2>/dev/null\nmkdir .tst 2>/dev/null\nif test -d .tst; then\n  am__leading_dot=.\nelse\n  am__leading_dot=_\nfi\nrmdir .tst 2>/dev/null\n\nif test \"`cd $srcdir && pwd`\" != \"`pwd`\"; then\n  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output\n  # is not polluted with repeated \"-I.\"\n  am__isrc=' -I$(srcdir)'\n  # test to see if srcdir already configured\n  if test -f $srcdir/config.status; then\n    as_fn_error \"source directory already configured; run \\\"make distclean\\\" there first\" \"$LINENO\" 5\n  fi\nfi\n\n# test whether we have cygpath\nif test -z \"$CYGPATH_W\"; then\n  if (cygpath --version) >/dev/null 2>/dev/null; then\n    CYGPATH_W='cygpath -w'\n  else\n    CYGPATH_W=echo\n  fi\nfi\n\n\n# Define the identity of the package.\n PACKAGE='tiff'\n VERSION='3.9.2'\n\n\ncat >>confdefs.h <<_ACEOF\n#define PACKAGE \"$PACKAGE\"\n_ACEOF\n\n\ncat >>confdefs.h <<_ACEOF\n#define VERSION \"$VERSION\"\n_ACEOF\n\n# Some tools Automake needs.\n\nACLOCAL=${ACLOCAL-\"${am_missing_run}aclocal-${am__api_version}\"}\n\n\nAUTOCONF=${AUTOCONF-\"${am_missing_run}autoconf\"}\n\n\nAUTOMAKE=${AUTOMAKE-\"${am_missing_run}automake-${am__api_version}\"}\n\n\nAUTOHEADER=${AUTOHEADER-\"${am_missing_run}autoheader\"}\n\n\nMAKEINFO=${MAKEINFO-\"${am_missing_run}makeinfo\"}\n\n# We need awk for the \"check\" target.  The system \"awk\" is bad on\n# some platforms.\n# Always define AMTAR for backward compatibility.\n\nAMTAR=${AMTAR-\"${am_missing_run}tar\"}\n\nam__tar='${AMTAR} chof - \"$$tardir\"'; am__untar='${AMTAR} xf -'\n\n\n\n\n\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles\" >&5\n$as_echo_n \"checking whether to enable maintainer-specific portions of Makefiles... \" >&6; }\n    # Check whether --enable-maintainer-mode was given.\nif test \"${enable_maintainer_mode+set}\" = set; then :\n  enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval\nelse\n  USE_MAINTAINER_MODE=no\nfi\n\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE\" >&5\n$as_echo \"$USE_MAINTAINER_MODE\" >&6; }\n   if test $USE_MAINTAINER_MODE = yes; then\n  MAINTAINER_MODE_TRUE=\n  MAINTAINER_MODE_FALSE='#'\nelse\n  MAINTAINER_MODE_TRUE='#'\n  MAINTAINER_MODE_FALSE=\nfi\n\n  MAINT=$MAINTAINER_MODE_TRUE\n\n\n\nLIBTIFF_MAJOR_VERSION=3\nLIBTIFF_MINOR_VERSION=9\nLIBTIFF_MICRO_VERSION=2\nLIBTIFF_ALPHA_VERSION=\nLIBTIFF_VERSION=$LIBTIFF_MAJOR_VERSION.$LIBTIFF_MINOR_VERSION.$LIBTIFF_MICRO_VERSION$LIBTIFF_ALPHA_VERSION\nLIBTIFF_RELEASE_DATE=`date +\"%Y%m%d\"`\n\n# This is a special hack for OpenBSD and MirOS systems. The dynamic linker\n# in OpenBSD uses some special semantics for shared libraries. Their soname\n# contains only two numbers, major and minor.\n# See http://bugzilla.remotesensing.org/show_bug.cgi?id=838 for details.\ncase \"$target_os\" in\n    openbsd* | mirbsd*)\n\tLIBTIFF_VERSION_INFO=$LIBTIFF_MAJOR_VERSION$LIBTIFF_MINOR_VERSION:$LIBTIFF_MICRO_VERSION:0\n\t;;\n    *)\n\tLIBTIFF_VERSION_INFO=$LIBTIFF_MAJOR_VERSION:$LIBTIFF_MINOR_VERSION:$LIBTIFF_MICRO_VERSION\n\t;;\nesac\n\n\n\n\n\n\n\n\n\n# Ensure that make can run correctly\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking whether build environment is sane\" >&5\n$as_echo_n \"checking whether build environment is sane... \" >&6; }\n# Just in case\nsleep 1\necho timestamp > conftest.file\n# Reject unsafe characters in $srcdir or the absolute working directory\n# name.  Accept space and tab only in the latter.\nam_lf='\n'\ncase `pwd` in\n  *[\\\\\\\"\\#\\$\\&\\'\\`$am_lf]*)\n    as_fn_error \"unsafe absolute working directory name\" \"$LINENO\" 5;;\nesac\ncase $srcdir in\n  *[\\\\\\\"\\#\\$\\&\\'\\`$am_lf\\ \\\t]*)\n    as_fn_error \"unsafe srcdir value: \\`$srcdir'\" \"$LINENO\" 5;;\nesac\n\n# Do `set' in a subshell so we don't clobber the current shell's\n# arguments.  Must try -L first in case configure is actually a\n# symlink; some systems play weird games with the mod time of symlinks\n# (eg FreeBSD returns the mod time of the symlink's containing\n# directory).\nif (\n   set X `ls -Lt \"$srcdir/configure\" conftest.file 2> /dev/null`\n   if test \"$*\" = \"X\"; then\n      # -L didn't work.\n      set X `ls -t \"$srcdir/configure\" conftest.file`\n   fi\n   rm -f conftest.file\n   if test \"$*\" != \"X $srcdir/configure conftest.file\" \\\n      && test \"$*\" != \"X conftest.file $srcdir/configure\"; then\n\n      # If neither matched, then we have a broken ls.  This can happen\n      # if, for instance, CONFIG_SHELL is bash and it inherits a\n      # broken ls alias from the environment.  This has actually\n      # happened.  Such a system could not be considered \"sane\".\n      as_fn_error \"ls -t appears to fail.  Make sure there is not a broken\nalias in your environment\" \"$LINENO\" 5\n   fi\n\n   test \"$2\" = conftest.file\n   )\nthen\n   # Ok.\n   :\nelse\n   as_fn_error \"newly created file is older than distributed files!\nCheck your system clock\" \"$LINENO\" 5\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: yes\" >&5\n$as_echo \"yes\" >&6; }\n\nac_ext=c\nac_cpp='$CPP $CPPFLAGS'\nac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'\nac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'\nac_compiler_gnu=$ac_cv_c_compiler_gnu\nif test -n \"$ac_tool_prefix\"; then\n  # Extract the first word of \"${ac_tool_prefix}gcc\", so it can be a program name with args.\nset dummy ${ac_tool_prefix}gcc; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif test \"${ac_cv_prog_CC+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$CC\"; then\n  ac_cv_prog_CC=\"$CC\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_CC=\"${ac_tool_prefix}gcc\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nCC=$ac_cv_prog_CC\nif test -n \"$CC\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $CC\" >&5\n$as_echo \"$CC\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n\nfi\nif test -z \"$ac_cv_prog_CC\"; then\n  ac_ct_CC=$CC\n  # Extract the first word of \"gcc\", so it can be a program name with args.\nset dummy gcc; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif test \"${ac_cv_prog_ac_ct_CC+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$ac_ct_CC\"; then\n  ac_cv_prog_ac_ct_CC=\"$ac_ct_CC\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_ac_ct_CC=\"gcc\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nac_ct_CC=$ac_cv_prog_ac_ct_CC\nif test -n \"$ac_ct_CC\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC\" >&5\n$as_echo \"$ac_ct_CC\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n  if test \"x$ac_ct_CC\" = x; then\n    CC=\"\"\n  else\n    case $cross_compiling:$ac_tool_warned in\nyes:)\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet\" >&5\n$as_echo \"$as_me: WARNING: using cross tools not prefixed with host triplet\" >&2;}\nac_tool_warned=yes ;;\nesac\n    CC=$ac_ct_CC\n  fi\nelse\n  CC=\"$ac_cv_prog_CC\"\nfi\n\nif test -z \"$CC\"; then\n          if test -n \"$ac_tool_prefix\"; then\n    # Extract the first word of \"${ac_tool_prefix}cc\", so it can be a program name with args.\nset dummy ${ac_tool_prefix}cc; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif test \"${ac_cv_prog_CC+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$CC\"; then\n  ac_cv_prog_CC=\"$CC\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_CC=\"${ac_tool_prefix}cc\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nCC=$ac_cv_prog_CC\nif test -n \"$CC\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $CC\" >&5\n$as_echo \"$CC\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n\n  fi\nfi\nif test -z \"$CC\"; then\n  # Extract the first word of \"cc\", so it can be a program name with args.\nset dummy cc; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif test \"${ac_cv_prog_CC+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$CC\"; then\n  ac_cv_prog_CC=\"$CC\" # Let the user override the test.\nelse\n  ac_prog_rejected=no\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    if test \"$as_dir/$ac_word$ac_exec_ext\" = \"/usr/ucb/cc\"; then\n       ac_prog_rejected=yes\n       continue\n     fi\n    ac_cv_prog_CC=\"cc\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nif test $ac_prog_rejected = yes; then\n  # We found a bogon in the path, so make sure we never use it.\n  set dummy $ac_cv_prog_CC\n  shift\n  if test $# != 0; then\n    # We chose a different compiler from the bogus one.\n    # However, it has the same basename, so the bogon will be chosen\n    # first if we set CC to just the basename; use the full file name.\n    shift\n    ac_cv_prog_CC=\"$as_dir/$ac_word${1+' '}$@\"\n  fi\nfi\nfi\nfi\nCC=$ac_cv_prog_CC\nif test -n \"$CC\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $CC\" >&5\n$as_echo \"$CC\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n\nfi\nif test -z \"$CC\"; then\n  if test -n \"$ac_tool_prefix\"; then\n  for ac_prog in cl.exe\n  do\n    # Extract the first word of \"$ac_tool_prefix$ac_prog\", so it can be a program name with args.\nset dummy $ac_tool_prefix$ac_prog; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif test \"${ac_cv_prog_CC+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$CC\"; then\n  ac_cv_prog_CC=\"$CC\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_CC=\"$ac_tool_prefix$ac_prog\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nCC=$ac_cv_prog_CC\nif test -n \"$CC\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $CC\" >&5\n$as_echo \"$CC\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n\n    test -n \"$CC\" && break\n  done\nfi\nif test -z \"$CC\"; then\n  ac_ct_CC=$CC\n  for ac_prog in cl.exe\ndo\n  # Extract the first word of \"$ac_prog\", so it can be a program name with args.\nset dummy $ac_prog; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif test \"${ac_cv_prog_ac_ct_CC+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$ac_ct_CC\"; then\n  ac_cv_prog_ac_ct_CC=\"$ac_ct_CC\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_ac_ct_CC=\"$ac_prog\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nac_ct_CC=$ac_cv_prog_ac_ct_CC\nif test -n \"$ac_ct_CC\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC\" >&5\n$as_echo \"$ac_ct_CC\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n\n  test -n \"$ac_ct_CC\" && break\ndone\n\n  if test \"x$ac_ct_CC\" = x; then\n    CC=\"\"\n  else\n    case $cross_compiling:$ac_tool_warned in\nyes:)\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet\" >&5\n$as_echo \"$as_me: WARNING: using cross tools not prefixed with host triplet\" >&2;}\nac_tool_warned=yes ;;\nesac\n    CC=$ac_ct_CC\n  fi\nfi\n\nfi\n\n\ntest -z \"$CC\" && { { $as_echo \"$as_me:${as_lineno-$LINENO}: error: in \\`$ac_pwd':\" >&5\n$as_echo \"$as_me: error: in \\`$ac_pwd':\" >&2;}\nas_fn_error \"no acceptable C compiler found in \\$PATH\nSee \\`config.log' for more details.\" \"$LINENO\" 5; }\n\n# Provide some information about the compiler.\n$as_echo \"$as_me:${as_lineno-$LINENO}: checking for C compiler version\" >&5\nset X $ac_compile\nac_compiler=$2\nfor ac_option in --version -v -V -qversion; do\n  { { ac_try=\"$ac_compiler $ac_option >&5\"\ncase \"(($ac_try\" in\n  *\\\"* | *\\`* | *\\\\*) ac_try_echo=\\$ac_try;;\n  *) ac_try_echo=$ac_try;;\nesac\neval ac_try_echo=\"\\\"\\$as_me:${as_lineno-$LINENO}: $ac_try_echo\\\"\"\n$as_echo \"$ac_try_echo\"; } >&5\n  (eval \"$ac_compiler $ac_option >&5\") 2>conftest.err\n  ac_status=$?\n  if test -s conftest.err; then\n    sed '10a\\\n... rest of stderr output deleted ...\n         10q' conftest.err >conftest.er1\n    cat conftest.er1 >&5\n    rm -f conftest.er1 conftest.err\n  fi\n  $as_echo \"$as_me:${as_lineno-$LINENO}: \\$? = $ac_status\" >&5\n  test $ac_status = 0; }\ndone\n\ncat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n#include <stdio.h>\nint\nmain ()\n{\nFILE *f = fopen (\"conftest.out\", \"w\");\n return ferror (f) || fclose (f) != 0;\n\n  ;\n  return 0;\n}\n_ACEOF\nac_clean_files_save=$ac_clean_files\nac_clean_files=\"$ac_clean_files a.out a.out.dSYM a.exe b.out conftest.out\"\n# Try to create an executable without -o first, disregard a.out.\n# It will help us diagnose broken compilers, and finding out an intuition\n# of exeext.\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name\" >&5\n$as_echo_n \"checking for C compiler default output file name... \" >&6; }\nac_link_default=`$as_echo \"$ac_link\" | sed 's/ -o *conftest[^ ]*//'`\n\n# The possible output files:\nac_files=\"a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*\"\n\nac_rmfiles=\nfor ac_file in $ac_files\ndo\n  case $ac_file in\n    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;\n    * ) ac_rmfiles=\"$ac_rmfiles $ac_file\";;\n  esac\ndone\nrm -f $ac_rmfiles\n\nif { { ac_try=\"$ac_link_default\"\ncase \"(($ac_try\" in\n  *\\\"* | *\\`* | *\\\\*) ac_try_echo=\\$ac_try;;\n  *) ac_try_echo=$ac_try;;\nesac\neval ac_try_echo=\"\\\"\\$as_me:${as_lineno-$LINENO}: $ac_try_echo\\\"\"\n$as_echo \"$ac_try_echo\"; } >&5\n  (eval \"$ac_link_default\") 2>&5\n  ac_status=$?\n  $as_echo \"$as_me:${as_lineno-$LINENO}: \\$? = $ac_status\" >&5\n  test $ac_status = 0; }; then :\n  # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.\n# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'\n# in a Makefile.  We should not override ac_cv_exeext if it was cached,\n# so that the user can short-circuit this test for compilers unknown to\n# Autoconf.\nfor ac_file in $ac_files ''\ndo\n  test -f \"$ac_file\" || continue\n  case $ac_file in\n    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )\n\t;;\n    [ab].out )\n\t# We found the default executable, but exeext='' is most\n\t# certainly right.\n\tbreak;;\n    *.* )\n\tif test \"${ac_cv_exeext+set}\" = set && test \"$ac_cv_exeext\" != no;\n\tthen :; else\n\t   ac_cv_exeext=`expr \"$ac_file\" : '[^.]*\\(\\..*\\)'`\n\tfi\n\t# We set ac_cv_exeext here because the later test for it is not\n\t# safe: cross compilers may not add the suffix if given an `-o'\n\t# argument, so we may need to know it at that point already.\n\t# Even if this section looks crufty: it has the advantage of\n\t# actually working.\n\tbreak;;\n    * )\n\tbreak;;\n  esac\ndone\ntest \"$ac_cv_exeext\" = no && ac_cv_exeext=\n\nelse\n  ac_file=''\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_file\" >&5\n$as_echo \"$ac_file\" >&6; }\nif test -z \"$ac_file\"; then :\n  $as_echo \"$as_me: failed program was:\" >&5\nsed 's/^/| /' conftest.$ac_ext >&5\n\n{ { $as_echo \"$as_me:${as_lineno-$LINENO}: error: in \\`$ac_pwd':\" >&5\n$as_echo \"$as_me: error: in \\`$ac_pwd':\" >&2;}\n{ as_fn_set_status 77\nas_fn_error \"C compiler cannot create executables\nSee \\`config.log' for more details.\" \"$LINENO\" 5; }; }\nfi\nac_exeext=$ac_cv_exeext\n\n# Check that the compiler produces executables we can run.  If not, either\n# the compiler is broken, or we cross compile.\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking whether the C compiler works\" >&5\n$as_echo_n \"checking whether the C compiler works... \" >&6; }\n# If not cross compiling, check that we can run a simple program.\nif test \"$cross_compiling\" != yes; then\n  if { ac_try='./$ac_file'\n  { { case \"(($ac_try\" in\n  *\\\"* | *\\`* | *\\\\*) ac_try_echo=\\$ac_try;;\n  *) ac_try_echo=$ac_try;;\nesac\neval ac_try_echo=\"\\\"\\$as_me:${as_lineno-$LINENO}: $ac_try_echo\\\"\"\n$as_echo \"$ac_try_echo\"; } >&5\n  (eval \"$ac_try\") 2>&5\n  ac_status=$?\n  $as_echo \"$as_me:${as_lineno-$LINENO}: \\$? = $ac_status\" >&5\n  test $ac_status = 0; }; }; then\n    cross_compiling=no\n  else\n    if test \"$cross_compiling\" = maybe; then\n\tcross_compiling=yes\n    else\n\t{ { $as_echo \"$as_me:${as_lineno-$LINENO}: error: in \\`$ac_pwd':\" >&5\n$as_echo \"$as_me: error: in \\`$ac_pwd':\" >&2;}\nas_fn_error \"cannot run C compiled programs.\nIf you meant to cross compile, use \\`--host'.\nSee \\`config.log' for more details.\" \"$LINENO\" 5; }\n    fi\n  fi\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: yes\" >&5\n$as_echo \"yes\" >&6; }\n\nrm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out conftest.out\nac_clean_files=$ac_clean_files_save\n# Check that the compiler produces executables we can run.  If not, either\n# the compiler is broken, or we cross compile.\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling\" >&5\n$as_echo_n \"checking whether we are cross compiling... \" >&6; }\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $cross_compiling\" >&5\n$as_echo \"$cross_compiling\" >&6; }\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for suffix of executables\" >&5\n$as_echo_n \"checking for suffix of executables... \" >&6; }\nif { { ac_try=\"$ac_link\"\ncase \"(($ac_try\" in\n  *\\\"* | *\\`* | *\\\\*) ac_try_echo=\\$ac_try;;\n  *) ac_try_echo=$ac_try;;\nesac\neval ac_try_echo=\"\\\"\\$as_me:${as_lineno-$LINENO}: $ac_try_echo\\\"\"\n$as_echo \"$ac_try_echo\"; } >&5\n  (eval \"$ac_link\") 2>&5\n  ac_status=$?\n  $as_echo \"$as_me:${as_lineno-$LINENO}: \\$? = $ac_status\" >&5\n  test $ac_status = 0; }; then :\n  # If both `conftest.exe' and `conftest' are `present' (well, observable)\n# catch `conftest.exe'.  For instance with Cygwin, `ls conftest' will\n# work properly (i.e., refer to `conftest.exe'), while it won't with\n# `rm'.\nfor ac_file in conftest.exe conftest conftest.*; do\n  test -f \"$ac_file\" || continue\n  case $ac_file in\n    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;\n    *.* ) ac_cv_exeext=`expr \"$ac_file\" : '[^.]*\\(\\..*\\)'`\n\t  break;;\n    * ) break;;\n  esac\ndone\nelse\n  { { $as_echo \"$as_me:${as_lineno-$LINENO}: error: in \\`$ac_pwd':\" >&5\n$as_echo \"$as_me: error: in \\`$ac_pwd':\" >&2;}\nas_fn_error \"cannot compute suffix of executables: cannot compile and link\nSee \\`config.log' for more details.\" \"$LINENO\" 5; }\nfi\nrm -f conftest$ac_cv_exeext\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext\" >&5\n$as_echo \"$ac_cv_exeext\" >&6; }\n\nrm -f conftest.$ac_ext\nEXEEXT=$ac_cv_exeext\nac_exeext=$EXEEXT\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for suffix of object files\" >&5\n$as_echo_n \"checking for suffix of object files... \" >&6; }\nif test \"${ac_cv_objext+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\nint\nmain ()\n{\n\n  ;\n  return 0;\n}\n_ACEOF\nrm -f conftest.o conftest.obj\nif { { ac_try=\"$ac_compile\"\ncase \"(($ac_try\" in\n  *\\\"* | *\\`* | *\\\\*) ac_try_echo=\\$ac_try;;\n  *) ac_try_echo=$ac_try;;\nesac\neval ac_try_echo=\"\\\"\\$as_me:${as_lineno-$LINENO}: $ac_try_echo\\\"\"\n$as_echo \"$ac_try_echo\"; } >&5\n  (eval \"$ac_compile\") 2>&5\n  ac_status=$?\n  $as_echo \"$as_me:${as_lineno-$LINENO}: \\$? = $ac_status\" >&5\n  test $ac_status = 0; }; then :\n  for ac_file in conftest.o conftest.obj conftest.*; do\n  test -f \"$ac_file\" || continue;\n  case $ac_file in\n    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;\n    *) ac_cv_objext=`expr \"$ac_file\" : '.*\\.\\(.*\\)'`\n       break;;\n  esac\ndone\nelse\n  $as_echo \"$as_me: failed program was:\" >&5\nsed 's/^/| /' conftest.$ac_ext >&5\n\n{ { $as_echo \"$as_me:${as_lineno-$LINENO}: error: in \\`$ac_pwd':\" >&5\n$as_echo \"$as_me: error: in \\`$ac_pwd':\" >&2;}\nas_fn_error \"cannot compute suffix of object files: cannot compile\nSee \\`config.log' for more details.\" \"$LINENO\" 5; }\nfi\nrm -f conftest.$ac_cv_objext conftest.$ac_ext\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext\" >&5\n$as_echo \"$ac_cv_objext\" >&6; }\nOBJEXT=$ac_cv_objext\nac_objext=$OBJEXT\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler\" >&5\n$as_echo_n \"checking whether we are using the GNU C compiler... \" >&6; }\nif test \"${ac_cv_c_compiler_gnu+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\nint\nmain ()\n{\n#ifndef __GNUC__\n       choke me\n#endif\n\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_compile \"$LINENO\"; then :\n  ac_compiler_gnu=yes\nelse\n  ac_compiler_gnu=no\nfi\nrm -f core conftest.err conftest.$ac_objext conftest.$ac_ext\nac_cv_c_compiler_gnu=$ac_compiler_gnu\n\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu\" >&5\n$as_echo \"$ac_cv_c_compiler_gnu\" >&6; }\nif test $ac_compiler_gnu = yes; then\n  GCC=yes\nelse\n  GCC=\nfi\nac_test_CFLAGS=${CFLAGS+set}\nac_save_CFLAGS=$CFLAGS\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g\" >&5\n$as_echo_n \"checking whether $CC accepts -g... \" >&6; }\nif test \"${ac_cv_prog_cc_g+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  ac_save_c_werror_flag=$ac_c_werror_flag\n   ac_c_werror_flag=yes\n   ac_cv_prog_cc_g=no\n   CFLAGS=\"-g\"\n   cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\nint\nmain ()\n{\n\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_compile \"$LINENO\"; then :\n  ac_cv_prog_cc_g=yes\nelse\n  CFLAGS=\"\"\n      cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\nint\nmain ()\n{\n\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_compile \"$LINENO\"; then :\n\nelse\n  ac_c_werror_flag=$ac_save_c_werror_flag\n\t CFLAGS=\"-g\"\n\t cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\nint\nmain ()\n{\n\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_compile \"$LINENO\"; then :\n  ac_cv_prog_cc_g=yes\nfi\nrm -f core conftest.err conftest.$ac_objext conftest.$ac_ext\nfi\nrm -f core conftest.err conftest.$ac_objext conftest.$ac_ext\nfi\nrm -f core conftest.err conftest.$ac_objext conftest.$ac_ext\n   ac_c_werror_flag=$ac_save_c_werror_flag\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g\" >&5\n$as_echo \"$ac_cv_prog_cc_g\" >&6; }\nif test \"$ac_test_CFLAGS\" = set; then\n  CFLAGS=$ac_save_CFLAGS\nelif test $ac_cv_prog_cc_g = yes; then\n  if test \"$GCC\" = yes; then\n    CFLAGS=\"-g -O2\"\n  else\n    CFLAGS=\"-g\"\n  fi\nelse\n  if test \"$GCC\" = yes; then\n    CFLAGS=\"-O2\"\n  else\n    CFLAGS=\n  fi\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89\" >&5\n$as_echo_n \"checking for $CC option to accept ISO C89... \" >&6; }\nif test \"${ac_cv_prog_cc_c89+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  ac_cv_prog_cc_c89=no\nac_save_CC=$CC\ncat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n#include <stdarg.h>\n#include <stdio.h>\n#include <sys/types.h>\n#include <sys/stat.h>\n/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */\nstruct buf { int x; };\nFILE * (*rcsopen) (struct buf *, struct stat *, int);\nstatic char *e (p, i)\n     char **p;\n     int i;\n{\n  return p[i];\n}\nstatic char *f (char * (*g) (char **, int), char **p, ...)\n{\n  char *s;\n  va_list v;\n  va_start (v,p);\n  s = g (p, va_arg (v,int));\n  va_end (v);\n  return s;\n}\n\n/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has\n   function prototypes and stuff, but not '\\xHH' hex character constants.\n   These don't provoke an error unfortunately, instead are silently treated\n   as 'x'.  The following induces an error, until -std is added to get\n   proper ANSI mode.  Curiously '\\x00'!='x' always comes out true, for an\n   array size at least.  It's necessary to write '\\x00'==0 to get something\n   that's true only with -std.  */\nint osf4_cc_array ['\\x00' == 0 ? 1 : -1];\n\n/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters\n   inside strings and character constants.  */\n#define FOO(x) 'x'\nint xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];\n\nint test (int i, double x);\nstruct s1 {int (*f) (int a);};\nstruct s2 {int (*f) (double a);};\nint pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);\nint argc;\nchar **argv;\nint\nmain ()\n{\nreturn f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];\n  ;\n  return 0;\n}\n_ACEOF\nfor ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \\\n\t-Ae \"-Aa -D_HPUX_SOURCE\" \"-Xc -D__EXTENSIONS__\"\ndo\n  CC=\"$ac_save_CC $ac_arg\"\n  if ac_fn_c_try_compile \"$LINENO\"; then :\n  ac_cv_prog_cc_c89=$ac_arg\nfi\nrm -f core conftest.err conftest.$ac_objext\n  test \"x$ac_cv_prog_cc_c89\" != \"xno\" && break\ndone\nrm -f conftest.$ac_ext\nCC=$ac_save_CC\n\nfi\n# AC_CACHE_VAL\ncase \"x$ac_cv_prog_cc_c89\" in\n  x)\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: result: none needed\" >&5\n$as_echo \"none needed\" >&6; } ;;\n  xno)\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: result: unsupported\" >&5\n$as_echo \"unsupported\" >&6; } ;;\n  *)\n    CC=\"$CC $ac_cv_prog_cc_c89\"\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89\" >&5\n$as_echo \"$ac_cv_prog_cc_c89\" >&6; } ;;\nesac\nif test \"x$ac_cv_prog_cc_c89\" != xno; then :\n\nfi\n\nac_ext=c\nac_cpp='$CPP $CPPFLAGS'\nac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'\nac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'\nac_compiler_gnu=$ac_cv_c_compiler_gnu\nDEPDIR=\"${am__leading_dot}deps\"\n\nac_config_commands=\"$ac_config_commands depfiles\"\n\n\nam_make=${MAKE-make}\ncat > confinc << 'END'\nam__doit:\n\t@echo this is the am__doit target\n.PHONY: am__doit\nEND\n# If we don't find an include directive, just comment out the code.\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make\" >&5\n$as_echo_n \"checking for style of include used by $am_make... \" >&6; }\nam__include=\"#\"\nam__quote=\n_am_result=none\n# First try GNU make style include.\necho \"include confinc\" > confmf\n# Ignore all kinds of additional output from `make'.\ncase `$am_make -s -f confmf 2> /dev/null` in #(\n*the\\ am__doit\\ target*)\n  am__include=include\n  am__quote=\n  _am_result=GNU\n  ;;\nesac\n# Now try BSD make style include.\nif test \"$am__include\" = \"#\"; then\n   echo '.include \"confinc\"' > confmf\n   case `$am_make -s -f confmf 2> /dev/null` in #(\n   *the\\ am__doit\\ target*)\n     am__include=.include\n     am__quote=\"\\\"\"\n     _am_result=BSD\n     ;;\n   esac\nfi\n\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $_am_result\" >&5\n$as_echo \"$_am_result\" >&6; }\nrm -f confinc confmf\n\n# Check whether --enable-dependency-tracking was given.\nif test \"${enable_dependency_tracking+set}\" = set; then :\n  enableval=$enable_dependency_tracking;\nfi\n\nif test \"x$enable_dependency_tracking\" != xno; then\n  am_depcomp=\"$ac_aux_dir/depcomp\"\n  AMDEPBACKSLASH='\\'\nfi\n if test \"x$enable_dependency_tracking\" != xno; then\n  AMDEP_TRUE=\n  AMDEP_FALSE='#'\nelse\n  AMDEP_TRUE='#'\n  AMDEP_FALSE=\nfi\n\n\n\ndepcc=\"$CC\"   am_compiler_list=\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc\" >&5\n$as_echo_n \"checking dependency style of $depcc... \" >&6; }\nif test \"${am_cv_CC_dependencies_compiler_type+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -z \"$AMDEP_TRUE\" && test -f \"$am_depcomp\"; then\n  # We make a subdir and do the tests there.  Otherwise we can end up\n  # making bogus files that we don't know about and never remove.  For\n  # instance it was reported that on HP-UX the gcc test will end up\n  # making a dummy file named `D' -- because `-MD' means `put the output\n  # in D'.\n  mkdir conftest.dir\n  # Copy depcomp to subdir because otherwise we won't find it if we're\n  # using a relative directory.\n  cp \"$am_depcomp\" conftest.dir\n  cd conftest.dir\n  # We will build objects and dependencies in a subdirectory because\n  # it helps to detect inapplicable dependency modes.  For instance\n  # both Tru64's cc and ICC support -MD to output dependencies as a\n  # side effect of compilation, but ICC will put the dependencies in\n  # the current directory while Tru64 will put them in the object\n  # directory.\n  mkdir sub\n\n  am_cv_CC_dependencies_compiler_type=none\n  if test \"$am_compiler_list\" = \"\"; then\n     am_compiler_list=`sed -n 's/^#*\\([a-zA-Z0-9]*\\))$/\\1/p' < ./depcomp`\n  fi\n  am__universal=false\n  case \" $depcc \" in #(\n     *\\ -arch\\ *\\ -arch\\ *) am__universal=true ;;\n     esac\n\n  for depmode in $am_compiler_list; do\n    # Setup a source with many dependencies, because some compilers\n    # like to wrap large dependency lists on column 80 (with \\), and\n    # we should not choose a depcomp mode which is confused by this.\n    #\n    # We need to recreate these files for each test, as the compiler may\n    # overwrite some of them when testing with obscure command lines.\n    # This happens at least with the AIX C compiler.\n    : > sub/conftest.c\n    for i in 1 2 3 4 5 6; do\n      echo '#include \"conftst'$i'.h\"' >> sub/conftest.c\n      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with\n      # Solaris 8's {/usr,}/bin/sh.\n      touch sub/conftst$i.h\n    done\n    echo \"${am__include} ${am__quote}sub/conftest.Po${am__quote}\" > confmf\n\n    # We check with `-c' and `-o' for the sake of the \"dashmstdout\"\n    # mode.  It turns out that the SunPro C++ compiler does not properly\n    # handle `-M -o', and we need to detect this.  Also, some Intel\n    # versions had trouble with output in subdirs\n    am__obj=sub/conftest.${OBJEXT-o}\n    am__minus_obj=\"-o $am__obj\"\n    case $depmode in\n    gcc)\n      # This depmode causes a compiler race in universal mode.\n      test \"$am__universal\" = false || continue\n      ;;\n    nosideeffect)\n      # after this tag, mechanisms are not by side-effect, so they'll\n      # only be used when explicitly requested\n      if test \"x$enable_dependency_tracking\" = xyes; then\n\tcontinue\n      else\n\tbreak\n      fi\n      ;;\n    msvisualcpp | msvcmsys)\n      # This compiler won't grok `-c -o', but also, the minuso test has\n      # not run yet.  These depmodes are late enough in the game, and\n      # so weak that their functioning should not be impacted.\n      am__obj=conftest.${OBJEXT-o}\n      am__minus_obj=\n      ;;\n    none) break ;;\n    esac\n    if depmode=$depmode \\\n       source=sub/conftest.c object=$am__obj \\\n       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \\\n       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \\\n         >/dev/null 2>conftest.err &&\n       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&\n       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&\n       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&\n       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then\n      # icc doesn't choke on unknown options, it will just issue warnings\n      # or remarks (even with -Werror).  So we grep stderr for any message\n      # that says an option was ignored or not supported.\n      # When given -MP, icc 7.0 and 7.1 complain thusly:\n      #   icc: Command line warning: ignoring option '-M'; no argument required\n      # The diagnosis changed in icc 8.0:\n      #   icc: Command line remark: option '-MP' not supported\n      if (grep 'ignoring option' conftest.err ||\n          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else\n        am_cv_CC_dependencies_compiler_type=$depmode\n        break\n      fi\n    fi\n  done\n\n  cd ..\n  rm -rf conftest.dir\nelse\n  am_cv_CC_dependencies_compiler_type=none\nfi\n\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type\" >&5\n$as_echo \"$am_cv_CC_dependencies_compiler_type\" >&6; }\nCCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type\n\n if\n  test \"x$enable_dependency_tracking\" != xno \\\n  && test \"$am_cv_CC_dependencies_compiler_type\" = gcc3; then\n  am__fastdepCC_TRUE=\n  am__fastdepCC_FALSE='#'\nelse\n  am__fastdepCC_TRUE='#'\n  am__fastdepCC_FALSE=\nfi\n\n\n   case $ac_cv_prog_cc_stdc in #(\n  no) :\n    ac_cv_prog_cc_c99=no; ac_cv_prog_cc_c89=no ;; #(\n  *) :\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C99\" >&5\n$as_echo_n \"checking for $CC option to accept ISO C99... \" >&6; }\nif test \"${ac_cv_prog_cc_c99+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  ac_cv_prog_cc_c99=no\nac_save_CC=$CC\ncat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n#include <stdarg.h>\n#include <stdbool.h>\n#include <stdlib.h>\n#include <wchar.h>\n#include <stdio.h>\n\n// Check varargs macros.  These examples are taken from C99 6.10.3.5.\n#define debug(...) fprintf (stderr, __VA_ARGS__)\n#define showlist(...) puts (#__VA_ARGS__)\n#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__))\nstatic void\ntest_varargs_macros (void)\n{\n  int x = 1234;\n  int y = 5678;\n  debug (\"Flag\");\n  debug (\"X = %d\\n\", x);\n  showlist (The first, second, and third items.);\n  report (x>y, \"x is %d but y is %d\", x, y);\n}\n\n// Check long long types.\n#define BIG64 18446744073709551615ull\n#define BIG32 4294967295ul\n#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0)\n#if !BIG_OK\n  your preprocessor is broken;\n#endif\n#if BIG_OK\n#else\n  your preprocessor is broken;\n#endif\nstatic long long int bignum = -9223372036854775807LL;\nstatic unsigned long long int ubignum = BIG64;\n\nstruct incomplete_array\n{\n  int datasize;\n  double data[];\n};\n\nstruct named_init {\n  int number;\n  const wchar_t *name;\n  double average;\n};\n\ntypedef const char *ccp;\n\nstatic inline int\ntest_restrict (ccp restrict text)\n{\n  // See if C++-style comments work.\n  // Iterate through items via the restricted pointer.\n  // Also check for declarations in for loops.\n  for (unsigned int i = 0; *(text+i) != '\\0'; ++i)\n    continue;\n  return 0;\n}\n\n// Check varargs and va_copy.\nstatic void\ntest_varargs (const char *format, ...)\n{\n  va_list args;\n  va_start (args, format);\n  va_list args_copy;\n  va_copy (args_copy, args);\n\n  const char *str;\n  int number;\n  float fnumber;\n\n  while (*format)\n    {\n      switch (*format++)\n\t{\n\tcase 's': // string\n\t  str = va_arg (args_copy, const char *);\n\t  break;\n\tcase 'd': // int\n\t  number = va_arg (args_copy, int);\n\t  break;\n\tcase 'f': // float\n\t  fnumber = va_arg (args_copy, double);\n\t  break;\n\tdefault:\n\t  break;\n\t}\n    }\n  va_end (args_copy);\n  va_end (args);\n}\n\nint\nmain ()\n{\n\n  // Check bool.\n  _Bool success = false;\n\n  // Check restrict.\n  if (test_restrict (\"String literal\") == 0)\n    success = true;\n  char *restrict newvar = \"Another string\";\n\n  // Check varargs.\n  test_varargs (\"s, d' f .\", \"string\", 65, 34.234);\n  test_varargs_macros ();\n\n  // Check flexible array members.\n  struct incomplete_array *ia =\n    malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10));\n  ia->datasize = 10;\n  for (int i = 0; i < ia->datasize; ++i)\n    ia->data[i] = i * 1.234;\n\n  // Check named initializers.\n  struct named_init ni = {\n    .number = 34,\n    .name = L\"Test wide string\",\n    .average = 543.34343,\n  };\n\n  ni.number = 58;\n\n  int dynamic_array[ni.number];\n  dynamic_array[ni.number - 1] = 543;\n\n  // work around unused variable warnings\n  return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x'\n\t  || dynamic_array[ni.number - 1] != 543);\n\n  ;\n  return 0;\n}\n_ACEOF\nfor ac_arg in '' -std=gnu99 -std=c99 -c99 -AC99 -xc99=all -qlanglvl=extc99\ndo\n  CC=\"$ac_save_CC $ac_arg\"\n  if ac_fn_c_try_compile \"$LINENO\"; then :\n  ac_cv_prog_cc_c99=$ac_arg\nfi\nrm -f core conftest.err conftest.$ac_objext\n  test \"x$ac_cv_prog_cc_c99\" != \"xno\" && break\ndone\nrm -f conftest.$ac_ext\nCC=$ac_save_CC\n\nfi\n# AC_CACHE_VAL\ncase \"x$ac_cv_prog_cc_c99\" in\n  x)\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: result: none needed\" >&5\n$as_echo \"none needed\" >&6; } ;;\n  xno)\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: result: unsupported\" >&5\n$as_echo \"unsupported\" >&6; } ;;\n  *)\n    CC=\"$CC $ac_cv_prog_cc_c99\"\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99\" >&5\n$as_echo \"$ac_cv_prog_cc_c99\" >&6; } ;;\nesac\nif test \"x$ac_cv_prog_cc_c99\" != xno; then :\n  ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89\" >&5\n$as_echo_n \"checking for $CC option to accept ISO C89... \" >&6; }\nif test \"${ac_cv_prog_cc_c89+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  ac_cv_prog_cc_c89=no\nac_save_CC=$CC\ncat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n#include <stdarg.h>\n#include <stdio.h>\n#include <sys/types.h>\n#include <sys/stat.h>\n/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */\nstruct buf { int x; };\nFILE * (*rcsopen) (struct buf *, struct stat *, int);\nstatic char *e (p, i)\n     char **p;\n     int i;\n{\n  return p[i];\n}\nstatic char *f (char * (*g) (char **, int), char **p, ...)\n{\n  char *s;\n  va_list v;\n  va_start (v,p);\n  s = g (p, va_arg (v,int));\n  va_end (v);\n  return s;\n}\n\n/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has\n   function prototypes and stuff, but not '\\xHH' hex character constants.\n   These don't provoke an error unfortunately, instead are silently treated\n   as 'x'.  The following induces an error, until -std is added to get\n   proper ANSI mode.  Curiously '\\x00'!='x' always comes out true, for an\n   array size at least.  It's necessary to write '\\x00'==0 to get something\n   that's true only with -std.  */\nint osf4_cc_array ['\\x00' == 0 ? 1 : -1];\n\n/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters\n   inside strings and character constants.  */\n#define FOO(x) 'x'\nint xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];\n\nint test (int i, double x);\nstruct s1 {int (*f) (int a);};\nstruct s2 {int (*f) (double a);};\nint pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);\nint argc;\nchar **argv;\nint\nmain ()\n{\nreturn f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];\n  ;\n  return 0;\n}\n_ACEOF\nfor ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \\\n\t-Ae \"-Aa -D_HPUX_SOURCE\" \"-Xc -D__EXTENSIONS__\"\ndo\n  CC=\"$ac_save_CC $ac_arg\"\n  if ac_fn_c_try_compile \"$LINENO\"; then :\n  ac_cv_prog_cc_c89=$ac_arg\nfi\nrm -f core conftest.err conftest.$ac_objext\n  test \"x$ac_cv_prog_cc_c89\" != \"xno\" && break\ndone\nrm -f conftest.$ac_ext\nCC=$ac_save_CC\n\nfi\n# AC_CACHE_VAL\ncase \"x$ac_cv_prog_cc_c89\" in\n  x)\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: result: none needed\" >&5\n$as_echo \"none needed\" >&6; } ;;\n  xno)\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: result: unsupported\" >&5\n$as_echo \"unsupported\" >&6; } ;;\n  *)\n    CC=\"$CC $ac_cv_prog_cc_c89\"\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89\" >&5\n$as_echo \"$ac_cv_prog_cc_c89\" >&6; } ;;\nesac\nif test \"x$ac_cv_prog_cc_c89\" != xno; then :\n  ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89\nelse\n  ac_cv_prog_cc_stdc=no\nfi\n\nfi\n ;;\nesac\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO Standard C\" >&5\n$as_echo_n \"checking for $CC option to accept ISO Standard C... \" >&6; }\n  if test \"${ac_cv_prog_cc_stdc+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nfi\n\n  case $ac_cv_prog_cc_stdc in #(\n  no) :\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: result: unsupported\" >&5\n$as_echo \"unsupported\" >&6; } ;; #(\n  '') :\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: result: none needed\" >&5\n$as_echo \"none needed\" >&6; } ;; #(\n  *) :\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_stdc\" >&5\n$as_echo \"$ac_cv_prog_cc_stdc\" >&6; } ;;\nesac\n\nac_ext=c\nac_cpp='$CPP $CPPFLAGS'\nac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'\nac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'\nac_compiler_gnu=$ac_cv_c_compiler_gnu\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor\" >&5\n$as_echo_n \"checking how to run the C preprocessor... \" >&6; }\n# On Suns, sometimes $CPP names a directory.\nif test -n \"$CPP\" && test -d \"$CPP\"; then\n  CPP=\nfi\nif test -z \"$CPP\"; then\n  if test \"${ac_cv_prog_CPP+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n      # Double quotes because CPP needs to be expanded\n    for CPP in \"$CC -E\" \"$CC -E -traditional-cpp\" \"/lib/cpp\"\n    do\n      ac_preproc_ok=false\nfor ac_c_preproc_warn_flag in '' yes\ndo\n  # Use a header file that comes with gcc, so configuring glibc\n  # with a fresh cross-compiler works.\n  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since\n  # <limits.h> exists even on freestanding compilers.\n  # On the NeXT, cc -E runs the code through the compiler's parser,\n  # not just through cpp. \"Syntax error\" is here to catch this case.\n  cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n#ifdef __STDC__\n# include <limits.h>\n#else\n# include <assert.h>\n#endif\n\t\t     Syntax error\n_ACEOF\nif ac_fn_c_try_cpp \"$LINENO\"; then :\n\nelse\n  # Broken: fails on valid input.\ncontinue\nfi\nrm -f conftest.err conftest.$ac_ext\n\n  # OK, works on sane cases.  Now check whether nonexistent headers\n  # can be detected and how.\n  cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n#include <ac_nonexistent.h>\n_ACEOF\nif ac_fn_c_try_cpp \"$LINENO\"; then :\n  # Broken: success on invalid input.\ncontinue\nelse\n  # Passes both tests.\nac_preproc_ok=:\nbreak\nfi\nrm -f conftest.err conftest.$ac_ext\n\ndone\n# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.\nrm -f conftest.err conftest.$ac_ext\nif $ac_preproc_ok; then :\n  break\nfi\n\n    done\n    ac_cv_prog_CPP=$CPP\n\nfi\n  CPP=$ac_cv_prog_CPP\nelse\n  ac_cv_prog_CPP=$CPP\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $CPP\" >&5\n$as_echo \"$CPP\" >&6; }\nac_preproc_ok=false\nfor ac_c_preproc_warn_flag in '' yes\ndo\n  # Use a header file that comes with gcc, so configuring glibc\n  # with a fresh cross-compiler works.\n  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since\n  # <limits.h> exists even on freestanding compilers.\n  # On the NeXT, cc -E runs the code through the compiler's parser,\n  # not just through cpp. \"Syntax error\" is here to catch this case.\n  cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n#ifdef __STDC__\n# include <limits.h>\n#else\n# include <assert.h>\n#endif\n\t\t     Syntax error\n_ACEOF\nif ac_fn_c_try_cpp \"$LINENO\"; then :\n\nelse\n  # Broken: fails on valid input.\ncontinue\nfi\nrm -f conftest.err conftest.$ac_ext\n\n  # OK, works on sane cases.  Now check whether nonexistent headers\n  # can be detected and how.\n  cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n#include <ac_nonexistent.h>\n_ACEOF\nif ac_fn_c_try_cpp \"$LINENO\"; then :\n  # Broken: success on invalid input.\ncontinue\nelse\n  # Passes both tests.\nac_preproc_ok=:\nbreak\nfi\nrm -f conftest.err conftest.$ac_ext\n\ndone\n# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.\nrm -f conftest.err conftest.$ac_ext\nif $ac_preproc_ok; then :\n\nelse\n  { { $as_echo \"$as_me:${as_lineno-$LINENO}: error: in \\`$ac_pwd':\" >&5\n$as_echo \"$as_me: error: in \\`$ac_pwd':\" >&2;}\nas_fn_error \"C preprocessor \\\"$CPP\\\" fails sanity check\nSee \\`config.log' for more details.\" \"$LINENO\" 5; }\nfi\n\nac_ext=c\nac_cpp='$CPP $CPPFLAGS'\nac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'\nac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'\nac_compiler_gnu=$ac_cv_c_compiler_gnu\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output\" >&5\n$as_echo_n \"checking for a sed that does not truncate output... \" >&6; }\nif test \"${ac_cv_path_SED+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n            ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/\n     for ac_i in 1 2 3 4 5 6 7; do\n       ac_script=\"$ac_script$as_nl$ac_script\"\n     done\n     echo \"$ac_script\" 2>/dev/null | sed 99q >conftest.sed\n     { ac_script=; unset ac_script;}\n     if test -z \"$SED\"; then\n  ac_path_SED_found=false\n  # Loop through the user's path and test for each of PROGNAME-LIST\n  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_prog in sed gsed; do\n    for ac_exec_ext in '' $ac_executable_extensions; do\n      ac_path_SED=\"$as_dir/$ac_prog$ac_exec_ext\"\n      { test -f \"$ac_path_SED\" && $as_test_x \"$ac_path_SED\"; } || continue\n# Check for GNU ac_path_SED and select it if it is found.\n  # Check for GNU $ac_path_SED\ncase `\"$ac_path_SED\" --version 2>&1` in\n*GNU*)\n  ac_cv_path_SED=\"$ac_path_SED\" ac_path_SED_found=:;;\n*)\n  ac_count=0\n  $as_echo_n 0123456789 >\"conftest.in\"\n  while :\n  do\n    cat \"conftest.in\" \"conftest.in\" >\"conftest.tmp\"\n    mv \"conftest.tmp\" \"conftest.in\"\n    cp \"conftest.in\" \"conftest.nl\"\n    $as_echo '' >> \"conftest.nl\"\n    \"$ac_path_SED\" -f conftest.sed < \"conftest.nl\" >\"conftest.out\" 2>/dev/null || break\n    diff \"conftest.out\" \"conftest.nl\" >/dev/null 2>&1 || break\n    as_fn_arith $ac_count + 1 && ac_count=$as_val\n    if test $ac_count -gt ${ac_path_SED_max-0}; then\n      # Best one so far, save it but keep looking for a better one\n      ac_cv_path_SED=\"$ac_path_SED\"\n      ac_path_SED_max=$ac_count\n    fi\n    # 10*(2^10) chars as input seems more than enough\n    test $ac_count -gt 10 && break\n  done\n  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;\nesac\n\n      $ac_path_SED_found && break 3\n    done\n  done\n  done\nIFS=$as_save_IFS\n  if test -z \"$ac_cv_path_SED\"; then\n    as_fn_error \"no acceptable sed could be found in \\$PATH\" \"$LINENO\" 5\n  fi\nelse\n  ac_cv_path_SED=$SED\nfi\n\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED\" >&5\n$as_echo \"$ac_cv_path_SED\" >&6; }\n SED=\"$ac_cv_path_SED\"\n  rm -f conftest.sed\n\ntest -z \"$SED\" && SED=sed\nXsed=\"$SED -e 1s/^X//\"\n\n\n\n\n\n\n\n\n\n\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e\" >&5\n$as_echo_n \"checking for grep that handles long lines and -e... \" >&6; }\nif test \"${ac_cv_path_GREP+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -z \"$GREP\"; then\n  ac_path_GREP_found=false\n  # Loop through the user's path and test for each of PROGNAME-LIST\n  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_prog in grep ggrep; do\n    for ac_exec_ext in '' $ac_executable_extensions; do\n      ac_path_GREP=\"$as_dir/$ac_prog$ac_exec_ext\"\n      { test -f \"$ac_path_GREP\" && $as_test_x \"$ac_path_GREP\"; } || continue\n# Check for GNU ac_path_GREP and select it if it is found.\n  # Check for GNU $ac_path_GREP\ncase `\"$ac_path_GREP\" --version 2>&1` in\n*GNU*)\n  ac_cv_path_GREP=\"$ac_path_GREP\" ac_path_GREP_found=:;;\n*)\n  ac_count=0\n  $as_echo_n 0123456789 >\"conftest.in\"\n  while :\n  do\n    cat \"conftest.in\" \"conftest.in\" >\"conftest.tmp\"\n    mv \"conftest.tmp\" \"conftest.in\"\n    cp \"conftest.in\" \"conftest.nl\"\n    $as_echo 'GREP' >> \"conftest.nl\"\n    \"$ac_path_GREP\" -e 'GREP$' -e '-(cannot match)-' < \"conftest.nl\" >\"conftest.out\" 2>/dev/null || break\n    diff \"conftest.out\" \"conftest.nl\" >/dev/null 2>&1 || break\n    as_fn_arith $ac_count + 1 && ac_count=$as_val\n    if test $ac_count -gt ${ac_path_GREP_max-0}; then\n      # Best one so far, save it but keep looking for a better one\n      ac_cv_path_GREP=\"$ac_path_GREP\"\n      ac_path_GREP_max=$ac_count\n    fi\n    # 10*(2^10) chars as input seems more than enough\n    test $ac_count -gt 10 && break\n  done\n  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;\nesac\n\n      $ac_path_GREP_found && break 3\n    done\n  done\n  done\nIFS=$as_save_IFS\n  if test -z \"$ac_cv_path_GREP\"; then\n    as_fn_error \"no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin\" \"$LINENO\" 5\n  fi\nelse\n  ac_cv_path_GREP=$GREP\nfi\n\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP\" >&5\n$as_echo \"$ac_cv_path_GREP\" >&6; }\n GREP=\"$ac_cv_path_GREP\"\n\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for egrep\" >&5\n$as_echo_n \"checking for egrep... \" >&6; }\nif test \"${ac_cv_path_EGREP+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if echo a | $GREP -E '(a|b)' >/dev/null 2>&1\n   then ac_cv_path_EGREP=\"$GREP -E\"\n   else\n     if test -z \"$EGREP\"; then\n  ac_path_EGREP_found=false\n  # Loop through the user's path and test for each of PROGNAME-LIST\n  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_prog in egrep; do\n    for ac_exec_ext in '' $ac_executable_extensions; do\n      ac_path_EGREP=\"$as_dir/$ac_prog$ac_exec_ext\"\n      { test -f \"$ac_path_EGREP\" && $as_test_x \"$ac_path_EGREP\"; } || continue\n# Check for GNU ac_path_EGREP and select it if it is found.\n  # Check for GNU $ac_path_EGREP\ncase `\"$ac_path_EGREP\" --version 2>&1` in\n*GNU*)\n  ac_cv_path_EGREP=\"$ac_path_EGREP\" ac_path_EGREP_found=:;;\n*)\n  ac_count=0\n  $as_echo_n 0123456789 >\"conftest.in\"\n  while :\n  do\n    cat \"conftest.in\" \"conftest.in\" >\"conftest.tmp\"\n    mv \"conftest.tmp\" \"conftest.in\"\n    cp \"conftest.in\" \"conftest.nl\"\n    $as_echo 'EGREP' >> \"conftest.nl\"\n    \"$ac_path_EGREP\" 'EGREP$' < \"conftest.nl\" >\"conftest.out\" 2>/dev/null || break\n    diff \"conftest.out\" \"conftest.nl\" >/dev/null 2>&1 || break\n    as_fn_arith $ac_count + 1 && ac_count=$as_val\n    if test $ac_count -gt ${ac_path_EGREP_max-0}; then\n      # Best one so far, save it but keep looking for a better one\n      ac_cv_path_EGREP=\"$ac_path_EGREP\"\n      ac_path_EGREP_max=$ac_count\n    fi\n    # 10*(2^10) chars as input seems more than enough\n    test $ac_count -gt 10 && break\n  done\n  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;\nesac\n\n      $ac_path_EGREP_found && break 3\n    done\n  done\n  done\nIFS=$as_save_IFS\n  if test -z \"$ac_cv_path_EGREP\"; then\n    as_fn_error \"no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin\" \"$LINENO\" 5\n  fi\nelse\n  ac_cv_path_EGREP=$EGREP\nfi\n\n   fi\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP\" >&5\n$as_echo \"$ac_cv_path_EGREP\" >&6; }\n EGREP=\"$ac_cv_path_EGREP\"\n\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for fgrep\" >&5\n$as_echo_n \"checking for fgrep... \" >&6; }\nif test \"${ac_cv_path_FGREP+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1\n   then ac_cv_path_FGREP=\"$GREP -F\"\n   else\n     if test -z \"$FGREP\"; then\n  ac_path_FGREP_found=false\n  # Loop through the user's path and test for each of PROGNAME-LIST\n  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_prog in fgrep; do\n    for ac_exec_ext in '' $ac_executable_extensions; do\n      ac_path_FGREP=\"$as_dir/$ac_prog$ac_exec_ext\"\n      { test -f \"$ac_path_FGREP\" && $as_test_x \"$ac_path_FGREP\"; } || continue\n# Check for GNU ac_path_FGREP and select it if it is found.\n  # Check for GNU $ac_path_FGREP\ncase `\"$ac_path_FGREP\" --version 2>&1` in\n*GNU*)\n  ac_cv_path_FGREP=\"$ac_path_FGREP\" ac_path_FGREP_found=:;;\n*)\n  ac_count=0\n  $as_echo_n 0123456789 >\"conftest.in\"\n  while :\n  do\n    cat \"conftest.in\" \"conftest.in\" >\"conftest.tmp\"\n    mv \"conftest.tmp\" \"conftest.in\"\n    cp \"conftest.in\" \"conftest.nl\"\n    $as_echo 'FGREP' >> \"conftest.nl\"\n    \"$ac_path_FGREP\" FGREP < \"conftest.nl\" >\"conftest.out\" 2>/dev/null || break\n    diff \"conftest.out\" \"conftest.nl\" >/dev/null 2>&1 || break\n    as_fn_arith $ac_count + 1 && ac_count=$as_val\n    if test $ac_count -gt ${ac_path_FGREP_max-0}; then\n      # Best one so far, save it but keep looking for a better one\n      ac_cv_path_FGREP=\"$ac_path_FGREP\"\n      ac_path_FGREP_max=$ac_count\n    fi\n    # 10*(2^10) chars as input seems more than enough\n    test $ac_count -gt 10 && break\n  done\n  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;\nesac\n\n      $ac_path_FGREP_found && break 3\n    done\n  done\n  done\nIFS=$as_save_IFS\n  if test -z \"$ac_cv_path_FGREP\"; then\n    as_fn_error \"no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin\" \"$LINENO\" 5\n  fi\nelse\n  ac_cv_path_FGREP=$FGREP\nfi\n\n   fi\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP\" >&5\n$as_echo \"$ac_cv_path_FGREP\" >&6; }\n FGREP=\"$ac_cv_path_FGREP\"\n\n\ntest -z \"$GREP\" && GREP=grep\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n# Check whether --with-gnu-ld was given.\nif test \"${with_gnu_ld+set}\" = set; then :\n  withval=$with_gnu_ld; test \"$withval\" = no || with_gnu_ld=yes\nelse\n  with_gnu_ld=no\nfi\n\nac_prog=ld\nif test \"$GCC\" = yes; then\n  # Check if gcc -print-prog-name=ld gives a path.\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking for ld used by $CC\" >&5\n$as_echo_n \"checking for ld used by $CC... \" >&6; }\n  case $host in\n  *-*-mingw*)\n    # gcc leaves a trailing carriage return which upsets mingw\n    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\\015'` ;;\n  *)\n    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;\n  esac\n  case $ac_prog in\n    # Accept absolute paths.\n    [\\\\/]* | ?:[\\\\/]*)\n      re_direlt='/[^/][^/]*/\\.\\./'\n      # Canonicalize the pathname of ld\n      ac_prog=`$ECHO \"$ac_prog\"| $SED 's%\\\\\\\\%/%g'`\n      while $ECHO \"$ac_prog\" | $GREP \"$re_direlt\" > /dev/null 2>&1; do\n\tac_prog=`$ECHO $ac_prog| $SED \"s%$re_direlt%/%\"`\n      done\n      test -z \"$LD\" && LD=\"$ac_prog\"\n      ;;\n  \"\")\n    # If it fails, then pretend we aren't using GCC.\n    ac_prog=ld\n    ;;\n  *)\n    # If it is relative, then search for the first ld in PATH.\n    with_gnu_ld=unknown\n    ;;\n  esac\nelif test \"$with_gnu_ld\" = yes; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking for GNU ld\" >&5\n$as_echo_n \"checking for GNU ld... \" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking for non-GNU ld\" >&5\n$as_echo_n \"checking for non-GNU ld... \" >&6; }\nfi\nif test \"${lt_cv_path_LD+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -z \"$LD\"; then\n  lt_save_ifs=\"$IFS\"; IFS=$PATH_SEPARATOR\n  for ac_dir in $PATH; do\n    IFS=\"$lt_save_ifs\"\n    test -z \"$ac_dir\" && ac_dir=.\n    if test -f \"$ac_dir/$ac_prog\" || test -f \"$ac_dir/$ac_prog$ac_exeext\"; then\n      lt_cv_path_LD=\"$ac_dir/$ac_prog\"\n      # Check to see if the program is GNU ld.  I'd rather use --version,\n      # but apparently some variants of GNU ld only accept -v.\n      # Break only if it was the GNU/non-GNU ld that we prefer.\n      case `\"$lt_cv_path_LD\" -v 2>&1 </dev/null` in\n      *GNU* | *'with BFD'*)\n\ttest \"$with_gnu_ld\" != no && break\n\t;;\n      *)\n\ttest \"$with_gnu_ld\" != yes && break\n\t;;\n      esac\n    fi\n  done\n  IFS=\"$lt_save_ifs\"\nelse\n  lt_cv_path_LD=\"$LD\" # Let the user override the test with a path.\nfi\nfi\n\nLD=\"$lt_cv_path_LD\"\nif test -n \"$LD\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $LD\" >&5\n$as_echo \"$LD\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\ntest -z \"$LD\" && as_fn_error \"no acceptable ld found in \\$PATH\" \"$LINENO\" 5\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld\" >&5\n$as_echo_n \"checking if the linker ($LD) is GNU ld... \" >&6; }\nif test \"${lt_cv_prog_gnu_ld+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  # I'd rather use --version here, but apparently some GNU lds only accept -v.\ncase `$LD -v 2>&1 </dev/null` in\n*GNU* | *'with BFD'*)\n  lt_cv_prog_gnu_ld=yes\n  ;;\n*)\n  lt_cv_prog_gnu_ld=no\n  ;;\nesac\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_gnu_ld\" >&5\n$as_echo \"$lt_cv_prog_gnu_ld\" >&6; }\nwith_gnu_ld=$lt_cv_prog_gnu_ld\n\n\n\n\n\n\n\n\n\n\nif test \"x$CC\" != xcc; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking whether $CC and cc understand -c and -o together\" >&5\n$as_echo_n \"checking whether $CC and cc understand -c and -o together... \" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking whether cc understands -c and -o together\" >&5\n$as_echo_n \"checking whether cc understands -c and -o together... \" >&6; }\nfi\nset dummy $CC; ac_cc=`$as_echo \"$2\" |\n\t\t      sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'`\nif { as_var=ac_cv_prog_cc_${ac_cc}_c_o; eval \"test \\\"\\${$as_var+set}\\\" = set\"; }; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\nint\nmain ()\n{\n\n  ;\n  return 0;\n}\n_ACEOF\n# Make sure it works both with $CC and with simple cc.\n# We do the test twice because some compilers refuse to overwrite an\n# existing .o file with -o, though they will create one.\nac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5'\nrm -f conftest2.*\nif { { case \"(($ac_try\" in\n  *\\\"* | *\\`* | *\\\\*) ac_try_echo=\\$ac_try;;\n  *) ac_try_echo=$ac_try;;\nesac\neval ac_try_echo=\"\\\"\\$as_me:${as_lineno-$LINENO}: $ac_try_echo\\\"\"\n$as_echo \"$ac_try_echo\"; } >&5\n  (eval \"$ac_try\") 2>&5\n  ac_status=$?\n  $as_echo \"$as_me:${as_lineno-$LINENO}: \\$? = $ac_status\" >&5\n  test $ac_status = 0; } &&\n   test -f conftest2.$ac_objext && { { case \"(($ac_try\" in\n  *\\\"* | *\\`* | *\\\\*) ac_try_echo=\\$ac_try;;\n  *) ac_try_echo=$ac_try;;\nesac\neval ac_try_echo=\"\\\"\\$as_me:${as_lineno-$LINENO}: $ac_try_echo\\\"\"\n$as_echo \"$ac_try_echo\"; } >&5\n  (eval \"$ac_try\") 2>&5\n  ac_status=$?\n  $as_echo \"$as_me:${as_lineno-$LINENO}: \\$? = $ac_status\" >&5\n  test $ac_status = 0; };\nthen\n  eval ac_cv_prog_cc_${ac_cc}_c_o=yes\n  if test \"x$CC\" != xcc; then\n    # Test first that cc exists at all.\n    if { ac_try='cc -c conftest.$ac_ext >&5'\n  { { case \"(($ac_try\" in\n  *\\\"* | *\\`* | *\\\\*) ac_try_echo=\\$ac_try;;\n  *) ac_try_echo=$ac_try;;\nesac\neval ac_try_echo=\"\\\"\\$as_me:${as_lineno-$LINENO}: $ac_try_echo\\\"\"\n$as_echo \"$ac_try_echo\"; } >&5\n  (eval \"$ac_try\") 2>&5\n  ac_status=$?\n  $as_echo \"$as_me:${as_lineno-$LINENO}: \\$? = $ac_status\" >&5\n  test $ac_status = 0; }; }; then\n      ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&5'\n      rm -f conftest2.*\n      if { { case \"(($ac_try\" in\n  *\\\"* | *\\`* | *\\\\*) ac_try_echo=\\$ac_try;;\n  *) ac_try_echo=$ac_try;;\nesac\neval ac_try_echo=\"\\\"\\$as_me:${as_lineno-$LINENO}: $ac_try_echo\\\"\"\n$as_echo \"$ac_try_echo\"; } >&5\n  (eval \"$ac_try\") 2>&5\n  ac_status=$?\n  $as_echo \"$as_me:${as_lineno-$LINENO}: \\$? = $ac_status\" >&5\n  test $ac_status = 0; } &&\n\t test -f conftest2.$ac_objext && { { case \"(($ac_try\" in\n  *\\\"* | *\\`* | *\\\\*) ac_try_echo=\\$ac_try;;\n  *) ac_try_echo=$ac_try;;\nesac\neval ac_try_echo=\"\\\"\\$as_me:${as_lineno-$LINENO}: $ac_try_echo\\\"\"\n$as_echo \"$ac_try_echo\"; } >&5\n  (eval \"$ac_try\") 2>&5\n  ac_status=$?\n  $as_echo \"$as_me:${as_lineno-$LINENO}: \\$? = $ac_status\" >&5\n  test $ac_status = 0; };\n      then\n\t# cc works too.\n\t:\n      else\n\t# cc exists but doesn't like -o.\n\teval ac_cv_prog_cc_${ac_cc}_c_o=no\n      fi\n    fi\n  fi\nelse\n  eval ac_cv_prog_cc_${ac_cc}_c_o=no\nfi\nrm -f core conftest*\n\nfi\nif eval test \\$ac_cv_prog_cc_${ac_cc}_c_o = yes; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: yes\" >&5\n$as_echo \"yes\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\n\n$as_echo \"#define NO_MINUS_C_MINUS_O 1\" >>confdefs.h\n\nfi\n\n# FIXME: we rely on the cache variable name because\n# there is no other way.\nset dummy $CC\nam_cc=`echo $2 | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'`\neval am_t=\\$ac_cv_prog_cc_${am_cc}_c_o\nif test \"$am_t\" != yes; then\n   # Losing compiler, so override with the script.\n   # FIXME: It is wrong to rewrite CC.\n   # But if we don't then we get into trouble of one sort or another.\n   # A longer-term fix would be to have automake use am__CC in this case,\n   # and then we could set am__CC=\"\\$(top_srcdir)/compile \\$(CC)\"\n   CC=\"$am_aux_dir/compile $CC\"\nfi\n\n\n\n\n# Check whether --with-gnu-ld was given.\nif test \"${with_gnu_ld+set}\" = set; then :\n  withval=$with_gnu_ld; test \"$withval\" = no || with_gnu_ld=yes\nelse\n  with_gnu_ld=no\nfi\n\nac_prog=ld\nif test \"$GCC\" = yes; then\n  # Check if gcc -print-prog-name=ld gives a path.\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking for ld used by $CC\" >&5\n$as_echo_n \"checking for ld used by $CC... \" >&6; }\n  case $host in\n  *-*-mingw*)\n    # gcc leaves a trailing carriage return which upsets mingw\n    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\\015'` ;;\n  *)\n    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;\n  esac\n  case $ac_prog in\n    # Accept absolute paths.\n    [\\\\/]* | ?:[\\\\/]*)\n      re_direlt='/[^/][^/]*/\\.\\./'\n      # Canonicalize the pathname of ld\n      ac_prog=`$ECHO \"$ac_prog\"| $SED 's%\\\\\\\\%/%g'`\n      while $ECHO \"$ac_prog\" | $GREP \"$re_direlt\" > /dev/null 2>&1; do\n\tac_prog=`$ECHO $ac_prog| $SED \"s%$re_direlt%/%\"`\n      done\n      test -z \"$LD\" && LD=\"$ac_prog\"\n      ;;\n  \"\")\n    # If it fails, then pretend we aren't using GCC.\n    ac_prog=ld\n    ;;\n  *)\n    # If it is relative, then search for the first ld in PATH.\n    with_gnu_ld=unknown\n    ;;\n  esac\nelif test \"$with_gnu_ld\" = yes; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking for GNU ld\" >&5\n$as_echo_n \"checking for GNU ld... \" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking for non-GNU ld\" >&5\n$as_echo_n \"checking for non-GNU ld... \" >&6; }\nfi\nif test \"${lt_cv_path_LD+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -z \"$LD\"; then\n  lt_save_ifs=\"$IFS\"; IFS=$PATH_SEPARATOR\n  for ac_dir in $PATH; do\n    IFS=\"$lt_save_ifs\"\n    test -z \"$ac_dir\" && ac_dir=.\n    if test -f \"$ac_dir/$ac_prog\" || test -f \"$ac_dir/$ac_prog$ac_exeext\"; then\n      lt_cv_path_LD=\"$ac_dir/$ac_prog\"\n      # Check to see if the program is GNU ld.  I'd rather use --version,\n      # but apparently some variants of GNU ld only accept -v.\n      # Break only if it was the GNU/non-GNU ld that we prefer.\n      case `\"$lt_cv_path_LD\" -v 2>&1 </dev/null` in\n      *GNU* | *'with BFD'*)\n\ttest \"$with_gnu_ld\" != no && break\n\t;;\n      *)\n\ttest \"$with_gnu_ld\" != yes && break\n\t;;\n      esac\n    fi\n  done\n  IFS=\"$lt_save_ifs\"\nelse\n  lt_cv_path_LD=\"$LD\" # Let the user override the test with a path.\nfi\nfi\n\nLD=\"$lt_cv_path_LD\"\nif test -n \"$LD\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $LD\" >&5\n$as_echo \"$LD\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\ntest -z \"$LD\" && as_fn_error \"no acceptable ld found in \\$PATH\" \"$LINENO\" 5\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld\" >&5\n$as_echo_n \"checking if the linker ($LD) is GNU ld... \" >&6; }\nif test \"${lt_cv_prog_gnu_ld+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  # I'd rather use --version here, but apparently some GNU lds only accept -v.\ncase `$LD -v 2>&1 </dev/null` in\n*GNU* | *'with BFD'*)\n  lt_cv_prog_gnu_ld=yes\n  ;;\n*)\n  lt_cv_prog_gnu_ld=no\n  ;;\nesac\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_gnu_ld\" >&5\n$as_echo \"$lt_cv_prog_gnu_ld\" >&6; }\nwith_gnu_ld=$lt_cv_prog_gnu_ld\n\n\n\n\n\n\n\n\n  ansi=\n  if test -z \"$ansi\"; then\n    msg=\"for C compiler warning flags\"\n  else\n    msg=\"for C compiler warning and ANSI conformance flags\"\n  fi\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking $msg\" >&5\n$as_echo_n \"checking $msg... \" >&6; }\nif test \"${vl_cv_prog_cc_warnings+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n\n    if test -n \"$CC\"; then\n      cat > conftest.c <<EOF\nint main(int argc, char **argv) { return 0; }\nEOF\n\n            if test \"$GCC\" = \"yes\"; then\n        if test -z \"$ansi\"; then\n          vl_cv_prog_cc_warnings=\"-Wall -W\"\n        else\n          vl_cv_prog_cc_warnings=\"-Wall -W -ansi -pedantic\"\n        fi\n\n\n            elif $CC -V 2>&1 | grep -i \"WorkShop\" > /dev/null 2>&1 &&\n           $CC -c -v -Xc conftest.c > /dev/null 2>&1 &&\n           test -f conftest.o; then\n        if test -z \"$ansi\"; then\n          vl_cv_prog_cc_warnings=\"-v\"\n        else\n          vl_cv_prog_cc_warnings=\"-v -Xc\"\n        fi\n\n            elif $CC -V 2>&1 | grep -i \"Digital UNIX Compiler\" > /dev/null 2>&1 &&\n           $CC -c -verbose -w0 -warnprotos -std1 conftest.c > /dev/null 2>&1 &&\n           test -f conftest.o; then\n        if test -z \"$ansi\"; then\n          vl_cv_prog_cc_warnings=\"-verbose -w0 -warnprotos\"\n        else\n          vl_cv_prog_cc_warnings=\"-verbose -w0 -warnprotos -std1\"\n        fi\n\n            elif $CC 2>&1 | grep -i \"C for AIX Compiler\" > /dev/null 2>&1 &&\n           $CC -c -qlanglvl=ansi -qinfo=all conftest.c > /dev/null 2>&1 &&\n           test -f conftest.o; then\n        if test -z \"$ansi\"; then\n          vl_cv_prog_cc_warnings=\"-qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd\"\n        else\n          vl_cv_prog_cc_warnings=\"-qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd -qlanglvl=ansi\"\n        fi\n\n            elif $CC -version 2>&1 | grep -i \"MIPSpro Compilers\" > /dev/null 2>&1 &&\n           $CC -c -fullwarn -ansi -ansiE conftest.c > /dev/null 2>&1 &&\n           test -f conftest.o; then\n        if test -z \"$ansi\"; then\n          vl_cv_prog_cc_warnings=\"-fullwarn\"\n        else\n          vl_cv_prog_cc_warnings=\"-fullwarn -ansi -ansiE\"\n        fi\n\n            elif what $CC 2>&1 | grep -i \"HP C Compiler\" > /dev/null 2>&1 &&\n           $CC -c -Aa +w1 conftest.c > /dev/null 2>&1 &&\n           test -f conftest.o; then\n        if test -z \"$ansi\"; then\n          vl_cv_prog_cc_warnings=\"+w1\"\n        else\n          vl_cv_prog_cc_warnings=\"+w1 -Aa\"\n        fi\n\n            elif $CC -V 2>&1 | grep \"/SX\" > /dev/null 2>&1 &&\n           $CC -c -pvctl,fullmsg -Xc conftest.c > /dev/null 2>&1 &&\n           test -f conftest.o; then\n        if test -z \"$ansi\"; then\n          vl_cv_prog_cc_warnings=\"-pvctl,fullmsg\"\n        else\n          vl_cv_prog_cc_warnings=\"-pvctl,fullmsg -Xc\"\n        fi\n\n            elif $CC -V 2>&1 | grep -i \"Cray\" > /dev/null 2>&1 &&\n           $CC -c -h msglevel 2 conftest.c > /dev/null 2>&1 &&\n           test -f conftest.o; then\n        if test -z \"$ansi\"; then\n          vl_cv_prog_cc_warnings=\"-h msglevel 2\"\n        else\n          vl_cv_prog_cc_warnings=\"-h msglevel 2 -h conform\"\n        fi\n\n      fi\n      rm -f conftest.*\n    fi\n    if test -n \"$vl_cv_prog_cc_warnings\"; then\n      CFLAGS=\"$CFLAGS $vl_cv_prog_cc_warnings\"\n    else\n      vl_cv_prog_cc_warnings=\"unknown\"\n    fi\n\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $vl_cv_prog_cc_warnings\" >&5\n$as_echo \"$vl_cv_prog_cc_warnings\" >&6; }\n\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \\$(MAKE)\" >&5\n$as_echo_n \"checking whether ${MAKE-make} sets \\$(MAKE)... \" >&6; }\nset x ${MAKE-make}\nac_make=`$as_echo \"$2\" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`\nif { as_var=ac_cv_prog_make_${ac_make}_set; eval \"test \\\"\\${$as_var+set}\\\" = set\"; }; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  cat >conftest.make <<\\_ACEOF\nSHELL = /bin/sh\nall:\n\t@echo '@@@%%%=$(MAKE)=@@@%%%'\n_ACEOF\n# GNU make sometimes prints \"make[1]: Entering...\", which would confuse us.\ncase `${MAKE-make} -f conftest.make 2>/dev/null` in\n  *@@@%%%=?*=@@@%%%*)\n    eval ac_cv_prog_make_${ac_make}_set=yes;;\n  *)\n    eval ac_cv_prog_make_${ac_make}_set=no;;\nesac\nrm -f conftest.make\nfi\nif eval test \\$ac_cv_prog_make_${ac_make}_set = yes; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: yes\" >&5\n$as_echo \"yes\" >&6; }\n  SET_MAKE=\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\n  SET_MAKE=\"MAKE=${MAKE-make}\"\nfi\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking whether ln -s works\" >&5\n$as_echo_n \"checking whether ln -s works... \" >&6; }\nLN_S=$as_ln_s\nif test \"$LN_S\" = \"ln -s\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: yes\" >&5\n$as_echo \"yes\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no, using $LN_S\" >&5\n$as_echo \"no, using $LN_S\" >&6; }\nfi\n\n\n\n\n\ncase `pwd` in\n  *\\ * | *\\\t*)\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \\`pwd\\`\" >&5\n$as_echo \"$as_me: WARNING: Libtool does not cope well with whitespace in \\`pwd\\`\" >&2;} ;;\nesac\n\n\n\nmacro_version='2.2.6'\nmacro_revision='1.3012'\n\n\n\n\n\n\n\n\n\n\n\n\n\nltmain=\"$ac_aux_dir/ltmain.sh\"\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)\" >&5\n$as_echo_n \"checking for BSD- or MS-compatible name lister (nm)... \" >&6; }\nif test \"${lt_cv_path_NM+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$NM\"; then\n  # Let the user override the test.\n  lt_cv_path_NM=\"$NM\"\nelse\n  lt_nm_to_check=\"${ac_tool_prefix}nm\"\n  if test -n \"$ac_tool_prefix\" && test \"$build\" = \"$host\"; then\n    lt_nm_to_check=\"$lt_nm_to_check nm\"\n  fi\n  for lt_tmp_nm in $lt_nm_to_check; do\n    lt_save_ifs=\"$IFS\"; IFS=$PATH_SEPARATOR\n    for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do\n      IFS=\"$lt_save_ifs\"\n      test -z \"$ac_dir\" && ac_dir=.\n      tmp_nm=\"$ac_dir/$lt_tmp_nm\"\n      if test -f \"$tmp_nm\" || test -f \"$tmp_nm$ac_exeext\" ; then\n\t# Check to see if the nm accepts a BSD-compat flag.\n\t# Adding the `sed 1q' prevents false positives on HP-UX, which says:\n\t#   nm: unknown option \"B\" ignored\n\t# Tru64's nm complains that /dev/null is an invalid object file\n\tcase `\"$tmp_nm\" -B /dev/null 2>&1 | sed '1q'` in\n\t*/dev/null* | *'Invalid file or object type'*)\n\t  lt_cv_path_NM=\"$tmp_nm -B\"\n\t  break\n\t  ;;\n\t*)\n\t  case `\"$tmp_nm\" -p /dev/null 2>&1 | sed '1q'` in\n\t  */dev/null*)\n\t    lt_cv_path_NM=\"$tmp_nm -p\"\n\t    break\n\t    ;;\n\t  *)\n\t    lt_cv_path_NM=${lt_cv_path_NM=\"$tmp_nm\"} # keep the first match, but\n\t    continue # so that we can try to find one that supports BSD flags\n\t    ;;\n\t  esac\n\t  ;;\n\tesac\n      fi\n    done\n    IFS=\"$lt_save_ifs\"\n  done\n  : ${lt_cv_path_NM=no}\nfi\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM\" >&5\n$as_echo \"$lt_cv_path_NM\" >&6; }\nif test \"$lt_cv_path_NM\" != \"no\"; then\n  NM=\"$lt_cv_path_NM\"\nelse\n  # Didn't find any BSD compatible name lister, look for dumpbin.\n  if test -n \"$ac_tool_prefix\"; then\n  for ac_prog in \"dumpbin -symbols\" \"link -dump -symbols\"\n  do\n    # Extract the first word of \"$ac_tool_prefix$ac_prog\", so it can be a program name with args.\nset dummy $ac_tool_prefix$ac_prog; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif test \"${ac_cv_prog_DUMPBIN+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$DUMPBIN\"; then\n  ac_cv_prog_DUMPBIN=\"$DUMPBIN\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_DUMPBIN=\"$ac_tool_prefix$ac_prog\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nDUMPBIN=$ac_cv_prog_DUMPBIN\nif test -n \"$DUMPBIN\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $DUMPBIN\" >&5\n$as_echo \"$DUMPBIN\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n\n    test -n \"$DUMPBIN\" && break\n  done\nfi\nif test -z \"$DUMPBIN\"; then\n  ac_ct_DUMPBIN=$DUMPBIN\n  for ac_prog in \"dumpbin -symbols\" \"link -dump -symbols\"\ndo\n  # Extract the first word of \"$ac_prog\", so it can be a program name with args.\nset dummy $ac_prog; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif test \"${ac_cv_prog_ac_ct_DUMPBIN+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$ac_ct_DUMPBIN\"; then\n  ac_cv_prog_ac_ct_DUMPBIN=\"$ac_ct_DUMPBIN\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_ac_ct_DUMPBIN=\"$ac_prog\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN\nif test -n \"$ac_ct_DUMPBIN\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN\" >&5\n$as_echo \"$ac_ct_DUMPBIN\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n\n  test -n \"$ac_ct_DUMPBIN\" && break\ndone\n\n  if test \"x$ac_ct_DUMPBIN\" = x; then\n    DUMPBIN=\":\"\n  else\n    case $cross_compiling:$ac_tool_warned in\nyes:)\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet\" >&5\n$as_echo \"$as_me: WARNING: using cross tools not prefixed with host triplet\" >&2;}\nac_tool_warned=yes ;;\nesac\n    DUMPBIN=$ac_ct_DUMPBIN\n  fi\nfi\n\n\n  if test \"$DUMPBIN\" != \":\"; then\n    NM=\"$DUMPBIN\"\n  fi\nfi\ntest -z \"$NM\" && NM=nm\n\n\n\n\n\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface\" >&5\n$as_echo_n \"checking the name lister ($NM) interface... \" >&6; }\nif test \"${lt_cv_nm_interface+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  lt_cv_nm_interface=\"BSD nm\"\n  echo \"int some_variable = 0;\" > conftest.$ac_ext\n  (eval echo \"\\\"\\$as_me:5907: $ac_compile\\\"\" >&5)\n  (eval \"$ac_compile\" 2>conftest.err)\n  cat conftest.err >&5\n  (eval echo \"\\\"\\$as_me:5910: $NM \\\\\\\"conftest.$ac_objext\\\\\\\"\\\"\" >&5)\n  (eval \"$NM \\\"conftest.$ac_objext\\\"\" 2>conftest.err > conftest.out)\n  cat conftest.err >&5\n  (eval echo \"\\\"\\$as_me:5913: output\\\"\" >&5)\n  cat conftest.out >&5\n  if $GREP 'External.*some_variable' conftest.out > /dev/null; then\n    lt_cv_nm_interface=\"MS dumpbin\"\n  fi\n  rm -f conftest*\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface\" >&5\n$as_echo \"$lt_cv_nm_interface\" >&6; }\n\n# find the maximum length of command line arguments\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments\" >&5\n$as_echo_n \"checking the maximum length of command line arguments... \" >&6; }\nif test \"${lt_cv_sys_max_cmd_len+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n    i=0\n  teststring=\"ABCD\"\n\n  case $build_os in\n  msdosdjgpp*)\n    # On DJGPP, this test can blow up pretty badly due to problems in libc\n    # (any single argument exceeding 2000 bytes causes a buffer overrun\n    # during glob expansion).  Even if it were fixed, the result of this\n    # check would be larger than it should be.\n    lt_cv_sys_max_cmd_len=12288;    # 12K is about right\n    ;;\n\n  gnu*)\n    # Under GNU Hurd, this test is not required because there is\n    # no limit to the length of command line arguments.\n    # Libtool will interpret -1 as no limit whatsoever\n    lt_cv_sys_max_cmd_len=-1;\n    ;;\n\n  cygwin* | mingw* | cegcc*)\n    # On Win9x/ME, this test blows up -- it succeeds, but takes\n    # about 5 minutes as the teststring grows exponentially.\n    # Worse, since 9x/ME are not pre-emptively multitasking,\n    # you end up with a \"frozen\" computer, even though with patience\n    # the test eventually succeeds (with a max line length of 256k).\n    # Instead, let's just punt: use the minimum linelength reported by\n    # all of the supported platforms: 8192 (on NT/2K/XP).\n    lt_cv_sys_max_cmd_len=8192;\n    ;;\n\n  amigaos*)\n    # On AmigaOS with pdksh, this test takes hours, literally.\n    # So we just punt and use a minimum line length of 8192.\n    lt_cv_sys_max_cmd_len=8192;\n    ;;\n\n  netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)\n    # This has been around since 386BSD, at least.  Likely further.\n    if test -x /sbin/sysctl; then\n      lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`\n    elif test -x /usr/sbin/sysctl; then\n      lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`\n    else\n      lt_cv_sys_max_cmd_len=65536\t# usable default for all BSDs\n    fi\n    # And add a safety zone\n    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \\/ 4`\n    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \\* 3`\n    ;;\n\n  interix*)\n    # We know the value 262144 and hardcode it with a safety zone (like BSD)\n    lt_cv_sys_max_cmd_len=196608\n    ;;\n\n  osf*)\n    # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure\n    # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not\n    # nice to cause kernel panics so lets avoid the loop below.\n    # First set a reasonable default.\n    lt_cv_sys_max_cmd_len=16384\n    #\n    if test -x /sbin/sysconfig; then\n      case `/sbin/sysconfig -q proc exec_disable_arg_limit` in\n        *1*) lt_cv_sys_max_cmd_len=-1 ;;\n      esac\n    fi\n    ;;\n  sco3.2v5*)\n    lt_cv_sys_max_cmd_len=102400\n    ;;\n  sysv5* | sco5v6* | sysv4.2uw2*)\n    kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`\n    if test -n \"$kargmax\"; then\n      lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[\t ]//'`\n    else\n      lt_cv_sys_max_cmd_len=32768\n    fi\n    ;;\n  *)\n    lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`\n    if test -n \"$lt_cv_sys_max_cmd_len\"; then\n      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \\/ 4`\n      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \\* 3`\n    else\n      # Make teststring a little bigger before we do anything with it.\n      # a 1K string should be a reasonable start.\n      for i in 1 2 3 4 5 6 7 8 ; do\n        teststring=$teststring$teststring\n      done\n      SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}\n      # If test is not a shell built-in, we'll probably end up computing a\n      # maximum length that is only half of the actual maximum length, but\n      # we can't tell.\n      while { test \"X\"`$SHELL $0 --fallback-echo \"X$teststring$teststring\" 2>/dev/null` \\\n\t         = \"XX$teststring$teststring\"; } >/dev/null 2>&1 &&\n\t      test $i != 17 # 1/2 MB should be enough\n      do\n        i=`expr $i + 1`\n        teststring=$teststring$teststring\n      done\n      # Only check the string length outside the loop.\n      lt_cv_sys_max_cmd_len=`expr \"X$teststring\" : \".*\" 2>&1`\n      teststring=\n      # Add a significant safety factor because C++ compilers can tack on\n      # massive amounts of additional arguments before passing them to the\n      # linker.  It appears as though 1/2 is a usable value.\n      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \\/ 2`\n    fi\n    ;;\n  esac\n\nfi\n\nif test -n $lt_cv_sys_max_cmd_len ; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len\" >&5\n$as_echo \"$lt_cv_sys_max_cmd_len\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: none\" >&5\n$as_echo \"none\" >&6; }\nfi\nmax_cmd_len=$lt_cv_sys_max_cmd_len\n\n\n\n\n\n\n: ${CP=\"cp -f\"}\n: ${MV=\"mv -f\"}\n: ${RM=\"rm -f\"}\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs\" >&5\n$as_echo_n \"checking whether the shell understands some XSI constructs... \" >&6; }\n# Try some XSI features\nxsi_shell=no\n( _lt_dummy=\"a/b/c\"\n  test \"${_lt_dummy##*/},${_lt_dummy%/*},\"${_lt_dummy%\"$_lt_dummy\"}, \\\n      = c,a/b,, \\\n    && eval 'test $(( 1 + 1 )) -eq 2 \\\n    && test \"${#_lt_dummy}\" -eq 5' ) >/dev/null 2>&1 \\\n  && xsi_shell=yes\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $xsi_shell\" >&5\n$as_echo \"$xsi_shell\" >&6; }\n\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking whether the shell understands \\\"+=\\\"\" >&5\n$as_echo_n \"checking whether the shell understands \\\"+=\\\"... \" >&6; }\nlt_shell_append=no\n( foo=bar; set foo baz; eval \"$1+=\\$2\" && test \"$foo\" = barbaz ) \\\n    >/dev/null 2>&1 \\\n  && lt_shell_append=yes\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $lt_shell_append\" >&5\n$as_echo \"$lt_shell_append\" >&6; }\n\n\nif ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then\n  lt_unset=unset\nelse\n  lt_unset=false\nfi\n\n\n\n\n\n# test EBCDIC or ASCII\ncase `echo X|tr X '\\101'` in\n A) # ASCII based system\n    # \\n is not interpreted correctly by Solaris 8 /usr/ucb/tr\n  lt_SP2NL='tr \\040 \\012'\n  lt_NL2SP='tr \\015\\012 \\040\\040'\n  ;;\n *) # EBCDIC based system\n  lt_SP2NL='tr \\100 \\n'\n  lt_NL2SP='tr \\r\\n \\100\\100'\n  ;;\nesac\n\n\n\n\n\n\n\n\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files\" >&5\n$as_echo_n \"checking for $LD option to reload object files... \" >&6; }\nif test \"${lt_cv_ld_reload_flag+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  lt_cv_ld_reload_flag='-r'\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag\" >&5\n$as_echo \"$lt_cv_ld_reload_flag\" >&6; }\nreload_flag=$lt_cv_ld_reload_flag\ncase $reload_flag in\n\"\" | \" \"*) ;;\n*) reload_flag=\" $reload_flag\" ;;\nesac\nreload_cmds='$LD$reload_flag -o $output$reload_objs'\ncase $host_os in\n  darwin*)\n    if test \"$GCC\" = yes; then\n      reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'\n    else\n      reload_cmds='$LD$reload_flag -o $output$reload_objs'\n    fi\n    ;;\nesac\n\n\n\n\n\n\n\n\n\nif test -n \"$ac_tool_prefix\"; then\n  # Extract the first word of \"${ac_tool_prefix}objdump\", so it can be a program name with args.\nset dummy ${ac_tool_prefix}objdump; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif test \"${ac_cv_prog_OBJDUMP+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$OBJDUMP\"; then\n  ac_cv_prog_OBJDUMP=\"$OBJDUMP\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_OBJDUMP=\"${ac_tool_prefix}objdump\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nOBJDUMP=$ac_cv_prog_OBJDUMP\nif test -n \"$OBJDUMP\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $OBJDUMP\" >&5\n$as_echo \"$OBJDUMP\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n\nfi\nif test -z \"$ac_cv_prog_OBJDUMP\"; then\n  ac_ct_OBJDUMP=$OBJDUMP\n  # Extract the first word of \"objdump\", so it can be a program name with args.\nset dummy objdump; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif test \"${ac_cv_prog_ac_ct_OBJDUMP+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$ac_ct_OBJDUMP\"; then\n  ac_cv_prog_ac_ct_OBJDUMP=\"$ac_ct_OBJDUMP\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_ac_ct_OBJDUMP=\"objdump\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP\nif test -n \"$ac_ct_OBJDUMP\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP\" >&5\n$as_echo \"$ac_ct_OBJDUMP\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n  if test \"x$ac_ct_OBJDUMP\" = x; then\n    OBJDUMP=\"false\"\n  else\n    case $cross_compiling:$ac_tool_warned in\nyes:)\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet\" >&5\n$as_echo \"$as_me: WARNING: using cross tools not prefixed with host triplet\" >&2;}\nac_tool_warned=yes ;;\nesac\n    OBJDUMP=$ac_ct_OBJDUMP\n  fi\nelse\n  OBJDUMP=\"$ac_cv_prog_OBJDUMP\"\nfi\n\ntest -z \"$OBJDUMP\" && OBJDUMP=objdump\n\n\n\n\n\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries\" >&5\n$as_echo_n \"checking how to recognize dependent libraries... \" >&6; }\nif test \"${lt_cv_deplibs_check_method+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  lt_cv_file_magic_cmd='$MAGIC_CMD'\nlt_cv_file_magic_test_file=\nlt_cv_deplibs_check_method='unknown'\n# Need to set the preceding variable on all platforms that support\n# interlibrary dependencies.\n# 'none' -- dependencies not supported.\n# `unknown' -- same as none, but documents that we really don't know.\n# 'pass_all' -- all dependencies passed with no checks.\n# 'test_compile' -- check by making test program.\n# 'file_magic [[regex]]' -- check by looking for files in library path\n# which responds to the $file_magic_cmd with a given extended regex.\n# If you have `file' or equivalent on your system and you're not sure\n# whether `pass_all' will *always* work, you probably want this one.\n\ncase $host_os in\naix[4-9]*)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\nbeos*)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\nbsdi[45]*)\n  lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'\n  lt_cv_file_magic_cmd='/usr/bin/file -L'\n  lt_cv_file_magic_test_file=/shlib/libc.so\n  ;;\n\ncygwin*)\n  # func_win32_libid is a shell function defined in ltmain.sh\n  lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'\n  lt_cv_file_magic_cmd='func_win32_libid'\n  ;;\n\nmingw* | pw32*)\n  # Base MSYS/MinGW do not provide the 'file' command needed by\n  # func_win32_libid shell function, so use a weaker test based on 'objdump',\n  # unless we find 'file', for example because we are cross-compiling.\n  if ( file / ) >/dev/null 2>&1; then\n    lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'\n    lt_cv_file_magic_cmd='func_win32_libid'\n  else\n    lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'\n    lt_cv_file_magic_cmd='$OBJDUMP -f'\n  fi\n  ;;\n\ncegcc)\n  # use the weaker test based on 'objdump'. See mingw*.\n  lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'\n  lt_cv_file_magic_cmd='$OBJDUMP -f'\n  ;;\n\ndarwin* | rhapsody*)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\nfreebsd* | dragonfly*)\n  if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then\n    case $host_cpu in\n    i*86 )\n      # Not sure whether the presence of OpenBSD here was a mistake.\n      # Let's accept both of them until this is cleared up.\n      lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library'\n      lt_cv_file_magic_cmd=/usr/bin/file\n      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`\n      ;;\n    esac\n  else\n    lt_cv_deplibs_check_method=pass_all\n  fi\n  ;;\n\ngnu*)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\nhpux10.20* | hpux11*)\n  lt_cv_file_magic_cmd=/usr/bin/file\n  case $host_cpu in\n  ia64*)\n    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64'\n    lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so\n    ;;\n  hppa*64*)\n    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'\n    lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl\n    ;;\n  *)\n    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'\n    lt_cv_file_magic_test_file=/usr/lib/libc.sl\n    ;;\n  esac\n  ;;\n\ninterix[3-9]*)\n  # PIC code is broken on Interix 3.x, that's why |\\.a not |_pic\\.a here\n  lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\\.so|\\.a)$'\n  ;;\n\nirix5* | irix6* | nonstopux*)\n  case $LD in\n  *-32|*\"-32 \") libmagic=32-bit;;\n  *-n32|*\"-n32 \") libmagic=N32;;\n  *-64|*\"-64 \") libmagic=64-bit;;\n  *) libmagic=never-match;;\n  esac\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\n# This must be Linux ELF.\nlinux* | k*bsd*-gnu)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\nnetbsd*)\n  if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then\n    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\\.so\\.[0-9]+\\.[0-9]+|_pic\\.a)$'\n  else\n    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\\.so|_pic\\.a)$'\n  fi\n  ;;\n\nnewos6*)\n  lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)'\n  lt_cv_file_magic_cmd=/usr/bin/file\n  lt_cv_file_magic_test_file=/usr/lib/libnls.so\n  ;;\n\n*nto* | *qnx*)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\nopenbsd*)\n  if test -z \"`echo __ELF__ | $CC -E - | $GREP __ELF__`\" || test \"$host_os-$host_cpu\" = \"openbsd2.8-powerpc\"; then\n    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\\.so\\.[0-9]+\\.[0-9]+|\\.so|_pic\\.a)$'\n  else\n    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\\.so\\.[0-9]+\\.[0-9]+|_pic\\.a)$'\n  fi\n  ;;\n\nosf3* | osf4* | osf5*)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\nrdos*)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\nsolaris*)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\nsysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\nsysv4 | sysv4.3*)\n  case $host_vendor in\n  motorola)\n    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'\n    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`\n    ;;\n  ncr)\n    lt_cv_deplibs_check_method=pass_all\n    ;;\n  sequent)\n    lt_cv_file_magic_cmd='/bin/file'\n    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'\n    ;;\n  sni)\n    lt_cv_file_magic_cmd='/bin/file'\n    lt_cv_deplibs_check_method=\"file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib\"\n    lt_cv_file_magic_test_file=/lib/libc.so\n    ;;\n  siemens)\n    lt_cv_deplibs_check_method=pass_all\n    ;;\n  pc)\n    lt_cv_deplibs_check_method=pass_all\n    ;;\n  esac\n  ;;\n\ntpf*)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\nesac\n\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method\" >&5\n$as_echo \"$lt_cv_deplibs_check_method\" >&6; }\nfile_magic_cmd=$lt_cv_file_magic_cmd\ndeplibs_check_method=$lt_cv_deplibs_check_method\ntest -z \"$deplibs_check_method\" && deplibs_check_method=unknown\n\n\n\n\n\n\n\n\n\n\n\n\nif test -n \"$ac_tool_prefix\"; then\n  # Extract the first word of \"${ac_tool_prefix}ar\", so it can be a program name with args.\nset dummy ${ac_tool_prefix}ar; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif test \"${ac_cv_prog_AR+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$AR\"; then\n  ac_cv_prog_AR=\"$AR\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_AR=\"${ac_tool_prefix}ar\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nAR=$ac_cv_prog_AR\nif test -n \"$AR\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $AR\" >&5\n$as_echo \"$AR\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n\nfi\nif test -z \"$ac_cv_prog_AR\"; then\n  ac_ct_AR=$AR\n  # Extract the first word of \"ar\", so it can be a program name with args.\nset dummy ar; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif test \"${ac_cv_prog_ac_ct_AR+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$ac_ct_AR\"; then\n  ac_cv_prog_ac_ct_AR=\"$ac_ct_AR\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_ac_ct_AR=\"ar\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nac_ct_AR=$ac_cv_prog_ac_ct_AR\nif test -n \"$ac_ct_AR\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR\" >&5\n$as_echo \"$ac_ct_AR\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n  if test \"x$ac_ct_AR\" = x; then\n    AR=\"false\"\n  else\n    case $cross_compiling:$ac_tool_warned in\nyes:)\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet\" >&5\n$as_echo \"$as_me: WARNING: using cross tools not prefixed with host triplet\" >&2;}\nac_tool_warned=yes ;;\nesac\n    AR=$ac_ct_AR\n  fi\nelse\n  AR=\"$ac_cv_prog_AR\"\nfi\n\ntest -z \"$AR\" && AR=ar\ntest -z \"$AR_FLAGS\" && AR_FLAGS=cru\n\n\n\n\n\n\n\n\n\n\n\nif test -n \"$ac_tool_prefix\"; then\n  # Extract the first word of \"${ac_tool_prefix}strip\", so it can be a program name with args.\nset dummy ${ac_tool_prefix}strip; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif test \"${ac_cv_prog_STRIP+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$STRIP\"; then\n  ac_cv_prog_STRIP=\"$STRIP\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_STRIP=\"${ac_tool_prefix}strip\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nSTRIP=$ac_cv_prog_STRIP\nif test -n \"$STRIP\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $STRIP\" >&5\n$as_echo \"$STRIP\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n\nfi\nif test -z \"$ac_cv_prog_STRIP\"; then\n  ac_ct_STRIP=$STRIP\n  # Extract the first word of \"strip\", so it can be a program name with args.\nset dummy strip; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif test \"${ac_cv_prog_ac_ct_STRIP+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$ac_ct_STRIP\"; then\n  ac_cv_prog_ac_ct_STRIP=\"$ac_ct_STRIP\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_ac_ct_STRIP=\"strip\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP\nif test -n \"$ac_ct_STRIP\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP\" >&5\n$as_echo \"$ac_ct_STRIP\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n  if test \"x$ac_ct_STRIP\" = x; then\n    STRIP=\":\"\n  else\n    case $cross_compiling:$ac_tool_warned in\nyes:)\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet\" >&5\n$as_echo \"$as_me: WARNING: using cross tools not prefixed with host triplet\" >&2;}\nac_tool_warned=yes ;;\nesac\n    STRIP=$ac_ct_STRIP\n  fi\nelse\n  STRIP=\"$ac_cv_prog_STRIP\"\nfi\n\ntest -z \"$STRIP\" && STRIP=:\n\n\n\n\n\n\nif test -n \"$ac_tool_prefix\"; then\n  # Extract the first word of \"${ac_tool_prefix}ranlib\", so it can be a program name with args.\nset dummy ${ac_tool_prefix}ranlib; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif test \"${ac_cv_prog_RANLIB+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$RANLIB\"; then\n  ac_cv_prog_RANLIB=\"$RANLIB\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_RANLIB=\"${ac_tool_prefix}ranlib\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nRANLIB=$ac_cv_prog_RANLIB\nif test -n \"$RANLIB\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $RANLIB\" >&5\n$as_echo \"$RANLIB\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n\nfi\nif test -z \"$ac_cv_prog_RANLIB\"; then\n  ac_ct_RANLIB=$RANLIB\n  # Extract the first word of \"ranlib\", so it can be a program name with args.\nset dummy ranlib; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif test \"${ac_cv_prog_ac_ct_RANLIB+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$ac_ct_RANLIB\"; then\n  ac_cv_prog_ac_ct_RANLIB=\"$ac_ct_RANLIB\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_ac_ct_RANLIB=\"ranlib\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB\nif test -n \"$ac_ct_RANLIB\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB\" >&5\n$as_echo \"$ac_ct_RANLIB\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n  if test \"x$ac_ct_RANLIB\" = x; then\n    RANLIB=\":\"\n  else\n    case $cross_compiling:$ac_tool_warned in\nyes:)\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet\" >&5\n$as_echo \"$as_me: WARNING: using cross tools not prefixed with host triplet\" >&2;}\nac_tool_warned=yes ;;\nesac\n    RANLIB=$ac_ct_RANLIB\n  fi\nelse\n  RANLIB=\"$ac_cv_prog_RANLIB\"\nfi\n\ntest -z \"$RANLIB\" && RANLIB=:\n\n\n\n\n\n\n# Determine commands to create old-style static archives.\nold_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'\nold_postinstall_cmds='chmod 644 $oldlib'\nold_postuninstall_cmds=\n\nif test -n \"$RANLIB\"; then\n  case $host_os in\n  openbsd*)\n    old_postinstall_cmds=\"$old_postinstall_cmds~\\$RANLIB -t \\$oldlib\"\n    ;;\n  *)\n    old_postinstall_cmds=\"$old_postinstall_cmds~\\$RANLIB \\$oldlib\"\n    ;;\n  esac\n  old_archive_cmds=\"$old_archive_cmds~\\$RANLIB \\$oldlib\"\nfi\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n# If no C compiler was specified, use CC.\nLTCC=${LTCC-\"$CC\"}\n\n# If no C compiler flags were specified, use CFLAGS.\nLTCFLAGS=${LTCFLAGS-\"$CFLAGS\"}\n\n# Allow CC to be a program name with arguments.\ncompiler=$CC\n\n\n# Check for command to grab the raw symbol name followed by C symbol from nm.\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object\" >&5\n$as_echo_n \"checking command to parse $NM output from $compiler object... \" >&6; }\nif test \"${lt_cv_sys_global_symbol_pipe+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n\n# These are sane defaults that work on at least a few old systems.\n# [They come from Ultrix.  What could be older than Ultrix?!! ;)]\n\n# Character class describing NM global symbol codes.\nsymcode='[BCDEGRST]'\n\n# Regexp to match symbols that can be accessed directly from C.\nsympat='\\([_A-Za-z][_A-Za-z0-9]*\\)'\n\n# Define system-specific variables.\ncase $host_os in\naix*)\n  symcode='[BCDT]'\n  ;;\ncygwin* | mingw* | pw32* | cegcc*)\n  symcode='[ABCDGISTW]'\n  ;;\nhpux*)\n  if test \"$host_cpu\" = ia64; then\n    symcode='[ABCDEGRST]'\n  fi\n  ;;\nirix* | nonstopux*)\n  symcode='[BCDEGRST]'\n  ;;\nosf*)\n  symcode='[BCDEGQRST]'\n  ;;\nsolaris*)\n  symcode='[BDRT]'\n  ;;\nsco3.2v5*)\n  symcode='[DT]'\n  ;;\nsysv4.2uw2*)\n  symcode='[DT]'\n  ;;\nsysv5* | sco5v6* | unixware* | OpenUNIX*)\n  symcode='[ABDT]'\n  ;;\nsysv4)\n  symcode='[DFNSTU]'\n  ;;\nesac\n\n# If we're using GNU nm, then use its standard symbol codes.\ncase `$NM -V 2>&1` in\n*GNU* | *'with BFD'*)\n  symcode='[ABCDGIRSTW]' ;;\nesac\n\n# Transform an extracted symbol line into a proper C declaration.\n# Some systems (esp. on ia64) link data and code symbols differently,\n# so use this general approach.\nlt_cv_sys_global_symbol_to_cdecl=\"sed -n -e 's/^T .* \\(.*\\)$/extern int \\1();/p' -e 's/^$symcode* .* \\(.*\\)$/extern char \\1;/p'\"\n\n# Transform an extracted symbol line into symbol name and symbol address\nlt_cv_sys_global_symbol_to_c_name_address=\"sed -n -e 's/^: \\([^ ]*\\) $/  {\\\\\\\"\\1\\\\\\\", (void *) 0},/p' -e 's/^$symcode* \\([^ ]*\\) \\([^ ]*\\)$/  {\\\"\\2\\\", (void *) \\&\\2},/p'\"\nlt_cv_sys_global_symbol_to_c_name_address_lib_prefix=\"sed -n -e 's/^: \\([^ ]*\\) $/  {\\\\\\\"\\1\\\\\\\", (void *) 0},/p' -e 's/^$symcode* \\([^ ]*\\) \\(lib[^ ]*\\)$/  {\\\"\\2\\\", (void *) \\&\\2},/p' -e 's/^$symcode* \\([^ ]*\\) \\([^ ]*\\)$/  {\\\"lib\\2\\\", (void *) \\&\\2},/p'\"\n\n# Handle CRLF in mingw tool chain\nopt_cr=\ncase $build_os in\nmingw*)\n  opt_cr=`$ECHO 'x\\{0,1\\}' | tr x '\\015'` # option cr in regexp\n  ;;\nesac\n\n# Try without a prefix underscore, then with it.\nfor ac_symprfx in \"\" \"_\"; do\n\n  # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.\n  symxfrm=\"\\\\1 $ac_symprfx\\\\2 \\\\2\"\n\n  # Write the raw and C identifiers.\n  if test \"$lt_cv_nm_interface\" = \"MS dumpbin\"; then\n    # Fake it for dumpbin and say T for any non-static function\n    # and D for any global variable.\n    # Also find C++ and __fastcall symbols from MSVC++,\n    # which start with @ or ?.\n    lt_cv_sys_global_symbol_pipe=\"$AWK '\"\\\n\"     {last_section=section; section=\\$ 3};\"\\\n\"     /Section length .*#relocs.*(pick any)/{hide[last_section]=1};\"\\\n\"     \\$ 0!~/External *\\|/{next};\"\\\n\"     / 0+ UNDEF /{next}; / UNDEF \\([^|]\\)*()/{next};\"\\\n\"     {if(hide[section]) next};\"\\\n\"     {f=0}; \\$ 0~/\\(\\).*\\|/{f=1}; {printf f ? \\\"T \\\" : \\\"D \\\"};\"\\\n\"     {split(\\$ 0, a, /\\||\\r/); split(a[2], s)};\"\\\n\"     s[1]~/^[@?]/{print s[1], s[1]; next};\"\\\n\"     s[1]~prfx {split(s[1],t,\\\"@\\\"); print t[1], substr(t[1],length(prfx))}\"\\\n\"     ' prfx=^$ac_symprfx\"\n  else\n    lt_cv_sys_global_symbol_pipe=\"sed -n -e 's/^.*[\t ]\\($symcode$symcode*\\)[\t ][\t ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'\"\n  fi\n\n  # Check to see that the pipe works correctly.\n  pipe_works=no\n\n  rm -f conftest*\n  cat > conftest.$ac_ext <<_LT_EOF\n#ifdef __cplusplus\nextern \"C\" {\n#endif\nchar nm_test_var;\nvoid nm_test_func(void);\nvoid nm_test_func(void){}\n#ifdef __cplusplus\n}\n#endif\nint main(){nm_test_var='a';nm_test_func();return(0);}\n_LT_EOF\n\n  if { { eval echo \"\\\"\\$as_me\\\":${as_lineno-$LINENO}: \\\"$ac_compile\\\"\"; } >&5\n  (eval $ac_compile) 2>&5\n  ac_status=$?\n  $as_echo \"$as_me:${as_lineno-$LINENO}: \\$? = $ac_status\" >&5\n  test $ac_status = 0; }; then\n    # Now try to grab the symbols.\n    nlist=conftest.nm\n    if { { eval echo \"\\\"\\$as_me\\\":${as_lineno-$LINENO}: \\\"$NM conftest.$ac_objext \\| $lt_cv_sys_global_symbol_pipe \\> $nlist\\\"\"; } >&5\n  (eval $NM conftest.$ac_objext \\| $lt_cv_sys_global_symbol_pipe \\> $nlist) 2>&5\n  ac_status=$?\n  $as_echo \"$as_me:${as_lineno-$LINENO}: \\$? = $ac_status\" >&5\n  test $ac_status = 0; } && test -s \"$nlist\"; then\n      # Try sorting and uniquifying the output.\n      if sort \"$nlist\" | uniq > \"$nlist\"T; then\n\tmv -f \"$nlist\"T \"$nlist\"\n      else\n\trm -f \"$nlist\"T\n      fi\n\n      # Make sure that we snagged all the symbols we need.\n      if $GREP ' nm_test_var$' \"$nlist\" >/dev/null; then\n\tif $GREP ' nm_test_func$' \"$nlist\" >/dev/null; then\n\t  cat <<_LT_EOF > conftest.$ac_ext\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n_LT_EOF\n\t  # Now generate the symbol file.\n\t  eval \"$lt_cv_sys_global_symbol_to_cdecl\"' < \"$nlist\" | $GREP -v main >> conftest.$ac_ext'\n\n\t  cat <<_LT_EOF >> conftest.$ac_ext\n\n/* The mapping between symbol names and symbols.  */\nconst struct {\n  const char *name;\n  void       *address;\n}\nlt__PROGRAM__LTX_preloaded_symbols[] =\n{\n  { \"@PROGRAM@\", (void *) 0 },\n_LT_EOF\n\t  $SED \"s/^$symcode$symcode* \\(.*\\) \\(.*\\)$/  {\\\"\\2\\\", (void *) \\&\\2},/\" < \"$nlist\" | $GREP -v main >> conftest.$ac_ext\n\t  cat <<\\_LT_EOF >> conftest.$ac_ext\n  {0, (void *) 0}\n};\n\n/* This works around a problem in FreeBSD linker */\n#ifdef FREEBSD_WORKAROUND\nstatic const void *lt_preloaded_setup() {\n  return lt__PROGRAM__LTX_preloaded_symbols;\n}\n#endif\n\n#ifdef __cplusplus\n}\n#endif\n_LT_EOF\n\t  # Now try linking the two files.\n\t  mv conftest.$ac_objext conftstm.$ac_objext\n\t  lt_save_LIBS=\"$LIBS\"\n\t  lt_save_CFLAGS=\"$CFLAGS\"\n\t  LIBS=\"conftstm.$ac_objext\"\n\t  CFLAGS=\"$CFLAGS$lt_prog_compiler_no_builtin_flag\"\n\t  if { { eval echo \"\\\"\\$as_me\\\":${as_lineno-$LINENO}: \\\"$ac_link\\\"\"; } >&5\n  (eval $ac_link) 2>&5\n  ac_status=$?\n  $as_echo \"$as_me:${as_lineno-$LINENO}: \\$? = $ac_status\" >&5\n  test $ac_status = 0; } && test -s conftest${ac_exeext}; then\n\t    pipe_works=yes\n\t  fi\n\t  LIBS=\"$lt_save_LIBS\"\n\t  CFLAGS=\"$lt_save_CFLAGS\"\n\telse\n\t  echo \"cannot find nm_test_func in $nlist\" >&5\n\tfi\n      else\n\techo \"cannot find nm_test_var in $nlist\" >&5\n      fi\n    else\n      echo \"cannot run $lt_cv_sys_global_symbol_pipe\" >&5\n    fi\n  else\n    echo \"$progname: failed program was:\" >&5\n    cat conftest.$ac_ext >&5\n  fi\n  rm -rf conftest* conftst*\n\n  # Do not use the global_symbol_pipe unless it works.\n  if test \"$pipe_works\" = yes; then\n    break\n  else\n    lt_cv_sys_global_symbol_pipe=\n  fi\ndone\n\nfi\n\nif test -z \"$lt_cv_sys_global_symbol_pipe\"; then\n  lt_cv_sys_global_symbol_to_cdecl=\nfi\nif test -z \"$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: failed\" >&5\n$as_echo \"failed\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: ok\" >&5\n$as_echo \"ok\" >&6; }\nfi\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n# Check whether --enable-libtool-lock was given.\nif test \"${enable_libtool_lock+set}\" = set; then :\n  enableval=$enable_libtool_lock;\nfi\n\ntest \"x$enable_libtool_lock\" != xno && enable_libtool_lock=yes\n\n# Some flags need to be propagated to the compiler or linker for good\n# libtool support.\ncase $host in\nia64-*-hpux*)\n  # Find out which ABI we are using.\n  echo 'int i;' > conftest.$ac_ext\n  if { { eval echo \"\\\"\\$as_me\\\":${as_lineno-$LINENO}: \\\"$ac_compile\\\"\"; } >&5\n  (eval $ac_compile) 2>&5\n  ac_status=$?\n  $as_echo \"$as_me:${as_lineno-$LINENO}: \\$? = $ac_status\" >&5\n  test $ac_status = 0; }; then\n    case `/usr/bin/file conftest.$ac_objext` in\n      *ELF-32*)\n\tHPUX_IA64_MODE=\"32\"\n\t;;\n      *ELF-64*)\n\tHPUX_IA64_MODE=\"64\"\n\t;;\n    esac\n  fi\n  rm -rf conftest*\n  ;;\n*-*-irix6*)\n  # Find out which ABI we are using.\n  echo '#line 7105 \"configure\"' > conftest.$ac_ext\n  if { { eval echo \"\\\"\\$as_me\\\":${as_lineno-$LINENO}: \\\"$ac_compile\\\"\"; } >&5\n  (eval $ac_compile) 2>&5\n  ac_status=$?\n  $as_echo \"$as_me:${as_lineno-$LINENO}: \\$? = $ac_status\" >&5\n  test $ac_status = 0; }; then\n    if test \"$lt_cv_prog_gnu_ld\" = yes; then\n      case `/usr/bin/file conftest.$ac_objext` in\n\t*32-bit*)\n\t  LD=\"${LD-ld} -melf32bsmip\"\n\t  ;;\n\t*N32*)\n\t  LD=\"${LD-ld} -melf32bmipn32\"\n\t  ;;\n\t*64-bit*)\n\t  LD=\"${LD-ld} -melf64bmip\"\n\t;;\n      esac\n    else\n      case `/usr/bin/file conftest.$ac_objext` in\n\t*32-bit*)\n\t  LD=\"${LD-ld} -32\"\n\t  ;;\n\t*N32*)\n\t  LD=\"${LD-ld} -n32\"\n\t  ;;\n\t*64-bit*)\n\t  LD=\"${LD-ld} -64\"\n\t  ;;\n      esac\n    fi\n  fi\n  rm -rf conftest*\n  ;;\n\nx86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \\\ns390*-*linux*|s390*-*tpf*|sparc*-*linux*)\n  # Find out which ABI we are using.\n  echo 'int i;' > conftest.$ac_ext\n  if { { eval echo \"\\\"\\$as_me\\\":${as_lineno-$LINENO}: \\\"$ac_compile\\\"\"; } >&5\n  (eval $ac_compile) 2>&5\n  ac_status=$?\n  $as_echo \"$as_me:${as_lineno-$LINENO}: \\$? = $ac_status\" >&5\n  test $ac_status = 0; }; then\n    case `/usr/bin/file conftest.o` in\n      *32-bit*)\n\tcase $host in\n\t  x86_64-*kfreebsd*-gnu)\n\t    LD=\"${LD-ld} -m elf_i386_fbsd\"\n\t    ;;\n\t  x86_64-*linux*)\n\t    LD=\"${LD-ld} -m elf_i386\"\n\t    ;;\n\t  ppc64-*linux*|powerpc64-*linux*)\n\t    LD=\"${LD-ld} -m elf32ppclinux\"\n\t    ;;\n\t  s390x-*linux*)\n\t    LD=\"${LD-ld} -m elf_s390\"\n\t    ;;\n\t  sparc64-*linux*)\n\t    LD=\"${LD-ld} -m elf32_sparc\"\n\t    ;;\n\tesac\n\t;;\n      *64-bit*)\n\tcase $host in\n\t  x86_64-*kfreebsd*-gnu)\n\t    LD=\"${LD-ld} -m elf_x86_64_fbsd\"\n\t    ;;\n\t  x86_64-*linux*)\n\t    LD=\"${LD-ld} -m elf_x86_64\"\n\t    ;;\n\t  ppc*-*linux*|powerpc*-*linux*)\n\t    LD=\"${LD-ld} -m elf64ppc\"\n\t    ;;\n\t  s390*-*linux*|s390*-*tpf*)\n\t    LD=\"${LD-ld} -m elf64_s390\"\n\t    ;;\n\t  sparc*-*linux*)\n\t    LD=\"${LD-ld} -m elf64_sparc\"\n\t    ;;\n\tesac\n\t;;\n    esac\n  fi\n  rm -rf conftest*\n  ;;\n\n*-*-sco3.2v5*)\n  # On SCO OpenServer 5, we need -belf to get full-featured binaries.\n  SAVE_CFLAGS=\"$CFLAGS\"\n  CFLAGS=\"$CFLAGS -belf\"\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf\" >&5\n$as_echo_n \"checking whether the C compiler needs -belf... \" >&6; }\nif test \"${lt_cv_cc_needs_belf+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  ac_ext=c\nac_cpp='$CPP $CPPFLAGS'\nac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'\nac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'\nac_compiler_gnu=$ac_cv_c_compiler_gnu\n\n     cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\nint\nmain ()\n{\n\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_link \"$LINENO\"; then :\n  lt_cv_cc_needs_belf=yes\nelse\n  lt_cv_cc_needs_belf=no\nfi\nrm -f core conftest.err conftest.$ac_objext \\\n    conftest$ac_exeext conftest.$ac_ext\n     ac_ext=c\nac_cpp='$CPP $CPPFLAGS'\nac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'\nac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'\nac_compiler_gnu=$ac_cv_c_compiler_gnu\n\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf\" >&5\n$as_echo \"$lt_cv_cc_needs_belf\" >&6; }\n  if test x\"$lt_cv_cc_needs_belf\" != x\"yes\"; then\n    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf\n    CFLAGS=\"$SAVE_CFLAGS\"\n  fi\n  ;;\nsparc*-*solaris*)\n  # Find out which ABI we are using.\n  echo 'int i;' > conftest.$ac_ext\n  if { { eval echo \"\\\"\\$as_me\\\":${as_lineno-$LINENO}: \\\"$ac_compile\\\"\"; } >&5\n  (eval $ac_compile) 2>&5\n  ac_status=$?\n  $as_echo \"$as_me:${as_lineno-$LINENO}: \\$? = $ac_status\" >&5\n  test $ac_status = 0; }; then\n    case `/usr/bin/file conftest.o` in\n    *64-bit*)\n      case $lt_cv_prog_gnu_ld in\n      yes*) LD=\"${LD-ld} -m elf64_sparc\" ;;\n      *)\n\tif ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then\n\t  LD=\"${LD-ld} -64\"\n\tfi\n\t;;\n      esac\n      ;;\n    esac\n  fi\n  rm -rf conftest*\n  ;;\nesac\n\nneed_locks=\"$enable_libtool_lock\"\n\n\n  case $host_os in\n    rhapsody* | darwin*)\n    if test -n \"$ac_tool_prefix\"; then\n  # Extract the first word of \"${ac_tool_prefix}dsymutil\", so it can be a program name with args.\nset dummy ${ac_tool_prefix}dsymutil; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif test \"${ac_cv_prog_DSYMUTIL+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$DSYMUTIL\"; then\n  ac_cv_prog_DSYMUTIL=\"$DSYMUTIL\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_DSYMUTIL=\"${ac_tool_prefix}dsymutil\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nDSYMUTIL=$ac_cv_prog_DSYMUTIL\nif test -n \"$DSYMUTIL\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL\" >&5\n$as_echo \"$DSYMUTIL\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n\nfi\nif test -z \"$ac_cv_prog_DSYMUTIL\"; then\n  ac_ct_DSYMUTIL=$DSYMUTIL\n  # Extract the first word of \"dsymutil\", so it can be a program name with args.\nset dummy dsymutil; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif test \"${ac_cv_prog_ac_ct_DSYMUTIL+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$ac_ct_DSYMUTIL\"; then\n  ac_cv_prog_ac_ct_DSYMUTIL=\"$ac_ct_DSYMUTIL\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_ac_ct_DSYMUTIL=\"dsymutil\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL\nif test -n \"$ac_ct_DSYMUTIL\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL\" >&5\n$as_echo \"$ac_ct_DSYMUTIL\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n  if test \"x$ac_ct_DSYMUTIL\" = x; then\n    DSYMUTIL=\":\"\n  else\n    case $cross_compiling:$ac_tool_warned in\nyes:)\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet\" >&5\n$as_echo \"$as_me: WARNING: using cross tools not prefixed with host triplet\" >&2;}\nac_tool_warned=yes ;;\nesac\n    DSYMUTIL=$ac_ct_DSYMUTIL\n  fi\nelse\n  DSYMUTIL=\"$ac_cv_prog_DSYMUTIL\"\nfi\n\n    if test -n \"$ac_tool_prefix\"; then\n  # Extract the first word of \"${ac_tool_prefix}nmedit\", so it can be a program name with args.\nset dummy ${ac_tool_prefix}nmedit; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif test \"${ac_cv_prog_NMEDIT+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$NMEDIT\"; then\n  ac_cv_prog_NMEDIT=\"$NMEDIT\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_NMEDIT=\"${ac_tool_prefix}nmedit\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nNMEDIT=$ac_cv_prog_NMEDIT\nif test -n \"$NMEDIT\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $NMEDIT\" >&5\n$as_echo \"$NMEDIT\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n\nfi\nif test -z \"$ac_cv_prog_NMEDIT\"; then\n  ac_ct_NMEDIT=$NMEDIT\n  # Extract the first word of \"nmedit\", so it can be a program name with args.\nset dummy nmedit; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif test \"${ac_cv_prog_ac_ct_NMEDIT+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$ac_ct_NMEDIT\"; then\n  ac_cv_prog_ac_ct_NMEDIT=\"$ac_ct_NMEDIT\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_ac_ct_NMEDIT=\"nmedit\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT\nif test -n \"$ac_ct_NMEDIT\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT\" >&5\n$as_echo \"$ac_ct_NMEDIT\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n  if test \"x$ac_ct_NMEDIT\" = x; then\n    NMEDIT=\":\"\n  else\n    case $cross_compiling:$ac_tool_warned in\nyes:)\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet\" >&5\n$as_echo \"$as_me: WARNING: using cross tools not prefixed with host triplet\" >&2;}\nac_tool_warned=yes ;;\nesac\n    NMEDIT=$ac_ct_NMEDIT\n  fi\nelse\n  NMEDIT=\"$ac_cv_prog_NMEDIT\"\nfi\n\n    if test -n \"$ac_tool_prefix\"; then\n  # Extract the first word of \"${ac_tool_prefix}lipo\", so it can be a program name with args.\nset dummy ${ac_tool_prefix}lipo; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif test \"${ac_cv_prog_LIPO+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$LIPO\"; then\n  ac_cv_prog_LIPO=\"$LIPO\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_LIPO=\"${ac_tool_prefix}lipo\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nLIPO=$ac_cv_prog_LIPO\nif test -n \"$LIPO\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $LIPO\" >&5\n$as_echo \"$LIPO\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n\nfi\nif test -z \"$ac_cv_prog_LIPO\"; then\n  ac_ct_LIPO=$LIPO\n  # Extract the first word of \"lipo\", so it can be a program name with args.\nset dummy lipo; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif test \"${ac_cv_prog_ac_ct_LIPO+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$ac_ct_LIPO\"; then\n  ac_cv_prog_ac_ct_LIPO=\"$ac_ct_LIPO\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_ac_ct_LIPO=\"lipo\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO\nif test -n \"$ac_ct_LIPO\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO\" >&5\n$as_echo \"$ac_ct_LIPO\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n  if test \"x$ac_ct_LIPO\" = x; then\n    LIPO=\":\"\n  else\n    case $cross_compiling:$ac_tool_warned in\nyes:)\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet\" >&5\n$as_echo \"$as_me: WARNING: using cross tools not prefixed with host triplet\" >&2;}\nac_tool_warned=yes ;;\nesac\n    LIPO=$ac_ct_LIPO\n  fi\nelse\n  LIPO=\"$ac_cv_prog_LIPO\"\nfi\n\n    if test -n \"$ac_tool_prefix\"; then\n  # Extract the first word of \"${ac_tool_prefix}otool\", so it can be a program name with args.\nset dummy ${ac_tool_prefix}otool; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif test \"${ac_cv_prog_OTOOL+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$OTOOL\"; then\n  ac_cv_prog_OTOOL=\"$OTOOL\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_OTOOL=\"${ac_tool_prefix}otool\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nOTOOL=$ac_cv_prog_OTOOL\nif test -n \"$OTOOL\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $OTOOL\" >&5\n$as_echo \"$OTOOL\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n\nfi\nif test -z \"$ac_cv_prog_OTOOL\"; then\n  ac_ct_OTOOL=$OTOOL\n  # Extract the first word of \"otool\", so it can be a program name with args.\nset dummy otool; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif test \"${ac_cv_prog_ac_ct_OTOOL+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$ac_ct_OTOOL\"; then\n  ac_cv_prog_ac_ct_OTOOL=\"$ac_ct_OTOOL\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_ac_ct_OTOOL=\"otool\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL\nif test -n \"$ac_ct_OTOOL\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL\" >&5\n$as_echo \"$ac_ct_OTOOL\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n  if test \"x$ac_ct_OTOOL\" = x; then\n    OTOOL=\":\"\n  else\n    case $cross_compiling:$ac_tool_warned in\nyes:)\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet\" >&5\n$as_echo \"$as_me: WARNING: using cross tools not prefixed with host triplet\" >&2;}\nac_tool_warned=yes ;;\nesac\n    OTOOL=$ac_ct_OTOOL\n  fi\nelse\n  OTOOL=\"$ac_cv_prog_OTOOL\"\nfi\n\n    if test -n \"$ac_tool_prefix\"; then\n  # Extract the first word of \"${ac_tool_prefix}otool64\", so it can be a program name with args.\nset dummy ${ac_tool_prefix}otool64; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif test \"${ac_cv_prog_OTOOL64+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$OTOOL64\"; then\n  ac_cv_prog_OTOOL64=\"$OTOOL64\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_OTOOL64=\"${ac_tool_prefix}otool64\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nOTOOL64=$ac_cv_prog_OTOOL64\nif test -n \"$OTOOL64\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $OTOOL64\" >&5\n$as_echo \"$OTOOL64\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n\nfi\nif test -z \"$ac_cv_prog_OTOOL64\"; then\n  ac_ct_OTOOL64=$OTOOL64\n  # Extract the first word of \"otool64\", so it can be a program name with args.\nset dummy otool64; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif test \"${ac_cv_prog_ac_ct_OTOOL64+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$ac_ct_OTOOL64\"; then\n  ac_cv_prog_ac_ct_OTOOL64=\"$ac_ct_OTOOL64\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_ac_ct_OTOOL64=\"otool64\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64\nif test -n \"$ac_ct_OTOOL64\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64\" >&5\n$as_echo \"$ac_ct_OTOOL64\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n  if test \"x$ac_ct_OTOOL64\" = x; then\n    OTOOL64=\":\"\n  else\n    case $cross_compiling:$ac_tool_warned in\nyes:)\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet\" >&5\n$as_echo \"$as_me: WARNING: using cross tools not prefixed with host triplet\" >&2;}\nac_tool_warned=yes ;;\nesac\n    OTOOL64=$ac_ct_OTOOL64\n  fi\nelse\n  OTOOL64=\"$ac_cv_prog_OTOOL64\"\nfi\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag\" >&5\n$as_echo_n \"checking for -single_module linker flag... \" >&6; }\nif test \"${lt_cv_apple_cc_single_mod+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  lt_cv_apple_cc_single_mod=no\n      if test -z \"${LT_MULTI_MODULE}\"; then\n\t# By default we will add the -single_module flag. You can override\n\t# by either setting the environment variable LT_MULTI_MODULE\n\t# non-empty at configure time, or by adding -multi_module to the\n\t# link flags.\n\trm -rf libconftest.dylib*\n\techo \"int foo(void){return 1;}\" > conftest.c\n\techo \"$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \\\n-dynamiclib -Wl,-single_module conftest.c\" >&5\n\t$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \\\n\t  -dynamiclib -Wl,-single_module conftest.c 2>conftest.err\n        _lt_result=$?\n\tif test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then\n\t  lt_cv_apple_cc_single_mod=yes\n\telse\n\t  cat conftest.err >&5\n\tfi\n\trm -rf libconftest.dylib*\n\trm -f conftest.*\n      fi\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod\" >&5\n$as_echo \"$lt_cv_apple_cc_single_mod\" >&6; }\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag\" >&5\n$as_echo_n \"checking for -exported_symbols_list linker flag... \" >&6; }\nif test \"${lt_cv_ld_exported_symbols_list+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  lt_cv_ld_exported_symbols_list=no\n      save_LDFLAGS=$LDFLAGS\n      echo \"_main\" > conftest.sym\n      LDFLAGS=\"$LDFLAGS -Wl,-exported_symbols_list,conftest.sym\"\n      cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\nint\nmain ()\n{\n\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_link \"$LINENO\"; then :\n  lt_cv_ld_exported_symbols_list=yes\nelse\n  lt_cv_ld_exported_symbols_list=no\nfi\nrm -f core conftest.err conftest.$ac_objext \\\n    conftest$ac_exeext conftest.$ac_ext\n\tLDFLAGS=\"$save_LDFLAGS\"\n\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list\" >&5\n$as_echo \"$lt_cv_ld_exported_symbols_list\" >&6; }\n    case $host_os in\n    rhapsody* | darwin1.[012])\n      _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;\n    darwin1.*)\n      _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;\n    darwin*) # darwin 5.x on\n      # if running on 10.5 or later, the deployment target defaults\n      # to the OS version, if on x86, and 10.4, the deployment\n      # target defaults to 10.4. Don't you love it?\n      case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in\n\t10.0,*86*-darwin8*|10.0,*-darwin[91]*)\n\t  _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;\n\t10.[012]*)\n\t  _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;\n\t10.*)\n\t  _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;\n      esac\n    ;;\n  esac\n    if test \"$lt_cv_apple_cc_single_mod\" = \"yes\"; then\n      _lt_dar_single_mod='$single_module'\n    fi\n    if test \"$lt_cv_ld_exported_symbols_list\" = \"yes\"; then\n      _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'\n    else\n      _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'\n    fi\n    if test \"$DSYMUTIL\" != \":\"; then\n      _lt_dsymutil='~$DSYMUTIL $lib || :'\n    else\n      _lt_dsymutil=\n    fi\n    ;;\n  esac\n\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for ANSI C header files\" >&5\n$as_echo_n \"checking for ANSI C header files... \" >&6; }\nif test \"${ac_cv_header_stdc+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n#include <stdlib.h>\n#include <stdarg.h>\n#include <string.h>\n#include <float.h>\n\nint\nmain ()\n{\n\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_compile \"$LINENO\"; then :\n  ac_cv_header_stdc=yes\nelse\n  ac_cv_header_stdc=no\nfi\nrm -f core conftest.err conftest.$ac_objext conftest.$ac_ext\n\nif test $ac_cv_header_stdc = yes; then\n  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.\n  cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n#include <string.h>\n\n_ACEOF\nif (eval \"$ac_cpp conftest.$ac_ext\") 2>&5 |\n  $EGREP \"memchr\" >/dev/null 2>&1; then :\n\nelse\n  ac_cv_header_stdc=no\nfi\nrm -f conftest*\n\nfi\n\nif test $ac_cv_header_stdc = yes; then\n  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.\n  cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n#include <stdlib.h>\n\n_ACEOF\nif (eval \"$ac_cpp conftest.$ac_ext\") 2>&5 |\n  $EGREP \"free\" >/dev/null 2>&1; then :\n\nelse\n  ac_cv_header_stdc=no\nfi\nrm -f conftest*\n\nfi\n\nif test $ac_cv_header_stdc = yes; then\n  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.\n  if test \"$cross_compiling\" = yes; then :\n  :\nelse\n  cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n#include <ctype.h>\n#include <stdlib.h>\n#if ((' ' & 0x0FF) == 0x020)\n# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')\n# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))\n#else\n# define ISLOWER(c) \\\n\t\t   (('a' <= (c) && (c) <= 'i') \\\n\t\t     || ('j' <= (c) && (c) <= 'r') \\\n\t\t     || ('s' <= (c) && (c) <= 'z'))\n# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))\n#endif\n\n#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))\nint\nmain ()\n{\n  int i;\n  for (i = 0; i < 256; i++)\n    if (XOR (islower (i), ISLOWER (i))\n\t|| toupper (i) != TOUPPER (i))\n      return 2;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_run \"$LINENO\"; then :\n\nelse\n  ac_cv_header_stdc=no\nfi\nrm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \\\n  conftest.$ac_objext conftest.beam conftest.$ac_ext\nfi\n\nfi\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc\" >&5\n$as_echo \"$ac_cv_header_stdc\" >&6; }\nif test $ac_cv_header_stdc = yes; then\n\n$as_echo \"#define STDC_HEADERS 1\" >>confdefs.h\n\nfi\n\n# On IRIX 5.3, sys/types and inttypes.h are conflicting.\nfor ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \\\n\t\t  inttypes.h stdint.h unistd.h\ndo :\n  as_ac_Header=`$as_echo \"ac_cv_header_$ac_header\" | $as_tr_sh`\nac_fn_c_check_header_compile \"$LINENO\" \"$ac_header\" \"$as_ac_Header\" \"$ac_includes_default\n\"\neval as_val=\\$$as_ac_Header\n   if test \"x$as_val\" = x\"\"yes; then :\n  cat >>confdefs.h <<_ACEOF\n#define `$as_echo \"HAVE_$ac_header\" | $as_tr_cpp` 1\n_ACEOF\n\nfi\n\ndone\n\n\nfor ac_header in dlfcn.h\ndo :\n  ac_fn_c_check_header_compile \"$LINENO\" \"dlfcn.h\" \"ac_cv_header_dlfcn_h\" \"$ac_includes_default\n\"\nif test \"x$ac_cv_header_dlfcn_h\" = x\"\"yes; then :\n  cat >>confdefs.h <<_ACEOF\n#define HAVE_DLFCN_H 1\n_ACEOF\n\nfi\n\ndone\n\n\n\n# Set options\nenable_win32_dll=yes\n\ncase $host in\n*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-cegcc*)\n  if test -n \"$ac_tool_prefix\"; then\n  # Extract the first word of \"${ac_tool_prefix}as\", so it can be a program name with args.\nset dummy ${ac_tool_prefix}as; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif test \"${ac_cv_prog_AS+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$AS\"; then\n  ac_cv_prog_AS=\"$AS\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_AS=\"${ac_tool_prefix}as\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nAS=$ac_cv_prog_AS\nif test -n \"$AS\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $AS\" >&5\n$as_echo \"$AS\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n\nfi\nif test -z \"$ac_cv_prog_AS\"; then\n  ac_ct_AS=$AS\n  # Extract the first word of \"as\", so it can be a program name with args.\nset dummy as; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif test \"${ac_cv_prog_ac_ct_AS+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$ac_ct_AS\"; then\n  ac_cv_prog_ac_ct_AS=\"$ac_ct_AS\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_ac_ct_AS=\"as\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nac_ct_AS=$ac_cv_prog_ac_ct_AS\nif test -n \"$ac_ct_AS\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_ct_AS\" >&5\n$as_echo \"$ac_ct_AS\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n  if test \"x$ac_ct_AS\" = x; then\n    AS=\"false\"\n  else\n    case $cross_compiling:$ac_tool_warned in\nyes:)\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet\" >&5\n$as_echo \"$as_me: WARNING: using cross tools not prefixed with host triplet\" >&2;}\nac_tool_warned=yes ;;\nesac\n    AS=$ac_ct_AS\n  fi\nelse\n  AS=\"$ac_cv_prog_AS\"\nfi\n\n  if test -n \"$ac_tool_prefix\"; then\n  # Extract the first word of \"${ac_tool_prefix}dlltool\", so it can be a program name with args.\nset dummy ${ac_tool_prefix}dlltool; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif test \"${ac_cv_prog_DLLTOOL+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$DLLTOOL\"; then\n  ac_cv_prog_DLLTOOL=\"$DLLTOOL\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_DLLTOOL=\"${ac_tool_prefix}dlltool\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nDLLTOOL=$ac_cv_prog_DLLTOOL\nif test -n \"$DLLTOOL\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $DLLTOOL\" >&5\n$as_echo \"$DLLTOOL\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n\nfi\nif test -z \"$ac_cv_prog_DLLTOOL\"; then\n  ac_ct_DLLTOOL=$DLLTOOL\n  # Extract the first word of \"dlltool\", so it can be a program name with args.\nset dummy dlltool; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif test \"${ac_cv_prog_ac_ct_DLLTOOL+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$ac_ct_DLLTOOL\"; then\n  ac_cv_prog_ac_ct_DLLTOOL=\"$ac_ct_DLLTOOL\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_ac_ct_DLLTOOL=\"dlltool\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL\nif test -n \"$ac_ct_DLLTOOL\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL\" >&5\n$as_echo \"$ac_ct_DLLTOOL\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n  if test \"x$ac_ct_DLLTOOL\" = x; then\n    DLLTOOL=\"false\"\n  else\n    case $cross_compiling:$ac_tool_warned in\nyes:)\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet\" >&5\n$as_echo \"$as_me: WARNING: using cross tools not prefixed with host triplet\" >&2;}\nac_tool_warned=yes ;;\nesac\n    DLLTOOL=$ac_ct_DLLTOOL\n  fi\nelse\n  DLLTOOL=\"$ac_cv_prog_DLLTOOL\"\nfi\n\n  if test -n \"$ac_tool_prefix\"; then\n  # Extract the first word of \"${ac_tool_prefix}objdump\", so it can be a program name with args.\nset dummy ${ac_tool_prefix}objdump; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif test \"${ac_cv_prog_OBJDUMP+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$OBJDUMP\"; then\n  ac_cv_prog_OBJDUMP=\"$OBJDUMP\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_OBJDUMP=\"${ac_tool_prefix}objdump\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nOBJDUMP=$ac_cv_prog_OBJDUMP\nif test -n \"$OBJDUMP\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $OBJDUMP\" >&5\n$as_echo \"$OBJDUMP\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n\nfi\nif test -z \"$ac_cv_prog_OBJDUMP\"; then\n  ac_ct_OBJDUMP=$OBJDUMP\n  # Extract the first word of \"objdump\", so it can be a program name with args.\nset dummy objdump; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif test \"${ac_cv_prog_ac_ct_OBJDUMP+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$ac_ct_OBJDUMP\"; then\n  ac_cv_prog_ac_ct_OBJDUMP=\"$ac_ct_OBJDUMP\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_ac_ct_OBJDUMP=\"objdump\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP\nif test -n \"$ac_ct_OBJDUMP\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP\" >&5\n$as_echo \"$ac_ct_OBJDUMP\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n  if test \"x$ac_ct_OBJDUMP\" = x; then\n    OBJDUMP=\"false\"\n  else\n    case $cross_compiling:$ac_tool_warned in\nyes:)\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet\" >&5\n$as_echo \"$as_me: WARNING: using cross tools not prefixed with host triplet\" >&2;}\nac_tool_warned=yes ;;\nesac\n    OBJDUMP=$ac_ct_OBJDUMP\n  fi\nelse\n  OBJDUMP=\"$ac_cv_prog_OBJDUMP\"\nfi\n\n  ;;\nesac\n\ntest -z \"$AS\" && AS=as\n\n\n\n\n\ntest -z \"$DLLTOOL\" && DLLTOOL=dlltool\n\n\n\n\n\ntest -z \"$OBJDUMP\" && OBJDUMP=objdump\n\n\n\n\n\n\n\n        enable_dlopen=no\n\n\n\n            # Check whether --enable-shared was given.\nif test \"${enable_shared+set}\" = set; then :\n  enableval=$enable_shared; p=${PACKAGE-default}\n    case $enableval in\n    yes) enable_shared=yes ;;\n    no) enable_shared=no ;;\n    *)\n      enable_shared=no\n      # Look at the argument we got.  We use all the common list separators.\n      lt_save_ifs=\"$IFS\"; IFS=\"${IFS}$PATH_SEPARATOR,\"\n      for pkg in $enableval; do\n\tIFS=\"$lt_save_ifs\"\n\tif test \"X$pkg\" = \"X$p\"; then\n\t  enable_shared=yes\n\tfi\n      done\n      IFS=\"$lt_save_ifs\"\n      ;;\n    esac\nelse\n  enable_shared=yes\nfi\n\n\n\n\n\n\n\n\n\n  # Check whether --enable-static was given.\nif test \"${enable_static+set}\" = set; then :\n  enableval=$enable_static; p=${PACKAGE-default}\n    case $enableval in\n    yes) enable_static=yes ;;\n    no) enable_static=no ;;\n    *)\n     enable_static=no\n      # Look at the argument we got.  We use all the common list separators.\n      lt_save_ifs=\"$IFS\"; IFS=\"${IFS}$PATH_SEPARATOR,\"\n      for pkg in $enableval; do\n\tIFS=\"$lt_save_ifs\"\n\tif test \"X$pkg\" = \"X$p\"; then\n\t  enable_static=yes\n\tfi\n      done\n      IFS=\"$lt_save_ifs\"\n      ;;\n    esac\nelse\n  enable_static=yes\nfi\n\n\n\n\n\n\n\n\n\n\n# Check whether --with-pic was given.\nif test \"${with_pic+set}\" = set; then :\n  withval=$with_pic; pic_mode=\"$withval\"\nelse\n  pic_mode=default\nfi\n\n\ntest -z \"$pic_mode\" && pic_mode=default\n\n\n\n\n\n\n\n  # Check whether --enable-fast-install was given.\nif test \"${enable_fast_install+set}\" = set; then :\n  enableval=$enable_fast_install; p=${PACKAGE-default}\n    case $enableval in\n    yes) enable_fast_install=yes ;;\n    no) enable_fast_install=no ;;\n    *)\n      enable_fast_install=no\n      # Look at the argument we got.  We use all the common list separators.\n      lt_save_ifs=\"$IFS\"; IFS=\"${IFS}$PATH_SEPARATOR,\"\n      for pkg in $enableval; do\n\tIFS=\"$lt_save_ifs\"\n\tif test \"X$pkg\" = \"X$p\"; then\n\t  enable_fast_install=yes\n\tfi\n      done\n      IFS=\"$lt_save_ifs\"\n      ;;\n    esac\nelse\n  enable_fast_install=yes\nfi\n\n\n\n\n\n\n\n\n\n\n\n# This can be used to rebuild libtool when needed\nLIBTOOL_DEPS=\"$ltmain\"\n\n# Always use our own libtool.\nLIBTOOL='$(SHELL) $(top_builddir)/libtool'\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\ntest -z \"$LN_S\" && LN_S=\"ln -s\"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nif test -n \"${ZSH_VERSION+set}\" ; then\n   setopt NO_GLOB_SUBST\nfi\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for objdir\" >&5\n$as_echo_n \"checking for objdir... \" >&6; }\nif test \"${lt_cv_objdir+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  rm -f .libs 2>/dev/null\nmkdir .libs 2>/dev/null\nif test -d .libs; then\n  lt_cv_objdir=.libs\nelse\n  # MS-DOS does not allow filenames that begin with a dot.\n  lt_cv_objdir=_libs\nfi\nrmdir .libs 2>/dev/null\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir\" >&5\n$as_echo \"$lt_cv_objdir\" >&6; }\nobjdir=$lt_cv_objdir\n\n\n\n\n\ncat >>confdefs.h <<_ACEOF\n#define LT_OBJDIR \"$lt_cv_objdir/\"\n_ACEOF\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\ncase $host_os in\naix3*)\n  # AIX sometimes has problems with the GCC collect2 program.  For some\n  # reason, if we set the COLLECT_NAMES environment variable, the problems\n  # vanish in a puff of smoke.\n  if test \"X${COLLECT_NAMES+set}\" != Xset; then\n    COLLECT_NAMES=\n    export COLLECT_NAMES\n  fi\n  ;;\nesac\n\n# Sed substitution that helps us do robust quoting.  It backslashifies\n# metacharacters that are still active within double-quoted strings.\nsed_quote_subst='s/\\([\"`$\\\\]\\)/\\\\\\1/g'\n\n# Same as above, but do not quote variable references.\ndouble_quote_subst='s/\\([\"`\\\\]\\)/\\\\\\1/g'\n\n# Sed substitution to delay expansion of an escaped shell variable in a\n# double_quote_subst'ed string.\ndelay_variable_subst='s/\\\\\\\\\\\\\\\\\\\\\\$/\\\\\\\\\\\\$/g'\n\n# Sed substitution to delay expansion of an escaped single quote.\ndelay_single_quote_subst='s/'\\''/'\\'\\\\\\\\\\\\\\'\\''/g'\n\n# Sed substitution to avoid accidental globbing in evaled expressions\nno_glob_subst='s/\\*/\\\\\\*/g'\n\n# Global variables:\nofile=libtool\ncan_build_shared=yes\n\n# All known linkers require a `.a' archive for static linking (except MSVC,\n# which needs '.lib').\nlibext=a\n\nwith_gnu_ld=\"$lt_cv_prog_gnu_ld\"\n\nold_CC=\"$CC\"\nold_CFLAGS=\"$CFLAGS\"\n\n# Set sane defaults for various variables\ntest -z \"$CC\" && CC=cc\ntest -z \"$LTCC\" && LTCC=$CC\ntest -z \"$LTCFLAGS\" && LTCFLAGS=$CFLAGS\ntest -z \"$LD\" && LD=ld\ntest -z \"$ac_objext\" && ac_objext=o\n\nfor cc_temp in $compiler\"\"; do\n  case $cc_temp in\n    compile | *[\\\\/]compile | ccache | *[\\\\/]ccache ) ;;\n    distcc | *[\\\\/]distcc | purify | *[\\\\/]purify ) ;;\n    \\-*) ;;\n    *) break;;\n  esac\ndone\ncc_basename=`$ECHO \"X$cc_temp\" | $Xsed -e 's%.*/%%' -e \"s%^$host_alias-%%\"`\n\n\n# Only perform the check for file, if the check method requires it\ntest -z \"$MAGIC_CMD\" && MAGIC_CMD=file\ncase $deplibs_check_method in\nfile_magic*)\n  if test \"$file_magic_cmd\" = '$MAGIC_CMD'; then\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file\" >&5\n$as_echo_n \"checking for ${ac_tool_prefix}file... \" >&6; }\nif test \"${lt_cv_path_MAGIC_CMD+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  case $MAGIC_CMD in\n[\\\\/*] |  ?:[\\\\/]*)\n  lt_cv_path_MAGIC_CMD=\"$MAGIC_CMD\" # Let the user override the test with a path.\n  ;;\n*)\n  lt_save_MAGIC_CMD=\"$MAGIC_CMD\"\n  lt_save_ifs=\"$IFS\"; IFS=$PATH_SEPARATOR\n  ac_dummy=\"/usr/bin$PATH_SEPARATOR$PATH\"\n  for ac_dir in $ac_dummy; do\n    IFS=\"$lt_save_ifs\"\n    test -z \"$ac_dir\" && ac_dir=.\n    if test -f $ac_dir/${ac_tool_prefix}file; then\n      lt_cv_path_MAGIC_CMD=\"$ac_dir/${ac_tool_prefix}file\"\n      if test -n \"$file_magic_test_file\"; then\n\tcase $deplibs_check_method in\n\t\"file_magic \"*)\n\t  file_magic_regex=`expr \"$deplibs_check_method\" : \"file_magic \\(.*\\)\"`\n\t  MAGIC_CMD=\"$lt_cv_path_MAGIC_CMD\"\n\t  if eval $file_magic_cmd \\$file_magic_test_file 2> /dev/null |\n\t    $EGREP \"$file_magic_regex\" > /dev/null; then\n\t    :\n\t  else\n\t    cat <<_LT_EOF 1>&2\n\n*** Warning: the command libtool uses to detect shared libraries,\n*** $file_magic_cmd, produces output that libtool cannot recognize.\n*** The result is that libtool may fail to recognize shared libraries\n*** as such.  This will affect the creation of libtool libraries that\n*** depend on shared libraries, but programs linked with such libtool\n*** libraries will work regardless of this problem.  Nevertheless, you\n*** may want to report the problem to your system manager and/or to\n*** bug-libtool@gnu.org\n\n_LT_EOF\n\t  fi ;;\n\tesac\n      fi\n      break\n    fi\n  done\n  IFS=\"$lt_save_ifs\"\n  MAGIC_CMD=\"$lt_save_MAGIC_CMD\"\n  ;;\nesac\nfi\n\nMAGIC_CMD=\"$lt_cv_path_MAGIC_CMD\"\nif test -n \"$MAGIC_CMD\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD\" >&5\n$as_echo \"$MAGIC_CMD\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n\n\n\n\nif test -z \"$lt_cv_path_MAGIC_CMD\"; then\n  if test -n \"$ac_tool_prefix\"; then\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: checking for file\" >&5\n$as_echo_n \"checking for file... \" >&6; }\nif test \"${lt_cv_path_MAGIC_CMD+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  case $MAGIC_CMD in\n[\\\\/*] |  ?:[\\\\/]*)\n  lt_cv_path_MAGIC_CMD=\"$MAGIC_CMD\" # Let the user override the test with a path.\n  ;;\n*)\n  lt_save_MAGIC_CMD=\"$MAGIC_CMD\"\n  lt_save_ifs=\"$IFS\"; IFS=$PATH_SEPARATOR\n  ac_dummy=\"/usr/bin$PATH_SEPARATOR$PATH\"\n  for ac_dir in $ac_dummy; do\n    IFS=\"$lt_save_ifs\"\n    test -z \"$ac_dir\" && ac_dir=.\n    if test -f $ac_dir/file; then\n      lt_cv_path_MAGIC_CMD=\"$ac_dir/file\"\n      if test -n \"$file_magic_test_file\"; then\n\tcase $deplibs_check_method in\n\t\"file_magic \"*)\n\t  file_magic_regex=`expr \"$deplibs_check_method\" : \"file_magic \\(.*\\)\"`\n\t  MAGIC_CMD=\"$lt_cv_path_MAGIC_CMD\"\n\t  if eval $file_magic_cmd \\$file_magic_test_file 2> /dev/null |\n\t    $EGREP \"$file_magic_regex\" > /dev/null; then\n\t    :\n\t  else\n\t    cat <<_LT_EOF 1>&2\n\n*** Warning: the command libtool uses to detect shared libraries,\n*** $file_magic_cmd, produces output that libtool cannot recognize.\n*** The result is that libtool may fail to recognize shared libraries\n*** as such.  This will affect the creation of libtool libraries that\n*** depend on shared libraries, but programs linked with such libtool\n*** libraries will work regardless of this problem.  Nevertheless, you\n*** may want to report the problem to your system manager and/or to\n*** bug-libtool@gnu.org\n\n_LT_EOF\n\t  fi ;;\n\tesac\n      fi\n      break\n    fi\n  done\n  IFS=\"$lt_save_ifs\"\n  MAGIC_CMD=\"$lt_save_MAGIC_CMD\"\n  ;;\nesac\nfi\n\nMAGIC_CMD=\"$lt_cv_path_MAGIC_CMD\"\nif test -n \"$MAGIC_CMD\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD\" >&5\n$as_echo \"$MAGIC_CMD\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n\n  else\n    MAGIC_CMD=:\n  fi\nfi\n\n  fi\n  ;;\nesac\n\n# Use C for the default configuration in the libtool script\n\nlt_save_CC=\"$CC\"\nac_ext=c\nac_cpp='$CPP $CPPFLAGS'\nac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'\nac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'\nac_compiler_gnu=$ac_cv_c_compiler_gnu\n\n\n# Source file extension for C test sources.\nac_ext=c\n\n# Object file extension for compiled C test sources.\nobjext=o\nobjext=$objext\n\n# Code to be used in simple compile tests\nlt_simple_compile_test_code=\"int some_variable = 0;\"\n\n# Code to be used in simple link tests\nlt_simple_link_test_code='int main(){return(0);}'\n\n\n\n\n\n\n\n# If no C compiler was specified, use CC.\nLTCC=${LTCC-\"$CC\"}\n\n# If no C compiler flags were specified, use CFLAGS.\nLTCFLAGS=${LTCFLAGS-\"$CFLAGS\"}\n\n# Allow CC to be a program name with arguments.\ncompiler=$CC\n\n# Save the default compiler, since it gets overwritten when the other\n# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP.\ncompiler_DEFAULT=$CC\n\n# save warnings/boilerplate of simple test code\nac_outfile=conftest.$ac_objext\necho \"$lt_simple_compile_test_code\" >conftest.$ac_ext\neval \"$ac_compile\" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err\n_lt_compiler_boilerplate=`cat conftest.err`\n$RM conftest*\n\nac_outfile=conftest.$ac_objext\necho \"$lt_simple_link_test_code\" >conftest.$ac_ext\neval \"$ac_link\" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err\n_lt_linker_boilerplate=`cat conftest.err`\n$RM -r conftest*\n\n\n## CAVEAT EMPTOR:\n## There is no encapsulation within the following macros, do not change\n## the running order or otherwise move them around unless you know exactly\n## what you are doing...\nif test -n \"$compiler\"; then\n\nlt_prog_compiler_no_builtin_flag=\n\nif test \"$GCC\" = yes; then\n  lt_prog_compiler_no_builtin_flag=' -fno-builtin'\n\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions\" >&5\n$as_echo_n \"checking if $compiler supports -fno-rtti -fno-exceptions... \" >&6; }\nif test \"${lt_cv_prog_compiler_rtti_exceptions+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  lt_cv_prog_compiler_rtti_exceptions=no\n   ac_outfile=conftest.$ac_objext\n   echo \"$lt_simple_compile_test_code\" > conftest.$ac_ext\n   lt_compiler_flag=\"-fno-rtti -fno-exceptions\"\n   # Insert the option either (1) after the last *FLAGS variable, or\n   # (2) before a word containing \"conftest.\", or (3) at the end.\n   # Note that $ac_compile itself does not contain backslashes and begins\n   # with a dollar sign (not a hyphen), so the echo should work correctly.\n   # The option is referenced via a variable to avoid confusing sed.\n   lt_compile=`echo \"$ac_compile\" | $SED \\\n   -e 's:.*FLAGS}\\{0,1\\} :&$lt_compiler_flag :; t' \\\n   -e 's: [^ ]*conftest\\.: $lt_compiler_flag&:; t' \\\n   -e 's:$: $lt_compiler_flag:'`\n   (eval echo \"\\\"\\$as_me:8796: $lt_compile\\\"\" >&5)\n   (eval \"$lt_compile\" 2>conftest.err)\n   ac_status=$?\n   cat conftest.err >&5\n   echo \"$as_me:8800: \\$? = $ac_status\" >&5\n   if (exit $ac_status) && test -s \"$ac_outfile\"; then\n     # The compiler can only warn and ignore the option if not recognized\n     # So say no if there are warnings other than the usual output.\n     $ECHO \"X$_lt_compiler_boilerplate\" | $Xsed -e '/^$/d' >conftest.exp\n     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2\n     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then\n       lt_cv_prog_compiler_rtti_exceptions=yes\n     fi\n   fi\n   $RM conftest*\n\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions\" >&5\n$as_echo \"$lt_cv_prog_compiler_rtti_exceptions\" >&6; }\n\nif test x\"$lt_cv_prog_compiler_rtti_exceptions\" = xyes; then\n    lt_prog_compiler_no_builtin_flag=\"$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions\"\nelse\n    :\nfi\n\nfi\n\n\n\n\n\n\n  lt_prog_compiler_wl=\nlt_prog_compiler_pic=\nlt_prog_compiler_static=\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC\" >&5\n$as_echo_n \"checking for $compiler option to produce PIC... \" >&6; }\n\n  if test \"$GCC\" = yes; then\n    lt_prog_compiler_wl='-Wl,'\n    lt_prog_compiler_static='-static'\n\n    case $host_os in\n      aix*)\n      # All AIX code is PIC.\n      if test \"$host_cpu\" = ia64; then\n\t# AIX 5 now supports IA64 processor\n\tlt_prog_compiler_static='-Bstatic'\n      fi\n      ;;\n\n    amigaos*)\n      case $host_cpu in\n      powerpc)\n            # see comment about AmigaOS4 .so support\n            lt_prog_compiler_pic='-fPIC'\n        ;;\n      m68k)\n            # FIXME: we need at least 68020 code to build shared libraries, but\n            # adding the `-m68020' flag to GCC prevents building anything better,\n            # like `-m68040'.\n            lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4'\n        ;;\n      esac\n      ;;\n\n    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)\n      # PIC is the default for these OSes.\n      ;;\n\n    mingw* | cygwin* | pw32* | os2* | cegcc*)\n      # This hack is so that the source file can tell whether it is being\n      # built for inclusion in a dll (and should export symbols for example).\n      # Although the cygwin gcc ignores -fPIC, still need this for old-style\n      # (--disable-auto-import) libraries\n      lt_prog_compiler_pic='-DDLL_EXPORT'\n      ;;\n\n    darwin* | rhapsody*)\n      # PIC is the default on this platform\n      # Common symbols not allowed in MH_DYLIB files\n      lt_prog_compiler_pic='-fno-common'\n      ;;\n\n    hpux*)\n      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit\n      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag\n      # sets the default TLS model and affects inlining.\n      case $host_cpu in\n      hppa*64*)\n\t# +Z the default\n\t;;\n      *)\n\tlt_prog_compiler_pic='-fPIC'\n\t;;\n      esac\n      ;;\n\n    interix[3-9]*)\n      # Interix 3.x gcc -fpic/-fPIC options generate broken code.\n      # Instead, we relocate shared libraries at runtime.\n      ;;\n\n    msdosdjgpp*)\n      # Just because we use GCC doesn't mean we suddenly get shared libraries\n      # on systems that don't support them.\n      lt_prog_compiler_can_build_shared=no\n      enable_shared=no\n      ;;\n\n    *nto* | *qnx*)\n      # QNX uses GNU C++, but need to define -shared option too, otherwise\n      # it will coredump.\n      lt_prog_compiler_pic='-fPIC -shared'\n      ;;\n\n    sysv4*MP*)\n      if test -d /usr/nec; then\n\tlt_prog_compiler_pic=-Kconform_pic\n      fi\n      ;;\n\n    *)\n      lt_prog_compiler_pic='-fPIC'\n      ;;\n    esac\n  else\n    # PORTME Check for flag to pass linker flags through the system compiler.\n    case $host_os in\n    aix*)\n      lt_prog_compiler_wl='-Wl,'\n      if test \"$host_cpu\" = ia64; then\n\t# AIX 5 now supports IA64 processor\n\tlt_prog_compiler_static='-Bstatic'\n      else\n\tlt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp'\n      fi\n      ;;\n\n    mingw* | cygwin* | pw32* | os2* | cegcc*)\n      # This hack is so that the source file can tell whether it is being\n      # built for inclusion in a dll (and should export symbols for example).\n      lt_prog_compiler_pic='-DDLL_EXPORT'\n      ;;\n\n    hpux9* | hpux10* | hpux11*)\n      lt_prog_compiler_wl='-Wl,'\n      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but\n      # not for PA HP-UX.\n      case $host_cpu in\n      hppa*64*|ia64*)\n\t# +Z the default\n\t;;\n      *)\n\tlt_prog_compiler_pic='+Z'\n\t;;\n      esac\n      # Is there a better lt_prog_compiler_static that works with the bundled CC?\n      lt_prog_compiler_static='${wl}-a ${wl}archive'\n      ;;\n\n    irix5* | irix6* | nonstopux*)\n      lt_prog_compiler_wl='-Wl,'\n      # PIC (with -KPIC) is the default.\n      lt_prog_compiler_static='-non_shared'\n      ;;\n\n    linux* | k*bsd*-gnu)\n      case $cc_basename in\n      # old Intel for x86_64 which still supported -KPIC.\n      ecc*)\n\tlt_prog_compiler_wl='-Wl,'\n\tlt_prog_compiler_pic='-KPIC'\n\tlt_prog_compiler_static='-static'\n        ;;\n      # icc used to be incompatible with GCC.\n      # ICC 10 doesn't accept -KPIC any more.\n      icc* | ifort*)\n\tlt_prog_compiler_wl='-Wl,'\n\tlt_prog_compiler_pic='-fPIC'\n\tlt_prog_compiler_static='-static'\n        ;;\n      # Lahey Fortran 8.1.\n      lf95*)\n\tlt_prog_compiler_wl='-Wl,'\n\tlt_prog_compiler_pic='--shared'\n\tlt_prog_compiler_static='--static'\n\t;;\n      pgcc* | pgf77* | pgf90* | pgf95*)\n        # Portland Group compilers (*not* the Pentium gcc compiler,\n\t# which looks to be a dead project)\n\tlt_prog_compiler_wl='-Wl,'\n\tlt_prog_compiler_pic='-fpic'\n\tlt_prog_compiler_static='-Bstatic'\n        ;;\n      ccc*)\n        lt_prog_compiler_wl='-Wl,'\n        # All Alpha code is PIC.\n        lt_prog_compiler_static='-non_shared'\n        ;;\n      xl*)\n\t# IBM XL C 8.0/Fortran 10.1 on PPC\n\tlt_prog_compiler_wl='-Wl,'\n\tlt_prog_compiler_pic='-qpic'\n\tlt_prog_compiler_static='-qstaticlink'\n\t;;\n      *)\n\tcase `$CC -V 2>&1 | sed 5q` in\n\t*Sun\\ C*)\n\t  # Sun C 5.9\n\t  lt_prog_compiler_pic='-KPIC'\n\t  lt_prog_compiler_static='-Bstatic'\n\t  lt_prog_compiler_wl='-Wl,'\n\t  ;;\n\t*Sun\\ F*)\n\t  # Sun Fortran 8.3 passes all unrecognized flags to the linker\n\t  lt_prog_compiler_pic='-KPIC'\n\t  lt_prog_compiler_static='-Bstatic'\n\t  lt_prog_compiler_wl=''\n\t  ;;\n\tesac\n\t;;\n      esac\n      ;;\n\n    newsos6)\n      lt_prog_compiler_pic='-KPIC'\n      lt_prog_compiler_static='-Bstatic'\n      ;;\n\n    *nto* | *qnx*)\n      # QNX uses GNU C++, but need to define -shared option too, otherwise\n      # it will coredump.\n      lt_prog_compiler_pic='-fPIC -shared'\n      ;;\n\n    osf3* | osf4* | osf5*)\n      lt_prog_compiler_wl='-Wl,'\n      # All OSF/1 code is PIC.\n      lt_prog_compiler_static='-non_shared'\n      ;;\n\n    rdos*)\n      lt_prog_compiler_static='-non_shared'\n      ;;\n\n    solaris*)\n      lt_prog_compiler_pic='-KPIC'\n      lt_prog_compiler_static='-Bstatic'\n      case $cc_basename in\n      f77* | f90* | f95*)\n\tlt_prog_compiler_wl='-Qoption ld ';;\n      *)\n\tlt_prog_compiler_wl='-Wl,';;\n      esac\n      ;;\n\n    sunos4*)\n      lt_prog_compiler_wl='-Qoption ld '\n      lt_prog_compiler_pic='-PIC'\n      lt_prog_compiler_static='-Bstatic'\n      ;;\n\n    sysv4 | sysv4.2uw2* | sysv4.3*)\n      lt_prog_compiler_wl='-Wl,'\n      lt_prog_compiler_pic='-KPIC'\n      lt_prog_compiler_static='-Bstatic'\n      ;;\n\n    sysv4*MP*)\n      if test -d /usr/nec ;then\n\tlt_prog_compiler_pic='-Kconform_pic'\n\tlt_prog_compiler_static='-Bstatic'\n      fi\n      ;;\n\n    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)\n      lt_prog_compiler_wl='-Wl,'\n      lt_prog_compiler_pic='-KPIC'\n      lt_prog_compiler_static='-Bstatic'\n      ;;\n\n    unicos*)\n      lt_prog_compiler_wl='-Wl,'\n      lt_prog_compiler_can_build_shared=no\n      ;;\n\n    uts4*)\n      lt_prog_compiler_pic='-pic'\n      lt_prog_compiler_static='-Bstatic'\n      ;;\n\n    *)\n      lt_prog_compiler_can_build_shared=no\n      ;;\n    esac\n  fi\n\ncase $host_os in\n  # For platforms which do not support PIC, -DPIC is meaningless:\n  *djgpp*)\n    lt_prog_compiler_pic=\n    ;;\n  *)\n    lt_prog_compiler_pic=\"$lt_prog_compiler_pic -DPIC\"\n    ;;\nesac\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic\" >&5\n$as_echo \"$lt_prog_compiler_pic\" >&6; }\n\n\n\n\n\n\n#\n# Check to make sure the PIC flag actually works.\n#\nif test -n \"$lt_prog_compiler_pic\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works\" >&5\n$as_echo_n \"checking if $compiler PIC flag $lt_prog_compiler_pic works... \" >&6; }\nif test \"${lt_cv_prog_compiler_pic_works+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  lt_cv_prog_compiler_pic_works=no\n   ac_outfile=conftest.$ac_objext\n   echo \"$lt_simple_compile_test_code\" > conftest.$ac_ext\n   lt_compiler_flag=\"$lt_prog_compiler_pic -DPIC\"\n   # Insert the option either (1) after the last *FLAGS variable, or\n   # (2) before a word containing \"conftest.\", or (3) at the end.\n   # Note that $ac_compile itself does not contain backslashes and begins\n   # with a dollar sign (not a hyphen), so the echo should work correctly.\n   # The option is referenced via a variable to avoid confusing sed.\n   lt_compile=`echo \"$ac_compile\" | $SED \\\n   -e 's:.*FLAGS}\\{0,1\\} :&$lt_compiler_flag :; t' \\\n   -e 's: [^ ]*conftest\\.: $lt_compiler_flag&:; t' \\\n   -e 's:$: $lt_compiler_flag:'`\n   (eval echo \"\\\"\\$as_me:9135: $lt_compile\\\"\" >&5)\n   (eval \"$lt_compile\" 2>conftest.err)\n   ac_status=$?\n   cat conftest.err >&5\n   echo \"$as_me:9139: \\$? = $ac_status\" >&5\n   if (exit $ac_status) && test -s \"$ac_outfile\"; then\n     # The compiler can only warn and ignore the option if not recognized\n     # So say no if there are warnings other than the usual output.\n     $ECHO \"X$_lt_compiler_boilerplate\" | $Xsed -e '/^$/d' >conftest.exp\n     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2\n     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then\n       lt_cv_prog_compiler_pic_works=yes\n     fi\n   fi\n   $RM conftest*\n\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works\" >&5\n$as_echo \"$lt_cv_prog_compiler_pic_works\" >&6; }\n\nif test x\"$lt_cv_prog_compiler_pic_works\" = xyes; then\n    case $lt_prog_compiler_pic in\n     \"\" | \" \"*) ;;\n     *) lt_prog_compiler_pic=\" $lt_prog_compiler_pic\" ;;\n     esac\nelse\n    lt_prog_compiler_pic=\n     lt_prog_compiler_can_build_shared=no\nfi\n\nfi\n\n\n\n\n\n\n#\n# Check to make sure the static flag actually works.\n#\nwl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\\\"$lt_prog_compiler_static\\\"\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works\" >&5\n$as_echo_n \"checking if $compiler static flag $lt_tmp_static_flag works... \" >&6; }\nif test \"${lt_cv_prog_compiler_static_works+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  lt_cv_prog_compiler_static_works=no\n   save_LDFLAGS=\"$LDFLAGS\"\n   LDFLAGS=\"$LDFLAGS $lt_tmp_static_flag\"\n   echo \"$lt_simple_link_test_code\" > conftest.$ac_ext\n   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then\n     # The linker can only warn and ignore the option if not recognized\n     # So say no if there are warnings\n     if test -s conftest.err; then\n       # Append any errors to the config.log.\n       cat conftest.err 1>&5\n       $ECHO \"X$_lt_linker_boilerplate\" | $Xsed -e '/^$/d' > conftest.exp\n       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2\n       if diff conftest.exp conftest.er2 >/dev/null; then\n         lt_cv_prog_compiler_static_works=yes\n       fi\n     else\n       lt_cv_prog_compiler_static_works=yes\n     fi\n   fi\n   $RM -r conftest*\n   LDFLAGS=\"$save_LDFLAGS\"\n\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works\" >&5\n$as_echo \"$lt_cv_prog_compiler_static_works\" >&6; }\n\nif test x\"$lt_cv_prog_compiler_static_works\" = xyes; then\n    :\nelse\n    lt_prog_compiler_static=\nfi\n\n\n\n\n\n\n\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext\" >&5\n$as_echo_n \"checking if $compiler supports -c -o file.$ac_objext... \" >&6; }\nif test \"${lt_cv_prog_compiler_c_o+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  lt_cv_prog_compiler_c_o=no\n   $RM -r conftest 2>/dev/null\n   mkdir conftest\n   cd conftest\n   mkdir out\n   echo \"$lt_simple_compile_test_code\" > conftest.$ac_ext\n\n   lt_compiler_flag=\"-o out/conftest2.$ac_objext\"\n   # Insert the option either (1) after the last *FLAGS variable, or\n   # (2) before a word containing \"conftest.\", or (3) at the end.\n   # Note that $ac_compile itself does not contain backslashes and begins\n   # with a dollar sign (not a hyphen), so the echo should work correctly.\n   lt_compile=`echo \"$ac_compile\" | $SED \\\n   -e 's:.*FLAGS}\\{0,1\\} :&$lt_compiler_flag :; t' \\\n   -e 's: [^ ]*conftest\\.: $lt_compiler_flag&:; t' \\\n   -e 's:$: $lt_compiler_flag:'`\n   (eval echo \"\\\"\\$as_me:9240: $lt_compile\\\"\" >&5)\n   (eval \"$lt_compile\" 2>out/conftest.err)\n   ac_status=$?\n   cat out/conftest.err >&5\n   echo \"$as_me:9244: \\$? = $ac_status\" >&5\n   if (exit $ac_status) && test -s out/conftest2.$ac_objext\n   then\n     # The compiler can only warn and ignore the option if not recognized\n     # So say no if there are warnings\n     $ECHO \"X$_lt_compiler_boilerplate\" | $Xsed -e '/^$/d' > out/conftest.exp\n     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2\n     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then\n       lt_cv_prog_compiler_c_o=yes\n     fi\n   fi\n   chmod u+w . 2>&5\n   $RM conftest*\n   # SGI C++ compiler will create directory out/ii_files/ for\n   # template instantiation\n   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files\n   $RM out/* && rmdir out\n   cd ..\n   $RM -r conftest\n   $RM conftest*\n\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o\" >&5\n$as_echo \"$lt_cv_prog_compiler_c_o\" >&6; }\n\n\n\n\n\n\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext\" >&5\n$as_echo_n \"checking if $compiler supports -c -o file.$ac_objext... \" >&6; }\nif test \"${lt_cv_prog_compiler_c_o+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  lt_cv_prog_compiler_c_o=no\n   $RM -r conftest 2>/dev/null\n   mkdir conftest\n   cd conftest\n   mkdir out\n   echo \"$lt_simple_compile_test_code\" > conftest.$ac_ext\n\n   lt_compiler_flag=\"-o out/conftest2.$ac_objext\"\n   # Insert the option either (1) after the last *FLAGS variable, or\n   # (2) before a word containing \"conftest.\", or (3) at the end.\n   # Note that $ac_compile itself does not contain backslashes and begins\n   # with a dollar sign (not a hyphen), so the echo should work correctly.\n   lt_compile=`echo \"$ac_compile\" | $SED \\\n   -e 's:.*FLAGS}\\{0,1\\} :&$lt_compiler_flag :; t' \\\n   -e 's: [^ ]*conftest\\.: $lt_compiler_flag&:; t' \\\n   -e 's:$: $lt_compiler_flag:'`\n   (eval echo \"\\\"\\$as_me:9295: $lt_compile\\\"\" >&5)\n   (eval \"$lt_compile\" 2>out/conftest.err)\n   ac_status=$?\n   cat out/conftest.err >&5\n   echo \"$as_me:9299: \\$? = $ac_status\" >&5\n   if (exit $ac_status) && test -s out/conftest2.$ac_objext\n   then\n     # The compiler can only warn and ignore the option if not recognized\n     # So say no if there are warnings\n     $ECHO \"X$_lt_compiler_boilerplate\" | $Xsed -e '/^$/d' > out/conftest.exp\n     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2\n     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then\n       lt_cv_prog_compiler_c_o=yes\n     fi\n   fi\n   chmod u+w . 2>&5\n   $RM conftest*\n   # SGI C++ compiler will create directory out/ii_files/ for\n   # template instantiation\n   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files\n   $RM out/* && rmdir out\n   cd ..\n   $RM -r conftest\n   $RM conftest*\n\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o\" >&5\n$as_echo \"$lt_cv_prog_compiler_c_o\" >&6; }\n\n\n\n\nhard_links=\"nottested\"\nif test \"$lt_cv_prog_compiler_c_o\" = no && test \"$need_locks\" != no; then\n  # do not overwrite the value of need_locks provided by the user\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links\" >&5\n$as_echo_n \"checking if we can lock with hard links... \" >&6; }\n  hard_links=yes\n  $RM conftest*\n  ln conftest.a conftest.b 2>/dev/null && hard_links=no\n  touch conftest.a\n  ln conftest.a conftest.b 2>&5 || hard_links=no\n  ln conftest.a conftest.b 2>/dev/null && hard_links=no\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $hard_links\" >&5\n$as_echo \"$hard_links\" >&6; }\n  if test \"$hard_links\" = no; then\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: WARNING: \\`$CC' does not support \\`-c -o', so \\`make -j' may be unsafe\" >&5\n$as_echo \"$as_me: WARNING: \\`$CC' does not support \\`-c -o', so \\`make -j' may be unsafe\" >&2;}\n    need_locks=warn\n  fi\nelse\n  need_locks=no\nfi\n\n\n\n\n\n\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries\" >&5\n$as_echo_n \"checking whether the $compiler linker ($LD) supports shared libraries... \" >&6; }\n\n  runpath_var=\n  allow_undefined_flag=\n  always_export_symbols=no\n  archive_cmds=\n  archive_expsym_cmds=\n  compiler_needs_object=no\n  enable_shared_with_static_runtimes=no\n  export_dynamic_flag_spec=\n  export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\\''s/.* //'\\'' | sort | uniq > $export_symbols'\n  hardcode_automatic=no\n  hardcode_direct=no\n  hardcode_direct_absolute=no\n  hardcode_libdir_flag_spec=\n  hardcode_libdir_flag_spec_ld=\n  hardcode_libdir_separator=\n  hardcode_minus_L=no\n  hardcode_shlibpath_var=unsupported\n  inherit_rpath=no\n  link_all_deplibs=unknown\n  module_cmds=\n  module_expsym_cmds=\n  old_archive_from_new_cmds=\n  old_archive_from_expsyms_cmds=\n  thread_safe_flag_spec=\n  whole_archive_flag_spec=\n  # include_expsyms should be a list of space-separated symbols to be *always*\n  # included in the symbol list\n  include_expsyms=\n  # exclude_expsyms can be an extended regexp of symbols to exclude\n  # it will be wrapped by ` (' and `)$', so one must not match beginning or\n  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',\n  # as well as any symbol that contains `d'.\n  exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'\n  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out\n  # platforms (ab)use it in PIC code, but their linkers get confused if\n  # the symbol is explicitly referenced.  Since portable code cannot\n  # rely on this symbol name, it's probably fine to never include it in\n  # preloaded symbol tables.\n  # Exclude shared library initialization/finalization symbols.\n  extract_expsyms_cmds=\n\n  case $host_os in\n  cygwin* | mingw* | pw32* | cegcc*)\n    # FIXME: the MSVC++ port hasn't been tested in a loooong time\n    # When not using gcc, we currently assume that we are using\n    # Microsoft Visual C++.\n    if test \"$GCC\" != yes; then\n      with_gnu_ld=no\n    fi\n    ;;\n  interix*)\n    # we just hope/assume this is gcc and not c89 (= MSVC++)\n    with_gnu_ld=yes\n    ;;\n  openbsd*)\n    with_gnu_ld=no\n    ;;\n  esac\n\n  ld_shlibs=yes\n  if test \"$with_gnu_ld\" = yes; then\n    # If archive_cmds runs LD, not CC, wlarc should be empty\n    wlarc='${wl}'\n\n    # Set some defaults for GNU ld with shared library support. These\n    # are reset later if shared libraries are not supported. Putting them\n    # here allows them to be overridden if necessary.\n    runpath_var=LD_RUN_PATH\n    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'\n    export_dynamic_flag_spec='${wl}--export-dynamic'\n    # ancient GNU ld didn't support --whole-archive et. al.\n    if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then\n      whole_archive_flag_spec=\"$wlarc\"'--whole-archive$convenience '\"$wlarc\"'--no-whole-archive'\n    else\n      whole_archive_flag_spec=\n    fi\n    supports_anon_versioning=no\n    case `$LD -v 2>&1` in\n      *\\ [01].* | *\\ 2.[0-9].* | *\\ 2.10.*) ;; # catch versions < 2.11\n      *\\ 2.11.93.0.2\\ *) supports_anon_versioning=yes ;; # RH7.3 ...\n      *\\ 2.11.92.0.12\\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...\n      *\\ 2.11.*) ;; # other 2.11 versions\n      *) supports_anon_versioning=yes ;;\n    esac\n\n    # See if GNU ld supports shared libraries.\n    case $host_os in\n    aix[3-9]*)\n      # On AIX/PPC, the GNU linker is very broken\n      if test \"$host_cpu\" != ia64; then\n\tld_shlibs=no\n\tcat <<_LT_EOF 1>&2\n\n*** Warning: the GNU linker, at least up to release 2.9.1, is reported\n*** to be unable to reliably create shared libraries on AIX.\n*** Therefore, libtool is disabling shared libraries support.  If you\n*** really care for shared libraries, you may want to modify your PATH\n*** so that a non-GNU linker is found, and then restart.\n\n_LT_EOF\n      fi\n      ;;\n\n    amigaos*)\n      case $host_cpu in\n      powerpc)\n            # see comment about AmigaOS4 .so support\n            archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n            archive_expsym_cmds=''\n        ;;\n      m68k)\n            archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO \"#define NAME $libname\" > $output_objdir/a2ixlibrary.data~$ECHO \"#define LIBRARY_ID 1\" >> $output_objdir/a2ixlibrary.data~$ECHO \"#define VERSION $major\" >> $output_objdir/a2ixlibrary.data~$ECHO \"#define REVISION $revision\" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'\n            hardcode_libdir_flag_spec='-L$libdir'\n            hardcode_minus_L=yes\n        ;;\n      esac\n      ;;\n\n    beos*)\n      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then\n\tallow_undefined_flag=unsupported\n\t# Joseph Beckenbach <jrb3@best.com> says some releases of gcc\n\t# support --undefined.  This deserves some investigation.  FIXME\n\tarchive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n      else\n\tld_shlibs=no\n      fi\n      ;;\n\n    cygwin* | mingw* | pw32* | cegcc*)\n      # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless,\n      # as there is no search path for DLLs.\n      hardcode_libdir_flag_spec='-L$libdir'\n      allow_undefined_flag=unsupported\n      always_export_symbols=no\n      enable_shared_with_static_runtimes=yes\n      export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\\''/^[BCDGRS][ ]/s/.*[ ]\\([^ ]*\\)/\\1 DATA/'\\'' | $SED -e '\\''/^[AITW][ ]/s/.*[ ]//'\\'' | sort | uniq > $export_symbols'\n\n      if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then\n        archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'\n\t# If the export-symbols file already is a .def file (1st line\n\t# is EXPORTS), use it as is; otherwise, prepend...\n\tarchive_expsym_cmds='if test \"x`$SED 1q $export_symbols`\" = xEXPORTS; then\n\t  cp $export_symbols $output_objdir/$soname.def;\n\telse\n\t  echo EXPORTS > $output_objdir/$soname.def;\n\t  cat $export_symbols >> $output_objdir/$soname.def;\n\tfi~\n\t$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'\n      else\n\tld_shlibs=no\n      fi\n      ;;\n\n    interix[3-9]*)\n      hardcode_direct=no\n      hardcode_shlibpath_var=no\n      hardcode_libdir_flag_spec='${wl}-rpath,$libdir'\n      export_dynamic_flag_spec='${wl}-E'\n      # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.\n      # Instead, shared libraries are loaded at an image base (0x10000000 by\n      # default) and relocated if they conflict, which is a slow very memory\n      # consuming and fragmenting process.  To avoid this, we pick a random,\n      # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link\n      # time.  Moving up from 0x10000000 also allows more sbrk(2) space.\n      archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \\* 262144 + 1342177280` -o $lib'\n      archive_expsym_cmds='sed \"s,^,_,\" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \\* 262144 + 1342177280` -o $lib'\n      ;;\n\n    gnu* | linux* | tpf* | k*bsd*-gnu)\n      tmp_diet=no\n      if test \"$host_os\" = linux-dietlibc; then\n\tcase $cc_basename in\n\t  diet\\ *) tmp_diet=yes;;\t# linux-dietlibc with static linking (!diet-dyn)\n\tesac\n      fi\n      if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \\\n\t && test \"$tmp_diet\" = no\n      then\n\ttmp_addflag=\n\ttmp_sharedflag='-shared'\n\tcase $cc_basename,$host_cpu in\n        pgcc*)\t\t\t\t# Portland Group C compiler\n\t  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\\\"\\\"; do test  -n \\\"$conv\\\" && new_convenience=\\\"$new_convenience,$conv\\\"; done; $ECHO \\\"$new_convenience\\\"` ${wl}--no-whole-archive'\n\t  tmp_addflag=' $pic_flag'\n\t  ;;\n\tpgf77* | pgf90* | pgf95*)\t# Portland Group f77 and f90 compilers\n\t  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\\\"\\\"; do test  -n \\\"$conv\\\" && new_convenience=\\\"$new_convenience,$conv\\\"; done; $ECHO \\\"$new_convenience\\\"` ${wl}--no-whole-archive'\n\t  tmp_addflag=' $pic_flag -Mnomain' ;;\n\tecc*,ia64* | icc*,ia64*)\t# Intel C compiler on ia64\n\t  tmp_addflag=' -i_dynamic' ;;\n\tefc*,ia64* | ifort*,ia64*)\t# Intel Fortran compiler on ia64\n\t  tmp_addflag=' -i_dynamic -nofor_main' ;;\n\tifc* | ifort*)\t\t\t# Intel Fortran compiler\n\t  tmp_addflag=' -nofor_main' ;;\n\tlf95*)\t\t\t\t# Lahey Fortran 8.1\n\t  whole_archive_flag_spec=\n\t  tmp_sharedflag='--shared' ;;\n\txl[cC]*)\t\t\t# IBM XL C 8.0 on PPC (deal with xlf below)\n\t  tmp_sharedflag='-qmkshrobj'\n\t  tmp_addflag= ;;\n\tesac\n\tcase `$CC -V 2>&1 | sed 5q` in\n\t*Sun\\ C*)\t\t\t# Sun C 5.9\n\t  whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\\\"\\\"; do test -z \\\"$conv\\\" || new_convenience=\\\"$new_convenience,$conv\\\"; done; $ECHO \\\"$new_convenience\\\"` ${wl}--no-whole-archive'\n\t  compiler_needs_object=yes\n\t  tmp_sharedflag='-G' ;;\n\t*Sun\\ F*)\t\t\t# Sun Fortran 8.3\n\t  tmp_sharedflag='-G' ;;\n\tesac\n\tarchive_cmds='$CC '\"$tmp_sharedflag\"\"$tmp_addflag\"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n\n        if test \"x$supports_anon_versioning\" = xyes; then\n          archive_expsym_cmds='echo \"{ global:\" > $output_objdir/$libname.ver~\n\t    cat $export_symbols | sed -e \"s/\\(.*\\)/\\1;/\" >> $output_objdir/$libname.ver~\n\t    echo \"local: *; };\" >> $output_objdir/$libname.ver~\n\t    $CC '\"$tmp_sharedflag\"\"$tmp_addflag\"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'\n        fi\n\n\tcase $cc_basename in\n\txlf*)\n\t  # IBM XL Fortran 10.1 on PPC cannot create shared libs itself\n\t  whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive'\n\t  hardcode_libdir_flag_spec=\n\t  hardcode_libdir_flag_spec_ld='-rpath $libdir'\n\t  archive_cmds='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib'\n\t  if test \"x$supports_anon_versioning\" = xyes; then\n\t    archive_expsym_cmds='echo \"{ global:\" > $output_objdir/$libname.ver~\n\t      cat $export_symbols | sed -e \"s/\\(.*\\)/\\1;/\" >> $output_objdir/$libname.ver~\n\t      echo \"local: *; };\" >> $output_objdir/$libname.ver~\n\t      $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'\n\t  fi\n\t  ;;\n\tesac\n      else\n        ld_shlibs=no\n      fi\n      ;;\n\n    netbsd*)\n      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then\n\tarchive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'\n\twlarc=\n      else\n\tarchive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n\tarchive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'\n      fi\n      ;;\n\n    solaris*)\n      if $LD -v 2>&1 | $GREP 'BFD 2\\.8' > /dev/null; then\n\tld_shlibs=no\n\tcat <<_LT_EOF 1>&2\n\n*** Warning: The releases 2.8.* of the GNU linker cannot reliably\n*** create shared libraries on Solaris systems.  Therefore, libtool\n*** is disabling shared libraries support.  We urge you to upgrade GNU\n*** binutils to release 2.9.1 or newer.  Another option is to modify\n*** your PATH or compiler configuration so that the native linker is\n*** used, and then restart.\n\n_LT_EOF\n      elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then\n\tarchive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n\tarchive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'\n      else\n\tld_shlibs=no\n      fi\n      ;;\n\n    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)\n      case `$LD -v 2>&1` in\n        *\\ [01].* | *\\ 2.[0-9].* | *\\ 2.1[0-5].*)\n\tld_shlibs=no\n\tcat <<_LT_EOF 1>&2\n\n*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not\n*** reliably create shared libraries on SCO systems.  Therefore, libtool\n*** is disabling shared libraries support.  We urge you to upgrade GNU\n*** binutils to release 2.16.91.0.3 or newer.  Another option is to modify\n*** your PATH or compiler configuration so that the native linker is\n*** used, and then restart.\n\n_LT_EOF\n\t;;\n\t*)\n\t  # For security reasons, it is highly recommended that you always\n\t  # use absolute paths for naming shared libraries, and exclude the\n\t  # DT_RUNPATH tag from executables and libraries.  But doing so\n\t  # requires that you compile everything twice, which is a pain.\n\t  if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then\n\t    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'\n\t    archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n\t    archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'\n\t  else\n\t    ld_shlibs=no\n\t  fi\n\t;;\n      esac\n      ;;\n\n    sunos4*)\n      archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'\n      wlarc=\n      hardcode_direct=yes\n      hardcode_shlibpath_var=no\n      ;;\n\n    *)\n      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then\n\tarchive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n\tarchive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'\n      else\n\tld_shlibs=no\n      fi\n      ;;\n    esac\n\n    if test \"$ld_shlibs\" = no; then\n      runpath_var=\n      hardcode_libdir_flag_spec=\n      export_dynamic_flag_spec=\n      whole_archive_flag_spec=\n    fi\n  else\n    # PORTME fill in a description of your system's linker (not GNU ld)\n    case $host_os in\n    aix3*)\n      allow_undefined_flag=unsupported\n      always_export_symbols=yes\n      archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'\n      # Note: this linker hardcodes the directories in LIBPATH if there\n      # are no directories specified by -L.\n      hardcode_minus_L=yes\n      if test \"$GCC\" = yes && test -z \"$lt_prog_compiler_static\"; then\n\t# Neither direct hardcoding nor static linking is supported with a\n\t# broken collect2.\n\thardcode_direct=unsupported\n      fi\n      ;;\n\n    aix[4-9]*)\n      if test \"$host_cpu\" = ia64; then\n\t# On IA64, the linker does run time linking by default, so we don't\n\t# have to do anything special.\n\taix_use_runtimelinking=no\n\texp_sym_flag='-Bexport'\n\tno_entry_flag=\"\"\n      else\n\t# If we're using GNU nm, then we don't want the \"-C\" option.\n\t# -C means demangle to AIX nm, but means don't demangle with GNU nm\n\tif $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then\n\t  export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\\''{ if (((\\$ 2 == \"T\") || (\\$ 2 == \"D\") || (\\$ 2 == \"B\")) && (substr(\\$ 3,1,1) != \".\")) { print \\$ 3 } }'\\'' | sort -u > $export_symbols'\n\telse\n\t  export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\\''{ if (((\\$ 2 == \"T\") || (\\$ 2 == \"D\") || (\\$ 2 == \"B\")) && (substr(\\$ 3,1,1) != \".\")) { print \\$ 3 } }'\\'' | sort -u > $export_symbols'\n\tfi\n\taix_use_runtimelinking=no\n\n\t# Test if we are trying to use run time linking or normal\n\t# AIX style linking. If -brtl is somewhere in LDFLAGS, we\n\t# need to do runtime linking.\n\tcase $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)\n\t  for ld_flag in $LDFLAGS; do\n\t  if (test $ld_flag = \"-brtl\" || test $ld_flag = \"-Wl,-brtl\"); then\n\t    aix_use_runtimelinking=yes\n\t    break\n\t  fi\n\t  done\n\t  ;;\n\tesac\n\n\texp_sym_flag='-bexport'\n\tno_entry_flag='-bnoentry'\n      fi\n\n      # When large executables or shared objects are built, AIX ld can\n      # have problems creating the table of contents.  If linking a library\n      # or program results in \"error TOC overflow\" add -mminimal-toc to\n      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not\n      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.\n\n      archive_cmds=''\n      hardcode_direct=yes\n      hardcode_direct_absolute=yes\n      hardcode_libdir_separator=':'\n      link_all_deplibs=yes\n      file_list_spec='${wl}-f,'\n\n      if test \"$GCC\" = yes; then\n\tcase $host_os in aix4.[012]|aix4.[012].*)\n\t# We only want to do this on AIX 4.2 and lower, the check\n\t# below for broken collect2 doesn't work under 4.3+\n\t  collect2name=`${CC} -print-prog-name=collect2`\n\t  if test -f \"$collect2name\" &&\n\t   strings \"$collect2name\" | $GREP resolve_lib_name >/dev/null\n\t  then\n\t  # We have reworked collect2\n\t  :\n\t  else\n\t  # We have old collect2\n\t  hardcode_direct=unsupported\n\t  # It fails to find uninstalled libraries when the uninstalled\n\t  # path is not listed in the libpath.  Setting hardcode_minus_L\n\t  # to unsupported forces relinking\n\t  hardcode_minus_L=yes\n\t  hardcode_libdir_flag_spec='-L$libdir'\n\t  hardcode_libdir_separator=\n\t  fi\n\t  ;;\n\tesac\n\tshared_flag='-shared'\n\tif test \"$aix_use_runtimelinking\" = yes; then\n\t  shared_flag=\"$shared_flag \"'${wl}-G'\n\tfi\n      else\n\t# not using gcc\n\tif test \"$host_cpu\" = ia64; then\n\t# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release\n\t# chokes on -Wl,-G. The following line is correct:\n\t  shared_flag='-G'\n\telse\n\t  if test \"$aix_use_runtimelinking\" = yes; then\n\t    shared_flag='${wl}-G'\n\t  else\n\t    shared_flag='${wl}-bM:SRE'\n\t  fi\n\tfi\n      fi\n\n      export_dynamic_flag_spec='${wl}-bexpall'\n      # It seems that -bexpall does not export symbols beginning with\n      # underscore (_), so it is better to generate a list of symbols to export.\n      always_export_symbols=yes\n      if test \"$aix_use_runtimelinking\" = yes; then\n\t# Warning - without using the other runtime loading flags (-brtl),\n\t# -berok will link without error, but may produce a broken library.\n\tallow_undefined_flag='-berok'\n        # Determine the default libpath from the value encoded in an\n        # empty executable.\n        cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\nint\nmain ()\n{\n\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_link \"$LINENO\"; then :\n\nlt_aix_libpath_sed='\n    /Import File Strings/,/^$/ {\n\t/^0/ {\n\t    s/^0  *\\(.*\\)$/\\1/\n\t    p\n\t}\n    }'\naix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e \"$lt_aix_libpath_sed\"`\n# Check for a 64-bit object if we didn't find anything.\nif test -z \"$aix_libpath\"; then\n  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e \"$lt_aix_libpath_sed\"`\nfi\nfi\nrm -f core conftest.err conftest.$ac_objext \\\n    conftest$ac_exeext conftest.$ac_ext\nif test -z \"$aix_libpath\"; then aix_libpath=\"/usr/lib:/lib\"; fi\n\n        hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'\"$aix_libpath\"\n        archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '\"\\${wl}$no_entry_flag\"' $compiler_flags `if test \"x${allow_undefined_flag}\" != \"x\"; then $ECHO \"X${wl}${allow_undefined_flag}\" | $Xsed; else :; fi` '\"\\${wl}$exp_sym_flag:\\$export_symbols $shared_flag\"\n      else\n\tif test \"$host_cpu\" = ia64; then\n\t  hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'\n\t  allow_undefined_flag=\"-z nodefs\"\n\t  archive_expsym_cmds=\"\\$CC $shared_flag\"' -o $output_objdir/$soname $libobjs $deplibs '\"\\${wl}$no_entry_flag\"' $compiler_flags ${wl}${allow_undefined_flag} '\"\\${wl}$exp_sym_flag:\\$export_symbols\"\n\telse\n\t # Determine the default libpath from the value encoded in an\n\t # empty executable.\n\t cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\nint\nmain ()\n{\n\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_link \"$LINENO\"; then :\n\nlt_aix_libpath_sed='\n    /Import File Strings/,/^$/ {\n\t/^0/ {\n\t    s/^0  *\\(.*\\)$/\\1/\n\t    p\n\t}\n    }'\naix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e \"$lt_aix_libpath_sed\"`\n# Check for a 64-bit object if we didn't find anything.\nif test -z \"$aix_libpath\"; then\n  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e \"$lt_aix_libpath_sed\"`\nfi\nfi\nrm -f core conftest.err conftest.$ac_objext \\\n    conftest$ac_exeext conftest.$ac_ext\nif test -z \"$aix_libpath\"; then aix_libpath=\"/usr/lib:/lib\"; fi\n\n\t hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'\"$aix_libpath\"\n\t  # Warning - without using the other run time loading flags,\n\t  # -berok will link without error, but may produce a broken library.\n\t  no_undefined_flag=' ${wl}-bernotok'\n\t  allow_undefined_flag=' ${wl}-berok'\n\t  # Exported symbols can be pulled into shared objects from archives\n\t  whole_archive_flag_spec='$convenience'\n\t  archive_cmds_need_lc=yes\n\t  # This is similar to how AIX traditionally builds its shared libraries.\n\t  archive_expsym_cmds=\"\\$CC $shared_flag\"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'\n\tfi\n      fi\n      ;;\n\n    amigaos*)\n      case $host_cpu in\n      powerpc)\n            # see comment about AmigaOS4 .so support\n            archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n            archive_expsym_cmds=''\n        ;;\n      m68k)\n            archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO \"#define NAME $libname\" > $output_objdir/a2ixlibrary.data~$ECHO \"#define LIBRARY_ID 1\" >> $output_objdir/a2ixlibrary.data~$ECHO \"#define VERSION $major\" >> $output_objdir/a2ixlibrary.data~$ECHO \"#define REVISION $revision\" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'\n            hardcode_libdir_flag_spec='-L$libdir'\n            hardcode_minus_L=yes\n        ;;\n      esac\n      ;;\n\n    bsdi[45]*)\n      export_dynamic_flag_spec=-rdynamic\n      ;;\n\n    cygwin* | mingw* | pw32* | cegcc*)\n      # When not using gcc, we currently assume that we are using\n      # Microsoft Visual C++.\n      # hardcode_libdir_flag_spec is actually meaningless, as there is\n      # no search path for DLLs.\n      hardcode_libdir_flag_spec=' '\n      allow_undefined_flag=unsupported\n      # Tell ltmain to make .lib files, not .a files.\n      libext=lib\n      # Tell ltmain to make .dll files, not .so files.\n      shrext_cmds=\".dll\"\n      # FIXME: Setting linknames here is a bad hack.\n      archive_cmds='$CC -o $lib $libobjs $compiler_flags `$ECHO \"X$deplibs\" | $Xsed -e '\\''s/ -lc$//'\\''` -link -dll~linknames='\n      # The linker will automatically build a .lib file if we build a DLL.\n      old_archive_from_new_cmds='true'\n      # FIXME: Should let the user specify the lib program.\n      old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'\n      fix_srcfile_path='`cygpath -w \"$srcfile\"`'\n      enable_shared_with_static_runtimes=yes\n      ;;\n\n    darwin* | rhapsody*)\n\n\n  archive_cmds_need_lc=no\n  hardcode_direct=no\n  hardcode_automatic=yes\n  hardcode_shlibpath_var=unsupported\n  whole_archive_flag_spec=''\n  link_all_deplibs=yes\n  allow_undefined_flag=\"$_lt_dar_allow_undefined\"\n  case $cc_basename in\n     ifort*) _lt_dar_can_shared=yes ;;\n     *) _lt_dar_can_shared=$GCC ;;\n  esac\n  if test \"$_lt_dar_can_shared\" = \"yes\"; then\n    output_verbose_link_cmd=echo\n    archive_cmds=\"\\$CC -dynamiclib \\$allow_undefined_flag -o \\$lib \\$libobjs \\$deplibs \\$compiler_flags -install_name \\$rpath/\\$soname \\$verstring $_lt_dar_single_mod${_lt_dsymutil}\"\n    module_cmds=\"\\$CC \\$allow_undefined_flag -o \\$lib -bundle \\$libobjs \\$deplibs \\$compiler_flags${_lt_dsymutil}\"\n    archive_expsym_cmds=\"sed 's,^,_,' < \\$export_symbols > \\$output_objdir/\\${libname}-symbols.expsym~\\$CC -dynamiclib \\$allow_undefined_flag -o \\$lib \\$libobjs \\$deplibs \\$compiler_flags -install_name \\$rpath/\\$soname \\$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}\"\n    module_expsym_cmds=\"sed -e 's,^,_,' < \\$export_symbols > \\$output_objdir/\\${libname}-symbols.expsym~\\$CC \\$allow_undefined_flag -o \\$lib -bundle \\$libobjs \\$deplibs \\$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}\"\n\n  else\n  ld_shlibs=no\n  fi\n\n      ;;\n\n    dgux*)\n      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'\n      hardcode_libdir_flag_spec='-L$libdir'\n      hardcode_shlibpath_var=no\n      ;;\n\n    freebsd1*)\n      ld_shlibs=no\n      ;;\n\n    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor\n    # support.  Future versions do this automatically, but an explicit c++rt0.o\n    # does not break anything, and helps significantly (at the cost of a little\n    # extra space).\n    freebsd2.2*)\n      archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'\n      hardcode_libdir_flag_spec='-R$libdir'\n      hardcode_direct=yes\n      hardcode_shlibpath_var=no\n      ;;\n\n    # Unfortunately, older versions of FreeBSD 2 do not have this feature.\n    freebsd2*)\n      archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'\n      hardcode_direct=yes\n      hardcode_minus_L=yes\n      hardcode_shlibpath_var=no\n      ;;\n\n    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.\n    freebsd* | dragonfly*)\n      archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'\n      hardcode_libdir_flag_spec='-R$libdir'\n      hardcode_direct=yes\n      hardcode_shlibpath_var=no\n      ;;\n\n    hpux9*)\n      if test \"$GCC\" = yes; then\n\tarchive_cmds='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'\n      else\n\tarchive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'\n      fi\n      hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'\n      hardcode_libdir_separator=:\n      hardcode_direct=yes\n\n      # hardcode_minus_L: Not really in the search PATH,\n      # but as the default location of the library.\n      hardcode_minus_L=yes\n      export_dynamic_flag_spec='${wl}-E'\n      ;;\n\n    hpux10*)\n      if test \"$GCC\" = yes -a \"$with_gnu_ld\" = no; then\n\tarchive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'\n      else\n\tarchive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'\n      fi\n      if test \"$with_gnu_ld\" = no; then\n\thardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'\n\thardcode_libdir_flag_spec_ld='+b $libdir'\n\thardcode_libdir_separator=:\n\thardcode_direct=yes\n\thardcode_direct_absolute=yes\n\texport_dynamic_flag_spec='${wl}-E'\n\t# hardcode_minus_L: Not really in the search PATH,\n\t# but as the default location of the library.\n\thardcode_minus_L=yes\n      fi\n      ;;\n\n    hpux11*)\n      if test \"$GCC\" = yes -a \"$with_gnu_ld\" = no; then\n\tcase $host_cpu in\n\thppa*64*)\n\t  archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t  ;;\n\tia64*)\n\t  archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'\n\t  ;;\n\t*)\n\t  archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'\n\t  ;;\n\tesac\n      else\n\tcase $host_cpu in\n\thppa*64*)\n\t  archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t  ;;\n\tia64*)\n\t  archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'\n\t  ;;\n\t*)\n\t  archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'\n\t  ;;\n\tesac\n      fi\n      if test \"$with_gnu_ld\" = no; then\n\thardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'\n\thardcode_libdir_separator=:\n\n\tcase $host_cpu in\n\thppa*64*|ia64*)\n\t  hardcode_direct=no\n\t  hardcode_shlibpath_var=no\n\t  ;;\n\t*)\n\t  hardcode_direct=yes\n\t  hardcode_direct_absolute=yes\n\t  export_dynamic_flag_spec='${wl}-E'\n\n\t  # hardcode_minus_L: Not really in the search PATH,\n\t  # but as the default location of the library.\n\t  hardcode_minus_L=yes\n\t  ;;\n\tesac\n      fi\n      ;;\n\n    irix5* | irix6* | nonstopux*)\n      if test \"$GCC\" = yes; then\n\tarchive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n \"$verstring\" && $ECHO \"X${wl}-set_version ${wl}$verstring\" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'\n\t# Try to use the -exported_symbol ld option, if it does not\n\t# work, assume that -exports_file does not work either and\n\t# implicitly export all symbols.\n        save_LDFLAGS=\"$LDFLAGS\"\n        LDFLAGS=\"$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null\"\n        cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\nint foo(void) {}\n_ACEOF\nif ac_fn_c_try_link \"$LINENO\"; then :\n  archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n \"$verstring\" && $ECHO \"X${wl}-set_version ${wl}$verstring\" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'\n\nfi\nrm -f core conftest.err conftest.$ac_objext \\\n    conftest$ac_exeext conftest.$ac_ext\n        LDFLAGS=\"$save_LDFLAGS\"\n      else\n\tarchive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n \"$verstring\" && $ECHO \"X-set_version $verstring\" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'\n\tarchive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n \"$verstring\" && $ECHO \"X-set_version $verstring\" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'\n      fi\n      archive_cmds_need_lc='no'\n      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'\n      hardcode_libdir_separator=:\n      inherit_rpath=yes\n      link_all_deplibs=yes\n      ;;\n\n    netbsd*)\n      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then\n\tarchive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out\n      else\n\tarchive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF\n      fi\n      hardcode_libdir_flag_spec='-R$libdir'\n      hardcode_direct=yes\n      hardcode_shlibpath_var=no\n      ;;\n\n    newsos6)\n      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'\n      hardcode_direct=yes\n      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'\n      hardcode_libdir_separator=:\n      hardcode_shlibpath_var=no\n      ;;\n\n    *nto* | *qnx*)\n      ;;\n\n    openbsd*)\n      if test -f /usr/libexec/ld.so; then\n\thardcode_direct=yes\n\thardcode_shlibpath_var=no\n\thardcode_direct_absolute=yes\n\tif test -z \"`echo __ELF__ | $CC -E - | $GREP __ELF__`\" || test \"$host_os-$host_cpu\" = \"openbsd2.8-powerpc\"; then\n\t  archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'\n\t  archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'\n\t  hardcode_libdir_flag_spec='${wl}-rpath,$libdir'\n\t  export_dynamic_flag_spec='${wl}-E'\n\telse\n\t  case $host_os in\n\t   openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)\n\t     archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'\n\t     hardcode_libdir_flag_spec='-R$libdir'\n\t     ;;\n\t   *)\n\t     archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'\n\t     hardcode_libdir_flag_spec='${wl}-rpath,$libdir'\n\t     ;;\n\t  esac\n\tfi\n      else\n\tld_shlibs=no\n      fi\n      ;;\n\n    os2*)\n      hardcode_libdir_flag_spec='-L$libdir'\n      hardcode_minus_L=yes\n      allow_undefined_flag=unsupported\n      archive_cmds='$ECHO \"LIBRARY $libname INITINSTANCE\" > $output_objdir/$libname.def~$ECHO \"DESCRIPTION \\\"$libname\\\"\" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO \" SINGLE NONSHARED\" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'\n      old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'\n      ;;\n\n    osf3*)\n      if test \"$GCC\" = yes; then\n\tallow_undefined_flag=' ${wl}-expect_unresolved ${wl}\\*'\n\tarchive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n \"$verstring\" && $ECHO \"X${wl}-set_version ${wl}$verstring\" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'\n      else\n\tallow_undefined_flag=' -expect_unresolved \\*'\n\tarchive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n \"$verstring\" && $ECHO \"X-set_version $verstring\" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'\n      fi\n      archive_cmds_need_lc='no'\n      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'\n      hardcode_libdir_separator=:\n      ;;\n\n    osf4* | osf5*)\t# as osf3* with the addition of -msym flag\n      if test \"$GCC\" = yes; then\n\tallow_undefined_flag=' ${wl}-expect_unresolved ${wl}\\*'\n\tarchive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n \"$verstring\" && $ECHO \"X${wl}-set_version ${wl}$verstring\" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'\n\thardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'\n      else\n\tallow_undefined_flag=' -expect_unresolved \\*'\n\tarchive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n \"$verstring\" && $ECHO \"X-set_version $verstring\" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'\n\tarchive_expsym_cmds='for i in `cat $export_symbols`; do printf \"%s %s\\\\n\" -exported_symbol \"\\$i\" >> $lib.exp; done; printf \"%s\\\\n\" \"-hidden\">> $lib.exp~\n\t$CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n \"$verstring\" && $ECHO \"X-set_version $verstring\" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'\n\n\t# Both c and cxx compiler support -rpath directly\n\thardcode_libdir_flag_spec='-rpath $libdir'\n      fi\n      archive_cmds_need_lc='no'\n      hardcode_libdir_separator=:\n      ;;\n\n    solaris*)\n      no_undefined_flag=' -z defs'\n      if test \"$GCC\" = yes; then\n\twlarc='${wl}'\n\tarchive_cmds='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'\n\tarchive_expsym_cmds='echo \"{ global:\" > $lib.exp~cat $export_symbols | $SED -e \"s/\\(.*\\)/\\1;/\" >> $lib.exp~echo \"local: *; };\" >> $lib.exp~\n\t  $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'\n      else\n\tcase `$CC -V 2>&1` in\n\t*\"Compilers 5.0\"*)\n\t  wlarc=''\n\t  archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'\n\t  archive_expsym_cmds='echo \"{ global:\" > $lib.exp~cat $export_symbols | $SED -e \"s/\\(.*\\)/\\1;/\" >> $lib.exp~echo \"local: *; };\" >> $lib.exp~\n\t  $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'\n\t  ;;\n\t*)\n\t  wlarc='${wl}'\n\t  archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'\n\t  archive_expsym_cmds='echo \"{ global:\" > $lib.exp~cat $export_symbols | $SED -e \"s/\\(.*\\)/\\1;/\" >> $lib.exp~echo \"local: *; };\" >> $lib.exp~\n\t  $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'\n\t  ;;\n\tesac\n      fi\n      hardcode_libdir_flag_spec='-R$libdir'\n      hardcode_shlibpath_var=no\n      case $host_os in\n      solaris2.[0-5] | solaris2.[0-5].*) ;;\n      *)\n\t# The compiler driver will combine and reorder linker options,\n\t# but understands `-z linker_flag'.  GCC discards it without `$wl',\n\t# but is careful enough not to reorder.\n\t# Supported since Solaris 2.6 (maybe 2.5.1?)\n\tif test \"$GCC\" = yes; then\n\t  whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'\n\telse\n\t  whole_archive_flag_spec='-z allextract$convenience -z defaultextract'\n\tfi\n\t;;\n      esac\n      link_all_deplibs=yes\n      ;;\n\n    sunos4*)\n      if test \"x$host_vendor\" = xsequent; then\n\t# Use $CC to link under sequent, because it throws in some extra .o\n\t# files that make .init and .fini sections work.\n\tarchive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'\n      else\n\tarchive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'\n      fi\n      hardcode_libdir_flag_spec='-L$libdir'\n      hardcode_direct=yes\n      hardcode_minus_L=yes\n      hardcode_shlibpath_var=no\n      ;;\n\n    sysv4)\n      case $host_vendor in\n\tsni)\n\t  archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'\n\t  hardcode_direct=yes # is this really true???\n\t;;\n\tsiemens)\n\t  ## LD is ld it makes a PLAMLIB\n\t  ## CC just makes a GrossModule.\n\t  archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'\n\t  reload_cmds='$CC -r -o $output$reload_objs'\n\t  hardcode_direct=no\n        ;;\n\tmotorola)\n\t  archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'\n\t  hardcode_direct=no #Motorola manual says yes, but my tests say they lie\n\t;;\n      esac\n      runpath_var='LD_RUN_PATH'\n      hardcode_shlibpath_var=no\n      ;;\n\n    sysv4.3*)\n      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'\n      hardcode_shlibpath_var=no\n      export_dynamic_flag_spec='-Bexport'\n      ;;\n\n    sysv4*MP*)\n      if test -d /usr/nec; then\n\tarchive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'\n\thardcode_shlibpath_var=no\n\trunpath_var=LD_RUN_PATH\n\thardcode_runpath_var=yes\n\tld_shlibs=yes\n      fi\n      ;;\n\n    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)\n      no_undefined_flag='${wl}-z,text'\n      archive_cmds_need_lc=no\n      hardcode_shlibpath_var=no\n      runpath_var='LD_RUN_PATH'\n\n      if test \"$GCC\" = yes; then\n\tarchive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\tarchive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n      else\n\tarchive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\tarchive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n      fi\n      ;;\n\n    sysv5* | sco3.2v5* | sco5v6*)\n      # Note: We can NOT use -z defs as we might desire, because we do not\n      # link with -lc, and that would cause any symbols used from libc to\n      # always be unresolved, which means just about no library would\n      # ever link correctly.  If we're not using GNU ld we use -z text\n      # though, which does catch some bad symbols but isn't as heavy-handed\n      # as -z defs.\n      no_undefined_flag='${wl}-z,text'\n      allow_undefined_flag='${wl}-z,nodefs'\n      archive_cmds_need_lc=no\n      hardcode_shlibpath_var=no\n      hardcode_libdir_flag_spec='${wl}-R,$libdir'\n      hardcode_libdir_separator=':'\n      link_all_deplibs=yes\n      export_dynamic_flag_spec='${wl}-Bexport'\n      runpath_var='LD_RUN_PATH'\n\n      if test \"$GCC\" = yes; then\n\tarchive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\tarchive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n      else\n\tarchive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\tarchive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n      fi\n      ;;\n\n    uts4*)\n      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'\n      hardcode_libdir_flag_spec='-L$libdir'\n      hardcode_shlibpath_var=no\n      ;;\n\n    *)\n      ld_shlibs=no\n      ;;\n    esac\n\n    if test x$host_vendor = xsni; then\n      case $host in\n      sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)\n\texport_dynamic_flag_spec='${wl}-Blargedynsym'\n\t;;\n      esac\n    fi\n  fi\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ld_shlibs\" >&5\n$as_echo \"$ld_shlibs\" >&6; }\ntest \"$ld_shlibs\" = no && can_build_shared=no\n\nwith_gnu_ld=$with_gnu_ld\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n#\n# Do we need to explicitly link libc?\n#\ncase \"x$archive_cmds_need_lc\" in\nx|xyes)\n  # Assume -lc should be added\n  archive_cmds_need_lc=yes\n\n  if test \"$enable_shared\" = yes && test \"$GCC\" = yes; then\n    case $archive_cmds in\n    *'~'*)\n      # FIXME: we may have to deal with multi-command sequences.\n      ;;\n    '$CC '*)\n      # Test whether the compiler implicitly links with -lc since on some\n      # systems, -lgcc has to come before -lc. If gcc already passes -lc\n      # to ld, don't add -lc before -lgcc.\n      { $as_echo \"$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in\" >&5\n$as_echo_n \"checking whether -lc should be explicitly linked in... \" >&6; }\n      $RM conftest*\n      echo \"$lt_simple_compile_test_code\" > conftest.$ac_ext\n\n      if { { eval echo \"\\\"\\$as_me\\\":${as_lineno-$LINENO}: \\\"$ac_compile\\\"\"; } >&5\n  (eval $ac_compile) 2>&5\n  ac_status=$?\n  $as_echo \"$as_me:${as_lineno-$LINENO}: \\$? = $ac_status\" >&5\n  test $ac_status = 0; } 2>conftest.err; then\n        soname=conftest\n        lib=conftest\n        libobjs=conftest.$ac_objext\n        deplibs=\n        wl=$lt_prog_compiler_wl\n\tpic_flag=$lt_prog_compiler_pic\n        compiler_flags=-v\n        linker_flags=-v\n        verstring=\n        output_objdir=.\n        libname=conftest\n        lt_save_allow_undefined_flag=$allow_undefined_flag\n        allow_undefined_flag=\n        if { { eval echo \"\\\"\\$as_me\\\":${as_lineno-$LINENO}: \\\"$archive_cmds 2\\>\\&1 \\| $GREP \\\" -lc \\\" \\>/dev/null 2\\>\\&1\\\"\"; } >&5\n  (eval $archive_cmds 2\\>\\&1 \\| $GREP \\\" -lc \\\" \\>/dev/null 2\\>\\&1) 2>&5\n  ac_status=$?\n  $as_echo \"$as_me:${as_lineno-$LINENO}: \\$? = $ac_status\" >&5\n  test $ac_status = 0; }\n        then\n\t  archive_cmds_need_lc=no\n        else\n\t  archive_cmds_need_lc=yes\n        fi\n        allow_undefined_flag=$lt_save_allow_undefined_flag\n      else\n        cat conftest.err 1>&5\n      fi\n      $RM conftest*\n      { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $archive_cmds_need_lc\" >&5\n$as_echo \"$archive_cmds_need_lc\" >&6; }\n      ;;\n    esac\n  fi\n  ;;\nesac\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics\" >&5\n$as_echo_n \"checking dynamic linker characteristics... \" >&6; }\n\nif test \"$GCC\" = yes; then\n  case $host_os in\n    darwin*) lt_awk_arg=\"/^libraries:/,/LR/\" ;;\n    *) lt_awk_arg=\"/^libraries:/\" ;;\n  esac\n  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e \"s/^libraries://\" -e \"s,=/,/,g\"`\n  if $ECHO \"$lt_search_path_spec\" | $GREP ';' >/dev/null ; then\n    # if the path contains \";\" then we assume it to be the separator\n    # otherwise default to the standard path separator (i.e. \":\") - it is\n    # assumed that no part of a normal pathname contains \";\" but that should\n    # okay in the real world where \";\" in dirpaths is itself problematic.\n    lt_search_path_spec=`$ECHO \"$lt_search_path_spec\" | $SED -e 's/;/ /g'`\n  else\n    lt_search_path_spec=`$ECHO \"$lt_search_path_spec\" | $SED  -e \"s/$PATH_SEPARATOR/ /g\"`\n  fi\n  # Ok, now we have the path, separated by spaces, we can step through it\n  # and add multilib dir if necessary.\n  lt_tmp_lt_search_path_spec=\n  lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`\n  for lt_sys_path in $lt_search_path_spec; do\n    if test -d \"$lt_sys_path/$lt_multi_os_dir\"; then\n      lt_tmp_lt_search_path_spec=\"$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir\"\n    else\n      test -d \"$lt_sys_path\" && \\\n\tlt_tmp_lt_search_path_spec=\"$lt_tmp_lt_search_path_spec $lt_sys_path\"\n    fi\n  done\n  lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk '\nBEGIN {RS=\" \"; FS=\"/|\\n\";} {\n  lt_foo=\"\";\n  lt_count=0;\n  for (lt_i = NF; lt_i > 0; lt_i--) {\n    if ($lt_i != \"\" && $lt_i != \".\") {\n      if ($lt_i == \"..\") {\n        lt_count++;\n      } else {\n        if (lt_count == 0) {\n          lt_foo=\"/\" $lt_i lt_foo;\n        } else {\n          lt_count--;\n        }\n      }\n    }\n  }\n  if (lt_foo != \"\") { lt_freq[lt_foo]++; }\n  if (lt_freq[lt_foo] == 1) { print lt_foo; }\n}'`\n  sys_lib_search_path_spec=`$ECHO $lt_search_path_spec`\nelse\n  sys_lib_search_path_spec=\"/lib /usr/lib /usr/local/lib\"\nfi\nlibrary_names_spec=\nlibname_spec='lib$name'\nsoname_spec=\nshrext_cmds=\".so\"\npostinstall_cmds=\npostuninstall_cmds=\nfinish_cmds=\nfinish_eval=\nshlibpath_var=\nshlibpath_overrides_runpath=unknown\nversion_type=none\ndynamic_linker=\"$host_os ld.so\"\nsys_lib_dlsearch_path_spec=\"/lib /usr/lib\"\nneed_lib_prefix=unknown\nhardcode_into_libs=no\n\n# when you set need_version to no, make sure it does not cause -set_version\n# flags to be left without arguments\nneed_version=unknown\n\ncase $host_os in\naix3*)\n  version_type=linux\n  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'\n  shlibpath_var=LIBPATH\n\n  # AIX 3 has no versioning support, so we append a major version to the name.\n  soname_spec='${libname}${release}${shared_ext}$major'\n  ;;\n\naix[4-9]*)\n  version_type=linux\n  need_lib_prefix=no\n  need_version=no\n  hardcode_into_libs=yes\n  if test \"$host_cpu\" = ia64; then\n    # AIX 5 supports IA64\n    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'\n    shlibpath_var=LD_LIBRARY_PATH\n  else\n    # With GCC up to 2.95.x, collect2 would create an import file\n    # for dependence libraries.  The import file would start with\n    # the line `#! .'.  This would cause the generated library to\n    # depend on `.', always an invalid library.  This was fixed in\n    # development snapshots of GCC prior to 3.0.\n    case $host_os in\n      aix4 | aix4.[01] | aix4.[01].*)\n      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'\n\t   echo ' yes '\n\t   echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then\n\t:\n      else\n\tcan_build_shared=no\n      fi\n      ;;\n    esac\n    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct\n    # soname into executable. Probably we can add versioning support to\n    # collect2, so additional links can be useful in future.\n    if test \"$aix_use_runtimelinking\" = yes; then\n      # If using run time linking (on AIX 4.2 or later) use lib<name>.so\n      # instead of lib<name>.a to let people know that these are not\n      # typical AIX shared libraries.\n      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n    else\n      # We preserve .a as extension for shared libraries through AIX4.2\n      # and later when we are not doing run time linking.\n      library_names_spec='${libname}${release}.a $libname.a'\n      soname_spec='${libname}${release}${shared_ext}$major'\n    fi\n    shlibpath_var=LIBPATH\n  fi\n  ;;\n\namigaos*)\n  case $host_cpu in\n  powerpc)\n    # Since July 2007 AmigaOS4 officially supports .so libraries.\n    # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.\n    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n    ;;\n  m68k)\n    library_names_spec='$libname.ixlibrary $libname.a'\n    # Create ${libname}_ixlibrary.a entries in /sys/libs.\n    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO \"X$lib\" | $Xsed -e '\\''s%^.*/\\([^/]*\\)\\.ixlibrary$%\\1%'\\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show \"cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a\"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'\n    ;;\n  esac\n  ;;\n\nbeos*)\n  library_names_spec='${libname}${shared_ext}'\n  dynamic_linker=\"$host_os ld.so\"\n  shlibpath_var=LIBRARY_PATH\n  ;;\n\nbsdi[45]*)\n  version_type=linux\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  finish_cmds='PATH=\"\\$PATH:/sbin\" ldconfig $libdir'\n  shlibpath_var=LD_LIBRARY_PATH\n  sys_lib_search_path_spec=\"/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib\"\n  sys_lib_dlsearch_path_spec=\"/shlib /usr/lib /usr/local/lib\"\n  # the default ld.so.conf also contains /usr/contrib/lib and\n  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow\n  # libtool to hard-code these into programs\n  ;;\n\ncygwin* | mingw* | pw32* | cegcc*)\n  version_type=windows\n  shrext_cmds=\".dll\"\n  need_version=no\n  need_lib_prefix=no\n\n  case $GCC,$host_os in\n  yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)\n    library_names_spec='$libname.dll.a'\n    # DLL is installed to $(libdir)/../bin by postinstall_cmds\n    postinstall_cmds='base_file=`basename \\${file}`~\n      dlpath=`$SHELL 2>&1 -c '\\''. $dir/'\\''\\${base_file}'\\''i; echo \\$dlname'\\''`~\n      dldir=$destdir/`dirname \\$dlpath`~\n      test -d \\$dldir || mkdir -p \\$dldir~\n      $install_prog $dir/$dlname \\$dldir/$dlname~\n      chmod a+x \\$dldir/$dlname~\n      if test -n '\\''$stripme'\\'' && test -n '\\''$striplib'\\''; then\n        eval '\\''$striplib \\$dldir/$dlname'\\'' || exit \\$?;\n      fi'\n    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\\''. $file; echo \\$dlname'\\''`~\n      dlpath=$dir/\\$dldll~\n       $RM \\$dlpath'\n    shlibpath_overrides_runpath=yes\n\n    case $host_os in\n    cygwin*)\n      # Cygwin DLLs use 'cyg' prefix rather than 'lib'\n      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'\n      sys_lib_search_path_spec=\"/usr/lib /lib/w32api /lib /usr/local/lib\"\n      ;;\n    mingw* | cegcc*)\n      # MinGW DLLs use traditional 'lib' prefix\n      soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'\n      sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP \"^libraries:\" | $SED -e \"s/^libraries://\" -e \"s,=/,/,g\"`\n      if $ECHO \"$sys_lib_search_path_spec\" | $GREP ';[c-zC-Z]:/' >/dev/null; then\n        # It is most probably a Windows format PATH printed by\n        # mingw gcc, but we are running on Cygwin. Gcc prints its search\n        # path with ; separators, and with drive letters. We can handle the\n        # drive letters (cygwin fileutils understands them), so leave them,\n        # especially as we might pass files found there to a mingw objdump,\n        # which wouldn't understand a cygwinified path. Ahh.\n        sys_lib_search_path_spec=`$ECHO \"$sys_lib_search_path_spec\" | $SED -e 's/;/ /g'`\n      else\n        sys_lib_search_path_spec=`$ECHO \"$sys_lib_search_path_spec\" | $SED  -e \"s/$PATH_SEPARATOR/ /g\"`\n      fi\n      ;;\n    pw32*)\n      # pw32 DLLs use 'pw' prefix rather than 'lib'\n      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'\n      ;;\n    esac\n    ;;\n\n  *)\n    library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'\n    ;;\n  esac\n  dynamic_linker='Win32 ld.exe'\n  # FIXME: first we should search . and the directory the executable is in\n  shlibpath_var=PATH\n  ;;\n\ndarwin* | rhapsody*)\n  dynamic_linker=\"$host_os dyld\"\n  version_type=darwin\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'\n  soname_spec='${libname}${release}${major}$shared_ext'\n  shlibpath_overrides_runpath=yes\n  shlibpath_var=DYLD_LIBRARY_PATH\n  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'\n\n  sys_lib_search_path_spec=\"$sys_lib_search_path_spec /usr/local/lib\"\n  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'\n  ;;\n\ndgux*)\n  version_type=linux\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LD_LIBRARY_PATH\n  ;;\n\nfreebsd1*)\n  dynamic_linker=no\n  ;;\n\nfreebsd* | dragonfly*)\n  # DragonFly does not have aout.  When/if they implement a new\n  # versioning mechanism, adjust this.\n  if test -x /usr/bin/objformat; then\n    objformat=`/usr/bin/objformat`\n  else\n    case $host_os in\n    freebsd[123]*) objformat=aout ;;\n    *) objformat=elf ;;\n    esac\n  fi\n  version_type=freebsd-$objformat\n  case $version_type in\n    freebsd-elf*)\n      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'\n      need_version=no\n      need_lib_prefix=no\n      ;;\n    freebsd-*)\n      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'\n      need_version=yes\n      ;;\n  esac\n  shlibpath_var=LD_LIBRARY_PATH\n  case $host_os in\n  freebsd2*)\n    shlibpath_overrides_runpath=yes\n    ;;\n  freebsd3.[01]* | freebsdelf3.[01]*)\n    shlibpath_overrides_runpath=yes\n    hardcode_into_libs=yes\n    ;;\n  freebsd3.[2-9]* | freebsdelf3.[2-9]* | \\\n  freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)\n    shlibpath_overrides_runpath=no\n    hardcode_into_libs=yes\n    ;;\n  *) # from 4.6 on, and DragonFly\n    shlibpath_overrides_runpath=yes\n    hardcode_into_libs=yes\n    ;;\n  esac\n  ;;\n\ngnu*)\n  version_type=linux\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LD_LIBRARY_PATH\n  hardcode_into_libs=yes\n  ;;\n\nhpux9* | hpux10* | hpux11*)\n  # Give a soname corresponding to the major version so that dld.sl refuses to\n  # link against other versions.\n  version_type=sunos\n  need_lib_prefix=no\n  need_version=no\n  case $host_cpu in\n  ia64*)\n    shrext_cmds='.so'\n    hardcode_into_libs=yes\n    dynamic_linker=\"$host_os dld.so\"\n    shlibpath_var=LD_LIBRARY_PATH\n    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.\n    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n    soname_spec='${libname}${release}${shared_ext}$major'\n    if test \"X$HPUX_IA64_MODE\" = X32; then\n      sys_lib_search_path_spec=\"/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib\"\n    else\n      sys_lib_search_path_spec=\"/usr/lib/hpux64 /usr/local/lib/hpux64\"\n    fi\n    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec\n    ;;\n  hppa*64*)\n    shrext_cmds='.sl'\n    hardcode_into_libs=yes\n    dynamic_linker=\"$host_os dld.sl\"\n    shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH\n    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.\n    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n    soname_spec='${libname}${release}${shared_ext}$major'\n    sys_lib_search_path_spec=\"/usr/lib/pa20_64 /usr/ccs/lib/pa20_64\"\n    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec\n    ;;\n  *)\n    shrext_cmds='.sl'\n    dynamic_linker=\"$host_os dld.sl\"\n    shlibpath_var=SHLIB_PATH\n    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH\n    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n    soname_spec='${libname}${release}${shared_ext}$major'\n    ;;\n  esac\n  # HP-UX runs *really* slowly unless shared libraries are mode 555.\n  postinstall_cmds='chmod 555 $lib'\n  ;;\n\ninterix[3-9]*)\n  version_type=linux\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=no\n  hardcode_into_libs=yes\n  ;;\n\nirix5* | irix6* | nonstopux*)\n  case $host_os in\n    nonstopux*) version_type=nonstopux ;;\n    *)\n\tif test \"$lt_cv_prog_gnu_ld\" = yes; then\n\t\tversion_type=linux\n\telse\n\t\tversion_type=irix\n\tfi ;;\n  esac\n  need_lib_prefix=no\n  need_version=no\n  soname_spec='${libname}${release}${shared_ext}$major'\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'\n  case $host_os in\n  irix5* | nonstopux*)\n    libsuff= shlibsuff=\n    ;;\n  *)\n    case $LD in # libtool.m4 will add one of these switches to LD\n    *-32|*\"-32 \"|*-melf32bsmip|*\"-melf32bsmip \")\n      libsuff= shlibsuff= libmagic=32-bit;;\n    *-n32|*\"-n32 \"|*-melf32bmipn32|*\"-melf32bmipn32 \")\n      libsuff=32 shlibsuff=N32 libmagic=N32;;\n    *-64|*\"-64 \"|*-melf64bmip|*\"-melf64bmip \")\n      libsuff=64 shlibsuff=64 libmagic=64-bit;;\n    *) libsuff= shlibsuff= libmagic=never-match;;\n    esac\n    ;;\n  esac\n  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH\n  shlibpath_overrides_runpath=no\n  sys_lib_search_path_spec=\"/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}\"\n  sys_lib_dlsearch_path_spec=\"/usr/lib${libsuff} /lib${libsuff}\"\n  hardcode_into_libs=yes\n  ;;\n\n# No shared lib support for Linux oldld, aout, or coff.\nlinux*oldld* | linux*aout* | linux*coff*)\n  dynamic_linker=no\n  ;;\n\n# This must be Linux ELF.\nlinux* | k*bsd*-gnu)\n  version_type=linux\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  finish_cmds='PATH=\"\\$PATH:/sbin\" ldconfig -n $libdir'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=no\n  # Some binutils ld are patched to set DT_RUNPATH\n  save_LDFLAGS=$LDFLAGS\n  save_libdir=$libdir\n  eval \"libdir=/foo; wl=\\\"$lt_prog_compiler_wl\\\"; \\\n       LDFLAGS=\\\"\\$LDFLAGS $hardcode_libdir_flag_spec\\\"\"\n  cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\nint\nmain ()\n{\n\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_link \"$LINENO\"; then :\n  if  ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep \"RUNPATH.*$libdir\" >/dev/null; then :\n  shlibpath_overrides_runpath=yes\nfi\nfi\nrm -f core conftest.err conftest.$ac_objext \\\n    conftest$ac_exeext conftest.$ac_ext\n  LDFLAGS=$save_LDFLAGS\n  libdir=$save_libdir\n\n  # This implies no fast_install, which is unacceptable.\n  # Some rework will be needed to allow for fast_install\n  # before this can be enabled.\n  hardcode_into_libs=yes\n\n  # Append ld.so.conf contents to the search path\n  if test -f /etc/ld.so.conf; then\n    lt_ld_extra=`awk '/^include / { system(sprintf(\"cd /etc; cat %s 2>/dev/null\", \\$2)); skip = 1; } { if (!skip) print \\$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[\t ]*hwcap[\t ]/d;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\\n' ' '`\n    sys_lib_dlsearch_path_spec=\"/lib /usr/lib $lt_ld_extra\"\n  fi\n\n  # We used to test for /lib/ld.so.1 and disable shared libraries on\n  # powerpc, because MkLinux only supported shared libraries with the\n  # GNU dynamic linker.  Since this was broken with cross compilers,\n  # most powerpc-linux boxes support dynamic linking these days and\n  # people can always --disable-shared, the test was removed, and we\n  # assume the GNU/Linux dynamic linker is in use.\n  dynamic_linker='GNU/Linux ld.so'\n  ;;\n\nnetbsd*)\n  version_type=sunos\n  need_lib_prefix=no\n  need_version=no\n  if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then\n    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'\n    finish_cmds='PATH=\"\\$PATH:/sbin\" ldconfig -m $libdir'\n    dynamic_linker='NetBSD (a.out) ld.so'\n  else\n    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'\n    soname_spec='${libname}${release}${shared_ext}$major'\n    dynamic_linker='NetBSD ld.elf_so'\n  fi\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=yes\n  hardcode_into_libs=yes\n  ;;\n\nnewsos6)\n  version_type=linux\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=yes\n  ;;\n\n*nto* | *qnx*)\n  version_type=qnx\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=no\n  hardcode_into_libs=yes\n  dynamic_linker='ldqnx.so'\n  ;;\n\nopenbsd*)\n  version_type=sunos\n  sys_lib_dlsearch_path_spec=\"/usr/lib\"\n  need_lib_prefix=no\n  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.\n  case $host_os in\n    openbsd3.3 | openbsd3.3.*)\tneed_version=yes ;;\n    *)\t\t\t\tneed_version=no  ;;\n  esac\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'\n  finish_cmds='PATH=\"\\$PATH:/sbin\" ldconfig -m $libdir'\n  shlibpath_var=LD_LIBRARY_PATH\n  if test -z \"`echo __ELF__ | $CC -E - | $GREP __ELF__`\" || test \"$host_os-$host_cpu\" = \"openbsd2.8-powerpc\"; then\n    case $host_os in\n      openbsd2.[89] | openbsd2.[89].*)\n\tshlibpath_overrides_runpath=no\n\t;;\n      *)\n\tshlibpath_overrides_runpath=yes\n\t;;\n      esac\n  else\n    shlibpath_overrides_runpath=yes\n  fi\n  ;;\n\nos2*)\n  libname_spec='$name'\n  shrext_cmds=\".dll\"\n  need_lib_prefix=no\n  library_names_spec='$libname${shared_ext} $libname.a'\n  dynamic_linker='OS/2 ld.exe'\n  shlibpath_var=LIBPATH\n  ;;\n\nosf3* | osf4* | osf5*)\n  version_type=osf\n  need_lib_prefix=no\n  need_version=no\n  soname_spec='${libname}${release}${shared_ext}$major'\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  shlibpath_var=LD_LIBRARY_PATH\n  sys_lib_search_path_spec=\"/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib\"\n  sys_lib_dlsearch_path_spec=\"$sys_lib_search_path_spec\"\n  ;;\n\nrdos*)\n  dynamic_linker=no\n  ;;\n\nsolaris*)\n  version_type=linux\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=yes\n  hardcode_into_libs=yes\n  # ldd complains unless libraries are executable\n  postinstall_cmds='chmod +x $lib'\n  ;;\n\nsunos4*)\n  version_type=sunos\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'\n  finish_cmds='PATH=\"\\$PATH:/usr/etc\" ldconfig $libdir'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=yes\n  if test \"$with_gnu_ld\" = yes; then\n    need_lib_prefix=no\n  fi\n  need_version=yes\n  ;;\n\nsysv4 | sysv4.3*)\n  version_type=linux\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LD_LIBRARY_PATH\n  case $host_vendor in\n    sni)\n      shlibpath_overrides_runpath=no\n      need_lib_prefix=no\n      runpath_var=LD_RUN_PATH\n      ;;\n    siemens)\n      need_lib_prefix=no\n      ;;\n    motorola)\n      need_lib_prefix=no\n      need_version=no\n      shlibpath_overrides_runpath=no\n      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'\n      ;;\n  esac\n  ;;\n\nsysv4*MP*)\n  if test -d /usr/nec ;then\n    version_type=linux\n    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'\n    soname_spec='$libname${shared_ext}.$major'\n    shlibpath_var=LD_LIBRARY_PATH\n  fi\n  ;;\n\nsysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)\n  version_type=freebsd-elf\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=yes\n  hardcode_into_libs=yes\n  if test \"$with_gnu_ld\" = yes; then\n    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'\n  else\n    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'\n    case $host_os in\n      sco3.2v5*)\n        sys_lib_search_path_spec=\"$sys_lib_search_path_spec /lib\"\n\t;;\n    esac\n  fi\n  sys_lib_dlsearch_path_spec='/usr/lib'\n  ;;\n\ntpf*)\n  # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.\n  version_type=linux\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=no\n  hardcode_into_libs=yes\n  ;;\n\nuts4*)\n  version_type=linux\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LD_LIBRARY_PATH\n  ;;\n\n*)\n  dynamic_linker=no\n  ;;\nesac\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $dynamic_linker\" >&5\n$as_echo \"$dynamic_linker\" >&6; }\ntest \"$dynamic_linker\" = no && can_build_shared=no\n\nvariables_saved_for_relink=\"PATH $shlibpath_var $runpath_var\"\nif test \"$GCC\" = yes; then\n  variables_saved_for_relink=\"$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH\"\nfi\n\nif test \"${lt_cv_sys_lib_search_path_spec+set}\" = set; then\n  sys_lib_search_path_spec=\"$lt_cv_sys_lib_search_path_spec\"\nfi\nif test \"${lt_cv_sys_lib_dlsearch_path_spec+set}\" = set; then\n  sys_lib_dlsearch_path_spec=\"$lt_cv_sys_lib_dlsearch_path_spec\"\nfi\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs\" >&5\n$as_echo_n \"checking how to hardcode library paths into programs... \" >&6; }\nhardcode_action=\nif test -n \"$hardcode_libdir_flag_spec\" ||\n   test -n \"$runpath_var\" ||\n   test \"X$hardcode_automatic\" = \"Xyes\" ; then\n\n  # We can hardcode non-existent directories.\n  if test \"$hardcode_direct\" != no &&\n     # If the only mechanism to avoid hardcoding is shlibpath_var, we\n     # have to relink, otherwise we might link with an installed library\n     # when we should be linking with a yet-to-be-installed one\n     ## test \"$_LT_TAGVAR(hardcode_shlibpath_var, )\" != no &&\n     test \"$hardcode_minus_L\" != no; then\n    # Linking always hardcodes the temporary library directory.\n    hardcode_action=relink\n  else\n    # We can link without hardcoding, and we can hardcode nonexisting dirs.\n    hardcode_action=immediate\n  fi\nelse\n  # We cannot hardcode anything, or else we can only hardcode existing\n  # directories.\n  hardcode_action=unsupported\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $hardcode_action\" >&5\n$as_echo \"$hardcode_action\" >&6; }\n\nif test \"$hardcode_action\" = relink ||\n   test \"$inherit_rpath\" = yes; then\n  # Fast installation is not supported\n  enable_fast_install=no\nelif test \"$shlibpath_overrides_runpath\" = yes ||\n     test \"$enable_shared\" = no; then\n  # Fast installation is not necessary\n  enable_fast_install=needless\nfi\n\n\n\n\n\n\n  if test \"x$enable_dlopen\" != xyes; then\n  enable_dlopen=unknown\n  enable_dlopen_self=unknown\n  enable_dlopen_self_static=unknown\nelse\n  lt_cv_dlopen=no\n  lt_cv_dlopen_libs=\n\n  case $host_os in\n  beos*)\n    lt_cv_dlopen=\"load_add_on\"\n    lt_cv_dlopen_libs=\n    lt_cv_dlopen_self=yes\n    ;;\n\n  mingw* | pw32* | cegcc*)\n    lt_cv_dlopen=\"LoadLibrary\"\n    lt_cv_dlopen_libs=\n    ;;\n\n  cygwin*)\n    lt_cv_dlopen=\"dlopen\"\n    lt_cv_dlopen_libs=\n    ;;\n\n  darwin*)\n  # if libdl is installed we need to link against it\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl\" >&5\n$as_echo_n \"checking for dlopen in -ldl... \" >&6; }\nif test \"${ac_cv_lib_dl_dlopen+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  ac_check_lib_save_LIBS=$LIBS\nLIBS=\"-ldl  $LIBS\"\ncat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\n/* Override any GCC internal prototype to avoid an error.\n   Use char because int might match the return type of a GCC\n   builtin and then its argument prototype would still apply.  */\n#ifdef __cplusplus\nextern \"C\"\n#endif\nchar dlopen ();\nint\nmain ()\n{\nreturn dlopen ();\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_link \"$LINENO\"; then :\n  ac_cv_lib_dl_dlopen=yes\nelse\n  ac_cv_lib_dl_dlopen=no\nfi\nrm -f core conftest.err conftest.$ac_objext \\\n    conftest$ac_exeext conftest.$ac_ext\nLIBS=$ac_check_lib_save_LIBS\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen\" >&5\n$as_echo \"$ac_cv_lib_dl_dlopen\" >&6; }\nif test \"x$ac_cv_lib_dl_dlopen\" = x\"\"yes; then :\n  lt_cv_dlopen=\"dlopen\" lt_cv_dlopen_libs=\"-ldl\"\nelse\n\n    lt_cv_dlopen=\"dyld\"\n    lt_cv_dlopen_libs=\n    lt_cv_dlopen_self=yes\n\nfi\n\n    ;;\n\n  *)\n    ac_fn_c_check_func \"$LINENO\" \"shl_load\" \"ac_cv_func_shl_load\"\nif test \"x$ac_cv_func_shl_load\" = x\"\"yes; then :\n  lt_cv_dlopen=\"shl_load\"\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld\" >&5\n$as_echo_n \"checking for shl_load in -ldld... \" >&6; }\nif test \"${ac_cv_lib_dld_shl_load+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  ac_check_lib_save_LIBS=$LIBS\nLIBS=\"-ldld  $LIBS\"\ncat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\n/* Override any GCC internal prototype to avoid an error.\n   Use char because int might match the return type of a GCC\n   builtin and then its argument prototype would still apply.  */\n#ifdef __cplusplus\nextern \"C\"\n#endif\nchar shl_load ();\nint\nmain ()\n{\nreturn shl_load ();\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_link \"$LINENO\"; then :\n  ac_cv_lib_dld_shl_load=yes\nelse\n  ac_cv_lib_dld_shl_load=no\nfi\nrm -f core conftest.err conftest.$ac_objext \\\n    conftest$ac_exeext conftest.$ac_ext\nLIBS=$ac_check_lib_save_LIBS\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load\" >&5\n$as_echo \"$ac_cv_lib_dld_shl_load\" >&6; }\nif test \"x$ac_cv_lib_dld_shl_load\" = x\"\"yes; then :\n  lt_cv_dlopen=\"shl_load\" lt_cv_dlopen_libs=\"-ldld\"\nelse\n  ac_fn_c_check_func \"$LINENO\" \"dlopen\" \"ac_cv_func_dlopen\"\nif test \"x$ac_cv_func_dlopen\" = x\"\"yes; then :\n  lt_cv_dlopen=\"dlopen\"\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl\" >&5\n$as_echo_n \"checking for dlopen in -ldl... \" >&6; }\nif test \"${ac_cv_lib_dl_dlopen+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  ac_check_lib_save_LIBS=$LIBS\nLIBS=\"-ldl  $LIBS\"\ncat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\n/* Override any GCC internal prototype to avoid an error.\n   Use char because int might match the return type of a GCC\n   builtin and then its argument prototype would still apply.  */\n#ifdef __cplusplus\nextern \"C\"\n#endif\nchar dlopen ();\nint\nmain ()\n{\nreturn dlopen ();\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_link \"$LINENO\"; then :\n  ac_cv_lib_dl_dlopen=yes\nelse\n  ac_cv_lib_dl_dlopen=no\nfi\nrm -f core conftest.err conftest.$ac_objext \\\n    conftest$ac_exeext conftest.$ac_ext\nLIBS=$ac_check_lib_save_LIBS\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen\" >&5\n$as_echo \"$ac_cv_lib_dl_dlopen\" >&6; }\nif test \"x$ac_cv_lib_dl_dlopen\" = x\"\"yes; then :\n  lt_cv_dlopen=\"dlopen\" lt_cv_dlopen_libs=\"-ldl\"\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld\" >&5\n$as_echo_n \"checking for dlopen in -lsvld... \" >&6; }\nif test \"${ac_cv_lib_svld_dlopen+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  ac_check_lib_save_LIBS=$LIBS\nLIBS=\"-lsvld  $LIBS\"\ncat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\n/* Override any GCC internal prototype to avoid an error.\n   Use char because int might match the return type of a GCC\n   builtin and then its argument prototype would still apply.  */\n#ifdef __cplusplus\nextern \"C\"\n#endif\nchar dlopen ();\nint\nmain ()\n{\nreturn dlopen ();\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_link \"$LINENO\"; then :\n  ac_cv_lib_svld_dlopen=yes\nelse\n  ac_cv_lib_svld_dlopen=no\nfi\nrm -f core conftest.err conftest.$ac_objext \\\n    conftest$ac_exeext conftest.$ac_ext\nLIBS=$ac_check_lib_save_LIBS\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen\" >&5\n$as_echo \"$ac_cv_lib_svld_dlopen\" >&6; }\nif test \"x$ac_cv_lib_svld_dlopen\" = x\"\"yes; then :\n  lt_cv_dlopen=\"dlopen\" lt_cv_dlopen_libs=\"-lsvld\"\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld\" >&5\n$as_echo_n \"checking for dld_link in -ldld... \" >&6; }\nif test \"${ac_cv_lib_dld_dld_link+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  ac_check_lib_save_LIBS=$LIBS\nLIBS=\"-ldld  $LIBS\"\ncat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\n/* Override any GCC internal prototype to avoid an error.\n   Use char because int might match the return type of a GCC\n   builtin and then its argument prototype would still apply.  */\n#ifdef __cplusplus\nextern \"C\"\n#endif\nchar dld_link ();\nint\nmain ()\n{\nreturn dld_link ();\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_link \"$LINENO\"; then :\n  ac_cv_lib_dld_dld_link=yes\nelse\n  ac_cv_lib_dld_dld_link=no\nfi\nrm -f core conftest.err conftest.$ac_objext \\\n    conftest$ac_exeext conftest.$ac_ext\nLIBS=$ac_check_lib_save_LIBS\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link\" >&5\n$as_echo \"$ac_cv_lib_dld_dld_link\" >&6; }\nif test \"x$ac_cv_lib_dld_dld_link\" = x\"\"yes; then :\n  lt_cv_dlopen=\"dld_link\" lt_cv_dlopen_libs=\"-ldld\"\nfi\n\n\nfi\n\n\nfi\n\n\nfi\n\n\nfi\n\n\nfi\n\n    ;;\n  esac\n\n  if test \"x$lt_cv_dlopen\" != xno; then\n    enable_dlopen=yes\n  else\n    enable_dlopen=no\n  fi\n\n  case $lt_cv_dlopen in\n  dlopen)\n    save_CPPFLAGS=\"$CPPFLAGS\"\n    test \"x$ac_cv_header_dlfcn_h\" = xyes && CPPFLAGS=\"$CPPFLAGS -DHAVE_DLFCN_H\"\n\n    save_LDFLAGS=\"$LDFLAGS\"\n    wl=$lt_prog_compiler_wl eval LDFLAGS=\\\"\\$LDFLAGS $export_dynamic_flag_spec\\\"\n\n    save_LIBS=\"$LIBS\"\n    LIBS=\"$lt_cv_dlopen_libs $LIBS\"\n\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself\" >&5\n$as_echo_n \"checking whether a program can dlopen itself... \" >&6; }\nif test \"${lt_cv_dlopen_self+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  \t  if test \"$cross_compiling\" = yes; then :\n  lt_cv_dlopen_self=cross\nelse\n  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2\n  lt_status=$lt_dlunknown\n  cat > conftest.$ac_ext <<_LT_EOF\n#line 11662 \"configure\"\n#include \"confdefs.h\"\n\n#if HAVE_DLFCN_H\n#include <dlfcn.h>\n#endif\n\n#include <stdio.h>\n\n#ifdef RTLD_GLOBAL\n#  define LT_DLGLOBAL\t\tRTLD_GLOBAL\n#else\n#  ifdef DL_GLOBAL\n#    define LT_DLGLOBAL\t\tDL_GLOBAL\n#  else\n#    define LT_DLGLOBAL\t\t0\n#  endif\n#endif\n\n/* We may have to define LT_DLLAZY_OR_NOW in the command line if we\n   find out it does not work in some platform. */\n#ifndef LT_DLLAZY_OR_NOW\n#  ifdef RTLD_LAZY\n#    define LT_DLLAZY_OR_NOW\t\tRTLD_LAZY\n#  else\n#    ifdef DL_LAZY\n#      define LT_DLLAZY_OR_NOW\t\tDL_LAZY\n#    else\n#      ifdef RTLD_NOW\n#        define LT_DLLAZY_OR_NOW\tRTLD_NOW\n#      else\n#        ifdef DL_NOW\n#          define LT_DLLAZY_OR_NOW\tDL_NOW\n#        else\n#          define LT_DLLAZY_OR_NOW\t0\n#        endif\n#      endif\n#    endif\n#  endif\n#endif\n\nvoid fnord() { int i=42;}\nint main ()\n{\n  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);\n  int status = $lt_dlunknown;\n\n  if (self)\n    {\n      if (dlsym (self,\"fnord\"))       status = $lt_dlno_uscore;\n      else if (dlsym( self,\"_fnord\")) status = $lt_dlneed_uscore;\n      /* dlclose (self); */\n    }\n  else\n    puts (dlerror ());\n\n  return status;\n}\n_LT_EOF\n  if { { eval echo \"\\\"\\$as_me\\\":${as_lineno-$LINENO}: \\\"$ac_link\\\"\"; } >&5\n  (eval $ac_link) 2>&5\n  ac_status=$?\n  $as_echo \"$as_me:${as_lineno-$LINENO}: \\$? = $ac_status\" >&5\n  test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then\n    (./conftest; exit; ) >&5 2>/dev/null\n    lt_status=$?\n    case x$lt_status in\n      x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;;\n      x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;;\n      x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;;\n    esac\n  else :\n    # compilation failed\n    lt_cv_dlopen_self=no\n  fi\nfi\nrm -fr conftest*\n\n\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self\" >&5\n$as_echo \"$lt_cv_dlopen_self\" >&6; }\n\n    if test \"x$lt_cv_dlopen_self\" = xyes; then\n      wl=$lt_prog_compiler_wl eval LDFLAGS=\\\"\\$LDFLAGS $lt_prog_compiler_static\\\"\n      { $as_echo \"$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself\" >&5\n$as_echo_n \"checking whether a statically linked program can dlopen itself... \" >&6; }\nif test \"${lt_cv_dlopen_self_static+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  \t  if test \"$cross_compiling\" = yes; then :\n  lt_cv_dlopen_self_static=cross\nelse\n  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2\n  lt_status=$lt_dlunknown\n  cat > conftest.$ac_ext <<_LT_EOF\n#line 11758 \"configure\"\n#include \"confdefs.h\"\n\n#if HAVE_DLFCN_H\n#include <dlfcn.h>\n#endif\n\n#include <stdio.h>\n\n#ifdef RTLD_GLOBAL\n#  define LT_DLGLOBAL\t\tRTLD_GLOBAL\n#else\n#  ifdef DL_GLOBAL\n#    define LT_DLGLOBAL\t\tDL_GLOBAL\n#  else\n#    define LT_DLGLOBAL\t\t0\n#  endif\n#endif\n\n/* We may have to define LT_DLLAZY_OR_NOW in the command line if we\n   find out it does not work in some platform. */\n#ifndef LT_DLLAZY_OR_NOW\n#  ifdef RTLD_LAZY\n#    define LT_DLLAZY_OR_NOW\t\tRTLD_LAZY\n#  else\n#    ifdef DL_LAZY\n#      define LT_DLLAZY_OR_NOW\t\tDL_LAZY\n#    else\n#      ifdef RTLD_NOW\n#        define LT_DLLAZY_OR_NOW\tRTLD_NOW\n#      else\n#        ifdef DL_NOW\n#          define LT_DLLAZY_OR_NOW\tDL_NOW\n#        else\n#          define LT_DLLAZY_OR_NOW\t0\n#        endif\n#      endif\n#    endif\n#  endif\n#endif\n\nvoid fnord() { int i=42;}\nint main ()\n{\n  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);\n  int status = $lt_dlunknown;\n\n  if (self)\n    {\n      if (dlsym (self,\"fnord\"))       status = $lt_dlno_uscore;\n      else if (dlsym( self,\"_fnord\")) status = $lt_dlneed_uscore;\n      /* dlclose (self); */\n    }\n  else\n    puts (dlerror ());\n\n  return status;\n}\n_LT_EOF\n  if { { eval echo \"\\\"\\$as_me\\\":${as_lineno-$LINENO}: \\\"$ac_link\\\"\"; } >&5\n  (eval $ac_link) 2>&5\n  ac_status=$?\n  $as_echo \"$as_me:${as_lineno-$LINENO}: \\$? = $ac_status\" >&5\n  test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then\n    (./conftest; exit; ) >&5 2>/dev/null\n    lt_status=$?\n    case x$lt_status in\n      x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;;\n      x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;;\n      x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;;\n    esac\n  else :\n    # compilation failed\n    lt_cv_dlopen_self_static=no\n  fi\nfi\nrm -fr conftest*\n\n\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static\" >&5\n$as_echo \"$lt_cv_dlopen_self_static\" >&6; }\n    fi\n\n    CPPFLAGS=\"$save_CPPFLAGS\"\n    LDFLAGS=\"$save_LDFLAGS\"\n    LIBS=\"$save_LIBS\"\n    ;;\n  esac\n\n  case $lt_cv_dlopen_self in\n  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;\n  *) enable_dlopen_self=unknown ;;\n  esac\n\n  case $lt_cv_dlopen_self_static in\n  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;\n  *) enable_dlopen_self_static=unknown ;;\n  esac\nfi\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nstriplib=\nold_striplib=\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible\" >&5\n$as_echo_n \"checking whether stripping libraries is possible... \" >&6; }\nif test -n \"$STRIP\" && $STRIP -V 2>&1 | $GREP \"GNU strip\" >/dev/null; then\n  test -z \"$old_striplib\" && old_striplib=\"$STRIP --strip-debug\"\n  test -z \"$striplib\" && striplib=\"$STRIP --strip-unneeded\"\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: yes\" >&5\n$as_echo \"yes\" >&6; }\nelse\n# FIXME - insert some real tests, host_os isn't really good enough\n  case $host_os in\n  darwin*)\n    if test -n \"$STRIP\" ; then\n      striplib=\"$STRIP -x\"\n      old_striplib=\"$STRIP -S\"\n      { $as_echo \"$as_me:${as_lineno-$LINENO}: result: yes\" >&5\n$as_echo \"yes\" >&6; }\n    else\n      { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\n    fi\n    ;;\n  *)\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\n    ;;\n  esac\nfi\n\n\n\n\n\n\n\n\n\n\n\n\n  # Report which library types will actually be built\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries\" >&5\n$as_echo_n \"checking if libtool supports shared libraries... \" >&6; }\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $can_build_shared\" >&5\n$as_echo \"$can_build_shared\" >&6; }\n\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries\" >&5\n$as_echo_n \"checking whether to build shared libraries... \" >&6; }\n  test \"$can_build_shared\" = \"no\" && enable_shared=no\n\n  # On AIX, shared libraries and static libraries use the same namespace, and\n  # are all built from PIC.\n  case $host_os in\n  aix3*)\n    test \"$enable_shared\" = yes && enable_static=no\n    if test -n \"$RANLIB\"; then\n      archive_cmds=\"$archive_cmds~\\$RANLIB \\$lib\"\n      postinstall_cmds='$RANLIB $lib'\n    fi\n    ;;\n\n  aix[4-9]*)\n    if test \"$host_cpu\" != ia64 && test \"$aix_use_runtimelinking\" = no ; then\n      test \"$enable_shared\" = yes && enable_static=no\n    fi\n    ;;\n  esac\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $enable_shared\" >&5\n$as_echo \"$enable_shared\" >&6; }\n\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking whether to build static libraries\" >&5\n$as_echo_n \"checking whether to build static libraries... \" >&6; }\n  # Make sure either enable_shared or enable_static is yes.\n  test \"$enable_shared\" = yes || enable_static=yes\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $enable_static\" >&5\n$as_echo \"$enable_static\" >&6; }\n\n\n\n\nfi\nac_ext=c\nac_cpp='$CPP $CPPFLAGS'\nac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'\nac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'\nac_compiler_gnu=$ac_cv_c_compiler_gnu\n\nCC=\"$lt_save_CC\"\n\n\n\n\n\n\n\n\n\n\n\n\n\n        ac_config_commands=\"$ac_config_commands libtool\"\n\n\n\n\n# Only expand once:\n\n\n\n\nac_ext=cpp\nac_cpp='$CXXCPP $CPPFLAGS'\nac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'\nac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'\nac_compiler_gnu=$ac_cv_cxx_compiler_gnu\nif test -z \"$CXX\"; then\n  if test -n \"$CCC\"; then\n    CXX=$CCC\n  else\n    if test -n \"$ac_tool_prefix\"; then\n  for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC\n  do\n    # Extract the first word of \"$ac_tool_prefix$ac_prog\", so it can be a program name with args.\nset dummy $ac_tool_prefix$ac_prog; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif test \"${ac_cv_prog_CXX+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$CXX\"; then\n  ac_cv_prog_CXX=\"$CXX\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_CXX=\"$ac_tool_prefix$ac_prog\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nCXX=$ac_cv_prog_CXX\nif test -n \"$CXX\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $CXX\" >&5\n$as_echo \"$CXX\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n\n    test -n \"$CXX\" && break\n  done\nfi\nif test -z \"$CXX\"; then\n  ac_ct_CXX=$CXX\n  for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC\ndo\n  # Extract the first word of \"$ac_prog\", so it can be a program name with args.\nset dummy $ac_prog; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif test \"${ac_cv_prog_ac_ct_CXX+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$ac_ct_CXX\"; then\n  ac_cv_prog_ac_ct_CXX=\"$ac_ct_CXX\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_ac_ct_CXX=\"$ac_prog\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\nfi\nfi\nac_ct_CXX=$ac_cv_prog_ac_ct_CXX\nif test -n \"$ac_ct_CXX\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX\" >&5\n$as_echo \"$ac_ct_CXX\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n\n  test -n \"$ac_ct_CXX\" && break\ndone\n\n  if test \"x$ac_ct_CXX\" = x; then\n    CXX=\"g++\"\n  else\n    case $cross_compiling:$ac_tool_warned in\nyes:)\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet\" >&5\n$as_echo \"$as_me: WARNING: using cross tools not prefixed with host triplet\" >&2;}\nac_tool_warned=yes ;;\nesac\n    CXX=$ac_ct_CXX\n  fi\nfi\n\n  fi\nfi\n# Provide some information about the compiler.\n$as_echo \"$as_me:${as_lineno-$LINENO}: checking for C++ compiler version\" >&5\nset X $ac_compile\nac_compiler=$2\nfor ac_option in --version -v -V -qversion; do\n  { { ac_try=\"$ac_compiler $ac_option >&5\"\ncase \"(($ac_try\" in\n  *\\\"* | *\\`* | *\\\\*) ac_try_echo=\\$ac_try;;\n  *) ac_try_echo=$ac_try;;\nesac\neval ac_try_echo=\"\\\"\\$as_me:${as_lineno-$LINENO}: $ac_try_echo\\\"\"\n$as_echo \"$ac_try_echo\"; } >&5\n  (eval \"$ac_compiler $ac_option >&5\") 2>conftest.err\n  ac_status=$?\n  if test -s conftest.err; then\n    sed '10a\\\n... rest of stderr output deleted ...\n         10q' conftest.err >conftest.er1\n    cat conftest.er1 >&5\n    rm -f conftest.er1 conftest.err\n  fi\n  $as_echo \"$as_me:${as_lineno-$LINENO}: \\$? = $ac_status\" >&5\n  test $ac_status = 0; }\ndone\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler\" >&5\n$as_echo_n \"checking whether we are using the GNU C++ compiler... \" >&6; }\nif test \"${ac_cv_cxx_compiler_gnu+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\nint\nmain ()\n{\n#ifndef __GNUC__\n       choke me\n#endif\n\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_cxx_try_compile \"$LINENO\"; then :\n  ac_compiler_gnu=yes\nelse\n  ac_compiler_gnu=no\nfi\nrm -f core conftest.err conftest.$ac_objext conftest.$ac_ext\nac_cv_cxx_compiler_gnu=$ac_compiler_gnu\n\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu\" >&5\n$as_echo \"$ac_cv_cxx_compiler_gnu\" >&6; }\nif test $ac_compiler_gnu = yes; then\n  GXX=yes\nelse\n  GXX=\nfi\nac_test_CXXFLAGS=${CXXFLAGS+set}\nac_save_CXXFLAGS=$CXXFLAGS\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g\" >&5\n$as_echo_n \"checking whether $CXX accepts -g... \" >&6; }\nif test \"${ac_cv_prog_cxx_g+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  ac_save_cxx_werror_flag=$ac_cxx_werror_flag\n   ac_cxx_werror_flag=yes\n   ac_cv_prog_cxx_g=no\n   CXXFLAGS=\"-g\"\n   cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\nint\nmain ()\n{\n\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_cxx_try_compile \"$LINENO\"; then :\n  ac_cv_prog_cxx_g=yes\nelse\n  CXXFLAGS=\"\"\n      cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\nint\nmain ()\n{\n\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_cxx_try_compile \"$LINENO\"; then :\n\nelse\n  ac_cxx_werror_flag=$ac_save_cxx_werror_flag\n\t CXXFLAGS=\"-g\"\n\t cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\nint\nmain ()\n{\n\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_cxx_try_compile \"$LINENO\"; then :\n  ac_cv_prog_cxx_g=yes\nfi\nrm -f core conftest.err conftest.$ac_objext conftest.$ac_ext\nfi\nrm -f core conftest.err conftest.$ac_objext conftest.$ac_ext\nfi\nrm -f core conftest.err conftest.$ac_objext conftest.$ac_ext\n   ac_cxx_werror_flag=$ac_save_cxx_werror_flag\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g\" >&5\n$as_echo \"$ac_cv_prog_cxx_g\" >&6; }\nif test \"$ac_test_CXXFLAGS\" = set; then\n  CXXFLAGS=$ac_save_CXXFLAGS\nelif test $ac_cv_prog_cxx_g = yes; then\n  if test \"$GXX\" = yes; then\n    CXXFLAGS=\"-g -O2\"\n  else\n    CXXFLAGS=\"-g\"\n  fi\nelse\n  if test \"$GXX\" = yes; then\n    CXXFLAGS=\"-O2\"\n  else\n    CXXFLAGS=\n  fi\nfi\nac_ext=c\nac_cpp='$CPP $CPPFLAGS'\nac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'\nac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'\nac_compiler_gnu=$ac_cv_c_compiler_gnu\n\ndepcc=\"$CXX\"  am_compiler_list=\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc\" >&5\n$as_echo_n \"checking dependency style of $depcc... \" >&6; }\nif test \"${am_cv_CXX_dependencies_compiler_type+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -z \"$AMDEP_TRUE\" && test -f \"$am_depcomp\"; then\n  # We make a subdir and do the tests there.  Otherwise we can end up\n  # making bogus files that we don't know about and never remove.  For\n  # instance it was reported that on HP-UX the gcc test will end up\n  # making a dummy file named `D' -- because `-MD' means `put the output\n  # in D'.\n  mkdir conftest.dir\n  # Copy depcomp to subdir because otherwise we won't find it if we're\n  # using a relative directory.\n  cp \"$am_depcomp\" conftest.dir\n  cd conftest.dir\n  # We will build objects and dependencies in a subdirectory because\n  # it helps to detect inapplicable dependency modes.  For instance\n  # both Tru64's cc and ICC support -MD to output dependencies as a\n  # side effect of compilation, but ICC will put the dependencies in\n  # the current directory while Tru64 will put them in the object\n  # directory.\n  mkdir sub\n\n  am_cv_CXX_dependencies_compiler_type=none\n  if test \"$am_compiler_list\" = \"\"; then\n     am_compiler_list=`sed -n 's/^#*\\([a-zA-Z0-9]*\\))$/\\1/p' < ./depcomp`\n  fi\n  am__universal=false\n  case \" $depcc \" in #(\n     *\\ -arch\\ *\\ -arch\\ *) am__universal=true ;;\n     esac\n\n  for depmode in $am_compiler_list; do\n    # Setup a source with many dependencies, because some compilers\n    # like to wrap large dependency lists on column 80 (with \\), and\n    # we should not choose a depcomp mode which is confused by this.\n    #\n    # We need to recreate these files for each test, as the compiler may\n    # overwrite some of them when testing with obscure command lines.\n    # This happens at least with the AIX C compiler.\n    : > sub/conftest.c\n    for i in 1 2 3 4 5 6; do\n      echo '#include \"conftst'$i'.h\"' >> sub/conftest.c\n      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with\n      # Solaris 8's {/usr,}/bin/sh.\n      touch sub/conftst$i.h\n    done\n    echo \"${am__include} ${am__quote}sub/conftest.Po${am__quote}\" > confmf\n\n    # We check with `-c' and `-o' for the sake of the \"dashmstdout\"\n    # mode.  It turns out that the SunPro C++ compiler does not properly\n    # handle `-M -o', and we need to detect this.  Also, some Intel\n    # versions had trouble with output in subdirs\n    am__obj=sub/conftest.${OBJEXT-o}\n    am__minus_obj=\"-o $am__obj\"\n    case $depmode in\n    gcc)\n      # This depmode causes a compiler race in universal mode.\n      test \"$am__universal\" = false || continue\n      ;;\n    nosideeffect)\n      # after this tag, mechanisms are not by side-effect, so they'll\n      # only be used when explicitly requested\n      if test \"x$enable_dependency_tracking\" = xyes; then\n\tcontinue\n      else\n\tbreak\n      fi\n      ;;\n    msvisualcpp | msvcmsys)\n      # This compiler won't grok `-c -o', but also, the minuso test has\n      # not run yet.  These depmodes are late enough in the game, and\n      # so weak that their functioning should not be impacted.\n      am__obj=conftest.${OBJEXT-o}\n      am__minus_obj=\n      ;;\n    none) break ;;\n    esac\n    if depmode=$depmode \\\n       source=sub/conftest.c object=$am__obj \\\n       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \\\n       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \\\n         >/dev/null 2>conftest.err &&\n       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&\n       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&\n       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&\n       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then\n      # icc doesn't choke on unknown options, it will just issue warnings\n      # or remarks (even with -Werror).  So we grep stderr for any message\n      # that says an option was ignored or not supported.\n      # When given -MP, icc 7.0 and 7.1 complain thusly:\n      #   icc: Command line warning: ignoring option '-M'; no argument required\n      # The diagnosis changed in icc 8.0:\n      #   icc: Command line remark: option '-MP' not supported\n      if (grep 'ignoring option' conftest.err ||\n          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else\n        am_cv_CXX_dependencies_compiler_type=$depmode\n        break\n      fi\n    fi\n  done\n\n  cd ..\n  rm -rf conftest.dir\nelse\n  am_cv_CXX_dependencies_compiler_type=none\nfi\n\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type\" >&5\n$as_echo \"$am_cv_CXX_dependencies_compiler_type\" >&6; }\nCXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type\n\n if\n  test \"x$enable_dependency_tracking\" != xno \\\n  && test \"$am_cv_CXX_dependencies_compiler_type\" = gcc3; then\n  am__fastdepCXX_TRUE=\n  am__fastdepCXX_FALSE='#'\nelse\n  am__fastdepCXX_TRUE='#'\n  am__fastdepCXX_FALSE=\nfi\n\n\nif test -n \"$CXX\" && ( test \"X$CXX\" != \"Xno\" &&\n    ( (test \"X$CXX\" = \"Xg++\" && `g++ -v >/dev/null 2>&1` ) ||\n    (test \"X$CXX\" != \"Xg++\"))) ; then\n  ac_ext=cpp\nac_cpp='$CXXCPP $CPPFLAGS'\nac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'\nac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'\nac_compiler_gnu=$ac_cv_cxx_compiler_gnu\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor\" >&5\n$as_echo_n \"checking how to run the C++ preprocessor... \" >&6; }\nif test -z \"$CXXCPP\"; then\n  if test \"${ac_cv_prog_CXXCPP+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n      # Double quotes because CXXCPP needs to be expanded\n    for CXXCPP in \"$CXX -E\" \"/lib/cpp\"\n    do\n      ac_preproc_ok=false\nfor ac_cxx_preproc_warn_flag in '' yes\ndo\n  # Use a header file that comes with gcc, so configuring glibc\n  # with a fresh cross-compiler works.\n  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since\n  # <limits.h> exists even on freestanding compilers.\n  # On the NeXT, cc -E runs the code through the compiler's parser,\n  # not just through cpp. \"Syntax error\" is here to catch this case.\n  cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n#ifdef __STDC__\n# include <limits.h>\n#else\n# include <assert.h>\n#endif\n\t\t     Syntax error\n_ACEOF\nif ac_fn_cxx_try_cpp \"$LINENO\"; then :\n\nelse\n  # Broken: fails on valid input.\ncontinue\nfi\nrm -f conftest.err conftest.$ac_ext\n\n  # OK, works on sane cases.  Now check whether nonexistent headers\n  # can be detected and how.\n  cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n#include <ac_nonexistent.h>\n_ACEOF\nif ac_fn_cxx_try_cpp \"$LINENO\"; then :\n  # Broken: success on invalid input.\ncontinue\nelse\n  # Passes both tests.\nac_preproc_ok=:\nbreak\nfi\nrm -f conftest.err conftest.$ac_ext\n\ndone\n# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.\nrm -f conftest.err conftest.$ac_ext\nif $ac_preproc_ok; then :\n  break\nfi\n\n    done\n    ac_cv_prog_CXXCPP=$CXXCPP\n\nfi\n  CXXCPP=$ac_cv_prog_CXXCPP\nelse\n  ac_cv_prog_CXXCPP=$CXXCPP\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $CXXCPP\" >&5\n$as_echo \"$CXXCPP\" >&6; }\nac_preproc_ok=false\nfor ac_cxx_preproc_warn_flag in '' yes\ndo\n  # Use a header file that comes with gcc, so configuring glibc\n  # with a fresh cross-compiler works.\n  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since\n  # <limits.h> exists even on freestanding compilers.\n  # On the NeXT, cc -E runs the code through the compiler's parser,\n  # not just through cpp. \"Syntax error\" is here to catch this case.\n  cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n#ifdef __STDC__\n# include <limits.h>\n#else\n# include <assert.h>\n#endif\n\t\t     Syntax error\n_ACEOF\nif ac_fn_cxx_try_cpp \"$LINENO\"; then :\n\nelse\n  # Broken: fails on valid input.\ncontinue\nfi\nrm -f conftest.err conftest.$ac_ext\n\n  # OK, works on sane cases.  Now check whether nonexistent headers\n  # can be detected and how.\n  cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n#include <ac_nonexistent.h>\n_ACEOF\nif ac_fn_cxx_try_cpp \"$LINENO\"; then :\n  # Broken: success on invalid input.\ncontinue\nelse\n  # Passes both tests.\nac_preproc_ok=:\nbreak\nfi\nrm -f conftest.err conftest.$ac_ext\n\ndone\n# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.\nrm -f conftest.err conftest.$ac_ext\nif $ac_preproc_ok; then :\n\nelse\n  { { $as_echo \"$as_me:${as_lineno-$LINENO}: error: in \\`$ac_pwd':\" >&5\n$as_echo \"$as_me: error: in \\`$ac_pwd':\" >&2;}\n_lt_caught_CXX_error=yes; }\nfi\n\nac_ext=c\nac_cpp='$CPP $CPPFLAGS'\nac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'\nac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'\nac_compiler_gnu=$ac_cv_c_compiler_gnu\n\nelse\n  _lt_caught_CXX_error=yes\nfi\n\n\n\n\nac_ext=cpp\nac_cpp='$CXXCPP $CPPFLAGS'\nac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'\nac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'\nac_compiler_gnu=$ac_cv_cxx_compiler_gnu\n\narchive_cmds_need_lc_CXX=no\nallow_undefined_flag_CXX=\nalways_export_symbols_CXX=no\narchive_expsym_cmds_CXX=\ncompiler_needs_object_CXX=no\nexport_dynamic_flag_spec_CXX=\nhardcode_direct_CXX=no\nhardcode_direct_absolute_CXX=no\nhardcode_libdir_flag_spec_CXX=\nhardcode_libdir_flag_spec_ld_CXX=\nhardcode_libdir_separator_CXX=\nhardcode_minus_L_CXX=no\nhardcode_shlibpath_var_CXX=unsupported\nhardcode_automatic_CXX=no\ninherit_rpath_CXX=no\nmodule_cmds_CXX=\nmodule_expsym_cmds_CXX=\nlink_all_deplibs_CXX=unknown\nold_archive_cmds_CXX=$old_archive_cmds\nno_undefined_flag_CXX=\nwhole_archive_flag_spec_CXX=\nenable_shared_with_static_runtimes_CXX=no\n\n# Source file extension for C++ test sources.\nac_ext=cpp\n\n# Object file extension for compiled C++ test sources.\nobjext=o\nobjext_CXX=$objext\n\n# No sense in running all these tests if we already determined that\n# the CXX compiler isn't working.  Some variables (like enable_shared)\n# are currently assumed to apply to all compilers on this platform,\n# and will be corrupted by setting them based on a non-working compiler.\nif test \"$_lt_caught_CXX_error\" != yes; then\n  # Code to be used in simple compile tests\n  lt_simple_compile_test_code=\"int some_variable = 0;\"\n\n  # Code to be used in simple link tests\n  lt_simple_link_test_code='int main(int, char *[]) { return(0); }'\n\n  # ltmain only uses $CC for tagged configurations so make sure $CC is set.\n\n\n\n\n\n\n# If no C compiler was specified, use CC.\nLTCC=${LTCC-\"$CC\"}\n\n# If no C compiler flags were specified, use CFLAGS.\nLTCFLAGS=${LTCFLAGS-\"$CFLAGS\"}\n\n# Allow CC to be a program name with arguments.\ncompiler=$CC\n\n\n  # save warnings/boilerplate of simple test code\n  ac_outfile=conftest.$ac_objext\necho \"$lt_simple_compile_test_code\" >conftest.$ac_ext\neval \"$ac_compile\" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err\n_lt_compiler_boilerplate=`cat conftest.err`\n$RM conftest*\n\n  ac_outfile=conftest.$ac_objext\necho \"$lt_simple_link_test_code\" >conftest.$ac_ext\neval \"$ac_link\" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err\n_lt_linker_boilerplate=`cat conftest.err`\n$RM -r conftest*\n\n\n  # Allow CC to be a program name with arguments.\n  lt_save_CC=$CC\n  lt_save_LD=$LD\n  lt_save_GCC=$GCC\n  GCC=$GXX\n  lt_save_with_gnu_ld=$with_gnu_ld\n  lt_save_path_LD=$lt_cv_path_LD\n  if test -n \"${lt_cv_prog_gnu_ldcxx+set}\"; then\n    lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx\n  else\n    $as_unset lt_cv_prog_gnu_ld\n  fi\n  if test -n \"${lt_cv_path_LDCXX+set}\"; then\n    lt_cv_path_LD=$lt_cv_path_LDCXX\n  else\n    $as_unset lt_cv_path_LD\n  fi\n  test -z \"${LDCXX+set}\" || LD=$LDCXX\n  CC=${CXX-\"c++\"}\n  compiler=$CC\n  compiler_CXX=$CC\n  for cc_temp in $compiler\"\"; do\n  case $cc_temp in\n    compile | *[\\\\/]compile | ccache | *[\\\\/]ccache ) ;;\n    distcc | *[\\\\/]distcc | purify | *[\\\\/]purify ) ;;\n    \\-*) ;;\n    *) break;;\n  esac\ndone\ncc_basename=`$ECHO \"X$cc_temp\" | $Xsed -e 's%.*/%%' -e \"s%^$host_alias-%%\"`\n\n\n  if test -n \"$compiler\"; then\n    # We don't want -fno-exception when compiling C++ code, so set the\n    # no_builtin_flag separately\n    if test \"$GXX\" = yes; then\n      lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin'\n    else\n      lt_prog_compiler_no_builtin_flag_CXX=\n    fi\n\n    if test \"$GXX\" = yes; then\n      # Set up default GNU C++ configuration\n\n\n\n# Check whether --with-gnu-ld was given.\nif test \"${with_gnu_ld+set}\" = set; then :\n  withval=$with_gnu_ld; test \"$withval\" = no || with_gnu_ld=yes\nelse\n  with_gnu_ld=no\nfi\n\nac_prog=ld\nif test \"$GCC\" = yes; then\n  # Check if gcc -print-prog-name=ld gives a path.\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking for ld used by $CC\" >&5\n$as_echo_n \"checking for ld used by $CC... \" >&6; }\n  case $host in\n  *-*-mingw*)\n    # gcc leaves a trailing carriage return which upsets mingw\n    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\\015'` ;;\n  *)\n    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;\n  esac\n  case $ac_prog in\n    # Accept absolute paths.\n    [\\\\/]* | ?:[\\\\/]*)\n      re_direlt='/[^/][^/]*/\\.\\./'\n      # Canonicalize the pathname of ld\n      ac_prog=`$ECHO \"$ac_prog\"| $SED 's%\\\\\\\\%/%g'`\n      while $ECHO \"$ac_prog\" | $GREP \"$re_direlt\" > /dev/null 2>&1; do\n\tac_prog=`$ECHO $ac_prog| $SED \"s%$re_direlt%/%\"`\n      done\n      test -z \"$LD\" && LD=\"$ac_prog\"\n      ;;\n  \"\")\n    # If it fails, then pretend we aren't using GCC.\n    ac_prog=ld\n    ;;\n  *)\n    # If it is relative, then search for the first ld in PATH.\n    with_gnu_ld=unknown\n    ;;\n  esac\nelif test \"$with_gnu_ld\" = yes; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking for GNU ld\" >&5\n$as_echo_n \"checking for GNU ld... \" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking for non-GNU ld\" >&5\n$as_echo_n \"checking for non-GNU ld... \" >&6; }\nfi\nif test \"${lt_cv_path_LD+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -z \"$LD\"; then\n  lt_save_ifs=\"$IFS\"; IFS=$PATH_SEPARATOR\n  for ac_dir in $PATH; do\n    IFS=\"$lt_save_ifs\"\n    test -z \"$ac_dir\" && ac_dir=.\n    if test -f \"$ac_dir/$ac_prog\" || test -f \"$ac_dir/$ac_prog$ac_exeext\"; then\n      lt_cv_path_LD=\"$ac_dir/$ac_prog\"\n      # Check to see if the program is GNU ld.  I'd rather use --version,\n      # but apparently some variants of GNU ld only accept -v.\n      # Break only if it was the GNU/non-GNU ld that we prefer.\n      case `\"$lt_cv_path_LD\" -v 2>&1 </dev/null` in\n      *GNU* | *'with BFD'*)\n\ttest \"$with_gnu_ld\" != no && break\n\t;;\n      *)\n\ttest \"$with_gnu_ld\" != yes && break\n\t;;\n      esac\n    fi\n  done\n  IFS=\"$lt_save_ifs\"\nelse\n  lt_cv_path_LD=\"$LD\" # Let the user override the test with a path.\nfi\nfi\n\nLD=\"$lt_cv_path_LD\"\nif test -n \"$LD\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $LD\" >&5\n$as_echo \"$LD\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\ntest -z \"$LD\" && as_fn_error \"no acceptable ld found in \\$PATH\" \"$LINENO\" 5\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld\" >&5\n$as_echo_n \"checking if the linker ($LD) is GNU ld... \" >&6; }\nif test \"${lt_cv_prog_gnu_ld+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  # I'd rather use --version here, but apparently some GNU lds only accept -v.\ncase `$LD -v 2>&1 </dev/null` in\n*GNU* | *'with BFD'*)\n  lt_cv_prog_gnu_ld=yes\n  ;;\n*)\n  lt_cv_prog_gnu_ld=no\n  ;;\nesac\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_gnu_ld\" >&5\n$as_echo \"$lt_cv_prog_gnu_ld\" >&6; }\nwith_gnu_ld=$lt_cv_prog_gnu_ld\n\n\n\n\n\n\n\n      # Check if GNU C++ uses GNU ld as the underlying linker, since the\n      # archiving commands below assume that GNU ld is being used.\n      if test \"$with_gnu_ld\" = yes; then\n        archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'\n        archive_expsym_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'\n\n        hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'\n        export_dynamic_flag_spec_CXX='${wl}--export-dynamic'\n\n        # If archive_cmds runs LD, not CC, wlarc should be empty\n        # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to\n        #     investigate it a little bit more. (MM)\n        wlarc='${wl}'\n\n        # ancient GNU ld didn't support --whole-archive et. al.\n        if eval \"`$CC -print-prog-name=ld` --help 2>&1\" |\n\t  $GREP 'no-whole-archive' > /dev/null; then\n          whole_archive_flag_spec_CXX=\"$wlarc\"'--whole-archive$convenience '\"$wlarc\"'--no-whole-archive'\n        else\n          whole_archive_flag_spec_CXX=\n        fi\n      else\n        with_gnu_ld=no\n        wlarc=\n\n        # A generic and very simple default shared library creation\n        # command for GNU C++ for the case where it uses the native\n        # linker, instead of GNU ld.  If possible, this setting should\n        # overridden to take advantage of the native linker features on\n        # the platform it is being used on.\n        archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'\n      fi\n\n      # Commands to make compiler produce verbose output that lists\n      # what \"hidden\" libraries, object files and flags are used when\n      # linking a shared library.\n      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP \"\\-L\"'\n\n    else\n      GXX=no\n      with_gnu_ld=no\n      wlarc=\n    fi\n\n    # PORTME: fill in a description of your system's C++ link characteristics\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries\" >&5\n$as_echo_n \"checking whether the $compiler linker ($LD) supports shared libraries... \" >&6; }\n    ld_shlibs_CXX=yes\n    case $host_os in\n      aix3*)\n        # FIXME: insert proper C++ library support\n        ld_shlibs_CXX=no\n        ;;\n      aix[4-9]*)\n        if test \"$host_cpu\" = ia64; then\n          # On IA64, the linker does run time linking by default, so we don't\n          # have to do anything special.\n          aix_use_runtimelinking=no\n          exp_sym_flag='-Bexport'\n          no_entry_flag=\"\"\n        else\n          aix_use_runtimelinking=no\n\n          # Test if we are trying to use run time linking or normal\n          # AIX style linking. If -brtl is somewhere in LDFLAGS, we\n          # need to do runtime linking.\n          case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)\n\t    for ld_flag in $LDFLAGS; do\n\t      case $ld_flag in\n\t      *-brtl*)\n\t        aix_use_runtimelinking=yes\n\t        break\n\t        ;;\n\t      esac\n\t    done\n\t    ;;\n          esac\n\n          exp_sym_flag='-bexport'\n          no_entry_flag='-bnoentry'\n        fi\n\n        # When large executables or shared objects are built, AIX ld can\n        # have problems creating the table of contents.  If linking a library\n        # or program results in \"error TOC overflow\" add -mminimal-toc to\n        # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not\n        # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.\n\n        archive_cmds_CXX=''\n        hardcode_direct_CXX=yes\n        hardcode_direct_absolute_CXX=yes\n        hardcode_libdir_separator_CXX=':'\n        link_all_deplibs_CXX=yes\n        file_list_spec_CXX='${wl}-f,'\n\n        if test \"$GXX\" = yes; then\n          case $host_os in aix4.[012]|aix4.[012].*)\n          # We only want to do this on AIX 4.2 and lower, the check\n          # below for broken collect2 doesn't work under 4.3+\n\t  collect2name=`${CC} -print-prog-name=collect2`\n\t  if test -f \"$collect2name\" &&\n\t     strings \"$collect2name\" | $GREP resolve_lib_name >/dev/null\n\t  then\n\t    # We have reworked collect2\n\t    :\n\t  else\n\t    # We have old collect2\n\t    hardcode_direct_CXX=unsupported\n\t    # It fails to find uninstalled libraries when the uninstalled\n\t    # path is not listed in the libpath.  Setting hardcode_minus_L\n\t    # to unsupported forces relinking\n\t    hardcode_minus_L_CXX=yes\n\t    hardcode_libdir_flag_spec_CXX='-L$libdir'\n\t    hardcode_libdir_separator_CXX=\n\t  fi\n          esac\n          shared_flag='-shared'\n\t  if test \"$aix_use_runtimelinking\" = yes; then\n\t    shared_flag=\"$shared_flag \"'${wl}-G'\n\t  fi\n        else\n          # not using gcc\n          if test \"$host_cpu\" = ia64; then\n\t  # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release\n\t  # chokes on -Wl,-G. The following line is correct:\n\t  shared_flag='-G'\n          else\n\t    if test \"$aix_use_runtimelinking\" = yes; then\n\t      shared_flag='${wl}-G'\n\t    else\n\t      shared_flag='${wl}-bM:SRE'\n\t    fi\n          fi\n        fi\n\n        export_dynamic_flag_spec_CXX='${wl}-bexpall'\n        # It seems that -bexpall does not export symbols beginning with\n        # underscore (_), so it is better to generate a list of symbols to\n\t# export.\n        always_export_symbols_CXX=yes\n        if test \"$aix_use_runtimelinking\" = yes; then\n          # Warning - without using the other runtime loading flags (-brtl),\n          # -berok will link without error, but may produce a broken library.\n          allow_undefined_flag_CXX='-berok'\n          # Determine the default libpath from the value encoded in an empty\n          # executable.\n          cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\nint\nmain ()\n{\n\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_cxx_try_link \"$LINENO\"; then :\n\nlt_aix_libpath_sed='\n    /Import File Strings/,/^$/ {\n\t/^0/ {\n\t    s/^0  *\\(.*\\)$/\\1/\n\t    p\n\t}\n    }'\naix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e \"$lt_aix_libpath_sed\"`\n# Check for a 64-bit object if we didn't find anything.\nif test -z \"$aix_libpath\"; then\n  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e \"$lt_aix_libpath_sed\"`\nfi\nfi\nrm -f core conftest.err conftest.$ac_objext \\\n    conftest$ac_exeext conftest.$ac_ext\nif test -z \"$aix_libpath\"; then aix_libpath=\"/usr/lib:/lib\"; fi\n\n          hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'\"$aix_libpath\"\n\n          archive_expsym_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $deplibs '\"\\${wl}$no_entry_flag\"' $compiler_flags `if test \"x${allow_undefined_flag}\" != \"x\"; then $ECHO \"X${wl}${allow_undefined_flag}\" | $Xsed; else :; fi` '\"\\${wl}$exp_sym_flag:\\$export_symbols $shared_flag\"\n        else\n          if test \"$host_cpu\" = ia64; then\n\t    hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib'\n\t    allow_undefined_flag_CXX=\"-z nodefs\"\n\t    archive_expsym_cmds_CXX=\"\\$CC $shared_flag\"' -o $output_objdir/$soname $libobjs $deplibs '\"\\${wl}$no_entry_flag\"' $compiler_flags ${wl}${allow_undefined_flag} '\"\\${wl}$exp_sym_flag:\\$export_symbols\"\n          else\n\t    # Determine the default libpath from the value encoded in an\n\t    # empty executable.\n\t    cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\nint\nmain ()\n{\n\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_cxx_try_link \"$LINENO\"; then :\n\nlt_aix_libpath_sed='\n    /Import File Strings/,/^$/ {\n\t/^0/ {\n\t    s/^0  *\\(.*\\)$/\\1/\n\t    p\n\t}\n    }'\naix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e \"$lt_aix_libpath_sed\"`\n# Check for a 64-bit object if we didn't find anything.\nif test -z \"$aix_libpath\"; then\n  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e \"$lt_aix_libpath_sed\"`\nfi\nfi\nrm -f core conftest.err conftest.$ac_objext \\\n    conftest$ac_exeext conftest.$ac_ext\nif test -z \"$aix_libpath\"; then aix_libpath=\"/usr/lib:/lib\"; fi\n\n\t    hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'\"$aix_libpath\"\n\t    # Warning - without using the other run time loading flags,\n\t    # -berok will link without error, but may produce a broken library.\n\t    no_undefined_flag_CXX=' ${wl}-bernotok'\n\t    allow_undefined_flag_CXX=' ${wl}-berok'\n\t    # Exported symbols can be pulled into shared objects from archives\n\t    whole_archive_flag_spec_CXX='$convenience'\n\t    archive_cmds_need_lc_CXX=yes\n\t    # This is similar to how AIX traditionally builds its shared\n\t    # libraries.\n\t    archive_expsym_cmds_CXX=\"\\$CC $shared_flag\"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'\n          fi\n        fi\n        ;;\n\n      beos*)\n\tif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then\n\t  allow_undefined_flag_CXX=unsupported\n\t  # Joseph Beckenbach <jrb3@best.com> says some releases of gcc\n\t  # support --undefined.  This deserves some investigation.  FIXME\n\t  archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n\telse\n\t  ld_shlibs_CXX=no\n\tfi\n\t;;\n\n      chorus*)\n        case $cc_basename in\n          *)\n\t  # FIXME: insert proper C++ library support\n\t  ld_shlibs_CXX=no\n\t  ;;\n        esac\n        ;;\n\n      cygwin* | mingw* | pw32* | cegcc*)\n        # _LT_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless,\n        # as there is no search path for DLLs.\n        hardcode_libdir_flag_spec_CXX='-L$libdir'\n        allow_undefined_flag_CXX=unsupported\n        always_export_symbols_CXX=no\n        enable_shared_with_static_runtimes_CXX=yes\n\n        if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then\n          archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'\n          # If the export-symbols file already is a .def file (1st line\n          # is EXPORTS), use it as is; otherwise, prepend...\n          archive_expsym_cmds_CXX='if test \"x`$SED 1q $export_symbols`\" = xEXPORTS; then\n\t    cp $export_symbols $output_objdir/$soname.def;\n          else\n\t    echo EXPORTS > $output_objdir/$soname.def;\n\t    cat $export_symbols >> $output_objdir/$soname.def;\n          fi~\n          $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'\n        else\n          ld_shlibs_CXX=no\n        fi\n        ;;\n      darwin* | rhapsody*)\n\n\n  archive_cmds_need_lc_CXX=no\n  hardcode_direct_CXX=no\n  hardcode_automatic_CXX=yes\n  hardcode_shlibpath_var_CXX=unsupported\n  whole_archive_flag_spec_CXX=''\n  link_all_deplibs_CXX=yes\n  allow_undefined_flag_CXX=\"$_lt_dar_allow_undefined\"\n  case $cc_basename in\n     ifort*) _lt_dar_can_shared=yes ;;\n     *) _lt_dar_can_shared=$GCC ;;\n  esac\n  if test \"$_lt_dar_can_shared\" = \"yes\"; then\n    output_verbose_link_cmd=echo\n    archive_cmds_CXX=\"\\$CC -dynamiclib \\$allow_undefined_flag -o \\$lib \\$libobjs \\$deplibs \\$compiler_flags -install_name \\$rpath/\\$soname \\$verstring $_lt_dar_single_mod${_lt_dsymutil}\"\n    module_cmds_CXX=\"\\$CC \\$allow_undefined_flag -o \\$lib -bundle \\$libobjs \\$deplibs \\$compiler_flags${_lt_dsymutil}\"\n    archive_expsym_cmds_CXX=\"sed 's,^,_,' < \\$export_symbols > \\$output_objdir/\\${libname}-symbols.expsym~\\$CC -dynamiclib \\$allow_undefined_flag -o \\$lib \\$libobjs \\$deplibs \\$compiler_flags -install_name \\$rpath/\\$soname \\$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}\"\n    module_expsym_cmds_CXX=\"sed -e 's,^,_,' < \\$export_symbols > \\$output_objdir/\\${libname}-symbols.expsym~\\$CC \\$allow_undefined_flag -o \\$lib -bundle \\$libobjs \\$deplibs \\$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}\"\n       if test \"$lt_cv_apple_cc_single_mod\" != \"yes\"; then\n      archive_cmds_CXX=\"\\$CC -r -keep_private_externs -nostdlib -o \\${lib}-master.o \\$libobjs~\\$CC -dynamiclib \\$allow_undefined_flag -o \\$lib \\${lib}-master.o \\$deplibs \\$compiler_flags -install_name \\$rpath/\\$soname \\$verstring${_lt_dsymutil}\"\n      archive_expsym_cmds_CXX=\"sed 's,^,_,' < \\$export_symbols > \\$output_objdir/\\${libname}-symbols.expsym~\\$CC -r -keep_private_externs -nostdlib -o \\${lib}-master.o \\$libobjs~\\$CC -dynamiclib \\$allow_undefined_flag -o \\$lib \\${lib}-master.o \\$deplibs \\$compiler_flags -install_name \\$rpath/\\$soname \\$verstring${_lt_dar_export_syms}${_lt_dsymutil}\"\n    fi\n\n  else\n  ld_shlibs_CXX=no\n  fi\n\n\t;;\n\n      dgux*)\n        case $cc_basename in\n          ec++*)\n\t    # FIXME: insert proper C++ library support\n\t    ld_shlibs_CXX=no\n\t    ;;\n          ghcx*)\n\t    # Green Hills C++ Compiler\n\t    # FIXME: insert proper C++ library support\n\t    ld_shlibs_CXX=no\n\t    ;;\n          *)\n\t    # FIXME: insert proper C++ library support\n\t    ld_shlibs_CXX=no\n\t    ;;\n        esac\n        ;;\n\n      freebsd[12]*)\n        # C++ shared libraries reported to be fairly broken before\n\t# switch to ELF\n        ld_shlibs_CXX=no\n        ;;\n\n      freebsd-elf*)\n        archive_cmds_need_lc_CXX=no\n        ;;\n\n      freebsd* | dragonfly*)\n        # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF\n        # conventions\n        ld_shlibs_CXX=yes\n        ;;\n\n      gnu*)\n        ;;\n\n      hpux9*)\n        hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir'\n        hardcode_libdir_separator_CXX=:\n        export_dynamic_flag_spec_CXX='${wl}-E'\n        hardcode_direct_CXX=yes\n        hardcode_minus_L_CXX=yes # Not in the search PATH,\n\t\t\t\t             # but as the default\n\t\t\t\t             # location of the library.\n\n        case $cc_basename in\n          CC*)\n            # FIXME: insert proper C++ library support\n            ld_shlibs_CXX=no\n            ;;\n          aCC*)\n            archive_cmds_CXX='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'\n            # Commands to make compiler produce verbose output that lists\n            # what \"hidden\" libraries, object files and flags are used when\n            # linking a shared library.\n            #\n            # There doesn't appear to be a way to prevent this compiler from\n            # explicitly linking system object files so we need to strip them\n            # from the output so that they don't get included in the library\n            # dependencies.\n            output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP \"\\-L\"`; list=\"\"; for z in $templist; do case $z in conftest.$objext) list=\"$list $z\";; *.$objext);; *) list=\"$list $z\";;esac; done; $ECHO \"X$list\" | $Xsed'\n            ;;\n          *)\n            if test \"$GXX\" = yes; then\n              archive_cmds_CXX='$RM $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'\n            else\n              # FIXME: insert proper C++ library support\n              ld_shlibs_CXX=no\n            fi\n            ;;\n        esac\n        ;;\n\n      hpux10*|hpux11*)\n        if test $with_gnu_ld = no; then\n\t  hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir'\n\t  hardcode_libdir_separator_CXX=:\n\n          case $host_cpu in\n            hppa*64*|ia64*)\n              ;;\n            *)\n\t      export_dynamic_flag_spec_CXX='${wl}-E'\n              ;;\n          esac\n        fi\n        case $host_cpu in\n          hppa*64*|ia64*)\n            hardcode_direct_CXX=no\n            hardcode_shlibpath_var_CXX=no\n            ;;\n          *)\n            hardcode_direct_CXX=yes\n            hardcode_direct_absolute_CXX=yes\n            hardcode_minus_L_CXX=yes # Not in the search PATH,\n\t\t\t\t\t         # but as the default\n\t\t\t\t\t         # location of the library.\n            ;;\n        esac\n\n        case $cc_basename in\n          CC*)\n\t    # FIXME: insert proper C++ library support\n\t    ld_shlibs_CXX=no\n\t    ;;\n          aCC*)\n\t    case $host_cpu in\n\t      hppa*64*)\n\t        archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'\n\t        ;;\n\t      ia64*)\n\t        archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'\n\t        ;;\n\t      *)\n\t        archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'\n\t        ;;\n\t    esac\n\t    # Commands to make compiler produce verbose output that lists\n\t    # what \"hidden\" libraries, object files and flags are used when\n\t    # linking a shared library.\n\t    #\n\t    # There doesn't appear to be a way to prevent this compiler from\n\t    # explicitly linking system object files so we need to strip them\n\t    # from the output so that they don't get included in the library\n\t    # dependencies.\n\t    output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP \"\\-L\"`; list=\"\"; for z in $templist; do case $z in conftest.$objext) list=\"$list $z\";; *.$objext);; *) list=\"$list $z\";;esac; done; $ECHO \"X$list\" | $Xsed'\n\t    ;;\n          *)\n\t    if test \"$GXX\" = yes; then\n\t      if test $with_gnu_ld = no; then\n\t        case $host_cpu in\n\t          hppa*64*)\n\t            archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'\n\t            ;;\n\t          ia64*)\n\t            archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'\n\t            ;;\n\t          *)\n\t            archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'\n\t            ;;\n\t        esac\n\t      fi\n\t    else\n\t      # FIXME: insert proper C++ library support\n\t      ld_shlibs_CXX=no\n\t    fi\n\t    ;;\n        esac\n        ;;\n\n      interix[3-9]*)\n\thardcode_direct_CXX=no\n\thardcode_shlibpath_var_CXX=no\n\thardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'\n\texport_dynamic_flag_spec_CXX='${wl}-E'\n\t# Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.\n\t# Instead, shared libraries are loaded at an image base (0x10000000 by\n\t# default) and relocated if they conflict, which is a slow very memory\n\t# consuming and fragmenting process.  To avoid this, we pick a random,\n\t# 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link\n\t# time.  Moving up from 0x10000000 also allows more sbrk(2) space.\n\tarchive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \\* 262144 + 1342177280` -o $lib'\n\tarchive_expsym_cmds_CXX='sed \"s,^,_,\" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \\* 262144 + 1342177280` -o $lib'\n\t;;\n      irix5* | irix6*)\n        case $cc_basename in\n          CC*)\n\t    # SGI C++\n\t    archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n \"$verstring\" && $ECHO \"X-set_version $verstring\" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'\n\n\t    # Archives containing C++ object files must be created using\n\t    # \"CC -ar\", where \"CC\" is the IRIX C++ compiler.  This is\n\t    # necessary to make sure instantiated templates are included\n\t    # in the archive.\n\t    old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs'\n\t    ;;\n          *)\n\t    if test \"$GXX\" = yes; then\n\t      if test \"$with_gnu_ld\" = no; then\n\t        archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n \"$verstring\" && $ECHO \"X${wl}-set_version ${wl}$verstring\" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'\n\t      else\n\t        archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n \"$verstring\" && $ECHO \"X${wl}-set_version ${wl}$verstring\" | $Xsed` -o $lib'\n\t      fi\n\t    fi\n\t    link_all_deplibs_CXX=yes\n\t    ;;\n        esac\n        hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'\n        hardcode_libdir_separator_CXX=:\n        inherit_rpath_CXX=yes\n        ;;\n\n      linux* | k*bsd*-gnu)\n        case $cc_basename in\n          KCC*)\n\t    # Kuck and Associates, Inc. (KAI) C++ Compiler\n\n\t    # KCC will only create a shared library if the output file\n\t    # ends with \".so\" (or \".sl\" for HP-UX), so rename the library\n\t    # to its proper name (with version) after linking.\n\t    archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\\''s/\\([^()0-9A-Za-z{}]\\)/\\\\\\\\\\1/g'\\''`; templib=`echo $lib | $SED -e \"s/\\${tempext}\\..*/.so/\"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \\$templib; mv \\$templib $lib'\n\t    archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\\''s/\\([^()0-9A-Za-z{}]\\)/\\\\\\\\\\1/g'\\''`; templib=`echo $lib | $SED -e \"s/\\${tempext}\\..*/.so/\"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \\$templib ${wl}-retain-symbols-file,$export_symbols; mv \\$templib $lib'\n\t    # Commands to make compiler produce verbose output that lists\n\t    # what \"hidden\" libraries, object files and flags are used when\n\t    # linking a shared library.\n\t    #\n\t    # There doesn't appear to be a way to prevent this compiler from\n\t    # explicitly linking system object files so we need to strip them\n\t    # from the output so that they don't get included in the library\n\t    # dependencies.\n\t    output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP \"ld\"`; rm -f libconftest$shared_ext; list=\"\"; for z in $templist; do case $z in conftest.$objext) list=\"$list $z\";; *.$objext);; *) list=\"$list $z\";;esac; done; $ECHO \"X$list\" | $Xsed'\n\n\t    hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'\n\t    export_dynamic_flag_spec_CXX='${wl}--export-dynamic'\n\n\t    # Archives containing C++ object files must be created using\n\t    # \"CC -Bstatic\", where \"CC\" is the KAI C++ compiler.\n\t    old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs'\n\t    ;;\n\t  icpc* | ecpc* )\n\t    # Intel C++\n\t    with_gnu_ld=yes\n\t    # version 8.0 and above of icpc choke on multiply defined symbols\n\t    # if we add $predep_objects and $postdep_objects, however 7.1 and\n\t    # earlier do not add the objects themselves.\n\t    case `$CC -V 2>&1` in\n\t      *\"Version 7.\"*)\n\t        archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'\n\t\tarchive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'\n\t\t;;\n\t      *)  # Version 8.0 or newer\n\t        tmp_idyn=\n\t        case $host_cpu in\n\t\t  ia64*) tmp_idyn=' -i_dynamic';;\n\t\tesac\n\t        archive_cmds_CXX='$CC -shared'\"$tmp_idyn\"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n\t\tarchive_expsym_cmds_CXX='$CC -shared'\"$tmp_idyn\"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'\n\t\t;;\n\t    esac\n\t    archive_cmds_need_lc_CXX=no\n\t    hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'\n\t    export_dynamic_flag_spec_CXX='${wl}--export-dynamic'\n\t    whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive'\n\t    ;;\n          pgCC* | pgcpp*)\n            # Portland Group C++ compiler\n\t    case `$CC -V` in\n\t    *pgCC\\ [1-5]* | *pgcpp\\ [1-5]*)\n\t      prelink_cmds_CXX='tpldir=Template.dir~\n\t\trm -rf $tpldir~\n\t\t$CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~\n\t\tcompile_command=\"$compile_command `find $tpldir -name \\*.o | $NL2SP`\"'\n\t      old_archive_cmds_CXX='tpldir=Template.dir~\n\t\trm -rf $tpldir~\n\t\t$CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~\n\t\t$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \\*.o | $NL2SP`~\n\t\t$RANLIB $oldlib'\n\t      archive_cmds_CXX='tpldir=Template.dir~\n\t\trm -rf $tpldir~\n\t\t$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~\n\t\t$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \\*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'\n\t      archive_expsym_cmds_CXX='tpldir=Template.dir~\n\t\trm -rf $tpldir~\n\t\t$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~\n\t\t$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \\*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'\n\t      ;;\n\t    *) # Version 6 will use weak symbols\n\t      archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'\n\t      archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'\n\t      ;;\n\t    esac\n\n\t    hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir'\n\t    export_dynamic_flag_spec_CXX='${wl}--export-dynamic'\n\t    whole_archive_flag_spec_CXX='${wl}--whole-archive`for conv in $convenience\\\"\\\"; do test  -n \\\"$conv\\\" && new_convenience=\\\"$new_convenience,$conv\\\"; done; $ECHO \\\"$new_convenience\\\"` ${wl}--no-whole-archive'\n            ;;\n\t  cxx*)\n\t    # Compaq C++\n\t    archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'\n\t    archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname  -o $lib ${wl}-retain-symbols-file $wl$export_symbols'\n\n\t    runpath_var=LD_RUN_PATH\n\t    hardcode_libdir_flag_spec_CXX='-rpath $libdir'\n\t    hardcode_libdir_separator_CXX=:\n\n\t    # Commands to make compiler produce verbose output that lists\n\t    # what \"hidden\" libraries, object files and flags are used when\n\t    # linking a shared library.\n\t    #\n\t    # There doesn't appear to be a way to prevent this compiler from\n\t    # explicitly linking system object files so we need to strip them\n\t    # from the output so that they don't get included in the library\n\t    # dependencies.\n\t    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP \"ld\"`; templist=`$ECHO \"X$templist\" | $Xsed -e \"s/\\(^.*ld.*\\)\\( .*ld .*$\\)/\\1/\"`; list=\"\"; for z in $templist; do case $z in conftest.$objext) list=\"$list $z\";; *.$objext);; *) list=\"$list $z\";;esac; done; $ECHO \"X$list\" | $Xsed'\n\t    ;;\n\t  xl*)\n\t    # IBM XL 8.0 on PPC, with GNU ld\n\t    hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'\n\t    export_dynamic_flag_spec_CXX='${wl}--export-dynamic'\n\t    archive_cmds_CXX='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n\t    if test \"x$supports_anon_versioning\" = xyes; then\n\t      archive_expsym_cmds_CXX='echo \"{ global:\" > $output_objdir/$libname.ver~\n\t\tcat $export_symbols | sed -e \"s/\\(.*\\)/\\1;/\" >> $output_objdir/$libname.ver~\n\t\techo \"local: *; };\" >> $output_objdir/$libname.ver~\n\t\t$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'\n\t    fi\n\t    ;;\n\t  *)\n\t    case `$CC -V 2>&1 | sed 5q` in\n\t    *Sun\\ C*)\n\t      # Sun C++ 5.9\n\t      no_undefined_flag_CXX=' -zdefs'\n\t      archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'\n\t      archive_expsym_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'\n\t      hardcode_libdir_flag_spec_CXX='-R$libdir'\n\t      whole_archive_flag_spec_CXX='${wl}--whole-archive`new_convenience=; for conv in $convenience\\\"\\\"; do test -z \\\"$conv\\\" || new_convenience=\\\"$new_convenience,$conv\\\"; done; $ECHO \\\"$new_convenience\\\"` ${wl}--no-whole-archive'\n\t      compiler_needs_object_CXX=yes\n\n\t      # Not sure whether something based on\n\t      # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1\n\t      # would be better.\n\t      output_verbose_link_cmd='echo'\n\n\t      # Archives containing C++ object files must be created using\n\t      # \"CC -xar\", where \"CC\" is the Sun C++ compiler.  This is\n\t      # necessary to make sure instantiated templates are included\n\t      # in the archive.\n\t      old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs'\n\t      ;;\n\t    esac\n\t    ;;\n\tesac\n\t;;\n\n      lynxos*)\n        # FIXME: insert proper C++ library support\n\tld_shlibs_CXX=no\n\t;;\n\n      m88k*)\n        # FIXME: insert proper C++ library support\n        ld_shlibs_CXX=no\n\t;;\n\n      mvs*)\n        case $cc_basename in\n          cxx*)\n\t    # FIXME: insert proper C++ library support\n\t    ld_shlibs_CXX=no\n\t    ;;\n\t  *)\n\t    # FIXME: insert proper C++ library support\n\t    ld_shlibs_CXX=no\n\t    ;;\n\tesac\n\t;;\n\n      netbsd*)\n        if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then\n\t  archive_cmds_CXX='$LD -Bshareable  -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'\n\t  wlarc=\n\t  hardcode_libdir_flag_spec_CXX='-R$libdir'\n\t  hardcode_direct_CXX=yes\n\t  hardcode_shlibpath_var_CXX=no\n\tfi\n\t# Workaround some broken pre-1.5 toolchains\n\toutput_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e \"s:-lgcc -lc -lgcc::\"'\n\t;;\n\n      *nto* | *qnx*)\n        ld_shlibs_CXX=yes\n\t;;\n\n      openbsd2*)\n        # C++ shared libraries are fairly broken\n\tld_shlibs_CXX=no\n\t;;\n\n      openbsd*)\n\tif test -f /usr/libexec/ld.so; then\n\t  hardcode_direct_CXX=yes\n\t  hardcode_shlibpath_var_CXX=no\n\t  hardcode_direct_absolute_CXX=yes\n\t  archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'\n\t  hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'\n\t  if test -z \"`echo __ELF__ | $CC -E - | grep __ELF__`\" || test \"$host_os-$host_cpu\" = \"openbsd2.8-powerpc\"; then\n\t    archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'\n\t    export_dynamic_flag_spec_CXX='${wl}-E'\n\t    whole_archive_flag_spec_CXX=\"$wlarc\"'--whole-archive$convenience '\"$wlarc\"'--no-whole-archive'\n\t  fi\n\t  output_verbose_link_cmd=echo\n\telse\n\t  ld_shlibs_CXX=no\n\tfi\n\t;;\n\n      osf3* | osf4* | osf5*)\n        case $cc_basename in\n          KCC*)\n\t    # Kuck and Associates, Inc. (KAI) C++ Compiler\n\n\t    # KCC will only create a shared library if the output file\n\t    # ends with \".so\" (or \".sl\" for HP-UX), so rename the library\n\t    # to its proper name (with version) after linking.\n\t    archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\\''s/\\([^()0-9A-Za-z{}]\\)/\\\\\\\\\\1/g'\\''`; templib=`echo \"$lib\" | $SED -e \"s/\\${tempext}\\..*/.so/\"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \\$templib; mv \\$templib $lib'\n\n\t    hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'\n\t    hardcode_libdir_separator_CXX=:\n\n\t    # Archives containing C++ object files must be created using\n\t    # the KAI C++ compiler.\n\t    case $host in\n\t      osf3*) old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;;\n\t      *) old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' ;;\n\t    esac\n\t    ;;\n          RCC*)\n\t    # Rational C++ 2.4.1\n\t    # FIXME: insert proper C++ library support\n\t    ld_shlibs_CXX=no\n\t    ;;\n          cxx*)\n\t    case $host in\n\t      osf3*)\n\t        allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\\*'\n\t        archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n \"$verstring\" && $ECHO \"X${wl}-set_version $verstring\" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'\n\t        hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'\n\t\t;;\n\t      *)\n\t        allow_undefined_flag_CXX=' -expect_unresolved \\*'\n\t        archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n \"$verstring\" && $ECHO \"X-set_version $verstring\" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'\n\t        archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf \"%s %s\\\\n\" -exported_symbol \"\\$i\" >> $lib.exp; done~\n\t          echo \"-hidden\">> $lib.exp~\n\t          $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp  `test -n \"$verstring\" && $ECHO \"X-set_version $verstring\" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~\n\t          $RM $lib.exp'\n\t        hardcode_libdir_flag_spec_CXX='-rpath $libdir'\n\t\t;;\n\t    esac\n\n\t    hardcode_libdir_separator_CXX=:\n\n\t    # Commands to make compiler produce verbose output that lists\n\t    # what \"hidden\" libraries, object files and flags are used when\n\t    # linking a shared library.\n\t    #\n\t    # There doesn't appear to be a way to prevent this compiler from\n\t    # explicitly linking system object files so we need to strip them\n\t    # from the output so that they don't get included in the library\n\t    # dependencies.\n\t    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP \"ld\" | $GREP -v \"ld:\"`; templist=`$ECHO \"X$templist\" | $Xsed -e \"s/\\(^.*ld.*\\)\\( .*ld.*$\\)/\\1/\"`; list=\"\"; for z in $templist; do case $z in conftest.$objext) list=\"$list $z\";; *.$objext);; *) list=\"$list $z\";;esac; done; $ECHO \"X$list\" | $Xsed'\n\t    ;;\n\t  *)\n\t    if test \"$GXX\" = yes && test \"$with_gnu_ld\" = no; then\n\t      allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\\*'\n\t      case $host in\n\t        osf3*)\n\t          archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n \"$verstring\" && $ECHO \"X${wl}-set_version ${wl}$verstring\" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'\n\t\t  ;;\n\t        *)\n\t          archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n \"$verstring\" && $ECHO \"${wl}-set_version ${wl}$verstring\" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'\n\t\t  ;;\n\t      esac\n\n\t      hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'\n\t      hardcode_libdir_separator_CXX=:\n\n\t      # Commands to make compiler produce verbose output that lists\n\t      # what \"hidden\" libraries, object files and flags are used when\n\t      # linking a shared library.\n\t      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP \"\\-L\"'\n\n\t    else\n\t      # FIXME: insert proper C++ library support\n\t      ld_shlibs_CXX=no\n\t    fi\n\t    ;;\n        esac\n        ;;\n\n      psos*)\n        # FIXME: insert proper C++ library support\n        ld_shlibs_CXX=no\n        ;;\n\n      sunos4*)\n        case $cc_basename in\n          CC*)\n\t    # Sun C++ 4.x\n\t    # FIXME: insert proper C++ library support\n\t    ld_shlibs_CXX=no\n\t    ;;\n          lcc*)\n\t    # Lucid\n\t    # FIXME: insert proper C++ library support\n\t    ld_shlibs_CXX=no\n\t    ;;\n          *)\n\t    # FIXME: insert proper C++ library support\n\t    ld_shlibs_CXX=no\n\t    ;;\n        esac\n        ;;\n\n      solaris*)\n        case $cc_basename in\n          CC*)\n\t    # Sun C++ 4.2, 5.x and Centerline C++\n            archive_cmds_need_lc_CXX=yes\n\t    no_undefined_flag_CXX=' -zdefs'\n\t    archive_cmds_CXX='$CC -G${allow_undefined_flag}  -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'\n\t    archive_expsym_cmds_CXX='echo \"{ global:\" > $lib.exp~cat $export_symbols | $SED -e \"s/\\(.*\\)/\\1;/\" >> $lib.exp~echo \"local: *; };\" >> $lib.exp~\n\t      $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'\n\n\t    hardcode_libdir_flag_spec_CXX='-R$libdir'\n\t    hardcode_shlibpath_var_CXX=no\n\t    case $host_os in\n\t      solaris2.[0-5] | solaris2.[0-5].*) ;;\n\t      *)\n\t\t# The compiler driver will combine and reorder linker options,\n\t\t# but understands `-z linker_flag'.\n\t        # Supported since Solaris 2.6 (maybe 2.5.1?)\n\t\twhole_archive_flag_spec_CXX='-z allextract$convenience -z defaultextract'\n\t        ;;\n\t    esac\n\t    link_all_deplibs_CXX=yes\n\n\t    output_verbose_link_cmd='echo'\n\n\t    # Archives containing C++ object files must be created using\n\t    # \"CC -xar\", where \"CC\" is the Sun C++ compiler.  This is\n\t    # necessary to make sure instantiated templates are included\n\t    # in the archive.\n\t    old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs'\n\t    ;;\n          gcx*)\n\t    # Green Hills C++ Compiler\n\t    archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'\n\n\t    # The C++ compiler must be used to create the archive.\n\t    old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs'\n\t    ;;\n          *)\n\t    # GNU C++ compiler with Solaris linker\n\t    if test \"$GXX\" = yes && test \"$with_gnu_ld\" = no; then\n\t      no_undefined_flag_CXX=' ${wl}-z ${wl}defs'\n\t      if $CC --version | $GREP -v '^2\\.7' > /dev/null; then\n\t        archive_cmds_CXX='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'\n\t        archive_expsym_cmds_CXX='echo \"{ global:\" > $lib.exp~cat $export_symbols | $SED -e \"s/\\(.*\\)/\\1;/\" >> $lib.exp~echo \"local: *; };\" >> $lib.exp~\n\t\t  $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'\n\n\t        # Commands to make compiler produce verbose output that lists\n\t        # what \"hidden\" libraries, object files and flags are used when\n\t        # linking a shared library.\n\t        output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP \"\\-L\"'\n\t      else\n\t        # g++ 2.7 appears to require `-G' NOT `-shared' on this\n\t        # platform.\n\t        archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'\n\t        archive_expsym_cmds_CXX='echo \"{ global:\" > $lib.exp~cat $export_symbols | $SED -e \"s/\\(.*\\)/\\1;/\" >> $lib.exp~echo \"local: *; };\" >> $lib.exp~\n\t\t  $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'\n\n\t        # Commands to make compiler produce verbose output that lists\n\t        # what \"hidden\" libraries, object files and flags are used when\n\t        # linking a shared library.\n\t        output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP \"\\-L\"'\n\t      fi\n\n\t      hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir'\n\t      case $host_os in\n\t\tsolaris2.[0-5] | solaris2.[0-5].*) ;;\n\t\t*)\n\t\t  whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'\n\t\t  ;;\n\t      esac\n\t    fi\n\t    ;;\n        esac\n        ;;\n\n    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)\n      no_undefined_flag_CXX='${wl}-z,text'\n      archive_cmds_need_lc_CXX=no\n      hardcode_shlibpath_var_CXX=no\n      runpath_var='LD_RUN_PATH'\n\n      case $cc_basename in\n        CC*)\n\t  archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t  archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t  ;;\n\t*)\n\t  archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t  archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t  ;;\n      esac\n      ;;\n\n      sysv5* | sco3.2v5* | sco5v6*)\n\t# Note: We can NOT use -z defs as we might desire, because we do not\n\t# link with -lc, and that would cause any symbols used from libc to\n\t# always be unresolved, which means just about no library would\n\t# ever link correctly.  If we're not using GNU ld we use -z text\n\t# though, which does catch some bad symbols but isn't as heavy-handed\n\t# as -z defs.\n\tno_undefined_flag_CXX='${wl}-z,text'\n\tallow_undefined_flag_CXX='${wl}-z,nodefs'\n\tarchive_cmds_need_lc_CXX=no\n\thardcode_shlibpath_var_CXX=no\n\thardcode_libdir_flag_spec_CXX='${wl}-R,$libdir'\n\thardcode_libdir_separator_CXX=':'\n\tlink_all_deplibs_CXX=yes\n\texport_dynamic_flag_spec_CXX='${wl}-Bexport'\n\trunpath_var='LD_RUN_PATH'\n\n\tcase $cc_basename in\n          CC*)\n\t    archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t    archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t    ;;\n\t  *)\n\t    archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t    archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t    ;;\n\tesac\n      ;;\n\n      tandem*)\n        case $cc_basename in\n          NCC*)\n\t    # NonStop-UX NCC 3.20\n\t    # FIXME: insert proper C++ library support\n\t    ld_shlibs_CXX=no\n\t    ;;\n          *)\n\t    # FIXME: insert proper C++ library support\n\t    ld_shlibs_CXX=no\n\t    ;;\n        esac\n        ;;\n\n      vxworks*)\n        # FIXME: insert proper C++ library support\n        ld_shlibs_CXX=no\n        ;;\n\n      *)\n        # FIXME: insert proper C++ library support\n        ld_shlibs_CXX=no\n        ;;\n    esac\n\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX\" >&5\n$as_echo \"$ld_shlibs_CXX\" >&6; }\n    test \"$ld_shlibs_CXX\" = no && can_build_shared=no\n\n    GCC_CXX=\"$GXX\"\n    LD_CXX=\"$LD\"\n\n    ## CAVEAT EMPTOR:\n    ## There is no encapsulation within the following macros, do not change\n    ## the running order or otherwise move them around unless you know exactly\n    ## what you are doing...\n    # Dependencies to place before and after the object being linked:\npredep_objects_CXX=\npostdep_objects_CXX=\npredeps_CXX=\npostdeps_CXX=\ncompiler_lib_search_path_CXX=\n\ncat > conftest.$ac_ext <<_LT_EOF\nclass Foo\n{\npublic:\n  Foo (void) { a = 0; }\nprivate:\n  int a;\n};\n_LT_EOF\n\nif { { eval echo \"\\\"\\$as_me\\\":${as_lineno-$LINENO}: \\\"$ac_compile\\\"\"; } >&5\n  (eval $ac_compile) 2>&5\n  ac_status=$?\n  $as_echo \"$as_me:${as_lineno-$LINENO}: \\$? = $ac_status\" >&5\n  test $ac_status = 0; }; then\n  # Parse the compiler output and extract the necessary\n  # objects, libraries and library flags.\n\n  # Sentinel used to keep track of whether or not we are before\n  # the conftest object file.\n  pre_test_object_deps_done=no\n\n  for p in `eval \"$output_verbose_link_cmd\"`; do\n    case $p in\n\n    -L* | -R* | -l*)\n       # Some compilers place space between \"-{L,R}\" and the path.\n       # Remove the space.\n       if test $p = \"-L\" ||\n          test $p = \"-R\"; then\n\t prev=$p\n\t continue\n       else\n\t prev=\n       fi\n\n       if test \"$pre_test_object_deps_done\" = no; then\n\t case $p in\n\t -L* | -R*)\n\t   # Internal compiler library paths should come after those\n\t   # provided the user.  The postdeps already come after the\n\t   # user supplied libs so there is no need to process them.\n\t   if test -z \"$compiler_lib_search_path_CXX\"; then\n\t     compiler_lib_search_path_CXX=\"${prev}${p}\"\n\t   else\n\t     compiler_lib_search_path_CXX=\"${compiler_lib_search_path_CXX} ${prev}${p}\"\n\t   fi\n\t   ;;\n\t # The \"-l\" case would never come before the object being\n\t # linked, so don't bother handling this case.\n\t esac\n       else\n\t if test -z \"$postdeps_CXX\"; then\n\t   postdeps_CXX=\"${prev}${p}\"\n\t else\n\t   postdeps_CXX=\"${postdeps_CXX} ${prev}${p}\"\n\t fi\n       fi\n       ;;\n\n    *.$objext)\n       # This assumes that the test object file only shows up\n       # once in the compiler output.\n       if test \"$p\" = \"conftest.$objext\"; then\n\t pre_test_object_deps_done=yes\n\t continue\n       fi\n\n       if test \"$pre_test_object_deps_done\" = no; then\n\t if test -z \"$predep_objects_CXX\"; then\n\t   predep_objects_CXX=\"$p\"\n\t else\n\t   predep_objects_CXX=\"$predep_objects_CXX $p\"\n\t fi\n       else\n\t if test -z \"$postdep_objects_CXX\"; then\n\t   postdep_objects_CXX=\"$p\"\n\t else\n\t   postdep_objects_CXX=\"$postdep_objects_CXX $p\"\n\t fi\n       fi\n       ;;\n\n    *) ;; # Ignore the rest.\n\n    esac\n  done\n\n  # Clean up.\n  rm -f a.out a.exe\nelse\n  echo \"libtool.m4: error: problem compiling CXX test program\"\nfi\n\n$RM -f confest.$objext\n\n# PORTME: override above test on systems where it is broken\ncase $host_os in\ninterix[3-9]*)\n  # Interix 3.5 installs completely hosed .la files for C++, so rather than\n  # hack all around it, let's just trust \"g++\" to DTRT.\n  predep_objects_CXX=\n  postdep_objects_CXX=\n  postdeps_CXX=\n  ;;\n\nlinux*)\n  case `$CC -V 2>&1 | sed 5q` in\n  *Sun\\ C*)\n    # Sun C++ 5.9\n\n    # The more standards-conforming stlport4 library is\n    # incompatible with the Cstd library. Avoid specifying\n    # it if it's in CXXFLAGS. Ignore libCrun as\n    # -library=stlport4 depends on it.\n    case \" $CXX $CXXFLAGS \" in\n    *\" -library=stlport4 \"*)\n      solaris_use_stlport4=yes\n      ;;\n    esac\n\n    if test \"$solaris_use_stlport4\" != yes; then\n      postdeps_CXX='-library=Cstd -library=Crun'\n    fi\n    ;;\n  esac\n  ;;\n\nsolaris*)\n  case $cc_basename in\n  CC*)\n    # The more standards-conforming stlport4 library is\n    # incompatible with the Cstd library. Avoid specifying\n    # it if it's in CXXFLAGS. Ignore libCrun as\n    # -library=stlport4 depends on it.\n    case \" $CXX $CXXFLAGS \" in\n    *\" -library=stlport4 \"*)\n      solaris_use_stlport4=yes\n      ;;\n    esac\n\n    # Adding this requires a known-good setup of shared libraries for\n    # Sun compiler versions before 5.6, else PIC objects from an old\n    # archive will be linked into the output, leading to subtle bugs.\n    if test \"$solaris_use_stlport4\" != yes; then\n      postdeps_CXX='-library=Cstd -library=Crun'\n    fi\n    ;;\n  esac\n  ;;\nesac\n\n\ncase \" $postdeps_CXX \" in\n*\" -lc \"*) archive_cmds_need_lc_CXX=no ;;\nesac\n compiler_lib_search_dirs_CXX=\nif test -n \"${compiler_lib_search_path_CXX}\"; then\n compiler_lib_search_dirs_CXX=`echo \" ${compiler_lib_search_path_CXX}\" | ${SED} -e 's! -L! !g' -e 's!^ !!'`\nfi\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n    lt_prog_compiler_wl_CXX=\nlt_prog_compiler_pic_CXX=\nlt_prog_compiler_static_CXX=\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC\" >&5\n$as_echo_n \"checking for $compiler option to produce PIC... \" >&6; }\n\n  # C++ specific cases for pic, static, wl, etc.\n  if test \"$GXX\" = yes; then\n    lt_prog_compiler_wl_CXX='-Wl,'\n    lt_prog_compiler_static_CXX='-static'\n\n    case $host_os in\n    aix*)\n      # All AIX code is PIC.\n      if test \"$host_cpu\" = ia64; then\n\t# AIX 5 now supports IA64 processor\n\tlt_prog_compiler_static_CXX='-Bstatic'\n      fi\n      ;;\n\n    amigaos*)\n      case $host_cpu in\n      powerpc)\n            # see comment about AmigaOS4 .so support\n            lt_prog_compiler_pic_CXX='-fPIC'\n        ;;\n      m68k)\n            # FIXME: we need at least 68020 code to build shared libraries, but\n            # adding the `-m68020' flag to GCC prevents building anything better,\n            # like `-m68040'.\n            lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4'\n        ;;\n      esac\n      ;;\n\n    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)\n      # PIC is the default for these OSes.\n      ;;\n    mingw* | cygwin* | os2* | pw32* | cegcc*)\n      # This hack is so that the source file can tell whether it is being\n      # built for inclusion in a dll (and should export symbols for example).\n      # Although the cygwin gcc ignores -fPIC, still need this for old-style\n      # (--disable-auto-import) libraries\n      lt_prog_compiler_pic_CXX='-DDLL_EXPORT'\n      ;;\n    darwin* | rhapsody*)\n      # PIC is the default on this platform\n      # Common symbols not allowed in MH_DYLIB files\n      lt_prog_compiler_pic_CXX='-fno-common'\n      ;;\n    *djgpp*)\n      # DJGPP does not support shared libraries at all\n      lt_prog_compiler_pic_CXX=\n      ;;\n    interix[3-9]*)\n      # Interix 3.x gcc -fpic/-fPIC options generate broken code.\n      # Instead, we relocate shared libraries at runtime.\n      ;;\n    sysv4*MP*)\n      if test -d /usr/nec; then\n\tlt_prog_compiler_pic_CXX=-Kconform_pic\n      fi\n      ;;\n    hpux*)\n      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit\n      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag\n      # sets the default TLS model and affects inlining.\n      case $host_cpu in\n      hppa*64*)\n\t;;\n      *)\n\tlt_prog_compiler_pic_CXX='-fPIC'\n\t;;\n      esac\n      ;;\n    *qnx* | *nto*)\n      # QNX uses GNU C++, but need to define -shared option too, otherwise\n      # it will coredump.\n      lt_prog_compiler_pic_CXX='-fPIC -shared'\n      ;;\n    *)\n      lt_prog_compiler_pic_CXX='-fPIC'\n      ;;\n    esac\n  else\n    case $host_os in\n      aix[4-9]*)\n\t# All AIX code is PIC.\n\tif test \"$host_cpu\" = ia64; then\n\t  # AIX 5 now supports IA64 processor\n\t  lt_prog_compiler_static_CXX='-Bstatic'\n\telse\n\t  lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp'\n\tfi\n\t;;\n      chorus*)\n\tcase $cc_basename in\n\tcxch68*)\n\t  # Green Hills C++ Compiler\n\t  # _LT_TAGVAR(lt_prog_compiler_static, CXX)=\"--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a\"\n\t  ;;\n\tesac\n\t;;\n      dgux*)\n\tcase $cc_basename in\n\t  ec++*)\n\t    lt_prog_compiler_pic_CXX='-KPIC'\n\t    ;;\n\t  ghcx*)\n\t    # Green Hills C++ Compiler\n\t    lt_prog_compiler_pic_CXX='-pic'\n\t    ;;\n\t  *)\n\t    ;;\n\tesac\n\t;;\n      freebsd* | dragonfly*)\n\t# FreeBSD uses GNU C++\n\t;;\n      hpux9* | hpux10* | hpux11*)\n\tcase $cc_basename in\n\t  CC*)\n\t    lt_prog_compiler_wl_CXX='-Wl,'\n\t    lt_prog_compiler_static_CXX='${wl}-a ${wl}archive'\n\t    if test \"$host_cpu\" != ia64; then\n\t      lt_prog_compiler_pic_CXX='+Z'\n\t    fi\n\t    ;;\n\t  aCC*)\n\t    lt_prog_compiler_wl_CXX='-Wl,'\n\t    lt_prog_compiler_static_CXX='${wl}-a ${wl}archive'\n\t    case $host_cpu in\n\t    hppa*64*|ia64*)\n\t      # +Z the default\n\t      ;;\n\t    *)\n\t      lt_prog_compiler_pic_CXX='+Z'\n\t      ;;\n\t    esac\n\t    ;;\n\t  *)\n\t    ;;\n\tesac\n\t;;\n      interix*)\n\t# This is c89, which is MS Visual C++ (no shared libs)\n\t# Anyone wants to do a port?\n\t;;\n      irix5* | irix6* | nonstopux*)\n\tcase $cc_basename in\n\t  CC*)\n\t    lt_prog_compiler_wl_CXX='-Wl,'\n\t    lt_prog_compiler_static_CXX='-non_shared'\n\t    # CC pic flag -KPIC is the default.\n\t    ;;\n\t  *)\n\t    ;;\n\tesac\n\t;;\n      linux* | k*bsd*-gnu)\n\tcase $cc_basename in\n\t  KCC*)\n\t    # KAI C++ Compiler\n\t    lt_prog_compiler_wl_CXX='--backend -Wl,'\n\t    lt_prog_compiler_pic_CXX='-fPIC'\n\t    ;;\n\t  ecpc* )\n\t    # old Intel C++ for x86_64 which still supported -KPIC.\n\t    lt_prog_compiler_wl_CXX='-Wl,'\n\t    lt_prog_compiler_pic_CXX='-KPIC'\n\t    lt_prog_compiler_static_CXX='-static'\n\t    ;;\n\t  icpc* )\n\t    # Intel C++, used to be incompatible with GCC.\n\t    # ICC 10 doesn't accept -KPIC any more.\n\t    lt_prog_compiler_wl_CXX='-Wl,'\n\t    lt_prog_compiler_pic_CXX='-fPIC'\n\t    lt_prog_compiler_static_CXX='-static'\n\t    ;;\n\t  pgCC* | pgcpp*)\n\t    # Portland Group C++ compiler\n\t    lt_prog_compiler_wl_CXX='-Wl,'\n\t    lt_prog_compiler_pic_CXX='-fpic'\n\t    lt_prog_compiler_static_CXX='-Bstatic'\n\t    ;;\n\t  cxx*)\n\t    # Compaq C++\n\t    # Make sure the PIC flag is empty.  It appears that all Alpha\n\t    # Linux and Compaq Tru64 Unix objects are PIC.\n\t    lt_prog_compiler_pic_CXX=\n\t    lt_prog_compiler_static_CXX='-non_shared'\n\t    ;;\n\t  xlc* | xlC*)\n\t    # IBM XL 8.0 on PPC\n\t    lt_prog_compiler_wl_CXX='-Wl,'\n\t    lt_prog_compiler_pic_CXX='-qpic'\n\t    lt_prog_compiler_static_CXX='-qstaticlink'\n\t    ;;\n\t  *)\n\t    case `$CC -V 2>&1 | sed 5q` in\n\t    *Sun\\ C*)\n\t      # Sun C++ 5.9\n\t      lt_prog_compiler_pic_CXX='-KPIC'\n\t      lt_prog_compiler_static_CXX='-Bstatic'\n\t      lt_prog_compiler_wl_CXX='-Qoption ld '\n\t      ;;\n\t    esac\n\t    ;;\n\tesac\n\t;;\n      lynxos*)\n\t;;\n      m88k*)\n\t;;\n      mvs*)\n\tcase $cc_basename in\n\t  cxx*)\n\t    lt_prog_compiler_pic_CXX='-W c,exportall'\n\t    ;;\n\t  *)\n\t    ;;\n\tesac\n\t;;\n      netbsd*)\n\t;;\n      *qnx* | *nto*)\n        # QNX uses GNU C++, but need to define -shared option too, otherwise\n        # it will coredump.\n        lt_prog_compiler_pic_CXX='-fPIC -shared'\n        ;;\n      osf3* | osf4* | osf5*)\n\tcase $cc_basename in\n\t  KCC*)\n\t    lt_prog_compiler_wl_CXX='--backend -Wl,'\n\t    ;;\n\t  RCC*)\n\t    # Rational C++ 2.4.1\n\t    lt_prog_compiler_pic_CXX='-pic'\n\t    ;;\n\t  cxx*)\n\t    # Digital/Compaq C++\n\t    lt_prog_compiler_wl_CXX='-Wl,'\n\t    # Make sure the PIC flag is empty.  It appears that all Alpha\n\t    # Linux and Compaq Tru64 Unix objects are PIC.\n\t    lt_prog_compiler_pic_CXX=\n\t    lt_prog_compiler_static_CXX='-non_shared'\n\t    ;;\n\t  *)\n\t    ;;\n\tesac\n\t;;\n      psos*)\n\t;;\n      solaris*)\n\tcase $cc_basename in\n\t  CC*)\n\t    # Sun C++ 4.2, 5.x and Centerline C++\n\t    lt_prog_compiler_pic_CXX='-KPIC'\n\t    lt_prog_compiler_static_CXX='-Bstatic'\n\t    lt_prog_compiler_wl_CXX='-Qoption ld '\n\t    ;;\n\t  gcx*)\n\t    # Green Hills C++ Compiler\n\t    lt_prog_compiler_pic_CXX='-PIC'\n\t    ;;\n\t  *)\n\t    ;;\n\tesac\n\t;;\n      sunos4*)\n\tcase $cc_basename in\n\t  CC*)\n\t    # Sun C++ 4.x\n\t    lt_prog_compiler_pic_CXX='-pic'\n\t    lt_prog_compiler_static_CXX='-Bstatic'\n\t    ;;\n\t  lcc*)\n\t    # Lucid\n\t    lt_prog_compiler_pic_CXX='-pic'\n\t    ;;\n\t  *)\n\t    ;;\n\tesac\n\t;;\n      sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)\n\tcase $cc_basename in\n\t  CC*)\n\t    lt_prog_compiler_wl_CXX='-Wl,'\n\t    lt_prog_compiler_pic_CXX='-KPIC'\n\t    lt_prog_compiler_static_CXX='-Bstatic'\n\t    ;;\n\tesac\n\t;;\n      tandem*)\n\tcase $cc_basename in\n\t  NCC*)\n\t    # NonStop-UX NCC 3.20\n\t    lt_prog_compiler_pic_CXX='-KPIC'\n\t    ;;\n\t  *)\n\t    ;;\n\tesac\n\t;;\n      vxworks*)\n\t;;\n      *)\n\tlt_prog_compiler_can_build_shared_CXX=no\n\t;;\n    esac\n  fi\n\ncase $host_os in\n  # For platforms which do not support PIC, -DPIC is meaningless:\n  *djgpp*)\n    lt_prog_compiler_pic_CXX=\n    ;;\n  *)\n    lt_prog_compiler_pic_CXX=\"$lt_prog_compiler_pic_CXX -DPIC\"\n    ;;\nesac\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic_CXX\" >&5\n$as_echo \"$lt_prog_compiler_pic_CXX\" >&6; }\n\n\n\n#\n# Check to make sure the PIC flag actually works.\n#\nif test -n \"$lt_prog_compiler_pic_CXX\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works\" >&5\n$as_echo_n \"checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... \" >&6; }\nif test \"${lt_cv_prog_compiler_pic_works_CXX+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  lt_cv_prog_compiler_pic_works_CXX=no\n   ac_outfile=conftest.$ac_objext\n   echo \"$lt_simple_compile_test_code\" > conftest.$ac_ext\n   lt_compiler_flag=\"$lt_prog_compiler_pic_CXX -DPIC\"\n   # Insert the option either (1) after the last *FLAGS variable, or\n   # (2) before a word containing \"conftest.\", or (3) at the end.\n   # Note that $ac_compile itself does not contain backslashes and begins\n   # with a dollar sign (not a hyphen), so the echo should work correctly.\n   # The option is referenced via a variable to avoid confusing sed.\n   lt_compile=`echo \"$ac_compile\" | $SED \\\n   -e 's:.*FLAGS}\\{0,1\\} :&$lt_compiler_flag :; t' \\\n   -e 's: [^ ]*conftest\\.: $lt_compiler_flag&:; t' \\\n   -e 's:$: $lt_compiler_flag:'`\n   (eval echo \"\\\"\\$as_me:14261: $lt_compile\\\"\" >&5)\n   (eval \"$lt_compile\" 2>conftest.err)\n   ac_status=$?\n   cat conftest.err >&5\n   echo \"$as_me:14265: \\$? = $ac_status\" >&5\n   if (exit $ac_status) && test -s \"$ac_outfile\"; then\n     # The compiler can only warn and ignore the option if not recognized\n     # So say no if there are warnings other than the usual output.\n     $ECHO \"X$_lt_compiler_boilerplate\" | $Xsed -e '/^$/d' >conftest.exp\n     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2\n     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then\n       lt_cv_prog_compiler_pic_works_CXX=yes\n     fi\n   fi\n   $RM conftest*\n\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works_CXX\" >&5\n$as_echo \"$lt_cv_prog_compiler_pic_works_CXX\" >&6; }\n\nif test x\"$lt_cv_prog_compiler_pic_works_CXX\" = xyes; then\n    case $lt_prog_compiler_pic_CXX in\n     \"\" | \" \"*) ;;\n     *) lt_prog_compiler_pic_CXX=\" $lt_prog_compiler_pic_CXX\" ;;\n     esac\nelse\n    lt_prog_compiler_pic_CXX=\n     lt_prog_compiler_can_build_shared_CXX=no\nfi\n\nfi\n\n\n\n#\n# Check to make sure the static flag actually works.\n#\nwl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\\\"$lt_prog_compiler_static_CXX\\\"\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works\" >&5\n$as_echo_n \"checking if $compiler static flag $lt_tmp_static_flag works... \" >&6; }\nif test \"${lt_cv_prog_compiler_static_works_CXX+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  lt_cv_prog_compiler_static_works_CXX=no\n   save_LDFLAGS=\"$LDFLAGS\"\n   LDFLAGS=\"$LDFLAGS $lt_tmp_static_flag\"\n   echo \"$lt_simple_link_test_code\" > conftest.$ac_ext\n   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then\n     # The linker can only warn and ignore the option if not recognized\n     # So say no if there are warnings\n     if test -s conftest.err; then\n       # Append any errors to the config.log.\n       cat conftest.err 1>&5\n       $ECHO \"X$_lt_linker_boilerplate\" | $Xsed -e '/^$/d' > conftest.exp\n       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2\n       if diff conftest.exp conftest.er2 >/dev/null; then\n         lt_cv_prog_compiler_static_works_CXX=yes\n       fi\n     else\n       lt_cv_prog_compiler_static_works_CXX=yes\n     fi\n   fi\n   $RM -r conftest*\n   LDFLAGS=\"$save_LDFLAGS\"\n\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works_CXX\" >&5\n$as_echo \"$lt_cv_prog_compiler_static_works_CXX\" >&6; }\n\nif test x\"$lt_cv_prog_compiler_static_works_CXX\" = xyes; then\n    :\nelse\n    lt_prog_compiler_static_CXX=\nfi\n\n\n\n\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext\" >&5\n$as_echo_n \"checking if $compiler supports -c -o file.$ac_objext... \" >&6; }\nif test \"${lt_cv_prog_compiler_c_o_CXX+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  lt_cv_prog_compiler_c_o_CXX=no\n   $RM -r conftest 2>/dev/null\n   mkdir conftest\n   cd conftest\n   mkdir out\n   echo \"$lt_simple_compile_test_code\" > conftest.$ac_ext\n\n   lt_compiler_flag=\"-o out/conftest2.$ac_objext\"\n   # Insert the option either (1) after the last *FLAGS variable, or\n   # (2) before a word containing \"conftest.\", or (3) at the end.\n   # Note that $ac_compile itself does not contain backslashes and begins\n   # with a dollar sign (not a hyphen), so the echo should work correctly.\n   lt_compile=`echo \"$ac_compile\" | $SED \\\n   -e 's:.*FLAGS}\\{0,1\\} :&$lt_compiler_flag :; t' \\\n   -e 's: [^ ]*conftest\\.: $lt_compiler_flag&:; t' \\\n   -e 's:$: $lt_compiler_flag:'`\n   (eval echo \"\\\"\\$as_me:14360: $lt_compile\\\"\" >&5)\n   (eval \"$lt_compile\" 2>out/conftest.err)\n   ac_status=$?\n   cat out/conftest.err >&5\n   echo \"$as_me:14364: \\$? = $ac_status\" >&5\n   if (exit $ac_status) && test -s out/conftest2.$ac_objext\n   then\n     # The compiler can only warn and ignore the option if not recognized\n     # So say no if there are warnings\n     $ECHO \"X$_lt_compiler_boilerplate\" | $Xsed -e '/^$/d' > out/conftest.exp\n     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2\n     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then\n       lt_cv_prog_compiler_c_o_CXX=yes\n     fi\n   fi\n   chmod u+w . 2>&5\n   $RM conftest*\n   # SGI C++ compiler will create directory out/ii_files/ for\n   # template instantiation\n   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files\n   $RM out/* && rmdir out\n   cd ..\n   $RM -r conftest\n   $RM conftest*\n\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX\" >&5\n$as_echo \"$lt_cv_prog_compiler_c_o_CXX\" >&6; }\n\n\n\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext\" >&5\n$as_echo_n \"checking if $compiler supports -c -o file.$ac_objext... \" >&6; }\nif test \"${lt_cv_prog_compiler_c_o_CXX+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  lt_cv_prog_compiler_c_o_CXX=no\n   $RM -r conftest 2>/dev/null\n   mkdir conftest\n   cd conftest\n   mkdir out\n   echo \"$lt_simple_compile_test_code\" > conftest.$ac_ext\n\n   lt_compiler_flag=\"-o out/conftest2.$ac_objext\"\n   # Insert the option either (1) after the last *FLAGS variable, or\n   # (2) before a word containing \"conftest.\", or (3) at the end.\n   # Note that $ac_compile itself does not contain backslashes and begins\n   # with a dollar sign (not a hyphen), so the echo should work correctly.\n   lt_compile=`echo \"$ac_compile\" | $SED \\\n   -e 's:.*FLAGS}\\{0,1\\} :&$lt_compiler_flag :; t' \\\n   -e 's: [^ ]*conftest\\.: $lt_compiler_flag&:; t' \\\n   -e 's:$: $lt_compiler_flag:'`\n   (eval echo \"\\\"\\$as_me:14412: $lt_compile\\\"\" >&5)\n   (eval \"$lt_compile\" 2>out/conftest.err)\n   ac_status=$?\n   cat out/conftest.err >&5\n   echo \"$as_me:14416: \\$? = $ac_status\" >&5\n   if (exit $ac_status) && test -s out/conftest2.$ac_objext\n   then\n     # The compiler can only warn and ignore the option if not recognized\n     # So say no if there are warnings\n     $ECHO \"X$_lt_compiler_boilerplate\" | $Xsed -e '/^$/d' > out/conftest.exp\n     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2\n     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then\n       lt_cv_prog_compiler_c_o_CXX=yes\n     fi\n   fi\n   chmod u+w . 2>&5\n   $RM conftest*\n   # SGI C++ compiler will create directory out/ii_files/ for\n   # template instantiation\n   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files\n   $RM out/* && rmdir out\n   cd ..\n   $RM -r conftest\n   $RM conftest*\n\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX\" >&5\n$as_echo \"$lt_cv_prog_compiler_c_o_CXX\" >&6; }\n\n\n\n\nhard_links=\"nottested\"\nif test \"$lt_cv_prog_compiler_c_o_CXX\" = no && test \"$need_locks\" != no; then\n  # do not overwrite the value of need_locks provided by the user\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links\" >&5\n$as_echo_n \"checking if we can lock with hard links... \" >&6; }\n  hard_links=yes\n  $RM conftest*\n  ln conftest.a conftest.b 2>/dev/null && hard_links=no\n  touch conftest.a\n  ln conftest.a conftest.b 2>&5 || hard_links=no\n  ln conftest.a conftest.b 2>/dev/null && hard_links=no\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $hard_links\" >&5\n$as_echo \"$hard_links\" >&6; }\n  if test \"$hard_links\" = no; then\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: WARNING: \\`$CC' does not support \\`-c -o', so \\`make -j' may be unsafe\" >&5\n$as_echo \"$as_me: WARNING: \\`$CC' does not support \\`-c -o', so \\`make -j' may be unsafe\" >&2;}\n    need_locks=warn\n  fi\nelse\n  need_locks=no\nfi\n\n\n\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries\" >&5\n$as_echo_n \"checking whether the $compiler linker ($LD) supports shared libraries... \" >&6; }\n\n  export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\\''s/.* //'\\'' | sort | uniq > $export_symbols'\n  case $host_os in\n  aix[4-9]*)\n    # If we're using GNU nm, then we don't want the \"-C\" option.\n    # -C means demangle to AIX nm, but means don't demangle with GNU nm\n    if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then\n      export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\\''{ if (((\\$ 2 == \"T\") || (\\$ 2 == \"D\") || (\\$ 2 == \"B\")) && (substr(\\$ 3,1,1) != \".\")) { print \\$ 3 } }'\\'' | sort -u > $export_symbols'\n    else\n      export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\\''{ if (((\\$ 2 == \"T\") || (\\$ 2 == \"D\") || (\\$ 2 == \"B\")) && (substr(\\$ 3,1,1) != \".\")) { print \\$ 3 } }'\\'' | sort -u > $export_symbols'\n    fi\n    ;;\n  pw32*)\n    export_symbols_cmds_CXX=\"$ltdll_cmds\"\n  ;;\n  cygwin* | mingw* | cegcc*)\n    export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\\''/^[BCDGRS][ ]/s/.*[ ]\\([^ ]*\\)/\\1 DATA/;/^.*[ ]__nm__/s/^.*[ ]__nm__\\([^ ]*\\)[ ][^ ]*/\\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\\'' | sort | uniq > $export_symbols'\n  ;;\n  *)\n    export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\\''s/.* //'\\'' | sort | uniq > $export_symbols'\n  ;;\n  esac\n  exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX\" >&5\n$as_echo \"$ld_shlibs_CXX\" >&6; }\ntest \"$ld_shlibs_CXX\" = no && can_build_shared=no\n\nwith_gnu_ld_CXX=$with_gnu_ld\n\n\n\n\n\n\n#\n# Do we need to explicitly link libc?\n#\ncase \"x$archive_cmds_need_lc_CXX\" in\nx|xyes)\n  # Assume -lc should be added\n  archive_cmds_need_lc_CXX=yes\n\n  if test \"$enable_shared\" = yes && test \"$GCC\" = yes; then\n    case $archive_cmds_CXX in\n    *'~'*)\n      # FIXME: we may have to deal with multi-command sequences.\n      ;;\n    '$CC '*)\n      # Test whether the compiler implicitly links with -lc since on some\n      # systems, -lgcc has to come before -lc. If gcc already passes -lc\n      # to ld, don't add -lc before -lgcc.\n      { $as_echo \"$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in\" >&5\n$as_echo_n \"checking whether -lc should be explicitly linked in... \" >&6; }\n      $RM conftest*\n      echo \"$lt_simple_compile_test_code\" > conftest.$ac_ext\n\n      if { { eval echo \"\\\"\\$as_me\\\":${as_lineno-$LINENO}: \\\"$ac_compile\\\"\"; } >&5\n  (eval $ac_compile) 2>&5\n  ac_status=$?\n  $as_echo \"$as_me:${as_lineno-$LINENO}: \\$? = $ac_status\" >&5\n  test $ac_status = 0; } 2>conftest.err; then\n        soname=conftest\n        lib=conftest\n        libobjs=conftest.$ac_objext\n        deplibs=\n        wl=$lt_prog_compiler_wl_CXX\n\tpic_flag=$lt_prog_compiler_pic_CXX\n        compiler_flags=-v\n        linker_flags=-v\n        verstring=\n        output_objdir=.\n        libname=conftest\n        lt_save_allow_undefined_flag=$allow_undefined_flag_CXX\n        allow_undefined_flag_CXX=\n        if { { eval echo \"\\\"\\$as_me\\\":${as_lineno-$LINENO}: \\\"$archive_cmds_CXX 2\\>\\&1 \\| $GREP \\\" -lc \\\" \\>/dev/null 2\\>\\&1\\\"\"; } >&5\n  (eval $archive_cmds_CXX 2\\>\\&1 \\| $GREP \\\" -lc \\\" \\>/dev/null 2\\>\\&1) 2>&5\n  ac_status=$?\n  $as_echo \"$as_me:${as_lineno-$LINENO}: \\$? = $ac_status\" >&5\n  test $ac_status = 0; }\n        then\n\t  archive_cmds_need_lc_CXX=no\n        else\n\t  archive_cmds_need_lc_CXX=yes\n        fi\n        allow_undefined_flag_CXX=$lt_save_allow_undefined_flag\n      else\n        cat conftest.err 1>&5\n      fi\n      $RM conftest*\n      { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $archive_cmds_need_lc_CXX\" >&5\n$as_echo \"$archive_cmds_need_lc_CXX\" >&6; }\n      ;;\n    esac\n  fi\n  ;;\nesac\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics\" >&5\n$as_echo_n \"checking dynamic linker characteristics... \" >&6; }\n\nlibrary_names_spec=\nlibname_spec='lib$name'\nsoname_spec=\nshrext_cmds=\".so\"\npostinstall_cmds=\npostuninstall_cmds=\nfinish_cmds=\nfinish_eval=\nshlibpath_var=\nshlibpath_overrides_runpath=unknown\nversion_type=none\ndynamic_linker=\"$host_os ld.so\"\nsys_lib_dlsearch_path_spec=\"/lib /usr/lib\"\nneed_lib_prefix=unknown\nhardcode_into_libs=no\n\n# when you set need_version to no, make sure it does not cause -set_version\n# flags to be left without arguments\nneed_version=unknown\n\ncase $host_os in\naix3*)\n  version_type=linux\n  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'\n  shlibpath_var=LIBPATH\n\n  # AIX 3 has no versioning support, so we append a major version to the name.\n  soname_spec='${libname}${release}${shared_ext}$major'\n  ;;\n\naix[4-9]*)\n  version_type=linux\n  need_lib_prefix=no\n  need_version=no\n  hardcode_into_libs=yes\n  if test \"$host_cpu\" = ia64; then\n    # AIX 5 supports IA64\n    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'\n    shlibpath_var=LD_LIBRARY_PATH\n  else\n    # With GCC up to 2.95.x, collect2 would create an import file\n    # for dependence libraries.  The import file would start with\n    # the line `#! .'.  This would cause the generated library to\n    # depend on `.', always an invalid library.  This was fixed in\n    # development snapshots of GCC prior to 3.0.\n    case $host_os in\n      aix4 | aix4.[01] | aix4.[01].*)\n      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'\n\t   echo ' yes '\n\t   echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then\n\t:\n      else\n\tcan_build_shared=no\n      fi\n      ;;\n    esac\n    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct\n    # soname into executable. Probably we can add versioning support to\n    # collect2, so additional links can be useful in future.\n    if test \"$aix_use_runtimelinking\" = yes; then\n      # If using run time linking (on AIX 4.2 or later) use lib<name>.so\n      # instead of lib<name>.a to let people know that these are not\n      # typical AIX shared libraries.\n      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n    else\n      # We preserve .a as extension for shared libraries through AIX4.2\n      # and later when we are not doing run time linking.\n      library_names_spec='${libname}${release}.a $libname.a'\n      soname_spec='${libname}${release}${shared_ext}$major'\n    fi\n    shlibpath_var=LIBPATH\n  fi\n  ;;\n\namigaos*)\n  case $host_cpu in\n  powerpc)\n    # Since July 2007 AmigaOS4 officially supports .so libraries.\n    # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.\n    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n    ;;\n  m68k)\n    library_names_spec='$libname.ixlibrary $libname.a'\n    # Create ${libname}_ixlibrary.a entries in /sys/libs.\n    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO \"X$lib\" | $Xsed -e '\\''s%^.*/\\([^/]*\\)\\.ixlibrary$%\\1%'\\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show \"cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a\"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'\n    ;;\n  esac\n  ;;\n\nbeos*)\n  library_names_spec='${libname}${shared_ext}'\n  dynamic_linker=\"$host_os ld.so\"\n  shlibpath_var=LIBRARY_PATH\n  ;;\n\nbsdi[45]*)\n  version_type=linux\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  finish_cmds='PATH=\"\\$PATH:/sbin\" ldconfig $libdir'\n  shlibpath_var=LD_LIBRARY_PATH\n  sys_lib_search_path_spec=\"/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib\"\n  sys_lib_dlsearch_path_spec=\"/shlib /usr/lib /usr/local/lib\"\n  # the default ld.so.conf also contains /usr/contrib/lib and\n  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow\n  # libtool to hard-code these into programs\n  ;;\n\ncygwin* | mingw* | pw32* | cegcc*)\n  version_type=windows\n  shrext_cmds=\".dll\"\n  need_version=no\n  need_lib_prefix=no\n\n  case $GCC,$host_os in\n  yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)\n    library_names_spec='$libname.dll.a'\n    # DLL is installed to $(libdir)/../bin by postinstall_cmds\n    postinstall_cmds='base_file=`basename \\${file}`~\n      dlpath=`$SHELL 2>&1 -c '\\''. $dir/'\\''\\${base_file}'\\''i; echo \\$dlname'\\''`~\n      dldir=$destdir/`dirname \\$dlpath`~\n      test -d \\$dldir || mkdir -p \\$dldir~\n      $install_prog $dir/$dlname \\$dldir/$dlname~\n      chmod a+x \\$dldir/$dlname~\n      if test -n '\\''$stripme'\\'' && test -n '\\''$striplib'\\''; then\n        eval '\\''$striplib \\$dldir/$dlname'\\'' || exit \\$?;\n      fi'\n    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\\''. $file; echo \\$dlname'\\''`~\n      dlpath=$dir/\\$dldll~\n       $RM \\$dlpath'\n    shlibpath_overrides_runpath=yes\n\n    case $host_os in\n    cygwin*)\n      # Cygwin DLLs use 'cyg' prefix rather than 'lib'\n      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'\n      sys_lib_search_path_spec=\"/usr/lib /lib/w32api /lib /usr/local/lib\"\n      ;;\n    mingw* | cegcc*)\n      # MinGW DLLs use traditional 'lib' prefix\n      soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'\n      sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP \"^libraries:\" | $SED -e \"s/^libraries://\" -e \"s,=/,/,g\"`\n      if $ECHO \"$sys_lib_search_path_spec\" | $GREP ';[c-zC-Z]:/' >/dev/null; then\n        # It is most probably a Windows format PATH printed by\n        # mingw gcc, but we are running on Cygwin. Gcc prints its search\n        # path with ; separators, and with drive letters. We can handle the\n        # drive letters (cygwin fileutils understands them), so leave them,\n        # especially as we might pass files found there to a mingw objdump,\n        # which wouldn't understand a cygwinified path. Ahh.\n        sys_lib_search_path_spec=`$ECHO \"$sys_lib_search_path_spec\" | $SED -e 's/;/ /g'`\n      else\n        sys_lib_search_path_spec=`$ECHO \"$sys_lib_search_path_spec\" | $SED  -e \"s/$PATH_SEPARATOR/ /g\"`\n      fi\n      ;;\n    pw32*)\n      # pw32 DLLs use 'pw' prefix rather than 'lib'\n      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'\n      ;;\n    esac\n    ;;\n\n  *)\n    library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'\n    ;;\n  esac\n  dynamic_linker='Win32 ld.exe'\n  # FIXME: first we should search . and the directory the executable is in\n  shlibpath_var=PATH\n  ;;\n\ndarwin* | rhapsody*)\n  dynamic_linker=\"$host_os dyld\"\n  version_type=darwin\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'\n  soname_spec='${libname}${release}${major}$shared_ext'\n  shlibpath_overrides_runpath=yes\n  shlibpath_var=DYLD_LIBRARY_PATH\n  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'\n\n  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'\n  ;;\n\ndgux*)\n  version_type=linux\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LD_LIBRARY_PATH\n  ;;\n\nfreebsd1*)\n  dynamic_linker=no\n  ;;\n\nfreebsd* | dragonfly*)\n  # DragonFly does not have aout.  When/if they implement a new\n  # versioning mechanism, adjust this.\n  if test -x /usr/bin/objformat; then\n    objformat=`/usr/bin/objformat`\n  else\n    case $host_os in\n    freebsd[123]*) objformat=aout ;;\n    *) objformat=elf ;;\n    esac\n  fi\n  version_type=freebsd-$objformat\n  case $version_type in\n    freebsd-elf*)\n      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'\n      need_version=no\n      need_lib_prefix=no\n      ;;\n    freebsd-*)\n      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'\n      need_version=yes\n      ;;\n  esac\n  shlibpath_var=LD_LIBRARY_PATH\n  case $host_os in\n  freebsd2*)\n    shlibpath_overrides_runpath=yes\n    ;;\n  freebsd3.[01]* | freebsdelf3.[01]*)\n    shlibpath_overrides_runpath=yes\n    hardcode_into_libs=yes\n    ;;\n  freebsd3.[2-9]* | freebsdelf3.[2-9]* | \\\n  freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)\n    shlibpath_overrides_runpath=no\n    hardcode_into_libs=yes\n    ;;\n  *) # from 4.6 on, and DragonFly\n    shlibpath_overrides_runpath=yes\n    hardcode_into_libs=yes\n    ;;\n  esac\n  ;;\n\ngnu*)\n  version_type=linux\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LD_LIBRARY_PATH\n  hardcode_into_libs=yes\n  ;;\n\nhpux9* | hpux10* | hpux11*)\n  # Give a soname corresponding to the major version so that dld.sl refuses to\n  # link against other versions.\n  version_type=sunos\n  need_lib_prefix=no\n  need_version=no\n  case $host_cpu in\n  ia64*)\n    shrext_cmds='.so'\n    hardcode_into_libs=yes\n    dynamic_linker=\"$host_os dld.so\"\n    shlibpath_var=LD_LIBRARY_PATH\n    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.\n    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n    soname_spec='${libname}${release}${shared_ext}$major'\n    if test \"X$HPUX_IA64_MODE\" = X32; then\n      sys_lib_search_path_spec=\"/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib\"\n    else\n      sys_lib_search_path_spec=\"/usr/lib/hpux64 /usr/local/lib/hpux64\"\n    fi\n    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec\n    ;;\n  hppa*64*)\n    shrext_cmds='.sl'\n    hardcode_into_libs=yes\n    dynamic_linker=\"$host_os dld.sl\"\n    shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH\n    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.\n    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n    soname_spec='${libname}${release}${shared_ext}$major'\n    sys_lib_search_path_spec=\"/usr/lib/pa20_64 /usr/ccs/lib/pa20_64\"\n    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec\n    ;;\n  *)\n    shrext_cmds='.sl'\n    dynamic_linker=\"$host_os dld.sl\"\n    shlibpath_var=SHLIB_PATH\n    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH\n    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n    soname_spec='${libname}${release}${shared_ext}$major'\n    ;;\n  esac\n  # HP-UX runs *really* slowly unless shared libraries are mode 555.\n  postinstall_cmds='chmod 555 $lib'\n  ;;\n\ninterix[3-9]*)\n  version_type=linux\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=no\n  hardcode_into_libs=yes\n  ;;\n\nirix5* | irix6* | nonstopux*)\n  case $host_os in\n    nonstopux*) version_type=nonstopux ;;\n    *)\n\tif test \"$lt_cv_prog_gnu_ld\" = yes; then\n\t\tversion_type=linux\n\telse\n\t\tversion_type=irix\n\tfi ;;\n  esac\n  need_lib_prefix=no\n  need_version=no\n  soname_spec='${libname}${release}${shared_ext}$major'\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'\n  case $host_os in\n  irix5* | nonstopux*)\n    libsuff= shlibsuff=\n    ;;\n  *)\n    case $LD in # libtool.m4 will add one of these switches to LD\n    *-32|*\"-32 \"|*-melf32bsmip|*\"-melf32bsmip \")\n      libsuff= shlibsuff= libmagic=32-bit;;\n    *-n32|*\"-n32 \"|*-melf32bmipn32|*\"-melf32bmipn32 \")\n      libsuff=32 shlibsuff=N32 libmagic=N32;;\n    *-64|*\"-64 \"|*-melf64bmip|*\"-melf64bmip \")\n      libsuff=64 shlibsuff=64 libmagic=64-bit;;\n    *) libsuff= shlibsuff= libmagic=never-match;;\n    esac\n    ;;\n  esac\n  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH\n  shlibpath_overrides_runpath=no\n  sys_lib_search_path_spec=\"/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}\"\n  sys_lib_dlsearch_path_spec=\"/usr/lib${libsuff} /lib${libsuff}\"\n  hardcode_into_libs=yes\n  ;;\n\n# No shared lib support for Linux oldld, aout, or coff.\nlinux*oldld* | linux*aout* | linux*coff*)\n  dynamic_linker=no\n  ;;\n\n# This must be Linux ELF.\nlinux* | k*bsd*-gnu)\n  version_type=linux\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  finish_cmds='PATH=\"\\$PATH:/sbin\" ldconfig -n $libdir'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=no\n  # Some binutils ld are patched to set DT_RUNPATH\n  save_LDFLAGS=$LDFLAGS\n  save_libdir=$libdir\n  eval \"libdir=/foo; wl=\\\"$lt_prog_compiler_wl_CXX\\\"; \\\n       LDFLAGS=\\\"\\$LDFLAGS $hardcode_libdir_flag_spec_CXX\\\"\"\n  cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\nint\nmain ()\n{\n\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_cxx_try_link \"$LINENO\"; then :\n  if  ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep \"RUNPATH.*$libdir\" >/dev/null; then :\n  shlibpath_overrides_runpath=yes\nfi\nfi\nrm -f core conftest.err conftest.$ac_objext \\\n    conftest$ac_exeext conftest.$ac_ext\n  LDFLAGS=$save_LDFLAGS\n  libdir=$save_libdir\n\n  # This implies no fast_install, which is unacceptable.\n  # Some rework will be needed to allow for fast_install\n  # before this can be enabled.\n  hardcode_into_libs=yes\n\n  # Append ld.so.conf contents to the search path\n  if test -f /etc/ld.so.conf; then\n    lt_ld_extra=`awk '/^include / { system(sprintf(\"cd /etc; cat %s 2>/dev/null\", \\$2)); skip = 1; } { if (!skip) print \\$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[\t ]*hwcap[\t ]/d;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\\n' ' '`\n    sys_lib_dlsearch_path_spec=\"/lib /usr/lib $lt_ld_extra\"\n  fi\n\n  # We used to test for /lib/ld.so.1 and disable shared libraries on\n  # powerpc, because MkLinux only supported shared libraries with the\n  # GNU dynamic linker.  Since this was broken with cross compilers,\n  # most powerpc-linux boxes support dynamic linking these days and\n  # people can always --disable-shared, the test was removed, and we\n  # assume the GNU/Linux dynamic linker is in use.\n  dynamic_linker='GNU/Linux ld.so'\n  ;;\n\nnetbsd*)\n  version_type=sunos\n  need_lib_prefix=no\n  need_version=no\n  if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then\n    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'\n    finish_cmds='PATH=\"\\$PATH:/sbin\" ldconfig -m $libdir'\n    dynamic_linker='NetBSD (a.out) ld.so'\n  else\n    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'\n    soname_spec='${libname}${release}${shared_ext}$major'\n    dynamic_linker='NetBSD ld.elf_so'\n  fi\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=yes\n  hardcode_into_libs=yes\n  ;;\n\nnewsos6)\n  version_type=linux\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=yes\n  ;;\n\n*nto* | *qnx*)\n  version_type=qnx\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=no\n  hardcode_into_libs=yes\n  dynamic_linker='ldqnx.so'\n  ;;\n\nopenbsd*)\n  version_type=sunos\n  sys_lib_dlsearch_path_spec=\"/usr/lib\"\n  need_lib_prefix=no\n  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.\n  case $host_os in\n    openbsd3.3 | openbsd3.3.*)\tneed_version=yes ;;\n    *)\t\t\t\tneed_version=no  ;;\n  esac\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'\n  finish_cmds='PATH=\"\\$PATH:/sbin\" ldconfig -m $libdir'\n  shlibpath_var=LD_LIBRARY_PATH\n  if test -z \"`echo __ELF__ | $CC -E - | $GREP __ELF__`\" || test \"$host_os-$host_cpu\" = \"openbsd2.8-powerpc\"; then\n    case $host_os in\n      openbsd2.[89] | openbsd2.[89].*)\n\tshlibpath_overrides_runpath=no\n\t;;\n      *)\n\tshlibpath_overrides_runpath=yes\n\t;;\n      esac\n  else\n    shlibpath_overrides_runpath=yes\n  fi\n  ;;\n\nos2*)\n  libname_spec='$name'\n  shrext_cmds=\".dll\"\n  need_lib_prefix=no\n  library_names_spec='$libname${shared_ext} $libname.a'\n  dynamic_linker='OS/2 ld.exe'\n  shlibpath_var=LIBPATH\n  ;;\n\nosf3* | osf4* | osf5*)\n  version_type=osf\n  need_lib_prefix=no\n  need_version=no\n  soname_spec='${libname}${release}${shared_ext}$major'\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  shlibpath_var=LD_LIBRARY_PATH\n  sys_lib_search_path_spec=\"/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib\"\n  sys_lib_dlsearch_path_spec=\"$sys_lib_search_path_spec\"\n  ;;\n\nrdos*)\n  dynamic_linker=no\n  ;;\n\nsolaris*)\n  version_type=linux\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=yes\n  hardcode_into_libs=yes\n  # ldd complains unless libraries are executable\n  postinstall_cmds='chmod +x $lib'\n  ;;\n\nsunos4*)\n  version_type=sunos\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'\n  finish_cmds='PATH=\"\\$PATH:/usr/etc\" ldconfig $libdir'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=yes\n  if test \"$with_gnu_ld\" = yes; then\n    need_lib_prefix=no\n  fi\n  need_version=yes\n  ;;\n\nsysv4 | sysv4.3*)\n  version_type=linux\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LD_LIBRARY_PATH\n  case $host_vendor in\n    sni)\n      shlibpath_overrides_runpath=no\n      need_lib_prefix=no\n      runpath_var=LD_RUN_PATH\n      ;;\n    siemens)\n      need_lib_prefix=no\n      ;;\n    motorola)\n      need_lib_prefix=no\n      need_version=no\n      shlibpath_overrides_runpath=no\n      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'\n      ;;\n  esac\n  ;;\n\nsysv4*MP*)\n  if test -d /usr/nec ;then\n    version_type=linux\n    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'\n    soname_spec='$libname${shared_ext}.$major'\n    shlibpath_var=LD_LIBRARY_PATH\n  fi\n  ;;\n\nsysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)\n  version_type=freebsd-elf\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=yes\n  hardcode_into_libs=yes\n  if test \"$with_gnu_ld\" = yes; then\n    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'\n  else\n    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'\n    case $host_os in\n      sco3.2v5*)\n        sys_lib_search_path_spec=\"$sys_lib_search_path_spec /lib\"\n\t;;\n    esac\n  fi\n  sys_lib_dlsearch_path_spec='/usr/lib'\n  ;;\n\ntpf*)\n  # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.\n  version_type=linux\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=no\n  hardcode_into_libs=yes\n  ;;\n\nuts4*)\n  version_type=linux\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LD_LIBRARY_PATH\n  ;;\n\n*)\n  dynamic_linker=no\n  ;;\nesac\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $dynamic_linker\" >&5\n$as_echo \"$dynamic_linker\" >&6; }\ntest \"$dynamic_linker\" = no && can_build_shared=no\n\nvariables_saved_for_relink=\"PATH $shlibpath_var $runpath_var\"\nif test \"$GCC\" = yes; then\n  variables_saved_for_relink=\"$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH\"\nfi\n\nif test \"${lt_cv_sys_lib_search_path_spec+set}\" = set; then\n  sys_lib_search_path_spec=\"$lt_cv_sys_lib_search_path_spec\"\nfi\nif test \"${lt_cv_sys_lib_dlsearch_path_spec+set}\" = set; then\n  sys_lib_dlsearch_path_spec=\"$lt_cv_sys_lib_dlsearch_path_spec\"\nfi\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs\" >&5\n$as_echo_n \"checking how to hardcode library paths into programs... \" >&6; }\nhardcode_action_CXX=\nif test -n \"$hardcode_libdir_flag_spec_CXX\" ||\n   test -n \"$runpath_var_CXX\" ||\n   test \"X$hardcode_automatic_CXX\" = \"Xyes\" ; then\n\n  # We can hardcode non-existent directories.\n  if test \"$hardcode_direct_CXX\" != no &&\n     # If the only mechanism to avoid hardcoding is shlibpath_var, we\n     # have to relink, otherwise we might link with an installed library\n     # when we should be linking with a yet-to-be-installed one\n     ## test \"$_LT_TAGVAR(hardcode_shlibpath_var, CXX)\" != no &&\n     test \"$hardcode_minus_L_CXX\" != no; then\n    # Linking always hardcodes the temporary library directory.\n    hardcode_action_CXX=relink\n  else\n    # We can link without hardcoding, and we can hardcode nonexisting dirs.\n    hardcode_action_CXX=immediate\n  fi\nelse\n  # We cannot hardcode anything, or else we can only hardcode existing\n  # directories.\n  hardcode_action_CXX=unsupported\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $hardcode_action_CXX\" >&5\n$as_echo \"$hardcode_action_CXX\" >&6; }\n\nif test \"$hardcode_action_CXX\" = relink ||\n   test \"$inherit_rpath_CXX\" = yes; then\n  # Fast installation is not supported\n  enable_fast_install=no\nelif test \"$shlibpath_overrides_runpath\" = yes ||\n     test \"$enable_shared\" = no; then\n  # Fast installation is not necessary\n  enable_fast_install=needless\nfi\n\n\n\n\n\n\n\n  fi # test -n \"$compiler\"\n\n  CC=$lt_save_CC\n  LDCXX=$LD\n  LD=$lt_save_LD\n  GCC=$lt_save_GCC\n  with_gnu_ld=$lt_save_with_gnu_ld\n  lt_cv_path_LDCXX=$lt_cv_path_LD\n  lt_cv_path_LD=$lt_save_path_LD\n  lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld\n  lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld\nfi # test \"$_lt_caught_CXX_error\" != yes\n\nac_ext=c\nac_cpp='$CPP $CPPFLAGS'\nac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'\nac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'\nac_compiler_gnu=$ac_cv_c_compiler_gnu\n\n\n\n# Enable support for silent build rules\n# Check whether --enable-silent-rules was given.\nif test \"${enable_silent_rules+set}\" = set; then :\n  enableval=$enable_silent_rules;\nfi\n\ncase $enable_silent_rules in\nyes) AM_DEFAULT_VERBOSITY=0;;\nno)  AM_DEFAULT_VERBOSITY=1;;\n*)   AM_DEFAULT_VERBOSITY=1;;\nesac\nAM_BACKSLASH='\\'\n\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for main in -lc\" >&5\n$as_echo_n \"checking for main in -lc... \" >&6; }\nif test \"${ac_cv_lib_c_main+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  ac_check_lib_save_LIBS=$LIBS\nLIBS=\"-lc  $LIBS\"\ncat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\n\nint\nmain ()\n{\nreturn main ();\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_link \"$LINENO\"; then :\n  ac_cv_lib_c_main=yes\nelse\n  ac_cv_lib_c_main=no\nfi\nrm -f core conftest.err conftest.$ac_objext \\\n    conftest$ac_exeext conftest.$ac_ext\nLIBS=$ac_check_lib_save_LIBS\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_main\" >&5\n$as_echo \"$ac_cv_lib_c_main\" >&6; }\nif test \"x$ac_cv_lib_c_main\" = x\"\"yes; then :\n  cat >>confdefs.h <<_ACEOF\n#define HAVE_LIBC 1\n_ACEOF\n\n  LIBS=\"-lc $LIBS\"\n\nfi\n\n\ncase \"${host_os}\" in\n    cygwin* | mingw32* | beos* | darwin*)\n        ;;\n    *)\n\t{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for sin in -lm\" >&5\n$as_echo_n \"checking for sin in -lm... \" >&6; }\nif test \"${ac_cv_lib_m_sin+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  ac_check_lib_save_LIBS=$LIBS\nLIBS=\"-lm  $LIBS\"\ncat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\n/* Override any GCC internal prototype to avoid an error.\n   Use char because int might match the return type of a GCC\n   builtin and then its argument prototype would still apply.  */\n#ifdef __cplusplus\nextern \"C\"\n#endif\nchar sin ();\nint\nmain ()\n{\nreturn sin ();\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_link \"$LINENO\"; then :\n  ac_cv_lib_m_sin=yes\nelse\n  ac_cv_lib_m_sin=no\nfi\nrm -f core conftest.err conftest.$ac_objext \\\n    conftest$ac_exeext conftest.$ac_ext\nLIBS=$ac_check_lib_save_LIBS\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_sin\" >&5\n$as_echo \"$ac_cv_lib_m_sin\" >&6; }\nif test \"x$ac_cv_lib_m_sin\" = x\"\"yes; then :\n  cat >>confdefs.h <<_ACEOF\n#define HAVE_LIBM 1\n_ACEOF\n\n  LIBS=\"-lm $LIBS\"\n\nfi\n\n        ;;\nesac\n\nfor ac_header in assert.h fcntl.h io.h limits.h malloc.h search.h sys/time.h unistd.h\ndo :\n  as_ac_Header=`$as_echo \"ac_cv_header_$ac_header\" | $as_tr_sh`\nac_fn_c_check_header_mongrel \"$LINENO\" \"$ac_header\" \"$as_ac_Header\" \"$ac_includes_default\"\neval as_val=\\$$as_ac_Header\n   if test \"x$as_val\" = x\"\"yes; then :\n  cat >>confdefs.h <<_ACEOF\n#define `$as_echo \"HAVE_$ac_header\" | $as_tr_cpp` 1\n_ACEOF\n\nfi\n\ndone\n\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const\" >&5\n$as_echo_n \"checking for an ANSI C-conforming const... \" >&6; }\nif test \"${ac_cv_c_const+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\nint\nmain ()\n{\n/* FIXME: Include the comments suggested by Paul. */\n#ifndef __cplusplus\n  /* Ultrix mips cc rejects this.  */\n  typedef int charset[2];\n  const charset cs;\n  /* SunOS 4.1.1 cc rejects this.  */\n  char const *const *pcpcc;\n  char **ppc;\n  /* NEC SVR4.0.2 mips cc rejects this.  */\n  struct point {int x, y;};\n  static struct point const zero = {0,0};\n  /* AIX XL C 1.02.0.0 rejects this.\n     It does not let you subtract one const X* pointer from another in\n     an arm of an if-expression whose if-part is not a constant\n     expression */\n  const char *g = \"string\";\n  pcpcc = &g + (g ? g-g : 0);\n  /* HPUX 7.0 cc rejects these. */\n  ++pcpcc;\n  ppc = (char**) pcpcc;\n  pcpcc = (char const *const *) ppc;\n  { /* SCO 3.2v4 cc rejects this.  */\n    char *t;\n    char const *s = 0 ? (char *) 0 : (char const *) 0;\n\n    *t++ = 0;\n    if (s) return 0;\n  }\n  { /* Someone thinks the Sun supposedly-ANSI compiler will reject this.  */\n    int x[] = {25, 17};\n    const int *foo = &x[0];\n    ++foo;\n  }\n  { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */\n    typedef const int *iptr;\n    iptr p = 0;\n    ++p;\n  }\n  { /* AIX XL C 1.02.0.0 rejects this saying\n       \"k.c\", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */\n    struct s { int j; const int *ap[3]; };\n    struct s *b; b->j = 5;\n  }\n  { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */\n    const int foo = 10;\n    if (!foo) return 0;\n  }\n  return !cs[0] && !zero.x;\n#endif\n\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_compile \"$LINENO\"; then :\n  ac_cv_c_const=yes\nelse\n  ac_cv_c_const=no\nfi\nrm -f core conftest.err conftest.$ac_objext conftest.$ac_ext\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const\" >&5\n$as_echo \"$ac_cv_c_const\" >&6; }\nif test $ac_cv_c_const = no; then\n\n$as_echo \"#define const /**/\" >>confdefs.h\n\nfi\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for inline\" >&5\n$as_echo_n \"checking for inline... \" >&6; }\nif test \"${ac_cv_c_inline+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  ac_cv_c_inline=no\nfor ac_kw in inline __inline__ __inline; do\n  cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n#ifndef __cplusplus\ntypedef int foo_t;\nstatic $ac_kw foo_t static_foo () {return 0; }\n$ac_kw foo_t foo () {return 0; }\n#endif\n\n_ACEOF\nif ac_fn_c_try_compile \"$LINENO\"; then :\n  ac_cv_c_inline=$ac_kw\nfi\nrm -f core conftest.err conftest.$ac_objext conftest.$ac_ext\n  test \"$ac_cv_c_inline\" != no && break\ndone\n\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline\" >&5\n$as_echo \"$ac_cv_c_inline\" >&6; }\n\ncase $ac_cv_c_inline in\n  inline | yes) ;;\n  *)\n    case $ac_cv_c_inline in\n      no) ac_val=;;\n      *) ac_val=$ac_cv_c_inline;;\n    esac\n    cat >>confdefs.h <<_ACEOF\n#ifndef __cplusplus\n#define inline $ac_val\n#endif\n_ACEOF\n    ;;\nesac\n\n { $as_echo \"$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian\" >&5\n$as_echo_n \"checking whether byte ordering is bigendian... \" >&6; }\nif test \"${ac_cv_c_bigendian+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  ac_cv_c_bigendian=unknown\n    # See if we're dealing with a universal compiler.\n    cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n#ifndef __APPLE_CC__\n\t       not a universal capable compiler\n\t     #endif\n\t     typedef int dummy;\n\n_ACEOF\nif ac_fn_c_try_compile \"$LINENO\"; then :\n\n\t# Check for potential -arch flags.  It is not universal unless\n\t# there are at least two -arch flags with different values.\n\tac_arch=\n\tac_prev=\n\tfor ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do\n\t if test -n \"$ac_prev\"; then\n\t   case $ac_word in\n\t     i?86 | x86_64 | ppc | ppc64)\n\t       if test -z \"$ac_arch\" || test \"$ac_arch\" = \"$ac_word\"; then\n\t\t ac_arch=$ac_word\n\t       else\n\t\t ac_cv_c_bigendian=universal\n\t\t break\n\t       fi\n\t       ;;\n\t   esac\n\t   ac_prev=\n\t elif test \"x$ac_word\" = \"x-arch\"; then\n\t   ac_prev=arch\n\t fi\n       done\nfi\nrm -f core conftest.err conftest.$ac_objext conftest.$ac_ext\n    if test $ac_cv_c_bigendian = unknown; then\n      # See if sys/param.h defines the BYTE_ORDER macro.\n      cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n#include <sys/types.h>\n\t     #include <sys/param.h>\n\nint\nmain ()\n{\n#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \\\n\t\t     && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \\\n\t\t     && LITTLE_ENDIAN)\n\t      bogus endian macros\n\t     #endif\n\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_compile \"$LINENO\"; then :\n  # It does; now see whether it defined to BIG_ENDIAN or not.\n\t cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n#include <sys/types.h>\n\t\t#include <sys/param.h>\n\nint\nmain ()\n{\n#if BYTE_ORDER != BIG_ENDIAN\n\t\t not big endian\n\t\t#endif\n\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_compile \"$LINENO\"; then :\n  ac_cv_c_bigendian=yes\nelse\n  ac_cv_c_bigendian=no\nfi\nrm -f core conftest.err conftest.$ac_objext conftest.$ac_ext\nfi\nrm -f core conftest.err conftest.$ac_objext conftest.$ac_ext\n    fi\n    if test $ac_cv_c_bigendian = unknown; then\n      # See if <limits.h> defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris).\n      cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n#include <limits.h>\n\nint\nmain ()\n{\n#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN)\n\t      bogus endian macros\n\t     #endif\n\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_compile \"$LINENO\"; then :\n  # It does; now see whether it defined to _BIG_ENDIAN or not.\n\t cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n#include <limits.h>\n\nint\nmain ()\n{\n#ifndef _BIG_ENDIAN\n\t\t not big endian\n\t\t#endif\n\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_compile \"$LINENO\"; then :\n  ac_cv_c_bigendian=yes\nelse\n  ac_cv_c_bigendian=no\nfi\nrm -f core conftest.err conftest.$ac_objext conftest.$ac_ext\nfi\nrm -f core conftest.err conftest.$ac_objext conftest.$ac_ext\n    fi\n    if test $ac_cv_c_bigendian = unknown; then\n      # Compile a test program.\n      if test \"$cross_compiling\" = yes; then :\n  # Try to guess by grepping values from an object file.\n\t cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\nshort int ascii_mm[] =\n\t\t  { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };\n\t\tshort int ascii_ii[] =\n\t\t  { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };\n\t\tint use_ascii (int i) {\n\t\t  return ascii_mm[i] + ascii_ii[i];\n\t\t}\n\t\tshort int ebcdic_ii[] =\n\t\t  { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };\n\t\tshort int ebcdic_mm[] =\n\t\t  { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };\n\t\tint use_ebcdic (int i) {\n\t\t  return ebcdic_mm[i] + ebcdic_ii[i];\n\t\t}\n\t\textern int foo;\n\nint\nmain ()\n{\nreturn use_ascii (foo) == use_ebcdic (foo);\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_compile \"$LINENO\"; then :\n  if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then\n\t      ac_cv_c_bigendian=yes\n\t    fi\n\t    if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then\n\t      if test \"$ac_cv_c_bigendian\" = unknown; then\n\t\tac_cv_c_bigendian=no\n\t      else\n\t\t# finding both strings is unlikely to happen, but who knows?\n\t\tac_cv_c_bigendian=unknown\n\t      fi\n\t    fi\nfi\nrm -f core conftest.err conftest.$ac_objext conftest.$ac_ext\nelse\n  cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n$ac_includes_default\nint\nmain ()\n{\n\n\t     /* Are we little or big endian?  From Harbison&Steele.  */\n\t     union\n\t     {\n\t       long int l;\n\t       char c[sizeof (long int)];\n\t     } u;\n\t     u.l = 1;\n\t     return u.c[sizeof (long int) - 1] == 1;\n\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_run \"$LINENO\"; then :\n  ac_cv_c_bigendian=no\nelse\n  ac_cv_c_bigendian=yes\nfi\nrm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \\\n  conftest.$ac_objext conftest.beam conftest.$ac_ext\nfi\n\n    fi\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian\" >&5\n$as_echo \"$ac_cv_c_bigendian\" >&6; }\n case $ac_cv_c_bigendian in #(\n   yes)\n     $as_echo \"#define WORDS_BIGENDIAN 1\" >>confdefs.h\n;; #(\n   no)\n      ;; #(\n   universal)\n\n$as_echo \"#define AC_APPLE_UNIVERSAL_BUILD 1\" >>confdefs.h\n\n     ;; #(\n   *)\n     as_fn_error \"unknown endianness\n presetting ac_cv_c_bigendian=no (or yes) will help\" \"$LINENO\" 5 ;;\n esac\n\nac_fn_c_check_type \"$LINENO\" \"off_t\" \"ac_cv_type_off_t\" \"$ac_includes_default\"\nif test \"x$ac_cv_type_off_t\" = x\"\"yes; then :\n\nelse\n\ncat >>confdefs.h <<_ACEOF\n#define off_t long int\n_ACEOF\n\nfi\n\nac_fn_c_check_type \"$LINENO\" \"size_t\" \"ac_cv_type_size_t\" \"$ac_includes_default\"\nif test \"x$ac_cv_type_size_t\" = x\"\"yes; then :\n\nelse\n\ncat >>confdefs.h <<_ACEOF\n#define size_t unsigned int\n_ACEOF\n\nfi\n\n# The cast to long int works around a bug in the HP C Compiler\n# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects\n# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.\n# This bug is HP SR number 8606223364.\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking size of int\" >&5\n$as_echo_n \"checking size of int... \" >&6; }\nif test \"${ac_cv_sizeof_int+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if ac_fn_c_compute_int \"$LINENO\" \"(long int) (sizeof (int))\" \"ac_cv_sizeof_int\"        \"$ac_includes_default\"; then :\n\nelse\n  if test \"$ac_cv_type_int\" = yes; then\n     { { $as_echo \"$as_me:${as_lineno-$LINENO}: error: in \\`$ac_pwd':\" >&5\n$as_echo \"$as_me: error: in \\`$ac_pwd':\" >&2;}\n{ as_fn_set_status 77\nas_fn_error \"cannot compute sizeof (int)\nSee \\`config.log' for more details.\" \"$LINENO\" 5; }; }\n   else\n     ac_cv_sizeof_int=0\n   fi\nfi\n\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_int\" >&5\n$as_echo \"$ac_cv_sizeof_int\" >&6; }\n\n\n\ncat >>confdefs.h <<_ACEOF\n#define SIZEOF_INT $ac_cv_sizeof_int\n_ACEOF\n\n\n# The cast to long int works around a bug in the HP C Compiler\n# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects\n# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.\n# This bug is HP SR number 8606223364.\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking size of long\" >&5\n$as_echo_n \"checking size of long... \" >&6; }\nif test \"${ac_cv_sizeof_long+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if ac_fn_c_compute_int \"$LINENO\" \"(long int) (sizeof (long))\" \"ac_cv_sizeof_long\"        \"$ac_includes_default\"; then :\n\nelse\n  if test \"$ac_cv_type_long\" = yes; then\n     { { $as_echo \"$as_me:${as_lineno-$LINENO}: error: in \\`$ac_pwd':\" >&5\n$as_echo \"$as_me: error: in \\`$ac_pwd':\" >&2;}\n{ as_fn_set_status 77\nas_fn_error \"cannot compute sizeof (long)\nSee \\`config.log' for more details.\" \"$LINENO\" 5; }; }\n   else\n     ac_cv_sizeof_long=0\n   fi\nfi\n\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long\" >&5\n$as_echo \"$ac_cv_sizeof_long\" >&6; }\n\n\n\ncat >>confdefs.h <<_ACEOF\n#define SIZEOF_LONG $ac_cv_sizeof_long\n_ACEOF\n\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included\" >&5\n$as_echo_n \"checking whether time.h and sys/time.h may both be included... \" >&6; }\nif test \"${ac_cv_header_time+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n#include <sys/types.h>\n#include <sys/time.h>\n#include <time.h>\n\nint\nmain ()\n{\nif ((struct tm *) 0)\nreturn 0;\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_compile \"$LINENO\"; then :\n  ac_cv_header_time=yes\nelse\n  ac_cv_header_time=no\nfi\nrm -f core conftest.err conftest.$ac_objext conftest.$ac_ext\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time\" >&5\n$as_echo \"$ac_cv_header_time\" >&6; }\nif test $ac_cv_header_time = yes; then\n\n$as_echo \"#define TIME_WITH_SYS_TIME 1\" >>confdefs.h\n\nfi\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking whether struct tm is in sys/time.h or time.h\" >&5\n$as_echo_n \"checking whether struct tm is in sys/time.h or time.h... \" >&6; }\nif test \"${ac_cv_struct_tm+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n#include <sys/types.h>\n#include <time.h>\n\nint\nmain ()\n{\nstruct tm tm;\n\t\t\t\t     int *p = &tm.tm_sec;\n\t\t\t\t     return !p;\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_compile \"$LINENO\"; then :\n  ac_cv_struct_tm=time.h\nelse\n  ac_cv_struct_tm=sys/time.h\nfi\nrm -f core conftest.err conftest.$ac_objext conftest.$ac_ext\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_struct_tm\" >&5\n$as_echo \"$ac_cv_struct_tm\" >&6; }\nif test $ac_cv_struct_tm = sys/time.h; then\n\n$as_echo \"#define TM_IN_SYS_TIME 1\" >>confdefs.h\n\nfi\n\nac_fn_c_check_type \"$LINENO\" \"int8\" \"ac_cv_type_int8\" \"\n#if HAVE_INTTYPES_H\n# include <inttypes.h>\n#endif\n\n\"\nif test \"x$ac_cv_type_int8\" = x\"\"yes; then :\n\ncat >>confdefs.h <<_ACEOF\n#define HAVE_INT8 1\n_ACEOF\n\n\nfi\nac_fn_c_check_type \"$LINENO\" \"int16\" \"ac_cv_type_int16\" \"\n#if HAVE_INTTYPES_H\n# include <inttypes.h>\n#endif\n\n\"\nif test \"x$ac_cv_type_int16\" = x\"\"yes; then :\n\ncat >>confdefs.h <<_ACEOF\n#define HAVE_INT16 1\n_ACEOF\n\n\nfi\nac_fn_c_check_type \"$LINENO\" \"int32\" \"ac_cv_type_int32\" \"\n#if HAVE_INTTYPES_H\n# include <inttypes.h>\n#endif\n\n\"\nif test \"x$ac_cv_type_int32\" = x\"\"yes; then :\n\ncat >>confdefs.h <<_ACEOF\n#define HAVE_INT32 1\n_ACEOF\n\n\nfi\n\n\n# Obtain size of a 'signed long' and define as SIZEOF_SIGNED_LONG\n# The cast to long int works around a bug in the HP C Compiler\n# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects\n# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.\n# This bug is HP SR number 8606223364.\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking size of signed long\" >&5\n$as_echo_n \"checking size of signed long... \" >&6; }\nif test \"${ac_cv_sizeof_signed_long+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if ac_fn_c_compute_int \"$LINENO\" \"(long int) (sizeof (signed long))\" \"ac_cv_sizeof_signed_long\"        \"$ac_includes_default\"; then :\n\nelse\n  if test \"$ac_cv_type_signed_long\" = yes; then\n     { { $as_echo \"$as_me:${as_lineno-$LINENO}: error: in \\`$ac_pwd':\" >&5\n$as_echo \"$as_me: error: in \\`$ac_pwd':\" >&2;}\n{ as_fn_set_status 77\nas_fn_error \"cannot compute sizeof (signed long)\nSee \\`config.log' for more details.\" \"$LINENO\" 5; }; }\n   else\n     ac_cv_sizeof_signed_long=0\n   fi\nfi\n\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_signed_long\" >&5\n$as_echo \"$ac_cv_sizeof_signed_long\" >&6; }\n\n\n\ncat >>confdefs.h <<_ACEOF\n#define SIZEOF_SIGNED_LONG $ac_cv_sizeof_signed_long\n_ACEOF\n\n\n\n# Obtain size of a 'unsigned long' and define as SIZEOF_UNSIGNED_LONG\n# The cast to long int works around a bug in the HP C Compiler\n# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects\n# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.\n# This bug is HP SR number 8606223364.\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking size of unsigned long\" >&5\n$as_echo_n \"checking size of unsigned long... \" >&6; }\nif test \"${ac_cv_sizeof_unsigned_long+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if ac_fn_c_compute_int \"$LINENO\" \"(long int) (sizeof (unsigned long))\" \"ac_cv_sizeof_unsigned_long\"        \"$ac_includes_default\"; then :\n\nelse\n  if test \"$ac_cv_type_unsigned_long\" = yes; then\n     { { $as_echo \"$as_me:${as_lineno-$LINENO}: error: in \\`$ac_pwd':\" >&5\n$as_echo \"$as_me: error: in \\`$ac_pwd':\" >&2;}\n{ as_fn_set_status 77\nas_fn_error \"cannot compute sizeof (unsigned long)\nSee \\`config.log' for more details.\" \"$LINENO\" 5; }; }\n   else\n     ac_cv_sizeof_unsigned_long=0\n   fi\nfi\n\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_unsigned_long\" >&5\n$as_echo \"$ac_cv_sizeof_unsigned_long\" >&6; }\n\n\n\ncat >>confdefs.h <<_ACEOF\n#define SIZEOF_UNSIGNED_LONG $ac_cv_sizeof_unsigned_long\n_ACEOF\n\n\n\n# Obtain size of a 'long long' and define as SIZEOF_SIGNED_LONG_LONG.\n# If 'long long' is not supported then the value defined is zero.\n# The cast to long int works around a bug in the HP C Compiler\n# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects\n# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.\n# This bug is HP SR number 8606223364.\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking size of signed long long\" >&5\n$as_echo_n \"checking size of signed long long... \" >&6; }\nif test \"${ac_cv_sizeof_signed_long_long+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if ac_fn_c_compute_int \"$LINENO\" \"(long int) (sizeof (signed long long))\" \"ac_cv_sizeof_signed_long_long\"        \"$ac_includes_default\"; then :\n\nelse\n  if test \"$ac_cv_type_signed_long_long\" = yes; then\n     { { $as_echo \"$as_me:${as_lineno-$LINENO}: error: in \\`$ac_pwd':\" >&5\n$as_echo \"$as_me: error: in \\`$ac_pwd':\" >&2;}\n{ as_fn_set_status 77\nas_fn_error \"cannot compute sizeof (signed long long)\nSee \\`config.log' for more details.\" \"$LINENO\" 5; }; }\n   else\n     ac_cv_sizeof_signed_long_long=0\n   fi\nfi\n\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_signed_long_long\" >&5\n$as_echo \"$ac_cv_sizeof_signed_long_long\" >&6; }\n\n\n\ncat >>confdefs.h <<_ACEOF\n#define SIZEOF_SIGNED_LONG_LONG $ac_cv_sizeof_signed_long_long\n_ACEOF\n\n\n\n# Obtain size of a 'unsigned long long' and define as\n# SIZEOF_UNSIGNED_LONG_LONG.  If 'unsigned long long' is not\n# supported then the value defined is zero.\n# The cast to long int works around a bug in the HP C Compiler\n# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects\n# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.\n# This bug is HP SR number 8606223364.\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking size of unsigned long long\" >&5\n$as_echo_n \"checking size of unsigned long long... \" >&6; }\nif test \"${ac_cv_sizeof_unsigned_long_long+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if ac_fn_c_compute_int \"$LINENO\" \"(long int) (sizeof (unsigned long long))\" \"ac_cv_sizeof_unsigned_long_long\"        \"$ac_includes_default\"; then :\n\nelse\n  if test \"$ac_cv_type_unsigned_long_long\" = yes; then\n     { { $as_echo \"$as_me:${as_lineno-$LINENO}: error: in \\`$ac_pwd':\" >&5\n$as_echo \"$as_me: error: in \\`$ac_pwd':\" >&2;}\n{ as_fn_set_status 77\nas_fn_error \"cannot compute sizeof (unsigned long long)\nSee \\`config.log' for more details.\" \"$LINENO\" 5; }; }\n   else\n     ac_cv_sizeof_unsigned_long_long=0\n   fi\nfi\n\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_unsigned_long_long\" >&5\n$as_echo \"$ac_cv_sizeof_unsigned_long_long\" >&6; }\n\n\n\ncat >>confdefs.h <<_ACEOF\n#define SIZEOF_UNSIGNED_LONG_LONG $ac_cv_sizeof_unsigned_long_long\n_ACEOF\n\n\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for signed 64-bit type\" >&5\n$as_echo_n \"checking for signed 64-bit type... \" >&6; }\nINT64_T='none'\nINT64_FORMAT='none'\nif test $ac_cv_sizeof_signed_long -eq 8\nthen\n  INT64_T='signed long'\n  INT64_FORMAT='\"%ld\"'\nelif test $ac_cv_sizeof_signed_long_long -eq 8\nthen\n  INT64_FORMAT='\"%lld\"'\n  INT64_T='signed long long'\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $INT64_T\" >&5\n$as_echo \"$INT64_T\" >&6; }\n\ncat >>confdefs.h <<_ACEOF\n#define TIFF_INT64_T $INT64_T\n_ACEOF\n\n\ncat >>confdefs.h <<_ACEOF\n#define TIFF_INT64_FORMAT $INT64_FORMAT\n_ACEOF\n\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for unsigned 64-bit type\" >&5\n$as_echo_n \"checking for unsigned 64-bit type... \" >&6; }\nUINT64_T='none'\nUINT64_FORMAT='none'\nif test $ac_cv_sizeof_unsigned_long -eq 8\nthen\n  UINT64_T='unsigned long'\n  UINT64_FORMAT='\"%lu\"'\nelif test $ac_cv_sizeof_unsigned_long_long -eq 8\nthen\n  UINT64_T='unsigned long long'\n  UINT64_FORMAT='\"%llu\"'\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $UINT64_T\" >&5\n$as_echo \"$UINT64_T\" >&6; }\n\ncat >>confdefs.h <<_ACEOF\n#define TIFF_UINT64_T $UINT64_T\n_ACEOF\n\n\ncat >>confdefs.h <<_ACEOF\n#define TIFF_UINT64_FORMAT $UINT64_FORMAT\n_ACEOF\n\n\nfor ac_func in floor isascii memmove memset mmap pow setmode sqrt strchr strrchr strstr strtol\ndo :\n  as_ac_var=`$as_echo \"ac_cv_func_$ac_func\" | $as_tr_sh`\nac_fn_c_check_func \"$LINENO\" \"$ac_func\" \"$as_ac_var\"\neval as_val=\\$$as_ac_var\n   if test \"x$as_val\" = x\"\"yes; then :\n  cat >>confdefs.h <<_ACEOF\n#define `$as_echo \"HAVE_$ac_func\" | $as_tr_cpp` 1\n_ACEOF\n\nfi\ndone\n\n\nfor ac_func in getopt\ndo :\n  ac_fn_c_check_func \"$LINENO\" \"getopt\" \"ac_cv_func_getopt\"\nif test \"x$ac_cv_func_getopt\" = x\"\"yes; then :\n  cat >>confdefs.h <<_ACEOF\n#define HAVE_GETOPT 1\n_ACEOF\n\nelse\n  case \" $LIBOBJS \" in\n  *\" $ac_func.$ac_objext \"* ) ;;\n  *) LIBOBJS=\"$LIBOBJS $ac_func.$ac_objext\"\n ;;\nesac\n\nfi\ndone\n\n\nfor ac_func in strcasecmp\ndo :\n  ac_fn_c_check_func \"$LINENO\" \"strcasecmp\" \"ac_cv_func_strcasecmp\"\nif test \"x$ac_cv_func_strcasecmp\" = x\"\"yes; then :\n  cat >>confdefs.h <<_ACEOF\n#define HAVE_STRCASECMP 1\n_ACEOF\n\nelse\n  case \" $LIBOBJS \" in\n  *\" $ac_func.$ac_objext \"* ) ;;\n  *) LIBOBJS=\"$LIBOBJS $ac_func.$ac_objext\"\n ;;\nesac\n\nfi\ndone\n\n\nfor ac_func in strtoul\ndo :\n  ac_fn_c_check_func \"$LINENO\" \"strtoul\" \"ac_cv_func_strtoul\"\nif test \"x$ac_cv_func_strtoul\" = x\"\"yes; then :\n  cat >>confdefs.h <<_ACEOF\n#define HAVE_STRTOUL 1\n_ACEOF\n\nelse\n  case \" $LIBOBJS \" in\n  *\" $ac_func.$ac_objext \"* ) ;;\n  *) LIBOBJS=\"$LIBOBJS $ac_func.$ac_objext\"\n ;;\nesac\n\nfi\ndone\n\n\nfor ac_func in lfind\ndo :\n  ac_fn_c_check_func \"$LINENO\" \"lfind\" \"ac_cv_func_lfind\"\nif test \"x$ac_cv_func_lfind\" = x\"\"yes; then :\n  cat >>confdefs.h <<_ACEOF\n#define HAVE_LFIND 1\n_ACEOF\n\nelse\n  case \" $LIBOBJS \" in\n  *\" $ac_func.$ac_objext \"* ) ;;\n  *) LIBOBJS=\"$LIBOBJS $ac_func.$ac_objext\"\n ;;\nesac\n\nfi\ndone\n\n\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking native cpu bit order\" >&5\n$as_echo_n \"checking native cpu bit order... \" >&6; }\ncase \"$target_cpu\" in\n    i*86*|x86_64*)\n        HOST_FILLORDER=FILLORDER_LSB2MSB\n\t{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: lsb2msb\" >&5\n$as_echo \"lsb2msb\" >&6; }\n\t;;\n    *)\n\tHOST_FILLORDER=FILLORDER_MSB2LSB\n\t{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: msb2lsb\" >&5\n$as_echo \"msb2lsb\" >&6; }\n        ;;\nesac\n\ncat >>confdefs.h <<_ACEOF\n#define HOST_FILLORDER $HOST_FILLORDER\n_ACEOF\n\n\nif test \"$ac_cv_c_bigendian\" = yes ; then\n    HOST_BIGENDIAN=1\nelse\n    HOST_BIGENDIAN=0\nfi\n\ncat >>confdefs.h <<_ACEOF\n#define HOST_BIGENDIAN $HOST_BIGENDIAN\n_ACEOF\n\n\n#_POSIX_C_SOURCE=2\n#AC_DEFINE_UNQUOTED(_POSIX_C_SOURCE, $_POSIX_C_SOURCE, [Define this macro to a positive integer to control which POSIX functionality is made available.])\n\nHAVE_IEEEFP=1\n\ncat >>confdefs.h <<_ACEOF\n#define HAVE_IEEEFP $HAVE_IEEEFP\n_ACEOF\n\n\n\n# Check whether --enable-rpath was given.\nif test \"${enable_rpath+set}\" = set; then :\n  enableval=$enable_rpath; HAVE_RPATH=$enableval\nelse\n  HAVE_RPATH=no\nfi\n\n if test \"$HAVE_RPATH\" = \"yes\"; then\n  HAVE_RPATH_TRUE=\n  HAVE_RPATH_FALSE='#'\nelse\n  HAVE_RPATH_TRUE='#'\n  HAVE_RPATH_FALSE=\nfi\n\n\n\n# Check whether --enable-largefile was given.\nif test \"${enable_largefile+set}\" = set; then :\n  enableval=$enable_largefile;\nfi\n\nif test \"$enable_largefile\" != no; then\n\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files\" >&5\n$as_echo_n \"checking for special C compiler options needed for large files... \" >&6; }\nif test \"${ac_cv_sys_largefile_CC+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  ac_cv_sys_largefile_CC=no\n     if test \"$GCC\" != yes; then\n       ac_save_CC=$CC\n       while :; do\n\t # IRIX 6.2 and later do not support large files by default,\n\t # so use the C compiler's -n32 option if that helps.\n\t cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n#include <sys/types.h>\n /* Check that off_t can represent 2**63 - 1 correctly.\n    We can't simply define LARGE_OFF_T to be 9223372036854775807,\n    since some C++ compilers masquerading as C compilers\n    incorrectly reject 9223372036854775807.  */\n#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))\n  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721\n\t\t       && LARGE_OFF_T % 2147483647 == 1)\n\t\t      ? 1 : -1];\nint\nmain ()\n{\n\n  ;\n  return 0;\n}\n_ACEOF\n\t if ac_fn_c_try_compile \"$LINENO\"; then :\n  break\nfi\nrm -f core conftest.err conftest.$ac_objext\n\t CC=\"$CC -n32\"\n\t if ac_fn_c_try_compile \"$LINENO\"; then :\n  ac_cv_sys_largefile_CC=' -n32'; break\nfi\nrm -f core conftest.err conftest.$ac_objext\n\t break\n       done\n       CC=$ac_save_CC\n       rm -f conftest.$ac_ext\n    fi\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC\" >&5\n$as_echo \"$ac_cv_sys_largefile_CC\" >&6; }\n  if test \"$ac_cv_sys_largefile_CC\" != no; then\n    CC=$CC$ac_cv_sys_largefile_CC\n  fi\n\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files\" >&5\n$as_echo_n \"checking for _FILE_OFFSET_BITS value needed for large files... \" >&6; }\nif test \"${ac_cv_sys_file_offset_bits+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  while :; do\n  cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n#include <sys/types.h>\n /* Check that off_t can represent 2**63 - 1 correctly.\n    We can't simply define LARGE_OFF_T to be 9223372036854775807,\n    since some C++ compilers masquerading as C compilers\n    incorrectly reject 9223372036854775807.  */\n#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))\n  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721\n\t\t       && LARGE_OFF_T % 2147483647 == 1)\n\t\t      ? 1 : -1];\nint\nmain ()\n{\n\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_compile \"$LINENO\"; then :\n  ac_cv_sys_file_offset_bits=no; break\nfi\nrm -f core conftest.err conftest.$ac_objext conftest.$ac_ext\n  cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n#define _FILE_OFFSET_BITS 64\n#include <sys/types.h>\n /* Check that off_t can represent 2**63 - 1 correctly.\n    We can't simply define LARGE_OFF_T to be 9223372036854775807,\n    since some C++ compilers masquerading as C compilers\n    incorrectly reject 9223372036854775807.  */\n#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))\n  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721\n\t\t       && LARGE_OFF_T % 2147483647 == 1)\n\t\t      ? 1 : -1];\nint\nmain ()\n{\n\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_compile \"$LINENO\"; then :\n  ac_cv_sys_file_offset_bits=64; break\nfi\nrm -f core conftest.err conftest.$ac_objext conftest.$ac_ext\n  ac_cv_sys_file_offset_bits=unknown\n  break\ndone\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits\" >&5\n$as_echo \"$ac_cv_sys_file_offset_bits\" >&6; }\ncase $ac_cv_sys_file_offset_bits in #(\n  no | unknown) ;;\n  *)\ncat >>confdefs.h <<_ACEOF\n#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits\n_ACEOF\n;;\nesac\nrm -rf conftest*\n  if test $ac_cv_sys_file_offset_bits = unknown; then\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files\" >&5\n$as_echo_n \"checking for _LARGE_FILES value needed for large files... \" >&6; }\nif test \"${ac_cv_sys_large_files+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  while :; do\n  cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n#include <sys/types.h>\n /* Check that off_t can represent 2**63 - 1 correctly.\n    We can't simply define LARGE_OFF_T to be 9223372036854775807,\n    since some C++ compilers masquerading as C compilers\n    incorrectly reject 9223372036854775807.  */\n#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))\n  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721\n\t\t       && LARGE_OFF_T % 2147483647 == 1)\n\t\t      ? 1 : -1];\nint\nmain ()\n{\n\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_compile \"$LINENO\"; then :\n  ac_cv_sys_large_files=no; break\nfi\nrm -f core conftest.err conftest.$ac_objext conftest.$ac_ext\n  cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n#define _LARGE_FILES 1\n#include <sys/types.h>\n /* Check that off_t can represent 2**63 - 1 correctly.\n    We can't simply define LARGE_OFF_T to be 9223372036854775807,\n    since some C++ compilers masquerading as C compilers\n    incorrectly reject 9223372036854775807.  */\n#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))\n  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721\n\t\t       && LARGE_OFF_T % 2147483647 == 1)\n\t\t      ? 1 : -1];\nint\nmain ()\n{\n\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_compile \"$LINENO\"; then :\n  ac_cv_sys_large_files=1; break\nfi\nrm -f core conftest.err conftest.$ac_objext conftest.$ac_ext\n  ac_cv_sys_large_files=unknown\n  break\ndone\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files\" >&5\n$as_echo \"$ac_cv_sys_large_files\" >&6; }\ncase $ac_cv_sys_large_files in #(\n  no | unknown) ;;\n  *)\ncat >>confdefs.h <<_ACEOF\n#define _LARGE_FILES $ac_cv_sys_large_files\n_ACEOF\n;;\nesac\nrm -rf conftest*\n  fi\nfi\n\n\n\nLIBTIFF_DOCDIR=\\${prefix}/share/doc/${PACKAGE}-${LIBTIFF_VERSION}\n\n\n# Check whether --with-docdir was given.\nif test \"${with_docdir+set}\" = set; then :\n  withval=$with_docdir;\nfi\n\nif test \"x$with_docdir\" != \"x\" ; then\n  LIBTIFF_DOCDIR=$with_docdir\nfi\n\n\n\n\n# Check whether --enable-ccitt was given.\nif test \"${enable_ccitt+set}\" = set; then :\n  enableval=$enable_ccitt; HAVE_CCITT=$enableval\nelse\n  HAVE_CCITT=yes\nfi\n\n\nif test \"$HAVE_CCITT\" = \"yes\" ; then\n\n$as_echo \"#define CCITT_SUPPORT 1\" >>confdefs.h\n\nfi\n\n# Check whether --enable-packbits was given.\nif test \"${enable_packbits+set}\" = set; then :\n  enableval=$enable_packbits; HAVE_PACKBITS=$enableval\nelse\n  HAVE_PACKBITS=yes\nfi\n\n\nif test \"$HAVE_PACKBITS\" = \"yes\" ; then\n\n$as_echo \"#define PACKBITS_SUPPORT 1\" >>confdefs.h\n\nfi\n\n# Check whether --enable-lzw was given.\nif test \"${enable_lzw+set}\" = set; then :\n  enableval=$enable_lzw; HAVE_LZW=$enableval\nelse\n  HAVE_LZW=yes\nfi\n\n\nif test \"$HAVE_LZW\" = \"yes\" ; then\n\n$as_echo \"#define LZW_SUPPORT 1\" >>confdefs.h\n\nfi\n\n# Check whether --enable-thunder was given.\nif test \"${enable_thunder+set}\" = set; then :\n  enableval=$enable_thunder; HAVE_THUNDER=$enableval\nelse\n  HAVE_THUNDER=yes\nfi\n\n\nif test \"$HAVE_THUNDER\" = \"yes\" ; then\n\n$as_echo \"#define THUNDER_SUPPORT 1\" >>confdefs.h\n\nfi\n\nHAVE_NEXT=yes\n\n# Check whether --enable-next was given.\nif test \"${enable_next+set}\" = set; then :\n  enableval=$enable_next; HAVE_NEXT=$enableval\nelse\n  HAVE_NEXT=yes\nfi\n\n\nif test \"$HAVE_NEXT\" = \"yes\" ; then\n\n$as_echo \"#define NEXT_SUPPORT 1\" >>confdefs.h\n\nfi\n\n# Check whether --enable-logluv was given.\nif test \"${enable_logluv+set}\" = set; then :\n  enableval=$enable_logluv; HAVE_LOGLUV=$enableval\nelse\n  HAVE_LOGLUV=yes\nfi\n\n\nif test \"$HAVE_LOGLUV\" = \"yes\" ; then\n\n$as_echo \"#define LOGLUV_SUPPORT 1\" >>confdefs.h\n\nfi\n\n\n# Check whether --enable-mdi was given.\nif test \"${enable_mdi+set}\" = set; then :\n  enableval=$enable_mdi; HAVE_MDI=$enableval\nelse\n  HAVE_MDI=yes\nfi\n\n\nif test \"$HAVE_MDI\" = \"yes\" ; then\n\n$as_echo \"#define MDI_SUPPORT 1\" >>confdefs.h\n\nfi\n\n\nHAVE_ZLIB=no\n\n# Check whether --enable-zlib was given.\nif test \"${enable_zlib+set}\" = set; then :\n  enableval=$enable_zlib;\nfi\n\n\n# Check whether --with-zlib-include-dir was given.\nif test \"${with_zlib_include_dir+set}\" = set; then :\n  withval=$with_zlib_include_dir;\nfi\n\n\n# Check whether --with-zlib-lib-dir was given.\nif test \"${with_zlib_lib_dir+set}\" = set; then :\n  withval=$with_zlib_lib_dir;\nfi\n\n\nif test \"x$enable_zlib\" != \"xno\" ; then\n\n  if test \"x$with_zlib_lib_dir\" != \"x\" ; then\n    LDFLAGS=\"-L$with_zlib_lib_dir $LDFLAGS\"\n  fi\n\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking for inflateEnd in -lz\" >&5\n$as_echo_n \"checking for inflateEnd in -lz... \" >&6; }\nif test \"${ac_cv_lib_z_inflateEnd+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  ac_check_lib_save_LIBS=$LIBS\nLIBS=\"-lz  $LIBS\"\ncat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\n/* Override any GCC internal prototype to avoid an error.\n   Use char because int might match the return type of a GCC\n   builtin and then its argument prototype would still apply.  */\n#ifdef __cplusplus\nextern \"C\"\n#endif\nchar inflateEnd ();\nint\nmain ()\n{\nreturn inflateEnd ();\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_link \"$LINENO\"; then :\n  ac_cv_lib_z_inflateEnd=yes\nelse\n  ac_cv_lib_z_inflateEnd=no\nfi\nrm -f core conftest.err conftest.$ac_objext \\\n    conftest$ac_exeext conftest.$ac_ext\nLIBS=$ac_check_lib_save_LIBS\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_inflateEnd\" >&5\n$as_echo \"$ac_cv_lib_z_inflateEnd\" >&6; }\nif test \"x$ac_cv_lib_z_inflateEnd\" = x\"\"yes; then :\n  zlib_lib=yes\nelse\n  zlib_lib=no\nfi\n\n  if test \"$zlib_lib\" = \"no\" -a \"x$with_zlib_lib_dir\" != \"x\"; then\n    as_fn_error \"Zlib library not found at $with_zlib_lib_dir\" \"$LINENO\" 5\n  fi\n\n  if test \"x$with_zlib_include_dir\" != \"x\" ; then\n    CPPFLAGS=\"-I$with_zlib_include_dir $CPPFLAGS\"\n  fi\n  ac_fn_c_check_header_mongrel \"$LINENO\" \"zlib.h\" \"ac_cv_header_zlib_h\" \"$ac_includes_default\"\nif test \"x$ac_cv_header_zlib_h\" = x\"\"yes; then :\n  zlib_h=yes\nelse\n  zlib_h=no\nfi\n\n\n  if test \"$zlib_h\" = \"no\" -a \"x$with_zlib_include_dir\" != \"x\" ; then\n    as_fn_error \"Zlib headers not found at $with_zlib_include_dir\" \"$LINENO\" 5\n  fi\n\n  if test \"$zlib_lib\" = \"yes\" -a \"$zlib_h\" = \"yes\" ; then\n    HAVE_ZLIB=yes\n  fi\n\nfi\n\nif test \"$HAVE_ZLIB\" = \"yes\" ; then\n\n$as_echo \"#define ZIP_SUPPORT 1\" >>confdefs.h\n\n  LIBS=\"-lz $LIBS\"\n\n  if test \"$HAVE_RPATH\" = \"yes\" -a \"x$with_zlib_lib_dir\" != \"x\" ; then\n    LIBDIR=\"-R $with_zlib_lib_dir $LIBDIR\"\n  fi\n\nfi\n\n\n# Check whether --enable-pixarlog was given.\nif test \"${enable_pixarlog+set}\" = set; then :\n  enableval=$enable_pixarlog; HAVE_PIXARLOG=$enableval\nelse\n  HAVE_PIXARLOG=yes\nfi\n\n\nif test \"$HAVE_ZLIB\" = \"yes\" -a \"$HAVE_PIXARLOG\" = \"yes\" ; then\n\n$as_echo \"#define PIXARLOG_SUPPORT 1\" >>confdefs.h\n\nelse\n  HAVE_PIXARLOG=no\nfi\n\n\nHAVE_JPEG=no\n\n# Check whether --enable-jpeg was given.\nif test \"${enable_jpeg+set}\" = set; then :\n  enableval=$enable_jpeg;\nfi\n\n\n# Check whether --with-jpeg-include-dir was given.\nif test \"${with_jpeg_include_dir+set}\" = set; then :\n  withval=$with_jpeg_include_dir;\nfi\n\n\n# Check whether --with-jpeg-lib-dir was given.\nif test \"${with_jpeg_lib_dir+set}\" = set; then :\n  withval=$with_jpeg_lib_dir;\nfi\n\n\nif test \"x$enable_jpeg\" != \"xno\" ; then\n\n  if test \"x$with_jpeg_lib_dir\" != \"x\" ; then\n    LDFLAGS=\"-L$with_jpeg_lib_dir $LDFLAGS\"\n\n  fi\n\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking for jpeg_read_scanlines in -ljpeg\" >&5\n$as_echo_n \"checking for jpeg_read_scanlines in -ljpeg... \" >&6; }\nif test \"${ac_cv_lib_jpeg_jpeg_read_scanlines+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  ac_check_lib_save_LIBS=$LIBS\nLIBS=\"-ljpeg  $LIBS\"\ncat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\n/* Override any GCC internal prototype to avoid an error.\n   Use char because int might match the return type of a GCC\n   builtin and then its argument prototype would still apply.  */\n#ifdef __cplusplus\nextern \"C\"\n#endif\nchar jpeg_read_scanlines ();\nint\nmain ()\n{\nreturn jpeg_read_scanlines ();\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_link \"$LINENO\"; then :\n  ac_cv_lib_jpeg_jpeg_read_scanlines=yes\nelse\n  ac_cv_lib_jpeg_jpeg_read_scanlines=no\nfi\nrm -f core conftest.err conftest.$ac_objext \\\n    conftest$ac_exeext conftest.$ac_ext\nLIBS=$ac_check_lib_save_LIBS\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_jpeg_jpeg_read_scanlines\" >&5\n$as_echo \"$ac_cv_lib_jpeg_jpeg_read_scanlines\" >&6; }\nif test \"x$ac_cv_lib_jpeg_jpeg_read_scanlines\" = x\"\"yes; then :\n  jpeg_lib=yes\nelse\n  jpeg_lib=no\nfi\n\n  if test \"$jpeg_lib\" = \"no\" -a \"x$with_jpeg_lib_dir\" != \"x\" ; then\n    as_fn_error \"IJG JPEG library not found at $with_jpeg_lib_dir\" \"$LINENO\" 5\n  fi\n\n  if test \"x$with_jpeg_include_dir\" != \"x\" ; then\n    CPPFLAGS=\"-I$with_jpeg_include_dir $CPPFLAGS\"\n  fi\n  ac_fn_c_check_header_mongrel \"$LINENO\" \"jpeglib.h\" \"ac_cv_header_jpeglib_h\" \"$ac_includes_default\"\nif test \"x$ac_cv_header_jpeglib_h\" = x\"\"yes; then :\n  jpeg_h=yes\nelse\n  jpeg_h=no\nfi\n\n\n  if test \"$jpeg_h\" = \"no\" -a \"x$with_jpeg_include_dir\" != \"x\" ; then\n    as_fn_error \"IJG JPEG library headers not found at $with_jpeg_include_dir\" \"$LINENO\" 5\n  fi\n\n  if test \"$jpeg_lib\" = \"yes\" -a \"$jpeg_h\" = \"yes\" ; then\n    HAVE_JPEG=yes\n  fi\n\nfi\n\nif test \"$HAVE_JPEG\" = \"yes\" ; then\n\n$as_echo \"#define JPEG_SUPPORT 1\" >>confdefs.h\n\n  LIBS=\"-ljpeg $LIBS\"\n\n  if test \"$HAVE_RPATH\" = \"yes\" -a \"x$with_jpeg_lib_dir\" != \"x\" ; then\n    LIBDIR=\"-R $with_jpeg_lib_dir $LIBDIR\"\n  fi\n\nfi\n\n\n# Check whether --enable-old-jpeg was given.\nif test \"${enable_old_jpeg+set}\" = set; then :\n  enableval=$enable_old_jpeg; HAVE_OJPEG=${enableval}\nelse\n  HAVE_OJPEG=yes\nfi\n\n\nif test \"$HAVE_JPEG\" = \"yes\" -a \"$HAVE_OJPEG\" = \"yes\" ; then\n\n$as_echo \"#define OJPEG_SUPPORT 1\" >>confdefs.h\n\nelse\n  HAVE_OJPEG=no\nfi\n\n\nHAVE_JBIG=no\n\n# Check whether --enable-jbig was given.\nif test \"${enable_jbig+set}\" = set; then :\n  enableval=$enable_jbig;\nfi\n\n\n# Check whether --with-jbig-include-dir was given.\nif test \"${with_jbig_include_dir+set}\" = set; then :\n  withval=$with_jbig_include_dir;\nfi\n\n\n# Check whether --with-jbig-lib-dir was given.\nif test \"${with_jbig_lib_dir+set}\" = set; then :\n  withval=$with_jbig_lib_dir;\nfi\n\n\nif test \"x$enable_jbig\" != \"xno\" ; then\n\n  if test \"x$with_jbig_lib_dir\" != \"x\" ; then\n    LDFLAGS=\"-L$with_jbig_lib_dir $LDFLAGS\"\n\n  fi\n\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking for jbg_dec_init in -ljbig\" >&5\n$as_echo_n \"checking for jbg_dec_init in -ljbig... \" >&6; }\nif test \"${ac_cv_lib_jbig_jbg_dec_init+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  ac_check_lib_save_LIBS=$LIBS\nLIBS=\"-ljbig  $LIBS\"\ncat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\n/* Override any GCC internal prototype to avoid an error.\n   Use char because int might match the return type of a GCC\n   builtin and then its argument prototype would still apply.  */\n#ifdef __cplusplus\nextern \"C\"\n#endif\nchar jbg_dec_init ();\nint\nmain ()\n{\nreturn jbg_dec_init ();\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_link \"$LINENO\"; then :\n  ac_cv_lib_jbig_jbg_dec_init=yes\nelse\n  ac_cv_lib_jbig_jbg_dec_init=no\nfi\nrm -f core conftest.err conftest.$ac_objext \\\n    conftest$ac_exeext conftest.$ac_ext\nLIBS=$ac_check_lib_save_LIBS\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_jbig_jbg_dec_init\" >&5\n$as_echo \"$ac_cv_lib_jbig_jbg_dec_init\" >&6; }\nif test \"x$ac_cv_lib_jbig_jbg_dec_init\" = x\"\"yes; then :\n  jbig_lib=yes\nelse\n  jbig_lib=no\nfi\n\n  if test \"$jbig_lib\" = \"no\" -a \"x$with_jbig_lib_dir\" != \"x\" ; then\n    as_fn_error \"JBIG-KIT library not found at $with_jbig_lib_dir\" \"$LINENO\" 5\n  fi\n\n  if test \"x$with_jbig_include_dir\" != \"x\" ; then\n    CPPFLAGS=\"-I$with_jbig_include_dir $CPPFLAGS\"\n  fi\n  ac_fn_c_check_header_mongrel \"$LINENO\" \"jbig.h\" \"ac_cv_header_jbig_h\" \"$ac_includes_default\"\nif test \"x$ac_cv_header_jbig_h\" = x\"\"yes; then :\n  jbig_h=yes\nelse\n  jbig_h=no\nfi\n\n\n  if test \"$jbig_h\" = \"no\" -a \"x$with_jbig_include_dir\" != \"x\" ; then\n    as_fn_error \"JBIG-KIT library headers not found at $with_jbig_include_dir\" \"$LINENO\" 5\n  fi\n\n  if test \"$jbig_lib\" = \"yes\" -a \"$jbig_h\" = \"yes\" ; then\n    HAVE_JBIG=yes\n  fi\n\nfi\n\nif test \"$HAVE_JBIG\" = \"yes\" ; then\n\n$as_echo \"#define JBIG_SUPPORT 1\" >>confdefs.h\n\n  LIBS=\"-ljbig $LIBS\"\n\n  if test \"$HAVE_RPATH\" = \"yes\" -a \"x$with_jbig_lib_dir\" != \"x\" ; then\n    LIBDIR=\"-R $with_jbig_lib_dir $LIBDIR\"\n  fi\n\n  # Older versions of jbigkit lack jbg_newlen\n  for ac_func in jbg_newlen\ndo :\n  ac_fn_c_check_func \"$LINENO\" \"jbg_newlen\" \"ac_cv_func_jbg_newlen\"\nif test \"x$ac_cv_func_jbg_newlen\" = x\"\"yes; then :\n  cat >>confdefs.h <<_ACEOF\n#define HAVE_JBG_NEWLEN 1\n_ACEOF\n\nfi\ndone\n\n\nfi\n\n\n# Check whether --enable-cxx was given.\nif test \"${enable_cxx+set}\" = set; then :\n  enableval=$enable_cxx; HAVE_CXX=$enableval\nelse\n  HAVE_CXX=yes\nfi\n\n\nif test \"$HAVE_CXX\" = \"yes\" ; then\n\n$as_echo \"#define CXX_SUPPORT 1\" >>confdefs.h\n\nelse\n  HAVE_CXX=no\nfi\n\n if test \"$HAVE_CXX\" = \"yes\"; then\n  HAVE_CXX_TRUE=\n  HAVE_CXX_FALSE='#'\nelse\n  HAVE_CXX_TRUE='#'\n  HAVE_CXX_FALSE=\nfi\n\n\n\nHAVE_OPENGL=no\n\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for X\" >&5\n$as_echo_n \"checking for X... \" >&6; }\n\n\n# Check whether --with-x was given.\nif test \"${with_x+set}\" = set; then :\n  withval=$with_x;\nfi\n\n# $have_x is `yes', `no', `disabled', or empty when we do not yet know.\nif test \"x$with_x\" = xno; then\n  # The user explicitly disabled X.\n  have_x=disabled\nelse\n  case $x_includes,$x_libraries in #(\n    *\\'*) as_fn_error \"cannot use X directory names containing '\" \"$LINENO\" 5;; #(\n    *,NONE | NONE,*) if test \"${ac_cv_have_x+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  # One or both of the vars are not set, and there is no cached value.\nac_x_includes=no ac_x_libraries=no\nrm -f -r conftest.dir\nif mkdir conftest.dir; then\n  cd conftest.dir\n  cat >Imakefile <<'_ACEOF'\nincroot:\n\t@echo incroot='${INCROOT}'\nusrlibdir:\n\t@echo usrlibdir='${USRLIBDIR}'\nlibdir:\n\t@echo libdir='${LIBDIR}'\n_ACEOF\n  if (export CC; ${XMKMF-xmkmf}) >/dev/null 2>/dev/null && test -f Makefile; then\n    # GNU make sometimes prints \"make[1]: Entering...\", which would confuse us.\n    for ac_var in incroot usrlibdir libdir; do\n      eval \"ac_im_$ac_var=\\`\\${MAKE-make} $ac_var 2>/dev/null | sed -n 's/^$ac_var=//p'\\`\"\n    done\n    # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR.\n    for ac_extension in a so sl dylib la dll; do\n      if test ! -f \"$ac_im_usrlibdir/libX11.$ac_extension\" &&\n\t test -f \"$ac_im_libdir/libX11.$ac_extension\"; then\n\tac_im_usrlibdir=$ac_im_libdir; break\n      fi\n    done\n    # Screen out bogus values from the imake configuration.  They are\n    # bogus both because they are the default anyway, and because\n    # using them would break gcc on systems where it needs fixed includes.\n    case $ac_im_incroot in\n\t/usr/include) ac_x_includes= ;;\n\t*) test -f \"$ac_im_incroot/X11/Xos.h\" && ac_x_includes=$ac_im_incroot;;\n    esac\n    case $ac_im_usrlibdir in\n\t/usr/lib | /usr/lib64 | /lib | /lib64) ;;\n\t*) test -d \"$ac_im_usrlibdir\" && ac_x_libraries=$ac_im_usrlibdir ;;\n    esac\n  fi\n  cd ..\n  rm -f -r conftest.dir\nfi\n\n# Standard set of common directories for X headers.\n# Check X11 before X11Rn because it is often a symlink to the current release.\nac_x_header_dirs='\n/usr/X11/include\n/usr/X11R7/include\n/usr/X11R6/include\n/usr/X11R5/include\n/usr/X11R4/include\n\n/usr/include/X11\n/usr/include/X11R7\n/usr/include/X11R6\n/usr/include/X11R5\n/usr/include/X11R4\n\n/usr/local/X11/include\n/usr/local/X11R7/include\n/usr/local/X11R6/include\n/usr/local/X11R5/include\n/usr/local/X11R4/include\n\n/usr/local/include/X11\n/usr/local/include/X11R7\n/usr/local/include/X11R6\n/usr/local/include/X11R5\n/usr/local/include/X11R4\n\n/usr/X386/include\n/usr/x386/include\n/usr/XFree86/include/X11\n\n/usr/include\n/usr/local/include\n/usr/unsupported/include\n/usr/athena/include\n/usr/local/x11r5/include\n/usr/lpp/Xamples/include\n\n/usr/openwin/include\n/usr/openwin/share/include'\n\nif test \"$ac_x_includes\" = no; then\n  # Guess where to find include files, by looking for Xlib.h.\n  # First, try using that file with no special directory specified.\n  cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n#include <X11/Xlib.h>\n_ACEOF\nif ac_fn_c_try_cpp \"$LINENO\"; then :\n  # We can compile using X headers with no special include directory.\nac_x_includes=\nelse\n  for ac_dir in $ac_x_header_dirs; do\n  if test -r \"$ac_dir/X11/Xlib.h\"; then\n    ac_x_includes=$ac_dir\n    break\n  fi\ndone\nfi\nrm -f conftest.err conftest.$ac_ext\nfi # $ac_x_includes = no\n\nif test \"$ac_x_libraries\" = no; then\n  # Check for the libraries.\n  # See if we find them without any special options.\n  # Don't add to $LIBS permanently.\n  ac_save_LIBS=$LIBS\n  LIBS=\"-lX11 $LIBS\"\n  cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n#include <X11/Xlib.h>\nint\nmain ()\n{\nXrmInitialize ()\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_link \"$LINENO\"; then :\n  LIBS=$ac_save_LIBS\n# We can link X programs with no special library path.\nac_x_libraries=\nelse\n  LIBS=$ac_save_LIBS\nfor ac_dir in `$as_echo \"$ac_x_includes $ac_x_header_dirs\" | sed s/include/lib/g`\ndo\n  # Don't even attempt the hair of trying to link an X program!\n  for ac_extension in a so sl dylib la dll; do\n    if test -r \"$ac_dir/libX11.$ac_extension\"; then\n      ac_x_libraries=$ac_dir\n      break 2\n    fi\n  done\ndone\nfi\nrm -f core conftest.err conftest.$ac_objext \\\n    conftest$ac_exeext conftest.$ac_ext\nfi # $ac_x_libraries = no\n\ncase $ac_x_includes,$ac_x_libraries in #(\n  no,* | *,no | *\\'*)\n    # Didn't find X, or a directory has \"'\" in its name.\n    ac_cv_have_x=\"have_x=no\";; #(\n  *)\n    # Record where we found X for the cache.\n    ac_cv_have_x=\"have_x=yes\\\n\tac_x_includes='$ac_x_includes'\\\n\tac_x_libraries='$ac_x_libraries'\"\nesac\nfi\n;; #(\n    *) have_x=yes;;\n  esac\n  eval \"$ac_cv_have_x\"\nfi # $with_x != no\n\nif test \"$have_x\" != yes; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $have_x\" >&5\n$as_echo \"$have_x\" >&6; }\n  no_x=yes\nelse\n  # If each of the values was on the command line, it overrides each guess.\n  test \"x$x_includes\" = xNONE && x_includes=$ac_x_includes\n  test \"x$x_libraries\" = xNONE && x_libraries=$ac_x_libraries\n  # Update the cache value to reflect the command line values.\n  ac_cv_have_x=\"have_x=yes\\\n\tac_x_includes='$x_includes'\\\n\tac_x_libraries='$x_libraries'\"\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: libraries $x_libraries, headers $x_includes\" >&5\n$as_echo \"libraries $x_libraries, headers $x_includes\" >&6; }\nfi\n\nif test \"$no_x\" = yes; then\n  # Not all programs may use this symbol, but it does not hurt to define it.\n\n$as_echo \"#define X_DISPLAY_MISSING 1\" >>confdefs.h\n\n  X_CFLAGS= X_PRE_LIBS= X_LIBS= X_EXTRA_LIBS=\nelse\n  if test -n \"$x_includes\"; then\n    X_CFLAGS=\"$X_CFLAGS -I$x_includes\"\n  fi\n\n  # It would also be nice to do this for all -L options, not just this one.\n  if test -n \"$x_libraries\"; then\n    X_LIBS=\"$X_LIBS -L$x_libraries\"\n    # For Solaris; some versions of Sun CC require a space after -R and\n    # others require no space.  Words are not sufficient . . . .\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: checking whether -R must be followed by a space\" >&5\n$as_echo_n \"checking whether -R must be followed by a space... \" >&6; }\n    ac_xsave_LIBS=$LIBS; LIBS=\"$LIBS -R$x_libraries\"\n    ac_xsave_c_werror_flag=$ac_c_werror_flag\n    ac_c_werror_flag=yes\n    cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\nint\nmain ()\n{\n\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_link \"$LINENO\"; then :\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\n       X_LIBS=\"$X_LIBS -R$x_libraries\"\nelse\n  LIBS=\"$ac_xsave_LIBS -R $x_libraries\"\n       cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\nint\nmain ()\n{\n\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_link \"$LINENO\"; then :\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: yes\" >&5\n$as_echo \"yes\" >&6; }\n\t  X_LIBS=\"$X_LIBS -R $x_libraries\"\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: neither works\" >&5\n$as_echo \"neither works\" >&6; }\nfi\nrm -f core conftest.err conftest.$ac_objext \\\n    conftest$ac_exeext conftest.$ac_ext\nfi\nrm -f core conftest.err conftest.$ac_objext \\\n    conftest$ac_exeext conftest.$ac_ext\n    ac_c_werror_flag=$ac_xsave_c_werror_flag\n    LIBS=$ac_xsave_LIBS\n  fi\n\n  # Check for system-dependent libraries X programs must link with.\n  # Do this before checking for the system-independent R6 libraries\n  # (-lICE), since we may need -lsocket or whatever for X linking.\n\n  if test \"$ISC\" = yes; then\n    X_EXTRA_LIBS=\"$X_EXTRA_LIBS -lnsl_s -linet\"\n  else\n    # Martyn Johnson says this is needed for Ultrix, if the X\n    # libraries were built with DECnet support.  And Karl Berry says\n    # the Alpha needs dnet_stub (dnet does not exist).\n    ac_xsave_LIBS=\"$LIBS\"; LIBS=\"$LIBS $X_LIBS -lX11\"\n    cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\n/* Override any GCC internal prototype to avoid an error.\n   Use char because int might match the return type of a GCC\n   builtin and then its argument prototype would still apply.  */\n#ifdef __cplusplus\nextern \"C\"\n#endif\nchar XOpenDisplay ();\nint\nmain ()\n{\nreturn XOpenDisplay ();\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_link \"$LINENO\"; then :\n\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking for dnet_ntoa in -ldnet\" >&5\n$as_echo_n \"checking for dnet_ntoa in -ldnet... \" >&6; }\nif test \"${ac_cv_lib_dnet_dnet_ntoa+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  ac_check_lib_save_LIBS=$LIBS\nLIBS=\"-ldnet  $LIBS\"\ncat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\n/* Override any GCC internal prototype to avoid an error.\n   Use char because int might match the return type of a GCC\n   builtin and then its argument prototype would still apply.  */\n#ifdef __cplusplus\nextern \"C\"\n#endif\nchar dnet_ntoa ();\nint\nmain ()\n{\nreturn dnet_ntoa ();\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_link \"$LINENO\"; then :\n  ac_cv_lib_dnet_dnet_ntoa=yes\nelse\n  ac_cv_lib_dnet_dnet_ntoa=no\nfi\nrm -f core conftest.err conftest.$ac_objext \\\n    conftest$ac_exeext conftest.$ac_ext\nLIBS=$ac_check_lib_save_LIBS\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dnet_dnet_ntoa\" >&5\n$as_echo \"$ac_cv_lib_dnet_dnet_ntoa\" >&6; }\nif test \"x$ac_cv_lib_dnet_dnet_ntoa\" = x\"\"yes; then :\n  X_EXTRA_LIBS=\"$X_EXTRA_LIBS -ldnet\"\nfi\n\n    if test $ac_cv_lib_dnet_dnet_ntoa = no; then\n      { $as_echo \"$as_me:${as_lineno-$LINENO}: checking for dnet_ntoa in -ldnet_stub\" >&5\n$as_echo_n \"checking for dnet_ntoa in -ldnet_stub... \" >&6; }\nif test \"${ac_cv_lib_dnet_stub_dnet_ntoa+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  ac_check_lib_save_LIBS=$LIBS\nLIBS=\"-ldnet_stub  $LIBS\"\ncat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\n/* Override any GCC internal prototype to avoid an error.\n   Use char because int might match the return type of a GCC\n   builtin and then its argument prototype would still apply.  */\n#ifdef __cplusplus\nextern \"C\"\n#endif\nchar dnet_ntoa ();\nint\nmain ()\n{\nreturn dnet_ntoa ();\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_link \"$LINENO\"; then :\n  ac_cv_lib_dnet_stub_dnet_ntoa=yes\nelse\n  ac_cv_lib_dnet_stub_dnet_ntoa=no\nfi\nrm -f core conftest.err conftest.$ac_objext \\\n    conftest$ac_exeext conftest.$ac_ext\nLIBS=$ac_check_lib_save_LIBS\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dnet_stub_dnet_ntoa\" >&5\n$as_echo \"$ac_cv_lib_dnet_stub_dnet_ntoa\" >&6; }\nif test \"x$ac_cv_lib_dnet_stub_dnet_ntoa\" = x\"\"yes; then :\n  X_EXTRA_LIBS=\"$X_EXTRA_LIBS -ldnet_stub\"\nfi\n\n    fi\nfi\nrm -f core conftest.err conftest.$ac_objext \\\n    conftest$ac_exeext conftest.$ac_ext\n    LIBS=\"$ac_xsave_LIBS\"\n\n    # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT,\n    # to get the SysV transport functions.\n    # Chad R. Larson says the Pyramis MIS-ES running DC/OSx (SVR4)\n    # needs -lnsl.\n    # The nsl library prevents programs from opening the X display\n    # on Irix 5.2, according to T.E. Dickey.\n    # The functions gethostbyname, getservbyname, and inet_addr are\n    # in -lbsd on LynxOS 3.0.1/i386, according to Lars Hecking.\n    ac_fn_c_check_func \"$LINENO\" \"gethostbyname\" \"ac_cv_func_gethostbyname\"\nif test \"x$ac_cv_func_gethostbyname\" = x\"\"yes; then :\n\nfi\n\n    if test $ac_cv_func_gethostbyname = no; then\n      { $as_echo \"$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lnsl\" >&5\n$as_echo_n \"checking for gethostbyname in -lnsl... \" >&6; }\nif test \"${ac_cv_lib_nsl_gethostbyname+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  ac_check_lib_save_LIBS=$LIBS\nLIBS=\"-lnsl  $LIBS\"\ncat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\n/* Override any GCC internal prototype to avoid an error.\n   Use char because int might match the return type of a GCC\n   builtin and then its argument prototype would still apply.  */\n#ifdef __cplusplus\nextern \"C\"\n#endif\nchar gethostbyname ();\nint\nmain ()\n{\nreturn gethostbyname ();\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_link \"$LINENO\"; then :\n  ac_cv_lib_nsl_gethostbyname=yes\nelse\n  ac_cv_lib_nsl_gethostbyname=no\nfi\nrm -f core conftest.err conftest.$ac_objext \\\n    conftest$ac_exeext conftest.$ac_ext\nLIBS=$ac_check_lib_save_LIBS\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_gethostbyname\" >&5\n$as_echo \"$ac_cv_lib_nsl_gethostbyname\" >&6; }\nif test \"x$ac_cv_lib_nsl_gethostbyname\" = x\"\"yes; then :\n  X_EXTRA_LIBS=\"$X_EXTRA_LIBS -lnsl\"\nfi\n\n      if test $ac_cv_lib_nsl_gethostbyname = no; then\n\t{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lbsd\" >&5\n$as_echo_n \"checking for gethostbyname in -lbsd... \" >&6; }\nif test \"${ac_cv_lib_bsd_gethostbyname+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  ac_check_lib_save_LIBS=$LIBS\nLIBS=\"-lbsd  $LIBS\"\ncat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\n/* Override any GCC internal prototype to avoid an error.\n   Use char because int might match the return type of a GCC\n   builtin and then its argument prototype would still apply.  */\n#ifdef __cplusplus\nextern \"C\"\n#endif\nchar gethostbyname ();\nint\nmain ()\n{\nreturn gethostbyname ();\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_link \"$LINENO\"; then :\n  ac_cv_lib_bsd_gethostbyname=yes\nelse\n  ac_cv_lib_bsd_gethostbyname=no\nfi\nrm -f core conftest.err conftest.$ac_objext \\\n    conftest$ac_exeext conftest.$ac_ext\nLIBS=$ac_check_lib_save_LIBS\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bsd_gethostbyname\" >&5\n$as_echo \"$ac_cv_lib_bsd_gethostbyname\" >&6; }\nif test \"x$ac_cv_lib_bsd_gethostbyname\" = x\"\"yes; then :\n  X_EXTRA_LIBS=\"$X_EXTRA_LIBS -lbsd\"\nfi\n\n      fi\n    fi\n\n    # lieder@skyler.mavd.honeywell.com says without -lsocket,\n    # socket/setsockopt and other routines are undefined under SCO ODT\n    # 2.0.  But -lsocket is broken on IRIX 5.2 (and is not necessary\n    # on later versions), says Simon Leinen: it contains gethostby*\n    # variants that don't use the name server (or something).  -lsocket\n    # must be given before -lnsl if both are needed.  We assume that\n    # if connect needs -lnsl, so does gethostbyname.\n    ac_fn_c_check_func \"$LINENO\" \"connect\" \"ac_cv_func_connect\"\nif test \"x$ac_cv_func_connect\" = x\"\"yes; then :\n\nfi\n\n    if test $ac_cv_func_connect = no; then\n      { $as_echo \"$as_me:${as_lineno-$LINENO}: checking for connect in -lsocket\" >&5\n$as_echo_n \"checking for connect in -lsocket... \" >&6; }\nif test \"${ac_cv_lib_socket_connect+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  ac_check_lib_save_LIBS=$LIBS\nLIBS=\"-lsocket $X_EXTRA_LIBS $LIBS\"\ncat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\n/* Override any GCC internal prototype to avoid an error.\n   Use char because int might match the return type of a GCC\n   builtin and then its argument prototype would still apply.  */\n#ifdef __cplusplus\nextern \"C\"\n#endif\nchar connect ();\nint\nmain ()\n{\nreturn connect ();\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_link \"$LINENO\"; then :\n  ac_cv_lib_socket_connect=yes\nelse\n  ac_cv_lib_socket_connect=no\nfi\nrm -f core conftest.err conftest.$ac_objext \\\n    conftest$ac_exeext conftest.$ac_ext\nLIBS=$ac_check_lib_save_LIBS\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_connect\" >&5\n$as_echo \"$ac_cv_lib_socket_connect\" >&6; }\nif test \"x$ac_cv_lib_socket_connect\" = x\"\"yes; then :\n  X_EXTRA_LIBS=\"-lsocket $X_EXTRA_LIBS\"\nfi\n\n    fi\n\n    # Guillermo Gomez says -lposix is necessary on A/UX.\n    ac_fn_c_check_func \"$LINENO\" \"remove\" \"ac_cv_func_remove\"\nif test \"x$ac_cv_func_remove\" = x\"\"yes; then :\n\nfi\n\n    if test $ac_cv_func_remove = no; then\n      { $as_echo \"$as_me:${as_lineno-$LINENO}: checking for remove in -lposix\" >&5\n$as_echo_n \"checking for remove in -lposix... \" >&6; }\nif test \"${ac_cv_lib_posix_remove+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  ac_check_lib_save_LIBS=$LIBS\nLIBS=\"-lposix  $LIBS\"\ncat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\n/* Override any GCC internal prototype to avoid an error.\n   Use char because int might match the return type of a GCC\n   builtin and then its argument prototype would still apply.  */\n#ifdef __cplusplus\nextern \"C\"\n#endif\nchar remove ();\nint\nmain ()\n{\nreturn remove ();\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_link \"$LINENO\"; then :\n  ac_cv_lib_posix_remove=yes\nelse\n  ac_cv_lib_posix_remove=no\nfi\nrm -f core conftest.err conftest.$ac_objext \\\n    conftest$ac_exeext conftest.$ac_ext\nLIBS=$ac_check_lib_save_LIBS\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_posix_remove\" >&5\n$as_echo \"$ac_cv_lib_posix_remove\" >&6; }\nif test \"x$ac_cv_lib_posix_remove\" = x\"\"yes; then :\n  X_EXTRA_LIBS=\"$X_EXTRA_LIBS -lposix\"\nfi\n\n    fi\n\n    # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.\n    ac_fn_c_check_func \"$LINENO\" \"shmat\" \"ac_cv_func_shmat\"\nif test \"x$ac_cv_func_shmat\" = x\"\"yes; then :\n\nfi\n\n    if test $ac_cv_func_shmat = no; then\n      { $as_echo \"$as_me:${as_lineno-$LINENO}: checking for shmat in -lipc\" >&5\n$as_echo_n \"checking for shmat in -lipc... \" >&6; }\nif test \"${ac_cv_lib_ipc_shmat+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  ac_check_lib_save_LIBS=$LIBS\nLIBS=\"-lipc  $LIBS\"\ncat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\n/* Override any GCC internal prototype to avoid an error.\n   Use char because int might match the return type of a GCC\n   builtin and then its argument prototype would still apply.  */\n#ifdef __cplusplus\nextern \"C\"\n#endif\nchar shmat ();\nint\nmain ()\n{\nreturn shmat ();\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_link \"$LINENO\"; then :\n  ac_cv_lib_ipc_shmat=yes\nelse\n  ac_cv_lib_ipc_shmat=no\nfi\nrm -f core conftest.err conftest.$ac_objext \\\n    conftest$ac_exeext conftest.$ac_ext\nLIBS=$ac_check_lib_save_LIBS\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ipc_shmat\" >&5\n$as_echo \"$ac_cv_lib_ipc_shmat\" >&6; }\nif test \"x$ac_cv_lib_ipc_shmat\" = x\"\"yes; then :\n  X_EXTRA_LIBS=\"$X_EXTRA_LIBS -lipc\"\nfi\n\n    fi\n  fi\n\n  # Check for libraries that X11R6 Xt/Xaw programs need.\n  ac_save_LDFLAGS=$LDFLAGS\n  test -n \"$x_libraries\" && LDFLAGS=\"$LDFLAGS -L$x_libraries\"\n  # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to\n  # check for ICE first), but we must link in the order -lSM -lICE or\n  # we get undefined symbols.  So assume we have SM if we have ICE.\n  # These have to be linked with before -lX11, unlike the other\n  # libraries we check for below, so use a different variable.\n  # John Interrante, Karl Berry\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking for IceConnectionNumber in -lICE\" >&5\n$as_echo_n \"checking for IceConnectionNumber in -lICE... \" >&6; }\nif test \"${ac_cv_lib_ICE_IceConnectionNumber+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  ac_check_lib_save_LIBS=$LIBS\nLIBS=\"-lICE $X_EXTRA_LIBS $LIBS\"\ncat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\n/* Override any GCC internal prototype to avoid an error.\n   Use char because int might match the return type of a GCC\n   builtin and then its argument prototype would still apply.  */\n#ifdef __cplusplus\nextern \"C\"\n#endif\nchar IceConnectionNumber ();\nint\nmain ()\n{\nreturn IceConnectionNumber ();\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_link \"$LINENO\"; then :\n  ac_cv_lib_ICE_IceConnectionNumber=yes\nelse\n  ac_cv_lib_ICE_IceConnectionNumber=no\nfi\nrm -f core conftest.err conftest.$ac_objext \\\n    conftest$ac_exeext conftest.$ac_ext\nLIBS=$ac_check_lib_save_LIBS\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ICE_IceConnectionNumber\" >&5\n$as_echo \"$ac_cv_lib_ICE_IceConnectionNumber\" >&6; }\nif test \"x$ac_cv_lib_ICE_IceConnectionNumber\" = x\"\"yes; then :\n  X_PRE_LIBS=\"$X_PRE_LIBS -lSM -lICE\"\nfi\n\n  LDFLAGS=$ac_save_LDFLAGS\n\nfi\n\n\n\n\n\nac_ext=c\nac_cpp='$CPP $CPPFLAGS'\nac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'\nac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'\nac_compiler_gnu=$ac_cv_c_compiler_gnu\n\nacx_pthread_ok=no\n\n# We used to check for pthread.h first, but this fails if pthread.h\n# requires special compiler flags (e.g. on True64 or Sequent).\n# It gets checked for in the link test anyway.\n\n# First of all, check if the user has set any of the PTHREAD_LIBS,\n# etcetera environment variables, and if threads linking works using\n# them:\nif test x\"$PTHREAD_LIBS$PTHREAD_CFLAGS\" != x; then\n        save_CFLAGS=\"$CFLAGS\"\n        CFLAGS=\"$CFLAGS $PTHREAD_CFLAGS\"\n        save_LIBS=\"$LIBS\"\n        LIBS=\"$PTHREAD_LIBS $LIBS\"\n        { $as_echo \"$as_me:${as_lineno-$LINENO}: checking for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS\" >&5\n$as_echo_n \"checking for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS... \" >&6; }\n        cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\n/* Override any GCC internal prototype to avoid an error.\n   Use char because int might match the return type of a GCC\n   builtin and then its argument prototype would still apply.  */\n#ifdef __cplusplus\nextern \"C\"\n#endif\nchar pthread_join ();\nint\nmain ()\n{\nreturn pthread_join ();\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_link \"$LINENO\"; then :\n  acx_pthread_ok=yes\nfi\nrm -f core conftest.err conftest.$ac_objext \\\n    conftest$ac_exeext conftest.$ac_ext\n        { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $acx_pthread_ok\" >&5\n$as_echo \"$acx_pthread_ok\" >&6; }\n        if test x\"$acx_pthread_ok\" = xno; then\n                PTHREAD_LIBS=\"\"\n                PTHREAD_CFLAGS=\"\"\n        fi\n        LIBS=\"$save_LIBS\"\n        CFLAGS=\"$save_CFLAGS\"\nfi\n\n# We must check for the threads library under a number of different\n# names; the ordering is very important because some systems\n# (e.g. DEC) have both -lpthread and -lpthreads, where one of the\n# libraries is broken (non-POSIX).\n\n# Create a list of thread flags to try.  Items starting with a \"-\" are\n# C compiler flags, and other items are library names, except for \"none\"\n# which indicates that we try without any flags at all, and \"pthread-config\"\n# which is a program returning the flags for the Pth emulation library.\n\nacx_pthread_flags=\"pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config\"\n\n# The ordering *is* (sometimes) important.  Some notes on the\n# individual items follow:\n\n# pthreads: AIX (must check this before -lpthread)\n# none: in case threads are in libc; should be tried before -Kthread and\n#       other compiler flags to prevent continual compiler warnings\n# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)\n# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)\n# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)\n# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)\n# -pthreads: Solaris/gcc\n# -mthreads: Mingw32/gcc, Lynx/gcc\n# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it\n#      doesn't hurt to check since this sometimes defines pthreads too;\n#      also defines -D_REENTRANT)\n# pthread: Linux, etcetera\n# --thread-safe: KAI C++\n# pthread-config: use pthread-config program (for GNU Pth library)\n\ncase \"${host_cpu}-${host_os}\" in\n        *solaris*)\n\n        # On Solaris (at least, for some versions), libc contains stubbed\n        # (non-functional) versions of the pthreads routines, so link-based\n        # tests will erroneously succeed.  (We need to link with -pthread or\n        # -lpthread.)  (The stubs are missing pthread_cleanup_push, or rather\n        # a function called by this macro, so we could check for that, but\n        # who knows whether they'll stub that too in a future libc.)  So,\n        # we'll just look for -pthreads and -lpthread first:\n\n        acx_pthread_flags=\"-pthread -pthreads pthread -mt $acx_pthread_flags\"\n        ;;\nesac\n\nif test x\"$acx_pthread_ok\" = xno; then\nfor flag in $acx_pthread_flags; do\n\n        case $flag in\n                none)\n                { $as_echo \"$as_me:${as_lineno-$LINENO}: checking whether pthreads work without any flags\" >&5\n$as_echo_n \"checking whether pthreads work without any flags... \" >&6; }\n                ;;\n\n                -*)\n                { $as_echo \"$as_me:${as_lineno-$LINENO}: checking whether pthreads work with $flag\" >&5\n$as_echo_n \"checking whether pthreads work with $flag... \" >&6; }\n                PTHREAD_CFLAGS=\"$flag\"\n                ;;\n\n\t\tpthread-config)\n\t\t# Extract the first word of \"pthread-config\", so it can be a program name with args.\nset dummy pthread-config; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif test \"${ac_cv_prog_acx_pthread_config+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$acx_pthread_config\"; then\n  ac_cv_prog_acx_pthread_config=\"$acx_pthread_config\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_acx_pthread_config=\"yes\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\n  test -z \"$ac_cv_prog_acx_pthread_config\" && ac_cv_prog_acx_pthread_config=\"no\"\nfi\nfi\nacx_pthread_config=$ac_cv_prog_acx_pthread_config\nif test -n \"$acx_pthread_config\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $acx_pthread_config\" >&5\n$as_echo \"$acx_pthread_config\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n\n\t\tif test x\"$acx_pthread_config\" = xno; then continue; fi\n\t\tPTHREAD_CFLAGS=\"`pthread-config --cflags`\"\n\t\tPTHREAD_LIBS=\"`pthread-config --ldflags` `pthread-config --libs`\"\n\t\t;;\n\n                *)\n                { $as_echo \"$as_me:${as_lineno-$LINENO}: checking for the pthreads library -l$flag\" >&5\n$as_echo_n \"checking for the pthreads library -l$flag... \" >&6; }\n                PTHREAD_LIBS=\"-l$flag\"\n                ;;\n        esac\n\n        save_LIBS=\"$LIBS\"\n        save_CFLAGS=\"$CFLAGS\"\n        LIBS=\"$PTHREAD_LIBS $LIBS\"\n        CFLAGS=\"$CFLAGS $PTHREAD_CFLAGS\"\n\n        # Check for various functions.  We must include pthread.h,\n        # since some functions may be macros.  (On the Sequent, we\n        # need a special flag -Kthread to make this header compile.)\n        # We check for pthread_join because it is in -lpthread on IRIX\n        # while pthread_create is in libc.  We check for pthread_attr_init\n        # due to DEC craziness with -lpthreads.  We check for\n        # pthread_cleanup_push because it is one of the few pthread\n        # functions on Solaris that doesn't have a non-functional libc stub.\n        # We try pthread_create on general principles.\n        cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n#include <pthread.h>\nint\nmain ()\n{\npthread_t th; pthread_join(th, 0);\n                     pthread_attr_init(0); pthread_cleanup_push(0, 0);\n                     pthread_create(0,0,0,0); pthread_cleanup_pop(0);\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_link \"$LINENO\"; then :\n  acx_pthread_ok=yes\nfi\nrm -f core conftest.err conftest.$ac_objext \\\n    conftest$ac_exeext conftest.$ac_ext\n\n        LIBS=\"$save_LIBS\"\n        CFLAGS=\"$save_CFLAGS\"\n\n        { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $acx_pthread_ok\" >&5\n$as_echo \"$acx_pthread_ok\" >&6; }\n        if test \"x$acx_pthread_ok\" = xyes; then\n                break;\n        fi\n\n        PTHREAD_LIBS=\"\"\n        PTHREAD_CFLAGS=\"\"\ndone\nfi\n\n# Various other checks:\nif test \"x$acx_pthread_ok\" = xyes; then\n        save_LIBS=\"$LIBS\"\n        LIBS=\"$PTHREAD_LIBS $LIBS\"\n        save_CFLAGS=\"$CFLAGS\"\n        CFLAGS=\"$CFLAGS $PTHREAD_CFLAGS\"\n\n        # Detect AIX lossage: JOINABLE attribute is called UNDETACHED.\n\t{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for joinable pthread attribute\" >&5\n$as_echo_n \"checking for joinable pthread attribute... \" >&6; }\n\tattr_name=unknown\n\tfor attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do\n\t    cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n#include <pthread.h>\nint\nmain ()\n{\nint attr=$attr;\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_link \"$LINENO\"; then :\n  attr_name=$attr; break\nfi\nrm -f core conftest.err conftest.$ac_objext \\\n    conftest$ac_exeext conftest.$ac_ext\n\tdone\n        { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $attr_name\" >&5\n$as_echo \"$attr_name\" >&6; }\n        if test \"$attr_name\" != PTHREAD_CREATE_JOINABLE; then\n\ncat >>confdefs.h <<_ACEOF\n#define PTHREAD_CREATE_JOINABLE $attr_name\n_ACEOF\n\n        fi\n\n        { $as_echo \"$as_me:${as_lineno-$LINENO}: checking if more special flags are required for pthreads\" >&5\n$as_echo_n \"checking if more special flags are required for pthreads... \" >&6; }\n        flag=no\n        case \"${host_cpu}-${host_os}\" in\n            *-aix* | *-freebsd* | *-darwin*) flag=\"-D_THREAD_SAFE\";;\n            *solaris* | *-osf* | *-hpux*) flag=\"-D_REENTRANT\";;\n        esac\n        { $as_echo \"$as_me:${as_lineno-$LINENO}: result: ${flag}\" >&5\n$as_echo \"${flag}\" >&6; }\n        if test \"x$flag\" != xno; then\n            PTHREAD_CFLAGS=\"$flag $PTHREAD_CFLAGS\"\n        fi\n\n        LIBS=\"$save_LIBS\"\n        CFLAGS=\"$save_CFLAGS\"\n\n        # More AIX lossage: must compile with cc_r\n        # Extract the first word of \"cc_r\", so it can be a program name with args.\nset dummy cc_r; ac_word=$2\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: checking for $ac_word\" >&5\n$as_echo_n \"checking for $ac_word... \" >&6; }\nif test \"${ac_cv_prog_PTHREAD_CC+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  if test -n \"$PTHREAD_CC\"; then\n  ac_cv_prog_PTHREAD_CC=\"$PTHREAD_CC\" # Let the user override the test.\nelse\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    for ac_exec_ext in '' $ac_executable_extensions; do\n  if { test -f \"$as_dir/$ac_word$ac_exec_ext\" && $as_test_x \"$as_dir/$ac_word$ac_exec_ext\"; }; then\n    ac_cv_prog_PTHREAD_CC=\"cc_r\"\n    $as_echo \"$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext\" >&5\n    break 2\n  fi\ndone\n  done\nIFS=$as_save_IFS\n\n  test -z \"$ac_cv_prog_PTHREAD_CC\" && ac_cv_prog_PTHREAD_CC=\"${CC}\"\nfi\nfi\nPTHREAD_CC=$ac_cv_prog_PTHREAD_CC\nif test -n \"$PTHREAD_CC\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: $PTHREAD_CC\" >&5\n$as_echo \"$PTHREAD_CC\" >&6; }\nelse\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: result: no\" >&5\n$as_echo \"no\" >&6; }\nfi\n\n\nelse\n        PTHREAD_CC=\"$CC\"\nfi\n\n\n\n\n\n# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:\nif test x\"$acx_pthread_ok\" = xyes; then\n\n$as_echo \"#define HAVE_PTHREAD 1\" >>confdefs.h\n\n        :\nelse\n        acx_pthread_ok=no\n\nfi\nac_ext=c\nac_cpp='$CPP $CPPFLAGS'\nac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'\nac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'\nac_compiler_gnu=$ac_cv_c_compiler_gnu\n\n\n\n#\n# There isn't a reliable way to know we should use the Apple OpenGL framework\n# without a configure option.  A Mac OS X user may have installed an\n# alternative GL implementation (e.g., Mesa), which may or may not depend on X.\n#\n\n# Check whether --with-apple-opengl-framework was given.\nif test \"${with_apple_opengl_framework+set}\" = set; then :\n  withval=$with_apple_opengl_framework;\nfi\n\nif test \"X$with_apple_opengl_framework\" = \"Xyes\"; then\n\n$as_echo \"#define HAVE_APPLE_OPENGL_FRAMEWORK 1\" >>confdefs.h\n\n  GL_LIBS=\"-framework OpenGL\"\nelse\n  ac_ext=c\nac_cpp='$CPP $CPPFLAGS'\nac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'\nac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'\nac_compiler_gnu=$ac_cv_c_compiler_gnu\n\n\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking whether we are using the Microsoft C compiler\" >&5\n$as_echo_n \"checking whether we are using the Microsoft C compiler... \" >&6; }\nif test \"${ax_cv_c_compiler_ms+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\nint\nmain ()\n{\n#ifndef _MSC_VER\n       choke me\n#endif\n\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_compile \"$LINENO\"; then :\n  ax_compiler_ms=yes\nelse\n  ax_compiler_ms=no\nfi\nrm -f core conftest.err conftest.$ac_objext conftest.$ac_ext\nax_cv_c_compiler_ms=$ax_compiler_ms\n\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ax_cv_c_compiler_ms\" >&5\n$as_echo \"$ax_cv_c_compiler_ms\" >&6; }\n  if test X$ax_compiler_ms = Xno; then\n    GL_CFLAGS=\"${PTHREAD_CFLAGS}\"\n    GL_LIBS=\"${PTHREAD_LIBS} -lm\"\n  fi\n\n  #\n  # Use x_includes and x_libraries if they have been set (presumably by\n  # AC_PATH_X).\n  #\n  if test \"X$no_x\" != \"Xyes\"; then\n    if test -n \"$x_includes\"; then\n      GL_CFLAGS=\"-I${x_includes} ${GL_CFLAGS}\"\n    fi\n    if test -n \"$x_libraries\"; then\n      GL_LIBS=\"-L${x_libraries} -lX11 ${GL_LIBS}\"\n    fi\n  fi\n\n  for ac_header in windows.h\ndo :\n  ac_fn_c_check_header_mongrel \"$LINENO\" \"windows.h\" \"ac_cv_header_windows_h\" \"$ac_includes_default\"\nif test \"x$ac_cv_header_windows_h\" = x\"\"yes; then :\n  cat >>confdefs.h <<_ACEOF\n#define HAVE_WINDOWS_H 1\n_ACEOF\n\nfi\n\ndone\n\n\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking for OpenGL library\" >&5\n$as_echo_n \"checking for OpenGL library... \" >&6; }\nif test \"${ax_cv_check_gl_libgl+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  ax_cv_check_gl_libgl=\"no\"\n  ax_save_CPPFLAGS=\"${CPPFLAGS}\"\n  CPPFLAGS=\"${GL_CFLAGS} ${CPPFLAGS}\"\n  ax_save_LIBS=\"${LIBS}\"\n  LIBS=\"\"\n  ax_check_libs=\"-lopengl32 -lGL\"\n  for ax_lib in ${ax_check_libs}; do\n    if test X$ax_compiler_ms = Xyes; then\n      ax_try_lib=`echo $ax_lib | sed -e 's/^-l//' -e 's/$/.lib/'`\n    else\n      ax_try_lib=\"${ax_lib}\"\n    fi\n    LIBS=\"${ax_try_lib} ${GL_LIBS} ${ax_save_LIBS}\"\n    cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\n# if HAVE_WINDOWS_H && defined(_WIN32)\n#   include <windows.h>\n# endif\n# include <GL/gl.h>\nint\nmain ()\n{\nglBegin(0)\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_link \"$LINENO\"; then :\n  ax_cv_check_gl_libgl=\"${ax_try_lib}\"; break\nfi\nrm -f core conftest.err conftest.$ac_objext \\\n    conftest$ac_exeext conftest.$ac_ext\n  done\n  LIBS=${ax_save_LIBS}\n  CPPFLAGS=${ax_save_CPPFLAGS}\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_gl_libgl\" >&5\n$as_echo \"$ax_cv_check_gl_libgl\" >&6; }\n\n  if test \"X${ax_cv_check_gl_libgl}\" = \"Xno\"; then\n    no_gl=\"yes\"\n    GL_CFLAGS=\"\"\n    GL_LIBS=\"\"\n  else\n    GL_LIBS=\"${ax_cv_check_gl_libgl} ${GL_LIBS}\"\n  fi\n  ac_ext=c\nac_cpp='$CPP $CPPFLAGS'\nac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'\nac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'\nac_compiler_gnu=$ac_cv_c_compiler_gnu\n\nfi\n\n\n\n\nGLU_CFLAGS=\"${GL_CFLAGS}\"\nif test \"X${with_apple_opengl_framework}\" != \"Xyes\"; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking for OpenGL Utility library\" >&5\n$as_echo_n \"checking for OpenGL Utility library... \" >&6; }\nif test \"${ax_cv_check_glu_libglu+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  ax_cv_check_glu_libglu=\"no\"\n  ax_save_CPPFLAGS=\"${CPPFLAGS}\"\n  CPPFLAGS=\"${GL_CFLAGS} ${CPPFLAGS}\"\n  ax_save_LIBS=\"${LIBS}\"\n  LIBS=\"\"\n  ax_check_libs=\"-lglu32 -lGLU\"\n  for ax_lib in ${ax_check_libs}; do\n    if test X$ax_compiler_ms = Xyes; then\n      ax_try_lib=`echo $ax_lib | sed -e 's/^-l//' -e 's/$/.lib/'`\n    else\n      ax_try_lib=\"${ax_lib}\"\n    fi\n    LIBS=\"${ax_try_lib} ${GL_LIBS} ${ax_save_LIBS}\"\n    #\n    # libGLU typically links with libstdc++ on POSIX platforms. However,\n    # setting the language to C++ means that test program source is named\n    # \"conftest.cc\"; and Microsoft cl doesn't know what to do with such a\n    # file.\n    #\n    ac_ext=cpp\nac_cpp='$CXXCPP $CPPFLAGS'\nac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'\nac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'\nac_compiler_gnu=$ac_cv_cxx_compiler_gnu\n\n    if test X$ax_compiler_ms = Xyes; then\n      ac_ext=c\nac_cpp='$CPP $CPPFLAGS'\nac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'\nac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'\nac_compiler_gnu=$ac_cv_c_compiler_gnu\n\n    fi\n    cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\n# if HAVE_WINDOWS_H && defined(_WIN32)\n#   include <windows.h>\n# endif\n# include <GL/glu.h>\nint\nmain ()\n{\ngluBeginCurve(0)\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_link \"$LINENO\"; then :\n  ax_cv_check_glu_libglu=\"${ax_try_lib}\"; break\nfi\nrm -f core conftest.err conftest.$ac_objext \\\n    conftest$ac_exeext conftest.$ac_ext\n    if test X$ax_compiler_ms = Xyes; then\n      ac_ext=cpp\nac_cpp='$CXXCPP $CPPFLAGS'\nac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'\nac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'\nac_compiler_gnu=$ac_cv_cxx_compiler_gnu\n\n    fi\n    ac_ext=c\nac_cpp='$CPP $CPPFLAGS'\nac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'\nac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'\nac_compiler_gnu=$ac_cv_c_compiler_gnu\n\n  done\n  LIBS=${ax_save_LIBS}\n  CPPFLAGS=${ax_save_CPPFLAGS}\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_glu_libglu\" >&5\n$as_echo \"$ax_cv_check_glu_libglu\" >&6; }\n  if test \"X${ax_cv_check_glu_libglu}\" = \"Xno\"; then\n    no_glu=\"yes\"\n    GLU_CFLAGS=\"\"\n    GLU_LIBS=\"\"\n  else\n    GLU_LIBS=\"${ax_cv_check_glu_libglu} ${GL_LIBS}\"\n  fi\nfi\n\n\n\n\nif test \"X$with_apple_opengl_framework\" = \"Xyes\"; then\n  GLUT_CFLAGS=\"${GLU_CFLAGS}\"\n  GLUT_LIBS=\"-framework GLUT -lobjc ${GL_LIBS}\"\nelse\n  GLUT_CFLAGS=${GLU_CFLAGS}\n  GLUT_LIBS=${GLU_LIBS}\n\n  #\n  # If X is present, assume GLUT depends on it.\n  #\n  if test \"X${no_x}\" != \"Xyes\"; then\n    GLUT_LIBS=\"${X_PRE_LIBS} -lXmu -lXi ${X_EXTRA_LIBS} ${GLUT_LIBS}\"\n  fi\n\n  ac_ext=c\nac_cpp='$CPP $CPPFLAGS'\nac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'\nac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'\nac_compiler_gnu=$ac_cv_c_compiler_gnu\n\n\n  ax_save_CPPFLAGS=\"${CPPFLAGS}\"\n  CPPFLAGS=\"${GLUT_CFLAGS} ${CPPFLAGS}\"\n\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: checking for GLUT library\" >&5\n$as_echo_n \"checking for GLUT library... \" >&6; }\nif test \"${ax_cv_check_glut_libglut+set}\" = set; then :\n  $as_echo_n \"(cached) \" >&6\nelse\n  ax_cv_check_glut_libglut=\"no\"\n  ax_save_LIBS=\"${LIBS}\"\n  LIBS=\"\"\n  ax_check_libs=\"-lglut32 -lglut\"\n  for ax_lib in ${ax_check_libs}; do\n    if test X$ax_compiler_ms = Xyes; then\n      ax_try_lib=`echo $ax_lib | sed -e 's/^-l//' -e 's/$/.lib/'`\n    else\n      ax_try_lib=\"${ax_lib}\"\n    fi\n    LIBS=\"${ax_try_lib} ${GLUT_LIBS} ${ax_save_LIBS}\"\n    cat confdefs.h - <<_ACEOF >conftest.$ac_ext\n/* end confdefs.h.  */\n\n# if HAVE_WINDOWS_H && defined(_WIN32)\n#   include <windows.h>\n# endif\n# include <GL/glut.h>\nint\nmain ()\n{\nglutMainLoop()\n  ;\n  return 0;\n}\n_ACEOF\nif ac_fn_c_try_link \"$LINENO\"; then :\n  ax_cv_check_glut_libglut=\"${ax_try_lib}\"; break\nfi\nrm -f core conftest.err conftest.$ac_objext \\\n    conftest$ac_exeext conftest.$ac_ext\n\n  done\n  LIBS=${ax_save_LIBS}\n\nfi\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_glut_libglut\" >&5\n$as_echo \"$ax_cv_check_glut_libglut\" >&6; }\n  CPPFLAGS=\"${ax_save_CPPFLAGS}\"\n  ac_ext=c\nac_cpp='$CPP $CPPFLAGS'\nac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'\nac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'\nac_compiler_gnu=$ac_cv_c_compiler_gnu\n\n\n  if test \"X${ax_cv_check_glut_libglut}\" = \"Xno\"; then\n    no_glut=\"yes\"\n    GLUT_CFLAGS=\"\"\n    GLUT_LIBS=\"\"\n  else\n    GLUT_LIBS=\"${ax_cv_check_glut_libglut} ${GLUT_LIBS}\"\n  fi\nfi\n\n\n\n\n\nif test \"$no_x\" != \"yes\" -a \"$no_gl\" != \"yes\" \\\n\t-a \"$no_glu\" != \"yes\" -a \"$no_glut\" != \"yes\" ; then\n  HAVE_OPENGL=yes\nfi\n\n if test \"$HAVE_OPENGL\" = \"yes\"; then\n  HAVE_OPENGL_TRUE=\n  HAVE_OPENGL_FALSE='#'\nelse\n  HAVE_OPENGL_TRUE='#'\n  HAVE_OPENGL_FALSE=\nfi\n\n\n\n\n\n\n\n\n\n# Check whether --enable-strip-chopping was given.\nif test \"${enable_strip_chopping+set}\" = set; then :\n  enableval=$enable_strip_chopping; HAVE_STRIPCHOP=$enableval\nelse\n  HAVE_STRIPCHOP=yes\nfi\n\n\n# Check whether --with-default-strip-size was given.\nif test \"${with_default_strip_size+set}\" = set; then :\n  withval=$with_default_strip_size;\nfi\n\n\nif test \"$HAVE_STRIPCHOP\" = \"yes\" \\\n\t-a \"x$with_default_strip_size\" != \"xno\"; then\n\n$as_echo \"#define STRIPCHOP_DEFAULT TIFF_STRIPCHOP\" >>confdefs.h\n\n\n  if test \"x$with_default_strip_size\" = \"x\" \\\n\t  -o \"x$with_default_strip_size\" = \"xyes\"; then\n    with_default_strip_size=\"8192\"\n  fi\n\n\ncat >>confdefs.h <<_ACEOF\n#define STRIP_SIZE_DEFAULT $with_default_strip_size\n_ACEOF\n\n\nfi\n\n\n$as_echo \"#define SUBIFD_SUPPORT 1\" >>confdefs.h\n\n\n\n# Check whether --enable-extrasample-as-alpha was given.\nif test \"${enable_extrasample_as_alpha+set}\" = set; then :\n  enableval=$enable_extrasample_as_alpha; HAVE_EXTRASAMPLE_AS_ALPHA=$enableval\nelse\n  HAVE_EXTRASAMPLE_AS_ALPHA=yes\nfi\n\n\nif test \"$HAVE_EXTRASAMPLE_AS_ALPHA\" = \"yes\" ; then\n\n$as_echo \"#define DEFAULT_EXTRASAMPLE_AS_ALPHA 1\" >>confdefs.h\n\nfi\n\n\n# Check whether --enable-check-ycbcr-subsampling was given.\nif test \"${enable_check_ycbcr_subsampling+set}\" = set; then :\n  enableval=$enable_check_ycbcr_subsampling; CHECK_JPEG_YCBCR_SUBSAMPLING=$enableval\nelse\n  CHECK_JPEG_YCBCR_SUBSAMPLING=yes\nfi\n\n\nif test \"$CHECK_JPEG_YCBCR_SUBSAMPLING\" = \"yes\" ; then\n\n$as_echo \"#define CHECK_JPEG_YCBCR_SUBSAMPLING 1\" >>confdefs.h\n\nfi\n\n\n\n\nac_config_headers=\"$ac_config_headers libtiff/tif_config.h libtiff/tiffconf.h\"\n\n\nac_config_files=\"$ac_config_files Makefile build/Makefile contrib/Makefile contrib/acorn/Makefile contrib/addtiffo/Makefile contrib/dbs/Makefile contrib/dbs/xtiff/Makefile contrib/iptcutil/Makefile contrib/mac-cw/Makefile contrib/mac-mpw/Makefile contrib/mfs/Makefile contrib/pds/Makefile contrib/ras/Makefile contrib/stream/Makefile contrib/tags/Makefile contrib/win_dib/Makefile html/Makefile html/images/Makefile html/man/Makefile libtiff/Makefile man/Makefile port/Makefile test/Makefile tools/Makefile\"\n\ncat >confcache <<\\_ACEOF\n# This file is a shell script that caches the results of configure\n# tests run on this system so they can be shared between configure\n# scripts and configure runs, see configure's option --config-cache.\n# It is not useful on other systems.  If it contains results you don't\n# want to keep, you may remove or edit it.\n#\n# config.status only pays attention to the cache file if you give it\n# the --recheck option to rerun configure.\n#\n# `ac_cv_env_foo' variables (set or unset) will be overridden when\n# loading this file, other *unset* `ac_cv_foo' will be assigned the\n# following values.\n\n_ACEOF\n\n# The following way of writing the cache mishandles newlines in values,\n# but we know of no workaround that is simple, portable, and efficient.\n# So, we kill variables containing newlines.\n# Ultrix sh set writes to stderr and can't be redirected directly,\n# and sets the high bit in the cache file unless we assign to the vars.\n(\n  for ac_var in `(set) 2>&1 | sed -n 's/^\\([a-zA-Z_][a-zA-Z0-9_]*\\)=.*/\\1/p'`; do\n    eval ac_val=\\$$ac_var\n    case $ac_val in #(\n    *${as_nl}*)\n      case $ac_var in #(\n      *_cv_*) { $as_echo \"$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline\" >&5\n$as_echo \"$as_me: WARNING: cache variable $ac_var contains a newline\" >&2;} ;;\n      esac\n      case $ac_var in #(\n      _ | IFS | as_nl) ;; #(\n      BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(\n      *) { eval $ac_var=; unset $ac_var;} ;;\n      esac ;;\n    esac\n  done\n\n  (set) 2>&1 |\n    case $as_nl`(ac_space=' '; set) 2>&1` in #(\n    *${as_nl}ac_space=\\ *)\n      # `set' does not quote correctly, so add quotes: double-quote\n      # substitution turns \\\\\\\\ into \\\\, and sed turns \\\\ into \\.\n      sed -n \\\n\t\"s/'/'\\\\\\\\''/g;\n\t  s/^\\\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\\\)=\\\\(.*\\\\)/\\\\1='\\\\2'/p\"\n      ;; #(\n    *)\n      # `set' quotes correctly as required by POSIX, so do not add quotes.\n      sed -n \"/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p\"\n      ;;\n    esac |\n    sort\n) |\n  sed '\n     /^ac_cv_env_/b end\n     t clear\n     :clear\n     s/^\\([^=]*\\)=\\(.*[{}].*\\)$/test \"${\\1+set}\" = set || &/\n     t end\n     s/^\\([^=]*\\)=\\(.*\\)$/\\1=${\\1=\\2}/\n     :end' >>confcache\nif diff \"$cache_file\" confcache >/dev/null 2>&1; then :; else\n  if test -w \"$cache_file\"; then\n    test \"x$cache_file\" != \"x/dev/null\" &&\n      { $as_echo \"$as_me:${as_lineno-$LINENO}: updating cache $cache_file\" >&5\n$as_echo \"$as_me: updating cache $cache_file\" >&6;}\n    cat confcache >$cache_file\n  else\n    { $as_echo \"$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file\" >&5\n$as_echo \"$as_me: not updating unwritable cache $cache_file\" >&6;}\n  fi\nfi\nrm -f confcache\n\ntest \"x$prefix\" = xNONE && prefix=$ac_default_prefix\n# Let make expand exec_prefix.\ntest \"x$exec_prefix\" = xNONE && exec_prefix='${prefix}'\n\nDEFS=-DHAVE_CONFIG_H\n\nac_libobjs=\nac_ltlibobjs=\nfor ac_i in : $LIBOBJS; do test \"x$ac_i\" = x: && continue\n  # 1. Remove the extension, and $U if already installed.\n  ac_script='s/\\$U\\././;s/\\.o$//;s/\\.obj$//'\n  ac_i=`$as_echo \"$ac_i\" | sed \"$ac_script\"`\n  # 2. Prepend LIBOBJDIR.  When used with automake>=1.10 LIBOBJDIR\n  #    will be set to the directory where LIBOBJS objects are built.\n  as_fn_append ac_libobjs \" \\${LIBOBJDIR}$ac_i\\$U.$ac_objext\"\n  as_fn_append ac_ltlibobjs \" \\${LIBOBJDIR}$ac_i\"'$U.lo'\ndone\nLIBOBJS=$ac_libobjs\n\nLTLIBOBJS=$ac_ltlibobjs\n\n\n if test -n \"$EXEEXT\"; then\n  am__EXEEXT_TRUE=\n  am__EXEEXT_FALSE='#'\nelse\n  am__EXEEXT_TRUE='#'\n  am__EXEEXT_FALSE=\nfi\n\nif test -z \"${MAINTAINER_MODE_TRUE}\" && test -z \"${MAINTAINER_MODE_FALSE}\"; then\n  as_fn_error \"conditional \\\"MAINTAINER_MODE\\\" was never defined.\nUsually this means the macro was only invoked conditionally.\" \"$LINENO\" 5\nfi\nif test -z \"${AMDEP_TRUE}\" && test -z \"${AMDEP_FALSE}\"; then\n  as_fn_error \"conditional \\\"AMDEP\\\" was never defined.\nUsually this means the macro was only invoked conditionally.\" \"$LINENO\" 5\nfi\nif test -z \"${am__fastdepCC_TRUE}\" && test -z \"${am__fastdepCC_FALSE}\"; then\n  as_fn_error \"conditional \\\"am__fastdepCC\\\" was never defined.\nUsually this means the macro was only invoked conditionally.\" \"$LINENO\" 5\nfi\nif test -z \"${am__fastdepCXX_TRUE}\" && test -z \"${am__fastdepCXX_FALSE}\"; then\n  as_fn_error \"conditional \\\"am__fastdepCXX\\\" was never defined.\nUsually this means the macro was only invoked conditionally.\" \"$LINENO\" 5\nfi\n\nif test -z \"${HAVE_RPATH_TRUE}\" && test -z \"${HAVE_RPATH_FALSE}\"; then\n  as_fn_error \"conditional \\\"HAVE_RPATH\\\" was never defined.\nUsually this means the macro was only invoked conditionally.\" \"$LINENO\" 5\nfi\nif test -z \"${HAVE_CXX_TRUE}\" && test -z \"${HAVE_CXX_FALSE}\"; then\n  as_fn_error \"conditional \\\"HAVE_CXX\\\" was never defined.\nUsually this means the macro was only invoked conditionally.\" \"$LINENO\" 5\nfi\nif test -z \"${HAVE_OPENGL_TRUE}\" && test -z \"${HAVE_OPENGL_FALSE}\"; then\n  as_fn_error \"conditional \\\"HAVE_OPENGL\\\" was never defined.\nUsually this means the macro was only invoked conditionally.\" \"$LINENO\" 5\nfi\n\n: ${CONFIG_STATUS=./config.status}\nac_write_fail=0\nac_clean_files_save=$ac_clean_files\nac_clean_files=\"$ac_clean_files $CONFIG_STATUS\"\n{ $as_echo \"$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS\" >&5\n$as_echo \"$as_me: creating $CONFIG_STATUS\" >&6;}\nas_write_fail=0\ncat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1\n#! $SHELL\n# Generated by $as_me.\n# Run this file to recreate the current configuration.\n# Compiler output produced by configure, useful for debugging\n# configure, is in config.log if it exists.\n\ndebug=false\nac_cs_recheck=false\nac_cs_silent=false\n\nSHELL=\\${CONFIG_SHELL-$SHELL}\nexport SHELL\n_ASEOF\ncat >>$CONFIG_STATUS <<\\_ASEOF || as_write_fail=1\n## -------------------- ##\n## M4sh Initialization. ##\n## -------------------- ##\n\n# Be more Bourne compatible\nDUALCASE=1; export DUALCASE # for MKS sh\nif test -n \"${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :\n  emulate sh\n  NULLCMD=:\n  # Pre-4.2 versions of Zsh do word splitting on ${1+\"$@\"}, which\n  # is contrary to our usage.  Disable this feature.\n  alias -g '${1+\"$@\"}'='\"$@\"'\n  setopt NO_GLOB_SUBST\nelse\n  case `(set -o) 2>/dev/null` in #(\n  *posix*) :\n    set -o posix ;; #(\n  *) :\n     ;;\nesac\nfi\n\n\nas_nl='\n'\nexport as_nl\n# Printing a long string crashes Solaris 7 /usr/bin/printf.\nas_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'\nas_echo=$as_echo$as_echo$as_echo$as_echo$as_echo\nas_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo\n# Prefer a ksh shell builtin over an external printf program on Solaris,\n# but without wasting forks for bash or zsh.\nif test -z \"$BASH_VERSION$ZSH_VERSION\" \\\n    && (test \"X`print -r -- $as_echo`\" = \"X$as_echo\") 2>/dev/null; then\n  as_echo='print -r --'\n  as_echo_n='print -rn --'\nelif (test \"X`printf %s $as_echo`\" = \"X$as_echo\") 2>/dev/null; then\n  as_echo='printf %s\\n'\n  as_echo_n='printf %s'\nelse\n  if test \"X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`\" = \"X-n $as_echo\"; then\n    as_echo_body='eval /usr/ucb/echo -n \"$1$as_nl\"'\n    as_echo_n='/usr/ucb/echo -n'\n  else\n    as_echo_body='eval expr \"X$1\" : \"X\\\\(.*\\\\)\"'\n    as_echo_n_body='eval\n      arg=$1;\n      case $arg in #(\n      *\"$as_nl\"*)\n\texpr \"X$arg\" : \"X\\\\(.*\\\\)$as_nl\";\n\targ=`expr \"X$arg\" : \".*$as_nl\\\\(.*\\\\)\"`;;\n      esac;\n      expr \"X$arg\" : \"X\\\\(.*\\\\)\" | tr -d \"$as_nl\"\n    '\n    export as_echo_n_body\n    as_echo_n='sh -c $as_echo_n_body as_echo'\n  fi\n  export as_echo_body\n  as_echo='sh -c $as_echo_body as_echo'\nfi\n\n# The user is always right.\nif test \"${PATH_SEPARATOR+set}\" != set; then\n  PATH_SEPARATOR=:\n  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {\n    (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||\n      PATH_SEPARATOR=';'\n  }\nfi\n\n\n# IFS\n# We need space, tab and new line, in precisely that order.  Quoting is\n# there to prevent editors from complaining about space-tab.\n# (If _AS_PATH_WALK were called with IFS unset, it would disable word\n# splitting by setting IFS to empty value.)\nIFS=\" \"\"\t$as_nl\"\n\n# Find who we are.  Look in the path if we contain no directory separator.\ncase $0 in #((\n  *[\\\\/]* ) as_myself=$0 ;;\n  *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n    test -r \"$as_dir/$0\" && as_myself=$as_dir/$0 && break\n  done\nIFS=$as_save_IFS\n\n     ;;\nesac\n# We did not find ourselves, most probably we were run as `sh COMMAND'\n# in which case we are not to be found in the path.\nif test \"x$as_myself\" = x; then\n  as_myself=$0\nfi\nif test ! -f \"$as_myself\"; then\n  $as_echo \"$as_myself: error: cannot find myself; rerun with an absolute file name\" >&2\n  exit 1\nfi\n\n# Unset variables that we do not need and which cause bugs (e.g. in\n# pre-3.0 UWIN ksh).  But do not cause bugs in bash 2.01; the \"|| exit 1\"\n# suppresses any \"Segmentation fault\" message there.  '((' could\n# trigger a bug in pdksh 5.2.14.\nfor as_var in BASH_ENV ENV MAIL MAILPATH\ndo eval test x\\${$as_var+set} = xset \\\n  && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :\ndone\nPS1='$ '\nPS2='> '\nPS4='+ '\n\n# NLS nuisances.\nLC_ALL=C\nexport LC_ALL\nLANGUAGE=C\nexport LANGUAGE\n\n# CDPATH.\n(unset CDPATH) >/dev/null 2>&1 && unset CDPATH\n\n\n# as_fn_error ERROR [LINENO LOG_FD]\n# ---------------------------------\n# Output \"`basename $0`: error: ERROR\" to stderr. If LINENO and LOG_FD are\n# provided, also output the error to LOG_FD, referencing LINENO. Then exit the\n# script with status $?, using 1 if that was 0.\nas_fn_error ()\n{\n  as_status=$?; test $as_status -eq 0 && as_status=1\n  if test \"$3\"; then\n    as_lineno=${as_lineno-\"$2\"} as_lineno_stack=as_lineno_stack=$as_lineno_stack\n    $as_echo \"$as_me:${as_lineno-$LINENO}: error: $1\" >&$3\n  fi\n  $as_echo \"$as_me: error: $1\" >&2\n  as_fn_exit $as_status\n} # as_fn_error\n\n\n# as_fn_set_status STATUS\n# -----------------------\n# Set $? to STATUS, without forking.\nas_fn_set_status ()\n{\n  return $1\n} # as_fn_set_status\n\n# as_fn_exit STATUS\n# -----------------\n# Exit the shell with STATUS, even in a \"trap 0\" or \"set -e\" context.\nas_fn_exit ()\n{\n  set +e\n  as_fn_set_status $1\n  exit $1\n} # as_fn_exit\n\n# as_fn_unset VAR\n# ---------------\n# Portably unset VAR.\nas_fn_unset ()\n{\n  { eval $1=; unset $1;}\n}\nas_unset=as_fn_unset\n# as_fn_append VAR VALUE\n# ----------------------\n# Append the text in VALUE to the end of the definition contained in VAR. Take\n# advantage of any shell optimizations that allow amortized linear growth over\n# repeated appends, instead of the typical quadratic growth present in naive\n# implementations.\nif (eval \"as_var=1; as_var+=2; test x\\$as_var = x12\") 2>/dev/null; then :\n  eval 'as_fn_append ()\n  {\n    eval $1+=\\$2\n  }'\nelse\n  as_fn_append ()\n  {\n    eval $1=\\$$1\\$2\n  }\nfi # as_fn_append\n\n# as_fn_arith ARG...\n# ------------------\n# Perform arithmetic evaluation on the ARGs, and store the result in the\n# global $as_val. Take advantage of shells that can avoid forks. The arguments\n# must be portable across $(()) and expr.\nif (eval \"test \\$(( 1 + 1 )) = 2\") 2>/dev/null; then :\n  eval 'as_fn_arith ()\n  {\n    as_val=$(( $* ))\n  }'\nelse\n  as_fn_arith ()\n  {\n    as_val=`expr \"$@\" || test $? -eq 1`\n  }\nfi # as_fn_arith\n\n\nif expr a : '\\(a\\)' >/dev/null 2>&1 &&\n   test \"X`expr 00001 : '.*\\(...\\)'`\" = X001; then\n  as_expr=expr\nelse\n  as_expr=false\nfi\n\nif (basename -- /) >/dev/null 2>&1 && test \"X`basename -- / 2>&1`\" = \"X/\"; then\n  as_basename=basename\nelse\n  as_basename=false\nfi\n\nif (as_dir=`dirname -- /` && test \"X$as_dir\" = X/) >/dev/null 2>&1; then\n  as_dirname=dirname\nelse\n  as_dirname=false\nfi\n\nas_me=`$as_basename -- \"$0\" ||\n$as_expr X/\"$0\" : '.*/\\([^/][^/]*\\)/*$' \\| \\\n\t X\"$0\" : 'X\\(//\\)$' \\| \\\n\t X\"$0\" : 'X\\(/\\)' \\| . 2>/dev/null ||\n$as_echo X/\"$0\" |\n    sed '/^.*\\/\\([^/][^/]*\\)\\/*$/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  /^X\\/\\(\\/\\/\\)$/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  /^X\\/\\(\\/\\).*/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  s/.*/./; q'`\n\n# Avoid depending upon Character Ranges.\nas_cr_letters='abcdefghijklmnopqrstuvwxyz'\nas_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'\nas_cr_Letters=$as_cr_letters$as_cr_LETTERS\nas_cr_digits='0123456789'\nas_cr_alnum=$as_cr_Letters$as_cr_digits\n\nECHO_C= ECHO_N= ECHO_T=\ncase `echo -n x` in #(((((\n-n*)\n  case `echo 'xy\\c'` in\n  *c*) ECHO_T='\t';;\t# ECHO_T is single tab character.\n  xy)  ECHO_C='\\c';;\n  *)   echo `echo ksh88 bug on AIX 6.1` > /dev/null\n       ECHO_T='\t';;\n  esac;;\n*)\n  ECHO_N='-n';;\nesac\n\nrm -f conf$$ conf$$.exe conf$$.file\nif test -d conf$$.dir; then\n  rm -f conf$$.dir/conf$$.file\nelse\n  rm -f conf$$.dir\n  mkdir conf$$.dir 2>/dev/null\nfi\nif (echo >conf$$.file) 2>/dev/null; then\n  if ln -s conf$$.file conf$$ 2>/dev/null; then\n    as_ln_s='ln -s'\n    # ... but there are two gotchas:\n    # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.\n    # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.\n    # In both cases, we have to default to `cp -p'.\n    ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||\n      as_ln_s='cp -p'\n  elif ln conf$$.file conf$$ 2>/dev/null; then\n    as_ln_s=ln\n  else\n    as_ln_s='cp -p'\n  fi\nelse\n  as_ln_s='cp -p'\nfi\nrm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file\nrmdir conf$$.dir 2>/dev/null\n\n\n# as_fn_mkdir_p\n# -------------\n# Create \"$as_dir\" as a directory, including parents if necessary.\nas_fn_mkdir_p ()\n{\n\n  case $as_dir in #(\n  -*) as_dir=./$as_dir;;\n  esac\n  test -d \"$as_dir\" || eval $as_mkdir_p || {\n    as_dirs=\n    while :; do\n      case $as_dir in #(\n      *\\'*) as_qdir=`$as_echo \"$as_dir\" | sed \"s/'/'\\\\\\\\\\\\\\\\''/g\"`;; #'(\n      *) as_qdir=$as_dir;;\n      esac\n      as_dirs=\"'$as_qdir' $as_dirs\"\n      as_dir=`$as_dirname -- \"$as_dir\" ||\n$as_expr X\"$as_dir\" : 'X\\(.*[^/]\\)//*[^/][^/]*/*$' \\| \\\n\t X\"$as_dir\" : 'X\\(//\\)[^/]' \\| \\\n\t X\"$as_dir\" : 'X\\(//\\)$' \\| \\\n\t X\"$as_dir\" : 'X\\(/\\)' \\| . 2>/dev/null ||\n$as_echo X\"$as_dir\" |\n    sed '/^X\\(.*[^/]\\)\\/\\/*[^/][^/]*\\/*$/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  /^X\\(\\/\\/\\)[^/].*/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  /^X\\(\\/\\/\\)$/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  /^X\\(\\/\\).*/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  s/.*/./; q'`\n      test -d \"$as_dir\" && break\n    done\n    test -z \"$as_dirs\" || eval \"mkdir $as_dirs\"\n  } || test -d \"$as_dir\" || as_fn_error \"cannot create directory $as_dir\"\n\n\n} # as_fn_mkdir_p\nif mkdir -p . 2>/dev/null; then\n  as_mkdir_p='mkdir -p \"$as_dir\"'\nelse\n  test -d ./-p && rmdir ./-p\n  as_mkdir_p=false\nfi\n\nif test -x / >/dev/null 2>&1; then\n  as_test_x='test -x'\nelse\n  if ls -dL / >/dev/null 2>&1; then\n    as_ls_L_option=L\n  else\n    as_ls_L_option=\n  fi\n  as_test_x='\n    eval sh -c '\\''\n      if test -d \"$1\"; then\n\ttest -d \"$1/.\";\n      else\n\tcase $1 in #(\n\t-*)set \"./$1\";;\n\tesac;\n\tcase `ls -ld'$as_ls_L_option' \"$1\" 2>/dev/null` in #((\n\t???[sx]*):;;*)false;;esac;fi\n    '\\'' sh\n  '\nfi\nas_executable_p=$as_test_x\n\n# Sed expression to map a string onto a valid CPP name.\nas_tr_cpp=\"eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'\"\n\n# Sed expression to map a string onto a valid variable name.\nas_tr_sh=\"eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'\"\n\n\nexec 6>&1\n## ----------------------------------- ##\n## Main body of $CONFIG_STATUS script. ##\n## ----------------------------------- ##\n_ASEOF\ntest $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1\n\ncat >>$CONFIG_STATUS <<\\_ACEOF || ac_write_fail=1\n# Save the log message, to keep $0 and so on meaningful, and to\n# report actual input values of CONFIG_FILES etc. instead of their\n# values after options handling.\nac_log=\"\nThis file was extended by LibTIFF Software $as_me 3.9.2, which was\ngenerated by GNU Autoconf 2.64.  Invocation command line was\n\n  CONFIG_FILES    = $CONFIG_FILES\n  CONFIG_HEADERS  = $CONFIG_HEADERS\n  CONFIG_LINKS    = $CONFIG_LINKS\n  CONFIG_COMMANDS = $CONFIG_COMMANDS\n  $ $0 $@\n\non `(hostname || uname -n) 2>/dev/null | sed 1q`\n\"\n\n_ACEOF\n\ncase $ac_config_files in *\"\n\"*) set x $ac_config_files; shift; ac_config_files=$*;;\nesac\n\ncase $ac_config_headers in *\"\n\"*) set x $ac_config_headers; shift; ac_config_headers=$*;;\nesac\n\n\ncat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1\n# Files that config.status was made for.\nconfig_files=\"$ac_config_files\"\nconfig_headers=\"$ac_config_headers\"\nconfig_commands=\"$ac_config_commands\"\n\n_ACEOF\n\ncat >>$CONFIG_STATUS <<\\_ACEOF || ac_write_fail=1\nac_cs_usage=\"\\\n\\`$as_me' instantiates files and other configuration actions\nfrom templates according to the current configuration.  Unless the files\nand actions are specified as TAGs, all are instantiated by default.\n\nUsage: $0 [OPTION]... [TAG]...\n\n  -h, --help       print this help, then exit\n  -V, --version    print version number and configuration settings, then exit\n  -q, --quiet, --silent\n                   do not print progress messages\n  -d, --debug      don't remove temporary files\n      --recheck    update $as_me by reconfiguring in the same conditions\n      --file=FILE[:TEMPLATE]\n                   instantiate the configuration file FILE\n      --header=FILE[:TEMPLATE]\n                   instantiate the configuration header FILE\n\nConfiguration files:\n$config_files\n\nConfiguration headers:\n$config_headers\n\nConfiguration commands:\n$config_commands\n\nReport bugs to <tiff@lists.maptools.org>.\"\n\n_ACEOF\ncat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1\nac_cs_version=\"\\\\\nLibTIFF Software config.status 3.9.2\nconfigured by $0, generated by GNU Autoconf 2.64,\n  with options \\\\\"`$as_echo \"$ac_configure_args\" | sed 's/^ //; s/[\\\\\"\"\\`\\$]/\\\\\\\\&/g'`\\\\\"\n\nCopyright (C) 2009 Free Software Foundation, Inc.\nThis config.status script is free software; the Free Software Foundation\ngives unlimited permission to copy, distribute and modify it.\"\n\nac_pwd='$ac_pwd'\nsrcdir='$srcdir'\nINSTALL='$INSTALL'\nMKDIR_P='$MKDIR_P'\nAWK='$AWK'\ntest -n \"\\$AWK\" || AWK=awk\n_ACEOF\n\ncat >>$CONFIG_STATUS <<\\_ACEOF || ac_write_fail=1\n# The default lists apply if the user does not specify any file.\nac_need_defaults=:\nwhile test $# != 0\ndo\n  case $1 in\n  --*=*)\n    ac_option=`expr \"X$1\" : 'X\\([^=]*\\)='`\n    ac_optarg=`expr \"X$1\" : 'X[^=]*=\\(.*\\)'`\n    ac_shift=:\n    ;;\n  *)\n    ac_option=$1\n    ac_optarg=$2\n    ac_shift=shift\n    ;;\n  esac\n\n  case $ac_option in\n  # Handling of the options.\n  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)\n    ac_cs_recheck=: ;;\n  --version | --versio | --versi | --vers | --ver | --ve | --v | -V )\n    $as_echo \"$ac_cs_version\"; exit ;;\n  --debug | --debu | --deb | --de | --d | -d )\n    debug=: ;;\n  --file | --fil | --fi | --f )\n    $ac_shift\n    case $ac_optarg in\n    *\\'*) ac_optarg=`$as_echo \"$ac_optarg\" | sed \"s/'/'\\\\\\\\\\\\\\\\''/g\"` ;;\n    esac\n    as_fn_append CONFIG_FILES \" '$ac_optarg'\"\n    ac_need_defaults=false;;\n  --header | --heade | --head | --hea )\n    $ac_shift\n    case $ac_optarg in\n    *\\'*) ac_optarg=`$as_echo \"$ac_optarg\" | sed \"s/'/'\\\\\\\\\\\\\\\\''/g\"` ;;\n    esac\n    as_fn_append CONFIG_HEADERS \" '$ac_optarg'\"\n    ac_need_defaults=false;;\n  --he | --h)\n    # Conflict between --help and --header\n    as_fn_error \"ambiguous option: \\`$1'\nTry \\`$0 --help' for more information.\";;\n  --help | --hel | -h )\n    $as_echo \"$ac_cs_usage\"; exit ;;\n  -q | -quiet | --quiet | --quie | --qui | --qu | --q \\\n  | -silent | --silent | --silen | --sile | --sil | --si | --s)\n    ac_cs_silent=: ;;\n\n  # This is an error.\n  -*) as_fn_error \"unrecognized option: \\`$1'\nTry \\`$0 --help' for more information.\" ;;\n\n  *) as_fn_append ac_config_targets \" $1\"\n     ac_need_defaults=false ;;\n\n  esac\n  shift\ndone\n\nac_configure_extra_args=\n\nif $ac_cs_silent; then\n  exec 6>/dev/null\n  ac_configure_extra_args=\"$ac_configure_extra_args --silent\"\nfi\n\n_ACEOF\ncat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1\nif \\$ac_cs_recheck; then\n  set X '$SHELL' '$0' $ac_configure_args \\$ac_configure_extra_args --no-create --no-recursion\n  shift\n  \\$as_echo \"running CONFIG_SHELL=$SHELL \\$*\" >&6\n  CONFIG_SHELL='$SHELL'\n  export CONFIG_SHELL\n  exec \"\\$@\"\nfi\n\n_ACEOF\ncat >>$CONFIG_STATUS <<\\_ACEOF || ac_write_fail=1\nexec 5>>config.log\n{\n  echo\n  sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX\n## Running $as_me. ##\n_ASBOX\n  $as_echo \"$ac_log\"\n} >&5\n\n_ACEOF\ncat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1\n#\n# INIT-COMMANDS\n#\nAMDEP_TRUE=\"$AMDEP_TRUE\" ac_aux_dir=\"$ac_aux_dir\"\n\n\n# The HP-UX ksh and POSIX shell print the target directory to stdout\n# if CDPATH is set.\n(unset CDPATH) >/dev/null 2>&1 && unset CDPATH\n\nsed_quote_subst='$sed_quote_subst'\ndouble_quote_subst='$double_quote_subst'\ndelay_variable_subst='$delay_variable_subst'\nSED='`$ECHO \"X$SED\" | $Xsed -e \"$delay_single_quote_subst\"`'\nXsed='`$ECHO \"X$Xsed\" | $Xsed -e \"$delay_single_quote_subst\"`'\nGREP='`$ECHO \"X$GREP\" | $Xsed -e \"$delay_single_quote_subst\"`'\nEGREP='`$ECHO \"X$EGREP\" | $Xsed -e \"$delay_single_quote_subst\"`'\nFGREP='`$ECHO \"X$FGREP\" | $Xsed -e \"$delay_single_quote_subst\"`'\nLD='`$ECHO \"X$LD\" | $Xsed -e \"$delay_single_quote_subst\"`'\nmacro_version='`$ECHO \"X$macro_version\" | $Xsed -e \"$delay_single_quote_subst\"`'\nmacro_revision='`$ECHO \"X$macro_revision\" | $Xsed -e \"$delay_single_quote_subst\"`'\nAS='`$ECHO \"X$AS\" | $Xsed -e \"$delay_single_quote_subst\"`'\nDLLTOOL='`$ECHO \"X$DLLTOOL\" | $Xsed -e \"$delay_single_quote_subst\"`'\nOBJDUMP='`$ECHO \"X$OBJDUMP\" | $Xsed -e \"$delay_single_quote_subst\"`'\nenable_shared='`$ECHO \"X$enable_shared\" | $Xsed -e \"$delay_single_quote_subst\"`'\nenable_static='`$ECHO \"X$enable_static\" | $Xsed -e \"$delay_single_quote_subst\"`'\npic_mode='`$ECHO \"X$pic_mode\" | $Xsed -e \"$delay_single_quote_subst\"`'\nenable_fast_install='`$ECHO \"X$enable_fast_install\" | $Xsed -e \"$delay_single_quote_subst\"`'\nhost_alias='`$ECHO \"X$host_alias\" | $Xsed -e \"$delay_single_quote_subst\"`'\nhost='`$ECHO \"X$host\" | $Xsed -e \"$delay_single_quote_subst\"`'\nhost_os='`$ECHO \"X$host_os\" | $Xsed -e \"$delay_single_quote_subst\"`'\nbuild_alias='`$ECHO \"X$build_alias\" | $Xsed -e \"$delay_single_quote_subst\"`'\nbuild='`$ECHO \"X$build\" | $Xsed -e \"$delay_single_quote_subst\"`'\nbuild_os='`$ECHO \"X$build_os\" | $Xsed -e \"$delay_single_quote_subst\"`'\nNM='`$ECHO \"X$NM\" | $Xsed -e \"$delay_single_quote_subst\"`'\nLN_S='`$ECHO \"X$LN_S\" | $Xsed -e \"$delay_single_quote_subst\"`'\nmax_cmd_len='`$ECHO \"X$max_cmd_len\" | $Xsed -e \"$delay_single_quote_subst\"`'\nac_objext='`$ECHO \"X$ac_objext\" | $Xsed -e \"$delay_single_quote_subst\"`'\nexeext='`$ECHO \"X$exeext\" | $Xsed -e \"$delay_single_quote_subst\"`'\nlt_unset='`$ECHO \"X$lt_unset\" | $Xsed -e \"$delay_single_quote_subst\"`'\nlt_SP2NL='`$ECHO \"X$lt_SP2NL\" | $Xsed -e \"$delay_single_quote_subst\"`'\nlt_NL2SP='`$ECHO \"X$lt_NL2SP\" | $Xsed -e \"$delay_single_quote_subst\"`'\nreload_flag='`$ECHO \"X$reload_flag\" | $Xsed -e \"$delay_single_quote_subst\"`'\nreload_cmds='`$ECHO \"X$reload_cmds\" | $Xsed -e \"$delay_single_quote_subst\"`'\ndeplibs_check_method='`$ECHO \"X$deplibs_check_method\" | $Xsed -e \"$delay_single_quote_subst\"`'\nfile_magic_cmd='`$ECHO \"X$file_magic_cmd\" | $Xsed -e \"$delay_single_quote_subst\"`'\nAR='`$ECHO \"X$AR\" | $Xsed -e \"$delay_single_quote_subst\"`'\nAR_FLAGS='`$ECHO \"X$AR_FLAGS\" | $Xsed -e \"$delay_single_quote_subst\"`'\nSTRIP='`$ECHO \"X$STRIP\" | $Xsed -e \"$delay_single_quote_subst\"`'\nRANLIB='`$ECHO \"X$RANLIB\" | $Xsed -e \"$delay_single_quote_subst\"`'\nold_postinstall_cmds='`$ECHO \"X$old_postinstall_cmds\" | $Xsed -e \"$delay_single_quote_subst\"`'\nold_postuninstall_cmds='`$ECHO \"X$old_postuninstall_cmds\" | $Xsed -e \"$delay_single_quote_subst\"`'\nold_archive_cmds='`$ECHO \"X$old_archive_cmds\" | $Xsed -e \"$delay_single_quote_subst\"`'\nCC='`$ECHO \"X$CC\" | $Xsed -e \"$delay_single_quote_subst\"`'\nCFLAGS='`$ECHO \"X$CFLAGS\" | $Xsed -e \"$delay_single_quote_subst\"`'\ncompiler='`$ECHO \"X$compiler\" | $Xsed -e \"$delay_single_quote_subst\"`'\nGCC='`$ECHO \"X$GCC\" | $Xsed -e \"$delay_single_quote_subst\"`'\nlt_cv_sys_global_symbol_pipe='`$ECHO \"X$lt_cv_sys_global_symbol_pipe\" | $Xsed -e \"$delay_single_quote_subst\"`'\nlt_cv_sys_global_symbol_to_cdecl='`$ECHO \"X$lt_cv_sys_global_symbol_to_cdecl\" | $Xsed -e \"$delay_single_quote_subst\"`'\nlt_cv_sys_global_symbol_to_c_name_address='`$ECHO \"X$lt_cv_sys_global_symbol_to_c_name_address\" | $Xsed -e \"$delay_single_quote_subst\"`'\nlt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO \"X$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix\" | $Xsed -e \"$delay_single_quote_subst\"`'\nobjdir='`$ECHO \"X$objdir\" | $Xsed -e \"$delay_single_quote_subst\"`'\nSHELL='`$ECHO \"X$SHELL\" | $Xsed -e \"$delay_single_quote_subst\"`'\nECHO='`$ECHO \"X$ECHO\" | $Xsed -e \"$delay_single_quote_subst\"`'\nMAGIC_CMD='`$ECHO \"X$MAGIC_CMD\" | $Xsed -e \"$delay_single_quote_subst\"`'\nlt_prog_compiler_no_builtin_flag='`$ECHO \"X$lt_prog_compiler_no_builtin_flag\" | $Xsed -e \"$delay_single_quote_subst\"`'\nlt_prog_compiler_wl='`$ECHO \"X$lt_prog_compiler_wl\" | $Xsed -e \"$delay_single_quote_subst\"`'\nlt_prog_compiler_pic='`$ECHO \"X$lt_prog_compiler_pic\" | $Xsed -e \"$delay_single_quote_subst\"`'\nlt_prog_compiler_static='`$ECHO \"X$lt_prog_compiler_static\" | $Xsed -e \"$delay_single_quote_subst\"`'\nlt_cv_prog_compiler_c_o='`$ECHO \"X$lt_cv_prog_compiler_c_o\" | $Xsed -e \"$delay_single_quote_subst\"`'\nneed_locks='`$ECHO \"X$need_locks\" | $Xsed -e \"$delay_single_quote_subst\"`'\nDSYMUTIL='`$ECHO \"X$DSYMUTIL\" | $Xsed -e \"$delay_single_quote_subst\"`'\nNMEDIT='`$ECHO \"X$NMEDIT\" | $Xsed -e \"$delay_single_quote_subst\"`'\nLIPO='`$ECHO \"X$LIPO\" | $Xsed -e \"$delay_single_quote_subst\"`'\nOTOOL='`$ECHO \"X$OTOOL\" | $Xsed -e \"$delay_single_quote_subst\"`'\nOTOOL64='`$ECHO \"X$OTOOL64\" | $Xsed -e \"$delay_single_quote_subst\"`'\nlibext='`$ECHO \"X$libext\" | $Xsed -e \"$delay_single_quote_subst\"`'\nshrext_cmds='`$ECHO \"X$shrext_cmds\" | $Xsed -e \"$delay_single_quote_subst\"`'\nextract_expsyms_cmds='`$ECHO \"X$extract_expsyms_cmds\" | $Xsed -e \"$delay_single_quote_subst\"`'\narchive_cmds_need_lc='`$ECHO \"X$archive_cmds_need_lc\" | $Xsed -e \"$delay_single_quote_subst\"`'\nenable_shared_with_static_runtimes='`$ECHO \"X$enable_shared_with_static_runtimes\" | $Xsed -e \"$delay_single_quote_subst\"`'\nexport_dynamic_flag_spec='`$ECHO \"X$export_dynamic_flag_spec\" | $Xsed -e \"$delay_single_quote_subst\"`'\nwhole_archive_flag_spec='`$ECHO \"X$whole_archive_flag_spec\" | $Xsed -e \"$delay_single_quote_subst\"`'\ncompiler_needs_object='`$ECHO \"X$compiler_needs_object\" | $Xsed -e \"$delay_single_quote_subst\"`'\nold_archive_from_new_cmds='`$ECHO \"X$old_archive_from_new_cmds\" | $Xsed -e \"$delay_single_quote_subst\"`'\nold_archive_from_expsyms_cmds='`$ECHO \"X$old_archive_from_expsyms_cmds\" | $Xsed -e \"$delay_single_quote_subst\"`'\narchive_cmds='`$ECHO \"X$archive_cmds\" | $Xsed -e \"$delay_single_quote_subst\"`'\narchive_expsym_cmds='`$ECHO \"X$archive_expsym_cmds\" | $Xsed -e \"$delay_single_quote_subst\"`'\nmodule_cmds='`$ECHO \"X$module_cmds\" | $Xsed -e \"$delay_single_quote_subst\"`'\nmodule_expsym_cmds='`$ECHO \"X$module_expsym_cmds\" | $Xsed -e \"$delay_single_quote_subst\"`'\nwith_gnu_ld='`$ECHO \"X$with_gnu_ld\" | $Xsed -e \"$delay_single_quote_subst\"`'\nallow_undefined_flag='`$ECHO \"X$allow_undefined_flag\" | $Xsed -e \"$delay_single_quote_subst\"`'\nno_undefined_flag='`$ECHO \"X$no_undefined_flag\" | $Xsed -e \"$delay_single_quote_subst\"`'\nhardcode_libdir_flag_spec='`$ECHO \"X$hardcode_libdir_flag_spec\" | $Xsed -e \"$delay_single_quote_subst\"`'\nhardcode_libdir_flag_spec_ld='`$ECHO \"X$hardcode_libdir_flag_spec_ld\" | $Xsed -e \"$delay_single_quote_subst\"`'\nhardcode_libdir_separator='`$ECHO \"X$hardcode_libdir_separator\" | $Xsed -e \"$delay_single_quote_subst\"`'\nhardcode_direct='`$ECHO \"X$hardcode_direct\" | $Xsed -e \"$delay_single_quote_subst\"`'\nhardcode_direct_absolute='`$ECHO \"X$hardcode_direct_absolute\" | $Xsed -e \"$delay_single_quote_subst\"`'\nhardcode_minus_L='`$ECHO \"X$hardcode_minus_L\" | $Xsed -e \"$delay_single_quote_subst\"`'\nhardcode_shlibpath_var='`$ECHO \"X$hardcode_shlibpath_var\" | $Xsed -e \"$delay_single_quote_subst\"`'\nhardcode_automatic='`$ECHO \"X$hardcode_automatic\" | $Xsed -e \"$delay_single_quote_subst\"`'\ninherit_rpath='`$ECHO \"X$inherit_rpath\" | $Xsed -e \"$delay_single_quote_subst\"`'\nlink_all_deplibs='`$ECHO \"X$link_all_deplibs\" | $Xsed -e \"$delay_single_quote_subst\"`'\nfix_srcfile_path='`$ECHO \"X$fix_srcfile_path\" | $Xsed -e \"$delay_single_quote_subst\"`'\nalways_export_symbols='`$ECHO \"X$always_export_symbols\" | $Xsed -e \"$delay_single_quote_subst\"`'\nexport_symbols_cmds='`$ECHO \"X$export_symbols_cmds\" | $Xsed -e \"$delay_single_quote_subst\"`'\nexclude_expsyms='`$ECHO \"X$exclude_expsyms\" | $Xsed -e \"$delay_single_quote_subst\"`'\ninclude_expsyms='`$ECHO \"X$include_expsyms\" | $Xsed -e \"$delay_single_quote_subst\"`'\nprelink_cmds='`$ECHO \"X$prelink_cmds\" | $Xsed -e \"$delay_single_quote_subst\"`'\nfile_list_spec='`$ECHO \"X$file_list_spec\" | $Xsed -e \"$delay_single_quote_subst\"`'\nvariables_saved_for_relink='`$ECHO \"X$variables_saved_for_relink\" | $Xsed -e \"$delay_single_quote_subst\"`'\nneed_lib_prefix='`$ECHO \"X$need_lib_prefix\" | $Xsed -e \"$delay_single_quote_subst\"`'\nneed_version='`$ECHO \"X$need_version\" | $Xsed -e \"$delay_single_quote_subst\"`'\nversion_type='`$ECHO \"X$version_type\" | $Xsed -e \"$delay_single_quote_subst\"`'\nrunpath_var='`$ECHO \"X$runpath_var\" | $Xsed -e \"$delay_single_quote_subst\"`'\nshlibpath_var='`$ECHO \"X$shlibpath_var\" | $Xsed -e \"$delay_single_quote_subst\"`'\nshlibpath_overrides_runpath='`$ECHO \"X$shlibpath_overrides_runpath\" | $Xsed -e \"$delay_single_quote_subst\"`'\nlibname_spec='`$ECHO \"X$libname_spec\" | $Xsed -e \"$delay_single_quote_subst\"`'\nlibrary_names_spec='`$ECHO \"X$library_names_spec\" | $Xsed -e \"$delay_single_quote_subst\"`'\nsoname_spec='`$ECHO \"X$soname_spec\" | $Xsed -e \"$delay_single_quote_subst\"`'\npostinstall_cmds='`$ECHO \"X$postinstall_cmds\" | $Xsed -e \"$delay_single_quote_subst\"`'\npostuninstall_cmds='`$ECHO \"X$postuninstall_cmds\" | $Xsed -e \"$delay_single_quote_subst\"`'\nfinish_cmds='`$ECHO \"X$finish_cmds\" | $Xsed -e \"$delay_single_quote_subst\"`'\nfinish_eval='`$ECHO \"X$finish_eval\" | $Xsed -e \"$delay_single_quote_subst\"`'\nhardcode_into_libs='`$ECHO \"X$hardcode_into_libs\" | $Xsed -e \"$delay_single_quote_subst\"`'\nsys_lib_search_path_spec='`$ECHO \"X$sys_lib_search_path_spec\" | $Xsed -e \"$delay_single_quote_subst\"`'\nsys_lib_dlsearch_path_spec='`$ECHO \"X$sys_lib_dlsearch_path_spec\" | $Xsed -e \"$delay_single_quote_subst\"`'\nhardcode_action='`$ECHO \"X$hardcode_action\" | $Xsed -e \"$delay_single_quote_subst\"`'\nenable_dlopen='`$ECHO \"X$enable_dlopen\" | $Xsed -e \"$delay_single_quote_subst\"`'\nenable_dlopen_self='`$ECHO \"X$enable_dlopen_self\" | $Xsed -e \"$delay_single_quote_subst\"`'\nenable_dlopen_self_static='`$ECHO \"X$enable_dlopen_self_static\" | $Xsed -e \"$delay_single_quote_subst\"`'\nold_striplib='`$ECHO \"X$old_striplib\" | $Xsed -e \"$delay_single_quote_subst\"`'\nstriplib='`$ECHO \"X$striplib\" | $Xsed -e \"$delay_single_quote_subst\"`'\ncompiler_lib_search_dirs='`$ECHO \"X$compiler_lib_search_dirs\" | $Xsed -e \"$delay_single_quote_subst\"`'\npredep_objects='`$ECHO \"X$predep_objects\" | $Xsed -e \"$delay_single_quote_subst\"`'\npostdep_objects='`$ECHO \"X$postdep_objects\" | $Xsed -e \"$delay_single_quote_subst\"`'\npredeps='`$ECHO \"X$predeps\" | $Xsed -e \"$delay_single_quote_subst\"`'\npostdeps='`$ECHO \"X$postdeps\" | $Xsed -e \"$delay_single_quote_subst\"`'\ncompiler_lib_search_path='`$ECHO \"X$compiler_lib_search_path\" | $Xsed -e \"$delay_single_quote_subst\"`'\nLD_CXX='`$ECHO \"X$LD_CXX\" | $Xsed -e \"$delay_single_quote_subst\"`'\nold_archive_cmds_CXX='`$ECHO \"X$old_archive_cmds_CXX\" | $Xsed -e \"$delay_single_quote_subst\"`'\ncompiler_CXX='`$ECHO \"X$compiler_CXX\" | $Xsed -e \"$delay_single_quote_subst\"`'\nGCC_CXX='`$ECHO \"X$GCC_CXX\" | $Xsed -e \"$delay_single_quote_subst\"`'\nlt_prog_compiler_no_builtin_flag_CXX='`$ECHO \"X$lt_prog_compiler_no_builtin_flag_CXX\" | $Xsed -e \"$delay_single_quote_subst\"`'\nlt_prog_compiler_wl_CXX='`$ECHO \"X$lt_prog_compiler_wl_CXX\" | $Xsed -e \"$delay_single_quote_subst\"`'\nlt_prog_compiler_pic_CXX='`$ECHO \"X$lt_prog_compiler_pic_CXX\" | $Xsed -e \"$delay_single_quote_subst\"`'\nlt_prog_compiler_static_CXX='`$ECHO \"X$lt_prog_compiler_static_CXX\" | $Xsed -e \"$delay_single_quote_subst\"`'\nlt_cv_prog_compiler_c_o_CXX='`$ECHO \"X$lt_cv_prog_compiler_c_o_CXX\" | $Xsed -e \"$delay_single_quote_subst\"`'\narchive_cmds_need_lc_CXX='`$ECHO \"X$archive_cmds_need_lc_CXX\" | $Xsed -e \"$delay_single_quote_subst\"`'\nenable_shared_with_static_runtimes_CXX='`$ECHO \"X$enable_shared_with_static_runtimes_CXX\" | $Xsed -e \"$delay_single_quote_subst\"`'\nexport_dynamic_flag_spec_CXX='`$ECHO \"X$export_dynamic_flag_spec_CXX\" | $Xsed -e \"$delay_single_quote_subst\"`'\nwhole_archive_flag_spec_CXX='`$ECHO \"X$whole_archive_flag_spec_CXX\" | $Xsed -e \"$delay_single_quote_subst\"`'\ncompiler_needs_object_CXX='`$ECHO \"X$compiler_needs_object_CXX\" | $Xsed -e \"$delay_single_quote_subst\"`'\nold_archive_from_new_cmds_CXX='`$ECHO \"X$old_archive_from_new_cmds_CXX\" | $Xsed -e \"$delay_single_quote_subst\"`'\nold_archive_from_expsyms_cmds_CXX='`$ECHO \"X$old_archive_from_expsyms_cmds_CXX\" | $Xsed -e \"$delay_single_quote_subst\"`'\narchive_cmds_CXX='`$ECHO \"X$archive_cmds_CXX\" | $Xsed -e \"$delay_single_quote_subst\"`'\narchive_expsym_cmds_CXX='`$ECHO \"X$archive_expsym_cmds_CXX\" | $Xsed -e \"$delay_single_quote_subst\"`'\nmodule_cmds_CXX='`$ECHO \"X$module_cmds_CXX\" | $Xsed -e \"$delay_single_quote_subst\"`'\nmodule_expsym_cmds_CXX='`$ECHO \"X$module_expsym_cmds_CXX\" | $Xsed -e \"$delay_single_quote_subst\"`'\nwith_gnu_ld_CXX='`$ECHO \"X$with_gnu_ld_CXX\" | $Xsed -e \"$delay_single_quote_subst\"`'\nallow_undefined_flag_CXX='`$ECHO \"X$allow_undefined_flag_CXX\" | $Xsed -e \"$delay_single_quote_subst\"`'\nno_undefined_flag_CXX='`$ECHO \"X$no_undefined_flag_CXX\" | $Xsed -e \"$delay_single_quote_subst\"`'\nhardcode_libdir_flag_spec_CXX='`$ECHO \"X$hardcode_libdir_flag_spec_CXX\" | $Xsed -e \"$delay_single_quote_subst\"`'\nhardcode_libdir_flag_spec_ld_CXX='`$ECHO \"X$hardcode_libdir_flag_spec_ld_CXX\" | $Xsed -e \"$delay_single_quote_subst\"`'\nhardcode_libdir_separator_CXX='`$ECHO \"X$hardcode_libdir_separator_CXX\" | $Xsed -e \"$delay_single_quote_subst\"`'\nhardcode_direct_CXX='`$ECHO \"X$hardcode_direct_CXX\" | $Xsed -e \"$delay_single_quote_subst\"`'\nhardcode_direct_absolute_CXX='`$ECHO \"X$hardcode_direct_absolute_CXX\" | $Xsed -e \"$delay_single_quote_subst\"`'\nhardcode_minus_L_CXX='`$ECHO \"X$hardcode_minus_L_CXX\" | $Xsed -e \"$delay_single_quote_subst\"`'\nhardcode_shlibpath_var_CXX='`$ECHO \"X$hardcode_shlibpath_var_CXX\" | $Xsed -e \"$delay_single_quote_subst\"`'\nhardcode_automatic_CXX='`$ECHO \"X$hardcode_automatic_CXX\" | $Xsed -e \"$delay_single_quote_subst\"`'\ninherit_rpath_CXX='`$ECHO \"X$inherit_rpath_CXX\" | $Xsed -e \"$delay_single_quote_subst\"`'\nlink_all_deplibs_CXX='`$ECHO \"X$link_all_deplibs_CXX\" | $Xsed -e \"$delay_single_quote_subst\"`'\nfix_srcfile_path_CXX='`$ECHO \"X$fix_srcfile_path_CXX\" | $Xsed -e \"$delay_single_quote_subst\"`'\nalways_export_symbols_CXX='`$ECHO \"X$always_export_symbols_CXX\" | $Xsed -e \"$delay_single_quote_subst\"`'\nexport_symbols_cmds_CXX='`$ECHO \"X$export_symbols_cmds_CXX\" | $Xsed -e \"$delay_single_quote_subst\"`'\nexclude_expsyms_CXX='`$ECHO \"X$exclude_expsyms_CXX\" | $Xsed -e \"$delay_single_quote_subst\"`'\ninclude_expsyms_CXX='`$ECHO \"X$include_expsyms_CXX\" | $Xsed -e \"$delay_single_quote_subst\"`'\nprelink_cmds_CXX='`$ECHO \"X$prelink_cmds_CXX\" | $Xsed -e \"$delay_single_quote_subst\"`'\nfile_list_spec_CXX='`$ECHO \"X$file_list_spec_CXX\" | $Xsed -e \"$delay_single_quote_subst\"`'\nhardcode_action_CXX='`$ECHO \"X$hardcode_action_CXX\" | $Xsed -e \"$delay_single_quote_subst\"`'\ncompiler_lib_search_dirs_CXX='`$ECHO \"X$compiler_lib_search_dirs_CXX\" | $Xsed -e \"$delay_single_quote_subst\"`'\npredep_objects_CXX='`$ECHO \"X$predep_objects_CXX\" | $Xsed -e \"$delay_single_quote_subst\"`'\npostdep_objects_CXX='`$ECHO \"X$postdep_objects_CXX\" | $Xsed -e \"$delay_single_quote_subst\"`'\npredeps_CXX='`$ECHO \"X$predeps_CXX\" | $Xsed -e \"$delay_single_quote_subst\"`'\npostdeps_CXX='`$ECHO \"X$postdeps_CXX\" | $Xsed -e \"$delay_single_quote_subst\"`'\ncompiler_lib_search_path_CXX='`$ECHO \"X$compiler_lib_search_path_CXX\" | $Xsed -e \"$delay_single_quote_subst\"`'\n\nLTCC='$LTCC'\nLTCFLAGS='$LTCFLAGS'\ncompiler='$compiler_DEFAULT'\n\n# Quote evaled strings.\nfor var in SED \\\nGREP \\\nEGREP \\\nFGREP \\\nLD \\\nNM \\\nLN_S \\\nlt_SP2NL \\\nlt_NL2SP \\\nreload_flag \\\ndeplibs_check_method \\\nfile_magic_cmd \\\nAR \\\nAR_FLAGS \\\nSTRIP \\\nRANLIB \\\nCC \\\nCFLAGS \\\ncompiler \\\nlt_cv_sys_global_symbol_pipe \\\nlt_cv_sys_global_symbol_to_cdecl \\\nlt_cv_sys_global_symbol_to_c_name_address \\\nlt_cv_sys_global_symbol_to_c_name_address_lib_prefix \\\nSHELL \\\nECHO \\\nlt_prog_compiler_no_builtin_flag \\\nlt_prog_compiler_wl \\\nlt_prog_compiler_pic \\\nlt_prog_compiler_static \\\nlt_cv_prog_compiler_c_o \\\nneed_locks \\\nDSYMUTIL \\\nNMEDIT \\\nLIPO \\\nOTOOL \\\nOTOOL64 \\\nshrext_cmds \\\nexport_dynamic_flag_spec \\\nwhole_archive_flag_spec \\\ncompiler_needs_object \\\nwith_gnu_ld \\\nallow_undefined_flag \\\nno_undefined_flag \\\nhardcode_libdir_flag_spec \\\nhardcode_libdir_flag_spec_ld \\\nhardcode_libdir_separator \\\nfix_srcfile_path \\\nexclude_expsyms \\\ninclude_expsyms \\\nfile_list_spec \\\nvariables_saved_for_relink \\\nlibname_spec \\\nlibrary_names_spec \\\nsoname_spec \\\nfinish_eval \\\nold_striplib \\\nstriplib \\\ncompiler_lib_search_dirs \\\npredep_objects \\\npostdep_objects \\\npredeps \\\npostdeps \\\ncompiler_lib_search_path \\\nLD_CXX \\\ncompiler_CXX \\\nlt_prog_compiler_no_builtin_flag_CXX \\\nlt_prog_compiler_wl_CXX \\\nlt_prog_compiler_pic_CXX \\\nlt_prog_compiler_static_CXX \\\nlt_cv_prog_compiler_c_o_CXX \\\nexport_dynamic_flag_spec_CXX \\\nwhole_archive_flag_spec_CXX \\\ncompiler_needs_object_CXX \\\nwith_gnu_ld_CXX \\\nallow_undefined_flag_CXX \\\nno_undefined_flag_CXX \\\nhardcode_libdir_flag_spec_CXX \\\nhardcode_libdir_flag_spec_ld_CXX \\\nhardcode_libdir_separator_CXX \\\nfix_srcfile_path_CXX \\\nexclude_expsyms_CXX \\\ninclude_expsyms_CXX \\\nfile_list_spec_CXX \\\ncompiler_lib_search_dirs_CXX \\\npredep_objects_CXX \\\npostdep_objects_CXX \\\npredeps_CXX \\\npostdeps_CXX \\\ncompiler_lib_search_path_CXX; do\n    case \\`eval \\\\\\\\\\$ECHO \"X\\\\\\\\\\$\\$var\"\\` in\n    *[\\\\\\\\\\\\\\`\\\\\"\\\\\\$]*)\n      eval \"lt_\\$var=\\\\\\\\\\\\\"\\\\\\`\\\\\\$ECHO \\\\\"X\\\\\\$\\$var\\\\\" | \\\\\\$Xsed -e \\\\\"\\\\\\$sed_quote_subst\\\\\"\\\\\\`\\\\\\\\\\\\\"\"\n      ;;\n    *)\n      eval \"lt_\\$var=\\\\\\\\\\\\\"\\\\\\$\\$var\\\\\\\\\\\\\"\"\n      ;;\n    esac\ndone\n\n# Double-quote double-evaled strings.\nfor var in reload_cmds \\\nold_postinstall_cmds \\\nold_postuninstall_cmds \\\nold_archive_cmds \\\nextract_expsyms_cmds \\\nold_archive_from_new_cmds \\\nold_archive_from_expsyms_cmds \\\narchive_cmds \\\narchive_expsym_cmds \\\nmodule_cmds \\\nmodule_expsym_cmds \\\nexport_symbols_cmds \\\nprelink_cmds \\\npostinstall_cmds \\\npostuninstall_cmds \\\nfinish_cmds \\\nsys_lib_search_path_spec \\\nsys_lib_dlsearch_path_spec \\\nold_archive_cmds_CXX \\\nold_archive_from_new_cmds_CXX \\\nold_archive_from_expsyms_cmds_CXX \\\narchive_cmds_CXX \\\narchive_expsym_cmds_CXX \\\nmodule_cmds_CXX \\\nmodule_expsym_cmds_CXX \\\nexport_symbols_cmds_CXX \\\nprelink_cmds_CXX; do\n    case \\`eval \\\\\\\\\\$ECHO \"X\\\\\\\\\\$\\$var\"\\` in\n    *[\\\\\\\\\\\\\\`\\\\\"\\\\\\$]*)\n      eval \"lt_\\$var=\\\\\\\\\\\\\"\\\\\\`\\\\\\$ECHO \\\\\"X\\\\\\$\\$var\\\\\" | \\\\\\$Xsed -e \\\\\"\\\\\\$double_quote_subst\\\\\" -e \\\\\"\\\\\\$sed_quote_subst\\\\\" -e \\\\\"\\\\\\$delay_variable_subst\\\\\"\\\\\\`\\\\\\\\\\\\\"\"\n      ;;\n    *)\n      eval \"lt_\\$var=\\\\\\\\\\\\\"\\\\\\$\\$var\\\\\\\\\\\\\"\"\n      ;;\n    esac\ndone\n\n# Fix-up fallback echo if it was mangled by the above quoting rules.\ncase \\$lt_ECHO in\n*'\\\\\\$0 --fallback-echo\"')  lt_ECHO=\\`\\$ECHO \"X\\$lt_ECHO\" | \\$Xsed -e 's/\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\$0 --fallback-echo\"\\$/\\$0 --fallback-echo\"/'\\`\n  ;;\nesac\n\nac_aux_dir='$ac_aux_dir'\nxsi_shell='$xsi_shell'\nlt_shell_append='$lt_shell_append'\n\n# See if we are running on zsh, and set the options which allow our\n# commands through without removal of \\ escapes INIT.\nif test -n \"\\${ZSH_VERSION+set}\" ; then\n   setopt NO_GLOB_SUBST\nfi\n\n\n    PACKAGE='$PACKAGE'\n    VERSION='$VERSION'\n    TIMESTAMP='$TIMESTAMP'\n    RM='$RM'\n    ofile='$ofile'\n\n\n\n\n\n\n_ACEOF\n\ncat >>$CONFIG_STATUS <<\\_ACEOF || ac_write_fail=1\n\n# Handling of arguments.\nfor ac_config_target in $ac_config_targets\ndo\n  case $ac_config_target in\n    \"depfiles\") CONFIG_COMMANDS=\"$CONFIG_COMMANDS depfiles\" ;;\n    \"libtool\") CONFIG_COMMANDS=\"$CONFIG_COMMANDS libtool\" ;;\n    \"libtiff/tif_config.h\") CONFIG_HEADERS=\"$CONFIG_HEADERS libtiff/tif_config.h\" ;;\n    \"libtiff/tiffconf.h\") CONFIG_HEADERS=\"$CONFIG_HEADERS libtiff/tiffconf.h\" ;;\n    \"Makefile\") CONFIG_FILES=\"$CONFIG_FILES Makefile\" ;;\n    \"build/Makefile\") CONFIG_FILES=\"$CONFIG_FILES build/Makefile\" ;;\n    \"contrib/Makefile\") CONFIG_FILES=\"$CONFIG_FILES contrib/Makefile\" ;;\n    \"contrib/acorn/Makefile\") CONFIG_FILES=\"$CONFIG_FILES contrib/acorn/Makefile\" ;;\n    \"contrib/addtiffo/Makefile\") CONFIG_FILES=\"$CONFIG_FILES contrib/addtiffo/Makefile\" ;;\n    \"contrib/dbs/Makefile\") CONFIG_FILES=\"$CONFIG_FILES contrib/dbs/Makefile\" ;;\n    \"contrib/dbs/xtiff/Makefile\") CONFIG_FILES=\"$CONFIG_FILES contrib/dbs/xtiff/Makefile\" ;;\n    \"contrib/iptcutil/Makefile\") CONFIG_FILES=\"$CONFIG_FILES contrib/iptcutil/Makefile\" ;;\n    \"contrib/mac-cw/Makefile\") CONFIG_FILES=\"$CONFIG_FILES contrib/mac-cw/Makefile\" ;;\n    \"contrib/mac-mpw/Makefile\") CONFIG_FILES=\"$CONFIG_FILES contrib/mac-mpw/Makefile\" ;;\n    \"contrib/mfs/Makefile\") CONFIG_FILES=\"$CONFIG_FILES contrib/mfs/Makefile\" ;;\n    \"contrib/pds/Makefile\") CONFIG_FILES=\"$CONFIG_FILES contrib/pds/Makefile\" ;;\n    \"contrib/ras/Makefile\") CONFIG_FILES=\"$CONFIG_FILES contrib/ras/Makefile\" ;;\n    \"contrib/stream/Makefile\") CONFIG_FILES=\"$CONFIG_FILES contrib/stream/Makefile\" ;;\n    \"contrib/tags/Makefile\") CONFIG_FILES=\"$CONFIG_FILES contrib/tags/Makefile\" ;;\n    \"contrib/win_dib/Makefile\") CONFIG_FILES=\"$CONFIG_FILES contrib/win_dib/Makefile\" ;;\n    \"html/Makefile\") CONFIG_FILES=\"$CONFIG_FILES html/Makefile\" ;;\n    \"html/images/Makefile\") CONFIG_FILES=\"$CONFIG_FILES html/images/Makefile\" ;;\n    \"html/man/Makefile\") CONFIG_FILES=\"$CONFIG_FILES html/man/Makefile\" ;;\n    \"libtiff/Makefile\") CONFIG_FILES=\"$CONFIG_FILES libtiff/Makefile\" ;;\n    \"man/Makefile\") CONFIG_FILES=\"$CONFIG_FILES man/Makefile\" ;;\n    \"port/Makefile\") CONFIG_FILES=\"$CONFIG_FILES port/Makefile\" ;;\n    \"test/Makefile\") CONFIG_FILES=\"$CONFIG_FILES test/Makefile\" ;;\n    \"tools/Makefile\") CONFIG_FILES=\"$CONFIG_FILES tools/Makefile\" ;;\n\n  *) as_fn_error \"invalid argument: \\`$ac_config_target'\" \"$LINENO\" 5;;\n  esac\ndone\n\n\n# If the user did not use the arguments to specify the items to instantiate,\n# then the envvar interface is used.  Set only those that are not.\n# We use the long form for the default assignment because of an extremely\n# bizarre bug on SunOS 4.1.3.\nif $ac_need_defaults; then\n  test \"${CONFIG_FILES+set}\" = set || CONFIG_FILES=$config_files\n  test \"${CONFIG_HEADERS+set}\" = set || CONFIG_HEADERS=$config_headers\n  test \"${CONFIG_COMMANDS+set}\" = set || CONFIG_COMMANDS=$config_commands\nfi\n\n# Have a temporary directory for convenience.  Make it in the build tree\n# simply because there is no reason against having it here, and in addition,\n# creating and moving files from /tmp can sometimes cause problems.\n# Hook for its removal unless debugging.\n# Note that there is a small window in which the directory will not be cleaned:\n# after its creation but before its name has been assigned to `$tmp'.\n$debug ||\n{\n  tmp=\n  trap 'exit_status=$?\n  { test -z \"$tmp\" || test ! -d \"$tmp\" || rm -fr \"$tmp\"; } && exit $exit_status\n' 0\n  trap 'as_fn_exit 1' 1 2 13 15\n}\n# Create a (secure) tmp directory for tmp files.\n\n{\n  tmp=`(umask 077 && mktemp -d \"./confXXXXXX\") 2>/dev/null` &&\n  test -n \"$tmp\" && test -d \"$tmp\"\n}  ||\n{\n  tmp=./conf$$-$RANDOM\n  (umask 077 && mkdir \"$tmp\")\n} || as_fn_error \"cannot create a temporary directory in .\" \"$LINENO\" 5\n\n# Set up the scripts for CONFIG_FILES section.\n# No need to generate them if there are no CONFIG_FILES.\n# This happens for instance with `./config.status config.h'.\nif test -n \"$CONFIG_FILES\"; then\n\n\nac_cr=`echo X | tr X '\\015'`\n# On cygwin, bash can eat \\r inside `` if the user requested igncr.\n# But we know of no other shell where ac_cr would be empty at this\n# point, so we can use a bashism as a fallback.\nif test \"x$ac_cr\" = x; then\n  eval ac_cr=\\$\\'\\\\r\\'\nfi\nac_cs_awk_cr=`$AWK 'BEGIN { print \"a\\rb\" }' </dev/null 2>/dev/null`\nif test \"$ac_cs_awk_cr\" = \"a${ac_cr}b\"; then\n  ac_cs_awk_cr='\\r'\nelse\n  ac_cs_awk_cr=$ac_cr\nfi\n\necho 'BEGIN {' >\"$tmp/subs1.awk\" &&\n_ACEOF\n\n\n{\n  echo \"cat >conf$$subs.awk <<_ACEOF\" &&\n  echo \"$ac_subst_vars\" | sed 's/.*/&!$&$ac_delim/' &&\n  echo \"_ACEOF\"\n} >conf$$subs.sh ||\n  as_fn_error \"could not make $CONFIG_STATUS\" \"$LINENO\" 5\nac_delim_num=`echo \"$ac_subst_vars\" | grep -c '$'`\nac_delim='%!_!# '\nfor ac_last_try in false false false false false :; do\n  . ./conf$$subs.sh ||\n    as_fn_error \"could not make $CONFIG_STATUS\" \"$LINENO\" 5\n\n  ac_delim_n=`sed -n \"s/.*$ac_delim\\$/X/p\" conf$$subs.awk | grep -c X`\n  if test $ac_delim_n = $ac_delim_num; then\n    break\n  elif $ac_last_try; then\n    as_fn_error \"could not make $CONFIG_STATUS\" \"$LINENO\" 5\n  else\n    ac_delim=\"$ac_delim!$ac_delim _$ac_delim!! \"\n  fi\ndone\nrm -f conf$$subs.sh\n\ncat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1\ncat >>\"\\$tmp/subs1.awk\" <<\\\\_ACAWK &&\n_ACEOF\nsed -n '\nh\ns/^/S[\"/; s/!.*/\"]=/\np\ng\ns/^[^!]*!//\n:repl\nt repl\ns/'\"$ac_delim\"'$//\nt delim\n:nl\nh\ns/\\(.\\{148\\}\\).*/\\1/\nt more1\ns/[\"\\\\]/\\\\&/g; s/^/\"/; s/$/\\\\n\"\\\\/\np\nn\nb repl\n:more1\ns/[\"\\\\]/\\\\&/g; s/^/\"/; s/$/\"\\\\/\np\ng\ns/.\\{148\\}//\nt nl\n:delim\nh\ns/\\(.\\{148\\}\\).*/\\1/\nt more2\ns/[\"\\\\]/\\\\&/g; s/^/\"/; s/$/\"/\np\nb\n:more2\ns/[\"\\\\]/\\\\&/g; s/^/\"/; s/$/\"\\\\/\np\ng\ns/.\\{148\\}//\nt delim\n' <conf$$subs.awk | sed '\n/^[^\"\"]/{\n  N\n  s/\\n//\n}\n' >>$CONFIG_STATUS || ac_write_fail=1\nrm -f conf$$subs.awk\ncat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1\n_ACAWK\ncat >>\"\\$tmp/subs1.awk\" <<_ACAWK &&\n  for (key in S) S_is_set[key] = 1\n  FS = \"\u0007\"\n\n}\n{\n  line = $ 0\n  nfields = split(line, field, \"@\")\n  substed = 0\n  len = length(field[1])\n  for (i = 2; i < nfields; i++) {\n    key = field[i]\n    keylen = length(key)\n    if (S_is_set[key]) {\n      value = S[key]\n      line = substr(line, 1, len) \"\" value \"\" substr(line, len + keylen + 3)\n      len += length(value) + length(field[++i])\n      substed = 1\n    } else\n      len += 1 + keylen\n  }\n\n  print line\n}\n\n_ACAWK\n_ACEOF\ncat >>$CONFIG_STATUS <<\\_ACEOF || ac_write_fail=1\nif sed \"s/$ac_cr//\" < /dev/null > /dev/null 2>&1; then\n  sed \"s/$ac_cr\\$//; s/$ac_cr/$ac_cs_awk_cr/g\"\nelse\n  cat\nfi < \"$tmp/subs1.awk\" > \"$tmp/subs.awk\" \\\n  || as_fn_error \"could not setup config files machinery\" \"$LINENO\" 5\n_ACEOF\n\n# VPATH may cause trouble with some makes, so we remove $(srcdir),\n# ${srcdir} and @srcdir@ from VPATH if srcdir is \".\", strip leading and\n# trailing colons and then remove the whole line if VPATH becomes empty\n# (actually we leave an empty line to preserve line numbers).\nif test \"x$srcdir\" = x.; then\n  ac_vpsub='/^[\t ]*VPATH[\t ]*=/{\ns/:*\\$(srcdir):*/:/\ns/:*\\${srcdir}:*/:/\ns/:*@srcdir@:*/:/\ns/^\\([^=]*=[\t ]*\\):*/\\1/\ns/:*$//\ns/^[^=]*=[\t ]*$//\n}'\nfi\n\ncat >>$CONFIG_STATUS <<\\_ACEOF || ac_write_fail=1\nfi # test -n \"$CONFIG_FILES\"\n\n# Set up the scripts for CONFIG_HEADERS section.\n# No need to generate them if there are no CONFIG_HEADERS.\n# This happens for instance with `./config.status Makefile'.\nif test -n \"$CONFIG_HEADERS\"; then\ncat >\"$tmp/defines.awk\" <<\\_ACAWK ||\nBEGIN {\n_ACEOF\n\n# Transform confdefs.h into an awk script `defines.awk', embedded as\n# here-document in config.status, that substitutes the proper values into\n# config.h.in to produce config.h.\n\n# Create a delimiter string that does not exist in confdefs.h, to ease\n# handling of long lines.\nac_delim='%!_!# '\nfor ac_last_try in false false :; do\n  ac_t=`sed -n \"/$ac_delim/p\" confdefs.h`\n  if test -z \"$ac_t\"; then\n    break\n  elif $ac_last_try; then\n    as_fn_error \"could not make $CONFIG_HEADERS\" \"$LINENO\" 5\n  else\n    ac_delim=\"$ac_delim!$ac_delim _$ac_delim!! \"\n  fi\ndone\n\n# For the awk script, D is an array of macro values keyed by name,\n# likewise P contains macro parameters if any.  Preserve backslash\n# newline sequences.\n\nac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*\nsed -n '\ns/.\\{148\\}/&'\"$ac_delim\"'/g\nt rset\n:rset\ns/^[\t ]*#[\t ]*define[\t ][\t ]*/ /\nt def\nd\n:def\ns/\\\\$//\nt bsnl\ns/[\"\\\\]/\\\\&/g\ns/^ \\('\"$ac_word_re\"'\\)\\(([^()]*)\\)[\t ]*\\(.*\\)/P[\"\\1\"]=\"\\2\"\\\nD[\"\\1\"]=\" \\3\"/p\ns/^ \\('\"$ac_word_re\"'\\)[\t ]*\\(.*\\)/D[\"\\1\"]=\" \\2\"/p\nd\n:bsnl\ns/[\"\\\\]/\\\\&/g\ns/^ \\('\"$ac_word_re\"'\\)\\(([^()]*)\\)[\t ]*\\(.*\\)/P[\"\\1\"]=\"\\2\"\\\nD[\"\\1\"]=\" \\3\\\\\\\\\\\\n\"\\\\/p\nt cont\ns/^ \\('\"$ac_word_re\"'\\)[\t ]*\\(.*\\)/D[\"\\1\"]=\" \\2\\\\\\\\\\\\n\"\\\\/p\nt cont\nd\n:cont\nn\ns/.\\{148\\}/&'\"$ac_delim\"'/g\nt clear\n:clear\ns/\\\\$//\nt bsnlc\ns/[\"\\\\]/\\\\&/g; s/^/\"/; s/$/\"/p\nd\n:bsnlc\ns/[\"\\\\]/\\\\&/g; s/^/\"/; s/$/\\\\\\\\\\\\n\"\\\\/p\nb cont\n' <confdefs.h | sed '\ns/'\"$ac_delim\"'/\"\\\\\\\n\"/g' >>$CONFIG_STATUS || ac_write_fail=1\n\ncat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1\n  for (key in D) D_is_set[key] = 1\n  FS = \"\u0007\"\n}\n/^[\\t ]*#[\\t ]*(define|undef)[\\t ]+$ac_word_re([\\t (]|\\$)/ {\n  line = \\$ 0\n  split(line, arg, \" \")\n  if (arg[1] == \"#\") {\n    defundef = arg[2]\n    mac1 = arg[3]\n  } else {\n    defundef = substr(arg[1], 2)\n    mac1 = arg[2]\n  }\n  split(mac1, mac2, \"(\") #)\n  macro = mac2[1]\n  prefix = substr(line, 1, index(line, defundef) - 1)\n  if (D_is_set[macro]) {\n    # Preserve the white space surrounding the \"#\".\n    print prefix \"define\", macro P[macro] D[macro]\n    next\n  } else {\n    # Replace #undef with comments.  This is necessary, for example,\n    # in the case of _POSIX_SOURCE, which is predefined and required\n    # on some systems where configure will not decide to define it.\n    if (defundef == \"undef\") {\n      print \"/*\", prefix defundef, macro, \"*/\"\n      next\n    }\n  }\n}\n{ print }\n_ACAWK\n_ACEOF\ncat >>$CONFIG_STATUS <<\\_ACEOF || ac_write_fail=1\n  as_fn_error \"could not setup config headers machinery\" \"$LINENO\" 5\nfi # test -n \"$CONFIG_HEADERS\"\n\n\neval set X \"  :F $CONFIG_FILES  :H $CONFIG_HEADERS    :C $CONFIG_COMMANDS\"\nshift\nfor ac_tag\ndo\n  case $ac_tag in\n  :[FHLC]) ac_mode=$ac_tag; continue;;\n  esac\n  case $ac_mode$ac_tag in\n  :[FHL]*:*);;\n  :L* | :C*:*) as_fn_error \"invalid tag \\`$ac_tag'\" \"$LINENO\" 5;;\n  :[FH]-) ac_tag=-:-;;\n  :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;\n  esac\n  ac_save_IFS=$IFS\n  IFS=:\n  set x $ac_tag\n  IFS=$ac_save_IFS\n  shift\n  ac_file=$1\n  shift\n\n  case $ac_mode in\n  :L) ac_source=$1;;\n  :[FH])\n    ac_file_inputs=\n    for ac_f\n    do\n      case $ac_f in\n      -) ac_f=\"$tmp/stdin\";;\n      *) # Look for the file first in the build tree, then in the source tree\n\t # (if the path is not absolute).  The absolute path cannot be DOS-style,\n\t # because $ac_f cannot contain `:'.\n\t test -f \"$ac_f\" ||\n\t   case $ac_f in\n\t   [\\\\/$]*) false;;\n\t   *) test -f \"$srcdir/$ac_f\" && ac_f=\"$srcdir/$ac_f\";;\n\t   esac ||\n\t   as_fn_error \"cannot find input file: \\`$ac_f'\" \"$LINENO\" 5;;\n      esac\n      case $ac_f in *\\'*) ac_f=`$as_echo \"$ac_f\" | sed \"s/'/'\\\\\\\\\\\\\\\\''/g\"`;; esac\n      as_fn_append ac_file_inputs \" '$ac_f'\"\n    done\n\n    # Let's still pretend it is `configure' which instantiates (i.e., don't\n    # use $as_me), people would be surprised to read:\n    #    /* config.h.  Generated by config.status.  */\n    configure_input='Generated from '`\n\t  $as_echo \"$*\" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'\n\t`' by configure.'\n    if test x\"$ac_file\" != x-; then\n      configure_input=\"$ac_file.  $configure_input\"\n      { $as_echo \"$as_me:${as_lineno-$LINENO}: creating $ac_file\" >&5\n$as_echo \"$as_me: creating $ac_file\" >&6;}\n    fi\n    # Neutralize special characters interpreted by sed in replacement strings.\n    case $configure_input in #(\n    *\\&* | *\\|* | *\\\\* )\n       ac_sed_conf_input=`$as_echo \"$configure_input\" |\n       sed 's/[\\\\\\\\&|]/\\\\\\\\&/g'`;; #(\n    *) ac_sed_conf_input=$configure_input;;\n    esac\n\n    case $ac_tag in\n    *:-:* | *:-) cat >\"$tmp/stdin\" \\\n      || as_fn_error \"could not create $ac_file\" \"$LINENO\" 5 ;;\n    esac\n    ;;\n  esac\n\n  ac_dir=`$as_dirname -- \"$ac_file\" ||\n$as_expr X\"$ac_file\" : 'X\\(.*[^/]\\)//*[^/][^/]*/*$' \\| \\\n\t X\"$ac_file\" : 'X\\(//\\)[^/]' \\| \\\n\t X\"$ac_file\" : 'X\\(//\\)$' \\| \\\n\t X\"$ac_file\" : 'X\\(/\\)' \\| . 2>/dev/null ||\n$as_echo X\"$ac_file\" |\n    sed '/^X\\(.*[^/]\\)\\/\\/*[^/][^/]*\\/*$/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  /^X\\(\\/\\/\\)[^/].*/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  /^X\\(\\/\\/\\)$/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  /^X\\(\\/\\).*/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  s/.*/./; q'`\n  as_dir=\"$ac_dir\"; as_fn_mkdir_p\n  ac_builddir=.\n\ncase \"$ac_dir\" in\n.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;\n*)\n  ac_dir_suffix=/`$as_echo \"$ac_dir\" | sed 's|^\\.[\\\\/]||'`\n  # A \"..\" for each directory in $ac_dir_suffix.\n  ac_top_builddir_sub=`$as_echo \"$ac_dir_suffix\" | sed 's|/[^\\\\/]*|/..|g;s|/||'`\n  case $ac_top_builddir_sub in\n  \"\") ac_top_builddir_sub=. ac_top_build_prefix= ;;\n  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;\n  esac ;;\nesac\nac_abs_top_builddir=$ac_pwd\nac_abs_builddir=$ac_pwd$ac_dir_suffix\n# for backward compatibility:\nac_top_builddir=$ac_top_build_prefix\n\ncase $srcdir in\n  .)  # We are building in place.\n    ac_srcdir=.\n    ac_top_srcdir=$ac_top_builddir_sub\n    ac_abs_top_srcdir=$ac_pwd ;;\n  [\\\\/]* | ?:[\\\\/]* )  # Absolute name.\n    ac_srcdir=$srcdir$ac_dir_suffix;\n    ac_top_srcdir=$srcdir\n    ac_abs_top_srcdir=$srcdir ;;\n  *) # Relative name.\n    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix\n    ac_top_srcdir=$ac_top_build_prefix$srcdir\n    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;\nesac\nac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix\n\n\n  case $ac_mode in\n  :F)\n  #\n  # CONFIG_FILE\n  #\n\n  case $INSTALL in\n  [\\\\/$]* | ?:[\\\\/]* ) ac_INSTALL=$INSTALL ;;\n  *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;\n  esac\n  ac_MKDIR_P=$MKDIR_P\n  case $MKDIR_P in\n  [\\\\/$]* | ?:[\\\\/]* ) ;;\n  */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;;\n  esac\n_ACEOF\n\ncat >>$CONFIG_STATUS <<\\_ACEOF || ac_write_fail=1\n# If the template does not know about datarootdir, expand it.\n# FIXME: This hack should be removed a few years after 2.60.\nac_datarootdir_hack=; ac_datarootdir_seen=\nac_sed_dataroot='\n/datarootdir/ {\n  p\n  q\n}\n/@datadir@/p\n/@docdir@/p\n/@infodir@/p\n/@localedir@/p\n/@mandir@/p'\ncase `eval \"sed -n \\\"\\$ac_sed_dataroot\\\" $ac_file_inputs\"` in\n*datarootdir*) ac_datarootdir_seen=yes;;\n*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting\" >&5\n$as_echo \"$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting\" >&2;}\n_ACEOF\ncat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1\n  ac_datarootdir_hack='\n  s&@datadir@&$datadir&g\n  s&@docdir@&$docdir&g\n  s&@infodir@&$infodir&g\n  s&@localedir@&$localedir&g\n  s&@mandir@&$mandir&g\n  s&\\\\\\${datarootdir}&$datarootdir&g' ;;\nesac\n_ACEOF\n\n# Neutralize VPATH when `$srcdir' = `.'.\n# Shell code in configure.ac might set extrasub.\n# FIXME: do we really want to maintain this feature?\ncat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1\nac_sed_extra=\"$ac_vpsub\n$extrasub\n_ACEOF\ncat >>$CONFIG_STATUS <<\\_ACEOF || ac_write_fail=1\n:t\n/@[a-zA-Z_][a-zA-Z_0-9]*@/!b\ns|@configure_input@|$ac_sed_conf_input|;t t\ns&@top_builddir@&$ac_top_builddir_sub&;t t\ns&@top_build_prefix@&$ac_top_build_prefix&;t t\ns&@srcdir@&$ac_srcdir&;t t\ns&@abs_srcdir@&$ac_abs_srcdir&;t t\ns&@top_srcdir@&$ac_top_srcdir&;t t\ns&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t\ns&@builddir@&$ac_builddir&;t t\ns&@abs_builddir@&$ac_abs_builddir&;t t\ns&@abs_top_builddir@&$ac_abs_top_builddir&;t t\ns&@INSTALL@&$ac_INSTALL&;t t\ns&@MKDIR_P@&$ac_MKDIR_P&;t t\n$ac_datarootdir_hack\n\"\neval sed \\\"\\$ac_sed_extra\\\" \"$ac_file_inputs\" | $AWK -f \"$tmp/subs.awk\" >$tmp/out \\\n  || as_fn_error \"could not create $ac_file\" \"$LINENO\" 5\n\ntest -z \"$ac_datarootdir_hack$ac_datarootdir_seen\" &&\n  { ac_out=`sed -n '/\\${datarootdir}/p' \"$tmp/out\"`; test -n \"$ac_out\"; } &&\n  { ac_out=`sed -n '/^[\t ]*datarootdir[\t ]*:*=/p' \"$tmp/out\"`; test -z \"$ac_out\"; } &&\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \\`datarootdir'\nwhich seems to be undefined.  Please make sure it is defined.\" >&5\n$as_echo \"$as_me: WARNING: $ac_file contains a reference to the variable \\`datarootdir'\nwhich seems to be undefined.  Please make sure it is defined.\" >&2;}\n\n  rm -f \"$tmp/stdin\"\n  case $ac_file in\n  -) cat \"$tmp/out\" && rm -f \"$tmp/out\";;\n  *) rm -f \"$ac_file\" && mv \"$tmp/out\" \"$ac_file\";;\n  esac \\\n  || as_fn_error \"could not create $ac_file\" \"$LINENO\" 5\n ;;\n  :H)\n  #\n  # CONFIG_HEADER\n  #\n  if test x\"$ac_file\" != x-; then\n    {\n      $as_echo \"/* $configure_input  */\" \\\n      && eval '$AWK -f \"$tmp/defines.awk\"' \"$ac_file_inputs\"\n    } >\"$tmp/config.h\" \\\n      || as_fn_error \"could not create $ac_file\" \"$LINENO\" 5\n    if diff \"$ac_file\" \"$tmp/config.h\" >/dev/null 2>&1; then\n      { $as_echo \"$as_me:${as_lineno-$LINENO}: $ac_file is unchanged\" >&5\n$as_echo \"$as_me: $ac_file is unchanged\" >&6;}\n    else\n      rm -f \"$ac_file\"\n      mv \"$tmp/config.h\" \"$ac_file\" \\\n\t|| as_fn_error \"could not create $ac_file\" \"$LINENO\" 5\n    fi\n  else\n    $as_echo \"/* $configure_input  */\" \\\n      && eval '$AWK -f \"$tmp/defines.awk\"' \"$ac_file_inputs\" \\\n      || as_fn_error \"could not create -\" \"$LINENO\" 5\n  fi\n# Compute \"$ac_file\"'s index in $config_headers.\n_am_arg=\"$ac_file\"\n_am_stamp_count=1\nfor _am_header in $config_headers :; do\n  case $_am_header in\n    $_am_arg | $_am_arg:* )\n      break ;;\n    * )\n      _am_stamp_count=`expr $_am_stamp_count + 1` ;;\n  esac\ndone\necho \"timestamp for $_am_arg\" >`$as_dirname -- \"$_am_arg\" ||\n$as_expr X\"$_am_arg\" : 'X\\(.*[^/]\\)//*[^/][^/]*/*$' \\| \\\n\t X\"$_am_arg\" : 'X\\(//\\)[^/]' \\| \\\n\t X\"$_am_arg\" : 'X\\(//\\)$' \\| \\\n\t X\"$_am_arg\" : 'X\\(/\\)' \\| . 2>/dev/null ||\n$as_echo X\"$_am_arg\" |\n    sed '/^X\\(.*[^/]\\)\\/\\/*[^/][^/]*\\/*$/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  /^X\\(\\/\\/\\)[^/].*/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  /^X\\(\\/\\/\\)$/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  /^X\\(\\/\\).*/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  s/.*/./; q'`/stamp-h$_am_stamp_count\n ;;\n\n  :C)  { $as_echo \"$as_me:${as_lineno-$LINENO}: executing $ac_file commands\" >&5\n$as_echo \"$as_me: executing $ac_file commands\" >&6;}\n ;;\n  esac\n\n\n  case $ac_file$ac_mode in\n    \"depfiles\":C) test x\"$AMDEP_TRUE\" != x\"\" || {\n  # Autoconf 2.62 quotes --file arguments for eval, but not when files\n  # are listed without --file.  Let's play safe and only enable the eval\n  # if we detect the quoting.\n  case $CONFIG_FILES in\n  *\\'*) eval set x \"$CONFIG_FILES\" ;;\n  *)   set x $CONFIG_FILES ;;\n  esac\n  shift\n  for mf\n  do\n    # Strip MF so we end up with the name of the file.\n    mf=`echo \"$mf\" | sed -e 's/:.*$//'`\n    # Check whether this is an Automake generated Makefile or not.\n    # We used to match only the files named `Makefile.in', but\n    # some people rename them; so instead we look at the file content.\n    # Grep'ing the first line is not enough: some people post-process\n    # each Makefile.in and add a new line on top of each file to say so.\n    # Grep'ing the whole file is not good either: AIX grep has a line\n    # limit of 2048, but all sed's we know have understand at least 4000.\n    if sed -n 's,^#.*generated by automake.*,X,p' \"$mf\" | grep X >/dev/null 2>&1; then\n      dirpart=`$as_dirname -- \"$mf\" ||\n$as_expr X\"$mf\" : 'X\\(.*[^/]\\)//*[^/][^/]*/*$' \\| \\\n\t X\"$mf\" : 'X\\(//\\)[^/]' \\| \\\n\t X\"$mf\" : 'X\\(//\\)$' \\| \\\n\t X\"$mf\" : 'X\\(/\\)' \\| . 2>/dev/null ||\n$as_echo X\"$mf\" |\n    sed '/^X\\(.*[^/]\\)\\/\\/*[^/][^/]*\\/*$/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  /^X\\(\\/\\/\\)[^/].*/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  /^X\\(\\/\\/\\)$/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  /^X\\(\\/\\).*/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  s/.*/./; q'`\n    else\n      continue\n    fi\n    # Extract the definition of DEPDIR, am__include, and am__quote\n    # from the Makefile without running `make'.\n    DEPDIR=`sed -n 's/^DEPDIR = //p' < \"$mf\"`\n    test -z \"$DEPDIR\" && continue\n    am__include=`sed -n 's/^am__include = //p' < \"$mf\"`\n    test -z \"am__include\" && continue\n    am__quote=`sed -n 's/^am__quote = //p' < \"$mf\"`\n    # When using ansi2knr, U may be empty or an underscore; expand it\n    U=`sed -n 's/^U = //p' < \"$mf\"`\n    # Find all dependency output files, they are included files with\n    # $(DEPDIR) in their names.  We invoke sed twice because it is the\n    # simplest approach to changing $(DEPDIR) to its actual value in the\n    # expansion.\n    for file in `sed -n \"\n      s/^$am__include $am__quote\\(.*(DEPDIR).*\\)$am__quote\"'$/\\1/p' <\"$mf\" | \\\n\t sed -e 's/\\$(DEPDIR)/'\"$DEPDIR\"'/g' -e 's/\\$U/'\"$U\"'/g'`; do\n      # Make sure the directory exists.\n      test -f \"$dirpart/$file\" && continue\n      fdir=`$as_dirname -- \"$file\" ||\n$as_expr X\"$file\" : 'X\\(.*[^/]\\)//*[^/][^/]*/*$' \\| \\\n\t X\"$file\" : 'X\\(//\\)[^/]' \\| \\\n\t X\"$file\" : 'X\\(//\\)$' \\| \\\n\t X\"$file\" : 'X\\(/\\)' \\| . 2>/dev/null ||\n$as_echo X\"$file\" |\n    sed '/^X\\(.*[^/]\\)\\/\\/*[^/][^/]*\\/*$/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  /^X\\(\\/\\/\\)[^/].*/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  /^X\\(\\/\\/\\)$/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  /^X\\(\\/\\).*/{\n\t    s//\\1/\n\t    q\n\t  }\n\t  s/.*/./; q'`\n      as_dir=$dirpart/$fdir; as_fn_mkdir_p\n      # echo \"creating $dirpart/$file\"\n      echo '# dummy' > \"$dirpart/$file\"\n    done\n  done\n}\n ;;\n    \"libtool\":C)\n\n    # See if we are running on zsh, and set the options which allow our\n    # commands through without removal of \\ escapes.\n    if test -n \"${ZSH_VERSION+set}\" ; then\n      setopt NO_GLOB_SUBST\n    fi\n\n    cfgfile=\"${ofile}T\"\n    trap \"$RM \\\"$cfgfile\\\"; exit 1\" 1 2 15\n    $RM \"$cfgfile\"\n\n    cat <<_LT_EOF >> \"$cfgfile\"\n#! $SHELL\n\n# `$ECHO \"$ofile\" | sed 's%^.*/%%'` - Provide generalized library-building support services.\n# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION\n# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:\n# NOTE: Changes made to this file will be lost: look at ltmain.sh.\n#\n#   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,\n#                 2006, 2007, 2008 Free Software Foundation, Inc.\n#   Written by Gordon Matzigkeit, 1996\n#\n#   This file is part of GNU Libtool.\n#\n# GNU Libtool is free software; you can redistribute it and/or\n# modify it under the terms of the GNU General Public License as\n# published by the Free Software Foundation; either version 2 of\n# the License, or (at your option) any later version.\n#\n# As a special exception to the GNU General Public License,\n# if you distribute this file as part of a program or library that\n# is built using GNU Libtool, you may include this file under the\n# same distribution terms that you use for the rest of that program.\n#\n# GNU Libtool is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with GNU Libtool; see the file COPYING.  If not, a copy\n# can be downloaded from http://www.gnu.org/licenses/gpl.html, or\n# obtained by writing to the Free Software Foundation, Inc.,\n# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n\n\n# The names of the tagged configurations supported by this script.\navailable_tags=\"CXX \"\n\n# ### BEGIN LIBTOOL CONFIG\n\n# A sed program that does not truncate output.\nSED=$lt_SED\n\n# Sed that helps us avoid accidentally triggering echo(1) options like -n.\nXsed=\"\\$SED -e 1s/^X//\"\n\n# A grep program that handles long lines.\nGREP=$lt_GREP\n\n# An ERE matcher.\nEGREP=$lt_EGREP\n\n# A literal string matcher.\nFGREP=$lt_FGREP\n\n# Which release of libtool.m4 was used?\nmacro_version=$macro_version\nmacro_revision=$macro_revision\n\n# Assembler program.\nAS=$AS\n\n# DLL creation program.\nDLLTOOL=$DLLTOOL\n\n# Object dumper program.\nOBJDUMP=$OBJDUMP\n\n# Whether or not to build shared libraries.\nbuild_libtool_libs=$enable_shared\n\n# Whether or not to build static libraries.\nbuild_old_libs=$enable_static\n\n# What type of objects to build.\npic_mode=$pic_mode\n\n# Whether or not to optimize for fast installation.\nfast_install=$enable_fast_install\n\n# The host system.\nhost_alias=$host_alias\nhost=$host\nhost_os=$host_os\n\n# The build system.\nbuild_alias=$build_alias\nbuild=$build\nbuild_os=$build_os\n\n# A BSD- or MS-compatible name lister.\nNM=$lt_NM\n\n# Whether we need soft or hard links.\nLN_S=$lt_LN_S\n\n# What is the maximum length of a command?\nmax_cmd_len=$max_cmd_len\n\n# Object file suffix (normally \"o\").\nobjext=$ac_objext\n\n# Executable file suffix (normally \"\").\nexeext=$exeext\n\n# whether the shell understands \"unset\".\nlt_unset=$lt_unset\n\n# turn spaces into newlines.\nSP2NL=$lt_lt_SP2NL\n\n# turn newlines into spaces.\nNL2SP=$lt_lt_NL2SP\n\n# How to create reloadable object files.\nreload_flag=$lt_reload_flag\nreload_cmds=$lt_reload_cmds\n\n# Method to check whether dependent libraries are shared objects.\ndeplibs_check_method=$lt_deplibs_check_method\n\n# Command to use when deplibs_check_method == \"file_magic\".\nfile_magic_cmd=$lt_file_magic_cmd\n\n# The archiver.\nAR=$lt_AR\nAR_FLAGS=$lt_AR_FLAGS\n\n# A symbol stripping program.\nSTRIP=$lt_STRIP\n\n# Commands used to install an old-style archive.\nRANLIB=$lt_RANLIB\nold_postinstall_cmds=$lt_old_postinstall_cmds\nold_postuninstall_cmds=$lt_old_postuninstall_cmds\n\n# A C compiler.\nLTCC=$lt_CC\n\n# LTCC compiler flags.\nLTCFLAGS=$lt_CFLAGS\n\n# Take the output of nm and produce a listing of raw symbols and C names.\nglobal_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe\n\n# Transform the output of nm in a proper C declaration.\nglobal_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl\n\n# Transform the output of nm in a C name address pair.\nglobal_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address\n\n# Transform the output of nm in a C name address pair when lib prefix is needed.\nglobal_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix\n\n# The name of the directory that contains temporary libtool files.\nobjdir=$objdir\n\n# Shell to use when invoking shell scripts.\nSHELL=$lt_SHELL\n\n# An echo program that does not interpret backslashes.\nECHO=$lt_ECHO\n\n# Used to examine libraries when file_magic_cmd begins with \"file\".\nMAGIC_CMD=$MAGIC_CMD\n\n# Must we lock files when doing compilation?\nneed_locks=$lt_need_locks\n\n# Tool to manipulate archived DWARF debug symbol files on Mac OS X.\nDSYMUTIL=$lt_DSYMUTIL\n\n# Tool to change global to local symbols on Mac OS X.\nNMEDIT=$lt_NMEDIT\n\n# Tool to manipulate fat objects and archives on Mac OS X.\nLIPO=$lt_LIPO\n\n# ldd/readelf like tool for Mach-O binaries on Mac OS X.\nOTOOL=$lt_OTOOL\n\n# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.\nOTOOL64=$lt_OTOOL64\n\n# Old archive suffix (normally \"a\").\nlibext=$libext\n\n# Shared library suffix (normally \".so\").\nshrext_cmds=$lt_shrext_cmds\n\n# The commands to extract the exported symbol list from a shared archive.\nextract_expsyms_cmds=$lt_extract_expsyms_cmds\n\n# Variables whose values should be saved in libtool wrapper scripts and\n# restored at link time.\nvariables_saved_for_relink=$lt_variables_saved_for_relink\n\n# Do we need the \"lib\" prefix for modules?\nneed_lib_prefix=$need_lib_prefix\n\n# Do we need a version for libraries?\nneed_version=$need_version\n\n# Library versioning type.\nversion_type=$version_type\n\n# Shared library runtime path variable.\nrunpath_var=$runpath_var\n\n# Shared library path variable.\nshlibpath_var=$shlibpath_var\n\n# Is shlibpath searched before the hard-coded library search path?\nshlibpath_overrides_runpath=$shlibpath_overrides_runpath\n\n# Format of library name prefix.\nlibname_spec=$lt_libname_spec\n\n# List of archive names.  First name is the real one, the rest are links.\n# The last name is the one that the linker finds with -lNAME\nlibrary_names_spec=$lt_library_names_spec\n\n# The coded name of the library, if different from the real name.\nsoname_spec=$lt_soname_spec\n\n# Command to use after installation of a shared archive.\npostinstall_cmds=$lt_postinstall_cmds\n\n# Command to use after uninstallation of a shared archive.\npostuninstall_cmds=$lt_postuninstall_cmds\n\n# Commands used to finish a libtool library installation in a directory.\nfinish_cmds=$lt_finish_cmds\n\n# As \"finish_cmds\", except a single script fragment to be evaled but\n# not shown.\nfinish_eval=$lt_finish_eval\n\n# Whether we should hardcode library paths into libraries.\nhardcode_into_libs=$hardcode_into_libs\n\n# Compile-time system search path for libraries.\nsys_lib_search_path_spec=$lt_sys_lib_search_path_spec\n\n# Run-time system search path for libraries.\nsys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec\n\n# Whether dlopen is supported.\ndlopen_support=$enable_dlopen\n\n# Whether dlopen of programs is supported.\ndlopen_self=$enable_dlopen_self\n\n# Whether dlopen of statically linked programs is supported.\ndlopen_self_static=$enable_dlopen_self_static\n\n# Commands to strip libraries.\nold_striplib=$lt_old_striplib\nstriplib=$lt_striplib\n\n\n# The linker used to build libraries.\nLD=$lt_LD\n\n# Commands used to build an old-style archive.\nold_archive_cmds=$lt_old_archive_cmds\n\n# A language specific compiler.\nCC=$lt_compiler\n\n# Is the compiler the GNU compiler?\nwith_gcc=$GCC\n\n# Compiler flag to turn off builtin functions.\nno_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag\n\n# How to pass a linker flag through the compiler.\nwl=$lt_lt_prog_compiler_wl\n\n# Additional compiler flags for building library objects.\npic_flag=$lt_lt_prog_compiler_pic\n\n# Compiler flag to prevent dynamic linking.\nlink_static_flag=$lt_lt_prog_compiler_static\n\n# Does compiler simultaneously support -c and -o options?\ncompiler_c_o=$lt_lt_cv_prog_compiler_c_o\n\n# Whether or not to add -lc for building shared libraries.\nbuild_libtool_need_lc=$archive_cmds_need_lc\n\n# Whether or not to disallow shared libs when runtime libs are static.\nallow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes\n\n# Compiler flag to allow reflexive dlopens.\nexport_dynamic_flag_spec=$lt_export_dynamic_flag_spec\n\n# Compiler flag to generate shared objects directly from archives.\nwhole_archive_flag_spec=$lt_whole_archive_flag_spec\n\n# Whether the compiler copes with passing no objects directly.\ncompiler_needs_object=$lt_compiler_needs_object\n\n# Create an old-style archive from a shared archive.\nold_archive_from_new_cmds=$lt_old_archive_from_new_cmds\n\n# Create a temporary old-style archive to link instead of a shared archive.\nold_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds\n\n# Commands used to build a shared archive.\narchive_cmds=$lt_archive_cmds\narchive_expsym_cmds=$lt_archive_expsym_cmds\n\n# Commands used to build a loadable module if different from building\n# a shared archive.\nmodule_cmds=$lt_module_cmds\nmodule_expsym_cmds=$lt_module_expsym_cmds\n\n# Whether we are building with GNU ld or not.\nwith_gnu_ld=$lt_with_gnu_ld\n\n# Flag that allows shared libraries with undefined symbols to be built.\nallow_undefined_flag=$lt_allow_undefined_flag\n\n# Flag that enforces no undefined symbols.\nno_undefined_flag=$lt_no_undefined_flag\n\n# Flag to hardcode \\$libdir into a binary during linking.\n# This must work even if \\$libdir does not exist\nhardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec\n\n# If ld is used when linking, flag to hardcode \\$libdir into a binary\n# during linking.  This must work even if \\$libdir does not exist.\nhardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld\n\n# Whether we need a single \"-rpath\" flag with a separated argument.\nhardcode_libdir_separator=$lt_hardcode_libdir_separator\n\n# Set to \"yes\" if using DIR/libNAME\\${shared_ext} during linking hardcodes\n# DIR into the resulting binary.\nhardcode_direct=$hardcode_direct\n\n# Set to \"yes\" if using DIR/libNAME\\${shared_ext} during linking hardcodes\n# DIR into the resulting binary and the resulting library dependency is\n# \"absolute\",i.e impossible to change by setting \\${shlibpath_var} if the\n# library is relocated.\nhardcode_direct_absolute=$hardcode_direct_absolute\n\n# Set to \"yes\" if using the -LDIR flag during linking hardcodes DIR\n# into the resulting binary.\nhardcode_minus_L=$hardcode_minus_L\n\n# Set to \"yes\" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR\n# into the resulting binary.\nhardcode_shlibpath_var=$hardcode_shlibpath_var\n\n# Set to \"yes\" if building a shared library automatically hardcodes DIR\n# into the library and all subsequent libraries and executables linked\n# against it.\nhardcode_automatic=$hardcode_automatic\n\n# Set to yes if linker adds runtime paths of dependent libraries\n# to runtime path list.\ninherit_rpath=$inherit_rpath\n\n# Whether libtool must link a program against all its dependency libraries.\nlink_all_deplibs=$link_all_deplibs\n\n# Fix the shell variable \\$srcfile for the compiler.\nfix_srcfile_path=$lt_fix_srcfile_path\n\n# Set to \"yes\" if exported symbols are required.\nalways_export_symbols=$always_export_symbols\n\n# The commands to list exported symbols.\nexport_symbols_cmds=$lt_export_symbols_cmds\n\n# Symbols that should not be listed in the preloaded symbols.\nexclude_expsyms=$lt_exclude_expsyms\n\n# Symbols that must always be exported.\ninclude_expsyms=$lt_include_expsyms\n\n# Commands necessary for linking programs (against libraries) with templates.\nprelink_cmds=$lt_prelink_cmds\n\n# Specify filename containing input files.\nfile_list_spec=$lt_file_list_spec\n\n# How to hardcode a shared library path into an executable.\nhardcode_action=$hardcode_action\n\n# The directories searched by this compiler when creating a shared library.\ncompiler_lib_search_dirs=$lt_compiler_lib_search_dirs\n\n# Dependencies to place before and after the objects being linked to\n# create a shared library.\npredep_objects=$lt_predep_objects\npostdep_objects=$lt_postdep_objects\npredeps=$lt_predeps\npostdeps=$lt_postdeps\n\n# The library search path used internally by the compiler when linking\n# a shared library.\ncompiler_lib_search_path=$lt_compiler_lib_search_path\n\n# ### END LIBTOOL CONFIG\n\n_LT_EOF\n\n  case $host_os in\n  aix3*)\n    cat <<\\_LT_EOF >> \"$cfgfile\"\n# AIX sometimes has problems with the GCC collect2 program.  For some\n# reason, if we set the COLLECT_NAMES environment variable, the problems\n# vanish in a puff of smoke.\nif test \"X${COLLECT_NAMES+set}\" != Xset; then\n  COLLECT_NAMES=\n  export COLLECT_NAMES\nfi\n_LT_EOF\n    ;;\n  esac\n\n\nltmain=\"$ac_aux_dir/ltmain.sh\"\n\n\n  # We use sed instead of cat because bash on DJGPP gets confused if\n  # if finds mixed CR/LF and LF-only lines.  Since sed operates in\n  # text mode, it properly converts lines to CR/LF.  This bash problem\n  # is reportedly fixed, but why not run on old versions too?\n  sed '/^# Generated shell functions inserted here/q' \"$ltmain\" >> \"$cfgfile\" \\\n    || (rm -f \"$cfgfile\"; exit 1)\n\n  case $xsi_shell in\n  yes)\n    cat << \\_LT_EOF >> \"$cfgfile\"\n\n# func_dirname file append nondir_replacement\n# Compute the dirname of FILE.  If nonempty, add APPEND to the result,\n# otherwise set result to NONDIR_REPLACEMENT.\nfunc_dirname ()\n{\n  case ${1} in\n    */*) func_dirname_result=\"${1%/*}${2}\" ;;\n    *  ) func_dirname_result=\"${3}\" ;;\n  esac\n}\n\n# func_basename file\nfunc_basename ()\n{\n  func_basename_result=\"${1##*/}\"\n}\n\n# func_dirname_and_basename file append nondir_replacement\n# perform func_basename and func_dirname in a single function\n# call:\n#   dirname:  Compute the dirname of FILE.  If nonempty,\n#             add APPEND to the result, otherwise set result\n#             to NONDIR_REPLACEMENT.\n#             value returned in \"$func_dirname_result\"\n#   basename: Compute filename of FILE.\n#             value retuned in \"$func_basename_result\"\n# Implementation must be kept synchronized with func_dirname\n# and func_basename. For efficiency, we do not delegate to\n# those functions but instead duplicate the functionality here.\nfunc_dirname_and_basename ()\n{\n  case ${1} in\n    */*) func_dirname_result=\"${1%/*}${2}\" ;;\n    *  ) func_dirname_result=\"${3}\" ;;\n  esac\n  func_basename_result=\"${1##*/}\"\n}\n\n# func_stripname prefix suffix name\n# strip PREFIX and SUFFIX off of NAME.\n# PREFIX and SUFFIX must not contain globbing or regex special\n# characters, hashes, percent signs, but SUFFIX may contain a leading\n# dot (in which case that matches only a dot).\nfunc_stripname ()\n{\n  # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\n  # positional parameters, so assign one to ordinary parameter first.\n  func_stripname_result=${3}\n  func_stripname_result=${func_stripname_result#\"${1}\"}\n  func_stripname_result=${func_stripname_result%\"${2}\"}\n}\n\n# func_opt_split\nfunc_opt_split ()\n{\n  func_opt_split_opt=${1%%=*}\n  func_opt_split_arg=${1#*=}\n}\n\n# func_lo2o object\nfunc_lo2o ()\n{\n  case ${1} in\n    *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\n    *)    func_lo2o_result=${1} ;;\n  esac\n}\n\n# func_xform libobj-or-source\nfunc_xform ()\n{\n  func_xform_result=${1%.*}.lo\n}\n\n# func_arith arithmetic-term...\nfunc_arith ()\n{\n  func_arith_result=$(( $* ))\n}\n\n# func_len string\n# STRING may not start with a hyphen.\nfunc_len ()\n{\n  func_len_result=${#1}\n}\n\n_LT_EOF\n    ;;\n  *) # Bourne compatible functions.\n    cat << \\_LT_EOF >> \"$cfgfile\"\n\n# func_dirname file append nondir_replacement\n# Compute the dirname of FILE.  If nonempty, add APPEND to the result,\n# otherwise set result to NONDIR_REPLACEMENT.\nfunc_dirname ()\n{\n  # Extract subdirectory from the argument.\n  func_dirname_result=`$ECHO \"X${1}\" | $Xsed -e \"$dirname\"`\n  if test \"X$func_dirname_result\" = \"X${1}\"; then\n    func_dirname_result=\"${3}\"\n  else\n    func_dirname_result=\"$func_dirname_result${2}\"\n  fi\n}\n\n# func_basename file\nfunc_basename ()\n{\n  func_basename_result=`$ECHO \"X${1}\" | $Xsed -e \"$basename\"`\n}\n\n\n# func_stripname prefix suffix name\n# strip PREFIX and SUFFIX off of NAME.\n# PREFIX and SUFFIX must not contain globbing or regex special\n# characters, hashes, percent signs, but SUFFIX may contain a leading\n# dot (in which case that matches only a dot).\n# func_strip_suffix prefix name\nfunc_stripname ()\n{\n  case ${2} in\n    .*) func_stripname_result=`$ECHO \"X${3}\" \\\n           | $Xsed -e \"s%^${1}%%\" -e \"s%\\\\\\\\${2}\\$%%\"`;;\n    *)  func_stripname_result=`$ECHO \"X${3}\" \\\n           | $Xsed -e \"s%^${1}%%\" -e \"s%${2}\\$%%\"`;;\n  esac\n}\n\n# sed scripts:\nmy_sed_long_opt='1s/^\\(-[^=]*\\)=.*/\\1/;q'\nmy_sed_long_arg='1s/^-[^=]*=//'\n\n# func_opt_split\nfunc_opt_split ()\n{\n  func_opt_split_opt=`$ECHO \"X${1}\" | $Xsed -e \"$my_sed_long_opt\"`\n  func_opt_split_arg=`$ECHO \"X${1}\" | $Xsed -e \"$my_sed_long_arg\"`\n}\n\n# func_lo2o object\nfunc_lo2o ()\n{\n  func_lo2o_result=`$ECHO \"X${1}\" | $Xsed -e \"$lo2o\"`\n}\n\n# func_xform libobj-or-source\nfunc_xform ()\n{\n  func_xform_result=`$ECHO \"X${1}\" | $Xsed -e 's/\\.[^.]*$/.lo/'`\n}\n\n# func_arith arithmetic-term...\nfunc_arith ()\n{\n  func_arith_result=`expr \"$@\"`\n}\n\n# func_len string\n# STRING may not start with a hyphen.\nfunc_len ()\n{\n  func_len_result=`expr \"$1\" : \".*\" 2>/dev/null || echo $max_cmd_len`\n}\n\n_LT_EOF\nesac\n\ncase $lt_shell_append in\n  yes)\n    cat << \\_LT_EOF >> \"$cfgfile\"\n\n# func_append var value\n# Append VALUE to the end of shell variable VAR.\nfunc_append ()\n{\n  eval \"$1+=\\$2\"\n}\n_LT_EOF\n    ;;\n  *)\n    cat << \\_LT_EOF >> \"$cfgfile\"\n\n# func_append var value\n# Append VALUE to the end of shell variable VAR.\nfunc_append ()\n{\n  eval \"$1=\\$$1\\$2\"\n}\n\n_LT_EOF\n    ;;\n  esac\n\n\n  sed -n '/^# Generated shell functions inserted here/,$p' \"$ltmain\" >> \"$cfgfile\" \\\n    || (rm -f \"$cfgfile\"; exit 1)\n\n  mv -f \"$cfgfile\" \"$ofile\" ||\n    (rm -f \"$ofile\" && cp \"$cfgfile\" \"$ofile\" && rm -f \"$cfgfile\")\n  chmod +x \"$ofile\"\n\n\n    cat <<_LT_EOF >> \"$ofile\"\n\n# ### BEGIN LIBTOOL TAG CONFIG: CXX\n\n# The linker used to build libraries.\nLD=$lt_LD_CXX\n\n# Commands used to build an old-style archive.\nold_archive_cmds=$lt_old_archive_cmds_CXX\n\n# A language specific compiler.\nCC=$lt_compiler_CXX\n\n# Is the compiler the GNU compiler?\nwith_gcc=$GCC_CXX\n\n# Compiler flag to turn off builtin functions.\nno_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX\n\n# How to pass a linker flag through the compiler.\nwl=$lt_lt_prog_compiler_wl_CXX\n\n# Additional compiler flags for building library objects.\npic_flag=$lt_lt_prog_compiler_pic_CXX\n\n# Compiler flag to prevent dynamic linking.\nlink_static_flag=$lt_lt_prog_compiler_static_CXX\n\n# Does compiler simultaneously support -c and -o options?\ncompiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX\n\n# Whether or not to add -lc for building shared libraries.\nbuild_libtool_need_lc=$archive_cmds_need_lc_CXX\n\n# Whether or not to disallow shared libs when runtime libs are static.\nallow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX\n\n# Compiler flag to allow reflexive dlopens.\nexport_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX\n\n# Compiler flag to generate shared objects directly from archives.\nwhole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX\n\n# Whether the compiler copes with passing no objects directly.\ncompiler_needs_object=$lt_compiler_needs_object_CXX\n\n# Create an old-style archive from a shared archive.\nold_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX\n\n# Create a temporary old-style archive to link instead of a shared archive.\nold_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX\n\n# Commands used to build a shared archive.\narchive_cmds=$lt_archive_cmds_CXX\narchive_expsym_cmds=$lt_archive_expsym_cmds_CXX\n\n# Commands used to build a loadable module if different from building\n# a shared archive.\nmodule_cmds=$lt_module_cmds_CXX\nmodule_expsym_cmds=$lt_module_expsym_cmds_CXX\n\n# Whether we are building with GNU ld or not.\nwith_gnu_ld=$lt_with_gnu_ld_CXX\n\n# Flag that allows shared libraries with undefined symbols to be built.\nallow_undefined_flag=$lt_allow_undefined_flag_CXX\n\n# Flag that enforces no undefined symbols.\nno_undefined_flag=$lt_no_undefined_flag_CXX\n\n# Flag to hardcode \\$libdir into a binary during linking.\n# This must work even if \\$libdir does not exist\nhardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX\n\n# If ld is used when linking, flag to hardcode \\$libdir into a binary\n# during linking.  This must work even if \\$libdir does not exist.\nhardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_CXX\n\n# Whether we need a single \"-rpath\" flag with a separated argument.\nhardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX\n\n# Set to \"yes\" if using DIR/libNAME\\${shared_ext} during linking hardcodes\n# DIR into the resulting binary.\nhardcode_direct=$hardcode_direct_CXX\n\n# Set to \"yes\" if using DIR/libNAME\\${shared_ext} during linking hardcodes\n# DIR into the resulting binary and the resulting library dependency is\n# \"absolute\",i.e impossible to change by setting \\${shlibpath_var} if the\n# library is relocated.\nhardcode_direct_absolute=$hardcode_direct_absolute_CXX\n\n# Set to \"yes\" if using the -LDIR flag during linking hardcodes DIR\n# into the resulting binary.\nhardcode_minus_L=$hardcode_minus_L_CXX\n\n# Set to \"yes\" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR\n# into the resulting binary.\nhardcode_shlibpath_var=$hardcode_shlibpath_var_CXX\n\n# Set to \"yes\" if building a shared library automatically hardcodes DIR\n# into the library and all subsequent libraries and executables linked\n# against it.\nhardcode_automatic=$hardcode_automatic_CXX\n\n# Set to yes if linker adds runtime paths of dependent libraries\n# to runtime path list.\ninherit_rpath=$inherit_rpath_CXX\n\n# Whether libtool must link a program against all its dependency libraries.\nlink_all_deplibs=$link_all_deplibs_CXX\n\n# Fix the shell variable \\$srcfile for the compiler.\nfix_srcfile_path=$lt_fix_srcfile_path_CXX\n\n# Set to \"yes\" if exported symbols are required.\nalways_export_symbols=$always_export_symbols_CXX\n\n# The commands to list exported symbols.\nexport_symbols_cmds=$lt_export_symbols_cmds_CXX\n\n# Symbols that should not be listed in the preloaded symbols.\nexclude_expsyms=$lt_exclude_expsyms_CXX\n\n# Symbols that must always be exported.\ninclude_expsyms=$lt_include_expsyms_CXX\n\n# Commands necessary for linking programs (against libraries) with templates.\nprelink_cmds=$lt_prelink_cmds_CXX\n\n# Specify filename containing input files.\nfile_list_spec=$lt_file_list_spec_CXX\n\n# How to hardcode a shared library path into an executable.\nhardcode_action=$hardcode_action_CXX\n\n# The directories searched by this compiler when creating a shared library.\ncompiler_lib_search_dirs=$lt_compiler_lib_search_dirs_CXX\n\n# Dependencies to place before and after the objects being linked to\n# create a shared library.\npredep_objects=$lt_predep_objects_CXX\npostdep_objects=$lt_postdep_objects_CXX\npredeps=$lt_predeps_CXX\npostdeps=$lt_postdeps_CXX\n\n# The library search path used internally by the compiler when linking\n# a shared library.\ncompiler_lib_search_path=$lt_compiler_lib_search_path_CXX\n\n# ### END LIBTOOL TAG CONFIG: CXX\n_LT_EOF\n\n ;;\n\n  esac\ndone # for ac_tag\n\n\nas_fn_exit 0\n_ACEOF\nac_clean_files=$ac_clean_files_save\n\ntest $ac_write_fail = 0 ||\n  as_fn_error \"write failure creating $CONFIG_STATUS\" \"$LINENO\" 5\n\n\n# configure is writing to config.log, and then calls config.status.\n# config.status does its own redirection, appending to config.log.\n# Unfortunately, on DOS this fails, as config.log is still kept open\n# by configure, so config.status won't be able to write to it; its\n# output is simply discarded.  So we exec the FD to /dev/null,\n# effectively closing config.log, so it can be properly (re)opened and\n# appended to by config.status.  When coming back to configure, we\n# need to make the FD available again.\nif test \"$no_create\" != yes; then\n  ac_cs_success=:\n  ac_config_status_args=\n  test \"$silent\" = yes &&\n    ac_config_status_args=\"$ac_config_status_args --quiet\"\n  exec 5>/dev/null\n  $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false\n  exec 5>>config.log\n  # Use ||, not &&, to avoid exiting from the if with $? = 1, which\n  # would make configure fail if this is the last instruction.\n  $ac_cs_success || as_fn_exit $?\nfi\nif test -n \"$ac_unrecognized_opts\" && test \"$enable_option_checking\" != no; then\n  { $as_echo \"$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts\" >&5\n$as_echo \"$as_me: WARNING: unrecognized options: $ac_unrecognized_opts\" >&2;}\nfi\n\n\n\necho \"\"\necho \"Libtiff is now configured for ${host}\"\necho \"\"\necho \"  Installation directory:             ${prefix}\"\necho \"  Documentation directory:            ${LIBTIFF_DOCDIR}\"\necho \"  C compiler:                         ${CC} ${CFLAGS}\"\necho \"  C++ compiler:                       ${CXX} ${CXXFLAGS}\"\necho \"  Enable runtime linker paths:        ${HAVE_RPATH}\"\necho \"  Support Microsoft Document Imaging: ${HAVE_MDI}\"\necho \"\"\necho \" Support for internal codecs:\"\necho \"  CCITT Group 3 & 4 algorithms:       ${HAVE_CCITT}\"\necho \"  Macintosh PackBits algorithm:       ${HAVE_PACKBITS}\"\necho \"  LZW algorithm:                      ${HAVE_LZW}\"\necho \"  ThunderScan 4-bit RLE algorithm:    ${HAVE_THUNDER}\"\necho \"  NeXT 2-bit RLE algorithm:           ${HAVE_NEXT}\"\necho \"  LogLuv high dynamic range encoding: ${HAVE_LOGLUV}\"\necho \"\"\necho \" Support for external codecs:\"\necho \"  ZLIB support:                       ${HAVE_ZLIB}\"\necho \"  Pixar log-format algorithm:         ${HAVE_PIXARLOG}\"\necho \"  JPEG support:                       ${HAVE_JPEG}\"\necho \"  Old JPEG support:                   ${HAVE_OJPEG}\"\necho \"  ISO JBIG support:                   ${HAVE_JBIG}\"\necho \"\"\necho \"  C++ support:                        ${HAVE_CXX}\"\necho \"\"\necho \"  OpenGL support:                     ${HAVE_OPENGL}\"\necho \"\"\n\n"
  },
  {
    "path": "src/main/jni/tiff/configure.ac",
    "content": "dnl                                               -*- Autoconf -*-\ndnl Tag Image File Format (TIFF) Software\ndnl\ndnl Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>\ndnl\ndnl Permission to use, copy, modify, distribute, and sell this software and \ndnl its documentation for any purpose is hereby granted without fee, provided\ndnl that (i) the above copyright notices and this permission notice appear in\ndnl all copies of the software and related documentation, and (ii) the names of\ndnl Sam Leffler and Silicon Graphics may not be used in any advertising or\ndnl publicity relating to the software without the specific, prior written\ndnl permission of Sam Leffler and Silicon Graphics.\ndnl \ndnl THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \ndnl EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \ndnl WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \ndnl \ndnl IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\ndnl ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\ndnl OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\ndnl WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \ndnl LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \ndnl OF THIS SOFTWARE.\n\ndnl Process this file with autoconf to produce a configure script.\n\nAC_PREREQ(2.64)\nAC_INIT([LibTIFF Software],[3.9.2],[tiff@lists.maptools.org],[tiff])\nAC_CONFIG_AUX_DIR(config)\nAC_CONFIG_MACRO_DIR(m4)\nAC_LANG(C)\n\ndnl Compute the canonical target-system type variable\nAC_CANONICAL_TARGET\n\nAM_INIT_AUTOMAKE\ndnl Do not rebuild generated files every time\nAM_MAINTAINER_MODE\n\ndnl Versioning.\ndnl Don't fill the ALPHA_VERSION field, if not applicable.\nLIBTIFF_MAJOR_VERSION=3\nLIBTIFF_MINOR_VERSION=9\nLIBTIFF_MICRO_VERSION=2\nLIBTIFF_ALPHA_VERSION=\nLIBTIFF_VERSION=$LIBTIFF_MAJOR_VERSION.$LIBTIFF_MINOR_VERSION.$LIBTIFF_MICRO_VERSION$LIBTIFF_ALPHA_VERSION\ndnl This will be used with the 'make release' target\nLIBTIFF_RELEASE_DATE=`date +\"%Y%m%d\"`\n\n# This is a special hack for OpenBSD and MirOS systems. The dynamic linker\n# in OpenBSD uses some special semantics for shared libraries. Their soname\n# contains only two numbers, major and minor.\n# See http://bugzilla.remotesensing.org/show_bug.cgi?id=838 for details.\ncase \"$target_os\" in\n    openbsd* | mirbsd*)\n\tLIBTIFF_VERSION_INFO=$LIBTIFF_MAJOR_VERSION$LIBTIFF_MINOR_VERSION:$LIBTIFF_MICRO_VERSION:0\n\t;;\n    *)\n\tLIBTIFF_VERSION_INFO=$LIBTIFF_MAJOR_VERSION:$LIBTIFF_MINOR_VERSION:$LIBTIFF_MICRO_VERSION\n\t;;\nesac\n\nAC_SUBST(LIBTIFF_MAJOR_VERSION)\nAC_SUBST(LIBTIFF_MINOR_VERSION)\nAC_SUBST(LIBTIFF_MICRO_VERSION)\nAC_SUBST(LIBTIFF_ALPHA_VERSION)\nAC_SUBST(LIBTIFF_VERSION)\nAC_SUBST(LIBTIFF_VERSION_INFO)\nAC_SUBST(LIBTIFF_RELEASE_DATE)\n\n# Ensure that make can run correctly\nAM_SANITY_CHECK\n\ndnl Checks for programs.\nAC_PROG_CC\nAC_PROG_CC_STDC\nAC_PROG_CPP\nLT_PATH_LD\n\nAM_PROG_CC_C_O\nLT_PATH_LD\n\ndnl We want warnings. As many warnings as possible.\nVL_PROG_CC_WARNINGS()\nAC_PROG_INSTALL\nAC_PROG_MAKE_SET\nAC_PROG_LN_S\n\ndnl Tests for Windows\nAC_EXEEXT\nAC_OBJEXT\n\ndnl initialize libtool\nLT_INIT([win32-dll])\nLT_LANG([C++])\n\n# Enable support for silent build rules\nAM_SILENT_RULES\n\ndnl Checks for libraries.\nAC_CHECK_LIB([c], [main])\n\ndnl We don't need to add math library to all targets\ncase \"${host_os}\" in\n    cygwin* | mingw32* | beos* | darwin*)\n        ;;\n    *)\n\tAC_CHECK_LIB(m,sin,,,)\n        ;;\nesac\n\ndnl Checks for header files.\nAC_CHECK_HEADERS([assert.h fcntl.h io.h limits.h malloc.h search.h sys/time.h unistd.h])\n\ndnl Checks for typedefs, structures, and compiler characteristics.\nAC_C_CONST\nAC_C_INLINE\nAC_C_BIGENDIAN\nAC_TYPE_OFF_T\nAC_TYPE_SIZE_T\nAC_CHECK_SIZEOF(int)\nAC_CHECK_SIZEOF(long)\nAC_HEADER_TIME\nAC_STRUCT_TM\ndnl Some compilers (IBM VisualAge) has these types defined, so check it here:\nAC_CHECK_TYPES([int8, int16, int32],,,\n[\n#if HAVE_INTTYPES_H\n# include <inttypes.h>\n#endif\n])\n\n# Obtain size of a 'signed long' and define as SIZEOF_SIGNED_LONG\nAC_CHECK_SIZEOF(signed long)\n\n# Obtain size of a 'unsigned long' and define as SIZEOF_UNSIGNED_LONG\nAC_CHECK_SIZEOF(unsigned long)\n\n# Obtain size of a 'long long' and define as SIZEOF_SIGNED_LONG_LONG.\n# If 'long long' is not supported then the value defined is zero.\nAC_CHECK_SIZEOF(signed long long)\n\n# Obtain size of a 'unsigned long long' and define as\n# SIZEOF_UNSIGNED_LONG_LONG.  If 'unsigned long long' is not\n# supported then the value defined is zero.\nAC_CHECK_SIZEOF(unsigned long long)\n\nAC_MSG_CHECKING(for signed 64-bit type)\nINT64_T='none'\nINT64_FORMAT='none'\nif test $ac_cv_sizeof_signed_long -eq 8\nthen\n  INT64_T='signed long'\n  INT64_FORMAT='\"%ld\"'\nelif test $ac_cv_sizeof_signed_long_long -eq 8\nthen\n  INT64_FORMAT='\"%lld\"'\n  INT64_T='signed long long'\nfi\nAC_MSG_RESULT($INT64_T)\nAC_DEFINE_UNQUOTED(TIFF_INT64_T,$INT64_T,[Signed 64-bit type])\nAC_DEFINE_UNQUOTED(TIFF_INT64_FORMAT,$INT64_FORMAT,[Signed 64-bit type formatter])\n\nAC_MSG_CHECKING(for unsigned 64-bit type)\nUINT64_T='none'\nUINT64_FORMAT='none'\nif test $ac_cv_sizeof_unsigned_long -eq 8\nthen\n  UINT64_T='unsigned long'\n  UINT64_FORMAT='\"%lu\"'\nelif test $ac_cv_sizeof_unsigned_long_long -eq 8\nthen\n  UINT64_T='unsigned long long'\n  UINT64_FORMAT='\"%llu\"'\nfi\nAC_MSG_RESULT($UINT64_T)\nAC_DEFINE_UNQUOTED(TIFF_UINT64_T,$UINT64_T,[Unsigned 64-bit type])\nAC_DEFINE_UNQUOTED(TIFF_UINT64_FORMAT,$UINT64_FORMAT,[Unsigned 64-bit type formatter])\n\ndnl Checks for library functions.\nAC_CHECK_FUNCS([floor isascii memmove memset mmap pow setmode sqrt strchr strrchr strstr strtol])\n\ndnl Will use local replacements for unavailable functions\nAC_REPLACE_FUNCS(getopt)\nAC_REPLACE_FUNCS(strcasecmp)\nAC_REPLACE_FUNCS(strtoul)\nAC_REPLACE_FUNCS(lfind)\n\ndnl ---------------------------------------------------------------------------\ndnl Check the native cpu bit order.\ndnl ---------------------------------------------------------------------------\nAC_MSG_CHECKING([native cpu bit order])\ncase \"$target_cpu\" in\n    i*86*|x86_64*)\n        HOST_FILLORDER=FILLORDER_LSB2MSB\n\tAC_MSG_RESULT([lsb2msb])\n\t;;\n    *)\n\tHOST_FILLORDER=FILLORDER_MSB2LSB\n\tAC_MSG_RESULT([msb2lsb])\n        ;;\nesac\nAC_DEFINE_UNQUOTED(HOST_FILLORDER, $HOST_FILLORDER, [Set the native cpu bit order (FILLORDER_LSB2MSB or FILLORDER_MSB2LSB)])\n\ndnl ---------------------------------------------------------------------------\ndnl Configure legacy tifconf.h HOST_BIGENDIAN.\ndnl ---------------------------------------------------------------------------\nif test \"$ac_cv_c_bigendian\" = yes ; then\n    HOST_BIGENDIAN=1\nelse\n    HOST_BIGENDIAN=0\nfi\nAC_DEFINE_UNQUOTED(HOST_BIGENDIAN,$HOST_BIGENDIAN,[Native cpu byte order: 1 if big-endian (Motorola) or 0 if little-endian (Intel)])\n\ndnl ---------------------------------------------------------------------------\ndnl Make the POSIX.2 features available.\ndnl ---------------------------------------------------------------------------\n#_POSIX_C_SOURCE=2\n#AC_DEFINE_UNQUOTED(_POSIX_C_SOURCE, $_POSIX_C_SOURCE, [Define this macro to a positive integer to control which POSIX functionality is made available.])\n\ndnl ---------------------------------------------------------------------------\ndnl Set the floating point format.\ndnl FIXME: write appropriate test.\ndnl ---------------------------------------------------------------------------\nHAVE_IEEEFP=1\nAC_DEFINE_UNQUOTED(HAVE_IEEEFP, $HAVE_IEEEFP, [Define as 0 or 1 according to the floating point format suported by the machine])\n\ndnl ---------------------------------------------------------------------------\ndnl Enable run-time paths to libraries usage.\ndnl ---------------------------------------------------------------------------\n\nAC_ARG_ENABLE(rpath,\n\t      AS_HELP_STRING([--enable-rpath],\n\t\t\t     [Enable runtime linker paths (-R libtool option)]),\n\t      [HAVE_RPATH=$enableval], [HAVE_RPATH=no])\nAM_CONDITIONAL(HAVE_RPATH, test \"$HAVE_RPATH\" = \"yes\")\n\ndnl ---------------------------------------------------------------------------\ndnl Support large files.\ndnl ---------------------------------------------------------------------------\n\nAC_SYS_LARGEFILE\n\ndnl ---------------------------------------------------------------------------\ndnl Point to path where we should install documentation.\ndnl ---------------------------------------------------------------------------\n\nLIBTIFF_DOCDIR=\\${prefix}/share/doc/${PACKAGE}-${LIBTIFF_VERSION}\n\nAC_ARG_WITH(docdir,\n\t    AS_HELP_STRING([--with-docdir=DIR],\n\t\t\t   [directory where documentation should be installed]),,)\nif test \"x$with_docdir\" != \"x\" ; then\n  LIBTIFF_DOCDIR=$with_docdir\nfi\n \nAC_SUBST(LIBTIFF_DOCDIR)\n\ndnl ---------------------------------------------------------------------------\ndnl Switch on/off internal codecs.\ndnl ---------------------------------------------------------------------------\n\nAC_ARG_ENABLE(ccitt,\n\t      AS_HELP_STRING([--disable-ccitt],\n\t\t\t     [disable support for CCITT Group 3 & 4 algorithms]),\n\t      [HAVE_CCITT=$enableval], [HAVE_CCITT=yes])\n\nif test \"$HAVE_CCITT\" = \"yes\" ; then\n  AC_DEFINE(CCITT_SUPPORT,1,[Support CCITT Group 3 & 4 algorithms])\nfi\n\nAC_ARG_ENABLE(packbits,\n\t      AS_HELP_STRING([--disable-packbits],\n\t\t\t     [disable support for Macintosh PackBits algorithm]),\n\t      [HAVE_PACKBITS=$enableval], [HAVE_PACKBITS=yes])\n\nif test \"$HAVE_PACKBITS\" = \"yes\" ; then\n  AC_DEFINE(PACKBITS_SUPPORT,1,[Support Macintosh PackBits algorithm])\nfi\n\nAC_ARG_ENABLE(lzw,\n\t      AS_HELP_STRING([--disable-lzw],\n\t\t\t     [disable support for LZW algorithm]),\n\t      [HAVE_LZW=$enableval], [HAVE_LZW=yes])\n\nif test \"$HAVE_LZW\" = \"yes\" ; then\n  AC_DEFINE(LZW_SUPPORT,1,[Support LZW algorithm])\nfi\n\nAC_ARG_ENABLE(thunder,\n\t      AS_HELP_STRING([--disable-thunder],\n\t\t\t     [disable support for ThunderScan 4-bit RLE algorithm]),\n\t      [HAVE_THUNDER=$enableval], [HAVE_THUNDER=yes])\n\nif test \"$HAVE_THUNDER\" = \"yes\" ; then\n  AC_DEFINE(THUNDER_SUPPORT,1,[Support ThunderScan 4-bit RLE algorithm])\nfi\n\nHAVE_NEXT=yes\n\nAC_ARG_ENABLE(next,\n\t      AS_HELP_STRING([--disable-next],\n\t\t\t     [disable support for NeXT 2-bit RLE algorithm]),\n\t      [HAVE_NEXT=$enableval], [HAVE_NEXT=yes])\n\nif test \"$HAVE_NEXT\" = \"yes\" ; then\n  AC_DEFINE(NEXT_SUPPORT,1,[Support NeXT 2-bit RLE algorithm])\nfi\n\nAC_ARG_ENABLE(logluv,\n\t      AS_HELP_STRING([--disable-logluv],\n\t\t\t     [disable support for LogLuv high dynamic range encoding]),\n\t      [HAVE_LOGLUV=$enableval], [HAVE_LOGLUV=yes])\n\nif test \"$HAVE_LOGLUV\" = \"yes\" ; then\n  AC_DEFINE(LOGLUV_SUPPORT,1,[Support LogLuv high dynamic range encoding])\nfi\n\ndnl ---------------------------------------------------------------------------\ndnl Switch on/off support for Microsoft Document Imaging\ndnl ---------------------------------------------------------------------------\n\nAC_ARG_ENABLE(mdi,\n\t      AS_HELP_STRING([--disable-mdi],\n\t\t\t     [disable support for Microsoft Document Imaging]),\n\t      [HAVE_MDI=$enableval], [HAVE_MDI=yes])\n\nif test \"$HAVE_MDI\" = \"yes\" ; then\n  AC_DEFINE(MDI_SUPPORT,1,[Support Microsoft Document Imaging format])\nfi\n\ndnl ---------------------------------------------------------------------------\ndnl Check for ZLIB.\ndnl ---------------------------------------------------------------------------\n\nHAVE_ZLIB=no\n\nAC_ARG_ENABLE(zlib,\n\t      AS_HELP_STRING([--disable-zlib],\n\t\t\t     [disable Zlib usage (required for Deflate compression, enabled by default)]),,)\nAC_ARG_WITH(zlib-include-dir,\n\t    AS_HELP_STRING([--with-zlib-include-dir=DIR],\n\t\t\t   [location of Zlib headers]),,)\nAC_ARG_WITH(zlib-lib-dir,\n\t    AS_HELP_STRING([--with-zlib-lib-dir=DIR],\n\t\t\t   [location of Zlib library binary]),,)\n\nif test \"x$enable_zlib\" != \"xno\" ; then\n\n  if test \"x$with_zlib_lib_dir\" != \"x\" ; then\n    LDFLAGS=\"-L$with_zlib_lib_dir $LDFLAGS\"\n  fi\n  \n  AC_CHECK_LIB(z, inflateEnd, [zlib_lib=yes], [zlib_lib=no],)\n  if test \"$zlib_lib\" = \"no\" -a \"x$with_zlib_lib_dir\" != \"x\"; then\n    AC_MSG_ERROR([Zlib library not found at $with_zlib_lib_dir])\n  fi\n    \n  if test \"x$with_zlib_include_dir\" != \"x\" ; then\n    CPPFLAGS=\"-I$with_zlib_include_dir $CPPFLAGS\"\n  fi\n  AC_CHECK_HEADER(zlib.h, [zlib_h=yes], [zlib_h=no])\n  if test \"$zlib_h\" = \"no\" -a \"x$with_zlib_include_dir\" != \"x\" ; then\n    AC_MSG_ERROR([Zlib headers not found at $with_zlib_include_dir])\n  fi\n\n  if test \"$zlib_lib\" = \"yes\" -a \"$zlib_h\" = \"yes\" ; then\n    HAVE_ZLIB=yes\n  fi\n\nfi\n\nif test \"$HAVE_ZLIB\" = \"yes\" ; then\n  AC_DEFINE(ZIP_SUPPORT,1,[Support Deflate compression])\n  LIBS=\"-lz $LIBS\"\n\n  if test \"$HAVE_RPATH\" = \"yes\" -a \"x$with_zlib_lib_dir\" != \"x\" ; then\n    LIBDIR=\"-R $with_zlib_lib_dir $LIBDIR\"\n  fi\n\nfi\n\ndnl ---------------------------------------------------------------------------\ndnl Check for Pixar log-format algorithm.\ndnl ---------------------------------------------------------------------------\n\nAC_ARG_ENABLE(pixarlog,\n\t      AS_HELP_STRING([--disable-pixarlog],\n\t\t\t     [disable support for Pixar log-format algorithm (requires Zlib)]),\n\t      [HAVE_PIXARLOG=$enableval], [HAVE_PIXARLOG=yes])\n\nif test \"$HAVE_ZLIB\" = \"yes\" -a \"$HAVE_PIXARLOG\" = \"yes\" ; then\n  AC_DEFINE(PIXARLOG_SUPPORT, 1,\n\t    [Support Pixar log-format algorithm (requires Zlib)])\nelse\n  HAVE_PIXARLOG=no\nfi\n\ndnl ---------------------------------------------------------------------------\ndnl Check for JPEG.\ndnl ---------------------------------------------------------------------------\n\nHAVE_JPEG=no\n\nAC_ARG_ENABLE(jpeg,\n\t      AS_HELP_STRING([--disable-jpeg],\n\t\t\t     [disable IJG JPEG library usage (required for JPEG compression, enabled by default)]),,)\nAC_ARG_WITH(jpeg-include-dir,\n\t    AS_HELP_STRING([--with-jpeg-include-dir=DIR],\n\t\t\t   [location of IJG JPEG library headers]),,)\nAC_ARG_WITH(jpeg-lib-dir,\n\t    AS_HELP_STRING([--with-jpeg-lib-dir=DIR],\n\t\t\t   [location of IJG JPEG library binary]),,)\n\nif test \"x$enable_jpeg\" != \"xno\" ; then\n\n  if test \"x$with_jpeg_lib_dir\" != \"x\" ; then\n    LDFLAGS=\"-L$with_jpeg_lib_dir $LDFLAGS\"\n  \n  fi\n  \n  AC_CHECK_LIB(jpeg, jpeg_read_scanlines, [jpeg_lib=yes], [jpeg_lib=no],)\n  if test \"$jpeg_lib\" = \"no\" -a \"x$with_jpeg_lib_dir\" != \"x\" ; then\n    AC_MSG_ERROR([IJG JPEG library not found at $with_jpeg_lib_dir])\n  fi\n    \n  if test \"x$with_jpeg_include_dir\" != \"x\" ; then\n    CPPFLAGS=\"-I$with_jpeg_include_dir $CPPFLAGS\"\n  fi\n  AC_CHECK_HEADER(jpeglib.h, [jpeg_h=yes], [jpeg_h=no])\n  if test \"$jpeg_h\" = \"no\" -a \"x$with_jpeg_include_dir\" != \"x\" ; then\n    AC_MSG_ERROR([IJG JPEG library headers not found at $with_jpeg_include_dir])\n  fi\n\n  if test \"$jpeg_lib\" = \"yes\" -a \"$jpeg_h\" = \"yes\" ; then\n    HAVE_JPEG=yes\n  fi\n\nfi\n\nif test \"$HAVE_JPEG\" = \"yes\" ; then\n  AC_DEFINE(JPEG_SUPPORT,1,[Support JPEG compression (requires IJG JPEG library)])\n  LIBS=\"-ljpeg $LIBS\"\n\n  if test \"$HAVE_RPATH\" = \"yes\" -a \"x$with_jpeg_lib_dir\" != \"x\" ; then\n    LIBDIR=\"-R $with_jpeg_lib_dir $LIBDIR\"\n  fi\n\nfi\n\ndnl ---------------------------------------------------------------------------\ndnl Check for Old JPEG.\ndnl ---------------------------------------------------------------------------\n\nAC_ARG_ENABLE(old-jpeg,\n\t      AS_HELP_STRING([--disable-old-jpeg],\n\t\t\t     [disable support for Old JPEG compresson (read-only, enabled by default)]),\n\t      [HAVE_OJPEG=${enableval}], [HAVE_OJPEG=yes])\n\nif test \"$HAVE_JPEG\" = \"yes\" -a \"$HAVE_OJPEG\" = \"yes\" ; then\n  AC_DEFINE(OJPEG_SUPPORT, 1,\n\t    [Support Old JPEG compresson (read-only)])\nelse\n  HAVE_OJPEG=no\nfi\n\ndnl ---------------------------------------------------------------------------\ndnl Check for JBIG-KIT.\ndnl ---------------------------------------------------------------------------\n\nHAVE_JBIG=no\n\nAC_ARG_ENABLE(jbig,\n\t      AS_HELP_STRING([--disable-jbig],\n\t\t\t     [disable JBIG-KIT usage (required for ISO JBIG compression, enabled by default)]),,)\nAC_ARG_WITH(jbig-include-dir,\n\t    AS_HELP_STRING([--with-jbig-include-dir=DIR],\n\t\t\t   [location of JBIG-KIT headers]),,)\nAC_ARG_WITH(jbig-lib-dir,\n\t    AS_HELP_STRING([--with-jbig-lib-dir=DIR],\n\t\t\t   [location of JBIG-KIT library binary]),,)\n\nif test \"x$enable_jbig\" != \"xno\" ; then\n\n  if test \"x$with_jbig_lib_dir\" != \"x\" ; then\n    LDFLAGS=\"-L$with_jbig_lib_dir $LDFLAGS\"\n  \n  fi\n  \n  AC_CHECK_LIB(jbig, jbg_dec_init, [jbig_lib=yes], [jbig_lib=no],)\n  if test \"$jbig_lib\" = \"no\" -a \"x$with_jbig_lib_dir\" != \"x\" ; then\n    AC_MSG_ERROR([JBIG-KIT library not found at $with_jbig_lib_dir])\n  fi\n    \n  if test \"x$with_jbig_include_dir\" != \"x\" ; then\n    CPPFLAGS=\"-I$with_jbig_include_dir $CPPFLAGS\"\n  fi\n  AC_CHECK_HEADER(jbig.h, [jbig_h=yes], [jbig_h=no])\n  if test \"$jbig_h\" = \"no\" -a \"x$with_jbig_include_dir\" != \"x\" ; then\n    AC_MSG_ERROR([JBIG-KIT library headers not found at $with_jbig_include_dir])\n  fi\n\n  if test \"$jbig_lib\" = \"yes\" -a \"$jbig_h\" = \"yes\" ; then\n    HAVE_JBIG=yes\n  fi\n\nfi\n\nif test \"$HAVE_JBIG\" = \"yes\" ; then\n  AC_DEFINE(JBIG_SUPPORT,1,[Support ISO JBIG compression (requires JBIG-KIT library)])\n  LIBS=\"-ljbig $LIBS\"\n\n  if test \"$HAVE_RPATH\" = \"yes\" -a \"x$with_jbig_lib_dir\" != \"x\" ; then\n    LIBDIR=\"-R $with_jbig_lib_dir $LIBDIR\"\n  fi\n\n  # Older versions of jbigkit lack jbg_newlen\n  AC_CHECK_FUNCS([jbg_newlen])\n\nfi\n\ndnl ---------------------------------------------------------------------------\ndnl Check for C++.\ndnl ---------------------------------------------------------------------------\n\nAC_ARG_ENABLE(cxx,\n\t      AS_HELP_STRING([--enable-cxx],\n\t\t\t     [enable C++ stream API building (requires C++ compiler)]),\n\t      [HAVE_CXX=$enableval], [HAVE_CXX=yes])\n\nif test \"$HAVE_CXX\" = \"yes\" ; then\n  AC_DEFINE(CXX_SUPPORT, 1, [Support C++ stream API (requires C++ compiler)])\nelse\n  HAVE_CXX=no\nfi\n\nAM_CONDITIONAL(HAVE_CXX, test \"$HAVE_CXX\" = \"yes\")\n\ndnl ---------------------------------------------------------------------------\ndnl Check for OpenGL and GLUT.\ndnl ---------------------------------------------------------------------------\n\nHAVE_OPENGL=no\n\nAC_PATH_XTRA\n\nAX_CHECK_GL\nAX_CHECK_GLU\nAX_CHECK_GLUT\n\nif test \"$no_x\" != \"yes\" -a \"$no_gl\" != \"yes\" \\\n\t-a \"$no_glu\" != \"yes\" -a \"$no_glut\" != \"yes\" ; then\n  HAVE_OPENGL=yes\nfi\n\nAM_CONDITIONAL(HAVE_OPENGL, test \"$HAVE_OPENGL\" = \"yes\")\n\ndnl ---------------------------------------------------------------------------\ndnl Check for X Athena Widgets\ndnl ---------------------------------------------------------------------------\n\ndnl HAVE_XAW=no\n\ndnl ICE_FIND_ATHENA\n\ndnl if test \"$no_xaw\" != \"yes\" ; then\ndnl   HAVE_XAW=yes\ndnl fi\n\ndnl AM_CONDITIONAL(HAVE_XAW, test \"$HAVE_XAW\" = \"yes\")\n\ndnl ===========================================================================\ndnl ``Orthogonal Features''\ndnl ===========================================================================\n\ndnl ---------------------------------------------------------------------------\ndnl Default handling of strip chopping support.\ndnl ---------------------------------------------------------------------------\n\nAC_ARG_ENABLE(strip-chopping,\n\t      AS_HELP_STRING([--disable-strip-chopping],\n\t\t\t     [disable support for strip chopping (whether or not to convert single-strip uncompressed images to mutiple strips of specified size to reduce memory usage)]),\n\t      [HAVE_STRIPCHOP=$enableval], [HAVE_STRIPCHOP=yes])\nAC_ARG_WITH(default-strip-size,\n\t    AS_HELP_STRING([--with-default-strip-size=SIZE],\n\t\t\t   [default size of the strip in bytes (when strip chopping enabled) [[default=8192]]]),,)\n\nif test \"$HAVE_STRIPCHOP\" = \"yes\" \\\n\t-a \"x$with_default_strip_size\" != \"xno\"; then\n  AC_DEFINE(STRIPCHOP_DEFAULT,TIFF_STRIPCHOP,[Support strip chopping (whether or not to convert single-strip uncompressed images to mutiple strips of specified size to reduce memory usage)])\n\n  if test \"x$with_default_strip_size\" = \"x\" \\\n\t  -o \"x$with_default_strip_size\" = \"xyes\"; then\n    with_default_strip_size=\"8192\"\n  fi\n\n  AC_DEFINE_UNQUOTED(STRIP_SIZE_DEFAULT,$with_default_strip_size,[Default size of the strip in bytes (when strip chopping enabled)])\n\nfi\n\ndnl ---------------------------------------------------------------------------\ndnl Default subifd support.\ndnl ---------------------------------------------------------------------------\nAC_DEFINE(SUBIFD_SUPPORT,1,[Enable SubIFD tag (330) support])\n\ndnl ---------------------------------------------------------------------------\ndnl Default handling of ASSOCALPHA support.\ndnl ---------------------------------------------------------------------------\n\nAC_ARG_ENABLE(extrasample-as-alpha,\n\t      AS_HELP_STRING([--disable-extrasample-as-alpha],\n\t\t\t     [the RGBA interface will treat a fourth sample with no EXTRASAMPLE_ value as being ASSOCALPHA. Many packages produce RGBA files but don't mark the alpha properly]),\n\t      [HAVE_EXTRASAMPLE_AS_ALPHA=$enableval],\n\t      [HAVE_EXTRASAMPLE_AS_ALPHA=yes])\n\nif test \"$HAVE_EXTRASAMPLE_AS_ALPHA\" = \"yes\" ; then\n  AC_DEFINE(DEFAULT_EXTRASAMPLE_AS_ALPHA, 1,\n\t    [Treat extra sample as alpha (default enabled). The RGBA interface will treat a fourth sample with no EXTRASAMPLE_ value as being ASSOCALPHA. Many packages produce RGBA files but don't mark the alpha properly.])\nfi\n\ndnl ---------------------------------------------------------------------------\ndnl Default handling of YCbCr subsampling support.\ndnl See Bug 168 in Bugzilla, and JPEGFixupTestSubsampling() for details.\ndnl ---------------------------------------------------------------------------\n\nAC_ARG_ENABLE(check-ycbcr-subsampling,\n\t      AS_HELP_STRING([--disable-check-ycbcr-subsampling],\n\t\t\t     [disable picking up YCbCr subsampling info from the JPEG data stream to support files lacking the tag]),\n\t      [CHECK_JPEG_YCBCR_SUBSAMPLING=$enableval],\n\t      [CHECK_JPEG_YCBCR_SUBSAMPLING=yes])\n\nif test \"$CHECK_JPEG_YCBCR_SUBSAMPLING\" = \"yes\" ; then\n  AC_DEFINE(CHECK_JPEG_YCBCR_SUBSAMPLING, 1,\n\t    [Pick up YCbCr subsampling info from the JPEG data stream to support files lacking the tag (default enabled).])\nfi\n\ndnl ---------------------------------------------------------------------------\n\nAC_SUBST(LIBDIR)\n\nAC_CONFIG_HEADERS([libtiff/tif_config.h libtiff/tiffconf.h])\n\nAC_CONFIG_FILES([Makefile \\\n\t\t build/Makefile \\\n\t\t contrib/Makefile \\\n\t\t contrib/acorn/Makefile \\\n\t\t contrib/addtiffo/Makefile \\\n\t\t contrib/dbs/Makefile \\\n\t\t contrib/dbs/xtiff/Makefile \\\n\t\t contrib/iptcutil/Makefile \\\n\t\t contrib/mac-cw/Makefile \\\n\t\t contrib/mac-mpw/Makefile \\\n\t\t contrib/mfs/Makefile \\\n\t\t contrib/pds/Makefile \\\n\t\t contrib/ras/Makefile \\\n\t\t contrib/stream/Makefile \\\n\t\t contrib/tags/Makefile \\\n\t\t contrib/win_dib/Makefile \\\n                 html/Makefile \\\n\t\t html/images/Makefile \\\n\t\t html/man/Makefile \\\n                 libtiff/Makefile \\\n                 man/Makefile \\\n\t\t port/Makefile \\\n\t\t test/Makefile \\\n                 tools/Makefile])\nAC_OUTPUT\n\ndnl ---------------------------------------------------------------------------\ndnl Display configuration status\ndnl ---------------------------------------------------------------------------\n\nLOC_MSG()\nLOC_MSG([Libtiff is now configured for ${host}])\nLOC_MSG()\nLOC_MSG([  Installation directory:             ${prefix}])\nLOC_MSG([  Documentation directory:            ${LIBTIFF_DOCDIR}])\nLOC_MSG([  C compiler:                         ${CC} ${CFLAGS}])\nLOC_MSG([  C++ compiler:                       ${CXX} ${CXXFLAGS}])\nLOC_MSG([  Enable runtime linker paths:        ${HAVE_RPATH}])\nLOC_MSG([  Support Microsoft Document Imaging: ${HAVE_MDI}])\nLOC_MSG()\nLOC_MSG([ Support for internal codecs:])\nLOC_MSG([  CCITT Group 3 & 4 algorithms:       ${HAVE_CCITT}])\nLOC_MSG([  Macintosh PackBits algorithm:       ${HAVE_PACKBITS}])\nLOC_MSG([  LZW algorithm:                      ${HAVE_LZW}])\nLOC_MSG([  ThunderScan 4-bit RLE algorithm:    ${HAVE_THUNDER}])\nLOC_MSG([  NeXT 2-bit RLE algorithm:           ${HAVE_NEXT}])\nLOC_MSG([  LogLuv high dynamic range encoding: ${HAVE_LOGLUV}])\nLOC_MSG()\nLOC_MSG([ Support for external codecs:])\nLOC_MSG([  ZLIB support:                       ${HAVE_ZLIB}])\nLOC_MSG([  Pixar log-format algorithm:         ${HAVE_PIXARLOG}])\nLOC_MSG([  JPEG support:                       ${HAVE_JPEG}])\nLOC_MSG([  Old JPEG support:                   ${HAVE_OJPEG}])\nLOC_MSG([  ISO JBIG support:                   ${HAVE_JBIG}])\nLOC_MSG()\nLOC_MSG([  C++ support:                        ${HAVE_CXX}])\nLOC_MSG()\ndnl LOC_MSG([  X Athena Widgets support:           ${HAVE_XAW}])\nLOC_MSG([  OpenGL support:                     ${HAVE_OPENGL}])\nLOC_MSG()\n\n"
  },
  {
    "path": "src/main/jni/tiff/configure.com",
    "content": "$! $Id: configure.com,v 1.1.2.2 2009-08-20 22:31:00 bfriesen Exp $\n$!\n$! OpenVMS configure procedure for libtiff\n$! (c) Alexey Chupahin  22-NOV-2007\n$! elvis_75@mail.ru\n$!\n$! Permission to use, copy, modify, distribute, and sell this software and \n$! its documentation for any purpose is hereby granted without fee, provided\n$! that (i) the above copyright notices and this permission notice appear in\n$! all copies of the software and related documentation, and (ii) the names of\n$! Sam Leffler and Silicon Graphics may not be used in any advertising or\n$! publicity relating to the software without the specific, prior written\n$! permission of Sam Leffler and Silicon Graphics.\n$! \n$! THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n$! EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n$! WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n$! \n$! IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n$! ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n$! OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n$! WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n$! LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n$! OF THIS SOFTWARE.\n$!\n$!\n$ SET NOON\n$WRITE SYS$OUTPUT \" \"\n$WRITE SYS$OUTPUT \"Configuring libTIFF library\"\n$WRITE SYS$OUTPUT \" \"\n$! Checking architecture\n$DECC = F$SEARCH(\"SYS$SYSTEM:DECC$COMPILER.EXE\") .NES. \"\"\n$IF (.NOT. DECC) THEN $WRITE SYS$OUTPUT  \"BAD compiler\" GOTO EXIT\n$    IF F$GETSYI(\"ARCH_TYPE\").EQ.1 THEN CPU = \"VAX\"\n$    IF F$GETSYI(\"ARCH_TYPE\").EQ.2 THEN CPU = \"Alpha\"\n$    IF F$GETSYI(\"ARCH_TYPE\").EQ.3 THEN CPU = \"I64\"\n$    OS = F$GETSYI(\"VERSION\")\n$WRITE SYS$OUTPUT \"Checking architecture\t...  \", CPU\n$WRITE SYS$OUTPUT \"Checking OS          \t...  OpenVMS \",OS\n$SHARED=0\n$IF ( (CPU.EQS.\"Alpha\").OR.(CPU.EQS.\"I64\") )\n$  THEN\n$       SHARED=64\n$  ELSE\n$       SHARED=32\n$ENDIF\n$MMS = F$SEARCH(\"SYS$SYSTEM:MMS.EXE\") .NES. \"\"\n$MMK = F$TYPE(MMK) \n$IF (MMS .OR. MMK.NES.\"\") THEN GOTO TEST_LIBRARIES\n$! I cant find any make tool\n$GOTO EXIT\n$!\n$!\n$TEST_LIBRARIES:\n$!   Setting as MAKE utility one of MMS or MMK. I prefer MMS.\n$IF (MMK.NES.\"\") THEN MAKE=\"MMK\"\n$IF (MMS) THEN MAKE=\"MMS\"\n$WRITE SYS$OUTPUT \"Checking build utility\t...  ''MAKE'\"\n$WRITE SYS$OUTPUT \" \"\n$!\n$!\n$IF (P1.EQS.\"STATIC\").OR.(P1.EQS.\"static\") THEN SHARED=0\n$!\n$!\n$!\"Checking for strcasecmp \"\n$ DEFINE SYS$ERROR _NLA0:\n$ DEFINE SYS$OUTPUT _NLA0:\n$ CC/OBJECT=TEST.OBJ/INCLUDE=(ZLIB) SYS$INPUT\n\t#include  <strings.h>\n\t#include  <stdlib.h>\n\n    int main()\n\t{\n        if (strcasecmp(\"bla\", \"Bla\")==0) exit(0);\n\t   else exit(2);\n\t}\n$!\n$TMP = $STATUS\n$DEASS SYS$ERROR\n$DEAS  SYS$OUTPUT\n$IF (TMP .NE. %X10B90001)\n$  THEN\n$       HAVE_STRCASECMP=0\n$       GOTO NEXT1\n$ENDIF\n$DEFINE SYS$ERROR _NLA0:\n$DEFINE SYS$OUTPUT _NLA0:\n$LINK/EXE=TEST TEST\n$TMP = $STATUS\n$DEAS  SYS$ERROR\n$DEAS  SYS$OUTPUT\n$!WRITE SYS$OUTPUT TMP\n$IF (TMP .NE. %X10000001)\n$  THEN\n$       HAVE_STRCASECMP=0\n$       GOTO NEXT1\n$ENDIF\n$!\n$DEFINE SYS$ERROR _NLA0:\n$DEFINE SYS$OUTPUT _NLA0:\n$RUN TEST\n$IF ($STATUS .NE. %X00000001)\n$  THEN\n$\tHAVE_STRCASECMP=0\n$  ELSE\n$\t HAVE_STRCASECMP=1\n$ENDIF\n$DEAS  SYS$ERROR\n$DEAS  SYS$OUTPUT\n$NEXT1:\n$IF (HAVE_STRCASECMP.EQ.1)\n$  THEN\n$ \tWRITE SYS$OUTPUT \"Checking for strcasecmp ...   Yes\"\t\n$  ELSE\n$\tWRITE SYS$OUTPUT \"Checking for strcasecmp ...   No\"\n$ENDIF\n$!\n$!\n\n$!\"Checking for lfind \"\n$ DEFINE SYS$ERROR _NLA0:\n$ DEFINE SYS$OUTPUT _NLA0:\n$ CC/OBJECT=TEST.OBJ/INCLUDE=(ZLIB) SYS$INPUT\n        #include  <search.h>\n\n    int main()\n        {\n        lfind((const void *)key, (const void *)NULL, (size_t *)NULL,\n           (size_t) 0, NULL);\n        }\n$!\n$TMP = $STATUS\n$DEASS SYS$ERROR\n$DEAS  SYS$OUTPUT\n$IF (TMP .NE. %X10B90001)\n$  THEN\n$       HAVE_LFIND=0\n$       GOTO NEXT2\n$ENDIF\n$DEFINE SYS$ERROR _NLA0:\n$DEFINE SYS$OUTPUT _NLA0:\n$LINK/EXE=TEST TEST\n$TMP = $STATUS\n$DEAS  SYS$ERROR\n$DEAS  SYS$OUTPUT\n$!WRITE SYS$OUTPUT TMP\n$IF (TMP .NE. %X10000001)\n$  THEN\n$       HAVE_LFIND=0\n$       GOTO NEXT2\n$  ELSE\n$        HAVE_LFIND=1\n$ENDIF\n$!\n$NEXT2:\n$IF (HAVE_LFIND.EQ.1)\n$  THEN\n$       WRITE SYS$OUTPUT \"Checking for lfind ...   Yes\"\n$  ELSE\n$       WRITE SYS$OUTPUT \"Checking for lfind ...   No\"\n$ENDIF\n$!\n$!\n$!\"Checking for correct zlib library    \"\n$ DEFINE SYS$ERROR _NLA0:\n$ DEFINE SYS$OUTPUT _NLA0:\n$ CC/OBJECT=TEST.OBJ/INCLUDE=(ZLIB) SYS$INPUT\n      #include <stdlib.h>\n      #include <stdio.h>\n      #include <zlib.h>\n   int main()\n     {\n        printf(\"checking version zlib:  %s\\n\",zlibVersion());\n     }\n$TMP = $STATUS\n$DEASS SYS$ERROR\n$DEAS  SYS$OUTPUT\n$!WRITE SYS$OUTPUT TMP\n$IF (TMP .NE. %X10B90001)\n$  THEN\n$       HAVE_ZLIB=0\n$       GOTO EXIT\n$ENDIF\n$DEFINE SYS$ERROR _NLA0:\n$DEFINE SYS$OUTPUT _NLA0:\n$LINK/EXE=TEST TEST,ZLIB:LIBZ/LIB\n$TMP = $STATUS\n$DEAS  SYS$ERROR\n$DEAS  SYS$OUTPUT\n$!WRITE SYS$OUTPUT TMP\n$IF (TMP .NE. %X10000001)\n$  THEN\n$       HAVE_ZLIB=0\n$       GOTO EXIT\n$  ELSE\n$       HAVE_ZLIB=1\n$ENDIF\n$IF (HAVE_ZLIB.EQ.1)\n$  THEN\n$       WRITE SYS$OUTPUT \"Checking for correct zlib library ...   Yes\"\n$  ELSE\n$       WRITE SYS$OUTPUT \"Checking for correct zlib library ...   No\"\n$       WRITE SYS$OUTPUT \"This is fatal. Please download and install good library from fafner.dyndns.org/~alexey/libsdl/public.html\"\n$ENDIF\n$RUN TEST\n$!\n\n$DEL TEST.OBJ;*\n$! Checking for JPEG ...\n$ DEFINE SYS$ERROR _NLA0:\n$ DEFINE SYS$OUTPUT _NLA0:\n$ CC/OBJECT=TEST.OBJ/INCLUDE=(JPEG) SYS$INPUT\n      #include <stdlib.h>\n      #include <stdio.h>\n      #include <jpeglib.h>\n      #include <jversion.h>\n   int main()\n     {\n        printf(\"checking version jpeg:  %s\\n\",JVERSION);\n        jpeg_quality_scaling(0);\n        return 0;\n     }\n$TMP = $STATUS\n$DEASS SYS$ERROR\n$DEAS  SYS$OUTPUT\n$!WRITE SYS$OUTPUT TMP\n$IF (TMP .NE. %X10B90001)\n$  THEN\n$       WRITE SYS$OUTPUT \"Checking for static jpeg library ...   No\"\n$       HAVE_JPEG=0\n$ENDIF\n$DEFINE SYS$ERROR _NLA0:\n$DEFINE SYS$OUTPUT _NLA0:\n$LINK/EXE=TEST TEST,JPEG:LIBJPEG/LIB\n$TMP = $STATUS\n$DEAS  SYS$ERROR\n$DEAS  SYS$OUTPUT\n$!WRITE SYS$OUTPUT TMP\n$IF (TMP .NE. %X10000001)\n$  THEN\n$       HAVE_JPEG=0\n$  ELSE\n$       HAVE_JPEG=1\n$ENDIF\n$IF (HAVE_JPEG.EQ.1)\n$  THEN\n$       WRITE SYS$OUTPUT \"Checking for static jpeg library ...   Yes\"\n$       JPEG_LIBRARY_PATH=\"JPEG:LIBJPEG/LIB\"\n$       RUN TEST\n$  ELSE\n$       WRITE SYS$OUTPUT \"Checking for static jpeg library ...   No\"\n$ENDIF\n$!\n$!\"Checking for SHARED JPEG library    \"\n$OPEN/WRITE OUT TEST.OPT\n$WRITE OUT \"SYS$SHARE:LIBJPEG$SHR/SHARE\"\n$WRITE OUT \"ZLIB:LIBZ/LIB\"\n$CLOSE OUT\n$DEFINE SYS$ERROR _NLA0:\n$DEFINE SYS$OUTPUT _NLA0:\n$LINK/EXE=TEST TEST,TEST/OPT\n$TMP = $STATUS\n$DEAS  SYS$ERROR\n$DEAS  SYS$OUTPUT\n$!WRITE SYS$OUTPUT TMP\n$IF (TMP .NE. %X10000001)\n$  THEN\n$       HAVE_JPEG_SHARED=0\n$  ELSE\n$       HAVE_JPEG_SHARED=1\n$ENDIF\n$IF (HAVE_JPEG_SHARED.EQ.1)\n$  THEN\n$       WRITE SYS$OUTPUT \"Checking for shared jpeg library ...   Yes\"\n$       JPEG_LIBRARY_PATH=\"SYS$SHARE:LIBJPEG$SHR/SHARE\"\n$  ELSE\n$       WRITE SYS$OUTPUT \"Checking for shared jpeg library ...   No\"\n$ENDIF\n$!\n$ IF ( (HAVE_JPEG_SHARED.EQ.0).AND.(HAVE_JPEG.EQ.0) )\n$    THEN\n$       WRITE SYS$OUTPUT \"No JPEG library installed. This is fatal. Please download and install good library from fafner.dyndns.org/~alexey/libsdl/public.html\"\n$       GOTO EXIT\n$ ENDIF\n$!\n$!\n$!\n$! Checking for X11 ...\n$IF F$TRNLNM(\"DECW$INCLUDE\") .NES. \"\"\n$  THEN\n$\tWRITE SYS$OUTPUT \"Checking for X11 ...   Yes\"\n$  ELSE\n$\tWRITE SYS$OUTPUT \"Checking for X11 ...   No\"\n$\tWRITE SYS$OUTPUT \"This is fatal. Please install X11 software\"\n$\tGOTO EXIT\n$ENDIF\n$!\n$!WRITING BUILD FILES\n$OPEN/WRITE OUT BUILD.COM\n$ WRITE OUT \"$set def [.port]\"\n$ WRITE OUT \"$\",MAKE\n$ WRITE OUT \"$set def [-.libtiff]\"\n$ WRITE OUT \"$\",MAKE\n$ WRITE OUT \"$set def [-.tools]\"\n$ WRITE OUT \"$\",MAKE\n$ WRITE OUT \"$set def [-]\"\n$ WRITE OUT \"$cop [.PORT]LIBPORT.OLB [.LIBTIFF]LIBPORT.OLB\"\n$ WRITE OUT \"$ CURRENT = F$ENVIRONMENT (\"\"DEFAULT\"\") \"\n$ WRITE OUT \"$TIFF=CURRENT\"\n$ WRITE OUT \"$OPEN/WRITE OUTT LIBTIFF$STARTUP.COM\"\n$ WRITE OUT \"$TIFF[F$LOCATE(\"\"]\"\",TIFF),9]:=\"\".LIBTIFF]\"\"\"\n$ WRITE OUT \"$WRITE OUTT \"\"DEFINE TIFF \",\"'\",\"'\",\"TIFF'\"\" \"\n$ WRITE OUT \"$TIFF=CURRENT\"\n$ WRITE OUT \"$TIFF[F$LOCATE(\"\"]\"\",TIFF),7]:=\"\".TOOLS]\"\"\"\n$ WRITE OUT \"$WRITE OUTT \"\"BMP2TIFF:==$\", \"'\",\"'\",\"TIFF'BMP2TIFF\"\"\"\n$ WRITE OUT \"$WRITE OUTT \"\"FAX2PS:==$\", \"'\",\"'\",\"TIFF'FAX2PS\"\"\"\n$ WRITE OUT \"$WRITE OUTT \"\"FAX2TIFF:==$\", \"'\",\"'\",\"TIFF'FAX2TIFF\"\"\"\n$ WRITE OUT \"$WRITE OUTT \"\"GIF2TIFF:==$\", \"'\",\"'\",\"TIFF'GIF2TIFF\"\"\"\n$ WRITE OUT \"$WRITE OUTT \"\"PAL2RGB:==$\", \"'\",\"'\",\"TIFF'PAL2RGB\"\"\"\n$ WRITE OUT \"$WRITE OUTT \"\"PPM2TIFF:==$\", \"'\",\"'\",\"TIFF'PPM2TIFF\"\"\"\n$ WRITE OUT \"$WRITE OUTT \"\"RAS2TIFF:==$\", \"'\",\"'\",\"TIFF'RAS2TIFF\"\"\"\n$ WRITE OUT \"$WRITE OUTT \"\"RAW2TIFF:==$\", \"'\",\"'\",\"TIFF'RAW2TIFF\"\"\"\n$ WRITE OUT \"$WRITE OUTT \"\"RGB2YCBCR:==$\", \"'\",\"'\",\"TIFF'RGB2YCBCR\"\"\"\n$ WRITE OUT \"$WRITE OUTT \"\"THUMBNAIL:==$\", \"'\",\"'\",\"TIFF'THUMBNAIL\"\"\"\n$ WRITE OUT \"$WRITE OUTT \"\"TIFF2BW:==$\", \"'\",\"'\",\"TIFF'TIFF2BW\"\"\"\n$ WRITE OUT \"$WRITE OUTT \"\"TIFF2PDF:==$\", \"'\",\"'\",\"TIFF'TIFF2PDF\"\"\"\n$ WRITE OUT \"$WRITE OUTT \"\"TIFF2PS:==$\", \"'\",\"'\",\"TIFF'TIFF2PS\"\"\"\n$ WRITE OUT \"$WRITE OUTT \"\"TIFF2RGBA:==$\", \"'\",\"'\",\"TIFF'TIFF2RGBA\"\"\"\n$ WRITE OUT \"$WRITE OUTT \"\"TIFFCMP:==$\", \"'\",\"'\",\"TIFF'TIFFCMP\"\"\"\n$ WRITE OUT \"$WRITE OUTT \"\"TIFFCP:==$\", \"'\",\"'\",\"TIFF'TIFFCP\"\"\"\n$ WRITE OUT \"$WRITE OUTT \"\"TIFFDITHER:==$\", \"'\",\"'\",\"TIFF'TIFFDITHER\"\"\"\n$ WRITE OUT \"$WRITE OUTT \"\"TIFFDUMP:==$\", \"'\",\"'\",\"TIFF'TIFFDUMP\"\"\"\n$ WRITE OUT \"$WRITE OUTT \"\"TIFFINFO:==$\", \"'\",\"'\",\"TIFF'TIFFINFO\"\"\"\n$ WRITE OUT \"$WRITE OUTT \"\"TIFFMEDIAN:==$\", \"'\",\"'\",\"TIFF'TIFFMEDIAN\"\"\"\n$ WRITE OUT \"$WRITE OUTT \"\"TIFFCROP:==$\", \"'\",\"'\",\"TIFF'TIFFCROP\"\"\"\n$ WRITE OUT \"$WRITE OUTT \"\"TIFFSET:==$\", \"'\",\"'\",\"TIFF'TIFFSET\"\"\"\n$ WRITE OUT \"$CLOSE OUTT\"\n$ WRITE OUT \"$OPEN/WRITE OUTT [.LIBTIFF]LIBTIFF.OPT\"\n$ WRITE OUT \"$WRITE OUTT \"\"TIFF:TIFF/LIB\"\"\n$ WRITE OUT \"$WRITE OUTT \"\"TIFF:LIBPORT/LIB\"\"\n$ WRITE OUT \"$WRITE OUTT \"\"JPEG:LIBJPEG/LIB\"\"\n$ WRITE OUT \"$WRITE OUTT \"\"ZLIB:LIBZ/LIB\"\"\n$ WRITE OUT \"$CLOSE OUTT\"\n$!\n$ WRITE OUT \"$WRITE SYS$OUTPUT \"\" \"\" \"\n$ WRITE OUT \"$WRITE SYS$OUTPUT \"\"***************************************************************************** \"\" \"\n$ WRITE OUT \"$WRITE SYS$OUTPUT \"\"LIBTIFF$STARTUP.COM has been created. \"\" \"\n$ WRITE OUT \"$WRITE SYS$OUTPUT \"\"This file setups all logicals needed. It should be execute before using LibTIFF \"\" \"\n$ WRITE OUT \"$WRITE SYS$OUTPUT \"\"Nice place to call it - LOGIN.COM \"\" \"\n$ WRITE OUT \"$WRITE SYS$OUTPUT \"\"\"\" \"\n$ WRITE OUT \"$WRITE SYS$OUTPUT \"\"Using the library:\"\" \"\n$ WRITE OUT \"$WRITE SYS$OUTPUT \"\"CC/INC=TIFF ASCII_TAG.C\"\" \"\n$ WRITE OUT \"$WRITE SYS$OUTPUT \"\"LINK ASCII_TAG,TIFF:LIBTIFF/OPT\"\" \"\n$ WRITE OUT \"$WRITE SYS$OUTPUT \"\"***************************************************************************** \"\" \"\n$CLOSE OUT\n$!\n$! DESCRIP.MMS in [.PORT]\n$OBJ=\"dummy.obj\"\n$IF HAVE_STRCASECMP.NE.1 \n$  THEN \n$     OBJ=OBJ+\",strcasecmp.obj\"\n$ENDIF\n$IF HAVE_LFIND.NE.1   \n$   THEN \n$       OBJ=OBJ+\",lfind.obj\"\n$ENDIF\n$OPEN/WRITE OUT [.PORT]DESCRIP.MMS\n$WRITE OUT \"OBJ=\",OBJ\n$WRITE OUT \"\"\n$WRITE OUT \"LIBPORT.OLB : $(OBJ)\"\n$WRITE OUT \"\tLIB/CREA LIBPORT $(OBJ)\"\n$WRITE OUT \"\"\n$WRITE OUT \"\"\n$WRITE OUT \"dummy.obj : dummy.c\"\n$WRITE OUT \"         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\"\n$WRITE OUT \"\"\n$WRITE OUT \"\"\n$WRITE OUT \"strcasecmp.obj : strcasecmp.c\"\n$WRITE OUT \"         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\"\n$WRITE OUT \"\"\n$WRITE OUT \"\"\n$WRITE OUT \"lfind.obj : lfind.c\"\n$WRITE OUT \"         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\"\n$WRITE OUT \"\"\n$WRITE OUT \"\"\n$CLOSE OUT\n$!\n$!\n$WRITE SYS$OUTPUT \"Creating LIBTIFF$DEF.OPT\"\n$IF (SHARED.EQ.64)\n$ THEN\n$       COPY SYS$INPUT TIFF$DEF.OPT\nSYMBOL_VECTOR= (-\nTIFFOpen=PROCEDURE,-\nTIFFGetVersion=PROCEDURE,-\nTIFFCleanup=PROCEDURE,-\nTIFFClose=PROCEDURE,-\nTIFFFlush=PROCEDURE,-\nTIFFFlushData=PROCEDURE,-\nTIFFGetField=PROCEDURE,-\nTIFFVGetField=PROCEDURE,-\nTIFFGetFieldDefaulted=PROCEDURE,-\nTIFFVGetFieldDefaulted=PROCEDURE,-\nTIFFGetTagListEntry=PROCEDURE,-\nTIFFGetTagListCount=PROCEDURE,-\nTIFFReadDirectory=PROCEDURE,-\nTIFFScanlineSize=PROCEDURE,-\nTIFFStripSize=PROCEDURE,-\nTIFFVStripSize=PROCEDURE,-\nTIFFRawStripSize=PROCEDURE,-\nTIFFTileRowSize=PROCEDURE,-\nTIFFTileSize=PROCEDURE,-\nTIFFVTileSize=PROCEDURE,-\nTIFFFileno=PROCEDURE,-\nTIFFSetFileno=PROCEDURE,-\nTIFFGetMode=PROCEDURE,-\nTIFFIsTiled=PROCEDURE,-\nTIFFIsByteSwapped=PROCEDURE,-\nTIFFIsBigEndian=PROCEDURE,-\nTIFFIsMSB2LSB=PROCEDURE,-\nTIFFIsUpSampled=PROCEDURE,-\nTIFFCIELabToRGBInit=PROCEDURE,-\nTIFFCIELabToXYZ=PROCEDURE,-\nTIFFXYZToRGB=PROCEDURE,-\nTIFFYCbCrToRGBInit=PROCEDURE,-\nTIFFYCbCrtoRGB=PROCEDURE,-\nTIFFCurrentRow=PROCEDURE,-\nTIFFCurrentDirectory=PROCEDURE,-\nTIFFCurrentStrip=PROCEDURE,-\nTIFFCurrentTile=PROCEDURE,-\nTIFFDataWidth=PROCEDURE,-\nTIFFReadBufferSetup=PROCEDURE,-\nTIFFWriteBufferSetup=PROCEDURE,-\nTIFFSetupStrips=PROCEDURE,-\nTIFFLastDirectory=PROCEDURE,-\nTIFFSetDirectory=PROCEDURE,-\nTIFFSetSubDirectory=PROCEDURE,-\nTIFFUnlinkDirectory=PROCEDURE,-\nTIFFSetField=PROCEDURE,-\nTIFFVSetField=PROCEDURE,-\nTIFFCheckpointDirectory=PROCEDURE,-\nTIFFWriteDirectory=PROCEDURE,-\nTIFFRewriteDirectory=PROCEDURE,-\nTIFFPrintDirectory=PROCEDURE,-\nTIFFReadScanline=PROCEDURE,-\nTIFFWriteScanline=PROCEDURE,-\nTIFFReadRGBAImage=PROCEDURE,-\nTIFFReadRGBAImageOriented=PROCEDURE,-\nTIFFFdOpen=PROCEDURE,-\nTIFFClientOpen=PROCEDURE,-\nTIFFFileName=PROCEDURE,-\nTIFFError=PROCEDURE,-\nTIFFErrorExt=PROCEDURE,-\nTIFFWarning=PROCEDURE,-\nTIFFWarningExt=PROCEDURE,-\nTIFFSetErrorHandler=PROCEDURE,-\nTIFFSetErrorHandlerExt=PROCEDURE,-\nTIFFSetWarningHandler=PROCEDURE,-\nTIFFSetWarningHandlerExt=PROCEDURE,-\nTIFFComputeTile=PROCEDURE,-\nTIFFCheckTile=PROCEDURE,-\nTIFFNumberOfTiles=PROCEDURE,-\nTIFFReadTile=PROCEDURE,-\nTIFFWriteTile=PROCEDURE,-\nTIFFComputeStrip=PROCEDURE,-\nTIFFNumberOfStrips=PROCEDURE,-\nTIFFRGBAImageBegin=PROCEDURE,-\nTIFFRGBAImageGet=PROCEDURE,-\nTIFFRGBAImageEnd=PROCEDURE,-\nTIFFReadEncodedStrip=PROCEDURE,-\nTIFFReadRawStrip=PROCEDURE,-\nTIFFReadEncodedTile=PROCEDURE,-\nTIFFReadRawTile=PROCEDURE,-\nTIFFReadRGBATile=PROCEDURE,-\nTIFFReadRGBAStrip=PROCEDURE,-\nTIFFWriteEncodedStrip=PROCEDURE,-\nTIFFWriteRawStrip=PROCEDURE,-\nTIFFWriteEncodedTile=PROCEDURE,-\nTIFFWriteRawTile=PROCEDURE,-\nTIFFSetWriteOffset=PROCEDURE,-\nTIFFSwabDouble=PROCEDURE,-\nTIFFSwabShort=PROCEDURE,-\nTIFFSwabLong=PROCEDURE,-\nTIFFSwabArrayOfShort=PROCEDURE,-\nTIFFSwabArrayOfLong=PROCEDURE,-\nTIFFSwabArrayOfDouble=PROCEDURE,-\nTIFFSwabArrayOfTriples=PROCEDURE,-\nTIFFReverseBits=PROCEDURE,-\nTIFFGetBitRevTable=PROCEDURE,-\nTIFFDefaultStripSize=PROCEDURE,-\nTIFFDefaultTileSize=PROCEDURE,-\nTIFFRasterScanlineSize=PROCEDURE,-\n_TIFFmalloc=PROCEDURE,-\n_TIFFrealloc=PROCEDURE,-\n_TIFFfree=PROCEDURE,-\n_TIFFmemset=PROCEDURE,-\n_TIFFmemcpy=PROCEDURE,-\n_TIFFmemcmp=PROCEDURE,-\nTIFFCreateDirectory=PROCEDURE,-\nTIFFSetTagExtender=PROCEDURE,-\nTIFFMergeFieldInfo=PROCEDURE,-\nTIFFFindFieldInfo=PROCEDURE,-\nTIFFFindFieldInfoByName=PROCEDURE,-\nTIFFFieldWithName=PROCEDURE,-\nTIFFFieldWithTag=PROCEDURE,-\nTIFFCurrentDirOffset=PROCEDURE,-\nTIFFWriteCheck=PROCEDURE,-\nTIFFRGBAImageOK=PROCEDURE,-\nTIFFNumberOfDirectories=PROCEDURE,-\nTIFFSetFileName=PROCEDURE,-\nTIFFSetClientdata=PROCEDURE,-\nTIFFSetMode=PROCEDURE,-\nTIFFClientdata=PROCEDURE,-\nTIFFGetReadProc=PROCEDURE,-\nTIFFGetWriteProc=PROCEDURE,-\nTIFFGetSeekProc=PROCEDURE,-\nTIFFGetCloseProc=PROCEDURE,-\nTIFFGetSizeProc=PROCEDURE,-\nTIFFGetMapFileProc=PROCEDURE,-\nTIFFGetUnmapFileProc=PROCEDURE,-\nTIFFIsCODECConfigured=PROCEDURE,-\nTIFFGetConfiguredCODECs=PROCEDURE,-\nTIFFFindCODEC=PROCEDURE,-\nTIFFRegisterCODEC=PROCEDURE,-\nTIFFUnRegisterCODEC=PROCEDURE,-\nTIFFFreeDirectory=PROCEDURE,-\nTIFFReadCustomDirectory=PROCEDURE,-\nTIFFReadEXIFDirectory=PROCEDURE,-\nTIFFAccessTagMethods=PROCEDURE,-\nTIFFGetClientInfo=PROCEDURE,-\nTIFFSetClientInfo=PROCEDURE,-\nTIFFReassignTagToIgnore=PROCEDURE-\n)\n\n$ENDIF\n$IF (SHARED.EQ.32)\n$ THEN\n$       COPY SYS$INPUT TIFF$DEF.OPT\nUNIVERSAL=TIFFOpen\nUNIVERSAL=TIFFGetVersion\nUNIVERSAL=TIFFCleanup\nUNIVERSAL=TIFFClose\nUNIVERSAL=TIFFFlush\nUNIVERSAL=TIFFFlushData\nUNIVERSAL=TIFFGetField\nUNIVERSAL=TIFFVGetField\nUNIVERSAL=TIFFGetFieldDefaulted\nUNIVERSAL=TIFFVGetFieldDefaulted\nUNIVERSAL=TIFFGetTagListEntry\nUNIVERSAL=TIFFGetTagListCount\nUNIVERSAL=TIFFReadDirectory\nUNIVERSAL=TIFFScanlineSize\nUNIVERSAL=TIFFStripSize\nUNIVERSAL=TIFFVStripSize\nUNIVERSAL=TIFFRawStripSize\nUNIVERSAL=TIFFTileRowSize\nUNIVERSAL=TIFFTileSize\nUNIVERSAL=TIFFVTileSize\nUNIVERSAL=TIFFFileno\nUNIVERSAL=TIFFSetFileno\nUNIVERSAL=TIFFGetMode\nUNIVERSAL=TIFFIsTiled\nUNIVERSAL=TIFFIsByteSwapped\nUNIVERSAL=TIFFIsBigEndian\nUNIVERSAL=TIFFIsMSB2LSB\nUNIVERSAL=TIFFIsUpSampled\nUNIVERSAL=TIFFCIELabToRGBInit\nUNIVERSAL=TIFFCIELabToXYZ\nUNIVERSAL=TIFFXYZToRGB\nUNIVERSAL=TIFFYCbCrToRGBInit\nUNIVERSAL=TIFFYCbCrtoRGB\nUNIVERSAL=TIFFCurrentRow\nUNIVERSAL=TIFFCurrentDirectory\nUNIVERSAL=TIFFCurrentStrip\nUNIVERSAL=TIFFCurrentTile\nUNIVERSAL=TIFFDataWidth\nUNIVERSAL=TIFFReadBufferSetup\nUNIVERSAL=TIFFWriteBufferSetup\nUNIVERSAL=TIFFSetupStrips\nUNIVERSAL=TIFFLastDirectory\nUNIVERSAL=TIFFSetDirectory\nUNIVERSAL=TIFFSetSubDirectory\nUNIVERSAL=TIFFUnlinkDirectory\nUNIVERSAL=TIFFSetField\nUNIVERSAL=TIFFVSetField\nUNIVERSAL=TIFFCheckpointDirectory\nUNIVERSAL=TIFFWriteDirectory\nUNIVERSAL=TIFFRewriteDirectory\nUNIVERSAL=TIFFPrintDirectory\nUNIVERSAL=TIFFReadScanline\nUNIVERSAL=TIFFWriteScanline\nUNIVERSAL=TIFFReadRGBAImage\nUNIVERSAL=TIFFReadRGBAImageOriented\nUNIVERSAL=TIFFFdOpen\nUNIVERSAL=TIFFClientOpen\nUNIVERSAL=TIFFFileName\nUNIVERSAL=TIFFError\nUNIVERSAL=TIFFErrorExt\nUNIVERSAL=TIFFWarning\nUNIVERSAL=TIFFWarningExt\nUNIVERSAL=TIFFSetErrorHandler\nUNIVERSAL=TIFFSetErrorHandlerExt\nUNIVERSAL=TIFFSetWarningHandler\nUNIVERSAL=TIFFSetWarningHandlerExt\nUNIVERSAL=TIFFComputeTile\nUNIVERSAL=TIFFCheckTile\nUNIVERSAL=TIFFNumberOfTiles\nUNIVERSAL=TIFFReadTile\nUNIVERSAL=TIFFWriteTile\nUNIVERSAL=TIFFComputeStrip\nUNIVERSAL=TIFFNumberOfStrips\nUNIVERSAL=TIFFRGBAImageBegin\nUNIVERSAL=TIFFRGBAImageGet\nUNIVERSAL=TIFFRGBAImageEnd\nUNIVERSAL=TIFFReadEncodedStrip\nUNIVERSAL=TIFFReadRawStrip\nUNIVERSAL=TIFFReadEncodedTile\nUNIVERSAL=TIFFReadRawTile\nUNIVERSAL=TIFFReadRGBATile\nUNIVERSAL=TIFFReadRGBAStrip\nUNIVERSAL=TIFFWriteEncodedStrip\nUNIVERSAL=TIFFWriteRawStrip\nUNIVERSAL=TIFFWriteEncodedTile\nUNIVERSAL=TIFFWriteRawTile\nUNIVERSAL=TIFFSetWriteOffset\nUNIVERSAL=TIFFSwabDouble\nUNIVERSAL=TIFFSwabShort\nUNIVERSAL=TIFFSwabLong\nUNIVERSAL=TIFFSwabArrayOfShort\nUNIVERSAL=TIFFSwabArrayOfLong\nUNIVERSAL=TIFFSwabArrayOfDouble\nUNIVERSAL=TIFFSwabArrayOfTriples\nUNIVERSAL=TIFFReverseBits\nUNIVERSAL=TIFFGetBitRevTable\nUNIVERSAL=TIFFDefaultStripSize\nUNIVERSAL=TIFFDefaultTileSize\nUNIVERSAL=TIFFRasterScanlineSize\nUNIVERSAL=_TIFFmalloc\nUNIVERSAL=_TIFFrealloc\nUNIVERSAL=_TIFFfree\nUNIVERSAL=_TIFFmemset\nUNIVERSAL=_TIFFmemcpy\nUNIVERSAL=_TIFFmemcmp\nUNIVERSAL=TIFFCreateDirectory\nUNIVERSAL=TIFFSetTagExtender\nUNIVERSAL=TIFFMergeFieldInfo\nUNIVERSAL=TIFFFindFieldInfo\nUNIVERSAL=TIFFFindFieldInfoByName\nUNIVERSAL=TIFFFieldWithName\nUNIVERSAL=TIFFFieldWithTag\nUNIVERSAL=TIFFCurrentDirOffset\nUNIVERSAL=TIFFWriteCheck\nUNIVERSAL=TIFFRGBAImageOK\nUNIVERSAL=TIFFNumberOfDirectories\nUNIVERSAL=TIFFSetFileName\nUNIVERSAL=TIFFSetClientdata\nUNIVERSAL=TIFFSetMode\nUNIVERSAL=TIFFClientdata\nUNIVERSAL=TIFFGetReadProc\nUNIVERSAL=TIFFGetWriteProc\nUNIVERSAL=TIFFGetSeekProc\nUNIVERSAL=TIFFGetCloseProc\nUNIVERSAL=TIFFGetSizeProc\nUNIVERSAL=TIFFGetMapFileProc\nUNIVERSAL=TIFFGetUnmapFileProc\nUNIVERSAL=TIFFIsCODECConfigured\nUNIVERSAL=TIFFGetConfiguredCODECs\nUNIVERSAL=TIFFFindCODEC\nUNIVERSAL=TIFFRegisterCODEC\nUNIVERSAL=TIFFUnRegisterCODEC\nUNIVERSAL=TIFFFreeDirectory\nUNIVERSAL=TIFFReadCustomDirectory\nUNIVERSAL=TIFFReadEXIFDirectory\nUNIVERSAL=TIFFAccessTagMethods\nUNIVERSAL=TIFFGetClientInfo\nUNIVERSAL=TIFFSetClientInfo\nUNIVERSAL=TIFFReassignTagToIgnore\n \n$ENDIF\n$!\n$!\n$! Writing TIFF$SHR.OPT file to build TOOLS\n$ IF (SHARED.GT.0)\n$   THEN\n$       OPEN/WRITE OUT TIFF$SHR.OPT\n$       WRITE OUT \"[]TIFF/LIB\"\n$       WRITE OUT \"[-.PORT]LIBPORT/LIB\"\n$       WRITE OUT JPEG_LIBRARY_PATH\n$       WRITE OUT \"ZLIB:LIBZ/LIB\"\n$       CLOSE OUT\n$ ENDIF\n$!\n$!\n$! Writing OPT.OPT file to build TOOLS\n$OPEN/WRITE OUT OPT.OPT\n$ IF (SHARED.GT.0)\n$   THEN\n$       WRITE OUT \"[-.LIBTIFF]TIFF$SHR/SHARE\"\n$       WRITE OUT JPEG_LIBRARY_PATH\n$   ELSE\n$       WRITE OUT \"[-.LIBTIFF]TIFF/LIB\"\n$       WRITE OUT \"[-.PORT]LIBPORT/LIB\"\n$       WRITE OUT JPEG_LIBRARY_PATH\n$ ENDIF\n$ WRITE OUT \"ZLIB:LIBZ/LIB\"\n$CLOSE OUT\n$!\n$!\n$COPY SYS$INPUT [.LIBTIFF]DESCRIP.MMS\n# (c) Alexey Chupahin 22-NOV-2007\n# OpenVMS 7.3-1, DEC 2000 mod.300\n# OpenVMS 8.3,   HP rx1620\n# Makefile for DEC C compilers.\n#\n\nINCL    = /INCLUDE=(JPEG,ZLIB,[])\n\nCFLAGS =  $(INCL)\n\nOBJ_SYSDEP_MODULE = tif_vms.obj\n\nOBJ     = \\\ntif_aux.obj,\\\ntif_close.obj,\\\ntif_codec.obj,\\\ntif_color.obj,\\\ntif_compress.obj,\\\ntif_dir.obj,\\\ntif_dirinfo.obj,\\\ntif_dirread.obj,\\\ntif_dirwrite.obj,\\\ntif_dumpmode.obj,\\\ntif_error.obj,\\\ntif_extension.obj,\\\ntif_fax3.obj,\\\ntif_fax3sm.obj,\\\ntif_flush.obj,\\\ntif_getimage.obj,\\\ntif_jbig.obj,\\\ntif_jpeg.obj,\\\ntif_luv.obj,\\\ntif_lzw.obj,\\\ntif_next.obj,\\\ntif_ojpeg.obj,\\\ntif_open.obj,\\\ntif_packbits.obj,\\\ntif_pixarlog.obj,\\\ntif_predict.obj,\\\ntif_print.obj,\\\ntif_read.obj,\\\ntif_strip.obj,\\\ntif_swab.obj,\\\ntif_thunder.obj,\\\ntif_tile.obj,\\\ntif_version.obj,\\\ntif_warning.obj,\\\ntif_write.obj,\\\ntif_zip.obj, $(OBJ_SYSDEP_MODULE)\n\n$IF (SHARED.GT.0)\n$ THEN\n$       APP SYS$INPUT [.LIBTIFF]DESCRIP.MMS\nALL : tiff.olb, tiff$shr.exe\n        $WRITE SYS$OUTPUT \"Done\"\n\ntiff$shr.exe : tiff.olb\n        LINK/SHARE=TIFF$SHR.EXE TIF_AUX,[-]TIFF$DEF/OPT, [-]TIFF$SHR/OPT\n        COPY TIFF$SHR.EXE SYS$SHARE\n        PURGE SYS$SHARE:TIFF$SHR.EXE\n\n$ ELSE\n$       APP SYS$INPUT [.LIBTIFF]DESCRIP.MMS\nALL : tiff.olb\n        $WRITE SYS$OUTPUT \"Done\"\n\n$ENDIF\n$!\n$!\n$ APP SYS$INPUT [.LIBTIFF]DESCRIP.MMS\n\ntiff.olb :  $(OBJ)\n        lib/crea tiff.olb $(OBJ)\n\n#tif_config.h : tif_config.h-vms\n#        copy tif_config.h-vms tif_config.h\n#\n#tiffconf.h : tiffconf.h-vms\n#        copy tiffconf.h-vms tiffconf.h\n\ntif_aux.obj : tif_aux.c\n         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\n\ntif_close.obj : tif_close.c\n         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\n\ntif_codec.obj : tif_codec.c\n         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\n\ntif_color.obj : tif_color.c\n         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\n\ntif_compress.obj : tif_compress.c\n         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\n\ntif_dir.obj : tif_dir.c\n         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\n\ntif_dirinfo.obj : tif_dirinfo.c\n         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\n\ntif_dirread.obj : tif_dirread.c\n         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\n\ntif_dirwrite.obj : tif_dirwrite.c\n         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\n\ntif_dumpmode.obj : tif_dumpmode.c\n         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\n\ntif_error.obj : tif_error.c\n         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\n\ntif_extension.obj : tif_extension.c\n         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\n\ntif_fax3.obj : tif_fax3.c\n         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\n\ntif_fax3sm.obj : tif_fax3sm.c\n         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\n\ntif_flush.obj : tif_flush.c\n         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\n\ntif_getimage.obj : tif_getimage.c\n         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\n\ntif_jbig.obj : tif_jbig.c\n         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\n\ntif_jpeg.obj : tif_jpeg.c\n         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\n\ntif_luv.obj : tif_luv.c\n         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\n\ntif_lzw.obj : tif_lzw.c\n         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\n\ntif_next.obj : tif_next.c\n         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\n\ntif_ojpeg.obj : tif_ojpeg.c\n         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\n\ntif_open.obj : tif_open.c\n         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\n\ntif_packbits.obj : tif_packbits.c\n         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\n\ntif_pixarlog.obj : tif_pixarlog.c\n         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\n\ntif_predict.obj : tif_predict.c\n         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\n\ntif_print.obj : tif_print.c\n         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\n\ntif_read.obj : tif_read.c\n         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\n\ntif_strip.obj : tif_strip.c\n         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\n\ntif_swab.obj : tif_swab.c\n         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\n\ntif_thunder.obj : tif_thunder.c\n         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\n\ntif_tile.obj : tif_tile.c\n         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\n\ntif_unix.obj : tif_unix.c\n         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\n\ntif_version.obj : tif_version.c\n         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\n\ntif_warning.obj : tif_warning.c\n         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\n\ntif_write.obj : tif_write.c\n         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\n\ntif_zip.obj : tif_zip.c\n         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\n \n\nclean :\n        del *.obj;*\n        del *.olb;*\n$!\n$!\n$!\n$COPY SYS$INPUT [.TOOLS]DESCRIP.MMS\n# (c) Alexey Chupahin 22-NOV-2007\n# OpenVMS 7.3-1, DEC 2000 mod.300\n# OpenVMS 8.3,   HP rx1620\n \nINCL            = /INCL=([],[-.LIBTIFF])\nCFLAGS = $(INCL)\nLIBS = [-]OPT/OPT\n\nOBJ=\\\nbmp2tiff.exe,\\\nfax2ps.exe,\\\nfax2tiff.exe,\\\ngif2tiff.exe,\\\npal2rgb.exe,\\\nppm2tiff.exe,\\\nras2tiff.exe,\\\nraw2tiff.exe,\\\nrgb2ycbcr.exe,\\\nthumbnail.exe,\\\ntiff2bw.exe,\\\ntiff2pdf.exe,\\\ntiff2ps.exe,\\\ntiff2rgba.exe,\\\ntiffcmp.exe,\\\ntiffcp.exe,\\\ntiffcrop.exe,\\\ntiffdither.exe,\\\ntiffdump.exe,\\\ntiffinfo.exe,\\\ntiffmedian.exe,\\\ntiffset.exe,\\\ntiffsplit.exe,\\\nycbcr.exe\n \n\nall : $(OBJ)\n\t$!\n\nbmp2tiff.obj : bmp2tiff.c\n         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\n\nbmp2tiff.exe : bmp2tiff.obj\n         LINK/EXE=$(MMS$TARGET)  $(MMS$SOURCE), $(LIBS)\n\nfax2ps.obj : fax2ps.c\n         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\n\nfax2ps.exe : fax2ps.obj\n         LINK/EXE=$(MMS$TARGET)  $(MMS$SOURCE), $(LIBS)\n\nfax2tiff.obj : fax2tiff.c\n         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\n\nfax2tiff.exe : fax2tiff.obj\n         LINK/EXE=$(MMS$TARGET)  $(MMS$SOURCE), $(LIBS)\n\ngif2tiff.obj : gif2tiff.c\n         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\n\ngif2tiff.exe : gif2tiff.obj\n         LINK/EXE=$(MMS$TARGET)  $(MMS$SOURCE), $(LIBS)\n\npal2rgb.obj : pal2rgb.c\n         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\n\npal2rgb.exe : pal2rgb.obj\n         LINK/EXE=$(MMS$TARGET)  $(MMS$SOURCE), $(LIBS)\n\nppm2tiff.obj : ppm2tiff.c\n         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\n\nppm2tiff.exe : ppm2tiff.obj\n         LINK/EXE=$(MMS$TARGET)  $(MMS$SOURCE), $(LIBS)\n\nras2tiff.obj : ras2tiff.c\n         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\n\nras2tiff.exe : ras2tiff.obj\n         LINK/EXE=$(MMS$TARGET)  $(MMS$SOURCE), $(LIBS)\n\nraw2tiff.obj : raw2tiff.c\n         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\n\nraw2tiff.exe : raw2tiff.obj\n         LINK/EXE=$(MMS$TARGET)  $(MMS$SOURCE), $(LIBS)\n\nrgb2ycbcr.obj : rgb2ycbcr.c\n         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\n\nrgb2ycbcr.exe : rgb2ycbcr.obj\n         LINK/EXE=$(MMS$TARGET)  $(MMS$SOURCE), $(LIBS)\n\nsgi2tiff.obj : sgi2tiff.c\n         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\n\nsgi2tiff.exe : sgi2tiff.obj\n         LINK/EXE=$(MMS$TARGET)  $(MMS$SOURCE), $(LIBS)\n\nsgisv.obj : sgisv.c\n         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\n\nsgisv.exe : sgisv.obj\n         LINK/EXE=$(MMS$TARGET)  $(MMS$SOURCE), $(LIBS)\n\nthumbnail.obj : thumbnail.c\n         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\n\nthumbnail.exe : thumbnail.obj\n         LINK/EXE=$(MMS$TARGET)  $(MMS$SOURCE), $(LIBS)\n\ntiff2bw.obj : tiff2bw.c\n         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\n\ntiff2bw.exe : tiff2bw.obj\n         LINK/EXE=$(MMS$TARGET)  $(MMS$SOURCE), $(LIBS)\n\ntiff2pdf.obj : tiff2pdf.c\n         $(CC) $(CFLAGS) /NOWARN $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\n\ntiff2pdf.exe : tiff2pdf.obj\n         LINK/EXE=$(MMS$TARGET)  $(MMS$SOURCE), $(LIBS)\n\ntiff2ps.obj : tiff2ps.c\n         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\n\ntiff2ps.exe : tiff2ps.obj\n         LINK/EXE=$(MMS$TARGET)  $(MMS$SOURCE), $(LIBS)\n\ntiff2rgba.obj : tiff2rgba.c\n         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\n\ntiff2rgba.exe : tiff2rgba.obj\n         LINK/EXE=$(MMS$TARGET)  $(MMS$SOURCE), $(LIBS)\n\ntiffcmp.obj : tiffcmp.c\n         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\n\ntiffcmp.exe : tiffcmp.obj\n         LINK/EXE=$(MMS$TARGET)  $(MMS$SOURCE), $(LIBS)\n\ntiffcp.obj : tiffcp.c\n         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\n\ntiffcp.exe : tiffcp.obj\n         LINK/EXE=$(MMS$TARGET)  $(MMS$SOURCE), $(LIBS)\n\ntiffcrop.obj : tiffcrop.c\n         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\n\ntiffcrop.exe : tiffcrop.obj\n         LINK/EXE=$(MMS$TARGET)  $(MMS$SOURCE), $(LIBS)\n\ntiffdither.obj : tiffdither.c\n         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\n\ntiffdither.exe : tiffdither.obj\n         LINK/EXE=$(MMS$TARGET)  $(MMS$SOURCE), $(LIBS)\n\ntiffdump.obj : tiffdump.c\n         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\n\ntiffdump.exe : tiffdump.obj\n         LINK/EXE=$(MMS$TARGET)  $(MMS$SOURCE), $(LIBS)\n\ntiffgt.obj : tiffgt.c\n         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\n\ntiffgt.exe : tiffgt.obj\n         LINK/EXE=$(MMS$TARGET)  $(MMS$SOURCE), $(LIBS)\n\ntiffinfo.obj : tiffinfo.c\n         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\n\ntiffinfo.exe : tiffinfo.obj\n         LINK/EXE=$(MMS$TARGET)  $(MMS$SOURCE), $(LIBS)\n\ntiffmedian.obj : tiffmedian.c\n         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\n\ntiffmedian.exe : tiffmedian.obj\n         LINK/EXE=$(MMS$TARGET)  $(MMS$SOURCE), $(LIBS)\n\ntiffset.obj : tiffset.c\n         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\n\ntiffset.exe : tiffset.obj\n         LINK/EXE=$(MMS$TARGET)  $(MMS$SOURCE), $(LIBS)\n\ntiffsplit.obj : tiffsplit.c\n         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\n\ntiffsplit.exe : tiffsplit.obj\n         LINK/EXE=$(MMS$TARGET)  $(MMS$SOURCE), $(LIBS)\n\nycbcr.obj : ycbcr.c\n         $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)\n\nycbcr.exe : ycbcr.obj\n         LINK/EXE=$(MMS$TARGET)  $(MMS$SOURCE), $(LIBS)\n \n\nCLEAN :\n\tDEL ALL.;*\n\tDEL *.OBJ;*\n\tDEL *.EXE;*\n\n$!\n$!\n$!\n$!copiing and patching TIFF_CONF.H, TIF_CONFIG.H\n$!\n$CURRENT = F$ENVIRONMENT (\"\"DEFAULT\"\")\n$CURRENT[F$LOCATE(\"]\",CURRENT),9]:=\".LIBTIFF]\"\n$WRITE SYS$OUTPUT \"Creating TIFFCONF.H and TIF_CONFIG.H\"\n$COPY SYS$INPUT 'CURRENT'TIFFCONF.H\n/*\n  Configuration defines for installed libtiff.\n  This file maintained for backward compatibility. Do not use definitions\n  from this file in your programs.\n*/\n\n#ifndef _TIFFCONF_\n#define _TIFFCONF_\n\n/* Define to 1 if the system has the type `int16'. */\n//#define HAVE_INT16\n\n/* Define to 1 if the system has the type `int32'. */\n//#define  HAVE_INT32\n\n/* Define to 1 if the system has the type `int8'. */\n//#define HAVE_INT8\n\n/* The size of a `int', as computed by sizeof. */\n#define SIZEOF_INT 4\n\n/* The size of a `long', as computed by sizeof. */\n#define SIZEOF_LONG 4\n\n/* Compatibility stuff. */\n\n/* Define as 0 or 1 according to the floating point format suported by the\n   machine */\n\n#ifdef __IEEE_FLOAT\n#define HAVE_IEEEFP 1\n#endif\n\n#define HAVE_GETOPT 1\n\n/* Set the native cpu bit order (FILLORDER_LSB2MSB or FILLORDER_MSB2LSB) */\n#define HOST_FILLORDER FILLORDER_LSB2MSB\n\n/* Native cpu byte order: 1 if big-endian (Motorola) or 0 if little-endian\n   (Intel) */\n#define HOST_BIGENDIAN 0\n\n/* Support CCITT Group 3 & 4 algorithms */\n#define CCITT_SUPPORT 1\n\n/* Support LogLuv high dynamic range encoding */\n#define LOGLUV_SUPPORT 1\n\n/* Support LZW algorithm */\n#define LZW_SUPPORT 1\n\n/* Support NeXT 2-bit RLE algorithm */\n#define NEXT_SUPPORT 1\n\n/* Support Old JPEG compresson (read contrib/ojpeg/README first! Compilation\n   fails with unpatched IJG JPEG library) */\n\n/* Support Macintosh PackBits algorithm */\n#define PACKBITS_SUPPORT 1\n\n/* Support Pixar log-format algorithm (requires Zlib) */\n#define PIXARLOG_SUPPORT 1\n\n/* Support ThunderScan 4-bit RLE algorithm */\n#define THUNDER_SUPPORT 1\n\n/* Support Deflate compression */\n/* #undef ZIP_SUPPORT */\n\n/* Support strip chopping (whether or not to convert single-strip uncompressed\n   images to mutiple strips of ~8Kb to reduce memory usage) */\n#define STRIPCHOP_DEFAULT TIFF_STRIPCHOP\n\n/* Enable SubIFD tag (330) support */\n#define SUBIFD_SUPPORT 1\n\n/* Treat extra sample as alpha (default enabled). The RGBA interface will\n   treat a fourth sample with no EXTRASAMPLE_ value as being ASSOCALPHA. Many\n   packages produce RGBA files but don't mark the alpha properly. */\n#define DEFAULT_EXTRASAMPLE_AS_ALPHA 1\n\n/* Pick up YCbCr subsampling info from the JPEG data stream to support files\n   lacking the tag (default enabled). */\n#define CHECK_JPEG_YCBCR_SUBSAMPLING 1\n\n/*\n * Feature support definitions.\n * XXX: These macros are obsoleted. Don't use them in your apps!\n * Macros stays here for backward compatibility and should be always defined.\n */\n#define COLORIMETRY_SUPPORT\n#define YCBCR_SUPPORT\n#define CMYK_SUPPORT\n#define ICC_SUPPORT\n#define PHOTOSHOP_SUPPORT\n#define IPTC_SUPPORT\n\n#endif /* _TIFFCONF_ */\n \n\n$COPY SYS$INPUT 'CURRENT'TIF_CONFIG.H\n/* Define to 1 if you have the <assert.h> header file. */\n\n#ifndef HAVE_GETOPT\n#  define HAVE_GETOPT 1\n#endif\n\n#define HAVE_ASSERT_H 1\n\n/* Define to 1 if you have the <fcntl.h> header file. */\n#define HAVE_FCNTL_H 1\n\n/* Define as 0 or 1 according to the floating point format suported by the\n   machine */\n\n#ifdef __IEEE_FLOAT\n#define HAVE_IEEEFP 1\n#endif\n\n#define HAVE_UNISTD_H 1\n\n#define HAVE_STRING_H 1\n/* Define to 1 if you have the <sys/types.h> header file. */\n#define HAVE_SYS_TYPES_H 1\n\n/* Define to 1 if you have the <io.h> header file. */\n//#define HAVE_IO_H 1\n\n/* Define to 1 if you have the <search.h> header file. */\n//#define HAVE_SEARCH_H 1\n\n/* The size of a `int', as computed by sizeof. */\n#define SIZEOF_INT 4\n\n/* The size of a `long', as computed by sizeof. */\n#define SIZEOF_LONG 4\n\n/* Set the native cpu bit order */\n#define HOST_FILLORDER FILLORDER_LSB2MSB\n\n/* Define to 1 if your processor stores words with the most significant byte\n   first (like Motorola and SPARC, unlike Intel and VAX). */\n/* #undef WORDS_BIGENDIAN */\n\n/* Define to `__inline__' or `__inline' if that's what the C compiler\n   calls it, or to nothing if 'inline' is not supported under any name.  */\n/*\n#ifndef __cplusplus\n# ifndef inline\n#  define inline __inline\n# endif\n#endif\n*/\n\n/* Support CCITT Group 3 & 4 algorithms */\n#define CCITT_SUPPORT 1\n\n/* Pick up YCbCr subsampling info from the JPEG data stream to support files\n   lacking the tag (default enabled). */\n#define CHECK_JPEG_YCBCR_SUBSAMPLING 1\n/* Support C++ stream API (requires C++ compiler) */\n#define CXX_SUPPORT 1\n\n/* Treat extra sample as alpha (default enabled). The RGBA interface will\n   treat a fourth sample with no EXTRASAMPLE_ value as being ASSOCALPHA. Many\n      packages produce RGBA files but don't mark the alpha properly. */\n#define DEFAULT_EXTRASAMPLE_AS_ALPHA 1\n\n/* little Endian */\n#define HOST_BIGENDIAN 0\n#define JPEG_SUPPORT 1\n#define LOGLUV_SUPPORT 1\n/* Support LZW algorithm */\n#define LZW_SUPPORT 1\n\n/* Support Microsoft Document Imaging format */\n#define MDI_SUPPORT 1\n\n/* Support NeXT 2-bit RLE algorithm */\n#define NEXT_SUPPORT 1\n#define OJPEG_SUPPORT 1\n\n/* Name of package */\n#define PACKAGE \"tiff\"\n\n\n/* Define to the address where bug reports for this package should be sent. */\n#define PACKAGE_BUGREPORT \"tiff@lists.maptools.org\"\n\n/* Define to the full name of this package. */\n#define PACKAGE_NAME \"LibTIFF Software\"\n\n/* Define to the full name and version of this package. */\n#define PACKAGE_STRING \"LibTIFF Software 3.9.0 for VMS\"\n\n/* Define to the one symbol short name of this package. */\n#define PACKAGE_TARNAME \"tiff\"\n\n$PURGE 'CURRENT'TIFFCONF.H\n$PURGE 'CURRENT'TIF_CONFIG.H\n$OPEN/APPEND OUT 'CURRENT'TIF_CONFIG.H\n$IF HAVE_LFIND.EQ.1\n$   THEN\n$       WRITE OUT \"#define HAVE_SEARCH_H 1\"\n$   ELSE\n$       WRITE OUT \"#undef HAVE_SEARCH_H\"\n$ENDIF\n$CLOSE OUT\n$!\n$!\n$WRITE SYS$OUTPUT \" \"\n$WRITE SYS$OUTPUT \" \"\n$WRITE SYS$OUTPUT \"Now you can type @BUILD \"\n$!\n$EXIT:\n$DEFINE SYS$ERROR _NLA0:\n$DEFINE SYS$OUTPUT _NLA0:\n$DEL TEST.OBJ;*\n$DEL TEST.C;*\n$DEL TEST.EXE;*\n$DEAS SYS$ERROR\n$DEAS SYS$OUTPUT\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/Makefile.am",
    "content": "# Tag Image File Format (TIFF) Software\n#\n# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>\n#\n# Permission to use, copy, modify, distribute, and sell this software and \n# its documentation for any purpose is hereby granted without fee, provided\n# that (i) the above copyright notices and this permission notice appear in\n# all copies of the software and related documentation, and (ii) the names of\n# Sam Leffler and Silicon Graphics may not be used in any advertising or\n# publicity relating to the software without the specific, prior written\n# permission of Sam Leffler and Silicon Graphics.\n# \n# THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n# \n# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n# OF THIS SOFTWARE.\n\n# Process this file with automake to produce Makefile.in.\n\nEXTRA_DIST = README\n\nSUBDIRS = acorn addtiffo dbs iptcutil mac-cw mac-mpw mfs pds ras stream tags win_dib\n\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/Makefile.in",
    "content": "# Makefile.in generated by automake 1.11 from Makefile.am.\n# @configure_input@\n\n# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,\n# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,\n# Inc.\n# This Makefile.in is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY, to the extent permitted by law; without\n# even the implied warranty of MERCHANTABILITY or FITNESS FOR A\n# PARTICULAR PURPOSE.\n\n@SET_MAKE@\n\n# Tag Image File Format (TIFF) Software\n#\n# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>\n#\n# Permission to use, copy, modify, distribute, and sell this software and \n# its documentation for any purpose is hereby granted without fee, provided\n# that (i) the above copyright notices and this permission notice appear in\n# all copies of the software and related documentation, and (ii) the names of\n# Sam Leffler and Silicon Graphics may not be used in any advertising or\n# publicity relating to the software without the specific, prior written\n# permission of Sam Leffler and Silicon Graphics.\n# \n# THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n# \n# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n# OF THIS SOFTWARE.\n\n# Process this file with automake to produce Makefile.in.\nVPATH = @srcdir@\npkgdatadir = $(datadir)/@PACKAGE@\npkgincludedir = $(includedir)/@PACKAGE@\npkglibdir = $(libdir)/@PACKAGE@\npkglibexecdir = $(libexecdir)/@PACKAGE@\nam__cd = CDPATH=\"$${ZSH_VERSION+.}$(PATH_SEPARATOR)\" && cd\ninstall_sh_DATA = $(install_sh) -c -m 644\ninstall_sh_PROGRAM = $(install_sh) -c\ninstall_sh_SCRIPT = $(install_sh) -c\nINSTALL_HEADER = $(INSTALL_DATA)\ntransform = $(program_transform_name)\nNORMAL_INSTALL = :\nPRE_INSTALL = :\nPOST_INSTALL = :\nNORMAL_UNINSTALL = :\nPRE_UNINSTALL = :\nPOST_UNINSTALL = :\nbuild_triplet = @build@\nhost_triplet = @host@\ntarget_triplet = @target@\nsubdir = contrib\nDIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in\nACLOCAL_M4 = $(top_srcdir)/aclocal.m4\nam__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \\\n\t$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \\\n\t$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \\\n\t$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac\nam__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \\\n\t$(ACLOCAL_M4)\nmkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs\nCONFIG_HEADER = $(top_builddir)/libtiff/tif_config.h \\\n\t$(top_builddir)/libtiff/tiffconf.h\nCONFIG_CLEAN_FILES =\nCONFIG_CLEAN_VPATH_FILES =\nAM_V_GEN = $(am__v_GEN_$(V))\nam__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))\nam__v_GEN_0 = @echo \"  GEN   \" $@;\nAM_V_at = $(am__v_at_$(V))\nam__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))\nam__v_at_0 = @\nSOURCES =\nDIST_SOURCES =\nRECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \\\n\thtml-recursive info-recursive install-data-recursive \\\n\tinstall-dvi-recursive install-exec-recursive \\\n\tinstall-html-recursive install-info-recursive \\\n\tinstall-pdf-recursive install-ps-recursive install-recursive \\\n\tinstallcheck-recursive installdirs-recursive pdf-recursive \\\n\tps-recursive uninstall-recursive\nRECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive\t\\\n  distclean-recursive maintainer-clean-recursive\nAM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \\\n\t$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \\\n\tdistdir\nETAGS = etags\nCTAGS = ctags\nDIST_SUBDIRS = $(SUBDIRS)\nDISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)\nam__relativize = \\\n  dir0=`pwd`; \\\n  sed_first='s,^\\([^/]*\\)/.*$$,\\1,'; \\\n  sed_rest='s,^[^/]*/*,,'; \\\n  sed_last='s,^.*/\\([^/]*\\)$$,\\1,'; \\\n  sed_butlast='s,/*[^/]*$$,,'; \\\n  while test -n \"$$dir1\"; do \\\n    first=`echo \"$$dir1\" | sed -e \"$$sed_first\"`; \\\n    if test \"$$first\" != \".\"; then \\\n      if test \"$$first\" = \"..\"; then \\\n        dir2=`echo \"$$dir0\" | sed -e \"$$sed_last\"`/\"$$dir2\"; \\\n        dir0=`echo \"$$dir0\" | sed -e \"$$sed_butlast\"`; \\\n      else \\\n        first2=`echo \"$$dir2\" | sed -e \"$$sed_first\"`; \\\n        if test \"$$first2\" = \"$$first\"; then \\\n          dir2=`echo \"$$dir2\" | sed -e \"$$sed_rest\"`; \\\n        else \\\n          dir2=\"../$$dir2\"; \\\n        fi; \\\n        dir0=\"$$dir0\"/\"$$first\"; \\\n      fi; \\\n    fi; \\\n    dir1=`echo \"$$dir1\" | sed -e \"$$sed_rest\"`; \\\n  done; \\\n  reldir=\"$$dir2\"\nACLOCAL = @ACLOCAL@\nAMTAR = @AMTAR@\nAM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@\nAR = @AR@\nAS = @AS@\nAUTOCONF = @AUTOCONF@\nAUTOHEADER = @AUTOHEADER@\nAUTOMAKE = @AUTOMAKE@\nAWK = @AWK@\nCC = @CC@\nCCDEPMODE = @CCDEPMODE@\nCFLAGS = @CFLAGS@\nCPP = @CPP@\nCPPFLAGS = @CPPFLAGS@\nCXX = @CXX@\nCXXCPP = @CXXCPP@\nCXXDEPMODE = @CXXDEPMODE@\nCXXFLAGS = @CXXFLAGS@\nCYGPATH_W = @CYGPATH_W@\nDEFS = @DEFS@\nDEPDIR = @DEPDIR@\nDLLTOOL = @DLLTOOL@\nDSYMUTIL = @DSYMUTIL@\nDUMPBIN = @DUMPBIN@\nECHO_C = @ECHO_C@\nECHO_N = @ECHO_N@\nECHO_T = @ECHO_T@\nEGREP = @EGREP@\nEXEEXT = @EXEEXT@\nFGREP = @FGREP@\nGLUT_CFLAGS = @GLUT_CFLAGS@\nGLUT_LIBS = @GLUT_LIBS@\nGLU_CFLAGS = @GLU_CFLAGS@\nGLU_LIBS = @GLU_LIBS@\nGL_CFLAGS = @GL_CFLAGS@\nGL_LIBS = @GL_LIBS@\nGREP = @GREP@\nINSTALL = @INSTALL@\nINSTALL_DATA = @INSTALL_DATA@\nINSTALL_PROGRAM = @INSTALL_PROGRAM@\nINSTALL_SCRIPT = @INSTALL_SCRIPT@\nINSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@\nLD = @LD@\nLDFLAGS = @LDFLAGS@\nLIBDIR = @LIBDIR@\nLIBOBJS = @LIBOBJS@\nLIBS = @LIBS@\nLIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@\nLIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@\nLIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@\nLIBTIFF_MICRO_VERSION = @LIBTIFF_MICRO_VERSION@\nLIBTIFF_MINOR_VERSION = @LIBTIFF_MINOR_VERSION@\nLIBTIFF_RELEASE_DATE = @LIBTIFF_RELEASE_DATE@\nLIBTIFF_VERSION = @LIBTIFF_VERSION@\nLIBTIFF_VERSION_INFO = @LIBTIFF_VERSION_INFO@\nLIBTOOL = @LIBTOOL@\nLIPO = @LIPO@\nLN_S = @LN_S@\nLTLIBOBJS = @LTLIBOBJS@\nMAINT = @MAINT@\nMAKEINFO = @MAKEINFO@\nMKDIR_P = @MKDIR_P@\nNM = @NM@\nNMEDIT = @NMEDIT@\nOBJDUMP = @OBJDUMP@\nOBJEXT = @OBJEXT@\nOTOOL = @OTOOL@\nOTOOL64 = @OTOOL64@\nPACKAGE = @PACKAGE@\nPACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@\nPACKAGE_NAME = @PACKAGE_NAME@\nPACKAGE_STRING = @PACKAGE_STRING@\nPACKAGE_TARNAME = @PACKAGE_TARNAME@\nPACKAGE_URL = @PACKAGE_URL@\nPACKAGE_VERSION = @PACKAGE_VERSION@\nPATH_SEPARATOR = @PATH_SEPARATOR@\nPTHREAD_CC = @PTHREAD_CC@\nPTHREAD_CFLAGS = @PTHREAD_CFLAGS@\nPTHREAD_LIBS = @PTHREAD_LIBS@\nRANLIB = @RANLIB@\nSED = @SED@\nSET_MAKE = @SET_MAKE@\nSHELL = @SHELL@\nSTRIP = @STRIP@\nVERSION = @VERSION@\nXMKMF = @XMKMF@\nX_CFLAGS = @X_CFLAGS@\nX_EXTRA_LIBS = @X_EXTRA_LIBS@\nX_LIBS = @X_LIBS@\nX_PRE_LIBS = @X_PRE_LIBS@\nabs_builddir = @abs_builddir@\nabs_srcdir = @abs_srcdir@\nabs_top_builddir = @abs_top_builddir@\nabs_top_srcdir = @abs_top_srcdir@\nac_ct_CC = @ac_ct_CC@\nac_ct_CXX = @ac_ct_CXX@\nac_ct_DUMPBIN = @ac_ct_DUMPBIN@\nacx_pthread_config = @acx_pthread_config@\nam__include = @am__include@\nam__leading_dot = @am__leading_dot@\nam__quote = @am__quote@\nam__tar = @am__tar@\nam__untar = @am__untar@\nbindir = @bindir@\nbuild = @build@\nbuild_alias = @build_alias@\nbuild_cpu = @build_cpu@\nbuild_os = @build_os@\nbuild_vendor = @build_vendor@\nbuilddir = @builddir@\ndatadir = @datadir@\ndatarootdir = @datarootdir@\ndocdir = @docdir@\ndvidir = @dvidir@\nexec_prefix = @exec_prefix@\nhost = @host@\nhost_alias = @host_alias@\nhost_cpu = @host_cpu@\nhost_os = @host_os@\nhost_vendor = @host_vendor@\nhtmldir = @htmldir@\nincludedir = @includedir@\ninfodir = @infodir@\ninstall_sh = @install_sh@\nlibdir = @libdir@\nlibexecdir = @libexecdir@\nlocaledir = @localedir@\nlocalstatedir = @localstatedir@\nlt_ECHO = @lt_ECHO@\nmandir = @mandir@\nmkdir_p = @mkdir_p@\noldincludedir = @oldincludedir@\npdfdir = @pdfdir@\nprefix = @prefix@\nprogram_transform_name = @program_transform_name@\npsdir = @psdir@\nsbindir = @sbindir@\nsharedstatedir = @sharedstatedir@\nsrcdir = @srcdir@\nsysconfdir = @sysconfdir@\ntarget = @target@\ntarget_alias = @target_alias@\ntarget_cpu = @target_cpu@\ntarget_os = @target_os@\ntarget_vendor = @target_vendor@\ntop_build_prefix = @top_build_prefix@\ntop_builddir = @top_builddir@\ntop_srcdir = @top_srcdir@\nEXTRA_DIST = README\nSUBDIRS = acorn addtiffo dbs iptcutil mac-cw mac-mpw mfs pds ras stream tags win_dib\nall: all-recursive\n\n.SUFFIXES:\n$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)\n\t@for dep in $?; do \\\n\t  case '$(am__configure_deps)' in \\\n\t    *$$dep*) \\\n\t      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \\\n\t        && { if test -f $@; then exit 0; else break; fi; }; \\\n\t      exit 1;; \\\n\t  esac; \\\n\tdone; \\\n\techo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign contrib/Makefile'; \\\n\t$(am__cd) $(top_srcdir) && \\\n\t  $(AUTOMAKE) --foreign contrib/Makefile\n.PRECIOUS: Makefile\nMakefile: $(srcdir)/Makefile.in $(top_builddir)/config.status\n\t@case '$?' in \\\n\t  *config.status*) \\\n\t    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \\\n\t  *) \\\n\t    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \\\n\t    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \\\n\tesac;\n\n$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n\n$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n$(am__aclocal_m4_deps):\n\nmostlyclean-libtool:\n\t-rm -f *.lo\n\nclean-libtool:\n\t-rm -rf .libs _libs\n\n# This directory's subdirectories are mostly independent; you can cd\n# into them and run `make' without going through this Makefile.\n# To change the values of `make' variables: instead of editing Makefiles,\n# (1) if the variable is set in `config.status', edit `config.status'\n#     (which will cause the Makefiles to be regenerated when you run `make');\n# (2) otherwise, pass the desired values on the `make' command line.\n$(RECURSIVE_TARGETS):\n\t@failcom='exit 1'; \\\n\tfor f in x $$MAKEFLAGS; do \\\n\t  case $$f in \\\n\t    *=* | --[!k]*);; \\\n\t    *k*) failcom='fail=yes';; \\\n\t  esac; \\\n\tdone; \\\n\tdot_seen=no; \\\n\ttarget=`echo $@ | sed s/-recursive//`; \\\n\tlist='$(SUBDIRS)'; for subdir in $$list; do \\\n\t  echo \"Making $$target in $$subdir\"; \\\n\t  if test \"$$subdir\" = \".\"; then \\\n\t    dot_seen=yes; \\\n\t    local_target=\"$$target-am\"; \\\n\t  else \\\n\t    local_target=\"$$target\"; \\\n\t  fi; \\\n\t  ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \\\n\t  || eval $$failcom; \\\n\tdone; \\\n\tif test \"$$dot_seen\" = \"no\"; then \\\n\t  $(MAKE) $(AM_MAKEFLAGS) \"$$target-am\" || exit 1; \\\n\tfi; test -z \"$$fail\"\n\n$(RECURSIVE_CLEAN_TARGETS):\n\t@failcom='exit 1'; \\\n\tfor f in x $$MAKEFLAGS; do \\\n\t  case $$f in \\\n\t    *=* | --[!k]*);; \\\n\t    *k*) failcom='fail=yes';; \\\n\t  esac; \\\n\tdone; \\\n\tdot_seen=no; \\\n\tcase \"$@\" in \\\n\t  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \\\n\t  *) list='$(SUBDIRS)' ;; \\\n\tesac; \\\n\trev=''; for subdir in $$list; do \\\n\t  if test \"$$subdir\" = \".\"; then :; else \\\n\t    rev=\"$$subdir $$rev\"; \\\n\t  fi; \\\n\tdone; \\\n\trev=\"$$rev .\"; \\\n\ttarget=`echo $@ | sed s/-recursive//`; \\\n\tfor subdir in $$rev; do \\\n\t  echo \"Making $$target in $$subdir\"; \\\n\t  if test \"$$subdir\" = \".\"; then \\\n\t    local_target=\"$$target-am\"; \\\n\t  else \\\n\t    local_target=\"$$target\"; \\\n\t  fi; \\\n\t  ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \\\n\t  || eval $$failcom; \\\n\tdone && test -z \"$$fail\"\ntags-recursive:\n\tlist='$(SUBDIRS)'; for subdir in $$list; do \\\n\t  test \"$$subdir\" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \\\n\tdone\nctags-recursive:\n\tlist='$(SUBDIRS)'; for subdir in $$list; do \\\n\t  test \"$$subdir\" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \\\n\tdone\n\nID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)\n\tlist='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \\\n\tunique=`for i in $$list; do \\\n\t    if test -f \"$$i\"; then echo $$i; else echo $(srcdir)/$$i; fi; \\\n\t  done | \\\n\t  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \\\n\t      END { if (nonempty) { for (i in files) print i; }; }'`; \\\n\tmkid -fID $$unique\ntags: TAGS\n\nTAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \\\n\t\t$(TAGS_FILES) $(LISP)\n\tset x; \\\n\there=`pwd`; \\\n\tif ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \\\n\t  include_option=--etags-include; \\\n\t  empty_fix=.; \\\n\telse \\\n\t  include_option=--include; \\\n\t  empty_fix=; \\\n\tfi; \\\n\tlist='$(SUBDIRS)'; for subdir in $$list; do \\\n\t  if test \"$$subdir\" = .; then :; else \\\n\t    test ! -f $$subdir/TAGS || \\\n\t      set \"$$@\" \"$$include_option=$$here/$$subdir/TAGS\"; \\\n\t  fi; \\\n\tdone; \\\n\tlist='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \\\n\tunique=`for i in $$list; do \\\n\t    if test -f \"$$i\"; then echo $$i; else echo $(srcdir)/$$i; fi; \\\n\t  done | \\\n\t  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \\\n\t      END { if (nonempty) { for (i in files) print i; }; }'`; \\\n\tshift; \\\n\tif test -z \"$(ETAGS_ARGS)$$*$$unique\"; then :; else \\\n\t  test -n \"$$unique\" || unique=$$empty_fix; \\\n\t  if test $$# -gt 0; then \\\n\t    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \\\n\t      \"$$@\" $$unique; \\\n\t  else \\\n\t    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \\\n\t      $$unique; \\\n\t  fi; \\\n\tfi\nctags: CTAGS\nCTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \\\n\t\t$(TAGS_FILES) $(LISP)\n\tlist='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \\\n\tunique=`for i in $$list; do \\\n\t    if test -f \"$$i\"; then echo $$i; else echo $(srcdir)/$$i; fi; \\\n\t  done | \\\n\t  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \\\n\t      END { if (nonempty) { for (i in files) print i; }; }'`; \\\n\ttest -z \"$(CTAGS_ARGS)$$unique\" \\\n\t  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \\\n\t     $$unique\n\nGTAGS:\n\there=`$(am__cd) $(top_builddir) && pwd` \\\n\t  && $(am__cd) $(top_srcdir) \\\n\t  && gtags -i $(GTAGS_ARGS) \"$$here\"\n\ndistclean-tags:\n\t-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags\n\ndistdir: $(DISTFILES)\n\t@srcdirstrip=`echo \"$(srcdir)\" | sed 's/[].[^$$\\\\*]/\\\\\\\\&/g'`; \\\n\ttopsrcdirstrip=`echo \"$(top_srcdir)\" | sed 's/[].[^$$\\\\*]/\\\\\\\\&/g'`; \\\n\tlist='$(DISTFILES)'; \\\n\t  dist_files=`for file in $$list; do echo $$file; done | \\\n\t  sed -e \"s|^$$srcdirstrip/||;t\" \\\n\t      -e \"s|^$$topsrcdirstrip/|$(top_builddir)/|;t\"`; \\\n\tcase $$dist_files in \\\n\t  */*) $(MKDIR_P) `echo \"$$dist_files\" | \\\n\t\t\t   sed '/\\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \\\n\t\t\t   sort -u` ;; \\\n\tesac; \\\n\tfor file in $$dist_files; do \\\n\t  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \\\n\t  if test -d $$d/$$file; then \\\n\t    dir=`echo \"/$$file\" | sed -e 's,/[^/]*$$,,'`; \\\n\t    if test -d \"$(distdir)/$$file\"; then \\\n\t      find \"$(distdir)/$$file\" -type d ! -perm -700 -exec chmod u+rwx {} \\;; \\\n\t    fi; \\\n\t    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \\\n\t      cp -fpR $(srcdir)/$$file \"$(distdir)$$dir\" || exit 1; \\\n\t      find \"$(distdir)/$$file\" -type d ! -perm -700 -exec chmod u+rwx {} \\;; \\\n\t    fi; \\\n\t    cp -fpR $$d/$$file \"$(distdir)$$dir\" || exit 1; \\\n\t  else \\\n\t    test -f \"$(distdir)/$$file\" \\\n\t    || cp -p $$d/$$file \"$(distdir)/$$file\" \\\n\t    || exit 1; \\\n\t  fi; \\\n\tdone\n\t@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \\\n\t  if test \"$$subdir\" = .; then :; else \\\n\t    test -d \"$(distdir)/$$subdir\" \\\n\t    || $(MKDIR_P) \"$(distdir)/$$subdir\" \\\n\t    || exit 1; \\\n\t  fi; \\\n\tdone\n\t@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \\\n\t  if test \"$$subdir\" = .; then :; else \\\n\t    dir1=$$subdir; dir2=\"$(distdir)/$$subdir\"; \\\n\t    $(am__relativize); \\\n\t    new_distdir=$$reldir; \\\n\t    dir1=$$subdir; dir2=\"$(top_distdir)\"; \\\n\t    $(am__relativize); \\\n\t    new_top_distdir=$$reldir; \\\n\t    echo \" (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=\"$$new_top_distdir\" distdir=\"$$new_distdir\" \\\\\"; \\\n\t    echo \"     am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)\"; \\\n\t    ($(am__cd) $$subdir && \\\n\t      $(MAKE) $(AM_MAKEFLAGS) \\\n\t        top_distdir=\"$$new_top_distdir\" \\\n\t        distdir=\"$$new_distdir\" \\\n\t\tam__remove_distdir=: \\\n\t\tam__skip_length_check=: \\\n\t\tam__skip_mode_fix=: \\\n\t        distdir) \\\n\t      || exit 1; \\\n\t  fi; \\\n\tdone\ncheck-am: all-am\ncheck: check-recursive\nall-am: Makefile\ninstalldirs: installdirs-recursive\ninstalldirs-am:\ninstall: install-recursive\ninstall-exec: install-exec-recursive\ninstall-data: install-data-recursive\nuninstall: uninstall-recursive\n\ninstall-am: all-am\n\t@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am\n\ninstallcheck: installcheck-recursive\ninstall-strip:\n\t$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM=\"$(INSTALL_STRIP_PROGRAM)\" \\\n\t  install_sh_PROGRAM=\"$(INSTALL_STRIP_PROGRAM)\" INSTALL_STRIP_FLAG=-s \\\n\t  `test -z '$(STRIP)' || \\\n\t    echo \"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'\"` install\nmostlyclean-generic:\n\nclean-generic:\n\ndistclean-generic:\n\t-test -z \"$(CONFIG_CLEAN_FILES)\" || rm -f $(CONFIG_CLEAN_FILES)\n\t-test . = \"$(srcdir)\" || test -z \"$(CONFIG_CLEAN_VPATH_FILES)\" || rm -f $(CONFIG_CLEAN_VPATH_FILES)\n\nmaintainer-clean-generic:\n\t@echo \"This command is intended for maintainers to use\"\n\t@echo \"it deletes files that may require special tools to rebuild.\"\nclean: clean-recursive\n\nclean-am: clean-generic clean-libtool mostlyclean-am\n\ndistclean: distclean-recursive\n\t-rm -f Makefile\ndistclean-am: clean-am distclean-generic distclean-tags\n\ndvi: dvi-recursive\n\ndvi-am:\n\nhtml: html-recursive\n\nhtml-am:\n\ninfo: info-recursive\n\ninfo-am:\n\ninstall-data-am:\n\ninstall-dvi: install-dvi-recursive\n\ninstall-dvi-am:\n\ninstall-exec-am:\n\ninstall-html: install-html-recursive\n\ninstall-html-am:\n\ninstall-info: install-info-recursive\n\ninstall-info-am:\n\ninstall-man:\n\ninstall-pdf: install-pdf-recursive\n\ninstall-pdf-am:\n\ninstall-ps: install-ps-recursive\n\ninstall-ps-am:\n\ninstallcheck-am:\n\nmaintainer-clean: maintainer-clean-recursive\n\t-rm -f Makefile\nmaintainer-clean-am: distclean-am maintainer-clean-generic\n\nmostlyclean: mostlyclean-recursive\n\nmostlyclean-am: mostlyclean-generic mostlyclean-libtool\n\npdf: pdf-recursive\n\npdf-am:\n\nps: ps-recursive\n\nps-am:\n\nuninstall-am:\n\n.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \\\n\tinstall-am install-strip tags-recursive\n\n.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \\\n\tall all-am check check-am clean clean-generic clean-libtool \\\n\tctags ctags-recursive distclean distclean-generic \\\n\tdistclean-libtool distclean-tags distdir dvi dvi-am html \\\n\thtml-am info info-am install install-am install-data \\\n\tinstall-data-am install-dvi install-dvi-am install-exec \\\n\tinstall-exec-am install-html install-html-am install-info \\\n\tinstall-info-am install-man install-pdf install-pdf-am \\\n\tinstall-ps install-ps-am install-strip installcheck \\\n\tinstallcheck-am installdirs installdirs-am maintainer-clean \\\n\tmaintainer-clean-generic mostlyclean mostlyclean-generic \\\n\tmostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \\\n\tuninstall uninstall-am\n\n\n# Tell versions [3.59,3.63) of GNU make to not export all variables.\n# Otherwise a system limit (for SysV at least) may be exceeded.\n.NOEXPORT:\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/README",
    "content": "This directory contains various contributions from libtiff users.\n\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/acorn/Makefile.acorn",
    "content": "# Project:   LibTIFF\n\n\n# Toolflags:\nCCflags = -c -zo -ffah -depend !Depend -IC:\nC++flags = -c -depend !Depend -IC: -throwback\nLinkflags = -aif -c++ -o $@\nDrLinkflags = -nounused -aif -c++ -o $@\nObjAsmflags = -throwback -NoCache -depend !Depend\nCMHGflags = \nLibFileflags = -c -o $@\nSqueezeflags = -o $@\n\n\n# Final targets:\n@.o.LIBTIFF:   \\\n        @.o.tif_acorn \\\n        @.o.tif_aux \\\n        @.o.tif_close \\\n        @.o.tif_codec \\\n\t@.o.tif_compress \\\n\t@.o.tif_dir \\\n\t@.o.tif_dirinfo \\\n\t@.o.tif_dirread \\\n\t@.o.tif_dirwrite \\\n\t@.o.tif_dumpmode \\\n\t@.o.tif_error \\\n\t@.o.tif_fax3 \\\n\t@.o.tif_flush \\\n\t@.o.tif_getimage \\\n\t@.o.tif_jpeg \\\n\t@.o.tif_lzw \\\n\t@.o.tif_next \\\n\t@.o.tif_open \\\n\t@.o.tif_packbits \\\n\t@.o.tif_predict \\\n\t@.o.tif_print \\\n\t@.o.tif_read \\\n\t@.o.tif_strip \\\n\t@.o.tif_swab \\\n\t@.o.tif_thunder \\\n\t@.o.tif_tile \\\n\t@.o.tif_version \\\n\t@.o.tif_warning \\\n\t@.o.tif_write \\\n\t@.o.tif_zip \\\n\t@.o.tif_fax3sm \\\n\t@.h.version \n\tLibFile $(LibFileflags) \\\n\t@.o.tif_acorn \\\n\t@.o.tif_aux \\\n\t@.o.tif_close \\\n\t@.o.tif_codec \\\n\t@.o.tif_compress \\\n\t@.o.tif_dir \\\n\t@.o.tif_dirinfo \\\n\t@.o.tif_dirread \\\n\t@.o.tif_dirwrite \\\n\t@.o.tif_dumpmode \\\n\t@.o.tif_error \\\n\t@.o.tif_fax3 \\\n\t@.o.tif_flush \\\n\t@.o.tif_getimage \\\n\t@.o.tif_jpeg \\\n\t@.o.tif_lzw \\\n\t@.o.tif_next \\\n\t@.o.tif_open \\\n\t@.o.tif_packbits \\\n\t@.o.tif_predict \\\n\t@.o.tif_print \\\n\t@.o.tif_read \\\n\t@.o.tif_strip \\\n\t@.o.tif_swab \\\n\t@.o.tif_thunder \\\n\t@.o.tif_tile \\\n\t@.o.tif_version \\\n\t@.o.tif_warning \\\n\t@.o.tif_write \\\n\t@.o.tif_zip \\\n\t@.o.tif_fax3sm \n\n\n# User-editable dependencies:\n@.mkversion:   @.o.mkversion C:o.Stubs \n\tLink $(linkflags) @.o.mkversion C:o.Stubs \n@.h.version:   @.VERSION @.mkversion \n\t<Prefix$Dir>.mkversion -v @.VERSION -a @.tiff/alpha @.h.version \n@.mkg3states:   @.o.mkg3states @.o.getopt C:o.Stubs \n\tlink $(linkflags) @.o.mkg3states C:o.Stubs @.o.getopt \n@.c.tif_fax3sm:   @.mkg3states \n\t<Prefix$Dir>.mkg3states -c const @.c.tif_fax3sm \n\n# Static dependencies:\n@.o.tif_acorn:   @.c.tif_acorn\n\tcc $(ccflags) -o @.o.tif_acorn @.c.tif_acorn \n@.o.tif_aux:   @.c.tif_aux\n\tcc $(ccflags) -o @.o.tif_aux @.c.tif_aux \n@.o.tif_close:   @.c.tif_close\n\tcc $(ccflags) -o @.o.tif_close @.c.tif_close \n@.o.tif_codec:   @.c.tif_codec\n\tcc $(ccflags) -o @.o.tif_codec @.c.tif_codec \n@.o.tif_compress:   @.c.tif_compress\n\tcc $(ccflags) -o @.o.tif_compress @.c.tif_compress \n@.o.tif_dir:   @.c.tif_dir\n\tcc $(ccflags) -o @.o.tif_dir @.c.tif_dir \n@.o.tif_dirinfo:   @.c.tif_dirinfo\n\tcc $(ccflags) -o @.o.tif_dirinfo @.c.tif_dirinfo \n@.o.tif_dirread:   @.c.tif_dirread\n\tcc $(ccflags) -o @.o.tif_dirread @.c.tif_dirread \n@.o.tif_dirwrite:   @.c.tif_dirwrite\n\tcc $(ccflags) -o @.o.tif_dirwrite @.c.tif_dirwrite \n@.o.tif_dumpmode:   @.c.tif_dumpmode\n\tcc $(ccflags) -o @.o.tif_dumpmode @.c.tif_dumpmode \n@.o.tif_error:   @.c.tif_error\n\tcc $(ccflags) -o @.o.tif_error @.c.tif_error \n@.o.tif_fax3:   @.c.tif_fax3\n\tcc $(ccflags) -o @.o.tif_fax3 @.c.tif_fax3 \n@.o.tif_flush:   @.c.tif_flush\n\tcc $(ccflags) -o @.o.tif_flush @.c.tif_flush \n@.o.tif_getimage:   @.c.tif_getimage\n\tcc $(ccflags) -o @.o.tif_getimage @.c.tif_getimage \n@.o.tif_jpeg:   @.c.tif_jpeg\n\tcc $(ccflags) -o @.o.tif_jpeg @.c.tif_jpeg \n@.o.tif_lzw:   @.c.tif_lzw\n\tcc $(ccflags) -o @.o.tif_lzw @.c.tif_lzw \n@.o.tif_next:   @.c.tif_next\n\tcc $(ccflags) -o @.o.tif_next @.c.tif_next \n@.o.tif_open:   @.c.tif_open\n\tcc $(ccflags) -o @.o.tif_open @.c.tif_open \n@.o.tif_packbits:   @.c.tif_packbits\n\tcc $(ccflags) -o @.o.tif_packbits @.c.tif_packbits \n@.o.tif_predict:   @.c.tif_predict\n\tcc $(ccflags) -o @.o.tif_predict @.c.tif_predict \n@.o.tif_print:   @.c.tif_print\n\tcc $(ccflags) -o @.o.tif_print @.c.tif_print \n@.o.tif_read:   @.c.tif_read\n\tcc $(ccflags) -o @.o.tif_read @.c.tif_read \n@.o.tif_strip:   @.c.tif_strip\n\tcc $(ccflags) -o @.o.tif_strip @.c.tif_strip \n@.o.tif_swab:   @.c.tif_swab\n\tcc $(ccflags) -o @.o.tif_swab @.c.tif_swab \n@.o.tif_thunder:   @.c.tif_thunder\n\tcc $(ccflags) -o @.o.tif_thunder @.c.tif_thunder \n@.o.tif_tile:   @.c.tif_tile\n\tcc $(ccflags) -o @.o.tif_tile @.c.tif_tile \n@.o.tif_version:   @.c.tif_version\n\tcc $(ccflags) -o @.o.tif_version @.c.tif_version \n@.o.tif_warning:   @.c.tif_warning\n\tcc $(ccflags) -o @.o.tif_warning @.c.tif_warning \n@.o.tif_write:   @.c.tif_write\n\tcc $(ccflags) -o @.o.tif_write @.c.tif_write \n@.o.tif_zip:   @.c.tif_zip\n\tcc $(ccflags) -o @.o.tif_zip @.c.tif_zip \n@.o.mkg3states:   @.c.mkg3states\n\tcc $(ccflags) -o @.o.mkg3states @.c.mkg3states \n@.o.getopt:   @.c.getopt\n\tcc $(ccflags) -o @.o.getopt @.c.getopt \n@.o.mkspans:   @.c.mkspans\n\tcc $(ccflags) -o @.o.mkspans @.c.mkspans \n@.o.tif_fax3sm:   @.c.tif_fax3sm\n\tcc $(ccflags) -o @.o.tif_fax3sm @.c.tif_fax3sm \n@.o.mkversion:   @.c.mkversion\n\tcc $(ccflags) -o @.o.mkversion @.c.mkversion \n\n# Dynamic dependencies:\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/acorn/Makefile.am",
    "content": "# Tag Image File Format (TIFF) Software\n#\n# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>\n#\n# Permission to use, copy, modify, distribute, and sell this software and \n# its documentation for any purpose is hereby granted without fee, provided\n# that (i) the above copyright notices and this permission notice appear in\n# all copies of the software and related documentation, and (ii) the names of\n# Sam Leffler and Silicon Graphics may not be used in any advertising or\n# publicity relating to the software without the specific, prior written\n# permission of Sam Leffler and Silicon Graphics.\n# \n# THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n# \n# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n# OF THIS SOFTWARE.\n\n# Process this file with automake to produce Makefile.in.\n\nEXTRA_DIST = Makefile.acorn ReadMe SetVars cleanlib convert install\n\nINCLUDES = -I../../libtiff -I$(top_srcdir)/libtiff\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/acorn/Makefile.in",
    "content": "# Makefile.in generated by automake 1.11 from Makefile.am.\n# @configure_input@\n\n# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,\n# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,\n# Inc.\n# This Makefile.in is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY, to the extent permitted by law; without\n# even the implied warranty of MERCHANTABILITY or FITNESS FOR A\n# PARTICULAR PURPOSE.\n\n@SET_MAKE@\n\n# Tag Image File Format (TIFF) Software\n#\n# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>\n#\n# Permission to use, copy, modify, distribute, and sell this software and \n# its documentation for any purpose is hereby granted without fee, provided\n# that (i) the above copyright notices and this permission notice appear in\n# all copies of the software and related documentation, and (ii) the names of\n# Sam Leffler and Silicon Graphics may not be used in any advertising or\n# publicity relating to the software without the specific, prior written\n# permission of Sam Leffler and Silicon Graphics.\n# \n# THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n# \n# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n# OF THIS SOFTWARE.\n\n# Process this file with automake to produce Makefile.in.\nVPATH = @srcdir@\npkgdatadir = $(datadir)/@PACKAGE@\npkgincludedir = $(includedir)/@PACKAGE@\npkglibdir = $(libdir)/@PACKAGE@\npkglibexecdir = $(libexecdir)/@PACKAGE@\nam__cd = CDPATH=\"$${ZSH_VERSION+.}$(PATH_SEPARATOR)\" && cd\ninstall_sh_DATA = $(install_sh) -c -m 644\ninstall_sh_PROGRAM = $(install_sh) -c\ninstall_sh_SCRIPT = $(install_sh) -c\nINSTALL_HEADER = $(INSTALL_DATA)\ntransform = $(program_transform_name)\nNORMAL_INSTALL = :\nPRE_INSTALL = :\nPOST_INSTALL = :\nNORMAL_UNINSTALL = :\nPRE_UNINSTALL = :\nPOST_UNINSTALL = :\nbuild_triplet = @build@\nhost_triplet = @host@\ntarget_triplet = @target@\nsubdir = contrib/acorn\nDIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in\nACLOCAL_M4 = $(top_srcdir)/aclocal.m4\nam__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \\\n\t$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \\\n\t$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \\\n\t$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac\nam__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \\\n\t$(ACLOCAL_M4)\nmkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs\nCONFIG_HEADER = $(top_builddir)/libtiff/tif_config.h \\\n\t$(top_builddir)/libtiff/tiffconf.h\nCONFIG_CLEAN_FILES =\nCONFIG_CLEAN_VPATH_FILES =\nAM_V_GEN = $(am__v_GEN_$(V))\nam__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))\nam__v_GEN_0 = @echo \"  GEN   \" $@;\nAM_V_at = $(am__v_at_$(V))\nam__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))\nam__v_at_0 = @\nSOURCES =\nDIST_SOURCES =\nDISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)\nACLOCAL = @ACLOCAL@\nAMTAR = @AMTAR@\nAM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@\nAR = @AR@\nAS = @AS@\nAUTOCONF = @AUTOCONF@\nAUTOHEADER = @AUTOHEADER@\nAUTOMAKE = @AUTOMAKE@\nAWK = @AWK@\nCC = @CC@\nCCDEPMODE = @CCDEPMODE@\nCFLAGS = @CFLAGS@\nCPP = @CPP@\nCPPFLAGS = @CPPFLAGS@\nCXX = @CXX@\nCXXCPP = @CXXCPP@\nCXXDEPMODE = @CXXDEPMODE@\nCXXFLAGS = @CXXFLAGS@\nCYGPATH_W = @CYGPATH_W@\nDEFS = @DEFS@\nDEPDIR = @DEPDIR@\nDLLTOOL = @DLLTOOL@\nDSYMUTIL = @DSYMUTIL@\nDUMPBIN = @DUMPBIN@\nECHO_C = @ECHO_C@\nECHO_N = @ECHO_N@\nECHO_T = @ECHO_T@\nEGREP = @EGREP@\nEXEEXT = @EXEEXT@\nFGREP = @FGREP@\nGLUT_CFLAGS = @GLUT_CFLAGS@\nGLUT_LIBS = @GLUT_LIBS@\nGLU_CFLAGS = @GLU_CFLAGS@\nGLU_LIBS = @GLU_LIBS@\nGL_CFLAGS = @GL_CFLAGS@\nGL_LIBS = @GL_LIBS@\nGREP = @GREP@\nINSTALL = @INSTALL@\nINSTALL_DATA = @INSTALL_DATA@\nINSTALL_PROGRAM = @INSTALL_PROGRAM@\nINSTALL_SCRIPT = @INSTALL_SCRIPT@\nINSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@\nLD = @LD@\nLDFLAGS = @LDFLAGS@\nLIBDIR = @LIBDIR@\nLIBOBJS = @LIBOBJS@\nLIBS = @LIBS@\nLIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@\nLIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@\nLIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@\nLIBTIFF_MICRO_VERSION = @LIBTIFF_MICRO_VERSION@\nLIBTIFF_MINOR_VERSION = @LIBTIFF_MINOR_VERSION@\nLIBTIFF_RELEASE_DATE = @LIBTIFF_RELEASE_DATE@\nLIBTIFF_VERSION = @LIBTIFF_VERSION@\nLIBTIFF_VERSION_INFO = @LIBTIFF_VERSION_INFO@\nLIBTOOL = @LIBTOOL@\nLIPO = @LIPO@\nLN_S = @LN_S@\nLTLIBOBJS = @LTLIBOBJS@\nMAINT = @MAINT@\nMAKEINFO = @MAKEINFO@\nMKDIR_P = @MKDIR_P@\nNM = @NM@\nNMEDIT = @NMEDIT@\nOBJDUMP = @OBJDUMP@\nOBJEXT = @OBJEXT@\nOTOOL = @OTOOL@\nOTOOL64 = @OTOOL64@\nPACKAGE = @PACKAGE@\nPACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@\nPACKAGE_NAME = @PACKAGE_NAME@\nPACKAGE_STRING = @PACKAGE_STRING@\nPACKAGE_TARNAME = @PACKAGE_TARNAME@\nPACKAGE_URL = @PACKAGE_URL@\nPACKAGE_VERSION = @PACKAGE_VERSION@\nPATH_SEPARATOR = @PATH_SEPARATOR@\nPTHREAD_CC = @PTHREAD_CC@\nPTHREAD_CFLAGS = @PTHREAD_CFLAGS@\nPTHREAD_LIBS = @PTHREAD_LIBS@\nRANLIB = @RANLIB@\nSED = @SED@\nSET_MAKE = @SET_MAKE@\nSHELL = @SHELL@\nSTRIP = @STRIP@\nVERSION = @VERSION@\nXMKMF = @XMKMF@\nX_CFLAGS = @X_CFLAGS@\nX_EXTRA_LIBS = @X_EXTRA_LIBS@\nX_LIBS = @X_LIBS@\nX_PRE_LIBS = @X_PRE_LIBS@\nabs_builddir = @abs_builddir@\nabs_srcdir = @abs_srcdir@\nabs_top_builddir = @abs_top_builddir@\nabs_top_srcdir = @abs_top_srcdir@\nac_ct_CC = @ac_ct_CC@\nac_ct_CXX = @ac_ct_CXX@\nac_ct_DUMPBIN = @ac_ct_DUMPBIN@\nacx_pthread_config = @acx_pthread_config@\nam__include = @am__include@\nam__leading_dot = @am__leading_dot@\nam__quote = @am__quote@\nam__tar = @am__tar@\nam__untar = @am__untar@\nbindir = @bindir@\nbuild = @build@\nbuild_alias = @build_alias@\nbuild_cpu = @build_cpu@\nbuild_os = @build_os@\nbuild_vendor = @build_vendor@\nbuilddir = @builddir@\ndatadir = @datadir@\ndatarootdir = @datarootdir@\ndocdir = @docdir@\ndvidir = @dvidir@\nexec_prefix = @exec_prefix@\nhost = @host@\nhost_alias = @host_alias@\nhost_cpu = @host_cpu@\nhost_os = @host_os@\nhost_vendor = @host_vendor@\nhtmldir = @htmldir@\nincludedir = @includedir@\ninfodir = @infodir@\ninstall_sh = @install_sh@\nlibdir = @libdir@\nlibexecdir = @libexecdir@\nlocaledir = @localedir@\nlocalstatedir = @localstatedir@\nlt_ECHO = @lt_ECHO@\nmandir = @mandir@\nmkdir_p = @mkdir_p@\noldincludedir = @oldincludedir@\npdfdir = @pdfdir@\nprefix = @prefix@\nprogram_transform_name = @program_transform_name@\npsdir = @psdir@\nsbindir = @sbindir@\nsharedstatedir = @sharedstatedir@\nsrcdir = @srcdir@\nsysconfdir = @sysconfdir@\ntarget = @target@\ntarget_alias = @target_alias@\ntarget_cpu = @target_cpu@\ntarget_os = @target_os@\ntarget_vendor = @target_vendor@\ntop_build_prefix = @top_build_prefix@\ntop_builddir = @top_builddir@\ntop_srcdir = @top_srcdir@\nEXTRA_DIST = Makefile.acorn ReadMe SetVars cleanlib convert install\nINCLUDES = -I../../libtiff -I$(top_srcdir)/libtiff\nall: all-am\n\n.SUFFIXES:\n$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)\n\t@for dep in $?; do \\\n\t  case '$(am__configure_deps)' in \\\n\t    *$$dep*) \\\n\t      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \\\n\t        && { if test -f $@; then exit 0; else break; fi; }; \\\n\t      exit 1;; \\\n\t  esac; \\\n\tdone; \\\n\techo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign contrib/acorn/Makefile'; \\\n\t$(am__cd) $(top_srcdir) && \\\n\t  $(AUTOMAKE) --foreign contrib/acorn/Makefile\n.PRECIOUS: Makefile\nMakefile: $(srcdir)/Makefile.in $(top_builddir)/config.status\n\t@case '$?' in \\\n\t  *config.status*) \\\n\t    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \\\n\t  *) \\\n\t    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \\\n\t    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \\\n\tesac;\n\n$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n\n$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n$(am__aclocal_m4_deps):\n\nmostlyclean-libtool:\n\t-rm -f *.lo\n\nclean-libtool:\n\t-rm -rf .libs _libs\ntags: TAGS\nTAGS:\n\nctags: CTAGS\nCTAGS:\n\n\ndistdir: $(DISTFILES)\n\t@srcdirstrip=`echo \"$(srcdir)\" | sed 's/[].[^$$\\\\*]/\\\\\\\\&/g'`; \\\n\ttopsrcdirstrip=`echo \"$(top_srcdir)\" | sed 's/[].[^$$\\\\*]/\\\\\\\\&/g'`; \\\n\tlist='$(DISTFILES)'; \\\n\t  dist_files=`for file in $$list; do echo $$file; done | \\\n\t  sed -e \"s|^$$srcdirstrip/||;t\" \\\n\t      -e \"s|^$$topsrcdirstrip/|$(top_builddir)/|;t\"`; \\\n\tcase $$dist_files in \\\n\t  */*) $(MKDIR_P) `echo \"$$dist_files\" | \\\n\t\t\t   sed '/\\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \\\n\t\t\t   sort -u` ;; \\\n\tesac; \\\n\tfor file in $$dist_files; do \\\n\t  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \\\n\t  if test -d $$d/$$file; then \\\n\t    dir=`echo \"/$$file\" | sed -e 's,/[^/]*$$,,'`; \\\n\t    if test -d \"$(distdir)/$$file\"; then \\\n\t      find \"$(distdir)/$$file\" -type d ! -perm -700 -exec chmod u+rwx {} \\;; \\\n\t    fi; \\\n\t    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \\\n\t      cp -fpR $(srcdir)/$$file \"$(distdir)$$dir\" || exit 1; \\\n\t      find \"$(distdir)/$$file\" -type d ! -perm -700 -exec chmod u+rwx {} \\;; \\\n\t    fi; \\\n\t    cp -fpR $$d/$$file \"$(distdir)$$dir\" || exit 1; \\\n\t  else \\\n\t    test -f \"$(distdir)/$$file\" \\\n\t    || cp -p $$d/$$file \"$(distdir)/$$file\" \\\n\t    || exit 1; \\\n\t  fi; \\\n\tdone\ncheck-am: all-am\ncheck: check-am\nall-am: Makefile\ninstalldirs:\ninstall: install-am\ninstall-exec: install-exec-am\ninstall-data: install-data-am\nuninstall: uninstall-am\n\ninstall-am: all-am\n\t@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am\n\ninstallcheck: installcheck-am\ninstall-strip:\n\t$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM=\"$(INSTALL_STRIP_PROGRAM)\" \\\n\t  install_sh_PROGRAM=\"$(INSTALL_STRIP_PROGRAM)\" INSTALL_STRIP_FLAG=-s \\\n\t  `test -z '$(STRIP)' || \\\n\t    echo \"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'\"` install\nmostlyclean-generic:\n\nclean-generic:\n\ndistclean-generic:\n\t-test -z \"$(CONFIG_CLEAN_FILES)\" || rm -f $(CONFIG_CLEAN_FILES)\n\t-test . = \"$(srcdir)\" || test -z \"$(CONFIG_CLEAN_VPATH_FILES)\" || rm -f $(CONFIG_CLEAN_VPATH_FILES)\n\nmaintainer-clean-generic:\n\t@echo \"This command is intended for maintainers to use\"\n\t@echo \"it deletes files that may require special tools to rebuild.\"\nclean: clean-am\n\nclean-am: clean-generic clean-libtool mostlyclean-am\n\ndistclean: distclean-am\n\t-rm -f Makefile\ndistclean-am: clean-am distclean-generic\n\ndvi: dvi-am\n\ndvi-am:\n\nhtml: html-am\n\nhtml-am:\n\ninfo: info-am\n\ninfo-am:\n\ninstall-data-am:\n\ninstall-dvi: install-dvi-am\n\ninstall-dvi-am:\n\ninstall-exec-am:\n\ninstall-html: install-html-am\n\ninstall-html-am:\n\ninstall-info: install-info-am\n\ninstall-info-am:\n\ninstall-man:\n\ninstall-pdf: install-pdf-am\n\ninstall-pdf-am:\n\ninstall-ps: install-ps-am\n\ninstall-ps-am:\n\ninstallcheck-am:\n\nmaintainer-clean: maintainer-clean-am\n\t-rm -f Makefile\nmaintainer-clean-am: distclean-am maintainer-clean-generic\n\nmostlyclean: mostlyclean-am\n\nmostlyclean-am: mostlyclean-generic mostlyclean-libtool\n\npdf: pdf-am\n\npdf-am:\n\nps: ps-am\n\nps-am:\n\nuninstall-am:\n\n.MAKE: install-am install-strip\n\n.PHONY: all all-am check check-am clean clean-generic clean-libtool \\\n\tdistclean distclean-generic distclean-libtool distdir dvi \\\n\tdvi-am html html-am info info-am install install-am \\\n\tinstall-data install-data-am install-dvi install-dvi-am \\\n\tinstall-exec install-exec-am install-html install-html-am \\\n\tinstall-info install-info-am install-man install-pdf \\\n\tinstall-pdf-am install-ps install-ps-am install-strip \\\n\tinstallcheck installcheck-am installdirs maintainer-clean \\\n\tmaintainer-clean-generic mostlyclean mostlyclean-generic \\\n\tmostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am\n\n\n# Tell versions [3.59,3.63) of GNU make to not export all variables.\n# Otherwise a system limit (for SysV at least) may be exceeded.\n.NOEXPORT:\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/acorn/ReadMe",
    "content": "Building the Software on an Acorn RISC OS system\n\nThe directory contrib/acorn contains support for compiling the library under\nAcorn C/C++ under Acorn's RISC OS 3.10 or above. Subsequent pathnames will\nuse the Acorn format: The full-stop or period character is a pathname\ndelimeter, and the slash character is not interpreted; the reverse position\nfrom Unix. Thus \"libtiff/tif_acorn.c\" becomes \"libtiff.tif_acorn/c\".\n\nThis support was contributed by Peter Greenham.\n(peterg@angmulti.demon.co.uk).\n\nInstalling LibTIFF:\n\nLIBTIFF uses several files which have names longer than the normal RISC OS\nmaximum of ten characters. This complicates matters. Maybe one day Acorn will\naddress the problem and implement long filenames properly. Until then this\ngets messy, especially as I'm trying to do this with obeyfiles and not have\nto include binaries in this distribution.\n\nFirst of all, ensure you have Truncate configured on (type *Configure\nTruncate On) Although it is, of course, preferable to have long filenames,\nLIBTIFF can be installed with short filenames, and it will compile and link\nwithout problems. However, getting it there is more problematic.\ncontrib.acorn.install is an installation obeyfile which will create a normal\nAcorn-style library from the source (ie: with c, h and o folders etc.), but\nneeds the distribution library to have been unpacked into a location which is\ncapable of supporting long filenames, even if only temporarily.\n\nMy recommendation, until Acorn address this problem properly, is to use Jason\nTribbeck's LongFilenames , or any other working system that gives you long\nfilenames, like a nearby NFS server for instance.\n\nIf you are using Longfilenames, even if only temporarily to install LIBTIFF,\nunpack the TAR into a RAMDisc which has been longfilenamed (ie: *addlongfs\nram) and then install from there to the hard disk. Unfortunately\nLongfilenames seems a bit unhappy about copying a bunch of long-named files\nacross the same filing system, but is happy going between systems. You'll\nneed to create a ramdisk of about 2Mb.\n\nNow you can run the installation script I've supplied (in contrib.acorn),\nwhich will automate the process of installing LIBTIFF as an Acorn-style\nlibrary. The syntax is as follows:\n\ninstall <source_dir> <dest_dir>\n\nInstall will then create <dest_dir> and put the library in there. For\nexample, having used LongFilenames on the RAMDisk and unpacked the library\ninto there, you can then type:\n\nObey RAM::RamDisc0.$.contrib.acorn.install RAM::RamDisc0.$ ADFS::4.$.LIBTIFF\n\nIt doesn't matter if the destination location can cope with long filenames or\nnot. The filenames will be truncated if necessary (*Configure Truncate On if\nyou get errors) and all will be well.\n\nCompiling LibTIFF:\n\nOnce the LibTIFF folder has been created and the files put inside, making the\nlibrary should be just a matter of running 'SetVars' to set the appropriate\nsystem variables, then running 'Makefile'.\n\nOSLib\n\nOSLib is a comprehensive API for RISC OS machines, written by Jonathan\nCoxhead of Acorn Computers (although OSLib is not an official Acorn product).\nUsing the OSLib SWI veneers produces code which is more compact and more\nefficient than code written using _kernel_swi or _swi. The Acorn port of\nLibTIFF can take advantage of this if present. Edit the Makefile and go to\nthe Static dependencies section. The first entry is:\n\n# Static dependencies:\n@.o.tif_acorn:   @.c.tif_acorn\n        cc $(ccflags) -o @.o.tif_acorn @.c.tif_acorn  \nChange the cc line to:\n\n        cc $(ccflags) -DINCLUDE_OSLIB -o @.o.tif_acorn @.c.tif_acorn  \n\nRemember, however, that OSLib is only recommended for efficiency's sake. It\nis not required.\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/acorn/SetVars",
    "content": "Set LibTIFF$Dir <Obey$Dir>\nSet LibTIFF$Path <LibTIFF$Dir>.\nSet C$Path <C$Path>,LibTIFF:\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/acorn/cleanlib",
    "content": "IfThere LibTIFF:o.* THEN Wipe LibTIFF:o.* ~CFR~V\nIfThere LibTIFF:c.tif_fax3sm THEN Delete LibTIFF:c.tif_fax3sm\nIfThere LibTIFF:mkg3states THEN Delete LibTIFF:mkg3states\nIfThere LibTIFF:h.version THEN Delete LibTIFF:h.version\nIfThere LibTIFF:mkversion THEN Delete LibTIFF:mkversion\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/acorn/convert",
    "content": "RISC OS Conversion log\n======================\n\nmkversion.c\n~~~~~~~~~~~\nThe RISC OS command-line does not allow the direct creation of the version.h\nfile in the proper manner. To remedy this in such a way that the version\nheader is made at compiletime, I wrote this small program. It is fully\nportable, so should work quite happily for any other platform that might need\nit.\n\nmsg3states.c\n~~~~~~~~~~~~\nNeeded getopt.c from the port folder, then compiled and worked fine.\n\n\ntiff.h\n~~~~~~\n\n====1====\n\nThe symbol _MIPS_SZLONG, if not defined, causes a compiler error. Fixed by\nensuring it does exist. This looks to me like this wouldn't be an\nAcorn-specific problem. The new code fragment is as follows:\n\n#ifndef _MIPS_SZLONG\n#define _MIPS_SZLONG 32\n#endif\n#if defined(__alpha) || _MIPS_SZLONG == 64\n\n\n\ntiffcomp.h\n~~~~~~~~~~\n\n====1====\n\n#if !defined(__MWERKS__) && !defined(THINK_C)\n#include <sys/types.h>\n#endif\n\nAcorn also doesn't have this header so:\n\n#if !defined(__MWERKS__) && !defined(THINK_C) && !defined(__acorn)\n#include <sys/types.h>\n#endif\n\n====2====\n\n#ifdef VMS\n#include <file.h>\n#include <unixio.h>\n#else\n#include <fcntl.h>\n#endif\n\nThis seems to indicate that fcntl.h is included on all systems except\nVMS. Odd, because I've never heard of it before. Sure it's in the ANSI\ndefinition? Anyway, following change:\n\n#ifdef VMS\n#include <file.h>\n#include <unixio.h>\n#else\n#ifndef __acorn\n#include <fcntl.h>\n#endif\n#endif\n\nThis will probably change when I find out what it wants from fcntl.h!\n\n====3====\n\n#if defined(__MWERKS__) || defined(THINK_C) || defined(applec)\n#include <stdlib.h>\n#define\tBSDTYPES\n#endif\n\nAdded RISC OS to above thus:\n\n#if defined(__MWERKS__) || defined(THINK_C) || defined(applec) || defined(__acorn)\n#include <stdlib.h>\n#define\tBSDTYPES\n#endif\n\n====4====\n\n/*\n * The library uses the ANSI C/POSIX SEEK_*\n * definitions that should be defined in unistd.h\n * (except on VMS where they are in stdio.h and\n * there is no unistd.h).\n */\n#ifndef SEEK_SET\n#if !defined(VMS) && !defined (applec) && !defined(THINK_C) && !defined(__MWERKS__)\n#include <unistd.h>\n#endif\n\nRISC OS is like VMS and Mac in this regard. So changed to:\n\n/*\n * The library uses the ANSI C/POSIX SEEK_*\n * definitions that should be defined in unistd.h\n * (except on VMS or the Mac or RISC OS, where they are in stdio.h and\n * there is no unistd.h).\n */\n#ifndef SEEK_SET\n#if !defined(VMS) && !defined (applec) && !defined(THINK_C) && !defined(__MWERKS__) && !defined(__acorn)\n#include <unistd.h>\n#endif\n#endif\n\n====5====\n\nNB: HAVE_IEEEFP is defined in tiffconf.h, not tiffcomp.h as mentioned\nin libtiff.README. (Note written on original port from 3.4beta004)\n\nAcorn C/C++ claims to accord with IEEE 754, so no change (yet) to\ntiffconf.h.\n\n====6====\n\nUnsure about whether this compiler supports inline functions. Will\nleave it on for the time being and see if it works! (Likely if\neverything else does.)\n\n... Seems to be OK ...\n\n====7====\n\nAdded to the end:\n\n/*\n * osfcn.h is part of C++Lib on Acorn C/C++, and as such can't be used\n * on C alone. For that reason, the relevant functions have been\n * implemented by myself in tif_acorn.c, and the elements from the header\n * included here.\n */\n\n#ifdef __acorn\n#ifdef __cplusplus\n#include <osfcn.h>\n#else\n#include \"kernel.h\"\n#define\tO_RDONLY\t0\n#define\tO_WRONLY\t1\n#define\tO_RDWR\t\t2\n#define\tO_APPEND\t8\n#define\tO_CREAT\t\t0x200\n#define\tO_TRUNC\t\t0x400\ntypedef long off_t;\nextern int open(const char *name, int flags, int mode);\nextern int close(int fd);\nextern int write(int fd, const char *buf, int nbytes);\nextern int read(int fd, char *buf, int nbytes);\nextern off_t lseek(int fd, off_t offset, int whence);\n#endif\n#endif\n\n\n===============================================================================\n\ntif_acorn.c\n~~~~~~~~~~~\n\nCreated file tif_acorn.c, copied initially from tif_unix.c\n\nDocumented internally where necessary.\n\nNote that I have implemented the low-level file-handling functions normally\nfound in osfcn.h in here, and put the header info at the bottom of\ntiffcomp.h. This is further documented from a RISC OS perspective inside the\nfile.\n\n===============================================================================\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/acorn/install",
    "content": "If \"%0\" = \"\" Then Error Syntax: install |<source_dir> |<dest_dir>\nIf \"%1\" = \"\" Then Error Syntax: install |<source_dir> |<dest_dir>\nSet LibTiffInstall$Dir %0\nSet LibTiff$Dir %1\nSet Alias$CPY Copy <LibTiffInstall$Dir>.%%0 <LibTiff$Dir>.%%1 ~C~DF~NRV\nCDir <LibTiff$Dir>\nCDir <LibTiff$Dir>.c\nCDir <LibTiff$Dir>.h\nCDir <LibTiff$Dir>.o\nCPY COPYRIGHT\t\t\tCOPYRIGHT\nCPY README\t\t\tREADME\nCPY VERSION\t\t\tVERSION\nCPY dist.tiff/alpha             tiff/alpha\nCPY contrib.acorn.SetVars\tSetVars\nCPY contrib.acorn.Makefile\tMakefile\nCPY contrib.acorn.cleanlib      cleanlib\nCPY port.getopt/c\t\tc.getopt\nCPY libtiff.mkg3states/c\tc.mkg3states\nCPY libtiff.mkspans/c\t\tc.mkspans\nCPY libtiff.mkversion/c\t\tc.mkversion\nCPY libtiff.tif_acorn/c\t\tc.tif_acorn\nCPY libtiff.tif_aux/c\t\tc.tif_aux\nCPY libtiff.tif_close/c\t\tc.tif_close\nCPY libtiff.tif_codec/c\t\tc.tif_codec\nCPY libtiff.tif_compress/c\tc.tif_compre\nCPY libtiff.tif_dir/c\t\tc.tif_dir\nCPY libtiff.tif_dirinfo/c\tc.tif_dirinf\nCPY libtiff.tif_dirread/c\tc.tif_dirrea\nCPY libtiff.tif_dirwrite/c\tc.tif_dirwri\nCPY libtiff.tif_dumpmode/c\tc.tif_dumpmo\nCPY libtiff.tif_error/c\t\tc.tif_error\nCPY libtiff.tif_fax3/c\t\tc.tif_fax3\nCPY libtiff.tif_flush/c\t\tc.tif_flush\nCPY libtiff.tif_getimage/c\tc.tif_getima\nCPY libtiff.tif_jpeg/c\t\tc.tif_jpeg\nCPY libtiff.tif_lzw/c\t\tc.tif_lzw\nCPY libtiff.tif_next/c\t\tc.tif_next\nCPY libtiff.tif_open/c\t\tc.tif_open\nCPY libtiff.tif_packbits/c\tc.tif_packbi\nCPY libtiff.tif_predict/c\tc.tif_predic\nCPY libtiff.tif_print/c\t\tc.tif_print\nCPY libtiff.tif_read/c\t\tc.tif_read\nCPY libtiff.tif_strip/c\t\tc.tif_strip\nCPY libtiff.tif_swab/c\t\tc.tif_swab\nCPY libtiff.tif_thunder/c\tc.tif_thunde\nCPY libtiff.tif_tile/c\t\tc.tif_tile\nCPY libtiff.tif_version/c\tc.tif_versio\nCPY libtiff.tif_warning/c\tc.tif_warnin\nCPY libtiff.tif_write/c\t\tc.tif_write\nCPY libtiff.tif_zip/c\t\tc.tif_zip\nCPY libtiff.t4/h\t\th.t4\nCPY libtiff.tiff/h\t\th.tiff\nCPY libtiff.tiffcomp/h\t\th.tiffcomp\nCPY libtiff.tiffconf/h\t\th.tiffconf\nCPY libtiff.tiffio/h\t\th.tiffio\nCPY libtiff.tiffiop/h\t\th.tiffiop\nCPY libtiff.tif_dir/h\t\th.tif_dir\nCPY libtiff.tif_fax3/h\t\th.tif_fax3\nCPY libtiff.tif_predict/h\th.tif_predic\nSetType <LibTiff$Dir>.COPYRIGHT\t\tText\nSetType <LibTiff$Dir>.README\t\tText\nSetType <LibTiff$Dir>.VERSION\t\tText\nSetType <LibTiff$Dir>.tiff/alpha        Text\nSetType <LibTiff$Dir>.SetVars\t\tObey\nSetType <LibTiff$Dir>.Makefile\t\tfe1\nSetType <LibTiff$Dir>.cleanlib          Obey\nSetType <LibTiff$Dir>.c.getopt\t\tText\nSetType <LibTiff$Dir>.c.mkg3states\tText\nSetType <LibTiff$Dir>.c.mkspans\t\tText\nSetType <LibTiff$Dir>.c.mkversion\tText\nSetType <LibTiff$Dir>.c.tif_acorn\tText\nSetType <LibTiff$Dir>.c.tif_aux\t\tText\nSetType <LibTiff$Dir>.c.tif_close\tText\nSetType <LibTiff$Dir>.c.tif_codec\tText\nSetType <LibTiff$Dir>.c.tif_compre\tText\nSetType <LibTiff$Dir>.c.tif_dir\t\tText\nSetType <LibTiff$Dir>.c.tif_dirinf\tText\nSetType <LibTiff$Dir>.c.tif_dirrea\tText\nSetType <LibTiff$Dir>.c.tif_dirwri\tText\nSetType <LibTiff$Dir>.c.tif_dumpmo\tText\nSetType <LibTiff$Dir>.c.tif_error\tText\nSetType <LibTiff$Dir>.c.tif_fax3\tText\nSetType <LibTiff$Dir>.c.tif_flush\tText\nSetType <LibTiff$Dir>.c.tif_getima\tText\nSetType <LibTiff$Dir>.c.tif_jpeg\tText\nSetType <LibTiff$Dir>.c.tif_lzw\t\tText\nSetType <LibTiff$Dir>.c.tif_next\tText\nSetType <LibTiff$Dir>.c.tif_open\tText\nSetType <LibTiff$Dir>.c.tif_packbi\tText\nSetType <LibTiff$Dir>.c.tif_predic\tText\nSetType <LibTiff$Dir>.c.tif_print\tText\nSetType <LibTiff$Dir>.c.tif_read\tText\nSetType <LibTiff$Dir>.c.tif_strip\tText\nSetType <LibTiff$Dir>.c.tif_swab\tText\nSetType <LibTiff$Dir>.c.tif_thunde\tText\nSetType <LibTiff$Dir>.c.tif_tile\tText\nSetType <LibTiff$Dir>.c.tif_versio\tText\nSetType <LibTiff$Dir>.c.tif_warnin\tText\nSetType <LibTiff$Dir>.c.tif_write\tText\nSetType <LibTiff$Dir>.c.tif_zip\t\tText\nSetType <LibTiff$Dir>.h.t4\t\tText\nSetType <LibTiff$Dir>.h.tiff\t\tText\nSetType <LibTiff$Dir>.h.tiffcomp\tText\nSetType <LibTiff$Dir>.h.tiffconf\tText\nSetType <LibTiff$Dir>.h.tiffio\t\tText\nSetType <LibTiff$Dir>.h.tiffiop\t\tText\nSetType <LibTiff$Dir>.h.tif_dir\t\tText\nSetType <LibTiff$Dir>.h.tif_fax3\tText\nSetType <LibTiff$Dir>.h.tif_predic\tText\nUnset Alias$CPY\nUnset LibTiffInstall$Dir\n| Now attempt to restore longfilename status. If it causes an error, OK.\nSet Alias$RN Rename <LibTiff$Dir>.%%0 <LibTiff$Dir>.%%1\nUnset LibTiff$Dir\nRN c.tif_compre c.tif_compress\nRN c.tif_dirinf c.tif_dirinfo\nRN c.tif_dirrea c.tif_dirread\nRN c.tif_dirwri c.tif_dirwrite\nRN c.tif_dumpmo c.tif_dumpmode\nRN c.tif_getima c.tif_getimage\nRN c.tif_packbi c.tif_packbits\nRN c.tif_predic c.tif_predict\nRN c.tif_thunde c.tif_thunder\nRN c.tif_versio c.tif_version\nRN c.tif_warnin c.tif_warning\nRN h.tif_predic h.tif_predict\nUnset Alias$RN\nEcho All done!\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/addtiffo/Makefile.am",
    "content": "# Tag Image File Format (TIFF) Software\n#\n# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>\n#\n# Permission to use, copy, modify, distribute, and sell this software and \n# its documentation for any purpose is hereby granted without fee, provided\n# that (i) the above copyright notices and this permission notice appear in\n# all copies of the software and related documentation, and (ii) the names of\n# Sam Leffler and Silicon Graphics may not be used in any advertising or\n# publicity relating to the software without the specific, prior written\n# permission of Sam Leffler and Silicon Graphics.\n# \n# THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n# \n# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n# OF THIS SOFTWARE.\n\n# Process this file with automake to produce Makefile.in.\n\nLIBTIFF = $(top_builddir)/libtiff/libtiff.la\n\nEXTRA_DIST = README Makefile.vc\n\nnoinst_PROGRAMS = addtiffo\n\naddtiffo_SOURCES = addtiffo.c tif_overview.c tif_ovrcache.c tif_ovrcache.h\naddtiffo_LDADD = $(LIBTIFF)\n\nINCLUDES = -I../../libtiff -I$(top_srcdir)/libtiff\n\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/addtiffo/Makefile.in",
    "content": "# Makefile.in generated by automake 1.11 from Makefile.am.\n# @configure_input@\n\n# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,\n# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,\n# Inc.\n# This Makefile.in is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY, to the extent permitted by law; without\n# even the implied warranty of MERCHANTABILITY or FITNESS FOR A\n# PARTICULAR PURPOSE.\n\n@SET_MAKE@\n\n# Tag Image File Format (TIFF) Software\n#\n# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>\n#\n# Permission to use, copy, modify, distribute, and sell this software and \n# its documentation for any purpose is hereby granted without fee, provided\n# that (i) the above copyright notices and this permission notice appear in\n# all copies of the software and related documentation, and (ii) the names of\n# Sam Leffler and Silicon Graphics may not be used in any advertising or\n# publicity relating to the software without the specific, prior written\n# permission of Sam Leffler and Silicon Graphics.\n# \n# THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n# \n# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n# OF THIS SOFTWARE.\n\n# Process this file with automake to produce Makefile.in.\n\nVPATH = @srcdir@\npkgdatadir = $(datadir)/@PACKAGE@\npkgincludedir = $(includedir)/@PACKAGE@\npkglibdir = $(libdir)/@PACKAGE@\npkglibexecdir = $(libexecdir)/@PACKAGE@\nam__cd = CDPATH=\"$${ZSH_VERSION+.}$(PATH_SEPARATOR)\" && cd\ninstall_sh_DATA = $(install_sh) -c -m 644\ninstall_sh_PROGRAM = $(install_sh) -c\ninstall_sh_SCRIPT = $(install_sh) -c\nINSTALL_HEADER = $(INSTALL_DATA)\ntransform = $(program_transform_name)\nNORMAL_INSTALL = :\nPRE_INSTALL = :\nPOST_INSTALL = :\nNORMAL_UNINSTALL = :\nPRE_UNINSTALL = :\nPOST_UNINSTALL = :\nbuild_triplet = @build@\nhost_triplet = @host@\ntarget_triplet = @target@\nnoinst_PROGRAMS = addtiffo$(EXEEXT)\nsubdir = contrib/addtiffo\nDIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in\nACLOCAL_M4 = $(top_srcdir)/aclocal.m4\nam__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \\\n\t$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \\\n\t$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \\\n\t$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac\nam__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \\\n\t$(ACLOCAL_M4)\nmkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs\nCONFIG_HEADER = $(top_builddir)/libtiff/tif_config.h \\\n\t$(top_builddir)/libtiff/tiffconf.h\nCONFIG_CLEAN_FILES =\nCONFIG_CLEAN_VPATH_FILES =\nPROGRAMS = $(noinst_PROGRAMS)\nam_addtiffo_OBJECTS = addtiffo.$(OBJEXT) tif_overview.$(OBJEXT) \\\n\ttif_ovrcache.$(OBJEXT)\naddtiffo_OBJECTS = $(am_addtiffo_OBJECTS)\naddtiffo_DEPENDENCIES = $(LIBTIFF)\nAM_V_lt = $(am__v_lt_$(V))\nam__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))\nam__v_lt_0 = --silent\nDEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/libtiff\ndepcomp = $(SHELL) $(top_srcdir)/config/depcomp\nam__depfiles_maybe = depfiles\nam__mv = mv -f\nCOMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \\\n\t$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)\nLTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \\\n\t$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \\\n\t$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \\\n\t$(AM_CFLAGS) $(CFLAGS)\nAM_V_CC = $(am__v_CC_$(V))\nam__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))\nam__v_CC_0 = @echo \"  CC    \" $@;\nAM_V_at = $(am__v_at_$(V))\nam__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))\nam__v_at_0 = @\nCCLD = $(CC)\nLINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \\\n\t$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \\\n\t$(AM_LDFLAGS) $(LDFLAGS) -o $@\nAM_V_CCLD = $(am__v_CCLD_$(V))\nam__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))\nam__v_CCLD_0 = @echo \"  CCLD  \" $@;\nAM_V_GEN = $(am__v_GEN_$(V))\nam__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))\nam__v_GEN_0 = @echo \"  GEN   \" $@;\nSOURCES = $(addtiffo_SOURCES)\nDIST_SOURCES = $(addtiffo_SOURCES)\nETAGS = etags\nCTAGS = ctags\nDISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)\nACLOCAL = @ACLOCAL@\nAMTAR = @AMTAR@\nAM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@\nAR = @AR@\nAS = @AS@\nAUTOCONF = @AUTOCONF@\nAUTOHEADER = @AUTOHEADER@\nAUTOMAKE = @AUTOMAKE@\nAWK = @AWK@\nCC = @CC@\nCCDEPMODE = @CCDEPMODE@\nCFLAGS = @CFLAGS@\nCPP = @CPP@\nCPPFLAGS = @CPPFLAGS@\nCXX = @CXX@\nCXXCPP = @CXXCPP@\nCXXDEPMODE = @CXXDEPMODE@\nCXXFLAGS = @CXXFLAGS@\nCYGPATH_W = @CYGPATH_W@\nDEFS = @DEFS@\nDEPDIR = @DEPDIR@\nDLLTOOL = @DLLTOOL@\nDSYMUTIL = @DSYMUTIL@\nDUMPBIN = @DUMPBIN@\nECHO_C = @ECHO_C@\nECHO_N = @ECHO_N@\nECHO_T = @ECHO_T@\nEGREP = @EGREP@\nEXEEXT = @EXEEXT@\nFGREP = @FGREP@\nGLUT_CFLAGS = @GLUT_CFLAGS@\nGLUT_LIBS = @GLUT_LIBS@\nGLU_CFLAGS = @GLU_CFLAGS@\nGLU_LIBS = @GLU_LIBS@\nGL_CFLAGS = @GL_CFLAGS@\nGL_LIBS = @GL_LIBS@\nGREP = @GREP@\nINSTALL = @INSTALL@\nINSTALL_DATA = @INSTALL_DATA@\nINSTALL_PROGRAM = @INSTALL_PROGRAM@\nINSTALL_SCRIPT = @INSTALL_SCRIPT@\nINSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@\nLD = @LD@\nLDFLAGS = @LDFLAGS@\nLIBDIR = @LIBDIR@\nLIBOBJS = @LIBOBJS@\nLIBS = @LIBS@\nLIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@\nLIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@\nLIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@\nLIBTIFF_MICRO_VERSION = @LIBTIFF_MICRO_VERSION@\nLIBTIFF_MINOR_VERSION = @LIBTIFF_MINOR_VERSION@\nLIBTIFF_RELEASE_DATE = @LIBTIFF_RELEASE_DATE@\nLIBTIFF_VERSION = @LIBTIFF_VERSION@\nLIBTIFF_VERSION_INFO = @LIBTIFF_VERSION_INFO@\nLIBTOOL = @LIBTOOL@\nLIPO = @LIPO@\nLN_S = @LN_S@\nLTLIBOBJS = @LTLIBOBJS@\nMAINT = @MAINT@\nMAKEINFO = @MAKEINFO@\nMKDIR_P = @MKDIR_P@\nNM = @NM@\nNMEDIT = @NMEDIT@\nOBJDUMP = @OBJDUMP@\nOBJEXT = @OBJEXT@\nOTOOL = @OTOOL@\nOTOOL64 = @OTOOL64@\nPACKAGE = @PACKAGE@\nPACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@\nPACKAGE_NAME = @PACKAGE_NAME@\nPACKAGE_STRING = @PACKAGE_STRING@\nPACKAGE_TARNAME = @PACKAGE_TARNAME@\nPACKAGE_URL = @PACKAGE_URL@\nPACKAGE_VERSION = @PACKAGE_VERSION@\nPATH_SEPARATOR = @PATH_SEPARATOR@\nPTHREAD_CC = @PTHREAD_CC@\nPTHREAD_CFLAGS = @PTHREAD_CFLAGS@\nPTHREAD_LIBS = @PTHREAD_LIBS@\nRANLIB = @RANLIB@\nSED = @SED@\nSET_MAKE = @SET_MAKE@\nSHELL = @SHELL@\nSTRIP = @STRIP@\nVERSION = @VERSION@\nXMKMF = @XMKMF@\nX_CFLAGS = @X_CFLAGS@\nX_EXTRA_LIBS = @X_EXTRA_LIBS@\nX_LIBS = @X_LIBS@\nX_PRE_LIBS = @X_PRE_LIBS@\nabs_builddir = @abs_builddir@\nabs_srcdir = @abs_srcdir@\nabs_top_builddir = @abs_top_builddir@\nabs_top_srcdir = @abs_top_srcdir@\nac_ct_CC = @ac_ct_CC@\nac_ct_CXX = @ac_ct_CXX@\nac_ct_DUMPBIN = @ac_ct_DUMPBIN@\nacx_pthread_config = @acx_pthread_config@\nam__include = @am__include@\nam__leading_dot = @am__leading_dot@\nam__quote = @am__quote@\nam__tar = @am__tar@\nam__untar = @am__untar@\nbindir = @bindir@\nbuild = @build@\nbuild_alias = @build_alias@\nbuild_cpu = @build_cpu@\nbuild_os = @build_os@\nbuild_vendor = @build_vendor@\nbuilddir = @builddir@\ndatadir = @datadir@\ndatarootdir = @datarootdir@\ndocdir = @docdir@\ndvidir = @dvidir@\nexec_prefix = @exec_prefix@\nhost = @host@\nhost_alias = @host_alias@\nhost_cpu = @host_cpu@\nhost_os = @host_os@\nhost_vendor = @host_vendor@\nhtmldir = @htmldir@\nincludedir = @includedir@\ninfodir = @infodir@\ninstall_sh = @install_sh@\nlibdir = @libdir@\nlibexecdir = @libexecdir@\nlocaledir = @localedir@\nlocalstatedir = @localstatedir@\nlt_ECHO = @lt_ECHO@\nmandir = @mandir@\nmkdir_p = @mkdir_p@\noldincludedir = @oldincludedir@\npdfdir = @pdfdir@\nprefix = @prefix@\nprogram_transform_name = @program_transform_name@\npsdir = @psdir@\nsbindir = @sbindir@\nsharedstatedir = @sharedstatedir@\nsrcdir = @srcdir@\nsysconfdir = @sysconfdir@\ntarget = @target@\ntarget_alias = @target_alias@\ntarget_cpu = @target_cpu@\ntarget_os = @target_os@\ntarget_vendor = @target_vendor@\ntop_build_prefix = @top_build_prefix@\ntop_builddir = @top_builddir@\ntop_srcdir = @top_srcdir@\nLIBTIFF = $(top_builddir)/libtiff/libtiff.la\nEXTRA_DIST = README Makefile.vc\naddtiffo_SOURCES = addtiffo.c tif_overview.c tif_ovrcache.c tif_ovrcache.h\naddtiffo_LDADD = $(LIBTIFF)\nINCLUDES = -I../../libtiff -I$(top_srcdir)/libtiff\nall: all-am\n\n.SUFFIXES:\n.SUFFIXES: .c .lo .o .obj\n$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)\n\t@for dep in $?; do \\\n\t  case '$(am__configure_deps)' in \\\n\t    *$$dep*) \\\n\t      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \\\n\t        && { if test -f $@; then exit 0; else break; fi; }; \\\n\t      exit 1;; \\\n\t  esac; \\\n\tdone; \\\n\techo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign contrib/addtiffo/Makefile'; \\\n\t$(am__cd) $(top_srcdir) && \\\n\t  $(AUTOMAKE) --foreign contrib/addtiffo/Makefile\n.PRECIOUS: Makefile\nMakefile: $(srcdir)/Makefile.in $(top_builddir)/config.status\n\t@case '$?' in \\\n\t  *config.status*) \\\n\t    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \\\n\t  *) \\\n\t    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \\\n\t    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \\\n\tesac;\n\n$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n\n$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n$(am__aclocal_m4_deps):\n\nclean-noinstPROGRAMS:\n\t@list='$(noinst_PROGRAMS)'; test -n \"$$list\" || exit 0; \\\n\techo \" rm -f\" $$list; \\\n\trm -f $$list || exit $$?; \\\n\ttest -n \"$(EXEEXT)\" || exit 0; \\\n\tlist=`for p in $$list; do echo \"$$p\"; done | sed 's/$(EXEEXT)$$//'`; \\\n\techo \" rm -f\" $$list; \\\n\trm -f $$list\naddtiffo$(EXEEXT): $(addtiffo_OBJECTS) $(addtiffo_DEPENDENCIES) \n\t@rm -f addtiffo$(EXEEXT)\n\t$(AM_V_CCLD)$(LINK) $(addtiffo_OBJECTS) $(addtiffo_LDADD) $(LIBS)\n\nmostlyclean-compile:\n\t-rm -f *.$(OBJEXT)\n\ndistclean-compile:\n\t-rm -f *.tab.c\n\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/addtiffo.Po@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_overview.Po@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_ovrcache.Po@am__quote@\n\n.c.o:\n@am__fastdepCC_TRUE@\t$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<\n@am__fastdepCC_TRUE@\t$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po\n@am__fastdepCC_FALSE@\t$(AM_V_CC) @AM_BACKSLASH@\n@AMDEP_TRUE@@am__fastdepCC_FALSE@\tsource='$<' object='$@' libtool=no @AMDEPBACKSLASH@\n@AMDEP_TRUE@@am__fastdepCC_FALSE@\tDEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@\n@am__fastdepCC_FALSE@\t$(COMPILE) -c $<\n\n.c.obj:\n@am__fastdepCC_TRUE@\t$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`\n@am__fastdepCC_TRUE@\t$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po\n@am__fastdepCC_FALSE@\t$(AM_V_CC) @AM_BACKSLASH@\n@AMDEP_TRUE@@am__fastdepCC_FALSE@\tsource='$<' object='$@' libtool=no @AMDEPBACKSLASH@\n@AMDEP_TRUE@@am__fastdepCC_FALSE@\tDEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@\n@am__fastdepCC_FALSE@\t$(COMPILE) -c `$(CYGPATH_W) '$<'`\n\n.c.lo:\n@am__fastdepCC_TRUE@\t$(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<\n@am__fastdepCC_TRUE@\t$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo\n@am__fastdepCC_FALSE@\t$(AM_V_CC) @AM_BACKSLASH@\n@AMDEP_TRUE@@am__fastdepCC_FALSE@\tsource='$<' object='$@' libtool=yes @AMDEPBACKSLASH@\n@AMDEP_TRUE@@am__fastdepCC_FALSE@\tDEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@\n@am__fastdepCC_FALSE@\t$(LTCOMPILE) -c -o $@ $<\n\nmostlyclean-libtool:\n\t-rm -f *.lo\n\nclean-libtool:\n\t-rm -rf .libs _libs\n\nID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)\n\tlist='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \\\n\tunique=`for i in $$list; do \\\n\t    if test -f \"$$i\"; then echo $$i; else echo $(srcdir)/$$i; fi; \\\n\t  done | \\\n\t  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \\\n\t      END { if (nonempty) { for (i in files) print i; }; }'`; \\\n\tmkid -fID $$unique\ntags: TAGS\n\nTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \\\n\t\t$(TAGS_FILES) $(LISP)\n\tset x; \\\n\there=`pwd`; \\\n\tlist='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \\\n\tunique=`for i in $$list; do \\\n\t    if test -f \"$$i\"; then echo $$i; else echo $(srcdir)/$$i; fi; \\\n\t  done | \\\n\t  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \\\n\t      END { if (nonempty) { for (i in files) print i; }; }'`; \\\n\tshift; \\\n\tif test -z \"$(ETAGS_ARGS)$$*$$unique\"; then :; else \\\n\t  test -n \"$$unique\" || unique=$$empty_fix; \\\n\t  if test $$# -gt 0; then \\\n\t    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \\\n\t      \"$$@\" $$unique; \\\n\t  else \\\n\t    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \\\n\t      $$unique; \\\n\t  fi; \\\n\tfi\nctags: CTAGS\nCTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \\\n\t\t$(TAGS_FILES) $(LISP)\n\tlist='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \\\n\tunique=`for i in $$list; do \\\n\t    if test -f \"$$i\"; then echo $$i; else echo $(srcdir)/$$i; fi; \\\n\t  done | \\\n\t  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \\\n\t      END { if (nonempty) { for (i in files) print i; }; }'`; \\\n\ttest -z \"$(CTAGS_ARGS)$$unique\" \\\n\t  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \\\n\t     $$unique\n\nGTAGS:\n\there=`$(am__cd) $(top_builddir) && pwd` \\\n\t  && $(am__cd) $(top_srcdir) \\\n\t  && gtags -i $(GTAGS_ARGS) \"$$here\"\n\ndistclean-tags:\n\t-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags\n\ndistdir: $(DISTFILES)\n\t@srcdirstrip=`echo \"$(srcdir)\" | sed 's/[].[^$$\\\\*]/\\\\\\\\&/g'`; \\\n\ttopsrcdirstrip=`echo \"$(top_srcdir)\" | sed 's/[].[^$$\\\\*]/\\\\\\\\&/g'`; \\\n\tlist='$(DISTFILES)'; \\\n\t  dist_files=`for file in $$list; do echo $$file; done | \\\n\t  sed -e \"s|^$$srcdirstrip/||;t\" \\\n\t      -e \"s|^$$topsrcdirstrip/|$(top_builddir)/|;t\"`; \\\n\tcase $$dist_files in \\\n\t  */*) $(MKDIR_P) `echo \"$$dist_files\" | \\\n\t\t\t   sed '/\\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \\\n\t\t\t   sort -u` ;; \\\n\tesac; \\\n\tfor file in $$dist_files; do \\\n\t  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \\\n\t  if test -d $$d/$$file; then \\\n\t    dir=`echo \"/$$file\" | sed -e 's,/[^/]*$$,,'`; \\\n\t    if test -d \"$(distdir)/$$file\"; then \\\n\t      find \"$(distdir)/$$file\" -type d ! -perm -700 -exec chmod u+rwx {} \\;; \\\n\t    fi; \\\n\t    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \\\n\t      cp -fpR $(srcdir)/$$file \"$(distdir)$$dir\" || exit 1; \\\n\t      find \"$(distdir)/$$file\" -type d ! -perm -700 -exec chmod u+rwx {} \\;; \\\n\t    fi; \\\n\t    cp -fpR $$d/$$file \"$(distdir)$$dir\" || exit 1; \\\n\t  else \\\n\t    test -f \"$(distdir)/$$file\" \\\n\t    || cp -p $$d/$$file \"$(distdir)/$$file\" \\\n\t    || exit 1; \\\n\t  fi; \\\n\tdone\ncheck-am: all-am\ncheck: check-am\nall-am: Makefile $(PROGRAMS)\ninstalldirs:\ninstall: install-am\ninstall-exec: install-exec-am\ninstall-data: install-data-am\nuninstall: uninstall-am\n\ninstall-am: all-am\n\t@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am\n\ninstallcheck: installcheck-am\ninstall-strip:\n\t$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM=\"$(INSTALL_STRIP_PROGRAM)\" \\\n\t  install_sh_PROGRAM=\"$(INSTALL_STRIP_PROGRAM)\" INSTALL_STRIP_FLAG=-s \\\n\t  `test -z '$(STRIP)' || \\\n\t    echo \"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'\"` install\nmostlyclean-generic:\n\nclean-generic:\n\ndistclean-generic:\n\t-test -z \"$(CONFIG_CLEAN_FILES)\" || rm -f $(CONFIG_CLEAN_FILES)\n\t-test . = \"$(srcdir)\" || test -z \"$(CONFIG_CLEAN_VPATH_FILES)\" || rm -f $(CONFIG_CLEAN_VPATH_FILES)\n\nmaintainer-clean-generic:\n\t@echo \"This command is intended for maintainers to use\"\n\t@echo \"it deletes files that may require special tools to rebuild.\"\nclean: clean-am\n\nclean-am: clean-generic clean-libtool clean-noinstPROGRAMS \\\n\tmostlyclean-am\n\ndistclean: distclean-am\n\t-rm -rf ./$(DEPDIR)\n\t-rm -f Makefile\ndistclean-am: clean-am distclean-compile distclean-generic \\\n\tdistclean-tags\n\ndvi: dvi-am\n\ndvi-am:\n\nhtml: html-am\n\nhtml-am:\n\ninfo: info-am\n\ninfo-am:\n\ninstall-data-am:\n\ninstall-dvi: install-dvi-am\n\ninstall-dvi-am:\n\ninstall-exec-am:\n\ninstall-html: install-html-am\n\ninstall-html-am:\n\ninstall-info: install-info-am\n\ninstall-info-am:\n\ninstall-man:\n\ninstall-pdf: install-pdf-am\n\ninstall-pdf-am:\n\ninstall-ps: install-ps-am\n\ninstall-ps-am:\n\ninstallcheck-am:\n\nmaintainer-clean: maintainer-clean-am\n\t-rm -rf ./$(DEPDIR)\n\t-rm -f Makefile\nmaintainer-clean-am: distclean-am maintainer-clean-generic\n\nmostlyclean: mostlyclean-am\n\nmostlyclean-am: mostlyclean-compile mostlyclean-generic \\\n\tmostlyclean-libtool\n\npdf: pdf-am\n\npdf-am:\n\nps: ps-am\n\nps-am:\n\nuninstall-am:\n\n.MAKE: install-am install-strip\n\n.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \\\n\tclean-libtool clean-noinstPROGRAMS ctags distclean \\\n\tdistclean-compile distclean-generic distclean-libtool \\\n\tdistclean-tags distdir dvi dvi-am html html-am info info-am \\\n\tinstall install-am install-data install-data-am install-dvi \\\n\tinstall-dvi-am install-exec install-exec-am install-html \\\n\tinstall-html-am install-info install-info-am install-man \\\n\tinstall-pdf install-pdf-am install-ps install-ps-am \\\n\tinstall-strip installcheck installcheck-am installdirs \\\n\tmaintainer-clean maintainer-clean-generic mostlyclean \\\n\tmostlyclean-compile mostlyclean-generic mostlyclean-libtool \\\n\tpdf pdf-am ps ps-am tags uninstall uninstall-am\n\n\n# Tell versions [3.59,3.63) of GNU make to not export all variables.\n# Otherwise a system limit (for SysV at least) may be exceeded.\n.NOEXPORT:\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/addtiffo/Makefile.vc",
    "content": "#\n# If libtiff.a is installed in /usr/lib or /usr/local/lib just point\n# LIBTIFF_DIR there.  It doesn't need a full libtiff tree.\n#\n!INCLUDE ..\\..\\nmake.opt\n\nLIBTIFF_DIR =\t..\\..\\libtiff\n#\nINCL\t\t= \t-I..\\..\\libtiff\nLIBS\t=\t$(LIBTIFF_DIR)\\libtiff.lib\n\naddtiffo:\taddtiffo.obj tif_overview.obj tif_ovrcache.obj\n\t$(CC) $(CFLAGS) addtiffo.obj tif_overview.obj tif_ovrcache.obj \\\n\t\t$(LIBS) /Feaddtiffo.exe\n\n\naddtiffo.obj:\taddtiffo.c\n\t$(CC) -c $(CFLAGS) addtiffo.c\n\ntif_overview.obj:\ttif_overview.c\n\t$(CC) -c $(CFLAGS) tif_overview.c\n\ntif_ovrcache.obj:\ttif_ovrcache.c\n\t$(CC) -c $(CFLAGS) tif_ovrcache.c\n\nclean:\n\t-del *.obj\n\t-del  addtiffo.exe\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/addtiffo/README",
    "content": "\taddtiffo 1.0\n\t============\n\nThe addtiffo utility is used to add overview pyramids to an existing \nTIFF or GeoTIFF file.  Some applications can take advantage of these\noverviews to accelerate overview display performance of large rasters. \n\nThis release of addtiffo is primarily intended for compatibility testing\nwith applications, and to see if there is interest in a cleaner release\nof the capability ... perhaps incorporation into the libtiff tools \ndistribution. \n\nPlease feel free to contact me with questions, or problems.\n\nwarmerda@home.com\nhttp://home.gdal.org/~warmerda/\n\n\nUsage\n-----\n\nUsage: addtiffo [-r {average/nearest} [-subifd] \n                tiff_filename [resolution_reductions]\n\nExample:\n % addtiffo abc.tif 2 4 8 16\n\nThe numeric arguments are the list of reduction factors to \ngenerate.  In this example a 1/2, 1/4 1/8 and 1/16 \n\n\n\nLimitations\n-----------\n\nSee tif_overview.cpp for up to date details. \n\n  o Currently only images with bits_per_sample of a multiple of eight\n    will work.\n\n  o The code will attempt to use the same kind of compression,\n    photometric interpretation, and organization as the source image, but\n    it doesn't copy geotiff tags to the reduced resolution images.\n\n  o Reduced resolution overviews for multi-sample files will currently\n    always be generated as PLANARCONFIG_SEPARATE.  This could be fixed\n    reasonable easily if needed to improve compatibility with other\n    packages.  Many don't properly support PLANARCONFIG_SEPARATE. \n\n  o Overviews are always written as appended IFDs, rather than using the\n    ``tree of tree's'' approach using the SUBIFD tag.  I wanted to implement\n    both, but it isn't currently easy to add a SUBIFD tag to an existing\n    main tiff IFD with libtiff.  I hope to try this again later. \n\n\nTIFF File Tags\n--------------\n\nThe results of running addtiffo on a 1024x1024 tiled greyscale file \nwith the arguments ``2 4 8 16'' is to add four additional TIFF directories\nappended on the file with the SUBFILETYPE flag to 0x1 indicating the extra\nitems are reduced resolution images. \n\nThe tiffinfo output of such a file might look like this:\n\nTIFF Directory at offset 0x118008\n  Image Width: 1024 Image Length: 1024\n  Tile Width: 256 Tile Length: 112\n  Bits/Sample: 8\n  Compression Scheme: none\n  Photometric Interpretation: min-is-black\n  Samples/Pixel: 1\n  Planar Configuration: single image plane\nTIFF Directory at offset 0x15e1d2\n  Subfile Type: reduced-resolution image (1 = 0x1)\n  Image Width: 512 Image Length: 512\n  Tile Width: 256 Tile Length: 112\n  Bits/Sample: 8\n  Compression Scheme: none\n  Photometric Interpretation: min-is-black\n  Samples/Pixel: 1\n  Planar Configuration: separate image planes\nTIFF Directory at offset 0x1732b8\n  Subfile Type: reduced-resolution image (1 = 0x1)\n  Image Width: 256 Image Length: 256\n  Tile Width: 256 Tile Length: 112\n  Bits/Sample: 8\n  Compression Scheme: none\n  Photometric Interpretation: min-is-black\n  Samples/Pixel: 1\n  Planar Configuration: separate image planes\nTIFF Directory at offset 0x17a366\n  Subfile Type: reduced-resolution image (1 = 0x1)\n  Image Width: 128 Image Length: 128\n  Tile Width: 128 Tile Length: 112\n  Bits/Sample: 8\n  Compression Scheme: none\n  Photometric Interpretation: min-is-black\n  Samples/Pixel: 1\n  Planar Configuration: separate image planes\nTIFF Directory at offset 0x17b40c\n  Subfile Type: reduced-resolution image (1 = 0x1)\n  Image Width: 64 Image Length: 64\n  Tile Width: 64 Tile Length: 64\n  Bits/Sample: 8\n  Compression Scheme: none\n  Photometric Interpretation: min-is-black\n  Samples/Pixel: 1\n  Planar Configuration: separate image planes\n\n\nBuilding\n--------\n\nYou will need a C compiler.  You will need to have libtiff already\nbuilt and installed.  The provided Makefile should work on most Unix systems.\nA similar file will be needed for Windows, but is not provided. \n\nThe CFLAGS and LIBS macros in the Makefile will have to be updated to \npoint to the correct location of the libtiff include files, and library.\n\n\nCredits\n-------\n\n o Intergraph Corporation for partially funding the work. \n\n o Global Geomatics for partially funding reorganization of the overview\n   building ability as a separate utility.\n\n o Orrin Long, and Ed Grissom of Intergraph for explaining what needed to \n   be done. \n\n o Max Martinez of Erdas for his discussion of external overviews. \n\n o Atlantis Scientific who supported adding averaging, and some other\n   generalizations. \n\n o Frank Warmerdam for writing the bulk of the code. \n\n o Sam Leffler since this only exists because of his libtiff. \n\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/addtiffo/addtiffo.c",
    "content": "/******************************************************************************\n * $Id: addtiffo.c,v 1.6 2005/12/16 05:59:55 fwarmerdam Exp $\n *\n * Project:  GeoTIFF Overview Builder\n * Purpose:  Mainline for building overviews in a TIFF file.\n * Author:   Frank Warmerdam, warmerdam@pobox.com\n *\n ******************************************************************************\n * Copyright (c) 1999, Frank Warmerdam\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included\n * in all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n ******************************************************************************\n *\n * $Log: addtiffo.c,v $\n * Revision 1.6  2005/12/16 05:59:55  fwarmerdam\n * Major upgrade to support YCbCr subsampled jpeg images\n *\n * Revision 1.4  2004/09/21 13:31:23  dron\n * Add missed include string.h.\n *\n * Revision 1.3  2000/04/18 22:48:31  warmerda\n * Added support for averaging resampling\n *\n * Revision 1.2  2000/01/28 15:36:38  warmerda\n * pass TIFF handle instead of filename to overview builder\n *\n * Revision 1.1  1999/08/17 01:47:59  warmerda\n * New\n *\n * Revision 1.1  1999/03/12 17:46:32  warmerda\n * New\n *\n * Revision 1.2  1999/02/11 22:27:12  warmerda\n * Added multi-sample support\n *\n * Revision 1.1  1999/02/11 18:12:30  warmerda\n * New\n */\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include \"tiffio.h\"\n\nvoid TIFFBuildOverviews( TIFF *, int, int *, int, const char *,\n                         int (*)(double,void*), void * );\n\n/************************************************************************/\n/*                                main()                                */\n/************************************************************************/\n\nint main( int argc, char ** argv )\n\n{\n    int\t\tanOverviews[100];   /* TODO: un-hardwire array length, flexible allocate */\n    int\t\tnOverviewCount = 0;\n    int\t\tbUseSubIFD = 0;\n    TIFF\t*hTIFF;\n    const char  *pszResampling = \"nearest\";\n\n/* -------------------------------------------------------------------- */\n/*      Usage:                                                          */\n/* -------------------------------------------------------------------- */\n    if( argc < 2 )\n    {\n        printf( \"Usage: addtiffo [-r {nearest,average,mode}]\\n\"\n                \"                tiff_filename [resolution_reductions]\\n\"\n                \"\\n\"\n                \"Example:\\n\"\n                \" %% addtiffo abc.tif 2 4 8 16\\n\" );\n        return( 1 );\n    }\n\n    while( argv[1][0] == '-' )\n    {\n        if( strcmp(argv[1],\"-subifd\") == 0 )\n        {\n            bUseSubIFD = 1;\n            argv++;\n            argc--;\n        }\n        else if( strcmp(argv[1],\"-r\") == 0 )\n        {\n            argv += 2;\n            argc -= 2;\n            pszResampling = *argv;\n        }\n        else\n        {\n            fprintf( stderr, \"Incorrect parameters\\n\" );\n            return( 1 );\n        }\n    }\n\n    /* TODO: resampling mode parameter needs to be encoded in an integer from this point on */\n\n/* -------------------------------------------------------------------- */\n/*      Collect the user requested reduction factors.                   */\n/* -------------------------------------------------------------------- */\n    while( nOverviewCount < argc - 2 && nOverviewCount < 100 )\n    {\n        anOverviews[nOverviewCount] = atoi(argv[nOverviewCount+2]);\n        if( anOverviews[nOverviewCount] <= 0)\n        {\n            fprintf( stderr, \"Incorrect parameters\\n\" );\n            return(1);\n        }\n        nOverviewCount++;\n    }\n\n/* -------------------------------------------------------------------- */\n/*      Default to four overview levels.  It would be nicer if it       */\n/*      defaulted based on the size of the source image.                */\n/* -------------------------------------------------------------------- */\n    /* TODO: make it default based on the size of the source image */\n    if( nOverviewCount == 0 )\n    {\n        nOverviewCount = 4;\n\n        anOverviews[0] = 2;\n        anOverviews[1] = 4;\n        anOverviews[2] = 8;\n        anOverviews[3] = 16;\n    }\n\n/* -------------------------------------------------------------------- */\n/*      Build the overview.                                             */\n/* -------------------------------------------------------------------- */\n    hTIFF = TIFFOpen( argv[1], \"r+\" );\n    if( hTIFF == NULL )\n    {\n        fprintf( stderr, \"TIFFOpen(%s) failed.\\n\", argv[1] );\n        return( 1 );\n    }\n\n    TIFFBuildOverviews( hTIFF, nOverviewCount, anOverviews, bUseSubIFD,\n                        pszResampling, NULL, NULL );\n\n    TIFFClose( hTIFF );\n\n/* -------------------------------------------------------------------- */\n/*      Optionally test for memory leaks.                               */\n/* -------------------------------------------------------------------- */\n#ifdef DBMALLOC\n    malloc_dump(1);\n#endif\n\n    return( 0 );\n}\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/addtiffo/tif_overview.c",
    "content": "/******************************************************************************\n * tif_overview.c,v 1.9 2005/05/25 09:03:16 dron Exp\n *\n * Project:  TIFF Overview Builder\n * Purpose:  Library function for building overviews in a TIFF file.\n * Author:   Frank Warmerdam, warmerdam@pobox.com\n *\n * Notes:\n *  o Currently only images with bits_per_sample of a multiple of eight\n *    will work.\n *\n *  o The downsampler currently just takes the top left pixel from the\n *    source rectangle.  Eventually sampling options of averaging, mode, and\n *    ``center pixel'' should be offered.\n *\n *  o The code will attempt to use the same kind of compression,\n *    photometric interpretation, and organization as the source image, but\n *    it doesn't copy geotiff tags to the reduced resolution images.\n *\n *  o Reduced resolution overviews for multi-sample files will currently\n *    always be generated as PLANARCONFIG_SEPARATE.  This could be fixed\n *    reasonable easily if needed to improve compatibility with other\n *    packages.  Many don't properly support PLANARCONFIG_SEPARATE. \n * \n ******************************************************************************\n * Copyright (c) 1999, Frank Warmerdam\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included\n * in all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n ******************************************************************************\n */\n\n/* TODO: update notes in header above */\n\n#include <stdio.h>\n#include <assert.h>\n#include <stdlib.h>\n#include <string.h>\n\n#include \"tiffio.h\"\n#include \"tif_ovrcache.h\"\n\n#ifndef FALSE\n#  define FALSE 0\n#  define TRUE 1\n#endif\n\n#ifndef MAX\n#  define MIN(a,b)      ((a<b) ? a : b)\n#  define MAX(a,b)      ((a>b) ? a : b)\n#endif\n\nvoid TIFFBuildOverviews( TIFF *, int, int *, int, const char *,\n                         int (*)(double,void*), void * );\n\n/************************************************************************/\n/*                         TIFF_WriteOverview()                         */\n/*                                                                      */\n/*      Create a new directory, without any image data for an overview. */\n/*      Returns offset of newly created overview directory, but the     */\n/*      current directory is reset to be the one in used when this      */\n/*      function is called.                                             */\n/************************************************************************/\n\nuint32 TIFF_WriteOverview( TIFF *hTIFF, int nXSize, int nYSize,\n                           int nBitsPerPixel, int nPlanarConfig, int nSamples, \n                           int nBlockXSize, int nBlockYSize,\n                           int bTiled, int nCompressFlag, int nPhotometric,\n                           int nSampleFormat,\n                           unsigned short *panRed,\n                           unsigned short *panGreen,\n                           unsigned short *panBlue,\n                           int bUseSubIFDs,\n                           int nHorSubsampling, int nVerSubsampling )\n\n{\n    uint32\tnBaseDirOffset;\n    uint32\tnOffset;\n\n    nBaseDirOffset = TIFFCurrentDirOffset( hTIFF );\n\n    TIFFCreateDirectory( hTIFF );\n\n/* -------------------------------------------------------------------- */\n/*      Setup TIFF fields.                                              */\n/* -------------------------------------------------------------------- */\n    TIFFSetField( hTIFF, TIFFTAG_IMAGEWIDTH, nXSize );\n    TIFFSetField( hTIFF, TIFFTAG_IMAGELENGTH, nYSize );\n    if( nSamples == 1 )\n        TIFFSetField( hTIFF, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG );\n    else\n        TIFFSetField( hTIFF, TIFFTAG_PLANARCONFIG, nPlanarConfig );\n\n    TIFFSetField( hTIFF, TIFFTAG_BITSPERSAMPLE, nBitsPerPixel );\n    TIFFSetField( hTIFF, TIFFTAG_SAMPLESPERPIXEL, nSamples );\n    TIFFSetField( hTIFF, TIFFTAG_COMPRESSION, nCompressFlag );\n    TIFFSetField( hTIFF, TIFFTAG_PHOTOMETRIC, nPhotometric );\n    TIFFSetField( hTIFF, TIFFTAG_SAMPLEFORMAT, nSampleFormat );\n\n    if( bTiled )\n    {\n        TIFFSetField( hTIFF, TIFFTAG_TILEWIDTH, nBlockXSize );\n        TIFFSetField( hTIFF, TIFFTAG_TILELENGTH, nBlockYSize );\n    }\n    else\n        TIFFSetField( hTIFF, TIFFTAG_ROWSPERSTRIP, nBlockYSize );\n\n    TIFFSetField( hTIFF, TIFFTAG_SUBFILETYPE, FILETYPE_REDUCEDIMAGE );\n\n    if( nPhotometric == PHOTOMETRIC_YCBCR || nPhotometric == PHOTOMETRIC_ITULAB )\n    {\n        TIFFSetField( hTIFF, TIFFTAG_YCBCRSUBSAMPLING, nHorSubsampling, nVerSubsampling);\n        /* TODO: also write YCbCrPositioning and YCbCrCoefficients tag identical to source IFD */\n    }\n    /* TODO: add command-line parameter for selecting jpeg compression quality\n     * that gets ignored when compression isn't jpeg */\n\n/* -------------------------------------------------------------------- */\n/*\tWrite color table if one is present.\t\t\t\t*/\n/* -------------------------------------------------------------------- */\n    if( panRed != NULL )\n    {\n        TIFFSetField( hTIFF, TIFFTAG_COLORMAP, panRed, panGreen, panBlue );\n    }\n\n/* -------------------------------------------------------------------- */\n/*      Write directory, and return byte offset.                        */\n/* -------------------------------------------------------------------- */\n    if( TIFFWriteCheck( hTIFF, bTiled, \"TIFFBuildOverviews\" ) == 0 )\n        return 0;\n\n    TIFFWriteDirectory( hTIFF );\n    TIFFSetDirectory( hTIFF, (tdir_t) (TIFFNumberOfDirectories(hTIFF)-1) );\n\n    nOffset = TIFFCurrentDirOffset( hTIFF );\n\n    TIFFSetSubDirectory( hTIFF, nBaseDirOffset );\n\n    return nOffset;\n}\n\n/************************************************************************/\n/*                       TIFF_GetSourceSamples()                        */\n/************************************************************************/\n\nstatic void \nTIFF_GetSourceSamples( double * padfSamples, unsigned char *pabySrc, \n                       int nPixelBytes, int nSampleFormat, \n                       int nXSize, int nYSize, \n                       int nPixelOffset, int nLineOffset )\n{\n    int  iXOff, iYOff, iSample;\n\n    iSample = 0;\n\n    for( iYOff = 0; iYOff < nYSize; iYOff++ )\n    {\n        for( iXOff = 0; iXOff < nXSize; iXOff++ )\n        {\n            unsigned char *pabyData;\n\n            pabyData = pabySrc + iYOff * nLineOffset + iXOff * nPixelOffset;\n\n            if( nSampleFormat == SAMPLEFORMAT_UINT && nPixelBytes == 1 )\n            {\n                padfSamples[iSample++] = *pabyData;\n            }\n            else if( nSampleFormat == SAMPLEFORMAT_UINT && nPixelBytes == 2 )\n            {\n                padfSamples[iSample++] = ((uint16 *) pabyData)[0];\n            }\n            else if( nSampleFormat == SAMPLEFORMAT_UINT && nPixelBytes == 4 )\n            {\n                padfSamples[iSample++] = ((uint32 *) pabyData)[0];\n            }\n            else if( nSampleFormat == SAMPLEFORMAT_INT && nPixelBytes == 2 )\n            {\n                padfSamples[iSample++] = ((int16 *) pabyData)[0];\n            }\n            else if( nSampleFormat == SAMPLEFORMAT_INT && nPixelBytes == 32 )\n            {\n                padfSamples[iSample++] = ((int32 *) pabyData)[0];\n            }\n            else if( nSampleFormat == SAMPLEFORMAT_IEEEFP && nPixelBytes == 4 )\n            {\n                padfSamples[iSample++] = ((float *) pabyData)[0];\n            }\n            else if( nSampleFormat == SAMPLEFORMAT_IEEEFP && nPixelBytes == 8 )\n            {\n                padfSamples[iSample++] = ((double *) pabyData)[0];\n            }\n        }\n    }\n} \n\n/************************************************************************/\n/*                           TIFF_SetSample()                           */\n/************************************************************************/\n\nstatic void \nTIFF_SetSample( unsigned char * pabyData, int nPixelBytes, int nSampleFormat, \n                double dfValue )\n\n{\n    if( nSampleFormat == SAMPLEFORMAT_UINT && nPixelBytes == 1 )\n    {\n        *pabyData = (unsigned char) MAX(0,MIN(255,dfValue));\n    }\n    else if( nSampleFormat == SAMPLEFORMAT_UINT && nPixelBytes == 2 )\n    {\n        *((uint16 *)pabyData) = (uint16) MAX(0,MIN(65535,dfValue));\n    }\n    else if( nSampleFormat == SAMPLEFORMAT_UINT && nPixelBytes == 4 )\n    {\n        *((uint32 *)pabyData) = (uint32) dfValue;\n    }\n    else if( nSampleFormat == SAMPLEFORMAT_INT && nPixelBytes == 2 )\n    {\n        *((int16 *)pabyData) = (int16) MAX(-32768,MIN(32767,dfValue));\n    }\n    else if( nSampleFormat == SAMPLEFORMAT_INT && nPixelBytes == 32 )\n    {\n        *((int32 *)pabyData) = (int32) dfValue;\n    }\n    else if( nSampleFormat == SAMPLEFORMAT_IEEEFP && nPixelBytes == 4 )\n    {\n        *((float *)pabyData) = (float) dfValue;\n    }\n    else if( nSampleFormat == SAMPLEFORMAT_IEEEFP && nPixelBytes == 8 )\n    {\n        *((double *)pabyData) = dfValue;\n    }\n}\n\n/************************************************************************/\n/*                          TIFF_DownSample()                           */\n/*                                                                      */\n/*      Down sample a tile of full res data into a window of a tile     */\n/*      of downsampled data.                                            */\n/************************************************************************/\n\nstatic\nvoid TIFF_DownSample( unsigned char *pabySrcTile,\n                      int nBlockXSize, int nBlockYSize,\n                      int nPixelSkewBits, int nBitsPerPixel,\n                      unsigned char * pabyOTile,\n                      int nOBlockXSize, int nOBlockYSize,\n                      int nTXOff, int nTYOff, int nOMult,\n                      int nSampleFormat, const char * pszResampling )\n\n{\n    int\t\ti, j, k, nPixelBytes = (nBitsPerPixel) / 8;\n    int\t\tnPixelGroupBytes = (nBitsPerPixel+nPixelSkewBits)/8;\n    unsigned char *pabySrc, *pabyDst;\n    double      *padfSamples;\n\n    assert( nBitsPerPixel >= 8 );\n\n    padfSamples = (double *) malloc(sizeof(double) * nOMult * nOMult);\n\n/* ==================================================================== */\n/*      Loop over scanline chunks to process, establishing where the    */\n/*      data is going.                                                  */\n/* ==================================================================== */\n    for( j = 0; j*nOMult < nBlockYSize; j++ )\n    {\n        if( j + nTYOff >= nOBlockYSize )\n            break;\n\n        pabyDst = pabyOTile + ((j+nTYOff)*nOBlockXSize + nTXOff)\n            * nPixelBytes * nPixelGroupBytes;\n\n/* -------------------------------------------------------------------- */\n/*      Handler nearest resampling ... we don't even care about the     */\n/*      data type, we just do a bytewise copy.                          */\n/* -------------------------------------------------------------------- */\n        if( strncmp(pszResampling,\"nearest\",4) == 0\n            || strncmp(pszResampling,\"NEAR\",4) == 0 )\n        {\n            pabySrc = pabySrcTile + j*nOMult*nBlockXSize * nPixelGroupBytes;\n\n            for( i = 0; i*nOMult < nBlockXSize; i++ )\n            {\n                if( i + nTXOff >= nOBlockXSize )\n                    break;\n            \n                /*\n                 * For now use simple subsampling, from the top left corner\n                 * of the source block of pixels.\n                 */\n\n                for( k = 0; k < nPixelBytes; k++ )\n                    pabyDst[k] = pabySrc[k];\n\n                pabyDst += nPixelBytes * nPixelGroupBytes;\n                pabySrc += nOMult * nPixelGroupBytes;\n            }\n        }\n\n/* -------------------------------------------------------------------- */\n/*      Handle the case of averaging.  For this we also have to         */\n/*      handle each sample format we are concerned with.                */\n/* -------------------------------------------------------------------- */\n        else if( strncmp(pszResampling,\"averag\",6) == 0\n                 || strncmp(pszResampling,\"AVERAG\",6) == 0 )\n        {\n            pabySrc = pabySrcTile + j*nOMult*nBlockXSize * nPixelGroupBytes;\n\n            for( i = 0; i*nOMult < nBlockXSize; i++ )\n            {\n                double   dfTotal;\n                int      iSample;\n                int      nXSize, nYSize;\n\n                if( i + nTXOff >= nOBlockXSize )\n                    break;\n\n                nXSize = MIN(nOMult,nBlockXSize-i);\n                nYSize = MIN(nOMult,nBlockYSize-j);\n\n                TIFF_GetSourceSamples( padfSamples, pabySrc,\n                                       nPixelBytes, nSampleFormat,\n                                       nXSize, nYSize,\n                                       nPixelGroupBytes,\n                                       nPixelGroupBytes * nBlockXSize );\n\n                dfTotal = 0;\n                for( iSample = 0; iSample < nXSize*nYSize; iSample++ )\n                {\n                    dfTotal += padfSamples[iSample];\n                }\n\n                TIFF_SetSample( pabyDst, nPixelBytes, nSampleFormat, \n                                dfTotal / (nXSize*nYSize) );\n\n                pabySrc += nOMult * nPixelGroupBytes;\n                pabyDst += nPixelBytes;\n            }\n        }\n    }\n\n    free( padfSamples );\n}\n\n/************************************************************************/\n/*                     TIFF_DownSample_Subsampled()                     */\n/************************************************************************/\nstatic\nvoid TIFF_DownSample_Subsampled( unsigned char *pabySrcTile, int nSample,\n                                 int nBlockXSize, int nBlockYSize,\n                                 unsigned char * pabyOTile,\n                                 int nOBlockXSize, int nOBlockYSize,\n                                 int nTXOff, int nTYOff, int nOMult,\n                                 const char * pszResampling,\n                                 int nHorSubsampling, int nVerSubsampling )\n{\n    /* TODO: test with variety of subsampling values, and incovinient tile/strip sizes */\n    int nSampleBlockSize;\n    int nSourceSampleRowSize;\n    int nDestSampleRowSize;\n    int nSourceX, nSourceY;\n    int nSourceXSec, nSourceYSec;\n    int nSourceXSecEnd, nSourceYSecEnd;\n    int nDestX, nDestY;\n    int nSampleOffsetInSampleBlock;\n    unsigned char * pSourceBase;\n    unsigned char * pDestBase;\n    int nSourceBaseInc;\n    unsigned char * pSourceBaseEnd;\n    unsigned int nCummulator;\n    unsigned int nCummulatorCount;\n\n    nSampleBlockSize = nHorSubsampling * nVerSubsampling + 2;\n    nSourceSampleRowSize = \n        ( ( nBlockXSize + nHorSubsampling - 1 ) / nHorSubsampling ) * nSampleBlockSize;\n    nDestSampleRowSize = \n        ( ( nOBlockXSize + nHorSubsampling - 1 ) / nHorSubsampling ) * nSampleBlockSize;\n\n    if( strncmp(pszResampling,\"nearest\",4) == 0\n        || strncmp(pszResampling,\"NEAR\",4) == 0 )\n    {\n    \tif( nSample == 0 )\n        {\n            for( nSourceY = 0, nDestY = nTYOff; \n                 nSourceY < nBlockYSize; \n                 nSourceY += nOMult, nDestY ++)\n            {\n                if( nDestY >= nOBlockYSize )\n                    break;\n\n                for( nSourceX = 0, nDestX = nTXOff; \n                     nSourceX < nBlockXSize; \n                     nSourceX += nOMult, nDestX ++)\n                {\n                    if( nDestX >= nOBlockXSize )\n                        break;\n\n                    * ( pabyOTile + ( nDestY / nVerSubsampling ) * nDestSampleRowSize\n                        + ( nDestY % nVerSubsampling ) * nHorSubsampling\n                        + ( nDestX / nHorSubsampling ) * nSampleBlockSize\n                        + ( nDestX % nHorSubsampling ) ) =\n                        * ( pabySrcTile + ( nSourceY / nVerSubsampling ) * nSourceSampleRowSize\n                            + ( nSourceY % nVerSubsampling ) * nHorSubsampling\n                            + ( nSourceX / nHorSubsampling ) * nSampleBlockSize\n                            + ( nSourceX % nHorSubsampling ) );\n                }\n            }\n        }\n        else\n        {\n            nSampleOffsetInSampleBlock = nHorSubsampling * nVerSubsampling + nSample - 1;\n            for( nSourceY = 0, nDestY = ( nTYOff / nVerSubsampling ); \n                 nSourceY < ( nBlockYSize / nVerSubsampling );\n                 nSourceY += nOMult, nDestY ++)\n            {\n                if( nDestY*nVerSubsampling >= nOBlockYSize )\n                    break;\n\n            \tfor( nSourceX = 0, nDestX = ( nTXOff / nHorSubsampling ); \n                     nSourceX < ( nBlockXSize / nHorSubsampling );\n                     nSourceX += nOMult, nDestX ++)\n                {\n                    if( nDestX*nHorSubsampling >= nOBlockXSize )\n                        break;\n\n                    * ( pabyOTile + nDestY * nDestSampleRowSize\n                        + nDestX * nSampleBlockSize\n                        + nSampleOffsetInSampleBlock ) =\n                    \t* ( pabySrcTile + nSourceY * nSourceSampleRowSize\n                            + nSourceX * nSampleBlockSize\n                            + nSampleOffsetInSampleBlock );\n                }\n            }\n        }\n    }\n    else if( strncmp(pszResampling,\"averag\",6) == 0\n             || strncmp(pszResampling,\"AVERAG\",6) == 0 )\n    {\n    \tif( nSample == 0 )\n        {\n            for( nSourceY = 0, nDestY = nTYOff; nSourceY < nBlockYSize; nSourceY += nOMult, nDestY ++)\n            {\n                if( nDestY >= nOBlockYSize )\n                    break;\n\n                for( nSourceX = 0, nDestX = nTXOff; nSourceX < nBlockXSize; nSourceX += nOMult, nDestX ++)\n                {\n                    if( nDestX >= nOBlockXSize )\n                        break;\n\n                    nSourceXSecEnd = nSourceX + nOMult;\n                    if( nSourceXSecEnd > nBlockXSize )\n                        nSourceXSecEnd = nBlockXSize;\n                    nSourceYSecEnd = nSourceY + nOMult;\n                    if( nSourceYSecEnd > nBlockYSize )\n                        nSourceYSecEnd = nBlockYSize;\n                    nCummulator = 0;\n                    for( nSourceYSec = nSourceY; nSourceYSec < nSourceYSecEnd; nSourceYSec ++)\n                    {\n                        for( nSourceXSec = nSourceX; nSourceXSec < nSourceXSecEnd; nSourceXSec ++)\n                        {\n                            nCummulator += * ( pabySrcTile + ( nSourceYSec / nVerSubsampling ) * nSourceSampleRowSize\n                                               + ( nSourceYSec % nVerSubsampling ) * nHorSubsampling\n                                               + ( nSourceXSec / nHorSubsampling ) * nSampleBlockSize\n                                               + ( nSourceXSec % nHorSubsampling ) );\n                        }\n                    }\n                    nCummulatorCount = ( nSourceXSecEnd - nSourceX ) * ( nSourceYSecEnd - nSourceY );\n                    * ( pabyOTile + ( nDestY / nVerSubsampling ) * nDestSampleRowSize\n                        + ( nDestY % nVerSubsampling ) * nHorSubsampling\n                        + ( nDestX / nHorSubsampling ) * nSampleBlockSize\n                        + ( nDestX % nHorSubsampling ) ) =\n                        ( ( nCummulator + ( nCummulatorCount >> 1 ) ) / nCummulatorCount );\n                }\n            }\n        }\n        else\n        {\n            nSampleOffsetInSampleBlock = nHorSubsampling * nVerSubsampling + nSample - 1;\n            for( nSourceY = 0, nDestY = ( nTYOff / nVerSubsampling ); nSourceY < ( nBlockYSize / nVerSubsampling );\n                 nSourceY += nOMult, nDestY ++)\n            {\n                if( nDestY*nVerSubsampling >= nOBlockYSize )\n                    break;\n\n                for( nSourceX = 0, nDestX = ( nTXOff / nHorSubsampling ); nSourceX < ( nBlockXSize / nHorSubsampling );\n                     nSourceX += nOMult, nDestX ++)\n                {\n                    if( nDestX*nHorSubsampling >= nOBlockXSize )\n                        break;\n\n                    nSourceXSecEnd = nSourceX + nOMult;\n                    if( nSourceXSecEnd > ( nBlockXSize / nHorSubsampling ) )\n                        nSourceXSecEnd = ( nBlockXSize / nHorSubsampling );\n                    nSourceYSecEnd = nSourceY + nOMult;\n                    if( nSourceYSecEnd > ( nBlockYSize / nVerSubsampling ) )\n                        nSourceYSecEnd = ( nBlockYSize / nVerSubsampling );\n                    nCummulator = 0;\n                    for( nSourceYSec = nSourceY; nSourceYSec < nSourceYSecEnd; nSourceYSec ++)\n                    {\n                        for( nSourceXSec = nSourceX; nSourceXSec < nSourceXSecEnd; nSourceXSec ++)\n                        {\n                            nCummulator += * ( pabySrcTile + nSourceYSec * nSourceSampleRowSize\n                                               + nSourceXSec * nSampleBlockSize\n                                               + nSampleOffsetInSampleBlock );\n                        }\n                    }\n                    nCummulatorCount = ( nSourceXSecEnd - nSourceX ) * ( nSourceYSecEnd - nSourceY );\n                    * ( pabyOTile + nDestY * nDestSampleRowSize\n                        + nDestX * nSampleBlockSize\n                        + nSampleOffsetInSampleBlock ) =\n                        ( ( nCummulator + ( nCummulatorCount >> 1 ) ) / nCummulatorCount );\n                }\n            }\n        }\n    }\n}\n\n/************************************************************************/\n/*                      TIFF_ProcessFullResBlock()                      */\n/*                                                                      */\n/*      Process one block of full res data, downsampling into each      */\n/*      of the overviews.                                               */\n/************************************************************************/\n\nvoid TIFF_ProcessFullResBlock( TIFF *hTIFF, int nPlanarConfig,\n                               int bSubsampled, int nHorSubsampling, int nVerSubsampling,\n                               int nOverviews, int * panOvList,\n                               int nBitsPerPixel,\n                               int nSamples, TIFFOvrCache ** papoRawBIs,\n                               int nSXOff, int nSYOff,\n                               unsigned char *pabySrcTile,\n                               int nBlockXSize, int nBlockYSize,\n                               int nSampleFormat, const char * pszResampling )\n    \n{\n    int\t\tiOverview, iSample;\n\n    for( iSample = 0; iSample < nSamples; iSample++ )\n    {\n        /*\n         * We have to read a tile/strip for each sample for\n         * PLANARCONFIG_SEPARATE.  Otherwise, we just read all the samples\n         * at once when handling the first sample.\n         */\n        if( nPlanarConfig == PLANARCONFIG_SEPARATE || iSample == 0 )\n        {\n            if( TIFFIsTiled(hTIFF) )\n            {\n                TIFFReadEncodedTile( hTIFF,\n                                     TIFFComputeTile(hTIFF, nSXOff, nSYOff,\n                                                     0, (tsample_t)iSample ),\n                                     pabySrcTile,\n                                     TIFFTileSize(hTIFF));\n            }\n            else\n            {\n                TIFFReadEncodedStrip( hTIFF,\n                                      TIFFComputeStrip(hTIFF, nSYOff,\n                                                       (tsample_t) iSample),\n                                      pabySrcTile,\n                                      TIFFStripSize(hTIFF) );\n            }\n        }\n\n        /*        \n         * Loop over destination overview layers\n         */\n        for( iOverview = 0; iOverview < nOverviews; iOverview++ )\n        {\n            TIFFOvrCache *poRBI = papoRawBIs[iOverview];\n            unsigned char *pabyOTile;\n            int\tnTXOff, nTYOff, nOXOff, nOYOff, nOMult;\n            int\tnOBlockXSize = poRBI->nBlockXSize;\n            int\tnOBlockYSize = poRBI->nBlockYSize;\n            int\tnSkewBits, nSampleByteOffset; \n\n            /*\n             * Fetch the destination overview tile\n             */\n            nOMult = panOvList[iOverview];\n            nOXOff = (nSXOff/nOMult) / nOBlockXSize;\n            nOYOff = (nSYOff/nOMult) / nOBlockYSize;\n\n            if( bSubsampled )\n            {\n                pabyOTile = TIFFGetOvrBlock_Subsampled( poRBI, nOXOff, nOYOff );\n\n                /*\n                 * Establish the offset into this tile at which we should\n                 * start placing data.\n                 */\n                nTXOff = (nSXOff - nOXOff*nOMult*nOBlockXSize) / nOMult;\n                nTYOff = (nSYOff - nOYOff*nOMult*nOBlockYSize) / nOMult;\n\n\n#ifdef DBMALLOC\n                malloc_chain_check( 1 );\n#endif\n                TIFF_DownSample_Subsampled( pabySrcTile, iSample,\n                                            nBlockXSize, nBlockYSize,\n                                            pabyOTile,\n                                            poRBI->nBlockXSize, poRBI->nBlockYSize,\n                                            nTXOff, nTYOff,\n                                            nOMult, pszResampling,\n                                            nHorSubsampling, nVerSubsampling );\n#ifdef DBMALLOC\n                malloc_chain_check( 1 );\n#endif\n\n            }\n            else\n            {\n\n                pabyOTile = TIFFGetOvrBlock( poRBI, nOXOff, nOYOff, iSample );\n\n                /*\n                 * Establish the offset into this tile at which we should\n                 * start placing data.\n                 */\n                nTXOff = (nSXOff - nOXOff*nOMult*nOBlockXSize) / nOMult;\n                nTYOff = (nSYOff - nOYOff*nOMult*nOBlockYSize) / nOMult;\n\n                /*\n                 * Figure out the skew (extra space between ``our samples'') and\n                 * the byte offset to the first sample.\n                 */\n                assert( (nBitsPerPixel % 8) == 0 );\n                if( nPlanarConfig == PLANARCONFIG_SEPARATE )\n                {\n                    nSkewBits = 0;\n                    nSampleByteOffset = 0;\n                }\n                else\n                {\n                    nSkewBits = nBitsPerPixel * (nSamples-1);\n                    nSampleByteOffset = (nBitsPerPixel/8) * iSample;\n                }\n\n                /*\n                 * Perform the downsampling.\n                 */\n#ifdef DBMALLOC\n                malloc_chain_check( 1 );\n#endif\n                TIFF_DownSample( pabySrcTile + nSampleByteOffset,\n                               nBlockXSize, nBlockYSize,\n                               nSkewBits, nBitsPerPixel, pabyOTile,\n                               poRBI->nBlockXSize, poRBI->nBlockYSize,\n                               nTXOff, nTYOff,\n                               nOMult, nSampleFormat, pszResampling );\n#ifdef DBMALLOC\n                malloc_chain_check( 1 );\n#endif\n            }\n        }\n    }\n}\n\n/************************************************************************/\n/*                        TIFF_BuildOverviews()                         */\n/*                                                                      */\n/*      Build the requested list of overviews.  Overviews are           */\n/*      maintained in a bunch of temporary files and then these are     */\n/*      written back to the TIFF file.  Only one pass through the       */\n/*      source TIFF file is made for any number of output               */\n/*      overviews.                                                      */\n/************************************************************************/\n\nvoid TIFFBuildOverviews( TIFF *hTIFF, int nOverviews, int * panOvList,\n                         int bUseSubIFDs, const char *pszResampleMethod,\n                         int (*pfnProgress)( double, void * ),\n                         void * pProgressData )\n\n{\n    TIFFOvrCache\t**papoRawBIs;\n    uint32\t\tnXSize, nYSize, nBlockXSize, nBlockYSize;\n    uint16\t\tnBitsPerPixel, nPhotometric, nCompressFlag, nSamples,\n        nPlanarConfig, nSampleFormat;\n    int         bSubsampled;\n    uint16      nHorSubsampling, nVerSubsampling;\n    int\t\t\tbTiled, nSXOff, nSYOff, i;\n    unsigned char\t*pabySrcTile;\n    uint16\t\t*panRedMap, *panGreenMap, *panBlueMap;\n    TIFFErrorHandler    pfnWarning;\n\n/* -------------------------------------------------------------------- */\n/*      Get the base raster size.                                       */\n/* -------------------------------------------------------------------- */\n    TIFFGetField( hTIFF, TIFFTAG_IMAGEWIDTH, &nXSize );\n    TIFFGetField( hTIFF, TIFFTAG_IMAGELENGTH, &nYSize );\n\n    TIFFGetField( hTIFF, TIFFTAG_BITSPERSAMPLE, &nBitsPerPixel );\n    /* TODO: nBitsPerPixel seems misnomer and may need renaming to nBitsPerSample */\n    TIFFGetField( hTIFF, TIFFTAG_SAMPLESPERPIXEL, &nSamples );\n    TIFFGetFieldDefaulted( hTIFF, TIFFTAG_PLANARCONFIG, &nPlanarConfig );\n\n    TIFFGetFieldDefaulted( hTIFF, TIFFTAG_PHOTOMETRIC, &nPhotometric );\n    TIFFGetFieldDefaulted( hTIFF, TIFFTAG_COMPRESSION, &nCompressFlag );\n    TIFFGetFieldDefaulted( hTIFF, TIFFTAG_SAMPLEFORMAT, &nSampleFormat );\n\n    if( nPhotometric == PHOTOMETRIC_YCBCR || nPhotometric == PHOTOMETRIC_ITULAB )\n    {\n        if( nBitsPerPixel != 8 || nSamples != 3 || nPlanarConfig != PLANARCONFIG_CONTIG ||\n            nSampleFormat != SAMPLEFORMAT_UINT)\n        {\n            /* TODO: use of TIFFError is inconsistent with use of fprintf in addtiffo.c, sort out */\n            TIFFErrorExt( TIFFClientdata(hTIFF), \"TIFFBuildOverviews\",\n                          \"File `%s' has an unsupported subsampling configuration.\\n\",\n                          TIFFFileName(hTIFF) );\n            /* If you need support for this particular flavor, please contact either\n             * Frank Warmerdam warmerdam@pobox.com\n             * Joris Van Damme info@awaresystems.be\n             */\n            return;\n        }\n        bSubsampled = 1;\n        TIFFGetField( hTIFF, TIFFTAG_YCBCRSUBSAMPLING, &nHorSubsampling, &nVerSubsampling );\n        /* TODO: find out if maybe TIFFGetFieldDefaulted is better choice for YCbCrSubsampling tag */\n    }\n    else\n    {\n        if( nBitsPerPixel < 8 )\n        {\n            /* TODO: use of TIFFError is inconsistent with use of fprintf in addtiffo.c, sort out */\n            TIFFErrorExt( TIFFClientdata(hTIFF), \"TIFFBuildOverviews\",\n                          \"File `%s' has samples of %d bits per sample.  Sample\\n\"\n                          \"sizes of less than 8 bits per sample are not supported.\\n\",\n                          TIFFFileName(hTIFF), nBitsPerPixel );\n            return;\n        }\n        bSubsampled = 0;\n        nHorSubsampling = 1;\n        nVerSubsampling = 1;\n    }\n\n/* -------------------------------------------------------------------- */\n/*      Turn off warnings to avoid alot of repeated warnings while      */\n/*      rereading directories.                                          */\n/* -------------------------------------------------------------------- */\n    pfnWarning = TIFFSetWarningHandler( NULL );\n\n/* -------------------------------------------------------------------- */\n/*      Get the base raster block size.                                 */\n/* -------------------------------------------------------------------- */\n    if( TIFFGetField( hTIFF, TIFFTAG_ROWSPERSTRIP, &(nBlockYSize) ) )\n    {\n        nBlockXSize = nXSize;\n        bTiled = FALSE;\n    }\n    else\n    {\n        TIFFGetField( hTIFF, TIFFTAG_TILEWIDTH, &nBlockXSize );\n        TIFFGetField( hTIFF, TIFFTAG_TILELENGTH, &nBlockYSize );\n        bTiled = TRUE;\n    }\n\n/* -------------------------------------------------------------------- */\n/*\tCapture the pallette if there is one.\t\t\t\t*/\n/* -------------------------------------------------------------------- */\n    if( TIFFGetField( hTIFF, TIFFTAG_COLORMAP,\n                      &panRedMap, &panGreenMap, &panBlueMap ) )\n    {\n        uint16\t\t*panRed2, *panGreen2, *panBlue2;\n        int             nColorCount = 1 << nBitsPerPixel;\n\n        panRed2 = (uint16 *) _TIFFmalloc(2*nColorCount);\n        panGreen2 = (uint16 *) _TIFFmalloc(2*nColorCount);\n        panBlue2 = (uint16 *) _TIFFmalloc(2*nColorCount);\n\n        memcpy( panRed2, panRedMap, 2 * nColorCount );\n        memcpy( panGreen2, panGreenMap, 2 * nColorCount );\n        memcpy( panBlue2, panBlueMap, 2 * nColorCount );\n\n        panRedMap = panRed2;\n        panGreenMap = panGreen2;\n        panBlueMap = panBlue2;\n    }\n    else\n    {\n        panRedMap = panGreenMap = panBlueMap = NULL;\n    }\n\n/* -------------------------------------------------------------------- */\n/*      Initialize overviews.                                           */\n/* -------------------------------------------------------------------- */\n    papoRawBIs = (TIFFOvrCache **) _TIFFmalloc(nOverviews*sizeof(void*));\n\n    for( i = 0; i < nOverviews; i++ )\n    {\n        int\tnOXSize, nOYSize, nOBlockXSize, nOBlockYSize;\n        uint32  nDirOffset;\n\n        nOXSize = (nXSize + panOvList[i] - 1) / panOvList[i];\n        nOYSize = (nYSize + panOvList[i] - 1) / panOvList[i];\n\n        nOBlockXSize = MIN((int)nBlockXSize,nOXSize);\n        nOBlockYSize = MIN((int)nBlockYSize,nOYSize);\n\n        if( bTiled )\n        {\n            if( (nOBlockXSize % 16) != 0 )\n                nOBlockXSize = nOBlockXSize + 16 - (nOBlockXSize % 16);\n\n            if( (nOBlockYSize % 16) != 0 )\n                nOBlockYSize = nOBlockYSize + 16 - (nOBlockYSize % 16);\n        }\n\n        nDirOffset = TIFF_WriteOverview( hTIFF, nOXSize, nOYSize,\n                                         nBitsPerPixel, nPlanarConfig,\n                                         nSamples, nOBlockXSize, nOBlockYSize,\n                                         bTiled, nCompressFlag, nPhotometric,\n                                         nSampleFormat,\n                                         panRedMap, panGreenMap, panBlueMap,\n                                         bUseSubIFDs,\n                                         nHorSubsampling, nVerSubsampling );\n        \n        papoRawBIs[i] = TIFFCreateOvrCache( hTIFF, nDirOffset );\n    }\n\n    if( panRedMap != NULL )\n    {\n        _TIFFfree( panRedMap );\n        _TIFFfree( panGreenMap );\n        _TIFFfree( panBlueMap );\n    }\n    \n/* -------------------------------------------------------------------- */\n/*      Allocate a buffer to hold a source block.                       */\n/* -------------------------------------------------------------------- */\n    if( bTiled )\n        pabySrcTile = (unsigned char *) _TIFFmalloc(TIFFTileSize(hTIFF));\n    else\n        pabySrcTile = (unsigned char *) _TIFFmalloc(TIFFStripSize(hTIFF));\n    \n/* -------------------------------------------------------------------- */\n/*      Loop over the source raster, applying data to the               */\n/*      destination raster.                                             */\n/* -------------------------------------------------------------------- */\n    for( nSYOff = 0; nSYOff < (int) nYSize; nSYOff += nBlockYSize )\n    {\n        for( nSXOff = 0; nSXOff < (int) nXSize; nSXOff += nBlockXSize )\n        {\n            /*\n             * Read and resample into the various overview images.\n             */\n            \n            TIFF_ProcessFullResBlock( hTIFF, nPlanarConfig,\n                                      bSubsampled,nHorSubsampling,nVerSubsampling,\n                                      nOverviews, panOvList,\n                                      nBitsPerPixel, nSamples, papoRawBIs,\n                                      nSXOff, nSYOff, pabySrcTile,\n                                      nBlockXSize, nBlockYSize,\n                                      nSampleFormat, pszResampleMethod );\n        }\n    }\n\n    _TIFFfree( pabySrcTile );\n\n/* -------------------------------------------------------------------- */\n/*      Cleanup the rawblockedimage files.                              */\n/* -------------------------------------------------------------------- */\n    for( i = 0; i < nOverviews; i++ )\n    {\n        TIFFDestroyOvrCache( papoRawBIs[i] );\n    }\n\n    if( papoRawBIs != NULL )\n        _TIFFfree( papoRawBIs );\n\n    TIFFSetWarningHandler( pfnWarning );\n}\n\n\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/addtiffo/tif_ovrcache.c",
    "content": "/******************************************************************************\n * $Id: tif_ovrcache.c,v 1.7 2006/03/25 17:52:37 joris Exp $\n *\n * Project:  TIFF Overview Builder\n * Purpose:  Library functions to maintain two rows of tiles or two strips\n *           of data for output overviews as an output cache. \n * Author:   Frank Warmerdam, warmerdam@pobox.com\n *\n ******************************************************************************\n * Copyright (c) 2000, Frank Warmerdam\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included\n * in all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n ******************************************************************************\n */\n\n#include \"tiffiop.h\"\n#include \"tif_ovrcache.h\"\n#include <assert.h>\n\n/************************************************************************/\n/*                         TIFFCreateOvrCache()                         */\n/*                                                                      */\n/*      Create an overview cache to hold two rows of blocks from an     */\n/*      existing TIFF directory.                                        */\n/************************************************************************/\n\nTIFFOvrCache *TIFFCreateOvrCache( TIFF *hTIFF, int nDirOffset )\n\n{\n    TIFFOvrCache\t*psCache;\n    uint32\t\tnBaseDirOffset;\n\n    psCache = (TIFFOvrCache *) _TIFFmalloc(sizeof(TIFFOvrCache));\n    psCache->nDirOffset = nDirOffset;\n    psCache->hTIFF = hTIFF;\n    \n/* -------------------------------------------------------------------- */\n/*      Get definition of this raster from the TIFF file itself.        */\n/* -------------------------------------------------------------------- */\n    nBaseDirOffset = TIFFCurrentDirOffset( psCache->hTIFF );\n    TIFFSetSubDirectory( hTIFF, nDirOffset );\n    \n    TIFFGetField( hTIFF, TIFFTAG_IMAGEWIDTH, &(psCache->nXSize) );\n    TIFFGetField( hTIFF, TIFFTAG_IMAGELENGTH, &(psCache->nYSize) );\n\n    TIFFGetField( hTIFF, TIFFTAG_BITSPERSAMPLE, &(psCache->nBitsPerPixel) );\n    TIFFGetField( hTIFF, TIFFTAG_SAMPLESPERPIXEL, &(psCache->nSamples) );\n    TIFFGetField( hTIFF, TIFFTAG_PLANARCONFIG, &(psCache->nPlanarConfig) );\n\n    if( !TIFFIsTiled( hTIFF ) )\n    {\n        TIFFGetField( hTIFF, TIFFTAG_ROWSPERSTRIP, &(psCache->nBlockYSize) );\n        psCache->nBlockXSize = psCache->nXSize;\n        psCache->nBytesPerBlock = TIFFStripSize(hTIFF);\n        psCache->bTiled = FALSE;\n    }\n    else\n    {\n        TIFFGetField( hTIFF, TIFFTAG_TILEWIDTH, &(psCache->nBlockXSize) );\n        TIFFGetField( hTIFF, TIFFTAG_TILELENGTH, &(psCache->nBlockYSize) );\n        psCache->nBytesPerBlock = TIFFTileSize(hTIFF);\n        psCache->bTiled = TRUE;\n    }\n\n/* -------------------------------------------------------------------- */\n/*      Compute some values from this.                                  */\n/* -------------------------------------------------------------------- */\n\n    psCache->nBlocksPerRow = (psCache->nXSize + psCache->nBlockXSize - 1)\n        \t\t/ psCache->nBlockXSize;\n    psCache->nBlocksPerColumn = (psCache->nYSize + psCache->nBlockYSize - 1)\n        \t\t/ psCache->nBlockYSize;\n\n    if (psCache->nPlanarConfig == PLANARCONFIG_SEPARATE)\n        psCache->nBytesPerRow = psCache->nBytesPerBlock\n            * psCache->nBlocksPerRow * psCache->nSamples;\n    else\n        psCache->nBytesPerRow =\n            psCache->nBytesPerBlock * psCache->nBlocksPerRow;\n\n\n/* -------------------------------------------------------------------- */\n/*      Allocate and initialize the data buffers.                       */\n/* -------------------------------------------------------------------- */\n\n    psCache->pabyRow1Blocks =\n        (unsigned char *) _TIFFmalloc(psCache->nBytesPerRow);\n    psCache->pabyRow2Blocks =\n        (unsigned char *) _TIFFmalloc(psCache->nBytesPerRow);\n\n    if( psCache->pabyRow1Blocks == NULL\n        || psCache->pabyRow2Blocks == NULL )\n    {\n\t\tTIFFErrorExt( hTIFF->tif_clientdata, hTIFF->tif_name,\n\t\t\t\t\t  \"Can't allocate memory for overview cache.\" );\n        /* TODO: use of TIFFError is inconsistent with use of fprintf in addtiffo.c, sort out */\n        return NULL;\n    }\n\n    _TIFFmemset( psCache->pabyRow1Blocks, 0, psCache->nBytesPerRow );\n    _TIFFmemset( psCache->pabyRow2Blocks, 0, psCache->nBytesPerRow );\n\n    psCache->nBlockOffset = 0;\n\n    TIFFSetSubDirectory( psCache->hTIFF, nBaseDirOffset );\n    \n    return psCache;\n}\n\n/************************************************************************/\n/*                          TIFFWriteOvrRow()                           */\n/*                                                                      */\n/*      Write one entire row of blocks (row 1) to the tiff file, and    */\n/*      then rotate the block buffers, essentially moving things        */\n/*      down by one block.                                              */\n/************************************************************************/\n\nstatic void TIFFWriteOvrRow( TIFFOvrCache * psCache )\n\n{\n    int\t\tnRet, iTileX, iTileY = psCache->nBlockOffset;\n    unsigned char *pabyData;\n    uint32\tnBaseDirOffset;\n    uint32 RowsInStrip;\n\n/* -------------------------------------------------------------------- */\n/*      If the output cache is multi-byte per sample, and the file      */\n/*      being written to is of a different byte order than the current  */\n/*      platform, we will need to byte swap the data.                   */\n/* -------------------------------------------------------------------- */\n    if( TIFFIsByteSwapped(psCache->hTIFF) )\n    {\n        if( psCache->nBitsPerPixel == 16 )\n            TIFFSwabArrayOfShort( (uint16 *) psCache->pabyRow1Blocks,\n                      (psCache->nBytesPerBlock * psCache->nSamples) / 2 );\n\n        else if( psCache->nBitsPerPixel == 32 )\n            TIFFSwabArrayOfLong( (uint32 *) psCache->pabyRow1Blocks,\n                         (psCache->nBytesPerBlock * psCache->nSamples) / 4 );\n\n        else if( psCache->nBitsPerPixel == 64 )\n            TIFFSwabArrayOfDouble( (double *) psCache->pabyRow1Blocks,\n                         (psCache->nBytesPerBlock * psCache->nSamples) / 8 );\n    }\n\n/* -------------------------------------------------------------------- */\n/*      Record original directory position, so we can restore it at     */\n/*      end.                                                            */\n/* -------------------------------------------------------------------- */\n    nBaseDirOffset = TIFFCurrentDirOffset( psCache->hTIFF );\n    nRet = TIFFSetSubDirectory( psCache->hTIFF, psCache->nDirOffset );\n    assert( nRet == 1 );\n\n/* -------------------------------------------------------------------- */\n/*      Write blocks to TIFF file.                                      */\n/* -------------------------------------------------------------------- */\n\tfor( iTileX = 0; iTileX < psCache->nBlocksPerRow; iTileX++ )\n\t{\n\t\tint nTileID;\n\n\t\tif (psCache->nPlanarConfig == PLANARCONFIG_SEPARATE)\n\t\t{\n\t\t\tint iSample;\n\n\t\t\tfor( iSample = 0; iSample < psCache->nSamples; iSample++ )\n\t\t\t{\n\t\t\t\tpabyData = TIFFGetOvrBlock( psCache, iTileX, iTileY, iSample );\n\n\t\t\t\tif( psCache->bTiled )\n\t\t\t\t{\n\t\t\t\t\tnTileID = TIFFComputeTile( psCache->hTIFF,\n\t\t\t\t\t    iTileX * psCache->nBlockXSize,\n\t\t\t\t\t    iTileY * psCache->nBlockYSize,\n\t\t\t\t\t    0, (tsample_t) iSample );\n\t\t\t\t\tTIFFWriteEncodedTile( psCache->hTIFF, nTileID,\n\t\t\t\t\t    pabyData,\n\t\t\t\t\t    TIFFTileSize(psCache->hTIFF) );\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tnTileID = TIFFComputeStrip( psCache->hTIFF,\n\t\t\t\t\t    iTileY * psCache->nBlockYSize,\n\t\t\t\t\t    (tsample_t) iSample );\n\t\t\t\t\tRowsInStrip=psCache->nBlockYSize;\n\t\t\t\t\tif ((iTileY+1)*psCache->nBlockYSize>psCache->nYSize)\n\t\t\t\t\t\tRowsInStrip=psCache->nYSize-iTileY*psCache->nBlockYSize;\n\t\t\t\t\tTIFFWriteEncodedStrip( psCache->hTIFF, nTileID,\n\t\t\t\t\t    pabyData,\n\t\t\t\t\t    TIFFVStripSize(psCache->hTIFF,RowsInStrip) );\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t\telse\n\t\t{\n\t\t\tpabyData = TIFFGetOvrBlock( psCache, iTileX, iTileY, 0 );\n\n\t\t\tif( psCache->bTiled )\n\t\t\t{\n\t\t\t\tnTileID = TIFFComputeTile( psCache->hTIFF,\n\t\t\t\t    iTileX * psCache->nBlockXSize,\n\t\t\t\t    iTileY * psCache->nBlockYSize,\n\t\t\t\t    0, 0 );\n\t\t\t\tTIFFWriteEncodedTile( psCache->hTIFF, nTileID,\n\t\t\t\t    pabyData,\n\t\t\t\t    TIFFTileSize(psCache->hTIFF) );\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tnTileID = TIFFComputeStrip( psCache->hTIFF,\n\t\t\t\t    iTileY * psCache->nBlockYSize,\n\t\t\t\t    0 );\n\t\t\t\tRowsInStrip=psCache->nBlockYSize;\n\t\t\t\tif ((iTileY+1)*psCache->nBlockYSize>psCache->nYSize)\n\t\t\t\t\tRowsInStrip=psCache->nYSize-iTileY*psCache->nBlockYSize;\n\t\t\t\tTIFFWriteEncodedStrip( psCache->hTIFF, nTileID,\n\t\t\t\t    pabyData,\n\t\t\t\t    TIFFVStripSize(psCache->hTIFF,RowsInStrip) );\n\t\t\t}\n\t\t}\n\t}\n\t/* TODO: add checks on error status return of TIFFWriteEncodedTile and TIFFWriteEncodedStrip */\n\n/* -------------------------------------------------------------------- */\n/*      Rotate buffers.                                                 */\n/* -------------------------------------------------------------------- */\n    pabyData = psCache->pabyRow1Blocks;\n    psCache->pabyRow1Blocks = psCache->pabyRow2Blocks;\n    psCache->pabyRow2Blocks = pabyData;\n\n    _TIFFmemset( pabyData, 0, psCache->nBytesPerRow );\n\n    psCache->nBlockOffset++;\n\n/* -------------------------------------------------------------------- */\n/*      Restore access to original directory.                           */\n/* -------------------------------------------------------------------- */\n    TIFFFlush( psCache->hTIFF );\n    /* TODO: add checks on error status return of TIFFFlush */\n    TIFFSetSubDirectory( psCache->hTIFF, nBaseDirOffset );\n    /* TODO: add checks on error status return of TIFFSetSubDirectory */\n}\n\n/************************************************************************/\n/*                          TIFFGetOvrBlock()                           */\n/************************************************************************/\n\n/* TODO: make TIFF_Downsample handle iSample offset, so that we can\n * do with a single TIFFGetOvrBlock and no longer need TIFFGetOvrBlock_Subsampled */\nunsigned char *TIFFGetOvrBlock( TIFFOvrCache *psCache, int iTileX, int iTileY,\n                                int iSample )\n\n{\n    int\t\tnRowOffset;\n\n    if( iTileY > psCache->nBlockOffset + 1 )\n        TIFFWriteOvrRow( psCache );\n\n    assert( iTileX >= 0 && iTileX < psCache->nBlocksPerRow );\n    assert( iTileY >= 0 && iTileY < psCache->nBlocksPerColumn );\n    assert( iTileY >= psCache->nBlockOffset\n            && iTileY < psCache->nBlockOffset+2 );\n    assert( iSample >= 0 && iSample < psCache->nSamples );\n\n    if (psCache->nPlanarConfig == PLANARCONFIG_SEPARATE)\n        nRowOffset = ((iTileX * psCache->nSamples) + iSample)\n            * psCache->nBytesPerBlock;\n    else\n        nRowOffset = iTileX * psCache->nBytesPerBlock +\n            (psCache->nBitsPerPixel + 7) / 8 * iSample;\n\n    if( iTileY == psCache->nBlockOffset )\n        return psCache->pabyRow1Blocks + nRowOffset;\n    else\n        return psCache->pabyRow2Blocks + nRowOffset;\n}\n\n/************************************************************************/\n/*                     TIFFGetOvrBlock_Subsampled()                     */\n/************************************************************************/\n\nunsigned char *TIFFGetOvrBlock_Subsampled( TIFFOvrCache *psCache, \n                                           int iTileX, int iTileY )\n\n{\n    int\t\tnRowOffset;\n\n    if( iTileY > psCache->nBlockOffset + 1 )\n        TIFFWriteOvrRow( psCache );\n\n    assert( iTileX >= 0 && iTileX < psCache->nBlocksPerRow );\n    assert( iTileY >= 0 && iTileY < psCache->nBlocksPerColumn );\n    assert( iTileY >= psCache->nBlockOffset\n            && iTileY < psCache->nBlockOffset+2 );\n    assert( psCache->nPlanarConfig != PLANARCONFIG_SEPARATE );\n\n    nRowOffset = iTileX * psCache->nBytesPerBlock;\n\n    if( iTileY == psCache->nBlockOffset )\n        return psCache->pabyRow1Blocks + nRowOffset;\n    else\n        return psCache->pabyRow2Blocks + nRowOffset;\n}\n\n/************************************************************************/\n/*                        TIFFDestroyOvrCache()                         */\n/************************************************************************/\n\nvoid TIFFDestroyOvrCache( TIFFOvrCache * psCache )\n\n{\n    while( psCache->nBlockOffset < psCache->nBlocksPerColumn )\n        TIFFWriteOvrRow( psCache );\n\n    _TIFFfree( psCache->pabyRow1Blocks );\n    _TIFFfree( psCache->pabyRow2Blocks );\n    _TIFFfree( psCache );\n}\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/addtiffo/tif_ovrcache.h",
    "content": "/******************************************************************************\n * tif_ovrcache.h,v 1.3 2005/05/25 09:03:16 dron Exp\n *\n * Project:  TIFF Overview Builder\n * Purpose:  Library functions to maintain two rows of tiles or two strips\n *           of data for output overviews as an output cache. \n * Author:   Frank Warmerdam, warmerdam@pobox.com\n *\n * This code could potentially be used by other applications wanting to\n * manage a once-through write cache. \n *\n ******************************************************************************\n * Copyright (c) 2000, Frank Warmerdam\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included\n * in all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n ******************************************************************************\n */\n\n#ifndef TIF_OVRCACHE_H_INCLUDED\n#define TIF_OVRCACHE_H_INCLUDED\n\n#include \"tiffio.h\"\n\n#if defined(__cplusplus)\nextern \"C\" {\n#endif\n    \ntypedef struct \n{\n    uint32\tnXSize;\n    uint32\tnYSize;\n\n    uint16\tnBitsPerPixel;\n    uint16\tnSamples;\n    uint16      nPlanarConfig;\n    uint32\tnBlockXSize;\n    uint32\tnBlockYSize;\n    uint32\tnBytesPerBlock;\n    uint32      nBytesPerRow;\n\n    int\t\tnBlocksPerRow;\n    int\t\tnBlocksPerColumn;\n\n    int\t        nBlockOffset; /* what block is the first in papabyBlocks? */\n    unsigned char *pabyRow1Blocks;\n    unsigned char *pabyRow2Blocks;\n\n    int\t\tnDirOffset;\n    TIFF\t*hTIFF;\n    int\t\tbTiled;\n    \n} TIFFOvrCache;\n\nTIFFOvrCache *TIFFCreateOvrCache( TIFF *hTIFF, int nDirOffset );\nunsigned char *TIFFGetOvrBlock( TIFFOvrCache *psCache, int iTileX, int iTileY,\n                                int iSample );\nunsigned char *TIFFGetOvrBlock_Subsampled( TIFFOvrCache *psCache, int iTileX, int iTileY );\nvoid           TIFFDestroyOvrCache( TIFFOvrCache * );\n\nvoid TIFFBuildOverviews( TIFF *, int, int *, int, const char *,\n                         int (*)(double,void*), void * );\n\nvoid TIFF_ProcessFullResBlock( TIFF *hTIFF, int nPlanarConfig,\n                               int bSubsampled, int nHorSamples, int nVerSamples,\n                               int nOverviews, int * panOvList,\n                               int nBitsPerPixel, \n                               int nSamples, TIFFOvrCache ** papoRawBIs,\n                               int nSXOff, int nSYOff,\n                               unsigned char *pabySrcTile,\n                               int nBlockXSize, int nBlockYSize,\n                               int nSampleFormat, const char * pszResampling );\n\nuint32 TIFF_WriteOverview( TIFF *, int, int, int, int, int, int, int,\n                           int, int, int, int, unsigned short *,\n                           unsigned short *, unsigned short *, int,\n                           int, int);\n\n\n\n#if defined(__cplusplus)\n}\n#endif\n    \n#endif /* ndef TIF_OVRCACHE_H_INCLUDED */\n\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/dbs/Makefile.am",
    "content": "# Tag Image File Format (TIFF) Software\n#\n# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>\n#\n# Permission to use, copy, modify, distribute, and sell this software and \n# its documentation for any purpose is hereby granted without fee, provided\n# that (i) the above copyright notices and this permission notice appear in\n# all copies of the software and related documentation, and (ii) the names of\n# Sam Leffler and Silicon Graphics may not be used in any advertising or\n# publicity relating to the software without the specific, prior written\n# permission of Sam Leffler and Silicon Graphics.\n# \n# THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n# \n# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n# OF THIS SOFTWARE.\n\n# Process this file with automake to produce Makefile.in.\n\nSUBDIRS = xtiff\n\nLIBTIFF = $(top_builddir)/libtiff/libtiff.la\n\nEXTRA_DIST = README\n\nnoinst_PROGRAMS = tiff-bi tiff-grayscale tiff-palette tiff-rgb\n\ntiff_bi_SOURCES = tiff-bi.c\ntiff_bi_LDADD = $(LIBTIFF)\ntiff_grayscale_SOURCES = tiff-grayscale.c\ntiff_grayscale_LDADD = $(LIBTIFF)\ntiff_palette_SOURCES = tiff-palette.c\ntiff_palette_LDADD = $(LIBTIFF)\ntiff_rgb_SOURCES = tiff-rgb.c\ntiff_rgb_LDADD = $(LIBTIFF)\n\nINCLUDES = -I../../libtiff -I$(top_srcdir)/libtiff\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/dbs/Makefile.in",
    "content": "# Makefile.in generated by automake 1.11 from Makefile.am.\n# @configure_input@\n\n# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,\n# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,\n# Inc.\n# This Makefile.in is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY, to the extent permitted by law; without\n# even the implied warranty of MERCHANTABILITY or FITNESS FOR A\n# PARTICULAR PURPOSE.\n\n@SET_MAKE@\n\n# Tag Image File Format (TIFF) Software\n#\n# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>\n#\n# Permission to use, copy, modify, distribute, and sell this software and \n# its documentation for any purpose is hereby granted without fee, provided\n# that (i) the above copyright notices and this permission notice appear in\n# all copies of the software and related documentation, and (ii) the names of\n# Sam Leffler and Silicon Graphics may not be used in any advertising or\n# publicity relating to the software without the specific, prior written\n# permission of Sam Leffler and Silicon Graphics.\n# \n# THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n# \n# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n# OF THIS SOFTWARE.\n\n# Process this file with automake to produce Makefile.in.\n\nVPATH = @srcdir@\npkgdatadir = $(datadir)/@PACKAGE@\npkgincludedir = $(includedir)/@PACKAGE@\npkglibdir = $(libdir)/@PACKAGE@\npkglibexecdir = $(libexecdir)/@PACKAGE@\nam__cd = CDPATH=\"$${ZSH_VERSION+.}$(PATH_SEPARATOR)\" && cd\ninstall_sh_DATA = $(install_sh) -c -m 644\ninstall_sh_PROGRAM = $(install_sh) -c\ninstall_sh_SCRIPT = $(install_sh) -c\nINSTALL_HEADER = $(INSTALL_DATA)\ntransform = $(program_transform_name)\nNORMAL_INSTALL = :\nPRE_INSTALL = :\nPOST_INSTALL = :\nNORMAL_UNINSTALL = :\nPRE_UNINSTALL = :\nPOST_UNINSTALL = :\nbuild_triplet = @build@\nhost_triplet = @host@\ntarget_triplet = @target@\nnoinst_PROGRAMS = tiff-bi$(EXEEXT) tiff-grayscale$(EXEEXT) \\\n\ttiff-palette$(EXEEXT) tiff-rgb$(EXEEXT)\nsubdir = contrib/dbs\nDIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in\nACLOCAL_M4 = $(top_srcdir)/aclocal.m4\nam__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \\\n\t$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \\\n\t$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \\\n\t$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac\nam__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \\\n\t$(ACLOCAL_M4)\nmkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs\nCONFIG_HEADER = $(top_builddir)/libtiff/tif_config.h \\\n\t$(top_builddir)/libtiff/tiffconf.h\nCONFIG_CLEAN_FILES =\nCONFIG_CLEAN_VPATH_FILES =\nPROGRAMS = $(noinst_PROGRAMS)\nam_tiff_bi_OBJECTS = tiff-bi.$(OBJEXT)\ntiff_bi_OBJECTS = $(am_tiff_bi_OBJECTS)\ntiff_bi_DEPENDENCIES = $(LIBTIFF)\nAM_V_lt = $(am__v_lt_$(V))\nam__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))\nam__v_lt_0 = --silent\nam_tiff_grayscale_OBJECTS = tiff-grayscale.$(OBJEXT)\ntiff_grayscale_OBJECTS = $(am_tiff_grayscale_OBJECTS)\ntiff_grayscale_DEPENDENCIES = $(LIBTIFF)\nam_tiff_palette_OBJECTS = tiff-palette.$(OBJEXT)\ntiff_palette_OBJECTS = $(am_tiff_palette_OBJECTS)\ntiff_palette_DEPENDENCIES = $(LIBTIFF)\nam_tiff_rgb_OBJECTS = tiff-rgb.$(OBJEXT)\ntiff_rgb_OBJECTS = $(am_tiff_rgb_OBJECTS)\ntiff_rgb_DEPENDENCIES = $(LIBTIFF)\nDEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/libtiff\ndepcomp = $(SHELL) $(top_srcdir)/config/depcomp\nam__depfiles_maybe = depfiles\nam__mv = mv -f\nCOMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \\\n\t$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)\nLTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \\\n\t$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \\\n\t$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \\\n\t$(AM_CFLAGS) $(CFLAGS)\nAM_V_CC = $(am__v_CC_$(V))\nam__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))\nam__v_CC_0 = @echo \"  CC    \" $@;\nAM_V_at = $(am__v_at_$(V))\nam__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))\nam__v_at_0 = @\nCCLD = $(CC)\nLINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \\\n\t$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \\\n\t$(AM_LDFLAGS) $(LDFLAGS) -o $@\nAM_V_CCLD = $(am__v_CCLD_$(V))\nam__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))\nam__v_CCLD_0 = @echo \"  CCLD  \" $@;\nAM_V_GEN = $(am__v_GEN_$(V))\nam__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))\nam__v_GEN_0 = @echo \"  GEN   \" $@;\nSOURCES = $(tiff_bi_SOURCES) $(tiff_grayscale_SOURCES) \\\n\t$(tiff_palette_SOURCES) $(tiff_rgb_SOURCES)\nDIST_SOURCES = $(tiff_bi_SOURCES) $(tiff_grayscale_SOURCES) \\\n\t$(tiff_palette_SOURCES) $(tiff_rgb_SOURCES)\nRECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \\\n\thtml-recursive info-recursive install-data-recursive \\\n\tinstall-dvi-recursive install-exec-recursive \\\n\tinstall-html-recursive install-info-recursive \\\n\tinstall-pdf-recursive install-ps-recursive install-recursive \\\n\tinstallcheck-recursive installdirs-recursive pdf-recursive \\\n\tps-recursive uninstall-recursive\nRECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive\t\\\n  distclean-recursive maintainer-clean-recursive\nAM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \\\n\t$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \\\n\tdistdir\nETAGS = etags\nCTAGS = ctags\nDIST_SUBDIRS = $(SUBDIRS)\nDISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)\nam__relativize = \\\n  dir0=`pwd`; \\\n  sed_first='s,^\\([^/]*\\)/.*$$,\\1,'; \\\n  sed_rest='s,^[^/]*/*,,'; \\\n  sed_last='s,^.*/\\([^/]*\\)$$,\\1,'; \\\n  sed_butlast='s,/*[^/]*$$,,'; \\\n  while test -n \"$$dir1\"; do \\\n    first=`echo \"$$dir1\" | sed -e \"$$sed_first\"`; \\\n    if test \"$$first\" != \".\"; then \\\n      if test \"$$first\" = \"..\"; then \\\n        dir2=`echo \"$$dir0\" | sed -e \"$$sed_last\"`/\"$$dir2\"; \\\n        dir0=`echo \"$$dir0\" | sed -e \"$$sed_butlast\"`; \\\n      else \\\n        first2=`echo \"$$dir2\" | sed -e \"$$sed_first\"`; \\\n        if test \"$$first2\" = \"$$first\"; then \\\n          dir2=`echo \"$$dir2\" | sed -e \"$$sed_rest\"`; \\\n        else \\\n          dir2=\"../$$dir2\"; \\\n        fi; \\\n        dir0=\"$$dir0\"/\"$$first\"; \\\n      fi; \\\n    fi; \\\n    dir1=`echo \"$$dir1\" | sed -e \"$$sed_rest\"`; \\\n  done; \\\n  reldir=\"$$dir2\"\nACLOCAL = @ACLOCAL@\nAMTAR = @AMTAR@\nAM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@\nAR = @AR@\nAS = @AS@\nAUTOCONF = @AUTOCONF@\nAUTOHEADER = @AUTOHEADER@\nAUTOMAKE = @AUTOMAKE@\nAWK = @AWK@\nCC = @CC@\nCCDEPMODE = @CCDEPMODE@\nCFLAGS = @CFLAGS@\nCPP = @CPP@\nCPPFLAGS = @CPPFLAGS@\nCXX = @CXX@\nCXXCPP = @CXXCPP@\nCXXDEPMODE = @CXXDEPMODE@\nCXXFLAGS = @CXXFLAGS@\nCYGPATH_W = @CYGPATH_W@\nDEFS = @DEFS@\nDEPDIR = @DEPDIR@\nDLLTOOL = @DLLTOOL@\nDSYMUTIL = @DSYMUTIL@\nDUMPBIN = @DUMPBIN@\nECHO_C = @ECHO_C@\nECHO_N = @ECHO_N@\nECHO_T = @ECHO_T@\nEGREP = @EGREP@\nEXEEXT = @EXEEXT@\nFGREP = @FGREP@\nGLUT_CFLAGS = @GLUT_CFLAGS@\nGLUT_LIBS = @GLUT_LIBS@\nGLU_CFLAGS = @GLU_CFLAGS@\nGLU_LIBS = @GLU_LIBS@\nGL_CFLAGS = @GL_CFLAGS@\nGL_LIBS = @GL_LIBS@\nGREP = @GREP@\nINSTALL = @INSTALL@\nINSTALL_DATA = @INSTALL_DATA@\nINSTALL_PROGRAM = @INSTALL_PROGRAM@\nINSTALL_SCRIPT = @INSTALL_SCRIPT@\nINSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@\nLD = @LD@\nLDFLAGS = @LDFLAGS@\nLIBDIR = @LIBDIR@\nLIBOBJS = @LIBOBJS@\nLIBS = @LIBS@\nLIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@\nLIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@\nLIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@\nLIBTIFF_MICRO_VERSION = @LIBTIFF_MICRO_VERSION@\nLIBTIFF_MINOR_VERSION = @LIBTIFF_MINOR_VERSION@\nLIBTIFF_RELEASE_DATE = @LIBTIFF_RELEASE_DATE@\nLIBTIFF_VERSION = @LIBTIFF_VERSION@\nLIBTIFF_VERSION_INFO = @LIBTIFF_VERSION_INFO@\nLIBTOOL = @LIBTOOL@\nLIPO = @LIPO@\nLN_S = @LN_S@\nLTLIBOBJS = @LTLIBOBJS@\nMAINT = @MAINT@\nMAKEINFO = @MAKEINFO@\nMKDIR_P = @MKDIR_P@\nNM = @NM@\nNMEDIT = @NMEDIT@\nOBJDUMP = @OBJDUMP@\nOBJEXT = @OBJEXT@\nOTOOL = @OTOOL@\nOTOOL64 = @OTOOL64@\nPACKAGE = @PACKAGE@\nPACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@\nPACKAGE_NAME = @PACKAGE_NAME@\nPACKAGE_STRING = @PACKAGE_STRING@\nPACKAGE_TARNAME = @PACKAGE_TARNAME@\nPACKAGE_URL = @PACKAGE_URL@\nPACKAGE_VERSION = @PACKAGE_VERSION@\nPATH_SEPARATOR = @PATH_SEPARATOR@\nPTHREAD_CC = @PTHREAD_CC@\nPTHREAD_CFLAGS = @PTHREAD_CFLAGS@\nPTHREAD_LIBS = @PTHREAD_LIBS@\nRANLIB = @RANLIB@\nSED = @SED@\nSET_MAKE = @SET_MAKE@\nSHELL = @SHELL@\nSTRIP = @STRIP@\nVERSION = @VERSION@\nXMKMF = @XMKMF@\nX_CFLAGS = @X_CFLAGS@\nX_EXTRA_LIBS = @X_EXTRA_LIBS@\nX_LIBS = @X_LIBS@\nX_PRE_LIBS = @X_PRE_LIBS@\nabs_builddir = @abs_builddir@\nabs_srcdir = @abs_srcdir@\nabs_top_builddir = @abs_top_builddir@\nabs_top_srcdir = @abs_top_srcdir@\nac_ct_CC = @ac_ct_CC@\nac_ct_CXX = @ac_ct_CXX@\nac_ct_DUMPBIN = @ac_ct_DUMPBIN@\nacx_pthread_config = @acx_pthread_config@\nam__include = @am__include@\nam__leading_dot = @am__leading_dot@\nam__quote = @am__quote@\nam__tar = @am__tar@\nam__untar = @am__untar@\nbindir = @bindir@\nbuild = @build@\nbuild_alias = @build_alias@\nbuild_cpu = @build_cpu@\nbuild_os = @build_os@\nbuild_vendor = @build_vendor@\nbuilddir = @builddir@\ndatadir = @datadir@\ndatarootdir = @datarootdir@\ndocdir = @docdir@\ndvidir = @dvidir@\nexec_prefix = @exec_prefix@\nhost = @host@\nhost_alias = @host_alias@\nhost_cpu = @host_cpu@\nhost_os = @host_os@\nhost_vendor = @host_vendor@\nhtmldir = @htmldir@\nincludedir = @includedir@\ninfodir = @infodir@\ninstall_sh = @install_sh@\nlibdir = @libdir@\nlibexecdir = @libexecdir@\nlocaledir = @localedir@\nlocalstatedir = @localstatedir@\nlt_ECHO = @lt_ECHO@\nmandir = @mandir@\nmkdir_p = @mkdir_p@\noldincludedir = @oldincludedir@\npdfdir = @pdfdir@\nprefix = @prefix@\nprogram_transform_name = @program_transform_name@\npsdir = @psdir@\nsbindir = @sbindir@\nsharedstatedir = @sharedstatedir@\nsrcdir = @srcdir@\nsysconfdir = @sysconfdir@\ntarget = @target@\ntarget_alias = @target_alias@\ntarget_cpu = @target_cpu@\ntarget_os = @target_os@\ntarget_vendor = @target_vendor@\ntop_build_prefix = @top_build_prefix@\ntop_builddir = @top_builddir@\ntop_srcdir = @top_srcdir@\nSUBDIRS = xtiff\nLIBTIFF = $(top_builddir)/libtiff/libtiff.la\nEXTRA_DIST = README\ntiff_bi_SOURCES = tiff-bi.c\ntiff_bi_LDADD = $(LIBTIFF)\ntiff_grayscale_SOURCES = tiff-grayscale.c\ntiff_grayscale_LDADD = $(LIBTIFF)\ntiff_palette_SOURCES = tiff-palette.c\ntiff_palette_LDADD = $(LIBTIFF)\ntiff_rgb_SOURCES = tiff-rgb.c\ntiff_rgb_LDADD = $(LIBTIFF)\nINCLUDES = -I../../libtiff -I$(top_srcdir)/libtiff\nall: all-recursive\n\n.SUFFIXES:\n.SUFFIXES: .c .lo .o .obj\n$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)\n\t@for dep in $?; do \\\n\t  case '$(am__configure_deps)' in \\\n\t    *$$dep*) \\\n\t      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \\\n\t        && { if test -f $@; then exit 0; else break; fi; }; \\\n\t      exit 1;; \\\n\t  esac; \\\n\tdone; \\\n\techo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign contrib/dbs/Makefile'; \\\n\t$(am__cd) $(top_srcdir) && \\\n\t  $(AUTOMAKE) --foreign contrib/dbs/Makefile\n.PRECIOUS: Makefile\nMakefile: $(srcdir)/Makefile.in $(top_builddir)/config.status\n\t@case '$?' in \\\n\t  *config.status*) \\\n\t    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \\\n\t  *) \\\n\t    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \\\n\t    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \\\n\tesac;\n\n$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n\n$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n$(am__aclocal_m4_deps):\n\nclean-noinstPROGRAMS:\n\t@list='$(noinst_PROGRAMS)'; test -n \"$$list\" || exit 0; \\\n\techo \" rm -f\" $$list; \\\n\trm -f $$list || exit $$?; \\\n\ttest -n \"$(EXEEXT)\" || exit 0; \\\n\tlist=`for p in $$list; do echo \"$$p\"; done | sed 's/$(EXEEXT)$$//'`; \\\n\techo \" rm -f\" $$list; \\\n\trm -f $$list\ntiff-bi$(EXEEXT): $(tiff_bi_OBJECTS) $(tiff_bi_DEPENDENCIES) \n\t@rm -f tiff-bi$(EXEEXT)\n\t$(AM_V_CCLD)$(LINK) $(tiff_bi_OBJECTS) $(tiff_bi_LDADD) $(LIBS)\ntiff-grayscale$(EXEEXT): $(tiff_grayscale_OBJECTS) $(tiff_grayscale_DEPENDENCIES) \n\t@rm -f tiff-grayscale$(EXEEXT)\n\t$(AM_V_CCLD)$(LINK) $(tiff_grayscale_OBJECTS) $(tiff_grayscale_LDADD) $(LIBS)\ntiff-palette$(EXEEXT): $(tiff_palette_OBJECTS) $(tiff_palette_DEPENDENCIES) \n\t@rm -f tiff-palette$(EXEEXT)\n\t$(AM_V_CCLD)$(LINK) $(tiff_palette_OBJECTS) $(tiff_palette_LDADD) $(LIBS)\ntiff-rgb$(EXEEXT): $(tiff_rgb_OBJECTS) $(tiff_rgb_DEPENDENCIES) \n\t@rm -f tiff-rgb$(EXEEXT)\n\t$(AM_V_CCLD)$(LINK) $(tiff_rgb_OBJECTS) $(tiff_rgb_LDADD) $(LIBS)\n\nmostlyclean-compile:\n\t-rm -f *.$(OBJEXT)\n\ndistclean-compile:\n\t-rm -f *.tab.c\n\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tiff-bi.Po@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tiff-grayscale.Po@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tiff-palette.Po@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tiff-rgb.Po@am__quote@\n\n.c.o:\n@am__fastdepCC_TRUE@\t$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<\n@am__fastdepCC_TRUE@\t$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po\n@am__fastdepCC_FALSE@\t$(AM_V_CC) @AM_BACKSLASH@\n@AMDEP_TRUE@@am__fastdepCC_FALSE@\tsource='$<' object='$@' libtool=no @AMDEPBACKSLASH@\n@AMDEP_TRUE@@am__fastdepCC_FALSE@\tDEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@\n@am__fastdepCC_FALSE@\t$(COMPILE) -c $<\n\n.c.obj:\n@am__fastdepCC_TRUE@\t$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`\n@am__fastdepCC_TRUE@\t$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po\n@am__fastdepCC_FALSE@\t$(AM_V_CC) @AM_BACKSLASH@\n@AMDEP_TRUE@@am__fastdepCC_FALSE@\tsource='$<' object='$@' libtool=no @AMDEPBACKSLASH@\n@AMDEP_TRUE@@am__fastdepCC_FALSE@\tDEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@\n@am__fastdepCC_FALSE@\t$(COMPILE) -c `$(CYGPATH_W) '$<'`\n\n.c.lo:\n@am__fastdepCC_TRUE@\t$(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<\n@am__fastdepCC_TRUE@\t$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo\n@am__fastdepCC_FALSE@\t$(AM_V_CC) @AM_BACKSLASH@\n@AMDEP_TRUE@@am__fastdepCC_FALSE@\tsource='$<' object='$@' libtool=yes @AMDEPBACKSLASH@\n@AMDEP_TRUE@@am__fastdepCC_FALSE@\tDEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@\n@am__fastdepCC_FALSE@\t$(LTCOMPILE) -c -o $@ $<\n\nmostlyclean-libtool:\n\t-rm -f *.lo\n\nclean-libtool:\n\t-rm -rf .libs _libs\n\n# This directory's subdirectories are mostly independent; you can cd\n# into them and run `make' without going through this Makefile.\n# To change the values of `make' variables: instead of editing Makefiles,\n# (1) if the variable is set in `config.status', edit `config.status'\n#     (which will cause the Makefiles to be regenerated when you run `make');\n# (2) otherwise, pass the desired values on the `make' command line.\n$(RECURSIVE_TARGETS):\n\t@failcom='exit 1'; \\\n\tfor f in x $$MAKEFLAGS; do \\\n\t  case $$f in \\\n\t    *=* | --[!k]*);; \\\n\t    *k*) failcom='fail=yes';; \\\n\t  esac; \\\n\tdone; \\\n\tdot_seen=no; \\\n\ttarget=`echo $@ | sed s/-recursive//`; \\\n\tlist='$(SUBDIRS)'; for subdir in $$list; do \\\n\t  echo \"Making $$target in $$subdir\"; \\\n\t  if test \"$$subdir\" = \".\"; then \\\n\t    dot_seen=yes; \\\n\t    local_target=\"$$target-am\"; \\\n\t  else \\\n\t    local_target=\"$$target\"; \\\n\t  fi; \\\n\t  ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \\\n\t  || eval $$failcom; \\\n\tdone; \\\n\tif test \"$$dot_seen\" = \"no\"; then \\\n\t  $(MAKE) $(AM_MAKEFLAGS) \"$$target-am\" || exit 1; \\\n\tfi; test -z \"$$fail\"\n\n$(RECURSIVE_CLEAN_TARGETS):\n\t@failcom='exit 1'; \\\n\tfor f in x $$MAKEFLAGS; do \\\n\t  case $$f in \\\n\t    *=* | --[!k]*);; \\\n\t    *k*) failcom='fail=yes';; \\\n\t  esac; \\\n\tdone; \\\n\tdot_seen=no; \\\n\tcase \"$@\" in \\\n\t  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \\\n\t  *) list='$(SUBDIRS)' ;; \\\n\tesac; \\\n\trev=''; for subdir in $$list; do \\\n\t  if test \"$$subdir\" = \".\"; then :; else \\\n\t    rev=\"$$subdir $$rev\"; \\\n\t  fi; \\\n\tdone; \\\n\trev=\"$$rev .\"; \\\n\ttarget=`echo $@ | sed s/-recursive//`; \\\n\tfor subdir in $$rev; do \\\n\t  echo \"Making $$target in $$subdir\"; \\\n\t  if test \"$$subdir\" = \".\"; then \\\n\t    local_target=\"$$target-am\"; \\\n\t  else \\\n\t    local_target=\"$$target\"; \\\n\t  fi; \\\n\t  ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \\\n\t  || eval $$failcom; \\\n\tdone && test -z \"$$fail\"\ntags-recursive:\n\tlist='$(SUBDIRS)'; for subdir in $$list; do \\\n\t  test \"$$subdir\" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \\\n\tdone\nctags-recursive:\n\tlist='$(SUBDIRS)'; for subdir in $$list; do \\\n\t  test \"$$subdir\" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \\\n\tdone\n\nID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)\n\tlist='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \\\n\tunique=`for i in $$list; do \\\n\t    if test -f \"$$i\"; then echo $$i; else echo $(srcdir)/$$i; fi; \\\n\t  done | \\\n\t  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \\\n\t      END { if (nonempty) { for (i in files) print i; }; }'`; \\\n\tmkid -fID $$unique\ntags: TAGS\n\nTAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \\\n\t\t$(TAGS_FILES) $(LISP)\n\tset x; \\\n\there=`pwd`; \\\n\tif ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \\\n\t  include_option=--etags-include; \\\n\t  empty_fix=.; \\\n\telse \\\n\t  include_option=--include; \\\n\t  empty_fix=; \\\n\tfi; \\\n\tlist='$(SUBDIRS)'; for subdir in $$list; do \\\n\t  if test \"$$subdir\" = .; then :; else \\\n\t    test ! -f $$subdir/TAGS || \\\n\t      set \"$$@\" \"$$include_option=$$here/$$subdir/TAGS\"; \\\n\t  fi; \\\n\tdone; \\\n\tlist='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \\\n\tunique=`for i in $$list; do \\\n\t    if test -f \"$$i\"; then echo $$i; else echo $(srcdir)/$$i; fi; \\\n\t  done | \\\n\t  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \\\n\t      END { if (nonempty) { for (i in files) print i; }; }'`; \\\n\tshift; \\\n\tif test -z \"$(ETAGS_ARGS)$$*$$unique\"; then :; else \\\n\t  test -n \"$$unique\" || unique=$$empty_fix; \\\n\t  if test $$# -gt 0; then \\\n\t    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \\\n\t      \"$$@\" $$unique; \\\n\t  else \\\n\t    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \\\n\t      $$unique; \\\n\t  fi; \\\n\tfi\nctags: CTAGS\nCTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \\\n\t\t$(TAGS_FILES) $(LISP)\n\tlist='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \\\n\tunique=`for i in $$list; do \\\n\t    if test -f \"$$i\"; then echo $$i; else echo $(srcdir)/$$i; fi; \\\n\t  done | \\\n\t  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \\\n\t      END { if (nonempty) { for (i in files) print i; }; }'`; \\\n\ttest -z \"$(CTAGS_ARGS)$$unique\" \\\n\t  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \\\n\t     $$unique\n\nGTAGS:\n\there=`$(am__cd) $(top_builddir) && pwd` \\\n\t  && $(am__cd) $(top_srcdir) \\\n\t  && gtags -i $(GTAGS_ARGS) \"$$here\"\n\ndistclean-tags:\n\t-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags\n\ndistdir: $(DISTFILES)\n\t@srcdirstrip=`echo \"$(srcdir)\" | sed 's/[].[^$$\\\\*]/\\\\\\\\&/g'`; \\\n\ttopsrcdirstrip=`echo \"$(top_srcdir)\" | sed 's/[].[^$$\\\\*]/\\\\\\\\&/g'`; \\\n\tlist='$(DISTFILES)'; \\\n\t  dist_files=`for file in $$list; do echo $$file; done | \\\n\t  sed -e \"s|^$$srcdirstrip/||;t\" \\\n\t      -e \"s|^$$topsrcdirstrip/|$(top_builddir)/|;t\"`; \\\n\tcase $$dist_files in \\\n\t  */*) $(MKDIR_P) `echo \"$$dist_files\" | \\\n\t\t\t   sed '/\\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \\\n\t\t\t   sort -u` ;; \\\n\tesac; \\\n\tfor file in $$dist_files; do \\\n\t  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \\\n\t  if test -d $$d/$$file; then \\\n\t    dir=`echo \"/$$file\" | sed -e 's,/[^/]*$$,,'`; \\\n\t    if test -d \"$(distdir)/$$file\"; then \\\n\t      find \"$(distdir)/$$file\" -type d ! -perm -700 -exec chmod u+rwx {} \\;; \\\n\t    fi; \\\n\t    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \\\n\t      cp -fpR $(srcdir)/$$file \"$(distdir)$$dir\" || exit 1; \\\n\t      find \"$(distdir)/$$file\" -type d ! -perm -700 -exec chmod u+rwx {} \\;; \\\n\t    fi; \\\n\t    cp -fpR $$d/$$file \"$(distdir)$$dir\" || exit 1; \\\n\t  else \\\n\t    test -f \"$(distdir)/$$file\" \\\n\t    || cp -p $$d/$$file \"$(distdir)/$$file\" \\\n\t    || exit 1; \\\n\t  fi; \\\n\tdone\n\t@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \\\n\t  if test \"$$subdir\" = .; then :; else \\\n\t    test -d \"$(distdir)/$$subdir\" \\\n\t    || $(MKDIR_P) \"$(distdir)/$$subdir\" \\\n\t    || exit 1; \\\n\t  fi; \\\n\tdone\n\t@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \\\n\t  if test \"$$subdir\" = .; then :; else \\\n\t    dir1=$$subdir; dir2=\"$(distdir)/$$subdir\"; \\\n\t    $(am__relativize); \\\n\t    new_distdir=$$reldir; \\\n\t    dir1=$$subdir; dir2=\"$(top_distdir)\"; \\\n\t    $(am__relativize); \\\n\t    new_top_distdir=$$reldir; \\\n\t    echo \" (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=\"$$new_top_distdir\" distdir=\"$$new_distdir\" \\\\\"; \\\n\t    echo \"     am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)\"; \\\n\t    ($(am__cd) $$subdir && \\\n\t      $(MAKE) $(AM_MAKEFLAGS) \\\n\t        top_distdir=\"$$new_top_distdir\" \\\n\t        distdir=\"$$new_distdir\" \\\n\t\tam__remove_distdir=: \\\n\t\tam__skip_length_check=: \\\n\t\tam__skip_mode_fix=: \\\n\t        distdir) \\\n\t      || exit 1; \\\n\t  fi; \\\n\tdone\ncheck-am: all-am\ncheck: check-recursive\nall-am: Makefile $(PROGRAMS)\ninstalldirs: installdirs-recursive\ninstalldirs-am:\ninstall: install-recursive\ninstall-exec: install-exec-recursive\ninstall-data: install-data-recursive\nuninstall: uninstall-recursive\n\ninstall-am: all-am\n\t@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am\n\ninstallcheck: installcheck-recursive\ninstall-strip:\n\t$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM=\"$(INSTALL_STRIP_PROGRAM)\" \\\n\t  install_sh_PROGRAM=\"$(INSTALL_STRIP_PROGRAM)\" INSTALL_STRIP_FLAG=-s \\\n\t  `test -z '$(STRIP)' || \\\n\t    echo \"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'\"` install\nmostlyclean-generic:\n\nclean-generic:\n\ndistclean-generic:\n\t-test -z \"$(CONFIG_CLEAN_FILES)\" || rm -f $(CONFIG_CLEAN_FILES)\n\t-test . = \"$(srcdir)\" || test -z \"$(CONFIG_CLEAN_VPATH_FILES)\" || rm -f $(CONFIG_CLEAN_VPATH_FILES)\n\nmaintainer-clean-generic:\n\t@echo \"This command is intended for maintainers to use\"\n\t@echo \"it deletes files that may require special tools to rebuild.\"\nclean: clean-recursive\n\nclean-am: clean-generic clean-libtool clean-noinstPROGRAMS \\\n\tmostlyclean-am\n\ndistclean: distclean-recursive\n\t-rm -rf ./$(DEPDIR)\n\t-rm -f Makefile\ndistclean-am: clean-am distclean-compile distclean-generic \\\n\tdistclean-tags\n\ndvi: dvi-recursive\n\ndvi-am:\n\nhtml: html-recursive\n\nhtml-am:\n\ninfo: info-recursive\n\ninfo-am:\n\ninstall-data-am:\n\ninstall-dvi: install-dvi-recursive\n\ninstall-dvi-am:\n\ninstall-exec-am:\n\ninstall-html: install-html-recursive\n\ninstall-html-am:\n\ninstall-info: install-info-recursive\n\ninstall-info-am:\n\ninstall-man:\n\ninstall-pdf: install-pdf-recursive\n\ninstall-pdf-am:\n\ninstall-ps: install-ps-recursive\n\ninstall-ps-am:\n\ninstallcheck-am:\n\nmaintainer-clean: maintainer-clean-recursive\n\t-rm -rf ./$(DEPDIR)\n\t-rm -f Makefile\nmaintainer-clean-am: distclean-am maintainer-clean-generic\n\nmostlyclean: mostlyclean-recursive\n\nmostlyclean-am: mostlyclean-compile mostlyclean-generic \\\n\tmostlyclean-libtool\n\npdf: pdf-recursive\n\npdf-am:\n\nps: ps-recursive\n\nps-am:\n\nuninstall-am:\n\n.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \\\n\tinstall-am install-strip tags-recursive\n\n.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \\\n\tall all-am check check-am clean clean-generic clean-libtool \\\n\tclean-noinstPROGRAMS ctags ctags-recursive distclean \\\n\tdistclean-compile distclean-generic distclean-libtool \\\n\tdistclean-tags distdir dvi dvi-am html html-am info info-am \\\n\tinstall install-am install-data install-data-am install-dvi \\\n\tinstall-dvi-am install-exec install-exec-am install-html \\\n\tinstall-html-am install-info install-info-am install-man \\\n\tinstall-pdf install-pdf-am install-ps install-ps-am \\\n\tinstall-strip installcheck installcheck-am installdirs \\\n\tinstalldirs-am maintainer-clean maintainer-clean-generic \\\n\tmostlyclean mostlyclean-compile mostlyclean-generic \\\n\tmostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \\\n\tuninstall uninstall-am\n\n\n# Tell versions [3.59,3.63) of GNU make to not export all variables.\n# Otherwise a system limit (for SysV at least) may be exceeded.\n.NOEXPORT:\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/dbs/README",
    "content": "Wed May  9 09:11:35 PDT 1990\n\nThis directory contains programs from Dan Sears\n(dbs@decwrl.dec.com).  Contact him directly if\nyou have questions/problems.\n\n\tSam\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/dbs/tiff-bi.c",
    "content": "/* $Id: tiff-bi.c,v 1.2 2004/05/03 16:46:36 dron Exp $ */\n\n/*\n * tiff-bi.c -- create a Class B (bilevel) TIFF file\n *\n * Copyright 1990 by Digital Equipment Corporation, Maynard, Massachusetts.\n *\n *                        All Rights Reserved\n *\n * Permission to use, copy, modify, and distribute this software and its\n * documentation for any purpose and without fee is hereby granted,\n * provided that the above copyright notice appear in all copies and that\n * both that copyright notice and this permission notice appear in\n * supporting documentation, and that the name of Digital not be\n * used in advertising or publicity pertaining to distribution of the\n * software without specific, written prior permission.\n *\n * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING\n * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL\n * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR\n * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,\n * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS\n * SOFTWARE.\n */\n\n#include <stdio.h>\n#include <stdlib.h>\n\n#include \"tiffio.h\"\n\n#define WIDTH       512\n#define HEIGHT      WIDTH\n\nint main(int argc, char **argv)\n{\n    int             i;\n    unsigned char * scan_line;\n    TIFF *          tif;\n\n    if (argc != 2) {\n        fprintf(stderr, \"Usage: %s tiff-image\\n\", argv[0]);\n        return 0;\n    }\n\n    if ((tif = TIFFOpen(argv[1], \"w\")) == NULL) {\n        fprintf(stderr, \"can't open %s as a TIFF file\\n\", argv[1]);\n        return 0;\n    }\n\n    TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, WIDTH);\n    TIFFSetField(tif, TIFFTAG_IMAGELENGTH, HEIGHT);\n    TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 1);\n    TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_NONE);\n    TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISBLACK);\n    TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 1);\n    TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, 1);\n    TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);\n    TIFFSetField(tif, TIFFTAG_RESOLUTIONUNIT, RESUNIT_NONE);\n\n    scan_line = (unsigned char *) malloc(WIDTH / 8);\n\n    for (i = 0; i < (WIDTH / 8) / 2; i++)\n        scan_line[i] = 0;\n\n    for (i = (WIDTH / 8) / 2; i < (WIDTH / 8); i++)\n        scan_line[i] = 255;\n\n    for (i = 0; i < HEIGHT / 2; i++)\n        TIFFWriteScanline(tif, scan_line, i, 0);\n\n    for (i = 0; i < (WIDTH / 8) / 2; i++)\n        scan_line[i] = 255;\n\n    for (i = (WIDTH / 8) / 2; i < (WIDTH / 8); i++)\n        scan_line[i] = 0;\n\n    for (i = HEIGHT / 2; i < HEIGHT; i++)\n        TIFFWriteScanline(tif, scan_line, i, 0);\n\n    free(scan_line);\n    TIFFClose(tif);\n    return 0;\n}\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/dbs/tiff-grayscale.c",
    "content": "/* $Id: tiff-grayscale.c,v 1.4 2004/09/03 08:26:08 dron Exp $ */\n\n/*\n * tiff-grayscale.c -- create a Class G (grayscale) TIFF file\n *      with a gray response curve in linear optical density\n *\n * Copyright 1990 by Digital Equipment Corporation, Maynard, Massachusetts.\n *\n *                        All Rights Reserved\n *\n * Permission to use, copy, modify, and distribute this software and its\n * documentation for any purpose and without fee is hereby granted,\n * provided that the above copyright notice appear in all copies and that\n * both that copyright notice and this permission notice appear in\n * supporting documentation, and that the name of Digital not be\n * used in advertising or publicity pertaining to distribution of the\n * software without specific, written prior permission.\n *\n * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING\n * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL\n * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR\n * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,\n * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS\n * SOFTWARE.\n */\n\n#include <math.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n#include \"tiffio.h\"\n\n#define WIDTH       512\n#define HEIGHT      WIDTH\n\nchar *              programName;\nvoid                Usage();\n\nint main(int argc, char **argv)\n{\n    int             bits_per_pixel = 8, cmsize, i, j, k,\n                    gray_index, chunk_size = 32, nchunks = 16;\n    unsigned char * scan_line;\n    uint16 *        gray;\n    float           refblackwhite[2*1];\n    TIFF *          tif;\n\n    programName = argv[0];\n\n    if (argc != 4)\n        Usage();\n\n    if (!strcmp(argv[1], \"-depth\"))\n         bits_per_pixel = atoi(argv[2]);\n    else\n         Usage();\n\n    switch (bits_per_pixel) {\n        case 8:\n            nchunks = 16;\n            chunk_size = 32;\n            break;\n        case 4:\n            nchunks = 4;\n            chunk_size = 128;\n            break;\n        case 2:\n            nchunks = 2;\n            chunk_size = 256;\n            break;\n        default:\n            Usage();\n    }\n\n    cmsize = nchunks * nchunks;\n    gray = (uint16 *) malloc(cmsize * sizeof(uint16));\n\n    gray[0] = 3000;\n    for (i = 1; i < cmsize; i++)\n        gray[i] = (uint16) (-log10((double) i / (cmsize - 1)) * 1000);\n\n    refblackwhite[0] = 0.0;\n    refblackwhite[1] = (float)((1L<<bits_per_pixel) - 1);\n\n    if ((tif = TIFFOpen(argv[3], \"w\")) == NULL) {\n        fprintf(stderr, \"can't open %s as a TIFF file\\n\", argv[3]);\n        return 0;\n    }\n\n    TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, WIDTH);\n    TIFFSetField(tif, TIFFTAG_IMAGELENGTH, HEIGHT);\n    TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, bits_per_pixel);\n    TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_NONE);\n    TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISBLACK);\n    TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 1);\n    TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, 1);\n    TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);\n    TIFFSetField(tif, TIFFTAG_REFERENCEBLACKWHITE, refblackwhite);\n    TIFFSetField(tif, TIFFTAG_TRANSFERFUNCTION, gray);\n    TIFFSetField(tif, TIFFTAG_RESOLUTIONUNIT, RESUNIT_NONE);\n\n    scan_line = (unsigned char *) malloc(WIDTH / (8 / bits_per_pixel));\n\n    for (i = 0; i < HEIGHT; i++) {\n        for (j = 0, k = 0; j < WIDTH;) {\n            gray_index = (j / chunk_size) + ((i / chunk_size) * nchunks);\n\n            switch (bits_per_pixel) {\n            case 8:\n                scan_line[k++] = gray_index;\n                j++;\n                break;\n            case 4:\n                scan_line[k++] = (gray_index << 4) + gray_index;\n                j += 2;\n                break;\n            case 2:\n                scan_line[k++] = (gray_index << 6) + (gray_index << 4)\n                    + (gray_index << 2) + gray_index;\n                j += 4;\n                break;\n            }\n        }\n        TIFFWriteScanline(tif, scan_line, i, 0);\n    }\n\n    free(scan_line);\n    TIFFClose(tif);\n    return 0;\n}\n\nvoid\nUsage()\n{\n    fprintf(stderr, \"Usage: %s -depth (8 | 4 | 2) tiff-image\\n\", programName);\n    exit(0);\n}\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/dbs/tiff-palette.c",
    "content": "/* $Id: tiff-palette.c,v 1.3 2004/09/03 08:27:20 dron Exp $ */\n\n/*\n * tiff-palette.c -- create a Class P (palette) TIFF file\n *\n * Copyright 1990 by Digital Equipment Corporation, Maynard, Massachusetts.\n *\n *                        All Rights Reserved\n *\n * Permission to use, copy, modify, and distribute this software and its\n * documentation for any purpose and without fee is hereby granted,\n * provided that the above copyright notice appear in all copies and that\n * both that copyright notice and this permission notice appear in\n * supporting documentation, and that the name of Digital not be\n * used in advertising or publicity pertaining to distribution of the\n * software without specific, written prior permission.\n *\n * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING\n * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL\n * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR\n * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,\n * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS\n * SOFTWARE.\n */\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n#include \"tiffio.h\"\n\n#define WIDTH       512\n#define HEIGHT      WIDTH\n#define SCALE(x)    ((x) * 257L)\n\nchar *              programName;\nvoid                Usage();\n\nint main(int argc, char **argv)\n{\n    int             bits_per_pixel = 8, cmsize, i, j, k,\n                    cmap_index, chunk_size = 32, nchunks = 16;\n    unsigned char * scan_line;\n    uint16          *red, *green, *blue;\n    TIFF *          tif;\n\n    programName = argv[0];\n\n    if (argc != 4)\n        Usage();\n\n    if (!strcmp(argv[1], \"-depth\"))\n         bits_per_pixel = atoi(argv[2]);\n    else\n         Usage();\n\n    switch (bits_per_pixel) {\n        case 8:\n            nchunks = 16;\n            chunk_size = 32;\n            break;\n        case 4:\n            nchunks = 4;\n            chunk_size = 128;\n            break;\n        case 2:\n            nchunks = 2;\n            chunk_size = 256;\n            break;\n\tcase 1:\n\t    nchunks = 2;\n\t    chunk_size = 256;\n\t    break;\n        default:\n            Usage();\n    }\n\n    if (bits_per_pixel != 1) {\n\tcmsize = nchunks * nchunks;\n    } else {\n\tcmsize = 2;\n    }\n    red = (uint16 *) malloc(cmsize * sizeof(uint16));\n    green = (uint16 *) malloc(cmsize * sizeof(uint16));\n    blue = (uint16 *) malloc(cmsize * sizeof(uint16));\n\n    switch (bits_per_pixel) {\n    case 8:\n        for (i = 0; i < cmsize; i++) {\n            if (i < 32)\n                red[i] = 0;\n            else if (i < 64)\n                red[i] = SCALE(36);\n            else if (i < 96)\n                red[i] = SCALE(73);\n            else if (i < 128)\n                red[i] = SCALE(109);\n            else if (i < 160)\n                red[i] = SCALE(146);\n            else if (i < 192)\n                red[i] = SCALE(182);\n            else if (i < 224)\n                red[i] = SCALE(219);\n            else if (i < 256)\n                red[i] = SCALE(255);\n\n            if ((i % 32) < 4)\n                green[i] = 0;\n            else if (i < 8)\n                green[i] = SCALE(36);\n            else if ((i % 32) < 12)\n                green[i] = SCALE(73);\n            else if ((i % 32) < 16)\n                green[i] = SCALE(109);\n            else if ((i % 32) < 20)\n                green[i] = SCALE(146);\n            else if ((i % 32) < 24)\n                green[i] = SCALE(182);\n            else if ((i % 32) < 28)\n                green[i] = SCALE(219);\n            else if ((i % 32) < 32)\n                green[i] = SCALE(255);\n\n            if ((i % 4) == 0)\n                blue[i] = SCALE(0);\n            else if ((i % 4) == 1)\n                blue[i] = SCALE(85);\n            else if ((i % 4) == 2)\n                blue[i] = SCALE(170);\n            else if ((i % 4) == 3)\n                blue[i] = SCALE(255);\n        }\n        break;\n    case 4:\n        red[0] = SCALE(255);\n        green[0] = 0;\n        blue[0] = 0;\n\n        red[1] = 0;\n        green[1] = SCALE(255);\n        blue[1] = 0;\n\n        red[2] = 0;\n        green[2] = 0;\n        blue[2] = SCALE(255);\n\n        red[3] = SCALE(255);\n        green[3] = SCALE(255);\n        blue[3] = SCALE(255);\n\n        red[4] = 0;\n        green[4] = SCALE(255);\n        blue[4] = SCALE(255);\n\n        red[5] = SCALE(255);\n        green[5] = 0;\n        blue[5] = SCALE(255);\n\n        red[6] = SCALE(255);\n        green[6] = SCALE(255);\n        blue[6] = 0;\n\n        red[7] = 0;\n        green[7] = 0;\n        blue[7] = 0;\n\n        red[8] = SCALE(176);\n        green[8] = SCALE(224);\n        blue[8] = SCALE(230);\n        red[9] = SCALE(100);\n        green[9] = SCALE(149);\n        blue[9] = SCALE(237);\n        red[10] = SCALE(46);\n        green[10] = SCALE(139);\n        blue[10] = SCALE(87);\n        red[11] = SCALE(160);\n        green[11] = SCALE(82);\n        blue[11] = SCALE(45);\n        red[12] = SCALE(238);\n        green[12] = SCALE(130);\n        blue[12] = SCALE(238);\n        red[13] = SCALE(176);\n        green[13] = SCALE(48);\n        blue[13] = SCALE(96);\n        red[14] = SCALE(50);\n        green[14] = SCALE(205);\n        blue[14] = SCALE(50);\n        red[15] = SCALE(240);\n        green[15] = SCALE(152);\n        blue[15] = SCALE(35);\n        break;\n    case 2:\n        red[0] = SCALE(255);\n        green[0] = 0;\n        blue[0] = 0;\n\n        red[1] = 0;\n        green[1] = SCALE(255);\n        blue[1] = 0;\n\n        red[2] = 0;\n        green[2] = 0;\n        blue[2] = SCALE(255);\n        red[3] = SCALE(255);\n        green[3] = SCALE(255);\n        blue[3] = SCALE(255);\n        break;\n    case 1:\n        red[0] = 0;\n        green[0] = 0;\n        blue[0] = 0;\n\n        red[1] = SCALE(255);\n        green[1] = SCALE(255);\n        blue[1] = SCALE(255);\n        break;\n    }\n\n    if ((tif = TIFFOpen(argv[3], \"w\")) == NULL) {\n        fprintf(stderr, \"can't open %s as a TIFF file\\n\", argv[3]);\n        return 0;\n    }\n\n    TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, WIDTH);\n    TIFFSetField(tif, TIFFTAG_IMAGELENGTH, HEIGHT);\n    TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, bits_per_pixel);\n    TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_NONE);\n    TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_PALETTE);\n    TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 1);\n    TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, 1);\n    TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);\n    TIFFSetField(tif, TIFFTAG_RESOLUTIONUNIT, RESUNIT_NONE);\n    TIFFSetField(tif, TIFFTAG_COLORMAP, red, green, blue);\n\n    scan_line = (unsigned char *) malloc(WIDTH / (8 / bits_per_pixel));\n\n    for (i = 0; i < HEIGHT; i++) {\n        for (j = 0, k = 0; j < WIDTH;) {\n            cmap_index = (j / chunk_size) + ((i / chunk_size) * nchunks);\n\n            switch (bits_per_pixel) {\n            case 8:\n                scan_line[k++] = cmap_index;\n                j++;\n                break;\n            case 4:\n                scan_line[k++] = (cmap_index << 4) + cmap_index;\n                j += 2;\n                break;\n            case 2:\n                scan_line[k++] = (cmap_index << 6) + (cmap_index << 4)\n                    + (cmap_index << 2) + cmap_index;\n                j += 4;\n                break;\n\t    case 1:\n\t\tscan_line[k++] =\n\t\t\t((j / chunk_size) == (i / chunk_size)) ? 0x00 : 0xff;\n\t\tj += 8;\n\t\tbreak;\n            }\n        }\n        TIFFWriteScanline(tif, scan_line, i, 0);\n    }\n\n    free(scan_line);\n    TIFFClose(tif);\n    return 0;\n}\n\nvoid\nUsage()\n{\n    fprintf(stderr, \"Usage: %s -depth (8 | 4 | 2 | 1) tiff-image\\n\", programName);\n    exit(0);\n}\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/dbs/tiff-rgb.c",
    "content": "/* $Id: tiff-rgb.c,v 1.3 2004/09/03 08:29:16 dron Exp $ */\n\n/*\n * tiff-rgb.c -- create a 24-bit Class R (rgb) TIFF file\n *\n * Copyright 1990 by Digital Equipment Corporation, Maynard, Massachusetts.\n *\n *                        All Rights Reserved\n *\n * Permission to use, copy, modify, and distribute this software and its\n * documentation for any purpose and without fee is hereby granted,\n * provided that the above copyright notice appear in all copies and that\n * both that copyright notice and this permission notice appear in\n * supporting documentation, and that the name of Digital not be\n * used in advertising or publicity pertaining to distribution of the\n * software without specific, written prior permission.\n *\n * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING\n * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL\n * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR\n * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,\n * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS\n * SOFTWARE.\n */\n\n#include <math.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n#include \"tiffio.h\"\n\n#define ROUND(x)    (uint16) ((x) + 0.5)\n#define CMSIZE      256\n#define WIDTH       525\n#define HEIGHT      512\n#define TIFF_GAMMA  2.2\n\nvoid                Usage();\nchar *              programName;\n\nint main(int argc, char **argv)\n{\n    char *          input_file = NULL;\n    double          image_gamma = TIFF_GAMMA;\n    int             i, j;\n    TIFF *          tif;\n    unsigned char * scan_line;\n    uint16          red[CMSIZE], green[CMSIZE], blue[CMSIZE];\n    float\t    refblackwhite[2*3];\n\n    programName = argv[0];\n\n    switch (argc) {\n    case 2:\n        image_gamma = TIFF_GAMMA;\n        input_file = argv[1];\n        break;\n    case 4:\n        if (!strcmp(argv[1], \"-gamma\")) {\n            image_gamma = atof(argv[2]);\n            input_file = argv[3];\n        } else\n            Usage();\n        break;\n    default:\n        Usage();\n    }\n\n    for (i = 0; i < CMSIZE; i++) {\n        if (i == 0)\n            red[i] = green[i] = blue[i] = 0;\n        else {\n            red[i] = ROUND((pow(i / 255.0, 1.0 / image_gamma) * 65535.0));\n            green[i] = ROUND((pow(i / 255.0, 1.0 / image_gamma) * 65535.0));\n            blue[i] = ROUND((pow(i / 255.0, 1.0 / image_gamma) * 65535.0));\n        }\n    }\n    refblackwhite[0] = 0.0; refblackwhite[1] = 255.0;\n    refblackwhite[2] = 0.0; refblackwhite[3] = 255.0;\n    refblackwhite[4] = 0.0; refblackwhite[5] = 255.0;\n\n    if ((tif = TIFFOpen(input_file, \"w\")) == NULL) {\n        fprintf(stderr, \"can't open %s as a TIFF file\\n\", input_file);\n        exit(0);\n    }\n\n    TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, WIDTH);\n    TIFFSetField(tif, TIFFTAG_IMAGELENGTH, HEIGHT);\n    TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 8);\n    TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_NONE);\n    TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB);\n    TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 3);\n    TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, 1);\n    TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);\n    TIFFSetField(tif, TIFFTAG_RESOLUTIONUNIT, RESUNIT_NONE);\n#ifdef notdef\n    TIFFSetField(tif, TIFFTAG_WHITEPOINT, whitex, whitey);\n    TIFFSetField(tif, TIFFTAG_PRIMARYCHROMATICITIES, primaries);\n#endif\n    TIFFSetField(tif, TIFFTAG_REFERENCEBLACKWHITE, refblackwhite);\n    TIFFSetField(tif, TIFFTAG_TRANSFERFUNCTION, red, green, blue);\n\n    scan_line = (unsigned char *) malloc(WIDTH * 3);\n\n    for (i = 0; i < 255; i++) {\n        for (j = 0; j < 75; j++) {\n             scan_line[j * 3] = 255;\n             scan_line[(j * 3) + 1] = 255 - i;\n             scan_line[(j * 3) + 2] = 255 - i;\n        }\n        for (j = 75; j < 150; j++) {\n             scan_line[j * 3] = 255 - i;\n             scan_line[(j * 3) + 1] = 255;\n             scan_line[(j * 3) + 2] = 255 - i;\n        }\n        for (j = 150; j < 225; j++) {\n             scan_line[j * 3] = 255 - i;\n             scan_line[(j * 3) + 1] = 255 - i;\n             scan_line[(j * 3) + 2] = 255;\n        }\n        for (j = 225; j < 300; j++) {\n             scan_line[j * 3] = (i - 1) / 2;\n             scan_line[(j * 3) + 1] = (i - 1) / 2;\n             scan_line[(j * 3) + 2] = (i - 1) / 2;\n        }\n        for (j = 300; j < 375; j++) {\n             scan_line[j * 3] = 255 - i;\n             scan_line[(j * 3) + 1] = 255;\n             scan_line[(j * 3) + 2] = 255;\n        }\n        for (j = 375; j < 450; j++) {\n             scan_line[j * 3] = 255;\n             scan_line[(j * 3) + 1] = 255 - i;\n             scan_line[(j * 3) + 2] = 255;\n        }\n        for (j = 450; j < 525; j++) {\n             scan_line[j * 3] = 255;\n             scan_line[(j * 3) + 1] = 255;\n             scan_line[(j * 3) + 2] = 255 - i;\n        }\n        TIFFWriteScanline(tif, scan_line, i, 0);\n    }\n    for (i = 255; i < 512; i++) {\n        for (j = 0; j < 75; j++) {\n             scan_line[j * 3] = i;\n             scan_line[(j * 3) + 1] = 0;\n             scan_line[(j * 3) + 2] = 0;\n        }\n        for (j = 75; j < 150; j++) {\n             scan_line[j * 3] = 0;\n             scan_line[(j * 3) + 1] = i;\n             scan_line[(j * 3) + 2] = 0;\n        }\n        for (j = 150; j < 225; j++) {\n             scan_line[j * 3] = 0;\n             scan_line[(j * 3) + 1] = 0;\n             scan_line[(j * 3) + 2] = i;\n        }\n        for (j = 225; j < 300; j++) {\n             scan_line[j * 3] = (i - 1) / 2;\n             scan_line[(j * 3) + 1] = (i - 1) / 2;\n             scan_line[(j * 3) + 2] = (i - 1) / 2;\n        }\n        for (j = 300; j < 375; j++) {\n             scan_line[j * 3] = 0;\n             scan_line[(j * 3) + 1] = i;\n             scan_line[(j * 3) + 2] = i;\n        }\n        for (j = 375; j < 450; j++) {\n             scan_line[j * 3] = i;\n             scan_line[(j * 3) + 1] = 0;\n             scan_line[(j * 3) + 2] = i;\n        }\n        for (j = 450; j < 525; j++) {\n             scan_line[j * 3] = i;\n             scan_line[(j * 3) + 1] = i;\n             scan_line[(j * 3) + 2] = 0;\n        }\n        TIFFWriteScanline(tif, scan_line, i, 0);\n    }\n\n    free(scan_line);\n    TIFFClose(tif);\n    exit(0);\n}\n\nvoid\nUsage()\n{\n    fprintf(stderr, \"Usage: %s -gamma gamma tiff-image\\n\", programName);\n    exit(0);\n}\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/dbs/xtiff/Makefile.am",
    "content": "# $Id: Makefile.am,v 1.4 2007/02/24 15:03:49 dron Exp $\n#\n# Tag Image File Format (TIFF) Software\n#\n# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>\n#\n# Permission to use, copy, modify, distribute, and sell this software and \n# its documentation for any purpose is hereby granted without fee, provided\n# that (i) the above copyright notices and this permission notice appear in\n# all copies of the software and related documentation, and (ii) the names of\n# Sam Leffler and Silicon Graphics may not be used in any advertising or\n# publicity relating to the software without the specific, prior written\n# permission of Sam Leffler and Silicon Graphics.\n# \n# THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n# \n# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n# OF THIS SOFTWARE.\n\n# Process this file with automake to produce Makefile.in.\n\n#LIBTIFF = $(top_builddir)/libtiff/libtiff.la\n\nEXTRA_DIST = README patchlevel.h xtiff.c xtifficon.h\n\n#noinst_PROGRAMS =\n\n#if HAVE_XAW\n#noinst_PROGRAMS += xtiff\n#endif\n\n#xtiff_SOURCES = patchlevel.h xtiff.c xtifficon.h\n#xtiff_CFLAGS = $(CFLAGS) $(XAW_CFLAGS) $(AM_CFLAGS)\n#xtiff_LDADD = $(LIBTIFF) $(X_LIBS) $(XAW_LIBS)\n\n#INCLUDES = -I$(top_srcdir)/libtiff\n\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/dbs/xtiff/Makefile.in",
    "content": "# Makefile.in generated by automake 1.11 from Makefile.am.\n# @configure_input@\n\n# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,\n# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,\n# Inc.\n# This Makefile.in is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY, to the extent permitted by law; without\n# even the implied warranty of MERCHANTABILITY or FITNESS FOR A\n# PARTICULAR PURPOSE.\n\n@SET_MAKE@\n\n# $Id: Makefile.am,v 1.4 2007/02/24 15:03:49 dron Exp $\n#\n# Tag Image File Format (TIFF) Software\n#\n# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>\n#\n# Permission to use, copy, modify, distribute, and sell this software and \n# its documentation for any purpose is hereby granted without fee, provided\n# that (i) the above copyright notices and this permission notice appear in\n# all copies of the software and related documentation, and (ii) the names of\n# Sam Leffler and Silicon Graphics may not be used in any advertising or\n# publicity relating to the software without the specific, prior written\n# permission of Sam Leffler and Silicon Graphics.\n# \n# THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n# \n# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n# OF THIS SOFTWARE.\n\n# Process this file with automake to produce Makefile.in.\n\n#LIBTIFF = $(top_builddir)/libtiff/libtiff.la\nVPATH = @srcdir@\npkgdatadir = $(datadir)/@PACKAGE@\npkgincludedir = $(includedir)/@PACKAGE@\npkglibdir = $(libdir)/@PACKAGE@\npkglibexecdir = $(libexecdir)/@PACKAGE@\nam__cd = CDPATH=\"$${ZSH_VERSION+.}$(PATH_SEPARATOR)\" && cd\ninstall_sh_DATA = $(install_sh) -c -m 644\ninstall_sh_PROGRAM = $(install_sh) -c\ninstall_sh_SCRIPT = $(install_sh) -c\nINSTALL_HEADER = $(INSTALL_DATA)\ntransform = $(program_transform_name)\nNORMAL_INSTALL = :\nPRE_INSTALL = :\nPOST_INSTALL = :\nNORMAL_UNINSTALL = :\nPRE_UNINSTALL = :\nPOST_UNINSTALL = :\nbuild_triplet = @build@\nhost_triplet = @host@\ntarget_triplet = @target@\nsubdir = contrib/dbs/xtiff\nDIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in\nACLOCAL_M4 = $(top_srcdir)/aclocal.m4\nam__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \\\n\t$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \\\n\t$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \\\n\t$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac\nam__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \\\n\t$(ACLOCAL_M4)\nmkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs\nCONFIG_HEADER = $(top_builddir)/libtiff/tif_config.h \\\n\t$(top_builddir)/libtiff/tiffconf.h\nCONFIG_CLEAN_FILES =\nCONFIG_CLEAN_VPATH_FILES =\nAM_V_GEN = $(am__v_GEN_$(V))\nam__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))\nam__v_GEN_0 = @echo \"  GEN   \" $@;\nAM_V_at = $(am__v_at_$(V))\nam__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))\nam__v_at_0 = @\nSOURCES =\nDIST_SOURCES =\nDISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)\nACLOCAL = @ACLOCAL@\nAMTAR = @AMTAR@\nAM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@\nAR = @AR@\nAS = @AS@\nAUTOCONF = @AUTOCONF@\nAUTOHEADER = @AUTOHEADER@\nAUTOMAKE = @AUTOMAKE@\nAWK = @AWK@\nCC = @CC@\nCCDEPMODE = @CCDEPMODE@\nCFLAGS = @CFLAGS@\nCPP = @CPP@\nCPPFLAGS = @CPPFLAGS@\nCXX = @CXX@\nCXXCPP = @CXXCPP@\nCXXDEPMODE = @CXXDEPMODE@\nCXXFLAGS = @CXXFLAGS@\nCYGPATH_W = @CYGPATH_W@\nDEFS = @DEFS@\nDEPDIR = @DEPDIR@\nDLLTOOL = @DLLTOOL@\nDSYMUTIL = @DSYMUTIL@\nDUMPBIN = @DUMPBIN@\nECHO_C = @ECHO_C@\nECHO_N = @ECHO_N@\nECHO_T = @ECHO_T@\nEGREP = @EGREP@\nEXEEXT = @EXEEXT@\nFGREP = @FGREP@\nGLUT_CFLAGS = @GLUT_CFLAGS@\nGLUT_LIBS = @GLUT_LIBS@\nGLU_CFLAGS = @GLU_CFLAGS@\nGLU_LIBS = @GLU_LIBS@\nGL_CFLAGS = @GL_CFLAGS@\nGL_LIBS = @GL_LIBS@\nGREP = @GREP@\nINSTALL = @INSTALL@\nINSTALL_DATA = @INSTALL_DATA@\nINSTALL_PROGRAM = @INSTALL_PROGRAM@\nINSTALL_SCRIPT = @INSTALL_SCRIPT@\nINSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@\nLD = @LD@\nLDFLAGS = @LDFLAGS@\nLIBDIR = @LIBDIR@\nLIBOBJS = @LIBOBJS@\nLIBS = @LIBS@\nLIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@\nLIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@\nLIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@\nLIBTIFF_MICRO_VERSION = @LIBTIFF_MICRO_VERSION@\nLIBTIFF_MINOR_VERSION = @LIBTIFF_MINOR_VERSION@\nLIBTIFF_RELEASE_DATE = @LIBTIFF_RELEASE_DATE@\nLIBTIFF_VERSION = @LIBTIFF_VERSION@\nLIBTIFF_VERSION_INFO = @LIBTIFF_VERSION_INFO@\nLIBTOOL = @LIBTOOL@\nLIPO = @LIPO@\nLN_S = @LN_S@\nLTLIBOBJS = @LTLIBOBJS@\nMAINT = @MAINT@\nMAKEINFO = @MAKEINFO@\nMKDIR_P = @MKDIR_P@\nNM = @NM@\nNMEDIT = @NMEDIT@\nOBJDUMP = @OBJDUMP@\nOBJEXT = @OBJEXT@\nOTOOL = @OTOOL@\nOTOOL64 = @OTOOL64@\nPACKAGE = @PACKAGE@\nPACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@\nPACKAGE_NAME = @PACKAGE_NAME@\nPACKAGE_STRING = @PACKAGE_STRING@\nPACKAGE_TARNAME = @PACKAGE_TARNAME@\nPACKAGE_URL = @PACKAGE_URL@\nPACKAGE_VERSION = @PACKAGE_VERSION@\nPATH_SEPARATOR = @PATH_SEPARATOR@\nPTHREAD_CC = @PTHREAD_CC@\nPTHREAD_CFLAGS = @PTHREAD_CFLAGS@\nPTHREAD_LIBS = @PTHREAD_LIBS@\nRANLIB = @RANLIB@\nSED = @SED@\nSET_MAKE = @SET_MAKE@\nSHELL = @SHELL@\nSTRIP = @STRIP@\nVERSION = @VERSION@\nXMKMF = @XMKMF@\nX_CFLAGS = @X_CFLAGS@\nX_EXTRA_LIBS = @X_EXTRA_LIBS@\nX_LIBS = @X_LIBS@\nX_PRE_LIBS = @X_PRE_LIBS@\nabs_builddir = @abs_builddir@\nabs_srcdir = @abs_srcdir@\nabs_top_builddir = @abs_top_builddir@\nabs_top_srcdir = @abs_top_srcdir@\nac_ct_CC = @ac_ct_CC@\nac_ct_CXX = @ac_ct_CXX@\nac_ct_DUMPBIN = @ac_ct_DUMPBIN@\nacx_pthread_config = @acx_pthread_config@\nam__include = @am__include@\nam__leading_dot = @am__leading_dot@\nam__quote = @am__quote@\nam__tar = @am__tar@\nam__untar = @am__untar@\nbindir = @bindir@\nbuild = @build@\nbuild_alias = @build_alias@\nbuild_cpu = @build_cpu@\nbuild_os = @build_os@\nbuild_vendor = @build_vendor@\nbuilddir = @builddir@\ndatadir = @datadir@\ndatarootdir = @datarootdir@\ndocdir = @docdir@\ndvidir = @dvidir@\nexec_prefix = @exec_prefix@\nhost = @host@\nhost_alias = @host_alias@\nhost_cpu = @host_cpu@\nhost_os = @host_os@\nhost_vendor = @host_vendor@\nhtmldir = @htmldir@\nincludedir = @includedir@\ninfodir = @infodir@\ninstall_sh = @install_sh@\nlibdir = @libdir@\nlibexecdir = @libexecdir@\nlocaledir = @localedir@\nlocalstatedir = @localstatedir@\nlt_ECHO = @lt_ECHO@\nmandir = @mandir@\nmkdir_p = @mkdir_p@\noldincludedir = @oldincludedir@\npdfdir = @pdfdir@\nprefix = @prefix@\nprogram_transform_name = @program_transform_name@\npsdir = @psdir@\nsbindir = @sbindir@\nsharedstatedir = @sharedstatedir@\nsrcdir = @srcdir@\nsysconfdir = @sysconfdir@\ntarget = @target@\ntarget_alias = @target_alias@\ntarget_cpu = @target_cpu@\ntarget_os = @target_os@\ntarget_vendor = @target_vendor@\ntop_build_prefix = @top_build_prefix@\ntop_builddir = @top_builddir@\ntop_srcdir = @top_srcdir@\nEXTRA_DIST = README patchlevel.h xtiff.c xtifficon.h\nall: all-am\n\n.SUFFIXES:\n$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)\n\t@for dep in $?; do \\\n\t  case '$(am__configure_deps)' in \\\n\t    *$$dep*) \\\n\t      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \\\n\t        && { if test -f $@; then exit 0; else break; fi; }; \\\n\t      exit 1;; \\\n\t  esac; \\\n\tdone; \\\n\techo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign contrib/dbs/xtiff/Makefile'; \\\n\t$(am__cd) $(top_srcdir) && \\\n\t  $(AUTOMAKE) --foreign contrib/dbs/xtiff/Makefile\n.PRECIOUS: Makefile\nMakefile: $(srcdir)/Makefile.in $(top_builddir)/config.status\n\t@case '$?' in \\\n\t  *config.status*) \\\n\t    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \\\n\t  *) \\\n\t    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \\\n\t    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \\\n\tesac;\n\n$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n\n$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n$(am__aclocal_m4_deps):\n\nmostlyclean-libtool:\n\t-rm -f *.lo\n\nclean-libtool:\n\t-rm -rf .libs _libs\ntags: TAGS\nTAGS:\n\nctags: CTAGS\nCTAGS:\n\n\ndistdir: $(DISTFILES)\n\t@srcdirstrip=`echo \"$(srcdir)\" | sed 's/[].[^$$\\\\*]/\\\\\\\\&/g'`; \\\n\ttopsrcdirstrip=`echo \"$(top_srcdir)\" | sed 's/[].[^$$\\\\*]/\\\\\\\\&/g'`; \\\n\tlist='$(DISTFILES)'; \\\n\t  dist_files=`for file in $$list; do echo $$file; done | \\\n\t  sed -e \"s|^$$srcdirstrip/||;t\" \\\n\t      -e \"s|^$$topsrcdirstrip/|$(top_builddir)/|;t\"`; \\\n\tcase $$dist_files in \\\n\t  */*) $(MKDIR_P) `echo \"$$dist_files\" | \\\n\t\t\t   sed '/\\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \\\n\t\t\t   sort -u` ;; \\\n\tesac; \\\n\tfor file in $$dist_files; do \\\n\t  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \\\n\t  if test -d $$d/$$file; then \\\n\t    dir=`echo \"/$$file\" | sed -e 's,/[^/]*$$,,'`; \\\n\t    if test -d \"$(distdir)/$$file\"; then \\\n\t      find \"$(distdir)/$$file\" -type d ! -perm -700 -exec chmod u+rwx {} \\;; \\\n\t    fi; \\\n\t    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \\\n\t      cp -fpR $(srcdir)/$$file \"$(distdir)$$dir\" || exit 1; \\\n\t      find \"$(distdir)/$$file\" -type d ! -perm -700 -exec chmod u+rwx {} \\;; \\\n\t    fi; \\\n\t    cp -fpR $$d/$$file \"$(distdir)$$dir\" || exit 1; \\\n\t  else \\\n\t    test -f \"$(distdir)/$$file\" \\\n\t    || cp -p $$d/$$file \"$(distdir)/$$file\" \\\n\t    || exit 1; \\\n\t  fi; \\\n\tdone\ncheck-am: all-am\ncheck: check-am\nall-am: Makefile\ninstalldirs:\ninstall: install-am\ninstall-exec: install-exec-am\ninstall-data: install-data-am\nuninstall: uninstall-am\n\ninstall-am: all-am\n\t@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am\n\ninstallcheck: installcheck-am\ninstall-strip:\n\t$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM=\"$(INSTALL_STRIP_PROGRAM)\" \\\n\t  install_sh_PROGRAM=\"$(INSTALL_STRIP_PROGRAM)\" INSTALL_STRIP_FLAG=-s \\\n\t  `test -z '$(STRIP)' || \\\n\t    echo \"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'\"` install\nmostlyclean-generic:\n\nclean-generic:\n\ndistclean-generic:\n\t-test -z \"$(CONFIG_CLEAN_FILES)\" || rm -f $(CONFIG_CLEAN_FILES)\n\t-test . = \"$(srcdir)\" || test -z \"$(CONFIG_CLEAN_VPATH_FILES)\" || rm -f $(CONFIG_CLEAN_VPATH_FILES)\n\nmaintainer-clean-generic:\n\t@echo \"This command is intended for maintainers to use\"\n\t@echo \"it deletes files that may require special tools to rebuild.\"\nclean: clean-am\n\nclean-am: clean-generic clean-libtool mostlyclean-am\n\ndistclean: distclean-am\n\t-rm -f Makefile\ndistclean-am: clean-am distclean-generic\n\ndvi: dvi-am\n\ndvi-am:\n\nhtml: html-am\n\nhtml-am:\n\ninfo: info-am\n\ninfo-am:\n\ninstall-data-am:\n\ninstall-dvi: install-dvi-am\n\ninstall-dvi-am:\n\ninstall-exec-am:\n\ninstall-html: install-html-am\n\ninstall-html-am:\n\ninstall-info: install-info-am\n\ninstall-info-am:\n\ninstall-man:\n\ninstall-pdf: install-pdf-am\n\ninstall-pdf-am:\n\ninstall-ps: install-ps-am\n\ninstall-ps-am:\n\ninstallcheck-am:\n\nmaintainer-clean: maintainer-clean-am\n\t-rm -f Makefile\nmaintainer-clean-am: distclean-am maintainer-clean-generic\n\nmostlyclean: mostlyclean-am\n\nmostlyclean-am: mostlyclean-generic mostlyclean-libtool\n\npdf: pdf-am\n\npdf-am:\n\nps: ps-am\n\nps-am:\n\nuninstall-am:\n\n.MAKE: install-am install-strip\n\n.PHONY: all all-am check check-am clean clean-generic clean-libtool \\\n\tdistclean distclean-generic distclean-libtool distdir dvi \\\n\tdvi-am html html-am info info-am install install-am \\\n\tinstall-data install-data-am install-dvi install-dvi-am \\\n\tinstall-exec install-exec-am install-html install-html-am \\\n\tinstall-info install-info-am install-man install-pdf \\\n\tinstall-pdf-am install-ps install-ps-am install-strip \\\n\tinstallcheck installcheck-am installdirs maintainer-clean \\\n\tmaintainer-clean-generic mostlyclean mostlyclean-generic \\\n\tmostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am\n\n\n#noinst_PROGRAMS =\n\n#if HAVE_XAW\n#noinst_PROGRAMS += xtiff\n#endif\n\n#xtiff_SOURCES = patchlevel.h xtiff.c xtifficon.h\n#xtiff_CFLAGS = $(CFLAGS) $(XAW_CFLAGS) $(AM_CFLAGS)\n#xtiff_LDADD = $(LIBTIFF) $(X_LIBS) $(XAW_LIBS)\n\n#INCLUDES = -I$(top_srcdir)/libtiff\n\n# Tell versions [3.59,3.63) of GNU make to not export all variables.\n# Otherwise a system limit (for SysV at least) may be exceeded.\n.NOEXPORT:\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/dbs/xtiff/README",
    "content": "xtiff 2.0\n\nxtiff is a tool for viewing a TIFF file in an X window.  It was written to\nhandle as many different kinds of TIFF files as possible while remaining\nsimple, portable and efficient.  xtiff requires X11 R4, the Athena Widgets\nand Sam Leffler's libtiff package (which can be found on ucbvax.berkeley.edu).\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/dbs/xtiff/patchlevel.h",
    "content": "#define PATCHLEVEL 0\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/dbs/xtiff/xtiff.c",
    "content": "/*\n * $Id: xtiff.c,v 1.2 2006/10/13 10:16:22 dron Exp $\n *\n * xtiff - view a TIFF file in an X window\n *\n * Dan Sears\n * Chris Sears\n *\n * Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts.\n *\n *                      All Rights Reserved\n *\n * Permission to use, copy, modify, and distribute this software and its\n * documentation for any purpose and without fee is hereby granted,\n * provided that the above copyright notice appear in all copies and that\n * both that copyright notice and this permission notice appear in\n * supporting documentation, and that the name of Digital not be\n * used in advertising or publicity pertaining to distribution of the\n * software without specific, written prior permission.\n *\n * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING\n * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL\n * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR\n * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,\n * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS\n * SOFTWARE.\n *\n * Revision 1.0  90/05/07\n *      Initial release.\n * Revision 2.0  90/12/20\n *      Converted to use the Athena Widgets and the Xt Intrinsics.\n *\n * Notes:\n *\n * According to the TIFF 5.0 Specification, it is possible to have\n * both a TIFFTAG_COLORMAP and a TIFFTAG_COLORRESPONSECURVE.  This\n * doesn't make sense since a TIFFTAG_COLORMAP is 16 bits wide and\n * a TIFFTAG_COLORRESPONSECURVE is tfBitsPerSample bits wide for each\n * channel.  This is probably a bug in the specification.\n * In this case, TIFFTAG_COLORRESPONSECURVE is ignored.\n * This might make sense if TIFFTAG_COLORMAP was 8 bits wide.\n *\n * TIFFTAG_COLORMAP is often incorrectly written as ranging from\n * 0 to 255 rather than from 0 to 65535.  CheckAndCorrectColormap()\n * takes care of this.\n *\n * Only ORIENTATION_TOPLEFT is supported correctly.  This is the\n * default TIFF and X orientation.  Other orientations will be\n * displayed incorrectly.\n *\n * There is no support for or use of 3/3/2 DirectColor visuals.\n * TIFFTAG_MINSAMPLEVALUE and TIFFTAG_MAXSAMPLEVALUE are not supported.\n *\n * Only TIFFTAG_BITSPERSAMPLE values that are 1, 2, 4 or 8 are supported.\n */\n#include <math.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <tiffio.h>\n#include <X11/Xatom.h>\n#include <X11/Intrinsic.h>\n#include <X11/StringDefs.h>\n#include <X11/Xproto.h>\n#include <X11/Shell.h>\n#include <X11/Xaw/Form.h>\n#include <X11/Xaw/List.h>\n#include <X11/Xaw/Label.h>\n#include <X11/cursorfont.h>\n#define XK_MISCELLANY\n#include <X11/keysymdef.h>\n#include \"xtifficon.h\"\n\n#define TIFF_GAMMA      \"2.2\"     /* default gamma from the TIFF 5.0 spec */\n#define ROUND(x)        (uint16) ((x) + 0.5)\n#define SCALE(x, s)     (((x) * 65535L) / (s))\n#define MCHECK(m)       if (!m) { fprintf(stderr, \"malloc failed\\n\"); exit(0); }\n#define MIN(a, b)       (((a) < (b)) ? (a) : (b))\n#define MAX(a, b)       (((a) > (b)) ? (a) : (b))\n#define VIEWPORT_WIDTH  700\n#define VIEWPORT_HEIGHT 500\n#define KEY_TRANSLATE   20\n\n#ifdef __STDC__\n#define PP(args)    args\n#else\n#define PP(args)    ()\n#endif\n\nint main PP((int argc, char **argv));\nvoid OpenTIFFFile PP((void));\nvoid GetTIFFHeader PP((void));\nvoid SetNameLabel PP((void));\nvoid CheckAndCorrectColormap PP((void));\nvoid SimpleGammaCorrection PP((void));\nvoid GetVisual PP((void));\nBoolean SearchVisualList PP((int image_depth,\n    int visual_class, Visual **visual));\nvoid GetTIFFImage PP((void));\nvoid CreateXImage PP((void));\nXtCallbackProc SelectProc PP((Widget w, caddr_t unused_1, caddr_t unused_2));\nvoid QuitProc PP((void));\nvoid NextProc PP((void));\nvoid PreviousProc PP((void));\nvoid PageProc PP((int direction));\nvoid EventProc PP((Widget widget, caddr_t unused, XEvent *event));\nvoid ResizeProc PP((void));\nint XTiffErrorHandler PP((Display *display, XErrorEvent *error_event));\nvoid Usage PP((void));\n\nint xtVersion = XtSpecificationRelease;     /* xtiff depends on R4 or higher */\n\n/*\n * Xt data structures\n */\nWidget shellWidget, formWidget, listWidget, labelWidget, imageWidget;\n\nenum { ButtonQuit = 0, ButtonPreviousPage = 1, ButtonNextPage = 2 };\n\nString buttonStrings[] = { \"Quit\", \"Previous\", \"Next\" };\n\nstatic XrmOptionDescRec shellOptions[] = {\n    { \"-help\", \"*help\", XrmoptionNoArg, (caddr_t) \"True\" },\n    { \"-gamma\", \"*gamma\", XrmoptionSepArg, NULL },\n    { \"-usePixmap\", \"*usePixmap\", XrmoptionSepArg, NULL },\n    { \"-viewportWidth\", \"*viewportWidth\", XrmoptionSepArg, NULL },\n    { \"-viewportHeight\", \"*viewportHeight\", XrmoptionSepArg, NULL },\n    { \"-translate\", \"*translate\", XrmoptionSepArg, NULL },\n    { \"-verbose\", \"*verbose\", XrmoptionSepArg, NULL }\n};\n\ntypedef struct {\n    Boolean help;\n    float gamma;\n    Boolean usePixmap;\n    uint32 viewportWidth;\n    uint32 viewportHeight;\n    int translate;\n    Boolean verbose;\n} AppData, *AppDataPtr;\n\nAppData appData;\n\nXtResource clientResources[] = {\n    {\n        \"help\", XtCBoolean, XtRBoolean, sizeof(Boolean),\n        XtOffset(AppDataPtr, help), XtRImmediate, (XtPointer) False\n    }, {\n        \"gamma\", \"Gamma\", XtRFloat, sizeof(float),\n        XtOffset(AppDataPtr, gamma), XtRString, (XtPointer) TIFF_GAMMA\n    }, {\n        \"usePixmap\", \"UsePixmap\", XtRBoolean, sizeof(Boolean),\n        XtOffset(AppDataPtr, usePixmap), XtRImmediate, (XtPointer) True\n    }, {\n        \"viewportWidth\", \"ViewportWidth\", XtRInt, sizeof(int),\n        XtOffset(AppDataPtr, viewportWidth), XtRImmediate,\n        (XtPointer) VIEWPORT_WIDTH\n    }, {\n        \"viewportHeight\", \"ViewportHeight\", XtRInt, sizeof(int),\n        XtOffset(AppDataPtr, viewportHeight), XtRImmediate,\n        (XtPointer) VIEWPORT_HEIGHT\n    }, {\n        \"translate\", \"Translate\", XtRInt, sizeof(int),\n        XtOffset(AppDataPtr, translate), XtRImmediate, (XtPointer) KEY_TRANSLATE\n    }, {\n        \"verbose\", \"Verbose\", XtRBoolean, sizeof(Boolean),\n        XtOffset(AppDataPtr, verbose), XtRImmediate, (XtPointer) True\n    }\n};\n\nArg formArgs[] = {\n    { XtNresizable, True }\n};\n\nArg listArgs[] = {\n    { XtNresizable, False },\n    { XtNborderWidth, 0 },\n    { XtNdefaultColumns, 3 },\n    { XtNforceColumns, True },\n    { XtNlist, (int) buttonStrings },\n    { XtNnumberStrings, XtNumber(buttonStrings) },\n    { XtNtop, XtChainTop },\n    { XtNleft, XtChainLeft },\n    { XtNbottom, XtChainTop },\n    { XtNright, XtChainLeft }\n};\n\nArg labelArgs[] = {\n    { XtNresizable, False },\n    { XtNwidth, 200 },\n    { XtNborderWidth, 0 },\n    { XtNjustify, XtJustifyLeft },\n    { XtNtop, XtChainTop },\n    { XtNleft, XtChainLeft },\n    { XtNbottom, XtChainTop },\n    { XtNright, XtChainLeft }\n};\n\nArg imageArgs[] = {\n    { XtNresizable, True },\n    { XtNborderWidth, 0 },\n    { XtNtop, XtChainTop },\n    { XtNleft, XtChainLeft },\n    { XtNbottom, XtChainTop },\n    { XtNright, XtChainLeft }\n};\n\nXtActionsRec actionsTable[] = {\n    { \"quit\", QuitProc },\n    { \"next\", NextProc },\n    { \"previous\", PreviousProc },\n    { \"notifyresize\", ResizeProc }\n};\n\nchar translationsTable[] = \"<Key>q:      quit() \\n \\\n                            <Key>Q:      quit() \\n \\\n                            <Message>WM_PROTOCOLS: quit()\\n \\\n                            <Key>p:      previous() \\n \\\n                            <Key>P:      previous() \\n \\\n                            <Key>n:      next() \\n \\\n                            <Key>N:      next() \\n \\\n                            <Configure>: notifyresize()\";\n\n/*\n * X data structures\n */\nColormap            xColormap;\nDisplay *           xDisplay;\nPixmap              xImagePixmap;\nVisual *            xVisual;\nXImage *            xImage;\nGC                  xWinGc;\nint                 xImageDepth, xScreen, xRedMask, xGreenMask, xBlueMask,\n                    xOffset = 0, yOffset = 0, grabX = -1, grabY = -1;\nunsigned char       basePixel = 0;\n\n/*\n * TIFF data structures\n */\nTIFF *              tfFile = NULL;\nuint32              tfImageWidth, tfImageHeight;\nuint16              tfBitsPerSample, tfSamplesPerPixel, tfPlanarConfiguration,\n                    tfPhotometricInterpretation, tfGrayResponseUnit,\n                    tfImageDepth, tfBytesPerRow;\nint                 tfDirectory = 0, tfMultiPage = False;\ndouble              tfUnitMap, tfGrayResponseUnitMap[] = {\n                        -1, -10, -100, -1000, -10000, -100000\n                    };\n\n/*\n * display data structures\n */\ndouble              *dRed, *dGreen, *dBlue;\n\n/*\n * shared data structures\n */\nuint16 *            redMap = NULL, *greenMap = NULL, *blueMap = NULL,\n                    *grayMap = NULL, colormapSize;\nchar *             imageMemory;\nchar *              fileName;\n\nint\nmain(int argc, char **argv)\n{\n    XSetWindowAttributes window_attributes;\n    Widget widget_list[3];\n    Arg args[5];\n\n    setbuf(stdout, NULL); setbuf(stderr, NULL);\n\n    shellWidget = XtInitialize(argv[0], \"XTiff\", shellOptions,\n        XtNumber(shellOptions), &argc, argv);\n\n    XSetErrorHandler(XTiffErrorHandler);\n\n    XtGetApplicationResources(shellWidget, &appData,\n        (XtResourceList) clientResources, (Cardinal) XtNumber(clientResources),\n        (ArgList) NULL, (Cardinal) 0);\n\n    if ((argc <= 1) || (argc > 2) || appData.help)\n        Usage();\n\n    if (appData.verbose == False) {\n        TIFFSetErrorHandler(0);\n        TIFFSetWarningHandler(0);\n    }\n\n    fileName = argv[1];\n\n    xDisplay = XtDisplay(shellWidget);\n    xScreen = DefaultScreen(xDisplay);\n\n    OpenTIFFFile();\n    GetTIFFHeader();\n    SimpleGammaCorrection();\n    GetVisual();\n    GetTIFFImage();\n\n    /*\n     * Send visual, colormap, depth and iconPixmap to shellWidget.\n     * Sending the visual to the shell is only possible with the advent of R4.\n     */\n    XtSetArg(args[0], XtNvisual, xVisual);\n    XtSetArg(args[1], XtNcolormap, xColormap);\n    XtSetArg(args[2], XtNdepth,\n        xImageDepth == 1 ? DefaultDepth(xDisplay, xScreen) : xImageDepth);\n    XtSetArg(args[3], XtNiconPixmap,\n        XCreateBitmapFromData(xDisplay, RootWindow(xDisplay, xScreen),\n            xtifficon_bits, xtifficon_width, xtifficon_height));\n    XtSetArg(args[4], XtNallowShellResize, True);\n    XtSetValues(shellWidget, args, 5);\n\n    /*\n     * widget instance hierarchy\n     */\n    formWidget = XtCreateManagedWidget(\"form\", formWidgetClass,\n        shellWidget, formArgs, XtNumber(formArgs));\n\n        widget_list[0] = listWidget = XtCreateWidget(\"list\",\n            listWidgetClass, formWidget, listArgs, XtNumber(listArgs));\n\n        widget_list[1] = labelWidget = XtCreateWidget(\"label\",\n            labelWidgetClass, formWidget, labelArgs, XtNumber(labelArgs));\n\n        widget_list[2] = imageWidget = XtCreateWidget(\"image\",\n            widgetClass, formWidget, imageArgs, XtNumber(imageArgs));\n\n    XtManageChildren(widget_list, XtNumber(widget_list));\n\n    /*\n     * initial widget sizes - for small images let xtiff size itself\n     */\n    if (tfImageWidth >= appData.viewportWidth) {\n        XtSetArg(args[0], XtNwidth, appData.viewportWidth);\n        XtSetValues(shellWidget, args, 1);\n    }\n    if (tfImageHeight >= appData.viewportHeight) {\n        XtSetArg(args[0], XtNheight, appData.viewportHeight);\n        XtSetValues(shellWidget, args, 1);\n    }\n\n    XtSetArg(args[0], XtNwidth, tfImageWidth);\n    XtSetArg(args[1], XtNheight, tfImageHeight);\n    XtSetValues(imageWidget, args, 2);\n\n    /*\n     * formWidget uses these constraints but they are stored in the children.\n     */\n    XtSetArg(args[0], XtNfromVert, listWidget);\n    XtSetValues(imageWidget, args, 1);\n    XtSetArg(args[0], XtNfromHoriz, listWidget);\n    XtSetValues(labelWidget, args, 1);\n\n    SetNameLabel();\n\n    XtAddCallback(listWidget, XtNcallback, (XtCallbackProc) SelectProc,\n        (XtPointer) NULL);\n\n    XtAddActions(actionsTable, XtNumber(actionsTable));\n    XtSetArg(args[0], XtNtranslations,\n        XtParseTranslationTable(translationsTable));\n    XtSetValues(formWidget, &args[0], 1);\n    XtSetValues(imageWidget, &args[0], 1);\n\n    /*\n     * This is intended to be a little faster than going through\n     * the translation manager.\n     */\n    XtAddEventHandler(imageWidget, ExposureMask | ButtonPressMask\n        | ButtonReleaseMask | Button1MotionMask | KeyPressMask,\n        False, EventProc, NULL);\n\n    XtRealizeWidget(shellWidget);\n\n    window_attributes.cursor = XCreateFontCursor(xDisplay, XC_fleur);\n    XChangeWindowAttributes(xDisplay, XtWindow(imageWidget),\n        CWCursor, &window_attributes);\n\n    CreateXImage();\n\n    XtMainLoop();\n\n    return 0;\n}\n\nvoid\nOpenTIFFFile()\n{\n    if (tfFile != NULL)\n        TIFFClose(tfFile);\n\n    if ((tfFile = TIFFOpen(fileName, \"r\")) == NULL) {\n\tfprintf(appData.verbose ? stderr : stdout,\n\t    \"xtiff: can't open %s as a TIFF file\\n\", fileName);\n        exit(0);\n    }\n\n    tfMultiPage = (TIFFLastDirectory(tfFile) ? False : True);\n}\n\nvoid\nGetTIFFHeader()\n{\n    register int i;\n\n    if (!TIFFSetDirectory(tfFile, tfDirectory)) {\n        fprintf(stderr, \"xtiff: can't seek to directory %d in %s\\n\",\n            tfDirectory, fileName);\n        exit(0);\n    }\n\n    TIFFGetField(tfFile, TIFFTAG_IMAGEWIDTH, &tfImageWidth);\n    TIFFGetField(tfFile, TIFFTAG_IMAGELENGTH, &tfImageHeight);\n\n    /*\n     * If the following tags aren't present then use the TIFF defaults.\n     */\n    TIFFGetFieldDefaulted(tfFile, TIFFTAG_BITSPERSAMPLE, &tfBitsPerSample);\n    TIFFGetFieldDefaulted(tfFile, TIFFTAG_SAMPLESPERPIXEL, &tfSamplesPerPixel);\n    TIFFGetFieldDefaulted(tfFile, TIFFTAG_PLANARCONFIG, &tfPlanarConfiguration);\n    TIFFGetFieldDefaulted(tfFile, TIFFTAG_GRAYRESPONSEUNIT, &tfGrayResponseUnit);\n\n    tfUnitMap = tfGrayResponseUnitMap[tfGrayResponseUnit];\n    colormapSize = 1 << tfBitsPerSample;\n    tfImageDepth = tfBitsPerSample * tfSamplesPerPixel;\n\n    dRed = (double *) malloc(colormapSize * sizeof(double));\n    dGreen = (double *) malloc(colormapSize * sizeof(double));\n    dBlue = (double *) malloc(colormapSize * sizeof(double));\n    MCHECK(dRed); MCHECK(dGreen); MCHECK(dBlue);\n\n    /*\n     * If TIFFTAG_PHOTOMETRIC is not present then assign a reasonable default.\n     * The TIFF 5.0 specification doesn't give a default.\n     */\n    if (!TIFFGetField(tfFile, TIFFTAG_PHOTOMETRIC,\n            &tfPhotometricInterpretation)) {\n        if (tfSamplesPerPixel != 1)\n            tfPhotometricInterpretation = PHOTOMETRIC_RGB;\n        else if (tfBitsPerSample == 1)\n            tfPhotometricInterpretation = PHOTOMETRIC_MINISBLACK;\n        else if (TIFFGetField(tfFile, TIFFTAG_COLORMAP,\n                &redMap, &greenMap, &blueMap)) {\n            tfPhotometricInterpretation = PHOTOMETRIC_PALETTE;\n            redMap = greenMap = blueMap = NULL;\n        } else\n            tfPhotometricInterpretation = PHOTOMETRIC_MINISBLACK;\n    }\n\n    /*\n     * Given TIFFTAG_PHOTOMETRIC extract or create the response curves.\n     */\n    switch (tfPhotometricInterpretation) {\n    case PHOTOMETRIC_RGB:\n\tredMap = (uint16 *) malloc(colormapSize * sizeof(uint16));\n\tgreenMap = (uint16 *) malloc(colormapSize * sizeof(uint16));\n\tblueMap = (uint16 *) malloc(colormapSize * sizeof(uint16));\n\tMCHECK(redMap); MCHECK(greenMap); MCHECK(blueMap);\n\tfor (i = 0; i < colormapSize; i++)\n\t    dRed[i] = dGreen[i] = dBlue[i]\n\t\t= (double) SCALE(i, colormapSize - 1);\n        break;\n    case PHOTOMETRIC_PALETTE:\n        if (!TIFFGetField(tfFile, TIFFTAG_COLORMAP,\n                &redMap, &greenMap, &blueMap)) {\n            redMap = (uint16 *) malloc(colormapSize * sizeof(uint16));\n            greenMap = (uint16 *) malloc(colormapSize * sizeof(uint16));\n            blueMap = (uint16 *) malloc(colormapSize * sizeof(uint16));\n            MCHECK(redMap); MCHECK(greenMap); MCHECK(blueMap);\n            for (i = 0; i < colormapSize; i++)\n                dRed[i] = dGreen[i] = dBlue[i]\n                    = (double) SCALE(i, colormapSize - 1);\n        } else {\n            CheckAndCorrectColormap();\n            for (i = 0; i < colormapSize; i++) {\n                dRed[i] = (double) redMap[i];\n                dGreen[i] = (double) greenMap[i];\n                dBlue[i] = (double) blueMap[i];\n            }\n        }\n        break;\n    case PHOTOMETRIC_MINISWHITE:\n        redMap = (uint16 *) malloc(colormapSize * sizeof(uint16));\n        greenMap = (uint16 *) malloc(colormapSize * sizeof(uint16));\n        blueMap = (uint16 *) malloc(colormapSize * sizeof(uint16));\n        MCHECK(redMap); MCHECK(greenMap); MCHECK(blueMap);\n\tfor (i = 0; i < colormapSize; i++)\n\t    dRed[i] = dGreen[i] = dBlue[i] = (double)\n\t\t SCALE(colormapSize-1-i, colormapSize-1);\n        break;\n    case PHOTOMETRIC_MINISBLACK:\n        redMap = (uint16 *) malloc(colormapSize * sizeof(uint16));\n        greenMap = (uint16 *) malloc(colormapSize * sizeof(uint16));\n        blueMap = (uint16 *) malloc(colormapSize * sizeof(uint16));\n        MCHECK(redMap); MCHECK(greenMap); MCHECK(blueMap);\n\tfor (i = 0; i < colormapSize; i++)\n\t    dRed[i] = dGreen[i] = dBlue[i] = (double) SCALE(i, colormapSize-1);\n        break;\n    default:\n        fprintf(stderr,\n            \"xtiff: can't display photometric interpretation type %d\\n\",\n            tfPhotometricInterpretation);\n        exit(0);\n    }\n}\n\nvoid\nSetNameLabel()\n{\n    char buffer[BUFSIZ];\n    Arg args[1];\n\n    if (tfMultiPage)\n        sprintf(buffer, \"%s - page %d\", fileName, tfDirectory);\n    else\n        strcpy(buffer, fileName);\n    XtSetArg(args[0], XtNlabel, buffer);\n    XtSetValues(labelWidget, args, 1);\n}\n\n/*\n * Many programs get TIFF colormaps wrong.  They use 8-bit colormaps instead of\n * 16-bit colormaps.  This function is a heuristic to detect and correct this.\n */\nvoid\nCheckAndCorrectColormap()\n{\n    register int i;\n\n    for (i = 0; i < colormapSize; i++)\n        if ((redMap[i] > 255) || (greenMap[i] > 255) || (blueMap[i] > 255))\n            return;\n\n    for (i = 0; i < colormapSize; i++) {\n        redMap[i] = SCALE(redMap[i], 255);\n        greenMap[i] = SCALE(greenMap[i], 255);\n        blueMap[i] = SCALE(blueMap[i], 255);\n    }\n    TIFFWarning(fileName, \"Assuming 8-bit colormap\");\n}\n\nvoid\nSimpleGammaCorrection()\n{\n    register int i;\n    register double i_gamma = 1.0 / appData.gamma;\n\n    for (i = 0; i < colormapSize; i++) {\n        if (((tfPhotometricInterpretation == PHOTOMETRIC_MINISWHITE)\n            && (i == colormapSize - 1))\n            || ((tfPhotometricInterpretation == PHOTOMETRIC_MINISBLACK)\n            && (i == 0)))\n            redMap[i] = greenMap[i] = blueMap[i] = 0;\n        else {\n            redMap[i] = ROUND((pow(dRed[i] / 65535.0, i_gamma) * 65535.0));\n            greenMap[i] = ROUND((pow(dGreen[i] / 65535.0, i_gamma) * 65535.0));\n            blueMap[i] = ROUND((pow(dBlue[i] / 65535.0, i_gamma) * 65535.0));\n        }\n    }\n\n    free(dRed); free(dGreen); free(dBlue);\n}\n\nstatic char* classNames[] = {\n    \"StaticGray\",\n    \"GrayScale\",\n    \"StaticColor\",\n    \"PseudoColor\",\n    \"TrueColor\",\n    \"DirectColor\"\n};\n\n/*\n * Current limitation: the visual is set initially by the first file.\n * It cannot be changed.\n */\nvoid\nGetVisual()\n{\n    XColor *colors = NULL;\n    unsigned long *pixels = NULL;\n    unsigned long i;\n\n    switch (tfImageDepth) {\n    /*\n     * X really wants a 32-bit image with the fourth channel unused,\n     * but the visual structure thinks it's 24-bit.  bitmap_unit is 32.\n     */\n    case 32:\n    case 24:\n        if (SearchVisualList(24, DirectColor, &xVisual) == False) {\n            fprintf(stderr, \"xtiff: 24-bit DirectColor visual not available\\n\");\n            exit(0);\n        }\n\n        colors = (XColor *) malloc(3 * colormapSize * sizeof(XColor));\n        MCHECK(colors);\n\n        for (i = 0; i < colormapSize; i++) {\n            colors[i].pixel = (i << 16) + (i << 8) + i;\n            colors[i].red = redMap[i];\n            colors[i].green = greenMap[i];\n            colors[i].blue = blueMap[i];\n            colors[i].flags = DoRed | DoGreen | DoBlue;\n        }\n\n        xColormap = XCreateColormap(xDisplay, RootWindow(xDisplay, xScreen),\n            xVisual, AllocAll);\n        XStoreColors(xDisplay, xColormap, colors, colormapSize);\n        break;\n    case 8:\n    case 4:\n    case 2:\n        /*\n         * We assume that systems with 24-bit visuals also have 8-bit visuals.\n         * We don't promote from 8-bit PseudoColor to 24/32 bit DirectColor.\n         */\n        switch (tfPhotometricInterpretation) {\n        case PHOTOMETRIC_MINISWHITE:\n        case PHOTOMETRIC_MINISBLACK:\n            if (SearchVisualList((int) tfImageDepth, GrayScale, &xVisual) == True)\n                break;\n        case PHOTOMETRIC_PALETTE:\n            if (SearchVisualList((int) tfImageDepth, PseudoColor, &xVisual) == True)\n                break;\n        default:\n            fprintf(stderr, \"xtiff: Unsupported TIFF/X configuration\\n\");\n            exit(0);\n        }\n\n        colors = (XColor *) malloc(colormapSize * sizeof(XColor));\n        MCHECK(colors);\n\n        for (i = 0; i < colormapSize; i++) {\n            colors[i].pixel = i;\n            colors[i].red = redMap[i];\n            colors[i].green = greenMap[i];\n            colors[i].blue = blueMap[i];\n            colors[i].flags = DoRed | DoGreen | DoBlue;\n        }\n\n        /*\n         * xtiff's colormap allocation is private.  It does not attempt\n         * to detect whether any existing colormap entries are suitable\n         * for its use.  This will cause colormap flashing.  Furthermore,\n         * background and foreground are taken from the environment.\n         * For example, the foreground color may be red when the visual\n         * is GrayScale.  If the colormap is completely populated,\n         * Xt will not be able to allocate fg and bg.\n         */\n        if (tfImageDepth == 8)\n            xColormap = XCreateColormap(xDisplay, RootWindow(xDisplay, xScreen),\n                xVisual, AllocAll);\n        else {\n            xColormap = XCreateColormap(xDisplay, RootWindow(xDisplay, xScreen),\n                xVisual, AllocNone);\n            pixels = (unsigned long *)\n                malloc(colormapSize * sizeof(unsigned long));\n            MCHECK(pixels);\n            (void) XAllocColorCells(xDisplay, xColormap, True,\n                NULL, 0, pixels, colormapSize);\n            basePixel = (unsigned char) pixels[0];\n            free(pixels);\n        }\n        XStoreColors(xDisplay, xColormap, colors, colormapSize);\n        break;\n    case 1:\n        xImageDepth = 1;\n        xVisual = DefaultVisual(xDisplay, xScreen);\n        xColormap = DefaultColormap(xDisplay, xScreen);\n        break;\n    default:\n        fprintf(stderr, \"xtiff: unsupported image depth %d\\n\", tfImageDepth);\n        exit(0);\n    }\n\n    if (appData.verbose == True)\n\tfprintf(stderr, \"%s: Using %d-bit %s visual.\\n\",\n\t    fileName, xImageDepth, classNames[xVisual->class]);\n\n    if (colors != NULL)\n        free(colors);\n    if (grayMap != NULL)\n        free(grayMap);\n    if (redMap != NULL)\n        free(redMap);\n    if (greenMap != NULL)\n        free(greenMap);\n    if (blueMap != NULL)\n        free(blueMap);\n\n    colors = NULL; grayMap = redMap = greenMap = blueMap = NULL;\n}\n\n/*\n * Search for an appropriate visual.  Promote where necessary.\n * Check to make sure that ENOUGH colormap entries are writeable.\n * basePixel was determined when XAllocColorCells() contiguously\n * allocated enough entries.  basePixel is used below in GetTIFFImage.\n */\nBoolean\nSearchVisualList(image_depth, visual_class, visual)\n    int image_depth, visual_class;\n    Visual **visual;\n{\n    XVisualInfo template_visual, *visual_list, *vl;\n    int i, n_visuals;\n\n    template_visual.screen = xScreen;\n    vl = visual_list = XGetVisualInfo(xDisplay, VisualScreenMask,\n        &template_visual, &n_visuals);\n\n    if (n_visuals == 0) {\n        fprintf(stderr, \"xtiff: visual list not available\\n\");\n        exit(0);\n    }\n\n    for (i = 0; i < n_visuals; vl++, i++) {\n        if ((vl->class == visual_class) && (vl->depth >= image_depth)\n            && (vl->visual->map_entries >= (1 << vl->depth))) {\n            *visual = vl->visual;\n            xImageDepth = vl->depth;\n            xRedMask = vl->red_mask;\n            xGreenMask = vl->green_mask;\n            xBlueMask = vl->blue_mask;\n            XFree((char *) visual_list);\n            return True;\n        }\n    }\n\n    XFree((char *) visual_list);\n    return False;\n}\n\nvoid\nGetTIFFImage()\n{\n    int pixel_map[3], red_shift, green_shift, blue_shift;\n    char *scan_line, *output_p, *input_p;\n    uint32 i, j;\n    uint16 s;\n\n    scan_line = (char *) malloc(tfBytesPerRow = TIFFScanlineSize(tfFile));\n    MCHECK(scan_line);\n\n    if ((tfImageDepth == 32) || (tfImageDepth == 24)) {\n        output_p = imageMemory = (char *)\n            malloc(tfImageWidth * tfImageHeight * 4);\n        MCHECK(imageMemory);\n\n        /*\n         * Handle different color masks for different frame buffers.\n         */\n        if (ImageByteOrder(xDisplay) == LSBFirst) { /* DECstation 5000 */\n            red_shift = pixel_map[0] = xRedMask == 0xFF000000 ? 3\n                : (xRedMask == 0xFF0000 ? 2 : (xRedMask == 0xFF00 ? 1 : 0));\n            green_shift = pixel_map[1] = xGreenMask == 0xFF000000 ? 3\n                : (xGreenMask == 0xFF0000 ? 2 : (xGreenMask == 0xFF00 ? 1 : 0));\n            blue_shift = pixel_map[2] = xBlueMask == 0xFF000000 ? 3\n                : (xBlueMask == 0xFF0000 ? 2 : (xBlueMask == 0xFF00 ? 1 : 0));\n        } else { /* Ardent */\n            red_shift = pixel_map[0] = xRedMask == 0xFF000000 ? 0\n                : (xRedMask == 0xFF0000 ? 1 : (xRedMask == 0xFF00 ? 2 : 3));\n            green_shift = pixel_map[0] = xGreenMask == 0xFF000000 ? 0\n                : (xGreenMask == 0xFF0000 ? 1 : (xGreenMask == 0xFF00 ? 2 : 3));\n            blue_shift = pixel_map[0] = xBlueMask == 0xFF000000 ? 0\n                : (xBlueMask == 0xFF0000 ? 1 : (xBlueMask == 0xFF00 ? 2 : 3));\n        }\n\n        if (tfPlanarConfiguration == PLANARCONFIG_CONTIG) {\n            for (i = 0; i < tfImageHeight; i++) {\n                if (TIFFReadScanline(tfFile, scan_line, i, 0) < 0)\n                    break;\n                for (input_p = scan_line, j = 0; j < tfImageWidth; j++) {\n                    *(output_p + red_shift) = *input_p++;\n                    *(output_p + green_shift) = *input_p++;\n                    *(output_p + blue_shift) = *input_p++;\n                    output_p += 4;\n                    if (tfSamplesPerPixel == 4) /* skip the fourth channel */\n                        input_p++;\n                }\n            }\n        } else {\n            for (s = 0; s < tfSamplesPerPixel; s++) {\n                if (s == 3)             /* skip the fourth channel */\n                    continue;\n                for (i = 0; i < tfImageHeight; i++) {\n                    if (TIFFReadScanline(tfFile, scan_line, i, s) < 0)\n                        break;\n                    input_p = scan_line;\n                    output_p = imageMemory + (i*tfImageWidth*4) + pixel_map[s];\n                    for (j = 0; j < tfImageWidth; j++, output_p += 4)\n                        *output_p = *input_p++;\n                }\n            }\n        }\n    } else {\n        if (xImageDepth == tfImageDepth) {\n            output_p = imageMemory = (char *)\n                malloc(tfBytesPerRow * tfImageHeight);\n            MCHECK(imageMemory);\n\n            for (i = 0; i < tfImageHeight; i++, output_p += tfBytesPerRow)\n                if (TIFFReadScanline(tfFile, output_p, i, 0) < 0)\n                    break;\n        } else if ((xImageDepth == 8) && (tfImageDepth == 4)) {\n            output_p = imageMemory = (char *)\n                malloc(tfBytesPerRow * 2 * tfImageHeight + 2);\n            MCHECK(imageMemory);\n\n            /*\n             * If a scanline is of odd size the inner loop below will overshoot.\n             * This is handled very simply by recalculating the start point at\n             * each scanline and padding imageMemory a little at the end.\n             */\n            for (i = 0; i < tfImageHeight; i++) {\n                if (TIFFReadScanline(tfFile, scan_line, i, 0) < 0)\n                    break;\n                output_p = &imageMemory[i * tfImageWidth];\n                input_p = scan_line;\n                for (j = 0; j < tfImageWidth; j += 2, input_p++) {\n                    *output_p++ = (*input_p >> 4) + basePixel;\n                    *output_p++ = (*input_p & 0xf) + basePixel;\n                }\n            }\n        } else if ((xImageDepth == 8) && (tfImageDepth == 2)) {\n            output_p = imageMemory = (char *)\n                malloc(tfBytesPerRow * 4 * tfImageHeight + 4);\n            MCHECK(imageMemory);\n\n            for (i = 0; i < tfImageHeight; i++) {\n                if (TIFFReadScanline(tfFile, scan_line, i, 0) < 0)\n                    break;\n                output_p = &imageMemory[i * tfImageWidth];\n                input_p = scan_line;\n                for (j = 0; j < tfImageWidth; j += 4, input_p++) {\n                    *output_p++ = (*input_p >> 6) + basePixel;\n                    *output_p++ = ((*input_p >> 4) & 3) + basePixel;\n                    *output_p++ = ((*input_p >> 2) & 3) + basePixel;\n                    *output_p++ = (*input_p & 3) + basePixel;\n                }\n            }\n        } else if ((xImageDepth == 4) && (tfImageDepth == 2)) {\n            output_p = imageMemory = (char *)\n                malloc(tfBytesPerRow * 2 * tfImageHeight + 2);\n            MCHECK(imageMemory);\n\n            for (i = 0; i < tfImageHeight; i++) {\n                if (TIFFReadScanline(tfFile, scan_line, i, 0) < 0)\n                    break;\n                output_p = &imageMemory[i * tfBytesPerRow * 2];\n                input_p = scan_line;\n                for (j = 0; j < tfImageWidth; j += 4, input_p++) {\n                    *output_p++ = (((*input_p>>6) << 4)\n                        | ((*input_p >> 4) & 3)) + basePixel;\n                    *output_p++ = ((((*input_p>>2) & 3) << 4)\n                        | (*input_p & 3)) + basePixel;\n                }\n            }\n        } else {\n            fprintf(stderr,\n                \"xtiff: can't handle %d-bit TIFF file on an %d-bit display\\n\",\n                tfImageDepth, xImageDepth);\n            exit(0);\n        }\n    }\n\n    free(scan_line);\n}\n\nvoid\nCreateXImage()\n{\n    XGCValues gc_values;\n    GC bitmap_gc;\n\n    xOffset = yOffset = 0;\n    grabX = grabY = -1;\n\n    xImage = XCreateImage(xDisplay, xVisual, xImageDepth,\n        xImageDepth == 1 ? XYBitmap : ZPixmap, /* offset */ 0,\n        (char *) imageMemory, tfImageWidth, tfImageHeight,\n        /* bitmap_pad */ 8, /* bytes_per_line */ 0);\n\n    /*\n     * libtiff converts LSB data into MSB but doesn't change the FillOrder tag.\n     */\n    if (xImageDepth == 1)\n        xImage->bitmap_bit_order = MSBFirst;\n    if (xImageDepth <= 8)\n        xImage->byte_order = MSBFirst;\n\n    /*\n     * create an appropriate GC\n     */\n    gc_values.function = GXcopy;\n    gc_values.plane_mask = AllPlanes;\n    if (tfPhotometricInterpretation == PHOTOMETRIC_MINISBLACK) {\n        gc_values.foreground = XWhitePixel(xDisplay, xScreen);\n        gc_values.background = XBlackPixel(xDisplay, xScreen);\n    } else {\n        gc_values.foreground = XBlackPixel(xDisplay, xScreen);\n        gc_values.background = XWhitePixel(xDisplay, xScreen);\n    }\n    xWinGc = XCreateGC(xDisplay, XtWindow(shellWidget),\n        GCFunction | GCPlaneMask | GCForeground | GCBackground, &gc_values);\n\n    /*\n     * create the pixmap and load the image\n     */\n    if (appData.usePixmap == True) {\n        xImagePixmap = XCreatePixmap(xDisplay, RootWindow(xDisplay, xScreen),\n            xImage->width, xImage->height, xImageDepth);\n\n        /*\n         * According to the O'Reilly X Protocol Reference Manual, page 53,\n         * \"A pixmap depth of one is always supported and listed, but windows\n         * of depth one might not be supported.\"  Therefore we create a pixmap\n         * of depth one and use XCopyPlane().  This is idiomatic.\n         */\n        if (xImageDepth == 1) {         /* just pass the bits through */\n            gc_values.foreground = 1;   /* foreground describes set bits */\n            gc_values.background = 0;   /* background describes clear bits */\n            bitmap_gc = XCreateGC(xDisplay, xImagePixmap,\n                GCForeground | GCBackground, &gc_values);\n            XPutImage(xDisplay, xImagePixmap, bitmap_gc, xImage,\n                0, 0, 0, 0, xImage->width, xImage->height);\n        } else\n            XPutImage(xDisplay, xImagePixmap, xWinGc, xImage,\n                0, 0, 0, 0, xImage->width, xImage->height);\n        XDestroyImage(xImage);\n        free(imageMemory);\n    }\n}\n\nXtCallbackProc\nSelectProc(w, unused_1, unused_2)\n    Widget w;\n    caddr_t unused_1;\n    caddr_t unused_2;\n{\n    XawListReturnStruct *list_return;\n\n    list_return = XawListShowCurrent(w);\n\n    switch (list_return->list_index) {\n    case ButtonQuit:\n        QuitProc();\n        break;\n    case ButtonPreviousPage:\n        PreviousProc();\n        break;\n    case ButtonNextPage:\n        NextProc();\n        break;\n    default:\n        fprintf(stderr, \"error in SelectProc\\n\");\n        exit(0);\n    }\n    XawListUnhighlight(w);\n}\n\nvoid\nQuitProc(void)\n{\n    exit(0);\n}\n\nvoid\nNextProc()\n{\n    PageProc(ButtonNextPage);\n}\n\nvoid\nPreviousProc()\n{\n    PageProc(ButtonPreviousPage);\n}\n\nvoid\nPageProc(direction)\n    int direction;\n{\n    XEvent fake_event;\n    Arg args[4];\n\n    switch (direction) {\n    case ButtonPreviousPage:\n        if (tfDirectory > 0)\n            TIFFSetDirectory(tfFile, --tfDirectory);\n        else\n            return;\n        break;\n    case ButtonNextPage:\n        if (TIFFReadDirectory(tfFile) == True)\n            tfDirectory++;\n        else\n            return;\n        break;\n    default:\n        fprintf(stderr, \"error in PageProc\\n\");\n        exit(0);\n    }\n\n    xOffset = yOffset = 0;\n    grabX = grabY = -1;\n\n    GetTIFFHeader();\n    SetNameLabel();\n    GetTIFFImage();\n\n    if (appData.usePixmap == True)\n        XFreePixmap(xDisplay, xImagePixmap);\n    else\n        XDestroyImage(xImage);\n\n    CreateXImage();\n\n    /*\n     * Using XtSetValues() to set the widget size causes a resize.\n     * This resize gets propagated up to the parent shell.\n     * In order to disable this visually disconcerting effect,\n     * shell resizing is temporarily disabled.\n     */\n    XtSetArg(args[0], XtNallowShellResize, False);\n    XtSetValues(shellWidget, args, 1);\n\n    XtSetArg(args[0], XtNwidth, tfImageWidth);\n    XtSetArg(args[1], XtNheight, tfImageHeight);\n    XtSetValues(imageWidget, args, 2);\n\n    XtSetArg(args[0], XtNallowShellResize, True);\n    XtSetValues(shellWidget, args, 1);\n\n    XClearWindow(xDisplay, XtWindow(imageWidget));\n\n    fake_event.type = Expose;\n    fake_event.xexpose.x = fake_event.xexpose.y = 0;\n    fake_event.xexpose.width = tfImageWidth;    /* the window will clip */\n    fake_event.xexpose.height = tfImageHeight;\n    EventProc(imageWidget, NULL, &fake_event);\n}\n\nvoid\nEventProc(widget, unused, event)\n    Widget widget;\n    caddr_t unused;\n    XEvent *event;\n{\n    int ih, iw, ww, wh, sx, sy, w, h, dx, dy;\n    Dimension w_width, w_height;\n    XEvent next_event;\n    Arg args[2];\n\n    if (event->type == MappingNotify) {\n        XRefreshKeyboardMapping((XMappingEvent *) event);\n        return;\n    }\n\n    if (!XtIsRealized(widget))\n        return;\n\n    if ((event->type == ButtonPress) || (event->type == ButtonRelease))\n        if (event->xbutton.button != Button1)\n            return;\n\n    iw = tfImageWidth;  /* avoid sign problems */\n    ih = tfImageHeight;\n\n    /*\n     * The grabX and grabY variables record where the user grabbed the image.\n     * They also record whether the mouse button is down or not.\n     */\n    if (event->type == ButtonPress) {\n        grabX = event->xbutton.x;\n        grabY = event->xbutton.y;\n        return;\n    }\n\n    /*\n     * imageWidget is a Core widget and doesn't get resized.\n     * So we calculate the size of its viewport here.\n     */\n    XtSetArg(args[0], XtNwidth, &w_width);\n    XtSetArg(args[1], XtNheight, &w_height);\n    XtGetValues(shellWidget, args, 2);\n    ww = w_width;\n    wh = w_height;\n    XtGetValues(listWidget, args, 2);\n    wh -= w_height;\n\n    switch (event->type) {\n    case Expose:\n        dx = event->xexpose.x;\n        dy = event->xexpose.y;\n        sx = dx + xOffset;\n        sy = dy + yOffset;\n        w = MIN(event->xexpose.width, iw);\n        h = MIN(event->xexpose.height, ih);\n        break;\n    case KeyPress:\n        if ((grabX >= 0) || (grabY >= 0)) /* Mouse button is still down */\n            return;\n        switch (XLookupKeysym((XKeyEvent *) event, /* KeySyms index */ 0)) {\n        case XK_Up:\n            if (ih < wh)    /* Don't scroll if the window fits the image. */\n                return;\n            sy = yOffset + appData.translate;\n            sy = MIN(ih - wh, sy);\n            if (sy == yOffset)  /* Filter redundant stationary refreshes. */\n                return;\n            yOffset = sy;\n            sx = xOffset;\n            dx = dy = 0;\n            w = ww; h = wh;\n            break;\n        case XK_Down:\n            if (ih < wh)\n                return;\n            sy = yOffset - appData.translate;\n            sy = MAX(sy, 0);\n            if (sy == yOffset)\n                return;\n            yOffset = sy;\n            sx = xOffset;\n            dx = dy = 0;\n            w = ww; h = wh;\n            break;\n        case XK_Left:\n            if (iw < ww)\n                return;\n            sx = xOffset + appData.translate;\n            sx = MIN(iw - ww, sx);\n            if (sx == xOffset)\n                return;\n            xOffset = sx;\n            sy = yOffset;\n            dx = dy = 0;\n            w = ww; h = wh;\n            break;\n        case XK_Right:\n            if (iw < ww)\n                return;\n            sx = xOffset - appData.translate;\n            sx = MAX(sx, 0);\n            if (sx == xOffset)\n                return;\n            xOffset = sx;\n            sy = yOffset;\n            dx = dy = 0;\n            w = ww; h = wh;\n            break;\n        default:\n            return;\n        }\n        break;\n    case MotionNotify:\n        /*\n         * MotionEvent compression.  Ignore multiple motion events.\n         * Ignore motion events if the mouse button is up.\n         */\n        if (XPending(xDisplay)) /* Xlib doesn't flush the output buffer */\n            if (XtPeekEvent(&next_event))\n                if (next_event.type == MotionNotify)\n                    return;\n        if ((grabX < 0) || (grabY < 0))\n            return;\n        sx = xOffset + grabX - (int) event->xmotion.x;\n        if (sx >= (iw - ww))    /* clamp x motion but allow y motion */\n            sx = iw - ww;\n        sx = MAX(sx, 0);\n        sy = yOffset + grabY - (int) event->xmotion.y;\n        if (sy >= (ih - wh)) /* clamp y motion but allow x motion */\n            sy = ih - wh;\n        sy = MAX(sy, 0);\n        if ((sx == xOffset) && (sy == yOffset))\n            return;\n        dx = dy = 0;\n        w = ww; h = wh;\n        break;\n    case ButtonRelease:\n        xOffset = xOffset + grabX - (int) event->xbutton.x;\n        xOffset = MIN(iw - ww, xOffset);\n        xOffset = MAX(xOffset, 0);\n        yOffset = yOffset + grabY - (int) event->xbutton.y;\n        yOffset = MIN(ih - wh, yOffset);\n        yOffset = MAX(yOffset, 0);\n        grabX = grabY = -1;\n    default:\n        return;\n    }\n\n    if (appData.usePixmap == True) {\n        if (xImageDepth == 1)\n            XCopyPlane(xDisplay, xImagePixmap, XtWindow(widget),\n                xWinGc, sx, sy, w, h, dx, dy, 1);\n        else\n            XCopyArea(xDisplay, xImagePixmap, XtWindow(widget),\n                xWinGc, sx, sy, w, h, dx, dy);\n    } else\n        XPutImage(xDisplay, XtWindow(widget), xWinGc, xImage,\n            sx, sy, dx, dy, w, h);\n}\n\nvoid\nResizeProc()\n{\n    Dimension w_width, w_height;\n    int xo, yo, ww, wh;\n    XEvent fake_event;\n    Arg args[2];\n\n    if ((xOffset == 0) && (yOffset == 0))\n        return;\n\n    XtSetArg(args[0], XtNwidth, &w_width);\n    XtSetArg(args[1], XtNheight, &w_height);\n    XtGetValues(shellWidget, args, 2);\n    ww = w_width;\n    wh = w_height;\n    XtGetValues(listWidget, args, 2);\n    wh -= w_height;\n\n    xo = xOffset; yo = yOffset;\n\n    if ((xOffset + ww) >= tfImageWidth)\n        xOffset = MAX((int) tfImageWidth - ww, 0);\n    if ((yOffset + wh) >= tfImageHeight)\n        yOffset = MAX((int) tfImageHeight - wh, 0);\n\n    /*\n     * Send an ExposeEvent if the origin changed.\n     * We have to do this because of the use and semantics of bit gravity.\n     */\n    if ((xo != xOffset) || (yo != yOffset)) {\n        fake_event.type = Expose;\n        fake_event.xexpose.x = fake_event.xexpose.y = 0;\n        fake_event.xexpose.width = tfImageWidth;\n        fake_event.xexpose.height = tfImageHeight;\n        EventProc(imageWidget, NULL, &fake_event);\n    }\n}\n\nint\nXTiffErrorHandler(display, error_event)\n    Display *display;\n    XErrorEvent *error_event;\n{\n    char message[80];\n\n    /*\n     * Some X servers limit the size of pixmaps.\n     */\n    if ((error_event->error_code == BadAlloc)\n            && (error_event->request_code == X_CreatePixmap))\n        fprintf(stderr, \"xtiff: requested pixmap too big for display\\n\");\n    else {\n        XGetErrorText(display, error_event->error_code, message, 80);\n        fprintf(stderr, \"xtiff: error code %s\\n\", message);\n    }\n\n    exit(0);\n}\n\nvoid\nUsage()\n{\n    fprintf(stderr, \"Usage xtiff: [options] tiff-file\\n\");\n    fprintf(stderr, \"\\tstandard Xt options\\n\");\n    fprintf(stderr, \"\\t[-help]\\n\");\n    fprintf(stderr, \"\\t[-gamma gamma]\\n\");\n    fprintf(stderr, \"\\t[-usePixmap (True | False)]\\n\");\n    fprintf(stderr, \"\\t[-viewportWidth pixels]\\n\");\n    fprintf(stderr, \"\\t[-viewportHeight pixels]\\n\");\n    fprintf(stderr, \"\\t[-translate pixels]\\n\");\n    fprintf(stderr, \"\\t[-verbose (True | False)]\\n\");\n    exit(0);\n}\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/dbs/xtiff/xtifficon.h",
    "content": "#define xtifficon_width 32\n#define xtifficon_height 32\nstatic char xtifficon_bits[] = {\n   0xff, 0x00, 0x00, 0xc0, 0xfe, 0x01, 0x7e, 0xc0, 0xfc, 0x03, 0x7e, 0x60,\n   0xf8, 0x07, 0x06, 0x30, 0xf8, 0x07, 0x1e, 0x18, 0xf0, 0x0f, 0x1e, 0x0c,\n   0xe0, 0x1f, 0x06, 0x06, 0xc0, 0x3f, 0x06, 0x06, 0xc0, 0x3f, 0x06, 0x03,\n   0x80, 0x7f, 0x80, 0x01, 0x00, 0xff, 0xc0, 0x00, 0x00, 0xfe, 0x61, 0x00,\n   0x00, 0xfe, 0x31, 0x7e, 0x7e, 0xfc, 0x33, 0x7e, 0x7e, 0xf8, 0x1b, 0x06,\n   0x18, 0xf0, 0x0d, 0x1e, 0x18, 0xf0, 0x0e, 0x1e, 0x18, 0x60, 0x1f, 0x06,\n   0x18, 0xb0, 0x3f, 0x06, 0x18, 0x98, 0x7f, 0x06, 0x18, 0x98, 0x7f, 0x00,\n   0x00, 0x0c, 0xff, 0x00, 0x00, 0x06, 0xfe, 0x01, 0x00, 0x63, 0xfc, 0x03,\n   0x80, 0x61, 0xfc, 0x03, 0xc0, 0x60, 0xf8, 0x07, 0xc0, 0x60, 0xf0, 0x0f,\n   0x60, 0x60, 0xe0, 0x1f, 0x30, 0x60, 0xe0, 0x1f, 0x18, 0x60, 0xc0, 0x3f,\n   0x0c, 0x60, 0x80, 0x7f, 0x06, 0x00, 0x00, 0xff};\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/iptcutil/Makefile.am",
    "content": "# Tag Image File Format (TIFF) Software\n#\n# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>\n#\n# Permission to use, copy, modify, distribute, and sell this software and \n# its documentation for any purpose is hereby granted without fee, provided\n# that (i) the above copyright notices and this permission notice appear in\n# all copies of the software and related documentation, and (ii) the names of\n# Sam Leffler and Silicon Graphics may not be used in any advertising or\n# publicity relating to the software without the specific, prior written\n# permission of Sam Leffler and Silicon Graphics.\n# \n# THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n# \n# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n# OF THIS SOFTWARE.\n\n# Process this file with automake to produce Makefile.in.\n\nLIBTIFF = $(top_builddir)/libtiff/libtiff.la\n\nEXTRA_DIST = README test.iptc test.txt\n\nnoinst_PROGRAMS = iptcutil\n\niptcutil_SOURCES = iptcutil.c\niptcutil_LDADD = $(LIBTIFF)\n\nINCLUDES = -I$(top_srcdir)/libtiff\n\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/iptcutil/Makefile.in",
    "content": "# Makefile.in generated by automake 1.11 from Makefile.am.\n# @configure_input@\n\n# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,\n# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,\n# Inc.\n# This Makefile.in is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY, to the extent permitted by law; without\n# even the implied warranty of MERCHANTABILITY or FITNESS FOR A\n# PARTICULAR PURPOSE.\n\n@SET_MAKE@\n\n# Tag Image File Format (TIFF) Software\n#\n# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>\n#\n# Permission to use, copy, modify, distribute, and sell this software and \n# its documentation for any purpose is hereby granted without fee, provided\n# that (i) the above copyright notices and this permission notice appear in\n# all copies of the software and related documentation, and (ii) the names of\n# Sam Leffler and Silicon Graphics may not be used in any advertising or\n# publicity relating to the software without the specific, prior written\n# permission of Sam Leffler and Silicon Graphics.\n# \n# THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n# \n# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n# OF THIS SOFTWARE.\n\n# Process this file with automake to produce Makefile.in.\n\nVPATH = @srcdir@\npkgdatadir = $(datadir)/@PACKAGE@\npkgincludedir = $(includedir)/@PACKAGE@\npkglibdir = $(libdir)/@PACKAGE@\npkglibexecdir = $(libexecdir)/@PACKAGE@\nam__cd = CDPATH=\"$${ZSH_VERSION+.}$(PATH_SEPARATOR)\" && cd\ninstall_sh_DATA = $(install_sh) -c -m 644\ninstall_sh_PROGRAM = $(install_sh) -c\ninstall_sh_SCRIPT = $(install_sh) -c\nINSTALL_HEADER = $(INSTALL_DATA)\ntransform = $(program_transform_name)\nNORMAL_INSTALL = :\nPRE_INSTALL = :\nPOST_INSTALL = :\nNORMAL_UNINSTALL = :\nPRE_UNINSTALL = :\nPOST_UNINSTALL = :\nbuild_triplet = @build@\nhost_triplet = @host@\ntarget_triplet = @target@\nnoinst_PROGRAMS = iptcutil$(EXEEXT)\nsubdir = contrib/iptcutil\nDIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in\nACLOCAL_M4 = $(top_srcdir)/aclocal.m4\nam__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \\\n\t$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \\\n\t$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \\\n\t$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac\nam__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \\\n\t$(ACLOCAL_M4)\nmkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs\nCONFIG_HEADER = $(top_builddir)/libtiff/tif_config.h \\\n\t$(top_builddir)/libtiff/tiffconf.h\nCONFIG_CLEAN_FILES =\nCONFIG_CLEAN_VPATH_FILES =\nPROGRAMS = $(noinst_PROGRAMS)\nam_iptcutil_OBJECTS = iptcutil.$(OBJEXT)\niptcutil_OBJECTS = $(am_iptcutil_OBJECTS)\niptcutil_DEPENDENCIES = $(LIBTIFF)\nAM_V_lt = $(am__v_lt_$(V))\nam__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))\nam__v_lt_0 = --silent\nDEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/libtiff\ndepcomp = $(SHELL) $(top_srcdir)/config/depcomp\nam__depfiles_maybe = depfiles\nam__mv = mv -f\nCOMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \\\n\t$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)\nLTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \\\n\t$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \\\n\t$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \\\n\t$(AM_CFLAGS) $(CFLAGS)\nAM_V_CC = $(am__v_CC_$(V))\nam__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))\nam__v_CC_0 = @echo \"  CC    \" $@;\nAM_V_at = $(am__v_at_$(V))\nam__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))\nam__v_at_0 = @\nCCLD = $(CC)\nLINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \\\n\t$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \\\n\t$(AM_LDFLAGS) $(LDFLAGS) -o $@\nAM_V_CCLD = $(am__v_CCLD_$(V))\nam__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))\nam__v_CCLD_0 = @echo \"  CCLD  \" $@;\nAM_V_GEN = $(am__v_GEN_$(V))\nam__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))\nam__v_GEN_0 = @echo \"  GEN   \" $@;\nSOURCES = $(iptcutil_SOURCES)\nDIST_SOURCES = $(iptcutil_SOURCES)\nETAGS = etags\nCTAGS = ctags\nDISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)\nACLOCAL = @ACLOCAL@\nAMTAR = @AMTAR@\nAM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@\nAR = @AR@\nAS = @AS@\nAUTOCONF = @AUTOCONF@\nAUTOHEADER = @AUTOHEADER@\nAUTOMAKE = @AUTOMAKE@\nAWK = @AWK@\nCC = @CC@\nCCDEPMODE = @CCDEPMODE@\nCFLAGS = @CFLAGS@\nCPP = @CPP@\nCPPFLAGS = @CPPFLAGS@\nCXX = @CXX@\nCXXCPP = @CXXCPP@\nCXXDEPMODE = @CXXDEPMODE@\nCXXFLAGS = @CXXFLAGS@\nCYGPATH_W = @CYGPATH_W@\nDEFS = @DEFS@\nDEPDIR = @DEPDIR@\nDLLTOOL = @DLLTOOL@\nDSYMUTIL = @DSYMUTIL@\nDUMPBIN = @DUMPBIN@\nECHO_C = @ECHO_C@\nECHO_N = @ECHO_N@\nECHO_T = @ECHO_T@\nEGREP = @EGREP@\nEXEEXT = @EXEEXT@\nFGREP = @FGREP@\nGLUT_CFLAGS = @GLUT_CFLAGS@\nGLUT_LIBS = @GLUT_LIBS@\nGLU_CFLAGS = @GLU_CFLAGS@\nGLU_LIBS = @GLU_LIBS@\nGL_CFLAGS = @GL_CFLAGS@\nGL_LIBS = @GL_LIBS@\nGREP = @GREP@\nINSTALL = @INSTALL@\nINSTALL_DATA = @INSTALL_DATA@\nINSTALL_PROGRAM = @INSTALL_PROGRAM@\nINSTALL_SCRIPT = @INSTALL_SCRIPT@\nINSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@\nLD = @LD@\nLDFLAGS = @LDFLAGS@\nLIBDIR = @LIBDIR@\nLIBOBJS = @LIBOBJS@\nLIBS = @LIBS@\nLIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@\nLIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@\nLIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@\nLIBTIFF_MICRO_VERSION = @LIBTIFF_MICRO_VERSION@\nLIBTIFF_MINOR_VERSION = @LIBTIFF_MINOR_VERSION@\nLIBTIFF_RELEASE_DATE = @LIBTIFF_RELEASE_DATE@\nLIBTIFF_VERSION = @LIBTIFF_VERSION@\nLIBTIFF_VERSION_INFO = @LIBTIFF_VERSION_INFO@\nLIBTOOL = @LIBTOOL@\nLIPO = @LIPO@\nLN_S = @LN_S@\nLTLIBOBJS = @LTLIBOBJS@\nMAINT = @MAINT@\nMAKEINFO = @MAKEINFO@\nMKDIR_P = @MKDIR_P@\nNM = @NM@\nNMEDIT = @NMEDIT@\nOBJDUMP = @OBJDUMP@\nOBJEXT = @OBJEXT@\nOTOOL = @OTOOL@\nOTOOL64 = @OTOOL64@\nPACKAGE = @PACKAGE@\nPACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@\nPACKAGE_NAME = @PACKAGE_NAME@\nPACKAGE_STRING = @PACKAGE_STRING@\nPACKAGE_TARNAME = @PACKAGE_TARNAME@\nPACKAGE_URL = @PACKAGE_URL@\nPACKAGE_VERSION = @PACKAGE_VERSION@\nPATH_SEPARATOR = @PATH_SEPARATOR@\nPTHREAD_CC = @PTHREAD_CC@\nPTHREAD_CFLAGS = @PTHREAD_CFLAGS@\nPTHREAD_LIBS = @PTHREAD_LIBS@\nRANLIB = @RANLIB@\nSED = @SED@\nSET_MAKE = @SET_MAKE@\nSHELL = @SHELL@\nSTRIP = @STRIP@\nVERSION = @VERSION@\nXMKMF = @XMKMF@\nX_CFLAGS = @X_CFLAGS@\nX_EXTRA_LIBS = @X_EXTRA_LIBS@\nX_LIBS = @X_LIBS@\nX_PRE_LIBS = @X_PRE_LIBS@\nabs_builddir = @abs_builddir@\nabs_srcdir = @abs_srcdir@\nabs_top_builddir = @abs_top_builddir@\nabs_top_srcdir = @abs_top_srcdir@\nac_ct_CC = @ac_ct_CC@\nac_ct_CXX = @ac_ct_CXX@\nac_ct_DUMPBIN = @ac_ct_DUMPBIN@\nacx_pthread_config = @acx_pthread_config@\nam__include = @am__include@\nam__leading_dot = @am__leading_dot@\nam__quote = @am__quote@\nam__tar = @am__tar@\nam__untar = @am__untar@\nbindir = @bindir@\nbuild = @build@\nbuild_alias = @build_alias@\nbuild_cpu = @build_cpu@\nbuild_os = @build_os@\nbuild_vendor = @build_vendor@\nbuilddir = @builddir@\ndatadir = @datadir@\ndatarootdir = @datarootdir@\ndocdir = @docdir@\ndvidir = @dvidir@\nexec_prefix = @exec_prefix@\nhost = @host@\nhost_alias = @host_alias@\nhost_cpu = @host_cpu@\nhost_os = @host_os@\nhost_vendor = @host_vendor@\nhtmldir = @htmldir@\nincludedir = @includedir@\ninfodir = @infodir@\ninstall_sh = @install_sh@\nlibdir = @libdir@\nlibexecdir = @libexecdir@\nlocaledir = @localedir@\nlocalstatedir = @localstatedir@\nlt_ECHO = @lt_ECHO@\nmandir = @mandir@\nmkdir_p = @mkdir_p@\noldincludedir = @oldincludedir@\npdfdir = @pdfdir@\nprefix = @prefix@\nprogram_transform_name = @program_transform_name@\npsdir = @psdir@\nsbindir = @sbindir@\nsharedstatedir = @sharedstatedir@\nsrcdir = @srcdir@\nsysconfdir = @sysconfdir@\ntarget = @target@\ntarget_alias = @target_alias@\ntarget_cpu = @target_cpu@\ntarget_os = @target_os@\ntarget_vendor = @target_vendor@\ntop_build_prefix = @top_build_prefix@\ntop_builddir = @top_builddir@\ntop_srcdir = @top_srcdir@\nLIBTIFF = $(top_builddir)/libtiff/libtiff.la\nEXTRA_DIST = README test.iptc test.txt\niptcutil_SOURCES = iptcutil.c\niptcutil_LDADD = $(LIBTIFF)\nINCLUDES = -I$(top_srcdir)/libtiff\nall: all-am\n\n.SUFFIXES:\n.SUFFIXES: .c .lo .o .obj\n$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)\n\t@for dep in $?; do \\\n\t  case '$(am__configure_deps)' in \\\n\t    *$$dep*) \\\n\t      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \\\n\t        && { if test -f $@; then exit 0; else break; fi; }; \\\n\t      exit 1;; \\\n\t  esac; \\\n\tdone; \\\n\techo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign contrib/iptcutil/Makefile'; \\\n\t$(am__cd) $(top_srcdir) && \\\n\t  $(AUTOMAKE) --foreign contrib/iptcutil/Makefile\n.PRECIOUS: Makefile\nMakefile: $(srcdir)/Makefile.in $(top_builddir)/config.status\n\t@case '$?' in \\\n\t  *config.status*) \\\n\t    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \\\n\t  *) \\\n\t    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \\\n\t    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \\\n\tesac;\n\n$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n\n$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n$(am__aclocal_m4_deps):\n\nclean-noinstPROGRAMS:\n\t@list='$(noinst_PROGRAMS)'; test -n \"$$list\" || exit 0; \\\n\techo \" rm -f\" $$list; \\\n\trm -f $$list || exit $$?; \\\n\ttest -n \"$(EXEEXT)\" || exit 0; \\\n\tlist=`for p in $$list; do echo \"$$p\"; done | sed 's/$(EXEEXT)$$//'`; \\\n\techo \" rm -f\" $$list; \\\n\trm -f $$list\niptcutil$(EXEEXT): $(iptcutil_OBJECTS) $(iptcutil_DEPENDENCIES) \n\t@rm -f iptcutil$(EXEEXT)\n\t$(AM_V_CCLD)$(LINK) $(iptcutil_OBJECTS) $(iptcutil_LDADD) $(LIBS)\n\nmostlyclean-compile:\n\t-rm -f *.$(OBJEXT)\n\ndistclean-compile:\n\t-rm -f *.tab.c\n\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iptcutil.Po@am__quote@\n\n.c.o:\n@am__fastdepCC_TRUE@\t$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<\n@am__fastdepCC_TRUE@\t$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po\n@am__fastdepCC_FALSE@\t$(AM_V_CC) @AM_BACKSLASH@\n@AMDEP_TRUE@@am__fastdepCC_FALSE@\tsource='$<' object='$@' libtool=no @AMDEPBACKSLASH@\n@AMDEP_TRUE@@am__fastdepCC_FALSE@\tDEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@\n@am__fastdepCC_FALSE@\t$(COMPILE) -c $<\n\n.c.obj:\n@am__fastdepCC_TRUE@\t$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`\n@am__fastdepCC_TRUE@\t$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po\n@am__fastdepCC_FALSE@\t$(AM_V_CC) @AM_BACKSLASH@\n@AMDEP_TRUE@@am__fastdepCC_FALSE@\tsource='$<' object='$@' libtool=no @AMDEPBACKSLASH@\n@AMDEP_TRUE@@am__fastdepCC_FALSE@\tDEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@\n@am__fastdepCC_FALSE@\t$(COMPILE) -c `$(CYGPATH_W) '$<'`\n\n.c.lo:\n@am__fastdepCC_TRUE@\t$(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<\n@am__fastdepCC_TRUE@\t$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo\n@am__fastdepCC_FALSE@\t$(AM_V_CC) @AM_BACKSLASH@\n@AMDEP_TRUE@@am__fastdepCC_FALSE@\tsource='$<' object='$@' libtool=yes @AMDEPBACKSLASH@\n@AMDEP_TRUE@@am__fastdepCC_FALSE@\tDEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@\n@am__fastdepCC_FALSE@\t$(LTCOMPILE) -c -o $@ $<\n\nmostlyclean-libtool:\n\t-rm -f *.lo\n\nclean-libtool:\n\t-rm -rf .libs _libs\n\nID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)\n\tlist='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \\\n\tunique=`for i in $$list; do \\\n\t    if test -f \"$$i\"; then echo $$i; else echo $(srcdir)/$$i; fi; \\\n\t  done | \\\n\t  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \\\n\t      END { if (nonempty) { for (i in files) print i; }; }'`; \\\n\tmkid -fID $$unique\ntags: TAGS\n\nTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \\\n\t\t$(TAGS_FILES) $(LISP)\n\tset x; \\\n\there=`pwd`; \\\n\tlist='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \\\n\tunique=`for i in $$list; do \\\n\t    if test -f \"$$i\"; then echo $$i; else echo $(srcdir)/$$i; fi; \\\n\t  done | \\\n\t  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \\\n\t      END { if (nonempty) { for (i in files) print i; }; }'`; \\\n\tshift; \\\n\tif test -z \"$(ETAGS_ARGS)$$*$$unique\"; then :; else \\\n\t  test -n \"$$unique\" || unique=$$empty_fix; \\\n\t  if test $$# -gt 0; then \\\n\t    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \\\n\t      \"$$@\" $$unique; \\\n\t  else \\\n\t    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \\\n\t      $$unique; \\\n\t  fi; \\\n\tfi\nctags: CTAGS\nCTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \\\n\t\t$(TAGS_FILES) $(LISP)\n\tlist='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \\\n\tunique=`for i in $$list; do \\\n\t    if test -f \"$$i\"; then echo $$i; else echo $(srcdir)/$$i; fi; \\\n\t  done | \\\n\t  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \\\n\t      END { if (nonempty) { for (i in files) print i; }; }'`; \\\n\ttest -z \"$(CTAGS_ARGS)$$unique\" \\\n\t  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \\\n\t     $$unique\n\nGTAGS:\n\there=`$(am__cd) $(top_builddir) && pwd` \\\n\t  && $(am__cd) $(top_srcdir) \\\n\t  && gtags -i $(GTAGS_ARGS) \"$$here\"\n\ndistclean-tags:\n\t-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags\n\ndistdir: $(DISTFILES)\n\t@srcdirstrip=`echo \"$(srcdir)\" | sed 's/[].[^$$\\\\*]/\\\\\\\\&/g'`; \\\n\ttopsrcdirstrip=`echo \"$(top_srcdir)\" | sed 's/[].[^$$\\\\*]/\\\\\\\\&/g'`; \\\n\tlist='$(DISTFILES)'; \\\n\t  dist_files=`for file in $$list; do echo $$file; done | \\\n\t  sed -e \"s|^$$srcdirstrip/||;t\" \\\n\t      -e \"s|^$$topsrcdirstrip/|$(top_builddir)/|;t\"`; \\\n\tcase $$dist_files in \\\n\t  */*) $(MKDIR_P) `echo \"$$dist_files\" | \\\n\t\t\t   sed '/\\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \\\n\t\t\t   sort -u` ;; \\\n\tesac; \\\n\tfor file in $$dist_files; do \\\n\t  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \\\n\t  if test -d $$d/$$file; then \\\n\t    dir=`echo \"/$$file\" | sed -e 's,/[^/]*$$,,'`; \\\n\t    if test -d \"$(distdir)/$$file\"; then \\\n\t      find \"$(distdir)/$$file\" -type d ! -perm -700 -exec chmod u+rwx {} \\;; \\\n\t    fi; \\\n\t    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \\\n\t      cp -fpR $(srcdir)/$$file \"$(distdir)$$dir\" || exit 1; \\\n\t      find \"$(distdir)/$$file\" -type d ! -perm -700 -exec chmod u+rwx {} \\;; \\\n\t    fi; \\\n\t    cp -fpR $$d/$$file \"$(distdir)$$dir\" || exit 1; \\\n\t  else \\\n\t    test -f \"$(distdir)/$$file\" \\\n\t    || cp -p $$d/$$file \"$(distdir)/$$file\" \\\n\t    || exit 1; \\\n\t  fi; \\\n\tdone\ncheck-am: all-am\ncheck: check-am\nall-am: Makefile $(PROGRAMS)\ninstalldirs:\ninstall: install-am\ninstall-exec: install-exec-am\ninstall-data: install-data-am\nuninstall: uninstall-am\n\ninstall-am: all-am\n\t@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am\n\ninstallcheck: installcheck-am\ninstall-strip:\n\t$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM=\"$(INSTALL_STRIP_PROGRAM)\" \\\n\t  install_sh_PROGRAM=\"$(INSTALL_STRIP_PROGRAM)\" INSTALL_STRIP_FLAG=-s \\\n\t  `test -z '$(STRIP)' || \\\n\t    echo \"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'\"` install\nmostlyclean-generic:\n\nclean-generic:\n\ndistclean-generic:\n\t-test -z \"$(CONFIG_CLEAN_FILES)\" || rm -f $(CONFIG_CLEAN_FILES)\n\t-test . = \"$(srcdir)\" || test -z \"$(CONFIG_CLEAN_VPATH_FILES)\" || rm -f $(CONFIG_CLEAN_VPATH_FILES)\n\nmaintainer-clean-generic:\n\t@echo \"This command is intended for maintainers to use\"\n\t@echo \"it deletes files that may require special tools to rebuild.\"\nclean: clean-am\n\nclean-am: clean-generic clean-libtool clean-noinstPROGRAMS \\\n\tmostlyclean-am\n\ndistclean: distclean-am\n\t-rm -rf ./$(DEPDIR)\n\t-rm -f Makefile\ndistclean-am: clean-am distclean-compile distclean-generic \\\n\tdistclean-tags\n\ndvi: dvi-am\n\ndvi-am:\n\nhtml: html-am\n\nhtml-am:\n\ninfo: info-am\n\ninfo-am:\n\ninstall-data-am:\n\ninstall-dvi: install-dvi-am\n\ninstall-dvi-am:\n\ninstall-exec-am:\n\ninstall-html: install-html-am\n\ninstall-html-am:\n\ninstall-info: install-info-am\n\ninstall-info-am:\n\ninstall-man:\n\ninstall-pdf: install-pdf-am\n\ninstall-pdf-am:\n\ninstall-ps: install-ps-am\n\ninstall-ps-am:\n\ninstallcheck-am:\n\nmaintainer-clean: maintainer-clean-am\n\t-rm -rf ./$(DEPDIR)\n\t-rm -f Makefile\nmaintainer-clean-am: distclean-am maintainer-clean-generic\n\nmostlyclean: mostlyclean-am\n\nmostlyclean-am: mostlyclean-compile mostlyclean-generic \\\n\tmostlyclean-libtool\n\npdf: pdf-am\n\npdf-am:\n\nps: ps-am\n\nps-am:\n\nuninstall-am:\n\n.MAKE: install-am install-strip\n\n.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \\\n\tclean-libtool clean-noinstPROGRAMS ctags distclean \\\n\tdistclean-compile distclean-generic distclean-libtool \\\n\tdistclean-tags distdir dvi dvi-am html html-am info info-am \\\n\tinstall install-am install-data install-data-am install-dvi \\\n\tinstall-dvi-am install-exec install-exec-am install-html \\\n\tinstall-html-am install-info install-info-am install-man \\\n\tinstall-pdf install-pdf-am install-ps install-ps-am \\\n\tinstall-strip installcheck installcheck-am installdirs \\\n\tmaintainer-clean maintainer-clean-generic mostlyclean \\\n\tmostlyclean-compile mostlyclean-generic mostlyclean-libtool \\\n\tpdf pdf-am ps ps-am tags uninstall uninstall-am\n\n\n# Tell versions [3.59,3.63) of GNU make to not export all variables.\n# Otherwise a system limit (for SysV at least) may be exceeded.\n.NOEXPORT:\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/iptcutil/README",
    "content": "\nProgram: IPTCUTIL.C\n\nPurpose: Convert between IPTC binary and a \"special\" IPTC text file format.\n\nUsage:   iptcutil -t | -b [-i file] [-o file] <input >output\n\nNotes:   You tell the program the \"type\" of input file via the -t and -b\n         switches. The -t says that the input is text, while the -b says\n         that the input is binary IPTC. You can use either the -i or the\n         -o switches to tell the program what the input and output files\n         will be, or use simple piping.\n\nAuthor:  William T. Radcliffe (billr@corbis.com)\n         Parts of this program were derived from other places. The original\n         binary to text conversion was taken from the PHP distribution and\n         the tokenizer was written many years ago, by someone else as well.\n\nThis software is provided freely \"as is\", without warranty of any kind,\nexpress or implied, including but not limited to the warranties of\nmerchantability, fitness for a particular purpose and noninfringement.\nIn no event shall William T. Radcliffe be liable for any claim, damages or\nother liability, whether in an action of contract, tort or otherwise,\narising from, out of or in connection with IPTCUTIL\n\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/iptcutil/iptcutil.c",
    "content": "/* $Id: iptcutil.c,v 1.4.2.1 2009-08-30 16:21:46 bfriesen Exp $ */\n\n#include \"tif_config.h\"\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <memory.h>\n#include <ctype.h>\n\n#ifdef HAVE_STRINGS_H\n# include <strings.h>\n#endif\n\n#ifdef HAVE_IO_H\n# include <io.h>\n#endif\n\n#ifdef HAVE_FCNTL_H\n# include <fcntl.h>\n#endif\n\n#ifdef WIN32\n#define STRNICMP strnicmp\n#else \n#define STRNICMP strncasecmp\n#endif \n\ntypedef struct _tag_spec\n{\n  short\n    id;\n\n  char\n    *name;\n} tag_spec;\n\nstatic tag_spec tags[] = {\n    { 5,\"Image Name\" },\n    { 7,\"Edit Status\" },\n    { 10,\"Priority\" },\n    { 15,\"Category\" },\n    { 20,\"Supplemental Category\" },\n    { 22,\"Fixture Identifier\" },\n    { 25,\"Keyword\" },\n    { 30,\"Release Date\" },\n    { 35,\"Release Time\" },\n    { 40,\"Special Instructions\" },\n    { 45,\"Reference Service\" },\n    { 47,\"Reference Date\" },\n    { 50,\"Reference Number\" },\n    { 55,\"Created Date\" },\n    { 60,\"Created Time\" },\n    { 65,\"Originating Program\" },\n    { 70,\"Program Version\" },\n    { 75,\"Object Cycle\" },\n    { 80,\"Byline\" },\n    { 85,\"Byline Title\" },\n    { 90,\"City\" },\n    { 95,\"Province State\" },\n    { 100,\"Country Code\" },\n    { 101,\"Country\" },\n    { 103,\"Original Transmission Reference\" },\n    { 105,\"Headline\" },\n    { 110,\"Credit\" },\n    { 115,\"Source\" },\n    { 116,\"Copyright String\" },\n    { 120,\"Caption\" },\n    { 121,\"Local Caption\" },\n    { 122,\"Caption Writer\" },\n    { 200,\"Custom Field 1\" },\n    { 201,\"Custom Field 2\" },\n    { 202,\"Custom Field 3\" },\n    { 203,\"Custom Field 4\" },\n    { 204,\"Custom Field 5\" },\n    { 205,\"Custom Field 6\" },\n    { 206,\"Custom Field 7\" },\n    { 207,\"Custom Field 8\" },\n    { 208,\"Custom Field 9\" },\n    { 209,\"Custom Field 10\" },\n    { 210,\"Custom Field 11\" },\n    { 211,\"Custom Field 12\" },\n    { 212,\"Custom Field 13\" },\n    { 213,\"Custom Field 14\" },\n    { 214,\"Custom Field 15\" },\n    { 215,\"Custom Field 16\" },\n    { 216,\"Custom Field 17\" },\n    { 217,\"Custom Field 18\" },\n    { 218,\"Custom Field 19\" },\n    { 219,\"Custom Field 20\" }\n};\n\n/*\n * We format the output using HTML conventions\n * to preserve control characters and such.\n */\nvoid formatString(FILE *ofile, const char *s, int len)\n{\n  putc('\"', ofile);\n  for (; len > 0; --len, ++s) {\n    int c = *s;\n    switch (c) {\n    case '&':\n      fputs(\"&amp;\", ofile);\n      break;\n#ifdef HANDLE_GT_LT\n    case '<':\n      fputs(\"&lt;\", ofile);\n      break;\n    case '>':\n      fputs(\"&gt;\", ofile);\n      break;\n#endif\n    case '\"':\n      fputs(\"&quot;\", ofile);\n      break;\n    default:\n      if (iscntrl(c))\n        fprintf(ofile, \"&#%d;\", c);\n      else\n        putc(*s, ofile);\n      break;\n    }\n  }\n  fputs(\"\\\"\\n\", ofile);\n}\n\ntypedef struct _html_code\n{\n  short\n    len;\n  const char\n    *code,\n    val;\n} html_code;\n\nstatic html_code html_codes[] = {\n#ifdef HANDLE_GT_LT\n    { 4,\"&lt;\",'<' },\n    { 4,\"&gt;\",'>' },\n#endif\n    { 5,\"&amp;\",'&' },\n    { 6,\"&quot;\",'\"' }\n};\n\n/*\n * This routine converts HTML escape sequence\n * back to the original ASCII representation.\n * - returns the number of characters dropped.\n */\nint convertHTMLcodes(char *s, int len)\n{\n  if (len <=0 || s==(char*)NULL || *s=='\\0')\n    return 0;\n\n  if (s[1] == '#')\n    {\n      int val, o;\n\n      if (sscanf(s,\"&#%d;\",&val) == 1)\n      {\n        o = 3;\n        while (s[o] != ';')\n        {\n          o++;\n          if (o > 5)\n            break;\n        }\n        if (o < 5)\n          strcpy(s+1, s+1+o);\n        *s = val;\n        return o;\n      }\n    }\n  else\n    {\n      int\n        i,\n        codes = sizeof(html_codes) / sizeof(html_code);\n\n      for (i=0; i < codes; i++)\n      {\n        if (html_codes[i].len <= len)\n          if (STRNICMP(s, html_codes[i].code, html_codes[i].len) == 0)\n            {\n              strcpy(s+1, s+html_codes[i].len);\n              *s = html_codes[i].val;\n              return html_codes[i].len-1;\n            }\n      }\n    }\n\n  return 0;\n}\n\nint formatIPTC(FILE *ifile, FILE *ofile)\n{\n  unsigned int\n    foundiptc,\n    tagsfound;\n\n  unsigned char\n    recnum,\n    dataset;\n\n  char\n    *readable,\n    *str;\n\n  long\n    tagindx,\n    taglen;\n\n  int\n    i,\n    tagcount = sizeof(tags) / sizeof(tag_spec);\n\n  char\n    c;\n\n  foundiptc = 0; /* found the IPTC-Header */\n  tagsfound = 0; /* number of tags found */\n\n  c = getc(ifile);\n  while (c != EOF)\n  {\n\t  if (c == 0x1c)\n\t    foundiptc = 1;\n\t  else\n      {\n        if (foundiptc)\n\t        return -1;\n        else\n\t        continue;\n\t    }\n\n    /* we found the 0x1c tag and now grab the dataset and record number tags */\n    dataset = getc(ifile);\n\t  if ((char) dataset == EOF)\n\t    return -1;\n    recnum = getc(ifile);\n\t  if ((char) recnum == EOF)\n\t    return -1;\n    /* try to match this record to one of the ones in our named table */\n    for (i=0; i< tagcount; i++)\n    {\n      if (tags[i].id == recnum)\n          break;\n    }\n    if (i < tagcount)\n      readable = tags[i].name;\n    else\n      readable = \"\";\n\n    /* then we decode the length of the block that follows - long or short fmt */\n    c = getc(ifile);\n\t  if (c == EOF)\n\t    return 0;\n\t  if (c & (unsigned char) 0x80)\n      {\n        unsigned char\n          buffer[4];\n\n        for (i=0; i<4; i++)\n        {\n          c = buffer[i] = getc(ifile);\n          if (c == EOF)\n            return -1;\n        }\n        taglen = (((long) buffer[ 0 ]) << 24) |\n                 (((long) buffer[ 1 ]) << 16) | \n\t               (((long) buffer[ 2 ]) <<  8) |\n                 (((long) buffer[ 3 ]));\n\t    }\n    else\n      {\n        unsigned char\n          x = c;\n\n        taglen = ((long) x) << 8;\n        x = getc(ifile);\n        if ((char)x == EOF)\n          return -1;\n        taglen |= (long) x;\n\t    }\n    /* make a buffer to hold the tag data and snag it from the input stream */\n    str = (char *) malloc((unsigned int) (taglen+1));\n    if (str == (char *) NULL)\n      {\n        printf(\"Memory allocation failed\");\n        return 0;\n      }\n    for (tagindx=0; tagindx<taglen; tagindx++)\n    {\n      c = str[tagindx] = getc(ifile);\n      if (c == EOF)\n        return -1;\n    }\n    str[ taglen ] = 0;\n\n    /* now finish up by formatting this binary data into ASCII equivalent */\n    if (strlen(readable) > 0)\n\t    fprintf(ofile, \"%d#%d#%s=\",(unsigned int)dataset, (unsigned int) recnum, readable);\n    else\n\t    fprintf(ofile, \"%d#%d=\",(unsigned int)dataset, (unsigned int) recnum);\n    formatString( ofile, str, taglen );\n    free(str);\n\n\t  tagsfound++;\n\n    c = getc(ifile);\n  }\n  return tagsfound;\n}\n\nint tokenizer(unsigned inflag,char *token,int tokmax,char *line,\nchar *white,char *brkchar,char *quote,char eschar,char *brkused,\nint *next,char *quoted);\n\nchar *super_fgets(char *b, int *blen, FILE *file)\n{\n  int\n    c,\n    len;\n\n  char\n    *q;\n\n  len=*blen;\n  for (q=b; ; q++)\n  {\n    c=fgetc(file);\n    if (c == EOF || c == '\\n')\n      break;\n    if (((int)q - (int)b + 1 ) >= (int) len)\n      {\n        int\n          tlen;\n\n        tlen=(int)q-(int)b;\n        len<<=1;\n        b=(char *) realloc((char *) b,(len+2));\n        if ((char *) b == (char *) NULL)\n          break;\n        q=b+tlen;\n      }\n    *q=(unsigned char) c;\n  }\n  *blen=0;\n  if ((unsigned char *)b != (unsigned char *) NULL)\n    {\n      int\n        tlen;\n\n      tlen=(int)q - (int)b;\n      if (tlen == 0)\n        return (char *) NULL;\n      b[tlen] = '\\0';\n      *blen=++tlen;\n    }\n  return b;\n}\n\n#define BUFFER_SZ 4096\n\nint main(int argc, char *argv[])\n{            \n  unsigned int\n    length;\n\n  unsigned char\n    *buffer;\n\n  int\n    i,\n    mode; /* iptc binary, or iptc text */\n\n  FILE\n    *ifile = stdin,\n    *ofile = stdout;\n\n  char\n    c,\n    *usage = \"usage: iptcutil -t | -b [-i file] [-o file] <input >output\";\n\n  if( argc < 2 )\n    {\n      printf(\"%s\\n\", usage);\n\t    return 1;\n    }\n\n  mode = 0;\n  length = -1;\n  buffer = (unsigned char *)NULL;\n\n  for (i=1; i<argc; i++)\n  {\n    c = argv[i][0];\n    if (c == '-' || c == '/')\n      {\n        c = argv[i][1];\n        switch( c )\n        {\n        case 't':\n\t        mode = 1;\n#ifdef WIN32\n          /* Set \"stdout\" to binary mode: */\n          _setmode( _fileno( ofile ), _O_BINARY );\n#endif\n\t        break;\n        case 'b':\n\t        mode = 0;\n#ifdef WIN32\n          /* Set \"stdin\" to binary mode: */\n          _setmode( _fileno( ifile ), _O_BINARY );\n#endif\n\t        break;\n        case 'i':\n          if (mode == 0)\n            ifile = fopen(argv[++i], \"rb\");\n          else\n            ifile = fopen(argv[++i], \"rt\");\n          if (ifile == (FILE *)NULL)\n            {\n\t            printf(\"Unable to open: %s\\n\", argv[i]);\n              return 1;\n            }\n\t        break;\n        case 'o':\n          if (mode == 0)\n            ofile = fopen(argv[++i], \"wt\");\n          else\n            ofile = fopen(argv[++i], \"wb\");\n          if (ofile == (FILE *)NULL)\n            {\n\t            printf(\"Unable to open: %s\\n\", argv[i]);\n              return 1;\n            }\n\t        break;\n        default:\n\t        printf(\"Unknown option: %s\\n\", argv[i]);\n\t        return 1;\n        }\n      }\n    else\n      {\n        printf(\"%s\\n\", usage);\n\t      return 1;\n      }\n  }\n\n  if (mode == 0) /* handle binary iptc info */\n    formatIPTC(ifile, ofile);\n\n  if (mode == 1) /* handle text form of iptc info */\n    {\n      char\n        brkused,\n        quoted,\n        *line,\n        *token,\n        *newstr;\n\n      int\n        state,\n        next;\n\n      unsigned char\n        recnum = 0,\n        dataset = 0;\n\n      int\n        inputlen = BUFFER_SZ;\n\n      line = (char *) malloc(inputlen);     \n      token = (char *)NULL;\n      while((line = super_fgets(line,&inputlen,ifile))!=NULL)\n      {\n        state=0;\n        next=0;\n\n        token = (char *) malloc(inputlen);     \n        newstr = (char *) malloc(inputlen);     \n        while(tokenizer(0, token, inputlen, line, \"\", \"=\", \"\\\"\", 0,\n          &brkused,&next,&quoted)==0)\n        {\n          if (state == 0)\n            {                  \n              int\n                state,\n                next;\n\n              char\n                brkused,\n                quoted;\n\n              state=0;\n              next=0;\n              while(tokenizer(0, newstr, inputlen, token, \"\", \"#\", \"\", 0,\n                &brkused, &next, &quoted)==0)\n              {\n                if (state == 0)\n                  dataset = (unsigned char) atoi(newstr);\n                else\n                   if (state == 1)\n                     recnum = (unsigned char) atoi(newstr);\n                state++;\n              }\n            }\n          else\n            if (state == 1)\n              {\n                int\n                  next;\n\n                unsigned long\n                  len;\n\n                char\n                  brkused,\n                  quoted;\n\n                next=0;\n                len = strlen(token);\n                while(tokenizer(0, newstr, inputlen, token, \"\", \"&\", \"\", 0,\n                  &brkused, &next, &quoted)==0)\n                {\n                  if (brkused && next > 0)\n                    {\n                      char\n                        *s = &token[next-1];\n\n                      len -= convertHTMLcodes(s, strlen(s));\n                    }\n                }\n\n                fputc(0x1c, ofile);\n                fputc(dataset, ofile);\n                fputc(recnum, ofile);\n                if (len < 0x10000)\n                  {\n                    fputc((len >> 8) & 255, ofile);\n                    fputc(len & 255, ofile);\n                  }\n                else\n                  {\n                    fputc(((len >> 24) & 255) | 0x80, ofile);\n                    fputc((len >> 16) & 255, ofile);\n                    fputc((len >> 8) & 255, ofile);\n                    fputc(len & 255, ofile);\n                  }\n                next=0;\n                while (len--)\n                  fputc(token[next++], ofile);\n              }\n          state++;\n        }\n        free(token);\n        token = (char *)NULL;\n        free(newstr);\n        newstr = (char *)NULL;\n      }\n      free(line);\n\n      fclose( ifile );\n      fclose( ofile );\n    }\n\n  return 0;\n}\n\n/*\n\tThis routine is a generalized, finite state token parser. It allows\n    you extract tokens one at a time from a string of characters.  The\n    characters used for white space, for break characters, and for quotes\n    can be specified. Also, characters in the string can be preceded by\n    a specifiable escape character which removes any special meaning the\n    character may have.\n\n\tThere are a lot of formal parameters in this subroutine call, but\n\tonce you get familiar with them, this routine is fairly easy to use.\n\t\"#define\" macros can be used to generate simpler looking calls for\n\tcommonly used applications of this routine.\n\n\tFirst, some terminology:\n\n\ttoken:\t\tused here, a single unit of information in\n\t\t\t\tthe form of a group of characters.\n\n\twhite space:\tspace that gets ignored (except within quotes\n\t\t\t\tor when escaped), like blanks and tabs.  in\n\t\t\t\taddition, white space terminates a non-quoted\n\t\t\t\ttoken.\n\n\tbreak character: a character that separates non-quoted tokens.\n\t\t\t\tcommas are a common break character.  the\n\t\t\t\tusage of break characters to signal the end\n\t\t\t\tof a token is the same as that of white space,\n\t\t\t\texcept multiple break characters with nothing\n\t\t\t\tor only white space between generate a null\n\t\t\t\ttoken for each two break characters together.\n\n\t\t\t\tfor example, if blank is set to be the white\n\t\t\t\tspace and comma is set to be the break\n\t\t\t\tcharacter, the line ...\n\n\t\t\t\tA, B, C ,  , DEF\n\n\t\t\t\t... consists of 5 tokens:\n\n\t\t\t\t1)\t\"A\"\n\t\t\t\t2)\t\"B\"\n\t\t\t\t3)\t\"C\"\n\t\t\t\t4)\t\"\"      (the null string)\n\t\t\t\t5)\t\"DEF\"\n\n\tquote character: \ta character that, when surrounding a group\n\t\t\t\tof other characters, causes the group of\n\t\t\t\tcharacters to be treated as a single token,\n\t\t\t\tno matter how many white spaces or break\n\t\t\t\tcharacters exist in the group.\talso, a\n\t\t\t\ttoken always terminates after the closing\n\t\t\t\tquote.\tfor example, if ' is the quote\n\t\t\t\tcharacter, blank is white space, and comma\n\t\t\t\tis the break character, the following\n\t\t\t\tstring ...\n\n\t\t\t\tA, ' B, CD'EF GHI\n\n\t\t\t\t... consists of 4 tokens:\n\n\t\t\t\t1)\t\"A\"\n\t\t\t\t2)\t\" B, CD\" (note the blanks & comma)\n\t\t\t\t3)\t\"EF\"\n\t\t\t\t4)\t\"GHI\"\n\n\t\t\t\tthe quote characters themselves do\n\t\t\t\tnot appear in the resultant tokens.  the\n\t\t\t\tdouble quotes are delimiters i use here for\n\t\t\t\tdocumentation purposes only.\n\n\tescape character:\ta character which itself is ignored but\n\t\t\t\twhich causes the next character to be\n\t\t\t\tused as is.  ^ and \\ are often used as\n\t\t\t\tescape characters.  an escape in the last\n\t\t\t\tposition of the string gets treated as a\n\t\t\t\t\"normal\" (i.e., non-quote, non-white,\n\t\t\t\tnon-break, and non-escape) character.\n\t\t\t\tfor example, assume white space, break\n\t\t\t\tcharacter, and quote are the same as in the\n\t\t\t\tabove examples, and further, assume that\n\t\t\t\t^ is the escape character.  then, in the\n\t\t\t\tstring ...\n\n\t\t\t\tABC, ' DEF ^' GH' I ^ J K^ L ^\n\n\t\t\t\t... there are 7 tokens:\n\n\t\t\t\t1)\t\"ABC\"\n\t\t\t\t2)\t\" DEF ' GH\"\n\t\t\t\t3)\t\"I\"\n\t\t\t\t4)\t\" \"     (a lone blank)\n\t\t\t\t5)\t\"J\"\n\t\t\t\t6)\t\"K L\"\n\t\t\t\t7)\t\"^\"     (passed as is at end of line)\n\n\n\tOK, now that you have this background, here's how to call \"tokenizer\":\n\n\tresult=tokenizer(flag,token,maxtok,string,white,break,quote,escape,\n\t\t      brkused,next,quoted)\n\n\tresult: \t0 if we haven't reached EOS (end of string), and\n\t\t\t1 if we have (this is an \"int\").\n\n\tflag:\t\tright now, only the low order 3 bits are used.\n\t\t\t1 => convert non-quoted tokens to upper case\n\t\t\t2 => convert non-quoted tokens to lower case\n\t\t\t0 => do not convert non-quoted tokens\n\t\t\t(this is a \"char\").\n\n\ttoken:\t\ta character string containing the returned next token\n\t\t\t(this is a \"char[]\").\n\n\tmaxtok: \tthe maximum size of \"token\".  characters beyond\n\t\t\t\"maxtok\" are truncated (this is an \"int\").\n\n\tstring: \tthe string to be parsed (this is a \"char[]\").\n\n\twhite:\t\ta string of the valid white spaces.  example:\n\n\t\t\tchar whitesp[]={\" \\t\"};\n\n\t\t\tblank and tab will be valid white space (this is\n\t\t\ta \"char[]\").\n\n\tbreak:\t\ta string of the valid break characters.  example:\n\n\t\t\tchar breakch[]={\";,\"};\n\n\t\t\tsemicolon and comma will be valid break characters\n\t\t\t(this is a \"char[]\").\n\n\t\t\tIMPORTANT:  do not use the name \"break\" as a C\n\t\t\tvariable, as this is a reserved word in C.\n\n\tquote:\t\ta string of the valid quote characters.  an example\n\t\t\twould be\n\n\t\t\tchar whitesp[]={\"'\\\"\");\n\n\t\t\t(this causes single and double quotes to be valid)\n\t\t\tnote that a token starting with one of these characters\n\t\t\tneeds the same quote character to terminate it.\n\n\t\t\tfor example,\n\n\t\t\t\"ABC '\n\n\t\t\tis unterminated, but\n\n\t\t\t\"DEF\" and 'GHI'\n\n\t\t\tare properly terminated.  note that different quote\n\t\t\tcharacters can appear on the same line; only for\n\t\t\ta given token do the quote characters have to be\n\t\t\tthe same (this is a \"char[]\").\n\n\tescape: \tthe escape character (NOT a string ... only one\n\t\t\tallowed).  use zero if none is desired (this is\n\t\t\ta \"char\").\n\n\tbrkused:\tthe break character used to terminate the current\n\t\t\ttoken.\tif the token was quoted, this will be the\n\t\t\tquote used.  if the token is the last one on the\n\t\t\tline, this will be zero (this is a pointer to a\n\t\t\t\"char\").\n\n\tnext:\t\tthis variable points to the first character of the\n\t\t\tnext token.  it gets reset by \"tokenizer\" as it steps\n\t\t\tthrough the string.  set it to 0 upon initialization,\n\t\t\tand leave it alone after that.\tyou can change it\n\t\t\tif you want to jump around in the string or re-parse\n\t\t\tfrom the beginning, but be careful (this is a\n\t\t\tpointer to an \"int\").\n\n\tquoted: \tset to 1 (true) if the token was quoted and 0 (false)\n\t\t\tif not.  you may need this information (for example:\n\t\t\tin C, a string with quotes around it is a character\n\t\t\tstring, while one without is an identifier).\n\n\t\t\t(this is a pointer to a \"char\").\n*/\n\n/* states */\n\n#define IN_WHITE 0\n#define IN_TOKEN 1\n#define IN_QUOTE 2\n#define IN_OZONE 3\n\nint _p_state;\t   /* current state\t */\nunsigned _p_flag;  /* option flag\t */\nchar _p_curquote;  /* current quote char */\nint _p_tokpos;\t   /* current token pos  */\n\n/* routine to find character in string ... used only by \"tokenizer\" */\n\nint sindex(char ch,char *string)\n{\n  char *cp;\n  for(cp=string;*cp;++cp)\n    if(ch==*cp)\n      return (int)(cp-string);\t/* return postion of character */\n  return -1;\t\t\t/* eol ... no match found */\n}\n\n/* routine to store a character in a string ... used only by \"tokenizer\" */\n\nvoid chstore(char *string,int max,char ch)\n{\n  char c;\n  if(_p_tokpos>=0&&_p_tokpos<max-1)\n  {\n    if(_p_state==IN_QUOTE)\n      c=ch;\n    else\n      switch(_p_flag&3)\n      {\n\t    case 1: \t    /* convert to upper */\n\t      c=toupper(ch);\n\t      break;\n\n\t    case 2: \t    /* convert to lower */\n\t      c=tolower(ch);\n\t      break;\n\n\t    default:\t    /* use as is */\n\t      c=ch;\n\t      break;\n      }\n    string[_p_tokpos++]=c;\n  }\n  return;\n}\n\nint tokenizer(unsigned inflag,char *token,int tokmax,char *line,\n  char *white,char *brkchar,char *quote,char eschar,char *brkused,\n    int *next,char *quoted)\n{\n  int qp;\n  char c,nc;\n\n  *brkused=0;\t\t/* initialize to null */\n  *quoted=0;\t\t/* assume not quoted  */\n\n  if(!line[*next])\t/* if we're at end of line, indicate such */\n    return 1;\n\n  _p_state=IN_WHITE;   /* initialize state */\n  _p_curquote=0;\t   /* initialize previous quote char */\n  _p_flag=inflag;\t   /* set option flag */\n\n  for(_p_tokpos=0;(c=line[*next]);++(*next))\t/* main loop */\n  {\n    if((qp=sindex(c,brkchar))>=0)  /* break */\n    {\n      switch(_p_state)\n      {\n\t    case IN_WHITE:\t\t/* these are the same here ...\t*/\n\t    case IN_TOKEN:\t\t/* ... just get out\t\t*/\n\t    case IN_OZONE:\t\t/* ditto\t\t\t*/\n\t      ++(*next);\n\t      *brkused=brkchar[qp];\n\t      goto byebye;\n\n\t    case IN_QUOTE:\t\t /* just keep going */\n\t      chstore(token,tokmax,c);\n\t      break;\n      }\n    }\n    else if((qp=sindex(c,quote))>=0)  /* quote */\n    {\n      switch(_p_state)\n      {\n\t    case IN_WHITE:\t /* these are identical, */\n\t      _p_state=IN_QUOTE; /* change states   */\n\t      _p_curquote=quote[qp]; /* save quote char */\n\t      *quoted=1;\t/* set to true as long as something is in quotes */\n\t      break;\n\n\t    case IN_QUOTE:\n\t      if(quote[qp]==_p_curquote) /* same as the beginning quote? */\n\t      {\n\t        _p_state=IN_OZONE;\n\t        _p_curquote=0;\n\t      }\n\t      else\n\t        chstore(token,tokmax,c); /* treat as regular char */\n\t      break;\n\n\t    case IN_TOKEN:\n\t    case IN_OZONE:\n\t      *brkused=c; /* uses quote as break char */\n\t      goto byebye;\n      }\n    }\n    else if((qp=sindex(c,white))>=0) /* white */\n    {\n      switch(_p_state)\n      {\n\t    case IN_WHITE:\n\t    case IN_OZONE:\n\t      break;\t\t/* keep going */\n\n\t    case IN_TOKEN:\n\t      _p_state=IN_OZONE;\n\t      break;\n\n\t    case IN_QUOTE:\n\t      chstore(token,tokmax,c); /* it's valid here */\n\t      break;\n      }\n    }\n    else if(c==eschar)  /* escape */\n    {\n      nc=line[(*next)+1];\n      if(nc==0) \t\t/* end of line */\n      {\n\t    *brkused=0;\n\t    chstore(token,tokmax,c);\n\t    ++(*next);\n\t    goto byebye;\n      }\n      switch(_p_state)\n      {\n\t    case IN_WHITE:\n\t      --(*next);\n\t      _p_state=IN_TOKEN;\n\t      break;\n\n\t    case IN_TOKEN:\n\t    case IN_QUOTE:\n\t      ++(*next);\n\t      chstore(token,tokmax,nc);\n\t      break;\n\n\t    case IN_OZONE:\n\t      goto byebye;\n      }\n    }\n    else\t/* anything else is just a real character */\n    {\n      switch(_p_state)\n      {\n\t    case IN_WHITE:\n\t      _p_state=IN_TOKEN; /* switch states */\n\n\t    case IN_TOKEN:\t\t /* these 2 are     */\n\t    case IN_QUOTE:\t\t /*  identical here */\n\t      chstore(token,tokmax,c);\n\t      break;\n\n\t    case IN_OZONE:\n\t      goto byebye;\n      }\n    }\n  }\t\t/* end of main loop */\n\nbyebye:\n  token[_p_tokpos]=0;\t/* make sure token ends with EOS */\n\n  return 0;\n}\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/iptcutil/test.txt",
    "content": "2#0=\"&#0;&#2;\"\n2#120#Caption=\"Chairman of the US House Judiciary Committee, Henry Hyde,R-IL, makes his opening statement during impeachment hearings 11 December on Capitol Hill in Washington, DC. The committee is debating the articles of impechment and my take a vote on the impeachment of US President BIll Clinton on charges that he obstucted justice, lied and abused the power of his office as early as today.    AFP PHOTO Paul J. RICHARDS&#13;\"\n2#122#Caption Writer=\"kb/lt\"\n2#100#Country Code=\"USA\"\n2#105#Headline=\"Old fart squeezing two fingers.\"\n2#30#Release Date=\"19981211\"\n2#35#Release Time=\"000000+0000\"\n2#40#Special Instructions=\"This is a test. This is only a test. ABCDEFGHIJKLMNOPQRSTUVWXYZ 1234567890\"\n2#80#Byline=\"PAUL J. RICHARDS\"\n2#85#Byline Title=\"STF\"\n2#110#Credit=\"AFP\"\n2#65#Originating Program=\"MacDesk Reporter\"\n2#115#Source=\"AFP\"\n2#5#Image Name=\"US-HYDE\"\n2#55#Created Date=\"19981211\"\n2#90#City=\"WASHINGTON\"\n2#95#Province State=\"DC\"\n2#101#Country=\"UNITED STATES\"\n2#103#Original Transmission Reference=\"DCA03\"\n2#15#Category=\"POL\"\n2#20#Supplemental Category=\"GOVERNMENT\"\n2#10#Priority=\"5\"\n2#25#Keyword=\"fart\"\n2#25#Keyword=\"squeezing\"\n2#25#Keyword=\"old\"\n2#25#Keyword=\"fingers\"\n2#75#Object Cycle=\"a\"\n2#60#Created Time=\"000000+0000\"\n2#70#Program Version=\"2.0.3\"\n2#130=\"3S\"\n2#135=\"GB\"\n2#231=\"Kaya A. Hoffmann 12/14/98 12:00:44 PM  Copy To : Selects - \\\\KINYANI\\Selects&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;\"\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/mac-cw/Makefile.am",
    "content": "# Tag Image File Format (TIFF) Software\n#\n# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>\n#\n# Permission to use, copy, modify, distribute, and sell this software and \n# its documentation for any purpose is hereby granted without fee, provided\n# that (i) the above copyright notices and this permission notice appear in\n# all copies of the software and related documentation, and (ii) the names of\n# Sam Leffler and Silicon Graphics may not be used in any advertising or\n# publicity relating to the software without the specific, prior written\n# permission of Sam Leffler and Silicon Graphics.\n# \n# THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n# \n# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n# OF THIS SOFTWARE.\n\n# Process this file with automake to produce Makefile.in.\n\nEXTRA_DIST = Makefile.script README mac_main.c mac_main.h metrowerks.note mkg3_main.c version.h\n\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/mac-cw/Makefile.in",
    "content": "# Makefile.in generated by automake 1.11 from Makefile.am.\n# @configure_input@\n\n# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,\n# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,\n# Inc.\n# This Makefile.in is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY, to the extent permitted by law; without\n# even the implied warranty of MERCHANTABILITY or FITNESS FOR A\n# PARTICULAR PURPOSE.\n\n@SET_MAKE@\n\n# Tag Image File Format (TIFF) Software\n#\n# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>\n#\n# Permission to use, copy, modify, distribute, and sell this software and \n# its documentation for any purpose is hereby granted without fee, provided\n# that (i) the above copyright notices and this permission notice appear in\n# all copies of the software and related documentation, and (ii) the names of\n# Sam Leffler and Silicon Graphics may not be used in any advertising or\n# publicity relating to the software without the specific, prior written\n# permission of Sam Leffler and Silicon Graphics.\n# \n# THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n# \n# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n# OF THIS SOFTWARE.\n\n# Process this file with automake to produce Makefile.in.\nVPATH = @srcdir@\npkgdatadir = $(datadir)/@PACKAGE@\npkgincludedir = $(includedir)/@PACKAGE@\npkglibdir = $(libdir)/@PACKAGE@\npkglibexecdir = $(libexecdir)/@PACKAGE@\nam__cd = CDPATH=\"$${ZSH_VERSION+.}$(PATH_SEPARATOR)\" && cd\ninstall_sh_DATA = $(install_sh) -c -m 644\ninstall_sh_PROGRAM = $(install_sh) -c\ninstall_sh_SCRIPT = $(install_sh) -c\nINSTALL_HEADER = $(INSTALL_DATA)\ntransform = $(program_transform_name)\nNORMAL_INSTALL = :\nPRE_INSTALL = :\nPOST_INSTALL = :\nNORMAL_UNINSTALL = :\nPRE_UNINSTALL = :\nPOST_UNINSTALL = :\nbuild_triplet = @build@\nhost_triplet = @host@\ntarget_triplet = @target@\nsubdir = contrib/mac-cw\nDIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in\nACLOCAL_M4 = $(top_srcdir)/aclocal.m4\nam__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \\\n\t$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \\\n\t$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \\\n\t$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac\nam__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \\\n\t$(ACLOCAL_M4)\nmkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs\nCONFIG_HEADER = $(top_builddir)/libtiff/tif_config.h \\\n\t$(top_builddir)/libtiff/tiffconf.h\nCONFIG_CLEAN_FILES =\nCONFIG_CLEAN_VPATH_FILES =\nAM_V_GEN = $(am__v_GEN_$(V))\nam__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))\nam__v_GEN_0 = @echo \"  GEN   \" $@;\nAM_V_at = $(am__v_at_$(V))\nam__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))\nam__v_at_0 = @\nSOURCES =\nDIST_SOURCES =\nDISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)\nACLOCAL = @ACLOCAL@\nAMTAR = @AMTAR@\nAM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@\nAR = @AR@\nAS = @AS@\nAUTOCONF = @AUTOCONF@\nAUTOHEADER = @AUTOHEADER@\nAUTOMAKE = @AUTOMAKE@\nAWK = @AWK@\nCC = @CC@\nCCDEPMODE = @CCDEPMODE@\nCFLAGS = @CFLAGS@\nCPP = @CPP@\nCPPFLAGS = @CPPFLAGS@\nCXX = @CXX@\nCXXCPP = @CXXCPP@\nCXXDEPMODE = @CXXDEPMODE@\nCXXFLAGS = @CXXFLAGS@\nCYGPATH_W = @CYGPATH_W@\nDEFS = @DEFS@\nDEPDIR = @DEPDIR@\nDLLTOOL = @DLLTOOL@\nDSYMUTIL = @DSYMUTIL@\nDUMPBIN = @DUMPBIN@\nECHO_C = @ECHO_C@\nECHO_N = @ECHO_N@\nECHO_T = @ECHO_T@\nEGREP = @EGREP@\nEXEEXT = @EXEEXT@\nFGREP = @FGREP@\nGLUT_CFLAGS = @GLUT_CFLAGS@\nGLUT_LIBS = @GLUT_LIBS@\nGLU_CFLAGS = @GLU_CFLAGS@\nGLU_LIBS = @GLU_LIBS@\nGL_CFLAGS = @GL_CFLAGS@\nGL_LIBS = @GL_LIBS@\nGREP = @GREP@\nINSTALL = @INSTALL@\nINSTALL_DATA = @INSTALL_DATA@\nINSTALL_PROGRAM = @INSTALL_PROGRAM@\nINSTALL_SCRIPT = @INSTALL_SCRIPT@\nINSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@\nLD = @LD@\nLDFLAGS = @LDFLAGS@\nLIBDIR = @LIBDIR@\nLIBOBJS = @LIBOBJS@\nLIBS = @LIBS@\nLIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@\nLIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@\nLIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@\nLIBTIFF_MICRO_VERSION = @LIBTIFF_MICRO_VERSION@\nLIBTIFF_MINOR_VERSION = @LIBTIFF_MINOR_VERSION@\nLIBTIFF_RELEASE_DATE = @LIBTIFF_RELEASE_DATE@\nLIBTIFF_VERSION = @LIBTIFF_VERSION@\nLIBTIFF_VERSION_INFO = @LIBTIFF_VERSION_INFO@\nLIBTOOL = @LIBTOOL@\nLIPO = @LIPO@\nLN_S = @LN_S@\nLTLIBOBJS = @LTLIBOBJS@\nMAINT = @MAINT@\nMAKEINFO = @MAKEINFO@\nMKDIR_P = @MKDIR_P@\nNM = @NM@\nNMEDIT = @NMEDIT@\nOBJDUMP = @OBJDUMP@\nOBJEXT = @OBJEXT@\nOTOOL = @OTOOL@\nOTOOL64 = @OTOOL64@\nPACKAGE = @PACKAGE@\nPACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@\nPACKAGE_NAME = @PACKAGE_NAME@\nPACKAGE_STRING = @PACKAGE_STRING@\nPACKAGE_TARNAME = @PACKAGE_TARNAME@\nPACKAGE_URL = @PACKAGE_URL@\nPACKAGE_VERSION = @PACKAGE_VERSION@\nPATH_SEPARATOR = @PATH_SEPARATOR@\nPTHREAD_CC = @PTHREAD_CC@\nPTHREAD_CFLAGS = @PTHREAD_CFLAGS@\nPTHREAD_LIBS = @PTHREAD_LIBS@\nRANLIB = @RANLIB@\nSED = @SED@\nSET_MAKE = @SET_MAKE@\nSHELL = @SHELL@\nSTRIP = @STRIP@\nVERSION = @VERSION@\nXMKMF = @XMKMF@\nX_CFLAGS = @X_CFLAGS@\nX_EXTRA_LIBS = @X_EXTRA_LIBS@\nX_LIBS = @X_LIBS@\nX_PRE_LIBS = @X_PRE_LIBS@\nabs_builddir = @abs_builddir@\nabs_srcdir = @abs_srcdir@\nabs_top_builddir = @abs_top_builddir@\nabs_top_srcdir = @abs_top_srcdir@\nac_ct_CC = @ac_ct_CC@\nac_ct_CXX = @ac_ct_CXX@\nac_ct_DUMPBIN = @ac_ct_DUMPBIN@\nacx_pthread_config = @acx_pthread_config@\nam__include = @am__include@\nam__leading_dot = @am__leading_dot@\nam__quote = @am__quote@\nam__tar = @am__tar@\nam__untar = @am__untar@\nbindir = @bindir@\nbuild = @build@\nbuild_alias = @build_alias@\nbuild_cpu = @build_cpu@\nbuild_os = @build_os@\nbuild_vendor = @build_vendor@\nbuilddir = @builddir@\ndatadir = @datadir@\ndatarootdir = @datarootdir@\ndocdir = @docdir@\ndvidir = @dvidir@\nexec_prefix = @exec_prefix@\nhost = @host@\nhost_alias = @host_alias@\nhost_cpu = @host_cpu@\nhost_os = @host_os@\nhost_vendor = @host_vendor@\nhtmldir = @htmldir@\nincludedir = @includedir@\ninfodir = @infodir@\ninstall_sh = @install_sh@\nlibdir = @libdir@\nlibexecdir = @libexecdir@\nlocaledir = @localedir@\nlocalstatedir = @localstatedir@\nlt_ECHO = @lt_ECHO@\nmandir = @mandir@\nmkdir_p = @mkdir_p@\noldincludedir = @oldincludedir@\npdfdir = @pdfdir@\nprefix = @prefix@\nprogram_transform_name = @program_transform_name@\npsdir = @psdir@\nsbindir = @sbindir@\nsharedstatedir = @sharedstatedir@\nsrcdir = @srcdir@\nsysconfdir = @sysconfdir@\ntarget = @target@\ntarget_alias = @target_alias@\ntarget_cpu = @target_cpu@\ntarget_os = @target_os@\ntarget_vendor = @target_vendor@\ntop_build_prefix = @top_build_prefix@\ntop_builddir = @top_builddir@\ntop_srcdir = @top_srcdir@\nEXTRA_DIST = Makefile.script README mac_main.c mac_main.h metrowerks.note mkg3_main.c version.h\nall: all-am\n\n.SUFFIXES:\n$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)\n\t@for dep in $?; do \\\n\t  case '$(am__configure_deps)' in \\\n\t    *$$dep*) \\\n\t      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \\\n\t        && { if test -f $@; then exit 0; else break; fi; }; \\\n\t      exit 1;; \\\n\t  esac; \\\n\tdone; \\\n\techo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign contrib/mac-cw/Makefile'; \\\n\t$(am__cd) $(top_srcdir) && \\\n\t  $(AUTOMAKE) --foreign contrib/mac-cw/Makefile\n.PRECIOUS: Makefile\nMakefile: $(srcdir)/Makefile.in $(top_builddir)/config.status\n\t@case '$?' in \\\n\t  *config.status*) \\\n\t    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \\\n\t  *) \\\n\t    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \\\n\t    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \\\n\tesac;\n\n$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n\n$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n$(am__aclocal_m4_deps):\n\nmostlyclean-libtool:\n\t-rm -f *.lo\n\nclean-libtool:\n\t-rm -rf .libs _libs\ntags: TAGS\nTAGS:\n\nctags: CTAGS\nCTAGS:\n\n\ndistdir: $(DISTFILES)\n\t@srcdirstrip=`echo \"$(srcdir)\" | sed 's/[].[^$$\\\\*]/\\\\\\\\&/g'`; \\\n\ttopsrcdirstrip=`echo \"$(top_srcdir)\" | sed 's/[].[^$$\\\\*]/\\\\\\\\&/g'`; \\\n\tlist='$(DISTFILES)'; \\\n\t  dist_files=`for file in $$list; do echo $$file; done | \\\n\t  sed -e \"s|^$$srcdirstrip/||;t\" \\\n\t      -e \"s|^$$topsrcdirstrip/|$(top_builddir)/|;t\"`; \\\n\tcase $$dist_files in \\\n\t  */*) $(MKDIR_P) `echo \"$$dist_files\" | \\\n\t\t\t   sed '/\\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \\\n\t\t\t   sort -u` ;; \\\n\tesac; \\\n\tfor file in $$dist_files; do \\\n\t  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \\\n\t  if test -d $$d/$$file; then \\\n\t    dir=`echo \"/$$file\" | sed -e 's,/[^/]*$$,,'`; \\\n\t    if test -d \"$(distdir)/$$file\"; then \\\n\t      find \"$(distdir)/$$file\" -type d ! -perm -700 -exec chmod u+rwx {} \\;; \\\n\t    fi; \\\n\t    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \\\n\t      cp -fpR $(srcdir)/$$file \"$(distdir)$$dir\" || exit 1; \\\n\t      find \"$(distdir)/$$file\" -type d ! -perm -700 -exec chmod u+rwx {} \\;; \\\n\t    fi; \\\n\t    cp -fpR $$d/$$file \"$(distdir)$$dir\" || exit 1; \\\n\t  else \\\n\t    test -f \"$(distdir)/$$file\" \\\n\t    || cp -p $$d/$$file \"$(distdir)/$$file\" \\\n\t    || exit 1; \\\n\t  fi; \\\n\tdone\ncheck-am: all-am\ncheck: check-am\nall-am: Makefile\ninstalldirs:\ninstall: install-am\ninstall-exec: install-exec-am\ninstall-data: install-data-am\nuninstall: uninstall-am\n\ninstall-am: all-am\n\t@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am\n\ninstallcheck: installcheck-am\ninstall-strip:\n\t$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM=\"$(INSTALL_STRIP_PROGRAM)\" \\\n\t  install_sh_PROGRAM=\"$(INSTALL_STRIP_PROGRAM)\" INSTALL_STRIP_FLAG=-s \\\n\t  `test -z '$(STRIP)' || \\\n\t    echo \"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'\"` install\nmostlyclean-generic:\n\nclean-generic:\n\ndistclean-generic:\n\t-test -z \"$(CONFIG_CLEAN_FILES)\" || rm -f $(CONFIG_CLEAN_FILES)\n\t-test . = \"$(srcdir)\" || test -z \"$(CONFIG_CLEAN_VPATH_FILES)\" || rm -f $(CONFIG_CLEAN_VPATH_FILES)\n\nmaintainer-clean-generic:\n\t@echo \"This command is intended for maintainers to use\"\n\t@echo \"it deletes files that may require special tools to rebuild.\"\nclean: clean-am\n\nclean-am: clean-generic clean-libtool mostlyclean-am\n\ndistclean: distclean-am\n\t-rm -f Makefile\ndistclean-am: clean-am distclean-generic\n\ndvi: dvi-am\n\ndvi-am:\n\nhtml: html-am\n\nhtml-am:\n\ninfo: info-am\n\ninfo-am:\n\ninstall-data-am:\n\ninstall-dvi: install-dvi-am\n\ninstall-dvi-am:\n\ninstall-exec-am:\n\ninstall-html: install-html-am\n\ninstall-html-am:\n\ninstall-info: install-info-am\n\ninstall-info-am:\n\ninstall-man:\n\ninstall-pdf: install-pdf-am\n\ninstall-pdf-am:\n\ninstall-ps: install-ps-am\n\ninstall-ps-am:\n\ninstallcheck-am:\n\nmaintainer-clean: maintainer-clean-am\n\t-rm -f Makefile\nmaintainer-clean-am: distclean-am maintainer-clean-generic\n\nmostlyclean: mostlyclean-am\n\nmostlyclean-am: mostlyclean-generic mostlyclean-libtool\n\npdf: pdf-am\n\npdf-am:\n\nps: ps-am\n\nps-am:\n\nuninstall-am:\n\n.MAKE: install-am install-strip\n\n.PHONY: all all-am check check-am clean clean-generic clean-libtool \\\n\tdistclean distclean-generic distclean-libtool distdir dvi \\\n\tdvi-am html html-am info info-am install install-am \\\n\tinstall-data install-data-am install-dvi install-dvi-am \\\n\tinstall-exec install-exec-am install-html install-html-am \\\n\tinstall-info install-info-am install-man install-pdf \\\n\tinstall-pdf-am install-ps install-ps-am install-strip \\\n\tinstallcheck installcheck-am installdirs maintainer-clean \\\n\tmaintainer-clean-generic mostlyclean mostlyclean-generic \\\n\tmostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am\n\n\n# Tell versions [3.59,3.63) of GNU make to not export all variables.\n# Otherwise a system limit (for SysV at least) may be exceeded.\n.NOEXPORT:\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/mac-cw/Makefile.script",
    "content": "\n(* You must manually set the top-level PATHNAME here; everything else is automatic *)\n\nset PATHNAME to \"ritter:tiff-v3.4beta028:\"\nset PRINTING to \"NO\"\n\nset MKG3STATES to PATHNAME & \"mkg3states.mw\"\nset LIBTIFF to PATHNAME & \"libtiff-68K.mw\"\nset TIFFINFO to PATHNAME & \"tiffinfo.mw\"\n\nwith timeout of 60000 seconds\n\ttell application \"MW C/C++ 68K 1.2.2\"\n\t\t\n\t\tactivate\n\t\t\n\t\t\n\t\t(* Create tif_fax3sm.c file *)\n\t\tCreate Project {file MKG3STATES}\n\t\tAdd Files {\"mkg3states.c\", \"mkg3_main.c\", \"getopt.c\"}\n\t\tAdd Files {\"MacOS.lib\"} To Segment 2\n\t\tAdd Files {\"ANSI (4i/8d) C.68K.Lib\"} To Segment 3\n\t\tAdd Files {\"SIOUX.68K.Lib\"} To Segment 4\n\t\tAdd Files {\"MathLib68K (4i/8d).Lib\"} To Segment 5\n\t\t\n\t\tSet Preferences To {Activate CPlusPlus:false, ARM Conformance:false, ANSI Keywords Only:false, Require Function Prototypes:false, Expand Trigraph Sequences:false, Enums Always Ints:false, MPW Pointer Type Rules:false, Prefix File:\"mac_main.h\"}\n\t\tSet Preferences To {Illegal Pragmas:false, Empty Declarations:false, Possible Errors:false, Unused Variables:false, Unused Arguments:false, Extra Commas:false, Extended Error Checking:false}\n\t\tSet Preferences To {Code Model:2, Struct Alignment:0, MC68020 CodeGen:false, MC68881 CodeGen:false, Four Bytes Ints:true, Eight Byte Double:true, Peephole Optimizer:true, CSE Optimizer:true, Optimize For Size:true, Far Data:true, Use Profiler:false, Far Virtual Function Tables:false, Far String Constants:true}\n\t\tSet Preferences To {MacsBug Symbols:2, Generate SYM File:false, Full Path In Sym Files:true, Generate Link Map:false, Generate A6 Stack Frames:true, The Debugger Aware:false, Link Single Segment:false, Fast Link:true}\n\t\tSet Preferences To {Project Type:0, File Name:\"mkg3states\", File Creator:\"????\", File Type:\"APPL\"}\n\t\t\n\t\tMake Project\n\t\tRun Project\n\t\tRemove Binaries\n\t\tClose Project\n\t\t\n\t\t\n\t\t(* Create LIBTIFF *)\n\t\tCreate Project {file LIBTIFF}\n\t\tAdd Files {\"tif_apple.c\", \"tif_aux.c\", \"tif_close.c\", \"tif_codec.c\", \"tif_compress.c\", \"tif_dumpmode.c\", \"tif_error.c\", \"tif_flush.c\", \"tif_lzw.c\", \"tif_next.c\", \"tif_open.c\", \"tif_packbits.c\"}\n\t\tAdd Files {\"tif_fax3.c\"} To Segment 2\n\t\tAdd Files {\"tif_dirinfo.c\", \"tif_dir.c\", \"tif_dirwrite.c\", \"tif_dirread.c\"} To Segment 3\n\t\tAdd Files {\"tif_predict.c\", \"tif_print.c\", \"tif_read.c\", \"tif_strip.c\", \"tif_swab.c\", \"tif_thunder.c\", \"tif_tile.c\", \"tif_version.c\", \"tif_zip.c\", \"tif_jpeg.c\", \"tif_warning.c\", \"tif_write.c\"} To Segment 4\n\t\tAdd Files {\"tif_fax3sm.c\"} To Segment 5\n\t\tAdd Files {\"tif_getimage.c\"} To Segment 6\n\t\t\n\t\tSet Preferences To {Activate CPlusPlus:false, ARM Conformance:false, ANSI Keywords Only:false, Require Function Prototypes:false, Expand Trigraph Sequences:false, Enums Always Ints:false, MPW Pointer Type Rules:false, Prefix File:\"MacHeaders68K\"}\n\t\tSet Preferences To {Illegal Pragmas:false, Empty Declarations:false, Possible Errors:false, Unused Variables:false, Unused Arguments:false, Extra Commas:false, Extended Error Checking:false}\n\t\tSet Preferences To {Code Model:2, Struct Alignment:0, MC68020 CodeGen:false, MC68881 CodeGen:false, Four Bytes Ints:true, Eight Byte Double:true, Peephole Optimizer:true, CSE Optimizer:true, Optimize For Size:true, Far Data:true, Use Profiler:false, Far Virtual Function Tables:false, Far String Constants:true}\n\t\tSet Preferences To {MacsBug Symbols:2, Generate SYM File:true, Full Path In Sym Files:true, Generate Link Map:false, Generate A6 Stack Frames:true, The Debugger Aware:false, Link Single Segment:false, Fast Link:true}\n\t\tSet Preferences To {Project Type:2, File Name:\"libtiff-68K\", File Creator:\"????\", File Type:\"APPL\"}\n\t\tMake Project\n\t\tClose Project\n\n\t\tCreate Project {file TIFFINFO}\n\t\tAdd Files {\"tiffinfo.c\", \"mac_main.c\", \"getopt.c\"}\n\t\tAdd Files {\"MacOS.lib\"} To Segment 2\n\t\tAdd Files {\"ANSI (4i/8d) C.68K.Lib\"} To Segment 3\n\t\tAdd Files {\"SIOUX.68K.Lib\"} To Segment 4\n\t\tAdd Files {\"MathLib68K (4i/8d).Lib\"} To Segment 5\n\t\tAdd Files {\"libtiff-68K\"} To Segment 6\n\t\t\n\t\tSet Preferences To {Activate CPlusPlus:false, ARM Conformance:false, ANSI Keywords Only:false, Require Function Prototypes:false, Expand Trigraph Sequences:false, Enums Always Ints:false, MPW Pointer Type Rules:false, Prefix File:\"mac_main.h\"}\n\t\tSet Preferences To {Illegal Pragmas:false, Empty Declarations:false, Possible Errors:false, Unused Variables:false, Unused Arguments:false, Extra Commas:false, Extended Error Checking:false}\n\t\tSet Preferences To {Code Model:2, Struct Alignment:0, MC68020 CodeGen:false, MC68881 CodeGen:false, Four Bytes Ints:true, Eight Byte Double:true, Peephole Optimizer:true, CSE Optimizer:true, Optimize For Size:true, Far Data:true, Use Profiler:false, Far Virtual Function Tables:false, Far String Constants:true}\n\t\tSet Preferences To {MacsBug Symbols:2, Generate SYM File:false, Full Path In Sym Files:true, Generate Link Map:false, Generate A6 Stack Frames:true, The Debugger Aware:false, Link Single Segment:false, Fast Link:true}\n\t\tSet Preferences To {Project Type:0, File Name:\"tiffinfo\", File Creator:\"????\", File Type:\"APPL\"}\n\t\t\n\t\tMake Project\n\t\tClose Project\n\t\t\n\tend tell\nend timeout\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/mac-cw/README",
    "content": "----------------------------------------------------\nBuild instructions for LIBTIFF - CodeWarrior (6.1):\n----------------------------------------------------\n\nIn this directory you will find a Makefile.script Applescript\nfile, which should be run in order to build the libtiff code\nusing MetroWerks CodeWarrior.\n\nRefer to the \"metrowerks.note\" instructions on building the\nlibrary for 68k and PowerPC native code, as well as building\nsome of the libtiff tools, which are rather unix-like, but\nat least give an example of how to link everything together.\n\n  Questions, comments, bug reports to Niles Ritter\n  (ndr@tazboy.jpl.nasa.gov). Sam Leffler takes no responsibility\n  for the viability of this stuff.\n  \n    -Niles.\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/mac-cw/mac_main.c",
    "content": "/*\n *  mac_main.c -- The REAL entry point which\n *   calls the tools main code. For the tools\n *   the symbol \"main\" has been #defined to \"tool_main\"\n *   so that this entry point may be used to access\n *   the user-input first.\n */\n\n#undef main\n\nint\nmain()\n{\n\tint argc;\n\tchar **argv;\n\t\n\targc=ccommand(&argv);\n\n\treturn tool_main(argc,argv);  // Call the tool \"main()\" routine\n}\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/mac-cw/mac_main.h",
    "content": "/* \n * mac_main.h  -- redefines main entry point\n */\n \n#ifndef _mac_main_h\n#define _mac_main_h\n\n#undef main\n#define main tool_main\n\n#endif  /* _mac_main_h */\n\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/mac-cw/metrowerks.note",
    "content": "----------------------------------------------------\nBuild instructions for LIBTIFF - CodeWarrior (6.1):\n----------------------------------------------------\n\nNote: there is a bug in CW earlier than 6.1 which will generate\n16-bit offset link errors for any projects using libtiff; you must\ndownload the CodeWarrior 6.1 patch located at:\n\n  ftp://ftp.metrowerks.com/pub/updates/metro-patches-61.hqx\n\nunpack the archive, insert the files and recompile the libraries\nusing the AppleScript provided.\n\n\n1. Make sure that the directory containing these files is under\n   the \"contrib\" directory of the tiff folder; otherwise, some\n   access path preferences will need to be updated.\n\n2. The instructions below are for the 68k platform build. \n    A similar script can be put together for the PPC version,\n    or you can just directly convert the projects. Be sure to\n   use the native libraries as well. NOTE: if anyone cooks  \n  up an equivalent script for PPC, send it to me and I'll include\n  it with the rest of the package.\n\n3.   Open the file Makefile.script with an AppleScript Editor\n   and change the PATHNAME variable to point to your\n   top-level TIFF directory\n\n4. Run the Script. It will do the following things:\n \n   4a. Prompt you for the current location of the CodeWarrior 68K\n   program.\n\n   4b. Create the source file \"tif_fax3sm.c\":\n\n        i) Build the project CW project mkg3states.cw. It will\n     produce a small program called mkg3states. Only a\n     68k version is provided, since you only have to run\n     this code once, and it only takes a few seconds.\n     \n        ii) Run the built mkg3states program: \n        \n    The program will temporarily take over ALL of the CPU, so\n    don't panic. After a few seconds it will produce a file called\n    \"tif_fax3sm.c\".\n\n  4c. Build the library project libtiff-68K.mw, producing library\n   called libtiff-68K.\n\n  4d. Build program project tiffinfo.mw; it will produce a\n   program called tiffinfo, which can dump the tiff tags of\n   a named file. Passing in no arguments will dump a help file\n   for the program. It is unix-flavored, but hey, it works.\n\n5  When the script finishes, you will have a usable libtiff-68K\n   library, a passable \"tiffinfo\" program, and the projects used\n   to build them. Note that to get tiffinfo to work I have put \n   an include file in the project that redefines main(), and\n   then have a mac_main.c program that calls ccommand() first\n   and passes that to the actual main code. A real mac app,\n   of course, would never use this stuff at all...\n\n . The tiffinfo.mw project may be used as a template to build\n   most of the other libtiff tools, or your own code. When\n   modifying a copy of the project, you will most likely need\n   to update the \"Access Paths\" directory if it is moved out of\n   the contrib folder.\n   \n6. If you are going to create a project from scratch, be sure\n   to set up the preferences with \n   \n      4-byte ints\n      8-byte doubles\n      Far Code/Far Data\n      Large Linking model\n      \n   and everything should work fine. If the console-style error\n   reports bother you, you can always override the error and\n   warning mechanism with TIFFSetErrorHandler to do something\n   more Mac-like.\n\nQuestions, comments to Niles Ritter (ndr@tazboy.jpl.nasa.gov).\n\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/mac-cw/mkg3_main.c",
    "content": "/*\n *  mkg3_main.c -- passes fake arguments into main\n */\n\n#undef main\n\nint\nmain()\n{\n\tstatic char *argv[4] = {\n\t \"mkg3states\", \"-c\", \"const\", \"tif_fax3sm.c\" };\n\t\n\treturn tool_main(4,argv);  // Call the tool \"main()\" routine\n}\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/mac-cw/version.h",
    "content": "#define VERSION \\\n\"LIBTIFF, Version 3.4beta028 \\n\"\\\n\"Copyright (c) 1988-1995 Sam Leffler\\n\"\\\n\"Copyright (c) 1991-1996 Silicon Graphics, Inc.\"\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/mac-mpw/BUILD.mpw",
    "content": "# BUILD.mpw:  \n#\n#   Full build for Apple Macintosh Programmer's Workshop (MPW).\n#\n#  This is an executable MPW script which creates various\n#  utilities, sets up the MPW makefiles and runs the builds.\n#  This script should be run at the top level TIFF directory with:\n#\n#     directory :::\n#     :contrib:mac-mpw:BUILD.mpw\n#\n#  NOTE: The full build requires that MPW have at least 6 MB\n#   allocated to it to compile the CCITT Fax codec tables. To\n#   deactivate CCITT compression edit the file :contrib:mac:libtiff.make\n#   first and follow the directions for disabling Fax decoding.\n#\n#  All TIFF tools are built as MPW tools, executable from the\n#  MPW shell or other compatible tool server.\n#\n#  Written by: Niles Ritter (ndr@tazboy.jpl.nasa.gov).\n#\n\necho \"############# Full Scratch Build for MPW #############\"\n\n# Create the ascii->mpw translation tool; this is used to\n# convert standard ASCII files into ones using the special\n# MPW characters, which don't live comfortably in unix tar files.\n#\necho \"######## Creating ASCII->MPW translator ########\"\nset contrib ':contrib:mac-mpw:'\ndirectory {contrib}\ncreatemake -tool mactrans mactrans.c > dev:null\nmake -f mactrans.make | streamedit -e \"/CSANELib/||/Math/||/ToolLibs/ del\" > mactrans.bld\nexecute mactrans.bld  > dev:null\ndelete -y mactrans.make mactrans.bld mactrans.c.o || set status 0\ndirectory :::   #An mpw trick for going up two levels\n\n# Create the top-level Makefile and run it\necho \"######## Creating Makefile ########\"\ncatenate {contrib}top.make | {contrib}mactrans > Makefile\n\necho \"######## Running Makefile ########\"\nmake  > build.mpw\nexecute build.mpw\necho \"############# MPW Build Complete #############\"\nexit 0\n\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/mac-mpw/Makefile.am",
    "content": "# Tag Image File Format (TIFF) Software\n#\n# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>\n#\n# Permission to use, copy, modify, distribute, and sell this software and \n# its documentation for any purpose is hereby granted without fee, provided\n# that (i) the above copyright notices and this permission notice appear in\n# all copies of the software and related documentation, and (ii) the names of\n# Sam Leffler and Silicon Graphics may not be used in any advertising or\n# publicity relating to the software without the specific, prior written\n# permission of Sam Leffler and Silicon Graphics.\n# \n# THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n# \n# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n# OF THIS SOFTWARE.\n\n# Process this file with automake to produce Makefile.in.\n\nEXTRA_DIST = BUILD.mpw README libtiff.make mactrans.c port.make tools.make top.make\n\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/mac-mpw/Makefile.in",
    "content": "# Makefile.in generated by automake 1.11 from Makefile.am.\n# @configure_input@\n\n# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,\n# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,\n# Inc.\n# This Makefile.in is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY, to the extent permitted by law; without\n# even the implied warranty of MERCHANTABILITY or FITNESS FOR A\n# PARTICULAR PURPOSE.\n\n@SET_MAKE@\n\n# Tag Image File Format (TIFF) Software\n#\n# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>\n#\n# Permission to use, copy, modify, distribute, and sell this software and \n# its documentation for any purpose is hereby granted without fee, provided\n# that (i) the above copyright notices and this permission notice appear in\n# all copies of the software and related documentation, and (ii) the names of\n# Sam Leffler and Silicon Graphics may not be used in any advertising or\n# publicity relating to the software without the specific, prior written\n# permission of Sam Leffler and Silicon Graphics.\n# \n# THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n# \n# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n# OF THIS SOFTWARE.\n\n# Process this file with automake to produce Makefile.in.\nVPATH = @srcdir@\npkgdatadir = $(datadir)/@PACKAGE@\npkgincludedir = $(includedir)/@PACKAGE@\npkglibdir = $(libdir)/@PACKAGE@\npkglibexecdir = $(libexecdir)/@PACKAGE@\nam__cd = CDPATH=\"$${ZSH_VERSION+.}$(PATH_SEPARATOR)\" && cd\ninstall_sh_DATA = $(install_sh) -c -m 644\ninstall_sh_PROGRAM = $(install_sh) -c\ninstall_sh_SCRIPT = $(install_sh) -c\nINSTALL_HEADER = $(INSTALL_DATA)\ntransform = $(program_transform_name)\nNORMAL_INSTALL = :\nPRE_INSTALL = :\nPOST_INSTALL = :\nNORMAL_UNINSTALL = :\nPRE_UNINSTALL = :\nPOST_UNINSTALL = :\nbuild_triplet = @build@\nhost_triplet = @host@\ntarget_triplet = @target@\nsubdir = contrib/mac-mpw\nDIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in\nACLOCAL_M4 = $(top_srcdir)/aclocal.m4\nam__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \\\n\t$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \\\n\t$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \\\n\t$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac\nam__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \\\n\t$(ACLOCAL_M4)\nmkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs\nCONFIG_HEADER = $(top_builddir)/libtiff/tif_config.h \\\n\t$(top_builddir)/libtiff/tiffconf.h\nCONFIG_CLEAN_FILES =\nCONFIG_CLEAN_VPATH_FILES =\nAM_V_GEN = $(am__v_GEN_$(V))\nam__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))\nam__v_GEN_0 = @echo \"  GEN   \" $@;\nAM_V_at = $(am__v_at_$(V))\nam__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))\nam__v_at_0 = @\nSOURCES =\nDIST_SOURCES =\nDISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)\nACLOCAL = @ACLOCAL@\nAMTAR = @AMTAR@\nAM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@\nAR = @AR@\nAS = @AS@\nAUTOCONF = @AUTOCONF@\nAUTOHEADER = @AUTOHEADER@\nAUTOMAKE = @AUTOMAKE@\nAWK = @AWK@\nCC = @CC@\nCCDEPMODE = @CCDEPMODE@\nCFLAGS = @CFLAGS@\nCPP = @CPP@\nCPPFLAGS = @CPPFLAGS@\nCXX = @CXX@\nCXXCPP = @CXXCPP@\nCXXDEPMODE = @CXXDEPMODE@\nCXXFLAGS = @CXXFLAGS@\nCYGPATH_W = @CYGPATH_W@\nDEFS = @DEFS@\nDEPDIR = @DEPDIR@\nDLLTOOL = @DLLTOOL@\nDSYMUTIL = @DSYMUTIL@\nDUMPBIN = @DUMPBIN@\nECHO_C = @ECHO_C@\nECHO_N = @ECHO_N@\nECHO_T = @ECHO_T@\nEGREP = @EGREP@\nEXEEXT = @EXEEXT@\nFGREP = @FGREP@\nGLUT_CFLAGS = @GLUT_CFLAGS@\nGLUT_LIBS = @GLUT_LIBS@\nGLU_CFLAGS = @GLU_CFLAGS@\nGLU_LIBS = @GLU_LIBS@\nGL_CFLAGS = @GL_CFLAGS@\nGL_LIBS = @GL_LIBS@\nGREP = @GREP@\nINSTALL = @INSTALL@\nINSTALL_DATA = @INSTALL_DATA@\nINSTALL_PROGRAM = @INSTALL_PROGRAM@\nINSTALL_SCRIPT = @INSTALL_SCRIPT@\nINSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@\nLD = @LD@\nLDFLAGS = @LDFLAGS@\nLIBDIR = @LIBDIR@\nLIBOBJS = @LIBOBJS@\nLIBS = @LIBS@\nLIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@\nLIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@\nLIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@\nLIBTIFF_MICRO_VERSION = @LIBTIFF_MICRO_VERSION@\nLIBTIFF_MINOR_VERSION = @LIBTIFF_MINOR_VERSION@\nLIBTIFF_RELEASE_DATE = @LIBTIFF_RELEASE_DATE@\nLIBTIFF_VERSION = @LIBTIFF_VERSION@\nLIBTIFF_VERSION_INFO = @LIBTIFF_VERSION_INFO@\nLIBTOOL = @LIBTOOL@\nLIPO = @LIPO@\nLN_S = @LN_S@\nLTLIBOBJS = @LTLIBOBJS@\nMAINT = @MAINT@\nMAKEINFO = @MAKEINFO@\nMKDIR_P = @MKDIR_P@\nNM = @NM@\nNMEDIT = @NMEDIT@\nOBJDUMP = @OBJDUMP@\nOBJEXT = @OBJEXT@\nOTOOL = @OTOOL@\nOTOOL64 = @OTOOL64@\nPACKAGE = @PACKAGE@\nPACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@\nPACKAGE_NAME = @PACKAGE_NAME@\nPACKAGE_STRING = @PACKAGE_STRING@\nPACKAGE_TARNAME = @PACKAGE_TARNAME@\nPACKAGE_URL = @PACKAGE_URL@\nPACKAGE_VERSION = @PACKAGE_VERSION@\nPATH_SEPARATOR = @PATH_SEPARATOR@\nPTHREAD_CC = @PTHREAD_CC@\nPTHREAD_CFLAGS = @PTHREAD_CFLAGS@\nPTHREAD_LIBS = @PTHREAD_LIBS@\nRANLIB = @RANLIB@\nSED = @SED@\nSET_MAKE = @SET_MAKE@\nSHELL = @SHELL@\nSTRIP = @STRIP@\nVERSION = @VERSION@\nXMKMF = @XMKMF@\nX_CFLAGS = @X_CFLAGS@\nX_EXTRA_LIBS = @X_EXTRA_LIBS@\nX_LIBS = @X_LIBS@\nX_PRE_LIBS = @X_PRE_LIBS@\nabs_builddir = @abs_builddir@\nabs_srcdir = @abs_srcdir@\nabs_top_builddir = @abs_top_builddir@\nabs_top_srcdir = @abs_top_srcdir@\nac_ct_CC = @ac_ct_CC@\nac_ct_CXX = @ac_ct_CXX@\nac_ct_DUMPBIN = @ac_ct_DUMPBIN@\nacx_pthread_config = @acx_pthread_config@\nam__include = @am__include@\nam__leading_dot = @am__leading_dot@\nam__quote = @am__quote@\nam__tar = @am__tar@\nam__untar = @am__untar@\nbindir = @bindir@\nbuild = @build@\nbuild_alias = @build_alias@\nbuild_cpu = @build_cpu@\nbuild_os = @build_os@\nbuild_vendor = @build_vendor@\nbuilddir = @builddir@\ndatadir = @datadir@\ndatarootdir = @datarootdir@\ndocdir = @docdir@\ndvidir = @dvidir@\nexec_prefix = @exec_prefix@\nhost = @host@\nhost_alias = @host_alias@\nhost_cpu = @host_cpu@\nhost_os = @host_os@\nhost_vendor = @host_vendor@\nhtmldir = @htmldir@\nincludedir = @includedir@\ninfodir = @infodir@\ninstall_sh = @install_sh@\nlibdir = @libdir@\nlibexecdir = @libexecdir@\nlocaledir = @localedir@\nlocalstatedir = @localstatedir@\nlt_ECHO = @lt_ECHO@\nmandir = @mandir@\nmkdir_p = @mkdir_p@\noldincludedir = @oldincludedir@\npdfdir = @pdfdir@\nprefix = @prefix@\nprogram_transform_name = @program_transform_name@\npsdir = @psdir@\nsbindir = @sbindir@\nsharedstatedir = @sharedstatedir@\nsrcdir = @srcdir@\nsysconfdir = @sysconfdir@\ntarget = @target@\ntarget_alias = @target_alias@\ntarget_cpu = @target_cpu@\ntarget_os = @target_os@\ntarget_vendor = @target_vendor@\ntop_build_prefix = @top_build_prefix@\ntop_builddir = @top_builddir@\ntop_srcdir = @top_srcdir@\nEXTRA_DIST = BUILD.mpw README libtiff.make mactrans.c port.make tools.make top.make\nall: all-am\n\n.SUFFIXES:\n$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)\n\t@for dep in $?; do \\\n\t  case '$(am__configure_deps)' in \\\n\t    *$$dep*) \\\n\t      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \\\n\t        && { if test -f $@; then exit 0; else break; fi; }; \\\n\t      exit 1;; \\\n\t  esac; \\\n\tdone; \\\n\techo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign contrib/mac-mpw/Makefile'; \\\n\t$(am__cd) $(top_srcdir) && \\\n\t  $(AUTOMAKE) --foreign contrib/mac-mpw/Makefile\n.PRECIOUS: Makefile\nMakefile: $(srcdir)/Makefile.in $(top_builddir)/config.status\n\t@case '$?' in \\\n\t  *config.status*) \\\n\t    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \\\n\t  *) \\\n\t    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \\\n\t    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \\\n\tesac;\n\n$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n\n$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n$(am__aclocal_m4_deps):\n\nmostlyclean-libtool:\n\t-rm -f *.lo\n\nclean-libtool:\n\t-rm -rf .libs _libs\ntags: TAGS\nTAGS:\n\nctags: CTAGS\nCTAGS:\n\n\ndistdir: $(DISTFILES)\n\t@srcdirstrip=`echo \"$(srcdir)\" | sed 's/[].[^$$\\\\*]/\\\\\\\\&/g'`; \\\n\ttopsrcdirstrip=`echo \"$(top_srcdir)\" | sed 's/[].[^$$\\\\*]/\\\\\\\\&/g'`; \\\n\tlist='$(DISTFILES)'; \\\n\t  dist_files=`for file in $$list; do echo $$file; done | \\\n\t  sed -e \"s|^$$srcdirstrip/||;t\" \\\n\t      -e \"s|^$$topsrcdirstrip/|$(top_builddir)/|;t\"`; \\\n\tcase $$dist_files in \\\n\t  */*) $(MKDIR_P) `echo \"$$dist_files\" | \\\n\t\t\t   sed '/\\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \\\n\t\t\t   sort -u` ;; \\\n\tesac; \\\n\tfor file in $$dist_files; do \\\n\t  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \\\n\t  if test -d $$d/$$file; then \\\n\t    dir=`echo \"/$$file\" | sed -e 's,/[^/]*$$,,'`; \\\n\t    if test -d \"$(distdir)/$$file\"; then \\\n\t      find \"$(distdir)/$$file\" -type d ! -perm -700 -exec chmod u+rwx {} \\;; \\\n\t    fi; \\\n\t    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \\\n\t      cp -fpR $(srcdir)/$$file \"$(distdir)$$dir\" || exit 1; \\\n\t      find \"$(distdir)/$$file\" -type d ! -perm -700 -exec chmod u+rwx {} \\;; \\\n\t    fi; \\\n\t    cp -fpR $$d/$$file \"$(distdir)$$dir\" || exit 1; \\\n\t  else \\\n\t    test -f \"$(distdir)/$$file\" \\\n\t    || cp -p $$d/$$file \"$(distdir)/$$file\" \\\n\t    || exit 1; \\\n\t  fi; \\\n\tdone\ncheck-am: all-am\ncheck: check-am\nall-am: Makefile\ninstalldirs:\ninstall: install-am\ninstall-exec: install-exec-am\ninstall-data: install-data-am\nuninstall: uninstall-am\n\ninstall-am: all-am\n\t@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am\n\ninstallcheck: installcheck-am\ninstall-strip:\n\t$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM=\"$(INSTALL_STRIP_PROGRAM)\" \\\n\t  install_sh_PROGRAM=\"$(INSTALL_STRIP_PROGRAM)\" INSTALL_STRIP_FLAG=-s \\\n\t  `test -z '$(STRIP)' || \\\n\t    echo \"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'\"` install\nmostlyclean-generic:\n\nclean-generic:\n\ndistclean-generic:\n\t-test -z \"$(CONFIG_CLEAN_FILES)\" || rm -f $(CONFIG_CLEAN_FILES)\n\t-test . = \"$(srcdir)\" || test -z \"$(CONFIG_CLEAN_VPATH_FILES)\" || rm -f $(CONFIG_CLEAN_VPATH_FILES)\n\nmaintainer-clean-generic:\n\t@echo \"This command is intended for maintainers to use\"\n\t@echo \"it deletes files that may require special tools to rebuild.\"\nclean: clean-am\n\nclean-am: clean-generic clean-libtool mostlyclean-am\n\ndistclean: distclean-am\n\t-rm -f Makefile\ndistclean-am: clean-am distclean-generic\n\ndvi: dvi-am\n\ndvi-am:\n\nhtml: html-am\n\nhtml-am:\n\ninfo: info-am\n\ninfo-am:\n\ninstall-data-am:\n\ninstall-dvi: install-dvi-am\n\ninstall-dvi-am:\n\ninstall-exec-am:\n\ninstall-html: install-html-am\n\ninstall-html-am:\n\ninstall-info: install-info-am\n\ninstall-info-am:\n\ninstall-man:\n\ninstall-pdf: install-pdf-am\n\ninstall-pdf-am:\n\ninstall-ps: install-ps-am\n\ninstall-ps-am:\n\ninstallcheck-am:\n\nmaintainer-clean: maintainer-clean-am\n\t-rm -f Makefile\nmaintainer-clean-am: distclean-am maintainer-clean-generic\n\nmostlyclean: mostlyclean-am\n\nmostlyclean-am: mostlyclean-generic mostlyclean-libtool\n\npdf: pdf-am\n\npdf-am:\n\nps: ps-am\n\nps-am:\n\nuninstall-am:\n\n.MAKE: install-am install-strip\n\n.PHONY: all all-am check check-am clean clean-generic clean-libtool \\\n\tdistclean distclean-generic distclean-libtool distdir dvi \\\n\tdvi-am html html-am info info-am install install-am \\\n\tinstall-data install-data-am install-dvi install-dvi-am \\\n\tinstall-exec install-exec-am install-html install-html-am \\\n\tinstall-info install-info-am install-man install-pdf \\\n\tinstall-pdf-am install-ps install-ps-am install-strip \\\n\tinstallcheck installcheck-am installdirs maintainer-clean \\\n\tmaintainer-clean-generic mostlyclean mostlyclean-generic \\\n\tmostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am\n\n\n# Tell versions [3.59,3.63) of GNU make to not export all variables.\n# Otherwise a system limit (for SysV at least) may be exceeded.\n.NOEXPORT:\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/mac-mpw/README",
    "content": "######################\nAbout contrib:mac-mpw:\n######################\n\nThis directory contains all of the utilities and makefile source\nto build the LIBTIFF library and tools from the MPW Shell. The\nfile BUILD.mpw in this directory is an executable script\nwhich uses all of these files to create the MPW makefiles and \nrun them. \n\nThe <file>.make files are not MPW makefiles as such,\nbut are when run through the \"mactrans\" program, which turns\nthe ascii \"%nn\" metacharacters into the standard weird MPW\nmake characters.\n\nThis translation trick is necessary to protect the files when\nthey are put into unix tarfiles, which tend to mangle the\nspecial characters.\n\n --Niles Ritter (ndr@tazboy.jpl.nasa.gov)\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/mac-mpw/libtiff.make",
    "content": "#\n# Tag Image File Format Library\n#\n# Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994 Sam Leffler\n# Copyright (c) 1991, 1992, 1993, 1994 Silicon Graphics, Inc.\n# \n# Permission to use, copy, modify, distribute, and sell this software and \n# its documentation for any purpose is hereby granted without fee, provided\n# that (i) the above copyright notices and this permission notice appear in\n# all copies of the software and related documentation, and (ii) the names of\n# Sam Leffler and Silicon Graphics may not be used in any advertising or\n# publicity relating to the software without the specific, prior written\n# permission of Sam Leffler and Silicon Graphics.\n# \n# THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n# \n# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n# OF THIS SOFTWARE.\n#\n\n#\n# Makefile for Mac using MPW 3.3.1 and MPW C 3.2.4\n#\n#  Note:  This file must be run through \"mactrans\" before it can\n#  be recognized by MPW as a valid makefile. The problem is that MPW\n#  uses special non-ASCII characters, which tend to get mangled when stored\n#  in unix tar files, etc. \"mactrans\" is built as part of the TIFF MPW build.\n#\n#\n\nDEPTH   = ::\n\n# FAX Options: If you do not wish to include the FAX options, uncomment\n# the first four definitions and comment out the next four \n# definitions. Note that to build programs with the FAX libraries you\n# have to include \"-model far\" in your compile and link statements.\n#\n# Also, to build the fax code (including the tif_fax3sm.c file, which is\n# created by the MPW tool \"mkg3states\", also built below), you will\n# need to size the MPW program up to about 6 megabytes or so.\n\n#FAX_OPTIONS = \n#FAX_OBJECTS = \t\n#FAX_SOURCES = tif_fax3.c \n#FAX_CONFIG = \n\nFAX_OPTIONS = -model far\nFAX_OBJECTS = \ttif_fax3.c.o tif_fax3sm.c.o\nFAX_SOURCES = tif_fax3.c tif_fax3sm.c\nFAX_CONFIG = -d CCITT_SUPPORT\n\nNULL=\n\nRM = delete -y -i \nCOPTS = \n\nLIBPORT=::port:libport.o\n\n#\n.c.o %c4 .c\n\t{C} -model far {CFLAGS} -s {Default} {DepDir}{Default}.c -o {TargDir}{Default}.c.o\n\n\nCONF_LIBRARY= %b6\n\t-d HAVE_IEEEFP=1 %b6\n\t-d BSDTYPES \n\nCONF_COMPRESSION= %b6\n\t{FAX_CONFIG} %b6\n\t-d COMPRESSION_SUPPORT %b6\n\t-d PACKBITS_SUPPORT \t%b6\n\t-d LZW_SUPPORT \t%b6\n\t-d THUNDER_SUPPORT %b6\n\t-d NEXT_SUPPORT \n\nCFLAGS=\t{FAX_OPTIONS} {IPATH} {CONF_LIBRARY} {CONF_COMPRESSION} \n\nINCS=\ttiff.h tiffio.h\n\nSRCS=\t%b6\n\t{FAX_SOURCES} %b6\n\ttif_apple.c %b6\n\ttif_aux.c %b6\n\ttif_close.c %b6\n\ttif_codec.c %b6\n\ttif_compress.c %b6\n\ttif_dir.c %b6\n\ttif_dirinfo.c %b6\n\ttif_dirread.c %b6\n\ttif_dirwrite.c %b6\n\ttif_dumpmode.c %b6\n\ttif_error.c %b6\n\ttif_getimage.c %b6\n\ttif_jpeg.c %b6\n\ttif_flush.c %b6\n\ttif_lzw.c %b6\n\ttif_next.c %b6\n\ttif_open.c %b6\n\ttif_packbits.c %b6\n\ttif_predict.c %b6\n\ttif_print.c %b6\n\ttif_read.c %b6\n\ttif_swab.c %b6\n\ttif_strip.c %b6\n\ttif_thunder.c %b6\n\ttif_tile.c %b6\n\ttif_version.c %b6\n\ttif_warning.c %b6\n\ttif_write.c %b6\n\ttif_zip.c %b6\n\t{NULL}\n\nOBJS=\t%b6\n\t{FAX_OBJECTS} %b6\n\ttif_apple.c.o %b6\n\ttif_aux.c.o %b6\n\ttif_close.c.o %b6\n\ttif_codec.c.o %b6\n\ttif_compress.c.o %b6\n\ttif_dir.c.o %b6\n\ttif_dirinfo.c.o %b6\n\ttif_dirread.c.o %b6\n\ttif_dirwrite.c.o %b6\n\ttif_dumpmode.c.o %b6\n\ttif_error.c.o %b6\n\ttif_getimage.c.o %b6\n\ttif_jpeg.c.o %b6\n\ttif_flush.c.o %b6\n\ttif_lzw.c.o %b6\n\ttif_next.c.o %b6\n\ttif_open.c.o %b6\n\ttif_packbits.c.o %b6\n\ttif_predict.c.o %b6\n\ttif_print.c.o %b6\n\ttif_read.c.o %b6\n\ttif_swab.c.o %b6\n\ttif_strip.c.o %b6\n\ttif_thunder.c.o %b6\n\ttif_tile.c.o %b6\n\ttif_version.c.o %b6\n\ttif_warning.c.o %b6\n\ttif_write.c.o %b6\n\ttif_zip.c.o %b6\n\t{NULL}\n\nALL=libtiff.o\n\nall %c4 {ALL}\n\nlibtiff.o %c4 {OBJS}\n\tLib  {OBJS} -o libtiff.o\n\t\n\n{OBJS} %c4 tiffio.h tiff.h tiffcomp.h tiffiop.h tiffconf.h\n\n#\n# The finite state machine tables used by the G3/G4 decoders\n# are generated by the mkg3states program.  On systems without\n# make these rules have to be manually carried out.\n#\ntif_fax3sm.c %c4 mkg3states tif_fax3.h\n        {RM} tif_fax3sm.c || set status 0\n\t:mkg3states -c const tif_fax3sm.c\n\nmkg3states.c.o %c4 mkg3states.c\n   C -model far  mkg3states.c -o mkg3states.c.o\n\nmkg3states %c4%c4 mkg3states.c.o\n\tLink -model far -d -c 'MPS ' -t MPST %b6\n\t\tmkg3states.c.o %b6\n\t\t{LIBPORT} %b6\n\t\t\"{CLibraries}\"StdClib.o %b6\n\t\t\"{Libraries}\"Stubs.o %b6\n\t\t\"{Libraries}\"Runtime.o %b6\n\t\t\"{Libraries}\"Interface.o %b6\n\t\t-o mkg3states\n\nALPHA   = \"{DEPTH}dist:tiff.alpha\"\nVERSION = \"{DEPTH}VERSION\"\n\nversion.h %c4 {VERSION} {ALPHA}\n        Set VERSION1 `catenate {VERSION}` \n        Set VERSION2 \"{VERSION1}`streamedit -e \"1 rep /%a5%c5 %c5 (%c5)%a81/ %a81\" {ALPHA}`\" \n        delete -y -i version.h || set status 0\n\techo '#define VERSION \"LIBTIFF, Version' {VERSION2} '\\nCopyright (c) 1988-1995 Sam Leffler\\nCopyright (c) 1991-1995 Silicon Graphics, Inc.\"' >version.h\n\ntif_version.c.o %c4 version.h\n\nclean %c4\n\t{RM} {ALL}  || set status 0\n\t{RM} {OBJS} || set status 0\n\t{RM} mkg3states || set status 0\n\t{RM} mkg3states.c.o || set status 0\n\t{RM} tif_fax3sm.c%c5 || set status 0\n\t{RM} version.h || set status 0\n \n"
  },
  {
    "path": "src/main/jni/tiff/contrib/mac-mpw/mactrans.c",
    "content": "/*\n *  mactrans.c  -- Hack filter used to generate MPW files \n *    with special characters from pure ASCII, denoted \"%nn\" \n *    where nn is hex. (except for \"%%\", which is literal '%').\n *\n *  calling sequence:\n *\n *    catenate file | mactrans [-toascii | -fromascii] > output\n *\n *    Written by: Niles Ritter.\n */\n#include <stdio.h>\n#include <stdlib.h>\n#include <ctype.h>\n\nvoid to_ascii(void);\nvoid from_ascii(void);\n\nmain(int argc, char *argv[])\n{\n\tif (argc<2 || argv[1][1]=='f') from_ascii();\n\telse to_ascii();\n\texit (0);\n}\n\nvoid from_ascii(void)\n{\n    char c;\n    int d;\n    while ((c=getchar())!=EOF)\n    {\n    \tif (c!='%' || (c=getchar())=='%') putchar(c);\n\telse\n\t{\n\t\tungetc(c,stdin);\n\t\tscanf(\"%2x\",&d);\n\t\t*((unsigned char *)&c) = d;\n\t\tputchar(c);\n\t}\n    }\n}\n\nvoid to_ascii(void)\n{\n    char c;\n    int d;\n    while ((c=getchar())!=EOF)\n    {\n    \tif (isascii(c)) putchar (c);\n\telse\n\t{\n\t\td = *((unsigned char *)&c);\n\t\tprintf(\"%%%2x\",d);\n\t}\n    }\n}\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/mac-mpw/port.make",
    "content": "#\n# Tag Image File Format Library\n#\n# Copyright (c) 1995 Sam Leffler\n# Copyright (c) 1995 Silicon Graphics, Inc.\n# \n# Permission to use, copy, modify, distribute, and sell this software and \n# its documentation for any purpose is hereby granted without fee, provided\n# that (i) the above copyright notices and this permission notice appear in\n# all copies of the software and related documentation, and (ii) the names of\n# Sam Leffler and Silicon Graphics may not be used in any advertising or\n# publicity relating to the software without the specific, prior written\n# permission of Sam Leffler and Silicon Graphics.\n# \n# THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n# \n# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n# OF THIS SOFTWARE.\n#\nDEPTH= ::\nSRCDIR= :\n\nNULL\t=\nCC\t= C\nAR\t= Lib\nAROPTS\t= \nRM= delete -y\n\nIPATH\t=  -I {DEPTH} -I {SRCDIR}\nCOPTS\t= \nOPTIMIZER=\nCFLAGS\t=  {COPTS} {OPTIMIZER} {IPATH}\n\nCFILES\t= \nOBJECTS\t= getopt.c.o\nTARGETS\t= libport.o\n\n.c.o %c4 .c\n\t{CC} -model far {COptions} {CFLAGS} -s {Default} {DepDir}{Default}.c -o {TargDir}{Default}.c.o\n\nall %c4  {TARGETS}\n\nlibport.o %c4  {OBJECTS}\n\t{AR} {OBJECTS} -o libport.o\n\t\nclean %c4\n\t{RM} {TARGETS} {OBJECTS} || set status 0\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/mac-mpw/tools.make",
    "content": "#\n# Tag Image File Format Library\n#\n# Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994 Sam Leffler\n# Copyright (c) 1991, 1992, 1993, 1994 Silicon Graphics, Inc.\n# \n# Permission to use, copy, modify, distribute, and sell this software and \n# its documentation for any purpose is hereby granted without fee, provided\n# that (i) the above copyright notices and this permission notice appear in\n# all copies of the software and related documentation, and (ii) the names of\n# Sam Leffler and Silicon Graphics may not be used in any advertising or\n# publicity relating to the software without the specific, prior written\n# permission of Stanford and Silicon Graphics.\n# \n# THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n# \n# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n# OF THIS SOFTWARE.\n#\n\n#\n# Makefile for Mac using MPW 3.2.3 and MPW C 3.2.4\n#\nCOPTS = -model far\n\n.c.o %c4 .c\n\t{C} {COPTS} {CFLAGS} -s {Default} {DepDir}{Default}.c -o {TargDir}{Default}.c.o\n\nRM = delete -y -i\n\nCONF_LIBRARY= %b6\n\t-d USE_CONST=0 %b6\n\t-d BSDTYPES\nNULL=\n\nIPATH= -I ::libtiff\n\nCFLAGS=\t-w -m {IPATH} {CONF_LIBRARY}\n\nLIBPORT= ::port:libport.o\n\nLOptions= -model far -w -srt -d -c 'MPS ' -t MPST\n\nLIBTIFF= ::libtiff:libtiff.o\n\nLIBS=\t{LIBTIFF} %b6\n\t{LIBPORT} %b6\n\t\"{CLibraries}\"CSANELib.o  %b6\n\t\"{CLibraries}\"Math.o  %b6\n\t\"{CLibraries}\"StdClib.o  %b6\n\t\"{Libraries}\"Stubs.o  %b6\n\t\"{Libraries}\"Runtime.o  %b6\n\t\"{Libraries}\"Interface.o  %b6\n\t\"{Libraries}\"ToolLibs.o  %b6\n\t{NULL}\n\nSRCS= %b6\n\tpal2rgb.c %b6\n\tras2tiff.c %b6\n\tthumbnail.c %b6\n\ttiff2bw.c %b6\n\ttiff2ps.c %b6\n\ttiffcmp.c %b6\n\ttiffcp.c %b6\n\ttiffdither.c %b6\n\ttiffdump.c %b6\n\ttiffinfo.c %b6\n\ttiffmedian.c %b6\n\t{NULL}\n\t\nMACHALL=ras2tiff\n\nALL= %b6\n\ttiffinfo  %b6\n\ttiffcmp  %b6\n\ttiffcp  %b6\n\ttiffdump  %b6\n\ttiffmedian  %b6\n\ttiff2bw  %b6\n\ttiffdither  %b6\n\ttiff2ps  %b6\n\tpal2rgb  %b6\n\tgif2tiff  %b6\n\t{MACHALL}\n\nall %c4 {ALL}\n\ntiffinfo %c4 tiffinfo.c.o {LIBTIFF} \n\tLink {LOptions} tiffinfo.c.o {LIBS} -o tiffinfo\n\t\ntiffcmp %c4 tiffcmp.c.o {LIBTIFF}\n\tLink {LOptions} tiffcmp.c.o {LIBS} -o tiffcmp\n\t\ntiffcp %c4 tiffcp.c.o {LIBTIFF}\n\tLink {LOptions} tiffcp.c.o {LIBS} -o tiffcp\n\t\ntiffdump %c4 tiffdump.c.o {LIBTIFF}\n\tLink {LOptions} tiffdump.c.o {LIBS} -o tiffdump \n\t\ntiffmedian %c4 tiffmedian.c.o {LIBTIFF}\n\tLink {LOptions} tiffmedian.c.o {LIBS} -o tiffmedian\n\t\ntiff2ps %c4 tiff2ps.c.o {LIBTIFF}\n\tLink {LOptions} tiff2ps.c.o {LIBS} -o tiff2ps\n\t\n# junky stuff...\n# convert RGB image to B&W\ntiff2bw %c4 tiff2bw.c.o {LIBTIFF}\n\tLink {LOptions} tiff2bw.c.o {LIBS} -o tiff2bw\n\t\n# convert B&W image to bilevel w/ FS dithering\ntiffdither %c4 tiffdither.c.o {LIBTIFF}\n\tLink {LOptions} tiffdither.c.o {LIBS} -o tiffdither\n\t\n# GIF converter\ngif2tiff %c4 gif2tiff.c.o {LIBTIFF}\n\tLink {LOptions} gif2tiff.c.o {LIBS} -o gif2tiff\n\t\n# convert Palette image to RGB\npal2rgb %c4 pal2rgb.c.o {LIBTIFF}\n\tLink {LOptions} pal2rgb.c.o {LIBS} -o pal2rgb\n\t\n# Sun rasterfile converter\nras2tiff %c4 ras2tiff.c.o {LIBTIFF}\n\tLink {LOptions} ras2tiff.c.o {LIBS} -o ras2tiff\n\n# generate thumbnail images from fax\nthumbnail %c4 thumbnail.c.o {LIBTIFF}\n        Link {LOptions} thumbnail.c.o {LIBS} -o thumbnail\n\t\nclean %c4\n\t{RM} {ALL} %c5.c.o ycbcr\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/mac-mpw/top.make",
    "content": "#\n# Tag Image File Format Library\n#\n# Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994 Sam Leffler\n# Copyright (c) 1991, 1992, 1993, 1994 Silicon Graphics, Inc.\n# \n# Permission to use, copy, modify, distribute, and sell this software and \n# its documentation for any purpose is hereby granted without fee, provided\n# that (i) the above copyright notices and this permission notice appear in\n# all copies of the software and related documentation, and (ii) the names of\n# Sam Leffler and Silicon Graphics may not be used in any advertising or\n# publicity relating to the software without the specific, prior written\n# permission of Stanford and Silicon Graphics.\n# \n# THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n# \n# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n# OF THIS SOFTWARE.\n#\n\n#\n# Makefile for Mac using MPW 3.2.3 and MPW C 3.2.4\n#\n#\n#  Written by: Niles D. Ritter\n#\n\nRM= delete -y -i\nPORT=:port:\nLIBTIFF=:libtiff:\nTOOLS=:tools:\nCONTRIB=:contrib:mac-mpw:\n\nMACTRANS=\"{CONTRIB}mactrans\"\n\nNULL=\n\nMAKEFILES = %b6\n\t{PORT}Makefile %b6\n\t{LIBTIFF}Makefile %b6\n\t{TOOLS}Makefile %b6\n\t{NULL}\n\t\nall %c4 PORT LIBTIFF TOOLS\n\nMAKEFILES %c4 {MAKEFILES}\nTOOLS %c4 LIBTIFF\n\nLIBTIFF %c4 PORT\n\n# Create the port routines\nPORT %c4 {PORT}Makefile\n\tdirectory {PORT}\n\t(make || set status 0) > build.mpw\n\tset echo 1\n\texecute build.mpw\n\tset echo 0\n\t{RM} build.mpw  || set status 0\n\tdirectory ::\n\n# Create the port routines\nLIBTIFF %c4 {LIBTIFF}Makefile\n\tdirectory {LIBTIFF}\n\t(make || set status 0) > build.mpw\n\tset echo 1\n\texecute build.mpw\n\tset echo 0\n\t{RM} build.mpw  || set status 0\n\tdirectory ::\n\n# Create the tools\nTOOLS %c4 {TOOLS}Makefile\n\tdirectory {TOOLS}\n\t(make || set status 0) > build.mpw\n\tset echo 1\n\texecute build.mpw\n\tset echo 0\n\t{RM} build.mpw  || set status 0\n\tdirectory ::\n\n# Makefile dependencies\n{PORT}Makefile  %c4 {CONTRIB}port.make\n\tcatenate {CONTRIB}port.make | {MACTRANS} > {PORT}Makefile\n\n{LIBTIFF}Makefile  %c4 {CONTRIB}libtiff.make\n\tcatenate {CONTRIB}libtiff.make | {MACTRANS} > {LIBTIFF}Makefile\n\n{TOOLS}Makefile  %c4 {CONTRIB}tools.make\n\tcatenate {CONTRIB}tools.make | {MACTRANS} > {TOOLS}Makefile\n\n\nclean %c4  clean.port clean.contrib clean.libtiff clean.tools clean.make\n\nclean.port %c4\n\tdirectory {PORT}\n\t(make clean || set status 0) > purge\n\tpurge\n\t{RM} purge  || set status 0\n\t{RM} Makefile || set status 0\n\t{RM} build.mpw || set status 0\n\tcd ::\n\nclean.contrib %c4\n\t{RM} {MACTRANS} || set status 0\n\t\nclean.libtiff %c4\n\tdirectory {LIBTIFF}\n\t(make clean || set status 0) > purge\n\tpurge\n\t{RM} purge  || set status 0\n\t{RM} Makefile || set status 0\n\t{RM} build.mpw || set status 0\n\tcd ::\n\nclean.tools %c4\n\tdirectory {TOOLS}\n\t(make clean || set status 0) > purge\n\tpurge\n\t{RM} purge  || set status 0\n\t{RM} Makefile || set status 0\n\t{RM} build.mpw || set status 0\n\tcd ::\n\nclean.make %c4\n\t{RM} {MAKEFILES} || set status 0\n\t{RM} build.mpw || set status 0\n\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/mfs/Makefile.am",
    "content": "# Tag Image File Format (TIFF) Software\n#\n# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>\n#\n# Permission to use, copy, modify, distribute, and sell this software and \n# its documentation for any purpose is hereby granted without fee, provided\n# that (i) the above copyright notices and this permission notice appear in\n# all copies of the software and related documentation, and (ii) the names of\n# Sam Leffler and Silicon Graphics may not be used in any advertising or\n# publicity relating to the software without the specific, prior written\n# permission of Sam Leffler and Silicon Graphics.\n# \n# THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n# \n# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n# OF THIS SOFTWARE.\n\n# Process this file with automake to produce Makefile.in.\n\nEXTRA_DIST = README mfs_file.c\n\nINCLUDES = -I../../libtiff -I$(top_srcdir)/libtiff"
  },
  {
    "path": "src/main/jni/tiff/contrib/mfs/Makefile.in",
    "content": "# Makefile.in generated by automake 1.11 from Makefile.am.\n# @configure_input@\n\n# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,\n# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,\n# Inc.\n# This Makefile.in is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY, to the extent permitted by law; without\n# even the implied warranty of MERCHANTABILITY or FITNESS FOR A\n# PARTICULAR PURPOSE.\n\n@SET_MAKE@\n\n# Tag Image File Format (TIFF) Software\n#\n# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>\n#\n# Permission to use, copy, modify, distribute, and sell this software and \n# its documentation for any purpose is hereby granted without fee, provided\n# that (i) the above copyright notices and this permission notice appear in\n# all copies of the software and related documentation, and (ii) the names of\n# Sam Leffler and Silicon Graphics may not be used in any advertising or\n# publicity relating to the software without the specific, prior written\n# permission of Sam Leffler and Silicon Graphics.\n# \n# THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n# \n# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n# OF THIS SOFTWARE.\n\n# Process this file with automake to produce Makefile.in.\nVPATH = @srcdir@\npkgdatadir = $(datadir)/@PACKAGE@\npkgincludedir = $(includedir)/@PACKAGE@\npkglibdir = $(libdir)/@PACKAGE@\npkglibexecdir = $(libexecdir)/@PACKAGE@\nam__cd = CDPATH=\"$${ZSH_VERSION+.}$(PATH_SEPARATOR)\" && cd\ninstall_sh_DATA = $(install_sh) -c -m 644\ninstall_sh_PROGRAM = $(install_sh) -c\ninstall_sh_SCRIPT = $(install_sh) -c\nINSTALL_HEADER = $(INSTALL_DATA)\ntransform = $(program_transform_name)\nNORMAL_INSTALL = :\nPRE_INSTALL = :\nPOST_INSTALL = :\nNORMAL_UNINSTALL = :\nPRE_UNINSTALL = :\nPOST_UNINSTALL = :\nbuild_triplet = @build@\nhost_triplet = @host@\ntarget_triplet = @target@\nsubdir = contrib/mfs\nDIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in\nACLOCAL_M4 = $(top_srcdir)/aclocal.m4\nam__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \\\n\t$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \\\n\t$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \\\n\t$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac\nam__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \\\n\t$(ACLOCAL_M4)\nmkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs\nCONFIG_HEADER = $(top_builddir)/libtiff/tif_config.h \\\n\t$(top_builddir)/libtiff/tiffconf.h\nCONFIG_CLEAN_FILES =\nCONFIG_CLEAN_VPATH_FILES =\nAM_V_GEN = $(am__v_GEN_$(V))\nam__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))\nam__v_GEN_0 = @echo \"  GEN   \" $@;\nAM_V_at = $(am__v_at_$(V))\nam__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))\nam__v_at_0 = @\nSOURCES =\nDIST_SOURCES =\nDISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)\nACLOCAL = @ACLOCAL@\nAMTAR = @AMTAR@\nAM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@\nAR = @AR@\nAS = @AS@\nAUTOCONF = @AUTOCONF@\nAUTOHEADER = @AUTOHEADER@\nAUTOMAKE = @AUTOMAKE@\nAWK = @AWK@\nCC = @CC@\nCCDEPMODE = @CCDEPMODE@\nCFLAGS = @CFLAGS@\nCPP = @CPP@\nCPPFLAGS = @CPPFLAGS@\nCXX = @CXX@\nCXXCPP = @CXXCPP@\nCXXDEPMODE = @CXXDEPMODE@\nCXXFLAGS = @CXXFLAGS@\nCYGPATH_W = @CYGPATH_W@\nDEFS = @DEFS@\nDEPDIR = @DEPDIR@\nDLLTOOL = @DLLTOOL@\nDSYMUTIL = @DSYMUTIL@\nDUMPBIN = @DUMPBIN@\nECHO_C = @ECHO_C@\nECHO_N = @ECHO_N@\nECHO_T = @ECHO_T@\nEGREP = @EGREP@\nEXEEXT = @EXEEXT@\nFGREP = @FGREP@\nGLUT_CFLAGS = @GLUT_CFLAGS@\nGLUT_LIBS = @GLUT_LIBS@\nGLU_CFLAGS = @GLU_CFLAGS@\nGLU_LIBS = @GLU_LIBS@\nGL_CFLAGS = @GL_CFLAGS@\nGL_LIBS = @GL_LIBS@\nGREP = @GREP@\nINSTALL = @INSTALL@\nINSTALL_DATA = @INSTALL_DATA@\nINSTALL_PROGRAM = @INSTALL_PROGRAM@\nINSTALL_SCRIPT = @INSTALL_SCRIPT@\nINSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@\nLD = @LD@\nLDFLAGS = @LDFLAGS@\nLIBDIR = @LIBDIR@\nLIBOBJS = @LIBOBJS@\nLIBS = @LIBS@\nLIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@\nLIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@\nLIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@\nLIBTIFF_MICRO_VERSION = @LIBTIFF_MICRO_VERSION@\nLIBTIFF_MINOR_VERSION = @LIBTIFF_MINOR_VERSION@\nLIBTIFF_RELEASE_DATE = @LIBTIFF_RELEASE_DATE@\nLIBTIFF_VERSION = @LIBTIFF_VERSION@\nLIBTIFF_VERSION_INFO = @LIBTIFF_VERSION_INFO@\nLIBTOOL = @LIBTOOL@\nLIPO = @LIPO@\nLN_S = @LN_S@\nLTLIBOBJS = @LTLIBOBJS@\nMAINT = @MAINT@\nMAKEINFO = @MAKEINFO@\nMKDIR_P = @MKDIR_P@\nNM = @NM@\nNMEDIT = @NMEDIT@\nOBJDUMP = @OBJDUMP@\nOBJEXT = @OBJEXT@\nOTOOL = @OTOOL@\nOTOOL64 = @OTOOL64@\nPACKAGE = @PACKAGE@\nPACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@\nPACKAGE_NAME = @PACKAGE_NAME@\nPACKAGE_STRING = @PACKAGE_STRING@\nPACKAGE_TARNAME = @PACKAGE_TARNAME@\nPACKAGE_URL = @PACKAGE_URL@\nPACKAGE_VERSION = @PACKAGE_VERSION@\nPATH_SEPARATOR = @PATH_SEPARATOR@\nPTHREAD_CC = @PTHREAD_CC@\nPTHREAD_CFLAGS = @PTHREAD_CFLAGS@\nPTHREAD_LIBS = @PTHREAD_LIBS@\nRANLIB = @RANLIB@\nSED = @SED@\nSET_MAKE = @SET_MAKE@\nSHELL = @SHELL@\nSTRIP = @STRIP@\nVERSION = @VERSION@\nXMKMF = @XMKMF@\nX_CFLAGS = @X_CFLAGS@\nX_EXTRA_LIBS = @X_EXTRA_LIBS@\nX_LIBS = @X_LIBS@\nX_PRE_LIBS = @X_PRE_LIBS@\nabs_builddir = @abs_builddir@\nabs_srcdir = @abs_srcdir@\nabs_top_builddir = @abs_top_builddir@\nabs_top_srcdir = @abs_top_srcdir@\nac_ct_CC = @ac_ct_CC@\nac_ct_CXX = @ac_ct_CXX@\nac_ct_DUMPBIN = @ac_ct_DUMPBIN@\nacx_pthread_config = @acx_pthread_config@\nam__include = @am__include@\nam__leading_dot = @am__leading_dot@\nam__quote = @am__quote@\nam__tar = @am__tar@\nam__untar = @am__untar@\nbindir = @bindir@\nbuild = @build@\nbuild_alias = @build_alias@\nbuild_cpu = @build_cpu@\nbuild_os = @build_os@\nbuild_vendor = @build_vendor@\nbuilddir = @builddir@\ndatadir = @datadir@\ndatarootdir = @datarootdir@\ndocdir = @docdir@\ndvidir = @dvidir@\nexec_prefix = @exec_prefix@\nhost = @host@\nhost_alias = @host_alias@\nhost_cpu = @host_cpu@\nhost_os = @host_os@\nhost_vendor = @host_vendor@\nhtmldir = @htmldir@\nincludedir = @includedir@\ninfodir = @infodir@\ninstall_sh = @install_sh@\nlibdir = @libdir@\nlibexecdir = @libexecdir@\nlocaledir = @localedir@\nlocalstatedir = @localstatedir@\nlt_ECHO = @lt_ECHO@\nmandir = @mandir@\nmkdir_p = @mkdir_p@\noldincludedir = @oldincludedir@\npdfdir = @pdfdir@\nprefix = @prefix@\nprogram_transform_name = @program_transform_name@\npsdir = @psdir@\nsbindir = @sbindir@\nsharedstatedir = @sharedstatedir@\nsrcdir = @srcdir@\nsysconfdir = @sysconfdir@\ntarget = @target@\ntarget_alias = @target_alias@\ntarget_cpu = @target_cpu@\ntarget_os = @target_os@\ntarget_vendor = @target_vendor@\ntop_build_prefix = @top_build_prefix@\ntop_builddir = @top_builddir@\ntop_srcdir = @top_srcdir@\nEXTRA_DIST = README mfs_file.c\nINCLUDES = -I../../libtiff -I$(top_srcdir)/libtiff\nall: all-am\n\n.SUFFIXES:\n$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)\n\t@for dep in $?; do \\\n\t  case '$(am__configure_deps)' in \\\n\t    *$$dep*) \\\n\t      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \\\n\t        && { if test -f $@; then exit 0; else break; fi; }; \\\n\t      exit 1;; \\\n\t  esac; \\\n\tdone; \\\n\techo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign contrib/mfs/Makefile'; \\\n\t$(am__cd) $(top_srcdir) && \\\n\t  $(AUTOMAKE) --foreign contrib/mfs/Makefile\n.PRECIOUS: Makefile\nMakefile: $(srcdir)/Makefile.in $(top_builddir)/config.status\n\t@case '$?' in \\\n\t  *config.status*) \\\n\t    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \\\n\t  *) \\\n\t    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \\\n\t    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \\\n\tesac;\n\n$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n\n$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n$(am__aclocal_m4_deps):\n\nmostlyclean-libtool:\n\t-rm -f *.lo\n\nclean-libtool:\n\t-rm -rf .libs _libs\ntags: TAGS\nTAGS:\n\nctags: CTAGS\nCTAGS:\n\n\ndistdir: $(DISTFILES)\n\t@srcdirstrip=`echo \"$(srcdir)\" | sed 's/[].[^$$\\\\*]/\\\\\\\\&/g'`; \\\n\ttopsrcdirstrip=`echo \"$(top_srcdir)\" | sed 's/[].[^$$\\\\*]/\\\\\\\\&/g'`; \\\n\tlist='$(DISTFILES)'; \\\n\t  dist_files=`for file in $$list; do echo $$file; done | \\\n\t  sed -e \"s|^$$srcdirstrip/||;t\" \\\n\t      -e \"s|^$$topsrcdirstrip/|$(top_builddir)/|;t\"`; \\\n\tcase $$dist_files in \\\n\t  */*) $(MKDIR_P) `echo \"$$dist_files\" | \\\n\t\t\t   sed '/\\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \\\n\t\t\t   sort -u` ;; \\\n\tesac; \\\n\tfor file in $$dist_files; do \\\n\t  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \\\n\t  if test -d $$d/$$file; then \\\n\t    dir=`echo \"/$$file\" | sed -e 's,/[^/]*$$,,'`; \\\n\t    if test -d \"$(distdir)/$$file\"; then \\\n\t      find \"$(distdir)/$$file\" -type d ! -perm -700 -exec chmod u+rwx {} \\;; \\\n\t    fi; \\\n\t    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \\\n\t      cp -fpR $(srcdir)/$$file \"$(distdir)$$dir\" || exit 1; \\\n\t      find \"$(distdir)/$$file\" -type d ! -perm -700 -exec chmod u+rwx {} \\;; \\\n\t    fi; \\\n\t    cp -fpR $$d/$$file \"$(distdir)$$dir\" || exit 1; \\\n\t  else \\\n\t    test -f \"$(distdir)/$$file\" \\\n\t    || cp -p $$d/$$file \"$(distdir)/$$file\" \\\n\t    || exit 1; \\\n\t  fi; \\\n\tdone\ncheck-am: all-am\ncheck: check-am\nall-am: Makefile\ninstalldirs:\ninstall: install-am\ninstall-exec: install-exec-am\ninstall-data: install-data-am\nuninstall: uninstall-am\n\ninstall-am: all-am\n\t@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am\n\ninstallcheck: installcheck-am\ninstall-strip:\n\t$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM=\"$(INSTALL_STRIP_PROGRAM)\" \\\n\t  install_sh_PROGRAM=\"$(INSTALL_STRIP_PROGRAM)\" INSTALL_STRIP_FLAG=-s \\\n\t  `test -z '$(STRIP)' || \\\n\t    echo \"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'\"` install\nmostlyclean-generic:\n\nclean-generic:\n\ndistclean-generic:\n\t-test -z \"$(CONFIG_CLEAN_FILES)\" || rm -f $(CONFIG_CLEAN_FILES)\n\t-test . = \"$(srcdir)\" || test -z \"$(CONFIG_CLEAN_VPATH_FILES)\" || rm -f $(CONFIG_CLEAN_VPATH_FILES)\n\nmaintainer-clean-generic:\n\t@echo \"This command is intended for maintainers to use\"\n\t@echo \"it deletes files that may require special tools to rebuild.\"\nclean: clean-am\n\nclean-am: clean-generic clean-libtool mostlyclean-am\n\ndistclean: distclean-am\n\t-rm -f Makefile\ndistclean-am: clean-am distclean-generic\n\ndvi: dvi-am\n\ndvi-am:\n\nhtml: html-am\n\nhtml-am:\n\ninfo: info-am\n\ninfo-am:\n\ninstall-data-am:\n\ninstall-dvi: install-dvi-am\n\ninstall-dvi-am:\n\ninstall-exec-am:\n\ninstall-html: install-html-am\n\ninstall-html-am:\n\ninstall-info: install-info-am\n\ninstall-info-am:\n\ninstall-man:\n\ninstall-pdf: install-pdf-am\n\ninstall-pdf-am:\n\ninstall-ps: install-ps-am\n\ninstall-ps-am:\n\ninstallcheck-am:\n\nmaintainer-clean: maintainer-clean-am\n\t-rm -f Makefile\nmaintainer-clean-am: distclean-am maintainer-clean-generic\n\nmostlyclean: mostlyclean-am\n\nmostlyclean-am: mostlyclean-generic mostlyclean-libtool\n\npdf: pdf-am\n\npdf-am:\n\nps: ps-am\n\nps-am:\n\nuninstall-am:\n\n.MAKE: install-am install-strip\n\n.PHONY: all all-am check check-am clean clean-generic clean-libtool \\\n\tdistclean distclean-generic distclean-libtool distdir dvi \\\n\tdvi-am html html-am info info-am install install-am \\\n\tinstall-data install-data-am install-dvi install-dvi-am \\\n\tinstall-exec install-exec-am install-html install-html-am \\\n\tinstall-info install-info-am install-man install-pdf \\\n\tinstall-pdf-am install-ps install-ps-am install-strip \\\n\tinstallcheck installcheck-am installdirs maintainer-clean \\\n\tmaintainer-clean-generic mostlyclean mostlyclean-generic \\\n\tmostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am\n\n\n# Tell versions [3.59,3.63) of GNU make to not export all variables.\n# Otherwise a system limit (for SysV at least) may be exceeded.\n.NOEXPORT:\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/mfs/README",
    "content": "Date:    Mon, 23 Jun 1997 13:30:48 +0200\nTo:      <sam@cthulhu.engr.sgi.com>\n\nFrom:    \"Mike Johnson\" <mikehunt@swipnet.se>\nSubject: libtiff - Thanks\n\nReturn-Path: mikehunt@swipnet.se \nDelivery-Date: Mon, 23 Jun 1997 06:53:39 -0700\n\nHi Sam,\n\nI noticed in the README from libtiff that you would like to know about\nwhat people have done with libtiff, so I thought I would drop you a\nline.\n\nWe have used libtiff to create and convert TIFF images of financial\ndocuments which are sent from and to major document processing systems\nin Sweden and Denmark.\n\nI would like to express my deep gratitude to yourself and Sillicon\nGraphics for making this excellent library available for public use.\nThere is obviously a lot of work that has gone in to libtiff and the\nquality of the code and documentation is an example to others.\n\nOne thing that libtiff did not do was work on a memory area rather than\nfiles. In my applications I had already read a TIFF or other format\nfile in to memory and did not want to waste I/O writing it out again\nfor libtiff's benefit. I therefore constructed a set of functions to\npass up to TIFFClientOpen to simulate a file in memory. I have attached\nmy mfs (memory file system) source code for you to use or junk, as you\nsee fit. :-)\n\nOnce again, thanks very much for making my life simpler.\n\nBest Regards,\n\nMike Johnson.\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/mfs/mfs_file.c",
    "content": "/*\n--------------------------------------------------------------------------------\n-   Module      :   mem_file.c\n-   Description :   A general purpose library for manipulating a memory area\n-                   as if it were a file.\n-                   mfs_ stands for memory file system.\n-   Author      :   Mike Johnson - Banctec AB 03/07/96\n-                   \n--------------------------------------------------------------------------------\n*/\n\n/* \n\nCopyright (c) 1996 Mike Johnson\nCopyright (c) 1996 BancTec AB\n\nPermission to use, copy, modify, distribute, and sell this software\nfor any purpose is hereby granted without fee, provided\nthat (i) the above copyright notices and this permission notice appear in\nall copies of the software and related documentation, and (ii) the names of\nMike Johnson and BancTec may not be used in any advertising or\npublicity relating to the software.\n\nTHE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \nEXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \nWARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n\nIN NO EVENT SHALL MIKE JOHNSON OR BANCTEC BE LIABLE FOR\nANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\nOR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\nWHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \nLIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \nOF THIS SOFTWARE.\n\n*/\n\n\n/*\n--------------------------------------------------------------------------------\n-   Includes\n--------------------------------------------------------------------------------\n*/\n\n#include    <stdio.h>\n#include    <stdlib.h>\n#include    <string.h>\n\n/*\n--------------------------------------------------------------------------------\n-   Definitions\n--------------------------------------------------------------------------------\n*/\n\n#define MAX_BUFFS   20\n#define FALSE       0\n#define TRUE        1\n\n/*\n--------------------------------------------------------------------------------\n-   Globals\n--------------------------------------------------------------------------------\n*/\n\nstatic char *buf[MAX_BUFFS];        /* Memory for each open buf */\nstatic long  buf_off[MAX_BUFFS];    /* File pointer for each buf */\nstatic long  buf_size[MAX_BUFFS];   /* Count of bytes allocated for each buf */\nstatic long  fds[MAX_BUFFS];        /* File descriptor status */\nstatic int   buf_mode[MAX_BUFFS];   /* Mode of buffer (r, w, a) */\n\nstatic int library_init_done = FALSE;\n\n\n/*\n--------------------------------------------------------------------------------\n-   Function prototypes\n--------------------------------------------------------------------------------\n*/\n\nint mfs_open (void *ptr, int size, char *mode);\nint mfs_lseek (int fd, int offset, int whence);\nint mfs_read (int fd, void *buf, int size);\nint mfs_write (int fd, void *buf, int size);\nint mfs_size (int fd);\nint mfs_map (int fd, char **addr, size_t *len);\nint mfs_unmap (int fd);\nint mfs_close (int fd);\nstatic int extend_mem_file (int fd, int size);\nstatic void mem_init ();\n\n/*\n--------------------------------------------------------------------------------\n-   Function code\n--------------------------------------------------------------------------------\n*/\n\n/*\n--------------------------------------------------------------------------------\n-   Function    :   mfs_open ()\n-\n-   Arguments   :   Pointer to allocated buffer, initial size of buffer, \n-                   mode spec (r, w, a)\n-\n-   Returns     :   File descriptor or -1 if error.\n-\n-   Description :   Register this area of memory (which has been allocated\n-                   and has a file read into it) under the mem_file library.\n-                   A file descriptor is returned which can the be passed\n-                   back to TIFFClientOpen and used as if it was a disk\n-                   based fd.\n-                   If the call is for mode 'w' then pass (void *)NULL as\n-                   the buffer and zero size and the library will \n-                   allocate memory for you.\n-                   If the mode is append then pass (void *)NULL and size\n-                   zero or with a valid address.\n-                   \n--------------------------------------------------------------------------------\n*/\n\nint mfs_open (void *buffer, int size, char *mode)\n{\n    int ret, i;\n    void *tmp;\n\n    if (library_init_done == FALSE)\n    {\n        mem_init ();\n        library_init_done = TRUE;\n    }\n\n    ret = -1;\n\n    /* Find a free fd */\n\n    for (i = 0; i < MAX_BUFFS; i++)\n    {\n        if (fds[i] == -1)\n        {\n            ret = i;\n            break;\n        }\n    }\n\n    if (i == MAX_BUFFS)     /* No more free descriptors */\n    {\n        ret = -1;\n        errno = EMFILE;\n    }\n\n    if (ret >= 0 && *mode == 'r')\n    {\n        if (buffer == (void *)NULL)\n        {\n            ret = -1;\n            errno = EINVAL;\n        }\n        else\n        {\n            buf[ret] = (char *)buffer;\n            buf_size[ret] = size;\n            buf_off[ret] = 0;\n        }\n    }\n    else if (ret >= 0 && *mode == 'w')\n    {\n\n        if (buffer != (void *)NULL)\n        {\n            ret = -1;\n            errno = EINVAL;\n        }\n\n        else\n        {\n            tmp = malloc (0);   /* Get a pointer */\n            if (tmp == (void *)NULL)\n            {\n                ret = -1;\n                errno = EDQUOT;\n            }\n            else\n            {\n                buf[ret] = (char *)tmp;\n                buf_size[ret] = 0;\n                buf_off[ret] = 0;\n            }\n        }\n    }\n    else if (ret >= 0 && *mode == 'a')\n    {\n        if (buffer == (void *) NULL)    /* Create space for client */\n        {\n            tmp = malloc (0);   /* Get a pointer */\n            if (tmp == (void *)NULL)\n            {\n                ret = -1;\n                errno = EDQUOT;\n            }\n            else\n            {\n                buf[ret] = (char *)tmp;\n                buf_size[ret] = 0;\n                buf_off[ret] = 0;\n            }\n        }\n        else                            /* Client has file read in already */\n        {\n            buf[ret] = (char *)buffer;\n            buf_size[ret] = size;\n            buf_off[ret] = 0;\n        }\n    }\n    else        /* Some other invalid combination of parameters */\n    {\n        ret = -1;\n        errno = EINVAL;\n    }\n\n    if (ret != -1)\n    {\n        fds[ret] = 0;\n        buf_mode[ret] = *mode;\n    }\n\n    return (ret);\n}\n\n/*\n--------------------------------------------------------------------------------\n-   Function    :   mfs_lseek ()\n-\n-   Arguments   :   File descriptor, offset, whence\n-\n-   Returns     :   as per man lseek (2)\n-\n-   Description :   Does the same as lseek (2) except on a memory based file.\n-                   Note: the memory area will be extended if the caller\n-                   attempts to seek past the current end of file (memory).\n-                   \n--------------------------------------------------------------------------------\n*/\n\nint mfs_lseek (int fd, int offset, int whence)\n{\n    int ret;\n    long test_off;\n\n    if (fds[fd] == -1)  /* Not open */\n    {\n        ret = -1;\n        errno = EBADF;\n    }\n    else if (offset < 0 && whence == SEEK_SET)\n    {\n        ret = -1;\n        errno = EINVAL;\n    }\n    else\n    {\n        switch (whence)\n        {\n            case SEEK_SET:\n                if (offset > buf_size[fd])\n                    extend_mem_file (fd, offset);\n                buf_off[fd] = offset;\n                ret = offset;\n                break;\n\n            case SEEK_CUR:\n                test_off = buf_off[fd] + offset;\n\n                if (test_off < 0)\n                {\n                    ret = -1;\n                    errno = EINVAL;\n                }\n                else\n                {\n                    if (test_off > buf_size[fd])\n                        extend_mem_file (fd, test_off);\n                    buf_off[fd] = test_off;\n                    ret = test_off;\n                }\n                break;\n\n            case SEEK_END:\n                test_off = buf_size[fd] + offset;\n\n                if (test_off < 0)\n                {\n                    ret = -1;\n                    errno = EINVAL;\n                }\n                else\n                {\n                    if (test_off > buf_size[fd])\n                        extend_mem_file (fd, test_off);\n                    buf_off[fd] = test_off;\n                    ret = test_off;\n                }\n                break;\n\n            default:\n                errno = EINVAL;\n                ret = -1;\n                break;\n        }\n    }\n\n    return (ret);\n}   \n\n/*\n--------------------------------------------------------------------------------\n-   Function    :   mfs_read ()\n-\n-   Arguments   :   File descriptor, buffer, size\n-\n-   Returns     :   as per man read (2)\n-\n-   Description :   Does the same as read (2) except on a memory based file.\n-                   Note: An attempt to read past the end of memory currently\n-                   allocated to the file will return 0 (End Of File)\n-                   \n--------------------------------------------------------------------------------\n*/\n\nint mfs_read (int fd, void *clnt_buf, int size)\n{\n    int ret;\n\n    if (fds[fd] == -1 || buf_mode[fd] != 'r')\n    {\n        /* File is either not open, or not opened for read */\n\n        ret = -1;\n        errno = EBADF;\n    }\n    else if (buf_off[fd] + size > buf_size[fd])\n    {\n        ret = 0;        /* EOF */\n    }\n    else\n    {\n        memcpy (clnt_buf, (void *) (buf[fd] + buf_off[fd]), size);\n        buf_off[fd] = buf_off[fd] + size;\n        ret = size;\n    }\n\n    return (ret);\n}\n\n/*\n--------------------------------------------------------------------------------\n-   Function    :   mfs_write ()\n-\n-   Arguments   :   File descriptor, buffer, size\n-\n-   Returns     :   as per man write (2)\n-\n-   Description :   Does the same as write (2) except on a memory based file.\n-                   Note: the memory area will be extended if the caller\n-                   attempts to write past the current end of file (memory).\n-                   \n--------------------------------------------------------------------------------\n*/\n\nint mfs_write (int fd, void *clnt_buf, int size)\n{\n    int ret;\n\n    if (fds[fd] == -1 || buf_mode[fd] == 'r')\n    {\n        /* Either the file is not open or it is opened for reading only */\n\n        ret = -1;\n        errno = EBADF;\n    }\n    else if (buf_mode[fd] == 'w')\n    {\n        /* Write */\n\n        if (buf_off[fd] + size > buf_size[fd])\n        {       \n            extend_mem_file (fd, buf_off[fd] + size);\n            buf_size[fd] = (buf_off[fd] + size);\n        }\n\n        memcpy ((buf[fd] + buf_off[fd]), clnt_buf, size);\n        buf_off[fd] = buf_off[fd] + size;\n\n        ret = size;\n    }\n    else\n    {\n        /* Append */\n\n        if (buf_off[fd] != buf_size[fd])\n            buf_off[fd] = buf_size[fd];\n\n        extend_mem_file (fd, buf_off[fd] + size);\n        buf_size[fd] += size;\n\n        memcpy ((buf[fd] + buf_off[fd]), clnt_buf, size);\n        buf_off[fd] = buf_off[fd] + size;\n\n        ret = size;\n    }\n\n    return (ret);\n}\n\n/*\n--------------------------------------------------------------------------------\n-   Function    :   mfs_size ()\n-\n-   Arguments   :   File descriptor\n-\n-   Returns     :   integer file size\n-\n-   Description :   This function returns the current size of the file in bytes.\n-                   \n--------------------------------------------------------------------------------\n*/\n\nint mfs_size (int fd)\n{\n    int ret;\n\n    if (fds[fd] == -1)  /* Not open */\n    {\n        ret = -1;\n        errno = EBADF;\n    }\n    else\n        ret = buf_size[fd];\n\n    return (ret);\n}\n\n/*\n--------------------------------------------------------------------------------\n-   Function    :   mfs_map ()\n-\n-   Arguments   :   File descriptor, ptr to address, ptr to length\n-\n-   Returns     :   Map status (succeeded or otherwise)\n-\n-   Description :   This function tells the client where the file is mapped\n-                   in memory and what size the mapped area is. It is provided\n-                   to satisfy the MapProc function in libtiff. It pretends\n-                   that the file has been mmap (2)ped.\n-                   \n--------------------------------------------------------------------------------\n*/\n\nint mfs_map (int fd, char **addr, size_t *len)\n{\n    int ret; \n\n    if (fds[fd] == -1)  /* Not open */\n    {\n        ret = -1;\n        errno = EBADF;\n    }\n    else\n    {\n        *addr = buf[fd];\n        *len = buf_size[fd];\n        ret = 0;\n    }\n\n    return (ret);\n}\n\n/*\n--------------------------------------------------------------------------------\n-   Function    :   mfs_unmap ()\n-\n-   Arguments   :   File descriptor\n-\n-   Returns     :   UnMap status (succeeded or otherwise)\n-\n-   Description :   This function does nothing as the file is always\n-                   in memory.\n-                   \n--------------------------------------------------------------------------------\n*/\n\nint mfs_unmap (int fd)\n{\n    return (0);\n}\n\n/*\n--------------------------------------------------------------------------------\n-   Function    :   mfs_close ()\n-\n-   Arguments   :   File descriptor\n-\n-   Returns     :   close status (succeeded or otherwise)\n-\n-   Description :   Close the open memory file. (Make fd available again.)\n-                   \n--------------------------------------------------------------------------------\n*/\n\nint mfs_close (int fd)\n{\n    int ret; \n\n    if (fds[fd] == -1)  /* Not open */\n    {\n        ret = -1;\n        errno = EBADF;\n    }\n    else\n    {\n        fds[fd] = -1;\n        ret = 0;\n    }\n\n    return (ret);\n}\n\n/*\n--------------------------------------------------------------------------------\n-   Function    :   extend_mem_file ()\n-\n-   Arguments   :   File descriptor, length to extend to.\n-\n-   Returns     :   0 - All OK, -1 - realloc () failed.\n-\n-   Description :   Increase the amount of memory allocated to a file.\n-                   \n--------------------------------------------------------------------------------\n*/\n\nstatic int extend_mem_file (int fd, int size)\n{\n    void *new_mem;\n    int ret;\n\n    if ((new_mem = realloc (buf[fd], size)) == (void *) NULL)\n        ret = -1;\n    else\n    {\n        buf[fd] = (char *) new_mem;\n        ret = 0;\n    }\n\n    return (ret);\n}\n\n/*\n--------------------------------------------------------------------------------\n-   Function    :   mem_init ()\n-\n-   Arguments   :   None\n-\n-   Returns     :   void\n-\n-   Description :   Initialise the library.\n-                   \n--------------------------------------------------------------------------------\n*/\n\nstatic void mem_init ()\n{\n    int i;\n\n    for (i = 0; i < MAX_BUFFS; i++)\n    {\n        fds[i] = -1;\n        buf[i] = (char *)NULL;\n        buf_size[i] = 0;\n        buf_off[i] = 0;\n    }\n}\n\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/pds/Makefile.am",
    "content": "# Tag Image File Format (TIFF) Software\n#\n# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>\n#\n# Permission to use, copy, modify, distribute, and sell this software and \n# its documentation for any purpose is hereby granted without fee, provided\n# that (i) the above copyright notices and this permission notice appear in\n# all copies of the software and related documentation, and (ii) the names of\n# Sam Leffler and Silicon Graphics may not be used in any advertising or\n# publicity relating to the software without the specific, prior written\n# permission of Sam Leffler and Silicon Graphics.\n# \n# THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n# \n# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n# OF THIS SOFTWARE.\n\n# Process this file with automake to produce Makefile.in.\n\nEXTRA_DIST = README tif_imageiter.c tif_imageiter.h tif_pdsdirread.c tif_pdsdirwrite.c\n\nINCLUDES = -I../../libtiff -I$(top_srcdir)/libtiff\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/pds/Makefile.in",
    "content": "# Makefile.in generated by automake 1.11 from Makefile.am.\n# @configure_input@\n\n# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,\n# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,\n# Inc.\n# This Makefile.in is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY, to the extent permitted by law; without\n# even the implied warranty of MERCHANTABILITY or FITNESS FOR A\n# PARTICULAR PURPOSE.\n\n@SET_MAKE@\n\n# Tag Image File Format (TIFF) Software\n#\n# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>\n#\n# Permission to use, copy, modify, distribute, and sell this software and \n# its documentation for any purpose is hereby granted without fee, provided\n# that (i) the above copyright notices and this permission notice appear in\n# all copies of the software and related documentation, and (ii) the names of\n# Sam Leffler and Silicon Graphics may not be used in any advertising or\n# publicity relating to the software without the specific, prior written\n# permission of Sam Leffler and Silicon Graphics.\n# \n# THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n# \n# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n# OF THIS SOFTWARE.\n\n# Process this file with automake to produce Makefile.in.\nVPATH = @srcdir@\npkgdatadir = $(datadir)/@PACKAGE@\npkgincludedir = $(includedir)/@PACKAGE@\npkglibdir = $(libdir)/@PACKAGE@\npkglibexecdir = $(libexecdir)/@PACKAGE@\nam__cd = CDPATH=\"$${ZSH_VERSION+.}$(PATH_SEPARATOR)\" && cd\ninstall_sh_DATA = $(install_sh) -c -m 644\ninstall_sh_PROGRAM = $(install_sh) -c\ninstall_sh_SCRIPT = $(install_sh) -c\nINSTALL_HEADER = $(INSTALL_DATA)\ntransform = $(program_transform_name)\nNORMAL_INSTALL = :\nPRE_INSTALL = :\nPOST_INSTALL = :\nNORMAL_UNINSTALL = :\nPRE_UNINSTALL = :\nPOST_UNINSTALL = :\nbuild_triplet = @build@\nhost_triplet = @host@\ntarget_triplet = @target@\nsubdir = contrib/pds\nDIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in\nACLOCAL_M4 = $(top_srcdir)/aclocal.m4\nam__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \\\n\t$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \\\n\t$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \\\n\t$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac\nam__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \\\n\t$(ACLOCAL_M4)\nmkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs\nCONFIG_HEADER = $(top_builddir)/libtiff/tif_config.h \\\n\t$(top_builddir)/libtiff/tiffconf.h\nCONFIG_CLEAN_FILES =\nCONFIG_CLEAN_VPATH_FILES =\nAM_V_GEN = $(am__v_GEN_$(V))\nam__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))\nam__v_GEN_0 = @echo \"  GEN   \" $@;\nAM_V_at = $(am__v_at_$(V))\nam__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))\nam__v_at_0 = @\nSOURCES =\nDIST_SOURCES =\nDISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)\nACLOCAL = @ACLOCAL@\nAMTAR = @AMTAR@\nAM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@\nAR = @AR@\nAS = @AS@\nAUTOCONF = @AUTOCONF@\nAUTOHEADER = @AUTOHEADER@\nAUTOMAKE = @AUTOMAKE@\nAWK = @AWK@\nCC = @CC@\nCCDEPMODE = @CCDEPMODE@\nCFLAGS = @CFLAGS@\nCPP = @CPP@\nCPPFLAGS = @CPPFLAGS@\nCXX = @CXX@\nCXXCPP = @CXXCPP@\nCXXDEPMODE = @CXXDEPMODE@\nCXXFLAGS = @CXXFLAGS@\nCYGPATH_W = @CYGPATH_W@\nDEFS = @DEFS@\nDEPDIR = @DEPDIR@\nDLLTOOL = @DLLTOOL@\nDSYMUTIL = @DSYMUTIL@\nDUMPBIN = @DUMPBIN@\nECHO_C = @ECHO_C@\nECHO_N = @ECHO_N@\nECHO_T = @ECHO_T@\nEGREP = @EGREP@\nEXEEXT = @EXEEXT@\nFGREP = @FGREP@\nGLUT_CFLAGS = @GLUT_CFLAGS@\nGLUT_LIBS = @GLUT_LIBS@\nGLU_CFLAGS = @GLU_CFLAGS@\nGLU_LIBS = @GLU_LIBS@\nGL_CFLAGS = @GL_CFLAGS@\nGL_LIBS = @GL_LIBS@\nGREP = @GREP@\nINSTALL = @INSTALL@\nINSTALL_DATA = @INSTALL_DATA@\nINSTALL_PROGRAM = @INSTALL_PROGRAM@\nINSTALL_SCRIPT = @INSTALL_SCRIPT@\nINSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@\nLD = @LD@\nLDFLAGS = @LDFLAGS@\nLIBDIR = @LIBDIR@\nLIBOBJS = @LIBOBJS@\nLIBS = @LIBS@\nLIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@\nLIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@\nLIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@\nLIBTIFF_MICRO_VERSION = @LIBTIFF_MICRO_VERSION@\nLIBTIFF_MINOR_VERSION = @LIBTIFF_MINOR_VERSION@\nLIBTIFF_RELEASE_DATE = @LIBTIFF_RELEASE_DATE@\nLIBTIFF_VERSION = @LIBTIFF_VERSION@\nLIBTIFF_VERSION_INFO = @LIBTIFF_VERSION_INFO@\nLIBTOOL = @LIBTOOL@\nLIPO = @LIPO@\nLN_S = @LN_S@\nLTLIBOBJS = @LTLIBOBJS@\nMAINT = @MAINT@\nMAKEINFO = @MAKEINFO@\nMKDIR_P = @MKDIR_P@\nNM = @NM@\nNMEDIT = @NMEDIT@\nOBJDUMP = @OBJDUMP@\nOBJEXT = @OBJEXT@\nOTOOL = @OTOOL@\nOTOOL64 = @OTOOL64@\nPACKAGE = @PACKAGE@\nPACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@\nPACKAGE_NAME = @PACKAGE_NAME@\nPACKAGE_STRING = @PACKAGE_STRING@\nPACKAGE_TARNAME = @PACKAGE_TARNAME@\nPACKAGE_URL = @PACKAGE_URL@\nPACKAGE_VERSION = @PACKAGE_VERSION@\nPATH_SEPARATOR = @PATH_SEPARATOR@\nPTHREAD_CC = @PTHREAD_CC@\nPTHREAD_CFLAGS = @PTHREAD_CFLAGS@\nPTHREAD_LIBS = @PTHREAD_LIBS@\nRANLIB = @RANLIB@\nSED = @SED@\nSET_MAKE = @SET_MAKE@\nSHELL = @SHELL@\nSTRIP = @STRIP@\nVERSION = @VERSION@\nXMKMF = @XMKMF@\nX_CFLAGS = @X_CFLAGS@\nX_EXTRA_LIBS = @X_EXTRA_LIBS@\nX_LIBS = @X_LIBS@\nX_PRE_LIBS = @X_PRE_LIBS@\nabs_builddir = @abs_builddir@\nabs_srcdir = @abs_srcdir@\nabs_top_builddir = @abs_top_builddir@\nabs_top_srcdir = @abs_top_srcdir@\nac_ct_CC = @ac_ct_CC@\nac_ct_CXX = @ac_ct_CXX@\nac_ct_DUMPBIN = @ac_ct_DUMPBIN@\nacx_pthread_config = @acx_pthread_config@\nam__include = @am__include@\nam__leading_dot = @am__leading_dot@\nam__quote = @am__quote@\nam__tar = @am__tar@\nam__untar = @am__untar@\nbindir = @bindir@\nbuild = @build@\nbuild_alias = @build_alias@\nbuild_cpu = @build_cpu@\nbuild_os = @build_os@\nbuild_vendor = @build_vendor@\nbuilddir = @builddir@\ndatadir = @datadir@\ndatarootdir = @datarootdir@\ndocdir = @docdir@\ndvidir = @dvidir@\nexec_prefix = @exec_prefix@\nhost = @host@\nhost_alias = @host_alias@\nhost_cpu = @host_cpu@\nhost_os = @host_os@\nhost_vendor = @host_vendor@\nhtmldir = @htmldir@\nincludedir = @includedir@\ninfodir = @infodir@\ninstall_sh = @install_sh@\nlibdir = @libdir@\nlibexecdir = @libexecdir@\nlocaledir = @localedir@\nlocalstatedir = @localstatedir@\nlt_ECHO = @lt_ECHO@\nmandir = @mandir@\nmkdir_p = @mkdir_p@\noldincludedir = @oldincludedir@\npdfdir = @pdfdir@\nprefix = @prefix@\nprogram_transform_name = @program_transform_name@\npsdir = @psdir@\nsbindir = @sbindir@\nsharedstatedir = @sharedstatedir@\nsrcdir = @srcdir@\nsysconfdir = @sysconfdir@\ntarget = @target@\ntarget_alias = @target_alias@\ntarget_cpu = @target_cpu@\ntarget_os = @target_os@\ntarget_vendor = @target_vendor@\ntop_build_prefix = @top_build_prefix@\ntop_builddir = @top_builddir@\ntop_srcdir = @top_srcdir@\nEXTRA_DIST = README tif_imageiter.c tif_imageiter.h tif_pdsdirread.c tif_pdsdirwrite.c\nINCLUDES = -I../../libtiff -I$(top_srcdir)/libtiff\nall: all-am\n\n.SUFFIXES:\n$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)\n\t@for dep in $?; do \\\n\t  case '$(am__configure_deps)' in \\\n\t    *$$dep*) \\\n\t      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \\\n\t        && { if test -f $@; then exit 0; else break; fi; }; \\\n\t      exit 1;; \\\n\t  esac; \\\n\tdone; \\\n\techo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign contrib/pds/Makefile'; \\\n\t$(am__cd) $(top_srcdir) && \\\n\t  $(AUTOMAKE) --foreign contrib/pds/Makefile\n.PRECIOUS: Makefile\nMakefile: $(srcdir)/Makefile.in $(top_builddir)/config.status\n\t@case '$?' in \\\n\t  *config.status*) \\\n\t    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \\\n\t  *) \\\n\t    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \\\n\t    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \\\n\tesac;\n\n$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n\n$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n$(am__aclocal_m4_deps):\n\nmostlyclean-libtool:\n\t-rm -f *.lo\n\nclean-libtool:\n\t-rm -rf .libs _libs\ntags: TAGS\nTAGS:\n\nctags: CTAGS\nCTAGS:\n\n\ndistdir: $(DISTFILES)\n\t@srcdirstrip=`echo \"$(srcdir)\" | sed 's/[].[^$$\\\\*]/\\\\\\\\&/g'`; \\\n\ttopsrcdirstrip=`echo \"$(top_srcdir)\" | sed 's/[].[^$$\\\\*]/\\\\\\\\&/g'`; \\\n\tlist='$(DISTFILES)'; \\\n\t  dist_files=`for file in $$list; do echo $$file; done | \\\n\t  sed -e \"s|^$$srcdirstrip/||;t\" \\\n\t      -e \"s|^$$topsrcdirstrip/|$(top_builddir)/|;t\"`; \\\n\tcase $$dist_files in \\\n\t  */*) $(MKDIR_P) `echo \"$$dist_files\" | \\\n\t\t\t   sed '/\\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \\\n\t\t\t   sort -u` ;; \\\n\tesac; \\\n\tfor file in $$dist_files; do \\\n\t  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \\\n\t  if test -d $$d/$$file; then \\\n\t    dir=`echo \"/$$file\" | sed -e 's,/[^/]*$$,,'`; \\\n\t    if test -d \"$(distdir)/$$file\"; then \\\n\t      find \"$(distdir)/$$file\" -type d ! -perm -700 -exec chmod u+rwx {} \\;; \\\n\t    fi; \\\n\t    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \\\n\t      cp -fpR $(srcdir)/$$file \"$(distdir)$$dir\" || exit 1; \\\n\t      find \"$(distdir)/$$file\" -type d ! -perm -700 -exec chmod u+rwx {} \\;; \\\n\t    fi; \\\n\t    cp -fpR $$d/$$file \"$(distdir)$$dir\" || exit 1; \\\n\t  else \\\n\t    test -f \"$(distdir)/$$file\" \\\n\t    || cp -p $$d/$$file \"$(distdir)/$$file\" \\\n\t    || exit 1; \\\n\t  fi; \\\n\tdone\ncheck-am: all-am\ncheck: check-am\nall-am: Makefile\ninstalldirs:\ninstall: install-am\ninstall-exec: install-exec-am\ninstall-data: install-data-am\nuninstall: uninstall-am\n\ninstall-am: all-am\n\t@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am\n\ninstallcheck: installcheck-am\ninstall-strip:\n\t$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM=\"$(INSTALL_STRIP_PROGRAM)\" \\\n\t  install_sh_PROGRAM=\"$(INSTALL_STRIP_PROGRAM)\" INSTALL_STRIP_FLAG=-s \\\n\t  `test -z '$(STRIP)' || \\\n\t    echo \"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'\"` install\nmostlyclean-generic:\n\nclean-generic:\n\ndistclean-generic:\n\t-test -z \"$(CONFIG_CLEAN_FILES)\" || rm -f $(CONFIG_CLEAN_FILES)\n\t-test . = \"$(srcdir)\" || test -z \"$(CONFIG_CLEAN_VPATH_FILES)\" || rm -f $(CONFIG_CLEAN_VPATH_FILES)\n\nmaintainer-clean-generic:\n\t@echo \"This command is intended for maintainers to use\"\n\t@echo \"it deletes files that may require special tools to rebuild.\"\nclean: clean-am\n\nclean-am: clean-generic clean-libtool mostlyclean-am\n\ndistclean: distclean-am\n\t-rm -f Makefile\ndistclean-am: clean-am distclean-generic\n\ndvi: dvi-am\n\ndvi-am:\n\nhtml: html-am\n\nhtml-am:\n\ninfo: info-am\n\ninfo-am:\n\ninstall-data-am:\n\ninstall-dvi: install-dvi-am\n\ninstall-dvi-am:\n\ninstall-exec-am:\n\ninstall-html: install-html-am\n\ninstall-html-am:\n\ninstall-info: install-info-am\n\ninstall-info-am:\n\ninstall-man:\n\ninstall-pdf: install-pdf-am\n\ninstall-pdf-am:\n\ninstall-ps: install-ps-am\n\ninstall-ps-am:\n\ninstallcheck-am:\n\nmaintainer-clean: maintainer-clean-am\n\t-rm -f Makefile\nmaintainer-clean-am: distclean-am maintainer-clean-generic\n\nmostlyclean: mostlyclean-am\n\nmostlyclean-am: mostlyclean-generic mostlyclean-libtool\n\npdf: pdf-am\n\npdf-am:\n\nps: ps-am\n\nps-am:\n\nuninstall-am:\n\n.MAKE: install-am install-strip\n\n.PHONY: all all-am check check-am clean clean-generic clean-libtool \\\n\tdistclean distclean-generic distclean-libtool distdir dvi \\\n\tdvi-am html html-am info info-am install install-am \\\n\tinstall-data install-data-am install-dvi install-dvi-am \\\n\tinstall-exec install-exec-am install-html install-html-am \\\n\tinstall-info install-info-am install-man install-pdf \\\n\tinstall-pdf-am install-ps install-ps-am install-strip \\\n\tinstallcheck installcheck-am installdirs maintainer-clean \\\n\tmaintainer-clean-generic mostlyclean mostlyclean-generic \\\n\tmostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am\n\n\n# Tell versions [3.59,3.63) of GNU make to not export all variables.\n# Otherwise a system limit (for SysV at least) may be exceeded.\n.NOEXPORT:\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/pds/README",
    "content": "Date:    Fri, 01 Aug 1997 20:14:52 MDT\nTo:      Sam Leffler <sam@cthulhu.engr.sgi.com>\n\nFrom:    \"Conrad J. Poelman (WSAT)\" <poelmanc@plk.af.mil>\nSubject: Potential TIFF library additions\n\nDelivery-Date: Fri, 01 Aug 1997 19:21:06 -0700\n\nSam,\n\nYou probably don't remember me, but I sent in a couple of bug fixes\nregarding the TIFF library about a 16 months ago or so...\n\nI just wanted to send you two other additions that I have made to our\nlocal version of the TIFF library in hopes that you will want to\nincorporate them into your next major release of the TIFF library.\n(These additions are based on TIFF version 3.4beta31, but they sit on\ntop of the library so they shouldn't be much trouble to incorporate them\ninto any more recent version.) They are internally documented to a\nreasonable extent and we've been successfully using them in our code\nhere for over a year. If you think they would make good additions to the\nTIFF library, I'd be happy to clean them up more, document them more,\nand/or integrate them with the latest version of the TIFF library, but I\nfigured I'd see if you were interested in using them before I went to\nall that trouble.\n\nTIFF Image Iterator\n-------------------\nYour ReadRGBA() routine works well for reading many different formats\n(TILED, STIP, compressed or not, etc.) of the most basic types of data\n(RGB, 8-bit greyscale, 8-bit colormapped) into an SGI-style data array,\nand serves as a good template for users with other needs. I used it as\nan exmaple of how to make an iterator which, rather than fill a data\narray, calls an arbitrary user-supplied callback function for each\n\"chunk\" of data - that \"chunk\" might be a strip or a tile, and might\nhave one sample-per-pixel or two, and might be 8-bit data or 16-bit or\n24-bit. The callback function can do whatever it wants with the data -\nstore it in a big array, convert it to RGBA, or draw it directly to the\nscreen. I was able to use this iterator to read 16-bit greyscale and 32-\nand 64-bit floating point data, which wasn't possible with ReadRGBA().\n\nI have tested this routine with 8- and 16-bit greyscale data as well as\nwith 32- and 64-bit floating point data. I believe nearly all of our\ndata is organized in strips, so actually I'd appreciate it if you had\nsome tiled images that I could test it with.\n\nIt should certainly be possible and would be cleanest to reimplement\nReadRGBA() in terms of the image iterator, but I haven't done that.\n\n\nPrivate Sub-Directory Read/Write\n--------------------------------\nTIFF-PL is a Phillips Laboratory extension to the TIFF tags that allows\nus to store satellite imaging-specific information in a TIFF format,\nsuch as the satellite's trajectory, the imaging time, etc. In order to\ngive us the flexibility to modify the tag definitions without getting\napproval from the TIFF committee every time, we were given only three\nTIFF tags - a PL signature, a PL version number, and PL directory\noffset, which lists the position in the file at which to find a private\nsub-directory of tags-value pairs. So I wrote two routines:\nTIFFWritePrivateDataSubDirectory(), which takes a list of tags and a\n\"get\" function and writes the tag values into the TIFF file, returning\nthe offset within the file at which it wrote the directory; and\nTIFFReadPrivateDataSubDirectory(), which takes an offset, a list of\ntags, and a \"set\" function and reads all the data from the private\ndirectory. The functions themselves are pretty simple. (The files are\nhuge because I had to basically copy all of the tif_dirread.c and\ntif_dirwrite.c files in order to access the various fetching routines\nwhich were all declared static and therefore inaccessible in the TIFF\nlibrary.)\n\n\nI'm including the four source files (tif_imgiter.h, tif_imgiter.c,\ntif_pdsdirread.c, tif_pdsdirwrite.c) in case you want to take a look at\nthem. I can also send you some sample code that uses them if you like.\nIf you're interested in having them incorporated into the standard TIFF\nlibrary, I'd be happy to do that integration and clean up and document\nthe routines. (For example, I've already realized that instead of\nlimiting the SEP callback function to three bands (R,G,B) it should take\nan array to enable the handling of n-banded multi-spectral data...) If\nnot, I'll just leave them as they are, since they work fine for us now.\n\nHoller if you have any questions.\n\n-- Conrad\n__________________________________________________________________\n  Capt Conrad J. Poelman         PL/WSAT   (Phillips Laboratory)\n    505-846-4347                   3550 Aberdeen Ave SE \n      (FAX) 505-846-4374             Kirtland AFB, NM 87117-5776\n\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/pds/tif_imageiter.c",
    "content": "/* $Header: /cvs/maptools/cvsroot/libtiff/contrib/pds/tif_imageiter.c,v 1.3 2005/12/21 12:23:13 joris Exp $ */\n\n/*\n * Copyright (c) 1991-1996 Sam Leffler\n * Copyright (c) 1991-1996 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n/*\n * TIFF Library\n *\n * Written by Conrad J. Poelman, PL/WSAT, Kirtland AFB, NM on 26 Mar 96.\n *\n * This file contains code to allow a calling program to \"iterate\" over each\n * pixels in an image as it is read from the file. The iterator takes care of\n * reading strips versus (possibly clipped) tiles, decoding the information\n * according to the decoding method, and so on, so that calling program can\n * ignore those details. The calling program does, however, need to be\n * conscious of the type of the pixel data that it is receiving.\n *\n * For reasons of efficiency, the callback function actually gets called for \n * \"blocks\" of pixels rather than for individual pixels. The format of the\n * callback arguments is given below.\n *\n * This code was taken from TIFFReadRGBAImage() in tif_getimage.c of the original\n * TIFF distribution, and simplified and generalized to provide this general\n * iteration capability. Those routines could certainly be re-implemented in terms\n * of a TIFFImageIter if desired.\n *\n */\n#include \"tiffiop.h\"\n#include \"tif_imageiter.h\"\n#include <assert.h>\n#include <stdio.h>\n\nstatic\tint gtTileContig(TIFFImageIter*, void *udata, uint32, uint32);\nstatic\tint gtTileSeparate(TIFFImageIter*, void *udata, uint32, uint32);\nstatic\tint gtStripContig(TIFFImageIter*, void *udata, uint32, uint32);\nstatic\tint gtStripSeparate(TIFFImageIter*, void *udata, uint32, uint32);\n\nstatic\tconst char photoTag[] = \"PhotometricInterpretation\";\n\nstatic int\nisCCITTCompression(TIFF* tif)\n{\n    uint16 compress;\n    TIFFGetField(tif, TIFFTAG_COMPRESSION, &compress);\n    return (compress == COMPRESSION_CCITTFAX3 ||\n\t    compress == COMPRESSION_CCITTFAX4 ||\n\t    compress == COMPRESSION_CCITTRLE ||\n\t    compress == COMPRESSION_CCITTRLEW);\n}\n\nint\nTIFFImageIterBegin(TIFFImageIter* img, TIFF* tif, int stop, char emsg[1024])\n{\n    uint16* sampleinfo;\n    uint16 extrasamples;\n    uint16 planarconfig;\n    int colorchannels;\n\n    img->tif = tif;\n    img->stoponerr = stop;\n    TIFFGetFieldDefaulted(tif, TIFFTAG_BITSPERSAMPLE, &img->bitspersample);\n    img->alpha = 0;\n    TIFFGetFieldDefaulted(tif, TIFFTAG_SAMPLESPERPIXEL, &img->samplesperpixel);\n    TIFFGetFieldDefaulted(tif, TIFFTAG_EXTRASAMPLES,\n\t&extrasamples, &sampleinfo);\n    if (extrasamples == 1)\n\tswitch (sampleinfo[0]) {\n\tcase EXTRASAMPLE_ASSOCALPHA:\t/* data is pre-multiplied */\n\tcase EXTRASAMPLE_UNASSALPHA:\t/* data is not pre-multiplied */\n\t    img->alpha = sampleinfo[0];\n\t    break;\n\t}\n    colorchannels = img->samplesperpixel - extrasamples;\n    TIFFGetFieldDefaulted(tif, TIFFTAG_PLANARCONFIG, &planarconfig);\n    if (!TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &img->photometric)) {\n\tswitch (colorchannels) {\n\tcase 1:\n\t    if (isCCITTCompression(tif))\n\t\timg->photometric = PHOTOMETRIC_MINISWHITE;\n\t    else\n\t\timg->photometric = PHOTOMETRIC_MINISBLACK;\n\t    break;\n\tcase 3:\n\t    img->photometric = PHOTOMETRIC_RGB;\n\t    break;\n\tdefault:\n\t    sprintf(emsg, \"Missing needed %s tag\", photoTag);\n\t    return (0);\n\t}\n    }\n    switch (img->photometric) {\n    case PHOTOMETRIC_PALETTE:\n\tif (!TIFFGetField(tif, TIFFTAG_COLORMAP,\n\t    &img->redcmap, &img->greencmap, &img->bluecmap)) {\n\t\tTIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), \"Missing required \\\"Colormap\\\" tag\");\n\t    return (0);\n\t}\n\t/* fall thru... */\n    case PHOTOMETRIC_MINISWHITE:\n    case PHOTOMETRIC_MINISBLACK:\n/* This should work now so skip the check - BSR\n\tif (planarconfig == PLANARCONFIG_CONTIG && img->samplesperpixel != 1) {\n\t    sprintf(emsg,\n\t\t\"Sorry, can not handle contiguous data with %s=%d, and %s=%d\",\n\t\tphotoTag, img->photometric,\n\t\t\"Samples/pixel\", img->samplesperpixel);\n\t    return (0);\n\t}\n */\n\tbreak;\n    case PHOTOMETRIC_YCBCR:\n\tif (planarconfig != PLANARCONFIG_CONTIG) {\n\t    sprintf(emsg, \"Sorry, can not handle YCbCr images with %s=%d\",\n\t\t\"Planarconfiguration\", planarconfig);\n\t    return (0);\n\t}\n\t/* It would probably be nice to have a reality check here. */\n\t{ uint16 compress;\n\t  TIFFGetField(tif, TIFFTAG_COMPRESSION, &compress);\n\t  if (compress == COMPRESSION_JPEG && planarconfig == PLANARCONFIG_CONTIG) {\n\t    /* can rely on libjpeg to convert to RGB */\n\t    /* XXX should restore current state on exit */\n\t    TIFFSetField(tif, TIFFTAG_JPEGCOLORMODE, JPEGCOLORMODE_RGB);\n\t    img->photometric = PHOTOMETRIC_RGB;\n\t  }\n\t}\n\tbreak;\n    case PHOTOMETRIC_RGB: \n\tif (colorchannels < 3) {\n\t    sprintf(emsg, \"Sorry, can not handle RGB image with %s=%d\",\n\t\t\"Color channels\", colorchannels);\n\t    return (0);\n\t}\n\tbreak;\n    case PHOTOMETRIC_SEPARATED: {\n\tuint16 inkset;\n\tTIFFGetFieldDefaulted(tif, TIFFTAG_INKSET, &inkset);\n\tif (inkset != INKSET_CMYK) {\n\t    sprintf(emsg, \"Sorry, can not handle separated image with %s=%d\",\n\t\t\"InkSet\", inkset);\n\t    return (0);\n\t}\n\tif (img->samplesperpixel != 4) {\n\t    sprintf(emsg, \"Sorry, can not handle separated image with %s=%d\",\n\t\t\"Samples/pixel\", img->samplesperpixel);\n\t    return (0);\n\t}\n\tbreak;\n    }\n    default:\n\tsprintf(emsg, \"Sorry, can not handle image with %s=%d\",\n\t    photoTag, img->photometric);\n\treturn (0);\n    }\n    TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &img->width);\n    TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &img->height);\n\n    TIFFGetFieldDefaulted(tif, TIFFTAG_ORIENTATION, &img->orientation);\n    switch (img->orientation) {\n    case ORIENTATION_BOTRIGHT:\n    case ORIENTATION_RIGHTBOT:\t/* XXX */\n    case ORIENTATION_LEFTBOT:\t/* XXX */\n\tTIFFWarning(TIFFFileName(tif), \"using bottom-left orientation\");\n\timg->orientation = ORIENTATION_BOTLEFT;\n\t/* fall thru... */\n    case ORIENTATION_BOTLEFT:\n\tbreak;\n    case ORIENTATION_TOPRIGHT:\n    case ORIENTATION_RIGHTTOP:\t/* XXX */\n    case ORIENTATION_LEFTTOP:\t/* XXX */\n    default:\n\tTIFFWarning(TIFFFileName(tif), \"using top-left orientation\");\n\timg->orientation = ORIENTATION_TOPLEFT;\n\t/* fall thru... */\n    case ORIENTATION_TOPLEFT:\n\tbreak;\n    }\n\n    img->isContig =\n\t!(planarconfig == PLANARCONFIG_SEPARATE && colorchannels > 1);\n    if (img->isContig) {\n\timg->get = TIFFIsTiled(tif) ? gtTileContig : gtStripContig;\n    } else {\n\timg->get = TIFFIsTiled(tif) ? gtTileSeparate : gtStripSeparate;\n    }\n    return (1);\n}\n\nint\nTIFFImageIterGet(TIFFImageIter* img, void *udata, uint32 w, uint32 h)\n{\n    if (img->get == NULL) {\n\tTIFFErrorExt(img->tif->tif_clientdata, TIFFFileName(img->tif), \"No \\\"get\\\" routine setup\");\n\treturn (0);\n    }\n    if (img->callback.any == NULL) {\n\tTIFFErrorExt(img->tif->tif_clientdata, TIFFFileName(img->tif),\n\t\t\"No \\\"put\\\" routine setupl; probably can not handle image format\");\n\treturn (0);\n    }\n    return (*img->get)(img, udata, w, h);\n}\n\nTIFFImageIterEnd(TIFFImageIter* img)\n{\n    /* Nothing to free... ? */\n}\n\n/*\n * Read the specified image into an ABGR-format raster.\n */\nint\nTIFFReadImageIter(TIFF* tif,\n    uint32 rwidth, uint32 rheight, uint8* raster, int stop)\n{\n    char emsg[1024];\n    TIFFImageIter img;\n    int ok;\n\n    if (TIFFImageIterBegin(&img, tif, stop, emsg)) {\n\t/* XXX verify rwidth and rheight against width and height */\n\tok = TIFFImageIterGet(&img, raster, rwidth, img.height);\n\tTIFFImageIterEnd(&img);\n    } else {\n\tTIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), emsg);\n\tok = 0;\n    }\n    return (ok);\n}\n\n\n/*\n * Get an tile-organized image that has\n *\tPlanarConfiguration contiguous if SamplesPerPixel > 1\n * or\n *\tSamplesPerPixel == 1\n */\t\nstatic int\ngtTileContig(TIFFImageIter* img, void *udata, uint32 w, uint32 h)\n{\n    TIFF* tif = img->tif;\n    ImageIterTileContigRoutine callback = img->callback.contig;\n    uint16 orientation;\n    uint32 col, row;\n    uint32 tw, th;\n    u_char* buf;\n    int32 fromskew;\n    uint32 nrow;\n\n    buf = (u_char*) _TIFFmalloc(TIFFTileSize(tif));\n    if (buf == 0) {\n\tTIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), \"No space for tile buffer\");\n\treturn (0);\n    }\n    TIFFGetField(tif, TIFFTAG_TILEWIDTH, &tw);\n    TIFFGetField(tif, TIFFTAG_TILELENGTH, &th);\n    orientation = img->orientation;\n    for (row = 0; row < h; row += th) {\n\tnrow = (row + th > h ? h - row : th);\n\tfor (col = 0; col < w; col += tw) {\n\t    if (TIFFReadTile(tif, buf, col, row, 0, 0) < 0 && img->stoponerr)\n\t\tbreak;\n\t    if (col + tw > w) {\n\t\t/*\n\t\t * Tile is clipped horizontally.  Calculate\n\t\t * visible portion and skewing factors.\n\t\t */\n\t\tuint32 npix = w - col;\n\t\tfromskew = tw - npix;\n\t\t(*callback)(img, udata, col, row, npix, nrow, fromskew, buf);\n\t    } else {\n\t\t(*callback)(img, udata, col, row, tw, nrow, 0, buf);\n\t    }\n\t}\n    }\n    _TIFFfree(buf);\n    return (1);\n}\n\n/*\n * Get an tile-organized image that has\n *\t SamplesPerPixel > 1\n *\t PlanarConfiguration separated\n * We assume that all such images are RGB.\n */\t\nstatic int\ngtTileSeparate(TIFFImageIter* img, void *udata, uint32 w, uint32 h)\n{\n    TIFF* tif = img->tif;\n    ImageIterTileSeparateRoutine callback = img->callback.separate;\n    uint16 orientation;\n    uint32 col, row;\n    uint32 tw, th;\n    u_char* buf;\n    u_char* r;\n    u_char* g;\n    u_char* b;\n    u_char* a;\n    tsize_t tilesize;\n    int32 fromskew;\n    int alpha = img->alpha;\n    uint32 nrow;\n\n    tilesize = TIFFTileSize(tif);\n    buf = (u_char*) _TIFFmalloc(4*tilesize);\n    if (buf == 0) {\n\tTIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), \"No space for tile buffer\");\n\treturn (0);\n    }\n    r = buf;\n    g = r + tilesize;\n    b = g + tilesize;\n    a = b + tilesize;\n    if (!alpha)\n\tmemset(a, 0xff, tilesize);\n    TIFFGetField(tif, TIFFTAG_TILEWIDTH, &tw);\n    TIFFGetField(tif, TIFFTAG_TILELENGTH, &th);\n    orientation = img->orientation;\n    for (row = 0; row < h; row += th) {\n\tnrow = (row + th > h ? h - row : th);\n\tfor (col = 0; col < w; col += tw) {\n\t    if (TIFFReadTile(tif, r, col, row,0,0) < 0 && img->stoponerr)\n\t\tbreak;\n\t    if (TIFFReadTile(tif, g, col, row,0,1) < 0 && img->stoponerr)\n\t\tbreak;\n\t    if (TIFFReadTile(tif, b, col, row,0,2) < 0 && img->stoponerr)\n\t\tbreak;\n\t    if (alpha && TIFFReadTile(tif,a,col,row,0,3) < 0 && img->stoponerr)\n\t\tbreak;\n\t    if (col + tw > w) {\n\t\t/*\n\t\t * Tile is clipped horizontally.  Calculate\n\t\t * visible portion and skewing factors.\n\t\t */\n\t\tuint32 npix = w - col;\n\t\tfromskew = tw - npix;\n\t\t(*callback)(img, udata, col, row, npix, nrow, fromskew, r, g, b, a);\n\t    } else {\n\t\t(*callback)(img, udata, col, row, tw, nrow, 0, r, g, b, a);\n\t    }\n\t}\n    }\n    _TIFFfree(buf);\n    return (1);\n}\n\n/*\n * Get a strip-organized image that has\n *\tPlanarConfiguration contiguous if SamplesPerPixel > 1\n * or\n *\tSamplesPerPixel == 1\n */\t\nstatic int\ngtStripContig(TIFFImageIter* img, void *udata, uint32 w, uint32 h)\n{\n    TIFF* tif = img->tif;\n    ImageIterTileContigRoutine callback = img->callback.contig;\n    uint16 orientation;\n    uint32 row, nrow;\n    u_char* buf;\n    uint32 rowsperstrip;\n    uint32 imagewidth = img->width;\n    tsize_t scanline;\n    int32 fromskew;\n\n    buf = (u_char*) _TIFFmalloc(TIFFStripSize(tif));\n    if (buf == 0) {\n\tTIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), \"No space for strip buffer\");\n\treturn (0);\n    }\n    orientation = img->orientation;\n    TIFFGetFieldDefaulted(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);\n    scanline = TIFFScanlineSize(tif);\n    fromskew = (w < imagewidth ? imagewidth - w : 0);\n    for (row = 0; row < h; row += rowsperstrip) {\n\tnrow = (row + rowsperstrip > h ? h - row : rowsperstrip);\n\tif (TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, row, 0),\n\t    buf, nrow*scanline) < 0 && img->stoponerr)\n\t\tbreak;\n\t(*callback)(img, udata, 0, row, w, nrow, fromskew, buf);\n    }\n    _TIFFfree(buf);\n    return (1);\n}\n\n/*\n * Get a strip-organized image with\n *\t SamplesPerPixel > 1\n *\t PlanarConfiguration separated\n * We assume that all such images are RGB.\n */\nstatic int\ngtStripSeparate(TIFFImageIter* img, void *udata, uint32 w, uint32 h)\n{\n    TIFF* tif = img->tif;\n    ImageIterTileSeparateRoutine callback = img->callback.separate;\n    uint16 orientation;\n    u_char *buf;\n    u_char *r, *g, *b, *a;\n    uint32 row, nrow;\n    tsize_t scanline;\n    uint32 rowsperstrip;\n    uint32 imagewidth = img->width;\n    tsize_t stripsize;\n    int32 fromskew;\n    int alpha = img->alpha;\n\n    stripsize = TIFFStripSize(tif);\n    r = buf = (u_char *)_TIFFmalloc(4*stripsize);\n    if (buf == 0) {\n\tTIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), \"No space for tile buffer\");\n\treturn (0);\n    }\n    g = r + stripsize;\n    b = g + stripsize;\n    a = b + stripsize;\n    if (!alpha)\n\tmemset(a, 0xff, stripsize);\n    orientation = img->orientation;\n    TIFFGetFieldDefaulted(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);\n    scanline = TIFFScanlineSize(tif);\n    fromskew = (w < imagewidth ? imagewidth - w : 0);\n    for (row = 0; row < h; row += rowsperstrip) {\n\tnrow = (row + rowsperstrip > h ? h - row : rowsperstrip);\n\tif (TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, row, 0),\n\t    r, nrow*scanline) < 0 && img->stoponerr)\n\t    break;\n\tif (TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, row, 1),\n\t    g, nrow*scanline) < 0 && img->stoponerr)\n\t    break;\n\tif (TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, row, 2),\n\t    b, nrow*scanline) < 0 && img->stoponerr)\n\t    break;\n\tif (alpha &&\n\t    (TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, row, 3),\n\t    a, nrow*scanline) < 0 && img->stoponerr))\n\t    break;\n\t(*callback)(img, udata, 0, row, w, nrow, fromskew, r, g, b, a);\n    }\n    _TIFFfree(buf);\n    return (1);\n}\n\nDECLAREContigCallbackFunc(TestContigCallback)\n{\n    printf(\"Contig Callback called with x = %d, y = %d, w = %d, h = %d, fromskew = %d\\n\",\n\t   x, y, w, h, fromskew);\n}\n\n\nDECLARESepCallbackFunc(TestSepCallback)\n{\n    printf(\"Sep Callback called with x = %d, y = %d, w = %d, h = %d, fromskew = %d\\n\",\n\t   x, y, w, h, fromskew);\n}\n\n\n#ifdef MAIN\nmain(int argc, char **argv)\n{\n    char emsg[1024];\n    TIFFImageIter img;\n    int ok;\n    int stop = 1;\n\n    TIFF *tif;\n    unsigned long nx, ny;\n    unsigned short BitsPerSample, SamplesPerPixel;\n    int isColorMapped, isPliFile;\n    unsigned char *ColorMap;\n    unsigned char *data;\n\n    if (argc < 2) {\n\tfprintf(stderr,\"usage: %s tiff_file\\n\",argv[0]);\n\texit(1);\n    }\n    tif = (TIFF *)PLIGetImage(argv[1], (void *) &data, &ColorMap, \n\t\t\t      &nx, &ny, &BitsPerSample, &SamplesPerPixel, \n\t\t\t      &isColorMapped, &isPliFile);\n    if (tif != NULL) {\n\n\tif (TIFFImageIterBegin(&img, tif, stop, emsg)) {\n\t    /* Here need to set data and callback function! */\n\t    if (img.isContig) {\n\t\timg.callback = TestContigCallback;\n\t    } else {\n\t\timg.callback = TestSepCallback;\n\t    }\n\t    ok = TIFFImageIterGet(&img, NULL, img.width, img.height);\n\t    TIFFImageIterEnd(&img);\n\t} else {\n\t    TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), emsg);\n\t}\n    }\n    \n}\n#endif\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/pds/tif_imageiter.h",
    "content": "typedef struct _TIFFImageIter TIFFImageIter;\n\n/* The callback function is called for each \"block\" of image pixel data after\n   it has been read from the file and decoded. This image pixel data is in the\n   buffer pp, and this data represents the image pixels from (x,y) to\n   (x+w,y+h). It is stored in pixel format, so each pixel contains\n   img->samplesperpixel consecutive samples each containing img->bitspersample\n   bits of data. The array pp is ordered in h consecutive rows of w+fromskew\n   pixels each. */\ntypedef void (*ImageIterTileContigRoutine)\n    (TIFFImageIter*, void *, uint32, uint32, uint32, uint32, int32,\n\tunsigned char*);\n#define\tDECLAREContigCallbackFunc(name) \\\nstatic void name(\\\n    TIFFImageIter* img, \\\n    void* user_data, \\\n    uint32 x, uint32 y, \\\n    uint32 w, uint32 h, \\\n    int32 fromskew, \\\n    u_char* pp \\\n)\n\ntypedef void (*ImageIterTileSeparateRoutine)\n    (TIFFImageIter*, void *, uint32, uint32, uint32, uint32, int32,\n\tunsigned char*, unsigned char*, unsigned char*, unsigned char*);\n#define\tDECLARESepCallbackFunc(name) \\\nstatic void name(\\\n    TIFFImageIter* img, \\\n    void* user_data, \\\n    uint32 x, uint32 y, \\\n    uint32 w, uint32 h,\\\n    int32 fromskew, \\\n    u_char* r, u_char* g, u_char* b, u_char* a\\\n)\n\nstruct _TIFFImageIter {\n\tTIFF*\ttif;\t\t\t\t/* image handle */\n\tint\tstoponerr;\t\t\t/* stop on read error */\n\tint\tisContig;\t\t\t/* data is packed/separate */\n\tint\talpha;\t\t\t\t/* type of alpha data present */\n\tuint32\twidth;\t\t\t\t/* image width */\n\tuint32\theight;\t\t\t\t/* image height */\n\tuint16\tbitspersample;\t\t\t/* image bits/sample */\n\tuint16\tsamplesperpixel;\t\t/* image samples/pixel */\n\tuint16\torientation;\t\t\t/* image orientation */\n\tuint16\tphotometric;\t\t\t/* image photometric interp */\n\tuint16*\tredcmap;\t\t\t/* colormap pallete */\n\tuint16*\tgreencmap;\n\tuint16*\tbluecmap;\n\t\t\t\t\t\t/* get image data routine */\n\tint\t(*get)(TIFFImageIter*, void *udata, uint32, uint32);\n\tunion {\n\t    void (*any)(TIFFImageIter*);\n\t    ImageIterTileContigRoutine\t\tcontig;\n\t    ImageIterTileSeparateRoutine\tseparate;\n\t} callback;\t\t\t\t/* fn to exec for each block */\n};\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/pds/tif_pdsdirread.c",
    "content": "/* $Header: /cvs/maptools/cvsroot/libtiff/contrib/pds/tif_pdsdirread.c,v 1.3 2005/12/21 12:23:13 joris Exp $ */\n\n/*\n * Copyright (c) 1988-1996 Sam Leffler\n * Copyright (c) 1991-1996 Silicon Graphics, Inc.\n * Copyright (c( 1996 USAF Phillips Laboratory\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n/*\n * TIFF Library.\n * \n * These routines written by Conrad J. Poelman on a single late-night of\n * March 20-21, 1996.\n *\n * The entire purpose of this file is to provide a single external function,\n * TIFFReadPrivateDataSubDirectory(). This function is intended for use in reading a\n * private subdirectory from a TIFF file into a private structure. The\n * actual writing of data into the structure is handled by the setFieldFn(),\n * which is passed to TIFFReadPrivateDataSubDirectory() as a parameter. The idea is to\n * enable any application wishing to store private subdirectories to do so\n * easily using this function, without modifying the TIFF library.\n *\n * The astute observer will notice that only two functions are at all different\n * from the original tif_dirread.c file: TIFFReadPrivateDataSubDirectory() and\n * TIFFFetchNormalSubTag(). All the other stuff that makes this file so huge\n * is only necessary because all of those functions are declared static in\n * tif_dirread.c, so we have to totally duplicate them in order to use them.\n *\n * Oh, also note the bug fix in TIFFFetchFloat().\n *\n */\n\n#include \"tiffiop.h\"\n\n#define\tIGNORE\t0\t\t/* tag placeholder used below */\n\n#if HAVE_IEEEFP\n#define\tTIFFCvtIEEEFloatToNative(tif, n, fp)\n#define\tTIFFCvtIEEEDoubleToNative(tif, n, dp)\n#else\nextern\tvoid TIFFCvtIEEEFloatToNative(TIFF*, uint32, float*);\nextern\tvoid TIFFCvtIEEEDoubleToNative(TIFF*, uint32, double*);\n#endif\n\nstatic\tvoid EstimateStripByteCounts(TIFF*, TIFFDirEntry*, uint16);\nstatic\tvoid MissingRequired(TIFF*, const char*);\nstatic\tint CheckDirCount(TIFF*, TIFFDirEntry*, uint32);\nstatic\ttsize_t TIFFFetchData(TIFF*, TIFFDirEntry*, char*);\nstatic\ttsize_t TIFFFetchString(TIFF*, TIFFDirEntry*, char*);\nstatic\tfloat TIFFFetchRational(TIFF*, TIFFDirEntry*);\nstatic\tint TIFFFetchNormalSubTag(TIFF*, TIFFDirEntry*, const TIFFFieldInfo*,\n\t\t\t\t  int (*getFieldFn)(TIFF *tif,ttag_t tag,...));\nstatic\tint TIFFFetchPerSampleShorts(TIFF*, TIFFDirEntry*, int*);\nstatic\tint TIFFFetchPerSampleAnys(TIFF*, TIFFDirEntry*, double*);\nstatic\tint TIFFFetchShortArray(TIFF*, TIFFDirEntry*, uint16*);\nstatic\tint TIFFFetchStripThing(TIFF*, TIFFDirEntry*, long, uint32**);\nstatic\tint TIFFFetchExtraSamples(TIFF*, TIFFDirEntry*);\nstatic\tint TIFFFetchRefBlackWhite(TIFF*, TIFFDirEntry*);\nstatic\tfloat TIFFFetchFloat(TIFF*, TIFFDirEntry*);\nstatic\tint TIFFFetchFloatArray(TIFF*, TIFFDirEntry*, float*);\nstatic\tint TIFFFetchDoubleArray(TIFF*, TIFFDirEntry*, double*);\nstatic\tint TIFFFetchAnyArray(TIFF*, TIFFDirEntry*, double*);\nstatic\tint TIFFFetchShortPair(TIFF*, TIFFDirEntry*);\n#if STRIPCHOP_SUPPORT\nstatic\tvoid ChopUpSingleUncompressedStrip(TIFF*);\n#endif\n\nstatic char *\nCheckMalloc(TIFF* tif, tsize_t n, const char* what)\n{\n\tchar *cp = (char*)_TIFFmalloc(n);\n\tif (cp == NULL)\n\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name, \"No space %s\", what);\n\treturn (cp);\n}\n\n/* Just as was done with TIFFWritePrivateDataSubDirectory(), here we implement\n   TIFFReadPrivateDataSubDirectory() which takes an offset into the TIFF file,\n   a TIFFFieldInfo structure specifying the types of the various tags,\n   and a function to use to set individual tags when they are encountered.\n   The data is read from the file, translated using the TIFF library's\n   built-in machine-independent conversion functions, and filled into\n   private subdirectory structure.\n\n   This code was written by copying the original TIFFReadDirectory() function\n   from tif_dirread.c and paring it down to what is needed for this.\n\n   It is the caller's responsibility to allocate and initialize the internal\n   structure that setFieldFn() will be writing into. If this function is being\n   called more than once before closing the file, the caller also must be\n   careful to free data in the structure before re-initializing.\n\n   It is also the caller's responsibility to verify the presence of\n   any required fields after reading the directory in.\n*/\n\n\nint\nTIFFReadPrivateDataSubDirectory(TIFF* tif, toff_t pdir_offset,\n\t\t\t\tTIFFFieldInfo *field_info,\n\t\t\t\tint (*setFieldFn)(TIFF *tif, ttag_t tag, ...))\n{\n\tregister TIFFDirEntry* dp;\n\tregister int n;\n\tregister TIFFDirectory* td;\n\tTIFFDirEntry* dir;\n\tint iv;\n\tlong v;\n\tdouble dv;\n\tconst TIFFFieldInfo* fip;\n\tint fix;\n\tuint16 dircount;\n\tuint32 nextdiroff;\n\tchar* cp;\n\tint diroutoforderwarning = 0;\n\n\t/* Skipped part about checking for directories or compression data. */\n\n\tif (!isMapped(tif)) {\n\t\tif (!SeekOK(tif, pdir_offset)) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t\t    \"Seek error accessing TIFF private subdirectory\");\n\t\t\treturn (0);\n\t\t}\n\t\tif (!ReadOK(tif, &dircount, sizeof (uint16))) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t\t    \"Can not read TIFF private subdirectory count\");\n\t\t\treturn (0);\n\t\t}\n\t\tif (tif->tif_flags & TIFF_SWAB)\n\t\t\tTIFFSwabShort(&dircount);\n\t\tdir = (TIFFDirEntry *)CheckMalloc(tif,\n\t\t    dircount * sizeof (TIFFDirEntry), \"to read TIFF private subdirectory\");\n\t\tif (dir == NULL)\n\t\t\treturn (0);\n\t\tif (!ReadOK(tif, dir, dircount*sizeof (TIFFDirEntry))) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name, \"Can not read TIFF private subdirectory\");\n\t\t\tgoto bad;\n\t\t}\n\t\t/*\n\t\t * Read offset to next directory for sequential scans.\n\t\t */\n\t\t(void) ReadOK(tif, &nextdiroff, sizeof (uint32));\n\t} else {\n\t\ttoff_t off = pdir_offset;\n\n\t\tif (off + sizeof (short) > tif->tif_size) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t\t    \"Can not read TIFF private subdirectory count\");\n\t\t\treturn (0);\n\t\t} else\n\t\t\t_TIFFmemcpy(&dircount, tif->tif_base + off, sizeof (uint16));\n\t\toff += sizeof (uint16);\n\t\tif (tif->tif_flags & TIFF_SWAB)\n\t\t\tTIFFSwabShort(&dircount);\n\t\tdir = (TIFFDirEntry *)CheckMalloc(tif,\n\t\t    dircount * sizeof (TIFFDirEntry), \"to read TIFF private subdirectory\");\n\t\tif (dir == NULL)\n\t\t\treturn (0);\n\t\tif (off + dircount*sizeof (TIFFDirEntry) > tif->tif_size) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name, \"Can not read TIFF private subdirectory\");\n\t\t\tgoto bad;\n\t\t} else\n\t\t\t_TIFFmemcpy(dir, tif->tif_base + off,\n\t\t\t    dircount*sizeof (TIFFDirEntry));\n\t\toff += dircount* sizeof (TIFFDirEntry);\n\t\tif (off + sizeof (uint32) < tif->tif_size)\n\t\t\t_TIFFmemcpy(&nextdiroff, tif->tif_base+off, sizeof (uint32));\n\t}\n\tif (tif->tif_flags & TIFF_SWAB)\n\t\tTIFFSwabLong(&nextdiroff);\n\n\t/*\n\t * Setup default value and then make a pass over\n\t * the fields to check type and tag information,\n\t * and to extract info required to size data\n\t * structures.  A second pass is made afterwards\n\t * to read in everthing not taken in the first pass.\n\t */\n\ttd = &tif->tif_dir;\n\t\n\tfor (fip = field_info, dp = dir, n = dircount;\n\t     n > 0; n--, dp++) {\n\t\tif (tif->tif_flags & TIFF_SWAB) {\n\t\t\tTIFFSwabArrayOfShort(&dp->tdir_tag, 2);\n\t\t\tTIFFSwabArrayOfLong(&dp->tdir_count, 2);\n\t\t}\n\t\t/*\n\t\t * Find the field information entry for this tag.\n\t\t */\n\t\t/*\n\t\t * Silicon Beach (at least) writes unordered\n\t\t * directory tags (violating the spec).  Handle\n\t\t * it here, but be obnoxious (maybe they'll fix it?).\n\t\t */\n\t\tif (dp->tdir_tag < fip->field_tag) {\n\t\t\tif (!diroutoforderwarning) {\n\t\t\t\tTIFFWarning(tif->tif_name,\n\t\"invalid TIFF private subdirectory; tags are not sorted in ascending order\");\n\t\t\t\tdiroutoforderwarning = 1;\n\t\t\t}\n\t\t\tfip = field_info;    /* O(n^2) */\n\t\t}\n\n\t\twhile (fip->field_tag && fip->field_tag < dp->tdir_tag)\n\t\t\tfip++;\n\t\tif (!fip->field_tag || fip->field_tag != dp->tdir_tag) {\n\t\t\tTIFFWarning(tif->tif_name,\n\t\t\t    \"unknown field with tag %d (0x%x) in private subdirectory ignored\",\n\t\t\t    dp->tdir_tag,  dp->tdir_tag);\n\t\t\tdp->tdir_tag = IGNORE;\n\t\t\tfip = field_info;/* restart search */\n\t\t\tcontinue;\n\t\t}\n\t\t/*\n\t\t * Null out old tags that we ignore.\n\t\t */\n\n\t\t/* Not implemented yet, since FIELD_IGNORE is specific to\n\t\t   the main directories. Could pass this in too... */\n\t\tif (0 /* && fip->field_bit == FIELD_IGNORE */) {\n\tignore:\n\t\t\tdp->tdir_tag = IGNORE;\n\t\t\tcontinue;\n\t\t}\n\n\t\t/*\n\t\t * Check data type.\n\t\t */\n\n\t\twhile (dp->tdir_type != (u_short)fip->field_type) {\n\t\t\tif (fip->field_type == TIFF_ANY)\t/* wildcard */\n\t\t\t\tbreak;\n\t\t\tfip++;\n\t\t\tif (!fip->field_tag || fip->field_tag != dp->tdir_tag) {\n\t\t\t\tTIFFWarning(tif->tif_name,\n\t\t\t\t   \"wrong data type %d for \\\"%s\\\"; tag ignored\",\n\t\t\t\t    dp->tdir_type, fip[-1].field_name);\n\t\t\t\tgoto ignore;\n\t\t\t}\n\t\t}\n\t\t/*\n\t\t * Check count if known in advance.\n\t\t */\n\t\tif (fip->field_readcount != TIFF_VARIABLE) {\n\t\t\tuint32 expected = (fip->field_readcount == TIFF_SPP) ?\n\t\t\t    (uint32) td->td_samplesperpixel :\n\t\t\t    (uint32) fip->field_readcount;\n\t\t\tif (!CheckDirCount(tif, dp, expected))\n\t\t\t\tgoto ignore;\n\t\t}\n\n\t\t/* Now read in and process data from field. */\n\t\tif (!TIFFFetchNormalSubTag(tif, dp, fip, setFieldFn))\n\t\t    goto bad;\n\n\t}\n\n\tif (dir)\n\t\t_TIFFfree(dir);\n\treturn (1);\nbad:\n\tif (dir)\n\t\t_TIFFfree(dir);\n\treturn (0);\n}\n\nstatic void\nEstimateStripByteCounts(TIFF* tif, TIFFDirEntry* dir, uint16 dircount)\n{\n\tregister TIFFDirEntry *dp;\n\tregister TIFFDirectory *td = &tif->tif_dir;\n\tuint16 i;\n\n\tif (td->td_stripbytecount)\n\t\t_TIFFfree(td->td_stripbytecount);\n\ttd->td_stripbytecount = (uint32*)\n\t    CheckMalloc(tif, td->td_nstrips * sizeof (uint32),\n\t\t\"for \\\"StripByteCounts\\\" array\");\n\tif (td->td_compression != COMPRESSION_NONE) {\n\t\tuint32 space = (uint32)(sizeof (TIFFHeader)\n\t\t    + sizeof (uint16)\n\t\t    + (dircount * sizeof (TIFFDirEntry))\n\t\t    + sizeof (uint32));\n\t\ttoff_t filesize = TIFFGetFileSize(tif);\n\t\tuint16 n;\n\n\t\t/* calculate amount of space used by indirect values */\n\t\tfor (dp = dir, n = dircount; n > 0; n--, dp++) {\n\t\t\tuint32 cc = dp->tdir_count*TIFFDataWidth(dp->tdir_type);\n\t\t\tif (cc > sizeof (uint32))\n\t\t\t\tspace += cc;\n\t\t}\n\t\tspace = (filesize - space) / td->td_samplesperpixel;\n\t\tfor (i = 0; i < td->td_nstrips; i++)\n\t\t\ttd->td_stripbytecount[i] = space;\n\t\t/*\n\t\t * This gross hack handles the case were the offset to\n\t\t * the last strip is past the place where we think the strip\n\t\t * should begin.  Since a strip of data must be contiguous,\n\t\t * it's safe to assume that we've overestimated the amount\n\t\t * of data in the strip and trim this number back accordingly.\n\t\t */ \n\t\ti--;\n\t\tif (td->td_stripoffset[i] + td->td_stripbytecount[i] > filesize)\n\t\t\ttd->td_stripbytecount[i] =\n\t\t\t    filesize - td->td_stripoffset[i];\n\t} else {\n\t\tuint32 rowbytes = TIFFScanlineSize(tif);\n\t\tuint32 rowsperstrip = td->td_imagelength / td->td_nstrips;\n\t\tfor (i = 0; i < td->td_nstrips; i++)\n\t\t\ttd->td_stripbytecount[i] = rowbytes*rowsperstrip;\n\t}\n\tTIFFSetFieldBit(tif, FIELD_STRIPBYTECOUNTS);\n\tif (!TIFFFieldSet(tif, FIELD_ROWSPERSTRIP))\n\t\ttd->td_rowsperstrip = td->td_imagelength;\n}\n\nstatic void\nMissingRequired(TIFF* tif, const char* tagname)\n{\n\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t    \"TIFF directory is missing required \\\"%s\\\" field\", tagname);\n}\n\n/*\n * Check the count field of a directory\n * entry against a known value.  The caller\n * is expected to skip/ignore the tag if\n * there is a mismatch.\n */\nstatic int\nCheckDirCount(TIFF* tif, TIFFDirEntry* dir, uint32 count)\n{\n\tif (count != dir->tdir_count) {\n\t\tTIFFWarning(tif->tif_name,\n\t\"incorrect count for field \\\"%s\\\" (%lu, expecting %lu); tag ignored\",\n\t\t    _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name,\n\t\t    dir->tdir_count, count);\n\t\treturn (0);\n\t}\n\treturn (1);\n}\n\n/*\n * Fetch a contiguous directory item.\n */\nstatic tsize_t\nTIFFFetchData(TIFF* tif, TIFFDirEntry* dir, char* cp)\n{\n\tint w = TIFFDataWidth(dir->tdir_type);\n\ttsize_t cc = dir->tdir_count * w;\n\n\tif (!isMapped(tif)) {\n\t\tif (!SeekOK(tif, dir->tdir_offset))\n\t\t\tgoto bad;\n\t\tif (!ReadOK(tif, cp, cc))\n\t\t\tgoto bad;\n\t} else {\n\t\tif (dir->tdir_offset + cc > tif->tif_size)\n\t\t\tgoto bad;\n\t\t_TIFFmemcpy(cp, tif->tif_base + dir->tdir_offset, cc);\n\t}\n\tif (tif->tif_flags & TIFF_SWAB) {\n\t\tswitch (dir->tdir_type) {\n\t\tcase TIFF_SHORT:\n\t\tcase TIFF_SSHORT:\n\t\t\tTIFFSwabArrayOfShort((uint16*) cp, dir->tdir_count);\n\t\t\tbreak;\n\t\tcase TIFF_LONG:\n\t\tcase TIFF_SLONG:\n\t\tcase TIFF_FLOAT:\n\t\t\tTIFFSwabArrayOfLong((uint32*) cp, dir->tdir_count);\n\t\t\tbreak;\n\t\tcase TIFF_RATIONAL:\n\t\tcase TIFF_SRATIONAL:\n\t\t\tTIFFSwabArrayOfLong((uint32*) cp, 2*dir->tdir_count);\n\t\t\tbreak;\n\t\tcase TIFF_DOUBLE:\n\t\t\tTIFFSwabArrayOfDouble((double*) cp, dir->tdir_count);\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn (cc);\nbad:\n\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name, \"Error fetching data for field \\\"%s\\\"\",\n\t    _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name);\n\treturn ((tsize_t) 0);\n}\n\n/*\n * Fetch an ASCII item from the file.\n */\nstatic tsize_t\nTIFFFetchString(TIFF* tif, TIFFDirEntry* dir, char* cp)\n{\n\tif (dir->tdir_count <= 4) {\n\t\tuint32 l = dir->tdir_offset;\n\t\tif (tif->tif_flags & TIFF_SWAB)\n\t\t\tTIFFSwabLong(&l);\n\t\t_TIFFmemcpy(cp, &l, dir->tdir_count);\n\t\treturn (1);\n\t}\n\treturn (TIFFFetchData(tif, dir, cp));\n}\n\n/*\n * Convert numerator+denominator to float.\n */\nstatic int\ncvtRational(TIFF* tif, TIFFDirEntry* dir, uint32 num, uint32 denom, float* rv)\n{\n\tif (denom == 0) {\n\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t    \"%s: Rational with zero denominator (num = %lu)\",\n\t\t    _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name, num);\n\t\treturn (0);\n\t} else {\n\t\tif (dir->tdir_type == TIFF_RATIONAL)\n\t\t\t*rv = ((float)num / (float)denom);\n\t\telse\n\t\t\t*rv = ((float)(int32)num / (float)(int32)denom);\n\t\treturn (1);\n\t}\n}\n\n/*\n * Fetch a rational item from the file\n * at offset off and return the value\n * as a floating point number.\n */\nstatic float\nTIFFFetchRational(TIFF* tif, TIFFDirEntry* dir)\n{\n\tuint32 l[2];\n\tfloat v;\n\n\treturn (!TIFFFetchData(tif, dir, (char *)l) ||\n\t    !cvtRational(tif, dir, l[0], l[1], &v) ? 1.0f : v);\n}\n\n/*\n * Fetch a single floating point value\n * from the offset field and return it\n * as a native float.\n */\nstatic float\nTIFFFetchFloat(TIFF* tif, TIFFDirEntry* dir)\n{\n\t/* This appears to be a flagrant bug in the TIFF library, yet I\n\t   actually don't understand how it could have ever worked the old\n\t   way. Look at the comments in my new code and you'll understand. */\n#if (0)\n\tfloat v = (float)\n\t    TIFFExtractData(tif, dir->tdir_type, dir->tdir_offset);\n\tTIFFCvtIEEEFloatToNative(tif, 1, &v);\n#else\n\tfloat v;\n\t/* This is a little bit tricky - if we just cast the uint32 to a float,\n\t   C will perform a numerical conversion, which is not what we want.\n\t   We want to take the actual bit pattern in the uint32 and interpret\n\t   it as a float. Thus we cast a uint32 * into a float * and then\n\t   dereference to get v. */\n\tuint32 l = (uint32)\n\t    TIFFExtractData(tif, dir->tdir_type, dir->tdir_offset);\n\tv = * (float *) &l;\n\tTIFFCvtIEEEFloatToNative(tif, 1, &v);\n#endif\n\treturn (v);\n\n}\n\n/*\n * Fetch an array of BYTE or SBYTE values.\n */\nstatic int\nTIFFFetchByteArray(TIFF* tif, TIFFDirEntry* dir, uint16* v)\n{\n\tif (dir->tdir_count <= 4) {\n\t\t/*\n\t\t * Extract data from offset field.\n\t\t */\n\t\tif (tif->tif_header.tiff_magic == TIFF_BIGENDIAN) {\n\t\t\tswitch (dir->tdir_count) {\n\t\t\tcase 4: v[3] = dir->tdir_offset & 0xff;\n\t\t\tcase 3: v[2] = (dir->tdir_offset >> 8) & 0xff;\n\t\t\tcase 2: v[1] = (dir->tdir_offset >> 16) & 0xff;\n\t\t\tcase 1: v[0] = dir->tdir_offset >> 24;\n\t\t\t}\n\t\t} else {\n\t\t\tswitch (dir->tdir_count) {\n\t\t\tcase 4: v[3] = dir->tdir_offset >> 24;\n\t\t\tcase 3: v[2] = (dir->tdir_offset >> 16) & 0xff;\n\t\t\tcase 2: v[1] = (dir->tdir_offset >> 8) & 0xff;\n\t\t\tcase 1: v[0] = dir->tdir_offset & 0xff;\n\t\t\t}\n\t\t}\n\t\treturn (1);\n\t} else\n\t\treturn (TIFFFetchData(tif, dir, (char*) v) != 0);\t/* XXX */\n}\n\n/*\n * Fetch an array of SHORT or SSHORT values.\n */\nstatic int\nTIFFFetchShortArray(TIFF* tif, TIFFDirEntry* dir, uint16* v)\n{\n\tif (dir->tdir_count <= 2) {\n\t\tif (tif->tif_header.tiff_magic == TIFF_BIGENDIAN) {\n\t\t\tswitch (dir->tdir_count) {\n\t\t\tcase 2: v[1] = dir->tdir_offset & 0xffff;\n\t\t\tcase 1: v[0] = dir->tdir_offset >> 16;\n\t\t\t}\n\t\t} else {\n\t\t\tswitch (dir->tdir_count) {\n\t\t\tcase 2: v[1] = dir->tdir_offset >> 16;\n\t\t\tcase 1: v[0] = dir->tdir_offset & 0xffff;\n\t\t\t}\n\t\t}\n\t\treturn (1);\n\t} else\n\t\treturn (TIFFFetchData(tif, dir, (char *)v) != 0);\n}\n\n/*\n * Fetch a pair of SHORT or BYTE values.\n */\nstatic int\nTIFFFetchShortPair(TIFF* tif, TIFFDirEntry* dir)\n{\n\tuint16 v[2];\n\tint ok = 0;\n\n\tswitch (dir->tdir_type) {\n\tcase TIFF_SHORT:\n\tcase TIFF_SSHORT:\n\t\tok = TIFFFetchShortArray(tif, dir, v);\n\t\tbreak;\n\tcase TIFF_BYTE:\n\tcase TIFF_SBYTE:\n\t\tok  = TIFFFetchByteArray(tif, dir, v);\n\t\tbreak;\n\t}\n\tif (ok)\n\t\tTIFFSetField(tif, dir->tdir_tag, v[0], v[1]);\n\treturn (ok);\n}\n\n/*\n * Fetch an array of LONG or SLONG values.\n */\nstatic int\nTIFFFetchLongArray(TIFF* tif, TIFFDirEntry* dir, uint32* v)\n{\n\tif (dir->tdir_count == 1) {\n\t\tv[0] = dir->tdir_offset;\n\t\treturn (1);\n\t} else\n\t\treturn (TIFFFetchData(tif, dir, (char*) v) != 0);\n}\n\n/*\n * Fetch an array of RATIONAL or SRATIONAL values.\n */\nstatic int\nTIFFFetchRationalArray(TIFF* tif, TIFFDirEntry* dir, float* v)\n{\n\tint ok = 0;\n\tuint32* l;\n\n\tl = (uint32*)CheckMalloc(tif,\n\t    dir->tdir_count*TIFFDataWidth(dir->tdir_type),\n\t    \"to fetch array of rationals\");\n\tif (l) {\n\t\tif (TIFFFetchData(tif, dir, (char *)l)) {\n\t\t\tuint32 i;\n\t\t\tfor (i = 0; i < dir->tdir_count; i++) {\n\t\t\t\tok = cvtRational(tif, dir,\n\t\t\t\t    l[2*i+0], l[2*i+1], &v[i]);\n\t\t\t\tif (!ok)\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t_TIFFfree((char *)l);\n\t}\n\treturn (ok);\n}\n\n/*\n * Fetch an array of FLOAT values.\n */\nstatic int\nTIFFFetchFloatArray(TIFF* tif, TIFFDirEntry* dir, float* v)\n{\n\n\tif (dir->tdir_count == 1) {\n\t\tv[0] = *(float*) &dir->tdir_offset;\n\t\tTIFFCvtIEEEFloatToNative(tif, dir->tdir_count, v);\n\t\treturn (1);\n\t} else\tif (TIFFFetchData(tif, dir, (char*) v)) {\n\t\tTIFFCvtIEEEFloatToNative(tif, dir->tdir_count, v);\n\t\treturn (1);\n\t} else\n\t\treturn (0);\n}\n\n/*\n * Fetch an array of DOUBLE values.\n */\nstatic int\nTIFFFetchDoubleArray(TIFF* tif, TIFFDirEntry* dir, double* v)\n{\n\tif (TIFFFetchData(tif, dir, (char*) v)) {\n\t\tTIFFCvtIEEEDoubleToNative(tif, dir->tdir_count, v);\n\t\treturn (1);\n\t} else\n\t\treturn (0);\n}\n\n/*\n * Fetch an array of ANY values.  The actual values are\n * returned as doubles which should be able hold all the\n * types.  Yes, there really should be an tany_t to avoid\n * this potential non-portability ...  Note in particular\n * that we assume that the double return value vector is\n * large enough to read in any fundamental type.  We use\n * that vector as a buffer to read in the base type vector\n * and then convert it in place to double (from end\n * to front of course).\n */\nstatic int\nTIFFFetchAnyArray(TIFF* tif, TIFFDirEntry* dir, double* v)\n{\n\tint i;\n\n\tswitch (dir->tdir_type) {\n\tcase TIFF_BYTE:\n\tcase TIFF_SBYTE:\n\t\tif (!TIFFFetchByteArray(tif, dir, (uint16*) v))\n\t\t\treturn (0);\n\t\tif (dir->tdir_type == TIFF_BYTE) {\n\t\t\tuint16* vp = (uint16*) v;\n\t\t\tfor (i = dir->tdir_count-1; i >= 0; i--)\n\t\t\t\tv[i] = vp[i];\n\t\t} else {\n\t\t\tint16* vp = (int16*) v;\n\t\t\tfor (i = dir->tdir_count-1; i >= 0; i--)\n\t\t\t\tv[i] = vp[i];\n\t\t}\n\t\tbreak;\n\tcase TIFF_SHORT:\n\tcase TIFF_SSHORT:\n\t\tif (!TIFFFetchShortArray(tif, dir, (uint16*) v))\n\t\t\treturn (0);\n\t\tif (dir->tdir_type == TIFF_SHORT) {\n\t\t\tuint16* vp = (uint16*) v;\n\t\t\tfor (i = dir->tdir_count-1; i >= 0; i--)\n\t\t\t\tv[i] = vp[i];\n\t\t} else {\n\t\t\tint16* vp = (int16*) v;\n\t\t\tfor (i = dir->tdir_count-1; i >= 0; i--)\n\t\t\t\tv[i] = vp[i];\n\t\t}\n\t\tbreak;\n\tcase TIFF_LONG:\n\tcase TIFF_SLONG:\n\t\tif (!TIFFFetchLongArray(tif, dir, (uint32*) v))\n\t\t\treturn (0);\n\t\tif (dir->tdir_type == TIFF_LONG) {\n\t\t\tuint32* vp = (uint32*) v;\n\t\t\tfor (i = dir->tdir_count-1; i >= 0; i--)\n\t\t\t\tv[i] = vp[i];\n\t\t} else {\n\t\t\tint32* vp = (int32*) v;\n\t\t\tfor (i = dir->tdir_count-1; i >= 0; i--)\n\t\t\t\tv[i] = vp[i];\n\t\t}\n\t\tbreak;\n\tcase TIFF_RATIONAL:\n\tcase TIFF_SRATIONAL:\n\t\tif (!TIFFFetchRationalArray(tif, dir, (float*) v))\n\t\t\treturn (0);\n\t\t{ float* vp = (float*) v;\n\t\t  for (i = dir->tdir_count-1; i >= 0; i--)\n\t\t\tv[i] = vp[i];\n\t\t}\n\t\tbreak;\n\tcase TIFF_FLOAT:\n\t\tif (!TIFFFetchFloatArray(tif, dir, (float*) v))\n\t\t\treturn (0);\n\t\t{ float* vp = (float*) v;\n\t\t  for (i = dir->tdir_count-1; i >= 0; i--)\n\t\t\tv[i] = vp[i];\n\t\t}\n\t\tbreak;\n\tcase TIFF_DOUBLE:\n\t\treturn (TIFFFetchDoubleArray(tif, dir, (double*) v));\n\tdefault:\n\t\t/* TIFF_NOTYPE */\n\t\t/* TIFF_ASCII */\n\t\t/* TIFF_UNDEFINED */\n\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t    \"Cannot read TIFF_ANY type %d for field \\\"%s\\\"\",\n\t\t    _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name);\n\t\treturn (0);\n\t}\n\treturn (1);\n}\n\n\n/*\n * Fetch a tag that is not handled by special case code.\n */\n/* The standard function TIFFFetchNormalTag() could definitely be replaced\n   with a simple call to this function, just adding TIFFSetField() as the\n   last argument. */\nstatic int\nTIFFFetchNormalSubTag(TIFF* tif, TIFFDirEntry* dp, const TIFFFieldInfo* fip,\n\t\t      int (*setFieldFn)(TIFF *tif, ttag_t tag, ...))\n{\n\tstatic char mesg[] = \"to fetch tag value\";\n\tint ok = 0;\n\n\tif (dp->tdir_count > 1) {\t\t/* array of values */\n\t\tchar* cp = NULL;\n\n\t\tswitch (dp->tdir_type) {\n\t\tcase TIFF_BYTE:\n\t\tcase TIFF_SBYTE:\n\t\t\t/* NB: always expand BYTE values to shorts */\n\t\t\tcp = CheckMalloc(tif,\n\t\t\t    dp->tdir_count * sizeof (uint16), mesg);\n\t\t\tok = cp && TIFFFetchByteArray(tif, dp, (uint16*) cp);\n\t\t\tbreak;\n\t\tcase TIFF_SHORT:\n\t\tcase TIFF_SSHORT:\n\t\t\tcp = CheckMalloc(tif,\n\t\t\t    dp->tdir_count * sizeof (uint16), mesg);\n\t\t\tok = cp && TIFFFetchShortArray(tif, dp, (uint16*) cp);\n\t\t\tbreak;\n\t\tcase TIFF_LONG:\n\t\tcase TIFF_SLONG:\n\t\t\tcp = CheckMalloc(tif,\n\t\t\t    dp->tdir_count * sizeof (uint32), mesg);\n\t\t\tok = cp && TIFFFetchLongArray(tif, dp, (uint32*) cp);\n\t\t\tbreak;\n\t\tcase TIFF_RATIONAL:\n\t\tcase TIFF_SRATIONAL:\n\t\t\tcp = CheckMalloc(tif,\n\t\t\t    dp->tdir_count * sizeof (float), mesg);\n\t\t\tok = cp && TIFFFetchRationalArray(tif, dp, (float*) cp);\n\t\t\tbreak;\n\t\tcase TIFF_FLOAT:\n\t\t\tcp = CheckMalloc(tif,\n\t\t\t    dp->tdir_count * sizeof (float), mesg);\n\t\t\tok = cp && TIFFFetchFloatArray(tif, dp, (float*) cp);\n\t\t\tbreak;\n\t\tcase TIFF_DOUBLE:\n\t\t\tcp = CheckMalloc(tif,\n\t\t\t    dp->tdir_count * sizeof (double), mesg);\n\t\t\tok = cp && TIFFFetchDoubleArray(tif, dp, (double*) cp);\n\t\t\tbreak;\n\t\tcase TIFF_ASCII:\n\t\tcase TIFF_UNDEFINED:\t\t/* bit of a cheat... */\n\t\t\t/*\n\t\t\t * Some vendors write strings w/o the trailing\n\t\t\t * NULL byte, so always append one just in case.\n\t\t\t */\n\t\t\tcp = CheckMalloc(tif, dp->tdir_count+1, mesg);\n\t\t\tif (ok = (cp && TIFFFetchString(tif, dp, cp)))\n\t\t\t\tcp[dp->tdir_count] = '\\0';\t/* XXX */\n\t\t\tbreak;\n\t\t}\n\t\tif (ok) {\n\t\t\tok = (fip->field_passcount ?\n\t\t\t    (*setFieldFn)(tif, dp->tdir_tag, dp->tdir_count, cp)\n\t\t\t  : (*setFieldFn)(tif, dp->tdir_tag, cp));\n\t\t}\n\t\tif (cp != NULL)\n\t\t\t_TIFFfree(cp);\n\t} else if (CheckDirCount(tif, dp, 1)) {\t/* singleton value */\n\t\tswitch (dp->tdir_type) {\n\t\tcase TIFF_BYTE:\n\t\tcase TIFF_SBYTE:\n\t\tcase TIFF_SHORT:\n\t\tcase TIFF_SSHORT:\n\t\t\t/*\n\t\t\t * If the tag is also acceptable as a LONG or SLONG\n\t\t\t * then (*setFieldFn) will expect an uint32 parameter\n\t\t\t * passed to it (through varargs).  Thus, for machines\n\t\t\t * where sizeof (int) != sizeof (uint32) we must do\n\t\t\t * a careful check here.  It's hard to say if this\n\t\t\t * is worth optimizing.\n\t\t\t *\n\t\t\t * NB: We use TIFFFieldWithTag here knowing that\n\t\t\t *     it returns us the first entry in the table\n\t\t\t *     for the tag and that that entry is for the\n\t\t\t *     widest potential data type the tag may have.\n\t\t\t */\n\t\t\t{ TIFFDataType type = fip->field_type;\n\t\t\t  if (type != TIFF_LONG && type != TIFF_SLONG) {\n\t\t\t\tuint16 v = (uint16)\n\t\t\t   TIFFExtractData(tif, dp->tdir_type, dp->tdir_offset);\n\t\t\t\tok = (fip->field_passcount ?\n\t\t\t\t    (*setFieldFn)(tif, dp->tdir_tag, 1, &v)\n\t\t\t\t  : (*setFieldFn)(tif, dp->tdir_tag, v));\n\t\t\t\tbreak;\n\t\t\t  }\n\t\t\t}\n\t\t\t/* fall thru... */\n\t\tcase TIFF_LONG:\n\t\tcase TIFF_SLONG:\n\t\t\t{ uint32 v32 =\n\t\t    TIFFExtractData(tif, dp->tdir_type, dp->tdir_offset);\n\t\t\t  ok = (fip->field_passcount ? \n\t\t\t      (*setFieldFn)(tif, dp->tdir_tag, 1, &v32)\n\t\t\t    : (*setFieldFn)(tif, dp->tdir_tag, v32));\n\t\t\t}\n\t\t\tbreak;\n\t\tcase TIFF_RATIONAL:\n\t\tcase TIFF_SRATIONAL:\n\t\tcase TIFF_FLOAT:\n\t\t\t{ float v = (dp->tdir_type == TIFF_FLOAT ? \n\t\t\t      TIFFFetchFloat(tif, dp)\n\t\t\t    : TIFFFetchRational(tif, dp));\n\t\t\t  ok = (fip->field_passcount ?\n\t\t\t      (*setFieldFn)(tif, dp->tdir_tag, 1, &v)\n\t\t\t    : (*setFieldFn)(tif, dp->tdir_tag, v));\n\t\t\t}\n\t\t\tbreak;\n\t\tcase TIFF_DOUBLE:\n\t\t\t{ double v;\n\t\t\t  ok = (TIFFFetchDoubleArray(tif, dp, &v) &&\n\t\t\t    (fip->field_passcount ?\n\t\t\t      (*setFieldFn)(tif, dp->tdir_tag, 1, &v)\n\t\t\t    : (*setFieldFn)(tif, dp->tdir_tag, v))\n\t\t\t  );\n\t\t\t}\n\t\t\tbreak;\n\t\tcase TIFF_ASCII:\n\t\tcase TIFF_UNDEFINED:\t\t/* bit of a cheat... */\n\t\t\t{ char c[2];\n\t\t\t  if (ok = (TIFFFetchString(tif, dp, c) != 0)) {\n\t\t\t\tc[1] = '\\0';\t\t/* XXX paranoid */\n\t\t\t\tok = (*setFieldFn)(tif, dp->tdir_tag, c);\n\t\t\t  }\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn (ok);\n}\n\n/* Everything after this is exactly duplicated from the standard tif_dirread.c\n   file, necessitated by the fact that they are declared static there so\n   we can't call them!\n*/\n#define\tNITEMS(x)\t(sizeof (x) / sizeof (x[0]))\n/*\n * Fetch samples/pixel short values for \n * the specified tag and verify that\n * all values are the same.\n */\nstatic int\nTIFFFetchPerSampleShorts(TIFF* tif, TIFFDirEntry* dir, int* pl)\n{\n\tint samples = tif->tif_dir.td_samplesperpixel;\n\tint status = 0;\n\n\tif (CheckDirCount(tif, dir, (uint32) samples)) {\n\t\tuint16 buf[10];\n\t\tuint16* v = buf;\n\n\t\tif (samples > NITEMS(buf))\n\t\t\tv = (uint16*) _TIFFmalloc(samples * sizeof (uint16));\n\t\tif (TIFFFetchShortArray(tif, dir, v)) {\n\t\t\tint i;\n\t\t\tfor (i = 1; i < samples; i++)\n\t\t\t\tif (v[i] != v[0]) {\n\t\t\t\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t\"Cannot handle different per-sample values for field \\\"%s\\\"\",\n\t\t\t   _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name);\n\t\t\t\t\tgoto bad;\n\t\t\t\t}\n\t\t\t*pl = v[0];\n\t\t\tstatus = 1;\n\t\t}\n\tbad:\n\t\tif (v != buf)\n\t\t\t_TIFFfree((char*) v);\n\t}\n\treturn (status);\n}\n\n/*\n * Fetch samples/pixel ANY values for \n * the specified tag and verify that\n * all values are the same.\n */\nstatic int\nTIFFFetchPerSampleAnys(TIFF* tif, TIFFDirEntry* dir, double* pl)\n{\n\tint samples = (int) tif->tif_dir.td_samplesperpixel;\n\tint status = 0;\n\n\tif (CheckDirCount(tif, dir, (uint32) samples)) {\n\t\tdouble buf[10];\n\t\tdouble* v = buf;\n\n\t\tif (samples > NITEMS(buf))\n\t\t\tv = (double*) _TIFFmalloc(samples * sizeof (double));\n\t\tif (TIFFFetchAnyArray(tif, dir, v)) {\n\t\t\tint i;\n\t\t\tfor (i = 1; i < samples; i++)\n\t\t\t\tif (v[i] != v[0]) {\n\t\t\t\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t\"Cannot handle different per-sample values for field \\\"%s\\\"\",\n\t\t\t   _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name);\n\t\t\t\t\tgoto bad;\n\t\t\t\t}\n\t\t\t*pl = v[0];\n\t\t\tstatus = 1;\n\t\t}\n\tbad:\n\t\tif (v != buf)\n\t\t\t_TIFFfree(v);\n\t}\n\treturn (status);\n}\n#undef NITEMS\n\n/*\n * Fetch a set of offsets or lengths.\n * While this routine says \"strips\",\n * in fact it's also used for tiles.\n */\nstatic int\nTIFFFetchStripThing(TIFF* tif, TIFFDirEntry* dir, long nstrips, uint32** lpp)\n{\n\tregister uint32* lp;\n\tint status;\n\n\tif (!CheckDirCount(tif, dir, (uint32) nstrips))\n\t\treturn (0);\n\t/*\n\t * Allocate space for strip information.\n\t */\n\tif (*lpp == NULL &&\n\t    (*lpp = (uint32 *)CheckMalloc(tif,\n\t      nstrips * sizeof (uint32), \"for strip array\")) == NULL)\n\t\treturn (0);\n\tlp = *lpp;\n\tif (dir->tdir_type == (int)TIFF_SHORT) {\n\t\t/*\n\t\t * Handle uint16->uint32 expansion.\n\t\t */\n\t\tuint16* dp = (uint16*) CheckMalloc(tif,\n\t\t    dir->tdir_count* sizeof (uint16), \"to fetch strip tag\");\n\t\tif (dp == NULL)\n\t\t\treturn (0);\n\t\tif (status = TIFFFetchShortArray(tif, dir, dp)) {\n\t\t\tregister uint16* wp = dp;\n\t\t\twhile (nstrips-- > 0)\n\t\t\t\t*lp++ = *wp++;\n\t\t}\n\t\t_TIFFfree((char*) dp);\n\t} else\n\t\tstatus = TIFFFetchLongArray(tif, dir, lp);\n\treturn (status);\n}\n\n#define\tNITEMS(x)\t(sizeof (x) / sizeof (x[0]))\n/*\n * Fetch and set the ExtraSamples tag.\n */\nstatic int\nTIFFFetchExtraSamples(TIFF* tif, TIFFDirEntry* dir)\n{\n\tuint16 buf[10];\n\tuint16* v = buf;\n\tint status;\n\n\tif (dir->tdir_count > NITEMS(buf))\n\t\tv = (uint16*) _TIFFmalloc(dir->tdir_count * sizeof (uint16));\n\tif (dir->tdir_type == TIFF_BYTE)\n\t\tstatus = TIFFFetchByteArray(tif, dir, v);\n\telse\n\t\tstatus = TIFFFetchShortArray(tif, dir, v);\n\tif (status)\n\t\tstatus = TIFFSetField(tif, dir->tdir_tag, dir->tdir_count, v);\n\tif (v != buf)\n\t\t_TIFFfree((char*) v);\n\treturn (status);\n}\n#undef NITEMS\n\n#ifdef COLORIMETRY_SUPPORT\n/*\n * Fetch and set the RefBlackWhite tag.\n */\nstatic int\nTIFFFetchRefBlackWhite(TIFF* tif, TIFFDirEntry* dir)\n{\n\tstatic char mesg[] = \"for \\\"ReferenceBlackWhite\\\" array\";\n\tchar* cp;\n\tint ok;\n\n\tif (dir->tdir_type == TIFF_RATIONAL)\n\t\treturn (1/*TIFFFetchNormalTag(tif, dir) just so linker won't complain - this part of the code is never used anyway */);\n\t/*\n\t * Handle LONG's for backward compatibility.\n\t */\n\tcp = CheckMalloc(tif, dir->tdir_count * sizeof (uint32), mesg);\n\tif (ok = (cp && TIFFFetchLongArray(tif, dir, (uint32*) cp))) {\n\t\tfloat* fp = (float*)\n\t\t    CheckMalloc(tif, dir->tdir_count * sizeof (float), mesg);\n\t\tif (ok = (fp != NULL)) {\n\t\t\tuint32 i;\n\t\t\tfor (i = 0; i < dir->tdir_count; i++)\n\t\t\t\tfp[i] = (float)((uint32*) cp)[i];\n\t\t\tok = TIFFSetField(tif, dir->tdir_tag, fp);\n\t\t\t_TIFFfree((char*) fp);\n\t\t}\n\t}\n\tif (cp)\n\t\t_TIFFfree(cp);\n\treturn (ok);\n}\n#endif\n\n#if STRIPCHOP_SUPPORT\n/*\n * Replace a single strip (tile) of uncompressed data by\n * multiple strips (tiles), each approximately 8Kbytes.\n * This is useful for dealing with large images or\n * for dealing with machines with a limited amount\n * memory.\n */\nstatic void\nChopUpSingleUncompressedStrip(TIFF* tif)\n{\n\tregister TIFFDirectory *td = &tif->tif_dir;\n\tuint32 bytecount = td->td_stripbytecount[0];\n\tuint32 offset = td->td_stripoffset[0];\n\ttsize_t rowbytes = TIFFVTileSize(tif, 1), stripbytes;\n\ttstrip_t strip, nstrips, rowsperstrip;\n\tuint32* newcounts;\n\tuint32* newoffsets;\n\n\t/*\n\t * Make the rows hold at least one\n\t * scanline, but fill 8k if possible.\n\t */\n\tif (rowbytes > 8192) {\n\t\tstripbytes = rowbytes;\n\t\trowsperstrip = 1;\n\t} else {\n\t\trowsperstrip = 8192 / rowbytes;\n\t\tstripbytes = rowbytes * rowsperstrip;\n\t}\n\t/* never increase the number of strips in an image */\n\tif (rowsperstrip >= td->td_rowsperstrip)\n\t\treturn;\n\tnstrips = (tstrip_t) TIFFhowmany(bytecount, stripbytes);\n\tnewcounts = (uint32*) CheckMalloc(tif, nstrips * sizeof (uint32),\n\t\t\t\t\"for chopped \\\"StripByteCounts\\\" array\");\n\tnewoffsets = (uint32*) CheckMalloc(tif, nstrips * sizeof (uint32),\n\t\t\t\t\"for chopped \\\"StripOffsets\\\" array\");\n\tif (newcounts == NULL || newoffsets == NULL) {\n\t        /*\n\t\t * Unable to allocate new strip information, give\n\t\t * up and use the original one strip information.\n\t\t */\n\t\tif (newcounts != NULL)\n\t\t\t_TIFFfree(newcounts);\n\t\tif (newoffsets != NULL)\n\t\t\t_TIFFfree(newoffsets);\n\t\treturn;\n\t}\n\t/*\n\t * Fill the strip information arrays with\n\t * new bytecounts and offsets that reflect\n\t * the broken-up format.\n\t */\n\tfor (strip = 0; strip < nstrips; strip++) {\n\t\tif (stripbytes > bytecount)\n\t\t\tstripbytes = bytecount;\n\t\tnewcounts[strip] = stripbytes;\n\t\tnewoffsets[strip] = offset;\n\t\toffset += stripbytes;\n\t\tbytecount -= stripbytes;\n\t}\n\t/*\n\t * Replace old single strip info with multi-strip info.\n\t */\n\ttd->td_stripsperimage = td->td_nstrips = nstrips;\n\tTIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, rowsperstrip);\n\n\t_TIFFfree(td->td_stripbytecount);\n\t_TIFFfree(td->td_stripoffset);\n\ttd->td_stripbytecount = newcounts;\n\ttd->td_stripoffset = newoffsets;\n}\n#endif /* STRIPCHOP_SUPPORT */\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/pds/tif_pdsdirwrite.c",
    "content": "/* $Header: /cvs/maptools/cvsroot/libtiff/contrib/pds/tif_pdsdirwrite.c,v 1.3 2005/12/21 12:23:13 joris Exp $ */\n\n/* When writing data to TIFF files, it is often useful to store application-\n   specific data in a private TIFF directory so that the tags don't need to\n   be registered and won't conflict with other people's user-defined tags.\n   One needs to have a registered public tag which contains some amount of\n   raw data. That raw data, however, is interpreted at an independent,\n   separate, private tiff directory. This file provides some routines which\n   will be useful for converting that data from its raw binary form into\n   the proper form for your application.\n*/\n\n/*\n * Copyright (c) 1988-1996 Sam Leffler\n * Copyright (c) 1991-1996 Silicon Graphics, Inc.\n * Copyright (c( 1996 USAF Phillips Laboratory\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n/*\n * TIFF Library.\n *\n * These routines written by Conrad J. Poelman on a single late-night of\n * March 20-21, 1996.\n *\n * The entire purpose of this file is to provide a single external function,\n * TIFFWritePrivateDataSubDirectory(). This function is intended for use\n * in writing a private subdirectory structure into a TIFF file. The\n * actual reading of data from the structure is handled by the getFieldFn(),\n * which is passed to TIFFWritePrivateDataSubDirectory() as a parameter. The\n * idea is to enable any application wishing to read private subdirectories to\n * do so easily using this function, without modifying the TIFF library.\n *\n * The astute observer will notice that only two functions are at all different\n * from the original tif_dirwrite.c file: TIFFWritePrivateDataSubDirectory()and\n * TIFFWriteNormalSubTag(). All the other stuff that makes this file so huge\n * is only necessary because all of those functions are declared static in\n * tif_dirwrite.c, so we have to totally duplicate them in order to use them.\n *\n * Oh, also please note the bug-fix in the routine TIFFWriteNormalSubTag(),\n * which equally should be applied to TIFFWriteNormalTag().\n *\n */\n#include \"tiffiop.h\"\n\n#if HAVE_IEEEFP\n#define\tTIFFCvtNativeToIEEEFloat(tif, n, fp)\n#define\tTIFFCvtNativeToIEEEDouble(tif, n, dp)\n#else\nextern\tvoid TIFFCvtNativeToIEEEFloat(TIFF*, uint32, float*);\nextern\tvoid TIFFCvtNativeToIEEEDouble(TIFF*, uint32, double*);\n#endif\n\nstatic\tint TIFFWriteNormalTag(TIFF*, TIFFDirEntry*, const TIFFFieldInfo*);\nstatic\tint TIFFWriteNormalSubTag(TIFF*, TIFFDirEntry*, const TIFFFieldInfo*,\n\t\t\t\t  int (*getFieldFn)(TIFF *tif,ttag_t tag,...));\nstatic\tvoid TIFFSetupShortLong(TIFF*, ttag_t, TIFFDirEntry*, uint32);\nstatic\tint TIFFSetupShortPair(TIFF*, ttag_t, TIFFDirEntry*);\nstatic\tint TIFFWritePerSampleShorts(TIFF*, ttag_t, TIFFDirEntry*);\nstatic\tint TIFFWritePerSampleAnys(TIFF*, TIFFDataType, ttag_t, TIFFDirEntry*);\nstatic\tint TIFFWriteShortTable(TIFF*, ttag_t, TIFFDirEntry*, uint32, uint16**);\nstatic\tint TIFFWriteShortArray(TIFF*,\n\t    TIFFDataType, ttag_t, TIFFDirEntry*, uint32, uint16*);\nstatic\tint TIFFWriteLongArray(TIFF *,\n\t    TIFFDataType, ttag_t, TIFFDirEntry*, uint32, uint32*);\nstatic\tint TIFFWriteRationalArray(TIFF *,\n\t    TIFFDataType, ttag_t, TIFFDirEntry*, uint32, float*);\nstatic\tint TIFFWriteFloatArray(TIFF *,\n\t    TIFFDataType, ttag_t, TIFFDirEntry*, uint32, float*);\nstatic\tint TIFFWriteDoubleArray(TIFF *,\n\t    TIFFDataType, ttag_t, TIFFDirEntry*, uint32, double*);\nstatic\tint TIFFWriteByteArray(TIFF*, TIFFDirEntry*, char*);\nstatic\tint TIFFWriteAnyArray(TIFF*,\n\t    TIFFDataType, ttag_t, TIFFDirEntry*, uint32, double*);\n#ifdef COLORIMETRY_SUPPORT\nstatic\tint TIFFWriteTransferFunction(TIFF*, TIFFDirEntry*);\n#endif\nstatic\tint TIFFWriteData(TIFF*, TIFFDirEntry*, char*);\nstatic\tint TIFFLinkDirectory(TIFF*);\n\n#define\tWriteRationalPair(type, tag1, v1, tag2, v2) {\t\t\\\n\tif (!TIFFWriteRational(tif, type, tag1, dir, v1))\t\\\n\t\tgoto bad;\t\t\t\t\t\\\n\tif (!TIFFWriteRational(tif, type, tag2, dir+1, v2))\t\\\n\t\tgoto bad;\t\t\t\t\t\\\n\tdir++;\t\t\t\t\t\t\t\\\n}\n#define\tTIFFWriteRational(tif, type, tag, dir, v) \\\n\tTIFFWriteRationalArray((tif), (type), (tag), (dir), 1, &(v))\n#ifndef TIFFWriteRational\nstatic\tint TIFFWriteRational(TIFF*,\n\t    TIFFDataType, ttag_t, TIFFDirEntry*, float);\n#endif\n\n/* This function will write an entire directory to the disk, and return the\n   offset value indicating where in the file it wrote the beginning of the\n   directory structure. This is NOT the same as the offset value before\n   calling this function, because some of the fields may have caused various\n   data items to be written out BEFORE writing the directory structure.\n\n   This code was basically written by ripping of the TIFFWriteDirectory() \n   code and generalizing it, using RPS's TIFFWritePliIfd() code for\n   inspiration.  My original goal was to make this code general enough that\n   the original TIFFWriteDirectory() could be rewritten to just call this\n   function with the appropriate field and field-accessing arguments.\n\n   However, now I realize that there's a lot of code that gets executed for\n   the main, standard TIFF directories that does not apply to special\n   private subdirectories, so such a reimplementation for the sake of\n   eliminating redundant or duplicate code is probably not possible,\n   unless we also pass in a Main flag to indiciate which type of handling\n   to do, which would be kind of a hack. I've marked those places where I\n   changed or ripped out code which would have to be re-inserted to\n   generalize this function. If it can be done in a clean and graceful way,\n   it would be a great way to generalize the TIFF library. Otherwise, I'll\n   just leave this code here where it duplicates but remains on top of and\n   hopefully mostly independent of the main TIFF library.\n\n   The caller will probably want to free the sub directory structure after\n   returning from this call, since otherwise once written out, the user\n   is likely to forget about it and leave data lying around.\n*/\ntoff_t\nTIFFWritePrivateDataSubDirectory(TIFF* tif,\n\t\t\t\t uint32 pdir_fieldsset[], int pdir_fields_last,\n\t\t\t\t TIFFFieldInfo *field_info,\n\t\t\t\t int (*getFieldFn)(TIFF *tif, ttag_t tag, ...))\n{\n\tuint16 dircount;\n\tuint32 diroff, nextdiroff;\n\tttag_t tag;\n\tuint32 nfields;\n\ttsize_t dirsize;\n\tchar* data;\n\tTIFFDirEntry* dir;\n\tu_long b, *fields, fields_size;\n\ttoff_t directory_offset;\n\tTIFFFieldInfo* fip;\n\n\t/*\n\t * Deleted out all of the encoder flushing and such code from here -\n\t * not necessary for subdirectories.\n\t */\n\n\t/* Finish writing out any image data. */\n\tTIFFFlushData(tif);\n\n\t/*\n\t * Size the directory so that we can calculate\n\t * offsets for the data items that aren't kept\n\t * in-place in each field.\n\t */\n\tnfields = 0;\n\tfor (b = 0; b <= pdir_fields_last; b++)\n\t\tif (FieldSet(pdir_fieldsset, b))\n\t\t\t/* Deleted code to make size of first 4 tags 2\n\t\t\t   instead of 1. */\n\t\t\tnfields += 1;\n\tdirsize = nfields * sizeof (TIFFDirEntry);\n\tdata = (char*) _TIFFmalloc(dirsize);\n\tif (data == NULL) {\n\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t    \"Cannot write private subdirectory, out of space\");\n\t\treturn (0);\n\t}\n\t/*\n\t * Place directory in data section of the file. If there isn't one\n\t * yet, place it at the end of the file. The directory is treated as\n\t * data, so we don't link it into the directory structure at all.\n\t */\n\tif (tif->tif_dataoff == 0)\n\t    tif->tif_dataoff =(TIFFSeekFile(tif, (toff_t) 0, SEEK_END)+1) &~ 1;\n\tdiroff = tif->tif_dataoff;\n\ttif->tif_dataoff = (toff_t)(\n\t    diroff + sizeof (uint16) + dirsize + sizeof (toff_t));\n\tif (tif->tif_dataoff & 1)\n\t\ttif->tif_dataoff++;\n\t(void) TIFFSeekFile(tif, tif->tif_dataoff, SEEK_SET);\n\t/*tif->tif_curdir++;*/\n\tdir = (TIFFDirEntry*) data;\n\t/*\n\t * Setup external form of directory\n\t * entries and write data items.\n\t */\n\t/*\n\t * We make a local copy of the fieldsset here so that we don't mess\n\t * up the original one when we call ResetFieldBit(). But I'm not sure\n\t * why the original code calls ResetFieldBit(), since we're already\n\t * going through the fields in order...\n\t *\n\t * fields_size is the number of uint32's we will need to hold the\n\t * bit-mask for all of the fields. If our highest field number is\n\t * 100, then we'll need 100 / (8*4)+1 == 4 uint32's to hold the\n\t * fieldset.\n\t *\n\t * Unlike the original code, we allocate fields dynamically based\n\t * on the requested pdir_fields_last value, allowing private\n\t * data subdirectories to contain more than the built-in code's limit\n\t * of 95 tags in a directory.\n\t */\n\tfields_size = pdir_fields_last / (8*sizeof(uint32)) + 1;\n\tfields = _TIFFmalloc(fields_size*sizeof(uint32));\n\t_TIFFmemcpy(fields, pdir_fieldsset, fields_size * sizeof(uint32));\n\n\t/* Deleted \"write out extra samples tag\" code here. */\n\n\t/* Deleted code for checking a billion little special cases for the\n\t * standard TIFF tags. Should add a general mechanism for overloading\n\t * write function for each field, just like Brian kept telling me!!!\n\t */\n\tfor (fip = field_info; fip->field_tag; fip++) {\n\t\t/* Deleted code to check for FIELD_IGNORE!! */\n\t\tif (/* fip->field_bit == FIELD_IGNORE || */\n\t\t    !FieldSet(fields, fip->field_bit))\n\t\t\tcontinue;\n\t\tif (!TIFFWriteNormalSubTag(tif, dir, fip, getFieldFn))\n\t\t\tgoto bad;\n\t\tdir++;\n\t\tResetFieldBit(fields, fip->field_bit);\n\t}\n\n\t/* Now we've written all of the referenced data, and are about to\n\t   write the main directory structure, so grab the tif_dataoff value\n\t   now so we can remember where we wrote the directory. */\n\tdirectory_offset = tif->tif_dataoff;\n\n\t/*\n\t * Write directory.\n\t */\n\tdircount = (uint16) nfields;\n\t/* Deleted code to link to the next directory - we set it to zero! */\n\tnextdiroff = 0;\n\tif (tif->tif_flags & TIFF_SWAB) {\n\t\t/*\n\t\t * The file's byte order is opposite to the\n\t\t * native machine architecture.  We overwrite\n\t\t * the directory information with impunity\n\t\t * because it'll be released below after we\n\t\t * write it to the file.  Note that all the\n\t\t * other tag construction routines assume that\n\t\t * we do this byte-swapping; i.e. they only\n\t\t * byte-swap indirect data.\n\t\t */\n\t\tfor (dir = (TIFFDirEntry*) data; dircount; dir++, dircount--) {\n\t\t\tTIFFSwabArrayOfShort(&dir->tdir_tag, 2);\n\t\t\tTIFFSwabArrayOfLong(&dir->tdir_count, 2);\n\t\t}\n\t\tdircount = (uint16) nfields;\n\t\tTIFFSwabShort(&dircount);\n\t\tTIFFSwabLong(&nextdiroff);\n\t}\n\n\t(void) TIFFSeekFile(tif, tif->tif_dataoff, SEEK_SET);\n\tif (!WriteOK(tif, &dircount, sizeof (dircount))) {\n\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name, \"Error writing private subdirectory count\");\n\t\tgoto bad;\n\t}\n\tif (!WriteOK(tif, data, dirsize)) {\n\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name, \"Error writing private subdirectory contents\");\n\t\tgoto bad;\n\t}\n\tif (!WriteOK(tif, &nextdiroff, sizeof (nextdiroff))) {\n\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name, \"Error writing private subdirectory link\");\n\t\tgoto bad;\n\t}\n\ttif->tif_dataoff += sizeof(dircount) + dirsize + sizeof(nextdiroff);\n\n\t_TIFFfree(data);\n\t_TIFFfree(fields);\n\ttif->tif_flags &= ~TIFF_DIRTYDIRECT;\n\n#if (0)\n\t/* This stuff commented out because I don't think we want it for\n\t   subdirectories, but I could be wrong. */\n\t(*tif->tif_cleanup)(tif);\n\n\t/*\n\t * Reset directory-related state for subsequent\n\t * directories.\n\t */\n\tTIFFDefaultDirectory(tif);\n\ttif->tif_curoff = 0;\n\ttif->tif_row = (uint32) -1;\n\ttif->tif_curstrip = (tstrip_t) -1;\n#endif\n\n\treturn (directory_offset);\nbad:\n\t_TIFFfree(data);\n\t_TIFFfree(fields);\n\treturn (0);\n}\n#undef WriteRationalPair\n\n/*\n * Process tags that are not special cased.\n */\n/* The standard function TIFFWriteNormalTag() could definitely be replaced\n   with a simple call to this function, just adding TIFFGetField() as the\n   last argument. */\nstatic int\nTIFFWriteNormalSubTag(TIFF* tif, TIFFDirEntry* dir, const TIFFFieldInfo* fip,\n\t\t      int (*getFieldFn)(TIFF *tif, ttag_t tag, ...))\n{\n\tu_short wc = (u_short) fip->field_writecount;\n\n\tdir->tdir_tag = fip->field_tag;\n\tdir->tdir_type = (u_short) fip->field_type;\n\tdir->tdir_count = wc;\n#define\tWRITEF(x,y)\tx(tif, fip->field_type, fip->field_tag, dir, wc, y)\n\tswitch (fip->field_type) {\n\tcase TIFF_SHORT:\n\tcase TIFF_SSHORT:\n\t\tif (wc > 1) {\n\t\t\tuint16* wp;\n\t\t\tif (wc == (u_short) TIFF_VARIABLE) {\n\t\t\t\t(*getFieldFn)(tif, fip->field_tag, &wc, &wp);\n\t\t\t\tdir->tdir_count = wc;\n\t\t\t} else\n\t\t\t\t(*getFieldFn)(tif, fip->field_tag, &wp);\n\t\t\tif (!WRITEF(TIFFWriteShortArray, wp))\n\t\t\t\treturn (0);\n\t\t} else {\n\t\t\tuint16 sv;\n\t\t\t(*getFieldFn)(tif, fip->field_tag, &sv);\n\t\t\tdir->tdir_offset =\n\t\t\t    TIFFInsertData(tif, dir->tdir_type, sv);\n\t\t}\n\t\tbreak;\n\tcase TIFF_LONG:\n\tcase TIFF_SLONG:\n\t\tif (wc > 1) {\n\t\t\tuint32* lp;\n\t\t\tif (wc == (u_short) TIFF_VARIABLE) {\n\t\t\t\t(*getFieldFn)(tif, fip->field_tag, &wc, &lp);\n\t\t\t\tdir->tdir_count = wc;\n\t\t\t} else\n\t\t\t\t(*getFieldFn)(tif, fip->field_tag, &lp);\n\t\t\tif (!WRITEF(TIFFWriteLongArray, lp))\n\t\t\t\treturn (0);\n\t\t} else {\n\t\t\t/* XXX handle LONG->SHORT conversion */\n\t\t\t(*getFieldFn)(tif, fip->field_tag, &dir->tdir_offset);\n\t\t}\n\t\tbreak;\n\tcase TIFF_RATIONAL:\n\tcase TIFF_SRATIONAL:\n\t\tif (wc > 1) {\n\t\t\tfloat* fp;\n\t\t\tif (wc == (u_short) TIFF_VARIABLE) {\n\t\t\t\t(*getFieldFn)(tif, fip->field_tag, &wc, &fp);\n\t\t\t\tdir->tdir_count = wc;\n\t\t\t} else\n\t\t\t\t(*getFieldFn)(tif, fip->field_tag, &fp);\n\t\t\tif (!WRITEF(TIFFWriteRationalArray, fp))\n\t\t\t\treturn (0);\n\t\t} else {\n\t\t\tfloat fv;\n\t\t\t(*getFieldFn)(tif, fip->field_tag, &fv);\n\t\t\tif (!WRITEF(TIFFWriteRationalArray, &fv))\n\t\t\t\treturn (0);\n\t\t}\n\t\tbreak;\n\tcase TIFF_FLOAT:\n\t\tif (wc > 1) {\n\t\t\tfloat* fp;\n\t\t\tif (wc == (u_short) TIFF_VARIABLE) {\n\t\t\t\t(*getFieldFn)(tif, fip->field_tag, &wc, &fp);\n\t\t\t\tdir->tdir_count = wc;\n\t\t\t} else\n\t\t\t\t(*getFieldFn)(tif, fip->field_tag, &fp);\n\t\t\tif (!WRITEF(TIFFWriteFloatArray, fp))\n\t\t\t\treturn (0);\n\t\t} else {\n\t\t\tfloat fv;\n\t\t\t(*getFieldFn)(tif, fip->field_tag, &fv);\n\t\t\tif (!WRITEF(TIFFWriteFloatArray, &fv))\n\t\t\t\treturn (0);\n\t\t}\n\t\tbreak;\n\tcase TIFF_DOUBLE:\n\t\t/* Hey - I think this is a bug, or at least a \"gross\n\t\t   inconsistency\", in the TIFF library. Look at the original\n\t\t   TIFF library code below within the \"#if (0) ... #else\".\n\t\t   Just from the type of *dp, you can see that this code\n\t\t   expects TIFFGetField() to be handed a double ** for\n\t\t   any TIFF_DOUBLE tag, even for the constant wc==1 case.\n\t\t   This is totally inconsistent with other fields (like\n\t\t   TIFF_FLOAT, above) and is also inconsistent with the\n\t\t   TIFFSetField() function for TIFF_DOUBLEs, which expects\n\t\t   to be passed a single double by value for the wc==1 case.\n\t\t   (See the handling of TIFFFetchNormalTag() in tif_dirread.c\n\t\t   for an example.) Maybe this function was written before\n\t\t   TIFFWriteDoubleArray() was written, not that that's an\n\t\t   excuse. Anyway, the new code below is a trivial modification\n\t\t   of the TIFF_FLOAT code above. The fact that even single\n\t\t   doubles get written out in the data segment and get an\n\t\t   offset value stored is irrelevant here - that is all\n\t\t   handled by TIFFWriteDoubleArray(). */\n#if (0)\n\t\t{ double* dp;\n\t\t  if (wc == (u_short) TIFF_VARIABLE) {\n\t\t\t(*getFieldFn)(tif, fip->field_tag, &wc, &dp);\n\t\t\tdir->tdir_count = wc;\n\t\t  } else\n\t\t\t(*getFieldFn)(tif, fip->field_tag, &dp);\n\t\t  TIFFCvtNativeToIEEEDouble(tif, wc, dp);\n\t\t  if (!TIFFWriteData(tif, dir, (char*) dp))\n\t\t\treturn (0);\n\t\t}\n#else\n\t\tif (wc > 1) {\n\t\t\tdouble* dp;\n\t\t\tif (wc == (u_short) TIFF_VARIABLE) {\n\t\t\t\t(*getFieldFn)(tif, fip->field_tag, &wc, &dp);\n\t\t\t\tdir->tdir_count = wc;\n\t\t\t} else\n\t\t\t\t(*getFieldFn)(tif, fip->field_tag, &dp);\n\t\t\tif (!WRITEF(TIFFWriteDoubleArray, dp))\n\t\t\t\treturn (0);\n\t\t} else {\n\t\t\tdouble dv;\n\t\t\t(*getFieldFn)(tif, fip->field_tag, &dv);\n\t\t\tif (!WRITEF(TIFFWriteDoubleArray, &dv))\n\t\t\t\treturn (0);\n\t\t}\n#endif\n\t\tbreak;\n\tcase TIFF_ASCII:\n\t\t{ char* cp;\n\t\t  (*getFieldFn)(tif, fip->field_tag, &cp);\n\t\t  dir->tdir_count = (uint32) (strlen(cp) + 1);\n\t\t  if (!TIFFWriteByteArray(tif, dir, cp))\n\t\t\treturn (0);\n\t\t}\n\t\tbreak;\n\tcase TIFF_UNDEFINED:\n\t\t{ char* cp;\n\t\t  if (wc == (u_short) TIFF_VARIABLE) {\n\t\t\t(*getFieldFn)(tif, fip->field_tag, &wc, &cp);\n\t\t\tdir->tdir_count = wc;\n\t\t  } else \n\t\t\t(*getFieldFn)(tif, fip->field_tag, &cp);\n\t\t  if (!TIFFWriteByteArray(tif, dir, cp))\n\t\t\treturn (0);\n\t\t}\n\t\tbreak;\n\t}\n\treturn (1);\n}\n#undef WRITEF\n\n/* Everything after this is exactly duplicated from the standard tif_dirwrite.c\n   file, necessitated by the fact that they are declared static there so\n   we can't call them!\n*/\n/*\n * Setup a directory entry with either a SHORT\n * or LONG type according to the value.\n */\nstatic void\nTIFFSetupShortLong(TIFF* tif, ttag_t tag, TIFFDirEntry* dir, uint32 v)\n{\n\tdir->tdir_tag = tag;\n\tdir->tdir_count = 1;\n\tif (v > 0xffffL) {\n\t\tdir->tdir_type = (short) TIFF_LONG;\n\t\tdir->tdir_offset = v;\n\t} else {\n\t\tdir->tdir_type = (short) TIFF_SHORT;\n\t\tdir->tdir_offset = TIFFInsertData(tif, (int) TIFF_SHORT, v);\n\t}\n}\n#undef MakeShortDirent\n\n#ifndef TIFFWriteRational\n/*\n * Setup a RATIONAL directory entry and\n * write the associated indirect value.\n */\nstatic int\nTIFFWriteRational(TIFF* tif,\n    TIFFDataType type, ttag_t tag, TIFFDirEntry* dir, float v)\n{\n\treturn (TIFFWriteRationalArray(tif, type, tag, dir, 1, &v));\n}\n#endif\n\n#define\tNITEMS(x)\t(sizeof (x) / sizeof (x[0]))\n/*\n * Setup a directory entry that references a\n * samples/pixel array of SHORT values and\n * (potentially) write the associated indirect\n * values.\n */\nstatic int\nTIFFWritePerSampleShorts(TIFF* tif, ttag_t tag, TIFFDirEntry* dir)\n{\n\tuint16 buf[10], v;\n\tuint16* w = buf;\n\tint i, status, samples = tif->tif_dir.td_samplesperpixel;\n\n\tif (samples > NITEMS(buf))\n\t\tw = (uint16*) _TIFFmalloc(samples * sizeof (uint16));\n\tTIFFGetField(tif, tag, &v);\n\tfor (i = 0; i < samples; i++)\n\t\tw[i] = v;\n\tstatus = TIFFWriteShortArray(tif, TIFF_SHORT, tag, dir, samples, w);\n\tif (w != buf)\n\t\t_TIFFfree((char*) w);\n\treturn (status);\n}\n\n/*\n * Setup a directory entry that references a samples/pixel array of ``type''\n * values and (potentially) write the associated indirect values.  The source\n * data from TIFFGetField() for the specified tag must be returned as double.\n */\nstatic int\nTIFFWritePerSampleAnys(TIFF* tif,\n    TIFFDataType type, ttag_t tag, TIFFDirEntry* dir)\n{\n\tdouble buf[10], v;\n\tdouble* w = buf;\n\tint i, status;\n\tint samples = (int) tif->tif_dir.td_samplesperpixel;\n\n\tif (samples > NITEMS(buf))\n\t\tw = (double*) _TIFFmalloc(samples * sizeof (double));\n\tTIFFGetField(tif, tag, &v);\n\tfor (i = 0; i < samples; i++)\n\t\tw[i] = v;\n\tstatus = TIFFWriteAnyArray(tif, type, tag, dir, samples, w);\n\tif (w != buf)\n\t\t_TIFFfree(w);\n\treturn (status);\n}\n#undef NITEMS\n\n/*\n * Setup a pair of shorts that are returned by\n * value, rather than as a reference to an array.\n */\nstatic int\nTIFFSetupShortPair(TIFF* tif, ttag_t tag, TIFFDirEntry* dir)\n{\n\tuint16 v[2];\n\n\tTIFFGetField(tif, tag, &v[0], &v[1]);\n\treturn (TIFFWriteShortArray(tif, TIFF_SHORT, tag, dir, 2, v));\n}\n\n/*\n * Setup a directory entry for an NxM table of shorts,\n * where M is known to be 2**bitspersample, and write\n * the associated indirect data.\n */\nstatic int\nTIFFWriteShortTable(TIFF* tif,\n    ttag_t tag, TIFFDirEntry* dir, uint32 n, uint16** table)\n{\n\tuint32 i, off;\n\n\tdir->tdir_tag = tag;\n\tdir->tdir_type = (short) TIFF_SHORT;\n\t/* XXX -- yech, fool TIFFWriteData */\n\tdir->tdir_count = (uint32) (1L<<tif->tif_dir.td_bitspersample);\n\toff = tif->tif_dataoff;\n\tfor (i = 0; i < n; i++)\n\t\tif (!TIFFWriteData(tif, dir, (char *)table[i]))\n\t\t\treturn (0);\n\tdir->tdir_count *= n;\n\tdir->tdir_offset = off;\n\treturn (1);\n}\n\n/*\n * Write/copy data associated with an ASCII or opaque tag value.\n */\nstatic int\nTIFFWriteByteArray(TIFF* tif, TIFFDirEntry* dir, char* cp)\n{\n\tif (dir->tdir_count > 4) {\n\t\tif (!TIFFWriteData(tif, dir, cp))\n\t\t\treturn (0);\n\t} else\n\t\t_TIFFmemcpy(&dir->tdir_offset, cp, dir->tdir_count);\n\treturn (1);\n}\n\n/*\n * Setup a directory entry of an array of SHORT\n * or SSHORT and write the associated indirect values.\n */\nstatic int\nTIFFWriteShortArray(TIFF* tif,\n    TIFFDataType type, ttag_t tag, TIFFDirEntry* dir, uint32 n, uint16* v)\n{\n\tdir->tdir_tag = tag;\n\tdir->tdir_type = (short) type;\n\tdir->tdir_count = n;\n\tif (n <= 2) {\n\t\tif (tif->tif_header.tiff_magic == TIFF_BIGENDIAN) {\n\t\t\tdir->tdir_offset = (uint32) ((long) v[0] << 16);\n\t\t\tif (n == 2)\n\t\t\t\tdir->tdir_offset |= v[1] & 0xffff;\n\t\t} else {\n\t\t\tdir->tdir_offset = v[0] & 0xffff;\n\t\t\tif (n == 2)\n\t\t\t\tdir->tdir_offset |= (long) v[1] << 16;\n\t\t}\n\t\treturn (1);\n\t} else\n\t\treturn (TIFFWriteData(tif, dir, (char*) v));\n}\n\n/*\n * Setup a directory entry of an array of LONG\n * or SLONG and write the associated indirect values.\n */\nstatic int\nTIFFWriteLongArray(TIFF* tif,\n    TIFFDataType type, ttag_t tag, TIFFDirEntry* dir, uint32 n, uint32* v)\n{\n\tdir->tdir_tag = tag;\n\tdir->tdir_type = (short) type;\n\tdir->tdir_count = n;\n\tif (n == 1) {\n\t\tdir->tdir_offset = v[0];\n\t\treturn (1);\n\t} else\n\t\treturn (TIFFWriteData(tif, dir, (char*) v));\n}\n\n/*\n * Setup a directory entry of an array of RATIONAL\n * or SRATIONAL and write the associated indirect values.\n */\nstatic int\nTIFFWriteRationalArray(TIFF* tif,\n    TIFFDataType type, ttag_t tag, TIFFDirEntry* dir, uint32 n, float* v)\n{\n\tuint32 i;\n\tuint32* t;\n\tint status;\n\n\tdir->tdir_tag = tag;\n\tdir->tdir_type = (short) type;\n\tdir->tdir_count = n;\n\tt = (uint32*) _TIFFmalloc(2*n * sizeof (uint32));\n\tfor (i = 0; i < n; i++) {\n\t\tfloat fv = v[i];\n\t\tint sign = 1;\n\t\tuint32 den;\n\n\t\tif (fv < 0) {\n\t\t\tif (type == TIFF_RATIONAL) {\n\t\t\t\tTIFFWarning(tif->tif_name,\n\t\"\\\"%s\\\": Information lost writing value (%g) as (unsigned) RATIONAL\",\n\t\t\t\t_TIFFFieldWithTag(tif,tag)->field_name, v);\n\t\t\t\tfv = 0;\n\t\t\t} else\n\t\t\t\tfv = -fv, sign = -1;\n\t\t}\n\t\tden = 1L;\n\t\tif (fv > 0) {\n\t\t\twhile (fv < 1L<<(31-3) && den < 1L<<(31-3))\n\t\t\t\tfv *= 1<<3, den *= 1L<<3;\n\t\t}\n\t\tt[2*i+0] = sign * (fv + 0.5);\n\t\tt[2*i+1] = den;\n\t}\n\tstatus = TIFFWriteData(tif, dir, (char *)t);\n\t_TIFFfree((char*) t);\n\treturn (status);\n}\n\nstatic int\nTIFFWriteFloatArray(TIFF* tif,\n    TIFFDataType type, ttag_t tag, TIFFDirEntry* dir, uint32 n, float* v)\n{\n\tdir->tdir_tag = tag;\n\tdir->tdir_type = (short) type;\n\tdir->tdir_count = n;\n\tTIFFCvtNativeToIEEEFloat(tif, n, v);\n\tif (n == 1) {\n\t\tdir->tdir_offset = *(uint32*) &v[0];\n\t\treturn (1);\n\t} else\n\t\treturn (TIFFWriteData(tif, dir, (char*) v));\n}\n\nstatic int\nTIFFWriteDoubleArray(TIFF* tif,\n    TIFFDataType type, ttag_t tag, TIFFDirEntry* dir, uint32 n, double* v)\n{\n\tdir->tdir_tag = tag;\n\tdir->tdir_type = (short) type;\n\tdir->tdir_count = n;\n\tTIFFCvtNativeToIEEEDouble(tif, n, v);\n\treturn (TIFFWriteData(tif, dir, (char*) v));\n}\n\n/*\n * Write an array of ``type'' values for a specified tag (i.e. this is a tag\n * which is allowed to have different types, e.g. SMaxSampleType).\n * Internally the data values are represented as double since a double can\n * hold any of the TIFF tag types (yes, this should really be an abstract\n * type tany_t for portability).  The data is converted into the specified\n * type in a temporary buffer and then handed off to the appropriate array\n * writer.\n */\nstatic int\nTIFFWriteAnyArray(TIFF* tif,\n    TIFFDataType type, ttag_t tag, TIFFDirEntry* dir, uint32 n, double* v)\n{\n\tchar buf[10 * sizeof(double)];\n\tchar* w = buf;\n\tint i, status = 0;\n\n\tif (n * TIFFDataWidth(type) > sizeof buf)\n\t\tw = (char*) _TIFFmalloc(n * TIFFDataWidth(type));\n\tswitch (type) {\n\tcase TIFF_BYTE:\n\t\t{ unsigned char* bp = (unsigned char*) w;\n\t\t  for (i = 0; i < n; i++)\n\t\t\tbp[i] = (unsigned char) v[i];\n\t\t  dir->tdir_tag = tag;\n\t\t  dir->tdir_type = (short) type;\n\t\t  dir->tdir_count = n;\n\t\t  if (!TIFFWriteByteArray(tif, dir, (char*) bp))\n\t\t\tgoto out;\n\t\t}\n\t\tbreak;\n\tcase TIFF_SBYTE:\n\t\t{ signed char* bp = (signed char*) w;\n\t\t  for (i = 0; i < n; i++)\n\t\t\tbp[i] = (signed char) v[i];\n\t\t  dir->tdir_tag = tag;\n\t\t  dir->tdir_type = (short) type;\n\t\t  dir->tdir_count = n;\n\t\t  if (!TIFFWriteByteArray(tif, dir, (char*) bp))\n\t\t\tgoto out;\n\t\t}\n\t\tbreak;\n\tcase TIFF_SHORT:\n\t\t{ uint16* bp = (uint16*) w;\n\t\t  for (i = 0; i < n; i++)\n\t\t\tbp[i] = (uint16) v[i];\n\t\t  if (!TIFFWriteShortArray(tif, type, tag, dir, n, (uint16*)bp))\n\t\t\t\tgoto out;\n\t\t}\n\t\tbreak;\n\tcase TIFF_SSHORT:\n\t\t{ int16* bp = (int16*) w;\n\t\t  for (i = 0; i < n; i++)\n\t\t\tbp[i] = (int16) v[i];\n\t\t  if (!TIFFWriteShortArray(tif, type, tag, dir, n, (uint16*)bp))\n\t\t\tgoto out;\n\t\t}\n\t\tbreak;\n\tcase TIFF_LONG:\n\t\t{ uint32* bp = (uint32*) w;\n\t\t  for (i = 0; i < n; i++)\n\t\t\tbp[i] = (uint32) v[i];\n\t\t  if (!TIFFWriteLongArray(tif, type, tag, dir, n, bp))\n\t\t\tgoto out;\n\t\t}\n\t\tbreak;\n\tcase TIFF_SLONG:\n\t\t{ int32* bp = (int32*) w;\n\t\t  for (i = 0; i < n; i++)\n\t\t\tbp[i] = (int32) v[i];\n\t\t  if (!TIFFWriteLongArray(tif, type, tag, dir, n, (uint32*) bp))\n\t\t\tgoto out;\n\t\t}\n\t\tbreak;\n\tcase TIFF_FLOAT:\n\t\t{ float* bp = (float*) w;\n\t\t  for (i = 0; i < n; i++)\n\t\t\tbp[i] = (float) v[i];\n\t\t  if (!TIFFWriteFloatArray(tif, type, tag, dir, n, bp))\n\t\t\tgoto out;\n\t\t}\n\t\tbreak;\n\tcase TIFF_DOUBLE:\n\t\treturn (TIFFWriteDoubleArray(tif, type, tag, dir, n, v));\n\tdefault:\n\t\t/* TIFF_NOTYPE */\n\t\t/* TIFF_ASCII */\n\t\t/* TIFF_UNDEFINED */\n\t\t/* TIFF_RATIONAL */\n\t\t/* TIFF_SRATIONAL */\n\t\tgoto out;\n\t}\n\tstatus = 1;\n out:\n\tif (w != buf)\n\t\t_TIFFfree(w);\n\treturn (status);\n}\n\n#ifdef COLORIMETRY_SUPPORT\nstatic int\nTIFFWriteTransferFunction(TIFF* tif, TIFFDirEntry* dir)\n{\n\tTIFFDirectory* td = &tif->tif_dir;\n\ttsize_t n = (1L<<td->td_bitspersample) * sizeof (uint16);\n\tuint16** tf = td->td_transferfunction;\n\tint ncols;\n\n\t/*\n\t * Check if the table can be written as a single column,\n\t * or if it must be written as 3 columns.  Note that we\n\t * write a 3-column tag if there are 2 samples/pixel and\n\t * a single column of data won't suffice--hmm.\n\t */\n\tswitch (td->td_samplesperpixel - td->td_extrasamples) {\n\tdefault:\tif (_TIFFmemcmp(tf[0], tf[2], n)) { ncols = 3; break; }\n\tcase 2:\t\tif (_TIFFmemcmp(tf[0], tf[1], n)) { ncols = 3; break; }\n\tcase 1: case 0:\tncols = 1;\n\t}\n\treturn (TIFFWriteShortTable(tif,\n\t    TIFFTAG_TRANSFERFUNCTION, dir, ncols, tf));\n}\n#endif\n\n/*\n * Write a contiguous directory item.\n */\nstatic int\nTIFFWriteData(TIFF* tif, TIFFDirEntry* dir, char* cp)\n{\n\ttsize_t cc;\n\n\tif (tif->tif_flags & TIFF_SWAB) {\n\t\tswitch (dir->tdir_type) {\n\t\tcase TIFF_SHORT:\n\t\tcase TIFF_SSHORT:\n\t\t\tTIFFSwabArrayOfShort((uint16*) cp, dir->tdir_count);\n\t\t\tbreak;\n\t\tcase TIFF_LONG:\n\t\tcase TIFF_SLONG:\n\t\tcase TIFF_FLOAT:\n\t\t\tTIFFSwabArrayOfLong((uint32*) cp, dir->tdir_count);\n\t\t\tbreak;\n\t\tcase TIFF_RATIONAL:\n\t\tcase TIFF_SRATIONAL:\n\t\t\tTIFFSwabArrayOfLong((uint32*) cp, 2*dir->tdir_count);\n\t\t\tbreak;\n\t\tcase TIFF_DOUBLE:\n\t\t\tTIFFSwabArrayOfDouble((double*) cp, dir->tdir_count);\n\t\t\tbreak;\n\t\t}\n\t}\n\tdir->tdir_offset = tif->tif_dataoff;\n\tcc = dir->tdir_count * TIFFDataWidth(dir->tdir_type);\n\tif (SeekOK(tif, dir->tdir_offset) &&\n\t    WriteOK(tif, cp, cc)) {\n\t\ttif->tif_dataoff += (cc + 1) & ~1;\n\t\treturn (1);\n\t}\n\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name, \"Error writing data for field \\\"%s\\\"\",\n\t    _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name);\n\treturn (0);\n}\n\n/*\n * Link the current directory into the\n * directory chain for the file.\n */\nstatic int\nTIFFLinkDirectory(TIFF* tif)\n{\n\tstatic const char module[] = \"TIFFLinkDirectory\";\n\tuint32 nextdir;\n\tuint32 diroff;\n\n\ttif->tif_diroff = (TIFFSeekFile(tif, (toff_t) 0, SEEK_END)+1) &~ 1;\n\tdiroff = (uint32) tif->tif_diroff;\n\tif (tif->tif_flags & TIFF_SWAB)\n\t\tTIFFSwabLong(&diroff);\n#if SUBIFD_SUPPORT\n\tif (tif->tif_flags & TIFF_INSUBIFD) {\n\t\t(void) TIFFSeekFile(tif, tif->tif_subifdoff, SEEK_SET);\n\t\tif (!WriteOK(tif, &diroff, sizeof (diroff))) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, module,\n\t\t\t    \"%s: Error writing SubIFD directory link\",\n\t\t\t    tif->tif_name);\n\t\t\treturn (0);\n\t\t}\n\t\t/*\n\t\t * Advance to the next SubIFD or, if this is\n\t\t * the last one configured, revert back to the\n\t\t * normal directory linkage.\n\t\t */\n\t\tif (--tif->tif_nsubifd)\n\t\t\ttif->tif_subifdoff += sizeof (diroff);\n\t\telse\n\t\t\ttif->tif_flags &= ~TIFF_INSUBIFD;\n\t\treturn (1);\n\t}\n#endif\n\tif (tif->tif_header.tiff_diroff == 0) {\n\t\t/*\n\t\t * First directory, overwrite offset in header.\n\t\t */\n\t\ttif->tif_header.tiff_diroff = (uint32) tif->tif_diroff;\n#define\tHDROFF(f)\t((toff_t) &(((TIFFHeader*) 0)->f))\n\t\t(void) TIFFSeekFile(tif, HDROFF(tiff_diroff), SEEK_SET);\n\t\tif (!WriteOK(tif, &diroff, sizeof (diroff))) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name, \"Error writing TIFF header\");\n\t\t\treturn (0);\n\t\t}\n\t\treturn (1);\n\t}\n\t/*\n\t * Not the first directory, search to the last and append.\n\t */\n\tnextdir = tif->tif_header.tiff_diroff;\n\tdo {\n\t\tuint16 dircount;\n\n\t\tif (!SeekOK(tif, nextdir) ||\n\t\t    !ReadOK(tif, &dircount, sizeof (dircount))) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, module, \"Error fetching directory count\");\n\t\t\treturn (0);\n\t\t}\n\t\tif (tif->tif_flags & TIFF_SWAB)\n\t\t\tTIFFSwabShort(&dircount);\n\t\t(void) TIFFSeekFile(tif,\n\t\t    dircount * sizeof (TIFFDirEntry), SEEK_CUR);\n\t\tif (!ReadOK(tif, &nextdir, sizeof (nextdir))) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, module, \"Error fetching directory link\");\n\t\t\treturn (0);\n\t\t}\n\t\tif (tif->tif_flags & TIFF_SWAB)\n\t\t\tTIFFSwabLong(&nextdir);\n\t} while (nextdir != 0);\n\t(void) TIFFSeekFile(tif, -(toff_t) sizeof (nextdir), SEEK_CUR);\n\tif (!WriteOK(tif, &diroff, sizeof (diroff))) {\n\t\tTIFFErrorExt(tif->tif_clientdata, module, \"Error writing directory link\");\n\t\treturn (0);\n\t}\n\treturn (1);\n}\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/ras/Makefile.am",
    "content": "# Tag Image File Format (TIFF) Software\n#\n# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>\n#\n# Permission to use, copy, modify, distribute, and sell this software and \n# its documentation for any purpose is hereby granted without fee, provided\n# that (i) the above copyright notices and this permission notice appear in\n# all copies of the software and related documentation, and (ii) the names of\n# Sam Leffler and Silicon Graphics may not be used in any advertising or\n# publicity relating to the software without the specific, prior written\n# permission of Sam Leffler and Silicon Graphics.\n# \n# THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n# \n# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n# OF THIS SOFTWARE.\n\n# Process this file with automake to produce Makefile.in.\n\nEXTRA_DIST = README ras2tif.c tif2ras.c\n\nINCLUDES = -I../../libtiff -I$(top_srcdir)/libtiff\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/ras/Makefile.in",
    "content": "# Makefile.in generated by automake 1.11 from Makefile.am.\n# @configure_input@\n\n# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,\n# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,\n# Inc.\n# This Makefile.in is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY, to the extent permitted by law; without\n# even the implied warranty of MERCHANTABILITY or FITNESS FOR A\n# PARTICULAR PURPOSE.\n\n@SET_MAKE@\n\n# Tag Image File Format (TIFF) Software\n#\n# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>\n#\n# Permission to use, copy, modify, distribute, and sell this software and \n# its documentation for any purpose is hereby granted without fee, provided\n# that (i) the above copyright notices and this permission notice appear in\n# all copies of the software and related documentation, and (ii) the names of\n# Sam Leffler and Silicon Graphics may not be used in any advertising or\n# publicity relating to the software without the specific, prior written\n# permission of Sam Leffler and Silicon Graphics.\n# \n# THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n# \n# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n# OF THIS SOFTWARE.\n\n# Process this file with automake to produce Makefile.in.\nVPATH = @srcdir@\npkgdatadir = $(datadir)/@PACKAGE@\npkgincludedir = $(includedir)/@PACKAGE@\npkglibdir = $(libdir)/@PACKAGE@\npkglibexecdir = $(libexecdir)/@PACKAGE@\nam__cd = CDPATH=\"$${ZSH_VERSION+.}$(PATH_SEPARATOR)\" && cd\ninstall_sh_DATA = $(install_sh) -c -m 644\ninstall_sh_PROGRAM = $(install_sh) -c\ninstall_sh_SCRIPT = $(install_sh) -c\nINSTALL_HEADER = $(INSTALL_DATA)\ntransform = $(program_transform_name)\nNORMAL_INSTALL = :\nPRE_INSTALL = :\nPOST_INSTALL = :\nNORMAL_UNINSTALL = :\nPRE_UNINSTALL = :\nPOST_UNINSTALL = :\nbuild_triplet = @build@\nhost_triplet = @host@\ntarget_triplet = @target@\nsubdir = contrib/ras\nDIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in\nACLOCAL_M4 = $(top_srcdir)/aclocal.m4\nam__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \\\n\t$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \\\n\t$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \\\n\t$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac\nam__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \\\n\t$(ACLOCAL_M4)\nmkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs\nCONFIG_HEADER = $(top_builddir)/libtiff/tif_config.h \\\n\t$(top_builddir)/libtiff/tiffconf.h\nCONFIG_CLEAN_FILES =\nCONFIG_CLEAN_VPATH_FILES =\nAM_V_GEN = $(am__v_GEN_$(V))\nam__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))\nam__v_GEN_0 = @echo \"  GEN   \" $@;\nAM_V_at = $(am__v_at_$(V))\nam__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))\nam__v_at_0 = @\nSOURCES =\nDIST_SOURCES =\nDISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)\nACLOCAL = @ACLOCAL@\nAMTAR = @AMTAR@\nAM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@\nAR = @AR@\nAS = @AS@\nAUTOCONF = @AUTOCONF@\nAUTOHEADER = @AUTOHEADER@\nAUTOMAKE = @AUTOMAKE@\nAWK = @AWK@\nCC = @CC@\nCCDEPMODE = @CCDEPMODE@\nCFLAGS = @CFLAGS@\nCPP = @CPP@\nCPPFLAGS = @CPPFLAGS@\nCXX = @CXX@\nCXXCPP = @CXXCPP@\nCXXDEPMODE = @CXXDEPMODE@\nCXXFLAGS = @CXXFLAGS@\nCYGPATH_W = @CYGPATH_W@\nDEFS = @DEFS@\nDEPDIR = @DEPDIR@\nDLLTOOL = @DLLTOOL@\nDSYMUTIL = @DSYMUTIL@\nDUMPBIN = @DUMPBIN@\nECHO_C = @ECHO_C@\nECHO_N = @ECHO_N@\nECHO_T = @ECHO_T@\nEGREP = @EGREP@\nEXEEXT = @EXEEXT@\nFGREP = @FGREP@\nGLUT_CFLAGS = @GLUT_CFLAGS@\nGLUT_LIBS = @GLUT_LIBS@\nGLU_CFLAGS = @GLU_CFLAGS@\nGLU_LIBS = @GLU_LIBS@\nGL_CFLAGS = @GL_CFLAGS@\nGL_LIBS = @GL_LIBS@\nGREP = @GREP@\nINSTALL = @INSTALL@\nINSTALL_DATA = @INSTALL_DATA@\nINSTALL_PROGRAM = @INSTALL_PROGRAM@\nINSTALL_SCRIPT = @INSTALL_SCRIPT@\nINSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@\nLD = @LD@\nLDFLAGS = @LDFLAGS@\nLIBDIR = @LIBDIR@\nLIBOBJS = @LIBOBJS@\nLIBS = @LIBS@\nLIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@\nLIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@\nLIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@\nLIBTIFF_MICRO_VERSION = @LIBTIFF_MICRO_VERSION@\nLIBTIFF_MINOR_VERSION = @LIBTIFF_MINOR_VERSION@\nLIBTIFF_RELEASE_DATE = @LIBTIFF_RELEASE_DATE@\nLIBTIFF_VERSION = @LIBTIFF_VERSION@\nLIBTIFF_VERSION_INFO = @LIBTIFF_VERSION_INFO@\nLIBTOOL = @LIBTOOL@\nLIPO = @LIPO@\nLN_S = @LN_S@\nLTLIBOBJS = @LTLIBOBJS@\nMAINT = @MAINT@\nMAKEINFO = @MAKEINFO@\nMKDIR_P = @MKDIR_P@\nNM = @NM@\nNMEDIT = @NMEDIT@\nOBJDUMP = @OBJDUMP@\nOBJEXT = @OBJEXT@\nOTOOL = @OTOOL@\nOTOOL64 = @OTOOL64@\nPACKAGE = @PACKAGE@\nPACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@\nPACKAGE_NAME = @PACKAGE_NAME@\nPACKAGE_STRING = @PACKAGE_STRING@\nPACKAGE_TARNAME = @PACKAGE_TARNAME@\nPACKAGE_URL = @PACKAGE_URL@\nPACKAGE_VERSION = @PACKAGE_VERSION@\nPATH_SEPARATOR = @PATH_SEPARATOR@\nPTHREAD_CC = @PTHREAD_CC@\nPTHREAD_CFLAGS = @PTHREAD_CFLAGS@\nPTHREAD_LIBS = @PTHREAD_LIBS@\nRANLIB = @RANLIB@\nSED = @SED@\nSET_MAKE = @SET_MAKE@\nSHELL = @SHELL@\nSTRIP = @STRIP@\nVERSION = @VERSION@\nXMKMF = @XMKMF@\nX_CFLAGS = @X_CFLAGS@\nX_EXTRA_LIBS = @X_EXTRA_LIBS@\nX_LIBS = @X_LIBS@\nX_PRE_LIBS = @X_PRE_LIBS@\nabs_builddir = @abs_builddir@\nabs_srcdir = @abs_srcdir@\nabs_top_builddir = @abs_top_builddir@\nabs_top_srcdir = @abs_top_srcdir@\nac_ct_CC = @ac_ct_CC@\nac_ct_CXX = @ac_ct_CXX@\nac_ct_DUMPBIN = @ac_ct_DUMPBIN@\nacx_pthread_config = @acx_pthread_config@\nam__include = @am__include@\nam__leading_dot = @am__leading_dot@\nam__quote = @am__quote@\nam__tar = @am__tar@\nam__untar = @am__untar@\nbindir = @bindir@\nbuild = @build@\nbuild_alias = @build_alias@\nbuild_cpu = @build_cpu@\nbuild_os = @build_os@\nbuild_vendor = @build_vendor@\nbuilddir = @builddir@\ndatadir = @datadir@\ndatarootdir = @datarootdir@\ndocdir = @docdir@\ndvidir = @dvidir@\nexec_prefix = @exec_prefix@\nhost = @host@\nhost_alias = @host_alias@\nhost_cpu = @host_cpu@\nhost_os = @host_os@\nhost_vendor = @host_vendor@\nhtmldir = @htmldir@\nincludedir = @includedir@\ninfodir = @infodir@\ninstall_sh = @install_sh@\nlibdir = @libdir@\nlibexecdir = @libexecdir@\nlocaledir = @localedir@\nlocalstatedir = @localstatedir@\nlt_ECHO = @lt_ECHO@\nmandir = @mandir@\nmkdir_p = @mkdir_p@\noldincludedir = @oldincludedir@\npdfdir = @pdfdir@\nprefix = @prefix@\nprogram_transform_name = @program_transform_name@\npsdir = @psdir@\nsbindir = @sbindir@\nsharedstatedir = @sharedstatedir@\nsrcdir = @srcdir@\nsysconfdir = @sysconfdir@\ntarget = @target@\ntarget_alias = @target_alias@\ntarget_cpu = @target_cpu@\ntarget_os = @target_os@\ntarget_vendor = @target_vendor@\ntop_build_prefix = @top_build_prefix@\ntop_builddir = @top_builddir@\ntop_srcdir = @top_srcdir@\nEXTRA_DIST = README ras2tif.c tif2ras.c\nINCLUDES = -I../../libtiff -I$(top_srcdir)/libtiff\nall: all-am\n\n.SUFFIXES:\n$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)\n\t@for dep in $?; do \\\n\t  case '$(am__configure_deps)' in \\\n\t    *$$dep*) \\\n\t      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \\\n\t        && { if test -f $@; then exit 0; else break; fi; }; \\\n\t      exit 1;; \\\n\t  esac; \\\n\tdone; \\\n\techo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign contrib/ras/Makefile'; \\\n\t$(am__cd) $(top_srcdir) && \\\n\t  $(AUTOMAKE) --foreign contrib/ras/Makefile\n.PRECIOUS: Makefile\nMakefile: $(srcdir)/Makefile.in $(top_builddir)/config.status\n\t@case '$?' in \\\n\t  *config.status*) \\\n\t    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \\\n\t  *) \\\n\t    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \\\n\t    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \\\n\tesac;\n\n$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n\n$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n$(am__aclocal_m4_deps):\n\nmostlyclean-libtool:\n\t-rm -f *.lo\n\nclean-libtool:\n\t-rm -rf .libs _libs\ntags: TAGS\nTAGS:\n\nctags: CTAGS\nCTAGS:\n\n\ndistdir: $(DISTFILES)\n\t@srcdirstrip=`echo \"$(srcdir)\" | sed 's/[].[^$$\\\\*]/\\\\\\\\&/g'`; \\\n\ttopsrcdirstrip=`echo \"$(top_srcdir)\" | sed 's/[].[^$$\\\\*]/\\\\\\\\&/g'`; \\\n\tlist='$(DISTFILES)'; \\\n\t  dist_files=`for file in $$list; do echo $$file; done | \\\n\t  sed -e \"s|^$$srcdirstrip/||;t\" \\\n\t      -e \"s|^$$topsrcdirstrip/|$(top_builddir)/|;t\"`; \\\n\tcase $$dist_files in \\\n\t  */*) $(MKDIR_P) `echo \"$$dist_files\" | \\\n\t\t\t   sed '/\\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \\\n\t\t\t   sort -u` ;; \\\n\tesac; \\\n\tfor file in $$dist_files; do \\\n\t  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \\\n\t  if test -d $$d/$$file; then \\\n\t    dir=`echo \"/$$file\" | sed -e 's,/[^/]*$$,,'`; \\\n\t    if test -d \"$(distdir)/$$file\"; then \\\n\t      find \"$(distdir)/$$file\" -type d ! -perm -700 -exec chmod u+rwx {} \\;; \\\n\t    fi; \\\n\t    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \\\n\t      cp -fpR $(srcdir)/$$file \"$(distdir)$$dir\" || exit 1; \\\n\t      find \"$(distdir)/$$file\" -type d ! -perm -700 -exec chmod u+rwx {} \\;; \\\n\t    fi; \\\n\t    cp -fpR $$d/$$file \"$(distdir)$$dir\" || exit 1; \\\n\t  else \\\n\t    test -f \"$(distdir)/$$file\" \\\n\t    || cp -p $$d/$$file \"$(distdir)/$$file\" \\\n\t    || exit 1; \\\n\t  fi; \\\n\tdone\ncheck-am: all-am\ncheck: check-am\nall-am: Makefile\ninstalldirs:\ninstall: install-am\ninstall-exec: install-exec-am\ninstall-data: install-data-am\nuninstall: uninstall-am\n\ninstall-am: all-am\n\t@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am\n\ninstallcheck: installcheck-am\ninstall-strip:\n\t$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM=\"$(INSTALL_STRIP_PROGRAM)\" \\\n\t  install_sh_PROGRAM=\"$(INSTALL_STRIP_PROGRAM)\" INSTALL_STRIP_FLAG=-s \\\n\t  `test -z '$(STRIP)' || \\\n\t    echo \"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'\"` install\nmostlyclean-generic:\n\nclean-generic:\n\ndistclean-generic:\n\t-test -z \"$(CONFIG_CLEAN_FILES)\" || rm -f $(CONFIG_CLEAN_FILES)\n\t-test . = \"$(srcdir)\" || test -z \"$(CONFIG_CLEAN_VPATH_FILES)\" || rm -f $(CONFIG_CLEAN_VPATH_FILES)\n\nmaintainer-clean-generic:\n\t@echo \"This command is intended for maintainers to use\"\n\t@echo \"it deletes files that may require special tools to rebuild.\"\nclean: clean-am\n\nclean-am: clean-generic clean-libtool mostlyclean-am\n\ndistclean: distclean-am\n\t-rm -f Makefile\ndistclean-am: clean-am distclean-generic\n\ndvi: dvi-am\n\ndvi-am:\n\nhtml: html-am\n\nhtml-am:\n\ninfo: info-am\n\ninfo-am:\n\ninstall-data-am:\n\ninstall-dvi: install-dvi-am\n\ninstall-dvi-am:\n\ninstall-exec-am:\n\ninstall-html: install-html-am\n\ninstall-html-am:\n\ninstall-info: install-info-am\n\ninstall-info-am:\n\ninstall-man:\n\ninstall-pdf: install-pdf-am\n\ninstall-pdf-am:\n\ninstall-ps: install-ps-am\n\ninstall-ps-am:\n\ninstallcheck-am:\n\nmaintainer-clean: maintainer-clean-am\n\t-rm -f Makefile\nmaintainer-clean-am: distclean-am maintainer-clean-generic\n\nmostlyclean: mostlyclean-am\n\nmostlyclean-am: mostlyclean-generic mostlyclean-libtool\n\npdf: pdf-am\n\npdf-am:\n\nps: ps-am\n\nps-am:\n\nuninstall-am:\n\n.MAKE: install-am install-strip\n\n.PHONY: all all-am check check-am clean clean-generic clean-libtool \\\n\tdistclean distclean-generic distclean-libtool distdir dvi \\\n\tdvi-am html html-am info info-am install install-am \\\n\tinstall-data install-data-am install-dvi install-dvi-am \\\n\tinstall-exec install-exec-am install-html install-html-am \\\n\tinstall-info install-info-am install-man install-pdf \\\n\tinstall-pdf-am install-ps install-ps-am install-strip \\\n\tinstallcheck installcheck-am installdirs maintainer-clean \\\n\tmaintainer-clean-generic mostlyclean mostlyclean-generic \\\n\tmostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am\n\n\n# Tell versions [3.59,3.63) of GNU make to not export all variables.\n# Otherwise a system limit (for SysV at least) may be exceeded.\n.NOEXPORT:\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/ras/README",
    "content": "Sun May 19 22:28:16 PDT 1991\n\nThese programs are from Patrick Naughton (naughton@wind.sun.com).\nI've tried to update them to reflect changes to the library, but\nI am unable to verify that they operate properly, because they\nrequire the Sun pixrect library.\n\nPlease contact Patrick directly if you have questions/problems.\n\n\tSam\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/ras/ras2tif.c",
    "content": "#ifndef lint\nstatic char sccsid[] = \"@(#)ras2tif.c 1.2 90/03/06\";\n#endif\n/*-\n * ras2tif.c - Converts from a Sun Rasterfile to a Tagged Image File.\n *\n * Copyright (c) 1990 by Sun Microsystems, Inc.\n *\n * Author: Patrick J. Naughton\n * naughton@wind.sun.com\n *\n * Permission to use, copy, modify, and distribute this software and its\n * documentation for any purpose and without fee is hereby granted,\n * provided that the above copyright notice appear in all copies and that\n * both that copyright notice and this permission notice appear in\n * supporting documentation.\n *\n * This file is provided AS IS with no warranties of any kind.  The author\n * shall have no liability with respect to the infringement of copyrights,\n * trade secrets or any patents by this file or any part thereof.  In no\n * event will the author be liable for any lost revenue or profits or\n * other special, indirect and consequential damages.\n *\n * Comments and additions should be sent to the author:\n *\n *                     Patrick J. Naughton\n *                     Sun Microsystems\n *                     2550 Garcia Ave, MS 14-40\n *                     Mountain View, CA 94043\n *                     (415) 336-1080\n *\n * Revision History:\n * 11-Jan-89: Created.\n * 06-Mar-90: fix bug in SCALE() macro.\n *\t      got rid of xres and yres, (they weren't working anyways).\n *\t      fixed bpsl calculation.\n * 25-Nov-99: y2k fix (year as 1900 + tm_year) <mike@onshore.com>\n *\n * Description:\n *   This program takes a Sun Rasterfile [see rasterfile(5)] as input and\n * writes a MicroSoft/Aldus \"Tagged Image File Format\" image or \"TIFF\" file.\n * The input file may be standard input, but the output TIFF file must be a\n * real file since seek(2) is used.\n */\n\n#include <stdio.h>\n#include <sys/time.h>\n#include <pixrect/pixrect_hs.h>\n#include \"tiffio.h\"\n\ntypedef int boolean;\n#define True (1)\n#define False (0)\n#define\tSCALE(x)\t(((x)*((1L<<16)-1))/255)\n\nboolean     Verbose = False;\nboolean     dummyinput = False;\nchar       *pname;\t\t/* program name (used for error messages) */\n\nvoid\nerror(s1, s2)\n    char       *s1,\n               *s2;\n{\n    fprintf(stderr, s1, pname, s2);\n    exit(1);\n}\n\nvoid\nusage()\n{\n    error(\"usage: %s -[vq] [-|rasterfile] TIFFfile\\n\", NULL);\n}\n\n\nmain(argc, argv)\n    int         argc;\n    char       *argv[];\n{\n    char       *inf = NULL;\n    char       *outf = NULL;\n    FILE       *fp;\n    int         depth,\n                i;\n    long        row;\n    TIFF       *tif;\n    Pixrect    *pix;\t\t/* The Sun Pixrect */\n    colormap_t  Colormap;\t/* The Pixrect Colormap */\n    u_short     red[256],\n                green[256],\n                blue[256];\n    struct tm  *ct;\n    struct timeval tv;\n    long        width,\n                height;\n    long        rowsperstrip;\n    int         year; \n    short       photometric;\n    short       samplesperpixel;\n    short       bitspersample;\n    int         bpsl;\n    static char *version = \"ras2tif 1.0\";\n    static char *datetime = \"1990:01:01 12:00:00\";\n\n    gettimeofday(&tv, (struct timezone *) NULL);\n    ct = localtime(&tv.tv_sec);\n    year=1900 + ct->tm_year; \n    sprintf(datetime, \"%04d:%02d:%02d %02d:%02d:%02d\",\n\t    year, ct->tm_mon + 1, ct->tm_mday,\n\t    ct->tm_hour, ct->tm_min, ct->tm_sec);\n\n    setbuf(stderr, NULL);\n    pname = argv[0];\n\n    while (--argc) {\n\tif ((++argv)[0][0] == '-') {\n\t    switch (argv[0][1]) {\n\t    case 'v':\n\t\tVerbose = True;\n\t\tbreak;\n\t    case 'q':\n\t\tusage();\n\t\tbreak;\n\t    case '\\0':\n\t\tif (inf == NULL)\n\t\t    dummyinput = True;\n\t\telse\n\t\t    usage();\n\t\tbreak;\n\t    default:\n\t\tfprintf(stderr, \"%s: illegal option -%c.\\n\", pname,\n\t\t\targv[0][1]);\n\t\texit(1);\n\t    }\n\t} else if (inf == NULL && !dummyinput) {\n\t    inf = argv[0];\n\t} else if (outf == NULL)\n\t    outf = argv[0];\n\telse\n\t    usage();\n    }\n\n    if (outf == NULL)\n\terror(\"%s: can't write output file to a stream.\\n\", NULL);\n\n    if (dummyinput || inf == NULL) {\n\tinf = \"Standard Input\";\n\tfp = stdin;\n    } else if ((fp = fopen(inf, \"r\")) == NULL)\n\terror(\"%s: %s couldn't be opened.\\n\", inf);\n\n    if (Verbose)\n\tfprintf(stderr, \"Reading rasterfile from %s...\", inf);\n\n    pix = pr_load(fp, &Colormap);\n    if (pix == NULL)\n\terror(\"%s: %s is not a raster file.\\n\", inf);\n\n    if (Verbose)\n\tfprintf(stderr, \"done.\\n\");\n\n    if (Verbose)\n\tfprintf(stderr, \"Writing %s...\", outf);\n\n    tif = TIFFOpen(outf, \"w\");\n\n    if (tif == NULL)\n\terror(\"%s: error opening TIFF file %s\", outf);\n\n    width = pix->pr_width;\n    height = pix->pr_height;\n    depth = pix->pr_depth;\n\n    switch (depth) {\n    case 1:\n\tsamplesperpixel = 1;\n\tbitspersample = 1;\n\tphotometric = PHOTOMETRIC_MINISBLACK;\n\tbreak;\n    case 8:\n\tsamplesperpixel = 1;\n\tbitspersample = 8;\n\tphotometric = PHOTOMETRIC_PALETTE;\n\tbreak;\n    case 24:\n\tsamplesperpixel = 3;\n\tbitspersample = 8;\n\tphotometric = PHOTOMETRIC_RGB;\n\tbreak;\n    case 32:\n\tsamplesperpixel = 4;\n\tbitspersample = 8;\n\tphotometric = PHOTOMETRIC_RGB;\n\tbreak;\n    default:\n\terror(\"%s: bogus depth: %d\\n\", depth);\n    }\n\n    bpsl = ((depth * width + 15) >> 3) & ~1;\n    rowsperstrip = (8 * 1024) / bpsl;\n\n    TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, width);\n    TIFFSetField(tif, TIFFTAG_IMAGELENGTH, height);\n    TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, bitspersample);\n    TIFFSetField(tif, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);\n    TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_LZW);\n    TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, photometric);\n    TIFFSetField(tif, TIFFTAG_DOCUMENTNAME, inf);\n    TIFFSetField(tif, TIFFTAG_IMAGEDESCRIPTION, \"converted Sun rasterfile\");\n    TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, samplesperpixel);\n    TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, rowsperstrip);\n    TIFFSetField(tif, TIFFTAG_STRIPBYTECOUNTS, height / rowsperstrip);\n    TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);\n    TIFFSetField(tif, TIFFTAG_SOFTWARE, version);\n    TIFFSetField(tif, TIFFTAG_DATETIME, datetime);\n\n    memset(red, 0, sizeof(red));\n    memset(green, 0, sizeof(green));\n    memset(blue, 0, sizeof(blue));\n    if (depth == 8) {\n\tTIFFSetField(tif, TIFFTAG_COLORMAP, red, green, blue);\n\tfor (i = 0; i < Colormap.length; i++) {\n\t    red[i] = SCALE(Colormap.map[0][i]);\n\t    green[i] = SCALE(Colormap.map[1][i]);\n\t    blue[i] = SCALE(Colormap.map[2][i]);\n\t}\n    }\n    if (Verbose)\n\tfprintf(stderr, \"%dx%dx%d image, \", width, height, depth);\n\n    for (row = 0; row < height; row++)\n\tif (TIFFWriteScanline(tif,\n\t\t\t      (u_char *) mprd_addr(mpr_d(pix), 0, row),\n\t\t\t      row, 0) < 0) {\n\t    fprintf(\"failed a scanline write (%d)\\n\", row);\n\t    break;\n\t}\n    TIFFFlushData(tif);\n    TIFFClose(tif);\n\n    if (Verbose)\n\tfprintf(stderr, \"done.\\n\");\n\n    pr_destroy(pix);\n\n    exit(0);\n}\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/ras/tif2ras.c",
    "content": "#ifndef lint\nstatic char id[] = \"$Id: tif2ras.c,v 1.2 1999/11/28 20:15:36 mwelles Exp $\"; \n#endif\n/*-\n * tif2ras.c - Converts from a Tagged Image File Format image to a Sun Raster.\n *\n * Copyright (c) 1990 by Sun Microsystems, Inc.\n *\n * Author: Patrick J. Naughton\n * naughton@wind.sun.com\n *\n * Permission to use, copy, modify, and distribute this software and its\n * documentation for any purpose and without fee is hereby granted,\n * provided that the above copyright notice appear in all copies and that\n * both that copyright notice and this permission notice appear in\n * supporting documentation.\n *\n * This file is provided AS IS with no warranties of any kind.  The author\n * shall have no liability with respect to the infringement of copyrights,\n * trade secrets or any patents by this file or any part thereof.  In no\n * event will the author be liable for any lost revenue or profits or\n * other special, indirect and consequential damages.\n *\n * Comments and additions should be sent to the author:\n *\n *                     Patrick J. Naughton\n *                     Sun Microsystems\n *                     2550 Garcia Ave, MS 14-40\n *                     Mountain View, CA 94043\n *                     (415) 336-1080\n *\n * Revision History:\n * 10-Jan-89: Created.\n * 06-Mar-90: Change to byte encoded rasterfiles.\n *\t      fix bug in call to ReadScanline().\n *\t      fix bug in CVT() macro.\n *\t      fix assignment of td, (missing &).\n *\n * Description:\n *   This program takes a MicroSoft/Aldus \"Tagged Image File Format\" image or\n * \"TIFF\" file as input and writes a Sun Rasterfile [see rasterfile(5)].  The\n * output file may be standard output, but the input TIFF file must be a real\n * file since seek(2) is used.\n */\n\n#include <stdio.h>\n#include <pixrect/pixrect_hs.h>\n#include \"tiffio.h\"\n\ntypedef int boolean;\n#define True (1)\n#define False (0)\n#define\tCVT(x)\t\t(((x) * 255) / ((1L<<16)-1))\n\nboolean     Verbose = False;\nchar       *pname;\t\t/* program name (used for error messages) */\n\nvoid\nerror(s1, s2)\n    char       *s1,\n               *s2;\n{\n    fprintf(stderr, s1, pname, s2);\n    exit(1);\n}\n\nvoid\nusage()\n{\n    error(\"usage: %s -[vq] TIFFfile [rasterfile]\\n\", NULL);\n}\n\n\nmain(argc, argv)\n    int         argc;\n    char       *argv[];\n{\n    char       *inf = NULL;\n    char       *outf = NULL;\n    FILE       *fp;\n    long        width,\n                height;\n    int         depth,\n                numcolors;\n    register TIFF *tif;\n    TIFFDirectory *td;\n    register u_char *inp,\n               *outp;\n    register int col,\n                i;\n    register long row;\n    u_char     *Map = NULL;\n    u_char     *buf;\n    short\tbitspersample;\n    short\tsamplesperpixel;\n    short\tphotometric;\n    u_short    *redcolormap,\n\t       *bluecolormap,\n\t       *greencolormap;\n\n    Pixrect    *pix;\t\t/* The Sun Pixrect */\n    colormap_t  Colormap;\t/* The Pixrect Colormap */\n    u_char      red[256],\n                green[256],\n                blue[256];\n\n    setbuf(stderr, NULL);\n    pname = argv[0];\n\n    while (--argc) {\n\tif ((++argv)[0][0] == '-')\n\t    switch (argv[0][1]) {\n\t    case 'v':\n\t\tVerbose = True;\n\t\tbreak;\n\t    case 'q':\n\t\tusage();\n\t\tbreak;\n\t    default:\n\t\tfprintf(stderr, \"%s: illegal option -%c.\\n\", pname,\n\t\t\targv[0][1]);\n\t\texit(1);\n\t    }\n\telse if (inf == NULL)\n\t    inf = argv[0];\n\telse if (outf == NULL)\n\t    outf = argv[0];\n\telse\n\t    usage();\n\n    }\n\n    if (inf == NULL)\n\terror(\"%s: can't read input file from a stream.\\n\", NULL);\n\n    if (Verbose)\n\tfprintf(stderr, \"Reading %s...\", inf);\n\n    tif = TIFFOpen(inf, \"r\");\n\n    if (tif == NULL)\n\terror(\"%s: error opening TIFF file %s\", inf);\n\n    if (Verbose)\n\tTIFFPrintDirectory(tif, stderr, True, False, False);\n    TIFFGetField(tif, TIFFTAG_BITSPERSAMPLE, &bitspersample);\n    if (bitspersample > 8)\n\terror(\"%s: can't handle more than 8-bits per sample\\n\", NULL);\n\n    TIFFGetField(tif, TIFFTAG_SAMPLESPERPIXEL, &samplesperpixel);\n    switch (samplesperpixel) {\n    case 1:\n\tif (bitspersample == 1)\n\t    depth = 1;\n\telse\n\t    depth = 8;\n\tbreak;\n    case 3:\n    case 4:\n\tdepth = 24;\n\tbreak;\n    default:\n\terror(\"%s: only handle 1-channel gray scale or 3-channel color\\n\");\n    }\n\n    TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &width);\n    TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &height);\n\n    if (Verbose)\n\tfprintf(stderr, \"%dx%dx%d image, \", width, height, depth);\n    if (Verbose)\n\tfprintf(stderr, \"%d bits/sample, %d samples/pixel, \",\n\t\tbitspersample, samplesperpixel);\n\n    pix = mem_create(width, height, depth);\n    if (pix == (Pixrect *) NULL)\n\terror(\"%s: can't allocate memory for output pixrect...\\n\", NULL);\n\n    numcolors = (1 << bitspersample);\n\n    TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &photometric);\n    if (numcolors == 2) {\n\tif (Verbose)\n\t    fprintf(stderr, \"monochrome \");\n\tColormap.type = RMT_NONE;\n\tColormap.length = 0;\n\tColormap.map[0] = Colormap.map[1] = Colormap.map[2] = NULL;\n    } else {\n\tswitch (photometric) {\n\tcase PHOTOMETRIC_MINISBLACK:\n\t    if (Verbose)\n\t\tfprintf(stderr, \"%d graylevels (min=black), \", numcolors);\n\t    Map = (u_char *) malloc(numcolors * sizeof(u_char));\n\t    for (i = 0; i < numcolors; i++)\n\t\tMap[i] = (255 * i) / numcolors;\n\t    Colormap.type = RMT_EQUAL_RGB;\n\t    Colormap.length = numcolors;\n\t    Colormap.map[0] = Colormap.map[1] = Colormap.map[2] = Map;\n\t    break;\n\tcase PHOTOMETRIC_MINISWHITE:\n\t    if (Verbose)\n\t\tfprintf(stderr, \"%d graylevels (min=white), \", numcolors);\n\t    Map = (u_char *) malloc(numcolors * sizeof(u_char));\n\t    for (i = 0; i < numcolors; i++)\n\t\tMap[i] = 255 - ((255 * i) / numcolors);\n\t    Colormap.type = RMT_EQUAL_RGB;\n\t    Colormap.length = numcolors;\n\t    Colormap.map[0] = Colormap.map[1] = Colormap.map[2] = Map;\n\t    break;\n\tcase PHOTOMETRIC_RGB:\n\t    if (Verbose)\n\t\tfprintf(stderr, \"truecolor \");\n\t    Colormap.type = RMT_NONE;\n\t    Colormap.length = 0;\n\t    Colormap.map[0] = Colormap.map[1] = Colormap.map[2] = NULL;\n\t    break;\n\tcase PHOTOMETRIC_PALETTE:\n\t    if (Verbose)\n\t\tfprintf(stderr, \"colormapped \");\n\t    Colormap.type = RMT_EQUAL_RGB;\n\t    Colormap.length = numcolors;\n\t    memset(red, 0, sizeof(red));\n\t    memset(green, 0, sizeof(green));\n\t    memset(blue, 0, sizeof(blue));\n\t    TIFFGetField(tif, TIFFTAG_COLORMAP,\n\t\t&redcolormap, &greencolormap, &bluecolormap);\n\t    for (i = 0; i < numcolors; i++) {\n\t\tred[i] = (u_char) CVT(redcolormap[i]);\n\t\tgreen[i] = (u_char) CVT(greencolormap[i]);\n\t\tblue[i] = (u_char) CVT(bluecolormap[i]);\n\t    }\n\t    Colormap.map[0] = red;\n\t    Colormap.map[1] = green;\n\t    Colormap.map[2] = blue;\n\t    break;\n\tcase PHOTOMETRIC_MASK:\n\t    error(\"%s: Don't know how to handle PHOTOMETRIC_MASK\\n\");\n\t    break;\n\tcase PHOTOMETRIC_DEPTH:\n\t    error(\"%s: Don't know how to handle PHOTOMETRIC_DEPTH\\n\");\n\t    break;\n\tdefault:\n\t    error(\"%s: unknown photometric (cmap): %d\\n\", photometric);\n\t}\n    }\n\n    buf = (u_char *) malloc(TIFFScanlineSize(tif));\n    if (buf == NULL)\n\terror(\"%s: can't allocate memory for scanline buffer...\\n\", NULL);\n\n    for (row = 0; row < height; row++) {\n\tif (TIFFReadScanline(tif, buf, row, 0) < 0)\n\t    error(\"%s: bad data read on line: %d\\n\", row);\n\tinp = buf;\n\toutp = (u_char *) mprd_addr(mpr_d(pix), 0, row);\n\tswitch (photometric) {\n\tcase PHOTOMETRIC_RGB:\n\t    if (samplesperpixel == 4)\n\t\tfor (col = 0; col < width; col++) {\n\t\t    *outp++ = *inp++;\t/* Blue */\n\t\t    *outp++ = *inp++;\t/* Green */\n\t\t    *outp++ = *inp++;\t/* Red */\n\t\t    inp++;\t/* skip alpha channel */\n\t\t}\n\t    else\n\t\tfor (col = 0; col < width; col++) {\n\t\t    *outp++ = *inp++;\t/* Blue */\n\t\t    *outp++ = *inp++;\t/* Green */\n\t\t    *outp++ = *inp++;\t/* Red */\n\t\t}\n\t    break;\n\tcase PHOTOMETRIC_MINISWHITE:\n\tcase PHOTOMETRIC_MINISBLACK:\n\t    switch (bitspersample) {\n\t    case 1:\n\t\tfor (col = 0; col < ((width + 7) / 8); col++)\n\t\t    *outp++ = *inp++;\n\t\tbreak;\n\t    case 2:\n\t\tfor (col = 0; col < ((width + 3) / 4); col++) {\n\t\t    *outp++ = (*inp >> 6) & 3;\n\t\t    *outp++ = (*inp >> 4) & 3;\n\t\t    *outp++ = (*inp >> 2) & 3;\n\t\t    *outp++ = *inp++ & 3;\n\t\t}\n\t\tbreak;\n\t    case 4:\n\t\tfor (col = 0; col < width / 2; col++) {\n\t\t    *outp++ = *inp >> 4;\n\t\t    *outp++ = *inp++ & 0xf;\n\t\t}\n\t\tbreak;\n\t    case 8:\n\t\tfor (col = 0; col < width; col++)\n\t\t    *outp++ = *inp++;\n\t\tbreak;\n\t    default:\n\t\terror(\"%s: bad bits/sample: %d\\n\", bitspersample);\n\t    }\n\t    break;\n\tcase PHOTOMETRIC_PALETTE:\n\t    memcpy(outp, inp, width);\n\t    break;\n\tdefault:\n\t    error(\"%s: unknown photometric (write): %d\\n\", photometric);\n\t}\n    }\n\n    free((char *) buf);\n\n    if (Verbose)\n\tfprintf(stderr, \"done.\\n\");\n\n    if (outf == NULL || strcmp(outf, \"Standard Output\") == 0) {\n\toutf = \"Standard Output\";\n\tfp = stdout;\n    } else {\n\tif (!(fp = fopen(outf, \"w\")))\n\t    error(\"%s: %s couldn't be opened for writing.\\n\", outf);\n    }\n\n    if (Verbose)\n\tfprintf(stderr, \"Writing rasterfile in %s...\", outf);\n\n    if (pr_dump(pix, fp, &Colormap, RT_BYTE_ENCODED, 0) == PIX_ERR)\n\terror(\"%s: error writing Sun Rasterfile: %s\\n\", outf);\n\n    if (Verbose)\n\tfprintf(stderr, \"done.\\n\");\n\n    pr_destroy(pix);\n\n    if (fp != stdout)\n\tfclose(fp);\n\n    exit(0);\n}\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/stream/Makefile.am",
    "content": "# Tag Image File Format (TIFF) Software\n#\n# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>\n#\n# Permission to use, copy, modify, distribute, and sell this software and \n# its documentation for any purpose is hereby granted without fee, provided\n# that (i) the above copyright notices and this permission notice appear in\n# all copies of the software and related documentation, and (ii) the names of\n# Sam Leffler and Silicon Graphics may not be used in any advertising or\n# publicity relating to the software without the specific, prior written\n# permission of Sam Leffler and Silicon Graphics.\n# \n# THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n# \n# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n# OF THIS SOFTWARE.\n\n# Process this file with automake to produce Makefile.in.\n\nEXTRA_DIST = README tiffstream.cpp tiffstream.h\n\nINCLUDES = -I../../libtiff -I$(top_srcdir)/libtiff\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/stream/Makefile.in",
    "content": "# Makefile.in generated by automake 1.11 from Makefile.am.\n# @configure_input@\n\n# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,\n# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,\n# Inc.\n# This Makefile.in is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY, to the extent permitted by law; without\n# even the implied warranty of MERCHANTABILITY or FITNESS FOR A\n# PARTICULAR PURPOSE.\n\n@SET_MAKE@\n\n# Tag Image File Format (TIFF) Software\n#\n# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>\n#\n# Permission to use, copy, modify, distribute, and sell this software and \n# its documentation for any purpose is hereby granted without fee, provided\n# that (i) the above copyright notices and this permission notice appear in\n# all copies of the software and related documentation, and (ii) the names of\n# Sam Leffler and Silicon Graphics may not be used in any advertising or\n# publicity relating to the software without the specific, prior written\n# permission of Sam Leffler and Silicon Graphics.\n# \n# THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n# \n# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n# OF THIS SOFTWARE.\n\n# Process this file with automake to produce Makefile.in.\nVPATH = @srcdir@\npkgdatadir = $(datadir)/@PACKAGE@\npkgincludedir = $(includedir)/@PACKAGE@\npkglibdir = $(libdir)/@PACKAGE@\npkglibexecdir = $(libexecdir)/@PACKAGE@\nam__cd = CDPATH=\"$${ZSH_VERSION+.}$(PATH_SEPARATOR)\" && cd\ninstall_sh_DATA = $(install_sh) -c -m 644\ninstall_sh_PROGRAM = $(install_sh) -c\ninstall_sh_SCRIPT = $(install_sh) -c\nINSTALL_HEADER = $(INSTALL_DATA)\ntransform = $(program_transform_name)\nNORMAL_INSTALL = :\nPRE_INSTALL = :\nPOST_INSTALL = :\nNORMAL_UNINSTALL = :\nPRE_UNINSTALL = :\nPOST_UNINSTALL = :\nbuild_triplet = @build@\nhost_triplet = @host@\ntarget_triplet = @target@\nsubdir = contrib/stream\nDIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in\nACLOCAL_M4 = $(top_srcdir)/aclocal.m4\nam__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \\\n\t$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \\\n\t$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \\\n\t$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac\nam__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \\\n\t$(ACLOCAL_M4)\nmkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs\nCONFIG_HEADER = $(top_builddir)/libtiff/tif_config.h \\\n\t$(top_builddir)/libtiff/tiffconf.h\nCONFIG_CLEAN_FILES =\nCONFIG_CLEAN_VPATH_FILES =\nAM_V_GEN = $(am__v_GEN_$(V))\nam__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))\nam__v_GEN_0 = @echo \"  GEN   \" $@;\nAM_V_at = $(am__v_at_$(V))\nam__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))\nam__v_at_0 = @\nSOURCES =\nDIST_SOURCES =\nDISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)\nACLOCAL = @ACLOCAL@\nAMTAR = @AMTAR@\nAM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@\nAR = @AR@\nAS = @AS@\nAUTOCONF = @AUTOCONF@\nAUTOHEADER = @AUTOHEADER@\nAUTOMAKE = @AUTOMAKE@\nAWK = @AWK@\nCC = @CC@\nCCDEPMODE = @CCDEPMODE@\nCFLAGS = @CFLAGS@\nCPP = @CPP@\nCPPFLAGS = @CPPFLAGS@\nCXX = @CXX@\nCXXCPP = @CXXCPP@\nCXXDEPMODE = @CXXDEPMODE@\nCXXFLAGS = @CXXFLAGS@\nCYGPATH_W = @CYGPATH_W@\nDEFS = @DEFS@\nDEPDIR = @DEPDIR@\nDLLTOOL = @DLLTOOL@\nDSYMUTIL = @DSYMUTIL@\nDUMPBIN = @DUMPBIN@\nECHO_C = @ECHO_C@\nECHO_N = @ECHO_N@\nECHO_T = @ECHO_T@\nEGREP = @EGREP@\nEXEEXT = @EXEEXT@\nFGREP = @FGREP@\nGLUT_CFLAGS = @GLUT_CFLAGS@\nGLUT_LIBS = @GLUT_LIBS@\nGLU_CFLAGS = @GLU_CFLAGS@\nGLU_LIBS = @GLU_LIBS@\nGL_CFLAGS = @GL_CFLAGS@\nGL_LIBS = @GL_LIBS@\nGREP = @GREP@\nINSTALL = @INSTALL@\nINSTALL_DATA = @INSTALL_DATA@\nINSTALL_PROGRAM = @INSTALL_PROGRAM@\nINSTALL_SCRIPT = @INSTALL_SCRIPT@\nINSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@\nLD = @LD@\nLDFLAGS = @LDFLAGS@\nLIBDIR = @LIBDIR@\nLIBOBJS = @LIBOBJS@\nLIBS = @LIBS@\nLIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@\nLIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@\nLIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@\nLIBTIFF_MICRO_VERSION = @LIBTIFF_MICRO_VERSION@\nLIBTIFF_MINOR_VERSION = @LIBTIFF_MINOR_VERSION@\nLIBTIFF_RELEASE_DATE = @LIBTIFF_RELEASE_DATE@\nLIBTIFF_VERSION = @LIBTIFF_VERSION@\nLIBTIFF_VERSION_INFO = @LIBTIFF_VERSION_INFO@\nLIBTOOL = @LIBTOOL@\nLIPO = @LIPO@\nLN_S = @LN_S@\nLTLIBOBJS = @LTLIBOBJS@\nMAINT = @MAINT@\nMAKEINFO = @MAKEINFO@\nMKDIR_P = @MKDIR_P@\nNM = @NM@\nNMEDIT = @NMEDIT@\nOBJDUMP = @OBJDUMP@\nOBJEXT = @OBJEXT@\nOTOOL = @OTOOL@\nOTOOL64 = @OTOOL64@\nPACKAGE = @PACKAGE@\nPACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@\nPACKAGE_NAME = @PACKAGE_NAME@\nPACKAGE_STRING = @PACKAGE_STRING@\nPACKAGE_TARNAME = @PACKAGE_TARNAME@\nPACKAGE_URL = @PACKAGE_URL@\nPACKAGE_VERSION = @PACKAGE_VERSION@\nPATH_SEPARATOR = @PATH_SEPARATOR@\nPTHREAD_CC = @PTHREAD_CC@\nPTHREAD_CFLAGS = @PTHREAD_CFLAGS@\nPTHREAD_LIBS = @PTHREAD_LIBS@\nRANLIB = @RANLIB@\nSED = @SED@\nSET_MAKE = @SET_MAKE@\nSHELL = @SHELL@\nSTRIP = @STRIP@\nVERSION = @VERSION@\nXMKMF = @XMKMF@\nX_CFLAGS = @X_CFLAGS@\nX_EXTRA_LIBS = @X_EXTRA_LIBS@\nX_LIBS = @X_LIBS@\nX_PRE_LIBS = @X_PRE_LIBS@\nabs_builddir = @abs_builddir@\nabs_srcdir = @abs_srcdir@\nabs_top_builddir = @abs_top_builddir@\nabs_top_srcdir = @abs_top_srcdir@\nac_ct_CC = @ac_ct_CC@\nac_ct_CXX = @ac_ct_CXX@\nac_ct_DUMPBIN = @ac_ct_DUMPBIN@\nacx_pthread_config = @acx_pthread_config@\nam__include = @am__include@\nam__leading_dot = @am__leading_dot@\nam__quote = @am__quote@\nam__tar = @am__tar@\nam__untar = @am__untar@\nbindir = @bindir@\nbuild = @build@\nbuild_alias = @build_alias@\nbuild_cpu = @build_cpu@\nbuild_os = @build_os@\nbuild_vendor = @build_vendor@\nbuilddir = @builddir@\ndatadir = @datadir@\ndatarootdir = @datarootdir@\ndocdir = @docdir@\ndvidir = @dvidir@\nexec_prefix = @exec_prefix@\nhost = @host@\nhost_alias = @host_alias@\nhost_cpu = @host_cpu@\nhost_os = @host_os@\nhost_vendor = @host_vendor@\nhtmldir = @htmldir@\nincludedir = @includedir@\ninfodir = @infodir@\ninstall_sh = @install_sh@\nlibdir = @libdir@\nlibexecdir = @libexecdir@\nlocaledir = @localedir@\nlocalstatedir = @localstatedir@\nlt_ECHO = @lt_ECHO@\nmandir = @mandir@\nmkdir_p = @mkdir_p@\noldincludedir = @oldincludedir@\npdfdir = @pdfdir@\nprefix = @prefix@\nprogram_transform_name = @program_transform_name@\npsdir = @psdir@\nsbindir = @sbindir@\nsharedstatedir = @sharedstatedir@\nsrcdir = @srcdir@\nsysconfdir = @sysconfdir@\ntarget = @target@\ntarget_alias = @target_alias@\ntarget_cpu = @target_cpu@\ntarget_os = @target_os@\ntarget_vendor = @target_vendor@\ntop_build_prefix = @top_build_prefix@\ntop_builddir = @top_builddir@\ntop_srcdir = @top_srcdir@\nEXTRA_DIST = README tiffstream.cpp tiffstream.h\nINCLUDES = -I../../libtiff -I$(top_srcdir)/libtiff\nall: all-am\n\n.SUFFIXES:\n$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)\n\t@for dep in $?; do \\\n\t  case '$(am__configure_deps)' in \\\n\t    *$$dep*) \\\n\t      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \\\n\t        && { if test -f $@; then exit 0; else break; fi; }; \\\n\t      exit 1;; \\\n\t  esac; \\\n\tdone; \\\n\techo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign contrib/stream/Makefile'; \\\n\t$(am__cd) $(top_srcdir) && \\\n\t  $(AUTOMAKE) --foreign contrib/stream/Makefile\n.PRECIOUS: Makefile\nMakefile: $(srcdir)/Makefile.in $(top_builddir)/config.status\n\t@case '$?' in \\\n\t  *config.status*) \\\n\t    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \\\n\t  *) \\\n\t    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \\\n\t    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \\\n\tesac;\n\n$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n\n$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n$(am__aclocal_m4_deps):\n\nmostlyclean-libtool:\n\t-rm -f *.lo\n\nclean-libtool:\n\t-rm -rf .libs _libs\ntags: TAGS\nTAGS:\n\nctags: CTAGS\nCTAGS:\n\n\ndistdir: $(DISTFILES)\n\t@srcdirstrip=`echo \"$(srcdir)\" | sed 's/[].[^$$\\\\*]/\\\\\\\\&/g'`; \\\n\ttopsrcdirstrip=`echo \"$(top_srcdir)\" | sed 's/[].[^$$\\\\*]/\\\\\\\\&/g'`; \\\n\tlist='$(DISTFILES)'; \\\n\t  dist_files=`for file in $$list; do echo $$file; done | \\\n\t  sed -e \"s|^$$srcdirstrip/||;t\" \\\n\t      -e \"s|^$$topsrcdirstrip/|$(top_builddir)/|;t\"`; \\\n\tcase $$dist_files in \\\n\t  */*) $(MKDIR_P) `echo \"$$dist_files\" | \\\n\t\t\t   sed '/\\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \\\n\t\t\t   sort -u` ;; \\\n\tesac; \\\n\tfor file in $$dist_files; do \\\n\t  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \\\n\t  if test -d $$d/$$file; then \\\n\t    dir=`echo \"/$$file\" | sed -e 's,/[^/]*$$,,'`; \\\n\t    if test -d \"$(distdir)/$$file\"; then \\\n\t      find \"$(distdir)/$$file\" -type d ! -perm -700 -exec chmod u+rwx {} \\;; \\\n\t    fi; \\\n\t    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \\\n\t      cp -fpR $(srcdir)/$$file \"$(distdir)$$dir\" || exit 1; \\\n\t      find \"$(distdir)/$$file\" -type d ! -perm -700 -exec chmod u+rwx {} \\;; \\\n\t    fi; \\\n\t    cp -fpR $$d/$$file \"$(distdir)$$dir\" || exit 1; \\\n\t  else \\\n\t    test -f \"$(distdir)/$$file\" \\\n\t    || cp -p $$d/$$file \"$(distdir)/$$file\" \\\n\t    || exit 1; \\\n\t  fi; \\\n\tdone\ncheck-am: all-am\ncheck: check-am\nall-am: Makefile\ninstalldirs:\ninstall: install-am\ninstall-exec: install-exec-am\ninstall-data: install-data-am\nuninstall: uninstall-am\n\ninstall-am: all-am\n\t@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am\n\ninstallcheck: installcheck-am\ninstall-strip:\n\t$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM=\"$(INSTALL_STRIP_PROGRAM)\" \\\n\t  install_sh_PROGRAM=\"$(INSTALL_STRIP_PROGRAM)\" INSTALL_STRIP_FLAG=-s \\\n\t  `test -z '$(STRIP)' || \\\n\t    echo \"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'\"` install\nmostlyclean-generic:\n\nclean-generic:\n\ndistclean-generic:\n\t-test -z \"$(CONFIG_CLEAN_FILES)\" || rm -f $(CONFIG_CLEAN_FILES)\n\t-test . = \"$(srcdir)\" || test -z \"$(CONFIG_CLEAN_VPATH_FILES)\" || rm -f $(CONFIG_CLEAN_VPATH_FILES)\n\nmaintainer-clean-generic:\n\t@echo \"This command is intended for maintainers to use\"\n\t@echo \"it deletes files that may require special tools to rebuild.\"\nclean: clean-am\n\nclean-am: clean-generic clean-libtool mostlyclean-am\n\ndistclean: distclean-am\n\t-rm -f Makefile\ndistclean-am: clean-am distclean-generic\n\ndvi: dvi-am\n\ndvi-am:\n\nhtml: html-am\n\nhtml-am:\n\ninfo: info-am\n\ninfo-am:\n\ninstall-data-am:\n\ninstall-dvi: install-dvi-am\n\ninstall-dvi-am:\n\ninstall-exec-am:\n\ninstall-html: install-html-am\n\ninstall-html-am:\n\ninstall-info: install-info-am\n\ninstall-info-am:\n\ninstall-man:\n\ninstall-pdf: install-pdf-am\n\ninstall-pdf-am:\n\ninstall-ps: install-ps-am\n\ninstall-ps-am:\n\ninstallcheck-am:\n\nmaintainer-clean: maintainer-clean-am\n\t-rm -f Makefile\nmaintainer-clean-am: distclean-am maintainer-clean-generic\n\nmostlyclean: mostlyclean-am\n\nmostlyclean-am: mostlyclean-generic mostlyclean-libtool\n\npdf: pdf-am\n\npdf-am:\n\nps: ps-am\n\nps-am:\n\nuninstall-am:\n\n.MAKE: install-am install-strip\n\n.PHONY: all all-am check check-am clean clean-generic clean-libtool \\\n\tdistclean distclean-generic distclean-libtool distdir dvi \\\n\tdvi-am html html-am info info-am install install-am \\\n\tinstall-data install-data-am install-dvi install-dvi-am \\\n\tinstall-exec install-exec-am install-html install-html-am \\\n\tinstall-info install-info-am install-man install-pdf \\\n\tinstall-pdf-am install-ps install-ps-am install-strip \\\n\tinstallcheck installcheck-am installdirs maintainer-clean \\\n\tmaintainer-clean-generic mostlyclean mostlyclean-generic \\\n\tmostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am\n\n\n# Tell versions [3.59,3.63) of GNU make to not export all variables.\n# Otherwise a system limit (for SysV at least) may be exceeded.\n.NOEXPORT:\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/stream/README",
    "content": "Subject: tiff stream interface (contrib)\nDate: Thu, 30 Mar 2000 10:48:51 -0800\nFrom: \"Avi Bleiweiss\" <avi@shutterfly.com>\nTo: <warmerda@home.com>, <mike@onshore.com>\n\nHere at Shutterfly we have augmented the file based tiff library to support\nC++ streams. The implementation is an adaptor class, which takes any C++\nstream from the user and in return it deposits i/o operation method pointers\n(e.g. read, write, seek and close) into the tiff's library client state.\n\nThe class TiffStream has an overloaded factory method - makeFileStream -\nwhich takes the C++ stream as an argument, calls TIFFClientOpen and returns\na tiff handle. The class retains the tiff handle in its local state and\nprovides a helper function (getTiffHandle) to query the handle at any time.\nAdditional helper method - getStreamSize - provides the stream size to the\nuser. The implementation assumes client responsibility to delete the stream\nobject. The class calls TIFFClose at destruction time.\n\nAttached are a definition (tiffstream.h) and an implementation\n(tiffstream.cpp) files of the TiffStream class. No changes are required to\nthe tiff core piece and the class sits on top of the library. The code is\nfairly tested at this point and is used internally in Shutterfly imaging\nsoftware. The code is portable across WindowsNT/Linux/Solaris.\n\nWe at Shutterfly believe this software has benefits to the larger community\nof tiff library users and would like to contribute this software to be part\nof the tiff distributed package. Let me know of any issue.\n\nThanks\nAvi\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/stream/tiffstream.cpp",
    "content": "// tiff stream interface class implementation\n\n#include \"tiffstream.h\"\n\nconst char* TiffStream::m_name = \"TiffStream\";\n\nTiffStream::TiffStream()\n{\n    m_tif = NULL;\n\n\n    m_inStream = NULL;\n\tm_outStream = NULL;\n\tm_ioStream = NULL;\n\n\tm_streamLength = 0;\n\n\tm_this = reinterpret_cast<thandle_t>(this);\n};\n\nTiffStream::~TiffStream()\n{\n    if(m_tif != NULL) TIFFClose(m_tif);\n}\n\nTIFF*\nTiffStream::makeFileStream(istream* str)\n{\n    m_inStream = str;\n\tm_outStream = NULL;\n\tm_ioStream = NULL;\n    m_streamLength = getSize(m_this);\n\n    m_tif =  TIFFClientOpen(m_name, \n                           \"r\",\n\t\t\t\t\t\t   m_this,\n\t\t\t\t\t\t   read,\n\t\t\t\t\t\t   write,\n\t\t\t\t\t\t   seek,\n\t\t\t\t\t\t   close,\n\t\t\t\t\t\t   size,\n\t\t\t\t\t\t   map,\n\t\t\t\t\t\t   unmap);\n    return m_tif;\n}\n\nTIFF*\nTiffStream::makeFileStream(ostream* str)\n{\n\tm_inStream = NULL;\n    m_outStream = str;\n\tm_ioStream = NULL;\n\tm_streamLength = getSize(m_this);\n\n\tm_tif =  TIFFClientOpen(m_name, \n                           \"w\",\n\t\t\t\t\t\t   m_this,\n\t\t\t\t\t\t   read,\n\t\t\t\t\t\t   write,\n\t\t\t\t\t\t   seek,\n\t\t\t\t\t\t   close,\n\t\t\t\t\t\t   size,\n\t\t\t\t\t\t   map,\n\t\t\t\t\t\t   unmap);\n    return m_tif;\n}\n\nTIFF*\nTiffStream::makeFileStream(iostream* str)\n{\n\tm_inStream = NULL;\n\tm_outStream = NULL;\n    m_ioStream = str;\n\tm_streamLength = getSize(m_this);\n\n    m_tif =  TIFFClientOpen(m_name, \n\t                       \"r+w\",\n\t\t\t\t\t\t   m_this,\n\t\t\t\t\t\t   read,\n\t\t\t\t\t\t   write,\n\t\t\t\t\t\t   seek,\n\t\t\t\t\t\t   close,\n\t\t\t\t\t\t   size,\n\t\t\t\t\t\t   map,\n\t\t\t\t\t\t   unmap);\n    return m_tif;\n}\n\ntsize_t\nTiffStream::read(thandle_t fd, tdata_t buf, tsize_t size)\n{\n\tistream* istr;\n\tTiffStream* ts = reinterpret_cast<TiffStream*>(fd);\n    if(ts->m_inStream != NULL) {\n\t    istr = ts->m_inStream;\n\t} else if(ts->m_ioStream != NULL) {\n\t    istr = ts->m_ioStream;\n\t}\n\n\tint remain = ts->m_streamLength - ts->tell(fd);\n\tint actual = remain < size ? remain : size;\n\tistr->read(reinterpret_cast<char*>(buf), actual);\n    return istr->gcount();\n}\n\ntsize_t\nTiffStream::write(thandle_t fd, tdata_t buf, tsize_t size)\n{\n\tTiffStream* ts = reinterpret_cast<TiffStream*>(fd);\n\tostream* ostr;\n\tif(ts->m_outStream != NULL) {\n\t    ostr = ts->m_outStream;\n\t} else if(ts->m_ioStream != NULL) {\n\t    ostr = ts->m_ioStream;\n\t}\n\n\tstreampos start = ostr->tellp();\n\tostr->write(reinterpret_cast<const char*>(buf), size);\n\treturn ostr->tellp() - start;\n}\n\ntoff_t\nTiffStream::seek(thandle_t fd, toff_t offset, int origin)\n{\n    TiffStream* ts = reinterpret_cast<TiffStream*>(fd);\n    if(ts->seekInt(fd, offset, origin) == true) return offset;\n\telse return -1;\n}\n\nint\nTiffStream::close(thandle_t fd)\n{\n    TiffStream* ts = reinterpret_cast<TiffStream*>(fd);\n\tif(ts->m_inStream != NULL) {\n\t\tts->m_inStream = NULL;\n\t\treturn 0;\n\t} else if(ts->m_outStream != NULL) {\n\t\tts->m_outStream = NULL;\n\t\treturn 0;\n\t} else if(ts->m_ioStream != NULL) {\n\t\tts->m_ioStream = NULL;\n\t\treturn 0;\n\t}\n    return -1;\n}\n\ntoff_t\nTiffStream::size(thandle_t fd)\n{\n    TiffStream* ts = reinterpret_cast<TiffStream*>(fd);\n    return ts->getSize(fd);\n}\n\nint \nTiffStream::map(thandle_t fd, tdata_t* phase, toff_t* psize)\n{\n    return 0;\n}\n\nvoid\nTiffStream::unmap(thandle_t fd, tdata_t base, tsize_t size)\n{\n}\n\nunsigned int\nTiffStream::getSize(thandle_t fd)\n{\n\tif(!isOpen(fd)) return 0;\n\n    unsigned int pos = tell(fd);\n\tseekInt(fd, 0, end);\n\tunsigned int size = tell(fd);\n\tseekInt(fd, pos, beg);\n\n\treturn size;\n}\n\nunsigned int\nTiffStream::tell(thandle_t fd)\n{\n    TiffStream* ts = reinterpret_cast<TiffStream*>(fd);\n    if(ts->m_inStream != NULL) {\n\t    return ts->m_inStream->tellg();\n\t} else if(ts->m_outStream != NULL) {\n\t    return ts->m_outStream->tellp();\n\t} else if(ts->m_ioStream != NULL) {\n\t\treturn ts->m_ioStream->tellg();\n\t}\n\treturn 0;\n}\n\nbool\nTiffStream::seekInt(thandle_t fd, unsigned int offset, int origin)\n{\n\tif(!isOpen(fd)) return false;\n\n\tios::seek_dir org;\n\tswitch(origin) {\n\tcase beg: \n\t\torg = ios::beg;\n\t\tbreak;\n\tcase cur: \n\t\torg = ios::cur;\n\t\tbreak;\n\tcase end: \n\t\torg = ios::end;\n\t\tbreak;\n\t}\n\n\tTiffStream* ts = reinterpret_cast<TiffStream*>(fd);\n    if(ts->m_inStream != NULL) {\n\t    ts->m_inStream->seekg(offset, org);\n\t\treturn true;\n\t} else if(ts->m_outStream != NULL) {\n\t    ts->m_outStream->seekp(offset, org);\n\t\treturn true;\n\t} else if(ts->m_ioStream != NULL) {\n\t    ts->m_ioStream->seekg(offset, org);\n\t\tts->m_ioStream->seekp(offset, org);\n\t\treturn true;\n\t}\n    return false;\n}\n\nbool\nTiffStream::isOpen(thandle_t fd)\n{\n\tTiffStream* ts = reinterpret_cast<TiffStream*>(fd);\n\treturn (ts->m_inStream != NULL ||\n\t\t   ts->m_outStream != NULL ||\n\t\t   ts->m_ioStream != NULL);\n}"
  },
  {
    "path": "src/main/jni/tiff/contrib/stream/tiffstream.h",
    "content": "// tiff stream interface class definition\n\n#ifndef _TIFF_STREAM_H_\n#define _TIFF_STREAM_H_\n\n#include <iostream.h>\n\n#include \"tiffio.h\"\n\nclass TiffStream {\n\npublic:\n    // ctor/dtor\n    TiffStream();\n\t~TiffStream();\n\npublic:\n    enum SeekDir {\n\t    beg,\n\t\tcur,\n\t\tend,\n    };\n\npublic:\n    // factory methods\n    TIFF* makeFileStream(iostream* str);\n\tTIFF* makeFileStream(istream* str);\n\tTIFF* makeFileStream(ostream* str);\n\npublic:\n    // tiff client methods\n\tstatic tsize_t read(thandle_t fd, tdata_t buf, tsize_t size);\n\tstatic tsize_t write(thandle_t fd, tdata_t buf, tsize_t size);\n\tstatic toff_t seek(thandle_t fd, toff_t offset, int origin);\n\tstatic toff_t size(thandle_t fd);\n\tstatic int close(thandle_t fd);\n\tstatic int map(thandle_t fd, tdata_t* phase, toff_t* psize);\n\tstatic void unmap(thandle_t fd, tdata_t base, tsize_t size);\n\npublic:\n    // query method\n\tTIFF* getTiffHandle() const { return m_tif; }\n\tunsigned int getStreamLength() { return m_streamLength; }\n\nprivate:\n\t// internal methods\n    unsigned int getSize(thandle_t fd);\n\tunsigned int tell(thandle_t fd);\n\tbool seekInt(thandle_t fd, unsigned int offset, int origin);\n\tbool isOpen(thandle_t fd);\n\nprivate:\n\tthandle_t m_this;\n\tTIFF* m_tif;\n\tstatic const char* m_name;\n\tistream* m_inStream;\n\tostream* m_outStream;\n\tiostream* m_ioStream;\n\tint m_streamLength;\n\t\n};\n\n#endif // _TIFF_STREAM_H_"
  },
  {
    "path": "src/main/jni/tiff/contrib/tags/Makefile.am",
    "content": "# Tag Image File Format (TIFF) Software\n#\n# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>\n#\n# Permission to use, copy, modify, distribute, and sell this software and \n# its documentation for any purpose is hereby granted without fee, provided\n# that (i) the above copyright notices and this permission notice appear in\n# all copies of the software and related documentation, and (ii) the names of\n# Sam Leffler and Silicon Graphics may not be used in any advertising or\n# publicity relating to the software without the specific, prior written\n# permission of Sam Leffler and Silicon Graphics.\n# \n# THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n# \n# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n# OF THIS SOFTWARE.\n\n# Process this file with automake to produce Makefile.in.\n\nEXTRA_DIST = README listtif.c maketif.c xtif_dir.c xtiffio.h xtiffiop.h\n\nINCLUDES = -I../../libtiff -I$(top_srcdir)/libtiff\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/tags/Makefile.in",
    "content": "# Makefile.in generated by automake 1.11 from Makefile.am.\n# @configure_input@\n\n# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,\n# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,\n# Inc.\n# This Makefile.in is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY, to the extent permitted by law; without\n# even the implied warranty of MERCHANTABILITY or FITNESS FOR A\n# PARTICULAR PURPOSE.\n\n@SET_MAKE@\n\n# Tag Image File Format (TIFF) Software\n#\n# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>\n#\n# Permission to use, copy, modify, distribute, and sell this software and \n# its documentation for any purpose is hereby granted without fee, provided\n# that (i) the above copyright notices and this permission notice appear in\n# all copies of the software and related documentation, and (ii) the names of\n# Sam Leffler and Silicon Graphics may not be used in any advertising or\n# publicity relating to the software without the specific, prior written\n# permission of Sam Leffler and Silicon Graphics.\n# \n# THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n# \n# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n# OF THIS SOFTWARE.\n\n# Process this file with automake to produce Makefile.in.\nVPATH = @srcdir@\npkgdatadir = $(datadir)/@PACKAGE@\npkgincludedir = $(includedir)/@PACKAGE@\npkglibdir = $(libdir)/@PACKAGE@\npkglibexecdir = $(libexecdir)/@PACKAGE@\nam__cd = CDPATH=\"$${ZSH_VERSION+.}$(PATH_SEPARATOR)\" && cd\ninstall_sh_DATA = $(install_sh) -c -m 644\ninstall_sh_PROGRAM = $(install_sh) -c\ninstall_sh_SCRIPT = $(install_sh) -c\nINSTALL_HEADER = $(INSTALL_DATA)\ntransform = $(program_transform_name)\nNORMAL_INSTALL = :\nPRE_INSTALL = :\nPOST_INSTALL = :\nNORMAL_UNINSTALL = :\nPRE_UNINSTALL = :\nPOST_UNINSTALL = :\nbuild_triplet = @build@\nhost_triplet = @host@\ntarget_triplet = @target@\nsubdir = contrib/tags\nDIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in\nACLOCAL_M4 = $(top_srcdir)/aclocal.m4\nam__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \\\n\t$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \\\n\t$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \\\n\t$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac\nam__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \\\n\t$(ACLOCAL_M4)\nmkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs\nCONFIG_HEADER = $(top_builddir)/libtiff/tif_config.h \\\n\t$(top_builddir)/libtiff/tiffconf.h\nCONFIG_CLEAN_FILES =\nCONFIG_CLEAN_VPATH_FILES =\nAM_V_GEN = $(am__v_GEN_$(V))\nam__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))\nam__v_GEN_0 = @echo \"  GEN   \" $@;\nAM_V_at = $(am__v_at_$(V))\nam__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))\nam__v_at_0 = @\nSOURCES =\nDIST_SOURCES =\nDISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)\nACLOCAL = @ACLOCAL@\nAMTAR = @AMTAR@\nAM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@\nAR = @AR@\nAS = @AS@\nAUTOCONF = @AUTOCONF@\nAUTOHEADER = @AUTOHEADER@\nAUTOMAKE = @AUTOMAKE@\nAWK = @AWK@\nCC = @CC@\nCCDEPMODE = @CCDEPMODE@\nCFLAGS = @CFLAGS@\nCPP = @CPP@\nCPPFLAGS = @CPPFLAGS@\nCXX = @CXX@\nCXXCPP = @CXXCPP@\nCXXDEPMODE = @CXXDEPMODE@\nCXXFLAGS = @CXXFLAGS@\nCYGPATH_W = @CYGPATH_W@\nDEFS = @DEFS@\nDEPDIR = @DEPDIR@\nDLLTOOL = @DLLTOOL@\nDSYMUTIL = @DSYMUTIL@\nDUMPBIN = @DUMPBIN@\nECHO_C = @ECHO_C@\nECHO_N = @ECHO_N@\nECHO_T = @ECHO_T@\nEGREP = @EGREP@\nEXEEXT = @EXEEXT@\nFGREP = @FGREP@\nGLUT_CFLAGS = @GLUT_CFLAGS@\nGLUT_LIBS = @GLUT_LIBS@\nGLU_CFLAGS = @GLU_CFLAGS@\nGLU_LIBS = @GLU_LIBS@\nGL_CFLAGS = @GL_CFLAGS@\nGL_LIBS = @GL_LIBS@\nGREP = @GREP@\nINSTALL = @INSTALL@\nINSTALL_DATA = @INSTALL_DATA@\nINSTALL_PROGRAM = @INSTALL_PROGRAM@\nINSTALL_SCRIPT = @INSTALL_SCRIPT@\nINSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@\nLD = @LD@\nLDFLAGS = @LDFLAGS@\nLIBDIR = @LIBDIR@\nLIBOBJS = @LIBOBJS@\nLIBS = @LIBS@\nLIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@\nLIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@\nLIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@\nLIBTIFF_MICRO_VERSION = @LIBTIFF_MICRO_VERSION@\nLIBTIFF_MINOR_VERSION = @LIBTIFF_MINOR_VERSION@\nLIBTIFF_RELEASE_DATE = @LIBTIFF_RELEASE_DATE@\nLIBTIFF_VERSION = @LIBTIFF_VERSION@\nLIBTIFF_VERSION_INFO = @LIBTIFF_VERSION_INFO@\nLIBTOOL = @LIBTOOL@\nLIPO = @LIPO@\nLN_S = @LN_S@\nLTLIBOBJS = @LTLIBOBJS@\nMAINT = @MAINT@\nMAKEINFO = @MAKEINFO@\nMKDIR_P = @MKDIR_P@\nNM = @NM@\nNMEDIT = @NMEDIT@\nOBJDUMP = @OBJDUMP@\nOBJEXT = @OBJEXT@\nOTOOL = @OTOOL@\nOTOOL64 = @OTOOL64@\nPACKAGE = @PACKAGE@\nPACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@\nPACKAGE_NAME = @PACKAGE_NAME@\nPACKAGE_STRING = @PACKAGE_STRING@\nPACKAGE_TARNAME = @PACKAGE_TARNAME@\nPACKAGE_URL = @PACKAGE_URL@\nPACKAGE_VERSION = @PACKAGE_VERSION@\nPATH_SEPARATOR = @PATH_SEPARATOR@\nPTHREAD_CC = @PTHREAD_CC@\nPTHREAD_CFLAGS = @PTHREAD_CFLAGS@\nPTHREAD_LIBS = @PTHREAD_LIBS@\nRANLIB = @RANLIB@\nSED = @SED@\nSET_MAKE = @SET_MAKE@\nSHELL = @SHELL@\nSTRIP = @STRIP@\nVERSION = @VERSION@\nXMKMF = @XMKMF@\nX_CFLAGS = @X_CFLAGS@\nX_EXTRA_LIBS = @X_EXTRA_LIBS@\nX_LIBS = @X_LIBS@\nX_PRE_LIBS = @X_PRE_LIBS@\nabs_builddir = @abs_builddir@\nabs_srcdir = @abs_srcdir@\nabs_top_builddir = @abs_top_builddir@\nabs_top_srcdir = @abs_top_srcdir@\nac_ct_CC = @ac_ct_CC@\nac_ct_CXX = @ac_ct_CXX@\nac_ct_DUMPBIN = @ac_ct_DUMPBIN@\nacx_pthread_config = @acx_pthread_config@\nam__include = @am__include@\nam__leading_dot = @am__leading_dot@\nam__quote = @am__quote@\nam__tar = @am__tar@\nam__untar = @am__untar@\nbindir = @bindir@\nbuild = @build@\nbuild_alias = @build_alias@\nbuild_cpu = @build_cpu@\nbuild_os = @build_os@\nbuild_vendor = @build_vendor@\nbuilddir = @builddir@\ndatadir = @datadir@\ndatarootdir = @datarootdir@\ndocdir = @docdir@\ndvidir = @dvidir@\nexec_prefix = @exec_prefix@\nhost = @host@\nhost_alias = @host_alias@\nhost_cpu = @host_cpu@\nhost_os = @host_os@\nhost_vendor = @host_vendor@\nhtmldir = @htmldir@\nincludedir = @includedir@\ninfodir = @infodir@\ninstall_sh = @install_sh@\nlibdir = @libdir@\nlibexecdir = @libexecdir@\nlocaledir = @localedir@\nlocalstatedir = @localstatedir@\nlt_ECHO = @lt_ECHO@\nmandir = @mandir@\nmkdir_p = @mkdir_p@\noldincludedir = @oldincludedir@\npdfdir = @pdfdir@\nprefix = @prefix@\nprogram_transform_name = @program_transform_name@\npsdir = @psdir@\nsbindir = @sbindir@\nsharedstatedir = @sharedstatedir@\nsrcdir = @srcdir@\nsysconfdir = @sysconfdir@\ntarget = @target@\ntarget_alias = @target_alias@\ntarget_cpu = @target_cpu@\ntarget_os = @target_os@\ntarget_vendor = @target_vendor@\ntop_build_prefix = @top_build_prefix@\ntop_builddir = @top_builddir@\ntop_srcdir = @top_srcdir@\nEXTRA_DIST = README listtif.c maketif.c xtif_dir.c xtiffio.h xtiffiop.h\nINCLUDES = -I../../libtiff -I$(top_srcdir)/libtiff\nall: all-am\n\n.SUFFIXES:\n$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)\n\t@for dep in $?; do \\\n\t  case '$(am__configure_deps)' in \\\n\t    *$$dep*) \\\n\t      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \\\n\t        && { if test -f $@; then exit 0; else break; fi; }; \\\n\t      exit 1;; \\\n\t  esac; \\\n\tdone; \\\n\techo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign contrib/tags/Makefile'; \\\n\t$(am__cd) $(top_srcdir) && \\\n\t  $(AUTOMAKE) --foreign contrib/tags/Makefile\n.PRECIOUS: Makefile\nMakefile: $(srcdir)/Makefile.in $(top_builddir)/config.status\n\t@case '$?' in \\\n\t  *config.status*) \\\n\t    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \\\n\t  *) \\\n\t    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \\\n\t    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \\\n\tesac;\n\n$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n\n$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n$(am__aclocal_m4_deps):\n\nmostlyclean-libtool:\n\t-rm -f *.lo\n\nclean-libtool:\n\t-rm -rf .libs _libs\ntags: TAGS\nTAGS:\n\nctags: CTAGS\nCTAGS:\n\n\ndistdir: $(DISTFILES)\n\t@srcdirstrip=`echo \"$(srcdir)\" | sed 's/[].[^$$\\\\*]/\\\\\\\\&/g'`; \\\n\ttopsrcdirstrip=`echo \"$(top_srcdir)\" | sed 's/[].[^$$\\\\*]/\\\\\\\\&/g'`; \\\n\tlist='$(DISTFILES)'; \\\n\t  dist_files=`for file in $$list; do echo $$file; done | \\\n\t  sed -e \"s|^$$srcdirstrip/||;t\" \\\n\t      -e \"s|^$$topsrcdirstrip/|$(top_builddir)/|;t\"`; \\\n\tcase $$dist_files in \\\n\t  */*) $(MKDIR_P) `echo \"$$dist_files\" | \\\n\t\t\t   sed '/\\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \\\n\t\t\t   sort -u` ;; \\\n\tesac; \\\n\tfor file in $$dist_files; do \\\n\t  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \\\n\t  if test -d $$d/$$file; then \\\n\t    dir=`echo \"/$$file\" | sed -e 's,/[^/]*$$,,'`; \\\n\t    if test -d \"$(distdir)/$$file\"; then \\\n\t      find \"$(distdir)/$$file\" -type d ! -perm -700 -exec chmod u+rwx {} \\;; \\\n\t    fi; \\\n\t    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \\\n\t      cp -fpR $(srcdir)/$$file \"$(distdir)$$dir\" || exit 1; \\\n\t      find \"$(distdir)/$$file\" -type d ! -perm -700 -exec chmod u+rwx {} \\;; \\\n\t    fi; \\\n\t    cp -fpR $$d/$$file \"$(distdir)$$dir\" || exit 1; \\\n\t  else \\\n\t    test -f \"$(distdir)/$$file\" \\\n\t    || cp -p $$d/$$file \"$(distdir)/$$file\" \\\n\t    || exit 1; \\\n\t  fi; \\\n\tdone\ncheck-am: all-am\ncheck: check-am\nall-am: Makefile\ninstalldirs:\ninstall: install-am\ninstall-exec: install-exec-am\ninstall-data: install-data-am\nuninstall: uninstall-am\n\ninstall-am: all-am\n\t@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am\n\ninstallcheck: installcheck-am\ninstall-strip:\n\t$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM=\"$(INSTALL_STRIP_PROGRAM)\" \\\n\t  install_sh_PROGRAM=\"$(INSTALL_STRIP_PROGRAM)\" INSTALL_STRIP_FLAG=-s \\\n\t  `test -z '$(STRIP)' || \\\n\t    echo \"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'\"` install\nmostlyclean-generic:\n\nclean-generic:\n\ndistclean-generic:\n\t-test -z \"$(CONFIG_CLEAN_FILES)\" || rm -f $(CONFIG_CLEAN_FILES)\n\t-test . = \"$(srcdir)\" || test -z \"$(CONFIG_CLEAN_VPATH_FILES)\" || rm -f $(CONFIG_CLEAN_VPATH_FILES)\n\nmaintainer-clean-generic:\n\t@echo \"This command is intended for maintainers to use\"\n\t@echo \"it deletes files that may require special tools to rebuild.\"\nclean: clean-am\n\nclean-am: clean-generic clean-libtool mostlyclean-am\n\ndistclean: distclean-am\n\t-rm -f Makefile\ndistclean-am: clean-am distclean-generic\n\ndvi: dvi-am\n\ndvi-am:\n\nhtml: html-am\n\nhtml-am:\n\ninfo: info-am\n\ninfo-am:\n\ninstall-data-am:\n\ninstall-dvi: install-dvi-am\n\ninstall-dvi-am:\n\ninstall-exec-am:\n\ninstall-html: install-html-am\n\ninstall-html-am:\n\ninstall-info: install-info-am\n\ninstall-info-am:\n\ninstall-man:\n\ninstall-pdf: install-pdf-am\n\ninstall-pdf-am:\n\ninstall-ps: install-ps-am\n\ninstall-ps-am:\n\ninstallcheck-am:\n\nmaintainer-clean: maintainer-clean-am\n\t-rm -f Makefile\nmaintainer-clean-am: distclean-am maintainer-clean-generic\n\nmostlyclean: mostlyclean-am\n\nmostlyclean-am: mostlyclean-generic mostlyclean-libtool\n\npdf: pdf-am\n\npdf-am:\n\nps: ps-am\n\nps-am:\n\nuninstall-am:\n\n.MAKE: install-am install-strip\n\n.PHONY: all all-am check check-am clean clean-generic clean-libtool \\\n\tdistclean distclean-generic distclean-libtool distdir dvi \\\n\tdvi-am html html-am info info-am install install-am \\\n\tinstall-data install-data-am install-dvi install-dvi-am \\\n\tinstall-exec install-exec-am install-html install-html-am \\\n\tinstall-info install-info-am install-man install-pdf \\\n\tinstall-pdf-am install-ps install-ps-am install-strip \\\n\tinstallcheck installcheck-am installdirs maintainer-clean \\\n\tmaintainer-clean-generic mostlyclean mostlyclean-generic \\\n\tmostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am\n\n\n# Tell versions [3.59,3.63) of GNU make to not export all variables.\n# Otherwise a system limit (for SysV at least) may be exceeded.\n.NOEXPORT:\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/tags/README",
    "content": "\nNOTE:  Sept/2004 \n\nThe following described approach to managing tag extensions has been\nmostly superceeded since libtiff 3.6.0.  The described approach requires\ninternal knowledge of the libtiff API and tends to be very fragile \nin the face of libtiff upgrades.  \n\nPlease read over the html/addingtags.html in preference to the below\ndescribed approach.\n\n\n\n==================================\n\nClient module for adding to LIBTIFF tagset\n-------------------------------------------\n  Author: Niles Ritter\n\n\n  \n\nIn the past, users of the \"libtiff\" package had to modify the\nsource code of the library if they required additional private tags\nor codes not recognized by libtiff. Thus, whenever\na new revision of libtiff came out the client would have to\nperform modifications to six or seven different files to re-install\ntheir tags.\n\nThe latest versions of libtiff now provide client software new routines, \ngiving them the opportunity to install private extensions at runtime,\nrather than compile-time. This means that the client may encapsulate\nall of their private tags into a separate module, which need only\nbe recompiled when new versions of libtiff are released; no manual\nediting of files is required.\n\nHow it works\n------------\n\nThe mechanism for overriding the tag access has been enabled with\na single new routine, which has the following calling sequence:\n\n  TIFFExtendProc old_extender;\n  \n  old_extender = TIFFSetTagExtender(tag_extender);\n\nwhich must be called prior to opening or creating TIFF files.\n\nThis routine sets a static pointer to the user-specified function\n<tag_extender>, which in turn is called by TIFFDefaultDirectory(),\njust after the usual TIFFSetField() and TIFFGetField() methods\nare defined, and just before the compression tag is set. It also\nreturns a pointer to the previously-defined value of the tag-extender,\nso that multiple clients may be installed.\n\nThe TIFFExtendProc method that you define should be used to override\nthe TIFF file's \"vsetfield\" and \"vgetfield\" methods, so that you\ncan trap your new, private tags, and install their values into\na private directory structure. For your convienience, a new pointer\nhas also been added to the \"TIFF\" file structure:\n\n\ttidata_t\ttif_clientdir;\t/* client TIFF directory */\n\ninto which you may install whatever private directory structures you like.\nYou should also override the tag-printing method from within your\n\"vsetfield\" method, to permit the symbolic printing of your new tags.\n\n\nExample Client Code:\n--------------------\n\nAn example module has been provided as a template for installing\nyour own tags into a client tag extender. The module is called\n\"xtif_dir.c\", and defines all of the interface routines, tag field\naccess, tag printing, etc. for most purpose. \n\nTo see how the client module operates, there are three \"fake\"\ntags currently installed. If you use the existing makefile you can\nbuild them with:\n\n     make all -f Makefile.gcc  !or Makefile.mpw\n     maketif\n     listtif\n  \nThis will build two example programs called \"maketif\" and \"listtif\" \nand then run them. These programs do nothing more than create a small\nfile called \"newtif.tif\", install the fake tags, and then list them out\nusing TIFFPrintDirectory().\n\nInstalling Private Tags\n-----------------------\n\nTo use this module for installing your own tags, edit each of the files\n\n    xtif_dir.c\n    xtiffio.h\n    xtiffiop.h\n    \nand search for the string \"XXX\". At these locations the comments\nwill direct you how to install your own tag values, define their\ntypes, etc. Three examples tags are currently installed, demonstrating\nhow to implement multi-valued tags, single-valued tags, and ASCII tags.\nThe examples are not valid, registered tags, so you must replace them with\nyour own.\n\nTo test the routines, also edit the test programs \"maketif.c\" and\n\"listtif.c\" and replace the portions of the code that set the\nprivate tag values and list them.\n\nOnce you have edited these files, you may build the client module\nwith the Makefile provided, and run the test programs.\n\nTo use these files in your own code, the \"xtif_dir.c\" module defines\nreplacement routines for the standard \"TIFFOpen()\" \"TIFFFdOpen\",\nand \"TIFFClose()\" routines, called XTIFFOpen, XTIFFFdOpen and XTIFFClose.\nYou must use these routines in order to have the extended tag handlers\ninstalled. Once installed, the standard TIFFGetField() and TIFFSetField\nroutines may be used as before.\n\nAdding Extended Tags to \"tools\"\n-------------------------------\nTo create an extended-tag savvy \"tiffinfo\" program or other utility, you may\nsimply recompile and link the tools to your \"libxtiff\" library, adding \n\n   -DTIFFOpen=XTIFFOpen -DTIFFClose=XTIFFClose -DTIFFFdOpen=XTIFFFdOpen\n\nto the compile statement.\n\nBugs, Comments Etc:\n------------------\n Send all reports and suggestions to ndr@tazboy.jpl.nasa.gov\n (Niles Ritter).\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/tags/listtif.c",
    "content": "/*\n * listtif.c -- lists a tiff file.\n */\n\n#include \"xtiffio.h\"\n#include <stdlib.h>\n\nvoid main(int argc,char *argv[])\n{\n\tchar *fname=\"newtif.tif\";\n\tint flags;\n\n\tTIFF *tif=(TIFF*)0;  /* TIFF-level descriptor */\n\n\tif (argc>1) fname=argv[1];\n\t\n\ttif=XTIFFOpen(fname,\"r\");\n\tif (!tif) goto failure;\n\t\n\t/* We want the double array listed */\n\tflags = TIFFPRINT_MYMULTIDOUBLES;\n\t\n\tTIFFPrintDirectory(tif,stdout,flags);\n\tXTIFFClose(tif);\n\texit (0);\n\t\nfailure:\n\tprintf(\"failure in listtif\\n\");\n\tif (tif) XTIFFClose(tif);\n\texit (-1);\n}\n\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/tags/maketif.c",
    "content": "/*\n * maketif.c -- creates a little TIFF file, with\n *   the XTIFF extended tiff example tags.\n */\n\n#include <stdlib.h>\n#include \"xtiffio.h\"\n\n\nvoid SetUpTIFFDirectory(TIFF *tif);\nvoid WriteImage(TIFF *tif);\n\n#define WIDTH 20\n#define HEIGHT 20\n\nvoid main()\n{\n\tTIFF *tif=(TIFF*)0;  /* TIFF-level descriptor */\n\t\n\ttif=XTIFFOpen(\"newtif.tif\",\"w\");\n\tif (!tif) goto failure;\n\t\n\tSetUpTIFFDirectory(tif);\n\tWriteImage(tif);\n\t\n\tXTIFFClose(tif);\n\texit (0);\n\t\nfailure:\n\tprintf(\"failure in maketif\\n\");\n\tif (tif) XTIFFClose(tif);\n\texit (-1);\n}\n\n\nvoid SetUpTIFFDirectory(TIFF *tif)\n{\n\tdouble mymulti[6]={0.0,1.0,2.0,  3.1415926, 5.0,1.0};\n\tuint32 mysingle=3456;\n\tchar *ascii=\"This file was produced by Steven Spielberg. NOT\";\n\n\tTIFFSetField(tif,TIFFTAG_IMAGEWIDTH,WIDTH);\n\tTIFFSetField(tif,TIFFTAG_IMAGELENGTH,HEIGHT);\n\tTIFFSetField(tif,TIFFTAG_COMPRESSION,COMPRESSION_NONE);\n\tTIFFSetField(tif,TIFFTAG_PHOTOMETRIC,PHOTOMETRIC_MINISBLACK);\n\tTIFFSetField(tif,TIFFTAG_PLANARCONFIG,PLANARCONFIG_CONTIG);\n\tTIFFSetField(tif,TIFFTAG_BITSPERSAMPLE,8);\n\tTIFFSetField(tif,TIFFTAG_ROWSPERSTRIP,20);\n\n\t/* Install the extended TIFF tag examples */\n\tTIFFSetField(tif,TIFFTAG_EXAMPLE_MULTI,6,mymulti);\n\tTIFFSetField(tif,TIFFTAG_EXAMPLE_SINGLE,mysingle);\n\tTIFFSetField(tif,TIFFTAG_EXAMPLE_ASCII,ascii);\n}\n\n\nvoid WriteImage(TIFF *tif)\n{\n\tint i;\n\tchar buffer[WIDTH];\n\t\n\tmemset(buffer,0,sizeof(buffer));\n\tfor (i=0;i<HEIGHT;i++)\n\t\tif (!TIFFWriteScanline(tif, buffer, i, 0))\n\t\t\tTIFFErrorExt(tif->tif_clientdata, \"WriteImage\",\"failure in WriteScanline\\n\");\n}\n\n\n\n\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/tags/xtif_dir.c",
    "content": "/*\n * xtif_dir.c\n *\n * Extended TIFF Directory Tag Support.\n *\n *  You may use this file as a template to add your own\n *  extended tags to the library. Only the parts of the code\n *  marked with \"XXX\" require modification. Three example tags\n *  are shown; you should replace them with your own.\n *\n *  Author: Niles D. Ritter\n */\n \n#include \"xtiffiop.h\"\n#include <stdio.h>\n\n/*  Tiff info structure.\n *\n *     Entry format:\n *        { TAGNUMBER, ReadCount, WriteCount, DataType, FIELDNUM, \n *          OkToChange, PassDirCountOnSet, AsciiName }\n *\n *     For ReadCount, WriteCount, -1 = unknown; used for mult-valued\n *         tags and ASCII.\n */\n\nstatic const TIFFFieldInfo xtiffFieldInfo[] = {\n  \n  /* XXX Replace these example tags with your own extended tags */\n    { TIFFTAG_EXAMPLE_MULTI,\t-1,-1, TIFF_DOUBLE,\tFIELD_EXAMPLE_MULTI,\n      TRUE,\tTRUE,\t\"MyMultivaluedTag\" },\n    { TIFFTAG_EXAMPLE_SINGLE,\t 1, 1, TIFF_LONG,\tFIELD_EXAMPLE_SINGLE,\n      TRUE,\tFALSE,\t\"MySingleLongTag\" },\n    { TIFFTAG_EXAMPLE_ASCII,\t-1,-1, TIFF_ASCII,\tFIELD_EXAMPLE_ASCII,\n      TRUE,\tFALSE,\t\"MyAsciiTag\" },\n};\n#define\tN(a)\t(sizeof (a) / sizeof (a[0]))\n\n\nstatic void\n_XTIFFPrintDirectory(TIFF* tif, FILE* fd, long flags)\n{\n\txtiff *xt = XTIFFDIR(tif);\n\tXTIFFDirectory *xd = &xt->xtif_dir;\n\tint i,num;\n\n\t/* call the inherited method */\n\tif (PARENT(xt,printdir))\n\t\t(PARENT(xt,printdir))(tif,fd,flags);\n\n\t/* XXX Add field printing here. Replace the three example\n         *    tags implemented below with your own.\n         */\n\n\tfprintf(fd,\"--My Example Tags--\\n\");\n\n\t/* Our first example tag may have a lot of values, so we\n         * will only print them out if the TIFFPRINT_MYMULTIDOUBLES\n         * flag is passed into the print method.\n         */\n\tif (TIFFFieldSet(tif,FIELD_EXAMPLE_MULTI))\n\t{\n\t\tfprintf(fd, \"  My Multi-Valued Doubles:\");\n\t\tif (flags & TIFFPRINT_MYMULTIDOUBLES) \n\t\t{\n\t\t\tdouble *value = xd->xd_example_multi;\n\t\n\t\t\tnum = xd->xd_num_multi;\n\t\t\tfprintf(fd,\"(\");\n\t\t\tfor (i=0;i<num;i++) fprintf(fd, \" %lg\", *value++);\n\t\t\tfprintf(fd,\")\\n\");\n\t\t} else\n\t\t\tfprintf(fd, \"(present)\\n\");\n\t}\n\n\tif (TIFFFieldSet(tif,FIELD_EXAMPLE_SINGLE))\n\t{\n\t\tfprintf(fd, \"  My Single Long Tag:  %lu\\n\", xd->xd_example_single);\n\t}\n\n\tif (TIFFFieldSet(tif,FIELD_EXAMPLE_ASCII))\n\t{\n\t\t_TIFFprintAsciiTag(fd,\"My ASCII Tag\",\n\t\t\t xd->xd_example_ascii);\n\t}\n}\n\nstatic int\n_XTIFFVSetField(TIFF* tif, ttag_t tag, va_list ap)\n{\n\txtiff *xt = XTIFFDIR(tif);\n\tXTIFFDirectory* xd = &xt->xtif_dir;\n\tint status = 1;\n\tuint32 v32=0;\n\tint i=0, v=0;\n\tva_list ap1 = ap;\n\n\t/* va_start is called by the calling routine */\n\t\n\tswitch (tag) {\n\t\t/* \n                 * XXX put your extended tags here; replace the implemented\n                 *     example tags with your own. \n                 */\n\tcase TIFFTAG_EXAMPLE_MULTI:\n\t\t/* multi-valued tags need to store the count as well */\n\t\txd->xd_num_multi = (uint16) va_arg(ap, int);\n\t\t_TIFFsetDoubleArray(&xd->xd_example_multi, va_arg(ap, double*),\n\t\t\t(long) xd->xd_num_multi);\n\t\tbreak;\n\tcase TIFFTAG_EXAMPLE_SINGLE:\n\t\txd->xd_example_single = va_arg(ap, uint32);\n\t\tbreak;\n\tcase TIFFTAG_EXAMPLE_ASCII:\n\t\t_TIFFsetString(&xd->xd_example_ascii, va_arg(ap, char*));\n\t\tbreak;\n\tdefault:\n\t\t/* call the inherited method */\n\t\treturn (PARENT(xt,vsetfield))(tif,tag,ap);\n\t\tbreak;\n\t}\n\tif (status) {\n\t\t/* we have to override the print method here,\n \t\t * after the compression tags have gotten to it.\n\t\t * This makes sense because the only time we would\n\t\t * need the extended print method is if an extended\n\t\t * tag is set by the reader.\n\t\t */\n\t\tif (!(xt->xtif_flags & XTIFFP_PRINT))\n\t\t{\n\t        \tPARENT(xt,printdir) =  TIFFMEMBER(tif,printdir);\n      \t\t  \tTIFFMEMBER(tif,printdir) = _XTIFFPrintDirectory;\n\t\t\txt->xtif_flags |= XTIFFP_PRINT;\n\t\t}\n\t\tTIFFSetFieldBit(tif, _TIFFFieldWithTag(tif, tag)->field_bit);\n\t\ttif->tif_flags |= TIFF_DIRTYDIRECT;\n\t}\n\tva_end(ap);\n\treturn (status);\nbadvalue:\n\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name, \"%d: Bad value for \\\"%s\\\"\", v,\n\t    _TIFFFieldWithTag(tif, tag)->field_name);\n\tva_end(ap);\n\treturn (0);\nbadvalue32:\n\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name, \"%ld: Bad value for \\\"%s\\\"\", v32,\n\t    _TIFFFieldWithTag(tif, tag)->field_name);\n\tva_end(ap);\n\treturn (0);\n}\n\n\nstatic int\n_XTIFFVGetField(TIFF* tif, ttag_t tag, va_list ap)\n{\n\txtiff *xt = XTIFFDIR(tif);\n\tXTIFFDirectory* xd = &xt->xtif_dir;\n\n\tswitch (tag) {\n\t\t/* \n                 * XXX put your extended tags here; replace the implemented\n                 *     example tags with your own.\n                 */\n\tcase TIFFTAG_EXAMPLE_MULTI:\n\t\t*va_arg(ap, uint16*) = xd->xd_num_multi;\n\t\t*va_arg(ap, double**) = xd->xd_example_multi;\n\t\tbreak;\n\tcase TIFFTAG_EXAMPLE_ASCII:\n\t\t*va_arg(ap, char**) = xd->xd_example_ascii;\n\t\tbreak;\n\tcase TIFFTAG_EXAMPLE_SINGLE:\n\t\t*va_arg(ap, uint32*) = xd->xd_example_single;\n\t\tbreak;\n\tdefault:\n\t\t/* return inherited method */\n\t\treturn (PARENT(xt,vgetfield))(tif,tag,ap);\n\t\tbreak;\n\t}\n\treturn (1);\n}\n\n#define\tCleanupField(member) {\t\t\\\n    if (xd->member) {\t\t\t\\\n\t_TIFFfree(xd->member);\t\t\\\n\txd->member = 0;\t\t\t\\\n    }\t\t\t\t\t\\\n}\n/*\n * Release storage associated with a directory.\n */\nstatic void\n_XTIFFFreeDirectory(xtiff* xt)\n{\n\tXTIFFDirectory* xd = &xt->xtif_dir;\n\n\t/* \n\t *  XXX - Purge all Your allocated memory except\n\t *  for the xtiff directory itself. This includes\n\t *  all fields that require a _TIFFsetXXX call in\n\t *  _XTIFFVSetField().\n\t */\n\t\n\tCleanupField(xd_example_multi);\n\tCleanupField(xd_example_ascii);\n\t\n}\n#undef CleanupField\n\nstatic void _XTIFFLocalDefaultDirectory(TIFF *tif)\n{\n\txtiff *xt = XTIFFDIR(tif);\n\tXTIFFDirectory* xd = &xt->xtif_dir;\n\n\t/* Install the extended Tag field info */\n\t_TIFFMergeFieldInfo(tif, xtiffFieldInfo, N(xtiffFieldInfo));\n\n\t/*\n\t *  free up any dynamically allocated arrays\n\t *  before the new directory is read in.\n\t */\n\t \n\t_XTIFFFreeDirectory(xt);\t\n\t_TIFFmemset(xt,0,sizeof(xtiff));\n\n\t/* Override the tag access methods */\n\n\tPARENT(xt,vsetfield) =  TIFFMEMBER(tif,vsetfield);\n\tTIFFMEMBER(tif,vsetfield) = _XTIFFVSetField;\n\tPARENT(xt,vgetfield) =  TIFFMEMBER(tif,vgetfield);\n\tTIFFMEMBER(tif,vgetfield) = _XTIFFVGetField;\n\n\t/* \n\t * XXX Set up any default values here.\n\t */\n\t\n\txd->xd_example_single = 234;\n}\n\n\n\n/**********************************************************************\n *    Nothing below this line should need to be changed.\n **********************************************************************/\n\nstatic TIFFExtendProc _ParentExtender;\n\n/*\n *  This is the callback procedure, and is\n *  called by the DefaultDirectory method\n *  every time a new TIFF directory is opened.\n */\n\nstatic void\n_XTIFFDefaultDirectory(TIFF *tif)\n{\n\txtiff *xt;\n\t\n\t/* Allocate Directory Structure if first time, and install it */\n\tif (!(tif->tif_flags & XTIFF_INITIALIZED))\n\t{\n\t\txt = _TIFFmalloc(sizeof(xtiff));\n\t\tif (!xt)\n\t\t{\n\t\t\t/* handle memory allocation failure here ! */\n\t\t\treturn;\n\t\t}\n\t\t_TIFFmemset(xt,0,sizeof(xtiff));\n\t\t/*\n\t\t * Install into TIFF structure.\n\t\t */\n\t\tTIFFMEMBER(tif,clientdir) = (tidata_t)xt;\n\t\ttif->tif_flags |= XTIFF_INITIALIZED; /* dont do this again! */\n\t}\n\t\n\t/* set up our own defaults */\n\t_XTIFFLocalDefaultDirectory(tif);\n\n\t/* Since an XTIFF client module may have overridden\n\t * the default directory method, we call it now to\n\t * allow it to set up the rest of its own methods.\n         */\n\n\tif (_ParentExtender) \n\t\t(*_ParentExtender)(tif);\n\n}\n\n/*\n *  XTIFF Initializer -- sets up the callback\n *   procedure for the TIFF module.\n */\n\nstatic\nvoid _XTIFFInitialize(void)\n{\n\tstatic first_time=1;\n\t\n\tif (! first_time) return; /* Been there. Done that. */\n\tfirst_time = 0;\n\t\n\t/* Grab the inherited method and install */\n\t_ParentExtender = TIFFSetTagExtender(_XTIFFDefaultDirectory);\n}\n\n\n/*\n * Public File I/O Routines.\n */\nTIFF*\nXTIFFOpen(const char* name, const char* mode)\n{\n\t/* Set up the callback */\n\t_XTIFFInitialize();\t\n\t\n\t/* Open the file; the callback will set everything up\n\t */\n\treturn TIFFOpen(name, mode);\n}\n\nTIFF*\nXTIFFFdOpen(int fd, const char* name, const char* mode)\n{\n\t/* Set up the callback */\n\t_XTIFFInitialize();\t\n\n\t/* Open the file; the callback will set everything up\n\t */\n\treturn TIFFFdOpen(fd, name, mode);\n}\n\n\nvoid\nXTIFFClose(TIFF *tif)\n{\n\txtiff *xt = XTIFFDIR(tif);\n\t\n\t/* call inherited function first */\n\tTIFFClose(tif);\n\t\n\t/* Free up extended allocated memory */\n\t_XTIFFFreeDirectory(xt);\n\t_TIFFfree(xt);\n}\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/tags/xtiffio.h",
    "content": "/*\n *  xtiffio.h -- Public interface to Extended TIFF tags\n *\n *    This is a template for defining a client module\n *    which supports tag extensions to the standard libtiff\n *    set. Only portions of the code marked \"XXX\" need to\n *    be changed to support your tag set.\n *\n *    written by: Niles D. Ritter\n */\n\n#ifndef __xtiffio_h\n#define __xtiffio_h\n\n#include \"tiffio.h\"\n\n/* \n *  XXX Define your private Tag names and values here \n */\n\n/* These tags are not valid, but are provided for example */\n#define TIFFTAG_EXAMPLE_MULTI      61234\n#define TIFFTAG_EXAMPLE_SINGLE     61235\n#define TIFFTAG_EXAMPLE_ASCII      61236\n\n/* \n *  XXX Define Printing method flags. These\n *  flags may be passed in to TIFFPrintDirectory() to\n *  indicate that those particular field values should\n *  be printed out in full, rather than just an indicator\n *  of whether they are present or not.\n */\n#define\tTIFFPRINT_MYMULTIDOUBLES\t0x80000000\n\n/**********************************************************************\n *    Nothing below this line should need to be changed by the user.\n **********************************************************************/\n\n#if defined(__cplusplus)\nextern \"C\" {\n#endif\n\nextern TIFF* XTIFFOpen(const char* name, const char* mode);\nextern TIFF* XTIFFFdOpen(int fd, const char* name, const char* mode);\nextern void  XTIFFClose(TIFF *tif);\n\n#if defined(__cplusplus)\n}\n#endif\n\n#endif /* __xtiffio_h */\n\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/tags/xtiffiop.h",
    "content": "/*\n * Private Extended TIFF library interface.\n *\n *  uses private LIBTIFF interface.\n *\n *  The portions of this module marked \"XXX\" should be\n *  modified to support your tags instead.\n *\n *  written by: Niles D. Ritter\n *\n */\n\n#ifndef __xtiffiop_h\n#define __xtiffiop_h\n\n#include \"tiffiop.h\"\n#include \"xtiffio.h\"\n\n/**********************************************************************\n *               User Configuration\n **********************************************************************/\n\n/* XXX - Define number of your extended tags here */\n#define NUM_XFIELD 3\n#define XFIELD_BASE (FIELD_LAST-NUM_XFIELD)\n\n/*  XXX - Define your Tag Fields here  */\n#define\tFIELD_EXAMPLE_MULTI     (XFIELD_BASE+0)\n#define\tFIELD_EXAMPLE_SINGLE    (XFIELD_BASE+1)\n#define\tFIELD_EXAMPLE_ASCII      (XFIELD_BASE+2)\n\n\n/* XXX - Define Private directory tag structure here */\nstruct XTIFFDirectory {\n\tuint16\t xd_num_multi; /* dir-count for the multi tag */\n\tdouble*  xd_example_multi;\n\tuint32   xd_example_single; \n\tchar*    xd_example_ascii;\n};\ntypedef struct XTIFFDirectory XTIFFDirectory;\n\n/**********************************************************************\n *    Nothing below this line should need to be changed by the user.\n **********************************************************************/\n\nstruct xtiff {\n\tTIFF \t\t*xtif_tif;\t/* parent TIFF pointer */\n\tuint32\t\txtif_flags;\n#define       XTIFFP_PRINT   0x00000001\n\tXTIFFDirectory\txtif_dir;\t/* internal rep of current directory */\n\tTIFFVSetMethod\txtif_vsetfield;\t/* inherited tag set routine */\n\tTIFFVGetMethod\txtif_vgetfield;\t/* inherited tag get routine */\n\tTIFFPrintMethod\txtif_printdir;  /* inherited dir print method */\n};\ntypedef struct xtiff xtiff;\n\n\n#define PARENT(xt,pmember) ((xt)->xtif_ ## pmember) \n#define TIFFMEMBER(tf,pmember) ((tf)->tif_ ## pmember) \n#define XTIFFDIR(tif) ((xtiff *)TIFFMEMBER(tif,clientdir))\n\t\n/* Extended TIFF flags */\n#define XTIFF_INITIALIZED 0x80000000\n\t\n#endif /* __xtiffiop_h */\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/win_dib/Makefile.am",
    "content": "# Tag Image File Format (TIFF) Software\n#\n# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>\n#\n# Permission to use, copy, modify, distribute, and sell this software and \n# its documentation for any purpose is hereby granted without fee, provided\n# that (i) the above copyright notices and this permission notice appear in\n# all copies of the software and related documentation, and (ii) the names of\n# Sam Leffler and Silicon Graphics may not be used in any advertising or\n# publicity relating to the software without the specific, prior written\n# permission of Sam Leffler and Silicon Graphics.\n# \n# THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n# \n# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n# OF THIS SOFTWARE.\n\n# Process this file with automake to produce Makefile.in.\n\nEXTRA_DIST = Makefile.w95 README.Tiffile README.tiff2dib Tiffile.cpp tiff2dib.c\n\nINCLUDES = -I../../libtiff -I$(top_srcdir)/libtiff"
  },
  {
    "path": "src/main/jni/tiff/contrib/win_dib/Makefile.in",
    "content": "# Makefile.in generated by automake 1.11 from Makefile.am.\n# @configure_input@\n\n# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,\n# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,\n# Inc.\n# This Makefile.in is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY, to the extent permitted by law; without\n# even the implied warranty of MERCHANTABILITY or FITNESS FOR A\n# PARTICULAR PURPOSE.\n\n@SET_MAKE@\n\n# Tag Image File Format (TIFF) Software\n#\n# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>\n#\n# Permission to use, copy, modify, distribute, and sell this software and \n# its documentation for any purpose is hereby granted without fee, provided\n# that (i) the above copyright notices and this permission notice appear in\n# all copies of the software and related documentation, and (ii) the names of\n# Sam Leffler and Silicon Graphics may not be used in any advertising or\n# publicity relating to the software without the specific, prior written\n# permission of Sam Leffler and Silicon Graphics.\n# \n# THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n# \n# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n# OF THIS SOFTWARE.\n\n# Process this file with automake to produce Makefile.in.\nVPATH = @srcdir@\npkgdatadir = $(datadir)/@PACKAGE@\npkgincludedir = $(includedir)/@PACKAGE@\npkglibdir = $(libdir)/@PACKAGE@\npkglibexecdir = $(libexecdir)/@PACKAGE@\nam__cd = CDPATH=\"$${ZSH_VERSION+.}$(PATH_SEPARATOR)\" && cd\ninstall_sh_DATA = $(install_sh) -c -m 644\ninstall_sh_PROGRAM = $(install_sh) -c\ninstall_sh_SCRIPT = $(install_sh) -c\nINSTALL_HEADER = $(INSTALL_DATA)\ntransform = $(program_transform_name)\nNORMAL_INSTALL = :\nPRE_INSTALL = :\nPOST_INSTALL = :\nNORMAL_UNINSTALL = :\nPRE_UNINSTALL = :\nPOST_UNINSTALL = :\nbuild_triplet = @build@\nhost_triplet = @host@\ntarget_triplet = @target@\nsubdir = contrib/win_dib\nDIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in\nACLOCAL_M4 = $(top_srcdir)/aclocal.m4\nam__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \\\n\t$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \\\n\t$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \\\n\t$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac\nam__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \\\n\t$(ACLOCAL_M4)\nmkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs\nCONFIG_HEADER = $(top_builddir)/libtiff/tif_config.h \\\n\t$(top_builddir)/libtiff/tiffconf.h\nCONFIG_CLEAN_FILES =\nCONFIG_CLEAN_VPATH_FILES =\nAM_V_GEN = $(am__v_GEN_$(V))\nam__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))\nam__v_GEN_0 = @echo \"  GEN   \" $@;\nAM_V_at = $(am__v_at_$(V))\nam__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))\nam__v_at_0 = @\nSOURCES =\nDIST_SOURCES =\nDISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)\nACLOCAL = @ACLOCAL@\nAMTAR = @AMTAR@\nAM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@\nAR = @AR@\nAS = @AS@\nAUTOCONF = @AUTOCONF@\nAUTOHEADER = @AUTOHEADER@\nAUTOMAKE = @AUTOMAKE@\nAWK = @AWK@\nCC = @CC@\nCCDEPMODE = @CCDEPMODE@\nCFLAGS = @CFLAGS@\nCPP = @CPP@\nCPPFLAGS = @CPPFLAGS@\nCXX = @CXX@\nCXXCPP = @CXXCPP@\nCXXDEPMODE = @CXXDEPMODE@\nCXXFLAGS = @CXXFLAGS@\nCYGPATH_W = @CYGPATH_W@\nDEFS = @DEFS@\nDEPDIR = @DEPDIR@\nDLLTOOL = @DLLTOOL@\nDSYMUTIL = @DSYMUTIL@\nDUMPBIN = @DUMPBIN@\nECHO_C = @ECHO_C@\nECHO_N = @ECHO_N@\nECHO_T = @ECHO_T@\nEGREP = @EGREP@\nEXEEXT = @EXEEXT@\nFGREP = @FGREP@\nGLUT_CFLAGS = @GLUT_CFLAGS@\nGLUT_LIBS = @GLUT_LIBS@\nGLU_CFLAGS = @GLU_CFLAGS@\nGLU_LIBS = @GLU_LIBS@\nGL_CFLAGS = @GL_CFLAGS@\nGL_LIBS = @GL_LIBS@\nGREP = @GREP@\nINSTALL = @INSTALL@\nINSTALL_DATA = @INSTALL_DATA@\nINSTALL_PROGRAM = @INSTALL_PROGRAM@\nINSTALL_SCRIPT = @INSTALL_SCRIPT@\nINSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@\nLD = @LD@\nLDFLAGS = @LDFLAGS@\nLIBDIR = @LIBDIR@\nLIBOBJS = @LIBOBJS@\nLIBS = @LIBS@\nLIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@\nLIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@\nLIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@\nLIBTIFF_MICRO_VERSION = @LIBTIFF_MICRO_VERSION@\nLIBTIFF_MINOR_VERSION = @LIBTIFF_MINOR_VERSION@\nLIBTIFF_RELEASE_DATE = @LIBTIFF_RELEASE_DATE@\nLIBTIFF_VERSION = @LIBTIFF_VERSION@\nLIBTIFF_VERSION_INFO = @LIBTIFF_VERSION_INFO@\nLIBTOOL = @LIBTOOL@\nLIPO = @LIPO@\nLN_S = @LN_S@\nLTLIBOBJS = @LTLIBOBJS@\nMAINT = @MAINT@\nMAKEINFO = @MAKEINFO@\nMKDIR_P = @MKDIR_P@\nNM = @NM@\nNMEDIT = @NMEDIT@\nOBJDUMP = @OBJDUMP@\nOBJEXT = @OBJEXT@\nOTOOL = @OTOOL@\nOTOOL64 = @OTOOL64@\nPACKAGE = @PACKAGE@\nPACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@\nPACKAGE_NAME = @PACKAGE_NAME@\nPACKAGE_STRING = @PACKAGE_STRING@\nPACKAGE_TARNAME = @PACKAGE_TARNAME@\nPACKAGE_URL = @PACKAGE_URL@\nPACKAGE_VERSION = @PACKAGE_VERSION@\nPATH_SEPARATOR = @PATH_SEPARATOR@\nPTHREAD_CC = @PTHREAD_CC@\nPTHREAD_CFLAGS = @PTHREAD_CFLAGS@\nPTHREAD_LIBS = @PTHREAD_LIBS@\nRANLIB = @RANLIB@\nSED = @SED@\nSET_MAKE = @SET_MAKE@\nSHELL = @SHELL@\nSTRIP = @STRIP@\nVERSION = @VERSION@\nXMKMF = @XMKMF@\nX_CFLAGS = @X_CFLAGS@\nX_EXTRA_LIBS = @X_EXTRA_LIBS@\nX_LIBS = @X_LIBS@\nX_PRE_LIBS = @X_PRE_LIBS@\nabs_builddir = @abs_builddir@\nabs_srcdir = @abs_srcdir@\nabs_top_builddir = @abs_top_builddir@\nabs_top_srcdir = @abs_top_srcdir@\nac_ct_CC = @ac_ct_CC@\nac_ct_CXX = @ac_ct_CXX@\nac_ct_DUMPBIN = @ac_ct_DUMPBIN@\nacx_pthread_config = @acx_pthread_config@\nam__include = @am__include@\nam__leading_dot = @am__leading_dot@\nam__quote = @am__quote@\nam__tar = @am__tar@\nam__untar = @am__untar@\nbindir = @bindir@\nbuild = @build@\nbuild_alias = @build_alias@\nbuild_cpu = @build_cpu@\nbuild_os = @build_os@\nbuild_vendor = @build_vendor@\nbuilddir = @builddir@\ndatadir = @datadir@\ndatarootdir = @datarootdir@\ndocdir = @docdir@\ndvidir = @dvidir@\nexec_prefix = @exec_prefix@\nhost = @host@\nhost_alias = @host_alias@\nhost_cpu = @host_cpu@\nhost_os = @host_os@\nhost_vendor = @host_vendor@\nhtmldir = @htmldir@\nincludedir = @includedir@\ninfodir = @infodir@\ninstall_sh = @install_sh@\nlibdir = @libdir@\nlibexecdir = @libexecdir@\nlocaledir = @localedir@\nlocalstatedir = @localstatedir@\nlt_ECHO = @lt_ECHO@\nmandir = @mandir@\nmkdir_p = @mkdir_p@\noldincludedir = @oldincludedir@\npdfdir = @pdfdir@\nprefix = @prefix@\nprogram_transform_name = @program_transform_name@\npsdir = @psdir@\nsbindir = @sbindir@\nsharedstatedir = @sharedstatedir@\nsrcdir = @srcdir@\nsysconfdir = @sysconfdir@\ntarget = @target@\ntarget_alias = @target_alias@\ntarget_cpu = @target_cpu@\ntarget_os = @target_os@\ntarget_vendor = @target_vendor@\ntop_build_prefix = @top_build_prefix@\ntop_builddir = @top_builddir@\ntop_srcdir = @top_srcdir@\nEXTRA_DIST = Makefile.w95 README.Tiffile README.tiff2dib Tiffile.cpp tiff2dib.c\nINCLUDES = -I../../libtiff -I$(top_srcdir)/libtiff\nall: all-am\n\n.SUFFIXES:\n$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)\n\t@for dep in $?; do \\\n\t  case '$(am__configure_deps)' in \\\n\t    *$$dep*) \\\n\t      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \\\n\t        && { if test -f $@; then exit 0; else break; fi; }; \\\n\t      exit 1;; \\\n\t  esac; \\\n\tdone; \\\n\techo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign contrib/win_dib/Makefile'; \\\n\t$(am__cd) $(top_srcdir) && \\\n\t  $(AUTOMAKE) --foreign contrib/win_dib/Makefile\n.PRECIOUS: Makefile\nMakefile: $(srcdir)/Makefile.in $(top_builddir)/config.status\n\t@case '$?' in \\\n\t  *config.status*) \\\n\t    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \\\n\t  *) \\\n\t    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \\\n\t    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \\\n\tesac;\n\n$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n\n$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n$(am__aclocal_m4_deps):\n\nmostlyclean-libtool:\n\t-rm -f *.lo\n\nclean-libtool:\n\t-rm -rf .libs _libs\ntags: TAGS\nTAGS:\n\nctags: CTAGS\nCTAGS:\n\n\ndistdir: $(DISTFILES)\n\t@srcdirstrip=`echo \"$(srcdir)\" | sed 's/[].[^$$\\\\*]/\\\\\\\\&/g'`; \\\n\ttopsrcdirstrip=`echo \"$(top_srcdir)\" | sed 's/[].[^$$\\\\*]/\\\\\\\\&/g'`; \\\n\tlist='$(DISTFILES)'; \\\n\t  dist_files=`for file in $$list; do echo $$file; done | \\\n\t  sed -e \"s|^$$srcdirstrip/||;t\" \\\n\t      -e \"s|^$$topsrcdirstrip/|$(top_builddir)/|;t\"`; \\\n\tcase $$dist_files in \\\n\t  */*) $(MKDIR_P) `echo \"$$dist_files\" | \\\n\t\t\t   sed '/\\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \\\n\t\t\t   sort -u` ;; \\\n\tesac; \\\n\tfor file in $$dist_files; do \\\n\t  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \\\n\t  if test -d $$d/$$file; then \\\n\t    dir=`echo \"/$$file\" | sed -e 's,/[^/]*$$,,'`; \\\n\t    if test -d \"$(distdir)/$$file\"; then \\\n\t      find \"$(distdir)/$$file\" -type d ! -perm -700 -exec chmod u+rwx {} \\;; \\\n\t    fi; \\\n\t    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \\\n\t      cp -fpR $(srcdir)/$$file \"$(distdir)$$dir\" || exit 1; \\\n\t      find \"$(distdir)/$$file\" -type d ! -perm -700 -exec chmod u+rwx {} \\;; \\\n\t    fi; \\\n\t    cp -fpR $$d/$$file \"$(distdir)$$dir\" || exit 1; \\\n\t  else \\\n\t    test -f \"$(distdir)/$$file\" \\\n\t    || cp -p $$d/$$file \"$(distdir)/$$file\" \\\n\t    || exit 1; \\\n\t  fi; \\\n\tdone\ncheck-am: all-am\ncheck: check-am\nall-am: Makefile\ninstalldirs:\ninstall: install-am\ninstall-exec: install-exec-am\ninstall-data: install-data-am\nuninstall: uninstall-am\n\ninstall-am: all-am\n\t@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am\n\ninstallcheck: installcheck-am\ninstall-strip:\n\t$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM=\"$(INSTALL_STRIP_PROGRAM)\" \\\n\t  install_sh_PROGRAM=\"$(INSTALL_STRIP_PROGRAM)\" INSTALL_STRIP_FLAG=-s \\\n\t  `test -z '$(STRIP)' || \\\n\t    echo \"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'\"` install\nmostlyclean-generic:\n\nclean-generic:\n\ndistclean-generic:\n\t-test -z \"$(CONFIG_CLEAN_FILES)\" || rm -f $(CONFIG_CLEAN_FILES)\n\t-test . = \"$(srcdir)\" || test -z \"$(CONFIG_CLEAN_VPATH_FILES)\" || rm -f $(CONFIG_CLEAN_VPATH_FILES)\n\nmaintainer-clean-generic:\n\t@echo \"This command is intended for maintainers to use\"\n\t@echo \"it deletes files that may require special tools to rebuild.\"\nclean: clean-am\n\nclean-am: clean-generic clean-libtool mostlyclean-am\n\ndistclean: distclean-am\n\t-rm -f Makefile\ndistclean-am: clean-am distclean-generic\n\ndvi: dvi-am\n\ndvi-am:\n\nhtml: html-am\n\nhtml-am:\n\ninfo: info-am\n\ninfo-am:\n\ninstall-data-am:\n\ninstall-dvi: install-dvi-am\n\ninstall-dvi-am:\n\ninstall-exec-am:\n\ninstall-html: install-html-am\n\ninstall-html-am:\n\ninstall-info: install-info-am\n\ninstall-info-am:\n\ninstall-man:\n\ninstall-pdf: install-pdf-am\n\ninstall-pdf-am:\n\ninstall-ps: install-ps-am\n\ninstall-ps-am:\n\ninstallcheck-am:\n\nmaintainer-clean: maintainer-clean-am\n\t-rm -f Makefile\nmaintainer-clean-am: distclean-am maintainer-clean-generic\n\nmostlyclean: mostlyclean-am\n\nmostlyclean-am: mostlyclean-generic mostlyclean-libtool\n\npdf: pdf-am\n\npdf-am:\n\nps: ps-am\n\nps-am:\n\nuninstall-am:\n\n.MAKE: install-am install-strip\n\n.PHONY: all all-am check check-am clean clean-generic clean-libtool \\\n\tdistclean distclean-generic distclean-libtool distdir dvi \\\n\tdvi-am html html-am info info-am install install-am \\\n\tinstall-data install-data-am install-dvi install-dvi-am \\\n\tinstall-exec install-exec-am install-html install-html-am \\\n\tinstall-info install-info-am install-man install-pdf \\\n\tinstall-pdf-am install-ps install-ps-am install-strip \\\n\tinstallcheck installcheck-am installdirs maintainer-clean \\\n\tmaintainer-clean-generic mostlyclean mostlyclean-generic \\\n\tmostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am\n\n\n# Tell versions [3.59,3.63) of GNU make to not export all variables.\n# Otherwise a system limit (for SysV at least) may be exceeded.\n.NOEXPORT:\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/win_dib/Makefile.w95",
    "content": "#\t$Header: /usr/people/sam/tiff/libtiff/RCS/Makefile.w95,v 1.2 1994/11/28\n06:13:31 sam Exp $\n#\n# Tag Image File Format Library\n#\n# Copyright (c) 1988, 1989, 1990, 1991, 1992 Sam Leffler\n# Copyright (c) 1991, 1992 Silicon Graphics, Inc.\n# \n# Permission to use, copy, modify, distribute, and sell this software and \n# its documentation for any purpose is hereby granted without fee, provided\n# that (i) the above copyright notices and this permission notice appear in\n# all copies of the software and related documentation, and (ii) the names of\n# Sam Leffler and Silicon Graphics may not be used in any advertising or\n# publicity relating to the software without the specific, prior written\n# permission of Sam Leffler and Silicon Graphics.\n# \n# THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n# \n# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n# OF THIS SOFTWARE.\n#\n# This Makefile is for use with microsoft nmake version 1.50 and \n# Microsoft 32-bit C/C++ Compiler 9.00\n#\nDESTDIR=.\n#\nIPATH=\t-I. \nCONF_LIBRARY=$(NULL)\nCOPTS=\t-Oxa -DBSDTYPES -Zd\nCFLAGS=\t$(COPTS)  $(CONF_LIBRARY)\n#\nINCS=\ttiff.h tiffio.h\nSRCS=\ttif_aux.c \\\n\ttif_close.c \\\n\ttif_codec.c \\\n\ttif_compress.c \\\n\ttif_dir.c \\\n\ttif_dirinfo.c \\\n\ttif_dirread.c \\\n\ttif_dirwrite.c \\\n\ttif_dumpmode.c \\\n\ttif_error.c \\\n\ttif_getimage.c \\\n\ttif_jpeg.c \\\n\ttif_flush.c \\\n\ttif_lzw.c \\\n\ttif_next.c \\\n\ttif_open.c \\\n\ttif_packbits.c \\\n\ttif_predict \\\n\ttif_print.c \\\n\ttif_read.c \\\n\ttif_swab.c \\\n\ttif_strip.c \\\n\ttif_thunder.c \\\n\ttif_tile.c \\\n\ttif_version.c \\\n\ttif_warning.c \\\n\ttif_write.c \\\n\ttif_win32.c \n\t\t\n\t\nOBJS=\ttif_aux.obj \\\n\ttif_close.obj \\\n\ttif_codec.obj \\\n\ttif_compress.obj \\\n\ttif_dir.obj \\\n\ttif_dirinfo.obj \\\n\ttif_dirread.obj \\\n\ttif_dirwrite.obj \\\n\ttif_dumpmode.obj \\\n\ttif_error.obj \\\n\ttif_getimage.obj \\\n\ttif_jpeg.obj \\\n\ttif_flush.obj \\\n\ttif_lzw.obj \\\n\ttif_next.obj \\\n\ttif_open.obj \\\n\ttif_packbits.obj \\\n\ttif_predict.obj \\\n\ttif_print.obj \\\n\ttif_read.obj \\\n\ttif_swab.obj \\\n\ttif_strip.obj \\\n\ttif_thunder.obj \\\n\ttif_tile.obj \\\n\ttif_version.obj \\\n\ttif_warning.obj \\\n\ttif_write.obj \\\n\ttif_win32.obj \n\t\n\t\n\nALL=\tlibtiff.lib\n\nall:\t $(ALL)\n\n%.obj : %.c\n\t$(CC) $(CFLAGS) -c $*.c\n\n\n#.INCLUDE .IGNORE : depend\n\nlibtiff.lib: $(OBJS)\n\t - del libtiff.lib\n\t lib /OUT:libtiff.lib $(OBJS)\n\n\n#To include fax3 support, you need to modify mkg3states.c so it could run\n#under windows 95 or NT. This application make the file g3state.h.\n#after that, you have to add to the build script : tif_fax3.c and tif_fax3.obj\n#and define CCITT_SUPPORT in the file tifconf.h\n\n#$(OBJS): tiffio.h tiff.h tiffcomp.h tiffiop.h tiffconf.h\n#tif_fax3.obj: tif_fax3.c g3states.h t4.h tif_fax3.h\n\n#g3states.h: mkg3states.c t4.h\n#\t$(CC) $(CFLAGS) mkg3states.c\n#\tmkg3states -c > g3states.h\n\n\nclean:\n\tdel *.obj\n        del mkg3stat\n        del g3states.h\n\ntags:\t$(SRCS)\n\t$(CTAGS) $(SRCS)\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/win_dib/README.Tiffile",
    "content": "Frank,\n\nI attached a file that uses RGBA interface (tif_getimage.c) to read a tiff\nfile and convert to a DIB.  It's advantage is that it is easy to read *any*\ntiff file suported by libtiff and easily convert it to a DIB.  The disadvantage\nis that bilevel (B&W) bitmaps (and all other non-rgba images) are also \nconverted to RGBA, thus taking up 32x as much memory as needed (4 bytes per \npixel, rather than 1 bit).  I read tiff files, but don't need to\nwrite them.  And my files are typically small, so the overhead is mostly\ninconsequential.  But for bilevel images, I overrode the get() and put()\nroutines of the RGBA interface to just copy the data from the input raster\nto the output raster, rather than expanding out to full 32 bit format.  It\nwould be nice if there were a simple way to handle all palletized images,\nbut that would take more custom routines, and it's not that important to me.\n\nUsage:\n\n    m_pDIB = (PBITMAPINFOHEADER)::ReadTIFF(pathName);\n    if (m_pDIB != 0) {\n       m_format = IMAGETYPE_TIF;\n    }\n\nThis is intended as Win32, but the modifications for new get() and put()\nroutines may be independent of platform.\n\nThanks for your work supporting the forum and the library!\n\nRegards,\n\nMark James\nmark@james.net\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/win_dib/README.tiff2dib",
    "content": "\nDate: 04 Dec 95 10:34:23 EST\nFrom: Philippe <100423.3705@compuserve.com>\nTo: TIFF/sam Leffler <sam@cthulhu.engr.sgi.com>\nSubject: TIFF library and Windows 95\nMessage-Id: <951204153422_100423.3705_BHG101-1@CompuServe.COM>\n\nSam, \n\nFirst, let me thanks all of you how have worked \non that great TIFF library !\n\nHere is some information that may help someone.\n\nI build the library under Windows 95 as a 32-bit library.\nThe contribution of Scott Wagner (tif_win32.c) worked fine, but \nthe makefile \"makefile.msc\" was unsable because it was\nwritten for DOS or Windows 3.1 and all the files names \nare limited to 8 characters.\n\nHere is the makefile I used : makefile.w95\n\nAlso, I had to disable fax3 support because I wasn't able\nto build (as it is) the tool \"mkg3states\" to generate the include\nfile \"g3states.h\". \nThis source file must be modify to be build under Windows 95.\n\nTo build the library under Windows 95 with Visual C++ 2.0, \nI had to :\n\n- undefine CCITT_SUPPORT in \"tiffconf.h\"\n\n- create the file version.h with this line :\n      #define VERSION \"3.4beta024\"\n\n- build the makefile \"makefile.w95\"\n\nI also join the source file \"tif2dib.c\" that I created, \nit contain the function LoadTIFFinDIB that load \na TIFF file and build a memory DIB with it and return the \nHANDLE (HDIB) of the memory bloc containing this DIB.\nSince DIB is the \"natural\" bitmap format for Windows 3.1, 95 and NT,\nthis function sould be usefull for some Windows 95 (or NT) developer.\n\n\nSorry for my approximate english ...\n\nRegards,\n\nPhilippe Tenenhaus   100423.3705@compuserve.com\nParis\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/win_dib/Tiffile.cpp",
    "content": "#include \"StdAfx.h\"\n\n//#define STRICT\n#include <windows.h>\n#include <windowsx.h>\n#include <commdlg.h>\n#include <stdlib.h>                     // MAX_ constants\n#include \"diblib.h\"\n\n/*--------------------------------------------------------------------\n        READ TIFF\n        Load the TIFF data from the file into memory.  Return\n        a pointer to a valid DIB (or NULL for errors).\n        Uses the TIFFRGBA interface to libtiff.lib to convert\n        most file formats to a useable form.  We just keep the 32 bit\n        form of the data to display, rather than optimizing for the\n        display.\n\n        Main entry points:\n\n            int ChkTIFF ( LPCTSTR lpszPath )\n            PVOID ReadTIFF ( LPCTSTR lpszPath )\n\n        RETURN\n            A valid DIB pointer for success; NULL for failure.\n\n  --------------------------------------------------------------------*/\n\n#include \"TiffLib/tiff.h\"\n#include \"TiffLib/tiffio.h\"\n#include <assert.h>\n#include <stdio.h>\n\n\n// piggyback some data on top of the RGBA Image\nstruct TIFFDibImage {\n    TIFFRGBAImage tif;\n    int  dibinstalled;\n} ;\n\n\nHANDLE LoadTIFFinDIB(LPCTSTR lpFileName);\nHANDLE TIFFRGBA2DIB(TIFFDibImage* dib, uint32* raster)  ;\n\nstatic void\nMyWarningHandler(const char* module, const char* fmt, va_list ap)\n{\n    // ignore all warnings (unused tags, etc)\n    return;\n}\n\nstatic void\nMyErrorHandler(const char* module, const char* fmt, va_list ap)\n{\n    return;\n}\n\n//  Turn off the error and warning handlers to check if a valid file.\n//  Necessary because of the way that the Doc loads images and restart files.\nint ChkTIFF ( LPCTSTR lpszPath )\n{\n    int rtn = 0;\n\n    TIFFErrorHandler  eh;\n    TIFFErrorHandler  wh;\n\n    eh = TIFFSetErrorHandler(NULL);\n    wh = TIFFSetWarningHandler(NULL);\n\n    TIFF* tif = TIFFOpen(lpszPath, \"r\");\n    if (tif) {\n        rtn = 1;\n        TIFFClose(tif);\n    }\n\n    TIFFSetErrorHandler(eh);\n    TIFFSetWarningHandler(wh);\n\n    return rtn;\n}\n\nvoid DibInstallHack(TIFFDibImage* img) ;\n\nPVOID ReadTIFF ( LPCTSTR lpszPath )\n{\n    void*             pDIB = 0;\n    TIFFErrorHandler  wh;\n\n    wh = TIFFSetWarningHandler(MyWarningHandler);\n\n    if (ChkTIFF(lpszPath)) {\n        TIFF* tif = TIFFOpen(lpszPath, \"r\");\n        if (tif) {\n            char emsg[1024];\n\n            if (TIFFRGBAImageOK(tif, emsg)) {\n                TIFFDibImage img;\n                char emsg[1024];\n\n                if (TIFFRGBAImageBegin(&img.tif, tif, -1, emsg)) {\n                    size_t npixels;\n                    uint32* raster;\n\n                    DibInstallHack(&img);\n\n                    npixels = img.tif.width * img.tif.height;\n                    raster = (uint32*) _TIFFmalloc(npixels * sizeof (uint32));\n                    if (raster != NULL) {\n                        if (TIFFRGBAImageGet(&img.tif, raster, img.tif.width, img.tif.height)) {\n                            pDIB = TIFFRGBA2DIB(&img, raster);\n                        }\n                    }\n                    _TIFFfree(raster);\n                }\n                TIFFRGBAImageEnd(&img.tif);\n            }\n            else {\n                TRACE(\"Unable to open image(%s): %s\\n\", lpszPath, emsg );\n            }\n            TIFFClose(tif);\n        }\n    }\n\n    TIFFSetWarningHandler(wh);\n\n    return pDIB;\n}\n\n\n\nHANDLE TIFFRGBA2DIB(TIFFDibImage* dib, uint32* raster)\n{\n    void*   pDIB = 0;\n    TIFFRGBAImage* img = &dib->tif;\n\n    uint32 imageLength;\n    uint32 imageWidth;\n    uint16 BitsPerSample;\n    uint16 SamplePerPixel;\n    uint32 RowsPerStrip;\n    uint16 PhotometricInterpretation;\n\n    BITMAPINFOHEADER   bi;\n    int                dwDIBSize ;\n\n    TIFFGetField(img->tif, TIFFTAG_IMAGEWIDTH, &imageWidth);\n    TIFFGetField(img->tif, TIFFTAG_IMAGELENGTH, &imageLength);\n    TIFFGetField(img->tif, TIFFTAG_BITSPERSAMPLE, &BitsPerSample);\n    TIFFGetField(img->tif, TIFFTAG_ROWSPERSTRIP, &RowsPerStrip);\n    TIFFGetField(img->tif, TIFFTAG_SAMPLESPERPIXEL, &SamplePerPixel);\n    TIFFGetField(img->tif, TIFFTAG_PHOTOMETRIC, &PhotometricInterpretation);\n\n    if ( BitsPerSample == 1 && SamplePerPixel == 1 && dib->dibinstalled ) {   // bilevel\n        bi.biSize           = sizeof(BITMAPINFOHEADER);\n        bi.biWidth          = imageWidth;\n        bi.biHeight         = imageLength;\n        bi.biPlanes         = 1;  // always\n        bi.biBitCount       = 1;\n        bi.biCompression    = BI_RGB;\n        bi.biSizeImage      = WIDTHBYTES(bi.biWidth * bi.biBitCount) * bi.biHeight;\n        bi.biXPelsPerMeter  = 0;\n        bi.biYPelsPerMeter  = 0;\n        bi.biClrUsed        = 0;  //  must be zero for RGB compression (none)\n        bi.biClrImportant   = 0;  // always\n\n        // Get the size of the DIB\n        dwDIBSize = GetDIBSize( &bi );\n\n        // Allocate for the BITMAPINFO structure and the color table.\n        pDIB = GlobalAllocPtr( GHND, dwDIBSize );\n        if (pDIB == 0) {\n            return( NULL );\n        }\n\n        // Copy the header info\n        *((BITMAPINFOHEADER*)pDIB) = bi;\n\n        // Get a pointer to the color table\n        RGBQUAD   *pRgbq = (RGBQUAD   *)((LPSTR)pDIB + sizeof(BITMAPINFOHEADER));\n\n        pRgbq[0].rgbRed      = 0;\n        pRgbq[0].rgbBlue     = 0;\n        pRgbq[0].rgbGreen    = 0;\n        pRgbq[0].rgbReserved = 0;\n        pRgbq[1].rgbRed      = 255;\n        pRgbq[1].rgbBlue     = 255;\n        pRgbq[1].rgbGreen    = 255;\n        pRgbq[1].rgbReserved = 255;\n\n        // Pointers to the bits\n        //PVOID pbiBits = (LPSTR)pRgbq + bi.biClrUsed * sizeof(RGBQUAD);\n        //\n        // In the BITMAPINFOHEADER documentation, it appears that\n        // there should be no color table for 32 bit images, but\n        // experience shows that the image is off by 3 words if it\n        // is not included.  So here it is.\n        PVOID pbiBits = GetDIBImagePtr((BITMAPINFOHEADER*)pDIB);  //(LPSTR)pRgbq + 3 * sizeof(RGBQUAD);\n\n        int       sizeWords = bi.biSizeImage/4;\n        RGBQUAD*  rgbDib = (RGBQUAD*)pbiBits;\n        long*     rgbTif = (long*)raster;\n\n        _TIFFmemcpy(pbiBits, raster, bi.biSizeImage);\n    }\n\n        //  For now just always default to the RGB 32 bit form.                                                       // save as 32 bit for simplicity\n    else if ( true /*BitsPerSample == 8 && SamplePerPixel == 3*/ ) {   // 24 bit color\n\n        bi.biSize           = sizeof(BITMAPINFOHEADER);\n        bi.biWidth          = imageWidth;\n        bi.biHeight         = imageLength;\n        bi.biPlanes         = 1;  // always\n        bi.biBitCount       = 32;\n        bi.biCompression    = BI_RGB;\n        bi.biSizeImage      = WIDTHBYTES(bi.biWidth * bi.biBitCount) * bi.biHeight;\n        bi.biXPelsPerMeter  = 0;\n        bi.biYPelsPerMeter  = 0;\n        bi.biClrUsed        = 0;  //  must be zero for RGB compression (none)\n        bi.biClrImportant   = 0;  // always\n\n        // Get the size of the DIB\n        dwDIBSize = GetDIBSize( &bi );\n\n        // Allocate for the BITMAPINFO structure and the color table.\n        pDIB = GlobalAllocPtr( GHND, dwDIBSize );\n        if (pDIB == 0) {\n            return( NULL );\n        }\n\n        // Copy the header info\n        *((BITMAPINFOHEADER*)pDIB) = bi;\n\n        // Get a pointer to the color table\n        RGBQUAD   *pRgbq = (RGBQUAD   *)((LPSTR)pDIB + sizeof(BITMAPINFOHEADER));\n\n        // Pointers to the bits\n        //PVOID pbiBits = (LPSTR)pRgbq + bi.biClrUsed * sizeof(RGBQUAD);\n        //\n        // In the BITMAPINFOHEADER documentation, it appears that\n        // there should be no color table for 32 bit images, but\n        // experience shows that the image is off by 3 words if it\n        // is not included.  So here it is.\n        PVOID pbiBits = (LPSTR)pRgbq + 3 * sizeof(RGBQUAD);\n\n        int       sizeWords = bi.biSizeImage/4;\n        RGBQUAD*  rgbDib = (RGBQUAD*)pbiBits;\n        long*     rgbTif = (long*)raster;\n\n        // Swap the byte order while copying\n        for ( int i = 0 ; i < sizeWords ; ++i )\n        {\n            rgbDib[i].rgbRed   = TIFFGetR(rgbTif[i]);\n            rgbDib[i].rgbBlue  = TIFFGetB(rgbTif[i]);\n            rgbDib[i].rgbGreen = TIFFGetG(rgbTif[i]);\n            rgbDib[i].rgbReserved = 0;\n        }\n    }\n\n    return pDIB;\n}\n\n\n\n\n///////////////////////////////////////////////////////////////\n//\n//  Hacked from tif_getimage.c in libtiff in v3.5.7\n//\n//\ntypedef unsigned char u_char;\n\n\n#define DECLAREContigPutFunc(name) \\\nstatic void name(\\\n    TIFFRGBAImage* img, \\\n    uint32* cp, \\\n    uint32 x, uint32 y, \\\n    uint32 w, uint32 h, \\\n    int32 fromskew, int32 toskew, \\\n    u_char* pp \\\n)\n\n#define DECLARESepPutFunc(name) \\\nstatic void name(\\\n    TIFFRGBAImage* img,\\\n    uint32* cp,\\\n    uint32 x, uint32 y, \\\n    uint32 w, uint32 h,\\\n    int32 fromskew, int32 toskew,\\\n    u_char* r, u_char* g, u_char* b, u_char* a\\\n)\n\nDECLAREContigPutFunc(putContig1bitTile);\nstatic int getStripContig1Bit(TIFFRGBAImage* img, uint32* uraster, uint32 w, uint32 h);\n\n//typdef struct TIFFDibImage {\n//    TIFFRGBAImage tif;\n//    dibinstalled;\n//} TIFFDibImage ;\n\nvoid DibInstallHack(TIFFDibImage* dib) {\n    TIFFRGBAImage* img = &dib->tif;\n    dib->dibinstalled = false;\n    switch (img->photometric) {\n        case PHOTOMETRIC_MINISWHITE:\n        case PHOTOMETRIC_MINISBLACK:\n        switch (img->bitspersample) {\n            case 1:\n                img->put.contig = putContig1bitTile;\n                img->get = getStripContig1Bit;\n                dib->dibinstalled = true;\n                break;\n        }\n        break;\n    }\n}\n\n/*\n * 1-bit packed samples => 1-bit\n *\n *   Override to just copy the data\n */\nDECLAREContigPutFunc(putContig1bitTile)\n{\n    int samplesperpixel = img->samplesperpixel;\n\n    (void) y;\n    fromskew *= samplesperpixel;\n    int wb = WIDTHBYTES(w);\n    u_char*  ucp = (u_char*)cp;\n\n    /* Conver 'w' to bytes from pixels (rounded up) */\n    w = (w+7)/8;\n\n    while (h-- > 0) {\n        _TIFFmemcpy(ucp, pp, w);\n        /*\n        for (x = wb; x-- > 0;) {\n            *cp++ = rgbi(Map[pp[0]], Map[pp[1]], Map[pp[2]]);\n            pp += samplesperpixel;\n        }\n        */\n        ucp += (wb + toskew);\n        pp += (w + fromskew);\n    }\n}\n\n/*\n *  Hacked from the tif_getimage.c file.\n */\nstatic uint32\nsetorientation(TIFFRGBAImage* img, uint32 h)\n{\n    TIFF* tif = img->tif;\n    uint32 y;\n\n    switch (img->orientation) {\n    case ORIENTATION_BOTRIGHT:\n    case ORIENTATION_RIGHTBOT:  /* XXX */\n    case ORIENTATION_LEFTBOT:   /* XXX */\n    TIFFWarning(TIFFFileName(tif), \"using bottom-left orientation\");\n    img->orientation = ORIENTATION_BOTLEFT;\n    /* fall thru... */\n    case ORIENTATION_BOTLEFT:\n    y = 0;\n    break;\n    case ORIENTATION_TOPRIGHT:\n    case ORIENTATION_RIGHTTOP:  /* XXX */\n    case ORIENTATION_LEFTTOP:   /* XXX */\n    default:\n    TIFFWarning(TIFFFileName(tif), \"using top-left orientation\");\n    img->orientation = ORIENTATION_TOPLEFT;\n    /* fall thru... */\n    case ORIENTATION_TOPLEFT:\n    y = h-1;\n    break;\n    }\n    return (y);\n}\n\n/*\n * Get a strip-organized image that has\n *  PlanarConfiguration contiguous if SamplesPerPixel > 1\n * or\n *  SamplesPerPixel == 1\n *\n *  Hacked from the tif_getimage.c file.\n *\n *    This is set up to allow us to just copy the data to the raster\n *    for 1-bit bitmaps\n */\nstatic int\ngetStripContig1Bit(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)\n{\n    TIFF* tif = img->tif;\n    tileContigRoutine put = img->put.contig;\n    uint16 orientation;\n    uint32 row, y, nrow, rowstoread;\n    uint32 pos;\n    u_char* buf;\n    uint32 rowsperstrip;\n    uint32 imagewidth = img->width;\n    tsize_t scanline;\n    int32 fromskew, toskew;\n    tstrip_t strip;\n    tsize_t  stripsize;\n    u_char* braster = (u_char*)raster; // byte wide raster\n    uint32  wb = WIDTHBYTES(w);\n    int ret = 1;\n\n    buf = (u_char*) _TIFFmalloc(TIFFStripSize(tif));\n    if (buf == 0) {\n        TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), \"No space for strip buffer\");\n        return (0);\n    }\n    y = setorientation(img, h);\n    orientation = img->orientation;\n    toskew = -(int32) (orientation == ORIENTATION_TOPLEFT ? wb+wb : wb-wb);\n    TIFFGetFieldDefaulted(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);\n    scanline = TIFFScanlineSize(tif);\n    fromskew = (w < imagewidth ? imagewidth - w : 0)/8;\n    for (row = 0; row < h; row += nrow)\n    {\n        rowstoread = rowsperstrip - (row + img->row_offset) % rowsperstrip;\n        nrow = (row + rowstoread > h ? h - row : rowstoread);\n        strip = TIFFComputeStrip(tif,row+img->row_offset, 0);\n        stripsize = ((row + img->row_offset)%rowsperstrip + nrow) * scanline;\n        if (TIFFReadEncodedStrip(tif, strip, buf, stripsize ) < 0\n            && img->stoponerr)\n        {\n            ret = 0;\n            break;\n        }\n\n        pos = ((row + img->row_offset) % rowsperstrip) * scanline;\n        (*put)(img, (uint32*)(braster+y*wb), 0, y, w, nrow, fromskew, toskew, buf + pos);\n        y += (orientation == ORIENTATION_TOPLEFT ?-(int32) nrow : (int32) nrow);\n    }\n    _TIFFfree(buf);\n    return (ret);\n}\n\n"
  },
  {
    "path": "src/main/jni/tiff/contrib/win_dib/tiff2dib.c",
    "content": "/*************************************************************************\n *\n * Source file for Windows 95/Win32. \n *\n * The function LoadTIFFinDIB in this source file let you load \n * a TIFF file and build a memory DIB with it and return the \n * HANDLE (HDIB) of the memory bloc containing the DIB.\n *\n *  Example : \n * \n *   HDIB   hDIB;\n *   hDIB = LoadTIFFinDIB(\"sample.tif\");\n *\n *\n * To build this source file you must include the TIFF library   \n * in your project.\n *\n * 4/12/95   Philippe Tenenhaus   100423.3705@compuserve.com\n *\n ************************************************************************/\n\n\n#include \"tiffio.h\" \n\n#define HDIB HANDLE\n#define IS_WIN30_DIB(lpbi)  ((*(LPDWORD)(lpbi)) == sizeof(BITMAPINFOHEADER))\n#define CVT(x)      (((x) * 255L) / ((1L<<16)-1))\n\nstatic HDIB CreateDIB(DWORD dwWidth, DWORD dwHeight, WORD wBitCount);\nstatic LPSTR FindDIBBits(LPSTR lpDIB);\nstatic WORD PaletteSize(LPSTR lpDIB);\nstatic WORD DIBNumColors(LPSTR lpDIB);\nstatic int checkcmap(int n, uint16* r, uint16* g, uint16* b);\n\n\n\n/*************************************************************************\n *\n * HDIB LoadTIFFinDIB(LPSTR lpFileName) \n *\n * Parameter:\n *\n * LPSTR lpDIB      - File name of a tiff imag\n *\n * Return Value:\n *\n * LPSTR            - HANDLE of a DIB\n *\n * Description:\n *\n * This function load a TIFF file and build a memory DIB with it\n * and return the HANDLE (HDIB) of the memory bloc containing\n * the DIB.\n *\n * 4/12/95   Philippe Tenenhaus   100423.3705@compuserve.com\n *\n ************************************************************************/\n\nHDIB LoadTIFFinDIB(LPSTR lpFileName)    \n{\n    TIFF          *tif;\n    unsigned long imageLength; \n    unsigned long imageWidth; \n    unsigned int  BitsPerSample;\n    unsigned long LineSize;\n    unsigned int  SamplePerPixel;\n    unsigned long RowsPerStrip;  \n    int           PhotometricInterpretation;\n    long          nrow;\n\tunsigned long row;\n    char          *buf;          \n    LPBITMAPINFOHEADER lpDIB; \n    HDIB          hDIB;\n    char          *lpBits;\n    HGLOBAL       hStrip;\n    int           i,l;\n    int           Align; \n    \n    tif = TIFFOpen(lpFileName, \"r\");\n    \n    if (!tif)\n        goto TiffOpenError;\n    \n    TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &imageWidth);\n    TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &imageLength);  \n    TIFFGetField(tif, TIFFTAG_BITSPERSAMPLE, &BitsPerSample);\n    TIFFGetField(tif, TIFFTAG_ROWSPERSTRIP, &RowsPerStrip);  \n    TIFFGetField(tif, TIFFTAG_ROWSPERSTRIP, &RowsPerStrip);   \n    TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &PhotometricInterpretation);\n           \n    LineSize = TIFFScanlineSize(tif); //Number of byte in ine line\n\n    SamplePerPixel = (int) (LineSize/imageWidth);\n\n    //Align = Number of byte to add at the end of each line of the DIB\n    Align = 4 - (LineSize % 4);\n    if (Align == 4)\tAlign = 0;\n\n    \n    //Create a new DIB\n    hDIB = CreateDIB((DWORD) imageWidth, (DWORD) imageLength, (WORD)\n(BitsPerSample*SamplePerPixel));\n    lpDIB  = (LPBITMAPINFOHEADER) GlobalLock(hDIB);\n    if (!lpDIB)\n          goto OutOfDIBMemory;\n          \n    if (lpDIB)\n       lpBits = FindDIBBits((LPSTR) lpDIB);\n\n    //In the tiff file the lines are save from up to down \n\t//In a DIB the lines must be save from down to up\n    if (lpBits)\n      {\n        lpBits = FindDIBBits((LPSTR) lpDIB);\n        lpBits+=((imageWidth*SamplePerPixel)+Align)*(imageLength-1);\n\t\t//now lpBits pointe on the bottom line\n        \n        hStrip = GlobalAlloc(GHND,TIFFStripSize(tif));\n        buf = GlobalLock(hStrip);           \n        \n        if (!buf)\n           goto OutOfBufMemory;\n        \n        //PhotometricInterpretation = 2 image is RGB\n        //PhotometricInterpretation = 3 image have a color palette              \n        if (PhotometricInterpretation == 3)\n        {\n          uint16* red;\n          uint16* green;\n          uint16* blue;\n          int16 i;\n          LPBITMAPINFO lpbmi;   \n          int   Palette16Bits;          \n           \n          TIFFGetField(tif, TIFFTAG_COLORMAP, &red, &green, &blue); \n\n\t\t  //Is the palette 16 or 8 bits ?\n          if (checkcmap(1<<BitsPerSample, red, green, blue) == 16) \n             Palette16Bits = TRUE;\n          else\n             Palette16Bits = FALSE;\n             \n          lpbmi = (LPBITMAPINFO)lpDIB;                      \n                \n          //load the palette in the DIB\n          for (i = (1<<BitsPerSample)-1; i >= 0; i--) \n            {             \n             if (Palette16Bits)\n                {\n                  lpbmi->bmiColors[i].rgbRed =(BYTE) CVT(red[i]);\n                  lpbmi->bmiColors[i].rgbGreen = (BYTE) CVT(green[i]);\n                  lpbmi->bmiColors[i].rgbBlue = (BYTE) CVT(blue[i]);           \n                }\n             else\n                {\n                  lpbmi->bmiColors[i].rgbRed = (BYTE) red[i];\n                  lpbmi->bmiColors[i].rgbGreen = (BYTE) green[i];\n                  lpbmi->bmiColors[i].rgbBlue = (BYTE) blue[i];        \n                }\n            }  \n                 \n        }\n        \n        //read the tiff lines and save them in the DIB\n\t\t//with RGB mode, we have to change the order of the 3 samples RGB\n<=> BGR\n        for (row = 0; row < imageLength; row += RowsPerStrip) \n          {     \n            nrow = (row + RowsPerStrip > imageLength ? imageLength - row :\nRowsPerStrip);\n            if (TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, row, 0),\n                buf, nrow*LineSize)==-1)\n                  {\n                     goto TiffReadError;\n                  } \n            else\n                  {  \n                    for (l = 0; l < nrow; l++) \n                      {\n                         if (SamplePerPixel  == 3)\n                           for (i=0;i< (int) (imageWidth);i++)\n                              {\n                               lpBits[i*SamplePerPixel+0]=buf[l*LineSize+i*Sample\nPerPixel+2]; \n                               lpBits[i*SamplePerPixel+1]=buf[l*LineSize+i*Sample\nPerPixel+1];\n                               lpBits[i*SamplePerPixel+2]=buf[l*LineSize+i*Sample\nPerPixel+0];\n                              }\n                         else\n                           memcpy(lpBits, &buf[(int) (l*LineSize)], (int)\nimageWidth*SamplePerPixel); \n                          \n                         lpBits-=imageWidth*SamplePerPixel+Align;\n\n                      }\n                 }\n          }\n        GlobalUnlock(hStrip);\n        GlobalFree(hStrip);\n        GlobalUnlock(hDIB); \n        TIFFClose(tif);\n      }\n      \n    return hDIB;\n    \n    OutOfBufMemory:\n       \n    TiffReadError:\n       GlobalUnlock(hDIB); \n       GlobalFree(hStrip);\n    OutOfDIBMemory:\n       TIFFClose(tif);\n    TiffOpenError:\n       return (HANDLE) 0;\n       \n         \n}\n\n\nstatic int checkcmap(int n, uint16* r, uint16* g, uint16* b)\n{\n    while (n-- > 0)\n        if (*r++ >= 256 || *g++ >= 256 || *b++ >= 256)\n        return (16);\n    \n    return (8);\n}\n\n\n\n/*************************************************************************\n * All the following functions were created by microsoft, they are\n * parts of the sample project \"wincap\" given with the SDK Win32.\n *\n * Microsoft says that :\n *\n *  You have a royalty-free right to use, modify, reproduce and\n *  distribute the Sample Files (and/or any modified version) in\n *  any way you find useful, provided that you agree that\n *  Microsoft has no warranty obligations or liability for any\n *  Sample Application Files which are modified.\n *\n ************************************************************************/\n\nHDIB CreateDIB(DWORD dwWidth, DWORD dwHeight, WORD wBitCount)\n{\n   BITMAPINFOHEADER bi;         // bitmap header\n   LPBITMAPINFOHEADER lpbi;     // pointer to BITMAPINFOHEADER\n   DWORD dwLen;                 // size of memory block\n   HDIB hDIB;\n   DWORD dwBytesPerLine;        // Number of bytes per scanline\n\n\n   // Make sure bits per pixel is valid\n   if (wBitCount <= 1)\n      wBitCount = 1;\n   else if (wBitCount <= 4)\n      wBitCount = 4;\n   else if (wBitCount <= 8)\n      wBitCount = 8;\n   else if (wBitCount <= 24)\n      wBitCount = 24;\n   else\n      wBitCount = 4;  // set default value to 4 if parameter is bogus\n\n   // initialize BITMAPINFOHEADER\n   bi.biSize = sizeof(BITMAPINFOHEADER);\n   bi.biWidth = dwWidth;         // fill in width from parameter\n   bi.biHeight = dwHeight;       // fill in height from parameter\n   bi.biPlanes = 1;              // must be 1\n   bi.biBitCount = wBitCount;    // from parameter\n   bi.biCompression = BI_RGB;    \n   bi.biSizeImage = (dwWidth*dwHeight*wBitCount)/8; //0;           // 0's here\nmean \"default\"\n   bi.biXPelsPerMeter = 2834; //0;\n   bi.biYPelsPerMeter = 2834; //0;\n   bi.biClrUsed = 0;\n   bi.biClrImportant = 0;\n\n   // calculate size of memory block required to store the DIB.  This\n   // block should be big enough to hold the BITMAPINFOHEADER, the color\n   // table, and the bits\n\n   dwBytesPerLine =   (((wBitCount * dwWidth) + 31) / 32 * 4);\n   dwLen = bi.biSize + PaletteSize((LPSTR)&bi) + (dwBytesPerLine * dwHeight);\n\n   // alloc memory block to store our bitmap\n   hDIB = GlobalAlloc(GHND, dwLen);\n\n   // major bummer if we couldn't get memory block\n   if (!hDIB)\n   {\n      return NULL;\n   }\n\n   // lock memory and get pointer to it\n   lpbi = (VOID FAR *)GlobalLock(hDIB);\n\n   // use our bitmap info structure to fill in first part of\n   // our DIB with the BITMAPINFOHEADER\n   *lpbi = bi;\n\n   // Since we don't know what the colortable and bits should contain,\n   // just leave these blank.  Unlock the DIB and return the HDIB.\n\n   GlobalUnlock(hDIB);\n\n   /* return handle to the DIB */\n   return hDIB;\n}\n\n\nLPSTR FAR FindDIBBits(LPSTR lpDIB)\n{\n   return (lpDIB + *(LPDWORD)lpDIB + PaletteSize(lpDIB));\n}\n\n\nWORD FAR PaletteSize(LPSTR lpDIB)\n{\n   /* calculate the size required by the palette */\n   if (IS_WIN30_DIB (lpDIB))\n      return (DIBNumColors(lpDIB) * sizeof(RGBQUAD));\n   else\n      return (DIBNumColors(lpDIB) * sizeof(RGBTRIPLE));\n}\n\n\nWORD DIBNumColors(LPSTR lpDIB)\n{\n   WORD wBitCount;  // DIB bit count\n\n   /*  If this is a Windows-style DIB, the number of colors in the\n    *  color table can be less than the number of bits per pixel\n    *  allows for (i.e. lpbi->biClrUsed can be set to some value).\n    *  If this is the case, return the appropriate value.\n    */\n\n   if (IS_WIN30_DIB(lpDIB))\n   {\n      DWORD dwClrUsed;\n\n      dwClrUsed = ((LPBITMAPINFOHEADER)lpDIB)->biClrUsed;\n      if (dwClrUsed)\n     return (WORD)dwClrUsed;\n   }\n\n   /*  Calculate the number of colors in the color table based on\n    *  the number of bits per pixel for the DIB.\n    */\n   if (IS_WIN30_DIB(lpDIB))\n      wBitCount = ((LPBITMAPINFOHEADER)lpDIB)->biBitCount;\n   else\n      wBitCount = ((LPBITMAPCOREHEADER)lpDIB)->bcBitCount;\n\n   /* return number of colors based on bits per pixel */\n   switch (wBitCount)\n      {\n   case 1:\n      return 2;\n\n   case 4:\n      return 16;\n\n   case 8:\n      return 256;\n\n   default:\n      return 0;\n      }\n}\n"
  },
  {
    "path": "src/main/jni/tiff/html/Makefile.am",
    "content": "# $Id: Makefile.am,v 1.16.2.1 2007/07/13 13:40:12 dron Exp $\n#\n# Tag Image File Format (TIFF) Software\n#\n# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>\n#\n# Permission to use, copy, modify, distribute, and sell this software and \n# its documentation for any purpose is hereby granted without fee, provided\n# that (i) the above copyright notices and this permission notice appear in\n# all copies of the software and related documentation, and (ii) the names of\n# Sam Leffler and Silicon Graphics may not be used in any advertising or\n# publicity relating to the software without the specific, prior written\n# permission of Sam Leffler and Silicon Graphics.\n# \n# THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n# \n# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n# OF THIS SOFTWARE.\n\n# Process this file with automake to produce Makefile.in.\n\ndocdir = $(LIBTIFF_DOCDIR)/html\n\ndocfiles = \\\n\taddingtags.html \\\n\tbugs.html \\\n\tbuild.html \\\n\tcontrib.html \\\n\tdocument.html \\\n\timages.html \\\n\tindex.html \\\n\tinternals.html \\\n\tintro.html \\\n\tlibtiff.html \\\n\tmisc.html \\\n\tsupport.html \\\n\tTIFFTechNote2.html \\\n\ttools.html \\\n\tv3.4beta007.html \\\n\tv3.4beta016.html \\\n\tv3.4beta018.html \\\n\tv3.4beta024.html \\\n\tv3.4beta028.html \\\n\tv3.4beta029.html \\\n\tv3.4beta031.html \\\n\tv3.4beta032.html \\\n\tv3.4beta033.html \\\n\tv3.4beta034.html \\\n\tv3.4beta035.html \\\n\tv3.4beta036.html \\\n\tv3.5.1.html \\\n\tv3.5.2.html \\\n\tv3.5.3.html \\\n\tv3.5.4.html \\\n\tv3.5.5.html \\\n\tv3.5.6-beta.html \\\n\tv3.5.7.html \\\n\tv3.6.0.html \\\n\tv3.6.1.html \\\n\tv3.7.0alpha.html \\\n\tv3.7.0beta.html \\\n\tv3.7.0beta2.html \\\n\tv3.7.0.html \\\n\tv3.7.1.html \\\n\tv3.7.2.html \\\n\tv3.7.3.html \\\n\tv3.7.4.html \\\n\tv3.8.0.html \\\n\tv3.8.1.html \\\n\tv3.8.2.html \\\n\tv3.9.0beta.html \\\n\tv3.9.1.html \\\n\tv3.9.2.html\n\ndist_doc_DATA = $(docfiles)\n\nSUBDIRS = images man\n\n"
  },
  {
    "path": "src/main/jni/tiff/html/Makefile.in",
    "content": "# Makefile.in generated by automake 1.11 from Makefile.am.\n# @configure_input@\n\n# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,\n# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,\n# Inc.\n# This Makefile.in is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY, to the extent permitted by law; without\n# even the implied warranty of MERCHANTABILITY or FITNESS FOR A\n# PARTICULAR PURPOSE.\n\n@SET_MAKE@\n\n# $Id: Makefile.am,v 1.16.2.1 2007/07/13 13:40:12 dron Exp $\n#\n# Tag Image File Format (TIFF) Software\n#\n# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>\n#\n# Permission to use, copy, modify, distribute, and sell this software and \n# its documentation for any purpose is hereby granted without fee, provided\n# that (i) the above copyright notices and this permission notice appear in\n# all copies of the software and related documentation, and (ii) the names of\n# Sam Leffler and Silicon Graphics may not be used in any advertising or\n# publicity relating to the software without the specific, prior written\n# permission of Sam Leffler and Silicon Graphics.\n# \n# THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n# \n# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n# OF THIS SOFTWARE.\n\n# Process this file with automake to produce Makefile.in.\n\nVPATH = @srcdir@\npkgdatadir = $(datadir)/@PACKAGE@\npkgincludedir = $(includedir)/@PACKAGE@\npkglibdir = $(libdir)/@PACKAGE@\npkglibexecdir = $(libexecdir)/@PACKAGE@\nam__cd = CDPATH=\"$${ZSH_VERSION+.}$(PATH_SEPARATOR)\" && cd\ninstall_sh_DATA = $(install_sh) -c -m 644\ninstall_sh_PROGRAM = $(install_sh) -c\ninstall_sh_SCRIPT = $(install_sh) -c\nINSTALL_HEADER = $(INSTALL_DATA)\ntransform = $(program_transform_name)\nNORMAL_INSTALL = :\nPRE_INSTALL = :\nPOST_INSTALL = :\nNORMAL_UNINSTALL = :\nPRE_UNINSTALL = :\nPOST_UNINSTALL = :\nbuild_triplet = @build@\nhost_triplet = @host@\ntarget_triplet = @target@\nsubdir = html\nDIST_COMMON = $(dist_doc_DATA) $(srcdir)/Makefile.am \\\n\t$(srcdir)/Makefile.in\nACLOCAL_M4 = $(top_srcdir)/aclocal.m4\nam__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \\\n\t$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \\\n\t$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \\\n\t$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac\nam__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \\\n\t$(ACLOCAL_M4)\nmkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs\nCONFIG_HEADER = $(top_builddir)/libtiff/tif_config.h \\\n\t$(top_builddir)/libtiff/tiffconf.h\nCONFIG_CLEAN_FILES =\nCONFIG_CLEAN_VPATH_FILES =\nAM_V_GEN = $(am__v_GEN_$(V))\nam__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))\nam__v_GEN_0 = @echo \"  GEN   \" $@;\nAM_V_at = $(am__v_at_$(V))\nam__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))\nam__v_at_0 = @\nSOURCES =\nDIST_SOURCES =\nRECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \\\n\thtml-recursive info-recursive install-data-recursive \\\n\tinstall-dvi-recursive install-exec-recursive \\\n\tinstall-html-recursive install-info-recursive \\\n\tinstall-pdf-recursive install-ps-recursive install-recursive \\\n\tinstallcheck-recursive installdirs-recursive pdf-recursive \\\n\tps-recursive uninstall-recursive\nam__vpath_adj_setup = srcdirstrip=`echo \"$(srcdir)\" | sed 's|.|.|g'`;\nam__vpath_adj = case $$p in \\\n    $(srcdir)/*) f=`echo \"$$p\" | sed \"s|^$$srcdirstrip/||\"`;; \\\n    *) f=$$p;; \\\n  esac;\nam__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;\nam__install_max = 40\nam__nobase_strip_setup = \\\n  srcdirstrip=`echo \"$(srcdir)\" | sed 's/[].[^$$\\\\*|]/\\\\\\\\&/g'`\nam__nobase_strip = \\\n  for p in $$list; do echo \"$$p\"; done | sed -e \"s|$$srcdirstrip/||\"\nam__nobase_list = $(am__nobase_strip_setup); \\\n  for p in $$list; do echo \"$$p $$p\"; done | \\\n  sed \"s| $$srcdirstrip/| |;\"' / .*\\//!s/ .*/ ./; s,\\( .*\\)/[^/]*$$,\\1,' | \\\n  $(AWK) 'BEGIN { files[\".\"] = \"\" } { files[$$2] = files[$$2] \" \" $$1; \\\n    if (++n[$$2] == $(am__install_max)) \\\n      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = \"\" } } \\\n    END { for (dir in files) print dir, files[dir] }'\nam__base_list = \\\n  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\\n/ /g' | \\\n  sed '$$!N;$$!N;$$!N;$$!N;s/\\n/ /g'\nam__installdirs = \"$(DESTDIR)$(docdir)\"\nDATA = $(dist_doc_DATA)\nRECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive\t\\\n  distclean-recursive maintainer-clean-recursive\nAM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \\\n\t$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \\\n\tdistdir\nETAGS = etags\nCTAGS = ctags\nDIST_SUBDIRS = $(SUBDIRS)\nDISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)\nam__relativize = \\\n  dir0=`pwd`; \\\n  sed_first='s,^\\([^/]*\\)/.*$$,\\1,'; \\\n  sed_rest='s,^[^/]*/*,,'; \\\n  sed_last='s,^.*/\\([^/]*\\)$$,\\1,'; \\\n  sed_butlast='s,/*[^/]*$$,,'; \\\n  while test -n \"$$dir1\"; do \\\n    first=`echo \"$$dir1\" | sed -e \"$$sed_first\"`; \\\n    if test \"$$first\" != \".\"; then \\\n      if test \"$$first\" = \"..\"; then \\\n        dir2=`echo \"$$dir0\" | sed -e \"$$sed_last\"`/\"$$dir2\"; \\\n        dir0=`echo \"$$dir0\" | sed -e \"$$sed_butlast\"`; \\\n      else \\\n        first2=`echo \"$$dir2\" | sed -e \"$$sed_first\"`; \\\n        if test \"$$first2\" = \"$$first\"; then \\\n          dir2=`echo \"$$dir2\" | sed -e \"$$sed_rest\"`; \\\n        else \\\n          dir2=\"../$$dir2\"; \\\n        fi; \\\n        dir0=\"$$dir0\"/\"$$first\"; \\\n      fi; \\\n    fi; \\\n    dir1=`echo \"$$dir1\" | sed -e \"$$sed_rest\"`; \\\n  done; \\\n  reldir=\"$$dir2\"\nACLOCAL = @ACLOCAL@\nAMTAR = @AMTAR@\nAM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@\nAR = @AR@\nAS = @AS@\nAUTOCONF = @AUTOCONF@\nAUTOHEADER = @AUTOHEADER@\nAUTOMAKE = @AUTOMAKE@\nAWK = @AWK@\nCC = @CC@\nCCDEPMODE = @CCDEPMODE@\nCFLAGS = @CFLAGS@\nCPP = @CPP@\nCPPFLAGS = @CPPFLAGS@\nCXX = @CXX@\nCXXCPP = @CXXCPP@\nCXXDEPMODE = @CXXDEPMODE@\nCXXFLAGS = @CXXFLAGS@\nCYGPATH_W = @CYGPATH_W@\nDEFS = @DEFS@\nDEPDIR = @DEPDIR@\nDLLTOOL = @DLLTOOL@\nDSYMUTIL = @DSYMUTIL@\nDUMPBIN = @DUMPBIN@\nECHO_C = @ECHO_C@\nECHO_N = @ECHO_N@\nECHO_T = @ECHO_T@\nEGREP = @EGREP@\nEXEEXT = @EXEEXT@\nFGREP = @FGREP@\nGLUT_CFLAGS = @GLUT_CFLAGS@\nGLUT_LIBS = @GLUT_LIBS@\nGLU_CFLAGS = @GLU_CFLAGS@\nGLU_LIBS = @GLU_LIBS@\nGL_CFLAGS = @GL_CFLAGS@\nGL_LIBS = @GL_LIBS@\nGREP = @GREP@\nINSTALL = @INSTALL@\nINSTALL_DATA = @INSTALL_DATA@\nINSTALL_PROGRAM = @INSTALL_PROGRAM@\nINSTALL_SCRIPT = @INSTALL_SCRIPT@\nINSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@\nLD = @LD@\nLDFLAGS = @LDFLAGS@\nLIBDIR = @LIBDIR@\nLIBOBJS = @LIBOBJS@\nLIBS = @LIBS@\nLIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@\nLIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@\nLIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@\nLIBTIFF_MICRO_VERSION = @LIBTIFF_MICRO_VERSION@\nLIBTIFF_MINOR_VERSION = @LIBTIFF_MINOR_VERSION@\nLIBTIFF_RELEASE_DATE = @LIBTIFF_RELEASE_DATE@\nLIBTIFF_VERSION = @LIBTIFF_VERSION@\nLIBTIFF_VERSION_INFO = @LIBTIFF_VERSION_INFO@\nLIBTOOL = @LIBTOOL@\nLIPO = @LIPO@\nLN_S = @LN_S@\nLTLIBOBJS = @LTLIBOBJS@\nMAINT = @MAINT@\nMAKEINFO = @MAKEINFO@\nMKDIR_P = @MKDIR_P@\nNM = @NM@\nNMEDIT = @NMEDIT@\nOBJDUMP = @OBJDUMP@\nOBJEXT = @OBJEXT@\nOTOOL = @OTOOL@\nOTOOL64 = @OTOOL64@\nPACKAGE = @PACKAGE@\nPACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@\nPACKAGE_NAME = @PACKAGE_NAME@\nPACKAGE_STRING = @PACKAGE_STRING@\nPACKAGE_TARNAME = @PACKAGE_TARNAME@\nPACKAGE_URL = @PACKAGE_URL@\nPACKAGE_VERSION = @PACKAGE_VERSION@\nPATH_SEPARATOR = @PATH_SEPARATOR@\nPTHREAD_CC = @PTHREAD_CC@\nPTHREAD_CFLAGS = @PTHREAD_CFLAGS@\nPTHREAD_LIBS = @PTHREAD_LIBS@\nRANLIB = @RANLIB@\nSED = @SED@\nSET_MAKE = @SET_MAKE@\nSHELL = @SHELL@\nSTRIP = @STRIP@\nVERSION = @VERSION@\nXMKMF = @XMKMF@\nX_CFLAGS = @X_CFLAGS@\nX_EXTRA_LIBS = @X_EXTRA_LIBS@\nX_LIBS = @X_LIBS@\nX_PRE_LIBS = @X_PRE_LIBS@\nabs_builddir = @abs_builddir@\nabs_srcdir = @abs_srcdir@\nabs_top_builddir = @abs_top_builddir@\nabs_top_srcdir = @abs_top_srcdir@\nac_ct_CC = @ac_ct_CC@\nac_ct_CXX = @ac_ct_CXX@\nac_ct_DUMPBIN = @ac_ct_DUMPBIN@\nacx_pthread_config = @acx_pthread_config@\nam__include = @am__include@\nam__leading_dot = @am__leading_dot@\nam__quote = @am__quote@\nam__tar = @am__tar@\nam__untar = @am__untar@\nbindir = @bindir@\nbuild = @build@\nbuild_alias = @build_alias@\nbuild_cpu = @build_cpu@\nbuild_os = @build_os@\nbuild_vendor = @build_vendor@\nbuilddir = @builddir@\ndatadir = @datadir@\ndatarootdir = @datarootdir@\ndocdir = $(LIBTIFF_DOCDIR)/html\ndvidir = @dvidir@\nexec_prefix = @exec_prefix@\nhost = @host@\nhost_alias = @host_alias@\nhost_cpu = @host_cpu@\nhost_os = @host_os@\nhost_vendor = @host_vendor@\nhtmldir = @htmldir@\nincludedir = @includedir@\ninfodir = @infodir@\ninstall_sh = @install_sh@\nlibdir = @libdir@\nlibexecdir = @libexecdir@\nlocaledir = @localedir@\nlocalstatedir = @localstatedir@\nlt_ECHO = @lt_ECHO@\nmandir = @mandir@\nmkdir_p = @mkdir_p@\noldincludedir = @oldincludedir@\npdfdir = @pdfdir@\nprefix = @prefix@\nprogram_transform_name = @program_transform_name@\npsdir = @psdir@\nsbindir = @sbindir@\nsharedstatedir = @sharedstatedir@\nsrcdir = @srcdir@\nsysconfdir = @sysconfdir@\ntarget = @target@\ntarget_alias = @target_alias@\ntarget_cpu = @target_cpu@\ntarget_os = @target_os@\ntarget_vendor = @target_vendor@\ntop_build_prefix = @top_build_prefix@\ntop_builddir = @top_builddir@\ntop_srcdir = @top_srcdir@\ndocfiles = \\\n\taddingtags.html \\\n\tbugs.html \\\n\tbuild.html \\\n\tcontrib.html \\\n\tdocument.html \\\n\timages.html \\\n\tindex.html \\\n\tinternals.html \\\n\tintro.html \\\n\tlibtiff.html \\\n\tmisc.html \\\n\tsupport.html \\\n\tTIFFTechNote2.html \\\n\ttools.html \\\n\tv3.4beta007.html \\\n\tv3.4beta016.html \\\n\tv3.4beta018.html \\\n\tv3.4beta024.html \\\n\tv3.4beta028.html \\\n\tv3.4beta029.html \\\n\tv3.4beta031.html \\\n\tv3.4beta032.html \\\n\tv3.4beta033.html \\\n\tv3.4beta034.html \\\n\tv3.4beta035.html \\\n\tv3.4beta036.html \\\n\tv3.5.1.html \\\n\tv3.5.2.html \\\n\tv3.5.3.html \\\n\tv3.5.4.html \\\n\tv3.5.5.html \\\n\tv3.5.6-beta.html \\\n\tv3.5.7.html \\\n\tv3.6.0.html \\\n\tv3.6.1.html \\\n\tv3.7.0alpha.html \\\n\tv3.7.0beta.html \\\n\tv3.7.0beta2.html \\\n\tv3.7.0.html \\\n\tv3.7.1.html \\\n\tv3.7.2.html \\\n\tv3.7.3.html \\\n\tv3.7.4.html \\\n\tv3.8.0.html \\\n\tv3.8.1.html \\\n\tv3.8.2.html \\\n\tv3.9.0beta.html \\\n\tv3.9.1.html \\\n\tv3.9.2.html\n\ndist_doc_DATA = $(docfiles)\nSUBDIRS = images man\nall: all-recursive\n\n.SUFFIXES:\n$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)\n\t@for dep in $?; do \\\n\t  case '$(am__configure_deps)' in \\\n\t    *$$dep*) \\\n\t      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \\\n\t        && { if test -f $@; then exit 0; else break; fi; }; \\\n\t      exit 1;; \\\n\t  esac; \\\n\tdone; \\\n\techo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign html/Makefile'; \\\n\t$(am__cd) $(top_srcdir) && \\\n\t  $(AUTOMAKE) --foreign html/Makefile\n.PRECIOUS: Makefile\nMakefile: $(srcdir)/Makefile.in $(top_builddir)/config.status\n\t@case '$?' in \\\n\t  *config.status*) \\\n\t    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \\\n\t  *) \\\n\t    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \\\n\t    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \\\n\tesac;\n\n$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n\n$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n$(am__aclocal_m4_deps):\n\nmostlyclean-libtool:\n\t-rm -f *.lo\n\nclean-libtool:\n\t-rm -rf .libs _libs\ninstall-dist_docDATA: $(dist_doc_DATA)\n\t@$(NORMAL_INSTALL)\n\ttest -z \"$(docdir)\" || $(MKDIR_P) \"$(DESTDIR)$(docdir)\"\n\t@list='$(dist_doc_DATA)'; test -n \"$(docdir)\" || list=; \\\n\tfor p in $$list; do \\\n\t  if test -f \"$$p\"; then d=; else d=\"$(srcdir)/\"; fi; \\\n\t  echo \"$$d$$p\"; \\\n\tdone | $(am__base_list) | \\\n\twhile read files; do \\\n\t  echo \" $(INSTALL_DATA) $$files '$(DESTDIR)$(docdir)'\"; \\\n\t  $(INSTALL_DATA) $$files \"$(DESTDIR)$(docdir)\" || exit $$?; \\\n\tdone\n\nuninstall-dist_docDATA:\n\t@$(NORMAL_UNINSTALL)\n\t@list='$(dist_doc_DATA)'; test -n \"$(docdir)\" || list=; \\\n\tfiles=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \\\n\ttest -n \"$$files\" || exit 0; \\\n\techo \" ( cd '$(DESTDIR)$(docdir)' && rm -f\" $$files \")\"; \\\n\tcd \"$(DESTDIR)$(docdir)\" && rm -f $$files\n\n# This directory's subdirectories are mostly independent; you can cd\n# into them and run `make' without going through this Makefile.\n# To change the values of `make' variables: instead of editing Makefiles,\n# (1) if the variable is set in `config.status', edit `config.status'\n#     (which will cause the Makefiles to be regenerated when you run `make');\n# (2) otherwise, pass the desired values on the `make' command line.\n$(RECURSIVE_TARGETS):\n\t@failcom='exit 1'; \\\n\tfor f in x $$MAKEFLAGS; do \\\n\t  case $$f in \\\n\t    *=* | --[!k]*);; \\\n\t    *k*) failcom='fail=yes';; \\\n\t  esac; \\\n\tdone; \\\n\tdot_seen=no; \\\n\ttarget=`echo $@ | sed s/-recursive//`; \\\n\tlist='$(SUBDIRS)'; for subdir in $$list; do \\\n\t  echo \"Making $$target in $$subdir\"; \\\n\t  if test \"$$subdir\" = \".\"; then \\\n\t    dot_seen=yes; \\\n\t    local_target=\"$$target-am\"; \\\n\t  else \\\n\t    local_target=\"$$target\"; \\\n\t  fi; \\\n\t  ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \\\n\t  || eval $$failcom; \\\n\tdone; \\\n\tif test \"$$dot_seen\" = \"no\"; then \\\n\t  $(MAKE) $(AM_MAKEFLAGS) \"$$target-am\" || exit 1; \\\n\tfi; test -z \"$$fail\"\n\n$(RECURSIVE_CLEAN_TARGETS):\n\t@failcom='exit 1'; \\\n\tfor f in x $$MAKEFLAGS; do \\\n\t  case $$f in \\\n\t    *=* | --[!k]*);; \\\n\t    *k*) failcom='fail=yes';; \\\n\t  esac; \\\n\tdone; \\\n\tdot_seen=no; \\\n\tcase \"$@\" in \\\n\t  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \\\n\t  *) list='$(SUBDIRS)' ;; \\\n\tesac; \\\n\trev=''; for subdir in $$list; do \\\n\t  if test \"$$subdir\" = \".\"; then :; else \\\n\t    rev=\"$$subdir $$rev\"; \\\n\t  fi; \\\n\tdone; \\\n\trev=\"$$rev .\"; \\\n\ttarget=`echo $@ | sed s/-recursive//`; \\\n\tfor subdir in $$rev; do \\\n\t  echo \"Making $$target in $$subdir\"; \\\n\t  if test \"$$subdir\" = \".\"; then \\\n\t    local_target=\"$$target-am\"; \\\n\t  else \\\n\t    local_target=\"$$target\"; \\\n\t  fi; \\\n\t  ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \\\n\t  || eval $$failcom; \\\n\tdone && test -z \"$$fail\"\ntags-recursive:\n\tlist='$(SUBDIRS)'; for subdir in $$list; do \\\n\t  test \"$$subdir\" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \\\n\tdone\nctags-recursive:\n\tlist='$(SUBDIRS)'; for subdir in $$list; do \\\n\t  test \"$$subdir\" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \\\n\tdone\n\nID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)\n\tlist='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \\\n\tunique=`for i in $$list; do \\\n\t    if test -f \"$$i\"; then echo $$i; else echo $(srcdir)/$$i; fi; \\\n\t  done | \\\n\t  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \\\n\t      END { if (nonempty) { for (i in files) print i; }; }'`; \\\n\tmkid -fID $$unique\ntags: TAGS\n\nTAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \\\n\t\t$(TAGS_FILES) $(LISP)\n\tset x; \\\n\there=`pwd`; \\\n\tif ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \\\n\t  include_option=--etags-include; \\\n\t  empty_fix=.; \\\n\telse \\\n\t  include_option=--include; \\\n\t  empty_fix=; \\\n\tfi; \\\n\tlist='$(SUBDIRS)'; for subdir in $$list; do \\\n\t  if test \"$$subdir\" = .; then :; else \\\n\t    test ! -f $$subdir/TAGS || \\\n\t      set \"$$@\" \"$$include_option=$$here/$$subdir/TAGS\"; \\\n\t  fi; \\\n\tdone; \\\n\tlist='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \\\n\tunique=`for i in $$list; do \\\n\t    if test -f \"$$i\"; then echo $$i; else echo $(srcdir)/$$i; fi; \\\n\t  done | \\\n\t  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \\\n\t      END { if (nonempty) { for (i in files) print i; }; }'`; \\\n\tshift; \\\n\tif test -z \"$(ETAGS_ARGS)$$*$$unique\"; then :; else \\\n\t  test -n \"$$unique\" || unique=$$empty_fix; \\\n\t  if test $$# -gt 0; then \\\n\t    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \\\n\t      \"$$@\" $$unique; \\\n\t  else \\\n\t    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \\\n\t      $$unique; \\\n\t  fi; \\\n\tfi\nctags: CTAGS\nCTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \\\n\t\t$(TAGS_FILES) $(LISP)\n\tlist='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \\\n\tunique=`for i in $$list; do \\\n\t    if test -f \"$$i\"; then echo $$i; else echo $(srcdir)/$$i; fi; \\\n\t  done | \\\n\t  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \\\n\t      END { if (nonempty) { for (i in files) print i; }; }'`; \\\n\ttest -z \"$(CTAGS_ARGS)$$unique\" \\\n\t  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \\\n\t     $$unique\n\nGTAGS:\n\there=`$(am__cd) $(top_builddir) && pwd` \\\n\t  && $(am__cd) $(top_srcdir) \\\n\t  && gtags -i $(GTAGS_ARGS) \"$$here\"\n\ndistclean-tags:\n\t-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags\n\ndistdir: $(DISTFILES)\n\t@srcdirstrip=`echo \"$(srcdir)\" | sed 's/[].[^$$\\\\*]/\\\\\\\\&/g'`; \\\n\ttopsrcdirstrip=`echo \"$(top_srcdir)\" | sed 's/[].[^$$\\\\*]/\\\\\\\\&/g'`; \\\n\tlist='$(DISTFILES)'; \\\n\t  dist_files=`for file in $$list; do echo $$file; done | \\\n\t  sed -e \"s|^$$srcdirstrip/||;t\" \\\n\t      -e \"s|^$$topsrcdirstrip/|$(top_builddir)/|;t\"`; \\\n\tcase $$dist_files in \\\n\t  */*) $(MKDIR_P) `echo \"$$dist_files\" | \\\n\t\t\t   sed '/\\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \\\n\t\t\t   sort -u` ;; \\\n\tesac; \\\n\tfor file in $$dist_files; do \\\n\t  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \\\n\t  if test -d $$d/$$file; then \\\n\t    dir=`echo \"/$$file\" | sed -e 's,/[^/]*$$,,'`; \\\n\t    if test -d \"$(distdir)/$$file\"; then \\\n\t      find \"$(distdir)/$$file\" -type d ! -perm -700 -exec chmod u+rwx {} \\;; \\\n\t    fi; \\\n\t    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \\\n\t      cp -fpR $(srcdir)/$$file \"$(distdir)$$dir\" || exit 1; \\\n\t      find \"$(distdir)/$$file\" -type d ! -perm -700 -exec chmod u+rwx {} \\;; \\\n\t    fi; \\\n\t    cp -fpR $$d/$$file \"$(distdir)$$dir\" || exit 1; \\\n\t  else \\\n\t    test -f \"$(distdir)/$$file\" \\\n\t    || cp -p $$d/$$file \"$(distdir)/$$file\" \\\n\t    || exit 1; \\\n\t  fi; \\\n\tdone\n\t@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \\\n\t  if test \"$$subdir\" = .; then :; else \\\n\t    test -d \"$(distdir)/$$subdir\" \\\n\t    || $(MKDIR_P) \"$(distdir)/$$subdir\" \\\n\t    || exit 1; \\\n\t  fi; \\\n\tdone\n\t@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \\\n\t  if test \"$$subdir\" = .; then :; else \\\n\t    dir1=$$subdir; dir2=\"$(distdir)/$$subdir\"; \\\n\t    $(am__relativize); \\\n\t    new_distdir=$$reldir; \\\n\t    dir1=$$subdir; dir2=\"$(top_distdir)\"; \\\n\t    $(am__relativize); \\\n\t    new_top_distdir=$$reldir; \\\n\t    echo \" (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=\"$$new_top_distdir\" distdir=\"$$new_distdir\" \\\\\"; \\\n\t    echo \"     am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)\"; \\\n\t    ($(am__cd) $$subdir && \\\n\t      $(MAKE) $(AM_MAKEFLAGS) \\\n\t        top_distdir=\"$$new_top_distdir\" \\\n\t        distdir=\"$$new_distdir\" \\\n\t\tam__remove_distdir=: \\\n\t\tam__skip_length_check=: \\\n\t\tam__skip_mode_fix=: \\\n\t        distdir) \\\n\t      || exit 1; \\\n\t  fi; \\\n\tdone\ncheck-am: all-am\ncheck: check-recursive\nall-am: Makefile $(DATA)\ninstalldirs: installdirs-recursive\ninstalldirs-am:\n\tfor dir in \"$(DESTDIR)$(docdir)\"; do \\\n\t  test -z \"$$dir\" || $(MKDIR_P) \"$$dir\"; \\\n\tdone\ninstall: install-recursive\ninstall-exec: install-exec-recursive\ninstall-data: install-data-recursive\nuninstall: uninstall-recursive\n\ninstall-am: all-am\n\t@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am\n\ninstallcheck: installcheck-recursive\ninstall-strip:\n\t$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM=\"$(INSTALL_STRIP_PROGRAM)\" \\\n\t  install_sh_PROGRAM=\"$(INSTALL_STRIP_PROGRAM)\" INSTALL_STRIP_FLAG=-s \\\n\t  `test -z '$(STRIP)' || \\\n\t    echo \"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'\"` install\nmostlyclean-generic:\n\nclean-generic:\n\ndistclean-generic:\n\t-test -z \"$(CONFIG_CLEAN_FILES)\" || rm -f $(CONFIG_CLEAN_FILES)\n\t-test . = \"$(srcdir)\" || test -z \"$(CONFIG_CLEAN_VPATH_FILES)\" || rm -f $(CONFIG_CLEAN_VPATH_FILES)\n\nmaintainer-clean-generic:\n\t@echo \"This command is intended for maintainers to use\"\n\t@echo \"it deletes files that may require special tools to rebuild.\"\nclean: clean-recursive\n\nclean-am: clean-generic clean-libtool mostlyclean-am\n\ndistclean: distclean-recursive\n\t-rm -f Makefile\ndistclean-am: clean-am distclean-generic distclean-tags\n\ndvi: dvi-recursive\n\ndvi-am:\n\nhtml: html-recursive\n\nhtml-am:\n\ninfo: info-recursive\n\ninfo-am:\n\ninstall-data-am: install-dist_docDATA\n\ninstall-dvi: install-dvi-recursive\n\ninstall-dvi-am:\n\ninstall-exec-am:\n\ninstall-html: install-html-recursive\n\ninstall-html-am:\n\ninstall-info: install-info-recursive\n\ninstall-info-am:\n\ninstall-man:\n\ninstall-pdf: install-pdf-recursive\n\ninstall-pdf-am:\n\ninstall-ps: install-ps-recursive\n\ninstall-ps-am:\n\ninstallcheck-am:\n\nmaintainer-clean: maintainer-clean-recursive\n\t-rm -f Makefile\nmaintainer-clean-am: distclean-am maintainer-clean-generic\n\nmostlyclean: mostlyclean-recursive\n\nmostlyclean-am: mostlyclean-generic mostlyclean-libtool\n\npdf: pdf-recursive\n\npdf-am:\n\nps: ps-recursive\n\nps-am:\n\nuninstall-am: uninstall-dist_docDATA\n\n.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \\\n\tinstall-am install-strip tags-recursive\n\n.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \\\n\tall all-am check check-am clean clean-generic clean-libtool \\\n\tctags ctags-recursive distclean distclean-generic \\\n\tdistclean-libtool distclean-tags distdir dvi dvi-am html \\\n\thtml-am info info-am install install-am install-data \\\n\tinstall-data-am install-dist_docDATA install-dvi \\\n\tinstall-dvi-am install-exec install-exec-am install-html \\\n\tinstall-html-am install-info install-info-am install-man \\\n\tinstall-pdf install-pdf-am install-ps install-ps-am \\\n\tinstall-strip installcheck installcheck-am installdirs \\\n\tinstalldirs-am maintainer-clean maintainer-clean-generic \\\n\tmostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \\\n\tps ps-am tags tags-recursive uninstall uninstall-am \\\n\tuninstall-dist_docDATA\n\n\n# Tell versions [3.59,3.63) of GNU make to not export all variables.\n# Otherwise a system limit (for SysV at least) may be exceeded.\n.NOEXPORT:\n"
  },
  {
    "path": "src/main/jni/tiff/html/TIFFTechNote2.html",
    "content": "<pre>\nDRAFT TIFF Technical Note #2\t\t\t\t17-Mar-95\n============================\n\nThis Technical Note describes serious problems that have been found in\nTIFF 6.0's design for embedding JPEG-compressed data in TIFF (Section 22\nof the TIFF 6.0 spec of 3 June 1992).  A replacement TIFF/JPEG\nspecification is given.  Some corrections to Section 21 are also given.\n\nTo permit TIFF implementations to continue to read existing files, the 6.0\nJPEG fields and tag values will remain reserved indefinitely.  However,\nTIFF writers are strongly discouraged from using the 6.0 JPEG design.  It\nis expected that the next full release of the TIFF specification will not\ndescribe the old design at all, except to note that certain tag numbers\nare reserved.  The existing Section 22 will be replaced by the\nspecification text given in the second part of this Tech Note.\n\n\nProblems in TIFF 6.0 JPEG\n=========================\n\nAbandoning a published spec is not a step to be taken lightly.  This\nsection summarizes the reasons that have forced this decision.\nTIFF 6.0's JPEG design suffers from design errors and limitations,\nambiguities, and unnecessary complexity.\n\n\nDesign errors and limitations\n-----------------------------\n\nThe fundamental design error in the existing Section 22 is that JPEG's\nvarious tables and parameters are broken out as separate fields which the\nTIFF control logic must manage.  This is bad software engineering: that\ninformation should be treated as private to the JPEG codec\n(compressor/decompressor).  Worse, the fields themselves are specified\nwithout sufficient thought for future extension and without regard to\nwell-established TIFF conventions.  Here are some of the significant\nproblems:\n\n* The JPEGxxTable fields do not store the table data directly in the\nIFD/field structure; rather, the fields hold pointers to information\nelsewhere in the file.  This requires special-purpose code to be added to\n*every* TIFF-manipulating application, whether it needs to decode JPEG\nimage data or not.  Even a trivial TIFF editor, for example a program to\nadd an ImageDescription field to a TIFF file, must be explicitly aware of\nthe internal structure of the JPEG-related tables, or else it will probably\nbreak the file.  Every other auxiliary field in the TIFF spec contains\ndata, not pointers, and can be copied or relocated by standard code that\ndoesn't know anything about the particular field.  This is a crucial\nproperty of the TIFF format that must not be given up.\n\n* To manipulate these fields, the TIFF control logic is required to know a\ngreat deal about JPEG details, for example such arcana as how to compute\nthe length of a Huffman code table --- the length is not supplied in the\nfield structure and can only be found by inspecting the table contents.\nThis is again a violation of good software practice.  Moreover, it will\nprevent easy adoption of future JPEG extensions that might change these\nlow-level details.\n\n* The design neglects the fact that baseline JPEG codecs support only two\nsets of Huffman tables: it specifies a separate table for each color\ncomponent.  This implies that encoders must waste space (by storing\nduplicate Huffman tables) or else violate the well-founded TIFF convention\nthat prohibits duplicate pointers.  Furthermore, baseline decoders must\ntest to find out which tables are identical, a waste of time and code\nspace.\n\n* The JPEGInterchangeFormat field also violates TIFF's proscription against\nduplicate pointers: the normal strip/tile pointers are expected to point\ninto the larger data area pointed to by JPEGInterchangeFormat.  All TIFF\nediting applications must be specifically aware of this relationship, since\nthey must maintain it or else delete the JPEGInterchangeFormat field.  The\nJPEGxxTables fields are also likely to point into the JPEGInterchangeFormat\narea, creating additional pointer relationships that must be maintained.\n\n* The JPEGQTables field is fixed at a byte per table entry; there is no\nway to support 16-bit quantization values.  This is a serious impediment\nto extending TIFF to use 12-bit JPEG.\n\n* The 6.0 design cannot support using different quantization tables in\ndifferent strips/tiles of an image (so as to encode some areas at higher\nquality than others).  Furthermore, since quantization tables are tied\none-for-one to color components, the design cannot support table switching\noptions that are likely to be added in future JPEG revisions.\n\n\nAmbiguities\n-----------\n\nSeveral incompatible interpretations are possible for 6.0's treatment of\nJPEG restart markers:\n\n  * It is unclear whether restart markers must be omitted at TIFF segment\n    (strip/tile) boundaries, or whether they are optional.\n\n  * It is unclear whether the segment size is required to be chosen as\n    a multiple of the specified restart interval (if any); perhaps the\n    JPEG codec is supposed to be reset at each segment boundary as if\n    there were a restart marker there, even if the boundary does not fall\n    at a multiple of the nominal restart interval.\n\n  * The spec fails to address the question of restart marker numbering:\n    do the numbers begin again within each segment, or not?\n\nThat last point is particularly nasty.  If we make numbering begin again\nwithin each segment, we give up the ability to impose a TIFF strip/tile\nstructure on an existing JPEG datastream with restarts (which was clearly a\ngoal of Section 22's authors).  But the other choice interferes with random\naccess to the image segments: a reader must compute the first restart\nnumber to be expected within a segment, and must have a way to reset its\nJPEG decoder to expect a nonzero restart number first.  This may not even\nbe possible with some JPEG chips.\n\nThe tile height restriction found on page 104 contradicts Section 15's\ngeneral description of tiles.  For an image that is not vertically\ndownsampled, page 104 specifies a tile height of one MCU or 8 pixels; but\nSection 15 requires tiles to be a multiple of 16 pixels high.\n\nThis Tech Note does not attempt to resolve these ambiguities, so\nimplementations that follow the 6.0 design should be aware that\ninter-application compatibility problems are likely to arise.\n\n\nUnnecessary complexity\n----------------------\n\nThe 6.0 design creates problems for implementations that need to keep the\nJPEG codec separate from the TIFF control logic --- for example, consider\nusing a JPEG chip that was not designed specifically for TIFF.  JPEG codecs\ngenerally want to produce or consume a standard ISO JPEG datastream, not\njust raw compressed data.  (If they were to handle raw data, a separate\nout-of-band mechanism would be needed to load tables into the codec.)\nWith such a codec, the TIFF control logic must parse JPEG markers emitted\nby the codec to create the TIFF table fields (when writing) or synthesize\nJPEG markers from the TIFF fields to feed the codec (when reading).  This\nmeans that the control logic must know a great deal more about JPEG details\nthan we would like.  The parsing and reconstruction of the markers also\nrepresents a fair amount of unnecessary work.\n\nQuite a few implementors have proposed writing \"TIFF/JPEG\" files in which\na standard JPEG datastream is simply dumped into the file and pointed to\nby JPEGInterchangeFormat.  To avoid parsing the JPEG datastream, they\nsuggest not writing the JPEG auxiliary fields (JPEGxxTables etc) nor even\nthe basic TIFF strip/tile data pointers.  This approach is incompatible\nwith implementations that handle the full TIFF 6.0 JPEG design, since they\nwill expect to find strip/tile pointers and auxiliary fields.  Indeed this\nis arguably not TIFF at all, since *all* TIFF-reading applications expect\nto find strip or tile pointers.  A subset implementation that is not\nupward-compatible with the full spec is clearly unacceptable.  However,\nthe frequency with which this idea has come up makes it clear that\nimplementors find the existing Section 22 too complex.\n\n\nOverview of the solution\n========================\n\nTo solve these problems, we adopt a new design for embedding\nJPEG-compressed data in TIFF files.  The new design uses only complete,\nuninterpreted ISO JPEG datastreams, so it should be much more forgiving of\nextensions to the ISO standard.  It should also be far easier to implement\nusing unmodified JPEG codecs.\n\nTo reduce overhead in multi-segment TIFF files, we allow JPEG overhead\ntables to be stored just once in a JPEGTables auxiliary field.  This\nfeature does not violate the integrity of the JPEG datastreams, because it\nuses the notions of \"tables-only datastreams\" and \"abbreviated image\ndatastreams\" as defined by the ISO standard.\n\nTo prevent confusion with the old design, the new design is given a new\nCompression tag value, Compression=7.  Readers that need to handle\nexisting 6.0 JPEG files may read both old and new files, using whatever\ninterpretation of the 6.0 spec they did before.  Compression tag value 6\nand the field tag numbers defined by 6.0 section 22 will remain reserved\nindefinitely, even though detailed descriptions of them will be dropped\nfrom future editions of the TIFF specification.\n\n\nReplacement TIFF/JPEG specification\n===================================\n\n[This section of the Tech Note is expected to replace Section 22 in the\nnext release of the TIFF specification.]\n\nThis section describes TIFF compression scheme 7, a high-performance\ncompression method for continuous-tone images.\n\nIntroduction\n------------\n\nThis TIFF compression method uses the international standard for image\ncompression ISO/IEC 10918-1, usually known as \"JPEG\" (after the original\nname of the standards committee, Joint Photographic Experts Group).  JPEG\nis a joint ISO/CCITT standard for compression of continuous-tone images.\n\nThe JPEG committee decided that because of the broad scope of the standard,\nno one algorithmic procedure was able to satisfy the requirements of all\napplications.  Instead, the JPEG standard became a \"toolkit\" of multiple\nalgorithms and optional capabilities.  Individual applications may select\na subset of the JPEG standard that meets their requirements.\n\nThe most important distinction among the JPEG processes is between lossy\nand lossless compression.  Lossy compression methods provide high\ncompression but allow only approximate reconstruction of the original\nimage.  JPEG's lossy processes allow the encoder to trade off compressed\nfile size against reconstruction fidelity over a wide range.  Typically,\n10:1 or more compression of full-color data can be obtained while keeping\nthe reconstructed image visually indistinguishable from the original.  Much\nhigher compression ratios are possible if a low-quality reconstructed image\nis acceptable.  Lossless compression provides exact reconstruction of the\nsource data, but the achievable compression ratio is much lower than for\nthe lossy processes; JPEG's rather simple lossless process typically\nachieves around 2:1 compression of full-color data.\n\nThe most widely implemented JPEG subset is the \"baseline\" JPEG process.\nThis provides lossy compression of 8-bit-per-channel data.  Optional\nextensions include 12-bit-per-channel data, arithmetic entropy coding for\nbetter compression, and progressive/hierarchical representations.  The\nlossless process is an independent algorithm that has little in\ncommon with the lossy processes.\n\nIt should be noted that the optional arithmetic-coding extension is subject\nto several US and Japanese patents.  To avoid patent problems, use of\narithmetic coding processes in TIFF files intended for inter-application\ninterchange is discouraged.\n\nAll of the JPEG processes are useful only for \"continuous tone\" data,\nin which the difference between adjacent pixel values is usually small.\nLow-bit-depth source data is not appropriate for JPEG compression, nor\nare palette-color images good candidates.  The JPEG processes work well\non grayscale and full-color data.\n\nDescribing the JPEG compression algorithms in sufficient detail to permit\nimplementation would require more space than we have here.  Instead, we\nrefer the reader to the References section.\n\n\nWhat data is being compressed?\n------------------------------\n\nIn lossy JPEG compression, it is customary to convert color source data\nto YCbCr and then downsample it before JPEG compression.  This gives\n2:1 data compression with hardly any visible image degradation, and it\npermits additional space savings within the JPEG compression step proper.\nHowever, these steps are not considered part of the ISO JPEG standard.\nThe ISO standard is \"color blind\": it accepts data in any color space.\n\nFor TIFF purposes, the JPEG compression tag is considered to represent the\nISO JPEG compression standard only.  The ISO standard is applied to the\nsame data that would be stored in the TIFF file if no compression were\nused.  Therefore, if color conversion or downsampling are used, they must\nbe reflected in the regular TIFF fields; these steps are not considered to\nbe implicit in the JPEG compression tag value.  PhotometricInterpretation\nand related fields shall describe the color space actually stored in the\nfile.  With the TIFF 6.0 field definitions, downsampling is permissible\nonly for YCbCr data, and it must correspond to the YCbCrSubSampling field.\n(Note that the default value for this field is not 1,1; so the default for\nYCbCr is to apply downsampling!)  It is likely that future versions of TIFF\nwill provide additional PhotometricInterpretation values and a more general\nway of defining subsampling, so as to allow more flexibility in\nJPEG-compressed files.  But that issue is not addressed in this Tech Note.\n\nImplementors should note that many popular JPEG codecs\n(compressor/decompressors) provide automatic color conversion and\ndownsampling, so that the application may supply full-size RGB data which\nis nonetheless converted to downsampled YCbCr.  This is an implementation\nconvenience which does not excuse the TIFF control layer from its\nresponsibility to know what is really going on.  The\nPhotometricInterpretation and subsampling fields written to the file must\ndescribe what is actually in the file.\n\nA JPEG-compressed TIFF file will typically have PhotometricInterpretation =\nYCbCr and YCbCrSubSampling = [2,1] or [2,2], unless the source data was\ngrayscale or CMYK.\n\n\nBasic representation of JPEG-compressed images\n----------------------------------------------\n\nJPEG compression works in either strip-based or tile-based TIFF files.\nRather than repeating \"strip or tile\" constantly, we will use the term\n\"segment\" to mean either a strip or a tile.\n\nWhen the Compression field has the value 7, each image segment contains\na complete JPEG datastream which is valid according to the ISO JPEG\nstandard (ISO/IEC 10918-1).  Any sequential JPEG process can be used,\nincluding lossless JPEG, but progressive and hierarchical processes are not\nsupported.  Since JPEG is useful only for continuous-tone images, the\nPhotometricInterpretation of the image shall not be 3 (palette color) nor\n4 (transparency mask).  The bit depth of the data is also restricted as\nspecified below.\n\nEach image segment in a JPEG-compressed TIFF file shall contain a valid\nJPEG datastream according to the ISO JPEG standard's rules for\ninterchange-format or abbreviated-image-format data.  The datastream shall\ncontain a single JPEG frame storing that segment of the image.  The\nrequired JPEG markers within a segment are:\n\tSOI\t(must appear at very beginning of segment)\n\tSOFn\n\tSOS\t(one for each scan, if there is more than one scan)\n\tEOI\t(must appear at very end of segment)\nThe actual compressed data follows SOS; it may contain RSTn markers if DRI\nis used.\n\nAdditional JPEG \"tables and miscellaneous\" markers may appear between SOI\nand SOFn, between SOFn and SOS, and before each subsequent SOS if there is\nmore than one scan.  These markers include:\n\tDQT\n\tDHT\n\tDAC\t(not to appear unless arithmetic coding is used)\n\tDRI\n\tAPPn\t(shall be ignored by TIFF readers)\n\tCOM\t(shall be ignored by TIFF readers)\nDNL markers shall not be used in TIFF files.  Readers should abort if any\nother marker type is found, especially the JPEG reserved markers;\noccurrence of such a marker is likely to indicate a JPEG extension.\n\nThe tables/miscellaneous markers may appear in any order.  Readers are\ncautioned that although the SOFn marker refers to DQT tables, JPEG does not\nrequire those tables to precede the SOFn, only the SOS.  Missing-table\nchecks should be made when SOS is reached.\n\nIf no JPEGTables field is used, then each image segment shall be a complete\nJPEG interchange datastream.  Each segment must define all the tables it\nreferences.  To allow readers to decode segments in any order, no segment\nmay rely on tables being carried over from a previous segment.\n\nWhen a JPEGTables field is used, image segments may omit tables that have\nbeen specified in the JPEGTables field.  Further details appear below.\n\nThe SOFn marker shall be of type SOF0 for strict baseline JPEG data, of\ntype SOF1 for non-baseline lossy JPEG data, or of type SOF3 for lossless\nJPEG data.  (SOF9 or SOF11 would be used for arithmetic coding.)  All\nsegments of a JPEG-compressed TIFF image shall use the same JPEG\ncompression process, in particular the same SOFn type.\n\nThe data precision field of the SOFn marker shall agree with the TIFF\nBitsPerSample field.  (Note that when PlanarConfiguration=1, this implies\nthat all components must have the same BitsPerSample value; when\nPlanarConfiguration=2, different components could have different bit\ndepths.)  For SOF0 only precision 8 is permitted; for SOF1, precision 8 or\n12 is permitted; for SOF3, precisions 2 to 16 are permitted.\n\nThe image dimensions given in the SOFn marker shall agree with the logical\ndimensions of that particular strip or tile.  For strip images, the SOFn\nimage width shall equal ImageWidth and the height shall equal RowsPerStrip,\nexcept in the last strip; its SOFn height shall equal the number of rows\nremaining in the ImageLength.  (In other words, no padding data is counted\nin the SOFn dimensions.)  For tile images, each SOFn shall have width\nTileWidth and height TileHeight; adding and removing any padding needed in\nthe edge tiles is the concern of some higher level of the TIFF software.\n(The dimensional rules are slightly different when PlanarConfiguration=2,\nas described below.)\n\nThe ISO JPEG standard only permits images up to 65535 pixels in width or\nheight, due to 2-byte fields in the SOFn markers.  In TIFF, this limits\nthe size of an individual JPEG-compressed strip or tile, but the total\nimage size can be greater.\n\nThe number of components in the JPEG datastream shall equal SamplesPerPixel\nfor PlanarConfiguration=1, and shall be 1 for PlanarConfiguration=2.  The\ncomponents shall be stored in the same order as they are described at the\nTIFF field level.  (This applies both to their order in the SOFn marker,\nand to the order in which they are scanned if multiple JPEG scans are\nused.)  The component ID bytes are arbitrary so long as each component\nwithin an image segment is given a distinct ID.  To avoid any possible\nconfusion, we require that all segments of a TIFF image use the same ID\ncode for a given component.\n\nIn PlanarConfiguration 1, the sampling factors given in SOFn markers shall\nagree with the sampling factors defined by the related TIFF fields (or with\nthe default values that are specified in the absence of those fields).\n\nWhen DCT-based JPEG is used in a strip TIFF file, RowsPerStrip is required\nto be a multiple of 8 times the largest vertical sampling factor, i.e., a\nmultiple of the height of an interleaved MCU.  (For simplicity of\nspecification, we require this even if the data is not actually\ninterleaved.)  For example, if YCbCrSubSampling = [2,2] then RowsPerStrip\nmust be a multiple of 16.  An exception to this rule is made for\nsingle-strip images (RowsPerStrip >= ImageLength): the exact value of\nRowsPerStrip is unimportant in that case.  This rule ensures that no data\npadding is needed at the bottom of a strip, except perhaps the last strip.\nAny padding required at the right edge of the image, or at the bottom of\nthe last strip, is expected to occur internally to the JPEG codec.\n\nWhen DCT-based JPEG is used in a tiled TIFF file, TileLength is required\nto be a multiple of 8 times the largest vertical sampling factor, i.e.,\na multiple of the height of an interleaved MCU; and TileWidth is required\nto be a multiple of 8 times the largest horizontal sampling factor, i.e.,\na multiple of the width of an interleaved MCU.  (For simplicity of\nspecification, we require this even if the data is not actually\ninterleaved.)  All edge padding required will therefore occur in the course\nof normal TIFF tile padding; it is not special to JPEG.\n\nLossless JPEG does not impose these constraints on strip and tile sizes,\nsince it is not DCT-based.\n\nNote that within JPEG datastreams, multibyte values appear in the MSB-first\norder specified by the JPEG standard, regardless of the byte ordering of\nthe surrounding TIFF file.\n\n\nJPEGTables field\n----------------\n\nThe only auxiliary TIFF field added for Compression=7 is the optional\nJPEGTables field.  The purpose of JPEGTables is to predefine JPEG\nquantization and/or Huffman tables for subsequent use by JPEG image\nsegments.  When this is done, these rather bulky tables need not be\nduplicated in each segment, thus saving space and processing time.\nJPEGTables may be used even in a single-segment file, although there is no\nspace savings in that case.\n\nJPEGTables:\n\tTag = 347 (15B.H)\n\tType = UNDEFINED\n\tN = number of bytes in tables datastream, typically a few hundred\nJPEGTables provides default JPEG quantization and/or Huffman tables which\nare used whenever a segment datastream does not contain its own tables, as\nspecified below.\n\nNotice that the JPEGTables field is required to have type code UNDEFINED,\nnot type code BYTE.  This is to cue readers that expanding individual bytes\nto short or long integers is not appropriate.  A TIFF reader will generally\nneed to store the field value as an uninterpreted byte sequence until it is\nfed to the JPEG decoder.\n\nMultibyte quantities within the tables follow the ISO JPEG convention of\nMSB-first storage, regardless of the byte ordering of the surrounding TIFF\nfile.\n\nWhen the JPEGTables field is present, it shall contain a valid JPEG\n\"abbreviated table specification\" datastream.  This datastream shall begin\nwith SOI and end with EOI.  It may contain zero or more JPEG \"tables and\nmiscellaneous\" markers, namely:\n\tDQT\n\tDHT\n\tDAC\t(not to appear unless arithmetic coding is used)\n\tDRI\n\tAPPn\t(shall be ignored by TIFF readers)\n\tCOM\t(shall be ignored by TIFF readers)\nSince JPEG defines the SOI marker to reset the DAC and DRI state, these two\nmarkers' values cannot be carried over into any image datastream, and thus\nthey are effectively no-ops in the JPEGTables field.  To avoid confusion,\nit is recommended that writers not place DAC or DRI markers in JPEGTables.\nHowever readers must properly skip over them if they appear.\n\nWhen JPEGTables is present, readers shall load the table specifications\ncontained in JPEGTables before processing image segment datastreams.\nImage segments may simply refer to these preloaded tables without defining\nthem.  An image segment can still define and use its own tables, subject to\nthe restrictions below.\n\nAn image segment may not redefine any table defined in JPEGTables.  (This\nrestriction is imposed to allow readers to process image segments in random\norder without having to reload JPEGTables between segments.)  Therefore, use\nof JPEGTables divides the available table slots into two groups: \"global\"\nslots are defined in JPEGTables and may be used but not redefined by\nsegments; \"local\" slots are available for local definition and use in each\nsegment.  To permit random access, a segment may not reference any local\ntables that it does not itself define.\n\n\nSpecial considerations for PlanarConfiguration 2\n------------------------------------------------\n\nIn PlanarConfiguration 2, each image segment contains data for only one\ncolor component.  To avoid confusing the JPEG codec, we wish the segments\nto look like valid single-channel (i.e., grayscale) JPEG datastreams.  This\nmeans that different rules must be used for the SOFn parameters.\n\nIn PlanarConfiguration 2, the dimensions given in the SOFn of a subsampled\ncomponent shall be scaled down by the sampling factors compared to the SOFn\ndimensions that would be used in PlanarConfiguration 1.  This is necessary\nto match the actual number of samples stored in that segment, so that the\nJPEG codec doesn't complain about too much or too little data.  In strip\nTIFF files the computed dimensions may need to be rounded up to the next\ninteger; in tiled files, the restrictions on tile size make this case\nimpossible.\n\nFurthermore, all SOFn sampling factors shall be given as 1.  (This is\nmerely to avoid confusion, since the sampling factors in a single-channel\nJPEG datastream have no real effect.)\n\nAny downsampling will need to happen externally to the JPEG codec, since\nJPEG sampling factors are defined with reference to the full-precision\ncomponent.  In PlanarConfiguration 2, the JPEG codec will be working on\nonly one component at a time and thus will have no reference component to\ndownsample against.\n\n\nMinimum requirements for TIFF/JPEG\n----------------------------------\n\nISO JPEG is a large and complex standard; most implementations support only\na subset of it.  Here we define a \"core\" subset of TIFF/JPEG which readers\nmust support to claim TIFF/JPEG compatibility.  For maximum\ncross-application compatibility, we recommend that writers confine\nthemselves to this subset unless there is very good reason to do otherwise.\n\nUse the ISO baseline JPEG process: 8-bit data precision, Huffman coding,\nwith no more than 2 DC and 2 AC Huffman tables.  Note that this implies\nBitsPerSample = 8 for each component.  We recommend deviating from baseline\nJPEG only if 12-bit data precision or lossless coding is required.\n\nUse no subsampling (all JPEG sampling factors = 1) for color spaces other\nthan YCbCr.  (This is, in fact, required with the TIFF 6.0 field\ndefinitions, but may not be so in future revisions.)  For YCbCr, use one of\nthe following choices:\n\tYCbCrSubSampling field\t\tJPEG sampling factors\n\t1,1\t\t\t\t1h1v, 1h1v, 1h1v\n\t2,1\t\t\t\t2h1v, 1h1v, 1h1v\n\t2,2  (default value)\t\t2h2v, 1h1v, 1h1v\nWe recommend that RGB source data be converted to YCbCr for best compression\nresults.  Other source data colorspaces should probably be left alone.\nMinimal readers need not support JPEG images with colorspaces other than\nYCbCr and grayscale (PhotometricInterpretation = 6 or 1).\n\nA minimal reader also need not support JPEG YCbCr images with nondefault\nvalues of YCbCrCoefficients or YCbCrPositioning, nor with values of\nReferenceBlackWhite other than [0,255,128,255,128,255].  (These values\ncorrespond to the RGB<=>YCbCr conversion specified by JFIF, which is widely\nimplemented in JPEG codecs.)\n\nWriters are reminded that a ReferenceBlackWhite field *must* be included\nwhen PhotometricInterpretation is YCbCr, because the default\nReferenceBlackWhite values are inappropriate for YCbCr.\n\nIf any subsampling is used, PlanarConfiguration=1 is preferred to avoid the\npossibly-confusing requirements of PlanarConfiguration=2.  In any case,\nreaders are not required to support PlanarConfiguration=2.\n\nIf possible, use a single interleaved scan in each image segment.  This is\nnot legal JPEG if there are more than 4 SamplesPerPixel or if the sampling\nfactors are such that more than 10 blocks would be needed per MCU; in that\ncase, use a separate scan for each component.  (The recommended color\nspaces and sampling factors will not run into that restriction, so a\nminimal reader need not support more than one scan per segment.)\n\nTo claim TIFF/JPEG compatibility, readers shall support multiple-strip TIFF\nfiles and the optional JPEGTables field; it is not acceptable to read only\nsingle-datastream files.  Support for tiled TIFF files is strongly\nrecommended but not required.\n\n\nOther recommendations for implementors\n--------------------------------------\n\nThe TIFF tag Compression=7 guarantees only that the compressed data is\nrepresented as ISO JPEG datastreams.  Since JPEG is a large and evolving\nstandard, readers should apply careful error checking to the JPEG markers\nto ensure that the compression process is within their capabilities.  In\nparticular, to avoid being confused by future extensions to the JPEG\nstandard, it is important to abort if unknown marker codes are seen.\n\nThe point of requiring that all image segments use the same JPEG process is\nto ensure that a reader need check only one segment to determine whether it\ncan handle the image.  For example, consider a TIFF reader that has access\nto fast but restricted JPEG hardware, as well as a slower, more general\nsoftware implementation.  It is desirable to check only one image segment\nto find out whether the fast hardware can be used.  Thus, writers should\ntry to ensure that all segments of an image look as much \"alike\" as\npossible: there should be no variation in scan layout, use of options such\nas DRI, etc.  Ideally, segments will be processed identically except\nperhaps for using different local quantization or entropy-coding tables.\n\nWriters should avoid including \"noise\" JPEG markers (COM and APPn markers).\nStandard TIFF fields provide a better way to transport any non-image data.\nSome JPEG codecs may change behavior if they see an APPn marker they\nthink they understand; since the TIFF spec requires these markers to be\nignored, this behavior is undesirable.\n\nIt is possible to convert an interchange-JPEG file (e.g., a JFIF file) to\nTIFF simply by dropping the interchange datastream into a single strip.\n(However, designers are reminded that the TIFF spec discourages huge\nstrips; splitting the image is somewhat more work but may give better\nresults.)  Conversion from TIFF to interchange JPEG is more complex.  A\nstrip-based TIFF/JPEG file can be converted fairly easily if all strips use\nidentical JPEG tables and no RSTn markers: just delete the overhead markers\nand insert RSTn markers between strips.  Converting tiled images is harder,\nsince the data will usually not be in the right order (unless the tiles are\nonly one MCU high).  This can still be done losslessly, but it will require\nundoing and redoing the entropy coding so that the DC coefficient\ndifferences can be updated.\n\nThere is no default value for JPEGTables: standard TIFF files must define all\ntables that they reference.  For some closed systems in which many files will\nhave identical tables, it might make sense to define a default JPEGTables\nvalue to avoid actually storing the tables.  Or even better, invent a\nprivate field selecting one of N default JPEGTables settings, so as to allow\nfor future expansion.  Either of these must be regarded as a private\nextension that will render the files unreadable by other applications.\n\n\nReferences\n----------\n\n[1] Wallace, Gregory K.  \"The JPEG Still Picture Compression Standard\",\nCommunications of the ACM, April 1991 (vol. 34 no. 4), pp. 30-44.\n\nThis is the best short technical introduction to the JPEG algorithms.\nIt is a good overview but does not provide sufficiently detailed\ninformation to write an implementation.\n\n[2] Pennebaker, William B. and Mitchell, Joan L.  \"JPEG Still Image Data\nCompression Standard\", Van Nostrand Reinhold, 1993, ISBN 0-442-01272-1.\n638pp.\n\nThis textbook is by far the most complete exposition of JPEG in existence.\nIt includes the full text of the ISO JPEG standards (DIS 10918-1 and draft\nDIS 10918-2).  No would-be JPEG implementor should be without it.\n\n[3] ISO/IEC IS 10918-1, \"Digital Compression and Coding of Continuous-tone\nStill Images, Part 1: Requirements and guidelines\", February 1994.\nISO/IEC DIS 10918-2, \"Digital Compression and Coding of Continuous-tone\nStill Images, Part 2: Compliance testing\", final approval expected 1994.\n\nThese are the official standards documents.  Note that the Pennebaker and\nMitchell textbook is likely to be cheaper and more useful than the official\nstandards.\n\n\nChanges to Section 21: YCbCr Images\n===================================\n\n[This section of the Tech Note clarifies section 21 to make clear the\ninterpretation of image dimensions in a subsampled image.  Furthermore,\nthe section is changed to allow the original image dimensions not to be\nmultiples of the sampling factors.  This change is necessary to support use\nof JPEG compression on odd-size images.]\n\nAdd the following paragraphs to the Section 21 introduction (p. 89),\njust after the paragraph beginning \"When a Class Y image is subsampled\":\n\n\tIn a subsampled image, it is understood that all TIFF image\n\tdimensions are measured in terms of the highest-resolution\n\t(luminance) component.  In particular, ImageWidth, ImageLength,\n\tRowsPerStrip, TileWidth, TileLength, XResolution, and YResolution\n\tare measured in luminance samples.\n\n\tRowsPerStrip, TileWidth, and TileLength are constrained so that\n\tthere are an integral number of samples of each component in a\n\tcomplete strip or tile.  However, ImageWidth/ImageLength are not\n\tconstrained.  If an odd-size image is to be converted to subsampled\n\tformat, the writer should pad the source data to a multiple of the\n\tsampling factors by replication of the last column and/or row, then\n\tdownsample.  The number of luminance samples actually stored in the\n\tfile will be a multiple of the sampling factors.  Conversely,\n\treaders must ignore any extra data (outside the specified image\n\tdimensions) after upsampling.\n\n\tWhen PlanarConfiguration=2, each strip or tile covers the same\n\timage area despite subsampling; that is, the total number of strips\n\tor tiles in the image is the same for each component.  Therefore\n\tstrips or tiles of the subsampled components contain fewer samples\n\tthan strips or tiles of the luminance component.\n\n\tIf there are extra samples per pixel (see field ExtraSamples),\n\tthese data channels have the same number of samples as the\n\tluminance component.\n\nRewrite the YCbCrSubSampling field description (pp 91-92) as follows\n(largely to eliminate possibly-misleading references to\nImageWidth/ImageLength of the subsampled components):\n\n\t(first paragraph unchanged)\n\n\tThe two elements of this field are defined as follows:\n\n\tShort 0: ChromaSubsampleHoriz:\n\n\t1 = there are equal numbers of luma and chroma samples horizontally.\n\n\t2 = there are twice as many luma samples as chroma samples\n\thorizontally.\n\n\t4 = there are four times as many luma samples as chroma samples\n\thorizontally.\n\n\tShort 1: ChromaSubsampleVert:\n\n\t1 = there are equal numbers of luma and chroma samples vertically.\n\n\t2 = there are twice as many luma samples as chroma samples\n\tvertically.\n\n\t4 = there are four times as many luma samples as chroma samples\n\tvertically.\n\n\tChromaSubsampleVert shall always be less than or equal to\n\tChromaSubsampleHoriz.  Note that Cb and Cr have the same sampling\n\tratios.\n\n\tIn a strip TIFF file, RowsPerStrip is required to be an integer\n\tmultiple of ChromaSubSampleVert (unless RowsPerStrip >=\n\tImageLength, in which case its exact value is unimportant).\n\tIf ImageWidth and ImageLength are not multiples of\n\tChromaSubsampleHoriz and ChromaSubsampleVert respectively, then the\n\tsource data shall be padded to the next integer multiple of these\n\tvalues before downsampling.\n\n\tIn a tiled TIFF file, TileWidth must be an integer multiple of\n\tChromaSubsampleHoriz and TileLength must be an integer multiple of\n\tChromaSubsampleVert.  Padding will occur to tile boundaries.\n\n\tThe default values of this field are [ 2,2 ].  Thus, YCbCr data is\n\tdownsampled by default!\n</pre>\n"
  },
  {
    "path": "src/main/jni/tiff/html/addingtags.html",
    "content": "<HTML>\n<HEAD>\n<TITLE>\nModifying The TIFF Library\n</TITLE>\n</HEAD>\n<BODY BGCOLOR=white> \n<FONT FACE=\"Arial, Helvetica, Sans\">\n\n<H1>\nDefining New TIFF Tags\n</H1>\n\nLibtiff has built-in knowledge of all the standard TIFF tags, as\nwell as extentions.  The following describes how to add knowledge of\nnew tags as builtins to libtiff, or how to application specific tags can\nbe used by applications without modifying libtiff. \n<p>\n\n<h2>TIFFFieldInfo</h2>\n\nHow libtiff manages specific tags is primarily controlled by the \ndefinition for that tag value stored internally as a TIFFFieldInfo structure. \nThis structure looks like this:\n<p>\n\n<pre>\ntypedef\tstruct {\n  ttag_t    field_tag;          /* field's tag */\n  short\t    field_readcount;    /* read count/TIFF_VARIABLE/TIFF_SPP */\n  short\t    field_writecount;   /* write count/TIFF_VARIABLE */\n  TIFFDataType field_type;      /* type of associated data */\n  unsigned short field_bit;     /* bit in fieldsset bit vector */\n  unsigned char field_oktochange;/* if true, can change while writing */\n  unsigned char field_passcount;/* if true, pass dir count on set */\n  char\t*field_name;\t\t/* ASCII name */\n} TIFFFieldInfo;\n</pre>\n\n<ul>\n<li> <b>field_tag</b>: the tag number.  For instance 277 for the\nSamplesPerPixel tag.  Builtin tags will generally have a #define in\ntiff.h for each known tag. <p>\n\n<li> <b>field_readcount</b>: The number of values which should be read.\nThe special value TIFF_VARIABLE (-1) indicates that a variable number of\nvalues may be read.  The special value TIFFTAG_SPP (-2) indicates that there\nshould be one value for each sample as defined by TIFFTAG_SAMPLESPERPIXEL.  \nThe special value TIFF_VARIABLE2 (-3) is presumably similar to TIFF_VARIABLE\nthough I am not sure what the distinction in behaviour is.  This field\nis TIFF_VARIABLE for variable length ascii fields.<p>\n\n<li> <b>field_writecount</b>: The number of values which should be written.\nGenerally the same as field_readcount.  A few built-in exceptions exist, but\nI haven't analysed why they differ. <p>\n\n<li> <b>field_type</b>: Type of the field.  One of TIFF_BYTE, TIFF_ASCII,\nTIFF_SHORT, TIFF_LONG, TIFF_RATIONAL, TIFF_SBYTE, TIFF_UNDEFINED, \nTIFF_SSHORT, TIFF_SLONG, TIFF_SRATIONAL, TIFF_FLOAT, TIFF_DOUBLE or\nTIFF_IFD.  Note that some fields can support more than one type (for \ninstance short and long).  These fields should have multiple TIFFFieldInfos. \n<p>\n\n<li> <b>field_bit</b>: Built-in tags stored in special fields in the \nTIFF structure have assigned field numbers to distinguish them (ie. \nFIELD_SAMPLESPERPIXEL).  New tags should generally just use \nFIELD_CUSTOM indicating they are stored in the generic tag list.<p>\n\n<li> <b>field_oktochange</b>: TRUE if it is OK to change this tag value\nwhile an image is being written.  FALSE for stuff that must be set once\nand then left unchanged (like ImageWidth, or PhotometricInterpretation for\ninstance).<p>\n\n<li> <b>field_passcount</b>: If TRUE, then the count value must be passed\nin TIFFSetField(), and TIFFGetField(), otherwise the count is not required.\nThis should generally be TRUE for non-ascii variable count tags unless\nthe count is implicit (such as with the colormap).<p>\n\n<li> <b>field_name</b>: A name for the tag.  Normally mixed case (studly caps) \nlike \"StripByteCounts\" and relatively short. <p>\n\n</ul>\n\nA TIFFFieldInfo definition exists for each built-in tag in the tif_dirinfo.c\nfile.  Some tags which support multiple data types have more than one\ndefinition, one per data type supported. <p>\n\nVarious functions exist for getting the internal TIFFFieldInfo definitions,\nincluding _TIFFFindFieldInfo(), and _TIFFFindFieldInfoByName().  See\ntif_dirinfo.c for details.  There must be some mechanism to get the whole\nlist, though I don't see it off hand.<p>\n\n<h2>Default Tag Auto-registration</h2>\n\nIn libtiff 3.6.0 a new mechanism was introduced allowing libtiff to \nread unrecognised tags automatically.  When an unknown tags is encountered, \nit is automatically internally defined with a default name and a type \nderived from the tag value in the file.  Applications only need to predefine\napplication specific tags if they need to be able to set them in a file, or\nif particular calling conventions are desired for TIFFSetField() and \nTIFFGetField().<p>\n\nWhen tags are autodefined like this the <b>field_readcount</b> and\n<b>field_writecount</b> values are always TIFF_VARIABLE.  The \n<b>field_passcount</b> is always TRUE, and the <b>field_bit</b> is \nFIELD_CUSTOM.  The field name will be \"Tag %d\" where the %d is the tag \nnumber.<p>  \n\n<h2>Defining Application Tags</h2>\n\nFor various reasons, it is common for applications to want to define\ntheir own tags to store information outside the core TIFF specification. \nThis is done by calling TIFFMergeFieldInfo() with one or more TIFFFieldInfos. \n<p>\n\nThe libgeotiff library provides geospatial information extentions within\na TIFF file.  First, a set of TIFFFieldInfo's is prepared with information\non the new tags:<p>\n\n<pre>\nstatic const TIFFFieldInfo xtiffFieldInfo[] = {\n  \n  /* XXX Insert Your tags here */\n    { TIFFTAG_GEOPIXELSCALE,\t-1,-1, TIFF_DOUBLE,\tFIELD_CUSTOM,\n      TRUE,\tTRUE,\t\"GeoPixelScale\" },\n    { TIFFTAG_GEOTRANSMATRIX,\t-1,-1, TIFF_DOUBLE,\tFIELD_CUSTOM,\n      TRUE,\tTRUE,\t\"GeoTransformationMatrix\" },\n    { TIFFTAG_GEOTIEPOINTS,\t-1,-1, TIFF_DOUBLE,\tFIELD_CUSTOM,\n      TRUE,\tTRUE,\t\"GeoTiePoints\" },\n    { TIFFTAG_GEOKEYDIRECTORY, -1,-1, TIFF_SHORT,\tFIELD_CUSTOM,\n      TRUE,\tTRUE,\t\"GeoKeyDirectory\" },\n    { TIFFTAG_GEODOUBLEPARAMS,\t-1,-1, TIFF_DOUBLE,\tFIELD_CUSTOM,\n      TRUE,\tTRUE,\t\"GeoDoubleParams\" },\n    { TIFFTAG_GEOASCIIPARAMS,\t-1,-1, TIFF_ASCII,\tFIELD_CUSTOM,\n      TRUE,\tFALSE,\t\"GeoASCIIParams\" }\n};\n</pre>\n\nIn order to define the tags, we call TIFFMergeFieldInfo() on the\ndesired TIFF handle with the list of TIFFFieldInfos.<p>\n\n<pre>\n#define\tN(a)\t(sizeof (a) / sizeof (a[0]))\n\n    /* Install the extended Tag field info */\n    TIFFMergeFieldInfo(tif, xtiffFieldInfo, N(xtiffFieldInfo));\n</pre>\n\nThe tags need to be defined for each TIFF file opened - and when reading\nthey should be defined before the tags of the file are read, yet a valid\nTIFF * is needed to merge the tags against.   In order to get them \nregistered at the appropriate part of the setup process, it is necessary\nto register our merge function as an extender callback with libtiff. \nThis is done with TIFFSetTagExtender().  We also keep track of the \nprevious tag extender (if any) so that we can call it from our extender\nallowing a chain of customizations to take effect. <P>\n\n<pre>\nstatic TIFFExtendProc _ParentExtender = NULL;\n\nstatic\nvoid _XTIFFInitialize(void)\n{\n    static int first_time=1;\n\t\n    if (! first_time) return; /* Been there. Done that. */\n    first_time = 0;\n\t\n    /* Grab the inherited method and install */\n    _ParentExtender = TIFFSetTagExtender(_XTIFFDefaultDirectory);\n}\n</pre>\n\nThe extender callback is looks like this.  It merges in our new fields\nand then calls the next extender if there is one in effect.<p>\n\n<pre>\nstatic void\n_XTIFFDefaultDirectory(TIFF *tif)\n{\n    /* Install the extended Tag field info */\n    TIFFMergeFieldInfo(tif, xtiffFieldInfo, N(xtiffFieldInfo));\n\n    /* Since an XTIFF client module may have overridden\n     * the default directory method, we call it now to\n     * allow it to set up the rest of its own methods.\n     */\n\n    if (_ParentExtender) \n        (*_ParentExtender)(tif);\n}\n</pre>\n\nThe above approach ensures that our new definitions are used when reading\nor writing any TIFF file.  However, since on reading we already have \ndefault definitions for tags, it is usually not critical to pre-define them.\nIf tag definitions are only required for writing custom tags, you can just\ncall TIFFMergeFieldInfo() before setting new tags.  The whole extender\narchitecture can then be avoided.<p>\n\n<A NAME=AddingTags><P><H2>Adding New Builtin Tags</H2></A>\n\nA similar approach is taken to the above.  However, the TIFFFieldInfo \nshould be added to the tiffFieldInfo[] list in tif_dirinfo.c.  Ensure that\nnew tags are added in sorted order by the tag number.<p>\n\nNormally new built-in tags should be defined with FIELD_CUSTOM; however, if\nit is desirable for the tag value to have it's own field in the TIFFDirectory\nstructure, then you will need to #define a new FIELD_ value for it, and\nadd appropriate handling as follows:\n\n\n<OL>\n<LI>Define the tag in <B>tiff.h</B>.\n<LI>Add a field to the directory structure in <B>tif_dir.h</B>\n   and define a <TT>FIELD_*</TT> bit (also update the definition of\n   <TT>FIELD_CODEC</TT> to reflect your addition).\n<LI>Add an entry in the <TT>TIFFFieldInfo</TT> array defined at the top of\n   <B>tif_dirinfo.c</B>. \n   Note that you must keep this array sorted by tag\n   number and that the widest variant entry for a tag should come\n   first (e.g. <TT>LONG</TT> before <TT>SHORT</TT>).\n<LI>Add entries in <TT>_TIFFVSetField()</TT> and <TT>_TIFFVGetField()</TT>\n   for the new tag.\n<LI>(<I>optional</I>) If the value associated with the tag is not a scalar value\n   (e.g. the array for <TT>TransferFunction</TT>) and requires\n   special processing,\n   then add the appropriate code to <TT>TIFFReadDirectory()</TT> and\n   <TT>TIFFWriteDirectory()</TT>.  You're best off finding a similar tag and\n   cribbing code.\n<LI>Add support to <TT>TIFFPrintDirectory()</TT> in <B>tif_print.c</B>\n    to print the tag's value.\n</OL>\n\n<P>\nIf you want to maintain portability, beware of making assumptions\nabout data types.  Use the typedefs (<TT>uint16</TT>, etc. when dealing with\ndata on disk and <TT>t*_t</TT> when stuff is in memory) and be careful about\npassing items through printf or similar vararg interfaces.\n\n<A NAME=AddingCODECTags><P><H2>Adding New Codec-private Tags</H2></A>\n\nTo add tags that are meaningful <EM>only when a particular compression\nalgorithm is used</EM> follow these steps:\n\n<OL>\n<LI>Define the tag in <B>tiff.h</B>.\n<LI>Allocate storage for the tag values in the private state block of\n   the codec.\n<LI>Insure the state block is created when the codec is initialized.\n<LI>At <TT>TIFFInitfoo</TT> time override the method pointers in the\n    TIFF structure\n   for getting, setting and printing tag values.  For example,\n<PRE>\n    sp->vgetparent = tif->tif_vgetfield;\n    tif->tif_vgetfield = fooVGetField;\t/* hook for codec tags */\n    sp->vsetparent = tif->tif_vsetfield;\n    tif->tif_vsetfield = fooVSetField;\t/* hook for codec tags */\n    tif->tif_printdir = fooPrintDir;\t/* hook for codec tags */\n</PRE>\n   (Actually you may decide not to override the\n   <TT>tif_printdir</TT> method, but rather just specify it).\n<LI>Create a private <TT>TIFFFieldInfo</TT> array for your tags and\n    merge them into the core tags at initialization time using\n    <TT>_TIFFMergeFieldInfo</TT>; e.g.\n<PRE>\n    _TIFFMergeFieldInfo(tif, fooFieldInfo, N(fooFieldInfo));\n</PRE>\n   (where <TT>N</TT> is a macro used liberaly throughout the distributed code).\n<LI>Fill in the get and set routines.  Be sure to call the parent method\n   for tags that you are not handled directly.  Also be sure to set the\n   <TT>FIELD_*</TT> bits for tags that are to be written to the file.  Note that\n   you can create ``pseudo-tags'' by defining tags that are processed\n   exclusively in the get/set routines and never written to file (see\n   the handling of <TT>TIFFTAG_FAXMODE</TT> in <B>tif_fax3.c</B>\n   for an example of this).\n<LI>Fill in the print routine, if appropriate.\n</OL>\n\nNote that space has been allocated in the <TT>FIELD_*</TT> bit space for\ncodec-private tags.  Define your bits as <TT>FIELD_CODEC+&lt;offset&gt;</TT> to\nkeep them away from the core tags.  If you need more tags than there\nis room for, just increase <TT>FIELD_SETLONGS</TT> at the top of\n<B>tiffiop.h</B>.\n\n<HR>\n\nLast updated: $Date: 2004/09/10 14:43:18 $\n\n</BODY>\n\n</HTML>\n"
  },
  {
    "path": "src/main/jni/tiff/html/bugs.html",
    "content": "<HTML>\n<HEAD>\n<TITLE>Bugs and the TIFF Mailing List</TITLE>\n</HEAD>\n<BODY BGCOLOR=white> \n<FONT FACE=\"Arial, Helvetica, Sans\">\n<H1>\n<IMG SRC=images/cover.jpg WIDTH=110 HEIGHT=110 ALIGN=left BORDER=1 HSPACE=6>\nBugs, Bugzilla, and the TIFF Mailing List\n</H1>\n\n<P>\nThis software is free.  Please let us know when you find a problem or\nfix a bug.\n\n<P>\nThanks to <A HREF=http://www.maptools.org/>MapTools.org</a>, libtiff now uses\nbugzilla to track bugs.  All bugs filed in the older bugzilla at\nbugzilla.remotesensing.org (pre April 2008) have unfortunately been lost. \n<P>\nIf you think you've discovered a bug, please first check to see if it is \nalready known by looking at the list of already reported bugs.  You can do so \nby visiting the buglist at \n<A HREF=http://bugzilla.maptools.org/buglist.cgi?product=libtiff>http://bugzilla.maptools.org/buglist.cgi?product=libtiff</A>.  Also verify that \nthe problem is still reproducable with the current development software \nfrom CVS. \n<P>\nIf you'd like to enter a new bug, you can do so at\n<A HREF=http://bugzilla.maptools.org/enter_bug.cgi?product=libtiff>http://bugzilla.maptools.org/enter_bug.cgi?product=libtiff</A>.  \n<P>\nIf you'd like to inform us about some kind of security issue that should not\nbe disclosed for a period of time, then you can contact maintainers directly.\nSend a copies of your report to the following people: Frank Warmerdam\n<a href=\"mailto:warmerdam@pobox.com\">&lt;warmerdam@pobox.com&gt;</a>,\nAndrey Kiselev\n<a href=\"mailto:dron@ak4719.spb.edu\">&lt;dron@ak4719.spb.edu&gt;</a>.\n<P>\n\nOf course, reporting bugs is no substitute for discussion.  The \n<a href=\"mailto:tiff@lists.maptools.org\">tiff@lists.maptools.org</a> mailing\nlist is for users of this software, and discussion TIFF issues in general. \nIt is managed with the Mailman software, and the web interface for subscribing\nand managing your access to the list is at:<p>\n\n  <a href=\"http://lists.maptools.org/mailman/listinfo/tiff\">http://lists.maptools.org/mailman/listinfo/tiff</a><P>\n\nPosts to the list are only accepted from members of the list in order\nto limit the amount of spam propagated.  Also, to be approved as a member\nyou will need to email the list administrator with a brief description of\nwhy you are interested in TIFF so we can weed out spammers.<p>\n\nA <A HREF=\"http://www.awaresystems.be/imaging/tiff/tml.html\">Long Term\nArchive</a> including recent messages, and most messages back to 1993,\nwith search capabilities is available, and \nhas been prepared and hosted by <a href=\"http://www.awaresystems.be\">AWare\nSystems</a>. <p>\n\n\n<HR>\n\nLast updated: $Date: 2008/09/03 08:04:26 $\n</BODY>\n</HTML>\n"
  },
  {
    "path": "src/main/jni/tiff/html/build.html",
    "content": "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n<html>\n<head>\n<meta name=\"generator\" content=\n\"HTML Tidy for Solaris (vers 12 April 2005), see www.w3.org\">\n<title>Building the TIFF Software Distribution</title>\n</head>\n<body bgcolor=\"white\">\n<h1><font face=\"Arial, Helvetica, Sans\"><img src=\n\"images/cramps.gif\" width=\"159\" height=\"203\" align=\"left\" border=\n\"1\" hspace=\"6\"> Building the Software Distribution</font></h1>\n<ul>\n<li><a href=\"#UNIX\">Building on a UNIX system</a>.</li>\n<li><a href=\"#MacMPW\">Building on a Macintosh system with\nMPW</a>.</li>\n<li><a href=\"#MacCW\">Building on a Macintosh system with\nCodeWarrior</a>.</li>\n<li><a href=\"#PC\">Building on an MS-DOS or Windows system</a>.</li>\n<li><a href=\"#DJGPP\">Building on MS-DOS with the DJGPP v2\ncompiler</a>.</li>\n<li><a href=\"#VMS\">Building on a VMS system</a>.</li>\n<li><a href=\"#Acorn\">Building on an Acorn RISC OS system</a>.</li>\n<li><a href=\"#Other\">Building the Software on Other\nSystems</a></li>\n</ul>\n<br clear=\"left\">\nThis chapter contains step-by-step instructions on how to configure\nand build the TIFF software distribution. The software is most\neasily built on a UNIX system, but with a little bit of work it can\neasily be built and used on other non-UNIX platforms. <a name=\n\"UNIX\" id=\"UNIX\"></a>\n<hr>\n<h2>Building on a UNIX System</h2>\nTo build the software on a UNIX system you need to first run the\nconfigure shell script that is located in the top level of the\nsource directory. This script probes the target system for\nnecessary tools and functions and constructs a build environment in\nwhich the software may be compiled. Once configuration is done, you\nsimply run <tt>make</tt> (or <tt>gmake</tt>) to build the software\nand then <tt>make install</tt> to do the installation; for example:\n<div style=\"margin-left: 2em\">\n<pre>\nhyla% <b>cd tiff-v3.4beta099</b>\nhyla% <b>./configure</b>\n    <i>...lots of messages...</i>\nhyla% <b>make</b>\n    <i>...lots of messages...</i>\nhyla# <b>make install</b>\n</pre></div>\nSupplied makefiles are depend on GNU <tt>make</tt> utility, so you\nwill need the one. Depending on your installation <b>make</b>\ncommand may invoke standard system <tt>make</tt> and <b>gmake</b>\ninvoke GNU make. In this case you should use former. If you don't\nhave <tt>make</tt> at all, but only <tt>gmake</tt>, you should\nexport environment variable <tt>MAKE=gmake</tt> before\n<b>./configure</b>.\n<p>In general, the software is designed such that the following\nshould be ``<i>make-able</i>'' in each directory:</p>\n<div style=\"margin-left: 2em\">\n<pre>\nmake [all]      build stuff\nmake install    build&amp;install stuff\nmake clean      remove .o files, executables and cruft\nmake distclean  remove everything, that can be recreated\n</pre></div>\nNote that after running \"<tt>make distclean</tt>\" the\n<tt>configure</tt> script must be run again to create the Makefiles\nand other make-related files. <a name=\"BuildTrees\" id=\n\"BuildTrees\"></a>\n<hr width=\"65%\" align=\"right\">\n<h3>Build Trees</h3>\nThere are two schemes for configuring and building the software. If\nyou intend to build the software for only one target system, you\ncan configure the software so that it is built in the same\ndirectories as the source code.\n<div style=\"margin-left: 2em\">\n<pre>\nhyla% <b>cd tiff-v3.4beta099</b>\nhyla% <b>ls</b>\nCOPYRIGHT       VERSION         config.sub      dist            man\nMakefile.in     config.guess    configure       html            port\nREADME          config.site     contrib         libtiff         tools\nhyla% <b>./configure</b>\n</pre></div>\n<p>Otherwise, you can configure a build tree that is parallel to\nthe source tree hierarchy but which contains only configured files\nand files created during the build procedure.</p>\n<div style=\"margin-left: 2em\">\n<pre>\nhyla% <b>cd tiff-v3.4beta099</b>\nhyla% <b>mkdir obj obj/mycpu</b>\nhyla% <b>cd obj/mycpu</b>\nhyla% <b>../../configure</b>\n</pre></div>\nThis second scheme is useful for:\n<ul>\n<li>building multiple targets from a single source tree</li>\n<li>building from a read-only source tree (e.g. if you receive the\ndistribution on CD-ROM)</li>\n</ul>\n<a name=\"ConfigOptions\" id=\"ConfigOptions\"></a>\n<hr width=\"65%\" align=\"right\">\n<h3>Configuration Options</h3>\nThe configuration process is critical to the proper compilation,\ninstallation, and operation of the software. The configure script\nruns a series of tests to decide whether or not the target system\nsupports required functionality and, if it does not, whether it can\nemulate or workaround the missing functions. This procedure is\nfairly complicated and, due to the nonstandard nature of most UNIX\nsystems, prone to error. The first time that you configure the\nsoftware for use you should check the output from the configure\nscript and look for anything that does not make sense for your\nsystem.\n<p>A second function of the configure script is to set the default\nconfiguration parameters for the software. Of particular note are\nthe directories where the software is to be installed. By default\nthe software is installed in the <b>/usr/local</b> hierarchy. To\nchange this behaviour the appropriate parameters can be specified\non the command line to configure. Run <b>./configure --help</b> to\nget a list of possible options. Installation related options are\nshown below.</p>\n<pre>\n<tt>\nInstallation directories:\n  --prefix=PREFIX         install architecture-independent files in PREFIX\n                          [/usr/local]\n  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX\n                          [PREFIX]\n\nBy default, `make install' will install all the files in\n`/usr/local/bin', `/usr/local/lib' etc.  You can specify\nan installation prefix other than `/usr/local' using `--prefix',\nfor instance `--prefix=$HOME'.\n\nFor better control, use the options below.\n\nFine tuning of the installation directories:\n  --bindir=DIR           user executables [EPREFIX/bin]\n  --sbindir=DIR          system admin executables [EPREFIX/sbin]\n  --libexecdir=DIR       program executables [EPREFIX/libexec]\n  --datadir=DIR          read-only architecture-independent data [PREFIX/share]\n  --sysconfdir=DIR       read-only single-machine data [PREFIX/etc]\n  --sharedstatedir=DIR   modifiable architecture-independent data [PREFIX/com]\n  --localstatedir=DIR    modifiable single-machine data [PREFIX/var]\n  --libdir=DIR           object code libraries [EPREFIX/lib]\n  --includedir=DIR       C header files [PREFIX/include]\n  --oldincludedir=DIR    C header files for non-gcc [/usr/include]\n  --infodir=DIR          info documentation [PREFIX/info]\n  --mandir=DIR           man documentation [PREFIX/man]\n\nProgram names:\n  --program-prefix=PREFIX            prepend PREFIX to installed program names\n  --program-suffix=SUFFIX            append SUFFIX to installed program names\n  --program-transform-name=PROGRAM   run sed PROGRAM on installed program names\n</tt>\n</pre>\n<a name=\"Packages\" id=\"Packages\"></a>\n<hr width=\"65%\" align=\"right\">\n<h3>Configuring Optional Packages/Support</h3>\nThe TIFF software comes with several packages that are installed\nonly as needed, or only if specifically configured at the time the\nconfigure script is run. Packages can be configured via the\n<b>configure</b> script commandline parameters.\n<dl>\n<dt><i>Static/Shared Objects Support</i></dt>\n<dd><tt>--enable-shared[=PKGS]&nbsp;&nbsp;&nbsp;&nbsp;build shared\nlibraries [default=yes]<br>\n--enable-static[=PKGS]&nbsp;&nbsp;&nbsp;&nbsp;build static\nlibraries [default=yes]</tt>\n<p>These options control whether or not to configure the software\nto build a shared and static binaries for the TIFF library. Use of\nshared libraries can significantly reduce the disk space needed for\nusers of the TIFF software. If shared libarries are not used then\nthe code is statically linked into each application that uses it.\nBy default both types of binaries is configured.</p>\n<p><tt>--enable-rpath&nbsp;&nbsp;&nbsp;&nbsp;Enable runtime linker\npaths (-R libtool option)</tt></p>\n<p>Add library directories (see other options below) to the TIFF\nlibrary run-time linker path.</p>\n</dd>\n<dt><i>JPEG Support</i></dt>\n<dd><tt>--disable-jpeg&nbsp;&nbsp;&nbsp;&nbsp;disable IJG JPEG\nlibrary usage (required for JPEG compression, enabled by default)\n--with-jpeg-include-dir=DIR&nbsp;&nbsp;&nbsp;&nbsp;location of IJG\nJPEG library headers\n--with-jpeg-lib-dir=DIR&nbsp;&nbsp;&nbsp;&nbsp;location of IJG JPEG\nlibrary binary)</tt></dd>\n<dd>The <tt>JPEG</tt> package enables support for the handling of\nTIFF images with JPEG-encoded data. Support for JPEG-encoded data\nrequires the Independent JPEG Group (IJG) <tt>libjpeg</tt>\ndistribution; this software is available at <a href=\n\"ftp://ftp.uu.net/graphics/jpeg/\">ftp.uu.net:/graphics/jpeg/</a>.\n<b>configure</b> script automatically tries to search the working\nIJG JPEG installation. If it fails to find library, JPEG support\nwill be automatically disabled.If you want specify the exact paths\nto library binary and headers, use above switches for that.</dd>\n<dt><i>ZIP Support</i></dt>\n<dd>The <tt>ZIP</tt> support enables support for the handling of\nTIFF images with deflate-encoded data. Support for deflate-encoded\ndata requires the freely available <tt>zlib</tt> distribution\nwritten by Jean-loup Gailly and Mark Adler; this software is\navailable at <a href=\n\"ftp://ftp.uu.net/pub/archiving/zip/zlib/\">ftp.uu.net:/pub/archiving/zip/zlib/</a>\n(or try <a href=\n\"ftp://quest.jpl.nasa.gov/beta/zlib/\">quest.jpl.nasa.gov:/beta/zlib/</a>).\nIf ZIP support is enabled the <tt>DIRS_LIBINC</tt> and\n<tt>DIR_GZLIB</tt> parameters should also be set (see below). By\ndefault this package is not configured.</dd>\n</dl>\n<a name=\"Sample\" id=\"Sample\"></a>\n<hr width=\"65%\" align=\"right\">\n<h3>A Sample Configuration Session</h3>\nThis section shows a sample configuration session and describes the\nwork done. The session is shown indented in a <tt>fixed width\nfont</tt> with user-supplied input in a <tt><b>bold font</b></tt>.\nComments are shown in a normal or <i>italic</i> font. This session\nwas collected on a 486 machine running BSDI 1.1.\n<div style=\"margin-left: 2em\">\n<pre>\n<tt>\nwullbrandt% <b>mkdir tiff</b>\nwullbrandt% <b>cd tiff</b>\nwullbrandt% <b>ln -s /hosts/oxford/usr/people/sam/tiff src</b>\n</tt>\n</pre></div>\nA build tree separate from the source tree is used here. In fact,\nin this case the distribution is accessed from a read-only\nNFS-mounted filesystem.\n<div style=\"margin-left: 2em\">\n<pre>\n<tt>\nwullbrandt% <b>src/configure</b>\nConfiguring TIFF Software v3.4beta015.\n\nReading site-wide parameters from ../tiff-v3.4beta015/config.site.\nReading local parameters from config.local.\nGosh, aren't you lucky to have a i386-unknown-bsdi1.1 system!\n</tt>\n</pre></div>\nNote that configure announces the distribution version and the\ndeduced target configuration (<tt>i386-unknown-bsdi1.1</tt> here).\n<div style=\"margin-left: 2em\">\n<pre>\n<tt>\nUsing /usr/local/bin/gcc for a C compiler (set CC to override).\nLooks like /usr/local/bin/gcc supports the -g option.\nUsing \" -g\" for C compiler options.\n</tt>\n</pre></div>\nconfigure checked the normal shell search path for potential ANSI C\ncompilers. The compiler is selected according to it properly\ncompiling a small ANSI C test program. A specific compiler may be\nrequested by setting the <tt>CC</tt> environment variable to the\nappropriate pathname, by supplying the parameter on the command\nline, e.g. <tt>-with-CC=gcc</tt>, or by setting <tt>CC</tt> in a\nconfiguration file.\n<p><img src=\"images/info.gif\" align=\"left\" hspace=\"10\"> <em>Note\nthat an ANSI C compiler is required to build the software. If a C\ncompiler requires options to enable ANSI C compilation, they can be\nspecified with the <tt>ENVOPTS</tt> parameter.</em></p>\n<p>Once a compiler is selected configure checks to see if the\ncompiler accepts a -g option to enable the generation of debugging\nsymbols, and if the compiler includes an ANSI C preprocessor.</p>\n<div style=\"margin-left: 2em\">\n<pre>\n<tt>\nUsing /usr/ucb/make to configure the software.\n</tt>\n</pre></div>\nNext various system-specific libraries that may or may not be\nneeded are checked for (none are needed in this case). If your\nsystem requires a library that is not automatically included it can\nbe specified by setting the <tt>MACHDEPLIBS</tt> parameter.\n<p><i>Creating port.h.</i> The <b>port.h</b> file is included by\nall the C code in the library (but not the tools). It includes\ndefinitions for functions and type definitions that are missing\nfrom system include files, <tt>#defines</tt> to enable or disable\nsystem-specific functionality, and other odds and ends.</p>\n<div style=\"margin-left: 2em\">\n<pre>\n<tt>\nCreating libtiff/port.h with necessary definitions.\n... using LSB2MSB bit order for your i386 cpu\n... using big-endian byte order for your i386 cpu\n... configure use of mmap for memory-mapped files\n... O_RDONLY is in &lt;fcntl.h&gt;\n... using double for promoted floating point parameters\n... enabling use of inline functions\nDone creating libtiff/port.h.\n</tt>\n</pre></div>\nThis file can take a long time to create so configure generates the\nfile only when it is needed, either because the file does not exist\nor because a different target or compiler is to be used. Note that\nrunning \"<tt>make distclean</tt>\" in the top-level directory of the\nbuild tree will remove the <b>port.h</b> file (along with all the\nother files generated by configure).\n<p><i>Selecting emulated library functions.</i> Certain library\nfunctions used by the tools are not present on all systems and can\nbe emulated using other system functionality. configure checks for\nthe presence of such functions and if they are missing, will\nconfigure emulation code from the <b>port</b> directory to use\ninstead. Building the TIFF software on unsupported systems may\nrequire adding to the code to the <b>port</b> directory.</p>\n<div style=\"margin-left: 2em\">\n<pre>\n<tt>\nChecking system libraries for functionality to emulate.\nDone checking system libraries.\n</tt>\n</pre></div>\nIf a routine must be emulated and configure does not automatically\ncheck for it, the routine name can be specified using the\n<tt>PORTFUNCS</tt> parameter. To add emulation support for a new\nfunction <tt>foo</tt>, create a file <b>port/foo.c</b> that\ncontains the emulation code and then set <tt>PORTFUNCS=foo</tt> in\na configuration file or modify the configure script to\nautomatically check for the missing function.\n<div style=\"margin-left: 2em\">\n<pre>\n<tt>\nChecking for Dynamic Shared Object (DSO) support.\nDone checking for DSO support.\n</tt>\n</pre></div>\nIf the <tt>DSO</tt> package is enabled (<tt>DSO=auto</tt> or\n<tt>DSO=yes</tt>), then configure will verify the system and\ncompiler are capable of constructing SVR4-style DSO's in the\nexpected way. Note that while a system may support DSO's the\ncompiler may not be capable of generating the required\nposition-independent code and/or the compiler may not pass the\nneeded options through to the loader.\n<p><i>Selecting utility programs.</i> configure locates various\nsystem utility programs that are used during installation of the\nsoftware.</p>\n<div style=\"margin-left: 2em\">\n<pre>\n<tt>\nSelecting programs used during installation.\nLooks like mv supports the -f option to force a move.\nLooks like /bin/ln supports the -s option to create a symbolic link.\nDone selecting programs.\n</tt>\n</pre></div>\n<p><i>Selecting default configuration parameters.</i> The remainder\nof the work done by configure involves setting up configuration\nparameters that control the placement and setup of files during the\ninstallation procedure.</p>\n<div style=\"margin-left: 2em\">\n<pre>\n<tt>\nSelecting default TIFF configuration parameters.\n\nLooks like manual pages go in /usr/contrib/man.\nLooks like manual pages should be installed with bsd-nroff-gzip-0.gz.\n\nTIFF configuration parameters are:\n\n[ 1] Directory for tools:               /usr/contrib/bin\n[ 2] Directory for libraries:           /usr/contrib/lib\n[ 3] Directory for include files:       /usr/contrib/include\n[ 4] Directory for manual pages:        /usr/contrib/man\n[ 5] Manual page installation scheme:   bsd-nroff-gzip-0.gz\n\nAre these ok [yes]? \n</tt>\n</pre></div>\nAt this point you can interactively modify any of the displayed\nparameters. Hitting a carriage return or typing <tt>yes</tt> will\naccept the current parameters. Typing one of the number displayed\nalong the left hand side causes configure to prompt for a new value\nof the specified parameter. Typing anything else causes configure\nto prompt for a new value <em>for each parameter</em>. In general\nhitting carriage return will accept the current value and typing\nanything that is unacceptable will cause a help message to be\ndisplayed. A description of each of the configuration parameters is\ngiven below.\n<p>Once acceptable parameters are setup configure will generate all\nthe files that depend on these parameters. Note that certain files\nmay or may not be created based on the configuration of optional\npackages and/or the functions supported by target system.</p>\n<div style=\"margin-left: 2em\">\n<pre>\n<tt>\nCreating Makefile from ../tiff-v3.4beta015/Makefile.in\nCreating libtiff/Makefile from ../tiff-v3.4beta015/libtiff/Makefile.in\nCreating man/Makefile from ../tiff-v3.4beta015/man/Makefile.in\nCreating tools/Makefile from ../tiff-v3.4beta015/tools/Makefile.in\nCreating port/install.sh from ../tiff-v3.4beta015/port/install.sh.in\nDone.\n</tt>\n</pre></div>\n<a name=\"DSOSupport\" id=\"DSOSupport\"></a>\n<hr>\n<h3>Shared Library Support</h3>\nIt is desirable to make the TIFF library be a shared object on\nsystems that have support for shared libraries. Unfortunately the\nrules to use to build a shared library vary between operating\nsystems and even compilers. The distributed software includes\nsupport for building a shared version of the library on a number of\ndifferent systems. This support is split between rules in the file\n<b>libtiff/Makefile.in</b> that construct the shared library and\nchecks done by the <tt>configure</tt> script to verify that the\nexpected rules are supported by compilation tools for the target\nsystem.\n<p>To add new support for building a shared library both these\nfiles must be updated. In the configure script search for the\nsection where the autoconfiguration setting of the <tt>DSO</tt>\nparameter is handled and add a new case for the target system that\nsets the <tt>DSOSUF</tt>, <tt>DSOLD</tt>, <tt>DSOOPTS</tt>, and\n<tt>LIBCOPTS</tt> options as appropriate for the system.\n<tt>DSOSUF</tt> specifies the filename suffix used for the shared\nlibrary (e.g. ``.so'' for Dynamic Shared Objects on most SVR4-based\nsystems). <tt>DSOLD</tt> specifies the program to use to build the\nshared library from a compiled object file; typically ``${LD}''\nthough on some systems it is better to use the C compiler directly\nso system-dependent options and libraries are automatically\nsupplied. <tt>DSOOPTS</tt> are options that must be specified to\n<tt>DSOLD</tt> when building the shared library. <tt>LIBCOPTS</tt>\nare options to pass to the C compiler when constructing a\nrelocatable object file to include in a shared library; e.g. ``-K\nPIC'' on a Sun system. The <tt>DSO</tt> parameter must also be set\nto a unique label that identifies the target system and compilation\ntools. This label is used to select a target in\n<b>libtiff/Makefile.in</b> to do the actual work in building the\nshared library. Finally, to complete support for the shared library\nadded the appropriate rules to <b>libtiff/Makefile.in</b> under the\ntarget specified in the <tt>configure</tt> script. <a name=\"PC\" id=\n\"PC\"></a></p>\n<hr>\n<h2>Building the Software under Windows 95/98/NT/2000 with MS\nVC++</h2>\nWith Microsoft Visual C++ installed, and properly configured for\ncommandline use (you will likely need to source VCVARS32.BAT in\nAUTOEXEC.bAT or somewhere similar) you should be able to use the\nprovided <tt>makefile.vc</tt>.\n<p>The source package is delivered using Unix line termination\nconventions, which work with MSVC but do not work with Windows\n'notepad'. If you use unzip from the <a href=\n\"http://www.info-zip.org/pub/infozip/\">Info-Zip</a> package, you\ncan extract the files using Windows normal line termination\nconventions with a command similar to:</p>\n<pre>\n  unzip -aa -a tiff-3.7.4.zip\n</pre>\n<p>By default libtiff expects that a pre-built zlib and jpeg\nlibrary are provided by the user. If this is not the case, then you\nmay edit libtiff\\tiffconf.h using a text editor (e.g. notepad) and\ncomment out the entries for JPEG_SUPPORT, PIXARLOG_SUPPORT, and\nZIP_SUPPORT. Ignore the comment at the top of the file which says\nthat it has no influence on the build, because the statement is not\ntrue for Windows. However, by taking this approach, libtiff will\nnot be able to open some TIFF files.</p>\n<p>To build using the provided makefile.vc you may use:</p>\n<pre>\n  C:\\tiff-3.7.4&gt; nmake /f makefile.vc clean\n  C:\\tiff-3.7.4&gt; nmake /f makefile.vc\n\n    or (the hard way)\n\n  C:\\tiff-3.7.4&gt; cd port\n  C:\\tiff-3.7.4\\port&gt; nmake /f makefile.vc clean\n  C:\\tiff-3.7.4\\port&gt; nmake /f makefile.vc\n  C:\\tiff-3.7.4&gt; cd ../libtiff\n  C:\\tiff-3.7.4\\libtiff&gt; nmake /f makefile.vc clean\n  C:\\tiff-3.7.4\\libtiff&gt; nmake /f makefile.vc\n  C:\\tiff-3.7.4\\libtiff&gt; cd ..\\tools\n  C:\\tiff-3.7.4\\tools&gt; nmake /f makefile.vc clean\n  C:\\tiff-3.7.4\\tools&gt; nmake /f makefile.vc\n</pre>\n<p>This will build the library file\n<tt>libtiff\\libtiff\\libtiff.lib</tt>. This can be used in Win32\nprograms. You may want to adjust the build options before start\ncompiling. All parameters contained in the <tt>nmake.opt</tt>\nfile.This is a plain text file you can open with your favorite text\neditor.</p>\n<p>The makefile also builds a DLL (libtiff.dll) with an associated\nimport library (libtiff_i.lib). Any builds using libtiff will need\nto include the LIBTIFF\\LIBTIFF directory in the include path.</p>\n<p>The <tt>libtiff\\tools\\makefile.vc</tt> should build .exe's for\nall the standard TIFF tool programs.</p>\n<p><a name=\"DJGPP\" id=\"DJGPP\"></a></p>\n<hr>\n<h2>Building the Software under MS/DOS with the DJGPP v2\ncompiler</h2>\n[<i>From the file <b>contrib/dosdjgpp/README</b>.</i>]\n<p>The directory <b>contrib/dosdjgpp</b> contains the files\nnecessary to build the library and tools with the DJGPP v2 compiler\nunder MSDOS.</p>\n<p>All you have to do is copy the files in the directory into the\nrespective directories and run make. If you want, you can use the\n<b>conf.bat</b> script to do that for you, make sure that the file\nis stored with MSDOS text EOL-convention (CR/LF), otherwise the\n<b>command.com</b> will not do anything.</p>\n<p>Note that you probably will not be able to build the library\nwith the v1.x versions of djgpp, due to two problems. First, the\ntop makefile calls a sub-make for each directory and you are likely\nto run out of memory, since each recursive invocation of a djgpp\nv1.x program requires about 130k, to avoid that, you can enter the\ndirectories manually and call make (well, there are only two dirs).\nThe 2nd problem is that djgpp 1.x doesn't call the coff2exe\n(stubify) program when creating an executable. This means that all\nprograms compiled are not converted to exe and consequently are not\navailable for calling directly. For the tools directory, you can\njust call coff2exe for each program after make finishes, but in the\nlibtiff directory, a few programs are created during the make\nprocess that have to be called for make to continue (e.g.\nmkg3states). Make will probably report an error at each such stage.\nTo fix that, either add a coff2exe call before each program is\ncalled or call coff2exe manually and rerun make (there 2-3 such\nprograms). <a name=\"MacMPW\" id=\"MacMPW\"></a></p>\n<hr>\n<h2>Building the Software on a Macintosh with MPW</h2>\nThe directory <b>contrib/mac-mpw</b> contains support for compiling\nthe library and tools under the MPW Shell on a Macintosh system.\nThis support was contributed by Niles Ritter (<a href=\n\"mailto:ndr@tazboy.jpl.nasa.gov\">ndr@tazboy.jpl.nasa.gov</a>).\n<p>[<i>From the file <b>contrib/mac-mpw/README</b>.</i>]</p>\n<p>This directory contains all of the utilities and makefile source\nto build the LIBTIFF library and tools from the MPW Shell. The file\nBUILD.mpw in this directory is an executable script which uses all\nof these files to create the MPW makefiles and run them.</p>\n<p>The &lt;file&gt;.make files are not MPW makefiles as such, but\nare when run through the \"mactrans\" program, which turns the ascii\n\"%nn\" metacharacters into the standard weird MPW make\ncharacters.</p>\n<p>This translation trick is necessary to protect the files when\nthey are put into unix tarfiles, which tend to mangle the special\ncharacters. <a name=\"MacCW\" id=\"MacCW\"></a></p>\n<hr>\n<h2>Building the Software on a Macintosh with CodeWarrior</h2>\nThe directory <b>contrib/mac-cw</b> contains support for compiling\nthe library and tools with MetroWerks CodeWarrior 6.1 on a\nMacintosh system. This support was contributed by Niles Ritter\n(<a href=\n\"mailto:ndr@tazboy.jpl.nasa.gov\">ndr@tazboy.jpl.nasa.gov</a>).\n<p>[<i>From the file <b>contrib/mac-cw/README</b>.</i>] In this\ndirectory you will find a Makefile.script Applescript file, which\nshould be run in order to build the libtiff code using MetroWerks\nCodeWarrior. Refer to the \"metrowerks.note\" instructions on\nbuilding the library for 68k and PowerPC native code, as well as\nbuilding some of the libtiff tools, which are rather unix-like, but\nat least give an example of how to link everything together.\n<a name=\"VMS\" id=\"VMS\"></a></p>\n<hr>\n<h2>Building the Software on a VMS System</h2>\nThe VMS port was done by Karsten Spang (<a href=\n\"mailto:krs@kampsax.dk\">krs@kampsax.dk</a>), who also \"sort of\"\nmaintains it. The VMS specific files are not in the main\ndirectories. Instead they are placed under\n<tt>[.CONTRIB.VMS...]</tt> in the distribution tree. Installation:\nIt is assumed that you have unpacked the tar file into a VMS\ndirectory tree, in this text called DISK:[TIFF].\n<ol>\n<li>Move the VMS specific files to their proper directories.\n<pre>\n$ SET DEFAULT DISK:[TIFF.CONTRIB.VMS]\n$ RENAME [.LIBTIFF]*.* [-.-.LIBTIFF]\n$ RENAME [.TOOLS]*.* [-.-.TOOLS]\n</pre></li>\n<li>Compile the library.\n<pre>\n$ SET DEFAULT DISK:[TIFF.LIBTIFF]\n$ @MAKEVMS\n</pre></li>\n<li>Compile the tools.\n<pre>\n$ SET DEFAULT DISK:[TIFF.TOOLS]\n$ @MAKEVMS\n</pre></li>\n<li>Define the programs.\n<pre>\n$ DEFINE TIFFSHR DISK:[TIFF.LIBTIFF]TIFFSHR\n$ FAX2PS    :==$DISK:[TIFF.TOOLS]FAX2PS\n$ FAX2TIFF  :==$DISK:[TIFF.TOOLS]FAX2TIFF\n$ GIF2TIFF  :==$DISK:[TIFF.TOOLS]GIF2TIFF\n$ PAL2RGB   :==$DISK:[TIFF.TOOLS]PAL2RGB\n$ PPM2TIFF  :==$DISK:[TIFF.TOOLS]PPM2TIFF\n$ RAS2TIFF  :==$DISK:[TIFF.TOOLS]RAS2TIFF\n$ RGB2YCBCR :==$DISK:[TIFF.TOOLS]RGB2YCBCR\n$ THUMBNAIL :==$DISK:[TIFF.TOOLS]THUMBNAIL\n$ TIFF2BW   :==$DISK:[TIFF.TOOLS]TIFF2BW\n$ TIFF2PS   :==$DISK:[TIFF.TOOLS]TIFF2PS\n$ TIFFCMP   :==$DISK:[TIFF.TOOLS]TIFFCMP\n$ TIFFCP    :==$DISK:[TIFF.TOOLS]TIFFCP\n$ TIFFDITHER:==$DISK:[TIFF.TOOLS]TIFFDITHER\n$ TIFFDUMP  :==$DISK:[TIFF.TOOLS]TIFFDUMP\n$ TIFFINFO  :==$DISK:[TIFF.TOOLS]TIFFINFO\n$ TIFFMEDIAN:==$DISK:[TIFF.TOOLS]TIFFMEDIAN\n$ TIFFSPLIT :==$DISK:[TIFF.TOOLS]TIFFSPLIT\n$ YCBCR     :==$DISK:[TIFF.TOOLS]YCBCR\n</pre></li>\n</ol>\nYou will want to add these lines to your <tt>LOGIN.COM</tt> file,\nafter changing the name of the directory that you have used on your\nmachine.\n<p>This release has been tested on OpenVMS/VAX 5.5-2, using VAX C\n3.2. A previous release was tested under OpenVMS/AXP ?.? using DEC\nC ?.?, it is believed that this release as well works on AXP. The\ncode contains some GNU C specific things. This does *not* imply,\nhowever, that the VAX/GCC configuration has been tested, *it has\nnot*.</p>\n<p>The command procedures (<tt>MAKEVMS.COM</tt>) for building the\nlibrary and tools, is believed to choose the correct options for\nthe VAX and AXP cases automatically.</p>\n<p>On the AXP, IEEE floating point is used by default. If you want\nVAX floating point, remove the <tt>/FLOAT=IEEE_FLOAT</tt>\nqualifier, and change <tt>HAVE_IEEEFP=1</tt> to\n<tt>HAVE_IEEEFP=0</tt> in the <tt>MAKEVMS.COM</tt> files in both\nthe <b>libtiff</b> and <b>tools</b> directories.</p>\n<h3>Compiling your own program on a VMS system:</h3>\nWhen compiling a source file in which you <tt>\"#include\n&lt;tiffio.h&gt;\"</tt>, use the following command\n<pre>\n    $ CC/INCLUDE=DISK:[TIFF.LIBTIFF]\n</pre>\nThis ensures that the header file is found. On the AXP, also add\n<tt>/FLOAT=IEEE_FLOAT</tt> (if used when building the library).\n<h3>Linking your own program to the TIFF library on a VMS\nsystem:</h3>\nYou can link to the library in two ways: Either using the shareable\nlibrary, or using the object library. On the VAX these\npossibilities are:\n<ol>\n<li>Using the shareable TIFF library.\n<pre>\n$ LINK MY_PROGRAM,DISK:[TIFF.LIBTIFF]TIFF/OPTIONS,SYS$INPUT:/OPTIONS\n    SYS$SHARE:VAXCRTL/SHAREABLE\n</pre></li>\n<li>Using the TIFF object library.\n<pre>\n$ LINK MY_PROGRAM, -\n    DISK:[TIFF.LIBTIFF]TIFF/LIBRARY/INCLUDE=(TIF_FAX3SM,TIF_CODEC), -\n    SYS$INPUT:/OPTIONS\n    SYS$SHARE:VAXCRTL/SHAREABLE\n</pre></li>\n</ol>\nOn AXP (and possibly also using DEC C on VAX) the corresponding\ncommands are\n<ol>\n<li>Using the shareable TIFF library.\n<pre>\n$ LINK MY_PROGRAM,DISK:[TIFF.LIBTIFF]TIFF/OPTIONS\n</pre></li>\n<li>Using the TIFF object library.\n<pre>\n$ LINK MY_PROGRAM,DISK:[TIFF.LIBTIFF]TIFF/LIBRARY\n</pre></li>\n</ol>\nMethod 1 uses the shortest link time and smallest <tt>.EXE</tt>\nfiles, but it requires that <tt>TIFFSHR</tt> is defined as above at\nlink time and <strong>at run time</strong>. Using the compilation\nprocedure above, the tools are linked in this way.\n<p>Method 2 gives somewhat longer link time and larger\n<tt>.EXE</tt> files, but does not require <tt>TIFFSHR</tt> to be\ndefined. This method is recommended if you want to run your program\non another machine, and for some reason don't want to have the\nlibrary on that machine. If you plan to have more than one program\n(including the tools) on the machine, it is recommended that you\ncopy the library to the other machine and use method 1. <a name=\n\"Acorn\" id=\"Acorn\"></a></p>\n<hr>\n<h2>Building the Software on an Acorn RISC OS system</h2>\nThe directory <b>contrib/acorn</b> contains support for compiling\nthe library under Acorn C/C++ under Acorn's RISC OS 3.10 or above.\nSubsequent pathnames will use the Acorn format: The full-stop or\nperiod character is a pathname delimeter, and the slash character\nis not interpreted; the reverse position from Unix. Thus\n\"libtiff/tif_acorn.c\" becomes \"libtiff.tif_acorn/c\".\n<p>This support was contributed by Peter Greenham. (<a href=\n\"mailto:peter@enlarion.demon.co.uk\">peter@enlarion.demon.co.uk</a>).</p>\n<h3>Installing LibTIFF:</h3>\n<p>LIBTIFF uses several files which have names longer than the\nnormal RISC OS maximum of ten characters. This complicates matters.\nMaybe one day Acorn will address the problem and implement long\nfilenames properly. Until then this gets messy, especially as I'm\ntrying to do this with obeyfiles and not have to include binaries\nin this distribution.</p>\n<p>First of all, ensure you have Truncate configured on (type\n<tt>*Configure Truncate On</tt>)</p>\n<p>Although it is, of course, preferable to have long filenames,\nLIBTIFF can be installed with short filenames, and it will compile\nand link without problems. However, <i>getting</i> it there is more\nproblematic. <b>contrib.acorn.install</b> is an installation\nobeyfile which will create a normal Acorn-style library from the\nsource (ie: with c, h and o folders etc.), but needs the\ndistribution library to have been unpacked into a location which is\ncapable of supporting long filenames, even if only temporarily.</p>\n<p>My recommendation, until Acorn address this problem properly, is\nto use Jason Tribbeck's <a href=\n\"ftp://ftp.demon.co.uk/pub/mirrors/hensa/micros/arch/riscos/c/c020/longfiles.arc\">\nLongFilenames</a>, or any other working system that gives you long\nfilenames, like a nearby NFS server for instance.</p>\n<p>If you are using Longfilenames, even if only temporarily to\ninstall LIBTIFF, unpack the TAR into a RAMDisc which has been\nlongfilenamed (ie: <tt>*addlongfs ram</tt>) and then install from\nthere to the hard disk. Unfortunately Longfilenames seems a bit\nunhappy about copying a bunch of long-named files across the same\nfiling system, but is happy going between systems. You'll need to\ncreate a ramdisk of about 2Mb.</p>\n<p>Now you can run the installation script I've supplied (in\ncontrib.acorn), which will automate the process of installing\nLIBTIFF as an Acorn-style library. The syntax is as follows:</p>\n<p><tt>install &lt;source_dir&gt; &lt;dest_dir&gt;</tt></p>\n<p>Install will then create &lt;dest_dir&gt; and put the library in\nthere. For example, having used LongFilenames on the RAMDisk and\nunpacked the library into there, you can then type:</p>\n<p><tt>Obey RAM::RamDisc0.$.contrib.acorn.install RAM::RamDisc0.$\nADFS::4.$.LIBTIFF</tt></p>\n<p>It doesn't matter if the destination location can cope with long\nfilenames or not. The filenames will be truncated if necessary\n(*Configure Truncate On if you get errors) and all will be\nwell.</p>\n<h3>Compiling LibTIFF:</h3>\n<p>Once the LibTIFF folder has been created and the files put\ninside, making the library should be just a matter of running\n'<b>SetVars</b>' to set the appropriate system variables, then\nrunning '<b>Makefile</b>'.</p>\n<p><b>OSLib</b></p>\n<p><a href=\n\"ftp://ftp.acorn.co.uk/pub/riscos/releases/oslib/oslib.arc\">OSLib</a>\nis a comprehensive API for RISC OS machines, written by Jonathan\nCoxhead of Acorn Computers (although OSLib is not an official Acorn\nproduct). Using the OSLib SWI veneers produces code which is more\ncompact and more efficient than code written using _kernel_swi or\n_swi. The Acorn port of LibTIFF can take advantage of this if\npresent. Edit the Makefile and go to the Static dependencies\nsection. The first entry is:</p>\n<pre>\n# Static dependencies:\n@.o.tif_acorn:   @.c.tif_acorn\n        cc $(ccflags) -o @.o.tif_acorn @.c.tif_acorn \n</pre>\n<p>Change the cc line to:</p>\n<pre>\n        cc $(ccflags) -DINCLUDE_OSLIB -o @.o.tif_acorn @.c.tif_acorn \n</pre>\n<p>Remember, however, that OSLib is only <i>recommended</i> for\nefficiency's sake. It is not required. <a name=\"Other\" id=\n\"Other\"></a></p>\n<hr>\n<h2>Building the Software on Other Systems</h2>\nThis section contains information that might be useful if you are\nworking on a non-UNIX system that is not directly supported. All\nlibrary-related files described below are located in the\n<b>libtiff</b> directory.\n<p>The library requires two files that are generated\n<i>on-the-fly</i>. The file <b>tif_fax3sm.c</b> has the state\ntables for the Group 3 and Group 4 decoders. This file is generated\nby the <tt>mkg3states</tt> program on a UNIX system; for\nexample,</p>\n<div style=\"margin-left: 2em\">\n<pre>\n<tt>\ncd libtiff\ncc -o mkg3states mkg3states.c\nrm -f tif_fax3sm.c\n./mkg3states -c const tif_fax3sm.c\n</tt>\n</pre></div>\nThe <tt>-c</tt> option can be used to control whether or not the\nresutling tables are generated with a <tt>const</tt> declaration.\nThe <tt>-s</tt> option can be used to specify a C storage class for\nthe table declarations. The <tt>-b</tt> option can be used to force\ndata values to be explicitly bracketed with ``{}'' (apparently\nneeded for some MS-Windows compilers); otherwise the structures are\nemitted in as compact a format as possible. Consult the source code\nfor this program if you have questions.\n<p>The second file required to build the library, <b>version.h</b>,\ncontains the version information returned by the\n<tt>TIFFGetVersion</tt> routine. This file is built on most systems\nusing the <tt>mkversion</tt> program and the contents of the\n<tt>VERSION</tt> and <tt>tiff.alpha</tt> files; for example,</p>\n<div style=\"margin-left: 2em\">\n<pre>\ncd libtiff\ncc -o mkversion mkversion.c\nrm -f version.h\n./mkversion -v ../VERSION -a ../dist/tiff.alpha version.h\n</pre></div>\n<p>Otherwise, when building the library on a non-UNIX system be\nsure to consult the files <b>tiffcomp.h</b> and <b>tiffconf.h</b>.\nThe former contains system compatibility definitions while the\nlatter is provided so that the software configuration can be\ncontrolled on systems that do not support the make facility for\nbuilding the software.</p>\n<p>Systems without a 32-bit compiler may not be able to handle some\nof the codecs in the library; especially the Group 3 and 4 decoder.\nIf you encounter problems try disabling support for a particular\ncodec; consult the <a href=\n\"internals.html#Config\">documentation</a>.</p>\n<p>Programs in the tools directory are written to assume an ANSI C\ncompilation environment. There may be a few POSIX'isms as well. The\ncode in the <b>port</b> directory is provided to emulate routines\nthat may be missing on some systems. On UNIX systems the\n<tt>configure</tt> script automatically figures out which routines\nare not present on a system and enables the use of the equivalent\nemulation routines from the <b>port</b> directory. It may be\nnecessary to manually do this work on a non-UNIX system. <a name=\n\"Testing\" id=\"Testing\"></a></p>\n<hr>\n<h2>Checking out the Software</h2>\n<p>Assuming you have working versions of <tt>tiffgt</tt> and\n<tt>tiffsv</tt>, you can just use them to view any of the sample\nimages available for testing (see the <a href=\"images.html\">section\non obtaining the test images</a>). Otherwise, you can do a cursory\ncheck of the library with the <tt>tiffcp</tt> and <tt>tiffcmp</tt>\nprograms. For example,</p>\n<div style=\"margin-left: 2em\">\n<pre>\ntiffcp -lzw cramps.tif x.tif\ntiffcmp cramps.tif x.tif\n</pre></div>\n<p>(<tt>tiffcmp</tt> should be silent if the files compare\ncorrectly). <a name=\"TOC\" id=\"TOC\"></a></p>\n<hr>\n<h2>Table of Contents</h2>\nThe following files makup the core library:\n<pre>\nlibtiff/tiff.h                  TIFF spec definitions\nlibtiff/tiffcomp.h              non-UNIX OS-compatibility definitions\nlibtiff/tiffconf.h              non-UNIX configuration definitions\nlibtiff/tiffio.h                public TIFF library definitions\nlibtiff/tiffiop.h               private TIFF library definitions\nlibtiff/t4.h                    CCITT Group 3/4 code tables+definitions\nlibtiff/tif_dir.h               private defs for TIFF directory handling\nlibtiff/tif_fax3.h              CCITT Group 3/4-related definitions\nlibtiff/tif_predict.h           private defs for Predictor tag support\nlibtiff/uvcode.h                LogL/LogLuv codec-specific definitions\nlibtiff/version.h               version string (generated by Makefile)\n\nlibtiff/tif_acorn.c             Acorn-related OS support\nlibtiff/tif_apple.c             Apple-related OS support\nlibtiff/tif_atari.c             Atari-related OS support\nlibtiff/tif_aux.c               auxilary directory-related functions\nlibtiff/tif_close.c             close an open TIFF file\nlibtiff/tif_codec.c             configuration table of builtin codecs\nlibtiff/tif_compress.c          compression scheme support\nlibtiff/tif_dir.c               directory tag interface code\nlibtiff/tif_dirinfo.c           directory known tag support code\nlibtiff/tif_dirread.c           directory reading code\nlibtiff/tif_dirwrite.c          directory writing code\nlibtiff/tif_dumpmode.c          \"no\" compression codec\nlibtiff/tif_error.c             library error handler\nlibtiff/tif_fax3.c              CCITT Group 3 and 4 codec\nlibtiff/tif_fax3sm.c            G3/G4 state tables (generated by mkg3states)\nlibtiff/tif_flush.c             i/o and directory state flushing\nlibtiff/tif_getimage.c          TIFFRGBAImage support\nlibtiff/tif_jpeg.c              JPEG codec (interface to the IJG distribution)\nlibtiff/tif_luv.c               SGI LogL/LogLuv codec\nlibtiff/tif_lzw.c               LZW codec\nlibtiff/tif_msdos.c             MSDOS-related OS support\nlibtiff/tif_next.c              NeXT 2-bit scheme codec (decoding only)\nlibtiff/tif_open.c              open and simply query code\nlibtiff/tif_packbits.c          Packbits codec\nlibtiff/tif_pixarlog.c          Pixar codec\nlibtiff/tif_predict.c           Predictor tag support\nlibtiff/tif_print.c             directory printing support\nlibtiff/tif_read.c              image data reading support\nlibtiff/tif_strip.c             some strip-related code\nlibtiff/tif_swab.c              byte and bit swapping support\nlibtiff/tif_thunder.c           Thunderscan codec (decoding only)\nlibtiff/tif_tile.c              some tile-related code\nlibtiff/tif_unix.c              UNIX-related OS support\nlibtiff/tif_version.c           library version support\nlibtiff/tif_vms.c               VMS-related OS support\nlibtiff/tif_warning.c           library warning handler\nlibtiff/tif_win3.c              Windows-3.1-related OS support\nlibtiff/tif_win32.c             Win32 (95/98/NT) related OS support\nlibtiff/tif_write.c             image data writing support\nlibtiff/tif_zip.c               Deflate codec\n\nlibtiff/mkg3states.c            program to generate G3/G4 decoder state tables\nlibtiff/mkspans.c               program to generate black-white span tables\nlibtiff/mkversion.c             program to generate libtiff/version.h.\n</pre>\n<hr>\nLast updated: $Date: 2005/12/24 22:25:05 $\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/contrib.html",
    "content": "<HTML>\n<HEAD>\n<TITLE>\nContributed TIFF Software\n</TITLE>\n</HEAD>\n\n<BODY BGCOLOR=white> \n<FONT FACE=\"Arial, Helvetica, Sans\">\n<H1>\n<IMG SRC=images/smallliz.jpg WIDTH=144 HEIGHT=108 ALIGN=left BORDER=1 HSPACE=6>\nContributed TIFF Software\n</H1>\n\n\n<P>\nThe <B>contrib</B> directory has contributed software that\nuses the TIFF library or which is associated with the library\n(typically glue and guidance for ports to non-UNIX platforms, or tools that\naren't directly TIFF related).\n\n<BR CLEAR=left>\n\n<P>\n<TABLE BORDER CELLPADDING=3>\n\n<TR>\n<TD VALIGN=top>\n<B>contrib/vms</B>\n</TD>\n<TD>\nscripts and files from Karsten Spang for building\n\t\tthe library and tools under VMS\n</TD>\n</TR>\n\n<TR>\n<TD VALIGN=top>\n<B>contrib/dbs</B>\n</TD>\n<TD>\nvarious tools from Dan & Chris Sears, including a simple X-based viewer\n</TD>\n</TR>\n\n<TR>\n<TD VALIGN=top>\n<B>contrib/ras</B>\n</TD>\n<TD>\ntwo programs by Patrick Naughton for converting\n\t\tbetween Sun rasterfile format and TIFF (these\n\t\trequire <TT>libpixrect.a</TT>, as opposed to the one in\n\t\ttools that doesn't)\n</TD>\n</TR>\n\n<TR>\n<TD VALIGN=top>\n<B>contrib/mac-mpw</B><br>\n<B>contrib/mac-cw</B>\n</TD>\n<TD>\nscripts and files from Niles Ritter for building\nthe library and tools under Macintosh/MPW C and\ncode warrior.\n</TD>\n</TR>\n\n<TR>\n<TD VALIGN=top>\n<B>contrib/acorn</B>\n</TD>\n<TD>\nscripts and files from Peter Greenham for building\n\t\tthe library and tools on an Acorn RISC OS system.\n</TD>\n</TR>\n\n<TR>\n<TD VALIGN=top>\n<B>contrib/win32</B>\n</TD>\n<TD>\nscripts and files from Scott Wagner for building\nthe library under Windows NT and Windows 95. (The makefile.vc in the\nlibtiff/libtiff directory may be sufficient for most users.)\n</TD>\n</TR>\n\n<TR>\n<TD VALIGN=top>\n<B>contrib/win_dib</B>\n</TD>\n<TD>\ntwo separate implementations of TIFF to DIB code suitable for any Win32 \nplatform.  Contributed by Mark James, and Philippe Tenenhaus.\n</TD>\n</TR>\n\n<TR>\n<TD VALIGN=top>\n<B>contrib/ojpeg</B>\n</TD>\n<TD>\nPatch for IJG JPEG library related to support for some Old JPEG in TIFF files.\nContributed by Scott Marovich.\n</TD>\n</TR>\n\n<TR>\n<TD VALIGN=top>\n<B>contrib/dosdjgpp</B>\n</TD>\n<TD>\nscripts and files from Alexander Lehmann for building\n\t\tthe library under MSDOS with the DJGPP v2 compiler.\n</TD>\n</TR>\n\n<TR>\n<TD VALIGN=top>\n<B>contrib/tags</B>\n</TD>\n<TD>\nscripts and files from Niles Ritter for adding private\n         tag support at runtime, without changing libtiff.\n</TD>\n</TR>\n\n<TR>\n<TD VALIGN=top>\n<B>contrib/mfs</B>\n</TD>\n<TD>\ncode from Mike Johnson to read+write images in memory\nwithout modifying the library\n</TD>\n</TR>\n\n<TR>\n<TD VALIGN=top>\n<B>contrib/pds</B>\n</TD>\n<TD>\nvarious routines from Conrad Poelman; a TIFF image iterator and\n   code to support ``private sub-directories''\n</TD>\n</TR>\n\n<TR>\n<TD VALIGN=top>\n<B>contrib/iptcutil</B>\n</TD>\n\n<TD>\n\nA utility by <A HREF=mailto:billr@corbis.com>Bill Radcliffe</a> to\nconvert an extracted IPTC Newsphoto caption from a binary blob to\nASCII text, and vice versa. IPTC binary blobs can be extracted from\nimages via the <A\nHREF=http://www.ImageMagick.org/>ImageMagick</a> convert(1)\nutility.\n\n\n</TD>\n</TR>\n\n<TR>\n<TD VALIGN=top>\n<B>contrib/addtiffo</B>\n</TD>\n\n<TD>\n\nA utility (and supporting subroutine) for building\none or more reduce resolution\noverviews to an existing TIFF file.  Supplied by \n<a href=\"http://pobox.com/~warmerdam\">Frank Warmerdam</a>.\n\n</TD>\n</TR>\n\n<TR>\n<TD VALIGN=top>\n<B>contrib/stream</B>\n</TD>\n\n<TD>\n\nA class (TiffStream) for accessing TIFF files through a C++ stream \ninterface.   Supplied by <a href=\"mailto:avi@shutterfly.com\">Avi Bleiweiss</a>.\n\n</TD>\n</TR>\n\n</TABLE>\n\n<P>\nQuestions regarding these packages are usually best directed toward\ntheir authors. \n\n<P>\n<HR>\n\nLast updated: $Date: 2006/01/03 01:42:30 $\n\n</BODY>\n</HTML>\n"
  },
  {
    "path": "src/main/jni/tiff/html/document.html",
    "content": "<HTML>\n<HEAD>\n<TITLE>\nTIFF Documentation\n</TITLE>\n</HEAD>\n<BODY BGCOLOR=white> \n<FONT FACE=\"Arial, Helvetica, Sans\">\n<H1>\n<IMG SRC=images/jim.gif WIDTH=139 HEIGHT=170 ALIGN=left BORDER=1 HSPACE=6>\nTIFF Documentation\n</H1>\n\n<P>\nA copy of the 6.0 specification is available from Adobe at\n<A HREF=\"http://partners.adobe.com/public/developer/en/tiff/TIFF6.pdf\">http://partners.adobe.com/public/developer/en/tiff/TIFF6.pdf</A>, or from the libtiff\nftp site at <a href=\"ftp://ftp.remotesensing.org/pub/libtiff/doc/TIFF6.pdf\">\nftp://ftp.remotesensing.org/pub/libtiff/doc/TIFF6.pdf</A>.<p>\n\n<P>\nDraft <a href=\"TIFFTechNote2.html\">TIFF Technical Note #2</A> covers problems \nwith the TIFF 6.0 design for embedding JPEG-compressed data in TIFF, and \ndescribes an alternative. <p>\n\nOther Adobe information on TIFF can be retrieved from:\n\n<A HREF=\"http://partners.adobe.com/public/developer/tiff/index.html\">\nhttp://partners.adobe.com/public/developer/tiff/index.html</A>\n\n<P>\nJoris Van Damme maintains a list of known tags and their descriptions and\ndefinitions. It is available online at\n<A HREF=\"http://www.awaresystems.be/imaging/tiff/tifftags.html\">\nhttp://www.awaresystems.be/imaging/tiff/tifftags.html</A>\n\n<P>\nThere is a FAQ, related both to TIFF format and libtiff library:\n<A HREF=\"http://www.awaresystems.be/imaging/tiff/faq.html\">\nhttp://www.awaresystems.be/imaging/tiff/faq.html</A>\n\n<HR>\n\n<ADDRESS>\n Last updated: $Date: 2009-08-20 22:31:00 $\n</ADDRESS>\n\n</BODY>\n</HTML>\n"
  },
  {
    "path": "src/main/jni/tiff/html/images/Makefile.am",
    "content": "# Tag Image File Format (TIFF) Software\n#\n# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>\n#\n# Permission to use, copy, modify, distribute, and sell this software and \n# its documentation for any purpose is hereby granted without fee, provided\n# that (i) the above copyright notices and this permission notice appear in\n# all copies of the software and related documentation, and (ii) the names of\n# Sam Leffler and Silicon Graphics may not be used in any advertising or\n# publicity relating to the software without the specific, prior written\n# permission of Sam Leffler and Silicon Graphics.\n# \n# THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n# \n# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n# OF THIS SOFTWARE.\n\n# Process this file with automake to produce Makefile.in.\n\ndocdir = $(LIBTIFF_DOCDIR)/html/images\n\ndocfiles = \\\n\tback.gif \\\n\tbali.jpg \\\n\tcat.gif \\\n\tcover.jpg \\\n\tcramps.gif \\\n\tdave.gif \\\n\tinfo.gif \\\n\tjello.jpg \\\n\tjim.gif \\\n\tnote.gif \\\n\toxford.gif \\\n\tquad.jpg \\\n\tring.gif \\\n\tsmallliz.jpg \\\n\tstrike.gif \\\n\twarning.gif\n\ndist_doc_DATA = $(docfiles)\n"
  },
  {
    "path": "src/main/jni/tiff/html/images/Makefile.in",
    "content": "# Makefile.in generated by automake 1.11 from Makefile.am.\n# @configure_input@\n\n# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,\n# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,\n# Inc.\n# This Makefile.in is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY, to the extent permitted by law; without\n# even the implied warranty of MERCHANTABILITY or FITNESS FOR A\n# PARTICULAR PURPOSE.\n\n@SET_MAKE@\n\n# Tag Image File Format (TIFF) Software\n#\n# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>\n#\n# Permission to use, copy, modify, distribute, and sell this software and \n# its documentation for any purpose is hereby granted without fee, provided\n# that (i) the above copyright notices and this permission notice appear in\n# all copies of the software and related documentation, and (ii) the names of\n# Sam Leffler and Silicon Graphics may not be used in any advertising or\n# publicity relating to the software without the specific, prior written\n# permission of Sam Leffler and Silicon Graphics.\n# \n# THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n# \n# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n# OF THIS SOFTWARE.\n\n# Process this file with automake to produce Makefile.in.\n\nVPATH = @srcdir@\npkgdatadir = $(datadir)/@PACKAGE@\npkgincludedir = $(includedir)/@PACKAGE@\npkglibdir = $(libdir)/@PACKAGE@\npkglibexecdir = $(libexecdir)/@PACKAGE@\nam__cd = CDPATH=\"$${ZSH_VERSION+.}$(PATH_SEPARATOR)\" && cd\ninstall_sh_DATA = $(install_sh) -c -m 644\ninstall_sh_PROGRAM = $(install_sh) -c\ninstall_sh_SCRIPT = $(install_sh) -c\nINSTALL_HEADER = $(INSTALL_DATA)\ntransform = $(program_transform_name)\nNORMAL_INSTALL = :\nPRE_INSTALL = :\nPOST_INSTALL = :\nNORMAL_UNINSTALL = :\nPRE_UNINSTALL = :\nPOST_UNINSTALL = :\nbuild_triplet = @build@\nhost_triplet = @host@\ntarget_triplet = @target@\nsubdir = html/images\nDIST_COMMON = $(dist_doc_DATA) $(srcdir)/Makefile.am \\\n\t$(srcdir)/Makefile.in\nACLOCAL_M4 = $(top_srcdir)/aclocal.m4\nam__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \\\n\t$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \\\n\t$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \\\n\t$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac\nam__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \\\n\t$(ACLOCAL_M4)\nmkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs\nCONFIG_HEADER = $(top_builddir)/libtiff/tif_config.h \\\n\t$(top_builddir)/libtiff/tiffconf.h\nCONFIG_CLEAN_FILES =\nCONFIG_CLEAN_VPATH_FILES =\nAM_V_GEN = $(am__v_GEN_$(V))\nam__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))\nam__v_GEN_0 = @echo \"  GEN   \" $@;\nAM_V_at = $(am__v_at_$(V))\nam__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))\nam__v_at_0 = @\nSOURCES =\nDIST_SOURCES =\nam__vpath_adj_setup = srcdirstrip=`echo \"$(srcdir)\" | sed 's|.|.|g'`;\nam__vpath_adj = case $$p in \\\n    $(srcdir)/*) f=`echo \"$$p\" | sed \"s|^$$srcdirstrip/||\"`;; \\\n    *) f=$$p;; \\\n  esac;\nam__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;\nam__install_max = 40\nam__nobase_strip_setup = \\\n  srcdirstrip=`echo \"$(srcdir)\" | sed 's/[].[^$$\\\\*|]/\\\\\\\\&/g'`\nam__nobase_strip = \\\n  for p in $$list; do echo \"$$p\"; done | sed -e \"s|$$srcdirstrip/||\"\nam__nobase_list = $(am__nobase_strip_setup); \\\n  for p in $$list; do echo \"$$p $$p\"; done | \\\n  sed \"s| $$srcdirstrip/| |;\"' / .*\\//!s/ .*/ ./; s,\\( .*\\)/[^/]*$$,\\1,' | \\\n  $(AWK) 'BEGIN { files[\".\"] = \"\" } { files[$$2] = files[$$2] \" \" $$1; \\\n    if (++n[$$2] == $(am__install_max)) \\\n      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = \"\" } } \\\n    END { for (dir in files) print dir, files[dir] }'\nam__base_list = \\\n  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\\n/ /g' | \\\n  sed '$$!N;$$!N;$$!N;$$!N;s/\\n/ /g'\nam__installdirs = \"$(DESTDIR)$(docdir)\"\nDATA = $(dist_doc_DATA)\nDISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)\nACLOCAL = @ACLOCAL@\nAMTAR = @AMTAR@\nAM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@\nAR = @AR@\nAS = @AS@\nAUTOCONF = @AUTOCONF@\nAUTOHEADER = @AUTOHEADER@\nAUTOMAKE = @AUTOMAKE@\nAWK = @AWK@\nCC = @CC@\nCCDEPMODE = @CCDEPMODE@\nCFLAGS = @CFLAGS@\nCPP = @CPP@\nCPPFLAGS = @CPPFLAGS@\nCXX = @CXX@\nCXXCPP = @CXXCPP@\nCXXDEPMODE = @CXXDEPMODE@\nCXXFLAGS = @CXXFLAGS@\nCYGPATH_W = @CYGPATH_W@\nDEFS = @DEFS@\nDEPDIR = @DEPDIR@\nDLLTOOL = @DLLTOOL@\nDSYMUTIL = @DSYMUTIL@\nDUMPBIN = @DUMPBIN@\nECHO_C = @ECHO_C@\nECHO_N = @ECHO_N@\nECHO_T = @ECHO_T@\nEGREP = @EGREP@\nEXEEXT = @EXEEXT@\nFGREP = @FGREP@\nGLUT_CFLAGS = @GLUT_CFLAGS@\nGLUT_LIBS = @GLUT_LIBS@\nGLU_CFLAGS = @GLU_CFLAGS@\nGLU_LIBS = @GLU_LIBS@\nGL_CFLAGS = @GL_CFLAGS@\nGL_LIBS = @GL_LIBS@\nGREP = @GREP@\nINSTALL = @INSTALL@\nINSTALL_DATA = @INSTALL_DATA@\nINSTALL_PROGRAM = @INSTALL_PROGRAM@\nINSTALL_SCRIPT = @INSTALL_SCRIPT@\nINSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@\nLD = @LD@\nLDFLAGS = @LDFLAGS@\nLIBDIR = @LIBDIR@\nLIBOBJS = @LIBOBJS@\nLIBS = @LIBS@\nLIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@\nLIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@\nLIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@\nLIBTIFF_MICRO_VERSION = @LIBTIFF_MICRO_VERSION@\nLIBTIFF_MINOR_VERSION = @LIBTIFF_MINOR_VERSION@\nLIBTIFF_RELEASE_DATE = @LIBTIFF_RELEASE_DATE@\nLIBTIFF_VERSION = @LIBTIFF_VERSION@\nLIBTIFF_VERSION_INFO = @LIBTIFF_VERSION_INFO@\nLIBTOOL = @LIBTOOL@\nLIPO = @LIPO@\nLN_S = @LN_S@\nLTLIBOBJS = @LTLIBOBJS@\nMAINT = @MAINT@\nMAKEINFO = @MAKEINFO@\nMKDIR_P = @MKDIR_P@\nNM = @NM@\nNMEDIT = @NMEDIT@\nOBJDUMP = @OBJDUMP@\nOBJEXT = @OBJEXT@\nOTOOL = @OTOOL@\nOTOOL64 = @OTOOL64@\nPACKAGE = @PACKAGE@\nPACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@\nPACKAGE_NAME = @PACKAGE_NAME@\nPACKAGE_STRING = @PACKAGE_STRING@\nPACKAGE_TARNAME = @PACKAGE_TARNAME@\nPACKAGE_URL = @PACKAGE_URL@\nPACKAGE_VERSION = @PACKAGE_VERSION@\nPATH_SEPARATOR = @PATH_SEPARATOR@\nPTHREAD_CC = @PTHREAD_CC@\nPTHREAD_CFLAGS = @PTHREAD_CFLAGS@\nPTHREAD_LIBS = @PTHREAD_LIBS@\nRANLIB = @RANLIB@\nSED = @SED@\nSET_MAKE = @SET_MAKE@\nSHELL = @SHELL@\nSTRIP = @STRIP@\nVERSION = @VERSION@\nXMKMF = @XMKMF@\nX_CFLAGS = @X_CFLAGS@\nX_EXTRA_LIBS = @X_EXTRA_LIBS@\nX_LIBS = @X_LIBS@\nX_PRE_LIBS = @X_PRE_LIBS@\nabs_builddir = @abs_builddir@\nabs_srcdir = @abs_srcdir@\nabs_top_builddir = @abs_top_builddir@\nabs_top_srcdir = @abs_top_srcdir@\nac_ct_CC = @ac_ct_CC@\nac_ct_CXX = @ac_ct_CXX@\nac_ct_DUMPBIN = @ac_ct_DUMPBIN@\nacx_pthread_config = @acx_pthread_config@\nam__include = @am__include@\nam__leading_dot = @am__leading_dot@\nam__quote = @am__quote@\nam__tar = @am__tar@\nam__untar = @am__untar@\nbindir = @bindir@\nbuild = @build@\nbuild_alias = @build_alias@\nbuild_cpu = @build_cpu@\nbuild_os = @build_os@\nbuild_vendor = @build_vendor@\nbuilddir = @builddir@\ndatadir = @datadir@\ndatarootdir = @datarootdir@\ndocdir = $(LIBTIFF_DOCDIR)/html/images\ndvidir = @dvidir@\nexec_prefix = @exec_prefix@\nhost = @host@\nhost_alias = @host_alias@\nhost_cpu = @host_cpu@\nhost_os = @host_os@\nhost_vendor = @host_vendor@\nhtmldir = @htmldir@\nincludedir = @includedir@\ninfodir = @infodir@\ninstall_sh = @install_sh@\nlibdir = @libdir@\nlibexecdir = @libexecdir@\nlocaledir = @localedir@\nlocalstatedir = @localstatedir@\nlt_ECHO = @lt_ECHO@\nmandir = @mandir@\nmkdir_p = @mkdir_p@\noldincludedir = @oldincludedir@\npdfdir = @pdfdir@\nprefix = @prefix@\nprogram_transform_name = @program_transform_name@\npsdir = @psdir@\nsbindir = @sbindir@\nsharedstatedir = @sharedstatedir@\nsrcdir = @srcdir@\nsysconfdir = @sysconfdir@\ntarget = @target@\ntarget_alias = @target_alias@\ntarget_cpu = @target_cpu@\ntarget_os = @target_os@\ntarget_vendor = @target_vendor@\ntop_build_prefix = @top_build_prefix@\ntop_builddir = @top_builddir@\ntop_srcdir = @top_srcdir@\ndocfiles = \\\n\tback.gif \\\n\tbali.jpg \\\n\tcat.gif \\\n\tcover.jpg \\\n\tcramps.gif \\\n\tdave.gif \\\n\tinfo.gif \\\n\tjello.jpg \\\n\tjim.gif \\\n\tnote.gif \\\n\toxford.gif \\\n\tquad.jpg \\\n\tring.gif \\\n\tsmallliz.jpg \\\n\tstrike.gif \\\n\twarning.gif\n\ndist_doc_DATA = $(docfiles)\nall: all-am\n\n.SUFFIXES:\n$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)\n\t@for dep in $?; do \\\n\t  case '$(am__configure_deps)' in \\\n\t    *$$dep*) \\\n\t      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \\\n\t        && { if test -f $@; then exit 0; else break; fi; }; \\\n\t      exit 1;; \\\n\t  esac; \\\n\tdone; \\\n\techo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign html/images/Makefile'; \\\n\t$(am__cd) $(top_srcdir) && \\\n\t  $(AUTOMAKE) --foreign html/images/Makefile\n.PRECIOUS: Makefile\nMakefile: $(srcdir)/Makefile.in $(top_builddir)/config.status\n\t@case '$?' in \\\n\t  *config.status*) \\\n\t    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \\\n\t  *) \\\n\t    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \\\n\t    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \\\n\tesac;\n\n$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n\n$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n$(am__aclocal_m4_deps):\n\nmostlyclean-libtool:\n\t-rm -f *.lo\n\nclean-libtool:\n\t-rm -rf .libs _libs\ninstall-dist_docDATA: $(dist_doc_DATA)\n\t@$(NORMAL_INSTALL)\n\ttest -z \"$(docdir)\" || $(MKDIR_P) \"$(DESTDIR)$(docdir)\"\n\t@list='$(dist_doc_DATA)'; test -n \"$(docdir)\" || list=; \\\n\tfor p in $$list; do \\\n\t  if test -f \"$$p\"; then d=; else d=\"$(srcdir)/\"; fi; \\\n\t  echo \"$$d$$p\"; \\\n\tdone | $(am__base_list) | \\\n\twhile read files; do \\\n\t  echo \" $(INSTALL_DATA) $$files '$(DESTDIR)$(docdir)'\"; \\\n\t  $(INSTALL_DATA) $$files \"$(DESTDIR)$(docdir)\" || exit $$?; \\\n\tdone\n\nuninstall-dist_docDATA:\n\t@$(NORMAL_UNINSTALL)\n\t@list='$(dist_doc_DATA)'; test -n \"$(docdir)\" || list=; \\\n\tfiles=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \\\n\ttest -n \"$$files\" || exit 0; \\\n\techo \" ( cd '$(DESTDIR)$(docdir)' && rm -f\" $$files \")\"; \\\n\tcd \"$(DESTDIR)$(docdir)\" && rm -f $$files\ntags: TAGS\nTAGS:\n\nctags: CTAGS\nCTAGS:\n\n\ndistdir: $(DISTFILES)\n\t@srcdirstrip=`echo \"$(srcdir)\" | sed 's/[].[^$$\\\\*]/\\\\\\\\&/g'`; \\\n\ttopsrcdirstrip=`echo \"$(top_srcdir)\" | sed 's/[].[^$$\\\\*]/\\\\\\\\&/g'`; \\\n\tlist='$(DISTFILES)'; \\\n\t  dist_files=`for file in $$list; do echo $$file; done | \\\n\t  sed -e \"s|^$$srcdirstrip/||;t\" \\\n\t      -e \"s|^$$topsrcdirstrip/|$(top_builddir)/|;t\"`; \\\n\tcase $$dist_files in \\\n\t  */*) $(MKDIR_P) `echo \"$$dist_files\" | \\\n\t\t\t   sed '/\\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \\\n\t\t\t   sort -u` ;; \\\n\tesac; \\\n\tfor file in $$dist_files; do \\\n\t  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \\\n\t  if test -d $$d/$$file; then \\\n\t    dir=`echo \"/$$file\" | sed -e 's,/[^/]*$$,,'`; \\\n\t    if test -d \"$(distdir)/$$file\"; then \\\n\t      find \"$(distdir)/$$file\" -type d ! -perm -700 -exec chmod u+rwx {} \\;; \\\n\t    fi; \\\n\t    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \\\n\t      cp -fpR $(srcdir)/$$file \"$(distdir)$$dir\" || exit 1; \\\n\t      find \"$(distdir)/$$file\" -type d ! -perm -700 -exec chmod u+rwx {} \\;; \\\n\t    fi; \\\n\t    cp -fpR $$d/$$file \"$(distdir)$$dir\" || exit 1; \\\n\t  else \\\n\t    test -f \"$(distdir)/$$file\" \\\n\t    || cp -p $$d/$$file \"$(distdir)/$$file\" \\\n\t    || exit 1; \\\n\t  fi; \\\n\tdone\ncheck-am: all-am\ncheck: check-am\nall-am: Makefile $(DATA)\ninstalldirs:\n\tfor dir in \"$(DESTDIR)$(docdir)\"; do \\\n\t  test -z \"$$dir\" || $(MKDIR_P) \"$$dir\"; \\\n\tdone\ninstall: install-am\ninstall-exec: install-exec-am\ninstall-data: install-data-am\nuninstall: uninstall-am\n\ninstall-am: all-am\n\t@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am\n\ninstallcheck: installcheck-am\ninstall-strip:\n\t$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM=\"$(INSTALL_STRIP_PROGRAM)\" \\\n\t  install_sh_PROGRAM=\"$(INSTALL_STRIP_PROGRAM)\" INSTALL_STRIP_FLAG=-s \\\n\t  `test -z '$(STRIP)' || \\\n\t    echo \"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'\"` install\nmostlyclean-generic:\n\nclean-generic:\n\ndistclean-generic:\n\t-test -z \"$(CONFIG_CLEAN_FILES)\" || rm -f $(CONFIG_CLEAN_FILES)\n\t-test . = \"$(srcdir)\" || test -z \"$(CONFIG_CLEAN_VPATH_FILES)\" || rm -f $(CONFIG_CLEAN_VPATH_FILES)\n\nmaintainer-clean-generic:\n\t@echo \"This command is intended for maintainers to use\"\n\t@echo \"it deletes files that may require special tools to rebuild.\"\nclean: clean-am\n\nclean-am: clean-generic clean-libtool mostlyclean-am\n\ndistclean: distclean-am\n\t-rm -f Makefile\ndistclean-am: clean-am distclean-generic\n\ndvi: dvi-am\n\ndvi-am:\n\nhtml: html-am\n\nhtml-am:\n\ninfo: info-am\n\ninfo-am:\n\ninstall-data-am: install-dist_docDATA\n\ninstall-dvi: install-dvi-am\n\ninstall-dvi-am:\n\ninstall-exec-am:\n\ninstall-html: install-html-am\n\ninstall-html-am:\n\ninstall-info: install-info-am\n\ninstall-info-am:\n\ninstall-man:\n\ninstall-pdf: install-pdf-am\n\ninstall-pdf-am:\n\ninstall-ps: install-ps-am\n\ninstall-ps-am:\n\ninstallcheck-am:\n\nmaintainer-clean: maintainer-clean-am\n\t-rm -f Makefile\nmaintainer-clean-am: distclean-am maintainer-clean-generic\n\nmostlyclean: mostlyclean-am\n\nmostlyclean-am: mostlyclean-generic mostlyclean-libtool\n\npdf: pdf-am\n\npdf-am:\n\nps: ps-am\n\nps-am:\n\nuninstall-am: uninstall-dist_docDATA\n\n.MAKE: install-am install-strip\n\n.PHONY: all all-am check check-am clean clean-generic clean-libtool \\\n\tdistclean distclean-generic distclean-libtool distdir dvi \\\n\tdvi-am html html-am info info-am install install-am \\\n\tinstall-data install-data-am install-dist_docDATA install-dvi \\\n\tinstall-dvi-am install-exec install-exec-am install-html \\\n\tinstall-html-am install-info install-info-am install-man \\\n\tinstall-pdf install-pdf-am install-ps install-ps-am \\\n\tinstall-strip installcheck installcheck-am installdirs \\\n\tmaintainer-clean maintainer-clean-generic mostlyclean \\\n\tmostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \\\n\tuninstall uninstall-am uninstall-dist_docDATA\n\n\n# Tell versions [3.59,3.63) of GNU make to not export all variables.\n# Otherwise a system limit (for SysV at least) may be exceeded.\n.NOEXPORT:\n"
  },
  {
    "path": "src/main/jni/tiff/html/images.html",
    "content": "<HTML>\n<HEAD>\n<TITLE>\nTIFF Test Images\n</TITLE>\n</HEAD>\n<BODY BGCOLOR=white> \n<FONT FACE=\"Arial, Helvetica, Sans\">\n<H1>\n<IMG SRC=images/bali.jpg WIDTH=158 HEIGHT=107 ALIGN=left BORDER=1 HSPACE=6>\nTIFF Test Images\n</H1>\n\n<P>\nTest images are available for most formats supported by the library.\nMost of the images included in the test kit are also part of this\ndocumentation (albeit in TIFF rather than GIF or JFIF).\nThe images are kept in a separate archive that should be located in\nthe same directory as this software.\n\n<BR CLEAR=left>\n\n<P>\nThe latest archive of test images is located at\n<A HREF=\"ftp://ftp.remotesensing.org/pub/libtiff/pics-3.8.0.tar.gz\">\nftp://ftp.remotesensing.org/pub/libtiff/pics-3.8.0.tar.gz</A>\n\n<P>\nThere are two other good sources for TIFF test images:\nthe contributed software <B>contrib/dbs</B> includes several\nprograms that generate test images suitable for debugging, and\nthe <TT>tiffcp</TT> program can be used to generate a variety\nof images with different storage characteristics.\n\n<P>\n<HR>\n\nLast updated: $Date: 2006/01/02 23:50:44 $\n\n</BODY>\n</HTML>\n"
  },
  {
    "path": "src/main/jni/tiff/html/index.html",
    "content": "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n<html lang=\"en\">\n<head>\n  <title>LibTIFF - TIFF Library and Utilities</title>\n  <meta http-equiv=\"content-type\" content=\"text/html; charset=ISO-8859-1\">\n  <meta http-equiv=\"content-language\" content=\"en\">\n  <style type=\"text/css\">\n  <!--\n    th {text-align: left; vertical-align: top; padding-right: 1em; white-space: nowrap}\n  -->\n  </style>\n</head>\n<body lang=\"en\" text=\"#000000\" bgcolor=\"#ffffff\" link=\"#0000ff\" alink=\"#0000ff\" vlink=\"#0000ff\">\n  <h1>LibTIFF - TIFF Library and Utilities</h1>\n  <hr>\n  <table cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n    <tr>\n      <th>Home Page</th>\n      <td><a href=\"http://www.remotesensing.org/libtiff/\" title=\"Home of the LibTIFF software\">http://www.remotesensing.org/libtiff/</a></td>\n    </tr>\n    <tr>\n      <th>Home Page Mirror</th>\n      <td><a href=\"http://libtiff.maptools.org/\" title=\"Mirror of the LibTIFF software\">http://libtiff.maptools.org/</a></td>\n    </tr>\n    <tr>\n      <th>Latest Stable Release</th>\n      <td><a href=\"v3.9.2.html\">v3.9.2</a></td>\n    </tr>\n    <tr>\n      <th>Master Download Site</th>\n      <td><a href=\"ftp://ftp.remotesensing.org/pub/libtiff\">ftp.remotesensing.org</a>, directory pub/libtiff</td>\n    </tr>\n    <tr>\n      <th>Mirror Download Site</th>\n      <td><a href=\"http://libtiff.maptools.org/dl/\">http://libtiff.maptools.org/dl/</a></td>\n    </tr>\n    <tr>\n      <th>Windows Binaries</th>\n      <td><a href=\"http://gnuwin32.sourceforge.net/packages/libtiff.htm\">GnuWin32 Project</a></td>\n    </tr>\n    <tr>\n      <th>Mailing List</th>\n      <td><a href=\"mailto:tiff@lists.maptools.org\">tiff@lists.maptools.org</a>,\n        <a href=\"http://lists.maptools.org/mailman/listinfo/tiff/\">Subscription</a>,\n        <a href=\"http://www.awaresystems.be/imaging/tiff/tml.html\">Archive</a>.\n        Please, read the <a href=\"http://www.awaresystems.be/imaging/tiff/faq.html\">TIFF FAQ</a>\n        before asking questions.</td>\n    </tr>\n    <tr>\n      <th>Anonymous CVS</th>\n      <td><tt>export CVSROOT=:pserver:cvsanon@cvs.maptools.org:/cvs/maptools/cvsroot<br>\n\tcvs login</tt><br>\n\t(use empty password)<br>\n\t<tt>cvs checkout -r branch-3-9 libtiff<br></tt>\n\tto get stable libtiff branch, or<br>\n\t<tt>cvs checkout libtiff</tt><br>\n\tto get bleeding edge development version of libtiff from CVS HEAD.</td>\n    </tr>\n  </table>\n  <hr>\n  <p>\n    This software provides support for the <i>Tag Image File Format</i> (TIFF),\n    a widely used format for storing image data.  The latest version of\n    the TIFF specification is <a href=\"document.html\">available on-line</a>\n    in several different formats.\n  </p>\n  <p>\n    Included in this software distribution is a library, libtiff, for reading\n    and writing TIFF, a small collection of tools for doing simple\n    manipulations of TIFF images, and documentation on the\n    library and tools.  Libtiff is a portable software, it was built and\n    tested on various systems: UNIX flavors (Linux, BSD, Solaris, MacOS X),\n    Windows, OpenVMS.  It should be possible to port libtiff and additional\n    tools on other OSes.\n  </p>\n  <p>\n    The library, along with associated tool programs, should handle most of\n    your needs for reading and writing TIFF images on 32- and 64-bit\n    machines.  This software can also be used on older 16-bit systems\n    though it may require some effort and you may need to leave out some of\n    the compression support.\n  </p>\n  <p>\n    The software was originally authored and maintained by Sam Leffler.\n    While he keeps a fatherly eye on the mailing list, he is no longer\n    responsible for day to day maintenance.\n  </p>\n  <p>\n    Questions should be sent to the TIFF mailing list:\n    <a href=\"mailto:tiff@lists.maptools.org\">tiff@lists.maptools.org</a>, with\n    a subscription interface at\n    <a href=\"http://lists.maptools.org/mailman/listinfo/tiff\">http://lists.maptools.org/mailman/listinfo/tiff</a>.\n  </p>\n  <p>\n    The persons responsible for putting up this site and putting together\n    versions &gt;= 3.5.1 are\n    <a href=\"http://pobox.com/~warmerdam\">Frank Warmerdam</a>,\n    <a href=\"mailto:dron@ak4719.spb.edu\">Andrey Kiselev</a>, Bob Friesenhahn, \nJoris Van Damme and Lee Howard.\n  </p>\n  <p>\n    The following sections are included in this documentation:\n  </p>\n  <ul>\n    <li><a href=\"support.html\">TIFF 6.0 specification coverage</a></li>\n    <li><a href=\"libtiff.html\">Using the TIFF Library</a></li>\n    <li><a href=\"internals.html\">Modifying the TIFF Library</a>\n      and <a href=\"addingtags.html\">Adding New Tags</a></li>\n    <li><a href=\"tools.html\">TIFF tools overview</a></li>\n    <li><a href=\"contrib.html\">Contributed software</a></li>\n    <li><a href=\"document.html\">TIFF documentation</a></li>\n    <li><a href=\"build.html\">Building the software distribution</a></li>\n    <li><a href=\"bugs.html\">Bugs, Bugzilla, and the TIFF mailing list</a></li>\n    <li><a href=\"images.html\">Test images</a></li>\n    <li><a href=\"misc.html\">Acknowledgements and copyright issues</a></li>\n    <li><a href=\"man/index.html\">Man Pages</a></li>\n  </ul>\n  <hr>\n  <p>\n    Last updated  $Date: 2009-08-28 16:24:13 $.\n  </p>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/internals.html",
    "content": "<HTML>\n<HEAD>\n<TITLE>\nModifying The TIFF Library\n</TITLE>\n</HEAD>\n<BODY BGCOLOR=white> \n<FONT FACE=\"Arial, Helvetica, Sans\">\n<H1>\n<IMG SRC=images/dave.gif WIDTH=107 HEIGHT=148 BORDER=2 ALIGN=left HSPACE=6>\nModifying The TIFF Library\n</H1>\n\n\n<P>\nThis chapter provides information about the internal structure of\nthe library, how to control the configuration when building it, and\nhow to add new support to the library.\nThe following sections are found in this chapter:\n\n<UL>\n<LI><A HREF=#Config>Library Configuration</A>\n<LI><A HREF=#Portability>General Portability Comments</A>\n<LI><A HREF=\"#Types\">Types and Portability</A>\n<LI><A HREF=\"addingtags.html\">Adding New Tags</A>\n<LI><A HREF=#AddingCODECS>Adding New Builtin Codecs</A>\n<LI><A HREF=\"addingtags.html#AddingCODECTags\">Adding New Codec-private Tags</A>\n<LI><A HREF=#Other>Other Comments</A>\n</UL>\n\n\n<A NAME=\"Config\"><P><HR WIDTH=65% ALIGN=right><H3>Library Configuration</H3></A>\n\nInformation on compiling the library is given\n<A HREF=build.html>elsewhere in this documentation</A>.\nThis section describes the low-level mechanisms used to control\nthe optional parts of the library that are configured at build\ntime.   Control is based on\na collection of C defines that are specified either on the compiler\ncommand line or in a configuration file such as <TT>port.h</TT>\n(as generated by the <TT>configure</TT> script for UNIX systems)\nor <B>tiffconf.h</B>.\n\n<P>\nConfiguration defines are split into three areas:\n<UL>\n<LI>those that control which compression schemes are\n    configured as part of the builtin codecs,\n<LI>those that control support for groups of tags that\n    are considered optional, and\n<LI>those that control operating system or machine-specific support.\n</UL>\n\n<P>\nIf the define <TT>COMPRESSION_SUPPORT</TT> is <STRONG>not defined</STRONG>\nthen a default set of compression schemes is automatically\nconfigured:\n<UL>\n<LI>CCITT Group 3 and 4 algorithms (compression codes 2, 3, 4, and 32771),\n<LI>the Macintosh PackBits algorithm (compression 32773),\n<LI>a 4-bit run-length encoding scheme from ThunderScan (compression 32809),\n<LI>a 2-bit encoding scheme used by NeXT (compression 32766), and\n<LI>two experimental schemes intended for images with high dynamic range\n(compression 34676 and 34677).\n</UL>\n\n<P>\n\nTo override the default compression behaviour define\n<TT>COMPRESSION_SUPPORT</TT> and then one or more additional defines\nto enable configuration of the appropriate codecs (see the table\nbelow); e.g.\n\n<UL><PRE>\n#define\tCOMPRESSION_SUPPORT\n#define\tCCITT_SUPPORT\n#define\tPACKBITS_SUPPORT\n</PRE></UL>\n\nSeveral other compression schemes are configured separately from\nthe default set because they depend on ancillary software\npackages that are not distributed with <TT>libtiff</TT>.\n\n<P>\nSupport for JPEG compression is controlled by <TT>JPEG_SUPPORT</TT>.\nThe JPEG codec that comes with <TT>libtiff</TT> is designed for\nuse with release 5 or later of the Independent JPEG Group's freely\navailable software distribution.\nThis software can be retrieved from the directory\n<A HREF=ftp://ftp.uu.net/graphics/jpeg>ftp.uu.net:/graphics/jpeg/</A>.\n\n\n<P>\n<IMG SRC=\"images/info.gif\" ALT=\"NOTE: \" ALIGN=left HSPACE=8>\n<EM>Enabling JPEG support automatically enables support for\nthe TIFF 6.0 colorimetry and YCbCr-related tags.</EM>\n\n<P>\nExperimental support for the deflate algorithm is controlled by\n<TT>DEFLATE_SUPPORT</TT>.\nThe deflate codec that comes with <TT>libtiff</TT> is designed\nfor use with version 0.99 or later of the freely available\n<TT>libz</TT> library written by Jean-loup Gailly and Mark Adler.\nThe data format used by this library is described\nin the files\n<A HREF=ftp://ftp.uu.net/pub/archiving/zip/doc/zlib-3.1.doc>zlib-3.1.doc</A>,\nand\n<A HREF=ftp://ftp.uu.net/pub/archiving/zip/doc/deflate-1.1.doc>deflate-1.1.doc</A>,\navailable in the directory\n<A HREF=ftp://ftp.uu.net/pub/archiving/zip/doc>ftp.uu.net:/pub/archiving/zip/doc</A>.</EM>\nThe library can be retried from the directory\n<A HREF=ftp://ftp.uu.net/pub/archiving/zip/zlib/>ftp.uu.net:/pub/archiving/zip/zlib/</A>\n(or try <A HREF=ftp://quest.jpl.nasa.gov/beta/zlib/>quest.jpl.nasa.gov:/beta/zlib/</A>).\n\n<P>\n<IMG SRC=\"images/warning.gif\" ALT=\"NOTE: \" ALIGN=left HSPACE=8 VSPACE=6>\n<EM>The deflate algorithm is experimental.  Do not expect\nto exchange files using this compression scheme;\nit is included only because the similar, and more common,\nLZW algorithm is claimed to be governed by licensing restrictions.</EM>\n\n\n<P>\nBy default <B>tiffconf.h</B> defines\n<TT>COLORIMETRY_SUPPORT</TT>, \n<TT>YCBCR_SUPPORT</TT>,\nand \n<TT>CMYK_SUPPORT</TT>.\n\n<P>\n<TABLE BORDER CELLPADDING=3>\n\n<TR><TH ALIGN=left>Define</TH><TH ALIGN=left>Description</TH></TR>\n\n<TR>\n<TD VALIGN=top><TT>CCITT_SUPPORT</TT></TD>\n<TD>CCITT Group 3 and 4 algorithms (compression codes 2, 3, 4,\n    and 32771)</TD>\n</TR>\n\n<TR>\n<TD VALIGN=top><TT>PACKBITS_SUPPORT</TT></TD>\n<TD>Macintosh PackBits algorithm (compression 32773)</TD>\n</TR>\n\n<TR>\n<TD VALIGN=top><TT>LZW_SUPPORT</TT></TD>\n<TD>Lempel-Ziv & Welch (LZW) algorithm (compression 5)</TD>\n</TR>\n\n<TR>\n<TD VALIGN=top><TT>THUNDER_SUPPORT</TT></TD>\n<TD>4-bit\nrun-length encoding scheme from ThunderScan (compression 32809)</TD>\n</TR>\n\n<TR>\n<TD VALIGN=top><TT>NEXT_SUPPORT</TT></TD>\n<TD>2-bit encoding scheme used by NeXT (compression 32766)</TD>\n</TR>\n\n<TR>\n<TD VALIGN=top><TT>OJPEG_SUPPORT</TT></TD>\n<TD>obsolete JPEG scheme defined in the 6.0 spec (compression 6)</TD>\n</TR>\n\n<TR>\n<TD VALIGN=top><TT>JPEG_SUPPORT</TT></TD>\n<TD>current JPEG scheme defined in TTN2 (compression 7)</TD>\n</TR>\n\n<TR>\n<TD VALIGN=top><TT>ZIP_SUPPORT</TT></TD>\n<TD>experimental Deflate scheme (compression 32946)</TD>\n</TR>\n\n<TR>\n<TD VALIGN=top><TT>PIXARLOG_SUPPORT</TT></TD>\n<TD>Pixar's compression scheme for high-resolution color images (compression 32909)</TD>\n</TR>\n\n<TR>\n<TD VALIGN=top><TT>SGILOG_SUPPORT</TT></TD>\n<TD>SGI's compression scheme for high-resolution color images (compression 34676 and 34677)</TD>\n</TR>\n\n<TR>\n<TD VALIGN=top><TT>COLORIMETRY_SUPPORT</TT></TD>\n<TD>support for the TIFF 6.0 colorimetry tags</TD>\n</TR>\n\n<TR>\n<TD VALIGN=top><TT>YCBCR_SUPPORT</TT></TD>\n<TD>support for the TIFF 6.0 YCbCr-related tags</TD>\n</TR>\n\n<TR>\n<TD VALIGN=top><TT>CMYK_SUPPORT</TT></TD>\n<TD>support for the TIFF 6.0 CMYK-related tags</TD>\n</TR>\n\n<TR>\n<TD VALIGN=top><TT>ICC_SUPPORT</TT></TD>\n<TD>support for the ICC Profile tag; see\n<I>The ICC Profile Format Specification</I>,\nAnnex B.3 \"Embedding ICC Profiles in TIFF Files\";\navailable at\n<A HREF=http://www.color.org>http://www.color.org</A>\n</TD>\n</TR>\n\n</TABLE>\n\n\n<A NAME=\"Portability\"><P><HR WIDTH=65% ALIGN=right><H3>General Portability Comments</H3></A>\n\nThis software is developed on Silicon Graphics UNIX\nsystems (big-endian, MIPS CPU, 32-bit ints,\nIEEE floating point). \nThe <TT>configure</TT> shell script generates the appropriate\ninclude files and make files for UNIX systems.\nMakefiles exist for non-UNIX platforms that the\ncode runs on -- this work has mostly been done by other people.\n\n<P>\nIn general, the code is guaranteed to work only on SGI machines.\nIn practice it is highly portable to any 32-bit or 64-bit system and much\nwork has been done to insure portability to 16-bit systems.\nIf you encounter portability problems please return fixes so\nthat future distributions can be improved.\n\n<P>\nThe software is written to assume an ANSI C compilation environment.\nIf your compiler does not support ANSI function prototypes, <TT>const</TT>,\nand <TT>&lt;stdarg.h&gt;</TT> then you will have to make modifications to the\nsoftware.  In the past I have tried to support compilers without <TT>const</TT>\nand systems without <TT>&lt;stdarg.h&gt;</TT>, but I am\n<EM>no longer interested in these\nantiquated environments</EM>.  With the general availability of\nthe freely available GCC compiler, I\nsee no reason to incorporate modifications to the software for these\npurposes.\n\n<P>\nAn effort has been made to isolate as many of the\noperating system-dependencies\nas possible in two files: <B>tiffcomp.h</B> and\n<B>libtiff/tif_&lt;os&gt;.c</B>.  The latter file contains\noperating system-specific routines to do I/O and I/O-related operations.\nThe UNIX (<B>tif_unix.c</B>),\nMacintosh (<B>tif_apple.c</B>),\nand VMS (<B>tif_vms.c</B>)\ncode has had the most use;\nthe MS/DOS support (<B>tif_msdos.c</B>) assumes\nsome level of UNIX system call emulation (i.e.\n<TT>open</TT>,\n<TT>read</TT>,\n<TT>write</TT>,\n<TT>fstat</TT>,\n<TT>malloc</TT>,\n<TT>free</TT>).\n\n<P>\nNative CPU byte order is determined on the fly by\nthe library and does not need to be specified.\nThe <TT>HOST_FILLORDER</TT> and <TT>HOST_BIGENDIAN</TT>\ndefinitions are not currently used, but may be employed by\ncodecs for optimization purposes.\n\n<P>\nThe following defines control general portability:\n\n<P>\n<TABLE BORDER CELLPADDING=3 WIDTH=100%>\n\n<TR>\n<TD VALIGN=top><TT>BSDTYPES</TT></TD>\n<TD>Define this if your system does NOT define the\n\t\tusual BSD typedefs: <TT>u_char</TT>,\n\t\t<TT>u_short</TT>, <TT>u_int</TT>, <TT>u_long</TT>.</TD>\n</TR>\n\n<TR>\n<TD VALIGN=top><TT>HAVE_IEEEFP</TT></TD>\n<TD>Define this as 0 or 1 according to the floating point\n\t\tformat suported by the machine.  If your machine does\n\t\tnot support IEEE floating point then you will need to\n\t\tadd support to tif_machdep.c to convert between the\n\t\tnative format and IEEE format.</TD>\n</TR>\n\n<TR>\n<TD VALIGN=top><TT>HAVE_MMAP</TT></TD>\n<TD>Define this if there is <I>mmap-style</I> support for\nmapping files into memory (used only to read data).</TD>\n</TR>\n\n<TR>\n<TD VALIGN=top><TT>HOST_FILLORDER</TT></TD>\n<TD>Define the native CPU bit order: one of <TT>FILLORDER_MSB2LSB</TT>\n or <TT>FILLORDER_LSB2MSB</TT></TD>\n</TR>\n\n<TR>\n<TD VALIGN=top><TT>HOST_BIGENDIAN</TT></TD>\n<TD>Define the native CPU byte order: 1 if big-endian (Motorola)\n or 0 if little-endian (Intel); this may be used\n in codecs to optimize code</TD>\n</TR>\n</TABLE>\n\n<P>\nOn UNIX systems <TT>HAVE_MMAP</TT> is defined through the running of\nthe <TT>configure</TT> script; otherwise support for memory-mapped\nfiles is disabled.\nNote that <B>tiffcomp.h</B> defines <TT>HAVE_IEEEFP</TT> to be\n1 (<TT>BSDTYPES</TT> is not defined).\n\n\n<A NAME=\"Types\"><P><HR WIDTH=65% ALIGN=right><H3>Types and Portability</H3></A>\n\nThe software makes extensive use of C typedefs to promote portability.\nTwo sets of typedefs are used, one for communication with clients\nof the library and one for internal data structures and parsing of the\nTIFF format.  There are interactions between these two to be careful\nof, but for the most part you should be able to deal with portability\npurely by fiddling with the following machine-dependent typedefs:\n\n\n<P>\n<TABLE BORDER CELLPADDING=3 WIDTH=100%>\n\n<TR>\n<TD>uint8</TD>\n<TD>8-bit unsigned integer</TD>\n<TD>tiff.h</TD>\n</TR>\n\n<TR>\n<TD>int8</TD>\n<TD>8-bit signed integer</TD>\n<TD>tiff.h</TD>\n</TR>\n\n<TR>\n<TD>uint16</TD>\n<TD>16-bit unsigned integer</TD>\n<TD>tiff.h</TD>\n</TR>\n\n<TR>\n<TD>int16</TD>\n<TD>16-bit signed integer</TD>\n<TD>tiff.h</TD>\n</TR>\n\n<TR>\n<TD>uint32</TD>\n<TD>32-bit unsigned integer</TD>\n<TD>tiff.h</TD>\n</TR>\n\n<TR>\n<TD>int32</TD>\n<TD>32-bit signed integer</TD>\n<TD>tiff.h</TD>\n</TR>\n\n<TR>\n<TD>dblparam_t</TD>\n<TD>promoted type for floats</TD>\n<TD>tiffcomp.h</TD>\n</TR>\n\n</TABLE>\n\n<P>\n(to clarify <TT>dblparam_t</TT>, it is the type that float parameters are\npromoted to when passed by value in a function call.)\n\n<P>\nThe following typedefs are used throughout the library and interfaces\nto refer to certain objects whose size is dependent on the TIFF image\nstructure:\n\n\n<P>\n<TABLE BORDER CELLPADDING=3 WIDTH=100%>\n\n<TR>\n<TD WIDTH=25%>typedef unsigned int ttag_t;</TD>\t<TD>directory tag</TD>\n</TR>\n\n<TR>\n<TD>typedef uint16 tdir_t;</TD>\t\t<TD>directory index</TD>\n</TR>\n\n<TR>\n<TD>typedef uint16 tsample_t;</TD>\t<TD>sample number</TD>\n</TR>\n\n<TR>\n<TD>typedef uint32 tstrip_t;</TD>\t<TD>strip number</TD>\n</TR>\n\n<TR>\n<TD>typedef uint32 ttile_t;</TD>\t\t<TD>tile number</TD>\n</TR>\n\n<TR>\n<TD>typedef int32 tsize_t;</TD>\t\t<TD>i/o size in bytes</TD>\n</TR>\n\n<TR>\n<TD>typedef void* tdata_t;</TD>\t\t<TD>image data ref</TD>\n</TR>\n\n<TR>\n<TD>typedef void* thandle_t;</TD>\t<TD>client data handle</TD>\n</TR>\n\n<TR>\n<TD>typedef int32 toff_t;</TD>\t\t<TD>file offset (should be off_t)</TD>\n</TR>\n\n<TR>\n<TD>typedef unsigned char* tidata_t;</TD> <TD>internal image data</TD>\n</TR>\n\n</TABLE>\n\n<P>\nNote that <TT>tstrip_t</TT>, <TT>ttile_t</TT>, and <TT>tsize_t</TT>\nare constrained to be\nno more than 32-bit quantities by 32-bit fields they are stored\nin in the TIFF image.  Likewise <TT>tsample_t</TT> is limited by the 16-bit\nfield used to store the <TT>SamplesPerPixel</TT> tag.  <TT>tdir_t</TT>\nconstrains\nthe maximum number of IFDs that may appear in an image and may\nbe an arbitrary size (without penalty).  <TT>ttag_t</TT> must be either\n<TT>int</TT>, <TT>unsigned int</TT>, pointer, or <TT>double</TT>\nbecause the library uses a varargs\ninterface and ANSI C restricts the type of the parameter before an\nellipsis to be a promoted type.  <TT>toff_t</TT> is defined as\n<TT>int32</TT> because\nTIFF file offsets are (unsigned) 32-bit quantities.  A signed\nvalue is used because some interfaces return -1 on error (sigh).\nFinally, note that <TT>tidata_t</TT> is used internally to the library to\nmanipulate internal data.  User-specified data references are\npassed as opaque handles and only cast at the lowest layers where\ntheir type is presumed.\n\n\n<P><HR WIDTH=65% ALIGN=right><H3>General Comments</H3></A>\n\nThe library is designed to hide as much of the details of TIFF from\napplications as\npossible.  In particular, TIFF directories are read in their entirety\ninto an internal format.  Only the tags known by the library are\navailable to a user and certain tag data may be maintained that a user\ndoes not care about (e.g. transfer function tables).\n\n<A NAME=AddingCODECS><P><HR WIDTH=65% ALIGN=right><H3>Adding New Builtin Codecs</H3></A>\n\nTo add builtin support for a new compression algorithm, you can either\nuse the \"tag-extension\" trick to override the handling of the\nTIFF Compression tag (see <A HREF=addingtags.html>Adding New Tags</A>), \nor do the following to add support directly to the core library:\n\n<OL>\n<LI>Define the tag value in <B>tiff.h</B>.\n<LI>Edit the file <B>tif_codec.c</B> to add an entry to the\n   _TIFFBuiltinCODECS array (see how other algorithms are handled).\n<LI>Add the appropriate function prototype declaration to\n   <B>tiffiop.h</B> (close to the bottom).\n<LI>Create a file with the compression scheme code, by convention files\n   are named <B>tif_*.c</B> (except perhaps on some systems where the\n   tif_ prefix pushes some filenames over 14 chars.\n<LI>Edit <B>Makefile.in</B> (and any other Makefiles)\n   to include the new source file.\n</OL>\n\n<P>\nA codec, say <TT>foo</TT>, can have many different entry points:\n\n<PRE>\nTIFFInitfoo(tif, scheme)/* initialize scheme and setup entry points in tif */\nfooSetupDecode(tif)\t/* called once per IFD after tags has been frozen */\nfooPreDecode(tif, sample)/* called once per strip/tile, after data is read,\n\t\t\t    but before the first row is decoded */\nfooDecode*(tif, bp, cc, sample)/* decode cc bytes of data into the buffer */\n    fooDecodeRow(...)\t/* called to decode a single scanline */\n    fooDecodeStrip(...)\t/* called to decode an entire strip */\n    fooDecodeTile(...)\t/* called to decode an entire tile */\nfooSetupEncode(tif)\t/* called once per IFD after tags has been frozen */\nfooPreEncode(tif, sample)/* called once per strip/tile, before the first row in\n\t\t\t    a strip/tile is encoded */\nfooEncode*(tif, bp, cc, sample)/* encode cc bytes of user data (bp) */\n    fooEncodeRow(...)\t/* called to decode a single scanline */\n    fooEncodeStrip(...)\t/* called to decode an entire strip */\n    fooEncodeTile(...)\t/* called to decode an entire tile */\nfooPostEncode(tif)\t/* called once per strip/tile, just before data is written */\nfooSeek(tif, row)\t/* seek forwards row scanlines from the beginning\n\t\t\t   of a strip (row will always be &gt;0 and &lt;rows/strip */\nfooCleanup(tif)\t\t/* called when compression scheme is replaced by user */\n</PRE>\n\n<P>\nNote that the encoding and decoding variants are only needed when\na compression algorithm is dependent on the structure of the data.\nFor example, Group 3 2D encoding and decoding maintains a reference\nscanline.  The sample parameter identifies which sample is to be\nencoded or decoded if the image is organized with <TT>PlanarConfig</TT>=2\n(separate planes).  This is important for algorithms such as JPEG.\nIf <TT>PlanarConfig</TT>=1 (interleaved), then sample will always be 0.\n\n<A NAME=Other><P><HR WIDTH=65% ALIGN=right><H3>Other Comments</H3></A>\n\nThe library handles most I/O buffering.  There are two data buffers\nwhen decoding data: a raw data buffer that holds all the data in a\nstrip, and a user-supplied scanline buffer that compression schemes\nplace decoded data into.  When encoding data the data in the\nuser-supplied scanline buffer is encoded into the raw data buffer (from\nwhere it is written).  Decoding routines should never have to explicitly\nread data -- a full strip/tile's worth of raw data is read and scanlines\nnever cross strip boundaries.  Encoding routines must be cognizant of\nthe raw data buffer size and call <TT>TIFFFlushData1()</TT> when necessary.\nNote that any pending data is automatically flushed when a new strip/tile is\nstarted, so there's no need do that in the tif_postencode routine (if\none exists).  Bit order is automatically handled by the library when\na raw strip or tile is filled.  If the decoded samples are interpreted\nby the decoding routine before they are passed back to the user, then\nthe decoding logic must handle byte-swapping by overriding the\n<TT>tif_postdecode</TT>\nroutine (set it to <TT>TIFFNoPostDecode</TT>) and doing the required work\ninternally.  For an example of doing this look at the horizontal\ndifferencing code in the routines in <B>tif_predict.c</B>.\n\n<P>\nThe variables <TT>tif_rawcc</TT>, <TT>tif_rawdata</TT>, and\n<TT>tif_rawcp</TT> in a <TT>TIFF</TT> structure\nare associated with the raw data buffer.  <TT>tif_rawcc</TT> must be non-zero\nfor the library to automatically flush data.  The variable\n<TT>tif_scanlinesize</TT> is the size a user's scanline buffer should be.  The\nvariable <TT>tif_tilesize</TT> is the size of a tile for tiled images.  This\nshould not normally be used by compression routines, except where it\nrelates to the compression algorithm.  That is, the <TT>cc</TT> parameter to the\n<TT>tif_decode*</TT> and <TT>tif_encode*</TT>\nroutines should be used in terminating\ndecompression/compression.  This ensures these routines can be used,\nfor example, to decode/encode entire strips of data.\n\n<P>\nIn general, if you have a new compression algorithm to add, work from\nthe code for an existing routine.  In particular,\n<B>tif_dumpmode.c</B>\nhas the trivial code for the \"nil\" compression scheme,\n<B>tif_packbits.c</B> is a\nsimple byte-oriented scheme that has to watch out for buffer\nboundaries, and <B>tif_lzw.c</B> has the LZW scheme that has the most\ncomplexity -- it tracks the buffer boundary at a bit level.\nOf course, using a private compression scheme (or private tags) limits\nthe portability of your TIFF files.\n\n<P>\n<HR>\n\nLast updated: $Date: 2004/09/10 14:47:31 $\n\n</BODY>\n\n</HTML>\n"
  },
  {
    "path": "src/main/jni/tiff/html/intro.html",
    "content": "<HTML>\n<HEAD>\n<TITLE>\nIntroduction to the TIFF Documentation\n</TITLE>\n</HEAD>\n<BODY BGCOLOR=white> \n<FONT FACE=\"Arial, Helvetica, Sans\">\n<H1>\n<IMG SRC=images/strike.gif WIDTH=128 HEIGHT=100 ALIGN=left HSPACE=6>\nIntroduction to the TIFF Documentation\n</H1>\n\n\n<P>\nThe following definitions are used throughout this documentation.\nThey are consistent with the terminology used in the TIFF 6.0 specification.\n\n<DL>\n<DT><I>Sample</I>\n<DD>The unit of information stored in an image; often called a\n  channel elsewhere.  Sample values are numbers, usually unsigned\n  integers, but possibly in some other format if the SampleFormat\n  tag is specified in a TIFF\n<DT><I>Pixel</I>\n<DD>A collection of one or more samples that go together.\n<DT><I>Row</I>\n<DD>An Nx1 rectangular collection of pixels.\n<DT><I>Tile</I>\n<DD>An NxM rectangular organization of data (or pixels).\n<DT><I>Strip</I>\n<DD>A tile whose width is the full image width.\n<DT><I>Compression</I>\n<DD>A scheme by which pixel or sample data are stored in\n  an encoded form, specifically with the intent of reducing the\n  storage cost.\n<DT><I>Codec</I>\n<DD>Software that implements the decoding and encoding algorithms\n  of a compression scheme.\n</UL>\n\n<P>\nIn order to better understand how TIFF works (and consequently this\nsoftware) it is important to recognize the distinction between the\nphysical organization of image data as it is stored in a TIFF and how\nthe data is interpreted and manipulated as pixels in an image.  TIFF\nsupports a wide variety of storage and data compression schemes that\ncan be used to optimize retrieval time and/or minimize storage space.\nThese on-disk formats are independent of the image characteristics; it\nis the responsibility of the TIFF reader to process the on-disk storage\ninto an in-memory format suitable for an application.  Furthermore, it\nis the responsibility of the application to properly interpret the\nvisual characteristics of the image data.  TIFF defines a framework for\nspecifying the on-disk storage format and image characteristics with\nfew restrictions.  This permits significant complexity that can be\ndaunting.  Good applications that handle TIFF work by handling as wide\na range of storage formats as possible, while constraining the\nacceptable image characteristics to those that make sense for the\napplication.\n\n\n<P>\n<HR>\n\nLast updated: $Date: 1999/08/09 20:21:21 $\n\n</BODY>\n</HTML>\n"
  },
  {
    "path": "src/main/jni/tiff/html/libtiff.html",
    "content": "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n<html lang=\"en\">\n<head>\n  <title>Using The TIFF Library</title>\n  <meta http-equiv=\"content-type\" content=\"text/html; charset=ISO-8859-1\">\n  <meta http-equiv=\"content-language\" content=\"en\">\n  <style type=\"text/css\">\n  <!--\n    th {text-align: left; vertical-align: top; font-style: italic; font-weight: normal}\n  -->\n  </style>\n</head>\n<body lang=\"en\" text=\"#000000\" bgcolor=\"#ffffff\" link=\"#0000ff\" alink=\"#0000ff\" vlink=\"#0000ff\">\n  <table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n    <tr>\n      <td style=\"padding-left: 1em; padding-right: 1em\"><img src=\"images/cat.gif\" width=\"113\" height=\"146\" alt=\"\"></td>\n      <td>\n        <h1>Using The TIFF Library</h1>\n        <p>\n          <tt>libtiff</tt> is a set of C functions (a library) that support\n          the manipulation of TIFF image files.\n          The library requires an ANSI C compilation environment for building\n          and presumes an ANSI C environment for use.\n        </p>\n      </td>\n    </tr>\n  </table>\n  <br>\n  <p>\n    <tt>libtiff</tt>\n    provides interfaces to image data at several layers of abstraction (and cost).\n    At the highest level image data can be read into an 8-bit/sample,\n    ABGR pixel raster format without regard for the underlying data organization,\n    colorspace, or compression scheme.  Below this high-level interface\n    the library provides scanline-, strip-, and tile-oriented interfaces that\n    return data decompressed but otherwise untransformed.  These interfaces\n    require that the application first identify the organization of stored\n    data and select either a strip-based or tile-based API for manipulating\n    data.  At the lowest level the library\n    provides access to the raw uncompressed strips or tiles,\n    returning the data exactly as it appears in the file.\n  </p>\n  <p>\n    The material presented in this chapter is a basic introduction\n    to the capabilities of the library; it is not an attempt to describe\n    everything a developer needs to know about the library or about TIFF.\n    Detailed information on the interfaces to the library are given in\n    the <a href=\"http://www.remotesensing.org/libtiff/man/index.html\">UNIX \n    manual pages</a> that accompany this software.\n  </p>\n  <p>\n    Michael Still has also written a useful introduction to libtiff for the\n    IBM DeveloperWorks site available at\n    <a href=\"http://www.ibm.com/developerworks/linux/library/l-libtiff\">http://www.ibm.com/developerworks/linux/library/l-libtiff</a>.\n  </p>\n  <p>\n    The following sections are found in this chapter:\n  </p>\n  <ul>\n    <li><a href=\"#version\">How to tell which version you have</a></li>\n    <li><a href=\"#typedefs\">Library Datatypes</a></li>\n    <li><a href=\"#mman\">Memory Management</a></li>\n    <li><a href=\"#errors\">Error Handling</a></li>\n    <li><a href=\"#fio\">Basic File Handling</a></li>\n    <li><a href=\"#dirs\">TIFF Directories</a></li>\n    <li><a href=\"#tags\">TIFF Tags</a></li>\n    <li><a href=\"#compression\">TIFF Compression Schemes</a></li>\n    <li><a href=\"#byteorder\">Byte Order</a></li>\n    <li><a href=\"#dataplacement\">Data Placement</a></li>\n    <li><a href=\"#tiffrgbaimage\">TIFFRGBAImage Support</a></li>\n    <li><a href=\"#scanlines\">Scanline-based Image I/O</a></li>\n    <li><a href=\"#strips\">Strip-oriented Image I/O</a></li>\n    <li><a href=\"#tiles\">Tile-oriented Image I/O</a></li>\n    <li><a href=\"#other\">Other Stuff</a></li>\n  </ul>\n  <hr>\n  <h2 id=\"version\">How to tell which version you have</h2>\n  <p>\n    The software version can be found by looking at the file named\n    <tt>VERSION</tt>\n    that is located at the top of the source tree; the precise alpha number\n    is given in the file <tt>dist/tiff.alpha</tt>.\n    If you have need to refer to this\n    specific software, you should identify it as:\n  </p>\n  <p style=\"margin-left: 40px\">\n    <tt>TIFF &lt;<i>version</i>&gt; &lt;<i>alpha</i>&gt;</tt>\n  </p>\n  <p>\n    where <tt>&lt;<i>version</i>&gt;</tt> is whatever you get from\n    <tt>\"cat VERSION\"</tt> and <tt>&lt;<i>alpha</i>&gt;</tt> is\n    what you get from <tt>\"cat dist/tiff.alpha\"</tt>.\n  </p>\n  <p>\n    Within an application that uses <tt>libtiff</tt> the <tt>TIFFGetVersion</tt>\n    routine will return a pointer to a string that contains software version\n    information.\n    The library include file <tt>&lt;tiffio.h&gt;</tt> contains a C pre-processor\n    define <tt>TIFFLIB_VERSION</tt> that can be used to check library\n    version compatiblity at compile time.\n  </p>\n  <hr>\n  <h2 id=\"typedefs\">Library Datatypes</h2>\n  <p>\n    <tt>libtiff</tt> defines a portable programming interface through the\n    use of a set of C type definitions.\n    These definitions, defined in in the files <b>tiff.h</b> and\n    <b>tiffio.h</b>,\n    isolate the <tt>libtiff</tt> API from the characteristics\n    of the underlying machine.\n    To insure portable code and correct operation, applications that use\n    <tt>libtiff</tt> should use the typedefs and follow the function\n    prototypes for the library API.\n  </p>\n  <hr>\n  <h2 id=\"mman\">Memory Management</h2>\n  <p>\n    <tt>libtiff</tt> uses a machine-specific set of routines for managing\n    dynamically allocated memory.\n    <tt>_TIFFmalloc</tt>, <tt>_TIFFrealloc</tt>, and <tt>_TIFFfree</tt>\n    mimic the normal ANSI C routines.\n    Any dynamically allocated memory that is to be passed into the library\n    should be allocated using these interfaces in order to insure pointer\n    compatibility on machines with a segmented architecture.\n    (On 32-bit UNIX systems these routines just call the normal <tt>malloc</tt>,\n    <tt>realloc</tt>, and <tt>free</tt> routines in the C library.)\n  </p>\n  <p>\n    To deal with segmented pointer issues <tt>libtiff</tt> also provides\n    <tt>_TIFFmemcpy</tt>, <tt>_TIFFmemset</tt>, and <tt>_TIFFmemmove</tt>\n    routines that mimic the equivalent ANSI C routines, but that are\n    intended for use with memory allocated through <tt>_TIFFmalloc</tt>\n    and <tt>_TIFFrealloc</tt>.\n  </p>\n  <hr>\n  <h2 id=\"errors\">Error Handling</h2>\n  <p>\n    <tt>libtiff</tt> handles most errors by returning an invalid/erroneous\n    value when returning from a function call.\n    Various diagnostic messages may also be generated by the library.\n    All error messages are directed to a single global error handler\n    routine that can be specified with a call to <tt>TIFFSetErrorHandler</tt>.\n    Likewise warning messages are directed to a single handler routine\n    that can be specified with a call to <tt>TIFFSetWarningHandler</tt>\n  </p>\n  <hr>\n  <h2 id=\"fio\">Basic File Handling</h2>\n  <p>\n    The library is modeled after the normal UNIX stdio library.\n    For example, to read from an existing TIFF image the\n    file must first be opened:\n  </p>\n  <p style=\"margin-left: 40px\">\n    <tt>#include \"tiffio.h\"<br>\n    main()<br>\n    {<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;TIFF* tif = TIFFOpen(\"foo.tif\", \"r\");<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;... do stuff ...<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;TIFFClose(tif);<br>\n    }</tt>\n  </p>\n  <p>\n    The handle returned by <tt>TIFFOpen</tt> is <i>opaque</i>, that is\n    the application is not permitted to know about its contents.\n    All subsequent library calls for this file must pass the handle\n    as an argument.\n  </p>\n  <p>\n    To create or overwrite a TIFF image the file is also opened, but with\n    a <tt>\"w\"</tt> argument:\n  <p>\n  <p style=\"margin-left: 40px\">\n    <tt>#include \"tiffio.h\"<br>\n    main()<br>\n    {<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;TIFF* tif = TIFFOpen(\"foo.tif\", \"w\");<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;... do stuff ...<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;TIFFClose(tif);<br>\n    }</tt>\n  </p>\n  <p>\n    If the file already exists it is first truncated to zero length.\n  </p>\n  <table>\n    <tr>\n      <td valign=top><img src=\"images/warning.gif\" width=\"40\" height=\"40\" alt=\"\"></td>\n      <td><i>Note that unlike the stdio library TIFF image files may not be\n        opened for both reading and writing;\n        there is no support for altering the contents of a TIFF file.</i></td>\n    </tr>\n  </table>\n  <p>\n    <tt>libtiff</tt> buffers much information associated with writing a\n    valid TIFF image.  Consequently, when writing a TIFF image it is necessary\n    to always call <tt>TIFFClose</tt> or <tt>TIFFFlush</tt> to flush any\n    buffered information to a file.  Note that if you call <tt>TIFFClose</tt>\n    you do not need to call <tt>TIFFFlush</tt>.\n  </p>\n  <hr>\n  <h2 id=\"dirs\">TIFF Directories</h2>\n  <p>\n    TIFF supports the storage of multiple images in a single file.\n    Each image has an associated data structure termed a <i>directory</i>\n    that houses all the information about the format and content of the\n    image data.\n    Images in a file are usually related but they do not need to be; it\n    is perfectly alright to store a color image together with a black and\n    white image.\n    Note however that while images may be related their directories are\n    not.\n    That is, each directory stands on its own; their is no need to read\n    an unrelated directory in order to properly interpret the contents\n    of an image.\n  </p>\n  <p>\n    <tt>libtiff</tt> provides several routines for reading and writing\n    directories.  In normal use there is no need to explicitly\n    read or write a directory: the library automatically reads the first\n    directory in a file when opened for reading, and directory information\n    to be written is automatically accumulated and written when writing\n    (assuming <tt>TIFFClose</tt> or <tt>TIFFFlush</tt> are called).\n  </p>\n  <p>\n    For a file open for reading the <tt>TIFFSetDirectory</tt> routine can\n    be used to select an arbitrary directory; directories are referenced by\n    number with the numbering starting at 0.  Otherwise the\n    <tt>TIFFReadDirectory</tt> and <tt>TIFFWriteDirectory</tt> routines can\n    be used for sequential access to directories.\n    For example, to count the number of directories in a file the following\n    code might be used:\n  </p>\n  <p style=\"margin-left: 40px\">\n    <tt>#include \"tiffio.h\"<br>\n    main(int argc, char* argv[])<br>\n    {<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;TIFF* tif = TIFFOpen(argv[1], \"r\");<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;if (tif) {<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;int dircount = 0;<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;do {<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dircount++;<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} while (TIFFReadDirectory(tif));<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;printf(\"%d directories in %s\\n\", dircount, argv[1]);<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TIFFClose(tif);<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;}<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;exit(0);<br>\n    }</tt>\n  </p>\n  <p>\n    Finally, note that there are several routines for querying the\n    directory status of an open file:\n    <tt>TIFFCurrentDirectory</tt> returns the index of the current\n    directory and\n    <tt>TIFFLastDirectory</tt> returns an indication of whether the\n    current directory is the last directory in a file.\n    There is also a routine, <tt>TIFFPrintDirectory</tt>, that can\n    be called to print a formatted description of the contents of\n    the current directory; consult the manual page for complete details.\n  </p>\n  <hr>\n  <h2 id=\"tags\">TIFF Tags</h2>\n  <p>\n    Image-related information such as the image width and height, number\n    of samples, orientation, colorimetric information, etc.\n    are stored in each image\n    directory in <i>fields</i> or <i>tags</i>.\n    Tags are identified by a number that is usually a value registered\n    with the Aldus (now Adobe) Corporation.\n    Beware however that some vendors write\n    TIFF images with tags that are unregistered; in this case interpreting\n    their contents is usually a waste of time.\n  </p>\n  <p>\n    <tt>libtiff</tt> reads the contents of a directory all at once\n    and converts the on-disk information to an appropriate in-memory\n    form.  While the TIFF specification permits an arbitrary set of\n    tags to be defined and used in a file, the library only understands\n    a limited set of tags.\n    Any unknown tags that are encountered in a file are ignored.\n    There is a mechanism to extend the set of tags the library handles\n    without modifying the library itself;\n    this is described <a href=\"addingtags.html\">elsewhere</a>.\n  </p>\n  <p>\n    <tt>libtiff</tt> provides two interfaces for getting and setting tag\n    values: <tt>TIFFGetField</tt> and <tt>TIFFSetField</tt>.\n    These routines use a variable argument list-style interface to pass\n    parameters of different type through a single function interface.\n    The <i>get interface</i> takes one or more pointers to memory locations\n    where the tag values are to be returned and also returns one or\n    zero according to whether the requested tag is defined in the directory.\n    The <i>set interface</i> takes the tag values either by-reference or\n    by-value.\n    The TIFF specification defines\n    <i>default values</i> for some tags.\n    To get the value of a tag, or its default value if it is undefined,\n    the <tt>TIFFGetFieldDefaulted</tt> interface may be used.\n  </p>\n  <p>\n    The manual pages for the tag get and set routines specifiy the exact data types\n    and calling conventions required for each tag supported by the library.\n  </p>\n  <hr>\n  <h2 id=\"compression\">TIFF Compression Schemes</h2>\n  <p>\n    <tt>libtiff</tt> includes support for a wide variety of\n    data compression schemes.\n    In normal operation a compression scheme is automatically used when\n    the TIFF <tt>Compression</tt> tag is set, either by opening a file\n    for reading, or by setting the tag when writing.\n  </p>\n  <p>\n    Compression schemes are implemented by software modules termed <i>codecs</i>\n    that implement decoder and encoder routines that hook into the\n    core library i/o support.\n    Codecs other than those bundled with the library can be registered\n    for use with the <tt>TIFFRegisterCODEC</tt> routine.\n    This interface can also be used to override the core-library\n    implementation for a compression scheme.\n  </p>\n  <hr>\n  <h2 id=\"byteorder\">Byte Order</h2>\n  <p>\n    The TIFF specification says, and has always said, that\n    <em>a correct TIFF\n    reader must handle images in big-endian and little-endian byte order</em>.\n    <tt>libtiff</tt> conforms in this respect.\n    Consequently there is no means to force a specific\n    byte order for the data written to a TIFF image file (data is\n    written in the native order of the host CPU unless appending to\n    an existing file, in which case it is written in the byte order\n    specified in the file).\n  </p>\n  <hr>\n  <h2 id=\"dataplacement\">Data Placement</h2>\n  <p>\n    The TIFF specification requires that all information except an\n    8-byte header can be placed anywhere in a file.\n    In particular, it is perfectly legitimate for directory information\n    to be written after the image data itself.\n    Consequently TIFF is inherently not suitable for passing through a\n    stream-oriented mechanism such as UNIX pipes.\n    Software that require that data be organized in a file in a particular\n    order (e.g. directory information before image data) does not\n    correctly support TIFF.\n    <tt>libtiff</tt> provides no mechanism for controlling the placement\n    of data in a file; image data is typically written before directory\n    information.\n  </p>\n  <hr>\n  <h2 id=\"tiffrgbaimage\">TIFFRGBAImage Support</h2>\n  <p>\n    <tt>libtiff</tt> provides a high-level interface for reading image\n    data from a TIFF file.  This interface handles the details of\n    data organization and format for a wide variety of TIFF files;\n    at least the large majority of those files that one would normally\n    encounter.  Image data is, by default, returned as ABGR\n    pixels packed into 32-bit words (8 bits per sample).  Rectangular\n    rasters can be read or data can be intercepted at an intermediate\n    level and packed into memory in a format more suitable to the\n    application.\n    The library handles all the details of the format of data stored on\n    disk and, in most cases, if any colorspace conversions are required:\n    bilevel to RGB, greyscale to RGB, CMYK to RGB, YCbCr to RGB, 16-bit\n    samples to 8-bit samples, associated/unassociated alpha, etc.\n  </p>\n  <p>\n    There are two ways to read image data using this interface.  If\n    all the data is to be stored in memory and manipulated at once,\n    then the routine <tt>TIFFReadRGBAImage</tt> can be used:\n  </p>\n  <p>\n  <p style=\"margin-left: 40px\">\n    <tt>#include \"tiffio.h\"<br>\n    main(int argc, char* argv[])<br>\n    {<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;TIFF* tif = TIFFOpen(argv[1], \"r\");<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;if (tif) {<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uint32 w, h;<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;size_t npixels;<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uint32* raster;<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &amp;w);<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &amp;h);<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;npixels = w * h;<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;raster = (uint32*) _TIFFmalloc(npixels * sizeof (uint32));<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (raster != NULL) {<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (TIFFReadRGBAImage(tif, w, h, raster, 0)) {<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...process raster data...<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_TIFFfree(raster);<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TIFFClose(tif);<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;}<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;exit(0);<br>\n    }</tt>\n  </p>\n  <p>\n    Note above that <tt>_TIFFmalloc</tt> is used to allocate memory for\n    the raster passed to <tt>TIFFReadRGBAImage</tt>; this is important\n    to insure the ``appropriate type of memory'' is passed on machines\n    with segmented architectures.\n  </p>\n  <p>\n    Alternatively, <tt>TIFFReadRGBAImage</tt> can be replaced with a\n    more low-level interface that permits an application to have more\n    control over this reading procedure.  The equivalent to the above\n    is:\n  </p>\n  <p style=\"margin-left: 40px\">\n    <tt>#include \"tiffio.h\"<br>\n    main(int argc, char* argv[])<br>\n    {<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;TIFF* tif = TIFFOpen(argv[1], \"r\");<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;if (tif) {<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TIFFRGBAImage img;<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;char emsg[1024];<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (TIFFRGBAImageBegin(&amp;img, tif, 0, emsg)) {<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;size_t npixels;<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uint32* raster;<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;npixels = img.width * img.height;<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;raster = (uint32*) _TIFFmalloc(npixels * sizeof (uint32));<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (raster != NULL) {<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (TIFFRGBAImageGet(&amp;img, raster, img.width, img.height)) {<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...process raster data...<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_TIFFfree(raster);<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TIFFRGBAImageEnd(&amp;img);<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} else<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TIFFError(argv[1], emsg);<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TIFFClose(tif);<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;}<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;exit(0);<br>\n    }</tt>\n  </p>\n  <p>\n    However this usage does not take advantage of the more fine-grained\n    control that's possible.  That is, by using this interface it is\n    possible to:\n  </p>\n  <ul>\n    <li>repeatedly fetch (and manipulate) an image without opening\n      and closing the file</li>\n    <li>interpose a method for packing raster pixel data according to\n      application-specific needs (or write the data at all)</li>\n    <li>interpose methods that handle TIFF formats that are not already\n      handled by the core library</li>\n  </ul>\n  <p>\n    The first item means that, for example, image viewers that want to\n    handle multiple files can cache decoding information in order to\n    speedup the work required to display a TIFF image.\n  </p>\n  <p>\n    The second item is the main reason for this interface.  By interposing\n    a \"put method\" (the routine that is called to pack pixel data in\n    the raster) it is possible share the core logic that understands how\n    to deal with TIFF while packing the resultant pixels in a format that\n    is optimized for the application.  This alternate format might be very\n    different than the 8-bit per sample ABGR format the library writes by\n    default.  For example, if the application is going to display the image\n    on an 8-bit colormap display the put routine might take the data and\n    convert it on-the-fly to the best colormap indices for display.\n  </p>\n  <p>\n    The last item permits an application to extend the library\n    without modifying the core code.\n    By overriding the code provided an application might add support\n    for some esoteric flavor of TIFF that it needs, or it might\n    substitute a packing routine that is able to do optimizations\n    using application/environment-specific information.\n  </p>\n  <p>\n    The TIFF image viewer found in <b>tools/sgigt.c</b> is an example\n    of an application that makes use of the <tt>TIFFRGBAImage</tt>\n    support.\n  </p>\n  <hr>\n  <h2 id=\"scanlines\">Scanline-based Image I/O</h2>\n  <p>\n    The simplest interface provided by <tt>libtiff</tt> is a\n    scanline-oriented interface that can be used to read TIFF\n    images that have their image data organized in strips\n    (trying to use this interface to read data written in tiles\n    will produce errors.)\n    A scanline is a one pixel high row of image data whose width\n    is the width of the image.\n    Data is returned packed if the image data is stored with samples\n    packed together, or as arrays of separate samples if the data\n    is stored with samples separated.\n    The major limitation of the scanline-oriented interface, other\n    than the need to first identify an existing file as having a\n    suitable organization, is that random access to individual\n    scanlines can only be provided when data is not stored in a\n    compressed format, or when the number of rows in a strip\n    of image data is set to one (<tt>RowsPerStrip</tt> is one).\n  </p>\n  <p>\n    Two routines are provided for scanline-based i/o:\n    <tt>TIFFReadScanline</tt>\n    and\n    <tt>TIFFWriteScanline</tt>.\n    For example, to read the contents of a file that\n    is assumed to be organized in strips, the following might be used:\n  </p>\n  <p style=\"margin-left: 40px\">\n    <tt>#include \"tiffio.h\"<br>\n    main()<br>\n    {<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;TIFF* tif = TIFFOpen(\"myfile.tif\", \"r\");<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;if (tif) {<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uint32 imagelength;<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tdata_t buf;<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uint32 row;<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &amp;imagelength);<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;buf = _TIFFmalloc(TIFFScanlineSize(tif));<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for (row = 0; row &lt; imagelength; row++)<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tiffreadscanline(tif, buf, row);<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_tifffree(buf);<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tiffclose(tif);<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;}<br>\n    }</tt>\n  </p>\n  <p>\n    <tt>TIFFScanlineSize</tt> returns the number of bytes in\n    a decoded scanline, as returned by <tt>TIFFReadScanline</tt>.\n    Note however that if the file had been create with samples\n    written in separate planes, then the above code would only\n    read data that contained the first sample of each pixel;\n    to handle either case one might use the following instead:\n  </p>\n  <p style=\"margin-left: 40px\">\n    <tt>#include \"tiffio.h\"<br>\n    main()<br>\n    {<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;TIFF* tif = TIFFOpen(\"myfile.tif\", \"r\");<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;if (tif) {<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uint32 imagelength;<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tdata_t buf;<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uint32 row;<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &amp;imagelength);<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TIFFGetField(tif, TIFFTAG_PLANARCONFIG, &amp;config);<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;buf = _TIFFmalloc(TIFFScanlineSize(tif));<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (config == PLANARCONFIG_CONTIG) {<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for (row = 0; row &lt; imagelength; row++)<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tiffreadscanline(tif, buf, row);<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} else if (config == planarconfig_separate) {<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uint16 s, nsamples;<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tiffgetfield(tif, tifftag_samplesperpixel, &amp;nsamples);<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for (s = 0; s &lt; nsamples; s++)<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for (row = 0; row &lt; imagelength; row++)<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tiffreadscanline(tif, buf, row, s);<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_tifffree(buf);<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tiffclose(tif);<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;}<br>\n    }</tt>\n  </p>\n  <p>\n    Beware however that if the following code were used instead to\n    read data in the case <tt>PLANARCONFIG_SEPARATE</tt>,...\n  </p>\n  <p style=\"margin-left: 40px\">\n    <tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for (row = 0; row &lt; imagelength; row++)<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for (s = 0; s &lt; nsamples; s++)<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tiffreadscanline(tif, buf, row, s);</tt>\n  </p>\n  <p>\n    ...then problems would arise if <tt>RowsPerStrip</tt> was not one\n    because the order in which scanlines are requested would require\n    random access to data within strips (something that is not supported\n    by the library when strips are compressed).\n  </p>\n  <hr>\n  <h2 id=\"strips\">Strip-oriented Image I/O</h2>\n  <p>\n    The strip-oriented interfaces provided by the library provide\n    access to entire strips of data.  Unlike the scanline-oriented\n    calls, data can be read or written compressed or uncompressed.\n    Accessing data at a strip (or tile) level is often desirable\n    because there are no complications with regard to random access\n    to data within strips.\n  </p>\n  <p>\n    A simple example of reading an image by strips is:\n  </p>\n  <p style=\"margin-left: 40px\">\n    <tt>#include \"tiffio.h\"<br>\n    main()<br>\n    {<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;TIFF* tif = TIFFOpen(\"myfile.tif\", \"r\");<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;if (tif) {<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tdata_t buf;<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tstrip_t strip;<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;buf = _TIFFmalloc(TIFFStripSize(tif));<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for (strip = 0; strip &lt; tiffnumberofstrips(tif); strip++)<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tiffreadencodedstrip(tif, strip, buf, (tsize_t) -1);<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_tifffree(buf);<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tiffclose(tif);<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;}<br>\n    }</tt>\n  </p>\n  <p>\n    Notice how a strip size of <tt>-1</tt> is used; <tt>TIFFReadEncodedStrip</tt>\n    will calculate the appropriate size in this case.\n  </p>\n  <p>\n    The above code reads strips in the order in which the\n    data is physically stored in the file.  If multiple samples\n    are present and data is stored with <tt>PLANARCONFIG_SEPARATE</tt>\n    then all the strips of data holding the first sample will be\n    read, followed by strips for the second sample, etc.\n  </p>\n  <p>\n    Finally, note that the last strip of data in an image may have fewer\n    rows in it than specified by the <tt>RowsPerStrip</tt> tag.  A\n    reader should not assume that each decoded strip contains a full\n    set of rows in it.\n  </p>\n  <p>\n    The following is an example of how to read raw strips of data from\n    a file:\n  </p>\n  <p style=\"margin-left: 40px\">\n    <tt>#include \"tiffio.h\"<br>\n    main()<br>\n    {<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;TIFF* tif = TIFFOpen(\"myfile.tif\", \"r\");<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;if (tif) {<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tdata_t buf;<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tstrip_t strip;<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uint32* bc;<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uint32 stripsize;<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TIFFGetField(tif, TIFFTAG_STRIPBYTECOUNTS, &amp;bc);<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;stripsize = bc[0];<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;buf = _TIFFmalloc(stripsize);<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for (strip = 0; strip &lt; tiffnumberofstrips(tif); strip++) {<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (bc[strip] &gt; stripsize) {<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;buf = _TIFFrealloc(buf, bc[strip]);<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;stripsize = bc[strip];<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TIFFReadRawStrip(tif, strip, buf, bc[strip]);<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_TIFFfree(buf);<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TIFFClose(tif);<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;}<br>\n    }</tt>\n  </p>\n  <p>\n    As above the strips are read in the order in which they are\n    physically stored in the file; this may be different from the\n    logical ordering expected by an application.\n  </p>\n  <hr>\n  <h2 id=\"tiles\">Tile-oriented Image I/O</h2>\n  <p>\n    Tiles of data may be read and written in a manner similar to strips.\n    With this interface, an image is\n    broken up into a set of rectangular areas that may have dimensions\n    less than the image width and height.  All the tiles\n    in an image have the same size, and the tile width and length must each\n    be a multiple of 16 pixels.  Tiles are ordered left-to-right and\n    top-to-bottom in an image.  As for scanlines, samples can be packed\n    contiguously or separately.  When separated, all the tiles for a sample\n    are colocated in the file.  That is, all the tiles for sample 0 appear\n    before the tiles for sample 1, etc.\n  </p>\n  <p>\n    Tiles and strips may also be extended in a z dimension to form\n    volumes.  Data volumes are organized as \"slices\".  That is, all the\n    data for a slice is colocated.  Volumes whose data is organized in\n    tiles can also have a tile depth so that data can be organized in\n    cubes.\n  </p>\n  <p>\n    There are actually two interfaces for tiles.\n    One interface is similar to scanlines,  to read a tiled image,\n    code of the following sort might be used:\n  </p>\n  <p style=\"margin-left: 40px\">\n    <tt>main()<br>\n    {<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;TIFF* tif = TIFFOpen(\"myfile.tif\", \"r\");<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;if (tif) {<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uint32 imageWidth, imageLength;<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uint32 tileWidth, tileLength;<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uint32 x, y;<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tdata_t buf;<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &amp;imageWidth);<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &amp;imageLength);<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TIFFGetField(tif, TIFFTAG_TILEWIDTH, &amp;tileWidth);<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TIFFGetField(tif, TIFFTAG_TILELENGTH, &amp;tileLength);<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;buf = _TIFFmalloc(TIFFTileSize(tif));<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for (y = 0; y &lt; imagelength; y += tilelength)<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for (x = 0; x &lt; imagewidth; x += tilewidth)<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tiffreadtile(tif, buf, x, y, 0);<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_tifffree(buf);<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tiffclose(tif);<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;}<br>\n    }</tt>\n  </p>\n  <p>\n    (once again, we assume samples are packed contiguously.)\n  </p>\n  <p>\n    Alternatively a direct interface to the low-level data is provided\n    a la strips.  Tiles can be read with\n    <tt>TIFFReadEncodedTile</tt> or <tt>TIFFReadRawTile</tt>,\n    and written with <tt>TIFFWriteEncodedTile</tt> or\n    <tt>TIFFWriteRawTile</tt>. For example, to read all the tiles in an image:\n  </p>\n  <p style=\"margin-left: 40px\">\n    <tt>#include \"tiffio.h\"<br>\n    main()<br>\n    {<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;TIFF* tif = TIFFOpen(\"myfile.tif\", \"r\");<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;if (tif) {<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tdata_t buf;<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ttile_t tile;<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;buf = _TIFFmalloc(TIFFTileSize(tif));<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for (tile = 0; tile &lt; tiffnumberoftiles(tif); tile++)<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tiffreadencodedtile(tif, tile, buf, (tsize_t) -1);<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_tifffree(buf);<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tiffclose(tif);<br>\n    &nbsp;&nbsp;&nbsp;&nbsp;}<br>\n    }</tt>\n  </p>\n  <hr>\n  <h2 id=\"other\">Other Stuff</h2>\n  <p>\n    Some other stuff will almost certainly go here...\n  </p>\n  <hr>\n  <p>\n    Last updated: $Date: 2005/12/28 06:53:18 $\n  </p>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/Makefile.am",
    "content": "# Tag Image File Format (TIFF) Software\n#\n# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>\n#\n# Permission to use, copy, modify, distribute, and sell this software and \n# its documentation for any purpose is hereby granted without fee, provided\n# that (i) the above copyright notices and this permission notice appear in\n# all copies of the software and related documentation, and (ii) the names of\n# Sam Leffler and Silicon Graphics may not be used in any advertising or\n# publicity relating to the software without the specific, prior written\n# permission of Sam Leffler and Silicon Graphics.\n# \n# THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n# \n# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n# OF THIS SOFTWARE.\n\n# Process this file with automake to produce Makefile.in.\n\ndocdir = $(LIBTIFF_DOCDIR)/html/man\nMANSRCDIR = $(top_srcdir)/man\nHTMLMANDIR = $(top_srcdir)/html/man\n\nGROFF = groff -Thtml -mandoc\nECHO = echo\n\nindexfile = index.html\ndocfiles = \\\n\tlibtiff.3tiff.html \\\n\tTIFFbuffer.3tiff.html \\\n\tTIFFClose.3tiff.html \\\n\tTIFFcodec.3tiff.html \\\n\tTIFFcolor.3tiff.html \\\n\tTIFFDataWidth.3tiff.html \\\n\tTIFFError.3tiff.html \\\n\tTIFFFlush.3tiff.html \\\n\tTIFFGetField.3tiff.html \\\n\tTIFFmemory.3tiff.html \\\n\tTIFFOpen.3tiff.html \\\n\tTIFFPrintDirectory.3tiff.html \\\n\tTIFFquery.3tiff.html \\\n\tTIFFReadDirectory.3tiff.html \\\n\tTIFFReadEncodedStrip.3tiff.html \\\n\tTIFFReadEncodedTile.3tiff.html \\\n\tTIFFReadRawStrip.3tiff.html \\\n\tTIFFReadRawTile.3tiff.html \\\n\tTIFFReadRGBAImage.3tiff.html \\\n\tTIFFReadRGBAStrip.3tiff.html \\\n\tTIFFReadRGBATile.3tiff.html \\\n\tTIFFReadScanline.3tiff.html \\\n\tTIFFReadTile.3tiff.html \\\n\tTIFFRGBAImage.3tiff.html \\\n\tTIFFSetDirectory.3tiff.html \\\n\tTIFFSetField.3tiff.html \\\n\tTIFFsize.3tiff.html \\\n\tTIFFstrip.3tiff.html \\\n\tTIFFswab.3tiff.html \\\n\tTIFFtile.3tiff.html \\\n\tTIFFWarning.3tiff.html \\\n\tTIFFWriteDirectory.3tiff.html \\\n\tTIFFWriteEncodedStrip.3tiff.html \\\n\tTIFFWriteEncodedTile.3tiff.html \\\n\tTIFFWriteRawStrip.3tiff.html \\\n\tTIFFWriteRawTile.3tiff.html \\\n\tTIFFWriteScanline.3tiff.html \\\n\tTIFFWriteTile.3tiff.html \\\n\tfax2ps.1.html \\\n\tfax2tiff.1.html \\\n\tgif2tiff.1.html \\\n\tpal2rgb.1.html \\\n\tppm2tiff.1.html \\\n\tras2tiff.1.html \\\n\traw2tiff.1.html \\\n\trgb2ycbcr.1.html \\\n\tsgi2tiff.1.html \\\n\tthumbnail.1.html \\\n\ttiff2bw.1.html \\\n\ttiff2pdf.1.html \\\n\ttiff2ps.1.html \\\n\ttiff2rgba.1.html \\\n\ttiffcmp.1.html \\\n\ttiffcp.1.html \\\n\ttiffcrop.1.html \\\n\ttiffdither.1.html \\\n\ttiffdump.1.html \\\n\ttiffgt.1.html \\\n\ttiffinfo.1.html \\\n\ttiffmedian.1.html \\\n\ttiffset.1.html \\\n\ttiffsplit.1.html \\\n\ttiffsv.1.html\n\ndist_doc_DATA = $(indexfile) $(docfiles)\n\nINDEXSTART = '<HTML><HEAD><TITLE>Libtiff HTML manpage index</TITLE></HEAD><BODY BGCOLOR=white><ul><H2>Man Pages</h2><p>'\nINDEXEND = '</ul></BODY></HTML>'\n\n.PHONY: index\nindex:\n\t${ECHO} ${INDEXSTART} > $(indexfile)\n\tfor i in $(docfiles); do\t\t\t\t\t\\\n\t\t${ECHO} '<li><A HREF='$$i'>'$$i'</a>' >> $(indexfile);  \\\n\tdone\n\t${ECHO} ${INDEXEND} >> $(indexfile)\n\nmanpages = $(docfiles:.html=)\n\n.PHONY: htmldoc\nhtmldoc:\n\tfor i in $(manpages); do\t\t\t\t\t\\\n\t\t${GROFF} $(MANSRCDIR)/$$i > $(HTMLMANDIR)/$$i.html;\t\\\n\tdone\n\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/Makefile.in",
    "content": "# Makefile.in generated by automake 1.11 from Makefile.am.\n# @configure_input@\n\n# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,\n# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,\n# Inc.\n# This Makefile.in is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY, to the extent permitted by law; without\n# even the implied warranty of MERCHANTABILITY or FITNESS FOR A\n# PARTICULAR PURPOSE.\n\n@SET_MAKE@\n\n# Tag Image File Format (TIFF) Software\n#\n# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>\n#\n# Permission to use, copy, modify, distribute, and sell this software and \n# its documentation for any purpose is hereby granted without fee, provided\n# that (i) the above copyright notices and this permission notice appear in\n# all copies of the software and related documentation, and (ii) the names of\n# Sam Leffler and Silicon Graphics may not be used in any advertising or\n# publicity relating to the software without the specific, prior written\n# permission of Sam Leffler and Silicon Graphics.\n# \n# THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n# \n# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n# OF THIS SOFTWARE.\n\n# Process this file with automake to produce Makefile.in.\n\nVPATH = @srcdir@\npkgdatadir = $(datadir)/@PACKAGE@\npkgincludedir = $(includedir)/@PACKAGE@\npkglibdir = $(libdir)/@PACKAGE@\npkglibexecdir = $(libexecdir)/@PACKAGE@\nam__cd = CDPATH=\"$${ZSH_VERSION+.}$(PATH_SEPARATOR)\" && cd\ninstall_sh_DATA = $(install_sh) -c -m 644\ninstall_sh_PROGRAM = $(install_sh) -c\ninstall_sh_SCRIPT = $(install_sh) -c\nINSTALL_HEADER = $(INSTALL_DATA)\ntransform = $(program_transform_name)\nNORMAL_INSTALL = :\nPRE_INSTALL = :\nPOST_INSTALL = :\nNORMAL_UNINSTALL = :\nPRE_UNINSTALL = :\nPOST_UNINSTALL = :\nbuild_triplet = @build@\nhost_triplet = @host@\ntarget_triplet = @target@\nsubdir = html/man\nDIST_COMMON = $(dist_doc_DATA) $(srcdir)/Makefile.am \\\n\t$(srcdir)/Makefile.in\nACLOCAL_M4 = $(top_srcdir)/aclocal.m4\nam__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \\\n\t$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \\\n\t$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \\\n\t$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac\nam__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \\\n\t$(ACLOCAL_M4)\nmkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs\nCONFIG_HEADER = $(top_builddir)/libtiff/tif_config.h \\\n\t$(top_builddir)/libtiff/tiffconf.h\nCONFIG_CLEAN_FILES =\nCONFIG_CLEAN_VPATH_FILES =\nAM_V_GEN = $(am__v_GEN_$(V))\nam__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))\nam__v_GEN_0 = @echo \"  GEN   \" $@;\nAM_V_at = $(am__v_at_$(V))\nam__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))\nam__v_at_0 = @\nSOURCES =\nDIST_SOURCES =\nam__vpath_adj_setup = srcdirstrip=`echo \"$(srcdir)\" | sed 's|.|.|g'`;\nam__vpath_adj = case $$p in \\\n    $(srcdir)/*) f=`echo \"$$p\" | sed \"s|^$$srcdirstrip/||\"`;; \\\n    *) f=$$p;; \\\n  esac;\nam__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;\nam__install_max = 40\nam__nobase_strip_setup = \\\n  srcdirstrip=`echo \"$(srcdir)\" | sed 's/[].[^$$\\\\*|]/\\\\\\\\&/g'`\nam__nobase_strip = \\\n  for p in $$list; do echo \"$$p\"; done | sed -e \"s|$$srcdirstrip/||\"\nam__nobase_list = $(am__nobase_strip_setup); \\\n  for p in $$list; do echo \"$$p $$p\"; done | \\\n  sed \"s| $$srcdirstrip/| |;\"' / .*\\//!s/ .*/ ./; s,\\( .*\\)/[^/]*$$,\\1,' | \\\n  $(AWK) 'BEGIN { files[\".\"] = \"\" } { files[$$2] = files[$$2] \" \" $$1; \\\n    if (++n[$$2] == $(am__install_max)) \\\n      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = \"\" } } \\\n    END { for (dir in files) print dir, files[dir] }'\nam__base_list = \\\n  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\\n/ /g' | \\\n  sed '$$!N;$$!N;$$!N;$$!N;s/\\n/ /g'\nam__installdirs = \"$(DESTDIR)$(docdir)\"\nDATA = $(dist_doc_DATA)\nDISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)\nACLOCAL = @ACLOCAL@\nAMTAR = @AMTAR@\nAM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@\nAR = @AR@\nAS = @AS@\nAUTOCONF = @AUTOCONF@\nAUTOHEADER = @AUTOHEADER@\nAUTOMAKE = @AUTOMAKE@\nAWK = @AWK@\nCC = @CC@\nCCDEPMODE = @CCDEPMODE@\nCFLAGS = @CFLAGS@\nCPP = @CPP@\nCPPFLAGS = @CPPFLAGS@\nCXX = @CXX@\nCXXCPP = @CXXCPP@\nCXXDEPMODE = @CXXDEPMODE@\nCXXFLAGS = @CXXFLAGS@\nCYGPATH_W = @CYGPATH_W@\nDEFS = @DEFS@\nDEPDIR = @DEPDIR@\nDLLTOOL = @DLLTOOL@\nDSYMUTIL = @DSYMUTIL@\nDUMPBIN = @DUMPBIN@\nECHO_C = @ECHO_C@\nECHO_N = @ECHO_N@\nECHO_T = @ECHO_T@\nEGREP = @EGREP@\nEXEEXT = @EXEEXT@\nFGREP = @FGREP@\nGLUT_CFLAGS = @GLUT_CFLAGS@\nGLUT_LIBS = @GLUT_LIBS@\nGLU_CFLAGS = @GLU_CFLAGS@\nGLU_LIBS = @GLU_LIBS@\nGL_CFLAGS = @GL_CFLAGS@\nGL_LIBS = @GL_LIBS@\nGREP = @GREP@\nINSTALL = @INSTALL@\nINSTALL_DATA = @INSTALL_DATA@\nINSTALL_PROGRAM = @INSTALL_PROGRAM@\nINSTALL_SCRIPT = @INSTALL_SCRIPT@\nINSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@\nLD = @LD@\nLDFLAGS = @LDFLAGS@\nLIBDIR = @LIBDIR@\nLIBOBJS = @LIBOBJS@\nLIBS = @LIBS@\nLIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@\nLIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@\nLIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@\nLIBTIFF_MICRO_VERSION = @LIBTIFF_MICRO_VERSION@\nLIBTIFF_MINOR_VERSION = @LIBTIFF_MINOR_VERSION@\nLIBTIFF_RELEASE_DATE = @LIBTIFF_RELEASE_DATE@\nLIBTIFF_VERSION = @LIBTIFF_VERSION@\nLIBTIFF_VERSION_INFO = @LIBTIFF_VERSION_INFO@\nLIBTOOL = @LIBTOOL@\nLIPO = @LIPO@\nLN_S = @LN_S@\nLTLIBOBJS = @LTLIBOBJS@\nMAINT = @MAINT@\nMAKEINFO = @MAKEINFO@\nMKDIR_P = @MKDIR_P@\nNM = @NM@\nNMEDIT = @NMEDIT@\nOBJDUMP = @OBJDUMP@\nOBJEXT = @OBJEXT@\nOTOOL = @OTOOL@\nOTOOL64 = @OTOOL64@\nPACKAGE = @PACKAGE@\nPACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@\nPACKAGE_NAME = @PACKAGE_NAME@\nPACKAGE_STRING = @PACKAGE_STRING@\nPACKAGE_TARNAME = @PACKAGE_TARNAME@\nPACKAGE_URL = @PACKAGE_URL@\nPACKAGE_VERSION = @PACKAGE_VERSION@\nPATH_SEPARATOR = @PATH_SEPARATOR@\nPTHREAD_CC = @PTHREAD_CC@\nPTHREAD_CFLAGS = @PTHREAD_CFLAGS@\nPTHREAD_LIBS = @PTHREAD_LIBS@\nRANLIB = @RANLIB@\nSED = @SED@\nSET_MAKE = @SET_MAKE@\nSHELL = @SHELL@\nSTRIP = @STRIP@\nVERSION = @VERSION@\nXMKMF = @XMKMF@\nX_CFLAGS = @X_CFLAGS@\nX_EXTRA_LIBS = @X_EXTRA_LIBS@\nX_LIBS = @X_LIBS@\nX_PRE_LIBS = @X_PRE_LIBS@\nabs_builddir = @abs_builddir@\nabs_srcdir = @abs_srcdir@\nabs_top_builddir = @abs_top_builddir@\nabs_top_srcdir = @abs_top_srcdir@\nac_ct_CC = @ac_ct_CC@\nac_ct_CXX = @ac_ct_CXX@\nac_ct_DUMPBIN = @ac_ct_DUMPBIN@\nacx_pthread_config = @acx_pthread_config@\nam__include = @am__include@\nam__leading_dot = @am__leading_dot@\nam__quote = @am__quote@\nam__tar = @am__tar@\nam__untar = @am__untar@\nbindir = @bindir@\nbuild = @build@\nbuild_alias = @build_alias@\nbuild_cpu = @build_cpu@\nbuild_os = @build_os@\nbuild_vendor = @build_vendor@\nbuilddir = @builddir@\ndatadir = @datadir@\ndatarootdir = @datarootdir@\ndocdir = $(LIBTIFF_DOCDIR)/html/man\ndvidir = @dvidir@\nexec_prefix = @exec_prefix@\nhost = @host@\nhost_alias = @host_alias@\nhost_cpu = @host_cpu@\nhost_os = @host_os@\nhost_vendor = @host_vendor@\nhtmldir = @htmldir@\nincludedir = @includedir@\ninfodir = @infodir@\ninstall_sh = @install_sh@\nlibdir = @libdir@\nlibexecdir = @libexecdir@\nlocaledir = @localedir@\nlocalstatedir = @localstatedir@\nlt_ECHO = @lt_ECHO@\nmandir = @mandir@\nmkdir_p = @mkdir_p@\noldincludedir = @oldincludedir@\npdfdir = @pdfdir@\nprefix = @prefix@\nprogram_transform_name = @program_transform_name@\npsdir = @psdir@\nsbindir = @sbindir@\nsharedstatedir = @sharedstatedir@\nsrcdir = @srcdir@\nsysconfdir = @sysconfdir@\ntarget = @target@\ntarget_alias = @target_alias@\ntarget_cpu = @target_cpu@\ntarget_os = @target_os@\ntarget_vendor = @target_vendor@\ntop_build_prefix = @top_build_prefix@\ntop_builddir = @top_builddir@\ntop_srcdir = @top_srcdir@\nMANSRCDIR = $(top_srcdir)/man\nHTMLMANDIR = $(top_srcdir)/html/man\nGROFF = groff -Thtml -mandoc\nECHO = echo\nindexfile = index.html\ndocfiles = \\\n\tlibtiff.3tiff.html \\\n\tTIFFbuffer.3tiff.html \\\n\tTIFFClose.3tiff.html \\\n\tTIFFcodec.3tiff.html \\\n\tTIFFcolor.3tiff.html \\\n\tTIFFDataWidth.3tiff.html \\\n\tTIFFError.3tiff.html \\\n\tTIFFFlush.3tiff.html \\\n\tTIFFGetField.3tiff.html \\\n\tTIFFmemory.3tiff.html \\\n\tTIFFOpen.3tiff.html \\\n\tTIFFPrintDirectory.3tiff.html \\\n\tTIFFquery.3tiff.html \\\n\tTIFFReadDirectory.3tiff.html \\\n\tTIFFReadEncodedStrip.3tiff.html \\\n\tTIFFReadEncodedTile.3tiff.html \\\n\tTIFFReadRawStrip.3tiff.html \\\n\tTIFFReadRawTile.3tiff.html \\\n\tTIFFReadRGBAImage.3tiff.html \\\n\tTIFFReadRGBAStrip.3tiff.html \\\n\tTIFFReadRGBATile.3tiff.html \\\n\tTIFFReadScanline.3tiff.html \\\n\tTIFFReadTile.3tiff.html \\\n\tTIFFRGBAImage.3tiff.html \\\n\tTIFFSetDirectory.3tiff.html \\\n\tTIFFSetField.3tiff.html \\\n\tTIFFsize.3tiff.html \\\n\tTIFFstrip.3tiff.html \\\n\tTIFFswab.3tiff.html \\\n\tTIFFtile.3tiff.html \\\n\tTIFFWarning.3tiff.html \\\n\tTIFFWriteDirectory.3tiff.html \\\n\tTIFFWriteEncodedStrip.3tiff.html \\\n\tTIFFWriteEncodedTile.3tiff.html \\\n\tTIFFWriteRawStrip.3tiff.html \\\n\tTIFFWriteRawTile.3tiff.html \\\n\tTIFFWriteScanline.3tiff.html \\\n\tTIFFWriteTile.3tiff.html \\\n\tfax2ps.1.html \\\n\tfax2tiff.1.html \\\n\tgif2tiff.1.html \\\n\tpal2rgb.1.html \\\n\tppm2tiff.1.html \\\n\tras2tiff.1.html \\\n\traw2tiff.1.html \\\n\trgb2ycbcr.1.html \\\n\tsgi2tiff.1.html \\\n\tthumbnail.1.html \\\n\ttiff2bw.1.html \\\n\ttiff2pdf.1.html \\\n\ttiff2ps.1.html \\\n\ttiff2rgba.1.html \\\n\ttiffcmp.1.html \\\n\ttiffcp.1.html \\\n\ttiffcrop.1.html \\\n\ttiffdither.1.html \\\n\ttiffdump.1.html \\\n\ttiffgt.1.html \\\n\ttiffinfo.1.html \\\n\ttiffmedian.1.html \\\n\ttiffset.1.html \\\n\ttiffsplit.1.html \\\n\ttiffsv.1.html\n\ndist_doc_DATA = $(indexfile) $(docfiles)\nINDEXSTART = '<HTML><HEAD><TITLE>Libtiff HTML manpage index</TITLE></HEAD><BODY BGCOLOR=white><ul><H2>Man Pages</h2><p>'\nINDEXEND = '</ul></BODY></HTML>'\nmanpages = $(docfiles:.html=)\nall: all-am\n\n.SUFFIXES:\n$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)\n\t@for dep in $?; do \\\n\t  case '$(am__configure_deps)' in \\\n\t    *$$dep*) \\\n\t      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \\\n\t        && { if test -f $@; then exit 0; else break; fi; }; \\\n\t      exit 1;; \\\n\t  esac; \\\n\tdone; \\\n\techo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign html/man/Makefile'; \\\n\t$(am__cd) $(top_srcdir) && \\\n\t  $(AUTOMAKE) --foreign html/man/Makefile\n.PRECIOUS: Makefile\nMakefile: $(srcdir)/Makefile.in $(top_builddir)/config.status\n\t@case '$?' in \\\n\t  *config.status*) \\\n\t    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \\\n\t  *) \\\n\t    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \\\n\t    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \\\n\tesac;\n\n$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n\n$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n$(am__aclocal_m4_deps):\n\nmostlyclean-libtool:\n\t-rm -f *.lo\n\nclean-libtool:\n\t-rm -rf .libs _libs\ninstall-dist_docDATA: $(dist_doc_DATA)\n\t@$(NORMAL_INSTALL)\n\ttest -z \"$(docdir)\" || $(MKDIR_P) \"$(DESTDIR)$(docdir)\"\n\t@list='$(dist_doc_DATA)'; test -n \"$(docdir)\" || list=; \\\n\tfor p in $$list; do \\\n\t  if test -f \"$$p\"; then d=; else d=\"$(srcdir)/\"; fi; \\\n\t  echo \"$$d$$p\"; \\\n\tdone | $(am__base_list) | \\\n\twhile read files; do \\\n\t  echo \" $(INSTALL_DATA) $$files '$(DESTDIR)$(docdir)'\"; \\\n\t  $(INSTALL_DATA) $$files \"$(DESTDIR)$(docdir)\" || exit $$?; \\\n\tdone\n\nuninstall-dist_docDATA:\n\t@$(NORMAL_UNINSTALL)\n\t@list='$(dist_doc_DATA)'; test -n \"$(docdir)\" || list=; \\\n\tfiles=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \\\n\ttest -n \"$$files\" || exit 0; \\\n\techo \" ( cd '$(DESTDIR)$(docdir)' && rm -f\" $$files \")\"; \\\n\tcd \"$(DESTDIR)$(docdir)\" && rm -f $$files\ntags: TAGS\nTAGS:\n\nctags: CTAGS\nCTAGS:\n\n\ndistdir: $(DISTFILES)\n\t@srcdirstrip=`echo \"$(srcdir)\" | sed 's/[].[^$$\\\\*]/\\\\\\\\&/g'`; \\\n\ttopsrcdirstrip=`echo \"$(top_srcdir)\" | sed 's/[].[^$$\\\\*]/\\\\\\\\&/g'`; \\\n\tlist='$(DISTFILES)'; \\\n\t  dist_files=`for file in $$list; do echo $$file; done | \\\n\t  sed -e \"s|^$$srcdirstrip/||;t\" \\\n\t      -e \"s|^$$topsrcdirstrip/|$(top_builddir)/|;t\"`; \\\n\tcase $$dist_files in \\\n\t  */*) $(MKDIR_P) `echo \"$$dist_files\" | \\\n\t\t\t   sed '/\\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \\\n\t\t\t   sort -u` ;; \\\n\tesac; \\\n\tfor file in $$dist_files; do \\\n\t  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \\\n\t  if test -d $$d/$$file; then \\\n\t    dir=`echo \"/$$file\" | sed -e 's,/[^/]*$$,,'`; \\\n\t    if test -d \"$(distdir)/$$file\"; then \\\n\t      find \"$(distdir)/$$file\" -type d ! -perm -700 -exec chmod u+rwx {} \\;; \\\n\t    fi; \\\n\t    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \\\n\t      cp -fpR $(srcdir)/$$file \"$(distdir)$$dir\" || exit 1; \\\n\t      find \"$(distdir)/$$file\" -type d ! -perm -700 -exec chmod u+rwx {} \\;; \\\n\t    fi; \\\n\t    cp -fpR $$d/$$file \"$(distdir)$$dir\" || exit 1; \\\n\t  else \\\n\t    test -f \"$(distdir)/$$file\" \\\n\t    || cp -p $$d/$$file \"$(distdir)/$$file\" \\\n\t    || exit 1; \\\n\t  fi; \\\n\tdone\ncheck-am: all-am\ncheck: check-am\nall-am: Makefile $(DATA)\ninstalldirs:\n\tfor dir in \"$(DESTDIR)$(docdir)\"; do \\\n\t  test -z \"$$dir\" || $(MKDIR_P) \"$$dir\"; \\\n\tdone\ninstall: install-am\ninstall-exec: install-exec-am\ninstall-data: install-data-am\nuninstall: uninstall-am\n\ninstall-am: all-am\n\t@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am\n\ninstallcheck: installcheck-am\ninstall-strip:\n\t$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM=\"$(INSTALL_STRIP_PROGRAM)\" \\\n\t  install_sh_PROGRAM=\"$(INSTALL_STRIP_PROGRAM)\" INSTALL_STRIP_FLAG=-s \\\n\t  `test -z '$(STRIP)' || \\\n\t    echo \"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'\"` install\nmostlyclean-generic:\n\nclean-generic:\n\ndistclean-generic:\n\t-test -z \"$(CONFIG_CLEAN_FILES)\" || rm -f $(CONFIG_CLEAN_FILES)\n\t-test . = \"$(srcdir)\" || test -z \"$(CONFIG_CLEAN_VPATH_FILES)\" || rm -f $(CONFIG_CLEAN_VPATH_FILES)\n\nmaintainer-clean-generic:\n\t@echo \"This command is intended for maintainers to use\"\n\t@echo \"it deletes files that may require special tools to rebuild.\"\nclean: clean-am\n\nclean-am: clean-generic clean-libtool mostlyclean-am\n\ndistclean: distclean-am\n\t-rm -f Makefile\ndistclean-am: clean-am distclean-generic\n\ndvi: dvi-am\n\ndvi-am:\n\nhtml: html-am\n\nhtml-am:\n\ninfo: info-am\n\ninfo-am:\n\ninstall-data-am: install-dist_docDATA\n\ninstall-dvi: install-dvi-am\n\ninstall-dvi-am:\n\ninstall-exec-am:\n\ninstall-html: install-html-am\n\ninstall-html-am:\n\ninstall-info: install-info-am\n\ninstall-info-am:\n\ninstall-man:\n\ninstall-pdf: install-pdf-am\n\ninstall-pdf-am:\n\ninstall-ps: install-ps-am\n\ninstall-ps-am:\n\ninstallcheck-am:\n\nmaintainer-clean: maintainer-clean-am\n\t-rm -f Makefile\nmaintainer-clean-am: distclean-am maintainer-clean-generic\n\nmostlyclean: mostlyclean-am\n\nmostlyclean-am: mostlyclean-generic mostlyclean-libtool\n\npdf: pdf-am\n\npdf-am:\n\nps: ps-am\n\nps-am:\n\nuninstall-am: uninstall-dist_docDATA\n\n.MAKE: install-am install-strip\n\n.PHONY: all all-am check check-am clean clean-generic clean-libtool \\\n\tdistclean distclean-generic distclean-libtool distdir dvi \\\n\tdvi-am html html-am info info-am install install-am \\\n\tinstall-data install-data-am install-dist_docDATA install-dvi \\\n\tinstall-dvi-am install-exec install-exec-am install-html \\\n\tinstall-html-am install-info install-info-am install-man \\\n\tinstall-pdf install-pdf-am install-ps install-ps-am \\\n\tinstall-strip installcheck installcheck-am installdirs \\\n\tmaintainer-clean maintainer-clean-generic mostlyclean \\\n\tmostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \\\n\tuninstall uninstall-am uninstall-dist_docDATA\n\n\n.PHONY: index\nindex:\n\t${ECHO} ${INDEXSTART} > $(indexfile)\n\tfor i in $(docfiles); do\t\t\t\t\t\\\n\t\t${ECHO} '<li><A HREF='$$i'>'$$i'</a>' >> $(indexfile);  \\\n\tdone\n\t${ECHO} ${INDEXEND} >> $(indexfile)\n\n.PHONY: htmldoc\nhtmldoc:\n\tfor i in $(manpages); do\t\t\t\t\t\\\n\t\t${GROFF} $(MANSRCDIR)/$$i > $(HTMLMANDIR)/$$i.html;\t\\\n\tdone\n\n# Tell versions [3.59,3.63) of GNU make to not export all variables.\n# Otherwise a system limit (for SysV at least) may be exceeded.\n.NOEXPORT:\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/TIFFClose.3tiff.html",
    "content": "<!-- Creator     : groff version 1.18.1 -->\n<!-- CreationDate: Fri Jul 13 17:43:15 2007 -->\n<html>\n<head>\n<meta name=\"generator\" content=\"groff -Thtml, see www.gnu.org\">\n<meta name=\"Content-Style\" content=\"text/css\">\n<title>TIFFClose</title>\n</head>\n<body>\n\n<h1 align=center>TIFFClose</h1>\n<a href=\"#NAME\">NAME</a><br>\n<a href=\"#SYNOPSIS\">SYNOPSIS</a><br>\n<a href=\"#DESCRIPTION\">DESCRIPTION</a><br>\n<a href=\"#DIAGNOSTICS\">DIAGNOSTICS</a><br>\n<a href=\"#SEE ALSO\">SEE ALSO</a><br>\n\n<hr>\n<a name=\"NAME\"></a>\n<h2>NAME</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>TIFFClose &minus; close a previously opened\n<small>TIFF</small> file</p>\n</td>\n</table>\n<a name=\"SYNOPSIS\"></a>\n<h2>SYNOPSIS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>#include &lt;tiffio.h&gt;</b></p>\n<!-- INDENTATION -->\n<p><b>void TIFFClose(TIFF *</b><i>tif</i><b>)</b></p>\n</td>\n</table>\n<a name=\"DESCRIPTION\"></a>\n<h2>DESCRIPTION</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><i>TIFFClose</i> closes a file that was previously opened\nwith <b>TIFFOpen</b>(3TIFF). Any buffered data are flushed\nto the file, including the contents of the current directory\n(if modified); and all resources are reclaimed.</p>\n</td>\n</table>\n<a name=\"DIAGNOSTICS\"></a>\n<h2>DIAGNOSTICS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>All error messages are directed to the routine. Likewise,\nwarning messages are directed to the\n<b>TIFFWarning</b>(3TIFF) routine.</p>\n</td>\n</table>\n<a name=\"SEE ALSO\"></a>\n<h2>SEE ALSO</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>libtiff</b>(3TIFF), <b>TIFFOpen</b>(3TIFF)</p>\n<!-- INDENTATION -->\n<p>Libtiff library home page:\n<b>http://www.remotesensing.org/libtiff/</b></p>\n</td>\n</table>\n<hr>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/TIFFDataWidth.3tiff.html",
    "content": "<!-- Creator     : groff version 1.18.1 -->\n<!-- CreationDate: Fri Jul 13 17:43:15 2007 -->\n<html>\n<head>\n<meta name=\"generator\" content=\"groff -Thtml, see www.gnu.org\">\n<meta name=\"Content-Style\" content=\"text/css\">\n<title>TIFFDataWidth</title>\n</head>\n<body>\n\n<h1 align=center>TIFFDataWidth</h1>\n<a href=\"#NAME\">NAME</a><br>\n<a href=\"#SYNOPSIS\">SYNOPSIS</a><br>\n<a href=\"#DESCRIPTION\">DESCRIPTION</a><br>\n<a href=\"#RETURN VALUES\">RETURN VALUES</a><br>\n<a href=\"#SEE ALSO\">SEE ALSO</a><br>\n\n<hr>\n<a name=\"NAME\"></a>\n<h2>NAME</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>TIFFDataWidth &minus; Get the size of TIFF data types</p>\n</td>\n</table>\n<a name=\"SYNOPSIS\"></a>\n<h2>SYNOPSIS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>#include &lt;tiffio.h&gt;</b></p>\n<!-- INDENTATION -->\n<p><b>int TIFFDataWidth(TIFFDataType</b>\n<i>type</i><b>)</b></p>\n</td>\n</table>\n<a name=\"DESCRIPTION\"></a>\n<h2>DESCRIPTION</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><i>TIFFDataWidth</i> returns a size of <i>type</i> in\nbytes. Currently following data types are supported:<i><br>\nTIFF_BYTE<br>\nTIFF_ASCII<br>\nTIFF_SBYTE<br>\nTIFF_UNDEFINED<br>\nTIFF_SHORT<br>\nTIFF_SSHORT<br>\nTIFF_LONG<br>\nTIFF_SLONG<br>\nTIFF_FLOAT<br>\nTIFF_IFD<br>\nTIFF_RATIONAL<br>\nTIFF_SRATIONAL<br>\nTIFF_DOUBLE</i></p>\n</td>\n</table>\n<a name=\"RETURN VALUES\"></a>\n<h2>RETURN VALUES</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><i>TIFFDataWidth</i> returns a number of bytes occupied\nby the item of given type. 0 returned when uknown data type\nsupplied.</p>\n</td>\n</table>\n<a name=\"SEE ALSO\"></a>\n<h2>SEE ALSO</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>libtiff</b>(3TIFF),</p>\n<!-- INDENTATION -->\n<p>Libtiff library home page:\n<b>http://www.remotesensing.org/libtiff/</b></p>\n</td>\n</table>\n<hr>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/TIFFError.3tiff.html",
    "content": "<!-- Creator     : groff version 1.18.1 -->\n<!-- CreationDate: Fri Jul 13 17:43:15 2007 -->\n<html>\n<head>\n<meta name=\"generator\" content=\"groff -Thtml, see www.gnu.org\">\n<meta name=\"Content-Style\" content=\"text/css\">\n<title>TIFFError</title>\n</head>\n<body>\n\n<h1 align=center>TIFFError</h1>\n<a href=\"#NAME\">NAME</a><br>\n<a href=\"#SYNOPSIS\">SYNOPSIS</a><br>\n<a href=\"#DESCRIPTION\">DESCRIPTION</a><br>\n<a href=\"#RETURN VALUES\">RETURN VALUES</a><br>\n<a href=\"#SEE ALSO\">SEE ALSO</a><br>\n\n<hr>\n<a name=\"NAME\"></a>\n<h2>NAME</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>TIFFError, TIFFSetErrorHandler &minus; library error\nhandling interface</p>\n</td>\n</table>\n<a name=\"SYNOPSIS\"></a>\n<h2>SYNOPSIS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>#include &lt;tiffio.h&gt;</b></p>\n<!-- INDENTATION -->\n<p><b>void TIFFError(const char *</b><i>module</i><b>, const\nchar *</b><i>fmt</i><b>,</b> <i>...</i><b>)</b></p>\n<!-- INDENTATION -->\n<p><b>#include &lt;stdarg.h&gt;</b></p>\n<!-- INDENTATION -->\n<p><b>typedef void (*TIFFErrorHandler)(const char\n*</b><i>module</i><b>, const char *</b><i>fmt</i><b>,\nva_list</b> <i>ap</i><b>);<br>\nTIFFErrorHandler TIFFSetErrorHandler(TIFFErrorHandler\nhandler);</b></p>\n</td>\n</table>\n<a name=\"DESCRIPTION\"></a>\n<h2>DESCRIPTION</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><i>TIFFError</i> invokes the library-wide error handling\nfunction to (normally) write an error message to the\n<b>stderr</b>. The <i>fmt</i> parameter is a\n<i>printf</i>(3S) format string, and any number arguments\ncan be supplied. The <i>module</i> parameter, if non-zero,\nis printed before the message; it typically is used to\nidentify the software module in which an error is\ndetected.</p>\n<!-- INDENTATION -->\n<p>Applications that desire to capture control in the event\nof an error should use <i>TIFFSetErrorHandler</i> to\noverride the default error handler. A <small>NULL</small>\n(0) error handling function may be installed to suppress\nerror messages.</p>\n</td>\n</table>\n<a name=\"RETURN VALUES\"></a>\n<h2>RETURN VALUES</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><i>TIFFSetErrorHandler</i> returns a reference to the\nprevious error handling function.</p>\n</td>\n</table>\n<a name=\"SEE ALSO\"></a>\n<h2>SEE ALSO</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>TIFFWarning</b>(3TIFF), <b>libtiff</b>(3TIFF),\n<b>printf</b>(3)</p>\n<!-- INDENTATION -->\n<p>Libtiff library home page:\n<b>http://www.remotesensing.org/libtiff/</b></p>\n</td>\n</table>\n<hr>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/TIFFFlush.3tiff.html",
    "content": "<!-- Creator     : groff version 1.18.1 -->\n<!-- CreationDate: Fri Jul 13 17:43:15 2007 -->\n<html>\n<head>\n<meta name=\"generator\" content=\"groff -Thtml, see www.gnu.org\">\n<meta name=\"Content-Style\" content=\"text/css\">\n<title>TIFFFlush</title>\n</head>\n<body>\n\n<h1 align=center>TIFFFlush</h1>\n<a href=\"#NAME\">NAME</a><br>\n<a href=\"#SYNOPSIS\">SYNOPSIS</a><br>\n<a href=\"#DESCRIPTION\">DESCRIPTION</a><br>\n<a href=\"#RETURN VALUES\">RETURN VALUES</a><br>\n<a href=\"#DIAGNOSTICS\">DIAGNOSTICS</a><br>\n<a href=\"#SEE ALSO\">SEE ALSO</a><br>\n\n<hr>\n<a name=\"NAME\"></a>\n<h2>NAME</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>TIFFFlush, TIFFFlushData &minus; flush pending writes to\nan open <small>TIFF</small> file</p>\n</td>\n</table>\n<a name=\"SYNOPSIS\"></a>\n<h2>SYNOPSIS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>#include &lt;tiffio.h&gt;</b></p>\n<!-- INDENTATION -->\n<p><b>int TIFFFlush(TIFF *</b><i>tif</i><b>)<br>\nint TIFFFlushData(TIFF *</b><i>tif</i><b>)</b></p>\n</td>\n</table>\n<a name=\"DESCRIPTION\"></a>\n<h2>DESCRIPTION</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><i>TIFFFlush</i> causes any pending writes for the\nspecified file (including writes for the current directory)\nto be done. In normal operation this call is never needed\n&minus; the library automatically does any flushing\nrequired.</p>\n<!-- INDENTATION -->\n<p><i>TIFFFlushData</i> flushes any pending image data for\nthe specified file to be written out; directory-related data\nare not flushed. In normal operation this call is never\nneeded &minus; the library automatically does any flushing\nrequired.</p>\n</td>\n</table>\n<a name=\"RETURN VALUES\"></a>\n<h2>RETURN VALUES</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>0 is returned if an error is encountered, otherwise 1 is\nreturned.</p>\n</td>\n</table>\n<a name=\"DIAGNOSTICS\"></a>\n<h2>DIAGNOSTICS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>All error messages are directed to the\n<b>TIFFError</b>(3TIFF) routine.</p>\n</td>\n</table>\n<a name=\"SEE ALSO\"></a>\n<h2>SEE ALSO</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>TIFFOpen</b>(3TIFF),\n<b>TIFFWriteEncodedStrip</b>(3TIFF),\n<b>TIFFWriteEncodedTile</b>(3TIFF),\n<b>TIFFWriteRawStrip</b>(3TIFF),\n<b>TIFFWriteRawTile</b>(3TIFF),\n<b>TIFFWriteScanline</b>(3TIFF), <b>TIFFWriteTile</b>(3TIFF)\n<b>libtiff</b>(3TIFF),</p>\n<!-- INDENTATION -->\n<p>Libtiff library home page:\n<b>http://www.remotesensing.org/libtiff/</b></p>\n</td>\n</table>\n<hr>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/TIFFGetField.3tiff.html",
    "content": "<!-- Creator     : groff version 1.18.1 -->\n<!-- CreationDate: Fri Jul 13 17:43:15 2007 -->\n<html>\n<head>\n<meta name=\"generator\" content=\"groff -Thtml, see www.gnu.org\">\n<meta name=\"Content-Style\" content=\"text/css\">\n<title>TIFFGetField</title>\n</head>\n<body>\n\n<h1 align=center>TIFFGetField</h1>\n<a href=\"#NAME\">NAME</a><br>\n<a href=\"#SYNOPSIS\">SYNOPSIS</a><br>\n<a href=\"#DESCRIPTION\">DESCRIPTION</a><br>\n<a href=\"#AUTOREGISTERED TAGS\">AUTOREGISTERED TAGS</a><br>\n<a href=\"#RETURN VALUES\">RETURN VALUES</a><br>\n<a href=\"#DIAGNOSTICS\">DIAGNOSTICS</a><br>\n<a href=\"#SEE ALSO\">SEE ALSO</a><br>\n\n<hr>\n<a name=\"NAME\"></a>\n<h2>NAME</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>TIFFGetField, TIFFVGetField &minus; get the value(s) of a\ntag in an open <small>TIFF</small> file</p>\n</td>\n</table>\n<a name=\"SYNOPSIS\"></a>\n<h2>SYNOPSIS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>#include &lt;tiffio.h&gt;</b></p>\n<!-- INDENTATION -->\n<p><b>int TIFFGetField(TIFF *</b><i>tif</i><b>, ttag_t</b>\n<i>tag</i><b>,</b> <i>...</i><b>)</b></p>\n<!-- INDENTATION -->\n<p><b>#include &lt;stdarg.h&gt;</b></p>\n<!-- INDENTATION -->\n<p><b>int TIFFVGetField(TIFF *</b><i>tif</i><b>, ttag_t</b>\n<i>tag</i><b>, va_list</b> <i>ap</i><b>)<br>\nint TIFFGetFieldDefaulted(TIFF *</b><i>tif</i><b>,\nttag_t</b> <i>tag</i><b>,</b> <i>...</i><b>)<br>\nint TIFFVGetFieldDefaulted(TIFF *</b><i>tif</i><b>,\nttag_t</b> <i>tag</i><b>, va_list</b> <i>ap</i><b>)</b></p>\n</td>\n</table>\n<a name=\"DESCRIPTION\"></a>\n<h2>DESCRIPTION</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><i>TIFFGetField</i> returns the value of a tag or\npseudo-tag associated with the the current directory of the\nopened <small>TIFF</small> file <i>tif</i>. (A\n<i>pseudo-tag</i> is a parameter that is used to control the\noperation of the <small>TIFF</small> library but whose value\nis not read or written to the underlying file.) The file\nmust have been previously opened with\n<i>TIFFOpen</i>(3TIFF). The tag is identified by <i>tag</i>,\none of the values defined in the include file <b>tiff.h</b>\n(see also the table below). The type and number of values\nreturned is dependent on the tag being requested. The\nprogramming interface uses a variable argument list as\nprescribed by the <i>stdarg</i>(3) interface. The returned\nvalues should only be interpreted if <i>TIFFGetField</i>\nreturns 1.</p>\n<!-- INDENTATION -->\n<p><i>TIFFVGetField</i> is functionally equivalent to\n<i>TIFFGetField</i> except that it takes a pointer to a\nvariable argument list. <i>TIFFVGetField</i> is useful for\nlayering interfaces on top of the functionality provided by\n<i>TIFFGetField</i>.</p>\n<!-- INDENTATION -->\n<p><i>TIFFGetFieldDefaulted</i> and\n<i>TIFFVGetFieldDefaulted</i> are identical to\n<i>TIFFGetField</i> and <i>TIFFVGetField</i>, except that if\na tag is not defined in the current directory and it has a\ndefault value, then the default value is returned.</p>\n<!-- INDENTATION -->\n<p>The tags understood by <i>libtiff(3TIFF),</i> the number\nof parameter values, and the types for the returned values\nare shown below. The data types are specified as in C and\ncorrespond to the types used to specify tag values to\n<i>TIFFSetField</i>(3TIFF). Remember that\n<i>TIFFGetField</i> returns parameter values, so all the\nlisted data types are pointers to storage where values\nshould be returned. Consult the <small>TIFF</small>\nspecification (or relevant industry specification) for\ninformation on the meaning of each tag and their possible\nvalues.</p></td>\n</table>\n<!-- TABS -->\n\n<p><i>Tag Name Count Types Notes</i></p>\n<!-- TABS -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"5\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_ARTIST</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"23%\">\n\n<p>char**</p>\n</td>\n<td width=\"17%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_BADFAXLINES</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"23%\">\n\n<p>uint32*</p>\n</td>\n<td width=\"17%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_BITSPERSAMPLE</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"23%\">\n\n<p>uint16*</p>\n</td>\n<td width=\"17%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_CLEANFAXDATA</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"23%\">\n\n<p>uint16*</p>\n</td>\n<td width=\"17%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_COLORMAP</p>\n</td>\n<td width=\"8%\">\n\n<p>3</p>\n</td>\n<td width=\"23%\">\n\n<p>uint16**</p>\n</td>\n<td width=\"17%\">\n\n<p>1&lt;&lt;BitsPerSample arrays</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_COMPRESSION</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"23%\">\n\n<p>uint16*</p>\n</td>\n<td width=\"17%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_CONSECUTIVEBADFAXLINES</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"23%\">\n\n<p>uint32*</p>\n</td>\n<td width=\"17%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_COPYRIGHT</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"23%\">\n\n<p>char**</p>\n</td>\n<td width=\"17%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_DATATYPE</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"23%\">\n\n<p>uint16*</p>\n</td>\n<td width=\"17%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_DATETIME</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"23%\">\n\n<p>char**</p>\n</td>\n<td width=\"17%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_DOCUMENTNAME</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"23%\">\n\n<p>char**</p>\n</td>\n<td width=\"17%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_DOTRANGE</p>\n</td>\n<td width=\"8%\">\n\n<p>2</p>\n</td>\n<td width=\"23%\">\n\n<p>uint16*</p>\n</td>\n<td width=\"17%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_EXTRASAMPLES</p>\n</td>\n<td width=\"8%\">\n\n<p>2</p>\n</td>\n<td width=\"23%\">\n\n<p>uint16*,uint16**</p>\n</td>\n<td width=\"17%\">\n\n<p>count &amp; types array</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_FAXFILLFUNC</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"23%\">\n\n<p>TIFFFaxFillFunc*</p>\n</td>\n<td width=\"17%\">\n\n<p>G3/G4 compression pseudo-tag</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_FAXMODE</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"23%\">\n\n<p>int*</p>\n</td>\n<td width=\"17%\">\n\n<p>G3/G4 compression pseudo-tag</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_FILLORDER</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"23%\">\n\n<p>uint16*</p>\n</td>\n<td width=\"17%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_GROUP3OPTIONS</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"23%\">\n\n<p>uint32*</p>\n</td>\n<td width=\"17%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_GROUP4OPTIONS</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"23%\">\n\n<p>uint32*</p>\n</td>\n<td width=\"17%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_HALFTONEHINTS</p>\n</td>\n<td width=\"8%\">\n\n<p>2</p>\n</td>\n<td width=\"23%\">\n\n<p>uint16*</p>\n</td>\n<td width=\"17%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_HOSTCOMPUTER</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"23%\">\n\n<p>char**</p>\n</td>\n<td width=\"17%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_ICCPROFILE</p>\n</td>\n<td width=\"8%\">\n\n<p>2</p>\n</td>\n<td width=\"23%\">\n\n<p>uint32*,void**</p>\n</td>\n<td width=\"17%\">\n\n<p>count, profile data</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_IMAGEDEPTH</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"23%\">\n\n<p>uint32*</p>\n</td>\n<td width=\"17%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_IMAGEDESCRIPTION</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"23%\">\n\n<p>char**</p>\n</td>\n<td width=\"17%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_IMAGELENGTH</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"23%\">\n\n<p>uint32*</p>\n</td>\n<td width=\"17%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_IMAGEWIDTH</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"23%\">\n\n<p>uint32*</p>\n</td>\n<td width=\"17%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_INKNAMES</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"23%\">\n\n<p>char**</p>\n</td>\n<td width=\"17%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_INKSET</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"23%\">\n\n<p>uint16*</p>\n</td>\n<td width=\"17%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_JPEGCOLORMODE</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"23%\">\n\n<p>int*</p>\n</td>\n<td width=\"17%\">\n\n<p>JPEG pseudo-tag</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_JPEGQUALITY</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"23%\">\n\n<p>int*</p>\n</td>\n<td width=\"17%\">\n\n<p>JPEG pseudo-tag</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_JPEGTABLES</p>\n</td>\n<td width=\"8%\">\n\n<p>2</p>\n</td>\n<td width=\"23%\">\n\n<p>uint32*,void**</p>\n</td>\n<td width=\"17%\">\n\n<p>count &amp; tables</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_JPEGTABLESMODE</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"23%\">\n\n<p>int*</p>\n</td>\n<td width=\"17%\">\n\n<p>JPEG pseudo-tag</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_MAKE</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"23%\">\n\n<p>char**</p>\n</td>\n<td width=\"17%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_MATTEING</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"23%\">\n\n<p>uint16*</p>\n</td>\n<td width=\"17%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_MAXSAMPLEVALUE</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"23%\">\n\n<p>uint16*</p>\n</td>\n<td width=\"17%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_MINSAMPLEVALUE</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"23%\">\n\n<p>uint16*</p>\n</td>\n<td width=\"17%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_MODEL</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"23%\">\n\n<p>char**</p>\n</td>\n<td width=\"17%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_ORIENTATION</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"23%\">\n\n<p>uint16*</p>\n</td>\n<td width=\"17%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_PAGENAME</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"23%\">\n\n<p>char**</p>\n</td>\n<td width=\"17%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_PAGENUMBER</p>\n</td>\n<td width=\"8%\">\n\n<p>2</p>\n</td>\n<td width=\"23%\">\n\n<p>uint16*</p>\n</td>\n<td width=\"17%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_PHOTOMETRIC</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"23%\">\n\n<p>uint16*</p>\n</td>\n<td width=\"17%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_PHOTOSHOP</p>\n</td>\n<td width=\"8%\">\n\n<p>2</p>\n</td>\n<td width=\"23%\">\n\n<p>uint32*,void**</p>\n</td>\n<td width=\"17%\">\n\n<p>count, data</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_PLANARCONFIG</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"23%\">\n\n<p>uint16*</p>\n</td>\n<td width=\"17%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_PREDICTOR</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"23%\">\n\n<p>uint16*</p>\n</td>\n<td width=\"17%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_PRIMARYCHROMATICITIES</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"23%\">\n\n<p>float**</p>\n</td>\n<td width=\"17%\">\n\n<p>6-entry array</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_REFERENCEBLACKWHITE</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"23%\">\n\n<p>float**</p>\n</td>\n<td width=\"17%\">\n\n<p>2*SamplesPerPixel array</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_RESOLUTIONUNIT</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"23%\">\n\n<p>uint16*</p>\n</td>\n<td width=\"17%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_RICHTIFFIPTC</p>\n</td>\n<td width=\"8%\">\n\n<p>2</p>\n</td>\n<td width=\"23%\">\n\n<p>uint32*,void**</p>\n</td>\n<td width=\"17%\">\n\n<p>count, data</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_ROWSPERSTRIP</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"23%\">\n\n<p>uint32*</p>\n</td>\n<td width=\"17%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_SAMPLEFORMAT</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"23%\">\n\n<p>uint16*</p>\n</td>\n<td width=\"17%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_SAMPLESPERPIXEL</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"23%\">\n\n<p>uint16*</p>\n</td>\n<td width=\"17%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_SMAXSAMPLEVALUE</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"23%\">\n\n<p>double*</p>\n</td>\n<td width=\"17%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_SMINSAMPLEVALUE</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"23%\">\n\n<p>double*</p>\n</td>\n<td width=\"17%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_SOFTWARE</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"23%\">\n\n<p>char**</p>\n</td>\n<td width=\"17%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_STONITS</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"23%\">\n\n<p>double**</p>\n</td>\n<td width=\"17%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_STRIPBYTECOUNTS</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"23%\">\n\n<p>uint32**</p>\n</td>\n<td width=\"17%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_STRIPOFFSETS</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"23%\">\n\n<p>uint32**</p>\n</td>\n<td width=\"17%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_SUBFILETYPE</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"23%\">\n\n<p>uint32*</p>\n</td>\n<td width=\"17%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_SUBIFD</p>\n</td>\n<td width=\"8%\">\n\n<p>2</p>\n</td>\n<td width=\"23%\">\n\n<p>uint16*,uint32**</p>\n</td>\n<td width=\"17%\">\n\n<p>count &amp; offsets array</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_TARGETPRINTER</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"23%\">\n\n<p>char**</p>\n</td>\n<td width=\"17%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_THRESHHOLDING</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"23%\">\n\n<p>uint16*</p>\n</td>\n<td width=\"17%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_TILEBYTECOUNTS</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"23%\">\n\n<p>uint32**</p>\n</td>\n<td width=\"17%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_TILEDEPTH</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"23%\">\n\n<p>uint32*</p>\n</td>\n<td width=\"17%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_TILELENGTH</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"23%\">\n\n<p>uint32*</p>\n</td>\n<td width=\"17%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_TILEOFFSETS</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"23%\">\n\n<p>uint32**</p>\n</td>\n<td width=\"17%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_TILEWIDTH</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"23%\">\n\n<p>uint32*</p>\n</td>\n<td width=\"17%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_TRANSFERFUNCTION</p>\n</td>\n<td width=\"8%\">\n\n<p>1 or 3&dagger;</p>\n</td>\n<td width=\"23%\"></td>\n<td width=\"17%\">\n\n<p>uint16**1&lt;&lt;BitsPerSample entry arrays</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_WHITEPOINT</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"23%\">\n\n<p>float**</p>\n</td>\n<td width=\"17%\">\n\n<p>2-entry array</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_XMLPACKET</p>\n</td>\n<td width=\"8%\">\n\n<p>2</p>\n</td>\n<td width=\"23%\">\n\n<p>uint32*,void**</p>\n</td>\n<td width=\"17%\">\n\n<p>count, data</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_XPOSITION</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"23%\">\n\n<p>float*</p>\n</td>\n<td width=\"17%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_XRESOLUTION</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"23%\">\n\n<p>float*</p>\n</td>\n<td width=\"17%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_YCBCRCOEFFICIENTS</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"23%\">\n\n<p>float**</p>\n</td>\n<td width=\"17%\">\n\n<p>3-entry array</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_YCBCRPOSITIONING</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"23%\">\n\n<p>uint16*</p>\n</td>\n<td width=\"17%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_YCBCRSUBSAMPLING</p>\n</td>\n<td width=\"8%\">\n\n<p>2</p>\n</td>\n<td width=\"23%\">\n\n<p>uint16*</p>\n</td>\n<td width=\"17%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_YPOSITION</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"23%\">\n\n<p>float*</p>\n</td>\n<td width=\"17%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_YRESOLUTION</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"23%\">\n\n<p>float*&Dagger;</p>\n</td>\n<td width=\"17%\">\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>&dagger; If <i>SamplesPerPixel</i> is one, then a single\narray is returned; otherwise three arrays are returned.<br>\n&Dagger; The contents of this field are quite complex. See\n<i>The ICC Profile Format Specification</i>, Annex B.3\n&quot;Embedding ICC Profiles in TIFF Files&quot; (available\nat http://www.color.org) for an explanation.</p>\n</td>\n</table>\n<a name=\"AUTOREGISTERED TAGS\"></a>\n<h2>AUTOREGISTERED TAGS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>If you can&rsquo;t find the tag in the table above that\nmeans this is unsupported tag. But you still be able to read\nit&rsquo;s value if you know the data type of that tag. For\nexample, if you want to read the LONG value from the tag\n33424 and ASCII string from the tag 36867 you can use the\nfollowing code:</p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"17%\"></td>\n<td width=\"82%\">\n<pre>uint16  count;\nvoid    *data;\n\nTIFFGetField(tiff, 33424, &amp;count, &amp;data);\nprintf(&quot;Tag %d: %d, count %d0, 33424, *(uint32 *)data, count);\nTIFFGetField(tiff, 36867, &amp;count, &amp;data);\nprintf(&quot;Tag %d: %s, count %d0, 36867, (char *)data, count);\n</pre>\n</td>\n</table>\n<!-- INDENTATION -->\n\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>is not supported by <b>libtiff(3TIFF),</b> library</p>\n</td>\n</table>\n<a name=\"RETURN VALUES\"></a>\n<h2>RETURN VALUES</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>1 is returned if the tag is defined in the current\ndirectory; otherwise a 0 is returned.</p>\n</td>\n</table>\n<a name=\"DIAGNOSTICS\"></a>\n<h2>DIAGNOSTICS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>All error messages are directed to the\n<b>TIFFError</b>(3TIFF) routine.</p>\n<!-- INDENTATION -->\n<p><b>Unknown field, tag 0x%x</b>. An unknown tag was\nsupplied.</p>\n</td>\n</table>\n<a name=\"SEE ALSO\"></a>\n<h2>SEE ALSO</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>TIFFOpen</b>(3TIFF), <b>TIFFSetField</b>(3TIFF),\n<b>TIFFSetDirectory</b>(3TIFF),\n<b>TIFFReadDirectory</b>(3TIFF),\n<b>TIFFWriteDirectory</b>(3TIFF) <b>libtiff</b>(3TIFF),</p>\n<!-- INDENTATION -->\n<p>Libtiff library home page:\n<b>http://www.remotesensing.org/libtiff/</b></p>\n</td>\n</table>\n<hr>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/TIFFOpen.3tiff.html",
    "content": "<!-- Creator     : groff version 1.18.1 -->\n<!-- CreationDate: Fri Jul 13 17:43:15 2007 -->\n<html>\n<head>\n<meta name=\"generator\" content=\"groff -Thtml, see www.gnu.org\">\n<meta name=\"Content-Style\" content=\"text/css\">\n<title>TIFFOpen</title>\n</head>\n<body>\n\n<h1 align=center>TIFFOpen</h1>\n<a href=\"#NAME\">NAME</a><br>\n<a href=\"#SYNOPSIS\">SYNOPSIS</a><br>\n<a href=\"#DESCRIPTION\">DESCRIPTION</a><br>\n<a href=\"#OPTIONS\">OPTIONS</a><br>\n<a href=\"#BYTE ORDER\">BYTE ORDER</a><br>\n<a href=\"#RETURN VALUES\">RETURN VALUES</a><br>\n<a href=\"#DIAGNOSTICS\">DIAGNOSTICS</a><br>\n<a href=\"#SEE ALSO\">SEE ALSO</a><br>\n\n<hr>\n<a name=\"NAME\"></a>\n<h2>NAME</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>TIFFOpen, TIFFFdOpen, TIFFClientOpen &minus; open a\n<small>TIFF</small> file for reading or writing</p>\n</td>\n</table>\n<a name=\"SYNOPSIS\"></a>\n<h2>SYNOPSIS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>#include &lt;tiffio.h&gt;</b></p>\n<!-- INDENTATION -->\n<p><b>TIFF* TIFFOpen(const char *</b><i>filename</i><b>,\nconst char *</b><i>mode</i><b>)<br>\nTIFF* TIFFFdOpen(const int</b> <i>fd</i><b>, const char\n*</b><i>filename</i><b>, const char\n*</b><i>mode</i><b>)</b></p>\n<!-- INDENTATION -->\n<p><b>typedef tsize_t (*TIFFReadWriteProc)(thandle_t,\ntdata_t, tsize_t);<br>\ntypedef toff_t (*TIFFSeekProc)(thandle_t, toff_t, int);<br>\ntypedef int (*TIFFCloseProc)(thandle_t);<br>\ntypedef toff_t (*TIFFSizeProc)(thandle_t);<br>\ntypedef int (*TIFFMapFileProc)(thandle_t, tdata_t*,\ntoff_t*);<br>\ntypedef void (*TIFFUnmapFileProc)(thandle_t, tdata_t,\ntoff_t);</b></p>\n<!-- INDENTATION -->\n<p><b>TIFF* TIFFClientOpen(const char\n*</b><i>filename</i><b>, const char *</b><i>mode</i><b>,\nthandle_t</b> <i>clientdata</i><b>, TIFFReadWriteProc</b>\n<i>readproc</i><b>, TIFFReadWriteProc</b>\n<i>writeproc</i><b>, TIFFSeekProc</b> <i>seekproc</i><b>,\nTIFFCloseProc</b> <i>closeproc</i><b>, TIFFSizeProc</b>\n<i>sizeproc</i><b>, TIFFMapFileProc</b> <i>mapproc</i><b>,\nTIFFUnmapFileProc</b> <i>unmapproc</i><b>)</b></p>\n</td>\n</table>\n<a name=\"DESCRIPTION\"></a>\n<h2>DESCRIPTION</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><i>TIFFOpen</i> opens a <small>TIFF</small> file whose\nname is <i>filename</i> and returns a handle to be used in\nsubsequent calls to routines in <i>libtiff</i>. If the open\noperation fails, then zero is returned. The <i>mode</i>\nparameter specifies if the file is to be opened for reading\n(&lsquo;&lsquo;r&rsquo;&rsquo;), writing\n(&lsquo;&lsquo;w&rsquo;&rsquo;), or appending\n(&lsquo;&lsquo;a&rsquo;&rsquo;) and, optionally, whether to\noverride certain default aspects of library operation (see\nbelow). When a file is opened for appending, existing data\nwill not be touched; instead new data will be written as\nadditional subfiles. If an existing file is opened for\nwriting, all previous data is overwritten.</p>\n<!-- INDENTATION -->\n<p>If a file is opened for reading, the first\n<small>TIFF</small> directory in the file is automatically\nread (also see <i>TIFFSetDirectory</i>(3TIFF) for reading\ndirectories other than the first). If a file is opened for\nwriting or appending, a default directory is automatically\ncreated for writing subsequent data. This directory has all\nthe default values specified in <small>TIFF</small> Revision\n6.0: <i>BitsPerSample</i>=1, <i>ThreshHolding</i>=bilevel\nart scan, <i>FillOrder</i>=1 (most significant bit of each\ndata byte is filled first), <i>Orientation</i>=1 (the 0th\nrow represents the visual top of the image, and the 0th\ncolumn represents the visual left hand side),\n<i>SamplesPerPixel</i>=1, <i>RowsPerStrip</i>=infinity,\n<i>ResolutionUnit</i>=2 (inches), and <i>Compression</i>=1\n(no compression). To alter these values, or to define values\nfor additional fields, <i>TIFFSetField</i>(3TIFF) must be\nused.</p>\n<!-- INDENTATION -->\n<p><i>TIFFFdOpen</i> is like <i>TIFFOpen</i> except that it\nopens a <small>TIFF</small> file given an open file\ndescriptor <i>fd</i>. The file&rsquo;s name and mode must\nreflect that of the open descriptor. The object associated\nwith the file descriptor <b>must support random\naccess</b>.</p>\n<!-- INDENTATION -->\n<p><i>TIFFClientOpen</i> is like <i>TIFFOpen</i> except that\nthe caller supplies a collection of functions that the\nlibrary will use to do <small>UNIX</small> -like I/O\noperations. The <i>readproc</i> and <i>writeproc</i> are\ncalled to read and write data at the current file position.\n<i>seekproc</i> is called to change the current file\nposition a la <i>lseek</i>(2). <i>closeproc</i> is invoked\nto release any resources associated with an open file.\n<i>sizeproc</i> is invoked to obtain the size in bytes of a\nfile. <i>mapproc</i> and <i>unmapproc</i> are called to map\nand unmap a file&rsquo;s contents in memory; c.f.\n<i>mmap</i>(2) and <i>munmap</i>(2). The <i>clientdata</i>\nparameter is an opaque &lsquo;&lsquo;handle&rsquo;&rsquo;\npassed to the client-specified routines passed as parameters\nto <i>TIFFClientOpen</i>.</p>\n</td>\n</table>\n<a name=\"OPTIONS\"></a>\n<h2>OPTIONS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>The open mode parameter can include the following flags\nin addition to the &lsquo;&lsquo;r&rsquo;&rsquo;,\n&lsquo;&lsquo;w&rsquo;&rsquo;, and\n&lsquo;&lsquo;a&rsquo;&rsquo; flags. Note however that\noption flags must follow the read-write-append\nspecification.</p>\n</td>\n</table>\n<!-- TABS -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"5\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"2%\">\n\n<p><b>l</b></p>\n</td>\n<td width=\"6%\"></td>\n<td width=\"80%\">\n\n<p>When creating a new file force information be written\nwith Little-Endian byte order (but see below). By default\nthe library will create new files using the native\n<small>CPU</small> byte order.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"2%\">\n\n<p><b>b</b></p>\n</td>\n<td width=\"6%\"></td>\n<td width=\"80%\">\n\n<p>When creating a new file force information be written\nwith Big-Endian byte order (but see below). By default the\nlibrary will create new files using the native\n<small>CPU</small> byte order.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"2%\">\n\n<p><b>L</b></p>\n</td>\n<td width=\"6%\"></td>\n<td width=\"80%\">\n\n<p>Force image data that is read or written to be treated\nwith bits filled from Least Significant Bit (\n<small>LSB</small> ) to Most Significant Bit (\n<small>MSB</small> ). Note that this is the opposite to the\nway the library has worked from its inception.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"2%\">\n\n<p><b>B</b></p>\n</td>\n<td width=\"6%\"></td>\n<td width=\"80%\">\n\n<p>Force image data that is read or written to be treated\nwith bits filled from Most Significant Bit (\n<small>MSB</small> ) to Least Significant Bit (\n<small>LSB</small> ); this is the default.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"2%\">\n\n<p><b>H</b></p>\n</td>\n<td width=\"6%\"></td>\n<td width=\"80%\">\n\n<p>Force image data that is read or written to be treated\nwith bits filled in the same order as the native\n<small>CPU.</small></p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"2%\">\n\n<p><b>M</b></p>\n</td>\n<td width=\"6%\"></td>\n<td width=\"80%\">\n\n<p>Enable the use of memory-mapped files for images opened\nread-only. If the underlying system does not support\nmemory-mapped files or if the specific image being opened\ncannot be memory-mapped then the library will fallback to\nusing the normal system interface for reading information.\nBy default the library will attempt to use memory-mapped\nfiles.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"2%\">\n\n<p><b>m</b></p>\n</td>\n<td width=\"6%\"></td>\n<td width=\"80%\">\n\n<p>Disable the use of memory-mapped files.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"2%\">\n\n<p><b>C</b></p>\n</td>\n<td width=\"6%\"></td>\n<td width=\"80%\">\n\n<p>Enable the use of &lsquo;&lsquo;strip\nchopping&rsquo;&rsquo; when reading images that are\ncomprised of a single strip or tile of uncompressed data.\nStrip chopping is a mechanism by which the library will\nautomatically convert the single-strip image to multiple\nstrips, each of which has about 8 Kilobytes of data. This\nfacility can be useful in reducing the amount of memory used\nto read an image because the library normally reads each\nstrip in its entirety. Strip chopping does however alter the\napparent contents of the image because when an image is\ndivided into multiple strips it looks as though the\nunderlying file contains multiple separate strips. Finally,\nnote that default handling of strip chopping is a\ncompile-time configuration parameter. The default behaviour,\nfor backwards compatibility, is to enable strip\nchopping.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"2%\">\n\n<p><b>c</b></p>\n</td>\n<td width=\"6%\"></td>\n<td width=\"80%\">\n\n<p>Disable the use of strip chopping when reading\nimages.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"2%\">\n\n<p><b>h</b></p>\n</td>\n<td width=\"6%\"></td>\n<td width=\"80%\">\n\n<p>Read TIFF header only, do not load the first image\ndirectory. That could be useful in case of the broken first\ndirectory. We can open the file and proceed to the other\ndirectories.</p>\n</td>\n<td width=\"0%\">\n</td>\n</table>\n<a name=\"BYTE ORDER\"></a>\n<h2>BYTE ORDER</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>The <small>TIFF</small> specification (<b>all\nversions</b>) states that compliant readers <i>must be\ncapable of reading images written in either byte order</i>.\nNonetheless some software that claims to support the reading\nof <small>TIFF</small> images is incapable of reading images\nin anything but the native <small>CPU</small> byte order on\nwhich the software was written. (Especially notorious are\napplications written to run on Intel-based machines.) By\ndefault the library will create new files with the native\nbyte-order of the <small>CPU</small> on which the\napplication is run. This ensures optimal performance and is\nportable to any application that conforms to the TIFF\nspecification. To force the library to use a specific\nbyte-order when creating a new file the\n&lsquo;&lsquo;b&rsquo;&rsquo; and\n&lsquo;&lsquo;l&rsquo;&rsquo; option flags may be included\nin the call to open a file; for example,\n&lsquo;&lsquo;wb&rsquo;&rsquo; or\n&lsquo;&lsquo;wl&rsquo;&rsquo;.</p>\n</td>\n</table>\n<a name=\"RETURN VALUES\"></a>\n<h2>RETURN VALUES</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>Upon successful completion <i>TIFFOpen</i>,\n<i>TIFFFdOpen</i>, and <i>TIFFClientOpen</i> return a\n<small>TIFF</small> pointer. Otherwise, NULL is\nreturned.</p>\n</td>\n</table>\n<a name=\"DIAGNOSTICS\"></a>\n<h2>DIAGNOSTICS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>All error messages are directed to the\n<i>TIFFError</i>(3TIFF) routine. Likewise, warning messages\nare directed to the <i>TIFFWarning</i>(3TIFF) routine.</p>\n<!-- INDENTATION -->\n<p><b>&quot;%s&quot;: Bad mode</b>. The specified\n<i>mode</i> parameter was not one of\n&lsquo;&lsquo;r&rsquo;&rsquo; (read),\n&lsquo;&lsquo;w&rsquo;&rsquo; (write), or\n&lsquo;&lsquo;a&rsquo;&rsquo; (append).</p>\n<!-- INDENTATION -->\n<p><b>%s: Cannot open</b>. <i>TIFFOpen</i>() was unable to\nopen the specified filename for read/writing.</p>\n<!-- INDENTATION -->\n<p><b>Cannot read TIFF header</b>. An error occurred while\nattempting to read the header information.</p>\n<!-- INDENTATION -->\n<p><b>Error writing TIFF header</b>. An error occurred while\nwriting the default header information for a new file.</p>\n<!-- INDENTATION -->\n<p><b>Not a TIFF file, bad magic number %d (0x%x)</b>. The\nmagic number in the header was not (hex) 0x4d4d or (hex)\n0x4949.</p>\n<!-- INDENTATION -->\n<p><b>Not a TIFF file, bad version number %d (0x%x)</b>. The\nversion field in the header was not 42 (decimal).</p>\n<!-- INDENTATION -->\n<p><b>Cannot append to file that has opposite byte\nordering</b>. A file with a byte ordering opposite to the\nnative byte ordering of the current machine was opened for\nappending (&lsquo;&lsquo;a&rsquo;&rsquo;). This is a\nlimitation of the library.</p>\n</td>\n</table>\n<a name=\"SEE ALSO\"></a>\n<h2>SEE ALSO</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><i>libtiff</i>(3TIFF), <i>TIFFClose</i>(3TIFF)</p>\n</td>\n</table>\n<hr>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/TIFFPrintDirectory.3tiff.html",
    "content": "<!-- Creator     : groff version 1.18.1 -->\n<!-- CreationDate: Fri Jul 13 17:43:15 2007 -->\n<html>\n<head>\n<meta name=\"generator\" content=\"groff -Thtml, see www.gnu.org\">\n<meta name=\"Content-Style\" content=\"text/css\">\n<title>TIFFPrintDirectory</title>\n</head>\n<body>\n\n<h1 align=center>TIFFPrintDirectory</h1>\n<a href=\"#NAME\">NAME</a><br>\n<a href=\"#SYNOPSIS\">SYNOPSIS</a><br>\n<a href=\"#DESCRIPTION\">DESCRIPTION</a><br>\n<a href=\"#NOTES\">NOTES</a><br>\n<a href=\"#RETURN VALUES\">RETURN VALUES</a><br>\n<a href=\"#DIAGNOSTICS\">DIAGNOSTICS</a><br>\n<a href=\"#SEE ALSO\">SEE ALSO</a><br>\n\n<hr>\n<a name=\"NAME\"></a>\n<h2>NAME</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>TIFFPrintDirectory &minus; print a description of a\n<small>TIFF</small> directory</p>\n</td>\n</table>\n<a name=\"SYNOPSIS\"></a>\n<h2>SYNOPSIS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>#include &lt;tiffio.h&gt;</b></p>\n<!-- INDENTATION -->\n<p><b>void TIFFPrintDirectory(TIFF *</b><i>tif</i><b>, FILE\n*</b><i>fd</i><b>, long</b> <i>flags</i><b>)</b></p>\n</td>\n</table>\n<a name=\"DESCRIPTION\"></a>\n<h2>DESCRIPTION</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><i>TIFFPrintDirectory</i> prints a description of the\ncurrent directory in the specified <small>TIFF</small> file\nto the standard I/O output stream <i>fd</i>. The\n<i>flags</i> parameter is used to control the <i>level of\ndetail</i> of the printed information; it is a bit-or of the\nflags defined in <b>tiffio.h</b>:</p></td>\n</table>\n<!-- TABS -->\n\n<p>#define TIFFPRINT_NONE 0x0 /* no extra info */</p>\n<!-- TABS -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"5\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"1%\">\n\n<p>#define</p>\n</td>\n<td width=\"30%\">\n\n<p>TIFFPRINT_STRIPS</p>\n</td>\n<td width=\"10%\">\n\n<p>0x1</p>\n</td>\n<td width=\"48%\">\n\n<p>/* strips/tiles info */</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"1%\">\n\n<p>#define</p>\n</td>\n<td width=\"30%\">\n\n<p>TIFFPRINT_CURVES</p>\n</td>\n<td width=\"10%\">\n\n<p>0x2</p>\n</td>\n<td width=\"48%\">\n\n<p>/* color/gray response curves */</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"1%\">\n\n<p>#define</p>\n</td>\n<td width=\"30%\">\n\n<p>TIFFPRINT_COLORMAP</p>\n</td>\n<td width=\"10%\">\n\n<p>0x4</p>\n</td>\n<td width=\"48%\">\n\n<p>/* colormap */</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"1%\">\n\n<p>#define</p>\n</td>\n<td width=\"30%\">\n\n<p>TIFFPRINT_JPEGQTABLES</p>\n</td>\n<td width=\"10%\">\n\n<p>0x100</p>\n</td>\n<td width=\"48%\">\n\n<p>/* JPEG Q matrices */</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"1%\">\n\n<p>#define</p>\n</td>\n<td width=\"30%\">\n\n<p>TIFFPRINT_JPEGACTABLES</p>\n</td>\n<td width=\"10%\">\n\n<p>0x200</p>\n</td>\n<td width=\"48%\">\n\n<p>/* JPEG AC tables */</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"1%\">\n\n<p>#define</p>\n</td>\n<td width=\"30%\">\n\n<p>TIFFPRINT_JPEGDCTABLES</p>\n</td>\n<td width=\"10%\">\n\n<p>0x200</p>\n</td>\n<td width=\"48%\">\n\n<p>/* JPEG DC tables */</p>\n</td>\n</table>\n<a name=\"NOTES\"></a>\n<h2>NOTES</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>In C++ the <i>flags</i> parameter defaults to 0.</p>\n</td>\n</table>\n<a name=\"RETURN VALUES\"></a>\n<h2>RETURN VALUES</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>None.</p>\n</td>\n</table>\n<a name=\"DIAGNOSTICS\"></a>\n<h2>DIAGNOSTICS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>None.</p>\n</td>\n</table>\n<a name=\"SEE ALSO\"></a>\n<h2>SEE ALSO</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><i>libtiff</i>(3TIFF), <i>TIFFOpen</i>(3TIFF),\n<i>TIFFReadDirectory</i>(3TIFF),\n<i>TIFFSetDirectory</i>(3TIFF)</p>\n</td>\n</table>\n<hr>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/TIFFRGBAImage.3tiff.html",
    "content": "<!-- Creator     : groff version 1.18.1 -->\n<!-- CreationDate: Fri Jul 13 17:43:16 2007 -->\n<html>\n<head>\n<meta name=\"generator\" content=\"groff -Thtml, see www.gnu.org\">\n<meta name=\"Content-Style\" content=\"text/css\">\n<title>TIFFRGBAImage</title>\n</head>\n<body>\n\n<h1 align=center>TIFFRGBAImage</h1>\n<a href=\"#NAME\">NAME</a><br>\n<a href=\"#SYNOPSIS\">SYNOPSIS</a><br>\n<a href=\"#DESCRIPTION\">DESCRIPTION</a><br>\n<a href=\"#ALTERNATE RASTER FORMATS\">ALTERNATE RASTER FORMATS</a><br>\n<a href=\"#SIMULTANEOUS RASTER STORE AND DISPLAY\">SIMULTANEOUS RASTER STORE AND DISPLAY</a><br>\n<a href=\"#SUPPORTING ADDITIONAL TIFF FORMATS\">SUPPORTING ADDITIONAL TIFF FORMATS</a><br>\n<a href=\"#NOTES\">NOTES</a><br>\n<a href=\"#RETURN VALUES\">RETURN VALUES</a><br>\n<a href=\"#DIAGNOSTICS\">DIAGNOSTICS</a><br>\n<a href=\"#SEE ALSO\">SEE ALSO</a><br>\n\n<hr>\n<a name=\"NAME\"></a>\n<h2>NAME</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>TIFFRGBAImageOK, TIFFRGBAImageBegin, TIFFRGBAImageGet,\nTIFFRGBAImageEnd &minus; read and decode an image into a\nraster</p>\n</td>\n</table>\n<a name=\"SYNOPSIS\"></a>\n<h2>SYNOPSIS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>#include &lt;tiffio.h&gt;</b></p>\n<!-- INDENTATION -->\n<p><b>typedef unsigned char TIFFRGBValue; typedef struct\n_TIFFRGBAImage TIFFRGBAImage;</b></p>\n<!-- INDENTATION -->\n<p><b>int TIFFRGBAImageOK(TIFF *</b><i>tif</i><b>, char</b>\n<i>emsg[1024]</i><b>)<br>\nint TIFFRGBAImageBegin(TIFFRGBAImage *</b><i>img</i><b>,\nTIFF*</b> <i>tif</i><b>, int</b> <i>stopOnError</i><b>,\nchar</b> <i>emsg[1024]</i><b>)<br>\nint TIFFRGBAImageGet(TIFFRGBAImage *</b><i>img</i><b>,\nuint32*</b> <i>raster</i><b>, uint32</b> <i>width</i> <b>,\nuint32</b> <i>height</i><b>)<br>\nvoid TIFFRGBAImageEnd(TIFFRGBAImage\n*</b><i>img</i><b>)</b></p>\n</td>\n</table>\n<a name=\"DESCRIPTION\"></a>\n<h2>DESCRIPTION</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>The routines described here provide a high-level\ninterface through which <small>TIFF</small> images may be\nread into memory. Images may be strip- or tile-based and\nhave a variety of different characteristics: bits/sample,\nsamples/pixel, photometric, etc. Decoding state is\nencapsulated in a <i>TIFFRGBAImage</i> structure making it\npossible to capture state for multiple images and quickly\nswitch between them. The target raster format can be\ncustomized to a particular application&rsquo;s needs by\ninstalling custom routines that manipulate image data\naccording to application requirements.</p>\n<!-- INDENTATION -->\n<p>The default usage for these routines is: check if an\nimage can be processed using <i>TIFFRGBAImageOK</i>,\nconstruct a decoder state block using\n<i>TIFFRGBAImageBegin</i>, read and decode an image into a\ntarget raster using <i>TIFFRGBAImageGet</i>, and then\nrelease resources using <i>TIFFRGBAImageEnd</i>.\n<i>TIFFRGBAImageGet</i> can be called multiple times to\ndecode an image using different state parameters. If\nmultiple images are to be displayed and there is not enough\nspace for each of the decoded rasters, multiple state blocks\ncan be managed and then calls can be made to\n<i>TIFFRGBAImageGet</i> as needed to display an image.</p>\n<!-- INDENTATION -->\n<p>The generated raster is assumed to be an array of\n<i>width</i> times <i>height</i> 32-bit entries, where\n<i>width</i> must be less than or equal to the width of the\nimage (<i>height</i> may be any non-zero size). If the\nraster dimensions are smaller than the image, the image data\nis cropped to the raster bounds. If the raster height is\ngreater than that of the image, then the image data are\nplaced in the lower part of the raster. (Note that the\nraster is assume to be organized such that the pixel at\nlocation (<i>x</i>,<i>y</i>) is\n<i>raster</i>[<i>y</i>*<i>width</i>+<i>x</i>]; with the\nraster origin in the <b>lower-left</b> hand corner.)</p>\n<!-- INDENTATION -->\n<p>Raster pixels are 8-bit packed red, green, blue, alpha\nsamples. The macros <i>TIFFGetR</i>, <i>TIFFGetG</i>,\n<i>TIFFGetB</i>, and <i>TIFFGetA</i> should be used to\naccess individual samples. Images without Associated Alpha\nmatting information have a constant Alpha of 1.0 (255).</p>\n<!-- INDENTATION -->\n<p><i>TIFFRGBAImageGet</i> converts non-8-bit images by\nscaling sample values. Palette, grayscale, bilevel,\n<small>CMYK</small> , and YCbCr images are converted to\n<small>RGB</small> transparently. Raster pixels are returned\nuncorrected by any colorimetry information present in the\ndirectory.</p>\n<!-- INDENTATION -->\n<p>The parameter <i>stopOnError</i> specifies how to act if\nan error is encountered while reading the image. If\n<i>stopOnError</i> is non-zero, then an error will terminate\nthe operation; otherwise <i>TIFFRGBAImageGet</i> will\ncontinue processing data until all the possible data in the\nimage have been requested.</p>\n</td>\n</table>\n<a name=\"ALTERNATE RASTER FORMATS\"></a>\n<h2>ALTERNATE RASTER FORMATS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>To use the core support for reading and processing\n<small>TIFF</small> images, but write the resulting raster\ndata in a different format one need only override the\n&lsquo;&lsquo;<i>put methods</i>&rsquo;&rsquo; used to store\nraster data. These methods are are defined in the\n<i>TIFFRGBAImage</i> structure and initially setup by\n<i>TIFFRGBAImageBegin</i> to point to routines that pack\nraster data in the default <small>ABGR</small> pixel format.\nTwo different routines are used according to the physical\norganization of the image data in the file:\n<i>PlanarConfiguration</i>=1 (packed samples), and\n<i>PlanarConfiguration</i>=2 (separated samples). Note that\nthis mechanism can be used to transform the data before\nstoring it in the raster. For example one can convert data\nto colormap indices for display on a colormap display.</p>\n</td>\n</table>\n<a name=\"SIMULTANEOUS RASTER STORE AND DISPLAY\"></a>\n<h2>SIMULTANEOUS RASTER STORE AND DISPLAY</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>It is simple to display an image as it is being read into\nmemory by overriding the put methods as described above for\nsupporting alternate raster formats. Simply keep a reference\nto the default put methods setup by\n<i>TIFFRGBAImageBegin</i> and then invoke them before or\nafter each display operation. For example, the\n<i>tiffgt</i>(1) utility uses the following put method to\nupdate the display as the raster is being filled:</p>\n<!-- INDENTATION -->\n<pre>static void\nputContigAndDraw(TIFFRGBAImage* img, uint32* raster,\n    uint32 x, uint32 y, uint32 w, uint32 h,\n    int32 fromskew, int32 toskew,\n    unsigned char* cp)\n{\n    (*putContig)(img, raster, x, y, w, h, fromskew, toskew, cp);\n    if (x+w == width) {\n     w = width;\n     if (img-&gt;orientation == ORIENTATION_TOPLEFT)\n         lrectwrite(0, y-(h-1), w-1, y, raster-x-(h-1)*w);\n     else\n         lrectwrite(0, y, w-1, y+h-1, raster);\n    }\n}\n</pre>\n<!-- INDENTATION -->\n<p>(the original routine provided by the library is saved in\nthe variable <i>putContig</i>.)</p>\n</td>\n</table>\n<a name=\"SUPPORTING ADDITIONAL TIFF FORMATS\"></a>\n<h2>SUPPORTING ADDITIONAL TIFF FORMATS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>The <i>TIFFRGBAImage</i> routines support the most\ncommonly encountered flavors of <small>TIFF.</small> It is\npossible to extend this support by overriding the\n&lsquo;&lsquo;<i>get method</i>&rsquo;&rsquo; invoked by\n<i>TIFFRGBAImageGet</i> to read <small>TIFF</small> image\ndata. Details of doing this are a bit involved, it is best\nto make a copy of an existing get method and modify it to\nsuit the needs of an application.</p>\n</td>\n</table>\n<a name=\"NOTES\"></a>\n<h2>NOTES</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>Samples must be either 1, 2, 4, 8, or 16 bits.\nColorimetric samples/pixel must be either 1, 3, or 4 (i.e.\n<i>SamplesPerPixel</i> minus <i>ExtraSamples</i>).</p>\n<!-- INDENTATION -->\n<p>Palette image colormaps that appear to be incorrectly\nwritten as 8-bit values are automatically scaled to\n16-bits.</p>\n</td>\n</table>\n<a name=\"RETURN VALUES\"></a>\n<h2>RETURN VALUES</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>All routines return 1 if the operation was successful.\nOtherwise, 0 is returned if an error was encountered and\n<i>stopOnError</i> is zero.</p>\n</td>\n</table>\n<a name=\"DIAGNOSTICS\"></a>\n<h2>DIAGNOSTICS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>All error messages are directed to the\n<i>TIFFError</i>(3TIFF) routine.</p>\n<!-- INDENTATION -->\n<p><b>Sorry, can not handle %d-bit pictures</b>. The image\nhad <i>BitsPerSample</i> other than 1, 2, 4, 8, or 16.</p>\n<!-- INDENTATION -->\n<p><b>Sorry, can not handle %d-channel images</b>. The image\nhad <i>SamplesPerPixel</i> other than 1, 3, or 4.</p>\n<!-- INDENTATION -->\n<p><b>Missing needed &quot;PhotometricInterpretation&quot;\ntag</b>. The image did not have a tag that describes how to\ndisplay the data.</p>\n<!-- INDENTATION -->\n<p><b>No &quot;PhotometricInterpretation&quot; tag, assuming\nRGB</b>. The image was missing a tag that describes how to\ndisplay it, but because it has 3 or 4 samples/pixel, it is\nassumed to be <small>RGB.</small></p>\n<!-- INDENTATION -->\n<p><b>No &quot;PhotometricInterpretation&quot; tag, assuming\nmin-is-black</b>. The image was missing a tag that describes\nhow to display it, but because it has 1 sample/pixel, it is\nassumed to be a grayscale or bilevel image.</p>\n<!-- INDENTATION -->\n<p><b>No space for photometric conversion table</b>. There\nwas insufficient memory for a table used to convert image\nsamples to 8-bit <small>RGB.</small></p>\n<!-- INDENTATION -->\n<p><b>Missing required &quot;Colormap&quot; tag</b>. A\nPalette image did not have a required <i>Colormap</i>\ntag.</p>\n<!-- INDENTATION -->\n<p><b>No space for tile buffer</b>. There was insufficient\nmemory to allocate an i/o buffer.</p>\n<!-- INDENTATION -->\n<p><b>No space for strip buffer</b>. There was insufficient\nmemory to allocate an i/o buffer.</p>\n<!-- INDENTATION -->\n<p><b>Can not handle format</b>. The image has a format\n(combination of <i>BitsPerSample</i>,\n<i>SamplesPerPixel</i>, and\n<i>PhotometricInterpretation</i>) that can not be\nhandled.</p>\n<!-- INDENTATION -->\n<p><b>No space for B&amp;W mapping table</b>. There was\ninsufficient memory to allocate a table used to map\ngrayscale data to <small>RGB.</small></p>\n<!-- INDENTATION -->\n<p><b>No space for Palette mapping table</b>. There was\ninsufficient memory to allocate a table used to map data to\n8-bit <small>RGB.</small></p>\n</td>\n</table>\n<a name=\"SEE ALSO\"></a>\n<h2>SEE ALSO</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>TIFFOpen</b>(3TIFF), <b>TIFFReadRGBAImage</b>(3TIFF),\n<b>TIFFReadRGBAImageOriented</b>(3TIFF),\n<b>TIFFReadRGBAStrip</b>(3TIFF),\n<b>TIFFReadRGBATile</b>(3TIFF), <b>libtiff</b>(3TIFF)</p>\n<!-- INDENTATION -->\n<p>Libtiff library home page:\n<b>http://www.remotesensing.org/libtiff/</b></p>\n</td>\n</table>\n<hr>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/TIFFReadDirectory.3tiff.html",
    "content": "<!-- Creator     : groff version 1.18.1 -->\n<!-- CreationDate: Fri Jul 13 17:43:16 2007 -->\n<html>\n<head>\n<meta name=\"generator\" content=\"groff -Thtml, see www.gnu.org\">\n<meta name=\"Content-Style\" content=\"text/css\">\n<title>TIFFReadDirectory</title>\n</head>\n<body>\n\n<h1 align=center>TIFFReadDirectory</h1>\n<a href=\"#NAME\">NAME</a><br>\n<a href=\"#SYNOPSIS\">SYNOPSIS</a><br>\n<a href=\"#DESCRIPTION\">DESCRIPTION</a><br>\n<a href=\"#NOTES\">NOTES</a><br>\n<a href=\"#RETURN VALUES\">RETURN VALUES</a><br>\n<a href=\"#DIAGNOSTICS\">DIAGNOSTICS</a><br>\n<a href=\"#SEE ALSO\">SEE ALSO</a><br>\n\n<hr>\n<a name=\"NAME\"></a>\n<h2>NAME</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><big>TIFFReadDirectory &minus; get the contents of the\nnext directory in an open</big> TIFF <big>file</big></p>\n</td>\n</table>\n<a name=\"SYNOPSIS\"></a>\n<h2>SYNOPSIS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><big><b>#include &lt;tiffio.h&gt;</b></big></p>\n<!-- INDENTATION -->\n<p><big><b>int TIFFReadDirectory(TIFF\n*</b><i>tif</i><b>)</b></big></p>\n</td>\n</table>\n<a name=\"DESCRIPTION\"></a>\n<h2>DESCRIPTION</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><big>Read the next directory in the specified file and\nmake it the current directory. Applications only need to\ncall <i>TIFFReadDirectory</i> to read multiple subfiles in a\nsingle</big> TIFF <big>file&mdash; the first directory in a\nfile is automatically read when <i>TIFFOpen</i> is\ncalled.</big></p>\n</td>\n</table>\n<a name=\"NOTES\"></a>\n<h2>NOTES</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><big>If the library is compiled with</big>\nSTRIPCHOP_SUPPORT <big>enabled, then images that have a\nsingle uncompressed strip or tile of data are automatically\ntreated as if they were made up of multiple strips or tiles\nof approximately 8 kilobytes each. This operation is done\nonly in-memory; it does not alter the contents of the file.\nHowever, the construction of the &lsquo;&lsquo;chopped\nstrips&rsquo;&rsquo; is visible to the application through\nthe number of strips [tiles] returned by\n<i>TIFFNumberOfStrips</i>\n[<i>TIFFNumberOfTiles</i>].</big></p>\n</td>\n</table>\n<a name=\"RETURN VALUES\"></a>\n<h2>RETURN VALUES</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><big>If the next directory was successfully read, 1 is\nreturned. Otherwise, 0 is returned if an error was\nencountered, or if there are no more directories to be\nread.</big></p>\n</td>\n</table>\n<a name=\"DIAGNOSTICS\"></a>\n<h2>DIAGNOSTICS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><big>All error messages are directed to the\n<i>TIFFError</i>(3TIFF) routine. All warning messages are\ndirected to the <i>TIFFWarning</i>(3TIFF) routine.</big></p>\n<!-- INDENTATION -->\n<p><big><b>Seek error accessing TIFF directory</b>. An error\noccurred while positioning to the location of the\ndirectory.</big></p>\n<!-- INDENTATION -->\n<p><big><b>Wrong data type %d for field &quot;%s&quot;</b>.\nThe tag entry in the directory had an incorrect data type.\nFor example, an <i>ImageDescription</i> tag with a</big>\nSHORT <big>data type.</big></p>\n<!-- INDENTATION -->\n<p><big><b>TIFF directory is missing required &quot;%s&quot;\nfield</b>. The specified tag is required to be present by\nthe</big> TIFF <big>5.0 specification, but is missing. The\ndirectory is (usually) unusable.</big></p>\n<!-- INDENTATION -->\n<p><big><b>%s: Rational with zero denominator</b>. A\ndirectory tag has a</big> RATIONAL <big>value whose\ndenominator is zero.</big></p>\n<!-- INDENTATION -->\n<p><big><b>Incorrect count %d for field &quot;%s&quot; (%lu,\nexpecting %lu); tag ignored</b>. The specified tag&rsquo;s\ncount field is bad. For example, a count other than 1 for a\n<i>SubFileType</i> tag.</big></p>\n<!-- INDENTATION -->\n<p><big><b>Cannot handle different per-sample values for\nfield &quot;%s&quot;</b>. The tag has <i>SamplesPerPixel</i>\nvalues and they are not all the same; e.g.\n<i>BitsPerSample</i>. The library is unable to handle images\nof this sort.</big></p>\n<!-- INDENTATION -->\n<p><big><b>Count mismatch for field &quot;%s&quot;;\nexpecting %d, got %d</b>. The count field in a tag does not\nagree with the number expected by the library. This should\nnever happen, so if it does, the library refuses to read the\ndirectory.</big></p>\n<!-- INDENTATION -->\n<p><big><b>Invalid TIFF directory; tags are not sorted in\nascending order</b>. The directory tags are not properly\nsorted as specified in the</big> TIFF <big>5.0\nspecification. This error is not fatal.</big></p>\n<!-- INDENTATION -->\n<p><big><b>Ignoring unknown field with tag %d (0x%x)</b>. An\nunknown tag was encountered in the directory; the library\nignores all such tags.</big></p>\n<!-- INDENTATION -->\n<p><big><b>TIFF directory is missing requred\n&quot;ImageLength&quot; field</b>. The image violates the\nspecification by not having a necessary field. There is no\nway for the library to recover from this error.</big></p>\n<!-- INDENTATION -->\n<p><big><b>TIFF directory is missing requred\n&quot;PlanarConfig&quot; field</b>. The image violates the\nspecification by not having a necessary field. There is no\nway for the library to recover from this error.</big></p>\n<!-- INDENTATION -->\n<p><big><b>TIFF directory is missing requred\n&quot;StripOffsets&quot; field</b>. The image has multiple\nstrips, but is missing the tag that specifies the file\noffset to each strip of data. There is no way for the\nlibrary to recover from this error.</big></p>\n<!-- INDENTATION -->\n<p><big><b>TIFF directory is missing requred\n&quot;TileOffsets&quot; field</b>. The image has multiple\ntiles, but is missing the tag that specifies the file offset\nto each tile of data. There is no way for the library to\nrecover from this error.</big></p>\n<!-- INDENTATION -->\n<p><big><b>TIFF directory is missing required\n&quot;StripByteCounts&quot; field</b>. The image has\nmultiple strips, but is missing the tag that specifies the\nsize of each strip of data. There is no way for the library\nto recover from this error.</big></p>\n<!-- INDENTATION -->\n<p><big><b>TIFF directory is missing required\n&quot;StripByteCounts&quot; field, calculating from\nimagelength</b>. The image violates the specification by not\nhaving a necessary field. However, when the image is\ncomprised of only one strip or tile, the library will\nestimate the missing value based on the file size.</big></p>\n<!-- INDENTATION -->\n<p><big><b>Bogus &quot;StripByteCounts&quot; field, ignoring\nand calculating from imagelength</b>. Certain vendors\nviolate the specification by writing zero for the\nStripByteCounts tag when they want to leave the value\nunspecified. If the image has a single strip, the library\nwill estimate the missing value based on the file\nsize.</big></p>\n</td>\n</table>\n<a name=\"SEE ALSO\"></a>\n<h2>SEE ALSO</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><big><b>TIFFOpen</b>(3TIFF),\n<b>TIFFWriteDirectory</b>(3TIFF),\n<b>TIFFSetDirectory</b>(3TIFF),\n<b>TIFFSetSubDirectory</b>(3TIFF),\n<b>libtiff</b>(3TIFF)</big></p>\n<!-- INDENTATION -->\n<p><big>Libtiff library home page:\n<b>http://www.remotesensing.org/libtiff/</b></big></p>\n</td>\n</table>\n<hr>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/TIFFReadEncodedStrip.3tiff.html",
    "content": "<!-- Creator     : groff version 1.18.1 -->\n<!-- CreationDate: Fri Jul 13 17:43:16 2007 -->\n<html>\n<head>\n<meta name=\"generator\" content=\"groff -Thtml, see www.gnu.org\">\n<meta name=\"Content-Style\" content=\"text/css\">\n<title>TIFFReadEncodedStrip</title>\n</head>\n<body>\n\n<h1 align=center>TIFFReadEncodedStrip</h1>\n<a href=\"#NAME\">NAME</a><br>\n<a href=\"#SYNOPSIS\">SYNOPSIS</a><br>\n<a href=\"#DESCRIPTION\">DESCRIPTION</a><br>\n<a href=\"#NOTES\">NOTES</a><br>\n<a href=\"#RETURN VALUES\">RETURN VALUES</a><br>\n<a href=\"#DIAGNOSTICS\">DIAGNOSTICS</a><br>\n<a href=\"#SEE ALSO\">SEE ALSO</a><br>\n\n<hr>\n<a name=\"NAME\"></a>\n<h2>NAME</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><big>TIFFReadEncodedStrip &minus; read and decode a strip\nof data from an open</big> TIFF <big>file</big></p>\n</td>\n</table>\n<a name=\"SYNOPSIS\"></a>\n<h2>SYNOPSIS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><big><b>#include &lt;tiffio.h&gt;</b></big></p>\n<!-- INDENTATION -->\n<p><big><b>tsize_t TIFFReadEncodedStrip(TIFF\n*</b><i>tif</i><b>, tstrip_t</b> <i>strip</i><b>,\ntdata_t</b> <i>buf</i><b>, tsize_t</b>\n<i>size</i><b>)</b></big></p>\n</td>\n</table>\n<a name=\"DESCRIPTION\"></a>\n<h2>DESCRIPTION</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><big>Read the specified strip of data and place up to\n<i>size</i> bytes of decompressed information in the (user\nsupplied) data buffer.</big></p>\n</td>\n</table>\n<a name=\"NOTES\"></a>\n<h2>NOTES</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><big>The value of <i>strip</i> is a &lsquo;&lsquo;raw\nstrip number.&rsquo;&rsquo; That is, the caller must take\ninto account whether or not the data are organized in\nseparate planes (<i>PlanarConfiguration</i>=2). To read a\nfull strip of data the data buffer should typically be at\nleast as large as the number returned by\n<b>TIFFStripSize</b>(3TIFF). If the -1 passed in <i>size</i>\nparameter, the whole strip will be read. You should be sure\nyou have enough space allocated for the buffer.</big></p>\n<!-- INDENTATION -->\n<p><big>The library attempts to hide bit- and byte-ordering\ndifferences between the image and the native machine by\nconverting data to the native machine order. Bit reversal is\ndone if the <i>FillOrder</i> tag is opposite to the native\nmachine bit order. 16- and 32-bit samples are automatically\nbyte-swapped if the file was written with a byte order\nopposite to the native machine byte order,</big></p>\n</td>\n</table>\n<a name=\"RETURN VALUES\"></a>\n<h2>RETURN VALUES</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><big>The actual number of bytes of data that were placed\nin <i>buf</i> is returned; <i>TIFFReadEncodedStrip</i>\nreturns &minus;1 if an error was encountered.</big></p>\n</td>\n</table>\n<a name=\"DIAGNOSTICS\"></a>\n<h2>DIAGNOSTICS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><big>All error messages are directed to the\n<b>TIFFError</b>(3TIFF) routine.</big></p>\n</td>\n</table>\n<a name=\"SEE ALSO\"></a>\n<h2>SEE ALSO</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><big><b>TIFFOpen</b>(3TIFF),\n<b>TIFFReadRawStrip</b>(3TIFF),\n<b>TIFFReadScanline</b>(3TIFF),\n<b>libtiff</b>(3TIFF)</big></p>\n<!-- INDENTATION -->\n<p><big>Libtiff library home page:\n<b>http://www.remotesensing.org/libtiff/</b></big></p>\n</td>\n</table>\n<hr>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/TIFFReadEncodedTile.3tiff.html",
    "content": "<!-- Creator     : groff version 1.18.1 -->\n<!-- CreationDate: Fri Jul 13 17:43:16 2007 -->\n<html>\n<head>\n<meta name=\"generator\" content=\"groff -Thtml, see www.gnu.org\">\n<meta name=\"Content-Style\" content=\"text/css\">\n<title>TIFFReadEncodedTile</title>\n</head>\n<body>\n\n<h1 align=center>TIFFReadEncodedTile</h1>\n<a href=\"#NAME\">NAME</a><br>\n<a href=\"#SYNOPSIS\">SYNOPSIS</a><br>\n<a href=\"#DESCRIPTION\">DESCRIPTION</a><br>\n<a href=\"#NOTES\">NOTES</a><br>\n<a href=\"#RETURN VALUES\">RETURN VALUES</a><br>\n<a href=\"#DIAGNOSTICS\">DIAGNOSTICS</a><br>\n<a href=\"#SEE ALSO\">SEE ALSO</a><br>\n\n<hr>\n<a name=\"NAME\"></a>\n<h2>NAME</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>TIFFReadEncodedTile &minus; read and decode a tile of\ndata from an open <small>TIFF</small> file</p>\n</td>\n</table>\n<a name=\"SYNOPSIS\"></a>\n<h2>SYNOPSIS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>#include &lt;tiffio.h&gt;</b></p>\n<!-- INDENTATION -->\n<p><b>int TIFFReadEncodedTile(TIFF *</b><i>tif</i><b>,\nttile_t</b> <i>tile</i><b>, tdata_t</b> <i>buf</i><b>,\ntsize_t</b> <i>size</i><b>)</b></p>\n</td>\n</table>\n<a name=\"DESCRIPTION\"></a>\n<h2>DESCRIPTION</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>Read the specified tile of data and place up to\n<i>size</i> bytes of decompressed information in the (user\nsupplied) data buffer.</p>\n</td>\n</table>\n<a name=\"NOTES\"></a>\n<h2>NOTES</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>The value of <i>tile</i> is a &lsquo;&lsquo;raw tile\nnumber.&rsquo;&rsquo; That is, the caller must take into\naccount whether or not the data are organized in separate\nplanes (<i>PlanarConfiguration</i>=2).\n<i>TIFFComputeTile</i> automatically does this when\nconverting an (x,y,z,sample) coordinate quadruple to a tile\nnumber. To read a full tile of data the data buffer should\nbe at least as large as the value returned by\n<i>TIFFTileSize</i>.</p>\n<!-- INDENTATION -->\n<p>The library attempts to hide bit- and byte-ordering\ndifferences between the image and the native machine by\nconverting data to the native machine order. Bit reversal is\ndone if the <i>FillOrder</i> tag is opposite to the native\nmachine bit order. 16- and 32-bit samples are automatically\nbyte-swapped if the file was written with a byte order\nopposite to the native machine byte order,</p>\n</td>\n</table>\n<a name=\"RETURN VALUES\"></a>\n<h2>RETURN VALUES</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>The actual number of bytes of data that were placed in\n<i>buf</i> is returned; <i>TIFFReadEncodedTile</i> returns\n&minus;1 if an error was encountered.</p>\n</td>\n</table>\n<a name=\"DIAGNOSTICS\"></a>\n<h2>DIAGNOSTICS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>All error messages are directed to the\n<b>TIFFError</b>(3TIFF) routine.</p>\n</td>\n</table>\n<a name=\"SEE ALSO\"></a>\n<h2>SEE ALSO</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>TIFFOpen</b>(3TIFF), <b>TIFFReadRawTile</b>(3TIFF),\n<b>TIFFReadTile</b>(3TIFF), <b>libtiff</b>(3TIFF)</p>\n<!-- INDENTATION -->\n<p>Libtiff library home page:\n<b>http://www.remotesensing.org/libtiff/</b></p>\n</td>\n</table>\n<hr>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/TIFFReadRGBAImage.3tiff.html",
    "content": "<!-- Creator     : groff version 1.18.1 -->\n<!-- CreationDate: Fri Jul 13 17:43:16 2007 -->\n<html>\n<head>\n<meta name=\"generator\" content=\"groff -Thtml, see www.gnu.org\">\n<meta name=\"Content-Style\" content=\"text/css\">\n<title>TIFFReadRGBAImage</title>\n</head>\n<body>\n\n<h1 align=center>TIFFReadRGBAImage</h1>\n<a href=\"#NAME\">NAME</a><br>\n<a href=\"#SYNOPSIS\">SYNOPSIS</a><br>\n<a href=\"#DESCRIPTION\">DESCRIPTION</a><br>\n<a href=\"#NOTES\">NOTES</a><br>\n<a href=\"#RETURN VALUES\">RETURN VALUES</a><br>\n<a href=\"#DIAGNOSTICS\">DIAGNOSTICS</a><br>\n<a href=\"#SEE ALSO\">SEE ALSO</a><br>\n\n<hr>\n<a name=\"NAME\"></a>\n<h2>NAME</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>TIFFReadRGBAImage, TIFFReadRGBAImageOriented &minus; read\nand decode an image into a fixed-format raster</p>\n</td>\n</table>\n<a name=\"SYNOPSIS\"></a>\n<h2>SYNOPSIS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>#include &lt;tiffio.h&gt;</b></p>\n<!-- INDENTATION -->\n<p><b>#define TIFFGetR(abgr) ((abgr) &amp; 0xff)<br>\n#define TIFFGetG(abgr) (((abgr) &gt;&gt; 8) &amp; 0xff)<br>\n#define TIFFGetB(abgr) (((abgr) &gt;&gt; 16) &amp; 0xff)<br>\n#define TIFFGetA(abgr) (((abgr) &gt;&gt; 24) &amp;\n0xff)</b></p>\n<!-- INDENTATION -->\n<p><b>int TIFFReadRGBAImage(TIFF *</b><i>tif</i><b>,\nuint32</b> <i>width</i><b>, uint32</b> <i>height</i><b>,\nuint32 *</b><i>raster</i><b>, int</b>\n<i>stopOnError</i><b>)<br>\nint TIFFReadRGBAImageOriented(TIFF *</b><i>tif</i><b>,\nuint32</b> <i>width</i><b>, uint32</b> <i>height</i><b>,\nuint32 *</b><i>raster</i><b>, int</b> <i>orientation</i><b>,\nint</b> <i>stopOnError</i><b>)</b></p>\n</td>\n</table>\n<a name=\"DESCRIPTION\"></a>\n<h2>DESCRIPTION</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><i>TIFFReadRGBAImage</i> reads a strip- or tile-based\nimage into memory, storing the result in the user supplied\n<i>raster</i>. The raster is assumed to be an array of\n<i>width</i> times <i>height</i> 32-bit entries, where\n<i>width</i> must be less than or equal to the width of the\nimage (<i>height</i> may be any non-zero size). If the\nraster dimensions are smaller than the image, the image data\nis cropped to the raster bounds. If the raster height is\ngreater than that of the image, then the image data are\nplaced in the lower part of the raster. (Note that the\nraster is assume to be organized such that the pixel at\nlocation (<i>x</i>,<i>y</i>) is\n<i>raster</i>[<i>y</i>*<i>width</i>+<i>x</i>]; with the\nraster origin in the lower-left hand corner.)</p>\n<!-- INDENTATION -->\n<p><i>TIFFReadRGBAImageOriented</i> works like\n<i>TIFFReadRGBAImage</i> with except of that user can\nspecify the raster origin position with the\n<i>orientation</i> parameter. Four orientations\nsupported:</p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>ORIENTATION_TOPLEFT</b></p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"19%\"></td>\n<td width=\"80%\">\n<p>origin in top-left corner,</p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>ORIENTATION_TOPRIGHT</b></p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"19%\"></td>\n<td width=\"80%\">\n<p>origin in top-right corner,</p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>ORIENTATION_BOTLEFT</b></p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"19%\"></td>\n<td width=\"80%\">\n<p>origin in bottom-left corner and</p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>ORIENTATION_BOTRIGHT</b></p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"19%\"></td>\n<td width=\"80%\">\n<p>origin in bottom-right corner.</p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>If you choose <b>ORIENTATION_BOTLEFT</b> result will be\nthe same as returned by the <i>TIFFReadRGBAImage.</i></p>\n<!-- INDENTATION -->\n<p>Raster pixels are 8-bit packed red, green, blue, alpha\nsamples. The macros <i>TIFFGetR</i>, <i>TIFFGetG</i>,\n<i>TIFFGetB</i>, and <i>TIFFGetA</i> should be used to\naccess individual samples. Images without Associated Alpha\nmatting information have a constant Alpha of 1.0 (255).</p>\n<!-- INDENTATION -->\n<p><i>TIFFReadRGBAImage</i> converts non-8-bit images by\nscaling sample values. Palette, grayscale, bilevel,\n<small>CMYK</small> , and YCbCr images are converted to\n<small>RGB</small> transparently. Raster pixels are returned\nuncorrected by any colorimetry information present in the\ndirectory.</p>\n<!-- INDENTATION -->\n<p>The paramater <i>stopOnError</i> specifies how to act if\nan error is encountered while reading the image. If\n<i>stopOnError</i> is non-zero, then an error will terminate\nthe operation; otherwise <i>TIFFReadRGBAImage</i> will\ncontinue processing data until all the possible data in the\nimage have been requested.</p>\n</td>\n</table>\n<a name=\"NOTES\"></a>\n<h2>NOTES</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>In C++ the <i>stopOnError</i> parameter defaults to\n0.</p>\n<!-- INDENTATION -->\n<p>Samples must be either 1, 2, 4, 8, or 16 bits.\nColorimetric samples/pixel must be either 1, 3, or 4 (i.e.\n<i>SamplesPerPixel</i> minus <i>ExtraSamples</i>).</p>\n<!-- INDENTATION -->\n<p>Palettte image colormaps that appear to be incorrectly\nwritten as 8-bit values are automatically scaled to\n16-bits.</p>\n<!-- INDENTATION -->\n<p><i>TIFFReadRGBAImage</i> is just a wrapper around the\nmore general <i>TIFFRGBAImage</i>(3TIFF) facilities.</p>\n</td>\n</table>\n<a name=\"RETURN VALUES\"></a>\n<h2>RETURN VALUES</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>1 is returned if the image was successfully read and\nconverted. Otherwise, 0 is returned if an error was\nencountered and <i>stopOnError</i> is zero.</p>\n</td>\n</table>\n<a name=\"DIAGNOSTICS\"></a>\n<h2>DIAGNOSTICS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>All error messages are directed to the\n<i>TIFFError</i>(3TIFF) routine.</p>\n<!-- INDENTATION -->\n<p><b>Sorry, can not handle %d-bit pictures</b>. The image\nhad <i>BitsPerSample</i> other than 1, 2, 4, 8, or 16.</p>\n<!-- INDENTATION -->\n<p><b>Sorry, can not handle %d-channel images</b>. The image\nhad <i>SamplesPerPixel</i> other than 1, 3, or 4.</p>\n<!-- INDENTATION -->\n<p><b>Missing needed &quot;PhotometricInterpretation&quot;\ntag</b>. The image did not have a tag that describes how to\ndisplay the data.</p>\n<!-- INDENTATION -->\n<p><b>No &quot;PhotometricInterpretation&quot; tag, assuming\nRGB</b>. The image was missing a tag that describes how to\ndisplay it, but because it has 3 or 4 samples/pixel, it is\nassumed to be <small>RGB.</small></p>\n<!-- INDENTATION -->\n<p><b>No &quot;PhotometricInterpretation&quot; tag, assuming\nmin-is-black</b>. The image was missing a tag that describes\nhow to display it, but because it has 1 sample/pixel, it is\nassumed to be a grayscale or bilevel image.</p>\n<!-- INDENTATION -->\n<p><b>No space for photometric conversion table</b>. There\nwas insufficient memory for a table used to convert image\nsamples to 8-bit <small>RGB.</small></p>\n<!-- INDENTATION -->\n<p><b>Missing required &quot;Colormap&quot; tag</b>. A\nPalette image did not have a required <i>Colormap</i>\ntag.</p>\n<!-- INDENTATION -->\n<p><b>No space for tile buffer</b>. There was insufficient\nmemory to allocate an i/o buffer.</p>\n<!-- INDENTATION -->\n<p><b>No space for strip buffer</b>. There was insufficient\nmemory to allocate an i/o buffer.</p>\n<!-- INDENTATION -->\n<p><b>Can not handle format</b>. The image has a format\n(combination of <i>BitsPerSample</i>,\n<i>SamplesPerPixel</i>, and\n<i>PhotometricInterpretation</i>) that\n<i>TIFFReadRGBAImage</i> can not handle.</p>\n<!-- INDENTATION -->\n<p><b>No space for B&amp;W mapping table</b>. There was\ninsufficient memory to allocate a table used to map\ngrayscale data to <small>RGB.</small></p>\n<!-- INDENTATION -->\n<p><b>No space for Palette mapping table</b>. There was\ninsufficient memory to allocate a table used to map data to\n8-bit <small>RGB.</small></p>\n</td>\n</table>\n<a name=\"SEE ALSO\"></a>\n<h2>SEE ALSO</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>TIFFOpen</b>(3TIFF), <b>TIFFRGBAImage</b>(3TIFF),\n<b>TIFFReadRGBAStrip</b>(3TIFF),\n<b>TIFFReadRGBATile</b>(3TIFF), <b>libtiff</b>(3TIFF)</p>\n<!-- INDENTATION -->\n<p>Libtiff library home page:\n<b>http://www.remotesensing.org/libtiff/</b></p>\n</td>\n</table>\n<hr>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/TIFFReadRGBAStrip.3tiff.html",
    "content": "<!-- Creator     : groff version 1.18.1 -->\n<!-- CreationDate: Fri Jul 13 17:43:16 2007 -->\n<html>\n<head>\n<meta name=\"generator\" content=\"groff -Thtml, see www.gnu.org\">\n<meta name=\"Content-Style\" content=\"text/css\">\n<title>TIFFReadRGBAStrip</title>\n</head>\n<body>\n\n<h1 align=center>TIFFReadRGBAStrip</h1>\n<a href=\"#NAME\">NAME</a><br>\n<a href=\"#SYNOPSIS\">SYNOPSIS</a><br>\n<a href=\"#DESCRIPTION\">DESCRIPTION</a><br>\n<a href=\"#NOTES\">NOTES</a><br>\n<a href=\"#RETURN VALUES\">RETURN VALUES</a><br>\n<a href=\"#DIAGNOSTICS\">DIAGNOSTICS</a><br>\n<a href=\"#SEE ALSO\">SEE ALSO</a><br>\n\n<hr>\n<a name=\"NAME\"></a>\n<h2>NAME</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>TIFFReadRGBAStrip &minus; read and decode an image strip\ninto a fixed-format raster</p>\n</td>\n</table>\n<a name=\"SYNOPSIS\"></a>\n<h2>SYNOPSIS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>#include &lt;tiffio.h&gt;</b></p>\n<!-- INDENTATION -->\n<p><b>#define TIFFGetR(abgr) ((abgr) &amp; 0xff)<br>\n#define TIFFGetG(abgr) (((abgr) &gt;&gt; 8) &amp; 0xff)<br>\n#define TIFFGetB(abgr) (((abgr) &gt;&gt; 16) &amp; 0xff)<br>\n#define TIFFGetA(abgr) (((abgr) &gt;&gt; 24) &amp;\n0xff)</b></p>\n<!-- INDENTATION -->\n<p><b>int TIFFReadRGBAStrip(TIFF *</b><i>tif</i><b>,\nuint32</b> <i>row</i><b>, uint32\n*</b><i>raster</i><b>)</b></p>\n</td>\n</table>\n<a name=\"DESCRIPTION\"></a>\n<h2>DESCRIPTION</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><i>TIFFReadRGBAStrip</i> reads a single strip of a\nstrip-based image into memory, storing the result in the\nuser supplied RGBA <i>raster</i>. The raster is assumed to\nbe an array of width times rowsperstrip 32-bit entries,\nwhere width is the width of the image (TIFFTAG_IMAGEWIDTH)\nand rowsperstrip is the maximum lines in a strip\n(TIFFTAG_ROWSPERSTRIP).</p>\n<!-- INDENTATION -->\n<p>The <i>row</i> value should be the row of the first row\nin the strip (strip * rowsperstrip, zero based).</p>\n<!-- INDENTATION -->\n<p>Note that the raster is assume to be organized such that\nthe pixel at location (<i>x</i>,<i>y</i>) is\n<i>raster</i>[<i>y</i>*<i>width</i>+<i>x</i>]; with the\nraster origin in the <i>lower-left hand corner</i> of the\nstrip. That is bottom to top organization. When reading a\npartial last strip in the file the last line of the image\nwill begin at the beginning of the buffer.</p>\n<!-- INDENTATION -->\n<p>Raster pixels are 8-bit packed red, green, blue, alpha\nsamples. The macros <i>TIFFGetR</i>, <i>TIFFGetG</i>,\n<i>TIFFGetB</i>, and <i>TIFFGetA</i> should be used to\naccess individual samples. Images without Associated Alpha\nmatting information have a constant Alpha of 1.0 (255).</p>\n<!-- INDENTATION -->\n<p>See the <i>TIFFRGBAImage</i>(3TIFF) page for more details\non how various image types are converted to RGBA values.</p>\n</td>\n</table>\n<a name=\"NOTES\"></a>\n<h2>NOTES</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>Samples must be either 1, 2, 4, 8, or 16 bits.\nColorimetric samples/pixel must be either 1, 3, or 4 (i.e.\n<i>SamplesPerPixel</i> minus <i>ExtraSamples</i>).</p>\n<!-- INDENTATION -->\n<p>Palette image colormaps that appear to be incorrectly\nwritten as 8-bit values are automatically scaled to\n16-bits.</p>\n<!-- INDENTATION -->\n<p><i>TIFFReadRGBAStrip</i> is just a wrapper around the\nmore general <i>TIFFRGBAImage</i>(3TIFF) facilities.\nIt&rsquo;s main advantage over the similar\n<i>TIFFReadRGBAImage()</i> function is that for large images\na single buffer capable of holding the whole image\ndoesn&rsquo;t need to be allocated, only enough for one\nstrip. The <i>TIFFReadRGBATile()</i> function does a similar\noperation for tiled images.</p>\n</td>\n</table>\n<a name=\"RETURN VALUES\"></a>\n<h2>RETURN VALUES</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>1 is returned if the image was successfully read and\nconverted. Otherwise, 0 is returned if an error was\nencountered.</p>\n</td>\n</table>\n<a name=\"DIAGNOSTICS\"></a>\n<h2>DIAGNOSTICS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>All error messages are directed to the\n<i>TIFFError</i>(3TIFF) routine.</p>\n<!-- INDENTATION -->\n<p><b>Sorry, can not handle %d-bit pictures</b>. The image\nhad <i>BitsPerSample</i> other than 1, 2, 4, 8, or 16.</p>\n<!-- INDENTATION -->\n<p><b>Sorry, can not handle %d-channel images</b>. The image\nhad <i>SamplesPerPixel</i> other than 1, 3, or 4.</p>\n<!-- INDENTATION -->\n<p><b>Missing needed &quot;PhotometricInterpretation&quot;\ntag</b>. The image did not have a tag that describes how to\ndisplay the data.</p>\n<!-- INDENTATION -->\n<p><b>No &quot;PhotometricInterpretation&quot; tag, assuming\nRGB</b>. The image was missing a tag that describes how to\ndisplay it, but because it has 3 or 4 samples/pixel, it is\nassumed to be <small>RGB.</small></p>\n<!-- INDENTATION -->\n<p><b>No &quot;PhotometricInterpretation&quot; tag, assuming\nmin-is-black</b>. The image was missing a tag that describes\nhow to display it, but because it has 1 sample/pixel, it is\nassumed to be a grayscale or bilevel image.</p>\n<!-- INDENTATION -->\n<p><b>No space for photometric conversion table</b>. There\nwas insufficient memory for a table used to convert image\nsamples to 8-bit <small>RGB.</small></p>\n<!-- INDENTATION -->\n<p><b>Missing required &quot;Colormap&quot; tag</b>. A\nPalette image did not have a required <i>Colormap</i>\ntag.</p>\n<!-- INDENTATION -->\n<p><b>No space for tile buffer</b>. There was insufficient\nmemory to allocate an i/o buffer.</p>\n<!-- INDENTATION -->\n<p><b>No space for strip buffer</b>. There was insufficient\nmemory to allocate an i/o buffer.</p>\n<!-- INDENTATION -->\n<p><b>Can not handle format</b>. The image has a format\n(combination of <i>BitsPerSample</i>,\n<i>SamplesPerPixel</i>, and\n<i>PhotometricInterpretation</i>) that\n<i>TIFFReadRGBAImage</i> can not handle.</p>\n<!-- INDENTATION -->\n<p><b>No space for B&amp;W mapping table</b>. There was\ninsufficient memory to allocate a table used to map\ngrayscale data to <small>RGB.</small></p>\n<!-- INDENTATION -->\n<p><b>No space for Palette mapping table</b>. There was\ninsufficient memory to allocate a table used to map data to\n8-bit <small>RGB.</small></p>\n</td>\n</table>\n<a name=\"SEE ALSO\"></a>\n<h2>SEE ALSO</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>TIFFOpen</b>(3TIFF), <b>TIFFRGBAImage</b>(3TIFF),\n<b>TIFFReadRGBAImage</b>(3TIFF),\n<b>TIFFReadRGBATile</b>(3TIFF), <b>libtiff</b>(3TIFF)</p>\n<!-- INDENTATION -->\n<p>Libtiff library home page:\n<b>http://www.remotesensing.org/libtiff/</b></p>\n</td>\n</table>\n<hr>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/TIFFReadRGBATile.3tiff.html",
    "content": "<!-- Creator     : groff version 1.18.1 -->\n<!-- CreationDate: Fri Jul 13 17:43:16 2007 -->\n<html>\n<head>\n<meta name=\"generator\" content=\"groff -Thtml, see www.gnu.org\">\n<meta name=\"Content-Style\" content=\"text/css\">\n<title>TIFFReadRGBATile</title>\n</head>\n<body>\n\n<h1 align=center>TIFFReadRGBATile</h1>\n<a href=\"#NAME\">NAME</a><br>\n<a href=\"#SYNOPSIS\">SYNOPSIS</a><br>\n<a href=\"#DESCRIPTION\">DESCRIPTION</a><br>\n<a href=\"#NOTES\">NOTES</a><br>\n<a href=\"#RETURN VALUES\">RETURN VALUES</a><br>\n<a href=\"#DIAGNOSTICS\">DIAGNOSTICS</a><br>\n<a href=\"#SEE ALSO\">SEE ALSO</a><br>\n\n<hr>\n<a name=\"NAME\"></a>\n<h2>NAME</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>TIFFReadRGBATile &minus; read and decode an image tile\ninto a fixed-format raster</p>\n</td>\n</table>\n<a name=\"SYNOPSIS\"></a>\n<h2>SYNOPSIS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>#include &lt;tiffio.h&gt;</b></p>\n</td>\n</table>\n<!-- TABS -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"5\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"-2%\">\n\n<p><b>#define TIFFGetR(abgr)</b></p>\n</td>\n<td width=\"25%\"></td>\n<td width=\"6%\"></td>\n<td width=\"61%\">\n\n<p><b>((abgr) &amp; 0xff)</b></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"-2%\">\n\n<p><b>#define TIFFGetG(abgr)</b></p>\n</td>\n<td width=\"25%\"></td>\n<td width=\"6%\"></td>\n<td width=\"61%\">\n\n<p><b>(((abgr) &gt;&gt; 8) &amp; 0xff)</b></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"-2%\">\n\n<p><b>#define TIFFGetB(abgr)</b></p>\n</td>\n<td width=\"25%\"></td>\n<td width=\"6%\"></td>\n<td width=\"61%\">\n\n<p><b>(((abgr) &gt;&gt; 16) &amp; 0xff)</b></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"-2%\">\n\n<p><b>#define TIFFGetA(abgr)</b></p>\n</td>\n<td width=\"25%\"></td>\n<td width=\"6%\"></td>\n<td width=\"61%\">\n\n<p><b>(((abgr) &gt;&gt; 24) &amp; 0xff)</b></p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>int TIFFReadRGBATile(TIFF *</b><i>tif</i><b>,\nuint32</b> <i>x</i><b>, uint32</b> <i>y</i><b>, uint32\n*</b><i>raster</i><b>)</b></p>\n</td>\n</table>\n<a name=\"DESCRIPTION\"></a>\n<h2>DESCRIPTION</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><i>TIFFReadRGBATile</i> reads a single tile of a\ntile-based image into memory, storing the result in the user\nsupplied RGBA <i>raster</i>. The raster is assumed to be an\narray of width times length 32-bit entries, where width is\nthe width of a tile (TIFFTAG_TILEWIDTH) and length is the\nheight of a tile (TIFFTAG_TILELENGTH).</p>\n<!-- INDENTATION -->\n<p>The <i>x</i> and <i>y</i> values are the offsets from the\ntop left corner to the top left corner of the tile to be\nread. They must be an exact multiple of the tile width and\nlength.</p>\n<!-- INDENTATION -->\n<p>Note that the raster is assume to be organized such that\nthe pixel at location (<i>x</i>,<i>y</i>) is\n<i>raster</i>[<i>y</i>*<i>width</i>+<i>x</i>]; with the\nraster origin in the <i>lower-left hand corner</i> of the\ntile. That is bottom to top organization. Edge tiles which\npartly fall off the image will be filled out with\nappropriate zeroed areas.</p>\n<!-- INDENTATION -->\n<p>Raster pixels are 8-bit packed red, green, blue, alpha\nsamples. The macros <i>TIFFGetR</i>, <i>TIFFGetG</i>,\n<i>TIFFGetB</i>, and <i>TIFFGetA</i> should be used to\naccess individual samples. Images without Associated Alpha\nmatting information have a constant Alpha of 1.0 (255).</p>\n<!-- INDENTATION -->\n<p>See the <i>TIFFRGBAImage</i>(3TIFF) page for more details\non how various image types are converted to RGBA values.</p>\n</td>\n</table>\n<a name=\"NOTES\"></a>\n<h2>NOTES</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>Samples must be either 1, 2, 4, 8, or 16 bits.\nColorimetric samples/pixel must be either 1, 3, or 4 (i.e.\n<i>SamplesPerPixel</i> minus <i>ExtraSamples</i>).</p>\n<!-- INDENTATION -->\n<p>Palette image colormaps that appear to be incorrectly\nwritten as 8-bit values are automatically scaled to\n16-bits.</p>\n<!-- INDENTATION -->\n<p><i>TIFFReadRGBATile</i> is just a wrapper around the more\ngeneral <i>TIFFRGBAImage</i>(3TIFF) facilities. It&rsquo;s\nmain advantage over the similar <i>TIFFReadRGBAImage()</i>\nfunction is that for large images a single buffer capable of\nholding the whole image doesn&rsquo;t need to be allocated,\nonly enough for one tile. The <i>TIFFReadRGBAStrip()</i>\nfunction does a similar operation for stripped images.</p>\n</td>\n</table>\n<a name=\"RETURN VALUES\"></a>\n<h2>RETURN VALUES</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>1 is returned if the image was successfully read and\nconverted. Otherwise, 0 is returned if an error was\nencountered.</p>\n</td>\n</table>\n<a name=\"DIAGNOSTICS\"></a>\n<h2>DIAGNOSTICS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>All error messages are directed to the\n<i>TIFFError</i>(3TIFF) routine.</p>\n<!-- INDENTATION -->\n<p><b>Sorry, can not handle %d-bit pictures</b>. The image\nhad <i>BitsPerSample</i> other than 1, 2, 4, 8, or 16.</p>\n<!-- INDENTATION -->\n<p><b>Sorry, can not handle %d-channel images</b>. The image\nhad <i>SamplesPerPixel</i> other than 1, 3, or 4.</p>\n<!-- INDENTATION -->\n<p><b>Missing needed &quot;PhotometricInterpretation&quot;\ntag</b>. The image did not have a tag that describes how to\ndisplay the data.</p>\n<!-- INDENTATION -->\n<p><b>No &quot;PhotometricInterpretation&quot; tag, assuming\nRGB</b>. The image was missing a tag that describes how to\ndisplay it, but because it has 3 or 4 samples/pixel, it is\nassumed to be <small>RGB.</small></p>\n<!-- INDENTATION -->\n<p><b>No &quot;PhotometricInterpretation&quot; tag, assuming\nmin-is-black</b>. The image was missing a tag that describes\nhow to display it, but because it has 1 sample/pixel, it is\nassumed to be a grayscale or bilevel image.</p>\n<!-- INDENTATION -->\n<p><b>No space for photometric conversion table</b>. There\nwas insufficient memory for a table used to convert image\nsamples to 8-bit <small>RGB.</small></p>\n<!-- INDENTATION -->\n<p><b>Missing required &quot;Colormap&quot; tag</b>. A\nPalette image did not have a required <i>Colormap</i>\ntag.</p>\n<!-- INDENTATION -->\n<p><b>No space for tile buffer</b>. There was insufficient\nmemory to allocate an i/o buffer.</p>\n<!-- INDENTATION -->\n<p><b>No space for strip buffer</b>. There was insufficient\nmemory to allocate an i/o buffer.</p>\n<!-- INDENTATION -->\n<p><b>Can not handle format</b>. The image has a format\n(combination of <i>BitsPerSample</i>,\n<i>SamplesPerPixel</i>, and\n<i>PhotometricInterpretation</i>) that\n<i>TIFFReadRGBAImage</i> can not handle.</p>\n<!-- INDENTATION -->\n<p><b>No space for B&amp;W mapping table</b>. There was\ninsufficient memory to allocate a table used to map\ngrayscale data to <small>RGB.</small></p>\n<!-- INDENTATION -->\n<p><b>No space for Palette mapping table</b>. There was\ninsufficient memory to allocate a table used to map data to\n8-bit <small>RGB.</small></p>\n</td>\n</table>\n<a name=\"SEE ALSO\"></a>\n<h2>SEE ALSO</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>TIFFOpen</b>(3TIFF), <b>TIFFRGBAImage</b>(3TIFF),\n<b>TIFFReadRGBAImage</b>(3TIFF),\n<b>TIFFReadRGBAStrip</b>(3TIFF), <b>libtiff</b>(3TIFF)</p>\n<!-- INDENTATION -->\n<p>Libtiff library home page:\n<b>http://www.remotesensing.org/libtiff/</b></p>\n</td>\n</table>\n<hr>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/TIFFReadRawStrip.3tiff.html",
    "content": "<!-- Creator     : groff version 1.18.1 -->\n<!-- CreationDate: Fri Jul 13 17:43:16 2007 -->\n<html>\n<head>\n<meta name=\"generator\" content=\"groff -Thtml, see www.gnu.org\">\n<meta name=\"Content-Style\" content=\"text/css\">\n<title>TIFFReadRawStrip</title>\n</head>\n<body>\n\n<h1 align=center>TIFFReadRawStrip</h1>\n<a href=\"#NAME\">NAME</a><br>\n<a href=\"#SYNOPSIS\">SYNOPSIS</a><br>\n<a href=\"#DESCRIPTION\">DESCRIPTION</a><br>\n<a href=\"#RETURN VALUES\">RETURN VALUES</a><br>\n<a href=\"#DIAGNOSTICS\">DIAGNOSTICS</a><br>\n<a href=\"#SEE ALSO\">SEE ALSO</a><br>\n\n<hr>\n<a name=\"NAME\"></a>\n<h2>NAME</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>TIFFReadRawStrip &minus; return the undecoded contents of\na strip of data from an open <small>TIFF</small> file</p>\n</td>\n</table>\n<a name=\"SYNOPSIS\"></a>\n<h2>SYNOPSIS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>#include &lt;tiffio.h&gt;</b></p>\n<!-- INDENTATION -->\n<p><b>tsize_t TIFFReadRawStrip(TIFF *</b><i>tif</i><b>,\ntstrip_t</b> <i>strip</i><b>, tdata_t</b> <i>buf</i><b>,\ntsize_t</b> <i>size</i><b>)</b></p>\n</td>\n</table>\n<a name=\"DESCRIPTION\"></a>\n<h2>DESCRIPTION</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>Read the contents of the specified strip into the (user\nsupplied) data buffer. Note that the value of <i>strip</i>\nis a &lsquo;&lsquo;raw strip number.&rsquo;&rsquo; That is,\nthe caller must take into account whether or not the data is\norganized in separate planes (<i>PlanarConfiguration</i>=2).\nTo read a full strip of data the data buffer should\ntypically be at least as large as the number returned by\n<i>TIFFStripSize</i>.</p>\n</td>\n</table>\n<a name=\"RETURN VALUES\"></a>\n<h2>RETURN VALUES</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>The actual number of bytes of data that were placed in\n<i>buf</i> is returned; <i>TIFFReadEncodedStrip</i> returns\n&minus;1 if an error was encountered.</p>\n</td>\n</table>\n<a name=\"DIAGNOSTICS\"></a>\n<h2>DIAGNOSTICS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>All error messages are directed to the\n<b>TIFFError</b>(3TIFF) routine.</p>\n</td>\n</table>\n<a name=\"SEE ALSO\"></a>\n<h2>SEE ALSO</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>TIFFOpen</b>(3TIFF),\n<b>TIFFReadEncodedStrip</b>(3TIFF),\n<b>TIFFReadScanline</b>(3TIFF), <b>TIFFStripSize</b>(3TIFF),\n<b>libtiff</b>(3TIFF)</p>\n<!-- INDENTATION -->\n<p>Libtiff library home page:\n<b>http://www.remotesensing.org/libtiff/</b></p>\n</td>\n</table>\n<hr>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/TIFFReadRawTile.3tiff.html",
    "content": "<!-- Creator     : groff version 1.18.1 -->\n<!-- CreationDate: Fri Jul 13 17:43:16 2007 -->\n<html>\n<head>\n<meta name=\"generator\" content=\"groff -Thtml, see www.gnu.org\">\n<meta name=\"Content-Style\" content=\"text/css\">\n<title>TIFFReadRawTile</title>\n</head>\n<body>\n\n<h1 align=center>TIFFReadRawTile</h1>\n<a href=\"#NAME\">NAME</a><br>\n<a href=\"#SYNOPSIS\">SYNOPSIS</a><br>\n<a href=\"#DESCRIPTION\">DESCRIPTION</a><br>\n<a href=\"#RETURN VALUES\">RETURN VALUES</a><br>\n<a href=\"#DIAGNOSTICS\">DIAGNOSTICS</a><br>\n<a href=\"#SEE ALSO\">SEE ALSO</a><br>\n\n<hr>\n<a name=\"NAME\"></a>\n<h2>NAME</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>TIFFReadRawTile &minus; return an undecoded tile of data\nfrom an open <small>TIFF</small> file</p>\n</td>\n</table>\n<a name=\"SYNOPSIS\"></a>\n<h2>SYNOPSIS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>#include &lt;tiffio.h&gt;</b></p>\n<!-- INDENTATION -->\n<p><b>tsize_t TIFFReadRawTile(TIFF *</b><i>tif</i><b>,\nttile_t</b> <i>tile</i><b>, tdata_t</b> <i>buf</i><b>,\ntsize_t</b> <i>size</i><b>)</b></p>\n</td>\n</table>\n<a name=\"DESCRIPTION\"></a>\n<h2>DESCRIPTION</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>Read the contents of the specified tile into the (user\nsupplied) data buffer. Note that the value of <i>tile</i> is\na &lsquo;&lsquo;raw tile number.&rsquo;&rsquo; That is, the\ncaller must take into account whether or not the data is\norganized in separate planes (<i>PlanarConfiguration</i>=2).\n<i>TIFFComputeTile</i> automatically does this when\nconverting an (x,y,z,sample) coordinate quadruple to a tile\nnumber. To read a full tile of data the data buffer should\ntypically be at least as large as the value returned by\n<i>TIFFTileSize</i>.</p>\n</td>\n</table>\n<a name=\"RETURN VALUES\"></a>\n<h2>RETURN VALUES</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>The actual number of bytes of data that were placed in\n<i>buf</i> is returned; <i>TIFFReadEncodedTile</i> returns\n&minus;1 if an error was encountered.</p>\n</td>\n</table>\n<a name=\"DIAGNOSTICS\"></a>\n<h2>DIAGNOSTICS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>All error messages are directed to the\n<b>TIFFError</b>(3TIFF) routine.</p>\n</td>\n</table>\n<a name=\"SEE ALSO\"></a>\n<h2>SEE ALSO</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>TIFFOpen</b>(3TIFF),\n<b>TIFFReadEncodedTile</b>(3TIFF),\n<b>TIFFReadTile</b>(3TIFF), <b>TIFFTileSize</b>(3TIFF),\n<b>libtiff</b>(3TIFF)</p>\n<!-- INDENTATION -->\n<p>Libtiff library home page:\n<b>http://www.remotesensing.org/libtiff/</b></p>\n</td>\n</table>\n<hr>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/TIFFReadScanline.3tiff.html",
    "content": "<!-- Creator     : groff version 1.18.1 -->\n<!-- CreationDate: Fri Jul 13 17:43:16 2007 -->\n<html>\n<head>\n<meta name=\"generator\" content=\"groff -Thtml, see www.gnu.org\">\n<meta name=\"Content-Style\" content=\"text/css\">\n<title>TIFFReadScanline</title>\n</head>\n<body>\n\n<h1 align=center>TIFFReadScanline</h1>\n<a href=\"#NAME\">NAME</a><br>\n<a href=\"#SYNOPSIS\">SYNOPSIS</a><br>\n<a href=\"#DESCRIPTION\">DESCRIPTION</a><br>\n<a href=\"#NOTES\">NOTES</a><br>\n<a href=\"#RETURN VALUES\">RETURN VALUES</a><br>\n<a href=\"#DIAGNOSTICS\">DIAGNOSTICS</a><br>\n<a href=\"#BUGS\">BUGS</a><br>\n<a href=\"#SEE ALSO\">SEE ALSO</a><br>\n\n<hr>\n<a name=\"NAME\"></a>\n<h2>NAME</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>TIFFReadScanline &minus; read and decode a scanline of\ndata from an open <small>TIFF</small> file</p>\n</td>\n</table>\n<a name=\"SYNOPSIS\"></a>\n<h2>SYNOPSIS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>#include &lt;tiffio.h&gt;</b></p>\n<!-- INDENTATION -->\n<p><b>int TIFFReadScanline(TIFF *</b><i>tif</i><b>,\ntdata_t</b> <i>buf</i><b>, uint32</b> <i>row</i><b>,\ntsample_t</b> <i>sample</i><b>)</b></p>\n</td>\n</table>\n<a name=\"DESCRIPTION\"></a>\n<h2>DESCRIPTION</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>Read the data for the specified row into the (user\nsupplied) data buffer <i>buf</i>. The data are returned\ndecompressed and, in the native byte- and bit-ordering, but\nare otherwise packed (see further below). The buffer must be\nlarge enough to hold an entire scanline of data.\nApplications should call the routine <i>TIFFScanlineSize</i>\nto find out the size (in bytes) of a scanline buffer. The\n<i>row</i> parameter is always used by\n<i>TIFFReadScanline</i>; the <i>sample</i> parameter is used\nonly if data are organized in separate planes\n(<i>PlanarConfiguration</i>=2).</p>\n</td>\n</table>\n<a name=\"NOTES\"></a>\n<h2>NOTES</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>The library attempts to hide bit- and byte-ordering\ndifferences between the image and the native machine by\nconverting data to the native machine order. Bit reversal is\ndone if the <i>FillOrder</i> tag is opposite to the native\nmachine bit order. 16- and 32-bit samples are automatically\nbyte-swapped if the file was written with a byte order\nopposite to the native machine byte order,</p>\n<!-- INDENTATION -->\n<p>In C++ the <i>sample</i> parameter defaults to 0.</p>\n</td>\n</table>\n<a name=\"RETURN VALUES\"></a>\n<h2>RETURN VALUES</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><i>TIFFReadScanline</i> returns &minus;1 if it detects an\nerror; otherwise 1 is returned.</p>\n</td>\n</table>\n<a name=\"DIAGNOSTICS\"></a>\n<h2>DIAGNOSTICS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>All error messages are directed to the\n<i>TIFFError</i>(3TIFF) routine.</p>\n<!-- INDENTATION -->\n<p><b>Compression algorithm does not support random\naccess</b>. Data was requested in a non-sequential order\nfrom a file that uses a compression algorithm and that has\n<i>RowsPerStrip</i> greater than one. That is, data in the\nimage is stored in a compressed form, and with multiple rows\npacked into a strip. In this case, the library does not\nsupport random access to the data. The data should either be\naccessed sequentially, or the file should be converted so\nthat each strip is made up of one row of data.</p>\n</td>\n</table>\n<a name=\"BUGS\"></a>\n<h2>BUGS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>Reading subsampled YCbCR data does not work correctly\nbecause, for <i>PlanarConfiguration</i>=2 the size of a\nscanline is not calculated on a per-sample basis, and for\n<i>PlanarConfiguration</i>=1 the library does not unpack the\nblock-interleaved samples; use the strip- and tile-based\ninterfaces to read these formats.</p>\n</td>\n</table>\n<a name=\"SEE ALSO\"></a>\n<h2>SEE ALSO</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>TIFFOpen</b>(3TIFF),\n<b>TIFFReadEncodedStrip</b>(3TIFF),\n<b>TIFFReadRawStrip</b>(3TIFF), <b>libtiff</b>(3TIFF)</p>\n<!-- INDENTATION -->\n<p>Libtiff library home page:\n<b>http://www.remotesensing.org/libtiff/</b></p>\n</td>\n</table>\n<hr>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/TIFFReadTile.3tiff.html",
    "content": "<!-- Creator     : groff version 1.18.1 -->\n<!-- CreationDate: Fri Jul 13 17:43:16 2007 -->\n<html>\n<head>\n<meta name=\"generator\" content=\"groff -Thtml, see www.gnu.org\">\n<meta name=\"Content-Style\" content=\"text/css\">\n<title>TIFFReadTile</title>\n</head>\n<body>\n\n<h1 align=center>TIFFReadTile</h1>\n<a href=\"#NAME\">NAME</a><br>\n<a href=\"#SYNOPSIS\">SYNOPSIS</a><br>\n<a href=\"#DESCRIPTION\">DESCRIPTION</a><br>\n<a href=\"#NOTES\">NOTES</a><br>\n<a href=\"#RETURN VALUES\">RETURN VALUES</a><br>\n<a href=\"#DIAGNOSTICS\">DIAGNOSTICS</a><br>\n<a href=\"#SEE ALSO\">SEE ALSO</a><br>\n\n<hr>\n<a name=\"NAME\"></a>\n<h2>NAME</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>TIFFReadTile &minus; read and decode a tile of data from\nan open <small>TIFF</small> file</p>\n</td>\n</table>\n<a name=\"SYNOPSIS\"></a>\n<h2>SYNOPSIS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>#include &lt;tiffio.h&gt;</b></p>\n<!-- INDENTATION -->\n<p><b>tsize_t TIFFReadTile(TIFF *</b><i>tif</i><b>,\ntdata_t</b> <i>buf</i><b>, uint32</b> <i>x</i><b>,\nuint32</b> <i>y</i><b>, uint32</b> <i>z</i><b>,\ntsample_t</b> <i>sample</i><b>)</b></p>\n</td>\n</table>\n<a name=\"DESCRIPTION\"></a>\n<h2>DESCRIPTION</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>Return the data for the tile <i>containing</i> the\nspecified coordinates. The data placed in <i>buf</i> are\nreturned decompressed and, typically, in the native byte-\nand bit-ordering, but are otherwise packed (see further\nbelow). The buffer must be large enough to hold an entire\ntile of data. Applications should call the routine\n<i>TIFFTileSize</i> to find out the size (in bytes) of a\ntile buffer. The <i>x</i> and <i>y</i> parameters are always\nused by <i>TIFFReadTile</i>. The <i>z</i> parameter is used\nif the image is deeper than 1 slice\n(<i>ImageDepth</i>&gt;1). The <i>sample</i> parameter is\nused only if data are organized in separate planes\n(<i>PlanarConfiguration</i>=2).</p>\n</td>\n</table>\n<a name=\"NOTES\"></a>\n<h2>NOTES</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>The library attempts to hide bit- and byte-ordering\ndifferences between the image and the native machine by\nconverting data to the native machine order. Bit reversal is\ndone if the <i>FillOrder</i> tag is opposite to the native\nmachine bit order. 16- and 32-bit samples are automatically\nbyte-swapped if the file was written with a byte order\nopposite to the native machine byte order,</p>\n</td>\n</table>\n<a name=\"RETURN VALUES\"></a>\n<h2>RETURN VALUES</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><i>TIFFReadTile</i> returns &minus;1 if it detects an\nerror; otherwise the number of bytes in the decoded tile is\nreturned.</p>\n</td>\n</table>\n<a name=\"DIAGNOSTICS\"></a>\n<h2>DIAGNOSTICS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>All error messages are directed to the\n<b>TIFFError</b>(3TIFF) routine.</p>\n</td>\n</table>\n<a name=\"SEE ALSO\"></a>\n<h2>SEE ALSO</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>TIFFCheckTile</b>(3TIFF),\n<b>TIFFComputeTile</b>(3TIFF), <b>TIFFOpen</b>(3TIFF),\n<b>TIFFReadEncodedTile</b>(3TIFF),\n<b>TIFFReadRawTile</b>(3TIFF), <b>libtiff</b>(3TIFF)</p>\n<!-- INDENTATION -->\n<p>Libtiff library home page:\n<b>http://www.remotesensing.org/libtiff/</b></p>\n</td>\n</table>\n<hr>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/TIFFSetDirectory.3tiff.html",
    "content": "<!-- Creator     : groff version 1.18.1 -->\n<!-- CreationDate: Fri Jul 13 17:43:17 2007 -->\n<html>\n<head>\n<meta name=\"generator\" content=\"groff -Thtml, see www.gnu.org\">\n<meta name=\"Content-Style\" content=\"text/css\">\n<title>TIFFSetDirectory</title>\n</head>\n<body>\n\n<h1 align=center>TIFFSetDirectory</h1>\n<a href=\"#NAME\">NAME</a><br>\n<a href=\"#SYNOPSIS\">SYNOPSIS</a><br>\n<a href=\"#DESCRIPTION\">DESCRIPTION</a><br>\n<a href=\"#RETURN VALUES\">RETURN VALUES</a><br>\n<a href=\"#DIAGNOSTICS\">DIAGNOSTICS</a><br>\n<a href=\"#SEE ALSO\">SEE ALSO</a><br>\n\n<hr>\n<a name=\"NAME\"></a>\n<h2>NAME</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>TIFFSetDirectory, TIFFSetSubDirectory &minus; set the\ncurrent directory for an open <small>TIFF</small> file</p>\n</td>\n</table>\n<a name=\"SYNOPSIS\"></a>\n<h2>SYNOPSIS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>#include &lt;tiffio.h&gt;</b></p>\n<!-- INDENTATION -->\n<p><b>int TIFFSetDirectory(TIFF *</b><i>tif</i><b>,\ntdir_t</b> <i>dirnum</i><b>)<br>\nint TIFFSetSubDirectory(TIFF *</b><i>tif</i><b>, uint32</b>\n<i>diroff</i><b>)</b></p>\n</td>\n</table>\n<a name=\"DESCRIPTION\"></a>\n<h2>DESCRIPTION</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><i>TIFFSetDirectory</i> changes the current directory and\nreads its contents with <i>TIFFReadDirectory</i>. The\nparameter <i>dirnum</i> specifies the subfile/directory as\nan integer number, with the first directory numbered\nzero.</p>\n<!-- INDENTATION -->\n<p><i>TIFFSetSubDirectory</i> acts like\n<i>TIFFSetDirectory</i>, except the directory is specified\nas a file offset instead of an index; this is required for\naccessing subdirectories linked through a <i>SubIFD</i>\ntag.</p>\n</td>\n</table>\n<a name=\"RETURN VALUES\"></a>\n<h2>RETURN VALUES</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>On successful return 1 is returned. Otherwise, 0 is\nreturned if <i>dirnum</i> or <i>diroff</i> specifies a\nnon-existent directory, or if an error was encountered while\nreading the directory&rsquo;s contents.</p>\n</td>\n</table>\n<a name=\"DIAGNOSTICS\"></a>\n<h2>DIAGNOSTICS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>All error messages are directed to the\n<i>TIFFError</i>(3TIFF) routine.</p>\n<!-- INDENTATION -->\n<p><b>%s: Error fetching directory count</b>. An error was\nencountered while reading the &lsquo;&lsquo;directory\ncount&rsquo;&rsquo; field.</p>\n<!-- INDENTATION -->\n<p><b>%s: Error fetching directory link</b>. An error was\nencountered while reading the &lsquo;&lsquo;link\nvalue&rsquo;&rsquo; that points to the next directory in a\nfile.</p>\n</td>\n</table>\n<a name=\"SEE ALSO\"></a>\n<h2>SEE ALSO</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><i>TIFFCurrentDirectory</i>(3TIFF),\n<i>TIFFOpen</i>(3TIFF), <i>TIFFReadDirectory</i>(3TIFF),\n<i>TIFFWriteDirectory</i>(3TIFF), <i>libtiff</i>(3TIFF)</p>\n<!-- INDENTATION -->\n<p>Libtiff library home page:\n<b>http://www.remotesensing.org/libtiff/</b></p>\n</td>\n</table>\n<hr>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/TIFFSetField.3tiff.html",
    "content": "<!-- Creator     : groff version 1.18.1 -->\n<!-- CreationDate: Fri Jul 13 17:43:17 2007 -->\n<html>\n<head>\n<meta name=\"generator\" content=\"groff -Thtml, see www.gnu.org\">\n<meta name=\"Content-Style\" content=\"text/css\">\n<title>TIFFSetField</title>\n</head>\n<body>\n\n<h1 align=center>TIFFSetField</h1>\n<a href=\"#NAME\">NAME</a><br>\n<a href=\"#SYNOPSIS\">SYNOPSIS</a><br>\n<a href=\"#DESCRIPTION\">DESCRIPTION</a><br>\n<a href=\"#RETURN VALUES\">RETURN VALUES</a><br>\n<a href=\"#DIAGNOSTICS\">DIAGNOSTICS</a><br>\n<a href=\"#SEE ALSO\">SEE ALSO</a><br>\n\n<hr>\n<a name=\"NAME\"></a>\n<h2>NAME</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>TIFFSetField, TIFFVSetField &minus; set the value(s) of a\ntag in a <small>TIFF</small> file open for writing</p>\n</td>\n</table>\n<a name=\"SYNOPSIS\"></a>\n<h2>SYNOPSIS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>#include &lt;tiffio.h&gt;</b></p>\n<!-- INDENTATION -->\n<p><b>int TIFFSetField(TIFF *</b><i>tif</i><b>, ttag_t</b>\n<i>tag</i><b>,</b> <i>...</i><b>)</b></p>\n<!-- INDENTATION -->\n<p><b>#include &lt;stdarg.h&gt;</b></p>\n<!-- INDENTATION -->\n<p><b>int TIFFVSetField(TIFF *</b><i>tif</i><b>, ttag_t</b>\n<i>tag</i><b>, va_list</b> <i>ap</i><b>)</b></p>\n</td>\n</table>\n<a name=\"DESCRIPTION\"></a>\n<h2>DESCRIPTION</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><i>TIFFSetField</i> sets the value of a field or\npseudo-tag in the current directory associated with the open\n<small>TIFF</small> file <i>tif</i>. (A <i>pseudo-tag</i> is\na parameter that is used to control the operation of the\n<small>TIFF</small> library but whose value is not read or\nwritten to the underlying file.) To set the value of a field\nthe file must have been previously opened for writing with\n<i>TIFFOpen</i>(3TIFF); pseudo-tags can be set whether the\nfile was opened for reading or writing. The field is\nidentified by <i>tag</i>, one of the values defined in the\ninclude file <b>tiff.h</b> (see also the table below). The\nactual value is specified using a variable argument list, as\nprescribed by the <i>stdarg</i>(3) interface (or, on some\nmachines, the <i>varargs</i>(3) interface.)</p>\n<!-- INDENTATION -->\n<p><i>TIFFVSetField</i> is functionally equivalent to\n<i>TIFFSetField</i> except that it takes a pointer to a\nvariable argument list. <i>TIFFVSetField</i> is useful for\nwriting routines that are layered on top of the\nfunctionality provided by <i>TIFFSetField</i>.</p>\n<!-- INDENTATION -->\n<p>The tags understood by <i>libtiff</i>, the number of\nparameter values, and the expected types for the parameter\nvalues are shown below. The data types are: <i>char*</i> is\nnull-terminated string and corresponds to the\n<small>ASCII</small> data type; <i>uint16</i> is an unsigned\n16-bit value; <i>uint32</i> is an unsigned 32-bit value;\n<i>uint16*</i> is an array of unsigned 16-bit values.\n<i>void*</i> is an array of data values of unspecified\ntype.</p>\n<!-- INDENTATION -->\n<p>Consult the <small>TIFF</small> specification for\ninformation on the meaning of each tag.</p></td>\n</table>\n<!-- TABS -->\n\n<p><i>Tag Name Count Types Notes</i></p>\n<!-- TABS -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"5\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_ARTIST</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"24%\">\n\n<p>char*</p>\n</td>\n<td width=\"16%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_BADFAXLINES</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"24%\">\n\n<p>uint32</p>\n</td>\n<td width=\"16%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_BITSPERSAMPLE</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"24%\">\n\n<p>uint16</p>\n</td>\n<td width=\"16%\">\n\n<p>&dagger;</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_CLEANFAXDATA</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"24%\">\n\n<p>uint16</p>\n</td>\n<td width=\"16%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_COLORMAP</p>\n</td>\n<td width=\"8%\">\n\n<p>3</p>\n</td>\n<td width=\"24%\">\n\n<p>uint16*</p>\n</td>\n<td width=\"16%\">\n\n<p>1&lt;&lt;BitsPerSample arrays</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_COMPRESSION</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"24%\">\n\n<p>uint16</p>\n</td>\n<td width=\"16%\">\n\n<p>&dagger;</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_CONSECUTIVEBADFAXLINES</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"24%\">\n\n<p>uint32</p>\n</td>\n<td width=\"16%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_COPYRIGHT</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"24%\">\n\n<p>char*</p>\n</td>\n<td width=\"16%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_DATETIME</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"24%\">\n\n<p>char*</p>\n</td>\n<td width=\"16%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_DOCUMENTNAME</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"24%\">\n\n<p>char*</p>\n</td>\n<td width=\"16%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_DOTRANGE</p>\n</td>\n<td width=\"8%\">\n\n<p>2</p>\n</td>\n<td width=\"24%\">\n\n<p>uint16</p>\n</td>\n<td width=\"16%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_EXTRASAMPLES</p>\n</td>\n<td width=\"8%\">\n\n<p>2</p>\n</td>\n<td width=\"24%\">\n\n<p>uint16,uint16*</p>\n</td>\n<td width=\"16%\">\n\n<p>&dagger; count &amp; types array</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_FAXFILLFUNC</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"24%\">\n\n<p>TIFFFaxFillFunc</p>\n</td>\n<td width=\"16%\">\n\n<p>G3/G4 compression pseudo-tag</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_FAXMODE</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"24%\">\n\n<p>int</p>\n</td>\n<td width=\"16%\">\n\n<p>&dagger; G3/G4 compression pseudo-tag</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_FILLORDER</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"24%\">\n\n<p>uint16</p>\n</td>\n<td width=\"16%\">\n\n<p>&dagger;</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_GROUP3OPTIONS</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"24%\">\n\n<p>uint32</p>\n</td>\n<td width=\"16%\">\n\n<p>&dagger;</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_GROUP4OPTIONS</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"24%\">\n\n<p>uint32</p>\n</td>\n<td width=\"16%\">\n\n<p>&dagger;</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_HALFTONEHINTS</p>\n</td>\n<td width=\"8%\">\n\n<p>2</p>\n</td>\n<td width=\"24%\">\n\n<p>uint16</p>\n</td>\n<td width=\"16%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_HOSTCOMPUTER</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"24%\">\n\n<p>char*</p>\n</td>\n<td width=\"16%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_ICCPROFILE</p>\n</td>\n<td width=\"8%\">\n\n<p>2</p>\n</td>\n<td width=\"24%\">\n\n<p>uint32,void*</p>\n</td>\n<td width=\"16%\">\n\n<p>count, profile data</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_IMAGEDEPTH</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"24%\">\n\n<p>uint32</p>\n</td>\n<td width=\"16%\">\n\n<p>&dagger;</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_IMAGEDESCRIPTION</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"24%\">\n\n<p>char*</p>\n</td>\n<td width=\"16%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_IMAGELENGTH</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"24%\">\n\n<p>uint32</p>\n</td>\n<td width=\"16%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_IMAGEWIDTH</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"24%\">\n\n<p>uint32</p>\n</td>\n<td width=\"16%\">\n\n<p>&dagger;</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_INKNAMES</p>\n</td>\n<td width=\"8%\">\n\n<p>2</p>\n</td>\n<td width=\"24%\">\n\n<p>uint16, char*</p>\n</td>\n<td width=\"16%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_INKSET</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"24%\">\n\n<p>uint16</p>\n</td>\n<td width=\"16%\">\n\n<p>&dagger;</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_JPEGCOLORMODE</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"24%\">\n\n<p>int</p>\n</td>\n<td width=\"16%\">\n\n<p>&dagger; JPEG pseudo-tag</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_JPEGQUALITY</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"24%\">\n\n<p>int</p>\n</td>\n<td width=\"16%\">\n\n<p>JPEG pseudo-tag</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_JPEGTABLES</p>\n</td>\n<td width=\"8%\">\n\n<p>2</p>\n</td>\n<td width=\"24%\">\n\n<p>uint32*,void*</p>\n</td>\n<td width=\"16%\">\n\n<p>&dagger; count &amp; tables</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_JPEGTABLESMODE</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"24%\">\n\n<p>int</p>\n</td>\n<td width=\"16%\">\n\n<p>&dagger; JPEG pseudo-tag</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_MAKE</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"24%\">\n\n<p>char*</p>\n</td>\n<td width=\"16%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_MATTEING</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"24%\">\n\n<p>uint16</p>\n</td>\n<td width=\"16%\">\n\n<p>&dagger;</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_MAXSAMPLEVALUE</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"24%\">\n\n<p>uint16</p>\n</td>\n<td width=\"16%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_MINSAMPLEVALUE</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"24%\">\n\n<p>uint16</p>\n</td>\n<td width=\"16%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_MODEL</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"24%\">\n\n<p>char*</p>\n</td>\n<td width=\"16%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_ORIENTATION</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"24%\">\n\n<p>uint16</p>\n</td>\n<td width=\"16%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_PAGENAME</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"24%\">\n\n<p>char*</p>\n</td>\n<td width=\"16%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_PAGENUMBER</p>\n</td>\n<td width=\"8%\">\n\n<p>2</p>\n</td>\n<td width=\"24%\">\n\n<p>uint16</p>\n</td>\n<td width=\"16%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_PHOTOMETRIC</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"24%\">\n\n<p>uint16</p>\n</td>\n<td width=\"16%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_PHOTOSHOP</p>\n</td>\n<td width=\"8%\">\n\n<p>?</p>\n</td>\n<td width=\"24%\">\n\n<p>uint32,void*</p>\n</td>\n<td width=\"16%\">\n\n<p>count, data</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_PLANARCONFIG</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"24%\">\n\n<p>uint16</p>\n</td>\n<td width=\"16%\">\n\n<p>&dagger;</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_PREDICTOR</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"24%\">\n\n<p>uint16</p>\n</td>\n<td width=\"16%\">\n\n<p>&dagger;</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_PRIMARYCHROMATICITIES</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"24%\">\n\n<p>float*</p>\n</td>\n<td width=\"16%\">\n\n<p>6-entry array</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_REFERENCEBLACKWHITE</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"24%\">\n\n<p>float*</p>\n</td>\n<td width=\"16%\">\n\n<p>&dagger; 2*SamplesPerPixel array</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_RESOLUTIONUNIT</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"24%\">\n\n<p>uint16</p>\n</td>\n<td width=\"16%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_RICHTIFFIPTC</p>\n</td>\n<td width=\"8%\">\n\n<p>2</p>\n</td>\n<td width=\"24%\">\n\n<p>uint32,void*</p>\n</td>\n<td width=\"16%\">\n\n<p>count, data</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_ROWSPERSTRIP</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"24%\">\n\n<p>uint32</p>\n</td>\n<td width=\"16%\">\n\n<p>&dagger; must be &gt; 0</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_SAMPLEFORMAT</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"24%\">\n\n<p>uint16</p>\n</td>\n<td width=\"16%\">\n\n<p>&dagger;</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_SAMPLESPERPIXEL</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"24%\">\n\n<p>uint16</p>\n</td>\n<td width=\"16%\">\n\n<p>&dagger; value must be &lt;= 4</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_SMAXSAMPLEVALUE</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"24%\">\n\n<p>double</p>\n</td>\n<td width=\"16%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_SMINSAMPLEVALUE</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"24%\">\n\n<p>double</p>\n</td>\n<td width=\"16%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_SOFTWARE</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"24%\">\n\n<p>char*</p>\n</td>\n<td width=\"16%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_STONITS</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"24%\">\n\n<p>double</p>\n</td>\n<td width=\"16%\">\n\n<p>&dagger;</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_SUBFILETYPE</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"24%\">\n\n<p>uint32</p>\n</td>\n<td width=\"16%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_SUBIFD</p>\n</td>\n<td width=\"8%\">\n\n<p>2</p>\n</td>\n<td width=\"24%\">\n\n<p>uint16,uint32*</p>\n</td>\n<td width=\"16%\">\n\n<p>count &amp; offsets array</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_TARGETPRINTER</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"24%\">\n\n<p>char*</p>\n</td>\n<td width=\"16%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_THRESHHOLDING</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"24%\">\n\n<p>uint16</p>\n</td>\n<td width=\"16%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_TILEDEPTH</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"24%\">\n\n<p>uint32</p>\n</td>\n<td width=\"16%\">\n\n<p>&dagger;</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_TILELENGTH</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"24%\">\n\n<p>uint32</p>\n</td>\n<td width=\"16%\">\n\n<p>&dagger; must be a multiple of 8</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_TILEWIDTH</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"24%\">\n\n<p>uint32</p>\n</td>\n<td width=\"16%\">\n\n<p>&dagger; must be a multiple of 8</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_TRANSFERFUNCTION</p>\n</td>\n<td width=\"8%\">\n\n<p>1 or 3&Dagger; uint16*</p>\n</td>\n<td width=\"24%\"></td>\n<td width=\"16%\">\n\n<p>1&lt;&lt;BitsPerSample entry arrays</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_WHITEPOINT</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"24%\">\n\n<p>float*</p>\n</td>\n<td width=\"16%\">\n\n<p>2-entry array</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_XMLPACKET</p>\n</td>\n<td width=\"8%\">\n\n<p>2</p>\n</td>\n<td width=\"24%\">\n\n<p>uint32,void*</p>\n</td>\n<td width=\"16%\">\n\n<p>count, data</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_XPOSITION</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"24%\">\n\n<p>float</p>\n</td>\n<td width=\"16%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_XRESOLUTION</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"24%\">\n\n<p>float</p>\n</td>\n<td width=\"16%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_YCBCRCOEFFICIENTS</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"24%\">\n\n<p>float*</p>\n</td>\n<td width=\"16%\">\n\n<p>&dagger; 3-entry array</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_YCBCRPOSITIONING</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"24%\">\n\n<p>uint16</p>\n</td>\n<td width=\"16%\">\n\n<p>&dagger;</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_YCBCRSAMPLING</p>\n</td>\n<td width=\"8%\">\n\n<p>2</p>\n</td>\n<td width=\"24%\">\n\n<p>uint16</p>\n</td>\n<td width=\"16%\">\n\n<p>&dagger;</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_YPOSITION</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"24%\">\n\n<p>float</p>\n</td>\n<td width=\"16%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"41%\">\n\n<p>TIFFTAG_YRESOLUTION</p>\n</td>\n<td width=\"8%\">\n\n<p>1</p>\n</td>\n<td width=\"24%\">\n\n<p>float</p>\n</td>\n<td width=\"16%\">\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>&dagger; Tag may not have its values changed once data is\nwritten.<br>\n&Dagger; If <i>SamplesPerPixel</i> is one, then a single\narray is passed; otherwise three arrays should be\npassed.<br>\n* The contents of this field are quite complex. See <b>The\nICC Profile Format Specification</b>, Annex B.3\n&quot;Embedding ICC Profiles in TIFF Files&quot; (available\nat http://www.color.org) for an explanation.</p>\n</td>\n</table>\n<a name=\"RETURN VALUES\"></a>\n<h2>RETURN VALUES</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>1 is returned if the operation was successful. Otherwise,\n0 is returned if an error was detected.</p>\n</td>\n</table>\n<a name=\"DIAGNOSTICS\"></a>\n<h2>DIAGNOSTICS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>All error messages are directed to the\n<b>TIFFError</b>(3TIFF) routine.</p>\n<!-- INDENTATION -->\n<p><b>%s: Cannot modify tag &quot;%s&quot; while\nwriting</b>. Data has already been written to the file, so\nthe specified tag&rsquo;s value can not be changed. This\nrestriction is applied to all tags that affect the format of\nwritten data.</p>\n<!-- INDENTATION -->\n<p><b>%d: Bad value for &quot;%s&quot;</b>. An invalid value\nwas supplied for the named tag.</p>\n</td>\n</table>\n<a name=\"SEE ALSO\"></a>\n<h2>SEE ALSO</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>TIFFOpen</b>(3TIFF), <b>TIFFGetField</b>(3TIFF),\n<b>TIFFSetDirectory</b>(3TIFF),\n<b>TIFFWriteDirectory</b>(3TIFF),\n<b>TIFFReadDirectory</b>(3TIFF), <b>libtiff</b>(3TIFF)</p>\n<!-- INDENTATION -->\n<p>Libtiff library home page:\n<b>http://www.remotesensing.org/libtiff/</b></p>\n</td>\n</table>\n<hr>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/TIFFWarning.3tiff.html",
    "content": "<!-- Creator     : groff version 1.18.1 -->\n<!-- CreationDate: Fri Jul 13 17:43:17 2007 -->\n<html>\n<head>\n<meta name=\"generator\" content=\"groff -Thtml, see www.gnu.org\">\n<meta name=\"Content-Style\" content=\"text/css\">\n<title>TIFFWarning</title>\n</head>\n<body>\n\n<h1 align=center>TIFFWarning</h1>\n<a href=\"#NAME\">NAME</a><br>\n<a href=\"#SYNOPSIS\">SYNOPSIS</a><br>\n<a href=\"#DESCRIPTION\">DESCRIPTION</a><br>\n<a href=\"#RETURN VALUES\">RETURN VALUES</a><br>\n<a href=\"#SEE ALSO\">SEE ALSO</a><br>\n\n<hr>\n<a name=\"NAME\"></a>\n<h2>NAME</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>TIFFWarning, TIFFSetWarningHandler &minus; library\nwarning interface</p>\n</td>\n</table>\n<a name=\"SYNOPSIS\"></a>\n<h2>SYNOPSIS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>#include &lt;tiffio.h&gt;</b></p>\n<!-- INDENTATION -->\n<p><b>void TIFFWarning(const char *</b><i>module</i><b>,\nconst char *</b><i>fmt</i><b>,</b> <i>...</i><b>)</b></p>\n<!-- INDENTATION -->\n<p><b>#include &lt;stdargh.h&gt;</b></p>\n<!-- INDENTATION -->\n<p><b>typedef void (*TIFFWarningHandler)(const char\n*</b><i>module</i><b>, const char *</b><i>fmt</i><b>,\nva_list</b> <i>ap</i><b>);</b></p>\n<!-- INDENTATION -->\n<p><b>TIFFWarningHandler\nTIFFSetWarningHandler(TIFFWarningHandler</b>\n<i>handler</i><b>);</b></p>\n</td>\n</table>\n<a name=\"DESCRIPTION\"></a>\n<h2>DESCRIPTION</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><i>TIFFWarning</i> invokes the library-wide warning\nhandler function to (normally) write a warning message to\nthe <b>stderr</b>. The <i>fmt</i> parameter is a\n<i>printf</i>(3S) format string, and any number arguments\ncan be supplied. The <i>module</i> parameter is interpreted\nas a string that, if non-zero, should be printed before the\nmessage; it typically is used to identify the software\nmodule in which a warning is detected.</p>\n<!-- INDENTATION -->\n<p>Applications that desire to capture control in the event\nof a warning should use <i>TIFFSetWarningHandler</i> to\noverride the default warning handler. A <small>NULL</small>\n(0) warning handler function may be installed to suppress\nerror messages.</p>\n</td>\n</table>\n<a name=\"RETURN VALUES\"></a>\n<h2>RETURN VALUES</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><i>TIFFSetWarningHandler</i> returns a reference to the\nprevious error handling function.</p>\n</td>\n</table>\n<a name=\"SEE ALSO\"></a>\n<h2>SEE ALSO</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>TIFFError</b>(3TIFF), <b>libtiff</b>(3TIFF),\n<b>printf</b>(3)</p>\n<!-- INDENTATION -->\n<p>Libtiff library home page:\n<b>http://www.remotesensing.org/libtiff/</b></p>\n</td>\n</table>\n<hr>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/TIFFWriteDirectory.3tiff.html",
    "content": "<!-- Creator     : groff version 1.18.1 -->\n<!-- CreationDate: Fri Jul 13 17:43:17 2007 -->\n<html>\n<head>\n<meta name=\"generator\" content=\"groff -Thtml, see www.gnu.org\">\n<meta name=\"Content-Style\" content=\"text/css\">\n<title>TIFFWriteDirectory</title>\n</head>\n<body>\n\n<h1 align=center>TIFFWriteDirectory</h1>\n<a href=\"#NAME\">NAME</a><br>\n<a href=\"#SYNOPSIS\">SYNOPSIS</a><br>\n<a href=\"#DESCRIPTION\">DESCRIPTION</a><br>\n<a href=\"#RETURN VALUES\">RETURN VALUES</a><br>\n<a href=\"#DIAGNOSTICS\">DIAGNOSTICS</a><br>\n<a href=\"#SEE ALSO\">SEE ALSO</a><br>\n\n<hr>\n<a name=\"NAME\"></a>\n<h2>NAME</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>TIFFWriteDirectory, TIFFRewriteDirectory,\nTIFFCheckpointDirectory &minus; write the current directory\nin an open <small>TIFF</small> file</p>\n</td>\n</table>\n<a name=\"SYNOPSIS\"></a>\n<h2>SYNOPSIS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>#include &lt;tiffio.h&gt;</b></p>\n<!-- INDENTATION -->\n<p><b>int TIFFWriteDirectory(TIFF *</b><i>tif</i><b>)<br>\nint TIFFRewriteDirectory(TIFF *</b><i>tif</i><b>)<br>\nint TIFFCheckpointDirectory(TIFF *</b><i>tif</i><b>)</b></p>\n</td>\n</table>\n<a name=\"DESCRIPTION\"></a>\n<h2>DESCRIPTION</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><i>TIFFWriteDirectory</i> will write the contents of the\ncurrent directory to the file and setup to create a new\nsubfile in the same file. Applications only need to call\n<i>TIFFWriteDirectory</i> when writing multiple subfiles to\na single <small>TIFF</small> file. <i>TIFFWriteDirectory</i>\nis automatically called by <i>TIFFClose</i> and\n<i>TIFFFlush</i> to write a modified directory if the file\nis open for writing.</p>\n<!-- INDENTATION -->\n<p>The <i>TIFFRewriteDirectory</i> function operates\nsimilarly to <i>TIFFWriteDirectory,</i> but can be called\nwith directories previously read or written that already\nhave an established location in the file. It will rewrite\nthe directory, but instead of place it at it&rsquo;s old\nlocation (as <i>TIFFWriteDirectory</i> would) it will place\nthem at the end of the file, correcting the pointer from the\npreceeding directory or file header to point to it&rsquo;s\nnew location. This is particularly important in cases where\nthe size of the directory and pointed to data has grown, so\nit won&rsquo;t fit in the space available at the old\nlocation.</p>\n<!-- INDENTATION -->\n<p>The <i>TIFFCheckpointDirectory</i> writes the current\nstate of the tiff directory into the file to make what is\ncurrently in the file readable. Unlike\n<i>TIFFWriteDirectory, TIFFCheckpointDirectory</i> does not\nfree up the directory data structures in memory, so they can\nbe updated (as strips/tiles are written) and written again.\nReading such a partial file you will at worst get a tiff\nread error for the first strip/tile encountered that is\nincomplete, but you will at least get all the valid data in\nthe file before that. When the file is complete, just use\n<i>TIFFWriteDirectory</i> as usual to finish it off\ncleanly.</p>\n</td>\n</table>\n<a name=\"RETURN VALUES\"></a>\n<h2>RETURN VALUES</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>1 is returned when the contents are successfully written\nto the file. Otherwise, 0 is returned if an error was\nencountered when writing the directory contents.</p>\n</td>\n</table>\n<a name=\"DIAGNOSTICS\"></a>\n<h2>DIAGNOSTICS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>All error messages are directed to the\n<i>TIFFError</i>(3TIFF) routine.</p>\n<!-- INDENTATION -->\n<p><b>Error post-encoding before directory write</b>. Before\nwriting the contents of the current directory, any pending\ndata are flushed. This message indicates that an error\noccurred while doing this.</p>\n<!-- INDENTATION -->\n<p><b>Error flushing data before directory write</b>. Before\nwriting the contents of the current directory, any pending\ndata are flushed. This message indicates that an error\noccurred while doing this.</p>\n<!-- INDENTATION -->\n<p><b>Cannot write directory, out of space</b>. There was\nnot enough space to allocate a temporary area for the\ndirectory that was to be written.</p>\n<!-- INDENTATION -->\n<p><b>Error writing directory count</b>. A write error\noccurred when writing the count of fields in the\ndirectory.</p>\n<!-- INDENTATION -->\n<p><b>Error writing directory contents</b>. A write error\noccurred when writing the directory fields.</p>\n<!-- INDENTATION -->\n<p><b>Error writing directory link</b>. A write error\noccurred when writing the link to the next directory.</p>\n<!-- INDENTATION -->\n<p><b>Error writing data for field &quot;%s&quot;</b>. A\nwrite error occurred when writing indirect data for the\nspecified field.</p>\n<!-- INDENTATION -->\n<p><b>Error writing TIFF header</b>. A write error occurred\nwhen re-writing header at the front of the file.</p>\n<!-- INDENTATION -->\n<p><b>Error fetching directory count</b>. A read error\noccurred when fetching the directory count field for a\nprevious directory. This can occur when setting up a link to\nthe directory that is being written.</p>\n<!-- INDENTATION -->\n<p><b>Error fetching directory link</b>. A read error\noccurred when fetching the directory link field for a\nprevious directory. This can occur when setting up a link to\nthe directory that is being written.</p>\n</td>\n</table>\n<a name=\"SEE ALSO\"></a>\n<h2>SEE ALSO</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>TIFFOpen</b>(3TIFF), <b>TIFFError</b>(3TIFF),\n<b>TIFFReadDirectory</b>(3TIFF),\n<b>TIFFSetDirectory</b>(3TIFF), <b>libtiff</b>(3TIFF)</p>\n<!-- INDENTATION -->\n<p>Libtiff library home page:\n<b>http://www.remotesensing.org/libtiff/</b></p>\n</td>\n</table>\n<hr>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/TIFFWriteEncodedStrip.3tiff.html",
    "content": "<!-- Creator     : groff version 1.18.1 -->\n<!-- CreationDate: Fri Jul 13 17:43:17 2007 -->\n<html>\n<head>\n<meta name=\"generator\" content=\"groff -Thtml, see www.gnu.org\">\n<meta name=\"Content-Style\" content=\"text/css\">\n<title>TIFFWriteEncodedStrip</title>\n</head>\n<body>\n\n<h1 align=center>TIFFWriteEncodedStrip</h1>\n<a href=\"#NAME\">NAME</a><br>\n<a href=\"#SYNOPSIS\">SYNOPSIS</a><br>\n<a href=\"#DESCRIPTION\">DESCRIPTION</a><br>\n<a href=\"#NOTES\">NOTES</a><br>\n<a href=\"#RETURN VALUES\">RETURN VALUES</a><br>\n<a href=\"#DIAGNOSTICS\">DIAGNOSTICS</a><br>\n<a href=\"#SEE ALSO\">SEE ALSO</a><br>\n\n<hr>\n<a name=\"NAME\"></a>\n<h2>NAME</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><big>TIFFWritedEncodedStrip &minus; compress and write a\nstrip of data to an open</big> TIFF <big>file</big></p>\n</td>\n</table>\n<a name=\"SYNOPSIS\"></a>\n<h2>SYNOPSIS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><big><b>#include &lt;tiffio.h&gt;</b></big></p>\n<!-- INDENTATION -->\n<p><big><b>tsize_t TIFFWriteEncodedStrip(TIFF\n*</b><i>tif</i><b>, tstrip_t</b> <i>strip</i><b>,\ntdata_t</b> <i>buf</i><b>, tsize_t</b>\n<i>size</i><b>)</b></big></p>\n</td>\n</table>\n<a name=\"DESCRIPTION\"></a>\n<h2>DESCRIPTION</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><big>Compress <i>size</i> bytes of raw data from\n<i>buf</i> and write the result to the specified strip;\nreplacing any previously written data. Note that the value\nof <i>strip</i> is a &lsquo;&lsquo;raw strip\nnumber.&rsquo;&rsquo; That is, the caller must take into\naccount whether or not the data are organized in separate\nplanes (<i>PlanarConfiguration</i>=2).</big></p>\n</td>\n</table>\n<a name=\"NOTES\"></a>\n<h2>NOTES</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><big>The library writes encoded data using the native\nmachine byte order. Correctly implemented</big> TIFF\n<big>readers are expected to do any necessary byte-swapping\nto correctly process image data with BitsPerSample greater\nthan 8.</big></p>\n<!-- INDENTATION -->\n<p><big>The strip number must be valid according to the\ncurrent settings of the <i>ImageLength</i> and\n<i>RowsPerStrip</i> tags. An image may be dynamically grown\nby increasing the value of <i>ImageLength</i> prior to each\ncall to <i>TIFFWriteEncodedStrip</i>.</big></p>\n</td>\n</table>\n<a name=\"RETURN VALUES\"></a>\n<h2>RETURN VALUES</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><big>&minus;1 is returned if an error was encountered.\nOtherwise, the value of <i>size</i> is returned.</big></p>\n</td>\n</table>\n<a name=\"DIAGNOSTICS\"></a>\n<h2>DIAGNOSTICS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><big>All error messages are directed to the\n<i>TIFFError</i>(3TIFF) routine.</big></p>\n<!-- INDENTATION -->\n<p><big><b>%s: File not open for writing</b>. The file was\nopened for reading, not writing.</big></p>\n<!-- INDENTATION -->\n<p><big><b>Can not write scanlines to a tiled image</b>. The\nimage is assumed to be organized in tiles because the\n<i>TileWidth</i> and <i>TileLength</i> tags have been set\nwith <i>TIFFSetField</i>(3TIFF).</big></p>\n<!-- INDENTATION -->\n<p><big><b>%s: Must set &quot;ImageWidth&quot; before\nwriting data</b>. The image&rsquo;s width has not be set\nbefore the first write. See <i>TIFFSetField</i>(3TIFF) for\ninformation on how to do this.</big></p>\n<!-- INDENTATION -->\n<p><big><b>%s: Must set &quot;PlanarConfiguration&quot;\nbefore writing data</b>. The organization of data has not be\ndefined before the first write. See\n<i>TIFFSetField</i>(3TIFF) for information on how to do\nthis.</big></p>\n<!-- INDENTATION -->\n<p><big><b>%s: No space for strip arrays&quot;</b>. There\nwas not enough space for the arrays that hold strip offsets\nand byte counts.</big></p>\n</td>\n</table>\n<a name=\"SEE ALSO\"></a>\n<h2>SEE ALSO</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><big><b>TIFFOpen</b>(3TIFF),\n<b>TIFFWriteScanline</b>(3TIFF),\n<b>TIFFWriteRawStrip</b>(3TIFF),\n<b>libtiff</b>(3TIFF)</big></p>\n<!-- INDENTATION -->\n<p><big>Libtiff library home page:\n<b>http://www.remotesensing.org/libtiff/</b></big></p>\n</td>\n</table>\n<hr>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/TIFFWriteEncodedTile.3tiff.html",
    "content": "<!-- Creator     : groff version 1.18.1 -->\n<!-- CreationDate: Fri Jul 13 17:43:17 2007 -->\n<html>\n<head>\n<meta name=\"generator\" content=\"groff -Thtml, see www.gnu.org\">\n<meta name=\"Content-Style\" content=\"text/css\">\n<title>TIFFWriteEncodedTile</title>\n</head>\n<body>\n\n<h1 align=center>TIFFWriteEncodedTile</h1>\n<a href=\"#NAME\">NAME</a><br>\n<a href=\"#SYNOPSIS\">SYNOPSIS</a><br>\n<a href=\"#DESCRIPTION\">DESCRIPTION</a><br>\n<a href=\"#NOTES\">NOTES</a><br>\n<a href=\"#RETURN VALUES\">RETURN VALUES</a><br>\n<a href=\"#DIAGNOSTICS\">DIAGNOSTICS</a><br>\n<a href=\"#SEE ALSO\">SEE ALSO</a><br>\n\n<hr>\n<a name=\"NAME\"></a>\n<h2>NAME</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><big>TIFFWritedEncodedTile &minus; compress and write a\ntile of data to an open</big> TIFF <big>file</big></p>\n</td>\n</table>\n<a name=\"SYNOPSIS\"></a>\n<h2>SYNOPSIS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><big><b>#include &lt;tiffio.h&gt;</b></big></p>\n<!-- INDENTATION -->\n<p><big><b>tsize_t TIFFWriteEncodedTile(TIFF\n*</b><i>tif</i><b>, ttile_t</b> <i>tile</i><b>, tdata_t</b>\n<i>buf</i><b>, tsize_t</b> <i>size</i><b>)</b></big></p>\n</td>\n</table>\n<a name=\"DESCRIPTION\"></a>\n<h2>DESCRIPTION</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><big>Compress <i>size</i> bytes of raw data from\n<i>buf</i> and <b>append</b> the result to the end of the\nspecified tile. Note that the value of <i>tile</i> is a\n&lsquo;&lsquo;raw tile number.&rsquo;&rsquo; That is, the\ncaller must take into account whether or not the data are\norganized in separate places (<i>PlanarConfiguration</i>=2).\n<i>TIFFComputeTile</i> automatically does this when\nconverting an (x,y,z,sample) coordinate quadruple to a tile\nnumber.</big></p>\n</td>\n</table>\n<a name=\"NOTES\"></a>\n<h2>NOTES</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><big>The library writes encoded data using the native\nmachine byte order. Correctly implemented</big> TIFF\n<big>readers are expected to do any necessary byte-swapping\nto correctly process image data with BitsPerSample greater\nthan 8.</big></p>\n</td>\n</table>\n<a name=\"RETURN VALUES\"></a>\n<h2>RETURN VALUES</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><big>&minus;1 is returned if an error was encountered.\nOtherwise, the value of <i>size</i> is returned.</big></p>\n</td>\n</table>\n<a name=\"DIAGNOSTICS\"></a>\n<h2>DIAGNOSTICS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><big>All error messages are directed to the\n<b>TIFFError</b>(3TIFF) routine.</big></p>\n<!-- INDENTATION -->\n<p><big><b>%s: File not open for writing</b>. The file was\nopened for reading, not writing.</big></p>\n<!-- INDENTATION -->\n<p><big><b>Can not write tiles to a stripped image</b>. The\nimage is assumed to be organized in strips because neither\nof the <i>TileWidth</i> or <i>TileLength</i> tags have been\nset with <b>TIFFSetField</b>(3TIFF).</big></p>\n<!-- INDENTATION -->\n<p><big><b>%s: Must set &quot;ImageWidth&quot; before\nwriting data</b>. The image&rsquo;s width has not be set\nbefore the first write. See <b>TIFFSetField</b>(3TIFF) for\ninformation on how to do this.</big></p>\n<!-- INDENTATION -->\n<p><big><b>%s: Must set &quot;PlanarConfiguration&quot;\nbefore writing data</b>. The organization of data has not be\ndefined before the first write. See\n<b>TIFFSetField</b>(3TIFF) for information on how to do\nthis.</big></p>\n<!-- INDENTATION -->\n<p><big><b>%s: No space for tile arrays&quot;</b>. There was\nnot enough space for the arrays that hold tile offsets and\nbyte counts.</big></p>\n</td>\n</table>\n<a name=\"SEE ALSO\"></a>\n<h2>SEE ALSO</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><big><b>TIFFOpen</b>(3TIFF), <b>TIFFWriteTile</b>(3TIFF),\n<b>TIFFWriteRawTile</b>(3TIFF),\n<b>libtiff</b>(3TIFF)</big></p>\n<!-- INDENTATION -->\n<p><big>Libtiff library home page:\n<b>http://www.remotesensing.org/libtiff/</b></big></p>\n</td>\n</table>\n<hr>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/TIFFWriteRawStrip.3tiff.html",
    "content": "<!-- Creator     : groff version 1.18.1 -->\n<!-- CreationDate: Fri Jul 13 17:43:17 2007 -->\n<html>\n<head>\n<meta name=\"generator\" content=\"groff -Thtml, see www.gnu.org\">\n<meta name=\"Content-Style\" content=\"text/css\">\n<title>TIFFWriteRawstrip</title>\n</head>\n<body>\n\n<h1 align=center>TIFFWriteRawstrip</h1>\n<a href=\"#NAME\">NAME</a><br>\n<a href=\"#SYNOPSIS\">SYNOPSIS</a><br>\n<a href=\"#DESCRIPTION\">DESCRIPTION</a><br>\n<a href=\"#NOTES\">NOTES</a><br>\n<a href=\"#RETURN VALUES\">RETURN VALUES</a><br>\n<a href=\"#DIAGNOSTICS\">DIAGNOSTICS</a><br>\n<a href=\"#SEE ALSO\">SEE ALSO</a><br>\n\n<hr>\n<a name=\"NAME\"></a>\n<h2>NAME</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>TIFFWriteRawStrip &minus; write a strip of raw data to an\nopen <small>TIFF</small> file</p>\n</td>\n</table>\n<a name=\"SYNOPSIS\"></a>\n<h2>SYNOPSIS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>#include &lt;tiffio.h&gt;</b></p>\n<!-- INDENTATION -->\n<p><b>tsize_t TIFFWriteRawStrip(TIFF *</b><i>tif</i><b>,\ntstrip_t</b> <i>strip</i><b>, tdata_t</b> <i>buf</i><b>,\ntsize_t</b> <i>size</i><b>)</b></p>\n</td>\n</table>\n<a name=\"DESCRIPTION\"></a>\n<h2>DESCRIPTION</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>Append <i>size</i> bytes of raw data to the specified\nstrip.</p>\n</td>\n</table>\n<a name=\"NOTES\"></a>\n<h2>NOTES</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>The strip number must be valid according to the current\nsettings of the <i>ImageLength</i> and <i>RowsPerStrip</i>\ntags. An image may be dynamically grown by increasing the\nvalue of <i>ImageLength</i> prior to each call to\n<i>TIFFWriteRawStrip</i>.</p>\n</td>\n</table>\n<a name=\"RETURN VALUES\"></a>\n<h2>RETURN VALUES</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>&minus;1 is returned if an error occurred. Otherwise, the\nvalue of <i>size</i> is returned.</p>\n</td>\n</table>\n<a name=\"DIAGNOSTICS\"></a>\n<h2>DIAGNOSTICS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>All error messages are directed to the\n<b>TIFFError</b>(3TIFF) routine.</p>\n<!-- INDENTATION -->\n<p><b>%s: File not open for writing</b>. The file was opened\nfor reading, not writing.</p>\n<!-- INDENTATION -->\n<p><b>Can not write scanlines to a tiled image</b>. The\nimage is assumed to be organized in tiles because the\n<i>TileWidth</i> and <i>TileLength</i> tags have been set\nwith <b>TIFFSetField</b>(3TIFF).</p>\n<!-- INDENTATION -->\n<p><b>%s: Must set &quot;ImageWidth&quot; before writing\ndata</b>. The image&rsquo;s width has not be set before the\nfirst write. See <b>TIFFSetField</b>(3TIFF) for information\non how to do this.</p>\n<!-- INDENTATION -->\n<p><b>%s: Must set &quot;PlanarConfiguration&quot; before\nwriting data</b>. The organization of data has not be\ndefined before the first write. See\n<b>TIFFSetField</b>(3TIFF) for information on how to do\nthis.</p>\n<!-- INDENTATION -->\n<p><b>%s: No space for strip arrays&quot;</b>. There was not\nenough space for the arrays that hold strip offsets and byte\ncounts.</p>\n<!-- INDENTATION -->\n<p><b>%s: Strip %d out of range, max %d</b>. The specified\nstrip is not a valid strip according to the currently\nspecified image dimensions.</p>\n</td>\n</table>\n<a name=\"SEE ALSO\"></a>\n<h2>SEE ALSO</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>TIFFOpen</b>(3TIFF),\n<b>TIFFWriteEncodedStrip</b>(3TIFF),\n<b>TIFFWriteScanline</b>(3TIFF), <b>libtiff</b>(3TIFF)</p>\n<!-- INDENTATION -->\n<p>Libtiff library home page:\n<b>http://www.remotesensing.org/libtiff/</b></p>\n</td>\n</table>\n<hr>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/TIFFWriteRawTile.3tiff.html",
    "content": "<!-- Creator     : groff version 1.18.1 -->\n<!-- CreationDate: Fri Jul 13 17:43:18 2007 -->\n<html>\n<head>\n<meta name=\"generator\" content=\"groff -Thtml, see www.gnu.org\">\n<meta name=\"Content-Style\" content=\"text/css\">\n<title>TIFFWriteRawtile</title>\n</head>\n<body>\n\n<h1 align=center>TIFFWriteRawtile</h1>\n<a href=\"#NAME\">NAME</a><br>\n<a href=\"#SYNOPSIS\">SYNOPSIS</a><br>\n<a href=\"#DESCRIPTION\">DESCRIPTION</a><br>\n<a href=\"#RETURN VALUES\">RETURN VALUES</a><br>\n<a href=\"#DIAGNOSTICS\">DIAGNOSTICS</a><br>\n<a href=\"#SEE ALSO\">SEE ALSO</a><br>\n\n<hr>\n<a name=\"NAME\"></a>\n<h2>NAME</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>TIFFWriteRawTile &minus; write a tile of raw data to an\nopen <small>TIFF</small> file</p>\n</td>\n</table>\n<a name=\"SYNOPSIS\"></a>\n<h2>SYNOPSIS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>#include &lt;tiffio.h&gt;</b></p>\n<!-- INDENTATION -->\n<p><b>tsize_t TIFFWriteRawTile(TIFF *</b><i>tif</i><b>,\nttile_t</b> <i>tile</i><b>, tdata_t</b> <i>buf</i><b>,\ntsize_t</b> <i>size</i><b>)</b></p>\n</td>\n</table>\n<a name=\"DESCRIPTION\"></a>\n<h2>DESCRIPTION</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>Append <i>size</i> bytes of raw data to the specified\ntile.</p>\n</td>\n</table>\n<a name=\"RETURN VALUES\"></a>\n<h2>RETURN VALUES</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>&minus;1 is returned if an error occurred. Otherwise, the\nvalue of <i>size</i> is returned.</p>\n</td>\n</table>\n<a name=\"DIAGNOSTICS\"></a>\n<h2>DIAGNOSTICS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>All error messages are directed to the\n<b>TIFFError</b>(3TIFF) routine.</p>\n<!-- INDENTATION -->\n<p><b>%s: File not open for writing</b>. The file was opened\nfor reading, not writing.</p>\n<!-- INDENTATION -->\n<p><b>Can not write tiles to a stripped image</b>. The image\nis assumed to be organized in strips because neither of the\n<i>TileWidth</i> or <i>TileLength</i> tags have been set\nwith <b>TIFFSetField</b>(3TIFF).</p>\n<!-- INDENTATION -->\n<p><b>%s: Must set &quot;ImageWidth&quot; before writing\ndata</b>. The image&rsquo;s width has not be set before the\nfirst write. See <b>TIFFSetField</b>(3TIFF) for information\non how to do this.</p>\n<!-- INDENTATION -->\n<p><b>%s: Must set &quot;PlanarConfiguration&quot; before\nwriting data</b>. The organization of data has not be\ndefined before the first write. See\n<b>TIFFSetField</b>(3TIFF) for information on how to do\nthis.</p>\n<!-- INDENTATION -->\n<p><b>%s: No space for tile arrays&quot;</b>. There was not\nenough space for the arrays that hold tile offsets and byte\ncounts.</p>\n<!-- INDENTATION -->\n<p><b>%s: Specified tile %d out of range, max %d</b>. The\nspecified tile is not valid according to the currently\nspecified image dimensions.</p>\n</td>\n</table>\n<a name=\"SEE ALSO\"></a>\n<h2>SEE ALSO</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>TIFFOpen</b>(3TIFF),\n<b>TIFFWriteEncodedTile</b>(3TIFF),\n<b>TIFFWriteScanline</b>(3TIFF), <b>libtiff</b>(3TIFF)</p>\n<!-- INDENTATION -->\n<p>Libtiff library home page:\n<b>http://www.remotesensing.org/libtiff/</b></p>\n</td>\n</table>\n<hr>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/TIFFWriteScanline.3tiff.html",
    "content": "<!-- Creator     : groff version 1.18.1 -->\n<!-- CreationDate: Fri Jul 13 17:43:18 2007 -->\n<html>\n<head>\n<meta name=\"generator\" content=\"groff -Thtml, see www.gnu.org\">\n<meta name=\"Content-Style\" content=\"text/css\">\n<title>TIFFWriteScanline</title>\n</head>\n<body>\n\n<h1 align=center>TIFFWriteScanline</h1>\n<a href=\"#NAME\">NAME</a><br>\n<a href=\"#SYNOPSIS\">SYNOPSIS</a><br>\n<a href=\"#DESCRIPTION\">DESCRIPTION</a><br>\n<a href=\"#NOTES\">NOTES</a><br>\n<a href=\"#RETURN VALUES\">RETURN VALUES</a><br>\n<a href=\"#DIAGNOSTICS\">DIAGNOSTICS</a><br>\n<a href=\"#BUGS\">BUGS</a><br>\n<a href=\"#SEE ALSO\">SEE ALSO</a><br>\n\n<hr>\n<a name=\"NAME\"></a>\n<h2>NAME</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>TIFFWriteScanline &minus; write a scanline to an open\n<small>TIFF</small> file</p>\n</td>\n</table>\n<a name=\"SYNOPSIS\"></a>\n<h2>SYNOPSIS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>#include &lt;tiffio.h&gt;</b></p>\n<!-- INDENTATION -->\n<p><b>int TIFFWriteScanline(TIFF *</b><i>tif</i><b>,\ntdata_t</b> <i>buf</i><b>, uint32</b> <i>row</i><b>,\ntsample_t</b> <i>sample</i><b>)</b></p>\n</td>\n</table>\n<a name=\"DESCRIPTION\"></a>\n<h2>DESCRIPTION</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>Write data to a file at the specified row. The\n<i>sample</i> parameter is used only if data are organized\nin separate planes (<i>PlanarConfiguration</i>=2). The data\nare assumed to be uncompressed and in the native bit- and\nbyte-order of the host machine. The data written to the file\nis compressed according to the compression scheme of the\ncurrent <small>TIFF</small> directory (see further below).\nIf the current scanline is past the end of the current\nsubfile, the <i>ImageLength</i> field is automatically\nincreased to include the scanline (except for\n<i>PlanarConfiguration</i>=2, where the <i>ImageLength</i>\ncannot be changed once the first data are written). If the\n<i>ImageLength</i> is increased, the <i>StripOffsets</i> and\n<i>StripByteCounts</i> fields are similarly enlarged to\nreflect data written past the previous end of image.</p>\n</td>\n</table>\n<a name=\"NOTES\"></a>\n<h2>NOTES</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>The library writes encoded data using the native machine\nbyte order. Correctly implemented <small>TIFF</small>\nreaders are expected to do any necessary byte-swapping to\ncorrectly process image data with BitsPerSample greater than\n8. The library attempts to hide bit-ordering differences\nbetween the image and the native machine by converting data\nfrom the native machine order.</p>\n<!-- INDENTATION -->\n<p>In C++ the <i>sample</i> parameter defaults to 0.</p>\n<!-- INDENTATION -->\n<p>Once data are written to a file for the current\ndirectory, the values of certain tags may not be altered;\nsee <i>TIFFSetField</i>(3TIFF) for more information.</p>\n<!-- INDENTATION -->\n<p>It is not possible to write scanlines to a file that uses\na tiled organization. The routine <i>TIFFIsTiled</i> can be\nused to determine if the file is organized as tiles or\nstrips.</p>\n</td>\n</table>\n<a name=\"RETURN VALUES\"></a>\n<h2>RETURN VALUES</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><i>TIFFWriteScanline</i> returns &minus;1 if it\nimmediately detects an error and 1 for a successful\nwrite.</p>\n</td>\n</table>\n<a name=\"DIAGNOSTICS\"></a>\n<h2>DIAGNOSTICS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>All error messages are directed to the\n<i>TIFFError</i>(3TIFF) routine.</p>\n<!-- INDENTATION -->\n<p><b>%s: File not open for writing .</b> The file was\nopened for reading, not writing.</p>\n<!-- INDENTATION -->\n<p><b>Can not write scanlines to a tiled image</b>. An\nattempt was made to write a scanline to a tiled image. The\nimage is assumed to be organized in tiles because the\n<i>TileWidth</i> and <i>TileLength</i> tags have been set\nwith <i>TIFFSetField</i>(3TIFF).</p>\n<!-- INDENTATION -->\n<p><b>Compression algorithm does not support random\naccess</b>. Data was written in a non-sequential order to a\nfile that uses a compression algorithm and that has\n<i>RowsPerStrip</i> greater than one. That is, data in the\nimage is to be stored in a compressed form, and with\nmultiple rows packed into a strip. In this case, the library\ndoes not support random access to the data. The data should\neither be written as entire strips, sequentially by rows, or\nthe value of <i>RowsPerStrip</i> should be set to one.</p>\n<!-- INDENTATION -->\n<p><b>%s: Must set &quot;ImageWidth&quot; before writing\ndata</b>. The image&rsquo;s width has not be set before the\nfirst write. See <b>TIFFSetField</b>(3TIFF) for information\non how to do this.</p>\n<!-- INDENTATION -->\n<p><b>%s: Must set &quot;PlanarConfiguration&quot; before\nwriting data</b>. The organization of data has not be\ndefined before the first write. See\n<b>TIFFSetField</b>(3TIFF) for information on how to do\nthis.</p>\n<!-- INDENTATION -->\n<p><b>Can not change &quot;ImageLength&quot; when using\nseparate planes</b>. Separate image planes are being used\n(<i>PlanarConfiguration</i>=2), but the number of rows has\nnot been specified before the first write. The library\nsupports the dynamic growth of an image only when data are\norganized in a contiguous manner\n(<i>PlanarConfiguration</i>=1).</p>\n<!-- INDENTATION -->\n<p><b>%d: Sample out of range, max %d</b>. The <i>sample</i>\nparameter was greater than the value of the SamplesPerPixel\ntag.</p>\n<!-- INDENTATION -->\n<p><b>%s: No space for strip arrays .</b> There was not\nenough space for the arrays that hold strip offsets and byte\ncounts.</p>\n</td>\n</table>\n<a name=\"BUGS\"></a>\n<h2>BUGS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>Writing subsampled YCbCR data does not work correctly\nbecause, for <i>PlanarConfiguration</i>=2 the size of a\nscanline is not calculated on a per-sample basis, and for\n<i>PlanarConfiguration</i>=1 the library does not pack the\nblock-interleaved samples.</p>\n</td>\n</table>\n<a name=\"SEE ALSO\"></a>\n<h2>SEE ALSO</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>TIFFOpen</b>(3TIFF),\n<b>TIFFWriteEncodedStrip</b>(3TIFF),\n<b>TIFFWriteRawStrip</b>(3TIFF), <b>libtiff</b>(3TIFF)</p>\n<!-- INDENTATION -->\n<p>Libtiff library home page:\n<b>http://www.remotesensing.org/libtiff/</b></p>\n</td>\n</table>\n<hr>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/TIFFWriteTile.3tiff.html",
    "content": "<!-- Creator     : groff version 1.18.1 -->\n<!-- CreationDate: Fri Jul 13 17:43:18 2007 -->\n<html>\n<head>\n<meta name=\"generator\" content=\"groff -Thtml, see www.gnu.org\">\n<meta name=\"Content-Style\" content=\"text/css\">\n<title>TIFFWriteTile</title>\n</head>\n<body>\n\n<h1 align=center>TIFFWriteTile</h1>\n<a href=\"#NAME\">NAME</a><br>\n<a href=\"#SYNOPSIS\">SYNOPSIS</a><br>\n<a href=\"#DESCRIPTION\">DESCRIPTION</a><br>\n<a href=\"#RETURN VALUES\">RETURN VALUES</a><br>\n<a href=\"#DIAGNOSTICS\">DIAGNOSTICS</a><br>\n<a href=\"#SEE ALSO\">SEE ALSO</a><br>\n\n<hr>\n<a name=\"NAME\"></a>\n<h2>NAME</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>TIFFWriteTile &minus; encode and write a tile of data to\nan open <small>TIFF</small> file</p>\n</td>\n</table>\n<a name=\"SYNOPSIS\"></a>\n<h2>SYNOPSIS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>#include &lt;tiffio.h&gt;</b></p>\n<!-- INDENTATION -->\n<p><b>tsize_t TIFFWriteTile(TIFF *</b><i>tif</i><b>,\ntdata_t</b> <i>buf</i><b>, uint32</b> <i>x</i><b>,\nuint32</b> <i>y</i><b>, uint32</b> <i>z</i><b>,\ntsample_t</b> <i>sample</i><b>)</b></p>\n</td>\n</table>\n<a name=\"DESCRIPTION\"></a>\n<h2>DESCRIPTION</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>Write the data for the tile <i>containing</i> the\nspecified coordinates. The data in <i>buf</i> are is\n(potentially) compressed, and written to the indicated file,\nnormally being appended to the end of the file. The buffer\nmust be contain an entire tile of data. Applications should\ncall the routine <i>TIFFTileSize</i> to find out the size\n(in bytes) of a tile buffer. The <i>x</i> and <i>y</i>\nparameters are always used by <i>TIFFWriteTile</i>. The\n<i>z</i> parameter is used if the image is deeper than 1\nslice (<i>ImageDepth</i>&gt;1). The <i>sample</i> parameter\nis used only if data are organized in separate planes\n(<i>PlanarConfiguration</i>=2).</p>\n</td>\n</table>\n<a name=\"RETURN VALUES\"></a>\n<h2>RETURN VALUES</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><i>TIFFWriteTile</i> returns &minus;1 if it detects an\nerror; otherwise the number of bytes in the tile is\nreturned.</p>\n</td>\n</table>\n<a name=\"DIAGNOSTICS\"></a>\n<h2>DIAGNOSTICS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>All error messages are directed to the\n<b>TIFFError</b>(3TIFF) routine.</p>\n</td>\n</table>\n<a name=\"SEE ALSO\"></a>\n<h2>SEE ALSO</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>TIFFCheckTile</b>(3TIFF),\n<b>TIFFComputeTile</b>(3TIFF), <b>TIFFOpen</b>(3TIFF),\n<b>TIFFReadTile</b>(3TIFF), <b>TIFFWriteScanline</b>(3TIFF),\n<b>TIFFWriteEncodedTile</b>(3TIFF),\n<b>TIFFWriteRawTile</b>(3TIFF), <b>libtiff</b>(3TIFF)</p>\n<!-- INDENTATION -->\n<p>Libtiff library home page:\n<b>http://www.remotesensing.org/libtiff/</b></p>\n</td>\n</table>\n<hr>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/TIFFbuffer.3tiff.html",
    "content": "<!-- Creator     : groff version 1.18.1 -->\n<!-- CreationDate: Fri Jul 13 17:43:14 2007 -->\n<html>\n<head>\n<meta name=\"generator\" content=\"groff -Thtml, see www.gnu.org\">\n<meta name=\"Content-Style\" content=\"text/css\">\n<title>TIFFBUFFER</title>\n</head>\n<body>\n\n<h1 align=center>TIFFBUFFER</h1>\n<a href=\"#NAME\">NAME</a><br>\n<a href=\"#SYNOPSIS\">SYNOPSIS</a><br>\n<a href=\"#DESCRIPTION\">DESCRIPTION</a><br>\n<a href=\"#DIAGNOSTICS\">DIAGNOSTICS</a><br>\n<a href=\"#SEE ALSO\">SEE ALSO</a><br>\n\n<hr>\n<a name=\"NAME\"></a>\n<h2>NAME</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>TIFFReadBufferSetup, TIFFWriteBufferSetup &minus; I/O\nbuffering control routines</p>\n</td>\n</table>\n<a name=\"SYNOPSIS\"></a>\n<h2>SYNOPSIS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<pre><b>#include &lt;tiffio.h&gt;\n\nint TIFFReadBufferSetup(TIFF *</b><i>tif</i><b>, tdata_t</b> <i>buffer</i><b>, tsize_t</b> <i>size</i><b>);\nint TIFFWriteBufferSetup(TIFF *</b><i>tif</i><b>, tdata_t</b> <i>buffer</i><b>, tsize_t</b> <i>size</i><b>);\n</b></pre>\n</td>\n</table>\n<a name=\"DESCRIPTION\"></a>\n<h2>DESCRIPTION</h2>\n<!-- INDENTATION -->\n\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>The following routines are provided for client-control of\nthe I/O buffers used by the library. Applications need never\nuse these routines; they are provided only for\n&lsquo;&lsquo;intelligent clients&rsquo;&rsquo; that wish to\noptimize memory usage and/or eliminate potential copy\noperations that can occur when working with images that have\ndata stored without compression.</p>\n<!-- INDENTATION -->\n<p><i>TIFFReadBufferSetup</i> sets up the data buffer used\nto read raw (encoded) data from a file. If the specified\npointer is <small>NULL</small> (zero), then a buffer of the\nappropriate size is allocated. Otherwise the caller must\nguarantee that the buffer is large enough to hold any\nindividual strip of raw data. <i>TIFFReadBufferSetup</i>\nreturns a non-zero value if the setup was successful and\nzero otherwise.</p>\n<!-- INDENTATION -->\n<p><i>TIFFWriteBufferSetup</i> sets up the data buffer used\nto write raw (encoded) data to a file. If the specified\n<i>size</i> is &minus;1 then the buffer size is selected to\nhold a complete tile or strip, or at least 8 kilobytes,\nwhichever is greater. If the specified <i>buffer</i> is\n<small>NULL</small> (zero), then a buffer of the appropriate\nsize is dynamically allocated. <i>TIFFWriteBufferSetup</i>\nreturns a non-zero value if the setup was successful and\nzero otherwise.</p>\n</td>\n</table>\n<a name=\"DIAGNOSTICS\"></a>\n<h2>DIAGNOSTICS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>%s: No space for data buffer at scanline %ld</b>.\n<i>TIFFReadBufferSetup</i> was unable to dynamically\nallocate space for a data buffer.</p>\n<!-- INDENTATION -->\n<p><b>%s: No space for output buffer</b>.\n<i>TIFFWriteBufferSetup</i> was unable to dynamically\nallocate space for a data buffer.</p>\n</td>\n</table>\n<a name=\"SEE ALSO\"></a>\n<h2>SEE ALSO</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>libtiff</b>(3TIFF)</p>\n<!-- INDENTATION -->\n<p>Libtiff library home page:\n<b>http://www.remotesensing.org/libtiff/</b></p>\n</td>\n</table>\n<hr>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/TIFFcodec.3tiff.html",
    "content": "<!-- Creator     : groff version 1.18.1 -->\n<!-- CreationDate: Fri Jul 13 17:43:15 2007 -->\n<html>\n<head>\n<meta name=\"generator\" content=\"groff -Thtml, see www.gnu.org\">\n<meta name=\"Content-Style\" content=\"text/css\">\n<title>CODEC</title>\n</head>\n<body>\n\n<h1 align=center>CODEC</h1>\n<a href=\"#NAME\">NAME</a><br>\n<a href=\"#SYNOPSIS\">SYNOPSIS</a><br>\n<a href=\"#DESCRIPTION\">DESCRIPTION</a><br>\n<a href=\"#DIAGNOSTICS\">DIAGNOSTICS</a><br>\n<a href=\"#SEE ALSO\">SEE ALSO</a><br>\n\n<hr>\n<a name=\"NAME\"></a>\n<h2>NAME</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>TIFFFindCODEC, TIFFRegisterCODEC, TIFFUnRegisterCODEC,\nTIFFIsCODECConfigured &minus; codec-related utility\nroutines</p>\n</td>\n</table>\n<a name=\"SYNOPSIS\"></a>\n<h2>SYNOPSIS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>#include &lt;tiffio.h&gt;</b></p>\n<!-- INDENTATION -->\n<p><b>const TIFFCodec* TIFFFindCODEC(uint16</b>\n<i>scheme</i><b>);<br>\nTIFFCodec* TIFFRegisterCODEC(uint16</b> <i>scheme</i><b>,\nconst char *</b><i>method</i><b>, TIFFInitMethod</b>\n<i>init</i><b>);<br>\nvoid TIFFUnRegisterCODEC(TIFFCodec\n*</b><i>codec</i><b>);<br>\nint TIFFIsCODECConfigured(uint16</b>\n<i>scheme</i><b>);</b></p>\n</td>\n</table>\n<a name=\"DESCRIPTION\"></a>\n<h2>DESCRIPTION</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><i>libtiff</i> supports a variety of compression schemes\nimplemented by software <i>codecs</i>. Each codec adheres to\na modular interface that provides for the decoding and\nencoding of image data; as well as some other methods for\ninitialization, setup, cleanup, and the control of default\nstrip and tile sizes. Codecs are identified by the\nassociated value of the <small>TIFF</small>\n<i>Compression</i> tag; e.g. 5 for <small>LZW</small>\ncompression.</p>\n<!-- INDENTATION -->\n<p>The <i>TIFFRegisterCODEC</i> routine can be used to\naugment or override the set of codecs available to an\napplication. If the specified <i>scheme</i> already has a\nregistered codec then it is <i>overridden</i> and any images\nwith data encoded with this compression scheme will be\ndecoded using the supplied coded.</p>\n<!-- INDENTATION -->\n<p><i>TIFFIsCODECConfigured</i> returns 1 if the codec is\nconfigured and working. Otherwise 0 will be returned.</p>\n</td>\n</table>\n<a name=\"DIAGNOSTICS\"></a>\n<h2>DIAGNOSTICS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>No space to register compression scheme %s</b>.\n<i>TIFFRegisterCODEC</i> was unable to allocate memory for\nthe data structures needed to register a codec.</p>\n<!-- INDENTATION -->\n<p><b>Cannot remove compression scheme %s; not\nregistered</b>. <i>TIFFUnRegisterCODEC</i> did not locate\nthe specified codec in the table of registered compression\nschemes.</p>\n</td>\n</table>\n<a name=\"SEE ALSO\"></a>\n<h2>SEE ALSO</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>libtiff</b>(3TIFF)</p>\n<!-- INDENTATION -->\n<p>Libtiff library home page:\n<b>http://www.remotesensing.org/libtiff/</b></p>\n</td>\n</table>\n<hr>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/TIFFcolor.3tiff.html",
    "content": "<!-- Creator     : groff version 1.18.1 -->\n<!-- CreationDate: Fri Jul 13 17:43:15 2007 -->\n<html>\n<head>\n<meta name=\"generator\" content=\"groff -Thtml, see www.gnu.org\">\n<meta name=\"Content-Style\" content=\"text/css\">\n<title>COLOR</title>\n</head>\n<body>\n\n<h1 align=center>COLOR</h1>\n<a href=\"#NAME\">NAME</a><br>\n<a href=\"#SYNOPSIS\">SYNOPSIS</a><br>\n<a href=\"#DESCRIPTION\">DESCRIPTION</a><br>\n<a href=\"#SEE ALSO\">SEE ALSO</a><br>\n\n<hr>\n<a name=\"NAME\"></a>\n<h2>NAME</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>TIFFYCbCrToRGBInit, TIFFYCbCrtoRGB, TIFFCIELabToRGBInit,\nTIFFCIELabToXYZ, TIFFXYZToRGB &minus; color conversion\nroutines.</p>\n</td>\n</table>\n<a name=\"SYNOPSIS\"></a>\n<h2>SYNOPSIS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>#include &lt;tiffio.h&gt;</b></p>\n<!-- INDENTATION -->\n<p><b>int TIFFYCbCrToRGBInit(TIFFYCbCrToRGB\n*</b><i>ycbcr</i><b>, float *</b><i>luma</i><b>, float\n*</b><i>refBlackWhite&quot;</i><b>);&quot;<br>\nvoid TIFFYCbCrtoRGB(TIFFYCbCrToRGB *</b><i>ycbcr</i><b>,\nuint32</b> <i>Y</i><b>, int32</b> <i>Cb</i><b>, int32</b>\n<i>Cr</i><b>, uint32 *</b><i>R</i><b>, uint32\n*</b><i>G</i><b>, uint32 *</b><i>B</i> <b>);</b></p>\n<!-- INDENTATION -->\n<p><b>int TIFFCIELabToRGBInit(TIFFCIELabToRGB\n*</b><i>cielab</i><b>, TIFFDisplay *</b><i>display</i><b>,\nfloat *</b><i>refWhite</i><b>);<br>\nvoid TIFFCIELabToXYZ(TIFFCIELabToRGB *</b><i>cielab</i><b>,\nuint32</b> <i>L</i><b>, int32</b> <i>a</i><b>, int32</b>\n<i>b</i><b>, float *</b><i>X</i><b>, float *</b><i>Y</i><b>,\nfloat *</b><i>Z</i><b>);<br>\nvoid TIFFXYZToRGB(TIFFCIELabToRGB *</b><i>cielab</i><b>,\nfloat</b> <i>X</i><b>, float</b> <i>Y</i><b>, float</b>\n<i>Z&quot;</i><b>,</b><i>uint32</i><b>*&quot;</b><i>R</i><b>,\nuint32 *</b><i>G</i><b>, uint32 *</b><i>B</i><b>);</b></p>\n</td>\n</table>\n<a name=\"DESCRIPTION\"></a>\n<h2>DESCRIPTION</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>TIFF supports several color spaces for images stored in\nthat format. There is usually a problem of application to\nhandle the data properly and convert between different\ncolorspaces for displaying and printing purposes. To\nsimplify this task libtiff implements several color\nconversion routines itself. In particular, these routines\nused in <b>TIFFRGBAImage(3TIFF)</b> interface.</p>\n<!-- INDENTATION -->\n<p><b>TIFFYCbCrToRGBInit()</b> used to initialize\n<i>YCbCr</i> to <i>RGB</i> conversion state. Allocating and\nfreeing of the <i>ycbcr</i> structure belongs to programmer.\n<i>TIFFYCbCrToRGB</i> defined in <b>tiffio.h</b> as</p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"17%\"></td>\n<td width=\"82%\">\n<pre>typedef struct {                /* YCbCr-&gt;RGB support */\n        TIFFRGBValue* clamptab; /* range clamping table */\n</pre>\n</td>\n</table>\n<!-- TABS -->\n\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"5\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n\n<p>int*</p>\n<td width=\"28%\"></td>\n<td width=\"-3%\"></td>\n<td width=\"12%\"></td>\n<td width=\"6%\">\n\n<p>Cr_r_tab;<br>\nint*</p>\n</td>\n<td width=\"56%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"28%\"></td>\n<td width=\"-3%\"></td>\n<td width=\"12%\"></td>\n<td width=\"6%\">\n\n<p>Cb_b_tab;<br>\nint32*</p>\n</td>\n<td width=\"56%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"28%\"></td>\n<td width=\"-3%\"></td>\n<td width=\"12%\"></td>\n<td width=\"6%\">\n\n<p>Cr_g_tab;<br>\nint32*</p>\n</td>\n<td width=\"56%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"28%\"></td>\n<td width=\"-3%\"></td>\n<td width=\"12%\"></td>\n<td width=\"6%\">\n\n<p>Cb_g_tab;</p>\n</td>\n<td width=\"56%\">\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"17%\"></td>\n<td width=\"82%\">\n<p>int32* Y_tab;<br>\n} TIFFYCbCrToRGB;</p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><i>luma</i> is a float array of three values representing\nproportions of the red, green and blue in luminance, Y (see\nsection 21 of the TIFF 6.0 specification, where the YCbCr\nimages discussed). <i>TIFFTAG_YCBCRCOEFFICIENTS</i> holds\nthat values in TIFF file. <i>refBlackWhite</i> is a float\narray of 6 values which specifies a pair of headroom and\nfootroom image data values (codes) for each image component\n(see section 20 of the TIFF 6.0 specification where the\ncolorinmetry fields discussed).\n<i>TIFFTAG_REFERENCEBLACKWHITE</i> is responsible for\nstoring these values in TIFF file. Following code snippet\nshould helps to understand the the technique:</p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"17%\"></td>\n<td width=\"82%\">\n<pre>float *luma, *refBlackWhite;\nuint16 hs, vs;\n\n/* Initialize structures */\nycbcr = (TIFFYCbCrToRGB*)\n</pre>\n</td>\n</table>\n<!-- TABS -->\n\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"24%\"></td>\n<td width=\"75%\">\n\n<p>_TIFFmalloc(TIFFroundup(sizeof(TIFFYCbCrToRGB),\nsizeof(long))</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"24%\"></td>\n<td width=\"75%\">\n\n<p>+ 4*256*sizeof(TIFFRGBValue)</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"24%\"></td>\n<td width=\"75%\">\n\n<p>+ 2*256*sizeof(int)</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"24%\"></td>\n<td width=\"75%\">\n\n<p>+ 3*256*sizeof(int32));</p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"17%\"></td>\n<td width=\"82%\">\n<p>if (ycbcr == NULL) {<br>\nTIFFError(&quot;YCbCr-&gt;RGB&quot;,</p></td>\n</table>\n<!-- TABS -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"4\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"24%\"></td>\n<td width=\"6%\">\n</td>\n<td width=\"6%\">\n\n<p>&quot;No space for YCbCr-&gt;RGB conversion\nstate&quot;);</p>\n</td>\n<td width=\"62%\">\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"17%\"></td>\n<td width=\"82%\">\n<p>exit(0);<br>\n}</p>\n<!-- INDENTATION -->\n<p>TIFFGetFieldDefaulted(tif, TIFFTAG_YCBCRCOEFFICIENTS,\n&amp;luma);<br>\nTIFFGetFieldDefaulted(tif, TIFFTAG_REFERENCEBLACKWHITE,\n&amp;refBlackWhite);<br>\nif (TIFFYCbCrToRGBInit(ycbcr, luma, refBlackWhite) &lt;\n0)</p></td>\n</table>\n<!-- TABS -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"24%\"></td>\n<td width=\"75%\">\n\n<p>exit(0);</p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"17%\"></td>\n<td width=\"82%\">\n<p>/* Start conversion */<br>\nuint32 r, g, b;<br>\nuint32 Y;<br>\nint32 Cb, Cr;</p>\n<!-- INDENTATION -->\n<p>for each pixel in image</p></td>\n</table>\n<!-- TABS -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"24%\"></td>\n<td width=\"75%\">\n\n<p>TIFFYCbCrtoRGB(img-&gt;ycbcr, Y, Cb, Cr, &amp;r, &amp;g,\n&amp;b);</p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"17%\"></td>\n<td width=\"82%\">\n<p>/* Free state structure */<br>\n_TIFFfree(ycbcr);</p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>TIFFCIELabToRGBInit()</b> initializes the <i>CIE\nL*a*b* 1976</i> to <i>RGB</i> conversion state.\n<b>TIFFCIELabToRGB</b> defined as</p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"17%\"></td>\n<td width=\"82%\">\n<pre>#define CIELABTORGB_TABLE_RANGE 1500\n\n</pre>\n</td>\n</table>\n<!-- TABS -->\n\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"9\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"17%\"></td>\n<td width=\"6%\">\n\n<p>typedef struct {</p>\n</td>\n<td width=\"6%\"></td>\n<td width=\"6%\"></td>\n<td width=\"6%\"></td>\n<td width=\"6%\">\n</td>\n<td width=\"6%\">\n\n<p>/* CIE Lab 1976-&gt;RGB support */</p>\n</td>\n<td width=\"6%\"></td>\n<td width=\"37%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"17%\"></td>\n<td width=\"6%\">\n</td>\n<td width=\"6%\">\n\n<p>int</p>\n</td>\n<td width=\"6%\">\n\n<p>range;</p>\n</td>\n<td width=\"6%\"></td>\n<td width=\"6%\">\n</td>\n<td width=\"6%\">\n\n<p>/* Size of conversion table */</p>\n</td>\n<td width=\"6%\"></td>\n<td width=\"37%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"17%\"></td>\n<td width=\"6%\">\n</td>\n<td width=\"6%\">\n\n<p>float</p>\n</td>\n<td width=\"6%\"></td>\n<td width=\"6%\">\n\n<p>rstep, gstep, bstep;</p>\n</td>\n<td width=\"6%\"></td>\n<td width=\"6%\"></td>\n<td width=\"6%\"></td>\n<td width=\"37%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"17%\"></td>\n<td width=\"6%\">\n</td>\n<td width=\"6%\">\n\n<p>float</p>\n</td>\n<td width=\"6%\"></td>\n<td width=\"6%\">\n\n<p>X0, Y0, Z0;</p>\n</td>\n<td width=\"6%\"></td>\n<td width=\"6%\"></td>\n<td width=\"6%\">\n\n<p>/* Reference white point */</p>\n</td>\n<td width=\"37%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"17%\"></td>\n<td width=\"6%\"></td>\n<td width=\"6%\">\n\n<p>TIFFDisplay display;</p>\n</td>\n<td width=\"6%\"></td>\n<td width=\"6%\"></td>\n<td width=\"6%\"></td>\n<td width=\"6%\"></td>\n<td width=\"6%\"></td>\n<td width=\"37%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"17%\"></td>\n<td width=\"6%\">\n</td>\n<td width=\"6%\">\n\n<p>float</p>\n</td>\n<td width=\"6%\"></td>\n<td width=\"6%\">\n\n<p>Yr2r[CIELABTORGB_TABLE_RANGE + 1]; /* Conversion of Yr\nto r */</p>\n</td>\n<td width=\"6%\"></td>\n<td width=\"6%\"></td>\n<td width=\"6%\"></td>\n<td width=\"37%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"17%\"></td>\n<td width=\"6%\">\n</td>\n<td width=\"6%\">\n\n<p>float</p>\n</td>\n<td width=\"6%\"></td>\n<td width=\"6%\">\n\n<p>Yg2g[CIELABTORGB_TABLE_RANGE + 1]; /* Conversion of Yg\nto g */</p>\n</td>\n<td width=\"6%\"></td>\n<td width=\"6%\"></td>\n<td width=\"6%\"></td>\n<td width=\"37%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"17%\"></td>\n<td width=\"6%\">\n</td>\n<td width=\"6%\">\n\n<p>float</p>\n</td>\n<td width=\"6%\"></td>\n<td width=\"6%\">\n\n<p>Yb2b[CIELABTORGB_TABLE_RANGE + 1]; /* Conversion of Yb\nto b */</p>\n</td>\n<td width=\"6%\"></td>\n<td width=\"6%\"></td>\n<td width=\"6%\"></td>\n<td width=\"37%\">\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"17%\"></td>\n<td width=\"82%\">\n<p>} TIFFCIELabToRGB;</p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><i>display</i> is a display device description, declared\nas</p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"17%\"></td>\n<td width=\"82%\">\n<pre>typedef struct {\n</pre>\n</td>\n</table>\n<!-- TABS -->\n\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"24%\"></td>\n<td width=\"75%\">\n\n<p>float d_mat[3][3]; /* XYZ -&gt; luminance matrix */</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"24%\"></td>\n<td width=\"75%\">\n\n<p>float d_YCR; /* Light o/p for reference white */</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"24%\"></td>\n<td width=\"75%\">\n\n<p>float d_YCG;</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"24%\"></td>\n<td width=\"75%\">\n\n<p>float d_YCB;</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"24%\"></td>\n<td width=\"75%\">\n\n<p>uint32 d_Vrwr; /* Pixel values for ref. white */</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"24%\"></td>\n<td width=\"75%\">\n\n<p>uint32 d_Vrwg;</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"24%\"></td>\n<td width=\"75%\">\n\n<p>uint32 d_Vrwb;</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"24%\"></td>\n<td width=\"75%\">\n\n<p>float d_Y0R; /* Residual light for black pixel */</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"24%\"></td>\n<td width=\"75%\">\n\n<p>float d_Y0G;</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"24%\"></td>\n<td width=\"75%\">\n\n<p>float d_Y0B;</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"24%\"></td>\n<td width=\"75%\">\n\n<p>float d_gammaR; /* Gamma values for the three guns\n*/</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"24%\"></td>\n<td width=\"75%\">\n\n<p>float d_gammaG;</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"24%\"></td>\n<td width=\"75%\">\n\n<p>float d_gammaB;</p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"17%\"></td>\n<td width=\"82%\">\n<p>} TIFFDisplay;</p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>For example, the one can use sRGB device, which has the\nfollowing parameters:</p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"17%\"></td>\n<td width=\"82%\">\n<pre>TIFFDisplay display_sRGB = {\n</pre>\n</td>\n</table>\n<!-- TABS -->\n\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"5\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"24%\"></td>\n<td width=\"0%\"></td>\n<td width=\"6%\">\n\n<p>{ /* XYZ -&gt; luminance matrix */</p>\n</td>\n<td width=\"6%\"></td>\n<td width=\"62%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"24%\"></td>\n<td width=\"0%\"></td>\n<td width=\"6%\">\n</td>\n<td width=\"6%\">\n\n<p>{ 3.2410F, -1.5374F, -0.4986F },</p>\n</td>\n<td width=\"62%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"24%\"></td>\n<td width=\"0%\"></td>\n<td width=\"6%\">\n</td>\n<td width=\"6%\">\n\n<p>{ -0.9692F, 1.8760F, 0.0416F },</p>\n</td>\n<td width=\"62%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"24%\"></td>\n<td width=\"0%\"></td>\n<td width=\"6%\">\n</td>\n<td width=\"6%\">\n\n<p>{ 0.0556F, -0.2040F, 1.0570F }</p>\n</td>\n<td width=\"62%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"24%\"></td>\n<td width=\"0%\"></td>\n<td width=\"6%\">\n\n<p>},</p>\n</td>\n<td width=\"6%\">\n</td>\n<td width=\"62%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"24%\"></td>\n<td width=\"0%\"></td>\n<td width=\"6%\">\n\n<p>100.0F, 100.0F, 100.0F, /* Light o/p for reference white\n*/</p>\n</td>\n<td width=\"6%\"></td>\n<td width=\"62%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"24%\"></td>\n<td width=\"0%\"></td>\n<td width=\"6%\">\n\n<p>255, 255, 255, /* Pixel values for ref. white */</p>\n</td>\n<td width=\"6%\"></td>\n<td width=\"62%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"24%\"></td>\n<td width=\"0%\"></td>\n<td width=\"6%\">\n\n<p>1.0F, 1.0F, 1.0F, /* Residual light o/p for black pixel\n*/</p>\n</td>\n<td width=\"6%\"></td>\n<td width=\"62%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"24%\"></td>\n<td width=\"0%\"></td>\n<td width=\"6%\">\n\n<p>2.4F, 2.4F, 2.4F, /* Gamma values for the three guns\n*/</p>\n</td>\n<td width=\"6%\"></td>\n<td width=\"62%\">\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"17%\"></td>\n<td width=\"82%\">\n<p>};</p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><i>refWhite</i> is a color temperature of the reference\nwhite. The <i>TIFFTAG_WHITEPOINT</i> contains the\nchromaticity of the white point of the image from where the\nreference white can be calculated using following\nformulae:</p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"17%\"></td>\n<td width=\"82%\">\n<p>refWhite_Y = 100.0<br>\nrefWhite_X = whitePoint_x / whitePoint_y * refWhite_Y<br>\nrefWhite_Z = (1.0 - whitePoint_x - whitePoint_y) /\nwhitePoint_y * refWhite_X</p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>The conversion itself performed in two steps: at the\nfirst one we will convert <i>CIE L*a*b* 1976</i> to <i>CIE\nXYZ</i> using <b>TIFFCIELabToXYZ()</b> routine, and at the\nsecond step we will convert <i>CIE XYZ</i> to <i>RGB</i>\nusing <b>TIFFXYZToRGB().</b> Look at the code sample\nbelow:</p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"17%\"></td>\n<td width=\"82%\">\n<pre>float   *whitePoint;\nfloat   refWhite[3];\n\n/* Initialize structures */\nimg-&gt;cielab = (TIFFCIELabToRGB *)\n</pre>\n</td>\n</table>\n<!-- TABS -->\n\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"24%\"></td>\n<td width=\"75%\">\n\n<p>_TIFFmalloc(sizeof(TIFFCIELabToRGB));</p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"17%\"></td>\n<td width=\"82%\">\n<p>if (!cielab) {</p></td>\n</table>\n<!-- TABS -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"5\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"24%\"></td>\n<td width=\"0%\"></td>\n<td width=\"6%\">\n\n<p>TIFFError(&quot;CIE L*a*b*-&gt;RGB&quot;,</p>\n</td>\n<td width=\"6%\"></td>\n<td width=\"62%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"24%\"></td>\n<td width=\"0%\"></td>\n<td width=\"6%\">\n</td>\n<td width=\"6%\">\n\n<p>&quot;No space for CIE L*a*b*-&gt;RGB conversion\nstate.&quot;);</p>\n</td>\n<td width=\"62%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"24%\"></td>\n<td width=\"0%\"></td>\n<td width=\"6%\">\n\n<p>exit(0);</p>\n</td>\n<td width=\"6%\"></td>\n<td width=\"62%\">\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"17%\"></td>\n<td width=\"82%\">\n<p>}</p>\n<!-- INDENTATION -->\n<p>TIFFGetFieldDefaulted(tif, TIFFTAG_WHITEPOINT,\n&amp;whitePoint);<br>\nrefWhite[1] = 100.0F;<br>\nrefWhite[0] = whitePoint[0] / whitePoint[1] *\nrefWhite[1];<br>\nrefWhite[2] = (1.0F - whitePoint[0] -\nwhitePoint[1])</p></td>\n</table>\n<!-- TABS -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"24%\"></td>\n<td width=\"75%\">\n\n<p>/ whitePoint[1] * refWhite[1];</p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"17%\"></td>\n<td width=\"82%\">\n<p>if (TIFFCIELabToRGBInit(cielab, &amp;display_sRGB,\nrefWhite) &lt; 0) {</p></td>\n</table>\n<!-- TABS -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"5\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"24%\"></td>\n<td width=\"0%\"></td>\n<td width=\"6%\">\n\n<p>TIFFError(&quot;CIE L*a*b*-&gt;RGB&quot;,</p>\n</td>\n<td width=\"6%\"></td>\n<td width=\"62%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"24%\"></td>\n<td width=\"0%\"></td>\n<td width=\"6%\">\n</td>\n<td width=\"6%\">\n\n<p>&quot;Failed to initialize CIE L*a*b*-&gt;RGB conversion\nstate.&quot;);</p>\n</td>\n<td width=\"62%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"24%\"></td>\n<td width=\"0%\"></td>\n<td width=\"6%\">\n\n<p>_TIFFfree(cielab);</p>\n</td>\n<td width=\"6%\"></td>\n<td width=\"62%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"24%\"></td>\n<td width=\"0%\"></td>\n<td width=\"6%\">\n\n<p>exit(0);</p>\n</td>\n<td width=\"6%\"></td>\n<td width=\"62%\">\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"17%\"></td>\n<td width=\"82%\">\n<p>}</p>\n<!-- INDENTATION -->\n<p>/* Now we can start to convert */<br>\nuint32 r, g, b;<br>\nuint32 L;<br>\nint32 a, b;<br>\nfloat X, Y, Z;</p>\n<!-- INDENTATION -->\n<p>for each pixel in image</p></td>\n</table>\n<!-- TABS -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"24%\"></td>\n<td width=\"75%\">\n\n<p>TIFFCIELabToXYZ(cielab, L, a, b, &amp;X, &amp;Y,\n&amp;Z);</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"24%\"></td>\n<td width=\"75%\">\n\n<p>TIFFXYZToRGB(cielab, X, Y, Z, &amp;r, &amp;g,\n&amp;b);</p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"17%\"></td>\n<td width=\"82%\">\n<p>/* Don&rsquo;t forget to free the state structure */<br>\n_TIFFfree(cielab);</p></td>\n</table>\n<a name=\"SEE ALSO\"></a>\n<h2>SEE ALSO</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>TIFFRGBAImage</b>(3TIFF) <b>libtiff</b>(3TIFF),</p>\n<!-- INDENTATION -->\n<p>Libtiff library home page:\n<b>http://www.remotesensing.org/libtiff/</b></p>\n</td>\n</table>\n<hr>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/TIFFmemory.3tiff.html",
    "content": "<!-- Creator     : groff version 1.18.1 -->\n<!-- CreationDate: Fri Jul 13 17:43:15 2007 -->\n<html>\n<head>\n<meta name=\"generator\" content=\"groff -Thtml, see www.gnu.org\">\n<meta name=\"Content-Style\" content=\"text/css\">\n<title>MEMORY</title>\n</head>\n<body>\n\n<h1 align=center>MEMORY</h1>\n<a href=\"#NAME\">NAME</a><br>\n<a href=\"#SYNOPSIS\">SYNOPSIS</a><br>\n<a href=\"#DESCRIPTION\">DESCRIPTION</a><br>\n<a href=\"#DIAGNOSTICS\">DIAGNOSTICS</a><br>\n<a href=\"#SEE ALSO\">SEE ALSO</a><br>\n\n<hr>\n<a name=\"NAME\"></a>\n<h2>NAME</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>_TIFFmalloc, _TIFFrealloc, _TIFFfree, _TIFFmemset,\n_TIFFmemcpy, _TIFFmemcmp, &minus; memory management-related\nfunctions for use with <small>TIFF</small> files</p>\n</td>\n</table>\n<a name=\"SYNOPSIS\"></a>\n<h2>SYNOPSIS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>#include &lt;tiffio.h&gt;</b></p>\n<!-- INDENTATION -->\n<p><b>tdata_t _TIFFmalloc(tsize_t</b> <i>size</i><b>);<br>\ntdata_t _TIFFrealloc(tdata_t</b> <i>buffer</i><b>,\ntsize_t</b> <i>size</i><b>);<br>\nvoid _TIFFfree(tdata_t</b> <i>buffer</i><b>);<br>\nvoid _TIFFmemset(tdata_t</b> <i>s</i><b>, int</b>\n<i>c</i><b>, tsize_t</b> <i>n</i><b>);<br>\nvoid _TIFFmemcpy(tdata_t</b> <i>dest</i><b>, const\ntdata_t</b> <i>src</i><b>, tsize_t</b> <i>n</i><b>);<br>\nint _TIFFmemcmp(const tdata_t</b> <i>s1</i><b>, const\ntdata_t</b> <i>s2</i><b>, tsize_t</b> <i>n</i><b>);</b></p>\n</td>\n</table>\n<a name=\"DESCRIPTION\"></a>\n<h2>DESCRIPTION</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>These routines are provided for writing portable software\nthat uses <i>libtiff</i>; they hide any memory-management\nrelated issues, such as dealing with segmented architectures\nfound on 16-bit machines.</p>\n<!-- INDENTATION -->\n<p><i>_TIFFmalloc</i> and <i>_TIFFrealloc</i> are used to\ndynamically allocate and reallocate memory used by\n<i>libtiff</i>; such as memory passed into the I/O routines.\nMemory allocated through these interfaces is released back\nto the system using the <i>_TIFFfree</i> routine.</p>\n<!-- INDENTATION -->\n<p>Memory allocated through one of the above interfaces can\nbe set to a known value using <i>_TIFFmemset</i>, copied to\nanother memory location using <i>_TIFFmemcpy</i>, or\ncompared for equality using <i>_TIFFmemcmp</i>. These\nroutines conform to the equivalent <small>ANSI</small> C\nroutines: <i>memset</i>, <i>memcpy</i>, and <i>memcmp</i>,\nrepsectively.</p>\n</td>\n</table>\n<a name=\"DIAGNOSTICS\"></a>\n<h2>DIAGNOSTICS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>None.</p>\n</td>\n</table>\n<a name=\"SEE ALSO\"></a>\n<h2>SEE ALSO</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>malloc</b>(3), <b>memory</b>(3),\n<b>libtiff</b>(3TIFF)</p>\n<!-- INDENTATION -->\n<p>Libtiff library home page:\n<b>http://www.remotesensing.org/libtiff/</b></p>\n</td>\n</table>\n<hr>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/TIFFquery.3tiff.html",
    "content": "<!-- Creator     : groff version 1.18.1 -->\n<!-- CreationDate: Fri Jul 13 17:43:15 2007 -->\n<html>\n<head>\n<meta name=\"generator\" content=\"groff -Thtml, see www.gnu.org\">\n<meta name=\"Content-Style\" content=\"text/css\">\n<title>QUERY</title>\n</head>\n<body>\n\n<h1 align=center>QUERY</h1>\n<a href=\"#NAME\">NAME</a><br>\n<a href=\"#SYNOPSIS\">SYNOPSIS</a><br>\n<a href=\"#DESCRIPTION\">DESCRIPTION</a><br>\n<a href=\"#DIAGNOSTICS\">DIAGNOSTICS</a><br>\n<a href=\"#SEE ALSO\">SEE ALSO</a><br>\n\n<hr>\n<a name=\"NAME\"></a>\n<h2>NAME</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>TIFFCurrentRow, TIFFCurrentStrip, TIFFCurrentTile,\nTIFFCurrentDirectory, TIFFLastDirectory, TIFFFileno,\nTIFFFileName, TIFFGetMode, TIFFIsTiled, TIFFIsByteSwapped,\nTIFFIsUpSampled, TIFFIsMSB2LSB, TIFFGetVersion &minus; query\nroutines</p>\n</td>\n</table>\n<a name=\"SYNOPSIS\"></a>\n<h2>SYNOPSIS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>#include &lt;tiffio.h&gt;</b></p>\n<!-- INDENTATION -->\n<p><b>uint32 TIFFCurrentRow(TIFF*</b> <i>tif</i><b>)<br>\ntstrip_t TIFFCurrentStrip(TIFF*</b> <i>tif</i><b>)<br>\nttile_t TIFFCurrentTile(TIFF*</b> <i>tif</i><b>)<br>\ntdir_t TIFFCurrentDirectory(TIFF*</b> <i>tif</i><b>)<br>\nint TIFFLastDirectory(TIFF*</b> <i>tif</i><b>)<br>\nint TIFFFileno(TIFF*</b> <i>tif</i><b>)<br>\nchar* TIFFFileName(TIFF*</b> <i>tif</i><b>)<br>\nint TIFFGetMode(TIFF*</b> <i>tif</i><b>)<br>\nint TIFFIsTiled(TIFF*</b> <i>tif</i><b>)<br>\nint TIFFIsByteSwapped(TIFF*</b> <i>tif</i><b>)<br>\nint TIFFIsUpSampled(TIFF*</b> <i>tif</i><b>)<br>\nint TIFFIsMSB2LSB(TIFF*</b> <i>tif</i><b>)<br>\nconst char* TIFFGetVersion(void)</b></p>\n</td>\n</table>\n<a name=\"DESCRIPTION\"></a>\n<h2>DESCRIPTION</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>The following routines return status information about an\nopen <small>TIFF</small> file.</p>\n<!-- INDENTATION -->\n<p><i>TIFFCurrentDirectory</i> returns the index of the\ncurrent directory (directories are numbered starting at 0).\nThis number is suitable for use with the\n<i>TIFFSetDirectory</i> routine.</p>\n<!-- INDENTATION -->\n<p><i>TIFFLastDirectory</i> returns a non-zero value if the\ncurrent directory is the last directory in the file;\notherwise zero is returned.</p>\n<!-- INDENTATION -->\n<p><i>TIFFCurrentRow</i>, <i>TIFFCurrentStrip</i>, and\n<i>TIFFCurrentTile</i>, return the current row, strip, and\ntile, respectively, that is being read or written. These\nvalues are updated each time a read or write is done.</p>\n<!-- INDENTATION -->\n<p><i>TIFFFileno</i> returns the underlying file descriptor\nused to access the <small>TIFF</small> image in the\nfilesystem.</p>\n<!-- INDENTATION -->\n<p><i>TIFFFileName</i> returns the pathname argument passed\nto <i>TIFFOpen</i> or <i>TIFFFdOpen</i>.</p>\n<!-- INDENTATION -->\n<p><i>TIFFGetMode</i> returns the mode with which the\nunderlying file was opened. On <small>UNIX</small> systems,\nthis is the value passed to the <i>open</i>(2) system\ncall.</p>\n<!-- INDENTATION -->\n<p><i>TIFFIsTiled</i> returns a non-zero value if the image\ndata has a tiled organization. Zero is returned if the image\ndata is organized in strips.</p>\n<!-- INDENTATION -->\n<p><i>TIFFIsByteSwapped</i> returns a non-zero value if the\nimage data was in a different byte-order than the host\nmachine. Zero is returned if the TIFF file and local host\nbyte-orders are the same. Note that TIFFReadTile(),\nTIFFReadStrip() and TIFFReadScanline() functions already\nnormally perform byte swapping to local host order if\nneeded.</p>\n<!-- INDENTATION -->\n<p><i>TIFFIsUpSampled</i> returns a non-zero value if image\ndata returned through the read interface routines is being\nup-sampled. This can be useful to applications that want to\ncalculate I/O buffer sizes to reflect this usage (though the\nusual strip and tile size routines already do this).</p>\n<!-- INDENTATION -->\n<p><i>TIFFIsMSB2LSB</i> returns a non-zero value if the\nimage data is being returned with bit 0 as the most\nsignificant bit.</p>\n<!-- INDENTATION -->\n<p><i>TIFFGetVersion</i> returns an <small>ASCII</small>\nstring that has a version stamp for the <small>TIFF</small>\nlibrary software.</p>\n</td>\n</table>\n<a name=\"DIAGNOSTICS\"></a>\n<h2>DIAGNOSTICS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>None.</p>\n</td>\n</table>\n<a name=\"SEE ALSO\"></a>\n<h2>SEE ALSO</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><i>libtiff</i>(3TIFF), <i>TIFFOpen</i>(3TIFF),\n<i>TIFFFdOpen</i>(3TIFF)</p>\n</td>\n</table>\n<hr>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/TIFFsize.3tiff.html",
    "content": "<!-- Creator     : groff version 1.18.1 -->\n<!-- CreationDate: Fri Jul 13 17:43:17 2007 -->\n<html>\n<head>\n<meta name=\"generator\" content=\"groff -Thtml, see www.gnu.org\">\n<meta name=\"Content-Style\" content=\"text/css\">\n<title>TIFFSIZE</title>\n</head>\n<body>\n\n<h1 align=center>TIFFSIZE</h1>\n<a href=\"#NAME\">NAME</a><br>\n<a href=\"#SYNOPSIS\">SYNOPSIS</a><br>\n<a href=\"#DESCRIPTION\">DESCRIPTION</a><br>\n<a href=\"#DIAGNOSTICS\">DIAGNOSTICS</a><br>\n<a href=\"#SEE ALSO\">SEE ALSO</a><br>\n\n<hr>\n<a name=\"NAME\"></a>\n<h2>NAME</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>TIFFScanlineSize, TIFFRasterScanlineSize, &minus; return\nthe size of various items associated with an open\n<small>TIFF</small> file</p>\n</td>\n</table>\n<a name=\"SYNOPSIS\"></a>\n<h2>SYNOPSIS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>#include &lt;tiffio.h&gt;</b></p>\n<!-- INDENTATION -->\n<p><b>tsize_t TIFFRasterScanlineSize(TIFF\n*</b><i>tif</i><b>)<br>\ntsize_t TIFFScanlineSize(TIFF *</b><i>tif</i><b>)</b></p>\n</td>\n</table>\n<a name=\"DESCRIPTION\"></a>\n<h2>DESCRIPTION</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><i>TIFFScanlineSize</i> returns the size in bytes of a\nrow of data as it would be returned in a call to\n<i>TIFFReadScanline</i>, or as it would be expected in a\ncall to <i>TIFFWriteScanline</i>.</p>\n<!-- INDENTATION -->\n<p><i>TIFFRasterScanlineSize</i> returns the size in bytes\nof a complete decoded and packed raster scanline. Note that\nthis value may be different from the value returned by\n<i>TIFFScanlineSize</i> if data is stored as separate\nplanes.</p>\n</td>\n</table>\n<a name=\"DIAGNOSTICS\"></a>\n<h2>DIAGNOSTICS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>None.</p>\n</td>\n</table>\n<a name=\"SEE ALSO\"></a>\n<h2>SEE ALSO</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>TIFFOpen</b>(3TIFF), <b>TIFFReadScanline</b>(3TIFF),\n<b>libtiff</b>(3TIFF)</p>\n<!-- INDENTATION -->\n<p>Libtiff library home page:\n<b>http://www.remotesensing.org/libtiff/</b></p>\n</td>\n</table>\n<hr>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/TIFFstrip.3tiff.html",
    "content": "<!-- Creator     : groff version 1.18.1 -->\n<!-- CreationDate: Fri Jul 13 17:43:17 2007 -->\n<html>\n<head>\n<meta name=\"generator\" content=\"groff -Thtml, see www.gnu.org\">\n<meta name=\"Content-Style\" content=\"text/css\">\n<title>TIFFSTRIP</title>\n</head>\n<body>\n\n<h1 align=center>TIFFSTRIP</h1>\n<a href=\"#NAME\">NAME</a><br>\n<a href=\"#SYNOPSIS\">SYNOPSIS</a><br>\n<a href=\"#DESCRIPTION\">DESCRIPTION</a><br>\n<a href=\"#DIAGNOSTICS\">DIAGNOSTICS</a><br>\n<a href=\"#SEE ALSO\">SEE ALSO</a><br>\n\n<hr>\n<a name=\"NAME\"></a>\n<h2>NAME</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>TIFFDefaultStripSize, TIFFStripSize, TIFFVStripSize,\nTIFFRawStripSize, TIFFComputeStrip, TIFFNumberOfStrips\n&minus; strip-related utility routines</p>\n</td>\n</table>\n<a name=\"SYNOPSIS\"></a>\n<h2>SYNOPSIS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>#include &lt;tiffio.h&gt;</b></p>\n<!-- INDENTATION -->\n<p><b>uint32 TIFFDefaultStripSize(TIFF *</b><i>tif</i><b>,\nuint32</b> <i>estimate</i><b>)<br>\ntsize_t TIFFStripSize(TIFF *</b><i>tif</i><b>)<br>\ntsize_t TIFFVStripSize(TIFF *</b><i>tif</i><b>, uint32</b>\n<i>nrows</i><b>)<br>\ntsize_t TIFFRawStripSize(TIFF *</b><i>tif</i><b>,\ntstrip_t</b> <i>strip</i><b>)<br>\ntstrip_t TIFFComputeStrip(TIFF *</b><i>tif</i><b>,\nuint32</b> <i>row</i><b>, tsample_t</b>\n<i>sample</i><b>)<br>\ntstrip_t TIFFNumberOfStrips(TIFF *</b><i>tif</i><b>)</b></p>\n</td>\n</table>\n<a name=\"DESCRIPTION\"></a>\n<h2>DESCRIPTION</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><i>TIFFDefaultStripSize</i> returns the number of rows\nfor a reasonable-sized strip according to the current\nsettings of the <i>ImageWidth</i>, <i>BitsPerSample</i>,\n<i>SamplesPerPixel</i>, tags and any compression-specific\nrequirements. If the <i>estimate</i> parameter, if non-zero,\nthen it is taken as an estimate of the desired strip size\nand adjusted according to any compression-specific\nrequirements. The value returned by this function is\ntypically used to define the <i>RowsPerStrip</i> tag. In\nlieu of any unusual requirements <i>TIFFDefaultStripSize</i>\ntries to create strips that have approximately 8 kilobytes\nof uncompressed data.</p>\n<!-- INDENTATION -->\n<p><i>TIFFStripSize</i> returns the equivalent size for a\nstrip of data as it would be returned in a call to\n<i>TIFFReadEncodedStrip</i> or as it would be expected in a\ncall to <i>TIFFWriteEncodedStrip</i>.</p>\n<!-- INDENTATION -->\n<p><i>TIFFVStripSize</i> returns the number of bytes in a\nstrip with <i>nrows</i> rows of data.</p>\n<!-- INDENTATION -->\n<p><i>TIFFRawStripSize</i> returns the number of bytes in a\nraw strip (i.e. not decoded).</p>\n<!-- INDENTATION -->\n<p><i>TIFFComputeStrip</i> returns the strip that contains\nthe specified coordinates. A valid strip is always returned;\nout-of-range coordinate values are clamped to the bounds of\nthe image. The <i>row</i> parameter is always used in\ncalculating a strip. The <i>sample</i> parameter is used\nonly if data are organized in separate planes\n(<i>PlanarConfiguration</i>=2).</p>\n<!-- INDENTATION -->\n<p><i>TIFFNumberOfStrips</i> returns the number of strips in\nthe image.</p>\n</td>\n</table>\n<a name=\"DIAGNOSTICS\"></a>\n<h2>DIAGNOSTICS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>None.</p>\n</td>\n</table>\n<a name=\"SEE ALSO\"></a>\n<h2>SEE ALSO</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>TIFFReadEncodedStrip</b>(3TIFF),\n<b>TIFFReadRawStrip</b>(3TIFF),\n<b>TIFFWriteEncodedStrip</b>(3TIFF),\n<b>TIFFWriteRawStrip</b>(3TIFF), <b>libtiff</b>(3TIFF),</p>\n<!-- INDENTATION -->\n<p>Libtiff library home page:\n<b>http://www.remotesensing.org/libtiff/</b></p>\n</td>\n</table>\n<hr>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/TIFFswab.3tiff.html",
    "content": "<!-- Creator     : groff version 1.18.1 -->\n<!-- CreationDate: Fri Jul 13 17:43:17 2007 -->\n<html>\n<head>\n<meta name=\"generator\" content=\"groff -Thtml, see www.gnu.org\">\n<meta name=\"Content-Style\" content=\"text/css\">\n<title>SWAB</title>\n</head>\n<body>\n\n<h1 align=center>SWAB</h1>\n<a href=\"#NAME\">NAME</a><br>\n<a href=\"#SYNOPSIS\">SYNOPSIS</a><br>\n<a href=\"#DESCRIPTION\">DESCRIPTION</a><br>\n<a href=\"#DIAGNOSTICS\">DIAGNOSTICS</a><br>\n<a href=\"#SEE ALSO\">SEE ALSO</a><br>\n\n<hr>\n<a name=\"NAME\"></a>\n<h2>NAME</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>TIFFGetBitRevTable, TIFFReverseBits, TIFFSwabShort,\nTIFFSwabLong, TIFFSwabArrayOfShort, TIFFSwabArrayOfLong\n&minus; byte- and bit-swapping routines</p>\n</td>\n</table>\n<a name=\"SYNOPSIS\"></a>\n<h2>SYNOPSIS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>#include &lt;tiffio.h&gt;</b></p>\n<!-- INDENTATION -->\n<p><b>const unsigned char* TIFFGetBitRevTable(int</b>\n<i>reversed</i><b>)<br>\nvoid TIFFReverseBits(u_char *</b><i>data</i><b>, unsigned\nlong</b> <i>nbytes</i><b>)<br>\nvoid TIFFSwabShort(uint16 *</b><i>data</i><b>)<br>\nvoid TIFFSwabLong(uint32 *</b><i>data</i><b>)<br>\nvoid TIFFSwabArrayOfShort(uint16 *</b><i>data</i><b>,\nunsigned long</b> <i>nshorts</i><b>)<br>\nvoid TIFFSwabArrayOfLong(uint32 *</b><i>data</i><b>,\nunsigned long</b> <i>nlongs</i><b>)</b></p>\n</td>\n</table>\n<a name=\"DESCRIPTION\"></a>\n<h2>DESCRIPTION</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>The following routines are used by the library to swap\n16- and 32-bit data and to reverse the order of bits in\nbytes.</p>\n<!-- INDENTATION -->\n<p><i>TIFFSwabShort</i> and <i>TIFFSwabLong</i> swap the\nbytes in a single 16-bit and 32-bit item, respectively.\n<i>TIFFSwabArrayOfShort</i> and <i>TIFFSwabArrayOfLong</i>\nswap the bytes in an array of 16-bit and 32-bit items,\nrespectively.</p>\n<!-- INDENTATION -->\n<p><i>TIFFReverseBits</i> replaces each byte in <i>data</i>\nwith the equivalent bit-reversed value. This operation is\nperformed with a lookup table, which is returned using the\n<i>TIFFGetBitRevTable</i> function. <i>reversed</i>\nparameter specifies which table should be returned. Supply\n<i>1</i> if you want bit reversal table. Supply <i>0</i> to\nget the table that do not reverse bit values. It is a lookup\ntable that can be used as an <i>identity function</i>; i.e.\n<i>TIFFNoBitRevTable[n] == n</i>.</p>\n</td>\n</table>\n<a name=\"DIAGNOSTICS\"></a>\n<h2>DIAGNOSTICS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>None.</p>\n</td>\n</table>\n<a name=\"SEE ALSO\"></a>\n<h2>SEE ALSO</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>libtiff</b>(3TIFF)</p>\n<!-- INDENTATION -->\n<p>Libtiff library home page:\n<b>http://www.remotesensing.org/libtiff/</b></p>\n</td>\n</table>\n<hr>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/TIFFtile.3tiff.html",
    "content": "<!-- Creator     : groff version 1.18.1 -->\n<!-- CreationDate: Fri Jul 13 17:43:17 2007 -->\n<html>\n<head>\n<meta name=\"generator\" content=\"groff -Thtml, see www.gnu.org\">\n<meta name=\"Content-Style\" content=\"text/css\">\n<title>TIFFTILE</title>\n</head>\n<body>\n\n<h1 align=center>TIFFTILE</h1>\n<a href=\"#NAME\">NAME</a><br>\n<a href=\"#SYNOPSIS\">SYNOPSIS</a><br>\n<a href=\"#DESCRIPTION\">DESCRIPTION</a><br>\n<a href=\"#DIAGNOSTICS\">DIAGNOSTICS</a><br>\n<a href=\"#SEE ALSO\">SEE ALSO</a><br>\n\n<hr>\n<a name=\"NAME\"></a>\n<h2>NAME</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>TIFFTileSize, TIFFTileRowSize, TIFFVTileSize,\nTIFFDefaultTileSize, TIFFComputeTile, TIFFCheckTile,\nTIFFNumberOfTiles &minus; tile-related utility routines</p>\n</td>\n</table>\n<a name=\"SYNOPSIS\"></a>\n<h2>SYNOPSIS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>#include &lt;tiffio.h&gt;</b></p>\n<!-- INDENTATION -->\n<p><b>void TIFFDefaultTileSize(TIFF *</b><i>tif</i><b>,\nuint32 *</b><i>tw</i><b>, uint32 *</b><i>th</i><b>)<br>\ntsize_t TIFFTileSize(TIFF *</b><i>tif</i><b>)<br>\ntsize_t TIFFTileRowSize(TIFF *</b><i>tif</i><b>)<br>\ntsize_t TIFFVTileSize(TIFF *</b><i>tif</i><b>, uint32</b>\n<i>nrows</i><b>)<br>\nttile_t TIFFComputeTile(TIFF *</b><i>tif</i><b>, uint32</b>\n<i>x</i><b>, uint32</b> <i>y</i><b>, uint32</b> <i>z</i><b>,\ntsample_t</b> <i>sample</i><b>)<br>\nint TIFFCheckTile(TIFF *</b><i>tif</i><b>, uint32</b>\n<i>x</i><b>, uint32</b> <i>y</i><b>, uint32</b> <i>z</i><b>,\ntsample_t</b> <i>sample</i><b>)<br>\nttile_t TIFFNumberOfTiles(TIFF *</b><i>tif</i><b>)</b></p>\n</td>\n</table>\n<a name=\"DESCRIPTION\"></a>\n<h2>DESCRIPTION</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><i>TIFFDefaultTileSize</i> returns the pixel width and\nheight of a reasonable-sized tile; suitable for setting up\nthe <i>TileWidth</i> and <i>TileLength</i> tags. If the\n<i>tw</i> and <i>th</i> values passed in are non-zero, then\nthey are adjusted to reflect any compression-specific\nrequirements. The returned width and height are constrained\nto be a multiple of 16 pixels to conform with the\n<small>TIFF</small> specification.</p>\n<!-- INDENTATION -->\n<p><i>TIFFTileSize</i> returns the equivalent size for a\ntile of data as it would be returned in a call to\n<i>TIFFReadTile</i> or as it would be expected in a call to\n<i>TIFFWriteTile</i>.</p>\n<!-- INDENTATION -->\n<p><i>TIFFVTileSize</i> returns the number of bytes in a\nrow-aligned tile with <i>nrows</i> of data.</p>\n<!-- INDENTATION -->\n<p><i>TIFFTileRowSize</i> returns the number of bytes of a\nrow of data in a tile.</p>\n<!-- INDENTATION -->\n<p><i>TIFFComputeTile</i> returns the tile that contains the\nspecified coordinates. A valid tile is always returned;\nout-of-range coordinate values are clamped to the bounds of\nthe image. The <i>x</i> and <i>y</i> parameters are always\nused in calculating a tile. The <i>z</i> parameter is used\nif the image is deeper than 1 slice\n(<i>ImageDepth</i>&gt;1). The <i>sample</i> parameter is\nused only if data are organized in separate planes\n(<i>PlanarConfiguration</i>=2).</p>\n<!-- INDENTATION -->\n<p><i>TIFFCheckTile</i> returns a non-zero value if the\nsupplied coordinates are within the bounds of the image and\nzero otherwise. The <i>x</i> parameter is checked against\nthe value of the <i>ImageWidth</i> tag. The <i>y</i>\nparameter is checked against the value of the\n<i>ImageLength</i> tag. The <i>z</i> parameter is checked\nagainst the value of the <i>ImageDepth</i> tag (if defined).\nThe <i>sample</i> parameter is checked against the value of\nthe <i>SamplesPerPixel</i> parameter if the data are\norganized in separate planes.</p>\n<!-- INDENTATION -->\n<p><i>TIFFNumberOfTiles</i> returns the number of tiles in\nthe image.</p>\n</td>\n</table>\n<a name=\"DIAGNOSTICS\"></a>\n<h2>DIAGNOSTICS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>None.</p>\n</td>\n</table>\n<a name=\"SEE ALSO\"></a>\n<h2>SEE ALSO</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>TIFFReadEncodedTile</b>(3TIFF),\n<b>TIFFReadRawTile</b>(3TIFF), <b>TIFFReadTile</b>(3TIFF),\n<b>TIFFWriteEncodedTile</b>(3TIFF),\n<b>TIFFWriteRawTile</b>(3TIFF), <b>TIFFWriteTile</b>(3TIFF),\n<b>libtiff</b>(3TIFF)</p>\n<!-- INDENTATION -->\n<p>Libtiff library home page:\n<b>http://www.remotesensing.org/libtiff/</b></p>\n</td>\n</table>\n<hr>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/fax2ps.1.html",
    "content": "<!-- Creator     : groff version 1.18.1 -->\n<!-- CreationDate: Fri Jul 13 17:43:18 2007 -->\n<html>\n<head>\n<meta name=\"generator\" content=\"groff -Thtml, see www.gnu.org\">\n<meta name=\"Content-Style\" content=\"text/css\">\n<title>FAX2PS</title>\n</head>\n<body>\n\n<h1 align=center>FAX2PS</h1>\n<a href=\"#NAME\">NAME</a><br>\n<a href=\"#SYNOPSIS\">SYNOPSIS</a><br>\n<a href=\"#DESCRIPTION\">DESCRIPTION</a><br>\n<a href=\"#OPTIONS\">OPTIONS</a><br>\n<a href=\"#DIAGNOSTICS\">DIAGNOSTICS</a><br>\n<a href=\"#NOTES\">NOTES</a><br>\n<a href=\"#BUGS\">BUGS</a><br>\n<a href=\"#SEE ALSO\">SEE ALSO</a><br>\n\n<hr>\n<a name=\"NAME\"></a>\n<h2>NAME</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>fax2ps &minus; convert a <small>TIFF</small> facsimile to\ncompressed PostScript&trade;</p>\n</td>\n</table>\n<a name=\"SYNOPSIS\"></a>\n<h2>SYNOPSIS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>fax2ps</b> [ <i>options</i> ] [ <i>file ...</i> ]</p>\n</td>\n</table>\n<a name=\"DESCRIPTION\"></a>\n<h2>DESCRIPTION</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><i>fax2ps</i> reads one or more <small>TIFF</small>\nfacsimile image files and prints a compressed form of\nPostScript on the standard output that is suitable for\nprinting.</p>\n<!-- INDENTATION -->\n<p>By default, each page is scaled to reflect the image\ndimensions and resolutions stored in the file. The\n<b>&minus;x</b> and <b>&minus;y</b> options can be used to\nspecify the horizontal and vertical image resolutions\n(lines/inch), respectively. If the <b>&minus;S</b> option is\nspecified, each page is scaled to fill an output page. The\ndefault output page is 8.5 by 11 inches. Alternate page\ndimensions can be specified in inches with the\n<b>&minus;W</b> and <b>&minus;H</b> options.</p>\n<!-- INDENTATION -->\n<p>By default <i>fax2ps</i> generates PostScript for all\npages in the file. The <b>&minus;p</b> option can be used to\nselect one or more pages from a multi-page document.</p>\n<!-- INDENTATION -->\n<p><i>fax2ps</i> generates a compressed form of PostScript\nthat is optimized for sending pages of text to a PostScript\nprinter attached to a host through a low-speed link (such as\na serial line). Each output page is filled with white and\nthen only the black areas are drawn. The PostScript\nspecification of the black drawing operations is optimized\nby using a special font that encodes the move-draw\noperations required to fill the black regions on the page.\nThis compression scheme typically results in a substantially\nreduced PostScript description, relative to the\nstraightforward imaging of the page with a PostScript\n<i>image</i> operator. This algorithm can, however, be\nineffective for continuous-tone and white-on-black images.\nFor these images, it sometimes is more efficient to send the\nraster bitmap image directly; see <b>tiff2ps</b>(1).</p>\n</td>\n</table>\n<a name=\"OPTIONS\"></a>\n<h2>OPTIONS</h2>\n<!-- TABS -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"4\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"></td>\n<td width=\"11%\">\n\n<p><b>&minus;p</b> <i>number</i></p>\n</td>\n<td width=\"76%\">\n\n<p>Print only the indicated page. Multiple pages may be\nprinted by specifying this option more than once.</p>\n</td>\n<td width=\"0%\">\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>&minus;x</b> <i>resolution</i></p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"23%\"></td>\n<td width=\"76%\">\n<p>Use <i>resolution</i> as the horizontal resolution, in\ndots/inch, of the image data. By default this value is taken\nfrom the file.</p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>&minus;y</b> <i>resolution</i></p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"23%\"></td>\n<td width=\"76%\">\n<p>Use <i>resolution</i> as the vertical resolution, in\nlines/inch, of the image data. By default this value is\ntaken from the file.</p>\n</td>\n</table>\n<!-- TABS -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"4\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"12%\">\n\n<p><b>&minus;S</b></p>\n</td>\n<td width=\"76%\">\n\n<p>Scale each page of image data to fill the output page\ndimensions. By default images are presented according to the\ndimension information recorded in the <small>TIFF</small>\nfile.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"12%\">\n\n<p><b>&minus;W</b> <i>width</i></p>\n</td>\n<td width=\"76%\">\n\n<p>Use <i>width</i> as the width, in inches, of the output\npage.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"12%\">\n\n<p><b>&minus;H</b> <i>height</i></p>\n</td>\n<td width=\"76%\">\n\n<p>Use <i>height</i> as the height, in inches, of the\noutput page.</p>\n</td>\n<td width=\"0%\">\n</td>\n</table>\n<a name=\"DIAGNOSTICS\"></a>\n<h2>DIAGNOSTICS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>Some messages about malformed <small>TIFF</small> images\ncome from the <small>TIFF</small> library.</p>\n<!-- INDENTATION -->\n<p>Various messages about badly formatted facsimile images\nmay be generated due to transmission errors in received\nfacsimile. <i>fax2ps</i> attempts to recover from such data\nerrors by resynchronizing decoding at the end of the current\nscanline. This can result in long horizontal black lines in\nthe resultant PostScript image.</p>\n</td>\n</table>\n<a name=\"NOTES\"></a>\n<h2>NOTES</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>If the destination printer supports PostScript Level II\nthen it is always faster to just send the encoded bitmap\ngenerated by the <b>tiff2ps</b>(1) program.</p>\n</td>\n</table>\n<a name=\"BUGS\"></a>\n<h2>BUGS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><i>fax2ps</i> should probably figure out when it is doing\na poor job of compressing the output and just generate\nPostScript to image the bitmap raster instead.</p>\n</td>\n</table>\n<a name=\"SEE ALSO\"></a>\n<h2>SEE ALSO</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>tiff2ps</b>(1), <b>libtiff</b>(3)</p>\n<!-- INDENTATION -->\n<p>Libtiff library home page:\n<b>http://www.remotesensing.org/libtiff/</b></p>\n</td>\n</table>\n<hr>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/fax2tiff.1.html",
    "content": "<!-- Creator     : groff version 1.18.1 -->\n<!-- CreationDate: Fri Jul 13 17:43:18 2007 -->\n<html>\n<head>\n<meta name=\"generator\" content=\"groff -Thtml, see www.gnu.org\">\n<meta name=\"Content-Style\" content=\"text/css\">\n<title>FAX2TIFF</title>\n</head>\n<body>\n\n<h1 align=center>FAX2TIFF</h1>\n<a href=\"#NAME\">NAME</a><br>\n<a href=\"#SYNOPSIS\">SYNOPSIS</a><br>\n<a href=\"#DESCRIPTION\">DESCRIPTION</a><br>\n<a href=\"#OPTIONS\">OPTIONS</a><br>\n<a href=\"#DIAGNOSTICS\">DIAGNOSTICS</a><br>\n<a href=\"#BUGS\">BUGS</a><br>\n<a href=\"#SEE ALSO\">SEE ALSO</a><br>\n\n<hr>\n<a name=\"NAME\"></a>\n<h2>NAME</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>fax2tiff &minus; create a <small>TIFF</small> Class F fax\nfile from raw fax data</p>\n</td>\n</table>\n<a name=\"SYNOPSIS\"></a>\n<h2>SYNOPSIS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>fax2tiff</b> [ <i>options</i> ] [ <b>&minus;o</b>\n<i>output.tif</i> ] <i>input.raw</i></p>\n</td>\n</table>\n<a name=\"DESCRIPTION\"></a>\n<h2>DESCRIPTION</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><i>Fax2tiff</i> creates a <small>TIFF</small> file\ncontaining <small>CCITT</small> Group 3 or Group 4 encoded\ndata from one or more files containing\n&lsquo;&lsquo;raw&rsquo;&rsquo; Group 3 or Group 4 encoded\ndata (typically obtained directly from a fax modem). By\ndefault, each row of data in the resultant\n<small>TIFF</small> file is 1-dimensionally encoded and\npadded or truncated to 1728 pixels, as needed. The resultant\nimage is a set of low resolution (98 lines/inch) or medium\nresolution (196 lines/inch) pages, each of which is a single\nstrip of data. The generated file conforms to the\n<small>TIFF</small> Class F ( <small>FAX</small> )\nspecification for storing facsimile data. This means, in\nparticular, that each page of the data does <b>not</b>\ninclude the trailing <i>return to control</i> (\n<small>RTC</small> ) code; as required for transmission by\nthe <small>CCITT</small> Group 3 specifications. The old,\n&lsquo;&lsquo;classic&rsquo;&rsquo;, format is created if\nthe <b>&minus;c</b> option is used. (The Class F format can\nalso be requested with the <b>&minus;f</b> option.)</p>\n<!-- INDENTATION -->\n<p>The default name of the output image is <i>fax.tif</i>;\nthis can be changed with the <b>&minus;o</b> option. Each\ninput file is assumed to be a separate page of facsimile\ndata from the same document. The order in which input files\nare specified on the command line is the order in which the\nresultant pages appear in the output file.</p>\n</td>\n</table>\n<a name=\"OPTIONS\"></a>\n<h2>OPTIONS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>Options that affect the interpretation of input data\nare:</p>\n</td>\n</table>\n<!-- TABS -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"5\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;3</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Assume input data is <small>CCITT</small> Group 3\nencoded (default).</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;4</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Assume input data is <small>CCITT</small> Group 4\nencoded.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;U</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Assume input data is uncompressed (Group 3 or Group\n4).</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;1</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Assume input data is encoded with the 1-dimensional\nversion of the <small>CCITT</small> Group 3 Huffman encoding\nalgorithm (default).</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;2</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Assume input data is 2-dimensional version of the\n<small>CCITT</small> Group 3 Huffman encoding algorithm.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;P</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Assume input data is <b>not</b> EOL-aligned (default).\nThis option has effect with Group 3 encoded input only.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;A</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Assume input data is EOL-aligned. This option has effect\nwith Group 3 encoded input only.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;M</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Treat input data as having bits filled from most\nsignificant bit ( <small>MSB</small> ) to most least bit (\n<small>LSB</small> ).</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;L</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Treat input data as having bits filled from least\nsignificant bit ( <small>LSB</small> ) to most significant\nbit ( <small>MSB</small> ) (default).</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;B</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Assume input data was encoded with black as 0 and white\nas 1.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;W</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Assume input data was encoded with black as 1 and white\nas 0 (default).</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;R</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Specify the vertical resolution, in lines/inch, of the\ninput images. By default input are assumed to have a\nvertical resolution of 196 lines/inch. If images are low\nresolution facsimile, a value of 98 lines/inch should be\nspecified.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;X</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Specify the width, in pixels, of the input images. By\ndefault input are assumed to have a width of 1728\npixels.</p>\n</td>\n<td width=\"0%\">\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>Options that affect the output file format are:</p>\n</td>\n</table>\n<!-- TABS -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"5\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;o</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Specify the name of the output file.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;7</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Force output to be compressed with the\n<small>CCITT</small> Group 3 Huffman encoding algorithm\n(default).</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;8</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Force output to be compressed with the\n<small>CCITT</small> Group 4 Huffman encoding.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;u</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Force output to be uncompressed (Group 3 or Group\n4).</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;5</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Force output to be encoded with the 1-dimensional\nversion of the <small>CCITT</small> Group 3 Huffman encoding\nalgorithm.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;6</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Force output to be encoded with the 2-dimensional\nversion of the <small>CCITT</small> Group 3 Huffman encoding\nalgorithm (default).</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;a</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Force the last bit of each <i>End Of Line</i> (\n<small>EOL</small> ) code to land on a byte boundary\n(default). This &lsquo;&lsquo;zero padding&rsquo;&rsquo;\nwill be reflected in the contents of the\n<i>Group3Options</i> tag of the resultant\n<small>TIFF</small> file. This option has effect with Group\n3 encoded output only.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;p</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Do not EOL-align output. This option has effect with\nGroup 3 encoded output only.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;c</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Generate &quot;classic&quot; Group 3 TIFF format.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;f</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Generate TIFF Class F (TIFF/F) format (default).</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;m</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Force output data to have bits filled from most\nsignificant bit ( <small>MSB</small> ) to most least bit (\n<small>LSB</small> ).</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;l</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Force output data to have bits filled from least\nsignificant bit ( <small>LSB</small> ) to most significant\nbit ( <small>MSB</small> ) (default).</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;r</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Specify the number of rows (scanlines) in each strip of\ndata written to the output file. By default (or when value\n<b>0</b> is specified), <i>tiffcp</i> attempts to set the\nrows/strip that no more than 8 kilobytes of data appear in a\nstrip (with except of G3/G4 compression schemes). If you\nspecify special value <b>&minus;1</b> it will results in\ninfinite number of the rows per strip. The entire image will\nbe the one strip in that case. This is default in case of\nG3/G4 output compression schemes.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;s</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Stretch the input image vertically by writing each input\nrow of data twice to the output file.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;v</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Force <i>fax2tiff</i> to print the number of rows of\ndata it retrieved from the input file.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;z</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Force output to be compressed with the LZW encoding.</p>\n</td>\n<td width=\"0%\">\n</td>\n</table>\n<a name=\"DIAGNOSTICS\"></a>\n<h2>DIAGNOSTICS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>The following warnings and errors come from the decoding\nroutines in the library.</p>\n<!-- INDENTATION -->\n<p><b>Warning, %s: Premature EOL at scanline %d (x\n%d).\\n</b>. The input data had a row that was shorter than\nthe expected width. The row is padded with white.</p>\n<!-- INDENTATION -->\n<p><b>%s: Premature EOF at scanline %d (x %d).\\n</b>. The\ndecoder ran out of data in the middle of a scanline. The\nresultant row is padded with white.</p>\n<!-- INDENTATION -->\n<p><b>%s: Bad code word at row %d, x %d\\n</b>. An invalid\nGroup 3 <i>code</i> was encountered while decoding the input\nfile. The row number and horizontal position is given. The\nremainder of the input row is discarded, while the\ncorresponding output row is padded with white.</p>\n<!-- INDENTATION -->\n<p><b>%s: Bad 2D code word at scanline %d.\\n</b>. An invalid\nGroup 4 or 2D Group 3 <i>code</i> was encountered while\ndecoding the input file. The row number and horizontal\nposition is given. The remainder of the input row is\ndiscarded, while the corresponding output row is padded with\nwhite.</p>\n</td>\n</table>\n<a name=\"BUGS\"></a>\n<h2>BUGS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>Input data are assumed to have a a &lsquo;&lsquo;top\nleft&rsquo;&rsquo; orientation; it should be possible to\noverride this assumption from the command line.</p>\n</td>\n</table>\n<a name=\"SEE ALSO\"></a>\n<h2>SEE ALSO</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b><small>CCITT</small> Recommendation T.4</b>\n(Standardization of Group 3 Facsimile Apparatus for Document\nTransmission).</p>\n<!-- INDENTATION -->\n<p><b>The Spirit of TIFF Class F</b>, an appendix to the\nTIFF 5.0 specification prepared by Cygnet Technologies.</p>\n<!-- INDENTATION -->\n<p><b>tiffinfo</b>(1), <b>tiffdither</b>(1),\n<b>tiffgt</b>(1), <b>libtiff</b>(3)</p>\n<!-- INDENTATION -->\n<p>Libtiff library home page:\n<b>http://www.remotesensing.org/libtiff/</b></p>\n</td>\n</table>\n<hr>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/gif2tiff.1.html",
    "content": "<!-- Creator     : groff version 1.18.1 -->\n<!-- CreationDate: Fri Jul 13 17:43:18 2007 -->\n<html>\n<head>\n<meta name=\"generator\" content=\"groff -Thtml, see www.gnu.org\">\n<meta name=\"Content-Style\" content=\"text/css\">\n<title>GIF2TIFF</title>\n</head>\n<body>\n\n<h1 align=center>GIF2TIFF</h1>\n<a href=\"#NAME\">NAME</a><br>\n<a href=\"#SYNOPSIS\">SYNOPSIS</a><br>\n<a href=\"#DESCRIPTION\">DESCRIPTION</a><br>\n<a href=\"#OPTIONS\">OPTIONS</a><br>\n<a href=\"#NOTES\">NOTES</a><br>\n<a href=\"#BUGS\">BUGS</a><br>\n<a href=\"#SEE ALSO\">SEE ALSO</a><br>\n\n<hr>\n<a name=\"NAME\"></a>\n<h2>NAME</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>gif2tiff &minus; create a <small>TIFF</small> file from a\nGIF87 format image file</p>\n</td>\n</table>\n<a name=\"SYNOPSIS\"></a>\n<h2>SYNOPSIS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>gif2tiff</b> [ <i>options</i> ] <i>input.gif\noutput.tif</i></p>\n</td>\n</table>\n<a name=\"DESCRIPTION\"></a>\n<h2>DESCRIPTION</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><i>Gif2tiff</i> converts a file in the GIF87 format to\n<small>TIFF.</small> The <small>TIFF</small> image is\ncreated as a palette image, with samples compressed with the\nLempel-Ziv &amp; Welch algorithm (<i>Compression</i>=5).\nThese characteristics can overridden, or explicitly\nspecified with the options described below.</p>\n</td>\n</table>\n<a name=\"OPTIONS\"></a>\n<h2>OPTIONS</h2>\n<!-- TABS -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"5\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;c</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Specify a compression scheme to use when writing image\ndata: <b>&minus;c none</b> for no compression, <b>&minus;c\npackbits</b> for the PackBits compression algorithm,\n<b>&minus;c zip</b> for the Deflate compression algorithm,\nand <b>&minus;c lzw</b> for Lempel-Ziv &amp; Welch (the\ndefault).</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;r</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Write data with a specified number of rows per strip; by\ndefault the number of rows/strip is selected so that each\nstrip is approximately 8 kilobytes.</p>\n</td>\n<td width=\"0%\">\n</td>\n</table>\n<a name=\"NOTES\"></a>\n<h2>NOTES</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>The program is based on Paul Haeberli&rsquo;s\n<i>fromgif</i> program which, in turn, is based on Marcel\nJ.E. Mol&rsquo;s GIF reader.</p>\n</td>\n</table>\n<a name=\"BUGS\"></a>\n<h2>BUGS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>Should have more options to control output format.</p>\n</td>\n</table>\n<a name=\"SEE ALSO\"></a>\n<h2>SEE ALSO</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>pal2rgb</b>(1), <b>tiffinfo</b>(1), <b>tiffcp</b>(1),\n<b>tiffmedian</b>(1), <b>libtiff</b>(3)</p>\n<!-- INDENTATION -->\n<p>Libtiff library home page:\n<b>http://www.remotesensing.org/libtiff/</b></p>\n</td>\n</table>\n<hr>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/index.html",
    "content": "<HTML><HEAD><TITLE>Libtiff HTML manpage index</TITLE></HEAD><BODY BGCOLOR=white><ul><H2>Man Pages</h2><p>\n<li><A HREF=TIFFbuffer.3tiff.html>TIFFbuffer.3tiff.html</a>\n<li><A HREF=TIFFClose.3tiff.html>TIFFClose.3tiff.html</a>\n<li><A HREF=TIFFcodec.3tiff.html>TIFFcodec.3tiff.html</a>\n<li><A HREF=TIFFcolor.3tiff.html>TIFFcolor.3tiff.html</a>\n<li><A HREF=TIFFDataWidth.3tiff.html>TIFFDataWidth.3tiff.html</a>\n<li><A HREF=TIFFError.3tiff.html>TIFFError.3tiff.html</a>\n<li><A HREF=TIFFFlush.3tiff.html>TIFFFlush.3tiff.html</a>\n<li><A HREF=TIFFGetField.3tiff.html>TIFFGetField.3tiff.html</a>\n<li><A HREF=TIFFmemory.3tiff.html>TIFFmemory.3tiff.html</a>\n<li><A HREF=TIFFOpen.3tiff.html>TIFFOpen.3tiff.html</a>\n<li><A HREF=TIFFPrintDirectory.3tiff.html>TIFFPrintDirectory.3tiff.html</a>\n<li><A HREF=TIFFquery.3tiff.html>TIFFquery.3tiff.html</a>\n<li><A HREF=TIFFReadDirectory.3tiff.html>TIFFReadDirectory.3tiff.html</a>\n<li><A HREF=TIFFReadEncodedStrip.3tiff.html>TIFFReadEncodedStrip.3tiff.html</a>\n<li><A HREF=TIFFReadEncodedTile.3tiff.html>TIFFReadEncodedTile.3tiff.html</a>\n<li><A HREF=TIFFReadRawStrip.3tiff.html>TIFFReadRawStrip.3tiff.html</a>\n<li><A HREF=TIFFReadRawTile.3tiff.html>TIFFReadRawTile.3tiff.html</a>\n<li><A HREF=TIFFReadRGBAImage.3tiff.html>TIFFReadRGBAImage.3tiff.html</a>\n<li><A HREF=TIFFReadRGBAStrip.3tiff.html>TIFFReadRGBAStrip.3tiff.html</a>\n<li><A HREF=TIFFReadRGBATile.3tiff.html>TIFFReadRGBATile.3tiff.html</a>\n<li><A HREF=TIFFReadScanline.3tiff.html>TIFFReadScanline.3tiff.html</a>\n<li><A HREF=TIFFReadTile.3tiff.html>TIFFReadTile.3tiff.html</a>\n<li><A HREF=TIFFRGBAImage.3tiff.html>TIFFRGBAImage.3tiff.html</a>\n<li><A HREF=TIFFSetDirectory.3tiff.html>TIFFSetDirectory.3tiff.html</a>\n<li><A HREF=TIFFSetField.3tiff.html>TIFFSetField.3tiff.html</a>\n<li><A HREF=TIFFsize.3tiff.html>TIFFsize.3tiff.html</a>\n<li><A HREF=TIFFstrip.3tiff.html>TIFFstrip.3tiff.html</a>\n<li><A HREF=TIFFswab.3tiff.html>TIFFswab.3tiff.html</a>\n<li><A HREF=TIFFtile.3tiff.html>TIFFtile.3tiff.html</a>\n<li><A HREF=TIFFWarning.3tiff.html>TIFFWarning.3tiff.html</a>\n<li><A HREF=TIFFWriteDirectory.3tiff.html>TIFFWriteDirectory.3tiff.html</a>\n<li><A HREF=TIFFWriteEncodedStrip.3tiff.html>TIFFWriteEncodedStrip.3tiff.html</a>\n<li><A HREF=TIFFWriteEncodedTile.3tiff.html>TIFFWriteEncodedTile.3tiff.html</a>\n<li><A HREF=TIFFWriteRawStrip.3tiff.html>TIFFWriteRawStrip.3tiff.html</a>\n<li><A HREF=TIFFWriteRawTile.3tiff.html>TIFFWriteRawTile.3tiff.html</a>\n<li><A HREF=TIFFWriteScanline.3tiff.html>TIFFWriteScanline.3tiff.html</a>\n<li><A HREF=TIFFWriteTile.3tiff.html>TIFFWriteTile.3tiff.html</a>\n<li><A HREF=fax2ps.1.html>fax2ps.1.html</a>\n<li><A HREF=fax2tiff.1.html>fax2tiff.1.html</a>\n<li><A HREF=gif2tiff.1.html>gif2tiff.1.html</a>\n<li><A HREF=pal2rgb.1.html>pal2rgb.1.html</a>\n<li><A HREF=ppm2tiff.1.html>ppm2tiff.1.html</a>\n<li><A HREF=ras2tiff.1.html>ras2tiff.1.html</a>\n<li><A HREF=raw2tiff.1.html>raw2tiff.1.html</a>\n<li><A HREF=rgb2ycbcr.1.html>rgb2ycbcr.1.html</a>\n<li><A HREF=sgi2tiff.1.html>sgi2tiff.1.html</a>\n<li><A HREF=thumbnail.1.html>thumbnail.1.html</a>\n<li><A HREF=tiff2bw.1.html>tiff2bw.1.html</a>\n<li><A HREF=tiff2pdf.1.html>tiff2pdf.1.html</a>\n<li><A HREF=tiff2ps.1.html>tiff2ps.1.html</a>\n<li><A HREF=tiff2rgba.1.html>tiff2rgba.1.html</a>\n<li><A HREF=tiffcmp.1.html>tiffcmp.1.html</a>\n<li><A HREF=tiffcp.1.html>tiffcp.1.html</a>\n<li><A HREF=tiffcrop.1.html>tiffcrop.1.html</a>\n<li><A HREF=tiffdither.1.html>tiffdither.1.html</a>\n<li><A HREF=tiffdump.1.html>tiffdump.1.html</a>\n<li><A HREF=tiffgt.1.html>tiffgt.1.html</a>\n<li><A HREF=tiffinfo.1.html>tiffinfo.1.html</a>\n<li><A HREF=tiffmedian.1.html>tiffmedian.1.html</a>\n<li><A HREF=tiffset.1.html>tiffset.1.html</a>\n<li><A HREF=tiffsplit.1.html>tiffsplit.1.html</a>\n<li><A HREF=tiffsv.1.html>tiffsv.1.html</a>\n</ul></BODY></HTML>\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/libtiff.3tiff.html",
    "content": "<!-- Creator     : groff version 1.18.1 -->\n<!-- CreationDate: Fri Jul 13 17:43:14 2007 -->\n<html>\n<head>\n<meta name=\"generator\" content=\"groff -Thtml, see www.gnu.org\">\n<meta name=\"Content-Style\" content=\"text/css\">\n<title>INTRO</title>\n</head>\n<body>\n\n<h1 align=center>INTRO</h1>\n<a href=\"#NAME\">NAME</a><br>\n<a href=\"#SYNOPSIS\">SYNOPSIS</a><br>\n<a href=\"#DESCRIPTION\">DESCRIPTION</a><br>\n<a href=\"#DATA TYPES\">DATA TYPES</a><br>\n<a href=\"#LIST OF ROUTINES\">LIST OF ROUTINES</a><br>\n<a href=\"#TAG USAGE\">TAG USAGE</a><br>\n<a href=\"#PSEUDO TAGS\">PSEUDO TAGS</a><br>\n<a href=\"#DIAGNOSTICS\">DIAGNOSTICS</a><br>\n<a href=\"#SEE ALSO\">SEE ALSO</a><br>\n<a href=\"#BUGS\">BUGS</a><br>\n\n<hr>\n<a name=\"NAME\"></a>\n<h2>NAME</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><big>libtiff &minus; introduction to <i>libtiff</i>, a\nlibrary for reading and writing</big> TIFF\n<big>files</big></p>\n</td>\n</table>\n<a name=\"SYNOPSIS\"></a>\n<h2>SYNOPSIS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><big><b>#include &lt;tiffio.h&gt;</b></big></p>\n<!-- INDENTATION -->\n<p><big>cc file.c <b>-ltiff</b></big></p>\n</td>\n</table>\n<a name=\"DESCRIPTION\"></a>\n<h2>DESCRIPTION</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><big><i>libtiff</i> is a library for reading and writing\ndata files encoded with the <i>Tag Image File</i> format,\nRevision 6.0 (or revision 5.0 or revision 4.0). This file\nformat is suitable for archiving multi-color and\nmonochromatic image data.</big></p>\n<!-- INDENTATION -->\n<p><big>The library supports several compression algorithms,\nas indicated by the <i>Compression</i> field, including: no\ncompression (1),</big> CCITT <big>1D Huffman compression\n(2),</big> CCITT <big>Group 3 Facsimile compression\n(3),</big> CCITT <big>Group 4 Facsimile compression (4),\nLempel-Ziv &amp; Welch compression (5), baseline JPEG\ncompression (7), word-aligned 1D Huffman compression\n(32771), and PackBits compression (32773). In addition,\nseveral nonstandard compression algorithms are supported:\nthe 4-bit compression algorithm used by the\n<i>ThunderScan</i> program (32809) (decompression only),\nNeXT&rsquo;s 2-bit compression algorithm (32766)\n(decompression only), an experimental LZ-style algorithm\nknown as Deflate (32946), and an experimental CIE LogLuv\ncompression scheme designed for images with high dynamic\nrange (32845 for LogL and 32845 for LogLuv). Directory\ninformation may be in either little- or big-endian byte\norder&minus;byte swapping is automatically done by the\nlibrary. Data bit ordering may be either Most Significant\nBit (</big> MSB <big>) to Least Significant Bit (</big> LSB\n<big>) or</big> LSB <big>to</big> MSB. <big>Finally, the\nlibrary does not support files in which the\n<i>BitsPerSample</i>, <i>Compression</i>,\n<i>MinSampleValue</i>, or <i>MaxSampleValue</i> fields are\ndefined differently on a per-sample basis (in Rev. 6.0 the\n<i>Compression</i> tag is not defined on a per-sample basis,\nso this is immaterial).</big></p>\n</td>\n</table>\n<a name=\"DATA TYPES\"></a>\n<h2>DATA TYPES</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><big>The library makes extensive use of C typedefs to\npromote portability. Two sets of typedefs are used, one for\ncommunication with clients of the library and one for\ninternal data structures and parsing of the</big> TIFF\n<big>format. The following typedefs are exposed to users\neither through function definitions or through parameters\npassed through the varargs interfaces.</big></p></td>\n</table>\n<!-- TABS -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"3\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"15%\"></td>\n<td width=\"46%\">\n\n<p><big>typedef unsigned short uint16;</big></p>\n</td>\n<td width=\"38%\">\n\n<p><big>16-bit unsigned integer</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"15%\"></td>\n<td width=\"46%\">\n\n<p><big>typedef unsigned &lt;<i>thing</i>&gt;\nuint32;</big></p>\n</td>\n<td width=\"38%\">\n\n<p><big>32-bit unsigned integer</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"15%\"></td>\n<td width=\"46%\">\n\n<p><big>typedef unsigned int ttag_t;</big></p>\n</td>\n<td width=\"38%\">\n\n<p><big>directory tag</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"15%\"></td>\n<td width=\"46%\">\n\n<p><big>typedef uint16 tdir_t;</big></p>\n</td>\n<td width=\"38%\">\n\n<p><big>directory index</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"15%\"></td>\n<td width=\"46%\">\n\n<p><big>typedef uint16 tsample_t;</big></p>\n</td>\n<td width=\"38%\">\n\n<p><big>sample number</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"15%\"></td>\n<td width=\"46%\">\n\n<p><big>typedef uint32 tstrip_t;</big></p>\n</td>\n<td width=\"38%\">\n\n<p><big>strip number</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"15%\"></td>\n<td width=\"46%\">\n\n<p><big>typedef uint32 ttile_t;</big></p>\n</td>\n<td width=\"38%\">\n\n<p><big>tile number</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"15%\"></td>\n<td width=\"46%\">\n\n<p><big>typedef int32 tsize_t;</big></p>\n</td>\n<td width=\"38%\">\n\n<p><big>i/o size in bytes</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"15%\"></td>\n<td width=\"46%\">\n\n<p><big>typedef void* tdata_t;</big></p>\n</td>\n<td width=\"38%\">\n\n<p><big>image data ref</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"15%\"></td>\n<td width=\"46%\">\n\n<p><big>typedef void* thandle_t;</big></p>\n</td>\n<td width=\"38%\">\n\n<p><big>client data handle</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"15%\"></td>\n<td width=\"46%\">\n\n<p><big>typedef int32 toff_t;</big></p>\n</td>\n<td width=\"38%\">\n\n<p><big>file offset</big></p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><big>Note that <i>tstrip_t</i>, <i>ttile_t</i>, and\n<i>tsize_t</i> are constrained to be no more than 32-bit\nquantities by 32-bit fields they are stored in in the</big>\nTIFF <big>image. Likewise <i>tsample_t</i> is limited by the\n16-bit field used to store the <i>SamplesPerPixel</i> tag.\n<i>tdir_t</i> constrains the maximum number of</big> IFDs\n<big>that may appear in an image and may be an arbitrary\nsize (w/o penalty). <i>ttag_t</i> must be either int,\nunsigned int, pointer, or double because the library uses a\nvarargs interface and</big> ANSI C <big>restricts the type\nof the parameter before an ellipsis to be a promoted type.\n<i>toff_t</i> is defined as int32 because TIFF file offsets\nare (unsigned) 32-bit quantities. A signed value is used\nbecause some interfaces return &minus;1 on error. Finally,\nnote that user-specified data references are passed as\nopaque handles and only cast at the lowest layers where\ntheir type is presumed.</big></p>\n</td>\n</table>\n<a name=\"LIST OF ROUTINES\"></a>\n<h2>LIST OF ROUTINES</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><big>The following routines are part of the library.\nConsult specific manual pages for details on their\noperation; on most systems doing &lsquo;&lsquo;man\nfunction-name&rsquo;&rsquo; will work.</big></p></td>\n</table>\n<!-- TABS -->\n\n<p><big><i>Name Description</i></big></p>\n<!-- TABS -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"3\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFCheckpointDirectory</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>writes the current state of the directory</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFCheckTile</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>very x,y,z,sample is within image</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFCIELabToRGBInit</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>initialize CIE L*a*b* 1976 to RGB conversion\nstate</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFCIELabToXYZ</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>perform CIE L*a*b* 1976 to CIE XYZ\nconversion</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFClientOpen</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>open a file for reading or writing</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFClose</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>close an open file</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFComputeStrip</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>return strip containing y,sample</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFComputeTile</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>return tile containing x,y,z,sample</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFCurrentDirectory</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>return index of current directory</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFCurrentRow</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>return index of current scanline</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFCurrentStrip</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>return index of current strip</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFCurrentTile</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>return index of current tile</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFDataWidth</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>return the size of TIFF data types</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFError</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>library error handler</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFFdOpen</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>open a file for reading or writing</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFFileName</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>return name of open file</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFFileno</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>return open file descriptor</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFFindCODEC</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>find standard codec for the specific\nscheme</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFFlush</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>flush all pending writes</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFFlushData</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>flush pending data writes</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFGetBitRevTable</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>return bit reversal table</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFGetField</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>return tag value in current directory</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFGetFieldDefaulted</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>return tag value in current directory</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFGetMode</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>return open file mode</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFGetVersion</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>return library version string</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFIsCODECConfigured</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>check, whether we have working codec</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFIsMSB2LSB</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>return true if image data is being\nreturned</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\"></td>\n<td width=\"67%\">\n\n<p><big>with bit 0 as the most significant bit</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFIsTiled</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>return true if image data is tiled</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFIsByteSwapped</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>return true if image data is byte-swapped</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFNumberOfStrips</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>return number of strips in an image</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFNumberOfTiles</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>return number of tiles in an image</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFOpen</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>open a file for reading or writing</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFPrintDirectory</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>print description of the current\ndirectory</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFReadBufferSetup</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>specify i/o buffer for reading</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFReadDirectory</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>read the next directory</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFReadEncodedStrip</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>read and decode a strip of data</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFReadEncodedTile</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>read and decode a tile of data</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFReadRawStrip</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>read a raw strip of data</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFReadRawTile</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>read a raw tile of data</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFReadRGBAImage</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>read an image into a fixed format raster</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFReadScanline</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>read and decode a row of data</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFReadTile</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>read and decode a tile of data</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFRegisterCODEC</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>override standard codec for the specific\nscheme</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFReverseBits</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>reverse bits in an array of bytes</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFRGBAImageBegin</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>setup decoder state for TIFFRGBAImageGet</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFRGBAImageEnd</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>release TIFFRGBAImage decoder state</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFRGBAImageGet</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>read and decode an image</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFRGBAImageOK</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>is image readable by TIFFRGBAImageGet</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFScanlineSize</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>return size of a scanline</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFSetDirectory</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>set the current directory</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFSetSubDirectory</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>set the current directory</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFSetErrorHandler</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>set error handler function</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFSetField</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>set a tag&rsquo;s value in the current\ndirectory</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFSetWarningHandler</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>set warning handler function</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFStripSize</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>returns size of a strip</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFRawStripSize</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>returns the number of bytes in a raw\nstrip</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFSwabShort</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>swap bytes of short</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFSwabLong</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>swap bytes of long</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFSwabArrayOfShort</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>swap bytes of an array of shorts</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFSwabArrayOfLong</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>swap bytes of an array of longs</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFTileRowSize</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>return size of a row in a tile</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFTileSize</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>return size of a tile</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFUnRegisterCODEC</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>unregisters the codec</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFVGetField</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>return tag value in current directory</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFVGetFieldDefaulted</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>return tag value in current directory</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFVSetField</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>set a tag&rsquo;s value in the current\ndirectory</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFVStripSize</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>returns the number of bytes in a strip</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFWarning</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>library warning handler</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFWriteDirectory</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>write the current directory</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFWriteEncodedStrip</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>compress and write a strip of data</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFWriteEncodedTile</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>compress and write a tile of data</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFWriteRawStrip</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>write a raw strip of data</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFWriteRawTile</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>write a raw tile of data</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFWriteScanline</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>write a scanline of data</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFWriteTile</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>compress and write a tile of data</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFXYZToRGB</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>perform CIE XYZ to RGB conversion</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFYCbCrToRGBInit</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>initialize YCbCr to RGB conversion state</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>TIFFYCbCrtoRGB</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>perform YCbCr to RGB conversion</big></p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><big>Auxiliary functions:</big></p></td>\n</table>\n<!-- TABS -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"3\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>_TIFFfree</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>free memory buffer</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>_TIFFmalloc</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>dynamically allocate memory buffer</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>_TIFFmemcmp</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>compare contents of the memory buffers</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>_TIFFmemcpy</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>copy contents of the one buffer to\nanother</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>_TIFFmemset</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>fill memory buffer with a constant byte</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"23%\">\n\n<p><big>_TIFFrealloc</big></p>\n</td>\n<td width=\"67%\">\n\n<p><big>dynamically reallocate memory buffer</big></p>\n</td>\n</table>\n<a name=\"TAG USAGE\"></a>\n<h2>TAG USAGE</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><big>The table below lists the</big> TIFF <big>tags that\nare recognized and handled by the library. If no use is\nindicated in the table, then the library reads and writes\nthe tag, but does not use it internally. Note that some tags\nare meaningful only when a particular compression scheme is\nbeing used; e.g. <i>Group3Options</i> is only useful if\n<i>Compression</i> is set to</big> CCITT <big>Group 3\nencoding. Tags of this sort are considered\n<i>codec-specific</i> tags and the library does not\nrecognize them except when the <i>Compression</i> tag has\nbeen previously set to the relevant compression\nscheme.</big></p>\n<!-- INDENTATION -->\n<pre><big><i>Tag Name                Value  R/W  Library Use/Notes\n</i></big></pre>\n</td>\n</table>\n<!-- TABS -->\n\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"5\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>Artist</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>315</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>BadFaxLines</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>326</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>BitsPerSample</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>258</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\"></td>\n<td width=\"8%\"></td>\n<td width=\"6%\"></td>\n<td width=\"53%\">\n\n<p><big>lots</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>CellLength</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>265</big></p>\n</td>\n<td width=\"53%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\"></td>\n<td width=\"8%\"></td>\n<td width=\"6%\"></td>\n<td width=\"53%\">\n\n<p><big>parsed but ignored</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>CellWidth</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>264</big></p>\n</td>\n<td width=\"53%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\"></td>\n<td width=\"8%\"></td>\n<td width=\"6%\"></td>\n<td width=\"53%\">\n\n<p><big>parsed but ignored</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>CleanFaxData</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>327</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>ColorMap</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>320</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>ColorResponseUnit</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>300</big></p>\n</td>\n<td width=\"53%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\"></td>\n<td width=\"8%\"></td>\n<td width=\"6%\"></td>\n<td width=\"53%\">\n\n<p><big>parsed but ignored</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>Compression</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>259</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\"></td>\n<td width=\"8%\"></td>\n<td width=\"6%\"></td>\n<td width=\"53%\">\n\n<p><big>choosing codec</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>ConsecutiveBadFaxLines</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>328</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><big>Copyright 33432 R/W</big></p></td>\n</table>\n<!-- TABS -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"5\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>DataType</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>32996</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\"></td>\n<td width=\"8%\"></td>\n<td width=\"6%\"></td>\n<td width=\"53%\">\n\n<p><big>obsoleted by SampleFormat tag</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>DateTime</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>306</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>DocumentName</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>269</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>DotRange</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>336</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>ExtraSamples</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>338</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\"></td>\n<td width=\"8%\"></td>\n<td width=\"6%\"></td>\n<td width=\"53%\">\n\n<p><big>lots</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>FaxRecvParams</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>34908</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>FaxSubAddress</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>34909</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>FaxRecvTime</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>34910</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>FillOrder</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>266</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\"></td>\n<td width=\"8%\"></td>\n<td width=\"6%\"></td>\n<td width=\"53%\">\n\n<p><big>control bit order</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>FreeByteCounts</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>289</big></p>\n</td>\n<td width=\"53%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\"></td>\n<td width=\"8%\"></td>\n<td width=\"6%\"></td>\n<td width=\"53%\">\n\n<p><big>parsed but ignored</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>FreeOffsets</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>288</big></p>\n</td>\n<td width=\"53%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\"></td>\n<td width=\"8%\"></td>\n<td width=\"6%\"></td>\n<td width=\"53%\">\n\n<p><big>parsed but ignored</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>GrayResponseCurve</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>291</big></p>\n</td>\n<td width=\"53%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\"></td>\n<td width=\"8%\"></td>\n<td width=\"6%\"></td>\n<td width=\"53%\">\n\n<p><big>parsed but ignored</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>GrayResponseUnit</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>290</big></p>\n</td>\n<td width=\"53%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\"></td>\n<td width=\"8%\"></td>\n<td width=\"6%\"></td>\n<td width=\"53%\">\n\n<p><big>parsed but ignored</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>Group3Options</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>292</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\"></td>\n<td width=\"8%\"></td>\n<td width=\"6%\"></td>\n<td width=\"53%\">\n\n<p><big>used by Group 3 codec</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>Group4Options</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>293</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>HostComputer</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>316</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>ImageDepth</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>32997</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\"></td>\n<td width=\"8%\"></td>\n<td width=\"6%\"></td>\n<td width=\"53%\">\n\n<p><big>tile/strip calculations</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>ImageDescription</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>270</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>ImageLength</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>257</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\"></td>\n<td width=\"8%\"></td>\n<td width=\"6%\"></td>\n<td width=\"53%\">\n\n<p><big>lots</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>ImageWidth</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>256</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\"></td>\n<td width=\"8%\"></td>\n<td width=\"6%\"></td>\n<td width=\"53%\">\n\n<p><big>lots</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>InkNames</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>333</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>InkSet</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>332</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>JPEGTables</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>347</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\"></td>\n<td width=\"8%\"></td>\n<td width=\"6%\"></td>\n<td width=\"53%\">\n\n<p><big>used by JPEG codec</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>Make</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>271</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>Matteing</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>32995</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\"></td>\n<td width=\"8%\"></td>\n<td width=\"6%\"></td>\n<td width=\"53%\">\n\n<p><big>obsoleted by ExtraSamples tag</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>MaxSampleValue</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>281</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>MinSampleValue</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>280</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>Model</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>272</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>NewSubFileType</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>254</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\"></td>\n<td width=\"8%\"></td>\n<td width=\"6%\"></td>\n<td width=\"53%\">\n\n<p><big>called SubFileType in spec</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>NumberOfInks</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>334</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>Orientation</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>274</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>PageName</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>285</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>PageNumber</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>297</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>PhotometricInterpretation</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\"></td>\n<td width=\"53%\">\n\n<p><big>262</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\"></td>\n<td width=\"8%\"></td>\n<td width=\"6%\"></td>\n<td width=\"53%\">\n\n<p><big>R/Wused by Group 3 and JPEG codecs</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>PlanarConfiguration</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>284</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\"></td>\n<td width=\"8%\"></td>\n<td width=\"6%\"></td>\n<td width=\"53%\">\n\n<p><big>data i/o</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>Predictor</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>317</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\"></td>\n<td width=\"8%\"></td>\n<td width=\"6%\"></td>\n<td width=\"53%\">\n\n<p><big>used by LZW and Deflate codecs</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>PrimaryChromacities</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>319</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>ReferenceBlackWhite</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>532</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>ResolutionUnit</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>296</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\"></td>\n<td width=\"8%\"></td>\n<td width=\"6%\"></td>\n<td width=\"53%\">\n\n<p><big>used by Group 3 codec</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>RowsPerStrip</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>278</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\"></td>\n<td width=\"8%\"></td>\n<td width=\"6%\"></td>\n<td width=\"53%\">\n\n<p><big>data i/o</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>SampleFormat</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>339</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>SamplesPerPixel</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>277</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\"></td>\n<td width=\"8%\"></td>\n<td width=\"6%\"></td>\n<td width=\"53%\">\n\n<p><big>lots</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>SMinSampleValue</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>340</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>SMaxSampleValue</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>341</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>Software</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>305</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>StoNits</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>37439</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>StripByteCounts</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>279</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\"></td>\n<td width=\"8%\"></td>\n<td width=\"6%\"></td>\n<td width=\"53%\">\n\n<p><big>data i/o</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>StripOffsets</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>273</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\"></td>\n<td width=\"8%\"></td>\n<td width=\"6%\"></td>\n<td width=\"53%\">\n\n<p><big>data i/o</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>SubFileType</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>255</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\"></td>\n<td width=\"8%\"></td>\n<td width=\"6%\"></td>\n<td width=\"53%\">\n\n<p><big>called OSubFileType in spec</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>TargetPrinter</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>337</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>Thresholding</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>263</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\"></td>\n<td width=\"8%\"></td>\n<td width=\"6%\"></td>\n<td width=\"53%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>TileByteCounts</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>324</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\"></td>\n<td width=\"8%\"></td>\n<td width=\"6%\"></td>\n<td width=\"53%\">\n\n<p><big>data i/o</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>TileDepth</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>32998</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\"></td>\n<td width=\"8%\"></td>\n<td width=\"6%\"></td>\n<td width=\"53%\">\n\n<p><big>tile/strip calculations</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>TileLength</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>323</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\"></td>\n<td width=\"8%\"></td>\n<td width=\"6%\"></td>\n<td width=\"53%\">\n\n<p><big>data i/o</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>TileOffsets</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>324</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\"></td>\n<td width=\"8%\"></td>\n<td width=\"6%\"></td>\n<td width=\"53%\">\n\n<p><big>data i/o</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>TileWidth</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>322</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\"></td>\n<td width=\"8%\"></td>\n<td width=\"6%\"></td>\n<td width=\"53%\">\n\n<p><big>data i/o</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>TransferFunction</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>301</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>WhitePoint</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>318</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>XPosition</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>286</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>XResolution</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>282</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>YCbCrCoefficients</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>529</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\"></td>\n<td width=\"8%\"></td>\n<td width=\"6%\"></td>\n<td width=\"53%\">\n\n<p><big>used by TIFFRGBAImage support</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>YCbCrPositioning</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>531</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\"></td>\n<td width=\"8%\"></td>\n<td width=\"6%\"></td>\n<td width=\"53%\">\n\n<p><big>tile/strip size calulcations</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>YCbCrSubsampling</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>530</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>YPosition</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>286</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>YResolution</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>283</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\"></td>\n<td width=\"8%\"></td>\n<td width=\"6%\"></td>\n<td width=\"53%\">\n\n<p><big>used by Group 3 codec</big></p>\n</td>\n</table>\n<a name=\"PSEUDO TAGS\"></a>\n<h2>PSEUDO TAGS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><big>In addition to the normal</big> TIFF <big>tags the\nlibrary supports a collection of tags whose values lie in a\nrange outside the valid range of</big> TIFF <big>tags. These\ntags are termed <i>pseud-tags</i> and are used to control\nvarious codec-specific functions within the library. The\ntable below summarizes the defined pseudo-tags.</big></p>\n<!-- INDENTATION -->\n<pre><big><i>Tag Name                Codec  R/W  Library Use/Notes\n</i></big></pre>\n</td>\n</table>\n<!-- TABS -->\n\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"5\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>TIFFTAG_FAXMODE</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>G3</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\"></td>\n<td width=\"8%\"></td>\n<td width=\"6%\"></td>\n<td width=\"53%\">\n\n<p><big>general codec operation</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>TIFFTAG_FAXFILLFUNC</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>G3/G4</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\"></td>\n<td width=\"8%\"></td>\n<td width=\"6%\"></td>\n<td width=\"53%\">\n\n<p><big>bitmap fill function</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>TIFFTAG_JPEGQUALITY</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>JPEG</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\"></td>\n<td width=\"8%\"></td>\n<td width=\"6%\"></td>\n<td width=\"53%\">\n\n<p><big>compression quality control</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>TIFFTAG_JPEGCOLORMODE</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>JPEG</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\"></td>\n<td width=\"8%\"></td>\n<td width=\"6%\"></td>\n<td width=\"53%\">\n\n<p><big>control colorspace conversions</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>TIFFTAG_JPEGTABLESMODE</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>JPEG</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\"></td>\n<td width=\"8%\"></td>\n<td width=\"6%\"></td>\n<td width=\"53%\">\n\n<p><big>control contents of <i>JPEGTables</i> tag</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>TIFFTAG_ZIPQUALITY</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>Deflate</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/Wcompression quality level</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>TIFFTAG_PIXARLOGDATAFMT</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>PixarLog</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/Wuser data format</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>TIFFTAG_PIXARLOGQUALITY</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>PixarLog</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/Wcompression quality level</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\">\n\n<p><big>TIFFTAG_SGILOGDATAFMT</big></p>\n</td>\n<td width=\"8%\"></td>\n<td width=\"6%\">\n\n<p><big>SGILog</big></p>\n</td>\n<td width=\"53%\">\n\n<p><big>R/W</big></p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"21%\"></td>\n<td width=\"8%\"></td>\n<td width=\"6%\"></td>\n<td width=\"53%\">\n\n<p><big>user data format</big></p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><big><b>TIFFTAG_FAXMODE</b></big></p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"19%\"></td>\n<td width=\"80%\">\n<p><big>Control the operation of the Group 3 codec. Possible\nvalues (independent bits that can be combined by\nor&rsquo;ing them together) are: FAXMODE_CLASSIC (enable\nold-style format in which the</big> RTC <big>is written at\nthe end of the last strip), FAXMODE_NORTC (opposite of\nFAXMODE_CLASSIC; also called FAXMODE_CLASSF), FAXMODE_NOEOL\n(do not write</big> EOL <big>codes at the start of each row\nof data), FAXMODE_BYTEALIGN (align each encoded row to an\n8-bit boundary), FAXMODE_WORDALIGN (align each encoded row\nto an 16-bit boundary), The default value is dependent on\nthe compression scheme; this pseudo-tag is used by the\nvarious G3 and G4 codecs to share code.</big></p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><big><b>TIFFTAG_FAXFILLFUNC</b></big></p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"19%\"></td>\n<td width=\"80%\">\n<p><big>Control the function used to convert arrays of black\nand white runs to packed bit arrays. This hook can be used\nto image decoded scanlines in multi-bit depth rasters (e.g.\nfor display in colormap mode) or for other purposes. The\ndefault value is a pointer to a builtin function that images\npacked bilevel data.</big></p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><big><b>TIFFTAG_IPTCNEWSPHOTO</b></big></p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"19%\"></td>\n<td width=\"80%\">\n<p><big>Tag contaings image metadata per the IPTC newsphoto\nspec: Headline, captioning, credit, etc... Used by most wire\nservices.</big></p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><big><b>TIFFTAG_PHOTOSHOP</b></big></p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"19%\"></td>\n<td width=\"80%\">\n<p><big>Tag contains Photoshop captioning information and\nmetadata. Photoshop uses in parallel and redundantly\nalongside IPTCNEWSPHOTO information.</big></p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><big><b>TIFFTAG_JPEGQUALITY</b></big></p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"19%\"></td>\n<td width=\"80%\">\n<p><big>Control the compression quality level used in the\nbaseline algorithm. Note that quality levels are in the\nrange 0-100 with a default value of 75.</big></p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><big><b>TIFFTAG_JPEGCOLORMODE</b></big></p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"19%\"></td>\n<td width=\"80%\">\n<p><big>Control whether or not conversion is done between\nRGB and YCbCr colorspaces. Possible values are:\nJPEGCOLORMODE_RAW (do not convert), and JPEGCOLORMODE_RGB\n(convert to/from RGB) The default value is\nJPEGCOLORMODE_RAW.</big></p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><big><b>TIFFTAG_JPEGTABLESMODE</b></big></p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"19%\"></td>\n<td width=\"80%\">\n<p><big>Control the information written in the\n<i>JPEGTables</i> tag. Possible values (independent bits\nthat can be combined by or&rsquo;ing them together) are:\nJPEGTABLESMODE_QUANT (include quantization tables), and\nJPEGTABLESMODE_HUFF (include Huffman encoding tables). The\ndefault value is\nJPEGTABLESMODE_QUANT|JPEGTABLESMODE_HUFF.</big></p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><big><b>TIFFTAG_ZIPQUALITY</b></big></p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"19%\"></td>\n<td width=\"80%\">\n<p><big>Control the compression technique used by the\nDeflate codec. Quality levels are in the range 1-9 with\nlarger numbers yielding better compression at the cost of\nmore computation. The default quality level is 6 which\nyields a good time-space tradeoff.</big></p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><big><b>TIFFTAG_PIXARLOGDATAFMT</b></big></p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"19%\"></td>\n<td width=\"80%\">\n<p><big>Control the format of user data passed <i>in</i> to\nthe PixarLog codec when encoding and passed <i>out</i> from\nwhen decoding. Possible values are: PIXARLOGDATAFMT_8BIT for\n8-bit unsigned pixels, PIXARLOGDATAFMT_8BITABGR for 8-bit\nunsigned ABGR-ordered pixels, PIXARLOGDATAFMT_11BITLOG for\n11-bit log-encoded raw data, PIXARLOGDATAFMT_12BITPICIO for\n12-bit PICIO-compatible data, PIXARLOGDATAFMT_16BIT for\n16-bit signed samples, and PIXARLOGDATAFMT_FLOAT for 32-bit\nIEEE floating point samples.</big></p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><big><b>TIFFTAG_PIXARLOGQUALITY</b></big></p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"19%\"></td>\n<td width=\"80%\">\n<p><big>Control the compression technique used by the\nPixarLog codec. This value is treated identically to\nTIFFTAG_ZIPQUALITY; see the above description.</big></p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><big><b>TIFFTAG_SGILOGDATAFMT</b></big></p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"19%\"></td>\n<td width=\"80%\">\n<p><big>Control the format of client data passed <i>in</i>\nto the SGILog codec when encoding and passed <i>out</i> from\nwhen decoding. Possible values are: SGILOGDATAFMT_FLTXYZ for\nconverting between LogLuv and 32-bit IEEE floating valued\nXYZ pixels, SGILOGDATAFMT_16BITLUV for 16-bit encoded Luv\npixels, SGILOGDATAFMT_32BITRAW and SGILOGDATAFMT_24BITRAW\nfor no conversion of data, SGILOGDATAFMT_8BITRGB for\nreturning 8-bit RGB data (valid only when decoding\nLogLuv-encoded data), SGILOGDATAFMT_FLTY for converting\nbetween LogL and 32-bit IEEE floating valued Y pixels,\nSGILOGDATAFMT_16BITL for 16-bit encoded L pixels, and\nSGILOGDATAFMT_8BITGRY for returning 8-bit greyscale data\n(valid only when decoding LogL-encoded data).</big></p>\n</td>\n</table>\n<a name=\"DIAGNOSTICS\"></a>\n<h2>DIAGNOSTICS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><big>All error messages are directed through the\n<i>TIFFError</i> routine. By default messages are directed\nto <b>stderr</b> in the form: <i>module: message\\n.</i>\nWarning messages are likewise directed through the\n<i>TIFFWarning</i> routine.</big></p>\n</td>\n</table>\n<a name=\"SEE ALSO\"></a>\n<h2>SEE ALSO</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><big><b>fax2tiff</b>(1), <b>gif2tiff</b>(1),\n<b>pal2rgb</b>(1), <b>ppm2tiff</b>(1), <b>rgb2ycbcr</b>(1),\n<b>ras2tiff</b>(1), <b>raw2tiff</b>(1), <b>sgi2tiff</b>(1),\n<b>tiff2bw</b>(1), <b>tiffdither</b>(1), <b>tiffdump</b>(1),\n<b>tiffcp</b>(1), <b>tiffcmp</b>(1), <b>tiffgt</b>(1),\n<b>tiffinfo</b>(1), <b>tiffmedian</b>(1),\n<b>tiffsplit</b>(1), <b>tiffsv</b>(1).</big></p>\n<!-- INDENTATION -->\n<p><big><b>Tag Image File Format Specification &mdash;\nRevision 6.0</b>, an Aldus Technical Memorandum.</big></p>\n<!-- INDENTATION -->\n<p><big><b>The Spirit of TIFF Class F</b>, an appendix to\nthe TIFF 5.0 specification prepared by Cygnet\nTechnologies.</big></p>\n<!-- INDENTATION -->\n<p><big>Libtiff library home page:\n<b>http://www.remotesensing.org/libtiff/</b></big></p>\n</td>\n</table>\n<a name=\"BUGS\"></a>\n<h2>BUGS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><big>The library does not support multi-sample images\nwhere some samples have different bits/sample.</big></p>\n<!-- INDENTATION -->\n<p><big>The library does not support random access to\ncompressed data that is organized with more than one row per\ntile or strip.</big></p>\n</td>\n</table>\n<hr>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/pal2rgb.1.html",
    "content": "<!-- Creator     : groff version 1.18.1 -->\n<!-- CreationDate: Fri Jul 13 17:43:18 2007 -->\n<html>\n<head>\n<meta name=\"generator\" content=\"groff -Thtml, see www.gnu.org\">\n<meta name=\"Content-Style\" content=\"text/css\">\n<title>PAL2RGB</title>\n</head>\n<body>\n\n<h1 align=center>PAL2RGB</h1>\n<a href=\"#NAME\">NAME</a><br>\n<a href=\"#SYNOPSIS\">SYNOPSIS</a><br>\n<a href=\"#DESCRIPTION\">DESCRIPTION</a><br>\n<a href=\"#OPTIONS\">OPTIONS</a><br>\n<a href=\"#BUGS\">BUGS</a><br>\n<a href=\"#SEE ALSO\">SEE ALSO</a><br>\n\n<hr>\n<a name=\"NAME\"></a>\n<h2>NAME</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>pal2rgb &minus; convert a palette color\n<small>TIFF</small> image to a full color image</p>\n</td>\n</table>\n<a name=\"SYNOPSIS\"></a>\n<h2>SYNOPSIS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>pal2rgb</b> [ <i>options</i> ] <i>input.tif\noutput.tif</i></p>\n</td>\n</table>\n<a name=\"DESCRIPTION\"></a>\n<h2>DESCRIPTION</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><i>Pal2rgb</i> converts a palette color\n<small>TIFF</small> image to a full color image by applying\nthe colormap of the palette image to each sample to generate\na full color <small>RGB</small> image.</p>\n</td>\n</table>\n<a name=\"OPTIONS\"></a>\n<h2>OPTIONS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>Options that affect the interpretation of input data\nare:</p>\n</td>\n</table>\n<!-- TABS -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"5\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"></td>\n<td width=\"2%\">\n\n<p><b>&minus;C</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>This option overrides the default behavior of\n<i>pal2rgb</i> in determining whether or not colormap\nentries contain 16-bit or 8-bit values. By default the\ncolormap is inspected and if no colormap entry greater than\n255 is found, the colormap is assumed to have only 8-bit\nvalues; otherwise 16-bit values (as required by the\n<small>TIFF</small> specification) are assumed. The\n<b>&minus;C</b> option can be used to explicitly specify the\nnumber of bits for colormap entries: <b>&minus;C 8</b> for\n8-bit values, <b>&minus;C 16</b> for 16-bit values.</p>\n</td>\n<td width=\"0%\">\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>Options that affect the output file format are:</p>\n</td>\n</table>\n<!-- TABS -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"5\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"5%\">\n\n<p><b>&minus;p</b></p>\n</td>\n<td width=\"3%\"></td>\n<td width=\"80%\">\n\n<p>Explicitly select the planar configuration used in\norganizing data samples in the output image: <b>&minus;p\ncontig</b> for samples packed contiguously, and <b>&minus;p\nseparate</b> for samples stored separately. By default\nsamples are packed.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"5%\">\n\n<p><b>&minus;c</b></p>\n</td>\n<td width=\"3%\"></td>\n<td width=\"80%\">\n\n<p>Use the specific compression algorithm to encoded image\ndata in the output file: <b>&minus;c packbits</b> for\nMacintosh Packbits, <b>&minus;c lzw</b> for Lempel-Ziv &amp;\nWelch, <b>&minus;c zip</b> for Deflate, <b>&minus;c none</b>\nfor no compression. If no compression-related option is\nspecified, the input file&rsquo;s compression algorithm is\nused.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"5%\">\n\n<p><b>&minus;r</b></p>\n</td>\n<td width=\"3%\"></td>\n<td width=\"80%\">\n\n<p>Explicitly specify the number of rows in each strip of\nthe output file. If the <b>&minus;r</b> option is not\nspecified, a number is selected such that each output strip\nhas approximately 8 kilobytes of data in it.</p>\n</td>\n<td width=\"0%\">\n</td>\n</table>\n<a name=\"BUGS\"></a>\n<h2>BUGS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>Only 8-bit images are handled.</p>\n</td>\n</table>\n<a name=\"SEE ALSO\"></a>\n<h2>SEE ALSO</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>tiffinfo</b>(1), <b>tiffcp</b>(1),\n<b>tiffmedian</b>(1), <b>libtiff</b>(3)</p>\n<!-- INDENTATION -->\n<p>Libtiff library home page:\n<b>http://www.remotesensing.org/libtiff/</b></p>\n</td>\n</table>\n<hr>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/ppm2tiff.1.html",
    "content": "<!-- Creator     : groff version 1.18.1 -->\n<!-- CreationDate: Fri Jul 13 17:43:18 2007 -->\n<html>\n<head>\n<meta name=\"generator\" content=\"groff -Thtml, see www.gnu.org\">\n<meta name=\"Content-Style\" content=\"text/css\">\n<title>PPM2TIFF</title>\n</head>\n<body>\n\n<h1 align=center>PPM2TIFF</h1>\n<a href=\"#NAME\">NAME</a><br>\n<a href=\"#SYNOPSIS\">SYNOPSIS</a><br>\n<a href=\"#DESCRIPTION\">DESCRIPTION</a><br>\n<a href=\"#OPTIONS\">OPTIONS</a><br>\n<a href=\"#SEE ALSO\">SEE ALSO</a><br>\n\n<hr>\n<a name=\"NAME\"></a>\n<h2>NAME</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>ppm2tiff &minus; create a <small>TIFF</small> file from\n<small>PPM, PGM</small> and <small>PBM</small> image\nfiles</p>\n</td>\n</table>\n<a name=\"SYNOPSIS\"></a>\n<h2>SYNOPSIS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>ppm2tiff</b> [ <i>options</i> ] [ <i>input.ppm</i> ]\n<i>output.tif</i></p>\n</td>\n</table>\n<a name=\"DESCRIPTION\"></a>\n<h2>DESCRIPTION</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><i>ppm2tiff</i> converts a file in the <small>PPM,\nPGM</small> and <small>PBM</small> image formats to\n<small>TIFF.</small> By default, the <small>TIFF</small>\nimage is created with data samples packed\n(<i>PlanarConfiguration</i>=1), compressed with the Packbits\nalgorithm (<i>Compression</i>=32773), and with each strip no\nmore than 8 kilobytes. These characteristics can be\noverridden, or explicitly specified with the options\ndescribed below</p>\n<!-- INDENTATION -->\n<p>If the <small>PPM</small> file contains greyscale data,\nthen the <i>PhotometricInterpretation</i> tag is set to 1\n(min-is-black), otherwise it is set to 2 (RGB).</p>\n<!-- INDENTATION -->\n<p>If no <small>PPM</small> file is specified on the command\nline, <i>ppm2tiff</i> will read from the standard input.</p>\n</td>\n</table>\n<a name=\"OPTIONS\"></a>\n<h2>OPTIONS</h2>\n<!-- TABS -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"5\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;c</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Specify a compression scheme to use when writing image\ndata: <b>none</b> for no compression, <b>packbits</b> for\nPackBits compression (will be used by default), <b>lzw</b>\nfor Lempel-Ziv &amp; Welch compression, <b>jpeg</b> for\nbaseline JPEG compression, <b>zip</b> for Deflate\ncompression, <b>g3</b> for CCITT Group 3 (T.4) compression,\nand <b>g4</b> for CCITT Group 4 (T.6) compression.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;r</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Write data with a specified number of rows per strip; by\ndefault the number of rows/strip is selected so that each\nstrip is approximately 8 kilobytes.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;R</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Mark the resultant image to have the specified X and Y\nresolution (in dots/inch).</p>\n</td>\n<td width=\"0%\">\n</td>\n</table>\n<a name=\"SEE ALSO\"></a>\n<h2>SEE ALSO</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>tiffinfo</b>(1), <b>tiffcp</b>(1),\n<b>tiffmedian</b>(1), <b>libtiff</b>(3)</p>\n<!-- INDENTATION -->\n<p>Libtiff library home page:\n<b>http://www.remotesensing.org/libtiff/</b></p>\n</td>\n</table>\n<hr>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/ras2tiff.1.html",
    "content": "<!-- Creator     : groff version 1.18.1 -->\n<!-- CreationDate: Fri Jul 13 17:43:18 2007 -->\n<html>\n<head>\n<meta name=\"generator\" content=\"groff -Thtml, see www.gnu.org\">\n<meta name=\"Content-Style\" content=\"text/css\">\n<title>RAS2TIFF</title>\n</head>\n<body>\n\n<h1 align=center>RAS2TIFF</h1>\n<a href=\"#NAME\">NAME</a><br>\n<a href=\"#SYNOPSIS\">SYNOPSIS</a><br>\n<a href=\"#DESCRIPTION\">DESCRIPTION</a><br>\n<a href=\"#OPTIONS\">OPTIONS</a><br>\n<a href=\"#BUGS\">BUGS</a><br>\n<a href=\"#SEE ALSO\">SEE ALSO</a><br>\n\n<hr>\n<a name=\"NAME\"></a>\n<h2>NAME</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>ras2tiff &minus; create a <small>TIFF</small> file from a\nSun rasterfile</p>\n</td>\n</table>\n<a name=\"SYNOPSIS\"></a>\n<h2>SYNOPSIS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>ras2tiff</b> [ <i>options</i> ] <i>input.ras\noutput.tif</i></p>\n</td>\n</table>\n<a name=\"DESCRIPTION\"></a>\n<h2>DESCRIPTION</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><i>ras2tiff</i> converts a file in the Sun rasterfile\nformat to <small>TIFF.</small> By default, the\n<small>TIFF</small> image is created with data samples\npacked (<i>PlanarConfiguration</i>=1), compressed with the\nLempel-Ziv &amp; Welch algorithm (<i>Compression</i>=5), and\nwith each strip no more than 8 kilobytes. These\ncharacteristics can overridden, or explicitly specified with\nthe options described below.</p>\n<!-- INDENTATION -->\n<p>Any colormap information in the rasterfile is carried\nover to the <small>TIFF</small> file by including a\n<i>Colormap</i> tag in the output file. If the rasterfile\nhas a colormap, the <i>PhotometricInterpretation</i> tag is\nset to 3 (palette); otherwise it is set to 2 (RGB) if the\ndepth is 24 or 1 (min-is-black) if the depth is not 24.</p>\n</td>\n</table>\n<a name=\"OPTIONS\"></a>\n<h2>OPTIONS</h2>\n<!-- TABS -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"5\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"2%\">\n\n<p><b>&minus;c</b></p>\n</td>\n<td width=\"6%\"></td>\n<td width=\"80%\">\n\n<p>Specify a compression scheme to use when writing image\ndata: <b>&minus;c none</b> for no compression, <b>&minus;c\npackbits</b> for the PackBits compression algorithm,\n<b>&minus;c jpeg</b> for the baseline JPEG compression\nalgorithm, <b>&minus;c zip</b> for the Deflate compression\nalgorithm, and <b>&minus;c lzw</b> for Lempel-Ziv &amp;\nWelch (the default).</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"2%\">\n\n<p><b>&minus;r</b></p>\n</td>\n<td width=\"6%\"></td>\n<td width=\"80%\">\n\n<p>Write data with a specified number of rows per strip; by\ndefault the number of rows/strip is selected so that each\nstrip is approximately 8 kilobytes.</p>\n</td>\n<td width=\"0%\">\n</td>\n</table>\n<a name=\"BUGS\"></a>\n<h2>BUGS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>Does not handle all possible rasterfiles. In particular,\n<i>ras2tiff</i> does not handle run-length encoded\nimages.</p>\n</td>\n</table>\n<a name=\"SEE ALSO\"></a>\n<h2>SEE ALSO</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>pal2rgb</b>(1), <b>tiffinfo</b>(1), <b>tiffcp</b>(1),\n<b>tiffmedian</b>(1), <b>libtiff</b>(3)</p>\n<!-- INDENTATION -->\n<p>Libtiff library home page:\n<b>http://www.remotesensing.org/libtiff/</b></p>\n</td>\n</table>\n<hr>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/raw2tiff.1.html",
    "content": "<!-- Creator     : groff version 1.18.1 -->\n<!-- CreationDate: Fri Jul 13 17:43:18 2007 -->\n<html>\n<head>\n<meta name=\"generator\" content=\"groff -Thtml, see www.gnu.org\">\n<meta name=\"Content-Style\" content=\"text/css\">\n<title>RAW2TIFF</title>\n</head>\n<body>\n\n<h1 align=center>RAW2TIFF</h1>\n<a href=\"#NAME\">NAME</a><br>\n<a href=\"#SYNOPSIS\">SYNOPSIS</a><br>\n<a href=\"#DESCRIPTION\">DESCRIPTION</a><br>\n<a href=\"#OPTIONS\">OPTIONS</a><br>\n<a href=\"#GUESSING THE IMAGE GEOMETRY\">GUESSING THE IMAGE GEOMETRY</a><br>\n<a href=\"#SEE ALSO\">SEE ALSO</a><br>\n\n<hr>\n<a name=\"NAME\"></a>\n<h2>NAME</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>raw2tiff &minus; create a <small>TIFF</small> file from a\nraw data</p>\n</td>\n</table>\n<a name=\"SYNOPSIS\"></a>\n<h2>SYNOPSIS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>raw2tiff</b> [ <i>options</i> ] <i>input.raw\noutput.tif</i></p>\n</td>\n</table>\n<a name=\"DESCRIPTION\"></a>\n<h2>DESCRIPTION</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><i>raw2tiff</i> converts a raw byte sequence into\n<small>TIFF.</small> By default, the <small>TIFF</small>\nimage is created with data samples packed\n(<i>PlanarConfiguration</i>=1), compressed with the PackBits\nalgorithm (<i>Compression</i>=32773), and with each strip no\nmore than 8 kilobytes. These characteristics can overridden,\nor explicitly specified with the options described\nbelow.</p>\n</td>\n</table>\n<a name=\"OPTIONS\"></a>\n<h2>OPTIONS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>&minus;H</b> <i>number</i></p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"19%\"></td>\n<td width=\"80%\">\n<p>size of input image file header in bytes (0 by default).\nThis amount of data just will be skipped from the start of\nfile while reading.</p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>&minus;w</b> <i>number</i></p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"19%\"></td>\n<td width=\"80%\">\n<p>width of input image in pixels (can be guessed, see\n<b><small>GUESSING THE IMAGE GEOMETRY</small></b>\nbelow).</p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>&minus;l</b> <i>number</i></p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"19%\"></td>\n<td width=\"80%\">\n<p>length of input image in lines (can be guessed, see\n<b><small>GUESSING THE IMAGE GEOMETRY</small></b>\nbelow).</p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>&minus;b</b> <i>number</i></p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"19%\"></td>\n<td width=\"80%\">\n<p>number of bands in input image (1 by default).</p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>&minus;d</b> <i>data_type</i></p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"19%\"></td>\n<td width=\"80%\">\n<p>type of samples in input image, where <i>data_type</i>\nmay be:</p></td>\n</table>\n<!-- TABS -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"3\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"19%\"></td>\n<td width=\"10%\">\n\n<p><b>byte</b></p>\n</td>\n<td width=\"70%\">\n\n<p>8-bit unsigned integer (default),</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"19%\"></td>\n<td width=\"10%\">\n\n<p><b>short</b></p>\n</td>\n<td width=\"70%\">\n\n<p>16-bit unsigned integer,</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"19%\"></td>\n<td width=\"10%\">\n\n<p><b>long</b></p>\n</td>\n<td width=\"70%\">\n\n<p>32-bit unsigned integer,</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"19%\"></td>\n<td width=\"10%\">\n\n<p><b>sbyte</b></p>\n</td>\n<td width=\"70%\">\n\n<p>8-bit signed integer,</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"19%\"></td>\n<td width=\"10%\">\n\n<p><b>sshort</b></p>\n</td>\n<td width=\"70%\">\n\n<p>16-bit signed integer,</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"19%\"></td>\n<td width=\"10%\">\n\n<p><b>slong</b></p>\n</td>\n<td width=\"70%\">\n\n<p>32-bit signed integer,</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"19%\"></td>\n<td width=\"10%\">\n\n<p><b>float</b></p>\n</td>\n<td width=\"70%\">\n\n<p>32-bit IEEE floating point,</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"19%\"></td>\n<td width=\"10%\">\n\n<p><b>double</b></p>\n</td>\n<td width=\"70%\">\n\n<p>64-bit IEEE floating point.</p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>&minus;i</b> <i>config</i></p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"19%\"></td>\n<td width=\"80%\">\n<p>type of samples interleaving in input image, where\n<i>config</i> may be:</p></td>\n</table>\n<!-- TABS -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"3\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"19%\"></td>\n<td width=\"8%\">\n\n<p><b>pixel</b></p>\n</td>\n<td width=\"71%\">\n\n<p>pixel interleaved data (default),</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"19%\"></td>\n<td width=\"8%\">\n\n<p><b>band</b></p>\n</td>\n<td width=\"71%\">\n\n<p>band interleaved data.</p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>&minus;p</b> <i>photo</i></p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"19%\"></td>\n<td width=\"80%\">\n<p>photometric interpretation (color space) of the input\nimage, where <i>photo</i> may be:</p></td>\n</table>\n<!-- TABS -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"3\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"19%\"></td>\n<td width=\"15%\">\n\n<p><b>miniswhite</b></p>\n</td>\n<td width=\"65%\">\n\n<p>white color represented with 0 value,</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"19%\"></td>\n<td width=\"15%\">\n\n<p><b>minisblack</b></p>\n</td>\n<td width=\"65%\">\n\n<p>black color represented with 0 value (default),</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"19%\"></td>\n<td width=\"15%\">\n\n<p><b>rgb</b></p>\n</td>\n<td width=\"65%\">\n\n<p>image has RGB color model,</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"19%\"></td>\n<td width=\"15%\">\n\n<p><b>cmyk</b></p>\n</td>\n<td width=\"65%\">\n\n<p>image has CMYK (separated) color model,</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"19%\"></td>\n<td width=\"15%\">\n\n<p><b>ycbcr</b></p>\n</td>\n<td width=\"65%\">\n\n<p>image has YCbCr color model,</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"19%\"></td>\n<td width=\"15%\">\n\n<p><b>cielab</b></p>\n</td>\n<td width=\"65%\">\n\n<p>image has CIE L*a*b color model,</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"19%\"></td>\n<td width=\"15%\">\n\n<p><b>icclab</b></p>\n</td>\n<td width=\"65%\">\n\n<p>image has ICC L*a*b color model,</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"19%\"></td>\n<td width=\"15%\">\n\n<p><b>itulab</b></p>\n</td>\n<td width=\"65%\">\n\n<p>image has ITU L*a*b color model.</p>\n</td>\n</table>\n<!-- TABS -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"5\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;s</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>swap bytes fetched from the input file.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;L</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>input data has LSB2MSB bit order (default).</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;M</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>input data has MSB2LSB bit order.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;c</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Specify a compression scheme to use when writing image\ndata: <b>&minus;c none</b> for no compression, <b>&minus;c\npackbits</b> for the PackBits compression algorithm (the\ndefault), <b>&minus;c jpeg</b> for the baseline JPEG\ncompression algorithm, <b>&minus;c zip</b> for the Deflate\ncompression algorithm, and <b>&minus;c lzw</b> for\nLempel-Ziv &amp; Welch.</p>\n</td>\n<td width=\"0%\">\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>&minus;r</b> <i>number</i></p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"19%\"></td>\n<td width=\"80%\">\n<p>Write data with a specified number of rows per strip; by\ndefault the number of rows/strip is selected so that each\nstrip is approximately 8 kilobytes.</p>\n</td>\n</table>\n<a name=\"GUESSING THE IMAGE GEOMETRY\"></a>\n<h2>GUESSING THE IMAGE GEOMETRY</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><i>raw2tiff</i> can guess image width and height in case\none or both of these parameters are not specified. If you\nomit one of those parameters, the complementary one will be\ncalculated based on the file size (taking into account\nheader size, number of bands and data type). If you omit\nboth parameters, the statistical approach will be used.\nUtility will compute correlation coefficient between two\nlines at the image center using several appropriate line\nsizes and the highest absolute value of the coefficient will\nindicate the right line size. That is why you should be\ncautious with the very large images, because guessing\nprocess may take a while (depending on your system\nperformance). Of course, the utility can&rsquo;t guess the\nheader size, number of bands and data type, so it should be\nspecified manually. If you don&rsquo;t know anything about\nyour image, just try with the several combinations of those\noptions.</p>\n<!-- INDENTATION -->\n<p>There is no magic, it is just a mathematical statistics,\nso it can be wrong in some cases. But for most ordinary\nimages guessing method will work fine.</p>\n</td>\n</table>\n<a name=\"SEE ALSO\"></a>\n<h2>SEE ALSO</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>pal2rgb</b>(1), <b>tiffcp</b>(1),\n<b>tiffmedian</b>(1), <b>libtiff</b>(3)</p>\n<!-- INDENTATION -->\n<p>Libtiff library home page:\n<b>http://www.remotesensing.org/libtiff/</b></p>\n</td>\n</table>\n<hr>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/rgb2ycbcr.1.html",
    "content": "<!-- Creator     : groff version 1.18.1 -->\n<!-- CreationDate: Fri Jul 13 17:43:19 2007 -->\n<html>\n<head>\n<meta name=\"generator\" content=\"groff -Thtml, see www.gnu.org\">\n<meta name=\"Content-Style\" content=\"text/css\">\n<title>RGB2YCBCR</title>\n</head>\n<body>\n\n<h1 align=center>RGB2YCBCR</h1>\n<a href=\"#NAME\">NAME</a><br>\n<a href=\"#SYNOPSIS\">SYNOPSIS</a><br>\n<a href=\"#DESCRIPTION\">DESCRIPTION</a><br>\n<a href=\"#OPTIONS\">OPTIONS</a><br>\n<a href=\"#SEE ALSO\">SEE ALSO</a><br>\n\n<hr>\n<a name=\"NAME\"></a>\n<h2>NAME</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>rgb2ycbcr &minus; convert non-YCbCr <small>TIFF</small>\nimages to a YCbCr <small>TIFF</small> image</p>\n</td>\n</table>\n<a name=\"SYNOPSIS\"></a>\n<h2>SYNOPSIS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>rgb2ycbcr</b> [ <i>options</i> ] <i>src1.tif src2.tif\n... dst.tif</i></p>\n</td>\n</table>\n<a name=\"DESCRIPTION\"></a>\n<h2>DESCRIPTION</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><i>rgb2ycbcr</i> converts <small>RGB</small> color,\ngreyscale, or bi-level <small>TIFF</small> images to YCbCr\nimages by transforming and sampling pixel data. If multiple\nfiles are specified on the command line each source file is\nconverted to a separate directory in the destination\nfile.</p>\n<!-- INDENTATION -->\n<p>By default, chrominance samples are created by sampling 2\nby 2 blocks of luminance values; this can be changed with\nthe <b>&minus;h</b> and <b>&minus;v</b> options. Output data\nare compressed with the <small>PackBits</small> compression\nscheme, by default; an alternate scheme can be selected with\nthe <b>&minus;c</b> option. By default, output data are\ncompressed in strips with the number of rows in each strip\nselected so that the size of a strip is never more than 8\nkilobytes; the <b>&minus;r</b> option can be used to\nexplicitly set the number of rows per strip.</p>\n</td>\n</table>\n<a name=\"OPTIONS\"></a>\n<h2>OPTIONS</h2>\n<!-- TABS -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"5\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;c</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Specify a compression scheme to use when writing image\ndata: <b>&minus;c none</b> for no compression, <b>&minus;c\npackbits</b> for the PackBits compression algorithm (the\ndefault), <b>&minus;c jpeg</b> for the JPEG compression\nalgorithm, <b>&minus;c zip</b> for the deflate compression\nalgorithm, and <b>&minus;c lzw</b> for Lempel-Ziv &amp;\nWelch.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;h</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Set the horizontal sampling dimension to one of: 1, 2\n(default), or 4.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;r</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Write data with a specified number of rows per strip; by\ndefault the number of rows/strip is selected so that each\nstrip is approximately 8 kilobytes.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;v</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Set the vertical sampling dimension to one of: 1, 2\n(default), or 4.</p>\n</td>\n<td width=\"0%\">\n</td>\n</table>\n<a name=\"SEE ALSO\"></a>\n<h2>SEE ALSO</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>tiffinfo</b>(1), <b>tiffcp</b>(1),\n<b>libtiff</b>(3)</p>\n<!-- INDENTATION -->\n<p>Libtiff library home page:\n<b>http://www.remotesensing.org/libtiff</b></p>\n</td>\n</table>\n<hr>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/sgi2tiff.1.html",
    "content": "<!-- Creator     : groff version 1.18.1 -->\n<!-- CreationDate: Fri Jul 13 17:43:19 2007 -->\n<html>\n<head>\n<meta name=\"generator\" content=\"groff -Thtml, see www.gnu.org\">\n<meta name=\"Content-Style\" content=\"text/css\">\n<title>SGI2TIFF</title>\n</head>\n<body>\n\n<h1 align=center>SGI2TIFF</h1>\n<a href=\"#NAME\">NAME</a><br>\n<a href=\"#SYNOPSIS\">SYNOPSIS</a><br>\n<a href=\"#DESCRIPTION\">DESCRIPTION</a><br>\n<a href=\"#OPTIONS\">OPTIONS</a><br>\n<a href=\"#BUGS\">BUGS</a><br>\n<a href=\"#SEE ALSO\">SEE ALSO</a><br>\n\n<hr>\n<a name=\"NAME\"></a>\n<h2>NAME</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>sgi2tiff &minus; create a <small>TIFF</small> file from\nan <small>SGI</small> image file</p>\n</td>\n</table>\n<a name=\"SYNOPSIS\"></a>\n<h2>SYNOPSIS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>sgi2tiff</b> [ <i>options</i> ] <i>input.rgb\noutput.tif</i></p>\n</td>\n</table>\n<a name=\"DESCRIPTION\"></a>\n<h2>DESCRIPTION</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><i>sgi2tiff</i> converts a file in the <small>SGI</small>\nimage format to <small>TIFF.</small> By default, the\n<small>TIFF</small> image is created with data samples\npacked (<i>PlanarConfiguration</i>=1), compressed with the\nLempel-Ziv &amp; Welch algorithm (<i>Compression</i>=5), and\nwith each strip no more than 8 kilobytes. These\ncharacteristics can overridden, or explicitly specified with\nthe options described below.</p>\n</td>\n</table>\n<a name=\"OPTIONS\"></a>\n<h2>OPTIONS</h2>\n<!-- TABS -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"5\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;c</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Specify a compression scheme to use when writing image\ndata: <b>&minus;c none</b> for no compression, <b>&minus;c\npackbits</b> for the PackBits compression algorithm),\n<b>&minus;c jpeg</b> for the baseline JPEG compression\nalgorithm, <b>&minus;c zip</b> for the Deflate compression\nalgorithm, and <b>&minus;c lzw</b> for Lempel-Ziv &amp;\nWelch (the default).</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;p</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Explicitly select the planar configuration used in\norganizing data samples in the output image: <b>&minus;p\ncontig</b> for samples packed contiguously, and <b>&minus;p\nseparate</b> for samples stored separately. By default\nsamples are packed.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;r</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Write data with a specified number of rows per strip; by\ndefault the number of rows/strip is selected so that each\nstrip is approximately 8 kilobytes.</p>\n</td>\n<td width=\"0%\">\n</td>\n</table>\n<a name=\"BUGS\"></a>\n<h2>BUGS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>Does not record colormap information.</p>\n</td>\n</table>\n<a name=\"SEE ALSO\"></a>\n<h2>SEE ALSO</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>tiffinfo</b>(1), <b>tiffcp</b>(1),\n<b>tiffmedian</b>(1), <b>libtiff</b>(3)</p>\n<!-- INDENTATION -->\n<p>Libtiff library home page:\n<b>http://www.remotesensing.org/libtiff/</b></p>\n</td>\n</table>\n<hr>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/thumbnail.1.html",
    "content": "<!-- Creator     : groff version 1.18.1 -->\n<!-- CreationDate: Fri Jul 13 17:43:19 2007 -->\n<html>\n<head>\n<meta name=\"generator\" content=\"groff -Thtml, see www.gnu.org\">\n<meta name=\"Content-Style\" content=\"text/css\">\n<title>THUMBNAIL</title>\n</head>\n<body>\n\n<h1 align=center>THUMBNAIL</h1>\n<a href=\"#NAME\">NAME</a><br>\n<a href=\"#SYNOPSIS\">SYNOPSIS</a><br>\n<a href=\"#DESCRIPTION\">DESCRIPTION</a><br>\n<a href=\"#OPTIONS\">OPTIONS</a><br>\n<a href=\"#BUGS\">BUGS</a><br>\n<a href=\"#SEE ALSO\">SEE ALSO</a><br>\n\n<hr>\n<a name=\"NAME\"></a>\n<h2>NAME</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>thumbnail &minus; create a <small>TIFF</small> file with\nthumbnail images</p>\n</td>\n</table>\n<a name=\"SYNOPSIS\"></a>\n<h2>SYNOPSIS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>thumbnail</b> [ <i>options</i> ] <i>input.tif\noutput.tif</i></p>\n</td>\n</table>\n<a name=\"DESCRIPTION\"></a>\n<h2>DESCRIPTION</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><i>thumbnail</i> is a program written to show how one\nmight use the SubIFD tag (#330) to store thumbnail images.\n<i>thumbnail</i> copies a <small>TIFF</small> Class F\nfacsimile file to the output file and for each image an\n8-bit greyscale <i>thumbnail sketch</i>. The output file\ncontains the thumbnail image with the associated\nfull-resolution page linked below with the SubIFD tag.</p>\n<!-- INDENTATION -->\n<p>By default, thumbnail images are 216 pixels wide by 274\npixels high. Pixels are calculated by sampling and filtering\nthe input image with each pixel value passed through a\ncontrast curve.</p>\n</td>\n</table>\n<a name=\"OPTIONS\"></a>\n<h2>OPTIONS</h2>\n<!-- TABS -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"5\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;w</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Specify the width of thumbnail images in pixels.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;h</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Specify the height of thumbnail images in pixels.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;c</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Specify a contrast curve to apply in generating the\nthumbnail images. By default pixels values are passed\nthrough a linear contrast curve that simply maps the pixel\nvalue ranges. Alternative curves are: <b>exp50</b> for a 50%\nexponential curve, <b>exp60</b> for a 60% exponential curve,\n<b>exp70</b> for a 70% exponential curve, <b>exp80</b> for a\n80% exponential curve, <b>exp90</b> for a 90% exponential\ncurve, <b>exp</b> for a pure exponential curve,\n<b>linear</b> for a linear curve.</p>\n</td>\n<td width=\"0%\">\n</td>\n</table>\n<a name=\"BUGS\"></a>\n<h2>BUGS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>There are no options to control the format of the saved\nthumbnail images.</p>\n</td>\n</table>\n<a name=\"SEE ALSO\"></a>\n<h2>SEE ALSO</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>tiffdump</b>(1), <b>tiffgt</b>(1), <b>tiffinfo</b>(1),\n<b>libtiff</b>(3)</p>\n<!-- INDENTATION -->\n<p>Libtiff library home page:\n<b>http://www.remotesensing.org/libtiff/</b></p>\n</td>\n</table>\n<hr>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/tiff2bw.1.html",
    "content": "<!-- Creator     : groff version 1.18.1 -->\n<!-- CreationDate: Fri Jul 13 17:43:19 2007 -->\n<html>\n<head>\n<meta name=\"generator\" content=\"groff -Thtml, see www.gnu.org\">\n<meta name=\"Content-Style\" content=\"text/css\">\n<title>TIFF2BW</title>\n</head>\n<body>\n\n<h1 align=center>TIFF2BW</h1>\n<a href=\"#NAME\">NAME</a><br>\n<a href=\"#SYNOPSIS\">SYNOPSIS</a><br>\n<a href=\"#DESCRIPTION\">DESCRIPTION</a><br>\n<a href=\"#OPTIONS\">OPTIONS</a><br>\n<a href=\"#SEE ALSO\">SEE ALSO</a><br>\n\n<hr>\n<a name=\"NAME\"></a>\n<h2>NAME</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>tiff2bw &minus; convert a color <small>TIFF</small> image\nto greyscale</p>\n</td>\n</table>\n<a name=\"SYNOPSIS\"></a>\n<h2>SYNOPSIS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>tiff2bw</b> [ <i>options</i> ] <i>input.tif\noutput.tif</i></p>\n</td>\n</table>\n<a name=\"DESCRIPTION\"></a>\n<h2>DESCRIPTION</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><i>Tiff2bw</i> converts an <small>RGB</small> or Palette\ncolor <small>TIFF</small> image to a greyscale image by\ncombining percentages of the red, green, and blue channels.\nBy default, output samples are created by taking 28% of the\nred channel, 59% of the green channel, and 11% of the blue\nchannel. To alter these percentages, the <b>&minus;R</b>,\n<b>&minus;G</b>, and <b>&minus;B</b> options may be\nused.</p>\n</td>\n</table>\n<a name=\"OPTIONS\"></a>\n<h2>OPTIONS</h2>\n<!-- TABS -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"5\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;c</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Specify a compression scheme to use when writing image\ndata: <b>&minus;c none</b> for no compression, <b>&minus;c\npackbits</b> for the PackBits compression algorithm,\n<b>&minus;c zip</b> for the Deflate compression algorithm,\n<b>&minus;c g3</b> for the CCITT Group 3 compression\nalgorithm, <b>&minus;c g4</b> for the CCITT Group 4\ncompression algorithm, and <b>&minus;c lzw</b> for\nLempel-Ziv &amp; Welch (the default).</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;r</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Write data with a specified number of rows per strip; by\ndefault the number of rows/strip is selected so that each\nstrip is approximately 8 kilobytes.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;R</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Specify the percentage of the red channel to use\n(default 28).</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;G</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Specify the percentage of the green channel to use\n(default 59).</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;B</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Specify the percentage of the blue channel to use\n(default 11).</p>\n</td>\n<td width=\"0%\">\n</td>\n</table>\n<a name=\"SEE ALSO\"></a>\n<h2>SEE ALSO</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>pal2rgb</b>(1), <b>tiffinfo</b>(1), <b>tiffcp</b>(1),\n<b>tiffmedian</b>(1), <b>libtiff</b>(3)</p>\n<!-- INDENTATION -->\n<p>Libtiff library home page:\n<b>http://www.remotesensing.org/libtiff/</b></p>\n</td>\n</table>\n<hr>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/tiff2pdf.1.html",
    "content": "<!-- Creator     : groff version 1.18.1 -->\n<!-- CreationDate: Fri Jul 13 17:43:19 2007 -->\n<html>\n<head>\n<meta name=\"generator\" content=\"groff -Thtml, see www.gnu.org\">\n<meta name=\"Content-Style\" content=\"text/css\">\n<title>TIFF2PDF</title>\n</head>\n<body>\n\n<h1 align=center>TIFF2PDF</h1>\n<a href=\"#NAME\">NAME</a><br>\n<a href=\"#SYNOPSIS\">SYNOPSIS</a><br>\n<a href=\"#DESCRIPTION\">DESCRIPTION</a><br>\n<a href=\"#OPTIONS\">OPTIONS</a><br>\n<a href=\"#EXAMPLES\">EXAMPLES</a><br>\n<a href=\"#BUGS\">BUGS</a><br>\n<a href=\"#SEE ALSO\">SEE ALSO</a><br>\n\n<hr>\n<a name=\"NAME\"></a>\n<h2>NAME</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"89%\">\n<p>tiff2pdf &minus; convert a TIFF image to a PDF\ndocument</p>\n</td>\n</table>\n<a name=\"SYNOPSIS\"></a>\n<h2>SYNOPSIS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"89%\">\n<p><b>tiff2pdf</b> [ <i>options</i> ] <i>input.tiff</i></p>\n</td>\n</table>\n<a name=\"DESCRIPTION\"></a>\n<h2>DESCRIPTION</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"89%\">\n<p><i>tiff2pdf</i> opens a TIFF image and writes a PDF\ndocument to standard output.</p>\n<!-- INDENTATION -->\n<p>The program converts one TIFF file to one PDF file,\nincluding multiple page TIFF files, tiled TIFF files, black\nand white. grayscale, and color TIFF files that contain data\nof TIFF photometric interpretations of bilevel, grayscale,\nRGB, YCbCr, CMYK separation, and ICC L*a*b* as supported by\n<i>libtiff</i> and PDF.</p>\n<!-- INDENTATION -->\n<p>If you have multiple TIFF files to convert into one PDF\nfile then use <i>tiffcp</i> or other program to concatenate\nthe files into a multiple page TIFF file. If the input TIFF\nfile is of huge dimensions (greater than 10000 pixels height\nor width) convert the input image to a tiled TIFF if it is\nnot already.</p>\n<!-- INDENTATION -->\n<p>The standard output is standard output. Set the output\nfile name with the <b>&minus;o</b> <i>output.pdf</i>\noption.</p>\n<!-- INDENTATION -->\n<p>All black and white files are compressed into a single\nstrip CCITT G4 Fax compressed PDF, unless tiled, where tiled\nblack and white images are compressed into tiled CCITT G4\nFax compressed PDF, <i>libtiff</i> CCITT support is\nassumed.</p>\n<!-- INDENTATION -->\n<p>Color and grayscale data can be compressed using either\nJPEG compression, ITU-T T.81, or Zip/Deflate LZ77\ncompression. Set the compression type using the\n<b>&minus;j</b> or <b>&minus;z</b> options. JPEG compression\nsupport requires that <i>libtiff</i> be configured with JPEG\nsupport, and Zip/Deflate compression support requires that\n<i>libtiff</i> be configured with Zip support, in\ntiffconf.h. Use only one or the other of <b>&minus;j</b> and\n<b>&minus;z.</b></p>\n<!-- INDENTATION -->\n<p>If the input TIFF contains single strip CCITT G4 Fax\ncompressed information, then that is written to the PDF file\nwithout transcoding, unless the options of no compression\nand no passthrough are set, <b>&minus;d</b> and\n<b>&minus;n.</b></p>\n<!-- INDENTATION -->\n<p>If the input TIFF contains JPEG or single strip\nZip/Deflate compressed information, and they are configured,\nthen that is written to the PDF file without transcoding,\nunless the options of no compression and no passthrough are\nset.</p>\n<!-- INDENTATION -->\n<p>The default page size upon which the TIFF image is placed\nis determined by the resolution and extent of the image\ndata. Default values for the TIFF image resolution can be\nset using the <b>&minus;x</b> and <b>&minus;y</b> options.\nThe page size can be set using the <b>&minus;p</b> option\nfor paper size, or <b>&minus;w</b> and <b>&minus;l</b> for\npaper width and length, then each page of the TIFF image is\ncentered on its page. The distance unit for default\nresolution and page width and length can be set by the\n<b>&minus;u</b> option, the default unit is inch.</p>\n<!-- INDENTATION -->\n<p>Various items of the output document information can be\nset with the <b>&minus;e</b>, <b>&minus;c</b>,\n<b>&minus;a</b>, <b>&minus;t</b>, <b>&minus;s</b>, and\n<b>&minus;k</b> options. Setting the argument of the option\nto &quot;&quot; for these tags causes the relevant document\ninformation field to be not written. Some of the document\ninformation values otherwise get their information from the\ninput TIFF image, the software, author, document name, and\nimage description.</p>\n<!-- INDENTATION -->\n<p>The Portable Document Format (PDF) specification is\ncopyrighted by Adobe Systems, Incorporated.</p>\n</td>\n</table>\n<a name=\"OPTIONS\"></a>\n<h2>OPTIONS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"89%\">\n<p><b>&minus;o</b> <i>output-file</i></p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"21%\"></td>\n<td width=\"77%\">\n<p>Set the output to go to file. <i>output-file</i></p>\n</td>\n</table>\n<!-- TABS -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"4\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"></td>\n<td width=\"4%\">\n\n<p><b>&minus;j</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"77%\">\n\n<p>Compress with JPEG (requires <i>libjpeg</i> configured\nwith <i>libtiff</i>).</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"></td>\n<td width=\"4%\">\n\n<p><b>&minus;z</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"77%\">\n\n<p>Compress with Zip/Deflate (requires <i>zlib</i>\nconfigured with <i>libtiff</i>).</p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"89%\">\n<p><b>&minus;q</b> <i>quality</i></p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"21%\"></td>\n<td width=\"77%\">\n<p>Set the compression quality, 1-100 for JPEG.</p>\n</td>\n</table>\n<!-- TABS -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"4\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"></td>\n<td width=\"2%\">\n\n<p><b>&minus;n</b></p>\n</td>\n<td width=\"7%\"></td>\n<td width=\"77%\">\n\n<p>Do not allow data to be converted without uncompressing,\nno compressed data passthrough.</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"></td>\n<td width=\"2%\">\n\n<p><b>&minus;b</b></p>\n</td>\n<td width=\"7%\"></td>\n<td width=\"77%\">\n\n<p>Set PDF &lsquo;&lsquo;Interpolate&rsquo;&rsquo; user\npreference.</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"></td>\n<td width=\"2%\">\n\n<p><b>&minus;d</b></p>\n</td>\n<td width=\"7%\"></td>\n<td width=\"77%\">\n\n<p>Do not compress (decompress).</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"></td>\n<td width=\"2%\">\n\n<p><b>&minus;i</b></p>\n</td>\n<td width=\"7%\"></td>\n<td width=\"77%\">\n\n<p>Invert colors.</p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"89%\">\n<p><b>&minus;p</b> <i>paper-size</i></p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"21%\"></td>\n<td width=\"77%\">\n<p>Set paper size, e.g., <b>letter</b>, <b>legal</b>,\n<b>A4</b>.</p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"89%\">\n<p><b>&minus;u</b> [<b>i</b>|<b>m</b>]</p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"21%\"></td>\n<td width=\"77%\">\n<p>Set distance unit, <b>i</b> for inch, <b>m</b> for\ncentimeter.</p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"89%\">\n<p><b>&minus;w</b> <i>width</i></p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"21%\"></td>\n<td width=\"77%\">\n<p>Set width in units.</p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"89%\">\n<p><b>&minus;l</b> <i>length</i></p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"21%\"></td>\n<td width=\"77%\">\n<p>Set length in units.</p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"89%\">\n<p><b>&minus;x</b> <i>xres</i></p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"21%\"></td>\n<td width=\"77%\">\n<p>Set x/width resolution default.</p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"89%\">\n<p><b>&minus;y</b> <i>yres</i></p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"21%\"></td>\n<td width=\"77%\">\n<p>Set y/length resolution default.</p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"89%\">\n<p><b>&minus;r</b> [<b>d</b>|<b>o</b>]</p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"21%\"></td>\n<td width=\"77%\">\n<p>Set <b>d</b> for resolution default for images without\nresolution, <b>o</b> for resolution override for all\nimages.</p>\n</td>\n</table>\n<!-- TABS -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"5\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"></td>\n<td width=\"2%\">\n\n<p><b>&minus;f</b></p>\n</td>\n<td width=\"13%\"></td>\n<td width=\"57%\">\n\n<p>Set PDF &lsquo;&lsquo;Fit Window&rsquo;&rsquo; user\npreference.</p>\n</td>\n<td width=\"14%\">\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"89%\">\n<p><b>&minus;e</b> <i>YYYYMMDDHHMMSS</i></p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"21%\"></td>\n<td width=\"77%\">\n<p>Set document information date, overrides image or current\ndate/time default, <i>YYYYMMDDHHMMSS.</i></p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"89%\">\n<p><b>&minus;c</b> <i>creator</i></p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"21%\"></td>\n<td width=\"77%\">\n<p>Set document information creator, overrides image\nsoftware default.</p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"89%\">\n<p><b>&minus;a</b> <i>author</i></p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"21%\"></td>\n<td width=\"77%\">\n<p>Set document information author, overrides image artist\ndefault.</p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"89%\">\n<p><b>&minus;t</b> <i>title</i></p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"21%\"></td>\n<td width=\"77%\">\n<p>Set document information title, overrides image document\nname default.</p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"89%\">\n<p><b>&minus;s</b> <i>subject</i></p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"21%\"></td>\n<td width=\"77%\">\n<p>Set document information subject, overrides image image\ndescription default.</p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"89%\">\n<p><b>&minus;k</b> <i>keywords</i></p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"21%\"></td>\n<td width=\"77%\">\n<p>Set document information keywords.</p>\n</td>\n</table>\n<!-- TABS -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"5\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"></td>\n<td width=\"2%\">\n\n<p><b>&minus;h</b></p>\n</td>\n<td width=\"13%\"></td>\n<td width=\"57%\">\n\n<p>List usage reminder to stderr and exit.</p>\n</td>\n<td width=\"14%\">\n</td>\n</table>\n<a name=\"EXAMPLES\"></a>\n<h2>EXAMPLES</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"89%\">\n<p>The following example would generate the file output.pdf\nfrom input.tiff.</p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"20%\"></td>\n<td width=\"79%\">\n<pre>tiff2pdf &minus;o output.pdf input.tiff\n</pre>\n</td>\n</table>\n<!-- INDENTATION -->\n\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"89%\">\n<p>The following example would generate PDF output from\ninput.tiff and write it to standard output.</p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"20%\"></td>\n<td width=\"79%\">\n<pre>tiff2pdf input.tiff\n</pre>\n</td>\n</table>\n<!-- INDENTATION -->\n\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"89%\">\n<p>The following example would generate the file output.pdf\nfrom input.tiff, putting the image pages on a letter sized\npage, compressing the output with JPEG, with JPEG quality\n75, setting the title to\n&lsquo;&lsquo;Document&rsquo;&rsquo;, and setting the\n&lsquo;&lsquo;Fit Window&rsquo;&rsquo; option.</p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"20%\"></td>\n<td width=\"79%\">\n<pre>tiff2pdf &minus;p letter &minus;j &minus;q 75 &minus;t &quot;Document&quot; &minus;f &minus;o output.pdf input.tiff\n</pre>\n</td>\n</table>\n<a name=\"BUGS\"></a>\n<h2>BUGS</h2>\n<!-- INDENTATION -->\n\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"89%\">\n<p>Please report bugs via the web interface at</p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"20%\"></td>\n<td width=\"79%\">\n\n<p>http://bugzilla.remotesensing.org/enter_bug.cgi?product=libtiff</p>\n</td>\n</table>\n<a name=\"SEE ALSO\"></a>\n<h2>SEE ALSO</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"89%\">\n<p><b>libtiff</b>(3), <b>tiffcp</b>(1),\n<b>tiff2ps</b>(1)</p>\n<!-- INDENTATION -->\n<p>Libtiff library home page:\n<b>http://www.remotesensing.org/libtiff/</b></p>\n</td>\n</table>\n<hr>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/tiff2ps.1.html",
    "content": "<!-- Creator     : groff version 1.18.1 -->\n<!-- CreationDate: Fri Jul 13 17:43:19 2007 -->\n<html>\n<head>\n<meta name=\"generator\" content=\"groff -Thtml, see www.gnu.org\">\n<meta name=\"Content-Style\" content=\"text/css\">\n<title>TIFF2PS</title>\n</head>\n<body>\n\n<h1 align=center>TIFF2PS</h1>\n<a href=\"#NAME\">NAME</a><br>\n<a href=\"#SYNOPSIS\">SYNOPSIS</a><br>\n<a href=\"#DESCRIPTION\">DESCRIPTION</a><br>\n<a href=\"#OPTIONS\">OPTIONS</a><br>\n<a href=\"#EXAMPLES\">EXAMPLES</a><br>\n<a href=\"#BUGS\">BUGS</a><br>\n<a href=\"#SEE ALSO\">SEE ALSO</a><br>\n\n<hr>\n<a name=\"NAME\"></a>\n<h2>NAME</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>tiff2ps &minus; convert a <small>TIFF</small> image to\nPostScript&trade;</p>\n</td>\n</table>\n<a name=\"SYNOPSIS\"></a>\n<h2>SYNOPSIS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>tiff2ps</b> [ <i>options</i> ] <i>input.tif\n...</i></p>\n</td>\n</table>\n<a name=\"DESCRIPTION\"></a>\n<h2>DESCRIPTION</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><i>tiff2ps</i> reads <small>TIFF</small> images and\nwrites PostScript or Encapsulated PostScript (EPS) on the\nstandard output. By default, <i>tiff2ps</i> writes\nEncapsulated PostScript for the first image in the specified\n<small>TIFF</small> image file.</p>\n<!-- INDENTATION -->\n<p>By default, <i>tiff2ps</i> will generate PostScript that\nfills a printed area specified by the <small>TIFF</small>\ntags in the input file. If the file does not contain\n<i>XResolution</i> or <i>YResolution</i> tags, then the\nprinted area is set according to the image dimensions. The\n<b>&minus;w</b> and <b>&minus;h</b> options (see below) can\nbe used to set the dimensions of the printed area in inches;\noverriding any relevant <small>TIFF</small> tags.</p>\n<!-- INDENTATION -->\n<p>The PostScript generated for <small>RGB,</small> palette,\nand <small>CMYK</small> images uses the <i>colorimage</i>\noperator. The PostScript generated for greyscale and bilevel\nimages uses the <i>image</i> operator. When the\n<i>colorimage</i> operator is used, PostScript code to\nemulate this operator on older PostScript printers is also\ngenerated. Note that this emulation code can be very\nslow.</p>\n<!-- INDENTATION -->\n<p>Color images with associated alpha data are composited\nover a white background.</p>\n</td>\n</table>\n<a name=\"OPTIONS\"></a>\n<h2>OPTIONS</h2>\n<!-- TABS -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"5\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;1</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Generate PostScript Level 1 (the default).</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;2</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Generate PostScript Level 2.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;3</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Generate PostScript Level 3. It basically allows one to\nuse the /flateDecode filter for ZIP compressed TIFF\nimages.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;a</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Generate output for all IFDs (pages) in the input\nfile.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;b</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Specify the bottom margin for the output (in inches).\nThis does not affect the height of the printed image.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;c</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Center the image in the output. This option only shows\nan effect if both the <b>&minus;w</b> and the\n<b>&minus;h</b> option are given.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;d</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Set the initial <small>TIFF</small> directory to the\nspecified directory number. (NB: Directories are numbered\nstarting at zero.) This option is useful for selecting\nindividual pages in a multi-page (e.g. facsimile) file.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;e</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Force the generation of Encapsulated PostScript (implies\n<b>&minus;z</b>).</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;h</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Specify the vertical size of the printed area (in\ninches).</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;H</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Specify the maximum height of image (in inches). Images\nwith larger sizes will be split in several pages. Option\n<b>&minus;L</b> may be used for specifying size of split\nimages overlapping.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;i</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Enable/disable pixel interpolation. This option requires\na single numeric value: zero to disable pixel interpolation\nand non-zero to enable. The default is enabled.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;L</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Specify the size of overlapping for split images (in\ninches). Used in conjunction with <b>&minus;H</b>\noption.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;l</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Specify the left margin for the output (in inches). This\ndoes not affect the width of the printed image.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;m</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Where possible render using the <i>imagemask</i>\nPostScript operator instead of the <i>image</i> operator.\nWhen this option is specified <i>tiff2ps</i> will use\n<i>imagemask</i> for rendering 1 bit deep images. If this\noption is not specified or if the image depth is greater\nthan 1 then the <i>image</i> operator is used.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;o</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Set the initial <small>TIFF</small> directory to the\n<small>IFD</small> at the specified file offset. This option\nis useful for selecting thumbnail images and the like which\nare hidden using the <i>SubIFD</i> tag.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;p</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Force the generation of (non-Encapsulated)\nPostScript.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;r</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Rotate image by 180 degrees.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;s</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Generate output for a single IFD (page) in the input\nfile.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;w</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Specify the horizontal size of the printed area (in\ninches).</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;x</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Override resolution units specified in the TIFF as\ncentimeters.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;y</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Override resolution units specified in the TIFF as\ninches.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;z</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>When generating PostScript Level 2, data is scaled so\nthat it does not image into the <i>deadzone</i> on a page\n(the outer margin that the printing device is unable to\nmark). This option suppresses this behavior. When PostScript\nLevel 1 is generated, data is imaged to the entire printed\npage and this option has no affect.</p>\n</td>\n<td width=\"0%\">\n</td>\n</table>\n<a name=\"EXAMPLES\"></a>\n<h2>EXAMPLES</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>The following generates PostScript Level 2 for all pages\nof a facsimile:</p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"17%\"></td>\n<td width=\"82%\">\n<pre>tiff2ps &minus;a2 fax.tif | lpr\n</pre>\n</td>\n</table>\n<!-- INDENTATION -->\n\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>Note also that if you have version 2.6.1 or newer of\nGhostscript then you can efficiently preview facsimile\ngenerated with the above command.</p>\n<!-- INDENTATION -->\n<p>To generate Encapsulated PostScript for a the image at\ndirectory 2 of an image use:</p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"17%\"></td>\n<td width=\"82%\">\n<pre>tiff2ps &minus;d 1 foo.tif\n</pre>\n</td>\n</table>\n<!-- INDENTATION -->\n\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>(Notice that directories are numbered starting at\nzero.)</p>\n<!-- INDENTATION -->\n<p>If you have a long image, it may be split in several\npages:</p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"17%\"></td>\n<td width=\"82%\">\n<pre>tiff2ps &minus;h11 &minus;w8.5 &minus;H14 &minus;L.5 foo.tif &gt; foo.ps\n</pre>\n</td>\n</table>\n<!-- INDENTATION -->\n\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>The page size is set to 8.5x11 by <b>&minus;w</b> and\n<b>&minus;h</b> options. We will accept a small amount of\nvertical compression, so <b>&minus;H</b> set to 14. Any\npages between 11 and 14 inches will be fit onto one page.\nPages longer than 14 inches are cut off at 11 and continued\non the next page. The <b>&minus;L.5</b> option says to\nrepeat a half inch on the next page (to improve\nreadability).</p>\n</td>\n</table>\n<a name=\"BUGS\"></a>\n<h2>BUGS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>Because PostScript does not support the notion of a\ncolormap, 8-bit palette images produce 24-bit PostScript\nimages. This conversion results in output that is six times\nbigger than the original image and which takes a long time\nto send to a printer over a serial line. Matters are even\nworse for 4-, 2-, and 1-bit palette images.</p>\n<!-- INDENTATION -->\n<p>Does not handle tiled images when generating PostScript\nLevel I output.</p>\n</td>\n</table>\n<a name=\"SEE ALSO\"></a>\n<h2>SEE ALSO</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>pal2rgb</b>(1), <b>tiffinfo</b>(1), <b>tiffcp</b>(1),\n<b>tiffgt</b>(1), <b>tiffmedian</b>(1), <b>tiff2bw</b>(1),\n<b>tiffsv</b>(1), <b>libtiff</b>(3)</p>\n<!-- INDENTATION -->\n<p>Libtiff library home page:\n<b>http://www.remotesensing.org/libtiff/</b></p>\n</td>\n</table>\n<hr>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/tiff2rgba.1.html",
    "content": "<!-- Creator     : groff version 1.18.1 -->\n<!-- CreationDate: Fri Jul 13 17:43:19 2007 -->\n<html>\n<head>\n<meta name=\"generator\" content=\"groff -Thtml, see www.gnu.org\">\n<meta name=\"Content-Style\" content=\"text/css\">\n<title>TIFF2RGBA</title>\n</head>\n<body>\n\n<h1 align=center>TIFF2RGBA</h1>\n<a href=\"#NAME\">NAME</a><br>\n<a href=\"#SYNOPSIS\">SYNOPSIS</a><br>\n<a href=\"#DESCRIPTION\">DESCRIPTION</a><br>\n<a href=\"#OPTIONS\">OPTIONS</a><br>\n<a href=\"#SEE ALSO\">SEE ALSO</a><br>\n\n<hr>\n<a name=\"NAME\"></a>\n<h2>NAME</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>tiff2rgba &minus; convert a <small>TIFF</small> image to\nRGBA color space</p>\n</td>\n</table>\n<a name=\"SYNOPSIS\"></a>\n<h2>SYNOPSIS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>tiff2rgba</b> [ <i>options</i> ] <i>input.tif\noutput.tif</i></p>\n</td>\n</table>\n<a name=\"DESCRIPTION\"></a>\n<h2>DESCRIPTION</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><i>Tiff2rgba</i> converts a wide variety of TIFF images\ninto an RGBA TIFF image. This includes the ability to\ntranslate different color spaces and photometric\ninterpretation into RGBA, support for alpha blending, and\ntranslation of many different bit depths into a 32bit RGBA\nimage.</p>\n<!-- INDENTATION -->\n<p>Internally this program is implemented using the\n<i>TIFFReadRGBAImage()</i> function, and it suffers any\nlimitations of that image. This includes limited support for\n&gt; 8 BitsPerSample images, and flaws with some esoteric\ncombinations of BitsPerSample, photometric interpretation,\nblock organization and planar configuration.</p>\n<!-- INDENTATION -->\n<p>The generated images are stripped images with four\nsamples per pixel (red, green, blue and alpha) or if the\n<b>&minus;n</b> flag is used, three samples per pixel (red,\ngreen, and blue). The resulting images are always planar\nconfiguration contiguous. For this reason, this program is a\nuseful utility for transform exotic TIFF files into a form\ningestible by almost any TIFF supporting software.</p>\n</td>\n</table>\n<a name=\"OPTIONS\"></a>\n<h2>OPTIONS</h2>\n<!-- TABS -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"5\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"></td>\n<td width=\"2%\">\n\n<p><b>&minus;c</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Specify a compression scheme to use when writing image\ndata: <b>&minus;c none</b> for no compression (the default),\n<b>&minus;c packbits</b> for the PackBits compression\nalgorithm, <b>&minus;c zip</b> for the Deflate compression\nalgorithm, <b>&minus;c jpeg</b> for the JPEG compression\nalgorithm, and <b>&minus;c lzw</b> for Lempel-Ziv &amp;\nWelch.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"></td>\n<td width=\"2%\">\n\n<p><b>&minus;r</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Write data with a specified number of rows per strip; by\ndefault the number of rows/strip is selected so that each\nstrip is approximately 8 kilobytes.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"></td>\n<td width=\"2%\">\n\n<p><b>&minus;b</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Process the image one block (strip/tile) at a time\ninstead of by reading the whole image into memory at once.\nThis may be necessary for very large images on systems with\nlimited RAM.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"></td>\n<td width=\"2%\">\n\n<p><b>&minus;n</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Drop the alpha component from the output file, producing\na pure RGB file. Currently this does not work if the\n<b>&minus;b</b> flag is also in effect.</p>\n</td>\n<td width=\"0%\">\n</td>\n</table>\n<a name=\"SEE ALSO\"></a>\n<h2>SEE ALSO</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>tiff2bw</b>(1), <b>TIFFReadRGBAImage</b>(3t),\n<b>libtiff</b>(3)</p>\n<!-- INDENTATION -->\n<p>Libtiff library home page:\n<b>http://www.remotesensing.org/libtiff/</b></p>\n</td>\n</table>\n<hr>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/tiffcmp.1.html",
    "content": "<!-- Creator     : groff version 1.18.1 -->\n<!-- CreationDate: Fri Jul 13 17:43:19 2007 -->\n<html>\n<head>\n<meta name=\"generator\" content=\"groff -Thtml, see www.gnu.org\">\n<meta name=\"Content-Style\" content=\"text/css\">\n<title>TIFFCMP</title>\n</head>\n<body>\n\n<h1 align=center>TIFFCMP</h1>\n<a href=\"#NAME\">NAME</a><br>\n<a href=\"#SYNOPSIS\">SYNOPSIS</a><br>\n<a href=\"#DESCRIPTION\">DESCRIPTION</a><br>\n<a href=\"#OPTIONS\">OPTIONS</a><br>\n<a href=\"#BUGS\">BUGS</a><br>\n<a href=\"#SEE ALSO\">SEE ALSO</a><br>\n\n<hr>\n<a name=\"NAME\"></a>\n<h2>NAME</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>tiffcmp &minus; compare two <small>TIFF</small> files</p>\n</td>\n</table>\n<a name=\"SYNOPSIS\"></a>\n<h2>SYNOPSIS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>tiffcmp</b> [ <i>options</i> ] <i>file1.tif\nfile2.tif</i></p>\n</td>\n</table>\n<a name=\"DESCRIPTION\"></a>\n<h2>DESCRIPTION</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><i>Tiffcmp</i> compares the tags and data in two files\ncreated according to the Tagged Image File Format, Revision\n6.0. The schemes used for compressing data in each file are\nimmaterial when data are compared&minus;data are compared on\na scanline-by-scanline basis after decompression. Most\ndirectory tags are checked; notable exceptions are:\n<i>GrayResponseCurve</i>, <i>ColorResponseCurve</i>, and\n<i>ColorMap</i> tags. Data will not be compared if any of\nthe <i>BitsPerSample</i>, <i>SamplesPerPixel</i>, or\n<i>ImageWidth</i> values are not equal. By default,\n<i>tiffcmp</i> will terminate if it encounters any\ndifference.</p>\n</td>\n</table>\n<a name=\"OPTIONS\"></a>\n<h2>OPTIONS</h2>\n<!-- TABS -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"5\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"></td>\n<td width=\"2%\">\n\n<p><b>&minus;l</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>List each byte of image data that differs between the\nfiles.</p>\n</td>\n<td width=\"0%\">\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>&minus;z</b> <i>number</i></p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"19%\"></td>\n<td width=\"80%\">\n<p>List specified number of image data bytes that differs\nbetween the files.</p>\n</td>\n</table>\n<!-- TABS -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"5\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"2%\">\n\n<p><b>&minus;t</b></p>\n</td>\n<td width=\"11%\"></td>\n<td width=\"52%\">\n\n<p>Ignore any differences in directory tags.</p>\n</td>\n<td width=\"23%\">\n</td>\n</table>\n<a name=\"BUGS\"></a>\n<h2>BUGS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>Tags that are not recognized by the library are not\ncompared; they may also generate spurious diagnostics.</p>\n<!-- INDENTATION -->\n<p>The image data of tiled files is not compared, since the\n<i>TIFFReadScanline()</i> function is used. An error will be\nreported for tiled files.</p>\n<!-- INDENTATION -->\n<p>The pixel and/or sample number reported in differences\nmay be off in some exotic cases.</p>\n</td>\n</table>\n<a name=\"SEE ALSO\"></a>\n<h2>SEE ALSO</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>pal2rgb</b>(1), <b>tiffcp</b>(1),\n<b>tiffmedian</b>(1), <b>libtiff</b>(3TIFF)</p>\n<!-- INDENTATION -->\n<p>Libtiff library home page:\n<b>http://www.remotesensing.org/libtiff/</b></p>\n</td>\n</table>\n<hr>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/tiffcp.1.html",
    "content": "<!-- Creator     : groff version 1.18.1 -->\n<!-- CreationDate: Fri Jul 13 17:43:19 2007 -->\n<html>\n<head>\n<meta name=\"generator\" content=\"groff -Thtml, see www.gnu.org\">\n<meta name=\"Content-Style\" content=\"text/css\">\n<title>TIFFCP</title>\n</head>\n<body>\n\n<h1 align=center>TIFFCP</h1>\n<a href=\"#NAME\">NAME</a><br>\n<a href=\"#SYNOPSIS\">SYNOPSIS</a><br>\n<a href=\"#DESCRIPTION\">DESCRIPTION</a><br>\n<a href=\"#OPTIONS\">OPTIONS</a><br>\n<a href=\"#EXAMPLES\">EXAMPLES</a><br>\n<a href=\"#SEE ALSO\">SEE ALSO</a><br>\n\n<hr>\n<a name=\"NAME\"></a>\n<h2>NAME</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>tiffcp &minus; copy (and possibly convert) a\n<small>TIFF</small> file</p>\n</td>\n</table>\n<a name=\"SYNOPSIS\"></a>\n<h2>SYNOPSIS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>tiffcp</b> [ <i>options</i> ] <i>src1.tif ... srcN.tif\ndst.tif</i></p>\n</td>\n</table>\n<a name=\"DESCRIPTION\"></a>\n<h2>DESCRIPTION</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><i>tiffcp</i> combines one or more files created\naccording to the Tag Image File Format, Revision 6.0 into a\nsingle <small>TIFF</small> file. Because the output file may\nbe compressed using a different algorithm than the input\nfiles, <i>tiffcp</i> is most often used to convert between\ndifferent compression schemes.</p>\n<!-- INDENTATION -->\n<p>By default, <i>tiffcp</i> will copy all the understood\ntags in a <small>TIFF</small> directory of an input file to\nthe associated directory in the output file.</p>\n<!-- INDENTATION -->\n<p><i>tiffcp</i> can be used to reorganize the storage\ncharacteristics of data in a file, but it is explicitly\nintended to not alter or convert the image data content in\nany way.</p>\n</td>\n</table>\n<a name=\"OPTIONS\"></a>\n<h2>OPTIONS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>&minus;b</b> <i>image</i></p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"19%\"></td>\n<td width=\"80%\">\n<p>subtract the following monochrome image from all others\nprocessed. This can be used to remove a noise bias from a\nset of images. This bias image is typically an image of\nnoise the camera saw with its shutter closed.</p>\n</td>\n</table>\n<!-- TABS -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"5\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;B</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Force output to be written with Big-Endian byte order.\nThis option only has an effect when the output file is\ncreated or overwritten and not when it is appended to.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;C</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Suppress the use of &lsquo;&lsquo;strip\nchopping&rsquo;&rsquo; when reading images that have a\nsingle strip/tile of uncompressed data.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;c</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Specify the compression to use for data written to the\noutput file: <b>none</b> for no compression, <b>packbits</b>\nfor PackBits compression, <b>lzw</b> for Lempel-Ziv &amp;\nWelch compression, <b>jpeg</b> for baseline JPEG\ncompression, <b>zip</b> for Deflate compression, <b>g3</b>\nfor CCITT Group 3 (T.4) compression, and <b>g4</b> for CCITT\nGroup 4 (T.6) compression. By default <i>tiffcp</i> will\ncompress data according to the value of the\n<i>Compression</i> tag found in the source file.</p>\n</td>\n<td width=\"0%\">\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"17%\"></td>\n<td width=\"82%\">\n<p>The <small>CCITT</small> Group 3 and Group 4 compression\nalgorithms can only be used with bilevel data.</p>\n<!-- INDENTATION -->\n<p>Group 3 compression can be specified together with\nseveral T.4-specific options: <b>1d</b> for 1-dimensional\nencoding, <b>2d</b> for 2-dimensional encoding, and\n<b>fill</b> to force each encoded scanline to be zero-filled\nso that the terminating EOL code lies on a byte boundary.\nGroup 3-specific options are specified by appending a\n&lsquo;&lsquo;:&rsquo;&rsquo;-separated list to the\n&lsquo;&lsquo;g3&rsquo;&rsquo; option; e.g. <b>&minus;c\ng3:2d:fill</b> to get 2D-encoded data with byte-aligned EOL\ncodes.</p>\n<!-- INDENTATION -->\n<p><small>LZW</small> compression can be specified together\nwith a <i>predictor</i> value. A predictor value of 2 causes\neach scanline of the output image to undergo horizontal\ndifferencing before it is encoded; a value of 1 forces each\nscanline to be encoded without differencing. LZW-specific\noptions are specified by appending a\n&lsquo;&lsquo;:&rsquo;&rsquo;-separated list to the\n&lsquo;&lsquo;lzw&rsquo;&rsquo; option; e.g. <b>&minus;c\nlzw:2</b> for <small>LZW</small> compression with horizontal\ndifferencing.</p>\n</td>\n</table>\n<!-- TABS -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"5\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;f</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Specify the bit fill order to use in writing output\ndata. By default, <i>tiffcp</i> will create a new file with\nthe same fill order as the original. Specifying <b>&minus;f\nlsb2msb</b> will force data to be written with the FillOrder\ntag set to <small>LSB2MSB,</small> while <b>&minus;f\nmsb2lsb</b> will force data to be written with the FillOrder\ntag set to <small>MSB2LSB.</small></p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;i</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Ignore non-fatal read errors and continue processing of\nthe input file.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;l</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Specify the length of a tile (in pixels). <i>tiffcp</i>\nattempts to set the tile dimensions so that no more than 8\nkilobytes of data appear in a tile.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;L</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Force output to be written with Little-Endian byte\norder. This option only has an effect when the output file\nis created or overwritten and not when it is appended\nto.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;M</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Suppress the use of memory-mapped files when reading\nimages.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;p</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Specify the planar configuration to use in writing image\ndata that has one 8-bit sample per pixel. By default,\n<i>tiffcp</i> will create a new file with the same planar\nconfiguration as the original. Specifying <b>&minus;p\ncontig</b> will force data to be written with multi-sample\ndata packed together, while <b>&minus;p separate</b> will\nforce samples to be written in separate planes.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;r</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Specify the number of rows (scanlines) in each strip of\ndata written to the output file. By default (or when value\n<b>0</b> is specified), <i>tiffcp</i> attempts to set the\nrows/strip that no more than 8 kilobytes of data appear in a\nstrip. If you specify special value <b>&minus;1</b> it will\nresults in infinite number of the rows per strip. The entire\nimage will be the one strip in that case.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;s</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Force the output file to be written with data organized\nin strips (rather than tiles).</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;t</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Force the output file to be written with data organized\nin tiles (rather than strips). options can be used to force\nthe resultant image to be written as strips or tiles of\ndata, respectively.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;w</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Specify the width of a tile (in pixels). <i>tiffcp</i>\nattempts to set the tile dimensions so that no more than 8\nkilobytes of data appear in a tile. <i>tiffcp</i> attempts\nto set the tile dimensions so that no more than 8 kilobytes\nof data appear in a tile.</p>\n</td>\n<td width=\"0%\">\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>&minus;,=</b><i>character</i></p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"19%\"></td>\n<td width=\"80%\">\n<p>substitute <i>character</i> for &lsquo;,&rsquo; in\nparsing image directory indices in files. This is necessary\nif filenames contain commas. Note that <b>&minus;,=</b> with\nwhitespace immediately following will disable the special\nmeaning of the &lsquo;,&rsquo; entirely. See examples.</p>\n</td>\n</table>\n<a name=\"EXAMPLES\"></a>\n<h2>EXAMPLES</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>The following concatenates two files and writes the\nresult using <small>LZW</small> encoding:</p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"17%\"></td>\n<td width=\"82%\">\n<pre>tiffcp &minus;c lzw a.tif b.tif result.tif\n</pre>\n</td>\n</table>\n<!-- INDENTATION -->\n\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>To convert a G3 1d-encoded <small>TIFF</small> to a\nsingle strip of G4-encoded data the following might be\nused:</p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"17%\"></td>\n<td width=\"82%\">\n<pre>tiffcp &minus;c g4 &minus;r 10000 g3.tif g4.tif\n</pre>\n</td>\n</table>\n<!-- INDENTATION -->\n\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>(1000 is just a number that is larger than the number of\nrows in the source file.)</p>\n<!-- INDENTATION -->\n<p>To extract a selected set of images from a multi-image\nTIFF file, the file name may be immediately followed by a\n&lsquo;,&rsquo; separated list of image directory indices.\nThe first image is always in directory 0. Thus, to copy the\n1st and 3rd images of image file\n&lsquo;&lsquo;album.tif&rsquo;&rsquo; to\n&lsquo;&lsquo;result.tif&rsquo;&rsquo;:</p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"17%\"></td>\n<td width=\"82%\">\n<pre>tiffcp album.tif,0,2 result.tif\n</pre>\n</td>\n</table>\n<!-- INDENTATION -->\n\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>A trailing comma denotes remaining images in sequence.\nThe following command will copy all image with except the\nfirst one:</p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"17%\"></td>\n<td width=\"82%\">\n<pre>tiffcp album.tif,1, result.tif\n</pre>\n</td>\n</table>\n<!-- INDENTATION -->\n\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>Given file &lsquo;&lsquo;CCD.tif&rsquo;&rsquo; whose\nfirst image is a noise bias followed by images which include\nthat bias, subtract the noise from all those images\nfollowing it (while decompressing) with the\ncommand:</p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"17%\"></td>\n<td width=\"82%\">\n<pre>tiffcp &minus;c none &minus;b CCD.tif CCD.tif,1, result.tif\n</pre>\n</td>\n</table>\n<!-- INDENTATION -->\n\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>If the file above were named\n&lsquo;&lsquo;CCD,X.tif&rsquo;&rsquo;, the <b>&minus;,=</b>\noption would be required to correctly parse this filename\nwith image numbers, as follows:</p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"17%\"></td>\n<td width=\"82%\">\n<pre>tiffcp &minus;c none &minus;,=% &minus;b CCD,X.tif CCD,X%1%.tif result.tif\n\n</pre>\n</td>\n</table>\n<a name=\"SEE ALSO\"></a>\n<h2>SEE ALSO</h2>\n<!-- INDENTATION -->\n\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>pal2rgb</b>(1), <b>tiffinfo</b>(1), <b>tiffcmp</b>(1),\n<b>tiffmedian</b>(1), <b>tiffsplit</b>(1),\n<b>libtiff</b>(3TIFF)</p>\n<!-- INDENTATION -->\n<p>Libtiff library home page:\n<b>http://www.remotesensing.org/libtiff/</b></p>\n</td>\n</table>\n<hr>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/tiffcrop.1.html",
    "content": "<!-- Creator     : groff version 1.18.1 -->\n<!-- CreationDate: Fri Jul 13 17:43:19 2007 -->\n<html>\n<head>\n<meta name=\"generator\" content=\"groff -Thtml, see www.gnu.org\">\n<meta name=\"Content-Style\" content=\"text/css\">\n<title>TIFFCROP</title>\n</head>\n<body>\n\n<h1 align=center>TIFFCROP</h1>\n<a href=\"#NAME\">NAME</a><br>\n<a href=\"#SYNOPSIS\">SYNOPSIS</a><br>\n<a href=\"#DESCRIPTION\">DESCRIPTION</a><br>\n<a href=\"#OPTIONS\">OPTIONS</a><br>\n<a href=\"#EXAMPLES\">EXAMPLES</a><br>\n<a href=\"#SEE ALSO\">SEE ALSO</a><br>\n\n<hr>\n<a name=\"NAME\"></a>\n<h2>NAME</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>tiffcrop &minus; copy, convert, crop, extract, or process\na <small>TIFF</small> file</p>\n</td>\n</table>\n<a name=\"SYNOPSIS\"></a>\n<h2>SYNOPSIS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>tiffcrop</b> [ <i>options</i> ] <i>src1.tif ...\nsrcN.tif dst.tif</i></p>\n</td>\n</table>\n<a name=\"DESCRIPTION\"></a>\n<h2>DESCRIPTION</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><i>tiffcrop</i> combines one or more files created\naccording to the Tag Image File Format, Revision 6.0 into a\nsingle <small>TIFF</small> file. The output file may be\ncompressed using a different algorithm than the input files.\n<i>tiffcrop</i> is most often used to extract portions of an\nimage for processing with bar code recognizer or OCR\nsoftware when that software cannot restrict the region of\ninterest to a specific portion of the image or to improve\nefficiency when the regions of interest must be rotated. It\ncan also be used to subdivide all or part of a processed\nimage into smaller sections.</p>\n<!-- INDENTATION -->\n<p>Functions are applied to the input image in the following\norder:</p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"17%\"></td>\n<td width=\"82%\">\n<pre>cropping, fixed area extraction, zones, inversion, mirroring, rotation.\n</pre>\n</td>\n</table>\n<!-- INDENTATION -->\n\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>Functions are applied to the output image in the\nfollowing order:</p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"17%\"></td>\n<td width=\"82%\">\n<p>output resolution, output margins, rows and columns\n<b>or</b> page size divisions, orientation options, strip,\ntile, byte order, and compression options.</p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>By default, <i>tiffcrop</i> will copy all the understood\ntags in a <small>TIFF</small> directory of an input file to\nthe associated directory in the output file. Options can be\nused to force the resultant image to be written as strips or\ntiles of data, respectively.</p>\n<!-- INDENTATION -->\n<p><i>tiffcrop</i> can be used to reorganize the storage\ncharacteristics of data in a file, and to reorganize,\nextract, rotate, and otherwise process the image data as\nspecified at the same time whereas tiffcp does not alter the\nimage data itself.</p>\n</td>\n</table>\n<a name=\"OPTIONS\"></a>\n<h2>OPTIONS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>&minus;N odd|even|#,#-#,#|last</b></p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"19%\"></td>\n<td width=\"80%\">\n<p>Specify one or more series or range(s) of images within\nfile to process. The words <b>odd</b> or <b>even</b> may be\nused to specify all odd or even numbered images. The word\n<b>last</b> may be used in place of a number in the sequence\nto indicate the final image in the file without knowing how\nmany images there are. Ranges of images may be specified\nwith a dash and multiple sets can be indicated by joining\nthem in a comma-separated list. eg. use <b>&minus;N\n1,5-7,last</b> to process the 1st, 5th through 7th, and\nfinal image in the file.</p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>&minus;E top|bottom|left|right</b></p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"19%\"></td>\n<td width=\"80%\">\n<p>Specify the top, bottom, left, or right edge as the\nreference from which to calcuate the width and length of\ncrop regions or sequence of postions for zones. May be\nabbreviated to first letter.</p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>&minus;U in|cm|px</b></p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"19%\"></td>\n<td width=\"80%\">\n<p>Specify the type of units to apply to dimensions for\nmargins and crop regions for input and output images. Inches\nor centimeters are converted to pixels using the resolution\nunit specified in the TIFF file (which defaults to inches if\nnot specified in the IFD).</p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>&minus;m #,#,#,#</b></p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"19%\"></td>\n<td width=\"80%\">\n<p>Specify margins to be removed from the input image. The\norder must be top, left, bottom, right with only commas\nseparating the elements of the list. Margins are scaled\naccording to the current units and removed before any other\nextractions are computed. Captial M was in use.</p>\n</td>\n</table>\n<!-- TABS -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"5\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"6%\">\n\n<p><b>&minus;X #</b></p>\n</td>\n<td width=\"2%\"></td>\n<td width=\"80%\">\n\n<p>Set the horizontal (X-axis) dimension of a region to\nextract relative to the specified origin reference. If the\norigin is the top or bottom edge, the X axis value will be\nassumed to start at the left edge.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"6%\">\n\n<p><b>&minus;Y #</b></p>\n</td>\n<td width=\"2%\"></td>\n<td width=\"80%\">\n\n<p>Set the vertical (Y-axis) dimension of a region to\nextract relative to the specified origin reference. If the\norigin is the left or right edge, the Y axis value will be\nassumed to start at the top.</p>\n</td>\n<td width=\"0%\">\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>&minus;Z #:#,#:#</b></p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"19%\"></td>\n<td width=\"80%\">\n<p>Specify zones of the image designated as position X of Y\nequal sized portions measured from the reference edge, eg\n1:3 would be first third of the image starting from the\nreference edge minus any margins specified for the confining\nedges. Multiple zones can be specified as a comma separated\nlist but they must reference the same edge. To extract the\ntop quarter and the bottom third of an image you would use\n<b>&minus;Z 1:4,3:3.</b></p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>&minus;F horiz|vert</b></p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"19%\"></td>\n<td width=\"80%\">\n<p>Flip, ie mirror, the image or extracted region\nhorizontally or vertically.</p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>&minus;R 90|180|270</b></p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"19%\"></td>\n<td width=\"80%\">\n<p>Rotate the image or extracted region 90, 180, or 270\ndegrees clockwise.</p>\n</td>\n</table>\n<!-- TABS -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"5\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"6%\">\n\n<p><b>&minus;I</b></p>\n</td>\n<td width=\"2%\"></td>\n<td width=\"80%\">\n\n<p>Invert the colorspace values for grayscale and bilevel\nimages. This would be used to correct negative images that\nhave incorrect PHOTMETRIC INTERPRETATION tags. No support\nfor color images.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"6%\">\n\n<p><b>&minus;H #</b></p>\n</td>\n<td width=\"2%\"></td>\n<td width=\"80%\">\n\n<p>Set the horizontal resolution of output images to #\nexpressed in the current units.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"6%\">\n\n<p><b>&minus;V #</b></p>\n</td>\n<td width=\"2%\"></td>\n<td width=\"80%\">\n\n<p>Set the vertical resolution of the output images to #\nexpressed in the current units.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"6%\">\n\n<p><b>&minus;J #</b></p>\n</td>\n<td width=\"2%\"></td>\n<td width=\"80%\">\n\n<p>Set the horizontal margin of an output page size to #\nexpressed in the current units.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"6%\">\n\n<p><b>&minus;K #</b></p>\n</td>\n<td width=\"2%\"></td>\n<td width=\"80%\">\n\n<p>Set the vertical margin of an output page size to #\nexpressed in the current units.</p>\n</td>\n<td width=\"0%\">\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>&minus;O portrait|landscape|auto</b></p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"19%\"></td>\n<td width=\"80%\">\n<p>Set the output orientation of the pages or sections. Auto\nwill use the arrangement that requires the fewest pages.</p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>&minus;S cols:rows</b></p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"19%\"></td>\n<td width=\"80%\">\n<p>Divide each image into cols across and rows down equal\nsections.</p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>&minus;P page</b></p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"19%\"></td>\n<td width=\"80%\">\n<p>Format the output images to fit on page size paper. Use\n-P list to show the supported page sizes and dimensions.</p>\n</td>\n</table>\n<!-- TABS -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"5\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;B</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Force output to be written with Big-Endian byte order.\nThis option only has an effect when the output file is\ncreated or overwritten and not when it is appended to.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;C</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Suppress the use of &lsquo;&lsquo;strip\nchopping&rsquo;&rsquo; when reading images that have a\nsingle strip/tile of uncompressed data.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;c</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Specify the compression to use for data written to the\noutput file: <b>none</b> for no compression, <b>packbits</b>\nfor PackBits compression, <b>lzw</b> for Lempel-Ziv &amp;\nWelch compression, <b>jpeg</b> for baseline JPEG\ncompression, <b>zip</b> for Deflate compression, <b>g3</b>\nfor CCITT Group 3 (T.4) compression, and <b>g4</b> for CCITT\nGroup 4 (T.6) compression. By default <i>tiffcrop</i> will\ncompress data according to the value of the\n<i>Compression</i> tag found in the source file.</p>\n</td>\n<td width=\"0%\">\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"17%\"></td>\n<td width=\"82%\">\n<p>The <small>CCITT</small> Group 3 and Group 4 compression\nalgorithms can only be used with bilevel data.</p>\n<!-- INDENTATION -->\n<p>Group 3 compression can be specified together with\nseveral T.4-specific options: <b>1d</b> for 1-dimensional\nencoding, <b>2d</b> for 2-dimensional encoding, and\n<b>fill</b> to force each encoded scanline to be zero-filled\nso that the terminating EOL code lies on a byte boundary.\nGroup 3-specific options are specified by appending a\n&lsquo;&lsquo;:&rsquo;&rsquo;-separated list to the\n&lsquo;&lsquo;g3&rsquo;&rsquo; option; e.g. <b>&minus;c\ng3:2d:fill</b> to get 2D-encoded data with byte-aligned EOL\ncodes.</p>\n<!-- INDENTATION -->\n<p><small>LZW</small> compression can be specified together\nwith a <i>predictor</i> value. A predictor value of 2 causes\neach scanline of the output image to undergo horizontal\ndifferencing before it is encoded; a value of 1 forces each\nscanline to be encoded without differencing. LZW-specific\noptions are specified by appending a\n&lsquo;&lsquo;:&rsquo;&rsquo;-separated list to the\n&lsquo;&lsquo;lzw&rsquo;&rsquo; option; e.g. <b>&minus;c\nlzw:2</b> for <small>LZW</small> compression with horizontal\ndifferencing.</p>\n</td>\n</table>\n<!-- TABS -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"5\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;f</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Specify the bit fill order to use in writing output\ndata. By default, <i>tiffcrop</i> will create a new file\nwith the same fill order as the original. Specifying\n<b>&minus;f lsb2msb</b> will force data to be written with\nthe FillOrder tag set to <small>LSB2MSB,</small> while\n<b>&minus;f msb2lsb</b> will force data to be written with\nthe FillOrder tag set to <small>MSB2LSB.</small></p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;i</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Ignore non-fatal read errors and continue processing of\nthe input file.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;l</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Specify the length of a tile (in pixels).\n<i>tiffcrop</i> attempts to set the tile dimensions so that\nno more than 8 kilobytes of data appear in a tile.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;L</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Force output to be written with Little-Endian byte\norder. This option only has an effect when the output file\nis created or overwritten and not when it is appended\nto.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;M</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Suppress the use of memory-mapped files when reading\nimages.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;p</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Specify the planar configuration to use in writing image\ndata that has more than one 8-bit sample per pixel. By\ndefault, <i>tiffcrop</i> will create a new file with the\nsame planar configuration as the original. Specifying\n<b>&minus;p contig</b> will force data to be written with\nmulti-sample data packed together, while <b>&minus;p\nseparate</b> will force samples to be written in separate\nplanes.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;r</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Specify the number of rows (scanlines) in each strip of\ndata written to the output file. By default (or when value\n<b>0</b> is specified), <i>tiffcrop</i> attempts to set the\nrows/strip that no more than 8 kilobytes of data appear in a\nstrip. If you specify the special value <b>-1</b> it will\nresults in infinite number of the rows per strip. The entire\nimage will be the one strip in that case.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;s</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Force the output file to be written with data organized\nin strips (rather than tiles).</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;t</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Force the output file to be written with data organized\nin tiles (rather than strips).</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;w</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Specify the width of a tile (in pixels). <i>tiffcrop</i>\nattempts to set the tile dimensions so that no more than 8\nkilobytes of data appear in a tile. <i>tiffcrop</i> attempts\nto set the tile dimensions so that no more than 8 kilobytes\nof data appear in a tile.</p>\n</td>\n<td width=\"0%\">\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>&minus;,={character}</b></p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"19%\"></td>\n<td width=\"80%\">\n<p>substitute {character} for &rsquo;,&rsquo; in parsing\nimage directory indices in files. This is necessary if\nfilenames contain commas. Note that &rsquo;,=&rsquo; with\nwhitespace immediately following will disable the special\nmeaning of the &rsquo;,&rsquo; entirely. See examples.</p>\n</td>\n</table>\n<a name=\"EXAMPLES\"></a>\n<h2>EXAMPLES</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>The following concatenates two files and writes the\nresult using <small>LZW</small> encoding:</p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"17%\"></td>\n<td width=\"82%\">\n<pre>tiffcrop -c lzw a.tif b.tif result.tif\n</pre>\n</td>\n</table>\n<!-- INDENTATION -->\n\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>To convert a G3 1d-encoded <small>TIFF</small> to a\nsingle strip of G4-encoded data the following might be\nused:</p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"17%\"></td>\n<td width=\"82%\">\n<pre>tiffcrop -c g4 -r 10000 g3.tif g4.tif\n</pre>\n</td>\n</table>\n<!-- INDENTATION -->\n\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>(1000 is just a number that is larger than the number of\nrows in the source file.)</p>\n<!-- INDENTATION -->\n<p>To extract a selected set of images from a multi-image\nTIFF file use the -N option described above. Thus, to copy\nthe 1st and 3rd images of image file &quot;album.tif&quot;\nto &quot;result.tif&quot;:</p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"17%\"></td>\n<td width=\"82%\">\n<pre>tiffcrop -N 1,3 album.tif result.tif\n</pre>\n</td>\n</table>\n<!-- INDENTATION -->\n\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>Invert a bilevel image scan of a microfilmed document and\ncrop off margins of 0.25 inches on the left and right, 0.5\ninch on the top, nad 0.75 inch on the bottom. From the\nremaining portion of the image, select the second and third\nquarters, ie, one half of the area left from the center to\neach margin.</p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"17%\"></td>\n<td width=\"82%\">\n<pre>tiffcrop -U in -m 0.5,0.25,0.75,0.25 -E left -Z 2:4,3:4 -I MicrofilmNegative.tif MicrofilmPostiveCenter.tif\n</pre>\n</td>\n</table>\n<!-- INDENTATION -->\n\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>Extract only the final image of a large Architectural E\nsized multipage TIFF file and rotate it 90 degrees clockwise\nwhile reformatting the output to fit on tabloid sized sheets\nwith one quarter of an inch on each side:</p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"17%\"></td>\n<td width=\"82%\">\n<pre>tiffcrop -N last -R 90 -O auto -P tabloid -U in -J 0.25 -K 0.25 -H 300 -V 300 Big-PlatMap.tif BigPlatMap-Tabloid.tif\n</pre>\n</td>\n</table>\n<!-- INDENTATION -->\n\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>The output images will have a specified resolution of 300\ndpi in both directions. The orientation of each page will be\ndetermined by whichever choice requires the fewest pages. To\nspecify a specific orientation, use the portrait or\nlandscape option.</p>\n</td>\n</table>\n<a name=\"SEE ALSO\"></a>\n<h2>SEE ALSO</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>pal2rgb</b>(1), <b>tiffinfo</b>(1), <b>tiffcmp</b>(1),\n<b>tiffcp</b>(1), <b>tiffmedian</b>(1), <b>tiffsplit</b>(1),\n<b>libtiff</b>(3TIFF)</p>\n<!-- INDENTATION -->\n<p>Libtiff library home page:\n<b>http://www.remotesensing.org/libtiff/</b></p>\n</td>\n</table>\n<hr>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/tiffdither.1.html",
    "content": "<!-- Creator     : groff version 1.18.1 -->\n<!-- CreationDate: Fri Jul 13 17:43:19 2007 -->\n<html>\n<head>\n<meta name=\"generator\" content=\"groff -Thtml, see www.gnu.org\">\n<meta name=\"Content-Style\" content=\"text/css\">\n<title>TIFFDITHER</title>\n</head>\n<body>\n\n<h1 align=center>TIFFDITHER</h1>\n<a href=\"#NAME\">NAME</a><br>\n<a href=\"#SYNOPSIS\">SYNOPSIS</a><br>\n<a href=\"#DESCRIPTION\">DESCRIPTION</a><br>\n<a href=\"#OPTIONS\">OPTIONS</a><br>\n<a href=\"#NOTES\">NOTES</a><br>\n<a href=\"#SEE ALSO\">SEE ALSO</a><br>\n\n<hr>\n<a name=\"NAME\"></a>\n<h2>NAME</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>tiffdither &minus; convert a greyscale image to bilevel\nusing dithering</p>\n</td>\n</table>\n<a name=\"SYNOPSIS\"></a>\n<h2>SYNOPSIS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>tiffdither</b> [ <i>options</i> ] <i>input.tif\noutput.tif</i></p>\n</td>\n</table>\n<a name=\"DESCRIPTION\"></a>\n<h2>DESCRIPTION</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><i>tiffdither</i> converts a single channel 8-bit\ngreyscale image to a bilevel image using Floyd-Steinberg\nerror propagation with thresholding.</p>\n</td>\n</table>\n<a name=\"OPTIONS\"></a>\n<h2>OPTIONS</h2>\n<!-- TABS -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"5\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"2%\">\n\n<p><b>&minus;c</b></p>\n</td>\n<td width=\"6%\"></td>\n<td width=\"80%\">\n\n<p>Specify the compression to use for data written to the\noutput file: <b>none</b> for no compression, <b>packbits</b>\nfor PackBits compression, <b>lzw</b> for Lempel-Ziv &amp;\nWelch compression, <b>zip</b> for Deflate compression,\n<b>g3</b> for CCITT Group 3 (T.4) compression, and <b>g4</b>\nfor CCITT Group 4 (T.6) compression. By default\n<i>tiffdither</i> will compress data according to the value\nof the <i>Compression</i> tag found in the source file.</p>\n</td>\n<td width=\"0%\">\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"17%\"></td>\n<td width=\"82%\">\n<p>The <small>CCITT</small> Group 3 and Group 4 compression\nalgorithms can only be used with bilevel data.</p>\n<!-- INDENTATION -->\n<p>Group 3 compression can be specified together with\nseveral T.4-specific options: <b>1d</b> for 1-dimensional\nencoding, <b>2d</b> for 2-dimensional encoding, and\n<b>fill</b> to force each encoded scanline to be zero-filled\nso that the terminating EOL code lies on a byte boundary.\nGroup 3-specific options are specified by appending a\n&lsquo;&lsquo;:&rsquo;&rsquo;-separated list to the\n&lsquo;&lsquo;g3&rsquo;&rsquo; option; e.g. <b>&minus;c\ng3:2d:fill</b> to get 2D-encoded data with byte-aligned EOL\ncodes.</p>\n<!-- INDENTATION -->\n<p><small>LZW</small> compression can be specified together\nwith a <i>predictor</i> value. A predictor value of 2 causes\neach scanline of the output image to undergo horizontal\ndifferencing before it is encoded; a value of 1 forces each\nscanline to be encoded without differencing. LZW-specific\noptions are specified by appending a\n&lsquo;&lsquo;:&rsquo;&rsquo;-separated list to the\n&lsquo;&lsquo;lzw&rsquo;&rsquo; option; e.g. <b>&minus;c\nlzw:2</b> for <small>LZW</small> compression with horizontal\ndifferencing.</p>\n</td>\n</table>\n<!-- TABS -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"5\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;f</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Specify the bit fill order to use in writing output\ndata. By default, <i>tiffdither</i> will create a new file\nwith the same fill order as the original. Specifying\n<b>&minus;f lsb2msb</b> will force data to be written with\nthe <i>FillOrder</i> tag set to <small>LSB2MSB ,</small>\nwhile <b>&minus;f msb2lsb</b> will force data to be written\nwith the <i>Fill- Order</i> tag set to <small>MSB2LSB\n.</small></p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;t</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Set the threshold value for dithering. By default the\nthreshold value is 128.</p>\n</td>\n<td width=\"0%\">\n</td>\n</table>\n<a name=\"NOTES\"></a>\n<h2>NOTES</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>The dither algorithm is taken from the\n<b>tiffmedian</b>(1) program (written by Paul Heckbert).</p>\n</td>\n</table>\n<a name=\"SEE ALSO\"></a>\n<h2>SEE ALSO</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>pal2rgb</b>(1), <b>fax2tiff</b>(1),\n<b>tiffinfo</b>(1), <b>tiffcp</b>(1), <b>tiff2bw</b>(1),\n<b>libtiff</b>(3TIFF)</p>\n<!-- INDENTATION -->\n<p>Libtiff library home page:\n<b>http://www.remotesensing.org/libtiff/</b></p>\n</td>\n</table>\n<hr>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/tiffdump.1.html",
    "content": "<!-- Creator     : groff version 1.18.1 -->\n<!-- CreationDate: Fri Jul 13 17:43:20 2007 -->\n<html>\n<head>\n<meta name=\"generator\" content=\"groff -Thtml, see www.gnu.org\">\n<meta name=\"Content-Style\" content=\"text/css\">\n<title>TIFFDUMP</title>\n</head>\n<body>\n\n<h1 align=center>TIFFDUMP</h1>\n<a href=\"#NAME\">NAME</a><br>\n<a href=\"#SYNOPSIS\">SYNOPSIS</a><br>\n<a href=\"#DESCRIPTION\">DESCRIPTION</a><br>\n<a href=\"#OPTIONS\">OPTIONS</a><br>\n<a href=\"#SEE ALSO\">SEE ALSO</a><br>\n\n<hr>\n<a name=\"NAME\"></a>\n<h2>NAME</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>tiffdump &minus; print verbatim information about\n<small>TIFF</small> files</p>\n</td>\n</table>\n<a name=\"SYNOPSIS\"></a>\n<h2>SYNOPSIS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>tiffdump</b> [ <i>options</i> ] <i>name ...</i></p>\n</td>\n</table>\n<a name=\"DESCRIPTION\"></a>\n<h2>DESCRIPTION</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><i>tiffdump</i> displays directory information from files\ncreated according to the Tag Image File Format, Revision\n6.0. The header of each <small>TIFF</small> file (magic\nnumber, version, and first directory offset) is displayed,\nfollowed by the tag contents of each directory in the file.\nFor each tag, the name, data type, count, and value(s) is\ndisplayed. When the symbolic name for a tag or data type is\nknown, the symbolic name is displayed followed by it&rsquo;s\nnumeric (decimal) value. Tag values are displayed enclosed\nin &lsquo;&lsquo;&lt;&gt;&rsquo;&rsquo; characters\nimmediately preceded by the value of the count field. For\nexample, an <i>ImageWidth</i> tag might be displayed as\n&lsquo;&lsquo;ImageWidth (256) SHORT (3)\n1&lt;800&gt;&rsquo;&rsquo;.</p>\n<!-- INDENTATION -->\n<p><i>tiffdump</i> is particularly useful for investigating\nthe contents of <small>TIFF</small> files that\n<i>libtiff</i> does not understand.</p>\n</td>\n</table>\n<a name=\"OPTIONS\"></a>\n<h2>OPTIONS</h2>\n<!-- TABS -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"5\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"2%\">\n\n<p><b>&minus;h</b></p>\n</td>\n<td width=\"6%\"></td>\n<td width=\"80%\">\n\n<p>Force numeric data to be printed in hexadecimal rather\nthan the default decimal.</p>\n</td>\n<td width=\"0%\">\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>&minus;m</b> <i>items</i></p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"19%\"></td>\n<td width=\"80%\">\n<p>Change the number of indirect data items that are\nprinted. By default, this will be 24.</p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>&minus;o</b> <i>offset</i></p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"19%\"></td>\n<td width=\"80%\">\n<p>Dump the contents of the <small>IFD</small> at the a\nparticular file offset. The file offset may be specified\nusing the usual C-style syntax; i.e. a leading\n&lsquo;&lsquo;0x&rsquo;&rsquo; for hexadecimal and a leading\n&lsquo;&lsquo;0&rsquo;&rsquo; for octal.</p>\n</td>\n</table>\n<a name=\"SEE ALSO\"></a>\n<h2>SEE ALSO</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>tiffinfo</b>(1), <b>libtiff</b>(3TIFF)</p>\n<!-- INDENTATION -->\n<p>Libtiff library home page:\n<b>http://www.remotesensing.org/libtiff/</b></p>\n</td>\n</table>\n<hr>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/tiffgt.1.html",
    "content": "<!-- Creator     : groff version 1.18.1 -->\n<!-- CreationDate: Fri Jul 13 17:43:20 2007 -->\n<html>\n<head>\n<meta name=\"generator\" content=\"groff -Thtml, see www.gnu.org\">\n<meta name=\"Content-Style\" content=\"text/css\">\n<title>TIFFGT</title>\n</head>\n<body>\n\n<h1 align=center>TIFFGT</h1>\n<a href=\"#NAME\">NAME</a><br>\n<a href=\"#SYNOPSIS\">SYNOPSIS</a><br>\n<a href=\"#DESCRIPTION\">DESCRIPTION</a><br>\n<a href=\"#OPTIONS\">OPTIONS</a><br>\n<a href=\"#BUGS\">BUGS</a><br>\n<a href=\"#SEE ALSO\">SEE ALSO</a><br>\n\n<hr>\n<a name=\"NAME\"></a>\n<h2>NAME</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>tiffgt &minus; display an image stored in a\n<small>TIFF</small> file (Silicon Graphics version)</p>\n</td>\n</table>\n<a name=\"SYNOPSIS\"></a>\n<h2>SYNOPSIS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>tiffgt</b> [ <i>options</i> ] <i>input.tif ...</i></p>\n</td>\n</table>\n<a name=\"DESCRIPTION\"></a>\n<h2>DESCRIPTION</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><i>tiffgt</i> displays one or more images stored using\nthe Tag Image File Format, Revision 6.0. Each image is\nplaced in a fixed size window that the user must position on\nthe display (unless configured otherwise through X\ndefaults). If the display has fewer than 24 bitplanes, or if\nthe image does not warrant full color, then\n<small>RGB</small> color values are mapped to the closest\nvalues that exist in the colormap (this is done using the\n<i>rgbi</i> routine found in the graphics utility library\n<b>&minus;lgutil</b>.)</p>\n<!-- INDENTATION -->\n<p><i>tiffgt</i> correctly handles files with any of the\nfollowing characteristics:</p></td>\n</table>\n<!-- TABS -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"3\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"15%\"></td>\n<td width=\"34%\">\n\n<p><i>BitsPerSample</i></p>\n</td>\n<td width=\"50%\">\n\n<p>1, 2, 4, 8, 16</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"15%\"></td>\n<td width=\"34%\">\n\n<p><i>SamplesPerPixel</i></p>\n</td>\n<td width=\"50%\">\n\n<p>1, 3, 4 (the 4th sample is ignored)</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"15%\"></td>\n<td width=\"34%\">\n\n<p><i>PhotometricInterpretation</i></p>\n</td>\n<td width=\"50%\">\n\n<p>0 (min-is-white), 1 (min-is-black), 2 (RGB), 3\n(palette), 6 (YCbCr)</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"15%\"></td>\n<td width=\"34%\">\n\n<p><i>PlanarConfiguration</i></p>\n</td>\n<td width=\"50%\">\n\n<p>1 (contiguous), 2 (separate)</p>\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"15%\"></td>\n<td width=\"34%\">\n\n<p><i>Orientation</i></p>\n</td>\n<td width=\"50%\">\n\n<p>1 (top-left), 4 (bottom-left)</p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>Data may be organized as strips or tiles and may be\ncompressed with any of the compression algorithms supported\nby the <i>libtiff</i>(3) library.</p>\n<!-- INDENTATION -->\n<p>For palette images (<i>PhotometricInterpretation</i>=3),\n<i>tiffgt</i> inspects the colormap values and assumes\neither 16-bit or 8-bit values according to the maximum\nvalue. That is, if no colormap entry greater than 255 is\nfound, <i>tiffgt</i> assumes the colormap has only 8-bit\nvalues; otherwise it assumes 16-bit values. This inspection\nis done to handle old images written by previous (incorrect)\nversions of <i>libtiff</i>.</p>\n<!-- INDENTATION -->\n<p><i>tiffgt</i> can be used to display multiple images\none-at-a-time. The left mouse button switches the display to\nthe first image in the <i>next</i> file in the list of files\nspecified on the command line. The right mouse button\nswitches to the first image in the <i>previous</i> file in\nthe list. The middle mouse button causes the first image in\nthe first file specified on the command line to be\ndisplayed. In addition the following keyboard commands are\nrecognized:</p>\n</td>\n</table>\n<!-- TABS -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"4\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"8%\">\n\n<p><b>b</b></p>\n</td>\n<td width=\"80%\">\n\n<p>Use a <i>PhotometricInterpretation</i> of MinIsBlack in\ndisplaying the current image.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"8%\">\n\n<p><b>l</b></p>\n</td>\n<td width=\"80%\">\n\n<p>Use a <i>FillOrder</i> of lsb-to-msb in decoding the\ncurrent image.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"8%\">\n\n<p><b>m</b></p>\n</td>\n<td width=\"80%\">\n\n<p>Use a <i>FillOrder</i> of msb-to-lsb in decoding the\ncurrent image.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"8%\">\n\n<p><b>c</b></p>\n</td>\n<td width=\"80%\">\n\n<p>Use a colormap visual to display the current image.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"8%\">\n\n<p><b>r</b></p>\n</td>\n<td width=\"80%\">\n\n<p>Use a true color (24-bit RGB) visual to display the\ncurrent image.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"8%\">\n\n<p><b>w</b></p>\n</td>\n<td width=\"80%\">\n\n<p>Use a <i>PhotometricInterpretation</i> of MinIsWhite in\ndisplaying the current image.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"8%\">\n\n<p><b>W</b></p>\n</td>\n<td width=\"80%\">\n\n<p>Toggle (enable/disable) display of warning messages from\nthe <small>TIFF</small> library when decoding images.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"8%\">\n\n<p><b>E</b></p>\n</td>\n<td width=\"80%\">\n\n<p>Toggle (enable/disable) display of error messages from\nthe <small>TIFF</small> library when decoding images.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"8%\">\n\n<p><b>z</b></p>\n</td>\n<td width=\"80%\">\n\n<p>Reset all parameters to their default settings\n(<i>FillOrder</i>, <i>PhotometricInterpretation</i>,\nhandling of warnings and errors).</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"8%\">\n\n<p><b>PageUp</b></p>\n</td>\n<td width=\"80%\">\n\n<p>Display the previous image in the current file or the\nlast image in the previous file.</p>\n</td>\n<td width=\"0%\">\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>PageDown</b></p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"19%\"></td>\n<td width=\"80%\">\n<p>Display the next image in the current file or the first\nimage in the next file.</p>\n</td>\n</table>\n<!-- TABS -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"5\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"6%\">\n\n<p><b>Home</b></p>\n</td>\n<td width=\"2%\"></td>\n<td width=\"80%\">\n\n<p>Display the first image in the current file.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"6%\">\n\n<p><b>End</b></p>\n</td>\n<td width=\"2%\"></td>\n<td width=\"80%\">\n\n<p>Display the last image in the current file\n(unimplemented).</p>\n</td>\n<td width=\"0%\">\n</td>\n</table>\n<a name=\"OPTIONS\"></a>\n<h2>OPTIONS</h2>\n<!-- TABS -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"5\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;c</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Force image display in a colormap window.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;d</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Specify an image to display by directory number. By\ndefault the first image in the file is displayed.\nDirectories are numbered starting at zero.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;e</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Enable reporting of error messages from the\n<small>TIFF</small> library. By default <i>tiffgt</i>\nsilently ignores images that cannot be read.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;f</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Force <i>tiffgt</i> to run as a foreground process. By\ndefault <i>tiffgt</i> will place itself in the background\nonce it has opened the requested image file.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;l</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Force the presumed bit ordering to be <small>LSB</small>\nto <small>MSB.</small></p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;m</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Force the presumed bit ordering to be <small>MSB</small>\nto <small>LSB.</small></p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;o</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Specify an image to display by directory offset. By\ndefault the first image in the file is displayed.\nDirectories offsets may be specified using C-style syntax;\ni.e. a leading &lsquo;&lsquo;0x&rsquo;&rsquo; for\nhexadecimal and a leading &lsquo;&lsquo;0&rsquo;&rsquo; for\noctal.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;p</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Override the value of the\n<i>PhotometricInterpretation</i> tag; the parameter may be\none of: <b>miniswhite</b>, <b>minisblack</b>, <b>rgb</b>,\n<b>palette</b>, <b>mask</b>, <b>separated</b>, <b>ycbcr</b>,\nand <b>cielab</b>.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;r</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Force image display in a full color window.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;s</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Stop on the first read error. By default all errors in\nthe input data are ignored and <i>tiffgt</i> does it&rsquo;s\nbest to display as much of an image as possible.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;w</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Enable reporting of warning messages from the\n<small>TIFF</small> library. By default <i>tiffgt</i>\nignores warning messages generated when reading an\nimage.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;v</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Place information in the title bar describing what type\nof window (full color or colormap) is being used, the name\nof the input file, and the directory index of the image (if\nnon-zero). By default, the window type is not shown in the\ntitle bar.</p>\n</td>\n<td width=\"0%\">\n</td>\n</table>\n<a name=\"BUGS\"></a>\n<h2>BUGS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>Images wider and taller than the display are silently\ntruncated to avoid crashing old versions of the window\nmanager.</p>\n</td>\n</table>\n<a name=\"SEE ALSO\"></a>\n<h2>SEE ALSO</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>tiffdump</b>(1), <b>tiffinfo</b>(1), <b>tiffcp</b>(1),\n<b>libtiff</b>(3TIFF)</p>\n<!-- INDENTATION -->\n<p>Libtiff library home page:\n<b>http://www.remotesensing.org/libtiff/</b></p>\n</td>\n</table>\n<hr>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/tiffinfo.1.html",
    "content": "<!-- Creator     : groff version 1.18.1 -->\n<!-- CreationDate: Fri Jul 13 17:43:20 2007 -->\n<html>\n<head>\n<meta name=\"generator\" content=\"groff -Thtml, see www.gnu.org\">\n<meta name=\"Content-Style\" content=\"text/css\">\n<title>TIFFINFO</title>\n</head>\n<body>\n\n<h1 align=center>TIFFINFO</h1>\n<a href=\"#NAME\">NAME</a><br>\n<a href=\"#SYNOPSIS\">SYNOPSIS</a><br>\n<a href=\"#DESCRIPTION\">DESCRIPTION</a><br>\n<a href=\"#OPTIONS\">OPTIONS</a><br>\n<a href=\"#SEE ALSO\">SEE ALSO</a><br>\n\n<hr>\n<a name=\"NAME\"></a>\n<h2>NAME</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>tiffinfo &minus; print information about\n<small>TIFF</small> files</p>\n</td>\n</table>\n<a name=\"SYNOPSIS\"></a>\n<h2>SYNOPSIS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>tiffinfo</b> [ <i>options</i> ] <i>input.tif\n...</i></p>\n</td>\n</table>\n<a name=\"DESCRIPTION\"></a>\n<h2>DESCRIPTION</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><i>Tiffinfo</i> displays information about files created\naccording to the Tag Image File Format, Revision 6.0. By\ndefault, the contents of each <small>TIFF</small> directory\nin each file is displayed, with the value of each tag shown\nsymbolically (where sensible).</p>\n</td>\n</table>\n<a name=\"OPTIONS\"></a>\n<h2>OPTIONS</h2>\n<!-- TABS -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"5\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;c</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Display the colormap and color/gray response curves, if\npresent.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;D</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>In addition to displaying the directory tags, read and\ndecompress all the data in each image (but not display\nit).</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;d</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>In addition to displaying the directory tags, print each\nbyte of decompressed data in hexadecimal.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;j</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Display any <small>JPEG</small> -related tags that are\npresent.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;o</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Set the initial <small>TIFF</small> directory according\nto the specified file offset. The file offset may be\nspecified using the usual C-style syntax; i.e. a leading\n&lsquo;&lsquo;0x&rsquo;&rsquo; for hexadecimal and a leading\n&lsquo;&lsquo;0&rsquo;&rsquo; for octal.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;s</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Display the offsets and byte counts for each data strip\nin a directory.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;z</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Enable strip chopping when reading image data.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;#</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Set the initial <small>TIFF</small> directory to\n<i>#</i>.</p>\n</td>\n<td width=\"0%\">\n</td>\n</table>\n<a name=\"SEE ALSO\"></a>\n<h2>SEE ALSO</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>pal2rgb</b>(1), <b>tiffcp</b>(1), <b>tiffcmp</b>(1),\n<b>tiffmedian</b>(1), <b>libtiff</b>(3TIFF)</p>\n<!-- INDENTATION -->\n<p>Libtiff library home page:\n<b>http://www.remotesensing.org/libtiff/</b></p>\n</td>\n</table>\n<hr>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/tiffmedian.1.html",
    "content": "<!-- Creator     : groff version 1.18.1 -->\n<!-- CreationDate: Fri Jul 13 17:43:20 2007 -->\n<html>\n<head>\n<meta name=\"generator\" content=\"groff -Thtml, see www.gnu.org\">\n<meta name=\"Content-Style\" content=\"text/css\">\n<title>TIFFMEDIAN</title>\n</head>\n<body>\n\n<h1 align=center>TIFFMEDIAN</h1>\n<a href=\"#NAME\">NAME</a><br>\n<a href=\"#SYNOPSIS\">SYNOPSIS</a><br>\n<a href=\"#DESCRIPTION\">DESCRIPTION</a><br>\n<a href=\"#OPTIONS\">OPTIONS</a><br>\n<a href=\"#NOTES\">NOTES</a><br>\n<a href=\"#SEE ALSO\">SEE ALSO</a><br>\n\n<hr>\n<a name=\"NAME\"></a>\n<h2>NAME</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>tiffmedian &minus; apply the median cut algorithm to data\nin a <small>TIFF</small> file</p>\n</td>\n</table>\n<a name=\"SYNOPSIS\"></a>\n<h2>SYNOPSIS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>tiffmedian</b> [ <i>options</i> ] <i>input.tif\noutput.tif</i></p>\n</td>\n</table>\n<a name=\"DESCRIPTION\"></a>\n<h2>DESCRIPTION</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><i>tiffmedian</i> applies the median cut algorithm to an\n<small>RGB</small> image in <i>input.tif</i> to generate a\npalette image that is written to <i>output.tif</i>. The\ngenerated colormap has, by default, 256 entries. The image\ndata is quantized by mapping each pixel to the closest color\nvalues in the colormap.</p>\n</td>\n</table>\n<a name=\"OPTIONS\"></a>\n<h2>OPTIONS</h2>\n<!-- TABS -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"5\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"></td>\n<td width=\"2%\">\n\n<p><b>&minus;c</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Specify the compression to use for data written to the\noutput file: <b>none</b> for no compression, <b>packbits</b>\nfor PackBits compression, <b>lzw</b> for Lempel-Ziv &amp;\nWelch compression, and <b>zip</b> for Deflate compression.\nBy default <i>tiffmedian</i> will compress data according to\nthe value of the <i>Compression</i> tag found in the source\nfile.</p>\n</td>\n<td width=\"0%\">\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"17%\"></td>\n<td width=\"82%\">\n<p><small>LZW</small> compression can be specified together\nwith a <i>predictor</i> value. A predictor value of 2 causes\neach scanline of the output image to undergo horizontal\ndifferencing before it is encoded; a value of 1 forces each\nscanline to be encoded without differencing. LZW-specific\noptions are specified by appending a\n&lsquo;&lsquo;:&rsquo;&rsquo;-separated list to the\n&lsquo;&lsquo;lzw&rsquo;&rsquo; option; e.g. <b>&minus;c\nlzw:2</b> for <small>LZW</small> compression with horizontal\ndifferencing.</p>\n</td>\n</table>\n<!-- TABS -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"5\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"2%\">\n\n<p><b>&minus;C</b></p>\n</td>\n<td width=\"6%\"></td>\n<td width=\"80%\">\n\n<p>Specify the number of entries to use in the generated\ncolormap. By default all 256 entries/colors are used.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"2%\">\n\n<p><b>&minus;f</b></p>\n</td>\n<td width=\"6%\"></td>\n<td width=\"80%\">\n\n<p>Apply Floyd-Steinberg dithering before selecting a\ncolormap entry.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"2%\">\n\n<p><b>&minus;r</b></p>\n</td>\n<td width=\"6%\"></td>\n<td width=\"80%\">\n\n<p>Specify the number of rows (scanlines) in each strip of\ndata written to the output file. By default,\n<i>tiffmedian</i> attempts to set the rows/strip that no\nmore than 8 kilobytes of data appear in a strip.</p>\n</td>\n<td width=\"0%\">\n</td>\n</table>\n<a name=\"NOTES\"></a>\n<h2>NOTES</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>This program is derived from Paul Heckbert&rsquo;s\n<i>median</i> program.</p>\n</td>\n</table>\n<a name=\"SEE ALSO\"></a>\n<h2>SEE ALSO</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>pal2rgb</b>(1), <b>tiffinfo</b>(1), <b>tiffcp</b>(1),\n<b>tiffcmp</b>(1), <b>libtiff</b>(3TIFF)</p>\n<!-- INDENTATION -->\n<p><b>Color Image Quantization for Frame Buffer Display</b>,\nPaul Heckbert, SIGGRAPH proceedings, 1982, pp. 297-307.</p>\n<!-- INDENTATION -->\n<p>Libtiff library home page:\n<b>http://www.remotesensing.org/libtiff/</b></p>\n</td>\n</table>\n<hr>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/tiffset.1.html",
    "content": "<!-- Creator     : groff version 1.18.1 -->\n<!-- CreationDate: Fri Jul 13 17:43:20 2007 -->\n<html>\n<head>\n<meta name=\"generator\" content=\"groff -Thtml, see www.gnu.org\">\n<meta name=\"Content-Style\" content=\"text/css\">\n<title>TIFFSET</title>\n</head>\n<body>\n\n<h1 align=center>TIFFSET</h1>\n<a href=\"#NAME\">NAME</a><br>\n<a href=\"#SYNOPSIS\">SYNOPSIS</a><br>\n<a href=\"#DESCRIPTION\">DESCRIPTION</a><br>\n<a href=\"#OPTIONS\">OPTIONS</a><br>\n<a href=\"#EXAMPLES\">EXAMPLES</a><br>\n<a href=\"#SEE ALSO\">SEE ALSO</a><br>\n\n<hr>\n<a name=\"NAME\"></a>\n<h2>NAME</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>tiffset &minus; set a field in a <small>TIFF</small>\nheader</p>\n</td>\n</table>\n<a name=\"SYNOPSIS\"></a>\n<h2>SYNOPSIS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>tiffset</b> [ <i>options</i> ] <i>filename.tif</i></p>\n</td>\n</table>\n<a name=\"DESCRIPTION\"></a>\n<h2>DESCRIPTION</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><i>Tiffset</i> sets the value of a <small>TIFF</small>\nheader to a specified value.</p>\n</td>\n</table>\n<a name=\"OPTIONS\"></a>\n<h2>OPTIONS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>&minus;s</b> <i>tagnumber</i> [ <i>count</i> ]\n<i>value ...</i></p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"19%\"></td>\n<td width=\"80%\">\n<p>Set the value of the named tag to the value or values\nspecified.</p>\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>&minus;sf</b> <i>tagnumber filename</i></p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"19%\"></td>\n<td width=\"80%\">\n<p>Set the value of the tag to the contents of filename.\nThis option is supported for ASCII tags only.</p>\n</td>\n</table>\n<a name=\"EXAMPLES\"></a>\n<h2>EXAMPLES</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>The following example sets the image description tag\n(270) of a.tif to the contents of the file descrip:</p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"17%\"></td>\n<td width=\"82%\">\n<pre>tiffset &minus;sf 270 descrip a.tif\n</pre>\n</td>\n</table>\n<!-- INDENTATION -->\n\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>The following example sets the artist tag (315) of a.tif\nto the string\n&lsquo;&lsquo;Anonymous&rsquo;&rsquo;:</p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"17%\"></td>\n<td width=\"82%\">\n<pre>tiffset &minus;s 305 Anonymous a.tif\n</pre>\n</td>\n</table>\n<!-- INDENTATION -->\n\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>This example sets the resolution of the file a.tif to 300\ndpi:</p></td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"17%\"></td>\n<td width=\"82%\">\n<pre>tiffset &minus;s 296 2 a.tif\ntiffset &minus;s 282 300.0 a.tif\ntiffset &minus;s 283 300.0 a.tif\n</pre>\n</td>\n</table>\n<a name=\"SEE ALSO\"></a>\n<h2>SEE ALSO</h2>\n<!-- INDENTATION -->\n\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>tiffdump</b>(1), <b>tiffinfo</b>(1), <b>tiffcp</b>(1),\n<b>libtiff</b>(3TIFF)</p>\n<!-- INDENTATION -->\n<p>Libtiff library home page:\n<b>http://www.remotesensing.org/libtiff/</b></p>\n</td>\n</table>\n<hr>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/tiffsplit.1.html",
    "content": "<!-- Creator     : groff version 1.18.1 -->\n<!-- CreationDate: Fri Jul 13 17:43:20 2007 -->\n<html>\n<head>\n<meta name=\"generator\" content=\"groff -Thtml, see www.gnu.org\">\n<meta name=\"Content-Style\" content=\"text/css\">\n<title>TIFFSPLIT</title>\n</head>\n<body>\n\n<h1 align=center>TIFFSPLIT</h1>\n<a href=\"#NAME\">NAME</a><br>\n<a href=\"#SYNOPSIS\">SYNOPSIS</a><br>\n<a href=\"#DESCRIPTION\">DESCRIPTION</a><br>\n<a href=\"#OPTIONS\">OPTIONS</a><br>\n<a href=\"#BUGS\">BUGS</a><br>\n<a href=\"#SEE ALSO\">SEE ALSO</a><br>\n\n<hr>\n<a name=\"NAME\"></a>\n<h2>NAME</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>tiffsplit &minus; split a multi-image <small>TIFF</small>\ninto single-image <small>TIFF</small> files</p>\n</td>\n</table>\n<a name=\"SYNOPSIS\"></a>\n<h2>SYNOPSIS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>tiffsplit</b> <i>src.tif</i> [ <i>prefix</i> ]</p>\n</td>\n</table>\n<a name=\"DESCRIPTION\"></a>\n<h2>DESCRIPTION</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><i>tiffsplit</i> takes a multi-directory (page)\n<small>TIFF</small> file and creates one or more\nsingle-directory (page) <small>TIFF</small> files from it.\nThe output files are given names created by concatenating a\nprefix, a lexically ordered suffix in the range\n[<i>aaa</i>-<i>zzz</i>], the suffix <i>.tif</i> (e.g.\n<i>xaaa.tif</i>, <i>xaab.tif</i>, <i>xzzz.tif</i>). If a\nprefix is not specified on the command line, the default\nprefix of <i>x</i> is used.</p>\n</td>\n</table>\n<a name=\"OPTIONS\"></a>\n<h2>OPTIONS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>None.</p>\n</td>\n</table>\n<a name=\"BUGS\"></a>\n<h2>BUGS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>Only a select set of &lsquo;&lsquo;known\ntags&rsquo;&rsquo; is copied when splitting.</p>\n</td>\n</table>\n<a name=\"SEE ALSO\"></a>\n<h2>SEE ALSO</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>tiffcp</b>(1), <b>tiffinfo</b>(1),\n<b>libtiff</b>(3TIFF)</p>\n<!-- INDENTATION -->\n<p>Libtiff library home page:\n<b>http://www.remotesensing.org/libtiff/</b></p>\n</td>\n</table>\n<hr>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/man/tiffsv.1.html",
    "content": "<!-- Creator     : groff version 1.18.1 -->\n<!-- CreationDate: Fri Jul 13 17:43:20 2007 -->\n<html>\n<head>\n<meta name=\"generator\" content=\"groff -Thtml, see www.gnu.org\">\n<meta name=\"Content-Style\" content=\"text/css\">\n<title>TIFFSV</title>\n</head>\n<body>\n\n<h1 align=center>TIFFSV</h1>\n<a href=\"#NAME\">NAME</a><br>\n<a href=\"#SYNOPSIS\">SYNOPSIS</a><br>\n<a href=\"#DESCRIPTION\">DESCRIPTION</a><br>\n<a href=\"#OPTIONS\">OPTIONS</a><br>\n<a href=\"#NOTE\">NOTE</a><br>\n<a href=\"#BUGS\">BUGS</a><br>\n<a href=\"#SEE ALSO\">SEE ALSO</a><br>\n\n<hr>\n<a name=\"NAME\"></a>\n<h2>NAME</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>tiffsv &minus; save an image from the framebuffer in a\n<small>TIFF</small> file (Silicon Graphics version)</p>\n</td>\n</table>\n<a name=\"SYNOPSIS\"></a>\n<h2>SYNOPSIS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>tiffsv</b> [ <i>options</i> ] <i>output.tif</i> [\n<i>x1 x2 y1 y2</i> ]</p>\n</td>\n</table>\n<a name=\"DESCRIPTION\"></a>\n<h2>DESCRIPTION</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><i>tiffsv</i> saves all or part of the framebuffer in a\nfile using the Tag Image File Format, Revision 6.0. By\ndefault, the image is saved with data samples packed\n(<i>PlanarConfiguration</i>=1), compressed with the\nLempel-Ziv &amp; Welch algorithm (<i>Compression</i>=5), and\nwith each strip no more than 8 kilobytes. These\ncharacteristics can be overridden, or explicitly specified\nwith the options described below.</p>\n</td>\n</table>\n<a name=\"OPTIONS\"></a>\n<h2>OPTIONS</h2>\n<!-- TABS -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"5\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;b</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Save the image as a greyscale image as if it were\nprocessed by <i>tiff2bw</i>(1). This option is included for\ncompatibility with the standard <i>scrsave</i>(6D)\nprogram.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;c</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Specify the compression to use for data written to the\noutput file: <b>none</b> for no compression, <b>packbits</b>\nfor PackBits compression, <b>jpeg</b> for baseline JPEG\ncompression, <b>zip</b> for Deflate compression, and\n<b>lzw</b> for Lempel-Ziv &amp; Welch compression\n(default).</p>\n</td>\n<td width=\"0%\">\n</td>\n</table>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"17%\"></td>\n<td width=\"82%\">\n<p><small>LZW</small> compression can be specified together\nwith a <i>predictor</i> value. A predictor value of 2 causes\neach scanline of the output image to undergo horizontal\ndifferencing before it is encoded; a value of 1 forces each\nscanline to be encoded without differencing. LZW-specific\noptions are specified by appending a\n&lsquo;&lsquo;:&rsquo;&rsquo;-separated list to the\n&lsquo;&lsquo;lzw&rsquo;&rsquo; option; e.g. <b>&minus;c\nlzw:2</b> for <small>LZW</small> compression with horizontal\ndifferencing.</p>\n</td>\n</table>\n<!-- TABS -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"5\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;p</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Specify the planar configuration to use in writing image\ndata. By default, <i>tiffsv</i> will create a new file with\nthe data samples packed contiguously. Specifying <b>&minus;p\ncontig</b> will force data to be written with multi-sample\ndata packed together, while <b>&minus;p separate</b> will\nforce samples to be written in separate planes.</p>\n</td>\n<td width=\"0%\">\n</td>\n<tr valign=\"top\" align=\"left\">\n<td width=\"10%\"></td>\n<td width=\"3%\">\n\n<p><b>&minus;r</b></p>\n</td>\n<td width=\"5%\"></td>\n<td width=\"80%\">\n\n<p>Specify the number of rows (scanlines) in each strip of\ndata written to the output file. By default, <i>tiffsv</i>\nattempts to set the rows/strip that no more than 8 kilobytes\nof data appear in a strip.</p>\n</td>\n<td width=\"0%\">\n</td>\n</table>\n<a name=\"NOTE\"></a>\n<h2>NOTE</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>Except for the use of <small>TIFF,</small> this program\nis equivalent to the standard <i>scrsave</i> program. This\nmeans, for example, that you can use it in conjunction with\nthe standard <i>icut</i> program simply by creating a link\ncalled <i>scrsave</i>, or by creating a shell script called\n<i>scrsave</i> that invokes <i>tiffgt</i> with the\nappropriate options.</p>\n</td>\n</table>\n<a name=\"BUGS\"></a>\n<h2>BUGS</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p>If data are saved compressed and in separate planes, then\nthe rows in each strip is silently set to one to avoid\nlimitations in the <b>libtiff</b>(3TIFF) library.</p>\n</td>\n</table>\n<a name=\"SEE ALSO\"></a>\n<h2>SEE ALSO</h2>\n<!-- INDENTATION -->\n<table width=\"100%\" border=0 rules=\"none\" frame=\"void\"\n       cols=\"2\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"></td>\n<td width=\"91%\">\n<p><b>scrsave</b>(6D) <b>pal2rgb</b>(1), <b>tiffdump</b>(1),\n<b>tiffgt</b>(1), <b>tiffinfo</b>(1), <b>tiffcp</b>(1),\n<b>tiffmedian</b>(1), <b>libtiff</b>(3TIFF)</p>\n<!-- INDENTATION -->\n<p>Libtiff library home page:\n<b>http://www.remotesensing.org/libtiff/</b></p>\n</td>\n</table>\n<hr>\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/misc.html",
    "content": "<HTML>\n<HEAD>\n<TITLE>\nAcknowledgments and Other Issues\n</TITLE>\n</HEAD>\n<BODY BGCOLOR=white> \n<FONT FACE=\"Arial, Helvetica, Sans\"> \n<H1>\n<IMG SRC=images/ring.gif WIDTH=124 HEIGHT=124 ALIGN=left BORDER=1 HSPACE=6>\nAcknowledgments and Other Issues\n</H1>\n\n<P>\nSilicon Graphics has seen fit to allow us to give this work away.  It\nis free.  There is no support or guarantee of any sort as to its\noperations, correctness, or whatever.  If you do anything useful with\nall or parts of it you need to honor the copyright notices.  It would\nalso be nice to be acknowledged.<p>\n\n<BR CLEAR=left>\n\n<H2>Acknowledgements</H2>\n\nThe libtiff software was written by Sam Leffler while working for\nSilicon Graphics.<p>\n\nThe LZW algorithm is derived from the compress program (the proper attribution\nis included in the source code).  The Group 3 fax stuff originated as code\nfrom Jef Poskanzer, but has since been rewritten several times.  The latest\nversion uses an algorithm from Frank Cringle -- consult\n<TT>libtiff/mkg3states.c</TT> and <TT>libtiff/tif_fax3.h</TT> for further\ninformation. The JPEG support was written by Tom Lane and is dependent on the\nexcellent work of Tom Lane and the Independent JPEG Group (IJG) who distribute\ntheir work under friendly licensing similar to this software. Joris Van Damme\nimplemented the robust Old JPEG decoder (as included in libtiff since version\n3.9.0, there was another Old JPEG module in older releases, which was\nincomplete and unsuitable for many existing images of that format). JBIG\nmodule was written by Lee Howard and depends on JBIG library from the Markus\nKuhn. Many other people have by now helped with bug fixes and code; a few of\nthe more persistent contributors have been:\n\n<PRE>\n    Bjorn P. Brox\n    Dan McCoy\n    J.T. Conklin                \n    Richard Minner\n    Frank D. Cringle        \n    Richard Mlynarik\n    Soren Pingel Dalsgaard  \n    Niles Ritter\n    Steve Johnson           \n    Karsten Spang\n    Tom Lane               \n    Peter Smith\n    Brent Roman            \n    Mike Welles\n    Frank Warmerdam\n    Greg Ward\n    Stanislav Brabec        \n    Roman Shpount\n    Peter Skarpetis        \n    Arvan Pritchard\n    Bernt Herd             \n    Joseph Orost\n    Phil Beffery           \n    Ivo Penzar\n    Francois Dagand        \n    Albert Chin-A-Young\n    Bruce A. Mallett\n    Dwight Kelly\n    Andrey Kiselev\n    Ross Finlayson\n    Dmitry V. Levin\n    Bob Friesenhahn\n    Lee Howard\n    Joris Van Damme\n    Tavis Ormandy\n    Richard Nolde\n</PRE>\n\n(my apology to anyone that was inadvertently not listed.)\n\n<H2>Use and Copyright</H2>\n\n<P><H5><PRE>\nCopyright (c) 1988-1997 Sam Leffler\nCopyright (c) 1991-1997 Silicon Graphics, Inc.\n\nPermission to use, copy, modify, distribute, and sell this software and \nits documentation for any purpose is hereby granted without fee, provided\nthat (i) the above copyright notices and this permission notice appear in\nall copies of the software and related documentation, and (ii) the names of\nSam Leffler and Silicon Graphics may not be used in any advertising or\npublicity relating to the software without the specific, prior written\npermission of Sam Leffler and Silicon Graphics.\n\nTHE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \nEXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \nWARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n\nIN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\nANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\nOR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\nWHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \nLIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \nOF THIS SOFTWARE.\n</PRE></H5>\n\n<P>\n<HR>\n\n\nLast updated: $Date: 2007/02/24 15:47:04 $\n</BODY>\n</HTML>\n"
  },
  {
    "path": "src/main/jni/tiff/html/support.html",
    "content": "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n<html lang=\"en\">\n<head>\n  <title>TIFF 6.0 Specification Coverage</title>\n  <meta http-equiv=\"content-type\" content=\"text/html; charset=ISO-8859-1\">\n  <meta http-equiv=\"content-language\" content=\"en\">\n  <style type=\"text/css\">\n  <!--\n    th {text-align: left; vertical-align: top; font-style: italic; font-weight: normal}\n  -->\n  </style>\n</head>\n<body lang=\"en\" text=\"#000000\" bgcolor=\"#ffffff\" link=\"#0000ff\" alink=\"#0000ff\" vlink=\"#0000ff\">\n  <table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n    <tr>\n      <td style=\"padding-left: 1em; padding-right: 1em\"><img src=\"images/strike.gif\" width=\"128\" height=\"100\" alt=\"\"></td>\n      <td>\n        <h1>TIFF 6.0 Specification Coverage</h1>\n        <p>\n          The library is capable of dealing with images that are written to\n          follow the 5.0 or 6.0 TIFF spec.  There is also considerable support\n          for some of the more esoteric portions of the 6.0 TIFF spec.\n        </p>\n      </td>\n    </tr>\n  </table>\n  <br>\n  <table border=\"1\" cellspacing=\"0\" cellpadding=\"5\">\n    <tr>\n      <th>Core requirements</th>\n      <td>\n        <p>\n          Both <tt>\"MM\"</tt> and <tt>\"II\"</tt> byte orders are handled.\n          Both packed and separated planar configuration of samples.\n          Any number of samples per pixel (memory permitting).\n          Any image width and height (memory permitting).\n          Multiple subfiles can be read and written.\n          Editing is <b>not</b> supported in that related subfiles (e.g.\n          a reduced resolution version of an image) are not automatically\n          updated.\n        </p>\n        <p>\n          Tags handled: <tt>ExtraSamples</tt>, <tt>ImageWidth</tt>,\n          <tt>ImageLength</tt>, <tt>NewSubfileType</tt>, <tt>ResolutionUnit</tt>.\n          <tt>Rowsperstrip</tt>, <tt>StripOffsets</tt>, <tt>StripByteCounts</tt>,\n          <tt>XResolution</tt>, <tt>YResolution</tt>\n        </p>\n      </td>\n    </tr>\n    <tr>\n      <th>Tiled Images</th>\n      <td><tt>TileWidth</tt>, <tt>TileLength</tt>, <tt>TileOffsets</tt>,\n        <tt>TileByteCounts</tt></td>\n    </tr>\n    <tr>\n      <th>Image Colorimetry Information</th>\n      <td><tt>WhitePoint</tt>, <tt>PrimaryChromaticities</tt>, <tt>TransferFunction</tt>,\n        <tt>ReferenceBlackWhite</tt></td>\n    </tr>\n    <tr>\n      <th>Class B for bilevel images</th>\n      <td><tt>SamplesPerPixel</tt> = 1<br>\n        <tt>BitsPerSample</tt> = 1<br>\n        <tt>Compression</tt> = 1 (none), 2 (CCITT 1D), or 32773 (PackBits)<br>\n        <tt>PhotometricInterpretation</tt> = 0 (Min-is-White), 1 (Min-is-Black)</td>\n    </tr>\n    <tr>\n      <th>Class G for grayscale images</th>\n      <td><tt>SamplesPerPixel</tt> = 1<br>\n        <tt>BitsPerSample</tt> = 4, 8<br>\n        <tt>Compression</tt> = 1 (none) 5 (LZW)<br>\n        <tt>PhotometricInterpretation</tt> = 0 (Min-is-White), 1 (Min-is-Black)</td>\n    </tr>\n    <tr>\n      <th>Class P for palette color images</th>\n      <td><tt>SamplesPerPixel</tt> = 1<br>\n        <tt>BitsPerSample</tt> = 1-8<br>\n        <tt>Compression</tt> = 1 (none) 5 (LZW)<br>\n        <tt>PhotometricInterpretation</tt> = 3 (Palette RGB)<br>\n        <tt>ColorMap</tt></td>\n    </tr>\n    <tr>\n      <th>Class R for RGB full color images</th>\n      <td><tt>SamplesPerPixel</tt> = 3<br>\n        <tt>BitsPerSample</tt> = &lt;8,8,8&gt;<br>\n        <tt>PlanarConfiguration</tt> = 1, 2<br>\n        <tt>Compression</tt> = 1 (none) 5 (LZW)<br>\n        <tt>PhotometricInterpretation</tt> = 2 (RGB)</td>\n    </tr>\n    <tr>\n      <th>Class F for facsimile</th>\n      <td>(<i>Class B tags plus...</i>)<br>\n        <tt>Compression</tt> = 3 (CCITT Group 3), 4 (CCITT Group 4)<br>\n        <tt>FillOrder</tt> = 1 (MSB), 2 (LSB)<br>\n        <tt>Group3Options</tt> = 1 (2d encoding), 4 (zero fill), 5 (2d+fill)<br>\n        <tt>ImageWidth</tt> = 1728, 2048, 2482<br>\n        <tt>NewSubFileType</tt> = 2<br>\n        <tt>ResolutionUnit</tt> = 2 (Inch), 3 (Centimeter)<br>\n        <tt>PageNumber</tt>,\n        <tt>XResolution</tt>,\n        <tt>YResolution</tt>,\n        <tt>Software</tt>,\n        <tt>BadFaxLines</tt>,\n        <tt>CleanFaxData</tt>,\n        <tt>ConsecutiveBadFaxLines</tt>,\n        <tt>DateTime</tt>,\n        <tt>DocumentName</tt>,\n        <tt>ImageDescription</tt>,\n        <tt>Orientation</tt></td>\n    </tr>\n    <tr>\n      <th>Class S for separated images</th>\n      <td><tt>SamplesPerPixel</tt> = 4<br>\n        <tt>PlanarConfiguration</tt> = 1, 2<br>\n        <tt>Compression</tt> = 1 (none), 5 (LZW)<br>\n        <tt>PhotometricInterpretation</tt> = 5 (Separated)<br>\n        <tt>InkSet</tt> = 1 (CMYK)<br>\n        <tt>DotRange</tt>,\n        <tt>InkNames</tt>,\n        <tt>DotRange</tt>,\n        <tt>TargetPrinter</tt></td>\n    </tr>\n    <tr>\n      <th>Class Y for YCbCr images</th>\n      <td><tt>SamplesPerPixel</tt> = 3<br>\n        <tt>BitsPerSample</tt> = &lt;8,8,8&gt;<br>\n        <tt>PlanarConfiguration</tt> = 1, 2<br>\n        <tt>Compression</tt> = 1 (none),  5 (LZW), 7 (JPEG)<br>\n        <tt>PhotometricInterpretation</tt> = 6 (YCbCr)<br>\n        <tt>YCbCrCoefficients</tt>,\n        <tt>YCbCrSubsampling</tt>,\n        <tt>YCbCrPositioning</tt><br>\n        (<i>colorimetry info from Appendix H; see above</i>)</td>\n    </tr>\n    <tr>\n      <th>Class \"JPEG\" for JPEG images (per TTN2)</th>\n      <td><tt>PhotometricInterpretation</tt> = 1 (grayscale), 2 (RGB), 5 (CMYK), 6 (YCbCr)<br>\n        (<i>Class Y tags if YCbCr</i>)<br>\n        (<i>Class S tags if CMYK</i>)<br>\n        <tt>Compression</tt> = 7 (JPEG)</td>\n    </tr>\n  </table>\n  <p>\n    In addition, the library supports some optional compression algorithms\n    that are, in some cases, of dubious value.\n  </p>\n  <table border=\"0\" cellspacing=\"0\" cellpadding=\"2\">\n    <tr><th>Compression tag value</th><th>Compression algorithm</th></tr>\n    <tr><td>32766</td><td>NeXT 2-bit encoding</td></tr>\n    <tr><td>32809</td><td>ThunderScan 4-bit encoding</td></tr>\n    <tr><td>32909</td><td>Pixar companded 11-bit ZIP encoding</td></tr>\n    <tr><td>32946</td><td>PKZIP-style Deflate encoding (experimental)</td></tr>\n    <tr><td>34676</td><td>SGI 32-bit Log Luminance encoding (experimental)</td></tr>\n    <tr><td>34677</td><td>SGI 24-bit Log Luminance encoding (experimental)</td></tr>\n  </table>\n  <br>\n  <p>\n    Note that there is no support for the JPEG-related tags defined\n    in the 6.0 specification; the JPEG support is based on the post-6.0\n    proposal given in TIFF Technical Note #2.\n  </p>\n  <table>\n    <tr>\n      <td valign=top><img src=\"images/info.gif\" width=\"32\" height=\"32\" alt=\"\"></td>\n      <td>For more information on the experimental Log Luminance encoding\n        consult the materials available at\n        <a href=\"http://www.anyhere.com/gward/pixformat/tiffluv.html\">http://www.anyhere.com/gward/pixformat/tiffluv.html</a>.</td>\n    </tr>\n  </table>\n  <br>\n  <p>\n    The following table shows the tags that are recognized\n    and how they are used by the library.  If no use is indicated,\n    then the library reads and writes the tag, but does not use it internally.\n  </p>\n  <table border=\"1\" cellspacing=\"0\" cellpadding=\"5\">\n    <tr>\n      <th>Tag Name</th>\n      <th>Value</th>\n      <th>R/W</th>\n      <th>Library's Use (Comments)</th>\n    </tr>\n    <tr>\n      <td><tt>NewSubFileType</tt></td>\n      <td>254</td>\n      <td>R/W</td>\n      <td>none (called <tt>SubFileType</tt> in &lt;tiff.h&gt;)</td>\n    </tr>\n    <tr>\n      <td><tt>SubFileType</tt></td>\n      <td>255</td>\n      <td>R/W</td>\n      <td>none (called <tt>OSubFileType</tt> in &lt;tiff.h&gt;)</td>\n    </tr>\n    <tr>\n      <td><tt>ImageWidth</tt></td>\n      <td>256</td>\n      <td>R/W</td>\n      <td>lots</td>\n    </tr>\n    <tr>\n      <td><tt>ImageLength</tt></td>\n      <td>257</td>\n      <td>R/W</td>\n      <td>lots</td>\n    </tr>\n    <tr>\n      <td><tt>BitsPerSample</tt></td>\n      <td>258</td>\n      <td>R/W</td>\n      <td>lots</td>\n    </tr>\n    <tr>\n      <td><tt>Compression</tt></td>\n      <td>259</td>\n      <td>R/W</td>\n      <td>to select appropriate codec</td>\n    </tr>\n    <tr>\n      <td><tt>PhotometricInterpretation</tt></td>\n      <td>262</td>\n      <td>R/W</td>\n      <td>lots</td>\n    </tr>\n    <tr>\n      <td><tt>Thresholding</tt></td>\n      <td>263</td>\n      <td>R/W</td>\n      <td>&nbsp;</td>\n    </tr>\n    <tr>\n      <td><tt>CellWidth</tt></td>\n      <td>264</td>\n      <td>&nbsp;</td>\n      <td>parsed but ignored</td>\n    </tr>\n    <tr>\n      <td><tt>CellLength</tt></td>\n      <td>265</td>\n      <td>&nbsp;</td>\n      <td>parsed but ignored</td>\n    </tr>\n    <tr>\n      <td><tt>FillOrder</tt></td>\n      <td>266</td>\n      <td>R/W</td>\n      <td>control bit order</td>\n    </tr>\n    <tr>\n      <td><tt>DocumentName</tt></td>\n      <td>269</td>\n      <td>R/W</td>\n      <td>&nbsp;</td>\n    </tr>\n    <tr>\n      <td><tt>ImageDescription</tt></td>\n      <td>270</td>\n      <td>R/W</td>\n      <td>&nbsp;</td>\n    </tr>\n    <tr>\n      <td><tt>Make</tt></td>\n      <td>271</td>\n      <td>R/W</td>\n      <td>&nbsp;</td>\n    </tr>\n    <tr>\n      <td><tt>Model</tt></td>\n      <td>272</td>\n      <td>R/W</td>\n      <td>&nbsp;</td>\n    </tr>\n    <tr>\n      <td><tt>StripOffsets</tt></td>\n      <td>273</td>\n      <td>R/W</td>\n      <td>data i/o</td>\n    </tr>\n    <tr>\n      <td><tt>Orientation</tt></td>\n      <td>274</td>\n      <td>R/W</td>\n      <td>&nbsp;</td>\n    </tr>\n    <tr>\n      <td><tt>SamplesPerPixel</tt></td>\n      <td>277</td>\n      <td>R/W</td>\n      <td>lots</td>\n    </tr>\n    <tr>\n      <td><tt>RowsPerStrip</tt></td>\n      <td>278</td>\n      <td>R/W</td>\n      <td>data i/o</td>\n    </tr>\n    <tr>\n    <td><tt>StripByteCounts</tt></td>\n      <td>279</td>\n      <td>R/W</td>\n      <td>data i/o</td>\n    </tr>\n    <tr>\n      <td><tt>MinSampleValue</tt></td>\n      <td>280</td>\n      <td>R/W</td>\n      <td>&nbsp;</td>\n    </tr>\n    <tr>\n      <td><tt>MaxSampleValue</tt></td>\n      <td>281</td>\n      <td>R/W</td>\n      <td>&nbsp;</td>\n    </tr>\n    <tr>\n      <td><tt>XResolution</tt></td>\n      <td>282</td>\n      <td>R/W</td>\n      <td>&nbsp;</td>\n    </tr>\n    <tr>\n      <td><tt>YResolution</tt></td>\n      <td>283</td>\n      <td>R/W</td>\n      <td>used by Group 3 2d encoder</td>\n    </tr>\n    <tr>\n      <td><tt>PlanarConfiguration</tt></td>\n      <td>284</td>\n      <td>R/W</td>\n      <td>data i/o</td>\n    </tr>\n    <tr>\n      <td><tt>PageName</tt></td>\n      <td>285</td>\n      <td>R/W</td>\n      <td>&nbsp;</td>\n    </tr>\n    <tr>\n      <td><tt>XPosition</tt></td>\n      <td>286</td>\n      <td>R/W</td>\n      <td>&nbsp;</td>\n    </tr>\n    <tr>\n      <td><tt>YPosition</tt></td>\n      <td>286</td>\n      <td>R/W</td>\n      <td>&nbsp;</td>\n    </tr>\n    <tr>\n      <td><tt>FreeOffsets</tt></td>\n      <td>288</td>\n      <td>&nbsp;</td>\n      <td>parsed but ignored</td>\n    </tr>\n    <tr>\n      <td><tt>FreeByteCounts</tt></td>\n      <td>289</td>\n      <td>&nbsp;</td>\n      <td>parsed but ignored</td>\n    </tr>\n    <tr>\n      <td><tt>GrayResponseUnit</tt></td>\n      <td>290</td>\n      <td>&nbsp;</td>\n      <td>parsed but ignored</td>\n    </tr>\n    <tr>\n      <td><tt>GrayResponseCurve</tt></td>\n      <td>291</td>\n      <td>&nbsp;</td>\n      <td>parsed but ignored</td>\n    </tr>\n    <tr>\n      <td><tt>Group3Options</tt></td>\n      <td>292</td>\n      <td>R/W</td>\n      <td>used by Group 3 codec</td>\n    </tr>\n    <tr>\n      <td><tt>Group4Options</tt></td>\n      <td>293</td>\n      <td>R/W</td>\n      <td>&nbsp;</td>\n    </tr>\n    <tr>\n      <td><tt>ResolutionUnit</tt></td>\n      <td>296</td>\n      <td>R/W</td>\n      <td>used by Group 3 2d encoder</td>\n    </tr>\n    <tr>\n      <td><tt>PageNumber</tt></td>\n      <td>297</td>\n      <td>R/W</td>\n      <td>&nbsp;</td>\n    </tr>\n    <tr>\n      <td><tt>ColorResponseUnit</tt></td>\n      <td>300</td>\n      <td>&nbsp;</td>\n      <td>parsed but ignored</td>\n    </tr>\n    <tr>\n      <td><tt>TransferFunction</tt></td>\n      <td>301</td>\n      <td>R/W</td>\n      <td>&nbsp;</td>\n    </tr>\n    <tr>\n      <td><tt>Software</tt></td>\n      <td>305</td>\n      <td>R/W</td>\n      <td>&nbsp;</td>\n    </tr>\n    <tr>\n      <td><tt>DateTime</tt></td>\n      <td>306</td>\n      <td>R/W</td>\n      <td>&nbsp;</td>\n    </tr>\n    <tr>\n      <td><tt>Artist</tt></td>\n      <td>315</td>\n      <td>R/W</td>\n      <td>&nbsp;</td>\n    </tr>\n    <tr>\n      <td><tt>HostComputer</tt></td>\n      <td>316</td>\n      <td>R/W</td>\n      <td>&nbsp;</td>\n    </tr>\n    <tr>\n      <td><tt>Predictor</tt></td>\n      <td>317</td>\n      <td>R/W</td>\n      <td>used by LZW codec</td>\n    </tr>\n    <tr>\n      <td><tt>WhitePoint</tt></td>\n      <td>318</td>\n      <td>R/W</td>\n      <td>&nbsp;</td>\n    </tr>\n    <tr>\n      <td><tt>PrimaryChromacities</tt></td>\n      <td>319</td>\n      <td>R/W</td>\n      <td>&nbsp;</td>\n    </tr>\n    <tr>\n      <td><tt>ColorMap</tt></td>\n      <td>320</td>\n      <td>R/W</td>\n      <td>&nbsp;</td>\n    </tr>\n    <tr>\n      <td><tt>TileWidth</tt></td>\n      <td>322</td>\n      <td>R/W</td>\n      <td>data i/o</td>\n    </tr>\n    <tr>\n      <td><tt>TileLength</tt></td>\n      <td>323</td>\n      <td>R/W</td>\n      <td>data i/o</td>\n    </tr>\n    <tr>\n      <td><tt>TileOffsets</tt></td>\n      <td>324</td>\n      <td>R/W</td>\n      <td>data i/o</td>\n    </tr>\n    <tr>\n      <td><tt>TileByteCounts</tt></td>\n      <td>324</td>\n      <td>R/W</td>\n      <td>data i/o</td>\n    </tr>\n    <tr>\n      <td><tt>BadFaxLines</tt></td>\n      <td>326</td>\n      <td>R/W</td>\n      <td>&nbsp;</td>\n    </tr>\n    <tr>\n      <td><tt>CleanFaxData</tt></td>\n      <td>327</td>\n      <td>R/W</td>\n      <td>&nbsp;</td>\n    </tr>\n    <tr>\n      <td><tt>ConsecutiveBadFaxLines</tt></td>\n      <td>328</td>\n      <td>R/W</td>\n      <td>&nbsp;</td>\n    </tr>\n    <tr>\n      <td><tt>SubIFD</tt></td>\n      <td>330</td>\n      <td>R/W</td>\n      <td>subimage descriptor support</td>\n    </tr>\n    <tr>\n      <td><tt>InkSet</tt></td>\n      <td>332</td>\n      <td>R/W</td>\n      <td>&nbsp;</td>\n    </tr>\n    <tr>\n      <td><tt>InkNames</tt></td>\n      <td>333</td>\n      <td>R/W</td>\n      <td>&nbsp;</td>\n    </tr>\n    <tr>\n      <td><tt>DotRange</tt></td>\n      <td>336</td>\n      <td>R/W</td>\n      <td>&nbsp;</td>\n    </tr>\n    <tr>\n      <td><tt>TargetPrinter</tt></td>\n      <td>337</td>\n      <td>R/W</td>\n      <td>&nbsp;</td>\n    </tr>\n    <tr>\n      <td><tt>ExtraSamples</tt></td>\n      <td>338</td>\n      <td>R/W</td>\n      <td>lots</td>\n    </tr>\n    <tr>\n      <td><tt>SampleFormat</tt></td>\n      <td>339</td>\n      <td>R/W</td>\n      <td>&nbsp;</td>\n    </tr>\n    <tr>\n      <td><tt>SMinSampleValue</tt></td>\n      <td>340</td>\n      <td>R/W</td>\n      <td>&nbsp;</td>\n    </tr>\n    <tr>\n      <td><tt>SMaxSampleValue</tt></td>\n      <td>341</td>\n      <td>R/W</td>\n      <td>&nbsp;</td>\n    </tr>\n    <tr>\n      <td><tt>JPEGTables</tt></td>\n      <td>347</td>\n      <td>R/W</td>\n      <td>used by JPEG codec</td>\n    </tr>\n    <tr>\n      <td><tt>YCbCrCoefficients</tt></td>\n      <td>529</td>\n      <td>R/W</td>\n      <td>used by <tt>TIFFReadRGBAImage</tt> support</td>\n    </tr>\n    <tr>\n      <td><tt>YCbCrSubsampling</tt></td>\n      <td>530</td>\n      <td>R/W</td>\n      <td>tile/strip size calculations</td>\n    </tr>\n    <tr>\n      <td><tt>YCbCrPositioning</tt></td>\n      <td>531</td>\n      <td>R/W</td>\n      <td>&nbsp;</td>\n    </tr>\n    <tr>\n      <td><tt>ReferenceBlackWhite</tt></td>\n      <td>532</td>\n      <td>R/W</td>\n      <td>&nbsp;</td>\n    </tr>\n    <tr>\n      <td><tt>Matteing</tt></td>\n      <td>32995</td>\n      <td>R</td>\n      <td>none (obsoleted by <tt>ExtraSamples</tt> tag)</td>\n    </tr>\n    <tr>\n      <td><tt>DataType</tt></td>\n      <td>32996</td>\n      <td>R</td>\n      <td>none (obsoleted by <tt>SampleFormat</tt> tag)</td>\n    </tr>\n    <tr>\n      <td><tt>ImageDepth</tt></td>\n      <td>32997</td>\n      <td>R/W</td>\n      <td>tile/strip calculations</td>\n    </tr>\n    <tr>\n      <td><tt>TileDepth</tt></td>\n      <td>32998</td>\n      <td>R/W</td>\n      <td>tile/strip calculations</td>\n    </tr>\n    <tr>\n      <td><tt>StoNits</tt></td>\n      <td>37439</td>\n      <td>R/W</td>\n      <td>&nbsp;</td>\n    </tr>\n  </table>\n  <p>\n    The <tt>Matteing</tt> and <tt>DataType</tt>\n    tags have been obsoleted by the 6.0\n    <tt>ExtraSamples</tt> and <tt>SampleFormat</tt> tags.\n    Consult the documentation on the\n    <tt>ExtraSamples</tt> tag and Associated Alpha for elaboration.  Note however\n    that if you use Associated Alpha, you are expected to save data that is\n    pre-multipled by Alpha.  If this means nothing to you, check out\n    Porter &amp; Duff's paper in the '84 SIGGRAPH proceedings: \"Compositing Digital\n    Images\".\n  </p>\n  <p>\n    The <tt>ImageDepth</tt>\n    tag is a non-standard, but registered tag that specifies\n    the Z-dimension of volumetric data.  The combination of <tt>ImageWidth</tt>,\n    <tt>ImageLength</tt>, and <tt>ImageDepth</tt>,\n    defines a 3D volume of pixels that are\n    further specified by <tt>BitsPerSample</tt> and\n    <tt>SamplesPerPixel</tt>.  The <tt>TileDepth</tt>\n    tag (also non-standard, but registered) can be used to specified a\n    subvolume \"tiling\" of a volume of data.\n  </p>\n  <p>\n    The Colorimetry, and CMYK tags are additions that appear in TIFF 6.0.\n    Consult the TIFF 6.0 specification included in the <b>doc</b> directory\n    and <a href=\"document.html\">online</a>.\n  </p>\n  <p>\n    The JPEG-related tag is specified in\n    <a href=\"TIFFTechNote2.html\">TIFF Technical Note #2</a> which defines\n    a revised JPEG-in-TIFF scheme (revised over that appendix that was\n    part of the TIFF 6.0 specification).\n  </p>\n  <hr>\n  <p>\n    Last updated: $Date: 2005/12/28 06:53:18 $\n  </p>\n</body>\n</html>\n\n"
  },
  {
    "path": "src/main/jni/tiff/html/tools.html",
    "content": "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n<html>\n<head>\n<meta name=\"generator\" content=\n\"HTML Tidy for Solaris (vers 12 April 2005), see www.w3.org\">\n<title>TIFF Tools Overview</title>\n</head>\n<body bgcolor=\"white\">\n<h1><font face=\"Arial, Helvetica, Sans\"><img src=\"images/quad.jpg\"\nwidth=\"144\" height=\"108\" align=\"left\" border=\"1\" hspace=\"6\"> TIFF\nTools Overview</font></h1>\n<p>This software distribution comes with a small collection of\nprograms for converting non-TIFF format images to TIFF and for\nmanipulating and interrogating the contents of TIFF images. Several\nof these tools are useful in their own right. Many of them however\nare more intended to serve as programming examples for using the\nTIFF library.</p>\n<h3>Device-dependent Programs</h3>\nThere are two device-dependent programs that serve as simple\nexamples for writing programs to display and save TIFF images.\n<table border cellpadding=\"3\">\n<tr>\n<td valign=\"top\" width=\"10%\">\n<tt><a href=\"man/tiffgt.1.html\">tiffgt</a>&nbsp;&nbsp;&nbsp;&nbsp;</tt></td>\n<td>Display the contents of one or more TIFF images using OpenGL.\nThe software makes extensive use of the <tt>TIFFRGBAImage</tt>\nfacilities described elsewhere.</td>\n</tr>\n<tr>\n<td valign=\"top\" width=\"10%\"><tt><a href=\"man/tiffsv.1.html\">tiffsv</a></tt></td>\n<td>A program to save all or part of a screen dump on a Silicon\nGraphics system. As for <tt>tiffgt</tt> this code, while written to\nuse the IRIS GL, can be easily tailored to other devices.</td>\n</tr>\n</table>\n<h3>Device-independent Programs</h3>\nThe remaining programs should be device-independent:\n<table border cellpadding=\"3\">\n<tr>\n<td valign=\"top\" width=\"10%\"><tt><a href=\"man/bmp2tiff.1.html\">bmp2tiff</a></tt></td>\n<td>Convert BMP images to TIFF</td>\n</tr>\n<tr>\n<td valign=\"top\" width=\"10%\"><tt><a href=\"man/fax2ps.1.html\">fax2ps</a></tt></td>\n<td>Convert a Group 3- or Group 4- compressed TIFF to PostScript\nthat is significantly more compressed than is generated by\n<tt>tiff2ps</tt> (unless <tt>tiff2ps</tt> writes PS Level II)</td>\n</tr>\n<tr>\n<td valign=\"top\" width=\"10%\"><tt><a href=\"man/fax2tiff.1.html\">fax2tiff</a></tt></td>\n<td>Convert raw Group 3 or Group 4 facsimile data to TIFF</td>\n</tr>\n<tr>\n<td valign=\"top\" width=\"10%\"><tt><a href=\"man/gif2tiff.1.html\">gif2tiff</a></tt></td>\n<td>A quick hack that converts GIF 87a (old) format images to TIFF</td>\n</tr>\n<tr>\n<td valign=\"top\" width=\"10%\"><tt><a href=\"man/pal2rgb.1.html\">pal2rgb</a></tt></td>\n<td>Convert a Palette-style image to a full color RGB image by\napplying the colormap</td>\n</tr>\n<tr>\n<td valign=\"top\" width=\"10%\"><tt><a href=\"man/ppm2tiff.1.html\">ppm2tiff</a></tt></td>\n<td>A quick hack that converts 8-bit PPM format images to TIFF</td>\n</tr>\n<tr>\n<td valign=\"top\" width=\"10%\"><tt><a href=\"man/ras2tiff.1.html\">ras2tiff</a></tt></td>\n<td>A quick hack that converts Sun rasterfile format images to TIFF\n-- it's less than complete</td>\n</tr>\n<tr>\n<td valign=\"top\" width=\"10%\"><tt><a href=\"man/raw2tiff.1.html\">raw2tiff</a></tt></td>\n<td>Create a TIFF file from raw data</td>\n</tr>\n<tr>\n<td valign=\"top\" width=\"10%\"><tt><a href=\"man/rgb2ycbcr.1.html\">rgb2ycbcr</a></tt></td>\n<td>Convert an RGB, grayscale, or bilevel TIFF image to a YCbCr\nTIFF image; it's mainly provided for testing</td>\n</tr>\n<tr>\n<td valign=\"top\" width=\"10%\"><tt><a href=\"man/sgi2tiff.1.html\">sgi2tiff</a></tt></td>\n<td>A program to convert SGI image files to TIFF. This program is\nonly useful on SGI machines as it uses <tt>-limage</tt>.</td>\n</tr>\n<tr>\n<td valign=\"top\" width=\"10%\"><tt><a href=\"man/thumbnail.1.html\">thumbnail</a></tt></tt></td>\n<td>Copy a bilevel TIFF to one that includes 8-bit greyscale\n\"thumbnail images\" for each page; it is provided as an example of\nhow one might use the <tt>SubIFD</tt> tag (and the library support\nfor it)</td>\n</tr>\n<tr>\n<td valign=\"top\" width=\"10%\"><tt><a href=\"man/tiff2bw.1.html\">tiff2bw</a></tt></td>\n<td>A simple program to convert a color image to grayscale</td>\n</tr>\n<tr>\n<td valign=\"top\" width=\"10%\"><tt><a href=\"man/tiff2pdf.1.html\">tiff2pdf</a></tt></td>\n<td>Convert TIFF images to PDF</td>\n</tr>\n<tr>\n<td valign=\"top\" width=\"10%\"><tt><a href=\"man/tiff2ps.1.html\">tiff2ps</a></tt></td>\n<td>Convert TIFF images to PostScript</td>\n</tr>\n<tr>\n<td valign=\"top\" width=\"10%\"><tt><a href=\"man/tiff2rgba.1.html\">tiff2rgba</a></tt></td>\n<td>Convert a TIFF image to RGBA color space</td>\n</tr>\n<tr>\n<td valign=\"top\" width=\"10%\"><tt><a href=\"man/tiffcmp.1.html\">tiffcmp</a></tt></td>\n<td>Compare the contents of two TIFF files (it does not check all\nthe directory information, but does check all the data)</td>\n</tr>\n<tr>\n<td valign=\"top\" width=\"10%\"><tt><a href=\"man/tiffcp.1.html\">tiffcp</a></tt></td>\n<td>Copy, concatenate, and convert TIFF images (e.g. switching from\nCompression=5 to Compression=1)</td>\n</tr>\n<tr>\n<td valign=\"top\" width=\"10%\"><tt><a href=\"man/tiffcrop.1.html\">tiffcrop</a></tt></td>\n<td>Provides selection of images from within one or more multi-image\nTIFF files, with orthogonal rotation, mirroring, cropping, and\nextraction of multiple sections and exporting to one or more files.\nIt extends the functionality of tiffcp to support additional bit\ndepths in strips and tiles and enhances the selection capabilities of\ntiffsplit. Bilevel images can be inverted and images may be split into\nsegments to fit on multiple /pages/ (standard paper sizes), plus other\nfunctions described in the tiffcrop man page</td>\n</tr>\n<tr>\n<td valign=\"top\" width=\"10%\"><tt><a href=\"man/tiffdither.1.html\">tiffdither</a></tt></td>\n<td>Dither a b&amp;w image into a bilevel image (suitable for use\nin creating fax files)</td>\n</tr>\n<tr>\n<td valign=\"top\" width=\"10%\"><tt><a href=\"man/tiffdump.1.html\">tiffdump</a></tt></td>\n<td>Display the verbatim contents of the TIFF directory in a file\n(it's very useful for debugging bogus files that you may get from\nsomeone that claims they support TIFF)</td>\n</tr>\n<tr>\n<td valign=\"top\" width=\"10%\"><tt><a href=\"man/tiffinfo.1.html\">tiffinfo</a></tt></td>\n<td>Display information about one or more TIFF files.</td>\n</tr>\n<tr>\n<td valign=\"top\" width=\"10%\"><tt><a href=\"man/tiffmedian.1.html\">tiffmedian</a></tt></td>\n<td>A version of Paul Heckbert's median cut program that reads an\nRGB TIFF image, and creates a TIFF palette file as a result</td>\n</tr>\n<tr>\n<td valign=\"top\" width=\"10%\"><tt><a href=\"man/tiffset.1.html\">tiffset</a></tt></td>\n<td>Set a field in a TIFF header</td>\n</tr>\n<tr>\n<td valign=\"top\" width=\"10%\"><tt><a href=\"man/tiffsplit.1.html\">tiffsplit</a></tt></td>\n<td>Create one or more single-image files from a (possibly)\nmulti-image file</td>\n</tr>\n</table>\n<p>Check out the manual pages for details about the above\nprograms.</p>\n<hr>\nLast updated: $Date: 2009-10-28 22:13:58 $\n</body>\n</html>\n"
  },
  {
    "path": "src/main/jni/tiff/html/v3.4beta007.html",
    "content": "<HTML>\n<HEAD>\n<TITLE>\nChanges in TIFF v3.4beta007\n</TITLE>\n</HEAD>\n\n<BODY>\n<FONT FACE=\"Arial, Helvetica, Sans\">\n\n<BASEFONT SIZE=4>\n<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>\n<BASEFONT SIZE=3>\n\n<UL>\n<HR SIZE=4 WIDTH=65% ALIGN=left>\n<B>Current Version</B>: v3.4beta007<BR>\n<B>Previous Version</B>: v3.4beta004<BR>\n<B>Master FTP Site</B>: <A HREF=\"ftp://ftp.sgi.com/graphics/tiff\">ftp.sgi.com (192.48.153.1), directory graphics/tiff</A><BR>\n<HR SIZE=4 WIDTH=65% ALIGN=left>\n</UL>\n\n<P>\nThis document describes the changes made to the software between the\n<I>previous</I> and <I>current</I> versions (see above).\nIf you don't find something listed here, then it was not done in this\ntimeframe, or it was not considered important enough to be mentioned.\nThe following information is located here:\n<UL>\n<LI><A HREF=\"#configure\">Changes in the software configuration</A>\n<LI><A HREF=\"#libtiff\">Changes in libtiff</A>\n<LI><A HREF=\"#port\">Changes in the portability support</A>\n<LI><A HREF=\"#tools\">Changes in the tools</A>\n</UL>\n\n<P><HR WIDTH=65% ALIGN=right>\n\n<A NAME=\"configure\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>\n\n<UL>\n<LI>bit order was corrected for Pentium systems\n<LI>a new define, <TT>HOST_BIGENDIAN</TT>, was added for code that\n   wants to statically use information about native cpu byte order\n</UL>\n\n<P><HR WIDTH=65% ALIGN=right>\n\n<A NAME=\"libtiff\"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>\n\n<UL>\n<LI>the G3/G4 decoder was replaced by a new one that is faster and\n   has smaller state tables\n<LI>Niles Ritter's client tag extension hooks were added\n<LI>a new routine <TT>TIFFCurrentDirOffset</TT> was added for\n   applications that want to find out the file offset of a TIFF directory\n<LI>the calculation of the number of strips in an image was corected\n   for images with certain esoteric configurations\n<LI>a potential memory leak (very unlikely) was plugged\n<LI>the <TT>TIFFReadRGBAImage</TT> support was completely rewritten\n   and new, more flexible support was added for reading images into\n   a fixed-format raster\n<LI>YCbCr to RGB conversion done in the <TT>TIFFReadRGBAImage</TT> support\n   was optimized\n<LI>a bug in JPEG support calculation of strip size was corrected\n<LI>the LZW decoder was changed to initialize the code table to zero\n   to lessen potential problems that arise when invalid data is decoded\n<LI><B>tiffcomp.h</B> is now aware of OS/2\n<LI>some function prototypes in <B>tiffio.h</B> and <B>tiffiop.h</B>\n   that contained parameter\n   names have been changed to avoid complaints from certain compilers\n</UL>\n\n<P><HR WIDTH=65% ALIGN=right>\n\n<A NAME=\"port\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE PORTABILITY SUPPORT:</B></A>\n\n<UL>\n<LI><B>Makefile.in</B> has been corrected to use the parameters\n   chosen by the configure script\n</UL>\n\n<P><HR WIDTH=65% ALIGN=right>\n\n<A NAME=\"tools\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE TOOLS:</B></A>\n\n<UL>\n<LI><TT>fax2ps</TT> has been rewritten and moved over from the user\n   contributed software\n<LI>an uninitialized variable in <TT>pal2rgb</TT> has been fixed\n<LI><TT>ras2tiff</TT> now converts 24-bit RGB raster data so that\n   samples are written in the proper order\n<LI><TT>tiff2ps</TT> has been updated to include fixes\n    and enhancements from Alberto Accomazzi\n<LI><TT>tiffcp</TT> now has a <TT>-o</TT> option to select a directory\n    by file offset\n<LI><TT>tiffinfo</TT> is now capable of displaying the raw undecoded\n    image data in a file\n<LI><TT>tiffgt</TT> has been rewritten to use the new <TT>TIFFRGBAImage</TT>\n   support and to handle multiple files\n</UL>\n\n<A HREF=\"index.html\"><IMG SRC=\"images/back.gif\"></A> TIFF home page.<BR>\n\n<HR>\n\n<ADDRESS>\n<A HREF=\"sam.html\">Sam Leffler</A> / <A HREF=\"mailto:sam@engr.sgi.com\">sam@engr.sgi.com</A>\nLast updated $Date: 1999/08/09 20:21:21 $.\n</ADDRESS>\n\n</BODY>\n</HTML>\n"
  },
  {
    "path": "src/main/jni/tiff/html/v3.4beta016.html",
    "content": "<HTML>\n<HEAD>\n<TITLE>\nChanges in TIFF v3.4beta016\n</TITLE>\n</HEAD>\n\n<BODY>\n<FONT FACE=\"Arial, Helvetica, Sans\">\n\n<BASEFONT SIZE=4>\n<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>\n<BASEFONT SIZE=3>\n\n<UL>\n<HR SIZE=4 WIDTH=65% ALIGN=left>\n<B>Current Version</B>: v3.4beta016<BR>\n<B>Previous Version</B>: <A HREF=v3.4beta007.html>v3.4beta007</A><BR>\n<B>Master FTP Site</B>: <A HREF=\"ftp://ftp.sgi.com/graphics/tiff\">ftp.sgi.com (192.48.153.1), directory graphics/tiff</A><BR>\n<HR SIZE=4 WIDTH=65% ALIGN=left>\n</UL>\n\n<P>\nThis document describes the changes made to the software between the\n<I>previous</I> and <I>current</I> versions (see above).\nIf you don't find something listed here, then it was not done in this\ntimeframe, or it was not considered important enough to be mentioned.\nThe following information is located here:\n<UL>\n<LI><A HREF=\"#configure\">Changes in the software configuration</A>\n<LI><A HREF=\"#libtiff\">Changes in libtiff</A>\n<LI><A HREF=\"#tools\">Changes in the tools</A>\n<LI><A HREF=\"#man\">Changes in the manual pages</A>\n<LI><A HREF=\"#html\">Changes in the documentation</A>\n<LI><A HREF=\"#contrib\">Changes in contributed software</A>\n</UL>\n\n<P><HR WIDTH=65% ALIGN=right>\n\n<A NAME=\"configure\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>\n\n<UL>\n<LI>support was added for configuring the Deflate codec\n<LI>support was added for the HTML documentation\n<LI>codecs that are not configured for inclusion in the library\n   are no longer compiled\n</UL>\n\n<P><HR WIDTH=65% ALIGN=right>\n\n<A NAME=\"libtiff\"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>\n\n<UL>\n<LI>support was added for registering new codecs external to the library\n   and for overriding the codecs that are builtin to the library\n<LI>emulation support for the old <TT>DataType</TT> tag was improved\n<LI>suppport was added for the <TT>SMinSampleValue</TT>\n    and <TT>SMaxSampleValue</TT> tags\n<LI>the library no longer ignores <TT>TileWidth</TT> and <TT>TileLength</TT>\n    tags whose values are not a multiple of 16 (per the spec); this\n    permits old, improperly written, images to be read\n<LI>the support for the <TT>Predictor</TT> tag was placed in a reusable\n    module so that it can be shared by multiple codecs\n<LI>experimental compression support was added for the Deflate algorithm\n   (using the freely available zlib package)\n<LI>a new routine, <TT>TIFFWriteBufferSetup</TT> was added a la the\n   routine <TT>TIFFReadBufferSetup</TT>\n<LI>the DSO version of the library is now statically linked with the\n   JPEG and Deflate libraries; this means applications that link against\n   the DSO do not also need to link against these ancillary libraries\n</UL>\n\n<P><HR WIDTH=65% ALIGN=right>\n\n<A NAME=\"tools\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE TOOLS:</B></A>\n\n<UL>\n<LI>all the tools now use common code to process compress-oriented arguments\n<LI><TT>tiffdump</TT> should now compile on a Macintosh with MPW\n</UL>\n\n<P><HR WIDTH=65% ALIGN=right>\n\n<A NAME=\"man\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE MANUAL PAGES:</B></A>\n\n<UL>\n<LI>everything was updated\n</UL>\n\n<P><HR WIDTH=65% ALIGN=right>\n\n<A NAME=\"html\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE DOCUMENTATION:</B></A>\n\n<UL>\n<LI>everything was updated\n</UL>\n\n<P><HR WIDTH=65% ALIGN=right>\n\n<A NAME=\"contrib\"><B><FONT SIZE=+3>C</FONT>HANGES IN CONTRIBUTED SOFTWARE:</B></A>\n\n<UL>\n<LI><B>contrib/dbs/xtiff</B> was made to compile\n<LI><B>contrib/mac-mpw</B> is new support for compiling the software on\n   a Macintosh under MPW; consult <A HREF=build.html#Mac>the documentation</A>\n   for details\n<LI><B>contrib/tags</B> is information on how to use the tag extenion\n   facilities; consult\n   <A HREF=../contrib/tags/README>contrib/tags/README</A> for details\n</UL>\n\n<A HREF=\"index.html\"><IMG SRC=\"images/back.gif\"></A> TIFF home page.<BR>\n\n<HR>\n\n<ADDRESS>\n<A HREF=\"sam.html\">Sam Leffler</A> / <A HREF=\"mailto:sam@engr.sgi.com\">sam@engr.sgi.com</A>\nLast updated $Date: 1999/08/09 20:21:21 $.\n</ADDRESS>\n\n</BODY>\n</HTML>\n"
  },
  {
    "path": "src/main/jni/tiff/html/v3.4beta018.html",
    "content": "<HTML>\n<HEAD>\n<TITLE>\nChanges in TIFF v3.4beta018\n</TITLE>\n</HEAD>\n\n<BODY>\n<FONT FACE=\"Arial, Helvetica, Sans\">\n\n<BASEFONT SIZE=4>\n<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>\n<BASEFONT SIZE=3>\n\n<UL>\n<HR SIZE=4 WIDTH=65% ALIGN=left>\n<B>Current Version</B>: v3.4beta018<BR>\n<B>Previous Version</B>: <A HREF=v3.4beta016.html>v3.4beta016</A><BR>\n<B>Master FTP Site</B>: <A HREF=\"ftp://ftp.sgi.com/graphics/tiff\">ftp.sgi.com (192.48.153.1), directory graphics/tiff</A><BR>\n<HR SIZE=4 WIDTH=65% ALIGN=left>\n</UL>\n\n<P>\nThis document describes the changes made to the software between the\n<I>previous</I> and <I>current</I> versions (see above).\nIf you don't find something listed here, then it was not done in this\ntimeframe, or it was not considered important enough to be mentioned.\nThe following information is located here:\n<UL>\n<LI><A HREF=\"#configure\">Changes in the software configuration</A>\n<LI><A HREF=\"#libtiff\">Changes in libtiff</A>\n<LI><A HREF=\"#tools\">Changes in the tools</A>\n</UL>\n\n<P><HR WIDTH=65% ALIGN=right>\n\n<A NAME=\"configure\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>\n\n<UL>\n<LI>configure now recognizes IRIX 6.x systems\n<LI>configure now uses <TT>ENVOPTS</TT> when searching for an ANSI\n   C compiler; this fixes a problem configuring the software under\n   HP/UX with the native C compiler\n<LI>configure now correctly recognizes memory-mapped files are supported\n   under AIX\n</UL>\n\n<P><HR WIDTH=65% ALIGN=right>\n\n<A NAME=\"libtiff\"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>\n\n<UL>\n<LI><TT>make install</TT> now properly installs the include files\n<LI>some portability fixes from Bjorn Brox\n<LI>the G3/G4 codec now warns about decoded rows that are longer than\n    the image/tile width\n<LI>changes from Frank Cringle to make the library work with the\n    gcc-specific bounds checking software\n<LI>miscellaneous fixes to <TT>TIFFPrintDirectory</TT>\n<LI>bug fix to correct a problem where <TT>TIFFWriteRawStrip</TT>\n    could not be used to automatically grow an image's length\n</UL>\n\n<P><HR WIDTH=65% ALIGN=right>\n\n<A NAME=\"tools\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE TOOLS:</B></A>\n\n<UL>\n<LI>fixes from Frank Cringle to update <TT>fax2tiff</TT>\n<LI>portability fixes to <TT>tiff2bw</TT> and <TT>tiffcmp</TT>\n<LI><TT>tiffdump</TT> now uses the byte swapping routines in the library\n</UL>\n\n<A HREF=\"index.html\"><IMG SRC=\"images/back.gif\"></A> TIFF home page.<BR>\n\n<HR>\n\n<ADDRESS>\n<A HREF=\"sam.html\">Sam Leffler</A> / <A HREF=\"mailto:sam@engr.sgi.com\">sam@engr.sgi.com</A>\nLast updated $Date: 1999/08/09 20:21:21 $.\n</ADDRESS>\n\n</BODY>\n</HTML>\n"
  },
  {
    "path": "src/main/jni/tiff/html/v3.4beta024.html",
    "content": "<HTML>\n<HEAD>\n<TITLE>\nChanges in TIFF v3.4beta024\n</TITLE>\n</HEAD>\n\n<BODY>\n<FONT FACE=\"Arial, Helvetica, Sans\">\n\n<BASEFONT SIZE=4>\n<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>\n<BASEFONT SIZE=3>\n\n<UL>\n<HR SIZE=4 WIDTH=65% ALIGN=left>\n<B>Current Version</B>: v3.4beta024<BR>\n<B>Previous Version</B>: <A HREF=v3.4beta018.html>v3.4beta018</A><BR>\n<B>Master FTP Site</B>: <A HREF=\"ftp://ftp.sgi.com/graphics/tiff\">ftp.sgi.com (192.48.153.1), directory graphics/tiff</A><BR>\n<HR SIZE=4 WIDTH=65% ALIGN=left>\n</UL>\n\n<P>\nThis document describes the changes made to the software between the\n<I>previous</I> and <I>current</I> versions (see above).\nIf you don't find something listed here, then it was not done in this\ntimeframe, or it was not considered important enough to be mentioned.\nThe following information is located here:\n<UL>\n<LI><A HREF=\"#configure\">Changes in the software configuration</A>\n<LI><A HREF=\"#libtiff\">Changes in libtiff</A>\n<LI><A HREF=\"#tools\">Changes in the tools</A>\n<LI><A HREF=\"#man\">Changes in the manual pages</A>\n<LI><A HREF=\"#contrib\">Changes in the contributed software</A>\n</UL>\n\n<P><HR WIDTH=65% ALIGN=right>\n\n<A NAME=\"configure\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>\n\n<UL>\n<LI>It is now possible to setup the software to build only the\n   library; configure reconizes this is the intent when the\n   <B>VERSION</B>, <B>tiff.alpha</B>, and <B>tif_version.c</B>\n   files are in the local directory (i.e. ``.'')\n<LI>configure no longer tries to setup HTML materials\n<LI>include file directories needed in building the library are now\n   specified with a <TT>DIRS_LIBINC</TT> config parameter\n<LI>configure no longer checks for alternate compilers if <TT>CC</TT>\n   is set; if the specified compiler is not found or is not appropriate\n   the configuration procedure aborts\n<LI>the <B>port.h</B> file generated by configure is now used only by\n   the library and as such as have been moved to the <B>libtiff</B>\n   directory\n<LI>there is beginning support for building DSO's on systems other than IRIX\n<LI>configure now verifies the JPEG and zlib directory pathnames by\n   checking for well-known include files in these directories\n<LI>configure no longer creates the <B>dist</B> directory needed only\n   on SGI machines (for building SGI binary distributions)\n<LI>a bug was fixed whereby configure would incorrectly set\n    <TT>ENVOPTS</TT> when building the software with gcc under AIX\n</UL>\n\n<P><HR WIDTH=65% ALIGN=right>\n\n<A NAME=\"libtiff\"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>\n\n<UL>\n<LI>two new typedefs were added to <B>tiff.h</TT>: <TT>int8</TT>\n    and <TT>uint8</TT> for signed and unsigned 8-bit quantities,\n    respectively; these are currently used only by\n    programs in the <B>tools</B> directory\n<LI>the <TT>BadFaxLines</TT>, <TT>CleanFaxData</TT>, and\n    <TT>ConsecutiveBadFaxLines</B> tags are now supported with\n    Group 4 compression\n<LI>byte order is now correctly identified on 64-bit machines\n<LI>a bug was fixed in the PackBits decoder where input data would\n    appear short when a no-op run was present\n<LI>a bug was fixed in calculations with very wide strips\n<LI><TT>TIFFWriteEncodedStrip</TT> and <TT>TIFFWriteRawStrip</TT>\n    were extended to support dynamically growing the number of\n    strips in an image (must set <TT>ImageLength</TT> prior to\n    making calls though)\n<LI><TT>TIFFDefaultTileSize</TT> now rounds tile width and height\n    up to a multiple of 16 pixels, as required by the TIFF 6.0 specification\n<LI>the file <B>version.h</B> is now built by a new <B>mkversion</B>\n    program; this was done for portability to non-UNIX systems\n<LI>support was added for the Acorn RISC OS (from Peter Greenham)\n<LI>the builtin codec table is now made <TT>const</TT> when compiling\n    under VMS so that <B>libtiff</B> can be built as a shared library\n<LI>support for the PowerPC Mac (from Ruedi Boesch)\n<LI>support for Window NT/Window 95 (from Scott Wagner)\n</UL>\n\n<P><HR WIDTH=65% ALIGN=right>\n\n<A NAME=\"tools\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE TOOLS:</B></A>\n\n<UL>\n<LI>the tools no longer include <B>port.h</B>\n<LI>various portability fixes; mostly to eliminate implicit assumptions\n    about how long <TT>int32</TT> data types are\n<LI>PostScript Level II additions to <TT>tiff2ps</TT> from Bjorn Brox\n<LI><TT>sgi2tiff</TT> now handles RGBA images\n</UL>\n\n<P><HR WIDTH=65% ALIGN=right>\n\n<A NAME=\"man\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE MANUAL PAGES:</B></A>\n\n<UL>\n<LI>the documentation has been updated to reflect the current state of\n    the software\n<LI>some routines have been moved to different manual pages\n    to group like-routines together\n</UL>\n\n<P><HR WIDTH=65% ALIGN=right>\n\n<A NAME=\"contrib\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE CONTRIBUTED SOFTWARE:</B></A>\n\n<UL>\n<LI>support was added for the Acorn RISC OS (from Peter Greenham)\n<LI>support for Windows NT/Windows 95 contributed for a previous\n    version of this software was sort of incorporated (it's broken\n    right now) (from Scott Wagner)\n</UL>\n\n<A HREF=\"index.html\"><IMG SRC=\"images/back.gif\"></A> TIFF home page.<BR>\n\n<HR>\n\n<ADDRESS>\n<A HREF=\"sam.html\">Sam Leffler</A> / <A HREF=\"mailto:sam@engr.sgi.com\">sam@engr.sgi.com</A>\nLast updated $Date: 1999/08/09 20:21:21 $.\n</ADDRESS>\n\n</BODY>\n</HTML>\n"
  },
  {
    "path": "src/main/jni/tiff/html/v3.4beta028.html",
    "content": "<HTML>\n<HEAD>\n<TITLE>\nChanges in TIFF v3.4beta028\n</TITLE>\n</HEAD>\n\n<BODY>\n<FONT FACE=\"Arial, Helvetica, Sans\">\n\n<BASEFONT SIZE=4>\n<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>\n<BASEFONT SIZE=3>\n\n<UL>\n<HR SIZE=4 WIDTH=65% ALIGN=left>\n<B>Current Version</B>: v3.4beta028<BR>\n<B>Previous Version</B>: <A HREF=v3.4beta024.html>v3.4beta024</A><BR>\n<B>Master FTP Site</B>: <A HREF=\"ftp://ftp.sgi.com/graphics/tiff\">ftp.sgi.com (192.48.153.1), directory graphics/tiff</A><BR>\n<HR SIZE=4 WIDTH=65% ALIGN=left>\n</UL>\n\n<P>\nThis document describes the changes made to the software between the\n<I>previous</I> and <I>current</I> versions (see above).\nIf you don't find something listed here, then it was not done in this\ntimeframe, or it was not considered important enough to be mentioned.\nThe following information is located here:\n<UL>\n<LI><A HREF=\"#configure\">Changes in the software configuration</A>\n<LI><A HREF=\"#libtiff\">Changes in libtiff</A>\n<LI><A HREF=\"#tools\">Changes in the tools</A>\n<LI><A HREF=\"#man\">Changes in the manual pages</A>\n<LI><A HREF=\"#contrib\">Changes in the contributed software</A>\n</UL>\n\n<P><HR WIDTH=65% ALIGN=right>\n\n<A NAME=\"configure\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>\n\n<UL>\n<LI>a <TT>-noninteractive</TT> flag was added to configure to\n   control whether or not it prints and prompts for configuration information\n<LI>various typos and fixes were made in configure for the the\n   library-only build support (this and other configure fixes from\n   Richard Mlynarik <A HREF=mailto:mly@adoc.xerox.com>&lt;mly@adoc.xerox.com&gt;</A>)\n<LI>bugs were fixed in the handling of pathnames supplied for external\n   packages; e.g. <TT>DIR_JPEG</TT>\n<LI>the handling of <TT>SETMAKE</TT> is now done properly\n<LI>the default prototype function declaration for <TT>pow</TT> was corrected\n<LI>a bug was fixed in <B>libtiff/Makefile.in</B> that caused installation\n   to fail on systems without DSO support\n</UL>\n\n<P><HR WIDTH=65% ALIGN=right>\n\n<A NAME=\"libtiff\"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>\n\n<UL>\n<LI>Acorn RISC O/S support that was accidentally left out of the\n   left out of the previous distribution is present (from Peter Greenham)\n<LI>complaints about unknown and/or unsupported codecs have been\n   delayed until they are invoked; this permits applications to open\n   images and look at tags even if the image data is compressed with\n   an unknown/unsupported compression scheme\n<LI>bugs in handling unknown tags have been corrected; applications\n   that use multiple codecs, each with codec-specific tags, no longer\n   generate confusing error messages\n<LI>a missing pseudo-tag definition in the CCITT G3 codec was fixed\n   (this problem caused core dumps in the <TT>tiffcp</TT> program)\n<LI>pseudo-tags are now treated specially; they are always considered\n   to be set (i.e. they do not use bits in the <TT>FIELD_*</TT> bit-vectors).\n<LI>the use of strip chopping can now be controlled on a per-file basis\n   through a mode parameter supplied when opening a file (``C'' to\n   enable strip chopping and ``c'' to disable)\n<LI>two bugs were fixed in the writing of opposite-endian byte-order\n   files\n<LI>support was added for three new fax-related tags registered to\n   SGI: FaxRecvParams, FaxRecvTime, and FaxSubAddress\n<LI>the bit order of image data read and written can now be controlled\n   on a per-file basis through a mode parameter supplied when opening\n   a file (``B'' to force MSB2LSB bit order, ``L'' for LSB2MSB bit\n   order, and ``H'' for the bit order of the native CPU)\n<LI>the byte order of image and tag data written to newly-created files\n   can now be controlled on a per-file basis through a mode parameter\n   supplied when openening a file (``b'' to force Big-Endian byte order\n   and ``l'' to force Little-Endian byte order)\n<LI>the use memory-mapped files for images opened read-only can now\n   be controlled on a per-file basis through a mode parameter supplied\n   when opening a file (``M'' to enable use of memory-mapped files\n   and ``m'' to disable use)\n<LI>the use of the <TT>WIN32</TT> define in <B>tiffiop.h</B> has\n   been replaced by <TT>__WIN32__</TT>\n</UL>\n\n<P><HR WIDTH=65% ALIGN=right>\n\n<A NAME=\"tools\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE TOOLS:</B></A>\n\n<UL>\n<LI><TT>fax2ps</TT> now does a <TT>save</TT> and <TT>restore</TT>\n    around each page of PostScript; this fixes a problem with VM\n    overflow when printing a many-page document on some printers\n<LI>a bug in the handling of 3-channel images by <TT>ras2tiff</TT> \n    was fixed\n<LI><TT>tiffcp</TT> has new options to control the byte order of\n    newly created files: <B>-B</B> for Big-Endian byte order, <B>-L</B>\n    for Little-Endian byte order; a <B>-M</B> option to disable the\n    use of memory-mapped files, and a <B>-C</B> option to disable the\n    use of strip chopping\n<LI>bugs were fixed in <TT>tiffcp</TT>'s handling of codec-specific tags\n</UL>\n\n<P><HR WIDTH=65% ALIGN=right>\n\n<A NAME=\"man\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE MANUAL PAGES:</B></A>\n\n<UL>\n<LI>the <TT>TIFFOpen</TT> page has been updated to reflect the new\n    optional open mode parameters\n</UL>\n\n<P><HR WIDTH=65% ALIGN=right>\n\n<A NAME=\"contrib\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE CONTRIBUTED SOFTWARE:</B></A>\n\n<UL>\n<LI><B>contrib/win95</B> contains information and code from Philippe Tenenhaus\n    <A HREF=mailto:100423.3705@compuserve.com>&lt;100423.3705@compuserve.com&gt;</A>\n    about using the software under Windows 95\n<LI><B>contrib/winnt</B> contains information and code from Dave Dyer\n    <A HREF=mailto:ddyer@triple-i.com>&lt;ddyer@triple-i.com&gt;</A>\n    about using the software under Windows NT\n</UL>\n\n<A HREF=\"index.html\"><IMG SRC=\"images/back.gif\"></A> TIFF home page.<BR>\n\n<HR>\n\n<ADDRESS>\n<A HREF=\"sam.html\">Sam Leffler</A> / <A HREF=\"mailto:sam@engr.sgi.com\">sam@engr.sgi.com</A>\nLast updated $Date: 1999/08/09 20:21:21 $.\n</ADDRESS>\n\n</BODY>\n</HTML>\n"
  },
  {
    "path": "src/main/jni/tiff/html/v3.4beta029.html",
    "content": "<HTML>\n<HEAD>\n<TITLE>\nChanges in TIFF v3.4beta029\n</TITLE>\n</HEAD>\n\n<BODY>\n<FONT FACE=\"Arial, Helvetica, Sans\">\n\n<BASEFONT SIZE=4>\n<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>\n<BASEFONT SIZE=3>\n\n<UL>\n<HR SIZE=4 WIDTH=65% ALIGN=left>\n<B>Current Version</B>: v3.4beta029<BR>\n<B>Previous Version</B>: <A HREF=v3.4beta028.html>v3.4beta028</A><BR>\n<B>Master FTP Site</B>: <A HREF=\"ftp://ftp.sgi.com/graphics/tiff\">ftp.sgi.com (192.48.153.1), directory graphics/tiff</A><BR>\n<HR SIZE=4 WIDTH=65% ALIGN=left>\n</UL>\n\n<P>\nThis document describes the changes made to the software between the\n<I>previous</I> and <I>current</I> versions (see above).\nIf you don't find something listed here, then it was not done in this\ntimeframe, or it was not considered important enough to be mentioned.\nThe following information is located here:\n<UL>\n<LI><A HREF=\"#configure\">Changes in the software configuration</A>\n<LI><A HREF=\"#libtiff\">Changes in libtiff</A>\n<LI><A HREF=\"#contrib\">Changes in the contributed software</A>\n</UL>\n\n<P><HR WIDTH=65% ALIGN=right>\n\n<A NAME=\"configure\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>\n\n<UL>\n<LI><B>configure</B> now relativizes pathname references given in\n   <TT>-L</TT> options (as frequently specified when configuring\n   ancillary packages)\n<LI>problems related to configuring the software on Ultrix 4.4 have\n   been corrected\n<LI>the shell to use in Makefiles and scripts can now be set with the\n   <TT>SCRIPT_SH</TT> configuration parameter\n<LI>comments in <B>config.site</B> now correctly indicate how to setup the\n   use of ancillary packages\n</UL>\n\n<P><HR WIDTH=65% ALIGN=right>\n\n<A NAME=\"libtiff\"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>\n\n<UL>\n<LI>mods for building the software on a Mac using the\n   MetroWerks CodeWarrior compilers\n<LI>a bug in the CCITT T.4/T.6 decoder was fixed where the last codeword in\n   a strip/tile might not be decoded; this was seen only when decoding\n   multi-strip images\n<LI>a bug in the CCITT RLE codecs was fixed whereby the pseudo tags were not\n   being properly registered\n</UL>\n\n<P><HR WIDTH=65% ALIGN=right>\n\n<A NAME=\"contrib\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE CONTRIBUTED SOFTWARE:</B></A>\n\n<UL>\n<LI><B>contrib/mac-cw</B> contains information and code from Niles Ritter\n    <A HREF=mailto:ndr@tazboy.jpl.nasa.gov>&lt;ndr@tazboy.jpl.nasa.gov&gt;</A>\n    about building the software with the MetroWerks CodeWarrior compilers\n    on Macintosh systems\n</UL>\n\n<A HREF=\"index.html\"><IMG SRC=\"images/back.gif\"></A> TIFF home page.<BR>\n\n<HR>\n\n<ADDRESS>\n<A HREF=\"sam.html\">Sam Leffler</A> / <A HREF=\"mailto:sam@engr.sgi.com\">sam@engr.sgi.com</A>\nLast updated $Date: 1999/08/09 20:21:21 $.\n</ADDRESS>\n\n</BODY>\n</HTML>\n"
  },
  {
    "path": "src/main/jni/tiff/html/v3.4beta031.html",
    "content": "<HTML>\n<HEAD>\n<TITLE>\nChanges in TIFF v3.4beta031\n</TITLE>\n</HEAD>\n\n<BODY>\n<FONT FACE=\"Arial, Helvetica, Sans\">\n\n<BASEFONT SIZE=4>\n<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>\n<BASEFONT SIZE=3>\n\n<UL>\n<HR SIZE=4 WIDTH=65% ALIGN=left>\n<B>Current Version</B>: v3.4beta031<BR>\n<B>Previous Version</B>: <A HREF=v3.4beta029.html>v3.4beta029</A><BR>\n<B>Master FTP Site</B>: <A HREF=\"ftp://ftp.sgi.com/graphics/tiff\">ftp.sgi.com (192.48.153.1), directory graphics/tiff</A><BR>\n<HR SIZE=4 WIDTH=65% ALIGN=left>\n</UL>\n\n<P>\nThis document describes the changes made to the software between the\n<I>previous</I> and <I>current</I> versions (see above).\nIf you don't find something listed here, then it was not done in this\ntimeframe, or it was not considered important enough to be mentioned.\nThe following information is located here:\n<UL>\n<LI><A HREF=\"#configure\">Changes in the software configuration</A>\n<LI><A HREF=\"#libtiff\">Changes in libtiff</A>\n<LI><A HREF=\"#man\">Changes in the manual pages</A>\n</UL>\n\n<P><HR WIDTH=65% ALIGN=right>\n\n<A NAME=\"configure\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>\n\n<UL>\n<LI><B>configure</B> now captures significantly more information\n   in the <B>config.log</B> file and provides more information when\n   it is unable to setup a configuration\n<LI>support was added for building shared libraries on more systems:\n   AIX, HPUX, Solaris, and Linux.\n<LI>a new configuration parameter <TT>LIBCOPTS</TT> was added for\n   passing arguments to the C compiler to use when building only\n   the library; this is part of the enhanced support for building\n   shared libraries\n<LI>include files for optional packages that reside in <B>/usr/include</B>\n   are now handled correctly\n<LI>build trees may now be configured using either relative or absolute\n   pathnames to the source distribution\n<LI>several new configuration parameters were added, mainly for building\n   shared libraries: <TT>DIST_MAJOR</TT>, <TT>DIST_MINOR</TT>, \n   <TT>DIST_ALPHA</TT>, and <TT>DSOSUF_VERSION</TT>\n</UL>\n\n<P><HR WIDTH=65% ALIGN=right>\n\n<A NAME=\"libtiff\"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>\n\n<UL>\n<LI>the Deflate support has been revised: it requires version 0.99 of\n   the zlib software distribution, <B>the output format has changed and\n   is incompatible with previous versions of this library</B> (each\n   strip now includes a header read and written by the zlib library)\n<LI>the codec name printed by the TIFFPrintDirectory routine is now\n   taken from the codec table instead of from a builtin table; this means\n   that application-defined codecs are handled correctly\n<LI>a new symbol was added that contains the library version number;\n   this can be used to do a compile-time compatibility check of the\n   library version\n</UL>\n\n<P><HR WIDTH=65% ALIGN=right>\n\n<A NAME=\"man\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE MANUAL PAGES:</B></A>\n\n<UL>\n<LI>the creation and installation of manual pages was redone; it now\n    implements the documented ``configuration scheme''\n</UL>\n\n<A HREF=\"index.html\"><IMG SRC=\"images/back.gif\"></A> TIFF home page.<BR>\n\n<HR>\n\n<ADDRESS>\n<A HREF=\"sam.html\">Sam Leffler</A> / <A HREF=\"mailto:sam@engr.sgi.com\">sam@engr.sgi.com</A>\nLast updated $Date: 1999/08/09 20:21:21 $.\n</ADDRESS>\n\n</BODY>\n</HTML>\n"
  },
  {
    "path": "src/main/jni/tiff/html/v3.4beta032.html",
    "content": "<HTML>\n<HEAD>\n<TITLE>\nChanges in TIFF v3.4beta032\n</TITLE>\n</HEAD>\n\n<BODY>\n<FONT FACE=\"Arial, Helvetica, Sans\">\n\n<BASEFONT SIZE=4>\n<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>\n<BASEFONT SIZE=3>\n\n<UL>\n<HR SIZE=4 WIDTH=65% ALIGN=left>\n<B>Current Version</B>: v3.4beta032<BR>\n<B>Previous Version</B>: <A HREF=v3.4beta031.html>v3.4beta031</A><BR>\n<B>Master FTP Site</B>: <A HREF=\"ftp://ftp.sgi.com/graphics/tiff\">ftp.sgi.com (192.48.153.1), directory graphics/tiff</A><BR>\n<HR SIZE=4 WIDTH=65% ALIGN=left>\n</UL>\n\n<P>\nThis document describes the changes made to the software between the\n<I>previous</I> and <I>current</I> versions (see above).\nIf you don't find something listed here, then it was not done in this\ntimeframe, or it was not considered important enough to be mentioned.\nThe following information is located here:\n<UL>\n<LI><A HREF=\"#configure\">Changes in the software configuration</A>\n<LI><A HREF=\"#libtiff\">Changes in libtiff</A>\n<LI><A HREF=\"#tools\">Changes in the tools</A>\n<LI><A HREF=\"#contrib\">Changes in the contributed software</A>\n</UL>\n\n<P><HR WIDTH=65% ALIGN=right>\n\n<A NAME=\"configure\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>\n\n<UL>\n<LI>various fixups and subtle improvements to <B>configure</B>\n    from Richard Mlynarik\n</UL>\n\n<P><HR WIDTH=65% ALIGN=right>\n\n<A NAME=\"libtiff\"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>\n\n<UL>\n<LI>a new codec from Pixar designed for high-resolution color images;\n    note that this codec is not configured by default\n<LI>a bug fix for reading tags with a single <TT>FLOAT</TT> value\n<LI>change to the <TT>TIFFGetField</TT> calling convention:\n    a tag that has a single value of\n    type <TT>DOUBLE</TT> is now retrieved by passing a\n    ``<TT>double*</TT>'' instead of a\n    ``<TT>double**</TT>'' (this change makes the handling of tags with\n    <TT>DOUBLE</TT> values identical to the handling of tags with\n    <TT>FLOAT</TT> values)\n<LI>fix to VMS support for the handling of floating point values\n</UL>\n\n<P><HR WIDTH=65% ALIGN=right>\n\n<A NAME=\"tools\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE TOOLS:</B></A>\n\n<UL>\n<LI><B>tiffdump</B> now handles tags with <TT>FLOAT</TT> and <TT>DOUBLE</TT>\n    values\n</UL>\n\n<P><HR WIDTH=65% ALIGN=right>\n\n<A NAME=\"contrib\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE CONTRIBUTED SOFTWARE:</B></A>\n\n<UL>\n<LI>updates to the Acorn OS support from Peter Greenham\n</UL>\n\n<A HREF=\"index.html\"><IMG SRC=\"images/back.gif\"></A> TIFF home page.<BR>\n\n<HR>\n\n<ADDRESS>\n<A HREF=\"sam.html\">Sam Leffler</A> / <A HREF=\"mailto:sam@engr.sgi.com\">sam@engr.sgi.com</A>\nLast updated $Date: 1999/08/09 20:21:21 $.\n</ADDRESS>\n\n</BODY>\n</HTML>\n"
  },
  {
    "path": "src/main/jni/tiff/html/v3.4beta033.html",
    "content": "<HTML>\n<HEAD>\n<TITLE>\nChanges in TIFF v3.4beta033\n</TITLE>\n</HEAD>\n\n<BODY>\n<FONT FACE=\"Arial, Helvetica, Sans\">\n\n<BASEFONT SIZE=4>\n<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>\n<BASEFONT SIZE=3>\n\n<UL>\n<HR SIZE=4 WIDTH=65% ALIGN=left>\n<B>Current Version</B>: v3.4beta033 (aka the v3.4 release)<BR>\n<B>Previous Version</B>: <A HREF=v3.4beta032.html>v3.4beta032</A><BR>\n<B>Master FTP Site</B>: <A HREF=\"ftp://ftp.sgi.com/graphics/tiff\">ftp.sgi.com (192.48.153.1), directory graphics/tiff</A><BR>\n<HR SIZE=4 WIDTH=65% ALIGN=left>\n</UL>\n\n<P>\nThis document describes the changes made to the software between the\n<I>previous</I> and <I>current</I> versions (see above).\nIf you don't find something listed here, then it was not done in this\ntimeframe, or it was not considered important enough to be mentioned.\nThe following information is located here:\n<UL>\n<LI><A HREF=\"#configure\">Changes in the software configuration</A>\n<LI><A HREF=\"#libtiff\">Changes in libtiff</A>\n<LI><A HREF=\"#tools\">Changes in the tools</A>\n<LI><A HREF=\"#contrib\">Changes in the contributed software</A>\n</UL>\n\n<P><HR WIDTH=65% ALIGN=right>\n\n<A NAME=\"configure\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>\n\n<UL>\n<LI>support was added for building the library as a DSO under OSF/1\n</UL>\n\n<P><HR WIDTH=65% ALIGN=right>\n\n<A NAME=\"libtiff\"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>\n\n<UL>\n<LI>fixes to the Pixar codec\n<LI>portability mods for VMS\n</UL>\n\n<P><HR WIDTH=65% ALIGN=right>\n\n<A NAME=\"tools\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE TOOLS:</B></A>\n\n<UL>\n<LI>fixes to <B>gif2tiff</B> and <B>ppm2tiff</B> for building under MS/DOS\n<LI>portability mods to <B>fax2ps</B> and <B>ycbcr</B> for VMS\n</UL>\n\n<P><HR WIDTH=65% ALIGN=right>\n\n<A NAME=\"contrib\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE CONTRIBUTED SOFTWARE:</B></A>\n\n<UL>\n<LI>a new package from Alexander Lehmann\n   for building the library and tools under MS/DOS with DJGPP v2\n<LI>updated VMS support from Karsten Spang\n</UL>\n\n<A HREF=\"index.html\"><IMG SRC=\"images/back.gif\"></A> TIFF home page.<BR>\n\n<HR>\n\n<ADDRESS>\n<A HREF=\"sam.html\">Sam Leffler</A> / <A HREF=\"mailto:sam@engr.sgi.com\">sam@engr.sgi.com</A>\nLast updated $Date: 1999/08/09 20:21:21 $.\n</ADDRESS>\n\n</BODY>\n</HTML>\n"
  },
  {
    "path": "src/main/jni/tiff/html/v3.4beta034.html",
    "content": "<HTML>\n<HEAD>\n<TITLE>\nChanges in TIFF v3.4beta034\n</TITLE>\n</HEAD>\n\n<BODY>\n<FONT FACE=\"Arial, Helvetica, Sans\">\n\n<BASEFONT SIZE=4>\n<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>\n<BASEFONT SIZE=3>\n\n<UL>\n<HR SIZE=4 WIDTH=65% ALIGN=left>\n<B>Current Version</B>: v3.4beta034<BR>\n<B>Previous Version</B>: <A HREF=v3.4beta033.html>v3.4beta033</A><BR>\n<B>Master FTP Site</B>: <A HREF=\"ftp://ftp.sgi.com/graphics/tiff\">ftp.sgi.com (192.48.153.1), directory graphics/tiff</A><BR>\n<HR SIZE=4 WIDTH=65% ALIGN=left>\n</UL>\n\n<P>\nThis document describes the changes made to the software between the\n<I>previous</I> and <I>current</I> versions (see above).\nIf you don't find something listed here, then it was not done in this\ntimeframe, or it was not considered important enough to be mentioned.\nThe following information is located here:\n<UL>\n<LI><A HREF=\"#configure\">Changes in the software configuration</A>\n<LI><A HREF=\"#libtiff\">Changes in libtiff</A>\n</UL>\n\n<P><HR WIDTH=65% ALIGN=right>\n\n<A NAME=\"configure\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>\n\n<UL>\n<LI>support was added for building the library as a DSO under NetBSD\n<LI>a bug was fixed in the DSO support for Linux\n<LI>the handling of version strings has changed slightly to simplify parsing\n<LI>a new parameter, <TT>TIFFLIBREF</TT>, was added to control how the\n    library is referenced when linking programs in the <B>tools</B> directory\n</UL>\n\n<P><HR WIDTH=65% ALIGN=right>\n\n<A NAME=\"libtiff\"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>\n\n<UL>\n<LI>DSO creation under Solaris now forces the DSO name with a <TT>-h</TT> option\n<LI>the interface to the <B>mkversion</B> program was changed\n    to eliminate the need to parse files\n<LI>a bug was fixed in the EOL-detection logic of the T.4/T.6 decoder\n<LI>ANSI IT8 TIFF/IT tag definitions were added to <B>tiff.h</B>\n</UL>\n\n<A HREF=\"index.html\"><IMG SRC=\"images/back.gif\"></A> TIFF home page.<BR>\n\n<HR>\n\n<ADDRESS>\n<A HREF=\"sam.html\">Sam Leffler</A> / <A HREF=\"mailto:sam@engr.sgi.com\">sam@engr.sgi.com</A>\nLast updated $Date: 1999/08/09 20:21:21 $.\n</ADDRESS>\n\n</BODY>\n</HTML>\n"
  },
  {
    "path": "src/main/jni/tiff/html/v3.4beta035.html",
    "content": "<HTML>\n<HEAD>\n<TITLE>\nChanges in TIFF v3.4beta035\n</TITLE>\n</HEAD>\n\n<BODY>\n<FONT FACE=\"Arial, Helvetica, Sans\">\n\n<BASEFONT SIZE=4>\n<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>\n<BASEFONT SIZE=3>\n\n<UL>\n<HR SIZE=4 WIDTH=65% ALIGN=left>\n<B>Current Version</B>: v3.4beta035<BR>\n<B>Previous Version</B>: <A HREF=v3.4beta034.html>v3.4beta034</A><BR>\n<B>Master FTP Site</B>: <A HREF=\"ftp://ftp.sgi.com/graphics/tiff\">ftp.sgi.com (192.48.153.1), directory graphics/tiff</A><BR>\n<HR SIZE=4 WIDTH=65% ALIGN=left>\n</UL>\n\n<P>\nThis document describes the changes made to the software between the\n<I>previous</I> and <I>current</I> versions (see above).\nIf you don't find something listed here, then it was not done in this\ntimeframe, or it was not considered important enough to be mentioned.\nThe following information is located here:\n<UL>\n<LI><A HREF=\"#configure\">Changes in the software configuration</A>\n<LI><A HREF=\"#libtiff\">Changes in libtiff</A>\n</UL>\n\n<P><HR WIDTH=65% ALIGN=right>\n\n<A NAME=\"configure\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>\n\n<UL>\n<LI>support was added installing the HTML documentation\n<LI>support was added for building the library as a DSO under FreeBSD\n</UL>\n\n<P><HR WIDTH=65% ALIGN=right>\n\n<A NAME=\"libtiff\"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>\n\n<UL>\n<LI>the interface to the <B>mkversion</B> program was restored to\n    the form used prior to v3.4beta034\n<LI>several portability problems for 16-bit systems were fixed\n</UL>\n\n<A HREF=\"index.html\"><IMG SRC=\"images/back.gif\"></A> TIFF home page.<BR>\n\n<HR>\n\n<ADDRESS>\n<A HREF=\"sam.html\">Sam Leffler</A> / <A HREF=\"mailto:sam@engr.sgi.com\">sam@engr.sgi.com</A>\nLast updated $Date: 1999/08/09 20:21:21 $.\n</ADDRESS>\n\n</BODY>\n</HTML>\n"
  },
  {
    "path": "src/main/jni/tiff/html/v3.4beta036.html",
    "content": "<HTML>\n<HEAD>\n<TITLE>\nChanges in TIFF v3.4beta036\n</TITLE>\n</HEAD>\n\n<BODY>\n<FONT FACE=\"Arial, Helvetica, Sans\">\n\n<BASEFONT SIZE=4>\n<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>\n<BASEFONT SIZE=3>\n\n<UL>\n<HR SIZE=4 WIDTH=65% ALIGN=left>\n<B>Current Version</B>: v3.4beta036<BR>\n<B>Previous Version</B>: <A HREF=v3.4beta035.html>v3.4beta035</A><BR>\n<B>Master FTP Site</B>: <A HREF=\"ftp://ftp.sgi.com/graphics/tiff\">ftp.sgi.com (192.48.153.1), directory graphics/tiff</A><BR>\n<HR SIZE=4 WIDTH=65% ALIGN=left>\n</UL>\n\n<P>\nThis document describes the changes made to the software between the\n<I>previous</I> and <I>current</I> versions (see above).\nIf you don't find something listed here, then it was not done in this\ntimeframe, or it was not considered important enough to be mentioned.\nThe following information is located here:\n<UL>\n<LI><A HREF=\"#configure\">Changes in the software configuration</A>\n<LI><A HREF=\"#libtiff\">Changes in libtiff</A>\n<LI><A HREF=\"#tools\">Changes in the tools</A>\n</UL>\n\n<P><HR WIDTH=65% ALIGN=right>\n\n<A NAME=\"configure\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>\n\n<UL>\n<LI>support was added for building the library as a DSO under HP-UX with \n    the native C compiler\n<LI>tools are now built with explicit pathnames for the DSO under IRIX,\n    Solaris, and Linux\n<LI>DSO configuration support for Linux was changed to require that\n    <B>libc.so</B> only be readable (not executable)\n</UL>\n\n<P><HR WIDTH=65% ALIGN=right>\n\n<A NAME=\"libtiff\"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>\n\n<UL>\n<LI>support was add for ICC: <TT>NumberOfInks</TT>, and <TT>ICCProfile</TT>\n<LI>a memory leak caused by doing <TT>TIFFSetDirectory(0)</TT> was fixed\n<LI>a bug was fixed whereby certain multi-directory files were not\n    properly handled when accessed by mapping the data into memory \n<LI>the strip chopping support is now always compiled\n    into the library with the default usage controlled by a\n    <TT>STRIPCHOP_DEFAULT</TT> configuration parameter\n<LI>the strip chopping support no longer chops tiled images\n<LI>all static strings are now const--for shared libraries\n<LI>the logic for estimating the strip size of images without\n    a <TT>StripByteCounts</TT> tag was improved by handling\n    <TT>PlanarContig</TT> images differently from <TT>PlanarSeparate</TT>\n<LI>a bug was fixed in the G3 codec when converting the Y resolution\n    of data specified in metric units\n<LI>a bug was fixed in the G3/G4 decoder for data where lines terminate\n    with a v0 code\n<LI>the <TT>TIFFRGBAImage</TT> support was changed to scale 16-bit colormap\n    entries more conservatively to avoid problems with applications\n    that do not generate fully saturated pixel values\n<LI>the LZW decoder was changed to use a more conservative scheme when\n    bounds checking the hash table array; this avoids pitfalls with\n    systems that load objects into memory in unusual locations\n<LI>a bug was fixed in <TT>TIFFPrintDirectory</TT>'s handling of the\n    <TT>InkNames</TT> tag\n<LI><TT>TIFFPrintDirectory</TT> now understands <TT>NumberOfInks</TT>\n    and ICC-related tags\n<LI>the routines for reading image data now provide more useful information\n    when a read error is encountered\n<LI>support was added for compiling with Microsoft Visual C++ 4.0\n</UL>\n\n<P><HR WIDTH=65% ALIGN=right>\n\n<A NAME=\"tools\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE TOOLS:</B></A>\n\n<UL>\n<LI>a bug was fixed in <B>pal2rgb</B>'s colormap handling\n<LI><B>tiff2ps</B> now includes John Wehle's changes for maintaining \n    the aspect ratio\n    of images when scaling and for honoring the deadzone on a page when\n    generating PostScript Level II\n<LI><B>tiff2ps</B> does a better job guarding against the mishandling\n    of greyscale images\n<LI><B>tiff2ps</B> now correctly converts X- and Y-resolution values\n    specified in metric units\n<LI><B>tiffdump</B> has a new <TT>-m</TT> option to control the maximum\n    number of indirect\n    data values printed for a tag (by default 24)\n<LI><B>tiffdump</B> understands several new tags\n<LI><B>tiffdump</B> now shows any terminating null in ASCII strings\n<LI><B>tiffinfo</B> now suppresses strip chopping when interpreting an image;\n    a new <TT>-z</TT> option has been added to enable strip chopping\n</UL>\n\n<A HREF=\"index.html\"><IMG SRC=\"images/back.gif\"></A> TIFF home page.<BR>\n\n<HR>\n\n<ADDRESS>\n<A HREF=\"sam.html\">Sam Leffler</A> / <A HREF=\"mailto:sam@engr.sgi.com\">sam@engr.sgi.com</A>\nLast updated $Date: 1999/08/09 20:21:21 $.\n</ADDRESS>\n\n</BODY>\n</HTML>\n"
  },
  {
    "path": "src/main/jni/tiff/html/v3.5.1.html",
    "content": "<HTML>\n<HEAD>\n<TITLE>\nChanges in TIFF v3.5.1\n</TITLE>\n</HEAD>\n\n<BODY BGCOLOR=white>\n<FONT FACE=\"Arial, Helvetica, Sans\">\n<FONT FACE=\"Arial, Helvetica, Sans\"> \n\n<BASEFONT SIZE=4>\n<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>\n<BASEFONT SIZE=3>\n\n<UL>\n<HR SIZE=4 WIDTH=65% ALIGN=left>\n<B>Current Version</B>: v3.5.1<BR>\n<B>Previous Version</B>: v3.4beta037<BR>\n<B>Master FTP Site</B>: <A HREF=\"ftp://ftp.onshore.com/pub/libtiff\">ftp.onshore.com, directory graphics/tiff</A><BR>\n<B>Master HTTP Site</B>: <A HREF=\"http://www.remotesensing.org/libtiff/>http://www.remotesensing.org/libtiff</a> \n<HR SIZE=4 WIDTH=65% ALIGN=left>\n</UL>\n\n<P>\nThis document describes the changes made to the software between the\n<I>previous</I> and <I>current</I> versions (see above).\nIf you don't find something listed here, then it was not done in this\ntimeframe, or it was not considered important enough to be mentioned.\nThe following information is located here:\n<UL>\n<LI><A HREF=\"#configure\">Changes in the software configuration</A>\n<LI><A HREF=\"#libtiff\">Changes in libtiff</A>\n<LI><A HREF=\"#tools\">Changes in the tools</A>\n</UL>\n\n<P><HR WIDTH=65% ALIGN=right>\n\n<A NAME=\"configure\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>\n\n<UL>\n\t\t  <LI> <em> None of consequence </em> \n</UL>\n\n<P><HR WIDTH=65% ALIGN=right>\n\n<A NAME=\"libtiff\"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>\n\n\n<UL>\n<LI> Support was added for IPTC Newsphoto metadata (TIFFTAGE_IPTCNEWSPHOTO)\n<LI> Support was added for photoshop caption handling (TIFFTAG_PHOTOSHOP)\n</UL>\n\n<P><HR WIDTH=65% ALIGN=right>\n\n<A NAME=\"tools\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE TOOLS:</B></A>\n\n<UL>\n<LI> <A HREF=mailto:billr@corbis.com>Bill Radcliffe's</a> iptcutil was\nadded to the \"contrib\" subdirectory .  It can convert an IPTC binary\nblob to ASCII text and vice-versa.  The blob itself can be extracted\nfrom or added to an image with the <A\nhref=http://www.ImageMagick.org/>ImageMagick</a> convert(1)\nutility.\n</UL>\n\n<A HREF=\"index.html\"><IMG SRC=\"images/back.gif\"></A> TIFF home page.<BR>\n\n<HR>\n\nLast updated $Date: 2006/01/03 01:42:30 $.\n\n</BODY>\n</HTML>\n"
  },
  {
    "path": "src/main/jni/tiff/html/v3.5.2.html",
    "content": "<HTML>\n<HEAD>\n<TITLE>\nChanges in TIFF v3.5.2\n</TITLE>\n</HEAD>\n\n<BODY BGCOLOR=white>\n<FONT FACE=\"Arial, Helvetica, Sans\">\n<FONT FACE=\"Arial, Helvetica, Sans\"> \n\n<BASEFONT SIZE=4>\n<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>\n<BASEFONT SIZE=3>\n\n<UL>\n<HR SIZE=4 WIDTH=65% ALIGN=left>\n<B>Current Version</B>: v3.5.2<BR>\n<B>Previous Version</B>: <A HREF=v3.5.1.html>v3.5.1</a><BR>\n<B>Master FTP Site</B>: <A HREF=\"ftp://ftp.onshore.com/pub/libtiff\">ftp.onshore.com, directory graphics/tiff</A><BR>\n<B>Master HTTP Site</B>: <A HREF=\"http://www.remotesensing.org/libtiff/\">http://www.remotesensing.org/libtiff</a> \n<HR SIZE=4 WIDTH=65% ALIGN=left>\n</UL>\n\n<P>\nThis document describes the changes made to the software between the\n<I>previous</I> and <I>current</I> versions (see above).\nIf you don't find something listed here, then it was not done in this\ntimeframe, or it was not considered important enough to be mentioned.\nThe following information is located here:\n<UL>\n<LI><A HREF=\"#configure\">Changes in the software configuration</A>\n<LI><A HREF=\"#libtiff\">Changes in libtiff</A>\n<LI><A HREF=\"#tools\">Changes in the tools</A>\n</UL>\n\n<P><HR WIDTH=65% ALIGN=right>\n\n<A NAME=\"configure\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>\n\n<UL>\n\t<LI> Corrected alpha versioning.  \n\n\t<LI> Removed distinction between  alpha and release targets in Makefile.in. \n\n\t<LI> Added release.stamp target, which tags cvs tree, and updates \n\t  \"RELEASE-DATE\"\n\n\t<LI> Added releasediff target, which diffs tree with source as of \n\t  date in \"RELEASE-DATE\"\n\t  \n\t<LI>Ticked up version to 3.5.2 (alpha 01 -- but I think we'll moving \n\t  away from alpha/non-alpha distinctions). \n\n</UL>\n\n<P><HR WIDTH=65% ALIGN=right>\n\n<A NAME=\"libtiff\"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>\n\n\n<UL> \n        <LI> Added IRIX/gcc, and OSF/1 4.x support on behalf of \n\tAlbert Chin-A-Young <china@thewrittenword.com>\n\n        <LI> Added TIFFReassignTagToIgnore() API on behalf of \n        Bruce Cameron <cameron@petris.com>.  Man page still pending.\n\n        <LI> pre-remove so link before softlink in LINUXdso action in \n\tlibtiff/Makefile.in to avoid failure on LINUXdso builds other than\n\tthe first.\n\n        <LI> Fixed problem with cvtcmap() in tif_getimage.c modifying the\n\tcolormaps owned by the TIFF handle itself when trying to fixup wrong\n\t(eight bit) colormaps.  Corrected by maintaining a private copy of\n\tthe colormap. \n\n\t<LI> Added TIFFReadRGBATile()/TIFFReadRGBAStrip() support in \n\ttif_getimage.c.\n\n\t<LI> Applied \"a\" mode fix to tif_win32.c/TIFFOpen() as suggested \n\tby Christopher Lawton <clawton@mathworks.com>\n\n\t<LI> Set O_BINARY for tif_unix.c open() ... used on cygwin for instance.\n\n\t<LI> Added CYGWIN case in configure.\n\n\t<LI> Applied Francois Dagand's patch to handle fax decompression bug. \n\t(sizes >= 65536 were failing) \n</UL>\n\n<P><HR WIDTH=65% ALIGN=right>\n\n<A NAME=\"tools\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE TOOLS:</B></A>\n\n<UL>\n        <LI> Added addtiffo (add overviews to a TIFF file) in contrib.  Didn't\n\t    put it in tools since part of it is in C++.\n</UL>\n\n<A HREF=\"index.html\"><IMG SRC=\"images/back.gif\"></A> TIFF home page.<BR>\n\n<HR>\n\nLast updated $Date: 2004/11/26 14:37:20 $.\n\n</BODY>\n</HTML>\n"
  },
  {
    "path": "src/main/jni/tiff/html/v3.5.3.html",
    "content": "<HTML>\n<HEAD>\n<TITLE>\nChanges in TIFF v3.5.3\n</TITLE>\n</HEAD>\n\n<BODY BGCOLOR=white>\n<FONT FACE=\"Arial, Helvetica, Sans\">\n<FONT FACE=\"Arial, Helvetica, Sans\"> \n\n<BASEFONT SIZE=4>\n<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>\n<BASEFONT SIZE=3>\n\n<UL>\n<HR SIZE=4 WIDTH=65% ALIGN=left>\n<B>Current Version</B>: v3.5.3<BR>\n<B>Previous Version</B>: <A HREF=v3.5.2.html>v3.5.2</a><BR>\n<B>Master FTP Site</B>: <A HREF=\"ftp://ftp.onshore.com/pub/libtiff\">ftp.onshore.com</a>, directory pub/libtiff</A><BR>\n<B>Master HTTP Site</B>: <A HREF=\"http://www.remotesensing.org/libtiff/\">http://www.remotesensing.org/libtiff</a> \n<HR SIZE=4 WIDTH=65% ALIGN=left>\n</UL>\n\n<P>\nThis document describes the changes made to the software between the\n<I>previous</I> and <I>current</I> versions (see above).\nIf you don't find something listed here, then it was not done in this\ntimeframe, or it was not considered important enough to be mentioned.\nThe following information is located here:\n<UL>\n<LI><A HREF=\"#configure\">Changes in the software configuration</A>\n<LI><A HREF=\"#libtiff\">Changes in libtiff</A>\n<LI><A HREF=\"#tools\">Changes in the tools</A>\n</UL>\n<p> \nThe ChangeLog will follow, but please note the most important change: \nLZW compression has been removed. \n<p>\nUnisys has the patent on LZW compression and have been very active in\ntheir enforcement of late, demanding payments of $5000 or more from\nwebsites using unlicensed software to create GIF's.  They could well\ndo the same do persons using libtiff to create LZW compressed TIFF\nimages.\n<p> \nFrom <A HREF=http://burnallgifs.org>Burn All GIF's Day</a>:\n<br> \n<em>The catch is that it appears to be difficult or impossible to get a\nUnisys license to use LZW in free software that complies with the Open\nSource Definition</em>\n<P>\nUnfortunatly, the removal of LZW compression means that saved image size has\ngrown dramatically.  Without a change in the TIFF spec to support\nanother lossless compression format, this is unavoidable.\n<P>\nThe library can use zip for lossless compression, but as this is not\npart of the spec, TIFFs using zip compression may not work with other\nsoftware\n<P> \nWe will be making a patch available that will contain the LZW\ncompression code for users who have either obtained a license from\nUnisys or are willing to risk it. \n<p> \nLZW decompression is unchanged. \n<p> \n<P><HR WIDTH=65% ALIGN=left>\n\n<A NAME=\"configure\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>\n\n<UL>\n\t<LI> Added zip creation to release makefile target \n\n\n</UL>\n\n<P><HR WIDTH=65% ALIGN=left>\n\n<A NAME=\"libtiff\"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>\n\n\n<UL> \n\n\t<LI> Added html for TIFFWriteTile.3t man page. \n\t\n\t<LI> Added some changes to tif_write.c to support rewriting existing\n\tfixed sized tiles and strips.  Code mods disabled by default, only\n\tenabled if REWRITE_HACK is defined for now.\n\n\t<LI> Added TIFFWriteTile.3t man page.\n\n\t<LI> Added notes on use of makefile.vc in build.html, and fixed \n\temail subscription address.\n\n\t<LI>  Fixed apocalypse-inducing y2k bug in contrib/ras/ras2tiff.c \n\n\t<LI>  Did some casts cleaning up to reduce compiler warnings in tif_fax3.c,\n\t   from Bruce Carmeron <cameron@petris.com> -- modifications of \n\t   changes made by Frank (sun cc still complained on cast). \n\n\t<LI> fixed various VC++ warnings as suggested by Gilles Vollant\n\t<info@winimage.com>.  \n\n\t<LI> Modified TIFFquery.3t man pages info on TIFFIsByteSwapped() to\n\tnot imply applications are responsible for image data swapping.\n\n\t<LI>  HTML-ized the man pages, added to html/man\n\t\n\t<LI>  Removed LZW Compression to comply with Unisys patent extortion. \n\n\t<LI>  Corrected one remaining 16 -> 32 bit value in tif_fax3.c, \n\t   From Ivo Penzar <ivo.penzar@infolink-software.com. \n\n\t<LI>  Added patch from Ivo Penzar to have TiffAdvanceDirectory handle\n\t   memory mapped files. <ivo.penzar@infolink-software.com>\n</UL>\n\n<P><HR WIDTH=65% ALIGN=left>\n\n<A NAME=\"tools\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE TOOLS:</B></A>\n\n<UL>\n\t<LI> Fixed apocalypse-inducing y2k bug in contrib/ras/ras2tiff.c \n</UL>\n\n<A HREF=\"index.html\"><IMG SRC=\"images/back.gif\"></A> TIFF home page.<BR>\n\n<HR>\n\nLast updated $Date: 2004/11/26 14:37:20 $.\n\n</BODY>\n</HTML>\n"
  },
  {
    "path": "src/main/jni/tiff/html/v3.5.4.html",
    "content": "<HTML>\n<HEAD>\n<TITLE>\nChanges in TIFF v3.5.4\n</TITLE>\n</HEAD>\n\n<BODY BGCOLOR=white>\n<FONT FACE=\"Helvetica, Arial, Sans\">\n<FONT FACE=\"Helvetica, Arial, Sans\"> \n\n<BASEFONT SIZE=4>\n<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>\n<BASEFONT SIZE=3>\n\n<UL>\n<HR SIZE=4 WIDTH=65% ALIGN=left>\n<B>Current Version</B>: v3.5.4<BR>\n<B>Previous Version</B>: <A HREF=v3.5.3.html>v3.5.3</a><BR>\n<B>Master FTP Site</B>: <A HREF=\"ftp://ftp.onshore.com/pub/libtiff\">ftp.onshore.com</a>, directory pub/libtiff</A><BR>\n<B>Master HTTP Site</B>: <A HREF=\"http://www.remotesensing.org/libtiff/\">http://www.remotesensing.org/libtiff</a> \n<HR SIZE=4 WIDTH=65% ALIGN=left>\n</UL>\n\n<P>\nThis document describes the changes made to the software between the\n<I>previous</I> and <I>current</I> versions (see above).\nIf you don't find something listed here, then it was not done in this\ntimeframe, or it was not considered important enough to be mentioned.\nThe following information is located here:\n<UL>\n<LI><A HREF=\"#configure\">Changes in the software configuration</A>\n<LI><A HREF=\"#libtiff\">Changes in libtiff</A>\n<LI><A HREF=\"#tools\">Changes in the tools</A>\n</UL>\n<p> \n<P><HR WIDTH=65% ALIGN=left>\n\n<A NAME=\"configure\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>\n\n<UL>\n\t<LI> None\n\n\n</UL>\n\n<P><HR WIDTH=65% ALIGN=left>\n\n<A NAME=\"libtiff\"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>\n\n\n<UL> \n\n\t<li> Added Pixar tag support.  Contributed by Phil Beffery <phil@pixar.com> \n\n\t<li>  Made one more change to tif_dir.c for removal of LZW compression. Also added notice \n\t  when LZW compression invoked. \n\n        <li> Fixed bug that caused LZW (non) compression to segfault. Added \n\t  warning about LZW compression removed being removed, and why. \n\n</UL>\n\n<P><HR WIDTH=65% ALIGN=left>\n\n<A NAME=\"tools\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE TOOLS:</B></A>\n\n<UL>\n\t<li> Changed default compression in tools to TIFF_PACKBITS, and changed usage descriptions\n\t  in tools to reflect removal of LZW compression\n\t\n\t<li> Added nostrip to install in tools/Makefile.in so that debugging \n\t  symbols are kept. \n\t\n \t<li> Made Packbits the default compression in tools/tiff2rgba.c instead\n\tof LZW.\n\n\n</UL>\n\n<A HREF=\"index.html\"><IMG SRC=\"images/back.gif\"></A> TIFF home page.<BR>\n\n<HR>\n\nLast updated $Date: 2006/01/03 01:45:41 $.\n\n</BODY>\n</HTML>\n"
  },
  {
    "path": "src/main/jni/tiff/html/v3.5.5.html",
    "content": "<HTML>\n<HEAD>\n<TITLE>\nChanges in TIFF v3.5.5\n</TITLE>\n</HEAD>\n\n<BODY BGCOLOR=white>\n<FONT FACE=\"Helvetica, Arial, Sans\">\n<FONT FACE=\"Helvetica, Arial, Sans\"> \n\n<BASEFONT SIZE=4>\n<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>\n<BASEFONT SIZE=3>\n\n<UL>\n<HR SIZE=4 WIDTH=65% ALIGN=left>\n<B>Current Version</B>: v3.5.5<BR>\n<B>Previous Version</B>: <A HREF=v3.5.4.html>v3.5.4</a><BR>\n<B>Master FTP Site</B>: <A HREF=\"ftp://ftp.onshore.com/pub/libtiff\">ftp.onshore.com</a>, directory pub/libtiff</A><BR>\n<B>Master HTTP Site</B>: <A HREF=\"http://www.remotesensing.org/libtiff/\">http://www.remotesensing.org/libtiff</a> \n<HR SIZE=4 WIDTH=65% ALIGN=left>\n</UL>\n\n<P>\nThis document describes the changes made to the software between the\n<I>previous</I> and <I>current</I> versions (see above).\nIf you don't find something listed here, then it was not done in this\ntimeframe, or it was not considered important enough to be mentioned.\nThe following information is located here:\n<UL>\n<LI><A HREF=\"#configure\">Changes in the software configuration</A>\n<LI><A HREF=\"#libtiff\">Changes in libtiff</A>\n<LI><A HREF=\"#tools\">Changes in the tools</A>\n<LI><A HREF=\"#lzwkit\">Changes in the LZW compression kit</A>\n</UL>\n<p> \n<P><HR WIDTH=65% ALIGN=left>\n\n<A NAME=\"configure\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>\n\n<UL>\n\n        <LI> configure: added test for libc6 for linux targets.  Bug reported by \n        Stanislav Brabec <utx@k332.feld.cvut.cz>\n\n         <LI>\tconfigure: fixed bugs in sed scripts \n\t(applied sed script s:/@:s;@:;s:/s;;:;: to configure). \n\tfix submitted by Stanislav Brabec <utx@k332.feld.cvut.cz>\n\n\t<LI> tools/iptcutil was not in files list, and wasn't being \n\tadded to tar archive.  Updated Makefile.in.\n\n        <LI>  Added 3.5 docs to html/Makefile.in.  \n\tThanks to  Stanislav Brabec <utx@k332.feld.cvut.cz>\n\n        <LI> Fixed tools/tiffcmp so that stopondiff testing works.\n\t     Patch care of Joseph Orost <joe@sanskrit.lz.att.com>.\n\n        <LI> Added fax3sm_winnt.c to distribution list in Makefile.in. \n\n         <LI> Added libtiff/libtiff.def to TIFFILES distribution list.\n</UL>\n\n<P><HR WIDTH=65% ALIGN=left>\n\n<A NAME=\"libtiff\"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>\n\n\n<UL> \n        <LI>tif_fax3.c: Fixed serious bug introduced during the uint16->uint32 \n        conversion for the run arrays.  \n\n\t<LI> Set td_sampleformat default to SAMPLEFORMAT_UINT instead of \n\tSAMPLEFORMAT_VOID in TIFFDefaultDirectory() in tif_dir.c.\n\n        <LI> Added \"GetDefaulted\" support for TIFFTAG_SAMPLEFORMAT in tif_aux.c.\n\n\t<LI> Patched tif_fax3.c so that dsp->runs is allocated a bit bigger\n\tto avoid overruns encountered with frle_bug.tif.\n\n        \n\t<LI> Modified tif_unix.c to support 2-4GB seeks if USE_64BIT_API is\n\t  set to 1, and added default (off) setting in tiffconf.h.  This\n\t  should eventually be set by the configure script somehow.\n\n\t  The original work on all these 2-4GB changes was done by \n\t  Peter Smith (psmith@creo.com).\n\n\t<LI> Modified tif_win32.c to support 2-4GB seeks.\n\n\t<LI> tentatively changed toff_t to be unsigned instead of signed to\n\t  facilitate support for 2-4GB files. \n\n\t<LI>  Updated a variety of files to use toff_t.  Fixed some mixups\n\t      between toff_t and tsize_t.\n\n\t<LI> Set tif_rawdatasize to zero when freeing raw data buffer in\n\t     TIFFWriteDirectory().\n\n         <LI> Enabled \"REWRITE_HACK\" in tif_write.c by default.\n        \n         <LI> Fix bug in tif_write.c when switching between reading one directory\n\t      and writing to another. \n\n         <LI> Made TIFFWriteCheck() public, and added TIFFCreateDirectory()\n\n         <LI> Added TIFFmemory(3t) functions to libtiff.def.\n\n         <LI> Added libtiff/libtiff.def to TIFFILES distribution list.\n</UL>\n\n<P><HR WIDTH=65% ALIGN=left>\n\n<A NAME=\"tools\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE TOOLS:</B></A>\n\n<UL>\n\t<LI> fax2ps: Fixed mixup of width and height in bounding box statement\n\tas per submission by Nalin Dahyabhai <nalin@redhat.com>.\n\n\t<LI> fax2ps:  Modified printruns to take uint32 instead of uint16.  \n\tPatch courtesy of Bernt Herd <herd@herdsoft.com> \n\n\n\t<LI> Largely reimplemented contrib/addtiffo to avoid temp files, \n \t    updating the TIFF file in place.  Fixed a few other bugs to.\n\n       <LI> Altered descriptions in tools to reflect \"by default\" lzw not supported\n</UL>\n\n<P><HR WIDTH=65% ALIGN=left>\n\n<A NAME=\"lzwkit\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE LZW COMPRESSION KIT</B></A>\n<UL> \n\t<LI>created mangle-src.sh -- sed scripts to munge src into LZW enabled format. Thanks to Stanislav Brabec <utx@k332.feld.cvut.cz>\n\t\n\t<LI>created Makefile\n\t\n\t<LI>merged  tif_dir.c with current source. \n\n\n\t<LI>  Created lzw compression kit, as a new CVS module (libtiff-lzw-compression-kit). \n\n\t<LI>  Updated index.html to note lzw compression kit. \n\n</UL>\n\n<A HREF=\"index.html\"><IMG SRC=\"images/back.gif\"></A> TIFF home page.<BR>\n\n<HR>\n\nLast updated $Date: 2004/11/26 14:37:20 $.\n\n</BODY>\n</HTML>\n"
  },
  {
    "path": "src/main/jni/tiff/html/v3.5.6-beta.html",
    "content": "<HTML>\n<HEAD>\n<TITLE>\nChanges in TIFF v3.5.6\n</TITLE>\n</HEAD>\n\n<BODY BGCOLOR=white>\n<FONT FACE=\"Helvetica, Arial, Sans\">\n<FONT FACE=\"Helvetica, Arial, Sans\"> \n\n<BASEFONT SIZE=4>\n<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>\n<BASEFONT SIZE=3>\n\n<UL>\n<HR SIZE=4 WIDTH=65% ALIGN=left>\n<B>Current Version</B>: v3.5.6beta<BR>\n<B>Previous Version</B>: <A HREF=v3.5.5.html>v3.5.5</a><BR>\n<B>Master FTP Site</B>: <A HREF=\"ftp://ftp.onshore.com/pub/libtiff\">ftp.onshore.com</a>, directory pub/libtiff</A><BR>\n<B>Master HTTP Site</B>: <A HREF=\"http://www.remotesensing.org/libtiff/\">http://www.remotesensing.org/libtiff</a> \n<HR SIZE=4 WIDTH=65% ALIGN=left>\n</UL>\n\n<P>\nThis document describes the changes made to the software between the\n<I>previous</I> and <I>current</I> versions (see above).\nIf you don't find something listed here, then it was not done in this\ntimeframe, or it was not considered important enough to be mentioned.\nThe following information is located here:\n<UL>\n<LI><A HREF=\"#configure\">Changes in the software configuration</A>\n<LI><A HREF=\"#libtiff\">Changes in libtiff</A>\n<LI><A HREF=\"#tools\">Changes in the tools</A>\n<LI><A HREF=\"#contrib\">Changes in contrib</A>\n<LI><A HREF=\"#lzwkit\">Changes in the LZW compression kit</A>\n</UL>\n<p> \n<P><HR WIDTH=65% ALIGN=left>\n\n<A NAME=\"configure\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>\n\n<UL>\n\n\t<LI> Added GNULDdso target and switched linux and freebsd to use it. \n\t<LI> tools/Makefile.in: Modified to install properly on SGI.\n\t<LI> configure: Fixed DSO test for Linux as per patch from\n\t  Jan Van Buggenhout <chipzz@Ace.ULYSSIS.Student.KULeuven.Ac.Be>.\n\n</UL>\n\n<P><HR WIDTH=65% ALIGN=left>\n\n<A NAME=\"libtiff\"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>\n\n\n<UL> \n\n\t<LI> tif_dir.c: Clear TIFF_ISTILED flag in TIFFDefaultDirectory\n\tas per http://bugzilla.remotesensing.org/show_bug.cgi?id=18\n\tfrom vandrove@vc.cvut.cz.\n\n\t<LI> Modified tif_packbits.c decoding to avoid overrunning the\n\toutput buffer, and to issue a warning if data needs to be\n\tdiscarded.  See http://bugzilla.remotesensing.org/show_bug.cgi?id=18\n\n\t<LI> Modified TIFFClientOpen() to emit an error on an attempt to\n\topen a comperessed file for update (O_RDWR/r+) access.  This is\n\tbecause the compressor/decompressor code gets very confused when\n\tthe mode is O_RDWR, assuming this means writing only.  See\n\tbug http://bugzilla.remotesensing.org/show_bug.cgi?id=13\n\n\t<LI> Applied patch for 0x0000 sequences in tif_fax3.h's definition\n\tof EXPAND1D() as per bug 11 (from Roman). \n\n\t<LI> Fixed tiffcomp.h to avoid win32 stuff if unix #defined, to improve\n\tcygwin compatibility.\n\n\t<LI> Applied patch from Roman Shpount to tif_fax3.c.  This seems to\n\tbe a proper fix to the buffer sizing problem.  See \n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=11\n\n\t<LI> Fixed tif_getimage.c to fix overrun bug with YCbCr images without\n\tdownsampling.  http://bugzilla.remotesensing.org/show_bug.cgi?id=10\n\tThanks to Nick Lamb <njl98r@ecs.soton.ac.uk> for reporting the\n\tbug and proving the patch.\n\t\n\t<LI> Fixed tif_jpeg.c so avoid destroying the decompressor before\n\twe are done access data thanks to bug report from:\n\tMichael Eckstein <eckstein@gepro.cz>.\n\n\t<LI> tif_open.c: Don't set MMAP for O_RDWR files.\n\n\t<LI> tif_open.c: Set STRIPCHOP_DEFAULT for O_RDWR as well as O_RDONLY\n\tso that files opened for update can be strip chopped too.\n\n\t<LI> tif_read.c: fixed up bug with files missing rowsperstrip and\n\tthe strips per separation fix done a few weeks ago.\n\n\t<LI> Tentatively added support for SAMPLEFORMAT_COMPLEXIEEEFP, and\n\tSAMPLEFORMAT_COMPLEXINT.\n\n\t<LI> index.html, bugs.html: added bugzilla info. \n\n\t<LI> tif_read.c: fix subtle bug with determining the number of\n\trows for strips that are the last strip in a separation but\n\tnot the last strip of all in TIFFReadEncodedStrip().  \n\n\t<LI> Applied 16/32 bit fix to tif_fax3.c.  Fix supplied by\n\tPeter Skarpetis <peters@serendipity-software.com.au>\n\n\t<LI> Modified tiffio.h logic with regard to including windows.h.  It\n\twon't include it when building with __CYGWIN__.\n\n\t<LI> README: update to mention www.libtiff.org, don't list Sam's old\n\temail address.\n\n\t<LI> libtiff/tif_dirread.c: Don't use estimate strip byte count for\n\tone tile/strip images with an offset, and byte count of zero. These\n\tcould be \"unpopulated\" images. \n\n\t<LI> tif_win32.c:  Applied patch to fix overreads and ovverwrites\n\t  caught by BoundsChecker.  From Arvan Pritchard \n\t  <arvan.pritchard@infomatix.co.uk>  (untested). \n\t\n        <LI> tif_getimage.c:  Applied patch to silence VC6 warnings.  From \n\t  Arvan Pritchard <arvan.pritchard@informatix.co.uk>\n\t\n\t<LI> tif_lzw.c:  Applied patch to silence VC6 warnings.  From \n\t  Arvan Pritchard <arvan.pritchard@informatix.co.uk>\n\n\t<LI> libtiff/tif_apple.c: Applied \"Carbon\" support patches supplied by\n\tLeonard Rosenthol <leonardr@lazerware.com>.  May interfere\n\twith correct building on older systems.  If so, please let me know.\n\n\n</UL>\n\n<P><HR WIDTH=65% ALIGN=left>\n\n<A NAME=\"tools\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE TOOLS:</B></A>\n\n<UL>\n\n\t<LI> tools/rgb2ycbcr.c: fixed output strip size to account for vertical \n\troundup if rows_per_strip not a multiple of vertical sample size.\n\n\t<LI> tools/tiffsplit.c: Copy TIFFTAG_SAMPLEFORMAT.\n\n\t<LI>  Modified tiff2bw to ensure portions add to 100%, and that\n\t white is properly recovered.  See bug\n\t http://bugzilla.remotesensing.org/show_bug.cgi?id=15 Patch\n\t c/o Stanislav Brabec <utx@penguin.cz>\n\n</UL>\n\n<P><HR WIDTH=65% ALIGN=left>\n\n<A NAME=\"contrib\"><B><FONT SIZE=+3>C</FONT>HANGES IN CONTRIB:</B></A>\n\n<UL>\n\n\t<LI> contrib/addtiffo: Added \"averaging\" resampling option.\n\n\t<LI> Added contrib/stream (stream io) code submitted by Avi Bleiweiss.\n\n</UL>\n\n<P><HR WIDTH=65% ALIGN=left>\n\n<A NAME=\"lzwkit\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE LZW COMPRESSION KIT</B></A>\n<UL> \n\n    <LI> updated tif_dir.c to reflect changes to no-lzw tif_dir.c\n\n</UL>\n\n<A HREF=\"index.html\"><IMG SRC=\"images/back.gif\"></A> TIFF home page.<BR>\n\n<HR>\n\nLast updated $Date: 2006/03/18 17:12:47 $.\n\n</BODY>\n</HTML>\n"
  },
  {
    "path": "src/main/jni/tiff/html/v3.5.7.html",
    "content": "<HTML>\n<HEAD>\n<TITLE>\nChanges in TIFF v3.5.7\n</TITLE>\n</HEAD>\n\n<BODY BGCOLOR=white>\n<FONT FACE=\"Helvetica, Arial, Sans\">\n<FONT FACE=\"Helvetica, Arial, Sans\"> \n\n<BASEFONT SIZE=4>\n<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>\n<BASEFONT SIZE=3>\n\n<UL>\n<HR SIZE=4 WIDTH=65% ALIGN=left>\n<B>Current Version</B>: v3.5.7<BR>\n<B>Previous Version</B>: <A HREF=v3.5.6-beta.html>v3.5.6 Beta</a><BR>\n<B>Master FTP Site</B>: <A HREF=\"ftp://ftp.remotesensing.org/pub/libtiff\">ftp.remotesensing.org</a>, directory pub/libtiff</A><BR>\n<B>Master HTTP Site</B>: <A HREF=\"http://www.remotesensing.org/libtiff/\">http://www.remotesensing.org/libtiff</a> \n<HR SIZE=4 WIDTH=65% ALIGN=left>\n</UL>\n\n<P>\nThis document describes the changes made to the software between the\n<I>previous</I> and <I>current</I> versions (see above).\nIf you don't find something listed here, then it was not done in this\ntimeframe, or it was not considered important enough to be mentioned.\nThe following information is located here:\n<UL>\n<LI><A HREF=\"#configure\">Changes in the software configuration</A>\n<LI><A HREF=\"#libtiff\">Changes in libtiff</A>\n<LI><A HREF=\"#tools\">Changes in the tools</A>\n<LI><A HREF=\"#lzwkit\">Changes in the LZW compression kit</A>\n</UL>\n<p> \n<P><HR WIDTH=65% ALIGN=left>\n\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"configure\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>\n\n<UL>\n<li> libtiff/libtiff.def: Brent Roman submitted new version adding\nserveral missing entry points.  Also add a few other entry points \nlater.\n\n<li> configure, Makefile.in, etc: added support for OPTIMIZER being\n\tset from config.site. \n<li> config.guess: updated wholesale to an FSF version apparently \n\tfrom 1998 (as opposed to 1994).  This is mainly inspired by \n\tproviding for MacOS X support.\n\n<li> configure/config.site: modified to check if -lm is needed for\n\tMACHDEPLIBS if not supplied by config.site.  Needed for Darwin.\n<li> libtiff/tiff.h: Applied hac to try and resolve the problem\n\twith the inttypes.h include file on AIX. (Bug 39)\n\n<li> configure, *Makefile.in: Various changes to improve configuration\n\tfor HP/UX specifically, and also in general.  (Bug 40) They include:\n<ul>\n <li> Try to handle /usr/bin/sh instead of /bin/sh where necessary.\n <li> Upgrade to HP/UX 10.x+ compiler, linker and dso options.\n <li> Fixed mmap() test to avoid MMAP_FIXED ... it isn't available on HP\n <li> Use -${MAKEFLAGS} in sub makes from makefiles.\n <li> Fixed SCRIPT_SH/SHELL handling.\n</ul>\n<li> configure: Changes for DSO generation on AIX provided by\n\tJohn Marquart <jomarqua@indiana.edu>.\n\n<li> configure, libtiff/Makefile.in: Modified to build DSOs properly\n\ton Darwin thanks to Robert Krajewski (rpk@alum.mit.edu) and\n\tKeisuke Fujii (fujiik@jlcuxf.kek.jp).\n\n<li> configure, libtiff/Makefile.in: applied OpenBSD patches as per bug 61.\n\n<li> Makefile.in: added DESTDIR support as per bug 60.\n\n<li> libtiff/tif_jpeg.c: Define HAVE_BOOLEAN on windows if RPCNDR.H \n\thas been included.\n<li> man/Makefile.in: add TIFFClientOpen link as per debian submitted\n\tbug 66.\n<li> libtiff/Makefile.in: Fixed @DSOSUB_VERSION to be @DSOSUF_VERSION@\n\tin two places.\n</UL>\n\n<P><HR WIDTH=65% ALIGN=left>\n\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"libtiff\"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>\n\n\n<UL> \n<li> tif_fax3.c: keep rw_mode flag internal to fax3 state to remember\n\twhether we are encoding or decoding.  This is to ensure graceful \n\trecovery if TIFFClientOpen() discovers an attempt to open a compressed\n\tfile for \"r+\" access, and subsequently close it, as it resets the \n\ttif_mode flag to O_RDONLY in this case to avoid writes, confusing the\n\tcompressor's concept of whether it is in encode or decode mode.\n<li> tif_luv.c/tiff.h/tiffio.h: \n\tNew version of TIFF LogLuv (SGILOG) modules contributed by Greg Ward \n\t(greg@shutterfly.com).  He writes:\n\n<ol>\n\t<li> I improved the gamut-mapping function in tif_luv.c for imaginary\n\tcolors, because some images were being super-saturated on the input \n\tside and this resulted in some strange color shifts in the output.\n\n\t<li> I added a psuedotag in tiff.h to control random dithering during\n\tLogLuv encoding.  This is turned off by default for 32-bit LogLuv and \n\ton for 24-bit LogLuv output.  Dithering improves the average color \n\taccuracy over the image.\n\n\t<li> I added a #define for LOG_LUV_PUBLIC, which is enabled by default in\n\ttiffio.h, to expose internal routines for converting between LogLuv and\n\tXYZ coordinates.  This is helpful for writing more efficient,\n\tspecialized conversion routines, especially for reading LogLuv files.\n</ol>\n\n<li> libtiff/tif_dirinfo.c: don't declare tiffFieldInfo static on VMS.\n\n<li> Added TIFFTAG_COPYRIGHT support.\n<li> tif_getimage.c: Added support for 16bit minisblack/miniswhite \n\timages in RGBA interface.\n<li> libtiff/tif_dirinfo.c: removed duplicate TIFFTAG_PHOTOSHOP as per\n\tbug 44.\n<li> libtiff/tif_dirwrite.c: Added support for TIFF_VARIABLE2 in the\n\tcase of writing TIFF_BYTE/TIFF_SBYTE fields as per bug 43.\n\n<li> libtiff/tif_dirinfo.c: Modified the TIFF_BYTE definition for\n\tTIFFTAG_PHOTOSHOP to use a writecount of TIFF_VARIABLE2 (-3) to\n\tforce use of uint32 counts instead of short counts. \n\n<li> libtiff/tif_dirinfo.c: moved pixar and copyright flags to \n\tensure everything is in order.\n\n<li> Integrated experimental OJPEG support from Scott Marovich of HP.  \n\n<li> libtiff/tif_open.c: Seek back to zero after failed read,\n\tbefore writing header.\n\n<li> libtiff/tiff.h, libtiff/tif_fax3.c: added check for __LP64__ \n\twhen checking for 64 bit architectures as per bugzilla bug 67.\n<li> libtiff/tif_getimage.c: Use memmove() instead of TIFFmemcpy()\n\tin TIFFReadRGBATile() to avoid issues in cases of overlapping\n\tbuffers.  See Bug 69 in Bugzilla. \n<li> libtiff/tif_getimage.c: Don't complain for CMYK (separated)\n\timages with more than four samples per pixel as per bug 73.\n\n<li> libtiff/tif_getimage.c: relax handling of contig case where\nthere are extra samples that are supposed to be ignored as per bug 75.  This\nshould now work for 8bit greyscale or palletted images.  \n\n<li> libtiff/tif_packbits.c: fixed memory overrun error as per bug 77.\n\n<li> libtiff/tif_getimage.c: Fixed problem with reading strips or\ntiles that don't start on a tile boundary.  Fix contributed by\nJosep Vallverdu (from HP), and further described in bug 47.\n\n<li> libtif/tif_fax3.c: Removed #ifdef PURIFY logic, and modified to\n\talways use the \"safe\" version, even if there is a very slight\n\tcost in performance as per bug 54.\n<li> libtiff/tif_lzw.c: added dummy LZWSetupEncode() to report an\n\terror about LZW not being available.\n\n<li> libtiff/tif_dir.c: propagate failure to initialize compression\n\tback from TIFFSetField() as an error status, so applications can \n\tdetect failure.\n\n<li> libtiff/tif_lzw.c: Avoid MS VC++ 5.0 optimization bug as per bug 78.\n\n<li> libtiff/tif_dirwrite.c: added TIFFRewriteDirectory() function.\nUpdated TIFFWriteDirectory man page to include TIFFRewriteDirectory.\n\n<li> libtiff/tiff.h: I have created COMPRESSION_CCITT_T4, \n\tCOMPRESSION_CCITT_T6, TIFFTAG_T4OPTIONS and TIFFTAG_T6OPTIONS aliases \n\tin keeping with TIFF 6.0 standard in tiff.h as per bug 83.\n\n<li> Added PHOTOMETRIC_ITULAB as per bug 90.\n\n</UL>\n\n<P><HR WIDTH=65% ALIGN=left>\n\n<!-------------------------------------------------------------------------->\n\n<A NAME=\"tools\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE TOOLS:</B></A>\n\n<UL>\n<li> Brent Roman contributed updated tiffcp utility (and tiffcp.1)\n\twith support for extracting subimages with the ,n syntax, and also\n\tadding the -b bias removal flag. \n<li> tiff2ps.c/tiff2ps.1: Substantial changes to tiff2ps by\n\tBruce A. Mallett, including a faster encoder, fixes for level\n\t2 PostScript, and support for the imagemask operator.\n<li> fax2ps.c: Helge (libtiff at oldach.net) submitted fix\nthat corrects behaviour for non-Letter paper\nsizes. (Bug 35) It fixes two problems:\n<br>\n\tWithout\tscaling (-S) the fax is now centered on the page size specified\n\twith -H\tand/or -W. Before, fax2ps was using an obscure and practially\n\tuseless algorithm to allocate the image relative to Letter sized paper\n\twhich sometime sled to useless whitespace on the paper, while at the\n\tsame time cutting of the faxes printable area at the opposite border.\n<br>\n\n\tSecond, scaling now preserves aspect ratio, which makes unusual faxes\n\t(in particular short ones) print properly.\n\n<li> thumbnail.c: changed default output compression\n\tto packbits from LZW since LZW isn't generally available.\n<li> tiff2rgba.c: added -n flag to avoid emitting alpha component. Also added\na man page for tiff2rgba.\n\n<li> tiffcmp.c: Fixed multi samples per pixel support for ContigCompare\nas per bug 53.\nUpdated bug section of tiffcmp.1 to note tiled file issues.\n\n<li> libtiff/tif_getimage.c: Fixed so that failure is properly\n\treported by gtTileContig, gtStripContig, gtTileSeparate and \n\tgtStripSeparate as per bug 51.\n\n\n</UL>\n\n<P><HR WIDTH=65% ALIGN=left>\n\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"lzwkit\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE LZW COMPRESSION KIT:</B></A>\n<UL> \n\t<LI> Rewrote lzw patching process so that is required to enable full\n\tLZW support is to drop the tif_lzw.c from the \n\tlibtiff-lzw-compression-kit over the one in the libtiff directory. \n\n\t<LI> Some changes were made to make recovery from failure to\n\tinitialize the LZW compressor more graceful.\n\n\t<LI> Note that as distributed libtiff support LZW decompression, but\n        not LZW compression. \n</UL>\n\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"contrib\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE CONTRIB AREA:</B></A>\n<UL> \n<li> Fixed distribution to include contrib/addtiffo/tif_ovrcache.{c,h}.\n</UL>\n\n<A HREF=\"index.html\"><IMG SRC=\"images/back.gif\"></A> TIFF home page.<BR>\n\n<HR>\n\nLast updated $Date: 2004/11/26 14:37:20 $.\n\n</BODY>\n</HTML>\n"
  },
  {
    "path": "src/main/jni/tiff/html/v3.6.0.html",
    "content": "<HTML>\n<HEAD>\n<TITLE>\nChanges in TIFF v3.6.0\n</TITLE>\n</HEAD>\n\n<BODY BGCOLOR=white>\n<FONT FACE=\"Helvetica, Arial, Sans\">\n<FONT FACE=\"Helvetica, Arial, Sans\"> \n\n<BASEFONT SIZE=4>\n<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>\n<BASEFONT SIZE=3>\n\n<UL>\n<HR SIZE=4 WIDTH=65% ALIGN=left>\n<B>Current Version</B>: v3.6.0<BR>\n<B>Previous Version</B>: <A HREF=v3.5.7.html>v3.5.7</a><BR>\n<B>Master FTP Site</B>: <A HREF=\"ftp://ftp.remotesensing.org/pub/libtiff\">\nftp.remotesensing.org</a>, directory pub/libtiff</A><BR>\n<B>Master HTTP Site</B>: <A HREF=\"http://www.remotesensing.org/libtiff\">\nhttp://www.remotesensing.org/libtiff</a> \n<HR SIZE=4 WIDTH=65% ALIGN=left>\n</UL>\n\n<P>\nThis document describes the changes made to the software between the\n<I>previous</I> and <I>current</I> versions (see above).\nIf you don't find something listed here, then it was not done in this\ntimeframe, or it was not considered important enough to be mentioned.\nThe following information is located here:\n<UL>\n<LI><A HREF=\"#hightlights\">Major Changes</A>\n<LI><A HREF=\"#configure\">Changes in the software configuration</A>\n<LI><A HREF=\"#libtiff\">Changes in libtiff</A>\n<LI><A HREF=\"#tools\">Changes in the tools</A>\n<LI><A HREF=\"#contrib\">Changes in the contrib area</A>\n<LI><A HREF=\"#lzwkit\">Changes in the LZW compression kit</A>\n</UL>\n<p> \n<P><HR WIDTH=65% ALIGN=left>\n\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"highlights\"><B><FONT SIZE=+3>M</FONT>AJOR CHANGES:</B></A>\n\n<ul>\n\t<li> New utility <a href=./man/raw2tiff.1.html>raw2tiff</a>\nfor converting raw rasters into TIFF files.\n\t<li> Lots of new <a href=./man/tiff2ps.1.html>tiff2ps</a> options.\n\t<li> Lots of new <a href=./man/fax2tiff.1.html>fax2tiff</a> options.\n\t<li> Lots of bug fixes for LZW, JPEG and OJPEG compression. \n</ul>\n\n<h3>Custom Tag Support</h3>\n\nThe approach to extending libtiff with custom tags has changed radically.\nPreviously, all internally supported TIFF tags had a place in the \nprivate TIFFDirectory structure within libtiff to hold the values (if read),\nand a \"field number\" (ie. FIELD_SUBFILETYPE) used to identify that tag. \nHowever, every time a new tag was added to the core, the size of the\nTIFFDirectory structure would changing, breaking any dynamically linked\nsoftware that used the private data structures.<p>\n\nAlso, any tag not recognised\nby libtiff would not be read and accessable to applications without some\nfairly complicated work on the applications part to pre-register the tags\nas exemplified by the support for \"Geo\"TIFF tags by libgeotiff layered on\nlibtiff.  <p>\n\nAmoung other things this approach required the extension code\nto access the private libtiff structures ... which made the higher level\nnon-libtiff code be locked into a specific version of libtiff at compile time.\nThis caused no end of bug reports!<p>\n\nThe new approach is for libtiff to read all tags from TIFF files.  Those that\naren't recognised as \"core tags\" (those having an associated FIELD_ value, \nand place for storage in the TIFFDirectory structure) are now read into a \ndynamic list of extra tags (td_customValues in TIFFDirectory).  When a new\ntag code is encountered for the first time in a given TIFF file, a new \nanonymous tag definition is created for the tag in the tag definition list. \nThe type, and some other metadata is worked out from the instance encountered.\nThese fields are known as \"custom tags\".  <p>\n\nCustom tags can be set and fetched normally using TIFFSetField() and \nTIFFGetField(), and appear pretty much like normal tags to application code.\nHowever, they have no impact on internal libtiff processing (such as\ncompression).  Some utilities, such as tiffcp will now copy these custom\ntags to the new output files. <p>\n\nAs well as the internal work with custom tags, new C API entry points\nwere added so that extension libraries, such as libgeotiff, could \ndefine new tags more easily without accessing internal data structures.  \nBecause tag handling of extension tags is done via the \"custom fields\" \nmechanism as well, the definition provided externally mostly serves to provide\na meaningful name for the tag.\n\nThe addition of \"custom tags\" and the altered approach to extending libtiff\nwith externally defined tags is the primary reason for the shift to the \n3.6.x version number from 3.5.x.<p>\n\n<P><HR WIDTH=65% ALIGN=left>\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"configure\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>\n\n<UL>\n<li> configure, config.site: Fix for large files (>2GiB) support. New\noption in the config.site: LARGEFILE=\"yes\". Should be enougth for the large\nfiles I/O.\n\n<li> configure: Set -DPIXARLOG_SUPPORT option along with -DZIP_SUPPORT.\n\n<li> html/Makefile.in: Updated to use groffhtml for generating html pages\nfrom man pages.\n\n<li> configure, libtiff/Makefile.in: Added SCO OpenServer 5.0.6 support\nfrom John H. DuBois III.  \n\n<li> libtiff/{Makefile.vc, libtiff.def}: Missed declarations added.\n\n<li> libtiff/Makefile.in, tools/Makefile.in: Shared library will not be\nstripped when installing, utility binaries will do be stripped. As per bug 93.\n\n<li> man/Makefile.in: Patch DESTDIR handling as per bug 95.\n\n<li> configure: OpenBSD changes for Sparc64 and DSO version as per bug 96.\n\n<li> config.site/configure: added support for OJPEG=yes option to enable\nOJPEG support from config.site.\n\n<li> config.guess, config.sub: Updated from ftp.gnu.org/pub/config.\n\n<li> configure: Modify CheckForBigEndian so it can work in a cross\ncompiled situation.\n\n<li> configure, libtiff/Makefile.in: Changes for building on MacOS 10.1\nas per bug 94.\n\n<li> html/Makefile.in: added missing images per bug 92.\n\n<li> port/Makefile.in: fixed clean target per bug 92.\n</UL>\n\n<P><HR WIDTH=65% ALIGN=left>\n\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"libtiff\"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>\n\n<UL>\n\n<li> libtiff/tif_getimage.c: New function <A\nHREF=\"./man/TIFFReadRGBAImage.3t.html\">TIFFReadRGBAImageOriented()</A>\nimplemented to retrieve raster array with user-specified origin position.\n\n<li> libtiff/tif_fax3.c: Fix wrong line numbering.\n\n<li> libtiff/tif_dirread.c: Check field counter against number of fields.\n\n<li> Store a list of opened IFD to prevent directory looping.\n\n<li> libtiff/tif_jpeg.c: modified segment_height calculation to always\nbe a full height tile for tiled images.  Also changed error to just\nbe a warning.\n\n<li> libtiff/tif_lzw.c: fixed so that decoder state isn't allocated till\nLZWSetupDecode().  Needed to read LZW files in \"r+\" mode.\n\t\n<li> libtiff/tif_dir.c: fixed up the tif_postdecode settings responsible\nfor byte swapping complex image data.\n\t\n<li> libtiff/tif_open.c: Removed error if opening a compressed file\nin update mode bug (198).\n\n<li> libtiff/tif_write.c: TIFFWriteCheck() now fails if the image is\na pre-existing compressed image.  That is, image writing to pre-existing\ncompressed images is not allowed.\n\n<li> html/man/*.html: Web pages regenerated from man pages.\n\n<li> libtiff/tif_jpeg.c: Hack to ensure that \"boolean\" is defined properly\non Windows so as to avoid the structure size mismatch error from libjpeg\n(bug 188).\n\n<li> libtiff/tiff.h: #ifdef USING_VISUALAGE around previous Visual Age\nAIX porting hack as it screwed up gcc. (bug 39)\n\n<li> libtiff/tiff.h: added COMPRESSION_JP2000 (34712) for LEAD tools\ncustom compression.\n\n<li> libtiff/tif_dirread.c: Another fix for the fetching SBYTE arrays\nby the TIFFFetchByteArray() function. (bug 52)\n\n<li> libtiff/tif_dirread.c: Expand v[2] to v[4] in TIFFFetchShortPair()\nas per bug 196.\n\n<li> libtiff/tif_lzw.c: Additional consistency checking added in\nLZWDecode() and LZWDecodeCompat() fixing bugs 190 and 100.\n\n<li> libtiff/tif_lzw.c: Added check for valid code lengths in LZWDecode()\nand LZWDecodeCompat(). Fixes bug 115.\n\n<li> tif_getimage.c: Ensure that TIFFRGBAImageBegin() returns the\nreturn code from the underlying pick function as per bug 177.\n\n<li> libtiff/{tif_jpeg.c,tif_strip.c,tif_print.c}: Hacked tif_jpeg.c to\nfetch TIFFTAG_YCBCRSUBSAMPLING from the jpeg data stream if it isn't\npresent in the tiff tags as per bug 168.\n\n<li> libtiff/tif_jpeg.c: Fixed problem with setting of nrows in \nJPEGDecode() as per bug 129. \n\n<li> libtiff/tif_read.c, libtiff/tif_write.c: TIFFReadScanline() and\nTIFFWriteScanline() now set tif_row explicitly in case the codec has\nfooled with the value as per bug 129.\n\n<li> libtiff/tif_ojpeg.c: Major upgrade from Scott.  Details in bug 156.\n\n<li>  libtiff/tif_open.c: Pointers to custom procedures\nin TIFFClientOpen() are checked to be not NULL-pointers.\n\n<li> libtiff/tif_lzw.c: Assertions in LZWDecode and LZWDecodeCompat\nreplaced by warnings. Now libtiff should read corrupted LZW-compressed\nfiles by skipping bad strips as per bug 100.\n\t\n<li> libtiff/: tif_dirwrite.c, tif_write.c, tiffio.h:\n<a href=./man/TIFFWriteDirectory.3t.html>TIFFCheckpointDirectory()</a>\nroutine added as per bug 124.  The\n<a href=./man/TIFFWriteDirectory.3t.html>TIFFWriteDirectory</a>\nman page discusses this new function as well as the related \n<a href=./man/TIFFWriteDirectory.3t.html>TIFFRewriteDirectory()</a>.\n\n<li> libtiff/: tif_codec.c, tif_compress.c, tiffiop.h, tif_getimage.c: \nIntroduced\nadditional members tif->tif_decodestatus and tif->tif_encodestatus\nfor correct handling of unconfigured codecs (we should not try to read\ndata or to define data size without correct codecs). See bug 119.\n\n<li> tif_dirread.c: avoid div-by-zero if rowbytes is zero in chop func as\nper bug 111.\n\n<li> libtiff/: tiff.h, tif_dir.c, tif_dir.h, tif_dirinfo.c, tif_dirread.c,\ntif_dirwrite.c: Dwight Kelly added get/put code for new tag XMLPACKET as \ndefined in Adobe XMP Technote. Added missing INKSET tag value from TIFF 6.0 \nspec INKSET_MULTIINK (=2). Added missing tags from Adobe TIFF technotes: \nCLIPPATH, XCLIPPATHUNITS, YCLIPPATHUNITS, OPIIMAGEID, OPIPROXY and\nINDEXED. Added PHOTOMETRIC tag value from TIFF technote 4 ICCLAB (=9).\n\n<li> libtiff/tif_getimage.c: Additional check for supported codecs added in \nTIFFRGBAImageOK, TIFFReadRGBAImage, TIFFReadRGBAStrip and TIFFReadRGBATile now\nuse TIFFRGBAImageOK before reading a per bug 110.\n\n<li> libtiff/: tif_dir.c, tif_dir.h, tif_dirinfo.c, tif_dirread.c,\ntif_dirwrite.c: Added routine\n<a href=./man/TIFFDataWidth.3t.html>TIFFDataWidth</a> for determining\nTIFFDataType sizes instead of working with tiffDataWidth array\ndirectly as per bug 109.\n\n<li>libtiff/: tif_dirinfo.c, tif_dirwrite.c: Added possibility to\nread broken TIFFs with LONG type used for TIFFTAG_COMPRESSION,\nTIFFTAG_BITSPERSAMPLE, TIFFTAG_PHOTOMETRIC as per bug 99.\n\n<li> libtiff/{tiff.h,tif_fax3.c}: Add support for __arch64__ as per bug 94.\n\n<li> libtiff/tif_read.c: Fixed TIFFReadEncodedStrip() to fail if the\ndecodestrip function returns anything not greater than zero as per bug 97.\n\n<li> libtiff/tif_jpeg.c: fixed computation of segment_width for \ntiles files to avoid error about it not matching the \ncinfo.d.image_width values (\"JPEGPreDecode: Improper JPEG strip/tile \nsize.\") for ITIFF files.  Apparently the problem was incorporated since\n3.5.5, presumably during the OJPEG/JPEG work recently.\n\n<li> libtiff/tif_getimage.c: If DEFAULT_EXTRASAMPLE_AS_ALPHA is 1 \n(defined in tiffconf.h - 1 by default) then the RGBA interface\nwill assume that a fourth extra sample is ASSOCALPHA if the\nEXTRASAMPLE value isn't set for it.  This changes the behaviour of\nthe library, but makes it work better with RGBA files produced by\nlots of applications that don't mark the alpha values properly.\nAs per bugs 93 and 65.\n\n<li> libtiff/tif_jpeg.c: allow jpeg data stream sampling values to \noverride those from tiff directory.  This makes this work with \nImageGear generated files. \n\n</UL>\n\n<P><HR WIDTH=65% ALIGN=left>\n\n<!-------------------------------------------------------------------------->\n\t\n<A NAME=\"tools\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE TOOLS:</B></A>\n\n<UL>\n\t\n<li> <a href=./man/tiff2ps.1.html>tiff2ps</a>: Added page size setting\nwhen creating PS Level 2.\n\n<li> <a href=./man/tiff2ps.1.html>tiff2ps</a>: Fixed PS comment emitted when\nFlateDecode is being used.\n\n<li> <a href=./man/tiffsplit.1.html>tiffsplit</a>: increased the maximum\nnumber of pages that can be split.\n\n<li> <a href=./man/raw2tiff.1.html>raw2tiff</a>: Added option `-p' to\nexplicitly select color\tspace of input image data.\n\n<li> <a href=./man/tiffmedian.1.html>tiffmedian</a>: Suppiort for large\n(> 2GB) images.\n\n<li> <a href=./man/ppm2tiff.1.html>ppm2tiff</a>: Fixed possible endless loop.\n\n<li> <a href=./man/tiff2rgba.1.html>tiff2rgba</a>: Switched to use\n<A HREF=\"./man/TIFFReadRGBAImage.3t.html\">TIFFReadRGBAImageOriented()</A>\ninstead of <A HREF=\"./man/TIFFReadRGBAImage.3t.html\">TIFFReadRGBAImage()</A>.\n\n<li> <a href=./man/tiffcmp.1.html>tiffcmp</a>: Fixed problem with unused data\ncomparing (bug 349). `-z' option now can be used to set the number of reported\ndifferent bytes.\n\n<li> <a href=./man/tiffcp.1.html>tiffcp</a>: Added possibility to specify\nvalue -1 to -r option to get the entire image as one strip (bug 343).\n\n<li> <a href=./man/tiffcp.1.html>tiffcp</a>: Set the correct RowsPerStrip\nand PageNumber values (bug 343).\n\t\n<li> <a href=./man/fax2tiff.1.html>fax2tiff</a>: Page numbering fixed (bug\n341).\n\n<li> <a href=./man/ppm2tiff.1.html>ppm2tiff</a>: PPM header parser improved:\nnow able to skip comments.\n\n<li> <a href=./man/tiff2ps.1.html>tiff2ps</a>: Force deadzone printing when\nEPS output specified (bug 325).\n\n<li> <a href=./man/tiff2ps.1.html>tiff2ps</a>: Add ability to generate\nPS Level 3. It basically allows one to use the /flateDecode filter for ZIP\ncompressed TIFF images. Patch supplied by Tom Kacvinsky (bug 328).\n\t\n<li> <a href=./man/tiffcp.1.html>tiffcp</a>: Fixed problem with colorspace\nconversion for JPEG encoded images (bugs 23 and 275)\n\n<li> <a href=./man/fax2tiff.1.html>fax2tiff</a>: Applied patch from\nJulien Gaulmin. More switches for fax2tiff tool for better control\nof input and output (bugs 272 and 293).\n\n<li> <a href=./man/raw2tiff.1.html>raw2tiff</a>:\nNew utility for turning raw raster images into TIFF files\nwritten by Andrey Kiselev.\n\n<li> <a href=./man/tiff2ps.1.html>tiff2ps</a>:\nSebastian Eken provided patches (bug 200) to add new these new \nswitches:\n  <ul>\n    <li> <b>-b #</b>: for a bottom margin of # inches\n    <li> <b>-c</b>: center image\n    <li> <b>-l #</b>: for a left margin of # inches\n    <li> <b>-r</b>: rotate the image by 180 degrees\n  </ul>\n\nAlso, new features merged with code for shrinking/overlapping.\n\n<li> <a href=./man/tiff2ps.1.html>tiff2ps</a>: Don't emit BeginData/EndData\nDSC comments since we are unable to properly include the amount to skip\nas per bug 80.\n\n<li> <a href=./man/tiff2ps.1.html>tiff2ps</a>: Added workaround for some\nsoftware that may crash when last strip of image contains fewer number\nof scanlines than specified by the `/Height' variable as per bug 164.\n\n<li> <a href=./man/tiff2ps.1.html>tiff2ps</a>: Patch from John Williams to add new \nfunctionality for tiff2ps utility splitting long images in several pages as\nper bug 142. New switches:\n\t<ul>\n\t\t<li> <b>-H #</b>: split image if height is more than # inches\n\t\t<li> <b>-L #</b>: overLap split images by # inches\n\t</ul>\n\n<li>  <a href=./man/tiff2ps.1.html>tiff2ps</a>: New commandline\nswitches to override resolution units obtained from the input file per bug 131:\n\t<ul>\n\t\t<li> <b>-x</b>: override resolution units as centimeters\n\t\t<li> <b>-y</b>: override resolution units as inches\n\t</ul>\n\n<li> <a href=./man/fax2tiff.1.html>fax2tiff</a>: Updated to reflect\nlatest changes in libtiff per bug 125.\n\n<li> tiff2ps: Division by zero fixed as per bug 88.\n\n<li> <a href=./man/tiffcp.1.html>tiffcp<a>:\nAdded support for 'Orientation' tag.\n\n<li> <a href=./man/tiffdump.1.html>tiffdump</a>:\ninclude TIFFTAG_JPEGTABLES in tag list.\n\n<li> tiffset: fix bug in error reporting.\n\n</UL>\n\n<P><HR WIDTH=65% ALIGN=left>\n\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"contrib\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE CONTRIB AREA:</B></A>\n<UL> \n\n<li> Fixed distribution to include contrib/addtiffo/tif_ovrcache.{c,h}.\n<li> libtiff/contrib/win95: renamed to contrib/win_dib.  Added new \nTiffile.cpp example of converting TIFF files into a DIB on Win32 as per \nbug 143.\n\n</UL>\n\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"lzwkit\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE LZW COMPRESSION\nKIT:</B></A>\n<UL> \n\n<li> LZW compression kit synchronized with actual libtiff version.\n\n</UL>\n\n<A HREF=\"index.html\"><IMG SRC=\"images/back.gif\"></A> TIFF home page.<BR>\n\n<HR>\n\nLast updated $Date: 2003/10/04 11:38:17 $.\n\n</BODY>\n</HTML>\n"
  },
  {
    "path": "src/main/jni/tiff/html/v3.6.1.html",
    "content": "<HTML>\n<HEAD>\n<TITLE>\nChanges in TIFF v3.6.1\n</TITLE>\n</HEAD>\n\n<BODY BGCOLOR=white>\n<FONT FACE=\"Helvetica, Arial, Sans\">\n<FONT FACE=\"Helvetica, Arial, Sans\"> \n\n<BASEFONT SIZE=4>\n<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>\n<BASEFONT SIZE=3>\n\n<UL>\n<HR SIZE=4 WIDTH=65% ALIGN=left>\n<B>Current Version</B>: v3.6.1<BR>\n<B>Previous Version</B>: <A HREF=v3.6.0.html>v3.6.0</a><BR>\n<B>Master FTP Site</B>: <A HREF=\"ftp://ftp.remotesensing.org/pub/libtiff\">\nftp.remotesensing.org</a>, directory pub/libtiff</A><BR>\n<B>Master HTTP Site</B>: <A HREF=\"http://www.remotesensing.org/libtiff\">\nhttp://www.remotesensing.org/libtiff</a> \n<HR SIZE=4 WIDTH=65% ALIGN=left>\n</UL>\n\n<P>\nThis document describes the changes made to the software between the\n<I>previous</I> and <I>current</I> versions (see above).\nIf you don't find something listed here, then it was not done in this\ntimeframe, or it was not considered important enough to be mentioned.\nThe following information is located here:\n<UL>\n<LI><A HREF=\"#hightlights\">Major Changes</A>\n<LI><A HREF=\"#configure\">Changes in the software configuration</A>\n<LI><A HREF=\"#libtiff\">Changes in libtiff</A>\n<LI><A HREF=\"#tools\">Changes in the tools</A>\n<LI><A HREF=\"#contrib\">Changes in the contrib area</A>\n<LI><A HREF=\"#lzwkit\">Changes in the LZW compression kit</A>\n</UL>\n<p> \n<P><HR WIDTH=65% ALIGN=left>\n\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"highlights\"><B><FONT SIZE=+3>M</FONT>AJOR CHANGES:</B></A>\n\n<ul>\n\t<li> New utility <a href=\"./man/tiff2pdf.1.html\">tiff2pdf</a>\n\tfor converting TIFF images directly into PDF.\n\t<li> New <a href=\"./man/TIFFcolor.3t.html\">color conversion module</a>.\n\t<li> Full support for Orientation tag in\n\t<a href=\"./man/TIFFReadRGBAImage.3t.html\">TIFFRGBAImage</a> interface.\n\t<li> Many bugs fixed.\n</ul>\n\n\n<P><HR WIDTH=65% ALIGN=left>\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"configure\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>\n\n<UL>\n\n<li> libtiff/makefile.vc, tools/makefile.vc: Support for IJG JPEG library.\n\n<li> Makefile.in: Add an absolute path to the test_pics.sh call.\n\n<li> Makefile.in: Add an absolute path to the test_pics.sh call.\n\n<li> libtiff/tiffcomp.h: #define _BSDTYPES_DEFINED when defining BSD typedefs.\n\n<li> configure, libtiff/{Makefile.in, mkversion.c}: Relative buildings fixed.\n\n<li> Makefile.in: Add an absolute path to the test_pics.sh call.\n\n</UL>\n\n<P><HR WIDTH=65% ALIGN=left>\n\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"libtiff\"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>\n\n<UL>\n\n<li> libtiff/{tif_color.c, tif_getimage.c, tiffio.h}: Added support\nfor ReferenceBlackWhite tag handling when converted from YCbCr color space as\nper bug 120.\n\n<li> libtiff/{tif_getimage.c, tif_aux.c}: Read WhitePoint tag from the\nfile and properly use it for CIE Lab 1976 to RGB transform.\n\n<li> libtiff/{tif_getimage.c, tiffio.h}: Finally resolved problems with\norientation handling. TIFFRGBAImage interface now properly supports all\npossible orientations, i.e. images will be flipped both in horizontal and\nvertical directions if required. 'Known bugs' section now removed from the\nappropriate manual pages.\n\n<li> libtiff/tif_luv.c: Fixed bug in 48-bit to 24-bit conversion routine,\nreported by Antonio Scuri.\n\n<li> libtiff/{tiffio.h, tif_codec.c}: Added new function\nTIFFIsCODECConfigured(), suggested by Ross Finlayson.\n\n<li> libtiff/tif_ojpeg.c: TIFFVGetField() function now can properly extract\nthe fields from the OJPEG files. Patch supplied by Ross\tFinlayson.\n\n<li> libtiff/tif_dir.h: _TIFFFindOrRegisterdInfo declaration replaced\nwith _TIFFFindOrRegisterFieldInfo as reported by Ross Finlayson.\n\n<li> libtiff/tif_dirinfo.c: Implemented binary search in _TIFFMergeFieldInfo().\nPatch supplied by Ross Finlayson.\n\n<li> tif_dirread.c: do not mark all anonymously defined tags to be IGNOREd (as\nit was done in 3.6.0).\n\n<li> libtiff/{tiff.h, tif_dirinfo.c}: Added support for IFD (13) datatype,\nintruduced in \"Adobe PageMaker TIFF Technical Notes\".\n\n<li> libtiff/{tif_color.c, tif_getimage.c, tiffio.h}: New color space\nconversion code: CIE L*a*b* 1976 images now supported by the TIFFRGBAImage\ninterface. YCbCr to RGB conversion code also moved there and now has\n<a href=\"./man/TIFFcolor.3t.html\">publicly available interface</a>. These\nroutines currently used in TIFFRGBAImage interface only and not supported in\nother libtiff tools yet. So if you want, for example, to convert CIE Lab image\ninto PostScript file you should do it in two steps: chnge colorspace to RGB\nusing <a href=\"./man/tiff2rgba.1.html\">tiff2rgba</a> utility abd then process\nit with the <a href=\"./man/tiff2ps.1.html\">tiff2ps</a>.\n\n<li> libtiff/tif_tile.c: Remove spurious use of \"s\" (sample) in the\nplanarconfig_contig case in TIFFComputeTile() as per bug 387\n\n<li> libtiff/tiffiop.h: New macros: TIFFmax and TIFFmin.\n\n<li> libtiff/{tiffio.h, tif_strip.c}: Added TIFFRawStripSize() function\nas suggested by Chris Hanson.\n\n<li> libtiff/{tif_lzw.c, tif_fax3.c}: Proper support for update mode\nas per bug 424.\n\n</UL>\n\n<P><HR WIDTH=65% ALIGN=left>\n\n<!-------------------------------------------------------------------------->\n\t\n<A NAME=\"tools\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE TOOLS:</B></A>\n\n<UL>\n\n<li> <a href=./man/tiff2pdf.1.html>tiff2pdf</a>: New tool, written by\nRoss Finlayson, to directly convert TIFF files to PDF.\n\n<li> <a href=./man/tiffgt.1.html>tiffgt</a>: Unmaintained and platform\ndependent sgigt utility removed and replaced with the completely rewritten\nportable <a href=./man/tiffgt.1.html>tiffgt</a> tool (depend on OpenGL and\nGLUT). This tool will not build by default.\n\n<li> <a href=./man/ras2tiff.1.html>ras2tiff</a>: Properly determine\nSUN Rasterfiles with the reverse byte order (it is reported by the magic\nheader field). Problem reported by Andreas Wiesmann.\n\n<li> <a href=./man/raw2tiff.1.html>raw2tiff</a>: Implemented image size\nguessing using correlation coefficient calculation between two neighbour\nlines.\n\n</UL>\n\n<P><HR WIDTH=65% ALIGN=left>\n\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"contrib\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE CONTRIB AREA:</B></A>\n<UL> \n\n<li> contrib/pds/{tif_pdsdirread.c, tif_pdsdirwrite.c}: Use TIFFDataWidth()\nfunction insted of tiffDataWidth array.\n\n</UL>\n\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"lzwkit\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE LZW COMPRESSION\nKIT:</B></A>\n<UL> \n\n<li> Proper support for update mode as per bug 424.\n\n</UL>\n\n<A HREF=\"index.html\"><IMG SRC=\"images/back.gif\"></A> TIFF home page.<BR>\n\n<HR>\n\nLast updated $Date: 2003/12/24 22:14:15 $.\n\n</BODY>\n</HTML>\n"
  },
  {
    "path": "src/main/jni/tiff/html/v3.7.0.html",
    "content": "<HTML>\n<HEAD>\n<TITLE>\n\tChanges in TIFF v3.7.0\n</TITLE>\n</HEAD>\n\n<BODY BGCOLOR=white>\n<FONT FACE=\"Helvetica, Arial, Sans\">\n<FONT FACE=\"Helvetica, Arial, Sans\"> \n\n<BASEFONT SIZE=4>\n<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>\n<BASEFONT SIZE=3>\n\n<UL>\n<HR SIZE=4 WIDTH=65% ALIGN=left>\n<B>Current Version</B>: v3.7.0<BR>\n<B>Previous Version</B>: <A HREF=v3.7.0beta2.html>v3.7.0beta2</a><BR>\n<B>Master FTP Site</B>: <A HREF=\"ftp://ftp.remotesensing.org/pub/libtiff\">\nftp.remotesensing.org</a>, directory pub/libtiff</A><BR>\n<B>Master HTTP Site</B>: <A HREF=\"http://www.remotesensing.org/libtiff\">\nhttp://www.remotesensing.org/libtiff</a> \n<HR SIZE=4 WIDTH=65% ALIGN=left>\n</UL>\n\n<P>\nThis document describes the changes made to the software between the\n<I>previous</I> and <I>current</I> versions (see above).\nIf you don't find something listed here, then it was not done in this\ntimeframe, or it was not considered important enough to be mentioned.\nThe following information is located here:\n<UL>\n<LI><A HREF=\"#hightlights\">Major Changes</A>\n<LI><A HREF=\"#configure\">Changes in the software configuration</A>\n<LI><A HREF=\"#libtiff\">Changes in libtiff</A>\n<LI><A HREF=\"#tools\">Changes in the tools</A>\n<LI><A HREF=\"#contrib\">Changes in the contrib area</A>\n<LI><A HREF=\"#lzwkit\">Changes in the LZW compression kit</A>\n</UL>\n<p> \n<P><HR WIDTH=65% ALIGN=left>\n\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"highlights\"><B><FONT SIZE=+3>M</FONT>AJOR CHANGES:</B></A>\n\n<UL>\n\n\t<li> Several bugs found after 3.7.0beta2 release were fixed.\n\n</UL>\n\n\n<P><HR WIDTH=65% ALIGN=left>\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"configure\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>\n\n<UL>\n\t<li> ltmain.sh: Fix for MinGW compilation.\n</UL>\n\n<P><HR WIDTH=65% ALIGN=left>\n\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"libtiff\"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>\n\n<UL>\n\n\t<li> libtiff/{tif_dirread.c, tif_jpeg.c, tif_luv.c, tif_ojpeg.c,\n\ttif_pixarlog.c, tif_write.c}: Handle the zero strip/tile sizes\n\tproperly (Dmitry V. Levin, Marcus Meissner).\n\n\t<li> libtiff/tif_dirinfo.c: Type of the TIFFTAG_SUBIFD field changed\n\tto TIFF_IFD.\n\t\n\t<li> Preliminary support for BigTIFF files: now libtiff can\n\trecognize and reject to open such images. ;-)\n\n\t<li> libtiff/tif_dir.c: Initialize td_tilewidth and td_tilelength fields\n\tof the TIFFDirectory structure with the 0 instead of -1 to avoid\n\tconfusing integer overflows in TIFFTileRowSize() for striped images.\n\n\t<li> libtiff/tif_dir.c: Initialize td_tilewidth and td_tilelength fields\n\tof the TIFFDirectory structure with the 0 instead of -1 to avoid\n\tconfusing integer overflows in TIFFTileRowSize() for striped images.\n\n\t<li> libtiff/tif_dirinfo.c: Fix bug with tif_foundfield and reallocation\n\tof tif_fieldinfo as per bug\n\t<A HREF=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=630\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=630</A>\n\n\t<li> libtiff/tif_compress.c: Improved error reporting in\n\tTIFFGetConfiguredCODECs() (Dmitry V. Levin).\n\n</UL>\n\n<P><HR WIDTH=65% ALIGN=left>\n\n<!-------------------------------------------------------------------------->\n\t\n<A NAME=\"tools\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE TOOLS:</B></A>\n\n<UL>\n\t<li> tiffcmp.c (leof): Renamed from 'eof' in order to avoid\n\tconflict noticed under MinGW.\n\n\t<li> tiff2pdf.c: Fixed TransferFunction tag handling reported\n\tby Ross A. Finlayson.\n\n</UL>\n\n<P><HR WIDTH=65% ALIGN=left>\n\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"contrib\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE CONTRIB AREA:</B></A>\n\n<UL> \n\n\t<li> No changes.\n\n</UL>\n\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"lzwkit\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE LZW COMPRESSION\nKIT:</B></A>\n<UL> \n\n\t<li> This one is not longer needed.\n\n</UL>\n\n<A HREF=\"index.html\"><IMG SRC=\"images/back.gif\"></A> TIFF home page.<BR>\n\n<HR>\n\nLast updated $Date: 2004/12/20 19:31:44 $.\n\n</BODY>\n</HTML>\n"
  },
  {
    "path": "src/main/jni/tiff/html/v3.7.0alpha.html",
    "content": "<HTML>\n<HEAD>\n<TITLE>\n\tChanges in TIFF v3.7.0alpha\n</TITLE>\n</HEAD>\n\n<BODY BGCOLOR=white>\n<FONT FACE=\"Helvetica, Arial, Sans\">\n<FONT FACE=\"Helvetica, Arial, Sans\"> \n\n<BASEFONT SIZE=4>\n<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>\n<BASEFONT SIZE=3>\n\n<UL>\n<HR SIZE=4 WIDTH=65% ALIGN=left>\n<B>Current Version</B>: v3.7.0alpha<BR>\n<B>Previous Version</B>: <A HREF=v3.6.1.html>v3.6.1</a><BR>\n<B>Master FTP Site</B>: <A HREF=\"ftp://ftp.remotesensing.org/pub/libtiff\">\nftp.remotesensing.org</a>, directory pub/libtiff</A><BR>\n<B>Master HTTP Site</B>: <A HREF=\"http://www.remotesensing.org/libtiff\">\nhttp://www.remotesensing.org/libtiff</a> \n<HR SIZE=4 WIDTH=65% ALIGN=left>\n</UL>\n\n<P>\nThis document describes the changes made to the software between the\n<I>previous</I> and <I>current</I> versions (see above).\nIf you don't find something listed here, then it was not done in this\ntimeframe, or it was not considered important enough to be mentioned.\nThe following information is located here:\n<UL>\n<LI><A HREF=\"#hightlights\">Major Changes</A>\n<LI><A HREF=\"#configure\">Changes in the software configuration</A>\n<LI><A HREF=\"#libtiff\">Changes in libtiff</A>\n<LI><A HREF=\"#tools\">Changes in the tools</A>\n<LI><A HREF=\"#contrib\">Changes in the contrib area</A>\n<LI><A HREF=\"#lzwkit\">Changes in the LZW compression kit</A>\n</UL>\n<p> \n<P><HR WIDTH=65% ALIGN=left>\n\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"highlights\"><B><FONT SIZE=+3>M</FONT>AJOR CHANGES:</B></A>\n\n<ul>\n\t<li> Significant changes in software configuration: we are switched\n\tto GNU autotools now.\n\t\n\t<li> tiffset: tiffset now can set any libtiff supported tags. Tags\n\tcan be supplied by the mnemonic name or number.\n</ul>\n\n\n<P><HR WIDTH=65% ALIGN=left>\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"configure\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>\n\n<UL>\n\t<li> Get rid of the old configuration system and switch to\n\tGNU autotools.\n</UL>\n\n<P><HR WIDTH=65% ALIGN=left>\n\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"libtiff\"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>\n\n<UL>\n\t<li> libtiff/tif_ojpeg.c: Fixed problem with duplicated SOI and SOF\n\tmarkers as per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=581\"\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=581</a>.\n\n\t<li> libtiff/{tif_open.c, tiffio.h}: New function added:\n\tTIFFIsBigEndian(). Function returns nonzero if given was file written\n\tin big-endian order.\n\n\t<li> libtiff/tif_print.c: added (untested) support for printing\n\tSSHORT, SLONG and SRATIONAL fields.\n\n\t<li> libtiff/tif_fax3.c: Avoid reading CCITT compression options\n\tif compression type mismatches. See\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=565\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=565</a>.\n\n\t<li> libtiff/tif_strip.c: Never return 0 from the TIFFNumberOfStrips().\n\n\t<li> libtiff/tif_dirread.c: Workaround for broken TIFF writers which\n\tstore single SampleFormat value for multisampled images. See\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=562\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=562</a>.\n\n\t<li> libtiff/tif_write.c: Allow in-place updating of the compressed\n\timages (don't work properly with all codecs). For details see GDAL bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=534\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=534</a>.\n\n\t<li> libtiff/tif_jpeg.c: Workaround for wrong sampling factors used\n\tin the Intergarph JPEG compressed TIFF images as per bug:\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=532\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=532</a>.\n\n\t<li> libtiff/tif_open.c: Use dummy mmap/munmap functions in\n\tTIFFClientOpen() when the appropriate client functions was not\n\tsupplied by user.\n\n\t<li> libtiff/tif_dirread.c: Fixed problem with handling TIFF_UNDEFINED\n\ttag type in TIFFFetchNormalTag() as per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=508\"\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=508</a>.\n\n\t<li> libtiff/tif_codec.c: Fixed typo in TIFFInitPackBits name as per:\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=494\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=494</a>.\n\n\t<li> libtiff/tif_fax3.c: Fixed problem, introdiced in 3.6.1 release,\n\twith the CCITT encoding modes as per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=483\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=483</a>.\n        We need more work on fax codec to support update mode.\n\n\t<li> libtiff/tiff.h: Fixed tag definitions for TIFFTAG_YCLIPPATHUNITS\n\tand TIFFTAG_INDEXED as per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=475\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=475</a>.\n\n\t<li> libtiff/{tif_win32.c, tif_unix.c}: Check whether the pointer is\n\tNULL before proceeding further as per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=474\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=474</a>.\n\tCheck results, returned by the TIFFFdOpen() before returning and close\n\tfile if TIFFFdOpen() failed as per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=468\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=468</a>.\n\n\t<li> libtiff/{libtiff.def, tif_close.c, tiffio.h, tif_open.c}:\n\tSeparate TIFFCleanup() from the TIFFClose() in order to fix the bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=468\">\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=468</a>.\n\n\t<li> libtiff/tif_dirwrite.c: Fixed handling of writable ASCII tags\n\tthat are field_passcount=TRUE properly.  Arguably anonymous custom\n\ttags should be declared as passcount=FALSE, but I don't want to change\n\tthat without a careful review.\n\n\t<li> libtiff/tif_write.c: Fixed reporting size of the buffer in case\n\tof stripped image in TIFFWriteBufferSetup(). As per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=460\">\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=460</a>.\n\t\t\t\t\n\t<li> libtiff/tif_dir.c: Incomplete cleanup in TIFFFreeDirectory(),\n\tpatch from Gerben Koopmans.\n\n\t<li> libtiff/tif_dirread.c: Check field_passcount value before setting\n\tthe value of undefined type, patch from Gerben Koopmans.\t\t\n\n\t<li> libtiff/{tiff.h, tif_fax3.c}:Fixes for AMD 64 platform as\n\tsuggested by Jeremy C. Reed.\t\t\t\n\n\t<li> libtiff/tif_win32.c: Fixed problem with _TIFFrealloc() when\n\tthe NULL pointer passed. Patch supplied by Larry Grill.\n\n</UL>\n\n<P><HR WIDTH=65% ALIGN=left>\n\n<!-------------------------------------------------------------------------->\n\t\n<A NAME=\"tools\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE TOOLS:</B></A>\n\n<UL>\n\t<li> tiffset: tiffset now can set any libtiff supported tags. Tags\n\tcan be supplied by the mnemonic name or number.\n\n\t<li> ycbcr.c: fixed main() declaration as per:\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=513\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=513</a>.\n\n\t<li> <a href=./man/tiffsplit.1.html>tiffsplit</a>: Don't forget\n\tto copy Photometric Interpretation tag.\n\t\n\t<li> <a href=./man/tiffsplit.1.html>tiffsplit</a>: Fixed problem with\n\tunproperly written multibyte files. Now output files will be written\n\tusing the same byte order flag as in the input image. See\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=574\"\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=574</a>.\n\n\t<li> <a href=./man/tiffsplit.1.html>tiffsplit</a>: Copy JPEGTables\n\ttag contents for JPEG compressed images. Reported by Artem Mirolubov.\n\n\t<li> <a href=./man/tiffcp.1.html>tiffcp</a>: Close output file\n\ton normal exit.\n\t\n\t<li> <a href=./man/tiffcp.1.html>tiffcp</a>: Don't emit warnings\n\twhen Orientation tag does not present in the input image.\n\t\n\t<li> <a href=./man/tiffcp.1.html>tiffcp</a>: Properly set\n\tPhotometric Interpretation in case of JPEG compression of grayscale\n\timages.\n\t\n\t<li> <a href=./man/tiffcp.1.html>tiffcp</a>: Fixed problem with wrong\n\tinterpretation of the InkNames tag as per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=466\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=466</a>.\n\tMemory leak fixed.\n\n\t<li> <a href=./man/tiffcp.1.html>tiffcp</a>: Fixed problem with\n\twrong Photometric setting for non-RGB images.\n\n</UL>\n\n<P><HR WIDTH=65% ALIGN=left>\n\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"contrib\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE CONTRIB AREA:</B></A>\n\n<UL> \n\n\t<li> Outdated stuff removed.\n\n\t<li> Almost all programs are sinchronized with the current libtiff\n\tand should compile without problems.\n\n</UL>\n\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"lzwkit\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE LZW COMPRESSION\nKIT:</B></A>\n<UL> \n\n<li> No changes.\n\n</UL>\n\n<A HREF=\"index.html\"><IMG SRC=\"images/back.gif\"></A> TIFF home page.<BR>\n\n<HR>\n\nLast updated $Date: 2006/03/18 17:12:47 $.\n\n</BODY>\n</HTML>\n"
  },
  {
    "path": "src/main/jni/tiff/html/v3.7.0beta.html",
    "content": "<HTML>\n<HEAD>\n<TITLE>\n\tChanges in TIFF v3.7.0beta\n</TITLE>\n</HEAD>\n\n<BODY BGCOLOR=white>\n<FONT FACE=\"Helvetica, Arial, Sans\">\n<FONT FACE=\"Helvetica, Arial, Sans\"> \n\n<BASEFONT SIZE=4>\n<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>\n<BASEFONT SIZE=3>\n\n<UL>\n<HR SIZE=4 WIDTH=65% ALIGN=left>\n<B>Current Version</B>: v3.7.0beta<BR>\n<B>Previous Version</B>: <A HREF=v3.7.0alpha.html>v3.7.0alpha</a><BR>\n<B>Master FTP Site</B>: <A HREF=\"ftp://ftp.remotesensing.org/pub/libtiff\">\nftp.remotesensing.org</a>, directory pub/libtiff</A><BR>\n<B>Master HTTP Site</B>: <A HREF=\"http://www.remotesensing.org/libtiff\">\nhttp://www.remotesensing.org/libtiff</a> \n<HR SIZE=4 WIDTH=65% ALIGN=left>\n</UL>\n\n<P>\nThis document describes the changes made to the software between the\n<I>previous</I> and <I>current</I> versions (see above).\nIf you don't find something listed here, then it was not done in this\ntimeframe, or it was not considered important enough to be mentioned.\nThe following information is located here:\n<UL>\n<LI><A HREF=\"#hightlights\">Major Changes</A>\n<LI><A HREF=\"#configure\">Changes in the software configuration</A>\n<LI><A HREF=\"#libtiff\">Changes in libtiff</A>\n<LI><A HREF=\"#tools\">Changes in the tools</A>\n<LI><A HREF=\"#contrib\">Changes in the contrib area</A>\n<LI><A HREF=\"#lzwkit\">Changes in the LZW compression kit</A>\n</UL>\n<p> \n<P><HR WIDTH=65% ALIGN=left>\n\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"highlights\"><B><FONT SIZE=+3>M</FONT>AJOR CHANGES:</B></A>\n\n<ul>\n\t<li> LZW compression enabled by default. You don't need the separate\n\tcompression kit anymore.\n\n\t<li> bmp2tiff: Added new utility to convert Windows BMP files\n\tinto TIFFs.\n\n\t<li> The first attempt to implement a test suite.\n</ul>\n\n\n<P><HR WIDTH=65% ALIGN=left>\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"configure\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>\n\n<UL>\n\t<li> Many portability fixes in the new autotooled build suite.\n</UL>\n\n<P><HR WIDTH=65% ALIGN=left>\n\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"libtiff\"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>\n\n<UL>\n\t<li> libtiff/{tif_luv.c, tif_next.c, tif_thunder.c}: Several buffer\n\toverruns fixed, as noted by Chris Evans.\n\n\t<li> BSD data types (u_char, u_short, u_int, u_long) is no longer\n\tused internally in the libtiff. Should result in simpler configuration\n\tand better portability.\n\n\t<li> libtiff/tiff.h: Fix column tagging. Reference current Adobe XMP\n\tspecification. Reference libtiff bug tracking system to submit\n\tprivate tag additions.\n\n\t<li> libtiff/tif_dirread.c: Don't reject to read tags of the\n\tSamplesPerPixel size when the tag count is greater than number of\n\tsamples as per bug\n\t<A HREF=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=576\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=576</A>.\n\n\t<li> libtiff/{tiffio.h, tif_open.c}: Applied patches from\n\tJoris Van Damme\tto avoid requirement for tiffiop.h inclusion in\n\tsome applications. Look for details here:\n\t<A HREF=\"http://www.asmail.be/msg0054799560.html\">\n\t\thttp://www.asmail.be/msg0054799560.html</A>.\n\n\t<li> libtiff/{tiffiop.h, tif_dirinfo.c}: Fixed problem with the static\n\tvariable as per bug\n\t<A HREF=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=593\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=593</A>.\n\t\n\t<li> libtiff/tif_lzw.c: LZW compression code is merged back from the\n\tseparate package. All libtiff tools are updated to not advertise an\n\tabcence of LZW support.\n\n\t<li> libtiff/tif_dir.c: Call TIFFError() instead of producing warnings\n\twhen setting custom tags by value. Reported by Eric Fieleke.\n\n</UL>\n\n<P><HR WIDTH=65% ALIGN=left>\n\n<!-------------------------------------------------------------------------->\n\t\n<A NAME=\"tools\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE TOOLS:</B></A>\n\n<UL>\n\t<li> tiff2ps: Avoid zero division in setupPageState() function;\n\tproperly initialize array in PSDataBW().\n\n\t<li> tiff2pdf: Multiple bugfixes.\n\n\t<li> ras2tiff:  Fixed issue with missed big-endian checks as per bug\n\t</A HREF=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=586\">\n\t\t http://bugzilla.remotesensing.org/show_bug.cgi?id=586</A>.\n\n\t<li> bmp2tiff: Added new utility to convert Windows BMP files\n\tinto TIFFs.\n\n</UL>\n\n<P><HR WIDTH=65% ALIGN=left>\n\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"contrib\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE CONTRIB AREA:</B></A>\n\n<UL> \n\n\t<li> No changes.\n\n</UL>\n\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"lzwkit\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE LZW COMPRESSION\nKIT:</B></A>\n<UL> \n\n\t<li> This one is not longer needed.\n\n</UL>\n\n<A HREF=\"index.html\"><IMG SRC=\"images/back.gif\"></A> TIFF home page.<BR>\n\n<HR>\n\nLast updated $Date: 2006/03/18 17:12:47 $.\n\n</BODY>\n</HTML>\n"
  },
  {
    "path": "src/main/jni/tiff/html/v3.7.0beta2.html",
    "content": "<HTML>\n<HEAD>\n<TITLE>\n\tChanges in TIFF v3.7.0beta2\n</TITLE>\n</HEAD>\n\n<BODY BGCOLOR=white>\n<FONT FACE=\"Helvetica, Arial, Sans\">\n<FONT FACE=\"Helvetica, Arial, Sans\"> \n\n<BASEFONT SIZE=4>\n<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>\n<BASEFONT SIZE=3>\n\n<UL>\n<HR SIZE=4 WIDTH=65% ALIGN=left>\n<B>Current Version</B>: v3.7.0beta2<BR>\n<B>Previous Version</B>: <A HREF=v3.7.0beta.html>v3.7.0beta</a><BR>\n<B>Master FTP Site</B>: <A HREF=\"ftp://ftp.remotesensing.org/pub/libtiff\">\nftp.remotesensing.org</a>, directory pub/libtiff</A><BR>\n<B>Master HTTP Site</B>: <A HREF=\"http://www.remotesensing.org/libtiff\">\nhttp://www.remotesensing.org/libtiff</a> \n<HR SIZE=4 WIDTH=65% ALIGN=left>\n</UL>\n\n<P>\nThis document describes the changes made to the software between the\n<I>previous</I> and <I>current</I> versions (see above).\nIf you don't find something listed here, then it was not done in this\ntimeframe, or it was not considered important enough to be mentioned.\nThe following information is located here:\n<UL>\n<LI><A HREF=\"#hightlights\">Major Changes</A>\n<LI><A HREF=\"#configure\">Changes in the software configuration</A>\n<LI><A HREF=\"#libtiff\">Changes in libtiff</A>\n<LI><A HREF=\"#tools\">Changes in the tools</A>\n<LI><A HREF=\"#contrib\">Changes in the contrib area</A>\n<LI><A HREF=\"#lzwkit\">Changes in the LZW compression kit</A>\n</UL>\n<p> \n<P><HR WIDTH=65% ALIGN=left>\n\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"highlights\"><B><FONT SIZE=+3>M</FONT>AJOR CHANGES:</B></A>\n\n<UL>\n\n\t<li> The code has been reviewed by Dmitry Levin: added checks\n\tfor values, returned by the space allocation functions, fixed\n\tproblems with the possible integer overflows.\n\n</UL>\n\n\n<P><HR WIDTH=65% ALIGN=left>\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"configure\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>\n\n<UL>\n\t<li> Several fixes in the test suite.\n</UL>\n\n<P><HR WIDTH=65% ALIGN=left>\n\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"libtiff\"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>\n\n<UL>\n\n\t<li> Preliminary support for BigTIFF files: now libtiff can\n\trecognize and reject to open such images. ;-)\n\n\t<li> libtiff/tif_dirinfo.c: changed type of XMLPacket (tag 700) to \n\tTIFFTAG_BYTE instead of TIFFTAG_UNDEFINED to comply with the info\n\tin the Adobe XMP Specification.\n\n\t<li> Added many checks for integer overflow and for successful space\n\tallocations in the different parts of library. Code review\n\tcompleted by Dmitry V. Levin.\n\n\t<li> libtiff/{tiffio.h, tif_compress.c}: Added\n\tTIFFGetConfiguredCODECs()function to get the list of configured codecs.\n\n</UL>\n\n<P><HR WIDTH=65% ALIGN=left>\n\n<!-------------------------------------------------------------------------->\n\t\n<A NAME=\"tools\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE TOOLS:</B></A>\n\n<UL>\n\t<li> tiff2bw: Write ImageWidth/Height tags to output file, as\n\tnoted by Gennady Khokhorin.\n\n</UL>\n\n<P><HR WIDTH=65% ALIGN=left>\n\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"contrib\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE CONTRIB AREA:</B></A>\n\n<UL> \n\n\t<li> No changes.\n\n</UL>\n\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"lzwkit\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE LZW COMPRESSION\nKIT:</B></A>\n<UL> \n\n\t<li> This one is not longer needed.\n\n</UL>\n\n<A HREF=\"index.html\"><IMG SRC=\"images/back.gif\"></A> TIFF home page.<BR>\n\n<HR>\n\nLast updated $Date: 2006/03/18 17:12:47 $.\n\n</BODY>\n</HTML>\n"
  },
  {
    "path": "src/main/jni/tiff/html/v3.7.1.html",
    "content": "<HTML>\n<HEAD>\n<TITLE>\n\tChanges in TIFF v3.7.1\n</TITLE>\n</HEAD>\n\n<BODY BGCOLOR=white>\n<FONT FACE=\"Helvetica, Arial, Sans\">\n<FONT FACE=\"Helvetica, Arial, Sans\"> \n\n<BASEFONT SIZE=4>\n<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>\n<BASEFONT SIZE=3>\n\n<UL>\n<HR SIZE=4 WIDTH=65% ALIGN=left>\n<B>Current Version</B>: v3.7.1<BR>\n<B>Previous Version</B>: <A HREF=v3.7.0.html>v3.7.0</a><BR>\n<B>Master FTP Site</B>: <A HREF=\"ftp://ftp.remotesensing.org/pub/libtiff\">\nftp.remotesensing.org</a>, directory pub/libtiff</A><BR>\n<B>Master HTTP Site</B>: <A HREF=\"http://www.remotesensing.org/libtiff\">\nhttp://www.remotesensing.org/libtiff</a> \n<HR SIZE=4 WIDTH=65% ALIGN=left>\n</UL>\n\n<P>\nThis document describes the changes made to the software between the\n<I>previous</I> and <I>current</I> versions (see above).\nIf you don't find something listed here, then it was not done in this\ntimeframe, or it was not considered important enough to be mentioned.\nThe following information is located here:\n<UL>\n<LI><A HREF=\"#hightlights\">Major Changes</A>\n<LI><A HREF=\"#configure\">Changes in the software configuration</A>\n<LI><A HREF=\"#libtiff\">Changes in libtiff</A>\n<LI><A HREF=\"#tools\">Changes in the tools</A>\n<LI><A HREF=\"#contrib\">Changes in the contrib area</A>\n</UL>\n<p> \n<P><HR WIDTH=65% ALIGN=left>\n\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"highlights\"><B><FONT SIZE=+3>M</FONT>AJOR CHANGES:</B></A>\n\n<UL>\n\n\t<li> This is mostly bugfix release. Most important fix is the one\n\trelated to wrong custom tag read/write code.\n\n</UL>\n\n\n<P><HR WIDTH=65% ALIGN=left>\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"configure\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>\n\n<UL>\n\n\t<li> autogen.sh: aclocal and autoheader should be executed after\n\tlibtoolize.  Also add '-I .' to aclocal invocation to check\n\tcurrent directory for macros.\n\n\t<li> nmake.opt: Link with the user32.lib in windowed mode. As per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=697\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=697</a>\n\n\t<li> nmake.opt, makefile.vc: make it easier to rename the libtiff DLL.\n\n\t<li> configure, configure.ac: Added --enable-rpath option to embed\n\tlinker paths into library binary.\n\n</UL>\n\n<P><HR WIDTH=65% ALIGN=left>\n\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"libtiff\"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>\n\n<UL>\n\n\t<li> tiff.h: Revert back libtiff data type definitions as per\n\tbug <a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=687\">\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=687</a>\n\n\t<li> tif_dirread.c: Do not forget about TIFF_VARIABLE2 when\n\tchecking for tag count in TIFFReadDirectory() function. As per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=713\">\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=713</a>\n\n\t<li> tif_getimage.c: Support for multiple-alpha-channelled\n\tRGB-images as per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=718\">\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=718</a>\n\n\t<li> tif_getimage.c: #define A1 bracketing for clean build on\n\tSunPro compiler.\n\n\t<li> tif_dirwrite.c: Always write TIFFTAG_SUBIFD using LONG type\n\tas per bugs\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=703\">\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=703</a> and\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=704\">\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=704</a>.\n\n\t<li> tif_win32.c: Use char* strings instead of TCHAR in windowed\n\tmode as per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=697\">\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=697</a>\n\n\t<li> tif_dir.c, tif_dirread.c: Remove TIFFReassignTagToIgnore()\n\tcall from the TIFFReadDirectory() function. TIFFReassignTagToIgnore\n\tmust be removed in the future, as it was never used properly. As per\n\tbug <a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=692\">\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=692</a>\n\n\t<li> tif_jpeg.c: Added a work-around in order to allow\n\tcompilation with the heavily modified version of libjpeg delivered\n\twith Cygwin.\n\n\t<li> tif_dir.c: Properly handle tags, which have the uint32\n\tcounts. As per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=693\">\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=693</a>\n\n\t<li> tif_unix.c: Make UNIX module compilable (and usable)\n\ton Windows.\n\n\t<li> tiff.h: Added Adobe DNG tags.\n\n\t<li> tif_aux.c: Set the appropriate ReferenceBlackWhite array for\n\tYCbCr image which lacks that tag (noted by Hans Petter Selasky).\n\n\t<li> tif_color.c: Division by zero fixed (Hans Petter Selasky).\n\n\t<li> tif_stream.cxx, tiffio.h: Added C++ stream interface\n\tcontributed by Edward Lam (see\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=654\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=654</a>\n\tfor details). Those who want to use C++ streams should\n\t#include <tiffio.hxx>.\n\n\t<li> tif_open.c: Removed close() in TIFFClientOpen() if file\n\tis bad. This is the callers responsibility.\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=651\">\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=651</a>\n\n\t<li> tiffio.h, tif_win32.c, libtiff.def}: Added TIFFOpenW()\n\tfunction to work with the double byte strings (used to represent\n\tfilenames in some locales). As per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=625\">\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=625</a>\n\n\t<li> tif_dirread.c: Fixed problem when fetching BitsPerSample and\n\tCompression tags of type LONG from broken TIFFS as per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=662\">\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=662</a>\n\n\t<li> tif_dirinfo.c: Fixed definition for TIFFTAG_RICHTIFFIPTC,\n\tthe writecount should have uint32 type. As per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=662\">\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=662</a>\n\n\t<li> tif_write.c: Fixed wrong if() statement in\n\tTIFFAppendToStrip() function as per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=660\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=660</a>\n\n\t<li> tif_dirinfo.c: Change definition for TIFFTAG_EXTRASAMPLES\n\tfield. The caller should supply a count when setting this field. As\n\tper bug <a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=648\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=648</a>. \n\n\t<li> tif_jpeg.c, tif_ojpeg.c: TIFFTAG_JPEGTABLES should have\n\tuint32 count. Use this type everywhere.\n\n\t<li> tif_next.c: avoid use of u_long and u_char types.\n\n\t<li> tif_fax3.c: Fixed case with the wrong decode routines\n\tchoosing when the incorrect Group4Options tag set. As per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=323\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=323</a>\n\n\t<li> tif_dirwrite.c: Fixed problem with passing count variable of\n\twrong type when writing the TIFF_BYTE/TIFF_SBYTE tags in\n\tTIFFWriteNormalTag().\n\n\t<li> tif_compress.c: Zero division problem fixed (Vladimir Nadvornik,\n\tDmitry V. Levin).\n\n</UL>\n\n<P><HR WIDTH=65% ALIGN=left>\n\n<!-------------------------------------------------------------------------->\n\t\n<A NAME=\"tools\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE TOOLS:</B></A>\n\n<UL>\n\n\t<li> fax2ps.c: Be able to extract the first page (#0). As per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=690\">\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=690</a>\n\n\t<li> tiff2ps.c: Fixed wrong variable data type when read Position\n\ttags (Tristan Hill).\n\n\t<li> tiff2ps.c: Fixed wrong variable data type when read Resolution\n\ttags (Peter Fales).\n\n\t<li> tiffset.c: Check the malloc return value (Dmitry V. Levin).\n\n</UL>\n\n<P><HR WIDTH=65% ALIGN=left>\n\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"contrib\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE CONTRIB AREA:</B></A>\n\n<UL> \n\n\t<li> No changes.\n\n</UL>\n\nLast updated $Date: 2004/12/20 19:31:44 $.\n\n</BODY>\n</HTML>\n"
  },
  {
    "path": "src/main/jni/tiff/html/v3.7.2.html",
    "content": "<HTML>\n<HEAD>\n<TITLE>\n\tChanges in TIFF v3.7.2\n</TITLE>\n</HEAD>\n\n<BODY BGCOLOR=white>\n<FONT FACE=\"Helvetica, Arial, Sans\">\n<FONT FACE=\"Helvetica, Arial, Sans\"> \n\n<BASEFONT SIZE=4>\n<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>\n<BASEFONT SIZE=3>\n\n<UL>\n<HR SIZE=4 WIDTH=65% ALIGN=left>\n<B>Current Version</B>: v3.7.2<BR>\n<B>Previous Version</B>: <A HREF=v3.7.1.html>v3.7.1</a><BR>\n<B>Master FTP Site</B>: <A HREF=\"ftp://ftp.remotesensing.org/pub/libtiff\">\nftp.remotesensing.org</a>, directory pub/libtiff</A><BR>\n<B>Master HTTP Site</B>: <A HREF=\"http://www.remotesensing.org/libtiff\">\nhttp://www.remotesensing.org/libtiff</a> \n<HR SIZE=4 WIDTH=65% ALIGN=left>\n</UL>\n\n<P>\nThis document describes the changes made to the software between the\n<I>previous</I> and <I>current</I> versions (see above).\nIf you don't find something listed here, then it was not done in this\ntimeframe, or it was not considered important enough to be mentioned.\nThe following information is located here:\n<UL>\n<LI><A HREF=\"#hightlights\">Major Changes</A>\n<LI><A HREF=\"#configure\">Changes in the software configuration</A>\n<LI><A HREF=\"#libtiff\">Changes in libtiff</A>\n<LI><A HREF=\"#tools\">Changes in the tools</A>\n<LI><A HREF=\"#contrib\">Changes in the contrib area</A>\n</UL>\n<p> \n<P><HR WIDTH=65% ALIGN=left>\n\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"highlights\"><B><FONT SIZE=+3>M</FONT>AJOR CHANGES:</B></A>\n\n<UL>\n\n\t<li> Maintainance release. Many bugfixes in the build environment\n\tand compatibility improvements.\n\n</UL>\n\n\n<P><HR WIDTH=65% ALIGN=left>\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"configure\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>\n\n<UL>\n\t<li> configure.ac: Use -rpath option instead of -R as per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=732\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=732</a>\n\n\t<li> tif_stream.cxx: Fixes for C++ stream interface from\n\tMichael Rinne and Edward Lam.\n\n\t<li> configure.ac: Make the documentation directory location\n\tconfigurable via the --with-docdir option (as suggested by\n\tJeremy C. Reed).\n\n\t<li> Place the C++ stream API in the separate library called\n\tlibtiffxx to avoid unneeded dependencies. Probably there will be\n\tmore C++ API in the future. As per bugs\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=733\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=733</a>\n\tand <a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=730\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=730</a>\n\t\n\t<li> configure, configure.ac: Replace --disable-c++ with the\n\t--disable-cxx option as\tper bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=730\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=730</a>.\n\n</UL>\n\n<P><HR WIDTH=65% ALIGN=left>\n\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"libtiff\"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>\n\n<UL>\n\n\t<li> Applied patch from Lee Howard to support a new tag TIFFTAG_FAXDCS\n\t(34911) used in HylaFax software. As per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=771\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=771</a>\n\n\t<li> tif_open.c: Remove unnesessary TIFFSeekFile() call as per\n\tbug <a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=756\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=756</a>\n\n\t<li> tiff.h: Changed the int8 definition to be always signed char\n\tas per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=727\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=727</a>\n\n\t<li> tiffio.h: Move TIFFOpenW() function into the extern \"C\"{}\n\tblock as per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=763\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=763</a>\n\n\t<li> tif_dirread.c: Estimate strip size in case of wrong or\n\tsuspicious values in the tags. As per bugs\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=705\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=705</a>\n\tand <a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=320\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=320</a>\n\n\t<li> tif_color.c: Use double as the second argument of pow()\n\tfunction in TIFFCIELabToRGBInit(). As per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=741\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=741</a>\n\n\t<li> tif_pixarlog.c: Avoid warnings when converting float to\n\tinteger as per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=740\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=740</a>\n\n\t<li> tif_getimage.c: Always fill the error message buffer in\n\tTIFFRGBAImageBegin() as per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=739\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=739</a>\n\n\t<li> tif_jpeg.c: Added ability to read/write the fax specific\n\tTIFFTAG_FAXRECVPARAMS, TIFFTAG_FAXSUBADDRESS and TIFFTAG_FAXRECVTIME\n\ttags as per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=736\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=736</a>\n\n\t<li> tif_win32.c: Fixed message formatting in functions\n\tWin32WarningHandler() and Win32ErrorHandler() as per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=735\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=735</a>\n\n\t<li> tiffio.h: Move the color conversion routines in the 'extern\n\t\"C\"' section as per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=727\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=727</a>\n\n\t<li> tiff.h: Restore back the workaround for AIX Visual Age C\n\tcompiler to avoid double definition of BSD types as per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=39\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=39</a>\n\n\t<li> tif_getimage.c: More fixes for multiple-alpha-channelled\n\tRGB-images as per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=713\">\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=713</a>\n\n</UL>\n\n<P><HR WIDTH=65% ALIGN=left>\n\n<!-------------------------------------------------------------------------->\n\t\n<A NAME=\"tools\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE TOOLS:</B></A>\n\n<UL>\n\n\t<li> tiffcmp.c: Added ability to compare the 32-bit integer and\n\tfloating point data; complain on unsupported bit depths.\n\n\t<li> tiffcmp.c: Use properly sized buffer in short arrays comparison\n\tas per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=785\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=785</a>\n\n\t<li> fax2ps.c: Replace insecure mktemp() function with the\n\ttmpfile() as per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=786\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=786</a>\n\n\t<li> tiffgt.c: Fix problem on big-endian CPUs so that images\n\tdisplay more correctly.  Images display brighter than they should\n\ton a Sun workstation.\n\n\t<li> tiff2ps.c: Fixed problem with page sizes as per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=742\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=742</a>\n\n\t<li> tiff2ps.c: Interpret the -w and -h options independently. As\n\tper bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=689\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=689</a>\n\n\t<li> tiffdump.c: Fixed problem when read broken TIFFs with the\n\twrong tag counts (Dmitry V. Levin, Martin Pitt).\n\n\t<li> tiffset.c: Convert character option to integer value as per\n\tbug <a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=725\">\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=725</a>.\n\n</UL>\n\n<P><HR WIDTH=65% ALIGN=left>\n\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"contrib\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE CONTRIB AREA:</B></A>\n\n<UL> \n\n\t<li> No changes.\n\n</UL>\n\nLast updated $Date: 2005/03/15 15:17:44 $.\n\n</BODY>\n</HTML>\n"
  },
  {
    "path": "src/main/jni/tiff/html/v3.7.3.html",
    "content": "<HTML>\n<HEAD>\n<TITLE>\n\tChanges in TIFF v3.7.3\n</TITLE>\n</HEAD>\n\n<BODY BGCOLOR=white>\n<FONT FACE=\"Helvetica, Arial, Sans\">\n<FONT FACE=\"Helvetica, Arial, Sans\"> \n\n<BASEFONT SIZE=4>\n<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>\n<BASEFONT SIZE=3>\n\n<UL>\n<HR SIZE=4 WIDTH=65% ALIGN=left>\n<B>Current Version</B>: v3.7.3<BR>\n<B>Previous Version</B>: <A HREF=v3.7.2.html>v3.7.2</a><BR>\n<B>Master FTP Site</B>: <A HREF=\"ftp://ftp.remotesensing.org/pub/libtiff\">\nftp.remotesensing.org</a>, directory pub/libtiff</A><BR>\n<B>Master HTTP Site</B>: <A HREF=\"http://www.remotesensing.org/libtiff\">\nhttp://www.remotesensing.org/libtiff</a> \n<HR SIZE=4 WIDTH=65% ALIGN=left>\n</UL>\n\n<P>\nThis document describes the changes made to the software between the\n<I>previous</I> and <I>current</I> versions (see above).\nIf you don't find something listed here, then it was not done in this\ntimeframe, or it was not considered important enough to be mentioned.\nThe following information is located here:\n<UL>\n<LI><A HREF=\"#hightlights\">Major Changes</A>\n<LI><A HREF=\"#configure\">Changes in the software configuration</A>\n<LI><A HREF=\"#libtiff\">Changes in libtiff</A>\n<LI><A HREF=\"#tools\">Changes in the tools</A>\n<LI><A HREF=\"#contrib\">Changes in the contrib area</A>\n</UL>\n<p> \n<P><HR WIDTH=65% ALIGN=left>\n\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"highlights\"><B><FONT SIZE=+3>M</FONT>AJOR CHANGES:</B></A>\n\n<UL>\n\t<li> Replace runtime endianess check with the compile time one.\n\n\t<li> Added support for the new predictor type (floating point\n\tpredictor), defined at the TIFF Technical Note 3.\n\n\t<li> Added Support for custom tags, passed by value.\n\tAdded support for all DNG tags.\n</UL>\n\n\n<P><HR WIDTH=65% ALIGN=left>\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"configure\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>\n\n<UL>\n\t<li> Do not use empty -R option when linking with --enable-rpath.\n\n\t<li> Added workaround for OpenBSD/MirOS soname problem as per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=838\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=838</a>\n\n\t<li> Fixed parallel compilation of the libtiff and\n\tlibtiffxx libraries as per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=826\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=826</a>\n\n\t<li> configure.ac, libtiff/Makefile.am: Use libtool machinery to pass\n\trpath option.\n\n\t<li> make.opt: Build with Win32 CRT library by default.\n</UL>\n\n<P><HR WIDTH=65% ALIGN=left>\n\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"libtiff\"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>\n\n<UL>\n\t<li> tiffiop.h, tif_open.c: Added open option 'h' to avoid reading\n\tthe first IFD when needed. As per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=875\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=875</a>\n\n\t<li> tiff.h: Use correct int size on Sparc 64bit/Sun compiler\n\tplatform. As per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=855\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=855</a>\n\n\t<li> tif_dirinfo.c: Added support for ClipPath, XClipPathUnits\n\tand YClipPathUnits tags.\n\n\t<li> tif_dirinfo.c, tif_dir.h, tif_dir.c, tif_print.c: Make\n\tDocumentName, Artist, HostComputer, ImageDescription, Make, Model,\n\tCopyright, DateTime, PageName, TextureFormat, TextureWrapModes and\n\tTargetPrinter tags custom.\n\n\t<li> tif_jpeg.c: Cleanup the codec state depending on TIFF_CODERSETUP\n\tflag (to fix memory leaks).\n\n\t<li> tif_dirwrite.c: Use tdir_count when calling\n\tTIFFCvtNativeToIEEEDouble() in the TIFFWriteDoubleArray() function as\n\tper bug <a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=845\">\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=845</a>\n\n\t<li> tif_dirinfo.c, tif_print.c: TIFFFetchByteArray() returns\n\tuint16 array when fetching the BYTE and SBYTE fields, so we should\n\tconsider result as pointer to uint16 array and not as array of chars.\n\tAs per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=831\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=831</a>\n\n\t<li> tif_dir.c: More efficient custom tags retrieval as per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=830\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=830</a>\n\n\t<li> tif_win32.c: Use FILE_SHARE_READ | FILE_SHARE_WRITE share\n\tmode in CreateFile() call as per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=829\">\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=829</a>\n\n\t<li> tif_jpeg.c: Substantial fix for addtiffo problems with\n\tJPEG encoded TIFF files.  Pre-allocate lots of space for jpegtables\n\tin directory.\n\n\t<li> tif_dirread.c: Changed the code that computes \n\tstripbytecount[0] if it appears bogus to ignore if stripoffset[0] is\n\tzero. This is a common case with GDAL indicating a \"null\" tile/strip.\n\n\t<li> tif_jpeg.c: added LIB_JPEG_MK1 support in JPEGDecodeRaw().\n\n\t<li> tif_dirread.c: Ensure that broken files with too many\n\tvalues in PerSampleShorts, TIFFFetchPerSampleLongs and\n\tTIFFFetchPerSampleAnys work ok instead of crashing.\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=843\">\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=843</a>\n\n\t<li> tif_predict.h, tif_predict.c: Added ability to decode and encode\n\tfloating point predictor, as per TIFF Technical Note 3.\n\tSee http://chriscox.org/TIFF_TN3_Draft2.pdf for details.\n\n\t<li> tiffio.h, tiffiop.h, tif_dir.c, tif_read.c, tif_swab.c:\n\tAdded _TIFFSwab24BitData() and TIFFSwabArrayOfLong() functions used to\n\tswap 24-bit floating point values.\n\n\t<li> tiff.h: Added predictor constants.\n\n\t<li> tiffiop.h, tif_dir.c: Use uint32 type for appropriate values\n\tin _TIFFVSetField() function. Inspired by the bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=816\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=816</a>\n\n\t<li> tif_open.c: Do not read header in case the output file should\n\tbe truncated (Ron).\n\n\t<li> tif_dirinfo.c, tif_config.h.vc: Use lfind() instead of bsearch()\n\tin _TIFFFindFieldInfoByName() function (Ron).\n\n\t<li> tif_dir.c, tif_print.c: Properly handle all data types in custom\n\ttags.\n\n\t<li> dirinfo.c: Added DNG tags.\n\n\t<li> tiff.h: Added missed DNG tag (LensInfo); added DNG 1.1.0.0 tags.\n\n\t<li> tif_dir.c, tif_print.c: Added Support for custom tags, passed\n\tby value.\n\n\t<li> tiff.h, tif_dirinfo.c, tiffiop.h: Added EXIF related tags.\n</UL>\n\n<P><HR WIDTH=65% ALIGN=left>\n\n<!-------------------------------------------------------------------------->\n\t\n<A NAME=\"tools\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE TOOLS:</B></A>\n\n<UL>\n\t<li> tiff2pdf.c: Print two characters per loop in the\n\tt2p_write_pdf_trailer(). As per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=594\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=594</a>\n\n\t<li> tiffgt.c: Use MacOS X OpenGL framework when appropriate. As\n\tper bug <a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=844\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=844</a>\n\n\t<li> ppm2tiff.c: Fixed format string when read PPM file header with\n\tthe fscanf() function. As per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=861\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=861</a>\n\n\t<li> tiffsplit.c: Check for JPEGTables tag presence before copying.\n\n\t<li> tiff2pdfr.c: Calculate the tile width properly; added new\n\toption '-b' to use interpolation in output PDF files (Bruno Ledoux).\n\n\t<li> tiffdither.c: Copy the PhotometricInterpretation tag from the\n\tinput file.\n\n\t<li> tif2pdf.c: Fixed problem with alpha channel handling as per\n\tbug <a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=794\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=794</a>.\n</UL>\n\n<P><HR WIDTH=65% ALIGN=left>\n\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"contrib\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE CONTRIB AREA:</B></A>\n\n<UL> \n\n\t<li> addtiffo/{tif_overview.c, tif_ovrcache.c, tif_ovrcache.h}:\n\tMake overviews working for contiguous images. \n\n</UL>\n\nLast updated $Date: 2006/01/04 22:04:46 $.\n\n</BODY>\n</HTML>\n"
  },
  {
    "path": "src/main/jni/tiff/html/v3.7.4.html",
    "content": "<HTML>\n<HEAD>\n<TITLE>\n\tChanges in TIFF v3.7.4\n</TITLE>\n</HEAD>\n\n<BODY BGCOLOR=white>\n<FONT FACE=\"Helvetica, Arial, Sans\">\n<FONT FACE=\"Helvetica, Arial, Sans\"> \n\n<BASEFONT SIZE=4>\n<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>\n<BASEFONT SIZE=3>\n\n<UL>\n<HR SIZE=4 WIDTH=65% ALIGN=left>\n<B>Current Version</B>: v3.7.4<BR>\n<B>Previous Version</B>: <A HREF=v3.7.3.html>v3.7.3</a><BR>\n<B>Master FTP Site</B>: <A HREF=\"ftp://ftp.remotesensing.org/pub/libtiff\">\nftp.remotesensing.org</a>, directory pub/libtiff</A><BR>\n<B>Master HTTP Site</B>: <A HREF=\"http://www.remotesensing.org/libtiff\">\nhttp://www.remotesensing.org/libtiff</a> \n<HR SIZE=4 WIDTH=65% ALIGN=left>\n</UL>\n\n<P>\nThis document describes the changes made to the software between the\n<I>previous</I> and <I>current</I> versions (see above).\nIf you don't find something listed here, then it was not done in this\ntimeframe, or it was not considered important enough to be mentioned.\nThe following information is located here:\n<UL>\n<LI><A HREF=\"#hightlights\">Major Changes</A>\n<LI><A HREF=\"#configure\">Changes in the software configuration</A>\n<LI><A HREF=\"#libtiff\">Changes in libtiff</A>\n<LI><A HREF=\"#tools\">Changes in the tools</A>\n<LI><A HREF=\"#contrib\">Changes in the contrib area</A>\n</UL>\n<p> \n<P><HR WIDTH=65% ALIGN=left>\n\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"highlights\"><B><FONT SIZE=+3>M</FONT>AJOR CHANGES:</B></A>\n\n<UL>\n\t<li> Fixed important bug in custom tags handling code..\n</UL>\n\n\n<P><HR WIDTH=65% ALIGN=left>\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"configure\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>\n\n<UL>\n\t<li> Applied patch from Patrick Welche (all scripts moved in the\n\t'config' and 'm4' directories).\n\n\t<li> SConstruct, libtiff/SConstruct: Added the first very preliminary\n\tsupport for SCons software building tool (http://www.scons.org/).\n\tThis is experimental infrastructure and it will exist along with the\n\tautotools stuff.\n\n\t<li> port/lfind.c: Added lfind() replacement module.\n</UL>\n\n<P><HR WIDTH=65% ALIGN=left>\n\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"libtiff\"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>\n\n<UL>\n\t<li> tif_dir.c: When prefreeing tv->value in TIFFSetFieldV\n\talso set it to NULL to avoid double free when re-setting custom\n\tstring fields as per:\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=922\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=922</a>\n\n\t<li> tif_dir.c: Fixed up support for swapping \"double complex\"\n\tvalues (128 bits as 2 64 bits doubles).  GDAL gcore tests now\n\tpass on bigendian (macosx) system.\n\n\t<li> libtiff/{tif_dirread.c, tif_dirinfo.c}: Do not upcast BYTEs to\n\tSHORTs in the TIFFFetchByteArray(). Remove TIFFFetchExtraSamples()\n\tfunction, use TIFFFetchNormalTag() instead as per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=831\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=831</a>\n\n\tRemove TIFFFetchExtraSamples() function, use TIFFFetchNormalTag()\n\tinstead.\n\n\t<li> tif_print.c: Fixed printing of the BYTE and SBYTE arrays.\n\n\t<li> tif_write.c: Do not check the PlanarConfiguration field in\n\tthe TIFFWriteCheck() function in case of single band images (as per\n\tTIFF spec).\n\n\t<li> libtiff/{tif_dir.c, tif_dir.h, tif_dirinfo.c, tif_print.c}:\n\tMake FieldOfViewCotangent, MatrixWorldToScreen, MatrixWorldToCamera,\n\tImageFullWidth, ImageFullLength and PrimaryChromaticities tags custom.\n</UL>\n\n<P><HR WIDTH=65% ALIGN=left>\n\n<!-------------------------------------------------------------------------->\n\t\n<A NAME=\"tools\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE TOOLS:</B></A>\n\n<UL>\n\t<li> tiffcp.c: Fixed WhitePoint tag copying.\n</UL>\n\n<P><HR WIDTH=65% ALIGN=left>\n\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"contrib\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE CONTRIB AREA:</B></A>\n\n<UL> \n\t<li> tiffdump.c: Added support for TIFF_IFD datatype.\n\n\t<li> addtiffo/{tif_overview.c, tif_ovrcache.c, tif_ovrcache.h}:\n\tMake overviews working for contiguous images. \n\n</UL>\n\nLast updated $Date: 2005/11/03 14:18:43 $.\n\n</BODY>\n</HTML>\n"
  },
  {
    "path": "src/main/jni/tiff/html/v3.8.0.html",
    "content": "<HTML>\n<HEAD>\n<TITLE>\n\tChanges in TIFF v3.8.0\n</TITLE>\n</HEAD>\n\n<BODY BGCOLOR=white>\n<FONT FACE=\"Helvetica, Arial, Sans\">\n<FONT FACE=\"Helvetica, Arial, Sans\"> \n\n<BASEFONT SIZE=4>\n<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>\n<BASEFONT SIZE=3>\n\n<UL>\n<HR SIZE=4 WIDTH=65% ALIGN=left>\n<B>Current Version</B>: v3.8.0<BR>\n<B>Previous Version</B>: <A HREF=v3.7.4.html>v3.7.4</a><BR>\n<B>Master FTP Site</B>: <A HREF=\"ftp://ftp.remotesensing.org/pub/libtiff\">\nftp.remotesensing.org</a>, directory pub/libtiff</A><BR>\n<B>Master HTTP Site</B>: <A HREF=\"http://www.remotesensing.org/libtiff\">\nhttp://www.remotesensing.org/libtiff</a> \n<HR SIZE=4 WIDTH=65% ALIGN=left>\n</UL>\n\n<P>\nThis document describes the changes made to the software between the\n<I>previous</I> and <I>current</I> versions (see above).\nIf you don't find something listed here, then it was not done in this\ntimeframe, or it was not considered important enough to be mentioned.\nThe following information is located here:\n<UL>\n<LI><A HREF=\"#hightlights\">Major Changes</A>\n<LI><A HREF=\"#configure\">Changes in the software configuration</A>\n<LI><A HREF=\"#libtiff\">Changes in libtiff</A>\n<LI><A HREF=\"#tools\">Changes in the tools</A>\n<LI><A HREF=\"#contrib\">Changes in the contrib area</A>\n</UL>\n<p> \n<P><HR WIDTH=65% ALIGN=left>\n\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"highlights\"><B><FONT SIZE=+3>M</FONT>AJOR CHANGES:</B></A>\n\n<UL>\n\t<li> Read-only support for custom directories (e.g. EXIF directory).\n\n\t<li> Preliminary support for MS MDI format.\n</UL>\n\n\n<P><HR WIDTH=65% ALIGN=left>\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"configure\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>\n\n<UL>\n\t<li> Make the default strip size configurable via the\n\t--with-default-strip-size and STRIP_SIZE_DEFAULT options.\n</UL>\n\n<P><HR WIDTH=65% ALIGN=left>\n\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"libtiff\"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>\n\n<UL>\n\t<li> tiffio.h: Added VC_EXTRALEAN definition before including\n\twindows.h, to reduce the compile time.\n\n\t<li> tif_jpeg.c: Improve compilation under MinGW.\n\n\t<li> {tif_aux.c, tif_dir.c, tif_dir.h, tif_dirwrite.c,\n\ttif_print.c, tif_getimage.c}: Make InkSet, NumberOfInks, DotRange and\n\tStoNits tags custom.\n\n\t<li> {tif_aux.c, tif_dir.c, tif_dir.h, tif_print.c}: Make\n\tWhitePoint tag custom.\n\n\t<li> tiffio.h: fixed typo that potentially resulted in \n\tredefininition of USE_WIN32_FILEIO\n\n\t<li> {tif_dir.c, tif_dir.h, tif_print.c}: Make RichTIFFIPTC,\n\tPhotoshop and ICCProfile tags custom.\n\n\t<li> libtiff/*, contrib/*: Added 'dual-mode' error handling, enabling \n\tnewer code to get context indicator in error handler and still\n\tremain compatible with older code: Done TIFFError calls everywhere \n\texcept in tools.\n\n\t<li> tiffinfo.c: Print EXIF directory contents if exist.\n\n\t<li> {tif_dirinfo.c, tif_dirread.c, tif_dir.h, tif_dir.c}:\n\tCustom directory read-only support.\n\n\t<li> {tif_aux.c, tif_dirinfo.c, tif_dirread.c, tif_dir.h,\n\ttif_dir.c, tif_print.c}: Make YCbCrCoefficients and ReferenceBlackWhite\n\ttags custom.\n\n\t<li> tif_dirread.c: One more workaround for broken StripByteCounts\n\ttag. Handle the case when StripByteCounts array filled with\n\tcompletely wrong values.\n\n\t<li> tif_dirinfo.c: Release file descriptor in case of failure\n\tin the TIFFOpenW() function as per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=1003\">\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1003</a>\n\n\t<li> tif_dirinfo.c: Correctly yse bsearch() and lfind()\n\tfunctions as per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=1008\">\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1008</a>\n\n\t<li> tif_open.c, tiff.h, tiffdump.c: Incorporate preliminary support\n\tfor MS MDI format.\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=1002\">\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1002</a>\n\n\t<li> libtiff.def, tiffiop.h, tiffio.h: Made TIFFFreeDirectory\n\tpublic.\n\n\t<li> /tif_dirinfo.c: Make XResolution, YResolution and\n\tResolutionUnit tags modifiable during write process. As per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=977\">\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=977</a>\n\n\t<li> if_dirread.c: Don't try and split single strips into \"0\" strips\n\tin ChopUpSingleUncompressedStrip.  This happens in some degenerate\n\tcases (like 1x1 files with stripbytecounts==0 (gtsmall.jp2 embed tiff)\n\n\t<li> tif_fax3.c: changed 'at scanline ...' style warning/errors\n\twith incorrect use of tif_row, to 'at line ... of\n\tstrip/tile ...' style.\n</UL>\n\n<P><HR WIDTH=65% ALIGN=left>\n\n<!-------------------------------------------------------------------------->\n\t\n<A NAME=\"tools\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE TOOLS:</B></A>\n\n<UL>\n\t<li> tiffcp.c: Added many error reporting messages; fixed integer\n\toverflow as per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=789\">\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=789</a>\n\n\t<li> tiffcp.c: Return non-zero status when reading fails.\n\n\t<li> fax2tiff.c: Properly calculate sizes of temporary arrays\n\tas per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=943\">\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=943</a>\n\n\t<li> fax2tiff.c: Added option '-r' to set RowsPerStrip parameter\n\tas per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=944\">\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=944</a>\n\n\t<li> tiffdump.c: Fixed typeshift and typemask arrays initialization\n\tproblem as per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=946\">\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=946</a>\n\n\t<li> bmp2tiff.c: Fixed possible integer overflow error as per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=965\">\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=965</a>\n\n\t<li> tiffsplit.c: Copy fax related fields over splitted parts\n\tas per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=983\">\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=983</a>\n\n\t<li> tiffdump.c: Fixed crash when reading malformed tags.\n\n\t<li> tiff2pdf.c: Added missed 'break' statement as per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=932\">\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=932</a>\n</UL>\n\n<P><HR WIDTH=65% ALIGN=left>\n\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"contrib\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE CONTRIB AREA:</B></A>\n\n<UL> \n\t<li> contrib/addtiffo/*: Major upgrade by Joris to support subsampled\n\tYCbCr images in jpeg compressed TIFF files.\n\n</UL>\n\nLast updated $Date: 2006/01/04 23:38:38 $.\n\n</BODY>\n</HTML>\n"
  },
  {
    "path": "src/main/jni/tiff/html/v3.8.1.html",
    "content": "<HTML>\n<HEAD>\n<TITLE>\n\tChanges in TIFF v3.8.1\n</TITLE>\n</HEAD>\n\n<BODY BGCOLOR=white>\n<FONT FACE=\"Helvetica, Arial, Sans\">\n<FONT FACE=\"Helvetica, Arial, Sans\"> \n\n<BASEFONT SIZE=4>\n<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>\n<BASEFONT SIZE=3>\n\n<UL>\n<HR SIZE=4 WIDTH=65% ALIGN=left>\n<B>Current Version</B>: v3.8.1<BR>\n<B>Previous Version</B>: <A HREF=v3.8.0.html>v3.8.0</a><BR>\n<B>Master FTP Site</B>: <A HREF=\"ftp://ftp.remotesensing.org/pub/libtiff\">\nftp.remotesensing.org</a>, directory pub/libtiff</A><BR>\n<B>Master HTTP Site</B>: <A HREF=\"http://www.remotesensing.org/libtiff\">\nhttp://www.remotesensing.org/libtiff</a> \n<HR SIZE=4 WIDTH=65% ALIGN=left>\n</UL>\n\n<P>\nThis document describes the changes made to the software between the\n<I>previous</I> and <I>current</I> versions (see above).\nIf you don't find something listed here, then it was not done in this\ntimeframe, or it was not considered important enough to be mentioned.\nThe following information is located here:\n<UL>\n<LI><A HREF=\"#hightlights\">Major Changes</A>\n<LI><A HREF=\"#configure\">Changes in the software configuration</A>\n<LI><A HREF=\"#libtiff\">Changes in libtiff</A>\n<LI><A HREF=\"#tools\">Changes in the tools</A>\n<LI><A HREF=\"#contrib\">Changes in the contrib area</A>\n</UL>\n<p> \n<P><HR WIDTH=65% ALIGN=left>\n\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"highlights\"><B><FONT SIZE=+3>M</FONT>AJOR CHANGES:</B></A>\n\n<UL>\n\t<li> Bug-fix release.\n</UL>\n\n\n<P><HR WIDTH=65% ALIGN=left>\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"configure\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>\n\n<UL>\n\t<li> libtool related stuff updated from the 2.1a branch.\n\n\t<li> Fix with_default_strip_size comparison as reported by\n\tNorihiko Murase.\n</UL>\n\n<P><HR WIDTH=65% ALIGN=left>\n\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"libtiff\"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>\n\n<UL>\n\n\t<li> tif_dirread.c: Fixed error reporting in TIFFFetchAnyArray()\n\tfunction as per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=1102\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1102</a>\n\n\t<li> tif_jpeg.c, tif_pixarlog.c, tif_fax3.c, tif_zip.c:\n\tProperly restore setfield/getfield methods in cleanup functions. As\n\tper bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=1102\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1102</a>\n\n\t<li> tif_lzw.c, tif_pixarlog.c, tif_zip.c: Use\n\tTIFFPredictorCleanup() in codec cleanup methods. As per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=1102\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1102</a>\n\n\t<li> tif_predict.c, tif_predict.h: Added new function\n\tTIFFPredictorCleanup() to restore parent decode/encode/field methods.\n\n\t<li> tif_dirread.c: Fixed integer overflow condition in\n\tTIFFFetchData() function. As per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=1102\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1102</a>\n\n\t<li> tif_ojpeg.c: Set the ReferenceBlackWhite with the\n\tTIFFSetField() method, not directly. As per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=1043\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1043</a>\n\n\t<li> tif_write.c: Small code rearrangement in TIFFWriteScanline()\n\tto avoid crash as per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=1081\">\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1081</a>\n\n\t<li> tif_dirwrite.c: Properly write TIFFTAG_DOTRANGE tag as per\n\tbug <a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=1088\">\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1088</a>\n\n\t<li> tif_print.c: Properly read TIFFTAG_PAGENUMBER,\n\tTIFFTAG_HALFTONEHINTS, TIFFTAG_YCBCRSUBSAMPLING and TIFFTAG_DOTRANGE\n\ttags as per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=1088\">\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1088</a>\n\n\t<li> tif_tile.c: Fix error reporting in TIFFCheckTile() as per\n\tbug <a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=1063\">\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1063</a>\n\n\t<li> tif_color.c: Avoid overflow in case of wrong input as per\n\tbug <a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=1065\">\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1065</a>\n\n\t<li> tif_dirinfo.c: Use TIFF_NOTYPE instead of 0 when\n\tappropriate. As per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=1033\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1033</a>\n\n\t<li> tif_aux.c: Fixed type of temporary variable in\n\t_TIFFCheckMalloc() as per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=103\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=103</a>\n\n\t<li> tif_aux.c: Return static array when fetching default\n\tYCbCrCoefficients (another problem, reported a the\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=1029\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1029</a>\n\tentry).\n\n\t<li> tif_dir.c: Special handling for PageNumber, HalftoneHints,\n\tYCbCrSubsampling and DotRange tags as per bugs\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=1029\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1029</a>\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=1034\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1034</a>\n\n\t<li> tif_dirread.c: Use _TIFFGetExifFieldInfo() instead of\n\t_TIFFGetFieldInfo() in TIFFReadEXIFDirectory() call as per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=1026\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1026</a>\n\n\t<li> tif_dirinfo.c: Change definitions for TIFFTAG_ICCPROFILE,\n\tTIFFTAG_PHOTOSHOP, TIFFTAG_RICHTIFFIPTC, TIFFTAG_XMLPACKET:\n\treadcount should be uint32 value.\n\n</UL>\n\n<P><HR WIDTH=65% ALIGN=left>\n\n<!-------------------------------------------------------------------------->\n\t\n<A NAME=\"tools\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE TOOLS:</B></A>\n\n<UL>\n\t<li> ppm2tiff.c: Added support for PBM files as per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=1044\">\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1044</a>\n\n\t<li> tiff2pdf.c: Functions t2p_sample_rgbaa_to_rgb() and\n\tt2p_sample_rgba_to_rgb() was used in place of each other, that was\n\tresulted in problems with RGBA images with associated alpha.\n\tAs per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=1097\">\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1097</a>\n\n\t<li> tiff2ps.c: Properly scale all the pages when converting\n\tmultipage TIFF with /width/height/center options set. As per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=1080\">\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1080</a>\n\n\t<li> tiff2pdf.c: Do not create output file until all option checks\n\twill be done. As per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=1072\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1072</a>\n\n\t<li> bmp2tiff.c: Added ability to create multipage TIFFs from the\n\tlist of input files as per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=1077\">\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1077</a>\n\n\t<li> tiffgt.c: Avoid crashing in case of image unsupported by\n\tTIFFRGBAImage interface.\n\n\t<li> tiff2pdf.c: Fixed support for non-YCbCr encoded JPEG\n\tcompressed TIFF files, per submission from Dan Cobra.\n\n\t<li> bmp2tiff, pal2rgb, ppm2tiff, ras2tiff, raw2tiff, sgi2tiff,\n\ttiff2bw, tiffcp: Fixed jpeg option processing so -c jpeg:r:50 works\n\tproperly as per bug:\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=1025\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1025</a>\n\n</UL>\n\n<P><HR WIDTH=65% ALIGN=left>\n\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"contrib\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE CONTRIB AREA:</B></A>\n\n<UL> \n</UL>\n\nLast updated $Date: 2006/03/13 14:52:12 $.\n\n</BODY>\n</HTML>\n"
  },
  {
    "path": "src/main/jni/tiff/html/v3.8.2.html",
    "content": "<HTML>\n<HEAD>\n<TITLE>\n\tChanges in TIFF v3.8.2\n</TITLE>\n</HEAD>\n\n<BODY BGCOLOR=white>\n<FONT FACE=\"Helvetica, Arial, Sans\">\n<FONT FACE=\"Helvetica, Arial, Sans\"> \n\n<BASEFONT SIZE=4>\n<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>\n<BASEFONT SIZE=3>\n\n<UL>\n<HR SIZE=4 WIDTH=65% ALIGN=left>\n<B>Current Version</B>: v3.8.2<BR>\n<B>Previous Version</B>: <A HREF=v3.8.1.html>v3.8.1</a><BR>\n<B>Master FTP Site</B>: <A HREF=\"ftp://ftp.remotesensing.org/pub/libtiff\">\nftp.remotesensing.org</a>, directory pub/libtiff</A><BR>\n<B>Master HTTP Site</B>: <A HREF=\"http://www.remotesensing.org/libtiff\">\nhttp://www.remotesensing.org/libtiff</a> \n<HR SIZE=4 WIDTH=65% ALIGN=left>\n</UL>\n\n<P>\nThis document describes the changes made to the software between the\n<I>previous</I> and <I>current</I> versions (see above).\nIf you don't find something listed here, then it was not done in this\ntimeframe, or it was not considered important enough to be mentioned.\nThe following information is located here:\n<UL>\n<LI><A HREF=\"#hightlights\">Major Changes</A>\n<LI><A HREF=\"#configure\">Changes in the software configuration</A>\n<LI><A HREF=\"#libtiff\">Changes in libtiff</A>\n<LI><A HREF=\"#tools\">Changes in the tools</A>\n<LI><A HREF=\"#contrib\">Changes in the contrib area</A>\n</UL>\n<p> \n<P><HR WIDTH=65% ALIGN=left>\n\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"highlights\"><B><FONT SIZE=+3>M</FONT>AJOR CHANGES:</B></A>\n\n<UL>\n\t<li> Bug-fix release.\n</UL>\n\n\n<P><HR WIDTH=65% ALIGN=left>\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"configure\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>\n\n<UL>\n\n\t<li> tools/Makefile.am: Use runtime paths linker flags when rpath\n\toption enabled.\n\n\t<li> Makefiles improvements as per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=1128\">\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1128</a>\n\n\t<li> Fixed win32 I/O functions usage as per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=1127\">\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1127</a>\n\n</UL>\n\n<P><HR WIDTH=65% ALIGN=left>\n\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"libtiff\"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>\n\n<UL>\n\t<li> tif_strip.c: Take subsampling in account when calculating\n\tTIFFScanlineSize().\n\n\t<li> tif_jpeg.c, tif_fax3.c, tif_zip.c, tif_pixarlog.c,\n\ttif_lzw.c, tif_luv.c: Use _TIFFSetDefaultCompressionState() in all\n\tcodec cleanup methods. As per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=1120\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1120</a>\n\t\n\t<li> tif_jpeg.c: Do not cleanup codec state in TIFFInitJPEG(). As\n\tper bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=1119\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1119</a>\n\n\t<li> tif_dir.c: Use double type instead of dblparam_t.\n\n\t<li> tif_dirread.c: Do not check the PlanarConfig tag presence\n\tin TIFFReadDirectory, because it is always set at the start of\n\tfunction and we allow TIFFs without that tag set.\n\n</UL>\n\n<P><HR WIDTH=65% ALIGN=left>\n\n<!-------------------------------------------------------------------------->\n\t\n<A NAME=\"tools\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE TOOLS:</B></A>\n\n<UL>\n\t<li> tiffcp.c: Do not set RowsPerStrip bigger than image length.\n\n\t<li> fax2tiff.c: Fixed wrong TIFFerror() invocations as per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=1125\">\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1125</a>\n\n\t<li> fax2ps.c: Fixed reading the input stream from stdin as per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=1124\">\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1124</a>\n\n\t<li> raw2tiff.c: Do not set RowsPerStrip larger than ImageLength.\n\tAs per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=1110\">\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1110</a>\n\n</UL>\n\n<P><HR WIDTH=65% ALIGN=left>\n\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"contrib\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE CONTRIB AREA:</B></A>\n\n<UL> \n</UL>\n\nLast updated $Date: 2006/03/23 14:54:01 $.\n\n</BODY>\n</HTML>\n"
  },
  {
    "path": "src/main/jni/tiff/html/v3.9.0beta.html",
    "content": "<HTML>\n<HEAD>\n<TITLE>\n\tChanges in TIFF v3.9.0beta\n</TITLE>\n</HEAD>\n\n<BODY BGCOLOR=white>\n<FONT FACE=\"Helvetica, Arial, Sans\">\n<FONT FACE=\"Helvetica, Arial, Sans\"> \n\n<BASEFONT SIZE=4>\n<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>\n<BASEFONT SIZE=3>\n\n<UL>\n<HR SIZE=4 WIDTH=65% ALIGN=left>\n<B>Current Version</B>: v3.9.0beta<BR>\n<B>Previous Version</B>: <A HREF=v3.8.2.html>v3.8.2</a><BR>\n<B>Master FTP Site</B>: <A HREF=\"ftp://ftp.remotesensing.org/pub/libtiff\">\nftp.remotesensing.org</a>, directory pub/libtiff</A><BR>\n<B>Master HTTP Site</B>: <A HREF=\"http://www.remotesensing.org/libtiff\">\nhttp://www.remotesensing.org/libtiff</a> \n<HR SIZE=4 WIDTH=65% ALIGN=left>\n</UL>\n\n<P>\nThis document describes the changes made to the software between the\n<I>previous</I> and <I>current</I> versions (see above).\nIf you don't find something listed here, then it was not done in this\ntimeframe, or it was not considered important enough to be mentioned.\nThe following information is located here:\n<UL>\n<LI><A HREF=\"#hightlights\">Major Changes</A>\n<LI><A HREF=\"#configure\">Changes in the software configuration</A>\n<LI><A HREF=\"#libtiff\">Changes in libtiff</A>\n<LI><A HREF=\"#tools\">Changes in the tools</A>\n<LI><A HREF=\"#contrib\">Changes in the contrib area</A>\n</UL>\n<p> \n<P><HR WIDTH=65% ALIGN=left>\n\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"highlights\"><B><FONT SIZE=+3>M</FONT>AJOR CHANGES:</B></A>\n\n<UL>\n\t<li> New <b>tiffcrop</b> utility contributed by Richard Nolde.\n\t<b>tiffcrop</b> does the same as <b>tiffcp</b>, but also can crop,\n\textract, rotate and mirror images.\n\n\t<li> tif_jbig.c:  Added\tsupport for JBIG compression scheme\n\t(34661 code), contributed by Lee Howard.\n\n\t<li> Totally new implementation of OJPEG module from\n\tJoris Van Damme. No need to patch libjpeg anymore. Many OJPEG files\n\tshould be supported now that was not supported previously.\n\n</UL>\n\n\n<P><HR WIDTH=65% ALIGN=left>\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"configure\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>\n\n<UL>\n\n\t<li> tif_config.wince.h, tiffconf.wince.h, tif_wince.c: WinCE-specific\n\tcompatibility stuff from Mateusz Loskot.\n\n\t<li> Rename config.h.vc and tif_config.h.vc to config.vc.h and \n\ttif_config.vc.h for easier identification by folks using an IDE.\n\n\t<li> configure, configure.ac: OJPEG support enabled by default (i.e.,\n\twhe the conformant JPEG support enabled).\n\n\t<li> README.vms, Makefile.am, configure.com, libtiff/{Makefile.am,\n\ttif_config.h-vms, tif_stream.cxx, tif_vms.c, tiffconf.h-vms}:\n\tAdded support for OpenVMS by Alexey Chupahin.\n\n\t<li> nmake.opt: use /EHsc for VS2005 compatibility.  Also define\n\t_CRT_SECURE_NO_DEPRECATE to avoid noise on VS2005.\n\n</UL>\n\n<P><HR WIDTH=65% ALIGN=left>\n\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"libtiff\"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>\n\n<UL>\n\t<li> tif_dirinfo.c (_TIFFFindFieldInfo): Don't attempt to\n\tbsearch() on a NULL fieldinfo list.\n\t(_TIFFFindFieldInfoByName): Don't attempt to lfind() on a NULL\n\tfieldinfo list.\n\n\t<li> tif_jpeg.c: Changed JPEGInitializeLibJPEG() so that it\n\twill convert from decompressor to compressor or compress to decompress\n\tif required by the force arguments.  This works around a problem in\n\twhere the JPEGFixupTestSubsampling() may cause a decompressor to \n\tbe setup on a directory when later a compressor is required with the\n\tforce flag set.  Occurs with the addtiffo program for instance.\n\n\t<li> tif_dirwrite.c: Fixed swapping of byte arrays stored\n\tin-place in tag offsets as per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=1363\">\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1363</a>\n\n\t<li> tif_getimage.c: workaround for 'Fractional scanline' error\n\treading OJPEG images with rowsperstrip that is not a multiple of\n\tvertical subsampling factor. This bug is mentioned in\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=1390\">\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1390</a> and\n\t<a href=\"http://www.asmail.be/msg0054766825.html\">\n\thttp://www.asmail.be/msg0054766825.html</a>\n\n\t<li> tif_dirread.c: Added special function to handle\n\tSubjectDistance EXIF tag as per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=1362\">\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1362</a>\n\n\t<li> tif_dirread.c, tif_read.c: Type of the byte counters\n\tchanged from tsize_t to uint32 to be able to work with data arrays\n\tlarger than 2GB. Fixes bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=890\">\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=89</a>\t\n\tIdea submitted by Matt Hancher.\n\n\t<li> tif_dir.c: Workaround for incorrect TIFFs with\n\tExtraSamples == 999 produced by Corel Draw. As per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=1490\">\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1490</a>\n\n\t<li> tif_write.c: TIFFAppendToStrip() - clear sorted flag if \n\twe move a strip.\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=1359\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1359</a>\n\n\t<li> tif_fax3.c: Save the state of printdir codec dependent method.\n\n\t<li> tif_jpeg.c: Save the state of printdir codec dependent method\n\tas per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=1273\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1273</a>\n\n\t<li> tif_win32.c: Fixed problem with offset value manipulation\n\tas per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=1322\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1322</a>\n\n\t<li> tif_fax3.c, tif_next.c, tif_pixarlog.c: Fixed multiple\n\tvulnerabilities, as per\tGentoo bug ():\n\t<a href=\"http://bugs.gentoo.org/show_bug.cgi?id=142383\">\n\thttp://bugs.gentoo.org/show_bug.cgi?id=142383</a>\n\n\t<li> tif_lzw.c, tif_zip.c: Fixed problems with mixing\n\tencoding and decoding on the same read-write TIFF handle.  The LZW\n\tcode can now maintain encode and decode state at the same time. The\n\tZIP code will switch back and forth as needed.  \n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=757\">\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=757</a>\n\n\t<li> tif_msdos.c: Avoid handle leak for failed opens.\n\tc/o Thierry Pierron\n\n\t<li> tif_dirwrite.c: take care not to flush out buffer of strip/tile\n\tdata in _TIFFWriteDirectory if TIFF_BEENWRITING not set.  Relates\n\tto bug report by Peng Gao with black strip at bottom of images.\n\n\t<li> tif_dirwrite.c: make sure to use uint32 for wordcount in \n\tTIFFWriteNormanTag if writecount is VARIABLE2 for ASCII fields.\n\tIt already seems to have been done for other field types.  Needed\n\tfor \"tiffset\" on files with geotiff ascii text.\n\n\t<li> tif_dirinfo.c: Added missed EXIF tag ColorSpace (40961).\n\n\t<li> tif_dirread.c: Move IFD fetching code in the separate\n\tfunction TIFFFetchDirectory() avoiding code duplication in\n\tTIFFReadDirectory() and TIFFReadCustomDirectory().\n\n\t<li>tif_readdir.c: Added case in EstimateStripByteCounts() for tiled\n\tfiles.  Modified TIFFReadDirectory() to not invoke\n\tEstimateStripByteCounts() for case where entry 0 and 1 are unequal but\n\tone of them is zero.\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=1204\">\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1204</a>\n\n\t<li> tif_open.c, tif_dirread.c, tiffiop.h: Move IFD looping\n\tchecking code in the separate function TIFFCheckDirOffset().\n\n\t<li> tif_aux.c: Added _TIFFCheckRealloc() function.\n\n\t<li> tif_fax3.c: Fixed problems in fax decoder as per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=1194\">\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1194</a>\n\n\t<li> tif_jbig.c:  Added\tsupport for JBIG compression scheme\n\t(34661 code) contributed by Lee Howard. As per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=896\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=896</a>\n\n\t<li> tif_getimage.c: Added support for planarconfig separate\n\tnon-subsampled YCbCr (i.e. separate YCbCr with subsampling [1,1]).\n\n\t<li> tif_getimage.c: Revision of all RGB(A) put routines:\n\t<ul>\n\t\t<li> Conversion of unassociated alpha to associated alpha\n\t\tnow done with more performant LUT, and calculation more\n\t\tcorrect.\n\t  \t<li> Conversion of 16bit data to 8bit data now done with\n\t  \tmore performant LUT, and calculation more correct\n\t  \t<li> Bugfix of handling of 16bit RGB with unassociated alpha\n  \t</ul>\n\n\t<li> tif_ojpeg.c: totally new implementation\n\n\t<li> tif_getimage.c: removed TIFFTAG_JPEGCOLORMODE handling\n\tof OJPEG images in favor of tif_getimage.c native handling of\n\tYCbCr and desubsampling.\n\n\t<li> tif_jpeg.c: JPEGVSetField() so that altering the photometric\n\tinterpretation causes the \"upsampled\" flag to be recomputed.  Fixes\n\tpeculiar bug where photometric flag had to be set before jpegcolormode\n\tflag.\n\n</UL>\n\n<P><HR WIDTH=65% ALIGN=left>\n\n<!-------------------------------------------------------------------------->\n\t\n<A NAME=\"tools\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE TOOLS:</B></A>\n\n<UL>\n\t<li> tiff2ps.c:  Added support 16-bit images as per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=1566\">\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1566</a>.\n\tPatch from William Bader.\n\n\t<li> tiff2pdf.c: Fix for TIFFTAG_JPEGTABLES tag fetching and\n\tsignificant upgrade of the whole utility as per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=1560\">\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1560</a>.\n\tNow we don't need tiffiop.h in tiff2pdf anymore and will open output\n\tPDF file using TIFFClientOpen() machinery as it is implemented\n\tby Leon Bottou.\n\n\t<li> tiffcrop.c:  New tiffcrop utility contributed\n\tby Richard Nolde. As per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=1383\">\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1383</a>\n\n\t<li> tiff2pdf.c: Do not assume inches when the resolution units\n\tdo not specified. As per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=1366\">\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1366</a>\n\n\t<li> tiffset.c: Properly handle tags with TIFF_VARIABLE writecount.\n\tAs per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=1350\">\n\t\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1350</a>\n\n\t<li> tif2rgba.c: This utility does not work properly on big-endian\n\tarchitectures. It was fixed including the bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=1149\">\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1149</a>\n\n\t<li> tiff2pdf.c: Fix handling of -q values.\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=587\">\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=587</a>\n\n\t<li> tiffcmp.c: Fixed floating point comparison logic as per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=1191\">\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1191</a>\n\n\t<li> tiff2pdf.c: Fixed buffer overflow condition in\n\tt2p_write_pdf_string() as per bug\n\t<a href=\"http://bugzilla.remotesensing.org/show_bug.cgi?id=1196\">\n\thttp://bugzilla.remotesensing.org/show_bug.cgi?id=1196</a>\n\n</UL>\n\n<P><HR WIDTH=65% ALIGN=left>\n\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"contrib\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE CONTRIB AREA:</B></A>\n\n<UL> \n\n\t<li> contrib/addtiffo/tif_overview.c: Fix problems with odd sized\n\toutput blocks in TIFF_DownSample_Subsampled() (bug 1542).\n\n\t<li> contrib/dbs/xtiff/xtiff.c: Make xtiff utility compilable.\n\tThough it is still far from the state of being working and useful.\n\n</UL>\n\nLast updated $Date: 2007/07/13 13:40:12 $.\n\n</BODY>\n</HTML>\n"
  },
  {
    "path": "src/main/jni/tiff/html/v3.9.1.html",
    "content": "<HTML>\n<HEAD>\n<TITLE>\n\tChanges in TIFF v3.9.1\n</TITLE>\n</HEAD>\n\n<BODY BGCOLOR=white>\n<FONT FACE=\"Helvetica, Arial, Sans\">\n<FONT FACE=\"Helvetica, Arial, Sans\"> \n\n<BASEFONT SIZE=4>\n<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>\n<BASEFONT SIZE=3>\n\n<UL>\n<HR SIZE=4 WIDTH=65% ALIGN=left>\n<B>Current Version</B>: v3.9.1<BR>\n<B>Previous Version</B>: <A HREF=v3.9.1.html>v3.9.1</a><BR>\n<B>Master FTP Site</B>: <A HREF=\"ftp://ftp.remotesensing.org/pub/libtiff\">\nftp.remotesensing.org</a>, directory pub/libtiff</A><BR>\n<B>Master HTTP Site</B>: <A HREF=\"http://www.remotesensing.org/libtiff\">\nhttp://www.remotesensing.org/libtiff</a> \n<HR SIZE=4 WIDTH=65% ALIGN=left>\n</UL>\n\n<P>\nThis document describes the changes made to the software between the\n<I>previous</I> and <I>current</I> versions (see above).  If you don't\nfind something listed here, then it was not done in this timeframe, or\nit was not considered important enough to be mentioned.  The following\ninformation is located here:\n<UL>\n<LI><A HREF=\"#hightlights\">Major Changes</A>\n<LI><A HREF=\"#configure\">Changes in the software configuration</A>\n<LI><A HREF=\"#libtiff\">Changes in libtiff</A>\n<LI><A HREF=\"#tools\">Changes in the tools</A>\n<LI><A HREF=\"#contrib\">Changes in the contrib area</A>\n</UL>\n<p> \n<P><HR WIDTH=65% ALIGN=left>\n\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"highlights\"><B><FONT SIZE=+3>M</FONT>AJOR CHANGES:</B></A>\n\n<UL>\n\t<li> This is a bug-fix release for several bugs (two of which\n\tare dire) which were discovered in the 3.9.0 release.\n\n</UL>\n\n\n<P><HR WIDTH=65% ALIGN=left>\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"configure\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>\n\n<UL>\n\n\t<li> Several defines were missing from tif_config.vc.h which\n\tare necessary to compile the library using MSVC.\n\n\t<li> Colorized tests were actually not enabled as expected.\n\tParallel tests mode is now also enabled so that tests can be\n\trun in parallel, and test output is sent to .log files.\n\n</UL>\n\n<P><HR WIDTH=65% ALIGN=left>\n\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"libtiff\"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>\n\n<UL>\n\t<li> libtiff/tif_write.c (TIFFAppendToStrip): Remove cast\n\twhich caused libtiff to output a wrong last strip with\n\tbyte-count and strip-offset of zero.  This cast was added on\n\tthe day of the 3.9.0 release.\n\n\t<li> libtiff/tif_dirwrite.c: Back out changes from 2007-11-22\n\tthat resulted in the final strip not being written in some\n\tcircumstances.\n\thttp://bugzilla.maptools.org/show_bug.cgi?id=2088\n\n</UL>\n\n<P><HR WIDTH=65% ALIGN=left>\n\n<!-------------------------------------------------------------------------->\n\t\n<A NAME=\"tools\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE TOOLS:</B></A>\n\n<UL>\n\t<li> None\n\n</UL>\n\n<P><HR WIDTH=65% ALIGN=left>\n\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"contrib\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE CONTRIB AREA:</B></A>\n\n<UL> \n\n\t<li> None\n\n</UL>\n\nLast updated $Date: 2009-08-28 18:49:02 $.\n\n</BODY>\n</HTML>\n"
  },
  {
    "path": "src/main/jni/tiff/html/v3.9.2.html",
    "content": "<HTML>\n<HEAD>\n<TITLE>\n\tChanges in TIFF v3.9.2\n</TITLE>\n</HEAD>\n\n<BODY BGCOLOR=white>\n<FONT FACE=\"Helvetica, Arial, Sans\">\n<FONT FACE=\"Helvetica, Arial, Sans\"> \n\n<BASEFONT SIZE=4>\n<B><FONT SIZE=+3>T</FONT>IFF <FONT SIZE=+2>C</FONT>HANGE <FONT SIZE=+2>I</FONT>NFORMATION</B>\n<BASEFONT SIZE=3>\n\n<UL>\n<HR SIZE=4 WIDTH=65% ALIGN=left>\n<B>Current Version</B>: v3.9.2<BR>\n<B>Previous Version</B>: <A HREF=v3.9.1.html>v3.9.1</a><BR>\n<B>Master FTP Site</B>: <A HREF=\"ftp://ftp.remotesensing.org/pub/libtiff\">\nftp.remotesensing.org</a>, directory pub/libtiff</A><BR>\n<B>Master HTTP Site</B>: <A HREF=\"http://www.remotesensing.org/libtiff\">\nhttp://www.remotesensing.org/libtiff</a> \n<HR SIZE=4 WIDTH=65% ALIGN=left>\n</UL>\n\n<P>\nThis document describes the changes made to the software between the\n<I>previous</I> and <I>current</I> versions (see above).  If you don't\nfind something listed here, then it was not done in this timeframe, or\nit was not considered important enough to be mentioned.  The following\ninformation is located here:\n<UL>\n<LI><A HREF=\"#hightlights\">Major Changes</A>\n<LI><A HREF=\"#configure\">Changes in the software configuration</A>\n<LI><A HREF=\"#libtiff\">Changes in libtiff</A>\n<LI><A HREF=\"#tools\">Changes in the tools</A>\n<LI><A HREF=\"#contrib\">Changes in the contrib area</A>\n</UL>\n<p> \n<P><HR WIDTH=65% ALIGN=left>\n\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"highlights\"><B><FONT SIZE=+3>M</FONT>AJOR CHANGES:</B></A>\n\n<UL>\n\n\t<li> Fixes a number of bugs present in the 3.9.1 release.\n\n        <li> OJPEG support updated to work with IJG JPEG 7 release.\n\n        <li> Tiffcrop validated for most TIFF storage subformats and sample depths.\n\n</UL>\n\n\n<P><HR WIDTH=65% ALIGN=left>\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"configure\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE SOFTWARE CONFIGURATION:</B></A>\n\n<UL>\n\n\t<li> x86_64 now uses the same default fill order as i386.\n\n</UL>\n\n<P><HR WIDTH=65% ALIGN=left>\n\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"libtiff\"><B><FONT SIZE=+3>C</FONT>HANGES IN LIBTIFF:</B></A>\n\n<UL>\n\t<li> Writing tags with an array value of type TIFF_DOUBLE now\n\treturns correct error status. The TIFFTAG_SMINSAMPLEVALUE and\n\tTIFFTAG_SMAXSAMPLEVALUE tags failed to write without this fix.\n\n\t<li> OJPEG decoder now works with IJG JPEG 7.  Resolves \"Bug\n\t2090 - OJPEG crash with libjpeg v7\".\n\thttp://bugzilla.maptools.org/show_bug.cgi?id=2090\n\n\t<li> Eliminate most GCC \"dereferencing type-punned pointer\"\n\twarnings.\n\n</UL>\n\n<P><HR WIDTH=65% ALIGN=left>\n\n<!-------------------------------------------------------------------------->\n\t\n<A NAME=\"tools\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE TOOLS:</B></A>\n\n<UL>\n\n        <li> New tiffcrop from Richard Nolde.  Major updates to add\n        significant functionality for reading and writing tile based\n        images with bit depths not a multiple of 8 which cannot be\n        handled by tiffcp.\n\n        <li> Allow building tools with GCC using the \"-Wformat\n        -Werror=format-security\" flags.\n\n</UL>\n\n<P><HR WIDTH=65% ALIGN=left>\n\n<!--------------------------------------------------------------------------->\n\n<A NAME=\"contrib\"><B><FONT SIZE=+3>C</FONT>HANGES IN THE CONTRIB AREA:</B></A>\n\n<UL> \n\n\t<li> None\n\n</UL>\n\nLast updated $Date: 2009-08-28 18:49:02 $.\n\n</BODY>\n</HTML>\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/Makefile.am",
    "content": "# Tag Image File Format (TIFF) Software\n#\n# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>\n#\n# Permission to use, copy, modify, distribute, and sell this software and \n# its documentation for any purpose is hereby granted without fee, provided\n# that (i) the above copyright notices and this permission notice appear in\n# all copies of the software and related documentation, and (ii) the names of\n# Sam Leffler and Silicon Graphics may not be used in any advertising or\n# publicity relating to the software without the specific, prior written\n# permission of Sam Leffler and Silicon Graphics.\n# \n# THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n# \n# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n# OF THIS SOFTWARE.\n\n# Process this file with automake to produce Makefile.in.\n\nLIBPORT = $(top_builddir)/port/libport.la\nLIBTIFF = $(top_builddir)/libtiff/libtiff.la\nlibtiffincludedir = $(includedir)\n\nEXTRA_DIST = Makefile.vc \\\n\t     SConstruct \\\n\t     tif_config.h-vms \\\n\t     tif_config.vc.h \\\n\t     tif_config.wince.h \\\n\t     tiffconf.vc.h \\\n\t     tiffconf.wince.h \\\n\t     libtiff.def \\\n\t     $(EXTRA_SRCS)\n\nlibtiffinclude_HEADERS = \\\n\ttiff.h \\\n\ttiffio.h \\\n\ttiffvers.h\n\nif HAVE_CXX\nlibtiffinclude_HEADERS += tiffio.hxx\nendif\n\nnoinst_HEADERS = \\\n\tt4.h \\\n\ttif_dir.h \\\n\ttif_predict.h \\\n\ttiffiop.h \\\n\tuvcode.h\n\nnodist_libtiffinclude_HEADERS = \\\n\ttiffconf.h\n\nlibtiff_la_SOURCES = \\\n\ttif_aux.c \\\n\ttif_close.c \\\n\ttif_codec.c \\\n\ttif_color.c \\\n\ttif_compress.c \\\n\ttif_dir.c \\\n\ttif_dirinfo.c \\\n\ttif_dirread.c \\\n\ttif_dirwrite.c \\\n\ttif_dumpmode.c \\\n\ttif_error.c \\\n\ttif_extension.c \\\n\ttif_fax3.c \\\n\ttif_fax3sm.c \\\n\ttif_flush.c \\\n\ttif_getimage.c \\\n\ttif_jbig.c \\\n\ttif_jpeg.c \\\n\ttif_luv.c \\\n\ttif_lzw.c \\\n\ttif_next.c \\\n\ttif_ojpeg.c \\\n\ttif_open.c \\\n\ttif_packbits.c \\\n\ttif_pixarlog.c \\\n\ttif_predict.c \\\n\ttif_print.c \\\n\ttif_read.c \\\n\ttif_strip.c \\\n\ttif_swab.c \\\n\ttif_thunder.c \\\n\ttif_tile.c \\\n\ttif_unix.c \\\n\ttif_version.c \\\n\ttif_warning.c \\\n\ttif_write.c \\\n\ttif_zip.c\n\nlibtiffxx_la_SOURCES = \\\n\ttif_stream.cxx\n\nEXTRA_SRCS = \\\n\ttif_acorn.c \\\n\ttif_apple.c \\\n\ttif_atari.c \\\n\ttif_msdos.c \\\n\ttif_next.c \\\n\ttif_win3.c \\\n\ttif_win32.c\n\nlib_LTLIBRARIES = libtiff.la\nif HAVE_CXX\nlib_LTLIBRARIES += libtiffxx.la\nendif\n\nlibtiff_la_LDFLAGS = \\\n\t-no-undefined \\\n\t-version-number $(LIBTIFF_VERSION_INFO)\nif HAVE_RPATH\nlibtiff_la_LDFLAGS += $(LIBDIR)\nendif\nlibtiff_la_LIBADD = $(LIBPORT)\n\nlibtiffxx_la_LDFLAGS = \\\n\t-no-undefined \\\n\t-version-number $(LIBTIFF_VERSION_INFO)\nif HAVE_RPATH\nlibtiffxx_la_LDFLAGS += $(LIBDIR)\nendif\nlibtiffxx_la_LIBADD = $(LIBTIFF) $(LIBPORT)\nlibtiffxx_la_DEPENDENCIES = libtiff.la\n\n#\n# The finite state machine tables used by the G3/G4 decoders\n# are generated by the mkg3states program.  On systems without\n# make these rules have to be manually carried out.\n#\nnoinst_PROGRAMS = mkg3states\nmkg3states_SOURCES = mkg3states.c tif_fax3.h\nmkg3states_LDADD = $(LIBPORT)\n\nfaxtable: mkg3states\n\t(rm -f tif_fax3sm.c && ./mkg3states -b -c const tif_fax3sm.c)\n\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/Makefile.in",
    "content": "# Makefile.in generated by automake 1.11 from Makefile.am.\n# @configure_input@\n\n# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,\n# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,\n# Inc.\n# This Makefile.in is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY, to the extent permitted by law; without\n# even the implied warranty of MERCHANTABILITY or FITNESS FOR A\n# PARTICULAR PURPOSE.\n\n@SET_MAKE@\n\n# Tag Image File Format (TIFF) Software\n#\n# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>\n#\n# Permission to use, copy, modify, distribute, and sell this software and \n# its documentation for any purpose is hereby granted without fee, provided\n# that (i) the above copyright notices and this permission notice appear in\n# all copies of the software and related documentation, and (ii) the names of\n# Sam Leffler and Silicon Graphics may not be used in any advertising or\n# publicity relating to the software without the specific, prior written\n# permission of Sam Leffler and Silicon Graphics.\n# \n# THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n# \n# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n# OF THIS SOFTWARE.\n\n# Process this file with automake to produce Makefile.in.\n\n\n\nVPATH = @srcdir@\npkgdatadir = $(datadir)/@PACKAGE@\npkgincludedir = $(includedir)/@PACKAGE@\npkglibdir = $(libdir)/@PACKAGE@\npkglibexecdir = $(libexecdir)/@PACKAGE@\nam__cd = CDPATH=\"$${ZSH_VERSION+.}$(PATH_SEPARATOR)\" && cd\ninstall_sh_DATA = $(install_sh) -c -m 644\ninstall_sh_PROGRAM = $(install_sh) -c\ninstall_sh_SCRIPT = $(install_sh) -c\nINSTALL_HEADER = $(INSTALL_DATA)\ntransform = $(program_transform_name)\nNORMAL_INSTALL = :\nPRE_INSTALL = :\nPOST_INSTALL = :\nNORMAL_UNINSTALL = :\nPRE_UNINSTALL = :\nPOST_UNINSTALL = :\nbuild_triplet = @build@\nhost_triplet = @host@\ntarget_triplet = @target@\n@HAVE_CXX_TRUE@am__append_1 = tiffio.hxx\n@HAVE_CXX_TRUE@am__append_2 = libtiffxx.la\n@HAVE_RPATH_TRUE@am__append_3 = $(LIBDIR)\n@HAVE_RPATH_TRUE@am__append_4 = $(LIBDIR)\nnoinst_PROGRAMS = mkg3states$(EXEEXT)\nsubdir = libtiff\nDIST_COMMON = $(am__libtiffinclude_HEADERS_DIST) $(noinst_HEADERS) \\\n\t$(srcdir)/Makefile.am $(srcdir)/Makefile.in \\\n\t$(srcdir)/tif_config.h.in $(srcdir)/tiffconf.h.in\nACLOCAL_M4 = $(top_srcdir)/aclocal.m4\nam__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \\\n\t$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \\\n\t$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \\\n\t$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac\nam__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \\\n\t$(ACLOCAL_M4)\nmkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs\nCONFIG_HEADER = tif_config.h tiffconf.h\nCONFIG_CLEAN_FILES =\nCONFIG_CLEAN_VPATH_FILES =\nam__vpath_adj_setup = srcdirstrip=`echo \"$(srcdir)\" | sed 's|.|.|g'`;\nam__vpath_adj = case $$p in \\\n    $(srcdir)/*) f=`echo \"$$p\" | sed \"s|^$$srcdirstrip/||\"`;; \\\n    *) f=$$p;; \\\n  esac;\nam__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;\nam__install_max = 40\nam__nobase_strip_setup = \\\n  srcdirstrip=`echo \"$(srcdir)\" | sed 's/[].[^$$\\\\*|]/\\\\\\\\&/g'`\nam__nobase_strip = \\\n  for p in $$list; do echo \"$$p\"; done | sed -e \"s|$$srcdirstrip/||\"\nam__nobase_list = $(am__nobase_strip_setup); \\\n  for p in $$list; do echo \"$$p $$p\"; done | \\\n  sed \"s| $$srcdirstrip/| |;\"' / .*\\//!s/ .*/ ./; s,\\( .*\\)/[^/]*$$,\\1,' | \\\n  $(AWK) 'BEGIN { files[\".\"] = \"\" } { files[$$2] = files[$$2] \" \" $$1; \\\n    if (++n[$$2] == $(am__install_max)) \\\n      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = \"\" } } \\\n    END { for (dir in files) print dir, files[dir] }'\nam__base_list = \\\n  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\\n/ /g' | \\\n  sed '$$!N;$$!N;$$!N;$$!N;s/\\n/ /g'\nam__installdirs = \"$(DESTDIR)$(libdir)\" \\\n\t\"$(DESTDIR)$(libtiffincludedir)\" \\\n\t\"$(DESTDIR)$(libtiffincludedir)\"\nLTLIBRARIES = $(lib_LTLIBRARIES)\nlibtiff_la_DEPENDENCIES = $(LIBPORT)\nam_libtiff_la_OBJECTS = tif_aux.lo tif_close.lo tif_codec.lo \\\n\ttif_color.lo tif_compress.lo tif_dir.lo tif_dirinfo.lo \\\n\ttif_dirread.lo tif_dirwrite.lo tif_dumpmode.lo tif_error.lo \\\n\ttif_extension.lo tif_fax3.lo tif_fax3sm.lo tif_flush.lo \\\n\ttif_getimage.lo tif_jbig.lo tif_jpeg.lo tif_luv.lo tif_lzw.lo \\\n\ttif_next.lo tif_ojpeg.lo tif_open.lo tif_packbits.lo \\\n\ttif_pixarlog.lo tif_predict.lo tif_print.lo tif_read.lo \\\n\ttif_strip.lo tif_swab.lo tif_thunder.lo tif_tile.lo \\\n\ttif_unix.lo tif_version.lo tif_warning.lo tif_write.lo \\\n\ttif_zip.lo\nlibtiff_la_OBJECTS = $(am_libtiff_la_OBJECTS)\nAM_V_lt = $(am__v_lt_$(V))\nam__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))\nam__v_lt_0 = --silent\nlibtiff_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \\\n\t$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \\\n\t$(libtiff_la_LDFLAGS) $(LDFLAGS) -o $@\nam_libtiffxx_la_OBJECTS = tif_stream.lo\nlibtiffxx_la_OBJECTS = $(am_libtiffxx_la_OBJECTS)\nlibtiffxx_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \\\n\t$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \\\n\t$(CXXFLAGS) $(libtiffxx_la_LDFLAGS) $(LDFLAGS) -o $@\n@HAVE_CXX_TRUE@am_libtiffxx_la_rpath = -rpath $(libdir)\nPROGRAMS = $(noinst_PROGRAMS)\nam_mkg3states_OBJECTS = mkg3states.$(OBJEXT)\nmkg3states_OBJECTS = $(am_mkg3states_OBJECTS)\nmkg3states_DEPENDENCIES = $(LIBPORT)\nDEFAULT_INCLUDES = -I.@am__isrc@\ndepcomp = $(SHELL) $(top_srcdir)/config/depcomp\nam__depfiles_maybe = depfiles\nam__mv = mv -f\nCOMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \\\n\t$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)\nLTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \\\n\t$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \\\n\t$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \\\n\t$(AM_CFLAGS) $(CFLAGS)\nAM_V_CC = $(am__v_CC_$(V))\nam__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))\nam__v_CC_0 = @echo \"  CC    \" $@;\nAM_V_at = $(am__v_at_$(V))\nam__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))\nam__v_at_0 = @\nCCLD = $(CC)\nLINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \\\n\t$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \\\n\t$(AM_LDFLAGS) $(LDFLAGS) -o $@\nAM_V_CCLD = $(am__v_CCLD_$(V))\nam__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))\nam__v_CCLD_0 = @echo \"  CCLD  \" $@;\nCXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \\\n\t$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)\nLTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \\\n\t$(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \\\n\t$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \\\n\t$(AM_CXXFLAGS) $(CXXFLAGS)\nAM_V_CXX = $(am__v_CXX_$(V))\nam__v_CXX_ = $(am__v_CXX_$(AM_DEFAULT_VERBOSITY))\nam__v_CXX_0 = @echo \"  CXX   \" $@;\nCXXLD = $(CXX)\nCXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \\\n\t$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \\\n\t$(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@\nAM_V_CXXLD = $(am__v_CXXLD_$(V))\nam__v_CXXLD_ = $(am__v_CXXLD_$(AM_DEFAULT_VERBOSITY))\nam__v_CXXLD_0 = @echo \"  CXXLD \" $@;\nAM_V_GEN = $(am__v_GEN_$(V))\nam__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))\nam__v_GEN_0 = @echo \"  GEN   \" $@;\nSOURCES = $(libtiff_la_SOURCES) $(libtiffxx_la_SOURCES) \\\n\t$(mkg3states_SOURCES)\nDIST_SOURCES = $(libtiff_la_SOURCES) $(libtiffxx_la_SOURCES) \\\n\t$(mkg3states_SOURCES)\nam__libtiffinclude_HEADERS_DIST = tiff.h tiffio.h tiffvers.h \\\n\ttiffio.hxx\nHEADERS = $(libtiffinclude_HEADERS) $(nodist_libtiffinclude_HEADERS) \\\n\t$(noinst_HEADERS)\nETAGS = etags\nCTAGS = ctags\nDISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)\nACLOCAL = @ACLOCAL@\nAMTAR = @AMTAR@\nAM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@\nAR = @AR@\nAS = @AS@\nAUTOCONF = @AUTOCONF@\nAUTOHEADER = @AUTOHEADER@\nAUTOMAKE = @AUTOMAKE@\nAWK = @AWK@\nCC = @CC@\nCCDEPMODE = @CCDEPMODE@\nCFLAGS = @CFLAGS@\nCPP = @CPP@\nCPPFLAGS = @CPPFLAGS@\nCXX = @CXX@\nCXXCPP = @CXXCPP@\nCXXDEPMODE = @CXXDEPMODE@\nCXXFLAGS = @CXXFLAGS@\nCYGPATH_W = @CYGPATH_W@\nDEFS = @DEFS@\nDEPDIR = @DEPDIR@\nDLLTOOL = @DLLTOOL@\nDSYMUTIL = @DSYMUTIL@\nDUMPBIN = @DUMPBIN@\nECHO_C = @ECHO_C@\nECHO_N = @ECHO_N@\nECHO_T = @ECHO_T@\nEGREP = @EGREP@\nEXEEXT = @EXEEXT@\nFGREP = @FGREP@\nGLUT_CFLAGS = @GLUT_CFLAGS@\nGLUT_LIBS = @GLUT_LIBS@\nGLU_CFLAGS = @GLU_CFLAGS@\nGLU_LIBS = @GLU_LIBS@\nGL_CFLAGS = @GL_CFLAGS@\nGL_LIBS = @GL_LIBS@\nGREP = @GREP@\nINSTALL = @INSTALL@\nINSTALL_DATA = @INSTALL_DATA@\nINSTALL_PROGRAM = @INSTALL_PROGRAM@\nINSTALL_SCRIPT = @INSTALL_SCRIPT@\nINSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@\nLD = @LD@\nLDFLAGS = @LDFLAGS@\nLIBDIR = @LIBDIR@\nLIBOBJS = @LIBOBJS@\nLIBS = @LIBS@\nLIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@\nLIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@\nLIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@\nLIBTIFF_MICRO_VERSION = @LIBTIFF_MICRO_VERSION@\nLIBTIFF_MINOR_VERSION = @LIBTIFF_MINOR_VERSION@\nLIBTIFF_RELEASE_DATE = @LIBTIFF_RELEASE_DATE@\nLIBTIFF_VERSION = @LIBTIFF_VERSION@\nLIBTIFF_VERSION_INFO = @LIBTIFF_VERSION_INFO@\nLIBTOOL = @LIBTOOL@\nLIPO = @LIPO@\nLN_S = @LN_S@\nLTLIBOBJS = @LTLIBOBJS@\nMAINT = @MAINT@\nMAKEINFO = @MAKEINFO@\nMKDIR_P = @MKDIR_P@\nNM = @NM@\nNMEDIT = @NMEDIT@\nOBJDUMP = @OBJDUMP@\nOBJEXT = @OBJEXT@\nOTOOL = @OTOOL@\nOTOOL64 = @OTOOL64@\nPACKAGE = @PACKAGE@\nPACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@\nPACKAGE_NAME = @PACKAGE_NAME@\nPACKAGE_STRING = @PACKAGE_STRING@\nPACKAGE_TARNAME = @PACKAGE_TARNAME@\nPACKAGE_URL = @PACKAGE_URL@\nPACKAGE_VERSION = @PACKAGE_VERSION@\nPATH_SEPARATOR = @PATH_SEPARATOR@\nPTHREAD_CC = @PTHREAD_CC@\nPTHREAD_CFLAGS = @PTHREAD_CFLAGS@\nPTHREAD_LIBS = @PTHREAD_LIBS@\nRANLIB = @RANLIB@\nSED = @SED@\nSET_MAKE = @SET_MAKE@\nSHELL = @SHELL@\nSTRIP = @STRIP@\nVERSION = @VERSION@\nXMKMF = @XMKMF@\nX_CFLAGS = @X_CFLAGS@\nX_EXTRA_LIBS = @X_EXTRA_LIBS@\nX_LIBS = @X_LIBS@\nX_PRE_LIBS = @X_PRE_LIBS@\nabs_builddir = @abs_builddir@\nabs_srcdir = @abs_srcdir@\nabs_top_builddir = @abs_top_builddir@\nabs_top_srcdir = @abs_top_srcdir@\nac_ct_CC = @ac_ct_CC@\nac_ct_CXX = @ac_ct_CXX@\nac_ct_DUMPBIN = @ac_ct_DUMPBIN@\nacx_pthread_config = @acx_pthread_config@\nam__include = @am__include@\nam__leading_dot = @am__leading_dot@\nam__quote = @am__quote@\nam__tar = @am__tar@\nam__untar = @am__untar@\nbindir = @bindir@\nbuild = @build@\nbuild_alias = @build_alias@\nbuild_cpu = @build_cpu@\nbuild_os = @build_os@\nbuild_vendor = @build_vendor@\nbuilddir = @builddir@\ndatadir = @datadir@\ndatarootdir = @datarootdir@\ndocdir = @docdir@\ndvidir = @dvidir@\nexec_prefix = @exec_prefix@\nhost = @host@\nhost_alias = @host_alias@\nhost_cpu = @host_cpu@\nhost_os = @host_os@\nhost_vendor = @host_vendor@\nhtmldir = @htmldir@\nincludedir = @includedir@\ninfodir = @infodir@\ninstall_sh = @install_sh@\nlibdir = @libdir@\nlibexecdir = @libexecdir@\nlocaledir = @localedir@\nlocalstatedir = @localstatedir@\nlt_ECHO = @lt_ECHO@\nmandir = @mandir@\nmkdir_p = @mkdir_p@\noldincludedir = @oldincludedir@\npdfdir = @pdfdir@\nprefix = @prefix@\nprogram_transform_name = @program_transform_name@\npsdir = @psdir@\nsbindir = @sbindir@\nsharedstatedir = @sharedstatedir@\nsrcdir = @srcdir@\nsysconfdir = @sysconfdir@\ntarget = @target@\ntarget_alias = @target_alias@\ntarget_cpu = @target_cpu@\ntarget_os = @target_os@\ntarget_vendor = @target_vendor@\ntop_build_prefix = @top_build_prefix@\ntop_builddir = @top_builddir@\ntop_srcdir = @top_srcdir@\nLIBPORT = $(top_builddir)/port/libport.la\nLIBTIFF = $(top_builddir)/libtiff/libtiff.la\nlibtiffincludedir = $(includedir)\nEXTRA_DIST = Makefile.vc \\\n\t     SConstruct \\\n\t     tif_config.h-vms \\\n\t     tif_config.vc.h \\\n\t     tif_config.wince.h \\\n\t     tiffconf.vc.h \\\n\t     tiffconf.wince.h \\\n\t     libtiff.def \\\n\t     $(EXTRA_SRCS)\n\nlibtiffinclude_HEADERS = tiff.h tiffio.h tiffvers.h $(am__append_1)\nnoinst_HEADERS = \\\n\tt4.h \\\n\ttif_dir.h \\\n\ttif_predict.h \\\n\ttiffiop.h \\\n\tuvcode.h\n\nnodist_libtiffinclude_HEADERS = \\\n\ttiffconf.h\n\nlibtiff_la_SOURCES = \\\n\ttif_aux.c \\\n\ttif_close.c \\\n\ttif_codec.c \\\n\ttif_color.c \\\n\ttif_compress.c \\\n\ttif_dir.c \\\n\ttif_dirinfo.c \\\n\ttif_dirread.c \\\n\ttif_dirwrite.c \\\n\ttif_dumpmode.c \\\n\ttif_error.c \\\n\ttif_extension.c \\\n\ttif_fax3.c \\\n\ttif_fax3sm.c \\\n\ttif_flush.c \\\n\ttif_getimage.c \\\n\ttif_jbig.c \\\n\ttif_jpeg.c \\\n\ttif_luv.c \\\n\ttif_lzw.c \\\n\ttif_next.c \\\n\ttif_ojpeg.c \\\n\ttif_open.c \\\n\ttif_packbits.c \\\n\ttif_pixarlog.c \\\n\ttif_predict.c \\\n\ttif_print.c \\\n\ttif_read.c \\\n\ttif_strip.c \\\n\ttif_swab.c \\\n\ttif_thunder.c \\\n\ttif_tile.c \\\n\ttif_unix.c \\\n\ttif_version.c \\\n\ttif_warning.c \\\n\ttif_write.c \\\n\ttif_zip.c\n\nlibtiffxx_la_SOURCES = \\\n\ttif_stream.cxx\n\nEXTRA_SRCS = \\\n\ttif_acorn.c \\\n\ttif_apple.c \\\n\ttif_atari.c \\\n\ttif_msdos.c \\\n\ttif_next.c \\\n\ttif_win3.c \\\n\ttif_win32.c\n\nlib_LTLIBRARIES = libtiff.la $(am__append_2)\nlibtiff_la_LDFLAGS = -no-undefined -version-number \\\n\t$(LIBTIFF_VERSION_INFO) $(am__append_3)\nlibtiff_la_LIBADD = $(LIBPORT)\nlibtiffxx_la_LDFLAGS = -no-undefined -version-number \\\n\t$(LIBTIFF_VERSION_INFO) $(am__append_4)\nlibtiffxx_la_LIBADD = $(LIBTIFF) $(LIBPORT)\nlibtiffxx_la_DEPENDENCIES = libtiff.la\nmkg3states_SOURCES = mkg3states.c tif_fax3.h\nmkg3states_LDADD = $(LIBPORT)\nall: tif_config.h tiffconf.h\n\t$(MAKE) $(AM_MAKEFLAGS) all-am\n\n.SUFFIXES:\n.SUFFIXES: .c .cxx .lo .o .obj\n$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)\n\t@for dep in $?; do \\\n\t  case '$(am__configure_deps)' in \\\n\t    *$$dep*) \\\n\t      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \\\n\t        && { if test -f $@; then exit 0; else break; fi; }; \\\n\t      exit 1;; \\\n\t  esac; \\\n\tdone; \\\n\techo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign libtiff/Makefile'; \\\n\t$(am__cd) $(top_srcdir) && \\\n\t  $(AUTOMAKE) --foreign libtiff/Makefile\n.PRECIOUS: Makefile\nMakefile: $(srcdir)/Makefile.in $(top_builddir)/config.status\n\t@case '$?' in \\\n\t  *config.status*) \\\n\t    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \\\n\t  *) \\\n\t    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \\\n\t    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \\\n\tesac;\n\n$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n\n$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n$(am__aclocal_m4_deps):\n\ntif_config.h: stamp-h1\n\t@if test ! -f $@; then \\\n\t  rm -f stamp-h1; \\\n\t  $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \\\n\telse :; fi\n\nstamp-h1: $(srcdir)/tif_config.h.in $(top_builddir)/config.status\n\t@rm -f stamp-h1\n\tcd $(top_builddir) && $(SHELL) ./config.status libtiff/tif_config.h\n$(srcdir)/tif_config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) \n\t($(am__cd) $(top_srcdir) && $(AUTOHEADER))\n\trm -f stamp-h1\n\ttouch $@\n\ntiffconf.h: stamp-h2\n\t@if test ! -f $@; then \\\n\t  rm -f stamp-h2; \\\n\t  $(MAKE) $(AM_MAKEFLAGS) stamp-h2; \\\n\telse :; fi\n\nstamp-h2: $(srcdir)/tiffconf.h.in $(top_builddir)/config.status\n\t@rm -f stamp-h2\n\tcd $(top_builddir) && $(SHELL) ./config.status libtiff/tiffconf.h\n\ndistclean-hdr:\n\t-rm -f tif_config.h stamp-h1 tiffconf.h stamp-h2\ninstall-libLTLIBRARIES: $(lib_LTLIBRARIES)\n\t@$(NORMAL_INSTALL)\n\ttest -z \"$(libdir)\" || $(MKDIR_P) \"$(DESTDIR)$(libdir)\"\n\t@list='$(lib_LTLIBRARIES)'; test -n \"$(libdir)\" || list=; \\\n\tlist2=; for p in $$list; do \\\n\t  if test -f $$p; then \\\n\t    list2=\"$$list2 $$p\"; \\\n\t  else :; fi; \\\n\tdone; \\\n\ttest -z \"$$list2\" || { \\\n\t  echo \" $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'\"; \\\n\t  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 \"$(DESTDIR)$(libdir)\"; \\\n\t}\n\nuninstall-libLTLIBRARIES:\n\t@$(NORMAL_UNINSTALL)\n\t@list='$(lib_LTLIBRARIES)'; test -n \"$(libdir)\" || list=; \\\n\tfor p in $$list; do \\\n\t  $(am__strip_dir) \\\n\t  echo \" $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'\"; \\\n\t  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f \"$(DESTDIR)$(libdir)/$$f\"; \\\n\tdone\n\nclean-libLTLIBRARIES:\n\t-test -z \"$(lib_LTLIBRARIES)\" || rm -f $(lib_LTLIBRARIES)\n\t@list='$(lib_LTLIBRARIES)'; for p in $$list; do \\\n\t  dir=\"`echo $$p | sed -e 's|/[^/]*$$||'`\"; \\\n\t  test \"$$dir\" != \"$$p\" || dir=.; \\\n\t  echo \"rm -f \\\"$${dir}/so_locations\\\"\"; \\\n\t  rm -f \"$${dir}/so_locations\"; \\\n\tdone\nlibtiff.la: $(libtiff_la_OBJECTS) $(libtiff_la_DEPENDENCIES) \n\t$(AM_V_CCLD)$(libtiff_la_LINK) -rpath $(libdir) $(libtiff_la_OBJECTS) $(libtiff_la_LIBADD) $(LIBS)\nlibtiffxx.la: $(libtiffxx_la_OBJECTS) $(libtiffxx_la_DEPENDENCIES) \n\t$(AM_V_CXXLD)$(libtiffxx_la_LINK) $(am_libtiffxx_la_rpath) $(libtiffxx_la_OBJECTS) $(libtiffxx_la_LIBADD) $(LIBS)\n\nclean-noinstPROGRAMS:\n\t@list='$(noinst_PROGRAMS)'; test -n \"$$list\" || exit 0; \\\n\techo \" rm -f\" $$list; \\\n\trm -f $$list || exit $$?; \\\n\ttest -n \"$(EXEEXT)\" || exit 0; \\\n\tlist=`for p in $$list; do echo \"$$p\"; done | sed 's/$(EXEEXT)$$//'`; \\\n\techo \" rm -f\" $$list; \\\n\trm -f $$list\nmkg3states$(EXEEXT): $(mkg3states_OBJECTS) $(mkg3states_DEPENDENCIES) \n\t@rm -f mkg3states$(EXEEXT)\n\t$(AM_V_CCLD)$(LINK) $(mkg3states_OBJECTS) $(mkg3states_LDADD) $(LIBS)\n\nmostlyclean-compile:\n\t-rm -f *.$(OBJEXT)\n\ndistclean-compile:\n\t-rm -f *.tab.c\n\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mkg3states.Po@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_aux.Plo@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_close.Plo@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_codec.Plo@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_color.Plo@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_compress.Plo@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_dir.Plo@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_dirinfo.Plo@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_dirread.Plo@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_dirwrite.Plo@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_dumpmode.Plo@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_error.Plo@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_extension.Plo@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_fax3.Plo@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_fax3sm.Plo@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_flush.Plo@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_getimage.Plo@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_jbig.Plo@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_jpeg.Plo@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_luv.Plo@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_lzw.Plo@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_next.Plo@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_ojpeg.Plo@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_open.Plo@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_packbits.Plo@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_pixarlog.Plo@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_predict.Plo@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_print.Plo@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_read.Plo@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_stream.Plo@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_strip.Plo@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_swab.Plo@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_thunder.Plo@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_tile.Plo@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_unix.Plo@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_version.Plo@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_warning.Plo@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_write.Plo@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_zip.Plo@am__quote@\n\n.c.o:\n@am__fastdepCC_TRUE@\t$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<\n@am__fastdepCC_TRUE@\t$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po\n@am__fastdepCC_FALSE@\t$(AM_V_CC) @AM_BACKSLASH@\n@AMDEP_TRUE@@am__fastdepCC_FALSE@\tsource='$<' object='$@' libtool=no @AMDEPBACKSLASH@\n@AMDEP_TRUE@@am__fastdepCC_FALSE@\tDEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@\n@am__fastdepCC_FALSE@\t$(COMPILE) -c $<\n\n.c.obj:\n@am__fastdepCC_TRUE@\t$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`\n@am__fastdepCC_TRUE@\t$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po\n@am__fastdepCC_FALSE@\t$(AM_V_CC) @AM_BACKSLASH@\n@AMDEP_TRUE@@am__fastdepCC_FALSE@\tsource='$<' object='$@' libtool=no @AMDEPBACKSLASH@\n@AMDEP_TRUE@@am__fastdepCC_FALSE@\tDEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@\n@am__fastdepCC_FALSE@\t$(COMPILE) -c `$(CYGPATH_W) '$<'`\n\n.c.lo:\n@am__fastdepCC_TRUE@\t$(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<\n@am__fastdepCC_TRUE@\t$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo\n@am__fastdepCC_FALSE@\t$(AM_V_CC) @AM_BACKSLASH@\n@AMDEP_TRUE@@am__fastdepCC_FALSE@\tsource='$<' object='$@' libtool=yes @AMDEPBACKSLASH@\n@AMDEP_TRUE@@am__fastdepCC_FALSE@\tDEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@\n@am__fastdepCC_FALSE@\t$(LTCOMPILE) -c -o $@ $<\n\n.cxx.o:\n@am__fastdepCXX_TRUE@\t$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<\n@am__fastdepCXX_TRUE@\t$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po\n@am__fastdepCXX_FALSE@\t$(AM_V_CXX) @AM_BACKSLASH@\n@AMDEP_TRUE@@am__fastdepCXX_FALSE@\tsource='$<' object='$@' libtool=no @AMDEPBACKSLASH@\n@AMDEP_TRUE@@am__fastdepCXX_FALSE@\tDEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@\n@am__fastdepCXX_FALSE@\t$(CXXCOMPILE) -c -o $@ $<\n\n.cxx.obj:\n@am__fastdepCXX_TRUE@\t$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`\n@am__fastdepCXX_TRUE@\t$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po\n@am__fastdepCXX_FALSE@\t$(AM_V_CXX) @AM_BACKSLASH@\n@AMDEP_TRUE@@am__fastdepCXX_FALSE@\tsource='$<' object='$@' libtool=no @AMDEPBACKSLASH@\n@AMDEP_TRUE@@am__fastdepCXX_FALSE@\tDEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@\n@am__fastdepCXX_FALSE@\t$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`\n\n.cxx.lo:\n@am__fastdepCXX_TRUE@\t$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<\n@am__fastdepCXX_TRUE@\t$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo\n@am__fastdepCXX_FALSE@\t$(AM_V_CXX) @AM_BACKSLASH@\n@AMDEP_TRUE@@am__fastdepCXX_FALSE@\tsource='$<' object='$@' libtool=yes @AMDEPBACKSLASH@\n@AMDEP_TRUE@@am__fastdepCXX_FALSE@\tDEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@\n@am__fastdepCXX_FALSE@\t$(LTCXXCOMPILE) -c -o $@ $<\n\nmostlyclean-libtool:\n\t-rm -f *.lo\n\nclean-libtool:\n\t-rm -rf .libs _libs\ninstall-libtiffincludeHEADERS: $(libtiffinclude_HEADERS)\n\t@$(NORMAL_INSTALL)\n\ttest -z \"$(libtiffincludedir)\" || $(MKDIR_P) \"$(DESTDIR)$(libtiffincludedir)\"\n\t@list='$(libtiffinclude_HEADERS)'; test -n \"$(libtiffincludedir)\" || list=; \\\n\tfor p in $$list; do \\\n\t  if test -f \"$$p\"; then d=; else d=\"$(srcdir)/\"; fi; \\\n\t  echo \"$$d$$p\"; \\\n\tdone | $(am__base_list) | \\\n\twhile read files; do \\\n\t  echo \" $(INSTALL_HEADER) $$files '$(DESTDIR)$(libtiffincludedir)'\"; \\\n\t  $(INSTALL_HEADER) $$files \"$(DESTDIR)$(libtiffincludedir)\" || exit $$?; \\\n\tdone\n\nuninstall-libtiffincludeHEADERS:\n\t@$(NORMAL_UNINSTALL)\n\t@list='$(libtiffinclude_HEADERS)'; test -n \"$(libtiffincludedir)\" || list=; \\\n\tfiles=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \\\n\ttest -n \"$$files\" || exit 0; \\\n\techo \" ( cd '$(DESTDIR)$(libtiffincludedir)' && rm -f\" $$files \")\"; \\\n\tcd \"$(DESTDIR)$(libtiffincludedir)\" && rm -f $$files\ninstall-nodist_libtiffincludeHEADERS: $(nodist_libtiffinclude_HEADERS)\n\t@$(NORMAL_INSTALL)\n\ttest -z \"$(libtiffincludedir)\" || $(MKDIR_P) \"$(DESTDIR)$(libtiffincludedir)\"\n\t@list='$(nodist_libtiffinclude_HEADERS)'; test -n \"$(libtiffincludedir)\" || list=; \\\n\tfor p in $$list; do \\\n\t  if test -f \"$$p\"; then d=; else d=\"$(srcdir)/\"; fi; \\\n\t  echo \"$$d$$p\"; \\\n\tdone | $(am__base_list) | \\\n\twhile read files; do \\\n\t  echo \" $(INSTALL_HEADER) $$files '$(DESTDIR)$(libtiffincludedir)'\"; \\\n\t  $(INSTALL_HEADER) $$files \"$(DESTDIR)$(libtiffincludedir)\" || exit $$?; \\\n\tdone\n\nuninstall-nodist_libtiffincludeHEADERS:\n\t@$(NORMAL_UNINSTALL)\n\t@list='$(nodist_libtiffinclude_HEADERS)'; test -n \"$(libtiffincludedir)\" || list=; \\\n\tfiles=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \\\n\ttest -n \"$$files\" || exit 0; \\\n\techo \" ( cd '$(DESTDIR)$(libtiffincludedir)' && rm -f\" $$files \")\"; \\\n\tcd \"$(DESTDIR)$(libtiffincludedir)\" && rm -f $$files\n\nID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)\n\tlist='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \\\n\tunique=`for i in $$list; do \\\n\t    if test -f \"$$i\"; then echo $$i; else echo $(srcdir)/$$i; fi; \\\n\t  done | \\\n\t  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \\\n\t      END { if (nonempty) { for (i in files) print i; }; }'`; \\\n\tmkid -fID $$unique\ntags: TAGS\n\nTAGS:  $(HEADERS) $(SOURCES) tif_config.h.in tiffconf.h.in $(TAGS_DEPENDENCIES) \\\n\t\t$(TAGS_FILES) $(LISP)\n\tset x; \\\n\there=`pwd`; \\\n\tlist='$(SOURCES) $(HEADERS) tif_config.h.in tiffconf.h.in $(LISP) $(TAGS_FILES)'; \\\n\tunique=`for i in $$list; do \\\n\t    if test -f \"$$i\"; then echo $$i; else echo $(srcdir)/$$i; fi; \\\n\t  done | \\\n\t  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \\\n\t      END { if (nonempty) { for (i in files) print i; }; }'`; \\\n\tshift; \\\n\tif test -z \"$(ETAGS_ARGS)$$*$$unique\"; then :; else \\\n\t  test -n \"$$unique\" || unique=$$empty_fix; \\\n\t  if test $$# -gt 0; then \\\n\t    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \\\n\t      \"$$@\" $$unique; \\\n\t  else \\\n\t    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \\\n\t      $$unique; \\\n\t  fi; \\\n\tfi\nctags: CTAGS\nCTAGS:  $(HEADERS) $(SOURCES) tif_config.h.in tiffconf.h.in $(TAGS_DEPENDENCIES) \\\n\t\t$(TAGS_FILES) $(LISP)\n\tlist='$(SOURCES) $(HEADERS) tif_config.h.in tiffconf.h.in $(LISP) $(TAGS_FILES)'; \\\n\tunique=`for i in $$list; do \\\n\t    if test -f \"$$i\"; then echo $$i; else echo $(srcdir)/$$i; fi; \\\n\t  done | \\\n\t  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \\\n\t      END { if (nonempty) { for (i in files) print i; }; }'`; \\\n\ttest -z \"$(CTAGS_ARGS)$$unique\" \\\n\t  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \\\n\t     $$unique\n\nGTAGS:\n\there=`$(am__cd) $(top_builddir) && pwd` \\\n\t  && $(am__cd) $(top_srcdir) \\\n\t  && gtags -i $(GTAGS_ARGS) \"$$here\"\n\ndistclean-tags:\n\t-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags\n\ndistdir: $(DISTFILES)\n\t@srcdirstrip=`echo \"$(srcdir)\" | sed 's/[].[^$$\\\\*]/\\\\\\\\&/g'`; \\\n\ttopsrcdirstrip=`echo \"$(top_srcdir)\" | sed 's/[].[^$$\\\\*]/\\\\\\\\&/g'`; \\\n\tlist='$(DISTFILES)'; \\\n\t  dist_files=`for file in $$list; do echo $$file; done | \\\n\t  sed -e \"s|^$$srcdirstrip/||;t\" \\\n\t      -e \"s|^$$topsrcdirstrip/|$(top_builddir)/|;t\"`; \\\n\tcase $$dist_files in \\\n\t  */*) $(MKDIR_P) `echo \"$$dist_files\" | \\\n\t\t\t   sed '/\\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \\\n\t\t\t   sort -u` ;; \\\n\tesac; \\\n\tfor file in $$dist_files; do \\\n\t  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \\\n\t  if test -d $$d/$$file; then \\\n\t    dir=`echo \"/$$file\" | sed -e 's,/[^/]*$$,,'`; \\\n\t    if test -d \"$(distdir)/$$file\"; then \\\n\t      find \"$(distdir)/$$file\" -type d ! -perm -700 -exec chmod u+rwx {} \\;; \\\n\t    fi; \\\n\t    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \\\n\t      cp -fpR $(srcdir)/$$file \"$(distdir)$$dir\" || exit 1; \\\n\t      find \"$(distdir)/$$file\" -type d ! -perm -700 -exec chmod u+rwx {} \\;; \\\n\t    fi; \\\n\t    cp -fpR $$d/$$file \"$(distdir)$$dir\" || exit 1; \\\n\t  else \\\n\t    test -f \"$(distdir)/$$file\" \\\n\t    || cp -p $$d/$$file \"$(distdir)/$$file\" \\\n\t    || exit 1; \\\n\t  fi; \\\n\tdone\ncheck-am: all-am\ncheck: check-am\nall-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(HEADERS) tif_config.h \\\n\t\ttiffconf.h\ninstalldirs:\n\tfor dir in \"$(DESTDIR)$(libdir)\" \"$(DESTDIR)$(libtiffincludedir)\" \"$(DESTDIR)$(libtiffincludedir)\"; do \\\n\t  test -z \"$$dir\" || $(MKDIR_P) \"$$dir\"; \\\n\tdone\ninstall: install-am\ninstall-exec: install-exec-am\ninstall-data: install-data-am\nuninstall: uninstall-am\n\ninstall-am: all-am\n\t@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am\n\ninstallcheck: installcheck-am\ninstall-strip:\n\t$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM=\"$(INSTALL_STRIP_PROGRAM)\" \\\n\t  install_sh_PROGRAM=\"$(INSTALL_STRIP_PROGRAM)\" INSTALL_STRIP_FLAG=-s \\\n\t  `test -z '$(STRIP)' || \\\n\t    echo \"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'\"` install\nmostlyclean-generic:\n\nclean-generic:\n\ndistclean-generic:\n\t-test -z \"$(CONFIG_CLEAN_FILES)\" || rm -f $(CONFIG_CLEAN_FILES)\n\t-test . = \"$(srcdir)\" || test -z \"$(CONFIG_CLEAN_VPATH_FILES)\" || rm -f $(CONFIG_CLEAN_VPATH_FILES)\n\nmaintainer-clean-generic:\n\t@echo \"This command is intended for maintainers to use\"\n\t@echo \"it deletes files that may require special tools to rebuild.\"\nclean: clean-am\n\nclean-am: clean-generic clean-libLTLIBRARIES clean-libtool \\\n\tclean-noinstPROGRAMS mostlyclean-am\n\ndistclean: distclean-am\n\t-rm -rf ./$(DEPDIR)\n\t-rm -f Makefile\ndistclean-am: clean-am distclean-compile distclean-generic \\\n\tdistclean-hdr distclean-tags\n\ndvi: dvi-am\n\ndvi-am:\n\nhtml: html-am\n\nhtml-am:\n\ninfo: info-am\n\ninfo-am:\n\ninstall-data-am: install-libtiffincludeHEADERS \\\n\tinstall-nodist_libtiffincludeHEADERS\n\ninstall-dvi: install-dvi-am\n\ninstall-dvi-am:\n\ninstall-exec-am: install-libLTLIBRARIES\n\ninstall-html: install-html-am\n\ninstall-html-am:\n\ninstall-info: install-info-am\n\ninstall-info-am:\n\ninstall-man:\n\ninstall-pdf: install-pdf-am\n\ninstall-pdf-am:\n\ninstall-ps: install-ps-am\n\ninstall-ps-am:\n\ninstallcheck-am:\n\nmaintainer-clean: maintainer-clean-am\n\t-rm -rf ./$(DEPDIR)\n\t-rm -f Makefile\nmaintainer-clean-am: distclean-am maintainer-clean-generic\n\nmostlyclean: mostlyclean-am\n\nmostlyclean-am: mostlyclean-compile mostlyclean-generic \\\n\tmostlyclean-libtool\n\npdf: pdf-am\n\npdf-am:\n\nps: ps-am\n\nps-am:\n\nuninstall-am: uninstall-libLTLIBRARIES uninstall-libtiffincludeHEADERS \\\n\tuninstall-nodist_libtiffincludeHEADERS\n\n.MAKE: all install-am install-strip\n\n.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \\\n\tclean-libLTLIBRARIES clean-libtool clean-noinstPROGRAMS ctags \\\n\tdistclean distclean-compile distclean-generic distclean-hdr \\\n\tdistclean-libtool distclean-tags distdir dvi dvi-am html \\\n\thtml-am info info-am install install-am install-data \\\n\tinstall-data-am install-dvi install-dvi-am install-exec \\\n\tinstall-exec-am install-html install-html-am install-info \\\n\tinstall-info-am install-libLTLIBRARIES \\\n\tinstall-libtiffincludeHEADERS install-man \\\n\tinstall-nodist_libtiffincludeHEADERS install-pdf \\\n\tinstall-pdf-am install-ps install-ps-am install-strip \\\n\tinstallcheck installcheck-am installdirs maintainer-clean \\\n\tmaintainer-clean-generic mostlyclean mostlyclean-compile \\\n\tmostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \\\n\ttags uninstall uninstall-am uninstall-libLTLIBRARIES \\\n\tuninstall-libtiffincludeHEADERS \\\n\tuninstall-nodist_libtiffincludeHEADERS\n\n\nfaxtable: mkg3states\n\t(rm -f tif_fax3sm.c && ./mkg3states -b -c const tif_fax3sm.c)\n\n# Tell versions [3.59,3.63) of GNU make to not export all variables.\n# Otherwise a system limit (for SysV at least) may be exceeded.\n.NOEXPORT:\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/Makefile.vc",
    "content": "# $Id: Makefile.vc,v 1.17.2.2 2007/07/18 14:30:05 dron Exp $\n#\n# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>\n#\n# Permission to use, copy, modify, distribute, and sell this software and \n# its documentation for any purpose is hereby granted without fee, provided\n# that (i) the above copyright notices and this permission notice appear in\n# all copies of the software and related documentation, and (ii) the names of\n# Sam Leffler and Silicon Graphics may not be used in any advertising or\n# publicity relating to the software without the specific, prior written\n# permission of Sam Leffler and Silicon Graphics.\n# \n# THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n# \n# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n# OF THIS SOFTWARE.\n#\n# Makefile for MS Visual C and Watcom C compilers.\n#\n# To build:\n# C:\\libtiff\\libtiff> nmake /f makefile.vc all\n#\n\n!INCLUDE ..\\nmake.opt\n\nINCL\t= -I. $(JPEG_INCLUDE) $(ZLIB_INCLUDE) $(JBIG_INCLUDE)\n\n!IFDEF USE_WIN_CRT_LIB\nOBJ_SYSDEP_MODULE = tif_unix.obj\n!ELSE\nOBJ_SYSDEP_MODULE = tif_win32.obj\n!ENDIF\n\nOBJ\t= \\\n\ttif_aux.obj \\\n\ttif_close.obj \\\n\ttif_codec.obj \\\n\ttif_color.obj \\\n\ttif_compress.obj \\\n\ttif_dir.obj \\\n\ttif_dirinfo.obj \\\n\ttif_dirread.obj \\\n\ttif_dirwrite.obj \\\n\ttif_dumpmode.obj \\\n\ttif_error.obj \\\n\ttif_extension.obj \\\n\ttif_fax3.obj \\\n\ttif_fax3sm.obj \\\n\ttif_getimage.obj \\\n\ttif_jbig.obj \\\n\ttif_jpeg.obj \\\n\ttif_ojpeg.obj \\\n\ttif_flush.obj \\\n\ttif_luv.obj \\\n\ttif_lzw.obj \\\n\ttif_next.obj \\\n\ttif_open.obj \\\n\ttif_packbits.obj \\\n\ttif_pixarlog.obj \\\n\ttif_predict.obj \\\n\ttif_print.obj \\\n\ttif_read.obj \\\n\ttif_stream.obj \\\n\ttif_swab.obj \\\n\ttif_strip.obj \\\n\ttif_thunder.obj \\\n\ttif_tile.obj \\\n\ttif_version.obj \\\n\ttif_warning.obj \\\n\ttif_write.obj \\\n\ttif_zip.obj \\\n\ttif_jbig.obj \\\n\t$(OBJ_SYSDEP_MODULE)\n\nall:\tlibtiff.lib $(DLLNAME)\n\ntif_config.h:\ttif_config.vc.h\n\tcopy tif_config.vc.h tif_config.h\n\ntiffconf.h:\ttiffconf.vc.h\n\tcopy tiffconf.vc.h tiffconf.h\n\nlibtiff.lib:\ttif_config.h tiffconf.h $(OBJ)\n\t$(AR) /out:libtiff.lib $(OBJ) $(LIBS)\n\n$(DLLNAME):\ttif_config.h tiffconf.h libtiff.def $(OBJ)\n\t$(LD) /debug /dll /def:libtiff.def /out:$(DLLNAME) \\\n\t/implib:libtiff_i.lib $(OBJ) $(LIBS)\n\t\nclean:\n\t-del tif_config.h tiffconf.h\n\t-del *.obj\n\t-del *.lib\n\t-del *.dll\n\t-del *.exe\n\t-del *.pdb\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/SConstruct",
    "content": "# $Id: SConstruct,v 1.4 2007/02/24 15:03:50 dron Exp $\n\n# Tag Image File Format (TIFF) Software\n#\n# Copyright (C) 2005, Andrey Kiselev <dron@ak4719.spb.edu>\n#\n# Permission to use, copy, modify, distribute, and sell this software and \n# its documentation for any purpose is hereby granted without fee, provided\n# that (i) the above copyright notices and this permission notice appear in\n# all copies of the software and related documentation, and (ii) the names of\n# Sam Leffler and Silicon Graphics may not be used in any advertising or\n# publicity relating to the software without the specific, prior written\n# permission of Sam Leffler and Silicon Graphics.\n# \n# THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n# \n# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n# OF THIS SOFTWARE.\n\n# This file contains rules to build software with the SCons tool\n# (see the http://www.scons.org/ for details on SCons).\n\n# Import globally defined options\nImport([ 'env', 'idir_lib' ])\n\nSRCS = [ \\\n\t'tif_aux.c', \\\n\t'tif_close.c', \\\n\t'tif_codec.c', \\\n\t'tif_color.c', \\\n\t'tif_compress.c', \\\n\t'tif_dir.c', \\\n\t'tif_dirinfo.c', \\\n\t'tif_dirread.c', \\\n\t'tif_dirwrite.c', \\\n\t'tif_dumpmode.c', \\\n\t'tif_error.c', \\\n\t'tif_extension.c', \\\n\t'tif_fax3.c', \\\n\t'tif_fax3sm.c', \\\n\t'tif_flush.c', \\\n\t'tif_getimage.c', \\\n\t'tif_jbig.c', \\\n\t'tif_jpeg.c', \\\n\t'tif_luv.c', \\\n\t'tif_lzw.c', \\\n\t'tif_next.c', \\\n\t'tif_ojpeg.c', \\\n\t'tif_open.c', \\\n\t'tif_packbits.c', \\\n\t'tif_pixarlog.c', \\\n\t'tif_predict.c', \\\n\t'tif_print.c', \\\n\t'tif_read.c', \\\n\t'tif_strip.c', \\\n\t'tif_swab.c', \\\n\t'tif_thunder.c', \\\n\t'tif_tile.c', \\\n\t'tif_unix.c', \\\n\t'tif_version.c', \\\n\t'tif_warning.c', \\\n\t'tif_write.c', \\\n\t'tif_zip.c' ]\n\nStaticLibrary('tiff', SRCS)\nSharedLibrary('tiff', SRCS)\n\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/libtiff.def",
    "content": "EXPORTS TIFFOpen\n\tTIFFOpenW\n\tTIFFGetVersion\n\tTIFFCleanup\n\tTIFFClose\n\tTIFFFlush\n\tTIFFFlushData\n\tTIFFGetField\n\tTIFFVGetField\n\tTIFFGetFieldDefaulted\n\tTIFFVGetFieldDefaulted\n\tTIFFGetTagListEntry\n\tTIFFGetTagListCount\n\tTIFFReadDirectory\n\tTIFFScanlineSize\n\tTIFFStripSize\n\tTIFFVStripSize\n\tTIFFRawStripSize\n\tTIFFTileRowSize\n\tTIFFTileSize\n\tTIFFVTileSize\n\tTIFFFileno\n\tTIFFSetFileno\n\tTIFFGetMode\n\tTIFFIsTiled\n\tTIFFIsByteSwapped\n\tTIFFIsBigEndian\n\tTIFFIsMSB2LSB\n\tTIFFIsUpSampled\n\tTIFFCIELabToRGBInit\n\tTIFFCIELabToXYZ\n\tTIFFXYZToRGB\n\tTIFFYCbCrToRGBInit\n\tTIFFYCbCrtoRGB\n\tTIFFCurrentRow\n\tTIFFCurrentDirectory\n\tTIFFCurrentStrip\n\tTIFFCurrentTile\n\tTIFFDataWidth\n\tTIFFReadBufferSetup\n\tTIFFWriteBufferSetup\n\tTIFFSetupStrips\n\tTIFFLastDirectory\n\tTIFFSetDirectory\n\tTIFFSetSubDirectory\n\tTIFFUnlinkDirectory\n\tTIFFSetField\n\tTIFFVSetField\n\tTIFFCheckpointDirectory\n\tTIFFWriteDirectory\n\tTIFFRewriteDirectory\n\tTIFFPrintDirectory\n\tTIFFReadScanline\n\tTIFFWriteScanline\n\tTIFFReadRGBAImage\n\tTIFFReadRGBAImageOriented\n\tTIFFFdOpen\n\tTIFFClientOpen\n\tTIFFFileName\n\tTIFFError\n\tTIFFErrorExt\n\tTIFFWarning\n\tTIFFWarningExt\n\tTIFFSetErrorHandler\n\tTIFFSetErrorHandlerExt\n\tTIFFSetWarningHandler\n\tTIFFSetWarningHandlerExt\n\tTIFFComputeTile\n\tTIFFCheckTile\n\tTIFFNumberOfTiles\n\tTIFFReadTile\n\tTIFFWriteTile\n\tTIFFComputeStrip\n\tTIFFNumberOfStrips\n\tTIFFRGBAImageBegin\n\tTIFFRGBAImageGet\n\tTIFFRGBAImageEnd\n\tTIFFReadEncodedStrip\n\tTIFFReadRawStrip\n\tTIFFReadEncodedTile\n\tTIFFReadRawTile\n\tTIFFReadRGBATile\n\tTIFFReadRGBAStrip\n\tTIFFWriteEncodedStrip\n\tTIFFWriteRawStrip\n\tTIFFWriteEncodedTile\n\tTIFFWriteRawTile\n\tTIFFSetWriteOffset\n\tTIFFSwabDouble\n\tTIFFSwabShort\n\tTIFFSwabLong\n\tTIFFSwabArrayOfShort\n\tTIFFSwabArrayOfLong\n\tTIFFSwabArrayOfDouble\n\tTIFFSwabArrayOfTriples\n\tTIFFReverseBits\n\tTIFFGetBitRevTable\n\tTIFFDefaultStripSize\n\tTIFFDefaultTileSize\n\tTIFFRasterScanlineSize\n\t_TIFFmalloc\n\t_TIFFrealloc\n\t_TIFFfree\n\t_TIFFmemset\n\t_TIFFmemcpy\n\t_TIFFmemcmp\n\tTIFFCreateDirectory\n\tTIFFSetTagExtender\n\tTIFFMergeFieldInfo\n\tTIFFFindFieldInfo\n\tTIFFFindFieldInfoByName\n\tTIFFFieldWithName\n\tTIFFFieldWithTag\n\tTIFFCurrentDirOffset\n\tTIFFWriteCheck\n\tTIFFRGBAImageOK\n\tTIFFNumberOfDirectories\n\tTIFFSetFileName\n\tTIFFSetClientdata\n\tTIFFSetMode\n\tTIFFClientdata\n\tTIFFGetReadProc\n\tTIFFGetWriteProc\n\tTIFFGetSeekProc\n\tTIFFGetCloseProc\n\tTIFFGetSizeProc\n\tTIFFGetMapFileProc\n\tTIFFGetUnmapFileProc\n\tTIFFIsCODECConfigured\n\tTIFFGetConfiguredCODECs\n \tTIFFFindCODEC\n \tTIFFRegisterCODEC\n \tTIFFUnRegisterCODEC\n\tTIFFFreeDirectory\n\tTIFFReadCustomDirectory\n\tTIFFReadEXIFDirectory\n \tTIFFAccessTagMethods\n \tTIFFGetClientInfo\n \tTIFFSetClientInfo\n \tTIFFReassignTagToIgnore\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/mkg3states.c",
    "content": "/* \"$Id: mkg3states.c,v 1.10 2007/02/22 11:27:17 dron Exp $ */\n\n/*\n * Copyright (c) 1991-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n/* Initialise fax decoder tables\n * Decoder support is derived, with permission, from the code\n * in Frank Cringle's viewfax program;\n *      Copyright (C) 1990, 1995  Frank D. Cringle.\n */\n#include \"tif_config.h\"\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n#ifdef HAVE_UNISTD_H\n# include <unistd.h>\n#endif\n\n#include \"tif_fax3.h\"\n\n#ifndef HAVE_GETOPT\nextern int getopt(int, char**, char*);\n#endif\n\n#define\tstreq(a,b)\t(strcmp(a,b) == 0)\n\n/* NB: can't use names in tif_fax3.h 'cuz they are declared const */\nTIFFFaxTabEnt MainTable[128];\nTIFFFaxTabEnt WhiteTable[4096];\nTIFFFaxTabEnt BlackTable[8192];\n\nstruct proto {\n    uint16 code;\t\t/* right justified, lsb-first, zero filled */\n    uint16 val;\t\t/* (pixel count)<<4 + code width  */\n};\n\nstatic struct proto Pass[] = {\n{ 0x0008, 4 },\n{ 0, 0 }\n};\n\nstatic struct proto Horiz[]  = {\n{ 0x0004, 3 },\n{ 0, 0 }\n};\n\nstatic struct proto V0[]  = {\n{ 0x0001, 1 },\n{ 0, 0 }\n};\n\nstatic struct proto VR[]  = {\n{ 0x0006, (1<<4)+3 },\n{ 0x0030, (2<<4)+6 },\n{ 0x0060, (3<<4)+7 },\n{ 0, 0 }\n};\n\nstatic struct proto VL[]  = {\n{ 0x0002, (1<<4)+3 },\n{ 0x0010, (2<<4)+6 },\n{ 0x0020, (3<<4)+7 },\n{ 0, 0 }\n};\n\nstatic struct proto Ext[]  = {\n{ 0x0040, 7 },\n{ 0, 0 }\n};\n\nstatic struct proto EOLV[]  = {\n{ 0x0000, 7 },\n{ 0, 0 }\n};\n\nstatic struct proto MakeUpW[] = {\n{ 0x001b, 1029 },\n{ 0x0009, 2053 },\n{ 0x003a, 3078 },\n{ 0x0076, 4103 },\n{ 0x006c, 5128 },\n{ 0x00ec, 6152 },\n{ 0x0026, 7176 },\n{ 0x00a6, 8200 },\n{ 0x0016, 9224 },\n{ 0x00e6, 10248 },\n{ 0x0066, 11273 },\n{ 0x0166, 12297 },\n{ 0x0096, 13321 },\n{ 0x0196, 14345 },\n{ 0x0056, 15369 },\n{ 0x0156, 16393 },\n{ 0x00d6, 17417 },\n{ 0x01d6, 18441 },\n{ 0x0036, 19465 },\n{ 0x0136, 20489 },\n{ 0x00b6, 21513 },\n{ 0x01b6, 22537 },\n{ 0x0032, 23561 },\n{ 0x0132, 24585 },\n{ 0x00b2, 25609 },\n{ 0x0006, 26630 },\n{ 0x01b2, 27657 },\n{ 0, 0 }\n};\n\nstatic struct proto MakeUpB[] = {\n{ 0x03c0, 1034 },\n{ 0x0130, 2060 },\n{ 0x0930, 3084 },\n{ 0x0da0, 4108 },\n{ 0x0cc0, 5132 },\n{ 0x02c0, 6156 },\n{ 0x0ac0, 7180 },\n{ 0x06c0, 8205 },\n{ 0x16c0, 9229 },\n{ 0x0a40, 10253 },\n{ 0x1a40, 11277 },\n{ 0x0640, 12301 },\n{ 0x1640, 13325 },\n{ 0x09c0, 14349 },\n{ 0x19c0, 15373 },\n{ 0x05c0, 16397 },\n{ 0x15c0, 17421 },\n{ 0x0dc0, 18445 },\n{ 0x1dc0, 19469 },\n{ 0x0940, 20493 },\n{ 0x1940, 21517 },\n{ 0x0540, 22541 },\n{ 0x1540, 23565 },\n{ 0x0b40, 24589 },\n{ 0x1b40, 25613 },\n{ 0x04c0, 26637 },\n{ 0x14c0, 27661 },\n{ 0, 0 }\n};\n\nstatic struct proto MakeUp[] = {\n{ 0x0080, 28683 },\n{ 0x0180, 29707 },\n{ 0x0580, 30731 },\n{ 0x0480, 31756 },\n{ 0x0c80, 32780 },\n{ 0x0280, 33804 },\n{ 0x0a80, 34828 },\n{ 0x0680, 35852 },\n{ 0x0e80, 36876 },\n{ 0x0380, 37900 },\n{ 0x0b80, 38924 },\n{ 0x0780, 39948 },\n{ 0x0f80, 40972 },\n{ 0, 0 }\n};\n\nstatic struct proto TermW[] = {\n{ 0x00ac, 8 },\n{ 0x0038, 22 },\n{ 0x000e, 36 },\n{ 0x0001, 52 },\n{ 0x000d, 68 },\n{ 0x0003, 84 },\n{ 0x0007, 100 },\n{ 0x000f, 116 },\n{ 0x0019, 133 },\n{ 0x0005, 149 },\n{ 0x001c, 165 },\n{ 0x0002, 181 },\n{ 0x0004, 198 },\n{ 0x0030, 214 },\n{ 0x000b, 230 },\n{ 0x002b, 246 },\n{ 0x0015, 262 },\n{ 0x0035, 278 },\n{ 0x0072, 295 },\n{ 0x0018, 311 },\n{ 0x0008, 327 },\n{ 0x0074, 343 },\n{ 0x0060, 359 },\n{ 0x0010, 375 },\n{ 0x000a, 391 },\n{ 0x006a, 407 },\n{ 0x0064, 423 },\n{ 0x0012, 439 },\n{ 0x000c, 455 },\n{ 0x0040, 472 },\n{ 0x00c0, 488 },\n{ 0x0058, 504 },\n{ 0x00d8, 520 },\n{ 0x0048, 536 },\n{ 0x00c8, 552 },\n{ 0x0028, 568 },\n{ 0x00a8, 584 },\n{ 0x0068, 600 },\n{ 0x00e8, 616 },\n{ 0x0014, 632 },\n{ 0x0094, 648 },\n{ 0x0054, 664 },\n{ 0x00d4, 680 },\n{ 0x0034, 696 },\n{ 0x00b4, 712 },\n{ 0x0020, 728 },\n{ 0x00a0, 744 },\n{ 0x0050, 760 },\n{ 0x00d0, 776 },\n{ 0x004a, 792 },\n{ 0x00ca, 808 },\n{ 0x002a, 824 },\n{ 0x00aa, 840 },\n{ 0x0024, 856 },\n{ 0x00a4, 872 },\n{ 0x001a, 888 },\n{ 0x009a, 904 },\n{ 0x005a, 920 },\n{ 0x00da, 936 },\n{ 0x0052, 952 },\n{ 0x00d2, 968 },\n{ 0x004c, 984 },\n{ 0x00cc, 1000 },\n{ 0x002c, 1016 },\n{ 0, 0 }\n};\n\nstatic struct proto TermB[] = {\n{ 0x03b0, 10 },\n{ 0x0002, 19 },\n{ 0x0003, 34 },\n{ 0x0001, 50 },\n{ 0x0006, 67 },\n{ 0x000c, 84 },\n{ 0x0004, 100 },\n{ 0x0018, 117 },\n{ 0x0028, 134 },\n{ 0x0008, 150 },\n{ 0x0010, 167 },\n{ 0x0050, 183 },\n{ 0x0070, 199 },\n{ 0x0020, 216 },\n{ 0x00e0, 232 },\n{ 0x0030, 249 },\n{ 0x03a0, 266 },\n{ 0x0060, 282 },\n{ 0x0040, 298 },\n{ 0x0730, 315 },\n{ 0x00b0, 331 },\n{ 0x01b0, 347 },\n{ 0x0760, 363 },\n{ 0x00a0, 379 },\n{ 0x0740, 395 },\n{ 0x00c0, 411 },\n{ 0x0530, 428 },\n{ 0x0d30, 444 },\n{ 0x0330, 460 },\n{ 0x0b30, 476 },\n{ 0x0160, 492 },\n{ 0x0960, 508 },\n{ 0x0560, 524 },\n{ 0x0d60, 540 },\n{ 0x04b0, 556 },\n{ 0x0cb0, 572 },\n{ 0x02b0, 588 },\n{ 0x0ab0, 604 },\n{ 0x06b0, 620 },\n{ 0x0eb0, 636 },\n{ 0x0360, 652 },\n{ 0x0b60, 668 },\n{ 0x05b0, 684 },\n{ 0x0db0, 700 },\n{ 0x02a0, 716 },\n{ 0x0aa0, 732 },\n{ 0x06a0, 748 },\n{ 0x0ea0, 764 },\n{ 0x0260, 780 },\n{ 0x0a60, 796 },\n{ 0x04a0, 812 },\n{ 0x0ca0, 828 },\n{ 0x0240, 844 },\n{ 0x0ec0, 860 },\n{ 0x01c0, 876 },\n{ 0x0e40, 892 },\n{ 0x0140, 908 },\n{ 0x01a0, 924 },\n{ 0x09a0, 940 },\n{ 0x0d40, 956 },\n{ 0x0340, 972 },\n{ 0x05a0, 988 },\n{ 0x0660, 1004 },\n{ 0x0e60, 1020 },\n{ 0, 0 }\n};\n\nstatic struct proto EOLH[] = {\n{ 0x0000, 11 },\n{ 0, 0 }\n};\n\nstatic void\nFillTable(TIFFFaxTabEnt *T, int Size, struct proto *P, int State)\n{\n    int limit = 1 << Size;\n\n    while (P->val) {\n\tint width = P->val & 15;\n\tint param = P->val >> 4;\n\tint incr = 1 << width;\n\tint code;\n\tfor (code = P->code; code < limit; code += incr) {\n\t    TIFFFaxTabEnt *E = T+code;\n\t    E->State = State;\n\t    E->Width = width;\n\t    E->Param = param;\n\t}\n\tP++;\n    }\n}\n\nstatic\tchar* storage_class = \"\";\nstatic\tchar* const_class = \"\";\nstatic\tint packoutput = 1;\nstatic\tchar* prebrace = \"\";\nstatic\tchar* postbrace = \"\";\n\nvoid\nWriteTable(FILE* fd, const TIFFFaxTabEnt* T, int Size, const char* name)\n{\n    int i;\n    char* sep;\n\n    fprintf(fd, \"%s %s TIFFFaxTabEnt %s[%d] = {\",\n\tstorage_class, const_class, name, Size);\n    if (packoutput) {\n\tsep = \"\\n\";\n\tfor (i = 0; i < Size; i++) {\n\t    fprintf(fd, \"%s%s%d,%d,%d%s\",\n\t\tsep, prebrace, T->State, T->Width, (int) T->Param, postbrace);\n\t    if (((i+1) % 10) == 0)\n\t\t    sep = \",\\n\";\n\t    else\n\t\t    sep = \",\";\n\t    T++;\n\t}\n    } else {\n\tsep = \"\\n \";\n\tfor (i = 0; i < Size; i++) {\n\t    fprintf(fd, \"%s%s%3d,%3d,%4d%s\",\n\t\tsep, prebrace, T->State, T->Width, (int) T->Param, postbrace);\n\t    if (((i+1) % 6) == 0)\n\t\t    sep = \",\\n \";\n\t    else\n\t\t    sep = \",\";\n\t    T++;\n\t}\n    }\n    fprintf(fd, \"\\n};\\n\");\n}\n\n/* initialise the huffman code tables */\nint\nmain(int argc, char* argv[])\n{\n    FILE* fd;\n    char* outputfile;\n    int c;\n    extern int optind;\n    extern char* optarg;\n\n    while ((c = getopt(argc, argv, \"c:s:bp\")) != -1)\n\tswitch (c) {\n\tcase 'c':\n\t    const_class = optarg;\n\t    break;\n\tcase 's':\n\t    storage_class = optarg;\n\t    break;\n\tcase 'p':\n\t    packoutput = 0;\n\t    break;\n\tcase 'b':\n\t    prebrace = \"{\";\n\t    postbrace = \"}\";\n\t    break;\n\tcase '?':\n\t    fprintf(stderr,\n\t\t\"usage: %s [-c const] [-s storage] [-p] [-b] file\\n\",\n\t\targv[0]);\n\t    return (-1);\n\t}\n    outputfile = optind < argc ? argv[optind] : \"g3states.h\";\n    fd = fopen(outputfile, \"w\");\n    if (fd == NULL) {\n\tfprintf(stderr, \"%s: %s: Cannot create output file.\\n\",\n\t    argv[0], outputfile);\n\treturn (-2);\n    }\n    FillTable(MainTable, 7, Pass, S_Pass);\n    FillTable(MainTable, 7, Horiz, S_Horiz);\n    FillTable(MainTable, 7, V0, S_V0);\n    FillTable(MainTable, 7, VR, S_VR);\n    FillTable(MainTable, 7, VL, S_VL);\n    FillTable(MainTable, 7, Ext, S_Ext);\n    FillTable(MainTable, 7, EOLV, S_EOL);\n    FillTable(WhiteTable, 12, MakeUpW, S_MakeUpW);\n    FillTable(WhiteTable, 12, MakeUp, S_MakeUp);\n    FillTable(WhiteTable, 12, TermW, S_TermW);\n    FillTable(WhiteTable, 12, EOLH, S_EOL);\n    FillTable(BlackTable, 13, MakeUpB, S_MakeUpB);\n    FillTable(BlackTable, 13, MakeUp, S_MakeUp);\n    FillTable(BlackTable, 13, TermB, S_TermB);\n    FillTable(BlackTable, 13, EOLH, S_EOL);\n\n    fprintf(fd, \"/* WARNING, this file was automatically generated by the\\n\");\n    fprintf(fd, \"    mkg3states program */\\n\");\n    fprintf(fd, \"#include \\\"tiff.h\\\"\\n\");\n    fprintf(fd, \"#include \\\"tif_fax3.h\\\"\\n\");\n    WriteTable(fd, MainTable, 128, \"TIFFFaxMainTable\");\n    WriteTable(fd, WhiteTable, 4096, \"TIFFFaxWhiteTable\");\n    WriteTable(fd, BlackTable, 8192, \"TIFFFaxBlackTable\");\n    fclose(fd);\n    return (0);\n}\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/t4.h",
    "content": "/* $Id: t4.h,v 1.1.1.1 1999/07/27 21:50:27 mike Exp $ */\n\n/*\n * Copyright (c) 1988-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n#ifndef _T4_\n#define\t_T4_\n/*\n * CCITT T.4 1D Huffman runlength codes and\n * related definitions.  Given the small sizes\n * of these tables it does not seem\n * worthwhile to make code & length 8 bits.\n */\ntypedef struct tableentry {\n    unsigned short length;\t/* bit length of g3 code */\n    unsigned short code;\t/* g3 code */\n    short\trunlen;\t\t/* run length in bits */\n} tableentry;\n\n#define\tEOL\t0x001\t/* EOL code value - 0000 0000 0000 1 */\n\n/* status values returned instead of a run length */\n#define\tG3CODE_EOL\t-1\t/* NB: ACT_EOL - ACT_WRUNT */\n#define\tG3CODE_INVALID\t-2\t/* NB: ACT_INVALID - ACT_WRUNT */\n#define\tG3CODE_EOF\t-3\t/* end of input data */\n#define\tG3CODE_INCOMP\t-4\t/* incomplete run code */\n\n/*\n * Note that these tables are ordered such that the\n * index into the table is known to be either the\n * run length, or (run length / 64) + a fixed offset.\n *\n * NB: The G3CODE_INVALID entries are only used\n *     during state generation (see mkg3states.c).\n */\n#ifdef G3CODES\nconst tableentry TIFFFaxWhiteCodes[] = {\n    { 8, 0x35, 0 },\t/* 0011 0101 */\n    { 6, 0x7, 1 },\t/* 0001 11 */\n    { 4, 0x7, 2 },\t/* 0111 */\n    { 4, 0x8, 3 },\t/* 1000 */\n    { 4, 0xB, 4 },\t/* 1011 */\n    { 4, 0xC, 5 },\t/* 1100 */\n    { 4, 0xE, 6 },\t/* 1110 */\n    { 4, 0xF, 7 },\t/* 1111 */\n    { 5, 0x13, 8 },\t/* 1001 1 */\n    { 5, 0x14, 9 },\t/* 1010 0 */\n    { 5, 0x7, 10 },\t/* 0011 1 */\n    { 5, 0x8, 11 },\t/* 0100 0 */\n    { 6, 0x8, 12 },\t/* 0010 00 */\n    { 6, 0x3, 13 },\t/* 0000 11 */\n    { 6, 0x34, 14 },\t/* 1101 00 */\n    { 6, 0x35, 15 },\t/* 1101 01 */\n    { 6, 0x2A, 16 },\t/* 1010 10 */\n    { 6, 0x2B, 17 },\t/* 1010 11 */\n    { 7, 0x27, 18 },\t/* 0100 111 */\n    { 7, 0xC, 19 },\t/* 0001 100 */\n    { 7, 0x8, 20 },\t/* 0001 000 */\n    { 7, 0x17, 21 },\t/* 0010 111 */\n    { 7, 0x3, 22 },\t/* 0000 011 */\n    { 7, 0x4, 23 },\t/* 0000 100 */\n    { 7, 0x28, 24 },\t/* 0101 000 */\n    { 7, 0x2B, 25 },\t/* 0101 011 */\n    { 7, 0x13, 26 },\t/* 0010 011 */\n    { 7, 0x24, 27 },\t/* 0100 100 */\n    { 7, 0x18, 28 },\t/* 0011 000 */\n    { 8, 0x2, 29 },\t/* 0000 0010 */\n    { 8, 0x3, 30 },\t/* 0000 0011 */\n    { 8, 0x1A, 31 },\t/* 0001 1010 */\n    { 8, 0x1B, 32 },\t/* 0001 1011 */\n    { 8, 0x12, 33 },\t/* 0001 0010 */\n    { 8, 0x13, 34 },\t/* 0001 0011 */\n    { 8, 0x14, 35 },\t/* 0001 0100 */\n    { 8, 0x15, 36 },\t/* 0001 0101 */\n    { 8, 0x16, 37 },\t/* 0001 0110 */\n    { 8, 0x17, 38 },\t/* 0001 0111 */\n    { 8, 0x28, 39 },\t/* 0010 1000 */\n    { 8, 0x29, 40 },\t/* 0010 1001 */\n    { 8, 0x2A, 41 },\t/* 0010 1010 */\n    { 8, 0x2B, 42 },\t/* 0010 1011 */\n    { 8, 0x2C, 43 },\t/* 0010 1100 */\n    { 8, 0x2D, 44 },\t/* 0010 1101 */\n    { 8, 0x4, 45 },\t/* 0000 0100 */\n    { 8, 0x5, 46 },\t/* 0000 0101 */\n    { 8, 0xA, 47 },\t/* 0000 1010 */\n    { 8, 0xB, 48 },\t/* 0000 1011 */\n    { 8, 0x52, 49 },\t/* 0101 0010 */\n    { 8, 0x53, 50 },\t/* 0101 0011 */\n    { 8, 0x54, 51 },\t/* 0101 0100 */\n    { 8, 0x55, 52 },\t/* 0101 0101 */\n    { 8, 0x24, 53 },\t/* 0010 0100 */\n    { 8, 0x25, 54 },\t/* 0010 0101 */\n    { 8, 0x58, 55 },\t/* 0101 1000 */\n    { 8, 0x59, 56 },\t/* 0101 1001 */\n    { 8, 0x5A, 57 },\t/* 0101 1010 */\n    { 8, 0x5B, 58 },\t/* 0101 1011 */\n    { 8, 0x4A, 59 },\t/* 0100 1010 */\n    { 8, 0x4B, 60 },\t/* 0100 1011 */\n    { 8, 0x32, 61 },\t/* 0011 0010 */\n    { 8, 0x33, 62 },\t/* 0011 0011 */\n    { 8, 0x34, 63 },\t/* 0011 0100 */\n    { 5, 0x1B, 64 },\t/* 1101 1 */\n    { 5, 0x12, 128 },\t/* 1001 0 */\n    { 6, 0x17, 192 },\t/* 0101 11 */\n    { 7, 0x37, 256 },\t/* 0110 111 */\n    { 8, 0x36, 320 },\t/* 0011 0110 */\n    { 8, 0x37, 384 },\t/* 0011 0111 */\n    { 8, 0x64, 448 },\t/* 0110 0100 */\n    { 8, 0x65, 512 },\t/* 0110 0101 */\n    { 8, 0x68, 576 },\t/* 0110 1000 */\n    { 8, 0x67, 640 },\t/* 0110 0111 */\n    { 9, 0xCC, 704 },\t/* 0110 0110 0 */\n    { 9, 0xCD, 768 },\t/* 0110 0110 1 */\n    { 9, 0xD2, 832 },\t/* 0110 1001 0 */\n    { 9, 0xD3, 896 },\t/* 0110 1001 1 */\n    { 9, 0xD4, 960 },\t/* 0110 1010 0 */\n    { 9, 0xD5, 1024 },\t/* 0110 1010 1 */\n    { 9, 0xD6, 1088 },\t/* 0110 1011 0 */\n    { 9, 0xD7, 1152 },\t/* 0110 1011 1 */\n    { 9, 0xD8, 1216 },\t/* 0110 1100 0 */\n    { 9, 0xD9, 1280 },\t/* 0110 1100 1 */\n    { 9, 0xDA, 1344 },\t/* 0110 1101 0 */\n    { 9, 0xDB, 1408 },\t/* 0110 1101 1 */\n    { 9, 0x98, 1472 },\t/* 0100 1100 0 */\n    { 9, 0x99, 1536 },\t/* 0100 1100 1 */\n    { 9, 0x9A, 1600 },\t/* 0100 1101 0 */\n    { 6, 0x18, 1664 },\t/* 0110 00 */\n    { 9, 0x9B, 1728 },\t/* 0100 1101 1 */\n    { 11, 0x8, 1792 },\t/* 0000 0001 000 */\n    { 11, 0xC, 1856 },\t/* 0000 0001 100 */\n    { 11, 0xD, 1920 },\t/* 0000 0001 101 */\n    { 12, 0x12, 1984 },\t/* 0000 0001 0010 */\n    { 12, 0x13, 2048 },\t/* 0000 0001 0011 */\n    { 12, 0x14, 2112 },\t/* 0000 0001 0100 */\n    { 12, 0x15, 2176 },\t/* 0000 0001 0101 */\n    { 12, 0x16, 2240 },\t/* 0000 0001 0110 */\n    { 12, 0x17, 2304 },\t/* 0000 0001 0111 */\n    { 12, 0x1C, 2368 },\t/* 0000 0001 1100 */\n    { 12, 0x1D, 2432 },\t/* 0000 0001 1101 */\n    { 12, 0x1E, 2496 },\t/* 0000 0001 1110 */\n    { 12, 0x1F, 2560 },\t/* 0000 0001 1111 */\n    { 12, 0x1, G3CODE_EOL },\t/* 0000 0000 0001 */\n    { 9, 0x1, G3CODE_INVALID },\t/* 0000 0000 1 */\n    { 10, 0x1, G3CODE_INVALID },\t/* 0000 0000 01 */\n    { 11, 0x1, G3CODE_INVALID },\t/* 0000 0000 001 */\n    { 12, 0x0, G3CODE_INVALID },\t/* 0000 0000 0000 */\n};\n\nconst tableentry TIFFFaxBlackCodes[] = {\n    { 10, 0x37, 0 },\t/* 0000 1101 11 */\n    { 3, 0x2, 1 },\t/* 010 */\n    { 2, 0x3, 2 },\t/* 11 */\n    { 2, 0x2, 3 },\t/* 10 */\n    { 3, 0x3, 4 },\t/* 011 */\n    { 4, 0x3, 5 },\t/* 0011 */\n    { 4, 0x2, 6 },\t/* 0010 */\n    { 5, 0x3, 7 },\t/* 0001 1 */\n    { 6, 0x5, 8 },\t/* 0001 01 */\n    { 6, 0x4, 9 },\t/* 0001 00 */\n    { 7, 0x4, 10 },\t/* 0000 100 */\n    { 7, 0x5, 11 },\t/* 0000 101 */\n    { 7, 0x7, 12 },\t/* 0000 111 */\n    { 8, 0x4, 13 },\t/* 0000 0100 */\n    { 8, 0x7, 14 },\t/* 0000 0111 */\n    { 9, 0x18, 15 },\t/* 0000 1100 0 */\n    { 10, 0x17, 16 },\t/* 0000 0101 11 */\n    { 10, 0x18, 17 },\t/* 0000 0110 00 */\n    { 10, 0x8, 18 },\t/* 0000 0010 00 */\n    { 11, 0x67, 19 },\t/* 0000 1100 111 */\n    { 11, 0x68, 20 },\t/* 0000 1101 000 */\n    { 11, 0x6C, 21 },\t/* 0000 1101 100 */\n    { 11, 0x37, 22 },\t/* 0000 0110 111 */\n    { 11, 0x28, 23 },\t/* 0000 0101 000 */\n    { 11, 0x17, 24 },\t/* 0000 0010 111 */\n    { 11, 0x18, 25 },\t/* 0000 0011 000 */\n    { 12, 0xCA, 26 },\t/* 0000 1100 1010 */\n    { 12, 0xCB, 27 },\t/* 0000 1100 1011 */\n    { 12, 0xCC, 28 },\t/* 0000 1100 1100 */\n    { 12, 0xCD, 29 },\t/* 0000 1100 1101 */\n    { 12, 0x68, 30 },\t/* 0000 0110 1000 */\n    { 12, 0x69, 31 },\t/* 0000 0110 1001 */\n    { 12, 0x6A, 32 },\t/* 0000 0110 1010 */\n    { 12, 0x6B, 33 },\t/* 0000 0110 1011 */\n    { 12, 0xD2, 34 },\t/* 0000 1101 0010 */\n    { 12, 0xD3, 35 },\t/* 0000 1101 0011 */\n    { 12, 0xD4, 36 },\t/* 0000 1101 0100 */\n    { 12, 0xD5, 37 },\t/* 0000 1101 0101 */\n    { 12, 0xD6, 38 },\t/* 0000 1101 0110 */\n    { 12, 0xD7, 39 },\t/* 0000 1101 0111 */\n    { 12, 0x6C, 40 },\t/* 0000 0110 1100 */\n    { 12, 0x6D, 41 },\t/* 0000 0110 1101 */\n    { 12, 0xDA, 42 },\t/* 0000 1101 1010 */\n    { 12, 0xDB, 43 },\t/* 0000 1101 1011 */\n    { 12, 0x54, 44 },\t/* 0000 0101 0100 */\n    { 12, 0x55, 45 },\t/* 0000 0101 0101 */\n    { 12, 0x56, 46 },\t/* 0000 0101 0110 */\n    { 12, 0x57, 47 },\t/* 0000 0101 0111 */\n    { 12, 0x64, 48 },\t/* 0000 0110 0100 */\n    { 12, 0x65, 49 },\t/* 0000 0110 0101 */\n    { 12, 0x52, 50 },\t/* 0000 0101 0010 */\n    { 12, 0x53, 51 },\t/* 0000 0101 0011 */\n    { 12, 0x24, 52 },\t/* 0000 0010 0100 */\n    { 12, 0x37, 53 },\t/* 0000 0011 0111 */\n    { 12, 0x38, 54 },\t/* 0000 0011 1000 */\n    { 12, 0x27, 55 },\t/* 0000 0010 0111 */\n    { 12, 0x28, 56 },\t/* 0000 0010 1000 */\n    { 12, 0x58, 57 },\t/* 0000 0101 1000 */\n    { 12, 0x59, 58 },\t/* 0000 0101 1001 */\n    { 12, 0x2B, 59 },\t/* 0000 0010 1011 */\n    { 12, 0x2C, 60 },\t/* 0000 0010 1100 */\n    { 12, 0x5A, 61 },\t/* 0000 0101 1010 */\n    { 12, 0x66, 62 },\t/* 0000 0110 0110 */\n    { 12, 0x67, 63 },\t/* 0000 0110 0111 */\n    { 10, 0xF, 64 },\t/* 0000 0011 11 */\n    { 12, 0xC8, 128 },\t/* 0000 1100 1000 */\n    { 12, 0xC9, 192 },\t/* 0000 1100 1001 */\n    { 12, 0x5B, 256 },\t/* 0000 0101 1011 */\n    { 12, 0x33, 320 },\t/* 0000 0011 0011 */\n    { 12, 0x34, 384 },\t/* 0000 0011 0100 */\n    { 12, 0x35, 448 },\t/* 0000 0011 0101 */\n    { 13, 0x6C, 512 },\t/* 0000 0011 0110 0 */\n    { 13, 0x6D, 576 },\t/* 0000 0011 0110 1 */\n    { 13, 0x4A, 640 },\t/* 0000 0010 0101 0 */\n    { 13, 0x4B, 704 },\t/* 0000 0010 0101 1 */\n    { 13, 0x4C, 768 },\t/* 0000 0010 0110 0 */\n    { 13, 0x4D, 832 },\t/* 0000 0010 0110 1 */\n    { 13, 0x72, 896 },\t/* 0000 0011 1001 0 */\n    { 13, 0x73, 960 },\t/* 0000 0011 1001 1 */\n    { 13, 0x74, 1024 },\t/* 0000 0011 1010 0 */\n    { 13, 0x75, 1088 },\t/* 0000 0011 1010 1 */\n    { 13, 0x76, 1152 },\t/* 0000 0011 1011 0 */\n    { 13, 0x77, 1216 },\t/* 0000 0011 1011 1 */\n    { 13, 0x52, 1280 },\t/* 0000 0010 1001 0 */\n    { 13, 0x53, 1344 },\t/* 0000 0010 1001 1 */\n    { 13, 0x54, 1408 },\t/* 0000 0010 1010 0 */\n    { 13, 0x55, 1472 },\t/* 0000 0010 1010 1 */\n    { 13, 0x5A, 1536 },\t/* 0000 0010 1101 0 */\n    { 13, 0x5B, 1600 },\t/* 0000 0010 1101 1 */\n    { 13, 0x64, 1664 },\t/* 0000 0011 0010 0 */\n    { 13, 0x65, 1728 },\t/* 0000 0011 0010 1 */\n    { 11, 0x8, 1792 },\t/* 0000 0001 000 */\n    { 11, 0xC, 1856 },\t/* 0000 0001 100 */\n    { 11, 0xD, 1920 },\t/* 0000 0001 101 */\n    { 12, 0x12, 1984 },\t/* 0000 0001 0010 */\n    { 12, 0x13, 2048 },\t/* 0000 0001 0011 */\n    { 12, 0x14, 2112 },\t/* 0000 0001 0100 */\n    { 12, 0x15, 2176 },\t/* 0000 0001 0101 */\n    { 12, 0x16, 2240 },\t/* 0000 0001 0110 */\n    { 12, 0x17, 2304 },\t/* 0000 0001 0111 */\n    { 12, 0x1C, 2368 },\t/* 0000 0001 1100 */\n    { 12, 0x1D, 2432 },\t/* 0000 0001 1101 */\n    { 12, 0x1E, 2496 },\t/* 0000 0001 1110 */\n    { 12, 0x1F, 2560 },\t/* 0000 0001 1111 */\n    { 12, 0x1, G3CODE_EOL },\t/* 0000 0000 0001 */\n    { 9, 0x1, G3CODE_INVALID },\t/* 0000 0000 1 */\n    { 10, 0x1, G3CODE_INVALID },\t/* 0000 0000 01 */\n    { 11, 0x1, G3CODE_INVALID },\t/* 0000 0000 001 */\n    { 12, 0x0, G3CODE_INVALID },\t/* 0000 0000 0000 */\n};\n#else\nextern\tconst tableentry TIFFFaxWhiteCodes[];\nextern\tconst tableentry TIFFFaxBlackCodes[];\n#endif\n#endif /* _T4_ */\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/tif_acorn.c",
    "content": "/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_acorn.c,v 1.2 2005/12/21 12:23:13 joris Exp $ */\n\n/*\n * Copyright (c) 1988-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and\n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n *\n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND,\n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY\n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.\n *\n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF\n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE\n * OF THIS SOFTWARE.\n */\n\n/*\n * TIFF Library RISC OS specific Routines.\n * Developed out of the Unix version.\n * Peter Greenham, May 1995\n */\n#include \"tiffiop.h\"\n#include <stdio.h>\n#include <stdlib.h>\n\n/*\nLow-level file handling\n~~~~~~~~~~~~~~~~~~~~~~~\nThe functions in osfcn.h are unavailable when compiling under C, as it's a\nC++ header. Therefore they have been implemented here.\n\nNow, why have I done it this way?\n\nThe definitive API library for RISC OS is Jonathan Coxhead's OSLib, which\nuses heavily optimised ARM assembler or even plain inline SWI calls for\nmaximum performance and minimum runtime size. However, I don't want to make\nLIBTIFF need that to survive. Therefore I have also emulated the functions\nusing macros to _swi() and _swix() defined in the swis.h header, and\nborrowing types from kernel.h, which is less efficient but doesn't need any\nthird-party libraries.\n */\n\n#ifdef INCLUDE_OSLIB\n\n#include \"osfile.h\"\n#include \"osgbpb.h\"\n#include \"osargs.h\"\n#include \"osfind.h\"\n\n#else\n\n/* OSLIB EMULATION STARTS */\n\n#include \"kernel.h\"\n#include \"swis.h\"\n\n/* From oslib:types.h */\ntypedef unsigned int                            bits;\ntypedef unsigned char                           byte;\n#ifndef TRUE\n#define TRUE                                    1\n#endif\n#ifndef FALSE\n#define FALSE                                   0\n#endif\n#ifndef NULL\n#define NULL                                    0\n#endif\n#ifndef SKIP\n#define SKIP                                    0\n#endif\n\n/* From oslib:os.h */\ntypedef _kernel_oserror os_error;\ntypedef byte os_f;\n\n/* From oslib:osfile.h */\n#undef  OS_File\n#define OS_File                                 0x8\n\n/* From oslib:osgbpb.h */\n#undef  OS_GBPB\n#define OS_GBPB                                 0xC\n#undef  OSGBPB_Write\n#define OSGBPB_Write                            0x2\n#undef  OSGBPB_Read\n#define OSGBPB_Read                             0x4\n\nextern os_error *xosgbpb_write (os_f file,\n      byte *data,\n      int size,\n      int *unwritten);\nextern int osgbpb_write (os_f file,\n      byte *data,\n      int size);\n\n#define\txosgbpb_write(file, data, size, unwritten) \\\n\t(os_error*) _swix(OS_GBPB, _IN(0)|_IN(1)|_IN(2)|_IN(3)|_IN(4)|_OUT(3), \\\n\t\tOSGBPB_WriteAt, \\\n\t\tfile, \\\n\t\tdata, \\\n\t\tsize, \\\n\t\tunwritten)\n\n#define\tosgbpb_write(file, data, size) \\\n\t_swi(OS_GBPB, _IN(0)|_IN(1)|_IN(2)|_IN(3)|_RETURN(3), \\\n\t\tOSGBPB_Write, \\\n\t\tfile, \\\n\t\tdata, \\\n\t\tsize)\n\nextern os_error *xosgbpb_read (os_f file,\n      byte *buffer,\n      int size,\n      int *unread);\nextern int osgbpb_read (os_f file,\n      byte *buffer,\n      int size);\n\n#define\txosgbpb_read(file, buffer, size, unread) \\\n\t(os_error*) _swix(OS_GBPB, _IN(0)|_IN(1)|_IN(2)|_IN(3)|_OUT(3), \\\n\t\tOSGBPB_Read, \\\n\t\tfile, \\\n\t\tbuffer, \\\n\t\tsize, \\\n\t\tunread)\n\n#define\tosgbpb_read(file, buffer, size) \\\n\t_swi(OS_GBPB, _IN(0)|_IN(1)|_IN(2)|_IN(3)|_RETURN(3), \\\n\t\tOSGBPB_Read, \\\n\t\tfile, \\\n\t\tbuffer, \\\n\t\tsize)\n\n/* From oslib:osfind.h */\n#undef  OS_Find\n#define OS_Find                                 0xD\n#undef  OSFind_Openin\n#define OSFind_Openin                           0x40\n#undef  OSFind_Openout\n#define OSFind_Openout                          0x80\n#undef  OSFind_Openup\n#define OSFind_Openup                           0xC0\n#undef  OSFind_Close\n#define OSFind_Close                            0x0\n\n#define\txosfind_open(reason, file_name, path, file) \\\n\t(os_error*) _swix(OS_Find, _IN(0)|_IN(1)|_IN(2)|_OUT(0), \\\n\t\treason, file_name, path, file)\n\n#define\tosfind_open(reason, file_name, path) \\\n\t(os_f) _swi(OS_Find, _IN(0)|_IN(1)|_IN(2)|_RETURN(0), \\\n\t\treason, file_name, path)\n\nextern os_error *xosfind_openin (bits flags,\n      char *file_name,\n      char *path,\n      os_f *file);\nextern os_f osfind_openin (bits flags,\n      char *file_name,\n      char *path);\n\n#define\txosfind_openin(flags, file_name, path, file) \\\n\txosfind_open(flags | OSFind_Openin, file_name, path, file)\n\n#define\tosfind_openin(flags, file_name, path) \\\n\tosfind_open(flags | OSFind_Openin, file_name, path)\n\nextern os_error *xosfind_openout (bits flags,\n      char *file_name,\n      char *path,\n      os_f *file);\nextern os_f osfind_openout (bits flags,\n      char *file_name,\n      char *path);\n\n#define\txosfind_openout(flags, file_name, path, file) \\\n\txosfind_open(flags | OSFind_Openout, file_name, path, file)\n\n#define\tosfind_openout(flags, file_name, path) \\\n\tosfind_open(flags | OSFind_Openout, file_name, path)\n\nextern os_error *xosfind_openup (bits flags,\n      char *file_name,\n      char *path,\n      os_f *file);\nextern os_f osfind_openup (bits flags,\n      char *file_name,\n      char *path);\n\n#define\txosfind_openup(flags, file_name, path, file) \\\n\txosfind_open(flags | OSFind_Openup, file_name, path, file)\n\n#define\tosfind_openup(flags, file_name, path) \\\n\tosfind_open(flags | OSFind_Openup, file_name, path)\n\nextern os_error *xosfind_close (os_f file);\nextern void osfind_close (os_f file);\n\n#define\txosfind_close(file) \\\n\t(os_error*) _swix(OS_Find, _IN(0)|_IN(1), \\\n\t\tOSFind_Close, \\\n\t\tfile)\n\n#define\tosfind_close(file) \\\n\t(void) _swi(OS_Find, _IN(0)|_IN(1), \\\n\t\tOSFind_Close, \\\n\t\tfile)\n\n/* From oslib:osargs.h */\n#undef  OS_Args\n#define OS_Args                                 0x9\n#undef  OSArgs_ReadPtr\n#define OSArgs_ReadPtr                          0x0\n#undef  OSArgs_SetPtr\n#define OSArgs_SetPtr                           0x1\n#undef  OSArgs_ReadExt\n#define OSArgs_ReadExt                          0x2\n\nextern os_error *xosargs_read_ptr (os_f file,\n      int *ptr);\nextern int osargs_read_ptr (os_f file);\n\n#define\txosargs_read_ptr(file, ptr) \\\n\t(os_error*) _swix(OS_Args, _IN(0)|_IN(1)|_OUT(2), \\\n\t\tOSArgs_ReadPtr, \\\n\t\tfile, \\\n\t\tptr)\n\n#define\tosargs_read_ptr(file) \\\n\t_swi(OS_Args, _IN(0)|_IN(1)|_RETURN(2), \\\n\t\tOSArgs_ReadPtr, \\\n\t\tfile)\n\nextern os_error *xosargs_set_ptr (os_f file,\n      int ptr);\nextern void osargs_set_ptr (os_f file,\n      int ptr);\n\n#define\txosargs_set_ptr(file, ptr) \\\n\t(os_error*) _swix(OS_Args, _IN(0)|_IN(1)|_IN(2), \\\n\t\tOSArgs_SetPtr, \\\n\t\tfile, \\\n\t\tptr)\n\n#define\tosargs_set_ptr(file, ptr) \\\n\t(void) _swi(OS_Args, _IN(0)|_IN(1)|_IN(2), \\\n\t\tOSArgs_SetPtr, \\\n\t\tfile, \\\n\t\tptr)\n\nextern os_error *xosargs_read_ext (os_f file,\n      int *ext);\nextern int osargs_read_ext (os_f file);\n\n#define\txosargs_read_ext(file, ext) \\\n\t(os_error*) _swix(OS_Args, _IN(0)|_IN(1)|_OUT(2), \\\n\t\tOSArgs_ReadExt, \\\n\t\tfile, \\\n\t\text)\n\n#define\tosargs_read_ext(file) \\\n\t_swi(OS_Args, _IN(0)|_IN(1)|_RETURN(2), \\\n\t\tOSArgs_ReadExt, \\\n\t\tfile)\n\n/* OSLIB EMULATION ENDS */\n\n#endif\n\n#ifndef __osfcn_h\n/* Will be set or not during tiffcomp.h */\n/* You get this to compile under C++? Please say how! */\n\nextern int open(const char* name, int flags, int mode)\n{\n\t/* From what I can tell, should return <0 for failure */\n\tos_error* e = (os_error*) 1; /* Cheeky way to use a pointer eh? :-) */\n\tos_f file = (os_f) -1;\n\n\tflags = flags;\n\n\tswitch(mode)\n\t{\n\t\tcase O_RDONLY:\n\t\t{\n\t\t\te = xosfind_openin(SKIP, name, SKIP, &file);\n\t\t\tbreak;\n\t\t}\n\t\tcase O_WRONLY:\n\t\tcase O_RDWR|O_CREAT:\n\t\tcase O_RDWR|O_CREAT|O_TRUNC:\n\t\t{\n\t\t\te = xosfind_openout(SKIP, name, SKIP, &file);\n\t\t\tbreak;\n\t\t}\n\t\tcase O_RDWR:\n\t\t{\n\t\t\te = xosfind_openup(SKIP, name, SKIP, &file);\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (e)\n\t{\n\t\tfile = (os_f) -1;\n\t}\n\treturn (file);\n}\n\nextern int close(int fd)\n{\n\treturn ((int) xosfind_close((os_f) fd));\n}\n\nextern int write(int fd, const char *buf, int nbytes)\n{\n\t/* Returns number of bytes written */\n\treturn (nbytes - osgbpb_write((os_f) fd, (const byte*) buf, nbytes));\n}\n\nextern int read(int fd, char *buf, int nbytes)\n{\n\t/* Returns number of bytes read */\n\treturn (nbytes - osgbpb_read((os_f) fd, (byte*) buf, nbytes));\n}\n\nextern off_t lseek(int fd, off_t offset, int whence)\n{\n\tint absolute = 0;\n\n\tswitch (whence)\n\t{\n\t\tcase SEEK_SET:\n\t\t{\n\t\t\tabsolute = (int) offset;\n\t\t\tbreak;\n\t\t}\n\t\tcase SEEK_CUR:\n\t\t{\n\t\t\tabsolute = osargs_read_ptr((os_f) fd) + (int) offset;\n\t\t\tbreak;\n\t\t}\n\t\tcase SEEK_END:\n\t\t{\n\t\t\tabsolute = osargs_read_ext((os_f) fd) + (int) offset;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tosargs_set_ptr((os_f) fd, absolute);\n\n\treturn ((off_t) osargs_read_ptr((os_f) fd));\n}\n#endif\n\nstatic tsize_t\n_tiffReadProc(thandle_t fd, tdata_t buf, tsize_t size)\n{\n\treturn ((tsize_t) read((int) fd, buf, (size_t) size));\n}\n\nstatic tsize_t\n_tiffWriteProc(thandle_t fd, tdata_t buf, tsize_t size)\n{\n\treturn ((tsize_t) write((int) fd, buf, (size_t) size));\n}\n\nstatic toff_t\n_tiffSeekProc(thandle_t fd, toff_t off, int whence)\n{\n\treturn ((toff_t) lseek((int) fd, (off_t) off, whence));\n}\n\nstatic int\n_tiffCloseProc(thandle_t fd)\n{\n\treturn (close((int) fd));\n}\n\nstatic toff_t\n_tiffSizeProc(thandle_t fd)\n{\n\treturn (lseek((int) fd, SEEK_END, SEEK_SET));\n}\n\n#ifdef HAVE_MMAP\n#error \"I didn't know Acorn had that!\"\n#endif\n\n/* !HAVE_MMAP */\nstatic int\n_tiffMapProc(thandle_t fd, tdata_t* pbase, toff_t* psize)\n{\n\t(void) fd; (void) pbase; (void) psize;\n\treturn (0);\n}\n\nstatic void\n_tiffUnmapProc(thandle_t fd, tdata_t base, toff_t size)\n{\n\t(void) fd; (void) base; (void) size;\n}\n\n/*\n * Open a TIFF file descriptor for read/writing.\n */\nTIFF*\nTIFFFdOpen(int fd, const char* name, const char* mode)\n{\n\tTIFF* tif;\n\n\ttif = TIFFClientOpen(name, mode,\n\t\t(thandle_t) fd,\n\t\t_tiffReadProc, _tiffWriteProc,\n\t\t_tiffSeekProc, _tiffCloseProc, _tiffSizeProc,\n\t\t_tiffMapProc, _tiffUnmapProc);\n\tif (tif)\n\t{\n\t\ttif->tif_fd = fd;\n\t}\n\treturn (tif);\n}\n\n/*\n * Open a TIFF file for read/writing.\n */\nTIFF*\nTIFFOpen(const char* name, const char* mode)\n{\n\tstatic const char module[] = \"TIFFOpen\";\n\tint m, fd;\n\n\tm = _TIFFgetMode(mode, module);\n\n\tif (m == -1)\n\t{\n\t\treturn ((TIFF*) 0);\n\t}\n\n\tfd = open(name, 0, m);\n\n\tif (fd < 0)\n\t{\n\t\tTIFFErrorExt(0, module, \"%s: Cannot open\", name);\n\t\treturn ((TIFF *)0);\n\t}\n\treturn (TIFFFdOpen(fd, name, mode));\n}\n\nvoid*\n_TIFFmalloc(tsize_t s)\n{\n\treturn (malloc((size_t) s));\n}\n\nvoid\n_TIFFfree(tdata_t p)\n{\n\tfree(p);\n}\n\nvoid*\n_TIFFrealloc(tdata_t p, tsize_t s)\n{\n\treturn (realloc(p, (size_t) s));\n}\n\nvoid\n_TIFFmemset(tdata_t p, int v, tsize_t c)\n{\n\tmemset(p, v, (size_t) c);\n}\n\nvoid\n_TIFFmemcpy(tdata_t d, const tdata_t s, tsize_t c)\n{\n\tmemcpy(d, s, (size_t) c);\n}\n\nint\n_TIFFmemcmp(const tdata_t p1, const tdata_t p2, tsize_t c)\n{\n\treturn (memcmp(p1, p2, (size_t) c));\n}\n\nstatic void\nacornWarningHandler(const char* module, const char* fmt, va_list ap)\n{\n\tif (module != NULL)\n\t{\n\t\tfprintf(stderr, \"%s: \", module);\n\t}\n\tfprintf(stderr, \"Warning, \");\n\tvfprintf(stderr, fmt, ap);\n\tfprintf(stderr, \".\\n\");\n}\nTIFFErrorHandler _TIFFwarningHandler = acornWarningHandler;\n\nstatic void\nacornErrorHandler(const char* module, const char* fmt, va_list ap)\n{\n\tif (module != NULL)\n\t{\n\t\tfprintf(stderr, \"%s: \", module);\n\t}\n\tvfprintf(stderr, fmt, ap);\n\tfprintf(stderr, \".\\n\");\n}\nTIFFErrorHandler _TIFFerrorHandler = acornErrorHandler;\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/tif_apple.c",
    "content": "/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_apple.c,v 1.3 2005/12/21 12:23:13 joris Exp $ */\n\n/*\n * Copyright (c) 1988-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n/*\n * TIFF Library Macintosh-specific routines.\n *\n * These routines use only Toolbox and high-level File Manager traps.\n * They make no calls to the THINK C \"unix\" compatibility library.  Also,\n * malloc is not used directly but it is still referenced internally by\n * the ANSI library in rare cases.  Heap fragmentation by the malloc ring\n * buffer is therefore minimized.\n *\n * O_RDONLY and O_RDWR are treated identically here.  The tif_mode flag is\n * checked in TIFFWriteCheck().\n *\n * Create below fills in a blank creator signature and sets the file type\n * to 'TIFF'.  It is much better for the application to do this by Create'ing\n * the file first and TIFFOpen'ing it later.\n * ---------\n * This code has been \"Carbonized\", and may not work with older MacOS versions.\n * If so, grab the tif_apple.c out of an older libtiff distribution, like\n * 3.5.5 from www.libtiff.org.\n */\n\n#include \"tiffiop.h\"\n#include <Errors.h>\n#include <Files.h>\n#include <Memory.h>\n#include <Script.h>\n\n#if defined(__PPCC__) || defined(__SC__) || defined(__MRC__) || defined(applec)\n#define\tCtoPstr\tc2pstr\n#endif\n\nstatic tsize_t\n_tiffReadProc(thandle_t fd, tdata_t buf, tsize_t size)\n{\n\treturn (FSRead((short) fd, (long*) &size, (char*) buf) == noErr ?\n\t    size : (tsize_t) -1);\n}\n\nstatic tsize_t\n_tiffWriteProc(thandle_t fd, tdata_t buf, tsize_t size)\n{\n\treturn (FSWrite((short) fd, (long*) &size, (char*) buf) == noErr ?\n\t    size : (tsize_t) -1);\n}\n\nstatic toff_t\n_tiffSeekProc(thandle_t fd, toff_t off, int whence)\n{\n\tlong fpos, size;\n\n\tif (GetEOF((short) fd, &size) != noErr)\n\t\treturn EOF;\n\t(void) GetFPos((short) fd, &fpos);\n\n\tswitch (whence) {\n\tcase SEEK_CUR:\n\t\tif (off + fpos > size)\n\t\t\tSetEOF((short) fd, off + fpos);\n\t\tif (SetFPos((short) fd, fsFromMark, off) != noErr)\n\t\t\treturn EOF;\n\t\tbreak;\n\tcase SEEK_END:\n\t\tif (off > 0)\n\t\t\tSetEOF((short) fd, off + size);\n\t\tif (SetFPos((short) fd, fsFromStart, off + size) != noErr)\n\t\t\treturn EOF;\n\t\tbreak;\n\tcase SEEK_SET:\n\t\tif (off > size)\n\t\t\tSetEOF((short) fd, off);\n\t\tif (SetFPos((short) fd, fsFromStart, off) != noErr)\n\t\t\treturn EOF;\n\t\tbreak;\n\t}\n\n\treturn (toff_t)(GetFPos((short) fd, &fpos) == noErr ? fpos : EOF);\n}\n\nstatic int\n_tiffMapProc(thandle_t fd, tdata_t* pbase, toff_t* psize)\n{\n\treturn (0);\n}\n\nstatic void\n_tiffUnmapProc(thandle_t fd, tdata_t base, toff_t size)\n{\n}\n\nstatic int\n_tiffCloseProc(thandle_t fd)\n{\n\treturn (FSClose((short) fd));\n}\n\nstatic toff_t\n_tiffSizeProc(thandle_t fd)\n{\n\tlong size;\n\n\tif (GetEOF((short) fd, &size) != noErr) {\n\t\tTIFFErrorExt(fd, \"_tiffSizeProc\", \"%s: Cannot get file size\");\n\t\treturn (-1L);\n\t}\n\treturn ((toff_t) size);\n}\n\n/*\n * Open a TIFF file descriptor for read/writing.\n */\nTIFF*\nTIFFFdOpen(int fd, const char* name, const char* mode)\n{\n\tTIFF* tif;\n\n\ttif = TIFFClientOpen(name, mode, (thandle_t) fd,\n\t    _tiffReadProc, _tiffWriteProc, _tiffSeekProc, _tiffCloseProc,\n\t    _tiffSizeProc, _tiffMapProc, _tiffUnmapProc);\n\tif (tif)\n\t\ttif->tif_fd = fd;\n\treturn (tif);\n}\n\nstatic void ourc2pstr( char* inString )\n{\n\tint\tsLen = strlen( inString );\n\tBlockMoveData( inString, &inString[1], sLen );\n\tinString[0] = sLen;\n}\n\n/*\n * Open a TIFF file for read/writing.\n */\nTIFF*\nTIFFOpen(const char* name, const char* mode)\n{\n\tstatic const char module[] = \"TIFFOpen\";\n\tStr255 pname;\n\tFInfo finfo;\n\tshort fref;\n\tOSErr err;\n\tFSSpec\tfSpec;\n\n\tstrcpy((char*) pname, name);\n\tourc2pstr((char*) pname);\n\t\n\terr = FSMakeFSSpec( 0, 0, pname, &fSpec );\n\n\tswitch (_TIFFgetMode(mode, module)) {\n\tdefault:\n\t\treturn ((TIFF*) 0);\n\tcase O_RDWR | O_CREAT | O_TRUNC:\n\t\tif (FSpGetFInfo(&fSpec, &finfo) == noErr)\n\t\t\tFSpDelete(&fSpec);\n\t\t/* fall through */\n\tcase O_RDWR | O_CREAT:\n\t\tif ((err = FSpGetFInfo(&fSpec, &finfo)) == fnfErr) {\n\t\t\tif (FSpCreate(&fSpec, '    ', 'TIFF', smSystemScript) != noErr)\n\t\t\t\tgoto badCreate;\n\t\t\tif (FSpOpenDF(&fSpec, fsRdWrPerm, &fref) != noErr)\n\t\t\t\tgoto badOpen;\n\t\t} else if (err == noErr) {\n\t\t\tif (FSpOpenDF(&fSpec, fsRdWrPerm, &fref) != noErr)\n\t\t\t\tgoto badOpen;\n\t\t} else\n\t\t\tgoto badOpen;\n\t\tbreak;\n\tcase O_RDONLY:\n\t\tif (FSpOpenDF(&fSpec, fsRdPerm, &fref) != noErr)\n\t\t\tgoto badOpen;\n\t\tbreak;\n\tcase O_RDWR:\n\t\tif (FSpOpenDF(&fSpec, fsRdWrPerm, &fref) != noErr)\n\t\t\tgoto badOpen;\n\t\tbreak;\n\t}\n\treturn (TIFFFdOpen((int) fref, name, mode));\nbadCreate:\n\tTIFFErrorExt(0, module, \"%s: Cannot create\", name);\n\treturn ((TIFF*) 0);\nbadOpen:\n\tTIFFErrorExt(0, module, \"%s: Cannot open\", name);\n\treturn ((TIFF*) 0);\n}\n\nvoid\n_TIFFmemset(tdata_t p, int v, tsize_t c)\n{\n\tmemset(p, v, (size_t) c);\n}\n\nvoid\n_TIFFmemcpy(tdata_t d, const tdata_t s, tsize_t c)\n{\n\tmemcpy(d, s, (size_t) c);\n}\n\nint\n_TIFFmemcmp(const tdata_t p1, const tdata_t p2, tsize_t c)\n{\n\treturn (memcmp(p1, p2, (size_t) c));\n}\n\ntdata_t\n_TIFFmalloc(tsize_t s)\n{\n\treturn (NewPtr((size_t) s));\n}\n\nvoid\n_TIFFfree(tdata_t p)\n{\n\tDisposePtr(p);\n}\n\ntdata_t\n_TIFFrealloc(tdata_t p, tsize_t s)\n{\n\tPtr n = p;\n\n\tSetPtrSize(p, (size_t) s);\n\tif (MemError() && (n = NewPtr((size_t) s)) != NULL) {\n\t\tBlockMove(p, n, GetPtrSize(p));\n\t\tDisposePtr(p);\n\t}\n\treturn ((tdata_t) n);\n}\n\nstatic void\nappleWarningHandler(const char* module, const char* fmt, va_list ap)\n{\n\tif (module != NULL)\n\t\tfprintf(stderr, \"%s: \", module);\n\tfprintf(stderr, \"Warning, \");\n\tvfprintf(stderr, fmt, ap);\n\tfprintf(stderr, \".\\n\");\n}\nTIFFErrorHandler _TIFFwarningHandler = appleWarningHandler;\n\nstatic void\nappleErrorHandler(const char* module, const char* fmt, va_list ap)\n{\n\tif (module != NULL)\n\t\tfprintf(stderr, \"%s: \", module);\n\tvfprintf(stderr, fmt, ap);\n\tfprintf(stderr, \".\\n\");\n}\nTIFFErrorHandler _TIFFerrorHandler = appleErrorHandler;\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/tif_atari.c",
    "content": "/* \"$Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_atari.c,v 1.2 2005/12/21 12:23:13 joris Exp $\" */\n\n/*\n * Copyright (c) 1988-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n/*\n * TIFF Library ATARI-specific Routines.\n */\n#include \"tiffiop.h\"\n#if defined(__TURBOC__)\n#include <tos.h>\n#include <stdio.h>\n#else\n#include <osbind.h>\n#include <fcntl.h>\n#endif\n\n#ifndef O_ACCMODE\n#define O_ACCMODE 3\n#endif\n\n#include <errno.h>\n\n#define AEFILNF   -33\n\nstatic tsize_t\n_tiffReadProc(thandle_t fd, tdata_t buf, tsize_t size)\n{\n\tlong r;\n\n\tr = Fread((int) fd, size, buf);\n\tif (r < 0) {\n\t\terrno = (int)-r;\n\t\tr = -1;\n\t}\n\treturn r;\n}\n\nstatic tsize_t\n_tiffWriteProc(thandle_t fd, tdata_t buf, tsize_t size)\n{\n\tlong r;\n\n\tr = Fwrite((int) fd, size, buf);\n\tif (r < 0) {\n\t\terrno = (int)-r;\n\t\tr = -1;\n\t}\n\treturn r;\n}\n\nstatic toff_t\n_tiffSeekProc(thandle_t fd, off_t off, int whence)\n{\n\tchar buf[256];\n\tlong current_off, expected_off, new_off;\n\n\tif (whence == SEEK_END || off <= 0)\n\t\treturn Fseek(off, (int) fd, whence);\n\tcurrent_off = Fseek(0, (int) fd, SEEK_CUR); /* find out where we are */\n\tif (whence == SEEK_SET)\n\t\texpected_off = off;\n\telse\n\t\texpected_off = off + current_off;\n\tnew_off = Fseek(off, (int) fd, whence);\n\tif (new_off == expected_off)\n\t\treturn new_off;\n\t/* otherwise extend file -- zero filling the hole */\n\tif (new_off < 0)            /* error? */\n\t\tnew_off = Fseek(0, (int) fd, SEEK_END); /* go to eof */\n\t_TIFFmemset(buf, 0, sizeof(buf));\n\twhile (expected_off > new_off) {\n\t\toff = expected_off - new_off;\n\t\tif (off > sizeof(buf))\n\t\t\toff = sizeof(buf);\n\t\tif ((current_off = Fwrite((int) fd, off, buf)) != off)\n\t\t\treturn (current_off > 0) ?\n\t\t\t    new_off + current_off : new_off;\n\t\tnew_off += off;\n\t}\n\treturn new_off;\n}\n\nstatic int\n_tiffCloseProc(thandle_t fd)\n{\n\tlong r;\n\n\tr = Fclose((int) fd);\n\tif (r < 0) {\n\t\terrno = (int)-r;\n\t\tr = -1;\n\t}\n\treturn (int)r;\n}\n\nstatic toff_t\n_tiffSizeProc(thandle_t fd)\n{\n\tlong pos, eof;\n\n\tpos = Fseek(0, (int) fd, SEEK_CUR);\n\teof = Fseek(0, (int) fd, SEEK_END);\n\tFseek(pos, (int) fd, SEEK_SET);\n\treturn eof;\n}\n\nstatic int\n_tiffMapProc(thandle_t fd, tdata_t* pbase, toff_t* psize)\n{\n\treturn (0);\n}\n\nstatic void\n_tiffUnmapProc(thandle_t fd, tdata_t base, toff_t size)\n{\n}\n\n/*\n* Open a TIFF file descriptor for read/writing.\n*/\nTIFF*\nTIFFFdOpen(int fd, const char* name, const char* mode)\n{\n\tTIFF* tif;\n\n\ttif = TIFFClientOpen(name, mode,\n\t\t(thandle_t) fd,\n\t\t_tiffReadProc, _tiffWriteProc, _tiffSeekProc, _tiffCloseProc,\n\t\t_tiffSizeProc, _tiffMapProc, _tiffUnmapProc);\n\tif (tif)\n\t\ttif->tif_fd = fd;\n\treturn (tif);\n}\n\n/*\n* Open a TIFF file for read/writing.\n*/\nTIFF*\nTIFFOpen(const char* name, const char* mode)\n{\n\tstatic const char module[] = \"TIFFOpen\";\n\tint m;\n\tlong fd;\n\n\tm = _TIFFgetMode(mode, module);\n\tif (m == -1)\n\t\treturn ((TIFF*)0);\n\tif (m & O_TRUNC) {\n\t\tfd = Fcreate(name, 0);\n\t} else {\n\t\tfd = Fopen(name, m & O_ACCMODE);\n\t\tif (fd == AEFILNF && m & O_CREAT)\n\t\t\tfd = Fcreate(name, 0);\n\t}\n\tif (fd < 0)\n\t\terrno = (int)fd;\n\tif (fd < 0) {\n\t\tTIFFErrorExt(0, module, \"%s: Cannot open\", name);\n\t\treturn ((TIFF*)0);\n\t}\n\treturn (TIFFFdOpen(fd, name, mode));\n}\n\n#include <stdlib.h>\n\ntdata_t\n_TIFFmalloc(tsize_t s)\n{\n\treturn (malloc((size_t) s));\n}\n\nvoid\n_TIFFfree(tdata_t p)\n{\n\tfree(p);\n}\n\ntdata_t\n_TIFFrealloc(tdata_t p, tsize_t s)\n{\n\treturn (realloc(p, (size_t) s));\n}\n\nvoid\n_TIFFmemset(tdata_t p, int v, size_t c)\n{\n\tmemset(p, v, (size_t) c);\n}\n\nvoid\n_TIFFmemcpy(tdata_t d, const tdata_t s, size_t c)\n{\n\tmemcpy(d, s, (size_t) c);\n}\n\nint\n_TIFFmemcmp(const tdata_t p1, const tdata_t p2, tsize_t c)\n{\n\treturn (memcmp(p1, p2, (size_t) c));\n}\n\nstatic void\natariWarningHandler(const char* module, const char* fmt, va_list ap)\n{\n\tif (module != NULL)\n\t\tfprintf(stderr, \"%s: \", module);\n\tfprintf(stderr, \"Warning, \");\n\tvfprintf(stderr, fmt, ap);\n\tfprintf(stderr, \".\\n\");\n}\nTIFFErrorHandler _TIFFwarningHandler = atariWarningHandler;\n\nstatic void\natariErrorHandler(const char* module, const char* fmt, va_list ap)\n{\n\tif (module != NULL)\n\t\tfprintf(stderr, \"%s: \", module);\n\tvfprintf(stderr, fmt, ap);\n\tfprintf(stderr, \".\\n\");\n}\nTIFFErrorHandler _TIFFerrorHandler = atariErrorHandler;\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/tif_aux.c",
    "content": "/* $Id: tif_aux.c,v 1.20 2006/06/08 14:24:13 dron Exp $ */\n\n/*\n * Copyright (c) 1991-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n/*\n * TIFF Library.\n *\n * Auxiliary Support Routines.\n */\n#include \"tiffiop.h\"\n#include \"tif_predict.h\"\n#include <math.h>\n\ntdata_t\n_TIFFCheckRealloc(TIFF* tif, tdata_t buffer,\n\t\t  size_t nmemb, size_t elem_size, const char* what)\n{\n\ttdata_t cp = NULL;\n\ttsize_t\tbytes = nmemb * elem_size;\n\n\t/*\n\t * XXX: Check for integer overflow.\n\t */\n\tif (nmemb && elem_size && bytes / elem_size == nmemb)\n\t\tcp = _TIFFrealloc(buffer, bytes);\n\n\tif (cp == NULL)\n\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t\t     \"No space %s\", what);\n\n\treturn cp;\n}\n\ntdata_t\n_TIFFCheckMalloc(TIFF* tif, size_t nmemb, size_t elem_size, const char* what)\n{\n\treturn _TIFFCheckRealloc(tif, NULL, nmemb, elem_size, what);\n}\n\nstatic int\nTIFFDefaultTransferFunction(TIFFDirectory* td)\n{\n\tuint16 **tf = td->td_transferfunction;\n\ttsize_t i, n, nbytes;\n\n\ttf[0] = tf[1] = tf[2] = 0;\n\tif (td->td_bitspersample >= sizeof(tsize_t) * 8 - 2)\n\t\treturn 0;\n\n\tn = 1<<td->td_bitspersample;\n\tnbytes = n * sizeof (uint16);\n\tif (!(tf[0] = (uint16 *)_TIFFmalloc(nbytes)))\n\t\treturn 0;\n\ttf[0][0] = 0;\n\tfor (i = 1; i < n; i++) {\n\t\tdouble t = (double)i/((double) n-1.);\n\t\ttf[0][i] = (uint16)floor(65535.*pow(t, 2.2) + .5);\n\t}\n\n\tif (td->td_samplesperpixel - td->td_extrasamples > 1) {\n\t\tif (!(tf[1] = (uint16 *)_TIFFmalloc(nbytes)))\n\t\t\tgoto bad;\n\t\t_TIFFmemcpy(tf[1], tf[0], nbytes);\n\t\tif (!(tf[2] = (uint16 *)_TIFFmalloc(nbytes)))\n\t\t\tgoto bad;\n\t\t_TIFFmemcpy(tf[2], tf[0], nbytes);\n\t}\n\treturn 1;\n\nbad:\n\tif (tf[0])\n\t\t_TIFFfree(tf[0]);\n\tif (tf[1])\n\t\t_TIFFfree(tf[1]);\n\tif (tf[2])\n\t\t_TIFFfree(tf[2]);\n\ttf[0] = tf[1] = tf[2] = 0;\n\treturn 0;\n}\n\n/*\n * Like TIFFGetField, but return any default\n * value if the tag is not present in the directory.\n *\n * NB:\tWe use the value in the directory, rather than\n *\texplcit values so that defaults exist only one\n *\tplace in the library -- in TIFFDefaultDirectory.\n */\nint\nTIFFVGetFieldDefaulted(TIFF* tif, ttag_t tag, va_list ap)\n{\n\tTIFFDirectory *td = &tif->tif_dir;\n\n\tif (TIFFVGetField(tif, tag, ap))\n\t\treturn (1);\n\tswitch (tag) {\n\tcase TIFFTAG_SUBFILETYPE:\n\t\t*va_arg(ap, uint32 *) = td->td_subfiletype;\n\t\treturn (1);\n\tcase TIFFTAG_BITSPERSAMPLE:\n\t\t*va_arg(ap, uint16 *) = td->td_bitspersample;\n\t\treturn (1);\n\tcase TIFFTAG_THRESHHOLDING:\n\t\t*va_arg(ap, uint16 *) = td->td_threshholding;\n\t\treturn (1);\n\tcase TIFFTAG_FILLORDER:\n\t\t*va_arg(ap, uint16 *) = td->td_fillorder;\n\t\treturn (1);\n\tcase TIFFTAG_ORIENTATION:\n\t\t*va_arg(ap, uint16 *) = td->td_orientation;\n\t\treturn (1);\n\tcase TIFFTAG_SAMPLESPERPIXEL:\n\t\t*va_arg(ap, uint16 *) = td->td_samplesperpixel;\n\t\treturn (1);\n\tcase TIFFTAG_ROWSPERSTRIP:\n\t\t*va_arg(ap, uint32 *) = td->td_rowsperstrip;\n\t\treturn (1);\n\tcase TIFFTAG_MINSAMPLEVALUE:\n\t\t*va_arg(ap, uint16 *) = td->td_minsamplevalue;\n\t\treturn (1);\n\tcase TIFFTAG_MAXSAMPLEVALUE:\n\t\t*va_arg(ap, uint16 *) = td->td_maxsamplevalue;\n\t\treturn (1);\n\tcase TIFFTAG_PLANARCONFIG:\n\t\t*va_arg(ap, uint16 *) = td->td_planarconfig;\n\t\treturn (1);\n\tcase TIFFTAG_RESOLUTIONUNIT:\n\t\t*va_arg(ap, uint16 *) = td->td_resolutionunit;\n\t\treturn (1);\n\tcase TIFFTAG_PREDICTOR:\n                {\n\t\t\tTIFFPredictorState* sp = (TIFFPredictorState*) tif->tif_data;\n\t\t\t*va_arg(ap, uint16*) = (uint16) sp->predictor;\n\t\t\treturn 1;\n                }\n\tcase TIFFTAG_DOTRANGE:\n\t\t*va_arg(ap, uint16 *) = 0;\n\t\t*va_arg(ap, uint16 *) = (1<<td->td_bitspersample)-1;\n\t\treturn (1);\n\tcase TIFFTAG_INKSET:\n\t\t*va_arg(ap, uint16 *) = INKSET_CMYK;\n\t\treturn 1;\n\tcase TIFFTAG_NUMBEROFINKS:\n\t\t*va_arg(ap, uint16 *) = 4;\n\t\treturn (1);\n\tcase TIFFTAG_EXTRASAMPLES:\n\t\t*va_arg(ap, uint16 *) = td->td_extrasamples;\n\t\t*va_arg(ap, uint16 **) = td->td_sampleinfo;\n\t\treturn (1);\n\tcase TIFFTAG_MATTEING:\n\t\t*va_arg(ap, uint16 *) =\n\t\t    (td->td_extrasamples == 1 &&\n\t\t     td->td_sampleinfo[0] == EXTRASAMPLE_ASSOCALPHA);\n\t\treturn (1);\n\tcase TIFFTAG_TILEDEPTH:\n\t\t*va_arg(ap, uint32 *) = td->td_tiledepth;\n\t\treturn (1);\n\tcase TIFFTAG_DATATYPE:\n\t\t*va_arg(ap, uint16 *) = td->td_sampleformat-1;\n\t\treturn (1);\n\tcase TIFFTAG_SAMPLEFORMAT:\n\t\t*va_arg(ap, uint16 *) = td->td_sampleformat;\n                return(1);\n\tcase TIFFTAG_IMAGEDEPTH:\n\t\t*va_arg(ap, uint32 *) = td->td_imagedepth;\n\t\treturn (1);\n\tcase TIFFTAG_YCBCRCOEFFICIENTS:\n\t\t{\n\t\t\t/* defaults are from CCIR Recommendation 601-1 */\n\t\t\tstatic float ycbcrcoeffs[] = { 0.299f, 0.587f, 0.114f };\n\t\t\t*va_arg(ap, float **) = ycbcrcoeffs;\n\t\t\treturn 1;\n\t\t}\n\tcase TIFFTAG_YCBCRSUBSAMPLING:\n\t\t*va_arg(ap, uint16 *) = td->td_ycbcrsubsampling[0];\n\t\t*va_arg(ap, uint16 *) = td->td_ycbcrsubsampling[1];\n\t\treturn (1);\n\tcase TIFFTAG_YCBCRPOSITIONING:\n\t\t*va_arg(ap, uint16 *) = td->td_ycbcrpositioning;\n\t\treturn (1);\n\tcase TIFFTAG_WHITEPOINT:\n\t\t{\n\t\t\tstatic float whitepoint[2];\n\n\t\t\t/* TIFF 6.0 specification tells that it is no default\n\t\t\t   value for the WhitePoint, but AdobePhotoshop TIFF\n\t\t\t   Technical Note tells that it should be CIE D50. */\n\t\t\twhitepoint[0] =\tD50_X0 / (D50_X0 + D50_Y0 + D50_Z0);\n\t\t\twhitepoint[1] =\tD50_Y0 / (D50_X0 + D50_Y0 + D50_Z0);\n\t\t\t*va_arg(ap, float **) = whitepoint;\n\t\t\treturn 1;\n\t\t}\n\tcase TIFFTAG_TRANSFERFUNCTION:\n\t\tif (!td->td_transferfunction[0] &&\n\t\t    !TIFFDefaultTransferFunction(td)) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name, \"No space for \\\"TransferFunction\\\" tag\");\n\t\t\treturn (0);\n\t\t}\n\t\t*va_arg(ap, uint16 **) = td->td_transferfunction[0];\n\t\tif (td->td_samplesperpixel - td->td_extrasamples > 1) {\n\t\t\t*va_arg(ap, uint16 **) = td->td_transferfunction[1];\n\t\t\t*va_arg(ap, uint16 **) = td->td_transferfunction[2];\n\t\t}\n\t\treturn (1);\n\tcase TIFFTAG_REFERENCEBLACKWHITE:\n\t\t{\n\t\t\tint i;\n\t\t\tstatic float ycbcr_refblackwhite[] = \n\t\t\t{ 0.0F, 255.0F, 128.0F, 255.0F, 128.0F, 255.0F };\n\t\t\tstatic float rgb_refblackwhite[6];\n\n\t\t\tfor (i = 0; i < 3; i++) {\n\t\t\t\trgb_refblackwhite[2 * i + 0] = 0.0F;\n\t\t\t\trgb_refblackwhite[2 * i + 1] =\n\t\t\t\t\t(float)((1L<<td->td_bitspersample)-1L);\n\t\t\t}\n\t\t\t\n\t\t\tif (td->td_photometric == PHOTOMETRIC_YCBCR) {\n\t\t\t\t/*\n\t\t\t\t * YCbCr (Class Y) images must have the\n\t\t\t\t * ReferenceBlackWhite tag set. Fix the\n\t\t\t\t * broken images, which lacks that tag.\n\t\t\t\t */\n\t\t\t\t*va_arg(ap, float **) = ycbcr_refblackwhite;\n\t\t\t} else {\n\t\t\t\t/*\n\t\t\t\t * Assume RGB (Class R)\n\t\t\t\t */\n\t\t\t\t*va_arg(ap, float **) = rgb_refblackwhite;\n\t\t\t}\n\t\t\treturn 1;\n\t\t}\n\t}\n\treturn 0;\n}\n\n/*\n * Like TIFFGetField, but return any default\n * value if the tag is not present in the directory.\n */\nint\nTIFFGetFieldDefaulted(TIFF* tif, ttag_t tag, ...)\n{\n\tint ok;\n\tva_list ap;\n\n\tva_start(ap, tag);\n\tok =  TIFFVGetFieldDefaulted(tif, tag, ap);\n\tva_end(ap);\n\treturn (ok);\n}\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/tif_close.c",
    "content": "/* $Id: tif_close.c,v 1.10 2006/03/25 03:09:24 joris Exp $ */\n\n/*\n * Copyright (c) 1988-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n/*\n * TIFF Library.\n */\n#include \"tiffiop.h\"\n\n/************************************************************************/\n/*                            TIFFCleanup()                             */\n/************************************************************************/\n\n/**\n * Auxiliary function to free the TIFF structure. Given structure will be\n * completetly freed, so you should save opened file handle and pointer\n * to the close procedure in external variables before calling\n * _TIFFCleanup(), if you will need these ones to close the file.\n * \n * @param tif A TIFF pointer.\n */\n\nvoid\nTIFFCleanup(TIFF* tif)\n{\n\tif (tif->tif_mode != O_RDONLY)\n\t    /*\n\t     * Flush buffered data and directory (if dirty).\n\t     */\n\t    TIFFFlush(tif);\n\t(*tif->tif_cleanup)(tif);\n\tTIFFFreeDirectory(tif);\n\n\tif (tif->tif_dirlist)\n\t\t_TIFFfree(tif->tif_dirlist);\n\n\t/* Clean up client info links */\n\twhile( tif->tif_clientinfo )\n\t{\n\t\tTIFFClientInfoLink *link = tif->tif_clientinfo;\n\n\t\ttif->tif_clientinfo = link->next;\n\t\t_TIFFfree( link->name );\n\t\t_TIFFfree( link );\n\t}\n\n\tif (tif->tif_rawdata && (tif->tif_flags&TIFF_MYBUFFER))\n\t\t_TIFFfree(tif->tif_rawdata);\n\tif (isMapped(tif))\n\t\tTIFFUnmapFileContents(tif, tif->tif_base, tif->tif_size);\n\n\t/* Clean up custom fields */\n\tif (tif->tif_nfields > 0)\n\t{\n\t\tsize_t  i;\n\n\t    for (i = 0; i < tif->tif_nfields; i++) \n\t    {\n\t\tTIFFFieldInfo *fld = tif->tif_fieldinfo[i];\n\t\tif (fld->field_bit == FIELD_CUSTOM && \n\t\t    strncmp(\"Tag \", fld->field_name, 4) == 0) \n\t\t{\n\t\t    _TIFFfree(fld->field_name);\n\t\t    _TIFFfree(fld);\n\t\t}\n\t    }   \n\t  \n\t    _TIFFfree(tif->tif_fieldinfo);\n\t}\n\n\t_TIFFfree(tif);\n}\n\n/************************************************************************/\n/*                            TIFFClose()                               */\n/************************************************************************/\n\n/**\n * Close a previously opened TIFF file.\n *\n * TIFFClose closes a file that was previously opened with TIFFOpen().\n * Any buffered data are flushed to the file, including the contents of\n * the current directory (if modified); and all resources are reclaimed.\n * \n * @param tif A TIFF pointer.\n */\n\nvoid\nTIFFClose(TIFF* tif)\n{\n\tTIFFCloseProc closeproc = tif->tif_closeproc;\n\tthandle_t fd = tif->tif_clientdata;\n\n\tTIFFCleanup(tif);\n\t(void) (*closeproc)(fd);\n}\n\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/tif_codec.c",
    "content": "/* $Id: tif_codec.c,v 1.10.2.1 2008-12-18 19:50:41 fwarmerdam Exp $ */\n\n/*\n * Copyright (c) 1988-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n/*\n * TIFF Library\n *\n * Builtin Compression Scheme Configuration Support.\n */\n#include \"tiffiop.h\"\n\nstatic\tint NotConfigured(TIFF*, int);\n\n#ifndef\tLZW_SUPPORT\n#define\tTIFFInitLZW\t\tNotConfigured\n#endif\n#ifndef\tPACKBITS_SUPPORT\n#define\tTIFFInitPackBits\tNotConfigured\n#endif\n#ifndef\tTHUNDER_SUPPORT\n#define\tTIFFInitThunderScan\tNotConfigured\n#endif\n#ifndef\tNEXT_SUPPORT\n#define\tTIFFInitNeXT\t\tNotConfigured\n#endif\n#ifndef\tJPEG_SUPPORT\n#define\tTIFFInitJPEG\t\tNotConfigured\n#endif\n#ifndef\tOJPEG_SUPPORT\n#define\tTIFFInitOJPEG\t\tNotConfigured\n#endif\n#ifndef\tCCITT_SUPPORT\n#define\tTIFFInitCCITTRLE\tNotConfigured\n#define\tTIFFInitCCITTRLEW\tNotConfigured\n#define\tTIFFInitCCITTFax3\tNotConfigured\n#define\tTIFFInitCCITTFax4\tNotConfigured\n#endif\n#ifndef JBIG_SUPPORT\n#define\tTIFFInitJBIG\t\tNotConfigured\n#endif\n#ifndef\tZIP_SUPPORT\n#define\tTIFFInitZIP\t\tNotConfigured\n#endif\n#ifndef\tPIXARLOG_SUPPORT\n#define\tTIFFInitPixarLog\tNotConfigured\n#endif\n#ifndef LOGLUV_SUPPORT\n#define TIFFInitSGILog\t\tNotConfigured\n#endif\n\n/*\n * Compression schemes statically built into the library.\n */\n#ifdef VMS\nconst TIFFCodec _TIFFBuiltinCODECS[] = {\n#else\nTIFFCodec _TIFFBuiltinCODECS[] = {\n#endif\n    { \"None\",\t\tCOMPRESSION_NONE,\tTIFFInitDumpMode },\n    { \"LZW\",\t\tCOMPRESSION_LZW,\tTIFFInitLZW },\n    { \"PackBits\",\tCOMPRESSION_PACKBITS,\tTIFFInitPackBits },\n    { \"ThunderScan\",\tCOMPRESSION_THUNDERSCAN,TIFFInitThunderScan },\n    { \"NeXT\",\t\tCOMPRESSION_NEXT,\tTIFFInitNeXT },\n    { \"JPEG\",\t\tCOMPRESSION_JPEG,\tTIFFInitJPEG },\n    { \"Old-style JPEG\",\tCOMPRESSION_OJPEG,\tTIFFInitOJPEG },\n    { \"CCITT RLE\",\tCOMPRESSION_CCITTRLE,\tTIFFInitCCITTRLE },\n    { \"CCITT RLE/W\",\tCOMPRESSION_CCITTRLEW,\tTIFFInitCCITTRLEW },\n    { \"CCITT Group 3\",\tCOMPRESSION_CCITTFAX3,\tTIFFInitCCITTFax3 },\n    { \"CCITT Group 4\",\tCOMPRESSION_CCITTFAX4,\tTIFFInitCCITTFax4 },\n    { \"ISO JBIG\",\tCOMPRESSION_JBIG,\tTIFFInitJBIG },\n    { \"Deflate\",\tCOMPRESSION_DEFLATE,\tTIFFInitZIP },\n    { \"AdobeDeflate\",   COMPRESSION_ADOBE_DEFLATE , TIFFInitZIP }, \n    { \"PixarLog\",\tCOMPRESSION_PIXARLOG,\tTIFFInitPixarLog },\n    { \"SGILog\",\t\tCOMPRESSION_SGILOG,\tTIFFInitSGILog },\n    { \"SGILog24\",\tCOMPRESSION_SGILOG24,\tTIFFInitSGILog },\n    { NULL,             0,                      NULL }\n};\n\nstatic int\n_notConfigured(TIFF* tif)\n{\n\tconst TIFFCodec* c = TIFFFindCODEC(tif->tif_dir.td_compression);\n        char compression_code[20];\n        \n        sprintf( compression_code, \"%d\", tif->tif_dir.td_compression );\n\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n                     \"%s compression support is not configured\", \n                     c ? c->name : compression_code );\n\treturn (0);\n}\n\nstatic int\nNotConfigured(TIFF* tif, int scheme)\n{\n    (void) scheme;\n    \n    tif->tif_decodestatus = FALSE;\n    tif->tif_setupdecode = _notConfigured;\n    tif->tif_encodestatus = FALSE;\n    tif->tif_setupencode = _notConfigured;\n    return (1);\n}\n\n/************************************************************************/\n/*                       TIFFIsCODECConfigured()                        */\n/************************************************************************/\n\n/**\n * Check whether we have working codec for the specific coding scheme.\n * \n * @return returns 1 if the codec is configured and working. Otherwise\n * 0 will be returned.\n */\n\nint\nTIFFIsCODECConfigured(uint16 scheme)\n{\n\tconst TIFFCodec* codec = TIFFFindCODEC(scheme);\n\n\tif(codec == NULL) {\n            return 0;\n        }\n        if(codec->init == NULL) {\n            return 0;\n        }\n\tif(codec->init != NotConfigured){\n            return 1;\n        }\n\treturn 0;\n}\n\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/tif_color.c",
    "content": "/* $Id: tif_color.c,v 1.12 2006/02/09 15:42:20 dron Exp $ */\n\n/*\n * Copyright (c) 1988-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n/*\n * CIE L*a*b* to CIE XYZ and CIE XYZ to RGB conversion routines are taken\n * from the VIPS library (http://www.vips.ecs.soton.ac.uk) with\n * the permission of John Cupitt, the VIPS author.\n */\n\n/*\n * TIFF Library.\n *\n * Color space conversion routines.\n */\n\n#include \"tiffiop.h\"\n#include <math.h>\n\n/*\n * Convert color value from the CIE L*a*b* 1976 space to CIE XYZ.\n */\nvoid\nTIFFCIELabToXYZ(TIFFCIELabToRGB *cielab, uint32 l, int32 a, int32 b,\n\t\tfloat *X, float *Y, float *Z)\n{\n\tfloat L = (float)l * 100.0F / 255.0F;\n\tfloat cby, tmp;\n\n\tif( L < 8.856F ) {\n\t\t*Y = (L * cielab->Y0) / 903.292F;\n\t\tcby = 7.787F * (*Y / cielab->Y0) + 16.0F / 116.0F;\n\t} else {\n\t\tcby = (L + 16.0F) / 116.0F;\n\t\t*Y = cielab->Y0 * cby * cby * cby;\n\t}\n\n\ttmp = (float)a / 500.0F + cby;\n\tif( tmp < 0.2069F )\n\t\t*X = cielab->X0 * (tmp - 0.13793F) / 7.787F;\n\telse    \n\t\t*X = cielab->X0 * tmp * tmp * tmp;\n\n\ttmp = cby - (float)b / 200.0F;\n\tif( tmp < 0.2069F )\n\t\t*Z = cielab->Z0 * (tmp - 0.13793F) / 7.787F;\n\telse    \n\t\t*Z = cielab->Z0 * tmp * tmp * tmp;\n}\n\n#define RINT(R) ((uint32)((R)>0?((R)+0.5):((R)-0.5)))\n/*\n * Convert color value from the XYZ space to RGB.\n */\nvoid\nTIFFXYZToRGB(TIFFCIELabToRGB *cielab, float X, float Y, float Z,\n\t     uint32 *r, uint32 *g, uint32 *b)\n{\n\tint i;\n\tfloat Yr, Yg, Yb;\n\tfloat *matrix = &cielab->display.d_mat[0][0];\n\n\t/* Multiply through the matrix to get luminosity values. */\n\tYr =  matrix[0] * X + matrix[1] * Y + matrix[2] * Z;\n\tYg =  matrix[3] * X + matrix[4] * Y + matrix[5] * Z;\n\tYb =  matrix[6] * X + matrix[7] * Y + matrix[8] * Z;\n\n\t/* Clip input */\n\tYr = TIFFmax(Yr, cielab->display.d_Y0R);\n\tYg = TIFFmax(Yg, cielab->display.d_Y0G);\n\tYb = TIFFmax(Yb, cielab->display.d_Y0B);\n\n\t/* Avoid overflow in case of wrong input values */\n\tYr = TIFFmin(Yr, cielab->display.d_YCR);\n\tYg = TIFFmin(Yg, cielab->display.d_YCG);\n\tYb = TIFFmin(Yb, cielab->display.d_YCB);\n\n\t/* Turn luminosity to colour value. */\n\ti = (int)((Yr - cielab->display.d_Y0R) / cielab->rstep);\n\ti = TIFFmin(cielab->range, i);\n\t*r = RINT(cielab->Yr2r[i]);\n\n\ti = (int)((Yg - cielab->display.d_Y0G) / cielab->gstep);\n\ti = TIFFmin(cielab->range, i);\n\t*g = RINT(cielab->Yg2g[i]);\n\n\ti = (int)((Yb - cielab->display.d_Y0B) / cielab->bstep);\n\ti = TIFFmin(cielab->range, i);\n\t*b = RINT(cielab->Yb2b[i]);\n\n\t/* Clip output. */\n\t*r = TIFFmin(*r, cielab->display.d_Vrwr);\n\t*g = TIFFmin(*g, cielab->display.d_Vrwg);\n\t*b = TIFFmin(*b, cielab->display.d_Vrwb);\n}\n#undef RINT\n\n/* \n * Allocate conversion state structures and make look_up tables for\n * the Yr,Yb,Yg <=> r,g,b conversions.\n */\nint\nTIFFCIELabToRGBInit(TIFFCIELabToRGB* cielab,\n\t\t    TIFFDisplay *display, float *refWhite)\n{\n\tint i;\n\tdouble gamma;\n\n\tcielab->range = CIELABTORGB_TABLE_RANGE;\n\n\t_TIFFmemcpy(&cielab->display, display, sizeof(TIFFDisplay));\n\n\t/* Red */\n\tgamma = 1.0 / cielab->display.d_gammaR ;\n\tcielab->rstep =\n\t\t(cielab->display.d_YCR - cielab->display.d_Y0R)\t/ cielab->range;\n\tfor(i = 0; i <= cielab->range; i++) {\n\t\tcielab->Yr2r[i] = cielab->display.d_Vrwr\n\t\t    * ((float)pow((double)i / cielab->range, gamma));\n\t}\n\n\t/* Green */\n\tgamma = 1.0 / cielab->display.d_gammaG ;\n\tcielab->gstep =\n\t    (cielab->display.d_YCR - cielab->display.d_Y0R) / cielab->range;\n\tfor(i = 0; i <= cielab->range; i++) {\n\t\tcielab->Yg2g[i] = cielab->display.d_Vrwg\n\t\t    * ((float)pow((double)i / cielab->range, gamma));\n\t}\n\n\t/* Blue */\n\tgamma = 1.0 / cielab->display.d_gammaB ;\n\tcielab->bstep =\n\t    (cielab->display.d_YCR - cielab->display.d_Y0R) / cielab->range;\n\tfor(i = 0; i <= cielab->range; i++) {\n\t\tcielab->Yb2b[i] = cielab->display.d_Vrwb\n\t\t    * ((float)pow((double)i / cielab->range, gamma));\n\t}\n\n\t/* Init reference white point */\n\tcielab->X0 = refWhite[0];\n\tcielab->Y0 = refWhite[1];\n\tcielab->Z0 = refWhite[2];\n\n\treturn 0;\n}\n\n/* \n * Convert color value from the YCbCr space to CIE XYZ.\n * The colorspace conversion algorithm comes from the IJG v5a code;\n * see below for more information on how it works.\n */\n#define\tSHIFT\t\t\t16\n#define\tFIX(x)\t\t\t((int32)((x) * (1L<<SHIFT) + 0.5))\n#define\tONE_HALF\t\t((int32)(1<<(SHIFT-1)))\n#define\tCode2V(c, RB, RW, CR)\t((((c)-(int32)(RB))*(float)(CR))/(float)(((RW)-(RB)) ? ((RW)-(RB)) : 1))\n#define\tCLAMP(f,min,max)\t((f)<(min)?(min):(f)>(max)?(max):(f))\n#define HICLAMP(f,max)\t\t((f)>(max)?(max):(f))\n\nvoid\nTIFFYCbCrtoRGB(TIFFYCbCrToRGB *ycbcr, uint32 Y, int32 Cb, int32 Cr,\n\t       uint32 *r, uint32 *g, uint32 *b)\n{\n\t/* XXX: Only 8-bit YCbCr input supported for now */\n\tY = HICLAMP(Y, 255), Cb = CLAMP(Cb, 0, 255), Cr = CLAMP(Cr, 0, 255);\n\n\t*r = ycbcr->clamptab[ycbcr->Y_tab[Y] + ycbcr->Cr_r_tab[Cr]];\n\t*g = ycbcr->clamptab[ycbcr->Y_tab[Y]\n\t    + (int)((ycbcr->Cb_g_tab[Cb] + ycbcr->Cr_g_tab[Cr]) >> SHIFT)];\n\t*b = ycbcr->clamptab[ycbcr->Y_tab[Y] + ycbcr->Cb_b_tab[Cb]];\n}\n\n/*\n * Initialize the YCbCr->RGB conversion tables.  The conversion\n * is done according to the 6.0 spec:\n *\n *    R = Y + Cr*(2 - 2*LumaRed)\n *    B = Y + Cb*(2 - 2*LumaBlue)\n *    G =   Y\n *        - LumaBlue*Cb*(2-2*LumaBlue)/LumaGreen\n *        - LumaRed*Cr*(2-2*LumaRed)/LumaGreen\n *\n * To avoid floating point arithmetic the fractional constants that\n * come out of the equations are represented as fixed point values\n * in the range 0...2^16.  We also eliminate multiplications by\n * pre-calculating possible values indexed by Cb and Cr (this code\n * assumes conversion is being done for 8-bit samples).\n */\nint\nTIFFYCbCrToRGBInit(TIFFYCbCrToRGB* ycbcr, float *luma, float *refBlackWhite)\n{\n    TIFFRGBValue* clamptab;\n    int i;\n    \n#define LumaRed\t    luma[0]\n#define LumaGreen   luma[1]\n#define LumaBlue    luma[2]\n\n    clamptab = (TIFFRGBValue*)(\n\t(tidata_t) ycbcr+TIFFroundup(sizeof (TIFFYCbCrToRGB), sizeof (long)));\n    _TIFFmemset(clamptab, 0, 256);\t\t/* v < 0 => 0 */\n    ycbcr->clamptab = (clamptab += 256);\n    for (i = 0; i < 256; i++)\n\tclamptab[i] = (TIFFRGBValue) i;\n    _TIFFmemset(clamptab+256, 255, 2*256);\t/* v > 255 => 255 */\n    ycbcr->Cr_r_tab = (int*) (clamptab + 3*256);\n    ycbcr->Cb_b_tab = ycbcr->Cr_r_tab + 256;\n    ycbcr->Cr_g_tab = (int32*) (ycbcr->Cb_b_tab + 256);\n    ycbcr->Cb_g_tab = ycbcr->Cr_g_tab + 256;\n    ycbcr->Y_tab = ycbcr->Cb_g_tab + 256;\n\n    { float f1 = 2-2*LumaRed;\t\tint32 D1 = FIX(f1);\n      float f2 = LumaRed*f1/LumaGreen;\tint32 D2 = -FIX(f2);\n      float f3 = 2-2*LumaBlue;\t\tint32 D3 = FIX(f3);\n      float f4 = LumaBlue*f3/LumaGreen;\tint32 D4 = -FIX(f4);\n      int x;\n\n#undef LumaBlue\n#undef LumaGreen\n#undef LumaRed\n      \n      /*\n       * i is the actual input pixel value in the range 0..255\n       * Cb and Cr values are in the range -128..127 (actually\n       * they are in a range defined by the ReferenceBlackWhite\n       * tag) so there is some range shifting to do here when\n       * constructing tables indexed by the raw pixel data.\n       */\n      for (i = 0, x = -128; i < 256; i++, x++) {\n\t    int32 Cr = (int32)Code2V(x, refBlackWhite[4] - 128.0F,\n\t\t\t    refBlackWhite[5] - 128.0F, 127);\n\t    int32 Cb = (int32)Code2V(x, refBlackWhite[2] - 128.0F,\n\t\t\t    refBlackWhite[3] - 128.0F, 127);\n\n\t    ycbcr->Cr_r_tab[i] = (int32)((D1*Cr + ONE_HALF)>>SHIFT);\n\t    ycbcr->Cb_b_tab[i] = (int32)((D3*Cb + ONE_HALF)>>SHIFT);\n\t    ycbcr->Cr_g_tab[i] = D2*Cr;\n\t    ycbcr->Cb_g_tab[i] = D4*Cb + ONE_HALF;\n\t    ycbcr->Y_tab[i] =\n\t\t    (int32)Code2V(x + 128, refBlackWhite[0], refBlackWhite[1], 255);\n      }\n    }\n\n    return 0;\n}\n#undef\tHICLAMP\n#undef\tCLAMP\n#undef\tCode2V\n#undef\tSHIFT\n#undef\tONE_HALF\n#undef\tFIX\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/tif_compress.c",
    "content": "/* $Id: tif_compress.c,v 1.13 2007/02/24 15:03:50 dron Exp $ */\n\n/*\n * Copyright (c) 1988-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n/*\n * TIFF Library\n *\n * Compression Scheme Configuration Support.\n */\n#include \"tiffiop.h\"\n\nstatic int\nTIFFNoEncode(TIFF* tif, const char* method)\n{\n\tconst TIFFCodec* c = TIFFFindCODEC(tif->tif_dir.td_compression);\n\n\tif (c) { \n\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t\t     \"%s %s encoding is not implemented\",\n\t\t\t     c->name, method);\n\t} else { \n\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t\t\"Compression scheme %u %s encoding is not implemented\",\n\t\t\t     tif->tif_dir.td_compression, method);\n\t}\n\treturn (-1);\n}\n\nint\n_TIFFNoRowEncode(TIFF* tif, tidata_t pp, tsize_t cc, tsample_t s)\n{\n\t(void) pp; (void) cc; (void) s;\n\treturn (TIFFNoEncode(tif, \"scanline\"));\n}\n\nint\n_TIFFNoStripEncode(TIFF* tif, tidata_t pp, tsize_t cc, tsample_t s)\n{\n\t(void) pp; (void) cc; (void) s;\n\treturn (TIFFNoEncode(tif, \"strip\"));\n}\n\nint\n_TIFFNoTileEncode(TIFF* tif, tidata_t pp, tsize_t cc, tsample_t s)\n{\n\t(void) pp; (void) cc; (void) s;\n\treturn (TIFFNoEncode(tif, \"tile\"));\n}\n\nstatic int\nTIFFNoDecode(TIFF* tif, const char* method)\n{\n\tconst TIFFCodec* c = TIFFFindCODEC(tif->tif_dir.td_compression);\n\n\tif (c)\n\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t\t     \"%s %s decoding is not implemented\",\n\t\t\t     c->name, method);\n\telse\n\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t\t     \"Compression scheme %u %s decoding is not implemented\",\n\t\t\t     tif->tif_dir.td_compression, method);\n\treturn (-1);\n}\n\nint\n_TIFFNoRowDecode(TIFF* tif, tidata_t pp, tsize_t cc, tsample_t s)\n{\n\t(void) pp; (void) cc; (void) s;\n\treturn (TIFFNoDecode(tif, \"scanline\"));\n}\n\nint\n_TIFFNoStripDecode(TIFF* tif, tidata_t pp, tsize_t cc, tsample_t s)\n{\n\t(void) pp; (void) cc; (void) s;\n\treturn (TIFFNoDecode(tif, \"strip\"));\n}\n\nint\n_TIFFNoTileDecode(TIFF* tif, tidata_t pp, tsize_t cc, tsample_t s)\n{\n\t(void) pp; (void) cc; (void) s;\n\treturn (TIFFNoDecode(tif, \"tile\"));\n}\n\nint\n_TIFFNoSeek(TIFF* tif, uint32 off)\n{\n\t(void) off;\n\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t     \"Compression algorithm does not support random access\");\n\treturn (0);\n}\n\nint\n_TIFFNoPreCode(TIFF* tif, tsample_t s)\n{\n\t(void) tif; (void) s;\n\treturn (1);\n}\n\nstatic int _TIFFtrue(TIFF* tif) { (void) tif; return (1); }\nstatic void _TIFFvoid(TIFF* tif) { (void) tif; }\n\nvoid\n_TIFFSetDefaultCompressionState(TIFF* tif)\n{\n\ttif->tif_decodestatus = TRUE;\n\ttif->tif_setupdecode = _TIFFtrue;\n\ttif->tif_predecode = _TIFFNoPreCode;\n\ttif->tif_decoderow = _TIFFNoRowDecode;\n\ttif->tif_decodestrip = _TIFFNoStripDecode;\n\ttif->tif_decodetile = _TIFFNoTileDecode;\n\ttif->tif_encodestatus = TRUE;\n\ttif->tif_setupencode = _TIFFtrue;\n\ttif->tif_preencode = _TIFFNoPreCode;\n\ttif->tif_postencode = _TIFFtrue;\n\ttif->tif_encoderow = _TIFFNoRowEncode;\n\ttif->tif_encodestrip = _TIFFNoStripEncode;\n\ttif->tif_encodetile = _TIFFNoTileEncode;\n\ttif->tif_close = _TIFFvoid;\n\ttif->tif_seek = _TIFFNoSeek;\n\ttif->tif_cleanup = _TIFFvoid;\n\ttif->tif_defstripsize = _TIFFDefaultStripSize;\n\ttif->tif_deftilesize = _TIFFDefaultTileSize;\n\ttif->tif_flags &= ~(TIFF_NOBITREV|TIFF_NOREADRAW);\n}\n\nint\nTIFFSetCompressionScheme(TIFF* tif, int scheme)\n{\n\tconst TIFFCodec *c = TIFFFindCODEC((uint16) scheme);\n\n\t_TIFFSetDefaultCompressionState(tif);\n\t/*\n\t * Don't treat an unknown compression scheme as an error.\n\t * This permits applications to open files with data that\n\t * the library does not have builtin support for, but which\n\t * may still be meaningful.\n\t */\n\treturn (c ? (*c->init)(tif, scheme) : 1);\n}\n\n/*\n * Other compression schemes may be registered.  Registered\n * schemes can also override the builtin versions provided\n * by this library.\n */\ntypedef struct _codec {\n\tstruct _codec*\tnext;\n\tTIFFCodec*\tinfo;\n} codec_t;\nstatic\tcodec_t* registeredCODECS = NULL;\n\nconst TIFFCodec*\nTIFFFindCODEC(uint16 scheme)\n{\n\tconst TIFFCodec* c;\n\tcodec_t* cd;\n\n\tfor (cd = registeredCODECS; cd; cd = cd->next)\n\t\tif (cd->info->scheme == scheme)\n\t\t\treturn ((const TIFFCodec*) cd->info);\n\tfor (c = _TIFFBuiltinCODECS; c->name; c++)\n\t\tif (c->scheme == scheme)\n\t\t\treturn (c);\n\treturn ((const TIFFCodec*) 0);\n}\n\nTIFFCodec*\nTIFFRegisterCODEC(uint16 scheme, const char* name, TIFFInitMethod init)\n{\n\tcodec_t* cd = (codec_t*)\n\t    _TIFFmalloc(sizeof (codec_t) + sizeof (TIFFCodec) + strlen(name)+1);\n\n\tif (cd != NULL) {\n\t\tcd->info = (TIFFCodec*) ((tidata_t) cd + sizeof (codec_t));\n\t\tcd->info->name = (char*)\n\t\t    ((tidata_t) cd->info + sizeof (TIFFCodec));\n\t\tstrcpy(cd->info->name, name);\n\t\tcd->info->scheme = scheme;\n\t\tcd->info->init = init;\n\t\tcd->next = registeredCODECS;\n\t\tregisteredCODECS = cd;\n\t} else {\n\t\tTIFFErrorExt(0, \"TIFFRegisterCODEC\",\n\t\t    \"No space to register compression scheme %s\", name);\n\t\treturn NULL;\n\t}\n\treturn (cd->info);\n}\n\nvoid\nTIFFUnRegisterCODEC(TIFFCodec* c)\n{\n\tcodec_t* cd;\n\tcodec_t** pcd;\n\n\tfor (pcd = &registeredCODECS; (cd = *pcd); pcd = &cd->next)\n\t\tif (cd->info == c) {\n\t\t\t*pcd = cd->next;\n\t\t\t_TIFFfree(cd);\n\t\t\treturn;\n\t\t}\n\tTIFFErrorExt(0, \"TIFFUnRegisterCODEC\",\n\t    \"Cannot remove compression scheme %s; not registered\", c->name);\n}\n\n/************************************************************************/\n/*                       TIFFGetConfisuredCODECs()                      */\n/************************************************************************/\n\n/**\n * Get list of configured codecs, both built-in and registered by user.\n * Caller is responsible to free this structure.\n * \n * @return returns array of TIFFCodec records (the last record should be NULL)\n * or NULL if function failed.\n */\n\nTIFFCodec*\nTIFFGetConfiguredCODECs()\n{\n\tint\t\ti = 1;\n        codec_t\t\t*cd;\n        const TIFFCodec\t*c;\n\tTIFFCodec\t*codecs = NULL, *new_codecs;\n\n        for (cd = registeredCODECS; cd; cd = cd->next) {\n                new_codecs = (TIFFCodec *)\n\t\t\t_TIFFrealloc(codecs, i * sizeof(TIFFCodec));\n\t\tif (!new_codecs) {\n\t\t\t_TIFFfree (codecs);\n\t\t\treturn NULL;\n\t\t}\n\t\tcodecs = new_codecs;\n\t\t_TIFFmemcpy(codecs + i - 1, cd, sizeof(TIFFCodec));\n\t\ti++;\n\t}\n        for (c = _TIFFBuiltinCODECS; c->name; c++) {\n                if (TIFFIsCODECConfigured(c->scheme)) {\n                        new_codecs = (TIFFCodec *)\n\t\t\t\t_TIFFrealloc(codecs, i * sizeof(TIFFCodec));\n\t\t\tif (!new_codecs) {\n\t\t\t\t_TIFFfree (codecs);\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t\tcodecs = new_codecs;\n\t\t\t_TIFFmemcpy(codecs + i - 1, (const tdata_t)c, sizeof(TIFFCodec));\n\t\t\ti++;\n\t\t}\n\t}\n\n\tnew_codecs = (TIFFCodec *) _TIFFrealloc(codecs, i * sizeof(TIFFCodec));\n\tif (!new_codecs) {\n\t\t_TIFFfree (codecs);\n\t\treturn NULL;\n\t}\n\tcodecs = new_codecs;\n\t_TIFFmemset(codecs + i - 1, 0, sizeof(TIFFCodec));\n\n        return codecs;\n}\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/tif_config.h",
    "content": "/* libtiff/tif_config.h.  Generated from tif_config.h.in by configure.  */\n/* libtiff/tif_config.h.in.  Generated from configure.ac by autoheader.  */\n\n/* Define if building universal (internal helper macro) */\n/* #undef AC_APPLE_UNIVERSAL_BUILD */\n\n/* Support CCITT Group 3 & 4 algorithms */\n#define CCITT_SUPPORT 1\n\n/* Pick up YCbCr subsampling info from the JPEG data stream to support files\n   lacking the tag (default enabled). */\n#define CHECK_JPEG_YCBCR_SUBSAMPLING 1\n\n/* Support C++ stream API (requires C++ compiler) */\n#define CXX_SUPPORT 1\n\n/* Treat extra sample as alpha (default enabled). The RGBA interface will\n   treat a fourth sample with no EXTRASAMPLE_ value as being ASSOCALPHA. Many\n   packages produce RGBA files but don't mark the alpha properly. */\n#define DEFAULT_EXTRASAMPLE_AS_ALPHA 1\n\n/* Use the Apple OpenGL framework. */\n/* #undef HAVE_APPLE_OPENGL_FRAMEWORK */\n\n/* Define to 1 if you have the <assert.h> header file. */\n#define HAVE_ASSERT_H 1\n\n/* Define to 1 if you have the <dlfcn.h> header file. */\n#define HAVE_DLFCN_H 1\n\n/* Define to 1 if you have the <fcntl.h> header file. */\n#define HAVE_FCNTL_H 1\n\n/* Define to 1 if you have the `floor' function. */\n#define HAVE_FLOOR 1\n\n/* Define to 1 if you have the `getopt' function. */\n#define HAVE_GETOPT 1\n\n/* Define as 0 or 1 according to the floating point format suported by the\n   machine */\n#define HAVE_IEEEFP 1\n\n/* Define to 1 if the system has the type `int16'. */\n/* #undef HAVE_INT16 */\n\n/* Define to 1 if the system has the type `int32'. */\n/* #undef HAVE_INT32 */\n\n/* Define to 1 if the system has the type `int8'. */\n/* #undef HAVE_INT8 */\n\n/* Define to 1 if you have the <inttypes.h> header file. */\n#define HAVE_INTTYPES_H 1\n\n/* Define to 1 if you have the <io.h> header file. */\n/* #undef HAVE_IO_H */\n\n/* Define to 1 if you have the `isascii' function. */\n#define HAVE_ISASCII 1\n\n/* Define to 1 if you have the `jbg_newlen' function. */\n/* #undef HAVE_JBG_NEWLEN */\n\n/* Define to 1 if you have the `lfind' function. */\n#define HAVE_LFIND 1\n\n/* Define to 1 if you have the `c' library (-lc). */\n#define HAVE_LIBC 1\n\n/* Define to 1 if you have the `m' library (-lm). */\n#define HAVE_LIBM 1\n\n/* Define to 1 if you have the <limits.h> header file. */\n#define HAVE_LIMITS_H 1\n\n/* Define to 1 if you have the <malloc.h> header file. */\n//#define HAVE_MALLOC_H 1\n\n/* Define to 1 if you have the `memmove' function. */\n#define HAVE_MEMMOVE 1\n\n/* Define to 1 if you have the <memory.h> header file. */\n#define HAVE_MEMORY_H 1\n\n/* Define to 1 if you have the `memset' function. */\n#define HAVE_MEMSET 1\n\n/* Define to 1 if you have the `mmap' function. */\n#define HAVE_MMAP 1\n\n/* Define to 1 if you have the `pow' function. */\n#define HAVE_POW 1\n\n/* Define if you have POSIX threads libraries and header files. */\n#define HAVE_PTHREAD 1\n\n/* Define to 1 if you have the <search.h> header file. */\n//#define HAVE_SEARCH_H 1\n\n/* Define to 1 if you have the `setmode' function. */\n/* #undef HAVE_SETMODE */\n\n/* Define to 1 if you have the `sqrt' function. */\n#define HAVE_SQRT 1\n\n/* Define to 1 if you have the <stdint.h> header file. */\n#define HAVE_STDINT_H 1\n\n/* Define to 1 if you have the <stdlib.h> header file. */\n#define HAVE_STDLIB_H 1\n\n/* Define to 1 if you have the `strcasecmp' function. */\n#define HAVE_STRCASECMP 1\n\n/* Define to 1 if you have the `strchr' function. */\n#define HAVE_STRCHR 1\n\n/* Define to 1 if you have the <strings.h> header file. */\n#define HAVE_STRINGS_H 1\n\n/* Define to 1 if you have the <string.h> header file. */\n#define HAVE_STRING_H 1\n\n/* Define to 1 if you have the `strrchr' function. */\n#define HAVE_STRRCHR 1\n\n/* Define to 1 if you have the `strstr' function. */\n#define HAVE_STRSTR 1\n\n/* Define to 1 if you have the `strtol' function. */\n#define HAVE_STRTOL 1\n\n/* Define to 1 if you have the `strtoul' function. */\n#define HAVE_STRTOUL 1\n\n/* Define to 1 if you have the <sys/stat.h> header file. */\n#define HAVE_SYS_STAT_H 1\n\n/* Define to 1 if you have the <sys/time.h> header file. */\n#define HAVE_SYS_TIME_H 1\n\n/* Define to 1 if you have the <sys/types.h> header file. */\n#define HAVE_SYS_TYPES_H 1\n\n/* Define to 1 if you have the <unistd.h> header file. */\n#define HAVE_UNISTD_H 1\n\n/* Define to 1 if you have the <windows.h> header file. */\n/* #undef HAVE_WINDOWS_H */\n\n/* Native cpu byte order: 1 if big-endian (Motorola) or 0 if little-endian\n   (Intel) */\n#define HOST_BIGENDIAN 0\n\n/* Set the native cpu bit order (FILLORDER_LSB2MSB or FILLORDER_MSB2LSB) */\n#define HOST_FILLORDER FILLORDER_LSB2MSB\n\n/* Support ISO JBIG compression (requires JBIG-KIT library) */\n/* #undef JBIG_SUPPORT */\n\n/* Support JPEG compression (requires IJG JPEG library) */\n#define JPEG_SUPPORT 1\n\n/* Support LogLuv high dynamic range encoding */\n#define LOGLUV_SUPPORT 1\n\n/* Define to the sub-directory in which libtool stores uninstalled libraries.\n   */\n#define LT_OBJDIR \".libs/\"\n\n/* Support LZW algorithm */\n#define LZW_SUPPORT 1\n\n/* Support Microsoft Document Imaging format */\n#define MDI_SUPPORT 1\n\n/* Support NeXT 2-bit RLE algorithm */\n#define NEXT_SUPPORT 1\n\n/* Define to 1 if your C compiler doesn't accept -c and -o together. */\n/* #undef NO_MINUS_C_MINUS_O */\n\n/* Support Old JPEG compresson (read-only) */\n#define OJPEG_SUPPORT 1\n\n/* Name of package */\n#define PACKAGE \"tiff\"\n\n/* Define to the address where bug reports for this package should be sent. */\n#define PACKAGE_BUGREPORT \"tiff@lists.maptools.org\"\n\n/* Define to the full name of this package. */\n#define PACKAGE_NAME \"LibTIFF Software\"\n\n/* Define to the full name and version of this package. */\n#define PACKAGE_STRING \"LibTIFF Software 3.9.2\"\n\n/* Define to the one symbol short name of this package. */\n#define PACKAGE_TARNAME \"tiff\"\n\n/* Define to the home page for this package. */\n#define PACKAGE_URL \"\"\n\n/* Define to the version of this package. */\n#define PACKAGE_VERSION \"3.9.2\"\n\n/* Support Macintosh PackBits algorithm */\n#define PACKBITS_SUPPORT 1\n\n/* Support Pixar log-format algorithm (requires Zlib) */\n#define PIXARLOG_SUPPORT 1\n\n/* Define to necessary symbol if this constant uses a non-standard name on\n   your system. */\n/* #undef PTHREAD_CREATE_JOINABLE */\n\n/* The size of `int', as computed by sizeof. */\n#define SIZEOF_INT 4\n\n/* The size of `long', as computed by sizeof. */\n#define SIZEOF_LONG 4\n\n/* The size of `signed long', as computed by sizeof. */\n#define SIZEOF_SIGNED_LONG 4\n\n/* The size of `signed long long', as computed by sizeof. */\n#define SIZEOF_SIGNED_LONG_LONG 8\n\n/* The size of `unsigned long', as computed by sizeof. */\n#define SIZEOF_UNSIGNED_LONG 4\n\n/* The size of `unsigned long long', as computed by sizeof. */\n#define SIZEOF_UNSIGNED_LONG_LONG 8\n\n/* Define to 1 if you have the ANSI C header files. */\n#define STDC_HEADERS 1\n\n/* enable strip chopping */\n//#define\tSTRIPCHOP_SUPPORT 1\n\n/* Support strip chopping (whether or not to convert single-strip uncompressed\n   images to mutiple strips of specified size to reduce memory usage) */\n#define STRIPCHOP_DEFAULT TIFF_STRIPCHOP\n\n/* Default size of the strip in bytes (when strip chopping enabled) */\n#define STRIP_SIZE_DEFAULT 8192\n\n/* Enable SubIFD tag (330) support */\n#define SUBIFD_SUPPORT 1\n\n/* Support ThunderScan 4-bit RLE algorithm */\n#define THUNDER_SUPPORT 1\n\n/* Signed 64-bit type formatter */\n#define TIFF_INT64_FORMAT \"%lld\"\n\n/* Signed 64-bit type */\n#define TIFF_INT64_T signed long long\n\n/* Unsigned 64-bit type formatter */\n#define TIFF_UINT64_FORMAT \"%llu\"\n\n/* Unsigned 64-bit type */\n#define TIFF_UINT64_T unsigned long long\n\n/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */\n#define TIME_WITH_SYS_TIME 1\n\n/* Define to 1 if your <sys/time.h> declares `struct tm'. */\n/* #undef TM_IN_SYS_TIME */\n\n/* Version number of package */\n#define VERSION \"3.9.2\"\n\n/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most\n   significant byte first (like Motorola and SPARC, unlike Intel). */\n#if defined AC_APPLE_UNIVERSAL_BUILD\n# if defined __BIG_ENDIAN__\n#  define WORDS_BIGENDIAN 1\n# endif\n#else\n# ifndef WORDS_BIGENDIAN\n/* #  undef WORDS_BIGENDIAN */\n# endif\n#endif\n\n/* Define to 1 if the X Window System is missing or not being used. */\n/* #undef X_DISPLAY_MISSING */\n\n/* Support Deflate compression */\n#define ZIP_SUPPORT 1\n\n/* Number of bits in a file offset, on hosts where this is settable. */\n#define _FILE_OFFSET_BITS 64\n\n/* Define for large files, on AIX-style hosts. */\n/* #undef _LARGE_FILES */\n\n/* Define to empty if `const' does not conform to ANSI C. */\n/* #undef const */\n\n/* Define to `__inline__' or `__inline' if that's what the C compiler\n   calls it, or to nothing if 'inline' is not supported under any name.  */\n#ifndef __cplusplus\n/* #undef inline */\n#endif\n\n/* Define to `long int' if <sys/types.h> does not define. */\n/* #undef off_t */\n\n/* Define to `unsigned int' if <sys/types.h> does not define. */\n/* #undef size_t */\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/tif_config.h-vms",
    "content": "/* Define to 1 if you have the <assert.h> header file. */\n#define HAVE_ASSERT_H 1\n\n/* Define to 1 if you have the <fcntl.h> header file. */\n#define HAVE_FCNTL_H 1\n\n/* Define as 0 or 1 according to the floating point format suported by the\n   machine */\n#define HAVE_IEEEFP 1\n\n#define HAVE_UNISTD_H 1\n\n#define HAVE_STRING_H 1\n/* Define to 1 if you have the <sys/types.h> header file. */\n#define HAVE_SYS_TYPES_H 1\n\n/* Define to 1 if you have the <io.h> header file. */\n//#define HAVE_IO_H 1\n\n/* Define to 1 if you have the <search.h> header file. */\n//#define HAVE_SEARCH_H 1\n\n/* The size of a `int', as computed by sizeof. */\n#define SIZEOF_INT 4\n\n/* The size of a `long', as computed by sizeof. */\n#define SIZEOF_LONG 4\n\n/* Set the native cpu bit order */\n#define HOST_FILLORDER FILLORDER_LSB2MSB\n\n/* Define to 1 if your processor stores words with the most significant byte\n   first (like Motorola and SPARC, unlike Intel and VAX). */\n/* #undef WORDS_BIGENDIAN */\n\n/* Define to `__inline__' or `__inline' if that's what the C compiler\n   calls it, or to nothing if 'inline' is not supported under any name.  */\n/*\n#ifndef __cplusplus\n# ifndef inline\n#  define inline __inline\n# endif\n#endif\n*/\n\n// #define lfind _lfind\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/tif_config.h.in",
    "content": "/* libtiff/tif_config.h.in.  Generated from configure.ac by autoheader.  */\n\n/* Define if building universal (internal helper macro) */\n#undef AC_APPLE_UNIVERSAL_BUILD\n\n/* Support CCITT Group 3 & 4 algorithms */\n#undef CCITT_SUPPORT\n\n/* Pick up YCbCr subsampling info from the JPEG data stream to support files\n   lacking the tag (default enabled). */\n#undef CHECK_JPEG_YCBCR_SUBSAMPLING\n\n/* Support C++ stream API (requires C++ compiler) */\n#undef CXX_SUPPORT\n\n/* Treat extra sample as alpha (default enabled). The RGBA interface will\n   treat a fourth sample with no EXTRASAMPLE_ value as being ASSOCALPHA. Many\n   packages produce RGBA files but don't mark the alpha properly. */\n#undef DEFAULT_EXTRASAMPLE_AS_ALPHA\n\n/* Use the Apple OpenGL framework. */\n#undef HAVE_APPLE_OPENGL_FRAMEWORK\n\n/* Define to 1 if you have the <assert.h> header file. */\n#undef HAVE_ASSERT_H\n\n/* Define to 1 if you have the <dlfcn.h> header file. */\n#undef HAVE_DLFCN_H\n\n/* Define to 1 if you have the <fcntl.h> header file. */\n#undef HAVE_FCNTL_H\n\n/* Define to 1 if you have the `floor' function. */\n#undef HAVE_FLOOR\n\n/* Define to 1 if you have the `getopt' function. */\n#undef HAVE_GETOPT\n\n/* Define as 0 or 1 according to the floating point format suported by the\n   machine */\n#undef HAVE_IEEEFP\n\n/* Define to 1 if the system has the type `int16'. */\n#undef HAVE_INT16\n\n/* Define to 1 if the system has the type `int32'. */\n#undef HAVE_INT32\n\n/* Define to 1 if the system has the type `int8'. */\n#undef HAVE_INT8\n\n/* Define to 1 if you have the <inttypes.h> header file. */\n#undef HAVE_INTTYPES_H\n\n/* Define to 1 if you have the <io.h> header file. */\n#undef HAVE_IO_H\n\n/* Define to 1 if you have the `isascii' function. */\n#undef HAVE_ISASCII\n\n/* Define to 1 if you have the `jbg_newlen' function. */\n#undef HAVE_JBG_NEWLEN\n\n/* Define to 1 if you have the `lfind' function. */\n#undef HAVE_LFIND\n\n/* Define to 1 if you have the `c' library (-lc). */\n#undef HAVE_LIBC\n\n/* Define to 1 if you have the `m' library (-lm). */\n#undef HAVE_LIBM\n\n/* Define to 1 if you have the <limits.h> header file. */\n#undef HAVE_LIMITS_H\n\n/* Define to 1 if you have the <malloc.h> header file. */\n#undef HAVE_MALLOC_H\n\n/* Define to 1 if you have the `memmove' function. */\n#undef HAVE_MEMMOVE\n\n/* Define to 1 if you have the <memory.h> header file. */\n#undef HAVE_MEMORY_H\n\n/* Define to 1 if you have the `memset' function. */\n#undef HAVE_MEMSET\n\n/* Define to 1 if you have the `mmap' function. */\n#undef HAVE_MMAP\n\n/* Define to 1 if you have the `pow' function. */\n#undef HAVE_POW\n\n/* Define if you have POSIX threads libraries and header files. */\n#undef HAVE_PTHREAD\n\n/* Define to 1 if you have the <search.h> header file. */\n#undef HAVE_SEARCH_H\n\n/* Define to 1 if you have the `setmode' function. */\n#undef HAVE_SETMODE\n\n/* Define to 1 if you have the `sqrt' function. */\n#undef HAVE_SQRT\n\n/* Define to 1 if you have the <stdint.h> header file. */\n#undef HAVE_STDINT_H\n\n/* Define to 1 if you have the <stdlib.h> header file. */\n#undef HAVE_STDLIB_H\n\n/* Define to 1 if you have the `strcasecmp' function. */\n#undef HAVE_STRCASECMP\n\n/* Define to 1 if you have the `strchr' function. */\n#undef HAVE_STRCHR\n\n/* Define to 1 if you have the <strings.h> header file. */\n#undef HAVE_STRINGS_H\n\n/* Define to 1 if you have the <string.h> header file. */\n#undef HAVE_STRING_H\n\n/* Define to 1 if you have the `strrchr' function. */\n#undef HAVE_STRRCHR\n\n/* Define to 1 if you have the `strstr' function. */\n#undef HAVE_STRSTR\n\n/* Define to 1 if you have the `strtol' function. */\n#undef HAVE_STRTOL\n\n/* Define to 1 if you have the `strtoul' function. */\n#undef HAVE_STRTOUL\n\n/* Define to 1 if you have the <sys/stat.h> header file. */\n#undef HAVE_SYS_STAT_H\n\n/* Define to 1 if you have the <sys/time.h> header file. */\n#undef HAVE_SYS_TIME_H\n\n/* Define to 1 if you have the <sys/types.h> header file. */\n#undef HAVE_SYS_TYPES_H\n\n/* Define to 1 if you have the <unistd.h> header file. */\n#undef HAVE_UNISTD_H\n\n/* Define to 1 if you have the <windows.h> header file. */\n#undef HAVE_WINDOWS_H\n\n/* Native cpu byte order: 1 if big-endian (Motorola) or 0 if little-endian\n   (Intel) */\n#undef HOST_BIGENDIAN\n\n/* Set the native cpu bit order (FILLORDER_LSB2MSB or FILLORDER_MSB2LSB) */\n#undef HOST_FILLORDER\n\n/* Support ISO JBIG compression (requires JBIG-KIT library) */\n#undef JBIG_SUPPORT\n\n/* Support JPEG compression (requires IJG JPEG library) */\n#undef JPEG_SUPPORT\n\n/* Support LogLuv high dynamic range encoding */\n#undef LOGLUV_SUPPORT\n\n/* Define to the sub-directory in which libtool stores uninstalled libraries.\n   */\n#undef LT_OBJDIR\n\n/* Support LZW algorithm */\n#undef LZW_SUPPORT\n\n/* Support Microsoft Document Imaging format */\n#undef MDI_SUPPORT\n\n/* Support NeXT 2-bit RLE algorithm */\n#undef NEXT_SUPPORT\n\n/* Define to 1 if your C compiler doesn't accept -c and -o together. */\n#undef NO_MINUS_C_MINUS_O\n\n/* Support Old JPEG compresson (read-only) */\n#undef OJPEG_SUPPORT\n\n/* Name of package */\n#undef PACKAGE\n\n/* Define to the address where bug reports for this package should be sent. */\n#undef PACKAGE_BUGREPORT\n\n/* Define to the full name of this package. */\n#undef PACKAGE_NAME\n\n/* Define to the full name and version of this package. */\n#undef PACKAGE_STRING\n\n/* Define to the one symbol short name of this package. */\n#undef PACKAGE_TARNAME\n\n/* Define to the home page for this package. */\n#undef PACKAGE_URL\n\n/* Define to the version of this package. */\n#undef PACKAGE_VERSION\n\n/* Support Macintosh PackBits algorithm */\n#undef PACKBITS_SUPPORT\n\n/* Support Pixar log-format algorithm (requires Zlib) */\n#undef PIXARLOG_SUPPORT\n\n/* Define to necessary symbol if this constant uses a non-standard name on\n   your system. */\n#undef PTHREAD_CREATE_JOINABLE\n\n/* The size of `int', as computed by sizeof. */\n#undef SIZEOF_INT\n\n/* The size of `long', as computed by sizeof. */\n#undef SIZEOF_LONG\n\n/* The size of `signed long', as computed by sizeof. */\n#undef SIZEOF_SIGNED_LONG\n\n/* The size of `signed long long', as computed by sizeof. */\n#undef SIZEOF_SIGNED_LONG_LONG\n\n/* The size of `unsigned long', as computed by sizeof. */\n#undef SIZEOF_UNSIGNED_LONG\n\n/* The size of `unsigned long long', as computed by sizeof. */\n#undef SIZEOF_UNSIGNED_LONG_LONG\n\n/* Define to 1 if you have the ANSI C header files. */\n#undef STDC_HEADERS\n\n/* Support strip chopping (whether or not to convert single-strip uncompressed\n   images to mutiple strips of specified size to reduce memory usage) */\n#undef STRIPCHOP_DEFAULT\n\n/* Default size of the strip in bytes (when strip chopping enabled) */\n#undef STRIP_SIZE_DEFAULT\n\n/* Enable SubIFD tag (330) support */\n#undef SUBIFD_SUPPORT\n\n/* Support ThunderScan 4-bit RLE algorithm */\n#undef THUNDER_SUPPORT\n\n/* Signed 64-bit type formatter */\n#undef TIFF_INT64_FORMAT\n\n/* Signed 64-bit type */\n#undef TIFF_INT64_T\n\n/* Unsigned 64-bit type formatter */\n#undef TIFF_UINT64_FORMAT\n\n/* Unsigned 64-bit type */\n#undef TIFF_UINT64_T\n\n/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */\n#undef TIME_WITH_SYS_TIME\n\n/* Define to 1 if your <sys/time.h> declares `struct tm'. */\n#undef TM_IN_SYS_TIME\n\n/* Version number of package */\n#undef VERSION\n\n/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most\n   significant byte first (like Motorola and SPARC, unlike Intel). */\n#if defined AC_APPLE_UNIVERSAL_BUILD\n# if defined __BIG_ENDIAN__\n#  define WORDS_BIGENDIAN 1\n# endif\n#else\n# ifndef WORDS_BIGENDIAN\n#  undef WORDS_BIGENDIAN\n# endif\n#endif\n\n/* Define to 1 if the X Window System is missing or not being used. */\n#undef X_DISPLAY_MISSING\n\n/* Support Deflate compression */\n#undef ZIP_SUPPORT\n\n/* Number of bits in a file offset, on hosts where this is settable. */\n#undef _FILE_OFFSET_BITS\n\n/* Define for large files, on AIX-style hosts. */\n#undef _LARGE_FILES\n\n/* Define to empty if `const' does not conform to ANSI C. */\n#undef const\n\n/* Define to `__inline__' or `__inline' if that's what the C compiler\n   calls it, or to nothing if 'inline' is not supported under any name.  */\n#ifndef __cplusplus\n#undef inline\n#endif\n\n/* Define to `long int' if <sys/types.h> does not define. */\n#undef off_t\n\n/* Define to `unsigned int' if <sys/types.h> does not define. */\n#undef size_t\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/tif_config.vc.h",
    "content": "/* Define to 1 if you have the <assert.h> header file. */\n#define HAVE_ASSERT_H 1\n\n/* Define to 1 if you have the <fcntl.h> header file. */\n#define HAVE_FCNTL_H 1\n\n/* Define as 0 or 1 according to the floating point format suported by the\n   machine */\n#define HAVE_IEEEFP 1\n\n/* Define to 1 if you have the `jbg_newlen' function. */\n#define HAVE_JBG_NEWLEN 1\n\n/* Define to 1 if you have the <string.h> header file. */\n#define HAVE_STRING_H 1\n\n/* Define to 1 if you have the <sys/types.h> header file. */\n#define HAVE_SYS_TYPES_H 1\n\n/* Define to 1 if you have the <io.h> header file. */\n#define HAVE_IO_H 1\n\n/* Define to 1 if you have the <search.h> header file. */\n#define HAVE_SEARCH_H 1\n\n/* Define to 1 if you have the `setmode' function. */\n#define HAVE_SETMODE 1\n\n/* The size of a `int', as computed by sizeof. */\n#define SIZEOF_INT 4\n\n/* The size of a `long', as computed by sizeof. */\n#define SIZEOF_LONG 4\n\n/* Signed 64-bit type */\n#define TIFF_INT64_T signed __int64\n\n/* Unsigned 64-bit type */\n#define TIFF_UINT64_T unsigned __int64\n\n/* Set the native cpu bit order */\n#define HOST_FILLORDER FILLORDER_LSB2MSB\n\n/* Define to 1 if your processor stores words with the most significant byte\n   first (like Motorola and SPARC, unlike Intel and VAX). */\n/* #undef WORDS_BIGENDIAN */\n\n/* Define to `__inline__' or `__inline' if that's what the C compiler\n   calls it, or to nothing if 'inline' is not supported under any name.  */\n#ifndef __cplusplus\n# ifndef inline\n#  define inline __inline\n# endif\n#endif\n\n#define lfind _lfind\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/tif_config.wince.h",
    "content": "/* $Id: tif_config.wince.h,v 1.1 2007/01/15 18:40:39 mloskot Exp $ */\n\n/*\n * TIFF library configuration header for Windows CE platform.\n */\n#ifndef _WIN32_WCE\n# error This version of tif_config.h header is dedicated for Windows CE platform!\n#endif\n\n/* Define to 1 if you have the <assert.h> header file. */\n#define HAVE_ASSERT_H 1\n\n/* Define to 1 if you have the <fcntl.h> header file. */\n#define  HAVE_FCNTL_H 1\n\n/* Define as 0 or 1 according to the floating point format suported by the\n   machine */\n#define HAVE_IEEEFP 1\n\n/* Define to 1 if you have the `jbg_newlen' function. */\n#define HAVE_JBG_NEWLEN 1\n\n/* Define to 1 if you have the <string.h> header file. */\n#define HAVE_STRING_H 1\n\n/* Define to 1 if you have the <sys/types.h> header file. */\n#undef HAVE_SYS_TYPES_H\n\n/* Define to 1 if you have the <io.h> header file. */\n#define HAVE_IO_H 1\n\n/* Define to 1 if you have the <search.h> header file. */\n#define HAVE_SEARCH_H 1\n\n/* Define to 1 if you have the `setmode' function. */\n#define HAVE_SETMODE 1\n\n/* Define to 1 if you have the `bsearch' function. */\n#define HAVE_BSEARCH 1\n#define bsearch wceex_bsearch\n\n/* Define to 1 if you have the `lfind' function. */\n#define HAVE_LFIND 1\n#define lfind wceex_lfind\n\n/* The size of a `int', as computed by sizeof. */\n#define SIZEOF_INT 4\n\n/* The size of a `long', as computed by sizeof. */\n#define SIZEOF_LONG 4\n\n/* Set the native cpu bit order */\n#define HOST_FILLORDER FILLORDER_LSB2MSB\n\n/* Define to 1 if your processor stores words with the most significant byte\n   first (like Motorola and SPARC, unlike Intel and VAX). */\n/* #undef WORDS_BIGENDIAN */\n\n/* Define to `__inline__' or `__inline' if that's what the C compiler\n   calls it, or to nothing if 'inline' is not supported under any name.  */\n#ifndef __cplusplus\n# ifndef inline\n#  define inline __inline\n# endif\n#endif\n\n\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/tif_dir.c",
    "content": "/* $Id: tif_dir.c,v 1.75.2.2 2009-01-01 00:10:43 bfriesen Exp $ */\n\n/*\n * Copyright (c) 1988-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n/*\n * TIFF Library.\n *\n * Directory Tag Get & Set Routines.\n * (and also some miscellaneous stuff)\n */\n#include \"tiffiop.h\"\n\n/*\n * These are used in the backwards compatibility code...\n */\n#define DATATYPE_VOID\t\t0       /* !untyped data */\n#define DATATYPE_INT\t\t1       /* !signed integer data */\n#define DATATYPE_UINT\t\t2       /* !unsigned integer data */\n#define DATATYPE_IEEEFP\t\t3       /* !IEEE floating point data */\n\nstatic void\nsetByteArray(void** vpp, void* vp, size_t nmemb, size_t elem_size)\n{\n\tif (*vpp)\n\t\t_TIFFfree(*vpp), *vpp = 0;\n\tif (vp) {\n\t\ttsize_t\tbytes = nmemb * elem_size;\n\t\tif (elem_size && bytes / elem_size == nmemb)\n\t\t\t*vpp = (void*) _TIFFmalloc(bytes);\n\t\tif (*vpp)\n\t\t\t_TIFFmemcpy(*vpp, vp, bytes);\n\t}\n}\nvoid _TIFFsetByteArray(void** vpp, void* vp, uint32 n)\n    { setByteArray(vpp, vp, n, 1); }\nvoid _TIFFsetString(char** cpp, char* cp)\n    { setByteArray((void**) cpp, (void*) cp, strlen(cp)+1, 1); }\nvoid _TIFFsetNString(char** cpp, char* cp, uint32 n)\n    { setByteArray((void**) cpp, (void*) cp, n, 1); }\nvoid _TIFFsetShortArray(uint16** wpp, uint16* wp, uint32 n)\n    { setByteArray((void**) wpp, (void*) wp, n, sizeof (uint16)); }\nvoid _TIFFsetLongArray(uint32** lpp, uint32* lp, uint32 n)\n    { setByteArray((void**) lpp, (void*) lp, n, sizeof (uint32)); }\nvoid _TIFFsetFloatArray(float** fpp, float* fp, uint32 n)\n    { setByteArray((void**) fpp, (void*) fp, n, sizeof (float)); }\nvoid _TIFFsetDoubleArray(double** dpp, double* dp, uint32 n)\n    { setByteArray((void**) dpp, (void*) dp, n, sizeof (double)); }\n\n/*\n * Install extra samples information.\n */\nstatic int\nsetExtraSamples(TIFFDirectory* td, va_list ap, uint32* v)\n{\n/* XXX: Unassociated alpha data == 999 is a known Corel Draw bug, see below */\n#define EXTRASAMPLE_COREL_UNASSALPHA 999 \n\n\tuint16* va;\n\tuint32 i;\n\n\t*v = va_arg(ap, uint32);\n\tif ((uint16) *v > td->td_samplesperpixel)\n\t\treturn 0;\n\tva = va_arg(ap, uint16*);\n\tif (*v > 0 && va == NULL)\t\t/* typically missing param */\n\t\treturn 0;\n\tfor (i = 0; i < *v; i++) {\n\t\tif (va[i] > EXTRASAMPLE_UNASSALPHA) {\n\t\t\t/*\n\t\t\t * XXX: Corel Draw is known to produce incorrect\n\t\t\t * ExtraSamples tags which must be patched here if we\n\t\t\t * want to be able to open some of the damaged TIFF\n\t\t\t * files: \n\t\t\t */\n\t\t\tif (va[i] == EXTRASAMPLE_COREL_UNASSALPHA)\n\t\t\t\tva[i] = EXTRASAMPLE_UNASSALPHA;\n\t\t\telse\n\t\t\t\treturn 0;\n\t\t}\n\t}\n\ttd->td_extrasamples = (uint16) *v;\n\t_TIFFsetShortArray(&td->td_sampleinfo, va, td->td_extrasamples);\n\treturn 1;\n\n#undef EXTRASAMPLE_COREL_UNASSALPHA\n}\n\nstatic uint32\ncheckInkNamesString(TIFF* tif, uint32 slen, const char* s)\n{\n\tTIFFDirectory* td = &tif->tif_dir;\n\tuint16 i = td->td_samplesperpixel;\n\n\tif (slen > 0) {\n\t\tconst char* ep = s+slen;\n\t\tconst char* cp = s;\n\t\tfor (; i > 0; i--) {\n\t\t\tfor (; *cp != '\\0'; cp++)\n\t\t\t\tif (cp >= ep)\n\t\t\t\t\tgoto bad;\n\t\t\tcp++;\t\t\t\t/* skip \\0 */\n\t\t}\n\t\treturn (cp-s);\n\t}\nbad:\n\tTIFFErrorExt(tif->tif_clientdata, \"TIFFSetField\",\n\t    \"%s: Invalid InkNames value; expecting %d names, found %d\",\n\t    tif->tif_name,\n\t    td->td_samplesperpixel,\n\t    td->td_samplesperpixel-i);\n\treturn (0);\n}\n\nstatic int\n_TIFFVSetField(TIFF* tif, ttag_t tag, va_list ap)\n{\n\tstatic const char module[] = \"_TIFFVSetField\";\n\n\tTIFFDirectory* td = &tif->tif_dir;\n\tint status = 1;\n\tuint32 v32, i, v;\n\tchar* s;\n\n\tswitch (tag) {\n\tcase TIFFTAG_SUBFILETYPE:\n\t\ttd->td_subfiletype = va_arg(ap, uint32);\n\t\tbreak;\n\tcase TIFFTAG_IMAGEWIDTH:\n\t\ttd->td_imagewidth = va_arg(ap, uint32);\n\t\tbreak;\n\tcase TIFFTAG_IMAGELENGTH:\n\t\ttd->td_imagelength = va_arg(ap, uint32);\n\t\tbreak;\n\tcase TIFFTAG_BITSPERSAMPLE:\n\t\ttd->td_bitspersample = (uint16) va_arg(ap, int);\n\t\t/*\n\t\t * If the data require post-decoding processing to byte-swap\n\t\t * samples, set it up here.  Note that since tags are required\n\t\t * to be ordered, compression code can override this behaviour\n\t\t * in the setup method if it wants to roll the post decoding\n\t\t * work in with its normal work.\n\t\t */\n\t\tif (tif->tif_flags & TIFF_SWAB) {\n\t\t\tif (td->td_bitspersample == 16)\n\t\t\t\ttif->tif_postdecode = _TIFFSwab16BitData;\n\t\t\telse if (td->td_bitspersample == 24)\n\t\t\t\ttif->tif_postdecode = _TIFFSwab24BitData;\n\t\t\telse if (td->td_bitspersample == 32)\n\t\t\t\ttif->tif_postdecode = _TIFFSwab32BitData;\n\t\t\telse if (td->td_bitspersample == 64)\n\t\t\t\ttif->tif_postdecode = _TIFFSwab64BitData;\n\t\t\telse if (td->td_bitspersample == 128) /* two 64's */\n\t\t\t\ttif->tif_postdecode = _TIFFSwab64BitData;\n\t\t}\n\t\tbreak;\n\tcase TIFFTAG_COMPRESSION:\n\t\tv = va_arg(ap, uint32) & 0xffff;\n\t\t/*\n\t\t * If we're changing the compression scheme, the notify the\n\t\t * previous module so that it can cleanup any state it's\n\t\t * setup.\n\t\t */\n\t\tif (TIFFFieldSet(tif, FIELD_COMPRESSION)) {\n\t\t\tif (td->td_compression == v)\n\t\t\t\tbreak;\n\t\t\t(*tif->tif_cleanup)(tif);\n\t\t\ttif->tif_flags &= ~TIFF_CODERSETUP;\n\t\t}\n\t\t/*\n\t\t * Setup new compression routine state.\n\t\t */\n\t\tif( (status = TIFFSetCompressionScheme(tif, v)) != 0 )\n                    td->td_compression = (uint16) v;\n                else\n                    status = 0;\n\t\tbreak;\n\tcase TIFFTAG_PHOTOMETRIC:\n\t\ttd->td_photometric = (uint16) va_arg(ap, int);\n\t\tbreak;\n\tcase TIFFTAG_THRESHHOLDING:\n\t\ttd->td_threshholding = (uint16) va_arg(ap, int);\n\t\tbreak;\n\tcase TIFFTAG_FILLORDER:\n\t\tv = va_arg(ap, uint32);\n\t\tif (v != FILLORDER_LSB2MSB && v != FILLORDER_MSB2LSB)\n\t\t\tgoto badvalue;\n\t\ttd->td_fillorder = (uint16) v;\n\t\tbreak;\n\tcase TIFFTAG_ORIENTATION:\n\t\tv = va_arg(ap, uint32);\n\t\tif (v < ORIENTATION_TOPLEFT || ORIENTATION_LEFTBOT < v)\n\t\t\tgoto badvalue;\n\t\telse\n\t\t\ttd->td_orientation = (uint16) v;\n\t\tbreak;\n\tcase TIFFTAG_SAMPLESPERPIXEL:\n\t\t/* XXX should cross check -- e.g. if pallette, then 1 */\n\t\tv = va_arg(ap, uint32);\n\t\tif (v == 0)\n\t\t\tgoto badvalue;\n\t\ttd->td_samplesperpixel = (uint16) v;\n\t\tbreak;\n\tcase TIFFTAG_ROWSPERSTRIP:\n\t\tv32 = va_arg(ap, uint32);\n\t\tif (v32 == 0)\n\t\t\tgoto badvalue32;\n\t\ttd->td_rowsperstrip = v32;\n\t\tif (!TIFFFieldSet(tif, FIELD_TILEDIMENSIONS)) {\n\t\t\ttd->td_tilelength = v32;\n\t\t\ttd->td_tilewidth = td->td_imagewidth;\n\t\t}\n\t\tbreak;\n\tcase TIFFTAG_MINSAMPLEVALUE:\n\t\ttd->td_minsamplevalue = (uint16) va_arg(ap, int);\n\t\tbreak;\n\tcase TIFFTAG_MAXSAMPLEVALUE:\n\t\ttd->td_maxsamplevalue = (uint16) va_arg(ap, int);\n\t\tbreak;\n\tcase TIFFTAG_SMINSAMPLEVALUE:\n\t\ttd->td_sminsamplevalue = va_arg(ap, double);\n\t\tbreak;\n\tcase TIFFTAG_SMAXSAMPLEVALUE:\n\t\ttd->td_smaxsamplevalue = va_arg(ap, double);\n\t\tbreak;\n\tcase TIFFTAG_XRESOLUTION:\n\t\ttd->td_xresolution = (float) va_arg(ap, double);\n\t\tbreak;\n\tcase TIFFTAG_YRESOLUTION:\n\t\ttd->td_yresolution = (float) va_arg(ap, double);\n\t\tbreak;\n\tcase TIFFTAG_PLANARCONFIG:\n\t\tv = va_arg(ap, uint32);\n\t\tif (v != PLANARCONFIG_CONTIG && v != PLANARCONFIG_SEPARATE)\n\t\t\tgoto badvalue;\n\t\ttd->td_planarconfig = (uint16) v;\n\t\tbreak;\n\tcase TIFFTAG_XPOSITION:\n\t\ttd->td_xposition = (float) va_arg(ap, double);\n\t\tbreak;\n\tcase TIFFTAG_YPOSITION:\n\t\ttd->td_yposition = (float) va_arg(ap, double);\n\t\tbreak;\n\tcase TIFFTAG_RESOLUTIONUNIT:\n\t\tv = va_arg(ap, uint32);\n\t\tif (v < RESUNIT_NONE || RESUNIT_CENTIMETER < v)\n\t\t\tgoto badvalue;\n\t\ttd->td_resolutionunit = (uint16) v;\n\t\tbreak;\n\tcase TIFFTAG_PAGENUMBER:\n\t\ttd->td_pagenumber[0] = (uint16) va_arg(ap, int);\n\t\ttd->td_pagenumber[1] = (uint16) va_arg(ap, int);\n\t\tbreak;\n\tcase TIFFTAG_HALFTONEHINTS:\n\t\ttd->td_halftonehints[0] = (uint16) va_arg(ap, int);\n\t\ttd->td_halftonehints[1] = (uint16) va_arg(ap, int);\n\t\tbreak;\n\tcase TIFFTAG_COLORMAP:\n\t\tv32 = (uint32)(1L<<td->td_bitspersample);\n\t\t_TIFFsetShortArray(&td->td_colormap[0], va_arg(ap, uint16*), v32);\n\t\t_TIFFsetShortArray(&td->td_colormap[1], va_arg(ap, uint16*), v32);\n\t\t_TIFFsetShortArray(&td->td_colormap[2], va_arg(ap, uint16*), v32);\n\t\tbreak;\n\tcase TIFFTAG_EXTRASAMPLES:\n\t\tif (!setExtraSamples(td, ap, &v))\n\t\t\tgoto badvalue;\n\t\tbreak;\n\tcase TIFFTAG_MATTEING:\n\t\ttd->td_extrasamples = (uint16) (va_arg(ap, int) != 0);\n\t\tif (td->td_extrasamples) {\n\t\t\tuint16 sv = EXTRASAMPLE_ASSOCALPHA;\n\t\t\t_TIFFsetShortArray(&td->td_sampleinfo, &sv, 1);\n\t\t}\n\t\tbreak;\n\tcase TIFFTAG_TILEWIDTH:\n\t\tv32 = va_arg(ap, uint32);\n\t\tif (v32 % 16) {\n\t\t\tif (tif->tif_mode != O_RDONLY)\n\t\t\t\tgoto badvalue32;\n\t\t\tTIFFWarningExt(tif->tif_clientdata, tif->tif_name,\n\t\t\t\t\"Nonstandard tile width %d, convert file\", v32);\n\t\t}\n\t\ttd->td_tilewidth = v32;\n\t\ttif->tif_flags |= TIFF_ISTILED;\n\t\tbreak;\n\tcase TIFFTAG_TILELENGTH:\n\t\tv32 = va_arg(ap, uint32);\n\t\tif (v32 % 16) {\n\t\t\tif (tif->tif_mode != O_RDONLY)\n\t\t\t\tgoto badvalue32;\n\t\t\tTIFFWarningExt(tif->tif_clientdata, tif->tif_name,\n\t\t\t    \"Nonstandard tile length %d, convert file\", v32);\n\t\t}\n\t\ttd->td_tilelength = v32;\n\t\ttif->tif_flags |= TIFF_ISTILED;\n\t\tbreak;\n\tcase TIFFTAG_TILEDEPTH:\n\t\tv32 = va_arg(ap, uint32);\n\t\tif (v32 == 0)\n\t\t\tgoto badvalue32;\n\t\ttd->td_tiledepth = v32;\n\t\tbreak;\n\tcase TIFFTAG_DATATYPE:\n\t\tv = va_arg(ap, uint32);\n\t\tswitch (v) {\n\t\tcase DATATYPE_VOID:\tv = SAMPLEFORMAT_VOID;\tbreak;\n\t\tcase DATATYPE_INT:\tv = SAMPLEFORMAT_INT;\tbreak;\n\t\tcase DATATYPE_UINT:\tv = SAMPLEFORMAT_UINT;\tbreak;\n\t\tcase DATATYPE_IEEEFP:\tv = SAMPLEFORMAT_IEEEFP;break;\n\t\tdefault:\t\tgoto badvalue;\n\t\t}\n\t\ttd->td_sampleformat = (uint16) v;\n\t\tbreak;\n\tcase TIFFTAG_SAMPLEFORMAT:\n\t\tv = va_arg(ap, uint32);\n\t\tif (v < SAMPLEFORMAT_UINT || SAMPLEFORMAT_COMPLEXIEEEFP < v)\n\t\t\tgoto badvalue;\n\t\ttd->td_sampleformat = (uint16) v;\n\n                /*  Try to fix up the SWAB function for complex data. */\n                if( td->td_sampleformat == SAMPLEFORMAT_COMPLEXINT \n                    && td->td_bitspersample == 32\n                    && tif->tif_postdecode == _TIFFSwab32BitData )\n                    tif->tif_postdecode = _TIFFSwab16BitData;\n                else if( (td->td_sampleformat == SAMPLEFORMAT_COMPLEXINT \n                          || td->td_sampleformat == SAMPLEFORMAT_COMPLEXIEEEFP)\n                         && td->td_bitspersample == 64\n                         && tif->tif_postdecode == _TIFFSwab64BitData )\n                    tif->tif_postdecode = _TIFFSwab32BitData;\n\t\tbreak;\n\tcase TIFFTAG_IMAGEDEPTH:\n\t\ttd->td_imagedepth = va_arg(ap, uint32);\n\t\tbreak;\n\tcase TIFFTAG_SUBIFD:\n\t\tif ((tif->tif_flags & TIFF_INSUBIFD) == 0) {\n\t\t\ttd->td_nsubifd = (uint16) va_arg(ap, int);\n\t\t\t_TIFFsetLongArray(&td->td_subifd, va_arg(ap, uint32*),\n\t\t\t    (long) td->td_nsubifd);\n\t\t} else {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, module,\n\t\t\t\t     \"%s: Sorry, cannot nest SubIFDs\",\n\t\t\t\t     tif->tif_name);\n\t\t\tstatus = 0;\n\t\t}\n\t\tbreak;\n\tcase TIFFTAG_YCBCRPOSITIONING:\n\t\ttd->td_ycbcrpositioning = (uint16) va_arg(ap, int);\n\t\tbreak;\n\tcase TIFFTAG_YCBCRSUBSAMPLING:\n\t\ttd->td_ycbcrsubsampling[0] = (uint16) va_arg(ap, int);\n\t\ttd->td_ycbcrsubsampling[1] = (uint16) va_arg(ap, int);\n\t\tbreak;\n\tcase TIFFTAG_TRANSFERFUNCTION:\n\t\tv = (td->td_samplesperpixel - td->td_extrasamples) > 1 ? 3 : 1;\n\t\tfor (i = 0; i < v; i++)\n\t\t\t_TIFFsetShortArray(&td->td_transferfunction[i],\n\t\t\t    va_arg(ap, uint16*), 1L<<td->td_bitspersample);\n\t\tbreak;\n\tcase TIFFTAG_INKNAMES:\n\t\tv = va_arg(ap, uint32);\n\t\ts = va_arg(ap, char*);\n\t\tv = checkInkNamesString(tif, v, s);\n                status = v > 0;\n\t\tif( v > 0 ) {\n\t\t\t_TIFFsetNString(&td->td_inknames, s, v);\n\t\t\ttd->td_inknameslen = v;\n\t\t}\n\t\tbreak;\n        default: {\n            TIFFTagValue *tv;\n            int tv_size, iCustom;\n\t    const TIFFFieldInfo* fip = _TIFFFindFieldInfo(tif, tag, TIFF_ANY);\n\n            /*\n\t     * This can happen if multiple images are open with different\n\t     * codecs which have private tags.  The global tag information\n\t     * table may then have tags that are valid for one file but not\n\t     * the other. If the client tries to set a tag that is not valid\n\t     * for the image's codec then we'll arrive here.  This\n\t     * happens, for example, when tiffcp is used to convert between\n\t     * compression schemes and codec-specific tags are blindly copied.\n             */\n            if(fip == NULL || fip->field_bit != FIELD_CUSTOM) {\n\t\tTIFFErrorExt(tif->tif_clientdata, module,\n\t\t\t     \"%s: Invalid %stag \\\"%s\\\" (not supported by codec)\",\n\t\t\t     tif->tif_name, isPseudoTag(tag) ? \"pseudo-\" : \"\",\n\t\t\t     fip ? fip->field_name : \"Unknown\");\n\t\tstatus = 0;\n\t\tbreak;\n            }\n\n            /*\n             * Find the existing entry for this custom value.\n             */\n            tv = NULL;\n            for (iCustom = 0; iCustom < td->td_customValueCount; iCustom++) {\n\t\t    if (td->td_customValues[iCustom].info->field_tag == tag) {\n\t\t\t    tv = td->td_customValues + iCustom;\n\t\t\t    if (tv->value != NULL) {\n\t\t\t\t    _TIFFfree(tv->value);\n\t\t\t\t    tv->value = NULL;\n\t\t\t    }\n\t\t\t    break;\n\t\t    }\n            }\n\n            /*\n             * Grow the custom list if the entry was not found.\n             */\n            if(tv == NULL) {\n\t\tTIFFTagValue\t*new_customValues;\n\t\t\n\t\ttd->td_customValueCount++;\n\t\tnew_customValues = (TIFFTagValue *)\n\t\t\t_TIFFrealloc(td->td_customValues,\n\t\t\t\t     sizeof(TIFFTagValue) * td->td_customValueCount);\n\t\tif (!new_customValues) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, module,\n\t\t\"%s: Failed to allocate space for list of custom values\",\n\t\t\t\t  tif->tif_name);\n\t\t\tstatus = 0;\n\t\t\tgoto end;\n\t\t}\n\n\t\ttd->td_customValues = new_customValues;\n\n                tv = td->td_customValues + (td->td_customValueCount - 1);\n                tv->info = fip;\n                tv->value = NULL;\n                tv->count = 0;\n            }\n\n            /*\n             * Set custom value ... save a copy of the custom tag value.\n             */\n\t    tv_size = _TIFFDataSize(fip->field_type);\n\t    if (tv_size == 0) {\n\t\t    status = 0;\n\t\t    TIFFErrorExt(tif->tif_clientdata, module,\n\t\t\t\t \"%s: Bad field type %d for \\\"%s\\\"\",\n\t\t\t\t tif->tif_name, fip->field_type,\n\t\t\t\t fip->field_name);\n\t\t    goto end;\n\t    }\n           \n            if(fip->field_passcount) {\n\t\t    if (fip->field_writecount == TIFF_VARIABLE2)\n\t\t\ttv->count = (uint32) va_arg(ap, uint32);\n\t\t    else\n\t\t\ttv->count = (int) va_arg(ap, int);\n\t    } else if (fip->field_writecount == TIFF_VARIABLE\n\t\t       || fip->field_writecount == TIFF_VARIABLE2)\n\t\ttv->count = 1;\n\t    else if (fip->field_writecount == TIFF_SPP)\n\t\ttv->count = td->td_samplesperpixel;\n\t    else\n                tv->count = fip->field_writecount;\n            \n    \n\t    if (fip->field_type == TIFF_ASCII)\n\t\t    _TIFFsetString((char **)&tv->value, va_arg(ap, char *));\n\t    else {\n\t\ttv->value = _TIFFCheckMalloc(tif, tv_size, tv->count,\n\t\t\t\t\t     \"Tag Value\");\n\t\tif (!tv->value) {\n\t\t    status = 0;\n\t\t    goto end;\n\t\t}\n\n\t\tif ((fip->field_passcount\n\t\t    || fip->field_writecount == TIFF_VARIABLE\n\t\t    || fip->field_writecount == TIFF_VARIABLE2\n\t\t    || fip->field_writecount == TIFF_SPP\n\t\t    || tv->count > 1)\n\t\t    && fip->field_tag != TIFFTAG_PAGENUMBER\n\t\t    && fip->field_tag != TIFFTAG_HALFTONEHINTS\n\t\t    && fip->field_tag != TIFFTAG_YCBCRSUBSAMPLING\n\t\t    && fip->field_tag != TIFFTAG_DOTRANGE) {\n                    _TIFFmemcpy(tv->value, va_arg(ap, void *),\n\t\t\t\ttv->count * tv_size);\n\t\t} else {\n\t\t    /*\n\t\t     * XXX: The following loop required to handle\n\t\t     * TIFFTAG_PAGENUMBER, TIFFTAG_HALFTONEHINTS,\n\t\t     * TIFFTAG_YCBCRSUBSAMPLING and TIFFTAG_DOTRANGE tags.\n\t\t     * These tags are actually arrays and should be passed as\n\t\t     * array pointers to TIFFSetField() function, but actually\n\t\t     * passed as a list of separate values. This behaviour\n\t\t     * must be changed in the future!\n\t\t     */\n\t\t    int i;\n\t\t    char *val = (char *)tv->value;\n\n\t\t    for (i = 0; i < tv->count; i++, val += tv_size) {\n\t\t\t    switch (fip->field_type) {\n\t\t\t\tcase TIFF_BYTE:\n\t\t\t\tcase TIFF_UNDEFINED:\n\t\t\t\t    {\n\t\t\t\t\tuint8 v = (uint8)va_arg(ap, int);\n\t\t\t\t\t_TIFFmemcpy(val, &v, tv_size);\n\t\t\t\t    }\n\t\t\t\t    break;\n\t\t\t\tcase TIFF_SBYTE:\n\t\t\t\t    {\n\t\t\t\t\tint8 v = (int8)va_arg(ap, int);\n\t\t\t\t\t_TIFFmemcpy(val, &v, tv_size);\n\t\t\t\t    }\n\t\t\t\t    break;\n\t\t\t\tcase TIFF_SHORT:\n\t\t\t\t    {\n\t\t\t\t\tuint16 v = (uint16)va_arg(ap, int);\n\t\t\t\t\t_TIFFmemcpy(val, &v, tv_size);\n\t\t\t\t    }\n\t\t\t\t    break;\n\t\t\t\tcase TIFF_SSHORT:\n\t\t\t\t    {\n\t\t\t\t\tint16 v = (int16)va_arg(ap, int);\n\t\t\t\t\t_TIFFmemcpy(val, &v, tv_size);\n\t\t\t\t    }\n\t\t\t\t    break;\n\t\t\t\tcase TIFF_LONG:\n\t\t\t\tcase TIFF_IFD:\n\t\t\t\t    {\n\t\t\t\t\tuint32 v = va_arg(ap, uint32);\n\t\t\t\t\t_TIFFmemcpy(val, &v, tv_size);\n\t\t\t\t    }\n\t\t\t\t    break;\n\t\t\t\tcase TIFF_SLONG:\n\t\t\t\t    {\n\t\t\t\t\tint32 v = va_arg(ap, int32);\n\t\t\t\t\t_TIFFmemcpy(val, &v, tv_size);\n\t\t\t\t    }\n\t\t\t\t    break;\n\t\t\t\tcase TIFF_RATIONAL:\n\t\t\t\tcase TIFF_SRATIONAL:\n\t\t\t\tcase TIFF_FLOAT:\n\t\t\t\t    {\n\t\t\t\t\tfloat v = (float)va_arg(ap, double);\n\t\t\t\t\t_TIFFmemcpy(val, &v, tv_size);\n\t\t\t\t    }\n\t\t\t\t    break;\n\t\t\t\tcase TIFF_DOUBLE:\n\t\t\t\t    {\n\t\t\t\t\tdouble v = va_arg(ap, double);\n\t\t\t\t\t_TIFFmemcpy(val, &v, tv_size);\n\t\t\t\t    }\n\t\t\t\t    break;\n\t\t\t\tdefault:\n\t\t\t\t    _TIFFmemset(val, 0, tv_size);\n\t\t\t\t    status = 0;\n\t\t\t\t    break;\n\t\t\t    }\n\t\t    }\n\t\t}\n\t    }\n          }\n\t}\n\tif (status) {\n\t\tTIFFSetFieldBit(tif, _TIFFFieldWithTag(tif, tag)->field_bit);\n\t\ttif->tif_flags |= TIFF_DIRTYDIRECT;\n\t}\n\nend:\n\tva_end(ap);\n\treturn (status);\nbadvalue:\n\tTIFFErrorExt(tif->tif_clientdata, module,\n\t\t     \"%s: Bad value %d for \\\"%s\\\" tag\",\n\t\t     tif->tif_name, v,\n\t\t     _TIFFFieldWithTag(tif, tag)->field_name);\n\tva_end(ap);\n\treturn (0);\nbadvalue32:\n\tTIFFErrorExt(tif->tif_clientdata, module,\n\t\t     \"%s: Bad value %u for \\\"%s\\\" tag\",\n\t\t     tif->tif_name, v32,\n\t\t     _TIFFFieldWithTag(tif, tag)->field_name);\n\tva_end(ap);\n\treturn (0);\n}\n\n/*\n * Return 1/0 according to whether or not\n * it is permissible to set the tag's value.\n * Note that we allow ImageLength to be changed\n * so that we can append and extend to images.\n * Any other tag may not be altered once writing\n * has commenced, unless its value has no effect\n * on the format of the data that is written.\n */\nstatic int\nOkToChangeTag(TIFF* tif, ttag_t tag)\n{\n\tconst TIFFFieldInfo* fip = _TIFFFindFieldInfo(tif, tag, TIFF_ANY);\n\tif (!fip) {\t\t\t/* unknown tag */\n\t\tTIFFErrorExt(tif->tif_clientdata, \"TIFFSetField\", \"%s: Unknown %stag %u\",\n\t\t    tif->tif_name, isPseudoTag(tag) ? \"pseudo-\" : \"\", tag);\n\t\treturn (0);\n\t}\n\tif (tag != TIFFTAG_IMAGELENGTH && (tif->tif_flags & TIFF_BEENWRITING) &&\n\t    !fip->field_oktochange) {\n\t\t/*\n\t\t * Consult info table to see if tag can be changed\n\t\t * after we've started writing.  We only allow changes\n\t\t * to those tags that don't/shouldn't affect the\n\t\t * compression and/or format of the data.\n\t\t */\n\t\tTIFFErrorExt(tif->tif_clientdata, \"TIFFSetField\",\n\t\t    \"%s: Cannot modify tag \\\"%s\\\" while writing\",\n\t\t    tif->tif_name, fip->field_name);\n\t\treturn (0);\n\t}\n\treturn (1);\n}\n\n/*\n * Record the value of a field in the\n * internal directory structure.  The\n * field will be written to the file\n * when/if the directory structure is\n * updated.\n */\nint\nTIFFSetField(TIFF* tif, ttag_t tag, ...)\n{\n\tva_list ap;\n\tint status;\n\n\tva_start(ap, tag);\n\tstatus = TIFFVSetField(tif, tag, ap);\n\tva_end(ap);\n\treturn (status);\n}\n\n/*\n * Like TIFFSetField, but taking a varargs\n * parameter list.  This routine is useful\n * for building higher-level interfaces on\n * top of the library.\n */\nint\nTIFFVSetField(TIFF* tif, ttag_t tag, va_list ap)\n{\n\treturn OkToChangeTag(tif, tag) ?\n\t    (*tif->tif_tagmethods.vsetfield)(tif, tag, ap) : 0;\n}\n\nstatic int\n_TIFFVGetField(TIFF* tif, ttag_t tag, va_list ap)\n{\n    TIFFDirectory* td = &tif->tif_dir;\n    int            ret_val = 1;\n\n    switch (tag) {\n\tcase TIFFTAG_SUBFILETYPE:\n            *va_arg(ap, uint32*) = td->td_subfiletype;\n            break;\n\tcase TIFFTAG_IMAGEWIDTH:\n            *va_arg(ap, uint32*) = td->td_imagewidth;\n            break;\n\tcase TIFFTAG_IMAGELENGTH:\n            *va_arg(ap, uint32*) = td->td_imagelength;\n            break;\n\tcase TIFFTAG_BITSPERSAMPLE:\n            *va_arg(ap, uint16*) = td->td_bitspersample;\n            break;\n\tcase TIFFTAG_COMPRESSION:\n            *va_arg(ap, uint16*) = td->td_compression;\n            break;\n\tcase TIFFTAG_PHOTOMETRIC:\n            *va_arg(ap, uint16*) = td->td_photometric;\n            break;\n\tcase TIFFTAG_THRESHHOLDING:\n            *va_arg(ap, uint16*) = td->td_threshholding;\n            break;\n\tcase TIFFTAG_FILLORDER:\n            *va_arg(ap, uint16*) = td->td_fillorder;\n            break;\n\tcase TIFFTAG_ORIENTATION:\n            *va_arg(ap, uint16*) = td->td_orientation;\n            break;\n\tcase TIFFTAG_SAMPLESPERPIXEL:\n            *va_arg(ap, uint16*) = td->td_samplesperpixel;\n            break;\n\tcase TIFFTAG_ROWSPERSTRIP:\n            *va_arg(ap, uint32*) = td->td_rowsperstrip;\n            break;\n\tcase TIFFTAG_MINSAMPLEVALUE:\n            *va_arg(ap, uint16*) = td->td_minsamplevalue;\n            break;\n\tcase TIFFTAG_MAXSAMPLEVALUE:\n            *va_arg(ap, uint16*) = td->td_maxsamplevalue;\n            break;\n\tcase TIFFTAG_SMINSAMPLEVALUE:\n            *va_arg(ap, double*) = td->td_sminsamplevalue;\n            break;\n\tcase TIFFTAG_SMAXSAMPLEVALUE:\n            *va_arg(ap, double*) = td->td_smaxsamplevalue;\n            break;\n\tcase TIFFTAG_XRESOLUTION:\n            *va_arg(ap, float*) = td->td_xresolution;\n            break;\n\tcase TIFFTAG_YRESOLUTION:\n            *va_arg(ap, float*) = td->td_yresolution;\n            break;\n\tcase TIFFTAG_PLANARCONFIG:\n            *va_arg(ap, uint16*) = td->td_planarconfig;\n            break;\n\tcase TIFFTAG_XPOSITION:\n            *va_arg(ap, float*) = td->td_xposition;\n            break;\n\tcase TIFFTAG_YPOSITION:\n            *va_arg(ap, float*) = td->td_yposition;\n            break;\n\tcase TIFFTAG_RESOLUTIONUNIT:\n            *va_arg(ap, uint16*) = td->td_resolutionunit;\n            break;\n\tcase TIFFTAG_PAGENUMBER:\n            *va_arg(ap, uint16*) = td->td_pagenumber[0];\n            *va_arg(ap, uint16*) = td->td_pagenumber[1];\n            break;\n\tcase TIFFTAG_HALFTONEHINTS:\n            *va_arg(ap, uint16*) = td->td_halftonehints[0];\n            *va_arg(ap, uint16*) = td->td_halftonehints[1];\n            break;\n\tcase TIFFTAG_COLORMAP:\n            *va_arg(ap, uint16**) = td->td_colormap[0];\n            *va_arg(ap, uint16**) = td->td_colormap[1];\n            *va_arg(ap, uint16**) = td->td_colormap[2];\n            break;\n\tcase TIFFTAG_STRIPOFFSETS:\n\tcase TIFFTAG_TILEOFFSETS:\n            *va_arg(ap, uint32**) = td->td_stripoffset;\n            break;\n\tcase TIFFTAG_STRIPBYTECOUNTS:\n\tcase TIFFTAG_TILEBYTECOUNTS:\n            *va_arg(ap, uint32**) = td->td_stripbytecount;\n            break;\n\tcase TIFFTAG_MATTEING:\n            *va_arg(ap, uint16*) =\n                (td->td_extrasamples == 1 &&\n                 td->td_sampleinfo[0] == EXTRASAMPLE_ASSOCALPHA);\n            break;\n\tcase TIFFTAG_EXTRASAMPLES:\n            *va_arg(ap, uint16*) = td->td_extrasamples;\n            *va_arg(ap, uint16**) = td->td_sampleinfo;\n            break;\n\tcase TIFFTAG_TILEWIDTH:\n            *va_arg(ap, uint32*) = td->td_tilewidth;\n            break;\n\tcase TIFFTAG_TILELENGTH:\n            *va_arg(ap, uint32*) = td->td_tilelength;\n            break;\n\tcase TIFFTAG_TILEDEPTH:\n            *va_arg(ap, uint32*) = td->td_tiledepth;\n            break;\n\tcase TIFFTAG_DATATYPE:\n            switch (td->td_sampleformat) {\n\t\tcase SAMPLEFORMAT_UINT:\n                    *va_arg(ap, uint16*) = DATATYPE_UINT;\n                    break;\n\t\tcase SAMPLEFORMAT_INT:\n                    *va_arg(ap, uint16*) = DATATYPE_INT;\n                    break;\n\t\tcase SAMPLEFORMAT_IEEEFP:\n                    *va_arg(ap, uint16*) = DATATYPE_IEEEFP;\n                    break;\n\t\tcase SAMPLEFORMAT_VOID:\n                    *va_arg(ap, uint16*) = DATATYPE_VOID;\n                    break;\n            }\n            break;\n\tcase TIFFTAG_SAMPLEFORMAT:\n            *va_arg(ap, uint16*) = td->td_sampleformat;\n            break;\n\tcase TIFFTAG_IMAGEDEPTH:\n            *va_arg(ap, uint32*) = td->td_imagedepth;\n            break;\n\tcase TIFFTAG_SUBIFD:\n            *va_arg(ap, uint16*) = td->td_nsubifd;\n            *va_arg(ap, uint32**) = td->td_subifd;\n            break;\n\tcase TIFFTAG_YCBCRPOSITIONING:\n            *va_arg(ap, uint16*) = td->td_ycbcrpositioning;\n            break;\n\tcase TIFFTAG_YCBCRSUBSAMPLING:\n            *va_arg(ap, uint16*) = td->td_ycbcrsubsampling[0];\n            *va_arg(ap, uint16*) = td->td_ycbcrsubsampling[1];\n            break;\n\tcase TIFFTAG_TRANSFERFUNCTION:\n            *va_arg(ap, uint16**) = td->td_transferfunction[0];\n            if (td->td_samplesperpixel - td->td_extrasamples > 1) {\n                *va_arg(ap, uint16**) = td->td_transferfunction[1];\n                *va_arg(ap, uint16**) = td->td_transferfunction[2];\n            }\n            break;\n\tcase TIFFTAG_INKNAMES:\n            *va_arg(ap, char**) = td->td_inknames;\n            break;\n        default:\n        {\n            const TIFFFieldInfo* fip = _TIFFFindFieldInfo(tif, tag, TIFF_ANY);\n            int           i;\n            \n            /*\n\t     * This can happen if multiple images are open with different\n\t     * codecs which have private tags.  The global tag information\n\t     * table may then have tags that are valid for one file but not\n\t     * the other. If the client tries to get a tag that is not valid\n\t     * for the image's codec then we'll arrive here.\n             */\n            if( fip == NULL || fip->field_bit != FIELD_CUSTOM )\n            {\n\t\t    TIFFErrorExt(tif->tif_clientdata, \"_TIFFVGetField\",\n\t\t\t\t \"%s: Invalid %stag \\\"%s\\\" \"\n\t\t\t\t \"(not supported by codec)\",\n\t\t\t\t tif->tif_name,\n\t\t\t\t isPseudoTag(tag) ? \"pseudo-\" : \"\",\n\t\t\t\t fip ? fip->field_name : \"Unknown\");\n\t\t    ret_val = 0;\n\t\t    break;\n            }\n\n            /*\n\t     * Do we have a custom value?\n\t     */\n            ret_val = 0;\n            for (i = 0; i < td->td_customValueCount; i++) {\n\t\tTIFFTagValue *tv = td->td_customValues + i;\n\n\t\tif (tv->info->field_tag != tag)\n\t\t\tcontinue;\n                \n\t\tif (fip->field_passcount) {\n\t\t\tif (fip->field_readcount == TIFF_VARIABLE2) \n\t\t\t\t*va_arg(ap, uint32*) = (uint32)tv->count;\n\t\t\telse\t/* Assume TIFF_VARIABLE */\n\t\t\t\t*va_arg(ap, uint16*) = (uint16)tv->count;\n\t\t\t*va_arg(ap, void **) = tv->value;\n\t\t\tret_val = 1;\n                } else {\n\t\t\tif ((fip->field_type == TIFF_ASCII\n\t\t\t    || fip->field_readcount == TIFF_VARIABLE\n\t\t\t    || fip->field_readcount == TIFF_VARIABLE2\n\t\t\t    || fip->field_readcount == TIFF_SPP\n\t\t\t    || tv->count > 1)\n\t\t\t    && fip->field_tag != TIFFTAG_PAGENUMBER\n\t\t\t    && fip->field_tag != TIFFTAG_HALFTONEHINTS\n\t\t\t    && fip->field_tag != TIFFTAG_YCBCRSUBSAMPLING\n\t\t\t    && fip->field_tag != TIFFTAG_DOTRANGE) {\n\t\t\t\t*va_arg(ap, void **) = tv->value;\n\t\t\t\tret_val = 1;\n\t\t\t} else {\n\t\t\t    int j;\n\t\t\t    char *val = (char *)tv->value;\n\n\t\t\t    for (j = 0; j < tv->count;\n\t\t\t\t j++, val += _TIFFDataSize(tv->info->field_type)) {\n\t\t\t\tswitch (fip->field_type) {\n\t\t\t\t\tcase TIFF_BYTE:\n\t\t\t\t\tcase TIFF_UNDEFINED:\n\t\t\t\t\t\t*va_arg(ap, uint8*) =\n\t\t\t\t\t\t\t*(uint8 *)val;\n\t\t\t\t\t\tret_val = 1;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase TIFF_SBYTE:\n\t\t\t\t\t\t*va_arg(ap, int8*) =\n\t\t\t\t\t\t\t*(int8 *)val;\n\t\t\t\t\t\tret_val = 1;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase TIFF_SHORT:\n\t\t\t\t\t\t*va_arg(ap, uint16*) =\n\t\t\t\t\t\t\t*(uint16 *)val;\n\t\t\t\t\t\tret_val = 1;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase TIFF_SSHORT:\n\t\t\t\t\t\t*va_arg(ap, int16*) =\n\t\t\t\t\t\t\t*(int16 *)val;\n\t\t\t\t\t\tret_val = 1;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase TIFF_LONG:\n\t\t\t\t\tcase TIFF_IFD:\n\t\t\t\t\t\t*va_arg(ap, uint32*) =\n\t\t\t\t\t\t\t*(uint32 *)val;\n\t\t\t\t\t\tret_val = 1;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase TIFF_SLONG:\n\t\t\t\t\t\t*va_arg(ap, int32*) =\n\t\t\t\t\t\t\t*(int32 *)val;\n\t\t\t\t\t\tret_val = 1;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase TIFF_RATIONAL:\n\t\t\t\t\tcase TIFF_SRATIONAL:\n\t\t\t\t\tcase TIFF_FLOAT:\n\t\t\t\t\t\t*va_arg(ap, float*) =\n\t\t\t\t\t\t\t*(float *)val;\n\t\t\t\t\t\tret_val = 1;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase TIFF_DOUBLE:\n\t\t\t\t\t\t*va_arg(ap, double*) =\n\t\t\t\t\t\t\t*(double *)val;\n\t\t\t\t\t\tret_val = 1;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tret_val = 0;\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t    }\n\t\t\t}\n                }\n\t\tbreak;\n            }\n        }\n    }\n    return(ret_val);\n}\n\n/*\n * Return the value of a field in the\n * internal directory structure.\n */\nint\nTIFFGetField(TIFF* tif, ttag_t tag, ...)\n{\n\tint status;\n\tva_list ap;\n\n\tva_start(ap, tag);\n\tstatus = TIFFVGetField(tif, tag, ap);\n\tva_end(ap);\n\treturn (status);\n}\n\n/*\n * Like TIFFGetField, but taking a varargs\n * parameter list.  This routine is useful\n * for building higher-level interfaces on\n * top of the library.\n */\nint\nTIFFVGetField(TIFF* tif, ttag_t tag, va_list ap)\n{\n\tconst TIFFFieldInfo* fip = _TIFFFindFieldInfo(tif, tag, TIFF_ANY);\n\treturn (fip && (isPseudoTag(tag) || TIFFFieldSet(tif, fip->field_bit)) ?\n\t    (*tif->tif_tagmethods.vgetfield)(tif, tag, ap) : 0);\n}\n\n#define\tCleanupField(member) {\t\t\\\n    if (td->member) {\t\t\t\\\n\t_TIFFfree(td->member);\t\t\\\n\ttd->member = 0;\t\t\t\\\n    }\t\t\t\t\t\\\n}\n\n/*\n * Release storage associated with a directory.\n */\nvoid\nTIFFFreeDirectory(TIFF* tif)\n{\n\tTIFFDirectory *td = &tif->tif_dir;\n\tint            i;\n\n\t_TIFFmemset(td->td_fieldsset, 0, FIELD_SETLONGS);\n\tCleanupField(td_colormap[0]);\n\tCleanupField(td_colormap[1]);\n\tCleanupField(td_colormap[2]);\n\tCleanupField(td_sampleinfo);\n\tCleanupField(td_subifd);\n\tCleanupField(td_inknames);\n\tCleanupField(td_transferfunction[0]);\n\tCleanupField(td_transferfunction[1]);\n\tCleanupField(td_transferfunction[2]);\n\tCleanupField(td_stripoffset);\n\tCleanupField(td_stripbytecount);\n\tTIFFClrFieldBit(tif, FIELD_YCBCRSUBSAMPLING);\n\tTIFFClrFieldBit(tif, FIELD_YCBCRPOSITIONING);\n\n\t/* Cleanup custom tag values */\n\tfor( i = 0; i < td->td_customValueCount; i++ ) {\n\t\tif (td->td_customValues[i].value)\n\t\t\t_TIFFfree(td->td_customValues[i].value);\n\t}\n\n\ttd->td_customValueCount = 0;\n\tCleanupField(td_customValues);\n}\n#undef CleanupField\n\n/*\n * Client Tag extension support (from Niles Ritter).\n */\nstatic TIFFExtendProc _TIFFextender = (TIFFExtendProc) NULL;\n\nTIFFExtendProc\nTIFFSetTagExtender(TIFFExtendProc extender)\n{\n\tTIFFExtendProc prev = _TIFFextender;\n\t_TIFFextender = extender;\n\treturn (prev);\n}\n\n/*\n * Setup for a new directory.  Should we automatically call\n * TIFFWriteDirectory() if the current one is dirty?\n *\n * The newly created directory will not exist on the file till\n * TIFFWriteDirectory(), TIFFFlush() or TIFFClose() is called.\n */\nint\nTIFFCreateDirectory(TIFF* tif)\n{\n    TIFFDefaultDirectory(tif);\n    tif->tif_diroff = 0;\n    tif->tif_nextdiroff = 0;\n    tif->tif_curoff = 0;\n    tif->tif_row = (uint32) -1;\n    tif->tif_curstrip = (tstrip_t) -1;\n\n    return 0;\n}\n\n/*\n * Setup a default directory structure.\n */\nint\nTIFFDefaultDirectory(TIFF* tif)\n{\n\tregister TIFFDirectory* td = &tif->tif_dir;\n\n\tsize_t tiffFieldInfoCount;\n\tconst TIFFFieldInfo *tiffFieldInfo =\n\t    _TIFFGetFieldInfo(&tiffFieldInfoCount);\n\t_TIFFSetupFieldInfo(tif, tiffFieldInfo, tiffFieldInfoCount);\n\n\t_TIFFmemset(td, 0, sizeof (*td));\n\ttd->td_fillorder = FILLORDER_MSB2LSB;\n\ttd->td_bitspersample = 1;\n\ttd->td_threshholding = THRESHHOLD_BILEVEL;\n\ttd->td_orientation = ORIENTATION_TOPLEFT;\n\ttd->td_samplesperpixel = 1;\n\ttd->td_rowsperstrip = (uint32) -1;\n\ttd->td_tilewidth = 0;\n\ttd->td_tilelength = 0;\n\ttd->td_tiledepth = 1;\n\ttd->td_stripbytecountsorted = 1; /* Our own arrays always sorted. */\n\ttd->td_resolutionunit = RESUNIT_INCH;\n\ttd->td_sampleformat = SAMPLEFORMAT_UINT;\n\ttd->td_imagedepth = 1;\n\ttd->td_ycbcrsubsampling[0] = 2;\n\ttd->td_ycbcrsubsampling[1] = 2;\n\ttd->td_ycbcrpositioning = YCBCRPOSITION_CENTERED;\n\ttif->tif_postdecode = _TIFFNoPostDecode;\n\ttif->tif_foundfield = NULL;\n\ttif->tif_tagmethods.vsetfield = _TIFFVSetField;\n\ttif->tif_tagmethods.vgetfield = _TIFFVGetField;\n\ttif->tif_tagmethods.printdir = NULL;\n\t/*\n\t *  Give client code a chance to install their own\n\t *  tag extensions & methods, prior to compression overloads.\n\t */\n\tif (_TIFFextender)\n\t\t(*_TIFFextender)(tif);\n\t(void) TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_NONE);\n\t/*\n\t * NB: The directory is marked dirty as a result of setting\n\t * up the default compression scheme.  However, this really\n\t * isn't correct -- we want TIFF_DIRTYDIRECT to be set only\n\t * if the user does something.  We could just do the setup\n\t * by hand, but it seems better to use the normal mechanism\n\t * (i.e. TIFFSetField).\n\t */\n\ttif->tif_flags &= ~TIFF_DIRTYDIRECT;\n\n\t/*\n\t * As per http://bugzilla.remotesensing.org/show_bug.cgi?id=19\n\t * we clear the ISTILED flag when setting up a new directory.\n\t * Should we also be clearing stuff like INSUBIFD?\n\t */\n\ttif->tif_flags &= ~TIFF_ISTILED;\n\n\treturn (1);\n}\n\nstatic int\nTIFFAdvanceDirectory(TIFF* tif, uint32* nextdir, toff_t* off)\n{\n\tstatic const char module[] = \"TIFFAdvanceDirectory\";\n\tuint16 dircount;\n\tif (isMapped(tif))\n\t{\n\t\ttoff_t poff=*nextdir;\n\t\tif (poff+sizeof(uint16) > tif->tif_size)\n\t\t{\n\t\t\tTIFFErrorExt(tif->tif_clientdata, module, \"%s: Error fetching directory count\",\n\t\t\t    tif->tif_name);\n\t\t\treturn (0);\n\t\t}\n\t\t_TIFFmemcpy(&dircount, tif->tif_base+poff, sizeof (uint16));\n\t\tif (tif->tif_flags & TIFF_SWAB)\n\t\t\tTIFFSwabShort(&dircount);\n\t\tpoff+=sizeof (uint16)+dircount*sizeof (TIFFDirEntry);\n\t\tif (off != NULL)\n\t\t\t*off = poff;\n\t\tif (((toff_t) (poff+sizeof (uint32))) > tif->tif_size)\n\t\t{\n\t\t\tTIFFErrorExt(tif->tif_clientdata, module, \"%s: Error fetching directory link\",\n\t\t\t    tif->tif_name);\n\t\t\treturn (0);\n\t\t}\n\t\t_TIFFmemcpy(nextdir, tif->tif_base+poff, sizeof (uint32));\n\t\tif (tif->tif_flags & TIFF_SWAB)\n\t\t\tTIFFSwabLong(nextdir);\n\t\treturn (1);\n\t}\n\telse\n\t{\n\t\tif (!SeekOK(tif, *nextdir) ||\n\t\t    !ReadOK(tif, &dircount, sizeof (uint16))) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, module, \"%s: Error fetching directory count\",\n\t\t\t    tif->tif_name);\n\t\t\treturn (0);\n\t\t}\n\t\tif (tif->tif_flags & TIFF_SWAB)\n\t\t\tTIFFSwabShort(&dircount);\n\t\tif (off != NULL)\n\t\t\t*off = TIFFSeekFile(tif,\n\t\t\t    dircount*sizeof (TIFFDirEntry), SEEK_CUR);\n\t\telse\n\t\t\t(void) TIFFSeekFile(tif,\n\t\t\t    dircount*sizeof (TIFFDirEntry), SEEK_CUR);\n\t\tif (!ReadOK(tif, nextdir, sizeof (uint32))) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, module, \"%s: Error fetching directory link\",\n\t\t\t    tif->tif_name);\n\t\t\treturn (0);\n\t\t}\n\t\tif (tif->tif_flags & TIFF_SWAB)\n\t\t\tTIFFSwabLong(nextdir);\n\t\treturn (1);\n\t}\n}\n\n/*\n * Count the number of directories in a file.\n */\ntdir_t\nTIFFNumberOfDirectories(TIFF* tif)\n{\n    toff_t nextdir = tif->tif_header.tiff_diroff;\n    tdir_t n = 0;\n    \n    while (nextdir != 0 && TIFFAdvanceDirectory(tif, &nextdir, NULL))\n        n++;\n    return (n);\n}\n\n/*\n * Set the n-th directory as the current directory.\n * NB: Directories are numbered starting at 0.\n */\nint\nTIFFSetDirectory(TIFF* tif, tdir_t dirn)\n{\n\ttoff_t nextdir;\n\ttdir_t n;\n\n\tnextdir = tif->tif_header.tiff_diroff;\n\tfor (n = dirn; n > 0 && nextdir != 0; n--)\n\t\tif (!TIFFAdvanceDirectory(tif, &nextdir, NULL))\n\t\t\treturn (0);\n\ttif->tif_nextdiroff = nextdir;\n\t/*\n\t * Set curdir to the actual directory index.  The\n\t * -1 is because TIFFReadDirectory will increment\n\t * tif_curdir after successfully reading the directory.\n\t */\n\ttif->tif_curdir = (dirn - n) - 1;\n\t/*\n\t * Reset tif_dirnumber counter and start new list of seen directories.\n\t * We need this to prevent IFD loops.\n\t */\n\ttif->tif_dirnumber = 0;\n\treturn (TIFFReadDirectory(tif));\n}\n\n/*\n * Set the current directory to be the directory\n * located at the specified file offset.  This interface\n * is used mainly to access directories linked with\n * the SubIFD tag (e.g. thumbnail images).\n */\nint\nTIFFSetSubDirectory(TIFF* tif, uint32 diroff)\n{\n\ttif->tif_nextdiroff = diroff;\n\t/*\n\t * Reset tif_dirnumber counter and start new list of seen directories.\n\t * We need this to prevent IFD loops.\n\t */\n\ttif->tif_dirnumber = 0;\n\treturn (TIFFReadDirectory(tif));\n}\n\n/*\n * Return file offset of the current directory.\n */\nuint32\nTIFFCurrentDirOffset(TIFF* tif)\n{\n\treturn (tif->tif_diroff);\n}\n\n/*\n * Return an indication of whether or not we are\n * at the last directory in the file.\n */\nint\nTIFFLastDirectory(TIFF* tif)\n{\n\treturn (tif->tif_nextdiroff == 0);\n}\n\n/*\n * Unlink the specified directory from the directory chain.\n */\nint\nTIFFUnlinkDirectory(TIFF* tif, tdir_t dirn)\n{\n\tstatic const char module[] = \"TIFFUnlinkDirectory\";\n\ttoff_t nextdir;\n\ttoff_t off;\n\ttdir_t n;\n\n\tif (tif->tif_mode == O_RDONLY) {\n\t\tTIFFErrorExt(tif->tif_clientdata, module,\n                             \"Can not unlink directory in read-only file\");\n\t\treturn (0);\n\t}\n\t/*\n\t * Go to the directory before the one we want\n\t * to unlink and nab the offset of the link\n\t * field we'll need to patch.\n\t */\n\tnextdir = tif->tif_header.tiff_diroff;\n\toff = sizeof (uint16) + sizeof (uint16);\n\tfor (n = dirn-1; n > 0; n--) {\n\t\tif (nextdir == 0) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, module, \"Directory %d does not exist\", dirn);\n\t\t\treturn (0);\n\t\t}\n\t\tif (!TIFFAdvanceDirectory(tif, &nextdir, &off))\n\t\t\treturn (0);\n\t}\n\t/*\n\t * Advance to the directory to be unlinked and fetch\n\t * the offset of the directory that follows.\n\t */\n\tif (!TIFFAdvanceDirectory(tif, &nextdir, NULL))\n\t\treturn (0);\n\t/*\n\t * Go back and patch the link field of the preceding\n\t * directory to point to the offset of the directory\n\t * that follows.\n\t */\n\t(void) TIFFSeekFile(tif, off, SEEK_SET);\n\tif (tif->tif_flags & TIFF_SWAB)\n\t\tTIFFSwabLong(&nextdir);\n\tif (!WriteOK(tif, &nextdir, sizeof (uint32))) {\n\t\tTIFFErrorExt(tif->tif_clientdata, module, \"Error writing directory link\");\n\t\treturn (0);\n\t}\n\t/*\n\t * Leave directory state setup safely.  We don't have\n\t * facilities for doing inserting and removing directories,\n\t * so it's safest to just invalidate everything.  This\n\t * means that the caller can only append to the directory\n\t * chain.\n\t */\n\t(*tif->tif_cleanup)(tif);\n\tif ((tif->tif_flags & TIFF_MYBUFFER) && tif->tif_rawdata) {\n\t\t_TIFFfree(tif->tif_rawdata);\n\t\ttif->tif_rawdata = NULL;\n\t\ttif->tif_rawcc = 0;\n\t}\n\ttif->tif_flags &= ~(TIFF_BEENWRITING|TIFF_BUFFERSETUP|TIFF_POSTENCODE);\n\tTIFFFreeDirectory(tif);\n\tTIFFDefaultDirectory(tif);\n\ttif->tif_diroff = 0;\t\t\t/* force link on next write */\n\ttif->tif_nextdiroff = 0;\t\t/* next write must be at end */\n\ttif->tif_curoff = 0;\n\ttif->tif_row = (uint32) -1;\n\ttif->tif_curstrip = (tstrip_t) -1;\n\treturn (1);\n}\n\n/*\t\t\t[BFC]\n *\n * Author: Bruce Cameron <cameron@petris.com>\n *\n * Set a table of tags that are to be replaced during directory process by the\n * 'IGNORE' state - or return TRUE/FALSE for the requested tag such that\n * 'ReadDirectory' can use the stored information.\n *\n * FIXME: this is never used properly. Should be removed in the future.\n */\nint\nTIFFReassignTagToIgnore (enum TIFFIgnoreSense task, int TIFFtagID)\n{\n    static int TIFFignoretags [FIELD_LAST];\n    static int tagcount = 0 ;\n    int\t\ti;\t\t\t\t\t/* Loop index */\n    int\t\tj;\t\t\t\t\t/* Loop index */\n\n    switch (task)\n    {\n      case TIS_STORE:\n        if ( tagcount < (FIELD_LAST - 1) )\n        {\n            for ( j = 0 ; j < tagcount ; ++j )\n            {\t\t\t\t\t/* Do not add duplicate tag */\n                if ( TIFFignoretags [j] == TIFFtagID )\n                    return (TRUE) ;\n            }\n            TIFFignoretags [tagcount++] = TIFFtagID ;\n            return (TRUE) ;\n        }\n        break ;\n        \n      case TIS_EXTRACT:\n        for ( i = 0 ; i < tagcount ; ++i )\n        {\n            if ( TIFFignoretags [i] == TIFFtagID )\n                return (TRUE) ;\n        }\n        break;\n        \n      case TIS_EMPTY:\n        tagcount = 0 ;\t\t\t/* Clear the list */\n        return (TRUE) ;\n        \n      default:\n        break;\n    }\n    \n    return (FALSE);\n}\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/tif_dir.h",
    "content": "/* $Id: tif_dir.h,v 1.30.2.1 2007/04/07 14:58:30 dron Exp $ */\n\n/*\n * Copyright (c) 1988-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n#ifndef _TIFFDIR_\n#define\t_TIFFDIR_\n/*\n * ``Library-private'' Directory-related Definitions.\n */\n\n/*\n * Internal format of a TIFF directory entry.\n */\ntypedef\tstruct {\n#define\tFIELD_SETLONGS\t4\n\t/* bit vector of fields that are set */\n\tunsigned long\ttd_fieldsset[FIELD_SETLONGS];\n\n\tuint32  td_imagewidth, td_imagelength, td_imagedepth;\n\tuint32  td_tilewidth, td_tilelength, td_tiledepth;\n\tuint32  td_subfiletype;\n\tuint16  td_bitspersample;\n\tuint16  td_sampleformat;\n\tuint16  td_compression;\n\tuint16  td_photometric;\n\tuint16  td_threshholding;\n\tuint16  td_fillorder;\n\tuint16  td_orientation;\n\tuint16  td_samplesperpixel;\n\tuint32  td_rowsperstrip;\n\tuint16  td_minsamplevalue, td_maxsamplevalue;\n\tdouble  td_sminsamplevalue, td_smaxsamplevalue;\n\tfloat   td_xresolution, td_yresolution;\n\tuint16  td_resolutionunit;\n\tuint16  td_planarconfig;\n\tfloat   td_xposition, td_yposition;\n\tuint16  td_pagenumber[2];\n\tuint16* td_colormap[3];\n\tuint16  td_halftonehints[2];\n\tuint16  td_extrasamples;\n\tuint16* td_sampleinfo;\n\t/* even though the name is misleading, td_stripsperimage is the number\n\t * of striles (=strips or tiles) per plane, and td_nstrips the total\n\t * number of striles */\n\ttstrile_t td_stripsperimage;\n\ttstrile_t td_nstrips;            /* size of offset & bytecount arrays */\n\ttoff_t* td_stripoffset;\n\ttoff_t* td_stripbytecount;\t /* FIXME: it should be tsize_t array */\n\tint     td_stripbytecountsorted; /* is the bytecount array sorted ascending? */\n\tuint16  td_nsubifd;\n\tuint32* td_subifd;\n\t/* YCbCr parameters */\n\tuint16  td_ycbcrsubsampling[2];\n\tuint16  td_ycbcrpositioning;\n\t/* Colorimetry parameters */\n\tuint16* td_transferfunction[3];\n\t/* CMYK parameters */\n\tint     td_inknameslen;\n\tchar*   td_inknames;\n\n\tint     td_customValueCount;\n        TIFFTagValue *td_customValues;\n} TIFFDirectory;\n\n/*\n * Field flags used to indicate fields that have\n * been set in a directory, and to reference fields\n * when manipulating a directory.\n */\n\n/*\n * FIELD_IGNORE is used to signify tags that are to\n * be processed but otherwise ignored.  This permits\n * antiquated tags to be quietly read and discarded.\n * Note that a bit *is* allocated for ignored tags;\n * this is understood by the directory reading logic\n * which uses this fact to avoid special-case handling\n */ \n#define\tFIELD_IGNORE\t\t\t0\n\n/* multi-item fields */\n#define\tFIELD_IMAGEDIMENSIONS\t\t1\n#define FIELD_TILEDIMENSIONS\t\t2\n#define\tFIELD_RESOLUTION\t\t3\n#define\tFIELD_POSITION\t\t\t4\n\n/* single-item fields */\n#define\tFIELD_SUBFILETYPE\t\t5\n#define\tFIELD_BITSPERSAMPLE\t\t6\n#define\tFIELD_COMPRESSION\t\t7\n#define\tFIELD_PHOTOMETRIC\t\t8\n#define\tFIELD_THRESHHOLDING\t\t9\n#define\tFIELD_FILLORDER\t\t\t10\n#define\tFIELD_ORIENTATION\t\t15\n#define\tFIELD_SAMPLESPERPIXEL\t\t16\n#define\tFIELD_ROWSPERSTRIP\t\t17\n#define\tFIELD_MINSAMPLEVALUE\t\t18\n#define\tFIELD_MAXSAMPLEVALUE\t\t19\n#define\tFIELD_PLANARCONFIG\t\t20\n#define\tFIELD_RESOLUTIONUNIT\t\t22\n#define\tFIELD_PAGENUMBER\t\t23\n#define\tFIELD_STRIPBYTECOUNTS\t\t24\n#define\tFIELD_STRIPOFFSETS\t\t25\n#define\tFIELD_COLORMAP\t\t\t26\n#define\tFIELD_EXTRASAMPLES\t\t31\n#define FIELD_SAMPLEFORMAT\t\t32\n#define\tFIELD_SMINSAMPLEVALUE\t\t33\n#define\tFIELD_SMAXSAMPLEVALUE\t\t34\n#define FIELD_IMAGEDEPTH\t\t35\n#define FIELD_TILEDEPTH\t\t\t36\n#define\tFIELD_HALFTONEHINTS\t\t37\n#define FIELD_YCBCRSUBSAMPLING\t\t39\n#define FIELD_YCBCRPOSITIONING\t\t40\n#define\tFIELD_TRANSFERFUNCTION\t\t44\n#define\tFIELD_INKNAMES\t\t\t46\n#define\tFIELD_SUBIFD\t\t\t49\n/*      FIELD_CUSTOM (see tiffio.h)     65 */\n/* end of support for well-known tags; codec-private tags follow */\n#define\tFIELD_CODEC\t\t\t66\t/* base of codec-private tags */\n\n\n/*\n * Pseudo-tags don't normally need field bits since they\n * are not written to an output file (by definition).\n * The library also has express logic to always query a\n * codec for a pseudo-tag so allocating a field bit for\n * one is a waste.   If codec wants to promote the notion\n * of a pseudo-tag being ``set'' or ``unset'' then it can\n * do using internal state flags without polluting the\n * field bit space defined for real tags.\n */\n#define\tFIELD_PSEUDO\t\t\t0\n\n#define\tFIELD_LAST\t\t\t(32*FIELD_SETLONGS-1)\n\n#define\tTIFFExtractData(tif, type, v) \\\n    ((uint32) ((tif)->tif_header.tiff_magic == TIFF_BIGENDIAN ? \\\n        ((v) >> (tif)->tif_typeshift[type]) & (tif)->tif_typemask[type] : \\\n\t(v) & (tif)->tif_typemask[type]))\n#define\tTIFFInsertData(tif, type, v) \\\n    ((uint32) ((tif)->tif_header.tiff_magic == TIFF_BIGENDIAN ? \\\n        ((v) & (tif)->tif_typemask[type]) << (tif)->tif_typeshift[type] : \\\n\t(v) & (tif)->tif_typemask[type]))\n\n\n#define BITn(n)\t\t\t\t(((unsigned long)1L)<<((n)&0x1f)) \n#define BITFIELDn(tif, n)\t\t((tif)->tif_dir.td_fieldsset[(n)/32]) \n#define TIFFFieldSet(tif, field)\t(BITFIELDn(tif, field) & BITn(field)) \n#define TIFFSetFieldBit(tif, field)\t(BITFIELDn(tif, field) |= BITn(field))\n#define TIFFClrFieldBit(tif, field)\t(BITFIELDn(tif, field) &= ~BITn(field))\n\n#define\tFieldSet(fields, f)\t\t(fields[(f)/32] & BITn(f))\n#define\tResetFieldBit(fields, f)\t(fields[(f)/32] &= ~BITn(f))\n\n#if defined(__cplusplus)\nextern \"C\" {\n#endif\nextern\tconst TIFFFieldInfo *_TIFFGetFieldInfo(size_t *);\nextern\tconst TIFFFieldInfo *_TIFFGetExifFieldInfo(size_t *);\nextern\tvoid _TIFFSetupFieldInfo(TIFF*, const TIFFFieldInfo[], size_t);\nextern\tint _TIFFMergeFieldInfo(TIFF*, const TIFFFieldInfo[], int);\nextern\tvoid _TIFFPrintFieldInfo(TIFF*, FILE*);\nextern\tTIFFDataType _TIFFSampleToTagType(TIFF*);\nextern  const TIFFFieldInfo* _TIFFFindOrRegisterFieldInfo( TIFF *tif,\n\t\t\t\t\t\t\t   ttag_t tag,\n\t\t\t\t\t\t\t   TIFFDataType dt );\nextern  TIFFFieldInfo* _TIFFCreateAnonFieldInfo( TIFF *tif, ttag_t tag,\n                                                 TIFFDataType dt );\n\n#define _TIFFFindFieldInfo\t    TIFFFindFieldInfo\n#define _TIFFFindFieldInfoByName    TIFFFindFieldInfoByName\n#define _TIFFFieldWithTag\t    TIFFFieldWithTag\n#define _TIFFFieldWithName\t    TIFFFieldWithName\n\n#if defined(__cplusplus)\n}\n#endif\n#endif /* _TIFFDIR_ */\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/tif_dirinfo.c",
    "content": "/* $Id: tif_dirinfo.c,v 1.65.2.7 2009-09-17 18:00:28 bfriesen Exp $ */\n\n/*\n * Copyright (c) 1988-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n/*\n * TIFF Library.\n *\n * Core Directory Tag Support.\n */\n#include \"tiffiop.h\"\n#include <stdlib.h>\n#include <string.h>\n\n/*\n * NB: NB: THIS ARRAY IS ASSUMED TO BE SORTED BY TAG.\n *       If a tag can have both LONG and SHORT types then the LONG must be\n *       placed before the SHORT for writing to work properly.\n *\n * NOTE: The second field (field_readcount) and third field (field_writecount)\n *       sometimes use the values TIFF_VARIABLE (-1), TIFF_VARIABLE2 (-3)\n *       and TIFFTAG_SPP (-2). The macros should be used but would throw off \n *       the formatting of the code, so please interprete the -1, -2 and -3 \n *       values accordingly.\n */\nstatic const TIFFFieldInfo\ntiffFieldInfo[] = {\n    { TIFFTAG_SUBFILETYPE,\t 1, 1,\tTIFF_LONG,\tFIELD_SUBFILETYPE,\n      1,\t0,\t\"SubfileType\" },\n/* XXX SHORT for compatibility w/ old versions of the library */\n    { TIFFTAG_SUBFILETYPE,\t 1, 1,\tTIFF_SHORT,\tFIELD_SUBFILETYPE,\n      1,\t0,\t\"SubfileType\" },\n    { TIFFTAG_OSUBFILETYPE,\t 1, 1,\tTIFF_SHORT,\tFIELD_SUBFILETYPE,\n      1,\t0,\t\"OldSubfileType\" },\n    { TIFFTAG_IMAGEWIDTH,\t 1, 1,\tTIFF_LONG,\tFIELD_IMAGEDIMENSIONS,\n      0,\t0,\t\"ImageWidth\" },\n    { TIFFTAG_IMAGEWIDTH,\t 1, 1,\tTIFF_SHORT,\tFIELD_IMAGEDIMENSIONS,\n      0,\t0,\t\"ImageWidth\" },\n    { TIFFTAG_IMAGELENGTH,\t 1, 1,\tTIFF_LONG,\tFIELD_IMAGEDIMENSIONS,\n      1,\t0,\t\"ImageLength\" },\n    { TIFFTAG_IMAGELENGTH,\t 1, 1,\tTIFF_SHORT,\tFIELD_IMAGEDIMENSIONS,\n      1,\t0,\t\"ImageLength\" },\n    { TIFFTAG_BITSPERSAMPLE,\t-1,-1,\tTIFF_SHORT,\tFIELD_BITSPERSAMPLE,\n      0,\t0,\t\"BitsPerSample\" },\n/* XXX LONG for compatibility with some broken TIFF writers */\n    { TIFFTAG_BITSPERSAMPLE,\t-1,-1,\tTIFF_LONG,\tFIELD_BITSPERSAMPLE,\n      0,\t0,\t\"BitsPerSample\" },\n    { TIFFTAG_COMPRESSION,\t-1, 1,\tTIFF_SHORT,\tFIELD_COMPRESSION,\n      0,\t0,\t\"Compression\" },\n/* XXX LONG for compatibility with some broken TIFF writers */\n    { TIFFTAG_COMPRESSION,\t-1, 1,\tTIFF_LONG,\tFIELD_COMPRESSION,\n      0,\t0,\t\"Compression\" },\n    { TIFFTAG_PHOTOMETRIC,\t 1, 1,\tTIFF_SHORT,\tFIELD_PHOTOMETRIC,\n      0,\t0,\t\"PhotometricInterpretation\" },\n/* XXX LONG for compatibility with some broken TIFF writers */\n    { TIFFTAG_PHOTOMETRIC,\t 1, 1,\tTIFF_LONG,\tFIELD_PHOTOMETRIC,\n      0,\t0,\t\"PhotometricInterpretation\" },\n    { TIFFTAG_THRESHHOLDING,\t 1, 1,\tTIFF_SHORT,\tFIELD_THRESHHOLDING,\n      1,\t0,\t\"Threshholding\" },\n    { TIFFTAG_CELLWIDTH,\t 1, 1,\tTIFF_SHORT,\tFIELD_IGNORE,\n      1,\t0,\t\"CellWidth\" },\n    { TIFFTAG_CELLLENGTH,\t 1, 1,\tTIFF_SHORT,\tFIELD_IGNORE,\n      1,\t0,\t\"CellLength\" },\n    { TIFFTAG_FILLORDER,\t 1, 1,\tTIFF_SHORT,\tFIELD_FILLORDER,\n      0,\t0,\t\"FillOrder\" },\n    { TIFFTAG_DOCUMENTNAME,\t-1,-1,\tTIFF_ASCII,\tFIELD_CUSTOM,\n      1,\t0,\t\"DocumentName\" },\n    { TIFFTAG_IMAGEDESCRIPTION,\t-1,-1,\tTIFF_ASCII,\tFIELD_CUSTOM,\n      1,\t0,\t\"ImageDescription\" },\n    { TIFFTAG_MAKE,\t\t-1,-1,\tTIFF_ASCII,\tFIELD_CUSTOM,\n      1,\t0,\t\"Make\" },\n    { TIFFTAG_MODEL,\t\t-1,-1,\tTIFF_ASCII,\tFIELD_CUSTOM,\n      1,\t0,\t\"Model\" },\n    { TIFFTAG_STRIPOFFSETS,\t-1,-1,\tTIFF_LONG,\tFIELD_STRIPOFFSETS,\n      0,\t0,\t\"StripOffsets\" },\n    { TIFFTAG_STRIPOFFSETS,\t-1,-1,\tTIFF_SHORT,\tFIELD_STRIPOFFSETS,\n      0,\t0,\t\"StripOffsets\" },\n    { TIFFTAG_ORIENTATION,\t 1, 1,\tTIFF_SHORT,\tFIELD_ORIENTATION,\n      0,\t0,\t\"Orientation\" },\n    { TIFFTAG_SAMPLESPERPIXEL,\t 1, 1,\tTIFF_SHORT,\tFIELD_SAMPLESPERPIXEL,\n      0,\t0,\t\"SamplesPerPixel\" },\n    { TIFFTAG_ROWSPERSTRIP,\t 1, 1,\tTIFF_LONG,\tFIELD_ROWSPERSTRIP,\n      0,\t0,\t\"RowsPerStrip\" },\n    { TIFFTAG_ROWSPERSTRIP,\t 1, 1,\tTIFF_SHORT,\tFIELD_ROWSPERSTRIP,\n      0,\t0,\t\"RowsPerStrip\" },\n    { TIFFTAG_STRIPBYTECOUNTS,\t-1,-1,\tTIFF_LONG,\tFIELD_STRIPBYTECOUNTS,\n      0,\t0,\t\"StripByteCounts\" },\n    { TIFFTAG_STRIPBYTECOUNTS,\t-1,-1,\tTIFF_SHORT,\tFIELD_STRIPBYTECOUNTS,\n      0,\t0,\t\"StripByteCounts\" },\n    { TIFFTAG_MINSAMPLEVALUE,\t-2,-1,\tTIFF_SHORT,\tFIELD_MINSAMPLEVALUE,\n      1,\t0,\t\"MinSampleValue\" },\n    { TIFFTAG_MAXSAMPLEVALUE,\t-2,-1,\tTIFF_SHORT,\tFIELD_MAXSAMPLEVALUE,\n      1,\t0,\t\"MaxSampleValue\" },\n    { TIFFTAG_XRESOLUTION,\t 1, 1,\tTIFF_RATIONAL,\tFIELD_RESOLUTION,\n      1,\t0,\t\"XResolution\" },\n    { TIFFTAG_YRESOLUTION,\t 1, 1,\tTIFF_RATIONAL,\tFIELD_RESOLUTION,\n      1,\t0,\t\"YResolution\" },\n    { TIFFTAG_PLANARCONFIG,\t 1, 1,\tTIFF_SHORT,\tFIELD_PLANARCONFIG,\n      0,\t0,\t\"PlanarConfiguration\" },\n    { TIFFTAG_PAGENAME,\t\t-1,-1,\tTIFF_ASCII,\tFIELD_CUSTOM,\n      1,\t0,\t\"PageName\" },\n    { TIFFTAG_XPOSITION,\t 1, 1,\tTIFF_RATIONAL,\tFIELD_POSITION,\n      1,\t0,\t\"XPosition\" },\n    { TIFFTAG_YPOSITION,\t 1, 1,\tTIFF_RATIONAL,\tFIELD_POSITION,\n      1,\t0,\t\"YPosition\" },\n    { TIFFTAG_FREEOFFSETS,\t-1,-1,\tTIFF_LONG,\tFIELD_IGNORE,\n      0,\t0,\t\"FreeOffsets\" },\n    { TIFFTAG_FREEBYTECOUNTS,\t-1,-1,\tTIFF_LONG,\tFIELD_IGNORE,\n      0,\t0,\t\"FreeByteCounts\" },\n    { TIFFTAG_GRAYRESPONSEUNIT,\t 1, 1,\tTIFF_SHORT,\tFIELD_IGNORE,\n      1,\t0,\t\"GrayResponseUnit\" },\n    { TIFFTAG_GRAYRESPONSECURVE,-1,-1,\tTIFF_SHORT,\tFIELD_IGNORE,\n      1,\t0,\t\"GrayResponseCurve\" },\n    { TIFFTAG_RESOLUTIONUNIT,\t 1, 1,\tTIFF_SHORT,\tFIELD_RESOLUTIONUNIT,\n      1,\t0,\t\"ResolutionUnit\" },\n    { TIFFTAG_PAGENUMBER,\t 2, 2,\tTIFF_SHORT,\tFIELD_PAGENUMBER,\n      1,\t0,\t\"PageNumber\" },\n    { TIFFTAG_COLORRESPONSEUNIT, 1, 1,\tTIFF_SHORT,\tFIELD_IGNORE,\n      1,\t0,\t\"ColorResponseUnit\" },\n    { TIFFTAG_TRANSFERFUNCTION,\t-1,-1,\tTIFF_SHORT,\tFIELD_TRANSFERFUNCTION,\n      1,\t0,\t\"TransferFunction\" },\n    { TIFFTAG_SOFTWARE,\t\t-1,-1,\tTIFF_ASCII,\tFIELD_CUSTOM,\n      1,\t0,\t\"Software\" },\n    { TIFFTAG_DATETIME,\t\t20,20,\tTIFF_ASCII,\tFIELD_CUSTOM,\n      1,\t0,\t\"DateTime\" },\n    { TIFFTAG_ARTIST,\t\t-1,-1,\tTIFF_ASCII,\tFIELD_CUSTOM,\n      1,\t0,\t\"Artist\" },\n    { TIFFTAG_HOSTCOMPUTER,\t-1,-1,\tTIFF_ASCII,\tFIELD_CUSTOM,\n      1,\t0,\t\"HostComputer\" },\n    { TIFFTAG_WHITEPOINT,\t 2, 2,\tTIFF_RATIONAL,\tFIELD_CUSTOM,\n      1,\t0,\t\"WhitePoint\" },\n    { TIFFTAG_PRIMARYCHROMATICITIES,6,6,TIFF_RATIONAL,\tFIELD_CUSTOM,\n      1,\t0,\t\"PrimaryChromaticities\" },\n    { TIFFTAG_COLORMAP,\t\t-1,-1,\tTIFF_SHORT,\tFIELD_COLORMAP,\n      1,\t0,\t\"ColorMap\" },\n    { TIFFTAG_HALFTONEHINTS,\t 2, 2,\tTIFF_SHORT,\tFIELD_HALFTONEHINTS,\n      1,\t0,\t\"HalftoneHints\" },\n    { TIFFTAG_TILEWIDTH,\t 1, 1,\tTIFF_LONG,\tFIELD_TILEDIMENSIONS,\n      0,\t0,\t\"TileWidth\" },\n    { TIFFTAG_TILEWIDTH,\t 1, 1,\tTIFF_SHORT,\tFIELD_TILEDIMENSIONS,\n      0,\t0,\t\"TileWidth\" },\n    { TIFFTAG_TILELENGTH,\t 1, 1,\tTIFF_LONG,\tFIELD_TILEDIMENSIONS,\n      0,\t0,\t\"TileLength\" },\n    { TIFFTAG_TILELENGTH,\t 1, 1,\tTIFF_SHORT,\tFIELD_TILEDIMENSIONS,\n      0,\t0,\t\"TileLength\" },\n    { TIFFTAG_TILEOFFSETS,\t-1, 1,\tTIFF_LONG,\tFIELD_STRIPOFFSETS,\n      0,\t0,\t\"TileOffsets\" },\n    { TIFFTAG_TILEBYTECOUNTS,\t-1, 1,\tTIFF_LONG,\tFIELD_STRIPBYTECOUNTS,\n      0,\t0,\t\"TileByteCounts\" },\n    { TIFFTAG_TILEBYTECOUNTS,\t-1, 1,\tTIFF_SHORT,\tFIELD_STRIPBYTECOUNTS,\n      0,\t0,\t\"TileByteCounts\" },\n    { TIFFTAG_SUBIFD,\t\t-1,-1,\tTIFF_IFD,\tFIELD_SUBIFD,\n      1,\t1,\t\"SubIFD\" },\n    { TIFFTAG_SUBIFD,\t\t-1,-1,\tTIFF_LONG,\tFIELD_SUBIFD,\n      1,\t1,\t\"SubIFD\" },\n    { TIFFTAG_INKSET,\t\t 1, 1,\tTIFF_SHORT,\tFIELD_CUSTOM,\n      0,\t0,\t\"InkSet\" },\n    { TIFFTAG_INKNAMES,\t\t-1,-1,\tTIFF_ASCII,\tFIELD_INKNAMES,\n      1,\t1,\t\"InkNames\" },\n    { TIFFTAG_NUMBEROFINKS,\t 1, 1,\tTIFF_SHORT,\tFIELD_CUSTOM,\n      1,\t0,\t\"NumberOfInks\" },\n    { TIFFTAG_DOTRANGE,\t\t 2, 2,\tTIFF_SHORT,\tFIELD_CUSTOM,\n      0,\t0,\t\"DotRange\" },\n    { TIFFTAG_DOTRANGE,\t\t 2, 2,\tTIFF_BYTE,\tFIELD_CUSTOM,\n      0,\t0,\t\"DotRange\" },\n    { TIFFTAG_TARGETPRINTER,\t-1,-1,\tTIFF_ASCII,\tFIELD_CUSTOM,\n      1,\t0,\t\"TargetPrinter\" },\n    { TIFFTAG_EXTRASAMPLES,\t-1,-1,\tTIFF_SHORT,\tFIELD_EXTRASAMPLES,\n      0,\t1,\t\"ExtraSamples\" },\n/* XXX for bogus Adobe Photoshop v2.5 files */\n    { TIFFTAG_EXTRASAMPLES,\t-1,-1,\tTIFF_BYTE,\tFIELD_EXTRASAMPLES,\n      0,\t1,\t\"ExtraSamples\" },\n    { TIFFTAG_SAMPLEFORMAT,\t-1,-1,\tTIFF_SHORT,\tFIELD_SAMPLEFORMAT,\n      0,\t0,\t\"SampleFormat\" },\n    { TIFFTAG_SMINSAMPLEVALUE,\t-2,-1,\tTIFF_ANY,\tFIELD_SMINSAMPLEVALUE,\n      1,\t0,\t\"SMinSampleValue\" },\n    { TIFFTAG_SMAXSAMPLEVALUE,\t-2,-1,\tTIFF_ANY,\tFIELD_SMAXSAMPLEVALUE,\n      1,\t0,\t\"SMaxSampleValue\" },\n    { TIFFTAG_CLIPPATH,\t\t-1, -3, TIFF_BYTE,\tFIELD_CUSTOM,\n      0,\t1,\t\"ClipPath\" },\n    { TIFFTAG_XCLIPPATHUNITS,\t 1, 1,\tTIFF_SLONG,\tFIELD_CUSTOM,\n      0,\t0,\t\"XClipPathUnits\" },\n    { TIFFTAG_XCLIPPATHUNITS,\t 1, 1,\tTIFF_SSHORT,\tFIELD_CUSTOM,\n      0,\t0,\t\"XClipPathUnits\" },\n    { TIFFTAG_XCLIPPATHUNITS,\t 1, 1,\tTIFF_SBYTE,\tFIELD_CUSTOM,\n      0,\t0,\t\"XClipPathUnits\" },\n    { TIFFTAG_YCLIPPATHUNITS,\t 1, 1,\tTIFF_SLONG,\tFIELD_CUSTOM,\n      0,\t0,\t\"YClipPathUnits\" },\n    { TIFFTAG_YCLIPPATHUNITS,\t 1, 1,\tTIFF_SSHORT,\tFIELD_CUSTOM,\n      0,\t0,\t\"YClipPathUnits\" },\n    { TIFFTAG_YCLIPPATHUNITS,\t 1, 1,\tTIFF_SBYTE,\tFIELD_CUSTOM,\n      0,\t0,\t\"YClipPathUnits\" },\n    { TIFFTAG_YCBCRCOEFFICIENTS, 3, 3,\tTIFF_RATIONAL,\tFIELD_CUSTOM,\n      0,\t0,\t\"YCbCrCoefficients\" },\n    { TIFFTAG_YCBCRSUBSAMPLING,\t 2, 2,\tTIFF_SHORT,\tFIELD_YCBCRSUBSAMPLING,\n      0,\t0,\t\"YCbCrSubsampling\" },\n    { TIFFTAG_YCBCRPOSITIONING,\t 1, 1,\tTIFF_SHORT,\tFIELD_YCBCRPOSITIONING,\n      0,\t0,\t\"YCbCrPositioning\" },\n    { TIFFTAG_REFERENCEBLACKWHITE, 6, 6, TIFF_RATIONAL,\tFIELD_CUSTOM,\n      1,\t0,\t\"ReferenceBlackWhite\" },\n/* XXX temporarily accept LONG for backwards compatibility */\n    { TIFFTAG_REFERENCEBLACKWHITE, 6, 6, TIFF_LONG,\tFIELD_CUSTOM,\n      1,\t0,\t\"ReferenceBlackWhite\" },\n    { TIFFTAG_XMLPACKET,\t-3,-3,\tTIFF_BYTE,\tFIELD_CUSTOM,\n      0,\t1,\t\"XMLPacket\" },\n/* begin SGI tags */\n    { TIFFTAG_MATTEING,\t\t 1, 1,\tTIFF_SHORT,\tFIELD_EXTRASAMPLES,\n      0,\t0,\t\"Matteing\" },\n    { TIFFTAG_DATATYPE,\t\t-2,-1,\tTIFF_SHORT,\tFIELD_SAMPLEFORMAT,\n      0,\t0,\t\"DataType\" },\n    { TIFFTAG_IMAGEDEPTH,\t 1, 1,\tTIFF_LONG,\tFIELD_IMAGEDEPTH,\n      0,\t0,\t\"ImageDepth\" },\n    { TIFFTAG_IMAGEDEPTH,\t 1, 1,\tTIFF_SHORT,\tFIELD_IMAGEDEPTH,\n      0,\t0,\t\"ImageDepth\" },\n    { TIFFTAG_TILEDEPTH,\t 1, 1,\tTIFF_LONG,\tFIELD_TILEDEPTH,\n      0,\t0,\t\"TileDepth\" },\n    { TIFFTAG_TILEDEPTH,\t 1, 1,\tTIFF_SHORT,\tFIELD_TILEDEPTH,\n      0,\t0,\t\"TileDepth\" },\n/* end SGI tags */\n/* begin Pixar tags */\n    { TIFFTAG_PIXAR_IMAGEFULLWIDTH,  1, 1, TIFF_LONG,\tFIELD_CUSTOM,\n      1,\t0,\t\"ImageFullWidth\" },\n    { TIFFTAG_PIXAR_IMAGEFULLLENGTH, 1, 1, TIFF_LONG,\tFIELD_CUSTOM,\n      1,\t0,\t\"ImageFullLength\" },\n    { TIFFTAG_PIXAR_TEXTUREFORMAT,  -1, -1, TIFF_ASCII,\tFIELD_CUSTOM,\n      1,\t0,\t\"TextureFormat\" },\n    { TIFFTAG_PIXAR_WRAPMODES,\t    -1, -1, TIFF_ASCII,\tFIELD_CUSTOM,\n      1,\t0,\t\"TextureWrapModes\" },\n    { TIFFTAG_PIXAR_FOVCOT,\t     1, 1, TIFF_FLOAT,\tFIELD_CUSTOM,\n      1,\t0,\t\"FieldOfViewCotangent\" },\n    { TIFFTAG_PIXAR_MATRIX_WORLDTOSCREEN,\t16,16,\tTIFF_FLOAT,\n      FIELD_CUSTOM,\t1,\t0,\t\"MatrixWorldToScreen\" },\n    { TIFFTAG_PIXAR_MATRIX_WORLDTOCAMERA,\t16,16,\tTIFF_FLOAT,\n       FIELD_CUSTOM,\t1,\t0,\t\"MatrixWorldToCamera\" },\n    { TIFFTAG_COPYRIGHT,\t-1, -1,\tTIFF_ASCII,\tFIELD_CUSTOM,\n      1,\t0,\t\"Copyright\" },\n/* end Pixar tags */\n    { TIFFTAG_RICHTIFFIPTC, -3, -3,\tTIFF_LONG,\tFIELD_CUSTOM, \n      0,    1,   \"RichTIFFIPTC\" },\n    { TIFFTAG_PHOTOSHOP,    -3, -3,\tTIFF_BYTE,\tFIELD_CUSTOM, \n      0,    1,   \"Photoshop\" },\n    { TIFFTAG_EXIFIFD,\t\t1, 1,\tTIFF_LONG,\tFIELD_CUSTOM,\n      0,\t0,\t\"EXIFIFDOffset\" },\n    { TIFFTAG_ICCPROFILE,\t-3, -3,\tTIFF_UNDEFINED,\tFIELD_CUSTOM,\n      0,\t1,\t\"ICC Profile\" },\n    { TIFFTAG_GPSIFD,\t\t1, 1,\tTIFF_LONG,\tFIELD_CUSTOM,\n      0,\t0,\t\"GPSIFDOffset\" },\n    { TIFFTAG_STONITS,\t\t 1, 1,\tTIFF_DOUBLE,\tFIELD_CUSTOM,\n      0,\t0,\t\"StoNits\" },\n    { TIFFTAG_INTEROPERABILITYIFD, 1, 1, TIFF_LONG,\tFIELD_CUSTOM,\n      0,\t0,\t\"InteroperabilityIFDOffset\" },\n/* begin DNG tags */\n    { TIFFTAG_DNGVERSION,\t4, 4,\tTIFF_BYTE,\tFIELD_CUSTOM, \n      0,\t0,\t\"DNGVersion\" },\n    { TIFFTAG_DNGBACKWARDVERSION, 4, 4,\tTIFF_BYTE,\tFIELD_CUSTOM, \n      0,\t0,\t\"DNGBackwardVersion\" },\n    { TIFFTAG_UNIQUECAMERAMODEL,    -1, -1, TIFF_ASCII,\tFIELD_CUSTOM,\n      1,\t0,\t\"UniqueCameraModel\" },\n    { TIFFTAG_LOCALIZEDCAMERAMODEL, -1, -1, TIFF_ASCII,\tFIELD_CUSTOM,\n      1,\t0,\t\"LocalizedCameraModel\" },\n    { TIFFTAG_LOCALIZEDCAMERAMODEL, -1, -1, TIFF_BYTE,\tFIELD_CUSTOM,\n      1,\t1,\t\"LocalizedCameraModel\" },\n    { TIFFTAG_CFAPLANECOLOR,\t-1, -1,\tTIFF_BYTE,\tFIELD_CUSTOM, \n      0,\t1,\t\"CFAPlaneColor\" },\n    { TIFFTAG_CFALAYOUT,\t1, 1,\tTIFF_SHORT,\tFIELD_CUSTOM, \n      0,\t0,\t\"CFALayout\" },\n    { TIFFTAG_LINEARIZATIONTABLE, -1, -1, TIFF_SHORT,\tFIELD_CUSTOM, \n      0,\t1,\t\"LinearizationTable\" },\n    { TIFFTAG_BLACKLEVELREPEATDIM, 2, 2, TIFF_SHORT,\tFIELD_CUSTOM, \n      0,\t0,\t\"BlackLevelRepeatDim\" },\n    { TIFFTAG_BLACKLEVEL,\t-1, -1,\tTIFF_LONG,\tFIELD_CUSTOM, \n      0,\t1,\t\"BlackLevel\" },\n    { TIFFTAG_BLACKLEVEL,\t-1, -1,\tTIFF_SHORT,\tFIELD_CUSTOM, \n      0,\t1,\t\"BlackLevel\" },\n    { TIFFTAG_BLACKLEVEL,\t-1, -1,\tTIFF_RATIONAL,\tFIELD_CUSTOM, \n      0,\t1,\t\"BlackLevel\" },\n    { TIFFTAG_BLACKLEVELDELTAH,\t-1, -1,\tTIFF_SRATIONAL,\tFIELD_CUSTOM, \n      0,\t1,\t\"BlackLevelDeltaH\" },\n    { TIFFTAG_BLACKLEVELDELTAV,\t-1, -1,\tTIFF_SRATIONAL,\tFIELD_CUSTOM, \n      0,\t1,\t\"BlackLevelDeltaV\" },\n    { TIFFTAG_WHITELEVEL,\t-2, -2,\tTIFF_LONG,\tFIELD_CUSTOM, \n      0,\t0,\t\"WhiteLevel\" },\n    { TIFFTAG_WHITELEVEL,\t-2, -2,\tTIFF_SHORT,\tFIELD_CUSTOM, \n      0,\t0,\t\"WhiteLevel\" },\n    { TIFFTAG_DEFAULTSCALE,\t2, 2,\tTIFF_RATIONAL,\tFIELD_CUSTOM, \n      0,\t0,\t\"DefaultScale\" },\n    { TIFFTAG_BESTQUALITYSCALE,\t1, 1,\tTIFF_RATIONAL,\tFIELD_CUSTOM, \n      0,\t0,\t\"BestQualityScale\" },\n    { TIFFTAG_DEFAULTCROPORIGIN,\t2, 2,\tTIFF_LONG,\tFIELD_CUSTOM, \n      0,\t0,\t\"DefaultCropOrigin\" },\n    { TIFFTAG_DEFAULTCROPORIGIN,\t2, 2,\tTIFF_SHORT,\tFIELD_CUSTOM, \n      0,\t0,\t\"DefaultCropOrigin\" },\n    { TIFFTAG_DEFAULTCROPORIGIN,\t2, 2,\tTIFF_RATIONAL,\tFIELD_CUSTOM, \n      0,\t0,\t\"DefaultCropOrigin\" },\n    { TIFFTAG_DEFAULTCROPSIZE,\t2, 2,\tTIFF_LONG,\tFIELD_CUSTOM, \n      0,\t0,\t\"DefaultCropSize\" },\n    { TIFFTAG_DEFAULTCROPSIZE,\t2, 2,\tTIFF_SHORT,\tFIELD_CUSTOM, \n      0,\t0,\t\"DefaultCropSize\" },\n    { TIFFTAG_DEFAULTCROPSIZE,\t2, 2,\tTIFF_RATIONAL,\tFIELD_CUSTOM, \n      0,\t0,\t\"DefaultCropSize\" },\n    { TIFFTAG_COLORMATRIX1,\t-1, -1,\tTIFF_SRATIONAL,\tFIELD_CUSTOM, \n      0,\t1,\t\"ColorMatrix1\" },\n    { TIFFTAG_COLORMATRIX2,\t-1, -1,\tTIFF_SRATIONAL,\tFIELD_CUSTOM, \n      0,\t1,\t\"ColorMatrix2\" },\n    { TIFFTAG_CAMERACALIBRATION1,\t-1, -1,\tTIFF_SRATIONAL,\tFIELD_CUSTOM, \n      0,\t1,\t\"CameraCalibration1\" },\n    { TIFFTAG_CAMERACALIBRATION2,\t-1, -1,\tTIFF_SRATIONAL,\tFIELD_CUSTOM, \n      0,\t1,\t\"CameraCalibration2\" },\n    { TIFFTAG_REDUCTIONMATRIX1,\t-1, -1,\tTIFF_SRATIONAL,\tFIELD_CUSTOM, \n      0,\t1,\t\"ReductionMatrix1\" },\n    { TIFFTAG_REDUCTIONMATRIX2,\t-1, -1,\tTIFF_SRATIONAL,\tFIELD_CUSTOM, \n      0,\t1,\t\"ReductionMatrix2\" },\n    { TIFFTAG_ANALOGBALANCE,\t-1, -1,\tTIFF_RATIONAL,\tFIELD_CUSTOM, \n      0,\t1,\t\"AnalogBalance\" },\n    { TIFFTAG_ASSHOTNEUTRAL,\t-1, -1,\tTIFF_SHORT,\tFIELD_CUSTOM, \n      0,\t1,\t\"AsShotNeutral\" },\n    { TIFFTAG_ASSHOTNEUTRAL,\t-1, -1,\tTIFF_RATIONAL,\tFIELD_CUSTOM, \n      0,\t1,\t\"AsShotNeutral\" },\n    { TIFFTAG_ASSHOTWHITEXY,\t2, 2,\tTIFF_RATIONAL,\tFIELD_CUSTOM, \n      0,\t0,\t\"AsShotWhiteXY\" },\n    { TIFFTAG_BASELINEEXPOSURE,\t1, 1,\tTIFF_SRATIONAL,\tFIELD_CUSTOM, \n      0,\t0,\t\"BaselineExposure\" },\n    { TIFFTAG_BASELINENOISE,\t1, 1,\tTIFF_RATIONAL,\tFIELD_CUSTOM, \n      0,\t0,\t\"BaselineNoise\" },\n    { TIFFTAG_BASELINESHARPNESS,\t1, 1,\tTIFF_RATIONAL,\tFIELD_CUSTOM, \n      0,\t0,\t\"BaselineSharpness\" },\n    { TIFFTAG_BAYERGREENSPLIT,\t1, 1,\tTIFF_LONG,\tFIELD_CUSTOM, \n      0,\t0,\t\"BayerGreenSplit\" },\n    { TIFFTAG_LINEARRESPONSELIMIT,\t1, 1,\tTIFF_RATIONAL,\tFIELD_CUSTOM, \n      0,\t0,\t\"LinearResponseLimit\" },\n    { TIFFTAG_CAMERASERIALNUMBER,    -1, -1, TIFF_ASCII,\tFIELD_CUSTOM,\n      1,\t0,\t\"CameraSerialNumber\" },\n    { TIFFTAG_LENSINFO,\t4, 4,\tTIFF_RATIONAL,\tFIELD_CUSTOM, \n      0,\t0,\t\"LensInfo\" },\n    { TIFFTAG_CHROMABLURRADIUS,\t1, 1,\tTIFF_RATIONAL,\tFIELD_CUSTOM, \n      0,\t0,\t\"ChromaBlurRadius\" },\n    { TIFFTAG_ANTIALIASSTRENGTH,\t1, 1,\tTIFF_RATIONAL,\tFIELD_CUSTOM, \n      0,\t0,\t\"AntiAliasStrength\" },\n    { TIFFTAG_SHADOWSCALE,\t1, 1,\tTIFF_RATIONAL,\tFIELD_CUSTOM, \n      0,\t0,\t\"ShadowScale\" },\n    { TIFFTAG_DNGPRIVATEDATA,    -1, -1, TIFF_BYTE,\tFIELD_CUSTOM,\n      0,\t1,\t\"DNGPrivateData\" },\n    { TIFFTAG_MAKERNOTESAFETY,\t1, 1,\tTIFF_SHORT,\tFIELD_CUSTOM, \n      0,\t0,\t\"MakerNoteSafety\" },\n    { TIFFTAG_CALIBRATIONILLUMINANT1,\t1, 1,\tTIFF_SHORT,\tFIELD_CUSTOM, \n      0,\t0,\t\"CalibrationIlluminant1\" },\n    { TIFFTAG_CALIBRATIONILLUMINANT2,\t1, 1,\tTIFF_SHORT,\tFIELD_CUSTOM, \n      0,\t0,\t\"CalibrationIlluminant2\" },\n    { TIFFTAG_RAWDATAUNIQUEID,\t16, 16,\tTIFF_BYTE,\tFIELD_CUSTOM, \n      0,\t0,\t\"RawDataUniqueID\" },\n    { TIFFTAG_ORIGINALRAWFILENAME,    -1, -1, TIFF_ASCII,\tFIELD_CUSTOM,\n      1,\t0,\t\"OriginalRawFileName\" },\n    { TIFFTAG_ORIGINALRAWFILENAME,    -1, -1, TIFF_BYTE,\tFIELD_CUSTOM,\n      1,\t1,\t\"OriginalRawFileName\" },\n    { TIFFTAG_ORIGINALRAWFILEDATA,    -1, -1, TIFF_UNDEFINED,\tFIELD_CUSTOM,\n      0,\t1,\t\"OriginalRawFileData\" },\n    { TIFFTAG_ACTIVEAREA,\t4, 4,\tTIFF_LONG,\tFIELD_CUSTOM, \n      0,\t0,\t\"ActiveArea\" },\n    { TIFFTAG_ACTIVEAREA,\t4, 4,\tTIFF_SHORT,\tFIELD_CUSTOM, \n      0,\t0,\t\"ActiveArea\" },\n    { TIFFTAG_MASKEDAREAS,\t-1, -1,\tTIFF_LONG,\tFIELD_CUSTOM, \n      0,\t1,\t\"MaskedAreas\" },\n    { TIFFTAG_ASSHOTICCPROFILE,    -1, -1, TIFF_UNDEFINED,\tFIELD_CUSTOM,\n      0,\t1,\t\"AsShotICCProfile\" },\n    { TIFFTAG_ASSHOTPREPROFILEMATRIX,\t-1, -1,\tTIFF_SRATIONAL,\tFIELD_CUSTOM, \n      0,\t1,\t\"AsShotPreProfileMatrix\" },\n    { TIFFTAG_CURRENTICCPROFILE,    -1, -1, TIFF_UNDEFINED,\tFIELD_CUSTOM,\n      0,\t1,\t\"CurrentICCProfile\" },\n    { TIFFTAG_CURRENTPREPROFILEMATRIX,\t-1, -1,\tTIFF_SRATIONAL,\tFIELD_CUSTOM, \n      0,\t1,\t\"CurrentPreProfileMatrix\" },\n/* end DNG tags */\n};\n\nstatic const TIFFFieldInfo\nexifFieldInfo[] = {\n    { EXIFTAG_EXPOSURETIME,\t1, 1,\t\tTIFF_RATIONAL,\tFIELD_CUSTOM, \n      1,\t0,\t\"ExposureTime\" },\n    { EXIFTAG_FNUMBER,\t\t1, 1,\t\tTIFF_RATIONAL,\tFIELD_CUSTOM, \n      1,\t0,\t\"FNumber\" },\n    { EXIFTAG_EXPOSUREPROGRAM,\t1, 1,\t\tTIFF_SHORT,\tFIELD_CUSTOM,\n      1,\t0,\t\"ExposureProgram\" },\n    { EXIFTAG_SPECTRALSENSITIVITY,    -1, -1,\tTIFF_ASCII,\tFIELD_CUSTOM,\n      1,\t0,\t\"SpectralSensitivity\" },\n    { EXIFTAG_ISOSPEEDRATINGS,  -1, -1,\t\tTIFF_SHORT,\tFIELD_CUSTOM,\n      1,\t1,\t\"ISOSpeedRatings\" },\n    { EXIFTAG_OECF,\t-1, -1,\t\t\tTIFF_UNDEFINED,\tFIELD_CUSTOM,\n      1,\t1,\t\"OptoelectricConversionFactor\" },\n    { EXIFTAG_EXIFVERSION,\t4, 4,\t\tTIFF_UNDEFINED,\tFIELD_CUSTOM,\n      1,\t0,\t\"ExifVersion\" },\n    { EXIFTAG_DATETIMEORIGINAL,\t20, 20,\t\tTIFF_ASCII,\tFIELD_CUSTOM,\n      1,\t0,\t\"DateTimeOriginal\" },\n    { EXIFTAG_DATETIMEDIGITIZED, 20, 20,\tTIFF_ASCII,\tFIELD_CUSTOM,\n      1,\t0,\t\"DateTimeDigitized\" },\n    { EXIFTAG_COMPONENTSCONFIGURATION,\t 4, 4,\tTIFF_UNDEFINED,\tFIELD_CUSTOM,\n      1,\t0,\t\"ComponentsConfiguration\" },\n    { EXIFTAG_COMPRESSEDBITSPERPIXEL,\t 1, 1,\tTIFF_RATIONAL,\tFIELD_CUSTOM,\n      1,\t0,\t\"CompressedBitsPerPixel\" },\n    { EXIFTAG_SHUTTERSPEEDVALUE,\t1, 1,\tTIFF_SRATIONAL,\tFIELD_CUSTOM, \n      1,\t0,\t\"ShutterSpeedValue\" },\n    { EXIFTAG_APERTUREVALUE,\t1, 1,\t\tTIFF_RATIONAL,\tFIELD_CUSTOM, \n      1,\t0,\t\"ApertureValue\" },\n    { EXIFTAG_BRIGHTNESSVALUE,\t1, 1,\t\tTIFF_SRATIONAL,\tFIELD_CUSTOM, \n      1,\t0,\t\"BrightnessValue\" },\n    { EXIFTAG_EXPOSUREBIASVALUE,\t1, 1,\tTIFF_SRATIONAL,\tFIELD_CUSTOM, \n      1,\t0,\t\"ExposureBiasValue\" },\n    { EXIFTAG_MAXAPERTUREVALUE,\t1, 1,\t\tTIFF_RATIONAL,\tFIELD_CUSTOM, \n      1,\t0,\t\"MaxApertureValue\" },\n    { EXIFTAG_SUBJECTDISTANCE,\t1, 1,\t\tTIFF_RATIONAL,\tFIELD_CUSTOM, \n      1,\t0,\t\"SubjectDistance\" },\n    { EXIFTAG_METERINGMODE,\t1, 1,\t\tTIFF_SHORT,\tFIELD_CUSTOM,\n      1,\t0,\t\"MeteringMode\" },\n    { EXIFTAG_LIGHTSOURCE,\t1, 1,\t\tTIFF_SHORT,\tFIELD_CUSTOM,\n      1,\t0,\t\"LightSource\" },\n    { EXIFTAG_FLASH,\t1, 1,\t\t\tTIFF_SHORT,\tFIELD_CUSTOM,\n      1,\t0,\t\"Flash\" },\n    { EXIFTAG_FOCALLENGTH,\t1, 1,\t\tTIFF_RATIONAL,\tFIELD_CUSTOM, \n      1,\t0,\t\"FocalLength\" },\n    { EXIFTAG_SUBJECTAREA,\t-1, -1,\t\tTIFF_SHORT,\tFIELD_CUSTOM,\n      1,\t1,\t\"SubjectArea\" },\n    { EXIFTAG_MAKERNOTE,\t-1, -1,\t\tTIFF_UNDEFINED,\tFIELD_CUSTOM,\n      1,\t1,\t\"MakerNote\" },\n    { EXIFTAG_USERCOMMENT,\t-1, -1,\t\tTIFF_UNDEFINED,\tFIELD_CUSTOM,\n      1,\t1,\t\"UserComment\" },\n    { EXIFTAG_SUBSECTIME,    -1, -1,\t\tTIFF_ASCII,\tFIELD_CUSTOM,\n      1,\t0,\t\"SubSecTime\" },\n    { EXIFTAG_SUBSECTIMEORIGINAL, -1, -1,\tTIFF_ASCII,\tFIELD_CUSTOM,\n      1,\t0,\t\"SubSecTimeOriginal\" },\n    { EXIFTAG_SUBSECTIMEDIGITIZED,-1, -1,\tTIFF_ASCII,\tFIELD_CUSTOM,\n      1,\t0,\t\"SubSecTimeDigitized\" },\n    { EXIFTAG_FLASHPIXVERSION,\t4, 4,\t\tTIFF_UNDEFINED,\tFIELD_CUSTOM,\n      1,\t0,\t\"FlashpixVersion\" },\n    { EXIFTAG_COLORSPACE,\t1, 1,\t\tTIFF_SHORT,\tFIELD_CUSTOM,\n      1,\t0,\t\"ColorSpace\" },\n    { EXIFTAG_PIXELXDIMENSION,\t1, 1,\t\tTIFF_LONG,\tFIELD_CUSTOM,\n      1,\t0,\t\"PixelXDimension\" },\n    { EXIFTAG_PIXELXDIMENSION,\t1, 1,\t\tTIFF_SHORT,\tFIELD_CUSTOM,\n      1,\t0,\t\"PixelXDimension\" },\n    { EXIFTAG_PIXELYDIMENSION,\t1, 1,\t\tTIFF_LONG,\tFIELD_CUSTOM,\n      1,\t0,\t\"PixelYDimension\" },\n    { EXIFTAG_PIXELYDIMENSION,\t1, 1,\t\tTIFF_SHORT,\tFIELD_CUSTOM,\n      1,\t0,\t\"PixelYDimension\" },\n    { EXIFTAG_RELATEDSOUNDFILE,\t13, 13,\t\tTIFF_ASCII,\tFIELD_CUSTOM,\n      1,\t0,\t\"RelatedSoundFile\" },\n    { EXIFTAG_FLASHENERGY,\t1, 1,\t\tTIFF_RATIONAL,\tFIELD_CUSTOM, \n      1,\t0,\t\"FlashEnergy\" },\n    { EXIFTAG_SPATIALFREQUENCYRESPONSE,\t-1, -1,\tTIFF_UNDEFINED,\tFIELD_CUSTOM,\n      1,\t1,\t\"SpatialFrequencyResponse\" },\n    { EXIFTAG_FOCALPLANEXRESOLUTION,\t1, 1,\tTIFF_RATIONAL,\tFIELD_CUSTOM, \n      1,\t0,\t\"FocalPlaneXResolution\" },\n    { EXIFTAG_FOCALPLANEYRESOLUTION,\t1, 1,\tTIFF_RATIONAL,\tFIELD_CUSTOM, \n      1,\t0,\t\"FocalPlaneYResolution\" },\n    { EXIFTAG_FOCALPLANERESOLUTIONUNIT,\t1, 1,\tTIFF_SHORT,\tFIELD_CUSTOM,\n      1,\t0,\t\"FocalPlaneResolutionUnit\" },\n    { EXIFTAG_SUBJECTLOCATION,\t2, 2,\t\tTIFF_SHORT,\tFIELD_CUSTOM,\n      1,\t0,\t\"SubjectLocation\" },\n    { EXIFTAG_EXPOSUREINDEX,\t1, 1,\t\tTIFF_RATIONAL,\tFIELD_CUSTOM, \n      1,\t0,\t\"ExposureIndex\" },\n    { EXIFTAG_SENSINGMETHOD,\t1, 1,\t\tTIFF_SHORT,\tFIELD_CUSTOM,\n      1,\t0,\t\"SensingMethod\" },\n    { EXIFTAG_FILESOURCE,\t1, 1,\t\tTIFF_UNDEFINED,\tFIELD_CUSTOM,\n      1,\t0,\t\"FileSource\" },\n    { EXIFTAG_SCENETYPE,\t1, 1,\t\tTIFF_UNDEFINED,\tFIELD_CUSTOM,\n      1,\t0,\t\"SceneType\" },\n    { EXIFTAG_CFAPATTERN,\t-1, -1,\t\tTIFF_UNDEFINED,\tFIELD_CUSTOM,\n      1,\t1,\t\"CFAPattern\" },\n    { EXIFTAG_CUSTOMRENDERED,\t1, 1,\t\tTIFF_SHORT,\tFIELD_CUSTOM,\n      1,\t0,\t\"CustomRendered\" },\n    { EXIFTAG_EXPOSUREMODE,\t1, 1,\t\tTIFF_SHORT,\tFIELD_CUSTOM,\n      1,\t0,\t\"ExposureMode\" },\n    { EXIFTAG_WHITEBALANCE,\t1, 1,\t\tTIFF_SHORT,\tFIELD_CUSTOM,\n      1,\t0,\t\"WhiteBalance\" },\n    { EXIFTAG_DIGITALZOOMRATIO,\t1, 1,\t\tTIFF_RATIONAL,\tFIELD_CUSTOM, \n      1,\t0,\t\"DigitalZoomRatio\" },\n    { EXIFTAG_FOCALLENGTHIN35MMFILM, 1, 1,\tTIFF_SHORT,\tFIELD_CUSTOM,\n      1,\t0,\t\"FocalLengthIn35mmFilm\" },\n    { EXIFTAG_SCENECAPTURETYPE,\t1, 1,\t\tTIFF_SHORT,\tFIELD_CUSTOM,\n      1,\t0,\t\"SceneCaptureType\" },\n    { EXIFTAG_GAINCONTROL,\t1, 1,\t\tTIFF_RATIONAL,\tFIELD_CUSTOM, \n      1,\t0,\t\"GainControl\" },\n    { EXIFTAG_CONTRAST,\t\t1, 1,\t\tTIFF_SHORT,\tFIELD_CUSTOM,\n      1,\t0,\t\"Contrast\" },\n    { EXIFTAG_SATURATION,\t1, 1,\t\tTIFF_SHORT,\tFIELD_CUSTOM,\n      1,\t0,\t\"Saturation\" },\n    { EXIFTAG_SHARPNESS,\t1, 1,\t\tTIFF_SHORT,\tFIELD_CUSTOM,\n      1,\t0,\t\"Sharpness\" },\n    { EXIFTAG_DEVICESETTINGDESCRIPTION,\t-1, -1,\tTIFF_UNDEFINED,\tFIELD_CUSTOM,\n      1,\t1,\t\"DeviceSettingDescription\" },\n    { EXIFTAG_SUBJECTDISTANCERANGE, 1, 1,\tTIFF_SHORT,\tFIELD_CUSTOM,\n      1,\t0,\t\"SubjectDistanceRange\" },\n    { EXIFTAG_IMAGEUNIQUEID,\t33, 33,\t\tTIFF_ASCII,\tFIELD_CUSTOM,\n      1,\t0,\t\"ImageUniqueID\" }\n};\n\nconst TIFFFieldInfo *\n_TIFFGetFieldInfo(size_t *size)\n{\n\t*size = TIFFArrayCount(tiffFieldInfo);\n\treturn tiffFieldInfo;\n}\n\nconst TIFFFieldInfo *\n_TIFFGetExifFieldInfo(size_t *size)\n{\n\t*size = TIFFArrayCount(exifFieldInfo);\n\treturn exifFieldInfo;\n}\n\nvoid\n_TIFFSetupFieldInfo(TIFF* tif, const TIFFFieldInfo info[], size_t n)\n{\n\tif (tif->tif_fieldinfo) {\n\t\tsize_t  i;\n\n\t\tfor (i = 0; i < tif->tif_nfields; i++) \n\t\t{\n\t\t\tTIFFFieldInfo *fld = tif->tif_fieldinfo[i];\n\t\t\tif (fld->field_bit == FIELD_CUSTOM && \n\t\t\t\tstrncmp(\"Tag \", fld->field_name, 4) == 0) {\n\t\t\t\t\t_TIFFfree(fld->field_name);\n\t\t\t\t\t_TIFFfree(fld);\n\t\t\t\t}\n\t\t}   \n      \n\t\t_TIFFfree(tif->tif_fieldinfo);\n\t\ttif->tif_nfields = 0;\n\t}\n\tif (!_TIFFMergeFieldInfo(tif, info, n))\n\t{\n\t\tTIFFErrorExt(tif->tif_clientdata, \"_TIFFSetupFieldInfo\",\n\t\t\t     \"Setting up field info failed\");\n\t}\n}\n\nstatic int\ntagCompare(const void* a, const void* b)\n{\n\tconst TIFFFieldInfo* ta = *(const TIFFFieldInfo**) a;\n\tconst TIFFFieldInfo* tb = *(const TIFFFieldInfo**) b;\n\t/* NB: be careful of return values for 16-bit platforms */\n\tif (ta->field_tag != tb->field_tag)\n\t\treturn (int)ta->field_tag - (int)tb->field_tag;\n\telse\n\t\treturn (ta->field_type == TIFF_ANY) ?\n\t\t\t0 : ((int)tb->field_type - (int)ta->field_type);\n}\n\nstatic int\ntagNameCompare(const void* a, const void* b)\n{\n\tconst TIFFFieldInfo* ta = *(const TIFFFieldInfo**) a;\n\tconst TIFFFieldInfo* tb = *(const TIFFFieldInfo**) b;\n\tint ret = strcmp(ta->field_name, tb->field_name);\n\n\tif (ret)\n\t\treturn ret;\n\telse\n\t\treturn (ta->field_type == TIFF_ANY) ?\n\t\t\t0 : ((int)tb->field_type - (int)ta->field_type);\n}\n\nvoid\nTIFFMergeFieldInfo(TIFF* tif, const TIFFFieldInfo info[], int n)\n{\n\tif (_TIFFMergeFieldInfo(tif, info, n) < 0)\n\t{\n\t\tTIFFErrorExt(tif->tif_clientdata, \"TIFFMergeFieldInfo\",\n\t\t\t     \"Merging block of %d fields failed\", n);\n\t}\n}\n\nint\n_TIFFMergeFieldInfo(TIFF* tif, const TIFFFieldInfo info[], int n)\n{\n\tstatic const char module[] = \"_TIFFMergeFieldInfo\";\n\tstatic const char reason[] = \"for field info array\";\n\tTIFFFieldInfo** tp;\n\tint i;\n\n        tif->tif_foundfield = NULL;\n\n\tif (tif->tif_nfields > 0) {\n\t\ttif->tif_fieldinfo = (TIFFFieldInfo**)\n\t\t\t_TIFFCheckRealloc(tif, tif->tif_fieldinfo,\n\t\t\t\t\t  (tif->tif_nfields + n),\n\t\t\t\t\t  sizeof (TIFFFieldInfo*), reason);\n\t} else {\n\t\ttif->tif_fieldinfo = (TIFFFieldInfo**)\n\t\t\t_TIFFCheckMalloc(tif, n, sizeof (TIFFFieldInfo*),\n\t\t\t\t\t reason);\n\t}\n\tif (!tif->tif_fieldinfo) {\n\t\tTIFFErrorExt(tif->tif_clientdata, module,\n\t\t\t     \"Failed to allocate field info array\");\n\t\treturn 0;\n\t}\n\ttp = tif->tif_fieldinfo + tif->tif_nfields;\n\tfor (i = 0; i < n; i++)\n        {\n            const TIFFFieldInfo *fip =\n                _TIFFFindFieldInfo(tif, info[i].field_tag, info[i].field_type);\n\n            /* only add definitions that aren't already present */\n            if (!fip) {\n                *tp++ = (TIFFFieldInfo*) (info + i);\n                tif->tif_nfields++;\n            }\n        }\n\n        /* Sort the field info by tag number */\n        qsort(tif->tif_fieldinfo, tif->tif_nfields,\n\t      sizeof (TIFFFieldInfo*), tagCompare);\n\n\treturn n;\n}\n\nvoid\n_TIFFPrintFieldInfo(TIFF* tif, FILE* fd)\n{\n\tsize_t i;\n\n\tfprintf(fd, \"%s: \\n\", tif->tif_name);\n\tfor (i = 0; i < tif->tif_nfields; i++) {\n\t\tconst TIFFFieldInfo* fip = tif->tif_fieldinfo[i];\n\t\tfprintf(fd, \"field[%2d] %5lu, %2d, %2d, %d, %2d, %5s, %5s, %s\\n\"\n\t\t\t, (int)i\n\t\t\t, (unsigned long) fip->field_tag\n\t\t\t, fip->field_readcount, fip->field_writecount\n\t\t\t, fip->field_type\n\t\t\t, fip->field_bit\n\t\t\t, fip->field_oktochange ? \"TRUE\" : \"FALSE\"\n\t\t\t, fip->field_passcount ? \"TRUE\" : \"FALSE\"\n\t\t\t, fip->field_name\n\t\t);\n\t}\n}\n\n/*\n * Return size of TIFFDataType in bytes\n */\nint\nTIFFDataWidth(TIFFDataType type)\n{\n\tswitch(type)\n\t{\n\tcase 0:  /* nothing */\n\tcase 1:  /* TIFF_BYTE */\n\tcase 2:  /* TIFF_ASCII */\n\tcase 6:  /* TIFF_SBYTE */\n\tcase 7:  /* TIFF_UNDEFINED */\n\t\treturn 1;\n\tcase 3:  /* TIFF_SHORT */\n\tcase 8:  /* TIFF_SSHORT */\n\t\treturn 2;\n\tcase 4:  /* TIFF_LONG */\n\tcase 9:  /* TIFF_SLONG */\n\tcase 11: /* TIFF_FLOAT */\n        case 13: /* TIFF_IFD */\n\t\treturn 4;\n\tcase 5:  /* TIFF_RATIONAL */\n\tcase 10: /* TIFF_SRATIONAL */\n\tcase 12: /* TIFF_DOUBLE */\n\t\treturn 8;\n\tdefault:\n\t\treturn 0; /* will return 0 for unknown types */\n\t}\n}\n\n/*\n * Return size of TIFFDataType in bytes.\n *\n * XXX: We need a separate function to determine the space needed\n * to store the value. For TIFF_RATIONAL values TIFFDataWidth() returns 8,\n * but we use 4-byte float to represent rationals.\n */\nint\n_TIFFDataSize(TIFFDataType type)\n{\n\tswitch (type) {\n\t\tcase TIFF_BYTE:\n\t\tcase TIFF_SBYTE:\n\t\tcase TIFF_ASCII:\n\t\tcase TIFF_UNDEFINED:\n\t\t    return 1;\n\t\tcase TIFF_SHORT:\n\t\tcase TIFF_SSHORT:\n\t\t    return 2;\n\t\tcase TIFF_LONG:\n\t\tcase TIFF_SLONG:\n\t\tcase TIFF_FLOAT:\n\t\tcase TIFF_IFD:\n\t\tcase TIFF_RATIONAL:\n\t\tcase TIFF_SRATIONAL:\n\t\t    return 4;\n\t\tcase TIFF_DOUBLE:\n\t\t    return 8;\n\t\tdefault:\n\t\t    return 0;\n\t}\n}\n\n/*\n * Return nearest TIFFDataType to the sample type of an image.\n */\nTIFFDataType\n_TIFFSampleToTagType(TIFF* tif)\n{\n\tuint32 bps = TIFFhowmany8(tif->tif_dir.td_bitspersample);\n\n\tswitch (tif->tif_dir.td_sampleformat) {\n\tcase SAMPLEFORMAT_IEEEFP:\n\t\treturn (bps == 4 ? TIFF_FLOAT : TIFF_DOUBLE);\n\tcase SAMPLEFORMAT_INT:\n\t\treturn (bps <= 1 ? TIFF_SBYTE :\n\t\t    bps <= 2 ? TIFF_SSHORT : TIFF_SLONG);\n\tcase SAMPLEFORMAT_UINT:\n\t\treturn (bps <= 1 ? TIFF_BYTE :\n\t\t    bps <= 2 ? TIFF_SHORT : TIFF_LONG);\n\tcase SAMPLEFORMAT_VOID:\n\t\treturn (TIFF_UNDEFINED);\n\t}\n\t/*NOTREACHED*/\n\treturn (TIFF_UNDEFINED);\n}\n\nconst TIFFFieldInfo*\n_TIFFFindFieldInfo(TIFF* tif, ttag_t tag, TIFFDataType dt)\n{\n        TIFFFieldInfo key = {0, 0, 0, TIFF_NOTYPE, 0, 0, 0, 0};\n\tTIFFFieldInfo* pkey = &key;\n\tconst TIFFFieldInfo **ret;\n\n\tif (tif->tif_foundfield && tif->tif_foundfield->field_tag == tag &&\n\t    (dt == TIFF_ANY || dt == tif->tif_foundfield->field_type))\n\t\treturn tif->tif_foundfield;\n\n\t/* If we are invoked with no field information, then just return. */\n\tif ( !tif->tif_fieldinfo ) {\n\t\treturn NULL;\n\t}\n\n\t/* NB: use sorted search (e.g. binary search) */\n\tkey.field_tag = tag;\n        key.field_type = dt;\n\n\tret = (const TIFFFieldInfo **) bsearch(&pkey,\n\t\t\t\t\t       tif->tif_fieldinfo, \n\t\t\t\t\t       tif->tif_nfields,\n\t\t\t\t\t       sizeof(TIFFFieldInfo *), \n\t\t\t\t\t       tagCompare);\n\treturn tif->tif_foundfield = (ret ? *ret : NULL);\n}\n\nconst TIFFFieldInfo*\n_TIFFFindFieldInfoByName(TIFF* tif, const char *field_name, TIFFDataType dt)\n{\n        TIFFFieldInfo key = {0, 0, 0, TIFF_NOTYPE, 0, 0, 0, 0};\n\tTIFFFieldInfo* pkey = &key;\n\tconst TIFFFieldInfo **ret;\n\n\tif (tif->tif_foundfield\n\t    && streq(tif->tif_foundfield->field_name, field_name)\n\t    && (dt == TIFF_ANY || dt == tif->tif_foundfield->field_type))\n\t\treturn (tif->tif_foundfield);\n\n\t/* If we are invoked with no field information, then just return. */\n\tif ( !tif->tif_fieldinfo ) {\n\t\treturn NULL;\n\t}\n\n\t/* NB: use sorted search (e.g. binary search) */\n        key.field_name = (char *)field_name;\n        key.field_type = dt;\n\n        ret = (const TIFFFieldInfo **) lfind(&pkey,\n\t\t\t\t\t     tif->tif_fieldinfo, \n\t\t\t\t\t     &tif->tif_nfields,\n\t\t\t\t\t     sizeof(TIFFFieldInfo *),\n\t\t\t\t\t     tagNameCompare);\n\treturn tif->tif_foundfield = (ret ? *ret : NULL);\n}\n\nconst TIFFFieldInfo*\n_TIFFFieldWithTag(TIFF* tif, ttag_t tag)\n{\n\tconst TIFFFieldInfo* fip = _TIFFFindFieldInfo(tif, tag, TIFF_ANY);\n\tif (!fip) {\n\t\tTIFFErrorExt(tif->tif_clientdata, \"TIFFFieldWithTag\",\n\t\t\t     \"Internal error, unknown tag 0x%x\",\n\t\t\t     (unsigned int) tag);\n\t\tassert(fip != NULL);\n\t\t/*NOTREACHED*/\n\t}\n\treturn (fip);\n}\n\nconst TIFFFieldInfo*\n_TIFFFieldWithName(TIFF* tif, const char *field_name)\n{\n\tconst TIFFFieldInfo* fip =\n\t\t_TIFFFindFieldInfoByName(tif, field_name, TIFF_ANY);\n\tif (!fip) {\n\t\tTIFFErrorExt(tif->tif_clientdata, \"TIFFFieldWithName\",\n\t\t\t     \"Internal error, unknown tag %s\", field_name);\n\t\tassert(fip != NULL);\n\t\t/*NOTREACHED*/\n\t}\n\treturn (fip);\n}\n\nconst TIFFFieldInfo*\n_TIFFFindOrRegisterFieldInfo( TIFF *tif, ttag_t tag, TIFFDataType dt )\n\n{\n    const TIFFFieldInfo *fld;\n\n    fld = _TIFFFindFieldInfo( tif, tag, dt );\n    if( fld == NULL )\n    {\n        fld = _TIFFCreateAnonFieldInfo( tif, tag, dt );\n        if (!_TIFFMergeFieldInfo(tif, fld, 1))\n\t\treturn NULL;\n    }\n\n    return fld;\n}\n\nTIFFFieldInfo*\n_TIFFCreateAnonFieldInfo(TIFF *tif, ttag_t tag, TIFFDataType field_type)\n{\n\tTIFFFieldInfo *fld;\n\t(void) tif;\n\n\tfld = (TIFFFieldInfo *) _TIFFmalloc(sizeof (TIFFFieldInfo));\n\tif (fld == NULL)\n\t    return NULL;\n\t_TIFFmemset( fld, 0, sizeof(TIFFFieldInfo) );\n\n\tfld->field_tag = tag;\n\tfld->field_readcount = TIFF_VARIABLE2;\n\tfld->field_writecount = TIFF_VARIABLE2;\n\tfld->field_type = field_type;\n\tfld->field_bit = FIELD_CUSTOM;\n\tfld->field_oktochange = TRUE;\n\tfld->field_passcount = TRUE;\n\tfld->field_name = (char *) _TIFFmalloc(32);\n\tif (fld->field_name == NULL) {\n\t    _TIFFfree(fld);\n\t    return NULL;\n\t}\n\n\t/* \n\t * note that this name is a special sign to TIFFClose() and\n\t * _TIFFSetupFieldInfo() to free the field\n\t */\n\tsprintf(fld->field_name, \"Tag %d\", (int) tag);\n\n\treturn fld;    \n}\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/tif_dirread.c",
    "content": "/* $Id: tif_dirread.c,v 1.92.2.6 2009-10-29 20:04:32 bfriesen Exp $ */\n\n/*\n * Copyright (c) 1988-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n/*\n * TIFF Library.\n *\n * Directory Read Support Routines.\n */\n#include \"tiffiop.h\"\n\n#define\tIGNORE\t0\t\t/* tag placeholder used below */\n\n#ifdef HAVE_IEEEFP\n# define\tTIFFCvtIEEEFloatToNative(tif, n, fp)\n# define\tTIFFCvtIEEEDoubleToNative(tif, n, dp)\n#else\nextern\tvoid TIFFCvtIEEEFloatToNative(TIFF*, uint32, float*);\nextern\tvoid TIFFCvtIEEEDoubleToNative(TIFF*, uint32, double*);\n#endif\n\nstatic  TIFFDirEntry* TIFFReadDirectoryFind(TIFFDirEntry* dir,\n\t\t\t\t\t    uint16 dircount, uint16 tagid);\nstatic\tint EstimateStripByteCounts(TIFF*, TIFFDirEntry*, uint16);\nstatic\tvoid MissingRequired(TIFF*, const char*);\nstatic\tint TIFFCheckDirOffset(TIFF*, toff_t);\nstatic\tint CheckDirCount(TIFF*, TIFFDirEntry*, uint32);\nstatic\tuint16 TIFFFetchDirectory(TIFF*, toff_t, TIFFDirEntry**, toff_t *);\nstatic\ttsize_t TIFFFetchData(TIFF*, TIFFDirEntry*, char*);\nstatic\ttsize_t TIFFFetchString(TIFF*, TIFFDirEntry*, char*);\nstatic\tfloat TIFFFetchRational(TIFF*, TIFFDirEntry*);\nstatic\tint TIFFFetchNormalTag(TIFF*, TIFFDirEntry*);\nstatic\tint TIFFFetchPerSampleShorts(TIFF*, TIFFDirEntry*, uint16*);\nstatic\tint TIFFFetchPerSampleLongs(TIFF*, TIFFDirEntry*, uint32*);\nstatic\tint TIFFFetchPerSampleAnys(TIFF*, TIFFDirEntry*, double*);\nstatic\tint TIFFFetchShortArray(TIFF*, TIFFDirEntry*, uint16*);\nstatic\tint TIFFFetchStripThing(TIFF*, TIFFDirEntry*, long, uint32**);\nstatic\tint TIFFFetchRefBlackWhite(TIFF*, TIFFDirEntry*);\nstatic\tint TIFFFetchSubjectDistance(TIFF*, TIFFDirEntry*);\nstatic\tfloat TIFFFetchFloat(TIFF*, TIFFDirEntry*);\nstatic\tint TIFFFetchFloatArray(TIFF*, TIFFDirEntry*, float*);\nstatic\tint TIFFFetchDoubleArray(TIFF*, TIFFDirEntry*, double*);\nstatic\tint TIFFFetchAnyArray(TIFF*, TIFFDirEntry*, double*);\nstatic\tint TIFFFetchShortPair(TIFF*, TIFFDirEntry*);\nstatic\tvoid ChopUpSingleUncompressedStrip(TIFF*);\n\n/*\n * Read the next TIFF directory from a file and convert it to the internal\n * format. We read directories sequentially.\n */\nint\nTIFFReadDirectory(TIFF* tif)\n{\n\tstatic const char module[] = \"TIFFReadDirectory\";\n\n\tint n;\n\tTIFFDirectory* td;\n\tTIFFDirEntry *dp, *dir = NULL;\n\tuint16 iv;\n\tuint32 v;\n\tconst TIFFFieldInfo* fip;\n\tsize_t fix;\n\tuint16 dircount;\n\tint diroutoforderwarning = 0, compressionknown = 0;\n\n\ttif->tif_diroff = tif->tif_nextdiroff;\n\t/*\n\t * Check whether we have the last offset or bad offset (IFD looping).\n\t */\n\tif (!TIFFCheckDirOffset(tif, tif->tif_nextdiroff))\n\t\treturn 0;\n\t/*\n\t * Cleanup any previous compression state.\n\t */\n\t(*tif->tif_cleanup)(tif);\n\ttif->tif_curdir++;\n\tdircount = TIFFFetchDirectory(tif, tif->tif_nextdiroff,\n\t\t\t\t      &dir, &tif->tif_nextdiroff);\n\tif (!dircount) {\n\t\tTIFFErrorExt(tif->tif_clientdata, module,\n\t\t\t     \"%s: Failed to read directory at offset %u\",\n\t\t\t     tif->tif_name, tif->tif_nextdiroff);\n\t\treturn 0;\n\t}\n\n\ttif->tif_flags &= ~TIFF_BEENWRITING;\t/* reset before new dir */\n\t/*\n\t * Setup default value and then make a pass over\n\t * the fields to check type and tag information,\n\t * and to extract info required to size data\n\t * structures.  A second pass is made afterwards\n\t * to read in everthing not taken in the first pass.\n\t */\n\ttd = &tif->tif_dir;\n\t/* free any old stuff and reinit */\n\tTIFFFreeDirectory(tif);\n\tTIFFDefaultDirectory(tif);\n\t/*\n\t * Electronic Arts writes gray-scale TIFF files\n\t * without a PlanarConfiguration directory entry.\n\t * Thus we setup a default value here, even though\n\t * the TIFF spec says there is no default value.\n\t */\n\tTIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);\n\n\t/*\n\t * Sigh, we must make a separate pass through the\n\t * directory for the following reason:\n\t *\n\t * We must process the Compression tag in the first pass\n\t * in order to merge in codec-private tag definitions (otherwise\n\t * we may get complaints about unknown tags).  However, the\n\t * Compression tag may be dependent on the SamplesPerPixel\n\t * tag value because older TIFF specs permited Compression\n\t * to be written as a SamplesPerPixel-count tag entry.\n\t * Thus if we don't first figure out the correct SamplesPerPixel\n\t * tag value then we may end up ignoring the Compression tag\n\t * value because it has an incorrect count value (if the\n\t * true value of SamplesPerPixel is not 1).\n\t *\n\t * It sure would have been nice if Aldus had really thought\n\t * this stuff through carefully.\n\t */\n\tfor (dp = dir, n = dircount; n > 0; n--, dp++) {\n\t\tif (tif->tif_flags & TIFF_SWAB) {\n\t\t\tTIFFSwabArrayOfShort(&dp->tdir_tag, 2);\n\t\t\tTIFFSwabArrayOfLong(&dp->tdir_count, 2);\n\t\t}\n\t\tif (dp->tdir_tag == TIFFTAG_SAMPLESPERPIXEL) {\n\t\t\tif (!TIFFFetchNormalTag(tif, dp))\n\t\t\t\tgoto bad;\n\t\t\tdp->tdir_tag = IGNORE;\n\t\t}\n\t}\n\t/*\n\t * First real pass over the directory.\n\t */\n\tfix = 0;\n\tfor (dp = dir, n = dircount; n > 0; n--, dp++) {\n\n\t\tif (fix >= tif->tif_nfields || dp->tdir_tag == IGNORE)\n\t\t\tcontinue;\n\n\t\t/*\n\t\t * Silicon Beach (at least) writes unordered\n\t\t * directory tags (violating the spec).  Handle\n\t\t * it here, but be obnoxious (maybe they'll fix it?).\n\t\t */\n\t\tif (dp->tdir_tag < tif->tif_fieldinfo[fix]->field_tag) {\n\t\t\tif (!diroutoforderwarning) {\n\t\t\t\tTIFFWarningExt(tif->tif_clientdata, module,\n\t\"%s: invalid TIFF directory; tags are not sorted in ascending order\",\n\t\t\t\t\t    tif->tif_name);\n\t\t\t\tdiroutoforderwarning = 1;\n\t\t\t}\n\t\t\tfix = 0;\t\t\t/* O(n^2) */\n\t\t}\n\t\twhile (fix < tif->tif_nfields &&\n\t\t    tif->tif_fieldinfo[fix]->field_tag < dp->tdir_tag)\n\t\t\tfix++;\n\t\tif (fix >= tif->tif_nfields ||\n\t\t    tif->tif_fieldinfo[fix]->field_tag != dp->tdir_tag) {\n\n\t\t\t\t\tTIFFWarningExt(tif->tif_clientdata,\n\t\t\t\t\t\t       module,\n                        \"%s: unknown field with tag %d (0x%x) encountered\",\n\t\t\t\t\t\t       tif->tif_name,\n\t\t\t\t\t\t       dp->tdir_tag,\n\t\t\t\t\t\t       dp->tdir_tag);\n\n\t\t\t\t\tif (!_TIFFMergeFieldInfo(tif,\n\t\t\t\t\t\t_TIFFCreateAnonFieldInfo(tif,\n\t\t\t\t\t\tdp->tdir_tag,\n\t\t\t\t\t\t(TIFFDataType) dp->tdir_type),\n\t\t\t\t\t\t1))\n\t\t\t\t\t{\n\t\t\t\t\tTIFFWarningExt(tif->tif_clientdata,\n\t\t\t\t\t\t       module,\n\t\t\t\"Registering anonymous field with tag %d (0x%x) failed\",\n\t\t\t\t\t\t       dp->tdir_tag,\n\t\t\t\t\t\t       dp->tdir_tag);\n\t\t\t\t\tgoto ignore;\n\t\t\t\t\t}\n\t\t\tfix = 0;\n\t\t\twhile (fix < tif->tif_nfields &&\n\t\t\t       tif->tif_fieldinfo[fix]->field_tag < dp->tdir_tag)\n\t\t\t\tfix++;\n\t\t}\n\t\t/*\n\t\t * Null out old tags that we ignore.\n\t\t */\n\t\tif (tif->tif_fieldinfo[fix]->field_bit == FIELD_IGNORE) {\n\tignore:\n\t\t\tdp->tdir_tag = IGNORE;\n\t\t\tcontinue;\n\t\t}\n\t\t/*\n\t\t * Check data type.\n\t\t */\n\t\tfip = tif->tif_fieldinfo[fix];\n\t\twhile (dp->tdir_type != (unsigned short) fip->field_type\n\t\t    && fix < tif->tif_nfields) {\n\t\t\tif (fip->field_type == TIFF_ANY)\t/* wildcard */\n\t\t\t\tbreak;\n\t\t\tfip = tif->tif_fieldinfo[++fix];\n\t\t\tif (fix >= tif->tif_nfields ||\n\t\t\t    fip->field_tag != dp->tdir_tag) {\n\t\t\t\tTIFFWarningExt(tif->tif_clientdata, module,\n\t\t\t\"%s: wrong data type %d for \\\"%s\\\"; tag ignored\",\n\t\t\t\t\t    tif->tif_name, dp->tdir_type,\n\t\t\t\t\t    tif->tif_fieldinfo[fix-1]->field_name);\n\t\t\t\tgoto ignore;\n\t\t\t}\n\t\t}\n\t\t/*\n\t\t * Check count if known in advance.\n\t\t */\n\t\tif (fip->field_readcount != TIFF_VARIABLE\n\t\t    && fip->field_readcount != TIFF_VARIABLE2) {\n\t\t\tuint32 expected = (fip->field_readcount == TIFF_SPP) ?\n\t\t\t    (uint32) td->td_samplesperpixel :\n\t\t\t    (uint32) fip->field_readcount;\n\t\t\tif (!CheckDirCount(tif, dp, expected))\n\t\t\t\tgoto ignore;\n\t\t}\n\n\t\tswitch (dp->tdir_tag) {\n\t\tcase TIFFTAG_COMPRESSION:\n\t\t\t/*\n\t\t\t * The 5.0 spec says the Compression tag has\n\t\t\t * one value, while earlier specs say it has\n\t\t\t * one value per sample.  Because of this, we\n\t\t\t * accept the tag if one value is supplied.\n\t\t\t */\n\t\t\tif (dp->tdir_count == 1) {\n\t\t\t\tv = TIFFExtractData(tif,\n\t\t\t\t    dp->tdir_type, dp->tdir_offset);\n\t\t\t\tif (!TIFFSetField(tif, dp->tdir_tag, (uint16)v))\n\t\t\t\t\tgoto bad;\n\t\t\t\telse\n\t\t\t\t\tcompressionknown = 1;\n\t\t\t\tbreak;\n\t\t\t/* XXX: workaround for broken TIFFs */\n\t\t\t} else if (dp->tdir_type == TIFF_LONG) {\n\t\t\t\tif (!TIFFFetchPerSampleLongs(tif, dp, &v) ||\n\t\t\t\t    !TIFFSetField(tif, dp->tdir_tag, (uint16)v))\n\t\t\t\t\tgoto bad;\n\t\t\t} else {\n\t\t\t\tif (!TIFFFetchPerSampleShorts(tif, dp, &iv)\n\t\t\t\t    || !TIFFSetField(tif, dp->tdir_tag, iv))\n\t\t\t\t\tgoto bad;\n\t\t\t}\n\t\t\tdp->tdir_tag = IGNORE;\n\t\t\tbreak;\n\t\tcase TIFFTAG_STRIPOFFSETS:\n\t\tcase TIFFTAG_STRIPBYTECOUNTS:\n\t\tcase TIFFTAG_TILEOFFSETS:\n\t\tcase TIFFTAG_TILEBYTECOUNTS:\n\t\t\tTIFFSetFieldBit(tif, fip->field_bit);\n\t\t\tbreak;\n\t\tcase TIFFTAG_IMAGEWIDTH:\n\t\tcase TIFFTAG_IMAGELENGTH:\n\t\tcase TIFFTAG_IMAGEDEPTH:\n\t\tcase TIFFTAG_TILELENGTH:\n\t\tcase TIFFTAG_TILEWIDTH:\n\t\tcase TIFFTAG_TILEDEPTH:\n\t\tcase TIFFTAG_PLANARCONFIG:\n\t\tcase TIFFTAG_ROWSPERSTRIP:\n\t\tcase TIFFTAG_EXTRASAMPLES:\n\t\t\tif (!TIFFFetchNormalTag(tif, dp))\n\t\t\t\tgoto bad;\n\t\t\tdp->tdir_tag = IGNORE;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\t/*\n\t * XXX: OJPEG hack.\n\t * If a) compression is OJPEG, b) planarconfig tag says it's separate,\n\t * c) strip offsets/bytecounts tag are both present and\n\t * d) both contain exactly one value, then we consistently find\n\t * that the buggy implementation of the buggy compression scheme\n\t * matches contig planarconfig best. So we 'fix-up' the tag here\n\t */\n\tif ((td->td_compression==COMPRESSION_OJPEG) &&\n\t    (td->td_planarconfig==PLANARCONFIG_SEPARATE)) {\n\t\tdp = TIFFReadDirectoryFind(dir,dircount,TIFFTAG_STRIPOFFSETS);\n\t\tif ((dp!=0) && (dp->tdir_count==1)) {\n\t\t\tdp = TIFFReadDirectoryFind(dir, dircount,\n\t\t\t\t\t\t   TIFFTAG_STRIPBYTECOUNTS);\n\t\t\tif ((dp!=0) && (dp->tdir_count==1)) {\n\t\t\t\ttd->td_planarconfig=PLANARCONFIG_CONTIG;\n\t\t\t\tTIFFWarningExt(tif->tif_clientdata,\n\t\t\t\t\t       \"TIFFReadDirectory\",\n\t\t\t\t\"Planarconfig tag value assumed incorrect, \"\n\t\t\t\t\"assuming data is contig instead of chunky\");\n\t\t\t}\n\t\t}\n\t}\n\n\t/*\n\t * Allocate directory structure and setup defaults.\n\t */\n\tif (!TIFFFieldSet(tif, FIELD_IMAGEDIMENSIONS)) {\n\t\tMissingRequired(tif, \"ImageLength\");\n\t\tgoto bad;\n\t}\n\t/* \n\t * Setup appropriate structures (by strip or by tile)\n\t */\n\tif (!TIFFFieldSet(tif, FIELD_TILEDIMENSIONS)) {\n\t\ttd->td_nstrips = TIFFNumberOfStrips(tif);\n\t\ttd->td_tilewidth = td->td_imagewidth;\n\t\ttd->td_tilelength = td->td_rowsperstrip;\n\t\ttd->td_tiledepth = td->td_imagedepth;\n\t\ttif->tif_flags &= ~TIFF_ISTILED;\n\t} else {\n\t\ttd->td_nstrips = TIFFNumberOfTiles(tif);\n\t\ttif->tif_flags |= TIFF_ISTILED;\n\t}\n\tif (!td->td_nstrips) {\n\t\tTIFFErrorExt(tif->tif_clientdata, module,\n\t\t\t     \"%s: cannot handle zero number of %s\",\n\t\t\t     tif->tif_name, isTiled(tif) ? \"tiles\" : \"strips\");\n\t\tgoto bad;\n\t}\n\ttd->td_stripsperimage = td->td_nstrips;\n\tif (td->td_planarconfig == PLANARCONFIG_SEPARATE)\n\t\ttd->td_stripsperimage /= td->td_samplesperpixel;\n\tif (!TIFFFieldSet(tif, FIELD_STRIPOFFSETS)) {\n\t\tif ((td->td_compression==COMPRESSION_OJPEG) &&\n\t\t    (isTiled(tif)==0) &&\n\t\t    (td->td_nstrips==1)) {\n\t\t\t/*\n\t\t\t * XXX: OJPEG hack.\n\t\t\t * If a) compression is OJPEG, b) it's not a tiled TIFF,\n\t\t\t * and c) the number of strips is 1,\n\t\t\t * then we tolerate the absence of stripoffsets tag,\n\t\t\t * because, presumably, all required data is in the\n\t\t\t * JpegInterchangeFormat stream.\n\t\t\t */\n\t\t\tTIFFSetFieldBit(tif, FIELD_STRIPOFFSETS);\n\t\t} else {\n\t\t\tMissingRequired(tif,\n\t\t\t\tisTiled(tif) ? \"TileOffsets\" : \"StripOffsets\");\n\t\t\tgoto bad;\n\t\t}\n\t}\n\n\t/*\n\t * Second pass: extract other information.\n\t */\n\tfor (dp = dir, n = dircount; n > 0; n--, dp++) {\n\t\tif (dp->tdir_tag == IGNORE)\n\t\t\tcontinue;\n\t\tswitch (dp->tdir_tag) {\n\t\tcase TIFFTAG_MINSAMPLEVALUE:\n\t\tcase TIFFTAG_MAXSAMPLEVALUE:\n\t\tcase TIFFTAG_BITSPERSAMPLE:\n\t\tcase TIFFTAG_DATATYPE:\n\t\tcase TIFFTAG_SAMPLEFORMAT:\n\t\t\t/*\n\t\t\t * The 5.0 spec says the Compression tag has\n\t\t\t * one value, while earlier specs say it has\n\t\t\t * one value per sample.  Because of this, we\n\t\t\t * accept the tag if one value is supplied.\n\t\t\t *\n\t\t\t * The MinSampleValue, MaxSampleValue, BitsPerSample\n\t\t\t * DataType and SampleFormat tags are supposed to be\n\t\t\t * written as one value/sample, but some vendors\n\t\t\t * incorrectly write one value only -- so we accept\n\t\t\t * that as well (yech). Other vendors write correct\n\t\t\t * value for NumberOfSamples, but incorrect one for\n\t\t\t * BitsPerSample and friends, and we will read this\n\t\t\t * too.\n\t\t\t */\n\t\t\tif (dp->tdir_count == 1) {\n\t\t\t\tv = TIFFExtractData(tif,\n\t\t\t\t    dp->tdir_type, dp->tdir_offset);\n\t\t\t\tif (!TIFFSetField(tif, dp->tdir_tag, (uint16)v))\n\t\t\t\t\tgoto bad;\n\t\t\t/* XXX: workaround for broken TIFFs */\n\t\t\t} else if (dp->tdir_tag == TIFFTAG_BITSPERSAMPLE\n\t\t\t\t   && dp->tdir_type == TIFF_LONG) {\n\t\t\t\tif (!TIFFFetchPerSampleLongs(tif, dp, &v) ||\n\t\t\t\t    !TIFFSetField(tif, dp->tdir_tag, (uint16)v))\n\t\t\t\t\tgoto bad;\n\t\t\t} else {\n\t\t\t\tif (!TIFFFetchPerSampleShorts(tif, dp, &iv) ||\n\t\t\t\t    !TIFFSetField(tif, dp->tdir_tag, iv))\n\t\t\t\t\tgoto bad;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase TIFFTAG_SMINSAMPLEVALUE:\n\t\tcase TIFFTAG_SMAXSAMPLEVALUE:\n\t\t\t{\n\t\t\t\tdouble dv = 0.0;\n\t\t\t\tif (!TIFFFetchPerSampleAnys(tif, dp, &dv) ||\n\t\t\t\t    !TIFFSetField(tif, dp->tdir_tag, dv))\n\t\t\t\t\tgoto bad;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase TIFFTAG_STRIPOFFSETS:\n\t\tcase TIFFTAG_TILEOFFSETS:\n\t\t\tif (!TIFFFetchStripThing(tif, dp,\n\t\t\t    td->td_nstrips, &td->td_stripoffset))\n\t\t\t\tgoto bad;\n\t\t\tbreak;\n\t\tcase TIFFTAG_STRIPBYTECOUNTS:\n\t\tcase TIFFTAG_TILEBYTECOUNTS:\n\t\t\tif (!TIFFFetchStripThing(tif, dp,\n\t\t\t    td->td_nstrips, &td->td_stripbytecount))\n\t\t\t\tgoto bad;\n\t\t\tbreak;\n\t\tcase TIFFTAG_COLORMAP:\n\t\tcase TIFFTAG_TRANSFERFUNCTION:\n\t\t\t{\n\t\t\t\tchar* cp;\n\t\t\t\t/*\n\t\t\t\t * TransferFunction can have either 1x or 3x\n\t\t\t\t * data values; Colormap can have only 3x\n\t\t\t\t * items.\n\t\t\t\t */\n\t\t\t\tv = 1L<<td->td_bitspersample;\n\t\t\t\tif (dp->tdir_tag == TIFFTAG_COLORMAP ||\n\t\t\t\t    dp->tdir_count != v) {\n\t\t\t\t\tif (!CheckDirCount(tif, dp, 3 * v))\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tv *= sizeof(uint16);\n\t\t\t\tcp = (char *)_TIFFCheckMalloc(tif,\n\t\t\t\t\t\t\t      dp->tdir_count,\n\t\t\t\t\t\t\t      sizeof (uint16),\n\t\t\t\t\t\"to read \\\"TransferFunction\\\" tag\");\n\t\t\t\tif (cp != NULL) {\n\t\t\t\t\tif (TIFFFetchData(tif, dp, cp)) {\n\t\t\t\t\t\t/*\n\t\t\t\t\t\t * This deals with there being\n\t\t\t\t\t\t * only one array to apply to\n\t\t\t\t\t\t * all samples.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tuint32 c = 1L << td->td_bitspersample;\n\t\t\t\t\t\tif (dp->tdir_count == c)\n\t\t\t\t\t\t\tv = 0L;\n\t\t\t\t\t\tTIFFSetField(tif, dp->tdir_tag,\n\t\t\t\t\t\t    cp, cp+v, cp+2*v);\n\t\t\t\t\t}\n\t\t\t\t\t_TIFFfree(cp);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\tcase TIFFTAG_PAGENUMBER:\n\t\tcase TIFFTAG_HALFTONEHINTS:\n\t\tcase TIFFTAG_YCBCRSUBSAMPLING:\n\t\tcase TIFFTAG_DOTRANGE:\n\t\t\t(void) TIFFFetchShortPair(tif, dp);\n\t\t\tbreak;\n\t\tcase TIFFTAG_REFERENCEBLACKWHITE:\n\t\t\t(void) TIFFFetchRefBlackWhite(tif, dp);\n\t\t\tbreak;\n/* BEGIN REV 4.0 COMPATIBILITY */\n\t\tcase TIFFTAG_OSUBFILETYPE:\n\t\t\tv = 0L;\n\t\t\tswitch (TIFFExtractData(tif, dp->tdir_type,\n\t\t\t    dp->tdir_offset)) {\n\t\t\tcase OFILETYPE_REDUCEDIMAGE:\n\t\t\t\tv = FILETYPE_REDUCEDIMAGE;\n\t\t\t\tbreak;\n\t\t\tcase OFILETYPE_PAGE:\n\t\t\t\tv = FILETYPE_PAGE;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (v)\n\t\t\t\tTIFFSetField(tif, TIFFTAG_SUBFILETYPE, v);\n\t\t\tbreak;\n/* END REV 4.0 COMPATIBILITY */\n\t\tdefault:\n\t\t\t(void) TIFFFetchNormalTag(tif, dp);\n\t\t\tbreak;\n\t\t}\n\t}\n\t/*\n\t * OJPEG hack:\n\t * - If a) compression is OJPEG, and b) photometric tag is missing,\n\t * then we consistently find that photometric should be YCbCr\n\t * - If a) compression is OJPEG, and b) photometric tag says it's RGB,\n\t * then we consistently find that the buggy implementation of the\n\t * buggy compression scheme matches photometric YCbCr instead.\n\t * - If a) compression is OJPEG, and b) bitspersample tag is missing,\n\t * then we consistently find bitspersample should be 8.\n\t * - If a) compression is OJPEG, b) samplesperpixel tag is missing,\n\t * and c) photometric is RGB or YCbCr, then we consistently find\n\t * samplesperpixel should be 3\n\t * - If a) compression is OJPEG, b) samplesperpixel tag is missing,\n\t * and c) photometric is MINISWHITE or MINISBLACK, then we consistently\n\t * find samplesperpixel should be 3\n\t */\n\tif (td->td_compression==COMPRESSION_OJPEG)\n\t{\n\t\tif (!TIFFFieldSet(tif,FIELD_PHOTOMETRIC))\n\t\t{\n\t\t\tTIFFWarningExt(tif->tif_clientdata, \"TIFFReadDirectory\",\n\t\t\t\"Photometric tag is missing, assuming data is YCbCr\");\n\t\t\tif (!TIFFSetField(tif,TIFFTAG_PHOTOMETRIC,PHOTOMETRIC_YCBCR))\n\t\t\t\tgoto bad;\n\t\t}\n\t\telse if (td->td_photometric==PHOTOMETRIC_RGB)\n\t\t{\n\t\t\ttd->td_photometric=PHOTOMETRIC_YCBCR;\n\t\t\tTIFFWarningExt(tif->tif_clientdata, \"TIFFReadDirectory\",\n\t\t\t\"Photometric tag value assumed incorrect, \"\n\t\t\t\"assuming data is YCbCr instead of RGB\");\n\t\t}\n\t\tif (!TIFFFieldSet(tif,FIELD_BITSPERSAMPLE))\n\t\t{\n\t\t\tTIFFWarningExt(tif->tif_clientdata,\"TIFFReadDirectory\",\n\t\t\"BitsPerSample tag is missing, assuming 8 bits per sample\");\n\t\t\tif (!TIFFSetField(tif,TIFFTAG_BITSPERSAMPLE,8))\n\t\t\t\tgoto bad;\n\t\t}\n\t\tif (!TIFFFieldSet(tif,FIELD_SAMPLESPERPIXEL))\n\t\t{\n\t\t\tif ((td->td_photometric==PHOTOMETRIC_RGB)\n\t\t\t    || (td->td_photometric==PHOTOMETRIC_YCBCR))\n\t\t\t{\n\t\t\t\tTIFFWarningExt(tif->tif_clientdata,\n\t\t\t\t\t       \"TIFFReadDirectory\",\n\t\t\t\t\"SamplesPerPixel tag is missing, \"\n\t\t\t\t\"assuming correct SamplesPerPixel value is 3\");\n\t\t\t\tif (!TIFFSetField(tif,TIFFTAG_SAMPLESPERPIXEL,3))\n\t\t\t\t\tgoto bad;\n\t\t\t}\n\t\t\telse if ((td->td_photometric==PHOTOMETRIC_MINISWHITE)\n\t\t\t\t || (td->td_photometric==PHOTOMETRIC_MINISBLACK))\n\t\t\t{\n\t\t\t\tTIFFWarningExt(tif->tif_clientdata,\n\t\t\t\t\t       \"TIFFReadDirectory\",\n\t\t\t\t\"SamplesPerPixel tag is missing, \"\n\t\t\t\t\"assuming correct SamplesPerPixel value is 1\");\n\t\t\t\tif (!TIFFSetField(tif,TIFFTAG_SAMPLESPERPIXEL,1))\n\t\t\t\t\tgoto bad;\n\t\t\t}\n\t\t}\n\t}\n\t/*\n\t * Verify Palette image has a Colormap.\n\t */\n\tif (td->td_photometric == PHOTOMETRIC_PALETTE &&\n\t    !TIFFFieldSet(tif, FIELD_COLORMAP)) {\n\t\tMissingRequired(tif, \"Colormap\");\n\t\tgoto bad;\n\t}\n\t/*\n\t * OJPEG hack:\n\t * We do no further messing with strip/tile offsets/bytecounts in OJPEG\n\t * TIFFs\n\t */\n\tif (td->td_compression!=COMPRESSION_OJPEG)\n\t{\n\t\t/*\n\t\t * Attempt to deal with a missing StripByteCounts tag.\n\t\t */\n\t\tif (!TIFFFieldSet(tif, FIELD_STRIPBYTECOUNTS)) {\n\t\t\t/*\n\t\t\t * Some manufacturers violate the spec by not giving\n\t\t\t * the size of the strips.  In this case, assume there\n\t\t\t * is one uncompressed strip of data.\n\t\t\t */\n\t\t\tif ((td->td_planarconfig == PLANARCONFIG_CONTIG &&\n\t\t\t    td->td_nstrips > 1) ||\n\t\t\t    (td->td_planarconfig == PLANARCONFIG_SEPARATE &&\n\t\t\t     td->td_nstrips != td->td_samplesperpixel)) {\n\t\t\t    MissingRequired(tif, \"StripByteCounts\");\n\t\t\t    goto bad;\n\t\t\t}\n\t\t\tTIFFWarningExt(tif->tif_clientdata, module,\n\t\t\t\t\"%s: TIFF directory is missing required \"\n\t\t\t\t\"\\\"%s\\\" field, calculating from imagelength\",\n\t\t\t\ttif->tif_name,\n\t\t\t\t_TIFFFieldWithTag(tif,TIFFTAG_STRIPBYTECOUNTS)->field_name);\n\t\t\tif (EstimateStripByteCounts(tif, dir, dircount) < 0)\n\t\t\t    goto bad;\n\t\t/*\n\t\t * Assume we have wrong StripByteCount value (in case\n\t\t * of single strip) in following cases:\n\t\t *   - it is equal to zero along with StripOffset;\n\t\t *   - it is larger than file itself (in case of uncompressed\n\t\t *     image);\n\t\t *   - it is smaller than the size of the bytes per row\n\t\t *     multiplied on the number of rows.  The last case should\n\t\t *     not be checked in the case of writing new image,\n\t\t *     because we may do not know the exact strip size\n\t\t *     until the whole image will be written and directory\n\t\t *     dumped out.\n\t\t */\n\t\t#define\tBYTECOUNTLOOKSBAD \\\n\t\t    ( (td->td_stripbytecount[0] == 0 && td->td_stripoffset[0] != 0) || \\\n\t\t      (td->td_compression == COMPRESSION_NONE && \\\n\t\t       td->td_stripbytecount[0] > TIFFGetFileSize(tif) - td->td_stripoffset[0]) || \\\n\t\t      (tif->tif_mode == O_RDONLY && \\\n\t\t       td->td_compression == COMPRESSION_NONE && \\\n\t\t       td->td_stripbytecount[0] < TIFFScanlineSize(tif) * td->td_imagelength) )\n\n\t\t} else if (td->td_nstrips == 1\n\t\t\t   && td->td_stripoffset[0] != 0\n\t\t\t   && BYTECOUNTLOOKSBAD) {\n\t\t\t/*\n\t\t\t * XXX: Plexus (and others) sometimes give a value of\n\t\t\t * zero for a tag when they don't know what the\n\t\t\t * correct value is!  Try and handle the simple case\n\t\t\t * of estimating the size of a one strip image.\n\t\t\t */\n\t\t\tTIFFWarningExt(tif->tif_clientdata, module,\n\t\"%s: Bogus \\\"%s\\\" field, ignoring and calculating from imagelength\",\n\t\t\t\t    tif->tif_name,\n\t\t\t\t    _TIFFFieldWithTag(tif,TIFFTAG_STRIPBYTECOUNTS)->field_name);\n\t\t\tif(EstimateStripByteCounts(tif, dir, dircount) < 0)\n\t\t\t    goto bad;\n\t\t} else if (td->td_planarconfig == PLANARCONFIG_CONTIG\n\t\t\t   && td->td_nstrips > 2\n\t\t\t   && td->td_compression == COMPRESSION_NONE\n\t\t\t   && td->td_stripbytecount[0] != td->td_stripbytecount[1]\n                           && td->td_stripbytecount[0] != 0 \n                           && td->td_stripbytecount[1] != 0 ) {\n\t\t\t/*\n\t\t\t * XXX: Some vendors fill StripByteCount array with \n                         * absolutely wrong values (it can be equal to \n                         * StripOffset array, for example). Catch this case \n                         * here.\n\t\t\t */\n\t\t\tTIFFWarningExt(tif->tif_clientdata, module,\n\t\"%s: Wrong \\\"%s\\\" field, ignoring and calculating from imagelength\",\n\t\t\t\t    tif->tif_name,\n\t\t\t\t    _TIFFFieldWithTag(tif,TIFFTAG_STRIPBYTECOUNTS)->field_name);\n\t\t\tif (EstimateStripByteCounts(tif, dir, dircount) < 0)\n\t\t\t    goto bad;\n\t\t}\n\t}\n\tif (dir) {\n\t\t_TIFFfree((char *)dir);\n\t\tdir = NULL;\n\t}\n\tif (!TIFFFieldSet(tif, FIELD_MAXSAMPLEVALUE))\n\t\ttd->td_maxsamplevalue = (uint16)((1L<<td->td_bitspersample)-1);\n\t/*\n\t * Setup default compression scheme.\n\t */\n\n\t/*\n\t * XXX: We can optimize checking for the strip bounds using the sorted\n\t * bytecounts array. See also comments for TIFFAppendToStrip()\n\t * function in tif_write.c.\n\t */\n\tif (td->td_nstrips > 1) {\n\t\ttstrip_t strip;\n\n\t\ttd->td_stripbytecountsorted = 1;\n\t\tfor (strip = 1; strip < td->td_nstrips; strip++) {\n\t\t\tif (td->td_stripoffset[strip - 1] >\n\t\t\t    td->td_stripoffset[strip]) {\n\t\t\t\ttd->td_stripbytecountsorted = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (!TIFFFieldSet(tif, FIELD_COMPRESSION))\n\t\tTIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_NONE);\n\t/*\n\t * Some manufacturers make life difficult by writing\n\t * large amounts of uncompressed data as a single strip.\n\t * This is contrary to the recommendations of the spec.\n\t * The following makes an attempt at breaking such images\n\t * into strips closer to the recommended 8k bytes.  A\n\t * side effect, however, is that the RowsPerStrip tag\n\t * value may be changed.\n\t */\n\tif (td->td_nstrips == 1 && td->td_compression == COMPRESSION_NONE &&\n\t    (tif->tif_flags & (TIFF_STRIPCHOP|TIFF_ISTILED)) == TIFF_STRIPCHOP)\n\t\tChopUpSingleUncompressedStrip(tif);\n\n\t/*\n\t * Reinitialize i/o since we are starting on a new directory.\n\t */\n\ttif->tif_row = (uint32) -1;\n\ttif->tif_curstrip = (tstrip_t) -1;\n\ttif->tif_col = (uint32) -1;\n\ttif->tif_curtile = (ttile_t) -1;\n\ttif->tif_tilesize = (tsize_t) -1;\n\n\ttif->tif_scanlinesize = TIFFScanlineSize(tif);\n\tif (!tif->tif_scanlinesize) {\n\t\tTIFFErrorExt(tif->tif_clientdata, module,\n\t\t\t     \"%s: cannot handle zero scanline size\",\n\t\t\t     tif->tif_name);\n\t\treturn (0);\n\t}\n\n\tif (isTiled(tif)) {\n\t\ttif->tif_tilesize = TIFFTileSize(tif);\n\t\tif (!tif->tif_tilesize) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, module,\n\t\t\t\t     \"%s: cannot handle zero tile size\",\n\t\t\t\t     tif->tif_name);\n\t\t\treturn (0);\n\t\t}\n\t} else {\n\t\tif (!TIFFStripSize(tif)) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, module,\n\t\t\t\t     \"%s: cannot handle zero strip size\",\n\t\t\t\t     tif->tif_name);\n\t\t\treturn (0);\n\t\t}\n\t}\n\treturn (1);\nbad:\n\tif (dir)\n\t\t_TIFFfree(dir);\n\treturn (0);\n}\n\nstatic TIFFDirEntry*\nTIFFReadDirectoryFind(TIFFDirEntry* dir, uint16 dircount, uint16 tagid)\n{\n\tTIFFDirEntry* m;\n\tuint16 n;\n\tfor (m=dir, n=0; n<dircount; m++, n++)\n\t{\n\t\tif (m->tdir_tag==tagid)\n\t\t\treturn(m);\n\t}\n\treturn(0);\n}\n\n/*\n * Read custom directory from the arbitarry offset.\n * The code is very similar to TIFFReadDirectory().\n */\nint\nTIFFReadCustomDirectory(TIFF* tif, toff_t diroff,\n\t\t\tconst TIFFFieldInfo info[], size_t n)\n{\n\tstatic const char module[] = \"TIFFReadCustomDirectory\";\n\n\tTIFFDirectory* td = &tif->tif_dir;\n\tTIFFDirEntry *dp, *dir = NULL;\n\tconst TIFFFieldInfo* fip;\n\tsize_t fix;\n\tuint16 i, dircount;\n\n\t_TIFFSetupFieldInfo(tif, info, n);\n\n\tdircount = TIFFFetchDirectory(tif, diroff, &dir, NULL);\n\tif (!dircount) {\n\t\tTIFFErrorExt(tif->tif_clientdata, module,\n\t\t\t\"%s: Failed to read custom directory at offset %u\",\n\t\t\t     tif->tif_name, diroff);\n\t\treturn 0;\n\t}\n\n\tTIFFFreeDirectory(tif);\n        _TIFFmemset(&tif->tif_dir, 0, sizeof(TIFFDirectory));\n\n\tfix = 0;\n\tfor (dp = dir, i = dircount; i > 0; i--, dp++) {\n\t\tif (tif->tif_flags & TIFF_SWAB) {\n\t\t\tTIFFSwabArrayOfShort(&dp->tdir_tag, 2);\n\t\t\tTIFFSwabArrayOfLong(&dp->tdir_count, 2);\n\t\t}\n\n\t\tif (fix >= tif->tif_nfields || dp->tdir_tag == IGNORE)\n\t\t\tcontinue;\n\n\t\twhile (fix < tif->tif_nfields &&\n\t\t       tif->tif_fieldinfo[fix]->field_tag < dp->tdir_tag)\n\t\t\tfix++;\n\n\t\tif (fix >= tif->tif_nfields ||\n\t\t    tif->tif_fieldinfo[fix]->field_tag != dp->tdir_tag) {\n\n\t\t\tTIFFWarningExt(tif->tif_clientdata, module,\n                        \"%s: unknown field with tag %d (0x%x) encountered\",\n\t\t\t\t    tif->tif_name, dp->tdir_tag, dp->tdir_tag);\n\t\t\tif (!_TIFFMergeFieldInfo(tif,\n\t\t\t\t\t\t _TIFFCreateAnonFieldInfo(tif,\n\t\t\t\t\t\t dp->tdir_tag,\n\t\t\t\t\t\t (TIFFDataType) dp->tdir_type),\n\t\t\t\t\t\t 1))\n\t\t\t{\n\t\t\t\tTIFFWarningExt(tif->tif_clientdata, module,\n\t\t\t\"Registering anonymous field with tag %d (0x%x) failed\",\n\t\t\t\t\t\tdp->tdir_tag, dp->tdir_tag);\n\t\t\t\tgoto ignore;\n\t\t\t}\n\n\t\t\tfix = 0;\n\t\t\twhile (fix < tif->tif_nfields &&\n\t\t\t       tif->tif_fieldinfo[fix]->field_tag < dp->tdir_tag)\n\t\t\t\tfix++;\n\t\t}\n\t\t/*\n\t\t * Null out old tags that we ignore.\n\t\t */\n\t\tif (tif->tif_fieldinfo[fix]->field_bit == FIELD_IGNORE) {\n\tignore:\n\t\t\tdp->tdir_tag = IGNORE;\n\t\t\tcontinue;\n\t\t}\n\t\t/*\n\t\t * Check data type.\n\t\t */\n\t\tfip = tif->tif_fieldinfo[fix];\n\t\twhile (dp->tdir_type != (unsigned short) fip->field_type\n                       && fix < tif->tif_nfields) {\n\t\t\tif (fip->field_type == TIFF_ANY)\t/* wildcard */\n\t\t\t\tbreak;\n                        fip = tif->tif_fieldinfo[++fix];\n\t\t\tif (fix >= tif->tif_nfields ||\n\t\t\t    fip->field_tag != dp->tdir_tag) {\n\t\t\t\tTIFFWarningExt(tif->tif_clientdata, module,\n\t\t\t\"%s: wrong data type %d for \\\"%s\\\"; tag ignored\",\n\t\t\t\t\t    tif->tif_name, dp->tdir_type,\n\t\t\t\t\t    tif->tif_fieldinfo[fix-1]->field_name);\n\t\t\t\tgoto ignore;\n\t\t\t}\n\t\t}\n\t\t/*\n\t\t * Check count if known in advance.\n\t\t */\n\t\tif (fip->field_readcount != TIFF_VARIABLE\n\t\t    && fip->field_readcount != TIFF_VARIABLE2) {\n\t\t\tuint32 expected = (fip->field_readcount == TIFF_SPP) ?\n\t\t\t    (uint32) td->td_samplesperpixel :\n\t\t\t    (uint32) fip->field_readcount;\n\t\t\tif (!CheckDirCount(tif, dp, expected))\n\t\t\t\tgoto ignore;\n\t\t}\n\n\t\t/*\n\t\t * EXIF tags which need to be specifically processed.\n\t\t */\n\t\tswitch (dp->tdir_tag) {\n\t\t\tcase EXIFTAG_SUBJECTDISTANCE:\n\t\t\t\t(void) TIFFFetchSubjectDistance(tif, dp);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\t(void) TIFFFetchNormalTag(tif, dp);\n\t\t\t\tbreak;\n\t\t}\n\t}\n\t\n\tif (dir)\n\t\t_TIFFfree(dir);\n\treturn 1;\n}\n\n/*\n * EXIF is important special case of custom IFD, so we have a special\n * function to read it.\n */\nint\nTIFFReadEXIFDirectory(TIFF* tif, toff_t diroff)\n{\n\tsize_t exifFieldInfoCount;\n\tconst TIFFFieldInfo *exifFieldInfo =\n\t\t_TIFFGetExifFieldInfo(&exifFieldInfoCount);\n\treturn TIFFReadCustomDirectory(tif, diroff, exifFieldInfo,\n\t\t\t\t       exifFieldInfoCount);\n}\n\nstatic int\nEstimateStripByteCounts(TIFF* tif, TIFFDirEntry* dir, uint16 dircount)\n{\n\tstatic const char module[] = \"EstimateStripByteCounts\";\n\n\tTIFFDirEntry *dp;\n\tTIFFDirectory *td = &tif->tif_dir;\n\tuint32 strip;\n\n\tif (td->td_stripbytecount)\n\t\t_TIFFfree(td->td_stripbytecount);\n\ttd->td_stripbytecount = (uint32*)\n\t    _TIFFCheckMalloc(tif, td->td_nstrips, sizeof (uint32),\n\t\t\"for \\\"StripByteCounts\\\" array\");\n        if( td->td_stripbytecount == NULL )\n            return -1;\n\n\tif (td->td_compression != COMPRESSION_NONE) {\n\t\tuint32 space = (uint32)(sizeof (TIFFHeader)\n\t\t    + sizeof (uint16)\n\t\t    + (dircount * sizeof (TIFFDirEntry))\n\t\t    + sizeof (uint32));\n\t\ttoff_t filesize = TIFFGetFileSize(tif);\n\t\tuint16 n;\n\n\t\t/* calculate amount of space used by indirect values */\n\t\tfor (dp = dir, n = dircount; n > 0; n--, dp++)\n\t\t{\n\t\t\tuint32 cc = TIFFDataWidth((TIFFDataType) dp->tdir_type);\n\t\t\tif (cc == 0) {\n\t\t\t\tTIFFErrorExt(tif->tif_clientdata, module,\n\t\t\t\"%s: Cannot determine size of unknown tag type %d\",\n\t\t\t\t\t  tif->tif_name, dp->tdir_type);\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t\tcc = cc * dp->tdir_count;\n\t\t\tif (cc > sizeof (uint32))\n\t\t\t\tspace += cc;\n\t\t}\n\t\tspace = filesize - space;\n\t\tif (td->td_planarconfig == PLANARCONFIG_SEPARATE)\n\t\t\tspace /= td->td_samplesperpixel;\n\t\tfor (strip = 0; strip < td->td_nstrips; strip++)\n\t\t\ttd->td_stripbytecount[strip] = space;\n\t\t/*\n\t\t * This gross hack handles the case were the offset to\n\t\t * the last strip is past the place where we think the strip\n\t\t * should begin.  Since a strip of data must be contiguous,\n\t\t * it's safe to assume that we've overestimated the amount\n\t\t * of data in the strip and trim this number back accordingly.\n\t\t */ \n\t\tstrip--;\n\t\tif (((toff_t)(td->td_stripoffset[strip]+\n\t\t\t      td->td_stripbytecount[strip])) > filesize)\n\t\t\ttd->td_stripbytecount[strip] =\n\t\t\t    filesize - td->td_stripoffset[strip];\n\t} else if (isTiled(tif)) {\n\t\tuint32 bytespertile = TIFFTileSize(tif);\n\n\t\tfor (strip = 0; strip < td->td_nstrips; strip++)\n                    td->td_stripbytecount[strip] = bytespertile;\n\t} else {\n\t\tuint32 rowbytes = TIFFScanlineSize(tif);\n\t\tuint32 rowsperstrip = td->td_imagelength/td->td_stripsperimage;\n\t\tfor (strip = 0; strip < td->td_nstrips; strip++)\n\t\t\ttd->td_stripbytecount[strip] = rowbytes * rowsperstrip;\n\t}\n\tTIFFSetFieldBit(tif, FIELD_STRIPBYTECOUNTS);\n\tif (!TIFFFieldSet(tif, FIELD_ROWSPERSTRIP))\n\t\ttd->td_rowsperstrip = td->td_imagelength;\n\treturn 1;\n}\n\nstatic void\nMissingRequired(TIFF* tif, const char* tagname)\n{\n\tstatic const char module[] = \"MissingRequired\";\n\n\tTIFFErrorExt(tif->tif_clientdata, module,\n\t\t  \"%s: TIFF directory is missing required \\\"%s\\\" field\",\n\t\t  tif->tif_name, tagname);\n}\n\n/*\n * Check the directory offset against the list of already seen directory\n * offsets. This is a trick to prevent IFD looping. The one can create TIFF\n * file with looped directory pointers. We will maintain a list of already\n * seen directories and check every IFD offset against that list.\n */\nstatic int\nTIFFCheckDirOffset(TIFF* tif, toff_t diroff)\n{\n\tuint16 n;\n\n\tif (diroff == 0)\t\t\t/* no more directories */\n\t\treturn 0;\n\n\tfor (n = 0; n < tif->tif_dirnumber && tif->tif_dirlist; n++) {\n\t\tif (tif->tif_dirlist[n] == diroff)\n\t\t\treturn 0;\n\t}\n\n\ttif->tif_dirnumber++;\n\n\tif (tif->tif_dirnumber > tif->tif_dirlistsize) {\n\t\ttoff_t* new_dirlist;\n\n\t\t/*\n\t\t * XXX: Reduce memory allocation granularity of the dirlist\n\t\t * array.\n\t\t */\n\t\tnew_dirlist = (toff_t *)_TIFFCheckRealloc(tif,\n\t\t\t\t\t\t\t  tif->tif_dirlist,\n\t\t\t\t\t\t\t  tif->tif_dirnumber,\n\t\t\t\t\t\t\t  2 * sizeof(toff_t),\n\t\t\t\t\t\t\t  \"for IFD list\");\n\t\tif (!new_dirlist)\n\t\t\treturn 0;\n\t\ttif->tif_dirlistsize = 2 * tif->tif_dirnumber;\n\t\ttif->tif_dirlist = new_dirlist;\n\t}\n\n\ttif->tif_dirlist[tif->tif_dirnumber - 1] = diroff;\n\n\treturn 1;\n}\n\n/*\n * Check the count field of a directory entry against a known value.  The\n * caller is expected to skip/ignore the tag if there is a mismatch.\n */\nstatic int\nCheckDirCount(TIFF* tif, TIFFDirEntry* dir, uint32 count)\n{\n\tif (count > dir->tdir_count) {\n\t\tTIFFWarningExt(tif->tif_clientdata, tif->tif_name,\n\t\"incorrect count for field \\\"%s\\\" (%u, expecting %u); tag ignored\",\n\t\t    _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name,\n\t\t    dir->tdir_count, count);\n\t\treturn (0);\n\t} else if (count < dir->tdir_count) {\n\t\tTIFFWarningExt(tif->tif_clientdata, tif->tif_name,\n\t\"incorrect count for field \\\"%s\\\" (%u, expecting %u); tag trimmed\",\n\t\t    _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name,\n\t\t    dir->tdir_count, count);\n\t\treturn (1);\n\t}\n\treturn (1);\n}\n\n/*\n * Read IFD structure from the specified offset. If the pointer to\n * nextdiroff variable has been specified, read it too. Function returns a\n * number of fields in the directory or 0 if failed.\n */\nstatic uint16\nTIFFFetchDirectory(TIFF* tif, toff_t diroff, TIFFDirEntry **pdir,\n\t\t   toff_t *nextdiroff)\n{\n\tstatic const char module[] = \"TIFFFetchDirectory\";\n\n\tTIFFDirEntry *dir;\n\tuint16 dircount;\n\n\tassert(pdir);\n\n\ttif->tif_diroff = diroff;\n\tif (nextdiroff)\n\t\t*nextdiroff = 0;\n\tif (!isMapped(tif)) {\n\t\tif (!SeekOK(tif, tif->tif_diroff)) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, module,\n\t\t\t\t\"%s: Seek error accessing TIFF directory\",\n\t\t\t\ttif->tif_name);\n\t\t\treturn 0;\n\t\t}\n\t\tif (!ReadOK(tif, &dircount, sizeof (uint16))) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, module,\n\t\t\t\t\"%s: Can not read TIFF directory count\",\n\t\t\t\ttif->tif_name);\n\t\t\treturn 0;\n\t\t}\n\t\tif (tif->tif_flags & TIFF_SWAB)\n\t\t\tTIFFSwabShort(&dircount);\n\t\tdir = (TIFFDirEntry *)_TIFFCheckMalloc(tif, dircount,\n\t\t\t\t\t\tsizeof (TIFFDirEntry),\n\t\t\t\t\t\t\"to read TIFF directory\");\n\t\tif (dir == NULL)\n\t\t\treturn 0;\n\t\tif (!ReadOK(tif, dir, dircount*sizeof (TIFFDirEntry))) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, module,\n\t\t\t\t\"%.100s: Can not read TIFF directory\",\n\t\t\t\ttif->tif_name);\n\t\t\t_TIFFfree(dir);\n\t\t\treturn 0;\n\t\t}\n\t\t/*\n\t\t * Read offset to next directory for sequential scans if\n\t\t * needed.\n\t\t */\n\t\tif (nextdiroff)\n\t\t\t(void) ReadOK(tif, nextdiroff, sizeof(uint32));\n\t} else {\n\t\ttoff_t off = tif->tif_diroff;\n\n\t\t/*\n\t\t * Check for integer overflow when validating the dir_off,\n\t\t * otherwise a very high offset may cause an OOB read and\n\t\t * crash the client. Make two comparisons instead of\n\t\t *\n\t\t *  off + sizeof(uint16) > tif->tif_size\n\t\t *\n\t\t * to avoid overflow.\n\t\t */\n\t\tif (tif->tif_size < sizeof (uint16) ||\n\t\t    off > tif->tif_size - sizeof(uint16)) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, module,\n\t\t\t\t\"%s: Can not read TIFF directory count\",\n\t\t\t\ttif->tif_name);\n\t\t\treturn 0;\n\t\t} else {\n\t\t\t_TIFFmemcpy(&dircount, tif->tif_base + off,\n\t\t\t\t    sizeof(uint16));\n\t\t}\n\t\toff += sizeof (uint16);\n\t\tif (tif->tif_flags & TIFF_SWAB)\n\t\t\tTIFFSwabShort(&dircount);\n\t\tdir = (TIFFDirEntry *)_TIFFCheckMalloc(tif, dircount,\n\t\t\t\t\t\tsizeof(TIFFDirEntry),\n\t\t\t\t\t\t\"to read TIFF directory\");\n\t\tif (dir == NULL)\n\t\t\treturn 0;\n\t\tif (off + dircount * sizeof (TIFFDirEntry) > tif->tif_size) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, module,\n\t\t\t\t     \"%s: Can not read TIFF directory\",\n\t\t\t\t     tif->tif_name);\n\t\t\t_TIFFfree(dir);\n\t\t\treturn 0;\n\t\t} else {\n\t\t\t_TIFFmemcpy(dir, tif->tif_base + off,\n\t\t\t\t    dircount * sizeof(TIFFDirEntry));\n\t\t}\n\t\tif (nextdiroff) {\n\t\t\toff += dircount * sizeof (TIFFDirEntry);\n\t\t\tif (off + sizeof (uint32) <= tif->tif_size) {\n\t\t\t\t_TIFFmemcpy(nextdiroff, tif->tif_base + off,\n\t\t\t\t\t    sizeof (uint32));\n\t\t\t}\n\t\t}\n\t}\n\tif (nextdiroff && tif->tif_flags & TIFF_SWAB)\n\t\tTIFFSwabLong(nextdiroff);\n\t*pdir = dir;\n\treturn dircount;\n}\n\n/*\n * Fetch a contiguous directory item.\n */\nstatic tsize_t\nTIFFFetchData(TIFF* tif, TIFFDirEntry* dir, char* cp)\n{\n\tuint32 w = TIFFDataWidth((TIFFDataType) dir->tdir_type);\n\t/* \n\t * FIXME: butecount should have tsize_t type, but for now libtiff\n\t * defines tsize_t as a signed 32-bit integer and we are losing\n\t * ability to read arrays larger than 2^31 bytes. So we are using\n\t * uint32 instead of tsize_t here.\n\t */\n\tuint32 cc = dir->tdir_count * w;\n\n\t/* Check for overflow. */\n\tif (!dir->tdir_count || !w || cc / w != dir->tdir_count)\n\t\tgoto bad;\n\n\tif (!isMapped(tif)) {\n\t\tif (!SeekOK(tif, dir->tdir_offset))\n\t\t\tgoto bad;\n\t\tif (!ReadOK(tif, cp, cc))\n\t\t\tgoto bad;\n\t} else {\n\t\t/* Check for overflow. */\n\t\tif (dir->tdir_offset + cc < dir->tdir_offset\n\t\t    || dir->tdir_offset + cc < cc\n\t\t    || dir->tdir_offset + cc > tif->tif_size)\n\t\t\tgoto bad;\n\t\t_TIFFmemcpy(cp, tif->tif_base + dir->tdir_offset, cc);\n\t}\n\tif (tif->tif_flags & TIFF_SWAB) {\n\t\tswitch (dir->tdir_type) {\n\t\tcase TIFF_SHORT:\n\t\tcase TIFF_SSHORT:\n\t\t\tTIFFSwabArrayOfShort((uint16*) cp, dir->tdir_count);\n\t\t\tbreak;\n\t\tcase TIFF_LONG:\n\t\tcase TIFF_SLONG:\n\t\tcase TIFF_FLOAT:\n\t\t\tTIFFSwabArrayOfLong((uint32*) cp, dir->tdir_count);\n\t\t\tbreak;\n\t\tcase TIFF_RATIONAL:\n\t\tcase TIFF_SRATIONAL:\n\t\t\tTIFFSwabArrayOfLong((uint32*) cp, 2*dir->tdir_count);\n\t\t\tbreak;\n\t\tcase TIFF_DOUBLE:\n\t\t\tTIFFSwabArrayOfDouble((double*) cp, dir->tdir_count);\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn (cc);\nbad:\n\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t     \"Error fetching data for field \\\"%s\\\"\",\n\t\t     _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name);\n\treturn (tsize_t) 0;\n}\n\n/*\n * Fetch an ASCII item from the file.\n */\nstatic tsize_t\nTIFFFetchString(TIFF* tif, TIFFDirEntry* dir, char* cp)\n{\n\tif (dir->tdir_count <= 4) {\n\t\tuint32 l = dir->tdir_offset;\n\t\tif (tif->tif_flags & TIFF_SWAB)\n\t\t\tTIFFSwabLong(&l);\n\t\t_TIFFmemcpy(cp, &l, dir->tdir_count);\n\t\treturn (1);\n\t}\n\treturn (TIFFFetchData(tif, dir, cp));\n}\n\n/*\n * Convert numerator+denominator to float.\n */\nstatic int\ncvtRational(TIFF* tif, TIFFDirEntry* dir, uint32 num, uint32 denom, float* rv)\n{\n\tif (denom == 0) {\n\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t    \"%s: Rational with zero denominator (num = %u)\",\n\t\t    _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name, num);\n\t\treturn (0);\n\t} else {\n\t\tif (dir->tdir_type == TIFF_RATIONAL)\n\t\t\t*rv = ((float)num / (float)denom);\n\t\telse\n\t\t\t*rv = ((float)(int32)num / (float)(int32)denom);\n\t\treturn (1);\n\t}\n}\n\n/*\n * Fetch a rational item from the file at offset off and return the value as a\n * floating point number.\n */\nstatic float\nTIFFFetchRational(TIFF* tif, TIFFDirEntry* dir)\n{\n\tuint32 l[2];\n\tfloat v;\n\n\treturn (!TIFFFetchData(tif, dir, (char *)l) ||\n\t    !cvtRational(tif, dir, l[0], l[1], &v) ? 1.0f : v);\n}\n\n/*\n * Fetch a single floating point value from the offset field and return it as\n * a native float.\n */\nstatic float\nTIFFFetchFloat(TIFF* tif, TIFFDirEntry* dir)\n{\n\tfloat v;\n\tint32 l = TIFFExtractData(tif, dir->tdir_type, dir->tdir_offset);\n        _TIFFmemcpy(&v, &l, sizeof(float));\n\tTIFFCvtIEEEFloatToNative(tif, 1, &v);\n\treturn (v);\n}\n\n/*\n * Fetch an array of BYTE or SBYTE values.\n */\nstatic int\nTIFFFetchByteArray(TIFF* tif, TIFFDirEntry* dir, uint8* v)\n{\n    if (dir->tdir_count <= 4) {\n        /*\n         * Extract data from offset field.\n         */\n        if (tif->tif_header.tiff_magic == TIFF_BIGENDIAN) {\n\t    if (dir->tdir_type == TIFF_SBYTE)\n                switch (dir->tdir_count) {\n                    case 4: v[3] = dir->tdir_offset & 0xff;\n                    case 3: v[2] = (dir->tdir_offset >> 8) & 0xff;\n                    case 2: v[1] = (dir->tdir_offset >> 16) & 0xff;\n\t\t    case 1: v[0] = dir->tdir_offset >> 24;\n                }\n\t    else\n                switch (dir->tdir_count) {\n                    case 4: v[3] = dir->tdir_offset & 0xff;\n                    case 3: v[2] = (dir->tdir_offset >> 8) & 0xff;\n                    case 2: v[1] = (dir->tdir_offset >> 16) & 0xff;\n\t\t    case 1: v[0] = dir->tdir_offset >> 24;\n                }\n\t} else {\n\t    if (dir->tdir_type == TIFF_SBYTE)\n                switch (dir->tdir_count) {\n                    case 4: v[3] = dir->tdir_offset >> 24;\n                    case 3: v[2] = (dir->tdir_offset >> 16) & 0xff;\n                    case 2: v[1] = (dir->tdir_offset >> 8) & 0xff;\n                    case 1: v[0] = dir->tdir_offset & 0xff;\n\t\t}\n\t    else\n                switch (dir->tdir_count) {\n                    case 4: v[3] = dir->tdir_offset >> 24;\n                    case 3: v[2] = (dir->tdir_offset >> 16) & 0xff;\n                    case 2: v[1] = (dir->tdir_offset >> 8) & 0xff;\n                    case 1: v[0] = dir->tdir_offset & 0xff;\n\t\t}\n\t}\n        return (1);\n    } else\n        return (TIFFFetchData(tif, dir, (char*) v) != 0);\t/* XXX */\n}\n\n/*\n * Fetch an array of SHORT or SSHORT values.\n */\nstatic int\nTIFFFetchShortArray(TIFF* tif, TIFFDirEntry* dir, uint16* v)\n{\n\tif (dir->tdir_count <= 2) {\n\t\tif (tif->tif_header.tiff_magic == TIFF_BIGENDIAN) {\n\t\t\tswitch (dir->tdir_count) {\n\t\t\tcase 2: v[1] = (uint16) (dir->tdir_offset & 0xffff);\n\t\t\tcase 1: v[0] = (uint16) (dir->tdir_offset >> 16);\n\t\t\t}\n\t\t} else {\n\t\t\tswitch (dir->tdir_count) {\n\t\t\tcase 2: v[1] = (uint16) (dir->tdir_offset >> 16);\n\t\t\tcase 1: v[0] = (uint16) (dir->tdir_offset & 0xffff);\n\t\t\t}\n\t\t}\n\t\treturn (1);\n\t} else\n\t\treturn (TIFFFetchData(tif, dir, (char *)v) != 0);\n}\n\n/*\n * Fetch a pair of SHORT or BYTE values. Some tags may have either BYTE\n * or SHORT type and this function works with both ones.\n */\nstatic int\nTIFFFetchShortPair(TIFF* tif, TIFFDirEntry* dir)\n{\n\t/*\n\t * Prevent overflowing the v stack arrays below by performing a sanity\n\t * check on tdir_count, this should never be greater than two.\n\t */\n\tif (dir->tdir_count > 2) {\n\t\tTIFFWarningExt(tif->tif_clientdata, tif->tif_name,\n\t\t\"unexpected count for field \\\"%s\\\", %u, expected 2; ignored\",\n\t\t\t_TIFFFieldWithTag(tif, dir->tdir_tag)->field_name,\n\t\t\tdir->tdir_count);\n\t\treturn 0;\n\t}\n\n\tswitch (dir->tdir_type) {\n\t\tcase TIFF_BYTE:\n\t\tcase TIFF_SBYTE:\n\t\t\t{\n\t\t\tuint8 v[4];\n\t\t\treturn TIFFFetchByteArray(tif, dir, v)\n\t\t\t\t&& TIFFSetField(tif, dir->tdir_tag, v[0], v[1]);\n\t\t\t}\n\t\tcase TIFF_SHORT:\n\t\tcase TIFF_SSHORT:\n\t\t\t{\n\t\t\tuint16 v[2];\n\t\t\treturn TIFFFetchShortArray(tif, dir, v)\n\t\t\t\t&& TIFFSetField(tif, dir->tdir_tag, v[0], v[1]);\n\t\t\t}\n\t\tdefault:\n\t\t\treturn 0;\n\t}\n}\n\n/*\n * Fetch an array of LONG or SLONG values.\n */\nstatic int\nTIFFFetchLongArray(TIFF* tif, TIFFDirEntry* dir, uint32* v)\n{\n\tif (dir->tdir_count == 1) {\n\t\tv[0] = dir->tdir_offset;\n\t\treturn (1);\n\t} else\n\t\treturn (TIFFFetchData(tif, dir, (char*) v) != 0);\n}\n\n/*\n * Fetch an array of RATIONAL or SRATIONAL values.\n */\nstatic int\nTIFFFetchRationalArray(TIFF* tif, TIFFDirEntry* dir, float* v)\n{\n\tint ok = 0;\n\tuint32* l;\n\n\tl = (uint32*)_TIFFCheckMalloc(tif,\n\t    dir->tdir_count, TIFFDataWidth((TIFFDataType) dir->tdir_type),\n\t    \"to fetch array of rationals\");\n\tif (l) {\n\t\tif (TIFFFetchData(tif, dir, (char *)l)) {\n\t\t\tuint32 i;\n\t\t\tfor (i = 0; i < dir->tdir_count; i++) {\n\t\t\t\tok = cvtRational(tif, dir,\n\t\t\t\t    l[2*i+0], l[2*i+1], &v[i]);\n\t\t\t\tif (!ok)\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t_TIFFfree((char *)l);\n\t}\n\treturn (ok);\n}\n\n/*\n * Fetch an array of FLOAT values.\n */\nstatic int\nTIFFFetchFloatArray(TIFF* tif, TIFFDirEntry* dir, float* v)\n{\n\n\tif (dir->tdir_count == 1) {\n\t        union\n\t\t{\n\t\t  float  f;\n\t\t  uint32 i;\n\t\t} float_union;\n\n\t\tfloat_union.i=dir->tdir_offset;\n\t\tv[0]=float_union.f;\n\t\tTIFFCvtIEEEFloatToNative(tif, dir->tdir_count, v);\n\t\treturn (1);\n\t} else\tif (TIFFFetchData(tif, dir, (char*) v)) {\n\t\tTIFFCvtIEEEFloatToNative(tif, dir->tdir_count, v);\n\t\treturn (1);\n\t} else\n\t\treturn (0);\n}\n\n/*\n * Fetch an array of DOUBLE values.\n */\nstatic int\nTIFFFetchDoubleArray(TIFF* tif, TIFFDirEntry* dir, double* v)\n{\n\tif (TIFFFetchData(tif, dir, (char*) v)) {\n\t\tTIFFCvtIEEEDoubleToNative(tif, dir->tdir_count, v);\n\t\treturn (1);\n\t} else\n\t\treturn (0);\n}\n\n/*\n * Fetch an array of ANY values.  The actual values are returned as doubles\n * which should be able hold all the types.  Yes, there really should be an\n * tany_t to avoid this potential non-portability ...  Note in particular that\n * we assume that the double return value vector is large enough to read in\n * any fundamental type.  We use that vector as a buffer to read in the base\n * type vector and then convert it in place to double (from end to front of\n * course).\n */\nstatic int\nTIFFFetchAnyArray(TIFF* tif, TIFFDirEntry* dir, double* v)\n{\n\tint i;\n\n\tswitch (dir->tdir_type) {\n\tcase TIFF_BYTE:\n\tcase TIFF_SBYTE:\n\t\tif (!TIFFFetchByteArray(tif, dir, (uint8*) v))\n\t\t\treturn (0);\n\t\tif (dir->tdir_type == TIFF_BYTE) {\n\t\t\tuint8* vp = (uint8*) v;\n\t\t\tfor (i = dir->tdir_count-1; i >= 0; i--)\n\t\t\t\tv[i] = vp[i];\n\t\t} else {\n\t\t\tint8* vp = (int8*) v;\n\t\t\tfor (i = dir->tdir_count-1; i >= 0; i--)\n\t\t\t\tv[i] = vp[i];\n\t\t}\n\t\tbreak;\n\tcase TIFF_SHORT:\n\tcase TIFF_SSHORT:\n\t\tif (!TIFFFetchShortArray(tif, dir, (uint16*) v))\n\t\t\treturn (0);\n\t\tif (dir->tdir_type == TIFF_SHORT) {\n\t\t\tuint16* vp = (uint16*) v;\n\t\t\tfor (i = dir->tdir_count-1; i >= 0; i--)\n\t\t\t\tv[i] = vp[i];\n\t\t} else {\n\t\t\tint16* vp = (int16*) v;\n\t\t\tfor (i = dir->tdir_count-1; i >= 0; i--)\n\t\t\t\tv[i] = vp[i];\n\t\t}\n\t\tbreak;\n\tcase TIFF_LONG:\n\tcase TIFF_SLONG:\n\t\tif (!TIFFFetchLongArray(tif, dir, (uint32*) v))\n\t\t\treturn (0);\n\t\tif (dir->tdir_type == TIFF_LONG) {\n\t\t\tuint32* vp = (uint32*) v;\n\t\t\tfor (i = dir->tdir_count-1; i >= 0; i--)\n\t\t\t\tv[i] = vp[i];\n\t\t} else {\n\t\t\tint32* vp = (int32*) v;\n\t\t\tfor (i = dir->tdir_count-1; i >= 0; i--)\n\t\t\t\tv[i] = vp[i];\n\t\t}\n\t\tbreak;\n\tcase TIFF_RATIONAL:\n\tcase TIFF_SRATIONAL:\n\t\tif (!TIFFFetchRationalArray(tif, dir, (float*) v))\n\t\t\treturn (0);\n\t\t{ float* vp = (float*) v;\n\t\t  for (i = dir->tdir_count-1; i >= 0; i--)\n\t\t\tv[i] = vp[i];\n\t\t}\n\t\tbreak;\n\tcase TIFF_FLOAT:\n\t\tif (!TIFFFetchFloatArray(tif, dir, (float*) v))\n\t\t\treturn (0);\n\t\t{ float* vp = (float*) v;\n\t\t  for (i = dir->tdir_count-1; i >= 0; i--)\n\t\t\tv[i] = vp[i];\n\t\t}\n\t\tbreak;\n\tcase TIFF_DOUBLE:\n\t\treturn (TIFFFetchDoubleArray(tif, dir, (double*) v));\n\tdefault:\n\t\t/* TIFF_NOTYPE */\n\t\t/* TIFF_ASCII */\n\t\t/* TIFF_UNDEFINED */\n\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t\t     \"cannot read TIFF_ANY type %d for field \\\"%s\\\"\",\n\t\t\t     dir->tdir_type,\n\t\t\t     _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name);\n\t\treturn (0);\n\t}\n\treturn (1);\n}\n\n/*\n * Fetch a tag that is not handled by special case code.\n */\nstatic int\nTIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp)\n{\n\tstatic const char mesg[] = \"to fetch tag value\";\n\tint ok = 0;\n\tconst TIFFFieldInfo* fip = _TIFFFieldWithTag(tif, dp->tdir_tag);\n\n\tif (dp->tdir_count > 1) {\t\t/* array of values */\n\t\tchar* cp = NULL;\n\n\t\tswitch (dp->tdir_type) {\n\t\tcase TIFF_BYTE:\n\t\tcase TIFF_SBYTE:\n\t\t\tcp = (char *)_TIFFCheckMalloc(tif,\n\t\t\t    dp->tdir_count, sizeof (uint8), mesg);\n\t\t\tok = cp && TIFFFetchByteArray(tif, dp, (uint8*) cp);\n\t\t\tbreak;\n\t\tcase TIFF_SHORT:\n\t\tcase TIFF_SSHORT:\n\t\t\tcp = (char *)_TIFFCheckMalloc(tif,\n\t\t\t    dp->tdir_count, sizeof (uint16), mesg);\n\t\t\tok = cp && TIFFFetchShortArray(tif, dp, (uint16*) cp);\n\t\t\tbreak;\n\t\tcase TIFF_LONG:\n\t\tcase TIFF_SLONG:\n\t\t\tcp = (char *)_TIFFCheckMalloc(tif,\n\t\t\t    dp->tdir_count, sizeof (uint32), mesg);\n\t\t\tok = cp && TIFFFetchLongArray(tif, dp, (uint32*) cp);\n\t\t\tbreak;\n\t\tcase TIFF_RATIONAL:\n\t\tcase TIFF_SRATIONAL:\n\t\t\tcp = (char *)_TIFFCheckMalloc(tif,\n\t\t\t    dp->tdir_count, sizeof (float), mesg);\n\t\t\tok = cp && TIFFFetchRationalArray(tif, dp, (float*) cp);\n\t\t\tbreak;\n\t\tcase TIFF_FLOAT:\n\t\t\tcp = (char *)_TIFFCheckMalloc(tif,\n\t\t\t    dp->tdir_count, sizeof (float), mesg);\n\t\t\tok = cp && TIFFFetchFloatArray(tif, dp, (float*) cp);\n\t\t\tbreak;\n\t\tcase TIFF_DOUBLE:\n\t\t\tcp = (char *)_TIFFCheckMalloc(tif,\n\t\t\t    dp->tdir_count, sizeof (double), mesg);\n\t\t\tok = cp && TIFFFetchDoubleArray(tif, dp, (double*) cp);\n\t\t\tbreak;\n\t\tcase TIFF_ASCII:\n\t\tcase TIFF_UNDEFINED:\t\t/* bit of a cheat... */\n\t\t\t/*\n\t\t\t * Some vendors write strings w/o the trailing\n\t\t\t * NULL byte, so always append one just in case.\n\t\t\t */\n\t\t\tcp = (char *)_TIFFCheckMalloc(tif, dp->tdir_count + 1,\n\t\t\t\t\t\t      1, mesg);\n\t\t\tif( (ok = (cp && TIFFFetchString(tif, dp, cp))) != 0 )\n\t\t\t\tcp[dp->tdir_count] = '\\0';\t/* XXX */\n\t\t\tbreak;\n\t\t}\n\t\tif (ok) {\n\t\t\tok = (fip->field_passcount ?\n\t\t\t    TIFFSetField(tif, dp->tdir_tag, dp->tdir_count, cp)\n\t\t\t  : TIFFSetField(tif, dp->tdir_tag, cp));\n\t\t}\n\t\tif (cp != NULL)\n\t\t\t_TIFFfree(cp);\n\t} else if (CheckDirCount(tif, dp, 1)) {\t/* singleton value */\n\t\tswitch (dp->tdir_type) {\n\t\tcase TIFF_BYTE:\n\t\tcase TIFF_SBYTE:\n\t\tcase TIFF_SHORT:\n\t\tcase TIFF_SSHORT:\n\t\t\t/*\n\t\t\t * If the tag is also acceptable as a LONG or SLONG\n\t\t\t * then TIFFSetField will expect an uint32 parameter\n\t\t\t * passed to it (through varargs).  Thus, for machines\n\t\t\t * where sizeof (int) != sizeof (uint32) we must do\n\t\t\t * a careful check here.  It's hard to say if this\n\t\t\t * is worth optimizing.\n\t\t\t *\n\t\t\t * NB: We use TIFFFieldWithTag here knowing that\n\t\t\t *     it returns us the first entry in the table\n\t\t\t *     for the tag and that that entry is for the\n\t\t\t *     widest potential data type the tag may have.\n\t\t\t */\n\t\t\t{ TIFFDataType type = fip->field_type;\n\t\t\t  if (type != TIFF_LONG && type != TIFF_SLONG) {\n\t\t\t\tuint16 v = (uint16)\n\t\t\t   TIFFExtractData(tif, dp->tdir_type, dp->tdir_offset);\n\t\t\t\tok = (fip->field_passcount ?\n\t\t\t\t    TIFFSetField(tif, dp->tdir_tag, 1, &v)\n\t\t\t\t  : TIFFSetField(tif, dp->tdir_tag, v));\n\t\t\t\tbreak;\n\t\t\t  }\n\t\t\t}\n\t\t\t/* fall thru... */\n\t\tcase TIFF_LONG:\n\t\tcase TIFF_SLONG:\n\t\t\t{ uint32 v32 =\n\t\t    TIFFExtractData(tif, dp->tdir_type, dp->tdir_offset);\n\t\t\t  ok = (fip->field_passcount ? \n\t\t\t      TIFFSetField(tif, dp->tdir_tag, 1, &v32)\n\t\t\t    : TIFFSetField(tif, dp->tdir_tag, v32));\n\t\t\t}\n\t\t\tbreak;\n\t\tcase TIFF_RATIONAL:\n\t\tcase TIFF_SRATIONAL:\n\t\tcase TIFF_FLOAT:\n\t\t\t{ float v = (dp->tdir_type == TIFF_FLOAT ? \n\t\t\t      TIFFFetchFloat(tif, dp)\n\t\t\t    : TIFFFetchRational(tif, dp));\n\t\t\t  ok = (fip->field_passcount ?\n\t\t\t      TIFFSetField(tif, dp->tdir_tag, 1, &v)\n\t\t\t    : TIFFSetField(tif, dp->tdir_tag, v));\n\t\t\t}\n\t\t\tbreak;\n\t\tcase TIFF_DOUBLE:\n\t\t\t{ double v;\n\t\t\t  ok = (TIFFFetchDoubleArray(tif, dp, &v) &&\n\t\t\t    (fip->field_passcount ?\n\t\t\t      TIFFSetField(tif, dp->tdir_tag, 1, &v)\n\t\t\t    : TIFFSetField(tif, dp->tdir_tag, v))\n\t\t\t  );\n\t\t\t}\n\t\t\tbreak;\n\t\tcase TIFF_ASCII:\n\t\tcase TIFF_UNDEFINED:\t\t/* bit of a cheat... */\n\t\t\t{ char c[2];\n\t\t\t  if( (ok = (TIFFFetchString(tif, dp, c) != 0)) != 0 ) {\n\t\t\t\tc[1] = '\\0';\t\t/* XXX paranoid */\n\t\t\t\tok = (fip->field_passcount ?\n\t\t\t\t\tTIFFSetField(tif, dp->tdir_tag, 1, c)\n\t\t\t\t      : TIFFSetField(tif, dp->tdir_tag, c));\n\t\t\t  }\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn (ok);\n}\n\n#define\tNITEMS(x)\t(sizeof (x) / sizeof (x[0]))\n/*\n * Fetch samples/pixel short values for \n * the specified tag and verify that\n * all values are the same.\n */\nstatic int\nTIFFFetchPerSampleShorts(TIFF* tif, TIFFDirEntry* dir, uint16* pl)\n{\n    uint16 samples = tif->tif_dir.td_samplesperpixel;\n    int status = 0;\n\n    if (CheckDirCount(tif, dir, (uint32) samples)) {\n        uint16 buf[10];\n        uint16* v = buf;\n\n        if (dir->tdir_count > NITEMS(buf))\n            v = (uint16*) _TIFFCheckMalloc(tif, dir->tdir_count, sizeof(uint16),\n                                      \"to fetch per-sample values\");\n        if (v && TIFFFetchShortArray(tif, dir, v)) {\n            uint16 i;\n            int check_count = dir->tdir_count;\n            if( samples < check_count )\n                check_count = samples;\n\n            for (i = 1; i < check_count; i++)\n                if (v[i] != v[0]) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n                \"Cannot handle different per-sample values for field \\\"%s\\\"\",\n\t\t\t_TIFFFieldWithTag(tif, dir->tdir_tag)->field_name);\n\t\t\tgoto bad;\n                }\n            *pl = v[0];\n            status = 1;\n        }\n      bad:\n        if (v && v != buf)\n            _TIFFfree(v);\n    }\n    return (status);\n}\n\n/*\n * Fetch samples/pixel long values for \n * the specified tag and verify that\n * all values are the same.\n */\nstatic int\nTIFFFetchPerSampleLongs(TIFF* tif, TIFFDirEntry* dir, uint32* pl)\n{\n    uint16 samples = tif->tif_dir.td_samplesperpixel;\n    int status = 0;\n\n    if (CheckDirCount(tif, dir, (uint32) samples)) {\n        uint32 buf[10];\n        uint32* v = buf;\n\n        if (dir->tdir_count > NITEMS(buf))\n            v = (uint32*) _TIFFCheckMalloc(tif, dir->tdir_count, sizeof(uint32),\n                                      \"to fetch per-sample values\");\n        if (v && TIFFFetchLongArray(tif, dir, v)) {\n            uint16 i;\n            int check_count = dir->tdir_count;\n\n            if( samples < check_count )\n                check_count = samples;\n            for (i = 1; i < check_count; i++)\n                if (v[i] != v[0]) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n                \"Cannot handle different per-sample values for field \\\"%s\\\"\",\n\t\t\t_TIFFFieldWithTag(tif, dir->tdir_tag)->field_name);\n\t\t\tgoto bad;\n                }\n            *pl = v[0];\n            status = 1;\n        }\n      bad:\n        if (v && v != buf)\n            _TIFFfree(v);\n    }\n    return (status);\n}\n\n/*\n * Fetch samples/pixel ANY values for the specified tag and verify that all\n * values are the same.\n */\nstatic int\nTIFFFetchPerSampleAnys(TIFF* tif, TIFFDirEntry* dir, double* pl)\n{\n    uint16 samples = tif->tif_dir.td_samplesperpixel;\n    int status = 0;\n\n    if (CheckDirCount(tif, dir, (uint32) samples)) {\n        double buf[10];\n        double* v = buf;\n\n        if (dir->tdir_count > NITEMS(buf))\n            v = (double*) _TIFFCheckMalloc(tif, dir->tdir_count, sizeof (double),\n                                      \"to fetch per-sample values\");\n        if (v && TIFFFetchAnyArray(tif, dir, v)) {\n            uint16 i;\n            int check_count = dir->tdir_count;\n            if( samples < check_count )\n                check_count = samples;\n\n            for (i = 1; i < check_count; i++)\n                if (v[i] != v[0]) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t\"Cannot handle different per-sample values for field \\\"%s\\\"\",\n\t\t\t_TIFFFieldWithTag(tif, dir->tdir_tag)->field_name);\n\t\t\tgoto bad;\n                }\n            *pl = v[0];\n            status = 1;\n        }\n      bad:\n        if (v && v != buf)\n            _TIFFfree(v);\n    }\n    return (status);\n}\n#undef NITEMS\n\n/*\n * Fetch a set of offsets or lengths.\n * While this routine says \"strips\", in fact it's also used for tiles.\n */\nstatic int\nTIFFFetchStripThing(TIFF* tif, TIFFDirEntry* dir, long nstrips, uint32** lpp)\n{\n\tregister uint32* lp;\n\tint status;\n\n        CheckDirCount(tif, dir, (uint32) nstrips);\n\n\t/*\n\t * Allocate space for strip information.\n\t */\n\tif (*lpp == NULL &&\n\t    (*lpp = (uint32 *)_TIFFCheckMalloc(tif,\n\t      nstrips, sizeof (uint32), \"for strip array\")) == NULL)\n\t\treturn (0);\n\tlp = *lpp;\n        _TIFFmemset( lp, 0, sizeof(uint32) * nstrips );\n\n\tif (dir->tdir_type == (int)TIFF_SHORT) {\n\t\t/*\n\t\t * Handle uint16->uint32 expansion.\n\t\t */\n\t\tuint16* dp = (uint16*) _TIFFCheckMalloc(tif,\n\t\t    dir->tdir_count, sizeof (uint16), \"to fetch strip tag\");\n\t\tif (dp == NULL)\n\t\t\treturn (0);\n\t\tif( (status = TIFFFetchShortArray(tif, dir, dp)) != 0 ) {\n                    int i;\n                    \n                    for( i = 0; i < nstrips && i < (int) dir->tdir_count; i++ )\n                    {\n                        lp[i] = dp[i];\n                    }\n\t\t}\n\t\t_TIFFfree((char*) dp);\n\n        } else if( nstrips != (int) dir->tdir_count ) {\n            /* Special case to correct length */\n\n            uint32* dp = (uint32*) _TIFFCheckMalloc(tif,\n\t\t    dir->tdir_count, sizeof (uint32), \"to fetch strip tag\");\n            if (dp == NULL)\n                return (0);\n\n            status = TIFFFetchLongArray(tif, dir, dp);\n            if( status != 0 ) {\n                int i;\n\n                for( i = 0; i < nstrips && i < (int) dir->tdir_count; i++ )\n                {\n                    lp[i] = dp[i];\n                }\n            }\n\n            _TIFFfree( (char *) dp );\n\t} else\n            status = TIFFFetchLongArray(tif, dir, lp);\n        \n\treturn (status);\n}\n\n/*\n * Fetch and set the RefBlackWhite tag.\n */\nstatic int\nTIFFFetchRefBlackWhite(TIFF* tif, TIFFDirEntry* dir)\n{\n\tstatic const char mesg[] = \"for \\\"ReferenceBlackWhite\\\" array\";\n\tchar* cp;\n\tint ok;\n\n\tif (dir->tdir_type == TIFF_RATIONAL)\n\t\treturn (TIFFFetchNormalTag(tif, dir));\n\t/*\n\t * Handle LONG's for backward compatibility.\n\t */\n\tcp = (char *)_TIFFCheckMalloc(tif, dir->tdir_count,\n\t\t\t\t      sizeof (uint32), mesg);\n\tif( (ok = (cp && TIFFFetchLongArray(tif, dir, (uint32*) cp))) != 0) {\n\t\tfloat* fp = (float*)\n\t\t    _TIFFCheckMalloc(tif, dir->tdir_count, sizeof (float), mesg);\n\t\tif( (ok = (fp != NULL)) != 0 ) {\n\t\t\tuint32 i;\n\t\t\tfor (i = 0; i < dir->tdir_count; i++)\n\t\t\t\tfp[i] = (float)((uint32*) cp)[i];\n\t\t\tok = TIFFSetField(tif, dir->tdir_tag, fp);\n\t\t\t_TIFFfree((char*) fp);\n\t\t}\n\t}\n\tif (cp)\n\t\t_TIFFfree(cp);\n\treturn (ok);\n}\n\n/*\n * Fetch and set the SubjectDistance EXIF tag.\n */\nstatic int\nTIFFFetchSubjectDistance(TIFF* tif, TIFFDirEntry* dir)\n{\n\tuint32 l[2];\n\tfloat v;\n\tint ok = 0;\n\n\tif (TIFFFetchData(tif, dir, (char *)l)\n\t    && cvtRational(tif, dir, l[0], l[1], &v)) {\n\t\t/*\n\t\t * XXX: Numerator 0xFFFFFFFF means that we have infinite\n\t\t * distance. Indicate that with a negative floating point\n\t\t * SubjectDistance value.\n\t\t */\n\t\tok = TIFFSetField(tif, dir->tdir_tag,\n\t\t\t\t  (l[0] != 0xFFFFFFFF) ? v : -v);\n\t}\n\n\treturn ok;\n}\n\n/*\n * Replace a single strip (tile) of uncompressed data by multiple strips\n * (tiles), each approximately STRIP_SIZE_DEFAULT bytes. This is useful for\n * dealing with large images or for dealing with machines with a limited\n * amount memory.\n */\nstatic void\nChopUpSingleUncompressedStrip(TIFF* tif)\n{\n\tregister TIFFDirectory *td = &tif->tif_dir;\n\tuint32 bytecount = td->td_stripbytecount[0];\n\tuint32 offset = td->td_stripoffset[0];\n\ttsize_t rowbytes = TIFFVTileSize(tif, 1), stripbytes;\n\ttstrip_t strip, nstrips, rowsperstrip;\n\tuint32* newcounts;\n\tuint32* newoffsets;\n\n\t/*\n\t * Make the rows hold at least one scanline, but fill specified amount\n\t * of data if possible.\n\t */\n\tif (rowbytes > STRIP_SIZE_DEFAULT) {\n\t\tstripbytes = rowbytes;\n\t\trowsperstrip = 1;\n\t} else if (rowbytes > 0 ) {\n\t\trowsperstrip = STRIP_SIZE_DEFAULT / rowbytes;\n\t\tstripbytes = rowbytes * rowsperstrip;\n\t}\n        else\n            return;\n\n\t/* \n\t * never increase the number of strips in an image\n\t */\n\tif (rowsperstrip >= td->td_rowsperstrip)\n\t\treturn;\n\tnstrips = (tstrip_t) TIFFhowmany(bytecount, stripbytes);\n        if( nstrips == 0 ) /* something is wonky, do nothing. */\n            return;\n\n\tnewcounts = (uint32*) _TIFFCheckMalloc(tif, nstrips, sizeof (uint32),\n\t\t\t\t\"for chopped \\\"StripByteCounts\\\" array\");\n\tnewoffsets = (uint32*) _TIFFCheckMalloc(tif, nstrips, sizeof (uint32),\n\t\t\t\t\"for chopped \\\"StripOffsets\\\" array\");\n\tif (newcounts == NULL || newoffsets == NULL) {\n\t        /*\n\t\t * Unable to allocate new strip information, give up and use\n\t\t * the original one strip information.\n\t\t */\n\t\tif (newcounts != NULL)\n\t\t\t_TIFFfree(newcounts);\n\t\tif (newoffsets != NULL)\n\t\t\t_TIFFfree(newoffsets);\n\t\treturn;\n\t}\n\t/*\n\t * Fill the strip information arrays with new bytecounts and offsets\n\t * that reflect the broken-up format.\n\t */\n\tfor (strip = 0; strip < nstrips; strip++) {\n\t\tif ((uint32)stripbytes > bytecount)\n\t\t\tstripbytes = bytecount;\n\t\tnewcounts[strip] = stripbytes;\n\t\tnewoffsets[strip] = offset;\n\t\toffset += stripbytes;\n\t\tbytecount -= stripbytes;\n\t}\n\t/*\n\t * Replace old single strip info with multi-strip info.\n\t */\n\ttd->td_stripsperimage = td->td_nstrips = nstrips;\n\tTIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, rowsperstrip);\n\n\t_TIFFfree(td->td_stripbytecount);\n\t_TIFFfree(td->td_stripoffset);\n\ttd->td_stripbytecount = newcounts;\n\ttd->td_stripoffset = newoffsets;\n\ttd->td_stripbytecountsorted = 1;\n}\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/tif_dirwrite.c",
    "content": "/* $Id: tif_dirwrite.c,v 1.37.2.6 2009-10-31 21:51:08 bfriesen Exp $ */\n\n/*\n * Copyright (c) 1988-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n/*\n * TIFF Library.\n *\n * Directory Write Support Routines.\n */\n#include \"tiffiop.h\"\n\n#ifdef HAVE_IEEEFP\n# define\tTIFFCvtNativeToIEEEFloat(tif, n, fp)\n# define\tTIFFCvtNativeToIEEEDouble(tif, n, dp)\n#else\nextern\tvoid TIFFCvtNativeToIEEEFloat(TIFF*, uint32, float*);\nextern\tvoid TIFFCvtNativeToIEEEDouble(TIFF*, uint32, double*);\n#endif\n\nstatic\tint TIFFWriteNormalTag(TIFF*, TIFFDirEntry*, const TIFFFieldInfo*);\nstatic\tvoid TIFFSetupShortLong(TIFF*, ttag_t, TIFFDirEntry*, uint32);\nstatic\tvoid TIFFSetupShort(TIFF*, ttag_t, TIFFDirEntry*, uint16);\nstatic\tint TIFFSetupShortPair(TIFF*, ttag_t, TIFFDirEntry*);\nstatic\tint TIFFWritePerSampleShorts(TIFF*, ttag_t, TIFFDirEntry*);\nstatic\tint TIFFWritePerSampleAnys(TIFF*, TIFFDataType, ttag_t, TIFFDirEntry*);\nstatic\tint TIFFWriteShortTable(TIFF*, ttag_t, TIFFDirEntry*, uint32, uint16**);\nstatic\tint TIFFWriteShortArray(TIFF*, TIFFDirEntry*, uint16*);\nstatic\tint TIFFWriteLongArray(TIFF *, TIFFDirEntry*, uint32*);\nstatic\tint TIFFWriteRationalArray(TIFF *, TIFFDirEntry*, float*);\nstatic\tint TIFFWriteFloatArray(TIFF *, TIFFDirEntry*, float*);\nstatic\tint TIFFWriteDoubleArray(TIFF *, TIFFDirEntry*, double*);\nstatic\tint TIFFWriteByteArray(TIFF*, TIFFDirEntry*, char*);\nstatic\tint TIFFWriteAnyArray(TIFF*,\n\t    TIFFDataType, ttag_t, TIFFDirEntry*, uint32, double*);\nstatic\tint TIFFWriteTransferFunction(TIFF*, TIFFDirEntry*);\nstatic\tint TIFFWriteInkNames(TIFF*, TIFFDirEntry*);\nstatic\tint TIFFWriteData(TIFF*, TIFFDirEntry*, char*);\nstatic\tint TIFFLinkDirectory(TIFF*);\n\n#define\tWriteRationalPair(type, tag1, v1, tag2, v2) {\t\t\\\n\tTIFFWriteRational((tif), (type), (tag1), (dir), (v1))\t\\\n\tTIFFWriteRational((tif), (type), (tag2), (dir)+1, (v2))\t\\\n\t(dir)++;\t\t\t\t\t\t\\\n}\n#define\tTIFFWriteRational(tif, type, tag, dir, v)\t\t\\\n\t(dir)->tdir_tag = (tag);\t\t\t\t\\\n\t(dir)->tdir_type = (type);\t\t\t\t\\\n\t(dir)->tdir_count = 1;\t\t\t\t\t\\\n\tif (!TIFFWriteRationalArray((tif), (dir), &(v)))\t\\\n\t\tgoto bad;\n\n/*\n * Write the contents of the current directory\n * to the specified file.  This routine doesn't\n * handle overwriting a directory with auxiliary\n * storage that's been changed.\n */\nstatic int\n_TIFFWriteDirectory(TIFF* tif, int done)\n{\n\tuint16 dircount;\n\ttoff_t diroff;\n\tttag_t tag;\n\tuint32 nfields;\n\ttsize_t dirsize;\n\tchar* data;\n\tTIFFDirEntry* dir;\n\tTIFFDirectory* td;\n\tunsigned long b, fields[FIELD_SETLONGS];\n\tint fi, nfi;\n\n\tif (tif->tif_mode == O_RDONLY)\n\t\treturn (1);\n\t/*\n\t * Clear write state so that subsequent images with\n\t * different characteristics get the right buffers\n\t * setup for them.\n\t */\n\tif (done)\n\t{\n\t\tif (tif->tif_flags & TIFF_POSTENCODE) {\n\t\t\ttif->tif_flags &= ~TIFF_POSTENCODE;\n\t\t\tif (!(*tif->tif_postencode)(tif)) {\n\t\t\t\tTIFFErrorExt(tif->tif_clientdata,\n\t\t\t\t\t     tif->tif_name,\n\t\t\t\t\"Error post-encoding before directory write\");\n\t\t\t\treturn (0);\n\t\t\t}\n\t\t}\n\t\t(*tif->tif_close)(tif);\t\t/* shutdown encoder */\n\t\t/*\n\t\t * Flush any data that might have been written\n \t\t * by the compression close+cleanup routines.\n\t\t */\n\t\tif (tif->tif_rawcc > 0\n                    && (tif->tif_flags & TIFF_BEENWRITING) != 0\n                    && !TIFFFlushData1(tif)) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t\t    \"Error flushing data before directory write\");\n\t\t\treturn (0);\n\t\t}\n\t\tif ((tif->tif_flags & TIFF_MYBUFFER) && tif->tif_rawdata) {\n\t\t\t_TIFFfree(tif->tif_rawdata);\n\t\t\ttif->tif_rawdata = NULL;\n\t\t\ttif->tif_rawcc = 0;\n\t\t\ttif->tif_rawdatasize = 0;\n\t\t}\n\t\ttif->tif_flags &= ~(TIFF_BEENWRITING|TIFF_BUFFERSETUP);\n\t}\n\n\ttd = &tif->tif_dir;\n\t/*\n\t * Size the directory so that we can calculate\n\t * offsets for the data items that aren't kept\n\t * in-place in each field.\n\t */\n\tnfields = 0;\n\tfor (b = 0; b <= FIELD_LAST; b++)\n\t\tif (TIFFFieldSet(tif, b) && b != FIELD_CUSTOM)\n\t\t\tnfields += (b < FIELD_SUBFILETYPE ? 2 : 1);\n\tnfields += td->td_customValueCount;\n\tdirsize = nfields * sizeof (TIFFDirEntry);\n\tdata = (char*) _TIFFmalloc(dirsize);\n\tif (data == NULL) {\n\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t\t     \"Cannot write directory, out of space\");\n\t\treturn (0);\n\t}\n\t/*\n\t * Directory hasn't been placed yet, put\n\t * it at the end of the file and link it\n\t * into the existing directory structure.\n\t */\n\tif (tif->tif_diroff == 0 && !TIFFLinkDirectory(tif))\n\t\tgoto bad;\n\ttif->tif_dataoff = (toff_t)(\n\t    tif->tif_diroff + sizeof (uint16) + dirsize + sizeof (toff_t));\n\tif (tif->tif_dataoff & 1)\n\t\ttif->tif_dataoff++;\n\t(void) TIFFSeekFile(tif, tif->tif_dataoff, SEEK_SET);\n\ttif->tif_curdir++;\n\tdir = (TIFFDirEntry*) data;\n\t/*\n\t * Setup external form of directory\n\t * entries and write data items.\n\t */\n\t_TIFFmemcpy(fields, td->td_fieldsset, sizeof (fields));\n\t/*\n\t * Write out ExtraSamples tag only if\n\t * extra samples are present in the data.\n\t */\n\tif (FieldSet(fields, FIELD_EXTRASAMPLES) && !td->td_extrasamples) {\n\t\tResetFieldBit(fields, FIELD_EXTRASAMPLES);\n\t\tnfields--;\n\t\tdirsize -= sizeof (TIFFDirEntry);\n\t}\t\t\t\t\t\t\t\t/*XXX*/\n\tfor (fi = 0, nfi = tif->tif_nfields; nfi > 0; nfi--, fi++) {\n\t\tconst TIFFFieldInfo* fip = tif->tif_fieldinfo[fi];\n\n\t\t/*\n\t\t * For custom fields, we test to see if the custom field\n\t\t * is set or not.  For normal fields, we just use the\n\t\t * FieldSet test.\n\t\t*/\n\t\tif( fip->field_bit == FIELD_CUSTOM )\n\t\t{\n\t\t\tint ci, is_set = FALSE;\n\n\t\t\tfor( ci = 0; ci < td->td_customValueCount; ci++ )\n\t\t\t\tis_set |= (td->td_customValues[ci].info == fip);\n\n\t\t\tif( !is_set )\n\t\t\t\tcontinue;\n\t\t}\n\t\telse if (!FieldSet(fields, fip->field_bit))\n\t\t\tcontinue;\n\n\t\t/*\n\t\t * Handle other fields.\n\t\t */\n\t\tswitch (fip->field_bit)\n\t\t{\n\t\tcase FIELD_STRIPOFFSETS:\n\t\t\t/*\n\t\t\t * We use one field bit for both strip and tile\n\n\t\t\t * offsets, and so must be careful in selecting\n\t\t\t * the appropriate field descriptor (so that tags\n\t\t\t * are written in sorted order).\n\t\t\t */\n\t\t\ttag = isTiled(tif) ?\n\t\t\t    TIFFTAG_TILEOFFSETS : TIFFTAG_STRIPOFFSETS;\n\t\t\tif (tag != fip->field_tag)\n\t\t\t\tcontinue;\n\t\t\t\n\t\t\tdir->tdir_tag = (uint16) tag;\n\t\t\tdir->tdir_type = (uint16) TIFF_LONG;\n\t\t\tdir->tdir_count = (uint32) td->td_nstrips;\n\t\t\tif (!TIFFWriteLongArray(tif, dir, td->td_stripoffset))\n\t\t\t\tgoto bad;\n\t\t\tbreak;\n\t\tcase FIELD_STRIPBYTECOUNTS:\n\t\t\t/*\n\t\t\t * We use one field bit for both strip and tile\n\t\t\t * byte counts, and so must be careful in selecting\n\t\t\t * the appropriate field descriptor (so that tags\n\t\t\t * are written in sorted order).\n\t\t\t */\n\t\t\ttag = isTiled(tif) ?\n\t\t\t    TIFFTAG_TILEBYTECOUNTS : TIFFTAG_STRIPBYTECOUNTS;\n\t\t\tif (tag != fip->field_tag)\n\t\t\t\tcontinue;\n\t\t\t\n\t\t\tdir->tdir_tag = (uint16) tag;\n\t\t\tdir->tdir_type = (uint16) TIFF_LONG;\n\t\t\tdir->tdir_count = (uint32) td->td_nstrips;\n\t\t\tif (!TIFFWriteLongArray(tif, dir, td->td_stripbytecount))\n\t\t\t\tgoto bad;\n\t\t\tbreak;\n\t\tcase FIELD_ROWSPERSTRIP:\n\t\t\tTIFFSetupShortLong(tif, TIFFTAG_ROWSPERSTRIP,\n\t\t\t    dir, td->td_rowsperstrip);\n\t\t\tbreak;\n\t\tcase FIELD_COLORMAP:\n\t\t\tif (!TIFFWriteShortTable(tif, TIFFTAG_COLORMAP, dir,\n\t\t\t    3, td->td_colormap))\n\t\t\t\tgoto bad;\n\t\t\tbreak;\n\t\tcase FIELD_IMAGEDIMENSIONS:\n\t\t\tTIFFSetupShortLong(tif, TIFFTAG_IMAGEWIDTH,\n\t\t\t    dir++, td->td_imagewidth);\n\t\t\tTIFFSetupShortLong(tif, TIFFTAG_IMAGELENGTH,\n\t\t\t    dir, td->td_imagelength);\n\t\t\tbreak;\n\t\tcase FIELD_TILEDIMENSIONS:\n\t\t\tTIFFSetupShortLong(tif, TIFFTAG_TILEWIDTH,\n\t\t\t    dir++, td->td_tilewidth);\n\t\t\tTIFFSetupShortLong(tif, TIFFTAG_TILELENGTH,\n\t\t\t    dir, td->td_tilelength);\n\t\t\tbreak;\n\t\tcase FIELD_COMPRESSION:\n\t\t\tTIFFSetupShort(tif, TIFFTAG_COMPRESSION,\n\t\t\t    dir, td->td_compression);\n\t\t\tbreak;\n\t\tcase FIELD_PHOTOMETRIC:\n\t\t\tTIFFSetupShort(tif, TIFFTAG_PHOTOMETRIC,\n\t\t\t    dir, td->td_photometric);\n\t\t\tbreak;\n\t\tcase FIELD_POSITION:\n\t\t\tWriteRationalPair(TIFF_RATIONAL,\n\t\t\t    TIFFTAG_XPOSITION, td->td_xposition,\n\t\t\t    TIFFTAG_YPOSITION, td->td_yposition);\n\t\t\tbreak;\n\t\tcase FIELD_RESOLUTION:\n\t\t\tWriteRationalPair(TIFF_RATIONAL,\n\t\t\t    TIFFTAG_XRESOLUTION, td->td_xresolution,\n\t\t\t    TIFFTAG_YRESOLUTION, td->td_yresolution);\n\t\t\tbreak;\n\t\tcase FIELD_BITSPERSAMPLE:\n\t\tcase FIELD_MINSAMPLEVALUE:\n\t\tcase FIELD_MAXSAMPLEVALUE:\n\t\tcase FIELD_SAMPLEFORMAT:\n\t\t\tif (!TIFFWritePerSampleShorts(tif, fip->field_tag, dir))\n\t\t\t\tgoto bad;\n\t\t\tbreak;\n\t\tcase FIELD_SMINSAMPLEVALUE:\n\t\tcase FIELD_SMAXSAMPLEVALUE:\n\t\t\tif (!TIFFWritePerSampleAnys(tif,\n\t\t\t    _TIFFSampleToTagType(tif), fip->field_tag, dir))\n\t\t\t\tgoto bad;\n\t\t\tbreak;\n\t\tcase FIELD_PAGENUMBER:\n\t\tcase FIELD_HALFTONEHINTS:\n\t\tcase FIELD_YCBCRSUBSAMPLING:\n\t\t\tif (!TIFFSetupShortPair(tif, fip->field_tag, dir))\n\t\t\t\tgoto bad;\n\t\t\tbreak;\n\t\tcase FIELD_INKNAMES:\n\t\t\tif (!TIFFWriteInkNames(tif, dir))\n\t\t\t\tgoto bad;\n\t\t\tbreak;\n\t\tcase FIELD_TRANSFERFUNCTION:\n\t\t\tif (!TIFFWriteTransferFunction(tif, dir))\n\t\t\t\tgoto bad;\n\t\t\tbreak;\n\t\tcase FIELD_SUBIFD:\n\t\t\t/*\n\t\t\t * XXX: Always write this field using LONG type\n\t\t\t * for backward compatibility.\n\t\t\t */\n\t\t\tdir->tdir_tag = (uint16) fip->field_tag;\n\t\t\tdir->tdir_type = (uint16) TIFF_LONG;\n\t\t\tdir->tdir_count = (uint32) td->td_nsubifd;\n\t\t\tif (!TIFFWriteLongArray(tif, dir, td->td_subifd))\n\t\t\t\tgoto bad;\n\t\t\t/*\n\t\t\t * Total hack: if this directory includes a SubIFD\n\t\t\t * tag then force the next <n> directories to be\n\t\t\t * written as ``sub directories'' of this one.  This\n\t\t\t * is used to write things like thumbnails and\n\t\t\t * image masks that one wants to keep out of the\n\t\t\t * normal directory linkage access mechanism.\n\t\t\t */\n\t\t\tif (dir->tdir_count > 0) {\n\t\t\t\ttif->tif_flags |= TIFF_INSUBIFD;\n\t\t\t\ttif->tif_nsubifd = (uint16) dir->tdir_count;\n\t\t\t\tif (dir->tdir_count > 1)\n\t\t\t\t\ttif->tif_subifdoff = dir->tdir_offset;\n\t\t\t\telse\n\t\t\t\t\ttif->tif_subifdoff = (uint32)(\n\t\t\t\t\t      tif->tif_diroff\n\t\t\t\t\t    + sizeof (uint16)\n\t\t\t\t\t    + ((char*)&dir->tdir_offset-data));\n\t\t\t}\n\t\t\tbreak;\n\t\tdefault:\n\t\t\t/* XXX: Should be fixed and removed. */\n\t\t\tif (fip->field_tag == TIFFTAG_DOTRANGE) {\n\t\t\t\tif (!TIFFSetupShortPair(tif, fip->field_tag, dir))\n\t\t\t\t\tgoto bad;\n\t\t\t}\n\t\t\telse if (!TIFFWriteNormalTag(tif, dir, fip))\n\t\t\t\tgoto bad;\n\t\t\tbreak;\n\t\t}\n\t\tdir++;\n                \n\t\tif( fip->field_bit != FIELD_CUSTOM )\n\t\t\tResetFieldBit(fields, fip->field_bit);\n\t}\n\n\t/*\n\t * Write directory.\n\t */\n\tdircount = (uint16) nfields;\n\tdiroff = (uint32) tif->tif_nextdiroff;\n\tif (tif->tif_flags & TIFF_SWAB) {\n\t\t/*\n\t\t * The file's byte order is opposite to the\n\t\t * native machine architecture.  We overwrite\n\t\t * the directory information with impunity\n\t\t * because it'll be released below after we\n\t\t * write it to the file.  Note that all the\n\t\t * other tag construction routines assume that\n\t\t * we do this byte-swapping; i.e. they only\n\t\t * byte-swap indirect data.\n\t\t */\n\t\tfor (dir = (TIFFDirEntry*) data; dircount; dir++, dircount--) {\n\t\t\tTIFFSwabArrayOfShort(&dir->tdir_tag, 2);\n\t\t\tTIFFSwabArrayOfLong(&dir->tdir_count, 2);\n\t\t}\n\t\tdircount = (uint16) nfields;\n\t\tTIFFSwabShort(&dircount);\n\t\tTIFFSwabLong(&diroff);\n\t}\n\t(void) TIFFSeekFile(tif, tif->tif_diroff, SEEK_SET);\n\tif (!WriteOK(tif, &dircount, sizeof (dircount))) {\n\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t\t     \"Error writing directory count\");\n\t\tgoto bad;\n\t}\n\tif (!WriteOK(tif, data, dirsize)) {\n\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t\t     \"Error writing directory contents\");\n\t\tgoto bad;\n\t}\n\tif (!WriteOK(tif, &diroff, sizeof (uint32))) {\n\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t\t     \"Error writing directory link\");\n\t\tgoto bad;\n\t}\n\tif (done) {\n\t\tTIFFFreeDirectory(tif);\n\t\ttif->tif_flags &= ~TIFF_DIRTYDIRECT;\n\t\t(*tif->tif_cleanup)(tif);\n\n\t\t/*\n\t\t* Reset directory-related state for subsequent\n\t\t* directories.\n\t\t*/\n\t\tTIFFCreateDirectory(tif);\n\t}\n\t_TIFFfree(data);\n\treturn (1);\nbad:\n\t_TIFFfree(data);\n\treturn (0);\n}\n#undef WriteRationalPair\n\nint\nTIFFWriteDirectory(TIFF* tif)\n{\n\treturn _TIFFWriteDirectory(tif, TRUE);\n}\n\n/*\n * Similar to TIFFWriteDirectory(), writes the directory out\n * but leaves all data structures in memory so that it can be\n * written again.  This will make a partially written TIFF file\n * readable before it is successfully completed/closed.\n */ \nint\nTIFFCheckpointDirectory(TIFF* tif)\n{\n\tint rc;\n\t/* Setup the strips arrays, if they haven't already been. */\n\tif (tif->tif_dir.td_stripoffset == NULL)\n\t    (void) TIFFSetupStrips(tif);\n\trc = _TIFFWriteDirectory(tif, FALSE);\n\t(void) TIFFSetWriteOffset(tif, TIFFSeekFile(tif, 0, SEEK_END));\n\treturn rc;\n}\n\nstatic int\n_TIFFWriteCustomDirectory(TIFF* tif, toff_t *pdiroff)\n{\n\tuint16 dircount;\n\tuint32 nfields;\n\ttsize_t dirsize;\n\tchar* data;\n\tTIFFDirEntry* dir;\n\tTIFFDirectory* td;\n\tunsigned long b, fields[FIELD_SETLONGS];\n\tint fi, nfi;\n\n\tif (tif->tif_mode == O_RDONLY)\n\t\treturn (1);\n\n\ttd = &tif->tif_dir;\n\t/*\n\t * Size the directory so that we can calculate\n\t * offsets for the data items that aren't kept\n\t * in-place in each field.\n\t */\n\tnfields = 0;\n\tfor (b = 0; b <= FIELD_LAST; b++)\n\t\tif (TIFFFieldSet(tif, b) && b != FIELD_CUSTOM)\n\t\t\tnfields += (b < FIELD_SUBFILETYPE ? 2 : 1);\n\tnfields += td->td_customValueCount;\n\tdirsize = nfields * sizeof (TIFFDirEntry);\n\tdata = (char*) _TIFFmalloc(dirsize);\n\tif (data == NULL) {\n\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t\t     \"Cannot write directory, out of space\");\n\t\treturn (0);\n\t}\n\t/*\n\t * Put the directory  at the end of the file.\n\t */\n\ttif->tif_diroff = (TIFFSeekFile(tif, (toff_t) 0, SEEK_END)+1) &~ 1;\n\ttif->tif_dataoff = (toff_t)(\n\t    tif->tif_diroff + sizeof (uint16) + dirsize + sizeof (toff_t));\n\tif (tif->tif_dataoff & 1)\n\t\ttif->tif_dataoff++;\n\t(void) TIFFSeekFile(tif, tif->tif_dataoff, SEEK_SET);\n\tdir = (TIFFDirEntry*) data;\n\t/*\n\t * Setup external form of directory\n\t * entries and write data items.\n\t */\n\t_TIFFmemcpy(fields, td->td_fieldsset, sizeof (fields));\n\n\tfor (fi = 0, nfi = tif->tif_nfields; nfi > 0; nfi--, fi++) {\n\t\tconst TIFFFieldInfo* fip = tif->tif_fieldinfo[fi];\n\n\t\t/*\n\t\t * For custom fields, we test to see if the custom field\n\t\t * is set or not.  For normal fields, we just use the\n\t\t * FieldSet test.\n\t\t*/\n\t\tif( fip->field_bit == FIELD_CUSTOM )\n\t\t{\n\t\t\tint ci, is_set = FALSE;\n\n\t\t\tfor( ci = 0; ci < td->td_customValueCount; ci++ )\n\t\t\t\tis_set |= (td->td_customValues[ci].info == fip);\n\n\t\t\tif( !is_set )\n\t\t\t\tcontinue;\n\t\t}\n\t\telse if (!FieldSet(fields, fip->field_bit))\n\t\t\tcontinue;\n                \n\t\tif( fip->field_bit != FIELD_CUSTOM )\n\t\t\tResetFieldBit(fields, fip->field_bit);\n\t}\n\n\t/*\n\t * Write directory.\n\t */\n\tdircount = (uint16) nfields;\n\t*pdiroff = (uint32) tif->tif_nextdiroff;\n\tif (tif->tif_flags & TIFF_SWAB) {\n\t\t/*\n\t\t * The file's byte order is opposite to the\n\t\t * native machine architecture.  We overwrite\n\t\t * the directory information with impunity\n\t\t * because it'll be released below after we\n\t\t * write it to the file.  Note that all the\n\t\t * other tag construction routines assume that\n\t\t * we do this byte-swapping; i.e. they only\n\t\t * byte-swap indirect data.\n\t\t */\n\t\tfor (dir = (TIFFDirEntry*) data; dircount; dir++, dircount--) {\n\t\t\tTIFFSwabArrayOfShort(&dir->tdir_tag, 2);\n\t\t\tTIFFSwabArrayOfLong(&dir->tdir_count, 2);\n\t\t}\n\t\tdircount = (uint16) nfields;\n\t\tTIFFSwabShort(&dircount);\n\t\tTIFFSwabLong(pdiroff);\n\t}\n\t(void) TIFFSeekFile(tif, tif->tif_diroff, SEEK_SET);\n\tif (!WriteOK(tif, &dircount, sizeof (dircount))) {\n\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t\t     \"Error writing directory count\");\n\t\tgoto bad;\n\t}\n\tif (!WriteOK(tif, data, dirsize)) {\n\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t\t     \"Error writing directory contents\");\n\t\tgoto bad;\n\t}\n\tif (!WriteOK(tif, pdiroff, sizeof (uint32))) {\n\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t\t     \"Error writing directory link\");\n\t\tgoto bad;\n\t}\n\t_TIFFfree(data);\n\treturn (1);\nbad:\n\t_TIFFfree(data);\n\treturn (0);\n}\n\nint\nTIFFWriteCustomDirectory(TIFF* tif, toff_t *pdiroff)\n{\n\treturn _TIFFWriteCustomDirectory(tif, pdiroff);\n}\n\n/*\n * Process tags that are not special cased.\n */\nstatic int\nTIFFWriteNormalTag(TIFF* tif, TIFFDirEntry* dir, const TIFFFieldInfo* fip)\n{\n\tuint16 wc = (uint16) fip->field_writecount;\n\tuint32 wc2;\n\n\tdir->tdir_tag = (uint16) fip->field_tag;\n\tdir->tdir_type = (uint16) fip->field_type;\n\tdir->tdir_count = wc;\n\t\n\tswitch (fip->field_type) {\n\tcase TIFF_SHORT:\n\tcase TIFF_SSHORT:\n\t\tif (fip->field_passcount) {\n\t\t\tuint16* wp;\n\t\t\tif (wc == (uint16) TIFF_VARIABLE2) {\n\t\t\t\tTIFFGetField(tif, fip->field_tag, &wc2, &wp);\n\t\t\t\tdir->tdir_count = wc2;\n\t\t\t} else {\t/* Assume TIFF_VARIABLE */\n\t\t\t\tTIFFGetField(tif, fip->field_tag, &wc, &wp);\n\t\t\t\tdir->tdir_count = wc;\n\t\t\t}\n\t\t\tif (!TIFFWriteShortArray(tif, dir, wp))\n\t\t\t\treturn 0;\n\t\t} else {\n\t\t\tif (wc == 1) {\n\t\t\t\tuint16 sv;\n\t\t\t\tTIFFGetField(tif, fip->field_tag, &sv);\n\t\t\t\tdir->tdir_offset =\n\t\t\t\t\tTIFFInsertData(tif, dir->tdir_type, sv);\n\t\t\t} else {\n\t\t\t\tuint16* wp;\n\t\t\t\tTIFFGetField(tif, fip->field_tag, &wp);\n\t\t\t\tif (!TIFFWriteShortArray(tif, dir, wp))\n\t\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t\tbreak;\n\tcase TIFF_LONG:\n\tcase TIFF_SLONG:\n\tcase TIFF_IFD:\n\t\tif (fip->field_passcount) {\n\t\t\tuint32* lp;\n\t\t\tif (wc == (uint16) TIFF_VARIABLE2) {\n\t\t\t\tTIFFGetField(tif, fip->field_tag, &wc2, &lp);\n\t\t\t\tdir->tdir_count = wc2;\n\t\t\t} else {\t/* Assume TIFF_VARIABLE */\n\t\t\t\tTIFFGetField(tif, fip->field_tag, &wc, &lp);\n\t\t\t\tdir->tdir_count = wc;\n\t\t\t}\n\t\t\tif (!TIFFWriteLongArray(tif, dir, lp))\n\t\t\t\treturn 0;\n\t\t} else {\n\t\t\tif (wc == 1) {\n\t\t\t\t/* XXX handle LONG->SHORT conversion */\n\t\t\t\tTIFFGetField(tif, fip->field_tag,\n\t\t\t\t\t     &dir->tdir_offset);\n\t\t\t} else {\n\t\t\t\tuint32* lp;\n\t\t\t\tTIFFGetField(tif, fip->field_tag, &lp);\n\t\t\t\tif (!TIFFWriteLongArray(tif, dir, lp))\n\t\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t\tbreak;\n\tcase TIFF_RATIONAL:\n\tcase TIFF_SRATIONAL:\n\t\tif (fip->field_passcount) {\n\t\t\tfloat* fp;\n\t\t\tif (wc == (uint16) TIFF_VARIABLE2) {\n\t\t\t\tTIFFGetField(tif, fip->field_tag, &wc2, &fp);\n\t\t\t\tdir->tdir_count = wc2;\n\t\t\t} else {\t/* Assume TIFF_VARIABLE */\n\t\t\t\tTIFFGetField(tif, fip->field_tag, &wc, &fp);\n\t\t\t\tdir->tdir_count = wc;\n\t\t\t}\n\t\t\tif (!TIFFWriteRationalArray(tif, dir, fp))\n\t\t\t\treturn 0;\n\t\t} else {\n\t\t\tif (wc == 1) {\n\t\t\t\tfloat fv;\n\t\t\t\tTIFFGetField(tif, fip->field_tag, &fv);\n\t\t\t\tif (!TIFFWriteRationalArray(tif, dir, &fv))\n\t\t\t\t\treturn 0;\n\t\t\t} else {\n\t\t\t\tfloat* fp;\n\t\t\t\tTIFFGetField(tif, fip->field_tag, &fp);\n\t\t\t\tif (!TIFFWriteRationalArray(tif, dir, fp))\n\t\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t\tbreak;\n\tcase TIFF_FLOAT:\n\t\tif (fip->field_passcount) {\n\t\t\tfloat* fp;\n\t\t\tif (wc == (uint16) TIFF_VARIABLE2) {\n\t\t\t\tTIFFGetField(tif, fip->field_tag, &wc2, &fp);\n\t\t\t\tdir->tdir_count = wc2;\n\t\t\t} else {\t/* Assume TIFF_VARIABLE */\n\t\t\t\tTIFFGetField(tif, fip->field_tag, &wc, &fp);\n\t\t\t\tdir->tdir_count = wc;\n\t\t\t}\n\t\t\tif (!TIFFWriteFloatArray(tif, dir, fp))\n\t\t\t\treturn 0;\n\t\t} else {\n\t\t\tif (wc == 1) {\n\t\t\t\tfloat fv;\n\t\t\t\tTIFFGetField(tif, fip->field_tag, &fv);\n\t\t\t\tif (!TIFFWriteFloatArray(tif, dir, &fv))\n\t\t\t\t\treturn 0;\n\t\t\t} else {\n\t\t\t\tfloat* fp;\n\t\t\t\tTIFFGetField(tif, fip->field_tag, &fp);\n\t\t\t\tif (!TIFFWriteFloatArray(tif, dir, fp))\n\t\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t\tbreak;\n\tcase TIFF_DOUBLE:\n\t\tif (fip->field_passcount) {\n\t\t\tdouble* dp;\n\t\t\tif (wc == (uint16) TIFF_VARIABLE2) {\n\t\t\t\tTIFFGetField(tif, fip->field_tag, &wc2, &dp);\n\t\t\t\tdir->tdir_count = wc2;\n\t\t\t} else {\t/* Assume TIFF_VARIABLE */\n\t\t\t\tTIFFGetField(tif, fip->field_tag, &wc, &dp);\n\t\t\t\tdir->tdir_count = wc;\n\t\t\t}\n\t\t\tif (!TIFFWriteDoubleArray(tif, dir, dp))\n\t\t\t\treturn 0;\n\t\t} else {\n\t\t\tif (wc == 1) {\n\t\t\t\tdouble dv;\n\t\t\t\tTIFFGetField(tif, fip->field_tag, &dv);\n\t\t\t\tif (!TIFFWriteDoubleArray(tif, dir, &dv))\n\t\t\t\t\treturn 0;\n\t\t\t} else {\n\t\t\t\tdouble* dp;\n\t\t\t\tTIFFGetField(tif, fip->field_tag, &dp);\n\t\t\t\tif (!TIFFWriteDoubleArray(tif, dir, dp))\n\t\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t\tbreak;\n\tcase TIFF_ASCII:\n\t\t{ \n                    char* cp;\n                    if (fip->field_passcount)\n                    {\n                        if( wc == (uint16) TIFF_VARIABLE2 )\n                            TIFFGetField(tif, fip->field_tag, &wc2, &cp);\n                        else\n                            TIFFGetField(tif, fip->field_tag, &wc, &cp);\n                    }\n                    else\n                        TIFFGetField(tif, fip->field_tag, &cp);\n\n                    dir->tdir_count = (uint32) (strlen(cp) + 1);\n                    if (!TIFFWriteByteArray(tif, dir, cp))\n                        return (0);\n\t\t}\n\t\tbreak;\n\n        case TIFF_BYTE:\n        case TIFF_SBYTE:          \n\t\tif (fip->field_passcount) {\n\t\t\tchar* cp;\n\t\t\tif (wc == (uint16) TIFF_VARIABLE2) {\n\t\t\t\tTIFFGetField(tif, fip->field_tag, &wc2, &cp);\n\t\t\t\tdir->tdir_count = wc2;\n\t\t\t} else {\t/* Assume TIFF_VARIABLE */\n\t\t\t\tTIFFGetField(tif, fip->field_tag, &wc, &cp);\n\t\t\t\tdir->tdir_count = wc;\n\t\t\t}\n\t\t\tif (!TIFFWriteByteArray(tif, dir, cp))\n\t\t\t\treturn 0;\n\t\t} else {\n\t\t\tif (wc == 1) {\n\t\t\t\tchar cv;\n\t\t\t\tTIFFGetField(tif, fip->field_tag, &cv);\n\t\t\t\tif (!TIFFWriteByteArray(tif, dir, &cv))\n\t\t\t\t\treturn 0;\n\t\t\t} else {\n\t\t\t\tchar* cp;\n\t\t\t\tTIFFGetField(tif, fip->field_tag, &cp);\n\t\t\t\tif (!TIFFWriteByteArray(tif, dir, cp))\n\t\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n                break;\n\n\tcase TIFF_UNDEFINED:\n\t\t{ char* cp;\n\t\t  if (wc == (unsigned short) TIFF_VARIABLE) {\n\t\t\tTIFFGetField(tif, fip->field_tag, &wc, &cp);\n\t\t\tdir->tdir_count = wc;\n\t\t  } else if (wc == (unsigned short) TIFF_VARIABLE2) {\n\t\t\tTIFFGetField(tif, fip->field_tag, &wc2, &cp);\n\t\t\tdir->tdir_count = wc2;\n\t\t  } else \n\t\t\tTIFFGetField(tif, fip->field_tag, &cp);\n\t\t  if (!TIFFWriteByteArray(tif, dir, cp))\n\t\t\treturn (0);\n\t\t}\n\t\tbreak;\n\n        case TIFF_NOTYPE:\n                break;\n\t}\n\treturn (1);\n}\n\n/*\n * Setup a directory entry with either a SHORT\n * or LONG type according to the value.\n */\nstatic void\nTIFFSetupShortLong(TIFF* tif, ttag_t tag, TIFFDirEntry* dir, uint32 v)\n{\n\tdir->tdir_tag = (uint16) tag;\n\tdir->tdir_count = 1;\n\tif (v > 0xffffL) {\n\t\tdir->tdir_type = (short) TIFF_LONG;\n\t\tdir->tdir_offset = v;\n\t} else {\n\t\tdir->tdir_type = (short) TIFF_SHORT;\n\t\tdir->tdir_offset = TIFFInsertData(tif, (int) TIFF_SHORT, v);\n\t}\n}\n\n/*\n * Setup a SHORT directory entry\n */\nstatic void\nTIFFSetupShort(TIFF* tif, ttag_t tag, TIFFDirEntry* dir, uint16 v)\n{\n\tdir->tdir_tag = (uint16) tag;\n\tdir->tdir_count = 1;\n\tdir->tdir_type = (short) TIFF_SHORT;\n\tdir->tdir_offset = TIFFInsertData(tif, (int) TIFF_SHORT, v);\n}\n#undef MakeShortDirent\n\n#define\tNITEMS(x)\t(sizeof (x) / sizeof (x[0]))\n/*\n * Setup a directory entry that references a\n * samples/pixel array of SHORT values and\n * (potentially) write the associated indirect\n * values.\n */\nstatic int\nTIFFWritePerSampleShorts(TIFF* tif, ttag_t tag, TIFFDirEntry* dir)\n{\n\tuint16 buf[10], v;\n\tuint16* w = buf;\n\tuint16 i, samples = tif->tif_dir.td_samplesperpixel;\n\tint status;\n\n\tif (samples > NITEMS(buf)) {\n\t\tw = (uint16*) _TIFFmalloc(samples * sizeof (uint16));\n\t\tif (w == NULL) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t\t    \"No space to write per-sample shorts\");\n\t\t\treturn (0);\n\t\t}\n\t}\n\tTIFFGetField(tif, tag, &v);\n\tfor (i = 0; i < samples; i++)\n\t\tw[i] = v;\n\t\n\tdir->tdir_tag = (uint16) tag;\n\tdir->tdir_type = (uint16) TIFF_SHORT;\n\tdir->tdir_count = samples;\n\tstatus = TIFFWriteShortArray(tif, dir, w);\n\tif (w != buf)\n\t\t_TIFFfree((char*) w);\n\treturn (status);\n}\n\n/*\n * Setup a directory entry that references a samples/pixel array of ``type''\n * values and (potentially) write the associated indirect values.  The source\n * data from TIFFGetField() for the specified tag must be returned as double.\n */\nstatic int\nTIFFWritePerSampleAnys(TIFF* tif,\n    TIFFDataType type, ttag_t tag, TIFFDirEntry* dir)\n{\n\tdouble buf[10], v;\n\tdouble* w = buf;\n\tuint16 i, samples = tif->tif_dir.td_samplesperpixel;\n\tint status;\n\n\tif (samples > NITEMS(buf)) {\n\t\tw = (double*) _TIFFmalloc(samples * sizeof (double));\n\t\tif (w == NULL) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t\t    \"No space to write per-sample values\");\n\t\t\treturn (0);\n\t\t}\n\t}\n\tTIFFGetField(tif, tag, &v);\n\tfor (i = 0; i < samples; i++)\n\t\tw[i] = v;\n\tstatus = TIFFWriteAnyArray(tif, type, tag, dir, samples, w);\n\tif (w != buf)\n\t\t_TIFFfree(w);\n\treturn (status);\n}\n#undef NITEMS\n\n/*\n * Setup a pair of shorts that are returned by\n * value, rather than as a reference to an array.\n */\nstatic int\nTIFFSetupShortPair(TIFF* tif, ttag_t tag, TIFFDirEntry* dir)\n{\n\tuint16 v[2];\n\n\tTIFFGetField(tif, tag, &v[0], &v[1]);\n\n\tdir->tdir_tag = (uint16) tag;\n\tdir->tdir_type = (uint16) TIFF_SHORT;\n\tdir->tdir_count = 2;\n\treturn (TIFFWriteShortArray(tif, dir, v));\n}\n\n/*\n * Setup a directory entry for an NxM table of shorts,\n * where M is known to be 2**bitspersample, and write\n * the associated indirect data.\n */\nstatic int\nTIFFWriteShortTable(TIFF* tif,\n    ttag_t tag, TIFFDirEntry* dir, uint32 n, uint16** table)\n{\n\tuint32 i, off;\n\n\tdir->tdir_tag = (uint16) tag;\n\tdir->tdir_type = (short) TIFF_SHORT;\n\t/* XXX -- yech, fool TIFFWriteData */\n\tdir->tdir_count = (uint32) (1L<<tif->tif_dir.td_bitspersample);\n\toff = tif->tif_dataoff;\n\tfor (i = 0; i < n; i++)\n\t\tif (!TIFFWriteData(tif, dir, (char *)table[i]))\n\t\t\treturn (0);\n\tdir->tdir_count *= n;\n\tdir->tdir_offset = off;\n\treturn (1);\n}\n\n/*\n * Write/copy data associated with an ASCII or opaque tag value.\n */\nstatic int\nTIFFWriteByteArray(TIFF* tif, TIFFDirEntry* dir, char* cp)\n{\n\tif (dir->tdir_count <= 4) {\n\t\tif (tif->tif_header.tiff_magic == TIFF_BIGENDIAN) {\n\t\t\tdir->tdir_offset = (uint32)cp[0] << 24;\n\t\t\tif (dir->tdir_count >= 2)\n\t\t\t\tdir->tdir_offset |= (uint32)cp[1] << 16;\n\t\t\tif (dir->tdir_count >= 3)\n\t\t\t\tdir->tdir_offset |= (uint32)cp[2] << 8;\n\t\t\tif (dir->tdir_count == 4)\n\t\t\t\tdir->tdir_offset |= cp[3];\n\t\t} else {\n\t\t\tdir->tdir_offset = cp[0];\n\t\t\tif (dir->tdir_count >= 2)\n\t\t\t\tdir->tdir_offset |= (uint32) cp[1] << 8;\n\t\t\tif (dir->tdir_count >= 3)\n\t\t\t\tdir->tdir_offset |= (uint32) cp[2] << 16;\n\t\t\tif (dir->tdir_count == 4)\n\t\t\t\tdir->tdir_offset |= (uint32) cp[3] << 24;\n\t\t}\n\t\treturn 1;\n\t} else\n\t\treturn TIFFWriteData(tif, dir, cp);\n}\n\n/*\n * Setup a directory entry of an array of SHORT\n * or SSHORT and write the associated indirect values.\n */\nstatic int\nTIFFWriteShortArray(TIFF* tif, TIFFDirEntry* dir, uint16* v)\n{\n\tif (dir->tdir_count <= 2) {\n\t\tif (tif->tif_header.tiff_magic == TIFF_BIGENDIAN) {\n\t\t\tdir->tdir_offset = (uint32) v[0] << 16;\n\t\t\tif (dir->tdir_count == 2)\n\t\t\t\tdir->tdir_offset |= v[1] & 0xffff;\n\t\t} else {\n\t\t\tdir->tdir_offset = v[0] & 0xffff;\n\t\t\tif (dir->tdir_count == 2)\n\t\t\t\tdir->tdir_offset |= (uint32) v[1] << 16;\n\t\t}\n\t\treturn (1);\n\t} else\n\t\treturn (TIFFWriteData(tif, dir, (char*) v));\n}\n\n/*\n * Setup a directory entry of an array of LONG\n * or SLONG and write the associated indirect values.\n */\nstatic int\nTIFFWriteLongArray(TIFF* tif, TIFFDirEntry* dir, uint32* v)\n{\n\tif (dir->tdir_count == 1) {\n\t\tdir->tdir_offset = v[0];\n\t\treturn (1);\n\t} else\n\t\treturn (TIFFWriteData(tif, dir, (char*) v));\n}\n\n/*\n * Setup a directory entry of an array of RATIONAL\n * or SRATIONAL and write the associated indirect values.\n */\nstatic int\nTIFFWriteRationalArray(TIFF* tif, TIFFDirEntry* dir, float* v)\n{\n\tuint32 i;\n\tuint32* t;\n\tint status;\n\n\tt = (uint32*) _TIFFmalloc(2 * dir->tdir_count * sizeof (uint32));\n\tif (t == NULL) {\n\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t    \"No space to write RATIONAL array\");\n\t\treturn (0);\n\t}\n\tfor (i = 0; i < dir->tdir_count; i++) {\n\t\tfloat fv = v[i];\n\t\tint sign = 1;\n\t\tuint32 den;\n\n\t\tif (fv < 0) {\n\t\t\tif (dir->tdir_type == TIFF_RATIONAL) {\n\t\t\t\tTIFFWarningExt(tif->tif_clientdata,\n\t\t\t\t\t       tif->tif_name,\n\t\"\\\"%s\\\": Information lost writing value (%g) as (unsigned) RATIONAL\",\n\t\t\t\t_TIFFFieldWithTag(tif,dir->tdir_tag)->field_name,\n\t\t\t\t\t\tfv);\n\t\t\t\tfv = 0;\n\t\t\t} else\n\t\t\t\tfv = -fv, sign = -1;\n\t\t}\n\t\tden = 1L;\n\t\tif (fv > 0) {\n\t\t\twhile (fv < 1L<<(31-3) && den < 1L<<(31-3))\n\t\t\t\tfv *= 1<<3, den *= 1L<<3;\n\t\t}\n\t\tt[2*i+0] = (uint32) (sign * (fv + 0.5));\n\t\tt[2*i+1] = den;\n\t}\n\tstatus = TIFFWriteData(tif, dir, (char *)t);\n\t_TIFFfree((char*) t);\n\treturn (status);\n}\n\nstatic int\nTIFFWriteFloatArray(TIFF* tif, TIFFDirEntry* dir, float* v)\n{\n\tTIFFCvtNativeToIEEEFloat(tif, dir->tdir_count, v);\n\tif (dir->tdir_count == 1) {\n\t\tdir->tdir_offset = *(uint32*) &v[0];\n\t\treturn (1);\n\t} else\n\t\treturn (TIFFWriteData(tif, dir, (char*) v));\n}\n\nstatic int\nTIFFWriteDoubleArray(TIFF* tif, TIFFDirEntry* dir, double* v)\n{\n\tTIFFCvtNativeToIEEEDouble(tif, dir->tdir_count, v);\n\treturn (TIFFWriteData(tif, dir, (char*) v));\n}\n\n/*\n * Write an array of ``type'' values for a specified tag (i.e. this is a tag\n * which is allowed to have different types, e.g. SMaxSampleType).\n * Internally the data values are represented as double since a double can\n * hold any of the TIFF tag types (yes, this should really be an abstract\n * type tany_t for portability).  The data is converted into the specified\n * type in a temporary buffer and then handed off to the appropriate array\n * writer.\n */\nstatic int\nTIFFWriteAnyArray(TIFF* tif,\n    TIFFDataType type, ttag_t tag, TIFFDirEntry* dir, uint32 n, double* v)\n{\n\tchar buf[10 * sizeof(double)];\n\tchar* w = buf;\n\tint i, status = 0;\n\n\tif (n * TIFFDataWidth(type) > sizeof buf) {\n\t\tw = (char*) _TIFFmalloc(n * TIFFDataWidth(type));\n\t\tif (w == NULL) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t\t\t     \"No space to write array\");\n\t\t\treturn (0);\n\t\t}\n\t}\n\n\tdir->tdir_tag = (uint16) tag;\n\tdir->tdir_type = (uint16) type;\n\tdir->tdir_count = n;\n\n\tswitch (type) {\n\tcase TIFF_BYTE:\n\t\t{ \n\t\t\tuint8* bp = (uint8*) w;\n\t\t\tfor (i = 0; i < (int) n; i++)\n\t\t\t\tbp[i] = (uint8) v[i];\n\t\t\tif (!TIFFWriteByteArray(tif, dir, (char*) bp))\n\t\t\t\tgoto out;\n\t\t}\n\t\tbreak;\n\tcase TIFF_SBYTE:\n\t\t{ \n\t\t\tint8* bp = (int8*) w;\n\t\t\tfor (i = 0; i < (int) n; i++)\n\t\t\t\tbp[i] = (int8) v[i];\n\t\t\tif (!TIFFWriteByteArray(tif, dir, (char*) bp))\n\t\t\t\tgoto out;\n\t\t}\n\t\tbreak;\n\tcase TIFF_SHORT:\n\t\t{\n\t\t\tuint16* bp = (uint16*) w;\n\t\t\tfor (i = 0; i < (int) n; i++)\n\t\t\t\tbp[i] = (uint16) v[i];\n\t\t\tif (!TIFFWriteShortArray(tif, dir, (uint16*)bp))\n\t\t\t\tgoto out;\n\t\t}\n\t\tbreak;\n\tcase TIFF_SSHORT:\n\t\t{ \n\t\t\tint16* bp = (int16*) w;\n\t\t\tfor (i = 0; i < (int) n; i++)\n\t\t\t\tbp[i] = (int16) v[i];\n\t\t\tif (!TIFFWriteShortArray(tif, dir, (uint16*)bp))\n\t\t\t\tgoto out;\n\t\t}\n\t\tbreak;\n\tcase TIFF_LONG:\n\t\t{\n\t\t\tuint32* bp = (uint32*) w;\n\t\t\tfor (i = 0; i < (int) n; i++)\n\t\t\t\tbp[i] = (uint32) v[i];\n\t\t\tif (!TIFFWriteLongArray(tif, dir, bp))\n\t\t\t\tgoto out;\n\t\t}\n\t\tbreak;\n\tcase TIFF_SLONG:\n\t\t{\n\t\t\tint32* bp = (int32*) w;\n\t\t\tfor (i = 0; i < (int) n; i++)\n\t\t\t\tbp[i] = (int32) v[i];\n\t\t\tif (!TIFFWriteLongArray(tif, dir, (uint32*) bp))\n\t\t\t\tgoto out;\n\t\t}\n\t\tbreak;\n\tcase TIFF_FLOAT:\n\t\t{ \n\t\t\tfloat* bp = (float*) w;\n\t\t\tfor (i = 0; i < (int) n; i++)\n\t\t\t\tbp[i] = (float) v[i];\n\t\t\tif (!TIFFWriteFloatArray(tif, dir, bp))\n\t\t\t\tgoto out;\n\t\t}\n\t\tbreak;\n\tcase TIFF_DOUBLE:\n                {\n                    if( !TIFFWriteDoubleArray(tif, dir, v))\n                        goto out;\n                }\n\t\tbreak;\n\tdefault:\n\t\t/* TIFF_NOTYPE */\n\t\t/* TIFF_ASCII */\n\t\t/* TIFF_UNDEFINED */\n\t\t/* TIFF_RATIONAL */\n\t\t/* TIFF_SRATIONAL */\n\t\tgoto out;\n\t}\n\tstatus = 1;\n out:\n\tif (w != buf)\n\t\t_TIFFfree(w);\n\treturn (status);\n}\n\nstatic int\nTIFFWriteTransferFunction(TIFF* tif, TIFFDirEntry* dir)\n{\n\tTIFFDirectory* td = &tif->tif_dir;\n\ttsize_t n = (1L<<td->td_bitspersample) * sizeof (uint16);\n\tuint16** tf = td->td_transferfunction;\n\tint ncols;\n\n\t/*\n\t * Check if the table can be written as a single column,\n\t * or if it must be written as 3 columns.  Note that we\n\t * write a 3-column tag if there are 2 samples/pixel and\n\t * a single column of data won't suffice--hmm.\n\t */\n\tswitch (td->td_samplesperpixel - td->td_extrasamples) {\n\tdefault:\tif (_TIFFmemcmp(tf[0], tf[2], n)) { ncols = 3; break; }\n\tcase 2:\t\tif (_TIFFmemcmp(tf[0], tf[1], n)) { ncols = 3; break; }\n\tcase 1: case 0:\tncols = 1;\n\t}\n\treturn (TIFFWriteShortTable(tif,\n\t    TIFFTAG_TRANSFERFUNCTION, dir, ncols, tf));\n}\n\nstatic int\nTIFFWriteInkNames(TIFF* tif, TIFFDirEntry* dir)\n{\n\tTIFFDirectory* td = &tif->tif_dir;\n\n\tdir->tdir_tag = TIFFTAG_INKNAMES;\n\tdir->tdir_type = (short) TIFF_ASCII;\n\tdir->tdir_count = td->td_inknameslen;\n\treturn (TIFFWriteByteArray(tif, dir, td->td_inknames));\n}\n\n/*\n * Write a contiguous directory item.\n */\nstatic int\nTIFFWriteData(TIFF* tif, TIFFDirEntry* dir, char* cp)\n{\n\ttsize_t cc;\n\n\tif (tif->tif_flags & TIFF_SWAB) {\n\t\tswitch (dir->tdir_type) {\n\t\tcase TIFF_SHORT:\n\t\tcase TIFF_SSHORT:\n\t\t\tTIFFSwabArrayOfShort((uint16*) cp, dir->tdir_count);\n\t\t\tbreak;\n\t\tcase TIFF_LONG:\n\t\tcase TIFF_SLONG:\n\t\tcase TIFF_FLOAT:\n\t\t\tTIFFSwabArrayOfLong((uint32*) cp, dir->tdir_count);\n\t\t\tbreak;\n\t\tcase TIFF_RATIONAL:\n\t\tcase TIFF_SRATIONAL:\n\t\t\tTIFFSwabArrayOfLong((uint32*) cp, 2*dir->tdir_count);\n\t\t\tbreak;\n\t\tcase TIFF_DOUBLE:\n\t\t\tTIFFSwabArrayOfDouble((double*) cp, dir->tdir_count);\n\t\t\tbreak;\n\t\t}\n\t}\n\tdir->tdir_offset = tif->tif_dataoff;\n\tcc = dir->tdir_count * TIFFDataWidth((TIFFDataType) dir->tdir_type);\n\tif (SeekOK(tif, dir->tdir_offset) &&\n\t    WriteOK(tif, cp, cc)) {\n\t\ttif->tif_dataoff += (cc + 1) & ~1;\n\t\treturn (1);\n\t}\n\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t     \"Error writing data for field \\\"%s\\\"\",\n\t_TIFFFieldWithTag(tif, dir->tdir_tag)->field_name);\n\treturn (0);\n}\n\n/*\n * Similar to TIFFWriteDirectory(), but if the directory has already\n * been written once, it is relocated to the end of the file, in case it\n * has changed in size.  Note that this will result in the loss of the \n * previously used directory space. \n */ \n\nint \nTIFFRewriteDirectory( TIFF *tif )\n{\n    static const char module[] = \"TIFFRewriteDirectory\";\n\n    /* We don't need to do anything special if it hasn't been written. */\n    if( tif->tif_diroff == 0 )\n        return TIFFWriteDirectory( tif );\n\n    /*\n    ** Find and zero the pointer to this directory, so that TIFFLinkDirectory\n    ** will cause it to be added after this directories current pre-link.\n    */\n    \n    /* Is it the first directory in the file? */\n    if (tif->tif_header.tiff_diroff == tif->tif_diroff) \n    {\n        tif->tif_header.tiff_diroff = 0;\n        tif->tif_diroff = 0;\n\n        TIFFSeekFile(tif, (toff_t)(TIFF_MAGIC_SIZE+TIFF_VERSION_SIZE),\n\t\t     SEEK_SET);\n        if (!WriteOK(tif, &(tif->tif_header.tiff_diroff), \n                     sizeof (tif->tif_diroff))) \n        {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t\t\t     \"Error updating TIFF header\");\n            return (0);\n        }\n    }\n    else\n    {\n        toff_t  nextdir, off;\n\n\tnextdir = tif->tif_header.tiff_diroff;\n\tdo {\n\t\tuint16 dircount;\n\n\t\tif (!SeekOK(tif, nextdir) ||\n\t\t    !ReadOK(tif, &dircount, sizeof (dircount))) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, module,\n\t\t\t\t     \"Error fetching directory count\");\n\t\t\treturn (0);\n\t\t}\n\t\tif (tif->tif_flags & TIFF_SWAB)\n\t\t\tTIFFSwabShort(&dircount);\n\t\t(void) TIFFSeekFile(tif,\n\t\t    dircount * sizeof (TIFFDirEntry), SEEK_CUR);\n\t\tif (!ReadOK(tif, &nextdir, sizeof (nextdir))) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, module,\n\t\t\t\t     \"Error fetching directory link\");\n\t\t\treturn (0);\n\t\t}\n\t\tif (tif->tif_flags & TIFF_SWAB)\n\t\t\tTIFFSwabLong(&nextdir);\n\t} while (nextdir != tif->tif_diroff && nextdir != 0);\n        off = TIFFSeekFile(tif, 0, SEEK_CUR); /* get current offset */\n        (void) TIFFSeekFile(tif, off - (toff_t)sizeof(nextdir), SEEK_SET);\n        tif->tif_diroff = 0;\n\tif (!WriteOK(tif, &(tif->tif_diroff), sizeof (nextdir))) {\n\t\tTIFFErrorExt(tif->tif_clientdata, module,\n\t\t\t     \"Error writing directory link\");\n\t\treturn (0);\n\t}\n    }\n\n    /*\n    ** Now use TIFFWriteDirectory() normally.\n    */\n\n    return TIFFWriteDirectory( tif );\n}\n\n\n/*\n * Link the current directory into the directory chain for the file.\n */\nstatic int\nTIFFLinkDirectory(TIFF* tif)\n{\n\tstatic const char module[] = \"TIFFLinkDirectory\";\n\ttoff_t nextdir;\n\ttoff_t diroff, off;\n\n\ttif->tif_diroff = (TIFFSeekFile(tif, (toff_t) 0, SEEK_END)+1) &~ 1;\n\tdiroff = tif->tif_diroff;\n\tif (tif->tif_flags & TIFF_SWAB)\n\t\tTIFFSwabLong(&diroff);\n\n\t/*\n\t * Handle SubIFDs\n\t */\n        if (tif->tif_flags & TIFF_INSUBIFD) {\n\t\t(void) TIFFSeekFile(tif, tif->tif_subifdoff, SEEK_SET);\n\t\tif (!WriteOK(tif, &diroff, sizeof (diroff))) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, module,\n\t\t\t\t     \"%s: Error writing SubIFD directory link\",\n\t\t\t\t     tif->tif_name);\n\t\t\treturn (0);\n\t\t}\n\t\t/*\n\t\t * Advance to the next SubIFD or, if this is\n\t\t * the last one configured, revert back to the\n\t\t * normal directory linkage.\n\t\t */\n\t\tif (--tif->tif_nsubifd)\n\t\t\ttif->tif_subifdoff += sizeof (diroff);\n\t\telse\n\t\t\ttif->tif_flags &= ~TIFF_INSUBIFD;\n\t\treturn (1);\n\t}\n\n\tif (tif->tif_header.tiff_diroff == 0) {\n\t\t/*\n\t\t * First directory, overwrite offset in header.\n\t\t */\n\t\ttif->tif_header.tiff_diroff = tif->tif_diroff;\n\t\t(void) TIFFSeekFile(tif,\n\t\t\t\t    (toff_t)(TIFF_MAGIC_SIZE+TIFF_VERSION_SIZE),\n                                    SEEK_SET);\n\t\tif (!WriteOK(tif, &diroff, sizeof (diroff))) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t\t\t     \"Error writing TIFF header\");\n\t\t\treturn (0);\n\t\t}\n\t\treturn (1);\n\t}\n\t/*\n\t * Not the first directory, search to the last and append.\n\t */\n\tnextdir = tif->tif_header.tiff_diroff;\n\tdo {\n\t\tuint16 dircount;\n\n\t\tif (!SeekOK(tif, nextdir) ||\n\t\t    !ReadOK(tif, &dircount, sizeof (dircount))) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, module,\n\t\t\t\t     \"Error fetching directory count\");\n\t\t\treturn (0);\n\t\t}\n\t\tif (tif->tif_flags & TIFF_SWAB)\n\t\t\tTIFFSwabShort(&dircount);\n\t\t(void) TIFFSeekFile(tif,\n\t\t    dircount * sizeof (TIFFDirEntry), SEEK_CUR);\n\t\tif (!ReadOK(tif, &nextdir, sizeof (nextdir))) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, module,\n\t\t\t\t     \"Error fetching directory link\");\n\t\t\treturn (0);\n\t\t}\n\t\tif (tif->tif_flags & TIFF_SWAB)\n\t\t\tTIFFSwabLong(&nextdir);\n\t} while (nextdir != 0);\n        off = TIFFSeekFile(tif, 0, SEEK_CUR); /* get current offset */\n        (void) TIFFSeekFile(tif, off - (toff_t)sizeof(nextdir), SEEK_SET);\n\tif (!WriteOK(tif, &diroff, sizeof (diroff))) {\n\t\tTIFFErrorExt(tif->tif_clientdata, module,\n\t\t\t     \"Error writing directory link\");\n\t\treturn (0);\n\t}\n\treturn (1);\n}\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/tif_dumpmode.c",
    "content": "/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_dumpmode.c,v 1.5.2.1 2009-01-01 00:10:43 bfriesen Exp $ */\n\n/*\n * Copyright (c) 1988-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n/*\n * TIFF Library.\n *\n * \"Null\" Compression Algorithm Support.\n */\n#include \"tiffiop.h\"\n\n/*\n * Encode a hunk of pixels.\n */\nstatic int\nDumpModeEncode(TIFF* tif, tidata_t pp, tsize_t cc, tsample_t s)\n{\n\t(void) s;\n\twhile (cc > 0) {\n\t\ttsize_t n;\n\n\t\tn = cc;\n\t\tif (tif->tif_rawcc + n > tif->tif_rawdatasize)\n\t\t\tn = tif->tif_rawdatasize - tif->tif_rawcc;\n\n\t\tassert( n > 0 );\n                \n\t\t/*\n\t\t * Avoid copy if client has setup raw\n\t\t * data buffer to avoid extra copy.\n\t\t */\n\t\tif (tif->tif_rawcp != pp)\n\t\t\t_TIFFmemcpy(tif->tif_rawcp, pp, n);\n\t\ttif->tif_rawcp += n;\n\t\ttif->tif_rawcc += n;\n\t\tpp += n;\n\t\tcc -= n;\n\t\tif (tif->tif_rawcc >= tif->tif_rawdatasize &&\n\t\t    !TIFFFlushData1(tif))\n\t\t\treturn (-1);\n\t}\n\treturn (1);\n}\n\n/*\n * Decode a hunk of pixels.\n */\nstatic int\nDumpModeDecode(TIFF* tif, tidata_t buf, tsize_t cc, tsample_t s)\n{\n\t(void) s;\n/*         fprintf(stderr,\"DumpModeDecode: scanline %ld, expected %ld bytes, got %ld bytes\\n\", */\n/*                 (long) tif->tif_row, (long) tif->tif_rawcc, (long) cc); */\n\tif (tif->tif_rawcc < cc) {\n\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t    \"DumpModeDecode: Not enough data for scanline %d\",\n\t\t    tif->tif_row);\n\t\treturn (0);\n\t}\n\t/*\n\t * Avoid copy if client has setup raw\n\t * data buffer to avoid extra copy.\n\t */\n\tif (tif->tif_rawcp != buf)\n\t\t_TIFFmemcpy(buf, tif->tif_rawcp, cc);\n\ttif->tif_rawcp += cc;\n\ttif->tif_rawcc -= cc;\n\treturn (1);\n}\n\n/*\n * Seek forwards nrows in the current strip.\n */\nstatic int\nDumpModeSeek(TIFF* tif, uint32 nrows)\n{\n\ttif->tif_rawcp += nrows * tif->tif_scanlinesize;\n\ttif->tif_rawcc -= nrows * tif->tif_scanlinesize;\n\treturn (1);\n}\n\n/*\n * Initialize dump mode.\n */\nint\nTIFFInitDumpMode(TIFF* tif, int scheme)\n{\n\t(void) scheme;\n\ttif->tif_decoderow = DumpModeDecode;\n\ttif->tif_decodestrip = DumpModeDecode;\n\ttif->tif_decodetile = DumpModeDecode;\n\ttif->tif_encoderow = DumpModeEncode;\n\ttif->tif_encodestrip = DumpModeEncode;\n\ttif->tif_encodetile = DumpModeEncode;\n\ttif->tif_seek = DumpModeSeek;\n\treturn (1);\n}\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/tif_error.c",
    "content": "/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_error.c,v 1.4 2005/12/23 01:18:59 joris Exp $ */\n\n/*\n * Copyright (c) 1988-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n/*\n * TIFF Library.\n */\n#include \"tiffiop.h\"\n\nTIFFErrorHandlerExt _TIFFerrorHandlerExt = NULL;\n\nTIFFErrorHandler\nTIFFSetErrorHandler(TIFFErrorHandler handler)\n{\n\tTIFFErrorHandler prev = _TIFFerrorHandler;\n\t_TIFFerrorHandler = handler;\n\treturn (prev);\n}\n\nTIFFErrorHandlerExt\nTIFFSetErrorHandlerExt(TIFFErrorHandlerExt handler)\n{\n\tTIFFErrorHandlerExt prev = _TIFFerrorHandlerExt;\n\t_TIFFerrorHandlerExt = handler;\n\treturn (prev);\n}\n\nvoid\nTIFFError(const char* module, const char* fmt, ...)\n{\n\tva_list ap;\n\tva_start(ap, fmt);\n\tif (_TIFFerrorHandler)\n\t\t(*_TIFFerrorHandler)(module, fmt, ap);\n\tif (_TIFFerrorHandlerExt)\n\t\t(*_TIFFerrorHandlerExt)(0, module, fmt, ap);\n\tva_end(ap);\n}\n\nvoid\nTIFFErrorExt(thandle_t fd, const char* module, const char* fmt, ...)\n{\n\tva_list ap;\n\tva_start(ap, fmt);\n\tif (_TIFFerrorHandler)\n\t\t(*_TIFFerrorHandler)(module, fmt, ap);\n\tif (_TIFFerrorHandlerExt)\n\t\t(*_TIFFerrorHandlerExt)(fd, module, fmt, ap);\n\tva_end(ap);\n}\n\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/tif_extension.c",
    "content": "/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_extension.c,v 1.4 2004/10/02 13:29:41 dron Exp $ */\n\n/*\n * Copyright (c) 1988-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n/*\n * TIFF Library.\n *\n * Various routines support external extension of the tag set, and other\n * application extension capabilities. \n */\n\n#include \"tiffiop.h\"\n\nint TIFFGetTagListCount( TIFF *tif )\n\n{\n    TIFFDirectory* td = &tif->tif_dir;\n    \n    return td->td_customValueCount;\n}\n\nttag_t TIFFGetTagListEntry( TIFF *tif, int tag_index )\n\n{\n    TIFFDirectory* td = &tif->tif_dir;\n\n    if( tag_index < 0 || tag_index >= td->td_customValueCount )\n        return (ttag_t) -1;\n    else\n        return td->td_customValues[tag_index].info->field_tag;\n}\n\n/*\n** This provides read/write access to the TIFFTagMethods within the TIFF\n** structure to application code without giving access to the private\n** TIFF structure.\n*/\nTIFFTagMethods *TIFFAccessTagMethods( TIFF *tif )\n\n{\n    return &(tif->tif_tagmethods);\n}\n\nvoid *TIFFGetClientInfo( TIFF *tif, const char *name )\n\n{\n    TIFFClientInfoLink *link = tif->tif_clientinfo;\n\n    while( link != NULL && strcmp(link->name,name) != 0 )\n        link = link->next;\n\n    if( link != NULL )\n        return link->data;\n    else\n        return NULL;\n}\n\nvoid TIFFSetClientInfo( TIFF *tif, void *data, const char *name )\n\n{\n    TIFFClientInfoLink *link = tif->tif_clientinfo;\n\n    /*\n    ** Do we have an existing link with this name?  If so, just\n    ** set it.\n    */\n    while( link != NULL && strcmp(link->name,name) != 0 )\n        link = link->next;\n\n    if( link != NULL )\n    {\n        link->data = data;\n        return;\n    }\n\n    /*\n    ** Create a new link.\n    */\n\n    link = (TIFFClientInfoLink *) _TIFFmalloc(sizeof(TIFFClientInfoLink));\n    assert (link != NULL);\n    link->next = tif->tif_clientinfo;\n    link->name = (char *) _TIFFmalloc(strlen(name)+1);\n    assert (link->name != NULL);\n    strcpy(link->name, name);\n    link->data = data;\n\n    tif->tif_clientinfo = link;\n}\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/tif_fax3.c",
    "content": "/* $Id: tif_fax3.c,v 1.43.2.5 2009-01-01 00:10:43 bfriesen Exp $ */\n\n/*\n * Copyright (c) 1990-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n#include \"tiffiop.h\"\n#ifdef CCITT_SUPPORT\n/*\n * TIFF Library.\n *\n * CCITT Group 3 (T.4) and Group 4 (T.6) Compression Support.\n *\n * This file contains support for decoding and encoding TIFF\n * compression algorithms 2, 3, 4, and 32771.\n *\n * Decoder support is derived, with permission, from the code\n * in Frank Cringle's viewfax program;\n *      Copyright (C) 1990, 1995  Frank D. Cringle.\n */\n#include \"tif_fax3.h\"\n#define\tG3CODES\n#include \"t4.h\"\n#include <stdio.h>\n\n/*\n * Compression+decompression state blocks are\n * derived from this ``base state'' block.\n */\ntypedef struct {\n        int     rw_mode;                /* O_RDONLY for decode, else encode */\n\tint\tmode;\t\t\t/* operating mode */\n\tuint32\trowbytes;\t\t/* bytes in a decoded scanline */\n\tuint32\trowpixels;\t\t/* pixels in a scanline */\n\n\tuint16\tcleanfaxdata;\t\t/* CleanFaxData tag */\n\tuint32\tbadfaxrun;\t\t/* BadFaxRun tag */\n\tuint32\tbadfaxlines;\t\t/* BadFaxLines tag */\n\tuint32\tgroupoptions;\t\t/* Group 3/4 options tag */\n\tuint32\trecvparams;\t\t/* encoded Class 2 session params */\n\tchar*\tsubaddress;\t\t/* subaddress string */\n\tuint32\trecvtime;\t\t/* time spent receiving (secs) */\n\tchar*\tfaxdcs;\t\t\t/* Table 2/T.30 encoded session params */\n\tTIFFVGetMethod vgetparent;\t/* super-class method */\n\tTIFFVSetMethod vsetparent;\t/* super-class method */\n\tTIFFPrintMethod printdir;\t/* super-class method */\n} Fax3BaseState;\n#define\tFax3State(tif)\t\t((Fax3BaseState*) (tif)->tif_data)\n\ntypedef enum { G3_1D, G3_2D } Ttag;\ntypedef struct {\n\tFax3BaseState b;\n\n\t/* Decoder state info */\n\tconst unsigned char* bitmap;\t/* bit reversal table */\n\tuint32\tdata;\t\t\t/* current i/o byte/word */\n\tint\tbit;\t\t\t/* current i/o bit in byte */\n\tint\tEOLcnt;\t\t\t/* count of EOL codes recognized */\n\tTIFFFaxFillFunc fill;\t\t/* fill routine */\n\tuint32*\truns;\t\t\t/* b&w runs for current/previous row */\n\tuint32*\trefruns;\t\t/* runs for reference line */\n\tuint32*\tcurruns;\t\t/* runs for current line */\n\n\t/* Encoder state info */\n\tTtag    tag;\t\t\t/* encoding state */\n\tunsigned char*\trefline;\t/* reference line for 2d decoding */\n\tint\tk;\t\t\t/* #rows left that can be 2d encoded */\n\tint\tmaxk;\t\t\t/* max #rows that can be 2d encoded */\n\n\tint line;\n} Fax3CodecState;\n#define\tDecoderState(tif)\t((Fax3CodecState*) Fax3State(tif))\n#define\tEncoderState(tif)\t((Fax3CodecState*) Fax3State(tif))\n\n#define\tis2DEncoding(sp) \\\n\t(sp->b.groupoptions & GROUP3OPT_2DENCODING)\n#define\tisAligned(p,t)\t((((unsigned long)(p)) & (sizeof (t)-1)) == 0)\n\n/*\n * Group 3 and Group 4 Decoding.\n */\n\n/*\n * These macros glue the TIFF library state to\n * the state expected by Frank's decoder.\n */\n#define\tDECLARE_STATE(tif, sp, mod)\t\t\t\t\t\\\n    static const char module[] = mod;\t\t\t\t\t\\\n    Fax3CodecState* sp = DecoderState(tif);\t\t\t\t\\\n    int a0;\t\t\t\t/* reference element */\t\t\\\n    int lastx = sp->b.rowpixels;\t/* last element in row */\t\\\n    uint32 BitAcc;\t\t\t/* bit accumulator */\t\t\\\n    int BitsAvail;\t\t\t/* # valid bits in BitAcc */\t\\\n    int RunLength;\t\t\t/* length of current run */\t\\\n    unsigned char* cp;\t\t\t/* next byte of input data */\t\\\n    unsigned char* ep;\t\t\t/* end of input data */\t\t\\\n    uint32* pa;\t\t\t\t/* place to stuff next run */\t\\\n    uint32* thisrun;\t\t\t/* current row's run array */\t\\\n    int EOLcnt;\t\t\t\t/* # EOL codes recognized */\t\\\n    const unsigned char* bitmap = sp->bitmap;\t/* input data bit reverser */\t\\\n    const TIFFFaxTabEnt* TabEnt\n#define\tDECLARE_STATE_2D(tif, sp, mod)\t\t\t\t\t\\\n    DECLARE_STATE(tif, sp, mod);\t\t\t\t\t\\\n    int b1;\t\t\t\t/* next change on prev line */\t\\\n    uint32* pb\t\t\t\t/* next run in reference line */\\\n/*\n * Load any state that may be changed during decoding.\n */\n#define\tCACHE_STATE(tif, sp) do {\t\t\t\t\t\\\n    BitAcc = sp->data;\t\t\t\t\t\t\t\\\n    BitsAvail = sp->bit;\t\t\t\t\t\t\\\n    EOLcnt = sp->EOLcnt;\t\t\t\t\t\t\\\n    cp = (unsigned char*) tif->tif_rawcp;\t\t\t\t\\\n    ep = cp + tif->tif_rawcc;\t\t\t\t\t\t\\\n} while (0)\n/*\n * Save state possibly changed during decoding.\n */\n#define\tUNCACHE_STATE(tif, sp) do {\t\t\t\t\t\\\n    sp->bit = BitsAvail;\t\t\t\t\t\t\\\n    sp->data = BitAcc;\t\t\t\t\t\t\t\\\n    sp->EOLcnt = EOLcnt;\t\t\t\t\t\t\\\n    tif->tif_rawcc -= (tidata_t) cp - tif->tif_rawcp;\t\t\t\\\n    tif->tif_rawcp = (tidata_t) cp;\t\t\t\t\t\\\n} while (0)\n\n/*\n * Setup state for decoding a strip.\n */\nstatic int\nFax3PreDecode(TIFF* tif, tsample_t s)\n{\n\tFax3CodecState* sp = DecoderState(tif);\n\n\t(void) s;\n\tassert(sp != NULL);\n\tsp->bit = 0;\t\t\t/* force initial read */\n\tsp->data = 0;\n\tsp->EOLcnt = 0;\t\t\t/* force initial scan for EOL */\n\t/*\n\t * Decoder assumes lsb-to-msb bit order.  Note that we select\n\t * this here rather than in Fax3SetupState so that viewers can\n\t * hold the image open, fiddle with the FillOrder tag value,\n\t * and then re-decode the image.  Otherwise they'd need to close\n\t * and open the image to get the state reset.\n\t */\n\tsp->bitmap =\n\t    TIFFGetBitRevTable(tif->tif_dir.td_fillorder != FILLORDER_LSB2MSB);\n\tif (sp->refruns) {\t\t/* init reference line to white */\n\t\tsp->refruns[0] = (uint32) sp->b.rowpixels;\n\t\tsp->refruns[1] = 0;\n\t}\n\tsp->line = 0;\n\treturn (1);\n}\n\n/*\n * Routine for handling various errors/conditions.\n * Note how they are \"glued into the decoder\" by\n * overriding the definitions used by the decoder.\n */\n\nstatic void\nFax3Unexpected(const char* module, TIFF* tif, uint32 line, uint32 a0)\n{\n\tTIFFErrorExt(tif->tif_clientdata, module, \"%s: Bad code word at line %u of %s %u (x %u)\",\n\t\t     tif->tif_name, line, isTiled(tif) ? \"tile\" : \"strip\",\n\t\t     (isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip),\n\t\t     a0);\n}\n#define\tunexpected(table, a0)\tFax3Unexpected(module, tif, sp->line, a0)\n\nstatic void\nFax3Extension(const char* module, TIFF* tif, uint32 line, uint32 a0)\n{\n\tTIFFErrorExt(tif->tif_clientdata, module,\n\t\t     \"%s: Uncompressed data (not supported) at line %u of %s %u (x %u)\",\n\t\t     tif->tif_name, line, isTiled(tif) ? \"tile\" : \"strip\",\n\t\t     (isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip),\n\t\t     a0);\n}\n#define\textension(a0)\tFax3Extension(module, tif, sp->line, a0)\n\nstatic void\nFax3BadLength(const char* module, TIFF* tif, uint32 line, uint32 a0, uint32 lastx)\n{\n\tTIFFWarningExt(tif->tif_clientdata, module, \"%s: %s at line %u of %s %u (got %u, expected %u)\",\n\t\t       tif->tif_name,\n\t\t       a0 < lastx ? \"Premature EOL\" : \"Line length mismatch\",\n\t\t       line, isTiled(tif) ? \"tile\" : \"strip\",\n\t\t       (isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip),\n\t\t       a0, lastx);\n}\n#define\tbadlength(a0,lastx)\tFax3BadLength(module, tif, sp->line, a0, lastx)\n\nstatic void\nFax3PrematureEOF(const char* module, TIFF* tif, uint32 line, uint32 a0)\n{\n\tTIFFWarningExt(tif->tif_clientdata, module, \"%s: Premature EOF at line %u of %s %u (x %u)\",\n\t    tif->tif_name,\n\t\t       line, isTiled(tif) ? \"tile\" : \"strip\",\n\t\t       (isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip),\n\t\t       a0);\n}\n#define\tprematureEOF(a0)\tFax3PrematureEOF(module, tif, sp->line, a0)\n\n#define\tNop\n\n/*\n * Decode the requested amount of G3 1D-encoded data.\n */\nstatic int\nFax3Decode1D(TIFF* tif, tidata_t buf, tsize_t occ, tsample_t s)\n{\n\tDECLARE_STATE(tif, sp, \"Fax3Decode1D\");\n\n\t(void) s;\n\tCACHE_STATE(tif, sp);\n\tthisrun = sp->curruns;\n\twhile ((long)occ > 0) {\n\t\ta0 = 0;\n\t\tRunLength = 0;\n\t\tpa = thisrun;\n#ifdef FAX3_DEBUG\n\t\tprintf(\"\\nBitAcc=%08X, BitsAvail = %d\\n\", BitAcc, BitsAvail);\n\t\tprintf(\"-------------------- %d\\n\", tif->tif_row);\n\t\tfflush(stdout);\n#endif\n\t\tSYNC_EOL(EOF1D);\n\t\tEXPAND1D(EOF1Da);\n\t\t(*sp->fill)(buf, thisrun, pa, lastx);\n\t\tbuf += sp->b.rowbytes;\n\t\tocc -= sp->b.rowbytes;\n\t\tsp->line++;\n\t\tcontinue;\n\tEOF1D:\t\t\t\t/* premature EOF */\n\t\tCLEANUP_RUNS();\n\tEOF1Da:\t\t\t\t/* premature EOF */\n\t\t(*sp->fill)(buf, thisrun, pa, lastx);\n\t\tUNCACHE_STATE(tif, sp);\n\t\treturn (-1);\n\t}\n\tUNCACHE_STATE(tif, sp);\n\treturn (1);\n}\n\n#define\tSWAP(t,a,b)\t{ t x; x = (a); (a) = (b); (b) = x; }\n/*\n * Decode the requested amount of G3 2D-encoded data.\n */\nstatic int\nFax3Decode2D(TIFF* tif, tidata_t buf, tsize_t occ, tsample_t s)\n{\n\tDECLARE_STATE_2D(tif, sp, \"Fax3Decode2D\");\n\tint is1D;\t\t\t/* current line is 1d/2d-encoded */\n\n\t(void) s;\n\tCACHE_STATE(tif, sp);\n\twhile ((long)occ > 0) {\n\t\ta0 = 0;\n\t\tRunLength = 0;\n\t\tpa = thisrun = sp->curruns;\n#ifdef FAX3_DEBUG\n\t\tprintf(\"\\nBitAcc=%08X, BitsAvail = %d EOLcnt = %d\",\n\t\t    BitAcc, BitsAvail, EOLcnt);\n#endif\n\t\tSYNC_EOL(EOF2D);\n\t\tNeedBits8(1, EOF2D);\n\t\tis1D = GetBits(1);\t/* 1D/2D-encoding tag bit */\n\t\tClrBits(1);\n#ifdef FAX3_DEBUG\n\t\tprintf(\" %s\\n-------------------- %d\\n\",\n\t\t    is1D ? \"1D\" : \"2D\", tif->tif_row);\n\t\tfflush(stdout);\n#endif\n\t\tpb = sp->refruns;\n\t\tb1 = *pb++;\n\t\tif (is1D)\n\t\t\tEXPAND1D(EOF2Da);\n\t\telse\n\t\t\tEXPAND2D(EOF2Da);\n\t\t(*sp->fill)(buf, thisrun, pa, lastx);\n\t\tSETVALUE(0);\t\t/* imaginary change for reference */\n\t\tSWAP(uint32*, sp->curruns, sp->refruns);\n\t\tbuf += sp->b.rowbytes;\n\t\tocc -= sp->b.rowbytes;\n\t\tsp->line++;\n\t\tcontinue;\n\tEOF2D:\t\t\t\t/* premature EOF */\n\t\tCLEANUP_RUNS();\n\tEOF2Da:\t\t\t\t/* premature EOF */\n\t\t(*sp->fill)(buf, thisrun, pa, lastx);\n\t\tUNCACHE_STATE(tif, sp);\n\t\treturn (-1);\n\t}\n\tUNCACHE_STATE(tif, sp);\n\treturn (1);\n}\n#undef SWAP\n\n/*\n * The ZERO & FILL macros must handle spans < 2*sizeof(long) bytes.\n * For machines with 64-bit longs this is <16 bytes; otherwise\n * this is <8 bytes.  We optimize the code here to reflect the\n * machine characteristics.\n */\n#if SIZEOF_LONG == 8\n# define FILL(n, cp)\t\t\t\t\t\t\t    \\\n    switch (n) {\t\t\t\t\t\t\t    \\\n    case 15:(cp)[14] = 0xff; case 14:(cp)[13] = 0xff; case 13: (cp)[12] = 0xff;\\\n    case 12:(cp)[11] = 0xff; case 11:(cp)[10] = 0xff; case 10: (cp)[9] = 0xff;\\\n    case  9: (cp)[8] = 0xff; case  8: (cp)[7] = 0xff; case  7: (cp)[6] = 0xff;\\\n    case  6: (cp)[5] = 0xff; case  5: (cp)[4] = 0xff; case  4: (cp)[3] = 0xff;\\\n    case  3: (cp)[2] = 0xff; case  2: (cp)[1] = 0xff;\t\t\t      \\\n    case  1: (cp)[0] = 0xff; (cp) += (n); case 0:  ;\t\t\t      \\\n    }\n# define ZERO(n, cp)\t\t\t\t\t\t\t\\\n    switch (n) {\t\t\t\t\t\t\t\\\n    case 15:(cp)[14] = 0; case 14:(cp)[13] = 0; case 13: (cp)[12] = 0;\t\\\n    case 12:(cp)[11] = 0; case 11:(cp)[10] = 0; case 10: (cp)[9] = 0;\t\\\n    case  9: (cp)[8] = 0; case  8: (cp)[7] = 0; case  7: (cp)[6] = 0;\t\\\n    case  6: (cp)[5] = 0; case  5: (cp)[4] = 0; case  4: (cp)[3] = 0;\t\\\n    case  3: (cp)[2] = 0; case  2: (cp)[1] = 0;\t\t\t\t\\\n    case  1: (cp)[0] = 0; (cp) += (n); case 0:  ;\t\t\t\\\n    }\n#else\n# define FILL(n, cp)\t\t\t\t\t\t\t    \\\n    switch (n) {\t\t\t\t\t\t\t    \\\n    case 7: (cp)[6] = 0xff; case 6: (cp)[5] = 0xff; case 5: (cp)[4] = 0xff; \\\n    case 4: (cp)[3] = 0xff; case 3: (cp)[2] = 0xff; case 2: (cp)[1] = 0xff; \\\n    case 1: (cp)[0] = 0xff; (cp) += (n); case 0:  ;\t\t\t    \\\n    }\n# define ZERO(n, cp)\t\t\t\t\t\t\t\\\n    switch (n) {\t\t\t\t\t\t\t\\\n    case 7: (cp)[6] = 0; case 6: (cp)[5] = 0; case 5: (cp)[4] = 0;\t\\\n    case 4: (cp)[3] = 0; case 3: (cp)[2] = 0; case 2: (cp)[1] = 0;\t\\\n    case 1: (cp)[0] = 0; (cp) += (n); case 0:  ;\t\t\t\\\n    }\n#endif\n\n/*\n * Bit-fill a row according to the white/black\n * runs generated during G3/G4 decoding.\n */\nvoid\n_TIFFFax3fillruns(unsigned char* buf, uint32* runs, uint32* erun, uint32 lastx)\n{\n\tstatic const unsigned char _fillmasks[] =\n\t    { 0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff };\n\tunsigned char* cp;\n\tuint32 x, bx, run;\n\tint32 n, nw;\n\tlong* lp;\n\n\tif ((erun-runs)&1)\n\t    *erun++ = 0;\n\tx = 0;\n\tfor (; runs < erun; runs += 2) {\n\t    run = runs[0];\n\t    if (x+run > lastx || run > lastx )\n\t\trun = runs[0] = (uint32) (lastx - x);\n\t    if (run) {\n\t\tcp = buf + (x>>3);\n\t\tbx = x&7;\n\t\tif (run > 8-bx) {\n\t\t    if (bx) {\t\t\t/* align to byte boundary */\n\t\t\t*cp++ &= 0xff << (8-bx);\n\t\t\trun -= 8-bx;\n\t\t    }\n\t\t    if( (n = run >> 3) != 0 ) {\t/* multiple bytes to fill */\n\t\t\tif ((n/sizeof (long)) > 1) {\n\t\t\t    /*\n\t\t\t     * Align to longword boundary and fill.\n\t\t\t     */\n\t\t\t    for (; n && !isAligned(cp, long); n--)\n\t\t\t\t    *cp++ = 0x00;\n\t\t\t    lp = (long*) cp;\n\t\t\t    nw = (int32)(n / sizeof (long));\n\t\t\t    n -= nw * sizeof (long);\n\t\t\t    do {\n\t\t\t\t    *lp++ = 0L;\n\t\t\t    } while (--nw);\n\t\t\t    cp = (unsigned char*) lp;\n\t\t\t}\n\t\t\tZERO(n, cp);\n\t\t\trun &= 7;\n\t\t    }\n\t\t    if (run)\n\t\t\tcp[0] &= 0xff >> run;\n\t\t} else\n\t\t    cp[0] &= ~(_fillmasks[run]>>bx);\n\t\tx += runs[0];\n\t    }\n\t    run = runs[1];\n\t    if (x+run > lastx || run > lastx )\n\t\trun = runs[1] = lastx - x;\n\t    if (run) {\n\t\tcp = buf + (x>>3);\n\t\tbx = x&7;\n\t\tif (run > 8-bx) {\n\t\t    if (bx) {\t\t\t/* align to byte boundary */\n\t\t\t*cp++ |= 0xff >> bx;\n\t\t\trun -= 8-bx;\n\t\t    }\n\t\t    if( (n = run>>3) != 0 ) {\t/* multiple bytes to fill */\n\t\t\tif ((n/sizeof (long)) > 1) {\n\t\t\t    /*\n\t\t\t     * Align to longword boundary and fill.\n\t\t\t     */\n\t\t\t    for (; n && !isAligned(cp, long); n--)\n\t\t\t\t*cp++ = 0xff;\n\t\t\t    lp = (long*) cp;\n\t\t\t    nw = (int32)(n / sizeof (long));\n\t\t\t    n -= nw * sizeof (long);\n\t\t\t    do {\n\t\t\t\t*lp++ = -1L;\n\t\t\t    } while (--nw);\n\t\t\t    cp = (unsigned char*) lp;\n\t\t\t}\n\t\t\tFILL(n, cp);\n\t\t\trun &= 7;\n\t\t    }\n\t\t    if (run)\n\t\t\tcp[0] |= 0xff00 >> run;\n\t\t} else\n\t\t    cp[0] |= _fillmasks[run]>>bx;\n\t\tx += runs[1];\n\t    }\n\t}\n\tassert(x == lastx);\n}\n#undef\tZERO\n#undef\tFILL\n\n/*\n * Setup G3/G4-related compression/decompression state\n * before data is processed.  This routine is called once\n * per image -- it sets up different state based on whether\n * or not decoding or encoding is being done and whether\n * 1D- or 2D-encoded data is involved.\n */\nstatic int\nFax3SetupState(TIFF* tif)\n{\n\tTIFFDirectory* td = &tif->tif_dir;\n\tFax3BaseState* sp = Fax3State(tif);\n\tint needsRefLine;\n\tFax3CodecState* dsp = (Fax3CodecState*) Fax3State(tif);\n\tuint32 rowbytes, rowpixels, nruns;\n\n\tif (td->td_bitspersample != 1) {\n\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t    \"Bits/sample must be 1 for Group 3/4 encoding/decoding\");\n\t\treturn (0);\n\t}\n\t/*\n\t * Calculate the scanline/tile widths.\n\t */\n\tif (isTiled(tif)) {\n\t\trowbytes = TIFFTileRowSize(tif);\n\t\trowpixels = td->td_tilewidth;\n\t} else {\n\t\trowbytes = TIFFScanlineSize(tif);\n\t\trowpixels = td->td_imagewidth;\n\t}\n\tsp->rowbytes = (uint32) rowbytes;\n\tsp->rowpixels = (uint32) rowpixels;\n\t/*\n\t * Allocate any additional space required for decoding/encoding.\n\t */\n\tneedsRefLine = (\n\t    (sp->groupoptions & GROUP3OPT_2DENCODING) ||\n\t    td->td_compression == COMPRESSION_CCITTFAX4\n\t);\n\n\tnruns = needsRefLine ? 2*TIFFroundup(rowpixels,32) : rowpixels;\n\tnruns += 3;\n\tdsp->runs = (uint32*) _TIFFCheckMalloc(tif, 2*nruns, sizeof (uint32),\n\t\t\t\t\t  \"for Group 3/4 run arrays\");\n\tif (dsp->runs == NULL)\n\t\treturn (0);\n\tdsp->curruns = dsp->runs;\n\tif (needsRefLine)\n\t\tdsp->refruns = dsp->runs + nruns;\n\telse\n\t\tdsp->refruns = NULL;\n\tif (td->td_compression == COMPRESSION_CCITTFAX3\n\t    && is2DEncoding(dsp)) {\t/* NB: default is 1D routine */\n\t\ttif->tif_decoderow = Fax3Decode2D;\n\t\ttif->tif_decodestrip = Fax3Decode2D;\n\t\ttif->tif_decodetile = Fax3Decode2D;\n\t}\n\n\tif (needsRefLine) {\t\t/* 2d encoding */\n\t\tFax3CodecState* esp = EncoderState(tif);\n\t\t/*\n\t\t * 2d encoding requires a scanline\n\t\t * buffer for the ``reference line''; the\n\t\t * scanline against which delta encoding\n\t\t * is referenced.  The reference line must\n\t\t * be initialized to be ``white'' (done elsewhere).\n\t\t */\n\t\tesp->refline = (unsigned char*) _TIFFmalloc(rowbytes);\n\t\tif (esp->refline == NULL) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, \"Fax3SetupState\",\n\t\t\t    \"%s: No space for Group 3/4 reference line\",\n\t\t\t    tif->tif_name);\n\t\t\treturn (0);\n\t\t}\n\t} else\t\t\t\t\t/* 1d encoding */\n\t\tEncoderState(tif)->refline = NULL;\n\n\treturn (1);\n}\n\n/*\n * CCITT Group 3 FAX Encoding.\n */\n\n#define\tFax3FlushBits(tif, sp) {\t\t\t\t\\\n\tif ((tif)->tif_rawcc >= (tif)->tif_rawdatasize)\t\t\\\n\t\t(void) TIFFFlushData1(tif);\t\t\t\\\n\t*(tif)->tif_rawcp++ = (tidataval_t) (sp)->data;\t\t\\\n\t(tif)->tif_rawcc++;\t\t\t\t\t\\\n\t(sp)->data = 0, (sp)->bit = 8;\t\t\t\t\\\n}\n#define\t_FlushBits(tif) {\t\t\t\t\t\\\n\tif ((tif)->tif_rawcc >= (tif)->tif_rawdatasize)\t\t\\\n\t\t(void) TIFFFlushData1(tif);\t\t\t\\\n\t*(tif)->tif_rawcp++ = (tidataval_t) data;\t\t\\\n\t(tif)->tif_rawcc++;\t\t\t\t\t\\\n\tdata = 0, bit = 8;\t\t\t\t\t\\\n}\nstatic const int _msbmask[9] =\n    { 0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff };\n#define\t_PutBits(tif, bits, length) {\t\t\t\t\\\n\twhile (length > bit) {\t\t\t\t\t\\\n\t\tdata |= bits >> (length - bit);\t\t\t\\\n\t\tlength -= bit;\t\t\t\t\t\\\n\t\t_FlushBits(tif);\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\\\n\tdata |= (bits & _msbmask[length]) << (bit - length);\t\\\n\tbit -= length;\t\t\t\t\t\t\\\n\tif (bit == 0)\t\t\t\t\t\t\\\n\t\t_FlushBits(tif);\t\t\t\t\\\n}\n\t\n/*\n * Write a variable-length bit-value to\n * the output stream.  Values are\n * assumed to be at most 16 bits.\n */\nstatic void\nFax3PutBits(TIFF* tif, unsigned int bits, unsigned int length)\n{\n\tFax3CodecState* sp = EncoderState(tif);\n\tunsigned int bit = sp->bit;\n\tint data = sp->data;\n\n\t_PutBits(tif, bits, length);\n\n\tsp->data = data;\n\tsp->bit = bit;\n}\n\n/*\n * Write a code to the output stream.\n */\n#define putcode(tif, te)\tFax3PutBits(tif, (te)->code, (te)->length)\n\n#ifdef FAX3_DEBUG\n#define\tDEBUG_COLOR(w) (tab == TIFFFaxWhiteCodes ? w \"W\" : w \"B\")\n#define\tDEBUG_PRINT(what,len) {\t\t\t\t\t\t\\\n    int t;\t\t\t\t\t\t\t\t\\\n    printf(\"%08X/%-2d: %s%5d\\t\", data, bit, DEBUG_COLOR(what), len);\t\\\n    for (t = length-1; t >= 0; t--)\t\t\t\t\t\\\n\tputchar(code & (1<<t) ? '1' : '0');\t\t\t\t\\\n    putchar('\\n');\t\t\t\t\t\t\t\\\n}\n#endif\n\n/*\n * Write the sequence of codes that describes\n * the specified span of zero's or one's.  The\n * appropriate table that holds the make-up and\n * terminating codes is supplied.\n */\nstatic void\nputspan(TIFF* tif, int32 span, const tableentry* tab)\n{\n\tFax3CodecState* sp = EncoderState(tif);\n\tunsigned int bit = sp->bit;\n\tint data = sp->data;\n\tunsigned int code, length;\n\n\twhile (span >= 2624) {\n\t\tconst tableentry* te = &tab[63 + (2560>>6)];\n\t\tcode = te->code, length = te->length;\n#ifdef FAX3_DEBUG\n\t\tDEBUG_PRINT(\"MakeUp\", te->runlen);\n#endif\n\t\t_PutBits(tif, code, length);\n\t\tspan -= te->runlen;\n\t}\n\tif (span >= 64) {\n\t\tconst tableentry* te = &tab[63 + (span>>6)];\n\t\tassert(te->runlen == 64*(span>>6));\n\t\tcode = te->code, length = te->length;\n#ifdef FAX3_DEBUG\n\t\tDEBUG_PRINT(\"MakeUp\", te->runlen);\n#endif\n\t\t_PutBits(tif, code, length);\n\t\tspan -= te->runlen;\n\t}\n\tcode = tab[span].code, length = tab[span].length;\n#ifdef FAX3_DEBUG\n\tDEBUG_PRINT(\"  Term\", tab[span].runlen);\n#endif\n\t_PutBits(tif, code, length);\n\n\tsp->data = data;\n\tsp->bit = bit;\n}\n\n/*\n * Write an EOL code to the output stream.  The zero-fill\n * logic for byte-aligning encoded scanlines is handled\n * here.  We also handle writing the tag bit for the next\n * scanline when doing 2d encoding.\n */\nstatic void\nFax3PutEOL(TIFF* tif)\n{\n\tFax3CodecState* sp = EncoderState(tif);\n\tunsigned int bit = sp->bit;\n\tint data = sp->data;\n\tunsigned int code, length, tparm;\n\n\tif (sp->b.groupoptions & GROUP3OPT_FILLBITS) {\n\t\t/*\n\t\t * Force bit alignment so EOL will terminate on\n\t\t * a byte boundary.  That is, force the bit alignment\n\t\t * to 16-12 = 4 before putting out the EOL code.\n\t\t */\n\t\tint align = 8 - 4;\n\t\tif (align != sp->bit) {\n\t\t\tif (align > sp->bit)\n\t\t\t\talign = sp->bit + (8 - align);\n\t\t\telse\n\t\t\t\talign = sp->bit - align;\n\t\t\tcode = 0;\n\t\t\ttparm=align; \n\t\t\t_PutBits(tif, 0, tparm);\n\t\t}\n\t}\n\tcode = EOL, length = 12;\n\tif (is2DEncoding(sp))\n\t\tcode = (code<<1) | (sp->tag == G3_1D), length++;\n\t_PutBits(tif, code, length);\n\n\tsp->data = data;\n\tsp->bit = bit;\n}\n\n/*\n * Reset encoding state at the start of a strip.\n */\nstatic int\nFax3PreEncode(TIFF* tif, tsample_t s)\n{\n\tFax3CodecState* sp = EncoderState(tif);\n\n\t(void) s;\n\tassert(sp != NULL);\n\tsp->bit = 8;\n\tsp->data = 0;\n\tsp->tag = G3_1D;\n\t/*\n\t * This is necessary for Group 4; otherwise it isn't\n\t * needed because the first scanline of each strip ends\n\t * up being copied into the refline.\n\t */\n\tif (sp->refline)\n\t\t_TIFFmemset(sp->refline, 0x00, sp->b.rowbytes);\n\tif (is2DEncoding(sp)) {\n\t\tfloat res = tif->tif_dir.td_yresolution;\n\t\t/*\n\t\t * The CCITT spec says that when doing 2d encoding, you\n\t\t * should only do it on K consecutive scanlines, where K\n\t\t * depends on the resolution of the image being encoded\n\t\t * (2 for <= 200 lpi, 4 for > 200 lpi).  Since the directory\n\t\t * code initializes td_yresolution to 0, this code will\n\t\t * select a K of 2 unless the YResolution tag is set\n\t\t * appropriately.  (Note also that we fudge a little here\n\t\t * and use 150 lpi to avoid problems with units conversion.)\n\t\t */\n\t\tif (tif->tif_dir.td_resolutionunit == RESUNIT_CENTIMETER)\n\t\t\tres *= 2.54f;\t\t/* convert to inches */\n\t\tsp->maxk = (res > 150 ? 4 : 2);\n\t\tsp->k = sp->maxk-1;\n\t} else\n\t\tsp->k = sp->maxk = 0;\n\tsp->line = 0;\n\treturn (1);\n}\n\nstatic const unsigned char zeroruns[256] = {\n    8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4,\t/* 0x00 - 0x0f */\n    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,\t/* 0x10 - 0x1f */\n    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,\t/* 0x20 - 0x2f */\n    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,\t/* 0x30 - 0x3f */\n    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\t/* 0x40 - 0x4f */\n    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\t/* 0x50 - 0x5f */\n    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\t/* 0x60 - 0x6f */\n    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\t/* 0x70 - 0x7f */\n    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\t/* 0x80 - 0x8f */\n    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\t/* 0x90 - 0x9f */\n    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\t/* 0xa0 - 0xaf */\n    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\t/* 0xb0 - 0xbf */\n    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\t/* 0xc0 - 0xcf */\n    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\t/* 0xd0 - 0xdf */\n    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\t/* 0xe0 - 0xef */\n    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\t/* 0xf0 - 0xff */\n};\nstatic const unsigned char oneruns[256] = {\n    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\t/* 0x00 - 0x0f */\n    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\t/* 0x10 - 0x1f */\n    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\t/* 0x20 - 0x2f */\n    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\t/* 0x30 - 0x3f */\n    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\t/* 0x40 - 0x4f */\n    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\t/* 0x50 - 0x5f */\n    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\t/* 0x60 - 0x6f */\n    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\t/* 0x70 - 0x7f */\n    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\t/* 0x80 - 0x8f */\n    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\t/* 0x90 - 0x9f */\n    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\t/* 0xa0 - 0xaf */\n    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\t/* 0xb0 - 0xbf */\n    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,\t/* 0xc0 - 0xcf */\n    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,\t/* 0xd0 - 0xdf */\n    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,\t/* 0xe0 - 0xef */\n    4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 7, 8,\t/* 0xf0 - 0xff */\n};\n\n/*\n * On certain systems it pays to inline\n * the routines that find pixel spans.\n */\n#ifdef VAXC\nstatic\tint32 find0span(unsigned char*, int32, int32);\nstatic\tint32 find1span(unsigned char*, int32, int32);\n#pragma inline(find0span,find1span)\n#endif\n\n/*\n * Find a span of ones or zeros using the supplied\n * table.  The ``base'' of the bit string is supplied\n * along with the start+end bit indices.\n */\nstatic int32\nfind0span(unsigned char* bp, int32 bs, int32 be)\n{\n\tint32 bits = be - bs;\n\tint32 n, span;\n\n\tbp += bs>>3;\n\t/*\n\t * Check partial byte on lhs.\n\t */\n\tif (bits > 0 && (n = (bs & 7))) {\n\t\tspan = zeroruns[(*bp << n) & 0xff];\n\t\tif (span > 8-n)\t\t/* table value too generous */\n\t\t\tspan = 8-n;\n\t\tif (span > bits)\t/* constrain span to bit range */\n\t\t\tspan = bits;\n\t\tif (n+span < 8)\t\t/* doesn't extend to edge of byte */\n\t\t\treturn (span);\n\t\tbits -= span;\n\t\tbp++;\n\t} else\n\t\tspan = 0;\n\tif (bits >= (int32)(2 * 8 * sizeof(long))) {\n\t\tlong* lp;\n\t\t/*\n\t\t * Align to longword boundary and check longwords.\n\t\t */\n\t\twhile (!isAligned(bp, long)) {\n\t\t\tif (*bp != 0x00)\n\t\t\t\treturn (span + zeroruns[*bp]);\n\t\t\tspan += 8, bits -= 8;\n\t\t\tbp++;\n\t\t}\n\t\tlp = (long*) bp;\n\t\twhile ((bits >= (int32)(8 * sizeof(long))) && (0 == *lp)) {\n\t\t\tspan += 8*sizeof (long), bits -= 8*sizeof (long);\n\t\t\tlp++;\n\t\t}\n\t\tbp = (unsigned char*) lp;\n\t}\n\t/*\n\t * Scan full bytes for all 0's.\n\t */\n\twhile (bits >= 8) {\n\t\tif (*bp != 0x00)\t/* end of run */\n\t\t\treturn (span + zeroruns[*bp]);\n\t\tspan += 8, bits -= 8;\n\t\tbp++;\n\t}\n\t/*\n\t * Check partial byte on rhs.\n\t */\n\tif (bits > 0) {\n\t\tn = zeroruns[*bp];\n\t\tspan += (n > bits ? bits : n);\n\t}\n\treturn (span);\n}\n\nstatic int32\nfind1span(unsigned char* bp, int32 bs, int32 be)\n{\n\tint32 bits = be - bs;\n\tint32 n, span;\n\n\tbp += bs>>3;\n\t/*\n\t * Check partial byte on lhs.\n\t */\n\tif (bits > 0 && (n = (bs & 7))) {\n\t\tspan = oneruns[(*bp << n) & 0xff];\n\t\tif (span > 8-n)\t\t/* table value too generous */\n\t\t\tspan = 8-n;\n\t\tif (span > bits)\t/* constrain span to bit range */\n\t\t\tspan = bits;\n\t\tif (n+span < 8)\t\t/* doesn't extend to edge of byte */\n\t\t\treturn (span);\n\t\tbits -= span;\n\t\tbp++;\n\t} else\n\t\tspan = 0;\n\tif (bits >= (int32)(2 * 8 * sizeof(long))) {\n\t\tlong* lp;\n\t\t/*\n\t\t * Align to longword boundary and check longwords.\n\t\t */\n\t\twhile (!isAligned(bp, long)) {\n\t\t\tif (*bp != 0xff)\n\t\t\t\treturn (span + oneruns[*bp]);\n\t\t\tspan += 8, bits -= 8;\n\t\t\tbp++;\n\t\t}\n\t\tlp = (long*) bp;\n\t\twhile ((bits >= (int32)(8 * sizeof(long))) && (~0 == *lp)) {\n\t\t\tspan += 8*sizeof (long), bits -= 8*sizeof (long);\n\t\t\tlp++;\n\t\t}\n\t\tbp = (unsigned char*) lp;\n\t}\n\t/*\n\t * Scan full bytes for all 1's.\n\t */\n\twhile (bits >= 8) {\n\t\tif (*bp != 0xff)\t/* end of run */\n\t\t\treturn (span + oneruns[*bp]);\n\t\tspan += 8, bits -= 8;\n\t\tbp++;\n\t}\n\t/*\n\t * Check partial byte on rhs.\n\t */\n\tif (bits > 0) {\n\t\tn = oneruns[*bp];\n\t\tspan += (n > bits ? bits : n);\n\t}\n\treturn (span);\n}\n\n/*\n * Return the offset of the next bit in the range\n * [bs..be] that is different from the specified\n * color.  The end, be, is returned if no such bit\n * exists.\n */\n#define\tfinddiff(_cp, _bs, _be, _color)\t\\\n\t(_bs + (_color ? find1span(_cp,_bs,_be) : find0span(_cp,_bs,_be)))\n/*\n * Like finddiff, but also check the starting bit\n * against the end in case start > end.\n */\n#define\tfinddiff2(_cp, _bs, _be, _color) \\\n\t(_bs < _be ? finddiff(_cp,_bs,_be,_color) : _be)\n\n/*\n * 1d-encode a row of pixels.  The encoding is\n * a sequence of all-white or all-black spans\n * of pixels encoded with Huffman codes.\n */\nstatic int\nFax3Encode1DRow(TIFF* tif, unsigned char* bp, uint32 bits)\n{\n\tFax3CodecState* sp = EncoderState(tif);\n\tint32 span;\n        uint32 bs = 0;\n\n\tfor (;;) {\n\t\tspan = find0span(bp, bs, bits);\t\t/* white span */\n\t\tputspan(tif, span, TIFFFaxWhiteCodes);\n\t\tbs += span;\n\t\tif (bs >= bits)\n\t\t\tbreak;\n\t\tspan = find1span(bp, bs, bits);\t\t/* black span */\n\t\tputspan(tif, span, TIFFFaxBlackCodes);\n\t\tbs += span;\n\t\tif (bs >= bits)\n\t\t\tbreak;\n\t}\n\tif (sp->b.mode & (FAXMODE_BYTEALIGN|FAXMODE_WORDALIGN)) {\n\t\tif (sp->bit != 8)\t\t\t/* byte-align */\n\t\t\tFax3FlushBits(tif, sp);\n\t\tif ((sp->b.mode&FAXMODE_WORDALIGN) &&\n\t\t    !isAligned(tif->tif_rawcp, uint16))\n\t\t\tFax3FlushBits(tif, sp);\n\t}\n\treturn (1);\n}\n\nstatic const tableentry horizcode =\n    { 3, 0x1, 0 };\t/* 001 */\nstatic const tableentry passcode =\n    { 4, 0x1, 0 };\t/* 0001 */\nstatic const tableentry vcodes[7] = {\n    { 7, 0x03, 0 },\t/* 0000 011 */\n    { 6, 0x03, 0 },\t/* 0000 11 */\n    { 3, 0x03, 0 },\t/* 011 */\n    { 1, 0x1, 0 },\t/* 1 */\n    { 3, 0x2, 0 },\t/* 010 */\n    { 6, 0x02, 0 },\t/* 0000 10 */\n    { 7, 0x02, 0 }\t/* 0000 010 */\n};\n\n/*\n * 2d-encode a row of pixels.  Consult the CCITT\n * documentation for the algorithm.\n */\nstatic int\nFax3Encode2DRow(TIFF* tif, unsigned char* bp, unsigned char* rp, uint32 bits)\n{\n#define\tPIXEL(buf,ix)\t((((buf)[(ix)>>3]) >> (7-((ix)&7))) & 1)\n        uint32 a0 = 0;\n\tuint32 a1 = (PIXEL(bp, 0) != 0 ? 0 : finddiff(bp, 0, bits, 0));\n\tuint32 b1 = (PIXEL(rp, 0) != 0 ? 0 : finddiff(rp, 0, bits, 0));\n\tuint32 a2, b2;\n\n\tfor (;;) {\n\t\tb2 = finddiff2(rp, b1, bits, PIXEL(rp,b1));\n\t\tif (b2 >= a1) {\n\t\t\tint32 d = b1 - a1;\n\t\t\tif (!(-3 <= d && d <= 3)) {\t/* horizontal mode */\n\t\t\t\ta2 = finddiff2(bp, a1, bits, PIXEL(bp,a1));\n\t\t\t\tputcode(tif, &horizcode);\n\t\t\t\tif (a0+a1 == 0 || PIXEL(bp, a0) == 0) {\n\t\t\t\t\tputspan(tif, a1-a0, TIFFFaxWhiteCodes);\n\t\t\t\t\tputspan(tif, a2-a1, TIFFFaxBlackCodes);\n\t\t\t\t} else {\n\t\t\t\t\tputspan(tif, a1-a0, TIFFFaxBlackCodes);\n\t\t\t\t\tputspan(tif, a2-a1, TIFFFaxWhiteCodes);\n\t\t\t\t}\n\t\t\t\ta0 = a2;\n\t\t\t} else {\t\t\t/* vertical mode */\n\t\t\t\tputcode(tif, &vcodes[d+3]);\n\t\t\t\ta0 = a1;\n\t\t\t}\n\t\t} else {\t\t\t\t/* pass mode */\n\t\t\tputcode(tif, &passcode);\n\t\t\ta0 = b2;\n\t\t}\n\t\tif (a0 >= bits)\n\t\t\tbreak;\n\t\ta1 = finddiff(bp, a0, bits, PIXEL(bp,a0));\n\t\tb1 = finddiff(rp, a0, bits, !PIXEL(bp,a0));\n\t\tb1 = finddiff(rp, b1, bits, PIXEL(bp,a0));\n\t}\n\treturn (1);\n#undef PIXEL\n}\n\n/*\n * Encode a buffer of pixels.\n */\nstatic int\nFax3Encode(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)\n{\n\tFax3CodecState* sp = EncoderState(tif);\n\n\t(void) s;\n\twhile ((long)cc > 0) {\n\t\tif ((sp->b.mode & FAXMODE_NOEOL) == 0)\n\t\t\tFax3PutEOL(tif);\n\t\tif (is2DEncoding(sp)) {\n\t\t\tif (sp->tag == G3_1D) {\n\t\t\t\tif (!Fax3Encode1DRow(tif, bp, sp->b.rowpixels))\n\t\t\t\t\treturn (0);\n\t\t\t\tsp->tag = G3_2D;\n\t\t\t} else {\n\t\t\t\tif (!Fax3Encode2DRow(tif, bp, sp->refline,\n                                                     sp->b.rowpixels))\n\t\t\t\t\treturn (0);\n\t\t\t\tsp->k--;\n\t\t\t}\n\t\t\tif (sp->k == 0) {\n\t\t\t\tsp->tag = G3_1D;\n\t\t\t\tsp->k = sp->maxk-1;\n\t\t\t} else\n\t\t\t\t_TIFFmemcpy(sp->refline, bp, sp->b.rowbytes);\n\t\t} else {\n\t\t\tif (!Fax3Encode1DRow(tif, bp, sp->b.rowpixels))\n\t\t\t\treturn (0);\n\t\t}\n\t\tbp += sp->b.rowbytes;\n\t\tcc -= sp->b.rowbytes;\n\t}\n\treturn (1);\n}\n\nstatic int\nFax3PostEncode(TIFF* tif)\n{\n\tFax3CodecState* sp = EncoderState(tif);\n\n\tif (sp->bit != 8)\n\t\tFax3FlushBits(tif, sp);\n\treturn (1);\n}\n\nstatic void\nFax3Close(TIFF* tif)\n{\n\tif ((Fax3State(tif)->mode & FAXMODE_NORTC) == 0) {\n\t\tFax3CodecState* sp = EncoderState(tif);\n\t\tunsigned int code = EOL;\n\t\tunsigned int length = 12;\n\t\tint i;\n\n\t\tif (is2DEncoding(sp))\n\t\t\tcode = (code<<1) | (sp->tag == G3_1D), length++;\n\t\tfor (i = 0; i < 6; i++)\n\t\t\tFax3PutBits(tif, code, length);\n\t\tFax3FlushBits(tif, sp);\n\t}\n}\n\nstatic void\nFax3Cleanup(TIFF* tif)\n{\n\tFax3CodecState* sp = DecoderState(tif);\n\t\n\tassert(sp != 0);\n\n\ttif->tif_tagmethods.vgetfield = sp->b.vgetparent;\n\ttif->tif_tagmethods.vsetfield = sp->b.vsetparent;\n\ttif->tif_tagmethods.printdir = sp->b.printdir;\n\n\tif (sp->runs)\n\t\t_TIFFfree(sp->runs);\n\tif (sp->refline)\n\t\t_TIFFfree(sp->refline);\n\n\tif (Fax3State(tif)->subaddress)\n\t\t_TIFFfree(Fax3State(tif)->subaddress);\n\tif (Fax3State(tif)->faxdcs)\n\t\t_TIFFfree(Fax3State(tif)->faxdcs);\n\n\t_TIFFfree(tif->tif_data);\n\ttif->tif_data = NULL;\n\n\t_TIFFSetDefaultCompressionState(tif);\n}\n\n#define\tFIELD_BADFAXLINES\t(FIELD_CODEC+0)\n#define\tFIELD_CLEANFAXDATA\t(FIELD_CODEC+1)\n#define\tFIELD_BADFAXRUN\t\t(FIELD_CODEC+2)\n#define\tFIELD_RECVPARAMS\t(FIELD_CODEC+3)\n#define\tFIELD_SUBADDRESS\t(FIELD_CODEC+4)\n#define\tFIELD_RECVTIME\t\t(FIELD_CODEC+5)\n#define\tFIELD_FAXDCS\t\t(FIELD_CODEC+6)\n\n#define\tFIELD_OPTIONS\t\t(FIELD_CODEC+7)\n\nstatic const TIFFFieldInfo faxFieldInfo[] = {\n    { TIFFTAG_FAXMODE,\t\t 0, 0,\tTIFF_ANY,\tFIELD_PSEUDO,\n      FALSE,\tFALSE,\t\"FaxMode\" },\n    { TIFFTAG_FAXFILLFUNC,\t 0, 0,\tTIFF_ANY,\tFIELD_PSEUDO,\n      FALSE,\tFALSE,\t\"FaxFillFunc\" },\n    { TIFFTAG_BADFAXLINES,\t 1, 1,\tTIFF_LONG,\tFIELD_BADFAXLINES,\n      TRUE,\tFALSE,\t\"BadFaxLines\" },\n    { TIFFTAG_BADFAXLINES,\t 1, 1,\tTIFF_SHORT,\tFIELD_BADFAXLINES,\n      TRUE,\tFALSE,\t\"BadFaxLines\" },\n    { TIFFTAG_CLEANFAXDATA,\t 1, 1,\tTIFF_SHORT,\tFIELD_CLEANFAXDATA,\n      TRUE,\tFALSE,\t\"CleanFaxData\" },\n    { TIFFTAG_CONSECUTIVEBADFAXLINES,1,1, TIFF_LONG,\tFIELD_BADFAXRUN,\n      TRUE,\tFALSE,\t\"ConsecutiveBadFaxLines\" },\n    { TIFFTAG_CONSECUTIVEBADFAXLINES,1,1, TIFF_SHORT,\tFIELD_BADFAXRUN,\n      TRUE,\tFALSE,\t\"ConsecutiveBadFaxLines\" },\n    { TIFFTAG_FAXRECVPARAMS,\t 1, 1, TIFF_LONG,\tFIELD_RECVPARAMS,\n      TRUE,\tFALSE,\t\"FaxRecvParams\" },\n    { TIFFTAG_FAXSUBADDRESS,\t-1,-1, TIFF_ASCII,\tFIELD_SUBADDRESS,\n      TRUE,\tFALSE,\t\"FaxSubAddress\" },\n    { TIFFTAG_FAXRECVTIME,\t 1, 1, TIFF_LONG,\tFIELD_RECVTIME,\n      TRUE,\tFALSE,\t\"FaxRecvTime\" },\n    { TIFFTAG_FAXDCS,\t\t-1,-1, TIFF_ASCII,\tFIELD_FAXDCS,\n      TRUE,\tFALSE,\t\"FaxDcs\" },\n};\nstatic const TIFFFieldInfo fax3FieldInfo[] = {\n    { TIFFTAG_GROUP3OPTIONS,\t 1, 1,\tTIFF_LONG,\tFIELD_OPTIONS,\n      FALSE,\tFALSE,\t\"Group3Options\" },\n};\nstatic const TIFFFieldInfo fax4FieldInfo[] = {\n    { TIFFTAG_GROUP4OPTIONS,\t 1, 1,\tTIFF_LONG,\tFIELD_OPTIONS,\n      FALSE,\tFALSE,\t\"Group4Options\" },\n};\n#define\tN(a)\t(sizeof (a) / sizeof (a[0]))\n\nstatic int\nFax3VSetField(TIFF* tif, ttag_t tag, va_list ap)\n{\n\tFax3BaseState* sp = Fax3State(tif);\n\tconst TIFFFieldInfo* fip;\n\n\tassert(sp != 0);\n\tassert(sp->vsetparent != 0);\n\n\tswitch (tag) {\n\tcase TIFFTAG_FAXMODE:\n\t\tsp->mode = va_arg(ap, int);\n\t\treturn 1;\t\t\t/* NB: pseudo tag */\n\tcase TIFFTAG_FAXFILLFUNC:\n\t\tDecoderState(tif)->fill = va_arg(ap, TIFFFaxFillFunc);\n\t\treturn 1;\t\t\t/* NB: pseudo tag */\n\tcase TIFFTAG_GROUP3OPTIONS:\n\t\t/* XXX: avoid reading options if compression mismatches. */\n\t\tif (tif->tif_dir.td_compression == COMPRESSION_CCITTFAX3)\n\t\t\tsp->groupoptions = va_arg(ap, uint32);\n\t\tbreak;\n\tcase TIFFTAG_GROUP4OPTIONS:\n\t\t/* XXX: avoid reading options if compression mismatches. */\n\t\tif (tif->tif_dir.td_compression == COMPRESSION_CCITTFAX4)\n\t\t\tsp->groupoptions = va_arg(ap, uint32);\n\t\tbreak;\n\tcase TIFFTAG_BADFAXLINES:\n\t\tsp->badfaxlines = va_arg(ap, uint32);\n\t\tbreak;\n\tcase TIFFTAG_CLEANFAXDATA:\n\t\tsp->cleanfaxdata = (uint16) va_arg(ap, int);\n\t\tbreak;\n\tcase TIFFTAG_CONSECUTIVEBADFAXLINES:\n\t\tsp->badfaxrun = va_arg(ap, uint32);\n\t\tbreak;\n\tcase TIFFTAG_FAXRECVPARAMS:\n\t\tsp->recvparams = va_arg(ap, uint32);\n\t\tbreak;\n\tcase TIFFTAG_FAXSUBADDRESS:\n\t\t_TIFFsetString(&sp->subaddress, va_arg(ap, char*));\n\t\tbreak;\n\tcase TIFFTAG_FAXRECVTIME:\n\t\tsp->recvtime = va_arg(ap, uint32);\n\t\tbreak;\n\tcase TIFFTAG_FAXDCS:\n\t\t_TIFFsetString(&sp->faxdcs, va_arg(ap, char*));\n\t\tbreak;\n\tdefault:\n\t\treturn (*sp->vsetparent)(tif, tag, ap);\n\t}\n\t\n\tif ((fip = _TIFFFieldWithTag(tif, tag)))\n\t\tTIFFSetFieldBit(tif, fip->field_bit);\n\telse\n\t\treturn 0;\n\n\ttif->tif_flags |= TIFF_DIRTYDIRECT;\n\treturn 1;\n}\n\nstatic int\nFax3VGetField(TIFF* tif, ttag_t tag, va_list ap)\n{\n\tFax3BaseState* sp = Fax3State(tif);\n\n\tassert(sp != 0);\n\n\tswitch (tag) {\n\tcase TIFFTAG_FAXMODE:\n\t\t*va_arg(ap, int*) = sp->mode;\n\t\tbreak;\n\tcase TIFFTAG_FAXFILLFUNC:\n\t\t*va_arg(ap, TIFFFaxFillFunc*) = DecoderState(tif)->fill;\n\t\tbreak;\n\tcase TIFFTAG_GROUP3OPTIONS:\n\tcase TIFFTAG_GROUP4OPTIONS:\n\t\t*va_arg(ap, uint32*) = sp->groupoptions;\n\t\tbreak;\n\tcase TIFFTAG_BADFAXLINES:\n\t\t*va_arg(ap, uint32*) = sp->badfaxlines;\n\t\tbreak;\n\tcase TIFFTAG_CLEANFAXDATA:\n\t\t*va_arg(ap, uint16*) = sp->cleanfaxdata;\n\t\tbreak;\n\tcase TIFFTAG_CONSECUTIVEBADFAXLINES:\n\t\t*va_arg(ap, uint32*) = sp->badfaxrun;\n\t\tbreak;\n\tcase TIFFTAG_FAXRECVPARAMS:\n\t\t*va_arg(ap, uint32*) = sp->recvparams;\n\t\tbreak;\n\tcase TIFFTAG_FAXSUBADDRESS:\n\t\t*va_arg(ap, char**) = sp->subaddress;\n\t\tbreak;\n\tcase TIFFTAG_FAXRECVTIME:\n\t\t*va_arg(ap, uint32*) = sp->recvtime;\n\t\tbreak;\n\tcase TIFFTAG_FAXDCS:\n\t\t*va_arg(ap, char**) = sp->faxdcs;\n\t\tbreak;\n\tdefault:\n\t\treturn (*sp->vgetparent)(tif, tag, ap);\n\t}\n\treturn (1);\n}\n\nstatic void\nFax3PrintDir(TIFF* tif, FILE* fd, long flags)\n{\n\tFax3BaseState* sp = Fax3State(tif);\n\n\tassert(sp != 0);\n\n\t(void) flags;\n\tif (TIFFFieldSet(tif,FIELD_OPTIONS)) {\n\t\tconst char* sep = \" \";\n\t\tif (tif->tif_dir.td_compression == COMPRESSION_CCITTFAX4) {\n\t\t\tfprintf(fd, \"  Group 4 Options:\");\n\t\t\tif (sp->groupoptions & GROUP4OPT_UNCOMPRESSED)\n\t\t\t\tfprintf(fd, \"%suncompressed data\", sep);\n\t\t} else {\n\n\t\t\tfprintf(fd, \"  Group 3 Options:\");\n\t\t\tif (sp->groupoptions & GROUP3OPT_2DENCODING)\n\t\t\t\tfprintf(fd, \"%s2-d encoding\", sep), sep = \"+\";\n\t\t\tif (sp->groupoptions & GROUP3OPT_FILLBITS)\n\t\t\t\tfprintf(fd, \"%sEOL padding\", sep), sep = \"+\";\n\t\t\tif (sp->groupoptions & GROUP3OPT_UNCOMPRESSED)\n\t\t\t\tfprintf(fd, \"%suncompressed data\", sep);\n\t\t}\n\t\tfprintf(fd, \" (%lu = 0x%lx)\\n\",\n                        (unsigned long) sp->groupoptions,\n                        (unsigned long) sp->groupoptions);\n\t}\n\tif (TIFFFieldSet(tif,FIELD_CLEANFAXDATA)) {\n\t\tfprintf(fd, \"  Fax Data:\");\n\t\tswitch (sp->cleanfaxdata) {\n\t\tcase CLEANFAXDATA_CLEAN:\n\t\t\tfprintf(fd, \" clean\");\n\t\t\tbreak;\n\t\tcase CLEANFAXDATA_REGENERATED:\n\t\t\tfprintf(fd, \" receiver regenerated\");\n\t\t\tbreak;\n\t\tcase CLEANFAXDATA_UNCLEAN:\n\t\t\tfprintf(fd, \" uncorrected errors\");\n\t\t\tbreak;\n\t\t}\n\t\tfprintf(fd, \" (%u = 0x%x)\\n\",\n\t\t    sp->cleanfaxdata, sp->cleanfaxdata);\n\t}\n\tif (TIFFFieldSet(tif,FIELD_BADFAXLINES))\n\t\tfprintf(fd, \"  Bad Fax Lines: %lu\\n\",\n                        (unsigned long) sp->badfaxlines);\n\tif (TIFFFieldSet(tif,FIELD_BADFAXRUN))\n\t\tfprintf(fd, \"  Consecutive Bad Fax Lines: %lu\\n\",\n\t\t    (unsigned long) sp->badfaxrun);\n\tif (TIFFFieldSet(tif,FIELD_RECVPARAMS))\n\t\tfprintf(fd, \"  Fax Receive Parameters: %08lx\\n\",\n\t\t   (unsigned long) sp->recvparams);\n\tif (TIFFFieldSet(tif,FIELD_SUBADDRESS))\n\t\tfprintf(fd, \"  Fax SubAddress: %s\\n\", sp->subaddress);\n\tif (TIFFFieldSet(tif,FIELD_RECVTIME))\n\t\tfprintf(fd, \"  Fax Receive Time: %lu secs\\n\",\n\t\t    (unsigned long) sp->recvtime);\n\tif (TIFFFieldSet(tif,FIELD_FAXDCS))\n\t\tfprintf(fd, \"  Fax DCS: %s\\n\", sp->faxdcs);\n}\n\nstatic int\nInitCCITTFax3(TIFF* tif)\n{\n\tFax3BaseState* sp;\n\n\t/*\n\t * Merge codec-specific tag information.\n\t */\n\tif (!_TIFFMergeFieldInfo(tif, faxFieldInfo, N(faxFieldInfo))) {\n\t\tTIFFErrorExt(tif->tif_clientdata, \"InitCCITTFax3\",\n\t\t\t\"Merging common CCITT Fax codec-specific tags failed\");\n\t\treturn 0;\n\t}\n\n\t/*\n\t * Allocate state block so tag methods have storage to record values.\n\t */\n\ttif->tif_data = (tidata_t)\n\t\t_TIFFmalloc(sizeof (Fax3CodecState));\n\n\tif (tif->tif_data == NULL) {\n\t\tTIFFErrorExt(tif->tif_clientdata, \"TIFFInitCCITTFax3\",\n\t\t    \"%s: No space for state block\", tif->tif_name);\n\t\treturn (0);\n\t}\n\n\tsp = Fax3State(tif);\n        sp->rw_mode = tif->tif_mode;\n\n\t/*\n\t * Override parent get/set field methods.\n\t */\n\tsp->vgetparent = tif->tif_tagmethods.vgetfield;\n\ttif->tif_tagmethods.vgetfield = Fax3VGetField; /* hook for codec tags */\n\tsp->vsetparent = tif->tif_tagmethods.vsetfield;\n\ttif->tif_tagmethods.vsetfield = Fax3VSetField; /* hook for codec tags */\n\tsp->printdir = tif->tif_tagmethods.printdir;\n\ttif->tif_tagmethods.printdir = Fax3PrintDir;   /* hook for codec tags */\n\tsp->groupoptions = 0;\t\n\tsp->recvparams = 0;\n\tsp->subaddress = NULL;\n\tsp->faxdcs = NULL;\n\n\tif (sp->rw_mode == O_RDONLY) /* FIXME: improve for in place update */\n\t\ttif->tif_flags |= TIFF_NOBITREV; /* decoder does bit reversal */\n\tDecoderState(tif)->runs = NULL;\n\tTIFFSetField(tif, TIFFTAG_FAXFILLFUNC, _TIFFFax3fillruns);\n\tEncoderState(tif)->refline = NULL;\n\n\t/*\n\t * Install codec methods.\n\t */\n\ttif->tif_setupdecode = Fax3SetupState;\n\ttif->tif_predecode = Fax3PreDecode;\n\ttif->tif_decoderow = Fax3Decode1D;\n\ttif->tif_decodestrip = Fax3Decode1D;\n\ttif->tif_decodetile = Fax3Decode1D;\n\ttif->tif_setupencode = Fax3SetupState;\n\ttif->tif_preencode = Fax3PreEncode;\n\ttif->tif_postencode = Fax3PostEncode;\n\ttif->tif_encoderow = Fax3Encode;\n\ttif->tif_encodestrip = Fax3Encode;\n\ttif->tif_encodetile = Fax3Encode;\n\ttif->tif_close = Fax3Close;\n\ttif->tif_cleanup = Fax3Cleanup;\n\n\treturn (1);\n}\n\nint\nTIFFInitCCITTFax3(TIFF* tif, int scheme)\n{\n\t(void) scheme;\n\tif (InitCCITTFax3(tif)) {\n\t\t/*\n\t\t * Merge codec-specific tag information.\n\t\t */\n\t\tif (!_TIFFMergeFieldInfo(tif, fax3FieldInfo, N(fax3FieldInfo))) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, \"TIFFInitCCITTFax3\",\n\t\t\t\"Merging CCITT Fax 3 codec-specific tags failed\");\n\t\t\treturn 0;\n\t\t}\n\n\t\t/*\n\t\t * The default format is Class/F-style w/o RTC.\n\t\t */\n\t\treturn TIFFSetField(tif, TIFFTAG_FAXMODE, FAXMODE_CLASSF);\n\t} else\n\t\treturn 01;\n}\n\n/*\n * CCITT Group 4 (T.6) Facsimile-compatible\n * Compression Scheme Support.\n */\n\n#define\tSWAP(t,a,b)\t{ t x; x = (a); (a) = (b); (b) = x; }\n/*\n * Decode the requested amount of G4-encoded data.\n */\nstatic int\nFax4Decode(TIFF* tif, tidata_t buf, tsize_t occ, tsample_t s)\n{\n\tDECLARE_STATE_2D(tif, sp, \"Fax4Decode\");\n\n\t(void) s;\n\tCACHE_STATE(tif, sp);\n\twhile ((long)occ > 0) {\n\t\ta0 = 0;\n\t\tRunLength = 0;\n\t\tpa = thisrun = sp->curruns;\n\t\tpb = sp->refruns;\n\t\tb1 = *pb++;\n#ifdef FAX3_DEBUG\n\t\tprintf(\"\\nBitAcc=%08X, BitsAvail = %d\\n\", BitAcc, BitsAvail);\n\t\tprintf(\"-------------------- %d\\n\", tif->tif_row);\n\t\tfflush(stdout);\n#endif\n\t\tEXPAND2D(EOFG4);\n                if (EOLcnt)\n                    goto EOFG4;\n\t\t(*sp->fill)(buf, thisrun, pa, lastx);\n\t\tSETVALUE(0);\t\t/* imaginary change for reference */\n\t\tSWAP(uint32*, sp->curruns, sp->refruns);\n\t\tbuf += sp->b.rowbytes;\n\t\tocc -= sp->b.rowbytes;\n\t\tsp->line++;\n\t\tcontinue;\n\tEOFG4:\n                NeedBits16( 13, BADG4 );\n        BADG4:\n#ifdef FAX3_DEBUG\n                if( GetBits(13) != 0x1001 )\n                    fputs( \"Bad RTC\\n\", stderr );\n#endif                \n                ClrBits( 13 );\n\t\t(*sp->fill)(buf, thisrun, pa, lastx);\n\t\tUNCACHE_STATE(tif, sp);\n\t\treturn (-1);\n\t}\n\tUNCACHE_STATE(tif, sp);\n\treturn (1);\n}\n#undef\tSWAP\n\n/*\n * Encode the requested amount of data.\n */\nstatic int\nFax4Encode(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)\n{\n\tFax3CodecState *sp = EncoderState(tif);\n\n\t(void) s;\n\twhile ((long)cc > 0) {\n\t\tif (!Fax3Encode2DRow(tif, bp, sp->refline, sp->b.rowpixels))\n\t\t\treturn (0);\n\t\t_TIFFmemcpy(sp->refline, bp, sp->b.rowbytes);\n\t\tbp += sp->b.rowbytes;\n\t\tcc -= sp->b.rowbytes;\n\t}\n\treturn (1);\n}\n\nstatic int\nFax4PostEncode(TIFF* tif)\n{\n\tFax3CodecState *sp = EncoderState(tif);\n\n\t/* terminate strip w/ EOFB */\n\tFax3PutBits(tif, EOL, 12);\n\tFax3PutBits(tif, EOL, 12);\n\tif (sp->bit != 8)\n\t\tFax3FlushBits(tif, sp);\n\treturn (1);\n}\n\nint\nTIFFInitCCITTFax4(TIFF* tif, int scheme)\n{\n\t(void) scheme;\n\tif (InitCCITTFax3(tif)) {\t\t/* reuse G3 support */\n\t\t/*\n\t\t * Merge codec-specific tag information.\n\t\t */\n\t\tif (!_TIFFMergeFieldInfo(tif, fax4FieldInfo, N(fax4FieldInfo))) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, \"TIFFInitCCITTFax4\",\n\t\t\t\"Merging CCITT Fax 4 codec-specific tags failed\");\n\t\t\treturn 0;\n\t\t}\n\n\t\ttif->tif_decoderow = Fax4Decode;\n\t\ttif->tif_decodestrip = Fax4Decode;\n\t\ttif->tif_decodetile = Fax4Decode;\n\t\ttif->tif_encoderow = Fax4Encode;\n\t\ttif->tif_encodestrip = Fax4Encode;\n\t\ttif->tif_encodetile = Fax4Encode;\n\t\ttif->tif_postencode = Fax4PostEncode;\n\t\t/*\n\t\t * Suppress RTC at the end of each strip.\n\t\t */\n\t\treturn TIFFSetField(tif, TIFFTAG_FAXMODE, FAXMODE_NORTC);\n\t} else\n\t\treturn (0);\n}\n\n/*\n * CCITT Group 3 1-D Modified Huffman RLE Compression Support.\n * (Compression algorithms 2 and 32771)\n */\n\n/*\n * Decode the requested amount of RLE-encoded data.\n */\nstatic int\nFax3DecodeRLE(TIFF* tif, tidata_t buf, tsize_t occ, tsample_t s)\n{\n\tDECLARE_STATE(tif, sp, \"Fax3DecodeRLE\");\n\tint mode = sp->b.mode;\n\n\t(void) s;\n\tCACHE_STATE(tif, sp);\n\tthisrun = sp->curruns;\n\twhile ((long)occ > 0) {\n\t\ta0 = 0;\n\t\tRunLength = 0;\n\t\tpa = thisrun;\n#ifdef FAX3_DEBUG\n\t\tprintf(\"\\nBitAcc=%08X, BitsAvail = %d\\n\", BitAcc, BitsAvail);\n\t\tprintf(\"-------------------- %d\\n\", tif->tif_row);\n\t\tfflush(stdout);\n#endif\n\t\tEXPAND1D(EOFRLE);\n\t\t(*sp->fill)(buf, thisrun, pa, lastx);\n\t\t/*\n\t\t * Cleanup at the end of the row.\n\t\t */\n\t\tif (mode & FAXMODE_BYTEALIGN) {\n\t\t\tint n = BitsAvail - (BitsAvail &~ 7);\n\t\t\tClrBits(n);\n\t\t} else if (mode & FAXMODE_WORDALIGN) {\n\t\t\tint n = BitsAvail - (BitsAvail &~ 15);\n\t\t\tClrBits(n);\n\t\t\tif (BitsAvail == 0 && !isAligned(cp, uint16))\n\t\t\t    cp++;\n\t\t}\n\t\tbuf += sp->b.rowbytes;\n\t\tocc -= sp->b.rowbytes;\n\t\tsp->line++;\n\t\tcontinue;\n\tEOFRLE:\t\t\t\t/* premature EOF */\n\t\t(*sp->fill)(buf, thisrun, pa, lastx);\n\t\tUNCACHE_STATE(tif, sp);\n\t\treturn (-1);\n\t}\n\tUNCACHE_STATE(tif, sp);\n\treturn (1);\n}\n\nint\nTIFFInitCCITTRLE(TIFF* tif, int scheme)\n{\n\t(void) scheme;\n\tif (InitCCITTFax3(tif)) {\t\t/* reuse G3 support */\n\t\ttif->tif_decoderow = Fax3DecodeRLE;\n\t\ttif->tif_decodestrip = Fax3DecodeRLE;\n\t\ttif->tif_decodetile = Fax3DecodeRLE;\n\t\t/*\n\t\t * Suppress RTC+EOLs when encoding and byte-align data.\n\t\t */\n\t\treturn TIFFSetField(tif, TIFFTAG_FAXMODE,\n\t\t    FAXMODE_NORTC|FAXMODE_NOEOL|FAXMODE_BYTEALIGN);\n\t} else\n\t\treturn (0);\n}\n\nint\nTIFFInitCCITTRLEW(TIFF* tif, int scheme)\n{\n\t(void) scheme;\n\tif (InitCCITTFax3(tif)) {\t\t/* reuse G3 support */\n\t\ttif->tif_decoderow = Fax3DecodeRLE;\n\t\ttif->tif_decodestrip = Fax3DecodeRLE;\n\t\ttif->tif_decodetile = Fax3DecodeRLE;\n\t\t/*\n\t\t * Suppress RTC+EOLs when encoding and word-align data.\n\t\t */\n\t\treturn TIFFSetField(tif, TIFFTAG_FAXMODE,\n\t\t    FAXMODE_NORTC|FAXMODE_NOEOL|FAXMODE_WORDALIGN);\n\t} else\n\t\treturn (0);\n}\n#endif /* CCITT_SUPPORT */\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/tif_fax3.h",
    "content": "/* $Id: tif_fax3.h,v 1.5 2005/12/12 09:23:11 dron Exp $ */\n\n/*\n * Copyright (c) 1990-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n#ifndef _FAX3_\n#define\t_FAX3_\n/*\n * TIFF Library.\n *\n * CCITT Group 3 (T.4) and Group 4 (T.6) Decompression Support.\n *\n * Decoder support is derived, with permission, from the code\n * in Frank Cringle's viewfax program;\n *      Copyright (C) 1990, 1995  Frank D. Cringle.\n */\n#include \"tiff.h\"\n\n/*\n * To override the default routine used to image decoded\n * spans one can use the pseduo tag TIFFTAG_FAXFILLFUNC.\n * The routine must have the type signature given below;\n * for example:\n *\n * fillruns(unsigned char* buf, uint32* runs, uint32* erun, uint32 lastx)\n *\n * where buf is place to set the bits, runs is the array of b&w run\n * lengths (white then black), erun is the last run in the array, and\n * lastx is the width of the row in pixels.  Fill routines can assume\n * the run array has room for at least lastx runs and can overwrite\n * data in the run array as needed (e.g. to append zero runs to bring\n * the count up to a nice multiple).\n */\ntypedef\tvoid (*TIFFFaxFillFunc)(unsigned char*, uint32*, uint32*, uint32);\n\n/*\n * The default run filler; made external for other decoders.\n */\n#if defined(__cplusplus)\nextern \"C\" {\n#endif\nextern\tvoid _TIFFFax3fillruns(unsigned char*, uint32*, uint32*, uint32);\n#if defined(__cplusplus)\n}\n#endif\n\n\n/* finite state machine codes */\n#define S_Null\t\t0\n#define S_Pass\t\t1\n#define S_Horiz\t\t2\n#define S_V0\t\t3\n#define S_VR\t\t4\n#define S_VL\t\t5\n#define S_Ext\t\t6\n#define S_TermW\t\t7\n#define S_TermB\t\t8\n#define S_MakeUpW\t9\n#define S_MakeUpB\t10\n#define S_MakeUp\t11\n#define S_EOL\t\t12\n\ntypedef struct {\t\t/* state table entry */\n\tunsigned char State;\t/* see above */\n\tunsigned char Width;\t/* width of code in bits */\n\tuint32\tParam;\t\t/* unsigned 32-bit run length in bits */\n} TIFFFaxTabEnt;\n\nextern\tconst TIFFFaxTabEnt TIFFFaxMainTable[];\nextern\tconst TIFFFaxTabEnt TIFFFaxWhiteTable[];\nextern\tconst TIFFFaxTabEnt TIFFFaxBlackTable[];\n\n/*\n * The following macros define the majority of the G3/G4 decoder\n * algorithm using the state tables defined elsewhere.  To build\n * a decoder you need some setup code and some glue code. Note\n * that you may also need/want to change the way the NeedBits*\n * macros get input data if, for example, you know the data to be\n * decoded is properly aligned and oriented (doing so before running\n * the decoder can be a big performance win).\n *\n * Consult the decoder in the TIFF library for an idea of what you\n * need to define and setup to make use of these definitions.\n *\n * NB: to enable a debugging version of these macros define FAX3_DEBUG\n *     before including this file.  Trace output goes to stdout.\n */\n\n#ifndef EndOfData\n#define EndOfData()\t(cp >= ep)\n#endif\n/*\n * Need <=8 or <=16 bits of input data.  Unlike viewfax we\n * cannot use/assume a word-aligned, properly bit swizzled\n * input data set because data may come from an arbitrarily\n * aligned, read-only source such as a memory-mapped file.\n * Note also that the viewfax decoder does not check for\n * running off the end of the input data buffer.  This is\n * possible for G3-encoded data because it prescans the input\n * data to count EOL markers, but can cause problems for G4\n * data.  In any event, we don't prescan and must watch for\n * running out of data since we can't permit the library to\n * scan past the end of the input data buffer.\n *\n * Finally, note that we must handle remaindered data at the end\n * of a strip specially.  The coder asks for a fixed number of\n * bits when scanning for the next code.  This may be more bits\n * than are actually present in the data stream.  If we appear\n * to run out of data but still have some number of valid bits\n * remaining then we makeup the requested amount with zeros and\n * return successfully.  If the returned data is incorrect then\n * we should be called again and get a premature EOF error;\n * otherwise we should get the right answer.\n */\n#ifndef NeedBits8\n#define NeedBits8(n,eoflab) do {\t\t\t\t\t\\\n    if (BitsAvail < (n)) {\t\t\t\t\t\t\\\n\tif (EndOfData()) {\t\t\t\t\t\t\\\n\t    if (BitsAvail == 0)\t\t\t/* no valid bits */\t\\\n\t\tgoto eoflab;\t\t\t\t\t\t\\\n\t    BitsAvail = (n);\t\t\t/* pad with zeros */\t\\\n\t} else {\t\t\t\t\t\t\t\\\n\t    BitAcc |= ((uint32) bitmap[*cp++])<<BitsAvail;\t\t\\\n\t    BitsAvail += 8;\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n    }\t\t\t\t\t\t\t\t\t\\\n} while (0)\n#endif\n#ifndef NeedBits16\n#define NeedBits16(n,eoflab) do {\t\t\t\t\t\\\n    if (BitsAvail < (n)) {\t\t\t\t\t\t\\\n\tif (EndOfData()) {\t\t\t\t\t\t\\\n\t    if (BitsAvail == 0)\t\t\t/* no valid bits */\t\\\n\t\tgoto eoflab;\t\t\t\t\t\t\\\n\t    BitsAvail = (n);\t\t\t/* pad with zeros */\t\\\n\t} else {\t\t\t\t\t\t\t\\\n\t    BitAcc |= ((uint32) bitmap[*cp++])<<BitsAvail;\t\t\\\n\t    if ((BitsAvail += 8) < (n)) {\t\t\t\t\\\n\t\tif (EndOfData()) {\t\t\t\t\t\\\n\t\t    /* NB: we know BitsAvail is non-zero here */\t\\\n\t\t    BitsAvail = (n);\t\t/* pad with zeros */\t\\\n\t\t} else {\t\t\t\t\t\t\\\n\t\t    BitAcc |= ((uint32) bitmap[*cp++])<<BitsAvail;\t\\\n\t\t    BitsAvail += 8;\t\t\t\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t    }\t\t\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n    }\t\t\t\t\t\t\t\t\t\\\n} while (0)\n#endif\n#define GetBits(n)\t(BitAcc & ((1<<(n))-1))\n#define ClrBits(n) do {\t\t\t\t\t\t\t\\\n    BitsAvail -= (n);\t\t\t\t\t\t\t\\\n    BitAcc >>= (n);\t\t\t\t\t\t\t\\\n} while (0)\n\n#ifdef FAX3_DEBUG\nstatic const char* StateNames[] = {\n    \"Null   \",\n    \"Pass   \",\n    \"Horiz  \",\n    \"V0     \",\n    \"VR     \",\n    \"VL     \",\n    \"Ext    \",\n    \"TermW  \",\n    \"TermB  \",\n    \"MakeUpW\",\n    \"MakeUpB\",\n    \"MakeUp \",\n    \"EOL    \",\n};\n#define DEBUG_SHOW putchar(BitAcc & (1 << t) ? '1' : '0')\n#define LOOKUP8(wid,tab,eoflab) do {\t\t\t\t\t\\\n    int t;\t\t\t\t\t\t\t\t\\\n    NeedBits8(wid,eoflab);\t\t\t\t\t\t\\\n    TabEnt = tab + GetBits(wid);\t\t\t\t\t\\\n    printf(\"%08lX/%d: %s%5d\\t\", (long) BitAcc, BitsAvail,\t\t\\\n\t   StateNames[TabEnt->State], TabEnt->Param);\t\t\t\\\n    for (t = 0; t < TabEnt->Width; t++)\t\t\t\t\t\\\n\tDEBUG_SHOW;\t\t\t\t\t\t\t\\\n    putchar('\\n');\t\t\t\t\t\t\t\\\n    fflush(stdout);\t\t\t\t\t\t\t\\\n    ClrBits(TabEnt->Width);\t\t\t\t\t\t\\\n} while (0)\n#define LOOKUP16(wid,tab,eoflab) do {\t\t\t\t\t\\\n    int t;\t\t\t\t\t\t\t\t\\\n    NeedBits16(wid,eoflab);\t\t\t\t\t\t\\\n    TabEnt = tab + GetBits(wid);\t\t\t\t\t\\\n    printf(\"%08lX/%d: %s%5d\\t\", (long) BitAcc, BitsAvail,\t\t\\\n\t   StateNames[TabEnt->State], TabEnt->Param);\t\t\t\\\n    for (t = 0; t < TabEnt->Width; t++)\t\t\t\t\t\\\n\tDEBUG_SHOW;\t\t\t\t\t\t\t\\\n    putchar('\\n');\t\t\t\t\t\t\t\\\n    fflush(stdout);\t\t\t\t\t\t\t\\\n    ClrBits(TabEnt->Width);\t\t\t\t\t\t\\\n} while (0)\n\n#define SETVALUE(x) do {\t\t\t\t\t\t\t\\\n    *pa++ = RunLength + (x);\t\t\t\t\t\t\\\n    printf(\"SETVALUE: %d\\t%d\\n\", RunLength + (x), a0);\t\t\t\\\n    a0 += x;\t\t\t\t\t\t\t\t\\\n    RunLength = 0;\t\t\t\t\t\t\t\\\n} while (0)\n#else\n#define LOOKUP8(wid,tab,eoflab) do {\t\t\t\t\t\\\n    NeedBits8(wid,eoflab);\t\t\t\t\t\t\\\n    TabEnt = tab + GetBits(wid);\t\t\t\t\t\\\n    ClrBits(TabEnt->Width);\t\t\t\t\t\t\\\n} while (0)\n#define LOOKUP16(wid,tab,eoflab) do {\t\t\t\t\t\\\n    NeedBits16(wid,eoflab);\t\t\t\t\t\t\\\n    TabEnt = tab + GetBits(wid);\t\t\t\t\t\\\n    ClrBits(TabEnt->Width);\t\t\t\t\t\t\\\n} while (0)\n\n/*\n * Append a run to the run length array for the\n * current row and reset decoding state.\n */\n#define SETVALUE(x) do {\t\t\t\t\t\t\t\\\n    *pa++ = RunLength + (x);\t\t\t\t\t\t\\\n    a0 += (x);\t\t\t\t\t\t\t\t\\\n    RunLength = 0;\t\t\t\t\t\t\t\\\n} while (0)\n#endif\n\n/*\n * Synchronize input decoding at the start of each\n * row by scanning for an EOL (if appropriate) and\n * skipping any trash data that might be present\n * after a decoding error.  Note that the decoding\n * done elsewhere that recognizes an EOL only consumes\n * 11 consecutive zero bits.  This means that if EOLcnt\n * is non-zero then we still need to scan for the final flag\n * bit that is part of the EOL code.\n */\n#define\tSYNC_EOL(eoflab) do {\t\t\t\t\t\t\\\n    if (EOLcnt == 0) {\t\t\t\t\t\t\t\\\n\tfor (;;) {\t\t\t\t\t\t\t\\\n\t    NeedBits16(11,eoflab);\t\t\t\t\t\\\n\t    if (GetBits(11) == 0)\t\t\t\t\t\\\n\t\tbreak;\t\t\t\t\t\t\t\\\n\t    ClrBits(1);\t\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n    }\t\t\t\t\t\t\t\t\t\\\n    for (;;) {\t\t\t\t\t\t\t\t\\\n\tNeedBits8(8,eoflab);\t\t\t\t\t\t\\\n\tif (GetBits(8))\t\t\t\t\t\t\t\\\n\t    break;\t\t\t\t\t\t\t\\\n\tClrBits(8);\t\t\t\t\t\t\t\\\n    }\t\t\t\t\t\t\t\t\t\\\n    while (GetBits(1) == 0)\t\t\t\t\t\t\\\n\tClrBits(1);\t\t\t\t\t\t\t\\\n    ClrBits(1);\t\t\t\t/* EOL bit */\t\t\t\\\n    EOLcnt = 0;\t\t\t\t/* reset EOL counter/flag */\t\\\n} while (0)\n\n/*\n * Cleanup the array of runs after decoding a row.\n * We adjust final runs to insure the user buffer is not\n * overwritten and/or undecoded area is white filled.\n */\n#define\tCLEANUP_RUNS() do {\t\t\t\t\t\t\\\n    if (RunLength)\t\t\t\t\t\t\t\\\n\tSETVALUE(0);\t\t\t\t\t\t\t\\\n    if (a0 != lastx) {\t\t\t\t\t\t\t\\\n\tbadlength(a0, lastx);\t\t\t\t\t\t\\\n\twhile (a0 > lastx && pa > thisrun)\t\t\t\t\\\n\t    a0 -= *--pa;\t\t\t\t\t\t\\\n\tif (a0 < lastx) {\t\t\t\t\t\t\\\n\t    if (a0 < 0)\t\t\t\t\t\t\t\\\n\t\ta0 = 0;\t\t\t\t\t\t\t\\\n\t    if ((pa-thisrun)&1)\t\t\t\t\t\t\\\n\t\tSETVALUE(0);\t\t\t\t\t\t\\\n\t    SETVALUE(lastx - a0);\t\t\t\t\t\t\\\n\t} else if (a0 > lastx) {\t\t\t\t\t\\\n\t    SETVALUE(lastx);\t\t\t\t\t\t\\\n\t    SETVALUE(0);\t\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n    }\t\t\t\t\t\t\t\t\t\\\n} while (0)\n\n/*\n * Decode a line of 1D-encoded data.\n *\n * The line expanders are written as macros so that they can be reused\n * but still have direct access to the local variables of the \"calling\"\n * function.\n *\n * Note that unlike the original version we have to explicitly test for\n * a0 >= lastx after each black/white run is decoded.  This is because\n * the original code depended on the input data being zero-padded to\n * insure the decoder recognized an EOL before running out of data.\n */\n#define EXPAND1D(eoflab) do {\t\t\t\t\t\t\\\n    for (;;) {\t\t\t\t\t\t\t\t\\\n\tfor (;;) {\t\t\t\t\t\t\t\\\n\t    LOOKUP16(12, TIFFFaxWhiteTable, eof1d);\t\t\t\\\n\t    switch (TabEnt->State) {\t\t\t\t\t\\\n\t    case S_EOL:\t\t\t\t\t\t\t\\\n\t\tEOLcnt = 1;\t\t\t\t\t\t\\\n\t\tgoto done1d;\t\t\t\t\t\t\\\n\t    case S_TermW:\t\t\t\t\t\t\\\n\t\tSETVALUE(TabEnt->Param);\t\t\t\t\t\\\n\t\tgoto doneWhite1d;\t\t\t\t\t\\\n\t    case S_MakeUpW:\t\t\t\t\t\t\\\n\t    case S_MakeUp:\t\t\t\t\t\t\\\n\t\ta0 += TabEnt->Param;\t\t\t\t\t\\\n\t\tRunLength += TabEnt->Param;\t\t\t\t\\\n\t\tbreak;\t\t\t\t\t\t\t\\\n\t    default:\t\t\t\t\t\t\t\\\n\t\tunexpected(\"WhiteTable\", a0);\t\t\t\t\\\n\t\tgoto done1d;\t\t\t\t\t\t\\\n\t    }\t\t\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n    doneWhite1d:\t\t\t\t\t\t\t\\\n\tif (a0 >= lastx)\t\t\t\t\t\t\\\n\t    goto done1d;\t\t\t\t\t\t\\\n\tfor (;;) {\t\t\t\t\t\t\t\\\n\t    LOOKUP16(13, TIFFFaxBlackTable, eof1d);\t\t\t\\\n\t    switch (TabEnt->State) {\t\t\t\t\t\\\n\t    case S_EOL:\t\t\t\t\t\t\t\\\n\t\tEOLcnt = 1;\t\t\t\t\t\t\\\n\t\tgoto done1d;\t\t\t\t\t\t\\\n\t    case S_TermB:\t\t\t\t\t\t\\\n\t\tSETVALUE(TabEnt->Param);\t\t\t\t\t\\\n\t\tgoto doneBlack1d;\t\t\t\t\t\\\n\t    case S_MakeUpB:\t\t\t\t\t\t\\\n\t    case S_MakeUp:\t\t\t\t\t\t\\\n\t\ta0 += TabEnt->Param;\t\t\t\t\t\\\n\t\tRunLength += TabEnt->Param;\t\t\t\t\\\n\t\tbreak;\t\t\t\t\t\t\t\\\n\t    default:\t\t\t\t\t\t\t\\\n\t\tunexpected(\"BlackTable\", a0);\t\t\t\t\\\n\t\tgoto done1d;\t\t\t\t\t\t\\\n\t    }\t\t\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n    doneBlack1d:\t\t\t\t\t\t\t\\\n\tif (a0 >= lastx)\t\t\t\t\t\t\\\n\t    goto done1d;\t\t\t\t\t\t\\\n        if( *(pa-1) == 0 && *(pa-2) == 0 )\t\t\t\t\\\n            pa -= 2;                                                    \\\n    }\t\t\t\t\t\t\t\t\t\\\neof1d:\t\t\t\t\t\t\t\t\t\\\n    prematureEOF(a0);\t\t\t\t\t\t\t\\\n    CLEANUP_RUNS();\t\t\t\t\t\t\t\\\n    goto eoflab;\t\t\t\t\t\t\t\\\ndone1d:\t\t\t\t\t\t\t\t\t\\\n    CLEANUP_RUNS();\t\t\t\t\t\t\t\\\n} while (0)\n\n/*\n * Update the value of b1 using the array\n * of runs for the reference line.\n */\n#define CHECK_b1 do {\t\t\t\t\t\t\t\\\n    if (pa != thisrun) while (b1 <= a0 && b1 < lastx) {\t\t\t\\\n\tb1 += pb[0] + pb[1];\t\t\t\t\t\t\\\n\tpb += 2;\t\t\t\t\t\t\t\\\n    }\t\t\t\t\t\t\t\t\t\\\n} while (0)\n\n/*\n * Expand a row of 2D-encoded data.\n */\n#define EXPAND2D(eoflab) do {\t\t\t\t\t\t\\\n    while (a0 < lastx) {\t\t\t\t\t\t\\\n\tLOOKUP8(7, TIFFFaxMainTable, eof2d);\t\t\t\t\\\n\tswitch (TabEnt->State) {\t\t\t\t\t\\\n\tcase S_Pass:\t\t\t\t\t\t\t\\\n\t    CHECK_b1;\t\t\t\t\t\t\t\\\n\t    b1 += *pb++;\t\t\t\t\t\t\\\n\t    RunLength += b1 - a0;\t\t\t\t\t\\\n\t    a0 = b1;\t\t\t\t\t\t\t\\\n\t    b1 += *pb++;\t\t\t\t\t\t\\\n\t    break;\t\t\t\t\t\t\t\\\n\tcase S_Horiz:\t\t\t\t\t\t\t\\\n\t    if ((pa-thisrun)&1) {\t\t\t\t\t\\\n\t\tfor (;;) {\t/* black first */\t\t\t\\\n\t\t    LOOKUP16(13, TIFFFaxBlackTable, eof2d);\t\t\\\n\t\t    switch (TabEnt->State) {\t\t\t\t\\\n\t\t    case S_TermB:\t\t\t\t\t\\\n\t\t\tSETVALUE(TabEnt->Param);\t\t\t\t\\\n\t\t\tgoto doneWhite2da;\t\t\t\t\\\n\t\t    case S_MakeUpB:\t\t\t\t\t\\\n\t\t    case S_MakeUp:\t\t\t\t\t\\\n\t\t\ta0 += TabEnt->Param;\t\t\t\t\\\n\t\t\tRunLength += TabEnt->Param;\t\t\t\\\n\t\t\tbreak;\t\t\t\t\t\t\\\n\t\t    default:\t\t\t\t\t\t\\\n\t\t\tgoto badBlack2d;\t\t\t\t\\\n\t\t    }\t\t\t\t\t\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t    doneWhite2da:;\t\t\t\t\t\t\\\n\t\tfor (;;) {\t/* then white */\t\t\t\\\n\t\t    LOOKUP16(12, TIFFFaxWhiteTable, eof2d);\t\t\\\n\t\t    switch (TabEnt->State) {\t\t\t\t\\\n\t\t    case S_TermW:\t\t\t\t\t\\\n\t\t\tSETVALUE(TabEnt->Param);\t\t\t\t\\\n\t\t\tgoto doneBlack2da;\t\t\t\t\\\n\t\t    case S_MakeUpW:\t\t\t\t\t\\\n\t\t    case S_MakeUp:\t\t\t\t\t\\\n\t\t\ta0 += TabEnt->Param;\t\t\t\t\\\n\t\t\tRunLength += TabEnt->Param;\t\t\t\\\n\t\t\tbreak;\t\t\t\t\t\t\\\n\t\t    default:\t\t\t\t\t\t\\\n\t\t\tgoto badWhite2d;\t\t\t\t\\\n\t\t    }\t\t\t\t\t\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t    doneBlack2da:;\t\t\t\t\t\t\\\n\t    } else {\t\t\t\t\t\t\t\\\n\t\tfor (;;) {\t/* white first */\t\t\t\\\n\t\t    LOOKUP16(12, TIFFFaxWhiteTable, eof2d);\t\t\\\n\t\t    switch (TabEnt->State) {\t\t\t\t\\\n\t\t    case S_TermW:\t\t\t\t\t\\\n\t\t\tSETVALUE(TabEnt->Param);\t\t\t\t\\\n\t\t\tgoto doneWhite2db;\t\t\t\t\\\n\t\t    case S_MakeUpW:\t\t\t\t\t\\\n\t\t    case S_MakeUp:\t\t\t\t\t\\\n\t\t\ta0 += TabEnt->Param;\t\t\t\t\\\n\t\t\tRunLength += TabEnt->Param;\t\t\t\\\n\t\t\tbreak;\t\t\t\t\t\t\\\n\t\t    default:\t\t\t\t\t\t\\\n\t\t\tgoto badWhite2d;\t\t\t\t\\\n\t\t    }\t\t\t\t\t\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t    doneWhite2db:;\t\t\t\t\t\t\\\n\t\tfor (;;) {\t/* then black */\t\t\t\\\n\t\t    LOOKUP16(13, TIFFFaxBlackTable, eof2d);\t\t\\\n\t\t    switch (TabEnt->State) {\t\t\t\t\\\n\t\t    case S_TermB:\t\t\t\t\t\\\n\t\t\tSETVALUE(TabEnt->Param);\t\t\t\t\\\n\t\t\tgoto doneBlack2db;\t\t\t\t\\\n\t\t    case S_MakeUpB:\t\t\t\t\t\\\n\t\t    case S_MakeUp:\t\t\t\t\t\\\n\t\t\ta0 += TabEnt->Param;\t\t\t\t\\\n\t\t\tRunLength += TabEnt->Param;\t\t\t\\\n\t\t\tbreak;\t\t\t\t\t\t\\\n\t\t    default:\t\t\t\t\t\t\\\n\t\t\tgoto badBlack2d;\t\t\t\t\\\n\t\t    }\t\t\t\t\t\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t    doneBlack2db:;\t\t\t\t\t\t\\\n\t    }\t\t\t\t\t\t\t\t\\\n\t    CHECK_b1;\t\t\t\t\t\t\t\\\n\t    break;\t\t\t\t\t\t\t\\\n\tcase S_V0:\t\t\t\t\t\t\t\\\n\t    CHECK_b1;\t\t\t\t\t\t\t\\\n\t    SETVALUE(b1 - a0);\t\t\t\t\t\t\\\n\t    b1 += *pb++;\t\t\t\t\t\t\\\n\t    break;\t\t\t\t\t\t\t\\\n\tcase S_VR:\t\t\t\t\t\t\t\\\n\t    CHECK_b1;\t\t\t\t\t\t\t\\\n\t    SETVALUE(b1 - a0 + TabEnt->Param);\t\t\t\t\\\n\t    b1 += *pb++;\t\t\t\t\t\t\\\n\t    break;\t\t\t\t\t\t\t\\\n\tcase S_VL:\t\t\t\t\t\t\t\\\n\t    CHECK_b1;\t\t\t\t\t\t\t\\\n\t    SETVALUE(b1 - a0 - TabEnt->Param);\t\t\t\t\\\n\t    b1 -= *--pb;\t\t\t\t\t\t\\\n\t    break;\t\t\t\t\t\t\t\\\n\tcase S_Ext:\t\t\t\t\t\t\t\\\n\t    *pa++ = lastx - a0;\t\t\t\t\t\t\\\n\t    extension(a0);\t\t\t\t\t\t\\\n\t    goto eol2d;\t\t\t\t\t\t\t\\\n\tcase S_EOL:\t\t\t\t\t\t\t\\\n\t    *pa++ = lastx - a0;\t\t\t\t\t\t\\\n\t    NeedBits8(4,eof2d);\t\t\t\t\t\t\\\n\t    if (GetBits(4))\t\t\t\t\t\t\\\n\t\tunexpected(\"EOL\", a0);\t\t\t\t\t\\\n            ClrBits(4);                                                 \\\n\t    EOLcnt = 1;\t\t\t\t\t\t\t\\\n\t    goto eol2d;\t\t\t\t\t\t\t\\\n\tdefault:\t\t\t\t\t\t\t\\\n\tbadMain2d:\t\t\t\t\t\t\t\\\n\t    unexpected(\"MainTable\", a0);\t\t\t\t\\\n\t    goto eol2d;\t\t\t\t\t\t\t\\\n\tbadBlack2d:\t\t\t\t\t\t\t\\\n\t    unexpected(\"BlackTable\", a0);\t\t\t\t\\\n\t    goto eol2d;\t\t\t\t\t\t\t\\\n\tbadWhite2d:\t\t\t\t\t\t\t\\\n\t    unexpected(\"WhiteTable\", a0);\t\t\t\t\\\n\t    goto eol2d;\t\t\t\t\t\t\t\\\n\teof2d:\t\t\t\t\t\t\t\t\\\n\t    prematureEOF(a0);\t\t\t\t\t\t\\\n\t    CLEANUP_RUNS();\t\t\t\t\t\t\\\n\t    goto eoflab;\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n    }\t\t\t\t\t\t\t\t\t\\\n    if (RunLength) {\t\t\t\t\t\t\t\\\n\tif (RunLength + a0 < lastx) {\t\t\t\t\t\\\n\t    /* expect a final V0 */\t\t\t\t\t\\\n\t    NeedBits8(1,eof2d);\t\t\t\t\t\t\\\n\t    if (!GetBits(1))\t\t\t\t\t\t\\\n\t\tgoto badMain2d;\t\t\t\t\t\t\\\n\t    ClrBits(1);\t\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n\tSETVALUE(0);\t\t\t\t\t\t\t\\\n    }\t\t\t\t\t\t\t\t\t\\\neol2d:\t\t\t\t\t\t\t\t\t\\\n    CLEANUP_RUNS();\t\t\t\t\t\t\t\\\n} while (0)\n#endif /* _FAX3_ */\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/tif_fax3sm.c",
    "content": "/* WARNING, this file was automatically generated by the\n    mkg3states program */\n#include \"tiff.h\"\n#include \"tif_fax3.h\"\n const TIFFFaxTabEnt TIFFFaxMainTable[128] = {\n{12,7,0},{3,1,0},{5,3,1},{3,1,0},{2,3,0},{3,1,0},{4,3,1},{3,1,0},{1,4,0},{3,1,0},\n{5,3,1},{3,1,0},{2,3,0},{3,1,0},{4,3,1},{3,1,0},{5,6,2},{3,1,0},{5,3,1},{3,1,0},\n{2,3,0},{3,1,0},{4,3,1},{3,1,0},{1,4,0},{3,1,0},{5,3,1},{3,1,0},{2,3,0},{3,1,0},\n{4,3,1},{3,1,0},{5,7,3},{3,1,0},{5,3,1},{3,1,0},{2,3,0},{3,1,0},{4,3,1},{3,1,0},\n{1,4,0},{3,1,0},{5,3,1},{3,1,0},{2,3,0},{3,1,0},{4,3,1},{3,1,0},{4,6,2},{3,1,0},\n{5,3,1},{3,1,0},{2,3,0},{3,1,0},{4,3,1},{3,1,0},{1,4,0},{3,1,0},{5,3,1},{3,1,0},\n{2,3,0},{3,1,0},{4,3,1},{3,1,0},{6,7,0},{3,1,0},{5,3,1},{3,1,0},{2,3,0},{3,1,0},\n{4,3,1},{3,1,0},{1,4,0},{3,1,0},{5,3,1},{3,1,0},{2,3,0},{3,1,0},{4,3,1},{3,1,0},\n{5,6,2},{3,1,0},{5,3,1},{3,1,0},{2,3,0},{3,1,0},{4,3,1},{3,1,0},{1,4,0},{3,1,0},\n{5,3,1},{3,1,0},{2,3,0},{3,1,0},{4,3,1},{3,1,0},{4,7,3},{3,1,0},{5,3,1},{3,1,0},\n{2,3,0},{3,1,0},{4,3,1},{3,1,0},{1,4,0},{3,1,0},{5,3,1},{3,1,0},{2,3,0},{3,1,0},\n{4,3,1},{3,1,0},{4,6,2},{3,1,0},{5,3,1},{3,1,0},{2,3,0},{3,1,0},{4,3,1},{3,1,0},\n{1,4,0},{3,1,0},{5,3,1},{3,1,0},{2,3,0},{3,1,0},{4,3,1},{3,1,0}\n};\n const TIFFFaxTabEnt TIFFFaxWhiteTable[4096] = {\n{12,11,0},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},\n{7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},\n{7,8,39},{7,6,16},{9,8,576},{7,4,6},{7,7,19},{7,5,8},{7,8,55},{9,5,64},{7,5,10},{7,4,4},\n{7,4,2},{7,4,7},{7,8,45},{7,4,3},{7,5,11},{7,4,5},{7,8,53},{7,5,9},{9,8,448},{7,4,6},\n{7,8,35},{9,5,128},{7,8,51},{7,6,15},{7,8,63},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},\n{9,9,1472},{7,4,5},{7,8,43},{7,6,17},{9,9,1216},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},\n{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,29},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},\n{9,6,1664},{7,4,6},{7,8,33},{9,5,128},{7,8,49},{7,6,14},{7,8,61},{7,4,4},{7,4,2},{7,4,7},\n{7,8,47},{7,4,3},{7,8,59},{7,4,5},{7,8,41},{7,6,16},{9,9,960},{7,4,6},{7,8,31},{7,5,8},\n{7,8,57},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},\n{7,7,26},{7,5,9},{9,9,704},{7,4,6},{7,8,37},{9,5,128},{7,7,25},{7,6,15},{9,8,320},{7,4,4},\n{7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},\n{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{11,11,1792},{7,4,3},\n{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14},\n{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,40},{7,6,16},\n{9,9,832},{7,4,6},{7,7,19},{7,5,8},{7,8,56},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},\n{7,8,46},{7,4,3},{7,5,11},{7,4,5},{7,8,54},{7,5,9},{9,8,512},{7,4,6},{7,8,36},{9,5,128},\n{7,8,52},{7,6,15},{7,8,0},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1600},{7,4,5},\n{7,8,44},{7,6,17},{9,9,1344},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},\n{7,4,2},{7,4,7},{7,8,30},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},\n{7,8,34},{9,5,128},{7,8,50},{7,6,14},{7,8,62},{7,4,4},{7,4,2},{7,4,7},{7,8,48},{7,4,3},\n{7,8,60},{7,4,5},{7,8,42},{7,6,16},{9,9,1088},{7,4,6},{7,8,32},{7,5,8},{7,8,58},{9,5,64},\n{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9},\n{9,8,640},{7,4,6},{7,8,38},{9,5,128},{7,7,25},{7,6,15},{9,8,384},{7,4,4},{7,4,2},{7,4,7},\n{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8},\n{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{0,0,0},{7,4,3},{7,5,11},{7,4,5},\n{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4},\n{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,39},{7,6,16},{9,8,576},{7,4,6},\n{7,7,19},{7,5,8},{7,8,55},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,45},{7,4,3},\n{7,5,11},{7,4,5},{7,8,53},{7,5,9},{9,8,448},{7,4,6},{7,8,35},{9,5,128},{7,8,51},{7,6,15},\n{7,8,63},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1536},{7,4,5},{7,8,43},{7,6,17},\n{9,9,1280},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},\n{7,8,29},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,33},{9,5,128},\n{7,8,49},{7,6,14},{7,8,61},{7,4,4},{7,4,2},{7,4,7},{7,8,47},{7,4,3},{7,8,59},{7,4,5},\n{7,8,41},{7,6,16},{9,9,1024},{7,4,6},{7,8,31},{7,5,8},{7,8,57},{9,5,64},{7,5,10},{7,4,4},\n{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,9,768},{7,4,6},\n{7,8,37},{9,5,128},{7,7,25},{7,6,15},{9,8,320},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},\n{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},\n{7,5,10},{7,4,4},{7,4,2},{7,4,7},{11,11,1856},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},\n{9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7},\n{7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,40},{7,6,16},{9,9,896},{7,4,6},{7,7,19},{7,5,8},\n{7,8,56},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,46},{7,4,3},{7,5,11},{7,4,5},\n{7,8,54},{7,5,9},{9,8,512},{7,4,6},{7,8,36},{9,5,128},{7,8,52},{7,6,15},{7,8,0},{7,4,4},\n{7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1728},{7,4,5},{7,8,44},{7,6,17},{9,9,1408},{7,4,6},\n{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,30},{7,4,3},\n{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,34},{9,5,128},{7,8,50},{7,6,14},\n{7,8,62},{7,4,4},{7,4,2},{7,4,7},{7,8,48},{7,4,3},{7,8,60},{7,4,5},{7,8,42},{7,6,16},\n{9,9,1152},{7,4,6},{7,8,32},{7,5,8},{7,8,58},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},\n{7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,8,640},{7,4,6},{7,8,38},{9,5,128},\n{7,7,25},{7,6,15},{9,8,384},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5},\n{7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},\n{7,4,2},{7,4,7},{0,0,0},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},\n{7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},\n{7,7,27},{7,4,5},{7,8,39},{7,6,16},{9,8,576},{7,4,6},{7,7,19},{7,5,8},{7,8,55},{9,5,64},\n{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,45},{7,4,3},{7,5,11},{7,4,5},{7,8,53},{7,5,9},\n{9,8,448},{7,4,6},{7,8,35},{9,5,128},{7,8,51},{7,6,15},{7,8,63},{7,4,4},{7,4,2},{7,4,7},\n{7,6,13},{7,4,3},{9,9,1472},{7,4,5},{7,8,43},{7,6,17},{9,9,1216},{7,4,6},{7,6,1},{7,5,8},\n{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,29},{7,4,3},{7,5,11},{7,4,5},\n{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,33},{9,5,128},{7,8,49},{7,6,14},{7,8,61},{7,4,4},\n{7,4,2},{7,4,7},{7,8,47},{7,4,3},{7,8,59},{7,4,5},{7,8,41},{7,6,16},{9,9,960},{7,4,6},\n{7,8,31},{7,5,8},{7,8,57},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},\n{7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,9,704},{7,4,6},{7,8,37},{9,5,128},{7,7,25},{7,6,15},\n{9,8,320},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},\n{9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},\n{11,12,2112},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},\n{7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},\n{7,8,40},{7,6,16},{9,9,832},{7,4,6},{7,7,19},{7,5,8},{7,8,56},{9,5,64},{7,5,10},{7,4,4},\n{7,4,2},{7,4,7},{7,8,46},{7,4,3},{7,5,11},{7,4,5},{7,8,54},{7,5,9},{9,8,512},{7,4,6},\n{7,8,36},{9,5,128},{7,8,52},{7,6,15},{7,8,0},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},\n{9,9,1600},{7,4,5},{7,8,44},{7,6,17},{9,9,1344},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},\n{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,30},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},\n{9,6,1664},{7,4,6},{7,8,34},{9,5,128},{7,8,50},{7,6,14},{7,8,62},{7,4,4},{7,4,2},{7,4,7},\n{7,8,48},{7,4,3},{7,8,60},{7,4,5},{7,8,42},{7,6,16},{9,9,1088},{7,4,6},{7,8,32},{7,5,8},\n{7,8,58},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},\n{7,7,26},{7,5,9},{9,8,640},{7,4,6},{7,8,38},{9,5,128},{7,7,25},{7,6,15},{9,8,384},{7,4,4},\n{7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},\n{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{0,0,0},{7,4,3},\n{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14},\n{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,39},{7,6,16},\n{9,8,576},{7,4,6},{7,7,19},{7,5,8},{7,8,55},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},\n{7,8,45},{7,4,3},{7,5,11},{7,4,5},{7,8,53},{7,5,9},{9,8,448},{7,4,6},{7,8,35},{9,5,128},\n{7,8,51},{7,6,15},{7,8,63},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1536},{7,4,5},\n{7,8,43},{7,6,17},{9,9,1280},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},\n{7,4,2},{7,4,7},{7,8,29},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},\n{7,8,33},{9,5,128},{7,8,49},{7,6,14},{7,8,61},{7,4,4},{7,4,2},{7,4,7},{7,8,47},{7,4,3},\n{7,8,59},{7,4,5},{7,8,41},{7,6,16},{9,9,1024},{7,4,6},{7,8,31},{7,5,8},{7,8,57},{9,5,64},\n{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9},\n{9,9,768},{7,4,6},{7,8,37},{9,5,128},{7,7,25},{7,6,15},{9,8,320},{7,4,4},{7,4,2},{7,4,7},\n{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8},\n{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{11,12,2368},{7,4,3},{7,5,11},{7,4,5},\n{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4},\n{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,40},{7,6,16},{9,9,896},{7,4,6},\n{7,7,19},{7,5,8},{7,8,56},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,46},{7,4,3},\n{7,5,11},{7,4,5},{7,8,54},{7,5,9},{9,8,512},{7,4,6},{7,8,36},{9,5,128},{7,8,52},{7,6,15},\n{7,8,0},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1728},{7,4,5},{7,8,44},{7,6,17},\n{9,9,1408},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},\n{7,8,30},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,34},{9,5,128},\n{7,8,50},{7,6,14},{7,8,62},{7,4,4},{7,4,2},{7,4,7},{7,8,48},{7,4,3},{7,8,60},{7,4,5},\n{7,8,42},{7,6,16},{9,9,1152},{7,4,6},{7,8,32},{7,5,8},{7,8,58},{9,5,64},{7,5,10},{7,4,4},\n{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,8,640},{7,4,6},\n{7,8,38},{9,5,128},{7,7,25},{7,6,15},{9,8,384},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},\n{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},\n{7,5,10},{7,4,4},{7,4,2},{7,4,7},{0,0,0},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},\n{9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7},\n{7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,39},{7,6,16},{9,8,576},{7,4,6},{7,7,19},{7,5,8},\n{7,8,55},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,45},{7,4,3},{7,5,11},{7,4,5},\n{7,8,53},{7,5,9},{9,8,448},{7,4,6},{7,8,35},{9,5,128},{7,8,51},{7,6,15},{7,8,63},{7,4,4},\n{7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1472},{7,4,5},{7,8,43},{7,6,17},{9,9,1216},{7,4,6},\n{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,29},{7,4,3},\n{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,33},{9,5,128},{7,8,49},{7,6,14},\n{7,8,61},{7,4,4},{7,4,2},{7,4,7},{7,8,47},{7,4,3},{7,8,59},{7,4,5},{7,8,41},{7,6,16},\n{9,9,960},{7,4,6},{7,8,31},{7,5,8},{7,8,57},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},\n{7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,9,704},{7,4,6},{7,8,37},{9,5,128},\n{7,7,25},{7,6,15},{9,8,320},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5},\n{7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},\n{7,4,2},{7,4,7},{11,12,1984},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},\n{7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},\n{7,7,27},{7,4,5},{7,8,40},{7,6,16},{9,9,832},{7,4,6},{7,7,19},{7,5,8},{7,8,56},{9,5,64},\n{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,46},{7,4,3},{7,5,11},{7,4,5},{7,8,54},{7,5,9},\n{9,8,512},{7,4,6},{7,8,36},{9,5,128},{7,8,52},{7,6,15},{7,8,0},{7,4,4},{7,4,2},{7,4,7},\n{7,6,13},{7,4,3},{9,9,1600},{7,4,5},{7,8,44},{7,6,17},{9,9,1344},{7,4,6},{7,6,1},{7,5,8},\n{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,30},{7,4,3},{7,5,11},{7,4,5},\n{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,34},{9,5,128},{7,8,50},{7,6,14},{7,8,62},{7,4,4},\n{7,4,2},{7,4,7},{7,8,48},{7,4,3},{7,8,60},{7,4,5},{7,8,42},{7,6,16},{9,9,1088},{7,4,6},\n{7,8,32},{7,5,8},{7,8,58},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},\n{7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,8,640},{7,4,6},{7,8,38},{9,5,128},{7,7,25},{7,6,15},\n{9,8,384},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},\n{9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},\n{0,0,0},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},\n{7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},\n{7,8,39},{7,6,16},{9,8,576},{7,4,6},{7,7,19},{7,5,8},{7,8,55},{9,5,64},{7,5,10},{7,4,4},\n{7,4,2},{7,4,7},{7,8,45},{7,4,3},{7,5,11},{7,4,5},{7,8,53},{7,5,9},{9,8,448},{7,4,6},\n{7,8,35},{9,5,128},{7,8,51},{7,6,15},{7,8,63},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},\n{9,9,1536},{7,4,5},{7,8,43},{7,6,17},{9,9,1280},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},\n{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,29},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},\n{9,6,1664},{7,4,6},{7,8,33},{9,5,128},{7,8,49},{7,6,14},{7,8,61},{7,4,4},{7,4,2},{7,4,7},\n{7,8,47},{7,4,3},{7,8,59},{7,4,5},{7,8,41},{7,6,16},{9,9,1024},{7,4,6},{7,8,31},{7,5,8},\n{7,8,57},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},\n{7,7,26},{7,5,9},{9,9,768},{7,4,6},{7,8,37},{9,5,128},{7,7,25},{7,6,15},{9,8,320},{7,4,4},\n{7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},\n{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{11,11,1920},{7,4,3},\n{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14},\n{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,40},{7,6,16},\n{9,9,896},{7,4,6},{7,7,19},{7,5,8},{7,8,56},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},\n{7,8,46},{7,4,3},{7,5,11},{7,4,5},{7,8,54},{7,5,9},{9,8,512},{7,4,6},{7,8,36},{9,5,128},\n{7,8,52},{7,6,15},{7,8,0},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1728},{7,4,5},\n{7,8,44},{7,6,17},{9,9,1408},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},\n{7,4,2},{7,4,7},{7,8,30},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},\n{7,8,34},{9,5,128},{7,8,50},{7,6,14},{7,8,62},{7,4,4},{7,4,2},{7,4,7},{7,8,48},{7,4,3},\n{7,8,60},{7,4,5},{7,8,42},{7,6,16},{9,9,1152},{7,4,6},{7,8,32},{7,5,8},{7,8,58},{9,5,64},\n{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9},\n{9,8,640},{7,4,6},{7,8,38},{9,5,128},{7,7,25},{7,6,15},{9,8,384},{7,4,4},{7,4,2},{7,4,7},\n{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8},\n{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{0,0,0},{7,4,3},{7,5,11},{7,4,5},\n{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4},\n{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,39},{7,6,16},{9,8,576},{7,4,6},\n{7,7,19},{7,5,8},{7,8,55},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,45},{7,4,3},\n{7,5,11},{7,4,5},{7,8,53},{7,5,9},{9,8,448},{7,4,6},{7,8,35},{9,5,128},{7,8,51},{7,6,15},\n{7,8,63},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1472},{7,4,5},{7,8,43},{7,6,17},\n{9,9,1216},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},\n{7,8,29},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,33},{9,5,128},\n{7,8,49},{7,6,14},{7,8,61},{7,4,4},{7,4,2},{7,4,7},{7,8,47},{7,4,3},{7,8,59},{7,4,5},\n{7,8,41},{7,6,16},{9,9,960},{7,4,6},{7,8,31},{7,5,8},{7,8,57},{9,5,64},{7,5,10},{7,4,4},\n{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,9,704},{7,4,6},\n{7,8,37},{9,5,128},{7,7,25},{7,6,15},{9,8,320},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},\n{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},\n{7,5,10},{7,4,4},{7,4,2},{7,4,7},{11,12,2240},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},\n{9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7},\n{7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,40},{7,6,16},{9,9,832},{7,4,6},{7,7,19},{7,5,8},\n{7,8,56},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,46},{7,4,3},{7,5,11},{7,4,5},\n{7,8,54},{7,5,9},{9,8,512},{7,4,6},{7,8,36},{9,5,128},{7,8,52},{7,6,15},{7,8,0},{7,4,4},\n{7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1600},{7,4,5},{7,8,44},{7,6,17},{9,9,1344},{7,4,6},\n{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,30},{7,4,3},\n{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,34},{9,5,128},{7,8,50},{7,6,14},\n{7,8,62},{7,4,4},{7,4,2},{7,4,7},{7,8,48},{7,4,3},{7,8,60},{7,4,5},{7,8,42},{7,6,16},\n{9,9,1088},{7,4,6},{7,8,32},{7,5,8},{7,8,58},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},\n{7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,8,640},{7,4,6},{7,8,38},{9,5,128},\n{7,7,25},{7,6,15},{9,8,384},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5},\n{7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},\n{7,4,2},{7,4,7},{0,0,0},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},\n{7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},\n{7,7,27},{7,4,5},{7,8,39},{7,6,16},{9,8,576},{7,4,6},{7,7,19},{7,5,8},{7,8,55},{9,5,64},\n{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,45},{7,4,3},{7,5,11},{7,4,5},{7,8,53},{7,5,9},\n{9,8,448},{7,4,6},{7,8,35},{9,5,128},{7,8,51},{7,6,15},{7,8,63},{7,4,4},{7,4,2},{7,4,7},\n{7,6,13},{7,4,3},{9,9,1536},{7,4,5},{7,8,43},{7,6,17},{9,9,1280},{7,4,6},{7,6,1},{7,5,8},\n{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,29},{7,4,3},{7,5,11},{7,4,5},\n{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,33},{9,5,128},{7,8,49},{7,6,14},{7,8,61},{7,4,4},\n{7,4,2},{7,4,7},{7,8,47},{7,4,3},{7,8,59},{7,4,5},{7,8,41},{7,6,16},{9,9,1024},{7,4,6},\n{7,8,31},{7,5,8},{7,8,57},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},\n{7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,9,768},{7,4,6},{7,8,37},{9,5,128},{7,7,25},{7,6,15},\n{9,8,320},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},\n{9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},\n{11,12,2496},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},\n{7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},\n{7,8,40},{7,6,16},{9,9,896},{7,4,6},{7,7,19},{7,5,8},{7,8,56},{9,5,64},{7,5,10},{7,4,4},\n{7,4,2},{7,4,7},{7,8,46},{7,4,3},{7,5,11},{7,4,5},{7,8,54},{7,5,9},{9,8,512},{7,4,6},\n{7,8,36},{9,5,128},{7,8,52},{7,6,15},{7,8,0},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},\n{9,9,1728},{7,4,5},{7,8,44},{7,6,17},{9,9,1408},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},\n{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,30},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},\n{9,6,1664},{7,4,6},{7,8,34},{9,5,128},{7,8,50},{7,6,14},{7,8,62},{7,4,4},{7,4,2},{7,4,7},\n{7,8,48},{7,4,3},{7,8,60},{7,4,5},{7,8,42},{7,6,16},{9,9,1152},{7,4,6},{7,8,32},{7,5,8},\n{7,8,58},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},\n{7,7,26},{7,5,9},{9,8,640},{7,4,6},{7,8,38},{9,5,128},{7,7,25},{7,6,15},{9,8,384},{7,4,4},\n{7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},\n{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{12,11,0},{7,4,3},\n{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14},\n{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,39},{7,6,16},\n{9,8,576},{7,4,6},{7,7,19},{7,5,8},{7,8,55},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},\n{7,8,45},{7,4,3},{7,5,11},{7,4,5},{7,8,53},{7,5,9},{9,8,448},{7,4,6},{7,8,35},{9,5,128},\n{7,8,51},{7,6,15},{7,8,63},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1472},{7,4,5},\n{7,8,43},{7,6,17},{9,9,1216},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},\n{7,4,2},{7,4,7},{7,8,29},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},\n{7,8,33},{9,5,128},{7,8,49},{7,6,14},{7,8,61},{7,4,4},{7,4,2},{7,4,7},{7,8,47},{7,4,3},\n{7,8,59},{7,4,5},{7,8,41},{7,6,16},{9,9,960},{7,4,6},{7,8,31},{7,5,8},{7,8,57},{9,5,64},\n{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9},\n{9,9,704},{7,4,6},{7,8,37},{9,5,128},{7,7,25},{7,6,15},{9,8,320},{7,4,4},{7,4,2},{7,4,7},\n{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8},\n{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{11,11,1792},{7,4,3},{7,5,11},{7,4,5},\n{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4},\n{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,40},{7,6,16},{9,9,832},{7,4,6},\n{7,7,19},{7,5,8},{7,8,56},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,46},{7,4,3},\n{7,5,11},{7,4,5},{7,8,54},{7,5,9},{9,8,512},{7,4,6},{7,8,36},{9,5,128},{7,8,52},{7,6,15},\n{7,8,0},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1600},{7,4,5},{7,8,44},{7,6,17},\n{9,9,1344},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},\n{7,8,30},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,34},{9,5,128},\n{7,8,50},{7,6,14},{7,8,62},{7,4,4},{7,4,2},{7,4,7},{7,8,48},{7,4,3},{7,8,60},{7,4,5},\n{7,8,42},{7,6,16},{9,9,1088},{7,4,6},{7,8,32},{7,5,8},{7,8,58},{9,5,64},{7,5,10},{7,4,4},\n{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,8,640},{7,4,6},\n{7,8,38},{9,5,128},{7,7,25},{7,6,15},{9,8,384},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},\n{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},\n{7,5,10},{7,4,4},{7,4,2},{7,4,7},{0,0,0},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},\n{9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7},\n{7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,39},{7,6,16},{9,8,576},{7,4,6},{7,7,19},{7,5,8},\n{7,8,55},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,45},{7,4,3},{7,5,11},{7,4,5},\n{7,8,53},{7,5,9},{9,8,448},{7,4,6},{7,8,35},{9,5,128},{7,8,51},{7,6,15},{7,8,63},{7,4,4},\n{7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1536},{7,4,5},{7,8,43},{7,6,17},{9,9,1280},{7,4,6},\n{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,29},{7,4,3},\n{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,33},{9,5,128},{7,8,49},{7,6,14},\n{7,8,61},{7,4,4},{7,4,2},{7,4,7},{7,8,47},{7,4,3},{7,8,59},{7,4,5},{7,8,41},{7,6,16},\n{9,9,1024},{7,4,6},{7,8,31},{7,5,8},{7,8,57},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},\n{7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,9,768},{7,4,6},{7,8,37},{9,5,128},\n{7,7,25},{7,6,15},{9,8,320},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5},\n{7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},\n{7,4,2},{7,4,7},{11,11,1856},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},\n{7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},\n{7,7,27},{7,4,5},{7,8,40},{7,6,16},{9,9,896},{7,4,6},{7,7,19},{7,5,8},{7,8,56},{9,5,64},\n{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,46},{7,4,3},{7,5,11},{7,4,5},{7,8,54},{7,5,9},\n{9,8,512},{7,4,6},{7,8,36},{9,5,128},{7,8,52},{7,6,15},{7,8,0},{7,4,4},{7,4,2},{7,4,7},\n{7,6,13},{7,4,3},{9,9,1728},{7,4,5},{7,8,44},{7,6,17},{9,9,1408},{7,4,6},{7,6,1},{7,5,8},\n{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,30},{7,4,3},{7,5,11},{7,4,5},\n{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,34},{9,5,128},{7,8,50},{7,6,14},{7,8,62},{7,4,4},\n{7,4,2},{7,4,7},{7,8,48},{7,4,3},{7,8,60},{7,4,5},{7,8,42},{7,6,16},{9,9,1152},{7,4,6},\n{7,8,32},{7,5,8},{7,8,58},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},\n{7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,8,640},{7,4,6},{7,8,38},{9,5,128},{7,7,25},{7,6,15},\n{9,8,384},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},\n{9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},\n{0,0,0},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},\n{7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},\n{7,8,39},{7,6,16},{9,8,576},{7,4,6},{7,7,19},{7,5,8},{7,8,55},{9,5,64},{7,5,10},{7,4,4},\n{7,4,2},{7,4,7},{7,8,45},{7,4,3},{7,5,11},{7,4,5},{7,8,53},{7,5,9},{9,8,448},{7,4,6},\n{7,8,35},{9,5,128},{7,8,51},{7,6,15},{7,8,63},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},\n{9,9,1472},{7,4,5},{7,8,43},{7,6,17},{9,9,1216},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},\n{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,29},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},\n{9,6,1664},{7,4,6},{7,8,33},{9,5,128},{7,8,49},{7,6,14},{7,8,61},{7,4,4},{7,4,2},{7,4,7},\n{7,8,47},{7,4,3},{7,8,59},{7,4,5},{7,8,41},{7,6,16},{9,9,960},{7,4,6},{7,8,31},{7,5,8},\n{7,8,57},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},\n{7,7,26},{7,5,9},{9,9,704},{7,4,6},{7,8,37},{9,5,128},{7,7,25},{7,6,15},{9,8,320},{7,4,4},\n{7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},\n{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{11,12,2176},{7,4,3},\n{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14},\n{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,40},{7,6,16},\n{9,9,832},{7,4,6},{7,7,19},{7,5,8},{7,8,56},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},\n{7,8,46},{7,4,3},{7,5,11},{7,4,5},{7,8,54},{7,5,9},{9,8,512},{7,4,6},{7,8,36},{9,5,128},\n{7,8,52},{7,6,15},{7,8,0},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1600},{7,4,5},\n{7,8,44},{7,6,17},{9,9,1344},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},\n{7,4,2},{7,4,7},{7,8,30},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},\n{7,8,34},{9,5,128},{7,8,50},{7,6,14},{7,8,62},{7,4,4},{7,4,2},{7,4,7},{7,8,48},{7,4,3},\n{7,8,60},{7,4,5},{7,8,42},{7,6,16},{9,9,1088},{7,4,6},{7,8,32},{7,5,8},{7,8,58},{9,5,64},\n{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9},\n{9,8,640},{7,4,6},{7,8,38},{9,5,128},{7,7,25},{7,6,15},{9,8,384},{7,4,4},{7,4,2},{7,4,7},\n{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8},\n{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{0,0,0},{7,4,3},{7,5,11},{7,4,5},\n{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4},\n{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,39},{7,6,16},{9,8,576},{7,4,6},\n{7,7,19},{7,5,8},{7,8,55},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,45},{7,4,3},\n{7,5,11},{7,4,5},{7,8,53},{7,5,9},{9,8,448},{7,4,6},{7,8,35},{9,5,128},{7,8,51},{7,6,15},\n{7,8,63},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1536},{7,4,5},{7,8,43},{7,6,17},\n{9,9,1280},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},\n{7,8,29},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,33},{9,5,128},\n{7,8,49},{7,6,14},{7,8,61},{7,4,4},{7,4,2},{7,4,7},{7,8,47},{7,4,3},{7,8,59},{7,4,5},\n{7,8,41},{7,6,16},{9,9,1024},{7,4,6},{7,8,31},{7,5,8},{7,8,57},{9,5,64},{7,5,10},{7,4,4},\n{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,9,768},{7,4,6},\n{7,8,37},{9,5,128},{7,7,25},{7,6,15},{9,8,320},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},\n{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},\n{7,5,10},{7,4,4},{7,4,2},{7,4,7},{11,12,2432},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},\n{9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7},\n{7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,40},{7,6,16},{9,9,896},{7,4,6},{7,7,19},{7,5,8},\n{7,8,56},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,46},{7,4,3},{7,5,11},{7,4,5},\n{7,8,54},{7,5,9},{9,8,512},{7,4,6},{7,8,36},{9,5,128},{7,8,52},{7,6,15},{7,8,0},{7,4,4},\n{7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1728},{7,4,5},{7,8,44},{7,6,17},{9,9,1408},{7,4,6},\n{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,30},{7,4,3},\n{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,34},{9,5,128},{7,8,50},{7,6,14},\n{7,8,62},{7,4,4},{7,4,2},{7,4,7},{7,8,48},{7,4,3},{7,8,60},{7,4,5},{7,8,42},{7,6,16},\n{9,9,1152},{7,4,6},{7,8,32},{7,5,8},{7,8,58},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},\n{7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,8,640},{7,4,6},{7,8,38},{9,5,128},\n{7,7,25},{7,6,15},{9,8,384},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5},\n{7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},\n{7,4,2},{7,4,7},{0,0,0},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},\n{7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},\n{7,7,27},{7,4,5},{7,8,39},{7,6,16},{9,8,576},{7,4,6},{7,7,19},{7,5,8},{7,8,55},{9,5,64},\n{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,45},{7,4,3},{7,5,11},{7,4,5},{7,8,53},{7,5,9},\n{9,8,448},{7,4,6},{7,8,35},{9,5,128},{7,8,51},{7,6,15},{7,8,63},{7,4,4},{7,4,2},{7,4,7},\n{7,6,13},{7,4,3},{9,9,1472},{7,4,5},{7,8,43},{7,6,17},{9,9,1216},{7,4,6},{7,6,1},{7,5,8},\n{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,29},{7,4,3},{7,5,11},{7,4,5},\n{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,33},{9,5,128},{7,8,49},{7,6,14},{7,8,61},{7,4,4},\n{7,4,2},{7,4,7},{7,8,47},{7,4,3},{7,8,59},{7,4,5},{7,8,41},{7,6,16},{9,9,960},{7,4,6},\n{7,8,31},{7,5,8},{7,8,57},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},\n{7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,9,704},{7,4,6},{7,8,37},{9,5,128},{7,7,25},{7,6,15},\n{9,8,320},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},\n{9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},\n{11,12,2048},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},\n{7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},\n{7,8,40},{7,6,16},{9,9,832},{7,4,6},{7,7,19},{7,5,8},{7,8,56},{9,5,64},{7,5,10},{7,4,4},\n{7,4,2},{7,4,7},{7,8,46},{7,4,3},{7,5,11},{7,4,5},{7,8,54},{7,5,9},{9,8,512},{7,4,6},\n{7,8,36},{9,5,128},{7,8,52},{7,6,15},{7,8,0},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},\n{9,9,1600},{7,4,5},{7,8,44},{7,6,17},{9,9,1344},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},\n{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,30},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},\n{9,6,1664},{7,4,6},{7,8,34},{9,5,128},{7,8,50},{7,6,14},{7,8,62},{7,4,4},{7,4,2},{7,4,7},\n{7,8,48},{7,4,3},{7,8,60},{7,4,5},{7,8,42},{7,6,16},{9,9,1088},{7,4,6},{7,8,32},{7,5,8},\n{7,8,58},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},\n{7,7,26},{7,5,9},{9,8,640},{7,4,6},{7,8,38},{9,5,128},{7,7,25},{7,6,15},{9,8,384},{7,4,4},\n{7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},\n{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{0,0,0},{7,4,3},\n{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14},\n{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,39},{7,6,16},\n{9,8,576},{7,4,6},{7,7,19},{7,5,8},{7,8,55},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},\n{7,8,45},{7,4,3},{7,5,11},{7,4,5},{7,8,53},{7,5,9},{9,8,448},{7,4,6},{7,8,35},{9,5,128},\n{7,8,51},{7,6,15},{7,8,63},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1536},{7,4,5},\n{7,8,43},{7,6,17},{9,9,1280},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},\n{7,4,2},{7,4,7},{7,8,29},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},\n{7,8,33},{9,5,128},{7,8,49},{7,6,14},{7,8,61},{7,4,4},{7,4,2},{7,4,7},{7,8,47},{7,4,3},\n{7,8,59},{7,4,5},{7,8,41},{7,6,16},{9,9,1024},{7,4,6},{7,8,31},{7,5,8},{7,8,57},{9,5,64},\n{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9},\n{9,9,768},{7,4,6},{7,8,37},{9,5,128},{7,7,25},{7,6,15},{9,8,320},{7,4,4},{7,4,2},{7,4,7},\n{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8},\n{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{11,11,1920},{7,4,3},{7,5,11},{7,4,5},\n{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4},\n{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,40},{7,6,16},{9,9,896},{7,4,6},\n{7,7,19},{7,5,8},{7,8,56},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,46},{7,4,3},\n{7,5,11},{7,4,5},{7,8,54},{7,5,9},{9,8,512},{7,4,6},{7,8,36},{9,5,128},{7,8,52},{7,6,15},\n{7,8,0},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1728},{7,4,5},{7,8,44},{7,6,17},\n{9,9,1408},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},\n{7,8,30},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,34},{9,5,128},\n{7,8,50},{7,6,14},{7,8,62},{7,4,4},{7,4,2},{7,4,7},{7,8,48},{7,4,3},{7,8,60},{7,4,5},\n{7,8,42},{7,6,16},{9,9,1152},{7,4,6},{7,8,32},{7,5,8},{7,8,58},{9,5,64},{7,5,10},{7,4,4},\n{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,8,640},{7,4,6},\n{7,8,38},{9,5,128},{7,7,25},{7,6,15},{9,8,384},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},\n{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},\n{7,5,10},{7,4,4},{7,4,2},{7,4,7},{0,0,0},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},\n{9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7},\n{7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,39},{7,6,16},{9,8,576},{7,4,6},{7,7,19},{7,5,8},\n{7,8,55},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,45},{7,4,3},{7,5,11},{7,4,5},\n{7,8,53},{7,5,9},{9,8,448},{7,4,6},{7,8,35},{9,5,128},{7,8,51},{7,6,15},{7,8,63},{7,4,4},\n{7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1472},{7,4,5},{7,8,43},{7,6,17},{9,9,1216},{7,4,6},\n{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,29},{7,4,3},\n{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,33},{9,5,128},{7,8,49},{7,6,14},\n{7,8,61},{7,4,4},{7,4,2},{7,4,7},{7,8,47},{7,4,3},{7,8,59},{7,4,5},{7,8,41},{7,6,16},\n{9,9,960},{7,4,6},{7,8,31},{7,5,8},{7,8,57},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},\n{7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,9,704},{7,4,6},{7,8,37},{9,5,128},\n{7,7,25},{7,6,15},{9,8,320},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5},\n{7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},\n{7,4,2},{7,4,7},{11,12,2304},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},\n{7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},\n{7,7,27},{7,4,5},{7,8,40},{7,6,16},{9,9,832},{7,4,6},{7,7,19},{7,5,8},{7,8,56},{9,5,64},\n{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,46},{7,4,3},{7,5,11},{7,4,5},{7,8,54},{7,5,9},\n{9,8,512},{7,4,6},{7,8,36},{9,5,128},{7,8,52},{7,6,15},{7,8,0},{7,4,4},{7,4,2},{7,4,7},\n{7,6,13},{7,4,3},{9,9,1600},{7,4,5},{7,8,44},{7,6,17},{9,9,1344},{7,4,6},{7,6,1},{7,5,8},\n{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,30},{7,4,3},{7,5,11},{7,4,5},\n{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,34},{9,5,128},{7,8,50},{7,6,14},{7,8,62},{7,4,4},\n{7,4,2},{7,4,7},{7,8,48},{7,4,3},{7,8,60},{7,4,5},{7,8,42},{7,6,16},{9,9,1088},{7,4,6},\n{7,8,32},{7,5,8},{7,8,58},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},\n{7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,8,640},{7,4,6},{7,8,38},{9,5,128},{7,7,25},{7,6,15},\n{9,8,384},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},\n{9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},\n{0,0,0},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},\n{7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},\n{7,8,39},{7,6,16},{9,8,576},{7,4,6},{7,7,19},{7,5,8},{7,8,55},{9,5,64},{7,5,10},{7,4,4},\n{7,4,2},{7,4,7},{7,8,45},{7,4,3},{7,5,11},{7,4,5},{7,8,53},{7,5,9},{9,8,448},{7,4,6},\n{7,8,35},{9,5,128},{7,8,51},{7,6,15},{7,8,63},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},\n{9,9,1536},{7,4,5},{7,8,43},{7,6,17},{9,9,1280},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},\n{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,29},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},\n{9,6,1664},{7,4,6},{7,8,33},{9,5,128},{7,8,49},{7,6,14},{7,8,61},{7,4,4},{7,4,2},{7,4,7},\n{7,8,47},{7,4,3},{7,8,59},{7,4,5},{7,8,41},{7,6,16},{9,9,1024},{7,4,6},{7,8,31},{7,5,8},\n{7,8,57},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},\n{7,7,26},{7,5,9},{9,9,768},{7,4,6},{7,8,37},{9,5,128},{7,7,25},{7,6,15},{9,8,320},{7,4,4},\n{7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},\n{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{11,12,2560},{7,4,3},\n{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14},\n{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,40},{7,6,16},\n{9,9,896},{7,4,6},{7,7,19},{7,5,8},{7,8,56},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},\n{7,8,46},{7,4,3},{7,5,11},{7,4,5},{7,8,54},{7,5,9},{9,8,512},{7,4,6},{7,8,36},{9,5,128},\n{7,8,52},{7,6,15},{7,8,0},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1728},{7,4,5},\n{7,8,44},{7,6,17},{9,9,1408},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},\n{7,4,2},{7,4,7},{7,8,30},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},\n{7,8,34},{9,5,128},{7,8,50},{7,6,14},{7,8,62},{7,4,4},{7,4,2},{7,4,7},{7,8,48},{7,4,3},\n{7,8,60},{7,4,5},{7,8,42},{7,6,16},{9,9,1152},{7,4,6},{7,8,32},{7,5,8},{7,8,58},{9,5,64},\n{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9},\n{9,8,640},{7,4,6},{7,8,38},{9,5,128},{7,7,25},{7,6,15},{9,8,384},{7,4,4},{7,4,2},{7,4,7},\n{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8},\n{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7}\n};\n const TIFFFaxTabEnt TIFFFaxBlackTable[8192] = {\n{12,11,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,9,15},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,18},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,17},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,11,1792},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,11,23},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,20},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,11,25},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,12,128},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,12,56},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,12,30},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,11,1856},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,57},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,11,21},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,54},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,9,15},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,52},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,48},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{11,12,2112},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,12,44},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,36},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,12,384},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{0,0,0},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,28},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,12,60},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,40},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,12,2368},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,16},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{10,10,64},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,9,15},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,18},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,10,17},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{11,12,1984},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,50},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,12,34},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,13,1664},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,26},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,13,1408},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,32},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,11,1920},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,12,61},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,42},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{10,13,1024},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,9,15},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{10,13,768},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,12,62},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,12,2240},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,46},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,12,38},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,13,512},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,11,19},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,24},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,22},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{11,12,2496},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,10,16},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,0},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,10,64},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{12,11,0},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,9,15},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,10,18},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,17},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,11,1792},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,23},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,20},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,11,25},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{10,12,192},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,13,1280},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,12,31},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{11,11,1856},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,58},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,11,21},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,13,896},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,9,15},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,13,640},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,49},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,12,2176},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,12,45},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,37},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{10,12,448},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,29},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{10,13,1536},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,12,41},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,12,2432},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,16},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,10,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,10,64},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,9,15},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,18},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,17},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{11,12,2048},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,12,51},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,35},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,12,320},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{0,0,0},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,27},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,12,59},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,33},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,11,1920},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,12,256},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,43},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{10,13,1152},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,9,15},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,55},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,12,63},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{11,12,2304},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,47},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,12,39},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,53},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,19},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,24},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,22},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,12,2560},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,10,16},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,0},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{10,10,64},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{12,11,0},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,9,15},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,10,18},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,10,17},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,11,1792},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,23},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,11,20},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,25},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{10,12,128},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,56},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,30},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{11,11,1856},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,12,57},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,21},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,54},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{0,0,0},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,9,15},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,12,52},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,48},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,12,2112},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,44},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,36},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{10,12,384},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,12,28},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,60},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,12,40},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{11,12,2368},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,16},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,10,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,10,64},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,9,15},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,18},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,17},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,12,1984},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,12,50},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,34},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{10,13,1728},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,26},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{10,13,1472},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,12,32},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,11,1920},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,61},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,12,42},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,13,1088},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,9,15},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,13,832},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,62},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{11,12,2240},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,12,46},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,38},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,13,576},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{0,0,0},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,19},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,11,24},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,22},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,12,2496},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,16},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{10,10,64},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{12,11,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,9,15},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,18},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,10,17},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{11,11,1792},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,23},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,11,20},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,25},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,12,192},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,13,1344},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,31},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,11,1856},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,12,58},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,21},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{10,13,960},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,9,15},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{10,13,704},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,12,49},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,12,2176},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,45},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,12,37},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,12,448},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,12,29},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,13,1600},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,41},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{11,12,2432},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,10,16},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,0},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,10,64},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{0,0,0},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,9,15},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,10,18},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,17},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,12,2048},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,51},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,35},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{10,12,320},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,12,27},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,59},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,12,33},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{11,11,1920},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,12,256},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,12,43},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,13,1216},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,9,15},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,55},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,63},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,12,2304},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,12,47},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,39},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,12,53},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,19},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,11,24},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,11,22},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,12,2560},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,16},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2},{8,10,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},\n{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,10,64},{8,2,3},\n{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},\n{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},\n{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},\n{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},\n{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},\n{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},\n{8,3,4},{8,2,2}\n};\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/tif_flush.c",
    "content": "/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_flush.c,v 1.3 2000/09/15 20:52:42 warmerda Exp $ */\n\n/*\n * Copyright (c) 1988-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n/*\n * TIFF Library.\n */\n#include \"tiffiop.h\"\n\nint\nTIFFFlush(TIFF* tif)\n{\n\n\tif (tif->tif_mode != O_RDONLY) {\n\t\tif (!TIFFFlushData(tif))\n\t\t\treturn (0);\n\t\tif ((tif->tif_flags & TIFF_DIRTYDIRECT) &&\n\t\t    !TIFFWriteDirectory(tif))\n\t\t\treturn (0);\n\t}\n\treturn (1);\n}\n\n/*\n * Flush buffered data to the file.\n *\n * Frank Warmerdam'2000: I modified this to return 1 if TIFF_BEENWRITING\n * is not set, so that TIFFFlush() will proceed to write out the directory.\n * The documentation says returning 1 is an error indicator, but not having\n * been writing isn't exactly a an error.  Hopefully this doesn't cause\n * problems for other people. \n */\nint\nTIFFFlushData(TIFF* tif)\n{\n\tif ((tif->tif_flags & TIFF_BEENWRITING) == 0)\n\t\treturn (0);\n\tif (tif->tif_flags & TIFF_POSTENCODE) {\n\t\ttif->tif_flags &= ~TIFF_POSTENCODE;\n\t\tif (!(*tif->tif_postencode)(tif))\n\t\t\treturn (0);\n\t}\n\treturn (TIFFFlushData1(tif));\n}\n\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/tif_getimage.c",
    "content": "/* $Id: tif_getimage.c,v 1.63.2.3 2009-08-30 16:21:46 bfriesen Exp $ */\n\n/*\n * Copyright (c) 1991-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n/*\n * TIFF Library\n *\n * Read and return a packed RGBA image.\n */\n#include \"tiffiop.h\"\n#include <stdio.h>\n\nstatic int gtTileContig(TIFFRGBAImage*, uint32*, uint32, uint32);\nstatic int gtTileSeparate(TIFFRGBAImage*, uint32*, uint32, uint32);\nstatic int gtStripContig(TIFFRGBAImage*, uint32*, uint32, uint32);\nstatic int gtStripSeparate(TIFFRGBAImage*, uint32*, uint32, uint32);\nstatic int PickContigCase(TIFFRGBAImage*);\nstatic int PickSeparateCase(TIFFRGBAImage*);\nstatic const char photoTag[] = \"PhotometricInterpretation\";\n\n/* \n * Helper constants used in Orientation tag handling\n */\n#define FLIP_VERTICALLY 0x01\n#define FLIP_HORIZONTALLY 0x02\n\n/*\n * Color conversion constants. We will define display types here.\n */\n\nTIFFDisplay display_sRGB = {\n\t{\t\t\t/* XYZ -> luminance matrix */\n\t\t{  3.2410F, -1.5374F, -0.4986F },\n\t\t{  -0.9692F, 1.8760F, 0.0416F },\n\t\t{  0.0556F, -0.2040F, 1.0570F }\n\t},\t\n\t100.0F, 100.0F, 100.0F,\t/* Light o/p for reference white */\n\t255, 255, 255,\t\t/* Pixel values for ref. white */\n\t1.0F, 1.0F, 1.0F,\t/* Residual light o/p for black pixel */\n\t2.4F, 2.4F, 2.4F,\t/* Gamma values for the three guns */\n};\n\n/*\n * Check the image to see if TIFFReadRGBAImage can deal with it.\n * 1/0 is returned according to whether or not the image can\n * be handled.  If 0 is returned, emsg contains the reason\n * why it is being rejected.\n */\nint\nTIFFRGBAImageOK(TIFF* tif, char emsg[1024])\n{\n\tTIFFDirectory* td = &tif->tif_dir;\n\tuint16 photometric;\n\tint colorchannels;\n\n\tif (!tif->tif_decodestatus) {\n\t\tsprintf(emsg, \"Sorry, requested compression method is not configured\");\n\t\treturn (0);\n\t}\n\tswitch (td->td_bitspersample) {\n\t\tcase 1:\n\t\tcase 2:\n\t\tcase 4:\n\t\tcase 8:\n\t\tcase 16:\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tsprintf(emsg, \"Sorry, can not handle images with %d-bit samples\",\n\t\t\t    td->td_bitspersample);\n\t\t\treturn (0);\n\t}\n\tcolorchannels = td->td_samplesperpixel - td->td_extrasamples;\n\tif (!TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &photometric)) {\n\t\tswitch (colorchannels) {\n\t\t\tcase 1:\n\t\t\t\tphotometric = PHOTOMETRIC_MINISBLACK;\n\t\t\t\tbreak;\n\t\t\tcase 3:\n\t\t\t\tphotometric = PHOTOMETRIC_RGB;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tsprintf(emsg, \"Missing needed %s tag\", photoTag);\n\t\t\t\treturn (0);\n\t\t}\n\t}\n\tswitch (photometric) {\n\t\tcase PHOTOMETRIC_MINISWHITE:\n\t\tcase PHOTOMETRIC_MINISBLACK:\n\t\tcase PHOTOMETRIC_PALETTE:\n\t\t\tif (td->td_planarconfig == PLANARCONFIG_CONTIG\n\t\t\t    && td->td_samplesperpixel != 1\n\t\t\t    && td->td_bitspersample < 8 ) {\n\t\t\t\tsprintf(emsg,\n\t\t\t\t    \"Sorry, can not handle contiguous data with %s=%d, \"\n\t\t\t\t    \"and %s=%d and Bits/Sample=%d\",\n\t\t\t\t    photoTag, photometric,\n\t\t\t\t    \"Samples/pixel\", td->td_samplesperpixel,\n\t\t\t\t    td->td_bitspersample);\n\t\t\t\treturn (0);\n\t\t\t}\n\t\t\t/*\n\t\t\t * We should likely validate that any extra samples are either\n\t\t\t * to be ignored, or are alpha, and if alpha we should try to use\n\t\t\t * them.  But for now we won't bother with this.\n\t\t\t*/\n\t\t\tbreak;\n\t\tcase PHOTOMETRIC_YCBCR:\n\t\t\t/*\n\t\t\t * TODO: if at all meaningful and useful, make more complete\n\t\t\t * support check here, or better still, refactor to let supporting\n\t\t\t * code decide whether there is support and what meaningfull\n\t\t\t * error to return\n\t\t\t */\n\t\t\tbreak;\n\t\tcase PHOTOMETRIC_RGB:\n\t\t\tif (colorchannels < 3) {\n\t\t\t\tsprintf(emsg, \"Sorry, can not handle RGB image with %s=%d\",\n\t\t\t\t    \"Color channels\", colorchannels);\n\t\t\t\treturn (0);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase PHOTOMETRIC_SEPARATED:\n\t\t\t{\n\t\t\t\tuint16 inkset;\n\t\t\t\tTIFFGetFieldDefaulted(tif, TIFFTAG_INKSET, &inkset);\n\t\t\t\tif (inkset != INKSET_CMYK) {\n\t\t\t\t\tsprintf(emsg,\n\t\t\t\t\t    \"Sorry, can not handle separated image with %s=%d\",\n\t\t\t\t\t    \"InkSet\", inkset);\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\tif (td->td_samplesperpixel < 4) {\n\t\t\t\t\tsprintf(emsg,\n\t\t\t\t\t    \"Sorry, can not handle separated image with %s=%d\",\n\t\t\t\t\t    \"Samples/pixel\", td->td_samplesperpixel);\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\tcase PHOTOMETRIC_LOGL:\n\t\t\tif (td->td_compression != COMPRESSION_SGILOG) {\n\t\t\t\tsprintf(emsg, \"Sorry, LogL data must have %s=%d\",\n\t\t\t\t    \"Compression\", COMPRESSION_SGILOG);\n\t\t\t\treturn (0);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase PHOTOMETRIC_LOGLUV:\n\t\t\tif (td->td_compression != COMPRESSION_SGILOG &&\n\t\t\t    td->td_compression != COMPRESSION_SGILOG24) {\n\t\t\t\tsprintf(emsg, \"Sorry, LogLuv data must have %s=%d or %d\",\n\t\t\t\t    \"Compression\", COMPRESSION_SGILOG, COMPRESSION_SGILOG24);\n\t\t\t\treturn (0);\n\t\t\t}\n\t\t\tif (td->td_planarconfig != PLANARCONFIG_CONTIG) {\n\t\t\t\tsprintf(emsg, \"Sorry, can not handle LogLuv images with %s=%d\",\n\t\t\t\t    \"Planarconfiguration\", td->td_planarconfig);\n\t\t\t\treturn (0);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase PHOTOMETRIC_CIELAB:\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tsprintf(emsg, \"Sorry, can not handle image with %s=%d\",\n\t\t\t    photoTag, photometric);\n\t\t\treturn (0);\n\t}\n\treturn (1);\n}\n\nvoid\nTIFFRGBAImageEnd(TIFFRGBAImage* img)\n{\n\tif (img->Map)\n\t\t_TIFFfree(img->Map), img->Map = NULL;\n\tif (img->BWmap)\n\t\t_TIFFfree(img->BWmap), img->BWmap = NULL;\n\tif (img->PALmap)\n\t\t_TIFFfree(img->PALmap), img->PALmap = NULL;\n\tif (img->ycbcr)\n\t\t_TIFFfree(img->ycbcr), img->ycbcr = NULL;\n\tif (img->cielab)\n\t\t_TIFFfree(img->cielab), img->cielab = NULL;\n\tif( img->redcmap ) {\n\t\t_TIFFfree( img->redcmap );\n\t\t_TIFFfree( img->greencmap );\n\t\t_TIFFfree( img->bluecmap );\n\t}\n}\n\nstatic int\nisCCITTCompression(TIFF* tif)\n{\n    uint16 compress;\n    TIFFGetField(tif, TIFFTAG_COMPRESSION, &compress);\n    return (compress == COMPRESSION_CCITTFAX3 ||\n\t    compress == COMPRESSION_CCITTFAX4 ||\n\t    compress == COMPRESSION_CCITTRLE ||\n\t    compress == COMPRESSION_CCITTRLEW);\n}\n\nint\nTIFFRGBAImageBegin(TIFFRGBAImage* img, TIFF* tif, int stop, char emsg[1024])\n{\n\tuint16* sampleinfo;\n\tuint16 extrasamples;\n\tuint16 planarconfig;\n\tuint16 compress;\n\tint colorchannels;\n\tuint16 *red_orig, *green_orig, *blue_orig;\n\tint n_color;\n\n\t/* Initialize to normal values */\n\timg->row_offset = 0;\n\timg->col_offset = 0;\n\timg->redcmap = NULL;\n\timg->greencmap = NULL;\n\timg->bluecmap = NULL;\n\timg->req_orientation = ORIENTATION_BOTLEFT;     /* It is the default */\n\n\timg->tif = tif;\n\timg->stoponerr = stop;\n\tTIFFGetFieldDefaulted(tif, TIFFTAG_BITSPERSAMPLE, &img->bitspersample);\n\tswitch (img->bitspersample) {\n\t\tcase 1:\n\t\tcase 2:\n\t\tcase 4:\n\t\tcase 8:\n\t\tcase 16:\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tsprintf(emsg, \"Sorry, can not handle images with %d-bit samples\",\n\t\t\t    img->bitspersample);\n\t\t\treturn (0);\n\t}\n\timg->alpha = 0;\n\tTIFFGetFieldDefaulted(tif, TIFFTAG_SAMPLESPERPIXEL, &img->samplesperpixel);\n\tTIFFGetFieldDefaulted(tif, TIFFTAG_EXTRASAMPLES,\n\t    &extrasamples, &sampleinfo);\n\tif (extrasamples >= 1)\n\t{\n\t\tswitch (sampleinfo[0]) {\n\t\t\tcase EXTRASAMPLE_UNSPECIFIED:          /* Workaround for some images without */\n\t\t\t\tif (img->samplesperpixel > 3)  /* correct info about alpha channel */\n\t\t\t\t\timg->alpha = EXTRASAMPLE_ASSOCALPHA;\n\t\t\t\tbreak;\n\t\t\tcase EXTRASAMPLE_ASSOCALPHA:           /* data is pre-multiplied */\n\t\t\tcase EXTRASAMPLE_UNASSALPHA:           /* data is not pre-multiplied */\n\t\t\t\timg->alpha = sampleinfo[0];\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n#ifdef DEFAULT_EXTRASAMPLE_AS_ALPHA\n\tif( !TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &img->photometric))\n\t\timg->photometric = PHOTOMETRIC_MINISWHITE;\n\n\tif( extrasamples == 0\n\t    && img->samplesperpixel == 4\n\t    && img->photometric == PHOTOMETRIC_RGB )\n\t{\n\t\timg->alpha = EXTRASAMPLE_ASSOCALPHA;\n\t\textrasamples = 1;\n\t}\n#endif\n\n\tcolorchannels = img->samplesperpixel - extrasamples;\n\tTIFFGetFieldDefaulted(tif, TIFFTAG_COMPRESSION, &compress);\n\tTIFFGetFieldDefaulted(tif, TIFFTAG_PLANARCONFIG, &planarconfig);\n\tif (!TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &img->photometric)) {\n\t\tswitch (colorchannels) {\n\t\t\tcase 1:\n\t\t\t\tif (isCCITTCompression(tif))\n\t\t\t\t\timg->photometric = PHOTOMETRIC_MINISWHITE;\n\t\t\t\telse\n\t\t\t\t\timg->photometric = PHOTOMETRIC_MINISBLACK;\n\t\t\t\tbreak;\n\t\t\tcase 3:\n\t\t\t\timg->photometric = PHOTOMETRIC_RGB;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tsprintf(emsg, \"Missing needed %s tag\", photoTag);\n\t\t\t\treturn (0);\n\t\t}\n\t}\n\tswitch (img->photometric) {\n\t\tcase PHOTOMETRIC_PALETTE:\n\t\t\tif (!TIFFGetField(tif, TIFFTAG_COLORMAP,\n\t\t\t    &red_orig, &green_orig, &blue_orig)) {\n\t\t\t\tsprintf(emsg, \"Missing required \\\"Colormap\\\" tag\");\n\t\t\t\treturn (0);\n\t\t\t}\n\n\t\t\t/* copy the colormaps so we can modify them */\n\t\t\tn_color = (1L << img->bitspersample);\n\t\t\timg->redcmap = (uint16 *) _TIFFmalloc(sizeof(uint16)*n_color);\n\t\t\timg->greencmap = (uint16 *) _TIFFmalloc(sizeof(uint16)*n_color);\n\t\t\timg->bluecmap = (uint16 *) _TIFFmalloc(sizeof(uint16)*n_color);\n\t\t\tif( !img->redcmap || !img->greencmap || !img->bluecmap ) {\n\t\t\t\tsprintf(emsg, \"Out of memory for colormap copy\");\n\t\t\t\treturn (0);\n\t\t\t}\n\n\t\t\t_TIFFmemcpy( img->redcmap, red_orig, n_color * 2 );\n\t\t\t_TIFFmemcpy( img->greencmap, green_orig, n_color * 2 );\n\t\t\t_TIFFmemcpy( img->bluecmap, blue_orig, n_color * 2 );\n\n\t\t\t/* fall thru... */\n\t\tcase PHOTOMETRIC_MINISWHITE:\n\t\tcase PHOTOMETRIC_MINISBLACK:\n\t\t\tif (planarconfig == PLANARCONFIG_CONTIG\n\t\t\t    && img->samplesperpixel != 1\n\t\t\t    && img->bitspersample < 8 ) {\n\t\t\t\tsprintf(emsg,\n\t\t\t\t    \"Sorry, can not handle contiguous data with %s=%d, \"\n\t\t\t\t    \"and %s=%d and Bits/Sample=%d\",\n\t\t\t\t    photoTag, img->photometric,\n\t\t\t\t    \"Samples/pixel\", img->samplesperpixel,\n\t\t\t\t    img->bitspersample);\n\t\t\t\treturn (0);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase PHOTOMETRIC_YCBCR:\n\t\t\t/* It would probably be nice to have a reality check here. */\n\t\t\tif (planarconfig == PLANARCONFIG_CONTIG)\n\t\t\t\t/* can rely on libjpeg to convert to RGB */\n\t\t\t\t/* XXX should restore current state on exit */\n\t\t\t\tswitch (compress) {\n\t\t\t\t\tcase COMPRESSION_JPEG:\n\t\t\t\t\t\t/*\n\t\t\t\t\t\t * TODO: when complete tests verify complete desubsampling\n\t\t\t\t\t\t * and YCbCr handling, remove use of TIFFTAG_JPEGCOLORMODE in\n\t\t\t\t\t\t * favor of tif_getimage.c native handling\n\t\t\t\t\t\t */\n\t\t\t\t\t\tTIFFSetField(tif, TIFFTAG_JPEGCOLORMODE, JPEGCOLORMODE_RGB);\n\t\t\t\t\t\timg->photometric = PHOTOMETRIC_RGB;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\t/* do nothing */;\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t/*\n\t\t\t * TODO: if at all meaningful and useful, make more complete\n\t\t\t * support check here, or better still, refactor to let supporting\n\t\t\t * code decide whether there is support and what meaningfull\n\t\t\t * error to return\n\t\t\t */\n\t\t\tbreak;\n\t\tcase PHOTOMETRIC_RGB:\n\t\t\tif (colorchannels < 3) {\n\t\t\t\tsprintf(emsg, \"Sorry, can not handle RGB image with %s=%d\",\n\t\t\t\t    \"Color channels\", colorchannels);\n\t\t\t\treturn (0);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase PHOTOMETRIC_SEPARATED:\n\t\t\t{\n\t\t\t\tuint16 inkset;\n\t\t\t\tTIFFGetFieldDefaulted(tif, TIFFTAG_INKSET, &inkset);\n\t\t\t\tif (inkset != INKSET_CMYK) {\n\t\t\t\t\tsprintf(emsg, \"Sorry, can not handle separated image with %s=%d\",\n\t\t\t\t\t    \"InkSet\", inkset);\n\t\t\t\t\treturn (0);\n\t\t\t\t}\n\t\t\t\tif (img->samplesperpixel < 4) {\n\t\t\t\t\tsprintf(emsg, \"Sorry, can not handle separated image with %s=%d\",\n\t\t\t\t\t    \"Samples/pixel\", img->samplesperpixel);\n\t\t\t\t\treturn (0);\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\tcase PHOTOMETRIC_LOGL:\n\t\t\tif (compress != COMPRESSION_SGILOG) {\n\t\t\t\tsprintf(emsg, \"Sorry, LogL data must have %s=%d\",\n\t\t\t\t    \"Compression\", COMPRESSION_SGILOG);\n\t\t\t\treturn (0);\n\t\t\t}\n\t\t\tTIFFSetField(tif, TIFFTAG_SGILOGDATAFMT, SGILOGDATAFMT_8BIT);\n\t\t\timg->photometric = PHOTOMETRIC_MINISBLACK;\t/* little white lie */\n\t\t\timg->bitspersample = 8;\n\t\t\tbreak;\n\t\tcase PHOTOMETRIC_LOGLUV:\n\t\t\tif (compress != COMPRESSION_SGILOG && compress != COMPRESSION_SGILOG24) {\n\t\t\t\tsprintf(emsg, \"Sorry, LogLuv data must have %s=%d or %d\",\n\t\t\t\t    \"Compression\", COMPRESSION_SGILOG, COMPRESSION_SGILOG24);\n\t\t\t\treturn (0);\n\t\t\t}\n\t\t\tif (planarconfig != PLANARCONFIG_CONTIG) {\n\t\t\t\tsprintf(emsg, \"Sorry, can not handle LogLuv images with %s=%d\",\n\t\t\t\t    \"Planarconfiguration\", planarconfig);\n\t\t\t\treturn (0);\n\t\t\t}\n\t\t\tTIFFSetField(tif, TIFFTAG_SGILOGDATAFMT, SGILOGDATAFMT_8BIT);\n\t\t\timg->photometric = PHOTOMETRIC_RGB;\t\t/* little white lie */\n\t\t\timg->bitspersample = 8;\n\t\t\tbreak;\n\t\tcase PHOTOMETRIC_CIELAB:\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tsprintf(emsg, \"Sorry, can not handle image with %s=%d\",\n\t\t\t    photoTag, img->photometric);\n\t\t\treturn (0);\n\t}\n\timg->Map = NULL;\n\timg->BWmap = NULL;\n\timg->PALmap = NULL;\n\timg->ycbcr = NULL;\n\timg->cielab = NULL;\n\tTIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &img->width);\n\tTIFFGetField(tif, TIFFTAG_IMAGELENGTH, &img->height);\n\tTIFFGetFieldDefaulted(tif, TIFFTAG_ORIENTATION, &img->orientation);\n\timg->isContig =\n\t    !(planarconfig == PLANARCONFIG_SEPARATE && colorchannels > 1);\n\tif (img->isContig) {\n\t\tif (!PickContigCase(img)) {\n\t\t\tsprintf(emsg, \"Sorry, can not handle image\");\n\t\t\treturn 0;\n\t\t}\n\t} else {\n\t\tif (!PickSeparateCase(img)) {\n\t\t\tsprintf(emsg, \"Sorry, can not handle image\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\treturn 1;\n}\n\nint\nTIFFRGBAImageGet(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)\n{\n    if (img->get == NULL) {\n\t\tTIFFErrorExt(img->tif->tif_clientdata, TIFFFileName(img->tif), \"No \\\"get\\\" routine setup\");\n\t\treturn (0);\n\t}\n\tif (img->put.any == NULL) {\n\t\tTIFFErrorExt(img->tif->tif_clientdata, TIFFFileName(img->tif),\n\t\t\"No \\\"put\\\" routine setupl; probably can not handle image format\");\n\t\treturn (0);\n    }\n    return (*img->get)(img, raster, w, h);\n}\n\n/*\n * Read the specified image into an ABGR-format rastertaking in account\n * specified orientation.\n */\nint\nTIFFReadRGBAImageOriented(TIFF* tif,\n\t\t\t  uint32 rwidth, uint32 rheight, uint32* raster,\n\t\t\t  int orientation, int stop)\n{\n    char emsg[1024] = \"\";\n    TIFFRGBAImage img;\n    int ok;\n\n\tif (TIFFRGBAImageOK(tif, emsg) && TIFFRGBAImageBegin(&img, tif, stop, emsg)) {\n\t\timg.req_orientation = orientation;\n\t\t/* XXX verify rwidth and rheight against width and height */\n\t\tok = TIFFRGBAImageGet(&img, raster+(rheight-img.height)*rwidth,\n\t\t\trwidth, img.height);\n\t\tTIFFRGBAImageEnd(&img);\n\t} else {\n\t\tTIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), \"%s\", emsg);\n\t\tok = 0;\n    }\n    return (ok);\n}\n\n/*\n * Read the specified image into an ABGR-format raster. Use bottom left\n * origin for raster by default.\n */\nint\nTIFFReadRGBAImage(TIFF* tif,\n\t\t  uint32 rwidth, uint32 rheight, uint32* raster, int stop)\n{\n\treturn TIFFReadRGBAImageOriented(tif, rwidth, rheight, raster,\n\t\t\t\t\t ORIENTATION_BOTLEFT, stop);\n}\n\nstatic int \nsetorientation(TIFFRGBAImage* img)\n{\n\tswitch (img->orientation) {\n\t\tcase ORIENTATION_TOPLEFT:\n\t\tcase ORIENTATION_LEFTTOP:\n\t\t\tif (img->req_orientation == ORIENTATION_TOPRIGHT ||\n\t\t\t    img->req_orientation == ORIENTATION_RIGHTTOP)\n\t\t\t\treturn FLIP_HORIZONTALLY;\n\t\t\telse if (img->req_orientation == ORIENTATION_BOTRIGHT ||\n\t\t\t    img->req_orientation == ORIENTATION_RIGHTBOT)\n\t\t\t\treturn FLIP_HORIZONTALLY | FLIP_VERTICALLY;\n\t\t\telse if (img->req_orientation == ORIENTATION_BOTLEFT ||\n\t\t\t    img->req_orientation == ORIENTATION_LEFTBOT)\n\t\t\t\treturn FLIP_VERTICALLY;\n\t\t\telse\n\t\t\t\treturn 0;\n\t\tcase ORIENTATION_TOPRIGHT:\n\t\tcase ORIENTATION_RIGHTTOP:\n\t\t\tif (img->req_orientation == ORIENTATION_TOPLEFT ||\n\t\t\t    img->req_orientation == ORIENTATION_LEFTTOP)\n\t\t\t\treturn FLIP_HORIZONTALLY;\n\t\t\telse if (img->req_orientation == ORIENTATION_BOTRIGHT ||\n\t\t\t    img->req_orientation == ORIENTATION_RIGHTBOT)\n\t\t\t\treturn FLIP_VERTICALLY;\n\t\t\telse if (img->req_orientation == ORIENTATION_BOTLEFT ||\n\t\t\t    img->req_orientation == ORIENTATION_LEFTBOT)\n\t\t\t\treturn FLIP_HORIZONTALLY | FLIP_VERTICALLY;\n\t\t\telse\n\t\t\t\treturn 0;\n\t\tcase ORIENTATION_BOTRIGHT:\n\t\tcase ORIENTATION_RIGHTBOT:\n\t\t\tif (img->req_orientation == ORIENTATION_TOPLEFT ||\n\t\t\t    img->req_orientation == ORIENTATION_LEFTTOP)\n\t\t\t\treturn FLIP_HORIZONTALLY | FLIP_VERTICALLY;\n\t\t\telse if (img->req_orientation == ORIENTATION_TOPRIGHT ||\n\t\t\t    img->req_orientation == ORIENTATION_RIGHTTOP)\n\t\t\t\treturn FLIP_VERTICALLY;\n\t\t\telse if (img->req_orientation == ORIENTATION_BOTLEFT ||\n\t\t\t    img->req_orientation == ORIENTATION_LEFTBOT)\n\t\t\t\treturn FLIP_HORIZONTALLY;\n\t\t\telse\n\t\t\t\treturn 0;\n\t\tcase ORIENTATION_BOTLEFT:\n\t\tcase ORIENTATION_LEFTBOT:\n\t\t\tif (img->req_orientation == ORIENTATION_TOPLEFT ||\n\t\t\t    img->req_orientation == ORIENTATION_LEFTTOP)\n\t\t\t\treturn FLIP_VERTICALLY;\n\t\t\telse if (img->req_orientation == ORIENTATION_TOPRIGHT ||\n\t\t\t    img->req_orientation == ORIENTATION_RIGHTTOP)\n\t\t\t\treturn FLIP_HORIZONTALLY | FLIP_VERTICALLY;\n\t\t\telse if (img->req_orientation == ORIENTATION_BOTRIGHT ||\n\t\t\t    img->req_orientation == ORIENTATION_RIGHTBOT)\n\t\t\t\treturn FLIP_HORIZONTALLY;\n\t\t\telse\n\t\t\t\treturn 0;\n\t\tdefault:\t/* NOTREACHED */\n\t\t\treturn 0;\n\t}\n}\n\n/*\n * Get an tile-organized image that has\n *\tPlanarConfiguration contiguous if SamplesPerPixel > 1\n * or\n *\tSamplesPerPixel == 1\n */\t\nstatic int\ngtTileContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)\n{\n    TIFF* tif = img->tif;\n    tileContigRoutine put = img->put.contig;\n    uint32 col, row, y, rowstoread;\n    uint32 pos;\n    uint32 tw, th;\n    unsigned char* buf;\n    int32 fromskew, toskew;\n    uint32 nrow;\n    int ret = 1, flip;\n\n    buf = (unsigned char*) _TIFFmalloc(TIFFTileSize(tif));\n    if (buf == 0) {\n\t\tTIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), \"No space for tile buffer\");\n\t\treturn (0);\n    }\n    _TIFFmemset(buf, 0, TIFFTileSize(tif));\n    TIFFGetField(tif, TIFFTAG_TILEWIDTH, &tw);\n    TIFFGetField(tif, TIFFTAG_TILELENGTH, &th);\n\n    flip = setorientation(img);\n    if (flip & FLIP_VERTICALLY) {\n\t    y = h - 1;\n\t    toskew = -(int32)(tw + w);\n    }\n    else {\n\t    y = 0;\n\t    toskew = -(int32)(tw - w);\n    }\n     \n    for (row = 0; row < h; row += nrow)\n    {\n        rowstoread = th - (row + img->row_offset) % th;\n    \tnrow = (row + rowstoread > h ? h - row : rowstoread);\n\tfor (col = 0; col < w; col += tw) \n        {\n            if (TIFFReadTile(tif, buf, col+img->col_offset,\n                             row+img->row_offset, 0, 0) < 0 && img->stoponerr)\n            {\n                ret = 0;\n                break;\n            }\n\t    \n            pos = ((row+img->row_offset) % th) * TIFFTileRowSize(tif);\n\n    \t    if (col + tw > w) \n            {\n                /*\n                 * Tile is clipped horizontally.  Calculate\n                 * visible portion and skewing factors.\n                 */\n                uint32 npix = w - col;\n                fromskew = tw - npix;\n                (*put)(img, raster+y*w+col, col, y,\n                       npix, nrow, fromskew, toskew + fromskew, buf + pos);\n            }\n            else \n            {\n                (*put)(img, raster+y*w+col, col, y, tw, nrow, 0, toskew, buf + pos);\n            }\n        }\n\n        y += (flip & FLIP_VERTICALLY ? -(int32) nrow : (int32) nrow);\n    }\n    _TIFFfree(buf);\n\n    if (flip & FLIP_HORIZONTALLY) {\n\t    uint32 line;\n\n\t    for (line = 0; line < h; line++) {\n\t\t    uint32 *left = raster + (line * w);\n\t\t    uint32 *right = left + w - 1;\n\t\t    \n\t\t    while ( left < right ) {\n\t\t\t    uint32 temp = *left;\n\t\t\t    *left = *right;\n\t\t\t    *right = temp;\n\t\t\t    left++, right--;\n\t\t    }\n\t    }\n    }\n\n    return (ret);\n}\n\n/*\n * Get an tile-organized image that has\n *\t SamplesPerPixel > 1\n *\t PlanarConfiguration separated\n * We assume that all such images are RGB.\n */\t\nstatic int\ngtTileSeparate(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)\n{\n\tTIFF* tif = img->tif;\n\ttileSeparateRoutine put = img->put.separate;\n\tuint32 col, row, y, rowstoread;\n\tuint32 pos;\n\tuint32 tw, th;\n\tunsigned char* buf;\n\tunsigned char* p0;\n\tunsigned char* p1;\n\tunsigned char* p2;\n\tunsigned char* pa;\n\ttsize_t tilesize;\n\tint32 fromskew, toskew;\n\tint alpha = img->alpha;\n\tuint32 nrow;\n\tint ret = 1, flip;\n\n\ttilesize = TIFFTileSize(tif);\n\tbuf = (unsigned char*) _TIFFmalloc((alpha?4:3)*tilesize);\n\tif (buf == 0) {\n\t\tTIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), \"No space for tile buffer\");\n\t\treturn (0);\n\t}\n\t_TIFFmemset(buf, 0, (alpha?4:3)*tilesize);\n\tp0 = buf;\n\tp1 = p0 + tilesize;\n\tp2 = p1 + tilesize;\n\tpa = (alpha?(p2+tilesize):NULL);\n\tTIFFGetField(tif, TIFFTAG_TILEWIDTH, &tw);\n\tTIFFGetField(tif, TIFFTAG_TILELENGTH, &th);\n\n\tflip = setorientation(img);\n\tif (flip & FLIP_VERTICALLY) {\n\t\ty = h - 1;\n\t\ttoskew = -(int32)(tw + w);\n\t}\n\telse {\n\t\ty = 0;\n\t\ttoskew = -(int32)(tw - w);\n\t}\n\n\tfor (row = 0; row < h; row += nrow)\n\t{\n\t\trowstoread = th - (row + img->row_offset) % th;\n\t\tnrow = (row + rowstoread > h ? h - row : rowstoread);\n\t\tfor (col = 0; col < w; col += tw)\n\t\t{\n\t\t\tif (TIFFReadTile(tif, p0, col+img->col_offset,\n\t\t\t    row+img->row_offset,0,0) < 0 && img->stoponerr)\n\t\t\t{\n\t\t\t\tret = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (TIFFReadTile(tif, p1, col+img->col_offset,\n\t\t\t    row+img->row_offset,0,1) < 0 && img->stoponerr)\n\t\t\t{\n\t\t\t\tret = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (TIFFReadTile(tif, p2, col+img->col_offset,\n\t\t\t    row+img->row_offset,0,2) < 0 && img->stoponerr)\n\t\t\t{\n\t\t\t\tret = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (alpha)\n\t\t\t{\n\t\t\t\tif (TIFFReadTile(tif,pa,col+img->col_offset,\n\t\t\t\t    row+img->row_offset,0,3) < 0 && img->stoponerr)\n\t\t\t\t{\n\t\t\t\t\tret = 0;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tpos = ((row+img->row_offset) % th) * TIFFTileRowSize(tif);\n\n\t\t\tif (col + tw > w)\n\t\t\t{\n\t\t\t\t/*\n\t\t\t\t * Tile is clipped horizontally.  Calculate\n\t\t\t\t * visible portion and skewing factors.\n\t\t\t\t */\n\t\t\t\tuint32 npix = w - col;\n\t\t\t\tfromskew = tw - npix;\n\t\t\t\t(*put)(img, raster+y*w+col, col, y,\n\t\t\t\t    npix, nrow, fromskew, toskew + fromskew,\n\t\t\t\t    p0 + pos, p1 + pos, p2 + pos, (alpha?(pa+pos):NULL));\n\t\t\t} else {\n\t\t\t\t(*put)(img, raster+y*w+col, col, y,\n\t\t\t\t    tw, nrow, 0, toskew, p0 + pos, p1 + pos, p2 + pos, (alpha?(pa+pos):NULL));\n\t\t\t}\n\t\t}\n\n\t\ty += (flip & FLIP_VERTICALLY ?-(int32) nrow : (int32) nrow);\n\t}\n\n\tif (flip & FLIP_HORIZONTALLY) {\n\t\tuint32 line;\n\n\t\tfor (line = 0; line < h; line++) {\n\t\t\tuint32 *left = raster + (line * w);\n\t\t\tuint32 *right = left + w - 1;\n\n\t\t\twhile ( left < right ) {\n\t\t\t\tuint32 temp = *left;\n\t\t\t\t*left = *right;\n\t\t\t\t*right = temp;\n\t\t\t\tleft++, right--;\n\t\t\t}\n\t\t}\n\t}\n\n\t_TIFFfree(buf);\n\treturn (ret);\n}\n\n/*\n * Get a strip-organized image that has\n *\tPlanarConfiguration contiguous if SamplesPerPixel > 1\n * or\n *\tSamplesPerPixel == 1\n */\t\nstatic int\ngtStripContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)\n{\n\tTIFF* tif = img->tif;\n\ttileContigRoutine put = img->put.contig;\n\tuint32 row, y, nrow, nrowsub, rowstoread;\n\tuint32 pos;\n\tunsigned char* buf;\n\tuint32 rowsperstrip;\n\tuint16 subsamplinghor,subsamplingver;\n\tuint32 imagewidth = img->width;\n\ttsize_t scanline;\n\tint32 fromskew, toskew;\n\tint ret = 1, flip;\n\n\tbuf = (unsigned char*) _TIFFmalloc(TIFFStripSize(tif));\n\tif (buf == 0) {\n\t\tTIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), \"No space for strip buffer\");\n\t\treturn (0);\n\t}\n\t_TIFFmemset(buf, 0, TIFFStripSize(tif));\n\n\tflip = setorientation(img);\n\tif (flip & FLIP_VERTICALLY) {\n\t\ty = h - 1;\n\t\ttoskew = -(int32)(w + w);\n\t} else {\n\t\ty = 0;\n\t\ttoskew = -(int32)(w - w);\n\t}\n\n\tTIFFGetFieldDefaulted(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);\n\tTIFFGetFieldDefaulted(tif, TIFFTAG_YCBCRSUBSAMPLING, &subsamplinghor, &subsamplingver);\n\tscanline = TIFFNewScanlineSize(tif);\n\tfromskew = (w < imagewidth ? imagewidth - w : 0);\n\tfor (row = 0; row < h; row += nrow)\n\t{\n\t\trowstoread = rowsperstrip - (row + img->row_offset) % rowsperstrip;\n\t\tnrow = (row + rowstoread > h ? h - row : rowstoread);\n\t\tnrowsub = nrow;\n\t\tif ((nrowsub%subsamplingver)!=0)\n\t\t\tnrowsub+=subsamplingver-nrowsub%subsamplingver;\n\t\tif (TIFFReadEncodedStrip(tif,\n\t\t    TIFFComputeStrip(tif,row+img->row_offset, 0),\n\t\t    buf,\n\t\t    ((row + img->row_offset)%rowsperstrip + nrowsub) * scanline) < 0\n\t\t    && img->stoponerr)\n\t\t{\n\t\t\tret = 0;\n\t\t\tbreak;\n\t\t}\n\n\t\tpos = ((row + img->row_offset) % rowsperstrip) * scanline;\n\t\t(*put)(img, raster+y*w, 0, y, w, nrow, fromskew, toskew, buf + pos);\n\t\ty += (flip & FLIP_VERTICALLY ? -(int32) nrow : (int32) nrow);\n\t}\n\n\tif (flip & FLIP_HORIZONTALLY) {\n\t\tuint32 line;\n\n\t\tfor (line = 0; line < h; line++) {\n\t\t\tuint32 *left = raster + (line * w);\n\t\t\tuint32 *right = left + w - 1;\n\n\t\t\twhile ( left < right ) {\n\t\t\t\tuint32 temp = *left;\n\t\t\t\t*left = *right;\n\t\t\t\t*right = temp;\n\t\t\t\tleft++, right--;\n\t\t\t}\n\t\t}\n\t}\n\n\t_TIFFfree(buf);\n\treturn (ret);\n}\n\n/*\n * Get a strip-organized image with\n *\t SamplesPerPixel > 1\n *\t PlanarConfiguration separated\n * We assume that all such images are RGB.\n */\nstatic int\ngtStripSeparate(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)\n{\n\tTIFF* tif = img->tif;\n\ttileSeparateRoutine put = img->put.separate;\n\tunsigned char *buf;\n\tunsigned char *p0, *p1, *p2, *pa;\n\tuint32 row, y, nrow, rowstoread;\n\tuint32 pos;\n\ttsize_t scanline;\n\tuint32 rowsperstrip, offset_row;\n\tuint32 imagewidth = img->width;\n\ttsize_t stripsize;\n\tint32 fromskew, toskew;\n\tint alpha = img->alpha;\n\tint ret = 1, flip;\n\n\tstripsize = TIFFStripSize(tif);\n\tp0 = buf = (unsigned char *)_TIFFmalloc((alpha?4:3)*stripsize);\n\tif (buf == 0) {\n\t\tTIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), \"No space for tile buffer\");\n\t\treturn (0);\n\t}\n\t_TIFFmemset(buf, 0, (alpha?4:3)*stripsize);\n\tp1 = p0 + stripsize;\n\tp2 = p1 + stripsize;\n\tpa = (alpha?(p2+stripsize):NULL);\n\n\tflip = setorientation(img);\n\tif (flip & FLIP_VERTICALLY) {\n\t\ty = h - 1;\n\t\ttoskew = -(int32)(w + w);\n\t}\n\telse {\n\t\ty = 0;\n\t\ttoskew = -(int32)(w - w);\n\t}\n\n\tTIFFGetFieldDefaulted(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);\n\tscanline = TIFFScanlineSize(tif);\n\tfromskew = (w < imagewidth ? imagewidth - w : 0);\n\tfor (row = 0; row < h; row += nrow)\n\t{\n\t\trowstoread = rowsperstrip - (row + img->row_offset) % rowsperstrip;\n\t\tnrow = (row + rowstoread > h ? h - row : rowstoread);\n\t\toffset_row = row + img->row_offset;\n\t\tif (TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, offset_row, 0),\n\t\t    p0, ((row + img->row_offset)%rowsperstrip + nrow) * scanline) < 0\n\t\t    && img->stoponerr)\n\t\t{\n\t\t\tret = 0;\n\t\t\tbreak;\n\t\t}\n\t\tif (TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, offset_row, 1),\n\t\t    p1, ((row + img->row_offset)%rowsperstrip + nrow) * scanline) < 0\n\t\t    && img->stoponerr)\n\t\t{\n\t\t\tret = 0;\n\t\t\tbreak;\n\t\t}\n\t\tif (TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, offset_row, 2),\n\t\t    p2, ((row + img->row_offset)%rowsperstrip + nrow) * scanline) < 0\n\t\t    && img->stoponerr)\n\t\t{\n\t\t\tret = 0;\n\t\t\tbreak;\n\t\t}\n\t\tif (alpha)\n\t\t{\n\t\t\tif (TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, offset_row, 3),\n\t\t\t    pa, ((row + img->row_offset)%rowsperstrip + nrow) * scanline) < 0\n\t\t\t    && img->stoponerr)\n\t\t\t{\n\t\t\t\tret = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tpos = ((row + img->row_offset) % rowsperstrip) * scanline;\n\t\t(*put)(img, raster+y*w, 0, y, w, nrow, fromskew, toskew, p0 + pos, p1 + pos,\n\t\t    p2 + pos, (alpha?(pa+pos):NULL));\n\t\ty += (flip & FLIP_VERTICALLY ? -(int32) nrow : (int32) nrow);\n\t}\n\n\tif (flip & FLIP_HORIZONTALLY) {\n\t\tuint32 line;\n\n\t\tfor (line = 0; line < h; line++) {\n\t\t\tuint32 *left = raster + (line * w);\n\t\t\tuint32 *right = left + w - 1;\n\n\t\t\twhile ( left < right ) {\n\t\t\t\tuint32 temp = *left;\n\t\t\t\t*left = *right;\n\t\t\t\t*right = temp;\n\t\t\t\tleft++, right--;\n\t\t\t}\n\t\t}\n\t}\n\n\t_TIFFfree(buf);\n\treturn (ret);\n}\n\n/*\n * The following routines move decoded data returned\n * from the TIFF library into rasters filled with packed\n * ABGR pixels (i.e. suitable for passing to lrecwrite.)\n *\n * The routines have been created according to the most\n * important cases and optimized.  PickContigCase and\n * PickSeparateCase analyze the parameters and select\n * the appropriate \"get\" and \"put\" routine to use.\n */\n#define\tREPEAT8(op)\tREPEAT4(op); REPEAT4(op)\n#define\tREPEAT4(op)\tREPEAT2(op); REPEAT2(op)\n#define\tREPEAT2(op)\top; op\n#define\tCASE8(x,op)\t\t\t\\\n    switch (x) {\t\t\t\\\n    case 7: op; case 6: op; case 5: op;\t\\\n    case 4: op; case 3: op; case 2: op;\t\\\n    case 1: op;\t\t\t\t\\\n    }\n#define\tCASE4(x,op)\tswitch (x) { case 3: op; case 2: op; case 1: op; }\n#define\tNOP\n\n#define\tUNROLL8(w, op1, op2) {\t\t\\\n    uint32 _x;\t\t\t\t\\\n    for (_x = w; _x >= 8; _x -= 8) {\t\\\n\top1;\t\t\t\t\\\n\tREPEAT8(op2);\t\t\t\\\n    }\t\t\t\t\t\\\n    if (_x > 0) {\t\t\t\\\n\top1;\t\t\t\t\\\n\tCASE8(_x,op2);\t\t\t\\\n    }\t\t\t\t\t\\\n}\n#define\tUNROLL4(w, op1, op2) {\t\t\\\n    uint32 _x;\t\t\t\t\\\n    for (_x = w; _x >= 4; _x -= 4) {\t\\\n\top1;\t\t\t\t\\\n\tREPEAT4(op2);\t\t\t\\\n    }\t\t\t\t\t\\\n    if (_x > 0) {\t\t\t\\\n\top1;\t\t\t\t\\\n\tCASE4(_x,op2);\t\t\t\\\n    }\t\t\t\t\t\\\n}\n#define\tUNROLL2(w, op1, op2) {\t\t\\\n    uint32 _x;\t\t\t\t\\\n    for (_x = w; _x >= 2; _x -= 2) {\t\\\n\top1;\t\t\t\t\\\n\tREPEAT2(op2);\t\t\t\\\n    }\t\t\t\t\t\\\n    if (_x) {\t\t\t\t\\\n\top1;\t\t\t\t\\\n\top2;\t\t\t\t\\\n    }\t\t\t\t\t\\\n}\n    \n#define\tSKEW(r,g,b,skew)\t{ r += skew; g += skew; b += skew; }\n#define\tSKEW4(r,g,b,a,skew)\t{ r += skew; g += skew; b += skew; a+= skew; }\n\n#define A1 (((uint32)0xffL)<<24)\n#define\tPACK(r,g,b)\t\\\n\t((uint32)(r)|((uint32)(g)<<8)|((uint32)(b)<<16)|A1)\n#define\tPACK4(r,g,b,a)\t\\\n\t((uint32)(r)|((uint32)(g)<<8)|((uint32)(b)<<16)|((uint32)(a)<<24))\n#define W2B(v) (((v)>>8)&0xff)\n#define\tPACKW(r,g,b)\t\\\n\t((uint32)W2B(r)|((uint32)W2B(g)<<8)|((uint32)W2B(b)<<16)|A1)\n#define\tPACKW4(r,g,b,a)\t\\\n\t((uint32)W2B(r)|((uint32)W2B(g)<<8)|((uint32)W2B(b)<<16)|((uint32)W2B(a)<<24))\n\n#define\tDECLAREContigPutFunc(name) \\\nstatic void name(\\\n    TIFFRGBAImage* img, \\\n    uint32* cp, \\\n    uint32 x, uint32 y, \\\n    uint32 w, uint32 h, \\\n    int32 fromskew, int32 toskew, \\\n    unsigned char* pp \\\n)\n\n/*\n * 8-bit palette => colormap/RGB\n */\nDECLAREContigPutFunc(put8bitcmaptile)\n{\n    uint32** PALmap = img->PALmap;\n    int samplesperpixel = img->samplesperpixel;\n\n    (void) y;\n    while (h-- > 0) {\n\tfor (x = w; x-- > 0;)\n        {\n\t    *cp++ = PALmap[*pp][0];\n            pp += samplesperpixel;\n        }\n\tcp += toskew;\n\tpp += fromskew;\n    }\n}\n\n/*\n * 4-bit palette => colormap/RGB\n */\nDECLAREContigPutFunc(put4bitcmaptile)\n{\n    uint32** PALmap = img->PALmap;\n\n    (void) x; (void) y;\n    fromskew /= 2;\n    while (h-- > 0) {\n\tuint32* bw;\n\tUNROLL2(w, bw = PALmap[*pp++], *cp++ = *bw++);\n\tcp += toskew;\n\tpp += fromskew;\n    }\n}\n\n/*\n * 2-bit palette => colormap/RGB\n */\nDECLAREContigPutFunc(put2bitcmaptile)\n{\n    uint32** PALmap = img->PALmap;\n\n    (void) x; (void) y;\n    fromskew /= 4;\n    while (h-- > 0) {\n\tuint32* bw;\n\tUNROLL4(w, bw = PALmap[*pp++], *cp++ = *bw++);\n\tcp += toskew;\n\tpp += fromskew;\n    }\n}\n\n/*\n * 1-bit palette => colormap/RGB\n */\nDECLAREContigPutFunc(put1bitcmaptile)\n{\n    uint32** PALmap = img->PALmap;\n\n    (void) x; (void) y;\n    fromskew /= 8;\n    while (h-- > 0) {\n\tuint32* bw;\n\tUNROLL8(w, bw = PALmap[*pp++], *cp++ = *bw++);\n\tcp += toskew;\n\tpp += fromskew;\n    }\n}\n\n/*\n * 8-bit greyscale => colormap/RGB\n */\nDECLAREContigPutFunc(putgreytile)\n{\n    int samplesperpixel = img->samplesperpixel;\n    uint32** BWmap = img->BWmap;\n\n    (void) y;\n    while (h-- > 0) {\n\tfor (x = w; x-- > 0;)\n        {\n\t    *cp++ = BWmap[*pp][0];\n            pp += samplesperpixel;\n        }\n\tcp += toskew;\n\tpp += fromskew;\n    }\n}\n\n/*\n * 16-bit greyscale => colormap/RGB\n */\nDECLAREContigPutFunc(put16bitbwtile)\n{\n    int samplesperpixel = img->samplesperpixel;\n    uint32** BWmap = img->BWmap;\n\n    (void) y;\n    while (h-- > 0) {\n        uint16 *wp = (uint16 *) pp;\n\n\tfor (x = w; x-- > 0;)\n        {\n            /* use high order byte of 16bit value */\n\n\t    *cp++ = BWmap[*wp >> 8][0];\n            pp += 2 * samplesperpixel;\n            wp += samplesperpixel;\n        }\n\tcp += toskew;\n\tpp += fromskew;\n    }\n}\n\n/*\n * 1-bit bilevel => colormap/RGB\n */\nDECLAREContigPutFunc(put1bitbwtile)\n{\n    uint32** BWmap = img->BWmap;\n\n    (void) x; (void) y;\n    fromskew /= 8;\n    while (h-- > 0) {\n\tuint32* bw;\n\tUNROLL8(w, bw = BWmap[*pp++], *cp++ = *bw++);\n\tcp += toskew;\n\tpp += fromskew;\n    }\n}\n\n/*\n * 2-bit greyscale => colormap/RGB\n */\nDECLAREContigPutFunc(put2bitbwtile)\n{\n    uint32** BWmap = img->BWmap;\n\n    (void) x; (void) y;\n    fromskew /= 4;\n    while (h-- > 0) {\n\tuint32* bw;\n\tUNROLL4(w, bw = BWmap[*pp++], *cp++ = *bw++);\n\tcp += toskew;\n\tpp += fromskew;\n    }\n}\n\n/*\n * 4-bit greyscale => colormap/RGB\n */\nDECLAREContigPutFunc(put4bitbwtile)\n{\n    uint32** BWmap = img->BWmap;\n\n    (void) x; (void) y;\n    fromskew /= 2;\n    while (h-- > 0) {\n\tuint32* bw;\n\tUNROLL2(w, bw = BWmap[*pp++], *cp++ = *bw++);\n\tcp += toskew;\n\tpp += fromskew;\n    }\n}\n\n/*\n * 8-bit packed samples, no Map => RGB\n */\nDECLAREContigPutFunc(putRGBcontig8bittile)\n{\n    int samplesperpixel = img->samplesperpixel;\n\n    (void) x; (void) y;\n    fromskew *= samplesperpixel;\n    while (h-- > 0) {\n\tUNROLL8(w, NOP,\n\t    *cp++ = PACK(pp[0], pp[1], pp[2]);\n\t    pp += samplesperpixel);\n\tcp += toskew;\n\tpp += fromskew;\n    }\n}\n\n/*\n * 8-bit packed samples => RGBA w/ associated alpha\n * (known to have Map == NULL)\n */\nDECLAREContigPutFunc(putRGBAAcontig8bittile)\n{\n    int samplesperpixel = img->samplesperpixel;\n\n    (void) x; (void) y;\n    fromskew *= samplesperpixel;\n    while (h-- > 0) {\n\tUNROLL8(w, NOP,\n\t    *cp++ = PACK4(pp[0], pp[1], pp[2], pp[3]);\n\t    pp += samplesperpixel);\n\tcp += toskew;\n\tpp += fromskew;\n    }\n}\n\n/*\n * 8-bit packed samples => RGBA w/ unassociated alpha\n * (known to have Map == NULL)\n */\nDECLAREContigPutFunc(putRGBUAcontig8bittile)\n{\n\tint samplesperpixel = img->samplesperpixel;\n\t(void) y;\n\tfromskew *= samplesperpixel;\n\twhile (h-- > 0) {\n\t\tuint32 r, g, b, a;\n\t\tfor (x = w; x-- > 0;) {\n\t\t\ta = pp[3];\n                        r = (a*pp[0] + 127) / 255;\n                        g = (a*pp[1] + 127) / 255;\n                        b = (a*pp[2] + 127) / 255;\n\t\t\t*cp++ = PACK4(r,g,b,a);\n\t\t\tpp += samplesperpixel;\n\t\t}\n\t\tcp += toskew;\n\t\tpp += fromskew;\n\t}\n}\n\n/*\n * 16-bit packed samples => RGB\n */\nDECLAREContigPutFunc(putRGBcontig16bittile)\n{\n\tint samplesperpixel = img->samplesperpixel;\n\tuint16 *wp = (uint16 *)pp;\n\t(void) y;\n\tfromskew *= samplesperpixel;\n\twhile (h-- > 0) {\n\t\tfor (x = w; x-- > 0;) {\n                    *cp++ = PACKW(wp[0],wp[1],wp[2]);\n                    wp += samplesperpixel;\n\t\t}\n\t\tcp += toskew;\n\t\twp += fromskew;\n\t}\n}\n\n/*\n * 16-bit packed samples => RGBA w/ associated alpha\n * (known to have Map == NULL)\n */\nDECLAREContigPutFunc(putRGBAAcontig16bittile)\n{\n\tint samplesperpixel = img->samplesperpixel;\n\tuint16 *wp = (uint16 *)pp;\n\t(void) y;\n\tfromskew *= samplesperpixel;\n\twhile (h-- > 0) {\n\t\tfor (x = w; x-- > 0;) {\n                    *cp++ = PACKW4(wp[0],wp[1],wp[2],wp[3]);\n                    wp += samplesperpixel;\n\t\t}\n\t\tcp += toskew;\n\t\twp += fromskew;\n\t}\n}\n\n/*\n * 16-bit packed samples => RGBA w/ unassociated alpha\n * (known to have Map == NULL)\n */\nDECLAREContigPutFunc(putRGBUAcontig16bittile)\n{\n\tint samplesperpixel = img->samplesperpixel;\n\tuint16 *wp = (uint16 *)pp;\n\t(void) y;\n\tfromskew *= samplesperpixel;\n\twhile (h-- > 0) {\n\t\tuint32 r,g,b,a;\n\t\tfor (x = w; x-- > 0;) {\n                    a = W2B(wp[3]);\n                    r = (a*W2B(wp[0]) + 127) / 255;\n                    g = (a*W2B(wp[1]) + 127) / 255;\n                    b = (a*W2B(wp[2]) + 127) / 255;\n                    *cp++ = PACK4(r,g,b,a);\n                    wp += samplesperpixel;\n\t\t}\n\t\tcp += toskew;\n\t\twp += fromskew;\n\t}\n}\n\n/*\n * 8-bit packed CMYK samples w/o Map => RGB\n *\n * NB: The conversion of CMYK->RGB is *very* crude.\n */\nDECLAREContigPutFunc(putRGBcontig8bitCMYKtile)\n{\n    int samplesperpixel = img->samplesperpixel;\n    uint16 r, g, b, k;\n\n    (void) x; (void) y;\n    fromskew *= samplesperpixel;\n    while (h-- > 0) {\n\tUNROLL8(w, NOP,\n\t    k = 255 - pp[3];\n\t    r = (k*(255-pp[0]))/255;\n\t    g = (k*(255-pp[1]))/255;\n\t    b = (k*(255-pp[2]))/255;\n\t    *cp++ = PACK(r, g, b);\n\t    pp += samplesperpixel);\n\tcp += toskew;\n\tpp += fromskew;\n    }\n}\n\n/*\n * 8-bit packed CMYK samples w/Map => RGB\n *\n * NB: The conversion of CMYK->RGB is *very* crude.\n */\nDECLAREContigPutFunc(putRGBcontig8bitCMYKMaptile)\n{\n    int samplesperpixel = img->samplesperpixel;\n    TIFFRGBValue* Map = img->Map;\n    uint16 r, g, b, k;\n\n    (void) y;\n    fromskew *= samplesperpixel;\n    while (h-- > 0) {\n\tfor (x = w; x-- > 0;) {\n\t    k = 255 - pp[3];\n\t    r = (k*(255-pp[0]))/255;\n\t    g = (k*(255-pp[1]))/255;\n\t    b = (k*(255-pp[2]))/255;\n\t    *cp++ = PACK(Map[r], Map[g], Map[b]);\n\t    pp += samplesperpixel;\n\t}\n\tpp += fromskew;\n\tcp += toskew;\n    }\n}\n\n#define\tDECLARESepPutFunc(name) \\\nstatic void name(\\\n    TIFFRGBAImage* img,\\\n    uint32* cp,\\\n    uint32 x, uint32 y, \\\n    uint32 w, uint32 h,\\\n    int32 fromskew, int32 toskew,\\\n    unsigned char* r, unsigned char* g, unsigned char* b, unsigned char* a\\\n)\n\n/*\n * 8-bit unpacked samples => RGB\n */\nDECLARESepPutFunc(putRGBseparate8bittile)\n{\n    (void) img; (void) x; (void) y; (void) a;\n    while (h-- > 0) {\n\tUNROLL8(w, NOP, *cp++ = PACK(*r++, *g++, *b++));\n\tSKEW(r, g, b, fromskew);\n\tcp += toskew;\n    }\n}\n\n/*\n * 8-bit unpacked samples => RGBA w/ associated alpha\n */\nDECLARESepPutFunc(putRGBAAseparate8bittile)\n{\n\t(void) img; (void) x; (void) y;\n\twhile (h-- > 0) {\n\t\tUNROLL8(w, NOP, *cp++ = PACK4(*r++, *g++, *b++, *a++));\n\t\tSKEW4(r, g, b, a, fromskew);\n\t\tcp += toskew;\n\t}\n}\n\n/*\n * 8-bit unpacked samples => RGBA w/ unassociated alpha\n */\nDECLARESepPutFunc(putRGBUAseparate8bittile)\n{\n\t(void) img; (void) y;\n\twhile (h-- > 0) {\n\t\tuint32 rv, gv, bv, av;\n\t\tfor (x = w; x-- > 0;) {\n\t\t\tav = *a++;\n                        rv = (av* *r++ + 127) / 255;\n                        gv = (av* *g++ + 127) / 255;\n                        bv = (av* *b++ + 127) / 255;\n\t\t\t*cp++ = PACK4(rv,gv,bv,av);\n\t\t}\n\t\tSKEW4(r, g, b, a, fromskew);\n\t\tcp += toskew;\n\t}\n}\n\n/*\n * 16-bit unpacked samples => RGB\n */\nDECLARESepPutFunc(putRGBseparate16bittile)\n{\n\tuint16 *wr = (uint16*) r;\n\tuint16 *wg = (uint16*) g;\n\tuint16 *wb = (uint16*) b;\n\t(void) img; (void) y; (void) a;\n\twhile (h-- > 0) {\n\t\tfor (x = 0; x < w; x++)\n                    *cp++ = PACKW(*wr++,*wg++,*wb++);\n\t\tSKEW(wr, wg, wb, fromskew);\n\t\tcp += toskew;\n\t}\n}\n\n/*\n * 16-bit unpacked samples => RGBA w/ associated alpha\n */\nDECLARESepPutFunc(putRGBAAseparate16bittile)\n{\n\tuint16 *wr = (uint16*) r;\n\tuint16 *wg = (uint16*) g;\n\tuint16 *wb = (uint16*) b;\n\tuint16 *wa = (uint16*) a;\n\t(void) img; (void) y;\n\twhile (h-- > 0) {\n\t\tfor (x = 0; x < w; x++)\n                    *cp++ = PACKW4(*wr++,*wg++,*wb++,*wa++);\n\t\tSKEW4(wr, wg, wb, wa, fromskew);\n\t\tcp += toskew;\n\t}\n}\n\n/*\n * 16-bit unpacked samples => RGBA w/ unassociated alpha\n */\nDECLARESepPutFunc(putRGBUAseparate16bittile)\n{\n\tuint16 *wr = (uint16*) r;\n\tuint16 *wg = (uint16*) g;\n\tuint16 *wb = (uint16*) b;\n\tuint16 *wa = (uint16*) a;\n\t(void) img; (void) y;\n\twhile (h-- > 0) {\n\t\tuint32 r,g,b,a;\n\t\tfor (x = w; x-- > 0;) {\n                    a = W2B(*wa++);\n                    r = (a*W2B(*wr++) + 127) / 255;\n                    g = (a*W2B(*wg++) + 127) / 255;\n                    b = (a*W2B(*wb++) + 127) / 255;\n                    *cp++ = PACK4(r,g,b,a);\n\t\t}\n\t\tSKEW4(wr, wg, wb, wa, fromskew);\n\t\tcp += toskew;\n\t}\n}\n\n/*\n * 8-bit packed CIE L*a*b 1976 samples => RGB\n */\nDECLAREContigPutFunc(putcontig8bitCIELab)\n{\n\tfloat X, Y, Z;\n\tuint32 r, g, b;\n\t(void) y;\n\tfromskew *= 3;\n\twhile (h-- > 0) {\n\t\tfor (x = w; x-- > 0;) {\n\t\t\tTIFFCIELabToXYZ(img->cielab,\n\t\t\t\t\t(unsigned char)pp[0],\n\t\t\t\t\t(signed char)pp[1],\n\t\t\t\t\t(signed char)pp[2],\n\t\t\t\t\t&X, &Y, &Z);\n\t\t\tTIFFXYZToRGB(img->cielab, X, Y, Z, &r, &g, &b);\n\t\t\t*cp++ = PACK(r, g, b);\n\t\t\tpp += 3;\n\t\t}\n\t\tcp += toskew;\n\t\tpp += fromskew;\n\t}\n}\n\n/*\n * YCbCr -> RGB conversion and packing routines.\n */\n\n#define\tYCbCrtoRGB(dst, Y) {\t\t\t\t\t\t\\\n\tuint32 r, g, b;\t\t\t\t\t\t\t\\\n\tTIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);\t\t\\\n\tdst = PACK(r, g, b);\t\t\t\t\t\t\\\n}\n\n/*\n * 8-bit packed YCbCr samples => RGB \n * This function is generic for different sampling sizes, \n * and can handle blocks sizes that aren't multiples of the\n * sampling size.  However, it is substantially less optimized\n * than the specific sampling cases.  It is used as a fallback\n * for difficult blocks.\n */\n#ifdef notdef\nstatic void putcontig8bitYCbCrGenericTile( \n    TIFFRGBAImage* img, \n    uint32* cp, \n    uint32 x, uint32 y, \n    uint32 w, uint32 h, \n    int32 fromskew, int32 toskew, \n    unsigned char* pp,\n    int h_group, \n    int v_group )\n\n{\n    uint32* cp1 = cp+w+toskew;\n    uint32* cp2 = cp1+w+toskew;\n    uint32* cp3 = cp2+w+toskew;\n    int32 incr = 3*w+4*toskew;\n    int32   Cb, Cr;\n    int     group_size = v_group * h_group + 2;\n\n    (void) y;\n    fromskew = (fromskew * group_size) / h_group;\n\n    for( yy = 0; yy < h; yy++ )\n    {\n        unsigned char *pp_line;\n        int     y_line_group = yy / v_group;\n        int     y_remainder = yy - y_line_group * v_group;\n\n        pp_line = pp + v_line_group * \n\n        \n        for( xx = 0; xx < w; xx++ )\n        {\n            Cb = pp\n        }\n    }\n    for (; h >= 4; h -= 4) {\n\tx = w>>2;\n\tdo {\n\t    Cb = pp[16];\n\t    Cr = pp[17];\n\n\t    YCbCrtoRGB(cp [0], pp[ 0]);\n\t    YCbCrtoRGB(cp [1], pp[ 1]);\n\t    YCbCrtoRGB(cp [2], pp[ 2]);\n\t    YCbCrtoRGB(cp [3], pp[ 3]);\n\t    YCbCrtoRGB(cp1[0], pp[ 4]);\n\t    YCbCrtoRGB(cp1[1], pp[ 5]);\n\t    YCbCrtoRGB(cp1[2], pp[ 6]);\n\t    YCbCrtoRGB(cp1[3], pp[ 7]);\n\t    YCbCrtoRGB(cp2[0], pp[ 8]);\n\t    YCbCrtoRGB(cp2[1], pp[ 9]);\n\t    YCbCrtoRGB(cp2[2], pp[10]);\n\t    YCbCrtoRGB(cp2[3], pp[11]);\n\t    YCbCrtoRGB(cp3[0], pp[12]);\n\t    YCbCrtoRGB(cp3[1], pp[13]);\n\t    YCbCrtoRGB(cp3[2], pp[14]);\n\t    YCbCrtoRGB(cp3[3], pp[15]);\n\n\t    cp += 4, cp1 += 4, cp2 += 4, cp3 += 4;\n\t    pp += 18;\n\t} while (--x);\n\tcp += incr, cp1 += incr, cp2 += incr, cp3 += incr;\n\tpp += fromskew;\n    }\n}\n#endif\n\n/*\n * 8-bit packed YCbCr samples w/ 4,4 subsampling => RGB\n */\nDECLAREContigPutFunc(putcontig8bitYCbCr44tile)\n{\n    uint32* cp1 = cp+w+toskew;\n    uint32* cp2 = cp1+w+toskew;\n    uint32* cp3 = cp2+w+toskew;\n    int32 incr = 3*w+4*toskew;\n\n    (void) y;\n    /* adjust fromskew */\n    fromskew = (fromskew * 18) / 4;\n    if ((h & 3) == 0 && (w & 3) == 0) {\t\t\t\t        \n        for (; h >= 4; h -= 4) {\n            x = w>>2;\n            do {\n                int32 Cb = pp[16];\n                int32 Cr = pp[17];\n\n                YCbCrtoRGB(cp [0], pp[ 0]);\n                YCbCrtoRGB(cp [1], pp[ 1]);\n                YCbCrtoRGB(cp [2], pp[ 2]);\n                YCbCrtoRGB(cp [3], pp[ 3]);\n                YCbCrtoRGB(cp1[0], pp[ 4]);\n                YCbCrtoRGB(cp1[1], pp[ 5]);\n                YCbCrtoRGB(cp1[2], pp[ 6]);\n                YCbCrtoRGB(cp1[3], pp[ 7]);\n                YCbCrtoRGB(cp2[0], pp[ 8]);\n                YCbCrtoRGB(cp2[1], pp[ 9]);\n                YCbCrtoRGB(cp2[2], pp[10]);\n                YCbCrtoRGB(cp2[3], pp[11]);\n                YCbCrtoRGB(cp3[0], pp[12]);\n                YCbCrtoRGB(cp3[1], pp[13]);\n                YCbCrtoRGB(cp3[2], pp[14]);\n                YCbCrtoRGB(cp3[3], pp[15]);\n\n                cp += 4, cp1 += 4, cp2 += 4, cp3 += 4;\n                pp += 18;\n            } while (--x);\n            cp += incr, cp1 += incr, cp2 += incr, cp3 += incr;\n            pp += fromskew;\n        }\n    } else {\n        while (h > 0) {\n            for (x = w; x > 0;) {\n                int32 Cb = pp[16];\n                int32 Cr = pp[17];\n                switch (x) {\n                default:\n                    switch (h) {\n                    default: YCbCrtoRGB(cp3[3], pp[15]); /* FALLTHROUGH */\n                    case 3:  YCbCrtoRGB(cp2[3], pp[11]); /* FALLTHROUGH */\n                    case 2:  YCbCrtoRGB(cp1[3], pp[ 7]); /* FALLTHROUGH */\n                    case 1:  YCbCrtoRGB(cp [3], pp[ 3]); /* FALLTHROUGH */\n                    }                                    /* FALLTHROUGH */\n                case 3:\n                    switch (h) {\n                    default: YCbCrtoRGB(cp3[2], pp[14]); /* FALLTHROUGH */\n                    case 3:  YCbCrtoRGB(cp2[2], pp[10]); /* FALLTHROUGH */\n                    case 2:  YCbCrtoRGB(cp1[2], pp[ 6]); /* FALLTHROUGH */\n                    case 1:  YCbCrtoRGB(cp [2], pp[ 2]); /* FALLTHROUGH */\n                    }                                    /* FALLTHROUGH */\n                case 2:\n                    switch (h) {\n                    default: YCbCrtoRGB(cp3[1], pp[13]); /* FALLTHROUGH */\n                    case 3:  YCbCrtoRGB(cp2[1], pp[ 9]); /* FALLTHROUGH */\n                    case 2:  YCbCrtoRGB(cp1[1], pp[ 5]); /* FALLTHROUGH */\n                    case 1:  YCbCrtoRGB(cp [1], pp[ 1]); /* FALLTHROUGH */\n                    }                                    /* FALLTHROUGH */\n                case 1:\n                    switch (h) {\n                    default: YCbCrtoRGB(cp3[0], pp[12]); /* FALLTHROUGH */\n                    case 3:  YCbCrtoRGB(cp2[0], pp[ 8]); /* FALLTHROUGH */\n                    case 2:  YCbCrtoRGB(cp1[0], pp[ 4]); /* FALLTHROUGH */\n                    case 1:  YCbCrtoRGB(cp [0], pp[ 0]); /* FALLTHROUGH */\n                    }                                    /* FALLTHROUGH */\n                }\n                if (x < 4) {\n                    cp += x; cp1 += x; cp2 += x; cp3 += x;\n                    x = 0;\n                }\n                else {\n                    cp += 4; cp1 += 4; cp2 += 4; cp3 += 4;\n                    x -= 4;\n                }\n                pp += 18;\n            }\n            if (h <= 4)\n                break;\n            h -= 4;\n            cp += incr, cp1 += incr, cp2 += incr, cp3 += incr;\n            pp += fromskew;\n        }\n    }\n}\n\n/*\n * 8-bit packed YCbCr samples w/ 4,2 subsampling => RGB\n */\nDECLAREContigPutFunc(putcontig8bitYCbCr42tile)\n{\n    uint32* cp1 = cp+w+toskew;\n    int32 incr = 2*toskew+w;\n\n    (void) y;\n    fromskew = (fromskew * 10) / 4;\n    if ((h & 3) == 0 && (w & 1) == 0) {\n        for (; h >= 2; h -= 2) {\n            x = w>>2;\n            do {\n                int32 Cb = pp[8];\n                int32 Cr = pp[9];\n                \n                YCbCrtoRGB(cp [0], pp[0]);\n                YCbCrtoRGB(cp [1], pp[1]);\n                YCbCrtoRGB(cp [2], pp[2]);\n                YCbCrtoRGB(cp [3], pp[3]);\n                YCbCrtoRGB(cp1[0], pp[4]);\n                YCbCrtoRGB(cp1[1], pp[5]);\n                YCbCrtoRGB(cp1[2], pp[6]);\n                YCbCrtoRGB(cp1[3], pp[7]);\n                \n                cp += 4, cp1 += 4;\n                pp += 10;\n            } while (--x);\n            cp += incr, cp1 += incr;\n            pp += fromskew;\n        }\n    } else {\n        while (h > 0) {\n            for (x = w; x > 0;) {\n                int32 Cb = pp[8];\n                int32 Cr = pp[9];\n                switch (x) {\n                default:\n                    switch (h) {\n                    default: YCbCrtoRGB(cp1[3], pp[ 7]); /* FALLTHROUGH */\n                    case 1:  YCbCrtoRGB(cp [3], pp[ 3]); /* FALLTHROUGH */\n                    }                                    /* FALLTHROUGH */\n                case 3:\n                    switch (h) {\n                    default: YCbCrtoRGB(cp1[2], pp[ 6]); /* FALLTHROUGH */\n                    case 1:  YCbCrtoRGB(cp [2], pp[ 2]); /* FALLTHROUGH */\n                    }                                    /* FALLTHROUGH */\n                case 2:\n                    switch (h) {\n                    default: YCbCrtoRGB(cp1[1], pp[ 5]); /* FALLTHROUGH */\n                    case 1:  YCbCrtoRGB(cp [1], pp[ 1]); /* FALLTHROUGH */\n                    }                                    /* FALLTHROUGH */\n                case 1:\n                    switch (h) {\n                    default: YCbCrtoRGB(cp1[0], pp[ 4]); /* FALLTHROUGH */\n                    case 1:  YCbCrtoRGB(cp [0], pp[ 0]); /* FALLTHROUGH */\n                    }                                    /* FALLTHROUGH */\n                }\n                if (x < 4) {\n                    cp += x; cp1 += x;\n                    x = 0;\n                }\n                else {\n                    cp += 4; cp1 += 4;\n                    x -= 4;\n                }\n                pp += 10;\n            }\n            if (h <= 2)\n                break;\n            h -= 2;\n            cp += incr, cp1 += incr;\n            pp += fromskew;\n        }\n    }\n}\n\n/*\n * 8-bit packed YCbCr samples w/ 4,1 subsampling => RGB\n */\nDECLAREContigPutFunc(putcontig8bitYCbCr41tile)\n{\n    (void) y;\n    /* XXX adjust fromskew */\n    do {\n\tx = w>>2;\n\tdo {\n\t    int32 Cb = pp[4];\n\t    int32 Cr = pp[5];\n\n\t    YCbCrtoRGB(cp [0], pp[0]);\n\t    YCbCrtoRGB(cp [1], pp[1]);\n\t    YCbCrtoRGB(cp [2], pp[2]);\n\t    YCbCrtoRGB(cp [3], pp[3]);\n\n\t    cp += 4;\n\t    pp += 6;\n\t} while (--x);\n\n        if( (w&3) != 0 )\n        {\n\t    int32 Cb = pp[4];\n\t    int32 Cr = pp[5];\n\n            switch( (w&3) ) {\n              case 3: YCbCrtoRGB(cp [2], pp[2]);\n              case 2: YCbCrtoRGB(cp [1], pp[1]);\n              case 1: YCbCrtoRGB(cp [0], pp[0]);\n              case 0: break;\n            }\n\n            cp += (w&3);\n            pp += 6;\n        }\n\n\tcp += toskew;\n\tpp += fromskew;\n    } while (--h);\n\n}\n\n/*\n * 8-bit packed YCbCr samples w/ 2,2 subsampling => RGB\n */\nDECLAREContigPutFunc(putcontig8bitYCbCr22tile)\n{\n\tuint32* cp2;\n\t(void) y;\n\tfromskew = (fromskew / 2) * 6;\n\tcp2 = cp+w+toskew;\n\twhile (h>=2) {\n\t\tx = w;\n\t\twhile (x>=2) {\n\t\t\tuint32 Cb = pp[4];\n\t\t\tuint32 Cr = pp[5];\n\t\t\tYCbCrtoRGB(cp[0], pp[0]);\n\t\t\tYCbCrtoRGB(cp[1], pp[1]);\n\t\t\tYCbCrtoRGB(cp2[0], pp[2]);\n\t\t\tYCbCrtoRGB(cp2[1], pp[3]);\n\t\t\tcp += 2;\n\t\t\tcp2 += 2;\n\t\t\tpp += 6;\n\t\t\tx -= 2;\n\t\t}\n\t\tif (x==1) {\n\t\t\tuint32 Cb = pp[4];\n\t\t\tuint32 Cr = pp[5];\n\t\t\tYCbCrtoRGB(cp[0], pp[0]);\n\t\t\tYCbCrtoRGB(cp2[0], pp[2]);\n\t\t\tcp ++ ;\n\t\t\tcp2 ++ ;\n\t\t\tpp += 6;\n\t\t}\n\t\tcp += toskew*2+w;\n\t\tcp2 += toskew*2+w;\n\t\tpp += fromskew;\n\t\th-=2;\n\t}\n\tif (h==1) {\n\t\tx = w;\n\t\twhile (x>=2) {\n\t\t\tuint32 Cb = pp[4];\n\t\t\tuint32 Cr = pp[5];\n\t\t\tYCbCrtoRGB(cp[0], pp[0]);\n\t\t\tYCbCrtoRGB(cp[1], pp[1]);\n\t\t\tcp += 2;\n\t\t\tcp2 += 2;\n\t\t\tpp += 6;\n\t\t\tx -= 2;\n\t\t}\n\t\tif (x==1) {\n\t\t\tuint32 Cb = pp[4];\n\t\t\tuint32 Cr = pp[5];\n\t\t\tYCbCrtoRGB(cp[0], pp[0]);\n\t\t}\n\t}\n}\n\n/*\n * 8-bit packed YCbCr samples w/ 2,1 subsampling => RGB\n */\nDECLAREContigPutFunc(putcontig8bitYCbCr21tile)\n{\n\t(void) y;\n\tfromskew = (fromskew * 4) / 2;\n\tdo {\n\t\tx = w>>1;\n\t\tdo {\n\t\t\tint32 Cb = pp[2];\n\t\t\tint32 Cr = pp[3];\n\n\t\t\tYCbCrtoRGB(cp[0], pp[0]);\n\t\t\tYCbCrtoRGB(cp[1], pp[1]);\n\n\t\t\tcp += 2;\n\t\t\tpp += 4;\n\t\t} while (--x);\n\n\t\tif( (w&1) != 0 )\n\t\t{\n\t\t\tint32 Cb = pp[2];\n\t\t\tint32 Cr = pp[3];\n\n\t\t\tYCbCrtoRGB(cp[0], pp[0]);\n\n\t\t\tcp += 1;\n\t\t\tpp += 4;\n\t\t}\n\n\t\tcp += toskew;\n\t\tpp += fromskew;\n\t} while (--h);\n}\n\n/*\n * 8-bit packed YCbCr samples w/ 1,2 subsampling => RGB\n */\nDECLAREContigPutFunc(putcontig8bitYCbCr12tile)\n{\n\tuint32* cp2;\n\t(void) y;\n\tfromskew = (fromskew / 2) * 4;\n\tcp2 = cp+w+toskew;\n\twhile (h>=2) {\n\t\tx = w;\n\t\tdo {\n\t\t\tuint32 Cb = pp[2];\n\t\t\tuint32 Cr = pp[3];\n\t\t\tYCbCrtoRGB(cp[0], pp[0]);\n\t\t\tYCbCrtoRGB(cp2[0], pp[1]);\n\t\t\tcp ++;\n\t\t\tcp2 ++;\n\t\t\tpp += 4;\n\t\t} while (--x);\n\t\tcp += toskew*2+w;\n\t\tcp2 += toskew*2+w;\n\t\tpp += fromskew;\n\t\th-=2;\n\t}\n\tif (h==1) {\n\t\tx = w;\n\t\tdo {\n\t\t\tuint32 Cb = pp[2];\n\t\t\tuint32 Cr = pp[3];\n\t\t\tYCbCrtoRGB(cp[0], pp[0]);\n\t\t\tcp ++;\n\t\t\tpp += 4;\n\t\t} while (--x);\n\t}\n}\n\n/*\n * 8-bit packed YCbCr samples w/ no subsampling => RGB\n */\nDECLAREContigPutFunc(putcontig8bitYCbCr11tile)\n{\n\t(void) y;\n\tfromskew *= 3;\n\tdo {\n\t\tx = w; /* was x = w>>1; patched 2000/09/25 warmerda@home.com */\n\t\tdo {\n\t\t\tint32 Cb = pp[1];\n\t\t\tint32 Cr = pp[2];\n\n\t\t\tYCbCrtoRGB(*cp++, pp[0]);\n\n\t\t\tpp += 3;\n\t\t} while (--x);\n\t\tcp += toskew;\n\t\tpp += fromskew;\n\t} while (--h);\n}\n\n/*\n * 8-bit packed YCbCr samples w/ no subsampling => RGB\n */\nDECLARESepPutFunc(putseparate8bitYCbCr11tile)\n{\n\t(void) y;\n\t(void) a;\n\t/* TODO: naming of input vars is still off, change obfuscating declaration inside define, or resolve obfuscation */\n\twhile (h-- > 0) {\n\t\tx = w;\n\t\tdo {\n\t\t\tuint32 dr, dg, db;\n\t\t\tTIFFYCbCrtoRGB(img->ycbcr,*r++,*g++,*b++,&dr,&dg,&db);\n\t\t\t*cp++ = PACK(dr,dg,db);\n\t\t} while (--x);\n\t\tSKEW(r, g, b, fromskew);\n\t\tcp += toskew;\n\t}\n}\n#undef YCbCrtoRGB\n\nstatic int\ninitYCbCrConversion(TIFFRGBAImage* img)\n{\n\tstatic char module[] = \"initYCbCrConversion\";\n\n\tfloat *luma, *refBlackWhite;\n\n\tif (img->ycbcr == NULL) {\n\t\timg->ycbcr = (TIFFYCbCrToRGB*) _TIFFmalloc(\n\t\t    TIFFroundup(sizeof (TIFFYCbCrToRGB), sizeof (long))\n\t\t    + 4*256*sizeof (TIFFRGBValue)\n\t\t    + 2*256*sizeof (int)\n\t\t    + 3*256*sizeof (int32)\n\t\t    );\n\t\tif (img->ycbcr == NULL) {\n\t\t\tTIFFErrorExt(img->tif->tif_clientdata, module,\n\t\t\t    \"No space for YCbCr->RGB conversion state\");\n\t\t\treturn (0);\n\t\t}\n\t}\n\n\tTIFFGetFieldDefaulted(img->tif, TIFFTAG_YCBCRCOEFFICIENTS, &luma);\n\tTIFFGetFieldDefaulted(img->tif, TIFFTAG_REFERENCEBLACKWHITE,\n\t    &refBlackWhite);\n\tif (TIFFYCbCrToRGBInit(img->ycbcr, luma, refBlackWhite) < 0)\n\t\treturn(0);\n\treturn (1);\n}\n\nstatic tileContigRoutine\ninitCIELabConversion(TIFFRGBAImage* img)\n{\n\tstatic char module[] = \"initCIELabConversion\";\n\n\tfloat   *whitePoint;\n\tfloat   refWhite[3];\n\n\tif (!img->cielab) {\n\t\timg->cielab = (TIFFCIELabToRGB *)\n\t\t\t_TIFFmalloc(sizeof(TIFFCIELabToRGB));\n\t\tif (!img->cielab) {\n\t\t\tTIFFErrorExt(img->tif->tif_clientdata, module,\n\t\t\t    \"No space for CIE L*a*b*->RGB conversion state.\");\n\t\t\treturn NULL;\n\t\t}\n\t}\n\n\tTIFFGetFieldDefaulted(img->tif, TIFFTAG_WHITEPOINT, &whitePoint);\n\trefWhite[1] = 100.0F;\n\trefWhite[0] = whitePoint[0] / whitePoint[1] * refWhite[1];\n\trefWhite[2] = (1.0F - whitePoint[0] - whitePoint[1])\n\t\t      / whitePoint[1] * refWhite[1];\n\tif (TIFFCIELabToRGBInit(img->cielab, &display_sRGB, refWhite) < 0) {\n\t\tTIFFErrorExt(img->tif->tif_clientdata, module,\n\t\t    \"Failed to initialize CIE L*a*b*->RGB conversion state.\");\n\t\t_TIFFfree(img->cielab);\n\t\treturn NULL;\n\t}\n\n\treturn putcontig8bitCIELab;\n}\n\n/*\n * Greyscale images with less than 8 bits/sample are handled\n * with a table to avoid lots of shifts and masks.  The table\n * is setup so that put*bwtile (below) can retrieve 8/bitspersample\n * pixel values simply by indexing into the table with one\n * number.\n */\nstatic int\nmakebwmap(TIFFRGBAImage* img)\n{\n    TIFFRGBValue* Map = img->Map;\n    int bitspersample = img->bitspersample;\n    int nsamples = 8 / bitspersample;\n    int i;\n    uint32* p;\n\n    if( nsamples == 0 )\n        nsamples = 1;\n\n    img->BWmap = (uint32**) _TIFFmalloc(\n\t256*sizeof (uint32 *)+(256*nsamples*sizeof(uint32)));\n    if (img->BWmap == NULL) {\n\t\tTIFFErrorExt(img->tif->tif_clientdata, TIFFFileName(img->tif), \"No space for B&W mapping table\");\n\t\treturn (0);\n    }\n    p = (uint32*)(img->BWmap + 256);\n    for (i = 0; i < 256; i++) {\n\tTIFFRGBValue c;\n\timg->BWmap[i] = p;\n\tswitch (bitspersample) {\n#define\tGREY(x)\tc = Map[x]; *p++ = PACK(c,c,c);\n\tcase 1:\n\t    GREY(i>>7);\n\t    GREY((i>>6)&1);\n\t    GREY((i>>5)&1);\n\t    GREY((i>>4)&1);\n\t    GREY((i>>3)&1);\n\t    GREY((i>>2)&1);\n\t    GREY((i>>1)&1);\n\t    GREY(i&1);\n\t    break;\n\tcase 2:\n\t    GREY(i>>6);\n\t    GREY((i>>4)&3);\n\t    GREY((i>>2)&3);\n\t    GREY(i&3);\n\t    break;\n\tcase 4:\n\t    GREY(i>>4);\n\t    GREY(i&0xf);\n\t    break;\n\tcase 8:\n        case 16:\n\t    GREY(i);\n\t    break;\n\t}\n#undef\tGREY\n    }\n    return (1);\n}\n\n/*\n * Construct a mapping table to convert from the range\n * of the data samples to [0,255] --for display.  This\n * process also handles inverting B&W images when needed.\n */ \nstatic int\nsetupMap(TIFFRGBAImage* img)\n{\n    int32 x, range;\n\n    range = (int32)((1L<<img->bitspersample)-1);\n    \n    /* treat 16 bit the same as eight bit */\n    if( img->bitspersample == 16 )\n        range = (int32) 255;\n\n    img->Map = (TIFFRGBValue*) _TIFFmalloc((range+1) * sizeof (TIFFRGBValue));\n    if (img->Map == NULL) {\n\t\tTIFFErrorExt(img->tif->tif_clientdata, TIFFFileName(img->tif),\n\t\t\t\"No space for photometric conversion table\");\n\t\treturn (0);\n    }\n    if (img->photometric == PHOTOMETRIC_MINISWHITE) {\n\tfor (x = 0; x <= range; x++)\n\t    img->Map[x] = (TIFFRGBValue) (((range - x) * 255) / range);\n    } else {\n\tfor (x = 0; x <= range; x++)\n\t    img->Map[x] = (TIFFRGBValue) ((x * 255) / range);\n    }\n    if (img->bitspersample <= 16 &&\n\t(img->photometric == PHOTOMETRIC_MINISBLACK ||\n\t img->photometric == PHOTOMETRIC_MINISWHITE)) {\n\t/*\n\t * Use photometric mapping table to construct\n\t * unpacking tables for samples <= 8 bits.\n\t */\n\tif (!makebwmap(img))\n\t    return (0);\n\t/* no longer need Map, free it */\n\t_TIFFfree(img->Map), img->Map = NULL;\n    }\n    return (1);\n}\n\nstatic int\ncheckcmap(TIFFRGBAImage* img)\n{\n    uint16* r = img->redcmap;\n    uint16* g = img->greencmap;\n    uint16* b = img->bluecmap;\n    long n = 1L<<img->bitspersample;\n\n    while (n-- > 0)\n\tif (*r++ >= 256 || *g++ >= 256 || *b++ >= 256)\n\t    return (16);\n    return (8);\n}\n\nstatic void\ncvtcmap(TIFFRGBAImage* img)\n{\n    uint16* r = img->redcmap;\n    uint16* g = img->greencmap;\n    uint16* b = img->bluecmap;\n    long i;\n\n    for (i = (1L<<img->bitspersample)-1; i >= 0; i--) {\n#define\tCVT(x)\t\t((uint16)((x)>>8))\n\tr[i] = CVT(r[i]);\n\tg[i] = CVT(g[i]);\n\tb[i] = CVT(b[i]);\n#undef\tCVT\n    }\n}\n\n/*\n * Palette images with <= 8 bits/sample are handled\n * with a table to avoid lots of shifts and masks.  The table\n * is setup so that put*cmaptile (below) can retrieve 8/bitspersample\n * pixel values simply by indexing into the table with one\n * number.\n */\nstatic int\nmakecmap(TIFFRGBAImage* img)\n{\n    int bitspersample = img->bitspersample;\n    int nsamples = 8 / bitspersample;\n    uint16* r = img->redcmap;\n    uint16* g = img->greencmap;\n    uint16* b = img->bluecmap;\n    uint32 *p;\n    int i;\n\n    img->PALmap = (uint32**) _TIFFmalloc(\n\t256*sizeof (uint32 *)+(256*nsamples*sizeof(uint32)));\n    if (img->PALmap == NULL) {\n\t\tTIFFErrorExt(img->tif->tif_clientdata, TIFFFileName(img->tif), \"No space for Palette mapping table\");\n\t\treturn (0);\n\t}\n    p = (uint32*)(img->PALmap + 256);\n    for (i = 0; i < 256; i++) {\n\tTIFFRGBValue c;\n\timg->PALmap[i] = p;\n#define\tCMAP(x)\tc = (TIFFRGBValue) x; *p++ = PACK(r[c]&0xff, g[c]&0xff, b[c]&0xff);\n\tswitch (bitspersample) {\n\tcase 1:\n\t    CMAP(i>>7);\n\t    CMAP((i>>6)&1);\n\t    CMAP((i>>5)&1);\n\t    CMAP((i>>4)&1);\n\t    CMAP((i>>3)&1);\n\t    CMAP((i>>2)&1);\n\t    CMAP((i>>1)&1);\n\t    CMAP(i&1);\n\t    break;\n\tcase 2:\n\t    CMAP(i>>6);\n\t    CMAP((i>>4)&3);\n\t    CMAP((i>>2)&3);\n\t    CMAP(i&3);\n\t    break;\n\tcase 4:\n\t    CMAP(i>>4);\n\t    CMAP(i&0xf);\n\t    break;\n\tcase 8:\n\t    CMAP(i);\n\t    break;\n\t}\n#undef CMAP\n    }\n    return (1);\n}\n\n/* \n * Construct any mapping table used\n * by the associated put routine.\n */\nstatic int\nbuildMap(TIFFRGBAImage* img)\n{\n    switch (img->photometric) {\n    case PHOTOMETRIC_RGB:\n    case PHOTOMETRIC_YCBCR:\n    case PHOTOMETRIC_SEPARATED:\n\tif (img->bitspersample == 8)\n\t    break;\n\t/* fall thru... */\n    case PHOTOMETRIC_MINISBLACK:\n    case PHOTOMETRIC_MINISWHITE:\n\tif (!setupMap(img))\n\t    return (0);\n\tbreak;\n    case PHOTOMETRIC_PALETTE:\n\t/*\n\t * Convert 16-bit colormap to 8-bit (unless it looks\n\t * like an old-style 8-bit colormap).\n\t */\n\tif (checkcmap(img) == 16)\n\t    cvtcmap(img);\n\telse\n\t    TIFFWarningExt(img->tif->tif_clientdata, TIFFFileName(img->tif), \"Assuming 8-bit colormap\");\n\t/*\n\t * Use mapping table and colormap to construct\n\t * unpacking tables for samples < 8 bits.\n\t */\n\tif (img->bitspersample <= 8 && !makecmap(img))\n\t    return (0);\n\tbreak;\n    }\n    return (1);\n}\n\n/*\n * Select the appropriate conversion routine for packed data.\n */\nstatic int\nPickContigCase(TIFFRGBAImage* img)\n{\n\timg->get = TIFFIsTiled(img->tif) ? gtTileContig : gtStripContig;\n\timg->put.contig = NULL;\n\tswitch (img->photometric) {\n\t\tcase PHOTOMETRIC_RGB:\n\t\t\tswitch (img->bitspersample) {\n\t\t\t\tcase 8:\n\t\t\t\t\tif (img->alpha == EXTRASAMPLE_ASSOCALPHA)\n\t\t\t\t\t\timg->put.contig = putRGBAAcontig8bittile;\n\t\t\t\t\telse if (img->alpha == EXTRASAMPLE_UNASSALPHA)\n\t\t\t\t\t{\n                                            img->put.contig = putRGBUAcontig8bittile;\n\t\t\t\t\t}\n\t\t\t\t\telse\n                                            img->put.contig = putRGBcontig8bittile;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 16:\n\t\t\t\t\tif (img->alpha == EXTRASAMPLE_ASSOCALPHA)\n\t\t\t\t\t{\n                                            img->put.contig = putRGBAAcontig16bittile;\n\t\t\t\t\t}\n\t\t\t\t\telse if (img->alpha == EXTRASAMPLE_UNASSALPHA)\n\t\t\t\t\t{\n                                            img->put.contig = putRGBUAcontig16bittile;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n                                            img->put.contig = putRGBcontig16bittile;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase PHOTOMETRIC_SEPARATED:\n\t\t\tif (buildMap(img)) {\n\t\t\t\tif (img->bitspersample == 8) {\n\t\t\t\t\tif (!img->Map)\n\t\t\t\t\t\timg->put.contig = putRGBcontig8bitCMYKtile;\n\t\t\t\t\telse\n\t\t\t\t\t\timg->put.contig = putRGBcontig8bitCMYKMaptile;\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\tcase PHOTOMETRIC_PALETTE:\n\t\t\tif (buildMap(img)) {\n\t\t\t\tswitch (img->bitspersample) {\n\t\t\t\t\tcase 8:\n\t\t\t\t\t\timg->put.contig = put8bitcmaptile;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 4:\n\t\t\t\t\t\timg->put.contig = put4bitcmaptile;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 2:\n\t\t\t\t\t\timg->put.contig = put2bitcmaptile;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 1:\n\t\t\t\t\t\timg->put.contig = put1bitcmaptile;\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\tcase PHOTOMETRIC_MINISWHITE:\n\t\tcase PHOTOMETRIC_MINISBLACK:\n\t\t\tif (buildMap(img)) {\n\t\t\t\tswitch (img->bitspersample) {\n\t\t\t\t\tcase 16:\n\t\t\t\t\t\timg->put.contig = put16bitbwtile;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 8:\n\t\t\t\t\t\timg->put.contig = putgreytile;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 4:\n\t\t\t\t\t\timg->put.contig = put4bitbwtile;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 2:\n\t\t\t\t\t\timg->put.contig = put2bitbwtile;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 1:\n\t\t\t\t\t\timg->put.contig = put1bitbwtile;\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\tcase PHOTOMETRIC_YCBCR:\n\t\t\tif (img->bitspersample == 8)\n\t\t\t{\n\t\t\t\tif (initYCbCrConversion(img)!=0)\n\t\t\t\t{\n\t\t\t\t\t/*\n\t\t\t\t\t * The 6.0 spec says that subsampling must be\n\t\t\t\t\t * one of 1, 2, or 4, and that vertical subsampling\n\t\t\t\t\t * must always be <= horizontal subsampling; so\n\t\t\t\t\t * there are only a few possibilities and we just\n\t\t\t\t\t * enumerate the cases.\n\t\t\t\t\t * Joris: added support for the [1,2] case, nonetheless, to accomodate\n\t\t\t\t\t * some OJPEG files\n\t\t\t\t\t */\n\t\t\t\t\tuint16 SubsamplingHor;\n\t\t\t\t\tuint16 SubsamplingVer;\n\t\t\t\t\tTIFFGetFieldDefaulted(img->tif, TIFFTAG_YCBCRSUBSAMPLING, &SubsamplingHor, &SubsamplingVer);\n\t\t\t\t\tswitch ((SubsamplingHor<<4)|SubsamplingVer) {\n\t\t\t\t\t\tcase 0x44:\n\t\t\t\t\t\t\timg->put.contig = putcontig8bitYCbCr44tile;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 0x42:\n\t\t\t\t\t\t\timg->put.contig = putcontig8bitYCbCr42tile;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 0x41:\n\t\t\t\t\t\t\timg->put.contig = putcontig8bitYCbCr41tile;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 0x22:\n\t\t\t\t\t\t\timg->put.contig = putcontig8bitYCbCr22tile;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 0x21:\n\t\t\t\t\t\t\timg->put.contig = putcontig8bitYCbCr21tile;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 0x12:\n\t\t\t\t\t\t\timg->put.contig = putcontig8bitYCbCr12tile;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 0x11:\n\t\t\t\t\t\t\timg->put.contig = putcontig8bitYCbCr11tile;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\tcase PHOTOMETRIC_CIELAB:\n\t\t\tif (buildMap(img)) {\n\t\t\t\tif (img->bitspersample == 8)\n\t\t\t\t\timg->put.contig = initCIELabConversion(img);\n\t\t\t\tbreak;\n\t\t\t}\n\t}\n\treturn ((img->get!=NULL) && (img->put.contig!=NULL));\n}\n\n/*\n * Select the appropriate conversion routine for unpacked data.\n *\n * NB: we assume that unpacked single channel data is directed\n *\t to the \"packed routines.\n */\nstatic int\nPickSeparateCase(TIFFRGBAImage* img)\n{\n\timg->get = TIFFIsTiled(img->tif) ? gtTileSeparate : gtStripSeparate;\n\timg->put.separate = NULL;\n\tswitch (img->photometric) {\n\t\tcase PHOTOMETRIC_RGB:\n\t\t\tswitch (img->bitspersample) {\n\t\t\t\tcase 8:\n\t\t\t\t\tif (img->alpha == EXTRASAMPLE_ASSOCALPHA)\n\t\t\t\t\t\timg->put.separate = putRGBAAseparate8bittile;\n\t\t\t\t\telse if (img->alpha == EXTRASAMPLE_UNASSALPHA)\n\t\t\t\t\t{\n                                            img->put.separate = putRGBUAseparate8bittile;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t\timg->put.separate = putRGBseparate8bittile;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 16:\n\t\t\t\t\tif (img->alpha == EXTRASAMPLE_ASSOCALPHA)\n\t\t\t\t\t{\n                                            img->put.separate = putRGBAAseparate16bittile;\n\t\t\t\t\t}\n\t\t\t\t\telse if (img->alpha == EXTRASAMPLE_UNASSALPHA)\n\t\t\t\t\t{\n                                            img->put.separate = putRGBUAseparate16bittile;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n                                            img->put.separate = putRGBseparate16bittile;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase PHOTOMETRIC_YCBCR:\n\t\t\tif ((img->bitspersample==8) && (img->samplesperpixel==3))\n\t\t\t{\n\t\t\t\tif (initYCbCrConversion(img)!=0)\n\t\t\t\t{\n\t\t\t\t\tuint16 hs, vs;\n\t\t\t\t\tTIFFGetFieldDefaulted(img->tif, TIFFTAG_YCBCRSUBSAMPLING, &hs, &vs);\n\t\t\t\t\tswitch ((hs<<4)|vs) {\n\t\t\t\t\t\tcase 0x11:\n\t\t\t\t\t\t\timg->put.separate = putseparate8bitYCbCr11tile;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t/* TODO: add other cases here */\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t}\n\treturn ((img->get!=NULL) && (img->put.separate!=NULL));\n}\n\n/*\n * Read a whole strip off data from the file, and convert to RGBA form.\n * If this is the last strip, then it will only contain the portion of\n * the strip that is actually within the image space.  The result is\n * organized in bottom to top form.\n */\n\n\nint\nTIFFReadRGBAStrip(TIFF* tif, uint32 row, uint32 * raster )\n\n{\n    char \temsg[1024] = \"\";\n    TIFFRGBAImage img;\n    int \tok;\n    uint32\trowsperstrip, rows_to_read;\n\n    if( TIFFIsTiled( tif ) )\n    {\n\t\tTIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif),\n                  \"Can't use TIFFReadRGBAStrip() with tiled file.\");\n\treturn (0);\n    }\n    \n    TIFFGetFieldDefaulted(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);\n    if( (row % rowsperstrip) != 0 )\n    {\n\t\tTIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif),\n\t\t\t\t\"Row passed to TIFFReadRGBAStrip() must be first in a strip.\");\n\t\treturn (0);\n    }\n\n    if (TIFFRGBAImageOK(tif, emsg) && TIFFRGBAImageBegin(&img, tif, 0, emsg)) {\n\n        img.row_offset = row;\n        img.col_offset = 0;\n\n        if( row + rowsperstrip > img.height )\n            rows_to_read = img.height - row;\n        else\n            rows_to_read = rowsperstrip;\n        \n\tok = TIFFRGBAImageGet(&img, raster, img.width, rows_to_read );\n        \n\tTIFFRGBAImageEnd(&img);\n    } else {\n\t\tTIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), \"%s\", emsg);\n\t\tok = 0;\n    }\n    \n    return (ok);\n}\n\n/*\n * Read a whole tile off data from the file, and convert to RGBA form.\n * The returned RGBA data is organized from bottom to top of tile,\n * and may include zeroed areas if the tile extends off the image.\n */\n\nint\nTIFFReadRGBATile(TIFF* tif, uint32 col, uint32 row, uint32 * raster)\n\n{\n    char \temsg[1024] = \"\";\n    TIFFRGBAImage img;\n    int \tok;\n    uint32\ttile_xsize, tile_ysize;\n    uint32\tread_xsize, read_ysize;\n    uint32\ti_row;\n\n    /*\n     * Verify that our request is legal - on a tile file, and on a\n     * tile boundary.\n     */\n    \n    if( !TIFFIsTiled( tif ) )\n    {\n\t\tTIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif),\n\t\t\t\t  \"Can't use TIFFReadRGBATile() with stripped file.\");\n\t\treturn (0);\n    }\n    \n    TIFFGetFieldDefaulted(tif, TIFFTAG_TILEWIDTH, &tile_xsize);\n    TIFFGetFieldDefaulted(tif, TIFFTAG_TILELENGTH, &tile_ysize);\n    if( (col % tile_xsize) != 0 || (row % tile_ysize) != 0 )\n    {\n\t\tTIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif),\n                  \"Row/col passed to TIFFReadRGBATile() must be top\"\n                  \"left corner of a tile.\");\n\treturn (0);\n    }\n\n    /*\n     * Setup the RGBA reader.\n     */\n    \n    if (!TIFFRGBAImageOK(tif, emsg) \n\t|| !TIFFRGBAImageBegin(&img, tif, 0, emsg)) {\n\t    TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), \"%s\", emsg);\n\t    return( 0 );\n    }\n\n    /*\n     * The TIFFRGBAImageGet() function doesn't allow us to get off the\n     * edge of the image, even to fill an otherwise valid tile.  So we\n     * figure out how much we can read, and fix up the tile buffer to\n     * a full tile configuration afterwards.\n     */\n\n    if( row + tile_ysize > img.height )\n        read_ysize = img.height - row;\n    else\n        read_ysize = tile_ysize;\n    \n    if( col + tile_xsize > img.width )\n        read_xsize = img.width - col;\n    else\n        read_xsize = tile_xsize;\n\n    /*\n     * Read the chunk of imagery.\n     */\n    \n    img.row_offset = row;\n    img.col_offset = col;\n\n    ok = TIFFRGBAImageGet(&img, raster, read_xsize, read_ysize );\n        \n    TIFFRGBAImageEnd(&img);\n\n    /*\n     * If our read was incomplete we will need to fix up the tile by\n     * shifting the data around as if a full tile of data is being returned.\n     *\n     * This is all the more complicated because the image is organized in\n     * bottom to top format. \n     */\n\n    if( read_xsize == tile_xsize && read_ysize == tile_ysize )\n        return( ok );\n\n    for( i_row = 0; i_row < read_ysize; i_row++ ) {\n        memmove( raster + (tile_ysize - i_row - 1) * tile_xsize,\n                 raster + (read_ysize - i_row - 1) * read_xsize,\n                 read_xsize * sizeof(uint32) );\n        _TIFFmemset( raster + (tile_ysize - i_row - 1) * tile_xsize+read_xsize,\n                     0, sizeof(uint32) * (tile_xsize - read_xsize) );\n    }\n\n    for( i_row = read_ysize; i_row < tile_ysize; i_row++ ) {\n        _TIFFmemset( raster + (tile_ysize - i_row - 1) * tile_xsize,\n                     0, sizeof(uint32) * tile_xsize );\n    }\n\n    return (ok);\n}\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/tif_jbig.c",
    "content": "/* $Id: tif_jbig.c,v 1.2.2.2 2008-10-21 13:13:07 dron Exp $ */\n\n/*\n * Copyright (c) 1988-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n/*\n * TIFF Library.\n *\n * JBIG Compression Algorithm Support.\n * Contributed by Lee Howard <faxguy@deanox.com>\n * \n */\n\n#include \"tiffiop.h\"\n\n#ifdef JBIG_SUPPORT\n#include \"jbig.h\"\n\ntypedef struct\n{\n        uint32  recvparams;     /* encoded Class 2 session params             */\n        char*   subaddress;     /* subaddress string                          */\n        uint32  recvtime;       /* time spend receiving in seconds            */\n        char*   faxdcs;         /* encoded fax parameters (DCS, Table 2/T.30) */\n\n        TIFFVGetMethod vgetparent;\n        TIFFVSetMethod vsetparent;\n} JBIGState;\n\n#define GetJBIGState(tif) ((JBIGState*)(tif)->tif_data)\n\n#define FIELD_RECVPARAMS        (FIELD_CODEC+0)\n#define FIELD_SUBADDRESS        (FIELD_CODEC+1)\n#define FIELD_RECVTIME          (FIELD_CODEC+2)\n#define FIELD_FAXDCS            (FIELD_CODEC+3)\n\nstatic const TIFFFieldInfo jbigFieldInfo[] = \n{\n        {TIFFTAG_FAXRECVPARAMS,  1,  1, TIFF_LONG,  FIELD_RECVPARAMS, TRUE, FALSE, \"FaxRecvParams\"},\n        {TIFFTAG_FAXSUBADDRESS, -1, -1, TIFF_ASCII, FIELD_SUBADDRESS, TRUE, FALSE, \"FaxSubAddress\"},\n        {TIFFTAG_FAXRECVTIME,    1,  1, TIFF_LONG,  FIELD_RECVTIME,   TRUE, FALSE, \"FaxRecvTime\"},\n        {TIFFTAG_FAXDCS,        -1, -1, TIFF_ASCII, FIELD_FAXDCS,     TRUE, FALSE, \"FaxDcs\"},\n};\n\nstatic int JBIGSetupDecode(TIFF* tif)\n{\n        if (TIFFNumberOfStrips(tif) != 1)\n        {\n                TIFFError(\"JBIG\", \"Multistrip images not supported in decoder\");\n                return 0;\n        }\n\n        return 1;\n}\n\nstatic int JBIGDecode(TIFF* tif, tidata_t buffer, tsize_t size, tsample_t s)\n{\n        struct jbg_dec_state decoder;\n        int decodeStatus = 0;\n        unsigned char* pImage = NULL;\n\t(void) size, (void) s;\n\n        if (isFillOrder(tif, tif->tif_dir.td_fillorder))\n        {\n                TIFFReverseBits(tif->tif_rawdata, tif->tif_rawdatasize);\n        }\n\n        jbg_dec_init(&decoder);\n\n#if defined(HAVE_JBG_NEWLEN)\n        jbg_newlen(tif->tif_rawdata, tif->tif_rawdatasize);\n        /*\n         * I do not check the return status of jbg_newlen because even if this\n         * function fails it does not necessarily mean that decoding the image\n         * will fail.  It is generally only needed for received fax images\n         * that do not contain the actual length of the image in the BIE\n         * header.  I do not log when an error occurs because that will cause\n         * problems when converting JBIG encoded TIFF's to \n         * PostScript.  As long as the actual image length is contained in the\n         * BIE header jbg_dec_in should succeed.\n         */\n#endif /* HAVE_JBG_NEWLEN */\n\n        decodeStatus = jbg_dec_in(&decoder, tif->tif_rawdata,\n                                  tif->tif_rawdatasize, NULL);\n        if (JBG_EOK != decodeStatus)\n        {\n\t\t/*\n\t\t * XXX: JBG_EN constant was defined in pre-2.0 releases of the\n\t\t * JBIG-KIT. Since the 2.0 the error reporting functions were\n\t\t * changed. We will handle both cases here.\n\t\t */\n                TIFFError(\"JBIG\", \"Error (%d) decoding: %s\", decodeStatus,\n#if defined(JBG_EN)\n\t\t\t  jbg_strerror(decodeStatus, JBG_EN)\n#else\n                          jbg_strerror(decodeStatus)\n#endif\n\t\t\t );\n                return 0;\n        }\n        \n        pImage = jbg_dec_getimage(&decoder, 0);\n        _TIFFmemcpy(buffer, pImage, jbg_dec_getsize(&decoder));\n        jbg_dec_free(&decoder);\n        return 1;\n}\n\nstatic int JBIGSetupEncode(TIFF* tif)\n{\n        if (TIFFNumberOfStrips(tif) != 1)\n        {\n                TIFFError(\"JBIG\", \"Multistrip images not supported in encoder\");\n                return 0;\n        }\n\n        return 1;\n}\n\nstatic int JBIGCopyEncodedData(TIFF* tif, tidata_t pp, tsize_t cc, tsample_t s)\n{\n        (void) s;\n        while (cc > 0) \n        {\n                tsize_t n = cc;\n\n                if (tif->tif_rawcc + n > tif->tif_rawdatasize)\n                {\n                        n = tif->tif_rawdatasize - tif->tif_rawcc;\n                }\n\n                assert(n > 0);\n                _TIFFmemcpy(tif->tif_rawcp, pp, n);\n                tif->tif_rawcp += n;\n                tif->tif_rawcc += n;\n                pp += n;\n                cc -= n;\n                if (tif->tif_rawcc >= tif->tif_rawdatasize &&\n                    !TIFFFlushData1(tif))\n                {\n                        return (-1);\n                }\n        }\n\n        return (1);\n}\n\nstatic void JBIGOutputBie(unsigned char* buffer, size_t len, void *userData)\n{\n        TIFF* tif = (TIFF*)userData;\n\n        if (isFillOrder(tif, tif->tif_dir.td_fillorder))\n        {\n                TIFFReverseBits(buffer, len);\n        }\n\n        JBIGCopyEncodedData(tif, buffer, len, 0);\n}\n\nstatic int JBIGEncode(TIFF* tif, tidata_t buffer, tsize_t size, tsample_t s)\n{\n        TIFFDirectory* dir = &tif->tif_dir;\n        struct jbg_enc_state encoder;\n\n\t(void) size, (void) s;\n\n        jbg_enc_init(&encoder, \n                     dir->td_imagewidth, \n                     dir->td_imagelength, \n                     1, \n                     &buffer,\n                     JBIGOutputBie,\n                     tif);\n        /* \n         * jbg_enc_out does the \"real\" encoding.  As data is encoded,\n         * JBIGOutputBie is called, which writes the data to the directory.\n         */\n        jbg_enc_out(&encoder);\n        jbg_enc_free(&encoder);\n\n        return 1;\n}\n\nstatic void JBIGCleanup(TIFF* tif)\n{\n        JBIGState *sp = GetJBIGState(tif);\n\n        assert(sp != 0);\n\n        tif->tif_tagmethods.vgetfield = sp->vgetparent;\n        tif->tif_tagmethods.vsetfield = sp->vsetparent;\n\n\t_TIFFfree(tif->tif_data);\n\ttif->tif_data = NULL;\n\n\t_TIFFSetDefaultCompressionState(tif);\n}\n\nstatic void JBIGPrintDir(TIFF* tif, FILE* fd, long flags)\n{\n        JBIGState* codec = GetJBIGState(tif);\n        (void)flags;\n\n        if (TIFFFieldSet(tif, FIELD_RECVPARAMS))\n        {\n                fprintf(fd, \n                        \"  Fax Receive Parameters: %08lx\\n\",\n                        (unsigned long)codec->recvparams);\n        }\n\n        if (TIFFFieldSet(tif, FIELD_SUBADDRESS))\n        {\n                fprintf(fd, \n                        \"  Fax SubAddress: %s\\n\", \n                        codec->subaddress);\n        }\n\n        if (TIFFFieldSet(tif, FIELD_RECVTIME))\n        {\n                fprintf(fd, \n                        \"  Fax Receive Time: %lu secs\\n\",\n                        (unsigned long)codec->recvtime);\n        }\n\n        if (TIFFFieldSet(tif, FIELD_FAXDCS))\n        {\n                fprintf(fd, \n                        \"  Fax DCS: %s\\n\", \n                        codec->faxdcs);\n        }\n}\n\nstatic int JBIGVGetField(TIFF* tif, ttag_t tag, va_list ap)\n{\n        JBIGState* codec = GetJBIGState(tif);\n\n        switch (tag)\n        {\n                case TIFFTAG_FAXRECVPARAMS:\n                        *va_arg(ap, uint32*) = codec->recvparams;\n                        break;\n                \n                case TIFFTAG_FAXSUBADDRESS:\n                        *va_arg(ap, char**) = codec->subaddress;\n                        break;\n\n                case TIFFTAG_FAXRECVTIME:\n                        *va_arg(ap, uint32*) = codec->recvtime;\n                        break;\n\n                case TIFFTAG_FAXDCS:\n                        *va_arg(ap, char**) = codec->faxdcs;\n                        break;\n\n                default:\n                        return (*codec->vgetparent)(tif, tag, ap);\n        }\n\n        return 1;\n}\n\nstatic int JBIGVSetField(TIFF* tif, ttag_t tag, va_list ap)\n{\n        JBIGState* codec = GetJBIGState(tif);\n\n        switch (tag)\n        {\n                case TIFFTAG_FAXRECVPARAMS:\n                        codec->recvparams = va_arg(ap, uint32);\n                        break;\n\n                case TIFFTAG_FAXSUBADDRESS:\n                        _TIFFsetString(&codec->subaddress, va_arg(ap, char*));\n                        break;\n\n                case TIFFTAG_FAXRECVTIME:\n                        codec->recvtime = va_arg(ap, uint32);\n                        break;\n\n                case TIFFTAG_FAXDCS:\n                        _TIFFsetString(&codec->faxdcs, va_arg(ap, char*));\n                        break;\n\n                default:\n                        return (*codec->vsetparent)(tif, tag, ap);\n        }\n\n        TIFFSetFieldBit(tif, _TIFFFieldWithTag(tif, tag)->field_bit);\n        tif->tif_flags |= TIFF_DIRTYDIRECT;\n        return 1;\n}\n\nint TIFFInitJBIG(TIFF* tif, int scheme)\n{\n        JBIGState* codec = NULL;\n\n\tassert(scheme == COMPRESSION_JBIG);\n\n\t/*\n\t * Merge codec-specific tag information.\n\t */\n\tif (!_TIFFMergeFieldInfo(tif, jbigFieldInfo,\n\t\t\t\t TIFFArrayCount(jbigFieldInfo))) {\n\t\tTIFFErrorExt(tif->tif_clientdata, \"TIFFInitJBIG\",\n\t\t\t     \"Merging JBIG codec-specific tags failed\");\n\t\treturn 0;\n\t}\n\n        /* Allocate memory for the JBIGState structure.*/\n        tif->tif_data = (tdata_t)_TIFFmalloc(sizeof(JBIGState));\n        if (tif->tif_data == NULL)\n        {\n                TIFFError(\"TIFFInitJBIG\", \"Not enough memory for JBIGState\");\n                return 0;\n        }\n        _TIFFmemset(tif->tif_data, 0, sizeof(JBIGState));\n        codec = GetJBIGState(tif);\n\n        /* Initialize codec private fields */\n        codec->recvparams = 0;\n        codec->subaddress = NULL;\n        codec->faxdcs = NULL;\n        codec->recvtime = 0;\n\n\t/* \n\t * Override parent get/set field methods.\n\t */\n        codec->vgetparent = tif->tif_tagmethods.vgetfield;\n        codec->vsetparent = tif->tif_tagmethods.vsetfield;\n        tif->tif_tagmethods.vgetfield = JBIGVGetField;\n        tif->tif_tagmethods.vsetfield = JBIGVSetField;\n        tif->tif_tagmethods.printdir = JBIGPrintDir;\n\n        /*\n         * These flags are set so the JBIG Codec can control when to reverse\n         * bits and when not to and to allow the jbig decoder and bit reverser\n         * to write to memory when necessary.\n         */\n        tif->tif_flags |= TIFF_NOBITREV;\n        tif->tif_flags &= ~TIFF_MAPPED;\n\n        /* Setup the function pointers for encode, decode, and cleanup. */\n        tif->tif_setupdecode = JBIGSetupDecode;\n        tif->tif_decodestrip = JBIGDecode;\n\n        tif->tif_setupencode = JBIGSetupEncode;\n        tif->tif_encodestrip = JBIGEncode;\n        \n        tif->tif_cleanup = JBIGCleanup;\n\n        return 1;\n}\n\n#endif /* JBIG_SUPPORT */\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/tif_jpeg.c",
    "content": "/* $Id: tif_jpeg.c,v 1.50.2.4 2009-08-30 16:21:46 bfriesen Exp $ */\n\n/*\n * Copyright (c) 1994-1997 Sam Leffler\n * Copyright (c) 1994-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n#define WIN32_LEAN_AND_MEAN\n#define VC_EXTRALEAN\n\n#include \"tiffiop.h\"\n#ifdef JPEG_SUPPORT\n\n/*\n * TIFF Library\n *\n * JPEG Compression support per TIFF Technical Note #2\n * (*not* per the original TIFF 6.0 spec).\n *\n * This file is simply an interface to the libjpeg library written by\n * the Independent JPEG Group.  You need release 5 or later of the IJG\n * code, which you can find on the Internet at ftp.uu.net:/graphics/jpeg/.\n *\n * Contributed by Tom Lane <tgl@sss.pgh.pa.us>.\n */\n#include <setjmp.h>\n\nint TIFFFillStrip(TIFF*, tstrip_t);\nint TIFFFillTile(TIFF*, ttile_t);\n\n/* We undefine FAR to avoid conflict with JPEG definition */\n\n#ifdef FAR\n#undef FAR\n#endif\n\n/*\n  Libjpeg's jmorecfg.h defines INT16 and INT32, but only if XMD_H is\n  not defined.  Unfortunately, the MinGW and Borland compilers include\n  a typedef for INT32, which causes a conflict.  MSVC does not include\n  a conficting typedef given the headers which are included.\n*/\n#if defined(__BORLANDC__) || defined(__MINGW32__)\n# define XMD_H 1\n#endif\n\n/*\n   The windows RPCNDR.H file defines boolean, but defines it with the\n   unsigned char size.  You should compile JPEG library using appropriate\n   definitions in jconfig.h header, but many users compile library in wrong\n   way. That causes errors of the following type:\n\n   \"JPEGLib: JPEG parameter struct mismatch: library thinks size is 432,\n   caller expects 464\"\n\n   For such users we wil fix the problem here. See install.doc file from\n   the JPEG library distribution for details.\n*/\n\n/* Define \"boolean\" as unsigned char, not int, per Windows custom. */\n#if defined(WIN32) && !defined(__MINGW32__)\n# ifndef __RPCNDR_H__            /* don't conflict if rpcndr.h already read */\n   typedef unsigned char boolean;\n# endif\n# define HAVE_BOOLEAN            /* prevent jmorecfg.h from redefining it */\n#endif\n\n#include \"jpeglib.h\"\n#include \"jerror.h\"\n\n/*\n * We are using width_in_blocks which is supposed to be private to\n * libjpeg. Unfortunately, the libjpeg delivered with Cygwin has\n * renamed this member to width_in_data_units.  Since the header has\n * also renamed a define, use that unique define name in order to\n * detect the problem header and adjust to suit.\n */\n#if defined(D_MAX_DATA_UNITS_IN_MCU)\n#define width_in_blocks width_in_data_units\n#endif\n\n/*\n * On some machines it may be worthwhile to use _setjmp or sigsetjmp\n * in place of plain setjmp.  These macros will make it easier.\n */\n#define SETJMP(jbuf)\t\tsetjmp(jbuf)\n#define LONGJMP(jbuf,code)\tlongjmp(jbuf,code)\n#define JMP_BUF\t\t\tjmp_buf\n\ntypedef struct jpeg_destination_mgr jpeg_destination_mgr;\ntypedef struct jpeg_source_mgr jpeg_source_mgr;\ntypedef\tstruct jpeg_error_mgr jpeg_error_mgr;\n\n/*\n * State block for each open TIFF file using\n * libjpeg to do JPEG compression/decompression.\n *\n * libjpeg's visible state is either a jpeg_compress_struct\n * or jpeg_decompress_struct depending on which way we\n * are going.  comm can be used to refer to the fields\n * which are common to both.\n *\n * NB: cinfo is required to be the first member of JPEGState,\n *     so we can safely cast JPEGState* -> jpeg_xxx_struct*\n *     and vice versa!\n */\ntypedef\tstruct {\n\tunion {\n\t\tstruct jpeg_compress_struct c;\n\t\tstruct jpeg_decompress_struct d;\n\t\tstruct jpeg_common_struct comm;\n\t} cinfo;\t\t\t/* NB: must be first */\n        int             cinfo_initialized;\n\n\tjpeg_error_mgr\terr;\t\t/* libjpeg error manager */\n\tJMP_BUF\t\texit_jmpbuf;\t/* for catching libjpeg failures */\n\t/*\n\t * The following two members could be a union, but\n\t * they're small enough that it's not worth the effort.\n\t */\n\tjpeg_destination_mgr dest;\t/* data dest for compression */\n\tjpeg_source_mgr\tsrc;\t\t/* data source for decompression */\n\t\t\t\t\t/* private state */\n\tTIFF*\t\ttif;\t\t/* back link needed by some code */\n\tuint16\t\tphotometric;\t/* copy of PhotometricInterpretation */\n\tuint16\t\th_sampling;\t/* luminance sampling factors */\n\tuint16\t\tv_sampling;\n\ttsize_t\t\tbytesperline;\t/* decompressed bytes per scanline */\n\t/* pointers to intermediate buffers when processing downsampled data */\n\tJSAMPARRAY\tds_buffer[MAX_COMPONENTS];\n\tint\t\tscancount;\t/* number of \"scanlines\" accumulated */\n\tint\t\tsamplesperclump;\n\n\tTIFFVGetMethod\tvgetparent;\t/* super-class method */\n\tTIFFVSetMethod\tvsetparent;\t/* super-class method */\n\tTIFFPrintMethod printdir;\t/* super-class method */\n\tTIFFStripMethod\tdefsparent;\t/* super-class method */\n\tTIFFTileMethod\tdeftparent;\t/* super-class method */\n\t\t\t\t\t/* pseudo-tag fields */\n\tvoid*\t\tjpegtables;\t/* JPEGTables tag value, or NULL */\n\tuint32\t\tjpegtables_length; /* number of bytes in same */\n\tint\t\tjpegquality;\t/* Compression quality level */\n\tint\t\tjpegcolormode;\t/* Auto RGB<=>YCbCr convert? */\n\tint\t\tjpegtablesmode;\t/* What to put in JPEGTables */\n\n        int             ycbcrsampling_fetched;\n\tuint32\t\trecvparams;\t/* encoded Class 2 session params */\n\tchar*\t\tsubaddress;\t/* subaddress string */\n\tuint32\t\trecvtime;\t/* time spent receiving (secs) */\n\tchar*\t\tfaxdcs;\t\t/* encoded fax parameters (DCS, Table 2/T.30) */\n} JPEGState;\n\n#define\tJState(tif)\t((JPEGState*)(tif)->tif_data)\n\nstatic\tint JPEGDecode(TIFF*, tidata_t, tsize_t, tsample_t);\nstatic\tint JPEGDecodeRaw(TIFF*, tidata_t, tsize_t, tsample_t);\nstatic\tint JPEGEncode(TIFF*, tidata_t, tsize_t, tsample_t);\nstatic\tint JPEGEncodeRaw(TIFF*, tidata_t, tsize_t, tsample_t);\nstatic  int JPEGInitializeLibJPEG( TIFF * tif,\n\t\t\t\t\t\t\t\t   int force_encode, int force_decode );\n\n#define\tFIELD_JPEGTABLES\t(FIELD_CODEC+0)\n#define\tFIELD_RECVPARAMS\t(FIELD_CODEC+1)\n#define\tFIELD_SUBADDRESS\t(FIELD_CODEC+2)\n#define\tFIELD_RECVTIME\t\t(FIELD_CODEC+3)\n#define\tFIELD_FAXDCS\t\t(FIELD_CODEC+4)\n\nstatic const TIFFFieldInfo jpegFieldInfo[] = {\n    { TIFFTAG_JPEGTABLES,\t -3,-3,\tTIFF_UNDEFINED,\tFIELD_JPEGTABLES,\n      FALSE,\tTRUE,\t\"JPEGTables\" },\n    { TIFFTAG_JPEGQUALITY,\t 0, 0,\tTIFF_ANY,\tFIELD_PSEUDO,\n      TRUE,\tFALSE,\t\"\" },\n    { TIFFTAG_JPEGCOLORMODE,\t 0, 0,\tTIFF_ANY,\tFIELD_PSEUDO,\n      FALSE,\tFALSE,\t\"\" },\n    { TIFFTAG_JPEGTABLESMODE,\t 0, 0,\tTIFF_ANY,\tFIELD_PSEUDO,\n      FALSE,\tFALSE,\t\"\" },\n    /* Specific for JPEG in faxes */\n    { TIFFTAG_FAXRECVPARAMS,\t 1, 1, TIFF_LONG,\tFIELD_RECVPARAMS,\n      TRUE,\tFALSE,\t\"FaxRecvParams\" },\n    { TIFFTAG_FAXSUBADDRESS,\t-1,-1, TIFF_ASCII,\tFIELD_SUBADDRESS,\n      TRUE,\tFALSE,\t\"FaxSubAddress\" },\n    { TIFFTAG_FAXRECVTIME,\t 1, 1, TIFF_LONG,\tFIELD_RECVTIME,\n      TRUE,\tFALSE,\t\"FaxRecvTime\" },\n    { TIFFTAG_FAXDCS,\t\t-1, -1, TIFF_ASCII,\tFIELD_FAXDCS,\n\t  TRUE,\tFALSE,\t\"FaxDcs\" },\n};\n#define\tN(a)\t(sizeof (a) / sizeof (a[0]))\n\n/*\n * libjpeg interface layer.\n *\n * We use setjmp/longjmp to return control to libtiff\n * when a fatal error is encountered within the JPEG\n * library.  We also direct libjpeg error and warning\n * messages through the appropriate libtiff handlers.\n */\n\n/*\n * Error handling routines (these replace corresponding\n * IJG routines from jerror.c).  These are used for both\n * compression and decompression.\n */\nstatic void\nTIFFjpeg_error_exit(j_common_ptr cinfo)\n{\n\tJPEGState *sp = (JPEGState *) cinfo;\t/* NB: cinfo assumed first */\n\tchar buffer[JMSG_LENGTH_MAX];\n\n\t(*cinfo->err->format_message) (cinfo, buffer);\n\tTIFFErrorExt(sp->tif->tif_clientdata, \"JPEGLib\", \"%s\", buffer);\t\t/* display the error message */\n\tjpeg_abort(cinfo);\t\t\t/* clean up libjpeg state */\n\tLONGJMP(sp->exit_jmpbuf, 1);\t\t/* return to libtiff caller */\n}\n\n/*\n * This routine is invoked only for warning messages,\n * since error_exit does its own thing and trace_level\n * is never set > 0.\n */\nstatic void\nTIFFjpeg_output_message(j_common_ptr cinfo)\n{\n\tchar buffer[JMSG_LENGTH_MAX];\n\n\t(*cinfo->err->format_message) (cinfo, buffer);\n\tTIFFWarningExt(((JPEGState *) cinfo)->tif->tif_clientdata, \"JPEGLib\", \"%s\", buffer);\n}\n\n/*\n * Interface routines.  This layer of routines exists\n * primarily to limit side-effects from using setjmp.\n * Also, normal/error returns are converted into return\n * values per libtiff practice.\n */\n#define\tCALLJPEG(sp, fail, op)\t(SETJMP((sp)->exit_jmpbuf) ? (fail) : (op))\n#define\tCALLVJPEG(sp, op)\tCALLJPEG(sp, 0, ((op),1))\n\nstatic int\nTIFFjpeg_create_compress(JPEGState* sp)\n{\n\t/* initialize JPEG error handling */\n\tsp->cinfo.c.err = jpeg_std_error(&sp->err);\n\tsp->err.error_exit = TIFFjpeg_error_exit;\n\tsp->err.output_message = TIFFjpeg_output_message;\n\n\treturn CALLVJPEG(sp, jpeg_create_compress(&sp->cinfo.c));\n}\n\nstatic int\nTIFFjpeg_create_decompress(JPEGState* sp)\n{\n\t/* initialize JPEG error handling */\n\tsp->cinfo.d.err = jpeg_std_error(&sp->err);\n\tsp->err.error_exit = TIFFjpeg_error_exit;\n\tsp->err.output_message = TIFFjpeg_output_message;\n\n\treturn CALLVJPEG(sp, jpeg_create_decompress(&sp->cinfo.d));\n}\n\nstatic int\nTIFFjpeg_set_defaults(JPEGState* sp)\n{\n\treturn CALLVJPEG(sp, jpeg_set_defaults(&sp->cinfo.c));\n}\n\nstatic int\nTIFFjpeg_set_colorspace(JPEGState* sp, J_COLOR_SPACE colorspace)\n{\n\treturn CALLVJPEG(sp, jpeg_set_colorspace(&sp->cinfo.c, colorspace));\n}\n\nstatic int\nTIFFjpeg_set_quality(JPEGState* sp, int quality, boolean force_baseline)\n{\n\treturn CALLVJPEG(sp,\n\t    jpeg_set_quality(&sp->cinfo.c, quality, force_baseline));\n}\n\nstatic int\nTIFFjpeg_suppress_tables(JPEGState* sp, boolean suppress)\n{\n\treturn CALLVJPEG(sp, jpeg_suppress_tables(&sp->cinfo.c, suppress));\n}\n\nstatic int\nTIFFjpeg_start_compress(JPEGState* sp, boolean write_all_tables)\n{\n\treturn CALLVJPEG(sp,\n\t    jpeg_start_compress(&sp->cinfo.c, write_all_tables));\n}\n\nstatic int\nTIFFjpeg_write_scanlines(JPEGState* sp, JSAMPARRAY scanlines, int num_lines)\n{\n\treturn CALLJPEG(sp, -1, (int) jpeg_write_scanlines(&sp->cinfo.c,\n\t    scanlines, (JDIMENSION) num_lines));\n}\n\nstatic int\nTIFFjpeg_write_raw_data(JPEGState* sp, JSAMPIMAGE data, int num_lines)\n{\n\treturn CALLJPEG(sp, -1, (int) jpeg_write_raw_data(&sp->cinfo.c,\n\t    data, (JDIMENSION) num_lines));\n}\n\nstatic int\nTIFFjpeg_finish_compress(JPEGState* sp)\n{\n\treturn CALLVJPEG(sp, jpeg_finish_compress(&sp->cinfo.c));\n}\n\nstatic int\nTIFFjpeg_write_tables(JPEGState* sp)\n{\n\treturn CALLVJPEG(sp, jpeg_write_tables(&sp->cinfo.c));\n}\n\nstatic int\nTIFFjpeg_read_header(JPEGState* sp, boolean require_image)\n{\n\treturn CALLJPEG(sp, -1, jpeg_read_header(&sp->cinfo.d, require_image));\n}\n\nstatic int\nTIFFjpeg_start_decompress(JPEGState* sp)\n{\n\treturn CALLVJPEG(sp, jpeg_start_decompress(&sp->cinfo.d));\n}\n\nstatic int\nTIFFjpeg_read_scanlines(JPEGState* sp, JSAMPARRAY scanlines, int max_lines)\n{\n\treturn CALLJPEG(sp, -1, (int) jpeg_read_scanlines(&sp->cinfo.d,\n\t    scanlines, (JDIMENSION) max_lines));\n}\n\nstatic int\nTIFFjpeg_read_raw_data(JPEGState* sp, JSAMPIMAGE data, int max_lines)\n{\n\treturn CALLJPEG(sp, -1, (int) jpeg_read_raw_data(&sp->cinfo.d,\n\t    data, (JDIMENSION) max_lines));\n}\n\nstatic int\nTIFFjpeg_finish_decompress(JPEGState* sp)\n{\n\treturn CALLJPEG(sp, -1, (int) jpeg_finish_decompress(&sp->cinfo.d));\n}\n\nstatic int\nTIFFjpeg_abort(JPEGState* sp)\n{\n\treturn CALLVJPEG(sp, jpeg_abort(&sp->cinfo.comm));\n}\n\nstatic int\nTIFFjpeg_destroy(JPEGState* sp)\n{\n\treturn CALLVJPEG(sp, jpeg_destroy(&sp->cinfo.comm));\n}\n\nstatic JSAMPARRAY\nTIFFjpeg_alloc_sarray(JPEGState* sp, int pool_id,\n\t\t      JDIMENSION samplesperrow, JDIMENSION numrows)\n{\n\treturn CALLJPEG(sp, (JSAMPARRAY) NULL,\n\t    (*sp->cinfo.comm.mem->alloc_sarray)\n\t\t(&sp->cinfo.comm, pool_id, samplesperrow, numrows));\n}\n\n/*\n * JPEG library destination data manager.\n * These routines direct compressed data from libjpeg into the\n * libtiff output buffer.\n */\n\nstatic void\nstd_init_destination(j_compress_ptr cinfo)\n{\n\tJPEGState* sp = (JPEGState*) cinfo;\n\tTIFF* tif = sp->tif;\n\n\tsp->dest.next_output_byte = (JOCTET*) tif->tif_rawdata;\n\tsp->dest.free_in_buffer = (size_t) tif->tif_rawdatasize;\n}\n\nstatic boolean\nstd_empty_output_buffer(j_compress_ptr cinfo)\n{\n\tJPEGState* sp = (JPEGState*) cinfo;\n\tTIFF* tif = sp->tif;\n\n\t/* the entire buffer has been filled */\n\ttif->tif_rawcc = tif->tif_rawdatasize;\n\tTIFFFlushData1(tif);\n\tsp->dest.next_output_byte = (JOCTET*) tif->tif_rawdata;\n\tsp->dest.free_in_buffer = (size_t) tif->tif_rawdatasize;\n\n\treturn (TRUE);\n}\n\nstatic void\nstd_term_destination(j_compress_ptr cinfo)\n{\n\tJPEGState* sp = (JPEGState*) cinfo;\n\tTIFF* tif = sp->tif;\n\n\ttif->tif_rawcp = (tidata_t) sp->dest.next_output_byte;\n\ttif->tif_rawcc =\n\t    tif->tif_rawdatasize - (tsize_t) sp->dest.free_in_buffer;\n\t/* NB: libtiff does the final buffer flush */\n}\n\nstatic void\nTIFFjpeg_data_dest(JPEGState* sp, TIFF* tif)\n{\n\t(void) tif;\n\tsp->cinfo.c.dest = &sp->dest;\n\tsp->dest.init_destination = std_init_destination;\n\tsp->dest.empty_output_buffer = std_empty_output_buffer;\n\tsp->dest.term_destination = std_term_destination;\n}\n\n/*\n * Alternate destination manager for outputting to JPEGTables field.\n */\n\nstatic void\ntables_init_destination(j_compress_ptr cinfo)\n{\n\tJPEGState* sp = (JPEGState*) cinfo;\n\n\t/* while building, jpegtables_length is allocated buffer size */\n\tsp->dest.next_output_byte = (JOCTET*) sp->jpegtables;\n\tsp->dest.free_in_buffer = (size_t) sp->jpegtables_length;\n}\n\nstatic boolean\ntables_empty_output_buffer(j_compress_ptr cinfo)\n{\n\tJPEGState* sp = (JPEGState*) cinfo;\n\tvoid* newbuf;\n\n\t/* the entire buffer has been filled; enlarge it by 1000 bytes */\n\tnewbuf = _TIFFrealloc((tdata_t) sp->jpegtables,\n\t\t\t      (tsize_t) (sp->jpegtables_length + 1000));\n\tif (newbuf == NULL)\n\t\tERREXIT1(cinfo, JERR_OUT_OF_MEMORY, 100);\n\tsp->dest.next_output_byte = (JOCTET*) newbuf + sp->jpegtables_length;\n\tsp->dest.free_in_buffer = (size_t) 1000;\n\tsp->jpegtables = newbuf;\n\tsp->jpegtables_length += 1000;\n\treturn (TRUE);\n}\n\nstatic void\ntables_term_destination(j_compress_ptr cinfo)\n{\n\tJPEGState* sp = (JPEGState*) cinfo;\n\n\t/* set tables length to number of bytes actually emitted */\n\tsp->jpegtables_length -= sp->dest.free_in_buffer;\n}\n\nstatic int\nTIFFjpeg_tables_dest(JPEGState* sp, TIFF* tif)\n{\n\t(void) tif;\n\t/*\n\t * Allocate a working buffer for building tables.\n\t * Initial size is 1000 bytes, which is usually adequate.\n\t */\n\tif (sp->jpegtables)\n\t\t_TIFFfree(sp->jpegtables);\n\tsp->jpegtables_length = 1000;\n\tsp->jpegtables = (void*) _TIFFmalloc((tsize_t) sp->jpegtables_length);\n\tif (sp->jpegtables == NULL) {\n\t\tsp->jpegtables_length = 0;\n\t\tTIFFErrorExt(sp->tif->tif_clientdata, \"TIFFjpeg_tables_dest\", \"No space for JPEGTables\");\n\t\treturn (0);\n\t}\n\tsp->cinfo.c.dest = &sp->dest;\n\tsp->dest.init_destination = tables_init_destination;\n\tsp->dest.empty_output_buffer = tables_empty_output_buffer;\n\tsp->dest.term_destination = tables_term_destination;\n\treturn (1);\n}\n\n/*\n * JPEG library source data manager.\n * These routines supply compressed data to libjpeg.\n */\n\nstatic void\nstd_init_source(j_decompress_ptr cinfo)\n{\n\tJPEGState* sp = (JPEGState*) cinfo;\n\tTIFF* tif = sp->tif;\n\n\tsp->src.next_input_byte = (const JOCTET*) tif->tif_rawdata;\n\tsp->src.bytes_in_buffer = (size_t) tif->tif_rawcc;\n}\n\nstatic boolean\nstd_fill_input_buffer(j_decompress_ptr cinfo)\n{\n\tJPEGState* sp = (JPEGState* ) cinfo;\n\tstatic const JOCTET dummy_EOI[2] = { 0xFF, JPEG_EOI };\n\n\t/*\n\t * Should never get here since entire strip/tile is\n\t * read into memory before the decompressor is called,\n\t * and thus was supplied by init_source.\n\t */\n\tWARNMS(cinfo, JWRN_JPEG_EOF);\n\t/* insert a fake EOI marker */\n\tsp->src.next_input_byte = dummy_EOI;\n\tsp->src.bytes_in_buffer = 2;\n\treturn (TRUE);\n}\n\nstatic void\nstd_skip_input_data(j_decompress_ptr cinfo, long num_bytes)\n{\n\tJPEGState* sp = (JPEGState*) cinfo;\n\n\tif (num_bytes > 0) {\n\t\tif (num_bytes > (long) sp->src.bytes_in_buffer) {\n\t\t\t/* oops, buffer overrun */\n\t\t\t(void) std_fill_input_buffer(cinfo);\n\t\t} else {\n\t\t\tsp->src.next_input_byte += (size_t) num_bytes;\n\t\t\tsp->src.bytes_in_buffer -= (size_t) num_bytes;\n\t\t}\n\t}\n}\n\nstatic void\nstd_term_source(j_decompress_ptr cinfo)\n{\n\t/* No work necessary here */\n\t/* Or must we update tif->tif_rawcp, tif->tif_rawcc ??? */\n\t/* (if so, need empty tables_term_source!) */\n\t(void) cinfo;\n}\n\nstatic void\nTIFFjpeg_data_src(JPEGState* sp, TIFF* tif)\n{\n\t(void) tif;\n\tsp->cinfo.d.src = &sp->src;\n\tsp->src.init_source = std_init_source;\n\tsp->src.fill_input_buffer = std_fill_input_buffer;\n\tsp->src.skip_input_data = std_skip_input_data;\n\tsp->src.resync_to_restart = jpeg_resync_to_restart;\n\tsp->src.term_source = std_term_source;\n\tsp->src.bytes_in_buffer = 0;\t\t/* for safety */\n\tsp->src.next_input_byte = NULL;\n}\n\n/*\n * Alternate source manager for reading from JPEGTables.\n * We can share all the code except for the init routine.\n */\n\nstatic void\ntables_init_source(j_decompress_ptr cinfo)\n{\n\tJPEGState* sp = (JPEGState*) cinfo;\n\n\tsp->src.next_input_byte = (const JOCTET*) sp->jpegtables;\n\tsp->src.bytes_in_buffer = (size_t) sp->jpegtables_length;\n}\n\nstatic void\nTIFFjpeg_tables_src(JPEGState* sp, TIFF* tif)\n{\n\tTIFFjpeg_data_src(sp, tif);\n\tsp->src.init_source = tables_init_source;\n}\n\n/*\n * Allocate downsampled-data buffers needed for downsampled I/O.\n * We use values computed in jpeg_start_compress or jpeg_start_decompress.\n * We use libjpeg's allocator so that buffers will be released automatically\n * when done with strip/tile.\n * This is also a handy place to compute samplesperclump, bytesperline.\n */\nstatic int\nalloc_downsampled_buffers(TIFF* tif, jpeg_component_info* comp_info,\n\t\t\t  int num_components)\n{\n\tJPEGState* sp = JState(tif);\n\tint ci;\n\tjpeg_component_info* compptr;\n\tJSAMPARRAY buf;\n\tint samples_per_clump = 0;\n\n\tfor (ci = 0, compptr = comp_info; ci < num_components;\n\t     ci++, compptr++) {\n\t\tsamples_per_clump += compptr->h_samp_factor *\n\t\t\tcompptr->v_samp_factor;\n\t\tbuf = TIFFjpeg_alloc_sarray(sp, JPOOL_IMAGE,\n\t\t\t\tcompptr->width_in_blocks * DCTSIZE,\n\t\t\t\t(JDIMENSION) (compptr->v_samp_factor*DCTSIZE));\n\t\tif (buf == NULL)\n\t\t\treturn (0);\n\t\tsp->ds_buffer[ci] = buf;\n\t}\n\tsp->samplesperclump = samples_per_clump;\n\treturn (1);\n}\n\n\n/*\n * JPEG Decoding.\n */\n\nstatic int\nJPEGSetupDecode(TIFF* tif)\n{\n\tJPEGState* sp = JState(tif);\n\tTIFFDirectory *td = &tif->tif_dir;\n\n        JPEGInitializeLibJPEG( tif, 0, 1 );\n\n\tassert(sp != NULL);\n\tassert(sp->cinfo.comm.is_decompressor);\n\n\t/* Read JPEGTables if it is present */\n\tif (TIFFFieldSet(tif,FIELD_JPEGTABLES)) {\n\t\tTIFFjpeg_tables_src(sp, tif);\n\t\tif(TIFFjpeg_read_header(sp,FALSE) != JPEG_HEADER_TABLES_ONLY) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, \"JPEGSetupDecode\", \"Bogus JPEGTables field\");\n\t\t\treturn (0);\n\t\t}\n\t}\n\n\t/* Grab parameters that are same for all strips/tiles */\n\tsp->photometric = td->td_photometric;\n\tswitch (sp->photometric) {\n\tcase PHOTOMETRIC_YCBCR:\n\t\tsp->h_sampling = td->td_ycbcrsubsampling[0];\n\t\tsp->v_sampling = td->td_ycbcrsubsampling[1];\n\t\tbreak;\n\tdefault:\n\t\t/* TIFF 6.0 forbids subsampling of all other color spaces */\n\t\tsp->h_sampling = 1;\n\t\tsp->v_sampling = 1;\n\t\tbreak;\n\t}\n\n\t/* Set up for reading normal data */\n\tTIFFjpeg_data_src(sp, tif);\n\ttif->tif_postdecode = _TIFFNoPostDecode; /* override byte swapping */\n\treturn (1);\n}\n\n/*\n * Set up for decoding a strip or tile.\n */\nstatic int\nJPEGPreDecode(TIFF* tif, tsample_t s)\n{\n\tJPEGState *sp = JState(tif);\n\tTIFFDirectory *td = &tif->tif_dir;\n\tstatic const char module[] = \"JPEGPreDecode\";\n\tuint32 segment_width, segment_height;\n\tint downsampled_output;\n\tint ci;\n\n\tassert(sp != NULL);\n\tassert(sp->cinfo.comm.is_decompressor);\n\t/*\n\t * Reset decoder state from any previous strip/tile,\n\t * in case application didn't read the whole strip.\n\t */\n\tif (!TIFFjpeg_abort(sp))\n\t\treturn (0);\n\t/*\n\t * Read the header for this strip/tile.\n\t */\n\tif (TIFFjpeg_read_header(sp, TRUE) != JPEG_HEADER_OK)\n\t\treturn (0);\n\t/*\n\t * Check image parameters and set decompression parameters.\n\t */\n\tsegment_width = td->td_imagewidth;\n\tsegment_height = td->td_imagelength - tif->tif_row;\n\tif (isTiled(tif)) {\n                segment_width = td->td_tilewidth;\n                segment_height = td->td_tilelength;\n\t\tsp->bytesperline = TIFFTileRowSize(tif);\n\t} else {\n\t\tif (segment_height > td->td_rowsperstrip)\n\t\t\tsegment_height = td->td_rowsperstrip;\n\t\tsp->bytesperline = TIFFOldScanlineSize(tif);\n\t}\n\tif (td->td_planarconfig == PLANARCONFIG_SEPARATE && s > 0) {\n\t\t/*\n\t\t * For PC 2, scale down the expected strip/tile size\n\t\t * to match a downsampled component\n\t\t */\n\t\tsegment_width = TIFFhowmany(segment_width, sp->h_sampling);\n\t\tsegment_height = TIFFhowmany(segment_height, sp->v_sampling);\n\t}\n\tif (sp->cinfo.d.image_width < segment_width ||\n\t    sp->cinfo.d.image_height < segment_height) {\n\t\tTIFFWarningExt(tif->tif_clientdata, module,\n\t\t\t       \"Improper JPEG strip/tile size, \"\n\t\t\t       \"expected %dx%d, got %dx%d\",\n\t\t\t       segment_width, segment_height,\n\t\t\t       sp->cinfo.d.image_width,\n\t\t\t       sp->cinfo.d.image_height);\n\t} \n\tif (sp->cinfo.d.image_width > segment_width ||\n\t    sp->cinfo.d.image_height > segment_height) {\n\t\t/*\n\t\t * This case could be dangerous, if the strip or tile size has\n\t\t * been reported as less than the amount of data jpeg will\n\t\t * return, some potential security issues arise. Catch this\n\t\t * case and error out.\n\t\t */\n\t\tTIFFErrorExt(tif->tif_clientdata, module,\n\t\t\t     \"JPEG strip/tile size exceeds expected dimensions,\"\n\t\t\t     \" expected %dx%d, got %dx%d\",\n\t\t\t     segment_width, segment_height,\n\t\t\t     sp->cinfo.d.image_width, sp->cinfo.d.image_height);\n\t\treturn (0);\n\t}\n\tif (sp->cinfo.d.num_components !=\n\t    (td->td_planarconfig == PLANARCONFIG_CONTIG ?\n\t     td->td_samplesperpixel : 1)) {\n\t\tTIFFErrorExt(tif->tif_clientdata, module, \"Improper JPEG component count\");\n\t\treturn (0);\n\t}\n#ifdef JPEG_LIB_MK1\n\tif (12 != td->td_bitspersample && 8 != td->td_bitspersample) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, module, \"Improper JPEG data precision\");\n            return (0);\n\t}\n        sp->cinfo.d.data_precision = td->td_bitspersample;\n        sp->cinfo.d.bits_in_jsample = td->td_bitspersample;\n#else\n\tif (sp->cinfo.d.data_precision != td->td_bitspersample) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, module, \"Improper JPEG data precision\");\n            return (0);\n\t}\n#endif\n\tif (td->td_planarconfig == PLANARCONFIG_CONTIG) {\n\t\t/* Component 0 should have expected sampling factors */\n\t\tif (sp->cinfo.d.comp_info[0].h_samp_factor != sp->h_sampling ||\n\t\t    sp->cinfo.d.comp_info[0].v_samp_factor != sp->v_sampling) {\n\t\t\t\tTIFFWarningExt(tif->tif_clientdata, module,\n                                    \"Improper JPEG sampling factors %d,%d\\n\"\n                                    \"Apparently should be %d,%d.\",\n                                    sp->cinfo.d.comp_info[0].h_samp_factor,\n                                    sp->cinfo.d.comp_info[0].v_samp_factor,\n                                    sp->h_sampling, sp->v_sampling);\n\n\t\t\t\t/*\n\t\t\t\t * There are potential security issues here\n\t\t\t\t * for decoders that have already allocated\n\t\t\t\t * buffers based on the expected sampling\n\t\t\t\t * factors. Lets check the sampling factors\n\t\t\t\t * dont exceed what we were expecting.\n\t\t\t\t */\n\t\t\t\tif (sp->cinfo.d.comp_info[0].h_samp_factor\n\t\t\t\t\t> sp->h_sampling\n\t\t\t\t    || sp->cinfo.d.comp_info[0].v_samp_factor\n\t\t\t\t\t> sp->v_sampling) {\n\t\t\t\t\tTIFFErrorExt(tif->tif_clientdata,\n\t\t\t\t\t\t     module,\n\t\t\t\t\t\"Cannot honour JPEG sampling factors\"\n\t\t\t\t\t\" that exceed those specified.\");\n\t\t\t\t\treturn (0);\n\t\t\t\t}\n\n\t\t\t    /*\n\t\t\t     * XXX: Files written by the Intergraph software\n\t\t\t     * has different sampling factors stored in the\n\t\t\t     * TIFF tags and in the JPEG structures. We will\n\t\t\t     * try to deduce Intergraph files by the presense\n\t\t\t     * of the tag 33918.\n\t\t\t     */\n\t\t\t    if (!_TIFFFindFieldInfo(tif, 33918, TIFF_ANY)) {\n\t\t\t\t\tTIFFWarningExt(tif->tif_clientdata, module,\n\t\t\t\t\t\"Decompressor will try reading with \"\n\t\t\t\t\t\"sampling %d,%d.\",\n\t\t\t\t\tsp->cinfo.d.comp_info[0].h_samp_factor,\n\t\t\t\t\tsp->cinfo.d.comp_info[0].v_samp_factor);\n\n\t\t\t\t    sp->h_sampling = (uint16)\n\t\t\t\t\tsp->cinfo.d.comp_info[0].h_samp_factor;\n\t\t\t\t    sp->v_sampling = (uint16)\n\t\t\t\t\tsp->cinfo.d.comp_info[0].v_samp_factor;\n\t\t\t    }\n\t\t}\n\t\t/* Rest should have sampling factors 1,1 */\n\t\tfor (ci = 1; ci < sp->cinfo.d.num_components; ci++) {\n\t\t\tif (sp->cinfo.d.comp_info[ci].h_samp_factor != 1 ||\n\t\t\t    sp->cinfo.d.comp_info[ci].v_samp_factor != 1) {\n\t\t\t\tTIFFErrorExt(tif->tif_clientdata, module, \"Improper JPEG sampling factors\");\n\t\t\t\treturn (0);\n\t\t\t}\n\t\t}\n\t} else {\n\t\t/* PC 2's single component should have sampling factors 1,1 */\n\t\tif (sp->cinfo.d.comp_info[0].h_samp_factor != 1 ||\n\t\t    sp->cinfo.d.comp_info[0].v_samp_factor != 1) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, module, \"Improper JPEG sampling factors\");\n\t\t\treturn (0);\n\t\t}\n\t}\n\tdownsampled_output = FALSE;\n\tif (td->td_planarconfig == PLANARCONFIG_CONTIG &&\n\t    sp->photometric == PHOTOMETRIC_YCBCR &&\n\t    sp->jpegcolormode == JPEGCOLORMODE_RGB) {\n\t/* Convert YCbCr to RGB */\n\t\tsp->cinfo.d.jpeg_color_space = JCS_YCbCr;\n\t\tsp->cinfo.d.out_color_space = JCS_RGB;\n\t} else {\n\t\t\t/* Suppress colorspace handling */\n\t\tsp->cinfo.d.jpeg_color_space = JCS_UNKNOWN;\n\t\tsp->cinfo.d.out_color_space = JCS_UNKNOWN;\n\t\tif (td->td_planarconfig == PLANARCONFIG_CONTIG &&\n\t\t    (sp->h_sampling != 1 || sp->v_sampling != 1))\n\t\t\tdownsampled_output = TRUE;\n\t\t/* XXX what about up-sampling? */\n\t}\n\tif (downsampled_output) {\n\t\t/* Need to use raw-data interface to libjpeg */\n\t\tsp->cinfo.d.raw_data_out = TRUE;\n\t\ttif->tif_decoderow = JPEGDecodeRaw;\n\t\ttif->tif_decodestrip = JPEGDecodeRaw;\n\t\ttif->tif_decodetile = JPEGDecodeRaw;\n\t} else {\n\t\t/* Use normal interface to libjpeg */\n\t\tsp->cinfo.d.raw_data_out = FALSE;\n\t\ttif->tif_decoderow = JPEGDecode;\n\t\ttif->tif_decodestrip = JPEGDecode;\n\t\ttif->tif_decodetile = JPEGDecode;\n\t}\n\t/* Start JPEG decompressor */\n\tif (!TIFFjpeg_start_decompress(sp))\n\t\treturn (0);\n\t/* Allocate downsampled-data buffers if needed */\n\tif (downsampled_output) {\n\t\tif (!alloc_downsampled_buffers(tif, sp->cinfo.d.comp_info,\n\t\t\t\t\t       sp->cinfo.d.num_components))\n\t\t\treturn (0);\n\t\tsp->scancount = DCTSIZE;\t/* mark buffer empty */\n\t}\n\treturn (1);\n}\n\n/*\n * Decode a chunk of pixels.\n * \"Standard\" case: returned data is not downsampled.\n */\n/*ARGSUSED*/ static int\nJPEGDecode(TIFF* tif, tidata_t buf, tsize_t cc, tsample_t s)\n{\n    JPEGState *sp = JState(tif);\n    tsize_t nrows;\n    (void) s;\n\n    nrows = cc / sp->bytesperline;\n    if (cc % sp->bytesperline)\n\t\tTIFFWarningExt(tif->tif_clientdata, tif->tif_name, \"fractional scanline not read\");\n\n    if( nrows > (int) sp->cinfo.d.image_height )\n        nrows = sp->cinfo.d.image_height;\n\n    /* data is expected to be read in multiples of a scanline */\n    if (nrows)\n    {\n        JSAMPROW line_work_buf = NULL;\n\n        /*\n        ** For 6B, only use temporary buffer for 12 bit imagery. \n        ** For Mk1 always use it. \n        */\n#if !defined(JPEG_LIB_MK1)        \n        if( sp->cinfo.d.data_precision == 12 )\n#endif\n        {\n            line_work_buf = (JSAMPROW) \n                _TIFFmalloc(sizeof(short) * sp->cinfo.d.output_width \n                            * sp->cinfo.d.num_components );\n        }\n\n        do {\n            if( line_work_buf != NULL )\n            {\n                /* \n                ** In the MK1 case, we aways read into a 16bit buffer, and then\n                ** pack down to 12bit or 8bit.  In 6B case we only read into 16\n                ** bit buffer for 12bit data, which we need to repack. \n                */\n                if (TIFFjpeg_read_scanlines(sp, &line_work_buf, 1) != 1)\n                    return (0);\n\n                if( sp->cinfo.d.data_precision == 12 )\n                {\n                    int value_pairs = (sp->cinfo.d.output_width \n                                       * sp->cinfo.d.num_components) / 2;\n                    int iPair;\n\n                    for( iPair = 0; iPair < value_pairs; iPair++ )\n                    {\n                        unsigned char *out_ptr = \n                            ((unsigned char *) buf) + iPair * 3;\n                        JSAMPLE *in_ptr = line_work_buf + iPair * 2;\n\n                        out_ptr[0] = (in_ptr[0] & 0xff0) >> 4;\n                        out_ptr[1] = ((in_ptr[0] & 0xf) << 4)\n                            | ((in_ptr[1] & 0xf00) >> 8);\n                        out_ptr[2] = ((in_ptr[1] & 0xff) >> 0);\n                    }\n                }\n                else if( sp->cinfo.d.data_precision == 8 )\n                {\n                    int value_count = (sp->cinfo.d.output_width \n                                       * sp->cinfo.d.num_components);\n                    int iValue;\n\n                    for( iValue = 0; iValue < value_count; iValue++ )\n                    {\n                        ((unsigned char *) buf)[iValue] = \n                            line_work_buf[iValue] & 0xff;\n                    }\n                }\n            }\n            else\n            {\n                /*\n                ** In the libjpeg6b 8bit case.  We read directly into the \n                ** TIFF buffer.\n                */\n                JSAMPROW bufptr = (JSAMPROW)buf;\n  \n                if (TIFFjpeg_read_scanlines(sp, &bufptr, 1) != 1)\n                    return (0);\n            }\n\n            ++tif->tif_row;\n            buf += sp->bytesperline;\n            cc -= sp->bytesperline;\n        } while (--nrows > 0);\n\n        if( line_work_buf != NULL )\n            _TIFFfree( line_work_buf );\n    }\n\n    /* Close down the decompressor if we've finished the strip or tile. */\n    return sp->cinfo.d.output_scanline < sp->cinfo.d.output_height\n        || TIFFjpeg_finish_decompress(sp);\n}\n\n/*\n * Decode a chunk of pixels.\n * Returned data is downsampled per sampling factors.\n */\n/*ARGSUSED*/ static int\nJPEGDecodeRaw(TIFF* tif, tidata_t buf, tsize_t cc, tsample_t s)\n{\n\tJPEGState *sp = JState(tif);\n\ttsize_t nrows;\n\t(void) s;\n\n\t/* data is expected to be read in multiples of a scanline */\n\tif ( (nrows = sp->cinfo.d.image_height) ) {\n\t\t/* Cb,Cr both have sampling factors 1, so this is correct */\n\t\tJDIMENSION clumps_per_line = sp->cinfo.d.comp_info[1].downsampled_width;            \n\t\tint samples_per_clump = sp->samplesperclump;\n\n#ifdef JPEG_LIB_MK1\n\t\tunsigned short* tmpbuf = _TIFFmalloc(sizeof(unsigned short) *\n\t\t    sp->cinfo.d.output_width *\n\t\t    sp->cinfo.d.num_components);\n#endif\n\n\t\tdo {\n\t\t\tjpeg_component_info *compptr;\n\t\t\tint ci, clumpoffset;\n\n\t\t\t/* Reload downsampled-data buffer if needed */\n\t\t\tif (sp->scancount >= DCTSIZE) {\n\t\t\t\tint n = sp->cinfo.d.max_v_samp_factor * DCTSIZE;\n\t\t\t\tif (TIFFjpeg_read_raw_data(sp, sp->ds_buffer, n) != n)\n\t\t\t\t\treturn (0);\n\t\t\t\tsp->scancount = 0;\n\t\t\t}\n\t\t\t/*\n\t\t\t * Fastest way to unseparate data is to make one pass\n\t\t\t * over the scanline for each row of each component.\n\t\t\t */\n\t\t\tclumpoffset = 0;    /* first sample in clump */\n\t\t\tfor (ci = 0, compptr = sp->cinfo.d.comp_info;\n\t\t\t    ci < sp->cinfo.d.num_components;\n\t\t\t    ci++, compptr++) {\n\t\t\t\tint hsamp = compptr->h_samp_factor;\n\t\t\t\tint vsamp = compptr->v_samp_factor;\n\t\t\t\tint ypos;\n\n\t\t\t\tfor (ypos = 0; ypos < vsamp; ypos++) {\n\t\t\t\t\tJSAMPLE *inptr = sp->ds_buffer[ci][sp->scancount*vsamp + ypos];\n#ifdef JPEG_LIB_MK1\n\t\t\t\t\tJSAMPLE *outptr = (JSAMPLE*)tmpbuf + clumpoffset;\n#else\n\t\t\t\t\tJSAMPLE *outptr = (JSAMPLE*)buf + clumpoffset;\n#endif\n\t\t\t\t\tJDIMENSION nclump;\n\n\t\t\t\t\tif (hsamp == 1) {\n\t\t\t\t\t\t/* fast path for at least Cb and Cr */\n\t\t\t\t\t\tfor (nclump = clumps_per_line; nclump-- > 0; ) {\n\t\t\t\t\t\t\toutptr[0] = *inptr++;\n\t\t\t\t\t\t\toutptr += samples_per_clump;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tint xpos;\n\n\t\t\t/* general case */\n\t\t\t\t\t\tfor (nclump = clumps_per_line; nclump-- > 0; ) {\n\t\t\t\t\t\t\tfor (xpos = 0; xpos < hsamp; xpos++)\n\t\t\t\t\t\t\t\toutptr[xpos] = *inptr++;\n\t\t\t\t\t\t\toutptr += samples_per_clump;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tclumpoffset += hsamp;\n\t\t\t\t}\n\t\t\t}\n\n#ifdef JPEG_LIB_MK1\n\t\t\t{\n\t\t\t\tif (sp->cinfo.d.data_precision == 8)\n\t\t\t\t{\n\t\t\t\t\tint i=0;\n\t\t\t\t\tint len = sp->cinfo.d.output_width * sp->cinfo.d.num_components;\n\t\t\t\t\tfor (i=0; i<len; i++)\n\t\t\t\t\t{\n\t\t\t\t\t\t((unsigned char*)buf)[i] = tmpbuf[i] & 0xff;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{         // 12-bit\n\t\t\t\t\tint value_pairs = (sp->cinfo.d.output_width\n\t\t\t\t\t    * sp->cinfo.d.num_components) / 2;\n\t\t\t\t\tint iPair;\n\t\t\t\t\tfor( iPair = 0; iPair < value_pairs; iPair++ )\n\t\t\t\t\t{\n\t\t\t\t\t\tunsigned char *out_ptr = ((unsigned char *) buf) + iPair * 3;\n\t\t\t\t\t\tJSAMPLE *in_ptr = tmpbuf + iPair * 2;\n\t\t\t\t\t\tout_ptr[0] = (in_ptr[0] & 0xff0) >> 4;\n\t\t\t\t\t\tout_ptr[1] = ((in_ptr[0] & 0xf) << 4)\n\t\t\t\t\t\t    | ((in_ptr[1] & 0xf00) >> 8);\n\t\t\t\t\t\tout_ptr[2] = ((in_ptr[1] & 0xff) >> 0);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n#endif\n\n\t\t\tsp->scancount ++;\n\t\t\ttif->tif_row += sp->v_sampling;\n\t\t\t/* increment/decrement of buf and cc is still incorrect, but should not matter\n\t\t\t * TODO: resolve this */\n\t\t\tbuf += sp->bytesperline;\n\t\t\tcc -= sp->bytesperline;\n\t\t\tnrows -= sp->v_sampling;\n\t\t} while (nrows > 0);\n\n#ifdef JPEG_LIB_MK1\n\t\t_TIFFfree(tmpbuf);\n#endif\n\n\t}\n\n\t/* Close down the decompressor if done. */\n\treturn sp->cinfo.d.output_scanline < sp->cinfo.d.output_height\n\t    || TIFFjpeg_finish_decompress(sp);\n}\n\n\n/*\n * JPEG Encoding.\n */\n\nstatic void\nunsuppress_quant_table (JPEGState* sp, int tblno)\n{\n\tJQUANT_TBL* qtbl;\n\n\tif ((qtbl = sp->cinfo.c.quant_tbl_ptrs[tblno]) != NULL)\n\t\tqtbl->sent_table = FALSE;\n}\n\nstatic void\nunsuppress_huff_table (JPEGState* sp, int tblno)\n{\n\tJHUFF_TBL* htbl;\n\n\tif ((htbl = sp->cinfo.c.dc_huff_tbl_ptrs[tblno]) != NULL)\n\t\thtbl->sent_table = FALSE;\n\tif ((htbl = sp->cinfo.c.ac_huff_tbl_ptrs[tblno]) != NULL)\n\t\thtbl->sent_table = FALSE;\n}\n\nstatic int\nprepare_JPEGTables(TIFF* tif)\n{\n\tJPEGState* sp = JState(tif);\n\n        JPEGInitializeLibJPEG( tif, 0, 0 );\n\n\t/* Initialize quant tables for current quality setting */\n\tif (!TIFFjpeg_set_quality(sp, sp->jpegquality, FALSE))\n\t\treturn (0);\n\t/* Mark only the tables we want for output */\n\t/* NB: chrominance tables are currently used only with YCbCr */\n\tif (!TIFFjpeg_suppress_tables(sp, TRUE))\n\t\treturn (0);\n\tif (sp->jpegtablesmode & JPEGTABLESMODE_QUANT) {\n\t\tunsuppress_quant_table(sp, 0);\n\t\tif (sp->photometric == PHOTOMETRIC_YCBCR)\n\t\t\tunsuppress_quant_table(sp, 1);\n\t}\n\tif (sp->jpegtablesmode & JPEGTABLESMODE_HUFF) {\n\t\tunsuppress_huff_table(sp, 0);\n\t\tif (sp->photometric == PHOTOMETRIC_YCBCR)\n\t\t\tunsuppress_huff_table(sp, 1);\n\t}\n\t/* Direct libjpeg output into jpegtables */\n\tif (!TIFFjpeg_tables_dest(sp, tif))\n\t\treturn (0);\n\t/* Emit tables-only datastream */\n\tif (!TIFFjpeg_write_tables(sp))\n\t\treturn (0);\n\n\treturn (1);\n}\n\nstatic int\nJPEGSetupEncode(TIFF* tif)\n{\n\tJPEGState* sp = JState(tif);\n\tTIFFDirectory *td = &tif->tif_dir;\n\tstatic const char module[] = \"JPEGSetupEncode\";\n\n        JPEGInitializeLibJPEG( tif, 1, 0 );\n\n\tassert(sp != NULL);\n\tassert(!sp->cinfo.comm.is_decompressor);\n\n\t/*\n\t * Initialize all JPEG parameters to default values.\n\t * Note that jpeg_set_defaults needs legal values for\n\t * in_color_space and input_components.\n\t */\n\tsp->cinfo.c.in_color_space = JCS_UNKNOWN;\n\tsp->cinfo.c.input_components = 1;\n\tif (!TIFFjpeg_set_defaults(sp))\n\t\treturn (0);\n\t/* Set per-file parameters */\n\tsp->photometric = td->td_photometric;\n\tswitch (sp->photometric) {\n\tcase PHOTOMETRIC_YCBCR:\n\t\tsp->h_sampling = td->td_ycbcrsubsampling[0];\n\t\tsp->v_sampling = td->td_ycbcrsubsampling[1];\n\t\t/*\n\t\t * A ReferenceBlackWhite field *must* be present since the\n\t\t * default value is inappropriate for YCbCr.  Fill in the\n\t\t * proper value if application didn't set it.\n\t\t */\n\t\t{\n\t\t\tfloat *ref;\n\t\t\tif (!TIFFGetField(tif, TIFFTAG_REFERENCEBLACKWHITE,\n\t\t\t\t\t  &ref)) {\n\t\t\t\tfloat refbw[6];\n\t\t\t\tlong top = 1L << td->td_bitspersample;\n\t\t\t\trefbw[0] = 0;\n\t\t\t\trefbw[1] = (float)(top-1L);\n\t\t\t\trefbw[2] = (float)(top>>1);\n\t\t\t\trefbw[3] = refbw[1];\n\t\t\t\trefbw[4] = refbw[2];\n\t\t\t\trefbw[5] = refbw[1];\n\t\t\t\tTIFFSetField(tif, TIFFTAG_REFERENCEBLACKWHITE,\n\t\t\t\t\t     refbw);\n\t\t\t}\n\t\t}\n\t\tbreak;\n\tcase PHOTOMETRIC_PALETTE:\t\t/* disallowed by Tech Note */\n\tcase PHOTOMETRIC_MASK:\n\t\tTIFFErrorExt(tif->tif_clientdata, module,\n\t\t\t  \"PhotometricInterpretation %d not allowed for JPEG\",\n\t\t\t  (int) sp->photometric);\n\t\treturn (0);\n\tdefault:\n\t\t/* TIFF 6.0 forbids subsampling of all other color spaces */\n\t\tsp->h_sampling = 1;\n\t\tsp->v_sampling = 1;\n\t\tbreak;\n\t}\n\n\t/* Verify miscellaneous parameters */\n\n\t/*\n\t * This would need work if libtiff ever supports different\n\t * depths for different components, or if libjpeg ever supports\n\t * run-time selection of depth.  Neither is imminent.\n\t */\n#ifdef JPEG_LIB_MK1\n        /* BITS_IN_JSAMPLE now permits 8 and 12 --- dgilbert */\n\tif (td->td_bitspersample != 8 && td->td_bitspersample != 12) \n#else\n\tif (td->td_bitspersample != BITS_IN_JSAMPLE )\n#endif\n\t{\n\t\tTIFFErrorExt(tif->tif_clientdata, module, \"BitsPerSample %d not allowed for JPEG\",\n\t\t\t  (int) td->td_bitspersample);\n\t\treturn (0);\n\t}\n\tsp->cinfo.c.data_precision = td->td_bitspersample;\n#ifdef JPEG_LIB_MK1\n        sp->cinfo.c.bits_in_jsample = td->td_bitspersample;\n#endif\n\tif (isTiled(tif)) {\n\t\tif ((td->td_tilelength % (sp->v_sampling * DCTSIZE)) != 0) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, module,\n\t\t\t\t  \"JPEG tile height must be multiple of %d\",\n\t\t\t\t  sp->v_sampling * DCTSIZE);\n\t\t\treturn (0);\n\t\t}\n\t\tif ((td->td_tilewidth % (sp->h_sampling * DCTSIZE)) != 0) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, module,\n\t\t\t\t  \"JPEG tile width must be multiple of %d\",\n\t\t\t\t  sp->h_sampling * DCTSIZE);\n\t\t\treturn (0);\n\t\t}\n\t} else {\n\t\tif (td->td_rowsperstrip < td->td_imagelength &&\n\t\t    (td->td_rowsperstrip % (sp->v_sampling * DCTSIZE)) != 0) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, module,\n\t\t\t\t  \"RowsPerStrip must be multiple of %d for JPEG\",\n\t\t\t\t  sp->v_sampling * DCTSIZE);\n\t\t\treturn (0);\n\t\t}\n\t}\n\n\t/* Create a JPEGTables field if appropriate */\n\tif (sp->jpegtablesmode & (JPEGTABLESMODE_QUANT|JPEGTABLESMODE_HUFF)) {\n\t\tif (!prepare_JPEGTables(tif))\n\t\t\treturn (0);\n\t\t/* Mark the field present */\n\t\t/* Can't use TIFFSetField since BEENWRITING is already set! */\n\t\tTIFFSetFieldBit(tif, FIELD_JPEGTABLES);\n\t\ttif->tif_flags |= TIFF_DIRTYDIRECT;\n\t} else {\n\t\t/* We do not support application-supplied JPEGTables, */\n\t\t/* so mark the field not present */\n\t\tTIFFClrFieldBit(tif, FIELD_JPEGTABLES);\n\t}\n\n\t/* Direct libjpeg output to libtiff's output buffer */\n\tTIFFjpeg_data_dest(sp, tif);\n\n\treturn (1);\n}\n\n/*\n * Set encoding state at the start of a strip or tile.\n */\nstatic int\nJPEGPreEncode(TIFF* tif, tsample_t s)\n{\n\tJPEGState *sp = JState(tif);\n\tTIFFDirectory *td = &tif->tif_dir;\n\tstatic const char module[] = \"JPEGPreEncode\";\n\tuint32 segment_width, segment_height;\n\tint downsampled_input;\n\n\tassert(sp != NULL);\n\tassert(!sp->cinfo.comm.is_decompressor);\n\t/*\n\t * Set encoding parameters for this strip/tile.\n\t */\n\tif (isTiled(tif)) {\n\t\tsegment_width = td->td_tilewidth;\n\t\tsegment_height = td->td_tilelength;\n\t\tsp->bytesperline = TIFFTileRowSize(tif);\n\t} else {\n\t\tsegment_width = td->td_imagewidth;\n\t\tsegment_height = td->td_imagelength - tif->tif_row;\n\t\tif (segment_height > td->td_rowsperstrip)\n\t\t\tsegment_height = td->td_rowsperstrip;\n\t\tsp->bytesperline = TIFFOldScanlineSize(tif);\n\t}\n\tif (td->td_planarconfig == PLANARCONFIG_SEPARATE && s > 0) {\n\t\t/* for PC 2, scale down the strip/tile size\n\t\t * to match a downsampled component\n\t\t */\n\t\tsegment_width = TIFFhowmany(segment_width, sp->h_sampling);\n\t\tsegment_height = TIFFhowmany(segment_height, sp->v_sampling);\n\t}\n\tif (segment_width > 65535 || segment_height > 65535) {\n\t\tTIFFErrorExt(tif->tif_clientdata, module, \"Strip/tile too large for JPEG\");\n\t\treturn (0);\n\t}\n\tsp->cinfo.c.image_width = segment_width;\n\tsp->cinfo.c.image_height = segment_height;\n\tdownsampled_input = FALSE;\n\tif (td->td_planarconfig == PLANARCONFIG_CONTIG) {\n\t\tsp->cinfo.c.input_components = td->td_samplesperpixel;\n\t\tif (sp->photometric == PHOTOMETRIC_YCBCR) {\n\t\t\tif (sp->jpegcolormode == JPEGCOLORMODE_RGB) {\n\t\t\t\tsp->cinfo.c.in_color_space = JCS_RGB;\n\t\t\t} else {\n\t\t\t\tsp->cinfo.c.in_color_space = JCS_YCbCr;\n\t\t\t\tif (sp->h_sampling != 1 || sp->v_sampling != 1)\n\t\t\t\t\tdownsampled_input = TRUE;\n\t\t\t}\n\t\t\tif (!TIFFjpeg_set_colorspace(sp, JCS_YCbCr))\n\t\t\t\treturn (0);\n\t\t\t/*\n\t\t\t * Set Y sampling factors;\n\t\t\t * we assume jpeg_set_colorspace() set the rest to 1\n\t\t\t */\n\t\t\tsp->cinfo.c.comp_info[0].h_samp_factor = sp->h_sampling;\n\t\t\tsp->cinfo.c.comp_info[0].v_samp_factor = sp->v_sampling;\n\t\t} else {\n\t\t\tsp->cinfo.c.in_color_space = JCS_UNKNOWN;\n\t\t\tif (!TIFFjpeg_set_colorspace(sp, JCS_UNKNOWN))\n\t\t\t\treturn (0);\n\t\t\t/* jpeg_set_colorspace set all sampling factors to 1 */\n\t\t}\n\t} else {\n\t\tsp->cinfo.c.input_components = 1;\n\t\tsp->cinfo.c.in_color_space = JCS_UNKNOWN;\n\t\tif (!TIFFjpeg_set_colorspace(sp, JCS_UNKNOWN))\n\t\t\treturn (0);\n\t\tsp->cinfo.c.comp_info[0].component_id = s;\n\t\t/* jpeg_set_colorspace() set sampling factors to 1 */\n\t\tif (sp->photometric == PHOTOMETRIC_YCBCR && s > 0) {\n\t\t\tsp->cinfo.c.comp_info[0].quant_tbl_no = 1;\n\t\t\tsp->cinfo.c.comp_info[0].dc_tbl_no = 1;\n\t\t\tsp->cinfo.c.comp_info[0].ac_tbl_no = 1;\n\t\t}\n\t}\n\t/* ensure libjpeg won't write any extraneous markers */\n\tsp->cinfo.c.write_JFIF_header = FALSE;\n\tsp->cinfo.c.write_Adobe_marker = FALSE;\n\t/* set up table handling correctly */\n\tif (! (sp->jpegtablesmode & JPEGTABLESMODE_QUANT)) {\n\t\tif (!TIFFjpeg_set_quality(sp, sp->jpegquality, FALSE))\n\t\t\treturn (0);\n\t\tunsuppress_quant_table(sp, 0);\n\t\tunsuppress_quant_table(sp, 1);\n\t}\n\tif (sp->jpegtablesmode & JPEGTABLESMODE_HUFF)\n\t\tsp->cinfo.c.optimize_coding = FALSE;\n\telse\n\t\tsp->cinfo.c.optimize_coding = TRUE;\n\tif (downsampled_input) {\n\t\t/* Need to use raw-data interface to libjpeg */\n\t\tsp->cinfo.c.raw_data_in = TRUE;\n\t\ttif->tif_encoderow = JPEGEncodeRaw;\n\t\ttif->tif_encodestrip = JPEGEncodeRaw;\n\t\ttif->tif_encodetile = JPEGEncodeRaw;\n\t} else {\n\t\t/* Use normal interface to libjpeg */\n\t\tsp->cinfo.c.raw_data_in = FALSE;\n\t\ttif->tif_encoderow = JPEGEncode;\n\t\ttif->tif_encodestrip = JPEGEncode;\n\t\ttif->tif_encodetile = JPEGEncode;\n\t}\n\t/* Start JPEG compressor */\n\tif (!TIFFjpeg_start_compress(sp, FALSE))\n\t\treturn (0);\n\t/* Allocate downsampled-data buffers if needed */\n\tif (downsampled_input) {\n\t\tif (!alloc_downsampled_buffers(tif, sp->cinfo.c.comp_info,\n\t\t\t\t\t       sp->cinfo.c.num_components))\n\t\t\treturn (0);\n\t}\n\tsp->scancount = 0;\n\n\treturn (1);\n}\n\n/*\n * Encode a chunk of pixels.\n * \"Standard\" case: incoming data is not downsampled.\n */\nstatic int\nJPEGEncode(TIFF* tif, tidata_t buf, tsize_t cc, tsample_t s)\n{\n\tJPEGState *sp = JState(tif);\n\ttsize_t nrows;\n\tJSAMPROW bufptr[1];\n\n\t(void) s;\n\tassert(sp != NULL);\n\t/* data is expected to be supplied in multiples of a scanline */\n\tnrows = cc / sp->bytesperline;\n\tif (cc % sp->bytesperline)\n\t\tTIFFWarningExt(tif->tif_clientdata, tif->tif_name, \"fractional scanline discarded\");\n\n        /* The last strip will be limited to image size */\n        if( !isTiled(tif) && tif->tif_row+nrows > tif->tif_dir.td_imagelength )\n            nrows = tif->tif_dir.td_imagelength - tif->tif_row;\n\n\twhile (nrows-- > 0) {\n\t\tbufptr[0] = (JSAMPROW) buf;\n\t\tif (TIFFjpeg_write_scanlines(sp, bufptr, 1) != 1)\n\t\t\treturn (0);\n\t\tif (nrows > 0)\n\t\t\ttif->tif_row++;\n\t\tbuf += sp->bytesperline;\n\t}\n\treturn (1);\n}\n\n/*\n * Encode a chunk of pixels.\n * Incoming data is expected to be downsampled per sampling factors.\n */\nstatic int\nJPEGEncodeRaw(TIFF* tif, tidata_t buf, tsize_t cc, tsample_t s)\n{\n\tJPEGState *sp = JState(tif);\n\tJSAMPLE* inptr;\n\tJSAMPLE* outptr;\n\ttsize_t nrows;\n\tJDIMENSION clumps_per_line, nclump;\n\tint clumpoffset, ci, xpos, ypos;\n\tjpeg_component_info* compptr;\n\tint samples_per_clump = sp->samplesperclump;\n\ttsize_t bytesperclumpline;\n\n\t(void) s;\n\tassert(sp != NULL);\n\t/* data is expected to be supplied in multiples of a clumpline */\n\t/* a clumpline is equivalent to v_sampling desubsampled scanlines */\n\t/* TODO: the following calculation of bytesperclumpline, should substitute calculation of sp->bytesperline, except that it is per v_sampling lines */\n\tbytesperclumpline = (((sp->cinfo.c.image_width+sp->h_sampling-1)/sp->h_sampling)\n\t\t\t     *(sp->h_sampling*sp->v_sampling+2)*sp->cinfo.c.data_precision+7)\n\t\t\t    /8;\n\n\tnrows = ( cc / bytesperclumpline ) * sp->v_sampling;\n\tif (cc % bytesperclumpline)\n\t\tTIFFWarningExt(tif->tif_clientdata, tif->tif_name, \"fractional scanline discarded\");\n\n\t/* Cb,Cr both have sampling factors 1, so this is correct */\n\tclumps_per_line = sp->cinfo.c.comp_info[1].downsampled_width;\n\n\twhile (nrows > 0) {\n\t\t/*\n\t\t * Fastest way to separate the data is to make one pass\n\t\t * over the scanline for each row of each component.\n\t\t */\n\t\tclumpoffset = 0;\t\t/* first sample in clump */\n\t\tfor (ci = 0, compptr = sp->cinfo.c.comp_info;\n\t\t     ci < sp->cinfo.c.num_components;\n\t\t     ci++, compptr++) {\n\t\t    int hsamp = compptr->h_samp_factor;\n\t\t    int vsamp = compptr->v_samp_factor;\n\t\t    int padding = (int) (compptr->width_in_blocks * DCTSIZE -\n\t\t\t\t\t clumps_per_line * hsamp);\n\t\t    for (ypos = 0; ypos < vsamp; ypos++) {\n\t\t\tinptr = ((JSAMPLE*) buf) + clumpoffset;\n\t\t\toutptr = sp->ds_buffer[ci][sp->scancount*vsamp + ypos];\n\t\t\tif (hsamp == 1) {\n\t\t\t    /* fast path for at least Cb and Cr */\n\t\t\t    for (nclump = clumps_per_line; nclump-- > 0; ) {\n\t\t\t\t*outptr++ = inptr[0];\n\t\t\t\tinptr += samples_per_clump;\n\t\t\t    }\n\t\t\t} else {\n\t\t\t    /* general case */\n\t\t\t    for (nclump = clumps_per_line; nclump-- > 0; ) {\n\t\t\t\tfor (xpos = 0; xpos < hsamp; xpos++)\n\t\t\t\t    *outptr++ = inptr[xpos];\n\t\t\t\tinptr += samples_per_clump;\n\t\t\t    }\n\t\t\t}\n\t\t\t/* pad each scanline as needed */\n\t\t\tfor (xpos = 0; xpos < padding; xpos++) {\n\t\t\t    *outptr = outptr[-1];\n\t\t\t    outptr++;\n\t\t\t}\n\t\t\tclumpoffset += hsamp;\n\t\t    }\n\t\t}\n\t\tsp->scancount++;\n\t\tif (sp->scancount >= DCTSIZE) {\n\t\t\tint n = sp->cinfo.c.max_v_samp_factor * DCTSIZE;\n\t\t\tif (TIFFjpeg_write_raw_data(sp, sp->ds_buffer, n) != n)\n\t\t\t\treturn (0);\n\t\t\tsp->scancount = 0;\n\t\t}\n\t\ttif->tif_row += sp->v_sampling;\n\t\tbuf += sp->bytesperline;\n\t\tnrows -= sp->v_sampling;\n\t}\n\treturn (1);\n}\n\n/*\n * Finish up at the end of a strip or tile.\n */\nstatic int\nJPEGPostEncode(TIFF* tif)\n{\n\tJPEGState *sp = JState(tif);\n\n\tif (sp->scancount > 0) {\n\t\t/*\n\t\t * Need to emit a partial bufferload of downsampled data.\n\t\t * Pad the data vertically.\n\t\t */\n\t\tint ci, ypos, n;\n\t\tjpeg_component_info* compptr;\n\n\t\tfor (ci = 0, compptr = sp->cinfo.c.comp_info;\n\t\t     ci < sp->cinfo.c.num_components;\n\t\t     ci++, compptr++) {\n\t\t\tint vsamp = compptr->v_samp_factor;\n\t\t\ttsize_t row_width = compptr->width_in_blocks * DCTSIZE\n\t\t\t\t* sizeof(JSAMPLE);\n\t\t\tfor (ypos = sp->scancount * vsamp;\n\t\t\t     ypos < DCTSIZE * vsamp; ypos++) {\n\t\t\t\t_TIFFmemcpy((tdata_t)sp->ds_buffer[ci][ypos],\n\t\t\t\t\t    (tdata_t)sp->ds_buffer[ci][ypos-1],\n\t\t\t\t\t    row_width);\n\n\t\t\t}\n\t\t}\n\t\tn = sp->cinfo.c.max_v_samp_factor * DCTSIZE;\n\t\tif (TIFFjpeg_write_raw_data(sp, sp->ds_buffer, n) != n)\n\t\t\treturn (0);\n\t}\n\n\treturn (TIFFjpeg_finish_compress(JState(tif)));\n}\n\nstatic void\nJPEGCleanup(TIFF* tif)\n{\n\tJPEGState *sp = JState(tif);\n\t\n\tassert(sp != 0);\n\n\ttif->tif_tagmethods.vgetfield = sp->vgetparent;\n\ttif->tif_tagmethods.vsetfield = sp->vsetparent;\n\ttif->tif_tagmethods.printdir = sp->printdir;\n\n\tif( sp->cinfo_initialized )\n\t    TIFFjpeg_destroy(sp);\t/* release libjpeg resources */\n\tif (sp->jpegtables)\t\t/* tag value */\n\t\t_TIFFfree(sp->jpegtables);\n\t_TIFFfree(tif->tif_data);\t/* release local state */\n\ttif->tif_data = NULL;\n\n\t_TIFFSetDefaultCompressionState(tif);\n}\n\nstatic void \nJPEGResetUpsampled( TIFF* tif )\n{\n\tJPEGState* sp = JState(tif);\n\tTIFFDirectory* td = &tif->tif_dir;\n\n\t/*\n\t * Mark whether returned data is up-sampled or not so TIFFStripSize\n\t * and TIFFTileSize return values that reflect the true amount of\n\t * data.\n\t */\n\ttif->tif_flags &= ~TIFF_UPSAMPLED;\n\tif (td->td_planarconfig == PLANARCONFIG_CONTIG) {\n\t\tif (td->td_photometric == PHOTOMETRIC_YCBCR &&\n\t\t    sp->jpegcolormode == JPEGCOLORMODE_RGB) {\n\t\t\ttif->tif_flags |= TIFF_UPSAMPLED;\n\t\t} else {\n#ifdef notdef\n\t\t\tif (td->td_ycbcrsubsampling[0] != 1 ||\n\t\t\t    td->td_ycbcrsubsampling[1] != 1)\n\t\t\t\t; /* XXX what about up-sampling? */\n#endif\n\t\t}\n\t}\n\n\t/*\n\t * Must recalculate cached tile size in case sampling state changed.\n\t * Should we really be doing this now if image size isn't set? \n\t */\n\ttif->tif_tilesize = isTiled(tif) ? TIFFTileSize(tif) : (tsize_t) -1;\n}\n\nstatic int\nJPEGVSetField(TIFF* tif, ttag_t tag, va_list ap)\n{\n\tJPEGState* sp = JState(tif);\n\tconst TIFFFieldInfo* fip;\n\tuint32 v32;\n\n\tassert(sp != NULL);\n\n\tswitch (tag) {\n\tcase TIFFTAG_JPEGTABLES:\n\t\tv32 = va_arg(ap, uint32);\n\t\tif (v32 == 0) {\n\t\t\t/* XXX */\n\t\t\treturn (0);\n\t\t}\n\t\t_TIFFsetByteArray(&sp->jpegtables, va_arg(ap, void*),\n\t\t    (long) v32);\n\t\tsp->jpegtables_length = v32;\n\t\tTIFFSetFieldBit(tif, FIELD_JPEGTABLES);\n\t\tbreak;\n\tcase TIFFTAG_JPEGQUALITY:\n\t\tsp->jpegquality = va_arg(ap, int);\n\t\treturn (1);\t\t\t/* pseudo tag */\n\tcase TIFFTAG_JPEGCOLORMODE:\n\t\tsp->jpegcolormode = va_arg(ap, int);\n                JPEGResetUpsampled( tif );\n\t\treturn (1);\t\t\t/* pseudo tag */\n\tcase TIFFTAG_PHOTOMETRIC:\n        {\n                int ret_value = (*sp->vsetparent)(tif, tag, ap);\n                JPEGResetUpsampled( tif );\n                return ret_value;\n        }\n\tcase TIFFTAG_JPEGTABLESMODE:\n\t\tsp->jpegtablesmode = va_arg(ap, int);\n\t\treturn (1);\t\t\t/* pseudo tag */\n\tcase TIFFTAG_YCBCRSUBSAMPLING:\n                /* mark the fact that we have a real ycbcrsubsampling! */\n\t\tsp->ycbcrsampling_fetched = 1;\n                /* should we be recomputing upsampling info here? */\n\t\treturn (*sp->vsetparent)(tif, tag, ap);\n\tcase TIFFTAG_FAXRECVPARAMS:\n\t\tsp->recvparams = va_arg(ap, uint32);\n\t\tbreak;\n\tcase TIFFTAG_FAXSUBADDRESS:\n\t\t_TIFFsetString(&sp->subaddress, va_arg(ap, char*));\n\t\tbreak;\n\tcase TIFFTAG_FAXRECVTIME:\n\t\tsp->recvtime = va_arg(ap, uint32);\n\t\tbreak;\n\tcase TIFFTAG_FAXDCS:\n\t\t_TIFFsetString(&sp->faxdcs, va_arg(ap, char*));\n\t\tbreak;\n\tdefault:\n\t\treturn (*sp->vsetparent)(tif, tag, ap);\n\t}\n\n\tif ((fip = _TIFFFieldWithTag(tif, tag))) {\n\t\tTIFFSetFieldBit(tif, fip->field_bit);\n\t} else {\n\t\treturn (0);\n\t}\n\n\ttif->tif_flags |= TIFF_DIRTYDIRECT;\n\treturn (1);\n}\n\n/*\n * Some JPEG-in-TIFF produces do not emit the YCBCRSUBSAMPLING values in\n * the TIFF tags, but still use non-default (2,2) values within the jpeg\n * data stream itself.  In order for TIFF applications to work properly\n * - for instance to get the strip buffer size right - it is imperative\n * that the subsampling be available before we start reading the image\n * data normally.  This function will attempt to load the first strip in\n * order to get the sampling values from the jpeg data stream.  Various\n * hacks are various places are done to ensure this function gets called\n * before the td_ycbcrsubsampling values are used from the directory structure,\n * including calling TIFFGetField() for the YCBCRSUBSAMPLING field from \n * TIFFStripSize(), and the printing code in tif_print.c. \n *\n * Note that JPEGPreDeocode() will produce a fairly loud warning when the\n * discovered sampling does not match the default sampling (2,2) or whatever\n * was actually in the tiff tags. \n *\n * Problems:\n *  o This code will cause one whole strip/tile of compressed data to be\n *    loaded just to get the tags right, even if the imagery is never read.\n *    It would be more efficient to just load a bit of the header, and\n *    initialize things from that. \n *\n * See the bug in bugzilla for details:\n *\n * http://bugzilla.remotesensing.org/show_bug.cgi?id=168\n *\n * Frank Warmerdam, July 2002\n */\n\nstatic void \nJPEGFixupTestSubsampling( TIFF * tif )\n{\n#ifdef CHECK_JPEG_YCBCR_SUBSAMPLING\n    JPEGState *sp = JState(tif);\n    TIFFDirectory *td = &tif->tif_dir;\n\n    JPEGInitializeLibJPEG( tif, 0, 0 );\n\n    /*\n     * Some JPEG-in-TIFF files don't provide the ycbcrsampling tags, \n     * and use a sampling schema other than the default 2,2.  To handle\n     * this we actually have to scan the header of a strip or tile of\n     * jpeg data to get the sampling.  \n     */\n    if( !sp->cinfo.comm.is_decompressor \n        || sp->ycbcrsampling_fetched  \n        || td->td_photometric != PHOTOMETRIC_YCBCR )\n        return;\n\n    sp->ycbcrsampling_fetched = 1;\n    if( TIFFIsTiled( tif ) )\n    {\n        if( !TIFFFillTile( tif, 0 ) )\n\t\t\treturn;\n    }\n    else\n\t{\n        if( !TIFFFillStrip( tif, 0 ) )\n            return;\n    }\n\n    TIFFSetField( tif, TIFFTAG_YCBCRSUBSAMPLING, \n                  (uint16) sp->h_sampling, (uint16) sp->v_sampling );\n#endif /* CHECK_JPEG_YCBCR_SUBSAMPLING */\n}\n\nstatic int\nJPEGVGetField(TIFF* tif, ttag_t tag, va_list ap)\n{\n\tJPEGState* sp = JState(tif);\n\n\tassert(sp != NULL);\n\n\tswitch (tag) {\n\t\tcase TIFFTAG_JPEGTABLES:\n\t\t\t*va_arg(ap, uint32*) = sp->jpegtables_length;\n\t\t\t*va_arg(ap, void**) = sp->jpegtables;\n\t\t\tbreak;\n\t\tcase TIFFTAG_JPEGQUALITY:\n\t\t\t*va_arg(ap, int*) = sp->jpegquality;\n\t\t\tbreak;\n\t\tcase TIFFTAG_JPEGCOLORMODE:\n\t\t\t*va_arg(ap, int*) = sp->jpegcolormode;\n\t\t\tbreak;\n\t\tcase TIFFTAG_JPEGTABLESMODE:\n\t\t\t*va_arg(ap, int*) = sp->jpegtablesmode;\n\t\t\tbreak;\n\t\tcase TIFFTAG_YCBCRSUBSAMPLING:\n\t\t\tJPEGFixupTestSubsampling( tif );\n\t\t\treturn (*sp->vgetparent)(tif, tag, ap);\n\t\tcase TIFFTAG_FAXRECVPARAMS:\n\t\t\t*va_arg(ap, uint32*) = sp->recvparams;\n\t\t\tbreak;\n\t\tcase TIFFTAG_FAXSUBADDRESS:\n\t\t\t*va_arg(ap, char**) = sp->subaddress;\n\t\t\tbreak;\n\t\tcase TIFFTAG_FAXRECVTIME:\n\t\t\t*va_arg(ap, uint32*) = sp->recvtime;\n\t\t\tbreak;\n\t\tcase TIFFTAG_FAXDCS:\n\t\t\t*va_arg(ap, char**) = sp->faxdcs;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\treturn (*sp->vgetparent)(tif, tag, ap);\n\t}\n\treturn (1);\n}\n\nstatic void\nJPEGPrintDir(TIFF* tif, FILE* fd, long flags)\n{\n\tJPEGState* sp = JState(tif);\n\n\tassert(sp != NULL);\n\n\t(void) flags;\n\tif (TIFFFieldSet(tif,FIELD_JPEGTABLES))\n\t\tfprintf(fd, \"  JPEG Tables: (%lu bytes)\\n\",\n\t\t\t(unsigned long) sp->jpegtables_length);\n        if (TIFFFieldSet(tif,FIELD_RECVPARAMS))\n                fprintf(fd, \"  Fax Receive Parameters: %08lx\\n\",\n                   (unsigned long) sp->recvparams);\n        if (TIFFFieldSet(tif,FIELD_SUBADDRESS))\n                fprintf(fd, \"  Fax SubAddress: %s\\n\", sp->subaddress);\n        if (TIFFFieldSet(tif,FIELD_RECVTIME))\n                fprintf(fd, \"  Fax Receive Time: %lu secs\\n\",\n                    (unsigned long) sp->recvtime);\n        if (TIFFFieldSet(tif,FIELD_FAXDCS))\n                fprintf(fd, \"  Fax DCS: %s\\n\", sp->faxdcs);\n}\n\nstatic uint32\nJPEGDefaultStripSize(TIFF* tif, uint32 s)\n{\n\tJPEGState* sp = JState(tif);\n\tTIFFDirectory *td = &tif->tif_dir;\n\n\ts = (*sp->defsparent)(tif, s);\n\tif (s < td->td_imagelength)\n\t\ts = TIFFroundup(s, td->td_ycbcrsubsampling[1] * DCTSIZE);\n\treturn (s);\n}\n\nstatic void\nJPEGDefaultTileSize(TIFF* tif, uint32* tw, uint32* th)\n{\n\tJPEGState* sp = JState(tif);\n\tTIFFDirectory *td = &tif->tif_dir;\n\n\t(*sp->deftparent)(tif, tw, th);\n\t*tw = TIFFroundup(*tw, td->td_ycbcrsubsampling[0] * DCTSIZE);\n\t*th = TIFFroundup(*th, td->td_ycbcrsubsampling[1] * DCTSIZE);\n}\n\n/*\n * The JPEG library initialized used to be done in TIFFInitJPEG(), but\n * now that we allow a TIFF file to be opened in update mode it is necessary\n * to have some way of deciding whether compression or decompression is\n * desired other than looking at tif->tif_mode.  We accomplish this by \n * examining {TILE/STRIP}BYTECOUNTS to see if there is a non-zero entry.\n * If so, we assume decompression is desired. \n *\n * This is tricky, because TIFFInitJPEG() is called while the directory is\n * being read, and generally speaking the BYTECOUNTS tag won't have been read\n * at that point.  So we try to defer jpeg library initialization till we\n * do have that tag ... basically any access that might require the compressor\n * or decompressor that occurs after the reading of the directory. \n *\n * In an ideal world compressors or decompressors would be setup\n * at the point where a single tile or strip was accessed (for read or write)\n * so that stuff like update of missing tiles, or replacement of tiles could\n * be done. However, we aren't trying to crack that nut just yet ...\n *\n * NFW, Feb 3rd, 2003.\n */\n\nstatic int JPEGInitializeLibJPEG( TIFF * tif, int force_encode, int force_decode )\n{\n    JPEGState* sp = JState(tif);\n    uint32 *byte_counts = NULL;\n    int     data_is_empty = TRUE;\n    int     decompress;\n\n\n    if(sp->cinfo_initialized)\n    {\n        if( force_encode && sp->cinfo.comm.is_decompressor )\n            TIFFjpeg_destroy( sp );\n        else if( force_decode && !sp->cinfo.comm.is_decompressor )\n            TIFFjpeg_destroy( sp );\n        else\n            return 1;\n\n        sp->cinfo_initialized = 0;\n    }\n\n    /*\n     * Do we have tile data already?  Make sure we initialize the\n     * the state in decompressor mode if we have tile data, even if we\n     * are not in read-only file access mode. \n     */\n    if( TIFFIsTiled( tif ) \n        && TIFFGetField( tif, TIFFTAG_TILEBYTECOUNTS, &byte_counts ) \n        && byte_counts != NULL )\n    {\n        data_is_empty = byte_counts[0] == 0;\n    }\n    if( !TIFFIsTiled( tif ) \n        && TIFFGetField( tif, TIFFTAG_STRIPBYTECOUNTS, &byte_counts) \n        && byte_counts != NULL )\n    {\n        data_is_empty = byte_counts[0] == 0;\n    }\n\n    if( force_decode )\n        decompress = 1;\n    else if( force_encode )\n        decompress = 0;\n    else if( tif->tif_mode == O_RDONLY )\n        decompress = 1;\n    else if( data_is_empty )\n        decompress = 0;\n    else\n        decompress = 1;\n\n    /*\n     * Initialize libjpeg.\n     */\n    if ( decompress ) {\n        if (!TIFFjpeg_create_decompress(sp))\n            return (0);\n\n    } else {\n        if (!TIFFjpeg_create_compress(sp))\n            return (0);\n    }\n\n    sp->cinfo_initialized = TRUE;\n\n    return 1;\n}\n\nint\nTIFFInitJPEG(TIFF* tif, int scheme)\n{\n\tJPEGState* sp;\n\n\tassert(scheme == COMPRESSION_JPEG);\n\n\t/*\n\t * Merge codec-specific tag information.\n\t */\n\tif (!_TIFFMergeFieldInfo(tif, jpegFieldInfo, N(jpegFieldInfo))) {\n\t\tTIFFErrorExt(tif->tif_clientdata,\n\t\t\t     \"TIFFInitJPEG\",\n\t\t\t     \"Merging JPEG codec-specific tags failed\");\n\t\treturn 0;\n\t}\n\n\t/*\n\t * Allocate state block so tag methods have storage to record values.\n\t */\n\ttif->tif_data = (tidata_t) _TIFFmalloc(sizeof (JPEGState));\n\n\tif (tif->tif_data == NULL) {\n\t\tTIFFErrorExt(tif->tif_clientdata,\n\t\t\t     \"TIFFInitJPEG\", \"No space for JPEG state block\");\n\t\treturn 0;\n\t}\n        _TIFFmemset(tif->tif_data, 0, sizeof(JPEGState));\n\n\tsp = JState(tif);\n\tsp->tif = tif;\t\t\t\t/* back link */\n\n\t/*\n\t * Override parent get/set field methods.\n\t */\n\tsp->vgetparent = tif->tif_tagmethods.vgetfield;\n\ttif->tif_tagmethods.vgetfield = JPEGVGetField; /* hook for codec tags */\n\tsp->vsetparent = tif->tif_tagmethods.vsetfield;\n\ttif->tif_tagmethods.vsetfield = JPEGVSetField; /* hook for codec tags */\n\tsp->printdir = tif->tif_tagmethods.printdir;\n\ttif->tif_tagmethods.printdir = JPEGPrintDir;   /* hook for codec tags */\n\n\t/* Default values for codec-specific fields */\n\tsp->jpegtables = NULL;\n\tsp->jpegtables_length = 0;\n\tsp->jpegquality = 75;\t\t\t/* Default IJG quality */\n\tsp->jpegcolormode = JPEGCOLORMODE_RAW;\n\tsp->jpegtablesmode = JPEGTABLESMODE_QUANT | JPEGTABLESMODE_HUFF;\n\n        sp->recvparams = 0;\n        sp->subaddress = NULL;\n        sp->faxdcs = NULL;\n\n        sp->ycbcrsampling_fetched = 0;\n\n\t/*\n\t * Install codec methods.\n\t */\n\ttif->tif_setupdecode = JPEGSetupDecode;\n\ttif->tif_predecode = JPEGPreDecode;\n\ttif->tif_decoderow = JPEGDecode;\n\ttif->tif_decodestrip = JPEGDecode;\n\ttif->tif_decodetile = JPEGDecode;\n\ttif->tif_setupencode = JPEGSetupEncode;\n\ttif->tif_preencode = JPEGPreEncode;\n\ttif->tif_postencode = JPEGPostEncode;\n\ttif->tif_encoderow = JPEGEncode;\n\ttif->tif_encodestrip = JPEGEncode;\n\ttif->tif_encodetile = JPEGEncode;\n\ttif->tif_cleanup = JPEGCleanup;\n\tsp->defsparent = tif->tif_defstripsize;\n\ttif->tif_defstripsize = JPEGDefaultStripSize;\n\tsp->deftparent = tif->tif_deftilesize;\n\ttif->tif_deftilesize = JPEGDefaultTileSize;\n\ttif->tif_flags |= TIFF_NOBITREV;\t/* no bit reversal, please */\n\n        sp->cinfo_initialized = FALSE;\n\n\t/*\n        ** Create a JPEGTables field if no directory has yet been created. \n        ** We do this just to ensure that sufficient space is reserved for\n        ** the JPEGTables field.  It will be properly created the right\n        ** size later. \n        */\n        if( tif->tif_diroff == 0 )\n        {\n#define SIZE_OF_JPEGTABLES 2000\n            TIFFSetFieldBit(tif, FIELD_JPEGTABLES);\n            sp->jpegtables_length = SIZE_OF_JPEGTABLES;\n            sp->jpegtables = (void *) _TIFFmalloc(sp->jpegtables_length);\n\t    _TIFFmemset(sp->jpegtables, 0, SIZE_OF_JPEGTABLES);\n#undef SIZE_OF_JPEGTABLES\n        }\n\n        /*\n         * Mark the TIFFTAG_YCBCRSAMPLES as present even if it is not\n         * see: JPEGFixupTestSubsampling().\n         */\n        TIFFSetFieldBit( tif, FIELD_YCBCRSUBSAMPLING );\n\n\treturn 1;\n}\n#endif /* JPEG_SUPPORT */\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/tif_luv.c",
    "content": "/* $Id: tif_luv.c,v 1.17.2.3 2009-06-30 17:06:25 fwarmerdam Exp $ */\n\n/*\n * Copyright (c) 1997 Greg Ward Larson\n * Copyright (c) 1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler, Greg Larson and Silicon Graphics may not be used in any\n * advertising or publicity relating to the software without the specific,\n * prior written permission of Sam Leffler, Greg Larson and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER, GREG LARSON OR SILICON GRAPHICS BE LIABLE\n * FOR ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n#include \"tiffiop.h\"\n#ifdef LOGLUV_SUPPORT\n\n/*\n * TIFF Library.\n * LogLuv compression support for high dynamic range images.\n *\n * Contributed by Greg Larson.\n *\n * LogLuv image support uses the TIFF library to store 16 or 10-bit\n * log luminance values with 8 bits each of u and v or a 14-bit index.\n *\n * The codec can take as input and produce as output 32-bit IEEE float values \n * as well as 16-bit integer values.  A 16-bit luminance is interpreted\n * as a sign bit followed by a 15-bit integer that is converted\n * to and from a linear magnitude using the transformation:\n *\n *\tL = 2^( (Le+.5)/256 - 64 )\t\t# real from 15-bit\n *\n *\tLe = floor( 256*(log2(L) + 64) )\t# 15-bit from real\n *\n * The actual conversion to world luminance units in candelas per sq. meter\n * requires an additional multiplier, which is stored in the TIFFTAG_STONITS.\n * This value is usually set such that a reasonable exposure comes from\n * clamping decoded luminances above 1 to 1 in the displayed image.\n *\n * The 16-bit values for u and v may be converted to real values by dividing\n * each by 32768.  (This allows for negative values, which aren't useful as\n * far as we know, but are left in case of future improvements in human\n * color vision.)\n *\n * Conversion from (u,v), which is actually the CIE (u',v') system for\n * you color scientists, is accomplished by the following transformation:\n *\n *\tu = 4*x / (-2*x + 12*y + 3)\n *\tv = 9*y / (-2*x + 12*y + 3)\n *\n *\tx = 9*u / (6*u - 16*v + 12)\n *\ty = 4*v / (6*u - 16*v + 12)\n *\n * This process is greatly simplified by passing 32-bit IEEE floats\n * for each of three CIE XYZ coordinates.  The codec then takes care\n * of conversion to and from LogLuv, though the application is still\n * responsible for interpreting the TIFFTAG_STONITS calibration factor.\n *\n * By definition, a CIE XYZ vector of [1 1 1] corresponds to a neutral white\n * point of (x,y)=(1/3,1/3).  However, most color systems assume some other\n * white point, such as D65, and an absolute color conversion to XYZ then\n * to another color space with a different white point may introduce an\n * unwanted color cast to the image.  It is often desirable, therefore, to\n * perform a white point conversion that maps the input white to [1 1 1]\n * in XYZ, then record the original white point using the TIFFTAG_WHITEPOINT\n * tag value.  A decoder that demands absolute color calibration may use\n * this white point tag to get back the original colors, but usually it\n * will be ignored and the new white point will be used instead that\n * matches the output color space.\n *\n * Pixel information is compressed into one of two basic encodings, depending\n * on the setting of the compression tag, which is one of COMPRESSION_SGILOG\n * or COMPRESSION_SGILOG24.  For COMPRESSION_SGILOG, greyscale data is\n * stored as:\n *\n *\t 1       15\n *\t|-+---------------|\n *\n * COMPRESSION_SGILOG color data is stored as:\n *\n *\t 1       15           8        8\n *\t|-+---------------|--------+--------|\n *\t S       Le           ue       ve\n *\n * For the 24-bit COMPRESSION_SGILOG24 color format, the data is stored as:\n *\n *\t     10           14\n *\t|----------|--------------|\n *\t     Le'          Ce\n *\n * There is no sign bit in the 24-bit case, and the (u,v) chromaticity is\n * encoded as an index for optimal color resolution.  The 10 log bits are\n * defined by the following conversions:\n *\n *\tL = 2^((Le'+.5)/64 - 12)\t\t# real from 10-bit\n *\n *\tLe' = floor( 64*(log2(L) + 12) )\t# 10-bit from real\n *\n * The 10 bits of the smaller format may be converted into the 15 bits of\n * the larger format by multiplying by 4 and adding 13314.  Obviously,\n * a smaller range of magnitudes is covered (about 5 orders of magnitude\n * instead of 38), and the lack of a sign bit means that negative luminances\n * are not allowed.  (Well, they aren't allowed in the real world, either,\n * but they are useful for certain types of image processing.)\n *\n * The desired user format is controlled by the setting the internal\n * pseudo tag TIFFTAG_SGILOGDATAFMT to one of:\n *  SGILOGDATAFMT_FLOAT       = IEEE 32-bit float XYZ values\n *  SGILOGDATAFMT_16BIT\t      = 16-bit integer encodings of logL, u and v\n * Raw data i/o is also possible using:\n *  SGILOGDATAFMT_RAW         = 32-bit unsigned integer with encoded pixel\n * In addition, the following decoding is provided for ease of display:\n *  SGILOGDATAFMT_8BIT        = 8-bit default RGB gamma-corrected values\n *\n * For grayscale images, we provide the following data formats:\n *  SGILOGDATAFMT_FLOAT       = IEEE 32-bit float Y values\n *  SGILOGDATAFMT_16BIT       = 16-bit integer w/ encoded luminance\n *  SGILOGDATAFMT_8BIT        = 8-bit gray monitor values\n *\n * Note that the COMPRESSION_SGILOG applies a simple run-length encoding\n * scheme by separating the logL, u and v bytes for each row and applying\n * a PackBits type of compression.  Since the 24-bit encoding is not\n * adaptive, the 32-bit color format takes less space in many cases.\n *\n * Further control is provided over the conversion from higher-resolution\n * formats to final encoded values through the pseudo tag\n * TIFFTAG_SGILOGENCODE:\n *  SGILOGENCODE_NODITHER     = do not dither encoded values\n *  SGILOGENCODE_RANDITHER    = apply random dithering during encoding\n *\n * The default value of this tag is SGILOGENCODE_NODITHER for\n * COMPRESSION_SGILOG to maximize run-length encoding and\n * SGILOGENCODE_RANDITHER for COMPRESSION_SGILOG24 to turn\n * quantization errors into noise.\n */\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\n/*\n * State block for each open TIFF\n * file using LogLuv compression/decompression.\n */\ntypedef\tstruct logLuvState LogLuvState;\n\nstruct logLuvState {\n\tint\t\t\tuser_datafmt;\t/* user data format */\n\tint\t\t\tencode_meth;\t/* encoding method */\n\tint\t\t\tpixel_size;\t/* bytes per pixel */\n\n\ttidata_t*\t\ttbuf;\t\t/* translation buffer */\n\tint\t\t\ttbuflen;\t/* buffer length */\n\tvoid (*tfunc)(LogLuvState*, tidata_t, int);\n\n\tTIFFVSetMethod\t\tvgetparent;\t/* super-class method */\n\tTIFFVSetMethod\t\tvsetparent;\t/* super-class method */\n};\n\n#define\tDecoderState(tif)\t((LogLuvState*) (tif)->tif_data)\n#define\tEncoderState(tif)\t((LogLuvState*) (tif)->tif_data)\n\n#define SGILOGDATAFMT_UNKNOWN\t-1\n\n#define MINRUN\t\t4\t/* minimum run length */\n\n/*\n * Decode a string of 16-bit gray pixels.\n */\nstatic int\nLogL16Decode(TIFF* tif, tidata_t op, tsize_t occ, tsample_t s)\n{\n\tLogLuvState* sp = DecoderState(tif);\n\tint shft, i, npixels;\n\tunsigned char* bp;\n\tint16* tp;\n\tint16 b;\n\tint cc, rc;\n\n\tassert(s == 0);\n\tassert(sp != NULL);\n\n\tnpixels = occ / sp->pixel_size;\n\n\tif (sp->user_datafmt == SGILOGDATAFMT_16BIT)\n\t\ttp = (int16*) op;\n\telse {\n\t\tassert(sp->tbuflen >= npixels);\n\t\ttp = (int16*) sp->tbuf;\n\t}\n\t_TIFFmemset((tdata_t) tp, 0, npixels*sizeof (tp[0]));\n\n\tbp = (unsigned char*) tif->tif_rawcp;\n\tcc = tif->tif_rawcc;\n\t\t\t\t\t/* get each byte string */\n\tfor (shft = 2*8; (shft -= 8) >= 0; ) {\n\t\tfor (i = 0; i < npixels && cc > 0; )\n\t\t\tif (*bp >= 128) {\t\t/* run */\n\t\t\t\trc = *bp++ + (2-128);\n\t\t\t\tb = (int16)(*bp++ << shft);\n\t\t\t\tcc -= 2;\n\t\t\t\twhile (rc-- && i < npixels)\n\t\t\t\t\ttp[i++] |= b;\n\t\t\t} else {\t\t\t/* non-run */\n\t\t\t\trc = *bp++;\t\t/* nul is noop */\n\t\t\t\twhile (--cc && rc-- && i < npixels)\n\t\t\t\t\ttp[i++] |= (int16)*bp++ << shft;\n\t\t\t}\n\t\tif (i != npixels) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t\"LogL16Decode: Not enough data at row %d (short %d pixels)\",\n\t\t\t    tif->tif_row, npixels - i);\n\t\t\ttif->tif_rawcp = (tidata_t) bp;\n\t\t\ttif->tif_rawcc = cc;\n\t\t\treturn (0);\n\t\t}\n\t}\n\t(*sp->tfunc)(sp, op, npixels);\n\ttif->tif_rawcp = (tidata_t) bp;\n\ttif->tif_rawcc = cc;\n\treturn (1);\n}\n\n/*\n * Decode a string of 24-bit pixels.\n */\nstatic int\nLogLuvDecode24(TIFF* tif, tidata_t op, tsize_t occ, tsample_t s)\n{\n\tLogLuvState* sp = DecoderState(tif);\n\tint cc, i, npixels;\n\tunsigned char* bp;\n\tuint32* tp;\n\n\tassert(s == 0);\n\tassert(sp != NULL);\n\n\tnpixels = occ / sp->pixel_size;\n\n\tif (sp->user_datafmt == SGILOGDATAFMT_RAW)\n\t\ttp = (uint32 *)op;\n\telse {\n\t\tassert(sp->tbuflen >= npixels);\n\t\ttp = (uint32 *) sp->tbuf;\n\t}\n\t\t\t\t\t/* copy to array of uint32 */\n\tbp = (unsigned char*) tif->tif_rawcp;\n\tcc = tif->tif_rawcc;\n\tfor (i = 0; i < npixels && cc > 0; i++) {\n\t\ttp[i] = bp[0] << 16 | bp[1] << 8 | bp[2];\n\t\tbp += 3;\n\t\tcc -= 3;\n\t}\n\ttif->tif_rawcp = (tidata_t) bp;\n\ttif->tif_rawcc = cc;\n\tif (i != npixels) {\n\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t    \"LogLuvDecode24: Not enough data at row %d (short %d pixels)\",\n\t\t    tif->tif_row, npixels - i);\n\t\treturn (0);\n\t}\n\t(*sp->tfunc)(sp, op, npixels);\n\treturn (1);\n}\n\n/*\n * Decode a string of 32-bit pixels.\n */\nstatic int\nLogLuvDecode32(TIFF* tif, tidata_t op, tsize_t occ, tsample_t s)\n{\n\tLogLuvState* sp;\n\tint shft, i, npixels;\n\tunsigned char* bp;\n\tuint32* tp;\n\tuint32 b;\n\tint cc, rc;\n\n\tassert(s == 0);\n\tsp = DecoderState(tif);\n\tassert(sp != NULL);\n\n\tnpixels = occ / sp->pixel_size;\n\n\tif (sp->user_datafmt == SGILOGDATAFMT_RAW)\n\t\ttp = (uint32*) op;\n\telse {\n\t\tassert(sp->tbuflen >= npixels);\n\t\ttp = (uint32*) sp->tbuf;\n\t}\n\t_TIFFmemset((tdata_t) tp, 0, npixels*sizeof (tp[0]));\n\n\tbp = (unsigned char*) tif->tif_rawcp;\n\tcc = tif->tif_rawcc;\n\t\t\t\t\t/* get each byte string */\n\tfor (shft = 4*8; (shft -= 8) >= 0; ) {\n\t\tfor (i = 0; i < npixels && cc > 0; )\n\t\t\tif (*bp >= 128) {\t\t/* run */\n\t\t\t\trc = *bp++ + (2-128);\n\t\t\t\tb = (uint32)*bp++ << shft;\n\t\t\t\tcc -= 2;\n\t\t\t\twhile (rc-- && i < npixels)\n\t\t\t\t\ttp[i++] |= b;\n\t\t\t} else {\t\t\t/* non-run */\n\t\t\t\trc = *bp++;\t\t/* nul is noop */\n\t\t\t\twhile (--cc && rc-- && i < npixels)\n\t\t\t\t\ttp[i++] |= (uint32)*bp++ << shft;\n\t\t\t}\n\t\tif (i != npixels) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t\"LogLuvDecode32: Not enough data at row %d (short %d pixels)\",\n\t\t\t    tif->tif_row, npixels - i);\n\t\t\ttif->tif_rawcp = (tidata_t) bp;\n\t\t\ttif->tif_rawcc = cc;\n\t\t\treturn (0);\n\t\t}\n\t}\n\t(*sp->tfunc)(sp, op, npixels);\n\ttif->tif_rawcp = (tidata_t) bp;\n\ttif->tif_rawcc = cc;\n\treturn (1);\n}\n\n/*\n * Decode a strip of pixels.  We break it into rows to\n * maintain synchrony with the encode algorithm, which\n * is row by row.\n */\nstatic int\nLogLuvDecodeStrip(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)\n{\n\ttsize_t rowlen = TIFFScanlineSize(tif);\n\n\tassert(cc%rowlen == 0);\n\twhile (cc && (*tif->tif_decoderow)(tif, bp, rowlen, s))\n\t\tbp += rowlen, cc -= rowlen;\n\treturn (cc == 0);\n}\n\n/*\n * Decode a tile of pixels.  We break it into rows to\n * maintain synchrony with the encode algorithm, which\n * is row by row.\n */\nstatic int\nLogLuvDecodeTile(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)\n{\n\ttsize_t rowlen = TIFFTileRowSize(tif);\n\n\tassert(cc%rowlen == 0);\n\twhile (cc && (*tif->tif_decoderow)(tif, bp, rowlen, s))\n\t\tbp += rowlen, cc -= rowlen;\n\treturn (cc == 0);\n}\n\n/*\n * Encode a row of 16-bit pixels.\n */\nstatic int\nLogL16Encode(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)\n{\n\tLogLuvState* sp = EncoderState(tif);\n\tint shft, i, j, npixels;\n\ttidata_t op;\n\tint16* tp;\n\tint16 b;\n\tint occ, rc=0, mask, beg;\n\n\tassert(s == 0);\n\tassert(sp != NULL);\n\tnpixels = cc / sp->pixel_size;\n\n\tif (sp->user_datafmt == SGILOGDATAFMT_16BIT)\n\t\ttp = (int16*) bp;\n\telse {\n\t\ttp = (int16*) sp->tbuf;\n\t\tassert(sp->tbuflen >= npixels);\n\t\t(*sp->tfunc)(sp, bp, npixels);\n\t}\n\t\t\t\t\t/* compress each byte string */\n\top = tif->tif_rawcp;\n\tocc = tif->tif_rawdatasize - tif->tif_rawcc;\n\tfor (shft = 2*8; (shft -= 8) >= 0; )\n\t\tfor (i = 0; i < npixels; i += rc) {\n\t\t\tif (occ < 4) {\n\t\t\t\ttif->tif_rawcp = op;\n\t\t\t\ttif->tif_rawcc = tif->tif_rawdatasize - occ;\n\t\t\t\tif (!TIFFFlushData1(tif))\n\t\t\t\t\treturn (-1);\n\t\t\t\top = tif->tif_rawcp;\n\t\t\t\tocc = tif->tif_rawdatasize - tif->tif_rawcc;\n\t\t\t}\n\t\t\tmask = 0xff << shft;\t\t/* find next run */\n\t\t\tfor (beg = i; beg < npixels; beg += rc) {\n\t\t\t\tb = (int16) (tp[beg] & mask);\n\t\t\t\trc = 1;\n\t\t\t\twhile (rc < 127+2 && beg+rc < npixels &&\n\t\t\t\t\t\t(tp[beg+rc] & mask) == b)\n\t\t\t\t\trc++;\n\t\t\t\tif (rc >= MINRUN)\n\t\t\t\t\tbreak;\t\t/* long enough */\n\t\t\t}\n\t\t\tif (beg-i > 1 && beg-i < MINRUN) {\n\t\t\t\tb = (int16) (tp[i] & mask);/*check short run */\n\t\t\t\tj = i+1;\n\t\t\t\twhile ((tp[j++] & mask) == b)\n                                    if (j == beg) {\n                                        *op++ = (tidataval_t)(128-2+j-i);\n                                        *op++ = (tidataval_t) (b >> shft);\n                                        occ -= 2;\n                                        i = beg;\n                                        break;\n                                    }\n\t\t\t}\n\t\t\twhile (i < beg) {\t\t/* write out non-run */\n\t\t\t\tif ((j = beg-i) > 127) j = 127;\n\t\t\t\tif (occ < j+3) {\n                                    tif->tif_rawcp = op;\n                                    tif->tif_rawcc = tif->tif_rawdatasize - occ;\n                                    if (!TIFFFlushData1(tif))\n                                        return (-1);\n                                    op = tif->tif_rawcp;\n                                    occ = tif->tif_rawdatasize - tif->tif_rawcc;\n\t\t\t\t}\n\t\t\t\t*op++ = (tidataval_t) j; occ--;\n\t\t\t\twhile (j--) {\n\t\t\t\t\t*op++ = (tidataval_t) (tp[i++] >> shft & 0xff);\n\t\t\t\t\tocc--;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (rc >= MINRUN) {\t\t/* write out run */\n\t\t\t\t*op++ = (tidataval_t) (128-2+rc);\n\t\t\t\t*op++ = (tidataval_t) (tp[beg] >> shft & 0xff);\n\t\t\t\tocc -= 2;\n\t\t\t} else\n\t\t\t\trc = 0;\n\t\t}\n\ttif->tif_rawcp = op;\n\ttif->tif_rawcc = tif->tif_rawdatasize - occ;\n\n\treturn (1);\n}\n\n/*\n * Encode a row of 24-bit pixels.\n */\nstatic int\nLogLuvEncode24(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)\n{\n\tLogLuvState* sp = EncoderState(tif);\n\tint i, npixels, occ;\n\ttidata_t op;\n\tuint32* tp;\n\n\tassert(s == 0);\n\tassert(sp != NULL);\n\tnpixels = cc / sp->pixel_size;\n\n\tif (sp->user_datafmt == SGILOGDATAFMT_RAW)\n\t\ttp = (uint32*) bp;\n\telse {\n\t\ttp = (uint32*) sp->tbuf;\n\t\tassert(sp->tbuflen >= npixels);\n\t\t(*sp->tfunc)(sp, bp, npixels);\n\t}\n\t\t\t\t\t/* write out encoded pixels */\n\top = tif->tif_rawcp;\n\tocc = tif->tif_rawdatasize - tif->tif_rawcc;\n\tfor (i = npixels; i--; ) {\n\t\tif (occ < 3) {\n\t\t\ttif->tif_rawcp = op;\n\t\t\ttif->tif_rawcc = tif->tif_rawdatasize - occ;\n\t\t\tif (!TIFFFlushData1(tif))\n\t\t\t\treturn (-1);\n\t\t\top = tif->tif_rawcp;\n\t\t\tocc = tif->tif_rawdatasize - tif->tif_rawcc;\n\t\t}\n\t\t*op++ = (tidataval_t)(*tp >> 16);\n\t\t*op++ = (tidataval_t)(*tp >> 8 & 0xff);\n\t\t*op++ = (tidataval_t)(*tp++ & 0xff);\n\t\tocc -= 3;\n\t}\n\ttif->tif_rawcp = op;\n\ttif->tif_rawcc = tif->tif_rawdatasize - occ;\n\n\treturn (1);\n}\n\n/*\n * Encode a row of 32-bit pixels.\n */\nstatic int\nLogLuvEncode32(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)\n{\n\tLogLuvState* sp = EncoderState(tif);\n\tint shft, i, j, npixels;\n\ttidata_t op;\n\tuint32* tp;\n\tuint32 b;\n\tint occ, rc=0, mask, beg;\n\n\tassert(s == 0);\n\tassert(sp != NULL);\n\n\tnpixels = cc / sp->pixel_size;\n\n\tif (sp->user_datafmt == SGILOGDATAFMT_RAW)\n\t\ttp = (uint32*) bp;\n\telse {\n\t\ttp = (uint32*) sp->tbuf;\n\t\tassert(sp->tbuflen >= npixels);\n\t\t(*sp->tfunc)(sp, bp, npixels);\n\t}\n\t\t\t\t\t/* compress each byte string */\n\top = tif->tif_rawcp;\n\tocc = tif->tif_rawdatasize - tif->tif_rawcc;\n\tfor (shft = 4*8; (shft -= 8) >= 0; )\n\t\tfor (i = 0; i < npixels; i += rc) {\n\t\t\tif (occ < 4) {\n\t\t\t\ttif->tif_rawcp = op;\n\t\t\t\ttif->tif_rawcc = tif->tif_rawdatasize - occ;\n\t\t\t\tif (!TIFFFlushData1(tif))\n\t\t\t\t\treturn (-1);\n\t\t\t\top = tif->tif_rawcp;\n\t\t\t\tocc = tif->tif_rawdatasize - tif->tif_rawcc;\n\t\t\t}\n\t\t\tmask = 0xff << shft;\t\t/* find next run */\n\t\t\tfor (beg = i; beg < npixels; beg += rc) {\n\t\t\t\tb = tp[beg] & mask;\n\t\t\t\trc = 1;\n\t\t\t\twhile (rc < 127+2 && beg+rc < npixels &&\n\t\t\t\t\t\t(tp[beg+rc] & mask) == b)\n\t\t\t\t\trc++;\n\t\t\t\tif (rc >= MINRUN)\n\t\t\t\t\tbreak;\t\t/* long enough */\n\t\t\t}\n\t\t\tif (beg-i > 1 && beg-i < MINRUN) {\n\t\t\t\tb = tp[i] & mask;\t/* check short run */\n\t\t\t\tj = i+1;\n\t\t\t\twhile ((tp[j++] & mask) == b)\n\t\t\t\t\tif (j == beg) {\n\t\t\t\t\t\t*op++ = (tidataval_t)(128-2+j-i);\n\t\t\t\t\t\t*op++ = (tidataval_t)(b >> shft);\n\t\t\t\t\t\tocc -= 2;\n\t\t\t\t\t\ti = beg;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t}\n\t\t\twhile (i < beg) {\t\t/* write out non-run */\n\t\t\t\tif ((j = beg-i) > 127) j = 127;\n\t\t\t\tif (occ < j+3) {\n\t\t\t\t\ttif->tif_rawcp = op;\n\t\t\t\t\ttif->tif_rawcc = tif->tif_rawdatasize - occ;\n\t\t\t\t\tif (!TIFFFlushData1(tif))\n\t\t\t\t\t\treturn (-1);\n\t\t\t\t\top = tif->tif_rawcp;\n\t\t\t\t\tocc = tif->tif_rawdatasize - tif->tif_rawcc;\n\t\t\t\t}\n\t\t\t\t*op++ = (tidataval_t) j; occ--;\n\t\t\t\twhile (j--) {\n\t\t\t\t\t*op++ = (tidataval_t)(tp[i++] >> shft & 0xff);\n\t\t\t\t\tocc--;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (rc >= MINRUN) {\t\t/* write out run */\n\t\t\t\t*op++ = (tidataval_t) (128-2+rc);\n\t\t\t\t*op++ = (tidataval_t)(tp[beg] >> shft & 0xff);\n\t\t\t\tocc -= 2;\n\t\t\t} else\n\t\t\t\trc = 0;\n\t\t}\n\ttif->tif_rawcp = op;\n\ttif->tif_rawcc = tif->tif_rawdatasize - occ;\n\n\treturn (1);\n}\n\n/*\n * Encode a strip of pixels.  We break it into rows to\n * avoid encoding runs across row boundaries.\n */\nstatic int\nLogLuvEncodeStrip(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)\n{\n\ttsize_t rowlen = TIFFScanlineSize(tif);\n\n\tassert(cc%rowlen == 0);\n\twhile (cc && (*tif->tif_encoderow)(tif, bp, rowlen, s) == 1)\n\t\tbp += rowlen, cc -= rowlen;\n\treturn (cc == 0);\n}\n\n/*\n * Encode a tile of pixels.  We break it into rows to\n * avoid encoding runs across row boundaries.\n */\nstatic int\nLogLuvEncodeTile(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)\n{\n\ttsize_t rowlen = TIFFTileRowSize(tif);\n\n\tassert(cc%rowlen == 0);\n\twhile (cc && (*tif->tif_encoderow)(tif, bp, rowlen, s) == 1)\n\t\tbp += rowlen, cc -= rowlen;\n\treturn (cc == 0);\n}\n\n/*\n * Encode/Decode functions for converting to and from user formats.\n */\n\n#include \"uvcode.h\"\n\n#ifndef UVSCALE\n#define U_NEU\t\t0.210526316\n#define V_NEU\t\t0.473684211\n#define UVSCALE\t\t410.\n#endif\n\n#ifndef\tM_LN2\n#define M_LN2\t\t0.69314718055994530942\n#endif\n#ifndef M_PI\n#define M_PI\t\t3.14159265358979323846\n#endif\n#define log2(x)\t\t((1./M_LN2)*log(x))\n#define exp2(x)\t\texp(M_LN2*(x))\n\n#define itrunc(x,m)\t((m)==SGILOGENCODE_NODITHER ? \\\n\t\t\t\t(int)(x) : \\\n\t\t\t\t(int)((x) + rand()*(1./RAND_MAX) - .5))\n\n#if !LOGLUV_PUBLIC\nstatic\n#endif\ndouble\nLogL16toY(int p16)\t\t/* compute luminance from 16-bit LogL */\n{\n\tint\tLe = p16 & 0x7fff;\n\tdouble\tY;\n\n\tif (!Le)\n\t\treturn (0.);\n\tY = exp(M_LN2/256.*(Le+.5) - M_LN2*64.);\n\treturn (!(p16 & 0x8000) ? Y : -Y);\n}\n\n#if !LOGLUV_PUBLIC\nstatic\n#endif\nint\nLogL16fromY(double Y, int em)\t/* get 16-bit LogL from Y */\n{\n\tif (Y >= 1.8371976e19)\n\t\treturn (0x7fff);\n\tif (Y <= -1.8371976e19)\n\t\treturn (0xffff);\n\tif (Y > 5.4136769e-20)\n\t\treturn itrunc(256.*(log2(Y) + 64.), em);\n\tif (Y < -5.4136769e-20)\n\t\treturn (~0x7fff | itrunc(256.*(log2(-Y) + 64.), em));\n\treturn (0);\n}\n\nstatic void\nL16toY(LogLuvState* sp, tidata_t op, int n)\n{\n\tint16* l16 = (int16*) sp->tbuf;\n\tfloat* yp = (float*) op;\n\n\twhile (n-- > 0)\n\t\t*yp++ = (float)LogL16toY(*l16++);\n}\n\nstatic void\nL16toGry(LogLuvState* sp, tidata_t op, int n)\n{\n\tint16* l16 = (int16*) sp->tbuf;\n\tuint8* gp = (uint8*) op;\n\n\twhile (n-- > 0) {\n\t\tdouble Y = LogL16toY(*l16++);\n\t\t*gp++ = (uint8) ((Y <= 0.) ? 0 : (Y >= 1.) ? 255 : (int)(256.*sqrt(Y)));\n\t}\n}\n\nstatic void\nL16fromY(LogLuvState* sp, tidata_t op, int n)\n{\n\tint16* l16 = (int16*) sp->tbuf;\n\tfloat* yp = (float*) op;\n\n\twhile (n-- > 0)\n\t\t*l16++ = (int16) (LogL16fromY(*yp++, sp->encode_meth));\n}\n\n#if !LOGLUV_PUBLIC\nstatic\n#endif\nvoid\nXYZtoRGB24(float xyz[3], uint8 rgb[3])\n{\n\tdouble\tr, g, b;\n\t\t\t\t\t/* assume CCIR-709 primaries */\n\tr =  2.690*xyz[0] + -1.276*xyz[1] + -0.414*xyz[2];\n\tg = -1.022*xyz[0] +  1.978*xyz[1] +  0.044*xyz[2];\n\tb =  0.061*xyz[0] + -0.224*xyz[1] +  1.163*xyz[2];\n\t\t\t\t\t/* assume 2.0 gamma for speed */\n\t/* could use integer sqrt approx., but this is probably faster */\n\trgb[0] = (uint8)((r<=0.) ? 0 : (r >= 1.) ? 255 : (int)(256.*sqrt(r)));\n\trgb[1] = (uint8)((g<=0.) ? 0 : (g >= 1.) ? 255 : (int)(256.*sqrt(g)));\n\trgb[2] = (uint8)((b<=0.) ? 0 : (b >= 1.) ? 255 : (int)(256.*sqrt(b)));\n}\n\n#if !LOGLUV_PUBLIC\nstatic\n#endif\ndouble\nLogL10toY(int p10)\t\t/* compute luminance from 10-bit LogL */\n{\n\tif (p10 == 0)\n\t\treturn (0.);\n\treturn (exp(M_LN2/64.*(p10+.5) - M_LN2*12.));\n}\n\n#if !LOGLUV_PUBLIC\nstatic\n#endif\nint\nLogL10fromY(double Y, int em)\t/* get 10-bit LogL from Y */\n{\n\tif (Y >= 15.742)\n\t\treturn (0x3ff);\n\telse if (Y <= .00024283)\n\t\treturn (0);\n\telse\n\t\treturn itrunc(64.*(log2(Y) + 12.), em);\n}\n\n#define NANGLES\t\t100\n#define uv2ang(u, v)\t( (NANGLES*.499999999/M_PI) \\\n\t\t\t\t* atan2((v)-V_NEU,(u)-U_NEU) + .5*NANGLES )\n\nstatic int\noog_encode(double u, double v)\t\t/* encode out-of-gamut chroma */\n{\n\tstatic int\toog_table[NANGLES];\n\tstatic int\tinitialized = 0;\n\tregister int\ti;\n\t\n\tif (!initialized) {\t\t/* set up perimeter table */\n\t\tdouble\teps[NANGLES], ua, va, ang, epsa;\n\t\tint\tui, vi, ustep;\n\t\tfor (i = NANGLES; i--; )\n\t\t\teps[i] = 2.;\n\t\tfor (vi = UV_NVS; vi--; ) {\n\t\t\tva = UV_VSTART + (vi+.5)*UV_SQSIZ;\n\t\t\tustep = uv_row[vi].nus-1;\n\t\t\tif (vi == UV_NVS-1 || vi == 0 || ustep <= 0)\n\t\t\t\tustep = 1;\n\t\t\tfor (ui = uv_row[vi].nus-1; ui >= 0; ui -= ustep) {\n\t\t\t\tua = uv_row[vi].ustart + (ui+.5)*UV_SQSIZ;\n\t\t\t\tang = uv2ang(ua, va);\n                                i = (int) ang;\n\t\t\t\tepsa = fabs(ang - (i+.5));\n\t\t\t\tif (epsa < eps[i]) {\n\t\t\t\t\toog_table[i] = uv_row[vi].ncum + ui;\n\t\t\t\t\teps[i] = epsa;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor (i = NANGLES; i--; )\t/* fill any holes */\n\t\t\tif (eps[i] > 1.5) {\n\t\t\t\tint\ti1, i2;\n\t\t\t\tfor (i1 = 1; i1 < NANGLES/2; i1++)\n\t\t\t\t\tif (eps[(i+i1)%NANGLES] < 1.5)\n\t\t\t\t\t\tbreak;\n\t\t\t\tfor (i2 = 1; i2 < NANGLES/2; i2++)\n\t\t\t\t\tif (eps[(i+NANGLES-i2)%NANGLES] < 1.5)\n\t\t\t\t\t\tbreak;\n\t\t\t\tif (i1 < i2)\n\t\t\t\t\toog_table[i] =\n\t\t\t\t\t\toog_table[(i+i1)%NANGLES];\n\t\t\t\telse\n\t\t\t\t\toog_table[i] =\n\t\t\t\t\t\toog_table[(i+NANGLES-i2)%NANGLES];\n\t\t\t}\n\t\tinitialized = 1;\n\t}\n\ti = (int) uv2ang(u, v);\t\t/* look up hue angle */\n\treturn (oog_table[i]);\n}\n\n#undef uv2ang\n#undef NANGLES\n\n#if !LOGLUV_PUBLIC\nstatic\n#endif\nint\nuv_encode(double u, double v, int em)\t/* encode (u',v') coordinates */\n{\n\tregister int\tvi, ui;\n\n\tif (v < UV_VSTART)\n\t\treturn oog_encode(u, v);\n\tvi = itrunc((v - UV_VSTART)*(1./UV_SQSIZ), em);\n\tif (vi >= UV_NVS)\n\t\treturn oog_encode(u, v);\n\tif (u < uv_row[vi].ustart)\n\t\treturn oog_encode(u, v);\n\tui = itrunc((u - uv_row[vi].ustart)*(1./UV_SQSIZ), em);\n\tif (ui >= uv_row[vi].nus)\n\t\treturn oog_encode(u, v);\n\n\treturn (uv_row[vi].ncum + ui);\n}\n\n#if !LOGLUV_PUBLIC\nstatic\n#endif\nint\nuv_decode(double *up, double *vp, int c)\t/* decode (u',v') index */\n{\n\tint\tupper, lower;\n\tregister int\tui, vi;\n\n\tif (c < 0 || c >= UV_NDIVS)\n\t\treturn (-1);\n\tlower = 0;\t\t\t\t/* binary search */\n\tupper = UV_NVS;\n\twhile (upper - lower > 1) {\n\t\tvi = (lower + upper) >> 1;\n\t\tui = c - uv_row[vi].ncum;\n\t\tif (ui > 0)\n\t\t\tlower = vi;\n\t\telse if (ui < 0)\n\t\t\tupper = vi;\n\t\telse {\n\t\t\tlower = vi;\n\t\t\tbreak;\n\t\t}\n\t}\n\tvi = lower;\n\tui = c - uv_row[vi].ncum;\n\t*up = uv_row[vi].ustart + (ui+.5)*UV_SQSIZ;\n\t*vp = UV_VSTART + (vi+.5)*UV_SQSIZ;\n\treturn (0);\n}\n\n#if !LOGLUV_PUBLIC\nstatic\n#endif\nvoid\nLogLuv24toXYZ(uint32 p, float XYZ[3])\n{\n\tint\tCe;\n\tdouble\tL, u, v, s, x, y;\n\t\t\t\t\t/* decode luminance */\n\tL = LogL10toY(p>>14 & 0x3ff);\n\tif (L <= 0.) {\n\t\tXYZ[0] = XYZ[1] = XYZ[2] = 0.;\n\t\treturn;\n\t}\n\t\t\t\t\t/* decode color */\n\tCe = p & 0x3fff;\n\tif (uv_decode(&u, &v, Ce) < 0) {\n\t\tu = U_NEU; v = V_NEU;\n\t}\n\ts = 1./(6.*u - 16.*v + 12.);\n\tx = 9.*u * s;\n\ty = 4.*v * s;\n\t\t\t\t\t/* convert to XYZ */\n\tXYZ[0] = (float)(x/y * L);\n\tXYZ[1] = (float)L;\n\tXYZ[2] = (float)((1.-x-y)/y * L);\n}\n\n#if !LOGLUV_PUBLIC\nstatic\n#endif\nuint32\nLogLuv24fromXYZ(float XYZ[3], int em)\n{\n\tint\tLe, Ce;\n\tdouble\tu, v, s;\n\t\t\t\t\t/* encode luminance */\n\tLe = LogL10fromY(XYZ[1], em);\n\t\t\t\t\t/* encode color */\n\ts = XYZ[0] + 15.*XYZ[1] + 3.*XYZ[2];\n\tif (!Le || s <= 0.) {\n\t\tu = U_NEU;\n\t\tv = V_NEU;\n\t} else {\n\t\tu = 4.*XYZ[0] / s;\n\t\tv = 9.*XYZ[1] / s;\n\t}\n\tCe = uv_encode(u, v, em);\n\tif (Ce < 0)\t\t\t/* never happens */\n\t\tCe = uv_encode(U_NEU, V_NEU, SGILOGENCODE_NODITHER);\n\t\t\t\t\t/* combine encodings */\n\treturn (Le << 14 | Ce);\n}\n\nstatic void\nLuv24toXYZ(LogLuvState* sp, tidata_t op, int n)\n{\n\tuint32* luv = (uint32*) sp->tbuf;\n\tfloat* xyz = (float*) op;\n\n\twhile (n-- > 0) {\n\t\tLogLuv24toXYZ(*luv, xyz);\n\t\txyz += 3;\n\t\tluv++;\n\t}\n}\n\nstatic void\nLuv24toLuv48(LogLuvState* sp, tidata_t op, int n)\n{\n\tuint32* luv = (uint32*) sp->tbuf;\n\tint16* luv3 = (int16*) op;\n\n\twhile (n-- > 0) {\n\t\tdouble u, v;\n\n\t\t*luv3++ = (int16)((*luv >> 12 & 0xffd) + 13314);\n\t\tif (uv_decode(&u, &v, *luv&0x3fff) < 0) {\n\t\t\tu = U_NEU;\n\t\t\tv = V_NEU;\n\t\t}\n\t\t*luv3++ = (int16)(u * (1L<<15));\n\t\t*luv3++ = (int16)(v * (1L<<15));\n\t\tluv++;\n\t}\n}\n\nstatic void\nLuv24toRGB(LogLuvState* sp, tidata_t op, int n)\n{\n\tuint32* luv = (uint32*) sp->tbuf;\n\tuint8* rgb = (uint8*) op;\n\n\twhile (n-- > 0) {\n\t\tfloat xyz[3];\n\n\t\tLogLuv24toXYZ(*luv++, xyz);\n\t\tXYZtoRGB24(xyz, rgb);\n\t\trgb += 3;\n\t}\n}\n\nstatic void\nLuv24fromXYZ(LogLuvState* sp, tidata_t op, int n)\n{\n\tuint32* luv = (uint32*) sp->tbuf;\n\tfloat* xyz = (float*) op;\n\n\twhile (n-- > 0) {\n\t\t*luv++ = LogLuv24fromXYZ(xyz, sp->encode_meth);\n\t\txyz += 3;\n\t}\n}\n\nstatic void\nLuv24fromLuv48(LogLuvState* sp, tidata_t op, int n)\n{\n\tuint32* luv = (uint32*) sp->tbuf;\n\tint16* luv3 = (int16*) op;\n\n\twhile (n-- > 0) {\n\t\tint Le, Ce;\n\n\t\tif (luv3[0] <= 0)\n\t\t\tLe = 0;\n\t\telse if (luv3[0] >= (1<<12)+3314)\n\t\t\tLe = (1<<10) - 1;\n\t\telse if (sp->encode_meth == SGILOGENCODE_NODITHER)\n\t\t\tLe = (luv3[0]-3314) >> 2;\n\t\telse\n\t\t\tLe = itrunc(.25*(luv3[0]-3314.), sp->encode_meth);\n\n\t\tCe = uv_encode((luv3[1]+.5)/(1<<15), (luv3[2]+.5)/(1<<15),\n\t\t\t\t\tsp->encode_meth);\n\t\tif (Ce < 0)\t/* never happens */\n\t\t\tCe = uv_encode(U_NEU, V_NEU, SGILOGENCODE_NODITHER);\n\t\t*luv++ = (uint32)Le << 14 | Ce;\n\t\tluv3 += 3;\n\t}\n}\n\n#if !LOGLUV_PUBLIC\nstatic\n#endif\nvoid\nLogLuv32toXYZ(uint32 p, float XYZ[3])\n{\n\tdouble\tL, u, v, s, x, y;\n\t\t\t\t\t/* decode luminance */\n\tL = LogL16toY((int)p >> 16);\n\tif (L <= 0.) {\n\t\tXYZ[0] = XYZ[1] = XYZ[2] = 0.;\n\t\treturn;\n\t}\n\t\t\t\t\t/* decode color */\n\tu = 1./UVSCALE * ((p>>8 & 0xff) + .5);\n\tv = 1./UVSCALE * ((p & 0xff) + .5);\n\ts = 1./(6.*u - 16.*v + 12.);\n\tx = 9.*u * s;\n\ty = 4.*v * s;\n\t\t\t\t\t/* convert to XYZ */\n\tXYZ[0] = (float)(x/y * L);\n\tXYZ[1] = (float)L;\n\tXYZ[2] = (float)((1.-x-y)/y * L);\n}\n\n#if !LOGLUV_PUBLIC\nstatic\n#endif\nuint32\nLogLuv32fromXYZ(float XYZ[3], int em)\n{\n\tunsigned int\tLe, ue, ve;\n\tdouble\tu, v, s;\n\t\t\t\t\t/* encode luminance */\n\tLe = (unsigned int)LogL16fromY(XYZ[1], em);\n\t\t\t\t\t/* encode color */\n\ts = XYZ[0] + 15.*XYZ[1] + 3.*XYZ[2];\n\tif (!Le || s <= 0.) {\n\t\tu = U_NEU;\n\t\tv = V_NEU;\n\t} else {\n\t\tu = 4.*XYZ[0] / s;\n\t\tv = 9.*XYZ[1] / s;\n\t}\n\tif (u <= 0.) ue = 0;\n\telse ue = itrunc(UVSCALE*u, em);\n\tif (ue > 255) ue = 255;\n\tif (v <= 0.) ve = 0;\n\telse ve = itrunc(UVSCALE*v, em);\n\tif (ve > 255) ve = 255;\n\t\t\t\t\t/* combine encodings */\n\treturn (Le << 16 | ue << 8 | ve);\n}\n\nstatic void\nLuv32toXYZ(LogLuvState* sp, tidata_t op, int n)\n{\n\tuint32* luv = (uint32*) sp->tbuf;\n\tfloat* xyz = (float*) op;\n\n\twhile (n-- > 0) {\n\t\tLogLuv32toXYZ(*luv++, xyz);\n\t\txyz += 3;\n\t}\n}\n\nstatic void\nLuv32toLuv48(LogLuvState* sp, tidata_t op, int n)\n{\n\tuint32* luv = (uint32*) sp->tbuf;\n\tint16* luv3 = (int16*) op;\n\n\twhile (n-- > 0) {\n\t\tdouble u, v;\n\n\t\t*luv3++ = (int16)(*luv >> 16);\n\t\tu = 1./UVSCALE * ((*luv>>8 & 0xff) + .5);\n\t\tv = 1./UVSCALE * ((*luv & 0xff) + .5);\n\t\t*luv3++ = (int16)(u * (1L<<15));\n\t\t*luv3++ = (int16)(v * (1L<<15));\n\t\tluv++;\n\t}\n}\n\nstatic void\nLuv32toRGB(LogLuvState* sp, tidata_t op, int n)\n{\n\tuint32* luv = (uint32*) sp->tbuf;\n\tuint8* rgb = (uint8*) op;\n\n\twhile (n-- > 0) {\n\t\tfloat xyz[3];\n\n\t\tLogLuv32toXYZ(*luv++, xyz);\n\t\tXYZtoRGB24(xyz, rgb);\n\t\trgb += 3;\n\t}\n}\n\nstatic void\nLuv32fromXYZ(LogLuvState* sp, tidata_t op, int n)\n{\n\tuint32* luv = (uint32*) sp->tbuf;\n\tfloat* xyz = (float*) op;\n\n\twhile (n-- > 0) {\n\t\t*luv++ = LogLuv32fromXYZ(xyz, sp->encode_meth);\n\t\txyz += 3;\n\t}\n}\n\nstatic void\nLuv32fromLuv48(LogLuvState* sp, tidata_t op, int n)\n{\n\tuint32* luv = (uint32*) sp->tbuf;\n\tint16* luv3 = (int16*) op;\n\n\tif (sp->encode_meth == SGILOGENCODE_NODITHER) {\n\t\twhile (n-- > 0) {\n\t\t\t*luv++ = (uint32)luv3[0] << 16 |\n\t\t\t\t(luv3[1]*(uint32)(UVSCALE+.5) >> 7 & 0xff00) |\n\t\t\t\t(luv3[2]*(uint32)(UVSCALE+.5) >> 15 & 0xff);\n\t\t\tluv3 += 3;\n\t\t}\n\t\treturn;\n\t}\n\twhile (n-- > 0) {\n\t\t*luv++ = (uint32)luv3[0] << 16 |\n\t(itrunc(luv3[1]*(UVSCALE/(1<<15)), sp->encode_meth) << 8 & 0xff00) |\n\t\t(itrunc(luv3[2]*(UVSCALE/(1<<15)), sp->encode_meth) & 0xff);\n\t\tluv3 += 3;\n\t}\n}\n\nstatic void\n_logLuvNop(LogLuvState* sp, tidata_t op, int n)\n{\n\t(void) sp; (void) op; (void) n;\n}\n\nstatic int\nLogL16GuessDataFmt(TIFFDirectory *td)\n{\n#define\tPACK(s,b,f)\t(((b)<<6)|((s)<<3)|(f))\n\tswitch (PACK(td->td_samplesperpixel, td->td_bitspersample, td->td_sampleformat)) {\n\tcase PACK(1, 32, SAMPLEFORMAT_IEEEFP):\n\t\treturn (SGILOGDATAFMT_FLOAT);\n\tcase PACK(1, 16, SAMPLEFORMAT_VOID):\n\tcase PACK(1, 16, SAMPLEFORMAT_INT):\n\tcase PACK(1, 16, SAMPLEFORMAT_UINT):\n\t\treturn (SGILOGDATAFMT_16BIT);\n\tcase PACK(1,  8, SAMPLEFORMAT_VOID):\n\tcase PACK(1,  8, SAMPLEFORMAT_UINT):\n\t\treturn (SGILOGDATAFMT_8BIT);\n\t}\n#undef PACK\n\treturn (SGILOGDATAFMT_UNKNOWN);\n}\n\nstatic uint32\nmultiply(size_t m1, size_t m2)\n{\n\tuint32\tbytes = m1 * m2;\n\n\tif (m1 && bytes / m1 != m2)\n\t\tbytes = 0;\n\n\treturn bytes;\n}\n\nstatic int\nLogL16InitState(TIFF* tif)\n{\n\tTIFFDirectory *td = &tif->tif_dir;\n\tLogLuvState* sp = DecoderState(tif);\n\tstatic const char module[] = \"LogL16InitState\";\n\n\tassert(sp != NULL);\n\tassert(td->td_photometric == PHOTOMETRIC_LOGL);\n\n\t/* for some reason, we can't do this in TIFFInitLogL16 */\n\tif (sp->user_datafmt == SGILOGDATAFMT_UNKNOWN)\n\t\tsp->user_datafmt = LogL16GuessDataFmt(td);\n\tswitch (sp->user_datafmt) {\n\tcase SGILOGDATAFMT_FLOAT:\n\t\tsp->pixel_size = sizeof (float);\n\t\tbreak;\n\tcase SGILOGDATAFMT_16BIT:\n\t\tsp->pixel_size = sizeof (int16);\n\t\tbreak;\n\tcase SGILOGDATAFMT_8BIT:\n\t\tsp->pixel_size = sizeof (uint8);\n\t\tbreak;\n\tdefault:\n\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t    \"No support for converting user data format to LogL\");\n\t\treturn (0);\n\t}\n        if( isTiled(tif) )\n            sp->tbuflen = multiply(td->td_tilewidth, td->td_tilelength);\n        else\n            sp->tbuflen = multiply(td->td_imagewidth, td->td_rowsperstrip);\n\tif (multiply(sp->tbuflen, sizeof (int16)) == 0 ||\n\t    (sp->tbuf = (tidata_t*) _TIFFmalloc(sp->tbuflen * sizeof (int16))) == NULL) {\n\t\tTIFFErrorExt(tif->tif_clientdata, module, \"%s: No space for SGILog translation buffer\",\n\t\t    tif->tif_name);\n\t\treturn (0);\n\t}\n\treturn (1);\n}\n\nstatic int\nLogLuvGuessDataFmt(TIFFDirectory *td)\n{\n\tint guess;\n\n\t/*\n\t * If the user didn't tell us their datafmt,\n\t * take our best guess from the bitspersample.\n\t */\n#define\tPACK(a,b)\t(((a)<<3)|(b))\n\tswitch (PACK(td->td_bitspersample, td->td_sampleformat)) {\n\tcase PACK(32, SAMPLEFORMAT_IEEEFP):\n\t\tguess = SGILOGDATAFMT_FLOAT;\n\t\tbreak;\n\tcase PACK(32, SAMPLEFORMAT_VOID):\n\tcase PACK(32, SAMPLEFORMAT_UINT):\n\tcase PACK(32, SAMPLEFORMAT_INT):\n\t\tguess = SGILOGDATAFMT_RAW;\n\t\tbreak;\n\tcase PACK(16, SAMPLEFORMAT_VOID):\n\tcase PACK(16, SAMPLEFORMAT_INT):\n\tcase PACK(16, SAMPLEFORMAT_UINT):\n\t\tguess = SGILOGDATAFMT_16BIT;\n\t\tbreak;\n\tcase PACK( 8, SAMPLEFORMAT_VOID):\n\tcase PACK( 8, SAMPLEFORMAT_UINT):\n\t\tguess = SGILOGDATAFMT_8BIT;\n\t\tbreak;\n\tdefault:\n\t\tguess = SGILOGDATAFMT_UNKNOWN;\n\t\tbreak;\n#undef PACK\n\t}\n\t/*\n\t * Double-check samples per pixel.\n\t */\n\tswitch (td->td_samplesperpixel) {\n\tcase 1:\n\t\tif (guess != SGILOGDATAFMT_RAW)\n\t\t\tguess = SGILOGDATAFMT_UNKNOWN;\n\t\tbreak;\n\tcase 3:\n\t\tif (guess == SGILOGDATAFMT_RAW)\n\t\t\tguess = SGILOGDATAFMT_UNKNOWN;\n\t\tbreak;\n\tdefault:\n\t\tguess = SGILOGDATAFMT_UNKNOWN;\n\t\tbreak;\n\t}\n\treturn (guess);\n}\n\nstatic int\nLogLuvInitState(TIFF* tif)\n{\n\tTIFFDirectory* td = &tif->tif_dir;\n\tLogLuvState* sp = DecoderState(tif);\n\tstatic const char module[] = \"LogLuvInitState\";\n\n\tassert(sp != NULL);\n\tassert(td->td_photometric == PHOTOMETRIC_LOGLUV);\n\n\t/* for some reason, we can't do this in TIFFInitLogLuv */\n\tif (td->td_planarconfig != PLANARCONFIG_CONTIG) {\n\t\tTIFFErrorExt(tif->tif_clientdata, module,\n\t\t    \"SGILog compression cannot handle non-contiguous data\");\n\t\treturn (0);\n\t}\n\tif (sp->user_datafmt == SGILOGDATAFMT_UNKNOWN)\n\t\tsp->user_datafmt = LogLuvGuessDataFmt(td);\n\tswitch (sp->user_datafmt) {\n\tcase SGILOGDATAFMT_FLOAT:\n\t\tsp->pixel_size = 3*sizeof (float);\n\t\tbreak;\n\tcase SGILOGDATAFMT_16BIT:\n\t\tsp->pixel_size = 3*sizeof (int16);\n\t\tbreak;\n\tcase SGILOGDATAFMT_RAW:\n\t\tsp->pixel_size = sizeof (uint32);\n\t\tbreak;\n\tcase SGILOGDATAFMT_8BIT:\n\t\tsp->pixel_size = 3*sizeof (uint8);\n\t\tbreak;\n\tdefault:\n\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t    \"No support for converting user data format to LogLuv\");\n\t\treturn (0);\n\t}\n        if( isTiled(tif) )\n            sp->tbuflen = multiply(td->td_tilewidth, td->td_tilelength);\n        else\n            sp->tbuflen = multiply(td->td_imagewidth, td->td_rowsperstrip);\n\tif (multiply(sp->tbuflen, sizeof (uint32)) == 0 ||\n\t    (sp->tbuf = (tidata_t*) _TIFFmalloc(sp->tbuflen * sizeof (uint32))) == NULL) {\n\t\tTIFFErrorExt(tif->tif_clientdata, module, \"%s: No space for SGILog translation buffer\",\n\t\t    tif->tif_name);\n\t\treturn (0);\n\t}\n\treturn (1);\n}\n\nstatic int\nLogLuvSetupDecode(TIFF* tif)\n{\n\tLogLuvState* sp = DecoderState(tif);\n\tTIFFDirectory* td = &tif->tif_dir;\n\n\ttif->tif_postdecode = _TIFFNoPostDecode;\n\tswitch (td->td_photometric) {\n\tcase PHOTOMETRIC_LOGLUV:\n\t\tif (!LogLuvInitState(tif))\n\t\t\tbreak;\n\t\tif (td->td_compression == COMPRESSION_SGILOG24) {\n\t\t\ttif->tif_decoderow = LogLuvDecode24;\n\t\t\tswitch (sp->user_datafmt) {\n\t\t\tcase SGILOGDATAFMT_FLOAT:\n\t\t\t\tsp->tfunc = Luv24toXYZ;\n\t\t\t\tbreak;\n\t\t\tcase SGILOGDATAFMT_16BIT:\n\t\t\t\tsp->tfunc = Luv24toLuv48;\n\t\t\t\tbreak;\n\t\t\tcase SGILOGDATAFMT_8BIT:\n\t\t\t\tsp->tfunc = Luv24toRGB;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t} else {\n\t\t\ttif->tif_decoderow = LogLuvDecode32;\n\t\t\tswitch (sp->user_datafmt) {\n\t\t\tcase SGILOGDATAFMT_FLOAT:\n\t\t\t\tsp->tfunc = Luv32toXYZ;\n\t\t\t\tbreak;\n\t\t\tcase SGILOGDATAFMT_16BIT:\n\t\t\t\tsp->tfunc = Luv32toLuv48;\n\t\t\t\tbreak;\n\t\t\tcase SGILOGDATAFMT_8BIT:\n\t\t\t\tsp->tfunc = Luv32toRGB;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn (1);\n\tcase PHOTOMETRIC_LOGL:\n\t\tif (!LogL16InitState(tif))\n\t\t\tbreak;\n\t\ttif->tif_decoderow = LogL16Decode;\n\t\tswitch (sp->user_datafmt) {\n\t\tcase SGILOGDATAFMT_FLOAT:\n\t\t\tsp->tfunc = L16toY;\n\t\t\tbreak;\n\t\tcase SGILOGDATAFMT_8BIT:\n\t\t\tsp->tfunc = L16toGry;\n\t\t\tbreak;\n\t\t}\n\t\treturn (1);\n\tdefault:\n\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n    \"Inappropriate photometric interpretation %d for SGILog compression; %s\",\n\t\t    td->td_photometric, \"must be either LogLUV or LogL\");\n\t\tbreak;\n\t}\n\treturn (0);\n}\n\nstatic int\nLogLuvSetupEncode(TIFF* tif)\n{\n\tLogLuvState* sp = EncoderState(tif);\n\tTIFFDirectory* td = &tif->tif_dir;\n\n\tswitch (td->td_photometric) {\n\tcase PHOTOMETRIC_LOGLUV:\n\t\tif (!LogLuvInitState(tif))\n\t\t\tbreak;\n\t\tif (td->td_compression == COMPRESSION_SGILOG24) {\n\t\t\ttif->tif_encoderow = LogLuvEncode24;\n\t\t\tswitch (sp->user_datafmt) {\n\t\t\tcase SGILOGDATAFMT_FLOAT:\n\t\t\t\tsp->tfunc = Luv24fromXYZ;\n\t\t\t\tbreak;\n\t\t\tcase SGILOGDATAFMT_16BIT:\n\t\t\t\tsp->tfunc = Luv24fromLuv48;\n\t\t\t\tbreak;\n\t\t\tcase SGILOGDATAFMT_RAW:\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tgoto notsupported;\n\t\t\t}\n\t\t} else {\n\t\t\ttif->tif_encoderow = LogLuvEncode32;\n\t\t\tswitch (sp->user_datafmt) {\n\t\t\tcase SGILOGDATAFMT_FLOAT:\n\t\t\t\tsp->tfunc = Luv32fromXYZ;\n\t\t\t\tbreak;\n\t\t\tcase SGILOGDATAFMT_16BIT:\n\t\t\t\tsp->tfunc = Luv32fromLuv48;\n\t\t\t\tbreak;\n\t\t\tcase SGILOGDATAFMT_RAW:\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tgoto notsupported;\n\t\t\t}\n\t\t}\n\t\tbreak;\n\tcase PHOTOMETRIC_LOGL:\n\t\tif (!LogL16InitState(tif))\n\t\t\tbreak;\n\t\ttif->tif_encoderow = LogL16Encode;\n\t\tswitch (sp->user_datafmt) {\n\t\tcase SGILOGDATAFMT_FLOAT:\n\t\t\tsp->tfunc = L16fromY;\n\t\t\tbreak;\n\t\tcase SGILOGDATAFMT_16BIT:\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tgoto notsupported;\n\t\t}\n\t\tbreak;\n\tdefault:\n\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n    \"Inappropriate photometric interpretation %d for SGILog compression; %s\",\n    \t\t    td->td_photometric, \"must be either LogLUV or LogL\");\n\t\tbreak;\n\t}\n\treturn (1);\nnotsupported:\n\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t    \"SGILog compression supported only for %s, or raw data\",\n\t    td->td_photometric == PHOTOMETRIC_LOGL ? \"Y, L\" : \"XYZ, Luv\");\n\treturn (0);\n}\n\nstatic void\nLogLuvClose(TIFF* tif)\n{\n\tTIFFDirectory *td = &tif->tif_dir;\n\n\t/*\n\t * For consistency, we always want to write out the same\n\t * bitspersample and sampleformat for our TIFF file,\n\t * regardless of the data format being used by the application.\n\t * Since this routine is called after tags have been set but\n\t * before they have been recorded in the file, we reset them here.\n\t */\n\ttd->td_samplesperpixel =\n\t    (td->td_photometric == PHOTOMETRIC_LOGL) ? 1 : 3;\n\ttd->td_bitspersample = 16;\n\ttd->td_sampleformat = SAMPLEFORMAT_INT;\n}\n\nstatic void\nLogLuvCleanup(TIFF* tif)\n{\n\tLogLuvState* sp = (LogLuvState *)tif->tif_data;\n\n\tassert(sp != 0);\n\n\ttif->tif_tagmethods.vgetfield = sp->vgetparent;\n\ttif->tif_tagmethods.vsetfield = sp->vsetparent;\n\n\tif (sp->tbuf)\n\t\t_TIFFfree(sp->tbuf);\n\t_TIFFfree(sp);\n\ttif->tif_data = NULL;\n\n\t_TIFFSetDefaultCompressionState(tif);\n}\n\nstatic int\nLogLuvVSetField(TIFF* tif, ttag_t tag, va_list ap)\n{\n\tLogLuvState* sp = DecoderState(tif);\n\tint bps, fmt;\n\n\tswitch (tag) {\n\tcase TIFFTAG_SGILOGDATAFMT:\n\t\tsp->user_datafmt = va_arg(ap, int);\n\t\t/*\n\t\t * Tweak the TIFF header so that the rest of libtiff knows what\n\t\t * size of data will be passed between app and library, and\n\t\t * assume that the app knows what it is doing and is not\n\t\t * confused by these header manipulations...\n\t\t */\n\t\tswitch (sp->user_datafmt) {\n\t\tcase SGILOGDATAFMT_FLOAT:\n\t\t\tbps = 32, fmt = SAMPLEFORMAT_IEEEFP;\n\t\t\tbreak;\n\t\tcase SGILOGDATAFMT_16BIT:\n\t\t\tbps = 16, fmt = SAMPLEFORMAT_INT;\n\t\t\tbreak;\n\t\tcase SGILOGDATAFMT_RAW:\n\t\t\tbps = 32, fmt = SAMPLEFORMAT_UINT;\n\t\t\tTIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 1);\n\t\t\tbreak;\n\t\tcase SGILOGDATAFMT_8BIT:\n\t\t\tbps = 8, fmt = SAMPLEFORMAT_UINT;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t\t    \"Unknown data format %d for LogLuv compression\",\n\t\t\t    sp->user_datafmt);\n\t\t\treturn (0);\n\t\t}\n\t\tTIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, bps);\n\t\tTIFFSetField(tif, TIFFTAG_SAMPLEFORMAT, fmt);\n\t\t/*\n\t\t * Must recalculate sizes should bits/sample change.\n\t\t */\n\t\ttif->tif_tilesize = isTiled(tif) ? TIFFTileSize(tif) : (tsize_t) -1;\n\t\ttif->tif_scanlinesize = TIFFScanlineSize(tif);\n\t\treturn (1);\n\tcase TIFFTAG_SGILOGENCODE:\n\t\tsp->encode_meth = va_arg(ap, int);\n\t\tif (sp->encode_meth != SGILOGENCODE_NODITHER &&\n\t\t\t\tsp->encode_meth != SGILOGENCODE_RANDITHER) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t\t\t\"Unknown encoding %d for LogLuv compression\",\n\t\t\t\tsp->encode_meth);\n\t\t\treturn (0);\n\t\t}\n\t\treturn (1);\n\tdefault:\n\t\treturn (*sp->vsetparent)(tif, tag, ap);\n\t}\n}\n\nstatic int\nLogLuvVGetField(TIFF* tif, ttag_t tag, va_list ap)\n{\n\tLogLuvState *sp = (LogLuvState *)tif->tif_data;\n\n\tswitch (tag) {\n\tcase TIFFTAG_SGILOGDATAFMT:\n\t\t*va_arg(ap, int*) = sp->user_datafmt;\n\t\treturn (1);\n\tdefault:\n\t\treturn (*sp->vgetparent)(tif, tag, ap);\n\t}\n}\n\nstatic const TIFFFieldInfo LogLuvFieldInfo[] = {\n    { TIFFTAG_SGILOGDATAFMT,\t  0, 0,\tTIFF_SHORT,\tFIELD_PSEUDO,\n      TRUE,\tFALSE,\t\"SGILogDataFmt\"},\n    { TIFFTAG_SGILOGENCODE,\t  0, 0, TIFF_SHORT,\tFIELD_PSEUDO,\n      TRUE,\tFALSE,\t\"SGILogEncode\"}\n};\n\nint\nTIFFInitSGILog(TIFF* tif, int scheme)\n{\n\tstatic const char module[] = \"TIFFInitSGILog\";\n\tLogLuvState* sp;\n\n\tassert(scheme == COMPRESSION_SGILOG24 || scheme == COMPRESSION_SGILOG);\n\n\t/*\n\t * Merge codec-specific tag information.\n\t */\n\tif (!_TIFFMergeFieldInfo(tif, LogLuvFieldInfo,\n\t\t\t\t TIFFArrayCount(LogLuvFieldInfo))) {\n\t\tTIFFErrorExt(tif->tif_clientdata, module,\n\t\t\t     \"Merging SGILog codec-specific tags failed\");\n\t\treturn 0;\n\t}\n\n\t/*\n\t * Allocate state block so tag methods have storage to record values.\n\t */\n\ttif->tif_data = (tidata_t) _TIFFmalloc(sizeof (LogLuvState));\n\tif (tif->tif_data == NULL)\n\t\tgoto bad;\n\tsp = (LogLuvState*) tif->tif_data;\n\t_TIFFmemset((tdata_t)sp, 0, sizeof (*sp));\n\tsp->user_datafmt = SGILOGDATAFMT_UNKNOWN;\n\tsp->encode_meth = (scheme == COMPRESSION_SGILOG24) ?\n\t\t\t\tSGILOGENCODE_RANDITHER : SGILOGENCODE_NODITHER;\n\tsp->tfunc = _logLuvNop;\n\n\t/*\n\t * Install codec methods.\n\t * NB: tif_decoderow & tif_encoderow are filled\n\t *     in at setup time.\n\t */\n\ttif->tif_setupdecode = LogLuvSetupDecode;\n\ttif->tif_decodestrip = LogLuvDecodeStrip;\n\ttif->tif_decodetile = LogLuvDecodeTile;\n\ttif->tif_setupencode = LogLuvSetupEncode;\n\ttif->tif_encodestrip = LogLuvEncodeStrip;\n\ttif->tif_encodetile = LogLuvEncodeTile;\n\ttif->tif_close = LogLuvClose;\n\ttif->tif_cleanup = LogLuvCleanup;\n\n\t/* \n\t * Override parent get/set field methods.\n\t */\n\tsp->vgetparent = tif->tif_tagmethods.vgetfield;\n\ttif->tif_tagmethods.vgetfield = LogLuvVGetField;   /* hook for codec tags */\n\tsp->vsetparent = tif->tif_tagmethods.vsetfield;\n\ttif->tif_tagmethods.vsetfield = LogLuvVSetField;   /* hook for codec tags */\n\n\treturn (1);\nbad:\n\tTIFFErrorExt(tif->tif_clientdata, module,\n\t\t     \"%s: No space for LogLuv state block\", tif->tif_name);\n\treturn (0);\n}\n#endif /* LOGLUV_SUPPORT */\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/tif_lzw.c",
    "content": "/* $Id: tif_lzw.c,v 1.29.2.5 2009-06-22 04:57:31 fwarmerdam Exp $ */\n\n/*\n * Copyright (c) 1988-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n#include \"tiffiop.h\"\n#ifdef LZW_SUPPORT\n/*\n * TIFF Library.\n * Rev 5.0 Lempel-Ziv & Welch Compression Support\n *\n * This code is derived from the compress program whose code is\n * derived from software contributed to Berkeley by James A. Woods,\n * derived from original work by Spencer Thomas and Joseph Orost.\n *\n * The original Berkeley copyright notice appears below in its entirety.\n */\n#include \"tif_predict.h\"\n\n#include <stdio.h>\n\n/*\n * NB: The 5.0 spec describes a different algorithm than Aldus\n *     implements.  Specifically, Aldus does code length transitions\n *     one code earlier than should be done (for real LZW).\n *     Earlier versions of this library implemented the correct\n *     LZW algorithm, but emitted codes in a bit order opposite\n *     to the TIFF spec.  Thus, to maintain compatibility w/ Aldus\n *     we interpret MSB-LSB ordered codes to be images written w/\n *     old versions of this library, but otherwise adhere to the\n *     Aldus \"off by one\" algorithm.\n *\n * Future revisions to the TIFF spec are expected to \"clarify this issue\".\n */\n#define\tLZW_COMPAT\t\t/* include backwards compatibility code */\n/*\n * Each strip of data is supposed to be terminated by a CODE_EOI.\n * If the following #define is included, the decoder will also\n * check for end-of-strip w/o seeing this code.  This makes the\n * library more robust, but also slower.\n */\n#define\tLZW_CHECKEOS\t\t/* include checks for strips w/o EOI code */\n\n#define MAXCODE(n)\t((1L<<(n))-1)\n/*\n * The TIFF spec specifies that encoded bit\n * strings range from 9 to 12 bits.\n */\n#define\tBITS_MIN\t9\t\t/* start with 9 bits */\n#define\tBITS_MAX\t12\t\t/* max of 12 bit strings */\n/* predefined codes */\n#define\tCODE_CLEAR\t256\t\t/* code to clear string table */\n#define\tCODE_EOI\t257\t\t/* end-of-information code */\n#define CODE_FIRST\t258\t\t/* first free code entry */\n#define\tCODE_MAX\tMAXCODE(BITS_MAX)\n#define\tHSIZE\t\t9001L\t\t/* 91% occupancy */\n#define\tHSHIFT\t\t(13-8)\n#ifdef LZW_COMPAT\n/* NB: +1024 is for compatibility with old files */\n#define\tCSIZE\t\t(MAXCODE(BITS_MAX)+1024L)\n#else\n#define\tCSIZE\t\t(MAXCODE(BITS_MAX)+1L)\n#endif\n\n/*\n * State block for each open TIFF file using LZW\n * compression/decompression.  Note that the predictor\n * state block must be first in this data structure.\n */\ntypedef\tstruct {\n\tTIFFPredictorState predict;\t/* predictor super class */\n\n\tunsigned short\tnbits;\t\t/* # of bits/code */\n\tunsigned short\tmaxcode;\t/* maximum code for lzw_nbits */\n\tunsigned short\tfree_ent;\t/* next free entry in hash table */\n\tlong\t\tnextdata;\t/* next bits of i/o */\n\tlong\t\tnextbits;\t/* # of valid bits in lzw_nextdata */\n\n        int             rw_mode;        /* preserve rw_mode from init */\n} LZWBaseState;\n\n#define\tlzw_nbits\tbase.nbits\n#define\tlzw_maxcode\tbase.maxcode\n#define\tlzw_free_ent\tbase.free_ent\n#define\tlzw_nextdata\tbase.nextdata\n#define\tlzw_nextbits\tbase.nextbits\n\n/*\n * Encoding-specific state.\n */\ntypedef uint16 hcode_t;\t\t\t/* codes fit in 16 bits */\ntypedef struct {\n\tlong\thash;\n\thcode_t\tcode;\n} hash_t;\n\n/*\n * Decoding-specific state.\n */\ntypedef struct code_ent {\n\tstruct code_ent *next;\n\tunsigned short\tlength;\t\t/* string len, including this token */\n\tunsigned char\tvalue;\t\t/* data value */\n\tunsigned char\tfirstchar;\t/* first token of string */\n} code_t;\n\ntypedef\tint (*decodeFunc)(TIFF*, tidata_t, tsize_t, tsample_t);\n\ntypedef struct {\n\tLZWBaseState base;\n\n\t/* Decoding specific data */\n\tlong\tdec_nbitsmask;\t\t/* lzw_nbits 1 bits, right adjusted */\n\tlong\tdec_restart;\t\t/* restart count */\n#ifdef LZW_CHECKEOS\n\tlong\tdec_bitsleft;\t\t/* available bits in raw data */\n#endif\n\tdecodeFunc dec_decode;\t\t/* regular or backwards compatible */\n\tcode_t*\tdec_codep;\t\t/* current recognized code */\n\tcode_t*\tdec_oldcodep;\t\t/* previously recognized code */\n\tcode_t*\tdec_free_entp;\t\t/* next free entry */\n\tcode_t*\tdec_maxcodep;\t\t/* max available entry */\n\tcode_t*\tdec_codetab;\t\t/* kept separate for small machines */\n\n\t/* Encoding specific data */\n\tint\tenc_oldcode;\t\t/* last code encountered */\n\tlong\tenc_checkpoint;\t\t/* point at which to clear table */\n#define CHECK_GAP\t10000\t\t/* enc_ratio check interval */\n\tlong\tenc_ratio;\t\t/* current compression ratio */\n\tlong\tenc_incount;\t\t/* (input) data bytes encoded */\n\tlong\tenc_outcount;\t\t/* encoded (output) bytes */\n\ttidata_t enc_rawlimit;\t\t/* bound on tif_rawdata buffer */\n\thash_t*\tenc_hashtab;\t\t/* kept separate for small machines */\n} LZWCodecState;\n\n#define\tLZWState(tif)\t\t((LZWBaseState*) (tif)->tif_data)\n#define\tDecoderState(tif)\t((LZWCodecState*) LZWState(tif))\n#define\tEncoderState(tif)\t((LZWCodecState*) LZWState(tif))\n\nstatic\tint LZWDecode(TIFF*, tidata_t, tsize_t, tsample_t);\n#ifdef LZW_COMPAT\nstatic\tint LZWDecodeCompat(TIFF*, tidata_t, tsize_t, tsample_t);\n#endif\nstatic  void cl_hash(LZWCodecState*);\n\n/*\n * LZW Decoder.\n */\n\n#ifdef LZW_CHECKEOS\n/*\n * This check shouldn't be necessary because each\n * strip is suppose to be terminated with CODE_EOI.\n */\n#define\tNextCode(_tif, _sp, _bp, _code, _get) {\t\t\t\t\\\n\tif ((_sp)->dec_bitsleft < nbits) {\t\t\t\t\\\n\t\tTIFFWarningExt(_tif->tif_clientdata, _tif->tif_name,\t\t\t\t\\\n\t\t    \"LZWDecode: Strip %d not terminated with EOI code\", \\\n\t\t    _tif->tif_curstrip);\t\t\t\t\\\n\t\t_code = CODE_EOI;\t\t\t\t\t\\\n\t} else {\t\t\t\t\t\t\t\\\n\t\t_get(_sp,_bp,_code);\t\t\t\t\t\\\n\t\t(_sp)->dec_bitsleft -= nbits;\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n}\n#else\n#define\tNextCode(tif, sp, bp, code, get) get(sp, bp, code)\n#endif\n\nstatic int\nLZWSetupDecode(TIFF* tif)\n{\n\tLZWCodecState* sp = DecoderState(tif);\n\tstatic const char module[] = \" LZWSetupDecode\";\n\tint code;\n\n        if( sp == NULL )\n        {\n            /*\n             * Allocate state block so tag methods have storage to record \n\t\t\t * values.\n             */\n            tif->tif_data = (tidata_t) _TIFFmalloc(sizeof(LZWCodecState));\n            if (tif->tif_data == NULL)\n            {\n\t\t\t\tTIFFErrorExt(tif->tif_clientdata, \"LZWPreDecode\", \"No space for LZW state block\");\n                return (0);\n            }\n\n            DecoderState(tif)->dec_codetab = NULL;\n            DecoderState(tif)->dec_decode = NULL;\n            \n            /*\n             * Setup predictor setup.\n             */\n            (void) TIFFPredictorInit(tif);\n\n            sp = DecoderState(tif);\n        }\n            \n\tassert(sp != NULL);\n\n\tif (sp->dec_codetab == NULL) {\n\t\tsp->dec_codetab = (code_t*)_TIFFmalloc(CSIZE*sizeof (code_t));\n\t\tif (sp->dec_codetab == NULL) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, module,\n\t\t\t\t     \"No space for LZW code table\");\n\t\t\treturn (0);\n\t\t}\n\t\t/*\n\t\t * Pre-load the table.\n\t\t */\n                code = 255;\n                do {\n                    sp->dec_codetab[code].value = code;\n                    sp->dec_codetab[code].firstchar = code;\n                    sp->dec_codetab[code].length = 1;\n                    sp->dec_codetab[code].next = NULL;\n                } while (code--);\n\t\t/*\n\t\t * Zero-out the unused entries\n                 */\n                 _TIFFmemset(&sp->dec_codetab[CODE_CLEAR], 0,\n\t\t\t     (CODE_FIRST - CODE_CLEAR) * sizeof (code_t));\n\t}\n\treturn (1);\n}\n\n/*\n * Setup state for decoding a strip.\n */\nstatic int\nLZWPreDecode(TIFF* tif, tsample_t s)\n{\n\tLZWCodecState *sp = DecoderState(tif);\n\n\t(void) s;\n\tassert(sp != NULL);\n        if( sp->dec_codetab == NULL )\n        {\n            tif->tif_setupdecode( tif );\n        }\n\n\t/*\n\t * Check for old bit-reversed codes.\n\t */\n\tif (tif->tif_rawdata[0] == 0 && (tif->tif_rawdata[1] & 0x1)) {\n#ifdef LZW_COMPAT\n\t\tif (!sp->dec_decode) {\n\t\t\tTIFFWarningExt(tif->tif_clientdata, tif->tif_name,\n\t\t\t    \"Old-style LZW codes, convert file\");\n\t\t\t/*\n\t\t\t * Override default decoding methods with\n\t\t\t * ones that deal with the old coding.\n\t\t\t * Otherwise the predictor versions set\n\t\t\t * above will call the compatibility routines\n\t\t\t * through the dec_decode method.\n\t\t\t */\n\t\t\ttif->tif_decoderow = LZWDecodeCompat;\n\t\t\ttif->tif_decodestrip = LZWDecodeCompat;\n\t\t\ttif->tif_decodetile = LZWDecodeCompat;\n\t\t\t/*\n\t\t\t * If doing horizontal differencing, must\n\t\t\t * re-setup the predictor logic since we\n\t\t\t * switched the basic decoder methods...\n\t\t\t */\n\t\t\t(*tif->tif_setupdecode)(tif);\n\t\t\tsp->dec_decode = LZWDecodeCompat;\n\t\t}\n\t\tsp->lzw_maxcode = MAXCODE(BITS_MIN);\n#else /* !LZW_COMPAT */\n\t\tif (!sp->dec_decode) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t\t    \"Old-style LZW codes not supported\");\n\t\t\tsp->dec_decode = LZWDecode;\n\t\t}\n\t\treturn (0);\n#endif/* !LZW_COMPAT */\n\t} else {\n\t\tsp->lzw_maxcode = MAXCODE(BITS_MIN)-1;\n\t\tsp->dec_decode = LZWDecode;\n\t}\n\tsp->lzw_nbits = BITS_MIN;\n\tsp->lzw_nextbits = 0;\n\tsp->lzw_nextdata = 0;\n\n\tsp->dec_restart = 0;\n\tsp->dec_nbitsmask = MAXCODE(BITS_MIN);\n#ifdef LZW_CHECKEOS\n\tsp->dec_bitsleft = tif->tif_rawcc << 3;\n#endif\n\tsp->dec_free_entp = sp->dec_codetab + CODE_FIRST;\n\t/*\n\t * Zero entries that are not yet filled in.  We do\n\t * this to guard against bogus input data that causes\n\t * us to index into undefined entries.  If you can\n\t * come up with a way to safely bounds-check input codes\n\t * while decoding then you can remove this operation.\n\t */\n\t_TIFFmemset(sp->dec_free_entp, 0, (CSIZE-CODE_FIRST)*sizeof (code_t));\n\tsp->dec_oldcodep = &sp->dec_codetab[-1];\n\tsp->dec_maxcodep = &sp->dec_codetab[sp->dec_nbitsmask-1];\n\treturn (1);\n}\n\n/*\n * Decode a \"hunk of data\".\n */\n#define\tGetNextCode(sp, bp, code) {\t\t\t\t\\\n\tnextdata = (nextdata<<8) | *(bp)++;\t\t\t\\\n\tnextbits += 8;\t\t\t\t\t\t\\\n\tif (nextbits < nbits) {\t\t\t\t\t\\\n\t\tnextdata = (nextdata<<8) | *(bp)++;\t\t\\\n\t\tnextbits += 8;\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\\\n\tcode = (hcode_t)((nextdata >> (nextbits-nbits)) & nbitsmask);\t\\\n\tnextbits -= nbits;\t\t\t\t\t\\\n}\n\nstatic void\ncodeLoop(TIFF* tif)\n{\n\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t    \"LZWDecode: Bogus encoding, loop in the code table; scanline %d\",\n\t    tif->tif_row);\n}\n\nstatic int\nLZWDecode(TIFF* tif, tidata_t op0, tsize_t occ0, tsample_t s)\n{\n\tLZWCodecState *sp = DecoderState(tif);\n\tchar *op = (char*) op0;\n\tlong occ = (long) occ0;\n\tchar *tp;\n\tunsigned char *bp;\n\thcode_t code;\n\tint len;\n\tlong nbits, nextbits, nextdata, nbitsmask;\n\tcode_t *codep, *free_entp, *maxcodep, *oldcodep;\n\n\t(void) s;\n\tassert(sp != NULL);\n        assert(sp->dec_codetab != NULL);\n\t/*\n\t * Restart interrupted output operation.\n\t */\n\tif (sp->dec_restart) {\n\t\tlong residue;\n\n\t\tcodep = sp->dec_codep;\n\t\tresidue = codep->length - sp->dec_restart;\n\t\tif (residue > occ) {\n\t\t\t/*\n\t\t\t * Residue from previous decode is sufficient\n\t\t\t * to satisfy decode request.  Skip to the\n\t\t\t * start of the decoded string, place decoded\n\t\t\t * values in the output buffer, and return.\n\t\t\t */\n\t\t\tsp->dec_restart += occ;\n\t\t\tdo {\n\t\t\t\tcodep = codep->next;\n\t\t\t} while (--residue > occ && codep);\n\t\t\tif (codep) {\n\t\t\t\ttp = op + occ;\n\t\t\t\tdo {\n\t\t\t\t\t*--tp = codep->value;\n\t\t\t\t\tcodep = codep->next;\n\t\t\t\t} while (--occ && codep);\n\t\t\t}\n\t\t\treturn (1);\n\t\t}\n\t\t/*\n\t\t * Residue satisfies only part of the decode request.\n\t\t */\n\t\top += residue, occ -= residue;\n\t\ttp = op;\n\t\tdo {\n\t\t\tint t;\n\t\t\t--tp;\n\t\t\tt = codep->value;\n\t\t\tcodep = codep->next;\n\t\t\t*tp = t;\n\t\t} while (--residue && codep);\n\t\tsp->dec_restart = 0;\n\t}\n\n\tbp = (unsigned char *)tif->tif_rawcp;\n\tnbits = sp->lzw_nbits;\n\tnextdata = sp->lzw_nextdata;\n\tnextbits = sp->lzw_nextbits;\n\tnbitsmask = sp->dec_nbitsmask;\n\toldcodep = sp->dec_oldcodep;\n\tfree_entp = sp->dec_free_entp;\n\tmaxcodep = sp->dec_maxcodep;\n\n\twhile (occ > 0) {\n\t\tNextCode(tif, sp, bp, code, GetNextCode);\n\t\tif (code == CODE_EOI)\n\t\t\tbreak;\n\t\tif (code == CODE_CLEAR) {\n\t\t\tfree_entp = sp->dec_codetab + CODE_FIRST;\n\t\t\t_TIFFmemset(free_entp, 0,\n\t\t\t\t    (CSIZE - CODE_FIRST) * sizeof (code_t));\n\t\t\tnbits = BITS_MIN;\n\t\t\tnbitsmask = MAXCODE(BITS_MIN);\n\t\t\tmaxcodep = sp->dec_codetab + nbitsmask-1;\n\t\t\tNextCode(tif, sp, bp, code, GetNextCode);\n\t\t\tif (code == CODE_EOI)\n\t\t\t\tbreak;\n\t\t\tif (code == CODE_CLEAR) {\n\t\t\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t\t\t\"LZWDecode: Corrupted LZW table at scanline %d\",\n\t\t\t\t\t     tif->tif_row);\n\t\t\t\treturn (0);\n\t\t\t}\n\t\t\t*op++ = (char)code, occ--;\n\t\t\toldcodep = sp->dec_codetab + code;\n\t\t\tcontinue;\n\t\t}\n\t\tcodep = sp->dec_codetab + code;\n\n\t\t/*\n\t \t * Add the new entry to the code table.\n\t \t */\n\t\tif (free_entp < &sp->dec_codetab[0] ||\n\t\t\tfree_entp >= &sp->dec_codetab[CSIZE]) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t\t\"LZWDecode: Corrupted LZW table at scanline %d\",\n\t\t\ttif->tif_row);\n\t\t\treturn (0);\n\t\t}\n\n\t\tfree_entp->next = oldcodep;\n\t\tif (free_entp->next < &sp->dec_codetab[0] ||\n\t\t\tfree_entp->next >= &sp->dec_codetab[CSIZE]) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t\t\"LZWDecode: Corrupted LZW table at scanline %d\",\n\t\t\ttif->tif_row);\n\t\t\treturn (0);\n\t\t}\n\t\tfree_entp->firstchar = free_entp->next->firstchar;\n\t\tfree_entp->length = free_entp->next->length+1;\n\t\tfree_entp->value = (codep < free_entp) ?\n\t\t    codep->firstchar : free_entp->firstchar;\n\t\tif (++free_entp > maxcodep) {\n\t\t\tif (++nbits > BITS_MAX)\t\t/* should not happen */\n\t\t\t\tnbits = BITS_MAX;\n\t\t\tnbitsmask = MAXCODE(nbits);\n\t\t\tmaxcodep = sp->dec_codetab + nbitsmask-1;\n\t\t}\n\t\toldcodep = codep;\n\t\tif (code >= 256) {\n\t\t\t/*\n\t\t \t * Code maps to a string, copy string\n\t\t\t * value to output (written in reverse).\n\t\t \t */\n\t\t\tif(codep->length == 0) {\n\t\t\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t    \t\t    \"LZWDecode: Wrong length of decoded string: \"\n\t\t\t    \"data probably corrupted at scanline %d\",\n\t\t\t    tif->tif_row);\t\n\t\t\t    return (0);\n\t\t\t}\n\t\t\tif (codep->length > occ) {\n\t\t\t\t/*\n\t\t\t\t * String is too long for decode buffer,\n\t\t\t\t * locate portion that will fit, copy to\n\t\t\t\t * the decode buffer, and setup restart\n\t\t\t\t * logic for the next decoding call.\n\t\t\t\t */\n\t\t\t\tsp->dec_codep = codep;\n\t\t\t\tdo {\n\t\t\t\t\tcodep = codep->next;\n\t\t\t\t} while (codep && codep->length > occ);\n\t\t\t\tif (codep) {\n\t\t\t\t\tsp->dec_restart = occ;\n\t\t\t\t\ttp = op + occ;\n\t\t\t\t\tdo  {\n\t\t\t\t\t\t*--tp = codep->value;\n\t\t\t\t\t\tcodep = codep->next;\n\t\t\t\t\t}  while (--occ && codep);\n\t\t\t\t\tif (codep)\n\t\t\t\t\t\tcodeLoop(tif);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tlen = codep->length;\n\t\t\ttp = op + len;\n\t\t\tdo {\n\t\t\t\tint t;\n\t\t\t\t--tp;\n\t\t\t\tt = codep->value;\n\t\t\t\tcodep = codep->next;\n\t\t\t\t*tp = t;\n\t\t\t} while (codep && tp > op);\n\t\t\tif (codep) {\n\t\t\t    codeLoop(tif);\n\t\t\t    break;\n\t\t\t}\n\t\t\top += len, occ -= len;\n\t\t} else\n\t\t\t*op++ = (char)code, occ--;\n\t}\n\n\ttif->tif_rawcp = (tidata_t) bp;\n\tsp->lzw_nbits = (unsigned short) nbits;\n\tsp->lzw_nextdata = nextdata;\n\tsp->lzw_nextbits = nextbits;\n\tsp->dec_nbitsmask = nbitsmask;\n\tsp->dec_oldcodep = oldcodep;\n\tsp->dec_free_entp = free_entp;\n\tsp->dec_maxcodep = maxcodep;\n\n\tif (occ > 0) {\n\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t\"LZWDecode: Not enough data at scanline %d (short %ld bytes)\",\n\t\t    tif->tif_row, occ);\n\t\treturn (0);\n\t}\n\treturn (1);\n}\n\n#ifdef LZW_COMPAT\n/*\n * Decode a \"hunk of data\" for old images.\n */\n#define\tGetNextCodeCompat(sp, bp, code) {\t\t\t\\\n\tnextdata |= (unsigned long) *(bp)++ << nextbits;\t\\\n\tnextbits += 8;\t\t\t\t\t\t\\\n\tif (nextbits < nbits) {\t\t\t\t\t\\\n\t\tnextdata |= (unsigned long) *(bp)++ << nextbits;\\\n\t\tnextbits += 8;\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\\\n\tcode = (hcode_t)(nextdata & nbitsmask);\t\t\t\\\n\tnextdata >>= nbits;\t\t\t\t\t\\\n\tnextbits -= nbits;\t\t\t\t\t\\\n}\n\nstatic int\nLZWDecodeCompat(TIFF* tif, tidata_t op0, tsize_t occ0, tsample_t s)\n{\n\tLZWCodecState *sp = DecoderState(tif);\n\tchar *op = (char*) op0;\n\tlong occ = (long) occ0;\n\tchar *tp;\n\tunsigned char *bp;\n\tint code, nbits;\n\tlong nextbits, nextdata, nbitsmask;\n\tcode_t *codep, *free_entp, *maxcodep, *oldcodep;\n\n\t(void) s;\n\tassert(sp != NULL);\n\t/*\n\t * Restart interrupted output operation.\n\t */\n\tif (sp->dec_restart) {\n\t\tlong residue;\n\n\t\tcodep = sp->dec_codep;\n\t\tresidue = codep->length - sp->dec_restart;\n\t\tif (residue > occ) {\n\t\t\t/*\n\t\t\t * Residue from previous decode is sufficient\n\t\t\t * to satisfy decode request.  Skip to the\n\t\t\t * start of the decoded string, place decoded\n\t\t\t * values in the output buffer, and return.\n\t\t\t */\n\t\t\tsp->dec_restart += occ;\n\t\t\tdo {\n\t\t\t\tcodep = codep->next;\n\t\t\t} while (--residue > occ);\n\t\t\ttp = op + occ;\n\t\t\tdo {\n\t\t\t\t*--tp = codep->value;\n\t\t\t\tcodep = codep->next;\n\t\t\t} while (--occ);\n\t\t\treturn (1);\n\t\t}\n\t\t/*\n\t\t * Residue satisfies only part of the decode request.\n\t\t */\n\t\top += residue, occ -= residue;\n\t\ttp = op;\n\t\tdo {\n\t\t\t*--tp = codep->value;\n\t\t\tcodep = codep->next;\n\t\t} while (--residue);\n\t\tsp->dec_restart = 0;\n\t}\n\n\tbp = (unsigned char *)tif->tif_rawcp;\n\tnbits = sp->lzw_nbits;\n\tnextdata = sp->lzw_nextdata;\n\tnextbits = sp->lzw_nextbits;\n\tnbitsmask = sp->dec_nbitsmask;\n\toldcodep = sp->dec_oldcodep;\n\tfree_entp = sp->dec_free_entp;\n\tmaxcodep = sp->dec_maxcodep;\n\n\twhile (occ > 0) {\n\t\tNextCode(tif, sp, bp, code, GetNextCodeCompat);\n\t\tif (code == CODE_EOI)\n\t\t\tbreak;\n\t\tif (code == CODE_CLEAR) {\n\t\t\tfree_entp = sp->dec_codetab + CODE_FIRST;\n\t\t\t_TIFFmemset(free_entp, 0,\n\t\t\t\t    (CSIZE - CODE_FIRST) * sizeof (code_t));\n\t\t\tnbits = BITS_MIN;\n\t\t\tnbitsmask = MAXCODE(BITS_MIN);\n\t\t\tmaxcodep = sp->dec_codetab + nbitsmask;\n\t\t\tNextCode(tif, sp, bp, code, GetNextCodeCompat);\n\t\t\tif (code == CODE_EOI)\n\t\t\t\tbreak;\n\t\t\tif (code == CODE_CLEAR) {\n\t\t\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t\t\t\"LZWDecode: Corrupted LZW table at scanline %d\",\n\t\t\t\t\t     tif->tif_row);\n\t\t\t\treturn (0);\n\t\t\t}\n\t\t\t*op++ = code, occ--;\n\t\t\toldcodep = sp->dec_codetab + code;\n\t\t\tcontinue;\n\t\t}\n\t\tcodep = sp->dec_codetab + code;\n\n\t\t/*\n\t \t * Add the new entry to the code table.\n\t \t */\n\t\tif (free_entp < &sp->dec_codetab[0] ||\n\t\t\tfree_entp >= &sp->dec_codetab[CSIZE]) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t\t\"LZWDecodeCompat: Corrupted LZW table at scanline %d\",\n\t\t\ttif->tif_row);\n\t\t\treturn (0);\n\t\t}\n\n\t\tfree_entp->next = oldcodep;\n\t\tif (free_entp->next < &sp->dec_codetab[0] ||\n\t\t\tfree_entp->next >= &sp->dec_codetab[CSIZE]) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t\t\"LZWDecodeCompat: Corrupted LZW table at scanline %d\",\n\t\t\ttif->tif_row);\n\t\t\treturn (0);\n\t\t}\n\t\tfree_entp->firstchar = free_entp->next->firstchar;\n\t\tfree_entp->length = free_entp->next->length+1;\n\t\tfree_entp->value = (codep < free_entp) ?\n\t\t    codep->firstchar : free_entp->firstchar;\n\t\tif (++free_entp > maxcodep) {\n\t\t\tif (++nbits > BITS_MAX)\t\t/* should not happen */\n\t\t\t\tnbits = BITS_MAX;\n\t\t\tnbitsmask = MAXCODE(nbits);\n\t\t\tmaxcodep = sp->dec_codetab + nbitsmask;\n\t\t}\n\t\toldcodep = codep;\n\t\tif (code >= 256) {\n\t\t\tchar *op_orig = op;\n\t\t\t/*\n\t\t \t * Code maps to a string, copy string\n\t\t\t * value to output (written in reverse).\n\t\t \t */\n\t\t\tif(codep->length == 0) {\n\t\t\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t    \t\t    \"LZWDecodeCompat: Wrong length of decoded \"\n\t\t\t    \"string: data probably corrupted at scanline %d\",\n\t\t\t    tif->tif_row);\t\n\t\t\t    return (0);\n\t\t\t}\n\t\t\tif (codep->length > occ) {\n\t\t\t\t/*\n\t\t\t\t * String is too long for decode buffer,\n\t\t\t\t * locate portion that will fit, copy to\n\t\t\t\t * the decode buffer, and setup restart\n\t\t\t\t * logic for the next decoding call.\n\t\t\t\t */\n\t\t\t\tsp->dec_codep = codep;\n\t\t\t\tdo {\n\t\t\t\t\tcodep = codep->next;\n\t\t\t\t} while (codep->length > occ);\n\t\t\t\tsp->dec_restart = occ;\n\t\t\t\ttp = op + occ;\n\t\t\t\tdo  {\n\t\t\t\t\t*--tp = codep->value;\n\t\t\t\t\tcodep = codep->next;\n\t\t\t\t}  while (--occ);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\top += codep->length, occ -= codep->length;\n\t\t\ttp = op;\n\t\t\tdo {\n\t\t\t\t*--tp = codep->value;\n\t\t\t} while( (codep = codep->next) != NULL && tp > op_orig);\n\t\t} else\n\t\t\t*op++ = code, occ--;\n\t}\n\n\ttif->tif_rawcp = (tidata_t) bp;\n\tsp->lzw_nbits = nbits;\n\tsp->lzw_nextdata = nextdata;\n\tsp->lzw_nextbits = nextbits;\n\tsp->dec_nbitsmask = nbitsmask;\n\tsp->dec_oldcodep = oldcodep;\n\tsp->dec_free_entp = free_entp;\n\tsp->dec_maxcodep = maxcodep;\n\n\tif (occ > 0) {\n\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t    \"LZWDecodeCompat: Not enough data at scanline %d (short %ld bytes)\",\n\t\t    tif->tif_row, occ);\n\t\treturn (0);\n\t}\n\treturn (1);\n}\n#endif /* LZW_COMPAT */\n\n/*\n * LZW Encoding.\n */\n\nstatic int\nLZWSetupEncode(TIFF* tif)\n{\n\tLZWCodecState* sp = EncoderState(tif);\n\tstatic const char module[] = \"LZWSetupEncode\";\n\n\tassert(sp != NULL);\n\tsp->enc_hashtab = (hash_t*) _TIFFmalloc(HSIZE*sizeof (hash_t));\n\tif (sp->enc_hashtab == NULL) {\n\t\tTIFFErrorExt(tif->tif_clientdata, module, \"No space for LZW hash table\");\n\t\treturn (0);\n\t}\n\treturn (1);\n}\n\n/*\n * Reset encoding state at the start of a strip.\n */\nstatic int\nLZWPreEncode(TIFF* tif, tsample_t s)\n{\n\tLZWCodecState *sp = EncoderState(tif);\n\n\t(void) s;\n\tassert(sp != NULL);\n        \n        if( sp->enc_hashtab == NULL )\n        {\n            tif->tif_setupencode( tif );\n        }\n\n\tsp->lzw_nbits = BITS_MIN;\n\tsp->lzw_maxcode = MAXCODE(BITS_MIN);\n\tsp->lzw_free_ent = CODE_FIRST;\n\tsp->lzw_nextbits = 0;\n\tsp->lzw_nextdata = 0;\n\tsp->enc_checkpoint = CHECK_GAP;\n\tsp->enc_ratio = 0;\n\tsp->enc_incount = 0;\n\tsp->enc_outcount = 0;\n\t/*\n\t * The 4 here insures there is space for 2 max-sized\n\t * codes in LZWEncode and LZWPostDecode.\n\t */\n\tsp->enc_rawlimit = tif->tif_rawdata + tif->tif_rawdatasize-1 - 4;\n\tcl_hash(sp);\t\t/* clear hash table */\n\tsp->enc_oldcode = (hcode_t) -1;\t/* generates CODE_CLEAR in LZWEncode */\n\treturn (1);\n}\n\n#define\tCALCRATIO(sp, rat) {\t\t\t\t\t\\\n\tif (incount > 0x007fffff) { /* NB: shift will overflow */\\\n\t\trat = outcount >> 8;\t\t\t\t\\\n\t\trat = (rat == 0 ? 0x7fffffff : incount/rat);\t\\\n\t} else\t\t\t\t\t\t\t\\\n\t\trat = (incount<<8) / outcount;\t\t\t\\\n}\n#define\tPutNextCode(op, c) {\t\t\t\t\t\\\n\tnextdata = (nextdata << nbits) | c;\t\t\t\\\n\tnextbits += nbits;\t\t\t\t\t\\\n\t*op++ = (unsigned char)(nextdata >> (nextbits-8));\t\t\\\n\tnextbits -= 8;\t\t\t\t\t\t\\\n\tif (nextbits >= 8) {\t\t\t\t\t\\\n\t\t*op++ = (unsigned char)(nextdata >> (nextbits-8));\t\\\n\t\tnextbits -= 8;\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\\\n\toutcount += nbits;\t\t\t\t\t\\\n}\n\n/*\n * Encode a chunk of pixels.\n *\n * Uses an open addressing double hashing (no chaining) on the \n * prefix code/next character combination.  We do a variant of\n * Knuth's algorithm D (vol. 3, sec. 6.4) along with G. Knott's\n * relatively-prime secondary probe.  Here, the modular division\n * first probe is gives way to a faster exclusive-or manipulation. \n * Also do block compression with an adaptive reset, whereby the\n * code table is cleared when the compression ratio decreases,\n * but after the table fills.  The variable-length output codes\n * are re-sized at this point, and a CODE_CLEAR is generated\n * for the decoder. \n */\nstatic int\nLZWEncode(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)\n{\n\tregister LZWCodecState *sp = EncoderState(tif);\n\tregister long fcode;\n\tregister hash_t *hp;\n\tregister int h, c;\n\thcode_t ent;\n\tlong disp;\n\tlong incount, outcount, checkpoint;\n\tlong nextdata, nextbits;\n\tint free_ent, maxcode, nbits;\n\ttidata_t op, limit;\n\n\t(void) s;\n\tif (sp == NULL)\n\t\treturn (0);\n\n        assert(sp->enc_hashtab != NULL);\n\n\t/*\n\t * Load local state.\n\t */\n\tincount = sp->enc_incount;\n\toutcount = sp->enc_outcount;\n\tcheckpoint = sp->enc_checkpoint;\n\tnextdata = sp->lzw_nextdata;\n\tnextbits = sp->lzw_nextbits;\n\tfree_ent = sp->lzw_free_ent;\n\tmaxcode = sp->lzw_maxcode;\n\tnbits = sp->lzw_nbits;\n\top = tif->tif_rawcp;\n\tlimit = sp->enc_rawlimit;\n\tent = sp->enc_oldcode;\n\n\tif (ent == (hcode_t) -1 && cc > 0) {\n\t\t/*\n\t\t * NB: This is safe because it can only happen\n\t\t *     at the start of a strip where we know there\n\t\t *     is space in the data buffer.\n\t\t */\n\t\tPutNextCode(op, CODE_CLEAR);\n\t\tent = *bp++; cc--; incount++;\n\t}\n\twhile (cc > 0) {\n\t\tc = *bp++; cc--; incount++;\n\t\tfcode = ((long)c << BITS_MAX) + ent;\n\t\th = (c << HSHIFT) ^ ent;\t/* xor hashing */\n#ifdef _WINDOWS\n\t\t/*\n\t\t * Check hash index for an overflow.\n\t\t */\n\t\tif (h >= HSIZE)\n\t\t\th -= HSIZE;\n#endif\n\t\thp = &sp->enc_hashtab[h];\n\t\tif (hp->hash == fcode) {\n\t\t\tent = hp->code;\n\t\t\tcontinue;\n\t\t}\n\t\tif (hp->hash >= 0) {\n\t\t\t/*\n\t\t\t * Primary hash failed, check secondary hash.\n\t\t\t */\n\t\t\tdisp = HSIZE - h;\n\t\t\tif (h == 0)\n\t\t\t\tdisp = 1;\n\t\t\tdo {\n\t\t\t\t/*\n\t\t\t\t * Avoid pointer arithmetic 'cuz of\n\t\t\t\t * wraparound problems with segments.\n\t\t\t\t */\n\t\t\t\tif ((h -= disp) < 0)\n\t\t\t\t\th += HSIZE;\n\t\t\t\thp = &sp->enc_hashtab[h];\n\t\t\t\tif (hp->hash == fcode) {\n\t\t\t\t\tent = hp->code;\n\t\t\t\t\tgoto hit;\n\t\t\t\t}\n\t\t\t} while (hp->hash >= 0);\n\t\t}\n\t\t/*\n\t\t * New entry, emit code and add to table.\n\t\t */\n\t\t/*\n\t\t * Verify there is space in the buffer for the code\n\t\t * and any potential Clear code that might be emitted\n\t\t * below.  The value of limit is setup so that there\n\t\t * are at least 4 bytes free--room for 2 codes.\n\t\t */\n\t\tif (op > limit) {\n\t\t\ttif->tif_rawcc = (tsize_t)(op - tif->tif_rawdata);\n\t\t\tTIFFFlushData1(tif);\n\t\t\top = tif->tif_rawdata;\n\t\t}\n\t\tPutNextCode(op, ent);\n\t\tent = c;\n\t\thp->code = free_ent++;\n\t\thp->hash = fcode;\n\t\tif (free_ent == CODE_MAX-1) {\n\t\t\t/* table is full, emit clear code and reset */\n\t\t\tcl_hash(sp);\n\t\t\tsp->enc_ratio = 0;\n\t\t\tincount = 0;\n\t\t\toutcount = 0;\n\t\t\tfree_ent = CODE_FIRST;\n\t\t\tPutNextCode(op, CODE_CLEAR);\n\t\t\tnbits = BITS_MIN;\n\t\t\tmaxcode = MAXCODE(BITS_MIN);\n\t\t} else {\n\t\t\t/*\n\t\t\t * If the next entry is going to be too big for\n\t\t\t * the code size, then increase it, if possible.\n\t\t\t */\n\t\t\tif (free_ent > maxcode) {\n\t\t\t\tnbits++;\n\t\t\t\tassert(nbits <= BITS_MAX);\n\t\t\t\tmaxcode = (int) MAXCODE(nbits);\n\t\t\t} else if (incount >= checkpoint) {\n\t\t\t\tlong rat;\n\t\t\t\t/*\n\t\t\t\t * Check compression ratio and, if things seem\n\t\t\t\t * to be slipping, clear the hash table and\n\t\t\t\t * reset state.  The compression ratio is a\n\t\t\t\t * 24+8-bit fractional number.\n\t\t\t\t */\n\t\t\t\tcheckpoint = incount+CHECK_GAP;\n\t\t\t\tCALCRATIO(sp, rat);\n\t\t\t\tif (rat <= sp->enc_ratio) {\n\t\t\t\t\tcl_hash(sp);\n\t\t\t\t\tsp->enc_ratio = 0;\n\t\t\t\t\tincount = 0;\n\t\t\t\t\toutcount = 0;\n\t\t\t\t\tfree_ent = CODE_FIRST;\n\t\t\t\t\tPutNextCode(op, CODE_CLEAR);\n\t\t\t\t\tnbits = BITS_MIN;\n\t\t\t\t\tmaxcode = MAXCODE(BITS_MIN);\n\t\t\t\t} else\n\t\t\t\t\tsp->enc_ratio = rat;\n\t\t\t}\n\t\t}\n\thit:\n\t\t;\n\t}\n\n\t/*\n\t * Restore global state.\n\t */\n\tsp->enc_incount = incount;\n\tsp->enc_outcount = outcount;\n\tsp->enc_checkpoint = checkpoint;\n\tsp->enc_oldcode = ent;\n\tsp->lzw_nextdata = nextdata;\n\tsp->lzw_nextbits = nextbits;\n\tsp->lzw_free_ent = free_ent;\n\tsp->lzw_maxcode = maxcode;\n\tsp->lzw_nbits = nbits;\n\ttif->tif_rawcp = op;\n\treturn (1);\n}\n\n/*\n * Finish off an encoded strip by flushing the last\n * string and tacking on an End Of Information code.\n */\nstatic int\nLZWPostEncode(TIFF* tif)\n{\n\tregister LZWCodecState *sp = EncoderState(tif);\n\ttidata_t op = tif->tif_rawcp;\n\tlong nextbits = sp->lzw_nextbits;\n\tlong nextdata = sp->lzw_nextdata;\n\tlong outcount = sp->enc_outcount;\n\tint nbits = sp->lzw_nbits;\n\n\tif (op > sp->enc_rawlimit) {\n\t\ttif->tif_rawcc = (tsize_t)(op - tif->tif_rawdata);\n\t\tTIFFFlushData1(tif);\n\t\top = tif->tif_rawdata;\n\t}\n\tif (sp->enc_oldcode != (hcode_t) -1) {\n\t\tPutNextCode(op, sp->enc_oldcode);\n\t\tsp->enc_oldcode = (hcode_t) -1;\n\t}\n\tPutNextCode(op, CODE_EOI);\n\tif (nextbits > 0) \n\t\t*op++ = (unsigned char)(nextdata << (8-nextbits));\n\ttif->tif_rawcc = (tsize_t)(op - tif->tif_rawdata);\n\treturn (1);\n}\n\n/*\n * Reset encoding hash table.\n */\nstatic void\ncl_hash(LZWCodecState* sp)\n{\n\tregister hash_t *hp = &sp->enc_hashtab[HSIZE-1];\n\tregister long i = HSIZE-8;\n\n \tdo {\n\t\ti -= 8;\n\t\thp[-7].hash = -1;\n\t\thp[-6].hash = -1;\n\t\thp[-5].hash = -1;\n\t\thp[-4].hash = -1;\n\t\thp[-3].hash = -1;\n\t\thp[-2].hash = -1;\n\t\thp[-1].hash = -1;\n\t\thp[ 0].hash = -1;\n\t\thp -= 8;\n\t} while (i >= 0);\n    \tfor (i += 8; i > 0; i--, hp--)\n\t\thp->hash = -1;\n}\n\nstatic void\nLZWCleanup(TIFF* tif)\n{\n\t(void)TIFFPredictorCleanup(tif);\n\n\tassert(tif->tif_data != 0);\n\n\tif (DecoderState(tif)->dec_codetab)\n\t\t_TIFFfree(DecoderState(tif)->dec_codetab);\n\n\tif (EncoderState(tif)->enc_hashtab)\n\t\t_TIFFfree(EncoderState(tif)->enc_hashtab);\n\n\t_TIFFfree(tif->tif_data);\n\ttif->tif_data = NULL;\n\n\t_TIFFSetDefaultCompressionState(tif);\n}\n\nint\nTIFFInitLZW(TIFF* tif, int scheme)\n{\n\tassert(scheme == COMPRESSION_LZW);\n\t/*\n\t * Allocate state block so tag methods have storage to record values.\n\t */\n\ttif->tif_data = (tidata_t) _TIFFmalloc(sizeof (LZWCodecState));\n\tif (tif->tif_data == NULL)\n\t\tgoto bad;\n\tDecoderState(tif)->dec_codetab = NULL;\n\tDecoderState(tif)->dec_decode = NULL;\n\tEncoderState(tif)->enc_hashtab = NULL;\n        LZWState(tif)->rw_mode = tif->tif_mode;\n\n\t/*\n\t * Install codec methods.\n\t */\n\ttif->tif_setupdecode = LZWSetupDecode;\n\ttif->tif_predecode = LZWPreDecode;\n\ttif->tif_decoderow = LZWDecode;\n\ttif->tif_decodestrip = LZWDecode;\n\ttif->tif_decodetile = LZWDecode;\n\ttif->tif_setupencode = LZWSetupEncode;\n\ttif->tif_preencode = LZWPreEncode;\n\ttif->tif_postencode = LZWPostEncode;\n\ttif->tif_encoderow = LZWEncode;\n\ttif->tif_encodestrip = LZWEncode;\n\ttif->tif_encodetile = LZWEncode;\n\ttif->tif_cleanup = LZWCleanup;\n\t/*\n\t * Setup predictor setup.\n\t */\n\t(void) TIFFPredictorInit(tif);\n\treturn (1);\nbad:\n\tTIFFErrorExt(tif->tif_clientdata, \"TIFFInitLZW\", \n\t\t     \"No space for LZW state block\");\n\treturn (0);\n}\n\n/*\n * Copyright (c) 1985, 1986 The Regents of the University of California.\n * All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * James A. Woods, derived from original work by Spencer Thomas\n * and Joseph Orost.\n *\n * Redistribution and use in source and binary forms are permitted\n * provided that the above copyright notice and this paragraph are\n * duplicated in all such forms and that any documentation,\n * advertising materials, and other materials related to such\n * distribution and use acknowledge that the software was developed\n * by the University of California, Berkeley.  The name of the\n * University may not be used to endorse or promote products derived\n * from this software without specific prior written permission.\n * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED\n * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.\n */\n#endif /* LZW_SUPPORT */\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/tif_msdos.c",
    "content": "/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_msdos.c,v 1.3 2006/07/25 18:26:33 fwarmerdam Exp $ */\n\n/*\n * Copyright (c) 1988-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n/*\n * TIFF Library MSDOS-specific Routines.\n */\n#if defined(__WATCOMC__) || defined(__BORLANDC__) || defined(_MSC_VER)\n#include <io.h>\t\t/* for open, close, etc. function prototypes */\n#include <stdio.h>\n#endif\n#include \"tiffiop.h\"\n\nstatic tsize_t \n_tiffReadProc(thandle_t fd, tdata_t buf, tsize_t size)\n{\n\treturn (read((int) fd, buf, size));\n}\n\nstatic tsize_t\n_tiffWriteProc(thandle_t fd, tdata_t buf, tsize_t size)\n{\n\treturn (write((int) fd, buf, size));\n}\n\nstatic toff_t\n_tiffSeekProc(thandle_t fd, toff_t off, int whence)\n{\n\treturn (lseek((int) fd, (off_t) off, whence));\n}\n\nstatic int\n_tiffCloseProc(thandle_t fd)\n{\n\treturn (close((int) fd));\n}\n\n#include <sys/stat.h>\n\nstatic toff_t\n_tiffSizeProc(thandle_t fd)\n{\n\tstruct stat sb;\n\treturn (fstat((int) fd, &sb) < 0 ? 0 : sb.st_size);\n}\n\nstatic int\n_tiffMapProc(thandle_t fd, tdata_t* pbase, toff_t* psize)\n{\n\treturn (0);\n}\n\nstatic void\n_tiffUnmapProc(thandle_t fd, tdata_t base, toff_t size)\n{\n}\n\n/*\n * Open a TIFF file descriptor for read/writing.\n */\nTIFF*\nTIFFFdOpen(int fd, const char* name, const char* mode)\n{\n\tTIFF* tif;\n\n\ttif = TIFFClientOpen(name, mode,\n\t    (void*) fd,\n\t    _tiffReadProc, _tiffWriteProc, _tiffSeekProc, _tiffCloseProc,\n\t    _tiffSizeProc, _tiffMapProc, _tiffUnmapProc);\n\tif (tif)\n\t\ttif->tif_fd = fd;\n\treturn (tif);\n}\n\n/*\n * Open a TIFF file for read/writing.\n */\nTIFF*\nTIFFOpen(const char* name, const char* mode)\n{\n\tstatic const char module[] = \"TIFFOpen\";\n\tint m, fd;\n        TIFF *ret;\n\n\tm = _TIFFgetMode(mode, module);\n\tif (m == -1)\n\t\treturn ((TIFF*)0);\n\tfd = open(name, m|O_BINARY, 0666);\n\tif (fd < 0) {\n\t\tTIFFErrorExt(0, module, \"%s: Cannot open\", name);\n\t\treturn ((TIFF*)0);\n\t}\n\treturn (TIFFFdOpen(fd, name, mode));\n\n        ret = TIFFFdOpen(fd, name, mode);\n\n        if (ret == NULL) close(fd);\n\n        return ret;\n}\n\n#ifdef __GNUC__\nextern\tchar* malloc();\nextern\tchar* realloc();\n#else\n#include <malloc.h>\n#endif\n\ntdata_t\n_TIFFmalloc(tsize_t s)\n{\n\treturn (malloc((size_t) s));\n}\n\nvoid\n_TIFFfree(tdata_t p)\n{\n\tfree(p);\n}\n\ntdata_t\n_TIFFrealloc(tdata_t p, tsize_t s)\n{\n\treturn (realloc(p, (size_t) s));\n}\n\nvoid\n_TIFFmemset(tdata_t p, int v, tsize_t c)\n{\n\tmemset(p, v, (size_t) c);\n}\n\nvoid\n_TIFFmemcpy(tdata_t d, const tdata_t s, tsize_t c)\n{\n\tmemcpy(d, s, (size_t) c);\n}\n\nint\n_TIFFmemcmp(const tdata_t p1, const tdata_t p2, tsize_t c)\n{\n\treturn (memcmp(p1, p2, (size_t) c));\n}\n\nstatic void\nmsdosWarningHandler(const char* module, const char* fmt, va_list ap)\n{\n\tif (module != NULL)\n\t\tfprintf(stderr, \"%s: \", module);\n\tfprintf(stderr, \"Warning, \");\n\tvfprintf(stderr, fmt, ap);\n\tfprintf(stderr, \".\\n\");\n}\nTIFFErrorHandler _TIFFwarningHandler = msdosWarningHandler;\n\nstatic void\nmsdosErrorHandler(const char* module, const char* fmt, va_list ap)\n{\n\tif (module != NULL)\n\t\tfprintf(stderr, \"%s: \", module);\n\tvfprintf(stderr, fmt, ap);\n\tfprintf(stderr, \".\\n\");\n}\nTIFFErrorHandler _TIFFerrorHandler = msdosErrorHandler;\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/tif_next.c",
    "content": "/* $Id: tif_next.c,v 1.8 2006/10/12 15:00:49 dron Exp $ */\n\n/*\n * Copyright (c) 1988-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n#include \"tiffiop.h\"\n#ifdef NEXT_SUPPORT\n/*\n * TIFF Library.\n *\n * NeXT 2-bit Grey Scale Compression Algorithm Support\n */\n\n#define SETPIXEL(op, v) {\t\t\t\\\n\tswitch (npixels++ & 3) {\t\t\\\n\tcase 0:\top[0]  = (unsigned char) ((v) << 6); break;\t\\\n\tcase 1:\top[0] |= (v) << 4; break;\t\\\n\tcase 2:\top[0] |= (v) << 2; break;\t\\\n\tcase 3:\t*op++ |= (v);\t   break;\t\\\n\t}\t\t\t\t\t\\\n}\n\n#define LITERALROW\t0x00\n#define LITERALSPAN\t0x40\n#define WHITE   \t((1<<2)-1)\n\nstatic int\nNeXTDecode(TIFF* tif, tidata_t buf, tsize_t occ, tsample_t s)\n{\n\tunsigned char *bp, *op;\n\ttsize_t cc;\n\ttidata_t row;\n\ttsize_t scanline, n;\n\n\t(void) s;\n\t/*\n\t * Each scanline is assumed to start off as all\n\t * white (we assume a PhotometricInterpretation\n\t * of ``min-is-black'').\n\t */\n\tfor (op = buf, cc = occ; cc-- > 0;)\n\t\t*op++ = 0xff;\n\n\tbp = (unsigned char *)tif->tif_rawcp;\n\tcc = tif->tif_rawcc;\n\tscanline = tif->tif_scanlinesize;\n\tfor (row = buf; occ > 0; occ -= scanline, row += scanline) {\n\t\tn = *bp++, cc--;\n\t\tswitch (n) {\n\t\tcase LITERALROW:\n\t\t\t/*\n\t\t\t * The entire scanline is given as literal values.\n\t\t\t */\n\t\t\tif (cc < scanline)\n\t\t\t\tgoto bad;\n\t\t\t_TIFFmemcpy(row, bp, scanline);\n\t\t\tbp += scanline;\n\t\t\tcc -= scanline;\n\t\t\tbreak;\n\t\tcase LITERALSPAN: {\n\t\t\ttsize_t off;\n\t\t\t/*\n\t\t\t * The scanline has a literal span that begins at some\n\t\t\t * offset.\n\t\t\t */\n\t\t\toff = (bp[0] * 256) + bp[1];\n\t\t\tn = (bp[2] * 256) + bp[3];\n\t\t\tif (cc < 4+n || off+n > scanline)\n\t\t\t\tgoto bad;\n\t\t\t_TIFFmemcpy(row+off, bp+4, n);\n\t\t\tbp += 4+n;\n\t\t\tcc -= 4+n;\n\t\t\tbreak;\n\t\t}\n\t\tdefault: {\n\t\t\tuint32 npixels = 0, grey;\n\t\t\tuint32 imagewidth = tif->tif_dir.td_imagewidth;\n\n\t\t\t/*\n\t\t\t * The scanline is composed of a sequence of constant\n\t\t\t * color ``runs''.  We shift into ``run mode'' and\n\t\t\t * interpret bytes as codes of the form\n\t\t\t * <color><npixels> until we've filled the scanline.\n\t\t\t */\n\t\t\top = row;\n\t\t\tfor (;;) {\n\t\t\t\tgrey = (n>>6) & 0x3;\n\t\t\t\tn &= 0x3f;\n\t\t\t\t/*\n\t\t\t\t * Ensure the run does not exceed the scanline\n\t\t\t\t * bounds, potentially resulting in a security\n\t\t\t\t * issue.\n\t\t\t\t */\n\t\t\t\twhile (n-- > 0 && npixels < imagewidth)\n\t\t\t\t\tSETPIXEL(op, grey);\n\t\t\t\tif (npixels >= imagewidth)\n\t\t\t\t\tbreak;\n\t\t\t\tif (cc == 0)\n\t\t\t\t\tgoto bad;\n\t\t\t\tn = *bp++, cc--;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\t}\n\t}\n\ttif->tif_rawcp = (tidata_t) bp;\n\ttif->tif_rawcc = cc;\n\treturn (1);\nbad:\n\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name, \"NeXTDecode: Not enough data for scanline %ld\",\n\t    (long) tif->tif_row);\n\treturn (0);\n}\n\nint\nTIFFInitNeXT(TIFF* tif, int scheme)\n{\n\t(void) scheme;\n\ttif->tif_decoderow = NeXTDecode;\n\ttif->tif_decodestrip = NeXTDecode;\n\ttif->tif_decodetile = NeXTDecode;\n\treturn (1);\n}\n#endif /* NEXT_SUPPORT */\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/tif_ojpeg.c",
    "content": "/* $Id: tif_ojpeg.c,v 1.24.2.4 2009-09-03 20:45:10 bfriesen Exp $ */\n\n/* WARNING: The type of JPEG encapsulation defined by the TIFF Version 6.0\n   specification is now totally obsolete and deprecated for new applications and\n   images. This file was was created solely in order to read unconverted images\n   still present on some users' computer systems. It will never be extended\n   to write such files. Writing new-style JPEG compressed TIFFs is implemented\n   in tif_jpeg.c.\n\n   The code is carefully crafted to robustly read all gathered JPEG-in-TIFF\n   testfiles, and anticipate as much as possible all other... But still, it may\n   fail on some. If you encounter problems, please report them on the TIFF\n   mailing list and/or to Joris Van Damme <info@awaresystems.be>.\n\n   Please read the file called \"TIFF Technical Note #2\" if you need to be\n   convinced this compression scheme is bad and breaks TIFF. That document\n   is linked to from the LibTiff site <http://www.remotesensing.org/libtiff/>\n   and from AWare Systems' TIFF section\n   <http://www.awaresystems.be/imaging/tiff.html>. It is also absorbed\n   in Adobe's specification supplements, marked \"draft\" up to this day, but\n   supported by the TIFF community.\n\n   This file interfaces with Release 6B of the JPEG Library written by the\n   Independent JPEG Group. Previous versions of this file required a hack inside\n   the LibJpeg library. This version no longer requires that. Remember to\n   remove the hack if you update from the old version.\n\n   Copyright (c) Joris Van Damme <info@awaresystems.be>\n   Copyright (c) AWare Systems <http://www.awaresystems.be/>\n\n   The licence agreement for this file is the same as the rest of the LibTiff\n   library.\n\n   IN NO EVENT SHALL JORIS VAN DAMME OR AWARE SYSTEMS BE LIABLE FOR\n   ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n   OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n   WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF\n   LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE\n   OF THIS SOFTWARE.\n\n   Joris Van Damme and/or AWare Systems may be available for custom\n   developement. If you like what you see, and need anything similar or related,\n   contact <info@awaresystems.be>.\n*/\n\n/* What is what, and what is not?\n\n   This decoder starts with an input stream, that is essentially the JpegInterchangeFormat\n   stream, if any, followed by the strile data, if any. This stream is read in\n   OJPEGReadByte and related functions.\n\n   It analyzes the start of this stream, until it encounters non-marker data, i.e.\n   compressed image data. Some of the header markers it sees have no actual content,\n   like the SOI marker, and APP/COM markers that really shouldn't even be there. Some\n   other markers do have content, and the valuable bits and pieces of information\n   in these markers are saved, checking all to verify that the stream is more or\n   less within expected bounds. This happens inside the OJPEGReadHeaderInfoSecStreamXxx\n   functions.\n\n   Some OJPEG imagery contains no valid JPEG header markers. This situation is picked\n   up on if we've seen no SOF marker when we're at the start of the compressed image\n   data. In this case, the tables are read from JpegXxxTables tags, and the other\n   bits and pieces of information is initialized to its most basic value. This is\n   implemented in the OJPEGReadHeaderInfoSecTablesXxx functions.\n\n   When this is complete, a good and valid JPEG header can be assembled, and this is\n   passed through to LibJpeg. When that's done, the remainder of the input stream, i.e.\n   the compressed image data, can be passed through unchanged. This is done in\n   OJPEGWriteStream functions.\n\n   LibTiff rightly expects to know the subsampling values before decompression. Just like\n   in new-style JPEG-in-TIFF, though, or even more so, actually, the YCbCrsubsampling\n   tag is notoriously unreliable. To correct these tag values with the ones inside\n   the JPEG stream, the first part of the input stream is pre-scanned in\n   OJPEGSubsamplingCorrect, making no note of any other data, reporting no warnings\n   or errors, up to the point where either these values are read, or it's clear they\n   aren't there. This means that some of the data is read twice, but we feel speed\n   in correcting these values is important enough to warrant this sacrifice. Allthough\n   there is currently no define or other configuration mechanism to disable this behaviour,\n   the actual header scanning is build to robustly respond with error report if it\n   should encounter an uncorrected mismatch of subsampling values. See\n   OJPEGReadHeaderInfoSecStreamSof.\n\n   The restart interval and restart markers are the most tricky part... The restart\n   interval can be specified in a tag. It can also be set inside the input JPEG stream.\n   It can be used inside the input JPEG stream. If reading from strile data, we've\n   consistenly discovered the need to insert restart markers in between the different\n   striles, as is also probably the most likely interpretation of the original TIFF 6.0\n   specification. With all this setting of interval, and actual use of markers that is not\n   predictable at the time of valid JPEG header assembly, the restart thing may turn\n   out the Achilles heel of this implementation. Fortunately, most OJPEG writer vendors\n   succeed in reading back what they write, which may be the reason why we've been able\n   to discover ways that seem to work.\n\n   Some special provision is made for planarconfig separate OJPEG files. These seem\n   to consistently contain header info, a SOS marker, a plane, SOS marker, plane, SOS,\n   and plane. This may or may not be a valid JPEG configuration, we don't know and don't\n   care. We want LibTiff to be able to access the planes individually, without huge\n   buffering inside LibJpeg, anyway. So we compose headers to feed to LibJpeg, in this\n   case, that allow us to pass a single plane such that LibJpeg sees a valid\n   single-channel JPEG stream. Locating subsequent SOS markers, and thus subsequent\n   planes, is done inside OJPEGReadSecondarySos.\n\n   The benefit of the scheme is... that it works, basically. We know of no other that\n   does. It works without checking software tag, or otherwise going about things in an\n   OJPEG flavor specific manner. Instead, it is a single scheme, that covers the cases\n   with and without JpegInterchangeFormat, with and without striles, with part of\n   the header in JpegInterchangeFormat and remainder in first strile, etc. It is forgiving\n   and robust, may likely work with OJPEG flavors we've not seen yet, and makes most out\n   of the data.\n\n   Another nice side-effect is that a complete JPEG single valid stream is build if\n   planarconfig is not separate (vast majority). We may one day use that to build\n   converters to JPEG, and/or to new-style JPEG compression inside TIFF.\n\n   A dissadvantage is the lack of random access to the individual striles. This is the\n   reason for much of the complicated restart-and-position stuff inside OJPEGPreDecode.\n   Applications would do well accessing all striles in order, as this will result in\n   a single sequential scan of the input stream, and no restarting of LibJpeg decoding\n   session.\n*/\n\n\n#include \"tiffiop.h\"\n#ifdef OJPEG_SUPPORT\n\n/* Configuration defines here are:\n * JPEG_ENCAP_EXTERNAL: The normal way to call libjpeg, uses longjump. In some environments,\n * \tlike eg LibTiffDelphi, this is not possible. For this reason, the actual calls to\n * \tlibjpeg, with longjump stuff, are encapsulated in dedicated functions. When\n * \tJPEG_ENCAP_EXTERNAL is defined, these encapsulating functions are declared external\n * \tto this unit, and can be defined elsewhere to use stuff other then longjump.\n * \tThe default mode, without JPEG_ENCAP_EXTERNAL, implements the call encapsulators\n * \there, internally, with normal longjump.\n * SETJMP, LONGJMP, JMP_BUF: On some machines/environments a longjump equivalent is\n * \tconviniently available, but still it may be worthwhile to use _setjmp or sigsetjmp\n * \tin place of plain setjmp. These macros will make it easier. It is useless\n * \tto fiddle with these if you define JPEG_ENCAP_EXTERNAL.\n * OJPEG_BUFFER: Define the size of the desired buffer here. Should be small enough so as to guarantee\n * \tinstant processing, optimal streaming and optimal use of processor cache, but also big\n * \tenough so as to not result in significant call overhead. It should be at least a few\n * \tbytes to accomodate some structures (this is verified in asserts), but it would not be\n * \tsensible to make it this small anyway, and it should be at most 64K since it is indexed\n * \twith uint16. We recommend 2K.\n * EGYPTIANWALK: You could also define EGYPTIANWALK here, but it is not used anywhere and has\n * \tabsolutely no effect. That is why most people insist the EGYPTIANWALK is a bit silly.\n */\n\n/* #define LIBJPEG_ENCAP_EXTERNAL */\n#define SETJMP(jbuf) setjmp(jbuf)\n#define LONGJMP(jbuf,code) longjmp(jbuf,code)\n#define JMP_BUF jmp_buf\n#define OJPEG_BUFFER 2048\n/* define EGYPTIANWALK */\n\n#define JPEG_MARKER_SOF0 0xC0\n#define JPEG_MARKER_SOF1 0xC1\n#define JPEG_MARKER_SOF3 0xC3\n#define JPEG_MARKER_DHT 0xC4\n#define JPEG_MARKER_RST0 0XD0\n#define JPEG_MARKER_SOI 0xD8\n#define JPEG_MARKER_EOI 0xD9\n#define JPEG_MARKER_SOS 0xDA\n#define JPEG_MARKER_DQT 0xDB\n#define JPEG_MARKER_DRI 0xDD\n#define JPEG_MARKER_APP0 0xE0\n#define JPEG_MARKER_COM 0xFE\n\n#define FIELD_OJPEG_JPEGINTERCHANGEFORMAT (FIELD_CODEC+0)\n#define FIELD_OJPEG_JPEGINTERCHANGEFORMATLENGTH (FIELD_CODEC+1)\n#define FIELD_OJPEG_JPEGQTABLES (FIELD_CODEC+2)\n#define FIELD_OJPEG_JPEGDCTABLES (FIELD_CODEC+3)\n#define FIELD_OJPEG_JPEGACTABLES (FIELD_CODEC+4)\n#define FIELD_OJPEG_JPEGPROC (FIELD_CODEC+5)\n#define FIELD_OJPEG_JPEGRESTARTINTERVAL (FIELD_CODEC+6)\n#define FIELD_OJPEG_COUNT 7\n\nstatic const TIFFFieldInfo ojpeg_field_info[] = {\n\t{TIFFTAG_JPEGIFOFFSET,1,1,TIFF_LONG,FIELD_OJPEG_JPEGINTERCHANGEFORMAT,TRUE,FALSE,\"JpegInterchangeFormat\"},\n\t{TIFFTAG_JPEGIFBYTECOUNT,1,1,TIFF_LONG,FIELD_OJPEG_JPEGINTERCHANGEFORMATLENGTH,TRUE,FALSE,\"JpegInterchangeFormatLength\"},\n\t{TIFFTAG_JPEGQTABLES,TIFF_VARIABLE,TIFF_VARIABLE,TIFF_LONG,FIELD_OJPEG_JPEGQTABLES,FALSE,TRUE,\"JpegQTables\"},\n\t{TIFFTAG_JPEGDCTABLES,TIFF_VARIABLE,TIFF_VARIABLE,TIFF_LONG,FIELD_OJPEG_JPEGDCTABLES,FALSE,TRUE,\"JpegDcTables\"},\n\t{TIFFTAG_JPEGACTABLES,TIFF_VARIABLE,TIFF_VARIABLE,TIFF_LONG,FIELD_OJPEG_JPEGACTABLES,FALSE,TRUE,\"JpegAcTables\"},\n\t{TIFFTAG_JPEGPROC,1,1,TIFF_SHORT,FIELD_OJPEG_JPEGPROC,FALSE,FALSE,\"JpegProc\"},\n\t{TIFFTAG_JPEGRESTARTINTERVAL,1,1,TIFF_SHORT,FIELD_OJPEG_JPEGRESTARTINTERVAL,FALSE,FALSE,\"JpegRestartInterval\"},\n};\n\n#ifndef LIBJPEG_ENCAP_EXTERNAL\n#include <setjmp.h>\n#endif\n\n#include \"jpeglib.h\"\n#include \"jerror.h\"\n\ntypedef struct jpeg_error_mgr jpeg_error_mgr;\ntypedef struct jpeg_common_struct jpeg_common_struct;\ntypedef struct jpeg_decompress_struct jpeg_decompress_struct;\ntypedef struct jpeg_source_mgr jpeg_source_mgr;\n\ntypedef enum {\n\tosibsNotSetYet,\n\tosibsJpegInterchangeFormat,\n\tosibsStrile,\n\tosibsEof\n} OJPEGStateInBufferSource;\n\ntypedef enum {\n\tososSoi,\n\tososQTable0,ososQTable1,ososQTable2,ososQTable3,\n\tososDcTable0,ososDcTable1,ososDcTable2,ososDcTable3,\n\tososAcTable0,ososAcTable1,ososAcTable2,ososAcTable3,\n\tososDri,\n\tososSof,\n\tososSos,\n\tososCompressed,\n\tososRst,\n\tososEoi\n} OJPEGStateOutState;\n\ntypedef struct {\n\tTIFF* tif;\n\t#ifndef LIBJPEG_ENCAP_EXTERNAL\n\tJMP_BUF exit_jmpbuf;\n\t#endif\n\tTIFFVGetMethod vgetparent;\n\tTIFFVSetMethod vsetparent;\n\ttoff_t file_size;\n\tuint32 image_width;\n\tuint32 image_length;\n\tuint32 strile_width;\n\tuint32 strile_length;\n\tuint32 strile_length_total;\n\tuint8 samples_per_pixel;\n\tuint8 plane_sample_offset;\n\tuint8 samples_per_pixel_per_plane;\n\ttoff_t jpeg_interchange_format;\n\ttoff_t jpeg_interchange_format_length;\n\tuint8 jpeg_proc;\n\tuint8 subsamplingcorrect;\n\tuint8 subsamplingcorrect_done;\n\tuint8 subsampling_tag;\n\tuint8 subsampling_hor;\n\tuint8 subsampling_ver;\n\tuint8 subsampling_force_desubsampling_inside_decompression;\n\tuint8 qtable_offset_count;\n\tuint8 dctable_offset_count;\n\tuint8 actable_offset_count;\n\ttoff_t qtable_offset[3];\n\ttoff_t dctable_offset[3];\n\ttoff_t actable_offset[3];\n\tuint8* qtable[4];\n\tuint8* dctable[4];\n\tuint8* actable[4];\n\tuint16 restart_interval;\n\tuint8 restart_index;\n\tuint8 sof_log;\n\tuint8 sof_marker_id;\n\tuint32 sof_x;\n\tuint32 sof_y;\n\tuint8 sof_c[3];\n\tuint8 sof_hv[3];\n\tuint8 sof_tq[3];\n\tuint8 sos_cs[3];\n\tuint8 sos_tda[3];\n\tstruct {\n\t\tuint8 log;\n\t\tOJPEGStateInBufferSource in_buffer_source;\n\t\ttstrile_t in_buffer_next_strile;\n\t\ttoff_t in_buffer_file_pos;\n\t\ttoff_t in_buffer_file_togo;\n\t} sos_end[3];\n\tuint8 readheader_done;\n\tuint8 writeheader_done;\n\ttsample_t write_cursample;\n\ttstrile_t write_curstrile;\n\tuint8 libjpeg_session_active;\n\tuint8 libjpeg_jpeg_query_style;\n\tjpeg_error_mgr libjpeg_jpeg_error_mgr;\n\tjpeg_decompress_struct libjpeg_jpeg_decompress_struct;\n\tjpeg_source_mgr libjpeg_jpeg_source_mgr;\n\tuint8 subsampling_convert_log;\n\tuint32 subsampling_convert_ylinelen;\n\tuint32 subsampling_convert_ylines;\n\tuint32 subsampling_convert_clinelen;\n\tuint32 subsampling_convert_clines;\n\tuint32 subsampling_convert_ybuflen;\n\tuint32 subsampling_convert_cbuflen;\n\tuint32 subsampling_convert_ycbcrbuflen;\n\tuint8* subsampling_convert_ycbcrbuf;\n\tuint8* subsampling_convert_ybuf;\n\tuint8* subsampling_convert_cbbuf;\n\tuint8* subsampling_convert_crbuf;\n\tuint32 subsampling_convert_ycbcrimagelen;\n\tuint8** subsampling_convert_ycbcrimage;\n\tuint32 subsampling_convert_clinelenout;\n\tuint32 subsampling_convert_state;\n\tuint32 bytes_per_line;   /* if the codec outputs subsampled data, a 'line' in bytes_per_line */\n\tuint32 lines_per_strile; /* and lines_per_strile means subsampling_ver desubsampled rows     */\n\tOJPEGStateInBufferSource in_buffer_source;\n\ttstrile_t in_buffer_next_strile;\n\ttstrile_t in_buffer_strile_count;\n\ttoff_t in_buffer_file_pos;\n\tuint8 in_buffer_file_pos_log;\n\ttoff_t in_buffer_file_togo;\n\tuint16 in_buffer_togo;\n\tuint8* in_buffer_cur;\n\tuint8 in_buffer[OJPEG_BUFFER];\n\tOJPEGStateOutState out_state;\n\tuint8 out_buffer[OJPEG_BUFFER];\n\tuint8* skip_buffer;\n} OJPEGState;\n\nstatic int OJPEGVGetField(TIFF* tif, ttag_t tag, va_list ap);\nstatic int OJPEGVSetField(TIFF* tif, ttag_t tag, va_list ap);\nstatic void OJPEGPrintDir(TIFF* tif, FILE* fd, long flags);\n\nstatic int OJPEGSetupDecode(TIFF* tif);\nstatic int OJPEGPreDecode(TIFF* tif, tsample_t s);\nstatic int OJPEGPreDecodeSkipRaw(TIFF* tif);\nstatic int OJPEGPreDecodeSkipScanlines(TIFF* tif);\nstatic int OJPEGDecode(TIFF* tif, tidata_t buf, tsize_t cc, tsample_t s);\nstatic int OJPEGDecodeRaw(TIFF* tif, tidata_t buf, tsize_t cc);\nstatic int OJPEGDecodeScanlines(TIFF* tif, tidata_t buf, tsize_t cc);\nstatic void OJPEGPostDecode(TIFF* tif, tidata_t buf, tsize_t cc);\nstatic int OJPEGSetupEncode(TIFF* tif);\nstatic int OJPEGPreEncode(TIFF* tif, tsample_t s);\nstatic int OJPEGEncode(TIFF* tif, tidata_t buf, tsize_t cc, tsample_t s);\nstatic int OJPEGPostEncode(TIFF* tif);\nstatic void OJPEGCleanup(TIFF* tif);\n\nstatic void OJPEGSubsamplingCorrect(TIFF* tif);\nstatic int OJPEGReadHeaderInfo(TIFF* tif);\nstatic int OJPEGReadSecondarySos(TIFF* tif, tsample_t s);\nstatic int OJPEGWriteHeaderInfo(TIFF* tif);\nstatic void OJPEGLibjpegSessionAbort(TIFF* tif);\n\nstatic int OJPEGReadHeaderInfoSec(TIFF* tif);\nstatic int OJPEGReadHeaderInfoSecStreamDri(TIFF* tif);\nstatic int OJPEGReadHeaderInfoSecStreamDqt(TIFF* tif);\nstatic int OJPEGReadHeaderInfoSecStreamDht(TIFF* tif);\nstatic int OJPEGReadHeaderInfoSecStreamSof(TIFF* tif, uint8 marker_id);\nstatic int OJPEGReadHeaderInfoSecStreamSos(TIFF* tif);\nstatic int OJPEGReadHeaderInfoSecTablesQTable(TIFF* tif);\nstatic int OJPEGReadHeaderInfoSecTablesDcTable(TIFF* tif);\nstatic int OJPEGReadHeaderInfoSecTablesAcTable(TIFF* tif);\n\nstatic int OJPEGReadBufferFill(OJPEGState* sp);\nstatic int OJPEGReadByte(OJPEGState* sp, uint8* byte);\nstatic int OJPEGReadBytePeek(OJPEGState* sp, uint8* byte);\nstatic void OJPEGReadByteAdvance(OJPEGState* sp);\nstatic int OJPEGReadWord(OJPEGState* sp, uint16* word);\nstatic int OJPEGReadBlock(OJPEGState* sp, uint16 len, void* mem);\nstatic void OJPEGReadSkip(OJPEGState* sp, uint16 len);\n\nstatic int OJPEGWriteStream(TIFF* tif, void** mem, uint32* len);\nstatic void OJPEGWriteStreamSoi(TIFF* tif, void** mem, uint32* len);\nstatic void OJPEGWriteStreamQTable(TIFF* tif, uint8 table_index, void** mem, uint32* len);\nstatic void OJPEGWriteStreamDcTable(TIFF* tif, uint8 table_index, void** mem, uint32* len);\nstatic void OJPEGWriteStreamAcTable(TIFF* tif, uint8 table_index, void** mem, uint32* len);\nstatic void OJPEGWriteStreamDri(TIFF* tif, void** mem, uint32* len);\nstatic void OJPEGWriteStreamSof(TIFF* tif, void** mem, uint32* len);\nstatic void OJPEGWriteStreamSos(TIFF* tif, void** mem, uint32* len);\nstatic int OJPEGWriteStreamCompressed(TIFF* tif, void** mem, uint32* len);\nstatic void OJPEGWriteStreamRst(TIFF* tif, void** mem, uint32* len);\nstatic void OJPEGWriteStreamEoi(TIFF* tif, void** mem, uint32* len);\n\n#ifdef LIBJPEG_ENCAP_EXTERNAL\nextern int jpeg_create_decompress_encap(OJPEGState* sp, jpeg_decompress_struct* cinfo);\nextern int jpeg_read_header_encap(OJPEGState* sp, jpeg_decompress_struct* cinfo, uint8 require_image);\nextern int jpeg_start_decompress_encap(OJPEGState* sp, jpeg_decompress_struct* cinfo);\nextern int jpeg_read_scanlines_encap(OJPEGState* sp, jpeg_decompress_struct* cinfo, void* scanlines, uint32 max_lines);\nextern int jpeg_read_raw_data_encap(OJPEGState* sp, jpeg_decompress_struct* cinfo, void* data, uint32 max_lines);\nextern void jpeg_encap_unwind(TIFF* tif);\n#else\nstatic int jpeg_create_decompress_encap(OJPEGState* sp, jpeg_decompress_struct* j);\nstatic int jpeg_read_header_encap(OJPEGState* sp, jpeg_decompress_struct* cinfo, uint8 require_image);\nstatic int jpeg_start_decompress_encap(OJPEGState* sp, jpeg_decompress_struct* cinfo);\nstatic int jpeg_read_scanlines_encap(OJPEGState* sp, jpeg_decompress_struct* cinfo, void* scanlines, uint32 max_lines);\nstatic int jpeg_read_raw_data_encap(OJPEGState* sp, jpeg_decompress_struct* cinfo, void* data, uint32 max_lines);\nstatic void jpeg_encap_unwind(TIFF* tif);\n#endif\n\nstatic void OJPEGLibjpegJpegErrorMgrOutputMessage(jpeg_common_struct* cinfo);\nstatic void OJPEGLibjpegJpegErrorMgrErrorExit(jpeg_common_struct* cinfo);\nstatic void OJPEGLibjpegJpegSourceMgrInitSource(jpeg_decompress_struct* cinfo);\nstatic boolean OJPEGLibjpegJpegSourceMgrFillInputBuffer(jpeg_decompress_struct* cinfo);\nstatic void OJPEGLibjpegJpegSourceMgrSkipInputData(jpeg_decompress_struct* cinfo, long num_bytes);\nstatic boolean OJPEGLibjpegJpegSourceMgrResyncToRestart(jpeg_decompress_struct* cinfo, int desired);\nstatic void OJPEGLibjpegJpegSourceMgrTermSource(jpeg_decompress_struct* cinfo);\n\nint\nTIFFInitOJPEG(TIFF* tif, int scheme)\n{\n\tstatic const char module[]=\"TIFFInitOJPEG\";\n\tOJPEGState* sp;\n\n\tassert(scheme==COMPRESSION_OJPEG);\n\n        /*\n\t * Merge codec-specific tag information.\n\t */\n\tif (!_TIFFMergeFieldInfo(tif,ojpeg_field_info,FIELD_OJPEG_COUNT)) {\n\t\tTIFFErrorExt(tif->tif_clientdata, module,\n\t\t\t     \"Merging Old JPEG codec-specific tags failed\");\n\t\treturn 0;\n\t}\n\n\t/* state block */\n\tsp=_TIFFmalloc(sizeof(OJPEGState));\n\tif (sp==NULL)\n\t{\n\t\tTIFFErrorExt(tif->tif_clientdata,module,\"No space for OJPEG state block\");\n\t\treturn(0);\n\t}\n\t_TIFFmemset(sp,0,sizeof(OJPEGState));\n\tsp->tif=tif;\n\tsp->jpeg_proc=1;\n\tsp->subsampling_hor=2;\n\tsp->subsampling_ver=2;\n\tTIFFSetField(tif,TIFFTAG_YCBCRSUBSAMPLING,2,2);\n\t/* tif codec methods */\n\ttif->tif_setupdecode=OJPEGSetupDecode;\n\ttif->tif_predecode=OJPEGPreDecode;\n\ttif->tif_postdecode=OJPEGPostDecode;\n\ttif->tif_decoderow=OJPEGDecode;\n\ttif->tif_decodestrip=OJPEGDecode;\n\ttif->tif_decodetile=OJPEGDecode;\n\ttif->tif_setupencode=OJPEGSetupEncode;\n\ttif->tif_preencode=OJPEGPreEncode;\n\ttif->tif_postencode=OJPEGPostEncode;\n\ttif->tif_encoderow=OJPEGEncode;\n\ttif->tif_encodestrip=OJPEGEncode;\n\ttif->tif_encodetile=OJPEGEncode;\n\ttif->tif_cleanup=OJPEGCleanup;\n\ttif->tif_data=(tidata_t)sp;\n\t/* tif tag methods */\n\tsp->vgetparent=tif->tif_tagmethods.vgetfield;\n\ttif->tif_tagmethods.vgetfield=OJPEGVGetField;\n\tsp->vsetparent=tif->tif_tagmethods.vsetfield;\n\ttif->tif_tagmethods.vsetfield=OJPEGVSetField;\n\ttif->tif_tagmethods.printdir=OJPEGPrintDir;\n\t/* Some OJPEG files don't have strip or tile offsets or bytecounts tags.\n\t   Some others do, but have totally meaningless or corrupt values\n\t   in these tags. In these cases, the JpegInterchangeFormat stream is\n\t   reliable. In any case, this decoder reads the compressed data itself,\n\t   from the most reliable locations, and we need to notify encapsulating\n\t   LibTiff not to read raw strips or tiles for us. */\n\ttif->tif_flags|=TIFF_NOREADRAW;\n\treturn(1);\n}\n\nstatic int\nOJPEGVGetField(TIFF* tif, ttag_t tag, va_list ap)\n{\n\tOJPEGState* sp=(OJPEGState*)tif->tif_data;\n\tswitch(tag)\n\t{\n\t\tcase TIFFTAG_JPEGIFOFFSET:\n\t\t\t*va_arg(ap,uint32*)=(uint32)sp->jpeg_interchange_format;\n\t\t\tbreak;\n\t\tcase TIFFTAG_JPEGIFBYTECOUNT:\n\t\t\t*va_arg(ap,uint32*)=(uint32)sp->jpeg_interchange_format_length;\n\t\t\tbreak;\n\t\tcase TIFFTAG_YCBCRSUBSAMPLING:\n\t\t\tif (sp->subsamplingcorrect_done==0)\n\t\t\t\tOJPEGSubsamplingCorrect(tif);\n\t\t\t*va_arg(ap,uint16*)=(uint16)sp->subsampling_hor;\n\t\t\t*va_arg(ap,uint16*)=(uint16)sp->subsampling_ver;\n\t\t\tbreak;\n\t\tcase TIFFTAG_JPEGQTABLES:\n\t\t\t*va_arg(ap,uint32*)=(uint32)sp->qtable_offset_count;\n\t\t\t*va_arg(ap,void**)=(void*)sp->qtable_offset;\n\t\t\tbreak;\n\t\tcase TIFFTAG_JPEGDCTABLES:\n\t\t\t*va_arg(ap,uint32*)=(uint32)sp->dctable_offset_count;\n\t\t\t*va_arg(ap,void**)=(void*)sp->dctable_offset;\n\t\t\tbreak;\n\t\tcase TIFFTAG_JPEGACTABLES:\n\t\t\t*va_arg(ap,uint32*)=(uint32)sp->actable_offset_count;\n\t\t\t*va_arg(ap,void**)=(void*)sp->actable_offset;\n\t\t\tbreak;\n\t\tcase TIFFTAG_JPEGPROC:\n\t\t\t*va_arg(ap,uint16*)=(uint16)sp->jpeg_proc;\n\t\t\tbreak;\n\t\tcase TIFFTAG_JPEGRESTARTINTERVAL:\n\t\t\t*va_arg(ap,uint16*)=sp->restart_interval;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\treturn (*sp->vgetparent)(tif,tag,ap);\n\t}\n\treturn (1);\n}\n\nstatic int\nOJPEGVSetField(TIFF* tif, ttag_t tag, va_list ap)\n{\n\tstatic const char module[]=\"OJPEGVSetField\";\n\tOJPEGState* sp=(OJPEGState*)tif->tif_data;\n\tuint32 ma;\n\tuint32* mb;\n\tuint32 n;\n\tswitch(tag)\n\t{\n\t\tcase TIFFTAG_JPEGIFOFFSET:\n\t\t\tsp->jpeg_interchange_format=(toff_t)va_arg(ap,uint32);  \n\t\t\tbreak;\n\t\tcase TIFFTAG_JPEGIFBYTECOUNT:\n\t\t\tsp->jpeg_interchange_format_length=(toff_t)va_arg(ap,uint32);  \n\t\t\tbreak;\n\t\tcase TIFFTAG_YCBCRSUBSAMPLING:\n\t\t\tsp->subsampling_tag=1;\n\t\t\tsp->subsampling_hor=(uint8)va_arg(ap,int);\n\t\t\tsp->subsampling_ver=(uint8)va_arg(ap,int);\n\t\t\ttif->tif_dir.td_ycbcrsubsampling[0]=sp->subsampling_hor;\n\t\t\ttif->tif_dir.td_ycbcrsubsampling[1]=sp->subsampling_ver;\n\t\t\tbreak;\n\t\tcase TIFFTAG_JPEGQTABLES:\n\t\t\tma=va_arg(ap,uint32);\n\t\t\tif (ma!=0)\n\t\t\t{\n\t\t\t\tif (ma>3)\n\t\t\t\t{\n\t\t\t\t\tTIFFErrorExt(tif->tif_clientdata,module,\"JpegQTables tag has incorrect count\");\n\t\t\t\t\treturn(0);\n\t\t\t\t}\n\t\t\t\tsp->qtable_offset_count=(uint8)ma;\n\t\t\t\tmb=va_arg(ap,uint32*);\n\t\t\t\tfor (n=0; n<ma; n++)\n\t\t\t\t\tsp->qtable_offset[n]=(toff_t)mb[n];\n\t\t\t}\n\t\t\tbreak;\n\t\tcase TIFFTAG_JPEGDCTABLES:\n\t\t\tma=va_arg(ap,uint32);\n\t\t\tif (ma!=0)\n\t\t\t{\n\t\t\t\tif (ma>3)\n\t\t\t\t{\n\t\t\t\t\tTIFFErrorExt(tif->tif_clientdata,module,\"JpegDcTables tag has incorrect count\");\n\t\t\t\t\treturn(0);\n\t\t\t\t}\n\t\t\t\tsp->dctable_offset_count=(uint8)ma;\n\t\t\t\tmb=va_arg(ap,uint32*);\n\t\t\t\tfor (n=0; n<ma; n++)\n\t\t\t\t\tsp->dctable_offset[n]=(toff_t)mb[n];\n\t\t\t}\n\t\t\tbreak;\n\t\tcase TIFFTAG_JPEGACTABLES:\n\t\t\tma=va_arg(ap,uint32);\n\t\t\tif (ma!=0)\n\t\t\t{\n\t\t\t\tif (ma>3)\n\t\t\t\t{\n\t\t\t\t\tTIFFErrorExt(tif->tif_clientdata,module,\"JpegAcTables tag has incorrect count\");\n\t\t\t\t\treturn(0);\n\t\t\t\t}\n\t\t\t\tsp->actable_offset_count=(uint8)ma;\n\t\t\t\tmb=va_arg(ap,uint32*);\n\t\t\t\tfor (n=0; n<ma; n++)\n\t\t\t\t\tsp->actable_offset[n]=(toff_t)mb[n];\n\t\t\t}\n\t\t\tbreak;\n\t\tcase TIFFTAG_JPEGPROC:\n\t\t\tsp->jpeg_proc=(uint8)va_arg(ap,uint32);\n\t\t\tbreak;\n\t\tcase TIFFTAG_JPEGRESTARTINTERVAL:\n\t\t\tsp->restart_interval=(uint16)va_arg(ap,uint32);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\treturn (*sp->vsetparent)(tif,tag,ap);\n\t}\n\tTIFFSetFieldBit(tif,_TIFFFieldWithTag(tif,tag)->field_bit);\n\ttif->tif_flags|=TIFF_DIRTYDIRECT;\n\treturn(1);\n}\n\nstatic void\nOJPEGPrintDir(TIFF* tif, FILE* fd, long flags)\n{\n\tOJPEGState* sp=(OJPEGState*)tif->tif_data;\n\tuint8 m;\n\t(void)flags;\n\tassert(sp!=NULL);\n\tif (TIFFFieldSet(tif,FIELD_OJPEG_JPEGINTERCHANGEFORMAT))\n\t\tfprintf(fd,\"  JpegInterchangeFormat: %lu\\n\",(unsigned long)sp->jpeg_interchange_format);\n\tif (TIFFFieldSet(tif,FIELD_OJPEG_JPEGINTERCHANGEFORMATLENGTH))\n\t\tfprintf(fd,\"  JpegInterchangeFormatLength: %lu\\n\",(unsigned long)sp->jpeg_interchange_format_length);\n\tif (TIFFFieldSet(tif,FIELD_OJPEG_JPEGQTABLES))\n\t{\n\t\tfprintf(fd,\"  JpegQTables:\");\n\t\tfor (m=0; m<sp->qtable_offset_count; m++)\n\t\t\tfprintf(fd,\" %lu\",(unsigned long)sp->qtable_offset[m]);\n\t\tfprintf(fd,\"\\n\");\n\t}\n\tif (TIFFFieldSet(tif,FIELD_OJPEG_JPEGDCTABLES))\n\t{\n\t\tfprintf(fd,\"  JpegDcTables:\");\n\t\tfor (m=0; m<sp->dctable_offset_count; m++)\n\t\t\tfprintf(fd,\" %lu\",(unsigned long)sp->dctable_offset[m]);\n\t\tfprintf(fd,\"\\n\");\n\t}\n\tif (TIFFFieldSet(tif,FIELD_OJPEG_JPEGACTABLES))\n\t{\n\t\tfprintf(fd,\"  JpegAcTables:\");\n\t\tfor (m=0; m<sp->actable_offset_count; m++)\n\t\t\tfprintf(fd,\" %lu\",(unsigned long)sp->actable_offset[m]);\n\t\tfprintf(fd,\"\\n\");\n\t}\n\tif (TIFFFieldSet(tif,FIELD_OJPEG_JPEGPROC))\n\t\tfprintf(fd,\"  JpegProc: %u\\n\",(unsigned int)sp->jpeg_proc);\n\tif (TIFFFieldSet(tif,FIELD_OJPEG_JPEGRESTARTINTERVAL))\n\t\tfprintf(fd,\"  JpegRestartInterval: %u\\n\",(unsigned int)sp->restart_interval);\n}\n\nstatic int\nOJPEGSetupDecode(TIFF* tif)\n{\n\tstatic const char module[]=\"OJPEGSetupDecode\";\n\tTIFFWarningExt(tif->tif_clientdata,module,\"Depreciated and troublesome old-style JPEG compression mode, please convert to new-style JPEG compression and notify vendor of writing software\");\n\treturn(1);\n}\n\nstatic int\nOJPEGPreDecode(TIFF* tif, tsample_t s)\n{\n\tOJPEGState* sp=(OJPEGState*)tif->tif_data;\n\ttstrile_t m;\n\tif (sp->subsamplingcorrect_done==0)\n\t\tOJPEGSubsamplingCorrect(tif);\n\tif (sp->readheader_done==0)\n\t{\n\t\tif (OJPEGReadHeaderInfo(tif)==0)\n\t\t\treturn(0);\n\t}\n\tif (sp->sos_end[s].log==0)\n\t{\n\t\tif (OJPEGReadSecondarySos(tif,s)==0)\n\t\t\treturn(0);\n\t}\n\tif isTiled(tif)\n\t\tm=(tstrile_t)tif->tif_curtile;\n\telse\n\t\tm=(tstrile_t)tif->tif_curstrip;\n\tif ((sp->writeheader_done!=0) && ((sp->write_cursample!=s) || (sp->write_curstrile>m)))\n\t{\n\t\tif (sp->libjpeg_session_active!=0)\n\t\t\tOJPEGLibjpegSessionAbort(tif);\n\t\tsp->writeheader_done=0;\n\t}\n\tif (sp->writeheader_done==0)\n\t{\n\t\tsp->plane_sample_offset=s;\n\t\tsp->write_cursample=s;\n\t\tsp->write_curstrile=s*tif->tif_dir.td_stripsperimage;\n\t\tif ((sp->in_buffer_file_pos_log==0) ||\n\t\t    (sp->in_buffer_file_pos-sp->in_buffer_togo!=sp->sos_end[s].in_buffer_file_pos))\n\t\t{\n\t\t\tsp->in_buffer_source=sp->sos_end[s].in_buffer_source;\n\t\t\tsp->in_buffer_next_strile=sp->sos_end[s].in_buffer_next_strile;\n\t\t\tsp->in_buffer_file_pos=sp->sos_end[s].in_buffer_file_pos;\n\t\t\tsp->in_buffer_file_pos_log=0;\n\t\t\tsp->in_buffer_file_togo=sp->sos_end[s].in_buffer_file_togo;\n\t\t\tsp->in_buffer_togo=0;\n\t\t\tsp->in_buffer_cur=0;\n\t\t}\n\t\tif (OJPEGWriteHeaderInfo(tif)==0)\n\t\t\treturn(0);\n\t}\n\twhile (sp->write_curstrile<m)          \n\t{\n\t\tif (sp->libjpeg_jpeg_query_style==0)\n\t\t{\n\t\t\tif (OJPEGPreDecodeSkipRaw(tif)==0)\n\t\t\t\treturn(0);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif (OJPEGPreDecodeSkipScanlines(tif)==0)\n\t\t\t\treturn(0);\n\t\t}\n\t\tsp->write_curstrile++;\n\t}\n\treturn(1);\n}\n\nstatic int\nOJPEGPreDecodeSkipRaw(TIFF* tif)\n{\n\tOJPEGState* sp=(OJPEGState*)tif->tif_data;\n\tuint32 m;\n\tm=sp->lines_per_strile;\n\tif (sp->subsampling_convert_state!=0)\n\t{\n\t\tif (sp->subsampling_convert_clines-sp->subsampling_convert_state>=m)\n\t\t{\n\t\t\tsp->subsampling_convert_state+=m;\n\t\t\tif (sp->subsampling_convert_state==sp->subsampling_convert_clines)\n\t\t\t\tsp->subsampling_convert_state=0;\n\t\t\treturn(1);\n\t\t}\n\t\tm-=sp->subsampling_convert_clines-sp->subsampling_convert_state;\n\t\tsp->subsampling_convert_state=0;\n\t}\n\twhile (m>=sp->subsampling_convert_clines)\n\t{\n\t\tif (jpeg_read_raw_data_encap(sp,&(sp->libjpeg_jpeg_decompress_struct),sp->subsampling_convert_ycbcrimage,sp->subsampling_ver*8)==0)\n\t\t\treturn(0);\n\t\tm-=sp->subsampling_convert_clines;\n\t}\n\tif (m>0)\n\t{\n\t\tif (jpeg_read_raw_data_encap(sp,&(sp->libjpeg_jpeg_decompress_struct),sp->subsampling_convert_ycbcrimage,sp->subsampling_ver*8)==0)\n\t\t\treturn(0);\n\t\tsp->subsampling_convert_state=m;\n\t}\n\treturn(1);\n}\n\nstatic int\nOJPEGPreDecodeSkipScanlines(TIFF* tif)\n{\n\tstatic const char module[]=\"OJPEGPreDecodeSkipScanlines\";\n\tOJPEGState* sp=(OJPEGState*)tif->tif_data;\n\tuint32 m;\n\tif (sp->skip_buffer==NULL)\n\t{\n\t\tsp->skip_buffer=_TIFFmalloc(sp->bytes_per_line);\n\t\tif (sp->skip_buffer==NULL)\n\t\t{\n\t\t\tTIFFErrorExt(tif->tif_clientdata,module,\"Out of memory\");\n\t\t\treturn(0);\n\t\t}\n\t}\n\tfor (m=0; m<sp->lines_per_strile; m++)\n\t{\n\t\tif (jpeg_read_scanlines_encap(sp,&(sp->libjpeg_jpeg_decompress_struct),&sp->skip_buffer,1)==0)\n\t\t\treturn(0);\n\t}\n\treturn(1);\n}\n\nstatic int\nOJPEGDecode(TIFF* tif, tidata_t buf, tsize_t cc, tsample_t s)\n{\n\tOJPEGState* sp=(OJPEGState*)tif->tif_data;\n\t(void)s;\n\tif (sp->libjpeg_jpeg_query_style==0)\n\t{\n\t\tif (OJPEGDecodeRaw(tif,buf,cc)==0)\n\t\t\treturn(0);\n\t}\n\telse\n\t{\n\t\tif (OJPEGDecodeScanlines(tif,buf,cc)==0)\n\t\t\treturn(0);\n\t}\n\treturn(1);\n}\n\nstatic int\nOJPEGDecodeRaw(TIFF* tif, tidata_t buf, tsize_t cc)\n{\n\tstatic const char module[]=\"OJPEGDecodeRaw\";\n\tOJPEGState* sp=(OJPEGState*)tif->tif_data;\n\tuint8* m;\n\tuint32 n;\n\tuint8* oy;\n\tuint8* ocb;\n\tuint8* ocr;\n\tuint8* p;\n\tuint32 q;\n\tuint8* r;\n\tuint8 sx,sy;\n\tif (cc%sp->bytes_per_line!=0)\n\t{\n\t\tTIFFErrorExt(tif->tif_clientdata,module,\"Fractional scanline not read\");\n\t\treturn(0);\n\t}\n\tassert(cc>0);\n\tm=buf;\n\tn=cc;\n\tdo\n\t{\n\t\tif (sp->subsampling_convert_state==0)\n\t\t{\n\t\t\tif (jpeg_read_raw_data_encap(sp,&(sp->libjpeg_jpeg_decompress_struct),sp->subsampling_convert_ycbcrimage,sp->subsampling_ver*8)==0)\n\t\t\t\treturn(0);\n\t\t}\n\t\toy=sp->subsampling_convert_ybuf+sp->subsampling_convert_state*sp->subsampling_ver*sp->subsampling_convert_ylinelen;\n\t\tocb=sp->subsampling_convert_cbbuf+sp->subsampling_convert_state*sp->subsampling_convert_clinelen;\n\t\tocr=sp->subsampling_convert_crbuf+sp->subsampling_convert_state*sp->subsampling_convert_clinelen;\n\t\tp=m;\n\t\tfor (q=0; q<sp->subsampling_convert_clinelenout; q++)\n\t\t{\n\t\t\tr=oy;\n\t\t\tfor (sy=0; sy<sp->subsampling_ver; sy++)\n\t\t\t{\n\t\t\t\tfor (sx=0; sx<sp->subsampling_hor; sx++)\n\t\t\t\t\t*p++=*r++;\n\t\t\t\tr+=sp->subsampling_convert_ylinelen-sp->subsampling_hor;\n\t\t\t}\n\t\t\toy+=sp->subsampling_hor;\n\t\t\t*p++=*ocb++;\n\t\t\t*p++=*ocr++;\n\t\t}\n\t\tsp->subsampling_convert_state++;\n\t\tif (sp->subsampling_convert_state==sp->subsampling_convert_clines)\n\t\t\tsp->subsampling_convert_state=0;\n\t\tm+=sp->bytes_per_line;\n\t\tn-=sp->bytes_per_line;\n\t} while(n>0);\n\treturn(1);\n}\n\nstatic int\nOJPEGDecodeScanlines(TIFF* tif, tidata_t buf, tsize_t cc)\n{\n\tstatic const char module[]=\"OJPEGDecodeScanlines\";\n\tOJPEGState* sp=(OJPEGState*)tif->tif_data;\n\tuint8* m;\n\tuint32 n;\n\tif (cc%sp->bytes_per_line!=0)\n\t{\n\t\tTIFFErrorExt(tif->tif_clientdata,module,\"Fractional scanline not read\");\n\t\treturn(0);\n\t}\n\tassert(cc>0);\n\tm=buf;\n\tn=cc;\n\tdo\n\t{\n\t\tif (jpeg_read_scanlines_encap(sp,&(sp->libjpeg_jpeg_decompress_struct),&m,1)==0)\n\t\t\treturn(0);\n\t\tm+=sp->bytes_per_line;\n\t\tn-=sp->bytes_per_line;\n\t} while(n>0);\n\treturn(1);\n}\n\nstatic void\nOJPEGPostDecode(TIFF* tif, tidata_t buf, tsize_t cc)\n{\n\tOJPEGState* sp=(OJPEGState*)tif->tif_data;\n\t(void)buf;\n\t(void)cc;\n\tsp->write_curstrile++;\n\tif (sp->write_curstrile%tif->tif_dir.td_stripsperimage==0)\n\t{\n\t\tassert(sp->libjpeg_session_active!=0);\n\t\tOJPEGLibjpegSessionAbort(tif);\n\t\tsp->writeheader_done=0;\n\t}\n}\n\nstatic int\nOJPEGSetupEncode(TIFF* tif)\n{\n\tstatic const char module[]=\"OJPEGSetupEncode\";\n\tTIFFErrorExt(tif->tif_clientdata,module,\"OJPEG encoding not supported; use new-style JPEG compression instead\");\n\treturn(0);\n}\n\nstatic int\nOJPEGPreEncode(TIFF* tif, tsample_t s)\n{\n\tstatic const char module[]=\"OJPEGPreEncode\";\n\t(void)s;\n\tTIFFErrorExt(tif->tif_clientdata,module,\"OJPEG encoding not supported; use new-style JPEG compression instead\");\n\treturn(0);\n}\n\nstatic int\nOJPEGEncode(TIFF* tif, tidata_t buf, tsize_t cc, tsample_t s)\n{\n\tstatic const char module[]=\"OJPEGEncode\";\n\t(void)buf;\n\t(void)cc;\n\t(void)s;\n\tTIFFErrorExt(tif->tif_clientdata,module,\"OJPEG encoding not supported; use new-style JPEG compression instead\");\n\treturn(0);\n}\n\nstatic int\nOJPEGPostEncode(TIFF* tif)\n{\n\tstatic const char module[]=\"OJPEGPostEncode\";\n\tTIFFErrorExt(tif->tif_clientdata,module,\"OJPEG encoding not supported; use new-style JPEG compression instead\");\n\treturn(0);\n}\n\nstatic void\nOJPEGCleanup(TIFF* tif)\n{\n\tOJPEGState* sp=(OJPEGState*)tif->tif_data;\n\tif (sp!=0)\n\t{\n\t\ttif->tif_tagmethods.vgetfield=sp->vgetparent;\n\t\ttif->tif_tagmethods.vsetfield=sp->vsetparent;\n\t\tif (sp->qtable[0]!=0)\n\t\t\t_TIFFfree(sp->qtable[0]);\n\t\tif (sp->qtable[1]!=0)\n\t\t\t_TIFFfree(sp->qtable[1]);\n\t\tif (sp->qtable[2]!=0)\n\t\t\t_TIFFfree(sp->qtable[2]);\n\t\tif (sp->qtable[3]!=0)\n\t\t\t_TIFFfree(sp->qtable[3]);\n\t\tif (sp->dctable[0]!=0)\n\t\t\t_TIFFfree(sp->dctable[0]);\n\t\tif (sp->dctable[1]!=0)\n\t\t\t_TIFFfree(sp->dctable[1]);\n\t\tif (sp->dctable[2]!=0)\n\t\t\t_TIFFfree(sp->dctable[2]);\n\t\tif (sp->dctable[3]!=0)\n\t\t\t_TIFFfree(sp->dctable[3]);\n\t\tif (sp->actable[0]!=0)\n\t\t\t_TIFFfree(sp->actable[0]);\n\t\tif (sp->actable[1]!=0)\n\t\t\t_TIFFfree(sp->actable[1]);\n\t\tif (sp->actable[2]!=0)\n\t\t\t_TIFFfree(sp->actable[2]);\n\t\tif (sp->actable[3]!=0)\n\t\t\t_TIFFfree(sp->actable[3]);\n\t\tif (sp->libjpeg_session_active!=0)\n\t\t\tOJPEGLibjpegSessionAbort(tif);\n\t\tif (sp->subsampling_convert_ycbcrbuf!=0)\n\t\t\t_TIFFfree(sp->subsampling_convert_ycbcrbuf);\n\t\tif (sp->subsampling_convert_ycbcrimage!=0)\n\t\t\t_TIFFfree(sp->subsampling_convert_ycbcrimage);\n\t\tif (sp->skip_buffer!=0)\n\t\t\t_TIFFfree(sp->skip_buffer);\n\t\t_TIFFfree(sp);\n\t\ttif->tif_data=NULL;\n\t\t_TIFFSetDefaultCompressionState(tif);\n\t}\n}\n\nstatic void\nOJPEGSubsamplingCorrect(TIFF* tif)\n{\n\tstatic const char module[]=\"OJPEGSubsamplingCorrect\";\n\tOJPEGState* sp=(OJPEGState*)tif->tif_data;\n\tuint8 mh;\n\tuint8 mv;\n\tassert(sp->subsamplingcorrect_done==0);\n\tif ((tif->tif_dir.td_samplesperpixel!=3) || ((tif->tif_dir.td_photometric!=PHOTOMETRIC_YCBCR) &&\n\t    (tif->tif_dir.td_photometric!=PHOTOMETRIC_ITULAB)))\n\t{\n\t\tif (sp->subsampling_tag!=0)\n\t\t\tTIFFWarningExt(tif->tif_clientdata,module,\"Subsampling tag not appropriate for this Photometric and/or SamplesPerPixel\");\n\t\tsp->subsampling_hor=1;\n\t\tsp->subsampling_ver=1;\n\t\tsp->subsampling_force_desubsampling_inside_decompression=0;\n\t}\n\telse\n\t{\n\t\tsp->subsamplingcorrect_done=1;\n\t\tmh=sp->subsampling_hor;\n\t\tmv=sp->subsampling_ver;\n\t\tsp->subsamplingcorrect=1;\n\t\tOJPEGReadHeaderInfoSec(tif);\n\t\tif (sp->subsampling_force_desubsampling_inside_decompression!=0)\n\t\t{\n\t\t\tsp->subsampling_hor=1;\n\t\t\tsp->subsampling_ver=1;\n\t\t}\n\t\tsp->subsamplingcorrect=0;\n\t\tif (((sp->subsampling_hor!=mh) || (sp->subsampling_ver!=mv)) && (sp->subsampling_force_desubsampling_inside_decompression==0))\n\t\t{\n\t\t\tif (sp->subsampling_tag==0)\n\t\t\t\tTIFFWarningExt(tif->tif_clientdata,module,\"Subsampling tag is not set, yet subsampling inside JPEG data [%d,%d] does not match default values [2,2]; assuming subsampling inside JPEG data is correct\",sp->subsampling_hor,sp->subsampling_ver);\n\t\t\telse\n\t\t\t\tTIFFWarningExt(tif->tif_clientdata,module,\"Subsampling inside JPEG data [%d,%d] does not match subsampling tag values [%d,%d]; assuming subsampling inside JPEG data is correct\",sp->subsampling_hor,sp->subsampling_ver,mh,mv);\n\t\t}\n\t\tif (sp->subsampling_force_desubsampling_inside_decompression!=0)\n\t\t{\n\t\t\tif (sp->subsampling_tag==0)\n\t\t\t\tTIFFWarningExt(tif->tif_clientdata,module,\"Subsampling tag is not set, yet subsampling inside JPEG data does not match default values [2,2] (nor any other values allowed in TIFF); assuming subsampling inside JPEG data is correct and desubsampling inside JPEG decompression\");\n\t\t\telse\n\t\t\t\tTIFFWarningExt(tif->tif_clientdata,module,\"Subsampling inside JPEG data does not match subsampling tag values [%d,%d] (nor any other values allowed in TIFF); assuming subsampling inside JPEG data is correct and desubsampling inside JPEG decompression\",mh,mv);\n\t\t}\n\t\tif (sp->subsampling_force_desubsampling_inside_decompression==0)\n\t\t{\n\t\t\tif (sp->subsampling_hor<sp->subsampling_ver)\n\t\t\t\tTIFFWarningExt(tif->tif_clientdata,module,\"Subsampling values [%d,%d] are not allowed in TIFF\",sp->subsampling_hor,sp->subsampling_ver);\n\t\t}\n\t}\n\tsp->subsamplingcorrect_done=1;\n}\n\nstatic int\nOJPEGReadHeaderInfo(TIFF* tif)\n{\n\tstatic const char module[]=\"OJPEGReadHeaderInfo\";\n\tOJPEGState* sp=(OJPEGState*)tif->tif_data;\n\tassert(sp->readheader_done==0);\n\tsp->image_width=tif->tif_dir.td_imagewidth;\n\tsp->image_length=tif->tif_dir.td_imagelength;\n\tif isTiled(tif)\n\t{\n\t\tsp->strile_width=tif->tif_dir.td_tilewidth;\n\t\tsp->strile_length=tif->tif_dir.td_tilelength;\n\t\tsp->strile_length_total=((sp->image_length+sp->strile_length-1)/sp->strile_length)*sp->strile_length;\n\t}\n\telse\n\t{\n\t\tsp->strile_width=sp->image_width;\n\t\tsp->strile_length=tif->tif_dir.td_rowsperstrip;\n\t\tsp->strile_length_total=sp->image_length;\n\t}\n\tsp->samples_per_pixel=tif->tif_dir.td_samplesperpixel;\n\tif (sp->samples_per_pixel==1)\n\t{\n\t\tsp->plane_sample_offset=0;\n\t\tsp->samples_per_pixel_per_plane=sp->samples_per_pixel;\n\t\tsp->subsampling_hor=1;\n\t\tsp->subsampling_ver=1;\n\t}\n\telse\n\t{\n\t\tif (sp->samples_per_pixel!=3)\n\t\t{\n\t\t\tTIFFErrorExt(tif->tif_clientdata,module,\"SamplesPerPixel %d not supported for this compression scheme\",sp->samples_per_pixel);\n\t\t\treturn(0);\n\t\t}\n\t\tsp->plane_sample_offset=0;\n\t\tif (tif->tif_dir.td_planarconfig==PLANARCONFIG_CONTIG)\n\t\t\tsp->samples_per_pixel_per_plane=3;\n\t\telse\n\t\t\tsp->samples_per_pixel_per_plane=1;\n\t}\n\tif (sp->strile_length<sp->image_length)\n\t{\n\t\tif (sp->strile_length%(sp->subsampling_ver*8)!=0)\n\t\t{\n\t\t\tTIFFErrorExt(tif->tif_clientdata,module,\"Incompatible vertical subsampling and image strip/tile length\");\n\t\t\treturn(0);\n\t\t}\n\t\tsp->restart_interval=((sp->strile_width+sp->subsampling_hor*8-1)/(sp->subsampling_hor*8))*(sp->strile_length/(sp->subsampling_ver*8));\n\t}\n\tif (OJPEGReadHeaderInfoSec(tif)==0)\n\t\treturn(0);\n\tsp->sos_end[0].log=1;\n\tsp->sos_end[0].in_buffer_source=sp->in_buffer_source;\n\tsp->sos_end[0].in_buffer_next_strile=sp->in_buffer_next_strile;\n\tsp->sos_end[0].in_buffer_file_pos=sp->in_buffer_file_pos-sp->in_buffer_togo;\n\tsp->sos_end[0].in_buffer_file_togo=sp->in_buffer_file_togo+sp->in_buffer_togo;\n\tsp->readheader_done=1;\n\treturn(1);\n}\n\nstatic int\nOJPEGReadSecondarySos(TIFF* tif, tsample_t s)\n{\n\tOJPEGState* sp=(OJPEGState*)tif->tif_data;\n\tuint8 m;\n\tassert(s>0);\n\tassert(s<3);\n\tassert(sp->sos_end[0].log!=0);\n\tassert(sp->sos_end[s].log==0);\n\tsp->plane_sample_offset=s-1;\n\twhile(sp->sos_end[sp->plane_sample_offset].log==0)\n\t\tsp->plane_sample_offset--;\n\tsp->in_buffer_source=sp->sos_end[sp->plane_sample_offset].in_buffer_source;\n\tsp->in_buffer_next_strile=sp->sos_end[sp->plane_sample_offset].in_buffer_next_strile;\n\tsp->in_buffer_file_pos=sp->sos_end[sp->plane_sample_offset].in_buffer_file_pos;  \n\tsp->in_buffer_file_pos_log=0;\n\tsp->in_buffer_file_togo=sp->sos_end[sp->plane_sample_offset].in_buffer_file_togo;\n\tsp->in_buffer_togo=0;\n\tsp->in_buffer_cur=0;\n\twhile(sp->plane_sample_offset<s)\n\t{\n\t\tdo\n\t\t{\n\t\t\tif (OJPEGReadByte(sp,&m)==0)\n\t\t\t\treturn(0);\n\t\t\tif (m==255)\n\t\t\t{\n\t\t\t\tdo\n\t\t\t\t{\n\t\t\t\t\tif (OJPEGReadByte(sp,&m)==0)\n\t\t\t\t\t\treturn(0);\n\t\t\t\t\tif (m!=255)\n\t\t\t\t\t\tbreak;\n\t\t\t\t} while(1);\n\t\t\t\tif (m==JPEG_MARKER_SOS)\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t} while(1);\n\t\tsp->plane_sample_offset++;\n\t\tif (OJPEGReadHeaderInfoSecStreamSos(tif)==0)\n\t\t\treturn(0);\n\t\tsp->sos_end[sp->plane_sample_offset].log=1;\n\t\tsp->sos_end[sp->plane_sample_offset].in_buffer_source=sp->in_buffer_source;\n\t\tsp->sos_end[sp->plane_sample_offset].in_buffer_next_strile=sp->in_buffer_next_strile;\n\t\tsp->sos_end[sp->plane_sample_offset].in_buffer_file_pos=sp->in_buffer_file_pos-sp->in_buffer_togo;\n\t\tsp->sos_end[sp->plane_sample_offset].in_buffer_file_togo=sp->in_buffer_file_togo+sp->in_buffer_togo;\n\t}\n\treturn(1);\n}\n\nstatic int\nOJPEGWriteHeaderInfo(TIFF* tif)\n{\n\tstatic const char module[]=\"OJPEGWriteHeaderInfo\";\n\tOJPEGState* sp=(OJPEGState*)tif->tif_data;\n\tuint8** m;\n\tuint32 n;\n\tassert(sp->libjpeg_session_active==0);\n\tsp->out_state=ososSoi;\n\tsp->restart_index=0;\n\tjpeg_std_error(&(sp->libjpeg_jpeg_error_mgr));\n\tsp->libjpeg_jpeg_error_mgr.output_message=OJPEGLibjpegJpegErrorMgrOutputMessage;\n\tsp->libjpeg_jpeg_error_mgr.error_exit=OJPEGLibjpegJpegErrorMgrErrorExit;\n\tsp->libjpeg_jpeg_decompress_struct.err=&(sp->libjpeg_jpeg_error_mgr);\n\tsp->libjpeg_jpeg_decompress_struct.client_data=(void*)tif;\n\tif (jpeg_create_decompress_encap(sp,&(sp->libjpeg_jpeg_decompress_struct))==0)\n\t\treturn(0);\n\tsp->libjpeg_session_active=1;\n\tsp->libjpeg_jpeg_source_mgr.bytes_in_buffer=0;\n\tsp->libjpeg_jpeg_source_mgr.init_source=OJPEGLibjpegJpegSourceMgrInitSource;\n\tsp->libjpeg_jpeg_source_mgr.fill_input_buffer=OJPEGLibjpegJpegSourceMgrFillInputBuffer;\n\tsp->libjpeg_jpeg_source_mgr.skip_input_data=OJPEGLibjpegJpegSourceMgrSkipInputData;\n\tsp->libjpeg_jpeg_source_mgr.resync_to_restart=OJPEGLibjpegJpegSourceMgrResyncToRestart;\n\tsp->libjpeg_jpeg_source_mgr.term_source=OJPEGLibjpegJpegSourceMgrTermSource;\n\tsp->libjpeg_jpeg_decompress_struct.src=&(sp->libjpeg_jpeg_source_mgr);\n\tif (jpeg_read_header_encap(sp,&(sp->libjpeg_jpeg_decompress_struct),1)==0)\n\t\treturn(0);\n\tif ((sp->subsampling_force_desubsampling_inside_decompression==0) && (sp->samples_per_pixel_per_plane>1))\n\t{\n\t\tsp->libjpeg_jpeg_decompress_struct.raw_data_out=1;\n#if JPEG_LIB_VERSION >= 70\n\t\tsp->libjpeg_jpeg_decompress_struct.do_fancy_upsampling=FALSE;\n#endif\n\t\tsp->libjpeg_jpeg_query_style=0;\n\t\tif (sp->subsampling_convert_log==0)\n\t\t{\n\t\t\tassert(sp->subsampling_convert_ycbcrbuf==0);\n\t\t\tassert(sp->subsampling_convert_ycbcrimage==0);\n\t\t\tsp->subsampling_convert_ylinelen=((sp->strile_width+sp->subsampling_hor*8-1)/(sp->subsampling_hor*8)*sp->subsampling_hor*8);\n\t\t\tsp->subsampling_convert_ylines=sp->subsampling_ver*8;\n\t\t\tsp->subsampling_convert_clinelen=sp->subsampling_convert_ylinelen/sp->subsampling_hor;\n\t\t\tsp->subsampling_convert_clines=8;\n\t\t\tsp->subsampling_convert_ybuflen=sp->subsampling_convert_ylinelen*sp->subsampling_convert_ylines;\n\t\t\tsp->subsampling_convert_cbuflen=sp->subsampling_convert_clinelen*sp->subsampling_convert_clines;\n\t\t\tsp->subsampling_convert_ycbcrbuflen=sp->subsampling_convert_ybuflen+2*sp->subsampling_convert_cbuflen;\n\t\t\tsp->subsampling_convert_ycbcrbuf=_TIFFmalloc(sp->subsampling_convert_ycbcrbuflen);\n\t\t\tif (sp->subsampling_convert_ycbcrbuf==0)\n\t\t\t{\n\t\t\t\tTIFFErrorExt(tif->tif_clientdata,module,\"Out of memory\");\n\t\t\t\treturn(0);\n\t\t\t}\n\t\t\tsp->subsampling_convert_ybuf=sp->subsampling_convert_ycbcrbuf;\n\t\t\tsp->subsampling_convert_cbbuf=sp->subsampling_convert_ybuf+sp->subsampling_convert_ybuflen;\n\t\t\tsp->subsampling_convert_crbuf=sp->subsampling_convert_cbbuf+sp->subsampling_convert_cbuflen;\n\t\t\tsp->subsampling_convert_ycbcrimagelen=3+sp->subsampling_convert_ylines+2*sp->subsampling_convert_clines;\n\t\t\tsp->subsampling_convert_ycbcrimage=_TIFFmalloc(sp->subsampling_convert_ycbcrimagelen*sizeof(uint8*));\n\t\t\tif (sp->subsampling_convert_ycbcrimage==0)\n\t\t\t{\n\t\t\t\tTIFFErrorExt(tif->tif_clientdata,module,\"Out of memory\");\n\t\t\t\treturn(0);\n\t\t\t}\n\t\t\tm=sp->subsampling_convert_ycbcrimage;\n\t\t\t*m++=(uint8*)(sp->subsampling_convert_ycbcrimage+3);\n\t\t\t*m++=(uint8*)(sp->subsampling_convert_ycbcrimage+3+sp->subsampling_convert_ylines);\n\t\t\t*m++=(uint8*)(sp->subsampling_convert_ycbcrimage+3+sp->subsampling_convert_ylines+sp->subsampling_convert_clines);\n\t\t\tfor (n=0; n<sp->subsampling_convert_ylines; n++)\n\t\t\t\t*m++=sp->subsampling_convert_ybuf+n*sp->subsampling_convert_ylinelen;\n\t\t\tfor (n=0; n<sp->subsampling_convert_clines; n++)\n\t\t\t\t*m++=sp->subsampling_convert_cbbuf+n*sp->subsampling_convert_clinelen;\n\t\t\tfor (n=0; n<sp->subsampling_convert_clines; n++)\n\t\t\t\t*m++=sp->subsampling_convert_crbuf+n*sp->subsampling_convert_clinelen;\n\t\t\tsp->subsampling_convert_clinelenout=((sp->strile_width+sp->subsampling_hor-1)/sp->subsampling_hor);\n\t\t\tsp->subsampling_convert_state=0;\n\t\t\tsp->bytes_per_line=sp->subsampling_convert_clinelenout*(sp->subsampling_ver*sp->subsampling_hor+2);\n\t\t\tsp->lines_per_strile=((sp->strile_length+sp->subsampling_ver-1)/sp->subsampling_ver);\n\t\t\tsp->subsampling_convert_log=1;\n\t\t}\n\t}\n\telse\n\t{\n\t\tsp->libjpeg_jpeg_decompress_struct.jpeg_color_space=JCS_UNKNOWN;\n\t\tsp->libjpeg_jpeg_decompress_struct.out_color_space=JCS_UNKNOWN;\n\t\tsp->libjpeg_jpeg_query_style=1;\n\t\tsp->bytes_per_line=sp->samples_per_pixel_per_plane*sp->strile_width;\n\t\tsp->lines_per_strile=sp->strile_length;\n\t}\n\tif (jpeg_start_decompress_encap(sp,&(sp->libjpeg_jpeg_decompress_struct))==0)\n\t\treturn(0);\n\tsp->writeheader_done=1;\n\treturn(1);\n}\n\nstatic void\nOJPEGLibjpegSessionAbort(TIFF* tif)\n{\n\tOJPEGState* sp=(OJPEGState*)tif->tif_data;\n\tassert(sp->libjpeg_session_active!=0);\n\tjpeg_destroy((jpeg_common_struct*)(&(sp->libjpeg_jpeg_decompress_struct)));\n\tsp->libjpeg_session_active=0;\n}\n\nstatic int\nOJPEGReadHeaderInfoSec(TIFF* tif)\n{\n\tstatic const char module[]=\"OJPEGReadHeaderInfoSec\";\n\tOJPEGState* sp=(OJPEGState*)tif->tif_data;\n\tuint8 m;\n\tuint16 n;\n\tuint8 o;\n\tif (sp->file_size==0)\n\t\tsp->file_size=TIFFGetFileSize(tif);\n\tif (sp->jpeg_interchange_format!=0)\n\t{\n\t\tif (sp->jpeg_interchange_format>=sp->file_size)\n\t\t{\n\t\t\tsp->jpeg_interchange_format=0;\n\t\t\tsp->jpeg_interchange_format_length=0;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif ((sp->jpeg_interchange_format_length==0) || (sp->jpeg_interchange_format+sp->jpeg_interchange_format_length>sp->file_size))\n\t\t\t\tsp->jpeg_interchange_format_length=sp->file_size-sp->jpeg_interchange_format;\n\t\t}\n\t}\n\tsp->in_buffer_source=osibsNotSetYet;\n\tsp->in_buffer_next_strile=0;\n\tsp->in_buffer_strile_count=tif->tif_dir.td_nstrips;   \n\tsp->in_buffer_file_togo=0;\n\tsp->in_buffer_togo=0;\n\tdo\n\t{\n\t\tif (OJPEGReadBytePeek(sp,&m)==0)\n\t\t\treturn(0);\n\t\tif (m!=255)\n\t\t\tbreak;\n\t\tOJPEGReadByteAdvance(sp);\n\t\tdo\n\t\t{\n\t\t\tif (OJPEGReadByte(sp,&m)==0)\n\t\t\t\treturn(0);\n\t\t} while(m==255);\n\t\tswitch(m)\n\t\t{\n\t\t\tcase JPEG_MARKER_SOI:\n\t\t\t\t/* this type of marker has no data, and should be skipped */\n\t\t\t\tbreak;\n\t\t\tcase JPEG_MARKER_COM:\n\t\t\tcase JPEG_MARKER_APP0:\n\t\t\tcase JPEG_MARKER_APP0+1:\n\t\t\tcase JPEG_MARKER_APP0+2:\n\t\t\tcase JPEG_MARKER_APP0+3:\n\t\t\tcase JPEG_MARKER_APP0+4:\n\t\t\tcase JPEG_MARKER_APP0+5:\n\t\t\tcase JPEG_MARKER_APP0+6:\n\t\t\tcase JPEG_MARKER_APP0+7:\n\t\t\tcase JPEG_MARKER_APP0+8:\n\t\t\tcase JPEG_MARKER_APP0+9:\n\t\t\tcase JPEG_MARKER_APP0+10:\n\t\t\tcase JPEG_MARKER_APP0+11:\n\t\t\tcase JPEG_MARKER_APP0+12:\n\t\t\tcase JPEG_MARKER_APP0+13:\n\t\t\tcase JPEG_MARKER_APP0+14:\n\t\t\tcase JPEG_MARKER_APP0+15:\n\t\t\t\t/* this type of marker has data, but it has no use to us (and no place here) and should be skipped */\n\t\t\t\tif (OJPEGReadWord(sp,&n)==0)\n\t\t\t\t\treturn(0);\n\t\t\t\tif (n<2)\n\t\t\t\t{\n\t\t\t\t\tif (sp->subsamplingcorrect==0)\n\t\t\t\t\t\tTIFFErrorExt(tif->tif_clientdata,module,\"Corrupt JPEG data\");\n\t\t\t\t\treturn(0);\n\t\t\t\t}\n\t\t\t\tif (n>2)\n\t\t\t\t\tOJPEGReadSkip(sp,n-2);\n\t\t\t\tbreak;\n\t\t\tcase JPEG_MARKER_DRI:\n\t\t\t\tif (OJPEGReadHeaderInfoSecStreamDri(tif)==0)\n\t\t\t\t\treturn(0);\n\t\t\t\tbreak;\n\t\t\tcase JPEG_MARKER_DQT:\n\t\t\t\tif (OJPEGReadHeaderInfoSecStreamDqt(tif)==0)\n\t\t\t\t\treturn(0);\n\t\t\t\tbreak;\n\t\t\tcase JPEG_MARKER_DHT:\n\t\t\t\tif (OJPEGReadHeaderInfoSecStreamDht(tif)==0)\n\t\t\t\t\treturn(0);\n\t\t\t\tbreak;\n\t\t\tcase JPEG_MARKER_SOF0:\n\t\t\tcase JPEG_MARKER_SOF1:\n\t\t\tcase JPEG_MARKER_SOF3:\n\t\t\t\tif (OJPEGReadHeaderInfoSecStreamSof(tif,m)==0)\n\t\t\t\t\treturn(0);\n\t\t\t\tif (sp->subsamplingcorrect!=0)\n\t\t\t\t\treturn(1);\n\t\t\t\tbreak;\n\t\t\tcase JPEG_MARKER_SOS:\n\t\t\t\tif (sp->subsamplingcorrect!=0)\n\t\t\t\t\treturn(1);\n\t\t\t\tassert(sp->plane_sample_offset==0);\n\t\t\t\tif (OJPEGReadHeaderInfoSecStreamSos(tif)==0)\n\t\t\t\t\treturn(0);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tTIFFErrorExt(tif->tif_clientdata,module,\"Unknown marker type %d in JPEG data\",m);\n\t\t\t\treturn(0);\n\t\t}\n\t} while(m!=JPEG_MARKER_SOS);\n\tif (sp->subsamplingcorrect)\n\t\treturn(1);\n\tif (sp->sof_log==0)\n\t{\n\t\tif (OJPEGReadHeaderInfoSecTablesQTable(tif)==0)\n\t\t\treturn(0);\n\t\tsp->sof_marker_id=JPEG_MARKER_SOF0;\n\t\tfor (o=0; o<sp->samples_per_pixel; o++)\n\t\t\tsp->sof_c[o]=o;\n\t\tsp->sof_hv[0]=((sp->subsampling_hor<<4)|sp->subsampling_ver);\n\t\tfor (o=1; o<sp->samples_per_pixel; o++)\n\t\t\tsp->sof_hv[o]=17;\n\t\tsp->sof_x=sp->strile_width;\n\t\tsp->sof_y=sp->strile_length_total;\n\t\tsp->sof_log=1;\n\t\tif (OJPEGReadHeaderInfoSecTablesDcTable(tif)==0)\n\t\t\treturn(0);\n\t\tif (OJPEGReadHeaderInfoSecTablesAcTable(tif)==0)\n\t\t\treturn(0);\n\t\tfor (o=1; o<sp->samples_per_pixel; o++)\n\t\t\tsp->sos_cs[o]=o;\n\t}\n\treturn(1);\n}\n\nstatic int\nOJPEGReadHeaderInfoSecStreamDri(TIFF* tif)\n{\n\t/* this could easilly cause trouble in some cases... but no such cases have occured sofar */\n\tstatic const char module[]=\"OJPEGReadHeaderInfoSecStreamDri\";\n\tOJPEGState* sp=(OJPEGState*)tif->tif_data;\n\tuint16 m;\n\tif (OJPEGReadWord(sp,&m)==0)\n\t\treturn(0);\n\tif (m!=4)\n\t{\n\t\tTIFFErrorExt(tif->tif_clientdata,module,\"Corrupt DRI marker in JPEG data\");\n\t\treturn(0);\n\t}\n\tif (OJPEGReadWord(sp,&m)==0)\n\t\treturn(0);\n\tsp->restart_interval=m;\n\treturn(1);\n}\n\nstatic int\nOJPEGReadHeaderInfoSecStreamDqt(TIFF* tif)\n{\n\t/* this is a table marker, and it is to be saved as a whole for exact pushing on the jpeg stream later on */\n\tstatic const char module[]=\"OJPEGReadHeaderInfoSecStreamDqt\";\n\tOJPEGState* sp=(OJPEGState*)tif->tif_data;\n\tuint16 m;\n\tuint32 na;\n\tuint8* nb;\n\tuint8 o;\n\tif (OJPEGReadWord(sp,&m)==0)\n\t\treturn(0);\n\tif (m<=2)\n\t{\n\t\tif (sp->subsamplingcorrect==0)\n\t\t\tTIFFErrorExt(tif->tif_clientdata,module,\"Corrupt DQT marker in JPEG data\");\n\t\treturn(0);\n\t}\n\tif (sp->subsamplingcorrect!=0)\n\t\tOJPEGReadSkip(sp,m-2);\n\telse\n\t{\n\t\tm-=2;\n\t\tdo\n\t\t{\n\t\t\tif (m<65)\n\t\t\t{\n\t\t\t\tTIFFErrorExt(tif->tif_clientdata,module,\"Corrupt DQT marker in JPEG data\");\n\t\t\t\treturn(0);\n\t\t\t}\n\t\t\tna=sizeof(uint32)+69;\n\t\t\tnb=_TIFFmalloc(na);\n\t\t\tif (nb==0)\n\t\t\t{\n\t\t\t\tTIFFErrorExt(tif->tif_clientdata,module,\"Out of memory\");\n\t\t\t\treturn(0);\n\t\t\t}\n\t\t\t*(uint32*)nb=na;\n\t\t\tnb[sizeof(uint32)]=255;\n\t\t\tnb[sizeof(uint32)+1]=JPEG_MARKER_DQT;\n\t\t\tnb[sizeof(uint32)+2]=0;\n\t\t\tnb[sizeof(uint32)+3]=67;\n\t\t\tif (OJPEGReadBlock(sp,65,&nb[sizeof(uint32)+4])==0)\n\t\t\t\treturn(0);\n\t\t\to=nb[sizeof(uint32)+4]&15;\n\t\t\tif (3<o)\n\t\t\t{\n\t\t\t\tTIFFErrorExt(tif->tif_clientdata,module,\"Corrupt DQT marker in JPEG data\");\n\t\t\t\treturn(0);\n\t\t\t}\n\t\t\tif (sp->qtable[o]!=0)\n\t\t\t\t_TIFFfree(sp->qtable[o]);\n\t\t\tsp->qtable[o]=nb;\n\t\t\tm-=65;\n\t\t} while(m>0);\n\t}\n\treturn(1);\n}\n\nstatic int\nOJPEGReadHeaderInfoSecStreamDht(TIFF* tif)\n{\n\t/* this is a table marker, and it is to be saved as a whole for exact pushing on the jpeg stream later on */\n\t/* TODO: the following assumes there is only one table in this marker... but i'm not quite sure that assumption is guaranteed correct */\n\tstatic const char module[]=\"OJPEGReadHeaderInfoSecStreamDht\";\n\tOJPEGState* sp=(OJPEGState*)tif->tif_data;\n\tuint16 m;\n\tuint32 na;\n\tuint8* nb;\n\tuint8 o;\n\tif (OJPEGReadWord(sp,&m)==0)\n\t\treturn(0);\n\tif (m<=2)\n\t{\n\t\tif (sp->subsamplingcorrect==0)\n\t\t\tTIFFErrorExt(tif->tif_clientdata,module,\"Corrupt DHT marker in JPEG data\");\n\t\treturn(0);\n\t}\n\tif (sp->subsamplingcorrect!=0)\n\t{\n\t\tOJPEGReadSkip(sp,m-2);\n\t}\n\telse\n\t{\n\t\tna=sizeof(uint32)+2+m;\n\t\tnb=_TIFFmalloc(na);\n\t\tif (nb==0)\n\t\t{\n\t\t\tTIFFErrorExt(tif->tif_clientdata,module,\"Out of memory\");\n\t\t\treturn(0);\n\t\t}\n\t\t*(uint32*)nb=na;\n\t\tnb[sizeof(uint32)]=255;\n\t\tnb[sizeof(uint32)+1]=JPEG_MARKER_DHT;\n\t\tnb[sizeof(uint32)+2]=(m>>8);\n\t\tnb[sizeof(uint32)+3]=(m&255);\n\t\tif (OJPEGReadBlock(sp,m-2,&nb[sizeof(uint32)+4])==0)\n\t\t\treturn(0);\n\t\to=nb[sizeof(uint32)+4];\n\t\tif ((o&240)==0)\n\t\t{\n\t\t\tif (3<o)\n\t\t\t{\n\t\t\t\tTIFFErrorExt(tif->tif_clientdata,module,\"Corrupt DHT marker in JPEG data\");\n\t\t\t\treturn(0);\n\t\t\t}\n\t\t\tif (sp->dctable[o]!=0)\n\t\t\t\t_TIFFfree(sp->dctable[o]);\n\t\t\tsp->dctable[o]=nb;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif ((o&240)!=16)\n\t\t\t{\n\t\t\t\tTIFFErrorExt(tif->tif_clientdata,module,\"Corrupt DHT marker in JPEG data\");\n\t\t\t\treturn(0);\n\t\t\t}\n\t\t\to&=15;\n\t\t\tif (3<o)\n\t\t\t{\n\t\t\t\tTIFFErrorExt(tif->tif_clientdata,module,\"Corrupt DHT marker in JPEG data\");\n\t\t\t\treturn(0);\n\t\t\t}\n\t\t\tif (sp->actable[o]!=0)\n\t\t\t\t_TIFFfree(sp->actable[o]);\n\t\t\tsp->actable[o]=nb;\n\t\t}\n\t}\n\treturn(1);\n}\n\nstatic int\nOJPEGReadHeaderInfoSecStreamSof(TIFF* tif, uint8 marker_id)\n{\n\t/* this marker needs to be checked, and part of its data needs to be saved for regeneration later on */\n\tstatic const char module[]=\"OJPEGReadHeaderInfoSecStreamSof\";\n\tOJPEGState* sp=(OJPEGState*)tif->tif_data;\n\tuint16 m;\n\tuint16 n;\n\tuint8 o;\n\tuint16 p;\n\tuint16 q;\n\tif (sp->sof_log!=0)\n\t{\n\t\tTIFFErrorExt(tif->tif_clientdata,module,\"Corrupt JPEG data\");\n\t\treturn(0);\n\t}\n\tif (sp->subsamplingcorrect==0)\n\t\tsp->sof_marker_id=marker_id;\n\t/* Lf: data length */\n\tif (OJPEGReadWord(sp,&m)==0)\n\t\treturn(0);\n\tif (m<11)\n\t{\n\t\tif (sp->subsamplingcorrect==0)\n\t\t\tTIFFErrorExt(tif->tif_clientdata,module,\"Corrupt SOF marker in JPEG data\");\n\t\treturn(0);\n\t}\n\tm-=8;\n\tif (m%3!=0)\n\t{\n\t\tif (sp->subsamplingcorrect==0)\n\t\t\tTIFFErrorExt(tif->tif_clientdata,module,\"Corrupt SOF marker in JPEG data\");\n\t\treturn(0);\n\t}\n\tn=m/3;\n\tif (sp->subsamplingcorrect==0)\n\t{\n\t\tif (n!=sp->samples_per_pixel)\n\t\t{\n\t\t\tTIFFErrorExt(tif->tif_clientdata,module,\"JPEG compressed data indicates unexpected number of samples\");\n\t\t\treturn(0);\n\t\t}\n\t}\n\t/* P: Sample precision */\n\tif (OJPEGReadByte(sp,&o)==0)\n\t\treturn(0);\n\tif (o!=8)\n\t{\n\t\tif (sp->subsamplingcorrect==0)\n\t\t\tTIFFErrorExt(tif->tif_clientdata,module,\"JPEG compressed data indicates unexpected number of bits per sample\");\n\t\treturn(0);\n\t}\n\t/* Y: Number of lines, X: Number of samples per line */\n\tif (sp->subsamplingcorrect)\n\t\tOJPEGReadSkip(sp,4);\n\telse\n\t{\n\t\t/* TODO: probably best to also add check on allowed upper bound, especially x, may cause buffer overflow otherwise i think */\n\t\t/* Y: Number of lines */\n\t\tif (OJPEGReadWord(sp,&p)==0)\n\t\t\treturn(0);\n\t\tif ((p<sp->image_length) && (p<sp->strile_length_total))\n\t\t{\n\t\t\tTIFFErrorExt(tif->tif_clientdata,module,\"JPEG compressed data indicates unexpected height\");\n\t\t\treturn(0);\n\t\t}\n\t\tsp->sof_y=p;\n\t\t/* X: Number of samples per line */\n\t\tif (OJPEGReadWord(sp,&p)==0)\n\t\t\treturn(0);\n\t\tif ((p<sp->image_width) && (p<sp->strile_width))\n\t\t{\n\t\t\tTIFFErrorExt(tif->tif_clientdata,module,\"JPEG compressed data indicates unexpected width\");\n\t\t\treturn(0);\n\t\t}\n\t\tsp->sof_x=p;\n\t}\n\t/* Nf: Number of image components in frame */\n\tif (OJPEGReadByte(sp,&o)==0)\n\t\treturn(0);\n\tif (o!=n)\n\t{\n\t\tif (sp->subsamplingcorrect==0)\n\t\t\tTIFFErrorExt(tif->tif_clientdata,module,\"Corrupt SOF marker in JPEG data\");\n\t\treturn(0);\n\t}\n\t/* per component stuff */\n\t/* TODO: double-check that flow implies that n cannot be as big as to make us overflow sof_c, sof_hv and sof_tq arrays */\n\tfor (q=0; q<n; q++)\n\t{\n\t\t/* C: Component identifier */\n\t\tif (OJPEGReadByte(sp,&o)==0)\n\t\t\treturn(0);\n\t\tif (sp->subsamplingcorrect==0)\n\t\t\tsp->sof_c[q]=o;\n\t\t/* H: Horizontal sampling factor, and V: Vertical sampling factor */\n\t\tif (OJPEGReadByte(sp,&o)==0)\n\t\t\treturn(0);\n\t\tif (sp->subsamplingcorrect!=0)\n\t\t{\n\t\t\tif (q==0)\n\t\t\t{\n\t\t\t\tsp->subsampling_hor=(o>>4);\n\t\t\t\tsp->subsampling_ver=(o&15);\n\t\t\t\tif (((sp->subsampling_hor!=1) && (sp->subsampling_hor!=2) && (sp->subsampling_hor!=4)) ||\n\t\t\t\t\t((sp->subsampling_ver!=1) && (sp->subsampling_ver!=2) && (sp->subsampling_ver!=4)))\n\t\t\t\t\tsp->subsampling_force_desubsampling_inside_decompression=1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif (o!=17)\n\t\t\t\t\tsp->subsampling_force_desubsampling_inside_decompression=1;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tsp->sof_hv[q]=o;\n\t\t\tif (sp->subsampling_force_desubsampling_inside_decompression==0)\n\t\t\t{\n\t\t\t\tif (q==0)\n\t\t\t\t{\n\t\t\t\t\tif (o!=((sp->subsampling_hor<<4)|sp->subsampling_ver))\n\t\t\t\t\t{\n\t\t\t\t\t\tTIFFErrorExt(tif->tif_clientdata,module,\"JPEG compressed data indicates unexpected subsampling values\");\n\t\t\t\t\t\treturn(0);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tif (o!=17)\n\t\t\t\t\t{\n\t\t\t\t\t\tTIFFErrorExt(tif->tif_clientdata,module,\"JPEG compressed data indicates unexpected subsampling values\");\n\t\t\t\t\t\treturn(0);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t/* Tq: Quantization table destination selector */\n\t\tif (OJPEGReadByte(sp,&o)==0)\n\t\t\treturn(0);\n\t\tif (sp->subsamplingcorrect==0)\n\t\t\tsp->sof_tq[q]=o;\n\t}\n\tif (sp->subsamplingcorrect==0)\n\t\tsp->sof_log=1;\n\treturn(1);\n}\n\nstatic int\nOJPEGReadHeaderInfoSecStreamSos(TIFF* tif)\n{\n\t/* this marker needs to be checked, and part of its data needs to be saved for regeneration later on */\n\tstatic const char module[]=\"OJPEGReadHeaderInfoSecStreamSos\";\n\tOJPEGState* sp=(OJPEGState*)tif->tif_data;\n\tuint16 m;\n\tuint8 n;\n\tuint8 o;\n\tassert(sp->subsamplingcorrect==0);\n\tif (sp->sof_log==0)\n\t{\n\t\tTIFFErrorExt(tif->tif_clientdata,module,\"Corrupt SOS marker in JPEG data\");\n\t\treturn(0);\n\t}\n\t/* Ls */\n\tif (OJPEGReadWord(sp,&m)==0)\n\t\treturn(0);\n\tif (m!=6+sp->samples_per_pixel_per_plane*2)\n\t{\n\t\tTIFFErrorExt(tif->tif_clientdata,module,\"Corrupt SOS marker in JPEG data\");\n\t\treturn(0);\n\t}\n\t/* Ns */\n\tif (OJPEGReadByte(sp,&n)==0)\n\t\treturn(0);\n\tif (n!=sp->samples_per_pixel_per_plane)\n\t{\n\t\tTIFFErrorExt(tif->tif_clientdata,module,\"Corrupt SOS marker in JPEG data\");\n\t\treturn(0);\n\t}\n\t/* Cs, Td, and Ta */\n\tfor (o=0; o<sp->samples_per_pixel_per_plane; o++)\n\t{\n\t\t/* Cs */\n\t\tif (OJPEGReadByte(sp,&n)==0)\n\t\t\treturn(0);\n\t\tsp->sos_cs[sp->plane_sample_offset+o]=n;\n\t\t/* Td and Ta */\n\t\tif (OJPEGReadByte(sp,&n)==0)\n\t\t\treturn(0);\n\t\tsp->sos_tda[sp->plane_sample_offset+o]=n;\n\t}\n\t/* skip Ss, Se, Ah, en Al -> no check, as per Tom Lane recommendation, as per LibJpeg source */\n\tOJPEGReadSkip(sp,3);\n\treturn(1);\n}\n\nstatic int\nOJPEGReadHeaderInfoSecTablesQTable(TIFF* tif)\n{\n\tstatic const char module[]=\"OJPEGReadHeaderInfoSecTablesQTable\";\n\tOJPEGState* sp=(OJPEGState*)tif->tif_data;\n\tuint8 m;\n\tuint8 n;\n\tuint32 oa;\n\tuint8* ob;\n\tuint32 p;\n\tif (sp->qtable_offset[0]==0)\n\t{\n\t\tTIFFErrorExt(tif->tif_clientdata,module,\"Missing JPEG tables\");\n\t\treturn(0);\n\t}\n\tsp->in_buffer_file_pos_log=0;\n\tfor (m=0; m<sp->samples_per_pixel; m++)\n\t{\n\t\tif ((sp->qtable_offset[m]!=0) && ((m==0) || (sp->qtable_offset[m]!=sp->qtable_offset[m-1])))\n\t\t{\n\t\t\tfor (n=0; n<m-1; n++)\n\t\t\t{\n\t\t\t\tif (sp->qtable_offset[m]==sp->qtable_offset[n])\n\t\t\t\t{\n\t\t\t\t\tTIFFErrorExt(tif->tif_clientdata,module,\"Corrupt JpegQTables tag value\");\n\t\t\t\t\treturn(0);\n\t\t\t\t}\n\t\t\t}\n\t\t\toa=sizeof(uint32)+69;\n\t\t\tob=_TIFFmalloc(oa);\n\t\t\tif (ob==0)\n\t\t\t{\n\t\t\t\tTIFFErrorExt(tif->tif_clientdata,module,\"Out of memory\");\n\t\t\t\treturn(0);\n\t\t\t}\n\t\t\t*(uint32*)ob=oa;\n\t\t\tob[sizeof(uint32)]=255;\n\t\t\tob[sizeof(uint32)+1]=JPEG_MARKER_DQT;\n\t\t\tob[sizeof(uint32)+2]=0;\n\t\t\tob[sizeof(uint32)+3]=67;\n\t\t\tob[sizeof(uint32)+4]=m;\n\t\t\tTIFFSeekFile(tif,sp->qtable_offset[m],SEEK_SET);\n\t\t\tp=TIFFReadFile(tif,&ob[sizeof(uint32)+5],64);\n\t\t\tif (p!=64)\n\t\t\t\treturn(0);\n\t\t\tsp->qtable[m]=ob;\n\t\t\tsp->sof_tq[m]=m;\n\t\t}\n\t\telse\n\t\t\tsp->sof_tq[m]=sp->sof_tq[m-1];\n\t}\n\treturn(1);\n}\n\nstatic int\nOJPEGReadHeaderInfoSecTablesDcTable(TIFF* tif)\n{\n\tstatic const char module[]=\"OJPEGReadHeaderInfoSecTablesDcTable\";\n\tOJPEGState* sp=(OJPEGState*)tif->tif_data;\n\tuint8 m;\n\tuint8 n;\n\tuint8 o[16];\n\tuint32 p;\n\tuint32 q;\n\tuint32 ra;\n\tuint8* rb;\n\tif (sp->dctable_offset[0]==0)\n\t{\n\t\tTIFFErrorExt(tif->tif_clientdata,module,\"Missing JPEG tables\");\n\t\treturn(0);\n\t}\n\tsp->in_buffer_file_pos_log=0;\n\tfor (m=0; m<sp->samples_per_pixel; m++)\n\t{\n\t\tif ((sp->dctable_offset[m]!=0) && ((m==0) || (sp->dctable_offset[m]!=sp->dctable_offset[m-1])))\n\t\t{\n\t\t\tfor (n=0; n<m-1; n++)\n\t\t\t{\n\t\t\t\tif (sp->dctable_offset[m]==sp->dctable_offset[n])\n\t\t\t\t{\n\t\t\t\t\tTIFFErrorExt(tif->tif_clientdata,module,\"Corrupt JpegDcTables tag value\");\n\t\t\t\t\treturn(0);\n\t\t\t\t}\n\t\t\t}\n\t\t\tTIFFSeekFile(tif,sp->dctable_offset[m],SEEK_SET);\n\t\t\tp=TIFFReadFile(tif,o,16);\n\t\t\tif (p!=16)\n\t\t\t\treturn(0);\n\t\t\tq=0;\n\t\t\tfor (n=0; n<16; n++)\n\t\t\t\tq+=o[n];\n\t\t\tra=sizeof(uint32)+21+q;\n\t\t\trb=_TIFFmalloc(ra);\n\t\t\tif (rb==0)\n\t\t\t{\n\t\t\t\tTIFFErrorExt(tif->tif_clientdata,module,\"Out of memory\");\n\t\t\t\treturn(0);\n\t\t\t}\n\t\t\t*(uint32*)rb=ra;\n\t\t\trb[sizeof(uint32)]=255;\n\t\t\trb[sizeof(uint32)+1]=JPEG_MARKER_DHT;\n\t\t\trb[sizeof(uint32)+2]=((19+q)>>8);\n\t\t\trb[sizeof(uint32)+3]=((19+q)&255);\n\t\t\trb[sizeof(uint32)+4]=m;\n\t\t\tfor (n=0; n<16; n++)\n\t\t\t\trb[sizeof(uint32)+5+n]=o[n];\n\t\t\tp=TIFFReadFile(tif,&(rb[sizeof(uint32)+21]),q);\n\t\t\tif (p!=q)\n\t\t\t\treturn(0);\n\t\t\tsp->dctable[m]=rb;\n\t\t\tsp->sos_tda[m]=(m<<4);\n\t\t}\n\t\telse\n\t\t\tsp->sos_tda[m]=sp->sos_tda[m-1];\n\t}\n\treturn(1);\n}\n\nstatic int\nOJPEGReadHeaderInfoSecTablesAcTable(TIFF* tif)\n{\n\tstatic const char module[]=\"OJPEGReadHeaderInfoSecTablesAcTable\";\n\tOJPEGState* sp=(OJPEGState*)tif->tif_data;\n\tuint8 m;\n\tuint8 n;\n\tuint8 o[16];\n\tuint32 p;\n\tuint32 q;\n\tuint32 ra;\n\tuint8* rb;\n\tif (sp->actable_offset[0]==0)\n\t{\n\t\tTIFFErrorExt(tif->tif_clientdata,module,\"Missing JPEG tables\");\n\t\treturn(0);\n\t}\n\tsp->in_buffer_file_pos_log=0;\n\tfor (m=0; m<sp->samples_per_pixel; m++)\n\t{\n\t\tif ((sp->actable_offset[m]!=0) && ((m==0) || (sp->actable_offset[m]!=sp->actable_offset[m-1])))\n\t\t{\n\t\t\tfor (n=0; n<m-1; n++)\n\t\t\t{\n\t\t\t\tif (sp->actable_offset[m]==sp->actable_offset[n])\n\t\t\t\t{\n\t\t\t\t\tTIFFErrorExt(tif->tif_clientdata,module,\"Corrupt JpegAcTables tag value\");\n\t\t\t\t\treturn(0);\n\t\t\t\t}\n\t\t\t}\n\t\t\tTIFFSeekFile(tif,sp->actable_offset[m],SEEK_SET);\n\t\t\tp=TIFFReadFile(tif,o,16);\n\t\t\tif (p!=16)\n\t\t\t\treturn(0);\n\t\t\tq=0;\n\t\t\tfor (n=0; n<16; n++)\n\t\t\t\tq+=o[n];\n\t\t\tra=sizeof(uint32)+21+q;\n\t\t\trb=_TIFFmalloc(ra);\n\t\t\tif (rb==0)\n\t\t\t{\n\t\t\t\tTIFFErrorExt(tif->tif_clientdata,module,\"Out of memory\");\n\t\t\t\treturn(0);\n\t\t\t}\n\t\t\t*(uint32*)rb=ra;\n\t\t\trb[sizeof(uint32)]=255;\n\t\t\trb[sizeof(uint32)+1]=JPEG_MARKER_DHT;\n\t\t\trb[sizeof(uint32)+2]=((19+q)>>8);\n\t\t\trb[sizeof(uint32)+3]=((19+q)&255);\n\t\t\trb[sizeof(uint32)+4]=(16|m);\n\t\t\tfor (n=0; n<16; n++)\n\t\t\t\trb[sizeof(uint32)+5+n]=o[n];\n\t\t\tp=TIFFReadFile(tif,&(rb[sizeof(uint32)+21]),q);\n\t\t\tif (p!=q)\n\t\t\t\treturn(0);\n\t\t\tsp->actable[m]=rb;\n\t\t\tsp->sos_tda[m]=(sp->sos_tda[m]|m);\n\t\t}\n\t\telse\n\t\t\tsp->sos_tda[m]=(sp->sos_tda[m]|(sp->sos_tda[m-1]&15));\n\t}\n\treturn(1);\n}\n\nstatic int\nOJPEGReadBufferFill(OJPEGState* sp)\n{\n\tuint16 m;\n\ttsize_t n;\n\t/* TODO: double-check: when subsamplingcorrect is set, no call to TIFFErrorExt or TIFFWarningExt should be made\n\t * in any other case, seek or read errors should be passed through */\n\tdo\n\t{\n\t\tif (sp->in_buffer_file_togo!=0)\n\t\t{\n\t\t\tif (sp->in_buffer_file_pos_log==0)\n\t\t\t{\n\t\t\t\tTIFFSeekFile(sp->tif,sp->in_buffer_file_pos,SEEK_SET);\n\t\t\t\tsp->in_buffer_file_pos_log=1;\n\t\t\t}\n\t\t\tm=OJPEG_BUFFER;\n\t\t\tif (m>sp->in_buffer_file_togo)\n\t\t\t\tm=(uint16)sp->in_buffer_file_togo;\n\t\t\tn=TIFFReadFile(sp->tif,sp->in_buffer,(tsize_t)m);\n\t\t\tif (n==0)\n\t\t\t\treturn(0);\n\t\t\tassert(n>0);\n\t\t\tassert(n<=OJPEG_BUFFER);\n\t\t\tassert(n<65536);\n\t\t\tassert((uint16)n<=sp->in_buffer_file_togo);\n\t\t\tm=(uint16)n;\n\t\t\tsp->in_buffer_togo=m;\n\t\t\tsp->in_buffer_cur=sp->in_buffer;\n\t\t\tsp->in_buffer_file_togo-=m;\n\t\t\tsp->in_buffer_file_pos+=m;\n\t\t\tbreak;\n\t\t}\n\t\tsp->in_buffer_file_pos_log=0;\n\t\tswitch(sp->in_buffer_source)\n\t\t{\n\t\t\tcase osibsNotSetYet:\n\t\t\t\tif (sp->jpeg_interchange_format!=0)\n\t\t\t\t{\n\t\t\t\t\tsp->in_buffer_file_pos=sp->jpeg_interchange_format;\n\t\t\t\t\tsp->in_buffer_file_togo=sp->jpeg_interchange_format_length;\n\t\t\t\t}\n\t\t\t\tsp->in_buffer_source=osibsJpegInterchangeFormat;\n\t\t\t\tbreak;\n\t\t\tcase osibsJpegInterchangeFormat:\n\t\t\t\tsp->in_buffer_source=osibsStrile;\n\t\t\tcase osibsStrile:\n\t\t\t\tif (sp->in_buffer_next_strile==sp->in_buffer_strile_count)  \n\t\t\t\t\tsp->in_buffer_source=osibsEof;\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tsp->in_buffer_file_pos=sp->tif->tif_dir.td_stripoffset[sp->in_buffer_next_strile];  \n\t\t\t\t\tif (sp->in_buffer_file_pos!=0)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (sp->in_buffer_file_pos>=sp->file_size)\n\t\t\t\t\t\t\tsp->in_buffer_file_pos=0;\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tsp->in_buffer_file_togo=sp->tif->tif_dir.td_stripbytecount[sp->in_buffer_next_strile];  \n\t\t\t\t\t\t\tif (sp->in_buffer_file_togo==0)\n\t\t\t\t\t\t\t\tsp->in_buffer_file_pos=0;\n\t\t\t\t\t\t\telse if (sp->in_buffer_file_pos+sp->in_buffer_file_togo>sp->file_size)\n\t\t\t\t\t\t\t\tsp->in_buffer_file_togo=sp->file_size-sp->in_buffer_file_pos;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tsp->in_buffer_next_strile++;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\treturn(0);\n\t\t}\n\t} while (1);\n\treturn(1);\n}\n\nstatic int\nOJPEGReadByte(OJPEGState* sp, uint8* byte)\n{\n\tif (sp->in_buffer_togo==0)\n\t{\n\t\tif (OJPEGReadBufferFill(sp)==0)\n\t\t\treturn(0);\n\t\tassert(sp->in_buffer_togo>0);\n\t}\n\t*byte=*(sp->in_buffer_cur);\n\tsp->in_buffer_cur++;\n\tsp->in_buffer_togo--;\n\treturn(1);\n}\n\nstatic int\nOJPEGReadBytePeek(OJPEGState* sp, uint8* byte)\n{\n\tif (sp->in_buffer_togo==0)\n\t{\n\t\tif (OJPEGReadBufferFill(sp)==0)\n\t\t\treturn(0);\n\t\tassert(sp->in_buffer_togo>0);\n\t}\n\t*byte=*(sp->in_buffer_cur);\n\treturn(1);\n}\n\nstatic void\nOJPEGReadByteAdvance(OJPEGState* sp)\n{\n\tassert(sp->in_buffer_togo>0);\n\tsp->in_buffer_cur++;\n\tsp->in_buffer_togo--;\n}\n\nstatic int\nOJPEGReadWord(OJPEGState* sp, uint16* word)\n{\n\tuint8 m;\n\tif (OJPEGReadByte(sp,&m)==0)\n\t\treturn(0);\n\t*word=(m<<8);\n\tif (OJPEGReadByte(sp,&m)==0)\n\t\treturn(0);\n\t*word|=m;\n\treturn(1);\n}\n\nstatic int\nOJPEGReadBlock(OJPEGState* sp, uint16 len, void* mem)\n{\n\tuint16 mlen;\n\tuint8* mmem;\n\tuint16 n;\n\tassert(len>0);\n\tmlen=len;\n\tmmem=mem;\n\tdo\n\t{\n\t\tif (sp->in_buffer_togo==0)\n\t\t{\n\t\t\tif (OJPEGReadBufferFill(sp)==0)\n\t\t\t\treturn(0);\n\t\t\tassert(sp->in_buffer_togo>0);\n\t\t}\n\t\tn=mlen;\n\t\tif (n>sp->in_buffer_togo)\n\t\t\tn=sp->in_buffer_togo;\n\t\t_TIFFmemcpy(mmem,sp->in_buffer_cur,n);\n\t\tsp->in_buffer_cur+=n;\n\t\tsp->in_buffer_togo-=n;\n\t\tmlen-=n;\n\t\tmmem+=n;\n\t} while(mlen>0);\n\treturn(1);\n}\n\nstatic void\nOJPEGReadSkip(OJPEGState* sp, uint16 len)\n{\n\tuint16 m;\n\tuint16 n;\n\tm=len;\n\tn=m;\n\tif (n>sp->in_buffer_togo)\n\t\tn=sp->in_buffer_togo;\n\tsp->in_buffer_cur+=n;\n\tsp->in_buffer_togo-=n;\n\tm-=n;\n\tif (m>0)\n\t{\n\t\tassert(sp->in_buffer_togo==0);\n\t\tn=m;\n\t\tif (n>sp->in_buffer_file_togo)\n\t\t\tn=sp->in_buffer_file_togo;\n\t\tsp->in_buffer_file_pos+=n;\n\t\tsp->in_buffer_file_togo-=n;\n\t\tsp->in_buffer_file_pos_log=0;\n\t\t/* we don't skip past jpeginterchangeformat/strile block...\n\t\t * if that is asked from us, we're dealing with totally bazurk\n\t\t * data anyway, and we've not seen this happening on any\n\t\t * testfile, so we might as well likely cause some other\n\t\t * meaningless error to be passed at some later time\n\t\t */\n\t}\n}\n\nstatic int\nOJPEGWriteStream(TIFF* tif, void** mem, uint32* len)\n{\n\tOJPEGState* sp=(OJPEGState*)tif->tif_data;\n\t*len=0;\n\tdo\n\t{\n\t\tassert(sp->out_state<=ososEoi);\n\t\tswitch(sp->out_state)\n\t\t{\n\t\t\tcase ososSoi:\n\t\t\t\tOJPEGWriteStreamSoi(tif,mem,len);\n\t\t\t\tbreak;\n\t\t\tcase ososQTable0:\n\t\t\t\tOJPEGWriteStreamQTable(tif,0,mem,len);\n\t\t\t\tbreak;\n\t\t\tcase ososQTable1:\n\t\t\t\tOJPEGWriteStreamQTable(tif,1,mem,len);\n\t\t\t\tbreak;\n\t\t\tcase ososQTable2:\n\t\t\t\tOJPEGWriteStreamQTable(tif,2,mem,len);\n\t\t\t\tbreak;\n\t\t\tcase ososQTable3:\n\t\t\t\tOJPEGWriteStreamQTable(tif,3,mem,len);\n\t\t\t\tbreak;\n\t\t\tcase ososDcTable0:\n\t\t\t\tOJPEGWriteStreamDcTable(tif,0,mem,len);\n\t\t\t\tbreak;\n\t\t\tcase ososDcTable1:\n\t\t\t\tOJPEGWriteStreamDcTable(tif,1,mem,len);\n\t\t\t\tbreak;\n\t\t\tcase ososDcTable2:\n\t\t\t\tOJPEGWriteStreamDcTable(tif,2,mem,len);\n\t\t\t\tbreak;\n\t\t\tcase ososDcTable3:\n\t\t\t\tOJPEGWriteStreamDcTable(tif,3,mem,len);\n\t\t\t\tbreak;\n\t\t\tcase ososAcTable0:\n\t\t\t\tOJPEGWriteStreamAcTable(tif,0,mem,len);\n\t\t\t\tbreak;\n\t\t\tcase ososAcTable1:\n\t\t\t\tOJPEGWriteStreamAcTable(tif,1,mem,len);\n\t\t\t\tbreak;\n\t\t\tcase ososAcTable2:\n\t\t\t\tOJPEGWriteStreamAcTable(tif,2,mem,len);\n\t\t\t\tbreak;\n\t\t\tcase ososAcTable3:\n\t\t\t\tOJPEGWriteStreamAcTable(tif,3,mem,len);\n\t\t\t\tbreak;\n\t\t\tcase ososDri:\n\t\t\t\tOJPEGWriteStreamDri(tif,mem,len);\n\t\t\t\tbreak;\n\t\t\tcase ososSof:\n\t\t\t\tOJPEGWriteStreamSof(tif,mem,len);\n\t\t\t\tbreak;\n\t\t\tcase ososSos:\n\t\t\t\tOJPEGWriteStreamSos(tif,mem,len);\n\t\t\t\tbreak;\n\t\t\tcase ososCompressed:\n\t\t\t\tif (OJPEGWriteStreamCompressed(tif,mem,len)==0)\n\t\t\t\t\treturn(0);\n\t\t\t\tbreak;\n\t\t\tcase ososRst:\n\t\t\t\tOJPEGWriteStreamRst(tif,mem,len);\n\t\t\t\tbreak;\n\t\t\tcase ososEoi:\n\t\t\t\tOJPEGWriteStreamEoi(tif,mem,len);\n\t\t\t\tbreak;\n\t\t}\n\t} while (*len==0);\n\treturn(1);\n}\n\nstatic void\nOJPEGWriteStreamSoi(TIFF* tif, void** mem, uint32* len)\n{\n\tOJPEGState* sp=(OJPEGState*)tif->tif_data;\n\tassert(OJPEG_BUFFER>=2);\n\tsp->out_buffer[0]=255;\n\tsp->out_buffer[1]=JPEG_MARKER_SOI;\n\t*len=2;\n\t*mem=(void*)sp->out_buffer;\n\tsp->out_state++;\n}\n\nstatic void\nOJPEGWriteStreamQTable(TIFF* tif, uint8 table_index, void** mem, uint32* len)\n{\n\tOJPEGState* sp=(OJPEGState*)tif->tif_data;\n\tif (sp->qtable[table_index]!=0)\n\t{\n\t\t*mem=(void*)(sp->qtable[table_index]+sizeof(uint32));\n\t\t*len=*((uint32*)sp->qtable[table_index])-sizeof(uint32);\n\t}\n\tsp->out_state++;\n}\n\nstatic void\nOJPEGWriteStreamDcTable(TIFF* tif, uint8 table_index, void** mem, uint32* len)\n{\n\tOJPEGState* sp=(OJPEGState*)tif->tif_data;\n\tif (sp->dctable[table_index]!=0)\n\t{\n\t\t*mem=(void*)(sp->dctable[table_index]+sizeof(uint32));\n\t\t*len=*((uint32*)sp->dctable[table_index])-sizeof(uint32);\n\t}\n\tsp->out_state++;\n}\n\nstatic void\nOJPEGWriteStreamAcTable(TIFF* tif, uint8 table_index, void** mem, uint32* len)\n{\n\tOJPEGState* sp=(OJPEGState*)tif->tif_data;\n\tif (sp->actable[table_index]!=0)\n\t{\n\t\t*mem=(void*)(sp->actable[table_index]+sizeof(uint32));\n\t\t*len=*((uint32*)sp->actable[table_index])-sizeof(uint32);\n\t}\n\tsp->out_state++;\n}\n\nstatic void\nOJPEGWriteStreamDri(TIFF* tif, void** mem, uint32* len)\n{\n\tOJPEGState* sp=(OJPEGState*)tif->tif_data;\n\tassert(OJPEG_BUFFER>=6);\n\tif (sp->restart_interval!=0)\n\t{\n\t\tsp->out_buffer[0]=255;\n\t\tsp->out_buffer[1]=JPEG_MARKER_DRI;\n\t\tsp->out_buffer[2]=0;\n\t\tsp->out_buffer[3]=4;\n\t\tsp->out_buffer[4]=(sp->restart_interval>>8);\n\t\tsp->out_buffer[5]=(sp->restart_interval&255);\n\t\t*len=6;\n\t\t*mem=(void*)sp->out_buffer;\n\t}\n\tsp->out_state++;\n}\n\nstatic void\nOJPEGWriteStreamSof(TIFF* tif, void** mem, uint32* len)\n{\n\tOJPEGState* sp=(OJPEGState*)tif->tif_data;\n\tuint8 m;\n\tassert(OJPEG_BUFFER>=2+8+sp->samples_per_pixel_per_plane*3);\n\tassert(255>=8+sp->samples_per_pixel_per_plane*3);\n\tsp->out_buffer[0]=255;\n\tsp->out_buffer[1]=sp->sof_marker_id;\n\t/* Lf */\n\tsp->out_buffer[2]=0;\n\tsp->out_buffer[3]=8+sp->samples_per_pixel_per_plane*3;\n\t/* P */\n\tsp->out_buffer[4]=8;\n\t/* Y */\n\tsp->out_buffer[5]=(sp->sof_y>>8);\n\tsp->out_buffer[6]=(sp->sof_y&255);\n\t/* X */\n\tsp->out_buffer[7]=(sp->sof_x>>8);\n\tsp->out_buffer[8]=(sp->sof_x&255);\n\t/* Nf */\n\tsp->out_buffer[9]=sp->samples_per_pixel_per_plane;\n\tfor (m=0; m<sp->samples_per_pixel_per_plane; m++)\n\t{\n\t\t/* C */\n\t\tsp->out_buffer[10+m*3]=sp->sof_c[sp->plane_sample_offset+m];\n\t\t/* H and V */\n\t\tsp->out_buffer[10+m*3+1]=sp->sof_hv[sp->plane_sample_offset+m];\n\t\t/* Tq */\n\t\tsp->out_buffer[10+m*3+2]=sp->sof_tq[sp->plane_sample_offset+m];\n\t}\n\t*len=10+sp->samples_per_pixel_per_plane*3;\n\t*mem=(void*)sp->out_buffer;\n\tsp->out_state++;\n}\n\nstatic void\nOJPEGWriteStreamSos(TIFF* tif, void** mem, uint32* len)\n{\n\tOJPEGState* sp=(OJPEGState*)tif->tif_data;\n\tuint8 m;\n\tassert(OJPEG_BUFFER>=2+6+sp->samples_per_pixel_per_plane*2);\n\tassert(255>=6+sp->samples_per_pixel_per_plane*2);\n\tsp->out_buffer[0]=255;\n\tsp->out_buffer[1]=JPEG_MARKER_SOS;\n\t/* Ls */\n\tsp->out_buffer[2]=0;\n\tsp->out_buffer[3]=6+sp->samples_per_pixel_per_plane*2;\n\t/* Ns */\n\tsp->out_buffer[4]=sp->samples_per_pixel_per_plane;\n\tfor (m=0; m<sp->samples_per_pixel_per_plane; m++)\n\t{\n\t\t/* Cs */\n\t\tsp->out_buffer[5+m*2]=sp->sos_cs[sp->plane_sample_offset+m];\n\t\t/* Td and Ta */\n\t\tsp->out_buffer[5+m*2+1]=sp->sos_tda[sp->plane_sample_offset+m];\n\t}\n\t/* Ss */\n\tsp->out_buffer[5+sp->samples_per_pixel_per_plane*2]=0;\n\t/* Se */\n\tsp->out_buffer[5+sp->samples_per_pixel_per_plane*2+1]=63;\n\t/* Ah and Al */\n\tsp->out_buffer[5+sp->samples_per_pixel_per_plane*2+2]=0;\n\t*len=8+sp->samples_per_pixel_per_plane*2;\n\t*mem=(void*)sp->out_buffer;\n\tsp->out_state++;\n}\n\nstatic int\nOJPEGWriteStreamCompressed(TIFF* tif, void** mem, uint32* len)\n{\n\tOJPEGState* sp=(OJPEGState*)tif->tif_data;\n\tif (sp->in_buffer_togo==0)\n\t{\n\t\tif (OJPEGReadBufferFill(sp)==0)\n\t\t\treturn(0);\n\t\tassert(sp->in_buffer_togo>0);\n\t}\n\t*len=sp->in_buffer_togo;\n\t*mem=(void*)sp->in_buffer_cur;\n\tsp->in_buffer_togo=0;\n\tif (sp->in_buffer_file_togo==0)\n\t{\n\t\tswitch(sp->in_buffer_source)\n\t\t{\n\t\t\tcase osibsStrile:\n\t\t\t\tif (sp->in_buffer_next_strile<sp->in_buffer_strile_count)  \n\t\t\t\t\tsp->out_state=ososRst;\n\t\t\t\telse\n\t\t\t\t\tsp->out_state=ososEoi;\n\t\t\t\tbreak;\n\t\t\tcase osibsEof:\n\t\t\t\tsp->out_state=ososEoi;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\t}\n\treturn(1);\n}\n\nstatic void\nOJPEGWriteStreamRst(TIFF* tif, void** mem, uint32* len)\n{\n\tOJPEGState* sp=(OJPEGState*)tif->tif_data;\n\tassert(OJPEG_BUFFER>=2);\n\tsp->out_buffer[0]=255;\n\tsp->out_buffer[1]=JPEG_MARKER_RST0+sp->restart_index;\n\tsp->restart_index++;\n\tif (sp->restart_index==8)\n\t\tsp->restart_index=0;\n\t*len=2;\n\t*mem=(void*)sp->out_buffer;\n\tsp->out_state=ososCompressed;\n}\n\nstatic void\nOJPEGWriteStreamEoi(TIFF* tif, void** mem, uint32* len)\n{\n\tOJPEGState* sp=(OJPEGState*)tif->tif_data;\n\tassert(OJPEG_BUFFER>=2);\n\tsp->out_buffer[0]=255;\n\tsp->out_buffer[1]=JPEG_MARKER_EOI;\n\t*len=2;\n\t*mem=(void*)sp->out_buffer;\n}\n\n#ifndef LIBJPEG_ENCAP_EXTERNAL\nstatic int\njpeg_create_decompress_encap(OJPEGState* sp, jpeg_decompress_struct* cinfo)\n{\n\treturn(SETJMP(sp->exit_jmpbuf)?0:(jpeg_create_decompress(cinfo),1));\n}\n#endif\n\n#ifndef LIBJPEG_ENCAP_EXTERNAL\nstatic int\njpeg_read_header_encap(OJPEGState* sp, jpeg_decompress_struct* cinfo, uint8 require_image)\n{\n\treturn(SETJMP(sp->exit_jmpbuf)?0:(jpeg_read_header(cinfo,require_image),1));\n}\n#endif\n\n#ifndef LIBJPEG_ENCAP_EXTERNAL\nstatic int\njpeg_start_decompress_encap(OJPEGState* sp, jpeg_decompress_struct* cinfo)\n{\n\treturn(SETJMP(sp->exit_jmpbuf)?0:(jpeg_start_decompress(cinfo),1));\n}\n#endif\n\n#ifndef LIBJPEG_ENCAP_EXTERNAL\nstatic int\njpeg_read_scanlines_encap(OJPEGState* sp, jpeg_decompress_struct* cinfo, void* scanlines, uint32 max_lines)\n{\n\treturn(SETJMP(sp->exit_jmpbuf)?0:(jpeg_read_scanlines(cinfo,scanlines,max_lines),1));\n}\n#endif\n\n#ifndef LIBJPEG_ENCAP_EXTERNAL\nstatic int\njpeg_read_raw_data_encap(OJPEGState* sp, jpeg_decompress_struct* cinfo, void* data, uint32 max_lines)\n{\n\treturn(SETJMP(sp->exit_jmpbuf)?0:(jpeg_read_raw_data(cinfo,data,max_lines),1));\n}\n#endif\n\n#ifndef LIBJPEG_ENCAP_EXTERNAL\nstatic void\njpeg_encap_unwind(TIFF* tif)\n{\n\tOJPEGState* sp=(OJPEGState*)tif->tif_data;\n\tLONGJMP(sp->exit_jmpbuf,1);\n}\n#endif\n\nstatic void\nOJPEGLibjpegJpegErrorMgrOutputMessage(jpeg_common_struct* cinfo)\n{\n\tchar buffer[JMSG_LENGTH_MAX];\n\t(*cinfo->err->format_message)(cinfo,buffer);\n\tTIFFWarningExt(((TIFF*)(cinfo->client_data))->tif_clientdata,\"LibJpeg\", \"%s\", buffer);\n}\n\nstatic void\nOJPEGLibjpegJpegErrorMgrErrorExit(jpeg_common_struct* cinfo)\n{\n\tchar buffer[JMSG_LENGTH_MAX];\n\t(*cinfo->err->format_message)(cinfo,buffer);\n\tTIFFErrorExt(((TIFF*)(cinfo->client_data))->tif_clientdata,\"LibJpeg\", \"%s\", buffer);\n\tjpeg_encap_unwind((TIFF*)(cinfo->client_data));\n}\n\nstatic void\nOJPEGLibjpegJpegSourceMgrInitSource(jpeg_decompress_struct* cinfo)\n{\n\t(void)cinfo;\n}\n\nstatic boolean\nOJPEGLibjpegJpegSourceMgrFillInputBuffer(jpeg_decompress_struct* cinfo)\n{\n\tTIFF* tif=(TIFF*)cinfo->client_data;\n\tOJPEGState* sp=(OJPEGState*)tif->tif_data;\n\tvoid* mem=0;\n\tuint32 len=0;\n\tif (OJPEGWriteStream(tif,&mem,&len)==0)\n\t{\n\t\tTIFFErrorExt(tif->tif_clientdata,\"LibJpeg\",\"Premature end of JPEG data\");\n\t\tjpeg_encap_unwind(tif);\n\t}\n\tsp->libjpeg_jpeg_source_mgr.bytes_in_buffer=len;\n\tsp->libjpeg_jpeg_source_mgr.next_input_byte=mem;\n\treturn(1);\n}\n\nstatic void\nOJPEGLibjpegJpegSourceMgrSkipInputData(jpeg_decompress_struct* cinfo, long num_bytes)\n{\n\tTIFF* tif=(TIFF*)cinfo->client_data;\n\t(void)num_bytes;\n\tTIFFErrorExt(tif->tif_clientdata,\"LibJpeg\",\"Unexpected error\");\n\tjpeg_encap_unwind(tif);\n}\n\nstatic boolean\nOJPEGLibjpegJpegSourceMgrResyncToRestart(jpeg_decompress_struct* cinfo, int desired)\n{\n\tTIFF* tif=(TIFF*)cinfo->client_data;\n\t(void)desired;\n\tTIFFErrorExt(tif->tif_clientdata,\"LibJpeg\",\"Unexpected error\");\n\tjpeg_encap_unwind(tif);\n\treturn(0);\n}\n\nstatic void\nOJPEGLibjpegJpegSourceMgrTermSource(jpeg_decompress_struct* cinfo)\n{\n\t(void)cinfo;\n}\n\n#endif\n\n\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/tif_open.c",
    "content": "/* $Id: tif_open.c,v 1.33 2006/06/08 14:27:17 dron Exp $ */\n\n/*\n * Copyright (c) 1988-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n/*\n * TIFF Library.\n */\n#include \"tiffiop.h\"\n\nstatic const long typemask[13] = {\n\t(long)0L,\t\t/* TIFF_NOTYPE */\n\t(long)0x000000ffL,\t/* TIFF_BYTE */\n\t(long)0xffffffffL,\t/* TIFF_ASCII */\n\t(long)0x0000ffffL,\t/* TIFF_SHORT */\n\t(long)0xffffffffL,\t/* TIFF_LONG */\n\t(long)0xffffffffL,\t/* TIFF_RATIONAL */\n\t(long)0x000000ffL,\t/* TIFF_SBYTE */\n\t(long)0x000000ffL,\t/* TIFF_UNDEFINED */\n\t(long)0x0000ffffL,\t/* TIFF_SSHORT */\n\t(long)0xffffffffL,\t/* TIFF_SLONG */\n\t(long)0xffffffffL,\t/* TIFF_SRATIONAL */\n\t(long)0xffffffffL,\t/* TIFF_FLOAT */\n\t(long)0xffffffffL,\t/* TIFF_DOUBLE */\n};\nstatic const int bigTypeshift[13] = {\n\t0,\t\t/* TIFF_NOTYPE */\n\t24,\t\t/* TIFF_BYTE */\n\t0,\t\t/* TIFF_ASCII */\n\t16,\t\t/* TIFF_SHORT */\n\t0,\t\t/* TIFF_LONG */\n\t0,\t\t/* TIFF_RATIONAL */\n\t24,\t\t/* TIFF_SBYTE */\n\t24,\t\t/* TIFF_UNDEFINED */\n\t16,\t\t/* TIFF_SSHORT */\n\t0,\t\t/* TIFF_SLONG */\n\t0,\t\t/* TIFF_SRATIONAL */\n\t0,\t\t/* TIFF_FLOAT */\n\t0,\t\t/* TIFF_DOUBLE */\n};\nstatic const int litTypeshift[13] = {\n\t0,\t\t/* TIFF_NOTYPE */\n\t0,\t\t/* TIFF_BYTE */\n\t0,\t\t/* TIFF_ASCII */\n\t0,\t\t/* TIFF_SHORT */\n\t0,\t\t/* TIFF_LONG */\n\t0,\t\t/* TIFF_RATIONAL */\n\t0,\t\t/* TIFF_SBYTE */\n\t0,\t\t/* TIFF_UNDEFINED */\n\t0,\t\t/* TIFF_SSHORT */\n\t0,\t\t/* TIFF_SLONG */\n\t0,\t\t/* TIFF_SRATIONAL */\n\t0,\t\t/* TIFF_FLOAT */\n\t0,\t\t/* TIFF_DOUBLE */\n};\n\n/*\n * Dummy functions to fill the omitted client procedures.\n */\nstatic int\n_tiffDummyMapProc(thandle_t fd, tdata_t* pbase, toff_t* psize)\n{\n\t(void) fd; (void) pbase; (void) psize;\n\treturn (0);\n}\n\nstatic void\n_tiffDummyUnmapProc(thandle_t fd, tdata_t base, toff_t size)\n{\n\t(void) fd; (void) base; (void) size;\n}\n\n/*\n * Initialize the shift & mask tables, and the\n * byte swapping state according to the file\n * contents and the machine architecture.\n */\nstatic void\nTIFFInitOrder(TIFF* tif, int magic)\n{\n\ttif->tif_typemask = typemask;\n\tif (magic == TIFF_BIGENDIAN) {\n\t\ttif->tif_typeshift = bigTypeshift;\n#ifndef WORDS_BIGENDIAN\n\t\ttif->tif_flags |= TIFF_SWAB;\n#endif\n\t} else {\n\t\ttif->tif_typeshift = litTypeshift;\n#ifdef WORDS_BIGENDIAN\n\t\ttif->tif_flags |= TIFF_SWAB;\n#endif\n\t}\n}\n\nint\n_TIFFgetMode(const char* mode, const char* module)\n{\n\tint m = -1;\n\n\tswitch (mode[0]) {\n\tcase 'r':\n\t\tm = O_RDONLY;\n\t\tif (mode[1] == '+')\n\t\t\tm = O_RDWR;\n\t\tbreak;\n\tcase 'w':\n\tcase 'a':\n\t\tm = O_RDWR|O_CREAT;\n\t\tif (mode[0] == 'w')\n\t\t\tm |= O_TRUNC;\n\t\tbreak;\n\tdefault:\n\t\tTIFFErrorExt(0, module, \"\\\"%s\\\": Bad mode\", mode);\n\t\tbreak;\n\t}\n\treturn (m);\n}\n\nTIFF*\nTIFFClientOpen(\n\tconst char* name, const char* mode,\n\tthandle_t clientdata,\n\tTIFFReadWriteProc readproc,\n\tTIFFReadWriteProc writeproc,\n\tTIFFSeekProc seekproc,\n\tTIFFCloseProc closeproc,\n\tTIFFSizeProc sizeproc,\n\tTIFFMapFileProc mapproc,\n\tTIFFUnmapFileProc unmapproc\n)\n{\n\tstatic const char module[] = \"TIFFClientOpen\";\n\tTIFF *tif;\n\tint m;\n\tconst char* cp;\n\n\tm = _TIFFgetMode(mode, module);\n\tif (m == -1)\n\t\tgoto bad2;\n\ttif = (TIFF *)_TIFFmalloc(sizeof (TIFF) + strlen(name) + 1);\n\tif (tif == NULL) {\n\t\tTIFFErrorExt(clientdata, module, \"%s: Out of memory (TIFF structure)\", name);\n\t\tgoto bad2;\n\t}\n\t_TIFFmemset(tif, 0, sizeof (*tif));\n\ttif->tif_name = (char *)tif + sizeof (TIFF);\n\tstrcpy(tif->tif_name, name);\n\ttif->tif_mode = m &~ (O_CREAT|O_TRUNC);\n\ttif->tif_curdir = (tdir_t) -1;\t\t/* non-existent directory */\n\ttif->tif_curoff = 0;\n\ttif->tif_curstrip = (tstrip_t) -1;\t/* invalid strip */\n\ttif->tif_row = (uint32) -1;\t\t/* read/write pre-increment */\n\ttif->tif_clientdata = clientdata;\n\tif (!readproc || !writeproc || !seekproc || !closeproc || !sizeproc) {\n\t\tTIFFErrorExt(clientdata, module,\n\t\t\t  \"One of the client procedures is NULL pointer.\");\n\t\tgoto bad2;\n\t}\n\ttif->tif_readproc = readproc;\n\ttif->tif_writeproc = writeproc;\n\ttif->tif_seekproc = seekproc;\n\ttif->tif_closeproc = closeproc;\n\ttif->tif_sizeproc = sizeproc;\n        if (mapproc)\n\t\ttif->tif_mapproc = mapproc;\n\telse\n\t\ttif->tif_mapproc = _tiffDummyMapProc;\n\tif (unmapproc)\n\t\ttif->tif_unmapproc = unmapproc;\n\telse\n\t\ttif->tif_unmapproc = _tiffDummyUnmapProc;\n\t_TIFFSetDefaultCompressionState(tif);\t/* setup default state */\n\t/*\n\t * Default is to return data MSB2LSB and enable the\n\t * use of memory-mapped files and strip chopping when\n\t * a file is opened read-only.\n\t */\n\ttif->tif_flags = FILLORDER_MSB2LSB;\n\tif (m == O_RDONLY )\n\t\ttif->tif_flags |= TIFF_MAPPED;\n\n#ifdef STRIPCHOP_DEFAULT\n\tif (m == O_RDONLY || m == O_RDWR)\n\t\ttif->tif_flags |= STRIPCHOP_DEFAULT;\n#endif\n\n\t/*\n\t * Process library-specific flags in the open mode string.\n\t * The following flags may be used to control intrinsic library\n\t * behaviour that may or may not be desirable (usually for\n\t * compatibility with some application that claims to support\n\t * TIFF but only supports some braindead idea of what the\n\t * vendor thinks TIFF is):\n\t *\n\t * 'l'\t\tuse little-endian byte order for creating a file\n\t * 'b'\t\tuse big-endian byte order for creating a file\n\t * 'L'\t\tread/write information using LSB2MSB bit order\n\t * 'B'\t\tread/write information using MSB2LSB bit order\n\t * 'H'\t\tread/write information using host bit order\n\t * 'M'\t\tenable use of memory-mapped files when supported\n\t * 'm'\t\tdisable use of memory-mapped files\n\t * 'C'\t\tenable strip chopping support when reading\n\t * 'c'\t\tdisable strip chopping support\n\t * 'h'\t\tread TIFF header only, do not load the first IFD\n\t *\n\t * The use of the 'l' and 'b' flags is strongly discouraged.\n\t * These flags are provided solely because numerous vendors,\n\t * typically on the PC, do not correctly support TIFF; they\n\t * only support the Intel little-endian byte order.  This\n\t * support is not configured by default because it supports\n\t * the violation of the TIFF spec that says that readers *MUST*\n\t * support both byte orders.  It is strongly recommended that\n\t * you not use this feature except to deal with busted apps\n\t * that write invalid TIFF.  And even in those cases you should\n\t * bang on the vendors to fix their software.\n\t *\n\t * The 'L', 'B', and 'H' flags are intended for applications\n\t * that can optimize operations on data by using a particular\n\t * bit order.  By default the library returns data in MSB2LSB\n\t * bit order for compatibiltiy with older versions of this\n\t * library.  Returning data in the bit order of the native cpu\n\t * makes the most sense but also requires applications to check\n\t * the value of the FillOrder tag; something they probably do\n\t * not do right now.\n\t *\n\t * The 'M' and 'm' flags are provided because some virtual memory\n\t * systems exhibit poor behaviour when large images are mapped.\n\t * These options permit clients to control the use of memory-mapped\n\t * files on a per-file basis.\n\t *\n\t * The 'C' and 'c' flags are provided because the library support\n\t * for chopping up large strips into multiple smaller strips is not\n\t * application-transparent and as such can cause problems.  The 'c'\n\t * option permits applications that only want to look at the tags,\n\t * for example, to get the unadulterated TIFF tag information.\n\t */\n\tfor (cp = mode; *cp; cp++)\n\t\tswitch (*cp) {\n\t\tcase 'b':\n#ifndef WORDS_BIGENDIAN\n\t\t    if (m&O_CREAT)\n\t\t\t\ttif->tif_flags |= TIFF_SWAB;\n#endif\n\t\t\tbreak;\n\t\tcase 'l':\n#ifdef WORDS_BIGENDIAN\n\t\t\tif ((m&O_CREAT))\n\t\t\t\ttif->tif_flags |= TIFF_SWAB;\n#endif\n\t\t\tbreak;\n\t\tcase 'B':\n\t\t\ttif->tif_flags = (tif->tif_flags &~ TIFF_FILLORDER) |\n\t\t\t    FILLORDER_MSB2LSB;\n\t\t\tbreak;\n\t\tcase 'L':\n\t\t\ttif->tif_flags = (tif->tif_flags &~ TIFF_FILLORDER) |\n\t\t\t    FILLORDER_LSB2MSB;\n\t\t\tbreak;\n\t\tcase 'H':\n\t\t\ttif->tif_flags = (tif->tif_flags &~ TIFF_FILLORDER) |\n\t\t\t    HOST_FILLORDER;\n\t\t\tbreak;\n\t\tcase 'M':\n\t\t\tif (m == O_RDONLY)\n\t\t\t\ttif->tif_flags |= TIFF_MAPPED;\n\t\t\tbreak;\n\t\tcase 'm':\n\t\t\tif (m == O_RDONLY)\n\t\t\t\ttif->tif_flags &= ~TIFF_MAPPED;\n\t\t\tbreak;\n\t\tcase 'C':\n\t\t\tif (m == O_RDONLY)\n\t\t\t\ttif->tif_flags |= TIFF_STRIPCHOP;\n\t\t\tbreak;\n\t\tcase 'c':\n\t\t\tif (m == O_RDONLY)\n\t\t\t\ttif->tif_flags &= ~TIFF_STRIPCHOP;\n\t\t\tbreak;\n\t\tcase 'h':\n\t\t\ttif->tif_flags |= TIFF_HEADERONLY;\n\t\t\tbreak;\n\t\t}\n\t/*\n\t * Read in TIFF header.\n\t */\n\tif (tif->tif_mode & O_TRUNC ||\n\t    !ReadOK(tif, &tif->tif_header, sizeof (TIFFHeader))) {\n\t\tif (tif->tif_mode == O_RDONLY) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, name,\n\t\t\t\t     \"Cannot read TIFF header\");\n\t\t\tgoto bad;\n\t\t}\n\t\t/*\n\t\t * Setup header and write.\n\t\t */\n#ifdef WORDS_BIGENDIAN\n\t\ttif->tif_header.tiff_magic = tif->tif_flags & TIFF_SWAB\n\t\t    ? TIFF_LITTLEENDIAN : TIFF_BIGENDIAN;\n#else\n\t\ttif->tif_header.tiff_magic = tif->tif_flags & TIFF_SWAB\n\t\t    ? TIFF_BIGENDIAN : TIFF_LITTLEENDIAN;\n#endif\n\t\ttif->tif_header.tiff_version = TIFF_VERSION;\n\t\tif (tif->tif_flags & TIFF_SWAB)\n\t\t\tTIFFSwabShort(&tif->tif_header.tiff_version);\n\t\ttif->tif_header.tiff_diroff = 0;\t/* filled in later */\n\n\n                /*\n                 * The doc for \"fopen\" for some STD_C_LIBs says that if you \n                 * open a file for modify (\"+\"), then you must fseek (or \n                 * fflush?) between any freads and fwrites.  This is not\n                 * necessary on most systems, but has been shown to be needed\n                 * on Solaris. \n                 */\n                TIFFSeekFile( tif, 0, SEEK_SET );\n               \n\t\tif (!WriteOK(tif, &tif->tif_header, sizeof (TIFFHeader))) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, name,\n\t\t\t\t     \"Error writing TIFF header\");\n\t\t\tgoto bad;\n\t\t}\n\t\t/*\n\t\t * Setup the byte order handling.\n\t\t */\n\t\tTIFFInitOrder(tif, tif->tif_header.tiff_magic);\n\t\t/*\n\t\t * Setup default directory.\n\t\t */\n\t\tif (!TIFFDefaultDirectory(tif))\n\t\t\tgoto bad;\n\t\ttif->tif_diroff = 0;\n\t\ttif->tif_dirlist = NULL;\n\t\ttif->tif_dirlistsize = 0;\n\t\ttif->tif_dirnumber = 0;\n\t\treturn (tif);\n\t}\n\t/*\n\t * Setup the byte order handling.\n\t */\n\tif (tif->tif_header.tiff_magic != TIFF_BIGENDIAN &&\n\t    tif->tif_header.tiff_magic != TIFF_LITTLEENDIAN\n#if MDI_SUPPORT\n\t    &&\n#if HOST_BIGENDIAN\n\t    tif->tif_header.tiff_magic != MDI_BIGENDIAN\n#else\n\t    tif->tif_header.tiff_magic != MDI_LITTLEENDIAN\n#endif\n\t    ) {\n\t\tTIFFErrorExt(tif->tif_clientdata, name,\n\t\t\t\"Not a TIFF or MDI file, bad magic number %d (0x%x)\",\n#else\n\t    ) {\n\t\tTIFFErrorExt(tif->tif_clientdata, name,\n\t\t\t     \"Not a TIFF file, bad magic number %d (0x%x)\",\n#endif\n\t\t    tif->tif_header.tiff_magic,\n\t\t    tif->tif_header.tiff_magic);\n\t\tgoto bad;\n\t}\n\tTIFFInitOrder(tif, tif->tif_header.tiff_magic);\n\t/*\n\t * Swap header if required.\n\t */\n\tif (tif->tif_flags & TIFF_SWAB) {\n\t\tTIFFSwabShort(&tif->tif_header.tiff_version);\n\t\tTIFFSwabLong(&tif->tif_header.tiff_diroff);\n\t}\n\t/*\n\t * Now check version (if needed, it's been byte-swapped).\n\t * Note that this isn't actually a version number, it's a\n\t * magic number that doesn't change (stupid).\n\t */\n\tif (tif->tif_header.tiff_version == TIFF_BIGTIFF_VERSION) {\n\t\tTIFFErrorExt(tif->tif_clientdata, name,\n                          \"This is a BigTIFF file.  This format not supported\\n\"\n                          \"by this version of libtiff.\" );\n\t\tgoto bad;\n\t}\n\tif (tif->tif_header.tiff_version != TIFF_VERSION) {\n\t\tTIFFErrorExt(tif->tif_clientdata, name,\n\t\t    \"Not a TIFF file, bad version number %d (0x%x)\",\n\t\t    tif->tif_header.tiff_version,\n\t\t    tif->tif_header.tiff_version);\n\t\tgoto bad;\n\t}\n\ttif->tif_flags |= TIFF_MYBUFFER;\n\ttif->tif_rawcp = tif->tif_rawdata = 0;\n\ttif->tif_rawdatasize = 0;\n\n\t/*\n\t * Sometimes we do not want to read the first directory (for example,\n\t * it may be broken) and want to proceed to other directories. I this\n\t * case we use the TIFF_HEADERONLY flag to open file and return\n\t * immediately after reading TIFF header.\n\t */\n\tif (tif->tif_flags & TIFF_HEADERONLY)\n\t\treturn (tif);\n\n\t/*\n\t * Setup initial directory.\n\t */\n\tswitch (mode[0]) {\n\tcase 'r':\n\t\ttif->tif_nextdiroff = tif->tif_header.tiff_diroff;\n\t\t/*\n\t\t * Try to use a memory-mapped file if the client\n\t\t * has not explicitly suppressed usage with the\n\t\t * 'm' flag in the open mode (see above).\n\t\t */\n\t\tif ((tif->tif_flags & TIFF_MAPPED) &&\n\t!TIFFMapFileContents(tif, (tdata_t*) &tif->tif_base, &tif->tif_size))\n\t\t\ttif->tif_flags &= ~TIFF_MAPPED;\n\t\tif (TIFFReadDirectory(tif)) {\n\t\t\ttif->tif_rawcc = -1;\n\t\t\ttif->tif_flags |= TIFF_BUFFERSETUP;\n\t\t\treturn (tif);\n\t\t}\n\t\tbreak;\n\tcase 'a':\n\t\t/*\n\t\t * New directories are automatically append\n\t\t * to the end of the directory chain when they\n\t\t * are written out (see TIFFWriteDirectory).\n\t\t */\n\t\tif (!TIFFDefaultDirectory(tif))\n\t\t\tgoto bad;\n\t\treturn (tif);\n\t}\nbad:\n\ttif->tif_mode = O_RDONLY;\t/* XXX avoid flush */\n        TIFFCleanup(tif);\nbad2:\n\treturn ((TIFF*)0);\n}\n\n/*\n * Query functions to access private data.\n */\n\n/*\n * Return open file's name.\n */\nconst char *\nTIFFFileName(TIFF* tif)\n{\n\treturn (tif->tif_name);\n}\n\n/*\n * Set the file name.\n */\nconst char *\nTIFFSetFileName(TIFF* tif, const char *name)\n{\n\tconst char* old_name = tif->tif_name;\n\ttif->tif_name = (char *)name;\n\treturn (old_name);\n}\n\n/*\n * Return open file's I/O descriptor.\n */\nint\nTIFFFileno(TIFF* tif)\n{\n\treturn (tif->tif_fd);\n}\n\n/*\n * Set open file's I/O descriptor, and return previous value.\n */\nint\nTIFFSetFileno(TIFF* tif, int fd)\n{\n        int old_fd = tif->tif_fd;\n\ttif->tif_fd = fd;\n\treturn old_fd;\n}\n\n/*\n * Return open file's clientdata.\n */\nthandle_t\nTIFFClientdata(TIFF* tif)\n{\n\treturn (tif->tif_clientdata);\n}\n\n/*\n * Set open file's clientdata, and return previous value.\n */\nthandle_t\nTIFFSetClientdata(TIFF* tif, thandle_t newvalue)\n{\n\tthandle_t m = tif->tif_clientdata;\n\ttif->tif_clientdata = newvalue;\n\treturn m;\n}\n\n/*\n * Return read/write mode.\n */\nint\nTIFFGetMode(TIFF* tif)\n{\n\treturn (tif->tif_mode);\n}\n\n/*\n * Return read/write mode.\n */\nint\nTIFFSetMode(TIFF* tif, int mode)\n{\n\tint old_mode = tif->tif_mode;\n\ttif->tif_mode = mode;\n\treturn (old_mode);\n}\n\n/*\n * Return nonzero if file is organized in\n * tiles; zero if organized as strips.\n */\nint\nTIFFIsTiled(TIFF* tif)\n{\n\treturn (isTiled(tif));\n}\n\n/*\n * Return current row being read/written.\n */\nuint32\nTIFFCurrentRow(TIFF* tif)\n{\n\treturn (tif->tif_row);\n}\n\n/*\n * Return index of the current directory.\n */\ntdir_t\nTIFFCurrentDirectory(TIFF* tif)\n{\n\treturn (tif->tif_curdir);\n}\n\n/*\n * Return current strip.\n */\ntstrip_t\nTIFFCurrentStrip(TIFF* tif)\n{\n\treturn (tif->tif_curstrip);\n}\n\n/*\n * Return current tile.\n */\nttile_t\nTIFFCurrentTile(TIFF* tif)\n{\n\treturn (tif->tif_curtile);\n}\n\n/*\n * Return nonzero if the file has byte-swapped data.\n */\nint\nTIFFIsByteSwapped(TIFF* tif)\n{\n\treturn ((tif->tif_flags & TIFF_SWAB) != 0);\n}\n\n/*\n * Return nonzero if the data is returned up-sampled.\n */\nint\nTIFFIsUpSampled(TIFF* tif)\n{\n\treturn (isUpSampled(tif));\n}\n\n/*\n * Return nonzero if the data is returned in MSB-to-LSB bit order.\n */\nint\nTIFFIsMSB2LSB(TIFF* tif)\n{\n\treturn (isFillOrder(tif, FILLORDER_MSB2LSB));\n}\n\n/*\n * Return nonzero if given file was written in big-endian order.\n */\nint\nTIFFIsBigEndian(TIFF* tif)\n{\n\treturn (tif->tif_header.tiff_magic == TIFF_BIGENDIAN);\n}\n\n/*\n * Return pointer to file read method.\n */\nTIFFReadWriteProc\nTIFFGetReadProc(TIFF* tif)\n{\n\treturn (tif->tif_readproc);\n}\n\n/*\n * Return pointer to file write method.\n */\nTIFFReadWriteProc\nTIFFGetWriteProc(TIFF* tif)\n{\n\treturn (tif->tif_writeproc);\n}\n\n/*\n * Return pointer to file seek method.\n */\nTIFFSeekProc\nTIFFGetSeekProc(TIFF* tif)\n{\n\treturn (tif->tif_seekproc);\n}\n\n/*\n * Return pointer to file close method.\n */\nTIFFCloseProc\nTIFFGetCloseProc(TIFF* tif)\n{\n\treturn (tif->tif_closeproc);\n}\n\n/*\n * Return pointer to file size requesting method.\n */\nTIFFSizeProc\nTIFFGetSizeProc(TIFF* tif)\n{\n\treturn (tif->tif_sizeproc);\n}\n\n/*\n * Return pointer to memory mapping method.\n */\nTIFFMapFileProc\nTIFFGetMapFileProc(TIFF* tif)\n{\n\treturn (tif->tif_mapproc);\n}\n\n/*\n * Return pointer to memory unmapping method.\n */\nTIFFUnmapFileProc\nTIFFGetUnmapFileProc(TIFF* tif)\n{\n\treturn (tif->tif_unmapproc);\n}\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/tif_packbits.c",
    "content": "/* $Id: tif_packbits.c,v 1.13.2.1 2009-01-01 00:10:43 bfriesen Exp $ */\n\n/*\n * Copyright (c) 1988-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n#include \"tiffiop.h\"\n#ifdef PACKBITS_SUPPORT\n/*\n * TIFF Library.\n *\n * PackBits Compression Algorithm Support\n */\n#include <stdio.h>\n\nstatic int\nPackBitsPreEncode(TIFF* tif, tsample_t s)\n{\n\t(void) s;\n\n        if (!(tif->tif_data = (tidata_t)_TIFFmalloc(sizeof(tsize_t))))\n\t\treturn (0);\n\t/*\n\t * Calculate the scanline/tile-width size in bytes.\n\t */\n\tif (isTiled(tif))\n\t\t*(tsize_t*)tif->tif_data = TIFFTileRowSize(tif);\n\telse\n\t\t*(tsize_t*)tif->tif_data = TIFFScanlineSize(tif);\n\treturn (1);\n}\n\nstatic int\nPackBitsPostEncode(TIFF* tif)\n{\n        if (tif->tif_data)\n            _TIFFfree(tif->tif_data);\n\treturn (1);\n}\n\n/*\n * NB: tidata is the type representing *(tidata_t);\n *     if tidata_t is made signed then this type must\n *     be adjusted accordingly.\n */\ntypedef unsigned char tidata;\n\n/*\n * Encode a run of pixels.\n */\nstatic int\nPackBitsEncode(TIFF* tif, tidata_t buf, tsize_t cc, tsample_t s)\n{\n\tunsigned char* bp = (unsigned char*) buf;\n\ttidata_t op, ep, lastliteral;\n\tlong n, slop;\n\tint b;\n\tenum { BASE, LITERAL, RUN, LITERAL_RUN } state;\n\n\t(void) s;\n\top = tif->tif_rawcp;\n\tep = tif->tif_rawdata + tif->tif_rawdatasize;\n\tstate = BASE;\n\tlastliteral = 0;\n\twhile (cc > 0) {\n\t\t/*\n\t\t * Find the longest string of identical bytes.\n\t\t */\n\t\tb = *bp++, cc--, n = 1;\n\t\tfor (; cc > 0 && b == *bp; cc--, bp++)\n\t\t\tn++;\n\tagain:\n\t\tif (op + 2 >= ep) {\t\t/* insure space for new data */\n\t\t\t/*\n\t\t\t * Be careful about writing the last\n\t\t\t * literal.  Must write up to that point\n\t\t\t * and then copy the remainder to the\n\t\t\t * front of the buffer.\n\t\t\t */\n\t\t\tif (state == LITERAL || state == LITERAL_RUN) {\n\t\t\t\tslop = op - lastliteral;\n\t\t\t\ttif->tif_rawcc += lastliteral - tif->tif_rawcp;\n\t\t\t\tif (!TIFFFlushData1(tif))\n\t\t\t\t\treturn (-1);\n\t\t\t\top = tif->tif_rawcp;\n\t\t\t\twhile (slop-- > 0)\n\t\t\t\t\t*op++ = *lastliteral++;\n\t\t\t\tlastliteral = tif->tif_rawcp;\n\t\t\t} else {\n\t\t\t\ttif->tif_rawcc += op - tif->tif_rawcp;\n\t\t\t\tif (!TIFFFlushData1(tif))\n\t\t\t\t\treturn (-1);\n\t\t\t\top = tif->tif_rawcp;\n\t\t\t}\n\t\t}\n\t\tswitch (state) {\n\t\tcase BASE:\t\t/* initial state, set run/literal */\n\t\t\tif (n > 1) {\n\t\t\t\tstate = RUN;\n\t\t\t\tif (n > 128) {\n\t\t\t\t\t*op++ = (tidata) -127;\n\t\t\t\t\t*op++ = (tidataval_t) b;\n\t\t\t\t\tn -= 128;\n\t\t\t\t\tgoto again;\n\t\t\t\t}\n\t\t\t\t*op++ = (tidataval_t)(-(n-1));\n\t\t\t\t*op++ = (tidataval_t) b;\n\t\t\t} else {\n\t\t\t\tlastliteral = op;\n\t\t\t\t*op++ = 0;\n\t\t\t\t*op++ = (tidataval_t) b;\n\t\t\t\tstate = LITERAL;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase LITERAL:\t\t/* last object was literal string */\n\t\t\tif (n > 1) {\n\t\t\t\tstate = LITERAL_RUN;\n\t\t\t\tif (n > 128) {\n\t\t\t\t\t*op++ = (tidata) -127;\n\t\t\t\t\t*op++ = (tidataval_t) b;\n\t\t\t\t\tn -= 128;\n\t\t\t\t\tgoto again;\n\t\t\t\t}\n\t\t\t\t*op++ = (tidataval_t)(-(n-1));\t/* encode run */\n\t\t\t\t*op++ = (tidataval_t) b;\n\t\t\t} else {\t\t\t/* extend literal */\n\t\t\t\tif (++(*lastliteral) == 127)\n\t\t\t\t\tstate = BASE;\n\t\t\t\t*op++ = (tidataval_t) b;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase RUN:\t\t/* last object was run */\n\t\t\tif (n > 1) {\n\t\t\t\tif (n > 128) {\n\t\t\t\t\t*op++ = (tidata) -127;\n\t\t\t\t\t*op++ = (tidataval_t) b;\n\t\t\t\t\tn -= 128;\n\t\t\t\t\tgoto again;\n\t\t\t\t}\n\t\t\t\t*op++ = (tidataval_t)(-(n-1));\n\t\t\t\t*op++ = (tidataval_t) b;\n\t\t\t} else {\n\t\t\t\tlastliteral = op;\n\t\t\t\t*op++ = 0;\n\t\t\t\t*op++ = (tidataval_t) b;\n\t\t\t\tstate = LITERAL;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase LITERAL_RUN:\t/* literal followed by a run */\n\t\t\t/*\n\t\t\t * Check to see if previous run should\n\t\t\t * be converted to a literal, in which\n\t\t\t * case we convert literal-run-literal\n\t\t\t * to a single literal.\n\t\t\t */\n\t\t\tif (n == 1 && op[-2] == (tidata) -1 &&\n\t\t\t    *lastliteral < 126) {\n\t\t\t\tstate = (((*lastliteral) += 2) == 127 ?\n\t\t\t\t    BASE : LITERAL);\n\t\t\t\top[-2] = op[-1];\t/* replicate */\n\t\t\t} else\n\t\t\t\tstate = RUN;\n\t\t\tgoto again;\n\t\t}\n\t}\n\ttif->tif_rawcc += op - tif->tif_rawcp;\n\ttif->tif_rawcp = op;\n\treturn (1);\n}\n\n/*\n * Encode a rectangular chunk of pixels.  We break it up\n * into row-sized pieces to insure that encoded runs do\n * not span rows.  Otherwise, there can be problems with\n * the decoder if data is read, for example, by scanlines\n * when it was encoded by strips.\n */\nstatic int\nPackBitsEncodeChunk(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)\n{\n\ttsize_t rowsize = *(tsize_t*)tif->tif_data;\n\n\twhile ((long)cc > 0) {\n\t\tint\tchunk = rowsize;\n\t\t\n\t\tif( cc < chunk )\n\t\t    chunk = cc;\n\n\t\tif (PackBitsEncode(tif, bp, chunk, s) < 0)\n\t\t    return (-1);\n\t\tbp += chunk;\n\t\tcc -= chunk;\n\t}\n\treturn (1);\n}\n\nstatic int\nPackBitsDecode(TIFF* tif, tidata_t op, tsize_t occ, tsample_t s)\n{\n\tchar *bp;\n\ttsize_t cc;\n\tlong n;\n\tint b;\n\n\t(void) s;\n\tbp = (char*) tif->tif_rawcp;\n\tcc = tif->tif_rawcc;\n\twhile (cc > 0 && (long)occ > 0) {\n\t\tn = (long) *bp++, cc--;\n\t\t/*\n\t\t * Watch out for compilers that\n\t\t * don't sign extend chars...\n\t\t */\n\t\tif (n >= 128)\n\t\t\tn -= 256;\n\t\tif (n < 0) {\t\t/* replicate next byte -n+1 times */\n\t\t\tif (n == -128)\t/* nop */\n\t\t\t\tcontinue;\n                        n = -n + 1;\n                        if( occ < n )\n                        {\n\t\t\t\t\t\t\tTIFFWarningExt(tif->tif_clientdata, tif->tif_name,\n                                        \"PackBitsDecode: discarding %ld bytes \"\n                                        \"to avoid buffer overrun\",\n                                        n - occ);\n                            n = occ;\n                        }\n\t\t\tocc -= n;\n\t\t\tb = *bp++, cc--;\n\t\t\twhile (n-- > 0)\n\t\t\t\t*op++ = (tidataval_t) b;\n\t\t} else {\t\t/* copy next n+1 bytes literally */\n\t\t\tif (occ < n + 1)\n                        {\n                            TIFFWarningExt(tif->tif_clientdata, tif->tif_name,\n                                        \"PackBitsDecode: discarding %ld bytes \"\n                                        \"to avoid buffer overrun\",\n                                        n - occ + 1);\n                            n = occ - 1;\n                        }\n                        _TIFFmemcpy(op, bp, ++n);\n\t\t\top += n; occ -= n;\n\t\t\tbp += n; cc -= n;\n\t\t}\n\t}\n\ttif->tif_rawcp = (tidata_t) bp;\n\ttif->tif_rawcc = cc;\n\tif (occ > 0) {\n\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t    \"PackBitsDecode: Not enough data for scanline %ld\",\n\t\t    (long) tif->tif_row);\n\t\treturn (0);\n\t}\n\treturn (1);\n}\n\nint\nTIFFInitPackBits(TIFF* tif, int scheme)\n{\n\t(void) scheme;\n\ttif->tif_decoderow = PackBitsDecode;\n\ttif->tif_decodestrip = PackBitsDecode;\n\ttif->tif_decodetile = PackBitsDecode;\n\ttif->tif_preencode = PackBitsPreEncode;\n        tif->tif_postencode = PackBitsPostEncode;\n\ttif->tif_encoderow = PackBitsEncode;\n\ttif->tif_encodestrip = PackBitsEncodeChunk;\n\ttif->tif_encodetile = PackBitsEncodeChunk;\n\treturn (1);\n}\n#endif /* PACKBITS_SUPPORT */\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/tif_pixarlog.c",
    "content": "/* $Id: tif_pixarlog.c,v 1.15.2.3 2009-01-01 00:10:43 bfriesen Exp $ */\n\n/*\n * Copyright (c) 1996-1997 Sam Leffler\n * Copyright (c) 1996 Pixar\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Pixar, Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Pixar, Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL PIXAR, SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n#include \"tiffiop.h\"\n#ifdef PIXARLOG_SUPPORT\n\n/*\n * TIFF Library.\n * PixarLog Compression Support\n *\n * Contributed by Dan McCoy.\n *\n * PixarLog film support uses the TIFF library to store companded\n * 11 bit values into a tiff file, which are compressed using the \n * zip compressor.  \n *\n * The codec can take as input and produce as output 32-bit IEEE float values \n * as well as 16-bit or 8-bit unsigned integer values.\n *\n * On writing any of the above are converted into the internal\n * 11-bit log format.   In the case of  8 and 16 bit values, the\n * input is assumed to be unsigned linear color values that represent\n * the range 0-1.  In the case of IEEE values, the 0-1 range is assumed to\n * be the normal linear color range, in addition over 1 values are\n * accepted up to a value of about 25.0 to encode \"hot\" hightlights and such.\n * The encoding is lossless for 8-bit values, slightly lossy for the\n * other bit depths.  The actual color precision should be better\n * than the human eye can perceive with extra room to allow for\n * error introduced by further image computation.  As with any quantized\n * color format, it is possible to perform image calculations which\n * expose the quantization error. This format should certainly be less \n * susceptable to such errors than standard 8-bit encodings, but more\n * susceptable than straight 16-bit or 32-bit encodings.\n *\n * On reading the internal format is converted to the desired output format.\n * The program can request which format it desires by setting the internal\n * pseudo tag TIFFTAG_PIXARLOGDATAFMT to one of these possible values:\n *  PIXARLOGDATAFMT_FLOAT     = provide IEEE float values.\n *  PIXARLOGDATAFMT_16BIT     = provide unsigned 16-bit integer values\n *  PIXARLOGDATAFMT_8BIT      = provide unsigned 8-bit integer values\n *\n * alternately PIXARLOGDATAFMT_8BITABGR provides unsigned 8-bit integer\n * values with the difference that if there are exactly three or four channels\n * (rgb or rgba) it swaps the channel order (bgr or abgr).\n *\n * PIXARLOGDATAFMT_11BITLOG provides the internal encoding directly\n * packed in 16-bit values.   However no tools are supplied for interpreting\n * these values.\n *\n * \"hot\" (over 1.0) areas written in floating point get clamped to\n * 1.0 in the integer data types.\n *\n * When the file is closed after writing, the bit depth and sample format\n * are set always to appear as if 8-bit data has been written into it.\n * That way a naive program unaware of the particulars of the encoding\n * gets the format it is most likely able to handle.\n *\n * The codec does it's own horizontal differencing step on the coded\n * values so the libraries predictor stuff should be turned off.\n * The codec also handle byte swapping the encoded values as necessary\n * since the library does not have the information necessary\n * to know the bit depth of the raw unencoded buffer.\n * \n */\n\n#include \"tif_predict.h\"\n#include \"zlib.h\"\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\n/* Tables for converting to/from 11 bit coded values */\n\n#define  TSIZE\t 2048\t\t/* decode table size (11-bit tokens) */\n#define  TSIZEP1 2049\t\t/* Plus one for slop */\n#define  ONE\t 1250\t\t/* token value of 1.0 exactly */\n#define  RATIO\t 1.004\t\t/* nominal ratio for log part */\n\n#define CODE_MASK 0x7ff         /* 11 bits. */\n\nstatic float  Fltsize;\nstatic float  LogK1, LogK2;\n\n#define REPEAT(n, op)   { int i; i=n; do { i--; op; } while (i>0); }\n\nstatic void\nhorizontalAccumulateF(uint16 *wp, int n, int stride, float *op, \n\tfloat *ToLinearF)\n{\n    register unsigned int  cr, cg, cb, ca, mask;\n    register float  t0, t1, t2, t3;\n\n    if (n >= stride) {\n\tmask = CODE_MASK;\n\tif (stride == 3) {\n\t    t0 = ToLinearF[cr = wp[0]];\n\t    t1 = ToLinearF[cg = wp[1]];\n\t    t2 = ToLinearF[cb = wp[2]];\n\t    op[0] = t0;\n\t    op[1] = t1;\n\t    op[2] = t2;\n\t    n -= 3;\n\t    while (n > 0) {\n\t\twp += 3;\n\t\top += 3;\n\t\tn -= 3;\n\t\tt0 = ToLinearF[(cr += wp[0]) & mask];\n\t\tt1 = ToLinearF[(cg += wp[1]) & mask];\n\t\tt2 = ToLinearF[(cb += wp[2]) & mask];\n\t\top[0] = t0;\n\t\top[1] = t1;\n\t\top[2] = t2;\n\t    }\n\t} else if (stride == 4) {\n\t    t0 = ToLinearF[cr = wp[0]];\n\t    t1 = ToLinearF[cg = wp[1]];\n\t    t2 = ToLinearF[cb = wp[2]];\n\t    t3 = ToLinearF[ca = wp[3]];\n\t    op[0] = t0;\n\t    op[1] = t1;\n\t    op[2] = t2;\n\t    op[3] = t3;\n\t    n -= 4;\n\t    while (n > 0) {\n\t\twp += 4;\n\t\top += 4;\n\t\tn -= 4;\n\t\tt0 = ToLinearF[(cr += wp[0]) & mask];\n\t\tt1 = ToLinearF[(cg += wp[1]) & mask];\n\t\tt2 = ToLinearF[(cb += wp[2]) & mask];\n\t\tt3 = ToLinearF[(ca += wp[3]) & mask];\n\t\top[0] = t0;\n\t\top[1] = t1;\n\t\top[2] = t2;\n\t\top[3] = t3;\n\t    }\n\t} else {\n\t    REPEAT(stride, *op = ToLinearF[*wp&mask]; wp++; op++)\n\t    n -= stride;\n\t    while (n > 0) {\n\t\tREPEAT(stride,\n\t\t    wp[stride] += *wp; *op = ToLinearF[*wp&mask]; wp++; op++)\n\t\tn -= stride;\n\t    }\n\t}\n    }\n}\n\nstatic void\nhorizontalAccumulate12(uint16 *wp, int n, int stride, int16 *op,\n\tfloat *ToLinearF)\n{\n    register unsigned int  cr, cg, cb, ca, mask;\n    register float  t0, t1, t2, t3;\n\n#define SCALE12 2048.0F\n#define CLAMP12(t) (((t) < 3071) ? (uint16) (t) : 3071)\n\n    if (n >= stride) {\n\tmask = CODE_MASK;\n\tif (stride == 3) {\n\t    t0 = ToLinearF[cr = wp[0]] * SCALE12;\n\t    t1 = ToLinearF[cg = wp[1]] * SCALE12;\n\t    t2 = ToLinearF[cb = wp[2]] * SCALE12;\n\t    op[0] = CLAMP12(t0);\n\t    op[1] = CLAMP12(t1);\n\t    op[2] = CLAMP12(t2);\n\t    n -= 3;\n\t    while (n > 0) {\n\t\twp += 3;\n\t\top += 3;\n\t\tn -= 3;\n\t\tt0 = ToLinearF[(cr += wp[0]) & mask] * SCALE12;\n\t\tt1 = ToLinearF[(cg += wp[1]) & mask] * SCALE12;\n\t\tt2 = ToLinearF[(cb += wp[2]) & mask] * SCALE12;\n\t\top[0] = CLAMP12(t0);\n\t\top[1] = CLAMP12(t1);\n\t\top[2] = CLAMP12(t2);\n\t    }\n\t} else if (stride == 4) {\n\t    t0 = ToLinearF[cr = wp[0]] * SCALE12;\n\t    t1 = ToLinearF[cg = wp[1]] * SCALE12;\n\t    t2 = ToLinearF[cb = wp[2]] * SCALE12;\n\t    t3 = ToLinearF[ca = wp[3]] * SCALE12;\n\t    op[0] = CLAMP12(t0);\n\t    op[1] = CLAMP12(t1);\n\t    op[2] = CLAMP12(t2);\n\t    op[3] = CLAMP12(t3);\n\t    n -= 4;\n\t    while (n > 0) {\n\t\twp += 4;\n\t\top += 4;\n\t\tn -= 4;\n\t\tt0 = ToLinearF[(cr += wp[0]) & mask] * SCALE12;\n\t\tt1 = ToLinearF[(cg += wp[1]) & mask] * SCALE12;\n\t\tt2 = ToLinearF[(cb += wp[2]) & mask] * SCALE12;\n\t\tt3 = ToLinearF[(ca += wp[3]) & mask] * SCALE12;\n\t\top[0] = CLAMP12(t0);\n\t\top[1] = CLAMP12(t1);\n\t\top[2] = CLAMP12(t2);\n\t\top[3] = CLAMP12(t3);\n\t    }\n\t} else {\n\t    REPEAT(stride, t0 = ToLinearF[*wp&mask] * SCALE12;\n                           *op = CLAMP12(t0); wp++; op++)\n\t    n -= stride;\n\t    while (n > 0) {\n\t\tREPEAT(stride,\n\t\t    wp[stride] += *wp; t0 = ToLinearF[wp[stride]&mask]*SCALE12;\n\t\t    *op = CLAMP12(t0);  wp++; op++)\n\t\tn -= stride;\n\t    }\n\t}\n    }\n}\n\nstatic void\nhorizontalAccumulate16(uint16 *wp, int n, int stride, uint16 *op,\n\tuint16 *ToLinear16)\n{\n    register unsigned int  cr, cg, cb, ca, mask;\n\n    if (n >= stride) {\n\tmask = CODE_MASK;\n\tif (stride == 3) {\n\t    op[0] = ToLinear16[cr = wp[0]];\n\t    op[1] = ToLinear16[cg = wp[1]];\n\t    op[2] = ToLinear16[cb = wp[2]];\n\t    n -= 3;\n\t    while (n > 0) {\n\t\twp += 3;\n\t\top += 3;\n\t\tn -= 3;\n\t\top[0] = ToLinear16[(cr += wp[0]) & mask];\n\t\top[1] = ToLinear16[(cg += wp[1]) & mask];\n\t\top[2] = ToLinear16[(cb += wp[2]) & mask];\n\t    }\n\t} else if (stride == 4) {\n\t    op[0] = ToLinear16[cr = wp[0]];\n\t    op[1] = ToLinear16[cg = wp[1]];\n\t    op[2] = ToLinear16[cb = wp[2]];\n\t    op[3] = ToLinear16[ca = wp[3]];\n\t    n -= 4;\n\t    while (n > 0) {\n\t\twp += 4;\n\t\top += 4;\n\t\tn -= 4;\n\t\top[0] = ToLinear16[(cr += wp[0]) & mask];\n\t\top[1] = ToLinear16[(cg += wp[1]) & mask];\n\t\top[2] = ToLinear16[(cb += wp[2]) & mask];\n\t\top[3] = ToLinear16[(ca += wp[3]) & mask];\n\t    }\n\t} else {\n\t    REPEAT(stride, *op = ToLinear16[*wp&mask]; wp++; op++)\n\t    n -= stride;\n\t    while (n > 0) {\n\t\tREPEAT(stride,\n\t\t    wp[stride] += *wp; *op = ToLinear16[*wp&mask]; wp++; op++)\n\t\tn -= stride;\n\t    }\n\t}\n    }\n}\n\n/* \n * Returns the log encoded 11-bit values with the horizontal\n * differencing undone.\n */\nstatic void\nhorizontalAccumulate11(uint16 *wp, int n, int stride, uint16 *op)\n{\n    register unsigned int  cr, cg, cb, ca, mask;\n\n    if (n >= stride) {\n\tmask = CODE_MASK;\n\tif (stride == 3) {\n\t    op[0] = cr = wp[0];  op[1] = cg = wp[1];  op[2] = cb = wp[2];\n\t    n -= 3;\n\t    while (n > 0) {\n\t\twp += 3;\n\t\top += 3;\n\t\tn -= 3;\n\t\top[0] = (cr += wp[0]) & mask;\n\t\top[1] = (cg += wp[1]) & mask;\n\t\top[2] = (cb += wp[2]) & mask;\n\t    }\n\t} else if (stride == 4) {\n\t    op[0] = cr = wp[0];  op[1] = cg = wp[1];\n\t    op[2] = cb = wp[2];  op[3] = ca = wp[3];\n\t    n -= 4;\n\t    while (n > 0) {\n\t\twp += 4;\n\t\top += 4;\n\t\tn -= 4;\n\t\top[0] = (cr += wp[0]) & mask;\n\t\top[1] = (cg += wp[1]) & mask;\n\t\top[2] = (cb += wp[2]) & mask;\n\t\top[3] = (ca += wp[3]) & mask;\n\t    } \n\t} else {\n\t    REPEAT(stride, *op = *wp&mask; wp++; op++)\n\t    n -= stride;\n\t    while (n > 0) {\n\t\tREPEAT(stride,\n\t\t    wp[stride] += *wp; *op = *wp&mask; wp++; op++)\n\t\tn -= stride;\n\t    }\n\t}\n    }\n}\n\nstatic void\nhorizontalAccumulate8(uint16 *wp, int n, int stride, unsigned char *op,\n\tunsigned char *ToLinear8)\n{\n    register unsigned int  cr, cg, cb, ca, mask;\n\n    if (n >= stride) {\n\tmask = CODE_MASK;\n\tif (stride == 3) {\n\t    op[0] = ToLinear8[cr = wp[0]];\n\t    op[1] = ToLinear8[cg = wp[1]];\n\t    op[2] = ToLinear8[cb = wp[2]];\n\t    n -= 3;\n\t    while (n > 0) {\n\t\tn -= 3;\n\t\twp += 3;\n\t\top += 3;\n\t\top[0] = ToLinear8[(cr += wp[0]) & mask];\n\t\top[1] = ToLinear8[(cg += wp[1]) & mask];\n\t\top[2] = ToLinear8[(cb += wp[2]) & mask];\n\t    }\n\t} else if (stride == 4) {\n\t    op[0] = ToLinear8[cr = wp[0]];\n\t    op[1] = ToLinear8[cg = wp[1]];\n\t    op[2] = ToLinear8[cb = wp[2]];\n\t    op[3] = ToLinear8[ca = wp[3]];\n\t    n -= 4;\n\t    while (n > 0) {\n\t\tn -= 4;\n\t\twp += 4;\n\t\top += 4;\n\t\top[0] = ToLinear8[(cr += wp[0]) & mask];\n\t\top[1] = ToLinear8[(cg += wp[1]) & mask];\n\t\top[2] = ToLinear8[(cb += wp[2]) & mask];\n\t\top[3] = ToLinear8[(ca += wp[3]) & mask];\n\t    }\n\t} else {\n\t    REPEAT(stride, *op = ToLinear8[*wp&mask]; wp++; op++)\n\t    n -= stride;\n\t    while (n > 0) {\n\t\tREPEAT(stride,\n\t\t    wp[stride] += *wp; *op = ToLinear8[*wp&mask]; wp++; op++)\n\t\tn -= stride;\n\t    }\n\t}\n    }\n}\n\n\nstatic void\nhorizontalAccumulate8abgr(uint16 *wp, int n, int stride, unsigned char *op,\n\tunsigned char *ToLinear8)\n{\n    register unsigned int  cr, cg, cb, ca, mask;\n    register unsigned char  t0, t1, t2, t3;\n\n    if (n >= stride) {\n\tmask = CODE_MASK;\n\tif (stride == 3) {\n\t    op[0] = 0;\n\t    t1 = ToLinear8[cb = wp[2]];\n\t    t2 = ToLinear8[cg = wp[1]];\n\t    t3 = ToLinear8[cr = wp[0]];\n\t    op[1] = t1;\n\t    op[2] = t2;\n\t    op[3] = t3;\n\t    n -= 3;\n\t    while (n > 0) {\n\t\tn -= 3;\n\t\twp += 3;\n\t\top += 4;\n\t\top[0] = 0;\n\t\tt1 = ToLinear8[(cb += wp[2]) & mask];\n\t\tt2 = ToLinear8[(cg += wp[1]) & mask];\n\t\tt3 = ToLinear8[(cr += wp[0]) & mask];\n\t\top[1] = t1;\n\t\top[2] = t2;\n\t\top[3] = t3;\n\t    }\n\t} else if (stride == 4) {\n\t    t0 = ToLinear8[ca = wp[3]];\n\t    t1 = ToLinear8[cb = wp[2]];\n\t    t2 = ToLinear8[cg = wp[1]];\n\t    t3 = ToLinear8[cr = wp[0]];\n\t    op[0] = t0;\n\t    op[1] = t1;\n\t    op[2] = t2;\n\t    op[3] = t3;\n\t    n -= 4;\n\t    while (n > 0) {\n\t\tn -= 4;\n\t\twp += 4;\n\t\top += 4;\n\t\tt0 = ToLinear8[(ca += wp[3]) & mask];\n\t\tt1 = ToLinear8[(cb += wp[2]) & mask];\n\t\tt2 = ToLinear8[(cg += wp[1]) & mask];\n\t\tt3 = ToLinear8[(cr += wp[0]) & mask];\n\t\top[0] = t0;\n\t\top[1] = t1;\n\t\top[2] = t2;\n\t\top[3] = t3;\n\t    }\n\t} else {\n\t    REPEAT(stride, *op = ToLinear8[*wp&mask]; wp++; op++)\n\t    n -= stride;\n\t    while (n > 0) {\n\t\tREPEAT(stride,\n\t\t    wp[stride] += *wp; *op = ToLinear8[*wp&mask]; wp++; op++)\n\t\tn -= stride;\n\t    }\n\t}\n    }\n}\n\n/*\n * State block for each open TIFF\n * file using PixarLog compression/decompression.\n */\ntypedef\tstruct {\n\tTIFFPredictorState\tpredict;\n\tz_stream\t\tstream;\n\tuint16\t\t\t*tbuf; \n\tuint16\t\t\tstride;\n\tint\t\t\tstate;\n\tint\t\t\tuser_datafmt;\n\tint\t\t\tquality;\n#define PLSTATE_INIT 1\n\n\tTIFFVSetMethod\t\tvgetparent;\t/* super-class method */\n\tTIFFVSetMethod\t\tvsetparent;\t/* super-class method */\n\n\tfloat *ToLinearF;\n\tuint16 *ToLinear16;\n\tunsigned char *ToLinear8;\n\tuint16  *FromLT2;\n\tuint16  *From14; /* Really for 16-bit data, but we shift down 2 */\n\tuint16  *From8;\n\t\n} PixarLogState;\n\nstatic int\nPixarLogMakeTables(PixarLogState *sp)\n{\n\n/*\n *    We make several tables here to convert between various external\n *    representations (float, 16-bit, and 8-bit) and the internal\n *    11-bit companded representation.  The 11-bit representation has two\n *    distinct regions.  A linear bottom end up through .018316 in steps\n *    of about .000073, and a region of constant ratio up to about 25.\n *    These floating point numbers are stored in the main table ToLinearF. \n *    All other tables are derived from this one.  The tables (and the\n *    ratios) are continuous at the internal seam.\n */\n\n    int  nlin, lt2size;\n    int  i, j;\n    double  b, c, linstep, v;\n    float *ToLinearF;\n    uint16 *ToLinear16;\n    unsigned char *ToLinear8;\n    uint16  *FromLT2;\n    uint16  *From14; /* Really for 16-bit data, but we shift down 2 */\n    uint16  *From8;\n\n    c = log(RATIO);\t\n    nlin = (int)(1./c);\t/* nlin must be an integer */\n    c = 1./nlin;\n    b = exp(-c*ONE);\t/* multiplicative scale factor [b*exp(c*ONE) = 1] */\n    linstep = b*c*exp(1.);\n\n    LogK1 = (float)(1./c);\t/* if (v >= 2)  token = k1*log(v*k2) */\n    LogK2 = (float)(1./b);\n    lt2size = (int)(2./linstep) + 1;\n    FromLT2 = (uint16 *)_TIFFmalloc(lt2size*sizeof(uint16));\n    From14 = (uint16 *)_TIFFmalloc(16384*sizeof(uint16));\n    From8 = (uint16 *)_TIFFmalloc(256*sizeof(uint16));\n    ToLinearF = (float *)_TIFFmalloc(TSIZEP1 * sizeof(float));\n    ToLinear16 = (uint16 *)_TIFFmalloc(TSIZEP1 * sizeof(uint16));\n    ToLinear8 = (unsigned char *)_TIFFmalloc(TSIZEP1 * sizeof(unsigned char));\n    if (FromLT2 == NULL || From14  == NULL || From8   == NULL ||\n\t ToLinearF == NULL || ToLinear16 == NULL || ToLinear8 == NULL) {\n\tif (FromLT2) _TIFFfree(FromLT2);\n\tif (From14) _TIFFfree(From14);\n\tif (From8) _TIFFfree(From8);\n\tif (ToLinearF) _TIFFfree(ToLinearF);\n\tif (ToLinear16) _TIFFfree(ToLinear16);\n\tif (ToLinear8) _TIFFfree(ToLinear8);\n\tsp->FromLT2 = NULL;\n\tsp->From14 = NULL;\n\tsp->From8 = NULL;\n\tsp->ToLinearF = NULL;\n\tsp->ToLinear16 = NULL;\n\tsp->ToLinear8 = NULL;\n\treturn 0;\n    }\n\n    j = 0;\n\n    for (i = 0; i < nlin; i++)  {\n\tv = i * linstep;\n\tToLinearF[j++] = (float)v;\n    }\n\n    for (i = nlin; i < TSIZE; i++)\n\tToLinearF[j++] = (float)(b*exp(c*i));\n\n    ToLinearF[2048] = ToLinearF[2047];\n\n    for (i = 0; i < TSIZEP1; i++)  {\n\tv = ToLinearF[i]*65535.0 + 0.5;\n\tToLinear16[i] = (v > 65535.0) ? 65535 : (uint16)v;\n\tv = ToLinearF[i]*255.0  + 0.5;\n\tToLinear8[i]  = (v > 255.0) ? 255 : (unsigned char)v;\n    }\n\n    j = 0;\n    for (i = 0; i < lt2size; i++)  {\n\tif ((i*linstep)*(i*linstep) > ToLinearF[j]*ToLinearF[j+1])\n\t    j++;\n\tFromLT2[i] = j;\n    }\n\n    /*\n     * Since we lose info anyway on 16-bit data, we set up a 14-bit\n     * table and shift 16-bit values down two bits on input.\n     * saves a little table space.\n     */\n    j = 0;\n    for (i = 0; i < 16384; i++)  {\n\twhile ((i/16383.)*(i/16383.) > ToLinearF[j]*ToLinearF[j+1])\n\t    j++;\n\tFrom14[i] = j;\n    }\n\n    j = 0;\n    for (i = 0; i < 256; i++)  {\n\twhile ((i/255.)*(i/255.) > ToLinearF[j]*ToLinearF[j+1])\n\t    j++;\n\tFrom8[i] = j;\n    }\n\n    Fltsize = (float)(lt2size/2);\n\n    sp->ToLinearF = ToLinearF;\n    sp->ToLinear16 = ToLinear16;\n    sp->ToLinear8 = ToLinear8;\n    sp->FromLT2 = FromLT2;\n    sp->From14 = From14;\n    sp->From8 = From8;\n\n    return 1;\n}\n\n#define\tDecoderState(tif)\t((PixarLogState*) (tif)->tif_data)\n#define\tEncoderState(tif)\t((PixarLogState*) (tif)->tif_data)\n\nstatic\tint PixarLogEncode(TIFF*, tidata_t, tsize_t, tsample_t);\nstatic\tint PixarLogDecode(TIFF*, tidata_t, tsize_t, tsample_t);\n\n#define PIXARLOGDATAFMT_UNKNOWN\t-1\n\nstatic int\nPixarLogGuessDataFmt(TIFFDirectory *td)\n{\n\tint guess = PIXARLOGDATAFMT_UNKNOWN;\n\tint format = td->td_sampleformat;\n\n\t/* If the user didn't tell us his datafmt,\n\t * take our best guess from the bitspersample.\n\t */\n\tswitch (td->td_bitspersample) {\n\t case 32:\n\t\tif (format == SAMPLEFORMAT_IEEEFP)\n\t\t\tguess = PIXARLOGDATAFMT_FLOAT;\n\t\tbreak;\n\t case 16:\n\t\tif (format == SAMPLEFORMAT_VOID || format == SAMPLEFORMAT_UINT)\n\t\t\tguess = PIXARLOGDATAFMT_16BIT;\n\t\tbreak;\n\t case 12:\n\t\tif (format == SAMPLEFORMAT_VOID || format == SAMPLEFORMAT_INT)\n\t\t\tguess = PIXARLOGDATAFMT_12BITPICIO;\n\t\tbreak;\n\t case 11:\n\t\tif (format == SAMPLEFORMAT_VOID || format == SAMPLEFORMAT_UINT)\n\t\t\tguess = PIXARLOGDATAFMT_11BITLOG;\n\t\tbreak;\n\t case 8:\n\t\tif (format == SAMPLEFORMAT_VOID || format == SAMPLEFORMAT_UINT)\n\t\t\tguess = PIXARLOGDATAFMT_8BIT;\n\t\tbreak;\n\t}\n\n\treturn guess;\n}\n\nstatic uint32\nmultiply(size_t m1, size_t m2)\n{\n\tuint32\tbytes = m1 * m2;\n\n\tif (m1 && bytes / m1 != m2)\n\t\tbytes = 0;\n\n\treturn bytes;\n}\n\nstatic int\nPixarLogSetupDecode(TIFF* tif)\n{\n\tTIFFDirectory *td = &tif->tif_dir;\n\tPixarLogState* sp = DecoderState(tif);\n\ttsize_t tbuf_size;\n\tstatic const char module[] = \"PixarLogSetupDecode\";\n\n\tassert(sp != NULL);\n\n\t/* Make sure no byte swapping happens on the data\n\t * after decompression. */\n\ttif->tif_postdecode = _TIFFNoPostDecode;\n\n\t/* for some reason, we can't do this in TIFFInitPixarLog */\n\n\tsp->stride = (td->td_planarconfig == PLANARCONFIG_CONTIG ?\n\t    td->td_samplesperpixel : 1);\n\ttbuf_size = multiply(multiply(multiply(sp->stride, td->td_imagewidth),\n\t\t\t\t      td->td_rowsperstrip), sizeof(uint16));\n\tif (tbuf_size == 0)\n\t\treturn (0);\n\tsp->tbuf = (uint16 *) _TIFFmalloc(tbuf_size);\n\tif (sp->tbuf == NULL)\n\t\treturn (0);\n\tif (sp->user_datafmt == PIXARLOGDATAFMT_UNKNOWN)\n\t\tsp->user_datafmt = PixarLogGuessDataFmt(td);\n\tif (sp->user_datafmt == PIXARLOGDATAFMT_UNKNOWN) {\n\t\tTIFFErrorExt(tif->tif_clientdata, module,\n\t\t\t\"PixarLog compression can't handle bits depth/data format combination (depth: %d)\", \n\t\t\ttd->td_bitspersample);\n\t\treturn (0);\n\t}\n\n\tif (inflateInit(&sp->stream) != Z_OK) {\n\t\tTIFFErrorExt(tif->tif_clientdata, module, \"%s: %s\", tif->tif_name, sp->stream.msg);\n\t\treturn (0);\n\t} else {\n\t\tsp->state |= PLSTATE_INIT;\n\t\treturn (1);\n\t}\n}\n\n/*\n * Setup state for decoding a strip.\n */\nstatic int\nPixarLogPreDecode(TIFF* tif, tsample_t s)\n{\n\tPixarLogState* sp = DecoderState(tif);\n\n\t(void) s;\n\tassert(sp != NULL);\n\tsp->stream.next_in = tif->tif_rawdata;\n\tsp->stream.avail_in = tif->tif_rawcc;\n\treturn (inflateReset(&sp->stream) == Z_OK);\n}\n\nstatic int\nPixarLogDecode(TIFF* tif, tidata_t op, tsize_t occ, tsample_t s)\n{\n\tTIFFDirectory *td = &tif->tif_dir;\n\tPixarLogState* sp = DecoderState(tif);\n\tstatic const char module[] = \"PixarLogDecode\";\n\tint i, nsamples, llen;\n\tuint16 *up;\n\n\tswitch (sp->user_datafmt) {\n\tcase PIXARLOGDATAFMT_FLOAT:\n\t\tnsamples = occ / sizeof(float);\t/* XXX float == 32 bits */\n\t\tbreak;\n\tcase PIXARLOGDATAFMT_16BIT:\n\tcase PIXARLOGDATAFMT_12BITPICIO:\n\tcase PIXARLOGDATAFMT_11BITLOG:\n\t\tnsamples = occ / sizeof(uint16); /* XXX uint16 == 16 bits */\n\t\tbreak;\n\tcase PIXARLOGDATAFMT_8BIT:\n\tcase PIXARLOGDATAFMT_8BITABGR:\n\t\tnsamples = occ;\n\t\tbreak;\n\tdefault:\n\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t\t\"%d bit input not supported in PixarLog\",\n\t\t\ttd->td_bitspersample);\n\t\treturn 0;\n\t}\n\n\tllen = sp->stride * td->td_imagewidth;\n\n\t(void) s;\n\tassert(sp != NULL);\n\tsp->stream.next_out = (unsigned char *) sp->tbuf;\n\tsp->stream.avail_out = nsamples * sizeof(uint16);\n\tdo {\n\t\tint state = inflate(&sp->stream, Z_PARTIAL_FLUSH);\n\t\tif (state == Z_STREAM_END) {\n\t\t\tbreak;\t\t\t/* XXX */\n\t\t}\n\t\tif (state == Z_DATA_ERROR) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, module,\n\t\t\t    \"%s: Decoding error at scanline %d, %s\",\n\t\t\t    tif->tif_name, tif->tif_row, sp->stream.msg);\n\t\t\tif (inflateSync(&sp->stream) != Z_OK)\n\t\t\t\treturn (0);\n\t\t\tcontinue;\n\t\t}\n\t\tif (state != Z_OK) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, module, \"%s: zlib error: %s\",\n\t\t\t    tif->tif_name, sp->stream.msg);\n\t\t\treturn (0);\n\t\t}\n\t} while (sp->stream.avail_out > 0);\n\n\t/* hopefully, we got all the bytes we needed */\n\tif (sp->stream.avail_out != 0) {\n\t\tTIFFErrorExt(tif->tif_clientdata, module,\n\t\t    \"%s: Not enough data at scanline %d (short %d bytes)\",\n\t\t    tif->tif_name, tif->tif_row, sp->stream.avail_out);\n\t\treturn (0);\n\t}\n\n\tup = sp->tbuf;\n\t/* Swap bytes in the data if from a different endian machine. */\n\tif (tif->tif_flags & TIFF_SWAB)\n\t\tTIFFSwabArrayOfShort(up, nsamples);\n\n\t/* \n\t * if llen is not an exact multiple of nsamples, the decode operation\n\t * may overflow the output buffer, so truncate it enough to prevent\n\t * that but still salvage as much data as possible.\n\t */\n\tif (nsamples % llen) { \n\t\tTIFFWarningExt(tif->tif_clientdata, module,\n\t\t\t\"%s: stride %d is not a multiple of sample count, \"\n\t\t\t\"%d, data truncated.\", tif->tif_name, llen, nsamples);\n\t\tnsamples -= nsamples % llen;\n\t}\n\n\tfor (i = 0; i < nsamples; i += llen, up += llen) {\n\t\tswitch (sp->user_datafmt)  {\n\t\tcase PIXARLOGDATAFMT_FLOAT:\n\t\t\thorizontalAccumulateF(up, llen, sp->stride,\n\t\t\t\t\t(float *)op, sp->ToLinearF);\n\t\t\top += llen * sizeof(float);\n\t\t\tbreak;\n\t\tcase PIXARLOGDATAFMT_16BIT:\n\t\t\thorizontalAccumulate16(up, llen, sp->stride,\n\t\t\t\t\t(uint16 *)op, sp->ToLinear16);\n\t\t\top += llen * sizeof(uint16);\n\t\t\tbreak;\n\t\tcase PIXARLOGDATAFMT_12BITPICIO:\n\t\t\thorizontalAccumulate12(up, llen, sp->stride,\n\t\t\t\t\t(int16 *)op, sp->ToLinearF);\n\t\t\top += llen * sizeof(int16);\n\t\t\tbreak;\n\t\tcase PIXARLOGDATAFMT_11BITLOG:\n\t\t\thorizontalAccumulate11(up, llen, sp->stride,\n\t\t\t\t\t(uint16 *)op);\n\t\t\top += llen * sizeof(uint16);\n\t\t\tbreak;\n\t\tcase PIXARLOGDATAFMT_8BIT:\n\t\t\thorizontalAccumulate8(up, llen, sp->stride,\n\t\t\t\t\t(unsigned char *)op, sp->ToLinear8);\n\t\t\top += llen * sizeof(unsigned char);\n\t\t\tbreak;\n\t\tcase PIXARLOGDATAFMT_8BITABGR:\n\t\t\thorizontalAccumulate8abgr(up, llen, sp->stride,\n\t\t\t\t\t(unsigned char *)op, sp->ToLinear8);\n\t\t\top += llen * sizeof(unsigned char);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t\t\t  \"PixarLogDecode: unsupported bits/sample: %d\", \n\t\t\t\t  td->td_bitspersample);\n\t\t\treturn (0);\n\t\t}\n\t}\n\n\treturn (1);\n}\n\nstatic int\nPixarLogSetupEncode(TIFF* tif)\n{\n\tTIFFDirectory *td = &tif->tif_dir;\n\tPixarLogState* sp = EncoderState(tif);\n\ttsize_t tbuf_size;\n\tstatic const char module[] = \"PixarLogSetupEncode\";\n\n\tassert(sp != NULL);\n\n\t/* for some reason, we can't do this in TIFFInitPixarLog */\n\n\tsp->stride = (td->td_planarconfig == PLANARCONFIG_CONTIG ?\n\t    td->td_samplesperpixel : 1);\n\ttbuf_size = multiply(multiply(multiply(sp->stride, td->td_imagewidth),\n\t\t\t\t      td->td_rowsperstrip), sizeof(uint16));\n\tif (tbuf_size == 0)\n\t\treturn (0);\n\tsp->tbuf = (uint16 *) _TIFFmalloc(tbuf_size);\n\tif (sp->tbuf == NULL)\n\t\treturn (0);\n\tif (sp->user_datafmt == PIXARLOGDATAFMT_UNKNOWN)\n\t\tsp->user_datafmt = PixarLogGuessDataFmt(td);\n\tif (sp->user_datafmt == PIXARLOGDATAFMT_UNKNOWN) {\n\t\tTIFFErrorExt(tif->tif_clientdata, module, \"PixarLog compression can't handle %d bit linear encodings\", td->td_bitspersample);\n\t\treturn (0);\n\t}\n\n\tif (deflateInit(&sp->stream, sp->quality) != Z_OK) {\n\t\tTIFFErrorExt(tif->tif_clientdata, module, \"%s: %s\", tif->tif_name, sp->stream.msg);\n\t\treturn (0);\n\t} else {\n\t\tsp->state |= PLSTATE_INIT;\n\t\treturn (1);\n\t}\n}\n\n/*\n * Reset encoding state at the start of a strip.\n */\nstatic int\nPixarLogPreEncode(TIFF* tif, tsample_t s)\n{\n\tPixarLogState *sp = EncoderState(tif);\n\n\t(void) s;\n\tassert(sp != NULL);\n\tsp->stream.next_out = tif->tif_rawdata;\n\tsp->stream.avail_out = tif->tif_rawdatasize;\n\treturn (deflateReset(&sp->stream) == Z_OK);\n}\n\nstatic void\nhorizontalDifferenceF(float *ip, int n, int stride, uint16 *wp, uint16 *FromLT2)\n{\n\n    int32 r1, g1, b1, a1, r2, g2, b2, a2, mask;\n    float fltsize = Fltsize;\n\n#define  CLAMP(v) ( (v<(float)0.)   ? 0\t\t\t\t\\\n\t\t  : (v<(float)2.)   ? FromLT2[(int)(v*fltsize)]\t\\\n\t\t  : (v>(float)24.2) ? 2047\t\t\t\\\n\t\t  : LogK1*log(v*LogK2) + 0.5 )\n\n    mask = CODE_MASK;\n    if (n >= stride) {\n\tif (stride == 3) {\n\t    r2 = wp[0] = (uint16) CLAMP(ip[0]);\n\t    g2 = wp[1] = (uint16) CLAMP(ip[1]);\n\t    b2 = wp[2] = (uint16) CLAMP(ip[2]);\n\t    n -= 3;\n\t    while (n > 0) {\n\t\tn -= 3;\n\t\twp += 3;\n\t\tip += 3;\n\t\tr1 = (int32) CLAMP(ip[0]); wp[0] = (r1-r2) & mask; r2 = r1;\n\t\tg1 = (int32) CLAMP(ip[1]); wp[1] = (g1-g2) & mask; g2 = g1;\n\t\tb1 = (int32) CLAMP(ip[2]); wp[2] = (b1-b2) & mask; b2 = b1;\n\t    }\n\t} else if (stride == 4) {\n\t    r2 = wp[0] = (uint16) CLAMP(ip[0]);\n\t    g2 = wp[1] = (uint16) CLAMP(ip[1]);\n\t    b2 = wp[2] = (uint16) CLAMP(ip[2]);\n\t    a2 = wp[3] = (uint16) CLAMP(ip[3]);\n\t    n -= 4;\n\t    while (n > 0) {\n\t\tn -= 4;\n\t\twp += 4;\n\t\tip += 4;\n\t\tr1 = (int32) CLAMP(ip[0]); wp[0] = (r1-r2) & mask; r2 = r1;\n\t\tg1 = (int32) CLAMP(ip[1]); wp[1] = (g1-g2) & mask; g2 = g1;\n\t\tb1 = (int32) CLAMP(ip[2]); wp[2] = (b1-b2) & mask; b2 = b1;\n\t\ta1 = (int32) CLAMP(ip[3]); wp[3] = (a1-a2) & mask; a2 = a1;\n\t    }\n\t} else {\n\t    ip += n - 1;\t/* point to last one */\n\t    wp += n - 1;\t/* point to last one */\n\t    n -= stride;\n\t    while (n > 0) {\n\t\tREPEAT(stride, wp[0] = (uint16) CLAMP(ip[0]);\n\t\t\t\twp[stride] -= wp[0];\n\t\t\t\twp[stride] &= mask;\n\t\t\t\twp--; ip--)\n\t\tn -= stride;\n\t    }\n\t    REPEAT(stride, wp[0] = (uint16) CLAMP(ip[0]); wp--; ip--)\n\t}\n    }\n}\n\nstatic void\nhorizontalDifference16(unsigned short *ip, int n, int stride, \n\tunsigned short *wp, uint16 *From14)\n{\n    register int  r1, g1, b1, a1, r2, g2, b2, a2, mask;\n\n/* assumption is unsigned pixel values */\n#undef   CLAMP\n#define  CLAMP(v) From14[(v) >> 2]\n\n    mask = CODE_MASK;\n    if (n >= stride) {\n\tif (stride == 3) {\n\t    r2 = wp[0] = CLAMP(ip[0]);  g2 = wp[1] = CLAMP(ip[1]);\n\t    b2 = wp[2] = CLAMP(ip[2]);\n\t    n -= 3;\n\t    while (n > 0) {\n\t\tn -= 3;\n\t\twp += 3;\n\t\tip += 3;\n\t\tr1 = CLAMP(ip[0]); wp[0] = (r1-r2) & mask; r2 = r1;\n\t\tg1 = CLAMP(ip[1]); wp[1] = (g1-g2) & mask; g2 = g1;\n\t\tb1 = CLAMP(ip[2]); wp[2] = (b1-b2) & mask; b2 = b1;\n\t    }\n\t} else if (stride == 4) {\n\t    r2 = wp[0] = CLAMP(ip[0]);  g2 = wp[1] = CLAMP(ip[1]);\n\t    b2 = wp[2] = CLAMP(ip[2]);  a2 = wp[3] = CLAMP(ip[3]);\n\t    n -= 4;\n\t    while (n > 0) {\n\t\tn -= 4;\n\t\twp += 4;\n\t\tip += 4;\n\t\tr1 = CLAMP(ip[0]); wp[0] = (r1-r2) & mask; r2 = r1;\n\t\tg1 = CLAMP(ip[1]); wp[1] = (g1-g2) & mask; g2 = g1;\n\t\tb1 = CLAMP(ip[2]); wp[2] = (b1-b2) & mask; b2 = b1;\n\t\ta1 = CLAMP(ip[3]); wp[3] = (a1-a2) & mask; a2 = a1;\n\t    }\n\t} else {\n\t    ip += n - 1;\t/* point to last one */\n\t    wp += n - 1;\t/* point to last one */\n\t    n -= stride;\n\t    while (n > 0) {\n\t\tREPEAT(stride, wp[0] = CLAMP(ip[0]);\n\t\t\t\twp[stride] -= wp[0];\n\t\t\t\twp[stride] &= mask;\n\t\t\t\twp--; ip--)\n\t\tn -= stride;\n\t    }\n\t    REPEAT(stride, wp[0] = CLAMP(ip[0]); wp--; ip--)\n\t}\n    }\n}\n\n\nstatic void\nhorizontalDifference8(unsigned char *ip, int n, int stride, \n\tunsigned short *wp, uint16 *From8)\n{\n    register int  r1, g1, b1, a1, r2, g2, b2, a2, mask;\n\n#undef\t CLAMP\n#define  CLAMP(v) (From8[(v)])\n\n    mask = CODE_MASK;\n    if (n >= stride) {\n\tif (stride == 3) {\n\t    r2 = wp[0] = CLAMP(ip[0]);  g2 = wp[1] = CLAMP(ip[1]);\n\t    b2 = wp[2] = CLAMP(ip[2]);\n\t    n -= 3;\n\t    while (n > 0) {\n\t\tn -= 3;\n\t\tr1 = CLAMP(ip[3]); wp[3] = (r1-r2) & mask; r2 = r1;\n\t\tg1 = CLAMP(ip[4]); wp[4] = (g1-g2) & mask; g2 = g1;\n\t\tb1 = CLAMP(ip[5]); wp[5] = (b1-b2) & mask; b2 = b1;\n\t\twp += 3;\n\t\tip += 3;\n\t    }\n\t} else if (stride == 4) {\n\t    r2 = wp[0] = CLAMP(ip[0]);  g2 = wp[1] = CLAMP(ip[1]);\n\t    b2 = wp[2] = CLAMP(ip[2]);  a2 = wp[3] = CLAMP(ip[3]);\n\t    n -= 4;\n\t    while (n > 0) {\n\t\tn -= 4;\n\t\tr1 = CLAMP(ip[4]); wp[4] = (r1-r2) & mask; r2 = r1;\n\t\tg1 = CLAMP(ip[5]); wp[5] = (g1-g2) & mask; g2 = g1;\n\t\tb1 = CLAMP(ip[6]); wp[6] = (b1-b2) & mask; b2 = b1;\n\t\ta1 = CLAMP(ip[7]); wp[7] = (a1-a2) & mask; a2 = a1;\n\t\twp += 4;\n\t\tip += 4;\n\t    }\n\t} else {\n\t    wp += n + stride - 1;\t/* point to last one */\n\t    ip += n + stride - 1;\t/* point to last one */\n\t    n -= stride;\n\t    while (n > 0) {\n\t\tREPEAT(stride, wp[0] = CLAMP(ip[0]);\n\t\t\t\twp[stride] -= wp[0];\n\t\t\t\twp[stride] &= mask;\n\t\t\t\twp--; ip--)\n\t\tn -= stride;\n\t    }\n\t    REPEAT(stride, wp[0] = CLAMP(ip[0]); wp--; ip--)\n\t}\n    }\n}\n\n/*\n * Encode a chunk of pixels.\n */\nstatic int\nPixarLogEncode(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)\n{\n\tTIFFDirectory *td = &tif->tif_dir;\n\tPixarLogState *sp = EncoderState(tif);\n\tstatic const char module[] = \"PixarLogEncode\";\n\tint\ti, n, llen;\n\tunsigned short * up;\n\n\t(void) s;\n\n\tswitch (sp->user_datafmt) {\n\tcase PIXARLOGDATAFMT_FLOAT:\n\t\tn = cc / sizeof(float);\t\t/* XXX float == 32 bits */\n\t\tbreak;\n\tcase PIXARLOGDATAFMT_16BIT:\n\tcase PIXARLOGDATAFMT_12BITPICIO:\n\tcase PIXARLOGDATAFMT_11BITLOG:\n\t\tn = cc / sizeof(uint16);\t/* XXX uint16 == 16 bits */\n\t\tbreak;\n\tcase PIXARLOGDATAFMT_8BIT:\n\tcase PIXARLOGDATAFMT_8BITABGR:\n\t\tn = cc;\n\t\tbreak;\n\tdefault:\n\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t\t\"%d bit input not supported in PixarLog\",\n\t\t\ttd->td_bitspersample);\n\t\treturn 0;\n\t}\n\n\tllen = sp->stride * td->td_imagewidth;\n\n\tfor (i = 0, up = sp->tbuf; i < n; i += llen, up += llen) {\n\t\tswitch (sp->user_datafmt)  {\n\t\tcase PIXARLOGDATAFMT_FLOAT:\n\t\t\thorizontalDifferenceF((float *)bp, llen, \n\t\t\t\tsp->stride, up, sp->FromLT2);\n\t\t\tbp += llen * sizeof(float);\n\t\t\tbreak;\n\t\tcase PIXARLOGDATAFMT_16BIT:\n\t\t\thorizontalDifference16((uint16 *)bp, llen, \n\t\t\t\tsp->stride, up, sp->From14);\n\t\t\tbp += llen * sizeof(uint16);\n\t\t\tbreak;\n\t\tcase PIXARLOGDATAFMT_8BIT:\n\t\t\thorizontalDifference8((unsigned char *)bp, llen, \n\t\t\t\tsp->stride, up, sp->From8);\n\t\t\tbp += llen * sizeof(unsigned char);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t\t\t\"%d bit input not supported in PixarLog\",\n\t\t\t\ttd->td_bitspersample);\n\t\t\treturn 0;\n\t\t}\n\t}\n \n\tsp->stream.next_in = (unsigned char *) sp->tbuf;\n\tsp->stream.avail_in = n * sizeof(uint16);\n\n\tdo {\n\t\tif (deflate(&sp->stream, Z_NO_FLUSH) != Z_OK) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, module, \"%s: Encoder error: %s\",\n\t\t\t    tif->tif_name, sp->stream.msg);\n\t\t\treturn (0);\n\t\t}\n\t\tif (sp->stream.avail_out == 0) {\n\t\t\ttif->tif_rawcc = tif->tif_rawdatasize;\n\t\t\tTIFFFlushData1(tif);\n\t\t\tsp->stream.next_out = tif->tif_rawdata;\n\t\t\tsp->stream.avail_out = tif->tif_rawdatasize;\n\t\t}\n\t} while (sp->stream.avail_in > 0);\n\treturn (1);\n}\n\n/*\n * Finish off an encoded strip by flushing the last\n * string and tacking on an End Of Information code.\n */\n\nstatic int\nPixarLogPostEncode(TIFF* tif)\n{\n\tPixarLogState *sp = EncoderState(tif);\n\tstatic const char module[] = \"PixarLogPostEncode\";\n\tint state;\n\n\tsp->stream.avail_in = 0;\n\n\tdo {\n\t\tstate = deflate(&sp->stream, Z_FINISH);\n\t\tswitch (state) {\n\t\tcase Z_STREAM_END:\n\t\tcase Z_OK:\n\t\t    if (sp->stream.avail_out != (uint32)tif->tif_rawdatasize) {\n\t\t\t    tif->tif_rawcc =\n\t\t\t\ttif->tif_rawdatasize - sp->stream.avail_out;\n\t\t\t    TIFFFlushData1(tif);\n\t\t\t    sp->stream.next_out = tif->tif_rawdata;\n\t\t\t    sp->stream.avail_out = tif->tif_rawdatasize;\n\t\t    }\n\t\t    break;\n\t\tdefault:\n\t\t\tTIFFErrorExt(tif->tif_clientdata, module, \"%s: zlib error: %s\",\n\t\t\ttif->tif_name, sp->stream.msg);\n\t\t    return (0);\n\t\t}\n\t} while (state != Z_STREAM_END);\n\treturn (1);\n}\n\nstatic void\nPixarLogClose(TIFF* tif)\n{\n\tTIFFDirectory *td = &tif->tif_dir;\n\n\t/* In a really sneaky maneuver, on close, we covertly modify both\n\t * bitspersample and sampleformat in the directory to indicate\n\t * 8-bit linear.  This way, the decode \"just works\" even for\n\t * readers that don't know about PixarLog, or how to set\n\t * the PIXARLOGDATFMT pseudo-tag.\n\t */\n\ttd->td_bitspersample = 8;\n\ttd->td_sampleformat = SAMPLEFORMAT_UINT;\n}\n\nstatic void\nPixarLogCleanup(TIFF* tif)\n{\n\tPixarLogState* sp = (PixarLogState*) tif->tif_data;\n\n\tassert(sp != 0);\n\n\t(void)TIFFPredictorCleanup(tif);\n\n\ttif->tif_tagmethods.vgetfield = sp->vgetparent;\n\ttif->tif_tagmethods.vsetfield = sp->vsetparent;\n\n\tif (sp->FromLT2) _TIFFfree(sp->FromLT2);\n\tif (sp->From14) _TIFFfree(sp->From14);\n\tif (sp->From8) _TIFFfree(sp->From8);\n\tif (sp->ToLinearF) _TIFFfree(sp->ToLinearF);\n\tif (sp->ToLinear16) _TIFFfree(sp->ToLinear16);\n\tif (sp->ToLinear8) _TIFFfree(sp->ToLinear8);\n\tif (sp->state&PLSTATE_INIT) {\n\t\tif (tif->tif_mode == O_RDONLY)\n\t\t\tinflateEnd(&sp->stream);\n\t\telse\n\t\t\tdeflateEnd(&sp->stream);\n\t}\n\tif (sp->tbuf)\n\t\t_TIFFfree(sp->tbuf);\n\t_TIFFfree(sp);\n\ttif->tif_data = NULL;\n\n\t_TIFFSetDefaultCompressionState(tif);\n}\n\nstatic int\nPixarLogVSetField(TIFF* tif, ttag_t tag, va_list ap)\n{\n    PixarLogState *sp = (PixarLogState *)tif->tif_data;\n    int result;\n    static const char module[] = \"PixarLogVSetField\";\n\n    switch (tag) {\n     case TIFFTAG_PIXARLOGQUALITY:\n\t\tsp->quality = va_arg(ap, int);\n\t\tif (tif->tif_mode != O_RDONLY && (sp->state&PLSTATE_INIT)) {\n\t\t\tif (deflateParams(&sp->stream,\n\t\t\t    sp->quality, Z_DEFAULT_STRATEGY) != Z_OK) {\n\t\t\t\tTIFFErrorExt(tif->tif_clientdata, module, \"%s: zlib error: %s\",\n\t\t\t\t\ttif->tif_name, sp->stream.msg);\n\t\t\t\treturn (0);\n\t\t\t}\n\t\t}\n\t\treturn (1);\n     case TIFFTAG_PIXARLOGDATAFMT:\n\tsp->user_datafmt = va_arg(ap, int);\n\t/* Tweak the TIFF header so that the rest of libtiff knows what\n\t * size of data will be passed between app and library, and\n\t * assume that the app knows what it is doing and is not\n\t * confused by these header manipulations...\n\t */\n\tswitch (sp->user_datafmt) {\n\t case PIXARLOGDATAFMT_8BIT:\n\t case PIXARLOGDATAFMT_8BITABGR:\n\t    TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 8);\n\t    TIFFSetField(tif, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_UINT);\n\t    break;\n\t case PIXARLOGDATAFMT_11BITLOG:\n\t    TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 16);\n\t    TIFFSetField(tif, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_UINT);\n\t    break;\n\t case PIXARLOGDATAFMT_12BITPICIO:\n\t    TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 16);\n\t    TIFFSetField(tif, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_INT);\n\t    break;\n\t case PIXARLOGDATAFMT_16BIT:\n\t    TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 16);\n\t    TIFFSetField(tif, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_UINT);\n\t    break;\n\t case PIXARLOGDATAFMT_FLOAT:\n\t    TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 32);\n\t    TIFFSetField(tif, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_IEEEFP);\n\t    break;\n\t}\n\t/*\n\t * Must recalculate sizes should bits/sample change.\n\t */\n\ttif->tif_tilesize = isTiled(tif) ? TIFFTileSize(tif) : (tsize_t) -1;\n\ttif->tif_scanlinesize = TIFFScanlineSize(tif);\n\tresult = 1;\t\t/* NB: pseudo tag */\n\tbreak;\n     default:\n\tresult = (*sp->vsetparent)(tif, tag, ap);\n    }\n    return (result);\n}\n\nstatic int\nPixarLogVGetField(TIFF* tif, ttag_t tag, va_list ap)\n{\n    PixarLogState *sp = (PixarLogState *)tif->tif_data;\n\n    switch (tag) {\n     case TIFFTAG_PIXARLOGQUALITY:\n\t*va_arg(ap, int*) = sp->quality;\n\tbreak;\n     case TIFFTAG_PIXARLOGDATAFMT:\n\t*va_arg(ap, int*) = sp->user_datafmt;\n\tbreak;\n     default:\n\treturn (*sp->vgetparent)(tif, tag, ap);\n    }\n    return (1);\n}\n\nstatic const TIFFFieldInfo pixarlogFieldInfo[] = {\n    {TIFFTAG_PIXARLOGDATAFMT,0,0,TIFF_ANY,  FIELD_PSEUDO,FALSE,FALSE,\"\"},\n    {TIFFTAG_PIXARLOGQUALITY,0,0,TIFF_ANY,  FIELD_PSEUDO,FALSE,FALSE,\"\"}\n};\n\nint\nTIFFInitPixarLog(TIFF* tif, int scheme)\n{\n\tstatic const char module[] = \"TIFFInitPixarLog\";\n\n\tPixarLogState* sp;\n\n\tassert(scheme == COMPRESSION_PIXARLOG);\n\n\t/*\n\t * Merge codec-specific tag information.\n\t */\n\tif (!_TIFFMergeFieldInfo(tif, pixarlogFieldInfo,\n\t\t\t\t TIFFArrayCount(pixarlogFieldInfo))) {\n\t\tTIFFErrorExt(tif->tif_clientdata, module,\n\t\t\t     \"Merging PixarLog codec-specific tags failed\");\n\t\treturn 0;\n\t}\n\n\t/*\n\t * Allocate state block so tag methods have storage to record values.\n\t */\n\ttif->tif_data = (tidata_t) _TIFFmalloc(sizeof (PixarLogState));\n\tif (tif->tif_data == NULL)\n\t\tgoto bad;\n\tsp = (PixarLogState*) tif->tif_data;\n\t_TIFFmemset(sp, 0, sizeof (*sp));\n\tsp->stream.data_type = Z_BINARY;\n\tsp->user_datafmt = PIXARLOGDATAFMT_UNKNOWN;\n\n\t/*\n\t * Install codec methods.\n\t */\n\ttif->tif_setupdecode = PixarLogSetupDecode;\n\ttif->tif_predecode = PixarLogPreDecode;\n\ttif->tif_decoderow = PixarLogDecode;\n\ttif->tif_decodestrip = PixarLogDecode;\n\ttif->tif_decodetile = PixarLogDecode;\n\ttif->tif_setupencode = PixarLogSetupEncode;\n\ttif->tif_preencode = PixarLogPreEncode;\n\ttif->tif_postencode = PixarLogPostEncode;\n\ttif->tif_encoderow = PixarLogEncode;\n\ttif->tif_encodestrip = PixarLogEncode;\n\ttif->tif_encodetile = PixarLogEncode;\n\ttif->tif_close = PixarLogClose;\n\ttif->tif_cleanup = PixarLogCleanup;\n\n\t/* Override SetField so we can handle our private pseudo-tag */\n\tsp->vgetparent = tif->tif_tagmethods.vgetfield;\n\ttif->tif_tagmethods.vgetfield = PixarLogVGetField;   /* hook for codec tags */\n\tsp->vsetparent = tif->tif_tagmethods.vsetfield;\n\ttif->tif_tagmethods.vsetfield = PixarLogVSetField;   /* hook for codec tags */\n\n\t/* Default values for codec-specific fields */\n\tsp->quality = Z_DEFAULT_COMPRESSION; /* default comp. level */\n\tsp->state = 0;\n\n\t/* we don't wish to use the predictor, \n\t * the default is none, which predictor value 1\n\t */\n\t(void) TIFFPredictorInit(tif);\n\n\t/*\n\t * build the companding tables \n\t */\n\tPixarLogMakeTables(sp);\n\n\treturn (1);\nbad:\n\tTIFFErrorExt(tif->tif_clientdata, module,\n\t\t     \"No space for PixarLog state block\");\n\treturn (0);\n}\n#endif /* PIXARLOG_SUPPORT */\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/tif_predict.c",
    "content": "/* $Id: tif_predict.c,v 1.11.2.3 2009-01-23 15:57:18 fwarmerdam Exp $ */\n\n/*\n * Copyright (c) 1988-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n/*\n * TIFF Library.\n *\n * Predictor Tag Support (used by multiple codecs).\n */\n#include \"tiffiop.h\"\n#include \"tif_predict.h\"\n\n#define\tPredictorState(tif)\t((TIFFPredictorState*) (tif)->tif_data)\n\nstatic\tvoid horAcc8(TIFF*, tidata_t, tsize_t);\nstatic\tvoid horAcc16(TIFF*, tidata_t, tsize_t);\nstatic\tvoid horAcc32(TIFF*, tidata_t, tsize_t);\nstatic\tvoid swabHorAcc16(TIFF*, tidata_t, tsize_t);\nstatic\tvoid swabHorAcc32(TIFF*, tidata_t, tsize_t);\nstatic\tvoid horDiff8(TIFF*, tidata_t, tsize_t);\nstatic\tvoid horDiff16(TIFF*, tidata_t, tsize_t);\nstatic\tvoid horDiff32(TIFF*, tidata_t, tsize_t);\nstatic\tvoid fpAcc(TIFF*, tidata_t, tsize_t);\nstatic\tvoid fpDiff(TIFF*, tidata_t, tsize_t);\nstatic\tint PredictorDecodeRow(TIFF*, tidata_t, tsize_t, tsample_t);\nstatic\tint PredictorDecodeTile(TIFF*, tidata_t, tsize_t, tsample_t);\nstatic\tint PredictorEncodeRow(TIFF*, tidata_t, tsize_t, tsample_t);\nstatic\tint PredictorEncodeTile(TIFF*, tidata_t, tsize_t, tsample_t);\n\nstatic int\nPredictorSetup(TIFF* tif)\n{\n\tstatic const char module[] = \"PredictorSetup\";\n\n\tTIFFPredictorState* sp = PredictorState(tif);\n\tTIFFDirectory* td = &tif->tif_dir;\n\n\tswitch (sp->predictor)\t\t/* no differencing */\n\t{\n\t\tcase PREDICTOR_NONE:\n\t\t\treturn 1;\n\t\tcase PREDICTOR_HORIZONTAL:\n\t\t\tif (td->td_bitspersample != 8\n\t\t\t    && td->td_bitspersample != 16\n\t\t\t    && td->td_bitspersample != 32) {\n\t\t\t\tTIFFErrorExt(tif->tif_clientdata, module,\n    \"Horizontal differencing \\\"Predictor\\\" not supported with %d-bit samples\",\n\t\t\t\t\t  td->td_bitspersample);\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase PREDICTOR_FLOATINGPOINT:\n\t\t\tif (td->td_sampleformat != SAMPLEFORMAT_IEEEFP) {\n\t\t\t\tTIFFErrorExt(tif->tif_clientdata, module,\n\t\"Floating point \\\"Predictor\\\" not supported with %d data format\",\n\t\t\t\t\t  td->td_sampleformat);\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tTIFFErrorExt(tif->tif_clientdata, module,\n\t\t\t\t  \"\\\"Predictor\\\" value %d not supported\",\n\t\t\t\t  sp->predictor);\n\t\t\treturn 0;\n\t}\n\tsp->stride = (td->td_planarconfig == PLANARCONFIG_CONTIG ?\n\t    td->td_samplesperpixel : 1);\n\t/*\n\t * Calculate the scanline/tile-width size in bytes.\n\t */\n\tif (isTiled(tif))\n\t\tsp->rowsize = TIFFTileRowSize(tif);\n\telse\n\t\tsp->rowsize = TIFFScanlineSize(tif);\n\n\treturn 1;\n}\n\nstatic int\nPredictorSetupDecode(TIFF* tif)\n{\n\tTIFFPredictorState* sp = PredictorState(tif);\n\tTIFFDirectory* td = &tif->tif_dir;\n\n\tif (!(*sp->setupdecode)(tif) || !PredictorSetup(tif))\n\t\treturn 0;\n\n\tif (sp->predictor == 2) {\n\t\tswitch (td->td_bitspersample) {\n\t\t\tcase 8:  sp->decodepfunc = horAcc8; break;\n\t\t\tcase 16: sp->decodepfunc = horAcc16; break;\n\t\t\tcase 32: sp->decodepfunc = horAcc32; break;\n\t\t}\n\t\t/*\n\t\t * Override default decoding method with one that does the\n\t\t * predictor stuff.\n\t\t */\n                if( tif->tif_decoderow != PredictorDecodeRow )\n                {\n                    sp->decoderow = tif->tif_decoderow;\n                    tif->tif_decoderow = PredictorDecodeRow;\n                    sp->decodestrip = tif->tif_decodestrip;\n                    tif->tif_decodestrip = PredictorDecodeTile;\n                    sp->decodetile = tif->tif_decodetile;\n                    tif->tif_decodetile = PredictorDecodeTile;\n                }\n\t\t/*\n\t\t * If the data is horizontally differenced 16-bit data that\n\t\t * requires byte-swapping, then it must be byte swapped before\n\t\t * the accumulation step.  We do this with a special-purpose\n\t\t * routine and override the normal post decoding logic that\n\t\t * the library setup when the directory was read.\n\t\t */\n\t\tif (tif->tif_flags & TIFF_SWAB) {\n\t\t\tif (sp->decodepfunc == horAcc16) {\n\t\t\t\tsp->decodepfunc = swabHorAcc16;\n\t\t\t\ttif->tif_postdecode = _TIFFNoPostDecode;\n\t\t\t} else if (sp->decodepfunc == horAcc32) {\n\t\t\t\tsp->decodepfunc = swabHorAcc32;\n\t\t\t\ttif->tif_postdecode = _TIFFNoPostDecode;\n\t\t\t}\n\t\t}\n\t}\n\n\telse if (sp->predictor == 3) {\n\t\tsp->decodepfunc = fpAcc;\n\t\t/*\n\t\t * Override default decoding method with one that does the\n\t\t * predictor stuff.\n\t\t */\n                if( tif->tif_decoderow != PredictorDecodeRow )\n                {\n                    sp->decoderow = tif->tif_decoderow;\n                    tif->tif_decoderow = PredictorDecodeRow;\n                    sp->decodestrip = tif->tif_decodestrip;\n                    tif->tif_decodestrip = PredictorDecodeTile;\n                    sp->decodetile = tif->tif_decodetile;\n                    tif->tif_decodetile = PredictorDecodeTile;\n                }\n\t\t/*\n\t\t * The data should not be swapped outside of the floating\n\t\t * point predictor, the accumulation routine should return\n\t\t * byres in the native order.\n\t\t */\n\t\tif (tif->tif_flags & TIFF_SWAB) {\n\t\t\ttif->tif_postdecode = _TIFFNoPostDecode;\n\t\t}\n\t\t/*\n\t\t * Allocate buffer to keep the decoded bytes before\n\t\t * rearranging in the ight order\n\t\t */\n\t}\n\n\treturn 1;\n}\n\nstatic int\nPredictorSetupEncode(TIFF* tif)\n{\n\tTIFFPredictorState* sp = PredictorState(tif);\n\tTIFFDirectory* td = &tif->tif_dir;\n\n\tif (!(*sp->setupencode)(tif) || !PredictorSetup(tif))\n\t\treturn 0;\n\n\tif (sp->predictor == 2) {\n\t\tswitch (td->td_bitspersample) {\n\t\t\tcase 8:  sp->encodepfunc = horDiff8; break;\n\t\t\tcase 16: sp->encodepfunc = horDiff16; break;\n\t\t\tcase 32: sp->encodepfunc = horDiff32; break;\n\t\t}\n\t\t/*\n\t\t * Override default encoding method with one that does the\n\t\t * predictor stuff.\n\t\t */\n                if( tif->tif_encoderow != PredictorEncodeRow )\n                {\n                    sp->encoderow = tif->tif_encoderow;\n                    tif->tif_encoderow = PredictorEncodeRow;\n                    sp->encodestrip = tif->tif_encodestrip;\n                    tif->tif_encodestrip = PredictorEncodeTile;\n                    sp->encodetile = tif->tif_encodetile;\n                    tif->tif_encodetile = PredictorEncodeTile;\n                }\n\t}\n\t\n\telse if (sp->predictor == 3) {\n\t\tsp->encodepfunc = fpDiff;\n\t\t/*\n\t\t * Override default encoding method with one that does the\n\t\t * predictor stuff.\n\t\t */\n                if( tif->tif_encoderow != PredictorEncodeRow )\n                {\n                    sp->encoderow = tif->tif_encoderow;\n                    tif->tif_encoderow = PredictorEncodeRow;\n                    sp->encodestrip = tif->tif_encodestrip;\n                    tif->tif_encodestrip = PredictorEncodeTile;\n                    sp->encodetile = tif->tif_encodetile;\n                    tif->tif_encodetile = PredictorEncodeTile;\n                }\n\t}\n\n\treturn 1;\n}\n\n#define REPEAT4(n, op)\t\t\\\n    switch (n) {\t\t\\\n    default: { int i; for (i = n-4; i > 0; i--) { op; } } \\\n    case 4:  op;\t\t\\\n    case 3:  op;\t\t\\\n    case 2:  op;\t\t\\\n    case 1:  op;\t\t\\\n    case 0:  ;\t\t\t\\\n    }\n\nstatic void\nhorAcc8(TIFF* tif, tidata_t cp0, tsize_t cc)\n{\n\ttsize_t stride = PredictorState(tif)->stride;\n\n\tchar* cp = (char*) cp0;\n\tif (cc > stride) {\n\t\tcc -= stride;\n\t\t/*\n\t\t * Pipeline the most common cases.\n\t\t */\n\t\tif (stride == 3)  {\n\t\t\tunsigned int cr = cp[0];\n\t\t\tunsigned int cg = cp[1];\n\t\t\tunsigned int cb = cp[2];\n\t\t\tdo {\n\t\t\t\tcc -= 3, cp += 3;\n\t\t\t\tcp[0] = (char) (cr += cp[0]);\n\t\t\t\tcp[1] = (char) (cg += cp[1]);\n\t\t\t\tcp[2] = (char) (cb += cp[2]);\n\t\t\t} while ((int32) cc > 0);\n\t\t} else if (stride == 4)  {\n\t\t\tunsigned int cr = cp[0];\n\t\t\tunsigned int cg = cp[1];\n\t\t\tunsigned int cb = cp[2];\n\t\t\tunsigned int ca = cp[3];\n\t\t\tdo {\n\t\t\t\tcc -= 4, cp += 4;\n\t\t\t\tcp[0] = (char) (cr += cp[0]);\n\t\t\t\tcp[1] = (char) (cg += cp[1]);\n\t\t\t\tcp[2] = (char) (cb += cp[2]);\n\t\t\t\tcp[3] = (char) (ca += cp[3]);\n\t\t\t} while ((int32) cc > 0);\n\t\t} else  {\n\t\t\tdo {\n\t\t\t\tREPEAT4(stride, cp[stride] =\n\t\t\t\t\t(char) (cp[stride] + *cp); cp++)\n\t\t\t\tcc -= stride;\n\t\t\t} while ((int32) cc > 0);\n\t\t}\n\t}\n}\n\nstatic void\nswabHorAcc16(TIFF* tif, tidata_t cp0, tsize_t cc)\n{\n\ttsize_t stride = PredictorState(tif)->stride;\n\tuint16* wp = (uint16*) cp0;\n\ttsize_t wc = cc / 2;\n\n\tif (wc > stride) {\n\t\tTIFFSwabArrayOfShort(wp, wc);\n\t\twc -= stride;\n\t\tdo {\n\t\t\tREPEAT4(stride, wp[stride] += wp[0]; wp++)\n\t\t\twc -= stride;\n\t\t} while ((int32) wc > 0);\n\t}\n}\n\nstatic void\nhorAcc16(TIFF* tif, tidata_t cp0, tsize_t cc)\n{\n\ttsize_t stride = PredictorState(tif)->stride;\n\tuint16* wp = (uint16*) cp0;\n\ttsize_t wc = cc / 2;\n\n\tif (wc > stride) {\n\t\twc -= stride;\n\t\tdo {\n\t\t\tREPEAT4(stride, wp[stride] += wp[0]; wp++)\n\t\t\twc -= stride;\n\t\t} while ((int32) wc > 0);\n\t}\n}\n\nstatic void\nswabHorAcc32(TIFF* tif, tidata_t cp0, tsize_t cc)\n{\n\ttsize_t stride = PredictorState(tif)->stride;\n\tuint32* wp = (uint32*) cp0;\n\ttsize_t wc = cc / 4;\n\n\tif (wc > stride) {\n\t\tTIFFSwabArrayOfLong(wp, wc);\n\t\twc -= stride;\n\t\tdo {\n\t\t\tREPEAT4(stride, wp[stride] += wp[0]; wp++)\n\t\t\twc -= stride;\n\t\t} while ((int32) wc > 0);\n\t}\n}\n\nstatic void\nhorAcc32(TIFF* tif, tidata_t cp0, tsize_t cc)\n{\n\ttsize_t stride = PredictorState(tif)->stride;\n\tuint32* wp = (uint32*) cp0;\n\ttsize_t wc = cc / 4;\n\n\tif (wc > stride) {\n\t\twc -= stride;\n\t\tdo {\n\t\t\tREPEAT4(stride, wp[stride] += wp[0]; wp++)\n\t\t\twc -= stride;\n\t\t} while ((int32) wc > 0);\n\t}\n}\n\n/*\n * Floating point predictor accumulation routine.\n */\nstatic void\nfpAcc(TIFF* tif, tidata_t cp0, tsize_t cc)\n{\n\ttsize_t stride = PredictorState(tif)->stride;\n\tuint32 bps = tif->tif_dir.td_bitspersample / 8;\n\ttsize_t wc = cc / bps;\n\ttsize_t count = cc;\n\tuint8 *cp = (uint8 *) cp0;\n\tuint8 *tmp = (uint8 *)_TIFFmalloc(cc);\n\n\tif (!tmp)\n\t\treturn;\n\n\twhile (count > stride) {\n\t\tREPEAT4(stride, cp[stride] += cp[0]; cp++)\n\t\tcount -= stride;\n\t}\n\n\t_TIFFmemcpy(tmp, cp0, cc);\n\tcp = (uint8 *) cp0;\n\tfor (count = 0; count < wc; count++) {\n\t\tuint32 byte;\n\t\tfor (byte = 0; byte < bps; byte++) {\n#if WORDS_BIGENDIAN\n\t\t\tcp[bps * count + byte] = tmp[byte * wc + count];\n#else\n\t\t\tcp[bps * count + byte] =\n\t\t\t\ttmp[(bps - byte - 1) * wc + count];\n#endif\n\t\t}\n\t}\n\t_TIFFfree(tmp);\n}\n\n/*\n * Decode a scanline and apply the predictor routine.\n */\nstatic int\nPredictorDecodeRow(TIFF* tif, tidata_t op0, tsize_t occ0, tsample_t s)\n{\n\tTIFFPredictorState *sp = PredictorState(tif);\n\n\tassert(sp != NULL);\n\tassert(sp->decoderow != NULL);\n\tassert(sp->decodepfunc != NULL);\n\n\tif ((*sp->decoderow)(tif, op0, occ0, s)) {\n\t\t(*sp->decodepfunc)(tif, op0, occ0);\n\t\treturn 1;\n\t} else\n\t\treturn 0;\n}\n\n/*\n * Decode a tile/strip and apply the predictor routine.\n * Note that horizontal differencing must be done on a\n * row-by-row basis.  The width of a \"row\" has already\n * been calculated at pre-decode time according to the\n * strip/tile dimensions.\n */\nstatic int\nPredictorDecodeTile(TIFF* tif, tidata_t op0, tsize_t occ0, tsample_t s)\n{\n\tTIFFPredictorState *sp = PredictorState(tif);\n\n\tassert(sp != NULL);\n\tassert(sp->decodetile != NULL);\n\n\tif ((*sp->decodetile)(tif, op0, occ0, s)) {\n\t\ttsize_t rowsize = sp->rowsize;\n\t\tassert(rowsize > 0);\n\t\tassert(sp->decodepfunc != NULL);\n\t\twhile ((long)occ0 > 0) {\n\t\t\t(*sp->decodepfunc)(tif, op0, (tsize_t) rowsize);\n\t\t\tocc0 -= rowsize;\n\t\t\top0 += rowsize;\n\t\t}\n\t\treturn 1;\n\t} else\n\t\treturn 0;\n}\n\nstatic void\nhorDiff8(TIFF* tif, tidata_t cp0, tsize_t cc)\n{\n\tTIFFPredictorState* sp = PredictorState(tif);\n\ttsize_t stride = sp->stride;\n\tchar* cp = (char*) cp0;\n\n\tif (cc > stride) {\n\t\tcc -= stride;\n\t\t/*\n\t\t * Pipeline the most common cases.\n\t\t */\n\t\tif (stride == 3) {\n\t\t\tint r1, g1, b1;\n\t\t\tint r2 = cp[0];\n\t\t\tint g2 = cp[1];\n\t\t\tint b2 = cp[2];\n\t\t\tdo {\n\t\t\t\tr1 = cp[3]; cp[3] = r1-r2; r2 = r1;\n\t\t\t\tg1 = cp[4]; cp[4] = g1-g2; g2 = g1;\n\t\t\t\tb1 = cp[5]; cp[5] = b1-b2; b2 = b1;\n\t\t\t\tcp += 3;\n\t\t\t} while ((int32)(cc -= 3) > 0);\n\t\t} else if (stride == 4) {\n\t\t\tint r1, g1, b1, a1;\n\t\t\tint r2 = cp[0];\n\t\t\tint g2 = cp[1];\n\t\t\tint b2 = cp[2];\n\t\t\tint a2 = cp[3];\n\t\t\tdo {\n\t\t\t\tr1 = cp[4]; cp[4] = r1-r2; r2 = r1;\n\t\t\t\tg1 = cp[5]; cp[5] = g1-g2; g2 = g1;\n\t\t\t\tb1 = cp[6]; cp[6] = b1-b2; b2 = b1;\n\t\t\t\ta1 = cp[7]; cp[7] = a1-a2; a2 = a1;\n\t\t\t\tcp += 4;\n\t\t\t} while ((int32)(cc -= 4) > 0);\n\t\t} else {\n\t\t\tcp += cc - 1;\n\t\t\tdo {\n\t\t\t\tREPEAT4(stride, cp[stride] -= cp[0]; cp--)\n\t\t\t} while ((int32)(cc -= stride) > 0);\n\t\t}\n\t}\n}\n\nstatic void\nhorDiff16(TIFF* tif, tidata_t cp0, tsize_t cc)\n{\n\tTIFFPredictorState* sp = PredictorState(tif);\n\ttsize_t stride = sp->stride;\n\tint16 *wp = (int16*) cp0;\n\ttsize_t wc = cc/2;\n\n\tif (wc > stride) {\n\t\twc -= stride;\n\t\twp += wc - 1;\n\t\tdo {\n\t\t\tREPEAT4(stride, wp[stride] -= wp[0]; wp--)\n\t\t\twc -= stride;\n\t\t} while ((int32) wc > 0);\n\t}\n}\n\nstatic void\nhorDiff32(TIFF* tif, tidata_t cp0, tsize_t cc)\n{\n\tTIFFPredictorState* sp = PredictorState(tif);\n\ttsize_t stride = sp->stride;\n\tint32 *wp = (int32*) cp0;\n\ttsize_t wc = cc/4;\n\n\tif (wc > stride) {\n\t\twc -= stride;\n\t\twp += wc - 1;\n\t\tdo {\n\t\t\tREPEAT4(stride, wp[stride] -= wp[0]; wp--)\n\t\t\twc -= stride;\n\t\t} while ((int32) wc > 0);\n\t}\n}\n\n/*\n * Floating point predictor differencing routine.\n */\nstatic void\nfpDiff(TIFF* tif, tidata_t cp0, tsize_t cc)\n{\n\ttsize_t stride = PredictorState(tif)->stride;\n\tuint32 bps = tif->tif_dir.td_bitspersample / 8;\n\ttsize_t wc = cc / bps;\n\ttsize_t count;\n\tuint8 *cp = (uint8 *) cp0;\n\tuint8 *tmp = (uint8 *)_TIFFmalloc(cc);\n\n\tif (!tmp)\n\t\treturn;\n\n\t_TIFFmemcpy(tmp, cp0, cc);\n\tfor (count = 0; count < wc; count++) {\n\t\tuint32 byte;\n\t\tfor (byte = 0; byte < bps; byte++) {\n#if WORDS_BIGENDIAN\n\t\t\tcp[byte * wc + count] =\ttmp[bps * count + byte];\n#else\n\t\t\tcp[(bps - byte - 1) * wc + count] =\n\t\t\t\ttmp[bps * count + byte];\n#endif\n\t\t}\n\t}\n\t_TIFFfree(tmp);\n\n\tcp = (uint8 *) cp0;\n\tcp += cc - stride - 1;\n\tfor (count = cc; count > stride; count -= stride)\n\t\tREPEAT4(stride, cp[stride] -= cp[0]; cp--)\n}\n\nstatic int\nPredictorEncodeRow(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)\n{\n\tTIFFPredictorState *sp = PredictorState(tif);\n\n\tassert(sp != NULL);\n\tassert(sp->encodepfunc != NULL);\n\tassert(sp->encoderow != NULL);\n\n\t/* XXX horizontal differencing alters user's data XXX */\n\t(*sp->encodepfunc)(tif, bp, cc);\n\treturn (*sp->encoderow)(tif, bp, cc, s);\n}\n\nstatic int\nPredictorEncodeTile(TIFF* tif, tidata_t bp0, tsize_t cc0, tsample_t s)\n{\n\tstatic const char module[] = \"PredictorEncodeTile\";\n\tTIFFPredictorState *sp = PredictorState(tif);\n        uint8 *working_copy;\n\ttsize_t cc = cc0, rowsize;\n\tunsigned char* bp;\n        int result_code;\n\n\tassert(sp != NULL);\n\tassert(sp->encodepfunc != NULL);\n\tassert(sp->encodetile != NULL);\n\n        /* \n         * Do predictor manipulation in a working buffer to avoid altering\n         * the callers buffer. http://trac.osgeo.org/gdal/ticket/1965\n         */\n        working_copy = (uint8*) _TIFFmalloc(cc0);\n        if( working_copy == NULL )\n        {\n            TIFFErrorExt(tif->tif_clientdata, module, \n                         \"Out of memory allocating %d byte temp buffer.\",\n                         cc0 );\n            return 0;\n        }\n        memcpy( working_copy, bp0, cc0 );\n        bp = working_copy;\n\n\trowsize = sp->rowsize;\n\tassert(rowsize > 0);\n\tassert((cc0%rowsize)==0);\n\twhile (cc > 0) {\n\t\t(*sp->encodepfunc)(tif, bp, rowsize);\n\t\tcc -= rowsize;\n\t\tbp += rowsize;\n\t}\n\tresult_code = (*sp->encodetile)(tif, working_copy, cc0, s);\n\n        _TIFFfree( working_copy );\n\n        return result_code;\n}\n\n#define\tFIELD_PREDICTOR\t(FIELD_CODEC+0)\t\t/* XXX */\n\nstatic const TIFFFieldInfo predictFieldInfo[] = {\n    { TIFFTAG_PREDICTOR,\t 1, 1, TIFF_SHORT,\tFIELD_PREDICTOR,\n      FALSE,\tFALSE,\t\"Predictor\" },\n};\n\nstatic int\nPredictorVSetField(TIFF* tif, ttag_t tag, va_list ap)\n{\n\tTIFFPredictorState *sp = PredictorState(tif);\n\n\tassert(sp != NULL);\n\tassert(sp->vsetparent != NULL);\n\n\tswitch (tag) {\n\tcase TIFFTAG_PREDICTOR:\n\t\tsp->predictor = (uint16) va_arg(ap, int);\n\t\tTIFFSetFieldBit(tif, FIELD_PREDICTOR);\n\t\tbreak;\n\tdefault:\n\t\treturn (*sp->vsetparent)(tif, tag, ap);\n\t}\n\ttif->tif_flags |= TIFF_DIRTYDIRECT;\n\treturn 1;\n}\n\nstatic int\nPredictorVGetField(TIFF* tif, ttag_t tag, va_list ap)\n{\n\tTIFFPredictorState *sp = PredictorState(tif);\n\n\tassert(sp != NULL);\n\tassert(sp->vgetparent != NULL);\n\n\tswitch (tag) {\n\tcase TIFFTAG_PREDICTOR:\n\t\t*va_arg(ap, uint16*) = sp->predictor;\n\t\tbreak;\n\tdefault:\n\t\treturn (*sp->vgetparent)(tif, tag, ap);\n\t}\n\treturn 1;\n}\n\nstatic void\nPredictorPrintDir(TIFF* tif, FILE* fd, long flags)\n{\n\tTIFFPredictorState* sp = PredictorState(tif);\n\n\t(void) flags;\n\tif (TIFFFieldSet(tif,FIELD_PREDICTOR)) {\n\t\tfprintf(fd, \"  Predictor: \");\n\t\tswitch (sp->predictor) {\n\t\tcase 1: fprintf(fd, \"none \"); break;\n\t\tcase 2: fprintf(fd, \"horizontal differencing \"); break;\n\t\tcase 3: fprintf(fd, \"floating point predictor \"); break;\n\t\t}\n\t\tfprintf(fd, \"%u (0x%x)\\n\", sp->predictor, sp->predictor);\n\t}\n\tif (sp->printdir)\n\t\t(*sp->printdir)(tif, fd, flags);\n}\n\nint\nTIFFPredictorInit(TIFF* tif)\n{\n\tTIFFPredictorState* sp = PredictorState(tif);\n\n\tassert(sp != 0);\n\n\t/*\n\t * Merge codec-specific tag information.\n\t */\n\tif (!_TIFFMergeFieldInfo(tif, predictFieldInfo,\n\t\t\t\t TIFFArrayCount(predictFieldInfo))) {\n\t\tTIFFErrorExt(tif->tif_clientdata, \"TIFFPredictorInit\",\n\t\t\t     \"Merging Predictor codec-specific tags failed\");\n\t\treturn 0;\n\t}\n\n\t/*\n\t * Override parent get/set field methods.\n\t */\n\tsp->vgetparent = tif->tif_tagmethods.vgetfield;\n\ttif->tif_tagmethods.vgetfield =\n            PredictorVGetField;/* hook for predictor tag */\n\tsp->vsetparent = tif->tif_tagmethods.vsetfield;\n\ttif->tif_tagmethods.vsetfield =\n            PredictorVSetField;/* hook for predictor tag */\n\tsp->printdir = tif->tif_tagmethods.printdir;\n\ttif->tif_tagmethods.printdir =\n            PredictorPrintDir;\t/* hook for predictor tag */\n\n\tsp->setupdecode = tif->tif_setupdecode;\n\ttif->tif_setupdecode = PredictorSetupDecode;\n\tsp->setupencode = tif->tif_setupencode;\n\ttif->tif_setupencode = PredictorSetupEncode;\n\n\tsp->predictor = 1;\t\t\t/* default value */\n\tsp->encodepfunc = NULL;\t\t\t/* no predictor routine */\n\tsp->decodepfunc = NULL;\t\t\t/* no predictor routine */\n\treturn 1;\n}\n\nint\nTIFFPredictorCleanup(TIFF* tif)\n{\n\tTIFFPredictorState* sp = PredictorState(tif);\n\n\tassert(sp != 0);\n\n\ttif->tif_tagmethods.vgetfield = sp->vgetparent;\n\ttif->tif_tagmethods.vsetfield = sp->vsetparent;\n\ttif->tif_tagmethods.printdir = sp->printdir;\n\ttif->tif_setupdecode = sp->setupdecode;\n\ttif->tif_setupencode = sp->setupencode;\n\n\treturn 1;\n}\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/tif_predict.h",
    "content": "/* $Id: tif_predict.h,v 1.3.2.1 2007/11/22 21:24:51 fwarmerdam Exp $ */\n\n/*\n * Copyright (c) 1995-1997 Sam Leffler\n * Copyright (c) 1995-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n#ifndef _TIFFPREDICT_\n#define\t_TIFFPREDICT_\n/*\n * ``Library-private'' Support for the Predictor Tag\n */\n\n/*\n * Codecs that want to support the Predictor tag must place\n * this structure first in their private state block so that\n * the predictor code can cast tif_data to find its state.\n */\ntypedef struct {\n\tint\t\tpredictor;\t/* predictor tag value */\n\tint\t\tstride;\t\t/* sample stride over data */\n\ttsize_t\t\trowsize;\t/* tile/strip row size */\n\n \tTIFFCodeMethod  encoderow;\t/* parent codec encode/decode row */\n \tTIFFCodeMethod  encodestrip;\t/* parent codec encode/decode strip */\n \tTIFFCodeMethod  encodetile;\t/* parent codec encode/decode tile */ \n \tTIFFPostMethod  encodepfunc;\t/* horizontal differencer */\n \n \tTIFFCodeMethod  decoderow;\t/* parent codec encode/decode row */\n \tTIFFCodeMethod  decodestrip;\t/* parent codec encode/decode strip */\n \tTIFFCodeMethod  decodetile;\t/* parent codec encode/decode tile */ \n \tTIFFPostMethod  decodepfunc;\t/* horizontal accumulator */\n\n\tTIFFVGetMethod\tvgetparent;\t/* super-class method */\n\tTIFFVSetMethod\tvsetparent;\t/* super-class method */\n\tTIFFPrintMethod\tprintdir;\t/* super-class method */\n\tTIFFBoolMethod\tsetupdecode;\t/* super-class method */\n\tTIFFBoolMethod\tsetupencode;\t/* super-class method */\n} TIFFPredictorState;\n\n#if defined(__cplusplus)\nextern \"C\" {\n#endif\nextern\tint TIFFPredictorInit(TIFF*);\nextern\tint TIFFPredictorCleanup(TIFF*);\n#if defined(__cplusplus)\n}\n#endif\n#endif /* _TIFFPREDICT_ */\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/tif_print.c",
    "content": "/* $Id: tif_print.c,v 1.36.2.2 2009-09-17 18:00:28 bfriesen Exp $ */\n\n/*\n * Copyright (c) 1988-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n/*\n * TIFF Library.\n *\n * Directory Printing Support\n */\n#include \"tiffiop.h\"\n#include <stdio.h>\n#include <string.h>\n#include <ctype.h>\n\nstatic const char *photoNames[] = {\n    \"min-is-white\",\t\t\t\t/* PHOTOMETRIC_MINISWHITE */\n    \"min-is-black\",\t\t\t\t/* PHOTOMETRIC_MINISBLACK */\n    \"RGB color\",\t\t\t\t/* PHOTOMETRIC_RGB */\n    \"palette color (RGB from colormap)\",\t/* PHOTOMETRIC_PALETTE */\n    \"transparency mask\",\t\t\t/* PHOTOMETRIC_MASK */\n    \"separated\",\t\t\t\t/* PHOTOMETRIC_SEPARATED */\n    \"YCbCr\",\t\t\t\t\t/* PHOTOMETRIC_YCBCR */\n    \"7 (0x7)\",\n    \"CIE L*a*b*\",\t\t\t\t/* PHOTOMETRIC_CIELAB */\n};\n#define\tNPHOTONAMES\t(sizeof (photoNames) / sizeof (photoNames[0]))\n\nstatic const char *orientNames[] = {\n    \"0 (0x0)\",\n    \"row 0 top, col 0 lhs\",\t\t\t/* ORIENTATION_TOPLEFT */\n    \"row 0 top, col 0 rhs\",\t\t\t/* ORIENTATION_TOPRIGHT */\n    \"row 0 bottom, col 0 rhs\",\t\t\t/* ORIENTATION_BOTRIGHT */\n    \"row 0 bottom, col 0 lhs\",\t\t\t/* ORIENTATION_BOTLEFT */\n    \"row 0 lhs, col 0 top\",\t\t\t/* ORIENTATION_LEFTTOP */\n    \"row 0 rhs, col 0 top\",\t\t\t/* ORIENTATION_RIGHTTOP */\n    \"row 0 rhs, col 0 bottom\",\t\t\t/* ORIENTATION_RIGHTBOT */\n    \"row 0 lhs, col 0 bottom\",\t\t\t/* ORIENTATION_LEFTBOT */\n};\n#define\tNORIENTNAMES\t(sizeof (orientNames) / sizeof (orientNames[0]))\n\nstatic void\n_TIFFPrintField(FILE* fd, const TIFFFieldInfo *fip,\n\t\tuint32 value_count, void *raw_data)\n{\n\tuint32 j;\n\t\t\n\tfprintf(fd, \"  %s: \", fip->field_name);\n\n\tfor(j = 0; j < value_count; j++) {\n\t\tif(fip->field_type == TIFF_BYTE)\n\t\t\tfprintf(fd, \"%u\", ((uint8 *) raw_data)[j]);\n\t\telse if(fip->field_type == TIFF_UNDEFINED)\n\t\t\tfprintf(fd, \"0x%x\",\n\t\t\t\t(unsigned int) ((unsigned char *) raw_data)[j]);\n\t\telse if(fip->field_type == TIFF_SBYTE)\n\t\t\tfprintf(fd, \"%d\", ((int8 *) raw_data)[j]);\n\t\telse if(fip->field_type == TIFF_SHORT)\n\t\t\tfprintf(fd, \"%u\", ((uint16 *) raw_data)[j]);\n\t\telse if(fip->field_type == TIFF_SSHORT)\n\t\t\tfprintf(fd, \"%d\", ((int16 *) raw_data)[j]);\n\t\telse if(fip->field_type == TIFF_LONG)\n\t\t\tfprintf(fd, \"%lu\",\n\t\t\t\t(unsigned long)((uint32 *) raw_data)[j]);\n\t\telse if(fip->field_type == TIFF_SLONG)\n\t\t\tfprintf(fd, \"%ld\", (long)((int32 *) raw_data)[j]);\n\t\telse if(fip->field_type == TIFF_RATIONAL\n\t\t\t|| fip->field_type == TIFF_SRATIONAL\n\t\t\t|| fip->field_type == TIFF_FLOAT)\n\t\t\tfprintf(fd, \"%f\", ((float *) raw_data)[j]);\n\t\telse if(fip->field_type == TIFF_IFD)\n\t\t\tfprintf(fd, \"0x%ulx\", ((uint32 *) raw_data)[j]);\n\t\telse if(fip->field_type == TIFF_ASCII) {\n\t\t\tfprintf(fd, \"%s\", (char *) raw_data);\n\t\t\tbreak;\n\t\t}\n\t\telse if(fip->field_type == TIFF_DOUBLE)\n\t\t\tfprintf(fd, \"%f\", ((double *) raw_data)[j]);\n\t\telse if(fip->field_type == TIFF_FLOAT)\n\t\t\tfprintf(fd, \"%f\", ((float *)raw_data)[j]);\n\t\telse {\n\t\t\tfprintf(fd, \"<unsupported data type in TIFFPrint>\");\n\t\t\tbreak;\n\t\t}\n\n\t\tif(j < value_count - 1)\n\t\t\tfprintf(fd, \",\");\n\t}\n\n\tfprintf(fd, \"\\n\");\n}\n\nstatic int\n_TIFFPrettyPrintField(TIFF* tif, FILE* fd, ttag_t tag,\n\t\t      uint32 value_count, void *raw_data)\n{\n\tTIFFDirectory *td = &tif->tif_dir;\n\n\tswitch (tag)\n\t{\n\t\tcase TIFFTAG_INKSET:\n\t\t\tfprintf(fd, \"  Ink Set: \");\n\t\t\tswitch (*((uint16*)raw_data)) {\n\t\t\t\tcase INKSET_CMYK:\n\t\t\t\t\tfprintf(fd, \"CMYK\\n\");\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tfprintf(fd, \"%u (0x%x)\\n\",\n\t\t\t\t\t\t*((uint16*)raw_data),\n\t\t\t\t\t\t*((uint16*)raw_data));\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\treturn 1;\n\t\tcase TIFFTAG_DOTRANGE:\n\t\t\tfprintf(fd, \"  Dot Range: %u-%u\\n\",\n\t\t\t\t((uint16*)raw_data)[0], ((uint16*)raw_data)[1]);\n\t\t\treturn 1;\n\t\tcase TIFFTAG_WHITEPOINT:\n\t\t\tfprintf(fd, \"  White Point: %g-%g\\n\",\n\t\t\t\t((float *)raw_data)[0], ((float *)raw_data)[1]);\t\t\treturn 1;\n\t\tcase TIFFTAG_REFERENCEBLACKWHITE:\n\t\t{\n\t\t\tuint16 i;\n\n\t\t\tfprintf(fd, \"  Reference Black/White:\\n\");\n\t\t\tfor (i = 0; i < td->td_samplesperpixel; i++)\n\t\t\tfprintf(fd, \"    %2d: %5g %5g\\n\", i,\n\t\t\t\t((float *)raw_data)[2*i+0],\n\t\t\t\t((float *)raw_data)[2*i+1]);\n\t\t\treturn 1;\n\t\t}\n\t\tcase TIFFTAG_XMLPACKET:\n\t\t{\n\t\t\tuint32 i;\n\t\t\t\n\t\t\tfprintf(fd, \"  XMLPacket (XMP Metadata):\\n\" );\n\t\t\tfor(i = 0; i < value_count; i++)\n\t\t\t\tfputc(((char *)raw_data)[i], fd);\n\t\t\tfprintf( fd, \"\\n\" );\n\t\t\treturn 1;\n\t\t}\n\t\tcase TIFFTAG_RICHTIFFIPTC:\n\t\t\t/*\n\t\t\t * XXX: for some weird reason RichTIFFIPTC tag\n\t\t\t * defined as array of LONG values.\n\t\t\t */\n\t\t\tfprintf(fd,\n\t\t\t\t\"  RichTIFFIPTC Data: <present>, %lu bytes\\n\",\n\t\t\t\t(unsigned long) value_count * 4);\n\t\t\treturn 1;\n\t\tcase TIFFTAG_PHOTOSHOP:\n\t\t\tfprintf(fd, \"  Photoshop Data: <present>, %lu bytes\\n\",\n\t\t\t\t(unsigned long) value_count);\n\t\t\treturn 1;\n\t\tcase TIFFTAG_ICCPROFILE:\n\t\t\tfprintf(fd, \"  ICC Profile: <present>, %lu bytes\\n\",\n\t\t\t\t(unsigned long) value_count);\n\t\t\treturn 1;\n\t\tcase TIFFTAG_STONITS:\n\t\t\tfprintf(fd,\n\t\t\t\t\"  Sample to Nits conversion factor: %.4e\\n\",\n\t\t\t\t*((double*)raw_data));\n\t\t\treturn 1;\n        }\n\n\treturn 0;\n}\n\n/*\n * Print the contents of the current directory\n * to the specified stdio file stream.\n */\nvoid\nTIFFPrintDirectory(TIFF* tif, FILE* fd, long flags)\n{\n\tTIFFDirectory *td = &tif->tif_dir;\n\tchar *sep;\n\tuint16 i;\n\tlong l, n;\n\n\tfprintf(fd, \"TIFF Directory at offset 0x%lx (%lu)\\n\",\n\t\t(unsigned long)tif->tif_diroff, (unsigned long)tif->tif_diroff);\n\tif (TIFFFieldSet(tif,FIELD_SUBFILETYPE)) {\n\t\tfprintf(fd, \"  Subfile Type:\");\n\t\tsep = \" \";\n\t\tif (td->td_subfiletype & FILETYPE_REDUCEDIMAGE) {\n\t\t\tfprintf(fd, \"%sreduced-resolution image\", sep);\n\t\t\tsep = \"/\";\n\t\t}\n\t\tif (td->td_subfiletype & FILETYPE_PAGE) {\n\t\t\tfprintf(fd, \"%smulti-page document\", sep);\n\t\t\tsep = \"/\";\n\t\t}\n\t\tif (td->td_subfiletype & FILETYPE_MASK)\n\t\t\tfprintf(fd, \"%stransparency mask\", sep);\n\t\tfprintf(fd, \" (%lu = 0x%lx)\\n\",\n\t\t    (long) td->td_subfiletype, (long) td->td_subfiletype);\n\t}\n\tif (TIFFFieldSet(tif,FIELD_IMAGEDIMENSIONS)) {\n\t\tfprintf(fd, \"  Image Width: %lu Image Length: %lu\",\n\t\t    (unsigned long) td->td_imagewidth, (unsigned long) td->td_imagelength);\n\t\tif (TIFFFieldSet(tif,FIELD_IMAGEDEPTH))\n\t\t\tfprintf(fd, \" Image Depth: %lu\",\n\t\t\t    (unsigned long) td->td_imagedepth);\n\t\tfprintf(fd, \"\\n\");\n\t}\n\tif (TIFFFieldSet(tif,FIELD_TILEDIMENSIONS)) {\n\t\tfprintf(fd, \"  Tile Width: %lu Tile Length: %lu\",\n\t\t    (unsigned long) td->td_tilewidth, (unsigned long) td->td_tilelength);\n\t\tif (TIFFFieldSet(tif,FIELD_TILEDEPTH))\n\t\t\tfprintf(fd, \" Tile Depth: %lu\",\n\t\t\t    (unsigned long) td->td_tiledepth);\n\t\tfprintf(fd, \"\\n\");\n\t}\n\tif (TIFFFieldSet(tif,FIELD_RESOLUTION)) {\n\t\tfprintf(fd, \"  Resolution: %g, %g\",\n\t\t    td->td_xresolution, td->td_yresolution);\n\t\tif (TIFFFieldSet(tif,FIELD_RESOLUTIONUNIT)) {\n\t\t\tswitch (td->td_resolutionunit) {\n\t\t\tcase RESUNIT_NONE:\n\t\t\t\tfprintf(fd, \" (unitless)\");\n\t\t\t\tbreak;\n\t\t\tcase RESUNIT_INCH:\n\t\t\t\tfprintf(fd, \" pixels/inch\");\n\t\t\t\tbreak;\n\t\t\tcase RESUNIT_CENTIMETER:\n\t\t\t\tfprintf(fd, \" pixels/cm\");\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tfprintf(fd, \" (unit %u = 0x%x)\",\n\t\t\t\t    td->td_resolutionunit,\n\t\t\t\t    td->td_resolutionunit);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tfprintf(fd, \"\\n\");\n\t}\n\tif (TIFFFieldSet(tif,FIELD_POSITION))\n\t\tfprintf(fd, \"  Position: %g, %g\\n\",\n\t\t    td->td_xposition, td->td_yposition);\n\tif (TIFFFieldSet(tif,FIELD_BITSPERSAMPLE))\n\t\tfprintf(fd, \"  Bits/Sample: %u\\n\", td->td_bitspersample);\n\tif (TIFFFieldSet(tif,FIELD_SAMPLEFORMAT)) {\n\t\tfprintf(fd, \"  Sample Format: \");\n\t\tswitch (td->td_sampleformat) {\n\t\tcase SAMPLEFORMAT_VOID:\n\t\t\tfprintf(fd, \"void\\n\");\n\t\t\tbreak;\n\t\tcase SAMPLEFORMAT_INT:\n\t\t\tfprintf(fd, \"signed integer\\n\");\n\t\t\tbreak;\n\t\tcase SAMPLEFORMAT_UINT:\n\t\t\tfprintf(fd, \"unsigned integer\\n\");\n\t\t\tbreak;\n\t\tcase SAMPLEFORMAT_IEEEFP:\n\t\t\tfprintf(fd, \"IEEE floating point\\n\");\n\t\t\tbreak;\n\t\tcase SAMPLEFORMAT_COMPLEXINT:\n\t\t\tfprintf(fd, \"complex signed integer\\n\");\n\t\t\tbreak;\n\t\tcase SAMPLEFORMAT_COMPLEXIEEEFP:\n\t\t\tfprintf(fd, \"complex IEEE floating point\\n\");\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tfprintf(fd, \"%u (0x%x)\\n\",\n\t\t\t    td->td_sampleformat, td->td_sampleformat);\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (TIFFFieldSet(tif,FIELD_COMPRESSION)) {\n\t\tconst TIFFCodec* c = TIFFFindCODEC(td->td_compression);\n\t\tfprintf(fd, \"  Compression Scheme: \");\n\t\tif (c)\n\t\t\tfprintf(fd, \"%s\\n\", c->name);\n\t\telse\n\t\t\tfprintf(fd, \"%u (0x%x)\\n\",\n\t\t\t    td->td_compression, td->td_compression);\n\t}\n\tif (TIFFFieldSet(tif,FIELD_PHOTOMETRIC)) {\n\t\tfprintf(fd, \"  Photometric Interpretation: \");\n\t\tif (td->td_photometric < NPHOTONAMES)\n\t\t\tfprintf(fd, \"%s\\n\", photoNames[td->td_photometric]);\n\t\telse {\n\t\t\tswitch (td->td_photometric) {\n\t\t\tcase PHOTOMETRIC_LOGL:\n\t\t\t\tfprintf(fd, \"CIE Log2(L)\\n\");\n\t\t\t\tbreak;\n\t\t\tcase PHOTOMETRIC_LOGLUV:\n\t\t\t\tfprintf(fd, \"CIE Log2(L) (u',v')\\n\");\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tfprintf(fd, \"%u (0x%x)\\n\",\n\t\t\t\t    td->td_photometric, td->td_photometric);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tif (TIFFFieldSet(tif,FIELD_EXTRASAMPLES) && td->td_extrasamples) {\n\t\tfprintf(fd, \"  Extra Samples: %u<\", td->td_extrasamples);\n\t\tsep = \"\";\n\t\tfor (i = 0; i < td->td_extrasamples; i++) {\n\t\t\tswitch (td->td_sampleinfo[i]) {\n\t\t\tcase EXTRASAMPLE_UNSPECIFIED:\n\t\t\t\tfprintf(fd, \"%sunspecified\", sep);\n\t\t\t\tbreak;\n\t\t\tcase EXTRASAMPLE_ASSOCALPHA:\n\t\t\t\tfprintf(fd, \"%sassoc-alpha\", sep);\n\t\t\t\tbreak;\n\t\t\tcase EXTRASAMPLE_UNASSALPHA:\n\t\t\t\tfprintf(fd, \"%sunassoc-alpha\", sep);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tfprintf(fd, \"%s%u (0x%x)\", sep,\n\t\t\t\t    td->td_sampleinfo[i], td->td_sampleinfo[i]);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tsep = \", \";\n\t\t}\n\t\tfprintf(fd, \">\\n\");\n\t}\n\tif (TIFFFieldSet(tif,FIELD_INKNAMES)) {\n\t\tchar* cp;\n\t\tfprintf(fd, \"  Ink Names: \");\n\t\ti = td->td_samplesperpixel;\n\t\tsep = \"\";\n\t\tfor (cp = td->td_inknames; i > 0; cp = strchr(cp,'\\0')+1, i--) {\n\t\t\tfputs(sep, fd);\n\t\t\t_TIFFprintAscii(fd, cp);\n\t\t\tsep = \", \";\n\t\t}\n                fputs(\"\\n\", fd);\n\t}\n\tif (TIFFFieldSet(tif,FIELD_THRESHHOLDING)) {\n\t\tfprintf(fd, \"  Thresholding: \");\n\t\tswitch (td->td_threshholding) {\n\t\tcase THRESHHOLD_BILEVEL:\n\t\t\tfprintf(fd, \"bilevel art scan\\n\");\n\t\t\tbreak;\n\t\tcase THRESHHOLD_HALFTONE:\n\t\t\tfprintf(fd, \"halftone or dithered scan\\n\");\n\t\t\tbreak;\n\t\tcase THRESHHOLD_ERRORDIFFUSE:\n\t\t\tfprintf(fd, \"error diffused\\n\");\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tfprintf(fd, \"%u (0x%x)\\n\",\n\t\t\t    td->td_threshholding, td->td_threshholding);\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (TIFFFieldSet(tif,FIELD_FILLORDER)) {\n\t\tfprintf(fd, \"  FillOrder: \");\n\t\tswitch (td->td_fillorder) {\n\t\tcase FILLORDER_MSB2LSB:\n\t\t\tfprintf(fd, \"msb-to-lsb\\n\");\n\t\t\tbreak;\n\t\tcase FILLORDER_LSB2MSB:\n\t\t\tfprintf(fd, \"lsb-to-msb\\n\");\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tfprintf(fd, \"%u (0x%x)\\n\",\n\t\t\t    td->td_fillorder, td->td_fillorder);\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (TIFFFieldSet(tif,FIELD_YCBCRSUBSAMPLING))\n        {\n            /*\n             * For hacky reasons (see tif_jpeg.c - JPEGFixupTestSubsampling),\n             * we need to fetch this rather than trust what is in our\n             * structures.\n             */\n            uint16 subsampling[2];\n\n            TIFFGetField( tif, TIFFTAG_YCBCRSUBSAMPLING, \n                          subsampling + 0, subsampling + 1 );\n\t\tfprintf(fd, \"  YCbCr Subsampling: %u, %u\\n\",\n                        subsampling[0], subsampling[1] );\n        }\n\tif (TIFFFieldSet(tif,FIELD_YCBCRPOSITIONING)) {\n\t\tfprintf(fd, \"  YCbCr Positioning: \");\n\t\tswitch (td->td_ycbcrpositioning) {\n\t\tcase YCBCRPOSITION_CENTERED:\n\t\t\tfprintf(fd, \"centered\\n\");\n\t\t\tbreak;\n\t\tcase YCBCRPOSITION_COSITED:\n\t\t\tfprintf(fd, \"cosited\\n\");\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tfprintf(fd, \"%u (0x%x)\\n\",\n\t\t\t    td->td_ycbcrpositioning, td->td_ycbcrpositioning);\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (TIFFFieldSet(tif,FIELD_HALFTONEHINTS))\n\t\tfprintf(fd, \"  Halftone Hints: light %u dark %u\\n\",\n\t\t    td->td_halftonehints[0], td->td_halftonehints[1]);\n\tif (TIFFFieldSet(tif,FIELD_ORIENTATION)) {\n\t\tfprintf(fd, \"  Orientation: \");\n\t\tif (td->td_orientation < NORIENTNAMES)\n\t\t\tfprintf(fd, \"%s\\n\", orientNames[td->td_orientation]);\n\t\telse\n\t\t\tfprintf(fd, \"%u (0x%x)\\n\",\n\t\t\t    td->td_orientation, td->td_orientation);\n\t}\n\tif (TIFFFieldSet(tif,FIELD_SAMPLESPERPIXEL))\n\t\tfprintf(fd, \"  Samples/Pixel: %u\\n\", td->td_samplesperpixel);\n\tif (TIFFFieldSet(tif,FIELD_ROWSPERSTRIP)) {\n\t\tfprintf(fd, \"  Rows/Strip: \");\n\t\tif (td->td_rowsperstrip == (uint32) -1)\n\t\t\tfprintf(fd, \"(infinite)\\n\");\n\t\telse\n\t\t\tfprintf(fd, \"%lu\\n\", (unsigned long) td->td_rowsperstrip);\n\t}\n\tif (TIFFFieldSet(tif,FIELD_MINSAMPLEVALUE))\n\t\tfprintf(fd, \"  Min Sample Value: %u\\n\", td->td_minsamplevalue);\n\tif (TIFFFieldSet(tif,FIELD_MAXSAMPLEVALUE))\n\t\tfprintf(fd, \"  Max Sample Value: %u\\n\", td->td_maxsamplevalue);\n\tif (TIFFFieldSet(tif,FIELD_SMINSAMPLEVALUE))\n\t\tfprintf(fd, \"  SMin Sample Value: %g\\n\",\n\t\t    td->td_sminsamplevalue);\n\tif (TIFFFieldSet(tif,FIELD_SMAXSAMPLEVALUE))\n\t\tfprintf(fd, \"  SMax Sample Value: %g\\n\",\n\t\t    td->td_smaxsamplevalue);\n\tif (TIFFFieldSet(tif,FIELD_PLANARCONFIG)) {\n\t\tfprintf(fd, \"  Planar Configuration: \");\n\t\tswitch (td->td_planarconfig) {\n\t\tcase PLANARCONFIG_CONTIG:\n\t\t\tfprintf(fd, \"single image plane\\n\");\n\t\t\tbreak;\n\t\tcase PLANARCONFIG_SEPARATE:\n\t\t\tfprintf(fd, \"separate image planes\\n\");\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tfprintf(fd, \"%u (0x%x)\\n\",\n\t\t\t    td->td_planarconfig, td->td_planarconfig);\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (TIFFFieldSet(tif,FIELD_PAGENUMBER))\n\t\tfprintf(fd, \"  Page Number: %u-%u\\n\",\n\t\t    td->td_pagenumber[0], td->td_pagenumber[1]);\n\tif (TIFFFieldSet(tif,FIELD_COLORMAP)) {\n\t\tfprintf(fd, \"  Color Map: \");\n\t\tif (flags & TIFFPRINT_COLORMAP) {\n\t\t\tfprintf(fd, \"\\n\");\n\t\t\tn = 1L<<td->td_bitspersample;\n\t\t\tfor (l = 0; l < n; l++)\n\t\t\t\tfprintf(fd, \"   %5lu: %5u %5u %5u\\n\",\n\t\t\t\t    l,\n\t\t\t\t    td->td_colormap[0][l],\n\t\t\t\t    td->td_colormap[1][l],\n\t\t\t\t    td->td_colormap[2][l]);\n\t\t} else\n\t\t\tfprintf(fd, \"(present)\\n\");\n\t}\n\tif (TIFFFieldSet(tif,FIELD_TRANSFERFUNCTION)) {\n\t\tfprintf(fd, \"  Transfer Function: \");\n\t\tif (flags & TIFFPRINT_CURVES) {\n\t\t\tfprintf(fd, \"\\n\");\n\t\t\tn = 1L<<td->td_bitspersample;\n\t\t\tfor (l = 0; l < n; l++) {\n\t\t\t\tfprintf(fd, \"    %2lu: %5u\",\n\t\t\t\t    l, td->td_transferfunction[0][l]);\n\t\t\t\tfor (i = 1; i < td->td_samplesperpixel; i++)\n\t\t\t\t\tfprintf(fd, \" %5u\",\n\t\t\t\t\t    td->td_transferfunction[i][l]);\n\t\t\t\tfputc('\\n', fd);\n\t\t\t}\n\t\t} else\n\t\t\tfprintf(fd, \"(present)\\n\");\n\t}\n\tif (TIFFFieldSet(tif, FIELD_SUBIFD) && (td->td_subifd)) {\n\t\tfprintf(fd, \"  SubIFD Offsets:\");\n\t\tfor (i = 0; i < td->td_nsubifd; i++)\n\t\t\tfprintf(fd, \" %5lu\", (long) td->td_subifd[i]);\n\t\tfputc('\\n', fd);\n\t}\n\n        /*\n        ** Custom tag support.\n        */\n        {\n            int  i;\n            short count;\n\n            count = (short) TIFFGetTagListCount(tif);\n            for(i = 0; i < count; i++) {\n                ttag_t  tag = TIFFGetTagListEntry(tif, i);\n                const TIFFFieldInfo *fip;\n                uint32 value_count;\n                int mem_alloc = 0;\n                void *raw_data;\n\n                fip = TIFFFieldWithTag(tif, tag);\n                if(fip == NULL)\n\t\t\tcontinue;\n\n\t\tif(fip->field_passcount) {\n\t\t\tif(TIFFGetField(tif, tag, &value_count, &raw_data) != 1)\n\t\t\t\tcontinue;\n\t\t} else {\n\t\t\tif (fip->field_readcount == TIFF_VARIABLE\n\t\t\t    || fip->field_readcount == TIFF_VARIABLE2)\n\t\t\t\tvalue_count = 1;\n\t\t\telse if (fip->field_readcount == TIFF_SPP)\n\t\t\t\tvalue_count = td->td_samplesperpixel;\n\t\t\telse\n\t\t\t\tvalue_count = fip->field_readcount;\n\t\t\tif ((fip->field_type == TIFF_ASCII\n\t\t\t     || fip->field_readcount == TIFF_VARIABLE\n\t\t\t     || fip->field_readcount == TIFF_VARIABLE2\n\t\t\t     || fip->field_readcount == TIFF_SPP\n\t\t\t     || value_count > 1)\n\t\t\t    && fip->field_tag != TIFFTAG_PAGENUMBER\n\t\t\t    && fip->field_tag != TIFFTAG_HALFTONEHINTS\n\t\t\t    && fip->field_tag != TIFFTAG_YCBCRSUBSAMPLING\n\t\t\t    && fip->field_tag != TIFFTAG_DOTRANGE) {\n\t\t\t\tif(TIFFGetField(tif, tag, &raw_data) != 1)\n\t\t\t\t\tcontinue;\n\t\t\t} else if (fip->field_tag != TIFFTAG_PAGENUMBER\n\t\t\t\t   && fip->field_tag != TIFFTAG_HALFTONEHINTS\n\t\t\t\t   && fip->field_tag != TIFFTAG_YCBCRSUBSAMPLING\n\t\t\t\t   && fip->field_tag != TIFFTAG_DOTRANGE) {\n\t\t\t\traw_data = _TIFFmalloc(\n\t\t\t\t\t_TIFFDataSize(fip->field_type)\n\t\t\t\t\t* value_count);\n\t\t\t\tmem_alloc = 1;\n\t\t\t\tif(TIFFGetField(tif, tag, raw_data) != 1) {\n\t\t\t\t\t_TIFFfree(raw_data);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t/* \n\t\t\t\t * XXX: Should be fixed and removed, see the\n\t\t\t\t * notes related to TIFFTAG_PAGENUMBER,\n\t\t\t\t * TIFFTAG_HALFTONEHINTS,\n\t\t\t\t * TIFFTAG_YCBCRSUBSAMPLING and\n\t\t\t\t * TIFFTAG_DOTRANGE tags in tif_dir.c. */\n\t\t\t\tchar *tmp;\n\t\t\t\traw_data = _TIFFmalloc(\n\t\t\t\t\t_TIFFDataSize(fip->field_type)\n\t\t\t\t\t* value_count);\n\t\t\t\ttmp = raw_data;\n\t\t\t\tmem_alloc = 1;\n\t\t\t\tif(TIFFGetField(tif, tag, tmp,\n\t\t\t\ttmp + _TIFFDataSize(fip->field_type)) != 1) {\n\t\t\t\t\t_TIFFfree(raw_data);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t/*\n\t\t * Catch the tags which needs to be specially handled and\n\t\t * pretty print them. If tag not handled in\n\t\t * _TIFFPrettyPrintField() fall down and print it as any other\n\t\t * tag.\n\t\t */\n\t\tif (_TIFFPrettyPrintField(tif, fd, tag, value_count, raw_data)) {\n\t\t\tif(mem_alloc)\n\t\t\t\t_TIFFfree(raw_data);\n\t\t\tcontinue;\n\t\t}\n\t\telse\n\t\t\t_TIFFPrintField(fd, fip, value_count, raw_data);\n\n\t\tif(mem_alloc)\n\t\t\t_TIFFfree(raw_data);\n            }\n        }\n        \n\tif (tif->tif_tagmethods.printdir)\n\t\t(*tif->tif_tagmethods.printdir)(tif, fd, flags);\n\tif ((flags & TIFFPRINT_STRIPS) &&\n\t    TIFFFieldSet(tif,FIELD_STRIPOFFSETS)) {\n\t\ttstrip_t s;\n\n\t\tfprintf(fd, \"  %lu %s:\\n\",\n\t\t    (long) td->td_nstrips,\n\t\t    isTiled(tif) ? \"Tiles\" : \"Strips\");\n\t\tfor (s = 0; s < td->td_nstrips; s++)\n\t\t\tfprintf(fd, \"    %3lu: [%8lu, %8lu]\\n\",\n\t\t\t    (unsigned long) s,\n\t\t\t    (unsigned long) td->td_stripoffset[s],\n\t\t\t    (unsigned long) td->td_stripbytecount[s]);\n\t}\n}\n\nvoid\n_TIFFprintAscii(FILE* fd, const char* cp)\n{\n\tfor (; *cp != '\\0'; cp++) {\n\t\tconst char* tp;\n\n\t\tif (isprint((int)*cp)) {\n\t\t\tfputc(*cp, fd);\n\t\t\tcontinue;\n\t\t}\n\t\tfor (tp = \"\\tt\\bb\\rr\\nn\\vv\"; *tp; tp++)\n\t\t\tif (*tp++ == *cp)\n\t\t\t\tbreak;\n\t\tif (*tp)\n\t\t\tfprintf(fd, \"\\\\%c\", *tp);\n\t\telse\n\t\t\tfprintf(fd, \"\\\\%03o\", *cp & 0xff);\n\t}\n}\n\nvoid\n_TIFFprintAsciiTag(FILE* fd, const char* name, const char* value)\n{\n\tfprintf(fd, \"  %s: \\\"\", name);\n\t_TIFFprintAscii(fd, value);\n\tfprintf(fd, \"\\\"\\n\");\n}\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/tif_read.c",
    "content": "/* $Id: tif_read.c,v 1.16 2007/02/22 11:33:44 dron Exp $ */\n\n/*\n * Copyright (c) 1988-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n/*\n * TIFF Library.\n * Scanline-oriented Read Support\n */\n#include \"tiffiop.h\"\n#include <stdio.h>\n\n\tint TIFFFillStrip(TIFF*, tstrip_t);\n\tint TIFFFillTile(TIFF*, ttile_t);\nstatic\tint TIFFStartStrip(TIFF*, tstrip_t);\nstatic\tint TIFFStartTile(TIFF*, ttile_t);\nstatic\tint TIFFCheckRead(TIFF*, int);\n\n#define\tNOSTRIP\t((tstrip_t) -1)\t\t\t/* undefined state */\n#define\tNOTILE\t((ttile_t) -1)\t\t\t/* undefined state */\n\n/*\n * Seek to a random row+sample in a file.\n */\nstatic int\nTIFFSeek(TIFF* tif, uint32 row, tsample_t sample)\n{\n\tregister TIFFDirectory *td = &tif->tif_dir;\n\ttstrip_t strip;\n\n\tif (row >= td->td_imagelength) {\t/* out of range */\n\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t\t     \"%lu: Row out of range, max %lu\",\n\t\t\t     (unsigned long) row,\n\t\t\t     (unsigned long) td->td_imagelength);\n\t\treturn (0);\n\t}\n\tif (td->td_planarconfig == PLANARCONFIG_SEPARATE) {\n\t\tif (sample >= td->td_samplesperpixel) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t\t    \"%lu: Sample out of range, max %lu\",\n\t\t\t    (unsigned long) sample, (unsigned long) td->td_samplesperpixel);\n\t\t\treturn (0);\n\t\t}\n\t\tstrip = sample*td->td_stripsperimage + row/td->td_rowsperstrip;\n\t} else\n\t\tstrip = row / td->td_rowsperstrip;\n\tif (strip != tif->tif_curstrip) {\t/* different strip, refill */\n\t\tif (!TIFFFillStrip(tif, strip))\n\t\t\treturn (0);\n\t} else if (row < tif->tif_row) {\n\t\t/*\n\t\t * Moving backwards within the same strip: backup\n\t\t * to the start and then decode forward (below).\n\t\t *\n\t\t * NB: If you're planning on lots of random access within a\n\t\t * strip, it's better to just read and decode the entire\n\t\t * strip, and then access the decoded data in a random fashion.\n\t\t */\n\t\tif (!TIFFStartStrip(tif, strip))\n\t\t\treturn (0);\n\t}\n\tif (row != tif->tif_row) {\n\t\t/*\n\t\t * Seek forward to the desired row.\n\t\t */\n\t\tif (!(*tif->tif_seek)(tif, row - tif->tif_row))\n\t\t\treturn (0);\n\t\ttif->tif_row = row;\n\t}\n\treturn (1);\n}\n\nint\nTIFFReadScanline(TIFF* tif, tdata_t buf, uint32 row, tsample_t sample)\n{\n\tint e;\n\n\tif (!TIFFCheckRead(tif, 0))\n\t\treturn (-1);\n\tif( (e = TIFFSeek(tif, row, sample)) != 0) {\n\t\t/*\n\t\t * Decompress desired row into user buffer.\n\t\t */\n\t\te = (*tif->tif_decoderow)\n\t\t    (tif, (tidata_t) buf, tif->tif_scanlinesize, sample);\n\n\t\t/* we are now poised at the beginning of the next row */\n\t\ttif->tif_row = row + 1;\n\n\t\tif (e)\n\t\t\t(*tif->tif_postdecode)(tif, (tidata_t) buf,\n\t\t\t    tif->tif_scanlinesize);\n\t}\n\treturn (e > 0 ? 1 : -1);\n}\n\n/*\n * Read a strip of data and decompress the specified\n * amount into the user-supplied buffer.\n */\ntsize_t\nTIFFReadEncodedStrip(TIFF* tif, tstrip_t strip, tdata_t buf, tsize_t size)\n{\n\tTIFFDirectory *td = &tif->tif_dir;\n\tuint32 nrows;\n\ttsize_t stripsize;\n        tstrip_t sep_strip, strips_per_sep;\n\n\tif (!TIFFCheckRead(tif, 0))\n\t\treturn (-1);\n\tif (strip >= td->td_nstrips) {\n\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t\t     \"%ld: Strip out of range, max %ld\",\n\t\t\t     (long) strip, (long) td->td_nstrips);\n\t\treturn (-1);\n\t}\n\t/*\n\t * Calculate the strip size according to the number of\n\t * rows in the strip (check for truncated last strip on any\n\t * of the separations).\n\t */\n\tif( td->td_rowsperstrip >= td->td_imagelength )\n\t\tstrips_per_sep = 1;\n\telse\n\t\tstrips_per_sep = (td->td_imagelength+td->td_rowsperstrip-1)\n\t\t    / td->td_rowsperstrip;\n\n\tsep_strip = strip % strips_per_sep;\n\n\tif (sep_strip != strips_per_sep-1 ||\n\t    (nrows = td->td_imagelength % td->td_rowsperstrip) == 0)\n\t\tnrows = td->td_rowsperstrip;\n\n\tstripsize = TIFFVStripSize(tif, nrows);\n\tif (size == (tsize_t) -1)\n\t\tsize = stripsize;\n\telse if (size > stripsize)\n\t\tsize = stripsize;\n\tif (TIFFFillStrip(tif, strip)\n\t    && (*tif->tif_decodestrip)(tif, (tidata_t) buf, size,   \n\t    (tsample_t)(strip / td->td_stripsperimage)) > 0 ) {\n\t\t(*tif->tif_postdecode)(tif, (tidata_t) buf, size);\n\t\treturn (size);\n\t} else\n\t\treturn ((tsize_t) -1);\n}\n\nstatic tsize_t\nTIFFReadRawStrip1(TIFF* tif,\n    tstrip_t strip, tdata_t buf, tsize_t size, const char* module)\n{\n\tTIFFDirectory *td = &tif->tif_dir;\n\n\tassert((tif->tif_flags&TIFF_NOREADRAW)==0);\n\tif (!isMapped(tif)) {\n\t\ttsize_t cc;\n\n\t\tif (!SeekOK(tif, td->td_stripoffset[strip])) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, module,\n\t\t\t    \"%s: Seek error at scanline %lu, strip %lu\",\n\t\t\t    tif->tif_name,\n\t\t\t    (unsigned long) tif->tif_row, (unsigned long) strip);\n\t\t\treturn (-1);\n\t\t}\n\t\tcc = TIFFReadFile(tif, buf, size);\n\t\tif (cc != size) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, module,\n\t\t\"%s: Read error at scanline %lu; got %lu bytes, expected %lu\",\n\t\t\t    tif->tif_name,\n\t\t\t    (unsigned long) tif->tif_row,\n\t\t\t    (unsigned long) cc,\n\t\t\t    (unsigned long) size);\n\t\t\treturn (-1);\n\t\t}\n\t} else {\n\t\tif (td->td_stripoffset[strip] + size > tif->tif_size) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, module,\n    \"%s: Read error at scanline %lu, strip %lu; got %lu bytes, expected %lu\",\n\t\t\t    tif->tif_name,\n\t\t\t    (unsigned long) tif->tif_row,\n\t\t\t    (unsigned long) strip,\n\t\t\t    (unsigned long) tif->tif_size - td->td_stripoffset[strip],\n\t\t\t    (unsigned long) size);\n\t\t\treturn (-1);\n\t\t}\n\t\t_TIFFmemcpy(buf, tif->tif_base + td->td_stripoffset[strip],\n                            size);\n\t}\n\treturn (size);\n}\n\n/*\n * Read a strip of data from the file.\n */\ntsize_t\nTIFFReadRawStrip(TIFF* tif, tstrip_t strip, tdata_t buf, tsize_t size)\n{\n\tstatic const char module[] = \"TIFFReadRawStrip\";\n\tTIFFDirectory *td = &tif->tif_dir;\n\t/*\n\t * FIXME: butecount should have tsize_t type, but for now libtiff\n\t * defines tsize_t as a signed 32-bit integer and we are losing\n\t * ability to read arrays larger than 2^31 bytes. So we are using\n\t * uint32 instead of tsize_t here.\n\t */\n\tuint32 bytecount;\n\n\tif (!TIFFCheckRead(tif, 0))\n\t\treturn ((tsize_t) -1);\n\tif (strip >= td->td_nstrips) {\n\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t\t     \"%lu: Strip out of range, max %lu\",\n\t\t\t     (unsigned long) strip,\n\t\t\t     (unsigned long) td->td_nstrips);\n\t\treturn ((tsize_t) -1);\n\t}\n\tif (tif->tif_flags&TIFF_NOREADRAW)\n\t{\n\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\"Compression scheme does not support access to raw uncompressed data\");\n\t\treturn ((tsize_t) -1);\n\t}\n\tbytecount = td->td_stripbytecount[strip];\n\tif (bytecount <= 0) {\n\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t    \"%lu: Invalid strip byte count, strip %lu\",\n\t\t    (unsigned long) bytecount, (unsigned long) strip);\n\t\treturn ((tsize_t) -1);\n\t}\n\tif (size != (tsize_t)-1 && (uint32)size < bytecount)\n\t\tbytecount = size;\n\treturn (TIFFReadRawStrip1(tif, strip, buf, bytecount, module));\n}\n\n/*\n * Read the specified strip and setup for decoding. The data buffer is\n * expanded, as necessary, to hold the strip's data.\n */\nint\nTIFFFillStrip(TIFF* tif, tstrip_t strip)\n{\n\tstatic const char module[] = \"TIFFFillStrip\";\n\tTIFFDirectory *td = &tif->tif_dir;\n\n\tif ((tif->tif_flags&TIFF_NOREADRAW)==0)\n\t{\n\t\t/*\n\t\t * FIXME: butecount should have tsize_t type, but for now\n\t\t * libtiff defines tsize_t as a signed 32-bit integer and we\n\t\t * are losing ability to read arrays larger than 2^31 bytes.\n\t\t * So we are using uint32 instead of tsize_t here.\n\t\t */\n\t\tuint32 bytecount = td->td_stripbytecount[strip];\n\t\tif (bytecount <= 0) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, module,\n\t\t\t    \"%s: Invalid strip byte count %lu, strip %lu\",\n\t\t\t    tif->tif_name, (unsigned long) bytecount,\n\t\t\t    (unsigned long) strip);\n\t\t\treturn (0);\n\t\t}\n\t\tif (isMapped(tif) &&\n\t\t    (isFillOrder(tif, td->td_fillorder)\n\t\t    || (tif->tif_flags & TIFF_NOBITREV))) {\n\t\t\t/*\n\t\t\t * The image is mapped into memory and we either don't\n\t\t\t * need to flip bits or the compression routine is\n\t\t\t * going to handle this operation itself.  In this\n\t\t\t * case, avoid copying the raw data and instead just\n\t\t\t * reference the data from the memory mapped file\n\t\t\t * image.  This assumes that the decompression\n\t\t\t * routines do not modify the contents of the raw data\n\t\t\t * buffer (if they try to, the application will get a\n\t\t\t * fault since the file is mapped read-only).\n\t\t\t */\n\t\t\tif ((tif->tif_flags & TIFF_MYBUFFER) && tif->tif_rawdata)\n\t\t\t\t_TIFFfree(tif->tif_rawdata);\n\t\t\ttif->tif_flags &= ~TIFF_MYBUFFER;\n\t\t\t/*\n\t\t\t * We must check for overflow, potentially causing\n\t\t\t * an OOB read. Instead of simple\n\t\t\t *\n\t\t\t *  td->td_stripoffset[strip]+bytecount > tif->tif_size\n\t\t\t *\n\t\t\t * comparison (which can overflow) we do the following\n\t\t\t * two comparisons:\n\t\t\t */\n\t\t\tif (bytecount > tif->tif_size ||\n\t\t\t    td->td_stripoffset[strip] > tif->tif_size - bytecount) {\n\t\t\t\t/*\n\t\t\t\t * This error message might seem strange, but\n\t\t\t\t * it's what would happen if a read were done\n\t\t\t\t * instead.\n\t\t\t\t */\n\t\t\t\tTIFFErrorExt(tif->tif_clientdata, module,\n\n\t\t\t\t\t\"%s: Read error on strip %lu; \"\n\t\t\t\t\t\"got %lu bytes, expected %lu\",\n\t\t\t\t\ttif->tif_name, (unsigned long) strip,\n\t\t\t\t\t(unsigned long) tif->tif_size - td->td_stripoffset[strip],\n\t\t\t\t\t(unsigned long) bytecount);\n\t\t\t\ttif->tif_curstrip = NOSTRIP;\n\t\t\t\treturn (0);\n\t\t\t}\n\t\t\ttif->tif_rawdatasize = bytecount;\n\t\t\ttif->tif_rawdata = tif->tif_base + td->td_stripoffset[strip];\n\t\t} else {\n\t\t\t/*\n\t\t\t * Expand raw data buffer, if needed, to hold data\n\t\t\t * strip coming from file (perhaps should set upper\n\t\t\t * bound on the size of a buffer we'll use?).\n\t\t\t */\n\t\t\tif (bytecount > (uint32)tif->tif_rawdatasize) {\n\t\t\t\ttif->tif_curstrip = NOSTRIP;\n\t\t\t\tif ((tif->tif_flags & TIFF_MYBUFFER) == 0) {\n\t\t\t\t\tTIFFErrorExt(tif->tif_clientdata,\n\t\t\t\t\t\t     module,\n\t\t\t\t\"%s: Data buffer too small to hold strip %lu\",\n\t\t\t\t\t\t     tif->tif_name,\n\t\t\t\t\t\t     (unsigned long) strip);\n\t\t\t\t\treturn (0);\n\t\t\t\t}\n\t\t\t\tif (!TIFFReadBufferSetup(tif, 0,\n\t\t\t\t    TIFFroundup(bytecount, 1024)))\n\t\t\t\t\treturn (0);\n\t\t\t}\n\t\t\tif ((uint32)TIFFReadRawStrip1(tif, strip,\n\t\t\t\t(unsigned char *)tif->tif_rawdata,\n\t\t\t\tbytecount, module) != bytecount)\n\t\t\t\treturn (0);\n\t\t\tif (!isFillOrder(tif, td->td_fillorder) &&\n\t\t\t    (tif->tif_flags & TIFF_NOBITREV) == 0)\n\t\t\t\tTIFFReverseBits(tif->tif_rawdata, bytecount);\n\t\t}\n\t}\n\treturn (TIFFStartStrip(tif, strip));\n}\n\n/*\n * Tile-oriented Read Support\n * Contributed by Nancy Cam (Silicon Graphics).\n */\n\n/*\n * Read and decompress a tile of data.  The\n * tile is selected by the (x,y,z,s) coordinates.\n */\ntsize_t\nTIFFReadTile(TIFF* tif,\n    tdata_t buf, uint32 x, uint32 y, uint32 z, tsample_t s)\n{\n\tif (!TIFFCheckRead(tif, 1) || !TIFFCheckTile(tif, x, y, z, s))\n\t\treturn (-1);\n\treturn (TIFFReadEncodedTile(tif,\n\t    TIFFComputeTile(tif, x, y, z, s), buf, (tsize_t) -1));\n}\n\n/*\n * Read a tile of data and decompress the specified\n * amount into the user-supplied buffer.\n */\ntsize_t\nTIFFReadEncodedTile(TIFF* tif, ttile_t tile, tdata_t buf, tsize_t size)\n{\n\tTIFFDirectory *td = &tif->tif_dir;\n\ttsize_t tilesize = tif->tif_tilesize;\n\n\tif (!TIFFCheckRead(tif, 1))\n\t\treturn (-1);\n\tif (tile >= td->td_nstrips) {\n\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t\t     \"%ld: Tile out of range, max %ld\",\n\t\t\t     (long) tile, (unsigned long) td->td_nstrips);\n\t\treturn (-1);\n\t}\n\tif (size == (tsize_t) -1)\n\t\tsize = tilesize;\n\telse if (size > tilesize)\n\t\tsize = tilesize;\n\tif (TIFFFillTile(tif, tile) && (*tif->tif_decodetile)(tif,\n\t    (tidata_t) buf, size, (tsample_t)(tile/td->td_stripsperimage))) {\n\t\t(*tif->tif_postdecode)(tif, (tidata_t) buf, size);\n\t\treturn (size);\n\t} else\n\t\treturn (-1);\n}\n\nstatic tsize_t\nTIFFReadRawTile1(TIFF* tif,\n    ttile_t tile, tdata_t buf, tsize_t size, const char* module)\n{\n\tTIFFDirectory *td = &tif->tif_dir;\n\n\tassert((tif->tif_flags&TIFF_NOREADRAW)==0);\n\tif (!isMapped(tif)) {\n\t\ttsize_t cc;\n\n\t\tif (!SeekOK(tif, td->td_stripoffset[tile])) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, module,\n\t\t\t    \"%s: Seek error at row %ld, col %ld, tile %ld\",\n\t\t\t    tif->tif_name,\n\t\t\t    (long) tif->tif_row,\n\t\t\t    (long) tif->tif_col,\n\t\t\t    (long) tile);\n\t\t\treturn ((tsize_t) -1);\n\t\t}\n\t\tcc = TIFFReadFile(tif, buf, size);\n\t\tif (cc != size) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, module,\n\t    \"%s: Read error at row %ld, col %ld; got %lu bytes, expected %lu\",\n\t\t\t    tif->tif_name,\n\t\t\t    (long) tif->tif_row,\n\t\t\t    (long) tif->tif_col,\n\t\t\t    (unsigned long) cc,\n\t\t\t    (unsigned long) size);\n\t\t\treturn ((tsize_t) -1);\n\t\t}\n\t} else {\n\t\tif (td->td_stripoffset[tile] + size > tif->tif_size) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, module,\n    \"%s: Read error at row %ld, col %ld, tile %ld; got %lu bytes, expected %lu\",\n\t\t\t    tif->tif_name,\n\t\t\t    (long) tif->tif_row,\n\t\t\t    (long) tif->tif_col,\n\t\t\t    (long) tile,\n\t\t\t    (unsigned long) tif->tif_size - td->td_stripoffset[tile],\n\t\t\t    (unsigned long) size);\n\t\t\treturn ((tsize_t) -1);\n\t\t}\n\t\t_TIFFmemcpy(buf, tif->tif_base + td->td_stripoffset[tile], size);\n\t}\n\treturn (size);\n}\n\n/*\n * Read a tile of data from the file.\n */\ntsize_t\nTIFFReadRawTile(TIFF* tif, ttile_t tile, tdata_t buf, tsize_t size)\n{\n\tstatic const char module[] = \"TIFFReadRawTile\";\n\tTIFFDirectory *td = &tif->tif_dir;\n\t/*\n\t * FIXME: butecount should have tsize_t type, but for now libtiff\n\t * defines tsize_t as a signed 32-bit integer and we are losing\n\t * ability to read arrays larger than 2^31 bytes. So we are using\n\t * uint32 instead of tsize_t here.\n\t */\n\tuint32 bytecount;\n\n\tif (!TIFFCheckRead(tif, 1))\n\t\treturn ((tsize_t) -1);\n\tif (tile >= td->td_nstrips) {\n\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t\t     \"%lu: Tile out of range, max %lu\",\n\t\t    (unsigned long) tile, (unsigned long) td->td_nstrips);\n\t\treturn ((tsize_t) -1);\n\t}\n\tif (tif->tif_flags&TIFF_NOREADRAW)\n\t{\n\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\"Compression scheme does not support access to raw uncompressed data\");\n\t\treturn ((tsize_t) -1);\n\t}\n\tbytecount = td->td_stripbytecount[tile];\n\tif (size != (tsize_t) -1 && (uint32)size < bytecount)\n\t\tbytecount = size;\n\treturn (TIFFReadRawTile1(tif, tile, buf, bytecount, module));\n}\n\n/*\n * Read the specified tile and setup for decoding. The data buffer is\n * expanded, as necessary, to hold the tile's data.\n */\nint\nTIFFFillTile(TIFF* tif, ttile_t tile)\n{\n\tstatic const char module[] = \"TIFFFillTile\";\n\tTIFFDirectory *td = &tif->tif_dir;\n\n\tif ((tif->tif_flags&TIFF_NOREADRAW)==0)\n\t{\n\t\t/*\n\t\t * FIXME: butecount should have tsize_t type, but for now\n\t\t * libtiff defines tsize_t as a signed 32-bit integer and we\n\t\t * are losing ability to read arrays larger than 2^31 bytes.\n\t\t * So we are using uint32 instead of tsize_t here.\n\t\t */\n\t\tuint32 bytecount = td->td_stripbytecount[tile];\n\t\tif (bytecount <= 0) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t\t    \"%lu: Invalid tile byte count, tile %lu\",\n\t\t\t    (unsigned long) bytecount, (unsigned long) tile);\n\t\t\treturn (0);\n\t\t}\n\t\tif (isMapped(tif) &&\n\t\t    (isFillOrder(tif, td->td_fillorder)\n\t\t     || (tif->tif_flags & TIFF_NOBITREV))) {\n\t\t\t/*\n\t\t\t * The image is mapped into memory and we either don't\n\t\t\t * need to flip bits or the compression routine is\n\t\t\t * going to handle this operation itself.  In this\n\t\t\t * case, avoid copying the raw data and instead just\n\t\t\t * reference the data from the memory mapped file\n\t\t\t * image.  This assumes that the decompression\n\t\t\t * routines do not modify the contents of the raw data\n\t\t\t * buffer (if they try to, the application will get a\n\t\t\t * fault since the file is mapped read-only).\n\t\t\t */\n\t\t\tif ((tif->tif_flags & TIFF_MYBUFFER) && tif->tif_rawdata)\n\t\t\t\t_TIFFfree(tif->tif_rawdata);\n\t\t\ttif->tif_flags &= ~TIFF_MYBUFFER;\n\t\t\t/*\n\t\t\t * We must check for overflow, potentially causing\n\t\t\t * an OOB read. Instead of simple\n\t\t\t *\n\t\t\t *  td->td_stripoffset[tile]+bytecount > tif->tif_size\n\t\t\t *\n\t\t\t * comparison (which can overflow) we do the following\n\t\t\t * two comparisons:\n\t\t\t */\n\t\t\tif (bytecount > tif->tif_size ||\n\t\t\t    td->td_stripoffset[tile] > tif->tif_size - bytecount) {\n\t\t\t\ttif->tif_curtile = NOTILE;\n\t\t\t\treturn (0);\n\t\t\t}\n\t\t\ttif->tif_rawdatasize = bytecount;\n\t\t\ttif->tif_rawdata =\n\t\t\t\ttif->tif_base + td->td_stripoffset[tile];\n\t\t} else {\n\t\t\t/*\n\t\t\t * Expand raw data buffer, if needed, to hold data\n\t\t\t * tile coming from file (perhaps should set upper\n\t\t\t * bound on the size of a buffer we'll use?).\n\t\t\t */\n\t\t\tif (bytecount > (uint32)tif->tif_rawdatasize) {\n\t\t\t\ttif->tif_curtile = NOTILE;\n\t\t\t\tif ((tif->tif_flags & TIFF_MYBUFFER) == 0) {\n\t\t\t\t\tTIFFErrorExt(tif->tif_clientdata,\n\t\t\t\t\t\t     module,\n\t\t\t\t\"%s: Data buffer too small to hold tile %ld\",\n\t\t\t\t\t\t     tif->tif_name,\n\t\t\t\t\t\t     (long) tile);\n\t\t\t\t\treturn (0);\n\t\t\t\t}\n\t\t\t\tif (!TIFFReadBufferSetup(tif, 0,\n\t\t\t\t    TIFFroundup(bytecount, 1024)))\n\t\t\t\t\treturn (0);\n\t\t\t}\n\t\t\tif ((uint32)TIFFReadRawTile1(tif, tile,\n\t\t\t\t(unsigned char *)tif->tif_rawdata,\n\t\t\t\tbytecount, module) != bytecount)\n\t\t\t\treturn (0);\n\t\t\tif (!isFillOrder(tif, td->td_fillorder) &&\n\t\t\t    (tif->tif_flags & TIFF_NOBITREV) == 0)\n\t\t\t\tTIFFReverseBits(tif->tif_rawdata, bytecount);\n\t\t}\n\t}\n\treturn (TIFFStartTile(tif, tile));\n}\n\n/*\n * Setup the raw data buffer in preparation for\n * reading a strip of raw data.  If the buffer\n * is specified as zero, then a buffer of appropriate\n * size is allocated by the library.  Otherwise,\n * the client must guarantee that the buffer is\n * large enough to hold any individual strip of\n * raw data.\n */\nint\nTIFFReadBufferSetup(TIFF* tif, tdata_t bp, tsize_t size)\n{\n\tstatic const char module[] = \"TIFFReadBufferSetup\";\n\n\tassert((tif->tif_flags&TIFF_NOREADRAW)==0);\n\tif (tif->tif_rawdata) {\n\t\tif (tif->tif_flags & TIFF_MYBUFFER)\n\t\t\t_TIFFfree(tif->tif_rawdata);\n\t\ttif->tif_rawdata = NULL;\n\t}\n\tif (bp) {\n\t\ttif->tif_rawdatasize = size;\n\t\ttif->tif_rawdata = (tidata_t) bp;\n\t\ttif->tif_flags &= ~TIFF_MYBUFFER;\n\t} else {\n\t\ttif->tif_rawdatasize = TIFFroundup(size, 1024);\n\t\ttif->tif_rawdata = (tidata_t) _TIFFmalloc(tif->tif_rawdatasize);\n\t\ttif->tif_flags |= TIFF_MYBUFFER;\n\t}\n\tif (tif->tif_rawdata == NULL) {\n\t\tTIFFErrorExt(tif->tif_clientdata, module,\n\t\t    \"%s: No space for data buffer at scanline %ld\",\n\t\t    tif->tif_name, (long) tif->tif_row);\n\t\ttif->tif_rawdatasize = 0;\n\t\treturn (0);\n\t}\n\treturn (1);\n}\n\n/*\n * Set state to appear as if a\n * strip has just been read in.\n */\nstatic int\nTIFFStartStrip(TIFF* tif, tstrip_t strip)\n{\n\tTIFFDirectory *td = &tif->tif_dir;\n\n\tif ((tif->tif_flags & TIFF_CODERSETUP) == 0) {\n\t\tif (!(*tif->tif_setupdecode)(tif))\n\t\t\treturn (0);\n\t\ttif->tif_flags |= TIFF_CODERSETUP;\n\t}\n\ttif->tif_curstrip = strip;\n\ttif->tif_row = (strip % td->td_stripsperimage) * td->td_rowsperstrip;\n\tif (tif->tif_flags&TIFF_NOREADRAW)\n\t{\n\t\ttif->tif_rawcp = NULL;\n\t\ttif->tif_rawcc = 0;\n\t}\n\telse\n\t{\n\t\ttif->tif_rawcp = tif->tif_rawdata;\n\t\ttif->tif_rawcc = td->td_stripbytecount[strip];\n\t}\n\treturn ((*tif->tif_predecode)(tif,\n\t\t\t(tsample_t)(strip / td->td_stripsperimage)));\n}\n\n/*\n * Set state to appear as if a\n * tile has just been read in.\n */\nstatic int\nTIFFStartTile(TIFF* tif, ttile_t tile)\n{\n\tTIFFDirectory *td = &tif->tif_dir;\n\n\tif ((tif->tif_flags & TIFF_CODERSETUP) == 0) {\n\t\tif (!(*tif->tif_setupdecode)(tif))\n\t\t\treturn (0);\n\t\ttif->tif_flags |= TIFF_CODERSETUP;\n\t}\n\ttif->tif_curtile = tile;\n\ttif->tif_row =\n\t    (tile % TIFFhowmany(td->td_imagewidth, td->td_tilewidth)) *\n\t\ttd->td_tilelength;\n\ttif->tif_col =\n\t    (tile % TIFFhowmany(td->td_imagelength, td->td_tilelength)) *\n\t\ttd->td_tilewidth;\n\tif (tif->tif_flags&TIFF_NOREADRAW)\n\t{\n\t\ttif->tif_rawcp = NULL;\n\t\ttif->tif_rawcc = 0;\n\t}\n\telse\n\t{\n\t\ttif->tif_rawcp = tif->tif_rawdata;\n\t\ttif->tif_rawcc = td->td_stripbytecount[tile];\n\t}\n\treturn ((*tif->tif_predecode)(tif,\n\t\t\t(tsample_t)(tile/td->td_stripsperimage)));\n}\n\nstatic int\nTIFFCheckRead(TIFF* tif, int tiles)\n{\n\tif (tif->tif_mode == O_WRONLY) {\n\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name, \"File not open for reading\");\n\t\treturn (0);\n\t}\n\tif (tiles ^ isTiled(tif)) {\n\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name, tiles ?\n\t\t    \"Can not read tiles from a stripped image\" :\n\t\t    \"Can not read scanlines from a tiled image\");\n\t\treturn (0);\n\t}\n\treturn (1);\n}\n\nvoid\n_TIFFNoPostDecode(TIFF* tif, tidata_t buf, tsize_t cc)\n{\n    (void) tif; (void) buf; (void) cc;\n}\n\nvoid\n_TIFFSwab16BitData(TIFF* tif, tidata_t buf, tsize_t cc)\n{\n    (void) tif;\n    assert((cc & 1) == 0);\n    TIFFSwabArrayOfShort((uint16*) buf, cc/2);\n}\n\nvoid\n_TIFFSwab24BitData(TIFF* tif, tidata_t buf, tsize_t cc)\n{\n    (void) tif;\n    assert((cc % 3) == 0);\n    TIFFSwabArrayOfTriples((uint8*) buf, cc/3);\n}\n\nvoid\n_TIFFSwab32BitData(TIFF* tif, tidata_t buf, tsize_t cc)\n{\n    (void) tif;\n    assert((cc & 3) == 0);\n    TIFFSwabArrayOfLong((uint32*) buf, cc/4);\n}\n\nvoid\n_TIFFSwab64BitData(TIFF* tif, tidata_t buf, tsize_t cc)\n{\n    (void) tif;\n    assert((cc & 7) == 0);\n    TIFFSwabArrayOfDouble((double*) buf, cc/8);\n}\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/tif_stream.cxx",
    "content": "/* $Id: tif_stream.cxx,v 1.6.2.1 2009-01-01 00:10:43 bfriesen Exp $ */\n\n/*\n * Copyright (c) 1988-1996 Sam Leffler\n * Copyright (c) 1991-1996 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n/*\n * TIFF Library UNIX-specific Routines.\n */\n#include \"tiffiop.h\"\n#include <iostream>\n\n#ifndef __VMS\nusing namespace std;\n#endif\n\nclass tiffis_data\n{\n  public:\n\n\tistream\t*myIS;\n        long\tmyStreamStartPos;\n};\n\nclass tiffos_data\n{\n  public:\n\n\tostream\t*myOS;\n\tlong\tmyStreamStartPos;\n};\n\nstatic tsize_t\n_tiffosReadProc(thandle_t, tdata_t, tsize_t)\n{\n        return 0;\n}\n\nstatic tsize_t\n_tiffisReadProc(thandle_t fd, tdata_t buf, tsize_t size)\n{\n        tiffis_data\t*data = (tiffis_data *)fd;\n\n        data->myIS->read((char *)buf, (int)size);\n\n        return data->myIS->gcount();\n}\n\nstatic tsize_t\n_tiffosWriteProc(thandle_t fd, tdata_t buf, tsize_t size)\n{\n\ttiffos_data\t*data = (tiffos_data *)fd;\n\tostream\t\t*os = data->myOS;\n\tint\t\tpos = os->tellp();\n\n\tos->write((const char *)buf, size);\n\n\treturn ((int)os->tellp()) - pos;\n}\n\nstatic tsize_t\n_tiffisWriteProc(thandle_t, tdata_t, tsize_t)\n{\n\treturn 0;\n}\n\nstatic toff_t\n_tiffosSeekProc(thandle_t fd, toff_t off, int whence)\n{\n\ttiffos_data\t*data = (tiffos_data *)fd;\n\tostream\t*os = data->myOS;\n\n\t// if the stream has already failed, don't do anything\n\tif( os->fail() )\n\t\treturn os->tellp();\n\n\tswitch(whence) {\n\tcase SEEK_SET:\n\t    os->seekp(data->myStreamStartPos + off, ios::beg);\n\t\tbreak;\n\tcase SEEK_CUR:\n\t\tos->seekp(off, ios::cur);\n\t\tbreak;\n\tcase SEEK_END:\n\t\tos->seekp(off, ios::end);\n\t\tbreak;\n\t}\n\n\t// Attempt to workaround problems with seeking past the end of the\n\t// stream.  ofstream doesn't have a problem with this but\n\t// ostrstream/ostringstream does. In that situation, add intermediate\n\t// '\\0' characters.\n\tif( os->fail() ) {\n#ifdef __VMS\n\t\tint\t\told_state;\n#else\n\t\tios::iostate\told_state;\n#endif\n\t\ttoff_t\t\torigin=0;\n\n\t\told_state = os->rdstate();\n\t\t// reset the fail bit or else tellp() won't work below\n\t\tos->clear(os->rdstate() & ~ios::failbit);\n\t\tswitch( whence ) {\n\t\t\tcase SEEK_SET:\n\t\t\t\torigin = data->myStreamStartPos;\n\t\t\t\tbreak;\n\t\t\tcase SEEK_CUR:\n\t\t\t\torigin = os->tellp();\n\t\t\t\tbreak;\n\t\t\tcase SEEK_END:\n\t\t\t\tos->seekp(0, ios::end);\n\t\t\t\torigin = os->tellp();\n\t\t\t\tbreak;\n\t\t}\n\t\t// restore original stream state\n\t\tos->clear(old_state);\t\n\n\t\t// only do something if desired seek position is valid\n\t\tif( origin + off > data->myStreamStartPos ) {\n\t\t\ttoff_t\tnum_fill;\n\n\t\t\t// clear the fail bit \n\t\t\tos->clear(os->rdstate() & ~ios::failbit);\n\n\t\t\t// extend the stream to the expected size\n\t\t\tos->seekp(0, ios::end);\n\t\t\tnum_fill = origin + off - (toff_t)os->tellp();\n\t\t\tfor( toff_t i = 0; i < num_fill; i++ )\n\t\t\t\tos->put('\\0');\n\n\t\t\t// retry the seek\n\t\t\tos->seekp(origin + off, ios::beg);\n\t\t}\n\t}\n\n\treturn os->tellp();\n}\n\nstatic toff_t\n_tiffisSeekProc(thandle_t fd, toff_t off, int whence)\n{\n\ttiffis_data\t*data = (tiffis_data *)fd;\n\n\tswitch(whence) {\n\tcase SEEK_SET:\n\t\tdata->myIS->seekg(data->myStreamStartPos + off, ios::beg);\n\t\tbreak;\n\tcase SEEK_CUR:\n\t\tdata->myIS->seekg(off, ios::cur);\n\t\tbreak;\n\tcase SEEK_END:\n\t\tdata->myIS->seekg(off, ios::end);\n\t\tbreak;\n\t}\n\n\treturn ((long)data->myIS->tellg()) - data->myStreamStartPos;\n}\n\nstatic toff_t\n_tiffosSizeProc(thandle_t fd)\n{\n\ttiffos_data\t*data = (tiffos_data *)fd;\n\tostream\t\t*os = data->myOS;\n\ttoff_t\t\tpos = os->tellp();\n\ttoff_t\t\tlen;\n\n\tos->seekp(0, ios::end);\n\tlen = os->tellp();\n\tos->seekp(pos);\n\n\treturn len;\n}\n\nstatic toff_t\n_tiffisSizeProc(thandle_t fd)\n{\n\ttiffis_data\t*data = (tiffis_data *)fd;\n\tint\t\tpos = data->myIS->tellg();\n\tint\t\tlen;\n\n\tdata->myIS->seekg(0, ios::end);\n\tlen = data->myIS->tellg();\n\tdata->myIS->seekg(pos);\n\n\treturn len;\n}\n\nstatic int\n_tiffosCloseProc(thandle_t fd)\n{\n\t// Our stream was not allocated by us, so it shouldn't be closed by us.\n\tdelete (tiffos_data *)fd;\n\treturn 0;\n}\n\nstatic int\n_tiffisCloseProc(thandle_t fd)\n{\n\t// Our stream was not allocated by us, so it shouldn't be closed by us.\n\tdelete (tiffis_data *)fd;\n\treturn 0;\n}\n\nstatic int\n_tiffDummyMapProc(thandle_t , tdata_t* , toff_t* )\n{\n\treturn (0);\n}\n\nstatic void\n_tiffDummyUnmapProc(thandle_t , tdata_t , toff_t )\n{\n}\n\n/*\n * Open a TIFF file descriptor for read/writing.\n */\nstatic TIFF*\n_tiffStreamOpen(const char* name, const char* mode, void *fd)\n{\n\tTIFF*\ttif;\n\n\tif( strchr(mode, 'w') ) {\n\t\ttiffos_data\t*data = new tiffos_data;\n\t\tdata->myOS = (ostream *)fd;\n\t\tdata->myStreamStartPos = data->myOS->tellp();\n\n\t\t// Open for writing.\n\t\ttif = TIFFClientOpen(name, mode,\n\t\t\t\t(thandle_t) data,\n\t\t\t\t_tiffosReadProc, _tiffosWriteProc,\n\t\t\t\t_tiffosSeekProc, _tiffosCloseProc,\n\t\t\t\t_tiffosSizeProc,\n\t\t\t\t_tiffDummyMapProc, _tiffDummyUnmapProc);\n\t} else {\n\t\ttiffis_data\t*data = new tiffis_data;\n\t\tdata->myIS = (istream *)fd;\n\t\tdata->myStreamStartPos = data->myIS->tellg();\n\t\t// Open for reading.\n\t\ttif = TIFFClientOpen(name, mode,\n\t\t\t\t(thandle_t) data,\n\t\t\t\t_tiffisReadProc, _tiffisWriteProc,\n\t\t\t\t_tiffisSeekProc, _tiffisCloseProc,\n\t\t\t\t_tiffisSizeProc,\n\t\t\t\t_tiffDummyMapProc, _tiffDummyUnmapProc);\n\t}\n\n\treturn (tif);\n}\n\nTIFF*\nTIFFStreamOpen(const char* name, ostream *os)\n{\n\t// If os is either a ostrstream or ostringstream, and has no data\n\t// written to it yet, then tellp() will return -1 which will break us.\n\t// We workaround this by writing out a dummy character and\n\t// then seek back to the beginning.\n\tif( !os->fail() && (int)os->tellp() < 0 ) {\n\t\t*os << '\\0';\n\t\tos->seekp(0);\n\t}\n\n\t// NB: We don't support mapped files with streams so add 'm'\n\treturn _tiffStreamOpen(name, \"wm\", os);\n}\n\nTIFF*\nTIFFStreamOpen(const char* name, istream *is)\n{\n\t// NB: We don't support mapped files with streams so add 'm'\n\treturn _tiffStreamOpen(name, \"rm\", is);\n}\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/tif_strip.c",
    "content": "/* $Id: tif_strip.c,v 1.19 2006/03/25 18:04:35 joris Exp $ */\n\n/*\n * Copyright (c) 1991-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n/*\n * TIFF Library.\n *\n * Strip-organized Image Support Routines.\n */\n#include \"tiffiop.h\"\n\nstatic uint32\nsummarize(TIFF* tif, size_t summand1, size_t summand2, const char* where)\n{\n\t/*\n\t * XXX: We are using casting to uint32 here, bacause sizeof(size_t)\n\t * may be larger than sizeof(uint32) on 64-bit architectures.\n\t */\n\tuint32\tbytes = summand1 + summand2;\n\n\tif (bytes - summand1 != summand2) {\n\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name, \"Integer overflow in %s\", where);\n\t\tbytes = 0;\n\t}\n\n\treturn (bytes);\n}\n\nstatic uint32\nmultiply(TIFF* tif, size_t nmemb, size_t elem_size, const char* where)\n{\n\tuint32\tbytes = nmemb * elem_size;\n\n\tif (elem_size && bytes / elem_size != nmemb) {\n\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name, \"Integer overflow in %s\", where);\n\t\tbytes = 0;\n\t}\n\n\treturn (bytes);\n}\n\n/*\n * Compute which strip a (row,sample) value is in.\n */\ntstrip_t\nTIFFComputeStrip(TIFF* tif, uint32 row, tsample_t sample)\n{\n\tTIFFDirectory *td = &tif->tif_dir;\n\ttstrip_t strip;\n\n\tstrip = row / td->td_rowsperstrip;\n\tif (td->td_planarconfig == PLANARCONFIG_SEPARATE) {\n\t\tif (sample >= td->td_samplesperpixel) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t\t    \"%lu: Sample out of range, max %lu\",\n\t\t\t    (unsigned long) sample, (unsigned long) td->td_samplesperpixel);\n\t\t\treturn ((tstrip_t) 0);\n\t\t}\n\t\tstrip += sample*td->td_stripsperimage;\n\t}\n\treturn (strip);\n}\n\n/*\n * Compute how many strips are in an image.\n */\ntstrip_t\nTIFFNumberOfStrips(TIFF* tif)\n{\n\tTIFFDirectory *td = &tif->tif_dir;\n\ttstrip_t nstrips;\n\n\tnstrips = (td->td_rowsperstrip == (uint32) -1 ? 1 :\n\t     TIFFhowmany(td->td_imagelength, td->td_rowsperstrip));\n\tif (td->td_planarconfig == PLANARCONFIG_SEPARATE)\n\t\tnstrips = multiply(tif, nstrips, td->td_samplesperpixel,\n\t\t\t\t   \"TIFFNumberOfStrips\");\n\treturn (nstrips);\n}\n\n/*\n * Compute the # bytes in a variable height, row-aligned strip.\n */\ntsize_t\nTIFFVStripSize(TIFF* tif, uint32 nrows)\n{\n\tTIFFDirectory *td = &tif->tif_dir;\n\n\tif (nrows == (uint32) -1)\n\t\tnrows = td->td_imagelength;\n\tif (td->td_planarconfig == PLANARCONFIG_CONTIG &&\n\t    td->td_photometric == PHOTOMETRIC_YCBCR &&\n\t    !isUpSampled(tif)) {\n\t\t/*\n\t\t * Packed YCbCr data contain one Cb+Cr for every\n\t\t * HorizontalSampling*VerticalSampling Y values.\n\t\t * Must also roundup width and height when calculating\n\t\t * since images that are not a multiple of the\n\t\t * horizontal/vertical subsampling area include\n\t\t * YCbCr data for the extended image.\n\t\t */\n\t\tuint16 ycbcrsubsampling[2];\n\t\ttsize_t w, scanline, samplingarea;\n\n\t\tTIFFGetField( tif, TIFFTAG_YCBCRSUBSAMPLING,\n\t\t\t      ycbcrsubsampling + 0,\n\t\t\t      ycbcrsubsampling + 1 );\n\n\t\tsamplingarea = ycbcrsubsampling[0]*ycbcrsubsampling[1];\n\t\tif (samplingarea == 0) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t\t\t     \"Invalid YCbCr subsampling\");\n\t\t\treturn 0;\n\t\t}\n\n\t\tw = TIFFroundup(td->td_imagewidth, ycbcrsubsampling[0]);\n\t\tscanline = TIFFhowmany8(multiply(tif, w, td->td_bitspersample,\n\t\t\t\t\t\t \"TIFFVStripSize\"));\n\t\tnrows = TIFFroundup(nrows, ycbcrsubsampling[1]);\n\t\t/* NB: don't need TIFFhowmany here 'cuz everything is rounded */\n\t\tscanline = multiply(tif, nrows, scanline, \"TIFFVStripSize\");\n\t\treturn ((tsize_t)\n\t\t    summarize(tif, scanline,\n\t\t\t      multiply(tif, 2, scanline / samplingarea,\n\t\t\t\t       \"TIFFVStripSize\"), \"TIFFVStripSize\"));\n\t} else\n\t\treturn ((tsize_t) multiply(tif, nrows, TIFFScanlineSize(tif),\n\t\t\t\t\t   \"TIFFVStripSize\"));\n}\n\n\n/*\n * Compute the # bytes in a raw strip.\n */\ntsize_t\nTIFFRawStripSize(TIFF* tif, tstrip_t strip)\n{\n\tTIFFDirectory* td = &tif->tif_dir;\n\ttsize_t bytecount = td->td_stripbytecount[strip];\n\n\tif (bytecount <= 0) {\n\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t\t  \"%lu: Invalid strip byte count, strip %lu\",\n\t\t\t  (unsigned long) bytecount, (unsigned long) strip);\n\t\tbytecount = (tsize_t) -1;\n\t}\n\n\treturn bytecount;\n}\n\n/*\n * Compute the # bytes in a (row-aligned) strip.\n *\n * Note that if RowsPerStrip is larger than the\n * recorded ImageLength, then the strip size is\n * truncated to reflect the actual space required\n * to hold the strip.\n */\ntsize_t\nTIFFStripSize(TIFF* tif)\n{\n\tTIFFDirectory* td = &tif->tif_dir;\n\tuint32 rps = td->td_rowsperstrip;\n\tif (rps > td->td_imagelength)\n\t\trps = td->td_imagelength;\n\treturn (TIFFVStripSize(tif, rps));\n}\n\n/*\n * Compute a default strip size based on the image\n * characteristics and a requested value.  If the\n * request is <1 then we choose a strip size according\n * to certain heuristics.\n */\nuint32\nTIFFDefaultStripSize(TIFF* tif, uint32 request)\n{\n\treturn (*tif->tif_defstripsize)(tif, request);\n}\n\nuint32\n_TIFFDefaultStripSize(TIFF* tif, uint32 s)\n{\n\tif ((int32) s < 1) {\n\t\t/*\n\t\t * If RowsPerStrip is unspecified, try to break the\n\t\t * image up into strips that are approximately\n\t\t * STRIP_SIZE_DEFAULT bytes long.\n\t\t */\n\t\ttsize_t scanline = TIFFScanlineSize(tif);\n\t\ts = (uint32)STRIP_SIZE_DEFAULT / (scanline == 0 ? 1 : scanline);\n\t\tif (s == 0)\t\t/* very wide images */\n\t\t\ts = 1;\n\t}\n\treturn (s);\n}\n\n/*\n * Return the number of bytes to read/write in a call to\n * one of the scanline-oriented i/o routines.  Note that\n * this number may be 1/samples-per-pixel if data is\n * stored as separate planes.\n */\ntsize_t\nTIFFScanlineSize(TIFF* tif)\n{\n\tTIFFDirectory *td = &tif->tif_dir;\n\ttsize_t scanline;\n\n\tif (td->td_planarconfig == PLANARCONFIG_CONTIG) {\n\t\tif (td->td_photometric == PHOTOMETRIC_YCBCR\n\t\t    && !isUpSampled(tif)) {\n\t\t\tuint16 ycbcrsubsampling[2];\n\n\t\t\tTIFFGetField(tif, TIFFTAG_YCBCRSUBSAMPLING,\n\t\t\t\t     ycbcrsubsampling + 0,\n\t\t\t\t     ycbcrsubsampling + 1);\n\n\t\t\tif (ycbcrsubsampling[0] == 0) {\n\t\t\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t\t\t\t     \"Invalid YCbCr subsampling\");\n\t\t\t\treturn 0;\n\t\t\t}\n\n\t\t\tscanline = TIFFroundup(td->td_imagewidth,\n\t\t\t\t\t       ycbcrsubsampling[0]);\n\t\t\tscanline = TIFFhowmany8(multiply(tif, scanline,\n\t\t\t\t\t\t\t td->td_bitspersample,\n\t\t\t\t\t\t\t \"TIFFScanlineSize\"));\n\t\t\treturn ((tsize_t)\n\t\t\t\tsummarize(tif, scanline,\n\t\t\t\t\t  multiply(tif, 2,\n\t\t\t\t\t\tscanline / ycbcrsubsampling[0],\n\t\t\t\t\t\t\"TIFFVStripSize\"),\n\t\t\t\t\t  \"TIFFVStripSize\"));\n\t\t} else {\n\t\t\tscanline = multiply(tif, td->td_imagewidth,\n\t\t\t\t\t    td->td_samplesperpixel,\n\t\t\t\t\t    \"TIFFScanlineSize\");\n\t\t}\n\t} else\n\t\tscanline = td->td_imagewidth;\n\treturn ((tsize_t) TIFFhowmany8(multiply(tif, scanline,\n\t\t\t\t\t\ttd->td_bitspersample,\n\t\t\t\t\t\t\"TIFFScanlineSize\")));\n}\n\n/*\n * Some stuff depends on this older version of TIFFScanlineSize\n * TODO: resolve this\n */\ntsize_t\nTIFFOldScanlineSize(TIFF* tif)\n{\n\tTIFFDirectory *td = &tif->tif_dir;\n\ttsize_t scanline;\n\n\tscanline = multiply (tif, td->td_bitspersample, td->td_imagewidth,\n\t\t\t     \"TIFFScanlineSize\");\n\tif (td->td_planarconfig == PLANARCONFIG_CONTIG)\n\t\tscanline = multiply (tif, scanline, td->td_samplesperpixel,\n\t\t\t\t     \"TIFFScanlineSize\");\n\treturn ((tsize_t) TIFFhowmany8(scanline));\n}\n\n/*\n * Return the number of bytes to read/write in a call to\n * one of the scanline-oriented i/o routines.  Note that\n * this number may be 1/samples-per-pixel if data is\n * stored as separate planes.\n * The ScanlineSize in case of YCbCrSubsampling is defined as the\n * strip size divided by the strip height, i.e. the size of a pack of vertical\n * subsampling lines divided by vertical subsampling. It should thus make\n * sense when multiplied by a multiple of vertical subsampling.\n * Some stuff depends on this newer version of TIFFScanlineSize\n * TODO: resolve this\n */\ntsize_t\nTIFFNewScanlineSize(TIFF* tif)\n{\n\tTIFFDirectory *td = &tif->tif_dir;\n\ttsize_t scanline;\n\n\tif (td->td_planarconfig == PLANARCONFIG_CONTIG) {\n\t\tif (td->td_photometric == PHOTOMETRIC_YCBCR\n\t\t    && !isUpSampled(tif)) {\n\t\t\tuint16 ycbcrsubsampling[2];\n\n\t\t\tTIFFGetField(tif, TIFFTAG_YCBCRSUBSAMPLING,\n\t\t\t\t     ycbcrsubsampling + 0,\n\t\t\t\t     ycbcrsubsampling + 1);\n\n\t\t\tif (ycbcrsubsampling[0]*ycbcrsubsampling[1] == 0) {\n\t\t\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t\t\t\t     \"Invalid YCbCr subsampling\");\n\t\t\t\treturn 0;\n\t\t\t}\n\n\t\t\treturn((tsize_t) ((((td->td_imagewidth+ycbcrsubsampling[0]-1)\n\t\t\t\t\t    /ycbcrsubsampling[0])\n\t\t\t\t\t   *(ycbcrsubsampling[0]*ycbcrsubsampling[1]+2)\n\t\t\t\t\t   *td->td_bitspersample+7)\n\t\t\t\t\t  /8)/ycbcrsubsampling[1]);\n\n\t\t} else {\n\t\t\tscanline = multiply(tif, td->td_imagewidth,\n\t\t\t\t\t    td->td_samplesperpixel,\n\t\t\t\t\t    \"TIFFScanlineSize\");\n\t\t}\n\t} else\n\t\tscanline = td->td_imagewidth;\n\treturn ((tsize_t) TIFFhowmany8(multiply(tif, scanline,\n\t\t\t\t\t\ttd->td_bitspersample,\n\t\t\t\t\t\t\"TIFFScanlineSize\")));\n}\n\n/*\n * Return the number of bytes required to store a complete\n * decoded and packed raster scanline (as opposed to the\n * I/O size returned by TIFFScanlineSize which may be less\n * if data is store as separate planes).\n */\ntsize_t\nTIFFRasterScanlineSize(TIFF* tif)\n{\n\tTIFFDirectory *td = &tif->tif_dir;\n\ttsize_t scanline;\n\t\n\tscanline = multiply (tif, td->td_bitspersample, td->td_imagewidth,\n\t\t\t     \"TIFFRasterScanlineSize\");\n\tif (td->td_planarconfig == PLANARCONFIG_CONTIG) {\n\t\tscanline = multiply (tif, scanline, td->td_samplesperpixel,\n\t\t\t\t     \"TIFFRasterScanlineSize\");\n\t\treturn ((tsize_t) TIFFhowmany8(scanline));\n\t} else\n\t\treturn ((tsize_t) multiply (tif, TIFFhowmany8(scanline),\n\t\t\t\t\t    td->td_samplesperpixel,\n\t\t\t\t\t    \"TIFFRasterScanlineSize\"));\n}\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/tif_swab.c",
    "content": "/* $Id: tif_swab.c,v 1.4 2005/04/13 14:06:21 dron Exp $ */\n\n/*\n * Copyright (c) 1988-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n/*\n * TIFF Library Bit & Byte Swapping Support.\n *\n * XXX We assume short = 16-bits and long = 32-bits XXX\n */\n#include \"tiffiop.h\"\n\n#ifndef TIFFSwabShort\nvoid\nTIFFSwabShort(uint16* wp)\n{\n\tregister unsigned char* cp = (unsigned char*) wp;\n\tunsigned char t;\n\n\tt = cp[1]; cp[1] = cp[0]; cp[0] = t;\n}\n#endif\n\n#ifndef TIFFSwabLong\nvoid\nTIFFSwabLong(uint32* lp)\n{\n\tregister unsigned char* cp = (unsigned char*) lp;\n\tunsigned char t;\n\n\tt = cp[3]; cp[3] = cp[0]; cp[0] = t;\n\tt = cp[2]; cp[2] = cp[1]; cp[1] = t;\n}\n#endif\n\n#ifndef TIFFSwabArrayOfShort\nvoid\nTIFFSwabArrayOfShort(uint16* wp, register unsigned long n)\n{\n\tregister unsigned char* cp;\n\tregister unsigned char t;\n\n\t/* XXX unroll loop some */\n\twhile (n-- > 0) {\n\t\tcp = (unsigned char*) wp;\n\t\tt = cp[1]; cp[1] = cp[0]; cp[0] = t;\n\t\twp++;\n\t}\n}\n#endif\n\n#ifndef TIFFSwabArrayOfTriples\nvoid\nTIFFSwabArrayOfTriples(uint8* tp, unsigned long n)\n{\n\tunsigned char* cp;\n\tunsigned char t;\n\n\t/* XXX unroll loop some */\n\twhile (n-- > 0) {\n\t\tcp = (unsigned char*) tp;\n\t\tt = cp[2]; cp[2] = cp[0]; cp[0] = t;\n\t\ttp += 3;\n\t}\n}\n#endif\n\n#ifndef TIFFSwabArrayOfLong\nvoid\nTIFFSwabArrayOfLong(register uint32* lp, register unsigned long n)\n{\n\tregister unsigned char *cp;\n\tregister unsigned char t;\n\n\t/* XXX unroll loop some */\n\twhile (n-- > 0) {\n\t\tcp = (unsigned char *)lp;\n\t\tt = cp[3]; cp[3] = cp[0]; cp[0] = t;\n\t\tt = cp[2]; cp[2] = cp[1]; cp[1] = t;\n\t\tlp++;\n\t}\n}\n#endif\n\n#ifndef TIFFSwabDouble\nvoid\nTIFFSwabDouble(double *dp)\n{\n        register uint32* lp = (uint32*) dp;\n        uint32 t;\n\n\tTIFFSwabArrayOfLong(lp, 2);\n\tt = lp[0]; lp[0] = lp[1]; lp[1] = t;\n}\n#endif\n\n#ifndef TIFFSwabArrayOfDouble\nvoid\nTIFFSwabArrayOfDouble(double* dp, register unsigned long n)\n{\n\tregister uint32* lp = (uint32*) dp;\n        register uint32 t;\n\n\tTIFFSwabArrayOfLong(lp, n + n);\n        while (n-- > 0) {\n\t\tt = lp[0]; lp[0] = lp[1]; lp[1] = t;\n                lp += 2;\n        }\n}\n#endif\n\n/*\n * Bit reversal tables.  TIFFBitRevTable[<byte>] gives\n * the bit reversed value of <byte>.  Used in various\n * places in the library when the FillOrder requires\n * bit reversal of byte values (e.g. CCITT Fax 3\n * encoding/decoding).  TIFFNoBitRevTable is provided\n * for algorithms that want an equivalent table that\n * do not reverse bit values.\n */\nstatic const unsigned char TIFFBitRevTable[256] = {\n    0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0,\n    0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0,\n    0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8,\n    0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8,\n    0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4,\n    0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4,\n    0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec,\n    0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc,\n    0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2,\n    0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2,\n    0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea,\n    0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa,\n    0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6,\n    0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6,\n    0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee,\n    0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe,\n    0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1,\n    0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1,\n    0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9,\n    0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9,\n    0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5,\n    0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5,\n    0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed,\n    0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd,\n    0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3,\n    0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3,\n    0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb,\n    0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb,\n    0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7,\n    0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7,\n    0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef,\n    0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff\n};\nstatic const unsigned char TIFFNoBitRevTable[256] = {\n    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, \n    0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, \n    0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, \n    0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, \n    0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, \n    0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, \n    0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, \n    0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, \n    0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, \n    0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, \n    0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, \n    0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, \n    0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, \n    0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, \n    0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, \n    0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, \n    0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, \n    0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, \n    0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, \n    0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, \n    0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, \n    0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, \n    0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, \n    0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, \n    0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, \n    0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, \n    0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, \n    0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, \n    0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, \n    0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, \n    0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, \n    0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, \n};\n\nconst unsigned char*\nTIFFGetBitRevTable(int reversed)\n{\n\treturn (reversed ? TIFFBitRevTable : TIFFNoBitRevTable);\n}\n\nvoid\nTIFFReverseBits(register unsigned char* cp, register unsigned long n)\n{\n\tfor (; n > 8; n -= 8) {\n\t\tcp[0] = TIFFBitRevTable[cp[0]];\n\t\tcp[1] = TIFFBitRevTable[cp[1]];\n\t\tcp[2] = TIFFBitRevTable[cp[2]];\n\t\tcp[3] = TIFFBitRevTable[cp[3]];\n\t\tcp[4] = TIFFBitRevTable[cp[4]];\n\t\tcp[5] = TIFFBitRevTable[cp[5]];\n\t\tcp[6] = TIFFBitRevTable[cp[6]];\n\t\tcp[7] = TIFFBitRevTable[cp[7]];\n\t\tcp += 8;\n\t}\n\twhile (n-- > 0)\n\t\t*cp = TIFFBitRevTable[*cp], cp++;\n}\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/tif_thunder.c",
    "content": "/* $Id: tif_thunder.c,v 1.5 2005/12/21 12:23:13 joris Exp $ */\n\n/*\n * Copyright (c) 1988-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n#include \"tiffiop.h\"\n#ifdef THUNDER_SUPPORT\n/*\n * TIFF Library.\n *\n * ThunderScan 4-bit Compression Algorithm Support\n */\n\n/*\n * ThunderScan uses an encoding scheme designed for\n * 4-bit pixel values.  Data is encoded in bytes, with\n * each byte split into a 2-bit code word and a 6-bit\n * data value.  The encoding gives raw data, runs of\n * pixels, or pixel values encoded as a delta from the\n * previous pixel value.  For the latter, either 2-bit\n * or 3-bit delta values are used, with the deltas packed\n * into a single byte.\n */\n#define\tTHUNDER_DATA\t\t0x3f\t/* mask for 6-bit data */\n#define\tTHUNDER_CODE\t\t0xc0\t/* mask for 2-bit code word */\n/* code values */\n#define\tTHUNDER_RUN\t\t0x00\t/* run of pixels w/ encoded count */\n#define\tTHUNDER_2BITDELTAS\t0x40\t/* 3 pixels w/ encoded 2-bit deltas */\n#define\t    DELTA2_SKIP\t\t2\t/* skip code for 2-bit deltas */\n#define\tTHUNDER_3BITDELTAS\t0x80\t/* 2 pixels w/ encoded 3-bit deltas */\n#define\t    DELTA3_SKIP\t\t4\t/* skip code for 3-bit deltas */\n#define\tTHUNDER_RAW\t\t0xc0\t/* raw data encoded */\n\nstatic const int twobitdeltas[4] = { 0, 1, 0, -1 };\nstatic const int threebitdeltas[8] = { 0, 1, 2, 3, 0, -3, -2, -1 };\n\n#define\tSETPIXEL(op, v) { \\\n\tlastpixel = (v) & 0xf; \\\n\tif (npixels++ & 1) \\\n\t    *op++ |= lastpixel; \\\n\telse \\\n\t    op[0] = (tidataval_t) (lastpixel << 4); \\\n}\n\nstatic int\nThunderDecode(TIFF* tif, tidata_t op, tsize_t maxpixels)\n{\n\tregister unsigned char *bp;\n\tregister tsize_t cc;\n\tunsigned int lastpixel;\n\ttsize_t npixels;\n\n\tbp = (unsigned char *)tif->tif_rawcp;\n\tcc = tif->tif_rawcc;\n\tlastpixel = 0;\n\tnpixels = 0;\n\twhile (cc > 0 && npixels < maxpixels) {\n\t\tint n, delta;\n\n\t\tn = *bp++, cc--;\n\t\tswitch (n & THUNDER_CODE) {\n\t\tcase THUNDER_RUN:\t\t/* pixel run */\n\t\t\t/*\n\t\t\t * Replicate the last pixel n times,\n\t\t\t * where n is the lower-order 6 bits.\n\t\t\t */\n\t\t\tif (npixels & 1) {\n\t\t\t\top[0] |= lastpixel;\n\t\t\t\tlastpixel = *op++; npixels++; n--;\n\t\t\t} else\n\t\t\t\tlastpixel |= lastpixel << 4;\n\t\t\tnpixels += n;\n\t\t\tif (npixels < maxpixels) {\n\t\t\t\tfor (; n > 0; n -= 2)\n\t\t\t\t\t*op++ = (tidataval_t) lastpixel;\n\t\t\t}\n\t\t\tif (n == -1)\n\t\t\t\t*--op &= 0xf0;\n\t\t\tlastpixel &= 0xf;\n\t\t\tbreak;\n\t\tcase THUNDER_2BITDELTAS:\t/* 2-bit deltas */\n\t\t\tif ((delta = ((n >> 4) & 3)) != DELTA2_SKIP)\n\t\t\t\tSETPIXEL(op, lastpixel + twobitdeltas[delta]);\n\t\t\tif ((delta = ((n >> 2) & 3)) != DELTA2_SKIP)\n\t\t\t\tSETPIXEL(op, lastpixel + twobitdeltas[delta]);\n\t\t\tif ((delta = (n & 3)) != DELTA2_SKIP)\n\t\t\t\tSETPIXEL(op, lastpixel + twobitdeltas[delta]);\n\t\t\tbreak;\n\t\tcase THUNDER_3BITDELTAS:\t/* 3-bit deltas */\n\t\t\tif ((delta = ((n >> 3) & 7)) != DELTA3_SKIP)\n\t\t\t\tSETPIXEL(op, lastpixel + threebitdeltas[delta]);\n\t\t\tif ((delta = (n & 7)) != DELTA3_SKIP)\n\t\t\t\tSETPIXEL(op, lastpixel + threebitdeltas[delta]);\n\t\t\tbreak;\n\t\tcase THUNDER_RAW:\t\t/* raw data */\n\t\t\tSETPIXEL(op, n);\n\t\t\tbreak;\n\t\t}\n\t}\n\ttif->tif_rawcp = (tidata_t) bp;\n\ttif->tif_rawcc = cc;\n\tif (npixels != maxpixels) {\n\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t    \"ThunderDecode: %s data at scanline %ld (%lu != %lu)\",\n\t\t    npixels < maxpixels ? \"Not enough\" : \"Too much\",\n\t\t    (long) tif->tif_row, (long) npixels, (long) maxpixels);\n\t\treturn (0);\n\t}\n\treturn (1);\n}\n\nstatic int\nThunderDecodeRow(TIFF* tif, tidata_t buf, tsize_t occ, tsample_t s)\n{\n\ttidata_t row = buf;\n\t\n\t(void) s;\n\twhile ((long)occ > 0) {\n\t\tif (!ThunderDecode(tif, row, tif->tif_dir.td_imagewidth))\n\t\t\treturn (0);\n\t\tocc -= tif->tif_scanlinesize;\n\t\trow += tif->tif_scanlinesize;\n\t}\n\treturn (1);\n}\n\nint\nTIFFInitThunderScan(TIFF* tif, int scheme)\n{\n\t(void) scheme;\n\ttif->tif_decoderow = ThunderDecodeRow;\n\ttif->tif_decodestrip = ThunderDecodeRow;\n\treturn (1);\n}\n#endif /* THUNDER_SUPPORT */\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/tif_tile.c",
    "content": "/* $Id: tif_tile.c,v 1.12 2006/02/09 16:15:43 dron Exp $ */\n\n/*\n * Copyright (c) 1991-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n/*\n * TIFF Library.\n *\n * Tiled Image Support Routines.\n */\n#include \"tiffiop.h\"\n\nstatic uint32\nsummarize(TIFF* tif, size_t summand1, size_t summand2, const char* where)\n{\n\t/*\n\t * XXX: We are using casting to uint32 here, because sizeof(size_t)\n\t * may be larger than sizeof(uint32) on 64-bit architectures.\n\t */\n\tuint32\tbytes = summand1 + summand2;\n\n\tif (bytes - summand1 != summand2) {\n\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name, \"Integer overflow in %s\", where);\n\t\tbytes = 0;\n\t}\n\n\treturn (bytes);\n}\n\nstatic uint32\nmultiply(TIFF* tif, size_t nmemb, size_t elem_size, const char* where)\n{\n\tuint32\tbytes = nmemb * elem_size;\n\n\tif (elem_size && bytes / elem_size != nmemb) {\n\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name, \"Integer overflow in %s\", where);\n\t\tbytes = 0;\n\t}\n\n\treturn (bytes);\n}\n\n/*\n * Compute which tile an (x,y,z,s) value is in.\n */\nttile_t\nTIFFComputeTile(TIFF* tif, uint32 x, uint32 y, uint32 z, tsample_t s)\n{\n\tTIFFDirectory *td = &tif->tif_dir;\n\tuint32 dx = td->td_tilewidth;\n\tuint32 dy = td->td_tilelength;\n\tuint32 dz = td->td_tiledepth;\n\tttile_t tile = 1;\n\n\tif (td->td_imagedepth == 1)\n\t\tz = 0;\n\tif (dx == (uint32) -1)\n\t\tdx = td->td_imagewidth;\n\tif (dy == (uint32) -1)\n\t\tdy = td->td_imagelength;\n\tif (dz == (uint32) -1)\n\t\tdz = td->td_imagedepth;\n\tif (dx != 0 && dy != 0 && dz != 0) {\n\t\tuint32 xpt = TIFFhowmany(td->td_imagewidth, dx); \n\t\tuint32 ypt = TIFFhowmany(td->td_imagelength, dy); \n\t\tuint32 zpt = TIFFhowmany(td->td_imagedepth, dz); \n\n\t\tif (td->td_planarconfig == PLANARCONFIG_SEPARATE) \n\t\t\ttile = (xpt*ypt*zpt)*s +\n\t\t\t     (xpt*ypt)*(z/dz) +\n\t\t\t     xpt*(y/dy) +\n\t\t\t     x/dx;\n\t\telse\n\t\t\ttile = (xpt*ypt)*(z/dz) + xpt*(y/dy) + x/dx;\n\t}\n\treturn (tile);\n}\n\n/*\n * Check an (x,y,z,s) coordinate\n * against the image bounds.\n */\nint\nTIFFCheckTile(TIFF* tif, uint32 x, uint32 y, uint32 z, tsample_t s)\n{\n\tTIFFDirectory *td = &tif->tif_dir;\n\n\tif (x >= td->td_imagewidth) {\n\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t\t     \"%lu: Col out of range, max %lu\",\n\t\t\t     (unsigned long) x,\n\t\t\t     (unsigned long) (td->td_imagewidth - 1));\n\t\treturn (0);\n\t}\n\tif (y >= td->td_imagelength) {\n\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t\t     \"%lu: Row out of range, max %lu\",\n\t\t\t     (unsigned long) y,\n\t\t\t     (unsigned long) (td->td_imagelength - 1));\n\t\treturn (0);\n\t}\n\tif (z >= td->td_imagedepth) {\n\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t\t     \"%lu: Depth out of range, max %lu\",\n\t\t\t     (unsigned long) z,\n\t\t\t     (unsigned long) (td->td_imagedepth - 1));\n\t\treturn (0);\n\t}\n\tif (td->td_planarconfig == PLANARCONFIG_SEPARATE &&\n\t    s >= td->td_samplesperpixel) {\n\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t\t     \"%lu: Sample out of range, max %lu\",\n\t\t\t     (unsigned long) s,\n\t\t\t     (unsigned long) (td->td_samplesperpixel - 1));\n\t\treturn (0);\n\t}\n\treturn (1);\n}\n\n/*\n * Compute how many tiles are in an image.\n */\nttile_t\nTIFFNumberOfTiles(TIFF* tif)\n{\n\tTIFFDirectory *td = &tif->tif_dir;\n\tuint32 dx = td->td_tilewidth;\n\tuint32 dy = td->td_tilelength;\n\tuint32 dz = td->td_tiledepth;\n\tttile_t ntiles;\n\n\tif (dx == (uint32) -1)\n\t\tdx = td->td_imagewidth;\n\tif (dy == (uint32) -1)\n\t\tdy = td->td_imagelength;\n\tif (dz == (uint32) -1)\n\t\tdz = td->td_imagedepth;\n\tntiles = (dx == 0 || dy == 0 || dz == 0) ? 0 :\n\t    multiply(tif, multiply(tif, TIFFhowmany(td->td_imagewidth, dx),\n\t\t\t\t   TIFFhowmany(td->td_imagelength, dy),\n\t\t\t\t   \"TIFFNumberOfTiles\"),\n\t\t     TIFFhowmany(td->td_imagedepth, dz), \"TIFFNumberOfTiles\");\n\tif (td->td_planarconfig == PLANARCONFIG_SEPARATE)\n\t\tntiles = multiply(tif, ntiles, td->td_samplesperpixel,\n\t\t\t\t  \"TIFFNumberOfTiles\");\n\treturn (ntiles);\n}\n\n/*\n * Compute the # bytes in each row of a tile.\n */\ntsize_t\nTIFFTileRowSize(TIFF* tif)\n{\n\tTIFFDirectory *td = &tif->tif_dir;\n\ttsize_t rowsize;\n\t\n\tif (td->td_tilelength == 0 || td->td_tilewidth == 0)\n\t\treturn ((tsize_t) 0);\n\trowsize = multiply(tif, td->td_bitspersample, td->td_tilewidth,\n\t\t\t   \"TIFFTileRowSize\");\n\tif (td->td_planarconfig == PLANARCONFIG_CONTIG)\n\t\trowsize = multiply(tif, rowsize, td->td_samplesperpixel,\n\t\t\t\t   \"TIFFTileRowSize\");\n\treturn ((tsize_t) TIFFhowmany8(rowsize));\n}\n\n/*\n * Compute the # bytes in a variable length, row-aligned tile.\n */\ntsize_t\nTIFFVTileSize(TIFF* tif, uint32 nrows)\n{\n\tTIFFDirectory *td = &tif->tif_dir;\n\ttsize_t tilesize;\n\n\tif (td->td_tilelength == 0 || td->td_tilewidth == 0 ||\n\t    td->td_tiledepth == 0)\n\t\treturn ((tsize_t) 0);\n\tif (td->td_planarconfig == PLANARCONFIG_CONTIG &&\n\t    td->td_photometric == PHOTOMETRIC_YCBCR &&\n\t    !isUpSampled(tif)) {\n\t\t/*\n\t\t * Packed YCbCr data contain one Cb+Cr for every\n\t\t * HorizontalSampling*VerticalSampling Y values.\n\t\t * Must also roundup width and height when calculating\n\t\t * since images that are not a multiple of the\n\t\t * horizontal/vertical subsampling area include\n\t\t * YCbCr data for the extended image.\n\t\t */\n\t\ttsize_t w =\n\t\t    TIFFroundup(td->td_tilewidth, td->td_ycbcrsubsampling[0]);\n\t\ttsize_t rowsize =\n\t\t    TIFFhowmany8(multiply(tif, w, td->td_bitspersample,\n\t\t\t\t\t  \"TIFFVTileSize\"));\n\t\ttsize_t samplingarea =\n\t\t    td->td_ycbcrsubsampling[0]*td->td_ycbcrsubsampling[1];\n\t\tif (samplingarea == 0) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name, \"Invalid YCbCr subsampling\");\n\t\t\treturn 0;\n\t\t}\n\t\tnrows = TIFFroundup(nrows, td->td_ycbcrsubsampling[1]);\n\t\t/* NB: don't need TIFFhowmany here 'cuz everything is rounded */\n\t\ttilesize = multiply(tif, nrows, rowsize, \"TIFFVTileSize\");\n\t\ttilesize = summarize(tif, tilesize,\n\t\t\t\t     multiply(tif, 2, tilesize / samplingarea,\n\t\t\t\t\t      \"TIFFVTileSize\"),\n\t\t\t\t     \"TIFFVTileSize\");\n\t} else\n\t\ttilesize = multiply(tif, nrows, TIFFTileRowSize(tif),\n\t\t\t\t    \"TIFFVTileSize\");\n\treturn ((tsize_t)\n\t    multiply(tif, tilesize, td->td_tiledepth, \"TIFFVTileSize\"));\n}\n\n/*\n * Compute the # bytes in a row-aligned tile.\n */\ntsize_t\nTIFFTileSize(TIFF* tif)\n{\n\treturn (TIFFVTileSize(tif, tif->tif_dir.td_tilelength));\n}\n\n/*\n * Compute a default tile size based on the image\n * characteristics and a requested value.  If a\n * request is <1 then we choose a size according\n * to certain heuristics.\n */\nvoid\nTIFFDefaultTileSize(TIFF* tif, uint32* tw, uint32* th)\n{\n\t(*tif->tif_deftilesize)(tif, tw, th);\n}\n\nvoid\n_TIFFDefaultTileSize(TIFF* tif, uint32* tw, uint32* th)\n{\n\t(void) tif;\n\tif (*(int32*) tw < 1)\n\t\t*tw = 256;\n\tif (*(int32*) th < 1)\n\t\t*th = 256;\n\t/* roundup to a multiple of 16 per the spec */\n\tif (*tw & 0xf)\n\t\t*tw = TIFFroundup(*tw, 16);\n\tif (*th & 0xf)\n\t\t*th = TIFFroundup(*th, 16);\n}\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/tif_unix.c",
    "content": "/* $Id: tif_unix.c,v 1.12 2006/03/21 16:37:51 dron Exp $ */\n\n/*\n * Copyright (c) 1988-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n/*\n * TIFF Library UNIX-specific Routines. These are should also work with the\n * Windows Common RunTime Library.\n */\n#include \"tif_config.h\"\n\n#ifdef HAVE_SYS_TYPES_H\n# include <sys/types.h>\n#endif\n\n#include <stdarg.h>\n#include <stdlib.h>\n#include <sys/stat.h>\n\n#ifdef HAVE_UNISTD_H\n# include <unistd.h>\n#endif\n\n#ifdef HAVE_FCNTL_H\n# include <fcntl.h>\n#endif\n\n#ifdef HAVE_IO_H\n# include <io.h>\n#endif\n\n#include \"tiffiop.h\"\n\nstatic tsize_t\n_tiffReadProc(thandle_t fd, tdata_t buf, tsize_t size)\n{\n\treturn ((tsize_t) read((int) fd, buf, (size_t) size));\n}\n\nstatic tsize_t\n_tiffWriteProc(thandle_t fd, tdata_t buf, tsize_t size)\n{\n\treturn ((tsize_t) write((int) fd, buf, (size_t) size));\n}\n\nstatic toff_t\n_tiffSeekProc(thandle_t fd, toff_t off, int whence)\n{\n\treturn ((toff_t) lseek((int) fd, (off_t) off, whence));\n}\n\nstatic int\n_tiffCloseProc(thandle_t fd)\n{\n\treturn (close((int) fd));\n}\n\n\nstatic toff_t\n_tiffSizeProc(thandle_t fd)\n{\n#ifdef _AM29K\n\tlong fsize;\n\treturn ((fsize = lseek((int) fd, 0, SEEK_END)) < 0 ? 0 : fsize);\n#else\n\tstruct stat sb;\n\treturn (toff_t) (fstat((int) fd, &sb) < 0 ? 0 : sb.st_size);\n#endif\n}\n\n#ifdef HAVE_MMAP\n#include <sys/mman.h>\n\nstatic int\n_tiffMapProc(thandle_t fd, tdata_t* pbase, toff_t* psize)\n{\n\ttoff_t size = _tiffSizeProc(fd);\n\tif (size != (toff_t) -1) {\n\t\t*pbase = (tdata_t)\n\t\t    mmap(0, size, PROT_READ, MAP_SHARED, (int) fd, 0);\n\t\tif (*pbase != (tdata_t) -1) {\n\t\t\t*psize = size;\n\t\t\treturn (1);\n\t\t}\n\t}\n\treturn (0);\n}\n\nstatic void\n_tiffUnmapProc(thandle_t fd, tdata_t base, toff_t size)\n{\n\t(void) fd;\n\t(void) munmap(base, (off_t) size);\n}\n#else /* !HAVE_MMAP */\nstatic int\n_tiffMapProc(thandle_t fd, tdata_t* pbase, toff_t* psize)\n{\n\t(void) fd; (void) pbase; (void) psize;\n\treturn (0);\n}\n\nstatic void\n_tiffUnmapProc(thandle_t fd, tdata_t base, toff_t size)\n{\n\t(void) fd; (void) base; (void) size;\n}\n#endif /* !HAVE_MMAP */\n\n/*\n * Open a TIFF file descriptor for read/writing.\n */\nTIFF*\nTIFFFdOpen(int fd, const char* name, const char* mode)\n{\n\tTIFF* tif;\n\n\ttif = TIFFClientOpen(name, mode,\n\t    (thandle_t) fd,\n\t    _tiffReadProc, _tiffWriteProc,\n\t    _tiffSeekProc, _tiffCloseProc, _tiffSizeProc,\n\t    _tiffMapProc, _tiffUnmapProc);\n\tif (tif)\n\t\ttif->tif_fd = fd;\n\treturn (tif);\n}\n\n/*\n * Open a TIFF file for read/writing.\n */\nTIFF*\nTIFFOpen(const char* name, const char* mode)\n{\n\tstatic const char module[] = \"TIFFOpen\";\n\tint m, fd;\n        TIFF* tif;\n\n\tm = _TIFFgetMode(mode, module);\n\tif (m == -1)\n\t\treturn ((TIFF*)0);\n\n/* for cygwin and mingw */        \n#ifdef O_BINARY\n        m |= O_BINARY;\n#endif        \n        \n#ifdef _AM29K\n\tfd = open(name, m);\n#else\n\tfd = open(name, m, 0666);\n#endif\n\tif (fd < 0) {\n\t\tTIFFErrorExt(0, module, \"%s: Cannot open\", name);\n\t\treturn ((TIFF *)0);\n\t}\n\n\ttif = TIFFFdOpen((int)fd, name, mode);\n\tif(!tif)\n\t\tclose(fd);\n\treturn tif;\n}\n\n#ifdef __WIN32__\n#include <windows.h>\n/*\n * Open a TIFF file with a Unicode filename, for read/writing.\n */\nTIFF*\nTIFFOpenW(const wchar_t* name, const char* mode)\n{\n\tstatic const char module[] = \"TIFFOpenW\";\n\tint m, fd;\n\tint mbsize;\n\tchar *mbname;\n\tTIFF* tif;\n\n\tm = _TIFFgetMode(mode, module);\n\tif (m == -1)\n\t\treturn ((TIFF*)0);\n\n/* for cygwin and mingw */        \n#ifdef O_BINARY\n        m |= O_BINARY;\n#endif        \n        \n\tfd = _wopen(name, m, 0666);\n\tif (fd < 0) {\n\t\tTIFFErrorExt(0, module, \"%s: Cannot open\", name);\n\t\treturn ((TIFF *)0);\n\t}\n\n\tmbname = NULL;\n\tmbsize = WideCharToMultiByte(CP_ACP, 0, name, -1, NULL, 0, NULL, NULL);\n\tif (mbsize > 0) {\n\t\tmbname = _TIFFmalloc(mbsize);\n\t\tif (!mbname) {\n\t\t\tTIFFErrorExt(0, module,\n\t\t\t\"Can't allocate space for filename conversion buffer\");\n\t\t\treturn ((TIFF*)0);\n\t\t}\n\n\t\tWideCharToMultiByte(CP_ACP, 0, name, -1, mbname, mbsize,\n\t\t\t\t    NULL, NULL);\n\t}\n\n\ttif = TIFFFdOpen((int)fd, (mbname != NULL) ? mbname : \"<unknown>\",\n\t\t\t mode);\n\t\n\t_TIFFfree(mbname);\n\t\n\tif(!tif)\n\t\tclose(fd);\n\treturn tif;\n}\n#endif\n\nvoid*\n_TIFFmalloc(tsize_t s)\n{\n\treturn (malloc((size_t) s));\n}\n\nvoid\n_TIFFfree(tdata_t p)\n{\n\tfree(p);\n}\n\nvoid*\n_TIFFrealloc(tdata_t p, tsize_t s)\n{\n\treturn (realloc(p, (size_t) s));\n}\n\nvoid\n_TIFFmemset(tdata_t p, int v, tsize_t c)\n{\n\tmemset(p, v, (size_t) c);\n}\n\nvoid\n_TIFFmemcpy(tdata_t d, const tdata_t s, tsize_t c)\n{\n\tmemcpy(d, s, (size_t) c);\n}\n\nint\n_TIFFmemcmp(const tdata_t p1, const tdata_t p2, tsize_t c)\n{\n\treturn (memcmp(p1, p2, (size_t) c));\n}\n\nstatic void\nunixWarningHandler(const char* module, const char* fmt, va_list ap)\n{\n\tif (module != NULL)\n\t\tfprintf(stderr, \"%s: \", module);\n\tfprintf(stderr, \"Warning, \");\n\tvfprintf(stderr, fmt, ap);\n\tfprintf(stderr, \".\\n\");\n}\nTIFFErrorHandler _TIFFwarningHandler = unixWarningHandler;\n\nstatic void\nunixErrorHandler(const char* module, const char* fmt, va_list ap)\n{\n\tif (module != NULL)\n\t\tfprintf(stderr, \"%s: \", module);\n\tvfprintf(stderr, fmt, ap);\n\tfprintf(stderr, \".\\n\");\n}\nTIFFErrorHandler _TIFFerrorHandler = unixErrorHandler;\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/tif_version.c",
    "content": "/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_version.c,v 1.2 2000/11/13 14:42:38 warmerda Exp $ */\n/*\n * Copyright (c) 1992-1997 Sam Leffler\n * Copyright (c) 1992-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n#include \"tiffiop.h\"\n\nstatic const char TIFFVersion[] = TIFFLIB_VERSION_STR;\n\nconst char*\nTIFFGetVersion(void)\n{\n\treturn (TIFFVersion);\n}\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/tif_warning.c",
    "content": "/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_warning.c,v 1.2 2005/12/23 01:18:59 joris Exp $ */\n\n/*\n * Copyright (c) 1988-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n/*\n * TIFF Library.\n */\n#include \"tiffiop.h\"\n\nTIFFErrorHandlerExt _TIFFwarningHandlerExt = NULL;\n\nTIFFErrorHandler\nTIFFSetWarningHandler(TIFFErrorHandler handler)\n{\n\tTIFFErrorHandler prev = _TIFFwarningHandler;\n\t_TIFFwarningHandler = handler;\n\treturn (prev);\n}\n\nTIFFErrorHandlerExt\nTIFFSetWarningHandlerExt(TIFFErrorHandlerExt handler)\n{\n\tTIFFErrorHandlerExt prev = _TIFFwarningHandlerExt;\n\t_TIFFwarningHandlerExt = handler;\n\treturn (prev);\n}\n\nvoid\nTIFFWarning(const char* module, const char* fmt, ...)\n{\n\tva_list ap;\n\tva_start(ap, fmt);\n\tif (_TIFFwarningHandler)\n\t\t(*_TIFFwarningHandler)(module, fmt, ap);\n\tif (_TIFFwarningHandlerExt)\n\t\t(*_TIFFwarningHandlerExt)(0, module, fmt, ap);\n\tva_end(ap);\n}\n\nvoid\nTIFFWarningExt(thandle_t fd, const char* module, const char* fmt, ...)\n{\n\tva_list ap;\n\tva_start(ap, fmt);\n\tif (_TIFFwarningHandler)\n\t\t(*_TIFFwarningHandler)(module, fmt, ap);\n\tif (_TIFFwarningHandlerExt)\n\t\t(*_TIFFwarningHandlerExt)(fd, module, fmt, ap);\n\tva_end(ap);\n}\n\n\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/tif_win3.c",
    "content": "/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_win3.c,v 1.2 2005/12/21 12:23:13 joris Exp $ */\n\n/*\n * Copyright (c) 1988-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n/*\n * TIFF Library Windows 3.x-specific Routines.\n */\n#include \"tiffiop.h\"\n#if defined(__WATCOMC__) || defined(__BORLANDC__) || defined(_MSC_VER)\n#include <io.h>\t\t/* for open, close, etc. function prototypes */\n#endif\n\n#include <windows.h>\n#include <windowsx.h>\n#include <memory.h>\n\nstatic tsize_t \n_tiffReadProc(thandle_t fd, tdata_t buf, tsize_t size)\n{\n\treturn (_hread(fd, buf, size));\n}\n\nstatic tsize_t\n_tiffWriteProc(thandle_t fd, tdata_t buf, tsize_t size)\n{\n\treturn (_hwrite(fd, buf, size));\n}\n\nstatic toff_t\n_tiffSeekProc(thandle_t fd, toff_t off, int whence)\n{\n\treturn (_llseek(fd, (off_t) off, whence));\n}\n\nstatic int\n_tiffCloseProc(thandle_t fd)\n{\n\treturn (_lclose(fd));\n}\n\n#include <sys/stat.h>\n\nstatic toff_t\n_tiffSizeProc(thandle_t fd)\n{\n\tstruct stat sb;\n\treturn (fstat((int) fd, &sb) < 0 ? 0 : sb.st_size);\n}\n\nstatic int\n_tiffMapProc(thandle_t fd, tdata_t* pbase, toff_t* psize)\n{\n\treturn (0);\n}\n\nstatic void\n_tiffUnmapProc(thandle_t fd, tdata_t base, toff_t size)\n{\n}\n\n/*\n * Open a TIFF file descriptor for read/writing.\n */\nTIFF*\nTIFFFdOpen(int fd, const char* name, const char* mode)\n{\n\tTIFF* tif;\n\n\ttif = TIFFClientOpen(name, mode,\n\t    (thandle_t) fd,\n\t    _tiffReadProc, _tiffWriteProc, _tiffSeekProc, _tiffCloseProc,\n\t    _tiffSizeProc, _tiffMapProc, _tiffUnmapProc);\n\tif (tif)\n\t\ttif->tif_fd = fd;\n\treturn (tif);\n}\n\n/*\n * Open a TIFF file for read/writing.\n */\nTIFF*\nTIFFOpen(const char* name, const char* mode)\n{\n\tstatic const char module[] = \"TIFFOpen\";\n\tint m, fd;\n\tOFSTRUCT of;\n\tint mm = 0;\n\n\tm = _TIFFgetMode(mode, module);\n\tif (m == -1)\n\t\treturn ((TIFF*)0);\n\tif (m & O_CREAT) {\n\t\tif ((m & O_TRUNC) || OpenFile(name, &of, OF_EXIST) != HFILE_ERROR)\n\t\t\tmm |= OF_CREATE;\n\t}\n\tif (m & O_WRONLY)\n\t\tmm |= OF_WRITE;\n\tif (m & O_RDWR)\n\t\tmm |= OF_READWRITE;\n\tfd = OpenFile(name, &of, mm);\n\tif (fd < 0) {\n\t\tTIFFErrorExt(0, module, \"%s: Cannot open\", name);\n\t\treturn ((TIFF*)0);\n\t}\n\treturn (TIFFFdOpen(fd, name, mode));\n}\n\ntdata_t\n_TIFFmalloc(tsize_t s)\n{\n\treturn (tdata_t) GlobalAllocPtr(GHND, (DWORD) s);\n}\n\nvoid\n_TIFFfree(tdata_t p)\n{\n\tGlobalFreePtr(p);\n}\n\ntdata_t\n_TIFFrealloc(tdata_t p, tsize_t s)\n{\n\treturn (tdata_t) GlobalReAllocPtr(p, (DWORD) s, GHND);\n}\n\nvoid\n_TIFFmemset(tdata_t p, int v, tsize_t c)\n{\n\tchar* pp = (char*) p;\n\n\twhile (c > 0) {\n\t\ttsize_t chunk = 0x10000 - ((uint32) pp & 0xffff);/* What's left in segment */\n\t\tif (chunk > 0xff00)\t\t\t\t/* No more than 0xff00 */\n\t\t\tchunk = 0xff00;\n\t\tif (chunk > c)\t\t\t\t\t/* No more than needed */\n\t\t\tchunk = c;\n\t\tmemset(pp, v, chunk);\n\t\tpp = (char*) (chunk + (char huge*) pp);\n\t\tc -= chunk;\n\t}\n}\n\nvoid\n_TIFFmemcpy(tdata_t d, const tdata_t s, tsize_t c)\n{\n\tif (c > 0xFFFF)\n\t\thmemcpy((void _huge*) d, (void _huge*) s, c);\n\telse\n\t\t(void) memcpy(d, s, (size_t) c);\n}\n\nint\n_TIFFmemcmp(const tdata_t d, const tdata_t s, tsize_t c)\n{\n\tchar* dd = (char*) d;\n\tchar* ss = (char*) s;\n\ttsize_t chunks, chunkd, chunk;\n\tint result;\n\n\twhile (c > 0) {\n\t\tchunks = 0x10000 - ((uint32) ss & 0xffff);\t/* What's left in segment */\n\t\tchunkd = 0x10000 - ((uint32) dd & 0xffff);\t/* What's left in segment */\n\t\tchunk = c;\t\t\t\t\t/* Get the largest of     */\n\t\tif (chunk > chunks)\t\t\t\t/*   c, chunks, chunkd,   */\n\t\t\tchunk = chunks;\t\t\t\t/*   0xff00               */\n\t\tif (chunk > chunkd)\n\t\t\tchunk = chunkd;\n\t\tif (chunk > 0xff00)\n\t\t\tchunk = 0xff00;\n\t\tresult = memcmp(dd, ss, chunk);\n\t\tif (result != 0)\n\t\t\treturn (result);\n\t\tdd = (char*) (chunk + (char huge*) dd);\n\t\tss = (char*) (chunk + (char huge*) ss);\n\t\tc -= chunk;\n\t}\n\treturn (0);\n}\n\nstatic void\nwin3WarningHandler(const char* module, const char* fmt, va_list ap)\n{\n\tchar e[512] = { '\\0' };\n\tif (module != NULL)\n\t\tstrcat(strcpy(e, module), \":\");\n\tvsprintf(e+strlen(e), fmt, ap);\n\tstrcat(e, \".\");\n\tMessageBox(GetActiveWindow(), e, \"LibTIFF Warning\",\n\t    MB_OK|MB_ICONEXCLAMATION);\n}\nTIFFErrorHandler _TIFFwarningHandler = win3WarningHandler;\n\nstatic void\nwin3ErrorHandler(const char* module, const char* fmt, va_list ap)\n{\n\tchar e[512] = { '\\0' };\n\tif (module != NULL)\n\t\tstrcat(strcpy(e, module), \":\");\n\tvsprintf(e+strlen(e), fmt, ap);\n\tstrcat(e, \".\");\n\tMessageBox(GetActiveWindow(), e, \"LibTIFF Error\", MB_OK|MB_ICONSTOP);\n}\nTIFFErrorHandler _TIFFerrorHandler = win3ErrorHandler;\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/tif_win32.c",
    "content": "/* $Id: tif_win32.c,v 1.21 2007/03/07 17:10:31 joris Exp $ */\n\n/*\n * Copyright (c) 1988-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n/*\n * TIFF Library Win32-specific Routines.  Adapted from tif_unix.c 4/5/95 by\n * Scott Wagner (wagner@itek.com), Itek Graphix, Rochester, NY USA\n */\n#include \"tiffiop.h\"\n\n#include <windows.h>\n\nstatic tsize_t\n_tiffReadProc(thandle_t fd, tdata_t buf, tsize_t size)\n{\n\tDWORD dwSizeRead;\n\tif (!ReadFile(fd, buf, size, &dwSizeRead, NULL))\n\t\treturn(0);\n\treturn ((tsize_t) dwSizeRead);\n}\n\nstatic tsize_t\n_tiffWriteProc(thandle_t fd, tdata_t buf, tsize_t size)\n{\n\tDWORD dwSizeWritten;\n\tif (!WriteFile(fd, buf, size, &dwSizeWritten, NULL))\n\t\treturn(0);\n\treturn ((tsize_t) dwSizeWritten);\n}\n\nstatic toff_t\n_tiffSeekProc(thandle_t fd, toff_t off, int whence)\n{\n        ULARGE_INTEGER li;\n\tDWORD dwMoveMethod;\n\n\tli.QuadPart = off;\n        \n\tswitch(whence)\n\t{\n\tcase SEEK_SET:\n\t\tdwMoveMethod = FILE_BEGIN;\n\t\tbreak;\n\tcase SEEK_CUR:\n\t\tdwMoveMethod = FILE_CURRENT;\n\t\tbreak;\n\tcase SEEK_END:\n\t\tdwMoveMethod = FILE_END;\n\t\tbreak;\n\tdefault:\n\t\tdwMoveMethod = FILE_BEGIN;\n\t\tbreak;\n\t}\n\treturn ((toff_t)SetFilePointer(fd, (LONG) li.LowPart,\n\t\t\t\t       (PLONG)&li.HighPart, dwMoveMethod));\n}\n\nstatic int\n_tiffCloseProc(thandle_t fd)\n{\n\treturn (CloseHandle(fd) ? 0 : -1);\n}\n\nstatic toff_t\n_tiffSizeProc(thandle_t fd)\n{\n\treturn ((toff_t)GetFileSize(fd, NULL));\n}\n\nstatic int\n_tiffDummyMapProc(thandle_t fd, tdata_t* pbase, toff_t* psize)\n{\n\t(void) fd;\n\t(void) pbase;\n\t(void) psize;\n\treturn (0);\n}\n\n/*\n * From \"Hermann Josef Hill\" <lhill@rhein-zeitung.de>:\n *\n * Windows uses both a handle and a pointer for file mapping,\n * but according to the SDK documentation and Richter's book\n * \"Advanced Windows Programming\" it is safe to free the handle\n * after obtaining the file mapping pointer\n *\n * This removes a nasty OS dependency and cures a problem\n * with Visual C++ 5.0\n */\nstatic int\n_tiffMapProc(thandle_t fd, tdata_t* pbase, toff_t* psize)\n{\n\ttoff_t size;\n\tHANDLE hMapFile;\n\n\tif ((size = _tiffSizeProc(fd)) == 0xFFFFFFFF)\n\t\treturn (0);\n\thMapFile = CreateFileMapping(fd, NULL, PAGE_READONLY, 0, size, NULL);\n\tif (hMapFile == NULL)\n\t\treturn (0);\n\t*pbase = MapViewOfFile(hMapFile, FILE_MAP_READ, 0, 0, 0);\n\tCloseHandle(hMapFile);\n\tif (*pbase == NULL)\n\t\treturn (0);\n\t*psize = size;\n\treturn(1);\n}\n\nstatic void\n_tiffDummyUnmapProc(thandle_t fd, tdata_t base, toff_t size)\n{\n\t(void) fd;\n\t(void) base;\n\t(void) size;\n}\n\nstatic void\n_tiffUnmapProc(thandle_t fd, tdata_t base, toff_t size)\n{\n\tUnmapViewOfFile(base);\n}\n\n/*\n * Open a TIFF file descriptor for read/writing.\n * Note that TIFFFdOpen and TIFFOpen recognise the character 'u' in the mode\n * string, which forces the file to be opened unmapped.\n */\nTIFF*\nTIFFFdOpen(int ifd, const char* name, const char* mode)\n{\n\tTIFF* tif;\n\tBOOL fSuppressMap = (mode[1] == 'u' || (mode[1]!=0 && mode[2] == 'u'));\n\n\ttif = TIFFClientOpen(name, mode, (thandle_t)ifd,\n\t\t\t_tiffReadProc, _tiffWriteProc,\n\t\t\t_tiffSeekProc, _tiffCloseProc, _tiffSizeProc,\n\t\t\tfSuppressMap ? _tiffDummyMapProc : _tiffMapProc,\n\t\t\tfSuppressMap ? _tiffDummyUnmapProc : _tiffUnmapProc);\n\tif (tif)\n\t\ttif->tif_fd = ifd;\n\treturn (tif);\n}\n\n#ifndef _WIN32_WCE\n\n/*\n * Open a TIFF file for read/writing.\n */\nTIFF*\nTIFFOpen(const char* name, const char* mode)\n{\n\tstatic const char module[] = \"TIFFOpen\";\n\tthandle_t fd;\n\tint m;\n\tDWORD dwMode;\n\tTIFF* tif;\n\n\tm = _TIFFgetMode(mode, module);\n\n\tswitch(m)\n\t{\n\tcase O_RDONLY:\n\t\tdwMode = OPEN_EXISTING;\n\t\tbreak;\n\tcase O_RDWR:\n\t\tdwMode = OPEN_ALWAYS;\n\t\tbreak;\n\tcase O_RDWR|O_CREAT:\n\t\tdwMode = OPEN_ALWAYS;\n\t\tbreak;\n\tcase O_RDWR|O_TRUNC:\n\t\tdwMode = CREATE_ALWAYS;\n\t\tbreak;\n\tcase O_RDWR|O_CREAT|O_TRUNC:\n\t\tdwMode = CREATE_ALWAYS;\n\t\tbreak;\n\tdefault:\n\t\treturn ((TIFF*)0);\n\t}\n\tfd = (thandle_t)CreateFileA(name,\n\t\t(m == O_RDONLY)?GENERIC_READ:(GENERIC_READ | GENERIC_WRITE),\n\t\tFILE_SHARE_READ | FILE_SHARE_WRITE, NULL, dwMode,\n\t\t(m == O_RDONLY)?FILE_ATTRIBUTE_READONLY:FILE_ATTRIBUTE_NORMAL,\n\t\tNULL);\n\tif (fd == INVALID_HANDLE_VALUE) {\n\t\tTIFFErrorExt(0, module, \"%s: Cannot open\", name);\n\t\treturn ((TIFF *)0);\n\t}\n\n\ttif = TIFFFdOpen((int)fd, name, mode);\n\tif(!tif)\n\t\tCloseHandle(fd);\n\treturn tif;\n}\n\n/*\n * Open a TIFF file with a Unicode filename, for read/writing.\n */\nTIFF*\nTIFFOpenW(const wchar_t* name, const char* mode)\n{\n\tstatic const char module[] = \"TIFFOpenW\";\n\tthandle_t fd;\n\tint m;\n\tDWORD dwMode;\n\tint mbsize;\n\tchar *mbname;\n\tTIFF *tif;\n\n\tm = _TIFFgetMode(mode, module);\n\n\tswitch(m) {\n\t\tcase O_RDONLY:\t\t\tdwMode = OPEN_EXISTING; break;\n\t\tcase O_RDWR:\t\t\tdwMode = OPEN_ALWAYS;   break;\n\t\tcase O_RDWR|O_CREAT:\t\tdwMode = OPEN_ALWAYS;   break;\n\t\tcase O_RDWR|O_TRUNC:\t\tdwMode = CREATE_ALWAYS; break;\n\t\tcase O_RDWR|O_CREAT|O_TRUNC:\tdwMode = CREATE_ALWAYS; break;\n\t\tdefault:\t\t\treturn ((TIFF*)0);\n\t}\n\n\tfd = (thandle_t)CreateFileW(name,\n\t\t(m == O_RDONLY)?GENERIC_READ:(GENERIC_READ|GENERIC_WRITE),\n\t\tFILE_SHARE_READ, NULL, dwMode,\n\t\t(m == O_RDONLY)?FILE_ATTRIBUTE_READONLY:FILE_ATTRIBUTE_NORMAL,\n\t\tNULL);\n\tif (fd == INVALID_HANDLE_VALUE) {\n\t\tTIFFErrorExt(0, module, \"%S: Cannot open\", name);\n\t\treturn ((TIFF *)0);\n\t}\n\n\tmbname = NULL;\n\tmbsize = WideCharToMultiByte(CP_ACP, 0, name, -1, NULL, 0, NULL, NULL);\n\tif (mbsize > 0) {\n\t\tmbname = (char *)_TIFFmalloc(mbsize);\n\t\tif (!mbname) {\n\t\t\tTIFFErrorExt(0, module,\n\t\t\t\"Can't allocate space for filename conversion buffer\");\n\t\t\treturn ((TIFF*)0);\n\t\t}\n\n\t\tWideCharToMultiByte(CP_ACP, 0, name, -1, mbname, mbsize,\n\t\t\t\t    NULL, NULL);\n\t}\n\n\ttif = TIFFFdOpen((int)fd,\n\t\t\t (mbname != NULL) ? mbname : \"<unknown>\", mode);\n\tif(!tif)\n\t\tCloseHandle(fd);\n\n\t_TIFFfree(mbname);\n\n\treturn tif;\n}\n\n#endif /* ndef _WIN32_WCE */\n\n\ntdata_t\n_TIFFmalloc(tsize_t s)\n{\n\treturn ((tdata_t)GlobalAlloc(GMEM_FIXED, s));\n}\n\nvoid\n_TIFFfree(tdata_t p)\n{\n\tGlobalFree(p);\n\treturn;\n}\n\ntdata_t\n_TIFFrealloc(tdata_t p, tsize_t s)\n{\n\tvoid* pvTmp;\n\ttsize_t old;\n\n\tif(p == NULL)\n\t\treturn ((tdata_t)GlobalAlloc(GMEM_FIXED, s));\n\n\told = GlobalSize(p);\n\n\tif (old>=s) {\n\t\tif ((pvTmp = GlobalAlloc(GMEM_FIXED, s)) != NULL) {\n\t\t\tCopyMemory(pvTmp, p, s);\n\t\t\tGlobalFree(p);\n\t\t}\n\t} else {\n\t\tif ((pvTmp = GlobalAlloc(GMEM_FIXED, s)) != NULL) {\n\t\t\tCopyMemory(pvTmp, p, old);\n\t\t\tGlobalFree(p);\n\t\t}\n\t}\n\treturn ((tdata_t)pvTmp);\n}\n\nvoid\n_TIFFmemset(void* p, int v, tsize_t c)\n{\n\tFillMemory(p, c, (BYTE)v);\n}\n\nvoid\n_TIFFmemcpy(void* d, const tdata_t s, tsize_t c)\n{\n\tCopyMemory(d, s, c);\n}\n\nint\n_TIFFmemcmp(const tdata_t p1, const tdata_t p2, tsize_t c)\n{\n\tregister const BYTE *pb1 = (const BYTE *) p1;\n\tregister const BYTE *pb2 = (const BYTE *) p2;\n\tregister DWORD dwTmp = c;\n\tregister int iTmp;\n\tfor (iTmp = 0; dwTmp-- && !iTmp; iTmp = (int)*pb1++ - (int)*pb2++)\n\t\t;\n\treturn (iTmp);\n}\n\n#ifndef _WIN32_WCE\n\nstatic void\nWin32WarningHandler(const char* module, const char* fmt, va_list ap)\n{\n#ifndef TIF_PLATFORM_CONSOLE\n\tLPTSTR szTitle;\n\tLPTSTR szTmp;\n\tLPCTSTR szTitleText = \"%s Warning\";\n\tLPCTSTR szDefaultModule = \"LIBTIFF\";\n\tLPCTSTR szTmpModule = (module == NULL) ? szDefaultModule : module;\n\tif ((szTitle = (LPTSTR)LocalAlloc(LMEM_FIXED, (strlen(szTmpModule) +\n\t\tstrlen(szTitleText) + strlen(fmt) + 128)*sizeof(char))) == NULL)\n\t\treturn;\n\tsprintf(szTitle, szTitleText, szTmpModule);\n\tszTmp = szTitle + (strlen(szTitle)+2)*sizeof(char);\n\tvsprintf(szTmp, fmt, ap);\n\tMessageBoxA(GetFocus(), szTmp, szTitle, MB_OK | MB_ICONINFORMATION);\n\tLocalFree(szTitle);\n\treturn;\n#else\n\tif (module != NULL)\n\t\tfprintf(stderr, \"%s: \", module);\n\tfprintf(stderr, \"Warning, \");\n\tvfprintf(stderr, fmt, ap);\n\tfprintf(stderr, \".\\n\");\n#endif        \n}\nTIFFErrorHandler _TIFFwarningHandler = Win32WarningHandler;\n\nstatic void\nWin32ErrorHandler(const char* module, const char* fmt, va_list ap)\n{\n#ifndef TIF_PLATFORM_CONSOLE\n\tLPTSTR szTitle;\n\tLPTSTR szTmp;\n\tLPCTSTR szTitleText = \"%s Error\";\n\tLPCTSTR szDefaultModule = \"LIBTIFF\";\n\tLPCTSTR szTmpModule = (module == NULL) ? szDefaultModule : module;\n\tif ((szTitle = (LPTSTR)LocalAlloc(LMEM_FIXED, (strlen(szTmpModule) +\n\t\tstrlen(szTitleText) + strlen(fmt) + 128)*sizeof(char))) == NULL)\n\t\treturn;\n\tsprintf(szTitle, szTitleText, szTmpModule);\n\tszTmp = szTitle + (strlen(szTitle)+2)*sizeof(char);\n\tvsprintf(szTmp, fmt, ap);\n\tMessageBoxA(GetFocus(), szTmp, szTitle, MB_OK | MB_ICONEXCLAMATION);\n\tLocalFree(szTitle);\n\treturn;\n#else\n\tif (module != NULL)\n\t\tfprintf(stderr, \"%s: \", module);\n\tvfprintf(stderr, fmt, ap);\n\tfprintf(stderr, \".\\n\");\n#endif        \n}\nTIFFErrorHandler _TIFFerrorHandler = Win32ErrorHandler;\n\n#endif /* ndef _WIN32_WCE */\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/tif_write.c",
    "content": "/* $Id: tif_write.c,v 1.22.2.4 2009-08-28 02:23:19 bfriesen Exp $ */\n\n/*\n * Copyright (c) 1988-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n/*\n * TIFF Library.\n *\n * Scanline-oriented Write Support\n */\n#include \"tiffiop.h\"\n#include <stdio.h>\n\n#define\tSTRIPINCR\t20\t\t/* expansion factor on strip array */\n\n#define\tWRITECHECKSTRIPS(tif, module)\t\t\t\t\\\n\t(((tif)->tif_flags&TIFF_BEENWRITING) || TIFFWriteCheck((tif),0,module))\n#define\tWRITECHECKTILES(tif, module)\t\t\t\t\\\n\t(((tif)->tif_flags&TIFF_BEENWRITING) || TIFFWriteCheck((tif),1,module))\n#define\tBUFFERCHECK(tif)\t\t\t\t\t\\\n\t((((tif)->tif_flags & TIFF_BUFFERSETUP) && tif->tif_rawdata) ||\t\\\n\t    TIFFWriteBufferSetup((tif), NULL, (tsize_t) -1))\n\nstatic\tint TIFFGrowStrips(TIFF*, int, const char*);\nstatic\tint TIFFAppendToStrip(TIFF*, tstrip_t, tidata_t, tsize_t);\n\nint\nTIFFWriteScanline(TIFF* tif, tdata_t buf, uint32 row, tsample_t sample)\n{\n\tstatic const char module[] = \"TIFFWriteScanline\";\n\tregister TIFFDirectory *td;\n\tint status, imagegrew = 0;\n\ttstrip_t strip;\n\n\tif (!WRITECHECKSTRIPS(tif, module))\n\t\treturn (-1);\n\t/*\n\t * Handle delayed allocation of data buffer.  This\n\t * permits it to be sized more intelligently (using\n\t * directory information).\n\t */\n\tif (!BUFFERCHECK(tif))\n\t\treturn (-1);\n\ttd = &tif->tif_dir;\n\t/*\n\t * Extend image length if needed\n\t * (but only for PlanarConfig=1).\n\t */\n\tif (row >= td->td_imagelength) {\t/* extend image */\n\t\tif (td->td_planarconfig == PLANARCONFIG_SEPARATE) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t\"Can not change \\\"ImageLength\\\" when using separate planes\");\n\t\t\treturn (-1);\n\t\t}\n\t\ttd->td_imagelength = row+1;\n\t\timagegrew = 1;\n\t}\n\t/*\n\t * Calculate strip and check for crossings.\n\t */\n\tif (td->td_planarconfig == PLANARCONFIG_SEPARATE) {\n\t\tif (sample >= td->td_samplesperpixel) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t\t    \"%d: Sample out of range, max %d\",\n\t\t\t    sample, td->td_samplesperpixel);\n\t\t\treturn (-1);\n\t\t}\n\t\tstrip = sample*td->td_stripsperimage + row/td->td_rowsperstrip;\n\t} else\n\t\tstrip = row / td->td_rowsperstrip;\n\t/*\n\t * Check strip array to make sure there's space. We don't support\n\t * dynamically growing files that have data organized in separate\n\t * bitplanes because it's too painful.  In that case we require that\n\t * the imagelength be set properly before the first write (so that the\n\t * strips array will be fully allocated above).\n\t */\n\tif (strip >= td->td_nstrips && !TIFFGrowStrips(tif, 1, module))\n\t\treturn (-1);\n\tif (strip != tif->tif_curstrip) {\n\t\t/*\n\t\t * Changing strips -- flush any data present.\n\t\t */\n\t\tif (!TIFFFlushData(tif))\n\t\t\treturn (-1);\n\t\ttif->tif_curstrip = strip;\n\t\t/*\n\t\t * Watch out for a growing image.  The value of strips/image\n\t\t * will initially be 1 (since it can't be deduced until the\n\t\t * imagelength is known).\n\t\t */\n\t\tif (strip >= td->td_stripsperimage && imagegrew)\n\t\t\ttd->td_stripsperimage =\n\t\t\t    TIFFhowmany(td->td_imagelength,td->td_rowsperstrip);\n\t\ttif->tif_row =\n\t\t    (strip % td->td_stripsperimage) * td->td_rowsperstrip;\n\t\tif ((tif->tif_flags & TIFF_CODERSETUP) == 0) {\n\t\t\tif (!(*tif->tif_setupencode)(tif))\n\t\t\t\treturn (-1);\n\t\t\ttif->tif_flags |= TIFF_CODERSETUP;\n\t\t}\n        \n\t\ttif->tif_rawcc = 0;\n\t\ttif->tif_rawcp = tif->tif_rawdata;\n\n\t\tif( td->td_stripbytecount[strip] > 0 )\n\t\t{\n\t\t\t/* if we are writing over existing tiles, zero length */\n\t\t\ttd->td_stripbytecount[strip] = 0;\n\n\t\t\t/* this forces TIFFAppendToStrip() to do a seek */\n\t\t\ttif->tif_curoff = 0;\n\t\t}\n\n\t\tif (!(*tif->tif_preencode)(tif, sample))\n\t\t\treturn (-1);\n\t\ttif->tif_flags |= TIFF_POSTENCODE;\n\t}\n\t/*\n\t * Ensure the write is either sequential or at the\n\t * beginning of a strip (or that we can randomly\n\t * access the data -- i.e. no encoding).\n\t */\n\tif (row != tif->tif_row) {\n\t\tif (row < tif->tif_row) {\n\t\t\t/*\n\t\t\t * Moving backwards within the same strip:\n\t\t\t * backup to the start and then decode\n\t\t\t * forward (below).\n\t\t\t */\n\t\t\ttif->tif_row = (strip % td->td_stripsperimage) *\n\t\t\t    td->td_rowsperstrip;\n\t\t\ttif->tif_rawcp = tif->tif_rawdata;\n\t\t}\n\t\t/*\n\t\t * Seek forward to the desired row.\n\t\t */\n\t\tif (!(*tif->tif_seek)(tif, row - tif->tif_row))\n\t\t\treturn (-1);\n\t\ttif->tif_row = row;\n\t}\n\n        /* swab if needed - note that source buffer will be altered */\n        tif->tif_postdecode( tif, (tidata_t) buf, tif->tif_scanlinesize );\n\n\tstatus = (*tif->tif_encoderow)(tif, (tidata_t) buf,\n\t    tif->tif_scanlinesize, sample);\n\n        /* we are now poised at the beginning of the next row */\n\ttif->tif_row = row + 1;\n\treturn (status);\n}\n\n/*\n * Encode the supplied data and write it to the\n * specified strip.\n *\n * NB: Image length must be setup before writing.\n */\ntsize_t\nTIFFWriteEncodedStrip(TIFF* tif, tstrip_t strip, tdata_t data, tsize_t cc)\n{\n\tstatic const char module[] = \"TIFFWriteEncodedStrip\";\n\tTIFFDirectory *td = &tif->tif_dir;\n\ttsample_t sample;\n\n\tif (!WRITECHECKSTRIPS(tif, module))\n\t\treturn ((tsize_t) -1);\n\t/*\n\t * Check strip array to make sure there's space.\n\t * We don't support dynamically growing files that\n\t * have data organized in separate bitplanes because\n\t * it's too painful.  In that case we require that\n\t * the imagelength be set properly before the first\n\t * write (so that the strips array will be fully\n\t * allocated above).\n\t */\n\tif (strip >= td->td_nstrips) {\n\t\tif (td->td_planarconfig == PLANARCONFIG_SEPARATE) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t\"Can not grow image by strips when using separate planes\");\n\t\t\treturn ((tsize_t) -1);\n\t\t}\n\t\tif (!TIFFGrowStrips(tif, 1, module))\n\t\t\treturn ((tsize_t) -1);\n\t\ttd->td_stripsperimage =\n\t\t    TIFFhowmany(td->td_imagelength, td->td_rowsperstrip);\n\t}\n\t/*\n\t * Handle delayed allocation of data buffer.  This\n\t * permits it to be sized according to the directory\n\t * info.\n\t */\n\tif (!BUFFERCHECK(tif))\n\t\treturn ((tsize_t) -1);\n\ttif->tif_curstrip = strip;\n\ttif->tif_row = (strip % td->td_stripsperimage) * td->td_rowsperstrip;\n\tif ((tif->tif_flags & TIFF_CODERSETUP) == 0) {\n\t\tif (!(*tif->tif_setupencode)(tif))\n\t\t\treturn ((tsize_t) -1);\n\t\ttif->tif_flags |= TIFF_CODERSETUP;\n\t}\n        \n\ttif->tif_rawcc = 0;\n\ttif->tif_rawcp = tif->tif_rawdata;\n\n        if( td->td_stripbytecount[strip] > 0 )\n        {\n\t    /* Force TIFFAppendToStrip() to consider placing data at end\n               of file. */\n            tif->tif_curoff = 0;\n        }\n        \n\ttif->tif_flags &= ~TIFF_POSTENCODE;\n\tsample = (tsample_t)(strip / td->td_stripsperimage);\n\tif (!(*tif->tif_preencode)(tif, sample))\n\t\treturn ((tsize_t) -1);\n\n        /* swab if needed - note that source buffer will be altered */\n        tif->tif_postdecode( tif, (tidata_t) data, cc );\n\n\tif (!(*tif->tif_encodestrip)(tif, (tidata_t) data, cc, sample))\n\t\treturn ((tsize_t) 0);\n\tif (!(*tif->tif_postencode)(tif))\n\t\treturn ((tsize_t) -1);\n\tif (!isFillOrder(tif, td->td_fillorder) &&\n\t    (tif->tif_flags & TIFF_NOBITREV) == 0)\n\t\tTIFFReverseBits(tif->tif_rawdata, tif->tif_rawcc);\n\tif (tif->tif_rawcc > 0 &&\n\t    !TIFFAppendToStrip(tif, strip, tif->tif_rawdata, tif->tif_rawcc))\n\t\treturn ((tsize_t) -1);\n\ttif->tif_rawcc = 0;\n\ttif->tif_rawcp = tif->tif_rawdata;\n\treturn (cc);\n}\n\n/*\n * Write the supplied data to the specified strip.\n *\n * NB: Image length must be setup before writing.\n */\ntsize_t\nTIFFWriteRawStrip(TIFF* tif, tstrip_t strip, tdata_t data, tsize_t cc)\n{\n\tstatic const char module[] = \"TIFFWriteRawStrip\";\n\tTIFFDirectory *td = &tif->tif_dir;\n\n\tif (!WRITECHECKSTRIPS(tif, module))\n\t\treturn ((tsize_t) -1);\n\t/*\n\t * Check strip array to make sure there's space.\n\t * We don't support dynamically growing files that\n\t * have data organized in separate bitplanes because\n\t * it's too painful.  In that case we require that\n\t * the imagelength be set properly before the first\n\t * write (so that the strips array will be fully\n\t * allocated above).\n\t */\n\tif (strip >= td->td_nstrips) {\n\t\tif (td->td_planarconfig == PLANARCONFIG_SEPARATE) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name,\n\t\t\"Can not grow image by strips when using separate planes\");\n\t\t\treturn ((tsize_t) -1);\n\t\t}\n\t\t/*\n\t\t * Watch out for a growing image.  The value of\n\t\t * strips/image will initially be 1 (since it\n\t\t * can't be deduced until the imagelength is known).\n\t\t */\n\t\tif (strip >= td->td_stripsperimage)\n\t\t\ttd->td_stripsperimage =\n\t\t\t    TIFFhowmany(td->td_imagelength,td->td_rowsperstrip);\n\t\tif (!TIFFGrowStrips(tif, 1, module))\n\t\t\treturn ((tsize_t) -1);\n\t}\n\ttif->tif_curstrip = strip;\n\ttif->tif_row = (strip % td->td_stripsperimage) * td->td_rowsperstrip;\n\treturn (TIFFAppendToStrip(tif, strip, (tidata_t) data, cc) ?\n\t    cc : (tsize_t) -1);\n}\n\n/*\n * Write and compress a tile of data.  The\n * tile is selected by the (x,y,z,s) coordinates.\n */\ntsize_t\nTIFFWriteTile(TIFF* tif,\n    tdata_t buf, uint32 x, uint32 y, uint32 z, tsample_t s)\n{\n\tif (!TIFFCheckTile(tif, x, y, z, s))\n\t\treturn (-1);\n\t/*\n\t * NB: A tile size of -1 is used instead of tif_tilesize knowing\n\t *     that TIFFWriteEncodedTile will clamp this to the tile size.\n\t *     This is done because the tile size may not be defined until\n\t *     after the output buffer is setup in TIFFWriteBufferSetup.\n\t */\n\treturn (TIFFWriteEncodedTile(tif,\n\t    TIFFComputeTile(tif, x, y, z, s), buf, (tsize_t) -1));\n}\n\n/*\n * Encode the supplied data and write it to the\n * specified tile.  There must be space for the\n * data.  The function clamps individual writes\n * to a tile to the tile size, but does not (and\n * can not) check that multiple writes to the same\n * tile do not write more than tile size data.\n *\n * NB: Image length must be setup before writing; this\n *     interface does not support automatically growing\n *     the image on each write (as TIFFWriteScanline does).\n */\ntsize_t\nTIFFWriteEncodedTile(TIFF* tif, ttile_t tile, tdata_t data, tsize_t cc)\n{\n\tstatic const char module[] = \"TIFFWriteEncodedTile\";\n\tTIFFDirectory *td;\n\ttsample_t sample;\n\n\tif (!WRITECHECKTILES(tif, module))\n\t\treturn ((tsize_t) -1);\n\ttd = &tif->tif_dir;\n\tif (tile >= td->td_nstrips) {\n\t\tTIFFErrorExt(tif->tif_clientdata, module, \"%s: Tile %lu out of range, max %lu\",\n\t\t    tif->tif_name, (unsigned long) tile, (unsigned long) td->td_nstrips);\n\t\treturn ((tsize_t) -1);\n\t}\n\t/*\n\t * Handle delayed allocation of data buffer.  This\n\t * permits it to be sized more intelligently (using\n\t * directory information).\n\t */\n\tif (!BUFFERCHECK(tif))\n\t\treturn ((tsize_t) -1);\n\ttif->tif_curtile = tile;\n\n\ttif->tif_rawcc = 0;\n\ttif->tif_rawcp = tif->tif_rawdata;\n\n        if( td->td_stripbytecount[tile] > 0 )\n        {\n\t    /* Force TIFFAppendToStrip() to consider placing data at end\n               of file. */\n            tif->tif_curoff = 0;\n        }\n        \n\t/* \n\t * Compute tiles per row & per column to compute\n\t * current row and column\n\t */\n\ttif->tif_row = (tile % TIFFhowmany(td->td_imagelength, td->td_tilelength))\n\t\t* td->td_tilelength;\n\ttif->tif_col = (tile % TIFFhowmany(td->td_imagewidth, td->td_tilewidth))\n\t\t* td->td_tilewidth;\n\n\tif ((tif->tif_flags & TIFF_CODERSETUP) == 0) {\n\t\tif (!(*tif->tif_setupencode)(tif))\n\t\t\treturn ((tsize_t) -1);\n\t\ttif->tif_flags |= TIFF_CODERSETUP;\n\t}\n\ttif->tif_flags &= ~TIFF_POSTENCODE;\n\tsample = (tsample_t)(tile/td->td_stripsperimage);\n\tif (!(*tif->tif_preencode)(tif, sample))\n\t\treturn ((tsize_t) -1);\n\t/*\n\t * Clamp write amount to the tile size.  This is mostly\n\t * done so that callers can pass in some large number\n\t * (e.g. -1) and have the tile size used instead.\n\t */\n\tif ( cc < 1 || cc > tif->tif_tilesize)\n\t\tcc = tif->tif_tilesize;\n\n        /* swab if needed - note that source buffer will be altered */\n        tif->tif_postdecode( tif, (tidata_t) data, cc );\n\n\tif (!(*tif->tif_encodetile)(tif, (tidata_t) data, cc, sample))\n\t\treturn ((tsize_t) 0);\n\tif (!(*tif->tif_postencode)(tif))\n\t\treturn ((tsize_t) -1);\n\tif (!isFillOrder(tif, td->td_fillorder) &&\n\t    (tif->tif_flags & TIFF_NOBITREV) == 0)\n\t\tTIFFReverseBits((unsigned char *)tif->tif_rawdata, tif->tif_rawcc);\n\tif (tif->tif_rawcc > 0 && !TIFFAppendToStrip(tif, tile,\n\t    tif->tif_rawdata, tif->tif_rawcc))\n\t\treturn ((tsize_t) -1);\n\ttif->tif_rawcc = 0;\n\ttif->tif_rawcp = tif->tif_rawdata;\n\treturn (cc);\n}\n\n/*\n * Write the supplied data to the specified strip.\n * There must be space for the data; we don't check\n * if strips overlap!\n *\n * NB: Image length must be setup before writing; this\n *     interface does not support automatically growing\n *     the image on each write (as TIFFWriteScanline does).\n */\ntsize_t\nTIFFWriteRawTile(TIFF* tif, ttile_t tile, tdata_t data, tsize_t cc)\n{\n\tstatic const char module[] = \"TIFFWriteRawTile\";\n\n\tif (!WRITECHECKTILES(tif, module))\n\t\treturn ((tsize_t) -1);\n\tif (tile >= tif->tif_dir.td_nstrips) {\n\t\tTIFFErrorExt(tif->tif_clientdata, module, \"%s: Tile %lu out of range, max %lu\",\n\t\t    tif->tif_name, (unsigned long) tile,\n\t\t    (unsigned long) tif->tif_dir.td_nstrips);\n\t\treturn ((tsize_t) -1);\n\t}\n\treturn (TIFFAppendToStrip(tif, tile, (tidata_t) data, cc) ?\n\t    cc : (tsize_t) -1);\n}\n\n#define\tisUnspecified(tif, f) \\\n    (TIFFFieldSet(tif,f) && (tif)->tif_dir.td_imagelength == 0)\n\nint\nTIFFSetupStrips(TIFF* tif)\n{\n\tTIFFDirectory* td = &tif->tif_dir;\n\n\tif (isTiled(tif))\n\t\ttd->td_stripsperimage =\n\t\t    isUnspecified(tif, FIELD_TILEDIMENSIONS) ?\n\t\t\ttd->td_samplesperpixel : TIFFNumberOfTiles(tif);\n\telse\n\t\ttd->td_stripsperimage =\n\t\t    isUnspecified(tif, FIELD_ROWSPERSTRIP) ?\n\t\t\ttd->td_samplesperpixel : TIFFNumberOfStrips(tif);\n\ttd->td_nstrips = td->td_stripsperimage;\n\tif (td->td_planarconfig == PLANARCONFIG_SEPARATE)\n\t\ttd->td_stripsperimage /= td->td_samplesperpixel;\n\ttd->td_stripoffset = (uint32 *)\n\t    _TIFFmalloc(td->td_nstrips * sizeof (uint32));\n\ttd->td_stripbytecount = (uint32 *)\n\t    _TIFFmalloc(td->td_nstrips * sizeof (uint32));\n\tif (td->td_stripoffset == NULL || td->td_stripbytecount == NULL)\n\t\treturn (0);\n\t/*\n\t * Place data at the end-of-file\n\t * (by setting offsets to zero).\n\t */\n\t_TIFFmemset(td->td_stripoffset, 0, td->td_nstrips*sizeof (uint32));\n\t_TIFFmemset(td->td_stripbytecount, 0, td->td_nstrips*sizeof (uint32));\n\tTIFFSetFieldBit(tif, FIELD_STRIPOFFSETS);\n\tTIFFSetFieldBit(tif, FIELD_STRIPBYTECOUNTS);\n\treturn (1);\n}\n#undef isUnspecified\n\n/*\n * Verify file is writable and that the directory\n * information is setup properly.  In doing the latter\n * we also \"freeze\" the state of the directory so\n * that important information is not changed.\n */\nint\nTIFFWriteCheck(TIFF* tif, int tiles, const char* module)\n{\n\tif (tif->tif_mode == O_RDONLY) {\n\t\tTIFFErrorExt(tif->tif_clientdata, module, \"%s: File not open for writing\",\n\t\t    tif->tif_name);\n\t\treturn (0);\n\t}\n\tif (tiles ^ isTiled(tif)) {\n\t\tTIFFErrorExt(tif->tif_clientdata, tif->tif_name, tiles ?\n\t\t    \"Can not write tiles to a stripped image\" :\n\t\t    \"Can not write scanlines to a tiled image\");\n\t\treturn (0);\n\t}\n        \n\t/*\n\t * On the first write verify all the required information\n\t * has been setup and initialize any data structures that\n\t * had to wait until directory information was set.\n\t * Note that a lot of our work is assumed to remain valid\n\t * because we disallow any of the important parameters\n\t * from changing after we start writing (i.e. once\n\t * TIFF_BEENWRITING is set, TIFFSetField will only allow\n\t * the image's length to be changed).\n\t */\n\tif (!TIFFFieldSet(tif, FIELD_IMAGEDIMENSIONS)) {\n\t\tTIFFErrorExt(tif->tif_clientdata, module,\n\t\t    \"%s: Must set \\\"ImageWidth\\\" before writing data\",\n\t\t    tif->tif_name);\n\t\treturn (0);\n\t}\n\tif (tif->tif_dir.td_samplesperpixel == 1) {\n\t\t/* \n\t\t * Planarconfiguration is irrelevant in case of single band\n\t\t * images and need not be included. We will set it anyway,\n\t\t * because this field is used in other parts of library even\n\t\t * in the single band case.\n\t\t */\n\t\tif (!TIFFFieldSet(tif, FIELD_PLANARCONFIG))\n                    tif->tif_dir.td_planarconfig = PLANARCONFIG_CONTIG;\n\t} else {\n\t\tif (!TIFFFieldSet(tif, FIELD_PLANARCONFIG)) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, module,\n\t\t    \"%s: Must set \\\"PlanarConfiguration\\\" before writing data\",\n\t\t\t    tif->tif_name);\n\t\t\treturn (0);\n\t\t}\n\t}\n\tif (tif->tif_dir.td_stripoffset == NULL && !TIFFSetupStrips(tif)) {\n\t\ttif->tif_dir.td_nstrips = 0;\n\t\tTIFFErrorExt(tif->tif_clientdata, module, \"%s: No space for %s arrays\",\n\t\t    tif->tif_name, isTiled(tif) ? \"tile\" : \"strip\");\n\t\treturn (0);\n\t}\n\ttif->tif_tilesize = isTiled(tif) ? TIFFTileSize(tif) : (tsize_t) -1;\n\ttif->tif_scanlinesize = TIFFScanlineSize(tif);\n\ttif->tif_flags |= TIFF_BEENWRITING;\n\treturn (1);\n}\n\n/*\n * Setup the raw data buffer used for encoding.\n */\nint\nTIFFWriteBufferSetup(TIFF* tif, tdata_t bp, tsize_t size)\n{\n\tstatic const char module[] = \"TIFFWriteBufferSetup\";\n\n\tif (tif->tif_rawdata) {\n\t\tif (tif->tif_flags & TIFF_MYBUFFER) {\n\t\t\t_TIFFfree(tif->tif_rawdata);\n\t\t\ttif->tif_flags &= ~TIFF_MYBUFFER;\n\t\t}\n\t\ttif->tif_rawdata = NULL;\n\t}\n\tif (size == (tsize_t) -1) {\n\t\tsize = (isTiled(tif) ?\n\t\t    tif->tif_tilesize : TIFFStripSize(tif));\n\t\t/*\n\t\t * Make raw data buffer at least 8K\n\t\t */\n\t\tif (size < 8*1024)\n\t\t\tsize = 8*1024;\n\t\tbp = NULL;\t\t\t/* NB: force malloc */\n\t}\n\tif (bp == NULL) {\n\t\tbp = _TIFFmalloc(size);\n\t\tif (bp == NULL) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, module, \"%s: No space for output buffer\",\n\t\t\t    tif->tif_name);\n\t\t\treturn (0);\n\t\t}\n\t\ttif->tif_flags |= TIFF_MYBUFFER;\n\t} else\n\t\ttif->tif_flags &= ~TIFF_MYBUFFER;\n\ttif->tif_rawdata = (tidata_t) bp;\n\ttif->tif_rawdatasize = size;\n\ttif->tif_rawcc = 0;\n\ttif->tif_rawcp = tif->tif_rawdata;\n\ttif->tif_flags |= TIFF_BUFFERSETUP;\n\treturn (1);\n}\n\n/*\n * Grow the strip data structures by delta strips.\n */\nstatic int\nTIFFGrowStrips(TIFF* tif, int delta, const char* module)\n{\n\tTIFFDirectory\t*td = &tif->tif_dir;\n\tuint32\t\t*new_stripoffset, *new_stripbytecount;\n\n\tassert(td->td_planarconfig == PLANARCONFIG_CONTIG);\n\tnew_stripoffset = (uint32*)_TIFFrealloc(td->td_stripoffset,\n\t\t(td->td_nstrips + delta) * sizeof (uint32));\n\tnew_stripbytecount = (uint32*)_TIFFrealloc(td->td_stripbytecount,\n\t\t(td->td_nstrips + delta) * sizeof (uint32));\n\tif (new_stripoffset == NULL || new_stripbytecount == NULL) {\n\t\tif (new_stripoffset)\n\t\t\t_TIFFfree(new_stripoffset);\n\t\tif (new_stripbytecount)\n\t\t\t_TIFFfree(new_stripbytecount);\n\t\ttd->td_nstrips = 0;\n\t\tTIFFErrorExt(tif->tif_clientdata, module, \"%s: No space to expand strip arrays\",\n\t\t\t  tif->tif_name);\n\t\treturn (0);\n\t}\n\ttd->td_stripoffset = new_stripoffset;\n\ttd->td_stripbytecount = new_stripbytecount;\n\t_TIFFmemset(td->td_stripoffset + td->td_nstrips,\n\t\t    0, delta*sizeof (uint32));\n\t_TIFFmemset(td->td_stripbytecount + td->td_nstrips,\n\t\t    0, delta*sizeof (uint32));\n\ttd->td_nstrips += delta;\n\treturn (1);\n}\n\n/*\n * Append the data to the specified strip.\n */\nstatic int\nTIFFAppendToStrip(TIFF* tif, tstrip_t strip, tidata_t data, tsize_t cc)\n{\n\tstatic const char module[] = \"TIFFAppendToStrip\";\n\tTIFFDirectory *td = &tif->tif_dir;\n\n\tif (td->td_stripoffset[strip] == 0 || tif->tif_curoff == 0) {\n            assert(td->td_nstrips > 0);\n\n            if( td->td_stripbytecount[strip] != 0 \n                && td->td_stripoffset[strip] != 0 \n                && td->td_stripbytecount[strip] >= cc )\n            {\n                /* \n                 * There is already tile data on disk, and the new tile\n                 * data we have to will fit in the same space.  The only \n                 * aspect of this that is risky is that there could be\n                 * more data to append to this strip before we are done\n                 * depending on how we are getting called.\n                 */\n                if (!SeekOK(tif, td->td_stripoffset[strip])) {\n                    TIFFErrorExt(tif->tif_clientdata, module,\n                                 \"Seek error at scanline %lu\",\n                                 (unsigned long)tif->tif_row);\n                    return (0);\n                }\n            }\n            else\n            {\n                /* \n                 * Seek to end of file, and set that as our location to \n                 * write this strip.\n                 */\n                td->td_stripoffset[strip] = TIFFSeekFile(tif, 0, SEEK_END);\n            }\n\n            tif->tif_curoff = td->td_stripoffset[strip];\n\n            /*\n             * We are starting a fresh strip/tile, so set the size to zero.\n             */\n            td->td_stripbytecount[strip] = 0;\n\t}\n\n\tif (!WriteOK(tif, data, cc)) {\n\t\tTIFFErrorExt(tif->tif_clientdata, module, \"Write error at scanline %lu\",\n\t\t    (unsigned long) tif->tif_row);\n\t\t    return (0);\n\t}\n\ttif->tif_curoff =  tif->tif_curoff+cc;\n\ttd->td_stripbytecount[strip] += cc;\n\treturn (1);\n}\n\n/*\n * Internal version of TIFFFlushData that can be\n * called by ``encodestrip routines'' w/o concern\n * for infinite recursion.\n */\nint\nTIFFFlushData1(TIFF* tif)\n{\n\tif (tif->tif_rawcc > 0) {\n\t\tif (!isFillOrder(tif, tif->tif_dir.td_fillorder) &&\n\t\t    (tif->tif_flags & TIFF_NOBITREV) == 0)\n\t\t\tTIFFReverseBits((unsigned char *)tif->tif_rawdata,\n\t\t\t    tif->tif_rawcc);\n\t\tif (!TIFFAppendToStrip(tif,\n\t\t    isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip,\n\t\t    tif->tif_rawdata, tif->tif_rawcc))\n\t\t\treturn (0);\n\t\ttif->tif_rawcc = 0;\n\t\ttif->tif_rawcp = tif->tif_rawdata;\n\t}\n\treturn (1);\n}\n\n/*\n * Set the current write offset.  This should only be\n * used to set the offset to a known previous location\n * (very carefully), or to 0 so that the next write gets\n * appended to the end of the file.\n */\nvoid\nTIFFSetWriteOffset(TIFF* tif, toff_t off)\n{\n\ttif->tif_curoff = off;\n}\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/tif_zip.c",
    "content": "/* $Id: tif_zip.c,v 1.11.2.3 2007/11/22 21:24:51 fwarmerdam Exp $ */\n\n/*\n * Copyright (c) 1995-1997 Sam Leffler\n * Copyright (c) 1995-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n#include \"tiffiop.h\"\n#ifdef ZIP_SUPPORT\n/*\n * TIFF Library.\n *\n * ZIP (aka Deflate) Compression Support\n *\n * This file is simply an interface to the zlib library written by\n * Jean-loup Gailly and Mark Adler.  You must use version 1.0 or later\n * of the library: this code assumes the 1.0 API and also depends on\n * the ability to write the zlib header multiple times (one per strip)\n * which was not possible with versions prior to 0.95.  Note also that\n * older versions of this codec avoided this bug by supressing the header\n * entirely.  This means that files written with the old library cannot\n * be read; they should be converted to a different compression scheme\n * and then reconverted.\n *\n * The data format used by the zlib library is described in the files\n * zlib-3.1.doc, deflate-1.1.doc and gzip-4.1.doc, available in the\n * directory ftp://ftp.uu.net/pub/archiving/zip/doc.  The library was\n * last found at ftp://ftp.uu.net/pub/archiving/zip/zlib/zlib-0.99.tar.gz.\n */\n#include \"tif_predict.h\"\n#include \"zlib.h\"\n\n#include <stdio.h>\n\n/*\n * Sigh, ZLIB_VERSION is defined as a string so there's no\n * way to do a proper check here.  Instead we guess based\n * on the presence of #defines that were added between the\n * 0.95 and 1.0 distributions.\n */\n#if !defined(Z_NO_COMPRESSION) || !defined(Z_DEFLATED)\n#error \"Antiquated ZLIB software; you must use version 1.0 or later\"\n#endif\n\n/*\n * State block for each open TIFF\n * file using ZIP compression/decompression.\n */\ntypedef\tstruct {\n\tTIFFPredictorState predict;\n\tz_stream\tstream;\n\tint\t\tzipquality;\t\t/* compression level */\n\tint\t\tstate;\t\t\t/* state flags */\n#define ZSTATE_INIT_DECODE 0x01\n#define ZSTATE_INIT_ENCODE 0x02\n\n\tTIFFVGetMethod\tvgetparent;\t\t/* super-class method */\n\tTIFFVSetMethod\tvsetparent;\t\t/* super-class method */\n} ZIPState;\n\n#define\tZState(tif)\t\t((ZIPState*) (tif)->tif_data)\n#define\tDecoderState(tif)\tZState(tif)\n#define\tEncoderState(tif)\tZState(tif)\n\nstatic\tint ZIPEncode(TIFF*, tidata_t, tsize_t, tsample_t);\nstatic\tint ZIPDecode(TIFF*, tidata_t, tsize_t, tsample_t);\n\nstatic int\nZIPSetupDecode(TIFF* tif)\n{\n\tZIPState* sp = DecoderState(tif);\n\tstatic const char module[] = \"ZIPSetupDecode\";\n\n\tassert(sp != NULL);\n        \n        /* if we were last encoding, terminate this mode */\n\tif (sp->state & ZSTATE_INIT_ENCODE) {\n            deflateEnd(&sp->stream);\n            sp->state = 0;\n        }\n\n\tif (inflateInit(&sp->stream) != Z_OK) {\n\t\tTIFFErrorExt(tif->tif_clientdata, module, \"%s: %s\", tif->tif_name, sp->stream.msg);\n\t\treturn (0);\n\t} else {\n\t\tsp->state |= ZSTATE_INIT_DECODE;\n\t\treturn (1);\n\t}\n}\n\n/*\n * Setup state for decoding a strip.\n */\nstatic int\nZIPPreDecode(TIFF* tif, tsample_t s)\n{\n\tZIPState* sp = DecoderState(tif);\n\n\t(void) s;\n\tassert(sp != NULL);\n\n        if( (sp->state & ZSTATE_INIT_DECODE) == 0 )\n            tif->tif_setupdecode( tif );\n\n\tsp->stream.next_in = tif->tif_rawdata;\n\tsp->stream.avail_in = tif->tif_rawcc;\n\treturn (inflateReset(&sp->stream) == Z_OK);\n}\n\nstatic int\nZIPDecode(TIFF* tif, tidata_t op, tsize_t occ, tsample_t s)\n{\n\tZIPState* sp = DecoderState(tif);\n\tstatic const char module[] = \"ZIPDecode\";\n\n\t(void) s;\n\tassert(sp != NULL);\n        assert(sp->state == ZSTATE_INIT_DECODE);\n\n\tsp->stream.next_out = op;\n\tsp->stream.avail_out = occ;\n\tdo {\n\t\tint state = inflate(&sp->stream, Z_PARTIAL_FLUSH);\n\t\tif (state == Z_STREAM_END)\n\t\t\tbreak;\n\t\tif (state == Z_DATA_ERROR) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, module,\n\t\t\t    \"%s: Decoding error at scanline %d, %s\",\n\t\t\t    tif->tif_name, tif->tif_row, sp->stream.msg);\n\t\t\tif (inflateSync(&sp->stream) != Z_OK)\n\t\t\t\treturn (0);\n\t\t\tcontinue;\n\t\t}\n\t\tif (state != Z_OK) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, module, \"%s: zlib error: %s\",\n\t\t\t    tif->tif_name, sp->stream.msg);\n\t\t\treturn (0);\n\t\t}\n\t} while (sp->stream.avail_out > 0);\n\tif (sp->stream.avail_out != 0) {\n\t\tTIFFErrorExt(tif->tif_clientdata, module,\n\t\t    \"%s: Not enough data at scanline %d (short %d bytes)\",\n\t\t    tif->tif_name, tif->tif_row, sp->stream.avail_out);\n\t\treturn (0);\n\t}\n\treturn (1);\n}\n\nstatic int\nZIPSetupEncode(TIFF* tif)\n{\n\tZIPState* sp = EncoderState(tif);\n\tstatic const char module[] = \"ZIPSetupEncode\";\n\n\tassert(sp != NULL);\n\tif (sp->state & ZSTATE_INIT_DECODE) {\n            inflateEnd(&sp->stream);\n            sp->state = 0;\n        }\n\n\tif (deflateInit(&sp->stream, sp->zipquality) != Z_OK) {\n\t\tTIFFErrorExt(tif->tif_clientdata, module, \"%s: %s\", tif->tif_name, sp->stream.msg);\n\t\treturn (0);\n\t} else {\n\t\tsp->state |= ZSTATE_INIT_ENCODE;\n\t\treturn (1);\n\t}\n}\n\n/*\n * Reset encoding state at the start of a strip.\n */\nstatic int\nZIPPreEncode(TIFF* tif, tsample_t s)\n{\n\tZIPState *sp = EncoderState(tif);\n\n\t(void) s;\n\tassert(sp != NULL);\n        if( sp->state != ZSTATE_INIT_ENCODE )\n            tif->tif_setupencode( tif );\n\n\tsp->stream.next_out = tif->tif_rawdata;\n\tsp->stream.avail_out = tif->tif_rawdatasize;\n\treturn (deflateReset(&sp->stream) == Z_OK);\n}\n\n/*\n * Encode a chunk of pixels.\n */\nstatic int\nZIPEncode(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)\n{\n\tZIPState *sp = EncoderState(tif);\n\tstatic const char module[] = \"ZIPEncode\";\n\n        assert(sp != NULL);\n        assert(sp->state == ZSTATE_INIT_ENCODE);\n\n\t(void) s;\n\tsp->stream.next_in = bp;\n\tsp->stream.avail_in = cc;\n\tdo {\n\t\tif (deflate(&sp->stream, Z_NO_FLUSH) != Z_OK) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, module, \"%s: Encoder error: %s\",\n\t\t\t    tif->tif_name, sp->stream.msg);\n\t\t\treturn (0);\n\t\t}\n\t\tif (sp->stream.avail_out == 0) {\n\t\t\ttif->tif_rawcc = tif->tif_rawdatasize;\n\t\t\tTIFFFlushData1(tif);\n\t\t\tsp->stream.next_out = tif->tif_rawdata;\n\t\t\tsp->stream.avail_out = tif->tif_rawdatasize;\n\t\t}\n\t} while (sp->stream.avail_in > 0);\n\treturn (1);\n}\n\n/*\n * Finish off an encoded strip by flushing the last\n * string and tacking on an End Of Information code.\n */\nstatic int\nZIPPostEncode(TIFF* tif)\n{\n\tZIPState *sp = EncoderState(tif);\n\tstatic const char module[] = \"ZIPPostEncode\";\n\tint state;\n\n\tsp->stream.avail_in = 0;\n\tdo {\n\t\tstate = deflate(&sp->stream, Z_FINISH);\n\t\tswitch (state) {\n\t\tcase Z_STREAM_END:\n\t\tcase Z_OK:\n\t\t    if ((int)sp->stream.avail_out != (int)tif->tif_rawdatasize)\n                    {\n\t\t\t    tif->tif_rawcc =\n\t\t\t\ttif->tif_rawdatasize - sp->stream.avail_out;\n\t\t\t    TIFFFlushData1(tif);\n\t\t\t    sp->stream.next_out = tif->tif_rawdata;\n\t\t\t    sp->stream.avail_out = tif->tif_rawdatasize;\n\t\t    }\n\t\t    break;\n\t\tdefault:\n\t\t\tTIFFErrorExt(tif->tif_clientdata, module, \"%s: zlib error: %s\",\n\t\t\ttif->tif_name, sp->stream.msg);\n\t\t    return (0);\n\t\t}\n\t} while (state != Z_STREAM_END);\n\treturn (1);\n}\n\nstatic void\nZIPCleanup(TIFF* tif)\n{\n\tZIPState* sp = ZState(tif);\n\n\tassert(sp != 0);\n\n\t(void)TIFFPredictorCleanup(tif);\n\n\ttif->tif_tagmethods.vgetfield = sp->vgetparent;\n\ttif->tif_tagmethods.vsetfield = sp->vsetparent;\n\n\tif (sp->state & ZSTATE_INIT_ENCODE) {\n            deflateEnd(&sp->stream);\n            sp->state = 0;\n        } else if( sp->state & ZSTATE_INIT_DECODE) {\n            inflateEnd(&sp->stream);\n            sp->state = 0;\n\t}\n\t_TIFFfree(sp);\n\ttif->tif_data = NULL;\n\n\t_TIFFSetDefaultCompressionState(tif);\n}\n\nstatic int\nZIPVSetField(TIFF* tif, ttag_t tag, va_list ap)\n{\n\tZIPState* sp = ZState(tif);\n\tstatic const char module[] = \"ZIPVSetField\";\n\n\tswitch (tag) {\n\tcase TIFFTAG_ZIPQUALITY:\n\t\tsp->zipquality = va_arg(ap, int);\n\t\tif ( sp->state&ZSTATE_INIT_ENCODE ) {\n\t\t\tif (deflateParams(&sp->stream,\n\t\t\t    sp->zipquality, Z_DEFAULT_STRATEGY) != Z_OK) {\n\t\t\t\tTIFFErrorExt(tif->tif_clientdata, module, \"%s: zlib error: %s\",\n\t\t\t\t    tif->tif_name, sp->stream.msg);\n\t\t\t\treturn (0);\n\t\t\t}\n\t\t}\n\t\treturn (1);\n\tdefault:\n\t\treturn (*sp->vsetparent)(tif, tag, ap);\n\t}\n\t/*NOTREACHED*/\n}\n\nstatic int\nZIPVGetField(TIFF* tif, ttag_t tag, va_list ap)\n{\n\tZIPState* sp = ZState(tif);\n\n\tswitch (tag) {\n\tcase TIFFTAG_ZIPQUALITY:\n\t\t*va_arg(ap, int*) = sp->zipquality;\n\t\tbreak;\n\tdefault:\n\t\treturn (*sp->vgetparent)(tif, tag, ap);\n\t}\n\treturn (1);\n}\n\nstatic const TIFFFieldInfo zipFieldInfo[] = {\n    { TIFFTAG_ZIPQUALITY,\t 0, 0,\tTIFF_ANY,\tFIELD_PSEUDO,\n      TRUE,\tFALSE,\t\"\" },\n};\n\nint\nTIFFInitZIP(TIFF* tif, int scheme)\n{\n\tstatic const char module[] = \"TIFFInitZIP\";\n\tZIPState* sp;\n\n\tassert( (scheme == COMPRESSION_DEFLATE)\n\t\t|| (scheme == COMPRESSION_ADOBE_DEFLATE));\n\n\t/*\n\t * Merge codec-specific tag information.\n\t */\n\tif (!_TIFFMergeFieldInfo(tif, zipFieldInfo,\n\t\t\t\t TIFFArrayCount(zipFieldInfo))) {\n\t\tTIFFErrorExt(tif->tif_clientdata, module,\n\t\t\t     \"Merging Deflate codec-specific tags failed\");\n\t\treturn 0;\n\t}\n\n\t/*\n\t * Allocate state block so tag methods have storage to record values.\n\t */\n\ttif->tif_data = (tidata_t) _TIFFmalloc(sizeof (ZIPState));\n\tif (tif->tif_data == NULL)\n\t\tgoto bad;\n\tsp = ZState(tif);\n\tsp->stream.zalloc = NULL;\n\tsp->stream.zfree = NULL;\n\tsp->stream.opaque = NULL;\n\tsp->stream.data_type = Z_BINARY;\n\n\t/*\n\t * Override parent get/set field methods.\n\t */\n\tsp->vgetparent = tif->tif_tagmethods.vgetfield;\n\ttif->tif_tagmethods.vgetfield = ZIPVGetField; /* hook for codec tags */\n\tsp->vsetparent = tif->tif_tagmethods.vsetfield;\n\ttif->tif_tagmethods.vsetfield = ZIPVSetField; /* hook for codec tags */\n\n\t/* Default values for codec-specific fields */\n\tsp->zipquality = Z_DEFAULT_COMPRESSION;\t/* default comp. level */\n\tsp->state = 0;\n\n\t/*\n\t * Install codec methods.\n\t */\n\ttif->tif_setupdecode = ZIPSetupDecode;\n\ttif->tif_predecode = ZIPPreDecode;\n\ttif->tif_decoderow = ZIPDecode;\n\ttif->tif_decodestrip = ZIPDecode;\n\ttif->tif_decodetile = ZIPDecode;\n\ttif->tif_setupencode = ZIPSetupEncode;\n\ttif->tif_preencode = ZIPPreEncode;\n\ttif->tif_postencode = ZIPPostEncode;\n\ttif->tif_encoderow = ZIPEncode;\n\ttif->tif_encodestrip = ZIPEncode;\n\ttif->tif_encodetile = ZIPEncode;\n\ttif->tif_cleanup = ZIPCleanup;\n\t/*\n\t * Setup predictor setup.\n\t */\n\t(void) TIFFPredictorInit(tif);\n\treturn (1);\nbad:\n\tTIFFErrorExt(tif->tif_clientdata, module,\n\t\t     \"No space for ZIP state block\");\n\treturn (0);\n}\n#endif /* ZIP_SUPORT */\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/tiff.h",
    "content": "/* $Id: tiff.h,v 1.43 2006-10-05 15:20:40 dron Exp $ */\n\n/*\n * Copyright (c) 1988-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n#ifndef _TIFF_\n#define\t_TIFF_\n\n#include \"tiffconf.h\"\n\n/*\n * Tag Image File Format (TIFF)\n *\n * Based on Rev 6.0 from:\n *    Developer's Desk\n *    Aldus Corporation\n *    411 First Ave. South\n *    Suite 200\n *    Seattle, WA  98104\n *    206-622-5500\n *    \n *    (http://partners.adobe.com/asn/developer/PDFS/TN/TIFF6.pdf)\n *\n * For Big TIFF design notes see the following link\n *    http://www.remotesensing.org/libtiff/bigtiffdesign.html\n */\n#define\tTIFF_VERSION\t        42\n#define TIFF_BIGTIFF_VERSION    43\n\n#define\tTIFF_BIGENDIAN\t\t0x4d4d\n#define\tTIFF_LITTLEENDIAN\t0x4949\n#define\tMDI_LITTLEENDIAN        0x5045\n#define\tMDI_BIGENDIAN           0x4550\n/*\n * Intrinsic data types required by the file format:\n *\n * 8-bit quantities\tint8/uint8\n * 16-bit quantities\tint16/uint16\n * 32-bit quantities\tint32/uint32\n * strings\t\tunsigned char*\n */\n\n#ifndef HAVE_INT8\ntypedef\tsigned char int8;\t/* NB: non-ANSI compilers may not grok */\n#endif\ntypedef\tunsigned char uint8;\n#ifndef HAVE_INT16\ntypedef\tshort int16;\n#endif\ntypedef\tunsigned short uint16;\t/* sizeof (uint16) must == 2 */\n#if SIZEOF_INT == 4\n#ifndef HAVE_INT32\ntypedef\tint int32;\n#endif\ntypedef\tunsigned int uint32;\t/* sizeof (uint32) must == 4 */\n#elif SIZEOF_LONG == 4\n#ifndef HAVE_INT32\ntypedef\tlong int32;\n#endif\ntypedef\tunsigned long uint32;\t/* sizeof (uint32) must == 4 */\n#endif\n\n/* For TIFFReassignTagToIgnore */\nenum TIFFIgnoreSense /* IGNORE tag table */\n{\n\tTIS_STORE,\n\tTIS_EXTRACT,\n\tTIS_EMPTY\n};\n\n/*\n * TIFF header.\n */\ntypedef\tstruct {\n\tuint16\ttiff_magic;\t/* magic number (defines byte order) */\n#define TIFF_MAGIC_SIZE\t\t2\n\tuint16\ttiff_version;\t/* TIFF version number */\n#define TIFF_VERSION_SIZE\t2\n\tuint32\ttiff_diroff;\t/* byte offset to first directory */\n#define TIFF_DIROFFSET_SIZE\t4\n} TIFFHeader;\n\n\n/*\n * TIFF Image File Directories are comprised of a table of field\n * descriptors of the form shown below.  The table is sorted in\n * ascending order by tag.  The values associated with each entry are\n * disjoint and may appear anywhere in the file (so long as they are\n * placed on a word boundary).\n *\n * If the value is 4 bytes or less, then it is placed in the offset\n * field to save space.  If the value is less than 4 bytes, it is\n * left-justified in the offset field.\n */\ntypedef\tstruct {\n\tuint16\t\ttdir_tag;\t/* see below */\n\tuint16\t\ttdir_type;\t/* data type; see below */\n\tuint32\t\ttdir_count;\t/* number of items; length in spec */\n\tuint32\t\ttdir_offset;\t/* byte offset to field data */\n} TIFFDirEntry;\n\n/*\n * NB: In the comments below,\n *  - items marked with a + are obsoleted by revision 5.0,\n *  - items marked with a ! are introduced in revision 6.0.\n *  - items marked with a % are introduced post revision 6.0.\n *  - items marked with a $ are obsoleted by revision 6.0.\n *  - items marked with a & are introduced by Adobe DNG specification.\n */\n\n/*\n * Tag data type information.\n *\n * Note: RATIONALs are the ratio of two 32-bit integer values.\n */\ntypedef\tenum {\n\tTIFF_NOTYPE\t= 0,\t/* placeholder */\n\tTIFF_BYTE\t= 1,\t/* 8-bit unsigned integer */\n\tTIFF_ASCII\t= 2,\t/* 8-bit bytes w/ last byte null */\n\tTIFF_SHORT\t= 3,\t/* 16-bit unsigned integer */\n\tTIFF_LONG\t= 4,\t/* 32-bit unsigned integer */\n\tTIFF_RATIONAL\t= 5,\t/* 64-bit unsigned fraction */\n\tTIFF_SBYTE\t= 6,\t/* !8-bit signed integer */\n\tTIFF_UNDEFINED\t= 7,\t/* !8-bit untyped data */\n\tTIFF_SSHORT\t= 8,\t/* !16-bit signed integer */\n\tTIFF_SLONG\t= 9,\t/* !32-bit signed integer */\n\tTIFF_SRATIONAL\t= 10,\t/* !64-bit signed fraction */\n\tTIFF_FLOAT\t= 11,\t/* !32-bit IEEE floating point */\n\tTIFF_DOUBLE\t= 12,\t/* !64-bit IEEE floating point */\n\tTIFF_IFD\t= 13\t/* %32-bit unsigned integer (offset) */\n} TIFFDataType;\n\n/*\n * TIFF Tag Definitions.\n */\n#define\tTIFFTAG_SUBFILETYPE\t\t254\t/* subfile data descriptor */\n#define\t    FILETYPE_REDUCEDIMAGE\t0x1\t/* reduced resolution version */\n#define\t    FILETYPE_PAGE\t\t0x2\t/* one page of many */\n#define\t    FILETYPE_MASK\t\t0x4\t/* transparency mask */\n#define\tTIFFTAG_OSUBFILETYPE\t\t255\t/* +kind of data in subfile */\n#define\t    OFILETYPE_IMAGE\t\t1\t/* full resolution image data */\n#define\t    OFILETYPE_REDUCEDIMAGE\t2\t/* reduced size image data */\n#define\t    OFILETYPE_PAGE\t\t3\t/* one page of many */\n#define\tTIFFTAG_IMAGEWIDTH\t\t256\t/* image width in pixels */\n#define\tTIFFTAG_IMAGELENGTH\t\t257\t/* image height in pixels */\n#define\tTIFFTAG_BITSPERSAMPLE\t\t258\t/* bits per channel (sample) */\n#define\tTIFFTAG_COMPRESSION\t\t259\t/* data compression technique */\n#define\t    COMPRESSION_NONE\t\t1\t/* dump mode */\n#define\t    COMPRESSION_CCITTRLE\t2\t/* CCITT modified Huffman RLE */\n#define\t    COMPRESSION_CCITTFAX3\t3\t/* CCITT Group 3 fax encoding */\n#define     COMPRESSION_CCITT_T4        3       /* CCITT T.4 (TIFF 6 name) */\n#define\t    COMPRESSION_CCITTFAX4\t4\t/* CCITT Group 4 fax encoding */\n#define     COMPRESSION_CCITT_T6        4       /* CCITT T.6 (TIFF 6 name) */\n#define\t    COMPRESSION_LZW\t\t5       /* Lempel-Ziv  & Welch */\n#define\t    COMPRESSION_OJPEG\t\t6\t/* !6.0 JPEG */\n#define\t    COMPRESSION_JPEG\t\t7\t/* %JPEG DCT compression */\n#define\t    COMPRESSION_NEXT\t\t32766\t/* NeXT 2-bit RLE */\n#define\t    COMPRESSION_CCITTRLEW\t32771\t/* #1 w/ word alignment */\n#define\t    COMPRESSION_PACKBITS\t32773\t/* Macintosh RLE */\n#define\t    COMPRESSION_THUNDERSCAN\t32809\t/* ThunderScan RLE */\n/* codes 32895-32898 are reserved for ANSI IT8 TIFF/IT <dkelly@apago.com) */\n#define\t    COMPRESSION_IT8CTPAD\t32895   /* IT8 CT w/padding */\n#define\t    COMPRESSION_IT8LW\t\t32896   /* IT8 Linework RLE */\n#define\t    COMPRESSION_IT8MP\t\t32897   /* IT8 Monochrome picture */\n#define\t    COMPRESSION_IT8BL\t\t32898   /* IT8 Binary line art */\n/* compression codes 32908-32911 are reserved for Pixar */\n#define     COMPRESSION_PIXARFILM\t32908   /* Pixar companded 10bit LZW */\n#define\t    COMPRESSION_PIXARLOG\t32909   /* Pixar companded 11bit ZIP */\n#define\t    COMPRESSION_DEFLATE\t\t32946\t/* Deflate compression */\n#define     COMPRESSION_ADOBE_DEFLATE   8       /* Deflate compression,\n\t\t\t\t\t\t   as recognized by Adobe */\n/* compression code 32947 is reserved for Oceana Matrix <dev@oceana.com> */\n#define     COMPRESSION_DCS             32947   /* Kodak DCS encoding */\n#define\t    COMPRESSION_JBIG\t\t34661\t/* ISO JBIG */\n#define     COMPRESSION_SGILOG\t\t34676\t/* SGI Log Luminance RLE */\n#define     COMPRESSION_SGILOG24\t34677\t/* SGI Log 24-bit packed */\n#define     COMPRESSION_JP2000          34712   /* Leadtools JPEG2000 */\n#define\tTIFFTAG_PHOTOMETRIC\t\t262\t/* photometric interpretation */\n#define\t    PHOTOMETRIC_MINISWHITE\t0\t/* min value is white */\n#define\t    PHOTOMETRIC_MINISBLACK\t1\t/* min value is black */\n#define\t    PHOTOMETRIC_RGB\t\t2\t/* RGB color model */\n#define\t    PHOTOMETRIC_PALETTE\t\t3\t/* color map indexed */\n#define\t    PHOTOMETRIC_MASK\t\t4\t/* $holdout mask */\n#define\t    PHOTOMETRIC_SEPARATED\t5\t/* !color separations */\n#define\t    PHOTOMETRIC_YCBCR\t\t6\t/* !CCIR 601 */\n#define\t    PHOTOMETRIC_CIELAB\t\t8\t/* !1976 CIE L*a*b* */\n#define\t    PHOTOMETRIC_ICCLAB\t\t9\t/* ICC L*a*b* [Adobe TIFF Technote 4] */\n#define\t    PHOTOMETRIC_ITULAB\t\t10\t/* ITU L*a*b* */\n#define     PHOTOMETRIC_LOGL\t\t32844\t/* CIE Log2(L) */\n#define     PHOTOMETRIC_LOGLUV\t\t32845\t/* CIE Log2(L) (u',v') */\n#define\tTIFFTAG_THRESHHOLDING\t\t263\t/* +thresholding used on data */\n#define\t    THRESHHOLD_BILEVEL\t\t1\t/* b&w art scan */\n#define\t    THRESHHOLD_HALFTONE\t\t2\t/* or dithered scan */\n#define\t    THRESHHOLD_ERRORDIFFUSE\t3\t/* usually floyd-steinberg */\n#define\tTIFFTAG_CELLWIDTH\t\t264\t/* +dithering matrix width */\n#define\tTIFFTAG_CELLLENGTH\t\t265\t/* +dithering matrix height */\n#define\tTIFFTAG_FILLORDER\t\t266\t/* data order within a byte */\n#define\t    FILLORDER_MSB2LSB\t\t1\t/* most significant -> least */\n#define\t    FILLORDER_LSB2MSB\t\t2\t/* least significant -> most */\n#define\tTIFFTAG_DOCUMENTNAME\t\t269\t/* name of doc. image is from */\n#define\tTIFFTAG_IMAGEDESCRIPTION\t270\t/* info about image */\n#define\tTIFFTAG_MAKE\t\t\t271\t/* scanner manufacturer name */\n#define\tTIFFTAG_MODEL\t\t\t272\t/* scanner model name/number */\n#define\tTIFFTAG_STRIPOFFSETS\t\t273\t/* offsets to data strips */\n#define\tTIFFTAG_ORIENTATION\t\t274\t/* +image orientation */\n#define\t    ORIENTATION_TOPLEFT\t\t1\t/* row 0 top, col 0 lhs */\n#define\t    ORIENTATION_TOPRIGHT\t2\t/* row 0 top, col 0 rhs */\n#define\t    ORIENTATION_BOTRIGHT\t3\t/* row 0 bottom, col 0 rhs */\n#define\t    ORIENTATION_BOTLEFT\t\t4\t/* row 0 bottom, col 0 lhs */\n#define\t    ORIENTATION_LEFTTOP\t\t5\t/* row 0 lhs, col 0 top */\n#define\t    ORIENTATION_RIGHTTOP\t6\t/* row 0 rhs, col 0 top */\n#define\t    ORIENTATION_RIGHTBOT\t7\t/* row 0 rhs, col 0 bottom */\n#define\t    ORIENTATION_LEFTBOT\t\t8\t/* row 0 lhs, col 0 bottom */\n#define\tTIFFTAG_SAMPLESPERPIXEL\t\t277\t/* samples per pixel */\n#define\tTIFFTAG_ROWSPERSTRIP\t\t278\t/* rows per strip of data */\n#define\tTIFFTAG_STRIPBYTECOUNTS\t\t279\t/* bytes counts for strips */\n#define\tTIFFTAG_MINSAMPLEVALUE\t\t280\t/* +minimum sample value */\n#define\tTIFFTAG_MAXSAMPLEVALUE\t\t281\t/* +maximum sample value */\n#define\tTIFFTAG_XRESOLUTION\t\t282\t/* pixels/resolution in x */\n#define\tTIFFTAG_YRESOLUTION\t\t283\t/* pixels/resolution in y */\n#define\tTIFFTAG_PLANARCONFIG\t\t284\t/* storage organization */\n#define\t    PLANARCONFIG_CONTIG\t\t1\t/* single image plane */\n#define\t    PLANARCONFIG_SEPARATE\t2\t/* separate planes of data */\n#define\tTIFFTAG_PAGENAME\t\t285\t/* page name image is from */\n#define\tTIFFTAG_XPOSITION\t\t286\t/* x page offset of image lhs */\n#define\tTIFFTAG_YPOSITION\t\t287\t/* y page offset of image lhs */\n#define\tTIFFTAG_FREEOFFSETS\t\t288\t/* +byte offset to free block */\n#define\tTIFFTAG_FREEBYTECOUNTS\t\t289\t/* +sizes of free blocks */\n#define\tTIFFTAG_GRAYRESPONSEUNIT\t290\t/* $gray scale curve accuracy */\n#define\t    GRAYRESPONSEUNIT_10S\t1\t/* tenths of a unit */\n#define\t    GRAYRESPONSEUNIT_100S\t2\t/* hundredths of a unit */\n#define\t    GRAYRESPONSEUNIT_1000S\t3\t/* thousandths of a unit */\n#define\t    GRAYRESPONSEUNIT_10000S\t4\t/* ten-thousandths of a unit */\n#define\t    GRAYRESPONSEUNIT_100000S\t5\t/* hundred-thousandths */\n#define\tTIFFTAG_GRAYRESPONSECURVE\t291\t/* $gray scale response curve */\n#define\tTIFFTAG_GROUP3OPTIONS\t\t292\t/* 32 flag bits */\n#define\tTIFFTAG_T4OPTIONS\t\t292\t/* TIFF 6.0 proper name alias */\n#define\t    GROUP3OPT_2DENCODING\t0x1\t/* 2-dimensional coding */\n#define\t    GROUP3OPT_UNCOMPRESSED\t0x2\t/* data not compressed */\n#define\t    GROUP3OPT_FILLBITS\t\t0x4\t/* fill to byte boundary */\n#define\tTIFFTAG_GROUP4OPTIONS\t\t293\t/* 32 flag bits */\n#define TIFFTAG_T6OPTIONS               293     /* TIFF 6.0 proper name */\n#define\t    GROUP4OPT_UNCOMPRESSED\t0x2\t/* data not compressed */\n#define\tTIFFTAG_RESOLUTIONUNIT\t\t296\t/* units of resolutions */\n#define\t    RESUNIT_NONE\t\t1\t/* no meaningful units */\n#define\t    RESUNIT_INCH\t\t2\t/* english */\n#define\t    RESUNIT_CENTIMETER\t\t3\t/* metric */\n#define\tTIFFTAG_PAGENUMBER\t\t297\t/* page numbers of multi-page */\n#define\tTIFFTAG_COLORRESPONSEUNIT\t300\t/* $color curve accuracy */\n#define\t    COLORRESPONSEUNIT_10S\t1\t/* tenths of a unit */\n#define\t    COLORRESPONSEUNIT_100S\t2\t/* hundredths of a unit */\n#define\t    COLORRESPONSEUNIT_1000S\t3\t/* thousandths of a unit */\n#define\t    COLORRESPONSEUNIT_10000S\t4\t/* ten-thousandths of a unit */\n#define\t    COLORRESPONSEUNIT_100000S\t5\t/* hundred-thousandths */\n#define\tTIFFTAG_TRANSFERFUNCTION\t301\t/* !colorimetry info */\n#define\tTIFFTAG_SOFTWARE\t\t305\t/* name & release */\n#define\tTIFFTAG_DATETIME\t\t306\t/* creation date and time */\n#define\tTIFFTAG_ARTIST\t\t\t315\t/* creator of image */\n#define\tTIFFTAG_HOSTCOMPUTER\t\t316\t/* machine where created */\n#define\tTIFFTAG_PREDICTOR\t\t317\t/* prediction scheme w/ LZW */\n#define     PREDICTOR_NONE\t\t1\t/* no prediction scheme used */\n#define     PREDICTOR_HORIZONTAL\t2\t/* horizontal differencing */\n#define     PREDICTOR_FLOATINGPOINT\t3\t/* floating point predictor */\n#define\tTIFFTAG_WHITEPOINT\t\t318\t/* image white point */\n#define\tTIFFTAG_PRIMARYCHROMATICITIES\t319\t/* !primary chromaticities */\n#define\tTIFFTAG_COLORMAP\t\t320\t/* RGB map for pallette image */\n#define\tTIFFTAG_HALFTONEHINTS\t\t321\t/* !highlight+shadow info */\n#define\tTIFFTAG_TILEWIDTH\t\t322\t/* !tile width in pixels */\n#define\tTIFFTAG_TILELENGTH\t\t323\t/* !tile height in pixels */\n#define TIFFTAG_TILEOFFSETS\t\t324\t/* !offsets to data tiles */\n#define TIFFTAG_TILEBYTECOUNTS\t\t325\t/* !byte counts for tiles */\n#define\tTIFFTAG_BADFAXLINES\t\t326\t/* lines w/ wrong pixel count */\n#define\tTIFFTAG_CLEANFAXDATA\t\t327\t/* regenerated line info */\n#define\t    CLEANFAXDATA_CLEAN\t\t0\t/* no errors detected */\n#define\t    CLEANFAXDATA_REGENERATED\t1\t/* receiver regenerated lines */\n#define\t    CLEANFAXDATA_UNCLEAN\t2\t/* uncorrected errors exist */\n#define\tTIFFTAG_CONSECUTIVEBADFAXLINES\t328\t/* max consecutive bad lines */\n#define\tTIFFTAG_SUBIFD\t\t\t330\t/* subimage descriptors */\n#define\tTIFFTAG_INKSET\t\t\t332\t/* !inks in separated image */\n#define\t    INKSET_CMYK\t\t\t1\t/* !cyan-magenta-yellow-black color */\n#define\t    INKSET_MULTIINK\t\t2\t/* !multi-ink or hi-fi color */\n#define\tTIFFTAG_INKNAMES\t\t333\t/* !ascii names of inks */\n#define\tTIFFTAG_NUMBEROFINKS\t\t334\t/* !number of inks */\n#define\tTIFFTAG_DOTRANGE\t\t336\t/* !0% and 100% dot codes */\n#define\tTIFFTAG_TARGETPRINTER\t\t337\t/* !separation target */\n#define\tTIFFTAG_EXTRASAMPLES\t\t338\t/* !info about extra samples */\n#define\t    EXTRASAMPLE_UNSPECIFIED\t0\t/* !unspecified data */\n#define\t    EXTRASAMPLE_ASSOCALPHA\t1\t/* !associated alpha data */\n#define\t    EXTRASAMPLE_UNASSALPHA\t2\t/* !unassociated alpha data */\n#define\tTIFFTAG_SAMPLEFORMAT\t\t339\t/* !data sample format */\n#define\t    SAMPLEFORMAT_UINT\t\t1\t/* !unsigned integer data */\n#define\t    SAMPLEFORMAT_INT\t\t2\t/* !signed integer data */\n#define\t    SAMPLEFORMAT_IEEEFP\t\t3\t/* !IEEE floating point data */\n#define\t    SAMPLEFORMAT_VOID\t\t4\t/* !untyped data */\n#define\t    SAMPLEFORMAT_COMPLEXINT\t5\t/* !complex signed int */\n#define\t    SAMPLEFORMAT_COMPLEXIEEEFP\t6\t/* !complex ieee floating */\n#define\tTIFFTAG_SMINSAMPLEVALUE\t\t340\t/* !variable MinSampleValue */\n#define\tTIFFTAG_SMAXSAMPLEVALUE\t\t341\t/* !variable MaxSampleValue */\n#define\tTIFFTAG_CLIPPATH\t\t343\t/* %ClipPath\n\t\t\t\t\t\t   [Adobe TIFF technote 2] */\n#define\tTIFFTAG_XCLIPPATHUNITS\t\t344\t/* %XClipPathUnits\n\t\t\t\t\t\t   [Adobe TIFF technote 2] */\n#define\tTIFFTAG_YCLIPPATHUNITS\t\t345\t/* %YClipPathUnits\n\t\t\t\t\t\t   [Adobe TIFF technote 2] */\n#define\tTIFFTAG_INDEXED\t\t\t346\t/* %Indexed\n\t\t\t\t\t\t   [Adobe TIFF Technote 3] */\n#define\tTIFFTAG_JPEGTABLES\t\t347\t/* %JPEG table stream */\n#define\tTIFFTAG_OPIPROXY\t\t351\t/* %OPI Proxy [Adobe TIFF technote] */\n/*\n * Tags 512-521 are obsoleted by Technical Note #2 which specifies a\n * revised JPEG-in-TIFF scheme.\n */\n#define\tTIFFTAG_JPEGPROC\t\t512\t/* !JPEG processing algorithm */\n#define\t    JPEGPROC_BASELINE\t\t1\t/* !baseline sequential */\n#define\t    JPEGPROC_LOSSLESS\t\t14\t/* !Huffman coded lossless */\n#define\tTIFFTAG_JPEGIFOFFSET\t\t513\t/* !pointer to SOI marker */\n#define\tTIFFTAG_JPEGIFBYTECOUNT\t\t514\t/* !JFIF stream length */\n#define\tTIFFTAG_JPEGRESTARTINTERVAL\t515\t/* !restart interval length */\n#define\tTIFFTAG_JPEGLOSSLESSPREDICTORS\t517\t/* !lossless proc predictor */\n#define\tTIFFTAG_JPEGPOINTTRANSFORM\t518\t/* !lossless point transform */\n#define\tTIFFTAG_JPEGQTABLES\t\t519\t/* !Q matrice offsets */\n#define\tTIFFTAG_JPEGDCTABLES\t\t520\t/* !DCT table offsets */\n#define\tTIFFTAG_JPEGACTABLES\t\t521\t/* !AC coefficient offsets */\n#define\tTIFFTAG_YCBCRCOEFFICIENTS\t529\t/* !RGB -> YCbCr transform */\n#define\tTIFFTAG_YCBCRSUBSAMPLING\t530\t/* !YCbCr subsampling factors */\n#define\tTIFFTAG_YCBCRPOSITIONING\t531\t/* !subsample positioning */\n#define\t    YCBCRPOSITION_CENTERED\t1\t/* !as in PostScript Level 2 */\n#define\t    YCBCRPOSITION_COSITED\t2\t/* !as in CCIR 601-1 */\n#define\tTIFFTAG_REFERENCEBLACKWHITE\t532\t/* !colorimetry info */\n#define\tTIFFTAG_XMLPACKET\t\t700\t/* %XML packet\n\t\t\t\t\t\t   [Adobe XMP Specification,\n\t\t\t\t\t\t   January 2004 */\n#define TIFFTAG_OPIIMAGEID\t\t32781\t/* %OPI ImageID\n\t\t\t\t\t\t   [Adobe TIFF technote] */\n/* tags 32952-32956 are private tags registered to Island Graphics */\n#define TIFFTAG_REFPTS\t\t\t32953\t/* image reference points */\n#define TIFFTAG_REGIONTACKPOINT\t\t32954\t/* region-xform tack point */\n#define TIFFTAG_REGIONWARPCORNERS\t32955\t/* warp quadrilateral */\n#define TIFFTAG_REGIONAFFINE\t\t32956\t/* affine transformation mat */\n/* tags 32995-32999 are private tags registered to SGI */\n#define\tTIFFTAG_MATTEING\t\t32995\t/* $use ExtraSamples */\n#define\tTIFFTAG_DATATYPE\t\t32996\t/* $use SampleFormat */\n#define\tTIFFTAG_IMAGEDEPTH\t\t32997\t/* z depth of image */\n#define\tTIFFTAG_TILEDEPTH\t\t32998\t/* z depth/data tile */\n/* tags 33300-33309 are private tags registered to Pixar */\n/*\n * TIFFTAG_PIXAR_IMAGEFULLWIDTH and TIFFTAG_PIXAR_IMAGEFULLLENGTH\n * are set when an image has been cropped out of a larger image.  \n * They reflect the size of the original uncropped image.\n * The TIFFTAG_XPOSITION and TIFFTAG_YPOSITION can be used\n * to determine the position of the smaller image in the larger one.\n */\n#define TIFFTAG_PIXAR_IMAGEFULLWIDTH    33300   /* full image size in x */\n#define TIFFTAG_PIXAR_IMAGEFULLLENGTH   33301   /* full image size in y */\n /* Tags 33302-33306 are used to identify special image modes and data\n  * used by Pixar's texture formats.\n  */\n#define TIFFTAG_PIXAR_TEXTUREFORMAT\t33302\t/* texture map format */\n#define TIFFTAG_PIXAR_WRAPMODES\t\t33303\t/* s & t wrap modes */\n#define TIFFTAG_PIXAR_FOVCOT\t\t33304\t/* cotan(fov) for env. maps */\n#define TIFFTAG_PIXAR_MATRIX_WORLDTOSCREEN 33305\n#define TIFFTAG_PIXAR_MATRIX_WORLDTOCAMERA 33306\n/* tag 33405 is a private tag registered to Eastman Kodak */\n#define TIFFTAG_WRITERSERIALNUMBER      33405   /* device serial number */\n/* tag 33432 is listed in the 6.0 spec w/ unknown ownership */\n#define\tTIFFTAG_COPYRIGHT\t\t33432\t/* copyright string */\n/* IPTC TAG from RichTIFF specifications */\n#define TIFFTAG_RICHTIFFIPTC\t\t33723\n/* 34016-34029 are reserved for ANSI IT8 TIFF/IT <dkelly@apago.com) */\n#define TIFFTAG_IT8SITE\t\t\t34016\t/* site name */\n#define TIFFTAG_IT8COLORSEQUENCE\t34017\t/* color seq. [RGB,CMYK,etc] */\n#define TIFFTAG_IT8HEADER\t\t34018\t/* DDES Header */\n#define TIFFTAG_IT8RASTERPADDING\t34019\t/* raster scanline padding */\n#define TIFFTAG_IT8BITSPERRUNLENGTH\t34020\t/* # of bits in short run */\n#define TIFFTAG_IT8BITSPEREXTENDEDRUNLENGTH 34021/* # of bits in long run */\n#define TIFFTAG_IT8COLORTABLE\t\t34022\t/* LW colortable */\n#define TIFFTAG_IT8IMAGECOLORINDICATOR\t34023\t/* BP/BL image color switch */\n#define TIFFTAG_IT8BKGCOLORINDICATOR\t34024\t/* BP/BL bg color switch */\n#define TIFFTAG_IT8IMAGECOLORVALUE\t34025\t/* BP/BL image color value */\n#define TIFFTAG_IT8BKGCOLORVALUE\t34026\t/* BP/BL bg color value */\n#define TIFFTAG_IT8PIXELINTENSITYRANGE\t34027\t/* MP pixel intensity value */\n#define TIFFTAG_IT8TRANSPARENCYINDICATOR 34028\t/* HC transparency switch */\n#define TIFFTAG_IT8COLORCHARACTERIZATION 34029\t/* color character. table */\n#define TIFFTAG_IT8HCUSAGE\t\t34030\t/* HC usage indicator */\n#define TIFFTAG_IT8TRAPINDICATOR\t34031\t/* Trapping indicator\n\t\t\t\t\t\t   (untrapped=0, trapped=1) */\n#define TIFFTAG_IT8CMYKEQUIVALENT\t34032\t/* CMYK color equivalents */\n/* tags 34232-34236 are private tags registered to Texas Instruments */\n#define TIFFTAG_FRAMECOUNT              34232   /* Sequence Frame Count */\n/* tag 34377 is private tag registered to Adobe for PhotoShop */\n#define TIFFTAG_PHOTOSHOP\t\t34377 \n/* tags 34665, 34853 and 40965 are documented in EXIF specification */\n#define TIFFTAG_EXIFIFD\t\t\t34665\t/* Pointer to EXIF private directory */\n/* tag 34750 is a private tag registered to Adobe? */\n#define TIFFTAG_ICCPROFILE\t\t34675\t/* ICC profile data */\n/* tag 34750 is a private tag registered to Pixel Magic */\n#define\tTIFFTAG_JBIGOPTIONS\t\t34750\t/* JBIG options */\n#define TIFFTAG_GPSIFD\t\t\t34853\t/* Pointer to GPS private directory */\n/* tags 34908-34914 are private tags registered to SGI */\n#define\tTIFFTAG_FAXRECVPARAMS\t\t34908\t/* encoded Class 2 ses. parms */\n#define\tTIFFTAG_FAXSUBADDRESS\t\t34909\t/* received SubAddr string */\n#define\tTIFFTAG_FAXRECVTIME\t\t34910\t/* receive time (secs) */\n#define\tTIFFTAG_FAXDCS\t\t\t34911\t/* encoded fax ses. params, Table 2/T.30 */\n/* tags 37439-37443 are registered to SGI <gregl@sgi.com> */\n#define TIFFTAG_STONITS\t\t\t37439\t/* Sample value to Nits */\n/* tag 34929 is a private tag registered to FedEx */\n#define\tTIFFTAG_FEDEX_EDR\t\t34929\t/* unknown use */\n#define TIFFTAG_INTEROPERABILITYIFD\t40965\t/* Pointer to Interoperability private directory */\n/* Adobe Digital Negative (DNG) format tags */\n#define TIFFTAG_DNGVERSION\t\t50706\t/* &DNG version number */\n#define TIFFTAG_DNGBACKWARDVERSION\t50707\t/* &DNG compatibility version */\n#define TIFFTAG_UNIQUECAMERAMODEL\t50708\t/* &name for the camera model */\n#define TIFFTAG_LOCALIZEDCAMERAMODEL\t50709\t/* &localized camera model\n\t\t\t\t\t\t   name */\n#define TIFFTAG_CFAPLANECOLOR\t\t50710\t/* &CFAPattern->LinearRaw space\n\t\t\t\t\t\t   mapping */\n#define TIFFTAG_CFALAYOUT\t\t50711\t/* &spatial layout of the CFA */\n#define TIFFTAG_LINEARIZATIONTABLE\t50712\t/* &lookup table description */\n#define TIFFTAG_BLACKLEVELREPEATDIM\t50713\t/* &repeat pattern size for\n\t\t\t\t\t\t   the BlackLevel tag */\n#define TIFFTAG_BLACKLEVEL\t\t50714\t/* &zero light encoding level */\n#define TIFFTAG_BLACKLEVELDELTAH\t50715\t/* &zero light encoding level\n\t\t\t\t\t\t   differences (columns) */\n#define TIFFTAG_BLACKLEVELDELTAV\t50716\t/* &zero light encoding level\n\t\t\t\t\t\t   differences (rows) */\n#define TIFFTAG_WHITELEVEL\t\t50717\t/* &fully saturated encoding\n\t\t\t\t\t\t   level */\n#define TIFFTAG_DEFAULTSCALE\t\t50718\t/* &default scale factors */\n#define TIFFTAG_DEFAULTCROPORIGIN\t50719\t/* &origin of the final image\n\t\t\t\t\t\t   area */\n#define TIFFTAG_DEFAULTCROPSIZE\t\t50720\t/* &size of the final image \n\t\t\t\t\t\t   area */\n#define TIFFTAG_COLORMATRIX1\t\t50721\t/* &XYZ->reference color space\n\t\t\t\t\t\t   transformation matrix 1 */\n#define TIFFTAG_COLORMATRIX2\t\t50722\t/* &XYZ->reference color space\n\t\t\t\t\t\t   transformation matrix 2 */\n#define TIFFTAG_CAMERACALIBRATION1\t50723\t/* &calibration matrix 1 */\n#define TIFFTAG_CAMERACALIBRATION2\t50724\t/* &calibration matrix 2 */\n#define TIFFTAG_REDUCTIONMATRIX1\t50725\t/* &dimensionality reduction\n\t\t\t\t\t\t   matrix 1 */\n#define TIFFTAG_REDUCTIONMATRIX2\t50726\t/* &dimensionality reduction\n\t\t\t\t\t\t   matrix 2 */\n#define TIFFTAG_ANALOGBALANCE\t\t50727\t/* &gain applied the stored raw\n\t\t\t\t\t\t   values*/\n#define TIFFTAG_ASSHOTNEUTRAL\t\t50728\t/* &selected white balance in\n\t\t\t\t\t\t   linear reference space */\n#define TIFFTAG_ASSHOTWHITEXY\t\t50729\t/* &selected white balance in\n\t\t\t\t\t\t   x-y chromaticity\n\t\t\t\t\t\t   coordinates */\n#define TIFFTAG_BASELINEEXPOSURE\t50730\t/* &how much to move the zero\n\t\t\t\t\t\t   point */\n#define TIFFTAG_BASELINENOISE\t\t50731\t/* &relative noise level */\n#define TIFFTAG_BASELINESHARPNESS\t50732\t/* &relative amount of\n\t\t\t\t\t\t   sharpening */\n#define TIFFTAG_BAYERGREENSPLIT\t\t50733\t/* &how closely the values of\n\t\t\t\t\t\t   the green pixels in the\n\t\t\t\t\t\t   blue/green rows track the\n\t\t\t\t\t\t   values of the green pixels\n\t\t\t\t\t\t   in the red/green rows */\n#define TIFFTAG_LINEARRESPONSELIMIT\t50734\t/* &non-linear encoding range */\n#define TIFFTAG_CAMERASERIALNUMBER\t50735\t/* &camera's serial number */\n#define TIFFTAG_LENSINFO\t\t50736\t/* info about the lens */\n#define TIFFTAG_CHROMABLURRADIUS\t50737\t/* &chroma blur radius */\n#define TIFFTAG_ANTIALIASSTRENGTH\t50738\t/* &relative strength of the\n\t\t\t\t\t\t   camera's anti-alias filter */\n#define TIFFTAG_SHADOWSCALE\t\t50739\t/* &used by Adobe Camera Raw */\n#define TIFFTAG_DNGPRIVATEDATA\t\t50740\t/* &manufacturer's private data */\n#define TIFFTAG_MAKERNOTESAFETY\t\t50741\t/* &whether the EXIF MakerNote\n\t\t\t\t\t\t   tag is safe to preserve\n\t\t\t\t\t\t   along with the rest of the\n\t\t\t\t\t\t   EXIF data */\n#define\tTIFFTAG_CALIBRATIONILLUMINANT1\t50778\t/* &illuminant 1 */\n#define TIFFTAG_CALIBRATIONILLUMINANT2\t50779\t/* &illuminant 2 */\n#define TIFFTAG_BESTQUALITYSCALE\t50780\t/* &best quality multiplier */\n#define TIFFTAG_RAWDATAUNIQUEID\t\t50781\t/* &unique identifier for\n\t\t\t\t\t\t   the raw image data */\n#define TIFFTAG_ORIGINALRAWFILENAME\t50827\t/* &file name of the original\n\t\t\t\t\t\t   raw file */\n#define TIFFTAG_ORIGINALRAWFILEDATA\t50828\t/* &contents of the original\n\t\t\t\t\t\t   raw file */\n#define TIFFTAG_ACTIVEAREA\t\t50829\t/* &active (non-masked) pixels\n\t\t\t\t\t\t   of the sensor */\n#define TIFFTAG_MASKEDAREAS\t\t50830\t/* &list of coordinates\n\t\t\t\t\t\t   of fully masked pixels */\n#define TIFFTAG_ASSHOTICCPROFILE\t50831\t/* &these two tags used to */\n#define TIFFTAG_ASSHOTPREPROFILEMATRIX\t50832\t/* map cameras's color space\n\t\t\t\t\t\t   into ICC profile space */\n#define TIFFTAG_CURRENTICCPROFILE\t50833\t/* & */\n#define TIFFTAG_CURRENTPREPROFILEMATRIX\t50834\t/* & */\n/* tag 65535 is an undefined tag used by Eastman Kodak */\n#define TIFFTAG_DCSHUESHIFTVALUES       65535   /* hue shift correction data */\n\n/*\n * The following are ``pseudo tags'' that can be used to control\n * codec-specific functionality.  These tags are not written to file.\n * Note that these values start at 0xffff+1 so that they'll never\n * collide with Aldus-assigned tags.\n *\n * If you want your private pseudo tags ``registered'' (i.e. added to\n * this file), please post a bug report via the tracking system at\n * http://www.remotesensing.org/libtiff/bugs.html with the appropriate\n * C definitions to add.\n */\n#define\tTIFFTAG_FAXMODE\t\t\t65536\t/* Group 3/4 format control */\n#define\t    FAXMODE_CLASSIC\t0x0000\t\t/* default, include RTC */\n#define\t    FAXMODE_NORTC\t0x0001\t\t/* no RTC at end of data */\n#define\t    FAXMODE_NOEOL\t0x0002\t\t/* no EOL code at end of row */\n#define\t    FAXMODE_BYTEALIGN\t0x0004\t\t/* byte align row */\n#define\t    FAXMODE_WORDALIGN\t0x0008\t\t/* word align row */\n#define\t    FAXMODE_CLASSF\tFAXMODE_NORTC\t/* TIFF Class F */\n#define\tTIFFTAG_JPEGQUALITY\t\t65537\t/* Compression quality level */\n/* Note: quality level is on the IJG 0-100 scale.  Default value is 75 */\n#define\tTIFFTAG_JPEGCOLORMODE\t\t65538\t/* Auto RGB<=>YCbCr convert? */\n#define\t    JPEGCOLORMODE_RAW\t0x0000\t\t/* no conversion (default) */\n#define\t    JPEGCOLORMODE_RGB\t0x0001\t\t/* do auto conversion */\n#define\tTIFFTAG_JPEGTABLESMODE\t\t65539\t/* What to put in JPEGTables */\n#define\t    JPEGTABLESMODE_QUANT 0x0001\t\t/* include quantization tbls */\n#define\t    JPEGTABLESMODE_HUFF\t0x0002\t\t/* include Huffman tbls */\n/* Note: default is JPEGTABLESMODE_QUANT | JPEGTABLESMODE_HUFF */\n#define\tTIFFTAG_FAXFILLFUNC\t\t65540\t/* G3/G4 fill function */\n#define\tTIFFTAG_PIXARLOGDATAFMT\t\t65549\t/* PixarLogCodec I/O data sz */\n#define\t    PIXARLOGDATAFMT_8BIT\t0\t/* regular u_char samples */\n#define\t    PIXARLOGDATAFMT_8BITABGR\t1\t/* ABGR-order u_chars */\n#define\t    PIXARLOGDATAFMT_11BITLOG\t2\t/* 11-bit log-encoded (raw) */\n#define\t    PIXARLOGDATAFMT_12BITPICIO\t3\t/* as per PICIO (1.0==2048) */\n#define\t    PIXARLOGDATAFMT_16BIT\t4\t/* signed short samples */\n#define\t    PIXARLOGDATAFMT_FLOAT\t5\t/* IEEE float samples */\n/* 65550-65556 are allocated to Oceana Matrix <dev@oceana.com> */\n#define TIFFTAG_DCSIMAGERTYPE           65550   /* imager model & filter */\n#define     DCSIMAGERMODEL_M3           0       /* M3 chip (1280 x 1024) */\n#define     DCSIMAGERMODEL_M5           1       /* M5 chip (1536 x 1024) */\n#define     DCSIMAGERMODEL_M6           2       /* M6 chip (3072 x 2048) */\n#define     DCSIMAGERFILTER_IR          0       /* infrared filter */\n#define     DCSIMAGERFILTER_MONO        1       /* monochrome filter */\n#define     DCSIMAGERFILTER_CFA         2       /* color filter array */\n#define     DCSIMAGERFILTER_OTHER       3       /* other filter */\n#define TIFFTAG_DCSINTERPMODE           65551   /* interpolation mode */\n#define     DCSINTERPMODE_NORMAL        0x0     /* whole image, default */\n#define     DCSINTERPMODE_PREVIEW       0x1     /* preview of image (384x256) */\n#define TIFFTAG_DCSBALANCEARRAY         65552   /* color balance values */\n#define TIFFTAG_DCSCORRECTMATRIX        65553   /* color correction values */\n#define TIFFTAG_DCSGAMMA                65554   /* gamma value */\n#define TIFFTAG_DCSTOESHOULDERPTS       65555   /* toe & shoulder points */\n#define TIFFTAG_DCSCALIBRATIONFD        65556   /* calibration file desc */\n/* Note: quality level is on the ZLIB 1-9 scale. Default value is -1 */\n#define\tTIFFTAG_ZIPQUALITY\t\t65557\t/* compression quality level */\n#define\tTIFFTAG_PIXARLOGQUALITY\t\t65558\t/* PixarLog uses same scale */\n/* 65559 is allocated to Oceana Matrix <dev@oceana.com> */\n#define TIFFTAG_DCSCLIPRECTANGLE\t65559\t/* area of image to acquire */\n#define TIFFTAG_SGILOGDATAFMT\t\t65560\t/* SGILog user data format */\n#define     SGILOGDATAFMT_FLOAT\t\t0\t/* IEEE float samples */\n#define     SGILOGDATAFMT_16BIT\t\t1\t/* 16-bit samples */\n#define     SGILOGDATAFMT_RAW\t\t2\t/* uninterpreted data */\n#define     SGILOGDATAFMT_8BIT\t\t3\t/* 8-bit RGB monitor values */\n#define TIFFTAG_SGILOGENCODE\t\t65561 /* SGILog data encoding control*/\n#define     SGILOGENCODE_NODITHER\t0     /* do not dither encoded values*/\n#define     SGILOGENCODE_RANDITHER\t1     /* randomly dither encd values */\n\n/*\n * EXIF tags\n */\n#define EXIFTAG_EXPOSURETIME\t\t33434\t/* Exposure time */\n#define EXIFTAG_FNUMBER\t\t\t33437\t/* F number */\n#define EXIFTAG_EXPOSUREPROGRAM\t\t34850\t/* Exposure program */\n#define EXIFTAG_SPECTRALSENSITIVITY\t34852\t/* Spectral sensitivity */\n#define EXIFTAG_ISOSPEEDRATINGS\t\t34855\t/* ISO speed rating */\n#define EXIFTAG_OECF\t\t\t34856\t/* Optoelectric conversion\n\t\t\t\t\t\t   factor */\n#define EXIFTAG_EXIFVERSION\t\t36864\t/* Exif version */\n#define EXIFTAG_DATETIMEORIGINAL\t36867\t/* Date and time of original\n\t\t\t\t\t\t   data generation */\n#define EXIFTAG_DATETIMEDIGITIZED\t36868\t/* Date and time of digital\n\t\t\t\t\t\t   data generation */\n#define EXIFTAG_COMPONENTSCONFIGURATION\t37121\t/* Meaning of each component */\n#define EXIFTAG_COMPRESSEDBITSPERPIXEL\t37122\t/* Image compression mode */\n#define EXIFTAG_SHUTTERSPEEDVALUE\t37377\t/* Shutter speed */\n#define EXIFTAG_APERTUREVALUE\t\t37378\t/* Aperture */\n#define EXIFTAG_BRIGHTNESSVALUE\t\t37379\t/* Brightness */\n#define EXIFTAG_EXPOSUREBIASVALUE\t37380\t/* Exposure bias */\n#define EXIFTAG_MAXAPERTUREVALUE\t37381\t/* Maximum lens aperture */\n#define EXIFTAG_SUBJECTDISTANCE\t\t37382\t/* Subject distance */\n#define EXIFTAG_METERINGMODE\t\t37383\t/* Metering mode */\n#define EXIFTAG_LIGHTSOURCE\t\t37384\t/* Light source */\n#define EXIFTAG_FLASH\t\t\t37385\t/* Flash */\n#define EXIFTAG_FOCALLENGTH\t\t37386\t/* Lens focal length */\n#define EXIFTAG_SUBJECTAREA\t\t37396\t/* Subject area */\n#define EXIFTAG_MAKERNOTE\t\t37500\t/* Manufacturer notes */\n#define EXIFTAG_USERCOMMENT\t\t37510\t/* User comments */\n#define EXIFTAG_SUBSECTIME\t\t37520\t/* DateTime subseconds */\n#define EXIFTAG_SUBSECTIMEORIGINAL\t37521\t/* DateTimeOriginal subseconds */\n#define EXIFTAG_SUBSECTIMEDIGITIZED\t37522\t/* DateTimeDigitized subseconds */\n#define EXIFTAG_FLASHPIXVERSION\t\t40960\t/* Supported Flashpix version */\n#define EXIFTAG_COLORSPACE\t\t40961\t/* Color space information */\n#define EXIFTAG_PIXELXDIMENSION\t\t40962\t/* Valid image width */\n#define EXIFTAG_PIXELYDIMENSION\t\t40963\t/* Valid image height */\n#define EXIFTAG_RELATEDSOUNDFILE\t40964\t/* Related audio file */\n#define EXIFTAG_FLASHENERGY\t\t41483\t/* Flash energy */\n#define EXIFTAG_SPATIALFREQUENCYRESPONSE 41484\t/* Spatial frequency response */\n#define EXIFTAG_FOCALPLANEXRESOLUTION\t41486\t/* Focal plane X resolution */\n#define EXIFTAG_FOCALPLANEYRESOLUTION\t41487\t/* Focal plane Y resolution */\n#define EXIFTAG_FOCALPLANERESOLUTIONUNIT 41488\t/* Focal plane resolution unit */\n#define EXIFTAG_SUBJECTLOCATION\t\t41492\t/* Subject location */\n#define EXIFTAG_EXPOSUREINDEX\t\t41493\t/* Exposure index */\n#define EXIFTAG_SENSINGMETHOD\t\t41495\t/* Sensing method */\n#define EXIFTAG_FILESOURCE\t\t41728\t/* File source */\n#define EXIFTAG_SCENETYPE\t\t41729\t/* Scene type */\n#define EXIFTAG_CFAPATTERN\t\t41730\t/* CFA pattern */\n#define EXIFTAG_CUSTOMRENDERED\t\t41985\t/* Custom image processing */\n#define EXIFTAG_EXPOSUREMODE\t\t41986\t/* Exposure mode */\n#define EXIFTAG_WHITEBALANCE\t\t41987\t/* White balance */\n#define EXIFTAG_DIGITALZOOMRATIO\t41988\t/* Digital zoom ratio */\n#define EXIFTAG_FOCALLENGTHIN35MMFILM\t41989\t/* Focal length in 35 mm film */\n#define EXIFTAG_SCENECAPTURETYPE\t41990\t/* Scene capture type */\n#define EXIFTAG_GAINCONTROL\t\t41991\t/* Gain control */\n#define EXIFTAG_CONTRAST\t\t41992\t/* Contrast */\n#define EXIFTAG_SATURATION\t\t41993\t/* Saturation */\n#define EXIFTAG_SHARPNESS\t\t41994\t/* Sharpness */\n#define EXIFTAG_DEVICESETTINGDESCRIPTION 41995\t/* Device settings description */\n#define EXIFTAG_SUBJECTDISTANCERANGE\t41996\t/* Subject distance range */\n#define EXIFTAG_GAINCONTROL\t\t41991\t/* Gain control */\n#define EXIFTAG_GAINCONTROL\t\t41991\t/* Gain control */\n#define EXIFTAG_IMAGEUNIQUEID\t\t42016\t/* Unique image ID */\n\n#endif /* _TIFF_ */\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/tiffconf.h",
    "content": "/* libtiff/tiffconf.h.  Generated from tiffconf.h.in by configure.  */\n/*\n  Configuration defines for installed libtiff.\n  This file maintained for backward compatibility. Do not use definitions\n  from this file in your programs.\n*/\n\n#ifndef _TIFFCONF_\n#define _TIFFCONF_\n\n/* Define to 1 if the system has the type `int16'. */\n/* #undef HAVE_INT16 */\n\n/* Define to 1 if the system has the type `int32'. */\n/* #undef HAVE_INT32 */\n\n/* Define to 1 if the system has the type `int8'. */\n/* #undef HAVE_INT8 */\n\n/* The size of a `int', as computed by sizeof. */\n#define SIZEOF_INT 4\n\n/* The size of a `long', as computed by sizeof. */\n#define SIZEOF_LONG 4\n\n/* Compatibility stuff. */\n\n/* Define as 0 or 1 according to the floating point format suported by the\n   machine */\n#define HAVE_IEEEFP 1\n\n/* Set the native cpu bit order (FILLORDER_LSB2MSB or FILLORDER_MSB2LSB) */\n#define HOST_FILLORDER FILLORDER_LSB2MSB\n\n/* Native cpu byte order: 1 if big-endian (Motorola) or 0 if little-endian\n   (Intel) */\n#define HOST_BIGENDIAN 0\n\n/* Support CCITT Group 3 & 4 algorithms */\n#define CCITT_SUPPORT 1\n\n/* Support JPEG compression (requires IJG JPEG library) */\n#define JPEG_SUPPORT 1\n\n/* Support JBIG compression (requires JBIG-KIT library) */\n/* #undef JBIG_SUPPORT */\n\n/* Support LogLuv high dynamic range encoding */\n#define LOGLUV_SUPPORT 1\n\n/* Support LZW algorithm */\n#define LZW_SUPPORT 1\n\n/* Support NeXT 2-bit RLE algorithm */\n#define NEXT_SUPPORT 1\n\n/* Support Old JPEG compresson (read contrib/ojpeg/README first! Compilation\n   fails with unpatched IJG JPEG library) */\n#define OJPEG_SUPPORT 1\n\n/* Support Macintosh PackBits algorithm */\n#define PACKBITS_SUPPORT 1\n\n/* Support Pixar log-format algorithm (requires Zlib) */\n#define PIXARLOG_SUPPORT 1\n\n/* Support ThunderScan 4-bit RLE algorithm */\n#define THUNDER_SUPPORT 1\n\n/* Support Deflate compression */\n#define ZIP_SUPPORT 1\n\n/* Support strip chopping (whether or not to convert single-strip uncompressed\n   images to mutiple strips of ~8Kb to reduce memory usage) */\n#define STRIPCHOP_DEFAULT TIFF_STRIPCHOP\n\n/* Enable SubIFD tag (330) support */\n#define SUBIFD_SUPPORT 1\n\n/* Treat extra sample as alpha (default enabled). The RGBA interface will\n   treat a fourth sample with no EXTRASAMPLE_ value as being ASSOCALPHA. Many\n   packages produce RGBA files but don't mark the alpha properly. */\n#define DEFAULT_EXTRASAMPLE_AS_ALPHA 1\n\n/* Pick up YCbCr subsampling info from the JPEG data stream to support files\n   lacking the tag (default enabled). */\n#define CHECK_JPEG_YCBCR_SUBSAMPLING 1\n\n/* Support MS MDI magic number files as TIFF */\n#define MDI_SUPPORT 1\n\n/*\n * Feature support definitions.\n * XXX: These macros are obsoleted. Don't use them in your apps!\n * Macros stays here for backward compatibility and should be always defined.\n */\n#define COLORIMETRY_SUPPORT\n#define YCBCR_SUPPORT\n#define CMYK_SUPPORT\n#define ICC_SUPPORT\n#define PHOTOSHOP_SUPPORT\n#define IPTC_SUPPORT\n\n#endif /* _TIFFCONF_ */\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/tiffconf.h.in",
    "content": "/*\n  Configuration defines for installed libtiff.\n  This file maintained for backward compatibility. Do not use definitions\n  from this file in your programs.\n*/\n\n#ifndef _TIFFCONF_\n#define _TIFFCONF_\n\n/* Define to 1 if the system has the type `int16'. */\n#undef HAVE_INT16\n\n/* Define to 1 if the system has the type `int32'. */\n#undef HAVE_INT32\n\n/* Define to 1 if the system has the type `int8'. */\n#undef HAVE_INT8\n\n/* The size of a `int', as computed by sizeof. */\n#undef SIZEOF_INT\n\n/* The size of a `long', as computed by sizeof. */\n#undef SIZEOF_LONG\n\n/* Compatibility stuff. */\n\n/* Define as 0 or 1 according to the floating point format suported by the\n   machine */\n#undef HAVE_IEEEFP\n\n/* Set the native cpu bit order (FILLORDER_LSB2MSB or FILLORDER_MSB2LSB) */\n#undef HOST_FILLORDER\n\n/* Native cpu byte order: 1 if big-endian (Motorola) or 0 if little-endian\n   (Intel) */\n#undef HOST_BIGENDIAN\n\n/* Support CCITT Group 3 & 4 algorithms */\n#undef CCITT_SUPPORT\n\n/* Support JPEG compression (requires IJG JPEG library) */\n#undef JPEG_SUPPORT\n\n/* Support JBIG compression (requires JBIG-KIT library) */\n#undef JBIG_SUPPORT\n\n/* Support LogLuv high dynamic range encoding */\n#undef LOGLUV_SUPPORT\n\n/* Support LZW algorithm */\n#undef LZW_SUPPORT\n\n/* Support NeXT 2-bit RLE algorithm */\n#undef NEXT_SUPPORT\n\n/* Support Old JPEG compresson (read contrib/ojpeg/README first! Compilation\n   fails with unpatched IJG JPEG library) */\n#undef OJPEG_SUPPORT\n\n/* Support Macintosh PackBits algorithm */\n#undef PACKBITS_SUPPORT\n\n/* Support Pixar log-format algorithm (requires Zlib) */\n#undef PIXARLOG_SUPPORT\n\n/* Support ThunderScan 4-bit RLE algorithm */\n#undef THUNDER_SUPPORT\n\n/* Support Deflate compression */\n#undef ZIP_SUPPORT\n\n/* Support strip chopping (whether or not to convert single-strip uncompressed\n   images to mutiple strips of ~8Kb to reduce memory usage) */\n#undef STRIPCHOP_DEFAULT\n\n/* Enable SubIFD tag (330) support */\n#undef SUBIFD_SUPPORT\n\n/* Treat extra sample as alpha (default enabled). The RGBA interface will\n   treat a fourth sample with no EXTRASAMPLE_ value as being ASSOCALPHA. Many\n   packages produce RGBA files but don't mark the alpha properly. */\n#undef DEFAULT_EXTRASAMPLE_AS_ALPHA\n\n/* Pick up YCbCr subsampling info from the JPEG data stream to support files\n   lacking the tag (default enabled). */\n#undef CHECK_JPEG_YCBCR_SUBSAMPLING\n\n/* Support MS MDI magic number files as TIFF */\n#undef MDI_SUPPORT\n\n/*\n * Feature support definitions.\n * XXX: These macros are obsoleted. Don't use them in your apps!\n * Macros stays here for backward compatibility and should be always defined.\n */\n#define COLORIMETRY_SUPPORT\n#define YCBCR_SUPPORT\n#define CMYK_SUPPORT\n#define ICC_SUPPORT\n#define PHOTOSHOP_SUPPORT\n#define IPTC_SUPPORT\n\n#endif /* _TIFFCONF_ */\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/tiffconf.vc.h",
    "content": "/*\n  Configuration defines for installed libtiff.\n  This file maintained for backward compatibility. Do not use definitions\n  from this file in your programs.\n*/\n\n#ifndef _TIFFCONF_\n#define _TIFFCONF_\n\n/* Define to 1 if the system has the type `int16'. */\n/* #undef HAVE_INT16 */\n\n/* Define to 1 if the system has the type `int32'. */\n/* #undef HAVE_INT32 */\n\n/* Define to 1 if the system has the type `int8'. */\n/* #undef HAVE_INT8 */\n\n/* The size of a `int', as computed by sizeof. */\n#define SIZEOF_INT 4\n\n/* The size of a `long', as computed by sizeof. */\n#define SIZEOF_LONG 4\n\n/* Signed 64-bit type formatter */\n#define TIFF_INT64_FORMAT \"%I64d\"\n\n/* Signed 64-bit type */\n#define TIFF_INT64_T signed __int64\n\n/* Unsigned 64-bit type formatter */\n#define TIFF_UINT64_FORMAT \"%I64u\"\n\n/* Unsigned 64-bit type */\n#define TIFF_UINT64_T unsigned __int64\n\n/* Compatibility stuff. */\n\n/* Define as 0 or 1 according to the floating point format suported by the\n   machine */\n#define HAVE_IEEEFP 1\n\n/* Set the native cpu bit order (FILLORDER_LSB2MSB or FILLORDER_MSB2LSB) */\n#define HOST_FILLORDER FILLORDER_LSB2MSB\n\n/* Native cpu byte order: 1 if big-endian (Motorola) or 0 if little-endian\n   (Intel) */\n#define HOST_BIGENDIAN 0\n\n/* Support CCITT Group 3 & 4 algorithms */\n#define CCITT_SUPPORT 1\n\n/* Support JPEG compression (requires IJG JPEG library) */\n/* #undef JPEG_SUPPORT */\n\n/* Support LogLuv high dynamic range encoding */\n#define LOGLUV_SUPPORT 1\n\n/* Support LZW algorithm */\n#define LZW_SUPPORT 1\n\n/* Support NeXT 2-bit RLE algorithm */\n#define NEXT_SUPPORT 1\n\n/* Support Old JPEG compresson (read contrib/ojpeg/README first! Compilation\n   fails with unpatched IJG JPEG library) */\n/* #undef OJPEG_SUPPORT */\n\n/* Support Macintosh PackBits algorithm */\n#define PACKBITS_SUPPORT 1\n\n/* Support Pixar log-format algorithm (requires Zlib) */\n/* #undef PIXARLOG_SUPPORT */\n\n/* Support ThunderScan 4-bit RLE algorithm */\n#define THUNDER_SUPPORT 1\n\n/* Support Deflate compression */\n/* #undef ZIP_SUPPORT */\n\n/* Support strip chopping (whether or not to convert single-strip uncompressed\n   images to mutiple strips of ~8Kb to reduce memory usage) */\n#define STRIPCHOP_DEFAULT TIFF_STRIPCHOP\n\n/* Enable SubIFD tag (330) support */\n#define SUBIFD_SUPPORT 1\n\n/* Treat extra sample as alpha (default enabled). The RGBA interface will\n   treat a fourth sample with no EXTRASAMPLE_ value as being ASSOCALPHA. Many\n   packages produce RGBA files but don't mark the alpha properly. */\n#define DEFAULT_EXTRASAMPLE_AS_ALPHA 1\n\n/* Pick up YCbCr subsampling info from the JPEG data stream to support files\n   lacking the tag (default enabled). */\n#define CHECK_JPEG_YCBCR_SUBSAMPLING 1\n\n/*\n * Feature support definitions.\n * XXX: These macros are obsoleted. Don't use them in your apps!\n * Macros stays here for backward compatibility and should be always defined.\n */\n#define COLORIMETRY_SUPPORT\n#define YCBCR_SUPPORT\n#define CMYK_SUPPORT\n#define ICC_SUPPORT\n#define PHOTOSHOP_SUPPORT\n#define IPTC_SUPPORT\n\n#endif /* _TIFFCONF_ */\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/tiffconf.wince.h",
    "content": "/* $Id: tiffconf.wince.h,v 1.1.2.1 2009-01-01 17:52:51 bfriesen Exp $ */\n\n/*\n * Windows CE platform tiffconf.wince.h\n * Created by Mateusz Loskot (mateusz@loskot.net)\n *\n * NOTE: Requires WCELIBCEX library with wceex_* functions,\n * It's an extension to C library on Windows CE platform.\n * For example, HAVE_STDIO_H definition indicates there are\n * following files available:\n * stdio.h - from Windows CE / Windows Mobile SDK \n * wce_stdio.h - from WCELIBCEX library\n */\n\n\n/*\n  Configuration defines for installed libtiff.\n  This file maintained for backward compatibility. Do not use definitions\n  from this file in your programs.\n*/\n\n#ifndef _WIN32_WCE\n# error This version of tif_config.h header is dedicated for Windows CE platform!\n#endif\n\n\n#ifndef _TIFFCONF_\n#define _TIFFCONF_\n\n/* Define to 1 if the system has the type `int16'. */\n/* #undef HAVE_INT16 */\n\n/* Define to 1 if the system has the type `int32'. */\n/* #undef HAVE_INT32 */\n\n/* Define to 1 if the system has the type `int8'. */\n/* #undef HAVE_INT8 */\n\n/* The size of a `int', as computed by sizeof. */\n#define SIZEOF_INT 4\n\n/* The size of a `long', as computed by sizeof. */\n#define SIZEOF_LONG 4\n\n/* Signed 64-bit type formatter */\n#define TIFF_INT64_FORMAT \"%I64d\"\n\n/* Signed 64-bit type */\n#define TIFF_INT64_T signed __int64\n\n/* Unsigned 64-bit type formatter */\n#define TIFF_UINT64_FORMAT \"%I64u\"\n\n/* Unsigned 64-bit type */\n#define TIFF_UINT64_T unsigned __int64\n\n/* Compatibility stuff. */\n\n/* Define as 0 or 1 according to the floating point format suported by the\n   machine */\n#define HAVE_IEEEFP 1\n\n/* Set the native cpu bit order (FILLORDER_LSB2MSB or FILLORDER_MSB2LSB) */\n#define HOST_FILLORDER FILLORDER_LSB2MSB\n\n/* Native cpu byte order: 1 if big-endian (Motorola) or 0 if little-endian\n   (Intel) */\n#define HOST_BIGENDIAN 0\n\n/* Support CCITT Group 3 & 4 algorithms */\n#define CCITT_SUPPORT 1\n\n/* Support JPEG compression (requires IJG JPEG library) */\n/* #undef JPEG_SUPPORT */\n\n/* Support LogLuv high dynamic range encoding */\n#define LOGLUV_SUPPORT 1\n\n/* Support LZW algorithm */\n#define LZW_SUPPORT 1\n\n/* Support NeXT 2-bit RLE algorithm */\n#define NEXT_SUPPORT 1\n\n/* Support Old JPEG compresson (read contrib/ojpeg/README first! Compilation\n   fails with unpatched IJG JPEG library) */\n/* #undef OJPEG_SUPPORT */\n\n/* Support Macintosh PackBits algorithm */\n#define PACKBITS_SUPPORT 1\n\n/* Support Pixar log-format algorithm (requires Zlib) */\n/* #undef PIXARLOG_SUPPORT */\n\n/* Support ThunderScan 4-bit RLE algorithm */\n#define THUNDER_SUPPORT 1\n\n/* Support Deflate compression */\n/* #undef ZIP_SUPPORT */\n\n/* Support strip chopping (whether or not to convert single-strip uncompressed\n   images to mutiple strips of ~8Kb to reduce memory usage) */\n#define STRIPCHOP_DEFAULT TIFF_STRIPCHOP\n\n/* Enable SubIFD tag (330) support */\n#define SUBIFD_SUPPORT 1\n\n/* Treat extra sample as alpha (default enabled). The RGBA interface will\n   treat a fourth sample with no EXTRASAMPLE_ value as being ASSOCALPHA. Many\n   packages produce RGBA files but don't mark the alpha properly. */\n#define DEFAULT_EXTRASAMPLE_AS_ALPHA 1\n\n/* Pick up YCbCr subsampling info from the JPEG data stream to support files\n   lacking the tag (default enabled). */\n#define CHECK_JPEG_YCBCR_SUBSAMPLING 1\n\n/*\n * Feature support definitions.\n * XXX: These macros are obsoleted. Don't use them in your apps!\n * Macros stays here for backward compatibility and should be always defined.\n */\n#define COLORIMETRY_SUPPORT\n#define YCBCR_SUPPORT\n#define CMYK_SUPPORT\n#define ICC_SUPPORT\n#define PHOTOSHOP_SUPPORT\n#define IPTC_SUPPORT\n\n#endif /* _TIFFCONF_ */\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/tiffio.h",
    "content": "/* $Id: tiffio.h,v 1.56.2.3 2009-01-01 00:10:43 bfriesen Exp $ */\n\n/*\n * Copyright (c) 1988-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF\n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE\n * OF THIS SOFTWARE.\n */\n\n#ifndef _TIFFIO_\n#define\t_TIFFIO_\n\n/*\n * TIFF I/O Library Definitions.\n */\n#include \"tiff.h\"\n#include \"tiffvers.h\"\n\n/*\n * TIFF is defined as an incomplete type to hide the\n * library's internal data structures from clients.\n */\ntypedef\tstruct tiff TIFF;\n\n/*\n * The following typedefs define the intrinsic size of\n * data types used in the *exported* interfaces.  These\n * definitions depend on the proper definition of types\n * in tiff.h.  Note also that the varargs interface used\n * to pass tag types and values uses the types defined in\n * tiff.h directly.\n *\n * NB: ttag_t is unsigned int and not unsigned short because\n *     ANSI C requires that the type before the ellipsis be a\n *     promoted type (i.e. one of int, unsigned int, pointer,\n *     or double) and because we defined pseudo-tags that are\n *     outside the range of legal Aldus-assigned tags.\n * NB: tsize_t is int32 and not uint32 because some functions\n *     return -1.\n * NB: toff_t is not off_t for many reasons; TIFFs max out at\n *     32-bit file offsets being the most important, and to ensure\n *     that it is unsigned, rather than signed.\n */\ntypedef uint32 ttag_t;          /* directory tag */\ntypedef uint16 tdir_t;          /* directory index */\ntypedef uint16 tsample_t;       /* sample number */\ntypedef uint32 tstrile_t;       /* strip or tile number */\ntypedef tstrile_t tstrip_t;     /* strip number */\ntypedef tstrile_t ttile_t;      /* tile number */\ntypedef int32 tsize_t;          /* i/o size in bytes */\ntypedef void* tdata_t;          /* image data ref */\ntypedef uint32 toff_t;          /* file offset */\n\n#if !defined(__WIN32__) && (defined(_WIN32) || defined(WIN32))\n#define __WIN32__\n#endif\n\n/*\n * On windows you should define USE_WIN32_FILEIO if you are using tif_win32.c\n * or AVOID_WIN32_FILEIO if you are using something else (like tif_unix.c).\n *\n * By default tif_unix.c is assumed.\n */\n\n#if defined(_WINDOWS) || defined(__WIN32__) || defined(_Windows)\n#  if !defined(__CYGWIN) && !defined(AVOID_WIN32_FILEIO) && !defined(USE_WIN32_FILEIO)\n#    define AVOID_WIN32_FILEIO\n#  endif\n#endif\n\n#if defined(USE_WIN32_FILEIO)\n# define VC_EXTRALEAN\n# include <windows.h>\n# ifdef __WIN32__\nDECLARE_HANDLE(thandle_t);\t/* Win32 file handle */\n# else\ntypedef\tHFILE thandle_t;\t/* client data handle */\n# endif /* __WIN32__ */\n#else\ntypedef\tvoid* thandle_t;\t/* client data handle */\n#endif /* USE_WIN32_FILEIO */\n\n/*\n * Flags to pass to TIFFPrintDirectory to control\n * printing of data structures that are potentially\n * very large.   Bit-or these flags to enable printing\n * multiple items.\n */\n#define\tTIFFPRINT_NONE\t\t0x0\t\t/* no extra info */\n#define\tTIFFPRINT_STRIPS\t0x1\t\t/* strips/tiles info */\n#define\tTIFFPRINT_CURVES\t0x2\t\t/* color/gray response curves */\n#define\tTIFFPRINT_COLORMAP\t0x4\t\t/* colormap */\n#define\tTIFFPRINT_JPEGQTABLES\t0x100\t\t/* JPEG Q matrices */\n#define\tTIFFPRINT_JPEGACTABLES\t0x200\t\t/* JPEG AC tables */\n#define\tTIFFPRINT_JPEGDCTABLES\t0x200\t\t/* JPEG DC tables */\n\n/* \n * Colour conversion stuff\n */\n\n/* reference white */\n#define D65_X0 (95.0470F)\n#define D65_Y0 (100.0F)\n#define D65_Z0 (108.8827F)\n\n#define D50_X0 (96.4250F)\n#define D50_Y0 (100.0F)\n#define D50_Z0 (82.4680F)\n\n/* Structure for holding information about a display device. */\n\ntypedef\tunsigned char TIFFRGBValue;\t\t/* 8-bit samples */\n\ntypedef struct {\n\tfloat d_mat[3][3]; \t\t/* XYZ -> luminance matrix */\n\tfloat d_YCR;\t\t\t/* Light o/p for reference white */\n\tfloat d_YCG;\n\tfloat d_YCB;\n\tuint32 d_Vrwr;\t\t\t/* Pixel values for ref. white */\n\tuint32 d_Vrwg;\n\tuint32 d_Vrwb;\n\tfloat d_Y0R;\t\t\t/* Residual light for black pixel */\n\tfloat d_Y0G;\n\tfloat d_Y0B;\n\tfloat d_gammaR;\t\t\t/* Gamma values for the three guns */\n\tfloat d_gammaG;\n\tfloat d_gammaB;\n} TIFFDisplay;\n\ntypedef struct {\t\t\t\t/* YCbCr->RGB support */\n\tTIFFRGBValue* clamptab;\t\t\t/* range clamping table */\n\tint*\tCr_r_tab;\n\tint*\tCb_b_tab;\n\tint32*\tCr_g_tab;\n\tint32*\tCb_g_tab;\n        int32*  Y_tab;\n} TIFFYCbCrToRGB;\n\ntypedef struct {\t\t\t\t/* CIE Lab 1976->RGB support */\n\tint\trange;\t\t\t\t/* Size of conversion table */\n#define CIELABTORGB_TABLE_RANGE 1500\n\tfloat\trstep, gstep, bstep;\n\tfloat\tX0, Y0, Z0;\t\t\t/* Reference white point */\n\tTIFFDisplay display;\n\tfloat\tYr2r[CIELABTORGB_TABLE_RANGE + 1];  /* Conversion of Yr to r */\n\tfloat\tYg2g[CIELABTORGB_TABLE_RANGE + 1];  /* Conversion of Yg to g */\n\tfloat\tYb2b[CIELABTORGB_TABLE_RANGE + 1];  /* Conversion of Yb to b */\n} TIFFCIELabToRGB;\n\n/*\n * RGBA-style image support.\n */\ntypedef struct _TIFFRGBAImage TIFFRGBAImage;\n/*\n * The image reading and conversion routines invoke\n * ``put routines'' to copy/image/whatever tiles of\n * raw image data.  A default set of routines are \n * provided to convert/copy raw image data to 8-bit\n * packed ABGR format rasters.  Applications can supply\n * alternate routines that unpack the data into a\n * different format or, for example, unpack the data\n * and draw the unpacked raster on the display.\n */\ntypedef void (*tileContigRoutine)\n    (TIFFRGBAImage*, uint32*, uint32, uint32, uint32, uint32, int32, int32,\n\tunsigned char*);\ntypedef void (*tileSeparateRoutine)\n    (TIFFRGBAImage*, uint32*, uint32, uint32, uint32, uint32, int32, int32,\n\tunsigned char*, unsigned char*, unsigned char*, unsigned char*);\n/*\n * RGBA-reader state.\n */\nstruct _TIFFRGBAImage {\n\tTIFF* tif;                              /* image handle */\n\tint stoponerr;                          /* stop on read error */\n\tint isContig;                           /* data is packed/separate */\n\tint alpha;                              /* type of alpha data present */\n\tuint32 width;                           /* image width */\n\tuint32 height;                          /* image height */\n\tuint16 bitspersample;                   /* image bits/sample */\n\tuint16 samplesperpixel;                 /* image samples/pixel */\n\tuint16 orientation;                     /* image orientation */\n\tuint16 req_orientation;                 /* requested orientation */\n\tuint16 photometric;                     /* image photometric interp */\n\tuint16* redcmap;                        /* colormap pallete */\n\tuint16* greencmap;\n\tuint16* bluecmap;\n\t/* get image data routine */\n\tint (*get)(TIFFRGBAImage*, uint32*, uint32, uint32);\n\t/* put decoded strip/tile */\n\tunion {\n\t    void (*any)(TIFFRGBAImage*);\n\t    tileContigRoutine contig;\n\t    tileSeparateRoutine separate;\n\t} put;\n\tTIFFRGBValue* Map;                      /* sample mapping array */\n\tuint32** BWmap;                         /* black&white map */\n\tuint32** PALmap;                        /* palette image map */\n\tTIFFYCbCrToRGB* ycbcr;                  /* YCbCr conversion state */\n\tTIFFCIELabToRGB* cielab;                /* CIE L*a*b conversion state */\n\n\tint row_offset;\n\tint col_offset;\n};\n\n/*\n * Macros for extracting components from the\n * packed ABGR form returned by TIFFReadRGBAImage.\n */\n#define\tTIFFGetR(abgr)\t((abgr) & 0xff)\n#define\tTIFFGetG(abgr)\t(((abgr) >> 8) & 0xff)\n#define\tTIFFGetB(abgr)\t(((abgr) >> 16) & 0xff)\n#define\tTIFFGetA(abgr)\t(((abgr) >> 24) & 0xff)\n\n/*\n * A CODEC is a software package that implements decoding,\n * encoding, or decoding+encoding of a compression algorithm.\n * The library provides a collection of builtin codecs.\n * More codecs may be registered through calls to the library\n * and/or the builtin implementations may be overridden.\n */\ntypedef\tint (*TIFFInitMethod)(TIFF*, int);\ntypedef struct {\n\tchar*\t\tname;\n\tuint16\t\tscheme;\n\tTIFFInitMethod\tinit;\n} TIFFCodec;\n\n#include <stdio.h>\n#include <stdarg.h>\n\n/* share internal LogLuv conversion routines? */\n#ifndef LOGLUV_PUBLIC\n#define LOGLUV_PUBLIC\t\t1\n#endif\n\n#if !defined(__GNUC__) && !defined(__attribute__)\n#  define __attribute__(x) /*nothing*/\n#endif\n\n#if defined(c_plusplus) || defined(__cplusplus)\nextern \"C\" {\n#endif\ntypedef\tvoid (*TIFFErrorHandler)(const char*, const char*, va_list);\ntypedef\tvoid (*TIFFErrorHandlerExt)(thandle_t, const char*, const char*, va_list);\ntypedef\ttsize_t (*TIFFReadWriteProc)(thandle_t, tdata_t, tsize_t);\ntypedef\ttoff_t (*TIFFSeekProc)(thandle_t, toff_t, int);\ntypedef\tint (*TIFFCloseProc)(thandle_t);\ntypedef\ttoff_t (*TIFFSizeProc)(thandle_t);\ntypedef\tint (*TIFFMapFileProc)(thandle_t, tdata_t*, toff_t*);\ntypedef\tvoid (*TIFFUnmapFileProc)(thandle_t, tdata_t, toff_t);\ntypedef\tvoid (*TIFFExtendProc)(TIFF*); \n\nextern\tconst char* TIFFGetVersion(void);\n\nextern\tconst TIFFCodec* TIFFFindCODEC(uint16);\nextern\tTIFFCodec* TIFFRegisterCODEC(uint16, const char*, TIFFInitMethod);\nextern\tvoid TIFFUnRegisterCODEC(TIFFCodec*);\nextern  int TIFFIsCODECConfigured(uint16);\nextern\tTIFFCodec* TIFFGetConfiguredCODECs(void);\n\n/*\n * Auxiliary functions.\n */\n\nextern\ttdata_t _TIFFmalloc(tsize_t);\nextern\ttdata_t _TIFFrealloc(tdata_t, tsize_t);\nextern\tvoid _TIFFmemset(tdata_t, int, tsize_t);\nextern\tvoid _TIFFmemcpy(tdata_t, const tdata_t, tsize_t);\nextern\tint _TIFFmemcmp(const tdata_t, const tdata_t, tsize_t);\nextern\tvoid _TIFFfree(tdata_t);\n\n/*\n** Stuff, related to tag handling and creating custom tags.\n*/\nextern  int  TIFFGetTagListCount( TIFF * );\nextern  ttag_t TIFFGetTagListEntry( TIFF *, int tag_index );\n    \n#define\tTIFF_ANY\tTIFF_NOTYPE\t/* for field descriptor searching */\n#define\tTIFF_VARIABLE\t-1\t\t/* marker for variable length tags */\n#define\tTIFF_SPP\t-2\t\t/* marker for SamplesPerPixel tags */\n#define\tTIFF_VARIABLE2\t-3\t\t/* marker for uint32 var-length tags */\n\n#define FIELD_CUSTOM    65    \n\ntypedef\tstruct {\n\tttag_t\tfield_tag;\t\t/* field's tag */\n\tshort\tfield_readcount;\t/* read count/TIFF_VARIABLE/TIFF_SPP */\n\tshort\tfield_writecount;\t/* write count/TIFF_VARIABLE */\n\tTIFFDataType field_type;\t/* type of associated data */\n        unsigned short field_bit;\t/* bit in fieldsset bit vector */\n\tunsigned char field_oktochange;\t/* if true, can change while writing */\n\tunsigned char field_passcount;\t/* if true, pass dir count on set */\n\tchar\t*field_name;\t\t/* ASCII name */\n} TIFFFieldInfo;\n\ntypedef struct _TIFFTagValue {\n    const TIFFFieldInfo  *info;\n    int             count;\n    void           *value;\n} TIFFTagValue;\n\nextern\tvoid TIFFMergeFieldInfo(TIFF*, const TIFFFieldInfo[], int);\nextern\tconst TIFFFieldInfo* TIFFFindFieldInfo(TIFF*, ttag_t, TIFFDataType);\nextern  const TIFFFieldInfo* TIFFFindFieldInfoByName(TIFF* , const char *,\n\t\t\t\t\t\t     TIFFDataType);\nextern\tconst TIFFFieldInfo* TIFFFieldWithTag(TIFF*, ttag_t);\nextern\tconst TIFFFieldInfo* TIFFFieldWithName(TIFF*, const char *);\n\ntypedef\tint (*TIFFVSetMethod)(TIFF*, ttag_t, va_list);\ntypedef\tint (*TIFFVGetMethod)(TIFF*, ttag_t, va_list);\ntypedef\tvoid (*TIFFPrintMethod)(TIFF*, FILE*, long);\n    \ntypedef struct {\n    TIFFVSetMethod\tvsetfield;\t/* tag set routine */\n    TIFFVGetMethod\tvgetfield;\t/* tag get routine */\n    TIFFPrintMethod\tprintdir;\t/* directory print routine */\n} TIFFTagMethods;\n        \nextern  TIFFTagMethods *TIFFAccessTagMethods( TIFF * );\nextern  void *TIFFGetClientInfo( TIFF *, const char * );\nextern  void TIFFSetClientInfo( TIFF *, void *, const char * );\n\nextern\tvoid TIFFCleanup(TIFF*);\nextern\tvoid TIFFClose(TIFF*);\nextern\tint TIFFFlush(TIFF*);\nextern\tint TIFFFlushData(TIFF*);\nextern\tint TIFFGetField(TIFF*, ttag_t, ...);\nextern\tint TIFFVGetField(TIFF*, ttag_t, va_list);\nextern\tint TIFFGetFieldDefaulted(TIFF*, ttag_t, ...);\nextern\tint TIFFVGetFieldDefaulted(TIFF*, ttag_t, va_list);\nextern\tint TIFFReadDirectory(TIFF*);\nextern\tint TIFFReadCustomDirectory(TIFF*, toff_t, const TIFFFieldInfo[],\n\t\t\t\t    size_t);\nextern\tint TIFFReadEXIFDirectory(TIFF*, toff_t);\nextern\ttsize_t TIFFScanlineSize(TIFF*);\nextern\ttsize_t TIFFOldScanlineSize(TIFF*);\nextern\ttsize_t TIFFNewScanlineSize(TIFF*);\nextern\ttsize_t TIFFRasterScanlineSize(TIFF*);\nextern\ttsize_t TIFFStripSize(TIFF*);\nextern\ttsize_t TIFFRawStripSize(TIFF*, tstrip_t);\nextern\ttsize_t TIFFVStripSize(TIFF*, uint32);\nextern\ttsize_t TIFFTileRowSize(TIFF*);\nextern\ttsize_t TIFFTileSize(TIFF*);\nextern\ttsize_t TIFFVTileSize(TIFF*, uint32);\nextern\tuint32 TIFFDefaultStripSize(TIFF*, uint32);\nextern\tvoid TIFFDefaultTileSize(TIFF*, uint32*, uint32*);\nextern\tint TIFFFileno(TIFF*);\nextern  int TIFFSetFileno(TIFF*, int);\nextern  thandle_t TIFFClientdata(TIFF*);\nextern  thandle_t TIFFSetClientdata(TIFF*, thandle_t);\nextern\tint TIFFGetMode(TIFF*);\nextern\tint TIFFSetMode(TIFF*, int);\nextern\tint TIFFIsTiled(TIFF*);\nextern\tint TIFFIsByteSwapped(TIFF*);\nextern\tint TIFFIsUpSampled(TIFF*);\nextern\tint TIFFIsMSB2LSB(TIFF*);\nextern\tint TIFFIsBigEndian(TIFF*);\nextern\tTIFFReadWriteProc TIFFGetReadProc(TIFF*);\nextern\tTIFFReadWriteProc TIFFGetWriteProc(TIFF*);\nextern\tTIFFSeekProc TIFFGetSeekProc(TIFF*);\nextern\tTIFFCloseProc TIFFGetCloseProc(TIFF*);\nextern\tTIFFSizeProc TIFFGetSizeProc(TIFF*);\nextern\tTIFFMapFileProc TIFFGetMapFileProc(TIFF*);\nextern\tTIFFUnmapFileProc TIFFGetUnmapFileProc(TIFF*);\nextern\tuint32 TIFFCurrentRow(TIFF*);\nextern\ttdir_t TIFFCurrentDirectory(TIFF*);\nextern\ttdir_t TIFFNumberOfDirectories(TIFF*);\nextern\tuint32 TIFFCurrentDirOffset(TIFF*);\nextern\ttstrip_t TIFFCurrentStrip(TIFF*);\nextern\tttile_t TIFFCurrentTile(TIFF*);\nextern\tint TIFFReadBufferSetup(TIFF*, tdata_t, tsize_t);\nextern\tint TIFFWriteBufferSetup(TIFF*, tdata_t, tsize_t);\nextern\tint TIFFSetupStrips(TIFF *);\nextern  int TIFFWriteCheck(TIFF*, int, const char *);\nextern\tvoid TIFFFreeDirectory(TIFF*);\nextern  int TIFFCreateDirectory(TIFF*);\nextern\tint TIFFLastDirectory(TIFF*);\nextern\tint TIFFSetDirectory(TIFF*, tdir_t);\nextern\tint TIFFSetSubDirectory(TIFF*, uint32);\nextern\tint TIFFUnlinkDirectory(TIFF*, tdir_t);\nextern\tint TIFFSetField(TIFF*, ttag_t, ...);\nextern\tint TIFFVSetField(TIFF*, ttag_t, va_list);\nextern\tint TIFFWriteDirectory(TIFF *);\nextern\tint TIFFCheckpointDirectory(TIFF *);\nextern\tint TIFFRewriteDirectory(TIFF *);\nextern\tint TIFFReassignTagToIgnore(enum TIFFIgnoreSense, int);\n\n#if defined(c_plusplus) || defined(__cplusplus)\nextern\tvoid TIFFPrintDirectory(TIFF*, FILE*, long = 0);\nextern\tint TIFFReadScanline(TIFF*, tdata_t, uint32, tsample_t = 0);\nextern\tint TIFFWriteScanline(TIFF*, tdata_t, uint32, tsample_t = 0);\nextern\tint TIFFReadRGBAImage(TIFF*, uint32, uint32, uint32*, int = 0);\nextern\tint TIFFReadRGBAImageOriented(TIFF*, uint32, uint32, uint32*,\n\t\t\t\t      int = ORIENTATION_BOTLEFT, int = 0);\n#else\nextern\tvoid TIFFPrintDirectory(TIFF*, FILE*, long);\nextern\tint TIFFReadScanline(TIFF*, tdata_t, uint32, tsample_t);\nextern\tint TIFFWriteScanline(TIFF*, tdata_t, uint32, tsample_t);\nextern\tint TIFFReadRGBAImage(TIFF*, uint32, uint32, uint32*, int);\nextern\tint TIFFReadRGBAImageOriented(TIFF*, uint32, uint32, uint32*, int, int);\n#endif\n\nextern\tint TIFFReadRGBAStrip(TIFF*, tstrip_t, uint32 * );\nextern\tint TIFFReadRGBATile(TIFF*, uint32, uint32, uint32 * );\nextern\tint TIFFRGBAImageOK(TIFF*, char [1024]);\nextern\tint TIFFRGBAImageBegin(TIFFRGBAImage*, TIFF*, int, char [1024]);\nextern\tint TIFFRGBAImageGet(TIFFRGBAImage*, uint32*, uint32, uint32);\nextern\tvoid TIFFRGBAImageEnd(TIFFRGBAImage*);\nextern\tTIFF* TIFFOpen(const char*, const char*);\n# ifdef __WIN32__\nextern\tTIFF* TIFFOpenW(const wchar_t*, const char*);\n# endif /* __WIN32__ */\nextern\tTIFF* TIFFFdOpen(int, const char*, const char*);\nextern\tTIFF* TIFFClientOpen(const char*, const char*,\n\t    thandle_t,\n\t    TIFFReadWriteProc, TIFFReadWriteProc,\n\t    TIFFSeekProc, TIFFCloseProc,\n\t    TIFFSizeProc,\n\t    TIFFMapFileProc, TIFFUnmapFileProc);\nextern\tconst char* TIFFFileName(TIFF*);\nextern\tconst char* TIFFSetFileName(TIFF*, const char *);\nextern void TIFFError(const char*, const char*, ...) __attribute__((format (printf,2,3)));\nextern void TIFFErrorExt(thandle_t, const char*, const char*, ...) __attribute__((format (printf,3,4)));\nextern void TIFFWarning(const char*, const char*, ...) __attribute__((format (printf,2,3)));\nextern void TIFFWarningExt(thandle_t, const char*, const char*, ...) __attribute__((format (printf,3,4)));\nextern\tTIFFErrorHandler TIFFSetErrorHandler(TIFFErrorHandler);\nextern\tTIFFErrorHandlerExt TIFFSetErrorHandlerExt(TIFFErrorHandlerExt);\nextern\tTIFFErrorHandler TIFFSetWarningHandler(TIFFErrorHandler);\nextern\tTIFFErrorHandlerExt TIFFSetWarningHandlerExt(TIFFErrorHandlerExt);\nextern\tTIFFExtendProc TIFFSetTagExtender(TIFFExtendProc);\nextern\tttile_t TIFFComputeTile(TIFF*, uint32, uint32, uint32, tsample_t);\nextern\tint TIFFCheckTile(TIFF*, uint32, uint32, uint32, tsample_t);\nextern\tttile_t TIFFNumberOfTiles(TIFF*);\nextern\ttsize_t TIFFReadTile(TIFF*,\n\t    tdata_t, uint32, uint32, uint32, tsample_t);\nextern\ttsize_t TIFFWriteTile(TIFF*,\n\t    tdata_t, uint32, uint32, uint32, tsample_t);\nextern\ttstrip_t TIFFComputeStrip(TIFF*, uint32, tsample_t);\nextern\ttstrip_t TIFFNumberOfStrips(TIFF*);\nextern\ttsize_t TIFFReadEncodedStrip(TIFF*, tstrip_t, tdata_t, tsize_t);\nextern\ttsize_t TIFFReadRawStrip(TIFF*, tstrip_t, tdata_t, tsize_t);\nextern\ttsize_t TIFFReadEncodedTile(TIFF*, ttile_t, tdata_t, tsize_t);\nextern\ttsize_t TIFFReadRawTile(TIFF*, ttile_t, tdata_t, tsize_t);\nextern\ttsize_t TIFFWriteEncodedStrip(TIFF*, tstrip_t, tdata_t, tsize_t);\nextern\ttsize_t TIFFWriteRawStrip(TIFF*, tstrip_t, tdata_t, tsize_t);\nextern\ttsize_t TIFFWriteEncodedTile(TIFF*, ttile_t, tdata_t, tsize_t);\nextern\ttsize_t TIFFWriteRawTile(TIFF*, ttile_t, tdata_t, tsize_t);\nextern\tint TIFFDataWidth(TIFFDataType);    /* table of tag datatype widths */\nextern\tvoid TIFFSetWriteOffset(TIFF*, toff_t);\nextern\tvoid TIFFSwabShort(uint16*);\nextern\tvoid TIFFSwabLong(uint32*);\nextern\tvoid TIFFSwabDouble(double*);\nextern\tvoid TIFFSwabArrayOfShort(uint16*, unsigned long);\nextern\tvoid TIFFSwabArrayOfTriples(uint8*, unsigned long);\nextern\tvoid TIFFSwabArrayOfLong(uint32*, unsigned long);\nextern\tvoid TIFFSwabArrayOfDouble(double*, unsigned long);\nextern\tvoid TIFFReverseBits(unsigned char *, unsigned long);\nextern\tconst unsigned char* TIFFGetBitRevTable(int);\n\n#ifdef LOGLUV_PUBLIC\n#define U_NEU\t\t0.210526316\n#define V_NEU\t\t0.473684211\n#define UVSCALE\t\t410.\nextern\tdouble LogL16toY(int);\nextern\tdouble LogL10toY(int);\nextern\tvoid XYZtoRGB24(float*, uint8*);\nextern\tint uv_decode(double*, double*, int);\nextern\tvoid LogLuv24toXYZ(uint32, float*);\nextern\tvoid LogLuv32toXYZ(uint32, float*);\n#if defined(c_plusplus) || defined(__cplusplus)\nextern\tint LogL16fromY(double, int = SGILOGENCODE_NODITHER);\nextern\tint LogL10fromY(double, int = SGILOGENCODE_NODITHER);\nextern\tint uv_encode(double, double, int = SGILOGENCODE_NODITHER);\nextern\tuint32 LogLuv24fromXYZ(float*, int = SGILOGENCODE_NODITHER);\nextern\tuint32 LogLuv32fromXYZ(float*, int = SGILOGENCODE_NODITHER);\n#else\nextern\tint LogL16fromY(double, int);\nextern\tint LogL10fromY(double, int);\nextern\tint uv_encode(double, double, int);\nextern\tuint32 LogLuv24fromXYZ(float*, int);\nextern\tuint32 LogLuv32fromXYZ(float*, int);\n#endif\n#endif /* LOGLUV_PUBLIC */\n    \nextern int TIFFCIELabToRGBInit(TIFFCIELabToRGB*, TIFFDisplay *, float*);\nextern void TIFFCIELabToXYZ(TIFFCIELabToRGB *, uint32, int32, int32,\n\t\t\t    float *, float *, float *);\nextern void TIFFXYZToRGB(TIFFCIELabToRGB *, float, float, float,\n\t\t\t uint32 *, uint32 *, uint32 *);\n\nextern int TIFFYCbCrToRGBInit(TIFFYCbCrToRGB*, float*, float*);\nextern void TIFFYCbCrtoRGB(TIFFYCbCrToRGB *, uint32, int32, int32,\n\t\t\t   uint32 *, uint32 *, uint32 *);\n\n#if defined(c_plusplus) || defined(__cplusplus)\n}\n#endif\n\n#endif /* _TIFFIO_ */\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/tiffio.hxx",
    "content": "/* $Id: tiffio.hxx,v 1.1 2004/11/21 16:12:08 dron Exp $ */\n\n/*\n * Copyright (c) 1988-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n#ifndef _TIFFIO_HXX_\n#define\t_TIFFIO_HXX_\n\n/*\n * TIFF I/O library definitions which provide C++ streams API.\n */\n\n#include <iostream>\n#include \"tiff.h\"\n\nextern\tTIFF* TIFFStreamOpen(const char*, std::ostream *);\nextern\tTIFF* TIFFStreamOpen(const char*, std::istream *);\n\n#endif /* _TIFFIO_HXX_ */\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/tiffiop.h",
    "content": "/* $Id: tiffiop.h,v 1.51.2.1 2009-01-06 19:08:09 bfriesen Exp $ */\n\n/*\n * Copyright (c) 1988-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n#ifndef _TIFFIOP_\n#define\t_TIFFIOP_\n/*\n * ``Library-private'' definitions.\n */\n\n#include \"tif_config.h\"\n\n#ifdef HAVE_FCNTL_H\n# include <fcntl.h>\n#endif\n\n#ifdef HAVE_SYS_TYPES_H\n# include <sys/types.h>\n#endif\n\n#ifdef HAVE_STRING_H\n# include <string.h>\n#endif\n\n#ifdef HAVE_ASSERT_H\n# include <assert.h>\n#else\n# define assert(x) \n#endif\n\n#ifdef HAVE_SEARCH_H\n# include <search.h>\n#else\nextern void *lfind(const void *, const void *, size_t *, size_t,\n\t\t   int (*)(const void *, const void *));\n#endif\n\n/*\n  Libtiff itself does not require a 64-bit type, but bundled TIFF\n  utilities may use it.\n*/\ntypedef TIFF_INT64_T  int64;\ntypedef TIFF_UINT64_T uint64;\n\n#include \"tiffio.h\"\n#include \"tif_dir.h\"\n\n#ifndef STRIP_SIZE_DEFAULT\n# define STRIP_SIZE_DEFAULT 8192\n#endif\n\n#define    streq(a,b)      (strcmp(a,b) == 0)\n\n#ifndef TRUE\n#define\tTRUE\t1\n#define\tFALSE\t0\n#endif\n\ntypedef struct client_info {\n    struct client_info *next;\n    void      *data;\n    char      *name;\n} TIFFClientInfoLink;\n\n/*\n * Typedefs for ``method pointers'' used internally.\n */\ntypedef\tunsigned char tidataval_t;\t/* internal image data value type */\ntypedef\ttidataval_t* tidata_t;\t\t/* reference to internal image data */\n\ntypedef\tvoid (*TIFFVoidMethod)(TIFF*);\ntypedef\tint (*TIFFBoolMethod)(TIFF*);\ntypedef\tint (*TIFFPreMethod)(TIFF*, tsample_t);\ntypedef\tint (*TIFFCodeMethod)(TIFF*, tidata_t, tsize_t, tsample_t);\ntypedef\tint (*TIFFSeekMethod)(TIFF*, uint32);\ntypedef\tvoid (*TIFFPostMethod)(TIFF*, tidata_t, tsize_t);\ntypedef\tuint32 (*TIFFStripMethod)(TIFF*, uint32);\ntypedef\tvoid (*TIFFTileMethod)(TIFF*, uint32*, uint32*);\n\nstruct tiff {\n\tchar*\t\ttif_name;\t/* name of open file */\n\tint\t\ttif_fd;\t\t/* open file descriptor */\n\tint\t\ttif_mode;\t/* open mode (O_*) */\n\tuint32\t\ttif_flags;\n#define\tTIFF_FILLORDER\t\t0x00003\t/* natural bit fill order for machine */\n#define\tTIFF_DIRTYHEADER\t0x00004\t/* header must be written on close */\n#define\tTIFF_DIRTYDIRECT\t0x00008\t/* current directory must be written */\n#define\tTIFF_BUFFERSETUP\t0x00010\t/* data buffers setup */\n#define\tTIFF_CODERSETUP\t\t0x00020\t/* encoder/decoder setup done */\n#define\tTIFF_BEENWRITING\t0x00040\t/* written 1+ scanlines to file */\n#define\tTIFF_SWAB\t\t0x00080\t/* byte swap file information */\n#define\tTIFF_NOBITREV\t\t0x00100\t/* inhibit bit reversal logic */\n#define\tTIFF_MYBUFFER\t\t0x00200\t/* my raw data buffer; free on close */\n#define\tTIFF_ISTILED\t\t0x00400\t/* file is tile, not strip- based */\n#define\tTIFF_MAPPED\t\t0x00800\t/* file is mapped into memory */\n#define\tTIFF_POSTENCODE\t\t0x01000\t/* need call to postencode routine */\n#define\tTIFF_INSUBIFD\t\t0x02000\t/* currently writing a subifd */\n#define\tTIFF_UPSAMPLED\t\t0x04000\t/* library is doing data up-sampling */ \n#define\tTIFF_STRIPCHOP\t\t0x08000\t/* enable strip chopping support */\n#define\tTIFF_HEADERONLY\t\t0x10000\t/* read header only, do not process */\n\t\t\t\t\t/* the first directory */\n#define TIFF_NOREADRAW\t\t0x20000 /* skip reading of raw uncompressed */\n\t\t\t\t\t/* image data */\n#define\tTIFF_INCUSTOMIFD\t0x40000\t/* currently writing a custom IFD */\n\ttoff_t\t\ttif_diroff;\t/* file offset of current directory */\n\ttoff_t\t\ttif_nextdiroff;\t/* file offset of following directory */\n\ttoff_t*\t\ttif_dirlist;\t/* list of offsets to already seen */\n\t\t\t\t\t/* directories to prevent IFD looping */\n\ttsize_t\t\ttif_dirlistsize;/* number of entires in offset list */\n\tuint16\t\ttif_dirnumber;  /* number of already seen directories */\n\tTIFFDirectory\ttif_dir;\t/* internal rep of current directory */\n\tTIFFDirectory\ttif_customdir;\t/* custom IFDs are separated from\n\t\t\t\t\t   the main ones */\n\tTIFFHeader\ttif_header;\t/* file's header block */\n\tconst int*\ttif_typeshift;\t/* data type shift counts */\n\tconst long*\ttif_typemask;\t/* data type masks */\n\tuint32\t\ttif_row;\t/* current scanline */\n\ttdir_t\t\ttif_curdir;\t/* current directory (index) */\n\ttstrip_t\ttif_curstrip;\t/* current strip for read/write */\n\ttoff_t\t\ttif_curoff;\t/* current offset for read/write */\n\ttoff_t\t\ttif_dataoff;\t/* current offset for writing dir */\n/* SubIFD support */\n\tuint16\t\ttif_nsubifd;\t/* remaining subifds to write */\n\ttoff_t\t\ttif_subifdoff;\t/* offset for patching SubIFD link */\n/* tiling support */\n\tuint32 \t\ttif_col;\t/* current column (offset by row too) */\n\tttile_t\t\ttif_curtile;\t/* current tile for read/write */\n\ttsize_t\t\ttif_tilesize;\t/* # of bytes in a tile */\n/* compression scheme hooks */\n\tint\t\ttif_decodestatus;\n\tTIFFBoolMethod\ttif_setupdecode;/* called once before predecode */\n\tTIFFPreMethod\ttif_predecode;\t/* pre- row/strip/tile decoding */\n\tTIFFBoolMethod\ttif_setupencode;/* called once before preencode */\n\tint\t\ttif_encodestatus;\n\tTIFFPreMethod\ttif_preencode;\t/* pre- row/strip/tile encoding */\n\tTIFFBoolMethod\ttif_postencode;\t/* post- row/strip/tile encoding */\n\tTIFFCodeMethod\ttif_decoderow;\t/* scanline decoding routine */\n\tTIFFCodeMethod\ttif_encoderow;\t/* scanline encoding routine */\n\tTIFFCodeMethod\ttif_decodestrip;/* strip decoding routine */\n\tTIFFCodeMethod\ttif_encodestrip;/* strip encoding routine */\n\tTIFFCodeMethod\ttif_decodetile;\t/* tile decoding routine */\n\tTIFFCodeMethod\ttif_encodetile;\t/* tile encoding routine */\n\tTIFFVoidMethod\ttif_close;\t/* cleanup-on-close routine */\n\tTIFFSeekMethod\ttif_seek;\t/* position within a strip routine */\n\tTIFFVoidMethod\ttif_cleanup;\t/* cleanup state routine */\n\tTIFFStripMethod\ttif_defstripsize;/* calculate/constrain strip size */\n\tTIFFTileMethod\ttif_deftilesize;/* calculate/constrain tile size */\n\ttidata_t\ttif_data;\t/* compression scheme private data */\n/* input/output buffering */\n\ttsize_t\t\ttif_scanlinesize;/* # of bytes in a scanline */\n\ttsize_t\t\ttif_scanlineskew;/* scanline skew for reading strips */\n\ttidata_t\ttif_rawdata;\t/* raw data buffer */\n\ttsize_t\t\ttif_rawdatasize;/* # of bytes in raw data buffer */\n\ttidata_t\ttif_rawcp;\t/* current spot in raw buffer */\n\ttsize_t\t\ttif_rawcc;\t/* bytes unread from raw buffer */\n/* memory-mapped file support */\n\ttidata_t\ttif_base;\t/* base of mapped file */\n\ttoff_t\t\ttif_size;\t/* size of mapped file region (bytes)\n\t\t\t\t\t   FIXME: it should be tsize_t */\n\tTIFFMapFileProc\ttif_mapproc;\t/* map file method */\n\tTIFFUnmapFileProc tif_unmapproc;/* unmap file method */\n/* input/output callback methods */\n\tthandle_t\ttif_clientdata;\t/* callback parameter */\n\tTIFFReadWriteProc tif_readproc;\t/* read method */\n\tTIFFReadWriteProc tif_writeproc;/* write method */\n\tTIFFSeekProc\ttif_seekproc;\t/* lseek method */\n\tTIFFCloseProc\ttif_closeproc;\t/* close method */\n\tTIFFSizeProc\ttif_sizeproc;\t/* filesize method */\n/* post-decoding support */\n\tTIFFPostMethod\ttif_postdecode;\t/* post decoding routine */\n/* tag support */\n\tTIFFFieldInfo**\ttif_fieldinfo;\t/* sorted table of registered tags */\n\tsize_t\t\ttif_nfields;\t/* # entries in registered tag table */\n\tconst TIFFFieldInfo *tif_foundfield;/* cached pointer to already found tag */\n        TIFFTagMethods  tif_tagmethods; /* tag get/set/print routines */\n        TIFFClientInfoLink *tif_clientinfo; /* extra client information. */\n};\n\n#define\tisPseudoTag(t)\t(t > 0xffff)\t/* is tag value normal or pseudo */\n\n#define\tisTiled(tif)\t(((tif)->tif_flags & TIFF_ISTILED) != 0)\n#define\tisMapped(tif)\t(((tif)->tif_flags & TIFF_MAPPED) != 0)\n#define\tisFillOrder(tif, o)\t(((tif)->tif_flags & (o)) != 0)\n#define\tisUpSampled(tif)\t(((tif)->tif_flags & TIFF_UPSAMPLED) != 0)\n#define\tTIFFReadFile(tif, buf, size) \\\n\t((*(tif)->tif_readproc)((tif)->tif_clientdata,buf,size))\n#define\tTIFFWriteFile(tif, buf, size) \\\n\t((*(tif)->tif_writeproc)((tif)->tif_clientdata,buf,size))\n#define\tTIFFSeekFile(tif, off, whence) \\\n\t((*(tif)->tif_seekproc)((tif)->tif_clientdata,(toff_t)(off),whence))\n#define\tTIFFCloseFile(tif) \\\n\t((*(tif)->tif_closeproc)((tif)->tif_clientdata))\n#define\tTIFFGetFileSize(tif) \\\n\t((*(tif)->tif_sizeproc)((tif)->tif_clientdata))\n#define\tTIFFMapFileContents(tif, paddr, psize) \\\n\t((*(tif)->tif_mapproc)((tif)->tif_clientdata,paddr,psize))\n#define\tTIFFUnmapFileContents(tif, addr, size) \\\n\t((*(tif)->tif_unmapproc)((tif)->tif_clientdata,addr,size))\n\n/*\n * Default Read/Seek/Write definitions.\n */\n#ifndef ReadOK\n#define\tReadOK(tif, buf, size) \\\n\t(TIFFReadFile(tif, (tdata_t) buf, (tsize_t)(size)) == (tsize_t)(size))\n#endif\n#ifndef SeekOK\n#define\tSeekOK(tif, off) \\\n\t(TIFFSeekFile(tif, (toff_t) off, SEEK_SET) == (toff_t) off)\n#endif\n#ifndef WriteOK\n#define\tWriteOK(tif, buf, size) \\\n\t(TIFFWriteFile(tif, (tdata_t) buf, (tsize_t) size) == (tsize_t) size)\n#endif\n\n/* NB: the uint32 casts are to silence certain ANSI-C compilers */\n#define TIFFhowmany(x, y) ((((uint32)(x))+(((uint32)(y))-1))/((uint32)(y)))\n#define TIFFhowmany8(x) (((x)&0x07)?((uint32)(x)>>3)+1:(uint32)(x)>>3)\n#define\tTIFFroundup(x, y) (TIFFhowmany(x,y)*(y))\n\n#define TIFFmax(A,B) ((A)>(B)?(A):(B))\n#define TIFFmin(A,B) ((A)<(B)?(A):(B))\n\n#define TIFFArrayCount(a) (sizeof (a) / sizeof ((a)[0]))\n\n#if defined(__cplusplus)\nextern \"C\" {\n#endif\nextern\tint _TIFFgetMode(const char*, const char*);\nextern\tint _TIFFNoRowEncode(TIFF*, tidata_t, tsize_t, tsample_t);\nextern\tint _TIFFNoStripEncode(TIFF*, tidata_t, tsize_t, tsample_t);\nextern\tint _TIFFNoTileEncode(TIFF*, tidata_t, tsize_t, tsample_t);\nextern\tint _TIFFNoRowDecode(TIFF*, tidata_t, tsize_t, tsample_t);\nextern\tint _TIFFNoStripDecode(TIFF*, tidata_t, tsize_t, tsample_t);\nextern\tint _TIFFNoTileDecode(TIFF*, tidata_t, tsize_t, tsample_t);\nextern\tvoid _TIFFNoPostDecode(TIFF*, tidata_t, tsize_t);\nextern  int  _TIFFNoPreCode (TIFF*, tsample_t); \nextern\tint _TIFFNoSeek(TIFF*, uint32);\nextern\tvoid _TIFFSwab16BitData(TIFF*, tidata_t, tsize_t);\nextern\tvoid _TIFFSwab24BitData(TIFF*, tidata_t, tsize_t);\nextern\tvoid _TIFFSwab32BitData(TIFF*, tidata_t, tsize_t);\nextern\tvoid _TIFFSwab64BitData(TIFF*, tidata_t, tsize_t);\nextern\tint TIFFFlushData1(TIFF*);\nextern\tint TIFFDefaultDirectory(TIFF*);\nextern\tvoid _TIFFSetDefaultCompressionState(TIFF*);\nextern\tint TIFFSetCompressionScheme(TIFF*, int);\nextern\tint TIFFSetDefaultCompressionState(TIFF*);\nextern\tuint32 _TIFFDefaultStripSize(TIFF*, uint32);\nextern\tvoid _TIFFDefaultTileSize(TIFF*, uint32*, uint32*);\nextern\tint _TIFFDataSize(TIFFDataType);\n\nextern\tvoid _TIFFsetByteArray(void**, void*, uint32);\nextern\tvoid _TIFFsetString(char**, char*);\nextern\tvoid _TIFFsetShortArray(uint16**, uint16*, uint32);\nextern\tvoid _TIFFsetLongArray(uint32**, uint32*, uint32);\nextern\tvoid _TIFFsetFloatArray(float**, float*, uint32);\nextern\tvoid _TIFFsetDoubleArray(double**, double*, uint32);\n\nextern\tvoid _TIFFprintAscii(FILE*, const char*);\nextern\tvoid _TIFFprintAsciiTag(FILE*, const char*, const char*);\n\nextern\tTIFFErrorHandler _TIFFwarningHandler;\nextern\tTIFFErrorHandler _TIFFerrorHandler;\nextern\tTIFFErrorHandlerExt _TIFFwarningHandlerExt;\nextern\tTIFFErrorHandlerExt _TIFFerrorHandlerExt;\n\nextern\ttdata_t _TIFFCheckMalloc(TIFF*, size_t, size_t, const char*);\nextern\ttdata_t _TIFFCheckRealloc(TIFF*, tdata_t, size_t, size_t, const char*);\n\nextern\tint TIFFInitDumpMode(TIFF*, int);\n#ifdef PACKBITS_SUPPORT\nextern\tint TIFFInitPackBits(TIFF*, int);\n#endif\n#ifdef CCITT_SUPPORT\nextern\tint TIFFInitCCITTRLE(TIFF*, int), TIFFInitCCITTRLEW(TIFF*, int);\nextern\tint TIFFInitCCITTFax3(TIFF*, int), TIFFInitCCITTFax4(TIFF*, int);\n#endif\n#ifdef THUNDER_SUPPORT\nextern\tint TIFFInitThunderScan(TIFF*, int);\n#endif\n#ifdef NEXT_SUPPORT\nextern\tint TIFFInitNeXT(TIFF*, int);\n#endif\n#ifdef LZW_SUPPORT\nextern\tint TIFFInitLZW(TIFF*, int);\n#endif\n#ifdef OJPEG_SUPPORT\nextern\tint TIFFInitOJPEG(TIFF*, int);\n#endif\n#ifdef JPEG_SUPPORT\nextern\tint TIFFInitJPEG(TIFF*, int);\n#endif\n#ifdef JBIG_SUPPORT\nextern\tint TIFFInitJBIG(TIFF*, int);\n#endif\n#ifdef ZIP_SUPPORT\nextern\tint TIFFInitZIP(TIFF*, int);\n#endif\n#ifdef PIXARLOG_SUPPORT\nextern\tint TIFFInitPixarLog(TIFF*, int);\n#endif\n#ifdef LOGLUV_SUPPORT\nextern\tint TIFFInitSGILog(TIFF*, int);\n#endif\n#ifdef VMS\nextern\tconst TIFFCodec _TIFFBuiltinCODECS[];\n#else\nextern\tTIFFCodec _TIFFBuiltinCODECS[];\n#endif\n\n#if defined(__cplusplus)\n}\n#endif\n#endif /* _TIFFIOP_ */\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/tiffvers.h",
    "content": "#define TIFFLIB_VERSION_STR \"LIBTIFF, Version 3.9.2\\nCopyright (c) 1988-1996 Sam Leffler\\nCopyright (c) 1991-1996 Silicon Graphics, Inc.\"\n/*\n * This define can be used in code that requires\n * compilation-related definitions specific to a\n * version or versions of the library.  Runtime\n * version checking should be done based on the\n * string returned by TIFFGetVersion.\n */\n#define TIFFLIB_VERSION 20091104\n"
  },
  {
    "path": "src/main/jni/tiff/libtiff/uvcode.h",
    "content": "/* Version 1.0 generated April 7, 1997 by Greg Ward Larson, SGI */\n#define UV_SQSIZ\t(float)0.003500\n#define UV_NDIVS\t16289\n#define UV_VSTART\t(float)0.016940\n#define UV_NVS\t\t163\nstatic struct {\n\tfloat\tustart;\n\tshort\tnus, ncum;\n}\tuv_row[UV_NVS] = {\n\t{ (float)0.247663,\t4,\t0 },\n\t{ (float)0.243779,\t6,\t4 },\n\t{ (float)0.241684,\t7,\t10 },\n\t{ (float)0.237874,\t9,\t17 },\n\t{ (float)0.235906,\t10,\t26 },\n\t{ (float)0.232153,\t12,\t36 },\n\t{ (float)0.228352,\t14,\t48 },\n\t{ (float)0.226259,\t15,\t62 },\n\t{ (float)0.222371,\t17,\t77 },\n\t{ (float)0.220410,\t18,\t94 },\n\t{ (float)0.214710,\t21,\t112 },\n\t{ (float)0.212714,\t22,\t133 },\n\t{ (float)0.210721,\t23,\t155 },\n\t{ (float)0.204976,\t26,\t178 },\n\t{ (float)0.202986,\t27,\t204 },\n\t{ (float)0.199245,\t29,\t231 },\n\t{ (float)0.195525,\t31,\t260 },\n\t{ (float)0.193560,\t32,\t291 },\n\t{ (float)0.189878,\t34,\t323 },\n\t{ (float)0.186216,\t36,\t357 },\n\t{ (float)0.186216,\t36,\t393 },\n\t{ (float)0.182592,\t38,\t429 },\n\t{ (float)0.179003,\t40,\t467 },\n\t{ (float)0.175466,\t42,\t507 },\n\t{ (float)0.172001,\t44,\t549 },\n\t{ (float)0.172001,\t44,\t593 },\n\t{ (float)0.168612,\t46,\t637 },\n\t{ (float)0.168612,\t46,\t683 },\n\t{ (float)0.163575,\t49,\t729 },\n\t{ (float)0.158642,\t52,\t778 },\n\t{ (float)0.158642,\t52,\t830 },\n\t{ (float)0.158642,\t52,\t882 },\n\t{ (float)0.153815,\t55,\t934 },\n\t{ (float)0.153815,\t55,\t989 },\n\t{ (float)0.149097,\t58,\t1044 },\n\t{ (float)0.149097,\t58,\t1102 },\n\t{ (float)0.142746,\t62,\t1160 },\n\t{ (float)0.142746,\t62,\t1222 },\n\t{ (float)0.142746,\t62,\t1284 },\n\t{ (float)0.138270,\t65,\t1346 },\n\t{ (float)0.138270,\t65,\t1411 },\n\t{ (float)0.138270,\t65,\t1476 },\n\t{ (float)0.132166,\t69,\t1541 },\n\t{ (float)0.132166,\t69,\t1610 },\n\t{ (float)0.126204,\t73,\t1679 },\n\t{ (float)0.126204,\t73,\t1752 },\n\t{ (float)0.126204,\t73,\t1825 },\n\t{ (float)0.120381,\t77,\t1898 },\n\t{ (float)0.120381,\t77,\t1975 },\n\t{ (float)0.120381,\t77,\t2052 },\n\t{ (float)0.120381,\t77,\t2129 },\n\t{ (float)0.112962,\t82,\t2206 },\n\t{ (float)0.112962,\t82,\t2288 },\n\t{ (float)0.112962,\t82,\t2370 },\n\t{ (float)0.107450,\t86,\t2452 },\n\t{ (float)0.107450,\t86,\t2538 },\n\t{ (float)0.107450,\t86,\t2624 },\n\t{ (float)0.107450,\t86,\t2710 },\n\t{ (float)0.100343,\t91,\t2796 },\n\t{ (float)0.100343,\t91,\t2887 },\n\t{ (float)0.100343,\t91,\t2978 },\n\t{ (float)0.095126,\t95,\t3069 },\n\t{ (float)0.095126,\t95,\t3164 },\n\t{ (float)0.095126,\t95,\t3259 },\n\t{ (float)0.095126,\t95,\t3354 },\n\t{ (float)0.088276,\t100,\t3449 },\n\t{ (float)0.088276,\t100,\t3549 },\n\t{ (float)0.088276,\t100,\t3649 },\n\t{ (float)0.088276,\t100,\t3749 },\n\t{ (float)0.081523,\t105,\t3849 },\n\t{ (float)0.081523,\t105,\t3954 },\n\t{ (float)0.081523,\t105,\t4059 },\n\t{ (float)0.081523,\t105,\t4164 },\n\t{ (float)0.074861,\t110,\t4269 },\n\t{ (float)0.074861,\t110,\t4379 },\n\t{ (float)0.074861,\t110,\t4489 },\n\t{ (float)0.074861,\t110,\t4599 },\n\t{ (float)0.068290,\t115,\t4709 },\n\t{ (float)0.068290,\t115,\t4824 },\n\t{ (float)0.068290,\t115,\t4939 },\n\t{ (float)0.068290,\t115,\t5054 },\n\t{ (float)0.063573,\t119,\t5169 },\n\t{ (float)0.063573,\t119,\t5288 },\n\t{ (float)0.063573,\t119,\t5407 },\n\t{ (float)0.063573,\t119,\t5526 },\n\t{ (float)0.057219,\t124,\t5645 },\n\t{ (float)0.057219,\t124,\t5769 },\n\t{ (float)0.057219,\t124,\t5893 },\n\t{ (float)0.057219,\t124,\t6017 },\n\t{ (float)0.050985,\t129,\t6141 },\n\t{ (float)0.050985,\t129,\t6270 },\n\t{ (float)0.050985,\t129,\t6399 },\n\t{ (float)0.050985,\t129,\t6528 },\n\t{ (float)0.050985,\t129,\t6657 },\n\t{ (float)0.044859,\t134,\t6786 },\n\t{ (float)0.044859,\t134,\t6920 },\n\t{ (float)0.044859,\t134,\t7054 },\n\t{ (float)0.044859,\t134,\t7188 },\n\t{ (float)0.040571,\t138,\t7322 },\n\t{ (float)0.040571,\t138,\t7460 },\n\t{ (float)0.040571,\t138,\t7598 },\n\t{ (float)0.040571,\t138,\t7736 },\n\t{ (float)0.036339,\t142,\t7874 },\n\t{ (float)0.036339,\t142,\t8016 },\n\t{ (float)0.036339,\t142,\t8158 },\n\t{ (float)0.036339,\t142,\t8300 },\n\t{ (float)0.032139,\t146,\t8442 },\n\t{ (float)0.032139,\t146,\t8588 },\n\t{ (float)0.032139,\t146,\t8734 },\n\t{ (float)0.032139,\t146,\t8880 },\n\t{ (float)0.027947,\t150,\t9026 },\n\t{ (float)0.027947,\t150,\t9176 },\n\t{ (float)0.027947,\t150,\t9326 },\n\t{ (float)0.023739,\t154,\t9476 },\n\t{ (float)0.023739,\t154,\t9630 },\n\t{ (float)0.023739,\t154,\t9784 },\n\t{ (float)0.023739,\t154,\t9938 },\n\t{ (float)0.019504,\t158,\t10092 },\n\t{ (float)0.019504,\t158,\t10250 },\n\t{ (float)0.019504,\t158,\t10408 },\n\t{ (float)0.016976,\t161,\t10566 },\n\t{ (float)0.016976,\t161,\t10727 },\n\t{ (float)0.016976,\t161,\t10888 },\n\t{ (float)0.016976,\t161,\t11049 },\n\t{ (float)0.012639,\t165,\t11210 },\n\t{ (float)0.012639,\t165,\t11375 },\n\t{ (float)0.012639,\t165,\t11540 },\n\t{ (float)0.009991,\t168,\t11705 },\n\t{ (float)0.009991,\t168,\t11873 },\n\t{ (float)0.009991,\t168,\t12041 },\n\t{ (float)0.009016,\t170,\t12209 },\n\t{ (float)0.009016,\t170,\t12379 },\n\t{ (float)0.009016,\t170,\t12549 },\n\t{ (float)0.006217,\t173,\t12719 },\n\t{ (float)0.006217,\t173,\t12892 },\n\t{ (float)0.005097,\t175,\t13065 },\n\t{ (float)0.005097,\t175,\t13240 },\n\t{ (float)0.005097,\t175,\t13415 },\n\t{ (float)0.003909,\t177,\t13590 },\n\t{ (float)0.003909,\t177,\t13767 },\n\t{ (float)0.002340,\t177,\t13944 },\n\t{ (float)0.002389,\t170,\t14121 },\n\t{ (float)0.001068,\t164,\t14291 },\n\t{ (float)0.001653,\t157,\t14455 },\n\t{ (float)0.000717,\t150,\t14612 },\n\t{ (float)0.001614,\t143,\t14762 },\n\t{ (float)0.000270,\t136,\t14905 },\n\t{ (float)0.000484,\t129,\t15041 },\n\t{ (float)0.001103,\t123,\t15170 },\n\t{ (float)0.001242,\t115,\t15293 },\n\t{ (float)0.001188,\t109,\t15408 },\n\t{ (float)0.001011,\t103,\t15517 },\n\t{ (float)0.000709,\t97,\t15620 },\n\t{ (float)0.000301,\t89,\t15717 },\n\t{ (float)0.002416,\t82,\t15806 },\n\t{ (float)0.003251,\t76,\t15888 },\n\t{ (float)0.003246,\t69,\t15964 },\n\t{ (float)0.004141,\t62,\t16033 },\n\t{ (float)0.005963,\t55,\t16095 },\n\t{ (float)0.008839,\t47,\t16150 },\n\t{ (float)0.010490,\t40,\t16197 },\n\t{ (float)0.016994,\t31,\t16237 },\n\t{ (float)0.023659,\t21,\t16268 },\n};\n"
  },
  {
    "path": "src/main/jni/tiff/m4/acinclude.m4",
    "content": "dnl ---------------------------------------------------------------------------\ndnl Message output\ndnl ---------------------------------------------------------------------------\nAC_DEFUN([LOC_MSG],[echo \"$1\"])\n\ndnl ---------------------------------------------------------------------------\ndnl Available from the GNU Autoconf Macro Archive at:\ndnl http://www.gnu.org/software/ac-archive/vl_prog_cc_warnings.html\ndnl ---------------------------------------------------------------------------\n\ndnl @synopsis VL_PROG_CC_WARNINGS([ANSI])\ndnl\ndnl Enables a reasonable set of warnings for the C compiler.\ndnl Optionally, if the first argument is nonempty, turns on flags which\ndnl enforce and/or enable proper ANSI C if such are known with the\ndnl compiler used.\ndnl\ndnl Currently this macro knows about GCC, Solaris C compiler, Digital\ndnl Unix C compiler, C for AIX Compiler, HP-UX C compiler, IRIX C\ndnl compiler, NEC SX-5 (Super-UX 10) C compiler, and Cray J90 (Unicos\ndnl 10.0.0.8) C compiler.\ndnl\ndnl @category C\ndnl @author Ville Laurikari <vl@iki.fi>\ndnl @version 2002-04-04\ndnl @license AllPermissive\n\nAC_DEFUN([VL_PROG_CC_WARNINGS], [\n  ansi=$1\n  if test -z \"$ansi\"; then\n    msg=\"for C compiler warning flags\"\n  else\n    msg=\"for C compiler warning and ANSI conformance flags\"\n  fi\n  AC_CACHE_CHECK($msg, vl_cv_prog_cc_warnings, [\n    if test -n \"$CC\"; then\n      cat > conftest.c <<EOF\nint main(int argc, char **argv) { return 0; }\nEOF\n\n      dnl GCC. -W option has been renamed in -wextra in latest gcc versions.\n      if test \"$GCC\" = \"yes\"; then\n        if test -z \"$ansi\"; then\n          vl_cv_prog_cc_warnings=\"-Wall -W\"\n        else\n          vl_cv_prog_cc_warnings=\"-Wall -W -ansi -pedantic\"\n        fi\n\n      dnl Most compilers print some kind of a version string with some command\n      dnl line options (often \"-V\").  The version string should be checked\n      dnl before doing a test compilation run with compiler-specific flags.\n      dnl This is because some compilers (like the Cray compiler) only\n      dnl produce a warning message for unknown flags instead of returning\n      dnl an error, resulting in a false positive.  Also, compilers may do\n      dnl erratic things when invoked with flags meant for a different\n      dnl compiler.\n\n      dnl Solaris C compiler\n      elif $CC -V 2>&1 | grep -i \"WorkShop\" > /dev/null 2>&1 &&\n           $CC -c -v -Xc conftest.c > /dev/null 2>&1 &&\n           test -f conftest.o; then\n        if test -z \"$ansi\"; then\n          vl_cv_prog_cc_warnings=\"-v\"\n        else\n          vl_cv_prog_cc_warnings=\"-v -Xc\"\n        fi\n\n      dnl Digital Unix C compiler\n      elif $CC -V 2>&1 | grep -i \"Digital UNIX Compiler\" > /dev/null 2>&1 &&\n           $CC -c -verbose -w0 -warnprotos -std1 conftest.c > /dev/null 2>&1 &&\n           test -f conftest.o; then\n        if test -z \"$ansi\"; then\n          vl_cv_prog_cc_warnings=\"-verbose -w0 -warnprotos\"\n        else\n          vl_cv_prog_cc_warnings=\"-verbose -w0 -warnprotos -std1\"\n        fi\n\n      dnl C for AIX Compiler\n      elif $CC 2>&1 | grep -i \"C for AIX Compiler\" > /dev/null 2>&1 &&\n           $CC -c -qlanglvl=ansi -qinfo=all conftest.c > /dev/null 2>&1 &&\n           test -f conftest.o; then\n        if test -z \"$ansi\"; then\n          vl_cv_prog_cc_warnings=\"-qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd\"\n        else\n          vl_cv_prog_cc_warnings=\"-qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd -qlanglvl=ansi\"\n        fi\n\n      dnl IRIX C compiler\n      elif $CC -version 2>&1 | grep -i \"MIPSpro Compilers\" > /dev/null 2>&1 &&\n           $CC -c -fullwarn -ansi -ansiE conftest.c > /dev/null 2>&1 &&\n           test -f conftest.o; then\n        if test -z \"$ansi\"; then\n          vl_cv_prog_cc_warnings=\"-fullwarn\"\n        else\n          vl_cv_prog_cc_warnings=\"-fullwarn -ansi -ansiE\"\n        fi\n\n      dnl HP-UX C compiler\n      elif what $CC 2>&1 | grep -i \"HP C Compiler\" > /dev/null 2>&1 &&\n           $CC -c -Aa +w1 conftest.c > /dev/null 2>&1 &&\n           test -f conftest.o; then\n        if test -z \"$ansi\"; then\n          vl_cv_prog_cc_warnings=\"+w1\"\n        else\n          vl_cv_prog_cc_warnings=\"+w1 -Aa\"\n        fi\n\n      dnl The NEC SX-5 (Super-UX 10) C compiler\n      elif $CC -V 2>&1 | grep \"/SX\" > /dev/null 2>&1 &&\n           $CC -c -pvctl[,]fullmsg -Xc conftest.c > /dev/null 2>&1 &&\n           test -f conftest.o; then\n        if test -z \"$ansi\"; then\n          vl_cv_prog_cc_warnings=\"-pvctl[,]fullmsg\"\n        else\n          vl_cv_prog_cc_warnings=\"-pvctl[,]fullmsg -Xc\"\n        fi\n\n      dnl The Cray C compiler (Unicos)\n      elif $CC -V 2>&1 | grep -i \"Cray\" > /dev/null 2>&1 &&\n           $CC -c -h msglevel 2 conftest.c > /dev/null 2>&1 &&\n           test -f conftest.o; then\n        if test -z \"$ansi\"; then\n          vl_cv_prog_cc_warnings=\"-h msglevel 2\"\n        else\n          vl_cv_prog_cc_warnings=\"-h msglevel 2 -h conform\"\n        fi\n\n      fi\n      rm -f conftest.*\n    fi\n    if test -n \"$vl_cv_prog_cc_warnings\"; then\n      CFLAGS=\"$CFLAGS $vl_cv_prog_cc_warnings\"\n    else\n      vl_cv_prog_cc_warnings=\"unknown\"\n    fi\n  ])\n])dnl\n\ndnl ---------------------------------------------------------------------------\ndnl Available from the GNU Autoconf Macro Archive at:\ndnl http://autoconf-archive.cryp.to/ax_lang_compiler_ms.html\ndnl ---------------------------------------------------------------------------\n\ndnl @synopsis AX_LANG_COMPILER_MS\ndnl\ndnl Check whether the compiler for the current language is Microsoft.\ndnl\ndnl This macro is modeled after _AC_LANG_COMPILER_GNU in the GNU\ndnl Autoconf implementation.\ndnl\ndnl @category InstalledPackages\ndnl @author Braden McDaniel <braden@endoframe.com>\ndnl @version 2004-11-15\ndnl @license AllPermissive\n\nAC_DEFUN([AX_LANG_COMPILER_MS],\n[AC_CACHE_CHECK([whether we are using the Microsoft _AC_LANG compiler],\n                [ax_cv_[]_AC_LANG_ABBREV[]_compiler_ms],\n[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[#ifndef _MSC_VER\n       choke me\n#endif\n]])],\n                   [ax_compiler_ms=yes],\n                   [ax_compiler_ms=no])\nax_cv_[]_AC_LANG_ABBREV[]_compiler_ms=$ax_compiler_ms\n])])\n\ndnl ---------------------------------------------------------------------------\ndnl Available from the GNU Autoconf Macro Archive at:\ndnl http://www.gnu.org/software/ac-archive/ax_check_gl.html\ndnl ---------------------------------------------------------------------------\n\ndnl @synopsis AX_CHECK_GL\ndnl\ndnl Check for an OpenGL implementation. If GL is found, the required\ndnl compiler and linker flags are included in the output variables\ndnl \"GL_CFLAGS\" and \"GL_LIBS\", respectively. This macro adds the\ndnl configure option \"--with-apple-opengl-framework\", which users can\ndnl use to indicate that Apple's OpenGL framework should be used on Mac\ndnl OS X. If Apple's OpenGL framework is used, the symbol\ndnl \"HAVE_APPLE_OPENGL_FRAMEWORK\" is defined. If no GL implementation\ndnl is found, \"no_gl\" is set to \"yes\".\ndnl\ndnl @category InstalledPackages\ndnl @author Braden McDaniel <braden@endoframe.com>\ndnl @version 2004-11-15\ndnl @license AllPermissive\n\nAC_DEFUN([AX_CHECK_GL],\n[AC_REQUIRE([AC_PATH_X])dnl\nAC_REQUIRE([ACX_PTHREAD])dnl\n\n#\n# There isn't a reliable way to know we should use the Apple OpenGL framework\n# without a configure option.  A Mac OS X user may have installed an\n# alternative GL implementation (e.g., Mesa), which may or may not depend on X.\n#\nAC_ARG_WITH([apple-opengl-framework],\n            [AC_HELP_STRING([--with-apple-opengl-framework],\n                            [use Apple OpenGL framework (Mac OS X only)])])\nif test \"X$with_apple_opengl_framework\" = \"Xyes\"; then\n  AC_DEFINE([HAVE_APPLE_OPENGL_FRAMEWORK], [1],\n            [Use the Apple OpenGL framework.])\n  GL_LIBS=\"-framework OpenGL\"\nelse\n  AC_LANG_PUSH(C)\n\n  AX_LANG_COMPILER_MS\n  if test X$ax_compiler_ms = Xno; then\n    GL_CFLAGS=\"${PTHREAD_CFLAGS}\"\n    GL_LIBS=\"${PTHREAD_LIBS} -lm\"\n  fi\n\n  #\n  # Use x_includes and x_libraries if they have been set (presumably by\n  # AC_PATH_X).\n  #\n  if test \"X$no_x\" != \"Xyes\"; then\n    if test -n \"$x_includes\"; then\n      GL_CFLAGS=\"-I${x_includes} ${GL_CFLAGS}\"\n    fi\n    if test -n \"$x_libraries\"; then\n      GL_LIBS=\"-L${x_libraries} -lX11 ${GL_LIBS}\"\n    fi\n  fi\n\n  AC_CHECK_HEADERS([windows.h])\n\n  AC_CACHE_CHECK([for OpenGL library], [ax_cv_check_gl_libgl],\n  [ax_cv_check_gl_libgl=\"no\"\n  ax_save_CPPFLAGS=\"${CPPFLAGS}\"\n  CPPFLAGS=\"${GL_CFLAGS} ${CPPFLAGS}\"\n  ax_save_LIBS=\"${LIBS}\"\n  LIBS=\"\"\n  ax_check_libs=\"-lopengl32 -lGL\"\n  for ax_lib in ${ax_check_libs}; do\n    if test X$ax_compiler_ms = Xyes; then\n      ax_try_lib=`echo $ax_lib | sed -e 's/^-l//' -e 's/$/.lib/'`\n    else\n      ax_try_lib=\"${ax_lib}\"\n    fi\n    LIBS=\"${ax_try_lib} ${GL_LIBS} ${ax_save_LIBS}\"\n    AC_LINK_IFELSE(\n    [AC_LANG_PROGRAM([[\n# if HAVE_WINDOWS_H && defined(_WIN32)\n#   include <windows.h>\n# endif\n# include <GL/gl.h>]],\n                     [[glBegin(0)]])],\n    [ax_cv_check_gl_libgl=\"${ax_try_lib}\"; break])\n  done\n  LIBS=${ax_save_LIBS}\n  CPPFLAGS=${ax_save_CPPFLAGS}])\n\n  if test \"X${ax_cv_check_gl_libgl}\" = \"Xno\"; then\n    no_gl=\"yes\"\n    GL_CFLAGS=\"\"\n    GL_LIBS=\"\"\n  else\n    GL_LIBS=\"${ax_cv_check_gl_libgl} ${GL_LIBS}\"\n  fi\n  AC_LANG_POP(C)\nfi\n\nAC_SUBST([GL_CFLAGS])\nAC_SUBST([GL_LIBS])\n])dnl\n\ndnl ---------------------------------------------------------------------------\ndnl Available from the GNU Autoconf Macro Archive at:\ndnl http://www.gnu.org/software/ac-archive/ax_check_glu.html\ndnl ---------------------------------------------------------------------------\n\ndnl @synopsis AX_CHECK_GLU\ndnl\ndnl Check for GLU. If GLU is found, the required preprocessor and\ndnl linker flags are included in the output variables \"GLU_CFLAGS\" and\ndnl \"GLU_LIBS\", respectively. This macro adds the configure option\ndnl \"--with-apple-opengl-framework\", which users can use to indicate\ndnl that Apple's OpenGL framework should be used on Mac OS X. If\ndnl Apple's OpenGL framework is used, the symbol\ndnl \"HAVE_APPLE_OPENGL_FRAMEWORK\" is defined. If no GLU implementation\ndnl is found, \"no_glu\" is set to \"yes\".\ndnl\ndnl @category InstalledPackages\ndnl @author Braden McDaniel <braden@endoframe.com>\ndnl @version 2004-11-15\ndnl @license AllPermissive\n\nAC_DEFUN([AX_CHECK_GLU],\n[AC_REQUIRE([AX_CHECK_GL])dnl\nAC_REQUIRE([AC_PROG_CXX])dnl\nGLU_CFLAGS=\"${GL_CFLAGS}\"\nif test \"X${with_apple_opengl_framework}\" != \"Xyes\"; then\n  AC_CACHE_CHECK([for OpenGL Utility library], [ax_cv_check_glu_libglu],\n  [ax_cv_check_glu_libglu=\"no\"\n  ax_save_CPPFLAGS=\"${CPPFLAGS}\"\n  CPPFLAGS=\"${GL_CFLAGS} ${CPPFLAGS}\"\n  ax_save_LIBS=\"${LIBS}\"\n  LIBS=\"\"\n  ax_check_libs=\"-lglu32 -lGLU\"\n  for ax_lib in ${ax_check_libs}; do\n    if test X$ax_compiler_ms = Xyes; then\n      ax_try_lib=`echo $ax_lib | sed -e 's/^-l//' -e 's/$/.lib/'`\n    else\n      ax_try_lib=\"${ax_lib}\"\n    fi\n    LIBS=\"${ax_try_lib} ${GL_LIBS} ${ax_save_LIBS}\"\n    #\n    # libGLU typically links with libstdc++ on POSIX platforms. However,\n    # setting the language to C++ means that test program source is named\n    # \"conftest.cc\"; and Microsoft cl doesn't know what to do with such a\n    # file.\n    #\n    AC_LANG_PUSH([C++])\n    if test X$ax_compiler_ms = Xyes; then\n      AC_LANG_PUSH([C])\n    fi\n    AC_LINK_IFELSE(\n    [AC_LANG_PROGRAM([[\n# if HAVE_WINDOWS_H && defined(_WIN32)\n#   include <windows.h>\n# endif\n# include <GL/glu.h>]],\n                     [[gluBeginCurve(0)]])],\n    [ax_cv_check_glu_libglu=\"${ax_try_lib}\"; break])\n    if test X$ax_compiler_ms = Xyes; then\n      AC_LANG_POP([C])\n    fi\n    AC_LANG_POP([C++])\n  done\n  LIBS=${ax_save_LIBS}\n  CPPFLAGS=${ax_save_CPPFLAGS}])\n  if test \"X${ax_cv_check_glu_libglu}\" = \"Xno\"; then\n    no_glu=\"yes\"\n    GLU_CFLAGS=\"\"\n    GLU_LIBS=\"\"\n  else\n    GLU_LIBS=\"${ax_cv_check_glu_libglu} ${GL_LIBS}\"\n  fi\nfi\nAC_SUBST([GLU_CFLAGS])\nAC_SUBST([GLU_LIBS])\n])\n\ndnl ---------------------------------------------------------------------------\ndnl Available from the GNU Autoconf Macro Archive at:\ndnl http://www.gnu.org/software/ac-archive/ax_check_glut.html\ndnl ---------------------------------------------------------------------------\n\ndnl @synopsis AX_CHECK_GLUT\ndnl\ndnl Check for GLUT. If GLUT is found, the required compiler and linker\ndnl flags are included in the output variables \"GLUT_CFLAGS\" and\ndnl \"GLUT_LIBS\", respectively. This macro adds the configure option\ndnl \"--with-apple-opengl-framework\", which users can use to indicate\ndnl that Apple's OpenGL framework should be used on Mac OS X. If\ndnl Apple's OpenGL framework is used, the symbol\ndnl \"HAVE_APPLE_OPENGL_FRAMEWORK\" is defined. If GLUT is not found,\ndnl \"no_glut\" is set to \"yes\".\ndnl\ndnl @category InstalledPackages\ndnl @author Braden McDaniel <braden@endoframe.com>\ndnl @version 2004-11-15\ndnl @license AllPermissive\n\nAC_DEFUN([AX_CHECK_GLUT],\n[AC_REQUIRE([AX_CHECK_GLU])dnl\nAC_REQUIRE([AC_PATH_XTRA])dnl\n\nif test \"X$with_apple_opengl_framework\" = \"Xyes\"; then\n  GLUT_CFLAGS=\"${GLU_CFLAGS}\"\n  GLUT_LIBS=\"-framework GLUT -lobjc ${GL_LIBS}\"\nelse\n  GLUT_CFLAGS=${GLU_CFLAGS}\n  GLUT_LIBS=${GLU_LIBS}\n\n  #\n  # If X is present, assume GLUT depends on it.\n  #\n  if test \"X${no_x}\" != \"Xyes\"; then\n    GLUT_LIBS=\"${X_PRE_LIBS} -lXmu -lXi ${X_EXTRA_LIBS} ${GLUT_LIBS}\"\n  fi\n\n  AC_LANG_PUSH(C)\n\n  ax_save_CPPFLAGS=\"${CPPFLAGS}\"\n  CPPFLAGS=\"${GLUT_CFLAGS} ${CPPFLAGS}\"\n\n  AC_CACHE_CHECK([for GLUT library], [ax_cv_check_glut_libglut],\n  [ax_cv_check_glut_libglut=\"no\"\n  ax_save_LIBS=\"${LIBS}\"\n  LIBS=\"\"\n  ax_check_libs=\"-lglut32 -lglut\"\n  for ax_lib in ${ax_check_libs}; do\n    if test X$ax_compiler_ms = Xyes; then\n      ax_try_lib=`echo $ax_lib | sed -e 's/^-l//' -e 's/$/.lib/'`\n    else\n      ax_try_lib=\"${ax_lib}\"\n    fi\n    LIBS=\"${ax_try_lib} ${GLUT_LIBS} ${ax_save_LIBS}\"\n    AC_LINK_IFELSE(\n    [AC_LANG_PROGRAM([[\n# if HAVE_WINDOWS_H && defined(_WIN32)\n#   include <windows.h>\n# endif\n# include <GL/glut.h>]],\n                     [[glutMainLoop()]])],\n    [ax_cv_check_glut_libglut=\"${ax_try_lib}\"; break])\n\n  done\n  LIBS=${ax_save_LIBS}\n  ])\n  CPPFLAGS=\"${ax_save_CPPFLAGS}\"\n  AC_LANG_POP(C)\n\n  if test \"X${ax_cv_check_glut_libglut}\" = \"Xno\"; then\n    no_glut=\"yes\"\n    GLUT_CFLAGS=\"\"\n    GLUT_LIBS=\"\"\n  else\n    GLUT_LIBS=\"${ax_cv_check_glut_libglut} ${GLUT_LIBS}\"\n  fi\nfi\n\nAC_SUBST([GLUT_CFLAGS])\nAC_SUBST([GLUT_LIBS])\n])dnl\n\ndnl ---------------------------------------------------------------------------\ndnl Available from the GNU Autoconf Macro Archive at:\ndnl http://www.gnu.org/software/ac-archive/acx_pthread.html\ndnl ---------------------------------------------------------------------------\n\ndnl @synopsis ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])\ndnl\ndnl This macro figures out how to build C programs using POSIX threads.\ndnl It sets the PTHREAD_LIBS output variable to the threads library and\ndnl linker flags, and the PTHREAD_CFLAGS output variable to any special\ndnl C compiler flags that are needed. (The user can also force certain\ndnl compiler flags/libs to be tested by setting these environment\ndnl variables.)\ndnl\ndnl Also sets PTHREAD_CC to any special C compiler that is needed for\ndnl multi-threaded programs (defaults to the value of CC otherwise).\ndnl (This is necessary on AIX to use the special cc_r compiler alias.)\ndnl\ndnl NOTE: You are assumed to not only compile your program with these\ndnl flags, but also link it with them as well. e.g. you should link\ndnl with $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS\ndnl $LIBS\ndnl\ndnl If you are only building threads programs, you may wish to use\ndnl these variables in your default LIBS, CFLAGS, and CC:\ndnl\ndnl        LIBS=\"$PTHREAD_LIBS $LIBS\"\ndnl        CFLAGS=\"$CFLAGS $PTHREAD_CFLAGS\"\ndnl        CC=\"$PTHREAD_CC\"\ndnl\ndnl In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute\ndnl constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to\ndnl that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX).\ndnl\ndnl ACTION-IF-FOUND is a list of shell commands to run if a threads\ndnl library is found, and ACTION-IF-NOT-FOUND is a list of commands to\ndnl run it if it is not found. If ACTION-IF-FOUND is not specified, the\ndnl default action will define HAVE_PTHREAD.\ndnl\ndnl Please let the authors know if this macro fails on any platform, or\ndnl if you have any other suggestions or comments. This macro was based\ndnl on work by SGJ on autoconf scripts for FFTW (www.fftw.org) (with\ndnl help from M. Frigo), as well as ac_pthread and hb_pthread macros\ndnl posted by Alejandro Forero Cuervo to the autoconf macro repository.\ndnl We are also grateful for the helpful feedback of numerous users.\ndnl\ndnl @category InstalledPackages\ndnl @author Steven G. Johnson <stevenj@alum.mit.edu>\ndnl @version 2005-01-14\ndnl @license GPLWithACException\n\nAC_DEFUN([ACX_PTHREAD], [\nAC_REQUIRE([AC_CANONICAL_HOST])\nAC_LANG_SAVE\nAC_LANG_C\nacx_pthread_ok=no\n\n# We used to check for pthread.h first, but this fails if pthread.h\n# requires special compiler flags (e.g. on True64 or Sequent).\n# It gets checked for in the link test anyway.\n\n# First of all, check if the user has set any of the PTHREAD_LIBS,\n# etcetera environment variables, and if threads linking works using\n# them:\nif test x\"$PTHREAD_LIBS$PTHREAD_CFLAGS\" != x; then\n        save_CFLAGS=\"$CFLAGS\"\n        CFLAGS=\"$CFLAGS $PTHREAD_CFLAGS\"\n        save_LIBS=\"$LIBS\"\n        LIBS=\"$PTHREAD_LIBS $LIBS\"\n        AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])\n        AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes)\n        AC_MSG_RESULT($acx_pthread_ok)\n        if test x\"$acx_pthread_ok\" = xno; then\n                PTHREAD_LIBS=\"\"\n                PTHREAD_CFLAGS=\"\"\n        fi\n        LIBS=\"$save_LIBS\"\n        CFLAGS=\"$save_CFLAGS\"\nfi\n\n# We must check for the threads library under a number of different\n# names; the ordering is very important because some systems\n# (e.g. DEC) have both -lpthread and -lpthreads, where one of the\n# libraries is broken (non-POSIX).\n\n# Create a list of thread flags to try.  Items starting with a \"-\" are\n# C compiler flags, and other items are library names, except for \"none\"\n# which indicates that we try without any flags at all, and \"pthread-config\"\n# which is a program returning the flags for the Pth emulation library.\n\nacx_pthread_flags=\"pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config\"\n\n# The ordering *is* (sometimes) important.  Some notes on the\n# individual items follow:\n\n# pthreads: AIX (must check this before -lpthread)\n# none: in case threads are in libc; should be tried before -Kthread and\n#       other compiler flags to prevent continual compiler warnings\n# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)\n# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)\n# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)\n# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)\n# -pthreads: Solaris/gcc\n# -mthreads: Mingw32/gcc, Lynx/gcc\n# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it\n#      doesn't hurt to check since this sometimes defines pthreads too;\n#      also defines -D_REENTRANT)\n# pthread: Linux, etcetera\n# --thread-safe: KAI C++\n# pthread-config: use pthread-config program (for GNU Pth library)\n\ncase \"${host_cpu}-${host_os}\" in\n        *solaris*)\n\n        # On Solaris (at least, for some versions), libc contains stubbed\n        # (non-functional) versions of the pthreads routines, so link-based\n        # tests will erroneously succeed.  (We need to link with -pthread or\n        # -lpthread.)  (The stubs are missing pthread_cleanup_push, or rather\n        # a function called by this macro, so we could check for that, but\n        # who knows whether they'll stub that too in a future libc.)  So,\n        # we'll just look for -pthreads and -lpthread first:\n\n        acx_pthread_flags=\"-pthread -pthreads pthread -mt $acx_pthread_flags\"\n        ;;\nesac\n\nif test x\"$acx_pthread_ok\" = xno; then\nfor flag in $acx_pthread_flags; do\n\n        case $flag in\n                none)\n                AC_MSG_CHECKING([whether pthreads work without any flags])\n                ;;\n\n                -*)\n                AC_MSG_CHECKING([whether pthreads work with $flag])\n                PTHREAD_CFLAGS=\"$flag\"\n                ;;\n\n\t\tpthread-config)\n\t\tAC_CHECK_PROG(acx_pthread_config, pthread-config, yes, no)\n\t\tif test x\"$acx_pthread_config\" = xno; then continue; fi\n\t\tPTHREAD_CFLAGS=\"`pthread-config --cflags`\"\n\t\tPTHREAD_LIBS=\"`pthread-config --ldflags` `pthread-config --libs`\"\n\t\t;;\n\n                *)\n                AC_MSG_CHECKING([for the pthreads library -l$flag])\n                PTHREAD_LIBS=\"-l$flag\"\n                ;;\n        esac\n\n        save_LIBS=\"$LIBS\"\n        save_CFLAGS=\"$CFLAGS\"\n        LIBS=\"$PTHREAD_LIBS $LIBS\"\n        CFLAGS=\"$CFLAGS $PTHREAD_CFLAGS\"\n\n        # Check for various functions.  We must include pthread.h,\n        # since some functions may be macros.  (On the Sequent, we\n        # need a special flag -Kthread to make this header compile.)\n        # We check for pthread_join because it is in -lpthread on IRIX\n        # while pthread_create is in libc.  We check for pthread_attr_init\n        # due to DEC craziness with -lpthreads.  We check for\n        # pthread_cleanup_push because it is one of the few pthread\n        # functions on Solaris that doesn't have a non-functional libc stub.\n        # We try pthread_create on general principles.\n        AC_TRY_LINK([#include <pthread.h>],\n                    [pthread_t th; pthread_join(th, 0);\n                     pthread_attr_init(0); pthread_cleanup_push(0, 0);\n                     pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],\n                    [acx_pthread_ok=yes])\n\n        LIBS=\"$save_LIBS\"\n        CFLAGS=\"$save_CFLAGS\"\n\n        AC_MSG_RESULT($acx_pthread_ok)\n        if test \"x$acx_pthread_ok\" = xyes; then\n                break;\n        fi\n\n        PTHREAD_LIBS=\"\"\n        PTHREAD_CFLAGS=\"\"\ndone\nfi\n\n# Various other checks:\nif test \"x$acx_pthread_ok\" = xyes; then\n        save_LIBS=\"$LIBS\"\n        LIBS=\"$PTHREAD_LIBS $LIBS\"\n        save_CFLAGS=\"$CFLAGS\"\n        CFLAGS=\"$CFLAGS $PTHREAD_CFLAGS\"\n\n        # Detect AIX lossage: JOINABLE attribute is called UNDETACHED.\n\tAC_MSG_CHECKING([for joinable pthread attribute])\n\tattr_name=unknown\n\tfor attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do\n\t    AC_TRY_LINK([#include <pthread.h>], [int attr=$attr;],\n                        [attr_name=$attr; break])\n\tdone\n        AC_MSG_RESULT($attr_name)\n        if test \"$attr_name\" != PTHREAD_CREATE_JOINABLE; then\n            AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name,\n                               [Define to necessary symbol if this constant\n                                uses a non-standard name on your system.])\n        fi\n\n        AC_MSG_CHECKING([if more special flags are required for pthreads])\n        flag=no\n        case \"${host_cpu}-${host_os}\" in\n            *-aix* | *-freebsd* | *-darwin*) flag=\"-D_THREAD_SAFE\";;\n            *solaris* | *-osf* | *-hpux*) flag=\"-D_REENTRANT\";;\n        esac\n        AC_MSG_RESULT(${flag})\n        if test \"x$flag\" != xno; then\n            PTHREAD_CFLAGS=\"$flag $PTHREAD_CFLAGS\"\n        fi\n\n        LIBS=\"$save_LIBS\"\n        CFLAGS=\"$save_CFLAGS\"\n\n        # More AIX lossage: must compile with cc_r\n        AC_CHECK_PROG(PTHREAD_CC, cc_r, cc_r, ${CC})\nelse\n        PTHREAD_CC=\"$CC\"\nfi\n\nAC_SUBST(PTHREAD_LIBS)\nAC_SUBST(PTHREAD_CFLAGS)\nAC_SUBST(PTHREAD_CC)\n\n# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:\nif test x\"$acx_pthread_ok\" = xyes; then\n        ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])\n        :\nelse\n        acx_pthread_ok=no\n        $2\nfi\nAC_LANG_RESTORE\n])dnl ACX_PTHREAD\n"
  },
  {
    "path": "src/main/jni/tiff/m4/libtool.m4",
    "content": "# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-\n#\n#   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,\n#                 2006, 2007, 2008 Free Software Foundation, Inc.\n#   Written by Gordon Matzigkeit, 1996\n#\n# This file is free software; the Free Software Foundation gives\n# unlimited permission to copy and/or distribute it, with or without\n# modifications, as long as this notice is preserved.\n\nm4_define([_LT_COPYING], [dnl\n#   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,\n#                 2006, 2007, 2008 Free Software Foundation, Inc.\n#   Written by Gordon Matzigkeit, 1996\n#\n#   This file is part of GNU Libtool.\n#\n# GNU Libtool is free software; you can redistribute it and/or\n# modify it under the terms of the GNU General Public License as\n# published by the Free Software Foundation; either version 2 of\n# the License, or (at your option) any later version.\n#\n# As a special exception to the GNU General Public License,\n# if you distribute this file as part of a program or library that\n# is built using GNU Libtool, you may include this file under the\n# same distribution terms that you use for the rest of that program.\n#\n# GNU Libtool is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with GNU Libtool; see the file COPYING.  If not, a copy\n# can be downloaded from http://www.gnu.org/licenses/gpl.html, or\n# obtained by writing to the Free Software Foundation, Inc.,\n# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n])\n\n# serial 56 LT_INIT\n\n\n# LT_PREREQ(VERSION)\n# ------------------\n# Complain and exit if this libtool version is less that VERSION.\nm4_defun([LT_PREREQ],\n[m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1,\n       [m4_default([$3],\n\t\t   [m4_fatal([Libtool version $1 or higher is required],\n\t\t             63)])],\n       [$2])])\n\n\n# _LT_CHECK_BUILDDIR\n# ------------------\n# Complain if the absolute build directory name contains unusual characters\nm4_defun([_LT_CHECK_BUILDDIR],\n[case `pwd` in\n  *\\ * | *\\\t*)\n    AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;;\nesac\n])\n\n\n# LT_INIT([OPTIONS])\n# ------------------\nAC_DEFUN([LT_INIT],\n[AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT\nAC_BEFORE([$0], [LT_LANG])dnl\nAC_BEFORE([$0], [LT_OUTPUT])dnl\nAC_BEFORE([$0], [LTDL_INIT])dnl\nm4_require([_LT_CHECK_BUILDDIR])dnl\n\ndnl Autoconf doesn't catch unexpanded LT_ macros by default:\nm4_pattern_forbid([^_?LT_[A-Z_]+$])dnl\nm4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl\ndnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4\ndnl unless we require an AC_DEFUNed macro:\nAC_REQUIRE([LTOPTIONS_VERSION])dnl\nAC_REQUIRE([LTSUGAR_VERSION])dnl\nAC_REQUIRE([LTVERSION_VERSION])dnl\nAC_REQUIRE([LTOBSOLETE_VERSION])dnl\nm4_require([_LT_PROG_LTMAIN])dnl\n\ndnl Parse OPTIONS\n_LT_SET_OPTIONS([$0], [$1])\n\n# This can be used to rebuild libtool when needed\nLIBTOOL_DEPS=\"$ltmain\"\n\n# Always use our own libtool.\nLIBTOOL='$(SHELL) $(top_builddir)/libtool'\nAC_SUBST(LIBTOOL)dnl\n\n_LT_SETUP\n\n# Only expand once:\nm4_define([LT_INIT])\n])# LT_INIT\n\n# Old names:\nAU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT])\nAU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT])\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([AC_PROG_LIBTOOL], [])\ndnl AC_DEFUN([AM_PROG_LIBTOOL], [])\n\n\n# _LT_CC_BASENAME(CC)\n# -------------------\n# Calculate cc_basename.  Skip known compiler wrappers and cross-prefix.\nm4_defun([_LT_CC_BASENAME],\n[for cc_temp in $1\"\"; do\n  case $cc_temp in\n    compile | *[[\\\\/]]compile | ccache | *[[\\\\/]]ccache ) ;;\n    distcc | *[[\\\\/]]distcc | purify | *[[\\\\/]]purify ) ;;\n    \\-*) ;;\n    *) break;;\n  esac\ndone\ncc_basename=`$ECHO \"X$cc_temp\" | $Xsed -e 's%.*/%%' -e \"s%^$host_alias-%%\"`\n])\n\n\n# _LT_FILEUTILS_DEFAULTS\n# ----------------------\n# It is okay to use these file commands and assume they have been set\n# sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'.\nm4_defun([_LT_FILEUTILS_DEFAULTS],\n[: ${CP=\"cp -f\"}\n: ${MV=\"mv -f\"}\n: ${RM=\"rm -f\"}\n])# _LT_FILEUTILS_DEFAULTS\n\n\n# _LT_SETUP\n# ---------\nm4_defun([_LT_SETUP],\n[AC_REQUIRE([AC_CANONICAL_HOST])dnl\nAC_REQUIRE([AC_CANONICAL_BUILD])dnl\n_LT_DECL([], [host_alias], [0], [The host system])dnl\n_LT_DECL([], [host], [0])dnl\n_LT_DECL([], [host_os], [0])dnl\ndnl\n_LT_DECL([], [build_alias], [0], [The build system])dnl\n_LT_DECL([], [build], [0])dnl\n_LT_DECL([], [build_os], [0])dnl\ndnl\nAC_REQUIRE([AC_PROG_CC])dnl\nAC_REQUIRE([LT_PATH_LD])dnl\nAC_REQUIRE([LT_PATH_NM])dnl\ndnl\nAC_REQUIRE([AC_PROG_LN_S])dnl\ntest -z \"$LN_S\" && LN_S=\"ln -s\"\n_LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl\ndnl\nAC_REQUIRE([LT_CMD_MAX_LEN])dnl\n_LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally \"o\")])dnl\n_LT_DECL([], [exeext], [0], [Executable file suffix (normally \"\")])dnl\ndnl\nm4_require([_LT_FILEUTILS_DEFAULTS])dnl\nm4_require([_LT_CHECK_SHELL_FEATURES])dnl\nm4_require([_LT_CMD_RELOAD])dnl\nm4_require([_LT_CHECK_MAGIC_METHOD])dnl\nm4_require([_LT_CMD_OLD_ARCHIVE])dnl\nm4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl\n\n_LT_CONFIG_LIBTOOL_INIT([\n# See if we are running on zsh, and set the options which allow our\n# commands through without removal of \\ escapes INIT.\nif test -n \"\\${ZSH_VERSION+set}\" ; then\n   setopt NO_GLOB_SUBST\nfi\n])\nif test -n \"${ZSH_VERSION+set}\" ; then\n   setopt NO_GLOB_SUBST\nfi\n\n_LT_CHECK_OBJDIR\n\nm4_require([_LT_TAG_COMPILER])dnl\n_LT_PROG_ECHO_BACKSLASH\n\ncase $host_os in\naix3*)\n  # AIX sometimes has problems with the GCC collect2 program.  For some\n  # reason, if we set the COLLECT_NAMES environment variable, the problems\n  # vanish in a puff of smoke.\n  if test \"X${COLLECT_NAMES+set}\" != Xset; then\n    COLLECT_NAMES=\n    export COLLECT_NAMES\n  fi\n  ;;\nesac\n\n# Sed substitution that helps us do robust quoting.  It backslashifies\n# metacharacters that are still active within double-quoted strings.\nsed_quote_subst='s/\\([[\"`$\\\\]]\\)/\\\\\\1/g'\n\n# Same as above, but do not quote variable references.\ndouble_quote_subst='s/\\([[\"`\\\\]]\\)/\\\\\\1/g'\n\n# Sed substitution to delay expansion of an escaped shell variable in a\n# double_quote_subst'ed string.\ndelay_variable_subst='s/\\\\\\\\\\\\\\\\\\\\\\$/\\\\\\\\\\\\$/g'\n\n# Sed substitution to delay expansion of an escaped single quote.\ndelay_single_quote_subst='s/'\\''/'\\'\\\\\\\\\\\\\\'\\''/g'\n\n# Sed substitution to avoid accidental globbing in evaled expressions\nno_glob_subst='s/\\*/\\\\\\*/g'\n\n# Global variables:\nofile=libtool\ncan_build_shared=yes\n\n# All known linkers require a `.a' archive for static linking (except MSVC,\n# which needs '.lib').\nlibext=a\n\nwith_gnu_ld=\"$lt_cv_prog_gnu_ld\"\n\nold_CC=\"$CC\"\nold_CFLAGS=\"$CFLAGS\"\n\n# Set sane defaults for various variables\ntest -z \"$CC\" && CC=cc\ntest -z \"$LTCC\" && LTCC=$CC\ntest -z \"$LTCFLAGS\" && LTCFLAGS=$CFLAGS\ntest -z \"$LD\" && LD=ld\ntest -z \"$ac_objext\" && ac_objext=o\n\n_LT_CC_BASENAME([$compiler])\n\n# Only perform the check for file, if the check method requires it\ntest -z \"$MAGIC_CMD\" && MAGIC_CMD=file\ncase $deplibs_check_method in\nfile_magic*)\n  if test \"$file_magic_cmd\" = '$MAGIC_CMD'; then\n    _LT_PATH_MAGIC\n  fi\n  ;;\nesac\n\n# Use C for the default configuration in the libtool script\nLT_SUPPORTED_TAG([CC])\n_LT_LANG_C_CONFIG\n_LT_LANG_DEFAULT_CONFIG\n_LT_CONFIG_COMMANDS\n])# _LT_SETUP\n\n\n# _LT_PROG_LTMAIN\n# ---------------\n# Note that this code is called both from `configure', and `config.status'\n# now that we use AC_CONFIG_COMMANDS to generate libtool.  Notably,\n# `config.status' has no value for ac_aux_dir unless we are using Automake,\n# so we pass a copy along to make sure it has a sensible value anyway.\nm4_defun([_LT_PROG_LTMAIN],\n[m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl\n_LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir'])\nltmain=\"$ac_aux_dir/ltmain.sh\"\n])# _LT_PROG_LTMAIN\n\n\n## ------------------------------------- ##\n## Accumulate code for creating libtool. ##\n## ------------------------------------- ##\n\n# So that we can recreate a full libtool script including additional\n# tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS\n# in macros and then make a single call at the end using the `libtool'\n# label.\n\n\n# _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS])\n# ----------------------------------------\n# Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later.\nm4_define([_LT_CONFIG_LIBTOOL_INIT],\n[m4_ifval([$1],\n          [m4_append([_LT_OUTPUT_LIBTOOL_INIT],\n                     [$1\n])])])\n\n# Initialize.\nm4_define([_LT_OUTPUT_LIBTOOL_INIT])\n\n\n# _LT_CONFIG_LIBTOOL([COMMANDS])\n# ------------------------------\n# Register COMMANDS to be passed to AC_CONFIG_COMMANDS later.\nm4_define([_LT_CONFIG_LIBTOOL],\n[m4_ifval([$1],\n          [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS],\n                     [$1\n])])])\n\n# Initialize.\nm4_define([_LT_OUTPUT_LIBTOOL_COMMANDS])\n\n\n# _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS])\n# -----------------------------------------------------\nm4_defun([_LT_CONFIG_SAVE_COMMANDS],\n[_LT_CONFIG_LIBTOOL([$1])\n_LT_CONFIG_LIBTOOL_INIT([$2])\n])\n\n\n# _LT_FORMAT_COMMENT([COMMENT])\n# -----------------------------\n# Add leading comment marks to the start of each line, and a trailing\n# full-stop to the whole comment if one is not present already.\nm4_define([_LT_FORMAT_COMMENT],\n[m4_ifval([$1], [\nm4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])],\n              [['`$\\]], [\\\\\\&])]m4_bmatch([$1], [[!?.]$], [], [.])\n)])\n\n\n\n## ------------------------ ##\n## FIXME: Eliminate VARNAME ##\n## ------------------------ ##\n\n\n# _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?])\n# -------------------------------------------------------------------\n# CONFIGNAME is the name given to the value in the libtool script.\n# VARNAME is the (base) name used in the configure script.\n# VALUE may be 0, 1 or 2 for a computed quote escaped value based on\n# VARNAME.  Any other value will be used directly.\nm4_define([_LT_DECL],\n[lt_if_append_uniq([lt_decl_varnames], [$2], [, ],\n    [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name],\n\t[m4_ifval([$1], [$1], [$2])])\n    lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3])\n    m4_ifval([$4],\n\t[lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])])\n    lt_dict_add_subkey([lt_decl_dict], [$2],\n\t[tagged?], [m4_ifval([$5], [yes], [no])])])\n])\n\n\n# _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION])\n# --------------------------------------------------------\nm4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])])\n\n\n# lt_decl_tag_varnames([SEPARATOR], [VARNAME1...])\n# ------------------------------------------------\nm4_define([lt_decl_tag_varnames],\n[_lt_decl_filter([tagged?], [yes], $@)])\n\n\n# _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..])\n# ---------------------------------------------------------\nm4_define([_lt_decl_filter],\n[m4_case([$#],\n  [0], [m4_fatal([$0: too few arguments: $#])],\n  [1], [m4_fatal([$0: too few arguments: $#: $1])],\n  [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)],\n  [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)],\n  [lt_dict_filter([lt_decl_dict], $@)])[]dnl\n])\n\n\n# lt_decl_quote_varnames([SEPARATOR], [VARNAME1...])\n# --------------------------------------------------\nm4_define([lt_decl_quote_varnames],\n[_lt_decl_filter([value], [1], $@)])\n\n\n# lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...])\n# ---------------------------------------------------\nm4_define([lt_decl_dquote_varnames],\n[_lt_decl_filter([value], [2], $@)])\n\n\n# lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...])\n# ---------------------------------------------------\nm4_define([lt_decl_varnames_tagged],\n[m4_assert([$# <= 2])dnl\n_$0(m4_quote(m4_default([$1], [[, ]])),\n    m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]),\n    m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))])\nm4_define([_lt_decl_varnames_tagged],\n[m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])])\n\n\n# lt_decl_all_varnames([SEPARATOR], [VARNAME1...])\n# ------------------------------------------------\nm4_define([lt_decl_all_varnames],\n[_$0(m4_quote(m4_default([$1], [[, ]])),\n     m4_if([$2], [],\n\t   m4_quote(lt_decl_varnames),\n\tm4_quote(m4_shift($@))))[]dnl\n])\nm4_define([_lt_decl_all_varnames],\n[lt_join($@, lt_decl_varnames_tagged([$1],\n\t\t\tlt_decl_tag_varnames([[, ]], m4_shift($@))))dnl\n])\n\n\n# _LT_CONFIG_STATUS_DECLARE([VARNAME])\n# ------------------------------------\n# Quote a variable value, and forward it to `config.status' so that its\n# declaration there will have the same value as in `configure'.  VARNAME\n# must have a single quote delimited value for this to work.\nm4_define([_LT_CONFIG_STATUS_DECLARE],\n[$1='`$ECHO \"X$][$1\" | $Xsed -e \"$delay_single_quote_subst\"`'])\n\n\n# _LT_CONFIG_STATUS_DECLARATIONS\n# ------------------------------\n# We delimit libtool config variables with single quotes, so when\n# we write them to config.status, we have to be sure to quote all\n# embedded single quotes properly.  In configure, this macro expands\n# each variable declared with _LT_DECL (and _LT_TAGDECL) into:\n#\n#    <var>='`$ECHO \"X$<var>\" | $Xsed -e \"$delay_single_quote_subst\"`'\nm4_defun([_LT_CONFIG_STATUS_DECLARATIONS],\n[m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames),\n    [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])])\n\n\n# _LT_LIBTOOL_TAGS\n# ----------------\n# Output comment and list of tags supported by the script\nm4_defun([_LT_LIBTOOL_TAGS],\n[_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl\navailable_tags=\"_LT_TAGS\"dnl\n])\n\n\n# _LT_LIBTOOL_DECLARE(VARNAME, [TAG])\n# -----------------------------------\n# Extract the dictionary values for VARNAME (optionally with TAG) and\n# expand to a commented shell variable setting:\n#\n#    # Some comment about what VAR is for.\n#    visible_name=$lt_internal_name\nm4_define([_LT_LIBTOOL_DECLARE],\n[_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1],\n\t\t\t\t\t   [description])))[]dnl\nm4_pushdef([_libtool_name],\n    m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl\nm4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])),\n    [0], [_libtool_name=[$]$1],\n    [1], [_libtool_name=$lt_[]$1],\n    [2], [_libtool_name=$lt_[]$1],\n    [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl\nm4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl\n])\n\n\n# _LT_LIBTOOL_CONFIG_VARS\n# -----------------------\n# Produce commented declarations of non-tagged libtool config variables\n# suitable for insertion in the LIBTOOL CONFIG section of the `libtool'\n# script.  Tagged libtool config variables (even for the LIBTOOL CONFIG\n# section) are produced by _LT_LIBTOOL_TAG_VARS.\nm4_defun([_LT_LIBTOOL_CONFIG_VARS],\n[m4_foreach([_lt_var],\n    m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)),\n    [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])])\n\n\n# _LT_LIBTOOL_TAG_VARS(TAG)\n# -------------------------\nm4_define([_LT_LIBTOOL_TAG_VARS],\n[m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames),\n    [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])])\n\n\n# _LT_TAGVAR(VARNAME, [TAGNAME])\n# ------------------------------\nm4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])])\n\n\n# _LT_CONFIG_COMMANDS\n# -------------------\n# Send accumulated output to $CONFIG_STATUS.  Thanks to the lists of\n# variables for single and double quote escaping we saved from calls\n# to _LT_DECL, we can put quote escaped variables declarations\n# into `config.status', and then the shell code to quote escape them in\n# for loops in `config.status'.  Finally, any additional code accumulated\n# from calls to _LT_CONFIG_LIBTOOL_INIT is expanded.\nm4_defun([_LT_CONFIG_COMMANDS],\n[AC_PROVIDE_IFELSE([LT_OUTPUT],\n\tdnl If the libtool generation code has been placed in $CONFIG_LT,\n\tdnl instead of duplicating it all over again into config.status,\n\tdnl then we will have config.status run $CONFIG_LT later, so it\n\tdnl needs to know what name is stored there:\n        [AC_CONFIG_COMMANDS([libtool],\n            [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])],\n    dnl If the libtool generation code is destined for config.status,\n    dnl expand the accumulated commands and init code now:\n    [AC_CONFIG_COMMANDS([libtool],\n        [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])])\n])#_LT_CONFIG_COMMANDS\n\n\n# Initialize.\nm4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT],\n[\n\n# The HP-UX ksh and POSIX shell print the target directory to stdout\n# if CDPATH is set.\n(unset CDPATH) >/dev/null 2>&1 && unset CDPATH\n\nsed_quote_subst='$sed_quote_subst'\ndouble_quote_subst='$double_quote_subst'\ndelay_variable_subst='$delay_variable_subst'\n_LT_CONFIG_STATUS_DECLARATIONS\nLTCC='$LTCC'\nLTCFLAGS='$LTCFLAGS'\ncompiler='$compiler_DEFAULT'\n\n# Quote evaled strings.\nfor var in lt_decl_all_varnames([[ \\\n]], lt_decl_quote_varnames); do\n    case \\`eval \\\\\\\\\\$ECHO \"X\\\\\\\\\\$\\$var\"\\` in\n    *[[\\\\\\\\\\\\\\`\\\\\"\\\\\\$]]*)\n      eval \"lt_\\$var=\\\\\\\\\\\\\"\\\\\\`\\\\\\$ECHO \\\\\"X\\\\\\$\\$var\\\\\" | \\\\\\$Xsed -e \\\\\"\\\\\\$sed_quote_subst\\\\\"\\\\\\`\\\\\\\\\\\\\"\"\n      ;;\n    *)\n      eval \"lt_\\$var=\\\\\\\\\\\\\"\\\\\\$\\$var\\\\\\\\\\\\\"\"\n      ;;\n    esac\ndone\n\n# Double-quote double-evaled strings.\nfor var in lt_decl_all_varnames([[ \\\n]], lt_decl_dquote_varnames); do\n    case \\`eval \\\\\\\\\\$ECHO \"X\\\\\\\\\\$\\$var\"\\` in\n    *[[\\\\\\\\\\\\\\`\\\\\"\\\\\\$]]*)\n      eval \"lt_\\$var=\\\\\\\\\\\\\"\\\\\\`\\\\\\$ECHO \\\\\"X\\\\\\$\\$var\\\\\" | \\\\\\$Xsed -e \\\\\"\\\\\\$double_quote_subst\\\\\" -e \\\\\"\\\\\\$sed_quote_subst\\\\\" -e \\\\\"\\\\\\$delay_variable_subst\\\\\"\\\\\\`\\\\\\\\\\\\\"\"\n      ;;\n    *)\n      eval \"lt_\\$var=\\\\\\\\\\\\\"\\\\\\$\\$var\\\\\\\\\\\\\"\"\n      ;;\n    esac\ndone\n\n# Fix-up fallback echo if it was mangled by the above quoting rules.\ncase \\$lt_ECHO in\n*'\\\\\\[$]0 --fallback-echo\"')dnl \"\n  lt_ECHO=\\`\\$ECHO \"X\\$lt_ECHO\" | \\$Xsed -e 's/\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\[$]0 --fallback-echo\"\\[$]/\\[$]0 --fallback-echo\"/'\\`\n  ;;\nesac\n\n_LT_OUTPUT_LIBTOOL_INIT\n])\n\n\n# LT_OUTPUT\n# ---------\n# This macro allows early generation of the libtool script (before\n# AC_OUTPUT is called), incase it is used in configure for compilation\n# tests.\nAC_DEFUN([LT_OUTPUT],\n[: ${CONFIG_LT=./config.lt}\nAC_MSG_NOTICE([creating $CONFIG_LT])\ncat >\"$CONFIG_LT\" <<_LTEOF\n#! $SHELL\n# Generated by $as_me.\n# Run this file to recreate a libtool stub with the current configuration.\n\nlt_cl_silent=false\nSHELL=\\${CONFIG_SHELL-$SHELL}\n_LTEOF\n\ncat >>\"$CONFIG_LT\" <<\\_LTEOF\nAS_SHELL_SANITIZE\n_AS_PREPARE\n\nexec AS_MESSAGE_FD>&1\nexec AS_MESSAGE_LOG_FD>>config.log\n{\n  echo\n  AS_BOX([Running $as_me.])\n} >&AS_MESSAGE_LOG_FD\n\nlt_cl_help=\"\\\n\\`$as_me' creates a local libtool stub from the current configuration,\nfor use in further configure time tests before the real libtool is\ngenerated.\n\nUsage: $[0] [[OPTIONS]]\n\n  -h, --help      print this help, then exit\n  -V, --version   print version number, then exit\n  -q, --quiet     do not print progress messages\n  -d, --debug     don't remove temporary files\n\nReport bugs to <bug-libtool@gnu.org>.\"\n\nlt_cl_version=\"\\\nm4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl\nm4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION])\nconfigured by $[0], generated by m4_PACKAGE_STRING.\n\nCopyright (C) 2008 Free Software Foundation, Inc.\nThis config.lt script is free software; the Free Software Foundation\ngives unlimited permision to copy, distribute and modify it.\"\n\nwhile test $[#] != 0\ndo\n  case $[1] in\n    --version | --v* | -V )\n      echo \"$lt_cl_version\"; exit 0 ;;\n    --help | --h* | -h )\n      echo \"$lt_cl_help\"; exit 0 ;;\n    --debug | --d* | -d )\n      debug=: ;;\n    --quiet | --q* | --silent | --s* | -q )\n      lt_cl_silent=: ;;\n\n    -*) AC_MSG_ERROR([unrecognized option: $[1]\nTry \\`$[0] --help' for more information.]) ;;\n\n    *) AC_MSG_ERROR([unrecognized argument: $[1]\nTry \\`$[0] --help' for more information.]) ;;\n  esac\n  shift\ndone\n\nif $lt_cl_silent; then\n  exec AS_MESSAGE_FD>/dev/null\nfi\n_LTEOF\n\ncat >>\"$CONFIG_LT\" <<_LTEOF\n_LT_OUTPUT_LIBTOOL_COMMANDS_INIT\n_LTEOF\n\ncat >>\"$CONFIG_LT\" <<\\_LTEOF\nAC_MSG_NOTICE([creating $ofile])\n_LT_OUTPUT_LIBTOOL_COMMANDS\nAS_EXIT(0)\n_LTEOF\nchmod +x \"$CONFIG_LT\"\n\n# configure is writing to config.log, but config.lt does its own redirection,\n# appending to config.log, which fails on DOS, as config.log is still kept\n# open by configure.  Here we exec the FD to /dev/null, effectively closing\n# config.log, so it can be properly (re)opened and appended to by config.lt.\nif test \"$no_create\" != yes; then\n  lt_cl_success=:\n  test \"$silent\" = yes &&\n    lt_config_lt_args=\"$lt_config_lt_args --quiet\"\n  exec AS_MESSAGE_LOG_FD>/dev/null\n  $SHELL \"$CONFIG_LT\" $lt_config_lt_args || lt_cl_success=false\n  exec AS_MESSAGE_LOG_FD>>config.log\n  $lt_cl_success || AS_EXIT(1)\nfi\n])# LT_OUTPUT\n\n\n# _LT_CONFIG(TAG)\n# ---------------\n# If TAG is the built-in tag, create an initial libtool script with a\n# default configuration from the untagged config vars.  Otherwise add code\n# to config.status for appending the configuration named by TAG from the\n# matching tagged config vars.\nm4_defun([_LT_CONFIG],\n[m4_require([_LT_FILEUTILS_DEFAULTS])dnl\n_LT_CONFIG_SAVE_COMMANDS([\n  m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl\n  m4_if(_LT_TAG, [C], [\n    # See if we are running on zsh, and set the options which allow our\n    # commands through without removal of \\ escapes.\n    if test -n \"${ZSH_VERSION+set}\" ; then\n      setopt NO_GLOB_SUBST\n    fi\n\n    cfgfile=\"${ofile}T\"\n    trap \"$RM \\\"$cfgfile\\\"; exit 1\" 1 2 15\n    $RM \"$cfgfile\"\n\n    cat <<_LT_EOF >> \"$cfgfile\"\n#! $SHELL\n\n# `$ECHO \"$ofile\" | sed 's%^.*/%%'` - Provide generalized library-building support services.\n# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION\n# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:\n# NOTE: Changes made to this file will be lost: look at ltmain.sh.\n#\n_LT_COPYING\n_LT_LIBTOOL_TAGS\n\n# ### BEGIN LIBTOOL CONFIG\n_LT_LIBTOOL_CONFIG_VARS\n_LT_LIBTOOL_TAG_VARS\n# ### END LIBTOOL CONFIG\n\n_LT_EOF\n\n  case $host_os in\n  aix3*)\n    cat <<\\_LT_EOF >> \"$cfgfile\"\n# AIX sometimes has problems with the GCC collect2 program.  For some\n# reason, if we set the COLLECT_NAMES environment variable, the problems\n# vanish in a puff of smoke.\nif test \"X${COLLECT_NAMES+set}\" != Xset; then\n  COLLECT_NAMES=\n  export COLLECT_NAMES\nfi\n_LT_EOF\n    ;;\n  esac\n\n  _LT_PROG_LTMAIN\n\n  # We use sed instead of cat because bash on DJGPP gets confused if\n  # if finds mixed CR/LF and LF-only lines.  Since sed operates in\n  # text mode, it properly converts lines to CR/LF.  This bash problem\n  # is reportedly fixed, but why not run on old versions too?\n  sed '/^# Generated shell functions inserted here/q' \"$ltmain\" >> \"$cfgfile\" \\\n    || (rm -f \"$cfgfile\"; exit 1)\n\n  _LT_PROG_XSI_SHELLFNS\n\n  sed -n '/^# Generated shell functions inserted here/,$p' \"$ltmain\" >> \"$cfgfile\" \\\n    || (rm -f \"$cfgfile\"; exit 1)\n\n  mv -f \"$cfgfile\" \"$ofile\" ||\n    (rm -f \"$ofile\" && cp \"$cfgfile\" \"$ofile\" && rm -f \"$cfgfile\")\n  chmod +x \"$ofile\"\n],\n[cat <<_LT_EOF >> \"$ofile\"\n\ndnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded\ndnl in a comment (ie after a #).\n# ### BEGIN LIBTOOL TAG CONFIG: $1\n_LT_LIBTOOL_TAG_VARS(_LT_TAG)\n# ### END LIBTOOL TAG CONFIG: $1\n_LT_EOF\n])dnl /m4_if\n],\n[m4_if([$1], [], [\n    PACKAGE='$PACKAGE'\n    VERSION='$VERSION'\n    TIMESTAMP='$TIMESTAMP'\n    RM='$RM'\n    ofile='$ofile'], [])\n])dnl /_LT_CONFIG_SAVE_COMMANDS\n])# _LT_CONFIG\n\n\n# LT_SUPPORTED_TAG(TAG)\n# ---------------------\n# Trace this macro to discover what tags are supported by the libtool\n# --tag option, using:\n#    autoconf --trace 'LT_SUPPORTED_TAG:$1'\nAC_DEFUN([LT_SUPPORTED_TAG], [])\n\n\n# C support is built-in for now\nm4_define([_LT_LANG_C_enabled], [])\nm4_define([_LT_TAGS], [])\n\n\n# LT_LANG(LANG)\n# -------------\n# Enable libtool support for the given language if not already enabled.\nAC_DEFUN([LT_LANG],\n[AC_BEFORE([$0], [LT_OUTPUT])dnl\nm4_case([$1],\n  [C],\t\t\t[_LT_LANG(C)],\n  [C++],\t\t[_LT_LANG(CXX)],\n  [Java],\t\t[_LT_LANG(GCJ)],\n  [Fortran 77],\t\t[_LT_LANG(F77)],\n  [Fortran],\t\t[_LT_LANG(FC)],\n  [Windows Resource],\t[_LT_LANG(RC)],\n  [m4_ifdef([_LT_LANG_]$1[_CONFIG],\n    [_LT_LANG($1)],\n    [m4_fatal([$0: unsupported language: \"$1\"])])])dnl\n])# LT_LANG\n\n\n# _LT_LANG(LANGNAME)\n# ------------------\nm4_defun([_LT_LANG],\n[m4_ifdef([_LT_LANG_]$1[_enabled], [],\n  [LT_SUPPORTED_TAG([$1])dnl\n  m4_append([_LT_TAGS], [$1 ])dnl\n  m4_define([_LT_LANG_]$1[_enabled], [])dnl\n  _LT_LANG_$1_CONFIG($1)])dnl\n])# _LT_LANG\n\n\n# _LT_LANG_DEFAULT_CONFIG\n# -----------------------\nm4_defun([_LT_LANG_DEFAULT_CONFIG],\n[AC_PROVIDE_IFELSE([AC_PROG_CXX],\n  [LT_LANG(CXX)],\n  [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])])\n\nAC_PROVIDE_IFELSE([AC_PROG_F77],\n  [LT_LANG(F77)],\n  [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])])\n\nAC_PROVIDE_IFELSE([AC_PROG_FC],\n  [LT_LANG(FC)],\n  [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])])\n\ndnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal\ndnl pulling things in needlessly.\nAC_PROVIDE_IFELSE([AC_PROG_GCJ],\n  [LT_LANG(GCJ)],\n  [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],\n    [LT_LANG(GCJ)],\n    [AC_PROVIDE_IFELSE([LT_PROG_GCJ],\n      [LT_LANG(GCJ)],\n      [m4_ifdef([AC_PROG_GCJ],\n\t[m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])])\n       m4_ifdef([A][M_PROG_GCJ],\n\t[m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])])\n       m4_ifdef([LT_PROG_GCJ],\n\t[m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])])\n\nAC_PROVIDE_IFELSE([LT_PROG_RC],\n  [LT_LANG(RC)],\n  [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])])\n])# _LT_LANG_DEFAULT_CONFIG\n\n# Obsolete macros:\nAU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)])\nAU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)])\nAU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)])\nAU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)])\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([AC_LIBTOOL_CXX], [])\ndnl AC_DEFUN([AC_LIBTOOL_F77], [])\ndnl AC_DEFUN([AC_LIBTOOL_FC], [])\ndnl AC_DEFUN([AC_LIBTOOL_GCJ], [])\n\n\n# _LT_TAG_COMPILER\n# ----------------\nm4_defun([_LT_TAG_COMPILER],\n[AC_REQUIRE([AC_PROG_CC])dnl\n\n_LT_DECL([LTCC], [CC], [1], [A C compiler])dnl\n_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl\n_LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl\n_LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl\n\n# If no C compiler was specified, use CC.\nLTCC=${LTCC-\"$CC\"}\n\n# If no C compiler flags were specified, use CFLAGS.\nLTCFLAGS=${LTCFLAGS-\"$CFLAGS\"}\n\n# Allow CC to be a program name with arguments.\ncompiler=$CC\n])# _LT_TAG_COMPILER\n\n\n# _LT_COMPILER_BOILERPLATE\n# ------------------------\n# Check for compiler boilerplate output or warnings with\n# the simple compiler test code.\nm4_defun([_LT_COMPILER_BOILERPLATE],\n[m4_require([_LT_DECL_SED])dnl\nac_outfile=conftest.$ac_objext\necho \"$lt_simple_compile_test_code\" >conftest.$ac_ext\neval \"$ac_compile\" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err\n_lt_compiler_boilerplate=`cat conftest.err`\n$RM conftest*\n])# _LT_COMPILER_BOILERPLATE\n\n\n# _LT_LINKER_BOILERPLATE\n# ----------------------\n# Check for linker boilerplate output or warnings with\n# the simple link test code.\nm4_defun([_LT_LINKER_BOILERPLATE],\n[m4_require([_LT_DECL_SED])dnl\nac_outfile=conftest.$ac_objext\necho \"$lt_simple_link_test_code\" >conftest.$ac_ext\neval \"$ac_link\" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err\n_lt_linker_boilerplate=`cat conftest.err`\n$RM -r conftest*\n])# _LT_LINKER_BOILERPLATE\n\n# _LT_REQUIRED_DARWIN_CHECKS\n# -------------------------\nm4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[\n  case $host_os in\n    rhapsody* | darwin*)\n    AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:])\n    AC_CHECK_TOOL([NMEDIT], [nmedit], [:])\n    AC_CHECK_TOOL([LIPO], [lipo], [:])\n    AC_CHECK_TOOL([OTOOL], [otool], [:])\n    AC_CHECK_TOOL([OTOOL64], [otool64], [:])\n    _LT_DECL([], [DSYMUTIL], [1],\n      [Tool to manipulate archived DWARF debug symbol files on Mac OS X])\n    _LT_DECL([], [NMEDIT], [1],\n      [Tool to change global to local symbols on Mac OS X])\n    _LT_DECL([], [LIPO], [1],\n      [Tool to manipulate fat objects and archives on Mac OS X])\n    _LT_DECL([], [OTOOL], [1],\n      [ldd/readelf like tool for Mach-O binaries on Mac OS X])\n    _LT_DECL([], [OTOOL64], [1],\n      [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4])\n\n    AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod],\n      [lt_cv_apple_cc_single_mod=no\n      if test -z \"${LT_MULTI_MODULE}\"; then\n\t# By default we will add the -single_module flag. You can override\n\t# by either setting the environment variable LT_MULTI_MODULE\n\t# non-empty at configure time, or by adding -multi_module to the\n\t# link flags.\n\trm -rf libconftest.dylib*\n\techo \"int foo(void){return 1;}\" > conftest.c\n\techo \"$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \\\n-dynamiclib -Wl,-single_module conftest.c\" >&AS_MESSAGE_LOG_FD\n\t$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \\\n\t  -dynamiclib -Wl,-single_module conftest.c 2>conftest.err\n        _lt_result=$?\n\tif test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then\n\t  lt_cv_apple_cc_single_mod=yes\n\telse\n\t  cat conftest.err >&AS_MESSAGE_LOG_FD\n\tfi\n\trm -rf libconftest.dylib*\n\trm -f conftest.*\n      fi])\n    AC_CACHE_CHECK([for -exported_symbols_list linker flag],\n      [lt_cv_ld_exported_symbols_list],\n      [lt_cv_ld_exported_symbols_list=no\n      save_LDFLAGS=$LDFLAGS\n      echo \"_main\" > conftest.sym\n      LDFLAGS=\"$LDFLAGS -Wl,-exported_symbols_list,conftest.sym\"\n      AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],\n\t[lt_cv_ld_exported_symbols_list=yes],\n\t[lt_cv_ld_exported_symbols_list=no])\n\tLDFLAGS=\"$save_LDFLAGS\"\n    ])\n    case $host_os in\n    rhapsody* | darwin1.[[012]])\n      _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;\n    darwin1.*)\n      _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;\n    darwin*) # darwin 5.x on\n      # if running on 10.5 or later, the deployment target defaults\n      # to the OS version, if on x86, and 10.4, the deployment\n      # target defaults to 10.4. Don't you love it?\n      case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in\n\t10.0,*86*-darwin8*|10.0,*-darwin[[91]]*)\n\t  _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;\n\t10.[[012]]*)\n\t  _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;\n\t10.*)\n\t  _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;\n      esac\n    ;;\n  esac\n    if test \"$lt_cv_apple_cc_single_mod\" = \"yes\"; then\n      _lt_dar_single_mod='$single_module'\n    fi\n    if test \"$lt_cv_ld_exported_symbols_list\" = \"yes\"; then\n      _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'\n    else\n      _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'\n    fi\n    if test \"$DSYMUTIL\" != \":\"; then\n      _lt_dsymutil='~$DSYMUTIL $lib || :'\n    else\n      _lt_dsymutil=\n    fi\n    ;;\n  esac\n])\n\n\n# _LT_DARWIN_LINKER_FEATURES\n# --------------------------\n# Checks for linker and compiler features on darwin\nm4_defun([_LT_DARWIN_LINKER_FEATURES],\n[\n  m4_require([_LT_REQUIRED_DARWIN_CHECKS])\n  _LT_TAGVAR(archive_cmds_need_lc, $1)=no\n  _LT_TAGVAR(hardcode_direct, $1)=no\n  _LT_TAGVAR(hardcode_automatic, $1)=yes\n  _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported\n  _LT_TAGVAR(whole_archive_flag_spec, $1)=''\n  _LT_TAGVAR(link_all_deplibs, $1)=yes\n  _LT_TAGVAR(allow_undefined_flag, $1)=\"$_lt_dar_allow_undefined\"\n  case $cc_basename in\n     ifort*) _lt_dar_can_shared=yes ;;\n     *) _lt_dar_can_shared=$GCC ;;\n  esac\n  if test \"$_lt_dar_can_shared\" = \"yes\"; then\n    output_verbose_link_cmd=echo\n    _LT_TAGVAR(archive_cmds, $1)=\"\\$CC -dynamiclib \\$allow_undefined_flag -o \\$lib \\$libobjs \\$deplibs \\$compiler_flags -install_name \\$rpath/\\$soname \\$verstring $_lt_dar_single_mod${_lt_dsymutil}\"\n    _LT_TAGVAR(module_cmds, $1)=\"\\$CC \\$allow_undefined_flag -o \\$lib -bundle \\$libobjs \\$deplibs \\$compiler_flags${_lt_dsymutil}\"\n    _LT_TAGVAR(archive_expsym_cmds, $1)=\"sed 's,^,_,' < \\$export_symbols > \\$output_objdir/\\${libname}-symbols.expsym~\\$CC -dynamiclib \\$allow_undefined_flag -o \\$lib \\$libobjs \\$deplibs \\$compiler_flags -install_name \\$rpath/\\$soname \\$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}\"\n    _LT_TAGVAR(module_expsym_cmds, $1)=\"sed -e 's,^,_,' < \\$export_symbols > \\$output_objdir/\\${libname}-symbols.expsym~\\$CC \\$allow_undefined_flag -o \\$lib -bundle \\$libobjs \\$deplibs \\$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}\"\n    m4_if([$1], [CXX],\n[   if test \"$lt_cv_apple_cc_single_mod\" != \"yes\"; then\n      _LT_TAGVAR(archive_cmds, $1)=\"\\$CC -r -keep_private_externs -nostdlib -o \\${lib}-master.o \\$libobjs~\\$CC -dynamiclib \\$allow_undefined_flag -o \\$lib \\${lib}-master.o \\$deplibs \\$compiler_flags -install_name \\$rpath/\\$soname \\$verstring${_lt_dsymutil}\"\n      _LT_TAGVAR(archive_expsym_cmds, $1)=\"sed 's,^,_,' < \\$export_symbols > \\$output_objdir/\\${libname}-symbols.expsym~\\$CC -r -keep_private_externs -nostdlib -o \\${lib}-master.o \\$libobjs~\\$CC -dynamiclib \\$allow_undefined_flag -o \\$lib \\${lib}-master.o \\$deplibs \\$compiler_flags -install_name \\$rpath/\\$soname \\$verstring${_lt_dar_export_syms}${_lt_dsymutil}\"\n    fi\n],[])\n  else\n  _LT_TAGVAR(ld_shlibs, $1)=no\n  fi\n])\n\n# _LT_SYS_MODULE_PATH_AIX\n# -----------------------\n# Links a minimal program and checks the executable\n# for the system default hardcoded library path. In most cases,\n# this is /usr/lib:/lib, but when the MPI compilers are used\n# the location of the communication and MPI libs are included too.\n# If we don't find anything, use the default library path according\n# to the aix ld manual.\nm4_defun([_LT_SYS_MODULE_PATH_AIX],\n[m4_require([_LT_DECL_SED])dnl\nAC_LINK_IFELSE(AC_LANG_PROGRAM,[\nlt_aix_libpath_sed='\n    /Import File Strings/,/^$/ {\n\t/^0/ {\n\t    s/^0  *\\(.*\\)$/\\1/\n\t    p\n\t}\n    }'\naix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e \"$lt_aix_libpath_sed\"`\n# Check for a 64-bit object if we didn't find anything.\nif test -z \"$aix_libpath\"; then\n  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e \"$lt_aix_libpath_sed\"`\nfi],[])\nif test -z \"$aix_libpath\"; then aix_libpath=\"/usr/lib:/lib\"; fi\n])# _LT_SYS_MODULE_PATH_AIX\n\n\n# _LT_SHELL_INIT(ARG)\n# -------------------\nm4_define([_LT_SHELL_INIT],\n[ifdef([AC_DIVERSION_NOTICE],\n\t     [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)],\n\t [AC_DIVERT_PUSH(NOTICE)])\n$1\nAC_DIVERT_POP\n])# _LT_SHELL_INIT\n\n\n# _LT_PROG_ECHO_BACKSLASH\n# -----------------------\n# Add some code to the start of the generated configure script which\n# will find an echo command which doesn't interpret backslashes.\nm4_defun([_LT_PROG_ECHO_BACKSLASH],\n[_LT_SHELL_INIT([\n# Check that we are running under the correct shell.\nSHELL=${CONFIG_SHELL-/bin/sh}\n\ncase X$lt_ECHO in\nX*--fallback-echo)\n  # Remove one level of quotation (which was required for Make).\n  ECHO=`echo \"$lt_ECHO\" | sed 's,\\\\\\\\\\[$]\\\\[$]0,'[$]0','`\n  ;;\nesac\n\nECHO=${lt_ECHO-echo}\nif test \"X[$]1\" = X--no-reexec; then\n  # Discard the --no-reexec flag, and continue.\n  shift\nelif test \"X[$]1\" = X--fallback-echo; then\n  # Avoid inline document here, it may be left over\n  :\nelif test \"X`{ $ECHO '\\t'; } 2>/dev/null`\" = 'X\\t' ; then\n  # Yippee, $ECHO works!\n  :\nelse\n  # Restart under the correct shell.\n  exec $SHELL \"[$]0\" --no-reexec ${1+\"[$]@\"}\nfi\n\nif test \"X[$]1\" = X--fallback-echo; then\n  # used as fallback echo\n  shift\n  cat <<_LT_EOF\n[$]*\n_LT_EOF\n  exit 0\nfi\n\n# The HP-UX ksh and POSIX shell print the target directory to stdout\n# if CDPATH is set.\n(unset CDPATH) >/dev/null 2>&1 && unset CDPATH\n\nif test -z \"$lt_ECHO\"; then\n  if test \"X${echo_test_string+set}\" != Xset; then\n    # find a string as large as possible, as long as the shell can cope with it\n    for cmd in 'sed 50q \"[$]0\"' 'sed 20q \"[$]0\"' 'sed 10q \"[$]0\"' 'sed 2q \"[$]0\"' 'echo test'; do\n      # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...\n      if { echo_test_string=`eval $cmd`; } 2>/dev/null &&\n\t { test \"X$echo_test_string\" = \"X$echo_test_string\"; } 2>/dev/null\n      then\n        break\n      fi\n    done\n  fi\n\n  if test \"X`{ $ECHO '\\t'; } 2>/dev/null`\" = 'X\\t' &&\n     echo_testing_string=`{ $ECHO \"$echo_test_string\"; } 2>/dev/null` &&\n     test \"X$echo_testing_string\" = \"X$echo_test_string\"; then\n    :\n  else\n    # The Solaris, AIX, and Digital Unix default echo programs unquote\n    # backslashes.  This makes it impossible to quote backslashes using\n    #   echo \"$something\" | sed 's/\\\\/\\\\\\\\/g'\n    #\n    # So, first we look for a working echo in the user's PATH.\n\n    lt_save_ifs=\"$IFS\"; IFS=$PATH_SEPARATOR\n    for dir in $PATH /usr/ucb; do\n      IFS=\"$lt_save_ifs\"\n      if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&\n         test \"X`($dir/echo '\\t') 2>/dev/null`\" = 'X\\t' &&\n         echo_testing_string=`($dir/echo \"$echo_test_string\") 2>/dev/null` &&\n         test \"X$echo_testing_string\" = \"X$echo_test_string\"; then\n        ECHO=\"$dir/echo\"\n        break\n      fi\n    done\n    IFS=\"$lt_save_ifs\"\n\n    if test \"X$ECHO\" = Xecho; then\n      # We didn't find a better echo, so look for alternatives.\n      if test \"X`{ print -r '\\t'; } 2>/dev/null`\" = 'X\\t' &&\n         echo_testing_string=`{ print -r \"$echo_test_string\"; } 2>/dev/null` &&\n         test \"X$echo_testing_string\" = \"X$echo_test_string\"; then\n        # This shell has a builtin print -r that does the trick.\n        ECHO='print -r'\n      elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } &&\n\t   test \"X$CONFIG_SHELL\" != X/bin/ksh; then\n        # If we have ksh, try running configure again with it.\n        ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}\n        export ORIGINAL_CONFIG_SHELL\n        CONFIG_SHELL=/bin/ksh\n        export CONFIG_SHELL\n        exec $CONFIG_SHELL \"[$]0\" --no-reexec ${1+\"[$]@\"}\n      else\n        # Try using printf.\n        ECHO='printf %s\\n'\n        if test \"X`{ $ECHO '\\t'; } 2>/dev/null`\" = 'X\\t' &&\n\t   echo_testing_string=`{ $ECHO \"$echo_test_string\"; } 2>/dev/null` &&\n\t   test \"X$echo_testing_string\" = \"X$echo_test_string\"; then\n\t  # Cool, printf works\n\t  :\n        elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL \"[$]0\" --fallback-echo '\\t') 2>/dev/null` &&\n\t     test \"X$echo_testing_string\" = 'X\\t' &&\n\t     echo_testing_string=`($ORIGINAL_CONFIG_SHELL \"[$]0\" --fallback-echo \"$echo_test_string\") 2>/dev/null` &&\n\t     test \"X$echo_testing_string\" = \"X$echo_test_string\"; then\n\t  CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL\n\t  export CONFIG_SHELL\n\t  SHELL=\"$CONFIG_SHELL\"\n\t  export SHELL\n\t  ECHO=\"$CONFIG_SHELL [$]0 --fallback-echo\"\n        elif echo_testing_string=`($CONFIG_SHELL \"[$]0\" --fallback-echo '\\t') 2>/dev/null` &&\n\t     test \"X$echo_testing_string\" = 'X\\t' &&\n\t     echo_testing_string=`($CONFIG_SHELL \"[$]0\" --fallback-echo \"$echo_test_string\") 2>/dev/null` &&\n\t     test \"X$echo_testing_string\" = \"X$echo_test_string\"; then\n\t  ECHO=\"$CONFIG_SHELL [$]0 --fallback-echo\"\n        else\n\t  # maybe with a smaller string...\n\t  prev=:\n\n\t  for cmd in 'echo test' 'sed 2q \"[$]0\"' 'sed 10q \"[$]0\"' 'sed 20q \"[$]0\"' 'sed 50q \"[$]0\"'; do\n\t    if { test \"X$echo_test_string\" = \"X`eval $cmd`\"; } 2>/dev/null\n\t    then\n\t      break\n\t    fi\n\t    prev=\"$cmd\"\n\t  done\n\n\t  if test \"$prev\" != 'sed 50q \"[$]0\"'; then\n\t    echo_test_string=`eval $prev`\n\t    export echo_test_string\n\t    exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} \"[$]0\" ${1+\"[$]@\"}\n\t  else\n\t    # Oops.  We lost completely, so just stick with echo.\n\t    ECHO=echo\n\t  fi\n        fi\n      fi\n    fi\n  fi\nfi\n\n# Copy echo and quote the copy suitably for passing to libtool from\n# the Makefile, instead of quoting the original, which is used later.\nlt_ECHO=$ECHO\nif test \"X$lt_ECHO\" = \"X$CONFIG_SHELL [$]0 --fallback-echo\"; then\n   lt_ECHO=\"$CONFIG_SHELL \\\\\\$\\[$]0 --fallback-echo\"\nfi\n\nAC_SUBST(lt_ECHO)\n])\n_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts])\n_LT_DECL([], [ECHO], [1],\n    [An echo program that does not interpret backslashes])\n])# _LT_PROG_ECHO_BACKSLASH\n\n\n# _LT_ENABLE_LOCK\n# ---------------\nm4_defun([_LT_ENABLE_LOCK],\n[AC_ARG_ENABLE([libtool-lock],\n  [AS_HELP_STRING([--disable-libtool-lock],\n    [avoid locking (might break parallel builds)])])\ntest \"x$enable_libtool_lock\" != xno && enable_libtool_lock=yes\n\n# Some flags need to be propagated to the compiler or linker for good\n# libtool support.\ncase $host in\nia64-*-hpux*)\n  # Find out which ABI we are using.\n  echo 'int i;' > conftest.$ac_ext\n  if AC_TRY_EVAL(ac_compile); then\n    case `/usr/bin/file conftest.$ac_objext` in\n      *ELF-32*)\n\tHPUX_IA64_MODE=\"32\"\n\t;;\n      *ELF-64*)\n\tHPUX_IA64_MODE=\"64\"\n\t;;\n    esac\n  fi\n  rm -rf conftest*\n  ;;\n*-*-irix6*)\n  # Find out which ABI we are using.\n  echo '[#]line __oline__ \"configure\"' > conftest.$ac_ext\n  if AC_TRY_EVAL(ac_compile); then\n    if test \"$lt_cv_prog_gnu_ld\" = yes; then\n      case `/usr/bin/file conftest.$ac_objext` in\n\t*32-bit*)\n\t  LD=\"${LD-ld} -melf32bsmip\"\n\t  ;;\n\t*N32*)\n\t  LD=\"${LD-ld} -melf32bmipn32\"\n\t  ;;\n\t*64-bit*)\n\t  LD=\"${LD-ld} -melf64bmip\"\n\t;;\n      esac\n    else\n      case `/usr/bin/file conftest.$ac_objext` in\n\t*32-bit*)\n\t  LD=\"${LD-ld} -32\"\n\t  ;;\n\t*N32*)\n\t  LD=\"${LD-ld} -n32\"\n\t  ;;\n\t*64-bit*)\n\t  LD=\"${LD-ld} -64\"\n\t  ;;\n      esac\n    fi\n  fi\n  rm -rf conftest*\n  ;;\n\nx86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \\\ns390*-*linux*|s390*-*tpf*|sparc*-*linux*)\n  # Find out which ABI we are using.\n  echo 'int i;' > conftest.$ac_ext\n  if AC_TRY_EVAL(ac_compile); then\n    case `/usr/bin/file conftest.o` in\n      *32-bit*)\n\tcase $host in\n\t  x86_64-*kfreebsd*-gnu)\n\t    LD=\"${LD-ld} -m elf_i386_fbsd\"\n\t    ;;\n\t  x86_64-*linux*)\n\t    LD=\"${LD-ld} -m elf_i386\"\n\t    ;;\n\t  ppc64-*linux*|powerpc64-*linux*)\n\t    LD=\"${LD-ld} -m elf32ppclinux\"\n\t    ;;\n\t  s390x-*linux*)\n\t    LD=\"${LD-ld} -m elf_s390\"\n\t    ;;\n\t  sparc64-*linux*)\n\t    LD=\"${LD-ld} -m elf32_sparc\"\n\t    ;;\n\tesac\n\t;;\n      *64-bit*)\n\tcase $host in\n\t  x86_64-*kfreebsd*-gnu)\n\t    LD=\"${LD-ld} -m elf_x86_64_fbsd\"\n\t    ;;\n\t  x86_64-*linux*)\n\t    LD=\"${LD-ld} -m elf_x86_64\"\n\t    ;;\n\t  ppc*-*linux*|powerpc*-*linux*)\n\t    LD=\"${LD-ld} -m elf64ppc\"\n\t    ;;\n\t  s390*-*linux*|s390*-*tpf*)\n\t    LD=\"${LD-ld} -m elf64_s390\"\n\t    ;;\n\t  sparc*-*linux*)\n\t    LD=\"${LD-ld} -m elf64_sparc\"\n\t    ;;\n\tesac\n\t;;\n    esac\n  fi\n  rm -rf conftest*\n  ;;\n\n*-*-sco3.2v5*)\n  # On SCO OpenServer 5, we need -belf to get full-featured binaries.\n  SAVE_CFLAGS=\"$CFLAGS\"\n  CFLAGS=\"$CFLAGS -belf\"\n  AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,\n    [AC_LANG_PUSH(C)\n     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])\n     AC_LANG_POP])\n  if test x\"$lt_cv_cc_needs_belf\" != x\"yes\"; then\n    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf\n    CFLAGS=\"$SAVE_CFLAGS\"\n  fi\n  ;;\nsparc*-*solaris*)\n  # Find out which ABI we are using.\n  echo 'int i;' > conftest.$ac_ext\n  if AC_TRY_EVAL(ac_compile); then\n    case `/usr/bin/file conftest.o` in\n    *64-bit*)\n      case $lt_cv_prog_gnu_ld in\n      yes*) LD=\"${LD-ld} -m elf64_sparc\" ;;\n      *)\n\tif ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then\n\t  LD=\"${LD-ld} -64\"\n\tfi\n\t;;\n      esac\n      ;;\n    esac\n  fi\n  rm -rf conftest*\n  ;;\nesac\n\nneed_locks=\"$enable_libtool_lock\"\n])# _LT_ENABLE_LOCK\n\n\n# _LT_CMD_OLD_ARCHIVE\n# -------------------\nm4_defun([_LT_CMD_OLD_ARCHIVE],\n[AC_CHECK_TOOL(AR, ar, false)\ntest -z \"$AR\" && AR=ar\ntest -z \"$AR_FLAGS\" && AR_FLAGS=cru\n_LT_DECL([], [AR], [1], [The archiver])\n_LT_DECL([], [AR_FLAGS], [1])\n\nAC_CHECK_TOOL(STRIP, strip, :)\ntest -z \"$STRIP\" && STRIP=:\n_LT_DECL([], [STRIP], [1], [A symbol stripping program])\n\nAC_CHECK_TOOL(RANLIB, ranlib, :)\ntest -z \"$RANLIB\" && RANLIB=:\n_LT_DECL([], [RANLIB], [1],\n    [Commands used to install an old-style archive])\n\n# Determine commands to create old-style static archives.\nold_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'\nold_postinstall_cmds='chmod 644 $oldlib'\nold_postuninstall_cmds=\n\nif test -n \"$RANLIB\"; then\n  case $host_os in\n  openbsd*)\n    old_postinstall_cmds=\"$old_postinstall_cmds~\\$RANLIB -t \\$oldlib\"\n    ;;\n  *)\n    old_postinstall_cmds=\"$old_postinstall_cmds~\\$RANLIB \\$oldlib\"\n    ;;\n  esac\n  old_archive_cmds=\"$old_archive_cmds~\\$RANLIB \\$oldlib\"\nfi\n_LT_DECL([], [old_postinstall_cmds], [2])\n_LT_DECL([], [old_postuninstall_cmds], [2])\n_LT_TAGDECL([], [old_archive_cmds], [2],\n    [Commands used to build an old-style archive])\n])# _LT_CMD_OLD_ARCHIVE\n\n\n# _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,\n#\t\t[OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE])\n# ----------------------------------------------------------------\n# Check whether the given compiler option works\nAC_DEFUN([_LT_COMPILER_OPTION],\n[m4_require([_LT_FILEUTILS_DEFAULTS])dnl\nm4_require([_LT_DECL_SED])dnl\nAC_CACHE_CHECK([$1], [$2],\n  [$2=no\n   m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4])\n   echo \"$lt_simple_compile_test_code\" > conftest.$ac_ext\n   lt_compiler_flag=\"$3\"\n   # Insert the option either (1) after the last *FLAGS variable, or\n   # (2) before a word containing \"conftest.\", or (3) at the end.\n   # Note that $ac_compile itself does not contain backslashes and begins\n   # with a dollar sign (not a hyphen), so the echo should work correctly.\n   # The option is referenced via a variable to avoid confusing sed.\n   lt_compile=`echo \"$ac_compile\" | $SED \\\n   -e 's:.*FLAGS}\\{0,1\\} :&$lt_compiler_flag :; t' \\\n   -e 's: [[^ ]]*conftest\\.: $lt_compiler_flag&:; t' \\\n   -e 's:$: $lt_compiler_flag:'`\n   (eval echo \"\\\"\\$as_me:__oline__: $lt_compile\\\"\" >&AS_MESSAGE_LOG_FD)\n   (eval \"$lt_compile\" 2>conftest.err)\n   ac_status=$?\n   cat conftest.err >&AS_MESSAGE_LOG_FD\n   echo \"$as_me:__oline__: \\$? = $ac_status\" >&AS_MESSAGE_LOG_FD\n   if (exit $ac_status) && test -s \"$ac_outfile\"; then\n     # The compiler can only warn and ignore the option if not recognized\n     # So say no if there are warnings other than the usual output.\n     $ECHO \"X$_lt_compiler_boilerplate\" | $Xsed -e '/^$/d' >conftest.exp\n     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2\n     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then\n       $2=yes\n     fi\n   fi\n   $RM conftest*\n])\n\nif test x\"[$]$2\" = xyes; then\n    m4_if([$5], , :, [$5])\nelse\n    m4_if([$6], , :, [$6])\nfi\n])# _LT_COMPILER_OPTION\n\n# Old name:\nAU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION])\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], [])\n\n\n# _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,\n#                  [ACTION-SUCCESS], [ACTION-FAILURE])\n# ----------------------------------------------------\n# Check whether the given linker option works\nAC_DEFUN([_LT_LINKER_OPTION],\n[m4_require([_LT_FILEUTILS_DEFAULTS])dnl\nm4_require([_LT_DECL_SED])dnl\nAC_CACHE_CHECK([$1], [$2],\n  [$2=no\n   save_LDFLAGS=\"$LDFLAGS\"\n   LDFLAGS=\"$LDFLAGS $3\"\n   echo \"$lt_simple_link_test_code\" > conftest.$ac_ext\n   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then\n     # The linker can only warn and ignore the option if not recognized\n     # So say no if there are warnings\n     if test -s conftest.err; then\n       # Append any errors to the config.log.\n       cat conftest.err 1>&AS_MESSAGE_LOG_FD\n       $ECHO \"X$_lt_linker_boilerplate\" | $Xsed -e '/^$/d' > conftest.exp\n       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2\n       if diff conftest.exp conftest.er2 >/dev/null; then\n         $2=yes\n       fi\n     else\n       $2=yes\n     fi\n   fi\n   $RM -r conftest*\n   LDFLAGS=\"$save_LDFLAGS\"\n])\n\nif test x\"[$]$2\" = xyes; then\n    m4_if([$4], , :, [$4])\nelse\n    m4_if([$5], , :, [$5])\nfi\n])# _LT_LINKER_OPTION\n\n# Old name:\nAU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION])\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], [])\n\n\n# LT_CMD_MAX_LEN\n#---------------\nAC_DEFUN([LT_CMD_MAX_LEN],\n[AC_REQUIRE([AC_CANONICAL_HOST])dnl\n# find the maximum length of command line arguments\nAC_MSG_CHECKING([the maximum length of command line arguments])\nAC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl\n  i=0\n  teststring=\"ABCD\"\n\n  case $build_os in\n  msdosdjgpp*)\n    # On DJGPP, this test can blow up pretty badly due to problems in libc\n    # (any single argument exceeding 2000 bytes causes a buffer overrun\n    # during glob expansion).  Even if it were fixed, the result of this\n    # check would be larger than it should be.\n    lt_cv_sys_max_cmd_len=12288;    # 12K is about right\n    ;;\n\n  gnu*)\n    # Under GNU Hurd, this test is not required because there is\n    # no limit to the length of command line arguments.\n    # Libtool will interpret -1 as no limit whatsoever\n    lt_cv_sys_max_cmd_len=-1;\n    ;;\n\n  cygwin* | mingw* | cegcc*)\n    # On Win9x/ME, this test blows up -- it succeeds, but takes\n    # about 5 minutes as the teststring grows exponentially.\n    # Worse, since 9x/ME are not pre-emptively multitasking,\n    # you end up with a \"frozen\" computer, even though with patience\n    # the test eventually succeeds (with a max line length of 256k).\n    # Instead, let's just punt: use the minimum linelength reported by\n    # all of the supported platforms: 8192 (on NT/2K/XP).\n    lt_cv_sys_max_cmd_len=8192;\n    ;;\n\n  amigaos*)\n    # On AmigaOS with pdksh, this test takes hours, literally.\n    # So we just punt and use a minimum line length of 8192.\n    lt_cv_sys_max_cmd_len=8192;\n    ;;\n\n  netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)\n    # This has been around since 386BSD, at least.  Likely further.\n    if test -x /sbin/sysctl; then\n      lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`\n    elif test -x /usr/sbin/sysctl; then\n      lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`\n    else\n      lt_cv_sys_max_cmd_len=65536\t# usable default for all BSDs\n    fi\n    # And add a safety zone\n    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \\/ 4`\n    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \\* 3`\n    ;;\n\n  interix*)\n    # We know the value 262144 and hardcode it with a safety zone (like BSD)\n    lt_cv_sys_max_cmd_len=196608\n    ;;\n\n  osf*)\n    # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure\n    # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not\n    # nice to cause kernel panics so lets avoid the loop below.\n    # First set a reasonable default.\n    lt_cv_sys_max_cmd_len=16384\n    #\n    if test -x /sbin/sysconfig; then\n      case `/sbin/sysconfig -q proc exec_disable_arg_limit` in\n        *1*) lt_cv_sys_max_cmd_len=-1 ;;\n      esac\n    fi\n    ;;\n  sco3.2v5*)\n    lt_cv_sys_max_cmd_len=102400\n    ;;\n  sysv5* | sco5v6* | sysv4.2uw2*)\n    kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`\n    if test -n \"$kargmax\"; then\n      lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[\t ]]//'`\n    else\n      lt_cv_sys_max_cmd_len=32768\n    fi\n    ;;\n  *)\n    lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`\n    if test -n \"$lt_cv_sys_max_cmd_len\"; then\n      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \\/ 4`\n      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \\* 3`\n    else\n      # Make teststring a little bigger before we do anything with it.\n      # a 1K string should be a reasonable start.\n      for i in 1 2 3 4 5 6 7 8 ; do\n        teststring=$teststring$teststring\n      done\n      SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}\n      # If test is not a shell built-in, we'll probably end up computing a\n      # maximum length that is only half of the actual maximum length, but\n      # we can't tell.\n      while { test \"X\"`$SHELL [$]0 --fallback-echo \"X$teststring$teststring\" 2>/dev/null` \\\n\t         = \"XX$teststring$teststring\"; } >/dev/null 2>&1 &&\n\t      test $i != 17 # 1/2 MB should be enough\n      do\n        i=`expr $i + 1`\n        teststring=$teststring$teststring\n      done\n      # Only check the string length outside the loop.\n      lt_cv_sys_max_cmd_len=`expr \"X$teststring\" : \".*\" 2>&1`\n      teststring=\n      # Add a significant safety factor because C++ compilers can tack on\n      # massive amounts of additional arguments before passing them to the\n      # linker.  It appears as though 1/2 is a usable value.\n      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \\/ 2`\n    fi\n    ;;\n  esac\n])\nif test -n $lt_cv_sys_max_cmd_len ; then\n  AC_MSG_RESULT($lt_cv_sys_max_cmd_len)\nelse\n  AC_MSG_RESULT(none)\nfi\nmax_cmd_len=$lt_cv_sys_max_cmd_len\n_LT_DECL([], [max_cmd_len], [0],\n    [What is the maximum length of a command?])\n])# LT_CMD_MAX_LEN\n\n# Old name:\nAU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN])\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], [])\n\n\n# _LT_HEADER_DLFCN\n# ----------------\nm4_defun([_LT_HEADER_DLFCN],\n[AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl\n])# _LT_HEADER_DLFCN\n\n\n# _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE,\n#                      ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING)\n# ----------------------------------------------------------------\nm4_defun([_LT_TRY_DLOPEN_SELF],\n[m4_require([_LT_HEADER_DLFCN])dnl\nif test \"$cross_compiling\" = yes; then :\n  [$4]\nelse\n  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2\n  lt_status=$lt_dlunknown\n  cat > conftest.$ac_ext <<_LT_EOF\n[#line __oline__ \"configure\"\n#include \"confdefs.h\"\n\n#if HAVE_DLFCN_H\n#include <dlfcn.h>\n#endif\n\n#include <stdio.h>\n\n#ifdef RTLD_GLOBAL\n#  define LT_DLGLOBAL\t\tRTLD_GLOBAL\n#else\n#  ifdef DL_GLOBAL\n#    define LT_DLGLOBAL\t\tDL_GLOBAL\n#  else\n#    define LT_DLGLOBAL\t\t0\n#  endif\n#endif\n\n/* We may have to define LT_DLLAZY_OR_NOW in the command line if we\n   find out it does not work in some platform. */\n#ifndef LT_DLLAZY_OR_NOW\n#  ifdef RTLD_LAZY\n#    define LT_DLLAZY_OR_NOW\t\tRTLD_LAZY\n#  else\n#    ifdef DL_LAZY\n#      define LT_DLLAZY_OR_NOW\t\tDL_LAZY\n#    else\n#      ifdef RTLD_NOW\n#        define LT_DLLAZY_OR_NOW\tRTLD_NOW\n#      else\n#        ifdef DL_NOW\n#          define LT_DLLAZY_OR_NOW\tDL_NOW\n#        else\n#          define LT_DLLAZY_OR_NOW\t0\n#        endif\n#      endif\n#    endif\n#  endif\n#endif\n\nvoid fnord() { int i=42;}\nint main ()\n{\n  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);\n  int status = $lt_dlunknown;\n\n  if (self)\n    {\n      if (dlsym (self,\"fnord\"))       status = $lt_dlno_uscore;\n      else if (dlsym( self,\"_fnord\")) status = $lt_dlneed_uscore;\n      /* dlclose (self); */\n    }\n  else\n    puts (dlerror ());\n\n  return status;\n}]\n_LT_EOF\n  if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then\n    (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null\n    lt_status=$?\n    case x$lt_status in\n      x$lt_dlno_uscore) $1 ;;\n      x$lt_dlneed_uscore) $2 ;;\n      x$lt_dlunknown|x*) $3 ;;\n    esac\n  else :\n    # compilation failed\n    $3\n  fi\nfi\nrm -fr conftest*\n])# _LT_TRY_DLOPEN_SELF\n\n\n# LT_SYS_DLOPEN_SELF\n# ------------------\nAC_DEFUN([LT_SYS_DLOPEN_SELF],\n[m4_require([_LT_HEADER_DLFCN])dnl\nif test \"x$enable_dlopen\" != xyes; then\n  enable_dlopen=unknown\n  enable_dlopen_self=unknown\n  enable_dlopen_self_static=unknown\nelse\n  lt_cv_dlopen=no\n  lt_cv_dlopen_libs=\n\n  case $host_os in\n  beos*)\n    lt_cv_dlopen=\"load_add_on\"\n    lt_cv_dlopen_libs=\n    lt_cv_dlopen_self=yes\n    ;;\n\n  mingw* | pw32* | cegcc*)\n    lt_cv_dlopen=\"LoadLibrary\"\n    lt_cv_dlopen_libs=\n    ;;\n\n  cygwin*)\n    lt_cv_dlopen=\"dlopen\"\n    lt_cv_dlopen_libs=\n    ;;\n\n  darwin*)\n  # if libdl is installed we need to link against it\n    AC_CHECK_LIB([dl], [dlopen],\n\t\t[lt_cv_dlopen=\"dlopen\" lt_cv_dlopen_libs=\"-ldl\"],[\n    lt_cv_dlopen=\"dyld\"\n    lt_cv_dlopen_libs=\n    lt_cv_dlopen_self=yes\n    ])\n    ;;\n\n  *)\n    AC_CHECK_FUNC([shl_load],\n\t  [lt_cv_dlopen=\"shl_load\"],\n      [AC_CHECK_LIB([dld], [shl_load],\n\t    [lt_cv_dlopen=\"shl_load\" lt_cv_dlopen_libs=\"-ldld\"],\n\t[AC_CHECK_FUNC([dlopen],\n\t      [lt_cv_dlopen=\"dlopen\"],\n\t  [AC_CHECK_LIB([dl], [dlopen],\n\t\t[lt_cv_dlopen=\"dlopen\" lt_cv_dlopen_libs=\"-ldl\"],\n\t    [AC_CHECK_LIB([svld], [dlopen],\n\t\t  [lt_cv_dlopen=\"dlopen\" lt_cv_dlopen_libs=\"-lsvld\"],\n\t      [AC_CHECK_LIB([dld], [dld_link],\n\t\t    [lt_cv_dlopen=\"dld_link\" lt_cv_dlopen_libs=\"-ldld\"])\n\t      ])\n\t    ])\n\t  ])\n\t])\n      ])\n    ;;\n  esac\n\n  if test \"x$lt_cv_dlopen\" != xno; then\n    enable_dlopen=yes\n  else\n    enable_dlopen=no\n  fi\n\n  case $lt_cv_dlopen in\n  dlopen)\n    save_CPPFLAGS=\"$CPPFLAGS\"\n    test \"x$ac_cv_header_dlfcn_h\" = xyes && CPPFLAGS=\"$CPPFLAGS -DHAVE_DLFCN_H\"\n\n    save_LDFLAGS=\"$LDFLAGS\"\n    wl=$lt_prog_compiler_wl eval LDFLAGS=\\\"\\$LDFLAGS $export_dynamic_flag_spec\\\"\n\n    save_LIBS=\"$LIBS\"\n    LIBS=\"$lt_cv_dlopen_libs $LIBS\"\n\n    AC_CACHE_CHECK([whether a program can dlopen itself],\n\t  lt_cv_dlopen_self, [dnl\n\t  _LT_TRY_DLOPEN_SELF(\n\t    lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes,\n\t    lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross)\n    ])\n\n    if test \"x$lt_cv_dlopen_self\" = xyes; then\n      wl=$lt_prog_compiler_wl eval LDFLAGS=\\\"\\$LDFLAGS $lt_prog_compiler_static\\\"\n      AC_CACHE_CHECK([whether a statically linked program can dlopen itself],\n\t  lt_cv_dlopen_self_static, [dnl\n\t  _LT_TRY_DLOPEN_SELF(\n\t    lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes,\n\t    lt_cv_dlopen_self_static=no,  lt_cv_dlopen_self_static=cross)\n      ])\n    fi\n\n    CPPFLAGS=\"$save_CPPFLAGS\"\n    LDFLAGS=\"$save_LDFLAGS\"\n    LIBS=\"$save_LIBS\"\n    ;;\n  esac\n\n  case $lt_cv_dlopen_self in\n  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;\n  *) enable_dlopen_self=unknown ;;\n  esac\n\n  case $lt_cv_dlopen_self_static in\n  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;\n  *) enable_dlopen_self_static=unknown ;;\n  esac\nfi\n_LT_DECL([dlopen_support], [enable_dlopen], [0],\n\t [Whether dlopen is supported])\n_LT_DECL([dlopen_self], [enable_dlopen_self], [0],\n\t [Whether dlopen of programs is supported])\n_LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0],\n\t [Whether dlopen of statically linked programs is supported])\n])# LT_SYS_DLOPEN_SELF\n\n# Old name:\nAU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF])\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], [])\n\n\n# _LT_COMPILER_C_O([TAGNAME])\n# ---------------------------\n# Check to see if options -c and -o are simultaneously supported by compiler.\n# This macro does not hard code the compiler like AC_PROG_CC_C_O.\nm4_defun([_LT_COMPILER_C_O],\n[m4_require([_LT_DECL_SED])dnl\nm4_require([_LT_FILEUTILS_DEFAULTS])dnl\nm4_require([_LT_TAG_COMPILER])dnl\nAC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],\n  [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)],\n  [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no\n   $RM -r conftest 2>/dev/null\n   mkdir conftest\n   cd conftest\n   mkdir out\n   echo \"$lt_simple_compile_test_code\" > conftest.$ac_ext\n\n   lt_compiler_flag=\"-o out/conftest2.$ac_objext\"\n   # Insert the option either (1) after the last *FLAGS variable, or\n   # (2) before a word containing \"conftest.\", or (3) at the end.\n   # Note that $ac_compile itself does not contain backslashes and begins\n   # with a dollar sign (not a hyphen), so the echo should work correctly.\n   lt_compile=`echo \"$ac_compile\" | $SED \\\n   -e 's:.*FLAGS}\\{0,1\\} :&$lt_compiler_flag :; t' \\\n   -e 's: [[^ ]]*conftest\\.: $lt_compiler_flag&:; t' \\\n   -e 's:$: $lt_compiler_flag:'`\n   (eval echo \"\\\"\\$as_me:__oline__: $lt_compile\\\"\" >&AS_MESSAGE_LOG_FD)\n   (eval \"$lt_compile\" 2>out/conftest.err)\n   ac_status=$?\n   cat out/conftest.err >&AS_MESSAGE_LOG_FD\n   echo \"$as_me:__oline__: \\$? = $ac_status\" >&AS_MESSAGE_LOG_FD\n   if (exit $ac_status) && test -s out/conftest2.$ac_objext\n   then\n     # The compiler can only warn and ignore the option if not recognized\n     # So say no if there are warnings\n     $ECHO \"X$_lt_compiler_boilerplate\" | $Xsed -e '/^$/d' > out/conftest.exp\n     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2\n     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then\n       _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes\n     fi\n   fi\n   chmod u+w . 2>&AS_MESSAGE_LOG_FD\n   $RM conftest*\n   # SGI C++ compiler will create directory out/ii_files/ for\n   # template instantiation\n   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files\n   $RM out/* && rmdir out\n   cd ..\n   $RM -r conftest\n   $RM conftest*\n])\n_LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1],\n\t[Does compiler simultaneously support -c and -o options?])\n])# _LT_COMPILER_C_O\n\n\n# _LT_COMPILER_FILE_LOCKS([TAGNAME])\n# ----------------------------------\n# Check to see if we can do hard links to lock some files if needed\nm4_defun([_LT_COMPILER_FILE_LOCKS],\n[m4_require([_LT_ENABLE_LOCK])dnl\nm4_require([_LT_FILEUTILS_DEFAULTS])dnl\n_LT_COMPILER_C_O([$1])\n\nhard_links=\"nottested\"\nif test \"$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)\" = no && test \"$need_locks\" != no; then\n  # do not overwrite the value of need_locks provided by the user\n  AC_MSG_CHECKING([if we can lock with hard links])\n  hard_links=yes\n  $RM conftest*\n  ln conftest.a conftest.b 2>/dev/null && hard_links=no\n  touch conftest.a\n  ln conftest.a conftest.b 2>&5 || hard_links=no\n  ln conftest.a conftest.b 2>/dev/null && hard_links=no\n  AC_MSG_RESULT([$hard_links])\n  if test \"$hard_links\" = no; then\n    AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe])\n    need_locks=warn\n  fi\nelse\n  need_locks=no\nfi\n_LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?])\n])# _LT_COMPILER_FILE_LOCKS\n\n\n# _LT_CHECK_OBJDIR\n# ----------------\nm4_defun([_LT_CHECK_OBJDIR],\n[AC_CACHE_CHECK([for objdir], [lt_cv_objdir],\n[rm -f .libs 2>/dev/null\nmkdir .libs 2>/dev/null\nif test -d .libs; then\n  lt_cv_objdir=.libs\nelse\n  # MS-DOS does not allow filenames that begin with a dot.\n  lt_cv_objdir=_libs\nfi\nrmdir .libs 2>/dev/null])\nobjdir=$lt_cv_objdir\n_LT_DECL([], [objdir], [0],\n         [The name of the directory that contains temporary libtool files])dnl\nm4_pattern_allow([LT_OBJDIR])dnl\nAC_DEFINE_UNQUOTED(LT_OBJDIR, \"$lt_cv_objdir/\",\n  [Define to the sub-directory in which libtool stores uninstalled libraries.])\n])# _LT_CHECK_OBJDIR\n\n\n# _LT_LINKER_HARDCODE_LIBPATH([TAGNAME])\n# --------------------------------------\n# Check hardcoding attributes.\nm4_defun([_LT_LINKER_HARDCODE_LIBPATH],\n[AC_MSG_CHECKING([how to hardcode library paths into programs])\n_LT_TAGVAR(hardcode_action, $1)=\nif test -n \"$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\" ||\n   test -n \"$_LT_TAGVAR(runpath_var, $1)\" ||\n   test \"X$_LT_TAGVAR(hardcode_automatic, $1)\" = \"Xyes\" ; then\n\n  # We can hardcode non-existent directories.\n  if test \"$_LT_TAGVAR(hardcode_direct, $1)\" != no &&\n     # If the only mechanism to avoid hardcoding is shlibpath_var, we\n     # have to relink, otherwise we might link with an installed library\n     # when we should be linking with a yet-to-be-installed one\n     ## test \"$_LT_TAGVAR(hardcode_shlibpath_var, $1)\" != no &&\n     test \"$_LT_TAGVAR(hardcode_minus_L, $1)\" != no; then\n    # Linking always hardcodes the temporary library directory.\n    _LT_TAGVAR(hardcode_action, $1)=relink\n  else\n    # We can link without hardcoding, and we can hardcode nonexisting dirs.\n    _LT_TAGVAR(hardcode_action, $1)=immediate\n  fi\nelse\n  # We cannot hardcode anything, or else we can only hardcode existing\n  # directories.\n  _LT_TAGVAR(hardcode_action, $1)=unsupported\nfi\nAC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)])\n\nif test \"$_LT_TAGVAR(hardcode_action, $1)\" = relink ||\n   test \"$_LT_TAGVAR(inherit_rpath, $1)\" = yes; then\n  # Fast installation is not supported\n  enable_fast_install=no\nelif test \"$shlibpath_overrides_runpath\" = yes ||\n     test \"$enable_shared\" = no; then\n  # Fast installation is not necessary\n  enable_fast_install=needless\nfi\n_LT_TAGDECL([], [hardcode_action], [0],\n    [How to hardcode a shared library path into an executable])\n])# _LT_LINKER_HARDCODE_LIBPATH\n\n\n# _LT_CMD_STRIPLIB\n# ----------------\nm4_defun([_LT_CMD_STRIPLIB],\n[m4_require([_LT_DECL_EGREP])\nstriplib=\nold_striplib=\nAC_MSG_CHECKING([whether stripping libraries is possible])\nif test -n \"$STRIP\" && $STRIP -V 2>&1 | $GREP \"GNU strip\" >/dev/null; then\n  test -z \"$old_striplib\" && old_striplib=\"$STRIP --strip-debug\"\n  test -z \"$striplib\" && striplib=\"$STRIP --strip-unneeded\"\n  AC_MSG_RESULT([yes])\nelse\n# FIXME - insert some real tests, host_os isn't really good enough\n  case $host_os in\n  darwin*)\n    if test -n \"$STRIP\" ; then\n      striplib=\"$STRIP -x\"\n      old_striplib=\"$STRIP -S\"\n      AC_MSG_RESULT([yes])\n    else\n      AC_MSG_RESULT([no])\n    fi\n    ;;\n  *)\n    AC_MSG_RESULT([no])\n    ;;\n  esac\nfi\n_LT_DECL([], [old_striplib], [1], [Commands to strip libraries])\n_LT_DECL([], [striplib], [1])\n])# _LT_CMD_STRIPLIB\n\n\n# _LT_SYS_DYNAMIC_LINKER([TAG])\n# -----------------------------\n# PORTME Fill in your ld.so characteristics\nm4_defun([_LT_SYS_DYNAMIC_LINKER],\n[AC_REQUIRE([AC_CANONICAL_HOST])dnl\nm4_require([_LT_DECL_EGREP])dnl\nm4_require([_LT_FILEUTILS_DEFAULTS])dnl\nm4_require([_LT_DECL_OBJDUMP])dnl\nm4_require([_LT_DECL_SED])dnl\nAC_MSG_CHECKING([dynamic linker characteristics])\nm4_if([$1],\n\t[], [\nif test \"$GCC\" = yes; then\n  case $host_os in\n    darwin*) lt_awk_arg=\"/^libraries:/,/LR/\" ;;\n    *) lt_awk_arg=\"/^libraries:/\" ;;\n  esac\n  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e \"s/^libraries://\" -e \"s,=/,/,g\"`\n  if $ECHO \"$lt_search_path_spec\" | $GREP ';' >/dev/null ; then\n    # if the path contains \";\" then we assume it to be the separator\n    # otherwise default to the standard path separator (i.e. \":\") - it is\n    # assumed that no part of a normal pathname contains \";\" but that should\n    # okay in the real world where \";\" in dirpaths is itself problematic.\n    lt_search_path_spec=`$ECHO \"$lt_search_path_spec\" | $SED -e 's/;/ /g'`\n  else\n    lt_search_path_spec=`$ECHO \"$lt_search_path_spec\" | $SED  -e \"s/$PATH_SEPARATOR/ /g\"`\n  fi\n  # Ok, now we have the path, separated by spaces, we can step through it\n  # and add multilib dir if necessary.\n  lt_tmp_lt_search_path_spec=\n  lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`\n  for lt_sys_path in $lt_search_path_spec; do\n    if test -d \"$lt_sys_path/$lt_multi_os_dir\"; then\n      lt_tmp_lt_search_path_spec=\"$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir\"\n    else\n      test -d \"$lt_sys_path\" && \\\n\tlt_tmp_lt_search_path_spec=\"$lt_tmp_lt_search_path_spec $lt_sys_path\"\n    fi\n  done\n  lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk '\nBEGIN {RS=\" \"; FS=\"/|\\n\";} {\n  lt_foo=\"\";\n  lt_count=0;\n  for (lt_i = NF; lt_i > 0; lt_i--) {\n    if ($lt_i != \"\" && $lt_i != \".\") {\n      if ($lt_i == \"..\") {\n        lt_count++;\n      } else {\n        if (lt_count == 0) {\n          lt_foo=\"/\" $lt_i lt_foo;\n        } else {\n          lt_count--;\n        }\n      }\n    }\n  }\n  if (lt_foo != \"\") { lt_freq[[lt_foo]]++; }\n  if (lt_freq[[lt_foo]] == 1) { print lt_foo; }\n}'`\n  sys_lib_search_path_spec=`$ECHO $lt_search_path_spec`\nelse\n  sys_lib_search_path_spec=\"/lib /usr/lib /usr/local/lib\"\nfi])\nlibrary_names_spec=\nlibname_spec='lib$name'\nsoname_spec=\nshrext_cmds=\".so\"\npostinstall_cmds=\npostuninstall_cmds=\nfinish_cmds=\nfinish_eval=\nshlibpath_var=\nshlibpath_overrides_runpath=unknown\nversion_type=none\ndynamic_linker=\"$host_os ld.so\"\nsys_lib_dlsearch_path_spec=\"/lib /usr/lib\"\nneed_lib_prefix=unknown\nhardcode_into_libs=no\n\n# when you set need_version to no, make sure it does not cause -set_version\n# flags to be left without arguments\nneed_version=unknown\n\ncase $host_os in\naix3*)\n  version_type=linux\n  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'\n  shlibpath_var=LIBPATH\n\n  # AIX 3 has no versioning support, so we append a major version to the name.\n  soname_spec='${libname}${release}${shared_ext}$major'\n  ;;\n\naix[[4-9]]*)\n  version_type=linux\n  need_lib_prefix=no\n  need_version=no\n  hardcode_into_libs=yes\n  if test \"$host_cpu\" = ia64; then\n    # AIX 5 supports IA64\n    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'\n    shlibpath_var=LD_LIBRARY_PATH\n  else\n    # With GCC up to 2.95.x, collect2 would create an import file\n    # for dependence libraries.  The import file would start with\n    # the line `#! .'.  This would cause the generated library to\n    # depend on `.', always an invalid library.  This was fixed in\n    # development snapshots of GCC prior to 3.0.\n    case $host_os in\n      aix4 | aix4.[[01]] | aix4.[[01]].*)\n      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'\n\t   echo ' yes '\n\t   echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then\n\t:\n      else\n\tcan_build_shared=no\n      fi\n      ;;\n    esac\n    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct\n    # soname into executable. Probably we can add versioning support to\n    # collect2, so additional links can be useful in future.\n    if test \"$aix_use_runtimelinking\" = yes; then\n      # If using run time linking (on AIX 4.2 or later) use lib<name>.so\n      # instead of lib<name>.a to let people know that these are not\n      # typical AIX shared libraries.\n      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n    else\n      # We preserve .a as extension for shared libraries through AIX4.2\n      # and later when we are not doing run time linking.\n      library_names_spec='${libname}${release}.a $libname.a'\n      soname_spec='${libname}${release}${shared_ext}$major'\n    fi\n    shlibpath_var=LIBPATH\n  fi\n  ;;\n\namigaos*)\n  case $host_cpu in\n  powerpc)\n    # Since July 2007 AmigaOS4 officially supports .so libraries.\n    # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.\n    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n    ;;\n  m68k)\n    library_names_spec='$libname.ixlibrary $libname.a'\n    # Create ${libname}_ixlibrary.a entries in /sys/libs.\n    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO \"X$lib\" | $Xsed -e '\\''s%^.*/\\([[^/]]*\\)\\.ixlibrary$%\\1%'\\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show \"cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a\"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'\n    ;;\n  esac\n  ;;\n\nbeos*)\n  library_names_spec='${libname}${shared_ext}'\n  dynamic_linker=\"$host_os ld.so\"\n  shlibpath_var=LIBRARY_PATH\n  ;;\n\nbsdi[[45]]*)\n  version_type=linux\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  finish_cmds='PATH=\"\\$PATH:/sbin\" ldconfig $libdir'\n  shlibpath_var=LD_LIBRARY_PATH\n  sys_lib_search_path_spec=\"/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib\"\n  sys_lib_dlsearch_path_spec=\"/shlib /usr/lib /usr/local/lib\"\n  # the default ld.so.conf also contains /usr/contrib/lib and\n  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow\n  # libtool to hard-code these into programs\n  ;;\n\ncygwin* | mingw* | pw32* | cegcc*)\n  version_type=windows\n  shrext_cmds=\".dll\"\n  need_version=no\n  need_lib_prefix=no\n\n  case $GCC,$host_os in\n  yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)\n    library_names_spec='$libname.dll.a'\n    # DLL is installed to $(libdir)/../bin by postinstall_cmds\n    postinstall_cmds='base_file=`basename \\${file}`~\n      dlpath=`$SHELL 2>&1 -c '\\''. $dir/'\\''\\${base_file}'\\''i; echo \\$dlname'\\''`~\n      dldir=$destdir/`dirname \\$dlpath`~\n      test -d \\$dldir || mkdir -p \\$dldir~\n      $install_prog $dir/$dlname \\$dldir/$dlname~\n      chmod a+x \\$dldir/$dlname~\n      if test -n '\\''$stripme'\\'' && test -n '\\''$striplib'\\''; then\n        eval '\\''$striplib \\$dldir/$dlname'\\'' || exit \\$?;\n      fi'\n    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\\''. $file; echo \\$dlname'\\''`~\n      dlpath=$dir/\\$dldll~\n       $RM \\$dlpath'\n    shlibpath_overrides_runpath=yes\n\n    case $host_os in\n    cygwin*)\n      # Cygwin DLLs use 'cyg' prefix rather than 'lib'\n      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'\n      sys_lib_search_path_spec=\"/usr/lib /lib/w32api /lib /usr/local/lib\"\n      ;;\n    mingw* | cegcc*)\n      # MinGW DLLs use traditional 'lib' prefix\n      soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'\n      sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP \"^libraries:\" | $SED -e \"s/^libraries://\" -e \"s,=/,/,g\"`\n      if $ECHO \"$sys_lib_search_path_spec\" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then\n        # It is most probably a Windows format PATH printed by\n        # mingw gcc, but we are running on Cygwin. Gcc prints its search\n        # path with ; separators, and with drive letters. We can handle the\n        # drive letters (cygwin fileutils understands them), so leave them,\n        # especially as we might pass files found there to a mingw objdump,\n        # which wouldn't understand a cygwinified path. Ahh.\n        sys_lib_search_path_spec=`$ECHO \"$sys_lib_search_path_spec\" | $SED -e 's/;/ /g'`\n      else\n        sys_lib_search_path_spec=`$ECHO \"$sys_lib_search_path_spec\" | $SED  -e \"s/$PATH_SEPARATOR/ /g\"`\n      fi\n      ;;\n    pw32*)\n      # pw32 DLLs use 'pw' prefix rather than 'lib'\n      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'\n      ;;\n    esac\n    ;;\n\n  *)\n    library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib'\n    ;;\n  esac\n  dynamic_linker='Win32 ld.exe'\n  # FIXME: first we should search . and the directory the executable is in\n  shlibpath_var=PATH\n  ;;\n\ndarwin* | rhapsody*)\n  dynamic_linker=\"$host_os dyld\"\n  version_type=darwin\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'\n  soname_spec='${libname}${release}${major}$shared_ext'\n  shlibpath_overrides_runpath=yes\n  shlibpath_var=DYLD_LIBRARY_PATH\n  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'\nm4_if([$1], [],[\n  sys_lib_search_path_spec=\"$sys_lib_search_path_spec /usr/local/lib\"])\n  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'\n  ;;\n\ndgux*)\n  version_type=linux\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LD_LIBRARY_PATH\n  ;;\n\nfreebsd1*)\n  dynamic_linker=no\n  ;;\n\nfreebsd* | dragonfly*)\n  # DragonFly does not have aout.  When/if they implement a new\n  # versioning mechanism, adjust this.\n  if test -x /usr/bin/objformat; then\n    objformat=`/usr/bin/objformat`\n  else\n    case $host_os in\n    freebsd[[123]]*) objformat=aout ;;\n    *) objformat=elf ;;\n    esac\n  fi\n  version_type=freebsd-$objformat\n  case $version_type in\n    freebsd-elf*)\n      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'\n      need_version=no\n      need_lib_prefix=no\n      ;;\n    freebsd-*)\n      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'\n      need_version=yes\n      ;;\n  esac\n  shlibpath_var=LD_LIBRARY_PATH\n  case $host_os in\n  freebsd2*)\n    shlibpath_overrides_runpath=yes\n    ;;\n  freebsd3.[[01]]* | freebsdelf3.[[01]]*)\n    shlibpath_overrides_runpath=yes\n    hardcode_into_libs=yes\n    ;;\n  freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \\\n  freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1)\n    shlibpath_overrides_runpath=no\n    hardcode_into_libs=yes\n    ;;\n  *) # from 4.6 on, and DragonFly\n    shlibpath_overrides_runpath=yes\n    hardcode_into_libs=yes\n    ;;\n  esac\n  ;;\n\ngnu*)\n  version_type=linux\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LD_LIBRARY_PATH\n  hardcode_into_libs=yes\n  ;;\n\nhpux9* | hpux10* | hpux11*)\n  # Give a soname corresponding to the major version so that dld.sl refuses to\n  # link against other versions.\n  version_type=sunos\n  need_lib_prefix=no\n  need_version=no\n  case $host_cpu in\n  ia64*)\n    shrext_cmds='.so'\n    hardcode_into_libs=yes\n    dynamic_linker=\"$host_os dld.so\"\n    shlibpath_var=LD_LIBRARY_PATH\n    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.\n    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n    soname_spec='${libname}${release}${shared_ext}$major'\n    if test \"X$HPUX_IA64_MODE\" = X32; then\n      sys_lib_search_path_spec=\"/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib\"\n    else\n      sys_lib_search_path_spec=\"/usr/lib/hpux64 /usr/local/lib/hpux64\"\n    fi\n    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec\n    ;;\n  hppa*64*)\n    shrext_cmds='.sl'\n    hardcode_into_libs=yes\n    dynamic_linker=\"$host_os dld.sl\"\n    shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH\n    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.\n    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n    soname_spec='${libname}${release}${shared_ext}$major'\n    sys_lib_search_path_spec=\"/usr/lib/pa20_64 /usr/ccs/lib/pa20_64\"\n    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec\n    ;;\n  *)\n    shrext_cmds='.sl'\n    dynamic_linker=\"$host_os dld.sl\"\n    shlibpath_var=SHLIB_PATH\n    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH\n    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n    soname_spec='${libname}${release}${shared_ext}$major'\n    ;;\n  esac\n  # HP-UX runs *really* slowly unless shared libraries are mode 555.\n  postinstall_cmds='chmod 555 $lib'\n  ;;\n\ninterix[[3-9]]*)\n  version_type=linux\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=no\n  hardcode_into_libs=yes\n  ;;\n\nirix5* | irix6* | nonstopux*)\n  case $host_os in\n    nonstopux*) version_type=nonstopux ;;\n    *)\n\tif test \"$lt_cv_prog_gnu_ld\" = yes; then\n\t\tversion_type=linux\n\telse\n\t\tversion_type=irix\n\tfi ;;\n  esac\n  need_lib_prefix=no\n  need_version=no\n  soname_spec='${libname}${release}${shared_ext}$major'\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'\n  case $host_os in\n  irix5* | nonstopux*)\n    libsuff= shlibsuff=\n    ;;\n  *)\n    case $LD in # libtool.m4 will add one of these switches to LD\n    *-32|*\"-32 \"|*-melf32bsmip|*\"-melf32bsmip \")\n      libsuff= shlibsuff= libmagic=32-bit;;\n    *-n32|*\"-n32 \"|*-melf32bmipn32|*\"-melf32bmipn32 \")\n      libsuff=32 shlibsuff=N32 libmagic=N32;;\n    *-64|*\"-64 \"|*-melf64bmip|*\"-melf64bmip \")\n      libsuff=64 shlibsuff=64 libmagic=64-bit;;\n    *) libsuff= shlibsuff= libmagic=never-match;;\n    esac\n    ;;\n  esac\n  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH\n  shlibpath_overrides_runpath=no\n  sys_lib_search_path_spec=\"/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}\"\n  sys_lib_dlsearch_path_spec=\"/usr/lib${libsuff} /lib${libsuff}\"\n  hardcode_into_libs=yes\n  ;;\n\n# No shared lib support for Linux oldld, aout, or coff.\nlinux*oldld* | linux*aout* | linux*coff*)\n  dynamic_linker=no\n  ;;\n\n# This must be Linux ELF.\nlinux* | k*bsd*-gnu)\n  version_type=linux\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  finish_cmds='PATH=\"\\$PATH:/sbin\" ldconfig -n $libdir'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=no\n  # Some binutils ld are patched to set DT_RUNPATH\n  save_LDFLAGS=$LDFLAGS\n  save_libdir=$libdir\n  eval \"libdir=/foo; wl=\\\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\\\"; \\\n       LDFLAGS=\\\"\\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\\\"\"\n  AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],\n    [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep \"RUNPATH.*$libdir\" >/dev/null],\n       [shlibpath_overrides_runpath=yes])])\n  LDFLAGS=$save_LDFLAGS\n  libdir=$save_libdir\n\n  # This implies no fast_install, which is unacceptable.\n  # Some rework will be needed to allow for fast_install\n  # before this can be enabled.\n  hardcode_into_libs=yes\n\n  # Append ld.so.conf contents to the search path\n  if test -f /etc/ld.so.conf; then\n    lt_ld_extra=`awk '/^include / { system(sprintf(\"cd /etc; cat %s 2>/dev/null\", \\[$]2)); skip = 1; } { if (!skip) print \\[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[\t ]*hwcap[\t ]/d;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\\n' ' '`\n    sys_lib_dlsearch_path_spec=\"/lib /usr/lib $lt_ld_extra\"\n  fi\n\n  # We used to test for /lib/ld.so.1 and disable shared libraries on\n  # powerpc, because MkLinux only supported shared libraries with the\n  # GNU dynamic linker.  Since this was broken with cross compilers,\n  # most powerpc-linux boxes support dynamic linking these days and\n  # people can always --disable-shared, the test was removed, and we\n  # assume the GNU/Linux dynamic linker is in use.\n  dynamic_linker='GNU/Linux ld.so'\n  ;;\n\nnetbsd*)\n  version_type=sunos\n  need_lib_prefix=no\n  need_version=no\n  if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then\n    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'\n    finish_cmds='PATH=\"\\$PATH:/sbin\" ldconfig -m $libdir'\n    dynamic_linker='NetBSD (a.out) ld.so'\n  else\n    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'\n    soname_spec='${libname}${release}${shared_ext}$major'\n    dynamic_linker='NetBSD ld.elf_so'\n  fi\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=yes\n  hardcode_into_libs=yes\n  ;;\n\nnewsos6)\n  version_type=linux\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=yes\n  ;;\n\n*nto* | *qnx*)\n  version_type=qnx\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=no\n  hardcode_into_libs=yes\n  dynamic_linker='ldqnx.so'\n  ;;\n\nopenbsd*)\n  version_type=sunos\n  sys_lib_dlsearch_path_spec=\"/usr/lib\"\n  need_lib_prefix=no\n  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.\n  case $host_os in\n    openbsd3.3 | openbsd3.3.*)\tneed_version=yes ;;\n    *)\t\t\t\tneed_version=no  ;;\n  esac\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'\n  finish_cmds='PATH=\"\\$PATH:/sbin\" ldconfig -m $libdir'\n  shlibpath_var=LD_LIBRARY_PATH\n  if test -z \"`echo __ELF__ | $CC -E - | $GREP __ELF__`\" || test \"$host_os-$host_cpu\" = \"openbsd2.8-powerpc\"; then\n    case $host_os in\n      openbsd2.[[89]] | openbsd2.[[89]].*)\n\tshlibpath_overrides_runpath=no\n\t;;\n      *)\n\tshlibpath_overrides_runpath=yes\n\t;;\n      esac\n  else\n    shlibpath_overrides_runpath=yes\n  fi\n  ;;\n\nos2*)\n  libname_spec='$name'\n  shrext_cmds=\".dll\"\n  need_lib_prefix=no\n  library_names_spec='$libname${shared_ext} $libname.a'\n  dynamic_linker='OS/2 ld.exe'\n  shlibpath_var=LIBPATH\n  ;;\n\nosf3* | osf4* | osf5*)\n  version_type=osf\n  need_lib_prefix=no\n  need_version=no\n  soname_spec='${libname}${release}${shared_ext}$major'\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  shlibpath_var=LD_LIBRARY_PATH\n  sys_lib_search_path_spec=\"/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib\"\n  sys_lib_dlsearch_path_spec=\"$sys_lib_search_path_spec\"\n  ;;\n\nrdos*)\n  dynamic_linker=no\n  ;;\n\nsolaris*)\n  version_type=linux\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=yes\n  hardcode_into_libs=yes\n  # ldd complains unless libraries are executable\n  postinstall_cmds='chmod +x $lib'\n  ;;\n\nsunos4*)\n  version_type=sunos\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'\n  finish_cmds='PATH=\"\\$PATH:/usr/etc\" ldconfig $libdir'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=yes\n  if test \"$with_gnu_ld\" = yes; then\n    need_lib_prefix=no\n  fi\n  need_version=yes\n  ;;\n\nsysv4 | sysv4.3*)\n  version_type=linux\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LD_LIBRARY_PATH\n  case $host_vendor in\n    sni)\n      shlibpath_overrides_runpath=no\n      need_lib_prefix=no\n      runpath_var=LD_RUN_PATH\n      ;;\n    siemens)\n      need_lib_prefix=no\n      ;;\n    motorola)\n      need_lib_prefix=no\n      need_version=no\n      shlibpath_overrides_runpath=no\n      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'\n      ;;\n  esac\n  ;;\n\nsysv4*MP*)\n  if test -d /usr/nec ;then\n    version_type=linux\n    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'\n    soname_spec='$libname${shared_ext}.$major'\n    shlibpath_var=LD_LIBRARY_PATH\n  fi\n  ;;\n\nsysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)\n  version_type=freebsd-elf\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=yes\n  hardcode_into_libs=yes\n  if test \"$with_gnu_ld\" = yes; then\n    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'\n  else\n    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'\n    case $host_os in\n      sco3.2v5*)\n        sys_lib_search_path_spec=\"$sys_lib_search_path_spec /lib\"\n\t;;\n    esac\n  fi\n  sys_lib_dlsearch_path_spec='/usr/lib'\n  ;;\n\ntpf*)\n  # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.\n  version_type=linux\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=no\n  hardcode_into_libs=yes\n  ;;\n\nuts4*)\n  version_type=linux\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LD_LIBRARY_PATH\n  ;;\n\n*)\n  dynamic_linker=no\n  ;;\nesac\nAC_MSG_RESULT([$dynamic_linker])\ntest \"$dynamic_linker\" = no && can_build_shared=no\n\nvariables_saved_for_relink=\"PATH $shlibpath_var $runpath_var\"\nif test \"$GCC\" = yes; then\n  variables_saved_for_relink=\"$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH\"\nfi\n\nif test \"${lt_cv_sys_lib_search_path_spec+set}\" = set; then\n  sys_lib_search_path_spec=\"$lt_cv_sys_lib_search_path_spec\"\nfi\nif test \"${lt_cv_sys_lib_dlsearch_path_spec+set}\" = set; then\n  sys_lib_dlsearch_path_spec=\"$lt_cv_sys_lib_dlsearch_path_spec\"\nfi\n\n_LT_DECL([], [variables_saved_for_relink], [1],\n    [Variables whose values should be saved in libtool wrapper scripts and\n    restored at link time])\n_LT_DECL([], [need_lib_prefix], [0],\n    [Do we need the \"lib\" prefix for modules?])\n_LT_DECL([], [need_version], [0], [Do we need a version for libraries?])\n_LT_DECL([], [version_type], [0], [Library versioning type])\n_LT_DECL([], [runpath_var], [0],  [Shared library runtime path variable])\n_LT_DECL([], [shlibpath_var], [0],[Shared library path variable])\n_LT_DECL([], [shlibpath_overrides_runpath], [0],\n    [Is shlibpath searched before the hard-coded library search path?])\n_LT_DECL([], [libname_spec], [1], [Format of library name prefix])\n_LT_DECL([], [library_names_spec], [1],\n    [[List of archive names.  First name is the real one, the rest are links.\n    The last name is the one that the linker finds with -lNAME]])\n_LT_DECL([], [soname_spec], [1],\n    [[The coded name of the library, if different from the real name]])\n_LT_DECL([], [postinstall_cmds], [2],\n    [Command to use after installation of a shared archive])\n_LT_DECL([], [postuninstall_cmds], [2],\n    [Command to use after uninstallation of a shared archive])\n_LT_DECL([], [finish_cmds], [2],\n    [Commands used to finish a libtool library installation in a directory])\n_LT_DECL([], [finish_eval], [1],\n    [[As \"finish_cmds\", except a single script fragment to be evaled but\n    not shown]])\n_LT_DECL([], [hardcode_into_libs], [0],\n    [Whether we should hardcode library paths into libraries])\n_LT_DECL([], [sys_lib_search_path_spec], [2],\n    [Compile-time system search path for libraries])\n_LT_DECL([], [sys_lib_dlsearch_path_spec], [2],\n    [Run-time system search path for libraries])\n])# _LT_SYS_DYNAMIC_LINKER\n\n\n# _LT_PATH_TOOL_PREFIX(TOOL)\n# --------------------------\n# find a file program which can recognize shared library\nAC_DEFUN([_LT_PATH_TOOL_PREFIX],\n[m4_require([_LT_DECL_EGREP])dnl\nAC_MSG_CHECKING([for $1])\nAC_CACHE_VAL(lt_cv_path_MAGIC_CMD,\n[case $MAGIC_CMD in\n[[\\\\/*] |  ?:[\\\\/]*])\n  lt_cv_path_MAGIC_CMD=\"$MAGIC_CMD\" # Let the user override the test with a path.\n  ;;\n*)\n  lt_save_MAGIC_CMD=\"$MAGIC_CMD\"\n  lt_save_ifs=\"$IFS\"; IFS=$PATH_SEPARATOR\ndnl $ac_dummy forces splitting on constant user-supplied paths.\ndnl POSIX.2 word splitting is done only on the output of word expansions,\ndnl not every word.  This closes a longstanding sh security hole.\n  ac_dummy=\"m4_if([$2], , $PATH, [$2])\"\n  for ac_dir in $ac_dummy; do\n    IFS=\"$lt_save_ifs\"\n    test -z \"$ac_dir\" && ac_dir=.\n    if test -f $ac_dir/$1; then\n      lt_cv_path_MAGIC_CMD=\"$ac_dir/$1\"\n      if test -n \"$file_magic_test_file\"; then\n\tcase $deplibs_check_method in\n\t\"file_magic \"*)\n\t  file_magic_regex=`expr \"$deplibs_check_method\" : \"file_magic \\(.*\\)\"`\n\t  MAGIC_CMD=\"$lt_cv_path_MAGIC_CMD\"\n\t  if eval $file_magic_cmd \\$file_magic_test_file 2> /dev/null |\n\t    $EGREP \"$file_magic_regex\" > /dev/null; then\n\t    :\n\t  else\n\t    cat <<_LT_EOF 1>&2\n\n*** Warning: the command libtool uses to detect shared libraries,\n*** $file_magic_cmd, produces output that libtool cannot recognize.\n*** The result is that libtool may fail to recognize shared libraries\n*** as such.  This will affect the creation of libtool libraries that\n*** depend on shared libraries, but programs linked with such libtool\n*** libraries will work regardless of this problem.  Nevertheless, you\n*** may want to report the problem to your system manager and/or to\n*** bug-libtool@gnu.org\n\n_LT_EOF\n\t  fi ;;\n\tesac\n      fi\n      break\n    fi\n  done\n  IFS=\"$lt_save_ifs\"\n  MAGIC_CMD=\"$lt_save_MAGIC_CMD\"\n  ;;\nesac])\nMAGIC_CMD=\"$lt_cv_path_MAGIC_CMD\"\nif test -n \"$MAGIC_CMD\"; then\n  AC_MSG_RESULT($MAGIC_CMD)\nelse\n  AC_MSG_RESULT(no)\nfi\n_LT_DECL([], [MAGIC_CMD], [0],\n\t [Used to examine libraries when file_magic_cmd begins with \"file\"])dnl\n])# _LT_PATH_TOOL_PREFIX\n\n# Old name:\nAU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX])\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([AC_PATH_TOOL_PREFIX], [])\n\n\n# _LT_PATH_MAGIC\n# --------------\n# find a file program which can recognize a shared library\nm4_defun([_LT_PATH_MAGIC],\n[_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH)\nif test -z \"$lt_cv_path_MAGIC_CMD\"; then\n  if test -n \"$ac_tool_prefix\"; then\n    _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH)\n  else\n    MAGIC_CMD=:\n  fi\nfi\n])# _LT_PATH_MAGIC\n\n\n# LT_PATH_LD\n# ----------\n# find the pathname to the GNU or non-GNU linker\nAC_DEFUN([LT_PATH_LD],\n[AC_REQUIRE([AC_PROG_CC])dnl\nAC_REQUIRE([AC_CANONICAL_HOST])dnl\nAC_REQUIRE([AC_CANONICAL_BUILD])dnl\nm4_require([_LT_DECL_SED])dnl\nm4_require([_LT_DECL_EGREP])dnl\n\nAC_ARG_WITH([gnu-ld],\n    [AS_HELP_STRING([--with-gnu-ld],\n\t[assume the C compiler uses GNU ld @<:@default=no@:>@])],\n    [test \"$withval\" = no || with_gnu_ld=yes],\n    [with_gnu_ld=no])dnl\n\nac_prog=ld\nif test \"$GCC\" = yes; then\n  # Check if gcc -print-prog-name=ld gives a path.\n  AC_MSG_CHECKING([for ld used by $CC])\n  case $host in\n  *-*-mingw*)\n    # gcc leaves a trailing carriage return which upsets mingw\n    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\\015'` ;;\n  *)\n    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;\n  esac\n  case $ac_prog in\n    # Accept absolute paths.\n    [[\\\\/]]* | ?:[[\\\\/]]*)\n      re_direlt='/[[^/]][[^/]]*/\\.\\./'\n      # Canonicalize the pathname of ld\n      ac_prog=`$ECHO \"$ac_prog\"| $SED 's%\\\\\\\\%/%g'`\n      while $ECHO \"$ac_prog\" | $GREP \"$re_direlt\" > /dev/null 2>&1; do\n\tac_prog=`$ECHO $ac_prog| $SED \"s%$re_direlt%/%\"`\n      done\n      test -z \"$LD\" && LD=\"$ac_prog\"\n      ;;\n  \"\")\n    # If it fails, then pretend we aren't using GCC.\n    ac_prog=ld\n    ;;\n  *)\n    # If it is relative, then search for the first ld in PATH.\n    with_gnu_ld=unknown\n    ;;\n  esac\nelif test \"$with_gnu_ld\" = yes; then\n  AC_MSG_CHECKING([for GNU ld])\nelse\n  AC_MSG_CHECKING([for non-GNU ld])\nfi\nAC_CACHE_VAL(lt_cv_path_LD,\n[if test -z \"$LD\"; then\n  lt_save_ifs=\"$IFS\"; IFS=$PATH_SEPARATOR\n  for ac_dir in $PATH; do\n    IFS=\"$lt_save_ifs\"\n    test -z \"$ac_dir\" && ac_dir=.\n    if test -f \"$ac_dir/$ac_prog\" || test -f \"$ac_dir/$ac_prog$ac_exeext\"; then\n      lt_cv_path_LD=\"$ac_dir/$ac_prog\"\n      # Check to see if the program is GNU ld.  I'd rather use --version,\n      # but apparently some variants of GNU ld only accept -v.\n      # Break only if it was the GNU/non-GNU ld that we prefer.\n      case `\"$lt_cv_path_LD\" -v 2>&1 </dev/null` in\n      *GNU* | *'with BFD'*)\n\ttest \"$with_gnu_ld\" != no && break\n\t;;\n      *)\n\ttest \"$with_gnu_ld\" != yes && break\n\t;;\n      esac\n    fi\n  done\n  IFS=\"$lt_save_ifs\"\nelse\n  lt_cv_path_LD=\"$LD\" # Let the user override the test with a path.\nfi])\nLD=\"$lt_cv_path_LD\"\nif test -n \"$LD\"; then\n  AC_MSG_RESULT($LD)\nelse\n  AC_MSG_RESULT(no)\nfi\ntest -z \"$LD\" && AC_MSG_ERROR([no acceptable ld found in \\$PATH])\n_LT_PATH_LD_GNU\nAC_SUBST([LD])\n\n_LT_TAGDECL([], [LD], [1], [The linker used to build libraries])\n])# LT_PATH_LD\n\n# Old names:\nAU_ALIAS([AM_PROG_LD], [LT_PATH_LD])\nAU_ALIAS([AC_PROG_LD], [LT_PATH_LD])\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([AM_PROG_LD], [])\ndnl AC_DEFUN([AC_PROG_LD], [])\n\n\n# _LT_PATH_LD_GNU\n#- --------------\nm4_defun([_LT_PATH_LD_GNU],\n[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,\n[# I'd rather use --version here, but apparently some GNU lds only accept -v.\ncase `$LD -v 2>&1 </dev/null` in\n*GNU* | *'with BFD'*)\n  lt_cv_prog_gnu_ld=yes\n  ;;\n*)\n  lt_cv_prog_gnu_ld=no\n  ;;\nesac])\nwith_gnu_ld=$lt_cv_prog_gnu_ld\n])# _LT_PATH_LD_GNU\n\n\n# _LT_CMD_RELOAD\n# --------------\n# find reload flag for linker\n#   -- PORTME Some linkers may need a different reload flag.\nm4_defun([_LT_CMD_RELOAD],\n[AC_CACHE_CHECK([for $LD option to reload object files],\n  lt_cv_ld_reload_flag,\n  [lt_cv_ld_reload_flag='-r'])\nreload_flag=$lt_cv_ld_reload_flag\ncase $reload_flag in\n\"\" | \" \"*) ;;\n*) reload_flag=\" $reload_flag\" ;;\nesac\nreload_cmds='$LD$reload_flag -o $output$reload_objs'\ncase $host_os in\n  darwin*)\n    if test \"$GCC\" = yes; then\n      reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'\n    else\n      reload_cmds='$LD$reload_flag -o $output$reload_objs'\n    fi\n    ;;\nesac\n_LT_DECL([], [reload_flag], [1], [How to create reloadable object files])dnl\n_LT_DECL([], [reload_cmds], [2])dnl\n])# _LT_CMD_RELOAD\n\n\n# _LT_CHECK_MAGIC_METHOD\n# ----------------------\n# how to check for library dependencies\n#  -- PORTME fill in with the dynamic library characteristics\nm4_defun([_LT_CHECK_MAGIC_METHOD],\n[m4_require([_LT_DECL_EGREP])\nm4_require([_LT_DECL_OBJDUMP])\nAC_CACHE_CHECK([how to recognize dependent libraries],\nlt_cv_deplibs_check_method,\n[lt_cv_file_magic_cmd='$MAGIC_CMD'\nlt_cv_file_magic_test_file=\nlt_cv_deplibs_check_method='unknown'\n# Need to set the preceding variable on all platforms that support\n# interlibrary dependencies.\n# 'none' -- dependencies not supported.\n# `unknown' -- same as none, but documents that we really don't know.\n# 'pass_all' -- all dependencies passed with no checks.\n# 'test_compile' -- check by making test program.\n# 'file_magic [[regex]]' -- check by looking for files in library path\n# which responds to the $file_magic_cmd with a given extended regex.\n# If you have `file' or equivalent on your system and you're not sure\n# whether `pass_all' will *always* work, you probably want this one.\n\ncase $host_os in\naix[[4-9]]*)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\nbeos*)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\nbsdi[[45]]*)\n  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)'\n  lt_cv_file_magic_cmd='/usr/bin/file -L'\n  lt_cv_file_magic_test_file=/shlib/libc.so\n  ;;\n\ncygwin*)\n  # func_win32_libid is a shell function defined in ltmain.sh\n  lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'\n  lt_cv_file_magic_cmd='func_win32_libid'\n  ;;\n\nmingw* | pw32*)\n  # Base MSYS/MinGW do not provide the 'file' command needed by\n  # func_win32_libid shell function, so use a weaker test based on 'objdump',\n  # unless we find 'file', for example because we are cross-compiling.\n  if ( file / ) >/dev/null 2>&1; then\n    lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'\n    lt_cv_file_magic_cmd='func_win32_libid'\n  else\n    lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'\n    lt_cv_file_magic_cmd='$OBJDUMP -f'\n  fi\n  ;;\n\ncegcc)\n  # use the weaker test based on 'objdump'. See mingw*.\n  lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'\n  lt_cv_file_magic_cmd='$OBJDUMP -f'\n  ;;\n\ndarwin* | rhapsody*)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\nfreebsd* | dragonfly*)\n  if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then\n    case $host_cpu in\n    i*86 )\n      # Not sure whether the presence of OpenBSD here was a mistake.\n      # Let's accept both of them until this is cleared up.\n      lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library'\n      lt_cv_file_magic_cmd=/usr/bin/file\n      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`\n      ;;\n    esac\n  else\n    lt_cv_deplibs_check_method=pass_all\n  fi\n  ;;\n\ngnu*)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\nhpux10.20* | hpux11*)\n  lt_cv_file_magic_cmd=/usr/bin/file\n  case $host_cpu in\n  ia64*)\n    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64'\n    lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so\n    ;;\n  hppa*64*)\n    [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]']\n    lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl\n    ;;\n  *)\n    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library'\n    lt_cv_file_magic_test_file=/usr/lib/libc.sl\n    ;;\n  esac\n  ;;\n\ninterix[[3-9]]*)\n  # PIC code is broken on Interix 3.x, that's why |\\.a not |_pic\\.a here\n  lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\\.so|\\.a)$'\n  ;;\n\nirix5* | irix6* | nonstopux*)\n  case $LD in\n  *-32|*\"-32 \") libmagic=32-bit;;\n  *-n32|*\"-n32 \") libmagic=N32;;\n  *-64|*\"-64 \") libmagic=64-bit;;\n  *) libmagic=never-match;;\n  esac\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\n# This must be Linux ELF.\nlinux* | k*bsd*-gnu)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\nnetbsd*)\n  if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then\n    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\\.so\\.[[0-9]]+\\.[[0-9]]+|_pic\\.a)$'\n  else\n    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\\.so|_pic\\.a)$'\n  fi\n  ;;\n\nnewos6*)\n  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)'\n  lt_cv_file_magic_cmd=/usr/bin/file\n  lt_cv_file_magic_test_file=/usr/lib/libnls.so\n  ;;\n\n*nto* | *qnx*)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\nopenbsd*)\n  if test -z \"`echo __ELF__ | $CC -E - | $GREP __ELF__`\" || test \"$host_os-$host_cpu\" = \"openbsd2.8-powerpc\"; then\n    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\\.so\\.[[0-9]]+\\.[[0-9]]+|\\.so|_pic\\.a)$'\n  else\n    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\\.so\\.[[0-9]]+\\.[[0-9]]+|_pic\\.a)$'\n  fi\n  ;;\n\nosf3* | osf4* | osf5*)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\nrdos*)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\nsolaris*)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\nsysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\nsysv4 | sysv4.3*)\n  case $host_vendor in\n  motorola)\n    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]'\n    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`\n    ;;\n  ncr)\n    lt_cv_deplibs_check_method=pass_all\n    ;;\n  sequent)\n    lt_cv_file_magic_cmd='/bin/file'\n    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )'\n    ;;\n  sni)\n    lt_cv_file_magic_cmd='/bin/file'\n    lt_cv_deplibs_check_method=\"file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib\"\n    lt_cv_file_magic_test_file=/lib/libc.so\n    ;;\n  siemens)\n    lt_cv_deplibs_check_method=pass_all\n    ;;\n  pc)\n    lt_cv_deplibs_check_method=pass_all\n    ;;\n  esac\n  ;;\n\ntpf*)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\nesac\n])\nfile_magic_cmd=$lt_cv_file_magic_cmd\ndeplibs_check_method=$lt_cv_deplibs_check_method\ntest -z \"$deplibs_check_method\" && deplibs_check_method=unknown\n\n_LT_DECL([], [deplibs_check_method], [1],\n    [Method to check whether dependent libraries are shared objects])\n_LT_DECL([], [file_magic_cmd], [1],\n    [Command to use when deplibs_check_method == \"file_magic\"])\n])# _LT_CHECK_MAGIC_METHOD\n\n\n# LT_PATH_NM\n# ----------\n# find the pathname to a BSD- or MS-compatible name lister\nAC_DEFUN([LT_PATH_NM],\n[AC_REQUIRE([AC_PROG_CC])dnl\nAC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM,\n[if test -n \"$NM\"; then\n  # Let the user override the test.\n  lt_cv_path_NM=\"$NM\"\nelse\n  lt_nm_to_check=\"${ac_tool_prefix}nm\"\n  if test -n \"$ac_tool_prefix\" && test \"$build\" = \"$host\"; then\n    lt_nm_to_check=\"$lt_nm_to_check nm\"\n  fi\n  for lt_tmp_nm in $lt_nm_to_check; do\n    lt_save_ifs=\"$IFS\"; IFS=$PATH_SEPARATOR\n    for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do\n      IFS=\"$lt_save_ifs\"\n      test -z \"$ac_dir\" && ac_dir=.\n      tmp_nm=\"$ac_dir/$lt_tmp_nm\"\n      if test -f \"$tmp_nm\" || test -f \"$tmp_nm$ac_exeext\" ; then\n\t# Check to see if the nm accepts a BSD-compat flag.\n\t# Adding the `sed 1q' prevents false positives on HP-UX, which says:\n\t#   nm: unknown option \"B\" ignored\n\t# Tru64's nm complains that /dev/null is an invalid object file\n\tcase `\"$tmp_nm\" -B /dev/null 2>&1 | sed '1q'` in\n\t*/dev/null* | *'Invalid file or object type'*)\n\t  lt_cv_path_NM=\"$tmp_nm -B\"\n\t  break\n\t  ;;\n\t*)\n\t  case `\"$tmp_nm\" -p /dev/null 2>&1 | sed '1q'` in\n\t  */dev/null*)\n\t    lt_cv_path_NM=\"$tmp_nm -p\"\n\t    break\n\t    ;;\n\t  *)\n\t    lt_cv_path_NM=${lt_cv_path_NM=\"$tmp_nm\"} # keep the first match, but\n\t    continue # so that we can try to find one that supports BSD flags\n\t    ;;\n\t  esac\n\t  ;;\n\tesac\n      fi\n    done\n    IFS=\"$lt_save_ifs\"\n  done\n  : ${lt_cv_path_NM=no}\nfi])\nif test \"$lt_cv_path_NM\" != \"no\"; then\n  NM=\"$lt_cv_path_NM\"\nelse\n  # Didn't find any BSD compatible name lister, look for dumpbin.\n  AC_CHECK_TOOLS(DUMPBIN, [\"dumpbin -symbols\" \"link -dump -symbols\"], :)\n  AC_SUBST([DUMPBIN])\n  if test \"$DUMPBIN\" != \":\"; then\n    NM=\"$DUMPBIN\"\n  fi\nfi\ntest -z \"$NM\" && NM=nm\nAC_SUBST([NM])\n_LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl\n\nAC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface],\n  [lt_cv_nm_interface=\"BSD nm\"\n  echo \"int some_variable = 0;\" > conftest.$ac_ext\n  (eval echo \"\\\"\\$as_me:__oline__: $ac_compile\\\"\" >&AS_MESSAGE_LOG_FD)\n  (eval \"$ac_compile\" 2>conftest.err)\n  cat conftest.err >&AS_MESSAGE_LOG_FD\n  (eval echo \"\\\"\\$as_me:__oline__: $NM \\\\\\\"conftest.$ac_objext\\\\\\\"\\\"\" >&AS_MESSAGE_LOG_FD)\n  (eval \"$NM \\\"conftest.$ac_objext\\\"\" 2>conftest.err > conftest.out)\n  cat conftest.err >&AS_MESSAGE_LOG_FD\n  (eval echo \"\\\"\\$as_me:__oline__: output\\\"\" >&AS_MESSAGE_LOG_FD)\n  cat conftest.out >&AS_MESSAGE_LOG_FD\n  if $GREP 'External.*some_variable' conftest.out > /dev/null; then\n    lt_cv_nm_interface=\"MS dumpbin\"\n  fi\n  rm -f conftest*])\n])# LT_PATH_NM\n\n# Old names:\nAU_ALIAS([AM_PROG_NM], [LT_PATH_NM])\nAU_ALIAS([AC_PROG_NM], [LT_PATH_NM])\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([AM_PROG_NM], [])\ndnl AC_DEFUN([AC_PROG_NM], [])\n\n\n# LT_LIB_M\n# --------\n# check for math library\nAC_DEFUN([LT_LIB_M],\n[AC_REQUIRE([AC_CANONICAL_HOST])dnl\nLIBM=\ncase $host in\n*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*)\n  # These system don't have libm, or don't need it\n  ;;\n*-ncr-sysv4.3*)\n  AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM=\"-lmw\")\n  AC_CHECK_LIB(m, cos, LIBM=\"$LIBM -lm\")\n  ;;\n*)\n  AC_CHECK_LIB(m, cos, LIBM=\"-lm\")\n  ;;\nesac\nAC_SUBST([LIBM])\n])# LT_LIB_M\n\n# Old name:\nAU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M])\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([AC_CHECK_LIBM], [])\n\n\n# _LT_COMPILER_NO_RTTI([TAGNAME])\n# -------------------------------\nm4_defun([_LT_COMPILER_NO_RTTI],\n[m4_require([_LT_TAG_COMPILER])dnl\n\n_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=\n\nif test \"$GCC\" = yes; then\n  _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'\n\n  _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions],\n    lt_cv_prog_compiler_rtti_exceptions,\n    [-fno-rtti -fno-exceptions], [],\n    [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=\"$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions\"])\nfi\n_LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1],\n\t[Compiler flag to turn off builtin functions])\n])# _LT_COMPILER_NO_RTTI\n\n\n# _LT_CMD_GLOBAL_SYMBOLS\n# ----------------------\nm4_defun([_LT_CMD_GLOBAL_SYMBOLS],\n[AC_REQUIRE([AC_CANONICAL_HOST])dnl\nAC_REQUIRE([AC_PROG_CC])dnl\nAC_REQUIRE([LT_PATH_NM])dnl\nAC_REQUIRE([LT_PATH_LD])dnl\nm4_require([_LT_DECL_SED])dnl\nm4_require([_LT_DECL_EGREP])dnl\nm4_require([_LT_TAG_COMPILER])dnl\n\n# Check for command to grab the raw symbol name followed by C symbol from nm.\nAC_MSG_CHECKING([command to parse $NM output from $compiler object])\nAC_CACHE_VAL([lt_cv_sys_global_symbol_pipe],\n[\n# These are sane defaults that work on at least a few old systems.\n# [They come from Ultrix.  What could be older than Ultrix?!! ;)]\n\n# Character class describing NM global symbol codes.\nsymcode='[[BCDEGRST]]'\n\n# Regexp to match symbols that can be accessed directly from C.\nsympat='\\([[_A-Za-z]][[_A-Za-z0-9]]*\\)'\n\n# Define system-specific variables.\ncase $host_os in\naix*)\n  symcode='[[BCDT]]'\n  ;;\ncygwin* | mingw* | pw32* | cegcc*)\n  symcode='[[ABCDGISTW]]'\n  ;;\nhpux*)\n  if test \"$host_cpu\" = ia64; then\n    symcode='[[ABCDEGRST]]'\n  fi\n  ;;\nirix* | nonstopux*)\n  symcode='[[BCDEGRST]]'\n  ;;\nosf*)\n  symcode='[[BCDEGQRST]]'\n  ;;\nsolaris*)\n  symcode='[[BDRT]]'\n  ;;\nsco3.2v5*)\n  symcode='[[DT]]'\n  ;;\nsysv4.2uw2*)\n  symcode='[[DT]]'\n  ;;\nsysv5* | sco5v6* | unixware* | OpenUNIX*)\n  symcode='[[ABDT]]'\n  ;;\nsysv4)\n  symcode='[[DFNSTU]]'\n  ;;\nesac\n\n# If we're using GNU nm, then use its standard symbol codes.\ncase `$NM -V 2>&1` in\n*GNU* | *'with BFD'*)\n  symcode='[[ABCDGIRSTW]]' ;;\nesac\n\n# Transform an extracted symbol line into a proper C declaration.\n# Some systems (esp. on ia64) link data and code symbols differently,\n# so use this general approach.\nlt_cv_sys_global_symbol_to_cdecl=\"sed -n -e 's/^T .* \\(.*\\)$/extern int \\1();/p' -e 's/^$symcode* .* \\(.*\\)$/extern char \\1;/p'\"\n\n# Transform an extracted symbol line into symbol name and symbol address\nlt_cv_sys_global_symbol_to_c_name_address=\"sed -n -e 's/^: \\([[^ ]]*\\) $/  {\\\\\\\"\\1\\\\\\\", (void *) 0},/p' -e 's/^$symcode* \\([[^ ]]*\\) \\([[^ ]]*\\)$/  {\\\"\\2\\\", (void *) \\&\\2},/p'\"\nlt_cv_sys_global_symbol_to_c_name_address_lib_prefix=\"sed -n -e 's/^: \\([[^ ]]*\\) $/  {\\\\\\\"\\1\\\\\\\", (void *) 0},/p' -e 's/^$symcode* \\([[^ ]]*\\) \\(lib[[^ ]]*\\)$/  {\\\"\\2\\\", (void *) \\&\\2},/p' -e 's/^$symcode* \\([[^ ]]*\\) \\([[^ ]]*\\)$/  {\\\"lib\\2\\\", (void *) \\&\\2},/p'\"\n\n# Handle CRLF in mingw tool chain\nopt_cr=\ncase $build_os in\nmingw*)\n  opt_cr=`$ECHO 'x\\{0,1\\}' | tr x '\\015'` # option cr in regexp\n  ;;\nesac\n\n# Try without a prefix underscore, then with it.\nfor ac_symprfx in \"\" \"_\"; do\n\n  # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.\n  symxfrm=\"\\\\1 $ac_symprfx\\\\2 \\\\2\"\n\n  # Write the raw and C identifiers.\n  if test \"$lt_cv_nm_interface\" = \"MS dumpbin\"; then\n    # Fake it for dumpbin and say T for any non-static function\n    # and D for any global variable.\n    # Also find C++ and __fastcall symbols from MSVC++,\n    # which start with @ or ?.\n    lt_cv_sys_global_symbol_pipe=\"$AWK ['\"\\\n\"     {last_section=section; section=\\$ 3};\"\\\n\"     /Section length .*#relocs.*(pick any)/{hide[last_section]=1};\"\\\n\"     \\$ 0!~/External *\\|/{next};\"\\\n\"     / 0+ UNDEF /{next}; / UNDEF \\([^|]\\)*()/{next};\"\\\n\"     {if(hide[section]) next};\"\\\n\"     {f=0}; \\$ 0~/\\(\\).*\\|/{f=1}; {printf f ? \\\"T \\\" : \\\"D \\\"};\"\\\n\"     {split(\\$ 0, a, /\\||\\r/); split(a[2], s)};\"\\\n\"     s[1]~/^[@?]/{print s[1], s[1]; next};\"\\\n\"     s[1]~prfx {split(s[1],t,\\\"@\\\"); print t[1], substr(t[1],length(prfx))}\"\\\n\"     ' prfx=^$ac_symprfx]\"\n  else\n    lt_cv_sys_global_symbol_pipe=\"sed -n -e 's/^.*[[\t ]]\\($symcode$symcode*\\)[[\t ]][[\t ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'\"\n  fi\n\n  # Check to see that the pipe works correctly.\n  pipe_works=no\n\n  rm -f conftest*\n  cat > conftest.$ac_ext <<_LT_EOF\n#ifdef __cplusplus\nextern \"C\" {\n#endif\nchar nm_test_var;\nvoid nm_test_func(void);\nvoid nm_test_func(void){}\n#ifdef __cplusplus\n}\n#endif\nint main(){nm_test_var='a';nm_test_func();return(0);}\n_LT_EOF\n\n  if AC_TRY_EVAL(ac_compile); then\n    # Now try to grab the symbols.\n    nlist=conftest.nm\n    if AC_TRY_EVAL(NM conftest.$ac_objext \\| $lt_cv_sys_global_symbol_pipe \\> $nlist) && test -s \"$nlist\"; then\n      # Try sorting and uniquifying the output.\n      if sort \"$nlist\" | uniq > \"$nlist\"T; then\n\tmv -f \"$nlist\"T \"$nlist\"\n      else\n\trm -f \"$nlist\"T\n      fi\n\n      # Make sure that we snagged all the symbols we need.\n      if $GREP ' nm_test_var$' \"$nlist\" >/dev/null; then\n\tif $GREP ' nm_test_func$' \"$nlist\" >/dev/null; then\n\t  cat <<_LT_EOF > conftest.$ac_ext\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n_LT_EOF\n\t  # Now generate the symbol file.\n\t  eval \"$lt_cv_sys_global_symbol_to_cdecl\"' < \"$nlist\" | $GREP -v main >> conftest.$ac_ext'\n\n\t  cat <<_LT_EOF >> conftest.$ac_ext\n\n/* The mapping between symbol names and symbols.  */\nconst struct {\n  const char *name;\n  void       *address;\n}\nlt__PROGRAM__LTX_preloaded_symbols[[]] =\n{\n  { \"@PROGRAM@\", (void *) 0 },\n_LT_EOF\n\t  $SED \"s/^$symcode$symcode* \\(.*\\) \\(.*\\)$/  {\\\"\\2\\\", (void *) \\&\\2},/\" < \"$nlist\" | $GREP -v main >> conftest.$ac_ext\n\t  cat <<\\_LT_EOF >> conftest.$ac_ext\n  {0, (void *) 0}\n};\n\n/* This works around a problem in FreeBSD linker */\n#ifdef FREEBSD_WORKAROUND\nstatic const void *lt_preloaded_setup() {\n  return lt__PROGRAM__LTX_preloaded_symbols;\n}\n#endif\n\n#ifdef __cplusplus\n}\n#endif\n_LT_EOF\n\t  # Now try linking the two files.\n\t  mv conftest.$ac_objext conftstm.$ac_objext\n\t  lt_save_LIBS=\"$LIBS\"\n\t  lt_save_CFLAGS=\"$CFLAGS\"\n\t  LIBS=\"conftstm.$ac_objext\"\n\t  CFLAGS=\"$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)\"\n\t  if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then\n\t    pipe_works=yes\n\t  fi\n\t  LIBS=\"$lt_save_LIBS\"\n\t  CFLAGS=\"$lt_save_CFLAGS\"\n\telse\n\t  echo \"cannot find nm_test_func in $nlist\" >&AS_MESSAGE_LOG_FD\n\tfi\n      else\n\techo \"cannot find nm_test_var in $nlist\" >&AS_MESSAGE_LOG_FD\n      fi\n    else\n      echo \"cannot run $lt_cv_sys_global_symbol_pipe\" >&AS_MESSAGE_LOG_FD\n    fi\n  else\n    echo \"$progname: failed program was:\" >&AS_MESSAGE_LOG_FD\n    cat conftest.$ac_ext >&5\n  fi\n  rm -rf conftest* conftst*\n\n  # Do not use the global_symbol_pipe unless it works.\n  if test \"$pipe_works\" = yes; then\n    break\n  else\n    lt_cv_sys_global_symbol_pipe=\n  fi\ndone\n])\nif test -z \"$lt_cv_sys_global_symbol_pipe\"; then\n  lt_cv_sys_global_symbol_to_cdecl=\nfi\nif test -z \"$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl\"; then\n  AC_MSG_RESULT(failed)\nelse\n  AC_MSG_RESULT(ok)\nfi\n\n_LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1],\n    [Take the output of nm and produce a listing of raw symbols and C names])\n_LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1],\n    [Transform the output of nm in a proper C declaration])\n_LT_DECL([global_symbol_to_c_name_address],\n    [lt_cv_sys_global_symbol_to_c_name_address], [1],\n    [Transform the output of nm in a C name address pair])\n_LT_DECL([global_symbol_to_c_name_address_lib_prefix],\n    [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1],\n    [Transform the output of nm in a C name address pair when lib prefix is needed])\n]) # _LT_CMD_GLOBAL_SYMBOLS\n\n\n# _LT_COMPILER_PIC([TAGNAME])\n# ---------------------------\nm4_defun([_LT_COMPILER_PIC],\n[m4_require([_LT_TAG_COMPILER])dnl\n_LT_TAGVAR(lt_prog_compiler_wl, $1)=\n_LT_TAGVAR(lt_prog_compiler_pic, $1)=\n_LT_TAGVAR(lt_prog_compiler_static, $1)=\n\nAC_MSG_CHECKING([for $compiler option to produce PIC])\nm4_if([$1], [CXX], [\n  # C++ specific cases for pic, static, wl, etc.\n  if test \"$GXX\" = yes; then\n    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'\n\n    case $host_os in\n    aix*)\n      # All AIX code is PIC.\n      if test \"$host_cpu\" = ia64; then\n\t# AIX 5 now supports IA64 processor\n\t_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n      fi\n      ;;\n\n    amigaos*)\n      case $host_cpu in\n      powerpc)\n            # see comment about AmigaOS4 .so support\n            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'\n        ;;\n      m68k)\n            # FIXME: we need at least 68020 code to build shared libraries, but\n            # adding the `-m68020' flag to GCC prevents building anything better,\n            # like `-m68040'.\n            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'\n        ;;\n      esac\n      ;;\n\n    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)\n      # PIC is the default for these OSes.\n      ;;\n    mingw* | cygwin* | os2* | pw32* | cegcc*)\n      # This hack is so that the source file can tell whether it is being\n      # built for inclusion in a dll (and should export symbols for example).\n      # Although the cygwin gcc ignores -fPIC, still need this for old-style\n      # (--disable-auto-import) libraries\n      m4_if([$1], [GCJ], [],\n\t[_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])\n      ;;\n    darwin* | rhapsody*)\n      # PIC is the default on this platform\n      # Common symbols not allowed in MH_DYLIB files\n      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'\n      ;;\n    *djgpp*)\n      # DJGPP does not support shared libraries at all\n      _LT_TAGVAR(lt_prog_compiler_pic, $1)=\n      ;;\n    interix[[3-9]]*)\n      # Interix 3.x gcc -fpic/-fPIC options generate broken code.\n      # Instead, we relocate shared libraries at runtime.\n      ;;\n    sysv4*MP*)\n      if test -d /usr/nec; then\n\t_LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic\n      fi\n      ;;\n    hpux*)\n      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit\n      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag\n      # sets the default TLS model and affects inlining.\n      case $host_cpu in\n      hppa*64*)\n\t;;\n      *)\n\t_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'\n\t;;\n      esac\n      ;;\n    *qnx* | *nto*)\n      # QNX uses GNU C++, but need to define -shared option too, otherwise\n      # it will coredump.\n      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'\n      ;;\n    *)\n      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'\n      ;;\n    esac\n  else\n    case $host_os in\n      aix[[4-9]]*)\n\t# All AIX code is PIC.\n\tif test \"$host_cpu\" = ia64; then\n\t  # AIX 5 now supports IA64 processor\n\t  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n\telse\n\t  _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'\n\tfi\n\t;;\n      chorus*)\n\tcase $cc_basename in\n\tcxch68*)\n\t  # Green Hills C++ Compiler\n\t  # _LT_TAGVAR(lt_prog_compiler_static, $1)=\"--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a\"\n\t  ;;\n\tesac\n\t;;\n      dgux*)\n\tcase $cc_basename in\n\t  ec++*)\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'\n\t    ;;\n\t  ghcx*)\n\t    # Green Hills C++ Compiler\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'\n\t    ;;\n\t  *)\n\t    ;;\n\tesac\n\t;;\n      freebsd* | dragonfly*)\n\t# FreeBSD uses GNU C++\n\t;;\n      hpux9* | hpux10* | hpux11*)\n\tcase $cc_basename in\n\t  CC*)\n\t    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n\t    _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'\n\t    if test \"$host_cpu\" != ia64; then\n\t      _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'\n\t    fi\n\t    ;;\n\t  aCC*)\n\t    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n\t    _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'\n\t    case $host_cpu in\n\t    hppa*64*|ia64*)\n\t      # +Z the default\n\t      ;;\n\t    *)\n\t      _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'\n\t      ;;\n\t    esac\n\t    ;;\n\t  *)\n\t    ;;\n\tesac\n\t;;\n      interix*)\n\t# This is c89, which is MS Visual C++ (no shared libs)\n\t# Anyone wants to do a port?\n\t;;\n      irix5* | irix6* | nonstopux*)\n\tcase $cc_basename in\n\t  CC*)\n\t    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n\t    _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'\n\t    # CC pic flag -KPIC is the default.\n\t    ;;\n\t  *)\n\t    ;;\n\tesac\n\t;;\n      linux* | k*bsd*-gnu)\n\tcase $cc_basename in\n\t  KCC*)\n\t    # KAI C++ Compiler\n\t    _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'\n\t    ;;\n\t  ecpc* )\n\t    # old Intel C++ for x86_64 which still supported -KPIC.\n\t    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'\n\t    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'\n\t    ;;\n\t  icpc* )\n\t    # Intel C++, used to be incompatible with GCC.\n\t    # ICC 10 doesn't accept -KPIC any more.\n\t    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'\n\t    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'\n\t    ;;\n\t  pgCC* | pgcpp*)\n\t    # Portland Group C++ compiler\n\t    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'\n\t    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n\t    ;;\n\t  cxx*)\n\t    # Compaq C++\n\t    # Make sure the PIC flag is empty.  It appears that all Alpha\n\t    # Linux and Compaq Tru64 Unix objects are PIC.\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)=\n\t    _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'\n\t    ;;\n\t  xlc* | xlC*)\n\t    # IBM XL 8.0 on PPC\n\t    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'\n\t    _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'\n\t    ;;\n\t  *)\n\t    case `$CC -V 2>&1 | sed 5q` in\n\t    *Sun\\ C*)\n\t      # Sun C++ 5.9\n\t      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'\n\t      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n\t      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '\n\t      ;;\n\t    esac\n\t    ;;\n\tesac\n\t;;\n      lynxos*)\n\t;;\n      m88k*)\n\t;;\n      mvs*)\n\tcase $cc_basename in\n\t  cxx*)\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall'\n\t    ;;\n\t  *)\n\t    ;;\n\tesac\n\t;;\n      netbsd*)\n\t;;\n      *qnx* | *nto*)\n        # QNX uses GNU C++, but need to define -shared option too, otherwise\n        # it will coredump.\n        _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'\n        ;;\n      osf3* | osf4* | osf5*)\n\tcase $cc_basename in\n\t  KCC*)\n\t    _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'\n\t    ;;\n\t  RCC*)\n\t    # Rational C++ 2.4.1\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'\n\t    ;;\n\t  cxx*)\n\t    # Digital/Compaq C++\n\t    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n\t    # Make sure the PIC flag is empty.  It appears that all Alpha\n\t    # Linux and Compaq Tru64 Unix objects are PIC.\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)=\n\t    _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'\n\t    ;;\n\t  *)\n\t    ;;\n\tesac\n\t;;\n      psos*)\n\t;;\n      solaris*)\n\tcase $cc_basename in\n\t  CC*)\n\t    # Sun C++ 4.2, 5.x and Centerline C++\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'\n\t    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n\t    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '\n\t    ;;\n\t  gcx*)\n\t    # Green Hills C++ Compiler\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'\n\t    ;;\n\t  *)\n\t    ;;\n\tesac\n\t;;\n      sunos4*)\n\tcase $cc_basename in\n\t  CC*)\n\t    # Sun C++ 4.x\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'\n\t    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n\t    ;;\n\t  lcc*)\n\t    # Lucid\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'\n\t    ;;\n\t  *)\n\t    ;;\n\tesac\n\t;;\n      sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)\n\tcase $cc_basename in\n\t  CC*)\n\t    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'\n\t    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n\t    ;;\n\tesac\n\t;;\n      tandem*)\n\tcase $cc_basename in\n\t  NCC*)\n\t    # NonStop-UX NCC 3.20\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'\n\t    ;;\n\t  *)\n\t    ;;\n\tesac\n\t;;\n      vxworks*)\n\t;;\n      *)\n\t_LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no\n\t;;\n    esac\n  fi\n],\n[\n  if test \"$GCC\" = yes; then\n    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'\n\n    case $host_os in\n      aix*)\n      # All AIX code is PIC.\n      if test \"$host_cpu\" = ia64; then\n\t# AIX 5 now supports IA64 processor\n\t_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n      fi\n      ;;\n\n    amigaos*)\n      case $host_cpu in\n      powerpc)\n            # see comment about AmigaOS4 .so support\n            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'\n        ;;\n      m68k)\n            # FIXME: we need at least 68020 code to build shared libraries, but\n            # adding the `-m68020' flag to GCC prevents building anything better,\n            # like `-m68040'.\n            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'\n        ;;\n      esac\n      ;;\n\n    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)\n      # PIC is the default for these OSes.\n      ;;\n\n    mingw* | cygwin* | pw32* | os2* | cegcc*)\n      # This hack is so that the source file can tell whether it is being\n      # built for inclusion in a dll (and should export symbols for example).\n      # Although the cygwin gcc ignores -fPIC, still need this for old-style\n      # (--disable-auto-import) libraries\n      m4_if([$1], [GCJ], [],\n\t[_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])\n      ;;\n\n    darwin* | rhapsody*)\n      # PIC is the default on this platform\n      # Common symbols not allowed in MH_DYLIB files\n      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'\n      ;;\n\n    hpux*)\n      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit\n      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag\n      # sets the default TLS model and affects inlining.\n      case $host_cpu in\n      hppa*64*)\n\t# +Z the default\n\t;;\n      *)\n\t_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'\n\t;;\n      esac\n      ;;\n\n    interix[[3-9]]*)\n      # Interix 3.x gcc -fpic/-fPIC options generate broken code.\n      # Instead, we relocate shared libraries at runtime.\n      ;;\n\n    msdosdjgpp*)\n      # Just because we use GCC doesn't mean we suddenly get shared libraries\n      # on systems that don't support them.\n      _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no\n      enable_shared=no\n      ;;\n\n    *nto* | *qnx*)\n      # QNX uses GNU C++, but need to define -shared option too, otherwise\n      # it will coredump.\n      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'\n      ;;\n\n    sysv4*MP*)\n      if test -d /usr/nec; then\n\t_LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic\n      fi\n      ;;\n\n    *)\n      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'\n      ;;\n    esac\n  else\n    # PORTME Check for flag to pass linker flags through the system compiler.\n    case $host_os in\n    aix*)\n      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n      if test \"$host_cpu\" = ia64; then\n\t# AIX 5 now supports IA64 processor\n\t_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n      else\n\t_LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'\n      fi\n      ;;\n\n    mingw* | cygwin* | pw32* | os2* | cegcc*)\n      # This hack is so that the source file can tell whether it is being\n      # built for inclusion in a dll (and should export symbols for example).\n      m4_if([$1], [GCJ], [],\n\t[_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])\n      ;;\n\n    hpux9* | hpux10* | hpux11*)\n      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but\n      # not for PA HP-UX.\n      case $host_cpu in\n      hppa*64*|ia64*)\n\t# +Z the default\n\t;;\n      *)\n\t_LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'\n\t;;\n      esac\n      # Is there a better lt_prog_compiler_static that works with the bundled CC?\n      _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'\n      ;;\n\n    irix5* | irix6* | nonstopux*)\n      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n      # PIC (with -KPIC) is the default.\n      _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'\n      ;;\n\n    linux* | k*bsd*-gnu)\n      case $cc_basename in\n      # old Intel for x86_64 which still supported -KPIC.\n      ecc*)\n\t_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n\t_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'\n\t_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'\n        ;;\n      # icc used to be incompatible with GCC.\n      # ICC 10 doesn't accept -KPIC any more.\n      icc* | ifort*)\n\t_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n\t_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'\n\t_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'\n        ;;\n      # Lahey Fortran 8.1.\n      lf95*)\n\t_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n\t_LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared'\n\t_LT_TAGVAR(lt_prog_compiler_static, $1)='--static'\n\t;;\n      pgcc* | pgf77* | pgf90* | pgf95*)\n        # Portland Group compilers (*not* the Pentium gcc compiler,\n\t# which looks to be a dead project)\n\t_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n\t_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'\n\t_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n        ;;\n      ccc*)\n        _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n        # All Alpha code is PIC.\n        _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'\n        ;;\n      xl*)\n\t# IBM XL C 8.0/Fortran 10.1 on PPC\n\t_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n\t_LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'\n\t_LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'\n\t;;\n      *)\n\tcase `$CC -V 2>&1 | sed 5q` in\n\t*Sun\\ C*)\n\t  # Sun C 5.9\n\t  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'\n\t  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n\t  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n\t  ;;\n\t*Sun\\ F*)\n\t  # Sun Fortran 8.3 passes all unrecognized flags to the linker\n\t  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'\n\t  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n\t  _LT_TAGVAR(lt_prog_compiler_wl, $1)=''\n\t  ;;\n\tesac\n\t;;\n      esac\n      ;;\n\n    newsos6)\n      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'\n      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n      ;;\n\n    *nto* | *qnx*)\n      # QNX uses GNU C++, but need to define -shared option too, otherwise\n      # it will coredump.\n      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'\n      ;;\n\n    osf3* | osf4* | osf5*)\n      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n      # All OSF/1 code is PIC.\n      _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'\n      ;;\n\n    rdos*)\n      _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'\n      ;;\n\n    solaris*)\n      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'\n      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n      case $cc_basename in\n      f77* | f90* | f95*)\n\t_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';;\n      *)\n\t_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';;\n      esac\n      ;;\n\n    sunos4*)\n      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '\n      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'\n      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n      ;;\n\n    sysv4 | sysv4.2uw2* | sysv4.3*)\n      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'\n      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n      ;;\n\n    sysv4*MP*)\n      if test -d /usr/nec ;then\n\t_LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic'\n\t_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n      fi\n      ;;\n\n    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)\n      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'\n      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n      ;;\n\n    unicos*)\n      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n      _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no\n      ;;\n\n    uts4*)\n      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'\n      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n      ;;\n\n    *)\n      _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no\n      ;;\n    esac\n  fi\n])\ncase $host_os in\n  # For platforms which do not support PIC, -DPIC is meaningless:\n  *djgpp*)\n    _LT_TAGVAR(lt_prog_compiler_pic, $1)=\n    ;;\n  *)\n    _LT_TAGVAR(lt_prog_compiler_pic, $1)=\"$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])\"\n    ;;\nesac\nAC_MSG_RESULT([$_LT_TAGVAR(lt_prog_compiler_pic, $1)])\n_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1],\n\t[How to pass a linker flag through the compiler])\n\n#\n# Check to make sure the PIC flag actually works.\n#\nif test -n \"$_LT_TAGVAR(lt_prog_compiler_pic, $1)\"; then\n  _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works],\n    [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)],\n    [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [],\n    [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in\n     \"\" | \" \"*) ;;\n     *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=\" $_LT_TAGVAR(lt_prog_compiler_pic, $1)\" ;;\n     esac],\n    [_LT_TAGVAR(lt_prog_compiler_pic, $1)=\n     _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no])\nfi\n_LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1],\n\t[Additional compiler flags for building library objects])\n\n#\n# Check to make sure the static flag actually works.\n#\nwl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\\\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\\\"\n_LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works],\n  _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1),\n  $lt_tmp_static_flag,\n  [],\n  [_LT_TAGVAR(lt_prog_compiler_static, $1)=])\n_LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1],\n\t[Compiler flag to prevent dynamic linking])\n])# _LT_COMPILER_PIC\n\n\n# _LT_LINKER_SHLIBS([TAGNAME])\n# ----------------------------\n# See if the linker supports building shared libraries.\nm4_defun([_LT_LINKER_SHLIBS],\n[AC_REQUIRE([LT_PATH_LD])dnl\nAC_REQUIRE([LT_PATH_NM])dnl\nm4_require([_LT_FILEUTILS_DEFAULTS])dnl\nm4_require([_LT_DECL_EGREP])dnl\nm4_require([_LT_DECL_SED])dnl\nm4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl\nm4_require([_LT_TAG_COMPILER])dnl\nAC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])\nm4_if([$1], [CXX], [\n  _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\\''s/.* //'\\'' | sort | uniq > $export_symbols'\n  case $host_os in\n  aix[[4-9]]*)\n    # If we're using GNU nm, then we don't want the \"-C\" option.\n    # -C means demangle to AIX nm, but means don't demangle with GNU nm\n    if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then\n      _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\\''{ if (((\\$ 2 == \"T\") || (\\$ 2 == \"D\") || (\\$ 2 == \"B\")) && ([substr](\\$ 3,1,1) != \".\")) { print \\$ 3 } }'\\'' | sort -u > $export_symbols'\n    else\n      _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\\''{ if (((\\$ 2 == \"T\") || (\\$ 2 == \"D\") || (\\$ 2 == \"B\")) && ([substr](\\$ 3,1,1) != \".\")) { print \\$ 3 } }'\\'' | sort -u > $export_symbols'\n    fi\n    ;;\n  pw32*)\n    _LT_TAGVAR(export_symbols_cmds, $1)=\"$ltdll_cmds\"\n  ;;\n  cygwin* | mingw* | cegcc*)\n    _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\\([[^ ]]*\\)/\\1 DATA/;/^.*[[ ]]__nm__/s/^.*[[ ]]__nm__\\([[^ ]]*\\)[[ ]][[^ ]]*/\\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\\'' | sort | uniq > $export_symbols'\n  ;;\n  *)\n    _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\\''s/.* //'\\'' | sort | uniq > $export_symbols'\n  ;;\n  esac\n  _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']\n], [\n  runpath_var=\n  _LT_TAGVAR(allow_undefined_flag, $1)=\n  _LT_TAGVAR(always_export_symbols, $1)=no\n  _LT_TAGVAR(archive_cmds, $1)=\n  _LT_TAGVAR(archive_expsym_cmds, $1)=\n  _LT_TAGVAR(compiler_needs_object, $1)=no\n  _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no\n  _LT_TAGVAR(export_dynamic_flag_spec, $1)=\n  _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\\''s/.* //'\\'' | sort | uniq > $export_symbols'\n  _LT_TAGVAR(hardcode_automatic, $1)=no\n  _LT_TAGVAR(hardcode_direct, $1)=no\n  _LT_TAGVAR(hardcode_direct_absolute, $1)=no\n  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=\n  _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=\n  _LT_TAGVAR(hardcode_libdir_separator, $1)=\n  _LT_TAGVAR(hardcode_minus_L, $1)=no\n  _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported\n  _LT_TAGVAR(inherit_rpath, $1)=no\n  _LT_TAGVAR(link_all_deplibs, $1)=unknown\n  _LT_TAGVAR(module_cmds, $1)=\n  _LT_TAGVAR(module_expsym_cmds, $1)=\n  _LT_TAGVAR(old_archive_from_new_cmds, $1)=\n  _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)=\n  _LT_TAGVAR(thread_safe_flag_spec, $1)=\n  _LT_TAGVAR(whole_archive_flag_spec, $1)=\n  # include_expsyms should be a list of space-separated symbols to be *always*\n  # included in the symbol list\n  _LT_TAGVAR(include_expsyms, $1)=\n  # exclude_expsyms can be an extended regexp of symbols to exclude\n  # it will be wrapped by ` (' and `)$', so one must not match beginning or\n  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',\n  # as well as any symbol that contains `d'.\n  _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']\n  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out\n  # platforms (ab)use it in PIC code, but their linkers get confused if\n  # the symbol is explicitly referenced.  Since portable code cannot\n  # rely on this symbol name, it's probably fine to never include it in\n  # preloaded symbol tables.\n  # Exclude shared library initialization/finalization symbols.\ndnl Note also adjust exclude_expsyms for C++ above.\n  extract_expsyms_cmds=\n\n  case $host_os in\n  cygwin* | mingw* | pw32* | cegcc*)\n    # FIXME: the MSVC++ port hasn't been tested in a loooong time\n    # When not using gcc, we currently assume that we are using\n    # Microsoft Visual C++.\n    if test \"$GCC\" != yes; then\n      with_gnu_ld=no\n    fi\n    ;;\n  interix*)\n    # we just hope/assume this is gcc and not c89 (= MSVC++)\n    with_gnu_ld=yes\n    ;;\n  openbsd*)\n    with_gnu_ld=no\n    ;;\n  esac\n\n  _LT_TAGVAR(ld_shlibs, $1)=yes\n  if test \"$with_gnu_ld\" = yes; then\n    # If archive_cmds runs LD, not CC, wlarc should be empty\n    wlarc='${wl}'\n\n    # Set some defaults for GNU ld with shared library support. These\n    # are reset later if shared libraries are not supported. Putting them\n    # here allows them to be overridden if necessary.\n    runpath_var=LD_RUN_PATH\n    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'\n    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'\n    # ancient GNU ld didn't support --whole-archive et. al.\n    if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then\n      _LT_TAGVAR(whole_archive_flag_spec, $1)=\"$wlarc\"'--whole-archive$convenience '\"$wlarc\"'--no-whole-archive'\n    else\n      _LT_TAGVAR(whole_archive_flag_spec, $1)=\n    fi\n    supports_anon_versioning=no\n    case `$LD -v 2>&1` in\n      *\\ [[01]].* | *\\ 2.[[0-9]].* | *\\ 2.10.*) ;; # catch versions < 2.11\n      *\\ 2.11.93.0.2\\ *) supports_anon_versioning=yes ;; # RH7.3 ...\n      *\\ 2.11.92.0.12\\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...\n      *\\ 2.11.*) ;; # other 2.11 versions\n      *) supports_anon_versioning=yes ;;\n    esac\n\n    # See if GNU ld supports shared libraries.\n    case $host_os in\n    aix[[3-9]]*)\n      # On AIX/PPC, the GNU linker is very broken\n      if test \"$host_cpu\" != ia64; then\n\t_LT_TAGVAR(ld_shlibs, $1)=no\n\tcat <<_LT_EOF 1>&2\n\n*** Warning: the GNU linker, at least up to release 2.9.1, is reported\n*** to be unable to reliably create shared libraries on AIX.\n*** Therefore, libtool is disabling shared libraries support.  If you\n*** really care for shared libraries, you may want to modify your PATH\n*** so that a non-GNU linker is found, and then restart.\n\n_LT_EOF\n      fi\n      ;;\n\n    amigaos*)\n      case $host_cpu in\n      powerpc)\n            # see comment about AmigaOS4 .so support\n            _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n            _LT_TAGVAR(archive_expsym_cmds, $1)=''\n        ;;\n      m68k)\n            _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO \"#define NAME $libname\" > $output_objdir/a2ixlibrary.data~$ECHO \"#define LIBRARY_ID 1\" >> $output_objdir/a2ixlibrary.data~$ECHO \"#define VERSION $major\" >> $output_objdir/a2ixlibrary.data~$ECHO \"#define REVISION $revision\" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'\n            _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'\n            _LT_TAGVAR(hardcode_minus_L, $1)=yes\n        ;;\n      esac\n      ;;\n\n    beos*)\n      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then\n\t_LT_TAGVAR(allow_undefined_flag, $1)=unsupported\n\t# Joseph Beckenbach <jrb3@best.com> says some releases of gcc\n\t# support --undefined.  This deserves some investigation.  FIXME\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n      else\n\t_LT_TAGVAR(ld_shlibs, $1)=no\n      fi\n      ;;\n\n    cygwin* | mingw* | pw32* | cegcc*)\n      # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,\n      # as there is no search path for DLLs.\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'\n      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported\n      _LT_TAGVAR(always_export_symbols, $1)=no\n      _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes\n      _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\\([[^ ]]*\\)/\\1 DATA/'\\'' | $SED -e '\\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\\'' | sort | uniq > $export_symbols'\n\n      if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then\n        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'\n\t# If the export-symbols file already is a .def file (1st line\n\t# is EXPORTS), use it as is; otherwise, prepend...\n\t_LT_TAGVAR(archive_expsym_cmds, $1)='if test \"x`$SED 1q $export_symbols`\" = xEXPORTS; then\n\t  cp $export_symbols $output_objdir/$soname.def;\n\telse\n\t  echo EXPORTS > $output_objdir/$soname.def;\n\t  cat $export_symbols >> $output_objdir/$soname.def;\n\tfi~\n\t$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'\n      else\n\t_LT_TAGVAR(ld_shlibs, $1)=no\n      fi\n      ;;\n\n    interix[[3-9]]*)\n      _LT_TAGVAR(hardcode_direct, $1)=no\n      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'\n      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'\n      # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.\n      # Instead, shared libraries are loaded at an image base (0x10000000 by\n      # default) and relocated if they conflict, which is a slow very memory\n      # consuming and fragmenting process.  To avoid this, we pick a random,\n      # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link\n      # time.  Moving up from 0x10000000 also allows more sbrk(2) space.\n      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \\* 262144 + 1342177280` -o $lib'\n      _LT_TAGVAR(archive_expsym_cmds, $1)='sed \"s,^,_,\" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \\* 262144 + 1342177280` -o $lib'\n      ;;\n\n    gnu* | linux* | tpf* | k*bsd*-gnu)\n      tmp_diet=no\n      if test \"$host_os\" = linux-dietlibc; then\n\tcase $cc_basename in\n\t  diet\\ *) tmp_diet=yes;;\t# linux-dietlibc with static linking (!diet-dyn)\n\tesac\n      fi\n      if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \\\n\t && test \"$tmp_diet\" = no\n      then\n\ttmp_addflag=\n\ttmp_sharedflag='-shared'\n\tcase $cc_basename,$host_cpu in\n        pgcc*)\t\t\t\t# Portland Group C compiler\n\t  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\\\"\\\"; do test  -n \\\"$conv\\\" && new_convenience=\\\"$new_convenience,$conv\\\"; done; $ECHO \\\"$new_convenience\\\"` ${wl}--no-whole-archive'\n\t  tmp_addflag=' $pic_flag'\n\t  ;;\n\tpgf77* | pgf90* | pgf95*)\t# Portland Group f77 and f90 compilers\n\t  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\\\"\\\"; do test  -n \\\"$conv\\\" && new_convenience=\\\"$new_convenience,$conv\\\"; done; $ECHO \\\"$new_convenience\\\"` ${wl}--no-whole-archive'\n\t  tmp_addflag=' $pic_flag -Mnomain' ;;\n\tecc*,ia64* | icc*,ia64*)\t# Intel C compiler on ia64\n\t  tmp_addflag=' -i_dynamic' ;;\n\tefc*,ia64* | ifort*,ia64*)\t# Intel Fortran compiler on ia64\n\t  tmp_addflag=' -i_dynamic -nofor_main' ;;\n\tifc* | ifort*)\t\t\t# Intel Fortran compiler\n\t  tmp_addflag=' -nofor_main' ;;\n\tlf95*)\t\t\t\t# Lahey Fortran 8.1\n\t  _LT_TAGVAR(whole_archive_flag_spec, $1)=\n\t  tmp_sharedflag='--shared' ;;\n\txl[[cC]]*)\t\t\t# IBM XL C 8.0 on PPC (deal with xlf below)\n\t  tmp_sharedflag='-qmkshrobj'\n\t  tmp_addflag= ;;\n\tesac\n\tcase `$CC -V 2>&1 | sed 5q` in\n\t*Sun\\ C*)\t\t\t# Sun C 5.9\n\t  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\\\"\\\"; do test -z \\\"$conv\\\" || new_convenience=\\\"$new_convenience,$conv\\\"; done; $ECHO \\\"$new_convenience\\\"` ${wl}--no-whole-archive'\n\t  _LT_TAGVAR(compiler_needs_object, $1)=yes\n\t  tmp_sharedflag='-G' ;;\n\t*Sun\\ F*)\t\t\t# Sun Fortran 8.3\n\t  tmp_sharedflag='-G' ;;\n\tesac\n\t_LT_TAGVAR(archive_cmds, $1)='$CC '\"$tmp_sharedflag\"\"$tmp_addflag\"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n\n        if test \"x$supports_anon_versioning\" = xyes; then\n          _LT_TAGVAR(archive_expsym_cmds, $1)='echo \"{ global:\" > $output_objdir/$libname.ver~\n\t    cat $export_symbols | sed -e \"s/\\(.*\\)/\\1;/\" >> $output_objdir/$libname.ver~\n\t    echo \"local: *; };\" >> $output_objdir/$libname.ver~\n\t    $CC '\"$tmp_sharedflag\"\"$tmp_addflag\"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'\n        fi\n\n\tcase $cc_basename in\n\txlf*)\n\t  # IBM XL Fortran 10.1 on PPC cannot create shared libs itself\n\t  _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive'\n\t  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=\n\t  _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir'\n\t  _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib'\n\t  if test \"x$supports_anon_versioning\" = xyes; then\n\t    _LT_TAGVAR(archive_expsym_cmds, $1)='echo \"{ global:\" > $output_objdir/$libname.ver~\n\t      cat $export_symbols | sed -e \"s/\\(.*\\)/\\1;/\" >> $output_objdir/$libname.ver~\n\t      echo \"local: *; };\" >> $output_objdir/$libname.ver~\n\t      $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'\n\t  fi\n\t  ;;\n\tesac\n      else\n        _LT_TAGVAR(ld_shlibs, $1)=no\n      fi\n      ;;\n\n    netbsd*)\n      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then\n\t_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'\n\twlarc=\n      else\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n\t_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'\n      fi\n      ;;\n\n    solaris*)\n      if $LD -v 2>&1 | $GREP 'BFD 2\\.8' > /dev/null; then\n\t_LT_TAGVAR(ld_shlibs, $1)=no\n\tcat <<_LT_EOF 1>&2\n\n*** Warning: The releases 2.8.* of the GNU linker cannot reliably\n*** create shared libraries on Solaris systems.  Therefore, libtool\n*** is disabling shared libraries support.  We urge you to upgrade GNU\n*** binutils to release 2.9.1 or newer.  Another option is to modify\n*** your PATH or compiler configuration so that the native linker is\n*** used, and then restart.\n\n_LT_EOF\n      elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n\t_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'\n      else\n\t_LT_TAGVAR(ld_shlibs, $1)=no\n      fi\n      ;;\n\n    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)\n      case `$LD -v 2>&1` in\n        *\\ [[01]].* | *\\ 2.[[0-9]].* | *\\ 2.1[[0-5]].*)\n\t_LT_TAGVAR(ld_shlibs, $1)=no\n\tcat <<_LT_EOF 1>&2\n\n*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not\n*** reliably create shared libraries on SCO systems.  Therefore, libtool\n*** is disabling shared libraries support.  We urge you to upgrade GNU\n*** binutils to release 2.16.91.0.3 or newer.  Another option is to modify\n*** your PATH or compiler configuration so that the native linker is\n*** used, and then restart.\n\n_LT_EOF\n\t;;\n\t*)\n\t  # For security reasons, it is highly recommended that you always\n\t  # use absolute paths for naming shared libraries, and exclude the\n\t  # DT_RUNPATH tag from executables and libraries.  But doing so\n\t  # requires that you compile everything twice, which is a pain.\n\t  if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then\n\t    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'\n\t    _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n\t    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'\n\t  else\n\t    _LT_TAGVAR(ld_shlibs, $1)=no\n\t  fi\n\t;;\n      esac\n      ;;\n\n    sunos4*)\n      _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'\n      wlarc=\n      _LT_TAGVAR(hardcode_direct, $1)=yes\n      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n      ;;\n\n    *)\n      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n\t_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'\n      else\n\t_LT_TAGVAR(ld_shlibs, $1)=no\n      fi\n      ;;\n    esac\n\n    if test \"$_LT_TAGVAR(ld_shlibs, $1)\" = no; then\n      runpath_var=\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=\n      _LT_TAGVAR(export_dynamic_flag_spec, $1)=\n      _LT_TAGVAR(whole_archive_flag_spec, $1)=\n    fi\n  else\n    # PORTME fill in a description of your system's linker (not GNU ld)\n    case $host_os in\n    aix3*)\n      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported\n      _LT_TAGVAR(always_export_symbols, $1)=yes\n      _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'\n      # Note: this linker hardcodes the directories in LIBPATH if there\n      # are no directories specified by -L.\n      _LT_TAGVAR(hardcode_minus_L, $1)=yes\n      if test \"$GCC\" = yes && test -z \"$lt_prog_compiler_static\"; then\n\t# Neither direct hardcoding nor static linking is supported with a\n\t# broken collect2.\n\t_LT_TAGVAR(hardcode_direct, $1)=unsupported\n      fi\n      ;;\n\n    aix[[4-9]]*)\n      if test \"$host_cpu\" = ia64; then\n\t# On IA64, the linker does run time linking by default, so we don't\n\t# have to do anything special.\n\taix_use_runtimelinking=no\n\texp_sym_flag='-Bexport'\n\tno_entry_flag=\"\"\n      else\n\t# If we're using GNU nm, then we don't want the \"-C\" option.\n\t# -C means demangle to AIX nm, but means don't demangle with GNU nm\n\tif $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then\n\t  _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\\''{ if (((\\$ 2 == \"T\") || (\\$ 2 == \"D\") || (\\$ 2 == \"B\")) && ([substr](\\$ 3,1,1) != \".\")) { print \\$ 3 } }'\\'' | sort -u > $export_symbols'\n\telse\n\t  _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\\''{ if (((\\$ 2 == \"T\") || (\\$ 2 == \"D\") || (\\$ 2 == \"B\")) && ([substr](\\$ 3,1,1) != \".\")) { print \\$ 3 } }'\\'' | sort -u > $export_symbols'\n\tfi\n\taix_use_runtimelinking=no\n\n\t# Test if we are trying to use run time linking or normal\n\t# AIX style linking. If -brtl is somewhere in LDFLAGS, we\n\t# need to do runtime linking.\n\tcase $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)\n\t  for ld_flag in $LDFLAGS; do\n\t  if (test $ld_flag = \"-brtl\" || test $ld_flag = \"-Wl,-brtl\"); then\n\t    aix_use_runtimelinking=yes\n\t    break\n\t  fi\n\t  done\n\t  ;;\n\tesac\n\n\texp_sym_flag='-bexport'\n\tno_entry_flag='-bnoentry'\n      fi\n\n      # When large executables or shared objects are built, AIX ld can\n      # have problems creating the table of contents.  If linking a library\n      # or program results in \"error TOC overflow\" add -mminimal-toc to\n      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not\n      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.\n\n      _LT_TAGVAR(archive_cmds, $1)=''\n      _LT_TAGVAR(hardcode_direct, $1)=yes\n      _LT_TAGVAR(hardcode_direct_absolute, $1)=yes\n      _LT_TAGVAR(hardcode_libdir_separator, $1)=':'\n      _LT_TAGVAR(link_all_deplibs, $1)=yes\n      _LT_TAGVAR(file_list_spec, $1)='${wl}-f,'\n\n      if test \"$GCC\" = yes; then\n\tcase $host_os in aix4.[[012]]|aix4.[[012]].*)\n\t# We only want to do this on AIX 4.2 and lower, the check\n\t# below for broken collect2 doesn't work under 4.3+\n\t  collect2name=`${CC} -print-prog-name=collect2`\n\t  if test -f \"$collect2name\" &&\n\t   strings \"$collect2name\" | $GREP resolve_lib_name >/dev/null\n\t  then\n\t  # We have reworked collect2\n\t  :\n\t  else\n\t  # We have old collect2\n\t  _LT_TAGVAR(hardcode_direct, $1)=unsupported\n\t  # It fails to find uninstalled libraries when the uninstalled\n\t  # path is not listed in the libpath.  Setting hardcode_minus_L\n\t  # to unsupported forces relinking\n\t  _LT_TAGVAR(hardcode_minus_L, $1)=yes\n\t  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'\n\t  _LT_TAGVAR(hardcode_libdir_separator, $1)=\n\t  fi\n\t  ;;\n\tesac\n\tshared_flag='-shared'\n\tif test \"$aix_use_runtimelinking\" = yes; then\n\t  shared_flag=\"$shared_flag \"'${wl}-G'\n\tfi\n      else\n\t# not using gcc\n\tif test \"$host_cpu\" = ia64; then\n\t# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release\n\t# chokes on -Wl,-G. The following line is correct:\n\t  shared_flag='-G'\n\telse\n\t  if test \"$aix_use_runtimelinking\" = yes; then\n\t    shared_flag='${wl}-G'\n\t  else\n\t    shared_flag='${wl}-bM:SRE'\n\t  fi\n\tfi\n      fi\n\n      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'\n      # It seems that -bexpall does not export symbols beginning with\n      # underscore (_), so it is better to generate a list of symbols to export.\n      _LT_TAGVAR(always_export_symbols, $1)=yes\n      if test \"$aix_use_runtimelinking\" = yes; then\n\t# Warning - without using the other runtime loading flags (-brtl),\n\t# -berok will link without error, but may produce a broken library.\n\t_LT_TAGVAR(allow_undefined_flag, $1)='-berok'\n        # Determine the default libpath from the value encoded in an\n        # empty executable.\n        _LT_SYS_MODULE_PATH_AIX\n        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'\"$aix_libpath\"\n        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '\"\\${wl}$no_entry_flag\"' $compiler_flags `if test \"x${allow_undefined_flag}\" != \"x\"; then $ECHO \"X${wl}${allow_undefined_flag}\" | $Xsed; else :; fi` '\"\\${wl}$exp_sym_flag:\\$export_symbols $shared_flag\"\n      else\n\tif test \"$host_cpu\" = ia64; then\n\t  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'\n\t  _LT_TAGVAR(allow_undefined_flag, $1)=\"-z nodefs\"\n\t  _LT_TAGVAR(archive_expsym_cmds, $1)=\"\\$CC $shared_flag\"' -o $output_objdir/$soname $libobjs $deplibs '\"\\${wl}$no_entry_flag\"' $compiler_flags ${wl}${allow_undefined_flag} '\"\\${wl}$exp_sym_flag:\\$export_symbols\"\n\telse\n\t # Determine the default libpath from the value encoded in an\n\t # empty executable.\n\t _LT_SYS_MODULE_PATH_AIX\n\t _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'\"$aix_libpath\"\n\t  # Warning - without using the other run time loading flags,\n\t  # -berok will link without error, but may produce a broken library.\n\t  _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'\n\t  _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'\n\t  # Exported symbols can be pulled into shared objects from archives\n\t  _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'\n\t  _LT_TAGVAR(archive_cmds_need_lc, $1)=yes\n\t  # This is similar to how AIX traditionally builds its shared libraries.\n\t  _LT_TAGVAR(archive_expsym_cmds, $1)=\"\\$CC $shared_flag\"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'\n\tfi\n      fi\n      ;;\n\n    amigaos*)\n      case $host_cpu in\n      powerpc)\n            # see comment about AmigaOS4 .so support\n            _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n            _LT_TAGVAR(archive_expsym_cmds, $1)=''\n        ;;\n      m68k)\n            _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO \"#define NAME $libname\" > $output_objdir/a2ixlibrary.data~$ECHO \"#define LIBRARY_ID 1\" >> $output_objdir/a2ixlibrary.data~$ECHO \"#define VERSION $major\" >> $output_objdir/a2ixlibrary.data~$ECHO \"#define REVISION $revision\" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'\n            _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'\n            _LT_TAGVAR(hardcode_minus_L, $1)=yes\n        ;;\n      esac\n      ;;\n\n    bsdi[[45]]*)\n      _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic\n      ;;\n\n    cygwin* | mingw* | pw32* | cegcc*)\n      # When not using gcc, we currently assume that we are using\n      # Microsoft Visual C++.\n      # hardcode_libdir_flag_spec is actually meaningless, as there is\n      # no search path for DLLs.\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '\n      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported\n      # Tell ltmain to make .lib files, not .a files.\n      libext=lib\n      # Tell ltmain to make .dll files, not .so files.\n      shrext_cmds=\".dll\"\n      # FIXME: Setting linknames here is a bad hack.\n      _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `$ECHO \"X$deplibs\" | $Xsed -e '\\''s/ -lc$//'\\''` -link -dll~linknames='\n      # The linker will automatically build a .lib file if we build a DLL.\n      _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'\n      # FIXME: Should let the user specify the lib program.\n      _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs'\n      _LT_TAGVAR(fix_srcfile_path, $1)='`cygpath -w \"$srcfile\"`'\n      _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes\n      ;;\n\n    darwin* | rhapsody*)\n      _LT_DARWIN_LINKER_FEATURES($1)\n      ;;\n\n    dgux*)\n      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'\n      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n      ;;\n\n    freebsd1*)\n      _LT_TAGVAR(ld_shlibs, $1)=no\n      ;;\n\n    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor\n    # support.  Future versions do this automatically, but an explicit c++rt0.o\n    # does not break anything, and helps significantly (at the cost of a little\n    # extra space).\n    freebsd2.2*)\n      _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'\n      _LT_TAGVAR(hardcode_direct, $1)=yes\n      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n      ;;\n\n    # Unfortunately, older versions of FreeBSD 2 do not have this feature.\n    freebsd2*)\n      _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'\n      _LT_TAGVAR(hardcode_direct, $1)=yes\n      _LT_TAGVAR(hardcode_minus_L, $1)=yes\n      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n      ;;\n\n    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.\n    freebsd* | dragonfly*)\n      _LT_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'\n      _LT_TAGVAR(hardcode_direct, $1)=yes\n      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n      ;;\n\n    hpux9*)\n      if test \"$GCC\" = yes; then\n\t_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'\n      else\n\t_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'\n      fi\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'\n      _LT_TAGVAR(hardcode_libdir_separator, $1)=:\n      _LT_TAGVAR(hardcode_direct, $1)=yes\n\n      # hardcode_minus_L: Not really in the search PATH,\n      # but as the default location of the library.\n      _LT_TAGVAR(hardcode_minus_L, $1)=yes\n      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'\n      ;;\n\n    hpux10*)\n      if test \"$GCC\" = yes -a \"$with_gnu_ld\" = no; then\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'\n      else\n\t_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'\n      fi\n      if test \"$with_gnu_ld\" = no; then\n\t_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'\n\t_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir'\n\t_LT_TAGVAR(hardcode_libdir_separator, $1)=:\n\t_LT_TAGVAR(hardcode_direct, $1)=yes\n\t_LT_TAGVAR(hardcode_direct_absolute, $1)=yes\n\t_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'\n\t# hardcode_minus_L: Not really in the search PATH,\n\t# but as the default location of the library.\n\t_LT_TAGVAR(hardcode_minus_L, $1)=yes\n      fi\n      ;;\n\n    hpux11*)\n      if test \"$GCC\" = yes -a \"$with_gnu_ld\" = no; then\n\tcase $host_cpu in\n\thppa*64*)\n\t  _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t  ;;\n\tia64*)\n\t  _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'\n\t  ;;\n\t*)\n\t  _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'\n\t  ;;\n\tesac\n      else\n\tcase $host_cpu in\n\thppa*64*)\n\t  _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t  ;;\n\tia64*)\n\t  _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'\n\t  ;;\n\t*)\n\t  _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'\n\t  ;;\n\tesac\n      fi\n      if test \"$with_gnu_ld\" = no; then\n\t_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'\n\t_LT_TAGVAR(hardcode_libdir_separator, $1)=:\n\n\tcase $host_cpu in\n\thppa*64*|ia64*)\n\t  _LT_TAGVAR(hardcode_direct, $1)=no\n\t  _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n\t  ;;\n\t*)\n\t  _LT_TAGVAR(hardcode_direct, $1)=yes\n\t  _LT_TAGVAR(hardcode_direct_absolute, $1)=yes\n\t  _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'\n\n\t  # hardcode_minus_L: Not really in the search PATH,\n\t  # but as the default location of the library.\n\t  _LT_TAGVAR(hardcode_minus_L, $1)=yes\n\t  ;;\n\tesac\n      fi\n      ;;\n\n    irix5* | irix6* | nonstopux*)\n      if test \"$GCC\" = yes; then\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n \"$verstring\" && $ECHO \"X${wl}-set_version ${wl}$verstring\" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'\n\t# Try to use the -exported_symbol ld option, if it does not\n\t# work, assume that -exports_file does not work either and\n\t# implicitly export all symbols.\n        save_LDFLAGS=\"$LDFLAGS\"\n        LDFLAGS=\"$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null\"\n        AC_LINK_IFELSE(int foo(void) {},\n          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n \"$verstring\" && $ECHO \"X${wl}-set_version ${wl}$verstring\" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'\n        )\n        LDFLAGS=\"$save_LDFLAGS\"\n      else\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n \"$verstring\" && $ECHO \"X-set_version $verstring\" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'\n\t_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n \"$verstring\" && $ECHO \"X-set_version $verstring\" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'\n      fi\n      _LT_TAGVAR(archive_cmds_need_lc, $1)='no'\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'\n      _LT_TAGVAR(hardcode_libdir_separator, $1)=:\n      _LT_TAGVAR(inherit_rpath, $1)=yes\n      _LT_TAGVAR(link_all_deplibs, $1)=yes\n      ;;\n\n    netbsd*)\n      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then\n\t_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out\n      else\n\t_LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF\n      fi\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'\n      _LT_TAGVAR(hardcode_direct, $1)=yes\n      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n      ;;\n\n    newsos6)\n      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'\n      _LT_TAGVAR(hardcode_direct, $1)=yes\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'\n      _LT_TAGVAR(hardcode_libdir_separator, $1)=:\n      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n      ;;\n\n    *nto* | *qnx*)\n      ;;\n\n    openbsd*)\n      if test -f /usr/libexec/ld.so; then\n\t_LT_TAGVAR(hardcode_direct, $1)=yes\n\t_LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n\t_LT_TAGVAR(hardcode_direct_absolute, $1)=yes\n\tif test -z \"`echo __ELF__ | $CC -E - | $GREP __ELF__`\" || test \"$host_os-$host_cpu\" = \"openbsd2.8-powerpc\"; then\n\t  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'\n\t  _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'\n\t  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'\n\t  _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'\n\telse\n\t  case $host_os in\n\t   openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)\n\t     _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'\n\t     _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'\n\t     ;;\n\t   *)\n\t     _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'\n\t     _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'\n\t     ;;\n\t  esac\n\tfi\n      else\n\t_LT_TAGVAR(ld_shlibs, $1)=no\n      fi\n      ;;\n\n    os2*)\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'\n      _LT_TAGVAR(hardcode_minus_L, $1)=yes\n      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported\n      _LT_TAGVAR(archive_cmds, $1)='$ECHO \"LIBRARY $libname INITINSTANCE\" > $output_objdir/$libname.def~$ECHO \"DESCRIPTION \\\"$libname\\\"\" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO \" SINGLE NONSHARED\" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'\n      _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'\n      ;;\n\n    osf3*)\n      if test \"$GCC\" = yes; then\n\t_LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\\*'\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n \"$verstring\" && $ECHO \"X${wl}-set_version ${wl}$verstring\" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'\n      else\n\t_LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \\*'\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n \"$verstring\" && $ECHO \"X-set_version $verstring\" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'\n      fi\n      _LT_TAGVAR(archive_cmds_need_lc, $1)='no'\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'\n      _LT_TAGVAR(hardcode_libdir_separator, $1)=:\n      ;;\n\n    osf4* | osf5*)\t# as osf3* with the addition of -msym flag\n      if test \"$GCC\" = yes; then\n\t_LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\\*'\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n \"$verstring\" && $ECHO \"X${wl}-set_version ${wl}$verstring\" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'\n\t_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'\n      else\n\t_LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \\*'\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n \"$verstring\" && $ECHO \"X-set_version $verstring\" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'\n\t_LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf \"%s %s\\\\n\" -exported_symbol \"\\$i\" >> $lib.exp; done; printf \"%s\\\\n\" \"-hidden\">> $lib.exp~\n\t$CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n \"$verstring\" && $ECHO \"X-set_version $verstring\" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'\n\n\t# Both c and cxx compiler support -rpath directly\n\t_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'\n      fi\n      _LT_TAGVAR(archive_cmds_need_lc, $1)='no'\n      _LT_TAGVAR(hardcode_libdir_separator, $1)=:\n      ;;\n\n    solaris*)\n      _LT_TAGVAR(no_undefined_flag, $1)=' -z defs'\n      if test \"$GCC\" = yes; then\n\twlarc='${wl}'\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t_LT_TAGVAR(archive_expsym_cmds, $1)='echo \"{ global:\" > $lib.exp~cat $export_symbols | $SED -e \"s/\\(.*\\)/\\1;/\" >> $lib.exp~echo \"local: *; };\" >> $lib.exp~\n\t  $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'\n      else\n\tcase `$CC -V 2>&1` in\n\t*\"Compilers 5.0\"*)\n\t  wlarc=''\n\t  _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'\n\t  _LT_TAGVAR(archive_expsym_cmds, $1)='echo \"{ global:\" > $lib.exp~cat $export_symbols | $SED -e \"s/\\(.*\\)/\\1;/\" >> $lib.exp~echo \"local: *; };\" >> $lib.exp~\n\t  $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'\n\t  ;;\n\t*)\n\t  wlarc='${wl}'\n\t  _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'\n\t  _LT_TAGVAR(archive_expsym_cmds, $1)='echo \"{ global:\" > $lib.exp~cat $export_symbols | $SED -e \"s/\\(.*\\)/\\1;/\" >> $lib.exp~echo \"local: *; };\" >> $lib.exp~\n\t  $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'\n\t  ;;\n\tesac\n      fi\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'\n      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n      case $host_os in\n      solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;\n      *)\n\t# The compiler driver will combine and reorder linker options,\n\t# but understands `-z linker_flag'.  GCC discards it without `$wl',\n\t# but is careful enough not to reorder.\n\t# Supported since Solaris 2.6 (maybe 2.5.1?)\n\tif test \"$GCC\" = yes; then\n\t  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'\n\telse\n\t  _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'\n\tfi\n\t;;\n      esac\n      _LT_TAGVAR(link_all_deplibs, $1)=yes\n      ;;\n\n    sunos4*)\n      if test \"x$host_vendor\" = xsequent; then\n\t# Use $CC to link under sequent, because it throws in some extra .o\n\t# files that make .init and .fini sections work.\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'\n      else\n\t_LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'\n      fi\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'\n      _LT_TAGVAR(hardcode_direct, $1)=yes\n      _LT_TAGVAR(hardcode_minus_L, $1)=yes\n      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n      ;;\n\n    sysv4)\n      case $host_vendor in\n\tsni)\n\t  _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'\n\t  _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true???\n\t;;\n\tsiemens)\n\t  ## LD is ld it makes a PLAMLIB\n\t  ## CC just makes a GrossModule.\n\t  _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags'\n\t  _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs'\n\t  _LT_TAGVAR(hardcode_direct, $1)=no\n        ;;\n\tmotorola)\n\t  _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'\n\t  _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie\n\t;;\n      esac\n      runpath_var='LD_RUN_PATH'\n      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n      ;;\n\n    sysv4.3*)\n      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'\n      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n      _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport'\n      ;;\n\n    sysv4*MP*)\n      if test -d /usr/nec; then\n\t_LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'\n\t_LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n\trunpath_var=LD_RUN_PATH\n\thardcode_runpath_var=yes\n\t_LT_TAGVAR(ld_shlibs, $1)=yes\n      fi\n      ;;\n\n    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)\n      _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'\n      _LT_TAGVAR(archive_cmds_need_lc, $1)=no\n      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n      runpath_var='LD_RUN_PATH'\n\n      if test \"$GCC\" = yes; then\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n      else\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n      fi\n      ;;\n\n    sysv5* | sco3.2v5* | sco5v6*)\n      # Note: We can NOT use -z defs as we might desire, because we do not\n      # link with -lc, and that would cause any symbols used from libc to\n      # always be unresolved, which means just about no library would\n      # ever link correctly.  If we're not using GNU ld we use -z text\n      # though, which does catch some bad symbols but isn't as heavy-handed\n      # as -z defs.\n      _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'\n      _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'\n      _LT_TAGVAR(archive_cmds_need_lc, $1)=no\n      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'\n      _LT_TAGVAR(hardcode_libdir_separator, $1)=':'\n      _LT_TAGVAR(link_all_deplibs, $1)=yes\n      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'\n      runpath_var='LD_RUN_PATH'\n\n      if test \"$GCC\" = yes; then\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n      else\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n      fi\n      ;;\n\n    uts4*)\n      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'\n      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n      ;;\n\n    *)\n      _LT_TAGVAR(ld_shlibs, $1)=no\n      ;;\n    esac\n\n    if test x$host_vendor = xsni; then\n      case $host in\n      sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)\n\t_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym'\n\t;;\n      esac\n    fi\n  fi\n])\nAC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])\ntest \"$_LT_TAGVAR(ld_shlibs, $1)\" = no && can_build_shared=no\n\n_LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld\n\n_LT_DECL([], [libext], [0], [Old archive suffix (normally \"a\")])dnl\n_LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally \".so\")])dnl\n_LT_DECL([], [extract_expsyms_cmds], [2],\n    [The commands to extract the exported symbol list from a shared archive])\n\n#\n# Do we need to explicitly link libc?\n#\ncase \"x$_LT_TAGVAR(archive_cmds_need_lc, $1)\" in\nx|xyes)\n  # Assume -lc should be added\n  _LT_TAGVAR(archive_cmds_need_lc, $1)=yes\n\n  if test \"$enable_shared\" = yes && test \"$GCC\" = yes; then\n    case $_LT_TAGVAR(archive_cmds, $1) in\n    *'~'*)\n      # FIXME: we may have to deal with multi-command sequences.\n      ;;\n    '$CC '*)\n      # Test whether the compiler implicitly links with -lc since on some\n      # systems, -lgcc has to come before -lc. If gcc already passes -lc\n      # to ld, don't add -lc before -lgcc.\n      AC_MSG_CHECKING([whether -lc should be explicitly linked in])\n      $RM conftest*\n      echo \"$lt_simple_compile_test_code\" > conftest.$ac_ext\n\n      if AC_TRY_EVAL(ac_compile) 2>conftest.err; then\n        soname=conftest\n        lib=conftest\n        libobjs=conftest.$ac_objext\n        deplibs=\n        wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1)\n\tpic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1)\n        compiler_flags=-v\n        linker_flags=-v\n        verstring=\n        output_objdir=.\n        libname=conftest\n        lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1)\n        _LT_TAGVAR(allow_undefined_flag, $1)=\n        if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\\>\\&1 \\| $GREP \\\" -lc \\\" \\>/dev/null 2\\>\\&1)\n        then\n\t  _LT_TAGVAR(archive_cmds_need_lc, $1)=no\n        else\n\t  _LT_TAGVAR(archive_cmds_need_lc, $1)=yes\n        fi\n        _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag\n      else\n        cat conftest.err 1>&5\n      fi\n      $RM conftest*\n      AC_MSG_RESULT([$_LT_TAGVAR(archive_cmds_need_lc, $1)])\n      ;;\n    esac\n  fi\n  ;;\nesac\n\n_LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0],\n    [Whether or not to add -lc for building shared libraries])\n_LT_TAGDECL([allow_libtool_libs_with_static_runtimes],\n    [enable_shared_with_static_runtimes], [0],\n    [Whether or not to disallow shared libs when runtime libs are static])\n_LT_TAGDECL([], [export_dynamic_flag_spec], [1],\n    [Compiler flag to allow reflexive dlopens])\n_LT_TAGDECL([], [whole_archive_flag_spec], [1],\n    [Compiler flag to generate shared objects directly from archives])\n_LT_TAGDECL([], [compiler_needs_object], [1],\n    [Whether the compiler copes with passing no objects directly])\n_LT_TAGDECL([], [old_archive_from_new_cmds], [2],\n    [Create an old-style archive from a shared archive])\n_LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2],\n    [Create a temporary old-style archive to link instead of a shared archive])\n_LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive])\n_LT_TAGDECL([], [archive_expsym_cmds], [2])\n_LT_TAGDECL([], [module_cmds], [2],\n    [Commands used to build a loadable module if different from building\n    a shared archive.])\n_LT_TAGDECL([], [module_expsym_cmds], [2])\n_LT_TAGDECL([], [with_gnu_ld], [1],\n    [Whether we are building with GNU ld or not])\n_LT_TAGDECL([], [allow_undefined_flag], [1],\n    [Flag that allows shared libraries with undefined symbols to be built])\n_LT_TAGDECL([], [no_undefined_flag], [1],\n    [Flag that enforces no undefined symbols])\n_LT_TAGDECL([], [hardcode_libdir_flag_spec], [1],\n    [Flag to hardcode $libdir into a binary during linking.\n    This must work even if $libdir does not exist])\n_LT_TAGDECL([], [hardcode_libdir_flag_spec_ld], [1],\n    [[If ld is used when linking, flag to hardcode $libdir into a binary\n    during linking.  This must work even if $libdir does not exist]])\n_LT_TAGDECL([], [hardcode_libdir_separator], [1],\n    [Whether we need a single \"-rpath\" flag with a separated argument])\n_LT_TAGDECL([], [hardcode_direct], [0],\n    [Set to \"yes\" if using DIR/libNAME${shared_ext} during linking hardcodes\n    DIR into the resulting binary])\n_LT_TAGDECL([], [hardcode_direct_absolute], [0],\n    [Set to \"yes\" if using DIR/libNAME${shared_ext} during linking hardcodes\n    DIR into the resulting binary and the resulting library dependency is\n    \"absolute\", i.e impossible to change by setting ${shlibpath_var} if the\n    library is relocated])\n_LT_TAGDECL([], [hardcode_minus_L], [0],\n    [Set to \"yes\" if using the -LDIR flag during linking hardcodes DIR\n    into the resulting binary])\n_LT_TAGDECL([], [hardcode_shlibpath_var], [0],\n    [Set to \"yes\" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR\n    into the resulting binary])\n_LT_TAGDECL([], [hardcode_automatic], [0],\n    [Set to \"yes\" if building a shared library automatically hardcodes DIR\n    into the library and all subsequent libraries and executables linked\n    against it])\n_LT_TAGDECL([], [inherit_rpath], [0],\n    [Set to yes if linker adds runtime paths of dependent libraries\n    to runtime path list])\n_LT_TAGDECL([], [link_all_deplibs], [0],\n    [Whether libtool must link a program against all its dependency libraries])\n_LT_TAGDECL([], [fix_srcfile_path], [1],\n    [Fix the shell variable $srcfile for the compiler])\n_LT_TAGDECL([], [always_export_symbols], [0],\n    [Set to \"yes\" if exported symbols are required])\n_LT_TAGDECL([], [export_symbols_cmds], [2],\n    [The commands to list exported symbols])\n_LT_TAGDECL([], [exclude_expsyms], [1],\n    [Symbols that should not be listed in the preloaded symbols])\n_LT_TAGDECL([], [include_expsyms], [1],\n    [Symbols that must always be exported])\n_LT_TAGDECL([], [prelink_cmds], [2],\n    [Commands necessary for linking programs (against libraries) with templates])\n_LT_TAGDECL([], [file_list_spec], [1],\n    [Specify filename containing input files])\ndnl FIXME: Not yet implemented\ndnl _LT_TAGDECL([], [thread_safe_flag_spec], [1],\ndnl    [Compiler flag to generate thread safe objects])\n])# _LT_LINKER_SHLIBS\n\n\n# _LT_LANG_C_CONFIG([TAG])\n# ------------------------\n# Ensure that the configuration variables for a C compiler are suitably\n# defined.  These variables are subsequently used by _LT_CONFIG to write\n# the compiler configuration to `libtool'.\nm4_defun([_LT_LANG_C_CONFIG],\n[m4_require([_LT_DECL_EGREP])dnl\nlt_save_CC=\"$CC\"\nAC_LANG_PUSH(C)\n\n# Source file extension for C test sources.\nac_ext=c\n\n# Object file extension for compiled C test sources.\nobjext=o\n_LT_TAGVAR(objext, $1)=$objext\n\n# Code to be used in simple compile tests\nlt_simple_compile_test_code=\"int some_variable = 0;\"\n\n# Code to be used in simple link tests\nlt_simple_link_test_code='int main(){return(0);}'\n\n_LT_TAG_COMPILER\n# Save the default compiler, since it gets overwritten when the other\n# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP.\ncompiler_DEFAULT=$CC\n\n# save warnings/boilerplate of simple test code\n_LT_COMPILER_BOILERPLATE\n_LT_LINKER_BOILERPLATE\n\n## CAVEAT EMPTOR:\n## There is no encapsulation within the following macros, do not change\n## the running order or otherwise move them around unless you know exactly\n## what you are doing...\nif test -n \"$compiler\"; then\n  _LT_COMPILER_NO_RTTI($1)\n  _LT_COMPILER_PIC($1)\n  _LT_COMPILER_C_O($1)\n  _LT_COMPILER_FILE_LOCKS($1)\n  _LT_LINKER_SHLIBS($1)\n  _LT_SYS_DYNAMIC_LINKER($1)\n  _LT_LINKER_HARDCODE_LIBPATH($1)\n  LT_SYS_DLOPEN_SELF\n  _LT_CMD_STRIPLIB\n\n  # Report which library types will actually be built\n  AC_MSG_CHECKING([if libtool supports shared libraries])\n  AC_MSG_RESULT([$can_build_shared])\n\n  AC_MSG_CHECKING([whether to build shared libraries])\n  test \"$can_build_shared\" = \"no\" && enable_shared=no\n\n  # On AIX, shared libraries and static libraries use the same namespace, and\n  # are all built from PIC.\n  case $host_os in\n  aix3*)\n    test \"$enable_shared\" = yes && enable_static=no\n    if test -n \"$RANLIB\"; then\n      archive_cmds=\"$archive_cmds~\\$RANLIB \\$lib\"\n      postinstall_cmds='$RANLIB $lib'\n    fi\n    ;;\n\n  aix[[4-9]]*)\n    if test \"$host_cpu\" != ia64 && test \"$aix_use_runtimelinking\" = no ; then\n      test \"$enable_shared\" = yes && enable_static=no\n    fi\n    ;;\n  esac\n  AC_MSG_RESULT([$enable_shared])\n\n  AC_MSG_CHECKING([whether to build static libraries])\n  # Make sure either enable_shared or enable_static is yes.\n  test \"$enable_shared\" = yes || enable_static=yes\n  AC_MSG_RESULT([$enable_static])\n\n  _LT_CONFIG($1)\nfi\nAC_LANG_POP\nCC=\"$lt_save_CC\"\n])# _LT_LANG_C_CONFIG\n\n\n# _LT_PROG_CXX\n# ------------\n# Since AC_PROG_CXX is broken, in that it returns g++ if there is no c++\n# compiler, we have our own version here.\nm4_defun([_LT_PROG_CXX],\n[\npushdef([AC_MSG_ERROR], [_lt_caught_CXX_error=yes])\nAC_PROG_CXX\nif test -n \"$CXX\" && ( test \"X$CXX\" != \"Xno\" &&\n    ( (test \"X$CXX\" = \"Xg++\" && `g++ -v >/dev/null 2>&1` ) ||\n    (test \"X$CXX\" != \"Xg++\"))) ; then\n  AC_PROG_CXXCPP\nelse\n  _lt_caught_CXX_error=yes\nfi\npopdef([AC_MSG_ERROR])\n])# _LT_PROG_CXX\n\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([_LT_PROG_CXX], [])\n\n\n# _LT_LANG_CXX_CONFIG([TAG])\n# --------------------------\n# Ensure that the configuration variables for a C++ compiler are suitably\n# defined.  These variables are subsequently used by _LT_CONFIG to write\n# the compiler configuration to `libtool'.\nm4_defun([_LT_LANG_CXX_CONFIG],\n[AC_REQUIRE([_LT_PROG_CXX])dnl\nm4_require([_LT_FILEUTILS_DEFAULTS])dnl\nm4_require([_LT_DECL_EGREP])dnl\n\nAC_LANG_PUSH(C++)\n_LT_TAGVAR(archive_cmds_need_lc, $1)=no\n_LT_TAGVAR(allow_undefined_flag, $1)=\n_LT_TAGVAR(always_export_symbols, $1)=no\n_LT_TAGVAR(archive_expsym_cmds, $1)=\n_LT_TAGVAR(compiler_needs_object, $1)=no\n_LT_TAGVAR(export_dynamic_flag_spec, $1)=\n_LT_TAGVAR(hardcode_direct, $1)=no\n_LT_TAGVAR(hardcode_direct_absolute, $1)=no\n_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=\n_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=\n_LT_TAGVAR(hardcode_libdir_separator, $1)=\n_LT_TAGVAR(hardcode_minus_L, $1)=no\n_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported\n_LT_TAGVAR(hardcode_automatic, $1)=no\n_LT_TAGVAR(inherit_rpath, $1)=no\n_LT_TAGVAR(module_cmds, $1)=\n_LT_TAGVAR(module_expsym_cmds, $1)=\n_LT_TAGVAR(link_all_deplibs, $1)=unknown\n_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds\n_LT_TAGVAR(no_undefined_flag, $1)=\n_LT_TAGVAR(whole_archive_flag_spec, $1)=\n_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no\n\n# Source file extension for C++ test sources.\nac_ext=cpp\n\n# Object file extension for compiled C++ test sources.\nobjext=o\n_LT_TAGVAR(objext, $1)=$objext\n\n# No sense in running all these tests if we already determined that\n# the CXX compiler isn't working.  Some variables (like enable_shared)\n# are currently assumed to apply to all compilers on this platform,\n# and will be corrupted by setting them based on a non-working compiler.\nif test \"$_lt_caught_CXX_error\" != yes; then\n  # Code to be used in simple compile tests\n  lt_simple_compile_test_code=\"int some_variable = 0;\"\n\n  # Code to be used in simple link tests\n  lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }'\n\n  # ltmain only uses $CC for tagged configurations so make sure $CC is set.\n  _LT_TAG_COMPILER\n\n  # save warnings/boilerplate of simple test code\n  _LT_COMPILER_BOILERPLATE\n  _LT_LINKER_BOILERPLATE\n\n  # Allow CC to be a program name with arguments.\n  lt_save_CC=$CC\n  lt_save_LD=$LD\n  lt_save_GCC=$GCC\n  GCC=$GXX\n  lt_save_with_gnu_ld=$with_gnu_ld\n  lt_save_path_LD=$lt_cv_path_LD\n  if test -n \"${lt_cv_prog_gnu_ldcxx+set}\"; then\n    lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx\n  else\n    $as_unset lt_cv_prog_gnu_ld\n  fi\n  if test -n \"${lt_cv_path_LDCXX+set}\"; then\n    lt_cv_path_LD=$lt_cv_path_LDCXX\n  else\n    $as_unset lt_cv_path_LD\n  fi\n  test -z \"${LDCXX+set}\" || LD=$LDCXX\n  CC=${CXX-\"c++\"}\n  compiler=$CC\n  _LT_TAGVAR(compiler, $1)=$CC\n  _LT_CC_BASENAME([$compiler])\n\n  if test -n \"$compiler\"; then\n    # We don't want -fno-exception when compiling C++ code, so set the\n    # no_builtin_flag separately\n    if test \"$GXX\" = yes; then\n      _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'\n    else\n      _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=\n    fi\n\n    if test \"$GXX\" = yes; then\n      # Set up default GNU C++ configuration\n\n      LT_PATH_LD\n\n      # Check if GNU C++ uses GNU ld as the underlying linker, since the\n      # archiving commands below assume that GNU ld is being used.\n      if test \"$with_gnu_ld\" = yes; then\n        _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'\n        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'\n\n        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'\n        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'\n\n        # If archive_cmds runs LD, not CC, wlarc should be empty\n        # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to\n        #     investigate it a little bit more. (MM)\n        wlarc='${wl}'\n\n        # ancient GNU ld didn't support --whole-archive et. al.\n        if eval \"`$CC -print-prog-name=ld` --help 2>&1\" |\n\t  $GREP 'no-whole-archive' > /dev/null; then\n          _LT_TAGVAR(whole_archive_flag_spec, $1)=\"$wlarc\"'--whole-archive$convenience '\"$wlarc\"'--no-whole-archive'\n        else\n          _LT_TAGVAR(whole_archive_flag_spec, $1)=\n        fi\n      else\n        with_gnu_ld=no\n        wlarc=\n\n        # A generic and very simple default shared library creation\n        # command for GNU C++ for the case where it uses the native\n        # linker, instead of GNU ld.  If possible, this setting should\n        # overridden to take advantage of the native linker features on\n        # the platform it is being used on.\n        _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'\n      fi\n\n      # Commands to make compiler produce verbose output that lists\n      # what \"hidden\" libraries, object files and flags are used when\n      # linking a shared library.\n      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP \"\\-L\"'\n\n    else\n      GXX=no\n      with_gnu_ld=no\n      wlarc=\n    fi\n\n    # PORTME: fill in a description of your system's C++ link characteristics\n    AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])\n    _LT_TAGVAR(ld_shlibs, $1)=yes\n    case $host_os in\n      aix3*)\n        # FIXME: insert proper C++ library support\n        _LT_TAGVAR(ld_shlibs, $1)=no\n        ;;\n      aix[[4-9]]*)\n        if test \"$host_cpu\" = ia64; then\n          # On IA64, the linker does run time linking by default, so we don't\n          # have to do anything special.\n          aix_use_runtimelinking=no\n          exp_sym_flag='-Bexport'\n          no_entry_flag=\"\"\n        else\n          aix_use_runtimelinking=no\n\n          # Test if we are trying to use run time linking or normal\n          # AIX style linking. If -brtl is somewhere in LDFLAGS, we\n          # need to do runtime linking.\n          case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)\n\t    for ld_flag in $LDFLAGS; do\n\t      case $ld_flag in\n\t      *-brtl*)\n\t        aix_use_runtimelinking=yes\n\t        break\n\t        ;;\n\t      esac\n\t    done\n\t    ;;\n          esac\n\n          exp_sym_flag='-bexport'\n          no_entry_flag='-bnoentry'\n        fi\n\n        # When large executables or shared objects are built, AIX ld can\n        # have problems creating the table of contents.  If linking a library\n        # or program results in \"error TOC overflow\" add -mminimal-toc to\n        # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not\n        # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.\n\n        _LT_TAGVAR(archive_cmds, $1)=''\n        _LT_TAGVAR(hardcode_direct, $1)=yes\n        _LT_TAGVAR(hardcode_direct_absolute, $1)=yes\n        _LT_TAGVAR(hardcode_libdir_separator, $1)=':'\n        _LT_TAGVAR(link_all_deplibs, $1)=yes\n        _LT_TAGVAR(file_list_spec, $1)='${wl}-f,'\n\n        if test \"$GXX\" = yes; then\n          case $host_os in aix4.[[012]]|aix4.[[012]].*)\n          # We only want to do this on AIX 4.2 and lower, the check\n          # below for broken collect2 doesn't work under 4.3+\n\t  collect2name=`${CC} -print-prog-name=collect2`\n\t  if test -f \"$collect2name\" &&\n\t     strings \"$collect2name\" | $GREP resolve_lib_name >/dev/null\n\t  then\n\t    # We have reworked collect2\n\t    :\n\t  else\n\t    # We have old collect2\n\t    _LT_TAGVAR(hardcode_direct, $1)=unsupported\n\t    # It fails to find uninstalled libraries when the uninstalled\n\t    # path is not listed in the libpath.  Setting hardcode_minus_L\n\t    # to unsupported forces relinking\n\t    _LT_TAGVAR(hardcode_minus_L, $1)=yes\n\t    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'\n\t    _LT_TAGVAR(hardcode_libdir_separator, $1)=\n\t  fi\n          esac\n          shared_flag='-shared'\n\t  if test \"$aix_use_runtimelinking\" = yes; then\n\t    shared_flag=\"$shared_flag \"'${wl}-G'\n\t  fi\n        else\n          # not using gcc\n          if test \"$host_cpu\" = ia64; then\n\t  # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release\n\t  # chokes on -Wl,-G. The following line is correct:\n\t  shared_flag='-G'\n          else\n\t    if test \"$aix_use_runtimelinking\" = yes; then\n\t      shared_flag='${wl}-G'\n\t    else\n\t      shared_flag='${wl}-bM:SRE'\n\t    fi\n          fi\n        fi\n\n        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'\n        # It seems that -bexpall does not export symbols beginning with\n        # underscore (_), so it is better to generate a list of symbols to\n\t# export.\n        _LT_TAGVAR(always_export_symbols, $1)=yes\n        if test \"$aix_use_runtimelinking\" = yes; then\n          # Warning - without using the other runtime loading flags (-brtl),\n          # -berok will link without error, but may produce a broken library.\n          _LT_TAGVAR(allow_undefined_flag, $1)='-berok'\n          # Determine the default libpath from the value encoded in an empty\n          # executable.\n          _LT_SYS_MODULE_PATH_AIX\n          _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'\"$aix_libpath\"\n\n          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '\"\\${wl}$no_entry_flag\"' $compiler_flags `if test \"x${allow_undefined_flag}\" != \"x\"; then $ECHO \"X${wl}${allow_undefined_flag}\" | $Xsed; else :; fi` '\"\\${wl}$exp_sym_flag:\\$export_symbols $shared_flag\"\n        else\n          if test \"$host_cpu\" = ia64; then\n\t    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'\n\t    _LT_TAGVAR(allow_undefined_flag, $1)=\"-z nodefs\"\n\t    _LT_TAGVAR(archive_expsym_cmds, $1)=\"\\$CC $shared_flag\"' -o $output_objdir/$soname $libobjs $deplibs '\"\\${wl}$no_entry_flag\"' $compiler_flags ${wl}${allow_undefined_flag} '\"\\${wl}$exp_sym_flag:\\$export_symbols\"\n          else\n\t    # Determine the default libpath from the value encoded in an\n\t    # empty executable.\n\t    _LT_SYS_MODULE_PATH_AIX\n\t    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'\"$aix_libpath\"\n\t    # Warning - without using the other run time loading flags,\n\t    # -berok will link without error, but may produce a broken library.\n\t    _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'\n\t    _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'\n\t    # Exported symbols can be pulled into shared objects from archives\n\t    _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'\n\t    _LT_TAGVAR(archive_cmds_need_lc, $1)=yes\n\t    # This is similar to how AIX traditionally builds its shared\n\t    # libraries.\n\t    _LT_TAGVAR(archive_expsym_cmds, $1)=\"\\$CC $shared_flag\"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'\n          fi\n        fi\n        ;;\n\n      beos*)\n\tif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then\n\t  _LT_TAGVAR(allow_undefined_flag, $1)=unsupported\n\t  # Joseph Beckenbach <jrb3@best.com> says some releases of gcc\n\t  # support --undefined.  This deserves some investigation.  FIXME\n\t  _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n\telse\n\t  _LT_TAGVAR(ld_shlibs, $1)=no\n\tfi\n\t;;\n\n      chorus*)\n        case $cc_basename in\n          *)\n\t  # FIXME: insert proper C++ library support\n\t  _LT_TAGVAR(ld_shlibs, $1)=no\n\t  ;;\n        esac\n        ;;\n\n      cygwin* | mingw* | pw32* | cegcc*)\n        # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,\n        # as there is no search path for DLLs.\n        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'\n        _LT_TAGVAR(allow_undefined_flag, $1)=unsupported\n        _LT_TAGVAR(always_export_symbols, $1)=no\n        _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes\n\n        if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then\n          _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'\n          # If the export-symbols file already is a .def file (1st line\n          # is EXPORTS), use it as is; otherwise, prepend...\n          _LT_TAGVAR(archive_expsym_cmds, $1)='if test \"x`$SED 1q $export_symbols`\" = xEXPORTS; then\n\t    cp $export_symbols $output_objdir/$soname.def;\n          else\n\t    echo EXPORTS > $output_objdir/$soname.def;\n\t    cat $export_symbols >> $output_objdir/$soname.def;\n          fi~\n          $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'\n        else\n          _LT_TAGVAR(ld_shlibs, $1)=no\n        fi\n        ;;\n      darwin* | rhapsody*)\n        _LT_DARWIN_LINKER_FEATURES($1)\n\t;;\n\n      dgux*)\n        case $cc_basename in\n          ec++*)\n\t    # FIXME: insert proper C++ library support\n\t    _LT_TAGVAR(ld_shlibs, $1)=no\n\t    ;;\n          ghcx*)\n\t    # Green Hills C++ Compiler\n\t    # FIXME: insert proper C++ library support\n\t    _LT_TAGVAR(ld_shlibs, $1)=no\n\t    ;;\n          *)\n\t    # FIXME: insert proper C++ library support\n\t    _LT_TAGVAR(ld_shlibs, $1)=no\n\t    ;;\n        esac\n        ;;\n\n      freebsd[[12]]*)\n        # C++ shared libraries reported to be fairly broken before\n\t# switch to ELF\n        _LT_TAGVAR(ld_shlibs, $1)=no\n        ;;\n\n      freebsd-elf*)\n        _LT_TAGVAR(archive_cmds_need_lc, $1)=no\n        ;;\n\n      freebsd* | dragonfly*)\n        # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF\n        # conventions\n        _LT_TAGVAR(ld_shlibs, $1)=yes\n        ;;\n\n      gnu*)\n        ;;\n\n      hpux9*)\n        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'\n        _LT_TAGVAR(hardcode_libdir_separator, $1)=:\n        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'\n        _LT_TAGVAR(hardcode_direct, $1)=yes\n        _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,\n\t\t\t\t             # but as the default\n\t\t\t\t             # location of the library.\n\n        case $cc_basename in\n          CC*)\n            # FIXME: insert proper C++ library support\n            _LT_TAGVAR(ld_shlibs, $1)=no\n            ;;\n          aCC*)\n            _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'\n            # Commands to make compiler produce verbose output that lists\n            # what \"hidden\" libraries, object files and flags are used when\n            # linking a shared library.\n            #\n            # There doesn't appear to be a way to prevent this compiler from\n            # explicitly linking system object files so we need to strip them\n            # from the output so that they don't get included in the library\n            # dependencies.\n            output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP \"\\-L\"`; list=\"\"; for z in $templist; do case $z in conftest.$objext) list=\"$list $z\";; *.$objext);; *) list=\"$list $z\";;esac; done; $ECHO \"X$list\" | $Xsed'\n            ;;\n          *)\n            if test \"$GXX\" = yes; then\n              _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'\n            else\n              # FIXME: insert proper C++ library support\n              _LT_TAGVAR(ld_shlibs, $1)=no\n            fi\n            ;;\n        esac\n        ;;\n\n      hpux10*|hpux11*)\n        if test $with_gnu_ld = no; then\n\t  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'\n\t  _LT_TAGVAR(hardcode_libdir_separator, $1)=:\n\n          case $host_cpu in\n            hppa*64*|ia64*)\n              ;;\n            *)\n\t      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'\n              ;;\n          esac\n        fi\n        case $host_cpu in\n          hppa*64*|ia64*)\n            _LT_TAGVAR(hardcode_direct, $1)=no\n            _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n            ;;\n          *)\n            _LT_TAGVAR(hardcode_direct, $1)=yes\n            _LT_TAGVAR(hardcode_direct_absolute, $1)=yes\n            _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,\n\t\t\t\t\t         # but as the default\n\t\t\t\t\t         # location of the library.\n            ;;\n        esac\n\n        case $cc_basename in\n          CC*)\n\t    # FIXME: insert proper C++ library support\n\t    _LT_TAGVAR(ld_shlibs, $1)=no\n\t    ;;\n          aCC*)\n\t    case $host_cpu in\n\t      hppa*64*)\n\t        _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'\n\t        ;;\n\t      ia64*)\n\t        _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'\n\t        ;;\n\t      *)\n\t        _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'\n\t        ;;\n\t    esac\n\t    # Commands to make compiler produce verbose output that lists\n\t    # what \"hidden\" libraries, object files and flags are used when\n\t    # linking a shared library.\n\t    #\n\t    # There doesn't appear to be a way to prevent this compiler from\n\t    # explicitly linking system object files so we need to strip them\n\t    # from the output so that they don't get included in the library\n\t    # dependencies.\n\t    output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP \"\\-L\"`; list=\"\"; for z in $templist; do case $z in conftest.$objext) list=\"$list $z\";; *.$objext);; *) list=\"$list $z\";;esac; done; $ECHO \"X$list\" | $Xsed'\n\t    ;;\n          *)\n\t    if test \"$GXX\" = yes; then\n\t      if test $with_gnu_ld = no; then\n\t        case $host_cpu in\n\t          hppa*64*)\n\t            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'\n\t            ;;\n\t          ia64*)\n\t            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'\n\t            ;;\n\t          *)\n\t            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'\n\t            ;;\n\t        esac\n\t      fi\n\t    else\n\t      # FIXME: insert proper C++ library support\n\t      _LT_TAGVAR(ld_shlibs, $1)=no\n\t    fi\n\t    ;;\n        esac\n        ;;\n\n      interix[[3-9]]*)\n\t_LT_TAGVAR(hardcode_direct, $1)=no\n\t_LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n\t_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'\n\t_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'\n\t# Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.\n\t# Instead, shared libraries are loaded at an image base (0x10000000 by\n\t# default) and relocated if they conflict, which is a slow very memory\n\t# consuming and fragmenting process.  To avoid this, we pick a random,\n\t# 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link\n\t# time.  Moving up from 0x10000000 also allows more sbrk(2) space.\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \\* 262144 + 1342177280` -o $lib'\n\t_LT_TAGVAR(archive_expsym_cmds, $1)='sed \"s,^,_,\" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \\* 262144 + 1342177280` -o $lib'\n\t;;\n      irix5* | irix6*)\n        case $cc_basename in\n          CC*)\n\t    # SGI C++\n\t    _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n \"$verstring\" && $ECHO \"X-set_version $verstring\" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'\n\n\t    # Archives containing C++ object files must be created using\n\t    # \"CC -ar\", where \"CC\" is the IRIX C++ compiler.  This is\n\t    # necessary to make sure instantiated templates are included\n\t    # in the archive.\n\t    _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs'\n\t    ;;\n          *)\n\t    if test \"$GXX\" = yes; then\n\t      if test \"$with_gnu_ld\" = no; then\n\t        _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n \"$verstring\" && $ECHO \"X${wl}-set_version ${wl}$verstring\" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'\n\t      else\n\t        _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n \"$verstring\" && $ECHO \"X${wl}-set_version ${wl}$verstring\" | $Xsed` -o $lib'\n\t      fi\n\t    fi\n\t    _LT_TAGVAR(link_all_deplibs, $1)=yes\n\t    ;;\n        esac\n        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'\n        _LT_TAGVAR(hardcode_libdir_separator, $1)=:\n        _LT_TAGVAR(inherit_rpath, $1)=yes\n        ;;\n\n      linux* | k*bsd*-gnu)\n        case $cc_basename in\n          KCC*)\n\t    # Kuck and Associates, Inc. (KAI) C++ Compiler\n\n\t    # KCC will only create a shared library if the output file\n\t    # ends with \".so\" (or \".sl\" for HP-UX), so rename the library\n\t    # to its proper name (with version) after linking.\n\t    _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\\''s/\\([[^()0-9A-Za-z{}]]\\)/\\\\\\\\\\1/g'\\''`; templib=`echo $lib | $SED -e \"s/\\${tempext}\\..*/.so/\"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \\$templib; mv \\$templib $lib'\n\t    _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\\''s/\\([[^()0-9A-Za-z{}]]\\)/\\\\\\\\\\1/g'\\''`; templib=`echo $lib | $SED -e \"s/\\${tempext}\\..*/.so/\"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \\$templib ${wl}-retain-symbols-file,$export_symbols; mv \\$templib $lib'\n\t    # Commands to make compiler produce verbose output that lists\n\t    # what \"hidden\" libraries, object files and flags are used when\n\t    # linking a shared library.\n\t    #\n\t    # There doesn't appear to be a way to prevent this compiler from\n\t    # explicitly linking system object files so we need to strip them\n\t    # from the output so that they don't get included in the library\n\t    # dependencies.\n\t    output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP \"ld\"`; rm -f libconftest$shared_ext; list=\"\"; for z in $templist; do case $z in conftest.$objext) list=\"$list $z\";; *.$objext);; *) list=\"$list $z\";;esac; done; $ECHO \"X$list\" | $Xsed'\n\n\t    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'\n\t    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'\n\n\t    # Archives containing C++ object files must be created using\n\t    # \"CC -Bstatic\", where \"CC\" is the KAI C++ compiler.\n\t    _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'\n\t    ;;\n\t  icpc* | ecpc* )\n\t    # Intel C++\n\t    with_gnu_ld=yes\n\t    # version 8.0 and above of icpc choke on multiply defined symbols\n\t    # if we add $predep_objects and $postdep_objects, however 7.1 and\n\t    # earlier do not add the objects themselves.\n\t    case `$CC -V 2>&1` in\n\t      *\"Version 7.\"*)\n\t        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'\n\t\t_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'\n\t\t;;\n\t      *)  # Version 8.0 or newer\n\t        tmp_idyn=\n\t        case $host_cpu in\n\t\t  ia64*) tmp_idyn=' -i_dynamic';;\n\t\tesac\n\t        _LT_TAGVAR(archive_cmds, $1)='$CC -shared'\"$tmp_idyn\"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n\t\t_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'\"$tmp_idyn\"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'\n\t\t;;\n\t    esac\n\t    _LT_TAGVAR(archive_cmds_need_lc, $1)=no\n\t    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'\n\t    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'\n\t    _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'\n\t    ;;\n          pgCC* | pgcpp*)\n            # Portland Group C++ compiler\n\t    case `$CC -V` in\n\t    *pgCC\\ [[1-5]]* | *pgcpp\\ [[1-5]]*)\n\t      _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~\n\t\trm -rf $tpldir~\n\t\t$CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~\n\t\tcompile_command=\"$compile_command `find $tpldir -name \\*.o | $NL2SP`\"'\n\t      _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~\n\t\trm -rf $tpldir~\n\t\t$CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~\n\t\t$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \\*.o | $NL2SP`~\n\t\t$RANLIB $oldlib'\n\t      _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~\n\t\trm -rf $tpldir~\n\t\t$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~\n\t\t$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \\*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'\n\t      _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~\n\t\trm -rf $tpldir~\n\t\t$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~\n\t\t$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \\*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'\n\t      ;;\n\t    *) # Version 6 will use weak symbols\n\t      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'\n\t      _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'\n\t      ;;\n\t    esac\n\n\t    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'\n\t    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'\n\t    _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\\\"\\\"; do test  -n \\\"$conv\\\" && new_convenience=\\\"$new_convenience,$conv\\\"; done; $ECHO \\\"$new_convenience\\\"` ${wl}--no-whole-archive'\n            ;;\n\t  cxx*)\n\t    # Compaq C++\n\t    _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'\n\t    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname  -o $lib ${wl}-retain-symbols-file $wl$export_symbols'\n\n\t    runpath_var=LD_RUN_PATH\n\t    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'\n\t    _LT_TAGVAR(hardcode_libdir_separator, $1)=:\n\n\t    # Commands to make compiler produce verbose output that lists\n\t    # what \"hidden\" libraries, object files and flags are used when\n\t    # linking a shared library.\n\t    #\n\t    # There doesn't appear to be a way to prevent this compiler from\n\t    # explicitly linking system object files so we need to strip them\n\t    # from the output so that they don't get included in the library\n\t    # dependencies.\n\t    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP \"ld\"`; templist=`$ECHO \"X$templist\" | $Xsed -e \"s/\\(^.*ld.*\\)\\( .*ld .*$\\)/\\1/\"`; list=\"\"; for z in $templist; do case $z in conftest.$objext) list=\"$list $z\";; *.$objext);; *) list=\"$list $z\";;esac; done; $ECHO \"X$list\" | $Xsed'\n\t    ;;\n\t  xl*)\n\t    # IBM XL 8.0 on PPC, with GNU ld\n\t    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'\n\t    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'\n\t    _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n\t    if test \"x$supports_anon_versioning\" = xyes; then\n\t      _LT_TAGVAR(archive_expsym_cmds, $1)='echo \"{ global:\" > $output_objdir/$libname.ver~\n\t\tcat $export_symbols | sed -e \"s/\\(.*\\)/\\1;/\" >> $output_objdir/$libname.ver~\n\t\techo \"local: *; };\" >> $output_objdir/$libname.ver~\n\t\t$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'\n\t    fi\n\t    ;;\n\t  *)\n\t    case `$CC -V 2>&1 | sed 5q` in\n\t    *Sun\\ C*)\n\t      # Sun C++ 5.9\n\t      _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'\n\t      _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'\n\t      _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'\n\t      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'\n\t      _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\\\"\\\"; do test -z \\\"$conv\\\" || new_convenience=\\\"$new_convenience,$conv\\\"; done; $ECHO \\\"$new_convenience\\\"` ${wl}--no-whole-archive'\n\t      _LT_TAGVAR(compiler_needs_object, $1)=yes\n\n\t      # Not sure whether something based on\n\t      # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1\n\t      # would be better.\n\t      output_verbose_link_cmd='echo'\n\n\t      # Archives containing C++ object files must be created using\n\t      # \"CC -xar\", where \"CC\" is the Sun C++ compiler.  This is\n\t      # necessary to make sure instantiated templates are included\n\t      # in the archive.\n\t      _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'\n\t      ;;\n\t    esac\n\t    ;;\n\tesac\n\t;;\n\n      lynxos*)\n        # FIXME: insert proper C++ library support\n\t_LT_TAGVAR(ld_shlibs, $1)=no\n\t;;\n\n      m88k*)\n        # FIXME: insert proper C++ library support\n        _LT_TAGVAR(ld_shlibs, $1)=no\n\t;;\n\n      mvs*)\n        case $cc_basename in\n          cxx*)\n\t    # FIXME: insert proper C++ library support\n\t    _LT_TAGVAR(ld_shlibs, $1)=no\n\t    ;;\n\t  *)\n\t    # FIXME: insert proper C++ library support\n\t    _LT_TAGVAR(ld_shlibs, $1)=no\n\t    ;;\n\tesac\n\t;;\n\n      netbsd*)\n        if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then\n\t  _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable  -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'\n\t  wlarc=\n\t  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'\n\t  _LT_TAGVAR(hardcode_direct, $1)=yes\n\t  _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n\tfi\n\t# Workaround some broken pre-1.5 toolchains\n\toutput_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e \"s:-lgcc -lc -lgcc::\"'\n\t;;\n\n      *nto* | *qnx*)\n        _LT_TAGVAR(ld_shlibs, $1)=yes\n\t;;\n\n      openbsd2*)\n        # C++ shared libraries are fairly broken\n\t_LT_TAGVAR(ld_shlibs, $1)=no\n\t;;\n\n      openbsd*)\n\tif test -f /usr/libexec/ld.so; then\n\t  _LT_TAGVAR(hardcode_direct, $1)=yes\n\t  _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n\t  _LT_TAGVAR(hardcode_direct_absolute, $1)=yes\n\t  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'\n\t  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'\n\t  if test -z \"`echo __ELF__ | $CC -E - | grep __ELF__`\" || test \"$host_os-$host_cpu\" = \"openbsd2.8-powerpc\"; then\n\t    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'\n\t    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'\n\t    _LT_TAGVAR(whole_archive_flag_spec, $1)=\"$wlarc\"'--whole-archive$convenience '\"$wlarc\"'--no-whole-archive'\n\t  fi\n\t  output_verbose_link_cmd=echo\n\telse\n\t  _LT_TAGVAR(ld_shlibs, $1)=no\n\tfi\n\t;;\n\n      osf3* | osf4* | osf5*)\n        case $cc_basename in\n          KCC*)\n\t    # Kuck and Associates, Inc. (KAI) C++ Compiler\n\n\t    # KCC will only create a shared library if the output file\n\t    # ends with \".so\" (or \".sl\" for HP-UX), so rename the library\n\t    # to its proper name (with version) after linking.\n\t    _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\\''s/\\([[^()0-9A-Za-z{}]]\\)/\\\\\\\\\\1/g'\\''`; templib=`echo \"$lib\" | $SED -e \"s/\\${tempext}\\..*/.so/\"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \\$templib; mv \\$templib $lib'\n\n\t    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'\n\t    _LT_TAGVAR(hardcode_libdir_separator, $1)=:\n\n\t    # Archives containing C++ object files must be created using\n\t    # the KAI C++ compiler.\n\t    case $host in\n\t      osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;;\n\t      *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;;\n\t    esac\n\t    ;;\n          RCC*)\n\t    # Rational C++ 2.4.1\n\t    # FIXME: insert proper C++ library support\n\t    _LT_TAGVAR(ld_shlibs, $1)=no\n\t    ;;\n          cxx*)\n\t    case $host in\n\t      osf3*)\n\t        _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\\*'\n\t        _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n \"$verstring\" && $ECHO \"X${wl}-set_version $verstring\" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'\n\t        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'\n\t\t;;\n\t      *)\n\t        _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \\*'\n\t        _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n \"$verstring\" && $ECHO \"X-set_version $verstring\" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'\n\t        _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf \"%s %s\\\\n\" -exported_symbol \"\\$i\" >> $lib.exp; done~\n\t          echo \"-hidden\">> $lib.exp~\n\t          $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp  `test -n \"$verstring\" && $ECHO \"X-set_version $verstring\" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~\n\t          $RM $lib.exp'\n\t        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'\n\t\t;;\n\t    esac\n\n\t    _LT_TAGVAR(hardcode_libdir_separator, $1)=:\n\n\t    # Commands to make compiler produce verbose output that lists\n\t    # what \"hidden\" libraries, object files and flags are used when\n\t    # linking a shared library.\n\t    #\n\t    # There doesn't appear to be a way to prevent this compiler from\n\t    # explicitly linking system object files so we need to strip them\n\t    # from the output so that they don't get included in the library\n\t    # dependencies.\n\t    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP \"ld\" | $GREP -v \"ld:\"`; templist=`$ECHO \"X$templist\" | $Xsed -e \"s/\\(^.*ld.*\\)\\( .*ld.*$\\)/\\1/\"`; list=\"\"; for z in $templist; do case $z in conftest.$objext) list=\"$list $z\";; *.$objext);; *) list=\"$list $z\";;esac; done; $ECHO \"X$list\" | $Xsed'\n\t    ;;\n\t  *)\n\t    if test \"$GXX\" = yes && test \"$with_gnu_ld\" = no; then\n\t      _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\\*'\n\t      case $host in\n\t        osf3*)\n\t          _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n \"$verstring\" && $ECHO \"X${wl}-set_version ${wl}$verstring\" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'\n\t\t  ;;\n\t        *)\n\t          _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n \"$verstring\" && $ECHO \"${wl}-set_version ${wl}$verstring\" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'\n\t\t  ;;\n\t      esac\n\n\t      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'\n\t      _LT_TAGVAR(hardcode_libdir_separator, $1)=:\n\n\t      # Commands to make compiler produce verbose output that lists\n\t      # what \"hidden\" libraries, object files and flags are used when\n\t      # linking a shared library.\n\t      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP \"\\-L\"'\n\n\t    else\n\t      # FIXME: insert proper C++ library support\n\t      _LT_TAGVAR(ld_shlibs, $1)=no\n\t    fi\n\t    ;;\n        esac\n        ;;\n\n      psos*)\n        # FIXME: insert proper C++ library support\n        _LT_TAGVAR(ld_shlibs, $1)=no\n        ;;\n\n      sunos4*)\n        case $cc_basename in\n          CC*)\n\t    # Sun C++ 4.x\n\t    # FIXME: insert proper C++ library support\n\t    _LT_TAGVAR(ld_shlibs, $1)=no\n\t    ;;\n          lcc*)\n\t    # Lucid\n\t    # FIXME: insert proper C++ library support\n\t    _LT_TAGVAR(ld_shlibs, $1)=no\n\t    ;;\n          *)\n\t    # FIXME: insert proper C++ library support\n\t    _LT_TAGVAR(ld_shlibs, $1)=no\n\t    ;;\n        esac\n        ;;\n\n      solaris*)\n        case $cc_basename in\n          CC*)\n\t    # Sun C++ 4.2, 5.x and Centerline C++\n            _LT_TAGVAR(archive_cmds_need_lc,$1)=yes\n\t    _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'\n\t    _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag}  -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'\n\t    _LT_TAGVAR(archive_expsym_cmds, $1)='echo \"{ global:\" > $lib.exp~cat $export_symbols | $SED -e \"s/\\(.*\\)/\\1;/\" >> $lib.exp~echo \"local: *; };\" >> $lib.exp~\n\t      $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'\n\n\t    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'\n\t    _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n\t    case $host_os in\n\t      solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;\n\t      *)\n\t\t# The compiler driver will combine and reorder linker options,\n\t\t# but understands `-z linker_flag'.\n\t        # Supported since Solaris 2.6 (maybe 2.5.1?)\n\t\t_LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'\n\t        ;;\n\t    esac\n\t    _LT_TAGVAR(link_all_deplibs, $1)=yes\n\n\t    output_verbose_link_cmd='echo'\n\n\t    # Archives containing C++ object files must be created using\n\t    # \"CC -xar\", where \"CC\" is the Sun C++ compiler.  This is\n\t    # necessary to make sure instantiated templates are included\n\t    # in the archive.\n\t    _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'\n\t    ;;\n          gcx*)\n\t    # Green Hills C++ Compiler\n\t    _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'\n\n\t    # The C++ compiler must be used to create the archive.\n\t    _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs'\n\t    ;;\n          *)\n\t    # GNU C++ compiler with Solaris linker\n\t    if test \"$GXX\" = yes && test \"$with_gnu_ld\" = no; then\n\t      _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs'\n\t      if $CC --version | $GREP -v '^2\\.7' > /dev/null; then\n\t        _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'\n\t        _LT_TAGVAR(archive_expsym_cmds, $1)='echo \"{ global:\" > $lib.exp~cat $export_symbols | $SED -e \"s/\\(.*\\)/\\1;/\" >> $lib.exp~echo \"local: *; };\" >> $lib.exp~\n\t\t  $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'\n\n\t        # Commands to make compiler produce verbose output that lists\n\t        # what \"hidden\" libraries, object files and flags are used when\n\t        # linking a shared library.\n\t        output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP \"\\-L\"'\n\t      else\n\t        # g++ 2.7 appears to require `-G' NOT `-shared' on this\n\t        # platform.\n\t        _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'\n\t        _LT_TAGVAR(archive_expsym_cmds, $1)='echo \"{ global:\" > $lib.exp~cat $export_symbols | $SED -e \"s/\\(.*\\)/\\1;/\" >> $lib.exp~echo \"local: *; };\" >> $lib.exp~\n\t\t  $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'\n\n\t        # Commands to make compiler produce verbose output that lists\n\t        # what \"hidden\" libraries, object files and flags are used when\n\t        # linking a shared library.\n\t        output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP \"\\-L\"'\n\t      fi\n\n\t      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir'\n\t      case $host_os in\n\t\tsolaris2.[[0-5]] | solaris2.[[0-5]].*) ;;\n\t\t*)\n\t\t  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'\n\t\t  ;;\n\t      esac\n\t    fi\n\t    ;;\n        esac\n        ;;\n\n    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)\n      _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'\n      _LT_TAGVAR(archive_cmds_need_lc, $1)=no\n      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n      runpath_var='LD_RUN_PATH'\n\n      case $cc_basename in\n        CC*)\n\t  _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t  _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t  ;;\n\t*)\n\t  _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t  _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t  ;;\n      esac\n      ;;\n\n      sysv5* | sco3.2v5* | sco5v6*)\n\t# Note: We can NOT use -z defs as we might desire, because we do not\n\t# link with -lc, and that would cause any symbols used from libc to\n\t# always be unresolved, which means just about no library would\n\t# ever link correctly.  If we're not using GNU ld we use -z text\n\t# though, which does catch some bad symbols but isn't as heavy-handed\n\t# as -z defs.\n\t_LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'\n\t_LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'\n\t_LT_TAGVAR(archive_cmds_need_lc, $1)=no\n\t_LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n\t_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'\n\t_LT_TAGVAR(hardcode_libdir_separator, $1)=':'\n\t_LT_TAGVAR(link_all_deplibs, $1)=yes\n\t_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'\n\trunpath_var='LD_RUN_PATH'\n\n\tcase $cc_basename in\n          CC*)\n\t    _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t    ;;\n\t  *)\n\t    _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t    ;;\n\tesac\n      ;;\n\n      tandem*)\n        case $cc_basename in\n          NCC*)\n\t    # NonStop-UX NCC 3.20\n\t    # FIXME: insert proper C++ library support\n\t    _LT_TAGVAR(ld_shlibs, $1)=no\n\t    ;;\n          *)\n\t    # FIXME: insert proper C++ library support\n\t    _LT_TAGVAR(ld_shlibs, $1)=no\n\t    ;;\n        esac\n        ;;\n\n      vxworks*)\n        # FIXME: insert proper C++ library support\n        _LT_TAGVAR(ld_shlibs, $1)=no\n        ;;\n\n      *)\n        # FIXME: insert proper C++ library support\n        _LT_TAGVAR(ld_shlibs, $1)=no\n        ;;\n    esac\n\n    AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])\n    test \"$_LT_TAGVAR(ld_shlibs, $1)\" = no && can_build_shared=no\n\n    _LT_TAGVAR(GCC, $1)=\"$GXX\"\n    _LT_TAGVAR(LD, $1)=\"$LD\"\n\n    ## CAVEAT EMPTOR:\n    ## There is no encapsulation within the following macros, do not change\n    ## the running order or otherwise move them around unless you know exactly\n    ## what you are doing...\n    _LT_SYS_HIDDEN_LIBDEPS($1)\n    _LT_COMPILER_PIC($1)\n    _LT_COMPILER_C_O($1)\n    _LT_COMPILER_FILE_LOCKS($1)\n    _LT_LINKER_SHLIBS($1)\n    _LT_SYS_DYNAMIC_LINKER($1)\n    _LT_LINKER_HARDCODE_LIBPATH($1)\n\n    _LT_CONFIG($1)\n  fi # test -n \"$compiler\"\n\n  CC=$lt_save_CC\n  LDCXX=$LD\n  LD=$lt_save_LD\n  GCC=$lt_save_GCC\n  with_gnu_ld=$lt_save_with_gnu_ld\n  lt_cv_path_LDCXX=$lt_cv_path_LD\n  lt_cv_path_LD=$lt_save_path_LD\n  lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld\n  lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld\nfi # test \"$_lt_caught_CXX_error\" != yes\n\nAC_LANG_POP\n])# _LT_LANG_CXX_CONFIG\n\n\n# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME])\n# ---------------------------------\n# Figure out \"hidden\" library dependencies from verbose\n# compiler output when linking a shared library.\n# Parse the compiler output and extract the necessary\n# objects, libraries and library flags.\nm4_defun([_LT_SYS_HIDDEN_LIBDEPS],\n[m4_require([_LT_FILEUTILS_DEFAULTS])dnl\n# Dependencies to place before and after the object being linked:\n_LT_TAGVAR(predep_objects, $1)=\n_LT_TAGVAR(postdep_objects, $1)=\n_LT_TAGVAR(predeps, $1)=\n_LT_TAGVAR(postdeps, $1)=\n_LT_TAGVAR(compiler_lib_search_path, $1)=\n\ndnl we can't use the lt_simple_compile_test_code here,\ndnl because it contains code intended for an executable,\ndnl not a library.  It's possible we should let each\ndnl tag define a new lt_????_link_test_code variable,\ndnl but it's only used here...\nm4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF\nint a;\nvoid foo (void) { a = 0; }\n_LT_EOF\n], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF\nclass Foo\n{\npublic:\n  Foo (void) { a = 0; }\nprivate:\n  int a;\n};\n_LT_EOF\n], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF\n      subroutine foo\n      implicit none\n      integer*4 a\n      a=0\n      return\n      end\n_LT_EOF\n], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF\n      subroutine foo\n      implicit none\n      integer a\n      a=0\n      return\n      end\n_LT_EOF\n], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF\npublic class foo {\n  private int a;\n  public void bar (void) {\n    a = 0;\n  }\n};\n_LT_EOF\n])\ndnl Parse the compiler output and extract the necessary\ndnl objects, libraries and library flags.\nif AC_TRY_EVAL(ac_compile); then\n  # Parse the compiler output and extract the necessary\n  # objects, libraries and library flags.\n\n  # Sentinel used to keep track of whether or not we are before\n  # the conftest object file.\n  pre_test_object_deps_done=no\n\n  for p in `eval \"$output_verbose_link_cmd\"`; do\n    case $p in\n\n    -L* | -R* | -l*)\n       # Some compilers place space between \"-{L,R}\" and the path.\n       # Remove the space.\n       if test $p = \"-L\" ||\n          test $p = \"-R\"; then\n\t prev=$p\n\t continue\n       else\n\t prev=\n       fi\n\n       if test \"$pre_test_object_deps_done\" = no; then\n\t case $p in\n\t -L* | -R*)\n\t   # Internal compiler library paths should come after those\n\t   # provided the user.  The postdeps already come after the\n\t   # user supplied libs so there is no need to process them.\n\t   if test -z \"$_LT_TAGVAR(compiler_lib_search_path, $1)\"; then\n\t     _LT_TAGVAR(compiler_lib_search_path, $1)=\"${prev}${p}\"\n\t   else\n\t     _LT_TAGVAR(compiler_lib_search_path, $1)=\"${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}\"\n\t   fi\n\t   ;;\n\t # The \"-l\" case would never come before the object being\n\t # linked, so don't bother handling this case.\n\t esac\n       else\n\t if test -z \"$_LT_TAGVAR(postdeps, $1)\"; then\n\t   _LT_TAGVAR(postdeps, $1)=\"${prev}${p}\"\n\t else\n\t   _LT_TAGVAR(postdeps, $1)=\"${_LT_TAGVAR(postdeps, $1)} ${prev}${p}\"\n\t fi\n       fi\n       ;;\n\n    *.$objext)\n       # This assumes that the test object file only shows up\n       # once in the compiler output.\n       if test \"$p\" = \"conftest.$objext\"; then\n\t pre_test_object_deps_done=yes\n\t continue\n       fi\n\n       if test \"$pre_test_object_deps_done\" = no; then\n\t if test -z \"$_LT_TAGVAR(predep_objects, $1)\"; then\n\t   _LT_TAGVAR(predep_objects, $1)=\"$p\"\n\t else\n\t   _LT_TAGVAR(predep_objects, $1)=\"$_LT_TAGVAR(predep_objects, $1) $p\"\n\t fi\n       else\n\t if test -z \"$_LT_TAGVAR(postdep_objects, $1)\"; then\n\t   _LT_TAGVAR(postdep_objects, $1)=\"$p\"\n\t else\n\t   _LT_TAGVAR(postdep_objects, $1)=\"$_LT_TAGVAR(postdep_objects, $1) $p\"\n\t fi\n       fi\n       ;;\n\n    *) ;; # Ignore the rest.\n\n    esac\n  done\n\n  # Clean up.\n  rm -f a.out a.exe\nelse\n  echo \"libtool.m4: error: problem compiling $1 test program\"\nfi\n\n$RM -f confest.$objext\n\n# PORTME: override above test on systems where it is broken\nm4_if([$1], [CXX],\n[case $host_os in\ninterix[[3-9]]*)\n  # Interix 3.5 installs completely hosed .la files for C++, so rather than\n  # hack all around it, let's just trust \"g++\" to DTRT.\n  _LT_TAGVAR(predep_objects,$1)=\n  _LT_TAGVAR(postdep_objects,$1)=\n  _LT_TAGVAR(postdeps,$1)=\n  ;;\n\nlinux*)\n  case `$CC -V 2>&1 | sed 5q` in\n  *Sun\\ C*)\n    # Sun C++ 5.9\n\n    # The more standards-conforming stlport4 library is\n    # incompatible with the Cstd library. Avoid specifying\n    # it if it's in CXXFLAGS. Ignore libCrun as\n    # -library=stlport4 depends on it.\n    case \" $CXX $CXXFLAGS \" in\n    *\" -library=stlport4 \"*)\n      solaris_use_stlport4=yes\n      ;;\n    esac\n\n    if test \"$solaris_use_stlport4\" != yes; then\n      _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'\n    fi\n    ;;\n  esac\n  ;;\n\nsolaris*)\n  case $cc_basename in\n  CC*)\n    # The more standards-conforming stlport4 library is\n    # incompatible with the Cstd library. Avoid specifying\n    # it if it's in CXXFLAGS. Ignore libCrun as\n    # -library=stlport4 depends on it.\n    case \" $CXX $CXXFLAGS \" in\n    *\" -library=stlport4 \"*)\n      solaris_use_stlport4=yes\n      ;;\n    esac\n\n    # Adding this requires a known-good setup of shared libraries for\n    # Sun compiler versions before 5.6, else PIC objects from an old\n    # archive will be linked into the output, leading to subtle bugs.\n    if test \"$solaris_use_stlport4\" != yes; then\n      _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'\n    fi\n    ;;\n  esac\n  ;;\nesac\n])\n\ncase \" $_LT_TAGVAR(postdeps, $1) \" in\n*\" -lc \"*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;;\nesac\n _LT_TAGVAR(compiler_lib_search_dirs, $1)=\nif test -n \"${_LT_TAGVAR(compiler_lib_search_path, $1)}\"; then\n _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo \" ${_LT_TAGVAR(compiler_lib_search_path, $1)}\" | ${SED} -e 's! -L! !g' -e 's!^ !!'`\nfi\n_LT_TAGDECL([], [compiler_lib_search_dirs], [1],\n    [The directories searched by this compiler when creating a shared library])\n_LT_TAGDECL([], [predep_objects], [1],\n    [Dependencies to place before and after the objects being linked to\n    create a shared library])\n_LT_TAGDECL([], [postdep_objects], [1])\n_LT_TAGDECL([], [predeps], [1])\n_LT_TAGDECL([], [postdeps], [1])\n_LT_TAGDECL([], [compiler_lib_search_path], [1],\n    [The library search path used internally by the compiler when linking\n    a shared library])\n])# _LT_SYS_HIDDEN_LIBDEPS\n\n\n# _LT_PROG_F77\n# ------------\n# Since AC_PROG_F77 is broken, in that it returns the empty string\n# if there is no fortran compiler, we have our own version here.\nm4_defun([_LT_PROG_F77],\n[\npushdef([AC_MSG_ERROR], [_lt_disable_F77=yes])\nAC_PROG_F77\nif test -z \"$F77\" || test \"X$F77\" = \"Xno\"; then\n  _lt_disable_F77=yes\nfi\npopdef([AC_MSG_ERROR])\n])# _LT_PROG_F77\n\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([_LT_PROG_F77], [])\n\n\n# _LT_LANG_F77_CONFIG([TAG])\n# --------------------------\n# Ensure that the configuration variables for a Fortran 77 compiler are\n# suitably defined.  These variables are subsequently used by _LT_CONFIG\n# to write the compiler configuration to `libtool'.\nm4_defun([_LT_LANG_F77_CONFIG],\n[AC_REQUIRE([_LT_PROG_F77])dnl\nAC_LANG_PUSH(Fortran 77)\n\n_LT_TAGVAR(archive_cmds_need_lc, $1)=no\n_LT_TAGVAR(allow_undefined_flag, $1)=\n_LT_TAGVAR(always_export_symbols, $1)=no\n_LT_TAGVAR(archive_expsym_cmds, $1)=\n_LT_TAGVAR(export_dynamic_flag_spec, $1)=\n_LT_TAGVAR(hardcode_direct, $1)=no\n_LT_TAGVAR(hardcode_direct_absolute, $1)=no\n_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=\n_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=\n_LT_TAGVAR(hardcode_libdir_separator, $1)=\n_LT_TAGVAR(hardcode_minus_L, $1)=no\n_LT_TAGVAR(hardcode_automatic, $1)=no\n_LT_TAGVAR(inherit_rpath, $1)=no\n_LT_TAGVAR(module_cmds, $1)=\n_LT_TAGVAR(module_expsym_cmds, $1)=\n_LT_TAGVAR(link_all_deplibs, $1)=unknown\n_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds\n_LT_TAGVAR(no_undefined_flag, $1)=\n_LT_TAGVAR(whole_archive_flag_spec, $1)=\n_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no\n\n# Source file extension for f77 test sources.\nac_ext=f\n\n# Object file extension for compiled f77 test sources.\nobjext=o\n_LT_TAGVAR(objext, $1)=$objext\n\n# No sense in running all these tests if we already determined that\n# the F77 compiler isn't working.  Some variables (like enable_shared)\n# are currently assumed to apply to all compilers on this platform,\n# and will be corrupted by setting them based on a non-working compiler.\nif test \"$_lt_disable_F77\" != yes; then\n  # Code to be used in simple compile tests\n  lt_simple_compile_test_code=\"\\\n      subroutine t\n      return\n      end\n\"\n\n  # Code to be used in simple link tests\n  lt_simple_link_test_code=\"\\\n      program t\n      end\n\"\n\n  # ltmain only uses $CC for tagged configurations so make sure $CC is set.\n  _LT_TAG_COMPILER\n\n  # save warnings/boilerplate of simple test code\n  _LT_COMPILER_BOILERPLATE\n  _LT_LINKER_BOILERPLATE\n\n  # Allow CC to be a program name with arguments.\n  lt_save_CC=\"$CC\"\n  lt_save_GCC=$GCC\n  CC=${F77-\"f77\"}\n  compiler=$CC\n  _LT_TAGVAR(compiler, $1)=$CC\n  _LT_CC_BASENAME([$compiler])\n  GCC=$G77\n  if test -n \"$compiler\"; then\n    AC_MSG_CHECKING([if libtool supports shared libraries])\n    AC_MSG_RESULT([$can_build_shared])\n\n    AC_MSG_CHECKING([whether to build shared libraries])\n    test \"$can_build_shared\" = \"no\" && enable_shared=no\n\n    # On AIX, shared libraries and static libraries use the same namespace, and\n    # are all built from PIC.\n    case $host_os in\n      aix3*)\n        test \"$enable_shared\" = yes && enable_static=no\n        if test -n \"$RANLIB\"; then\n          archive_cmds=\"$archive_cmds~\\$RANLIB \\$lib\"\n          postinstall_cmds='$RANLIB $lib'\n        fi\n        ;;\n      aix[[4-9]]*)\n\tif test \"$host_cpu\" != ia64 && test \"$aix_use_runtimelinking\" = no ; then\n\t  test \"$enable_shared\" = yes && enable_static=no\n\tfi\n        ;;\n    esac\n    AC_MSG_RESULT([$enable_shared])\n\n    AC_MSG_CHECKING([whether to build static libraries])\n    # Make sure either enable_shared or enable_static is yes.\n    test \"$enable_shared\" = yes || enable_static=yes\n    AC_MSG_RESULT([$enable_static])\n\n    _LT_TAGVAR(GCC, $1)=\"$G77\"\n    _LT_TAGVAR(LD, $1)=\"$LD\"\n\n    ## CAVEAT EMPTOR:\n    ## There is no encapsulation within the following macros, do not change\n    ## the running order or otherwise move them around unless you know exactly\n    ## what you are doing...\n    _LT_COMPILER_PIC($1)\n    _LT_COMPILER_C_O($1)\n    _LT_COMPILER_FILE_LOCKS($1)\n    _LT_LINKER_SHLIBS($1)\n    _LT_SYS_DYNAMIC_LINKER($1)\n    _LT_LINKER_HARDCODE_LIBPATH($1)\n\n    _LT_CONFIG($1)\n  fi # test -n \"$compiler\"\n\n  GCC=$lt_save_GCC\n  CC=\"$lt_save_CC\"\nfi # test \"$_lt_disable_F77\" != yes\n\nAC_LANG_POP\n])# _LT_LANG_F77_CONFIG\n\n\n# _LT_PROG_FC\n# -----------\n# Since AC_PROG_FC is broken, in that it returns the empty string\n# if there is no fortran compiler, we have our own version here.\nm4_defun([_LT_PROG_FC],\n[\npushdef([AC_MSG_ERROR], [_lt_disable_FC=yes])\nAC_PROG_FC\nif test -z \"$FC\" || test \"X$FC\" = \"Xno\"; then\n  _lt_disable_FC=yes\nfi\npopdef([AC_MSG_ERROR])\n])# _LT_PROG_FC\n\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([_LT_PROG_FC], [])\n\n\n# _LT_LANG_FC_CONFIG([TAG])\n# -------------------------\n# Ensure that the configuration variables for a Fortran compiler are\n# suitably defined.  These variables are subsequently used by _LT_CONFIG\n# to write the compiler configuration to `libtool'.\nm4_defun([_LT_LANG_FC_CONFIG],\n[AC_REQUIRE([_LT_PROG_FC])dnl\nAC_LANG_PUSH(Fortran)\n\n_LT_TAGVAR(archive_cmds_need_lc, $1)=no\n_LT_TAGVAR(allow_undefined_flag, $1)=\n_LT_TAGVAR(always_export_symbols, $1)=no\n_LT_TAGVAR(archive_expsym_cmds, $1)=\n_LT_TAGVAR(export_dynamic_flag_spec, $1)=\n_LT_TAGVAR(hardcode_direct, $1)=no\n_LT_TAGVAR(hardcode_direct_absolute, $1)=no\n_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=\n_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=\n_LT_TAGVAR(hardcode_libdir_separator, $1)=\n_LT_TAGVAR(hardcode_minus_L, $1)=no\n_LT_TAGVAR(hardcode_automatic, $1)=no\n_LT_TAGVAR(inherit_rpath, $1)=no\n_LT_TAGVAR(module_cmds, $1)=\n_LT_TAGVAR(module_expsym_cmds, $1)=\n_LT_TAGVAR(link_all_deplibs, $1)=unknown\n_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds\n_LT_TAGVAR(no_undefined_flag, $1)=\n_LT_TAGVAR(whole_archive_flag_spec, $1)=\n_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no\n\n# Source file extension for fc test sources.\nac_ext=${ac_fc_srcext-f}\n\n# Object file extension for compiled fc test sources.\nobjext=o\n_LT_TAGVAR(objext, $1)=$objext\n\n# No sense in running all these tests if we already determined that\n# the FC compiler isn't working.  Some variables (like enable_shared)\n# are currently assumed to apply to all compilers on this platform,\n# and will be corrupted by setting them based on a non-working compiler.\nif test \"$_lt_disable_FC\" != yes; then\n  # Code to be used in simple compile tests\n  lt_simple_compile_test_code=\"\\\n      subroutine t\n      return\n      end\n\"\n\n  # Code to be used in simple link tests\n  lt_simple_link_test_code=\"\\\n      program t\n      end\n\"\n\n  # ltmain only uses $CC for tagged configurations so make sure $CC is set.\n  _LT_TAG_COMPILER\n\n  # save warnings/boilerplate of simple test code\n  _LT_COMPILER_BOILERPLATE\n  _LT_LINKER_BOILERPLATE\n\n  # Allow CC to be a program name with arguments.\n  lt_save_CC=\"$CC\"\n  lt_save_GCC=$GCC\n  CC=${FC-\"f95\"}\n  compiler=$CC\n  GCC=$ac_cv_fc_compiler_gnu\n\n  _LT_TAGVAR(compiler, $1)=$CC\n  _LT_CC_BASENAME([$compiler])\n\n  if test -n \"$compiler\"; then\n    AC_MSG_CHECKING([if libtool supports shared libraries])\n    AC_MSG_RESULT([$can_build_shared])\n\n    AC_MSG_CHECKING([whether to build shared libraries])\n    test \"$can_build_shared\" = \"no\" && enable_shared=no\n\n    # On AIX, shared libraries and static libraries use the same namespace, and\n    # are all built from PIC.\n    case $host_os in\n      aix3*)\n        test \"$enable_shared\" = yes && enable_static=no\n        if test -n \"$RANLIB\"; then\n          archive_cmds=\"$archive_cmds~\\$RANLIB \\$lib\"\n          postinstall_cmds='$RANLIB $lib'\n        fi\n        ;;\n      aix[[4-9]]*)\n\tif test \"$host_cpu\" != ia64 && test \"$aix_use_runtimelinking\" = no ; then\n\t  test \"$enable_shared\" = yes && enable_static=no\n\tfi\n        ;;\n    esac\n    AC_MSG_RESULT([$enable_shared])\n\n    AC_MSG_CHECKING([whether to build static libraries])\n    # Make sure either enable_shared or enable_static is yes.\n    test \"$enable_shared\" = yes || enable_static=yes\n    AC_MSG_RESULT([$enable_static])\n\n    _LT_TAGVAR(GCC, $1)=\"$ac_cv_fc_compiler_gnu\"\n    _LT_TAGVAR(LD, $1)=\"$LD\"\n\n    ## CAVEAT EMPTOR:\n    ## There is no encapsulation within the following macros, do not change\n    ## the running order or otherwise move them around unless you know exactly\n    ## what you are doing...\n    _LT_SYS_HIDDEN_LIBDEPS($1)\n    _LT_COMPILER_PIC($1)\n    _LT_COMPILER_C_O($1)\n    _LT_COMPILER_FILE_LOCKS($1)\n    _LT_LINKER_SHLIBS($1)\n    _LT_SYS_DYNAMIC_LINKER($1)\n    _LT_LINKER_HARDCODE_LIBPATH($1)\n\n    _LT_CONFIG($1)\n  fi # test -n \"$compiler\"\n\n  GCC=$lt_save_GCC\n  CC=\"$lt_save_CC\"\nfi # test \"$_lt_disable_FC\" != yes\n\nAC_LANG_POP\n])# _LT_LANG_FC_CONFIG\n\n\n# _LT_LANG_GCJ_CONFIG([TAG])\n# --------------------------\n# Ensure that the configuration variables for the GNU Java Compiler compiler\n# are suitably defined.  These variables are subsequently used by _LT_CONFIG\n# to write the compiler configuration to `libtool'.\nm4_defun([_LT_LANG_GCJ_CONFIG],\n[AC_REQUIRE([LT_PROG_GCJ])dnl\nAC_LANG_SAVE\n\n# Source file extension for Java test sources.\nac_ext=java\n\n# Object file extension for compiled Java test sources.\nobjext=o\n_LT_TAGVAR(objext, $1)=$objext\n\n# Code to be used in simple compile tests\nlt_simple_compile_test_code=\"class foo {}\"\n\n# Code to be used in simple link tests\nlt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }'\n\n# ltmain only uses $CC for tagged configurations so make sure $CC is set.\n_LT_TAG_COMPILER\n\n# save warnings/boilerplate of simple test code\n_LT_COMPILER_BOILERPLATE\n_LT_LINKER_BOILERPLATE\n\n# Allow CC to be a program name with arguments.\nlt_save_CC=\"$CC\"\nlt_save_GCC=$GCC\nGCC=yes\nCC=${GCJ-\"gcj\"}\ncompiler=$CC\n_LT_TAGVAR(compiler, $1)=$CC\n_LT_TAGVAR(LD, $1)=\"$LD\"\n_LT_CC_BASENAME([$compiler])\n\n# GCJ did not exist at the time GCC didn't implicitly link libc in.\n_LT_TAGVAR(archive_cmds_need_lc, $1)=no\n\n_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds\n\n## CAVEAT EMPTOR:\n## There is no encapsulation within the following macros, do not change\n## the running order or otherwise move them around unless you know exactly\n## what you are doing...\nif test -n \"$compiler\"; then\n  _LT_COMPILER_NO_RTTI($1)\n  _LT_COMPILER_PIC($1)\n  _LT_COMPILER_C_O($1)\n  _LT_COMPILER_FILE_LOCKS($1)\n  _LT_LINKER_SHLIBS($1)\n  _LT_LINKER_HARDCODE_LIBPATH($1)\n\n  _LT_CONFIG($1)\nfi\n\nAC_LANG_RESTORE\n\nGCC=$lt_save_GCC\nCC=\"$lt_save_CC\"\n])# _LT_LANG_GCJ_CONFIG\n\n\n# _LT_LANG_RC_CONFIG([TAG])\n# -------------------------\n# Ensure that the configuration variables for the Windows resource compiler\n# are suitably defined.  These variables are subsequently used by _LT_CONFIG\n# to write the compiler configuration to `libtool'.\nm4_defun([_LT_LANG_RC_CONFIG],\n[AC_REQUIRE([LT_PROG_RC])dnl\nAC_LANG_SAVE\n\n# Source file extension for RC test sources.\nac_ext=rc\n\n# Object file extension for compiled RC test sources.\nobjext=o\n_LT_TAGVAR(objext, $1)=$objext\n\n# Code to be used in simple compile tests\nlt_simple_compile_test_code='sample MENU { MENUITEM \"&Soup\", 100, CHECKED }'\n\n# Code to be used in simple link tests\nlt_simple_link_test_code=\"$lt_simple_compile_test_code\"\n\n# ltmain only uses $CC for tagged configurations so make sure $CC is set.\n_LT_TAG_COMPILER\n\n# save warnings/boilerplate of simple test code\n_LT_COMPILER_BOILERPLATE\n_LT_LINKER_BOILERPLATE\n\n# Allow CC to be a program name with arguments.\nlt_save_CC=\"$CC\"\nlt_save_GCC=$GCC\nGCC=\nCC=${RC-\"windres\"}\ncompiler=$CC\n_LT_TAGVAR(compiler, $1)=$CC\n_LT_CC_BASENAME([$compiler])\n_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes\n\nif test -n \"$compiler\"; then\n  :\n  _LT_CONFIG($1)\nfi\n\nGCC=$lt_save_GCC\nAC_LANG_RESTORE\nCC=\"$lt_save_CC\"\n])# _LT_LANG_RC_CONFIG\n\n\n# LT_PROG_GCJ\n# -----------\nAC_DEFUN([LT_PROG_GCJ],\n[m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ],\n  [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ],\n    [AC_CHECK_TOOL(GCJ, gcj,)\n      test \"x${GCJFLAGS+set}\" = xset || GCJFLAGS=\"-g -O2\"\n      AC_SUBST(GCJFLAGS)])])[]dnl\n])\n\n# Old name:\nAU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ])\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([LT_AC_PROG_GCJ], [])\n\n\n# LT_PROG_RC\n# ----------\nAC_DEFUN([LT_PROG_RC],\n[AC_CHECK_TOOL(RC, windres,)\n])\n\n# Old name:\nAU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC])\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([LT_AC_PROG_RC], [])\n\n\n# _LT_DECL_EGREP\n# --------------\n# If we don't have a new enough Autoconf to choose the best grep\n# available, choose the one first in the user's PATH.\nm4_defun([_LT_DECL_EGREP],\n[AC_REQUIRE([AC_PROG_EGREP])dnl\nAC_REQUIRE([AC_PROG_FGREP])dnl\ntest -z \"$GREP\" && GREP=grep\n_LT_DECL([], [GREP], [1], [A grep program that handles long lines])\n_LT_DECL([], [EGREP], [1], [An ERE matcher])\n_LT_DECL([], [FGREP], [1], [A literal string matcher])\ndnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too\nAC_SUBST([GREP])\n])\n\n\n# _LT_DECL_OBJDUMP\n# --------------\n# If we don't have a new enough Autoconf to choose the best objdump\n# available, choose the one first in the user's PATH.\nm4_defun([_LT_DECL_OBJDUMP],\n[AC_CHECK_TOOL(OBJDUMP, objdump, false)\ntest -z \"$OBJDUMP\" && OBJDUMP=objdump\n_LT_DECL([], [OBJDUMP], [1], [An object symbol dumper])\nAC_SUBST([OBJDUMP])\n])\n\n\n# _LT_DECL_SED\n# ------------\n# Check for a fully-functional sed program, that truncates\n# as few characters as possible.  Prefer GNU sed if found.\nm4_defun([_LT_DECL_SED],\n[AC_PROG_SED\ntest -z \"$SED\" && SED=sed\nXsed=\"$SED -e 1s/^X//\"\n_LT_DECL([], [SED], [1], [A sed program that does not truncate output])\n_LT_DECL([], [Xsed], [\"\\$SED -e 1s/^X//\"],\n    [Sed that helps us avoid accidentally triggering echo(1) options like -n])\n])# _LT_DECL_SED\n\nm4_ifndef([AC_PROG_SED], [\n############################################################\n# NOTE: This macro has been submitted for inclusion into   #\n#  GNU Autoconf as AC_PROG_SED.  When it is available in   #\n#  a released version of Autoconf we should remove this    #\n#  macro and use it instead.                               #\n############################################################\n\nm4_defun([AC_PROG_SED],\n[AC_MSG_CHECKING([for a sed that does not truncate output])\nAC_CACHE_VAL(lt_cv_path_SED,\n[# Loop through the user's path and test for sed and gsed.\n# Then use that list of sed's as ones to test for truncation.\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n  for lt_ac_prog in sed gsed; do\n    for ac_exec_ext in '' $ac_executable_extensions; do\n      if $as_executable_p \"$as_dir/$lt_ac_prog$ac_exec_ext\"; then\n        lt_ac_sed_list=\"$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext\"\n      fi\n    done\n  done\ndone\nIFS=$as_save_IFS\nlt_ac_max=0\nlt_ac_count=0\n# Add /usr/xpg4/bin/sed as it is typically found on Solaris\n# along with /bin/sed that truncates output.\nfor lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do\n  test ! -f $lt_ac_sed && continue\n  cat /dev/null > conftest.in\n  lt_ac_count=0\n  echo $ECHO_N \"0123456789$ECHO_C\" >conftest.in\n  # Check for GNU sed and select it if it is found.\n  if \"$lt_ac_sed\" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then\n    lt_cv_path_SED=$lt_ac_sed\n    break\n  fi\n  while true; do\n    cat conftest.in conftest.in >conftest.tmp\n    mv conftest.tmp conftest.in\n    cp conftest.in conftest.nl\n    echo >>conftest.nl\n    $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break\n    cmp -s conftest.out conftest.nl || break\n    # 10000 chars as input seems more than enough\n    test $lt_ac_count -gt 10 && break\n    lt_ac_count=`expr $lt_ac_count + 1`\n    if test $lt_ac_count -gt $lt_ac_max; then\n      lt_ac_max=$lt_ac_count\n      lt_cv_path_SED=$lt_ac_sed\n    fi\n  done\ndone\n])\nSED=$lt_cv_path_SED\nAC_SUBST([SED])\nAC_MSG_RESULT([$SED])\n])#AC_PROG_SED\n])#m4_ifndef\n\n# Old name:\nAU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED])\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([LT_AC_PROG_SED], [])\n\n\n# _LT_CHECK_SHELL_FEATURES\n# ------------------------\n# Find out whether the shell is Bourne or XSI compatible,\n# or has some other useful features.\nm4_defun([_LT_CHECK_SHELL_FEATURES],\n[AC_MSG_CHECKING([whether the shell understands some XSI constructs])\n# Try some XSI features\nxsi_shell=no\n( _lt_dummy=\"a/b/c\"\n  test \"${_lt_dummy##*/},${_lt_dummy%/*},\"${_lt_dummy%\"$_lt_dummy\"}, \\\n      = c,a/b,, \\\n    && eval 'test $(( 1 + 1 )) -eq 2 \\\n    && test \"${#_lt_dummy}\" -eq 5' ) >/dev/null 2>&1 \\\n  && xsi_shell=yes\nAC_MSG_RESULT([$xsi_shell])\n_LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell'])\n\nAC_MSG_CHECKING([whether the shell understands \"+=\"])\nlt_shell_append=no\n( foo=bar; set foo baz; eval \"$[1]+=\\$[2]\" && test \"$foo\" = barbaz ) \\\n    >/dev/null 2>&1 \\\n  && lt_shell_append=yes\nAC_MSG_RESULT([$lt_shell_append])\n_LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append'])\n\nif ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then\n  lt_unset=unset\nelse\n  lt_unset=false\nfi\n_LT_DECL([], [lt_unset], [0], [whether the shell understands \"unset\"])dnl\n\n# test EBCDIC or ASCII\ncase `echo X|tr X '\\101'` in\n A) # ASCII based system\n    # \\n is not interpreted correctly by Solaris 8 /usr/ucb/tr\n  lt_SP2NL='tr \\040 \\012'\n  lt_NL2SP='tr \\015\\012 \\040\\040'\n  ;;\n *) # EBCDIC based system\n  lt_SP2NL='tr \\100 \\n'\n  lt_NL2SP='tr \\r\\n \\100\\100'\n  ;;\nesac\n_LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl\n_LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl\n])# _LT_CHECK_SHELL_FEATURES\n\n\n# _LT_PROG_XSI_SHELLFNS\n# ---------------------\n# Bourne and XSI compatible variants of some useful shell functions.\nm4_defun([_LT_PROG_XSI_SHELLFNS],\n[case $xsi_shell in\n  yes)\n    cat << \\_LT_EOF >> \"$cfgfile\"\n\n# func_dirname file append nondir_replacement\n# Compute the dirname of FILE.  If nonempty, add APPEND to the result,\n# otherwise set result to NONDIR_REPLACEMENT.\nfunc_dirname ()\n{\n  case ${1} in\n    */*) func_dirname_result=\"${1%/*}${2}\" ;;\n    *  ) func_dirname_result=\"${3}\" ;;\n  esac\n}\n\n# func_basename file\nfunc_basename ()\n{\n  func_basename_result=\"${1##*/}\"\n}\n\n# func_dirname_and_basename file append nondir_replacement\n# perform func_basename and func_dirname in a single function\n# call:\n#   dirname:  Compute the dirname of FILE.  If nonempty,\n#             add APPEND to the result, otherwise set result\n#             to NONDIR_REPLACEMENT.\n#             value returned in \"$func_dirname_result\"\n#   basename: Compute filename of FILE.\n#             value retuned in \"$func_basename_result\"\n# Implementation must be kept synchronized with func_dirname\n# and func_basename. For efficiency, we do not delegate to\n# those functions but instead duplicate the functionality here.\nfunc_dirname_and_basename ()\n{\n  case ${1} in\n    */*) func_dirname_result=\"${1%/*}${2}\" ;;\n    *  ) func_dirname_result=\"${3}\" ;;\n  esac\n  func_basename_result=\"${1##*/}\"\n}\n\n# func_stripname prefix suffix name\n# strip PREFIX and SUFFIX off of NAME.\n# PREFIX and SUFFIX must not contain globbing or regex special\n# characters, hashes, percent signs, but SUFFIX may contain a leading\n# dot (in which case that matches only a dot).\nfunc_stripname ()\n{\n  # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\n  # positional parameters, so assign one to ordinary parameter first.\n  func_stripname_result=${3}\n  func_stripname_result=${func_stripname_result#\"${1}\"}\n  func_stripname_result=${func_stripname_result%\"${2}\"}\n}\n\n# func_opt_split\nfunc_opt_split ()\n{\n  func_opt_split_opt=${1%%=*}\n  func_opt_split_arg=${1#*=}\n}\n\n# func_lo2o object\nfunc_lo2o ()\n{\n  case ${1} in\n    *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\n    *)    func_lo2o_result=${1} ;;\n  esac\n}\n\n# func_xform libobj-or-source\nfunc_xform ()\n{\n  func_xform_result=${1%.*}.lo\n}\n\n# func_arith arithmetic-term...\nfunc_arith ()\n{\n  func_arith_result=$(( $[*] ))\n}\n\n# func_len string\n# STRING may not start with a hyphen.\nfunc_len ()\n{\n  func_len_result=${#1}\n}\n\n_LT_EOF\n    ;;\n  *) # Bourne compatible functions.\n    cat << \\_LT_EOF >> \"$cfgfile\"\n\n# func_dirname file append nondir_replacement\n# Compute the dirname of FILE.  If nonempty, add APPEND to the result,\n# otherwise set result to NONDIR_REPLACEMENT.\nfunc_dirname ()\n{\n  # Extract subdirectory from the argument.\n  func_dirname_result=`$ECHO \"X${1}\" | $Xsed -e \"$dirname\"`\n  if test \"X$func_dirname_result\" = \"X${1}\"; then\n    func_dirname_result=\"${3}\"\n  else\n    func_dirname_result=\"$func_dirname_result${2}\"\n  fi\n}\n\n# func_basename file\nfunc_basename ()\n{\n  func_basename_result=`$ECHO \"X${1}\" | $Xsed -e \"$basename\"`\n}\n\ndnl func_dirname_and_basename\ndnl A portable version of this function is already defined in general.m4sh\ndnl so there is no need for it here.\n\n# func_stripname prefix suffix name\n# strip PREFIX and SUFFIX off of NAME.\n# PREFIX and SUFFIX must not contain globbing or regex special\n# characters, hashes, percent signs, but SUFFIX may contain a leading\n# dot (in which case that matches only a dot).\n# func_strip_suffix prefix name\nfunc_stripname ()\n{\n  case ${2} in\n    .*) func_stripname_result=`$ECHO \"X${3}\" \\\n           | $Xsed -e \"s%^${1}%%\" -e \"s%\\\\\\\\${2}\\$%%\"`;;\n    *)  func_stripname_result=`$ECHO \"X${3}\" \\\n           | $Xsed -e \"s%^${1}%%\" -e \"s%${2}\\$%%\"`;;\n  esac\n}\n\n# sed scripts:\nmy_sed_long_opt='1s/^\\(-[[^=]]*\\)=.*/\\1/;q'\nmy_sed_long_arg='1s/^-[[^=]]*=//'\n\n# func_opt_split\nfunc_opt_split ()\n{\n  func_opt_split_opt=`$ECHO \"X${1}\" | $Xsed -e \"$my_sed_long_opt\"`\n  func_opt_split_arg=`$ECHO \"X${1}\" | $Xsed -e \"$my_sed_long_arg\"`\n}\n\n# func_lo2o object\nfunc_lo2o ()\n{\n  func_lo2o_result=`$ECHO \"X${1}\" | $Xsed -e \"$lo2o\"`\n}\n\n# func_xform libobj-or-source\nfunc_xform ()\n{\n  func_xform_result=`$ECHO \"X${1}\" | $Xsed -e 's/\\.[[^.]]*$/.lo/'`\n}\n\n# func_arith arithmetic-term...\nfunc_arith ()\n{\n  func_arith_result=`expr \"$[@]\"`\n}\n\n# func_len string\n# STRING may not start with a hyphen.\nfunc_len ()\n{\n  func_len_result=`expr \"$[1]\" : \".*\" 2>/dev/null || echo $max_cmd_len`\n}\n\n_LT_EOF\nesac\n\ncase $lt_shell_append in\n  yes)\n    cat << \\_LT_EOF >> \"$cfgfile\"\n\n# func_append var value\n# Append VALUE to the end of shell variable VAR.\nfunc_append ()\n{\n  eval \"$[1]+=\\$[2]\"\n}\n_LT_EOF\n    ;;\n  *)\n    cat << \\_LT_EOF >> \"$cfgfile\"\n\n# func_append var value\n# Append VALUE to the end of shell variable VAR.\nfunc_append ()\n{\n  eval \"$[1]=\\$$[1]\\$[2]\"\n}\n\n_LT_EOF\n    ;;\n  esac\n])\n"
  },
  {
    "path": "src/main/jni/tiff/m4/ltoptions.m4",
    "content": "# Helper functions for option handling.                    -*- Autoconf -*-\n#\n#   Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.\n#   Written by Gary V. Vaughan, 2004\n#\n# This file is free software; the Free Software Foundation gives\n# unlimited permission to copy and/or distribute it, with or without\n# modifications, as long as this notice is preserved.\n\n# serial 6 ltoptions.m4\n\n# This is to help aclocal find these macros, as it can't see m4_define.\nAC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])\n\n\n# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME)\n# ------------------------------------------\nm4_define([_LT_MANGLE_OPTION],\n[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])])\n\n\n# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME)\n# ---------------------------------------\n# Set option OPTION-NAME for macro MACRO-NAME, and if there is a\n# matching handler defined, dispatch to it.  Other OPTION-NAMEs are\n# saved as a flag.\nm4_define([_LT_SET_OPTION],\n[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl\nm4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),\n        _LT_MANGLE_DEFUN([$1], [$2]),\n    [m4_warning([Unknown $1 option `$2'])])[]dnl\n])\n\n\n# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET])\n# ------------------------------------------------------------\n# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.\nm4_define([_LT_IF_OPTION],\n[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])])\n\n\n# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET)\n# -------------------------------------------------------\n# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME\n# are set.\nm4_define([_LT_UNLESS_OPTIONS],\n[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),\n\t    [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option),\n\t\t      [m4_define([$0_found])])])[]dnl\nm4_ifdef([$0_found], [m4_undefine([$0_found])], [$3\n])[]dnl\n])\n\n\n# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST)\n# ----------------------------------------\n# OPTION-LIST is a space-separated list of Libtool options associated\n# with MACRO-NAME.  If any OPTION has a matching handler declared with\n# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about\n# the unknown option and exit.\nm4_defun([_LT_SET_OPTIONS],\n[# Set options\nm4_foreach([_LT_Option], m4_split(m4_normalize([$2])),\n    [_LT_SET_OPTION([$1], _LT_Option)])\n\nm4_if([$1],[LT_INIT],[\n  dnl\n  dnl Simply set some default values (i.e off) if boolean options were not\n  dnl specified:\n  _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no\n  ])\n  _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no\n  ])\n  dnl\n  dnl If no reference was made to various pairs of opposing options, then\n  dnl we run the default mode handler for the pair.  For example, if neither\n  dnl `shared' nor `disable-shared' was passed, we enable building of shared\n  dnl archives by default:\n  _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])\n  _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])\n  _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])\n  _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],\n  \t\t   [_LT_ENABLE_FAST_INSTALL])\n  ])\n])# _LT_SET_OPTIONS\n\n\n## --------------------------------- ##\n## Macros to handle LT_INIT options. ##\n## --------------------------------- ##\n\n# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME)\n# -----------------------------------------\nm4_define([_LT_MANGLE_DEFUN],\n[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])])\n\n\n# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE)\n# -----------------------------------------------\nm4_define([LT_OPTION_DEFINE],\n[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl\n])# LT_OPTION_DEFINE\n\n\n# dlopen\n# ------\nLT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes\n])\n\nAU_DEFUN([AC_LIBTOOL_DLOPEN],\n[_LT_SET_OPTION([LT_INIT], [dlopen])\nAC_DIAGNOSE([obsolete],\n[$0: Remove this warning and the call to _LT_SET_OPTION when you\nput the `dlopen' option into LT_INIT's first parameter.])\n])\n\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([AC_LIBTOOL_DLOPEN], [])\n\n\n# win32-dll\n# ---------\n# Declare package support for building win32 dll's.\nLT_OPTION_DEFINE([LT_INIT], [win32-dll],\n[enable_win32_dll=yes\n\ncase $host in\n*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-cegcc*)\n  AC_CHECK_TOOL(AS, as, false)\n  AC_CHECK_TOOL(DLLTOOL, dlltool, false)\n  AC_CHECK_TOOL(OBJDUMP, objdump, false)\n  ;;\nesac\n\ntest -z \"$AS\" && AS=as\n_LT_DECL([], [AS],      [0], [Assembler program])dnl\n\ntest -z \"$DLLTOOL\" && DLLTOOL=dlltool\n_LT_DECL([], [DLLTOOL], [0], [DLL creation program])dnl\n\ntest -z \"$OBJDUMP\" && OBJDUMP=objdump\n_LT_DECL([], [OBJDUMP], [0], [Object dumper program])dnl\n])# win32-dll\n\nAU_DEFUN([AC_LIBTOOL_WIN32_DLL],\n[AC_REQUIRE([AC_CANONICAL_HOST])dnl\n_LT_SET_OPTION([LT_INIT], [win32-dll])\nAC_DIAGNOSE([obsolete],\n[$0: Remove this warning and the call to _LT_SET_OPTION when you\nput the `win32-dll' option into LT_INIT's first parameter.])\n])\n\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])\n\n\n# _LT_ENABLE_SHARED([DEFAULT])\n# ----------------------------\n# implement the --enable-shared flag, and supports the `shared' and\n# `disable-shared' LT_INIT options.\n# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.\nm4_define([_LT_ENABLE_SHARED],\n[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl\nAC_ARG_ENABLE([shared],\n    [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],\n\t[build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])],\n    [p=${PACKAGE-default}\n    case $enableval in\n    yes) enable_shared=yes ;;\n    no) enable_shared=no ;;\n    *)\n      enable_shared=no\n      # Look at the argument we got.  We use all the common list separators.\n      lt_save_ifs=\"$IFS\"; IFS=\"${IFS}$PATH_SEPARATOR,\"\n      for pkg in $enableval; do\n\tIFS=\"$lt_save_ifs\"\n\tif test \"X$pkg\" = \"X$p\"; then\n\t  enable_shared=yes\n\tfi\n      done\n      IFS=\"$lt_save_ifs\"\n      ;;\n    esac],\n    [enable_shared=]_LT_ENABLE_SHARED_DEFAULT)\n\n    _LT_DECL([build_libtool_libs], [enable_shared], [0],\n\t[Whether or not to build shared libraries])\n])# _LT_ENABLE_SHARED\n\nLT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])])\nLT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])])\n\n# Old names:\nAC_DEFUN([AC_ENABLE_SHARED],\n[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])\n])\n\nAC_DEFUN([AC_DISABLE_SHARED],\n[_LT_SET_OPTION([LT_INIT], [disable-shared])\n])\n\nAU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])\nAU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])\n\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([AM_ENABLE_SHARED], [])\ndnl AC_DEFUN([AM_DISABLE_SHARED], [])\n\n\n\n# _LT_ENABLE_STATIC([DEFAULT])\n# ----------------------------\n# implement the --enable-static flag, and support the `static' and\n# `disable-static' LT_INIT options.\n# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.\nm4_define([_LT_ENABLE_STATIC],\n[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl\nAC_ARG_ENABLE([static],\n    [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],\n\t[build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])],\n    [p=${PACKAGE-default}\n    case $enableval in\n    yes) enable_static=yes ;;\n    no) enable_static=no ;;\n    *)\n     enable_static=no\n      # Look at the argument we got.  We use all the common list separators.\n      lt_save_ifs=\"$IFS\"; IFS=\"${IFS}$PATH_SEPARATOR,\"\n      for pkg in $enableval; do\n\tIFS=\"$lt_save_ifs\"\n\tif test \"X$pkg\" = \"X$p\"; then\n\t  enable_static=yes\n\tfi\n      done\n      IFS=\"$lt_save_ifs\"\n      ;;\n    esac],\n    [enable_static=]_LT_ENABLE_STATIC_DEFAULT)\n\n    _LT_DECL([build_old_libs], [enable_static], [0],\n\t[Whether or not to build static libraries])\n])# _LT_ENABLE_STATIC\n\nLT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])])\nLT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])])\n\n# Old names:\nAC_DEFUN([AC_ENABLE_STATIC],\n[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])\n])\n\nAC_DEFUN([AC_DISABLE_STATIC],\n[_LT_SET_OPTION([LT_INIT], [disable-static])\n])\n\nAU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])\nAU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])\n\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([AM_ENABLE_STATIC], [])\ndnl AC_DEFUN([AM_DISABLE_STATIC], [])\n\n\n\n# _LT_ENABLE_FAST_INSTALL([DEFAULT])\n# ----------------------------------\n# implement the --enable-fast-install flag, and support the `fast-install'\n# and `disable-fast-install' LT_INIT options.\n# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.\nm4_define([_LT_ENABLE_FAST_INSTALL],\n[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl\nAC_ARG_ENABLE([fast-install],\n    [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],\n    [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],\n    [p=${PACKAGE-default}\n    case $enableval in\n    yes) enable_fast_install=yes ;;\n    no) enable_fast_install=no ;;\n    *)\n      enable_fast_install=no\n      # Look at the argument we got.  We use all the common list separators.\n      lt_save_ifs=\"$IFS\"; IFS=\"${IFS}$PATH_SEPARATOR,\"\n      for pkg in $enableval; do\n\tIFS=\"$lt_save_ifs\"\n\tif test \"X$pkg\" = \"X$p\"; then\n\t  enable_fast_install=yes\n\tfi\n      done\n      IFS=\"$lt_save_ifs\"\n      ;;\n    esac],\n    [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)\n\n_LT_DECL([fast_install], [enable_fast_install], [0],\n\t [Whether or not to optimize for fast installation])dnl\n])# _LT_ENABLE_FAST_INSTALL\n\nLT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])\nLT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])\n\n# Old names:\nAU_DEFUN([AC_ENABLE_FAST_INSTALL],\n[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])\nAC_DIAGNOSE([obsolete],\n[$0: Remove this warning and the call to _LT_SET_OPTION when you put\nthe `fast-install' option into LT_INIT's first parameter.])\n])\n\nAU_DEFUN([AC_DISABLE_FAST_INSTALL],\n[_LT_SET_OPTION([LT_INIT], [disable-fast-install])\nAC_DIAGNOSE([obsolete],\n[$0: Remove this warning and the call to _LT_SET_OPTION when you put\nthe `disable-fast-install' option into LT_INIT's first parameter.])\n])\n\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])\ndnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])\n\n\n# _LT_WITH_PIC([MODE])\n# --------------------\n# implement the --with-pic flag, and support the `pic-only' and `no-pic'\n# LT_INIT options.\n# MODE is either `yes' or `no'.  If omitted, it defaults to `both'.\nm4_define([_LT_WITH_PIC],\n[AC_ARG_WITH([pic],\n    [AS_HELP_STRING([--with-pic],\n\t[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],\n    [pic_mode=\"$withval\"],\n    [pic_mode=default])\n\ntest -z \"$pic_mode\" && pic_mode=m4_default([$1], [default])\n\n_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl\n])# _LT_WITH_PIC\n\nLT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])])\nLT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])])\n\n# Old name:\nAU_DEFUN([AC_LIBTOOL_PICMODE],\n[_LT_SET_OPTION([LT_INIT], [pic-only])\nAC_DIAGNOSE([obsolete],\n[$0: Remove this warning and the call to _LT_SET_OPTION when you\nput the `pic-only' option into LT_INIT's first parameter.])\n])\n\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([AC_LIBTOOL_PICMODE], [])\n\n## ----------------- ##\n## LTDL_INIT Options ##\n## ----------------- ##\n\nm4_define([_LTDL_MODE], [])\nLT_OPTION_DEFINE([LTDL_INIT], [nonrecursive],\n\t\t [m4_define([_LTDL_MODE], [nonrecursive])])\nLT_OPTION_DEFINE([LTDL_INIT], [recursive],\n\t\t [m4_define([_LTDL_MODE], [recursive])])\nLT_OPTION_DEFINE([LTDL_INIT], [subproject],\n\t\t [m4_define([_LTDL_MODE], [subproject])])\n\nm4_define([_LTDL_TYPE], [])\nLT_OPTION_DEFINE([LTDL_INIT], [installable],\n\t\t [m4_define([_LTDL_TYPE], [installable])])\nLT_OPTION_DEFINE([LTDL_INIT], [convenience],\n\t\t [m4_define([_LTDL_TYPE], [convenience])])\n"
  },
  {
    "path": "src/main/jni/tiff/m4/ltsugar.m4",
    "content": "# ltsugar.m4 -- libtool m4 base layer.                         -*-Autoconf-*-\n#\n# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.\n# Written by Gary V. Vaughan, 2004\n#\n# This file is free software; the Free Software Foundation gives\n# unlimited permission to copy and/or distribute it, with or without\n# modifications, as long as this notice is preserved.\n\n# serial 6 ltsugar.m4\n\n# This is to help aclocal find these macros, as it can't see m4_define.\nAC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])\n\n\n# lt_join(SEP, ARG1, [ARG2...])\n# -----------------------------\n# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their\n# associated separator.\n# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier\n# versions in m4sugar had bugs.\nm4_define([lt_join],\n[m4_if([$#], [1], [],\n       [$#], [2], [[$2]],\n       [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])])\nm4_define([_lt_join],\n[m4_if([$#$2], [2], [],\n       [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])])\n\n\n# lt_car(LIST)\n# lt_cdr(LIST)\n# ------------\n# Manipulate m4 lists.\n# These macros are necessary as long as will still need to support\n# Autoconf-2.59 which quotes differently.\nm4_define([lt_car], [[$1]])\nm4_define([lt_cdr],\n[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],\n       [$#], 1, [],\n       [m4_dquote(m4_shift($@))])])\nm4_define([lt_unquote], $1)\n\n\n# lt_append(MACRO-NAME, STRING, [SEPARATOR])\n# ------------------------------------------\n# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'.\n# Note that neither SEPARATOR nor STRING are expanded; they are appended\n# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).\n# No SEPARATOR is output if MACRO-NAME was previously undefined (different\n# than defined and empty).\n#\n# This macro is needed until we can rely on Autoconf 2.62, since earlier\n# versions of m4sugar mistakenly expanded SEPARATOR but not STRING.\nm4_define([lt_append],\n[m4_define([$1],\n\t   m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])])\n\n\n\n# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...])\n# ----------------------------------------------------------\n# Produce a SEP delimited list of all paired combinations of elements of\n# PREFIX-LIST with SUFFIX1 through SUFFIXn.  Each element of the list\n# has the form PREFIXmINFIXSUFFIXn.\n# Needed until we can rely on m4_combine added in Autoconf 2.62.\nm4_define([lt_combine],\n[m4_if(m4_eval([$# > 3]), [1],\n       [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl\n[[m4_foreach([_Lt_prefix], [$2],\n\t     [m4_foreach([_Lt_suffix],\n\t\t]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,\n\t[_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])\n\n\n# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])\n# -----------------------------------------------------------------------\n# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited\n# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ.\nm4_define([lt_if_append_uniq],\n[m4_ifdef([$1],\n\t  [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1],\n\t\t [lt_append([$1], [$2], [$3])$4],\n\t\t [$5])],\n\t  [lt_append([$1], [$2], [$3])$4])])\n\n\n# lt_dict_add(DICT, KEY, VALUE)\n# -----------------------------\nm4_define([lt_dict_add],\n[m4_define([$1($2)], [$3])])\n\n\n# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE)\n# --------------------------------------------\nm4_define([lt_dict_add_subkey],\n[m4_define([$1($2:$3)], [$4])])\n\n\n# lt_dict_fetch(DICT, KEY, [SUBKEY])\n# ----------------------------------\nm4_define([lt_dict_fetch],\n[m4_ifval([$3],\n\tm4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]),\n    m4_ifdef([$1($2)], [m4_defn([$1($2)])]))])\n\n\n# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE])\n# -----------------------------------------------------------------\nm4_define([lt_if_dict_fetch],\n[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4],\n\t[$5],\n    [$6])])\n\n\n# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...])\n# --------------------------------------------------------------\nm4_define([lt_dict_filter],\n[m4_if([$5], [], [],\n  [lt_join(m4_quote(m4_default([$4], [[, ]])),\n           lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]),\n\t\t      [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl\n])\n"
  },
  {
    "path": "src/main/jni/tiff/m4/ltversion.m4",
    "content": "# ltversion.m4 -- version numbers\t\t\t-*- Autoconf -*-\n#\n#   Copyright (C) 2004 Free Software Foundation, Inc.\n#   Written by Scott James Remnant, 2004\n#\n# This file is free software; the Free Software Foundation gives\n# unlimited permission to copy and/or distribute it, with or without\n# modifications, as long as this notice is preserved.\n\n# Generated from ltversion.in.\n\n# serial 3012 ltversion.m4\n# This file is part of GNU Libtool\n\nm4_define([LT_PACKAGE_VERSION], [2.2.6])\nm4_define([LT_PACKAGE_REVISION], [1.3012])\n\nAC_DEFUN([LTVERSION_VERSION],\n[macro_version='2.2.6'\nmacro_revision='1.3012'\n_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])\n_LT_DECL(, macro_revision, 0)\n])\n"
  },
  {
    "path": "src/main/jni/tiff/m4/lt~obsolete.m4",
    "content": "# lt~obsolete.m4 -- aclocal satisfying obsolete definitions.    -*-Autoconf-*-\n#\n#   Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.\n#   Written by Scott James Remnant, 2004.\n#\n# This file is free software; the Free Software Foundation gives\n# unlimited permission to copy and/or distribute it, with or without\n# modifications, as long as this notice is preserved.\n\n# serial 4 lt~obsolete.m4\n\n# These exist entirely to fool aclocal when bootstrapping libtool.\n#\n# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN)\n# which have later been changed to m4_define as they aren't part of the\n# exported API, or moved to Autoconf or Automake where they belong.\n#\n# The trouble is, aclocal is a bit thick.  It'll see the old AC_DEFUN\n# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us\n# using a macro with the same name in our local m4/libtool.m4 it'll\n# pull the old libtool.m4 in (it doesn't see our shiny new m4_define\n# and doesn't know about Autoconf macros at all.)\n#\n# So we provide this file, which has a silly filename so it's always\n# included after everything else.  This provides aclocal with the\n# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything\n# because those macros already exist, or will be overwritten later.\n# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. \n#\n# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here.\n# Yes, that means every name once taken will need to remain here until\n# we give up compatibility with versions before 1.7, at which point\n# we need to keep only those names which we still refer to.\n\n# This is to help aclocal find these macros, as it can't see m4_define.\nAC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])])\n\nm4_ifndef([AC_LIBTOOL_LINKER_OPTION],\t[AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])])\nm4_ifndef([AC_PROG_EGREP],\t\t[AC_DEFUN([AC_PROG_EGREP])])\nm4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH],\t[AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])])\nm4_ifndef([_LT_AC_SHELL_INIT],\t\t[AC_DEFUN([_LT_AC_SHELL_INIT])])\nm4_ifndef([_LT_AC_SYS_LIBPATH_AIX],\t[AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])])\nm4_ifndef([_LT_PROG_LTMAIN],\t\t[AC_DEFUN([_LT_PROG_LTMAIN])])\nm4_ifndef([_LT_AC_TAGVAR],\t\t[AC_DEFUN([_LT_AC_TAGVAR])])\nm4_ifndef([AC_LTDL_ENABLE_INSTALL],\t[AC_DEFUN([AC_LTDL_ENABLE_INSTALL])])\nm4_ifndef([AC_LTDL_PREOPEN],\t\t[AC_DEFUN([AC_LTDL_PREOPEN])])\nm4_ifndef([_LT_AC_SYS_COMPILER],\t[AC_DEFUN([_LT_AC_SYS_COMPILER])])\nm4_ifndef([_LT_AC_LOCK],\t\t[AC_DEFUN([_LT_AC_LOCK])])\nm4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE],\t[AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])])\nm4_ifndef([_LT_AC_TRY_DLOPEN_SELF],\t[AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])])\nm4_ifndef([AC_LIBTOOL_PROG_CC_C_O],\t[AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])])\nm4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])])\nm4_ifndef([AC_LIBTOOL_OBJDIR],\t\t[AC_DEFUN([AC_LIBTOOL_OBJDIR])])\nm4_ifndef([AC_LTDL_OBJDIR],\t\t[AC_DEFUN([AC_LTDL_OBJDIR])])\nm4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])])\nm4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP],\t[AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])])\nm4_ifndef([AC_PATH_MAGIC],\t\t[AC_DEFUN([AC_PATH_MAGIC])])\nm4_ifndef([AC_PROG_LD_GNU],\t\t[AC_DEFUN([AC_PROG_LD_GNU])])\nm4_ifndef([AC_PROG_LD_RELOAD_FLAG],\t[AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])])\nm4_ifndef([AC_DEPLIBS_CHECK_METHOD],\t[AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])])\nm4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])])\nm4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])])\nm4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])])\nm4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS],\t[AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])])\nm4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP],\t[AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])])\nm4_ifndef([LT_AC_PROG_EGREP],\t\t[AC_DEFUN([LT_AC_PROG_EGREP])])\nm4_ifndef([LT_AC_PROG_SED],\t\t[AC_DEFUN([LT_AC_PROG_SED])])\nm4_ifndef([_LT_CC_BASENAME],\t\t[AC_DEFUN([_LT_CC_BASENAME])])\nm4_ifndef([_LT_COMPILER_BOILERPLATE],\t[AC_DEFUN([_LT_COMPILER_BOILERPLATE])])\nm4_ifndef([_LT_LINKER_BOILERPLATE],\t[AC_DEFUN([_LT_LINKER_BOILERPLATE])])\nm4_ifndef([_AC_PROG_LIBTOOL],\t\t[AC_DEFUN([_AC_PROG_LIBTOOL])])\nm4_ifndef([AC_LIBTOOL_SETUP],\t\t[AC_DEFUN([AC_LIBTOOL_SETUP])])\nm4_ifndef([_LT_AC_CHECK_DLFCN],\t\t[AC_DEFUN([_LT_AC_CHECK_DLFCN])])\nm4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER],\t[AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])])\nm4_ifndef([_LT_AC_TAGCONFIG],\t\t[AC_DEFUN([_LT_AC_TAGCONFIG])])\nm4_ifndef([AC_DISABLE_FAST_INSTALL],\t[AC_DEFUN([AC_DISABLE_FAST_INSTALL])])\nm4_ifndef([_LT_AC_LANG_CXX],\t\t[AC_DEFUN([_LT_AC_LANG_CXX])])\nm4_ifndef([_LT_AC_LANG_F77],\t\t[AC_DEFUN([_LT_AC_LANG_F77])])\nm4_ifndef([_LT_AC_LANG_GCJ],\t\t[AC_DEFUN([_LT_AC_LANG_GCJ])])\nm4_ifndef([AC_LIBTOOL_RC],\t\t[AC_DEFUN([AC_LIBTOOL_RC])])\nm4_ifndef([AC_LIBTOOL_LANG_C_CONFIG],\t[AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])])\nm4_ifndef([_LT_AC_LANG_C_CONFIG],\t[AC_DEFUN([_LT_AC_LANG_C_CONFIG])])\nm4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG],\t[AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])])\nm4_ifndef([_LT_AC_LANG_CXX_CONFIG],\t[AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])])\nm4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG],\t[AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])])\nm4_ifndef([_LT_AC_LANG_F77_CONFIG],\t[AC_DEFUN([_LT_AC_LANG_F77_CONFIG])])\nm4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG],\t[AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])])\nm4_ifndef([_LT_AC_LANG_GCJ_CONFIG],\t[AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])])\nm4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG],\t[AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])])\nm4_ifndef([_LT_AC_LANG_RC_CONFIG],\t[AC_DEFUN([_LT_AC_LANG_RC_CONFIG])])\nm4_ifndef([AC_LIBTOOL_CONFIG],\t\t[AC_DEFUN([AC_LIBTOOL_CONFIG])])\nm4_ifndef([_LT_AC_FILE_LTDLL_C],\t[AC_DEFUN([_LT_AC_FILE_LTDLL_C])])\n"
  },
  {
    "path": "src/main/jni/tiff/man/Makefile.am",
    "content": "# Tag Image File Format (TIFF) Software\n#\n# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>\n#\n# Permission to use, copy, modify, distribute, and sell this software and \n# its documentation for any purpose is hereby granted without fee, provided\n# that (i) the above copyright notices and this permission notice appear in\n# all copies of the software and related documentation, and (ii) the names of\n# Sam Leffler and Silicon Graphics may not be used in any advertising or\n# publicity relating to the software without the specific, prior written\n# permission of Sam Leffler and Silicon Graphics.\n# \n# THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n# \n# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n# OF THIS SOFTWARE.\n\n# Process this file with automake to produce Makefile.in.\n\ndist_man1_MANS = \\\n\tbmp2tiff.1 \\\n\tfax2ps.1 \\\n\tfax2tiff.1 \\\n\tgif2tiff.1 \\\n\tpal2rgb.1 \\\n\tppm2tiff.1 \\\n\tras2tiff.1 \\\n\traw2tiff.1 \\\n\trgb2ycbcr.1 \\\n\tsgi2tiff.1 \\\n\tthumbnail.1 \\\n\ttiff2bw.1 \\\n\ttiff2pdf.1 \\\n\ttiff2ps.1 \\\n\ttiff2rgba.1 \\\n\ttiffcmp.1 \\\n\ttiffcp.1 \\\n\ttiffcrop.1 \\\n\ttiffdither.1 \\\n\ttiffdump.1 \\\n\ttiffgt.1 \\\n\ttiffinfo.1 \\\n\ttiffmedian.1 \\\n\ttiffset.1 \\\n\ttiffsplit.1 \\\n\ttiffsv.1\n\ndist_man3_MANS = \\\n\tlibtiff.3tiff \\\n\tTIFFbuffer.3tiff \\\n\tTIFFClose.3tiff \\\n\tTIFFcodec.3tiff \\\n\tTIFFcolor.3tiff \\\n\tTIFFDataWidth.3tiff \\\n\tTIFFError.3tiff \\\n\tTIFFFlush.3tiff \\\n\tTIFFGetField.3tiff \\\n\tTIFFmemory.3tiff \\\n\tTIFFOpen.3tiff \\\n\tTIFFPrintDirectory.3tiff \\\n\tTIFFquery.3tiff \\\n\tTIFFReadDirectory.3tiff \\\n\tTIFFReadEncodedStrip.3tiff \\\n\tTIFFReadEncodedTile.3tiff \\\n\tTIFFReadRawStrip.3tiff \\\n\tTIFFReadRawTile.3tiff \\\n\tTIFFReadRGBAImage.3tiff \\\n\tTIFFReadRGBAStrip.3tiff \\\n\tTIFFReadRGBATile.3tiff \\\n\tTIFFReadScanline.3tiff \\\n\tTIFFReadTile.3tiff \\\n\tTIFFRGBAImage.3tiff \\\n\tTIFFSetDirectory.3tiff \\\n\tTIFFSetField.3tiff \\\n\tTIFFsize.3tiff \\\n\tTIFFstrip.3tiff \\\n\tTIFFswab.3tiff \\\n\tTIFFtile.3tiff \\\n\tTIFFWarning.3tiff \\\n\tTIFFWriteDirectory.3tiff \\\n\tTIFFWriteEncodedStrip.3tiff \\\n\tTIFFWriteEncodedTile.3tiff \\\n\tTIFFWriteRawStrip.3tiff \\\n\tTIFFWriteRawTile.3tiff \\\n\tTIFFWriteScanline.3tiff \\\n\tTIFFWriteTile.3tiff\n"
  },
  {
    "path": "src/main/jni/tiff/man/Makefile.in",
    "content": "# Makefile.in generated by automake 1.11 from Makefile.am.\n# @configure_input@\n\n# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,\n# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,\n# Inc.\n# This Makefile.in is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY, to the extent permitted by law; without\n# even the implied warranty of MERCHANTABILITY or FITNESS FOR A\n# PARTICULAR PURPOSE.\n\n@SET_MAKE@\n\n# Tag Image File Format (TIFF) Software\n#\n# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>\n#\n# Permission to use, copy, modify, distribute, and sell this software and \n# its documentation for any purpose is hereby granted without fee, provided\n# that (i) the above copyright notices and this permission notice appear in\n# all copies of the software and related documentation, and (ii) the names of\n# Sam Leffler and Silicon Graphics may not be used in any advertising or\n# publicity relating to the software without the specific, prior written\n# permission of Sam Leffler and Silicon Graphics.\n# \n# THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n# \n# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n# OF THIS SOFTWARE.\n\n# Process this file with automake to produce Makefile.in.\nVPATH = @srcdir@\npkgdatadir = $(datadir)/@PACKAGE@\npkgincludedir = $(includedir)/@PACKAGE@\npkglibdir = $(libdir)/@PACKAGE@\npkglibexecdir = $(libexecdir)/@PACKAGE@\nam__cd = CDPATH=\"$${ZSH_VERSION+.}$(PATH_SEPARATOR)\" && cd\ninstall_sh_DATA = $(install_sh) -c -m 644\ninstall_sh_PROGRAM = $(install_sh) -c\ninstall_sh_SCRIPT = $(install_sh) -c\nINSTALL_HEADER = $(INSTALL_DATA)\ntransform = $(program_transform_name)\nNORMAL_INSTALL = :\nPRE_INSTALL = :\nPOST_INSTALL = :\nNORMAL_UNINSTALL = :\nPRE_UNINSTALL = :\nPOST_UNINSTALL = :\nbuild_triplet = @build@\nhost_triplet = @host@\ntarget_triplet = @target@\nsubdir = man\nDIST_COMMON = $(dist_man1_MANS) $(dist_man3_MANS) \\\n\t$(srcdir)/Makefile.am $(srcdir)/Makefile.in\nACLOCAL_M4 = $(top_srcdir)/aclocal.m4\nam__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \\\n\t$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \\\n\t$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \\\n\t$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac\nam__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \\\n\t$(ACLOCAL_M4)\nmkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs\nCONFIG_HEADER = $(top_builddir)/libtiff/tif_config.h \\\n\t$(top_builddir)/libtiff/tiffconf.h\nCONFIG_CLEAN_FILES =\nCONFIG_CLEAN_VPATH_FILES =\nAM_V_GEN = $(am__v_GEN_$(V))\nam__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))\nam__v_GEN_0 = @echo \"  GEN   \" $@;\nAM_V_at = $(am__v_at_$(V))\nam__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))\nam__v_at_0 = @\nSOURCES =\nDIST_SOURCES =\nam__vpath_adj_setup = srcdirstrip=`echo \"$(srcdir)\" | sed 's|.|.|g'`;\nam__vpath_adj = case $$p in \\\n    $(srcdir)/*) f=`echo \"$$p\" | sed \"s|^$$srcdirstrip/||\"`;; \\\n    *) f=$$p;; \\\n  esac;\nam__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;\nam__install_max = 40\nam__nobase_strip_setup = \\\n  srcdirstrip=`echo \"$(srcdir)\" | sed 's/[].[^$$\\\\*|]/\\\\\\\\&/g'`\nam__nobase_strip = \\\n  for p in $$list; do echo \"$$p\"; done | sed -e \"s|$$srcdirstrip/||\"\nam__nobase_list = $(am__nobase_strip_setup); \\\n  for p in $$list; do echo \"$$p $$p\"; done | \\\n  sed \"s| $$srcdirstrip/| |;\"' / .*\\//!s/ .*/ ./; s,\\( .*\\)/[^/]*$$,\\1,' | \\\n  $(AWK) 'BEGIN { files[\".\"] = \"\" } { files[$$2] = files[$$2] \" \" $$1; \\\n    if (++n[$$2] == $(am__install_max)) \\\n      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = \"\" } } \\\n    END { for (dir in files) print dir, files[dir] }'\nam__base_list = \\\n  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\\n/ /g' | \\\n  sed '$$!N;$$!N;$$!N;$$!N;s/\\n/ /g'\nman1dir = $(mandir)/man1\nam__installdirs = \"$(DESTDIR)$(man1dir)\" \"$(DESTDIR)$(man3dir)\"\nman3dir = $(mandir)/man3\nNROFF = nroff\nMANS = $(dist_man1_MANS) $(dist_man3_MANS)\nDISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)\nACLOCAL = @ACLOCAL@\nAMTAR = @AMTAR@\nAM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@\nAR = @AR@\nAS = @AS@\nAUTOCONF = @AUTOCONF@\nAUTOHEADER = @AUTOHEADER@\nAUTOMAKE = @AUTOMAKE@\nAWK = @AWK@\nCC = @CC@\nCCDEPMODE = @CCDEPMODE@\nCFLAGS = @CFLAGS@\nCPP = @CPP@\nCPPFLAGS = @CPPFLAGS@\nCXX = @CXX@\nCXXCPP = @CXXCPP@\nCXXDEPMODE = @CXXDEPMODE@\nCXXFLAGS = @CXXFLAGS@\nCYGPATH_W = @CYGPATH_W@\nDEFS = @DEFS@\nDEPDIR = @DEPDIR@\nDLLTOOL = @DLLTOOL@\nDSYMUTIL = @DSYMUTIL@\nDUMPBIN = @DUMPBIN@\nECHO_C = @ECHO_C@\nECHO_N = @ECHO_N@\nECHO_T = @ECHO_T@\nEGREP = @EGREP@\nEXEEXT = @EXEEXT@\nFGREP = @FGREP@\nGLUT_CFLAGS = @GLUT_CFLAGS@\nGLUT_LIBS = @GLUT_LIBS@\nGLU_CFLAGS = @GLU_CFLAGS@\nGLU_LIBS = @GLU_LIBS@\nGL_CFLAGS = @GL_CFLAGS@\nGL_LIBS = @GL_LIBS@\nGREP = @GREP@\nINSTALL = @INSTALL@\nINSTALL_DATA = @INSTALL_DATA@\nINSTALL_PROGRAM = @INSTALL_PROGRAM@\nINSTALL_SCRIPT = @INSTALL_SCRIPT@\nINSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@\nLD = @LD@\nLDFLAGS = @LDFLAGS@\nLIBDIR = @LIBDIR@\nLIBOBJS = @LIBOBJS@\nLIBS = @LIBS@\nLIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@\nLIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@\nLIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@\nLIBTIFF_MICRO_VERSION = @LIBTIFF_MICRO_VERSION@\nLIBTIFF_MINOR_VERSION = @LIBTIFF_MINOR_VERSION@\nLIBTIFF_RELEASE_DATE = @LIBTIFF_RELEASE_DATE@\nLIBTIFF_VERSION = @LIBTIFF_VERSION@\nLIBTIFF_VERSION_INFO = @LIBTIFF_VERSION_INFO@\nLIBTOOL = @LIBTOOL@\nLIPO = @LIPO@\nLN_S = @LN_S@\nLTLIBOBJS = @LTLIBOBJS@\nMAINT = @MAINT@\nMAKEINFO = @MAKEINFO@\nMKDIR_P = @MKDIR_P@\nNM = @NM@\nNMEDIT = @NMEDIT@\nOBJDUMP = @OBJDUMP@\nOBJEXT = @OBJEXT@\nOTOOL = @OTOOL@\nOTOOL64 = @OTOOL64@\nPACKAGE = @PACKAGE@\nPACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@\nPACKAGE_NAME = @PACKAGE_NAME@\nPACKAGE_STRING = @PACKAGE_STRING@\nPACKAGE_TARNAME = @PACKAGE_TARNAME@\nPACKAGE_URL = @PACKAGE_URL@\nPACKAGE_VERSION = @PACKAGE_VERSION@\nPATH_SEPARATOR = @PATH_SEPARATOR@\nPTHREAD_CC = @PTHREAD_CC@\nPTHREAD_CFLAGS = @PTHREAD_CFLAGS@\nPTHREAD_LIBS = @PTHREAD_LIBS@\nRANLIB = @RANLIB@\nSED = @SED@\nSET_MAKE = @SET_MAKE@\nSHELL = @SHELL@\nSTRIP = @STRIP@\nVERSION = @VERSION@\nXMKMF = @XMKMF@\nX_CFLAGS = @X_CFLAGS@\nX_EXTRA_LIBS = @X_EXTRA_LIBS@\nX_LIBS = @X_LIBS@\nX_PRE_LIBS = @X_PRE_LIBS@\nabs_builddir = @abs_builddir@\nabs_srcdir = @abs_srcdir@\nabs_top_builddir = @abs_top_builddir@\nabs_top_srcdir = @abs_top_srcdir@\nac_ct_CC = @ac_ct_CC@\nac_ct_CXX = @ac_ct_CXX@\nac_ct_DUMPBIN = @ac_ct_DUMPBIN@\nacx_pthread_config = @acx_pthread_config@\nam__include = @am__include@\nam__leading_dot = @am__leading_dot@\nam__quote = @am__quote@\nam__tar = @am__tar@\nam__untar = @am__untar@\nbindir = @bindir@\nbuild = @build@\nbuild_alias = @build_alias@\nbuild_cpu = @build_cpu@\nbuild_os = @build_os@\nbuild_vendor = @build_vendor@\nbuilddir = @builddir@\ndatadir = @datadir@\ndatarootdir = @datarootdir@\ndocdir = @docdir@\ndvidir = @dvidir@\nexec_prefix = @exec_prefix@\nhost = @host@\nhost_alias = @host_alias@\nhost_cpu = @host_cpu@\nhost_os = @host_os@\nhost_vendor = @host_vendor@\nhtmldir = @htmldir@\nincludedir = @includedir@\ninfodir = @infodir@\ninstall_sh = @install_sh@\nlibdir = @libdir@\nlibexecdir = @libexecdir@\nlocaledir = @localedir@\nlocalstatedir = @localstatedir@\nlt_ECHO = @lt_ECHO@\nmandir = @mandir@\nmkdir_p = @mkdir_p@\noldincludedir = @oldincludedir@\npdfdir = @pdfdir@\nprefix = @prefix@\nprogram_transform_name = @program_transform_name@\npsdir = @psdir@\nsbindir = @sbindir@\nsharedstatedir = @sharedstatedir@\nsrcdir = @srcdir@\nsysconfdir = @sysconfdir@\ntarget = @target@\ntarget_alias = @target_alias@\ntarget_cpu = @target_cpu@\ntarget_os = @target_os@\ntarget_vendor = @target_vendor@\ntop_build_prefix = @top_build_prefix@\ntop_builddir = @top_builddir@\ntop_srcdir = @top_srcdir@\ndist_man1_MANS = \\\n\tbmp2tiff.1 \\\n\tfax2ps.1 \\\n\tfax2tiff.1 \\\n\tgif2tiff.1 \\\n\tpal2rgb.1 \\\n\tppm2tiff.1 \\\n\tras2tiff.1 \\\n\traw2tiff.1 \\\n\trgb2ycbcr.1 \\\n\tsgi2tiff.1 \\\n\tthumbnail.1 \\\n\ttiff2bw.1 \\\n\ttiff2pdf.1 \\\n\ttiff2ps.1 \\\n\ttiff2rgba.1 \\\n\ttiffcmp.1 \\\n\ttiffcp.1 \\\n\ttiffcrop.1 \\\n\ttiffdither.1 \\\n\ttiffdump.1 \\\n\ttiffgt.1 \\\n\ttiffinfo.1 \\\n\ttiffmedian.1 \\\n\ttiffset.1 \\\n\ttiffsplit.1 \\\n\ttiffsv.1\n\ndist_man3_MANS = \\\n\tlibtiff.3tiff \\\n\tTIFFbuffer.3tiff \\\n\tTIFFClose.3tiff \\\n\tTIFFcodec.3tiff \\\n\tTIFFcolor.3tiff \\\n\tTIFFDataWidth.3tiff \\\n\tTIFFError.3tiff \\\n\tTIFFFlush.3tiff \\\n\tTIFFGetField.3tiff \\\n\tTIFFmemory.3tiff \\\n\tTIFFOpen.3tiff \\\n\tTIFFPrintDirectory.3tiff \\\n\tTIFFquery.3tiff \\\n\tTIFFReadDirectory.3tiff \\\n\tTIFFReadEncodedStrip.3tiff \\\n\tTIFFReadEncodedTile.3tiff \\\n\tTIFFReadRawStrip.3tiff \\\n\tTIFFReadRawTile.3tiff \\\n\tTIFFReadRGBAImage.3tiff \\\n\tTIFFReadRGBAStrip.3tiff \\\n\tTIFFReadRGBATile.3tiff \\\n\tTIFFReadScanline.3tiff \\\n\tTIFFReadTile.3tiff \\\n\tTIFFRGBAImage.3tiff \\\n\tTIFFSetDirectory.3tiff \\\n\tTIFFSetField.3tiff \\\n\tTIFFsize.3tiff \\\n\tTIFFstrip.3tiff \\\n\tTIFFswab.3tiff \\\n\tTIFFtile.3tiff \\\n\tTIFFWarning.3tiff \\\n\tTIFFWriteDirectory.3tiff \\\n\tTIFFWriteEncodedStrip.3tiff \\\n\tTIFFWriteEncodedTile.3tiff \\\n\tTIFFWriteRawStrip.3tiff \\\n\tTIFFWriteRawTile.3tiff \\\n\tTIFFWriteScanline.3tiff \\\n\tTIFFWriteTile.3tiff\n\nall: all-am\n\n.SUFFIXES:\n$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)\n\t@for dep in $?; do \\\n\t  case '$(am__configure_deps)' in \\\n\t    *$$dep*) \\\n\t      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \\\n\t        && { if test -f $@; then exit 0; else break; fi; }; \\\n\t      exit 1;; \\\n\t  esac; \\\n\tdone; \\\n\techo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign man/Makefile'; \\\n\t$(am__cd) $(top_srcdir) && \\\n\t  $(AUTOMAKE) --foreign man/Makefile\n.PRECIOUS: Makefile\nMakefile: $(srcdir)/Makefile.in $(top_builddir)/config.status\n\t@case '$?' in \\\n\t  *config.status*) \\\n\t    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \\\n\t  *) \\\n\t    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \\\n\t    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \\\n\tesac;\n\n$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n\n$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n$(am__aclocal_m4_deps):\n\nmostlyclean-libtool:\n\t-rm -f *.lo\n\nclean-libtool:\n\t-rm -rf .libs _libs\ninstall-man1: $(dist_man1_MANS)\n\t@$(NORMAL_INSTALL)\n\ttest -z \"$(man1dir)\" || $(MKDIR_P) \"$(DESTDIR)$(man1dir)\"\n\t@list='$(dist_man1_MANS)'; test -n \"$(man1dir)\" || exit 0; \\\n\t{ for i in $$list; do echo \"$$i\"; done; \\\n\t} | while read p; do \\\n\t  if test -f $$p; then d=; else d=\"$(srcdir)/\"; fi; \\\n\t  echo \"$$d$$p\"; echo \"$$p\"; \\\n\tdone | \\\n\tsed -e 'n;s,.*/,,;p;h;s,.*\\.,,;s,^[^1][0-9a-z]*$$,1,;x' \\\n\t      -e 's,\\.[0-9a-z]*$$,,;$(transform);G;s,\\n,.,' | \\\n\tsed 'N;N;s,\\n, ,g' | { \\\n\tlist=; while read file base inst; do \\\n\t  if test \"$$base\" = \"$$inst\"; then list=\"$$list $$file\"; else \\\n\t    echo \" $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'\"; \\\n\t    $(INSTALL_DATA) \"$$file\" \"$(DESTDIR)$(man1dir)/$$inst\" || exit $$?; \\\n\t  fi; \\\n\tdone; \\\n\tfor i in $$list; do echo \"$$i\"; done | $(am__base_list) | \\\n\twhile read files; do \\\n\t  test -z \"$$files\" || { \\\n\t    echo \" $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'\"; \\\n\t    $(INSTALL_DATA) $$files \"$(DESTDIR)$(man1dir)\" || exit $$?; }; \\\n\tdone; }\n\nuninstall-man1:\n\t@$(NORMAL_UNINSTALL)\n\t@list='$(dist_man1_MANS)'; test -n \"$(man1dir)\" || exit 0; \\\n\tfiles=`{ for i in $$list; do echo \"$$i\"; done; \\\n\t} | sed -e 's,.*/,,;h;s,.*\\.,,;s,^[^1][0-9a-z]*$$,1,;x' \\\n\t      -e 's,\\.[0-9a-z]*$$,,;$(transform);G;s,\\n,.,'`; \\\n\ttest -z \"$$files\" || { \\\n\t  echo \" ( cd '$(DESTDIR)$(man1dir)' && rm -f\" $$files \")\"; \\\n\t  cd \"$(DESTDIR)$(man1dir)\" && rm -f $$files; }\ninstall-man3: $(dist_man3_MANS)\n\t@$(NORMAL_INSTALL)\n\ttest -z \"$(man3dir)\" || $(MKDIR_P) \"$(DESTDIR)$(man3dir)\"\n\t@list='$(dist_man3_MANS)'; test -n \"$(man3dir)\" || exit 0; \\\n\t{ for i in $$list; do echo \"$$i\"; done; \\\n\t} | while read p; do \\\n\t  if test -f $$p; then d=; else d=\"$(srcdir)/\"; fi; \\\n\t  echo \"$$d$$p\"; echo \"$$p\"; \\\n\tdone | \\\n\tsed -e 'n;s,.*/,,;p;h;s,.*\\.,,;s,^[^3][0-9a-z]*$$,3,;x' \\\n\t      -e 's,\\.[0-9a-z]*$$,,;$(transform);G;s,\\n,.,' | \\\n\tsed 'N;N;s,\\n, ,g' | { \\\n\tlist=; while read file base inst; do \\\n\t  if test \"$$base\" = \"$$inst\"; then list=\"$$list $$file\"; else \\\n\t    echo \" $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man3dir)/$$inst'\"; \\\n\t    $(INSTALL_DATA) \"$$file\" \"$(DESTDIR)$(man3dir)/$$inst\" || exit $$?; \\\n\t  fi; \\\n\tdone; \\\n\tfor i in $$list; do echo \"$$i\"; done | $(am__base_list) | \\\n\twhile read files; do \\\n\t  test -z \"$$files\" || { \\\n\t    echo \" $(INSTALL_DATA) $$files '$(DESTDIR)$(man3dir)'\"; \\\n\t    $(INSTALL_DATA) $$files \"$(DESTDIR)$(man3dir)\" || exit $$?; }; \\\n\tdone; }\n\nuninstall-man3:\n\t@$(NORMAL_UNINSTALL)\n\t@list='$(dist_man3_MANS)'; test -n \"$(man3dir)\" || exit 0; \\\n\tfiles=`{ for i in $$list; do echo \"$$i\"; done; \\\n\t} | sed -e 's,.*/,,;h;s,.*\\.,,;s,^[^3][0-9a-z]*$$,3,;x' \\\n\t      -e 's,\\.[0-9a-z]*$$,,;$(transform);G;s,\\n,.,'`; \\\n\ttest -z \"$$files\" || { \\\n\t  echo \" ( cd '$(DESTDIR)$(man3dir)' && rm -f\" $$files \")\"; \\\n\t  cd \"$(DESTDIR)$(man3dir)\" && rm -f $$files; }\ntags: TAGS\nTAGS:\n\nctags: CTAGS\nCTAGS:\n\n\ndistdir: $(DISTFILES)\n\t@list='$(MANS)'; if test -n \"$$list\"; then \\\n\t  list=`for p in $$list; do \\\n\t    if test -f $$p; then d=; else d=\"$(srcdir)/\"; fi; \\\n\t    if test -f \"$$d$$p\"; then echo \"$$d$$p\"; else :; fi; done`; \\\n\t  if test -n \"$$list\" && \\\n\t    grep 'ab help2man is required to generate this page' $$list >/dev/null; then \\\n\t    echo \"error: found man pages containing the \\`missing help2man' replacement text:\" >&2; \\\n\t    grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/         /' >&2; \\\n\t    echo \"       to fix them, install help2man, remove and regenerate the man pages;\" >&2; \\\n\t    echo \"       typically \\`make maintainer-clean' will remove them\" >&2; \\\n\t    exit 1; \\\n\t  else :; fi; \\\n\telse :; fi\n\t@srcdirstrip=`echo \"$(srcdir)\" | sed 's/[].[^$$\\\\*]/\\\\\\\\&/g'`; \\\n\ttopsrcdirstrip=`echo \"$(top_srcdir)\" | sed 's/[].[^$$\\\\*]/\\\\\\\\&/g'`; \\\n\tlist='$(DISTFILES)'; \\\n\t  dist_files=`for file in $$list; do echo $$file; done | \\\n\t  sed -e \"s|^$$srcdirstrip/||;t\" \\\n\t      -e \"s|^$$topsrcdirstrip/|$(top_builddir)/|;t\"`; \\\n\tcase $$dist_files in \\\n\t  */*) $(MKDIR_P) `echo \"$$dist_files\" | \\\n\t\t\t   sed '/\\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \\\n\t\t\t   sort -u` ;; \\\n\tesac; \\\n\tfor file in $$dist_files; do \\\n\t  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \\\n\t  if test -d $$d/$$file; then \\\n\t    dir=`echo \"/$$file\" | sed -e 's,/[^/]*$$,,'`; \\\n\t    if test -d \"$(distdir)/$$file\"; then \\\n\t      find \"$(distdir)/$$file\" -type d ! -perm -700 -exec chmod u+rwx {} \\;; \\\n\t    fi; \\\n\t    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \\\n\t      cp -fpR $(srcdir)/$$file \"$(distdir)$$dir\" || exit 1; \\\n\t      find \"$(distdir)/$$file\" -type d ! -perm -700 -exec chmod u+rwx {} \\;; \\\n\t    fi; \\\n\t    cp -fpR $$d/$$file \"$(distdir)$$dir\" || exit 1; \\\n\t  else \\\n\t    test -f \"$(distdir)/$$file\" \\\n\t    || cp -p $$d/$$file \"$(distdir)/$$file\" \\\n\t    || exit 1; \\\n\t  fi; \\\n\tdone\ncheck-am: all-am\ncheck: check-am\nall-am: Makefile $(MANS)\ninstalldirs:\n\tfor dir in \"$(DESTDIR)$(man1dir)\" \"$(DESTDIR)$(man3dir)\"; do \\\n\t  test -z \"$$dir\" || $(MKDIR_P) \"$$dir\"; \\\n\tdone\ninstall: install-am\ninstall-exec: install-exec-am\ninstall-data: install-data-am\nuninstall: uninstall-am\n\ninstall-am: all-am\n\t@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am\n\ninstallcheck: installcheck-am\ninstall-strip:\n\t$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM=\"$(INSTALL_STRIP_PROGRAM)\" \\\n\t  install_sh_PROGRAM=\"$(INSTALL_STRIP_PROGRAM)\" INSTALL_STRIP_FLAG=-s \\\n\t  `test -z '$(STRIP)' || \\\n\t    echo \"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'\"` install\nmostlyclean-generic:\n\nclean-generic:\n\ndistclean-generic:\n\t-test -z \"$(CONFIG_CLEAN_FILES)\" || rm -f $(CONFIG_CLEAN_FILES)\n\t-test . = \"$(srcdir)\" || test -z \"$(CONFIG_CLEAN_VPATH_FILES)\" || rm -f $(CONFIG_CLEAN_VPATH_FILES)\n\nmaintainer-clean-generic:\n\t@echo \"This command is intended for maintainers to use\"\n\t@echo \"it deletes files that may require special tools to rebuild.\"\nclean: clean-am\n\nclean-am: clean-generic clean-libtool mostlyclean-am\n\ndistclean: distclean-am\n\t-rm -f Makefile\ndistclean-am: clean-am distclean-generic\n\ndvi: dvi-am\n\ndvi-am:\n\nhtml: html-am\n\nhtml-am:\n\ninfo: info-am\n\ninfo-am:\n\ninstall-data-am: install-man\n\ninstall-dvi: install-dvi-am\n\ninstall-dvi-am:\n\ninstall-exec-am:\n\ninstall-html: install-html-am\n\ninstall-html-am:\n\ninstall-info: install-info-am\n\ninstall-info-am:\n\ninstall-man: install-man1 install-man3\n\ninstall-pdf: install-pdf-am\n\ninstall-pdf-am:\n\ninstall-ps: install-ps-am\n\ninstall-ps-am:\n\ninstallcheck-am:\n\nmaintainer-clean: maintainer-clean-am\n\t-rm -f Makefile\nmaintainer-clean-am: distclean-am maintainer-clean-generic\n\nmostlyclean: mostlyclean-am\n\nmostlyclean-am: mostlyclean-generic mostlyclean-libtool\n\npdf: pdf-am\n\npdf-am:\n\nps: ps-am\n\nps-am:\n\nuninstall-am: uninstall-man\n\nuninstall-man: uninstall-man1 uninstall-man3\n\n.MAKE: install-am install-strip\n\n.PHONY: all all-am check check-am clean clean-generic clean-libtool \\\n\tdistclean distclean-generic distclean-libtool distdir dvi \\\n\tdvi-am html html-am info info-am install install-am \\\n\tinstall-data install-data-am install-dvi install-dvi-am \\\n\tinstall-exec install-exec-am install-html install-html-am \\\n\tinstall-info install-info-am install-man install-man1 \\\n\tinstall-man3 install-pdf install-pdf-am install-ps \\\n\tinstall-ps-am install-strip installcheck installcheck-am \\\n\tinstalldirs maintainer-clean maintainer-clean-generic \\\n\tmostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \\\n\tps ps-am uninstall uninstall-am uninstall-man uninstall-man1 \\\n\tuninstall-man3\n\n\n# Tell versions [3.59,3.63) of GNU make to not export all variables.\n# Otherwise a system limit (for SysV at least) may be exceeded.\n.NOEXPORT:\n"
  },
  {
    "path": "src/main/jni/tiff/man/TIFFClose.3tiff",
    "content": ".\\\" $Id: TIFFClose.3tiff,v 1.2 2005/11/02 11:07:18 dron Exp $\n.\\\"\n.\\\" Copyright (c) 1988-1997 Sam Leffler\n.\\\" Copyright (c) 1991-1997 Silicon Graphics, Inc.\n.\\\"\n.\\\" Permission to use, copy, modify, distribute, and sell this software and \n.\\\" its documentation for any purpose is hereby granted without fee, provided\n.\\\" that (i) the above copyright notices and this permission notice appear in\n.\\\" all copies of the software and related documentation, and (ii) the names of\n.\\\" Sam Leffler and Silicon Graphics may not be used in any advertising or\n.\\\" publicity relating to the software without the specific, prior written\n.\\\" permission of Sam Leffler and Silicon Graphics.\n.\\\" \n.\\\" THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n.\\\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n.\\\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n.\\\" \n.\\\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n.\\\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n.\\\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n.\\\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n.\\\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n.\\\" OF THIS SOFTWARE.\n.\\\"\n.if n .po 0\n.TH TIFFClose 3TIFF \"November 2, 2005\" \"libtiff\"\n.SH NAME\nTIFFClose \\- close a previously opened\n.SM TIFF\nfile\n.SH SYNOPSIS\n.B \"#include <tiffio.h>\"\n.sp\n.BI \"void TIFFClose(TIFF *\" tif \")\"\n.SH DESCRIPTION\n.IR TIFFClose\ncloses a file that was previously opened with\n.BR TIFFOpen (3TIFF).\nAny buffered data are flushed to the file, including the contents of the\ncurrent directory (if modified); and all resources are reclaimed.\n.SH DIAGNOSTICS\nAll error messages are directed to the\n.bR TIFFError (3TIFF)\nroutine.\nLikewise, warning messages are directed to the\n.BR TIFFWarning (3TIFF)\nroutine.\n.SH \"SEE ALSO\"\n.BR libtiff (3TIFF),\n.BR TIFFOpen (3TIFF)\n.PP\nLibtiff library home page:\n.BR http://www.remotesensing.org/libtiff/\n"
  },
  {
    "path": "src/main/jni/tiff/man/TIFFDataWidth.3tiff",
    "content": ".\\\" $Id: TIFFDataWidth.3tiff,v 1.3 2006/03/23 14:54:02 dron Exp $\n.\\\"\n.\\\" Copyright (c) 2002, Andrey Kiselev <dron@ak4719.spb.edu>\n.\\\"\n.\\\" Permission to use, copy, modify, distribute, and sell this software and \n.\\\" its documentation for any purpose is hereby granted without fee, provided\n.\\\" that (i) the above copyright notices and this permission notice appear in\n.\\\" all copies of the software and related documentation, and (ii) the names of\n.\\\" Sam Leffler and Silicon Graphics may not be used in any advertising or\n.\\\" publicity relating to the software without the specific, prior written\n.\\\" permission of Sam Leffler and Silicon Graphics.\n.\\\" \n.\\\" THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n.\\\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n.\\\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n.\\\" \n.\\\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n.\\\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n.\\\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n.\\\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n.\\\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n.\\\" OF THIS SOFTWARE.\n.\\\"\n.if n .po 0\n.TH TIFFDataWidth 3TIFF \"September 12, 2002\" \"libtiff\"\n.SH NAME\nTIFFDataWidth \\- Get the size of TIFF data types\n.SH SYNOPSIS\n.B \"#include <tiffio.h>\"\n.sp\n.BI \"int TIFFDataWidth(TIFFDataType \" type \")\"\n.SH DESCRIPTION\n.I TIFFDataWidth\nreturns a size of\n.I type\nin bytes.\nCurrently following data types are supported:\n.br\n.I TIFF_BYTE\n.br\n.I TIFF_ASCII\n.br\n.I TIFF_SBYTE\n.br\n.I TIFF_UNDEFINED\n.br\n.I TIFF_SHORT\n.br\n.I TIFF_SSHORT\n.br\n.I TIFF_LONG\n.br\n.I TIFF_SLONG\n.br\n.I TIFF_FLOAT\n.br\n.I TIFF_IFD\n.br\n.I TIFF_RATIONAL\n.br\n.I TIFF_SRATIONAL\n.br\n.I TIFF_DOUBLE\n.br\n.SH \"RETURN VALUES\"\n.br\n.IR TIFFDataWidth\nreturns a number of bytes occupied by the item of given type. 0 returned when\nuknown data type supplied.\n.SH \"SEE ALSO\"\n.BR libtiff (3TIFF),\n.PP\nLibtiff library home page:\n.BR http://www.remotesensing.org/libtiff/\n"
  },
  {
    "path": "src/main/jni/tiff/man/TIFFError.3tiff",
    "content": ".\\\" $Id: TIFFError.3tiff,v 1.2 2005/11/02 11:07:18 dron Exp $\n.\\\"\n.\\\" Copyright (c) 1988-1997 Sam Leffler\n.\\\" Copyright (c) 1991-1997 Silicon Graphics, Inc.\n.\\\"\n.\\\" Permission to use, copy, modify, distribute, and sell this software and \n.\\\" its documentation for any purpose is hereby granted without fee, provided\n.\\\" that (i) the above copyright notices and this permission notice appear in\n.\\\" all copies of the software and related documentation, and (ii) the names of\n.\\\" Sam Leffler and Silicon Graphics may not be used in any advertising or\n.\\\" publicity relating to the software without the specific, prior written\n.\\\" permission of Sam Leffler and Silicon Graphics.\n.\\\" \n.\\\" THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n.\\\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n.\\\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n.\\\" \n.\\\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n.\\\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n.\\\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n.\\\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n.\\\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n.\\\" OF THIS SOFTWARE.\n.\\\"\n.if n .po 0\n.TH TIFFError 3TIFF \"October 15, 1995\" \"libtiff\"\n.SH NAME\nTIFFError, TIFFSetErrorHandler \\- library error handling interface\n.SH SYNOPSIS\n.B \"#include <tiffio.h>\"\n.sp\n.BI \"void TIFFError(const char *\" module \", const char *\" fmt \", \" ... \")\"\n.sp\n.B \"#include <stdarg.h>\"\n.sp\n.BI \"typedef void (*TIFFErrorHandler)(const char *\" module \", const char *\" fmt \", va_list \" ap \");\"\n.br\n.B \"TIFFErrorHandler TIFFSetErrorHandler(TIFFErrorHandler handler);\"\n.SH DESCRIPTION\n.I TIFFError\ninvokes the library-wide error handling function to (normally) write an error\nmessage to the\n.BR stderr .\nThe\n.I fmt\nparameter is a\n.IR printf (3S)\nformat string, and any number arguments can be supplied. The\n.I module\nparameter, if non-zero, is printed before the message; it typically is used to\nidentify the software module in which an error is detected.\n.PP\nApplications that desire to capture control in the event of an error should\nuse\n.IR TIFFSetErrorHandler\nto override the default error handler.\nA\n.SM NULL\n(0) error handling function may be installed to suppress error messages.\n.SH \"RETURN VALUES\"\n.IR TIFFSetErrorHandler\nreturns a reference to the previous error handling function.\n.SH \"SEE ALSO\"\n.BR TIFFWarning (3TIFF),\n.BR libtiff (3TIFF),\n.BR printf (3)\n.PP\nLibtiff library home page:\n.BR http://www.remotesensing.org/libtiff/\n"
  },
  {
    "path": "src/main/jni/tiff/man/TIFFFlush.3tiff",
    "content": ".\\\" $Id: TIFFFlush.3tiff,v 1.2 2005/11/02 11:07:18 dron Exp $\n.\\\"\n.\\\" Copyright (c) 1988-1997 Sam Leffler\n.\\\" Copyright (c) 1991-1997 Silicon Graphics, Inc.\n.\\\"\n.\\\" Permission to use, copy, modify, distribute, and sell this software and \n.\\\" its documentation for any purpose is hereby granted without fee, provided\n.\\\" that (i) the above copyright notices and this permission notice appear in\n.\\\" all copies of the software and related documentation, and (ii) the names of\n.\\\" Sam Leffler and Silicon Graphics may not be used in any advertising or\n.\\\" publicity relating to the software without the specific, prior written\n.\\\" permission of Sam Leffler and Silicon Graphics.\n.\\\" \n.\\\" THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n.\\\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n.\\\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n.\\\" \n.\\\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n.\\\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n.\\\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n.\\\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n.\\\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n.\\\" OF THIS SOFTWARE.\n.\\\"\n.if n .po 0\n.TH TIFFFlush 3TIFF \"December 16, 1991\" \"libtiff\"\n.SH NAME\nTIFFFlush, TIFFFlushData \\- flush pending writes to an open\n.SM TIFF\nfile\n.SH SYNOPSIS\n.B \"#include <tiffio.h>\"\n.sp\n.BI \"int TIFFFlush(TIFF *\" tif \")\"\n.br\n.BI \"int TIFFFlushData(TIFF *\" tif \")\"\n.SH DESCRIPTION\n.IR TIFFFlush\ncauses any pending writes for the specified file (including writes for the\ncurrent directory) to be done. In normal operation this call is never needed \\-\nthe library automatically does any flushing required.\n.PP\n.IR TIFFFlushData\nflushes any pending image data for the specified file to be written out;\ndirectory-related data are not flushed. In normal operation this call is never\nneeded \\- the library automatically does any flushing required.\n.SH \"RETURN VALUES\"\n0 is returned if an error is encountered, otherwise 1 is returned.\n.SH DIAGNOSTICS\nAll error messages are directed to the\n.BR TIFFError (3TIFF)\nroutine.\n.SH \"SEE ALSO\"\n.BR TIFFOpen (3TIFF),\n.BR TIFFWriteEncodedStrip (3TIFF),\n.BR TIFFWriteEncodedTile (3TIFF),\n.BR TIFFWriteRawStrip (3TIFF),\n.BR TIFFWriteRawTile (3TIFF),\n.BR TIFFWriteScanline (3TIFF),\n.BR TIFFWriteTile (3TIFF)\n.BR libtiff (3TIFF),\n.PP\nLibtiff library home page:\n.BR http://www.remotesensing.org/libtiff/\n"
  },
  {
    "path": "src/main/jni/tiff/man/TIFFGetField.3tiff",
    "content": ".\\\" $Id: TIFFGetField.3tiff,v 1.4 2006/01/02 23:50:44 bfriesen Exp $\n.\\\"\n.\\\" Copyright (c) 1988-1997 Sam Leffler\n.\\\" Copyright (c) 1991-1997 Silicon Graphics, Inc.\n.\\\"\n.\\\" Permission to use, copy, modify, distribute, and sell this software and \n.\\\" its documentation for any purpose is hereby granted without fee, provided\n.\\\" that (i) the above copyright notices and this permission notice appear in\n.\\\" all copies of the software and related documentation, and (ii) the names of\n.\\\" Sam Leffler and Silicon Graphics may not be used in any advertising or\n.\\\" publicity relating to the software without the specific, prior written\n.\\\" permission of Sam Leffler and Silicon Graphics.\n.\\\" \n.\\\" THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n.\\\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n.\\\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n.\\\" \n.\\\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n.\\\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n.\\\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n.\\\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n.\\\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n.\\\" OF THIS SOFTWARE.\n.\\\"\n.if n .po 0\n.TH TIFFGetField 3TIFF \"March 18, 2005\" \"libtiff\"\n.SH NAME\nTIFFGetField, TIFFVGetField \\- get the value(s) of a tag in an open\n.SM TIFF\nfile\n.SH SYNOPSIS\n.B \"#include <tiffio.h>\"\n.sp\n.BI \"int TIFFGetField(TIFF *\" tif \", ttag_t \" tag \", \" ... \")\"\n.sp\n.B \"#include <stdarg.h>\"\n.sp\n.BI \"int TIFFVGetField(TIFF *\" tif \", ttag_t \" tag \", va_list \" ap \")\"\n.br\n.BI \"int TIFFGetFieldDefaulted(TIFF *\" tif \", ttag_t \" tag \", \" ... \")\"\n.br\n.BI \"int TIFFVGetFieldDefaulted(TIFF *\" tif \", ttag_t \" tag \", va_list \" ap \")\"\n.SH DESCRIPTION\n.IR TIFFGetField\nreturns the value of a tag or pseudo-tag associated with the the current\ndirectory of the opened\n.SM TIFF\nfile\n.IR tif .\n(A\n.I pseudo-tag \nis a parameter that is used to control the operation of the\n.SM TIFF\nlibrary but whose value is not read or written to the underlying file.) The\nfile must have been previously opened with\n.IR TIFFOpen (3TIFF).\nThe tag is identified by\n.IR tag ,\none of the values defined in the include file\n.B tiff.h\n(see also the table below). The type and number of values returned is\ndependent on the tag being requested. The programming interface uses a\nvariable argument list as prescribed by the\n.IR stdarg (3)\ninterface. The returned values should only be interpreted if\n.IR TIFFGetField\nreturns 1.\n.PP\n.IR TIFFVGetField\nis functionally equivalent to\n.IR TIFFGetField\nexcept that it takes a pointer to a variable argument list.\n.I TIFFVGetField\nis useful for layering interfaces on top of the functionality provided by\n.IR TIFFGetField .\n.PP\n.IR TIFFGetFieldDefaulted\nand\n.IR TIFFVGetFieldDefaulted\nare identical to \n.IR TIFFGetField\nand\n.IR TIFFVGetField ,\nexcept that if a tag is not defined in the current directory and it has a\ndefault value, then the default value is returned.\n.PP\nThe tags understood by\n.IR libtiff(3TIFF),\nthe number of parameter values, and the types for the returned values are\nshown below. The data types are specified as in C and correspond to the types\nused to specify tag values to\n.IR TIFFSetField (3TIFF).\nRemember that\n.IR TIFFGetField\nreturns parameter values, so all the listed data types are pointers to storage\nwhere values should be returned.\nConsult the\n.SM TIFF\nspecification (or relevant industry specification) for information on the\nmeaning of each tag and their possible values.\n.PP\n.nf\n.ta \\w'TIFFTAG_CONSECUTIVEBADFAXLINES'u+2n +\\w'Count'u+2n +\\w'TIFFFaxFillFunc*'u+2n\n\\fITag Name\\fP\t\\fICount\\fP\t\\fITypes\\fP\t\\fINotes\\fP\n.sp 5p\nTIFFTAG_ARTIST\t1\tchar**\nTIFFTAG_BADFAXLINES\t1\tuint32*\nTIFFTAG_BITSPERSAMPLE\t1\tuint16*\nTIFFTAG_CLEANFAXDATA\t1\tuint16*\nTIFFTAG_COLORMAP\t3\tuint16**\t1<<BitsPerSample arrays\nTIFFTAG_COMPRESSION\t1\tuint16*\nTIFFTAG_CONSECUTIVEBADFAXLINES\t1\tuint32*\nTIFFTAG_COPYRIGHT\t1\tchar**\nTIFFTAG_DATATYPE\t1\tuint16*\nTIFFTAG_DATETIME\t1\tchar**\nTIFFTAG_DOCUMENTNAME\t1\tchar**\nTIFFTAG_DOTRANGE\t2\tuint16*\nTIFFTAG_EXTRASAMPLES\t2\tuint16*,uint16**\tcount & types array\nTIFFTAG_FAXFILLFUNC\t1\tTIFFFaxFillFunc*\tG3/G4 compression pseudo-tag\nTIFFTAG_FAXMODE\t1\tint*\tG3/G4 compression pseudo-tag\nTIFFTAG_FILLORDER\t1\tuint16*\nTIFFTAG_GROUP3OPTIONS\t1\tuint32*\nTIFFTAG_GROUP4OPTIONS\t1\tuint32*\nTIFFTAG_HALFTONEHINTS\t2\tuint16*\nTIFFTAG_HOSTCOMPUTER\t1\tchar**\nTIFFTAG_ICCPROFILE\t2\tuint32*,void**\tcount, profile data\nTIFFTAG_IMAGEDEPTH\t1\tuint32*\nTIFFTAG_IMAGEDESCRIPTION\t1\tchar**\nTIFFTAG_IMAGELENGTH\t1\tuint32*\nTIFFTAG_IMAGEWIDTH\t1\tuint32*\nTIFFTAG_INKNAMES\t1\tchar**\nTIFFTAG_INKSET\t1\tuint16*\nTIFFTAG_JPEGCOLORMODE\t1\tint*\tJPEG pseudo-tag\nTIFFTAG_JPEGQUALITY\t1\tint*\tJPEG pseudo-tag\nTIFFTAG_JPEGTABLES\t2\tuint32*,void**\tcount & tables\nTIFFTAG_JPEGTABLESMODE\t1\tint*\tJPEG pseudo-tag\nTIFFTAG_MAKE\t1\tchar**\nTIFFTAG_MATTEING\t1\tuint16*\nTIFFTAG_MAXSAMPLEVALUE\t1\tuint16*\nTIFFTAG_MINSAMPLEVALUE\t1\tuint16*\nTIFFTAG_MODEL\t1\tchar**\nTIFFTAG_ORIENTATION\t1\tuint16*\nTIFFTAG_PAGENAME\t1\tchar**\nTIFFTAG_PAGENUMBER\t2\tuint16*\nTIFFTAG_PHOTOMETRIC\t1\tuint16*\nTIFFTAG_PHOTOSHOP\t2\tuint32*,void**\tcount, data\nTIFFTAG_PLANARCONFIG\t1\tuint16*\nTIFFTAG_PREDICTOR\t1\tuint16*\nTIFFTAG_PRIMARYCHROMATICITIES\t1\tfloat**\t6-entry array\nTIFFTAG_REFERENCEBLACKWHITE\t1\tfloat**\t2*SamplesPerPixel array\nTIFFTAG_RESOLUTIONUNIT\t1\tuint16*\nTIFFTAG_RICHTIFFIPTC\t2\tuint32*,void**\tcount, data\nTIFFTAG_ROWSPERSTRIP\t1\tuint32*\nTIFFTAG_SAMPLEFORMAT\t1\tuint16*\nTIFFTAG_SAMPLESPERPIXEL\t1\tuint16*\nTIFFTAG_SMAXSAMPLEVALUE\t1\tdouble*\nTIFFTAG_SMINSAMPLEVALUE\t1\tdouble*\nTIFFTAG_SOFTWARE\t1\tchar**\nTIFFTAG_STONITS\t1\tdouble**\nTIFFTAG_STRIPBYTECOUNTS\t1\tuint32**\nTIFFTAG_STRIPOFFSETS\t1\tuint32**\nTIFFTAG_SUBFILETYPE\t1\tuint32*\nTIFFTAG_SUBIFD\t2\tuint16*,uint32**\tcount & offsets array\nTIFFTAG_TARGETPRINTER\t1\tchar**\nTIFFTAG_THRESHHOLDING\t1\tuint16*\nTIFFTAG_TILEBYTECOUNTS\t1\tuint32**\nTIFFTAG_TILEDEPTH\t1\tuint32*\nTIFFTAG_TILELENGTH\t1\tuint32*\nTIFFTAG_TILEOFFSETS\t1\tuint32**\nTIFFTAG_TILEWIDTH\t1\tuint32*\nTIFFTAG_TRANSFERFUNCTION\t1 or 3\\(dg\tuint16**1<<BitsPerSample entry arrays\nTIFFTAG_WHITEPOINT\t1\tfloat**\t2-entry array\nTIFFTAG_XMLPACKET\t2\tuint32*,void**\tcount, data\nTIFFTAG_XPOSITION\t1\tfloat*\nTIFFTAG_XRESOLUTION\t1\tfloat*\nTIFFTAG_YCBCRCOEFFICIENTS\t1\tfloat**\t3-entry array\nTIFFTAG_YCBCRPOSITIONING\t1\tuint16*\nTIFFTAG_YCBCRSUBSAMPLING\t2\tuint16*\nTIFFTAG_YPOSITION\t1\tfloat*\nTIFFTAG_YRESOLUTION\t1\tfloat*\\(dd\n.fi\n\\(dg If\n.I SamplesPerPixel\nis one, then a single array is returned; otherwise three arrays are returned.\n.fi\n\\(dd The contents of this field are quite complex.  See \n.IR \"The ICC Profile Format Specification\" ,\nAnnex B.3 \"Embedding ICC Profiles in TIFF Files\" (available at\nhttp://www.color.org) for an explanation.\n.SH AUTOREGISTERED TAGS\nIf you can't find the tag in the table above that means this is unsupported\ntag. But you still be able to read it's value if you know the data type of\nthat tag. For example, if you want to read the LONG value from the tag 33424\nand ASCII string from the tag 36867 you can use the following code:\n.PP\n.RS\n.nf\nuint16  count;\nvoid    *data;\n\nTIFFGetField(tiff, 33424, &count, &data);\nprintf(\"Tag %d: %d, count %d\\n\", 33424, *(uint32 *)data, count);\nTIFFGetField(tiff, 36867, &count, &data);\nprintf(\"Tag %d: %s, count %d\\n\", 36867, (char *)data, count);\n.fi\n.RE\n.PP\n\n\nis not supported by\n.BR libtiff(3TIFF),\nlibrary\n.SH RETURN VALUES\n1 is returned if the tag is defined in the current directory; otherwise a 0 is\nreturned.\n.SH DIAGNOSTICS\nAll error messages are directed to the\n.BR TIFFError (3TIFF)\nroutine.\n.PP\n.BR \"Unknown field, tag 0x%x\" .\nAn unknown tag was supplied.\n.SH \"SEE ALSO\"\n.BR TIFFOpen (3TIFF),\n.BR TIFFSetField (3TIFF),\n.BR TIFFSetDirectory (3TIFF),\n.BR TIFFReadDirectory (3TIFF),\n.BR TIFFWriteDirectory (3TIFF)\n.BR libtiff (3TIFF),\n.PP\nLibtiff library home page:\n.BR http://www.remotesensing.org/libtiff/\n"
  },
  {
    "path": "src/main/jni/tiff/man/TIFFOpen.3tiff",
    "content": ".\\\" $Id: TIFFOpen.3tiff,v 1.2 2005/07/01 12:36:22 dron Exp $\n.\\\"\n.\\\" Copyright (c) 1988-1997 Sam Leffler\n.\\\" Copyright (c) 1991-1997 Silicon Graphics, Inc.\n.\\\"\n.\\\" Permission to use, copy, modify, distribute, and sell this software and \n.\\\" its documentation for any purpose is hereby granted without fee, provided\n.\\\" that (i) the above copyright notices and this permission notice appear in\n.\\\" all copies of the software and related documentation, and (ii) the names of\n.\\\" Sam Leffler and Silicon Graphics may not be used in any advertising or\n.\\\" publicity relating to the software without the specific, prior written\n.\\\" permission of Sam Leffler and Silicon Graphics.\n.\\\" \n.\\\" THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n.\\\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n.\\\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n.\\\" \n.\\\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n.\\\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n.\\\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n.\\\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n.\\\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n.\\\" OF THIS SOFTWARE.\n.\\\"\n.if n .po 0\n.TH TIFFOpen 3TIFF \"July 1, 2005\" \"libtiff\"\n.SH NAME\nTIFFOpen, TIFFFdOpen, TIFFClientOpen \\- open a\n.SM TIFF\nfile for reading or writing\n.SH SYNOPSIS\n.B \"#include <tiffio.h>\"\n.sp\n.BI \"TIFF* TIFFOpen(const char *\" filename \", const char *\" mode \")\"\n.br\n.BI \"TIFF* TIFFFdOpen(const int \" fd \", const char *\" filename \", const char *\" mode \")\"\n.sp\n.B \"typedef tsize_t (*TIFFReadWriteProc)(thandle_t, tdata_t, tsize_t);\"\n.br\n.B \"typedef toff_t (*TIFFSeekProc)(thandle_t, toff_t, int);\"\n.br\n.B \"typedef int (*TIFFCloseProc)(thandle_t);\"\n.br\n.B \"typedef toff_t (*TIFFSizeProc)(thandle_t);\"\n.br\n.B \"typedef int (*TIFFMapFileProc)(thandle_t, tdata_t*, toff_t*);\"\n.br\n.B \"typedef void (*TIFFUnmapFileProc)(thandle_t, tdata_t, toff_t);\"\n.sp\n.BI \"TIFF* TIFFClientOpen(const char *\" filename \", const char *\" mode \", thandle_t \" clientdata \", TIFFReadWriteProc \" readproc \", TIFFReadWriteProc \" writeproc \", TIFFSeekProc \" seekproc \", TIFFCloseProc \" closeproc \", TIFFSizeProc \" sizeproc \", TIFFMapFileProc \" mapproc \", TIFFUnmapFileProc \" unmapproc \")\"\n.SH DESCRIPTION\n.IR TIFFOpen\nopens a\n.SM TIFF\nfile whose name is\n.I filename\nand returns a handle to be used in subsequent calls to routines in\n.IR libtiff .\nIf the open operation fails, then zero is returned.\nThe\n.I mode\nparameter specifies if the file is to be opened for reading (``r''),\nwriting (``w''), or appending (``a'') and, optionally, whether\nto override certain default aspects of library operation (see below).\nWhen a file is opened for appending, existing data will not\nbe touched; instead new data will be written as additional subfiles.\nIf an existing file is opened for writing, all previous data is\noverwritten.\n.PP\nIf a file is opened for reading, the first\n.SM TIFF\ndirectory in the file is automatically read\n(also see\n.IR TIFFSetDirectory (3TIFF)\nfor reading directories other than the first).\nIf a file is opened for writing or appending, a default directory\nis automatically created for writing subsequent data.\nThis directory has all the default values specified in\n.SM TIFF\nRevision 6.0:\n.IR BitsPerSample =1,\n.IR ThreshHolding \"=bilevel art scan,\"\n.IR FillOrder =1\n(most significant bit of each data byte is filled first),\n.IR Orientation =1\n(the 0th row represents the visual top of the image, and the 0th\ncolumn represents the visual left hand side),\n.IR SamplesPerPixel =1,\n.IR RowsPerStrip =infinity,\n.IR ResolutionUnit =2\n(inches), and\n.IR Compression =1\n(no compression).\nTo alter these values, or to define values for additional fields,\n.IR TIFFSetField (3TIFF)\nmust be used.\n.PP\n.IR TIFFFdOpen\nis like\n.IR TIFFOpen\nexcept that it opens a\n.SM TIFF\nfile given an open file descriptor\n.IR fd .\nThe file's name and mode must reflect that of the open descriptor.\nThe object associated with the file descriptor\n.BR \"must support random access\" .\n.PP\n.IR TIFFClientOpen\nis like\n.IR TIFFOpen\nexcept that the caller supplies a collection of functions that the\nlibrary will use to do \\s-1UNIX\\s+1-like I/O operations. \nThe\n.I readproc\nand\n.I writeproc\nare called to read and write data at the current file position.\n.I seekproc\nis called to change the current file position a la\n.IR lseek (2).\n.I closeproc\nis invoked to release any resources associated with an open file.\n.I sizeproc\nis invoked to obtain the size in bytes of a file.\n.I mapproc\nand\n.I unmapproc\nare called to map and unmap a file's contents in memory; c.f.\n.IR mmap (2)\nand\n.IR munmap (2).\nThe\n.I clientdata\nparameter is an opaque ``handle'' passed to the client-specified\nroutines passed as parameters to\n.IR TIFFClientOpen .\n.SH OPTIONS\nThe open mode parameter can include the following flags in\naddition to the ``r'', ``w'', and ``a'' flags.\nNote however that option flags must follow the read-write-append\nspecification.\n.TP\n.B l\nWhen creating a new file force information be written with\nLittle-Endian byte order (but see below).\nBy default the library will create new files using the native\n.SM CPU\nbyte order.\n.TP\n.B b\nWhen creating a new file force information be written with\nBig-Endian byte order (but see below).\nBy default the library will create new files using the native\n.SM CPU\nbyte order.\n.TP\n.B L\nForce image data that is read or written to be treated with\nbits filled from Least Significant Bit (\\s-1LSB\\s+1) to\nMost Significant Bit (\\s-1MSB\\s+1).\nNote that this is the opposite to the way the library has\nworked from its inception.\n.TP\n.B B\nForce image data that is read or written to be treated with\nbits filled from Most Significant Bit (\\s-1MSB\\s+1) to\nLeast Significant Bit (\\s-1LSB\\s+1); this is the default.\n.TP\n.B H\nForce image data that is read or written to be treated with\nbits filled in the same order as the native \n.SM CPU.\n.TP\n.B M\nEnable the use of memory-mapped files for images opened read-only.\nIf the underlying system does not support memory-mapped files\nor if the specific image being opened cannot be memory-mapped\nthen the library will fallback to using the normal system interface\nfor reading information.\nBy default the library will attempt to use memory-mapped files.\n.TP\n.B m\nDisable the use of memory-mapped files.\n.TP\n.B C\nEnable the use of ``strip chopping'' when reading images\nthat are comprised of a single strip or tile of uncompressed data.\nStrip chopping is a mechanism by which the library will automatically\nconvert the single-strip image to multiple strips,\neach of which has about 8 Kilobytes of data.\nThis facility can be useful in reducing the amount of memory used\nto read an image because the library normally reads each strip\nin its entirety.\nStrip chopping does however alter the apparent contents of the\nimage because when an image is divided into multiple strips it\nlooks as though the underlying file contains multiple separate\nstrips.\nFinally, note that default handling of strip chopping is a compile-time\nconfiguration parameter.\nThe default behaviour, for backwards compatibility, is to enable\nstrip chopping.\n.TP\n.B c\nDisable the use of strip chopping when reading images.\n.TP\n.B h\nRead TIFF header only, do not load the first image directory. That could be\nuseful in case of the broken first directory. We can open the file and proceed\nto the other directories.\n.SH \"BYTE ORDER\"\nThe \n.SM TIFF\nspecification (\\fBall versions\\fP) states that compliant readers\n.IR \"must be capable of reading images written in either byte order\" .\nNonetheless some software that claims to support the reading of\n.SM TIFF\nimages is incapable of reading images in anything but the native\n.SM CPU\nbyte order on which the software was written.\n(Especially notorious\nare applications written to run on Intel-based machines.)\nBy default the library will create new files with the native\nbyte-order of the \n.SM CPU\non which the application is run.\nThis ensures optimal performance and is portable to any application\nthat conforms to the TIFF specification.\nTo force the library to use a specific byte-order when creating\na new file the ``b'' and ``l'' option flags may be included in\nthe call to open a file; for example, ``wb'' or ``wl''.\n.SH \"RETURN VALUES\"\nUpon successful completion \n.IR TIFFOpen ,\n.IR TIFFFdOpen ,\nand\n.IR TIFFClientOpen\nreturn a \n.SM TIFF\npointer.\nOtherwise, NULL is returned.\n.SH DIAGNOSTICS\nAll error messages are directed to the\n.IR TIFFError (3TIFF)\nroutine.\nLikewise, warning messages are directed to the\n.IR TIFFWarning (3TIFF)\nroutine.\n.PP\n\\fB\"%s\": Bad mode\\fP.\nThe specified\n.I mode\nparameter was not one of ``r'' (read), ``w'' (write), or ``a'' (append).\n.PP\n.BR \"%s: Cannot open\" .\n.IR TIFFOpen ()\nwas unable to open the specified filename for read/writing.\n.PP\n.BR \"Cannot read TIFF header\" .\nAn error occurred while attempting to read the header information.\n.PP\n.BR \"Error writing TIFF header\" .\nAn error occurred while writing the default header information\nfor a new file.\n.PP\n.BR \"Not a TIFF file, bad magic number %d (0x%x)\" .\nThe magic number in the header was not (hex)\n0x4d4d or (hex) 0x4949.\n.PP\n.BR \"Not a TIFF file, bad version number %d (0x%x)\" .\nThe version field in the header was not 42 (decimal).\n.PP\n.BR \"Cannot append to file that has opposite byte ordering\" .\nA file with a byte ordering opposite to the native byte\nordering of the current machine was opened for appending (``a'').\nThis is a limitation of the library.\n.SH \"SEE ALSO\"\n.IR libtiff (3TIFF),\n.IR TIFFClose (3TIFF)\n"
  },
  {
    "path": "src/main/jni/tiff/man/TIFFPrintDirectory.3tiff",
    "content": ".\\\" $Id: TIFFPrintDirectory.3tiff,v 1.1 2004/11/11 14:39:16 dron Exp $\n.\\\"\n.\\\" Copyright (c) 1991-1997 Sam Leffler\n.\\\" Copyright (c) 1991-1997 Silicon Graphics, Inc.\n.\\\"\n.\\\" Permission to use, copy, modify, distribute, and sell this software and \n.\\\" its documentation for any purpose is hereby granted without fee, provided\n.\\\" that (i) the above copyright notices and this permission notice appear in\n.\\\" all copies of the software and related documentation, and (ii) the names of\n.\\\" Sam Leffler and Silicon Graphics may not be used in any advertising or\n.\\\" publicity relating to the software without the specific, prior written\n.\\\" permission of Sam Leffler and Silicon Graphics.\n.\\\" \n.\\\" THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n.\\\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n.\\\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n.\\\" \n.\\\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n.\\\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n.\\\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n.\\\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n.\\\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n.\\\" OF THIS SOFTWARE.\n.\\\"\n.if n .po 0\n.TH TIFFPrintDirectory 3TIFF \"December 12, 1991\" \"libtiff\"\n.SH NAME\nTIFFPrintDirectory \\- print a description of a\n.SM TIFF\ndirectory\n.SH SYNOPSIS\n.B \"#include <tiffio.h>\"\n.sp\n.BI \"void TIFFPrintDirectory(TIFF *\" tif \", FILE *\" fd \", long \" flags \")\"\n.SH DESCRIPTION\n.I TIFFPrintDirectory\nprints a description of the current directory in the specified\n.SM TIFF\nfile to the standard I/O output stream\n.IR fd .\nThe\n.I flags\nparameter is used to control the\n.I \"level of detail\"\nof the printed information; it is a bit-or of the flags defined in\n.BR tiffio.h :\n.sp .5\n.nf\n.ta \\w'#define 'u +\\w'TIFFPRINT_JPEGDCTABLES  'u +\\w'0x200   'u\n#define\tTIFFPRINT_NONE\t0x0\t/* no extra info */\n#define\tTIFFPRINT_STRIPS\t0x1\t/* strips/tiles info */\n#define\tTIFFPRINT_CURVES\t0x2\t/* color/gray response curves */\n#define\tTIFFPRINT_COLORMAP\t0x4\t/* colormap */\n#define\tTIFFPRINT_JPEGQTABLES\t0x100\t/* JPEG Q matrices */\n#define\tTIFFPRINT_JPEGACTABLES\t0x200\t/* JPEG AC tables */\n#define\tTIFFPRINT_JPEGDCTABLES\t0x200\t/* JPEG DC tables */\n.fi\n.SH NOTES\nIn C++ the\n.I flags\nparameter defaults to 0.\n.SH \"RETURN VALUES\"\nNone.\n.SH DIAGNOSTICS\nNone.\n.SH \"SEE ALSO\"\n.IR libtiff (3TIFF),\n.IR TIFFOpen (3TIFF),\n.IR TIFFReadDirectory (3TIFF),\n.IR TIFFSetDirectory (3TIFF)\n"
  },
  {
    "path": "src/main/jni/tiff/man/TIFFRGBAImage.3tiff",
    "content": ".\\\" $Id: TIFFRGBAImage.3tiff,v 1.2 2005/11/02 11:07:18 dron Exp $\n.\\\"\n.\\\" Copyright (c) 1991-1997 Sam Leffler\n.\\\" Copyright (c) 1991-1997 Silicon Graphics, Inc.\n.\\\"\n.\\\" Permission to use, copy, modify, distribute, and sell this software and \n.\\\" its documentation for any purpose is hereby granted without fee, provided\n.\\\" that (i) the above copyright notices and this permission notice appear in\n.\\\" all copies of the software and related documentation, and (ii) the names of\n.\\\" Sam Leffler and Silicon Graphics may not be used in any advertising or\n.\\\" publicity relating to the software without the specific, prior written\n.\\\" permission of Sam Leffler and Silicon Graphics.\n.\\\" \n.\\\" THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n.\\\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n.\\\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n.\\\" \n.\\\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n.\\\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n.\\\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n.\\\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n.\\\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n.\\\" OF THIS SOFTWARE.\n.\\\"\n.if n .po 0\n.TH TIFFRGBAImage 3TIFF \"October 29, 2004\" \"libtiff\"\n.SH NAME\nTIFFRGBAImageOK, TIFFRGBAImageBegin, TIFFRGBAImageGet, TIFFRGBAImageEnd\n\\- read and decode an image into a raster\n.SH SYNOPSIS\n.B \"#include <tiffio.h>\"\n.sp\n.B \"typedef unsigned char TIFFRGBValue;\"\n.B \"typedef struct _TIFFRGBAImage TIFFRGBAImage;\"\n.sp\n.BI \"int TIFFRGBAImageOK(TIFF *\" tif \", char \" emsg[1024] \")\"\n.br\n.BI \"int TIFFRGBAImageBegin(TIFFRGBAImage *\" img \", TIFF* \" tif \", int \" stopOnError \", char \" emsg[1024] \")\"\n.br\n.BI \"int TIFFRGBAImageGet(TIFFRGBAImage *\" img \", uint32* \" raster \", uint32 \" width \" , uint32 \" height \")\"\n.br\n.BI \"void TIFFRGBAImageEnd(TIFFRGBAImage *\" img \")\"\n.br\n.SH DESCRIPTION\nThe routines described here provide a high-level interface\nthrough which\n.SM TIFF\nimages may be read into memory.\nImages may be strip- or tile-based and have a variety of different\ncharacteristics: bits/sample, samples/pixel, photometric, etc.\nDecoding state is encapsulated in a\n.I TIFFRGBAImage\nstructure making it possible to capture state for multiple images\nand quickly switch between them.\nThe target raster format can be customized to a particular application's\nneeds by installing custom routines that manipulate image data\naccording to application requirements.\n.PP\nThe default usage for these routines is: check if an image can\nbe processed using\n.IR TIFFRGBAImageOK ,\nconstruct a decoder state block using\n.IR TIFFRGBAImageBegin ,\nread and decode an image into a target raster using\n.IR TIFFRGBAImageGet ,\nand then\nrelease resources using\n.IR TIFFRGBAImageEnd .\n.I TIFFRGBAImageGet\ncan be called multiple times to decode an image using different\nstate parameters.\nIf multiple images are to be displayed and there is not enough\nspace for each of the decoded rasters, multiple state blocks can\nbe managed and then calls can be made to\n.I TIFFRGBAImageGet\nas needed to display an image.\n.PP\nThe generated raster is assumed to be an array of\n.I width\ntimes\n.I height\n32-bit entries, where\n.I width\nmust be less than or equal to the width of the image (\\c\n.I height\nmay be any non-zero size).\nIf the raster dimensions are smaller than the image, the image data\nis cropped to the raster bounds.\nIf the raster height is greater than that of the image, then the\nimage data are placed in the lower part of the raster.\n(Note that the raster is assume to be organized such that the pixel\nat location (\\fIx\\fP,\\fIy\\fP) is \\fIraster\\fP[\\fIy\\fP*\\fIwidth\\fP+\\fIx\\fP];\nwith the raster origin in the \n.B lower-left\nhand corner.)\n.PP\nRaster pixels are 8-bit packed red, green, blue, alpha samples.\nThe macros\n.IR TIFFGetR ,\n.IR TIFFGetG ,\n.IR TIFFGetB ,\nand\n.I TIFFGetA\nshould be used to access individual samples.\nImages without Associated Alpha matting information have a constant\nAlpha of 1.0 (255).\n.PP\n.I TIFFRGBAImageGet\nconverts non-8-bit images by scaling sample values.\nPalette, grayscale, bilevel, \n.SM CMYK\\c\n, and YCbCr images are converted to\n.SM RGB\ntransparently.\nRaster pixels are returned uncorrected by any colorimetry information\npresent in the directory.\n.PP\nThe parameter\n.I stopOnError\nspecifies how to act if an error is encountered while reading\nthe image.\nIf\n.I stopOnError\nis non-zero, then an error will terminate the operation; otherwise\n.I TIFFRGBAImageGet\nwill continue processing data until all the possible data in the\nimage have been requested.\n.SH \"ALTERNATE RASTER FORMATS\"\nTo use the core support for reading and processing \n.SM TIFF\nimages, but write the resulting raster data in a different format\none need only override the ``\\fIput methods\\fP'' used to store raster data.\nThese methods are are defined in the\n.I TIFFRGBAImage\nstructure and initially setup by\n.I TIFFRGBAImageBegin\nto point to routines that pack raster data in the default\n.SM ABGR\npixel format.\nTwo different routines are used according to the physical organization\nof the image data in the file: \n.IR PlanarConfiguration =1\n(packed samples),\nand \n.IR PlanarConfiguration =2\n(separated samples).\nNote that this mechanism can be used to transform the data before\nstoring it in the raster.\nFor example one can convert data\nto colormap indices for display on a colormap display.\n.SH \"SIMULTANEOUS RASTER STORE AND DISPLAY\"\nIt is simple to display an image as it is being read into memory\nby overriding the put methods as described above for supporting\nalternate raster formats.\nSimply keep a reference to the default put methods setup by\n.I TIFFRGBAImageBegin\nand then invoke them before or after each display operation.\nFor example, the\n.IR tiffgt (1)\nutility uses the following put method to update the display as\nthe raster is being filled:\n.sp\n.nf\n.ft C\nstatic void\nputContigAndDraw(TIFFRGBAImage* img, uint32* raster,\n    uint32 x, uint32 y, uint32 w, uint32 h,\n    int32 fromskew, int32 toskew,\n    unsigned char* cp)\n{\n    (*putContig)(img, raster, x, y, w, h, fromskew, toskew, cp);\n    if (x+w == width) {\n\tw = width;\n\tif (img->orientation == ORIENTATION_TOPLEFT)\n\t    lrectwrite(0, y-(h-1), w-1, y, raster-x-(h-1)*w);\n\telse\n\t    lrectwrite(0, y, w-1, y+h-1, raster);\n    }\n}\n.ft R\n.fi\n.sp\n(the original routine provided by the library is saved in the\nvariable \n.IR putContig .)\n.SH \"SUPPORTING ADDITIONAL TIFF FORMATS\"\nThe\n.I TIFFRGBAImage\nroutines support the most commonly encountered flavors of\n.SM TIFF.\nIt is possible to extend this support by overriding the ``\\fIget method\\fP''\ninvoked by\n.I TIFFRGBAImageGet\nto read \n.SM TIFF\nimage data.\nDetails of doing this are a bit involved, it is best to make a copy\nof an existing get method and modify it to suit the needs of an\napplication.\n.SH NOTES\nSamples must be either 1, 2, 4, 8, or 16 bits.\nColorimetric samples/pixel must be either 1, 3, or 4 (i.e.\n.I SamplesPerPixel\nminus\n.IR ExtraSamples ).\n.PP\nPalette image colormaps that appear to be incorrectly written\nas 8-bit values are automatically scaled to 16-bits.\n.SH \"RETURN VALUES\"\nAll routines return\n1 if the operation was successful.\nOtherwise, 0 is returned if an error was encountered and\n.I stopOnError\nis zero.\n.SH DIAGNOSTICS\nAll error messages are directed to the\n.IR TIFFError (3TIFF)\nroutine.\n.PP\n.BR \"Sorry, can not handle %d-bit pictures\" .\nThe image had\n.I BitsPerSample\nother than 1, 2, 4, 8, or 16.\n.PP\n.BR \"Sorry, can not handle %d-channel images\" .\nThe image had\n.I SamplesPerPixel\nother than 1, 3, or 4.\n.PP\n\\fBMissing needed \"PhotometricInterpretation\" tag\\fP.\nThe image did not have a tag that describes how to display\nthe data.\n.PP\n\\fBNo \"PhotometricInterpretation\" tag, assuming RGB\\fP.\nThe image was missing a tag that describes how to display it,\nbut because it has 3 or 4 samples/pixel, it is assumed to be\n.SM RGB.\n.PP\n\\fBNo \"PhotometricInterpretation\" tag, assuming min-is-black\\fP.\nThe image was missing a tag that describes how to display it,\nbut because it has 1 sample/pixel, it is assumed to be a grayscale\nor bilevel image.\n.PP\n.BR \"No space for photometric conversion table\" .\nThere was insufficient memory for a table used to convert\nimage samples to 8-bit\n.SM RGB.\n.PP\n\\fBMissing required \"Colormap\" tag\\fP.\nA Palette image did not have a required\n.I Colormap\ntag.\n.PP\n.BR \"No space for tile buffer\" .\nThere was insufficient memory to allocate an i/o buffer.\n.PP\n.BR \"No space for strip buffer\" .\nThere was insufficient memory to allocate an i/o buffer.\n.PP\n.BR \"Can not handle format\" .\nThe image has a format (combination of\n.IR BitsPerSample ,\n.IR SamplesPerPixel ,\nand\n.IR PhotometricInterpretation )\nthat can not be handled.\n.PP\n.BR \"No space for B&W mapping table\" .\nThere was insufficient memory to allocate a table used to map\ngrayscale data to\n.SM RGB.\n.PP\n.BR \"No space for Palette mapping table\" .\nThere was insufficient memory to allocate a table used to map\ndata to 8-bit\n.SM RGB.\n.SH \"SEE ALSO\"\n.BR TIFFOpen (3TIFF),\n.BR TIFFReadRGBAImage (3TIFF),\n.BR TIFFReadRGBAImageOriented (3TIFF),\n.BR TIFFReadRGBAStrip (3TIFF),\n.BR TIFFReadRGBATile (3TIFF),\n.BR libtiff (3TIFF)\n.PP\nLibtiff library home page:\n.BR http://www.remotesensing.org/libtiff/\n"
  },
  {
    "path": "src/main/jni/tiff/man/TIFFReadDirectory.3tiff",
    "content": ".\\\" $Id: TIFFReadDirectory.3tiff,v 1.2 2005/11/02 11:07:18 dron Exp $\n.\\\"\n.\\\" Copyright (c) 1988-1997 Sam Leffler\n.\\\" Copyright (c) 1991-1997 Silicon Graphics, Inc.\n.\\\"\n.\\\" Permission to use, copy, modify, distribute, and sell this software and \n.\\\" its documentation for any purpose is hereby granted without fee, provided\n.\\\" that (i) the above copyright notices and this permission notice appear in\n.\\\" all copies of the software and related documentation, and (ii) the names of\n.\\\" Sam Leffler and Silicon Graphics may not be used in any advertising or\n.\\\" publicity relating to the software without the specific, prior written\n.\\\" permission of Sam Leffler and Silicon Graphics.\n.\\\" \n.\\\" THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n.\\\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n.\\\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n.\\\" \n.\\\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n.\\\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n.\\\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n.\\\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n.\\\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n.\\\" OF THIS SOFTWARE.\n.\\\"\n.if n .po 0\n.TH TIFFReadDirectory 3TIFF \"October 15, 1995\" \"libtiff\"\n.SH NAME\nTIFFReadDirectory \\- get the contents of the next directory in an open\n.SM TIFF\nfile\n.SH SYNOPSIS\n.B \"#include <tiffio.h>\"\n.sp\n.BI \"int TIFFReadDirectory(TIFF *\" tif \")\"\n.SH DESCRIPTION\nRead the next directory in the specified file and make it the current\ndirectory. Applications only need to call\n.I TIFFReadDirectory\nto read multiple subfiles in a single\n.SM TIFF\nfile\\(em\nthe first directory in a file is automatically read when\n.IR TIFFOpen\nis called.\n.SH NOTES\nIf the library is compiled with \n.SM STRIPCHOP_SUPPORT\nenabled, then images that have a single uncompressed strip or tile of data are\nautomatically treated as if they were made up of multiple strips or tiles of\napproximately 8 kilobytes each. This operation is done only in-memory; it does\nnot alter the contents of the file. However, the construction of the ``chopped\nstrips'' is visible to the application through the number of strips [tiles]\nreturned by \n.I TIFFNumberOfStrips\n[\\c\n.IR TIFFNumberOfTiles ].\n.SH \"RETURN VALUES\"\nIf the next directory was successfully read, 1 is returned. Otherwise, 0 is\nreturned if an error was encountered, or if there are no more directories to\nbe read.\n.SH DIAGNOSTICS\nAll error messages are directed to the\n.IR TIFFError (3TIFF)\nroutine.\nAll warning messages are directed to the\n.IR TIFFWarning (3TIFF)\nroutine.\n.PP\n\\fBSeek error accessing TIFF directory\\fP.\nAn error occurred while positioning to the location of the\ndirectory.\n.PP\n\\fBWrong data type %d for field \"%s\"\\fP.\nThe tag entry in the directory had an incorrect data type.\nFor example, an\n.I ImageDescription\ntag with a\n.SM SHORT\ndata type.\n.PP\n\\fBTIFF directory is missing required \"%s\" field\\fP.\nThe specified tag is required to be present by the\n.SM TIFF\n5.0 specification, but is missing.\nThe directory is (usually) unusable.\n.PP\n\\fB%s: Rational with zero denominator\\fP.\nA directory tag has a\n.SM RATIONAL\nvalue whose denominator is zero.\n.PP\n\\fBIncorrect count %d for field \"%s\" (%lu, expecting %lu); tag ignored\\fP.\nThe specified tag's count field is bad.\nFor example, a count other than 1 for a\n.I SubFileType\ntag.\n.PP\n\\fBCannot handle different per-sample values for field \"%s\"\\fP.\nThe tag has\n.I SamplesPerPixel\nvalues and they are not all the same; e.g.\n.IR BitsPerSample .\nThe library is unable to handle images of this sort.\n.PP\n\\fBCount mismatch for field \"%s\"; expecting %d, got %d\\fP.\nThe count field in a\ntag does not agree with the number expected by the library.\nThis should never happen, so if it does, the library refuses to\nread the directory.\n.PP\n\\fBInvalid TIFF directory; tags are not sorted in ascending order\\fP.\nThe directory tags are not properly sorted as specified\nin the\n.SM TIFF\n5.0 specification.\nThis error is not fatal.\n.PP\n\\fBIgnoring unknown field with tag %d (0x%x)\\fP.\nAn unknown tag was encountered in the directory;\nthe library ignores all such tags.\n.PP\n\\fBTIFF directory is missing requred \"ImageLength\" field\\fP.\nThe image violates the specification by not having a necessary field.\nThere is no way for the library to recover from this error.\n.PP\n\\fBTIFF directory is missing requred \"PlanarConfig\" field\\fP.\nThe image violates the specification by not having a necessary field.\nThere is no way for the library to recover from this error.\n.PP\n\\fBTIFF directory is missing requred \"StripOffsets\" field\\fP.\nThe image has multiple strips, but is missing the tag that\nspecifies the file offset to each strip of data.\nThere is no way for the library to recover from this error.\n.PP\n\\fBTIFF directory is missing requred \"TileOffsets\" field\\fP.\nThe image has multiple tiles, but is missing the tag that\nspecifies the file offset to each tile of data.\nThere is no way for the library to recover from this error.\n.PP\n\\fBTIFF directory is missing required \"StripByteCounts\" field\\fP.\nThe image has multiple strips, but is missing the tag that\nspecifies the size of each strip of data.\nThere is no way for the library to recover from this error.\n.PP\n\\fBTIFF directory is missing required \"StripByteCounts\" field, calculating from imagelength\\fP.\nThe image violates the specification by not having a necessary field.\nHowever, when the image is comprised of only one strip or tile, the\nlibrary will estimate the missing value based on the file size.\n.PP\n\\fBBogus \"StripByteCounts\" field, ignoring and calculating from imagelength\\fP.\nCertain vendors violate the specification by writing zero for\nthe StripByteCounts tag when they want to leave the value\nunspecified.\nIf the image has a single strip, the library will estimate\nthe missing value based on the file size.\n.SH \"SEE ALSO\"\n.BR TIFFOpen (3TIFF),\n.BR TIFFWriteDirectory (3TIFF),\n.BR TIFFSetDirectory (3TIFF),\n.BR TIFFSetSubDirectory (3TIFF),\n.BR libtiff (3TIFF)\n.PP\nLibtiff library home page:\n.BR http://www.remotesensing.org/libtiff/\n"
  },
  {
    "path": "src/main/jni/tiff/man/TIFFReadEncodedStrip.3tiff",
    "content": ".\\\" $Id: TIFFReadEncodedStrip.3tiff,v 1.2 2005/11/02 11:07:18 dron Exp $\n.\\\"\n.\\\" Copyright (c) 1988-1997 Sam Leffler\n.\\\" Copyright (c) 1991-1997 Silicon Graphics, Inc.\n.\\\"\n.\\\" Permission to use, copy, modify, distribute, and sell this software and \n.\\\" its documentation for any purpose is hereby granted without fee, provided\n.\\\" that (i) the above copyright notices and this permission notice appear in\n.\\\" all copies of the software and related documentation, and (ii) the names of\n.\\\" Sam Leffler and Silicon Graphics may not be used in any advertising or\n.\\\" publicity relating to the software without the specific, prior written\n.\\\" permission of Sam Leffler and Silicon Graphics.\n.\\\" \n.\\\" THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n.\\\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n.\\\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n.\\\" \n.\\\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n.\\\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n.\\\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n.\\\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n.\\\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n.\\\" OF THIS SOFTWARE.\n.\\\"\n.if n .po 0\n.TH TIFFReadEncodedStrip 3TIFF \"October 15, 1995\" \"libtiff\"\n.SH NAME\nTIFFReadEncodedStrip \\- read and decode a strip of data from an open\n.SM TIFF\nfile\n.SH SYNOPSIS\n.B \"#include <tiffio.h>\"\n.sp\n.BI \"tsize_t TIFFReadEncodedStrip(TIFF *\" tif \", tstrip_t \" strip \", tdata_t \" buf \", tsize_t \" size \")\"\n.SH DESCRIPTION\nRead the specified strip of data and place up to\n.I size\nbytes of decompressed information in the (user supplied) data buffer.\n.SH NOTES\nThe value of\n.I strip\nis a ``raw strip number.''\nThat is, the caller must take into account whether or not the data are\norganized in separate planes (\\c\n.IR PlanarConfiguration =2).\nTo read a full strip of data the data buffer should typically be at least as\nlarge as the number returned by\n.BR TIFFStripSize (3TIFF).\nIf the -1 passed in\n.I size\nparameter, the whole strip will be read. You should be sure you have enough\nspace allocated for the buffer.\n.PP\nThe library attempts to hide bit- and byte-ordering differences between the\nimage and the native machine by converting data to the native machine order.\nBit reversal is done if the\n.I FillOrder\ntag is opposite to the native machine bit order. 16- and 32-bit samples are\nautomatically byte-swapped if the file was written with a byte order opposite\nto the native machine byte order,\n.SH \"RETURN VALUES\"\nThe actual number of bytes of data that were placed in\n.I buf\nis returned;\n.IR TIFFReadEncodedStrip\nreturns \\-1 if an error was encountered.\n.SH DIAGNOSTICS\nAll error messages are directed to the\n.BR TIFFError (3TIFF)\nroutine.\n.SH \"SEE ALSO\"\n.BR TIFFOpen (3TIFF),\n.BR TIFFReadRawStrip (3TIFF),\n.BR TIFFReadScanline (3TIFF),\n.BR libtiff (3TIFF)\n.PP\nLibtiff library home page:\n.BR http://www.remotesensing.org/libtiff/\n"
  },
  {
    "path": "src/main/jni/tiff/man/TIFFReadEncodedTile.3tiff",
    "content": ".\\\" $Id: TIFFReadEncodedTile.3tiff,v 1.3 2006/10/13 07:22:01 dron Exp $\n.\\\"\n.\\\" Copyright (c) 1988-1997 Sam Leffler\n.\\\" Copyright (c) 1991-1997 Silicon Graphics, Inc.\n.\\\"\n.\\\" Permission to use, copy, modify, distribute, and sell this software and \n.\\\" its documentation for any purpose is hereby granted without fee, provided\n.\\\" that (i) the above copyright notices and this permission notice appear in\n.\\\" all copies of the software and related documentation, and (ii) the names of\n.\\\" Sam Leffler and Silicon Graphics may not be used in any advertising or\n.\\\" publicity relating to the software without the specific, prior written\n.\\\" permission of Sam Leffler and Silicon Graphics.\n.\\\" \n.\\\" THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n.\\\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n.\\\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n.\\\" \n.\\\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n.\\\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n.\\\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n.\\\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n.\\\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n.\\\" OF THIS SOFTWARE.\n.\\\"\n.if n .po 0\n.TH TIFFReadEncodedTile 3TIFF \"October 13, 2006\" \"libtiff\"\n.SH NAME\nTIFFReadEncodedTile \\- read and decode a tile of data from an open\n.SM TIFF\nfile\n.SH SYNOPSIS\n.B \"#include <tiffio.h>\"\n.sp\n.BI \"int TIFFReadEncodedTile(TIFF *\" tif \", ttile_t \" tile \", tdata_t \" buf \", tsize_t \" size \")\"\n.SH DESCRIPTION\nRead the specified tile of data and place up to\n.I size\nbytes of decompressed information in the (user supplied) data buffer.\n.SH NOTES\nThe value of\n.I tile\nis a ``raw tile number.''\nThat is, the caller must take into account whether or not the data are\norganized in separate planes (\\c\n.IR PlanarConfiguration =2).\n.IR TIFFComputeTile\nautomatically does this when converting an (x,y,z,sample) coordinate quadruple\nto a tile number. To read a full tile of data the data buffer should be at\nleast as large as the value returned by\n.IR TIFFTileSize .\n.PP\nThe library attempts to hide bit- and byte-ordering differences between the\nimage and the native machine by converting data to the native machine order.\nBit reversal is done if the\n.I FillOrder\ntag is opposite to the native machine bit order. 16- and 32-bit samples are\nautomatically byte-swapped if the file was written with a byte order opposite\nto the native machine byte order,\n.SH \"RETURN VALUES\"\nThe actual number of bytes of data that were placed in\n.I buf\nis returned;\n.IR TIFFReadEncodedTile\nreturns \\-1 if an error was encountered.\n.SH DIAGNOSTICS\nAll error messages are directed to the\n.BR TIFFError (3TIFF)\nroutine.\n.SH \"SEE ALSO\"\n.BR TIFFOpen (3TIFF),\n.BR TIFFReadRawTile (3TIFF),\n.BR TIFFReadTile (3TIFF),\n.BR libtiff (3TIFF)\n.PP\nLibtiff library home page:\n.BR http://www.remotesensing.org/libtiff/\n"
  },
  {
    "path": "src/main/jni/tiff/man/TIFFReadRGBAImage.3tiff",
    "content": ".\\\" $Id: TIFFReadRGBAImage.3tiff,v 1.4 2006/10/13 07:22:01 dron Exp $\n.\\\"\n.\\\" Copyright (c) 1991-1997 Sam Leffler\n.\\\" Copyright (c) 1991-1997 Silicon Graphics, Inc.\n.\\\"\n.\\\" Permission to use, copy, modify, distribute, and sell this software and \n.\\\" its documentation for any purpose is hereby granted without fee, provided\n.\\\" that (i) the above copyright notices and this permission notice appear in\n.\\\" all copies of the software and related documentation, and (ii) the names of\n.\\\" Sam Leffler and Silicon Graphics may not be used in any advertising or\n.\\\" publicity relating to the software without the specific, prior written\n.\\\" permission of Sam Leffler and Silicon Graphics.\n.\\\" \n.\\\" THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n.\\\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n.\\\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n.\\\" \n.\\\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n.\\\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n.\\\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n.\\\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n.\\\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n.\\\" OF THIS SOFTWARE.\n.\\\"\n.if n .po 0\n.TH TIFFReadRGBAImage 3TIFF \"October 13, 2006\" \"libtiff\"\n.SH NAME\nTIFFReadRGBAImage, TIFFReadRGBAImageOriented \\- read and decode an image\ninto a fixed-format raster\n.SH SYNOPSIS\n.B \"#include <tiffio.h>\"\n.sp\n.B \"#define TIFFGetR(abgr) ((abgr) & 0xff)\"\n.br\n.B \"#define TIFFGetG(abgr) (((abgr) >> 8) & 0xff)\"\n.br\n.B \"#define TIFFGetB(abgr) (((abgr) >> 16) & 0xff)\"\n.br\n.B \"#define TIFFGetA(abgr) (((abgr) >> 24) & 0xff)\"\n.sp\n.BI \"int TIFFReadRGBAImage(TIFF *\" tif \", uint32 \" width \", uint32 \" height \", uint32 *\" raster \", int \" stopOnError \")\"\n.br\n.BI \"int TIFFReadRGBAImageOriented(TIFF *\" tif \", uint32 \" width \", uint32 \" height \", uint32 *\" raster \", int \" orientation \", int \" stopOnError \")\"\n.br\n.SH DESCRIPTION\n.IR TIFFReadRGBAImage\nreads a strip- or tile-based image into memory, storing the\nresult in the user supplied\n.IR raster .\nThe raster is assumed to be an array of\n.I width\ntimes\n.I height\n32-bit entries, where\n.I width\nmust be less than or equal to the width of the image (\\c\n.I height\nmay be any non-zero size).\nIf the raster dimensions are smaller than the image, the image data\nis cropped to the raster bounds.\nIf the raster height is greater than that of the image, then the\nimage data are placed in the lower part of the raster.\n(Note that the raster is assume to be organized such that the pixel\nat location (\\fIx\\fP,\\fIy\\fP) is \\fIraster\\fP[\\fIy\\fP*\\fIwidth\\fP+\\fIx\\fP];\nwith the raster origin in the lower-left hand corner.)\n.PP\n.IR TIFFReadRGBAImageOriented\nworks like\n.IR TIFFReadRGBAImage\nwith except of that user can specify the raster origin position with the\n.I orientation\nparameter. Four orientations supported:\n.TP\n.B ORIENTATION_TOPLEFT\norigin in top-left corner,\n.TP\n.B ORIENTATION_TOPRIGHT\norigin in top-right corner,\n.TP\n.B ORIENTATION_BOTLEFT\norigin in bottom-left corner\nand\n.TP\n.B ORIENTATION_BOTRIGHT\norigin in bottom-right corner.\n.LP\nIf you choose\n.B ORIENTATION_BOTLEFT\nresult will be the same as returned by the\n.IR TIFFReadRGBAImage.\n.PP\nRaster pixels are 8-bit packed red, green, blue, alpha samples.\nThe macros\n.IR TIFFGetR ,\n.IR TIFFGetG ,\n.IR TIFFGetB ,\nand\n.I TIFFGetA\nshould be used to access individual samples.\nImages without Associated Alpha matting information have a constant\nAlpha of 1.0 (255).\n.PP\n.I TIFFReadRGBAImage\nconverts non-8-bit images by scaling sample values.\nPalette, grayscale, bilevel, \n.SM CMYK\\c\n, and YCbCr images are converted to\n.SM RGB\ntransparently.\nRaster pixels are returned uncorrected by any colorimetry information\npresent in the directory.\n.PP\nThe paramater\n.I stopOnError\nspecifies how to act if an error is encountered while reading\nthe image.\nIf\n.I stopOnError\nis non-zero, then an error will terminate the operation; otherwise\n.I TIFFReadRGBAImage\nwill continue processing data until all the possible data in the\nimage have been requested.\n.SH NOTES\nIn C++ the\n.I stopOnError\nparameter defaults to 0.\n.PP\nSamples must be either 1, 2, 4, 8, or 16 bits.\nColorimetric samples/pixel must be either 1, 3, or 4 (i.e.\n.I SamplesPerPixel\nminus\n.IR ExtraSamples ).\n.PP\nPalettte image colormaps that appear to be incorrectly written\nas 8-bit values are automatically scaled to 16-bits.\n.PP\n.I TIFFReadRGBAImage\nis just a wrapper around the more general\n.IR TIFFRGBAImage (3TIFF)\nfacilities.\n.SH \"RETURN VALUES\"\n1 is returned if the image was successfully read and converted.\nOtherwise, 0 is returned if an error was encountered and\n.I stopOnError\nis zero.\n.SH DIAGNOSTICS\nAll error messages are directed to the\n.IR TIFFError (3TIFF)\nroutine.\n.PP\n.BR \"Sorry, can not handle %d-bit pictures\" .\nThe image had\n.I BitsPerSample\nother than 1, 2, 4, 8, or 16.\n.PP\n.BR \"Sorry, can not handle %d-channel images\" .\nThe image had\n.I SamplesPerPixel\nother than 1, 3, or 4.\n.PP\n\\fBMissing needed \"PhotometricInterpretation\" tag\\fP.\nThe image did not have a tag that describes how to display\nthe data.\n.PP\n\\fBNo \"PhotometricInterpretation\" tag, assuming RGB\\fP.\nThe image was missing a tag that describes how to display it,\nbut because it has 3 or 4 samples/pixel, it is assumed to be\n.SM RGB.\n.PP\n\\fBNo \"PhotometricInterpretation\" tag, assuming min-is-black\\fP.\nThe image was missing a tag that describes how to display it,\nbut because it has 1 sample/pixel, it is assumed to be a grayscale\nor bilevel image.\n.PP\n.BR \"No space for photometric conversion table\" .\nThere was insufficient memory for a table used to convert\nimage samples to 8-bit\n.SM RGB.\n.PP\n\\fBMissing required \"Colormap\" tag\\fP.\nA Palette image did not have a required\n.I Colormap\ntag.\n.PP\n.BR \"No space for tile buffer\" .\nThere was insufficient memory to allocate an i/o buffer.\n.PP\n.BR \"No space for strip buffer\" .\nThere was insufficient memory to allocate an i/o buffer.\n.PP\n.BR \"Can not handle format\" .\nThe image has a format (combination of\n.IR BitsPerSample ,\n.IR SamplesPerPixel ,\nand\n.IR PhotometricInterpretation )\nthat\n.I TIFFReadRGBAImage\ncan not handle.\n.PP\n.BR \"No space for B&W mapping table\" .\nThere was insufficient memory to allocate a table used to map\ngrayscale data to\n.SM RGB.\n.PP\n.BR \"No space for Palette mapping table\" .\nThere was insufficient memory to allocate a table used to map\ndata to 8-bit\n.SM RGB.\n.SH \"SEE ALSO\"\n.BR TIFFOpen (3TIFF),\n.BR TIFFRGBAImage (3TIFF),\n.BR TIFFReadRGBAStrip (3TIFF),\n.BR TIFFReadRGBATile (3TIFF),\n.BR libtiff (3TIFF)\n.PP\nLibtiff library home page:\n.BR http://www.remotesensing.org/libtiff/\n"
  },
  {
    "path": "src/main/jni/tiff/man/TIFFReadRGBAStrip.3tiff",
    "content": ".\\\" $Id: TIFFReadRGBAStrip.3tiff,v 1.3 2005/11/02 11:07:18 dron Exp $\n.\\\"\n.\\\" Copyright (c) 1991-1997 Sam Leffler\n.\\\" Copyright (c) 1991-1997 Silicon Graphics, Inc.\n.\\\"\n.\\\" Permission to use, copy, modify, distribute, and sell this software and \n.\\\" its documentation for any purpose is hereby granted without fee, provided\n.\\\" that (i) the above copyright notices and this permission notice appear in\n.\\\" all copies of the software and related documentation, and (ii) the names of\n.\\\" Sam Leffler and Silicon Graphics may not be used in any advertising or\n.\\\" publicity relating to the software without the specific, prior written\n.\\\" permission of Sam Leffler and Silicon Graphics.\n.\\\" \n.\\\" THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n.\\\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n.\\\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n.\\\" \n.\\\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n.\\\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n.\\\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n.\\\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n.\\\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n.\\\" OF THIS SOFTWARE.\n.\\\"\n.if n .po 0\n.TH TIFFReadRGBAStrip 3TIFF \"December 10, 1998\" \"libtiff\"\n.SH NAME\nTIFFReadRGBAStrip \\- read and decode an image strip into a fixed-format raster\n.SH SYNOPSIS\n.B \"#include <tiffio.h>\"\n.sp\n.B \"#define TIFFGetR(abgr) ((abgr) & 0xff)\"\n.br\n.B \"#define TIFFGetG(abgr) (((abgr) >> 8) & 0xff)\"\n.br\n.B \"#define TIFFGetB(abgr) (((abgr) >> 16) & 0xff)\"\n.br\n.B \"#define TIFFGetA(abgr) (((abgr) >> 24) & 0xff)\"\n.sp\n.BI \"int TIFFReadRGBAStrip(TIFF *\" tif \", uint32 \" row \", uint32 *\" raster \")\"\n.SH DESCRIPTION\n.IR TIFFReadRGBAStrip\nreads a single strip of a strip-based image into memory, storing the result in\nthe user supplied RGBA\n.IR raster .\nThe raster is assumed to be an array of width times rowsperstrip 32-bit\nentries, where width is the width of the image (TIFFTAG_IMAGEWIDTH) and\nrowsperstrip is the maximum lines in a strip (TIFFTAG_ROWSPERSTRIP). \n\n.PP\nThe \n.IR row\nvalue should be the row of the first row in the strip (strip * rowsperstrip,\nzero based).\n\n.PP\nNote that the raster is assume to be organized such that the pixel at location\n(\\fIx\\fP,\\fIy\\fP) is \\fIraster\\fP[\\fIy\\fP*\\fIwidth\\fP+\\fIx\\fP]; with the\nraster origin in the \n.I lower-left hand corner\nof the strip. That is bottom to top organization.  When reading a partial last\nstrip in the file the last line of the image will begin at the beginning of\nthe buffer.\n\n.PP\nRaster pixels are 8-bit packed red, green, blue, alpha samples. The macros\n.IR TIFFGetR ,\n.IR TIFFGetG ,\n.IR TIFFGetB ,\nand\n.I TIFFGetA\nshould be used to access individual samples. Images without Associated Alpha\nmatting information have a constant Alpha of 1.0 (255).\n.PP\nSee the \n.IR TIFFRGBAImage (3TIFF) \npage for more details on how various image types are converted to RGBA values.\n.SH NOTES\nSamples must be either 1, 2, 4, 8, or 16 bits. Colorimetric samples/pixel must\nbe either 1, 3, or 4 (i.e.\n.I SamplesPerPixel\nminus\n.IR ExtraSamples ).\n.PP\nPalette image colormaps that appear to be incorrectly written as 8-bit values\nare automatically scaled to 16-bits.\n.PP\n.I TIFFReadRGBAStrip\nis just a wrapper around the more general\n.IR TIFFRGBAImage (3TIFF)\nfacilities.  It's main advantage over the similar \n.IR TIFFReadRGBAImage() \nfunction is that for large images a single buffer capable of holding the whole\nimage doesn't need to be allocated, only enough for one strip.  The \n.IR TIFFReadRGBATile() \nfunction does a similar operation for tiled images.\n.SH \"RETURN VALUES\"\n1 is returned if the image was successfully read and converted.\nOtherwise, 0 is returned if an error was encountered.\n.SH DIAGNOSTICS\nAll error messages are directed to the\n.IR TIFFError (3TIFF)\nroutine.\n.PP\n.BR \"Sorry, can not handle %d-bit pictures\" .\nThe image had\n.I BitsPerSample\nother than 1, 2, 4, 8, or 16.\n.PP\n.BR \"Sorry, can not handle %d-channel images\" .\nThe image had\n.I SamplesPerPixel\nother than 1, 3, or 4.\n.PP\n\\fBMissing needed \"PhotometricInterpretation\" tag\\fP.\nThe image did not have a tag that describes how to display the data.\n.PP\n\\fBNo \"PhotometricInterpretation\" tag, assuming RGB\\fP.\nThe image was missing a tag that describes how to display it, but because it\nhas 3 or 4 samples/pixel, it is assumed to be\n.SM RGB.\n.PP\n\\fBNo \"PhotometricInterpretation\" tag, assuming min-is-black\\fP. The image was\nmissing a tag that describes how to display it, but because it has 1\nsample/pixel, it is assumed to be a grayscale or bilevel image.\n.PP\n.BR \"No space for photometric conversion table\" .\nThere was insufficient memory for a table used to convert image samples to\n8-bit\n.SM RGB.\n.PP\n\\fBMissing required \"Colormap\" tag\\fP.\nA Palette image did not have a required\n.I Colormap\ntag.\n.PP\n.BR \"No space for tile buffer\" .\nThere was insufficient memory to allocate an i/o buffer.\n.PP\n.BR \"No space for strip buffer\" .\nThere was insufficient memory to allocate an i/o buffer.\n.PP\n.BR \"Can not handle format\" .\nThe image has a format (combination of\n.IR BitsPerSample ,\n.IR SamplesPerPixel ,\nand\n.IR PhotometricInterpretation )\nthat\n.I TIFFReadRGBAImage\ncan not handle.\n.PP\n.BR \"No space for B&W mapping table\" .\nThere was insufficient memory to allocate a table used to map grayscale data\nto\n.SM RGB.\n.PP\n.BR \"No space for Palette mapping table\" .\nThere was insufficient memory to allocate a table used to map data to 8-bit\n.SM RGB.\n.SH \"SEE ALSO\"\n.BR TIFFOpen (3TIFF),\n.BR TIFFRGBAImage (3TIFF),\n.BR TIFFReadRGBAImage (3TIFF),\n.BR TIFFReadRGBATile (3TIFF),\n.BR libtiff (3TIFF)\n.PP\nLibtiff library home page:\n.BR http://www.remotesensing.org/libtiff/\n\n"
  },
  {
    "path": "src/main/jni/tiff/man/TIFFReadRGBATile.3tiff",
    "content": ".\\\" $Id: TIFFReadRGBATile.3tiff,v 1.2 2005/11/02 11:07:18 dron Exp $\n.\\\"\n.\\\" Copyright (c) 1991-1997 Sam Leffler\n.\\\" Copyright (c) 1991-1997 Silicon Graphics, Inc.\n.\\\"\n.\\\" Permission to use, copy, modify, distribute, and sell this software and \n.\\\" its documentation for any purpose is hereby granted without fee, provided\n.\\\" that (i) the above copyright notices and this permission notice appear in\n.\\\" all copies of the software and related documentation, and (ii) the names of\n.\\\" Sam Leffler and Silicon Graphics may not be used in any advertising or\n.\\\" publicity relating to the software without the specific, prior written\n.\\\" permission of Sam Leffler and Silicon Graphics.\n.\\\" \n.\\\" THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n.\\\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n.\\\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n.\\\" \n.\\\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n.\\\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n.\\\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n.\\\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n.\\\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n.\\\" OF THIS SOFTWARE.\n.\\\"\n.if n .po 0\n.TH TIFFReadRGBATile 3TIFF \"December 10, 1998\" \"libtiff\"\n.SH NAME\nTIFFReadRGBATile \\- read and decode an image tile into a fixed-format raster\n.SH SYNOPSIS\n.B \"#include <tiffio.h>\"\n.sp\n.B \"#define TIFFGetR(abgr)\t((abgr) & 0xff)\"\n.br\n.B \"#define TIFFGetG(abgr)\t(((abgr) >> 8) & 0xff)\"\n.br\n.B \"#define TIFFGetB(abgr)\t(((abgr) >> 16) & 0xff)\"\n.br\n.B \"#define TIFFGetA(abgr)\t(((abgr) >> 24) & 0xff)\"\n.sp\n.BI \"int TIFFReadRGBATile(TIFF *\" tif \", uint32 \" x \", uint32 \" y \", uint32 *\" raster \")\"\n.SH DESCRIPTION\n.IR TIFFReadRGBATile\nreads a single tile of a tile-based image into memory, storing the result in\nthe user supplied RGBA\n.IR raster .\nThe raster is assumed to be an array of width times length 32-bit entries,\nwhere width is the width of a tile (TIFFTAG_TILEWIDTH) and length is the\nheight of a tile (TIFFTAG_TILELENGTH). \n\n.PP\nThe \n.IR x\nand \n.IR y\nvalues are the offsets from the top left corner to the top left corner of the\ntile to be read.  They must be an exact multiple of the tile width and length. \n\n.PP\nNote that the raster is assume to be organized such that the pixel at location\n(\\fIx\\fP,\\fIy\\fP) is \\fIraster\\fP[\\fIy\\fP*\\fIwidth\\fP+\\fIx\\fP]; with the\nraster origin in the \n.I lower-left hand corner\nof the tile. That is bottom to top organization.  Edge tiles which partly fall\noff the image will be filled out with appropriate zeroed areas.\n\n.PP\nRaster pixels are 8-bit packed red, green, blue, alpha samples. The macros\n.IR TIFFGetR ,\n.IR TIFFGetG ,\n.IR TIFFGetB ,\nand\n.I TIFFGetA\nshould be used to access individual samples. Images without Associated Alpha\nmatting information have a constant Alpha of 1.0 (255).\n.PP\nSee the \n.IR TIFFRGBAImage (3TIFF) \npage for more details on how various image types are converted to RGBA values.\n.SH NOTES\nSamples must be either 1, 2, 4, 8, or 16 bits. Colorimetric samples/pixel must\nbe either 1, 3, or 4 (i.e.\n.I SamplesPerPixel\nminus\n.IR ExtraSamples ).\n.PP\nPalette image colormaps that appear to be incorrectly written as 8-bit values\nare automatically scaled to 16-bits.\n.PP\n.I TIFFReadRGBATile\nis just a wrapper around the more general\n.IR TIFFRGBAImage (3TIFF)\nfacilities.  It's main advantage over the similar \n.IR TIFFReadRGBAImage() \nfunction is that for large images a single buffer capable of holding the whole\nimage doesn't need to be allocated, only enough for one tile.  The \n.IR TIFFReadRGBAStrip() \nfunction does a similar operation for stripped images.\n.SH \"RETURN VALUES\"\n1 is returned if the image was successfully read and converted.\nOtherwise, 0 is returned if an error was encountered.\n.SH DIAGNOSTICS\nAll error messages are directed to the\n.IR TIFFError (3TIFF)\nroutine.\n.PP\n.BR \"Sorry, can not handle %d-bit pictures\" .\nThe image had\n.I BitsPerSample\nother than 1, 2, 4, 8, or 16.\n.PP\n.BR \"Sorry, can not handle %d-channel images\" .\nThe image had\n.I SamplesPerPixel\nother than 1, 3, or 4.\n.PP\n\\fBMissing needed \"PhotometricInterpretation\" tag\\fP.\nThe image did not have a tag that describes how to display the data.\n.PP\n\\fBNo \"PhotometricInterpretation\" tag, assuming RGB\\fP.\nThe image was missing a tag that describes how to display it, but because it\nhas 3 or 4 samples/pixel, it is assumed to be\n.SM RGB.\n.PP\n\\fBNo \"PhotometricInterpretation\" tag, assuming min-is-black\\fP.\nThe image was missing a tag that describes how to display it,\nbut because it has 1 sample/pixel, it is assumed to be a grayscale\nor bilevel image.\n.PP\n.BR \"No space for photometric conversion table\" .\nThere was insufficient memory for a table used to convert\nimage samples to 8-bit\n.SM RGB.\n.PP\n\\fBMissing required \"Colormap\" tag\\fP.\nA Palette image did not have a required\n.I Colormap\ntag.\n.PP\n.BR \"No space for tile buffer\" .\nThere was insufficient memory to allocate an i/o buffer.\n.PP\n.BR \"No space for strip buffer\" .\nThere was insufficient memory to allocate an i/o buffer.\n.PP\n.BR \"Can not handle format\" .\nThe image has a format (combination of\n.IR BitsPerSample ,\n.IR SamplesPerPixel ,\nand\n.IR PhotometricInterpretation )\nthat\n.I TIFFReadRGBAImage\ncan not handle.\n.PP\n.BR \"No space for B&W mapping table\" .\nThere was insufficient memory to allocate a table used to map\ngrayscale data to\n.SM RGB.\n.PP\n.BR \"No space for Palette mapping table\" .\nThere was insufficient memory to allocate a table used to map data to 8-bit\n.SM RGB.\n.SH \"SEE ALSO\"\n.BR TIFFOpen (3TIFF),\n.BR TIFFRGBAImage (3TIFF),\n.BR TIFFReadRGBAImage (3TIFF),\n.BR TIFFReadRGBAStrip (3TIFF),\n.BR libtiff (3TIFF)\n.PP\nLibtiff library home page:\n.BR http://www.remotesensing.org/libtiff/\n"
  },
  {
    "path": "src/main/jni/tiff/man/TIFFReadRawStrip.3tiff",
    "content": ".\\\" $Id: TIFFReadRawStrip.3tiff,v 1.2 2005/11/02 11:07:18 dron Exp $\n.\\\"\n.\\\" Copyright (c) 1988-1997 Sam Leffler\n.\\\" Copyright (c) 1991-1997 Silicon Graphics, Inc.\n.\\\"\n.\\\" Permission to use, copy, modify, distribute, and sell this software and \n.\\\" its documentation for any purpose is hereby granted without fee, provided\n.\\\" that (i) the above copyright notices and this permission notice appear in\n.\\\" all copies of the software and related documentation, and (ii) the names of\n.\\\" Sam Leffler and Silicon Graphics may not be used in any advertising or\n.\\\" publicity relating to the software without the specific, prior written\n.\\\" permission of Sam Leffler and Silicon Graphics.\n.\\\" \n.\\\" THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n.\\\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n.\\\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n.\\\" \n.\\\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n.\\\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n.\\\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n.\\\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n.\\\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n.\\\" OF THIS SOFTWARE.\n.\\\"\n.if n .po 0\n.TH TIFFReadRawStrip 3TIFF \"October 15, 1995\" \"libtiff\"\n.SH NAME\nTIFFReadRawStrip \\- return the undecoded contents of a strip of data from an\nopen\n.SM TIFF\nfile\n.SH SYNOPSIS\n.B \"#include <tiffio.h>\"\n.sp\n.BI \"tsize_t TIFFReadRawStrip(TIFF *\" tif \", tstrip_t \" strip \", tdata_t \" buf \", tsize_t \" size \")\"\n.SH DESCRIPTION\nRead the contents of the specified strip into the (user supplied) data buffer.\nNote that the value of\n.I strip\nis a ``raw strip number.'' That is, the caller must take into account whether\nor not the data is organized in separate planes (\\c\n.IR PlanarConfiguration =2).\nTo read a full strip of data the data buffer should typically be at least as\nlarge as the number returned by\n.IR TIFFStripSize .\n.SH \"RETURN VALUES\"\nThe actual number of bytes of data that were placed in\n.I buf\nis returned;\n.IR TIFFReadEncodedStrip\nreturns \\-1 if an error was encountered.\n.SH DIAGNOSTICS\nAll error messages are directed to the\n.BR TIFFError (3TIFF)\nroutine.\n.SH \"SEE ALSO\"\n.BR TIFFOpen (3TIFF),\n.BR TIFFReadEncodedStrip (3TIFF),\n.BR TIFFReadScanline (3TIFF),\n.BR TIFFStripSize (3TIFF),\n.BR libtiff (3TIFF)\n.PP\nLibtiff library home page:\n.BR http://www.remotesensing.org/libtiff/\n"
  },
  {
    "path": "src/main/jni/tiff/man/TIFFReadRawTile.3tiff",
    "content": ".\\\" $Id: TIFFReadRawTile.3tiff,v 1.2 2005/11/02 11:07:18 dron Exp $\n.\\\"\n.\\\" Copyright (c) 1988-1997 Sam Leffler\n.\\\" Copyright (c) 1991-1997 Silicon Graphics, Inc.\n.\\\"\n.\\\" Permission to use, copy, modify, distribute, and sell this software and \n.\\\" its documentation for any purpose is hereby granted without fee, provided\n.\\\" that (i) the above copyright notices and this permission notice appear in\n.\\\" all copies of the software and related documentation, and (ii) the names of\n.\\\" Sam Leffler and Silicon Graphics may not be used in any advertising or\n.\\\" publicity relating to the software without the specific, prior written\n.\\\" permission of Sam Leffler and Silicon Graphics.\n.\\\" \n.\\\" THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n.\\\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n.\\\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n.\\\" \n.\\\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n.\\\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n.\\\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n.\\\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n.\\\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n.\\\" OF THIS SOFTWARE.\n.\\\"\n.if n .po 0\n.TH TIFFReadRawTile 3TIFF \"October 15, 1995\" \"libtiff\"\n.SH NAME\nTIFFReadRawTile \\- return an undecoded tile of data from an open\n.SM TIFF\nfile\n.SH SYNOPSIS\n.B \"#include <tiffio.h>\"\n.sp\n.BI \"tsize_t TIFFReadRawTile(TIFF *\" tif \", ttile_t \" tile \", tdata_t \" buf \", tsize_t \" size \")\"\n.SH DESCRIPTION\nRead the contents of the specified tile into the (user supplied) data buffer.\nNote that the value of\n.I tile\nis a ``raw tile number.'' That is, the caller must take into account whether\nor not the data is organized in separate planes (\\c\n.IR PlanarConfiguration =2).\n.I TIFFComputeTile\nautomatically does this when converting an (x,y,z,sample) coordinate quadruple\nto a tile number. To read a full tile of data the data buffer should typically\nbe at least as large as the value returned by\n.IR TIFFTileSize .\n.SH \"RETURN VALUES\"\nThe actual number of bytes of data that were placed in\n.I buf\nis returned;\n.IR TIFFReadEncodedTile\nreturns \\-1 if an error was encountered.\n.SH DIAGNOSTICS\nAll error messages are directed to the\n.BR TIFFError (3TIFF)\nroutine.\n.SH \"SEE ALSO\"\n.BR TIFFOpen (3TIFF),\n.BR TIFFReadEncodedTile (3TIFF),\n.BR TIFFReadTile (3TIFF),\n.BR TIFFTileSize (3TIFF),\n.BR libtiff (3TIFF)\n.PP\nLibtiff library home page:\n.BR http://www.remotesensing.org/libtiff/\n"
  },
  {
    "path": "src/main/jni/tiff/man/TIFFReadScanline.3tiff",
    "content": ".\\\" $Id: TIFFReadScanline.3tiff,v 1.2 2005/11/02 11:07:18 dron Exp $\n.\\\"\n.\\\" Copyright (c) 1988-1997 Sam Leffler\n.\\\" Copyright (c) 1991-1997 Silicon Graphics, Inc.\n.\\\"\n.\\\" Permission to use, copy, modify, distribute, and sell this software and \n.\\\" its documentation for any purpose is hereby granted without fee, provided\n.\\\" that (i) the above copyright notices and this permission notice appear in\n.\\\" all copies of the software and related documentation, and (ii) the names of\n.\\\" Sam Leffler and Silicon Graphics may not be used in any advertising or\n.\\\" publicity relating to the software without the specific, prior written\n.\\\" permission of Sam Leffler and Silicon Graphics.\n.\\\" \n.\\\" THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n.\\\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n.\\\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n.\\\" \n.\\\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n.\\\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n.\\\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n.\\\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n.\\\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n.\\\" OF THIS SOFTWARE.\n.\\\"\n.if n .po 0\n.TH TIFFReadScanline 3TIFF \"October 15, 1995\" \"libtiff\"\n.SH NAME\nTIFFReadScanline \\- read and decode a scanline of data from an open\n.SM TIFF\nfile\n.SH SYNOPSIS\n.B \"#include <tiffio.h>\"\n.sp\n.BI \"int TIFFReadScanline(TIFF *\" tif \", tdata_t \" buf \", uint32 \" row \", tsample_t \" sample \")\"\n.SH DESCRIPTION\nRead the data for the specified row into the (user supplied) data buffer\n.IR buf .\nThe data are returned decompressed and, in the native byte- and bit-ordering,\nbut are otherwise packed (see further below). The buffer must be large enough\nto hold an entire scanline of data. Applications should call the routine\n.IR TIFFScanlineSize\nto find out the size (in bytes) of a scanline buffer.\nThe\n.I row\nparameter is always used by\n.IR TIFFReadScanline ;\nthe\n.I sample\nparameter is used only if data are organized in separate planes (\\c\n.IR PlanarConfiguration =2).\n.SH NOTES\nThe library attempts to hide bit- and byte-ordering differences between the\nimage and the native machine by converting data to the native machine order.\nBit reversal is done if the\n.I FillOrder\ntag is opposite to the native machine bit order. 16- and 32-bit samples are\nautomatically byte-swapped if the file was written with a byte order opposite\nto the native machine byte order,\n.PP\nIn C++ the\n.I sample\nparameter defaults to 0.\n.SH \"RETURN VALUES\"\n.IR TIFFReadScanline\nreturns \\-1 if it detects an error; otherwise 1 is returned.\n.SH DIAGNOSTICS\nAll error messages are directed to the\n.IR TIFFError (3TIFF)\nroutine.\n.PP\n.BR \"Compression algorithm does not support random access\" .\nData was requested in a non-sequential order from a file that uses a\ncompression algorithm and that has\n.I RowsPerStrip\ngreater than one.\nThat is, data in the image is stored in a compressed form, and with multiple\nrows packed into a strip. In this case, the library does not support random\naccess to the data. The data should either be accessed sequentially, or the\nfile should be converted so that each strip is made up of one row of data.\n.SH BUGS\nReading subsampled YCbCR data does not work correctly because, for \n.IR PlanarConfiguration =2\nthe size of a scanline is not calculated on a per-sample basis, and for\n.IR PlanarConfiguration =1\nthe library does not unpack the block-interleaved samples; use the strip- and\ntile-based interfaces to read these formats.\n.SH \"SEE ALSO\"\n.BR TIFFOpen (3TIFF),\n.BR TIFFReadEncodedStrip (3TIFF),\n.BR TIFFReadRawStrip (3TIFF),\n.BR libtiff (3TIFF)\n.PP\nLibtiff library home page:\n.BR http://www.remotesensing.org/libtiff/\n"
  },
  {
    "path": "src/main/jni/tiff/man/TIFFReadTile.3tiff",
    "content": ".\\\" $Id: TIFFReadTile.3tiff,v 1.2 2005/11/02 11:07:18 dron Exp $\n.\\\"\n.\\\" Copyright (c) 1988-1997 Sam Leffler\n.\\\" Copyright (c) 1991-1997 Silicon Graphics, Inc.\n.\\\"\n.\\\" Permission to use, copy, modify, distribute, and sell this software and \n.\\\" its documentation for any purpose is hereby granted without fee, provided\n.\\\" that (i) the above copyright notices and this permission notice appear in\n.\\\" all copies of the software and related documentation, and (ii) the names of\n.\\\" Sam Leffler and Silicon Graphics may not be used in any advertising or\n.\\\" publicity relating to the software without the specific, prior written\n.\\\" permission of Sam Leffler and Silicon Graphics.\n.\\\" \n.\\\" THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n.\\\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n.\\\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n.\\\" \n.\\\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n.\\\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n.\\\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n.\\\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n.\\\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n.\\\" OF THIS SOFTWARE.\n.\\\"\n.if n .po 0\n.TH TIFFReadTile 3TIFF \"December 16, 1991\" \"libtiff\"\n.SH NAME\nTIFFReadTile \\- read and decode a tile of data from an open\n.SM TIFF\nfile\n.SH SYNOPSIS\n.B \"#include <tiffio.h>\"\n.sp\n.BI \"tsize_t TIFFReadTile(TIFF *\" tif \", tdata_t \" buf \", uint32 \" x \", uint32 \" y \", uint32 \" z \", tsample_t \" sample \")\"\n.SH DESCRIPTION\nReturn the data for the tile\n.I containing\nthe specified coordinates. The data placed in\n.I buf\nare returned decompressed and, typically, in the native byte- and\nbit-ordering, but are otherwise packed (see further below). The buffer must be\nlarge enough to hold an entire tile of data. Applications should call the\nroutine\n.IR TIFFTileSize\nto find out the size (in bytes) of a tile buffer. The\n.I x\nand\n.I y\nparameters are always used by\n.IR TIFFReadTile .\nThe\n.I z\nparameter is used if the image is deeper than 1 slice (\\c\n.IR ImageDepth >1).\nThe\n.I sample\nparameter is used only if data are organized in separate planes (\\c\n.IR PlanarConfiguration =2).\n.SH NOTES\nThe library attempts to hide bit- and byte-ordering differences between the\nimage and the native machine by converting data to the native machine order.\nBit reversal is done if the\n.I FillOrder\ntag is opposite to the native machine bit order. 16- and 32-bit samples are\nautomatically byte-swapped if the file was written with a byte order opposite\nto the native machine byte order,\n.SH \"RETURN VALUES\"\n.IR TIFFReadTile\nreturns \\-1 if it detects an error; otherwise the number of bytes in the\ndecoded tile is returned.\n.SH DIAGNOSTICS\nAll error messages are directed to the\n.BR TIFFError (3TIFF)\nroutine.\n.SH \"SEE ALSO\"\n.BR TIFFCheckTile (3TIFF),\n.BR TIFFComputeTile (3TIFF),\n.BR TIFFOpen (3TIFF),\n.BR TIFFReadEncodedTile (3TIFF),\n.BR TIFFReadRawTile (3TIFF),\n.BR libtiff (3TIFF)\n.PP\nLibtiff library home page:\n.BR http://www.remotesensing.org/libtiff/\n"
  },
  {
    "path": "src/main/jni/tiff/man/TIFFSetDirectory.3tiff",
    "content": ".\\\" $Id: TIFFSetDirectory.3tiff,v 1.2 2005/11/02 11:07:18 dron Exp $\n.\\\"\n.\\\" Copyright (c) 1988-1997 Sam Leffler\n.\\\" Copyright (c) 1991-1997 Silicon Graphics, Inc.\n.\\\"\n.\\\" Permission to use, copy, modify, distribute, and sell this software and \n.\\\" its documentation for any purpose is hereby granted without fee, provided\n.\\\" that (i) the above copyright notices and this permission notice appear in\n.\\\" all copies of the software and related documentation, and (ii) the names of\n.\\\" Sam Leffler and Silicon Graphics may not be used in any advertising or\n.\\\" publicity relating to the software without the specific, prior written\n.\\\" permission of Sam Leffler and Silicon Graphics.\n.\\\" \n.\\\" THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n.\\\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n.\\\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n.\\\" \n.\\\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n.\\\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n.\\\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n.\\\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n.\\\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n.\\\" OF THIS SOFTWARE.\n.\\\"\n.if n .po 0\n.TH TIFFSetDirectory 3TIFF \"October 15, 1995\" \"libtiff\"\n.SH NAME\nTIFFSetDirectory, TIFFSetSubDirectory \\- set the current directory for an open\n.SM TIFF\nfile\n.SH SYNOPSIS\n.B \"#include <tiffio.h>\"\n.sp\n.BI \"int TIFFSetDirectory(TIFF *\" tif \", tdir_t \" dirnum \")\"\n.br\n.BI \"int TIFFSetSubDirectory(TIFF *\" tif \", uint32 \" diroff \")\"\n.SH DESCRIPTION\n.I TIFFSetDirectory\nchanges the current directory and reads its contents with\n.IR TIFFReadDirectory .\nThe parameter\n.I dirnum\nspecifies the subfile/directory as an integer number, with the first directory\nnumbered zero.\n.PP\n.I TIFFSetSubDirectory\nacts like \n.IR TIFFSetDirectory ,\nexcept the directory is specified as a file offset instead of an index; this\nis required for accessing subdirectories linked through a\n.I SubIFD\ntag.\n.SH \"RETURN VALUES\"\nOn successful return 1 is returned. Otherwise, 0 is returned if \n.I dirnum\nor\n.I diroff\nspecifies a non-existent directory, or if an error was encountered while\nreading the directory's contents.\n.SH DIAGNOSTICS\nAll error messages are directed to the\n.IR TIFFError (3TIFF)\nroutine.\n.PP\n.BR \"%s: Error fetching directory count\" .\nAn error was encountered while reading the ``directory count'' field.\n.PP\n.BR \"%s: Error fetching directory link\" .\nAn error was encountered while reading the ``link value'' that points to the\nnext directory in a file.\n.SH \"SEE ALSO\"\n.IR TIFFCurrentDirectory (3TIFF),\n.IR TIFFOpen (3TIFF),\n.IR TIFFReadDirectory (3TIFF),\n.IR TIFFWriteDirectory (3TIFF),\n.IR libtiff (3TIFF)\n.PP\nLibtiff library home page:\n.BR http://www.remotesensing.org/libtiff/\n"
  },
  {
    "path": "src/main/jni/tiff/man/TIFFSetField.3tiff",
    "content": ".\\\" $Id: TIFFSetField.3tiff,v 1.4 2006/01/02 23:50:44 bfriesen Exp $\n.\\\"\n.\\\" Copyright (c) 1988-1997 Sam Leffler\n.\\\" Copyright (c) 1991-1997 Silicon Graphics, Inc.\n.\\\"\n.\\\" Permission to use, copy, modify, distribute, and sell this software and \n.\\\" its documentation for any purpose is hereby granted without fee, provided\n.\\\" that (i) the above copyright notices and this permission notice appear in\n.\\\" all copies of the software and related documentation, and (ii) the names of\n.\\\" Sam Leffler and Silicon Graphics may not be used in any advertising or\n.\\\" publicity relating to the software without the specific, prior written\n.\\\" permission of Sam Leffler and Silicon Graphics.\n.\\\" \n.\\\" THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n.\\\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n.\\\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n.\\\" \n.\\\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n.\\\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n.\\\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n.\\\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n.\\\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n.\\\" OF THIS SOFTWARE.\n.\\\"\n.if n .po 0\n.TH TIFFSetField 3TIFF \"October 29, 2004\" \"libtiff\"\n.SH NAME\nTIFFSetField, TIFFVSetField \\- set the value(s) of a tag in a\n.SM TIFF\nfile open for writing\n.SH SYNOPSIS\n.B \"#include <tiffio.h>\"\n.sp\n.BI \"int TIFFSetField(TIFF *\" tif \", ttag_t \" tag \", \" ... \")\"\n.sp\n.B \"#include <stdarg.h>\"\n.sp\n.BI \"int TIFFVSetField(TIFF *\" tif \", ttag_t \" tag \", va_list \" ap \")\"\n.SH DESCRIPTION\n.IR TIFFSetField\nsets the value of a field\nor pseudo-tag in the current directory associated with\nthe open\n.SM TIFF\nfile\n.IR tif .\n(A\n.I pseudo-tag \nis a parameter that is used to control the operation of the\n.SM TIFF\nlibrary but whose value is not read or written to the underlying file.)\nTo set the value of a field\nthe file must have been previously opened for writing with\n.IR TIFFOpen (3TIFF);\npseudo-tags can be set whether the file was opened for reading\nor writing.\nThe field is identified by\n.IR tag ,\none of the values defined in the include file\n.B tiff.h\n(see also the table below).\nThe actual value is specified using a variable argument list,\nas prescribed by the\n.IR stdarg (3)\ninterface (\\c\nor, on some machines, the\n.IR varargs (3)\ninterface.)\n.PP\n.IR TIFFVSetField\nis functionally equivalent to\n.IR TIFFSetField\nexcept that it takes a pointer to a variable\nargument list.\n.I TIFFVSetField\nis useful for writing routines that are layered\non top of the functionality provided by\n.IR TIFFSetField .\n.PP\nThe tags understood by\n.IR libtiff ,\nthe number of parameter values, and the\nexpected types for the parameter values are shown below.\nThe data types are:\n.I char*\nis null-terminated string and corresponds to the\n.SM ASCII\ndata type;\n.I uint16\nis an unsigned 16-bit value;\n.I uint32\nis an unsigned 32-bit value;\n.I uint16*\nis an array of unsigned 16-bit values.\n.I void*\nis an array of data values of unspecified type.\n\nConsult the\n.SM TIFF\nspecification for information on the meaning of each tag.\n.PP\n.nf\n.ta \\w'TIFFTAG_CONSECUTIVEBADFAXLINES'u+2n +\\w'Count'u+2n +\\w'TIFFFaxFillFunc \\(dg'u+2n\n\\fITag Name\\fP\t\\fICount\\fP\t\\fITypes\\fP\t\\fINotes\\fP\n.sp 5p\nTIFFTAG_ARTIST\t1\tchar*\nTIFFTAG_BADFAXLINES\t1\tuint32\nTIFFTAG_BITSPERSAMPLE\t1\tuint16\t\\(dg\nTIFFTAG_CLEANFAXDATA\t1\tuint16\nTIFFTAG_COLORMAP\t3\tuint16*\t1<<BitsPerSample arrays\nTIFFTAG_COMPRESSION\t1\tuint16\t\\(dg\nTIFFTAG_CONSECUTIVEBADFAXLINES\t1\tuint32\nTIFFTAG_COPYRIGHT\t1\tchar*\nTIFFTAG_DATETIME\t1\tchar*\nTIFFTAG_DOCUMENTNAME\t1\tchar*\nTIFFTAG_DOTRANGE\t2\tuint16\nTIFFTAG_EXTRASAMPLES\t2\tuint16,uint16*\t\\(dg count & types array\nTIFFTAG_FAXFILLFUNC\t1\tTIFFFaxFillFunc\tG3/G4 compression pseudo-tag\nTIFFTAG_FAXMODE\t1\tint\t\\(dg G3/G4 compression pseudo-tag\nTIFFTAG_FILLORDER\t1\tuint16\t\\(dg\nTIFFTAG_GROUP3OPTIONS\t1\tuint32\t\\(dg\nTIFFTAG_GROUP4OPTIONS\t1\tuint32\t\\(dg\nTIFFTAG_HALFTONEHINTS\t2\tuint16\nTIFFTAG_HOSTCOMPUTER\t1\tchar*\nTIFFTAG_ICCPROFILE\t2\tuint32,void*\tcount, profile data\nTIFFTAG_IMAGEDEPTH\t1\tuint32\t\\(dg\nTIFFTAG_IMAGEDESCRIPTION\t1\tchar*\nTIFFTAG_IMAGELENGTH\t1\tuint32\nTIFFTAG_IMAGEWIDTH\t1\tuint32\t\\(dg\nTIFFTAG_INKNAMES\t2\tuint16, char*\nTIFFTAG_INKSET\t1\tuint16\t\\(dg\nTIFFTAG_JPEGCOLORMODE\t1\tint\t\\(dg JPEG pseudo-tag\nTIFFTAG_JPEGQUALITY\t1\tint\tJPEG pseudo-tag\nTIFFTAG_JPEGTABLES\t2\tuint32*,void*\t\\(dg count & tables\nTIFFTAG_JPEGTABLESMODE\t1\tint\t\\(dg JPEG pseudo-tag\nTIFFTAG_MAKE\t1\tchar*\nTIFFTAG_MATTEING\t1\tuint16\t\\(dg\nTIFFTAG_MAXSAMPLEVALUE\t1\tuint16\nTIFFTAG_MINSAMPLEVALUE\t1\tuint16\nTIFFTAG_MODEL\t1\tchar*\nTIFFTAG_ORIENTATION\t1\tuint16\nTIFFTAG_PAGENAME\t1\tchar*\nTIFFTAG_PAGENUMBER\t2\tuint16\nTIFFTAG_PHOTOMETRIC\t1\tuint16\nTIFFTAG_PHOTOSHOP\t?\tuint32,void*\tcount, data\nTIFFTAG_PLANARCONFIG\t1\tuint16\t\\(dg\nTIFFTAG_PREDICTOR\t1\tuint16\t\\(dg\nTIFFTAG_PRIMARYCHROMATICITIES\t1\tfloat*\t6-entry array\nTIFFTAG_REFERENCEBLACKWHITE\t1\tfloat*\t\\(dg 2*SamplesPerPixel array\nTIFFTAG_RESOLUTIONUNIT\t1\tuint16\nTIFFTAG_RICHTIFFIPTC\t2\tuint32,void*\tcount, data\nTIFFTAG_ROWSPERSTRIP\t1\tuint32\t\\(dg must be > 0\nTIFFTAG_SAMPLEFORMAT\t1\tuint16\t\\(dg\nTIFFTAG_SAMPLESPERPIXEL\t1\tuint16\t\\(dg value must be <= 4\nTIFFTAG_SMAXSAMPLEVALUE\t1\tdouble\nTIFFTAG_SMINSAMPLEVALUE\t1\tdouble\nTIFFTAG_SOFTWARE\t1\tchar*\nTIFFTAG_STONITS\t1\tdouble\t\\(dg\nTIFFTAG_SUBFILETYPE\t1\tuint32\nTIFFTAG_SUBIFD\t2\tuint16,uint32*\tcount & offsets array\nTIFFTAG_TARGETPRINTER\t1\tchar*\nTIFFTAG_THRESHHOLDING\t1\tuint16\nTIFFTAG_TILEDEPTH\t1\tuint32\t\\(dg\nTIFFTAG_TILELENGTH\t1\tuint32\t\\(dg must be a multiple of 8\nTIFFTAG_TILEWIDTH\t1\tuint32\t\\(dg must be a multiple of 8\nTIFFTAG_TRANSFERFUNCTION\t1 or 3\\(dd uint16*\t1<<BitsPerSample entry arrays\nTIFFTAG_WHITEPOINT\t1\tfloat*\t2-entry array\nTIFFTAG_XMLPACKET\t2\tuint32,void*\tcount, data\nTIFFTAG_XPOSITION\t1\tfloat\nTIFFTAG_XRESOLUTION\t1\tfloat\nTIFFTAG_YCBCRCOEFFICIENTS\t1\tfloat*\t\\(dg 3-entry array\nTIFFTAG_YCBCRPOSITIONING\t1\tuint16\t\\(dg\nTIFFTAG_YCBCRSAMPLING\t2\tuint16\t\\(dg\nTIFFTAG_YPOSITION\t1\tfloat\nTIFFTAG_YRESOLUTION\t1\tfloat\n.fi\n.sp 5p\n\\(dg Tag may not have its values changed once data is written.\n.br\n.fi\n\\(dd\nIf\n.I SamplesPerPixel\nis one, then a single array is passed; otherwise three arrays should be\npassed.\n.fi\n* The contents of this field are quite complex.  See \n.BR \"The ICC Profile Format Specification\" ,\nAnnex B.3 \"Embedding ICC Profiles in TIFF Files\"\n(available at http://www.color.org) for an explanation.\n.br\n.SH \"RETURN VALUES\"\n1 is returned if the operation was successful.\nOtherwise, 0 is returned if an error was detected.\n.SH DIAGNOSTICS\nAll error messages are directed to the\n.BR TIFFError (3TIFF)\nroutine.\n.PP\n\\fB%s: Cannot modify tag \"%s\" while writing\\fP.\nData has already been written to the file, so the\nspecified tag's value can not be changed.\nThis restriction is applied to all tags that affect\nthe format of written data.\n.PP\n\\fB%d: Bad value for \"%s\"\\fP.\nAn invalid value was supplied for the named tag.\n.SH \"SEE ALSO\"\n.BR TIFFOpen (3TIFF),\n.BR TIFFGetField (3TIFF),\n.BR TIFFSetDirectory (3TIFF),\n.BR TIFFWriteDirectory (3TIFF),\n.BR TIFFReadDirectory (3TIFF),\n.BR libtiff (3TIFF)\n.PP\nLibtiff library home page:\n.BR http://www.remotesensing.org/libtiff/\n"
  },
  {
    "path": "src/main/jni/tiff/man/TIFFWarning.3tiff",
    "content": ".\\\" $Id: TIFFWarning.3tiff,v 1.2 2005/11/02 11:07:18 dron Exp $\n.\\\"\n.\\\" Copyright (c) 1988-1997 Sam Leffler\n.\\\" Copyright (c) 1991-1997 Silicon Graphics, Inc.\n.\\\"\n.\\\" Permission to use, copy, modify, distribute, and sell this software and \n.\\\" its documentation for any purpose is hereby granted without fee, provided\n.\\\" that (i) the above copyright notices and this permission notice appear in\n.\\\" all copies of the software and related documentation, and (ii) the names of\n.\\\" Sam Leffler and Silicon Graphics may not be used in any advertising or\n.\\\" publicity relating to the software without the specific, prior written\n.\\\" permission of Sam Leffler and Silicon Graphics.\n.\\\" \n.\\\" THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n.\\\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n.\\\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n.\\\" \n.\\\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n.\\\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n.\\\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n.\\\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n.\\\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n.\\\" OF THIS SOFTWARE.\n.\\\"\n.if n .po 0\n.TH TIFFWarning 3TIFF \"October 15, 1995\" \"libtiff\"\n.SH NAME\nTIFFWarning, TIFFSetWarningHandler \\- library warning interface\n.SH SYNOPSIS\n.B \"#include <tiffio.h>\"\n.sp\n.BI \"void TIFFWarning(const char *\" module \", const char *\" fmt \", \" ... \")\"\n.sp\n.B \"#include <stdargh.h>\"\n.sp\n.BI \"typedef void (*TIFFWarningHandler)(const char *\" module \", const char *\" fmt \", va_list \" ap \");\"\n.sp\n.BI \"TIFFWarningHandler TIFFSetWarningHandler(TIFFWarningHandler \" handler \");\"\n.SH DESCRIPTION\n.I TIFFWarning\ninvokes the library-wide warning handler function to (normally) write a\nwarning message to the\n.BR stderr .\nThe\n.I fmt\nparameter is a\n.IR printf (3S)\nformat string, and any number arguments can be supplied. The\n.I module\nparameter is interpreted as a string that, if non-zero, should be printed\nbefore the message; it typically is used to identify the software module in\nwhich a warning is detected.\n.PP\nApplications that desire to capture control in the event of a warning should\nuse\n.IR TIFFSetWarningHandler\nto override the default warning handler.\nA\n.SM NULL\n(0) warning handler function may be installed to suppress error messages.\n.SH \"RETURN VALUES\"\n.IR TIFFSetWarningHandler\nreturns a reference to the previous error handling function.\n.SH \"SEE ALSO\"\n.BR TIFFError (3TIFF),\n.BR libtiff (3TIFF),\n.BR printf (3)\n.PP\nLibtiff library home page:\n.BR http://www.remotesensing.org/libtiff/\n"
  },
  {
    "path": "src/main/jni/tiff/man/TIFFWriteDirectory.3tiff",
    "content": ".\\\" $Id: TIFFWriteDirectory.3tiff,v 1.2 2005/11/02 11:07:18 dron Exp $\n.\\\"\n.\\\" Copyright (c) 1988-1997 Sam Leffler\n.\\\" Copyright (c) 1991-1997 Silicon Graphics, Inc.\n.\\\"\n.\\\" Permission to use, copy, modify, distribute, and sell this software and \n.\\\" its documentation for any purpose is hereby granted without fee, provided\n.\\\" that (i) the above copyright notices and this permission notice appear in\n.\\\" all copies of the software and related documentation, and (ii) the names of\n.\\\" Sam Leffler and Silicon Graphics may not be used in any advertising or\n.\\\" publicity relating to the software without the specific, prior written\n.\\\" permission of Sam Leffler and Silicon Graphics.\n.\\\" \n.\\\" THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n.\\\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n.\\\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n.\\\" \n.\\\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n.\\\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n.\\\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n.\\\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n.\\\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n.\\\" OF THIS SOFTWARE.\n.\\\"\n.if n .po 0\n.TH TIFFWriteDirectory 3TIFF \"September 26, 2001\" \"libtiff\"\n.SH NAME\nTIFFWriteDirectory, TIFFRewriteDirectory, TIFFCheckpointDirectory \\- write the\ncurrent directory in an open\n.SM TIFF\nfile\n.SH SYNOPSIS\n.B \"#include <tiffio.h>\"\n.sp\n.BI \"int TIFFWriteDirectory(TIFF *\" tif \")\"\n.br\n.BI \"int TIFFRewriteDirectory(TIFF *\" tif \")\"\n.br\n.BI \"int TIFFCheckpointDirectory(TIFF *\" tif \")\"\n.SH DESCRIPTION\n.IR TIFFWriteDirectory \nwill write the contents of the current directory to the file and setup to\ncreate a new subfile in the same file. Applications only need to call\n.IR TIFFWriteDirectory\nwhen writing multiple subfiles to a single\n.SM TIFF\nfile.\n.IR TIFFWriteDirectory\nis automatically called by\n.IR TIFFClose\nand\n.IR TIFFFlush\nto write a modified directory if the file is open for writing.\n.PP\nThe \n.IR TIFFRewriteDirectory\nfunction operates similarly to \n.IR TIFFWriteDirectory,\nbut can be called with directories previously read or written that already\nhave an established location in the file.  It will rewrite the directory,\nbut instead of place it at it's old location (as \n.IR TIFFWriteDirectory\nwould) it will place them at the end of the file, correcting the pointer from\nthe preceeding directory or file header to point to it's new location.  This\nis particularly important in cases where the size of the directory and\npointed to data has grown, so it won't fit in the space available at the\nold location.\n.PP\nThe\n.IR TIFFCheckpointDirectory\nwrites the current state of the tiff directory into the file to make what\nis currently in the file readable.  Unlike\n.IR TIFFWriteDirectory,\n.IR TIFFCheckpointDirectory\ndoes not free up the directory data structures in memory, so they can be\nupdated (as strips/tiles are written) and written again.  Reading such\na partial file you will at worst get a tiff read error for the first\nstrip/tile encountered that is incomplete, but you will at least get\nall the valid data in the file before that.  When the file is complete,\njust use\n.IR TIFFWriteDirectory\nas usual to finish it off cleanly.\n.SH \"RETURN VALUES\"\n1 is returned when the contents are successfully written to the file.\nOtherwise, 0 is returned if an error was encountered when writing\nthe directory contents.\n.SH DIAGNOSTICS\nAll error messages are directed to the\n.IR TIFFError (3TIFF)\nroutine.\n.PP\n.BR \"Error post-encoding before directory write\" .\nBefore writing the contents of the current directory, any pending data are\nflushed. This message indicates that an error occurred while doing this.\n.PP\n.BR \"Error flushing data before directory write\" .\nBefore writing the contents of the current directory, any pending data are\nflushed. This message indicates that an error occurred while doing this.\n.PP\n.BR \"Cannot write directory, out of space\" .\nThere was not enough space to allocate a temporary area for the directory that\nwas to be written.\n.PP\n.BR \"Error writing directory count\" .\nA write error occurred when writing the count of fields in the directory.\n.PP\n.BR \"Error writing directory contents\" .\nA write error occurred when writing the directory fields.\n.PP\n.BR \"Error writing directory link\" .\nA write error occurred when writing the link to the next directory.\n.PP\n\\fBError writing data for field \"%s\"\\fP.\nA write error occurred when writing indirect data for the specified field.\n.PP\n.BR \"Error writing TIFF header\" .\nA write error occurred when re-writing header at the front of the file.\n.PP\n.BR \"Error fetching directory count\" .\nA read error occurred when fetching the directory count field for\na previous directory.\nThis can occur when setting up a link to the directory that is being\nwritten.\n.PP\n.BR \"Error fetching directory link\" .\nA read error occurred when fetching the directory link field for\na previous directory.\nThis can occur when setting up a link to the directory that is being\nwritten.\n.SH \"SEE ALSO\"\n.BR TIFFOpen (3TIFF),\n.BR TIFFError (3TIFF),\n.BR TIFFReadDirectory (3TIFF),\n.BR TIFFSetDirectory (3TIFF),\n.BR libtiff (3TIFF)\n.PP\nLibtiff library home page:\n.BR http://www.remotesensing.org/libtiff/\n"
  },
  {
    "path": "src/main/jni/tiff/man/TIFFWriteEncodedStrip.3tiff",
    "content": ".\\\" $Id: TIFFWriteEncodedStrip.3tiff,v 1.2 2005/11/02 11:07:18 dron Exp $\n.\\\"\n.\\\" Copyright (c) 1988-1997 Sam Leffler\n.\\\" Copyright (c) 1991-1997 Silicon Graphics, Inc.\n.\\\"\n.\\\" Permission to use, copy, modify, distribute, and sell this software and \n.\\\" its documentation for any purpose is hereby granted without fee, provided\n.\\\" that (i) the above copyright notices and this permission notice appear in\n.\\\" all copies of the software and related documentation, and (ii) the names of\n.\\\" Sam Leffler and Silicon Graphics may not be used in any advertising or\n.\\\" publicity relating to the software without the specific, prior written\n.\\\" permission of Sam Leffler and Silicon Graphics.\n.\\\" \n.\\\" THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n.\\\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n.\\\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n.\\\" \n.\\\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n.\\\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n.\\\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n.\\\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n.\\\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n.\\\" OF THIS SOFTWARE.\n.\\\"\n.if n .po 0\n.TH TIFFWriteEncodedStrip 3TIFF \"October 15, 1995\" \"libtiff\"\n.SH NAME\nTIFFWritedEncodedStrip \\- compress and write a strip of data to an open\n.SM TIFF\nfile\n.SH SYNOPSIS\n.B \"#include <tiffio.h>\"\n.sp\n.BI \"tsize_t TIFFWriteEncodedStrip(TIFF *\" tif \", tstrip_t \" strip \", tdata_t \" buf \", tsize_t \" size \")\"\n.SH DESCRIPTION\nCompress\n.I size\nbytes of raw data from\n.I buf\nand write the result to the specified strip; replacing any previously written\ndata. Note that the value of\n.I strip\nis a ``raw strip number.'' That is, the caller must take into account whether\nor not the data are organized in separate planes (\\c\n.IR PlanarConfiguration =2).\n.SH NOTES\nThe library writes encoded data using the native machine byte order. Correctly\nimplemented\n.SM TIFF\nreaders are expected to do any necessary byte-swapping to correctly process\nimage data with BitsPerSample greater than 8.\n.PP\nThe strip number must be valid according to the current settings of the\n.I ImageLength\nand\n.I RowsPerStrip\ntags.\nAn image may be dynamically grown by increasing the value of\n.I ImageLength\nprior to each call to\n.IR TIFFWriteEncodedStrip .\n.SH \"RETURN VALUES\"\n\\-1 is returned if an error was encountered. Otherwise, the value of\n.IR size\nis returned.\n.SH DIAGNOSTICS\nAll error messages are directed to the\n.IR TIFFError (3TIFF)\nroutine.\n.PP\n\\fB%s: File not open for writing\\fP. The file was opened for reading, not\nwriting.\n.PP\n\\fBCan not write scanlines to a tiled image\\fP. The image is assumed to be\norganized in tiles because the\n.I TileWidth\nand\n.I TileLength\ntags have been set with\n.IR TIFFSetField (3TIFF).\n.PP\n\\fB%s: Must set \"ImageWidth\" before writing data\\fP.\nThe image's width has not be set before the first write. See\n.IR TIFFSetField (3TIFF)\nfor information on how to do this.\n.PP\n\\fB%s: Must set \"PlanarConfiguration\" before writing data\\fP.\nThe organization of data has not be defined before the first write. See\n.IR TIFFSetField (3TIFF)\nfor information on how to do this.\n.PP\n\\fB%s: No space for strip arrays\"\\fP.\nThere was not enough space for the arrays that hold strip offsets and byte\ncounts.\n.SH \"SEE ALSO\"\n.BR TIFFOpen (3TIFF),\n.BR TIFFWriteScanline (3TIFF),\n.BR TIFFWriteRawStrip (3TIFF),\n.BR libtiff (3TIFF)\n.PP\nLibtiff library home page:\n.BR http://www.remotesensing.org/libtiff/\n"
  },
  {
    "path": "src/main/jni/tiff/man/TIFFWriteEncodedTile.3tiff",
    "content": ".\\\" $Id: TIFFWriteEncodedTile.3tiff,v 1.2 2005/11/02 11:07:18 dron Exp $\n.\\\"\n.\\\" Copyright (c) 1988-1997 Sam Leffler\n.\\\" Copyright (c) 1991-1997 Silicon Graphics, Inc.\n.\\\"\n.\\\" Permission to use, copy, modify, distribute, and sell this software and \n.\\\" its documentation for any purpose is hereby granted without fee, provided\n.\\\" that (i) the above copyright notices and this permission notice appear in\n.\\\" all copies of the software and related documentation, and (ii) the names of\n.\\\" Sam Leffler and Silicon Graphics may not be used in any advertising or\n.\\\" publicity relating to the software without the specific, prior written\n.\\\" permission of Sam Leffler and Silicon Graphics.\n.\\\" \n.\\\" THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n.\\\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n.\\\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n.\\\" \n.\\\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n.\\\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n.\\\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n.\\\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n.\\\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n.\\\" OF THIS SOFTWARE.\n.\\\"\n.if n .po 0\n.TH TIFFWriteEncodedTile 3TIFF \"December 16, 1991\" \"libtiff\"\n.SH NAME\nTIFFWritedEncodedTile \\- compress and write a tile of data to an open\n.SM TIFF\nfile\n.SH SYNOPSIS\n.B \"#include <tiffio.h>\"\n.sp\n.BI \"tsize_t TIFFWriteEncodedTile(TIFF *\" tif \", ttile_t \" tile \", tdata_t \" buf \", tsize_t \" size \")\"\n.SH DESCRIPTION\nCompress\n.I size\nbytes of raw data from\n.I buf\nand\n.B append\nthe result to the end of the specified tile. Note that the value of\n.I tile\nis a ``raw tile number.'' That is, the caller must take into account whether\nor not the data are organized in separate places (\\c\n.IR PlanarConfiguration =2).\n.IR TIFFComputeTile\nautomatically does this when converting an (x,y,z,sample) coordinate quadruple\nto a tile number.\n.SH NOTES\nThe library writes encoded data using the native machine byte order. Correctly\nimplemented\n.SM TIFF\nreaders are expected to do any necessary byte-swapping to correctly process\nimage data with BitsPerSample greater than 8.\n.SH \"RETURN VALUES\"\n\\-1 is returned if an error was encountered. Otherwise, the value of\n.IR size \nis returned.\n.SH DIAGNOSTICS\nAll error messages are directed to the\n.BR TIFFError (3TIFF)\nroutine.\n.PP\n\\fB%s: File not open for writing\\fP.\nThe file was opened for reading, not writing.\n.PP\n\\fBCan not write tiles to a stripped image\\fP.\nThe image is assumed to be organized in strips because neither of the\n.I TileWidth\nor\n.I TileLength\ntags have been set with\n.BR TIFFSetField (3TIFF).\n.PP\n\\fB%s: Must set \"ImageWidth\" before writing data\\fP. The image's width has not\nbe set before the first write. See\n.BR TIFFSetField (3TIFF)\nfor information on how to do this.\n.PP\n\\fB%s: Must set \"PlanarConfiguration\" before writing data\\fP. The organization\nof data has not be defined before the first write. See\n.BR TIFFSetField (3TIFF)\nfor information on how to do this.\n.PP\n\\fB%s: No space for tile arrays\"\\fP.\nThere was not enough space for the arrays that hold tile offsets and byte\ncounts.\n.SH \"SEE ALSO\"\n.BR TIFFOpen (3TIFF),\n.BR TIFFWriteTile (3TIFF),\n.BR TIFFWriteRawTile (3TIFF),\n.BR libtiff (3TIFF)\n.PP\nLibtiff library home page:\n.BR http://www.remotesensing.org/libtiff/\n"
  },
  {
    "path": "src/main/jni/tiff/man/TIFFWriteRawStrip.3tiff",
    "content": ".\\\" $Id: TIFFWriteRawStrip.3tiff,v 1.2 2005/11/02 11:07:18 dron Exp $\n.\\\"\n.\\\" Copyright (c) 1988-1997 Sam Leffler\n.\\\" Copyright (c) 1991-1997 Silicon Graphics, Inc.\n.\\\"\n.\\\" Permission to use, copy, modify, distribute, and sell this software and \n.\\\" its documentation for any purpose is hereby granted without fee, provided\n.\\\" that (i) the above copyright notices and this permission notice appear in\n.\\\" all copies of the software and related documentation, and (ii) the names of\n.\\\" Sam Leffler and Silicon Graphics may not be used in any advertising or\n.\\\" publicity relating to the software without the specific, prior written\n.\\\" permission of Sam Leffler and Silicon Graphics.\n.\\\" \n.\\\" THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n.\\\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n.\\\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n.\\\" \n.\\\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n.\\\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n.\\\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n.\\\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n.\\\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n.\\\" OF THIS SOFTWARE.\n.\\\"\n.if n .po 0\n.TH TIFFWriteRawstrip 3TIFF \"October 15, 1995\" \"libtiff\"\n.SH NAME\nTIFFWriteRawStrip \\- write a strip of raw data to an open\n.SM TIFF\nfile\n.SH SYNOPSIS\n.B \"#include <tiffio.h>\"\n.sp\n.BI \"tsize_t TIFFWriteRawStrip(TIFF *\" tif \", tstrip_t \" strip \", tdata_t \" buf \", tsize_t \" size \")\"\n.SH DESCRIPTION\nAppend\n.I size\nbytes of raw data to the specified strip.\n.SH NOTES\nThe strip number must be valid according to the current settings of the\n.I ImageLength\nand\n.I RowsPerStrip\ntags.\nAn image may be dynamically grown by increasing the value of\n.I ImageLength\nprior to each call to\n.IR TIFFWriteRawStrip .\n.SH \"RETURN VALUES\"\n\\-1 is returned if an error occurred.\nOtherwise, the value of\n.IR size \nis returned.\n.SH DIAGNOSTICS\nAll error messages are directed to the\n.BR TIFFError (3TIFF)\nroutine.\n.PP\n\\fB%s: File not open for writing\\fP.\nThe file was opened for reading, not writing.\n.PP\n\\fBCan not write scanlines to a tiled image\\fP. The image is assumed to be\norganized in tiles because the\n.I TileWidth\nand\n.I TileLength\ntags have been set with\n.BR TIFFSetField (3TIFF).\n.PP\n\\fB%s: Must set \"ImageWidth\" before writing data\\fP.\nThe image's width has not be set before the first write.\nSee\n.BR TIFFSetField (3TIFF)\nfor information on how to do this.\n.PP\n\\fB%s: Must set \"PlanarConfiguration\" before writing data\\fP.\nThe organization of data has not be defined before the first write.\nSee\n.BR TIFFSetField (3TIFF)\nfor information on how to do this.\n.PP\n\\fB%s: No space for strip arrays\"\\fP.\nThere was not enough space for the arrays that hold strip\noffsets and byte counts.\n.PP\n\\fB%s: Strip %d out of range, max %d\\fP.\nThe specified strip is not a valid strip according to the\ncurrently specified image dimensions.\n.SH \"SEE ALSO\"\n.BR TIFFOpen (3TIFF),\n.BR TIFFWriteEncodedStrip (3TIFF),\n.BR TIFFWriteScanline (3TIFF),\n.BR libtiff (3TIFF)\n.PP\nLibtiff library home page:\n.BR http://www.remotesensing.org/libtiff/\n"
  },
  {
    "path": "src/main/jni/tiff/man/TIFFWriteRawTile.3tiff",
    "content": ".\\\" $Id: TIFFWriteRawTile.3tiff,v 1.2 2005/11/02 11:07:18 dron Exp $\n.\\\"\n.\\\" Copyright (c) 1988-1997 Sam Leffler\n.\\\" Copyright (c) 1991-1997 Silicon Graphics, Inc.\n.\\\"\n.\\\" Permission to use, copy, modify, distribute, and sell this software and \n.\\\" its documentation for any purpose is hereby granted without fee, provided\n.\\\" that (i) the above copyright notices and this permission notice appear in\n.\\\" all copies of the software and related documentation, and (ii) the names of\n.\\\" Sam Leffler and Silicon Graphics may not be used in any advertising or\n.\\\" publicity relating to the software without the specific, prior written\n.\\\" permission of Sam Leffler and Silicon Graphics.\n.\\\" \n.\\\" THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n.\\\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n.\\\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n.\\\" \n.\\\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n.\\\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n.\\\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n.\\\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n.\\\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n.\\\" OF THIS SOFTWARE.\n.\\\"\n.if n .po 0\n.TH TIFFWriteRawtile 3TIFF \"December 16, 1991\" \"libtiff\"\n.SH NAME\nTIFFWriteRawTile \\- write a tile of raw data to an open\n.SM TIFF\nfile\n.SH SYNOPSIS\n.B \"#include <tiffio.h>\"\n.sp\n.BI \"tsize_t TIFFWriteRawTile(TIFF *\" tif \", ttile_t \" tile \", tdata_t \" buf \", tsize_t \" size \")\"\n.SH DESCRIPTION\nAppend\n.I size\nbytes of raw data to the specified tile.\n.SH \"RETURN VALUES\"\n\\-1 is returned if an error occurred. Otherwise, the value of\n.IR size \nis returned.\n.SH DIAGNOSTICS\nAll error messages are directed to the\n.BR TIFFError (3TIFF)\nroutine.\n.PP\n\\fB%s: File not open for writing\\fP.\nThe file was opened for reading, not writing.\n.PP\n\\fBCan not write tiles to a stripped image\\fP.\nThe image is assumed to be organized in strips because neither of the\n.I TileWidth\nor\n.I TileLength\ntags have been set with\n.BR TIFFSetField (3TIFF).\n.PP\n\\fB%s: Must set \"ImageWidth\" before writing data\\fP.\nThe image's width has not be set before the first write.\nSee\n.BR TIFFSetField (3TIFF)\nfor information on how to do this.\n.PP\n\\fB%s: Must set \"PlanarConfiguration\" before writing data\\fP. The organization\nof data has not be defined before the first write. See\n.BR TIFFSetField (3TIFF)\nfor information on how to do this.\n.PP\n\\fB%s: No space for tile arrays\"\\fP.\nThere was not enough space for the arrays that hold tile offsets and byte\ncounts.\n.PP\n\\fB%s: Specified tile %d out of range, max %d\\fP.\nThe specified tile is not valid according to the currently specified image\ndimensions.\n.SH \"SEE ALSO\"\n.BR TIFFOpen (3TIFF),\n.BR TIFFWriteEncodedTile (3TIFF),\n.BR TIFFWriteScanline (3TIFF),\n.BR libtiff (3TIFF)\n.PP\nLibtiff library home page:\n.BR http://www.remotesensing.org/libtiff/\n"
  },
  {
    "path": "src/main/jni/tiff/man/TIFFWriteScanline.3tiff",
    "content": ".\\\" $Id: TIFFWriteScanline.3tiff,v 1.2 2005/11/02 11:07:18 dron Exp $\n.\\\"\n.\\\" Copyright (c) 1988-1997 Sam Leffler\n.\\\" Copyright (c) 1991-1997 Silicon Graphics, Inc.\n.\\\"\n.\\\" Permission to use, copy, modify, distribute, and sell this software and \n.\\\" its documentation for any purpose is hereby granted without fee, provided\n.\\\" that (i) the above copyright notices and this permission notice appear in\n.\\\" all copies of the software and related documentation, and (ii) the names of\n.\\\" Sam Leffler and Silicon Graphics may not be used in any advertising or\n.\\\" publicity relating to the software without the specific, prior written\n.\\\" permission of Sam Leffler and Silicon Graphics.\n.\\\" \n.\\\" THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n.\\\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n.\\\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n.\\\" \n.\\\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n.\\\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n.\\\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n.\\\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n.\\\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n.\\\" OF THIS SOFTWARE.\n.\\\"\n.if n .po 0\n.TH TIFFWriteScanline 3TIFF \"December 16, 1991\" \"libtiff\"\n.SH NAME\nTIFFWriteScanline \\- write a scanline to an open\n.SM TIFF\nfile\n.SH SYNOPSIS\n.B \"#include <tiffio.h>\"\n.sp\n.BI \"int TIFFWriteScanline(TIFF *\" tif \", tdata_t \" buf \", uint32 \" row \", tsample_t \" sample \")\"\n.SH DESCRIPTION\nWrite data to a file at the specified row. The\n.I sample\nparameter is used only if data are organized in separate planes (\\c\n.IR PlanarConfiguration =2).\nThe data are assumed to be uncompressed and in the native bit- and byte-order\nof the host machine. The data written to the file is compressed according to\nthe compression scheme of the current\n.SM TIFF\ndirectory (see further below). If the current scanline is past the end of the\ncurrent subfile, the\n.I ImageLength\nfield is automatically increased to include the scanline (except\nfor\n.IR PlanarConfiguration =2,\nwhere the\n.I ImageLength\ncannot be changed once the first data are written). If the\n.I ImageLength\nis increased, the\n.I StripOffsets\nand\n.I StripByteCounts\nfields are similarly enlarged to reflect data written past the previous end of\nimage.\n.SH NOTES\nThe library writes encoded data using the native machine byte order. Correctly\nimplemented\n.SM TIFF\nreaders are expected to do any necessary byte-swapping to correctly process\nimage data with BitsPerSample greater than 8. The library attempts to hide\nbit-ordering differences between the image and the native machine by\nconverting data from the native machine order.\n.PP\nIn C++ the\n.I sample\nparameter defaults to 0.\n.PP\nOnce data are written to a file for the current directory, the values of\ncertain tags may not be altered; see\n.IR TIFFSetField (3TIFF)\nfor more information.\n.PP\nIt is not possible to write scanlines to a file that uses a tiled\norganization.  The routine\n.IR TIFFIsTiled\ncan be used to determine if the file is organized as tiles or strips.\n.SH \"RETURN VALUES\"\n.IR TIFFWriteScanline\nreturns \\-1 if it immediately detects an error and 1 for a successful write.\n.SH DIAGNOSTICS\nAll error messages are directed to the\n.IR TIFFError (3TIFF)\nroutine.\n.PP\n.BR \"%s: File not open for writing .\nThe file was opened for reading, not writing.\n.PP\n.BR \"Can not write scanlines to a tiled image\" .\nAn attempt was made to write a scanline to a tiled image. The image is assumed\nto be organized in tiles because the\n.I TileWidth\nand\n.I TileLength\ntags have been set with\n.IR TIFFSetField (3TIFF).\n.PP\n.BR \"Compression algorithm does not support random access\" .\nData was written in a non-sequential order to a file that uses a compression\nalgorithm and that has\n.I RowsPerStrip\ngreater than one. That is, data in the image is to be stored in a compressed\nform, and with multiple rows packed into a strip. In this case, the library\ndoes not support random access to the data. The data should either be written\nas entire strips, sequentially by rows, or the value of\n.I RowsPerStrip\nshould be set to one.\n.PP\n\\fB%s: Must set \"ImageWidth\" before writing data\\fP.\nThe image's width has not be set before the first write.\nSee\n.BR TIFFSetField (3TIFF)\nfor information on how to do this.\n.PP\n\\fB%s: Must set \"PlanarConfiguration\" before writing data\\fP.\nThe organization of data has not be defined before the first write.\nSee\n.BR TIFFSetField (3TIFF)\nfor information on how to do this.\n.PP\n\\fBCan not change \"ImageLength\" when using separate planes\\fP. Separate image\nplanes are being used (\\c\n.IR PlanarConfiguration =2),\nbut the number of rows has not been specified before the first write. The\nlibrary supports the dynamic growth of an image only when data are organized\nin a contiguous manner (\\c\n.IR PlanarConfiguration =1).\n.PP\n.BR \"%d: Sample out of range, max %d\" .\nThe\n.I sample\nparameter was greater than the value of the SamplesPerPixel tag.\n.PP\n.BR \"%s: No space for strip arrays .\nThere was not enough space for the arrays that hold strip offsets and byte\ncounts.\n.SH BUGS\nWriting subsampled YCbCR data does not work correctly because, for \n.IR PlanarConfiguration =2\nthe size of a scanline is not calculated on a per-sample basis, and for\n.IR PlanarConfiguration =1\nthe library does not pack the block-interleaved samples.\n.SH \"SEE ALSO\"\n.BR TIFFOpen (3TIFF),\n.BR TIFFWriteEncodedStrip (3TIFF),\n.BR TIFFWriteRawStrip (3TIFF),\n.BR libtiff (3TIFF)\n.PP\nLibtiff library home page:\n.BR http://www.remotesensing.org/libtiff/\n"
  },
  {
    "path": "src/main/jni/tiff/man/TIFFWriteTile.3tiff",
    "content": ".\\\" $Id: TIFFWriteTile.3tiff,v 1.2 2005/11/02 11:07:18 dron Exp $\n.\\\"\n.\\\" Copyright (c) 1988-1997 Sam Leffler\n.\\\" Copyright (c) 1991-1997 Silicon Graphics, Inc.\n.\\\"\n.\\\" Permission to use, copy, modify, distribute, and sell this software and \n.\\\" its documentation for any purpose is hereby granted without fee, provided\n.\\\" that (i) the above copyright notices and this permission notice appear in\n.\\\" all copies of the software and related documentation, and (ii) the names of\n.\\\" Sam Leffler and Silicon Graphics may not be used in any advertising or\n.\\\" publicity relating to the software without the specific, prior written\n.\\\" permission of Sam Leffler and Silicon Graphics.\n.\\\" \n.\\\" THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n.\\\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n.\\\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n.\\\" \n.\\\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n.\\\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n.\\\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n.\\\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n.\\\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n.\\\" OF THIS SOFTWARE.\n.\\\"\n.if n .po 0\n.TH TIFFWriteTile 3TIFF \"November 29, 1999\" \"libtiff\"\n.SH NAME\nTIFFWriteTile \\- encode and write a tile of data to an open\n.SM TIFF\nfile\n.SH SYNOPSIS\n.B \"#include <tiffio.h>\"\n.sp\n.BI \"tsize_t TIFFWriteTile(TIFF *\" tif \", tdata_t \" buf \", uint32 \" x \", uint32 \" y \", uint32 \" z \", tsample_t \" sample \")\"\n.SH DESCRIPTION\nWrite the data for the tile\n.I containing\nthe specified coordinates. The data in\n.I buf\nare is (potentially) compressed, and written to the indicated file, normally\nbeing appended to the end of the file. The buffer must be contain an entire\ntile of data. Applications should call the routine\n.IR TIFFTileSize\nto find out the size (in bytes) of a tile buffer. The\n.I x\nand\n.I y\nparameters are always used by\n.IR TIFFWriteTile .\nThe\n.I z\nparameter is used if the image is deeper than 1 slice (\\c\n.IR ImageDepth >1).\nThe\n.I sample\nparameter is used only if data are organized in separate planes (\\c\n.IR PlanarConfiguration =2).\n.SH \"RETURN VALUES\"\n.IR TIFFWriteTile\nreturns \\-1 if it detects an error; otherwise the number of bytes in the tile\nis returned.\n.SH DIAGNOSTICS\nAll error messages are directed to the\n.BR TIFFError (3TIFF)\nroutine.\n.SH \"SEE ALSO\"\n.BR TIFFCheckTile (3TIFF),\n.BR TIFFComputeTile (3TIFF),\n.BR TIFFOpen (3TIFF),\n.BR TIFFReadTile (3TIFF),\n.BR TIFFWriteScanline (3TIFF),\n.BR TIFFWriteEncodedTile (3TIFF),\n.BR TIFFWriteRawTile (3TIFF),\n.BR libtiff (3TIFF)\n.PP\nLibtiff library home page:\n.BR http://www.remotesensing.org/libtiff/\n"
  },
  {
    "path": "src/main/jni/tiff/man/TIFFbuffer.3tiff",
    "content": ".\\\" $Id: TIFFbuffer.3tiff,v 1.2 2005/11/02 11:07:18 dron Exp $\n.\\\"\n.\\\" Copyright (c) 1995 Sam Leffler\n.\\\" Copyright (c) 1995 Silicon Graphics, Inc.\n.\\\"\n.\\\" Permission to use, copy, modify, distribute, and sell this software and \n.\\\" its documentation for any purpose is hereby granted without fee, provided\n.\\\" that (i) the above copyright notices and this permission notice appear in\n.\\\" all copies of the software and related documentation, and (ii) the names of\n.\\\" Sam Leffler and Silicon Graphics may not be used in any advertising or\n.\\\" publicity relating to the software without the specific, prior written\n.\\\" permission of Sam Leffler and Silicon Graphics.\n.\\\" \n.\\\" THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n.\\\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n.\\\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n.\\\" \n.\\\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n.\\\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n.\\\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n.\\\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n.\\\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n.\\\" OF THIS SOFTWARE.\n.\\\"\n.if n .po 0\n.TH TIFFBUFFER 3TIFF \"November 1, 2005\" \"libtiff\"\n.SH NAME\nTIFFReadBufferSetup, TIFFWriteBufferSetup \\- I/O buffering control routines\n.SH SYNOPSIS\n.nf\n.B \"#include <tiffio.h>\"\n.sp\n.BI \"int TIFFReadBufferSetup(TIFF *\" tif \", tdata_t \" buffer \", tsize_t \" size \");\"\n.BI \"int TIFFWriteBufferSetup(TIFF *\" tif \", tdata_t \" buffer \", tsize_t \" size \");\"\n.fi\n.SH DESCRIPTION\nThe following routines are provided for client-control of the I/O buffers used\nby the library. Applications need never use these routines; they are provided\nonly for ``intelligent clients'' that wish to optimize memory usage and/or\neliminate potential copy operations that can occur when working with images\nthat have data stored without compression.\n.PP\n.I TIFFReadBufferSetup\nsets up the data buffer used to read raw (encoded) data from a file. If the\nspecified pointer is\n.SM NULL\n(zero), then a buffer of the appropriate size is allocated. Otherwise the\ncaller must guarantee that the buffer is large enough to hold any individual\nstrip of raw data.\n.I TIFFReadBufferSetup\nreturns a non-zero value if the setup was successful and zero otherwise.\n.PP\n.I TIFFWriteBufferSetup\nsets up the data buffer used to write raw (encoded) data to a file. If the\nspecified\n.I size\nis \\-1 then the buffer size is selected to hold a complete tile or strip, or\nat least 8 kilobytes, whichever is greater. If the specified\n.I buffer\nis \n.SM NULL\n(zero), then a buffer of the appropriate size is dynamically allocated.\n.I TIFFWriteBufferSetup\nreturns a non-zero value if the setup was successful and zero otherwise.\n.SH DIAGNOSTICS\n.BR \"%s: No space for data buffer at scanline %ld\" .\n.I TIFFReadBufferSetup\nwas unable to dynamically allocate space for a data buffer.\n.PP\n.BR \"%s: No space for output buffer\" .\n.I TIFFWriteBufferSetup\nwas unable to dynamically allocate space for a data buffer.\n.SH \"SEE ALSO\"\n.BR libtiff (3TIFF)\n.PP\nLibtiff library home page:\n.BR http://www.remotesensing.org/libtiff/\n"
  },
  {
    "path": "src/main/jni/tiff/man/TIFFcodec.3tiff",
    "content": ".\\\" $Id: TIFFcodec.3tiff,v 1.2 2005/11/02 11:07:18 dron Exp $\n.\\\"\n.\\\" Copyright (c) 1995 Sam Leffler\n.\\\" Copyright (c) 1995 Silicon Graphics, Inc.\n.\\\"\n.\\\" Permission to use, copy, modify, distribute, and sell this software and \n.\\\" its documentation for any purpose is hereby granted without fee, provided\n.\\\" that (i) the above copyright notices and this permission notice appear in\n.\\\" all copies of the software and related documentation, and (ii) the names of\n.\\\" Sam Leffler and Silicon Graphics may not be used in any advertising or\n.\\\" publicity relating to the software without the specific, prior written\n.\\\" permission of Sam Leffler and Silicon Graphics.\n.\\\" \n.\\\" THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n.\\\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n.\\\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n.\\\" \n.\\\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n.\\\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n.\\\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n.\\\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n.\\\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n.\\\" OF THIS SOFTWARE.\n.\\\"\n.if n .po 0\n.TH CODEC 3TIFF \"October 29, 2004\" \"libtiff\"\n.SH NAME\nTIFFFindCODEC, TIFFRegisterCODEC, TIFFUnRegisterCODEC, TIFFIsCODECConfigured\n\\- codec-related utility routines\n.SH SYNOPSIS\n.B \"#include <tiffio.h>\"\n.sp\n.BI \"const TIFFCodec* TIFFFindCODEC(uint16 \" scheme \");\"\n.br\n.BI \"TIFFCodec* TIFFRegisterCODEC(uint16 \" scheme \", const char *\" method \", TIFFInitMethod \" init \");\"\n.br\n.BI \"void TIFFUnRegisterCODEC(TIFFCodec *\" codec \");\"\n.br\n.BI \"int TIFFIsCODECConfigured(uint16 \" scheme \");\"\n.SH DESCRIPTION\n.I libtiff\nsupports a variety of compression schemes implemented by software\n.IR codecs .\nEach codec adheres to a modular interface that provides for\nthe decoding and encoding of image data; as well as some other\nmethods for initialization, setup, cleanup, and the control\nof default strip and tile sizes.\nCodecs are identified by the associated value of the \n.SM TIFF\n.I Compression\ntag; e.g. 5 for\n.SM LZW\ncompression.\n.PP\nThe\n.I TIFFRegisterCODEC\nroutine can be used to\naugment or override the set of codecs available to an application.\nIf the specified\n.I scheme\nalready has a registered codec then it is\n.I overridden\nand any images with data encoded with this\ncompression scheme will be decoded using the supplied coded.\n.PP\n.I TIFFIsCODECConfigured\nreturns 1 if the codec is configured and working. Otherwise 0 will be returned.\n.SH DIAGNOSTICS\n.BR \"No space to register compression scheme %s\" .\n.I TIFFRegisterCODEC\nwas unable to allocate memory for the data structures needed\nto register a codec.\n.PP\n.BR \"Cannot remove compression scheme %s; not registered\" .\n.I TIFFUnRegisterCODEC\ndid not locate the specified codec in the table of registered \ncompression schemes.\n.SH \"SEE ALSO\"\n.BR libtiff (3TIFF)\n.PP\nLibtiff library home page:\n.BR http://www.remotesensing.org/libtiff/\n"
  },
  {
    "path": "src/main/jni/tiff/man/TIFFcolor.3tiff",
    "content": ".\\\" $Id: TIFFcolor.3tiff,v 1.3 2006/03/23 14:54:02 dron Exp $\n.\\\"\n.\\\" Copyright (c) 2003, Andrey Kiselev <dron@ak4719.spb.edu>\n.\\\"\n.\\\" Permission to use, copy, modify, distribute, and sell this software and \n.\\\" its documentation for any purpose is hereby granted without fee, provided\n.\\\" that (i) the above copyright notices and this permission notice appear in\n.\\\" all copies of the software and related documentation, and (ii) the names of\n.\\\" Sam Leffler and Silicon Graphics may not be used in any advertising or\n.\\\" publicity relating to the software without the specific, prior written\n.\\\" permission of Sam Leffler and Silicon Graphics.\n.\\\" \n.\\\" THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n.\\\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n.\\\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n.\\\" \n.\\\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n.\\\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n.\\\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n.\\\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n.\\\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n.\\\" OF THIS SOFTWARE.\n.\\\"\n.if n .po 0\n.TH COLOR 3TIFF \"December 21, 2003\" \"libtiff\"\n.SH NAME\nTIFFYCbCrToRGBInit, TIFFYCbCrtoRGB, TIFFCIELabToRGBInit, TIFFCIELabToXYZ,\nTIFFXYZToRGB \\- color conversion routines.\n.SH SYNOPSIS\n.B \"#include <tiffio.h>\"\n.sp\n.BI \"int TIFFYCbCrToRGBInit(TIFFYCbCrToRGB *\" ycbcr \", float *\" luma \", float *\"refBlackWhite\" );\"\n.br\n.BI \"void TIFFYCbCrtoRGB(TIFFYCbCrToRGB *\" ycbcr \", uint32 \" Y \", int32 \" Cb \", int32 \" Cr \", uint32 *\" R \", uint32 *\" G \", uint32 *\" B \" );\"\n.sp\n.BI \"int TIFFCIELabToRGBInit(TIFFCIELabToRGB *\" cielab \", TIFFDisplay *\" display \", float *\" refWhite \");\"\n.br\n.BI \"void TIFFCIELabToXYZ(TIFFCIELabToRGB *\" cielab \", uint32 \" L \", int32 \" a \", int32 \" b \", float *\" X \", float *\" Y \", float *\" Z \");\"\n.br\n.BI \"void TIFFXYZToRGB(TIFFCIELabToRGB *\" cielab \", float \" X \", float \" Y \", float \" Z\" , uint32 *\" R \", uint32 *\" G \", uint32 *\" B \");\"\n.SH DESCRIPTION\nTIFF supports several color spaces for images stored in that format. There is\nusually a problem of application to handle the data properly and convert\nbetween different colorspaces for displaying and printing purposes. To\nsimplify this task libtiff implements several color conversion routines\nitself. In particular, these routines used in\n.B TIFFRGBAImage(3TIFF)\ninterface.\n.PP\n.B TIFFYCbCrToRGBInit()\nused to initialize\n.I YCbCr\nto\n.I RGB\nconversion state. Allocating and freeing of the\n.I ycbcr\nstructure belongs to programmer.\n.I TIFFYCbCrToRGB\ndefined in\n.B tiffio.h\nas\n.PP\n.RS\n.nf\ntypedef struct {                /* YCbCr->RGB support */\n        TIFFRGBValue* clamptab; /* range clamping table */\n        int*\t      Cr_r_tab;\n        int*\t      Cb_b_tab;\n        int32*\t      Cr_g_tab;\n        int32*\t      Cb_g_tab;\n        int32*        Y_tab;\n} TIFFYCbCrToRGB;\n.fi\n.RE\n.PP\n.I luma\nis a float array of three values representing proportions of the red, green\nand blue in luminance, Y (see section 21 of the TIFF 6.0 specification, where\nthe YCbCr images discussed).\n.I TIFFTAG_YCBCRCOEFFICIENTS\nholds that values in TIFF file.\n.I refBlackWhite\nis a float array of 6 values which specifies a pair of headroom and footroom\nimage data values (codes) for each image component (see section 20 of the\nTIFF 6.0 specification where the colorinmetry fields discussed).\n.I TIFFTAG_REFERENCEBLACKWHITE\nis responsible for storing these values in TIFF file. Following code snippet\nshould helps to understand the the technique:\n.PP\n.RS\n.nf\nfloat *luma, *refBlackWhite;\nuint16 hs, vs;\n\n/* Initialize structures */\nycbcr = (TIFFYCbCrToRGB*)\n\t_TIFFmalloc(TIFFroundup(sizeof(TIFFYCbCrToRGB), sizeof(long))\n        \t+ 4*256*sizeof(TIFFRGBValue)\n        \t+ 2*256*sizeof(int)\n        \t+ 3*256*sizeof(int32));\nif (ycbcr == NULL) {\n        TIFFError(\"YCbCr->RGB\",\n\t\t\"No space for YCbCr->RGB conversion state\");\n        exit(0);\n}\n\nTIFFGetFieldDefaulted(tif, TIFFTAG_YCBCRCOEFFICIENTS, &luma);\nTIFFGetFieldDefaulted(tif, TIFFTAG_REFERENCEBLACKWHITE, &refBlackWhite);\nif (TIFFYCbCrToRGBInit(ycbcr, luma, refBlackWhite) < 0)\n\texit(0);\n\n/* Start conversion */\nuint32 r, g, b;\nuint32 Y;\nint32 Cb, Cr;\n\nfor each pixel in image\n\tTIFFYCbCrtoRGB(img->ycbcr, Y, Cb, Cr, &r, &g, &b);\n\n/* Free state structure */\n_TIFFfree(ycbcr);\n.fi\n.RE\n.PP\n\n.PP\n.B TIFFCIELabToRGBInit()\ninitializes the\n.I CIE L*a*b* 1976\nto\n.I RGB\nconversion state.\n.B TIFFCIELabToRGB\ndefined as\n.PP\n.RS\n.nf\n#define CIELABTORGB_TABLE_RANGE 1500\n\ntypedef struct {\t\t     /* CIE Lab 1976->RGB support */\n\tint\trange;\t\t     /* Size of conversion table */\n\tfloat\trstep, gstep, bstep;\n\tfloat\tX0, Y0, Z0;\t     /* Reference white point */\n\tTIFFDisplay display;\n\tfloat\tYr2r[CIELABTORGB_TABLE_RANGE + 1]; /* Conversion of Yr to r */\n\tfloat\tYg2g[CIELABTORGB_TABLE_RANGE + 1]; /* Conversion of Yg to g */\n\tfloat\tYb2b[CIELABTORGB_TABLE_RANGE + 1]; /* Conversion of Yb to b */\n} TIFFCIELabToRGB;\n.fi\n.RE\n.PP\n.I display\nis a display device description, declared as\n.PP\n.RS\n.nf\ntypedef struct {\n\tfloat d_mat[3][3]; /* XYZ -> luminance matrix */\n\tfloat d_YCR;       /* Light o/p for reference white */\n\tfloat d_YCG;\n\tfloat d_YCB;\n\tuint32 d_Vrwr;     /* Pixel values for ref. white */\n\tuint32 d_Vrwg;\n\tuint32 d_Vrwb;\n\tfloat d_Y0R;       /* Residual light for black pixel */\n\tfloat d_Y0G;\n\tfloat d_Y0B;\n\tfloat d_gammaR;    /* Gamma values for the three guns */\n\tfloat d_gammaG;\n\tfloat d_gammaB;\n} TIFFDisplay;\n.fi\n.RE\n.PP\nFor example, the one can use sRGB device, which has the following parameters:\n.PP\n.RS\n.nf\nTIFFDisplay display_sRGB = {\n\t{       /* XYZ -> luminance matrix */\n\t\t{  3.2410F, -1.5374F, -0.4986F },\n\t\t{  -0.9692F, 1.8760F, 0.0416F },\n\t\t{  0.0556F, -0.2040F, 1.0570F }\n\t},\t\n\t100.0F, 100.0F, 100.0F, /* Light o/p for reference white */\n\t255, 255, 255,      /* Pixel values for ref. white */\n\t1.0F, 1.0F, 1.0F,   /* Residual light o/p for black pixel */\n\t2.4F, 2.4F, 2.4F,   /* Gamma values for the three guns */\n};\n.fi\n.RE\n.PP\n.I refWhite\nis a color temperature of the reference white. The\n.I TIFFTAG_WHITEPOINT\ncontains the chromaticity of the white point of the image from where the\nreference white can be calculated using following formulae:\n.PP\n.RS\nrefWhite_Y = 100.0\n.br\nrefWhite_X = whitePoint_x / whitePoint_y * refWhite_Y\n.br\nrefWhite_Z = (1.0 - whitePoint_x - whitePoint_y) / whitePoint_y * refWhite_X\n.br\n.RE\n.PP\nThe conversion itself performed in two steps: at the first one we will convert\n.I CIE L*a*b* 1976\nto\n.I CIE XYZ\nusing\n.B TIFFCIELabToXYZ()\nroutine, and at the second step we will convert\n.I CIE XYZ\nto\n.I RGB\nusing\n.B TIFFXYZToRGB().\nLook at the code sample below:\n.PP\n.RS\n.nf\nfloat   *whitePoint;\nfloat   refWhite[3];\n\n/* Initialize structures */\nimg->cielab = (TIFFCIELabToRGB *)\n\t_TIFFmalloc(sizeof(TIFFCIELabToRGB));\nif (!cielab) {\n\tTIFFError(\"CIE L*a*b*->RGB\",\n\t\t\"No space for CIE L*a*b*->RGB conversion state.\");\n\texit(0);\n}\n\nTIFFGetFieldDefaulted(tif, TIFFTAG_WHITEPOINT, &whitePoint);\nrefWhite[1] = 100.0F;\nrefWhite[0] = whitePoint[0] / whitePoint[1] * refWhite[1];\nrefWhite[2] = (1.0F - whitePoint[0] - whitePoint[1])\n\t      / whitePoint[1] * refWhite[1];\nif (TIFFCIELabToRGBInit(cielab, &display_sRGB, refWhite) < 0) {\n\tTIFFError(\"CIE L*a*b*->RGB\",\n\t\t\"Failed to initialize CIE L*a*b*->RGB conversion state.\");\n\t_TIFFfree(cielab);\n\texit(0);\n}\n\n/* Now we can start to convert */\nuint32 r, g, b;\nuint32 L;\nint32 a, b;\nfloat X, Y, Z;\n\nfor each pixel in image\n\tTIFFCIELabToXYZ(cielab, L, a, b, &X, &Y, &Z);\n\tTIFFXYZToRGB(cielab, X, Y, Z, &r, &g, &b);\n\n/* Don't forget to free the state structure */\n_TIFFfree(cielab);\n.fi\n.RE\n.PP\n.SH \"SEE ALSO\"\n.BR TIFFRGBAImage (3TIFF)\n.BR libtiff (3TIFF),\n.PP\nLibtiff library home page:\n.BR http://www.remotesensing.org/libtiff/\n"
  },
  {
    "path": "src/main/jni/tiff/man/TIFFmemory.3tiff",
    "content": ".\\\" $Id: TIFFmemory.3tiff,v 1.2 2005/11/02 11:07:18 dron Exp $\n.\\\"\n.\\\" Copyright (c) 1995 Sam Leffler\n.\\\" Copyright (c) 1995 Silicon Graphics, Inc.\n.\\\"\n.\\\" Permission to use, copy, modify, distribute, and sell this software and \n.\\\" its documentation for any purpose is hereby granted without fee, provided\n.\\\" that (i) the above copyright notices and this permission notice appear in\n.\\\" all copies of the software and related documentation, and (ii) the names of\n.\\\" Sam Leffler and Silicon Graphics may not be used in any advertising or\n.\\\" publicity relating to the software without the specific, prior written\n.\\\" permission of Sam Leffler and Silicon Graphics.\n.\\\" \n.\\\" THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n.\\\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n.\\\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n.\\\" \n.\\\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n.\\\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n.\\\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n.\\\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n.\\\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n.\\\" OF THIS SOFTWARE.\n.\\\"\n.if n .po 0\n.TH MEMORY 3TIFF \"October 15, 1995\" \"libtiff\"\n.SH NAME\n_TIFFmalloc, \\c\n_TIFFrealloc, \\c\n_TIFFfree, \\c\n_TIFFmemset, \\c\n_TIFFmemcpy, \\c\n_TIFFmemcmp, \\c\n\\- memory management-related functions for use with\n.SM TIFF\nfiles\n.SH SYNOPSIS\n.B \"#include <tiffio.h>\"\n.sp\n.BI \"tdata_t _TIFFmalloc(tsize_t \" size \");\"\n.br\n.BI \"tdata_t _TIFFrealloc(tdata_t \" buffer \", tsize_t \" size \");\"\n.br\n.BI \"void _TIFFfree(tdata_t \" buffer \");\"\n.br\n.BI \"void _TIFFmemset(tdata_t \" s \", int \" c \", tsize_t \" n \");\"\n.br\n.BI \"void _TIFFmemcpy(tdata_t \" dest \", const tdata_t \" src \", tsize_t \" n \");\"\n.br\n.BI \"int _TIFFmemcmp(const tdata_t \" s1 \", const tdata_t \"s2 \", tsize_t \" n \");\"\n.SH DESCRIPTION\nThese routines are provided for writing portable software that uses \n.IR libtiff ;\nthey hide any memory-management related issues, such as dealing with segmented\narchitectures found on 16-bit machines.\n.PP\n.I _TIFFmalloc\nand\n.I _TIFFrealloc\nare used to dynamically allocate and reallocate memory used by \n.IR libtiff ;\nsuch as memory passed into the I/O routines. Memory allocated through these\ninterfaces is released back to the system using the\n.I _TIFFfree\nroutine.\n.PP\nMemory allocated through one of the above interfaces can be set to a known\nvalue using\n.IR _TIFFmemset ,\ncopied to another memory location using\n.IR _TIFFmemcpy ,\nor compared for equality using \n.IR _TIFFmemcmp .\nThese routines conform to the equivalent\n.SM ANSI\nC routines: \n.IR memset ,\n.IR memcpy ,\nand\n.IR memcmp ,\nrepsectively.\n.SH DIAGNOSTICS\nNone.\n.SH \"SEE ALSO\"\n.BR malloc (3),\n.BR memory (3),\n.BR libtiff (3TIFF)\n.PP\nLibtiff library home page:\n.BR http://www.remotesensing.org/libtiff/\n"
  },
  {
    "path": "src/main/jni/tiff/man/TIFFquery.3tiff",
    "content": ".\\\" $Id: TIFFquery.3tiff,v 1.1 2004/11/11 14:39:16 dron Exp $\n.\\\"\n.\\\" Copyright (c) 1988-1997 Sam Leffler\n.\\\" Copyright (c) 1991-1997 Silicon Graphics, Inc.\n.\\\"\n.\\\" Permission to use, copy, modify, distribute, and sell this software and \n.\\\" its documentation for any purpose is hereby granted without fee, provided\n.\\\" that (i) the above copyright notices and this permission notice appear in\n.\\\" all copies of the software and related documentation, and (ii) the names of\n.\\\" Sam Leffler and Silicon Graphics may not be used in any advertising or\n.\\\" publicity relating to the software without the specific, prior written\n.\\\" permission of Sam Leffler and Silicon Graphics.\n.\\\" \n.\\\" THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n.\\\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n.\\\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n.\\\" \n.\\\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n.\\\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n.\\\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n.\\\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n.\\\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n.\\\" OF THIS SOFTWARE.\n.\\\"\n.if n .po 0\n.TH QUERY 3TIFF \"October 29, 2004\" \"libtiff\"\n.SH NAME\nTIFFCurrentRow,\nTIFFCurrentStrip,\nTIFFCurrentTile,\nTIFFCurrentDirectory,\nTIFFLastDirectory,\nTIFFFileno,\nTIFFFileName,\nTIFFGetMode,\nTIFFIsTiled,\nTIFFIsByteSwapped,\nTIFFIsUpSampled,\nTIFFIsMSB2LSB,\nTIFFGetVersion\n\\- query routines\n.SH SYNOPSIS\n.B \"#include <tiffio.h>\"\n.sp\n.BI \"uint32 TIFFCurrentRow(TIFF* \" tif \")\"\n.br\n.BI \"tstrip_t TIFFCurrentStrip(TIFF* \" tif \")\"\n.br\n.BI \"ttile_t TIFFCurrentTile(TIFF* \" tif \")\"\n.br\n.BI \"tdir_t TIFFCurrentDirectory(TIFF* \" tif \")\"\n.br\n.BI \"int TIFFLastDirectory(TIFF* \" tif \")\"\n.br\n.BI \"int TIFFFileno(TIFF* \" tif \")\"\n.br\n.BI \"char* TIFFFileName(TIFF* \" tif \")\"\n.br\n.BI \"int TIFFGetMode(TIFF* \" tif \")\"\n.br\n.BI \"int TIFFIsTiled(TIFF* \" tif \")\"\n.br\n.BI \"int TIFFIsByteSwapped(TIFF* \" tif \")\"\n.br\n.BI \"int TIFFIsUpSampled(TIFF* \" tif \")\"\n.br\n.BI \"int TIFFIsMSB2LSB(TIFF* \" tif \")\"\n.br\n.BI \"const char* TIFFGetVersion(void)\"\n.SH DESCRIPTION\nThe following routines return status information about an open\n.SM TIFF\nfile.\n.PP\n.IR TIFFCurrentDirectory\nreturns the index of the current directory (directories are numbered starting\nat 0). This number is suitable for use with the\n.IR TIFFSetDirectory\nroutine.\n.PP\n.IR TIFFLastDirectory\nreturns a non-zero value if the current directory is the last directory in the\nfile; otherwise zero is returned.\n.PP\n.IR TIFFCurrentRow ,\n.IR TIFFCurrentStrip ,\nand\n.IR TIFFCurrentTile ,\nreturn the current row, strip, and tile, respectively, that is being read or\nwritten. These values are updated each time a read or write is done.\n.PP\n.IR TIFFFileno\nreturns the underlying file descriptor used to access the \n.SM TIFF\nimage in the filesystem.\n.PP\n.IR TIFFFileName\nreturns the pathname argument passed to\n.IR TIFFOpen\nor\n.IR TIFFFdOpen .\n.PP\n.IR TIFFGetMode\nreturns the mode with which the underlying file was opened. On\n.SM UNIX\nsystems, this is the value passed to the\n.IR open (2)\nsystem call.\n.PP\n.IR TIFFIsTiled\nreturns a non-zero value if the image data has a tiled organization. Zero is\nreturned if the image data is organized in strips.\n.PP\n.IR TIFFIsByteSwapped\nreturns a non-zero value if the image data was in a different byte-order than\nthe host machine. Zero is returned if the TIFF file and local host byte-orders\nare the same.  Note that TIFFReadTile(), TIFFReadStrip() and\nTIFFReadScanline() functions already normally perform byte swapping to local\nhost order if needed.\n.PP\n.I TIFFIsUpSampled\nreturns a non-zero value if image data returned through the read interface\nroutines is being up-sampled. This can be useful to applications that want to\ncalculate I/O buffer sizes to reflect this usage (though the usual strip and\ntile size routines already do this).\n.PP\n.I TIFFIsMSB2LSB\nreturns a non-zero value if the image data is being returned with bit 0 as the\nmost significant bit.\n.PP\n.IR TIFFGetVersion\nreturns an\n.SM ASCII\nstring that has a version stamp for the \n.SM TIFF\nlibrary software.\n.SH DIAGNOSTICS\nNone.\n.SH \"SEE ALSO\"\n.IR libtiff (3TIFF),\n.IR TIFFOpen (3TIFF),\n.IR TIFFFdOpen (3TIFF)\n"
  },
  {
    "path": "src/main/jni/tiff/man/TIFFsize.3tiff",
    "content": ".\\\" $Id: TIFFsize.3tiff,v 1.2 2005/11/02 11:07:18 dron Exp $\n.\\\"\n.\\\" Copyright (c) 1988-1997 Sam Leffler\n.\\\" Copyright (c) 1991-1997 Silicon Graphics, Inc.\n.\\\"\n.\\\" Permission to use, copy, modify, distribute, and sell this software and \n.\\\" its documentation for any purpose is hereby granted without fee, provided\n.\\\" that (i) the above copyright notices and this permission notice appear in\n.\\\" all copies of the software and related documentation, and (ii) the names of\n.\\\" Sam Leffler and Silicon Graphics may not be used in any advertising or\n.\\\" publicity relating to the software without the specific, prior written\n.\\\" permission of Sam Leffler and Silicon Graphics.\n.\\\" \n.\\\" THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n.\\\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n.\\\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n.\\\" \n.\\\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n.\\\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n.\\\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n.\\\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n.\\\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n.\\\" OF THIS SOFTWARE.\n.\\\"\n.if n .po 0\n.TH TIFFSIZE 3TIFF \"October 15, 1995\" \"libtiff\"\n.SH NAME\nTIFFScanlineSize, TIFFRasterScanlineSize,\n\\- return the size of various items associated with an open\n.SM TIFF\nfile\n.SH SYNOPSIS\n.B \"#include <tiffio.h>\"\n.sp\n.BI \"tsize_t TIFFRasterScanlineSize(TIFF *\" tif \")\"\n.br\n.BI \"tsize_t TIFFScanlineSize(TIFF *\" tif \")\"\n.SH DESCRIPTION\n.I TIFFScanlineSize\nreturns the size in bytes of a row of data as it would be returned in a call\nto\n.IR TIFFReadScanline ,\nor as it would be expected in a call to\n.IR TIFFWriteScanline .\n.PP\n.I TIFFRasterScanlineSize\nreturns the size in bytes of a complete decoded and packed raster scanline.\nNote that this value may be different from the value returned by\n.I TIFFScanlineSize\nif data is stored as separate planes.\n.SH DIAGNOSTICS\nNone.\n.SH \"SEE ALSO\"\n.BR TIFFOpen (3TIFF),\n.BR TIFFReadScanline (3TIFF),\n.BR libtiff (3TIFF)\n.PP\nLibtiff library home page:\n.BR http://www.remotesensing.org/libtiff/\n"
  },
  {
    "path": "src/main/jni/tiff/man/TIFFstrip.3tiff",
    "content": ".\\\" $Id: TIFFstrip.3tiff,v 1.2 2005/11/02 11:07:18 dron Exp $\n.\\\"\n.\\\" Copyright (c) 1992-1997 Sam Leffler\n.\\\" Copyright (c) 1992-1997 Silicon Graphics, Inc.\n.\\\"\n.\\\" Permission to use, copy, modify, distribute, and sell this software and \n.\\\" its documentation for any purpose is hereby granted without fee, provided\n.\\\" that (i) the above copyright notices and this permission notice appear in\n.\\\" all copies of the software and related documentation, and (ii) the names of\n.\\\" Sam Leffler and Silicon Graphics may not be used in any advertising or\n.\\\" publicity relating to the software without the specific, prior written\n.\\\" permission of Sam Leffler and Silicon Graphics.\n.\\\" \n.\\\" THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n.\\\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n.\\\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n.\\\" \n.\\\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n.\\\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n.\\\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n.\\\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n.\\\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n.\\\" OF THIS SOFTWARE.\n.\\\"\n.if n .po 0\n.TH TIFFSTRIP 3TIFF \"October 15, 1995\" \"libtiff\"\n.SH NAME\nTIFFDefaultStripSize, TIFFStripSize, TIFFVStripSize, TIFFRawStripSize,\nTIFFComputeStrip, TIFFNumberOfStrips \\- strip-related utility routines\n.SH SYNOPSIS\n.B \"#include <tiffio.h>\"\n.sp\n.BI \"uint32 TIFFDefaultStripSize(TIFF *\" tif \", uint32 \" estimate \")\"\n.br\n.BI \"tsize_t TIFFStripSize(TIFF *\" tif \")\"\n.br\n.BI \"tsize_t TIFFVStripSize(TIFF *\" tif \", uint32 \" nrows \")\"\n.br\n.BI \"tsize_t TIFFRawStripSize(TIFF *\" tif \", tstrip_t \" strip \")\"\n.br\n.BI \"tstrip_t TIFFComputeStrip(TIFF *\" tif \", uint32 \" row \", tsample_t \" sample \")\"\n.br\n.BI \"tstrip_t TIFFNumberOfStrips(TIFF *\" tif \")\"\n.SH DESCRIPTION\n.I TIFFDefaultStripSize\nreturns the number of rows for a reasonable-sized strip according to the\ncurrent settings of the\n.IR ImageWidth ,\n.IR BitsPerSample ,\n.IR SamplesPerPixel ,\ntags and any compression-specific requirements. If the\n.I estimate\nparameter, if non-zero, then it is taken as an estimate of the desired strip\nsize and adjusted according to any compression-specific requirements. The\nvalue returned by this function is typically used to define the\n.I RowsPerStrip\ntag. In lieu of any unusual requirements\n.I TIFFDefaultStripSize\ntries to create strips that have approximately\n8 kilobytes of uncompressed data.\n.PP\n.IR TIFFStripSize\nreturns the equivalent size for a strip of data as it would be returned in a\ncall to\n.IR TIFFReadEncodedStrip\nor as it would be expected in a call to\n.IR TIFFWriteEncodedStrip .\n.PP\n.I TIFFVStripSize\nreturns the number of bytes in a strip with\n.I nrows\nrows of data.\n.PP\n.I TIFFRawStripSize\nreturns the number of bytes in a raw strip (i.e. not decoded).\n.PP\n.IR TIFFComputeStrip\nreturns the strip that contains the specified coordinates. A valid strip is\nalways returned; out-of-range coordinate values are clamped to the bounds of\nthe image. The\n.I row\nparameter is always used in calculating a strip. The\n.I sample\nparameter is used only if data are organized in separate planes (\\c\n.IR PlanarConfiguration =2).\n.PP\n.IR TIFFNumberOfStrips\nreturns the number of strips in the image.\n.SH DIAGNOSTICS\nNone.\n.SH \"SEE ALSO\"\n.BR TIFFReadEncodedStrip (3TIFF),\n.BR TIFFReadRawStrip (3TIFF),\n.BR TIFFWriteEncodedStrip (3TIFF),\n.BR TIFFWriteRawStrip (3TIFF),\n.BR libtiff (3TIFF),\n.PP\nLibtiff library home page:\n.BR http://www.remotesensing.org/libtiff/\n"
  },
  {
    "path": "src/main/jni/tiff/man/TIFFswab.3tiff",
    "content": ".\\\" $Id: TIFFswab.3tiff,v 1.2 2005/11/02 11:07:18 dron Exp $\n.\\\"\n.\\\" Copyright (c) 1988-1997 Sam Leffler\n.\\\" Copyright (c) 1991-1997 Silicon Graphics, Inc.\n.\\\"\n.\\\" Permission to use, copy, modify, distribute, and sell this software and \n.\\\" its documentation for any purpose is hereby granted without fee, provided\n.\\\" that (i) the above copyright notices and this permission notice appear in\n.\\\" all copies of the software and related documentation, and (ii) the names of\n.\\\" Sam Leffler and Silicon Graphics may not be used in any advertising or\n.\\\" publicity relating to the software without the specific, prior written\n.\\\" permission of Sam Leffler and Silicon Graphics.\n.\\\" \n.\\\" THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n.\\\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n.\\\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n.\\\" \n.\\\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n.\\\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n.\\\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n.\\\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n.\\\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n.\\\" OF THIS SOFTWARE.\n.\\\"\n.if n .po 0\n.TH SWAB 3TIFF \"November 04, 2004\" \"libtiff\"\n.SH NAME\nTIFFGetBitRevTable, TIFFReverseBits, TIFFSwabShort, TIFFSwabLong,\nTIFFSwabArrayOfShort, TIFFSwabArrayOfLong \\- byte- and bit-swapping routines\n.SH SYNOPSIS\n.B \"#include <tiffio.h>\"\n.sp\n.BI \"const unsigned char* TIFFGetBitRevTable(int \" reversed \")\"\n.br\n.BI \"void TIFFReverseBits(u_char *\" data \", unsigned long \" nbytes \")\"\n.br\n.BI \"void TIFFSwabShort(uint16 *\" data \")\"\n.br\n.BI \"void TIFFSwabLong(uint32 *\" data \")\"\n.br\n.BI \"void TIFFSwabArrayOfShort(uint16 *\" data \", unsigned long \" nshorts \")\"\n.br\n.BI \"void TIFFSwabArrayOfLong(uint32 *\" data \", unsigned long \" nlongs \")\"\n.SH DESCRIPTION\nThe following routines are used by the library to swap\n16- and 32-bit data and to reverse the order of bits in bytes.\n.PP\n.IR TIFFSwabShort\nand\n.IR TIFFSwabLong\nswap the bytes in a single 16-bit and 32-bit item, respectively.\n.IR TIFFSwabArrayOfShort\nand\n.IR TIFFSwabArrayOfLong\nswap the bytes in an array of 16-bit and 32-bit items, respectively.\n.PP\n.IR TIFFReverseBits\nreplaces each byte in\n.I data\nwith the equivalent bit-reversed value. This operation is performed with a\nlookup table, which is returned using the\n.IR TIFFGetBitRevTable\nfunction.\n.I reversed\nparameter specifies which table should be returned. Supply\n.I 1\nif you want bit reversal table. Supply\n.I 0\nto get the table that do not reverse bit values. It is a lookup table that can\nbe used as an\n.IR \"identity function\" ;\ni.e.\n.IR \"TIFFNoBitRevTable[n] == n\" .\n.SH DIAGNOSTICS\nNone.\n.SH \"SEE ALSO\"\n.BR libtiff (3TIFF)\n.PP\nLibtiff library home page:\n.BR http://www.remotesensing.org/libtiff/\n"
  },
  {
    "path": "src/main/jni/tiff/man/TIFFtile.3tiff",
    "content": ".\\\" $Id: TIFFtile.3tiff,v 1.2 2005/11/02 11:07:19 dron Exp $\n.\\\"\n.\\\" Copyright (c) 1988-1997 Sam Leffler\n.\\\" Copyright (c) 1991-1997 Silicon Graphics, Inc.\n.\\\"\n.\\\" Permission to use, copy, modify, distribute, and sell this software and \n.\\\" its documentation for any purpose is hereby granted without fee, provided\n.\\\" that (i) the above copyright notices and this permission notice appear in\n.\\\" all copies of the software and related documentation, and (ii) the names of\n.\\\" Sam Leffler and Silicon Graphics may not be used in any advertising or\n.\\\" publicity relating to the software without the specific, prior written\n.\\\" permission of Sam Leffler and Silicon Graphics.\n.\\\" \n.\\\" THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n.\\\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n.\\\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n.\\\" \n.\\\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n.\\\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n.\\\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n.\\\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n.\\\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n.\\\" OF THIS SOFTWARE.\n.\\\"\n.if n .po 0\n.TH TIFFTILE 3TIFF \"February 14, 1992\" \"libtiff\"\n.SH NAME\nTIFFTileSize, TIFFTileRowSize, TIFFVTileSize, TIFFDefaultTileSize,\nTIFFComputeTile, TIFFCheckTile, TIFFNumberOfTiles \\- tile-related utility\nroutines\n.SH SYNOPSIS\n.B \"#include <tiffio.h>\"\n.sp\n.BI \"void TIFFDefaultTileSize(TIFF *\" tif \", uint32 *\" tw \", uint32 *\" th \")\"\n.br\n.BI \"tsize_t TIFFTileSize(TIFF *\" tif \")\"\n.br\n.BI \"tsize_t TIFFTileRowSize(TIFF *\" tif \")\"\n.br\n.BI \"tsize_t TIFFVTileSize(TIFF *\" tif \", uint32 \" nrows \")\"\n.br\n.BI \"ttile_t TIFFComputeTile(TIFF *\" tif \", uint32 \" x \", uint32 \" y \", uint32 \" z \", tsample_t \" sample \")\"\n.br\n.BI \"int TIFFCheckTile(TIFF *\" tif \", uint32 \" x \", uint32 \" y \", uint32 \" z \", tsample_t \" sample \")\"\n.br\n.BI \"ttile_t TIFFNumberOfTiles(TIFF *\" tif \")\"\n.br\n.SH DESCRIPTION\n.I TIFFDefaultTileSize\nreturns the pixel width and height of a reasonable-sized tile; suitable for\nsetting up the\n.I TileWidth\nand\n.I TileLength\ntags.\nIf the\n.I tw\nand\n.I th\nvalues passed in are non-zero, then they are adjusted to reflect any\ncompression-specific requirements. The returned width and height are\nconstrained to be a multiple of 16 pixels to conform with the \n.SM TIFF\nspecification.\n.PP\n.I TIFFTileSize\nreturns the equivalent size for a tile of data as it would be returned in a\ncall to\n.I TIFFReadTile\nor as it would be expected in a call to\n.IR TIFFWriteTile .\n.PP\n.I TIFFVTileSize\nreturns the number of bytes in a row-aligned tile with\n.I nrows\nof data.\n.PP\n.I TIFFTileRowSize\nreturns the number of bytes of a row of data in a tile.\n.PP\n.IR TIFFComputeTile\nreturns the tile that contains the specified coordinates. A valid tile is\nalways returned; out-of-range coordinate values are clamped to the bounds of\nthe image. The\n.I x\nand\n.I y\nparameters are always used in calculating a tile. The\n.I z\nparameter is used if the image is deeper than 1 slice (\\c\n.IR ImageDepth >1).\nThe\n.I sample\nparameter is used only if data are organized in separate planes (\\c\n.IR PlanarConfiguration =2).\n.PP\n.IR TIFFCheckTile\nreturns a non-zero value if the supplied coordinates are within the bounds of\nthe image and zero otherwise. The\n.I x\nparameter is checked against the value of the\n.I ImageWidth\ntag. The\n.I y\nparameter is checked against the value of the\n.I ImageLength\ntag. The\n.I z\nparameter is checked against the value of the\n.I ImageDepth\ntag (if defined). The\n.I sample\nparameter is checked against the value of the\n.I SamplesPerPixel\nparameter if the data are organized in separate planes.\n.PP\n.IR TIFFNumberOfTiles\nreturns the number of tiles in the image.\n.SH DIAGNOSTICS\nNone.\n.SH \"SEE ALSO\"\n.BR TIFFReadEncodedTile (3TIFF),\n.BR TIFFReadRawTile (3TIFF),\n.BR TIFFReadTile (3TIFF),\n.BR TIFFWriteEncodedTile (3TIFF),\n.BR TIFFWriteRawTile (3TIFF),\n.BR TIFFWriteTile (3TIFF),\n.BR libtiff (3TIFF)\n.PP\nLibtiff library home page:\n.BR http://www.remotesensing.org/libtiff/\n"
  },
  {
    "path": "src/main/jni/tiff/man/bmp2tiff.1",
    "content": ".\\\" $Id: bmp2tiff.1,v 1.7 2006/04/20 12:17:19 dron Exp $\n.\\\"\n.\\\" Copyright (c) 2004, Andrey Kiselev <dron@ak4719.spb.edu> \n.\\\"\n.\\\" Permission to use, copy, modify, distribute, and sell this software and \n.\\\" its documentation for any purpose is hereby granted without fee, provided\n.\\\" that (i) the above copyright notices and this permission notice appear in\n.\\\" all copies of the software and related documentation, and (ii) the names of\n.\\\" Sam Leffler and Silicon Graphics may not be used in any advertising or\n.\\\" publicity relating to the software without the specific, prior written\n.\\\" permission of Sam Leffler and Silicon Graphics.\n.\\\" \n.\\\" THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n.\\\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n.\\\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n.\\\" \n.\\\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n.\\\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n.\\\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n.\\\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n.\\\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n.\\\" OF THIS SOFTWARE.\n.\\\"\n.if n .po 0\n.TH BMP2TIFF 1 \"15 October, 2004\" \"libtiff\"\n.SH NAME\nbmp2tiff \\- create a\n.SM TIFF\nfile from a Microsoft Windows Device Independent Bitmap image file\n.SH SYNOPSIS\n.B bmp2tiff\n[\n.I options\n]\n.I input.bmp\n[\n.I input2.bmp ...\\&\n]\n.I output.tiff\n.SH DESCRIPTION\n.I bmp2tiff\nconverts a Microsoft Windows Device Independent Bitmap image file to\n.SM TIFF.\nIf several input BMP files are being specified the multipage\n.SM TIFF\noutput file will be created. By default, the\n.SM TIFF\nimage is created with data samples packed (\\c\n.IR PlanarConfiguration =1),\ncompressed with the PackBits algorithm (\\c\n.IR Compression =32773),\nand with each strip no more than 8 kilobytes.\nThese characteristics can overridden, or explicitly specified\nwith the options described below.\n.SH OPTIONS\n.TP\n.B \\-c\nSpecify a compression scheme to use when writing image data:\n.B \"\\-c none\"\nfor no compression,\n.B \"\\-c packbits\"\nfor the PackBits compression algorithm (the default),\n.B \"\\-c jpeg\"\nfor the baseline JPEG compression algorithm,\n.B \"\\-c zip\"\nfor the Deflate compression algorithm,\nand\n.B \"\\-c lzw\"\nfor Lempel-Ziv & Welch.\n.TP\n.BI \\-r \" number\"\nWrite data with a specified number of rows per strip;\nby default the number of rows/strip is selected so that each strip\nis approximately 8 kilobytes.\n.SH \"SEE ALSO\"\n.BR gif2tiff (1),\n.BR pal2rgb (1),\n.BR ppm2tiff (1),\n.BR raw2tiff (1),\n.BR ras2tiff (1),\n.BR sgi2tiff (1),\n.BR libtiff (3TIFF)\n.PP\nLibtiff library home page:\n.BR http://www.remotesensing.org/libtiff/\n"
  },
  {
    "path": "src/main/jni/tiff/man/fax2ps.1",
    "content": ".\\\"\t$Id: fax2ps.1,v 1.4 2006/04/20 12:17:19 dron Exp $\n.\\\"\n.\\\" Copyright (c) 1991-1997 Sam Leffler\n.\\\" Copyright (c) 1991-1997 Silicon Graphics, Inc.\n.\\\"\n.\\\" Permission to use, copy, modify, distribute, and sell this software and \n.\\\" its documentation for any purpose is hereby granted without fee, provided\n.\\\" that (i) the above copyright notices and this permission notice appear in\n.\\\" all copies of the software and related documentation, and (ii) the names of\n.\\\" Sam Leffler and Silicon Graphics may not be used in any advertising or\n.\\\" publicity relating to the software without the specific, prior written\n.\\\" permission of Sam Leffler and Silicon Graphics.\n.\\\" \n.\\\" THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n.\\\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n.\\\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n.\\\" \n.\\\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n.\\\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n.\\\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n.\\\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n.\\\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n.\\\" OF THIS SOFTWARE.\n.\\\"\n.ds Ps PostScript\n.if n .po 0\n.TH FAX2PS 1 \"November 2, 2005\" \"libtiff\"\n.SH NAME\nfax2ps \\- convert a\n.SM TIFF\nfacsimile to compressed \\*(Ps\\(tm\n.SH SYNOPSIS\n.B fax2ps\n[\n.I options\n] [\n.I file ...\\&\n]\n.SH DESCRIPTION\n.I fax2ps\nreads one or more\n.SM TIFF\nfacsimile image files and prints a compressed form of\n\\*(Ps on the standard output that is suitable for printing.\n.PP\nBy default, each page is scaled to reflect the\nimage dimensions and resolutions stored in the file.\nThe\n.B \\-x\nand\n.B \\-y\noptions can be used to specify the horizontal and vertical\nimage resolutions (lines/inch), respectively.\nIf the\n.B \\-S\noption is specified, each page is scaled to fill an output page.\nThe default output page is 8.5 by 11 inches.\nAlternate page dimensions can be specified in inches with the\n.B \\-W\nand\n.B \\-H\noptions.\n.PP\nBy default\n.I fax2ps\ngenerates \\*(Ps for all pages in the file.\nThe\n.B \\-p\noption can be used to select one or more pages from\na multi-page document.\n.PP\n.I fax2ps\ngenerates a compressed form of \\*(Ps that is\noptimized for sending pages of text to a \\*(Ps\nprinter attached to a host through a low-speed link (such\nas a serial line).\nEach output page is filled with white and then only\nthe black areas are drawn.\nThe \\*(Ps specification of the black drawing operations\nis optimized by using a special font that encodes the\nmove-draw operations required to fill\nthe black regions on the page.\nThis compression scheme typically results in a substantially\nreduced \\*(Ps description, relative to the straightforward\nimaging of the page with a \\*(Ps\n.I image\noperator.\nThis algorithm can, however, be ineffective\nfor continuous-tone and white-on-black images.\nFor these images, it sometimes is more efficient to send\nthe raster bitmap image directly; see\n.BR tiff2ps (1).\n.SH OPTIONS\n.TP 10\n.BI \\-p \" number\"\nPrint only the indicated page.\nMultiple pages may be printed by specifying\nthis option more than once.\n.TP 10\n.BI \\-x \" resolution\"\nUse\n.I resolution\nas the horizontal resolution, in dots/inch, of the image data.\nBy default this value is taken from the file.\n.TP 10\n.BI \\-y \" resolution\"\nUse\n.I resolution\nas the vertical resolution, in lines/inch, of the image data.\nBy default this value is taken from the file.\n.TP 10\n.B \\-S\nScale each page of image data to fill the output page dimensions.\nBy default images are presented according to the dimension\ninformation recorded in the \n.SM TIFF\nfile.\n.TP 10\n.BI \\-W \" width\"\nUse\n.I width\nas the width, in inches, of the output page.\n.TP 10\n.BI \\-H \" height\"\nUse\n.I height\nas the height, in inches, of the output page.\n.SH DIAGNOSTICS\nSome messages about malformed \n.SM TIFF\nimages come from the\n.SM TIFF\nlibrary.\n.PP\nVarious messages about badly formatted facsimile images\nmay be generated due to transmission errors in received\nfacsimile.\n.I fax2ps\nattempts to recover from such data errors by resynchronizing\ndecoding at the end of the current scanline.\nThis can result in long horizontal black lines in the resultant\n\\*(Ps image.\n.SH NOTES\nIf the destination printer supports \\*(Ps Level II then\nit is always faster to just send the encoded bitmap generated\nby the\n.BR tiff2ps (1)\nprogram.\n.SH BUGS\n.I fax2ps\nshould probably figure out when it is doing a poor\njob of compressing the output and just generate \n\\*(Ps to image the bitmap raster instead.\n.SH \"SEE ALSO\"\n.BR tiff2ps (1),\n.BR libtiff (3)\n.PP\nLibtiff library home page:\n.BR http://www.remotesensing.org/libtiff/\n"
  },
  {
    "path": "src/main/jni/tiff/man/fax2tiff.1",
    "content": ".\\\" $Id: fax2tiff.1,v 1.7 2006/04/20 12:17:19 dron Exp $\n.\\\"\n.\\\" Copyright (c) 1990-1997 Sam Leffler\n.\\\" Copyright (c) 1991-1997 Silicon Graphics, Inc.\n.\\\"\n.\\\" Permission to use, copy, modify, distribute, and sell this software and \n.\\\" its documentation for any purpose is hereby granted without fee, provided\n.\\\" that (i) the above copyright notices and this permission notice appear in\n.\\\" all copies of the software and related documentation, and (ii) the names of\n.\\\" Sam Leffler and Silicon Graphics may not be used in any advertising or\n.\\\" publicity relating to the software without the specific, prior written\n.\\\" permission of Sam Leffler and Silicon Graphics.\n.\\\" \n.\\\" THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n.\\\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n.\\\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n.\\\" \n.\\\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n.\\\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n.\\\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n.\\\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n.\\\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n.\\\" OF THIS SOFTWARE.\n.\\\"\n.if n .po 0\n.TH FAX2TIFF 1 \"November 2, 2005\" \"libtiff\"\n.SH NAME\nfax2tiff \\- create a\n.SM TIFF\nClass F fax file from raw fax data\n.SH SYNOPSIS\n.B fax2tiff\n[\n.I options\n] [\n.B \\-o\n.I output.tif\n]\n.I input.raw\n.SH DESCRIPTION\n.I Fax2tiff\ncreates a\n.SM TIFF\nfile containing \n.SM CCITT\nGroup 3 or Group 4 encoded data from one or more files containing ``raw''\nGroup 3 or Group 4 encoded data (typically obtained directly from a fax modem).\nBy default, each row of data in the resultant\n.SM TIFF\nfile is 1-dimensionally encoded and\npadded or truncated to 1728 pixels, as needed.\nThe resultant image is a set of low resolution (98 lines/inch)\nor medium resolution (196 lines/inch)\npages, each of which is a single strip of data.\nThe generated file conforms to the\n.SM TIFF\nClass F (\\c\n.SM FAX\\c\n) specification for storing facsimile data.\nThis means, in particular, that each page of the data does\n.B not\ninclude the trailing \n.I \"return to control\"\n(\\c\n.SM RTC\\c\n) code; as required\nfor transmission by the\n.SM CCITT\nGroup 3 specifications.\nThe old, ``classic'', format is created if the\n.B \\-c\noption is used.\n(The Class F format can also be requested with the\n.B \\-f\noption.)\n.PP\nThe default name of the output image is\n.IR fax.tif ;\nthis can be changed with the\n.B \\-o\noption.\nEach input file is assumed to be a separate page of facsimile data\nfrom the same document.\nThe order in which input files are specified on the command\nline is the order in which the resultant pages appear in the\noutput file.\n.SH OPTIONS\nOptions that affect the interpretation of input data are:\n.TP\n.B \\-3\nAssume input data is\n.SM CCITT\nGroup 3 encoded (default).\n.TP\n.B \\-4\nAssume input data is\n.SM CCITT\nGroup 4 encoded.\n.TP\n.B \\-U\nAssume input data is uncompressed (Group 3 or Group 4).\n.TP\n.B \\-1\nAssume input data is encoded with the 1-dimensional version of the\n.SM CCITT\nGroup 3 Huffman encoding algorithm (default).\n.TP\n.B \\-2\nAssume input data is 2-dimensional version of the\n.SM CCITT\nGroup 3 Huffman encoding algorithm.\n.TP\n.B \\-P\nAssume input data is\n.B not\nEOL-aligned (default). This option has effect with Group 3 encoded input only.\n.TP\n.B \\-A\nAssume input data is EOL-aligned. This option has effect with Group 3\nencoded input only.\n.TP\n.B \\-M\nTreat input data as having bits filled from most significant bit (\\c\n.SM MSB\\c\n) to most least bit (\\c\n.SM LSB\\c\n).\n.TP\n.B \\-L\nTreat input data as having bits filled from least significant bit (\\c\n.SM LSB\\c\n) to most significant bit (\\c\n.SM MSB\\c\n) (default).\n.TP\n.B \\-B\nAssume input data was encoded with black as 0 and white as 1.\n.TP\n.B \\-W\nAssume input data was encoded with black as 1 and white as 0 (default).\n.TP\n.B \\-R\nSpecify the vertical resolution, in lines/inch, of the input images.\nBy default input are assumed to have a vertical resolution of 196 lines/inch.\nIf images are low resolution facsimile, a value of 98 lines/inch should\nbe specified.\n.TP\n.B \\-X\nSpecify the width, in pixels, of the input images.\nBy default input are assumed to have a width of 1728 pixels.\n.PP\nOptions that affect the output file format are:\n.TP\n.B \\-o\nSpecify the name of the output file.\n.TP\n.B \\-7\nForce output to be compressed with the\n.SM CCITT\nGroup 3 Huffman encoding algorithm (default).\n.TP\n.B \\-8\nForce output to be compressed with the\n.SM CCITT\nGroup 4 Huffman encoding.\n.TP\n.B \\-u\nForce output to be uncompressed (Group 3 or Group 4).\n.TP\n.B \\-5\nForce output to be encoded with the 1-dimensional version of the\n.SM CCITT\nGroup 3 Huffman encoding algorithm.\n.TP\n.B \\-6\nForce output to be encoded with the 2-dimensional version of the\n.SM CCITT\nGroup 3 Huffman encoding algorithm (default).\n.TP\n.B \\-a\nForce the last bit of each\n.I \"End Of Line\"\n(\\c\n.SM EOL\\c\n) code to land on a byte boundary (default). This ``zero padding'' will\nbe reflected in the contents of the\n.I Group3Options\ntag of the resultant\n.SM TIFF\nfile. This option has effect with Group 3 encoded output only.\n.TP\n.B \\-p\nDo not EOL-align output. This option has effect with Group 3 encoded\noutput only.\n.TP\n.B \\-c\nGenerate \"classic\" Group 3 TIFF format.\n.TP\n.B \\-f\nGenerate TIFF Class F (TIFF/F) format (default).\n.TP\n.B \\-m\nForce output data to have bits filled from most significant bit (\\c\n.SM MSB\\c\n) to most least bit (\\c\n.SM LSB\\c\n).\n.TP\n.B \\-l\nForce  output data to have bits filled from least significant bit (\\c\n.SM LSB\\c\n) to most significant bit (\\c\n.SM MSB\\c\n) (default).\n.TP\n.B \\-r\nSpecify the number of rows (scanlines) in each strip of data\nwritten to the output file.\nBy default (or when value\n.B 0\nis specified),\n.I tiffcp\nattempts to set the rows/strip\nthat no more than 8 kilobytes of data appear in a strip (with except of G3/G4\ncompression schemes). If you specify special value\n.B \\-1\nit will results in infinite number of the rows per strip. The entire image\nwill be the one strip in that case. This is default in case of G3/G4 output\ncompression schemes.\n.TP\n.B \\-s\nStretch the input image vertically by writing each input row of\ndata twice to the output file.\n.TP\n.B \\-v\nForce\n.I fax2tiff\nto print the number of rows of data it retrieved from the input file.\n.TP\n.B \\-z\nForce output to be compressed with the LZW encoding.\n.SH DIAGNOSTICS\nThe following warnings and errors come from the decoding\nroutines in the library.\n.PP\n.BR \"Warning, %s: Premature EOL at scanline %d (x %d).\\en\" .\nThe input data had a row that was shorter than the expected width.\nThe row is padded with white.\n.PP\n.BR \"%s: Premature EOF at scanline %d (x %d).\\en\" .\nThe decoder ran out of data in the middle of a scanline.\nThe resultant row is padded with white.\n.PP\n.BR \"%s: Bad code word at row %d, x %d\\en\" .\nAn invalid Group 3 \n.I code\nwas encountered while decoding the input file. \nThe row number and horizontal position is given.\nThe remainder of the input row is discarded, while\nthe corresponding output row is padded with white.\n.PP\n.BR \"%s: Bad 2D code word at scanline %d.\\en\" .\nAn invalid Group 4 or 2D Group 3\n.I code\nwas encountered while decoding the input file. \nThe row number and horizontal position is given.\nThe remainder of the input row is discarded, while\nthe corresponding output row is padded with white.\n.SH BUGS\nInput data are assumed to have a a ``top left'' orientation;\nit should be possible to override this assumption\nfrom the command line.\n.SH \"SEE ALSO\"\n.BR \"\\s-1CCITT\\s+1 Recommendation T.4\"\n(Standardization of Group 3 Facsimile Apparatus for Document Transmission).\n.PP\n.BR \"The Spirit of TIFF Class F\",\nan appendix to the TIFF 5.0 specification prepared by Cygnet Technologies.\n.PP\n.BR tiffinfo (1),\n.BR tiffdither (1),\n.BR tiffgt (1),\n.BR libtiff (3)\n.PP\nLibtiff library home page:\n.BR http://www.remotesensing.org/libtiff/\n"
  },
  {
    "path": "src/main/jni/tiff/man/gif2tiff.1",
    "content": ".\\\" $Id: gif2tiff.1,v 1.4 2006/04/20 12:17:19 dron Exp $\n.\\\"\n.\\\" Copyright (c) 1991-1997 Sam Leffler\n.\\\" Copyright (c) 1991-1997 Silicon Graphics, Inc.\n.\\\"\n.\\\" Permission to use, copy, modify, distribute, and sell this software and \n.\\\" its documentation for any purpose is hereby granted without fee, provided\n.\\\" that (i) the above copyright notices and this permission notice appear in\n.\\\" all copies of the software and related documentation, and (ii) the names of\n.\\\" Sam Leffler and Silicon Graphics may not be used in any advertising or\n.\\\" publicity relating to the software without the specific, prior written\n.\\\" permission of Sam Leffler and Silicon Graphics.\n.\\\" \n.\\\" THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n.\\\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n.\\\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n.\\\" \n.\\\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n.\\\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n.\\\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n.\\\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n.\\\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n.\\\" OF THIS SOFTWARE.\n.\\\"\n.if n .po 0\n.TH GIF2TIFF 1 \"November 2, 2005\" \"libtiff\"\n.SH NAME\ngif2tiff \\- create a\n.SM TIFF\nfile from a GIF87 format image file\n.SH SYNOPSIS\n.B gif2tiff\n[\n.I options\n]\n.I input.gif\n.I output.tif\n.SH DESCRIPTION\n.I Gif2tiff\nconverts a file in the GIF87 format to\n.SM TIFF.\nThe\n.SM TIFF\nimage is created as a palette image, with samples\ncompressed with the Lempel-Ziv & Welch algorithm (\\c\n.IR Compression =5).\nThese characteristics can overridden, or explicitly specified\nwith the options described below.\n.SH OPTIONS\n.TP\n.B \\-c\nSpecify a compression scheme to use when writing image data:\n.B \"\\-c none\"\nfor no compression,\n.B \"\\-c packbits\"\nfor the PackBits compression algorithm,\n.B \"\\-c zip\"\nfor the Deflate compression algorithm,\nand\n.B \"\\-c lzw\"\nfor Lempel-Ziv & Welch (the default).\n.TP\n.B \\-r\nWrite data with a specified number of rows per strip;\nby default the number of rows/strip is selected so that each strip\nis approximately 8 kilobytes.\n.SH NOTES\nThe program is based on Paul Haeberli's\n.I fromgif\nprogram which, in turn, is based on Marcel J.E. Mol's GIF reader.\n.SH BUGS\nShould have more options to control output format.\n.SH \"SEE ALSO\"\n.BR pal2rgb (1),\n.BR tiffinfo (1),\n.BR tiffcp (1),\n.BR tiffmedian (1),\n.BR libtiff (3)\n.PP\nLibtiff library home page:\n.BR http://www.remotesensing.org/libtiff/\n"
  },
  {
    "path": "src/main/jni/tiff/man/libtiff.3tiff",
    "content": ".\\\" $Id: libtiff.3tiff,v 1.3 2005/11/02 11:07:19 dron Exp $\n.\\\"\n.\\\" Copyright (c) 1988-1997 Sam Leffler\n.\\\" Copyright (c) 1991-1997 Silicon Graphics, Inc.\n.\\\"\n.\\\" Permission to use, copy, modify, distribute, and sell this software and \n.\\\" its documentation for any purpose is hereby granted without fee, provided\n.\\\" that (i) the above copyright notices and this permission notice appear in\n.\\\" all copies of the software and related documentation, and (ii) the names of\n.\\\" Sam Leffler and Silicon Graphics may not be used in any advertising or\n.\\\" publicity relating to the software without the specific, prior written\n.\\\" permission of Sam Leffler and Silicon Graphics.\n.\\\" \n.\\\" THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n.\\\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n.\\\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n.\\\" \n.\\\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n.\\\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n.\\\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n.\\\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n.\\\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n.\\\" OF THIS SOFTWARE.\n.\\\"\n.if n .po 0\n.TH INTRO 3TIFF \"November 2, 2005\" \"libtiff\"\n.SH NAME\nlibtiff \\- introduction to\n.IR libtiff ,\na library for reading and writing\n.SM TIFF\nfiles\n.SH SYNOPSIS\n.B \"#include <tiffio.h>\"\n.sp\ncc file.c\n.B -ltiff\n.SH DESCRIPTION\n.I libtiff\nis a library for reading and writing data files encoded with the\n.I \"Tag Image File\"\nformat, Revision 6.0 (or revision 5.0 or revision 4.0). This file format is\nsuitable for archiving multi-color and monochromatic image data.\n.PP\nThe library supports several compression algorithms, as indicated by the\n.I Compression\nfield, including:\nno compression (1),\n.SM CCITT\n1D Huffman compression (2),\n.SM CCITT\nGroup 3 Facsimile compression (3),\n.SM CCITT\nGroup 4 Facsimile compression (4),\nLempel-Ziv & Welch compression (5),\nbaseline JPEG compression (7),\nword-aligned 1D Huffman compression (32771),\nand\nPackBits compression (32773).\nIn addition, several nonstandard compression algorithms are supported: the\n4-bit compression algorithm used by the\n.I ThunderScan\nprogram (32809) (decompression only), NeXT's 2-bit compression algorithm\n(32766) (decompression only), an experimental LZ-style algorithm known as\nDeflate (32946), and an experimental CIE LogLuv compression scheme designed\nfor images with high dynamic range (32845 for LogL and 32845 for LogLuv).\nDirectory information may be in either little- or big-endian byte order\\-byte\nswapping is automatically done by the library. Data bit ordering may be either\nMost Significant Bit (\\c\n.SM MSB\\c\n) to Least Significant Bit (\\c\n.SM LSB\\c\n) or\n.SM LSB\nto\n.SM MSB.\nFinally, the library does not support files in which the\n.IR BitsPerSample ,\n.IR Compression ,\n.IR MinSampleValue ,\nor\n.IR MaxSampleValue\nfields are defined differently on a per-sample basis\n(in Rev. 6.0 the\n.I Compression\ntag is not defined on a per-sample basis, so this is immaterial).\n.SH \"DATA TYPES\"\nThe library makes extensive use of C typedefs to promote portability.\nTwo sets of typedefs are used, one for communication with clients\nof the library and one for internal data structures and parsing of the\n.SM TIFF\nformat.\nThe following typedefs are exposed to users either through function\ndefinitions or through parameters passed through the varargs interfaces.\n.in +.5i\n.sp 5p\n.ta +\\w'typedef unsigned <\\fIthing\\fP> uint32;    'u\n.nf\ntypedef unsigned short uint16;\t16-bit unsigned integer\ntypedef unsigned <\\fIthing\\fP> uint32;\t32-bit unsigned integer\n.sp 5p\ntypedef unsigned int ttag_t;\tdirectory tag\ntypedef uint16 tdir_t;\tdirectory index\ntypedef uint16 tsample_t;\tsample number\ntypedef uint32 tstrip_t;\tstrip number\ntypedef uint32 ttile_t;\ttile number\ntypedef int32 tsize_t;\ti/o size in bytes\ntypedef void* tdata_t;\timage data ref\ntypedef void* thandle_t;\tclient data handle\ntypedef int32 toff_t;\tfile offset\n.fi\n.sp 5p\n.in -.5i\nNote that\n.IR tstrip_t ,\n.IR ttile_t ,\nand\n.I tsize_t\nare constrained to be no more than 32-bit quantities by 32-bit fields they are\nstored in in the\n.SM TIFF\nimage.\nLikewise\n.I tsample_t\nis limited by the 16-bit field used to store the\n.I SamplesPerPixel\ntag.\n.I tdir_t\nconstrains the maximum number of\n.SM IFDs\nthat may appear in an image and may be an arbitrary size (w/o penalty). \n.I ttag_t\nmust be either int, unsigned int, pointer, or double because the library uses\na varargs interface and\n.SM \"ANSI C\"\nrestricts the type of the parameter before an ellipsis to be a promoted type.\n.I toff_t\nis defined as int32 because TIFF file offsets are (unsigned) 32-bit\nquantities. A signed value is used because some interfaces return \\-1 on\nerror. Finally, note that user-specified data references are passed as opaque\nhandles and only cast at the lowest layers where their type is presumed.\n.SH \"LIST OF ROUTINES\"\nThe following routines are part of the library. Consult specific manual pages\nfor details on their operation; on most systems doing ``man function-name''\nwill work.\n.sp\n.nf\n.ta \\w'TIFFCheckpointDirectory'u+2n\n\\fIName\\fP\t\\fIDescription\\fP\n.sp 5p\nTIFFCheckpointDirectory\twrites the current state of the directory\nTIFFCheckTile\t\tvery x,y,z,sample is within image\nTIFFCIELabToRGBInit\tinitialize CIE L*a*b* 1976 to RGB conversion state\nTIFFCIELabToXYZ\t\tperform CIE L*a*b* 1976 to CIE XYZ conversion\nTIFFClientOpen\t\topen a file for reading or writing\nTIFFClose\t\tclose an open file\nTIFFComputeStrip\treturn strip containing y,sample\nTIFFComputeTile\t\treturn tile containing x,y,z,sample\nTIFFCurrentDirectory\treturn index of current directory\nTIFFCurrentRow\t\treturn index of current scanline\nTIFFCurrentStrip\treturn index of current strip\nTIFFCurrentTile\t\treturn index of current tile\nTIFFDataWidth \t\treturn the size of TIFF data types\nTIFFError\t\tlibrary error handler\nTIFFFdOpen\t\topen a file for reading or writing\nTIFFFileName\t\treturn name of open file\nTIFFFileno\t\treturn open file descriptor\nTIFFFindCODEC\t\tfind standard codec for the specific scheme\nTIFFFlush\t\tflush all pending writes\nTIFFFlushData\t\tflush pending data writes\nTIFFGetBitRevTable\treturn bit reversal table\nTIFFGetField\t\treturn tag value in current directory\nTIFFGetFieldDefaulted\treturn tag value in current directory\nTIFFGetMode\t\treturn open file mode\nTIFFGetVersion\t\treturn library version string\nTIFFIsCODECConfigured\tcheck, whether we have working codec\nTIFFIsMSB2LSB\t\treturn true if image data is being returned\n\t\t\twith bit 0 as the most significant bit \nTIFFIsTiled\t\treturn true if image data is tiled\nTIFFIsByteSwapped\treturn true if image data is byte-swapped\nTIFFNumberOfStrips\treturn number of strips in an image\nTIFFNumberOfTiles\treturn number of tiles in an image\nTIFFOpen\t\topen a file for reading or writing\nTIFFPrintDirectory\tprint description of the current directory\nTIFFReadBufferSetup\tspecify i/o buffer for reading\nTIFFReadDirectory\tread the next directory\nTIFFReadEncodedStrip\tread and decode a strip of data\nTIFFReadEncodedTile\tread and decode a tile of data\nTIFFReadRawStrip\tread a raw strip of data\nTIFFReadRawTile\t\tread a raw tile of data\nTIFFReadRGBAImage\tread an image into a fixed format raster\nTIFFReadScanline\tread and decode a row of data\nTIFFReadTile\t\tread and decode a tile of data\nTIFFRegisterCODEC\toverride standard codec for the specific scheme\nTIFFReverseBits\t\treverse bits in an array of bytes\nTIFFRGBAImageBegin\tsetup decoder state for TIFFRGBAImageGet\nTIFFRGBAImageEnd\trelease TIFFRGBAImage decoder state\nTIFFRGBAImageGet\tread and decode an image\nTIFFRGBAImageOK\t\tis image readable by TIFFRGBAImageGet\nTIFFScanlineSize\treturn size of a scanline\nTIFFSetDirectory\tset the current directory\nTIFFSetSubDirectory\tset the current directory\nTIFFSetErrorHandler\tset error handler function\nTIFFSetField\t\tset a tag's value in the current directory\nTIFFSetWarningHandler\tset warning handler function\nTIFFStripSize\t\treturns size of a strip\nTIFFRawStripSize\treturns the number of bytes in a raw strip\nTIFFSwabShort\t\tswap bytes of short\nTIFFSwabLong\t\tswap bytes of long\nTIFFSwabArrayOfShort\tswap bytes of an array of shorts\nTIFFSwabArrayOfLong\tswap bytes of an array of longs\nTIFFTileRowSize\t\treturn size of a row in a tile\nTIFFTileSize\t\treturn size of a tile\nTIFFUnRegisterCODEC\tunregisters the codec\nTIFFVGetField\t\treturn tag value in current directory\nTIFFVGetFieldDefaulted\treturn tag value in current directory\nTIFFVSetField\t\tset a tag's value in the current directory\nTIFFVStripSize\t\treturns the number of bytes in a strip\nTIFFWarning\t\tlibrary warning handler\nTIFFWriteDirectory\twrite the current directory\nTIFFWriteEncodedStrip\tcompress and write a strip of data\nTIFFWriteEncodedTile\tcompress and write a tile of data\nTIFFWriteRawStrip\twrite a raw strip of data\nTIFFWriteRawTile\twrite a raw tile of data\nTIFFWriteScanline\twrite a scanline of data\nTIFFWriteTile\t\tcompress and write a tile of data\nTIFFXYZToRGB\t\tperform CIE XYZ to RGB conversion\nTIFFYCbCrToRGBInit\tinitialize YCbCr to RGB conversion state\nTIFFYCbCrtoRGB\t\tperform YCbCr to RGB conversion\n.sp\nAuxiliary functions:\n_TIFFfree\t\tfree memory buffer\n_TIFFmalloc\t\tdynamically allocate memory buffer\n_TIFFmemcmp\t\tcompare contents of the memory buffers\n_TIFFmemcpy\t\tcopy contents of the one buffer to another\n_TIFFmemset\t\tfill memory buffer with a constant byte\n_TIFFrealloc\t\tdynamically reallocate memory buffer\n\n.fi\n.SH \"TAG USAGE\"\nThe table below lists the\n.SM TIFF\ntags that are recognized and handled by the library.\nIf no use is indicated in the table, then the library\nreads and writes the tag, but does not use it internally.\nNote that some tags are meaningful only when a particular\ncompression scheme is being used; e.g.\n.I Group3Options\nis only useful if \n.I Compression\nis set to\n.SM CCITT\nGroup 3 encoding.\nTags of this sort are considered\n.I codec-specific\ntags and the library does not recognize them except when the\n.I Compression\ntag has been previously set to the relevant compression scheme.\n.sp\n.nf\n.ta \\w'TIFFTAG_JPEGTABLESMODE'u+2n +\\w'Value'u+2n +\\w'R/W'u+2n\n\\fITag Name\\fP\t\\fIValue\\fP\t\\fIR/W\\fP\t\\fILibrary Use/Notes\\fP\n.sp 5p\n.nf\nArtist\t315\tR/W\nBadFaxLines\t326\tR/W\nBitsPerSample\t258\tR/W\tlots\nCellLength\t265\t\tparsed but ignored\nCellWidth\t264\t\tparsed but ignored\nCleanFaxData\t327\tR/W\nColorMap\t320\tR/W\nColorResponseUnit\t300\t\tparsed but ignored\nCompression\t259\tR/W\tchoosing codec\nConsecutiveBadFaxLines\t328\tR/W\nCopyright       33432   R/W\nDataType\t32996\tR\tobsoleted by SampleFormat tag\nDateTime\t306\tR/W\nDocumentName\t269\tR/W\nDotRange\t336\tR/W\nExtraSamples\t338\tR/W\tlots\nFaxRecvParams\t34908\tR/W\nFaxSubAddress\t34909\tR/W\nFaxRecvTime\t34910\tR/W\nFillOrder\t266\tR/W\tcontrol bit order\nFreeByteCounts\t289\t\tparsed but ignored\nFreeOffsets\t288\t\tparsed but ignored\nGrayResponseCurve\t291\t\tparsed but ignored\nGrayResponseUnit\t290\t\tparsed but ignored\nGroup3Options\t292\tR/W\tused by Group 3 codec\nGroup4Options\t293\tR/W\nHostComputer\t316\tR/W\nImageDepth\t32997\tR/W\ttile/strip calculations\nImageDescription \t270\tR/W\nImageLength\t257\tR/W\tlots\nImageWidth\t256\tR/W\tlots\nInkNames\t333\tR/W\nInkSet\t332\tR/W\nJPEGTables\t347\tR/W\tused by JPEG codec\nMake\t271\tR/W\nMatteing\t32995\tR\tobsoleted by ExtraSamples tag\nMaxSampleValue\t281\tR/W\nMinSampleValue\t280\tR/W\nModel\t272\tR/W\nNewSubFileType\t254\tR/W\tcalled SubFileType in spec\nNumberOfInks\t334\tR/W\nOrientation\t274\tR/W\nPageName\t285\tR/W\nPageNumber\t297\tR/W\nPhotometricInterpretation\t262\tR/W\tused by Group 3 and JPEG codecs\nPlanarConfiguration\t284\tR/W\tdata i/o\nPredictor\t317\tR/W\tused by LZW and Deflate codecs\nPrimaryChromacities\t319\tR/W\nReferenceBlackWhite\t532\tR/W\nResolutionUnit\t296\tR/W\tused by Group 3 codec\nRowsPerStrip\t278\tR/W\tdata i/o\nSampleFormat\t339\tR/W\nSamplesPerPixel\t277\tR/W\tlots\nSMinSampleValue\t340\tR/W\nSMaxSampleValue\t341\tR/W\nSoftware\t305\tR/W\nStoNits\t37439\tR/W\nStripByteCounts\t279\tR/W\tdata i/o\nStripOffsets\t273\tR/W\tdata i/o\nSubFileType\t255\tR/W\tcalled OSubFileType in spec\nTargetPrinter\t337\tR/W\nThresholding\t263\tR/W\t\nTileByteCounts\t324\tR/W\tdata i/o\nTileDepth\t32998\tR/W\ttile/strip calculations\nTileLength\t323\tR/W\tdata i/o\nTileOffsets\t324\tR/W\tdata i/o\nTileWidth\t322\tR/W\tdata i/o\nTransferFunction\t301\tR/W\nWhitePoint\t318\tR/W\nXPosition\t286\tR/W\nXResolution\t282\tR/W\nYCbCrCoefficients\t529\tR/W\tused by TIFFRGBAImage support\nYCbCrPositioning\t531\tR/W\ttile/strip size calulcations\nYCbCrSubsampling\t530\tR/W\nYPosition\t286\tR/W\nYResolution\t283\tR/W\tused by Group 3 codec\n.SH \"PSEUDO TAGS\"\nIn addition to the normal\n.SM TIFF\ntags the library supports a collection of \ntags whose values lie in a range outside the valid range of \n.SM TIFF\ntags.\nThese tags are termed\n.I pseud-tags\nand are used to control various codec-specific functions within the library.\nThe table below summarizes the defined pseudo-tags.\n.sp\n.nf\n.ta \\w'TIFFTAG_JPEGTABLESMODE'u+2n +\\w'Codec'u+2n +\\w'R/W'u+2n\n\\fITag Name\\fP\t\\fICodec\\fP\t\\fIR/W\\fP\t\\fILibrary Use/Notes\\fP\n.sp 5p\n.nf\nTIFFTAG_FAXMODE\tG3\tR/W\tgeneral codec operation\nTIFFTAG_FAXFILLFUNC\tG3/G4\tR/W\tbitmap fill function\nTIFFTAG_JPEGQUALITY\tJPEG\tR/W\tcompression quality control\nTIFFTAG_JPEGCOLORMODE\tJPEG\tR/W\tcontrol colorspace conversions\nTIFFTAG_JPEGTABLESMODE\tJPEG\tR/W\tcontrol contents of \\fIJPEGTables\\fP tag\nTIFFTAG_ZIPQUALITY\tDeflate\tR/W\tcompression quality level\nTIFFTAG_PIXARLOGDATAFMT\tPixarLog\tR/W\tuser data format\nTIFFTAG_PIXARLOGQUALITY\tPixarLog\tR/W\tcompression quality level\nTIFFTAG_SGILOGDATAFMT\tSGILog\tR/W\tuser data format\n.fi\n.TP\n.B TIFFTAG_FAXMODE\nControl the operation of the Group 3 codec.\nPossible values (independent bits that can be combined by\nor'ing them together) are:\nFAXMODE_CLASSIC\n(enable old-style format in which the\n.SM RTC\nis written at the end of the last strip),\nFAXMODE_NORTC\n(opposite of \nFAXMODE_CLASSIC;\nalso called\nFAXMODE_CLASSF),\nFAXMODE_NOEOL\n(do not write \n.SM EOL\ncodes at the start of each row of data),\nFAXMODE_BYTEALIGN\n(align each encoded row to an 8-bit boundary),\nFAXMODE_WORDALIGN\n(align each encoded row to an 16-bit boundary),\nThe default value is dependent on the compression scheme; this\npseudo-tag is used by the various G3 and G4 codecs to share code.\n.TP\n.B TIFFTAG_FAXFILLFUNC\nControl the function used to convert arrays of black and white\nruns to packed bit arrays.\nThis hook can be used to image decoded scanlines in multi-bit\ndepth rasters (e.g. for display in colormap mode)\nor for other purposes.\nThe default value is a pointer to a builtin function that images\npacked bilevel data.\n.TP\n.B TIFFTAG_IPTCNEWSPHOTO\nTag contaings image metadata per the IPTC newsphoto spec: Headline, \ncaptioning, credit, etc... Used by most wire services. \n.TP\n.B TIFFTAG_PHOTOSHOP\nTag contains Photoshop captioning information and metadata. Photoshop \nuses in parallel and redundantly alongside IPTCNEWSPHOTO information. \n.TP\n.B TIFFTAG_JPEGQUALITY\nControl the compression quality level used in the baseline algorithm.\nNote that quality levels are in the range 0-100 with a default value of 75.\n.TP\n.B TIFFTAG_JPEGCOLORMODE\nControl whether or not conversion is done between\nRGB and YCbCr colorspaces.\nPossible values are:\nJPEGCOLORMODE_RAW\n(do not convert), and\nJPEGCOLORMODE_RGB\n(convert to/from RGB)\nThe default value is JPEGCOLORMODE_RAW.\n.TP\n.B TIFFTAG_JPEGTABLESMODE\nControl the information written in the \n.I JPEGTables\ntag.\nPossible values (independent bits that can be combined by\nor'ing them together) are:\nJPEGTABLESMODE_QUANT\n(include quantization tables),\nand\nJPEGTABLESMODE_HUFF\n(include Huffman encoding tables).\nThe default value is JPEGTABLESMODE_QUANT|JPEGTABLESMODE_HUFF.\n.TP\n.B TIFFTAG_ZIPQUALITY\nControl the compression technique used by the Deflate codec.\nQuality levels are in the range 1-9 with larger numbers yielding better\ncompression at the cost of more computation.\nThe default quality level is 6 which yields a good time-space tradeoff.\n.TP\n.B TIFFTAG_PIXARLOGDATAFMT\nControl the format of user data passed\n.I in\nto the PixarLog codec when encoding and passed\n.I out\nfrom when decoding.\nPossible values are:\nPIXARLOGDATAFMT_8BIT\nfor 8-bit unsigned pixels,\nPIXARLOGDATAFMT_8BITABGR\nfor 8-bit unsigned ABGR-ordered pixels,\nPIXARLOGDATAFMT_11BITLOG\nfor 11-bit log-encoded raw data,\nPIXARLOGDATAFMT_12BITPICIO\nfor 12-bit PICIO-compatible data,\nPIXARLOGDATAFMT_16BIT\nfor 16-bit signed samples,\nand\nPIXARLOGDATAFMT_FLOAT\nfor 32-bit IEEE floating point samples.\n.TP\n.B TIFFTAG_PIXARLOGQUALITY\nControl the compression technique used by the PixarLog codec.\nThis value is treated identically to TIFFTAG_ZIPQUALITY; see the\nabove description.\n.TP\n.B TIFFTAG_SGILOGDATAFMT\nControl the format of client data passed \n.I in\nto the SGILog codec when encoding and passed\n.I out\nfrom when decoding.\nPossible values are:\nSGILOGDATAFMT_FLTXYZ\nfor converting between LogLuv and 32-bit IEEE floating valued XYZ pixels,\nSGILOGDATAFMT_16BITLUV\nfor 16-bit encoded Luv pixels,\nSGILOGDATAFMT_32BITRAW and SGILOGDATAFMT_24BITRAW\nfor no conversion of data,\nSGILOGDATAFMT_8BITRGB\nfor returning 8-bit RGB data (valid only when decoding LogLuv-encoded data),\nSGILOGDATAFMT_FLTY\nfor converting between LogL and 32-bit IEEE floating valued Y pixels,\nSGILOGDATAFMT_16BITL\nfor 16-bit encoded L pixels,\nand\nSGILOGDATAFMT_8BITGRY\nfor returning 8-bit greyscale data\n(valid only when decoding LogL-encoded data).\n.SH DIAGNOSTICS\nAll error messages are directed through the\n.IR TIFFError\nroutine.\nBy default messages are directed to\n.B stderr\nin the form:\n.IR \"module: message\\en.\"\nWarning messages are likewise directed through the\n.IR TIFFWarning\nroutine.\n.SH \"SEE ALSO\"\n.BR fax2tiff (1),\n.BR gif2tiff (1),\n.BR pal2rgb (1),\n.BR ppm2tiff (1),\n.BR rgb2ycbcr (1),\n.BR ras2tiff (1),\n.BR raw2tiff (1),\n.BR sgi2tiff (1),\n.BR tiff2bw (1),\n.BR tiffdither (1),\n.BR tiffdump (1),\n.BR tiffcp (1),\n.BR tiffcmp (1),\n.BR tiffgt (1),\n.BR tiffinfo (1),\n.BR tiffmedian (1),\n.BR tiffsplit (1),\n.BR tiffsv (1).\n.PP\n.BR \"Tag Image File Format Specification \\(em Revision 6.0\" ,\nan Aldus Technical Memorandum.\n.PP\n.BR \"The Spirit of TIFF Class F\" ,\nan appendix to the TIFF 5.0 specification prepared by Cygnet Technologies.\n.PP\nLibtiff library home page:\n.BR http://www.remotesensing.org/libtiff/\n.SH BUGS\nThe library does not support multi-sample images\nwhere some samples have different bits/sample.\n.PP\nThe library does not support random access to compressed data\nthat is organized with more than one row per tile or strip.\n"
  },
  {
    "path": "src/main/jni/tiff/man/pal2rgb.1",
    "content": ".\\\" $Id: pal2rgb.1,v 1.3 2005/11/02 11:07:19 dron Exp $\n.\\\"\n.\\\" Copyright (c) 1990-1997 Sam Leffler\n.\\\" Copyright (c) 1991-1997 Silicon Graphics, Inc.\n.\\\"\n.\\\" Permission to use, copy, modify, distribute, and sell this software and \n.\\\" its documentation for any purpose is hereby granted without fee, provided\n.\\\" that (i) the above copyright notices and this permission notice appear in\n.\\\" all copies of the software and related documentation, and (ii) the names of\n.\\\" Sam Leffler and Silicon Graphics may not be used in any advertising or\n.\\\" publicity relating to the software without the specific, prior written\n.\\\" permission of Sam Leffler and Silicon Graphics.\n.\\\" \n.\\\" THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n.\\\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n.\\\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n.\\\" \n.\\\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n.\\\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n.\\\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n.\\\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n.\\\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n.\\\" OF THIS SOFTWARE.\n.\\\"\n.if n .po 0\n.TH PAL2RGB 1 \"September 20, 2005\" \"libtiff\"\n.SH NAME\npal2rgb \\- convert a palette color\n.SM TIFF\nimage to a full color image\n.SH SYNOPSIS\n.B pal2rgb\n[\n.I options\n]\n.I input.tif\n.I output.tif\n.SH DESCRIPTION\n.I Pal2rgb\nconverts a palette color\n.SM TIFF\nimage to a full color image by\napplying the colormap of the palette image to each sample\nto generate a full color\n.SM RGB\nimage.\n.SH OPTIONS\nOptions that affect the interpretation of input data are:\n.TP\n.B \\-C\nThis option overrides the default behavior of\n.I pal2rgb\nin determining whether or not\ncolormap entries contain 16-bit or 8-bit values.\nBy default the colormap is inspected and\nif no colormap entry greater than 255 is found,\nthe colormap is assumed to have only 8-bit values; otherwise\n16-bit values (as required by the\n.SM TIFF\nspecification) are assumed.\nThe\n.B \\-C\noption can be used to explicitly specify the number of\nbits for colormap entries:\n.B \"\\-C 8\"\nfor 8-bit values, \n.B \"\\-C 16\"\nfor 16-bit values.\n.PP\nOptions that affect the output file format are:\n.TP\n.B \\-p\nExplicitly select the planar configuration used in organizing\ndata samples in the output image:\n.B \"\\-p contig\"\nfor samples packed contiguously, and\n.B \"\\-p separate\"\nfor samples stored separately.\nBy default samples are packed.\n.TP\n.B \\-c\nUse the specific compression algorithm to encoded image data\nin the output file:\n.B \"\\-c packbits\"\nfor Macintosh Packbits,\n.B \"\\-c lzw\"\nfor Lempel-Ziv & Welch,\n.B \"\\-c zip\"\nfor Deflate,\n.B \"\\-c none\"\nfor no compression.\nIf no compression-related option is specified, the input\nfile's compression algorithm is used.\n.TP\n.B \\-r\nExplicitly specify the number of rows in each strip of the\noutput file.\nIf the\n.B \\-r\noption is not specified, a number is selected such that each\noutput strip has approximately 8 kilobytes of data in it.\n.SH BUGS\nOnly 8-bit images are handled.\n.SH \"SEE ALSO\"\n.BR tiffinfo (1),\n.BR tiffcp (1),\n.BR tiffmedian (1),\n.BR libtiff (3)\n.PP\nLibtiff library home page:\n.BR http://www.remotesensing.org/libtiff/\n"
  },
  {
    "path": "src/main/jni/tiff/man/ppm2tiff.1",
    "content": ".\\\" $Id: ppm2tiff.1,v 1.5 2006/03/01 11:20:33 dron Exp $\n.\\\"\n.\\\" Copyright (c) 1991-1997 Sam Leffler\n.\\\" Copyright (c) 1991-1997 Silicon Graphics, Inc.\n.\\\"\n.\\\" Permission to use, copy, modify, distribute, and sell this software and \n.\\\" its documentation for any purpose is hereby granted without fee, provided\n.\\\" that (i) the above copyright notices and this permission notice appear in\n.\\\" all copies of the software and related documentation, and (ii) the names of\n.\\\" Sam Leffler and Silicon Graphics may not be used in any advertising or\n.\\\" publicity relating to the software without the specific, prior written\n.\\\" permission of Sam Leffler and Silicon Graphics.\n.\\\" \n.\\\" THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n.\\\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n.\\\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n.\\\" \n.\\\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n.\\\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n.\\\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n.\\\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n.\\\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n.\\\" OF THIS SOFTWARE.\n.\\\"\n.if n .po 0\n.TH PPM2TIFF 1 \"March 1, 2006\" \"libtiff\"\n.SH NAME\nppm2tiff \\- create a\n.SM TIFF\nfile from \n.SM PPM, PGM\nand\n.SM PBM\nimage files\n.SH SYNOPSIS\n.B ppm2tiff\n[\n.I options\n] [\n.I input.ppm\n]\n.I output.tif\n.SH DESCRIPTION\n.I ppm2tiff\nconverts a file in the \n.SM PPM, PGM\nand\n.SM PBM\nimage formats to\n.SM TIFF.\nBy default, the\n.SM TIFF\nimage is created with data samples packed (\\c\n.IR PlanarConfiguration =1),\ncompressed with the Packbits algorithm (\\c\n.IR Compression =32773),\nand with each strip no more than 8 kilobytes. These characteristics can be\noverridden, or explicitly specified with the options described below\n.PP\nIf the\n.SM PPM\nfile contains greyscale data, then the\n.I PhotometricInterpretation\ntag is set to 1 (min-is-black), otherwise it is set to 2 (RGB).\n.PP\nIf no\n.SM PPM\nfile is specified on the command line,\n.I ppm2tiff\nwill read from the standard input.\n.SH OPTIONS\n.TP\n.B \\-c\nSpecify a compression scheme to use when writing image data:\n.B none \nfor no compression,\n.B packbits\nfor PackBits compression (will be used by default),\n.B lzw\nfor Lempel-Ziv & Welch compression,\n.B jpeg\nfor baseline JPEG compression,\n.B zip\nfor Deflate compression,\n.B g3\nfor CCITT Group 3 (T.4) compression,\nand\n.B g4\nfor CCITT Group 4 (T.6) compression.\n.TP\n.B \\-r\nWrite data with a specified number of rows per strip; by default the number of\nrows/strip is selected so that each strip is approximately 8 kilobytes.\n.TP\n.B \\-R\nMark the resultant image to have the specified X and Y resolution (in\ndots/inch).\n.SH \"SEE ALSO\"\n.BR tiffinfo (1),\n.BR tiffcp (1),\n.BR tiffmedian (1),\n.BR libtiff (3)\n.PP\nLibtiff library home page:\n.BR http://www.remotesensing.org/libtiff/\n"
  },
  {
    "path": "src/main/jni/tiff/man/ras2tiff.1",
    "content": ".\\\" $Id: ras2tiff.1,v 1.4 2006/04/20 12:17:19 dron Exp $\n.\\\"\n.\\\" Copyright (c) 1990-1997 Sam Leffler\n.\\\" Copyright (c) 1991-1997 Silicon Graphics, Inc.\n.\\\"\n.\\\" Permission to use, copy, modify, distribute, and sell this software and \n.\\\" its documentation for any purpose is hereby granted without fee, provided\n.\\\" that (i) the above copyright notices and this permission notice appear in\n.\\\" all copies of the software and related documentation, and (ii) the names of\n.\\\" Sam Leffler and Silicon Graphics may not be used in any advertising or\n.\\\" publicity relating to the software without the specific, prior written\n.\\\" permission of Sam Leffler and Silicon Graphics.\n.\\\" \n.\\\" THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n.\\\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n.\\\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n.\\\" \n.\\\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n.\\\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n.\\\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n.\\\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n.\\\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n.\\\" OF THIS SOFTWARE.\n.\\\"\n.if n .po 0\n.TH RAS2TIFF 1 \"November 2, 2005\" \"libtiff\"\n.SH NAME\nras2tiff \\- create a\n.SM TIFF\nfile from a Sun rasterfile\n.SH SYNOPSIS\n.B ras2tiff\n[\n.I options\n]\n.I input.ras\n.I output.tif\n.SH DESCRIPTION\n.I ras2tiff\nconverts a file in the Sun rasterfile format to\n.SM TIFF.\nBy default, the\n.SM TIFF\nimage is created with data samples packed (\\c\n.IR PlanarConfiguration =1),\ncompressed with the Lempel-Ziv & Welch algorithm (\\c\n.IR Compression =5),\nand with each strip no more than 8 kilobytes.\nThese characteristics can overridden, or explicitly specified\nwith the options described below.\n.PP\nAny colormap information in the rasterfile is carried over to the\n.SM TIFF\nfile by including a\n.I Colormap\ntag in the output file.\nIf the rasterfile has a colormap, the\n.I PhotometricInterpretation\ntag is set to 3 (palette);\notherwise it is set to 2 (RGB) if the depth\nis 24 or 1 (min-is-black) if the depth is not 24.\n.SH OPTIONS\n.TP\n.B \\-c\nSpecify a compression scheme to use when writing image data:\n.B \"\\-c none\"\nfor no compression,\n.B \"\\-c packbits\"\nfor the PackBits compression algorithm,\n.B \"\\-c jpeg\"\nfor the baseline JPEG compression algorithm,\n.B \"\\-c zip\nfor the Deflate compression algorithm,\nand\n.B \"\\-c lzw\"\nfor Lempel-Ziv & Welch (the default).\n.TP\n.B \\-r\nWrite data with a specified number of rows per strip;\nby default the number of rows/strip is selected so that each strip\nis approximately 8 kilobytes.\n.SH BUGS\nDoes not handle all possible rasterfiles.\nIn particular, \n.I ras2tiff\ndoes not handle run-length encoded images.\n.SH \"SEE ALSO\"\n.BR pal2rgb (1),\n.BR tiffinfo (1),\n.BR tiffcp (1),\n.BR tiffmedian (1),\n.BR libtiff (3)\n.PP\nLibtiff library home page:\n.BR http://www.remotesensing.org/libtiff/\n\n"
  },
  {
    "path": "src/main/jni/tiff/man/raw2tiff.1",
    "content": ".\\\" $Id: raw2tiff.1,v 1.6 2006/04/20 12:17:19 dron Exp $\n.\\\"\n.\\\" Copyright (c) 1990-1997 Sam Leffler\n.\\\" Copyright (c) 1991-1997 Silicon Graphics, Inc.\n.\\\"\n.\\\" Permission to use, copy, modify, distribute, and sell this software and \n.\\\" its documentation for any purpose is hereby granted without fee, provided\n.\\\" that (i) the above copyright notices and this permission notice appear in\n.\\\" all copies of the software and related documentation, and (ii) the names of\n.\\\" Sam Leffler and Silicon Graphics may not be used in any advertising or\n.\\\" publicity relating to the software without the specific, prior written\n.\\\" permission of Sam Leffler and Silicon Graphics.\n.\\\" \n.\\\" THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n.\\\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n.\\\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n.\\\" \n.\\\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n.\\\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n.\\\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n.\\\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n.\\\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n.\\\" OF THIS SOFTWARE.\n.\\\"\n.if n .po 0\n.TH RAW2TIFF 1 \"November 2, 2005\" \"libtiff\"\n.SH NAME\nraw2tiff \\- create a\n.SM TIFF\nfile from a raw data\n.SH SYNOPSIS\n.B raw2tiff\n[\n.I options\n]\n.I input.raw\n.I output.tif\n.SH DESCRIPTION\n.I raw2tiff\nconverts a raw byte sequence into\n.SM TIFF.\nBy default, the\n.SM TIFF\nimage is created with data samples packed (\\c\n.IR PlanarConfiguration =1),\ncompressed with the PackBits algorithm (\\c\n.IR Compression =32773),\nand with each strip no more than 8 kilobytes.\nThese characteristics can overridden, or explicitly specified\nwith the options described below.\n.SH OPTIONS\n.TP\n.BI \\-H \" number\"\nsize of input image file header in bytes (0 by default). This amount of data\njust will be skipped from the start of file while reading.\n.TP\n.BI \\-w \" number\"\nwidth of input image in pixels (can be guessed, see\n.SM\n.B \"GUESSING THE IMAGE GEOMETRY\"\nbelow).\n.TP\n.BI \\-l \" number\"\nlength of input image in lines (can be guessed, see\n.SM\n.B \"GUESSING THE IMAGE GEOMETRY\"\nbelow).\n.TP\n.BI \\-b \" number\"\nnumber of bands in input image (1 by default).\n.TP\n.BI \\-d \" data_type\"\ntype of samples in input image, where\n.I data_type\nmay be:\n.ta \\w'\\fBdouble  \\fR'u\n.br\n.B byte\\t\n8-bit unsigned integer (default),\n.br\n.B short\\t\n16-bit unsigned integer,\n.br\n.B long\\t\n32-bit unsigned integer,\n.br\n.B sbyte\\t\n8-bit signed integer,\n.br\n.B sshort\\t\n16-bit signed integer,\n.br\n.B slong\\t\n32-bit signed integer,\n.br\n.B float\\t\n32-bit IEEE floating point,\n.br\n.B double\\t\n64-bit IEEE floating point.\n.TP\n.BI \\-i \" config\"\ntype of samples interleaving in input image, where\n.I config\nmay be:\n.ta \\w'\\fBpixel  \\fR'u\n.br\n.B pixel\\t\npixel interleaved data (default),\n.br\n.B band\\t\nband interleaved data.\n.TP\n.BI \\-p \" photo\"\nphotometric interpretation (color space) of the input image, where\n.I photo\nmay be:\n.ta \\w'\\fBminiswhite  \\fR'u\n.br\n.B miniswhite\\t\nwhite color represented with 0 value,\n.br\n.B minisblack\\t\nblack color represented with 0 value (default),\n.br\n.B rgb\\t\nimage has RGB color model,\n.br\n.B cmyk\\t\nimage has CMYK (separated) color model,\n.br\n.B ycbcr\\t\nimage has YCbCr color model,\n.br\n.B cielab\\t\nimage has CIE L*a*b color model,\n.br\n.B icclab\\t\nimage has ICC L*a*b color model,\n.br\n.B itulab\\t\nimage has ITU L*a*b color model.\n.TP\n.B \\-s\nswap bytes fetched from the input file.\n.TP\n.B \\-L\ninput data has LSB2MSB bit order (default).\n.TP\n.B \\-M\ninput data has MSB2LSB bit order.\n.TP\n.B \\-c\nSpecify a compression scheme to use when writing image data:\n.B \"\\-c none\"\nfor no compression,\n.B \"\\-c packbits\"\nfor the PackBits compression algorithm (the default),\n.B \"\\-c jpeg\"\nfor the baseline JPEG compression algorithm,\n.B \"\\-c zip\"\nfor the Deflate compression algorithm,\nand\n.B \"\\-c lzw\"\nfor Lempel-Ziv & Welch.\n.TP\n.BI \\-r \" number\"\nWrite data with a specified number of rows per strip;\nby default the number of rows/strip is selected so that each strip\nis approximately 8 kilobytes.\n.SH GUESSING THE IMAGE GEOMETRY\n.I raw2tiff\ncan guess image width and height in case one or both of these parameters are\nnot specified. If you omit one of those parameters, the complementary one will\nbe calculated based on the file size (taking into account header size, number\nof bands and data type). If you omit both parameters, the statistical approach\nwill be used. Utility will compute correlation coefficient between two lines\nat the image center using several appropriate line sizes and the highest\nabsolute value of the coefficient will indicate the right line size. That is\nwhy you should be cautious with the very large images, because guessing\nprocess may take a while (depending on your system performance). Of course, the\nutility can't guess the header size, number of bands and data type, so it\nshould be specified manually. If you don't know anything about your image,\njust try with the several combinations of those options.\n.P\nThere is no magic, it is just a mathematical statistics, so it can be wrong\nin some cases. But for most ordinary images guessing method will work fine.\n.SH \"SEE ALSO\"\n.BR pal2rgb (1),\n.bR tiffinfo (1),\n.BR tiffcp (1),\n.BR tiffmedian (1),\n.BR libtiff (3)\n.PP\nLibtiff library home page:\n.BR http://www.remotesensing.org/libtiff/\n"
  },
  {
    "path": "src/main/jni/tiff/man/rgb2ycbcr.1",
    "content": ".\\\"\t$Header: /cvs/maptools/cvsroot/libtiff/man/rgb2ycbcr.1,v 1.4 2006/04/20 12:17:19 dron Exp $\n.\\\"\n.\\\" Copyright (c) 1991-1997 Sam Leffler\n.\\\" Copyright (c) 1991-1997 Silicon Graphics, Inc.\n.\\\"\n.\\\" Permission to use, copy, modify, distribute, and sell this software and \n.\\\" its documentation for any purpose is hereby granted without fee, provided\n.\\\" that (i) the above copyright notices and this permission notice appear in\n.\\\" all copies of the software and related documentation, and (ii) the names of\n.\\\" Sam Leffler and Silicon Graphics may not be used in any advertising or\n.\\\" publicity relating to the software without the specific, prior written\n.\\\" permission of Sam Leffler and Silicon Graphics.\n.\\\" \n.\\\" THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n.\\\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n.\\\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n.\\\" \n.\\\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n.\\\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n.\\\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n.\\\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n.\\\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n.\\\" OF THIS SOFTWARE.\n.\\\"\n.if n .po 0\n.TH RGB2YCBCR 1 \"November 2, 2005\" \"libtiff\"\n.SH NAME\nrgb2ycbcr \\- convert non-YCbCr\n.SM TIFF\nimages to a YCbCr\n.SM TIFF\nimage\n.SH SYNOPSIS\n.B rgb2ycbcr\n[\n.I options\n]\n.I \"src1.tif src2.tif ... dst.tif\"\n.SH DESCRIPTION\n.I rgb2ycbcr\nconverts\n.SM RGB\ncolor, greyscale, or bi-level\n.SM TIFF\nimages to YCbCr images by transforming and sampling pixel data. If multiple\nfiles are specified on the command line each source file is converted to a\nseparate directory in the destination file.\n.PP\nBy default, chrominance samples are created by sampling\n2 by 2 blocks of luminance values; this can be changed with the\n.B \\-h\nand\n.B \\-v\noptions.\nOutput data are compressed with the\n.SM PackBits\ncompression scheme, by default; an alternate scheme can be selected with the\n.B \\-c\noption.\nBy default, output data are compressed in strips with\nthe number of rows in each strip selected so that the\nsize of a strip is never more than 8 kilobytes;\nthe\n.B \\-r\noption can be used to explicitly set the number of\nrows per strip.\n.SH OPTIONS\n.TP\n.B \\-c\nSpecify a compression scheme to use when writing image data:\n.B \"\\-c none\"\nfor no compression,\n.B \"\\-c packbits\"\nfor the PackBits compression algorithm (the default),\n.B \"\\-c jpeg\"\nfor the JPEG compression algorithm,\n.B \"\\-c zip\"\nfor the deflate compression algorithm,\nand\n.B \"\\-c lzw\"\nfor Lempel-Ziv & Welch.\n.TP\n.B \\-h\nSet the horizontal sampling dimension to one of: 1, 2 (default), or 4.\n.TP\n.B \\-r\nWrite data with a specified number of rows per strip;\nby default the number of rows/strip is selected so that each strip\nis approximately 8 kilobytes.\n.TP\n.B \\-v\nSet the vertical sampling dimension to one of: 1, 2 (default), or 4.\n.SH \"SEE ALSO\"\n.BR tiffinfo (1),\n.BR tiffcp (1),\n.BR libtiff (3)\n.PP\nLibtiff library home page:\n.BR http://www.remotesensing.org/libtiff\n"
  },
  {
    "path": "src/main/jni/tiff/man/sgi2tiff.1",
    "content": ".\\\" $Id: sgi2tiff.1,v 1.4 2006/04/20 12:17:19 dron Exp $\n.\\\"\n.\\\" Copyright (c) 1991-1997 Sam Leffler\n.\\\" Copyright (c) 1991-1997 Silicon Graphics, Inc.\n.\\\"\n.\\\" Permission to use, copy, modify, distribute, and sell this software and \n.\\\" its documentation for any purpose is hereby granted without fee, provided\n.\\\" that (i) the above copyright notices and this permission notice appear in\n.\\\" all copies of the software and related documentation, and (ii) the names of\n.\\\" Sam Leffler and Silicon Graphics may not be used in any advertising or\n.\\\" publicity relating to the software without the specific, prior written\n.\\\" permission of Sam Leffler and Silicon Graphics.\n.\\\" \n.\\\" THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n.\\\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n.\\\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n.\\\" \n.\\\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n.\\\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n.\\\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n.\\\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n.\\\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n.\\\" OF THIS SOFTWARE.\n.\\\"\n.if n .po 0\n.TH SGI2TIFF 1 \"November 2, 2005\" \"libtiff\"\n.SH NAME\nsgi2tiff \\- create a\n.SM TIFF\nfile from an\n.SM SGI\nimage file\n.SH SYNOPSIS\n.B sgi2tiff\n[\n.I options\n]\n.I input.rgb\n.I output.tif\n.SH DESCRIPTION\n.I sgi2tiff\nconverts a file in the \n.SM SGI\nimage format to\n.SM TIFF.\nBy default, the\n.SM TIFF\nimage is created with data samples packed (\\c\n.IR PlanarConfiguration =1),\ncompressed with the Lempel-Ziv & Welch algorithm (\\c\n.IR Compression =5),\nand with each strip no more than 8 kilobytes.\nThese characteristics can overridden, or explicitly specified\nwith the options described below.\n.SH OPTIONS\n.TP\n.B \\-c\nSpecify a compression scheme to use when writing image data:\n.B \"\\-c none\"\nfor no compression,\n.B \"\\-c packbits\"\nfor the PackBits compression algorithm),\n.B \"\\-c jpeg\"\nfor the baseline JPEG compression algorithm,\n.B \"\\-c zip\nfor the Deflate compression algorithm,\nand\n.B \"\\-c lzw\"\nfor Lempel-Ziv & Welch (the default).\n.TP\n.B \\-p\nExplicitly select the planar configuration used in organizing\ndata samples in the output image:\n.B \"\\-p contig\"\nfor samples packed contiguously, and\n.B \"\\-p separate\"\nfor samples stored separately.\nBy default samples are packed.\n.TP\n.B \\-r\nWrite data with a specified number of rows per strip;\nby default the number of rows/strip is selected so that each strip\nis approximately 8 kilobytes.\n.SH BUGS\nDoes not record colormap information.\n.SH \"SEE ALSO\"\n.BR tiffinfo (1),\n.BR tiffcp (1),\n.BR tiffmedian (1),\n.BR libtiff (3)\n.PP\nLibtiff library home page:\n.BR http://www.remotesensing.org/libtiff/\n"
  },
  {
    "path": "src/main/jni/tiff/man/thumbnail.1",
    "content": ".\\\"\t$Id: thumbnail.1,v 1.2 2005/11/02 11:07:19 dron Exp $\n.\\\"\n.\\\" Copyright (c) 1994-1997 Sam Leffler\n.\\\" Copyright (c) 1994-1997 Silicon Graphics, Inc.\n.\\\"\n.\\\" Permission to use, copy, modify, distribute, and sell this software and \n.\\\" its documentation for any purpose is hereby granted without fee, provided\n.\\\" that (i) the above copyright notices and this permission notice appear in\n.\\\" all copies of the software and related documentation, and (ii) the names of\n.\\\" Sam Leffler and Silicon Graphics may not be used in any advertising or\n.\\\" publicity relating to the software without the specific, prior written\n.\\\" permission of Sam Leffler and Silicon Graphics.\n.\\\" \n.\\\" THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n.\\\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n.\\\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n.\\\" \n.\\\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n.\\\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n.\\\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n.\\\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n.\\\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n.\\\" OF THIS SOFTWARE.\n.\\\"\n.if n .po 0\n.TH THUMBNAIL 1 \"November 2, 2005\" \"libtiff\"\n.SH NAME\nthumbnail \\- create a\n.SM TIFF\nfile with thumbnail images\n.SH SYNOPSIS\n.B thumbnail\n[\n.I options\n]\n.I input.tif\n.I output.tif\n.SH DESCRIPTION\n.I thumbnail\nis a program written to show how one might use the\nSubIFD tag (#330) to store thumbnail images.\n.I thumbnail\ncopies a\n.SM TIFF\nClass F facsimile file to the output file\nand for each image an 8-bit greyscale \n.IR \"thumbnail sketch\" .\nThe output file contains the thumbnail image with the associated\nfull-resolution page linked below with the SubIFD tag.\n.PP\nBy default, thumbnail images are 216 pixels wide by 274 pixels high.\nPixels are calculated by sampling and filtering the input image\nwith each pixel value passed through a contrast curve.\n.SH OPTIONS\n.TP\n.B \\-w\nSpecify the width of thumbnail images in pixels.\n.TP\n.B \\-h\nSpecify the height of thumbnail images in pixels.\n.TP\n.B \\-c\nSpecify a contrast curve to apply in generating the thumbnail images.\nBy default pixels values are passed through a linear contrast curve\nthat simply maps the pixel value ranges.\nAlternative curves are:\n.B exp50\nfor a 50% exponential curve,\n.B exp60\nfor a 60% exponential curve,\n.B exp70\nfor a 70% exponential curve,\n.B exp80\nfor a 80% exponential curve,\n.B exp90\nfor a 90% exponential curve,\n.B exp\nfor a pure exponential curve,\n.B linear\nfor a linear curve.\n.SH BUGS\nThere are no options to control the format of the saved thumbnail images.\n.SH \"SEE ALSO\"\n.BR tiffdump (1),\n.BR tiffgt (1),\n.BR tiffinfo (1),\n.BR libtiff (3)\n.PP\nLibtiff library home page:\n.BR http://www.remotesensing.org/libtiff/\n"
  },
  {
    "path": "src/main/jni/tiff/man/tiff2bw.1",
    "content": ".\\\"\t$Id: tiff2bw.1,v 1.3 2006/04/20 12:17:19 dron Exp $\n.\\\"\n.\\\" Copyright (c) 1988-1997 Sam Leffler\n.\\\" Copyright (c) 1991-1997 Silicon Graphics, Inc.\n.\\\"\n.\\\" Permission to use, copy, modify, distribute, and sell this software and \n.\\\" its documentation for any purpose is hereby granted without fee, provided\n.\\\" that (i) the above copyright notices and this permission notice appear in\n.\\\" all copies of the software and related documentation, and (ii) the names of\n.\\\" Sam Leffler and Silicon Graphics may not be used in any advertising or\n.\\\" publicity relating to the software without the specific, prior written\n.\\\" permission of Sam Leffler and Silicon Graphics.\n.\\\" \n.\\\" THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n.\\\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n.\\\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n.\\\" \n.\\\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n.\\\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n.\\\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n.\\\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n.\\\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n.\\\" OF THIS SOFTWARE.\n.\\\"\n.if n .po 0\n.TH TIFF2BW 1 \"November 2, 2005\" \"libtiff\"\n.SH NAME\ntiff2bw \\- convert a color\n.SM TIFF\nimage to greyscale\n.SH SYNOPSIS\n.B tiff2bw\n[\n.I options\n]\n.I input.tif\n.I output.tif\n.SH DESCRIPTION\n.I Tiff2bw\nconverts an\n.SM RGB\nor Palette color\n.SM TIFF\nimage to a greyscale image by\ncombining percentages of the red, green, and blue channels.\nBy default, output samples are created by taking\n28% of the red channel, 59% of the green channel, and 11% of\nthe blue channel.\nTo alter these percentages, the\n.BR \\-R ,\n.BR \\-G ,\nand\n.BR \\-B\noptions may be used.\n.SH OPTIONS\n.TP\n.B \\-c\nSpecify a compression scheme to use when writing image data:\n.B \"\\-c none\"\nfor no compression,\n.B \"\\-c packbits\"\nfor the PackBits compression algorithm,\n.B \"\\-c zip\nfor the Deflate compression algorithm,\n.B \"\\-c g3\nfor the CCITT Group 3 compression algorithm,\n.B \"\\-c g4\nfor the CCITT Group 4 compression algorithm,\nand\n.B \"\\-c lzw\"\nfor Lempel-Ziv & Welch (the default).\n.TP\n.B \\-r\nWrite data with a specified number of rows per strip;\nby default the number of rows/strip is selected so that each strip\nis approximately 8 kilobytes.\n.TP\n.B \\-R\nSpecify the percentage of the red channel to use (default 28).\n.TP\n.B \\-G\nSpecify the percentage of the green channel to use (default 59).\n.TP\n.B \\-B\nSpecify the percentage of the blue channel to use (default 11).\n.SH \"SEE ALSO\"\n.BR pal2rgb (1),\n.BR tiffinfo (1),\n.BR tiffcp (1),\n.BR tiffmedian (1),\n.BR libtiff (3)\n.PP\nLibtiff library home page:\n.BR http://www.remotesensing.org/libtiff/\n"
  },
  {
    "path": "src/main/jni/tiff/man/tiff2pdf.1",
    "content": ".\\\" $Id: tiff2pdf.1,v 1.6 2006/04/20 12:17:19 dron Exp $\n.\\\" \n.\\\"  Copyright (c) 2003 Ross Finlayson\n.\\\" \n.\\\"  Permission to use, copy, modify, distribute, and sell this software and \n.\\\"  its documentation for any purpose is hereby granted without fee, provided\n.\\\"  that (i) the above copyright notices and this permission notice appear in\n.\\\"  all copies of the software and related documentation, and (ii) the name of\n.\\\"  Ross Finlayson may not be used in any advertising or\n.\\\"  publicity relating to the software without the specific, prior written\n.\\\"  permission of Ross Finlayson.\n.\\\"  \n.\\\"  THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n.\\\"  EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n.\\\"  WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n.\\\"  \n.\\\"  IN NO EVENT SHALL ROSS FINLAYSON BE LIABLE FOR\n.\\\"  ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n.\\\"  OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n.\\\"  WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n.\\\"  LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n.\\\"  OF THIS SOFTWARE.\n.\\\" \n.\\\" Process this file with\n.\\\" groff -man -Tascii tiff2pdf.1\n.\\\"\n.TH TIFF2PDF 1 \"April 20, 2006\" \"libtiff\"\n.SH NAME\ntiff2pdf \\- convert a TIFF image to a PDF document\n.SH SYNOPSIS\n.B tiff2pdf\n[\n.I options \n] \n.I input.tiff\n.SH DESCRIPTION\n.I tiff2pdf\nopens a TIFF image and writes a PDF document to standard output.\n.PP\nThe program converts one TIFF file to one PDF file, including multiple page \nTIFF files, tiled TIFF files, black and white. grayscale, and color TIFF \nfiles that contain data of TIFF photometric interpretations of bilevel, \ngrayscale, RGB, YCbCr, CMYK separation, and ICC L*a*b* as supported by \n.I libtiff \nand PDF.\n.PP\nIf you have multiple TIFF files to convert into one PDF file then use \n.I tiffcp \nor other program to concatenate the files into a multiple page TIFF file.  \nIf the input TIFF file is of huge dimensions (greater than 10000 pixels height\nor width) convert the input image to a tiled TIFF if it is not already.\n.PP\nThe standard output is standard output.  Set the output file name with the \n.BI \\-o \" output.pdf\"\noption.\n.PP\nAll black and white files are compressed into a single strip CCITT G4 Fax\ncompressed PDF, unless tiled, where tiled black and white images are\ncompressed into tiled CCITT G4 Fax compressed PDF, \n.I libtiff \nCCITT support is assumed.\n.PP\nColor and grayscale data can be compressed using either JPEG compression,\nITU-T T.81, or Zip/Deflate LZ77 compression.  Set the compression type using\nthe \n.B \\-j\nor\n.B \\-z\noptions.  JPEG compression support \nrequires that \n.I libtiff \nbe configured with JPEG support, and Zip/Deflate compression support requires\nthat \n.I libtiff \nbe configured with Zip support, in tiffconf.h.  Use only one or the other of \n.B \\-j\nand\n.B \\-z.\n.PP\nIf the input TIFF contains single strip CCITT G4 Fax compressed information, \nthen that is written to the PDF file without transcoding, unless the options \nof no compression and no passthrough are set, \n.B \\-d\nand\n.B \\-n.\n.PP\nIf the input TIFF contains JPEG or single strip Zip/Deflate compressed \ninformation, and they are configured, then that is written to the PDF file \nwithout transcoding, unless the options of no compression and no passthrough \nare set.\n.PP\nThe default page size upon which the TIFF image is placed is determined by \nthe resolution and extent of the image data.  Default values for the TIFF \nimage resolution can be set using the\n.B \\-x\nand\n.B \\-y\noptions.  The page size can be set using the\n.B \\-p\noption for paper size, or\n.B \\-w\nand\n.B \\-l\nfor paper width and length, then each page of the TIFF image is centered on\nits page.  The distance unit for default resolution and page width and\nlength can be set by the\n.B \\-u\noption, the default unit is inch.\n.PP\nVarious items of the output document information can be set with the\n.BR \\-e ,\n.BR \\-c , \n.BR \\-a ,\n.BR \\-t ,\n.BR \\-s ,\nand\n.B \\-k\noptions.  Setting the argument of the option to \"\" for these \ntags causes the relevant document information field to be not written.  Some \nof the document information values otherwise get their information from the \ninput TIFF image, the software, author, document name, and image description.\n.PP\nThe Portable Document Format (PDF) specification is copyrighted by Adobe \nSystems, Incorporated.\n.SH OPTIONS\n.TP\n.BI \\-o \" output-file\"\nSet the output to go to file.\n.I output-file\n.TP\n.B \\-j  \nCompress with JPEG (requires\n.I libjpeg\nconfigured with\n.IR libtiff ).\n.TP\n.B \\-z  \nCompress with Zip/Deflate (requires\n.I zlib\nconfigured with\n.IR libtiff ).\n.TP\n.BI \\-q \" quality\"\nSet the compression quality, 1-100 for JPEG.\n.TP\n.B \\-n\nDo not allow data to be converted without uncompressing, no compressed\ndata passthrough.\n.TP\n.BI \\-b\nSet PDF ``Interpolate'' user preference.\n.TP\n.B \\-d  \nDo not compress (decompress).\n.TP\n.B \\-i  \nInvert colors.\n.TP\n.BI \\-p \" paper-size\"\nSet paper size, e.g.,\n.BR letter ,\n.BR legal ,\n.BR A4 .\n.TP\n.BR \\-u \" [\" i | m ]\nSet distance unit,\n.B i\nfor inch, \n.B m\nfor centimeter.\n.TP\n.BI \\-w \" width\"\nSet width in units.\n.TP\n.BI \\-l \" length\"\nSet length in units.\n.TP\n.BI \\-x \" xres\"\nSet x/width resolution default.\n.TP\n.BI \\-y \" yres\"\nSet y/length resolution default.\n.TP\n.BR \\-r \" [\" d | o ]\nSet\n.B d\nfor resolution default for images without resolution, \n.B o\nfor resolution override for all images.\n.TP\n.BI \\-f\nSet PDF ``Fit Window'' user preference.\n.TP\n.BI \\-e \" YYYYMMDDHHMMSS\"\nSet document information date, overrides image or current date/time default,\n.I YYYYMMDDHHMMSS.\n.TP\n.BI \\-c \" creator\"\nSet document information creator, overrides image software default.\n.TP\n.BI \\-a \" author\"\nSet document information author, overrides image artist default.\n.TP\n.BI \\-t \" title\"\nSet document information title, overrides image document name default.\n.TP\n.BI \\-s \" subject\"\nSet document information subject, overrides image image description default.\n.TP\n.BI \\-k \" keywords\"\nSet document information keywords.\n.TP\n.B \\-h  \nList usage reminder to stderr and exit.\n.SH EXAMPLES\n.TP\nThe following example would generate the file output.pdf from input.tiff.\n.RS\n.nf\ntiff2pdf \\-o output.pdf input.tiff\n.fi\n.RE\n.PP\nThe following example would generate PDF output from input.tiff and write it \nto standard output.\n.RS\n.nf\ntiff2pdf input.tiff\n.fi\n.RE\n.PP\nThe following example would generate the file output.pdf from input.tiff, \nputting the image pages on a letter sized page, compressing the output \nwith JPEG, with JPEG quality 75, setting the title to ``Document'', and setting \nthe ``Fit Window'' option.\n.RS\n.nf\ntiff2pdf \\-p letter \\-j \\-q 75 \\-t \"Document\" \\-f \\-o output.pdf input.tiff\n.fi\n.RE\n.SH BUGS\nPlease report bugs via the web interface at \n.IP\n\\%http://bugzilla.remotesensing.org/enter_bug.cgi?product=libtiff\n.SH \"SEE ALSO\"\n.BR libtiff (3),\n.BR tiffcp (1), \n.BR tiff2ps (1)\n.PP\nLibtiff library home page:\n.BR http://www.remotesensing.org/libtiff/\n"
  },
  {
    "path": "src/main/jni/tiff/man/tiff2ps.1",
    "content": ".\\\" $Id: tiff2ps.1,v 1.9.2.2 2009-08-20 18:40:33 bfriesen Exp $\n.\\\"\n.\\\" Copyright (c) 1988-1997 Sam Leffler\n.\\\" Copyright (c) 1991-1997 Silicon Graphics, Inc.\n.\\\"\n.\\\" Permission to use, copy, modify, distribute, and sell this software and \n.\\\" its documentation for any purpose is hereby granted without fee, provided\n.\\\" that (i) the above copyright notices and this permission notice appear in\n.\\\" all copies of the software and related documentation, and (ii) the names of\n.\\\" Sam Leffler and Silicon Graphics may not be used in any advertising or\n.\\\" publicity relating to the software without the specific, prior written\n.\\\" permission of Sam Leffler and Silicon Graphics.\n.\\\" \n.\\\" THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n.\\\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n.\\\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n.\\\" \n.\\\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n.\\\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n.\\\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n.\\\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n.\\\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n.\\\" OF THIS SOFTWARE.\n.\\\"\n.ds Ps PostScript\n.if n .po 0\n.TH TIFF2PS 1 \"November 2, 2005\" \"libtiff\"\n.SH NAME\ntiff2ps \\- convert a\n.SM TIFF\nimage to \\*(Ps\\*(Tm\n.SH SYNOPSIS\n.B tiff2ps\n[\n.I options\n]\n.I \"input.tif ...\"\n.SH DESCRIPTION\n.I tiff2ps\nreads\n.SM TIFF\nimages and writes \\*(Ps or Encapsulated \\*(Ps (EPS)\non the standard output.\nBy default,\n.I tiff2ps\nwrites Encapsulated \\*(Ps for the first image in the specified\n.SM TIFF\nimage file.\n.PP\nBy default,\n.I tiff2ps\nwill generate \\*(Ps that fills a printed area specified\nby the \n.SM TIFF\ntags in the input file.\nIf the file does not contain\n.I XResolution\nor\n.I YResolution\ntags, then the printed area is set according to the image dimensions.\nThe\n.B \\-w\nand\n.B \\-h\noptions (see below)\ncan be used to set the dimensions of the printed area in inches;\noverriding any relevant\n.SM TIFF\ntags.\n.PP\nThe \\*(Ps generated for\n.SM RGB,\npalette, and\n.SM CMYK\nimages uses the\n.I colorimage\noperator.\nThe \\*(Ps generated for\ngreyscale and bilevel images\nuses the\n.I image\noperator.\nWhen the\n.I colorimage\noperator is used, \\*(Ps code to emulate this operator\non older \\*(Ps printers is also generated.\nNote that this emulation code can be very slow.\n.PP\nColor images with associated alpha data are composited over\na white background.\n.SH OPTIONS\n.TP\n.B \\-1\nGenerate \\*(Ps Level 1 (the default).\n.TP\n.B \\-2\nGenerate \\*(Ps Level 2.\n.TP\n.B \\-3\nGenerate \\*(Ps Level 3. It basically allows one to use the /flateDecode\nfilter for ZIP compressed TIFF images.\n.TP\n.B \\-a\nGenerate output for all IFDs (pages) in the input file.\n.TP\n.B \\-b\nSpecify the bottom margin for the output (in inches). This does not affect\nthe height of the printed image.\n.TP\n.B \\-c\nCenter the image in the output. This option only shows an effect if both\nthe\n.B \\-w\nand the\n.B \\-h\noption are given.\n.TP\n.B \\-d\nSet the initial\n.SM TIFF\ndirectory to the specified directory number.\n(NB: Directories are numbered starting at zero.)\nThis option is useful for selecting individual pages in a\nmulti-page (e.g. facsimile) file.\n.TP\n.B \\-e\nForce the generation of Encapsulated \\*(Ps (implies\n.BR \\-z ).\n.TP\n.B \\-h\nSpecify the vertical size of the printed area (in inches).\n.TP\n.B \\-H\nSpecify the maximum height of image (in inches). Images with larger sizes will\nbe split in several pages. Option\n.B \\-L\nmay be used for specifying size of split images overlapping.\n.TP\n.B \\-W\nSpecify the maximum width of image (in inches). Images with larger sizes will\nbe split in several pages. Options\n.B \\-L\nand \n.B \\-W\nare mutually exclusive.\n.B \\-i\nEnable/disable pixel interpolation.  This option requires a\nsingle numeric value: zero to disable pixel interpolation and\nnon-zero to enable.  The default is enabled.\n.TP\n.B \\-L\nSpecify the size of overlapping for split images (in inches). Used in\nconjunction with\n.B \\-H\noption.\n.TP\n.B \\-l\nSpecify the left margin for the output (in inches). This does not affect\nthe width of the printed image.\n.TP\n.B \\-m\nWhere possible render using the\n.I imagemask\n\\*(Ps operator instead of the\n.I image\noperator.  When this option is specified\n.I tiff2ps\nwill use\n.I imagemask\nfor rendering 1 bit deep images.  If this option is not specified\nor if the image depth is greater than 1 then the\n.I image\noperator is used.\n.TP\n.B \\-o\nSet the initial\n.SM TIFF\ndirectory to the\n.SM IFD\nat the specified file offset.\nThis option is useful for selecting thumbnail images and the\nlike which are hidden using the\n.I SubIFD\ntag.\n.TP\n.B \\-p\nForce the generation of (non-Encapsulated) \\*(Ps.\n.TP\n.B \\-r\nRotate image by 180 degrees.\n.TP\n.B \\-s\nGenerate output for a single IFD (page) in the input file.\n.TP\n.B \\-w\nSpecify the horizontal size of the printed area (in inches).\n.TP\n.B \\-x\nOverride resolution units specified in the TIFF as centimeters.\n.TP\n.B \\-y\nOverride resolution units specified in the TIFF as inches.\n.TP\n.B \\-z\nWhen generating \\*(Ps Level 2, data is scaled so that it does not\nimage into the \n.I deadzone\non a page (the outer margin that the printing device is unable to mark).\nThis option suppresses this behavior.\nWhen \\*(Ps Level 1 is generated, data is imaged to the entire printed\npage and this option has no affect.\n.SH EXAMPLES\nThe following generates \\*(Ps Level 2 for all pages of a facsimile:\n.RS\n.nf\ntiff2ps \\-a2 fax.tif | lpr\n.fi\n.RE\nNote also that if you have version 2.6.1 or newer of Ghostscript then you\ncan efficiently preview facsimile generated with the above command.\n.PP\nTo generate Encapsulated \\*(Ps for a the image at directory 2\nof an image use:\n.RS\n.nf\ntiff2ps \\-d 1 foo.tif\n.fi\n.RE\n(Notice that directories are numbered starting at zero.)\n.PP\nIf you have a long image, it may be split in several pages:\n.RS\n.nf\ntiff2ps \\-h11 \\-w8.5 \\-H14 \\-L.5 foo.tif > foo.ps\n.fi\n.RE\nThe page size is set to 8.5x11 by\n.B \\-w\nand\n.B \\-h\noptions. We will accept a small amount of vertical compression, so\n.B \\-H\nset to 14. Any pages between 11 and 14 inches will be fit onto one page.\nPages longer than 14 inches are cut off at 11 and continued on the next\npage. The\n.B \\-L.5\noption says to repeat a half inch on the next page (to improve readability).\n.SH BUGS\nBecause \\*(Ps does not support the notion of a colormap,\n8-bit palette images produce 24-bit \\*(Ps images.\nThis conversion results in output that is six times\nbigger than the original image and which takes a long time\nto send to a printer over a serial line.\nMatters are even worse for 4-, 2-, and 1-bit palette images.\n.PP\nDoes not handle tiled images when generating \\*(Ps Level I output.\n.SH \"SEE ALSO\"\n.BR pal2rgb (1),\n.BR tiffinfo (1),\n.BR tiffcp (1),\n.BR tiffgt (1),\n.BR tiffmedian (1),\n.BR tiff2bw (1),\n.BR tiffsv (1),\n.BR libtiff (3)\n.PP\nLibtiff library home page:\n.BR http://www.remotesensing.org/libtiff/\n"
  },
  {
    "path": "src/main/jni/tiff/man/tiff2rgba.1",
    "content": ".\\\" $Id: tiff2rgba.1,v 1.4 2006/04/20 12:17:19 dron Exp $\n.\\\"\n.\\\" Copyright (c) 1988-1997 Sam Leffler\n.\\\" Copyright (c) 1991-1997 Silicon Graphics, Inc.\n.\\\"\n.\\\" Permission to use, copy, modify, distribute, and sell this software and \n.\\\" its documentation for any purpose is hereby granted without fee, provided\n.\\\" that (i) the above copyright notices and this permission notice appear in\n.\\\" all copies of the software and related documentation, and (ii) the names of\n.\\\" Sam Leffler and Silicon Graphics may not be used in any advertising or\n.\\\" publicity relating to the software without the specific, prior written\n.\\\" permission of Sam Leffler and Silicon Graphics.\n.\\\" \n.\\\" THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n.\\\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n.\\\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n.\\\" \n.\\\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n.\\\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n.\\\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n.\\\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n.\\\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n.\\\" OF THIS SOFTWARE.\n.\\\"\n.if n .po 0\n.TH TIFF2RGBA 1 \"November 2, 2005\" \"libtiff\"\n.SH NAME\ntiff2rgba \\- convert a \n.SM TIFF\nimage to RGBA color space\n.SH SYNOPSIS\n.B tiff2rgba\n[\n.I options\n]\n.I input.tif\n.I output.tif\n.SH DESCRIPTION\n.I Tiff2rgba\nconverts a wide variety of TIFF images into an RGBA TIFF image.  This \nincludes the ability to translate different color spaces and photometric\ninterpretation into RGBA, support for alpha blending, and translation\nof many different bit depths into a 32bit RGBA image.\n.P\nInternally this program is implemented using the\n.I TIFFReadRGBAImage()\nfunction, and it suffers any limitations of that image.  This includes\nlimited support for > 8 BitsPerSample images, and flaws with some\nesoteric combinations of BitsPerSample, photometric interpretation, \nblock organization and planar configuration.  \n.P\nThe generated images are stripped images with four samples per pixel \n(red, green, blue and alpha) or if the\n.B \\-n\nflag is used, three samples\nper pixel (red, green, and blue).  The resulting images are always planar\nconfiguration contiguous.  For this reason, this program is a useful utility\nfor transform exotic TIFF files into a form ingestible by almost any TIFF\nsupporting software. \n.SH OPTIONS\n.TP\n.B \\-c\nSpecify a compression scheme to use when writing image data:\n.B \"\\-c none\"\nfor no compression (the default),\n.B \"\\-c packbits\"\nfor the PackBits compression algorithm,\n.B \"\\-c zip\"\nfor the Deflate compression algorithm,\n.B \"\\-c jpeg\"\nfor the JPEG compression algorithm,\nand\n.B \"\\-c lzw\"\nfor Lempel-Ziv & Welch.\n.TP\n.B \\-r\nWrite data with a specified number of rows per strip;\nby default the number of rows/strip is selected so that each strip\nis approximately 8 kilobytes.\n.TP\n.B \\-b\nProcess the image one block (strip/tile) at a time instead of by reading\nthe whole image into memory at once.  This may be necessary for very large\nimages on systems with limited RAM.\n.TP\n.B \\-n\nDrop the alpha component from the output file, producing a pure RGB file.\nCurrently this does not work if the\n.B \\-b\nflag is also in effect.\n.SH \"SEE ALSO\"\n.BR tiff2bw (1),\n.BR TIFFReadRGBAImage (3t),\n.BR libtiff (3)\n.PP\nLibtiff library home page:\n.BR http://www.remotesensing.org/libtiff/\n"
  },
  {
    "path": "src/main/jni/tiff/man/tiffcmp.1",
    "content": ".\\\" $Id: tiffcmp.1,v 1.5 2006/04/20 12:17:19 dron Exp $\n.\\\"\n.\\\" Copyright (c) 1988-1997 Sam Leffler\n.\\\" Copyright (c) 1991-1997 Silicon Graphics, Inc.\n.\\\"\n.\\\" Permission to use, copy, modify, distribute, and sell this software and \n.\\\" its documentation for any purpose is hereby granted without fee, provided\n.\\\" that (i) the above copyright notices and this permission notice appear in\n.\\\" all copies of the software and related documentation, and (ii) the names of\n.\\\" Sam Leffler and Silicon Graphics may not be used in any advertising or\n.\\\" publicity relating to the software without the specific, prior written\n.\\\" permission of Sam Leffler and Silicon Graphics.\n.\\\" \n.\\\" THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n.\\\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n.\\\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n.\\\" \n.\\\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n.\\\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n.\\\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n.\\\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n.\\\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n.\\\" OF THIS SOFTWARE.\n.\\\"\n.if n .po 0\n.TH TIFFCMP 1 \"November 2, 2005\" \"libtiff\"\n.SH NAME\ntiffcmp \\- compare two\n.SM TIFF\nfiles\n.SH SYNOPSIS\n.B tiffcmp\n[\n.I options\n]\n.I \"file1.tif file2.tif\"\n.SH DESCRIPTION\n.I Tiffcmp\ncompares the tags and data in two files created according\nto the Tagged Image File Format, Revision 6.0.\nThe schemes used for compressing data in each file\nare immaterial when data are compared\\-data are compared on\na scanline-by-scanline basis after decompression.\nMost directory tags are checked; notable exceptions are:\n.IR GrayResponseCurve ,\n.IR ColorResponseCurve ,\nand\n.IR ColorMap\ntags.\nData will not be compared if any of the\n.IR BitsPerSample ,\n.IR SamplesPerPixel ,\nor\n.I ImageWidth\nvalues are not equal.\nBy default,\n.I tiffcmp\nwill terminate if it encounters any difference.\n.SH OPTIONS\n.TP\n.B \\-l\nList each byte of image data that differs between the files.\n.TP\n.BI \\-z \" number\"\nList specified number of image data bytes that differs between the files.\n.TP\n.B \\-t\nIgnore any differences in directory tags.\n.SH BUGS\nTags that are not recognized by the library are not\ncompared; they may also generate spurious diagnostics.\n.PP\nThe image data of tiled files is not compared, since the\n.I TIFFReadScanline()\nfunction is used.  An error will be reported for tiled files.\n.PP\nThe pixel and/or sample number reported in differences may be off\nin some exotic cases. \n.SH \"SEE ALSO\"\n.BR pal2rgb (1),\n.bR tiffinfo (1),\n.BR tiffcp (1),\n.BR tiffmedian (1),\n.BR libtiff (3TIFF)\n.PP\nLibtiff library home page:\n.BR http://www.remotesensing.org/libtiff/\n"
  },
  {
    "path": "src/main/jni/tiff/man/tiffcp.1",
    "content": ".\\\" $Id: tiffcp.1,v 1.9 2007/02/24 11:19:33 dron Exp $\n.\\\"\n.\\\" Copyright (c) 1988-1997 Sam Leffler\n.\\\" Copyright (c) 1991-1997 Silicon Graphics, Inc.\n.\\\"\n.\\\" Permission to use, copy, modify, distribute, and sell this software and \n.\\\" its documentation for any purpose is hereby granted without fee, provided\n.\\\" that (i) the above copyright notices and this permission notice appear in\n.\\\" all copies of the software and related documentation, and (ii) the names of\n.\\\" Sam Leffler and Silicon Graphics may not be used in any advertising or\n.\\\" publicity relating to the software without the specific, prior written\n.\\\" permission of Sam Leffler and Silicon Graphics.\n.\\\" \n.\\\" THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n.\\\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n.\\\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n.\\\" \n.\\\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n.\\\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n.\\\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n.\\\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n.\\\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n.\\\" OF THIS SOFTWARE.\n.\\\"\n.if n .po 0\n.TH TIFFCP 1 \"February 24, 2007\" \"libtiff\"\n.SH NAME\ntiffcp \\- copy (and possibly convert) a\n.SM TIFF\nfile\n.SH SYNOPSIS\n.B tiffcp\n[\n.I options\n]\n.I \"src1.tif ... srcN.tif dst.tif\"\n.SH DESCRIPTION\n.I tiffcp\ncombines one or more files created according\nto the Tag Image File Format, Revision 6.0\ninto a single\n.SM TIFF\nfile.\nBecause the output file may be compressed using a different\nalgorithm than the input files,\n.I tiffcp\nis most often used to convert between different compression\nschemes.\n.PP\nBy default, \n.I tiffcp\nwill copy all the understood tags in a\n.SM TIFF\ndirectory of an input\nfile to the associated directory in the output file.\n.PP\n.I tiffcp\ncan be used to reorganize the storage characteristics of data\nin a file, but it is explicitly intended to not alter or convert\nthe image data content in any way.\n.SH OPTIONS\n.TP\n.BI \\-b \" image\"\nsubtract the following monochrome image from all others\nprocessed.  This can be used to remove a noise bias\nfrom a set of images.  This bias image is typically an\nimage of noise the camera saw with its shutter closed.\n.TP\n.B \\-B\nForce output to be written with Big-Endian byte order.\nThis option only has an effect when the output file is created or\noverwritten and not when it is appended to.\n.TP\n.B \\-C\nSuppress the use of ``strip chopping'' when reading images\nthat have a single strip/tile of uncompressed data.\n.TP\n.B \\-c\nSpecify the compression to use for data written to the output file:\n.B none \nfor no compression,\n.B packbits\nfor PackBits compression,\n.B lzw\nfor Lempel-Ziv & Welch compression,\n.B jpeg\nfor baseline JPEG compression,\n.B zip\nfor Deflate compression,\n.B g3\nfor CCITT Group 3 (T.4) compression,\nand\n.B g4\nfor CCITT Group 4 (T.6) compression.\nBy default\n.I tiffcp\nwill compress data according to the value of the\n.I Compression\ntag found in the source file.\n.IP\nThe\n.SM CCITT\nGroup 3 and Group 4 compression algorithms can only\nbe used with bilevel data.\n.IP\nGroup 3 compression can be specified together with several\nT.4-specific options:\n.B 1d\nfor 1-dimensional encoding,\n.B 2d\nfor 2-dimensional encoding,\nand\n.B fill\nto force each encoded scanline to be zero-filled so that the\nterminating EOL code lies on a byte boundary.\nGroup 3-specific options are specified by appending a ``:''-separated\nlist to the ``g3'' option; e.g.\n.B \"\\-c g3:2d:fill\"\nto get 2D-encoded data with byte-aligned EOL codes.\n.IP\n.SM LZW\ncompression can be specified together with a \n.I predictor\nvalue.\nA predictor value of 2 causes\neach scanline of the output image to undergo horizontal\ndifferencing before it is encoded; a value\nof 1 forces each scanline to be encoded without differencing.\nLZW-specific options are specified by appending a ``:''-separated\nlist to the ``lzw'' option; e.g.\n.B \"\\-c lzw:2\"\nfor\n.SM LZW\ncompression with horizontal differencing.\n.TP\n.B \\-f\nSpecify the bit fill order to use in writing output data.\nBy default,\n.I tiffcp\nwill create a new file with the same fill order as the original.\nSpecifying\n.B \"\\-f lsb2msb\"\nwill force data to be written with the FillOrder tag set to\n.SM LSB2MSB,\nwhile\n.B \"\\-f msb2lsb\"\nwill force data to be written with the FillOrder tag set to\n.SM MSB2LSB.\n.TP\n.B \\-i\nIgnore non-fatal read errors and continue processing of the input file.\n.TP\n.B \\-l\nSpecify the length of a tile (in pixels).\n.I tiffcp\nattempts to set the tile dimensions so\nthat no more than 8 kilobytes of data appear in a tile.\n.TP\n.B \\-L\nForce output to be written with Little-Endian byte order.\nThis option only has an effect when the output file is created or\noverwritten and not when it is appended to.\n.TP\n.B \\-M\nSuppress the use of memory-mapped files when reading images.\n.TP\n.B \\-p\nSpecify the planar configuration to use in writing image data\nthat has one 8-bit sample per pixel.\nBy default,\n.I tiffcp\nwill create a new file with the same planar configuration as\nthe original.\nSpecifying\n.B \"\\-p contig\"\nwill force data to be written with multi-sample data packed\ntogether, while\n.B \"\\-p separate\"\nwill force samples to be written in separate planes.\n.TP\n.B \\-r\nSpecify the number of rows (scanlines) in each strip of data\nwritten to the output file.\nBy default (or when value\n.B 0\nis specified),\n.I tiffcp\nattempts to set the rows/strip\nthat no more than 8 kilobytes of data appear in a strip. If you specify\nspecial value\n.B \\-1\nit will results in infinite number of the rows per strip. The entire image\nwill be the one strip in that case.\n.TP\n.B \\-s\nForce the output file to be written with data organized in strips\n(rather than tiles).\n.TP\n.B \\-t\nForce the output file to be written with data organized in tiles (rather than\nstrips). options can be used to force the resultant image to be written as\nstrips or tiles of data, respectively.\n.TP\n.B \\-w\nSpecify the width of a tile (in pixels).\n.I tiffcp\nattempts to set the tile dimensions so that no more than 8 kilobytes of data\nappear in a tile.\n.I tiffcp\nattempts to set the tile dimensions so that no more than 8 kilobytes of data\nappear in a tile.\n.TP\n.BI \\-,= character\nsubstitute\n.I character\nfor `,' in parsing image directory indices\nin files.  This is necessary if filenames contain commas.\nNote that\n.B \\-,=\nwith whitespace immediately following will disable\nthe special meaning of the `,' entirely.  See examples.\n.SH EXAMPLES\nThe following concatenates two files and writes the result using \n.SM LZW\nencoding:\n.RS\n.nf\ntiffcp \\-c lzw a.tif b.tif result.tif\n.fi\n.RE\n.PP\nTo convert a G3 1d-encoded \n.SM TIFF\nto a single strip of G4-encoded data the following might be used:\n.RS\n.nf\ntiffcp \\-c g4 \\-r 10000 g3.tif g4.tif\n.fi\n.RE\n(1000 is just a number that is larger than the number of rows in\nthe source file.)\n\nTo extract a selected set of images from a multi-image TIFF file, the file\nname may be immediately followed by a `,' separated list of image directory\nindices.  The first image is always in directory 0.  Thus, to copy the 1st and\n3rd images of image file ``album.tif'' to ``result.tif'':\n.RS\n.nf\ntiffcp album.tif,0,2 result.tif\n.fi\n.RE\n\nA trailing comma denotes remaining images in sequence.  The following command\nwill copy all image with except the first one:\n.RS\n.nf\ntiffcp album.tif,1, result.tif\n.fi\n.RE\n\nGiven file ``CCD.tif'' whose first image is a noise bias\nfollowed by images which include that bias,\nsubtract the noise from all those images following it\n(while decompressing) with the command:\n.RS\n.nf\ntiffcp \\-c none \\-b CCD.tif CCD.tif,1, result.tif\n.fi\n.RE\n\nIf the file above were named ``CCD,X.tif'', the\n.B \\-,=\noption would\nbe required to correctly parse this filename with image numbers,\nas follows:\n.RS\n.nf\ntiffcp \\-c none \\-,=% \\-b CCD,X.tif CCD,X%1%.tif result.tif\n.SH \"SEE ALSO\"\n.BR pal2rgb (1),\n.BR tiffinfo (1),\n.BR tiffcmp (1),\n.BR tiffmedian (1),\n.BR tiffsplit (1),\n.BR libtiff (3TIFF)\n.PP\nLibtiff library home page:\n.BR http://www.remotesensing.org/libtiff/\n"
  },
  {
    "path": "src/main/jni/tiff/man/tiffcrop.1",
    "content": ".\\\" $Id: tiffcrop.1,v 1.1.2.3 2009-09-24 21:51:46 bfriesen Exp $\r\n.\\\" tiffcrop -- a port of tiffcp.c extended to include extended processing of images\r\n.\\\" \r\n.\\\" Original code:\r\n.\\\" \r\n.\\\" Copyright (c) 1988-1997 Sam Leffler\r\n.\\\" Copyright (c) 1991-1997 Silicon Graphics, Inc.\r\n.\\\" \r\n.\\\" Permission to use, copy, modify, distribute, and sell this software and \r\n.\\\" its documentation for any purpose is hereby granted without fee, provided\r\n.\\\" that (i) the above copyright notices and this permission notice appear in\r\n.\\\" all copies of the software and related documentation, and (ii) the names of\r\n.\\\" Sam Leffler and Silicon Graphics may not be used in any advertising or\r\n.\\\" publicity relating to the software without the specific, prior written\r\n.\\\" permission of Sam Leffler and Silicon Graphics.\r\n.\\\" \r\n.\\\" THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \r\n.\\\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \r\n.\\\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \r\n.\\\" \r\n.\\\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\r\n.\\\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\r\n.\\\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\r\n.\\\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \r\n.\\\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \r\n.\\\" OF THIS SOFTWARE.\r\n.\\\" \r\n.\\\" Additional code Copyright (c) 2006-2009 Richard Nolde \r\n.\\\" Lasted Updated 9/2009\r\n.\\\" .if n .po 0\r\n.TH \"TIFFCROP\" \"1\" \"December, 2008\" \"libtiff\" \"\"\r\n.SH \"NAME\"\r\ntiffcrop \\- select, copy, crop, convert, extract, and/or process one or more\r\n.SM TIFF\r\nfiles.\r\n.SH \"SYNOPSIS\"\r\n.B tiffcrop\r\n[\r\n.I options\r\n]\r\n.I \"src1.tif ... srcN.tif dst.tif\"\r\n.SH \"DESCRIPTION\"\r\n.I Tiffcrop\r\nprocesses one or more files created according\r\nto the Tag Image File Format, Revision 6.0, specification\r\ninto one or more\r\n.SM TIFF\r\nfile(s).\r\n.I Tiffcrop\r\nis most often used to extract portions of an image for processing \r\nwith bar code recognizer or OCR software when that software cannot \r\nrestrict the region of interest to a specific portion of the image \r\nor to improve efficiency when the regions of interest must be rotated.\r\nIt can also be used to subdivide all or part of a processed image into \r\nsmaller sections and export individual images or sections of images\r\nas separate files or separate images within one or more files derived\r\nfrom the original input image or images.\r\n.PP \r\nThe available functions can be grouped broadly into three classes:\r\n.IP \r\nThose that select individual images or sections of images from the input files.\r\nThe options \\-N for sequences or lists of individual images in the input files,\r\n\\-Z for zones, \\-z for regions, \\-X and \\-Y for fixed sized selections,\r\n\\-m for margins, \\-U for units, and \\-E for edge reference provide a variety of \r\nways to specify portions of the input image.\r\n.IP \r\nThose that allow the individual images or selections to be exported to one or\r\nmore output files in different groupings and control the organization of the \r\ndata in the output images. The options \\-P for page size grouping, \\-S for \r\nsubdivision into columns and rows and \\-e for export mode options that produce\r\none or more files from each input image. The options \\-r, \\-s, \\-t, \\-w  control \r\nstrip and tile format and sizes while \\-B \\-L \\-c \\-f modify the endian addressing\r\nscheme, the compression options, and the bit fill sequence of images as they\r\nare written.\r\n.IP \r\nThose that perform some action on each image that is selected from the input file.\r\nThe options include \\-R for rotate, \\-I for inversion of the photometric \r\ninterpretation and/or data values, and \\-F to flip (mirror) the image horizontally\r\nor vertically.\r\n.PP \r\n\r\nFunctions are applied to the input image(s) in the following order:\r\ncropping, fixed area extraction, zone and region extraction, \r\ninversion, mirroring, rotation.\r\n.PP \r\nFunctions are applied to the output image(s) in the following order:\r\nexport mode options for grouping zones, regions, or images into\r\none or more files,\r\n.I or\r\nrow and column divisions with output margins,\r\n.I or\r\npage size divisions with page orientation options.\r\n.PP \r\nFinally, strip, tile, byte order, output resolution, and compression options are \r\napplied to all output images.\r\n.PP \r\nThe output file(s) may be organized and compressed using a different\r\nalgorithm from the input files.\r\nBy default, \r\n.I tiffcrop\r\nwill copy all the understood tags in a\r\n.SM TIFF\r\ndirectory of an input file to the associated directory in the output file.\r\nOptions can be used to force the resultant image to be written as strips \r\nor tiles of data, respectively.\r\n.PP \r\n.I Tiffcrop\r\ncan be used to reorganize the storage characteristics of data\r\nin a file, and to reorganize, extract, rotate, and otherwise\r\nprocess the image data as specified at the same time whereas \r\ntiffcp does not alter the image data within the file. \r\n.PP \r\nUsing the options for selecting individual input images and the \r\noptions for exporting images and/or segments defined as zones or\r\nregions of each input image,\r\n.I tiffcrop\r\ncan perform the functions of tiffcp and tiffsplit in a single pass\r\nwhile applying multiple operations to individual selections or images.\r\n.PP \r\n.SH \"OPTIONS\"\r\n.TP \r\n.B \\-h\r\nDisplay the syntax summary for tiffcrop.\r\n.TP \r\n.B \\-v\r\nReport the current version and last modification date for tiffcrop.\r\n.TP \r\n.B \\-N odd|even|#,#\\-#,#|last\r\nSpecify one or more series or range(s) of images within each file to process.\r\nThe words\r\n.B odd\r\nor\r\n.B even\r\nmay be used to specify all odd or even numbered images counting from one.\r\nNote that internally, TIFF images are numbered from zero rather than one\r\nbut since this convention is not obvious to most users, tiffcrop used 1\r\nto specifiy the first image in a multipage file.  The word\r\n.B last \r\nmay be used in place of a number in the sequence to indicate the \r\nfinal image in the file without knowing how many images there are.\r\nRanges of images may be specified with a dash and multiple sets\r\ncan be indicated by joining them in a comma\\-separated list. eg. use\r\n.B \\-N 1,5\\-7,last \r\nto process the 1st, 5th through 7th, and final image in the file.\r\n.TP \r\n.B \\-E top|bottom|left|right\r\nSpecify the top, bottom, left, or right edge as the reference from\r\nwhich to calcuate the width and length of crop regions or sequence\r\nof postions for zones. When used with the \\-e option for exporting\r\nzones or regions, the reference edge determines how composite images\r\nare arranged. Using \\-E left or right causes successive zones or \r\nregions to be merged horizontally whereas using \\-E top or bottom\r\ncauses successive zones or regions to be arranged vertically. This \r\noption has no effect on export layout when multiple zones or regions\r\nare not being exported to composite images. Edges may be abbreviated\r\nto the first letter.\r\n.TP \r\n.B \\-e combined|divided|image|multiple|separate\r\nSpecify the export mode for images and selections from input images.\r\nThe final filename on the command line is considered to be the \r\ndestination file or filename stem for automatically generated \r\nsequences of files. Modes may be abbreviated to the first letter.\r\n.IP \r\ncombined   All images and selections are written to a single file with\r\nmultiple selections from one image combined into a single image (default)\r\n.IP \r\ndivided    All images and selections are written to a single file\r\nwith each selection from one image written to a new image\r\n.IP \r\nimage      Each input image is written to a new file (numeric filename sequence)\r\nwith multiple selections from the image combined into one image\r\n.IP \r\nmultiple   Each input image is written to a new file (numeric filename sequence)\r\nwith each selection from the image written to a new image\r\n.IP \r\nseparate   Individual selections from each image are written to separate files\r\n.TP \r\n.B \\-U in|cm|px\r\nSpecify the type of units to apply to dimensions for margins and \r\ncrop regions for input and output images. Inches or centimeters \r\nare converted to pixels using the resolution unit specified in the \r\nTIFF file (which defaults to inches if not specified in the IFD).\r\n.TP \r\n.B \\-m #,#,#,#\r\nSpecify margins to be removed from the input image. The order must \r\nbe top, left, bottom, right with only commas separating the elements \r\nof the list. Margins are scaled according to the current units and \r\nremoved before any other extractions are computed..\r\n.TP \r\n.B \\-X #\r\nSet the horizontal (X\\-axis) dimension of a region to extract relative to \r\nthe specified origin reference. If the origin is the top or bottom\r\nedge, the X axis value will be assumed to start at the left edge.\r\n.TP \r\n.B \\-Y #\r\nSet the vertical (Y\\-axis) dimension of a region to extract relative to\r\nthe specified origin reference. If the origin is the left or right\r\nedge, the Y axis value will be assumed to start at the top.\r\n.TP \r\n.B \\-Z  #:#,#:#  \r\nSpecify zones of the image designated as position X of Y equal sized portions\r\nmeasured from the reference edge,  eg 1:3 would be first third of the\r\nimage starting from the reference edge minus any margins specified\r\nfor the confining edges. Multiple zones can be specified as a comma\r\nseparated list but they must reference the same edge. To extract the\r\ntop quarter and the bottom third of an image you would use \r\n.B \\-Z 1:4,3:3.\r\n.TP \r\n.B \\-z x1,y1,x2,y2: ... :xN,yN,xN+1,yN+1 \r\nSpecify a series of coordinates to define regions for processing and exporting.\r\nThe coordinates represent the top left and lower right corners of each region \r\nin the current units, eg inch, cm, or pixels. Pixels are counted from one to \r\nwidth or height and inches or cm are calculated from image resolution data.\r\n\r\nEach colon delimited series of four values represents the horizontal and vertical \r\noffsets from the top and left edges of the image, regardless of the edge specified\r\nwith the \\-E option. The first and third values represent the horizontal offsets of \r\nthe corner points from the left edge while the second and fourth values represent \r\nthe vertical offsets from the top edge.\r\n.TP \r\n.B \\-F horiz|vert\r\nFlip, ie mirror, the image or extracted region horizontally or vertically.\r\n.TP \r\n.B \\-R 90|180|270\r\nRotate the image or extracted region 90, 180, or 270 degrees clockwise.\r\n.TP \r\n.B \\\\-I [black|white|data|both]\r\nInvert color space, eg dark to light for bilevel and grayscale images.\r\nThis can be used to modify negative images to positive or to correct\r\nimages that have the PHOTOMETRIC_INTERPRETATIN tag set incorrectly.\r\nIf the value is black or white, the PHOTOMETRIC_INTERPRETATION tag is set to \r\nMinIsBlack or MinIsWhite, without altering the image data. If the argument \r\nis data or both, the data values of the image are modified. Specifying both \r\ninverts the data and the PHOTOMETRIC_INTERPRETATION tag, whereas using data\r\ninverts the data but not the PHOTOMETRIC_INTERPRETATION tag.\r\nNo support for modifying the color space of color images in this release.\r\n.TP \r\n.B \\-H #\r\nSet the horizontal resolution of output images to #\r\nexpressed in the current units.\r\n.TP \r\n.B \\-V #\r\nSet the vertical resolution of the output images to #\r\nexpressed in the current units.\r\n.TP \r\n.B \\-J #\r\nSet the horizontal margin of an output page size to #\r\nexpressed in the current units when sectioning image into columns x rows\r\nsubimages using the \\-S cols:rows option.\r\n.TP \r\n.B \\-K #\r\nSet the vertical margin of an output page size to # \r\nexpressed in the current units when sectioning image into columns x rows\r\nsubmiages using the \\-S cols:rows option.\r\n.TP\r\n.B \\-O portrait|landscape|auto\r\nSet the output orientation of the pages or sections.\r\nAuto will use the arrangement that requires the fewest pages.\r\nThis option is only meaningful in conjunction with the -P\r\noption to format an image to fit on a specific paper size.\r\n.TP \r\n.B \\-P page\r\nFormat the output images to fit on page size paper. Use\r\n\\-P list to show the supported page sizes and dimensions.\r\n.TP \r\n.B \\-S cols:rows\r\nDivide each image into cols across and rows down equal sections.\r\n.TP \r\n.B \\-B\r\nForce output to be written with Big\\-Endian byte order.\r\nThis option only has an effect when the output file is created or\r\noverwritten and not when it is appended to.\r\n.TP \r\n.B \\-C\r\nSuppress the use of ``strip chopping'' when reading images\r\nthat have a single strip/tile of uncompressed data.\r\n.TP \r\n.B \\-c\r\nSpecify the compression to use for data written to the output file:\r\n.B none \r\nfor no compression,\r\n.B packbits\r\nfor PackBits compression,\r\n.B lzw\r\nfor Lempel\\-Ziv & Welch compression,\r\n.B jpeg \r\nfor baseline JPEG compression.\r\n.B zip\r\nfor Deflate compression,\r\n.B g3\r\nfor CCITT Group 3 (T.4) compression,\r\nand\r\n.B g4\r\nfor CCITT Group 4 (T.6) compression.\r\nBy default\r\n.I tiffcrop\r\nwill compress data according to the value of the\r\n.I Compression\r\ntag found in the source file.\r\n.IP \r\nThe\r\n.SM CCITT\r\nGroup 3 and Group 4 compression algorithms can only\r\nbe used with bilevel data.\r\n.IP \r\nGroup 3 compression can be specified together with several\r\nT.4\\-specific options:\r\n.B 1d\r\nfor 1\\-dimensional encoding,\r\n.B 2d\r\nfor 2\\-dimensional encoding,\r\nand\r\n.B fill\r\nto force each encoded scanline to be zero\\-filled so that the\r\nterminating EOL code lies on a byte boundary.\r\nGroup 3\\-specific options are specified by appending a ``:''\\-separated\r\nlist to the ``g3'' option; e.g.\r\n.B \"\\-c g3:2d:fill\"\r\nto get 2D\\-encoded data with byte\\-aligned EOL codes.\r\n.IP \r\n.SM LZW\r\ncompression can be specified together with a \r\n.I predictor\r\nvalue.\r\nA predictor value of 2 causes\r\neach scanline of the output image to undergo horizontal\r\ndifferencing before it is encoded; a value\r\nof 1 forces each scanline to be encoded without differencing.\r\nLZW\\-specific options are specified by appending a ``:''\\-separated\r\nlist to the ``lzw'' option; e.g.\r\n.B \"\\-c lzw:2\"\r\nfor\r\n.SM LZW\r\ncompression with horizontal differencing.\r\n.TP \r\n.B \\-f\r\nSpecify the bit fill order to use in writing output data.\r\nBy default,\r\n.I tiffcrop\r\nwill create a new file with the same fill order as the original.\r\nSpecifying\r\n.B \"\\-f lsb2msb\"\r\nwill force data to be written with the FillOrder tag set to\r\n.SM LSB2MSB,\r\nwhile\r\n.B \"\\-f msb2lsb\"\r\nwill force data to be written with the FillOrder tag set to\r\n.SM MSB2LSB.\r\n.TP \r\n.B \\-i\r\nIgnore non\\-fatal read errors and continue processing of the input file.\r\n.TP \r\n.B \\-l\r\nSpecify the length of a tile (in pixels).\r\n.I Tiffcrop\r\nattempts to set the tile dimensions so\r\nthat no more than 8 kilobytes of data appear in a tile.\r\n.TP \r\n.B \\-L\r\nForce output to be written with Little\\-Endian byte order.\r\nThis option only has an effect when the output file is created or\r\noverwritten and not when it is appended to.\r\n.TP \r\n.B \\-M\r\nSuppress the use of memory\\-mapped files when reading images.\r\n.TP \r\n.B \\-p\r\nSpecify the planar configuration to use in writing image data\r\nthat has more than one sample per pixel.\r\nBy default,\r\n.I tiffcrop\r\nwill create a new file with the same planar configuration as\r\nthe original.\r\nSpecifying\r\n.B \"\\-p contig\"\r\nwill force data to be written with multi\\-sample data packed\r\ntogether, while\r\n.B \"\\-p separate\"\r\nwill force samples to be written in separate planes.\r\n.TP \r\n.B \\-r\r\nSpecify the number of rows (scanlines) in each strip of data\r\nwritten to the output file.\r\nBy default (or when value\r\n.B 0\r\nis specified),\r\n.I tiffcrop\r\nattempts to set the rows/strip that no more than 8 kilobytes of \r\ndata appear in a strip. If you specify the special value\r\n.B \\-1\r\nit will results in infinite number of the rows per strip. The entire image\r\nwill be the one strip in that case.\r\n.TP \r\n.B \\-s\r\nForce the output file to be written with data organized in strips\r\n(rather than tiles).\r\n.TP \r\n.B \\-t\r\nForce the output file to be written with data organized in tiles\r\n(rather than strips).\r\n.TP \r\n.B \\-w\r\nSpecify the width of a tile (in pixels).\r\n.I tiffcrop\r\nattempts to set the tile dimensions so\r\nthat no more than 8 kilobytes of data appear in a tile.\r\n.I tiffcrop\r\nattempts to set the tile dimensions so\r\nthat no more than 8 kilobytes of data appear in a tile.\r\n.TP\r\nDebug and dump facility\r\n.B \\-D opt1:value1,opt2:value2,opt3:value3:opt4:value4\r\nDisplay program progress and/or dump raw data to non\\-TIFF files.\r\nOptions include the following and must be joined as a comma\r\nseparated list. The use of this option is generally limited to\r\nprogram debugging and development of future options. An equal sign\r\nmay be substituted for the colon in option:value pairs.\r\n.IP\r\ndebug:N         Display limited program progress indicators where larger N\r\nincrease the level of detail.\r\n.IP\r\nformat:txt|raw  Format any logged data as ASCII text or raw binary \r\nvalues. ASCII text dumps include strings of ones and zeroes representing\r\nthe binary values in the image data plus identifying headers.\r\n.IP\r\nlevel:N         Specify the level of detail presented in the dump files.\r\nThis can vary from dumps of the entire input or output image data to dumps\r\nof data processed by specific functions. Current range of levels is 1 to 3.\r\n.IP\r\ninput:full\\-path\\-to\\-directory/input\\-dumpname\r\n.IP\r\noutput:full\\-path\\-to\\-directory/output\\-dumpname\r\n.IP\r\nWhen dump files are being written, each image will be written to a separate\r\nfile with the name built by adding a numeric sequence value to the dumpname\r\nand an extension of .txt for ASCII dumps or .bin for binary dumps.\r\n\r\nThe four debug/dump options are independent, though it makes little sense to\r\nspecify a dump file without specifying a detail level.\r\n.IP\r\nNote: Tiffcrop may be compiled with -DDEVELMODE to enable additional very\r\n low level debug reporting.\r\n.SH \"EXAMPLES\"\r\nThe following concatenates two files and writes the result using \r\n.SM LZW\r\nencoding:\r\n.RS\r\n.nf \r\ntiffcrop \\-c lzw a.tif b.tif result.tif\r\n.fi \r\n.RE\r\n.PP \r\nTo convert a G3 1d\\-encoded \r\n.SM TIFF\r\nto a single strip of G4\\-encoded data the following might be used:\r\n.RS\r\n.nf \r\ntiffcrop \\-c g4 \\-r 10000 g3.tif g4.tif\r\n.fi \r\n.RE\r\n(1000 is just a number that is larger than the number of rows in\r\nthe source file.)\r\n\r\nTo extract a selected set of images from a multi\\-image TIFF file \r\nuse the \\-N option described above. Thus, to copy the 1st and 3rd\r\nimages of image file \"album.tif\" to \"result.tif\":\r\n.RS\r\n.nf \r\ntiffcrop \\-N 1,3 album.tif result.tif\r\n.fi \r\n.RE\r\n.PP \r\nInvert a bilevel image scan of a microfilmed document and crop off margins of\r\n0.25 inches on the left and right, 0.5 inch on the top, and 0.75 inch on the\r\nbottom. From the remaining portion of the image, select the second and third\r\nquarters, ie, one half of the area left from the center to each margin. \r\n.RS\r\ntiffcrop \\-U in \\-m 0.5,0.25,0.75,0.25 \\-E left \\-Z 2:4,3:4 \\-I both MicrofilmNegative.tif MicrofilmPostiveCenter.tif\r\n.fi \r\n.RE\r\n.PP \r\nExtract only the final image of a large Architectural E sized \r\nmultipage TIFF file and rotate it 90 degrees clockwise while \r\nreformatting the output to fit on tabloid sized sheets with one \r\nquarter of an inch on each side:\r\n.RS\r\ntiffcrop \\-N last \\-R 90 \\-O auto \\-P tabloid \\-U in \\-J 0.25 \\-K 0.25 \\-H 300 \\-V 300 Big\\-PlatMap.tif BigPlatMap\\-Tabloid.tif \r\n.fi \r\n.RE\r\nThe output images will have a specified resolution of 300 dpi in both\r\ndirections. The orientation of each page will be determined by whichever\r\nchoice requires the fewest pages. To specify a specific orientation, use\r\nthe portrait or landscape option. The paper size option does not resample\r\nthe image. It breaks each original image into a series of smaller images\r\nthat will fit on the target paper size at the specified resolution.\r\n.fi \r\n.RE\r\n.PP \r\nExtract two regions 2048 pixels wide by 2048 pixels high from each page of\r\na multi\\-page input file and write each region to a separate output file.\r\n.RS\r\ntiffcrop \\-U px \\-z 1,1,2048,2048:1,2049,2048,4097 \\-e separate  CheckScans.tiff Check\r\n.fi \r\n.RE\r\nThe output file names will use the stem Check with a numeric suffix which is\r\nincremented for each region of each image, eg Check\\-001.tiff, Check\\-002.tiff ...\r\nCheck\\-NNN.tiff. To produce a unique file for each page of the input image\r\nwith one new image for each region of the input image on that page, change\r\nthe export option to \\-e multiple.\r\n\r\n.SH \"NOTES\"\r\n.PP \r\nIn general, bilevel, grayscale, palette and RGB(A) data with bit depths\r\nfrom 1 to 32 bits should work in both interleaved and separate plane\r\nformats. Unlike tiffcp, tiffcrop can read and write tiled images with\r\nbits per sample that are not a multiple of 8 in both interleaved and\r\nseparate planar format. Floating point data types are supported at \r\nbit depts of 16, 24, 32 and 64 bits per sample. \r\n.PP\r\nNot all images can be converted from one compression scheme to another.\r\nData with some photometric interpretations and/or bit depths are tied to \r\nspecific compression schemes and vice-versa, e.g. Group 3/4 compression\r\nis only usable for bilevel data. JPEG compression is only useable on 8\r\nbit per sample data (or 12 bit if \r\n.I LibTIFF\r\nwas compiled with 12 bit JPEG support). Support for OJPEG compressed \r\nimages is problematic at best. Since OJPEG compression is no longer \r\nsupported for writing images with LibTIFF, these images will be updated\r\nto the newer JPEG compression when they are copied or processed. This\r\nmay cause the image to appear color shifted or distorted after conversion.\r\nIn some cases, it is possible to remove the original compression from \r\nimage data using the option -cnone.\r\n.PP\r\nTiffcrop does not currently provide options to up or downsample data to \r\ndifferent bit depths or convert data from one photometric interpretation \r\nto another, e.g. 16 bits per sample to 8 bits per sample or RGB to grayscale. \r\n.PP\r\nTiffcrop is very loosely derived from code in\r\n.I tiffcp\r\nwith extensive modifications and additions to support the selection of input \r\nimages and regions and the exporting of them to one or more output files in \r\nvarious groupings. The image manipulation routines are entirely new and \r\nadditional ones may be added in the future. It will handle tiled images with \r\nbit depths that are not a multiple of eight that tiffcp may refuse to read.\r\n.PP \r\n.I Tiffcrop\r\nwas designed to handle large files containing many moderate sized images \r\nwith memory usage that is independent of the number of images in the file. \r\nIn order to support compression modes that are not based on individual \r\nscanlines, e.g. JPEG, it now reads images by strip or tile rather than by \r\nindvidual scanlines. In addition to the memory required by the input and \r\noutput buffers associated with\r\n.I LibTIFF\r\none or more buffers at least as large as the largest image to be read are\r\nrequired. The design favors large volume document processing uses over \r\nscientific or graphical manipulation of large datasets as might be found \r\nin research or remote sensing scenarios.\r\n.SH \"SEE ALSO\"\r\n.BR pal2rgb (1),\r\n.BR tiffinfo (1),\r\n.BR tiffcmp (1),\r\n.BR tiffcp (1),\r\n.BR tiffmedian (1),\r\n.BR tiffsplit (1),\r\n.BR libtiff (3TIFF)\r\n.PP \r\nLibtiff library home page:\r\n.BR http://www.remotesensing.org/libtiff/\r\n\r\n"
  },
  {
    "path": "src/main/jni/tiff/man/tiffdither.1",
    "content": ".\\\" $Id: tiffdither.1,v 1.4 2006/04/20 12:17:19 dron Exp $\n.\\\"\n.\\\" Copyright (c) 1990-1997 Sam Leffler\n.\\\" Copyright (c) 1991-1997 Silicon Graphics, Inc.\n.\\\"\n.\\\" Permission to use, copy, modify, distribute, and sell this software and \n.\\\" its documentation for any purpose is hereby granted without fee, provided\n.\\\" that (i) the above copyright notices and this permission notice appear in\n.\\\" all copies of the software and related documentation, and (ii) the names of\n.\\\" Sam Leffler and Silicon Graphics may not be used in any advertising or\n.\\\" publicity relating to the software without the specific, prior written\n.\\\" permission of Sam Leffler and Silicon Graphics.\n.\\\" \n.\\\" THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n.\\\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n.\\\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n.\\\" \n.\\\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n.\\\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n.\\\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n.\\\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n.\\\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n.\\\" OF THIS SOFTWARE.\n.\\\"\n.if n .po 0\n.TH TIFFDITHER 1 \"September 20, 2005\" \"libtiff\"\n.SH NAME\ntiffdither \\- convert a greyscale image to bilevel using dithering\n.SH SYNOPSIS\n.B tiffdither\n[\n.I options\n]\n.I input.tif\n.I output.tif\n.SH DESCRIPTION\n.I tiffdither\nconverts a single channel 8-bit greyscale image to a bilevel image\nusing Floyd-Steinberg error propagation with thresholding.\n.SH OPTIONS\n.TP\n.B \\-c\nSpecify the compression to use for data written to the output file:\n.B none \nfor no compression,\n.B packbits\nfor PackBits compression,\n.B lzw\nfor Lempel-Ziv & Welch compression,\n.B zip\nfor Deflate compression,\n.B g3\nfor CCITT Group 3 (T.4) compression,\nand\n.B g4\nfor CCITT Group 4 (T.6) compression.\nBy default\n.I tiffdither\nwill compress data according to the value of the\n.I Compression\ntag found in the source file.\n.IP\nThe\n.SM CCITT\nGroup 3 and Group 4 compression algorithms can only\nbe used with bilevel data.\n.IP\nGroup 3 compression can be specified together with several\nT.4-specific options:\n.B 1d\nfor 1-dimensional encoding,\n.B 2d\nfor 2-dimensional encoding,\nand\n.B fill\nto force each encoded scanline to be zero-filled so that the\nterminating EOL code lies on a byte boundary.\nGroup 3-specific options are specified by appending a ``:''-separated\nlist to the ``g3'' option; e.g.\n.B \"\\-c g3:2d:fill\"\nto get 2D-encoded data with byte-aligned EOL codes.\n.IP\n.SM LZW\ncompression can be specified together with a \n.I predictor\nvalue.\nA predictor value of 2 causes\neach scanline of the output image to undergo horizontal\ndifferencing before it is encoded; a value\nof 1 forces each scanline to be encoded without differencing.\nLZW-specific options are specified by appending a ``:''-separated\nlist to the ``lzw'' option; e.g.\n.B \"\\-c lzw:2\"\nfor\n.SM LZW\ncompression with horizontal differencing.\n.TP\n.B \\-f\nSpecify the bit fill order to use in writing output data.\nBy default,\n.I tiffdither\nwill create a new file with the same fill order as the original.\nSpecifying\n.B \"\\-f lsb2msb\"\nwill force data to be written with the\n.I Fill\\%Order\ntag set to\n.SM LSB2MSB ,\nwhile\n.B \"\\-f msb2lsb\"\nwill force data to be written with the\n.I Fill\\%Order\ntag set to\n.SM MSB2LSB .\n.TP\n.B \\-t\nSet the threshold value for dithering.\nBy default the threshold value is 128.\n.SH NOTES\nThe dither algorithm is taken from the\n.BR tiffmedian (1)\nprogram (written by Paul Heckbert).\n.SH \"SEE ALSO\"\n.BR pal2rgb (1),\n.BR fax2tiff (1),\n.BR tiffinfo (1),\n.BR tiffcp (1),\n.BR tiff2bw (1),\n.BR libtiff (3TIFF)\n.PP\nLibtiff library home page:\n.BR http://www.remotesensing.org/libtiff/\n"
  },
  {
    "path": "src/main/jni/tiff/man/tiffdump.1",
    "content": ".\\\" $Id: tiffdump.1,v 1.5 2006/04/20 12:17:19 dron Exp $\n.\\\"\n.\\\" Copyright (c) 1988-1997 Sam Leffler\n.\\\" Copyright (c) 1991-1997 Silicon Graphics, Inc.\n.\\\"\n.\\\" Permission to use, copy, modify, distribute, and sell this software and \n.\\\" its documentation for any purpose is hereby granted without fee, provided\n.\\\" that (i) the above copyright notices and this permission notice appear in\n.\\\" all copies of the software and related documentation, and (ii) the names of\n.\\\" Sam Leffler and Silicon Graphics may not be used in any advertising or\n.\\\" publicity relating to the software without the specific, prior written\n.\\\" permission of Sam Leffler and Silicon Graphics.\n.\\\" \n.\\\" THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n.\\\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n.\\\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n.\\\" \n.\\\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n.\\\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n.\\\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n.\\\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n.\\\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n.\\\" OF THIS SOFTWARE.\n.\\\"\n.if n .po 0\n.TH TIFFDUMP 1 \"October 23, 2005\" \"libtiff\"\n.SH NAME\ntiffdump \\- print verbatim information about\n.SM TIFF\nfiles\n.SH SYNOPSIS\n.B tiffdump\n[\n.I options\n]\n.I \"name \\&...\"\n.SH DESCRIPTION\n.I tiffdump\ndisplays directory information from files created according\nto the Tag Image File Format, Revision 6.0.\nThe header of each\n.SM TIFF\nfile (magic number, version, and first directory offset)\nis displayed, followed by the tag contents of each directory in the file.\nFor each tag, the name, data type, count, and value(s) is displayed.\nWhen the symbolic name for a tag or data type is known, the symbolic\nname is displayed followed by it's numeric (decimal) value.\nTag values are displayed enclosed in ``<>'' characters immediately\npreceded by the value of the count field.\nFor example, an\n.I ImageWidth\ntag might be displayed as ``ImageWidth (256) SHORT (3) 1<800>''.\n.PP\n.I tiffdump\nis particularly useful for investigating the contents of\n.SM TIFF\nfiles that\n.I libtiff\ndoes not understand.\n.SH OPTIONS\n.TP\n.B \\-h\nForce numeric data to be printed in hexadecimal rather than the\ndefault decimal.\n.TP\n.BI \\-m \" items\"\nChange the number of indirect data items that are printed. By default, this\nwill be 24.\n.TP\n.BI \\-o \" offset\"\nDump the contents of the \n.SM IFD\nat the a particular file offset.\nThe file offset may be specified using the usual C-style syntax;\ni.e. a leading ``0x'' for hexadecimal and a leading ``0'' for octal.\n.SH \"SEE ALSO\"\n.BR tiffinfo (1),\n.BR libtiff (3TIFF)\n.PP\nLibtiff library home page:\n.BR http://www.remotesensing.org/libtiff/\n"
  },
  {
    "path": "src/main/jni/tiff/man/tiffgt.1",
    "content": ".\\\" $Id: tiffgt.1,v 1.4 2006/04/20 12:17:19 dron Exp $\n.\\\"\n.\\\" Copyright (c) 1988-1997 Sam Leffler\n.\\\" Copyright (c) 1991-1997 Silicon Graphics, Inc.\n.\\\"\n.\\\" Permission to use, copy, modify, distribute, and sell this software and \n.\\\" its documentation for any purpose is hereby granted without fee, provided\n.\\\" that (i) the above copyright notices and this permission notice appear in\n.\\\" all copies of the software and related documentation, and (ii) the names of\n.\\\" Sam Leffler and Silicon Graphics may not be used in any advertising or\n.\\\" publicity relating to the software without the specific, prior written\n.\\\" permission of Sam Leffler and Silicon Graphics.\n.\\\" \n.\\\" THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n.\\\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n.\\\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n.\\\" \n.\\\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n.\\\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n.\\\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n.\\\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n.\\\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n.\\\" OF THIS SOFTWARE.\n.\\\"\n.if n .po 0\n.TH TIFFGT 1 \"September 20, 2005\" \"libtiff\"\n.SH NAME\ntiffgt \\- display an image stored in a\n.SM TIFF\nfile (Silicon Graphics version)\n.SH SYNOPSIS\n.B tiffgt\n[\n.I options\n]\n.I \"input.tif ...\"\n.SH DESCRIPTION\n.I tiffgt\ndisplays one or more images stored using the\nTag Image File Format, Revision 6.0.\nEach image is placed in a fixed size window that the\nuser must position on the display (unless configured\notherwise through X defaults).\nIf the display has fewer than 24 bitplanes, or if the\nimage does not warrant full color, then\n.SM RGB\ncolor values are mapped to the closest values that exist in\nthe colormap (this is done using the\n.I rgbi\nroutine found in the graphics utility library\n.BR \\-lgutil .)\n.PP\n.I tiffgt\ncorrectly handles files with any of the following characteristics:\n.sp .5\n.in +0.5i\n.ta \\w'\\fIPhotometricInterpretation\\fP  'u\n.nf\n\\fIBitsPerSample\\fP\t1, 2, 4, 8, 16\n\\fISamplesPerPixel\\fP\t1, 3, 4 (the 4th sample is ignored)\n\\fIPhotometricInterpretation\\fP\t0 (min-is-white), 1 (min-is-black), 2 (RGB), 3 (palette), 6 (YCbCr)\n\\fIPlanarConfiguration\\fP\t1 (contiguous), 2 (separate)\n\\fIOrientation\\fP\t1 (top-left), 4 (bottom-left)\n.fi\n.in -0.5i\n.sp .5\nData may be organized as strips or tiles and may be\ncompressed with any of the compression algorithms supported\nby the \n.IR libtiff (3)\nlibrary.\n.PP\nFor palette images (\\c\n.IR PhotometricInterpretation =3),\n.I tiffgt\ninspects the colormap values and assumes either 16-bit\nor 8-bit values according to the maximum value.\nThat is, if no colormap entry greater than 255 is found,\n.I tiffgt\nassumes the colormap has only 8-bit values; otherwise\nit assumes 16-bit values.\nThis inspection is done to handle old images written by\nprevious (incorrect) versions of\n.IR libtiff .\n.PP\n.I tiffgt\ncan be used to display multiple images one-at-a-time.\nThe left mouse button switches the display to the first image in the\n.I next\nfile in the list of files specified on the command line.\nThe right mouse button switches to the first image in the\n.I previous\nfile in the list.\nThe middle mouse button causes the first image in the first file\nspecified on the command line to be displayed.\nIn addition the following keyboard commands are recognized:\n.TP\n.B b\nUse a\n.I PhotometricInterpretation\nof MinIsBlack in displaying the current image.\n.TP\n.B l\nUse a\n.I FillOrder\nof lsb-to-msb in decoding the current image.\n.TP\n.B m\nUse a\n.I FillOrder\nof msb-to-lsb in decoding the current image.\n.TP\n.B c\nUse a colormap visual to display the current image.\n.TP\n.B r\nUse a true color (24-bit RGB) visual to display the current image.\n.TP\n.B w\nUse a\n.I PhotometricInterpretation\nof MinIsWhite in displaying the current image.\n.TP\n.B W\nToggle (enable/disable) display of warning messages from the\n.SM TIFF\nlibrary when decoding images.\n.TP\n.B E\nToggle (enable/disable) display of error messages from the\n.SM TIFF\nlibrary when decoding images.\n.TP\n.B z\nReset all parameters to their default settings (\\c\n.IR FillOrder ,\n.IR PhotometricInterpretation ,\nhandling of warnings and errors).\n.TP\n.B PageUp\nDisplay the previous image in the current file or the last\nimage in the previous file.\n.TP\n.B PageDown\nDisplay the next image in the current file or the first image\nin the next file.\n.TP\n.B Home\nDisplay the first image in the current file.\n.TP\n.B End\nDisplay the last image in the current file (unimplemented).\n.SH OPTIONS\n.TP\n.B \\-c\nForce image display in a colormap window.\n.TP\n.B \\-d\nSpecify an image to display by directory number.\nBy default the first image in the file is displayed.\nDirectories are numbered starting at zero.\n.TP\n.B \\-e\nEnable reporting of error messages from the \n.SM TIFF\nlibrary.\nBy default\n.I tiffgt\nsilently ignores images that cannot be read.\n.TP\n.B \\-f\nForce \n.I tiffgt\nto run as a foreground process.\nBy default\n.I tiffgt\nwill place itself in the background once it has opened the\nrequested image file.\n.TP\n.B \\-l\nForce the presumed bit ordering to be\n.SM LSB\nto\n.SM MSB.\n.TP\n.B \\-m\nForce the presumed bit ordering to be\n.SM MSB\nto\n.SM LSB.\n.TP\n.B \\-o\nSpecify an image to display by directory offset.\nBy default the first image in the file is displayed.\nDirectories offsets may be specified using C-style syntax;\ni.e. a leading ``0x'' for hexadecimal and a leading ``0'' for octal.\n.TP\n.B \\-p\nOverride the value of the\n.I PhotometricInterpretation\ntag; the parameter may be one of:\n.BR miniswhite ,\n.BR minisblack ,\n.BR rgb ,\n.BR palette ,\n.BR mask ,\n.BR separated ,\n.BR ycbcr ,\nand\n.BR cielab .\n.TP\n.B \\-r\nForce image display in a full color window.\n.TP\n.B \\-s\nStop on the first read error.\nBy default all errors in the input data are ignored and \n.I tiffgt\ndoes it's best to display as much of an image as possible.\n.TP\n.B \\-w\nEnable reporting of warning messages from the \n.SM TIFF\nlibrary.\nBy default\n.I tiffgt\nignores warning messages generated when reading an image.\n.TP\n.B \\-v\nPlace information in the title bar describing\nwhat type of window (full color or colormap) is being\nused, the name of the input file, and the directory\nindex of the image (if non-zero).\nBy default, the window type is not shown in the title bar.\n.SH BUGS\nImages wider and taller than the display are silently truncated to avoid\ncrashing old versions of the window manager.\n.SH \"SEE ALSO\"\n.BR tiffdump (1),\n.BR tiffinfo (1),\n.BR tiffcp (1),\n.BR libtiff (3TIFF)\n.PP\nLibtiff library home page:\n.BR http://www.remotesensing.org/libtiff/\n"
  },
  {
    "path": "src/main/jni/tiff/man/tiffinfo.1",
    "content": ".\\\" $Id: tiffinfo.1,v 1.2 2005/11/02 11:07:19 dron Exp $\n.\\\"\n.\\\" Copyright (c) 1988-1997 Sam Leffler\n.\\\" Copyright (c) 1991-1997 Silicon Graphics, Inc.\n.\\\"\n.\\\" Permission to use, copy, modify, distribute, and sell this software and \n.\\\" its documentation for any purpose is hereby granted without fee, provided\n.\\\" that (i) the above copyright notices and this permission notice appear in\n.\\\" all copies of the software and related documentation, and (ii) the names of\n.\\\" Sam Leffler and Silicon Graphics may not be used in any advertising or\n.\\\" publicity relating to the software without the specific, prior written\n.\\\" permission of Sam Leffler and Silicon Graphics.\n.\\\" \n.\\\" THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n.\\\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n.\\\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n.\\\" \n.\\\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n.\\\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n.\\\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n.\\\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n.\\\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n.\\\" OF THIS SOFTWARE.\n.\\\"\n.if n .po 0\n.TH TIFFINFO 1 \"November 2, 2005\" \"libtiff\"\n.SH NAME\ntiffinfo \\- print information about\n.SM TIFF\nfiles\n.SH SYNOPSIS\n.B tiffinfo\n[\n.I options\n]\n.I \"input.tif \\&...\"\n.SH DESCRIPTION\n.I Tiffinfo\ndisplays information about files created according\nto the Tag Image File Format, Revision 6.0.\nBy default, the contents of each\n.SM TIFF\ndirectory in each file\nis displayed, with the value of each tag shown symbolically\n(where sensible).\n.SH OPTIONS\n.TP\n.B \\-c\nDisplay the colormap and color/gray response curves, if present.\n.TP\n.B \\-D\nIn addition to displaying the directory tags,\nread and decompress all the data in each image (but not display it).\n.TP\n.B \\-d\nIn addition to displaying the directory tags,\nprint each byte of decompressed data in hexadecimal.\n.TP\n.B \\-j\nDisplay any \\s-2JPEG\\s0-related tags that are present.\n.TP\n.B \\-o\nSet the initial\n.SM TIFF\ndirectory according to the specified file offset.\nThe file offset may be specified using the usual C-style syntax;\ni.e. a leading ``0x'' for hexadecimal and a leading ``0'' for octal.\n.TP\n.B \\-s\nDisplay the offsets and byte counts for each data strip in a directory.\n.TP\n.B \\-z\nEnable strip chopping when reading image data.\n.TP\n.B \\-#\nSet the initial\n.SM TIFF\ndirectory to\n.IR # .\n.SH \"SEE ALSO\"\n.BR pal2rgb (1),\n.BR tiffcp (1),\n.BR tiffcmp (1),\n.BR tiffmedian (1),\n.BR libtiff (3TIFF)\n.PP\nLibtiff library home page:\n.BR http://www.remotesensing.org/libtiff/\n"
  },
  {
    "path": "src/main/jni/tiff/man/tiffmedian.1",
    "content": ".\\\" $Id: tiffmedian.1,v 1.3 2005/11/02 11:07:19 dron Exp $\n.\\\"\n.\\\" Copyright (c) 1990-1997 Sam Leffler\n.\\\" Copyright (c) 1991-1997 Silicon Graphics, Inc.\n.\\\"\n.\\\" Permission to use, copy, modify, distribute, and sell this software and \n.\\\" its documentation for any purpose is hereby granted without fee, provided\n.\\\" that (i) the above copyright notices and this permission notice appear in\n.\\\" all copies of the software and related documentation, and (ii) the names of\n.\\\" Sam Leffler and Silicon Graphics may not be used in any advertising or\n.\\\" publicity relating to the software without the specific, prior written\n.\\\" permission of Sam Leffler and Silicon Graphics.\n.\\\" \n.\\\" THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n.\\\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n.\\\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n.\\\" \n.\\\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n.\\\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n.\\\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n.\\\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n.\\\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n.\\\" OF THIS SOFTWARE.\n.\\\"\n.if n .po 0\n.TH TIFFMEDIAN 1 \"November 2, 2005\" \"libtiff\"\n.SH NAME\ntiffmedian \\- apply the median cut algorithm to data in a\n.SM TIFF\nfile\n.SH SYNOPSIS\n.B tiffmedian\n[\n.I options\n]\n.I input.tif\n.I output.tif\n.SH DESCRIPTION\n.I tiffmedian\napplies the median cut algorithm to an\n.SM RGB\nimage in\n.I input.tif\nto generate a palette image that is written to\n.IR output.tif .\nThe generated colormap has, by default, 256 entries.\nThe image data is quantized by mapping each\npixel to the closest color values in the colormap.\n.SH OPTIONS\n.TP\n.B \\-c\nSpecify the compression to use for data written to the output file:\n.B none \nfor no compression,\n.B packbits\nfor PackBits compression,\n.B lzw\nfor Lempel-Ziv & Welch compression,\nand\n.B zip\nfor Deflate compression.\nBy default\n.I tiffmedian\nwill compress data according to the value of the\n.I Compression\ntag found in the source file.\n.IP\n.SM LZW\ncompression can be specified together with a \n.I predictor\nvalue.\nA predictor value of 2 causes\neach scanline of the output image to undergo horizontal\ndifferencing before it is encoded; a value\nof 1 forces each scanline to be encoded without differencing.\nLZW-specific options are specified by appending a ``:''-separated\nlist to the ``lzw'' option; e.g.\n.B \"\\-c lzw:2\"\nfor\n.SM LZW\ncompression with horizontal differencing.\n.TP\n.B \\-C\nSpecify the number of entries to use in the generated colormap.\nBy default all 256 entries/colors are used.\n.TP\n.B \\-f\nApply Floyd-Steinberg dithering before selecting a colormap entry.\n.TP\n.B \\-r\nSpecify the number of rows (scanlines) in each strip of data\nwritten to the output file.\nBy default,\n.I tiffmedian\nattempts to set the rows/strip\nthat no more than 8 kilobytes of data appear in a strip.\n.SH NOTES\nThis program is derived from Paul Heckbert's\n.I median\nprogram.\n.SH \"SEE ALSO\"\n.BR pal2rgb (1),\n.BR tiffinfo (1),\n.BR tiffcp (1),\n.BR tiffcmp (1),\n.BR libtiff (3TIFF)\n.PP\n.BR \"Color Image Quantization for Frame Buffer Display\",\nPaul Heckbert, SIGGRAPH proceedings, 1982, pp. 297-307.\n.PP\nLibtiff library home page:\n.BR http://www.remotesensing.org/libtiff/\n"
  },
  {
    "path": "src/main/jni/tiff/man/tiffset.1",
    "content": ".\\\" $Id: tiffset.1,v 1.3 2006/04/20 12:17:19 dron Exp $\n.\\\"\n.\\\" Copyright (c) 1988-1997 Sam Leffler\n.\\\" Copyright (c) 1991-1997 Silicon Graphics, Inc.\n.\\\"\n.\\\" Permission to use, copy, modify, distribute, and sell this software and \n.\\\" its documentation for any purpose is hereby granted without fee, provided\n.\\\" that (i) the above copyright notices and this permission notice appear in\n.\\\" all copies of the software and related documentation, and (ii) the names of\n.\\\" Sam Leffler and Silicon Graphics may not be used in any advertising or\n.\\\" publicity relating to the software without the specific, prior written\n.\\\" permission of Sam Leffler and Silicon Graphics.\n.\\\" \n.\\\" THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n.\\\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n.\\\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n.\\\" \n.\\\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n.\\\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n.\\\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n.\\\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n.\\\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n.\\\" OF THIS SOFTWARE.\n.\\\"\n.if n .po 0\n.TH TIFFSET 1 \"November 21, 2004\" \"libtiff\"\n.SH NAME\ntiffset \\- set a field in a\n.SM TIFF\nheader\n.SH SYNOPSIS\n.B tiffset\n[\n.I options\n]\n.I filename.tif\n.SH DESCRIPTION\n.I Tiffset\nsets the value of a\n.SM TIFF\nheader to a specified value.\n.SH OPTIONS\n.TP\n.BI \\-s \" tagnumber\" \"\\fR [\\fP\" \" count\" \"\\fR ]\\fP\" \" value ...\"\nSet the value of the named tag to the value or values specified.\n.TP\n.BI \\-sf \" tagnumber filename\"\nSet the value of the tag to the contents of filename.  This option is\nsupported for ASCII tags only.\n.SH EXAMPLES\nThe following example sets the image description tag (270) of a.tif to\nthe contents of the file descrip:\n.RS\n.nf\ntiffset \\-sf 270 descrip a.tif\n.fi\n.RE\n.PP\nThe following example sets the artist tag (315) of a.tif to the string\n``Anonymous'':\n.RS\n.nf\ntiffset \\-s 305 Anonymous a.tif\n.fi\n.RE\n.PP\nThis example sets the resolution of the file a.tif to 300 dpi:\n.RS\n.nf\ntiffset \\-s 296 2 a.tif\ntiffset \\-s 282 300.0 a.tif\ntiffset \\-s 283 300.0 a.tif\n.fi\n.RE\n.SH \"SEE ALSO\"\n.BR tiffdump (1),\n.BR tiffinfo (1),\n.BR tiffcp (1),\n.BR libtiff (3TIFF)\n.PP\nLibtiff library home page:\n.BR http://www.remotesensing.org/libtiff/\n"
  },
  {
    "path": "src/main/jni/tiff/man/tiffsplit.1",
    "content": ".\\\" $Id: tiffsplit.1,v 1.5 2005/11/02 11:07:19 dron Exp $\n.\\\"\n.\\\" Copyright (c) 1992-1997 Sam Leffler\n.\\\" Copyright (c) 1992-1997 Silicon Graphics, Inc.\n.\\\"\n.\\\" Permission to use, copy, modify, distribute, and sell this software and \n.\\\" its documentation for any purpose is hereby granted without fee, provided\n.\\\" that (i) the above copyright notices and this permission notice appear in\n.\\\" all copies of the software and related documentation, and (ii) the names of\n.\\\" Sam Leffler and Silicon Graphics may not be used in any advertising or\n.\\\" publicity relating to the software without the specific, prior written\n.\\\" permission of Sam Leffler and Silicon Graphics.\n.\\\" \n.\\\" THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n.\\\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n.\\\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n.\\\" \n.\\\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n.\\\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n.\\\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n.\\\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n.\\\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n.\\\" OF THIS SOFTWARE.\n.\\\"\n.if n .po 0\n.TH TIFFSPLIT 1 \"September 20, 2005\" \"libtiff\"\n.SH NAME\ntiffsplit \\- split a multi-image\n.SM TIFF\ninto single-image\n.SM TIFF\nfiles\n.SH SYNOPSIS\n.B tiffsplit\n.I src.tif\n[\n.I prefix\n]\n.SH DESCRIPTION\n.I tiffsplit\ntakes a multi-directory (page)\n.SM TIFF\nfile and creates one or more single-directory (page)\n.SM TIFF\nfiles from it.\nThe output files are given names created by concatenating\na prefix, a lexically ordered\nsuffix in the range [\\fIaaa\\fP-\\fIzzz\\fP], the suffix\n.I .tif \n(e.g. \n.IR xaaa.tif ,\n.IR xaab.tif ,\n\\...\n.IR xzzz.tif ).\nIf a prefix is not specified on the command line,\nthe default prefix of\n.I x\nis used.\n.SH OPTIONS\nNone.\n.SH BUGS\nOnly a select set of ``known tags'' is copied when splitting.\n.SH \"SEE ALSO\"\n.BR tiffcp (1),\n.BR tiffinfo (1),\n.BR libtiff (3TIFF)\n.PP\nLibtiff library home page:\n.BR http://www.remotesensing.org/libtiff/\n"
  },
  {
    "path": "src/main/jni/tiff/man/tiffsv.1",
    "content": ".\\\" $Id: tiffsv.1,v 1.3 2005/11/02 11:07:19 dron Exp $\n.\\\"\n.\\\" Copyright (c) 1988-1997 Sam Leffler\n.\\\" Copyright (c) 1991-1997 Silicon Graphics, Inc.\n.\\\"\n.\\\" Permission to use, copy, modify, distribute, and sell this software and \n.\\\" its documentation for any purpose is hereby granted without fee, provided\n.\\\" that (i) the above copyright notices and this permission notice appear in\n.\\\" all copies of the software and related documentation, and (ii) the names of\n.\\\" Sam Leffler and Silicon Graphics may not be used in any advertising or\n.\\\" publicity relating to the software without the specific, prior written\n.\\\" permission of Sam Leffler and Silicon Graphics.\n.\\\" \n.\\\" THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n.\\\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n.\\\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n.\\\" \n.\\\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n.\\\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n.\\\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n.\\\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n.\\\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n.\\\" OF THIS SOFTWARE.\n.\\\"\n.if n .po 0\n.TH TIFFSV 1 \"September 20, 2005\" \"libtiff\"\n.SH NAME\ntiffsv \\- save an image from the framebuffer in a\n.SM TIFF\nfile (Silicon Graphics version)\n.SH SYNOPSIS\n.B tiffsv\n[\n.I options\n]\n.I output.tif\n[\n.I \"x1 x2 y1 y2\"\n]\n.SH DESCRIPTION\n.I tiffsv\nsaves all or part of the framebuffer in a file using the\nTag Image File Format, Revision 6.0.\nBy default, the image is saved with data samples packed (\\c\n.IR PlanarConfiguration =1),\ncompressed with the Lempel-Ziv & Welch algorithm (\\c\n.IR Compression =5),\nand with each strip no more than 8 kilobytes.\nThese characteristics can be overridden, or explicitly specified\nwith the options described below.\n.SH OPTIONS\n.TP\n.B \\-b\nSave the image as a greyscale image\nas if it were processed by \n.IR tiff2bw (1).\nThis option is included for compatibility with the standard\n.IR scrsave (6D)\nprogram.\n.TP\n.B \\-c\nSpecify the compression to use for data written to the output file:\n.B none \nfor no compression,\n.B packbits\nfor PackBits compression,\n.B jpeg\nfor baseline JPEG compression,\n.B zip\nfor Deflate compression,\nand\n.B lzw\nfor Lempel-Ziv & Welch compression (default).\n.IP\n.SM LZW\ncompression can be specified together with a \n.I predictor\nvalue.\nA predictor value of 2 causes\neach scanline of the output image to undergo horizontal\ndifferencing before it is encoded; a value\nof 1 forces each scanline to be encoded without differencing.\nLZW-specific options are specified by appending a ``:''-separated\nlist to the ``lzw'' option; e.g.\n.B \"\\-c lzw:2\"\nfor\n.SM LZW\ncompression with horizontal differencing.\n.TP\n.B \\-p\nSpecify the planar configuration to use in writing image data.\nBy default,\n.I tiffsv\nwill create a new file with the data samples packed contiguously.\nSpecifying\n.B \"\\-p contig\"\nwill force data to be written with multi-sample data packed\ntogether, while\n.B \"\\-p separate\"\nwill force samples to be written in separate planes.\n.TP\n.B \\-r\nSpecify the number of rows (scanlines) in each strip of data\nwritten to the output file.\nBy default,\n.I tiffsv\nattempts to set the rows/strip\nthat no more than 8 kilobytes of data appear in a strip.\n.SH NOTE\nExcept for the use of\n.SM TIFF,\nthis program is equivalent to the standard\n.I scrsave\nprogram.\nThis means, for example, that you can use it in conjunction with\nthe standard\n.IR icut\nprogram simply by creating a link called\n.IR scrsave ,\nor by creating a shell script called\n.I scrsave\nthat invokes\n.I tiffgt\nwith the appropriate options.\n.SH BUGS\nIf data are saved compressed and in separate planes, then the\nrows in each strip is silently set to one to avoid limitations\nin the\n.BR libtiff (3TIFF)\nlibrary.\n.SH \"SEE ALSO\"\n.BR scrsave (6D)\n.BR pal2rgb (1),\n.BR tiffdump (1),\n.BR tiffgt (1),\n.BR tiffinfo (1),\n.BR tiffcp (1),\n.BR tiffmedian (1),\n.BR libtiff (3TIFF)\n.PP\nLibtiff library home page:\n.BR http://www.remotesensing.org/libtiff/\n"
  },
  {
    "path": "src/main/jni/tiff/nmake.opt",
    "content": "# $Id: nmake.opt,v 1.18 2006/06/07 16:33:45 dron Exp $\r\n#\r\n# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>\r\n#\r\n# Permission to use, copy, modify, distribute, and sell this software and \r\n# its documentation for any purpose is hereby granted without fee, provided\r\n# that (i) the above copyright notices and this permission notice appear in\r\n# all copies of the software and related documentation, and (ii) the names of\r\n# Sam Leffler and Silicon Graphics may not be used in any advertising or\r\n# publicity relating to the software without the specific, prior written\r\n# permission of Sam Leffler and Silicon Graphics.\r\n# \r\n# THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \r\n# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \r\n# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \r\n# \r\n# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\r\n# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\r\n# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\r\n# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \r\n# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \r\n# OF THIS SOFTWARE.\r\n\r\n# Compile time parameters for MS Visual C++ compiler.\r\n# You may edit this file to specify building options.\r\n\r\n#\r\n###### Edit the following lines to choose a feature set you need. #######\r\n#\r\n\r\n# \r\n# Select WINMODE_CONSOLE to build a library which reports errors to stderr, or\r\n# WINMODE_WINDOWED to build such that errors are reported via MessageBox().\r\n#\r\nWINMODE_CONSOLE = 1\r\n#WINMODE_WINDOWED = 1\r\n\r\n#\r\n# Comment out the following lines to disable internal codecs.\r\n#\r\n# Support for CCITT Group 3 & 4 algorithms\r\nCCITT_SUPPORT\t= 1\r\n# Support for Macintosh PackBits algorithm\r\nPACKBITS_SUPPORT = 1\r\n# Support for LZW algorithm\r\nLZW_SUPPORT\t= 1\r\n# Support for ThunderScan 4-bit RLE algorithm\r\nTHUNDER_SUPPORT\t= 1\r\n# Support for NeXT 2-bit RLE algorithm\r\nNEXT_SUPPORT\t= 1\r\n# Support for LogLuv high dynamic range encoding\r\nLOGLUV_SUPPORT\t= 1\r\n\r\n#\r\n# Uncomment and edit following lines to enable JPEG support.\r\n#\r\n#JPEG_SUPPORT\t= 1\r\n#JPEGDIR \t= d:/projects/jpeg-6b\r\n#JPEG_INCLUDE\t= -I$(JPEGDIR)\r\n#JPEG_LIB \t= $(JPEGDIR)/Release/jpeg.lib\r\n\r\n#\r\n# Uncomment and edit following lines to enable ZIP support\r\n# (required for Deflate compression and Pixar log-format)\r\n#\r\n#ZIP_SUPPORT\t= 1\r\n#ZLIBDIR \t= d:/projects/zlib-1.2.1\r\n#ZLIB_INCLUDE\t= -I$(ZLIBDIR)\r\n#ZLIB_LIB \t= $(ZLIBDIR)/zlib.lib\r\n\r\n#\r\n# Uncomment and edit following lines to enable ISO JBIG support\r\n#\r\n#JBIG_SUPPORT\t= 1\r\n#JBIGDIR \t= d:/projects/jbigkit\r\n#JBIG_INCLUDE\t= -I$(JBIGDIR)/libjbig\r\n#JBIG_LIB \t= $(JBIGDIR)/libjbig/jbig.lib\r\n\r\n#\r\n# Uncomment following line to enable Pixar log-format algorithm\r\n# (Zlib required).\r\n#\r\n#PIXARLOG_SUPPORT = 1\r\n\r\n#\r\n# Comment out the following lines to disable strip chopping\r\n# (whether or not to convert single-strip uncompressed images to mutiple\r\n# strips of specified size to reduce memory usage). Default strip size\r\n# is 8192 bytes, it can be configured via the STRIP_SIZE_DEFAULT parameter\r\n#\r\nSTRIPCHOP_SUPPORT = 1\r\nSTRIP_SIZE_DEFAULT = 8192\r\n\r\n#\r\n# Comment out the following lines to disable treating the fourth sample with\r\n# no EXTRASAMPLE_ value as being ASSOCALPHA. Many packages produce RGBA\r\n# files but don't mark the alpha properly.\r\n#\r\nEXTRASAMPLE_AS_ALPHA_SUPPORT = 1\r\n\r\n#\r\n# Comment out the following lines to disable picking up YCbCr subsampling\r\n# info from the JPEG data stream to support files lacking the tag.\r\n# See Bug 168 in Bugzilla, and JPEGFixupTestSubsampling() for details.\r\n#\r\nCHECK_JPEG_YCBCR_SUBSAMPLING = 1\r\n\r\n#\r\n####################### Compiler related options. #######################\r\n#\r\n\r\n#\r\n# Pick debug or optimized build flags.  We default to an optimized build\r\n# with no debugging information.\r\n# NOTE: /EHsc option required if you want to build the C++ stream API\r\n#\r\nOPTFLAGS =\t/Ox /MD /EHsc /W3 /D_CRT_SECURE_NO_DEPRECATE\r\n#OPTFLAGS = \t/Zi \r\n\r\n#\r\n# Uncomment following line to enable using Windows Common RunTime Library\r\n# instead of Windows specific system calls. See notes on top of tif_unix.c\r\n# module for details.\r\n#\r\nUSE_WIN_CRT_LIB = 1\r\n\r\n# Compiler specific options. You may probably want to adjust compilation\r\n# parameters in CFLAGS variable. Refer to your compiler documentation\r\n# for the option reference.\r\n#\r\nMAKE\t=\tnmake /nologo\r\nCC\t=\tcl /nologo\r\nCXX\t=\tcl /nologo\r\nAR\t=\tlib /nologo\r\nLD\t=\tlink /nologo\r\n\r\nCFLAGS  =\t$(OPTFLAGS) $(INCL) $(EXTRAFLAGS)\r\nCXXFLAGS =\t$(OPTFLAGS) $(INCL) $(EXTRAFLAGS)\r\nEXTRAFLAGS =\r\nLIBS\t=\r\n\r\n# Name of the output shared library\r\nDLLNAME\t= libtiff.dll\r\n\r\n#\r\n########### There is nothing to edit below this line normally. ###########\r\n#\r\n\r\n# Set the native cpu bit order\r\nEXTRAFLAGS\t= -DFILLODER_LSB2MSB $(EXTRAFLAGS)\r\n\r\n!IFDEF WINMODE_WINDOWED\r\nEXTRAFLAGS\t= -DTIF_PLATFORM_WINDOWED $(EXTRAFLAGS)\r\nLIBS\t\t= user32.lib $(LIBS)\r\n!ELSE\r\nEXTRAFLAGS\t= -DTIF_PLATFORM_CONSOLE $(EXTRAFLAGS)\r\n!ENDIF\r\n\r\n# Codec stuff\r\n!IFDEF CCITT_SUPPORT\r\nEXTRAFLAGS\t= -DCCITT_SUPPORT $(EXTRAFLAGS)\r\n!ENDIF\r\n\r\n!IFDEF PACKBITS_SUPPORT\r\nEXTRAFLAGS\t= -DPACKBITS_SUPPORT $(EXTRAFLAGS)\r\n!ENDIF\r\n\r\n!IFDEF LZW_SUPPORT\r\nEXTRAFLAGS\t=  -DLZW_SUPPORT $(EXTRAFLAGS)\r\n!ENDIF\r\n\r\n!IFDEF THUNDER_SUPPORT\r\nEXTRAFLAGS\t= -DTHUNDER_SUPPORT $(EXTRAFLAGS)\r\n!ENDIF\r\n\r\n!IFDEF NEXT_SUPPORT\r\nEXTRAFLAGS\t= -DNEXT_SUPPORT $(EXTRAFLAGS)\r\n!ENDIF\r\n\r\n!IFDEF LOGLUV_SUPPORT\r\nEXTRAFLAGS\t= -DLOGLUV_SUPPORT $(EXTRAFLAGS)\r\n!ENDIF\r\n\r\n!IFDEF JPEG_SUPPORT\r\nLIBS\t\t= $(LIBS) $(JPEG_LIB)\r\nEXTRAFLAGS\t= -DJPEG_SUPPORT -DOJPEG_SUPPORT $(EXTRAFLAGS)\r\n!ENDIF\r\n\r\n!IFDEF ZIP_SUPPORT\r\nLIBS\t\t= $(LIBS) $(ZLIB_LIB)\r\nEXTRAFLAGS\t= -DZIP_SUPPORT $(EXTRAFLAGS)\r\n!IFDEF PIXARLOG_SUPPORT\r\nEXTRAFLAGS\t= -DPIXARLOG_SUPPORT $(EXTRAFLAGS)\r\n!ENDIF\r\n!ENDIF\r\n\r\n!IFDEF JBIG_SUPPORT\r\nLIBS\t\t= $(LIBS) $(JBIG_LIB)\r\nEXTRAFLAGS\t= -DJBIG_SUPPORT $(EXTRAFLAGS)\r\n!ENDIF\r\n\r\n!IFDEF STRIPCHOP_SUPPORT\r\nEXTRAFLAGS\t= -DSTRIPCHOP_DEFAULT=TIFF_STRIPCHOP -DSTRIP_SIZE_DEFAULT=$(STRIP_SIZE_DEFAULT) $(EXTRAFLAGS)\r\n!ENDIF\r\n\r\n!IFDEF EXTRASAMPLE_AS_ALPHA_SUPPORT\r\nEXTRAFLAGS\t= -DDEFAULT_EXTRASAMPLE_AS_ALPHA $(EXTRAFLAGS)\r\n!ENDIF\r\n\r\n!IFDEF CHECK_JPEG_YCBCR_SUBSAMPLING\r\nEXTRAFLAGS\t= -DCHECK_JPEG_YCBCR_SUBSAMPLING $(EXTRAFLAGS)\r\n!ENDIF\r\n\r\n!IFDEF USE_WIN_CRT_LIB\r\nEXTRAFLAGS\t= -DAVOID_WIN32_FILEIO $(EXTRAFLAGS)\r\n!ELSE\r\nEXTRAFLAGS\t= -DUSE_WIN32_FILEIO $(EXTRAFLAGS)\r\n!ENDIF\r\n"
  },
  {
    "path": "src/main/jni/tiff/port/Makefile.am",
    "content": "# Tag Image File Format (TIFF) Software\n#\n# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>\n#\n# Permission to use, copy, modify, distribute, and sell this software and \n# its documentation for any purpose is hereby granted without fee, provided\n# that (i) the above copyright notices and this permission notice appear in\n# all copies of the software and related documentation, and (ii) the names of\n# Sam Leffler and Silicon Graphics may not be used in any advertising or\n# publicity relating to the software without the specific, prior written\n# permission of Sam Leffler and Silicon Graphics.\n# \n# THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n# \n# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n# OF THIS SOFTWARE.\n\n# Process this file with automake to produce Makefile.in.\n\nEXTRA_DIST = Makefile.vc\n\nnoinst_LTLIBRARIES\t= libport.la\nlibport_la_SOURCES\t= dummy.c libport.h\nlibport_la_LIBADD\t= @LTLIBOBJS@\n\n"
  },
  {
    "path": "src/main/jni/tiff/port/Makefile.in",
    "content": "# Makefile.in generated by automake 1.11 from Makefile.am.\n# @configure_input@\n\n# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,\n# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,\n# Inc.\n# This Makefile.in is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY, to the extent permitted by law; without\n# even the implied warranty of MERCHANTABILITY or FITNESS FOR A\n# PARTICULAR PURPOSE.\n\n@SET_MAKE@\n\n# Tag Image File Format (TIFF) Software\n#\n# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>\n#\n# Permission to use, copy, modify, distribute, and sell this software and \n# its documentation for any purpose is hereby granted without fee, provided\n# that (i) the above copyright notices and this permission notice appear in\n# all copies of the software and related documentation, and (ii) the names of\n# Sam Leffler and Silicon Graphics may not be used in any advertising or\n# publicity relating to the software without the specific, prior written\n# permission of Sam Leffler and Silicon Graphics.\n# \n# THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n# \n# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n# OF THIS SOFTWARE.\n\n# Process this file with automake to produce Makefile.in.\n\nVPATH = @srcdir@\npkgdatadir = $(datadir)/@PACKAGE@\npkgincludedir = $(includedir)/@PACKAGE@\npkglibdir = $(libdir)/@PACKAGE@\npkglibexecdir = $(libexecdir)/@PACKAGE@\nam__cd = CDPATH=\"$${ZSH_VERSION+.}$(PATH_SEPARATOR)\" && cd\ninstall_sh_DATA = $(install_sh) -c -m 644\ninstall_sh_PROGRAM = $(install_sh) -c\ninstall_sh_SCRIPT = $(install_sh) -c\nINSTALL_HEADER = $(INSTALL_DATA)\ntransform = $(program_transform_name)\nNORMAL_INSTALL = :\nPRE_INSTALL = :\nPOST_INSTALL = :\nNORMAL_UNINSTALL = :\nPRE_UNINSTALL = :\nPOST_UNINSTALL = :\nbuild_triplet = @build@\nhost_triplet = @host@\ntarget_triplet = @target@\nsubdir = port\nDIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in getopt.c \\\n\tlfind.c strcasecmp.c strtoul.c\nACLOCAL_M4 = $(top_srcdir)/aclocal.m4\nam__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \\\n\t$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \\\n\t$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \\\n\t$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac\nam__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \\\n\t$(ACLOCAL_M4)\nmkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs\nCONFIG_HEADER = $(top_builddir)/libtiff/tif_config.h \\\n\t$(top_builddir)/libtiff/tiffconf.h\nCONFIG_CLEAN_FILES =\nCONFIG_CLEAN_VPATH_FILES =\nLTLIBRARIES = $(noinst_LTLIBRARIES)\nlibport_la_DEPENDENCIES = @LTLIBOBJS@\nam_libport_la_OBJECTS = dummy.lo\nlibport_la_OBJECTS = $(am_libport_la_OBJECTS)\nAM_V_lt = $(am__v_lt_$(V))\nam__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))\nam__v_lt_0 = --silent\nDEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/libtiff\ndepcomp = $(SHELL) $(top_srcdir)/config/depcomp\nam__depfiles_maybe = depfiles\nam__mv = mv -f\nCOMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \\\n\t$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)\nLTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \\\n\t$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \\\n\t$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \\\n\t$(AM_CFLAGS) $(CFLAGS)\nAM_V_CC = $(am__v_CC_$(V))\nam__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))\nam__v_CC_0 = @echo \"  CC    \" $@;\nAM_V_at = $(am__v_at_$(V))\nam__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))\nam__v_at_0 = @\nCCLD = $(CC)\nLINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \\\n\t$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \\\n\t$(AM_LDFLAGS) $(LDFLAGS) -o $@\nAM_V_CCLD = $(am__v_CCLD_$(V))\nam__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))\nam__v_CCLD_0 = @echo \"  CCLD  \" $@;\nAM_V_GEN = $(am__v_GEN_$(V))\nam__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))\nam__v_GEN_0 = @echo \"  GEN   \" $@;\nSOURCES = $(libport_la_SOURCES)\nDIST_SOURCES = $(libport_la_SOURCES)\nETAGS = etags\nCTAGS = ctags\nDISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)\nACLOCAL = @ACLOCAL@\nAMTAR = @AMTAR@\nAM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@\nAR = @AR@\nAS = @AS@\nAUTOCONF = @AUTOCONF@\nAUTOHEADER = @AUTOHEADER@\nAUTOMAKE = @AUTOMAKE@\nAWK = @AWK@\nCC = @CC@\nCCDEPMODE = @CCDEPMODE@\nCFLAGS = @CFLAGS@\nCPP = @CPP@\nCPPFLAGS = @CPPFLAGS@\nCXX = @CXX@\nCXXCPP = @CXXCPP@\nCXXDEPMODE = @CXXDEPMODE@\nCXXFLAGS = @CXXFLAGS@\nCYGPATH_W = @CYGPATH_W@\nDEFS = @DEFS@\nDEPDIR = @DEPDIR@\nDLLTOOL = @DLLTOOL@\nDSYMUTIL = @DSYMUTIL@\nDUMPBIN = @DUMPBIN@\nECHO_C = @ECHO_C@\nECHO_N = @ECHO_N@\nECHO_T = @ECHO_T@\nEGREP = @EGREP@\nEXEEXT = @EXEEXT@\nFGREP = @FGREP@\nGLUT_CFLAGS = @GLUT_CFLAGS@\nGLUT_LIBS = @GLUT_LIBS@\nGLU_CFLAGS = @GLU_CFLAGS@\nGLU_LIBS = @GLU_LIBS@\nGL_CFLAGS = @GL_CFLAGS@\nGL_LIBS = @GL_LIBS@\nGREP = @GREP@\nINSTALL = @INSTALL@\nINSTALL_DATA = @INSTALL_DATA@\nINSTALL_PROGRAM = @INSTALL_PROGRAM@\nINSTALL_SCRIPT = @INSTALL_SCRIPT@\nINSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@\nLD = @LD@\nLDFLAGS = @LDFLAGS@\nLIBDIR = @LIBDIR@\nLIBOBJS = @LIBOBJS@\nLIBS = @LIBS@\nLIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@\nLIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@\nLIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@\nLIBTIFF_MICRO_VERSION = @LIBTIFF_MICRO_VERSION@\nLIBTIFF_MINOR_VERSION = @LIBTIFF_MINOR_VERSION@\nLIBTIFF_RELEASE_DATE = @LIBTIFF_RELEASE_DATE@\nLIBTIFF_VERSION = @LIBTIFF_VERSION@\nLIBTIFF_VERSION_INFO = @LIBTIFF_VERSION_INFO@\nLIBTOOL = @LIBTOOL@\nLIPO = @LIPO@\nLN_S = @LN_S@\nLTLIBOBJS = @LTLIBOBJS@\nMAINT = @MAINT@\nMAKEINFO = @MAKEINFO@\nMKDIR_P = @MKDIR_P@\nNM = @NM@\nNMEDIT = @NMEDIT@\nOBJDUMP = @OBJDUMP@\nOBJEXT = @OBJEXT@\nOTOOL = @OTOOL@\nOTOOL64 = @OTOOL64@\nPACKAGE = @PACKAGE@\nPACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@\nPACKAGE_NAME = @PACKAGE_NAME@\nPACKAGE_STRING = @PACKAGE_STRING@\nPACKAGE_TARNAME = @PACKAGE_TARNAME@\nPACKAGE_URL = @PACKAGE_URL@\nPACKAGE_VERSION = @PACKAGE_VERSION@\nPATH_SEPARATOR = @PATH_SEPARATOR@\nPTHREAD_CC = @PTHREAD_CC@\nPTHREAD_CFLAGS = @PTHREAD_CFLAGS@\nPTHREAD_LIBS = @PTHREAD_LIBS@\nRANLIB = @RANLIB@\nSED = @SED@\nSET_MAKE = @SET_MAKE@\nSHELL = @SHELL@\nSTRIP = @STRIP@\nVERSION = @VERSION@\nXMKMF = @XMKMF@\nX_CFLAGS = @X_CFLAGS@\nX_EXTRA_LIBS = @X_EXTRA_LIBS@\nX_LIBS = @X_LIBS@\nX_PRE_LIBS = @X_PRE_LIBS@\nabs_builddir = @abs_builddir@\nabs_srcdir = @abs_srcdir@\nabs_top_builddir = @abs_top_builddir@\nabs_top_srcdir = @abs_top_srcdir@\nac_ct_CC = @ac_ct_CC@\nac_ct_CXX = @ac_ct_CXX@\nac_ct_DUMPBIN = @ac_ct_DUMPBIN@\nacx_pthread_config = @acx_pthread_config@\nam__include = @am__include@\nam__leading_dot = @am__leading_dot@\nam__quote = @am__quote@\nam__tar = @am__tar@\nam__untar = @am__untar@\nbindir = @bindir@\nbuild = @build@\nbuild_alias = @build_alias@\nbuild_cpu = @build_cpu@\nbuild_os = @build_os@\nbuild_vendor = @build_vendor@\nbuilddir = @builddir@\ndatadir = @datadir@\ndatarootdir = @datarootdir@\ndocdir = @docdir@\ndvidir = @dvidir@\nexec_prefix = @exec_prefix@\nhost = @host@\nhost_alias = @host_alias@\nhost_cpu = @host_cpu@\nhost_os = @host_os@\nhost_vendor = @host_vendor@\nhtmldir = @htmldir@\nincludedir = @includedir@\ninfodir = @infodir@\ninstall_sh = @install_sh@\nlibdir = @libdir@\nlibexecdir = @libexecdir@\nlocaledir = @localedir@\nlocalstatedir = @localstatedir@\nlt_ECHO = @lt_ECHO@\nmandir = @mandir@\nmkdir_p = @mkdir_p@\noldincludedir = @oldincludedir@\npdfdir = @pdfdir@\nprefix = @prefix@\nprogram_transform_name = @program_transform_name@\npsdir = @psdir@\nsbindir = @sbindir@\nsharedstatedir = @sharedstatedir@\nsrcdir = @srcdir@\nsysconfdir = @sysconfdir@\ntarget = @target@\ntarget_alias = @target_alias@\ntarget_cpu = @target_cpu@\ntarget_os = @target_os@\ntarget_vendor = @target_vendor@\ntop_build_prefix = @top_build_prefix@\ntop_builddir = @top_builddir@\ntop_srcdir = @top_srcdir@\nEXTRA_DIST = Makefile.vc\nnoinst_LTLIBRARIES = libport.la\nlibport_la_SOURCES = dummy.c libport.h\nlibport_la_LIBADD = @LTLIBOBJS@\nall: all-am\n\n.SUFFIXES:\n.SUFFIXES: .c .lo .o .obj\n$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)\n\t@for dep in $?; do \\\n\t  case '$(am__configure_deps)' in \\\n\t    *$$dep*) \\\n\t      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \\\n\t        && { if test -f $@; then exit 0; else break; fi; }; \\\n\t      exit 1;; \\\n\t  esac; \\\n\tdone; \\\n\techo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign port/Makefile'; \\\n\t$(am__cd) $(top_srcdir) && \\\n\t  $(AUTOMAKE) --foreign port/Makefile\n.PRECIOUS: Makefile\nMakefile: $(srcdir)/Makefile.in $(top_builddir)/config.status\n\t@case '$?' in \\\n\t  *config.status*) \\\n\t    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \\\n\t  *) \\\n\t    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \\\n\t    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \\\n\tesac;\n\n$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n\n$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n$(am__aclocal_m4_deps):\n\nclean-noinstLTLIBRARIES:\n\t-test -z \"$(noinst_LTLIBRARIES)\" || rm -f $(noinst_LTLIBRARIES)\n\t@list='$(noinst_LTLIBRARIES)'; for p in $$list; do \\\n\t  dir=\"`echo $$p | sed -e 's|/[^/]*$$||'`\"; \\\n\t  test \"$$dir\" != \"$$p\" || dir=.; \\\n\t  echo \"rm -f \\\"$${dir}/so_locations\\\"\"; \\\n\t  rm -f \"$${dir}/so_locations\"; \\\n\tdone\nlibport.la: $(libport_la_OBJECTS) $(libport_la_DEPENDENCIES) \n\t$(AM_V_CCLD)$(LINK)  $(libport_la_OBJECTS) $(libport_la_LIBADD) $(LIBS)\n\nmostlyclean-compile:\n\t-rm -f *.$(OBJEXT)\n\ndistclean-compile:\n\t-rm -f *.tab.c\n\n@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/getopt.Plo@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/lfind.Plo@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/strcasecmp.Plo@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/strtoul.Plo@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dummy.Plo@am__quote@\n\n.c.o:\n@am__fastdepCC_TRUE@\t$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<\n@am__fastdepCC_TRUE@\t$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po\n@am__fastdepCC_FALSE@\t$(AM_V_CC) @AM_BACKSLASH@\n@AMDEP_TRUE@@am__fastdepCC_FALSE@\tsource='$<' object='$@' libtool=no @AMDEPBACKSLASH@\n@AMDEP_TRUE@@am__fastdepCC_FALSE@\tDEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@\n@am__fastdepCC_FALSE@\t$(COMPILE) -c $<\n\n.c.obj:\n@am__fastdepCC_TRUE@\t$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`\n@am__fastdepCC_TRUE@\t$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po\n@am__fastdepCC_FALSE@\t$(AM_V_CC) @AM_BACKSLASH@\n@AMDEP_TRUE@@am__fastdepCC_FALSE@\tsource='$<' object='$@' libtool=no @AMDEPBACKSLASH@\n@AMDEP_TRUE@@am__fastdepCC_FALSE@\tDEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@\n@am__fastdepCC_FALSE@\t$(COMPILE) -c `$(CYGPATH_W) '$<'`\n\n.c.lo:\n@am__fastdepCC_TRUE@\t$(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<\n@am__fastdepCC_TRUE@\t$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo\n@am__fastdepCC_FALSE@\t$(AM_V_CC) @AM_BACKSLASH@\n@AMDEP_TRUE@@am__fastdepCC_FALSE@\tsource='$<' object='$@' libtool=yes @AMDEPBACKSLASH@\n@AMDEP_TRUE@@am__fastdepCC_FALSE@\tDEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@\n@am__fastdepCC_FALSE@\t$(LTCOMPILE) -c -o $@ $<\n\nmostlyclean-libtool:\n\t-rm -f *.lo\n\nclean-libtool:\n\t-rm -rf .libs _libs\n\nID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)\n\tlist='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \\\n\tunique=`for i in $$list; do \\\n\t    if test -f \"$$i\"; then echo $$i; else echo $(srcdir)/$$i; fi; \\\n\t  done | \\\n\t  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \\\n\t      END { if (nonempty) { for (i in files) print i; }; }'`; \\\n\tmkid -fID $$unique\ntags: TAGS\n\nTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \\\n\t\t$(TAGS_FILES) $(LISP)\n\tset x; \\\n\there=`pwd`; \\\n\tlist='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \\\n\tunique=`for i in $$list; do \\\n\t    if test -f \"$$i\"; then echo $$i; else echo $(srcdir)/$$i; fi; \\\n\t  done | \\\n\t  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \\\n\t      END { if (nonempty) { for (i in files) print i; }; }'`; \\\n\tshift; \\\n\tif test -z \"$(ETAGS_ARGS)$$*$$unique\"; then :; else \\\n\t  test -n \"$$unique\" || unique=$$empty_fix; \\\n\t  if test $$# -gt 0; then \\\n\t    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \\\n\t      \"$$@\" $$unique; \\\n\t  else \\\n\t    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \\\n\t      $$unique; \\\n\t  fi; \\\n\tfi\nctags: CTAGS\nCTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \\\n\t\t$(TAGS_FILES) $(LISP)\n\tlist='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \\\n\tunique=`for i in $$list; do \\\n\t    if test -f \"$$i\"; then echo $$i; else echo $(srcdir)/$$i; fi; \\\n\t  done | \\\n\t  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \\\n\t      END { if (nonempty) { for (i in files) print i; }; }'`; \\\n\ttest -z \"$(CTAGS_ARGS)$$unique\" \\\n\t  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \\\n\t     $$unique\n\nGTAGS:\n\there=`$(am__cd) $(top_builddir) && pwd` \\\n\t  && $(am__cd) $(top_srcdir) \\\n\t  && gtags -i $(GTAGS_ARGS) \"$$here\"\n\ndistclean-tags:\n\t-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags\n\ndistdir: $(DISTFILES)\n\t@srcdirstrip=`echo \"$(srcdir)\" | sed 's/[].[^$$\\\\*]/\\\\\\\\&/g'`; \\\n\ttopsrcdirstrip=`echo \"$(top_srcdir)\" | sed 's/[].[^$$\\\\*]/\\\\\\\\&/g'`; \\\n\tlist='$(DISTFILES)'; \\\n\t  dist_files=`for file in $$list; do echo $$file; done | \\\n\t  sed -e \"s|^$$srcdirstrip/||;t\" \\\n\t      -e \"s|^$$topsrcdirstrip/|$(top_builddir)/|;t\"`; \\\n\tcase $$dist_files in \\\n\t  */*) $(MKDIR_P) `echo \"$$dist_files\" | \\\n\t\t\t   sed '/\\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \\\n\t\t\t   sort -u` ;; \\\n\tesac; \\\n\tfor file in $$dist_files; do \\\n\t  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \\\n\t  if test -d $$d/$$file; then \\\n\t    dir=`echo \"/$$file\" | sed -e 's,/[^/]*$$,,'`; \\\n\t    if test -d \"$(distdir)/$$file\"; then \\\n\t      find \"$(distdir)/$$file\" -type d ! -perm -700 -exec chmod u+rwx {} \\;; \\\n\t    fi; \\\n\t    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \\\n\t      cp -fpR $(srcdir)/$$file \"$(distdir)$$dir\" || exit 1; \\\n\t      find \"$(distdir)/$$file\" -type d ! -perm -700 -exec chmod u+rwx {} \\;; \\\n\t    fi; \\\n\t    cp -fpR $$d/$$file \"$(distdir)$$dir\" || exit 1; \\\n\t  else \\\n\t    test -f \"$(distdir)/$$file\" \\\n\t    || cp -p $$d/$$file \"$(distdir)/$$file\" \\\n\t    || exit 1; \\\n\t  fi; \\\n\tdone\ncheck-am: all-am\ncheck: check-am\nall-am: Makefile $(LTLIBRARIES)\ninstalldirs:\ninstall: install-am\ninstall-exec: install-exec-am\ninstall-data: install-data-am\nuninstall: uninstall-am\n\ninstall-am: all-am\n\t@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am\n\ninstallcheck: installcheck-am\ninstall-strip:\n\t$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM=\"$(INSTALL_STRIP_PROGRAM)\" \\\n\t  install_sh_PROGRAM=\"$(INSTALL_STRIP_PROGRAM)\" INSTALL_STRIP_FLAG=-s \\\n\t  `test -z '$(STRIP)' || \\\n\t    echo \"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'\"` install\nmostlyclean-generic:\n\nclean-generic:\n\ndistclean-generic:\n\t-test -z \"$(CONFIG_CLEAN_FILES)\" || rm -f $(CONFIG_CLEAN_FILES)\n\t-test . = \"$(srcdir)\" || test -z \"$(CONFIG_CLEAN_VPATH_FILES)\" || rm -f $(CONFIG_CLEAN_VPATH_FILES)\n\nmaintainer-clean-generic:\n\t@echo \"This command is intended for maintainers to use\"\n\t@echo \"it deletes files that may require special tools to rebuild.\"\nclean: clean-am\n\nclean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \\\n\tmostlyclean-am\n\ndistclean: distclean-am\n\t-rm -rf $(DEPDIR) ./$(DEPDIR)\n\t-rm -f Makefile\ndistclean-am: clean-am distclean-compile distclean-generic \\\n\tdistclean-tags\n\ndvi: dvi-am\n\ndvi-am:\n\nhtml: html-am\n\nhtml-am:\n\ninfo: info-am\n\ninfo-am:\n\ninstall-data-am:\n\ninstall-dvi: install-dvi-am\n\ninstall-dvi-am:\n\ninstall-exec-am:\n\ninstall-html: install-html-am\n\ninstall-html-am:\n\ninstall-info: install-info-am\n\ninstall-info-am:\n\ninstall-man:\n\ninstall-pdf: install-pdf-am\n\ninstall-pdf-am:\n\ninstall-ps: install-ps-am\n\ninstall-ps-am:\n\ninstallcheck-am:\n\nmaintainer-clean: maintainer-clean-am\n\t-rm -rf $(DEPDIR) ./$(DEPDIR)\n\t-rm -f Makefile\nmaintainer-clean-am: distclean-am maintainer-clean-generic\n\nmostlyclean: mostlyclean-am\n\nmostlyclean-am: mostlyclean-compile mostlyclean-generic \\\n\tmostlyclean-libtool\n\npdf: pdf-am\n\npdf-am:\n\nps: ps-am\n\nps-am:\n\nuninstall-am:\n\n.MAKE: install-am install-strip\n\n.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \\\n\tclean-libtool clean-noinstLTLIBRARIES ctags distclean \\\n\tdistclean-compile distclean-generic distclean-libtool \\\n\tdistclean-tags distdir dvi dvi-am html html-am info info-am \\\n\tinstall install-am install-data install-data-am install-dvi \\\n\tinstall-dvi-am install-exec install-exec-am install-html \\\n\tinstall-html-am install-info install-info-am install-man \\\n\tinstall-pdf install-pdf-am install-ps install-ps-am \\\n\tinstall-strip installcheck installcheck-am installdirs \\\n\tmaintainer-clean maintainer-clean-generic mostlyclean \\\n\tmostlyclean-compile mostlyclean-generic mostlyclean-libtool \\\n\tpdf pdf-am ps ps-am tags uninstall uninstall-am\n\n\n# Tell versions [3.59,3.63) of GNU make to not export all variables.\n# Otherwise a system limit (for SysV at least) may be exceeded.\n.NOEXPORT:\n"
  },
  {
    "path": "src/main/jni/tiff/port/Makefile.vc",
    "content": "# $Id: Makefile.vc,v 1.4 2006/03/23 14:54:02 dron Exp $\n#\n# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>\n#\n# Permission to use, copy, modify, distribute, and sell this software and \n# its documentation for any purpose is hereby granted without fee, provided\n# that (i) the above copyright notices and this permission notice appear in\n# all copies of the software and related documentation, and (ii) the names of\n# Sam Leffler and Silicon Graphics may not be used in any advertising or\n# publicity relating to the software without the specific, prior written\n# permission of Sam Leffler and Silicon Graphics.\n# \n# THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n# \n# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n# OF THIS SOFTWARE.\n#\n# Makefile for MS Visual C and Watcom C compilers.\n#\n# To build:\n# C:\\libtiff\\port> nmake /f makefile.vc \n\n!INCLUDE ..\\nmake.opt\n\nOBJ\t= \\\n\tstrcasecmp.obj \\\n\tgetopt.obj\n\nall:\tlibport.lib\n\nlibport.lib:\t$(OBJ)\n\t$(AR) /out:libport.lib $(OBJ)\n\nclean:\n\t-del *.obj\n\t-del *.lib\n\n"
  },
  {
    "path": "src/main/jni/tiff/port/dummy.c",
    "content": "/* $Id: dummy.c,v 1.2.2.1 2007/03/21 14:53:46 dron Exp $ */\n\n/*\n * Dummy function, just to be ensure that the library always will be created.\n */\n\nvoid\nlibport_dummy_function()\n{\n        return;\n}\n\n"
  },
  {
    "path": "src/main/jni/tiff/port/getopt.c",
    "content": "/* $Id: getopt.c,v 1.2 2005/07/07 16:34:06 dron Exp $ */\n\n/*\n * Copyright (c) 1987, 1993, 1994\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n#if 0\nstatic char sccsid[] = \"@(#)getopt.c\t8.3 (Berkeley) 4/27/95\";\n__RCSID(\"$NetBSD: getopt.c,v 1.26 2003/08/07 16:43:40 agc Exp $\");\n#endif\n\n#include <stdio.h>\n#include <string.h>\n\nint\topterr = 1,\t\t/* if error message should be printed */\n\toptind = 1,\t\t/* index into parent argv vector */\n\toptopt,\t\t\t/* character checked for validity */\n\toptreset;\t\t/* reset getopt */\nchar\t*optarg;\t\t/* argument associated with option */\n\n#define\tBADCH\t(int)'?'\n#define\tBADARG\t(int)':'\n#define\tEMSG\t\"\"\n\n/*\n * getopt --\n *\tParse argc/argv argument vector.\n */\nint\ngetopt(int argc, char * const argv[], const char *optstring)\n{\n\tstatic char *place = EMSG;\t\t/* option letter processing */\n\tchar *oli;\t\t\t\t/* option letter list index */\n\n\tif (optreset || *place == 0) {\t\t/* update scanning pointer */\n\t\toptreset = 0;\n\t\tplace = argv[optind];\n\t\tif (optind >= argc || *place++ != '-') {\n\t\t\t/* Argument is absent or is not an option */\n\t\t\tplace = EMSG;\n\t\t\treturn (-1);\n\t\t}\n\t\toptopt = *place++;\n\t\tif (optopt == '-' && *place == 0) {\n\t\t\t/* \"--\" => end of options */\n\t\t\t++optind;\n\t\t\tplace = EMSG;\n\t\t\treturn (-1);\n\t\t}\n\t\tif (optopt == 0) {\n\t\t\t/* Solitary '-', treat as a '-' option\n\t\t\t   if the program (eg su) is looking for it. */\n\t\t\tplace = EMSG;\n\t\t\tif (strchr(optstring, '-') == NULL)\n\t\t\t\treturn -1;\n\t\t\toptopt = '-';\n\t\t}\n\t} else\n\t\toptopt = *place++;\n\n\t/* See if option letter is one the caller wanted... */\n\tif (optopt == ':' || (oli = strchr(optstring, optopt)) == NULL) {\n\t\tif (*place == 0)\n\t\t\t++optind;\n\t\tif (opterr && *optstring != ':')\n\t\t\t(void)fprintf(stderr,\n                                      \"unknown option -- %c\\n\", optopt);\n\t\treturn (BADCH);\n\t}\n\n\t/* Does this option need an argument? */\n\tif (oli[1] != ':') {\n\t\t/* don't need argument */\n\t\toptarg = NULL;\n\t\tif (*place == 0)\n\t\t\t++optind;\n\t} else {\n\t\t/* Option-argument is either the rest of this argument or the\n\t\t   entire next argument. */\n\t\tif (*place)\n\t\t\toptarg = place;\n\t\telse if (argc > ++optind)\n\t\t\toptarg = argv[optind];\n\t\telse {\n\t\t\t/* option-argument absent */\n\t\t\tplace = EMSG;\n\t\t\tif (*optstring == ':')\n\t\t\t\treturn (BADARG);\n\t\t\tif (opterr)\n\t\t\t\t(void)fprintf(stderr,\n                                        \"option requires an argument -- %c\\n\",\n                                        optopt);\n\t\t\treturn (BADCH);\n\t\t}\n\t\tplace = EMSG;\n\t\t++optind;\n\t}\n\treturn (optopt);\t\t\t/* return option letter */\n}\n"
  },
  {
    "path": "src/main/jni/tiff/port/lfind.c",
    "content": "/* $Id: lfind.c,v 1.4 2007/01/15 18:40:39 mloskot Exp $ */\n\n/*\n * Copyright (c) 1989, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * Roger L. Snyder.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n#if 0\nstatic char sccsid[] = \"@(#)lsearch.c\t8.1 (Berkeley) 6/4/93\";\n__RCSID(\"$NetBSD: lsearch.c,v 1.2 2005/07/06 15:47:15 drochner Exp $\");\n#endif\n\n#ifdef _WIN32_WCE\n# include <wce_types.h>\n#else\n# include <sys/types.h>\n#endif\n\n#ifndef NULL\n# define NULL 0\n#endif\n\nvoid *\nlfind(const void *key, const void *base, size_t *nmemb, size_t size,\n      int(*compar)(const void *, const void *))\n{\n\tchar *element, *end;\n\n\tend = (char *)base + *nmemb * size;\n\tfor (element = (char *)base; element < end; element += size)\n\t\tif (!compar(element, key))\t\t/* key found */\n\t\t\treturn element;\n\n\treturn NULL;\n}\n"
  },
  {
    "path": "src/main/jni/tiff/port/libport.h",
    "content": "/* $Id: libport.h,v 1.2.2.2 2009-11-02 14:47:41 bfriesen Exp $ */\n\n/*\n * Copyright (c) 2009 Frank Warmerdam\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF\n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE\n * OF THIS SOFTWARE.\n */\n\n#ifndef _LIBPORT_\n#define\t_LIBPORT_\n\nint getopt(int argc, char * const argv[], const char *optstring);\nextern   char *optarg;\nextern   int opterr;\nextern   int optind;\nextern   int optopt;\n\nint strcasecmp(const char *s1, const char *s2);\n\n#ifndef HAVE_GETOPT\n#  define HAVE_GETOPT 1\n#endif\n\n#if 0\nunsigned long strtoul(const char *nptr, char **endptr, int base);\n#endif\n\n#if 0\nvoid *\nlfind(const void *key, const void *base, size_t *nmemb, size_t size,\n      int(*compar)(const void *, const void *));\n#endif\n\n#endif /* ndef _LIBPORT_ */\n"
  },
  {
    "path": "src/main/jni/tiff/port/strcasecmp.c",
    "content": "/* $Id: strcasecmp.c,v 1.2 2005/07/07 16:34:06 dron Exp $ */\n\n/*\n * Copyright (c) 1987, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n#if 0\nstatic char sccsid[] = \"@(#)strcasecmp.c\t8.1 (Berkeley) 6/4/93\";\n__RCSID(\"$NetBSD: strcasecmp.c,v 1.16 2003/08/07 16:43:49 agc Exp $\");\n#endif\n\n#include <ctype.h>\n#include <string.h>\n\nint\nstrcasecmp(const char *s1, const char *s2)\n{\n\tconst unsigned char *us1 = (const unsigned char *)s1,\n\t\t\t*us2 = (const unsigned char *)s2;\n\n\twhile (tolower(*us1) == tolower(*us2++))\n\t\tif (*us1++ == '\\0')\n\t\t\treturn (0);\n\treturn (tolower(*us1) - tolower(*--us2));\n}\n"
  },
  {
    "path": "src/main/jni/tiff/port/strtoul.c",
    "content": "/* $Id: strtoul.c,v 1.2 2005/07/07 16:34:06 dron Exp $ */\n\n/*\n * Copyright (c) 1990, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n#if 0\nstatic char sccsid[] = \"@(#)strtoul.c\t8.1 (Berkeley) 6/4/93\";\n__RCSID(\"$NetBSD: strtoul.c,v 1.16 2003/08/07 16:43:45 agc Exp $\");\n#endif\n\n#include <ctype.h>\n#include <errno.h>\n#include <limits.h>\n#include <stdlib.h>\n\n/*\n * Convert a string to an unsigned long integer.\n *\n * Ignores `locale' stuff.  Assumes that the upper and lower case\n * alphabets and digits are each contiguous.\n */\nunsigned long\nstrtoul(const char *nptr, char **endptr, int base)\n{\n\tconst char *s;\n\tunsigned long acc, cutoff;\n\tint c;\n\tint neg, any, cutlim;\n\n\t/*\n\t * See strtol for comments as to the logic used.\n\t */\n\ts = nptr;\n\tdo {\n\t\tc = (unsigned char) *s++;\n\t} while (isspace(c));\n\tif (c == '-') {\n\t\tneg = 1;\n\t\tc = *s++;\n\t} else {\n\t\tneg = 0;\n\t\tif (c == '+')\n\t\t\tc = *s++;\n\t}\n\tif ((base == 0 || base == 16) &&\n\t    c == '0' && (*s == 'x' || *s == 'X')) {\n\t\tc = s[1];\n\t\ts += 2;\n\t\tbase = 16;\n\t}\n\tif (base == 0)\n\t\tbase = c == '0' ? 8 : 10;\n\n\tcutoff = ULONG_MAX / (unsigned long)base;\n\tcutlim = (int)(ULONG_MAX % (unsigned long)base);\n\tfor (acc = 0, any = 0;; c = (unsigned char) *s++) {\n\t\tif (isdigit(c))\n\t\t\tc -= '0';\n\t\telse if (isalpha(c))\n\t\t\tc -= isupper(c) ? 'A' - 10 : 'a' - 10;\n\t\telse\n\t\t\tbreak;\n\t\tif (c >= base)\n\t\t\tbreak;\n\t\tif (any < 0)\n\t\t\tcontinue;\n\t\tif (acc > cutoff || (acc == cutoff && c > cutlim)) {\n\t\t\tany = -1;\n\t\t\tacc = ULONG_MAX;\n\t\t\terrno = ERANGE;\n\t\t} else {\n\t\t\tany = 1;\n\t\t\tacc *= (unsigned long)base;\n\t\t\tacc += c;\n\t\t}\n\t}\n\tif (neg && any > 0)\n\t\tacc = -acc;\n\tif (endptr != 0)\n\t\t/* LINTED interface specification */\n\t\t*endptr = (char *)(any ? s - 1 : nptr);\n\treturn (acc);\n}\n"
  },
  {
    "path": "src/main/jni/tiff/test/Makefile.am",
    "content": "# Tag Image File Format (TIFF) Software\n#\n# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>\n#\n# Permission to use, copy, modify, distribute, and sell this software and \n# its documentation for any purpose is hereby granted without fee, provided\n# that (i) the above copyright notices and this permission notice appear in\n# all copies of the software and related documentation, and (ii) the names of\n# Sam Leffler and Silicon Graphics may not be used in any advertising or\n# publicity relating to the software without the specific, prior written\n# permission of Sam Leffler and Silicon Graphics.\n# \n# THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n# \n# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n# OF THIS SOFTWARE.\n\n# Process this file with automake to produce Makefile.in.\n\nAUTOMAKE_OPTIONS = 1.11 color-tests parallel-tests foreign\n\nLIBTIFF = $(top_builddir)/libtiff/libtiff.la\n\n#EXTRA_DIST = Makefile.vc\n\nTESTS = $(check_PROGRAMS)\n\ncheck_PROGRAMS = ascii_tag long_tag short_tag strip_rw\n\nascii_tag_SOURCES = ascii_tag.c\nascii_tag_LDADD = $(LIBTIFF)\nlong_tag_SOURCES = long_tag.c check_tag.c\nlong_tag_LDADD = $(LIBTIFF)\nshort_tag_SOURCES = short_tag.c check_tag.c\nshort_tag_LDADD = $(LIBTIFF)\nstrip_rw_SOURCES = strip_rw.c strip.c test_arrays.c test_arrays.h\nstrip_rw_LDADD = $(LIBTIFF)\n\nINCLUDES = -I$(top_srcdir)/libtiff\n\n"
  },
  {
    "path": "src/main/jni/tiff/test/Makefile.in",
    "content": "# Makefile.in generated by automake 1.11 from Makefile.am.\n# @configure_input@\n\n# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,\n# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,\n# Inc.\n# This Makefile.in is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY, to the extent permitted by law; without\n# even the implied warranty of MERCHANTABILITY or FITNESS FOR A\n# PARTICULAR PURPOSE.\n\n@SET_MAKE@\n\n# Tag Image File Format (TIFF) Software\n#\n# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>\n#\n# Permission to use, copy, modify, distribute, and sell this software and \n# its documentation for any purpose is hereby granted without fee, provided\n# that (i) the above copyright notices and this permission notice appear in\n# all copies of the software and related documentation, and (ii) the names of\n# Sam Leffler and Silicon Graphics may not be used in any advertising or\n# publicity relating to the software without the specific, prior written\n# permission of Sam Leffler and Silicon Graphics.\n# \n# THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n# \n# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n# OF THIS SOFTWARE.\n\n# Process this file with automake to produce Makefile.in.\nVPATH = @srcdir@\npkgdatadir = $(datadir)/@PACKAGE@\npkgincludedir = $(includedir)/@PACKAGE@\npkglibdir = $(libdir)/@PACKAGE@\npkglibexecdir = $(libexecdir)/@PACKAGE@\nam__cd = CDPATH=\"$${ZSH_VERSION+.}$(PATH_SEPARATOR)\" && cd\ninstall_sh_DATA = $(install_sh) -c -m 644\ninstall_sh_PROGRAM = $(install_sh) -c\ninstall_sh_SCRIPT = $(install_sh) -c\nINSTALL_HEADER = $(INSTALL_DATA)\ntransform = $(program_transform_name)\nNORMAL_INSTALL = :\nPRE_INSTALL = :\nPOST_INSTALL = :\nNORMAL_UNINSTALL = :\nPRE_UNINSTALL = :\nPOST_UNINSTALL = :\nbuild_triplet = @build@\nhost_triplet = @host@\ntarget_triplet = @target@\ncheck_PROGRAMS = ascii_tag$(EXEEXT) long_tag$(EXEEXT) \\\n\tshort_tag$(EXEEXT) strip_rw$(EXEEXT)\nsubdir = test\nDIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in\nACLOCAL_M4 = $(top_srcdir)/aclocal.m4\nam__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \\\n\t$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \\\n\t$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \\\n\t$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac\nam__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \\\n\t$(ACLOCAL_M4)\nmkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs\nCONFIG_HEADER = $(top_builddir)/libtiff/tif_config.h \\\n\t$(top_builddir)/libtiff/tiffconf.h\nCONFIG_CLEAN_FILES =\nCONFIG_CLEAN_VPATH_FILES =\nam_ascii_tag_OBJECTS = ascii_tag.$(OBJEXT)\nascii_tag_OBJECTS = $(am_ascii_tag_OBJECTS)\nascii_tag_DEPENDENCIES = $(LIBTIFF)\nAM_V_lt = $(am__v_lt_$(V))\nam__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))\nam__v_lt_0 = --silent\nam_long_tag_OBJECTS = long_tag.$(OBJEXT) check_tag.$(OBJEXT)\nlong_tag_OBJECTS = $(am_long_tag_OBJECTS)\nlong_tag_DEPENDENCIES = $(LIBTIFF)\nam_short_tag_OBJECTS = short_tag.$(OBJEXT) check_tag.$(OBJEXT)\nshort_tag_OBJECTS = $(am_short_tag_OBJECTS)\nshort_tag_DEPENDENCIES = $(LIBTIFF)\nam_strip_rw_OBJECTS = strip_rw.$(OBJEXT) strip.$(OBJEXT) \\\n\ttest_arrays.$(OBJEXT)\nstrip_rw_OBJECTS = $(am_strip_rw_OBJECTS)\nstrip_rw_DEPENDENCIES = $(LIBTIFF)\nDEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/libtiff\ndepcomp = $(SHELL) $(top_srcdir)/config/depcomp\nam__depfiles_maybe = depfiles\nam__mv = mv -f\nCOMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \\\n\t$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)\nLTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \\\n\t$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \\\n\t$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \\\n\t$(AM_CFLAGS) $(CFLAGS)\nAM_V_CC = $(am__v_CC_$(V))\nam__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))\nam__v_CC_0 = @echo \"  CC    \" $@;\nAM_V_at = $(am__v_at_$(V))\nam__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))\nam__v_at_0 = @\nCCLD = $(CC)\nLINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \\\n\t$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \\\n\t$(AM_LDFLAGS) $(LDFLAGS) -o $@\nAM_V_CCLD = $(am__v_CCLD_$(V))\nam__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))\nam__v_CCLD_0 = @echo \"  CCLD  \" $@;\nAM_V_GEN = $(am__v_GEN_$(V))\nam__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))\nam__v_GEN_0 = @echo \"  GEN   \" $@;\nSOURCES = $(ascii_tag_SOURCES) $(long_tag_SOURCES) \\\n\t$(short_tag_SOURCES) $(strip_rw_SOURCES)\nDIST_SOURCES = $(ascii_tag_SOURCES) $(long_tag_SOURCES) \\\n\t$(short_tag_SOURCES) $(strip_rw_SOURCES)\nETAGS = etags\nCTAGS = ctags\n# If stdout is a non-dumb tty, use colors.  If test -t is not supported,\n# then this fails; a conservative approach.  Of course do not redirect\n# stdout here, just stderr.\nam__tty_colors = \\\nred=; grn=; lgn=; blu=; std=; \\\ntest \"X$(AM_COLOR_TESTS)\" != Xno \\\n&& test \"X$$TERM\" != Xdumb \\\n&& { test \"X$(AM_COLOR_TESTS)\" = Xalways || test -t 1 2>/dev/null; } \\\n&& { \\\n  red='\u001b[0;31m'; \\\n  grn='\u001b[0;32m'; \\\n  lgn='\u001b[1;32m'; \\\n  blu='\u001b[1;34m'; \\\n  std='\u001b[m'; \\\n}\nam__vpath_adj_setup = srcdirstrip=`echo \"$(srcdir)\" | sed 's|.|.|g'`;\nam__vpath_adj = case $$p in \\\n    $(srcdir)/*) f=`echo \"$$p\" | sed \"s|^$$srcdirstrip/||\"`;; \\\n    *) f=$$p;; \\\n  esac;\nam__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;\nam__install_max = 40\nam__nobase_strip_setup = \\\n  srcdirstrip=`echo \"$(srcdir)\" | sed 's/[].[^$$\\\\*|]/\\\\\\\\&/g'`\nam__nobase_strip = \\\n  for p in $$list; do echo \"$$p\"; done | sed -e \"s|$$srcdirstrip/||\"\nam__nobase_list = $(am__nobase_strip_setup); \\\n  for p in $$list; do echo \"$$p $$p\"; done | \\\n  sed \"s| $$srcdirstrip/| |;\"' / .*\\//!s/ .*/ ./; s,\\( .*\\)/[^/]*$$,\\1,' | \\\n  $(AWK) 'BEGIN { files[\".\"] = \"\" } { files[$$2] = files[$$2] \" \" $$1; \\\n    if (++n[$$2] == $(am__install_max)) \\\n      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = \"\" } } \\\n    END { for (dir in files) print dir, files[dir] }'\nam__base_list = \\\n  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\\n/ /g' | \\\n  sed '$$!N;$$!N;$$!N;$$!N;s/\\n/ /g'\n# Restructured Text title and section.\nam__rst_title = sed 's/.*/   &   /;h;s/./=/g;p;x;p;g;p;s/.*//'\nam__rst_section = sed 'p;s/./=/g;p;g'\n# Put stdin (possibly several lines separated by \".  \") in a box.\nam__text_box = $(AWK) '{\t\t\t\t\\\n  n = split($$0, lines, \"\\\\.  \"); max = 0;\t\t\\\n  for (i = 1; i <= n; ++i)\t\t\t\t\\\n    if (max < length(lines[i]))\t\t\t\t\\\n      max = length(lines[i]);\t\t\t\t\\\n  for (i = 0; i < max; ++i) line = line \"=\";\t\t\\\n  print line;\t\t\t\t\t\t\\\n  for (i = 1; i <= n; ++i) if (lines[i]) print lines[i];\\\n  print line;\t\t\t\t\t\t\\\n}'\n# Solaris 10 'make', and several other traditional 'make' implementations,\n# pass \"-e\" to $(SHELL).  This contradicts POSIX.  Work around the problem\n# by disabling -e (using the XSI extension \"set +e\") if it's set.\nam__sh_e_setup = case $$- in *e*) set +e;; esac\n# To be inserted before the command running the test.  Creates the\n# directory for the log if needed.  Stores in $dir the directory\n# containing $f, in $tst the test, in $log the log, and passes\n# TESTS_ENVIRONMENT.  Save and restore TERM around use of\n# TESTS_ENVIRONMENT, in case that unsets it.\nam__check_pre = \\\n$(am__sh_e_setup);\t\t\t\t\t\\\n$(am__vpath_adj_setup) $(am__vpath_adj)\t\t\t\\\nsrcdir=$(srcdir); export srcdir;\t\t\t\\\nrm -f $@-t;\t\t\t\t\t\t\\\ntrap 'st=$$?; rm -f '\\''$(abs_builddir)/$@-t'\\''; (exit $$st); exit $$st' \\\n  1 2 13 15;\t\t\t\t\t\t\\\nam__odir=`echo \"./$@\" | sed 's|/[^/]*$$||'`;\t\t\\\ntest \"x$$am__odir\" = x. || $(MKDIR_P) \"$$am__odir\" || exit $$?;\t\\\nif test -f \"./$$f\"; then dir=./;\t\t\t\\\nelif test -f \"$$f\"; then dir=;\t\t\t\t\\\nelse dir=\"$(srcdir)/\"; fi;\t\t\t\t\\\ntst=$$dir$$f; log='$@'; __SAVED_TERM=$$TERM;\t\t\\\n$(TESTS_ENVIRONMENT)\nRECHECK_LOGS = $(TEST_LOGS)\nAM_RECURSIVE_TARGETS = check check-html recheck recheck-html\nTEST_SUITE_LOG = test-suite.log\nTEST_SUITE_HTML = $(TEST_SUITE_LOG:.log=.html)\nTEST_EXTENSIONS = @EXEEXT@ .test\nLOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS)\nam__test_logs1 = $(TESTS:=.log)\nam__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log)\nTEST_LOGS = $(am__test_logs2:.test.log=.log)\nTEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \\\n\t$(TEST_LOG_FLAGS)\nTEST_LOGS_TMP = $(TEST_LOGS:.log=.log-t)\nDISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)\nACLOCAL = @ACLOCAL@\nAMTAR = @AMTAR@\nAM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@\nAR = @AR@\nAS = @AS@\nAUTOCONF = @AUTOCONF@\nAUTOHEADER = @AUTOHEADER@\nAUTOMAKE = @AUTOMAKE@\nAWK = @AWK@\nCC = @CC@\nCCDEPMODE = @CCDEPMODE@\nCFLAGS = @CFLAGS@\nCPP = @CPP@\nCPPFLAGS = @CPPFLAGS@\nCXX = @CXX@\nCXXCPP = @CXXCPP@\nCXXDEPMODE = @CXXDEPMODE@\nCXXFLAGS = @CXXFLAGS@\nCYGPATH_W = @CYGPATH_W@\nDEFS = @DEFS@\nDEPDIR = @DEPDIR@\nDLLTOOL = @DLLTOOL@\nDSYMUTIL = @DSYMUTIL@\nDUMPBIN = @DUMPBIN@\nECHO_C = @ECHO_C@\nECHO_N = @ECHO_N@\nECHO_T = @ECHO_T@\nEGREP = @EGREP@\nEXEEXT = @EXEEXT@\nFGREP = @FGREP@\nGLUT_CFLAGS = @GLUT_CFLAGS@\nGLUT_LIBS = @GLUT_LIBS@\nGLU_CFLAGS = @GLU_CFLAGS@\nGLU_LIBS = @GLU_LIBS@\nGL_CFLAGS = @GL_CFLAGS@\nGL_LIBS = @GL_LIBS@\nGREP = @GREP@\nINSTALL = @INSTALL@\nINSTALL_DATA = @INSTALL_DATA@\nINSTALL_PROGRAM = @INSTALL_PROGRAM@\nINSTALL_SCRIPT = @INSTALL_SCRIPT@\nINSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@\nLD = @LD@\nLDFLAGS = @LDFLAGS@\nLIBDIR = @LIBDIR@\nLIBOBJS = @LIBOBJS@\nLIBS = @LIBS@\nLIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@\nLIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@\nLIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@\nLIBTIFF_MICRO_VERSION = @LIBTIFF_MICRO_VERSION@\nLIBTIFF_MINOR_VERSION = @LIBTIFF_MINOR_VERSION@\nLIBTIFF_RELEASE_DATE = @LIBTIFF_RELEASE_DATE@\nLIBTIFF_VERSION = @LIBTIFF_VERSION@\nLIBTIFF_VERSION_INFO = @LIBTIFF_VERSION_INFO@\nLIBTOOL = @LIBTOOL@\nLIPO = @LIPO@\nLN_S = @LN_S@\nLTLIBOBJS = @LTLIBOBJS@\nMAINT = @MAINT@\nMAKEINFO = @MAKEINFO@\nMKDIR_P = @MKDIR_P@\nNM = @NM@\nNMEDIT = @NMEDIT@\nOBJDUMP = @OBJDUMP@\nOBJEXT = @OBJEXT@\nOTOOL = @OTOOL@\nOTOOL64 = @OTOOL64@\nPACKAGE = @PACKAGE@\nPACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@\nPACKAGE_NAME = @PACKAGE_NAME@\nPACKAGE_STRING = @PACKAGE_STRING@\nPACKAGE_TARNAME = @PACKAGE_TARNAME@\nPACKAGE_URL = @PACKAGE_URL@\nPACKAGE_VERSION = @PACKAGE_VERSION@\nPATH_SEPARATOR = @PATH_SEPARATOR@\nPTHREAD_CC = @PTHREAD_CC@\nPTHREAD_CFLAGS = @PTHREAD_CFLAGS@\nPTHREAD_LIBS = @PTHREAD_LIBS@\nRANLIB = @RANLIB@\nSED = @SED@\nSET_MAKE = @SET_MAKE@\nSHELL = @SHELL@\nSTRIP = @STRIP@\nVERSION = @VERSION@\nXMKMF = @XMKMF@\nX_CFLAGS = @X_CFLAGS@\nX_EXTRA_LIBS = @X_EXTRA_LIBS@\nX_LIBS = @X_LIBS@\nX_PRE_LIBS = @X_PRE_LIBS@\nabs_builddir = @abs_builddir@\nabs_srcdir = @abs_srcdir@\nabs_top_builddir = @abs_top_builddir@\nabs_top_srcdir = @abs_top_srcdir@\nac_ct_CC = @ac_ct_CC@\nac_ct_CXX = @ac_ct_CXX@\nac_ct_DUMPBIN = @ac_ct_DUMPBIN@\nacx_pthread_config = @acx_pthread_config@\nam__include = @am__include@\nam__leading_dot = @am__leading_dot@\nam__quote = @am__quote@\nam__tar = @am__tar@\nam__untar = @am__untar@\nbindir = @bindir@\nbuild = @build@\nbuild_alias = @build_alias@\nbuild_cpu = @build_cpu@\nbuild_os = @build_os@\nbuild_vendor = @build_vendor@\nbuilddir = @builddir@\ndatadir = @datadir@\ndatarootdir = @datarootdir@\ndocdir = @docdir@\ndvidir = @dvidir@\nexec_prefix = @exec_prefix@\nhost = @host@\nhost_alias = @host_alias@\nhost_cpu = @host_cpu@\nhost_os = @host_os@\nhost_vendor = @host_vendor@\nhtmldir = @htmldir@\nincludedir = @includedir@\ninfodir = @infodir@\ninstall_sh = @install_sh@\nlibdir = @libdir@\nlibexecdir = @libexecdir@\nlocaledir = @localedir@\nlocalstatedir = @localstatedir@\nlt_ECHO = @lt_ECHO@\nmandir = @mandir@\nmkdir_p = @mkdir_p@\noldincludedir = @oldincludedir@\npdfdir = @pdfdir@\nprefix = @prefix@\nprogram_transform_name = @program_transform_name@\npsdir = @psdir@\nsbindir = @sbindir@\nsharedstatedir = @sharedstatedir@\nsrcdir = @srcdir@\nsysconfdir = @sysconfdir@\ntarget = @target@\ntarget_alias = @target_alias@\ntarget_cpu = @target_cpu@\ntarget_os = @target_os@\ntarget_vendor = @target_vendor@\ntop_build_prefix = @top_build_prefix@\ntop_builddir = @top_builddir@\ntop_srcdir = @top_srcdir@\nAUTOMAKE_OPTIONS = 1.11 color-tests parallel-tests foreign\nLIBTIFF = $(top_builddir)/libtiff/libtiff.la\n\n#EXTRA_DIST = Makefile.vc\nTESTS = $(check_PROGRAMS)\nascii_tag_SOURCES = ascii_tag.c\nascii_tag_LDADD = $(LIBTIFF)\nlong_tag_SOURCES = long_tag.c check_tag.c\nlong_tag_LDADD = $(LIBTIFF)\nshort_tag_SOURCES = short_tag.c check_tag.c\nshort_tag_LDADD = $(LIBTIFF)\nstrip_rw_SOURCES = strip_rw.c strip.c test_arrays.c test_arrays.h\nstrip_rw_LDADD = $(LIBTIFF)\nINCLUDES = -I$(top_srcdir)/libtiff\nall: all-am\n\n.SUFFIXES:\n.SUFFIXES: .c .html .lo .log .o .obj .test .test$(EXEEXT)\n$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)\n\t@for dep in $?; do \\\n\t  case '$(am__configure_deps)' in \\\n\t    *$$dep*) \\\n\t      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \\\n\t        && { if test -f $@; then exit 0; else break; fi; }; \\\n\t      exit 1;; \\\n\t  esac; \\\n\tdone; \\\n\techo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign test/Makefile'; \\\n\t$(am__cd) $(top_srcdir) && \\\n\t  $(AUTOMAKE) --foreign test/Makefile\n.PRECIOUS: Makefile\nMakefile: $(srcdir)/Makefile.in $(top_builddir)/config.status\n\t@case '$?' in \\\n\t  *config.status*) \\\n\t    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \\\n\t  *) \\\n\t    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \\\n\t    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \\\n\tesac;\n\n$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n\n$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n$(am__aclocal_m4_deps):\n\nclean-checkPROGRAMS:\n\t@list='$(check_PROGRAMS)'; test -n \"$$list\" || exit 0; \\\n\techo \" rm -f\" $$list; \\\n\trm -f $$list || exit $$?; \\\n\ttest -n \"$(EXEEXT)\" || exit 0; \\\n\tlist=`for p in $$list; do echo \"$$p\"; done | sed 's/$(EXEEXT)$$//'`; \\\n\techo \" rm -f\" $$list; \\\n\trm -f $$list\nascii_tag$(EXEEXT): $(ascii_tag_OBJECTS) $(ascii_tag_DEPENDENCIES) \n\t@rm -f ascii_tag$(EXEEXT)\n\t$(AM_V_CCLD)$(LINK) $(ascii_tag_OBJECTS) $(ascii_tag_LDADD) $(LIBS)\nlong_tag$(EXEEXT): $(long_tag_OBJECTS) $(long_tag_DEPENDENCIES) \n\t@rm -f long_tag$(EXEEXT)\n\t$(AM_V_CCLD)$(LINK) $(long_tag_OBJECTS) $(long_tag_LDADD) $(LIBS)\nshort_tag$(EXEEXT): $(short_tag_OBJECTS) $(short_tag_DEPENDENCIES) \n\t@rm -f short_tag$(EXEEXT)\n\t$(AM_V_CCLD)$(LINK) $(short_tag_OBJECTS) $(short_tag_LDADD) $(LIBS)\nstrip_rw$(EXEEXT): $(strip_rw_OBJECTS) $(strip_rw_DEPENDENCIES) \n\t@rm -f strip_rw$(EXEEXT)\n\t$(AM_V_CCLD)$(LINK) $(strip_rw_OBJECTS) $(strip_rw_LDADD) $(LIBS)\n\nmostlyclean-compile:\n\t-rm -f *.$(OBJEXT)\n\ndistclean-compile:\n\t-rm -f *.tab.c\n\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ascii_tag.Po@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_tag.Po@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/long_tag.Po@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/short_tag.Po@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strip.Po@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strip_rw.Po@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_arrays.Po@am__quote@\n\n.c.o:\n@am__fastdepCC_TRUE@\t$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<\n@am__fastdepCC_TRUE@\t$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po\n@am__fastdepCC_FALSE@\t$(AM_V_CC) @AM_BACKSLASH@\n@AMDEP_TRUE@@am__fastdepCC_FALSE@\tsource='$<' object='$@' libtool=no @AMDEPBACKSLASH@\n@AMDEP_TRUE@@am__fastdepCC_FALSE@\tDEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@\n@am__fastdepCC_FALSE@\t$(COMPILE) -c $<\n\n.c.obj:\n@am__fastdepCC_TRUE@\t$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`\n@am__fastdepCC_TRUE@\t$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po\n@am__fastdepCC_FALSE@\t$(AM_V_CC) @AM_BACKSLASH@\n@AMDEP_TRUE@@am__fastdepCC_FALSE@\tsource='$<' object='$@' libtool=no @AMDEPBACKSLASH@\n@AMDEP_TRUE@@am__fastdepCC_FALSE@\tDEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@\n@am__fastdepCC_FALSE@\t$(COMPILE) -c `$(CYGPATH_W) '$<'`\n\n.c.lo:\n@am__fastdepCC_TRUE@\t$(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<\n@am__fastdepCC_TRUE@\t$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo\n@am__fastdepCC_FALSE@\t$(AM_V_CC) @AM_BACKSLASH@\n@AMDEP_TRUE@@am__fastdepCC_FALSE@\tsource='$<' object='$@' libtool=yes @AMDEPBACKSLASH@\n@AMDEP_TRUE@@am__fastdepCC_FALSE@\tDEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@\n@am__fastdepCC_FALSE@\t$(LTCOMPILE) -c -o $@ $<\n\nmostlyclean-libtool:\n\t-rm -f *.lo\n\nclean-libtool:\n\t-rm -rf .libs _libs\n\nID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)\n\tlist='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \\\n\tunique=`for i in $$list; do \\\n\t    if test -f \"$$i\"; then echo $$i; else echo $(srcdir)/$$i; fi; \\\n\t  done | \\\n\t  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \\\n\t      END { if (nonempty) { for (i in files) print i; }; }'`; \\\n\tmkid -fID $$unique\ntags: TAGS\n\nTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \\\n\t\t$(TAGS_FILES) $(LISP)\n\tset x; \\\n\there=`pwd`; \\\n\tlist='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \\\n\tunique=`for i in $$list; do \\\n\t    if test -f \"$$i\"; then echo $$i; else echo $(srcdir)/$$i; fi; \\\n\t  done | \\\n\t  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \\\n\t      END { if (nonempty) { for (i in files) print i; }; }'`; \\\n\tshift; \\\n\tif test -z \"$(ETAGS_ARGS)$$*$$unique\"; then :; else \\\n\t  test -n \"$$unique\" || unique=$$empty_fix; \\\n\t  if test $$# -gt 0; then \\\n\t    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \\\n\t      \"$$@\" $$unique; \\\n\t  else \\\n\t    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \\\n\t      $$unique; \\\n\t  fi; \\\n\tfi\nctags: CTAGS\nCTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \\\n\t\t$(TAGS_FILES) $(LISP)\n\tlist='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \\\n\tunique=`for i in $$list; do \\\n\t    if test -f \"$$i\"; then echo $$i; else echo $(srcdir)/$$i; fi; \\\n\t  done | \\\n\t  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \\\n\t      END { if (nonempty) { for (i in files) print i; }; }'`; \\\n\ttest -z \"$(CTAGS_ARGS)$$unique\" \\\n\t  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \\\n\t     $$unique\n\nGTAGS:\n\there=`$(am__cd) $(top_builddir) && pwd` \\\n\t  && $(am__cd) $(top_srcdir) \\\n\t  && gtags -i $(GTAGS_ARGS) \"$$here\"\n\ndistclean-tags:\n\t-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags\n\n# To be appended to the command running the test.  Handle the stdout\n# and stderr redirection, and catch the exit status.\nam__check_post =\t\t\t\t\t\\\n>$@-t 2>&1;\t\t\t\t\t\t\\\nestatus=$$?;\t\t\t\t\t\t\\\nif test -n '$(DISABLE_HARD_ERRORS)'\t\t\t\\\n   && test $$estatus -eq 99; then\t\t\t\\\n  estatus=1;\t\t\t\t\t\t\\\nfi;\t\t\t\t\t\t\t\\\nTERM=$$__SAVED_TERM; export TERM;\t\t\t\\\n$(am__tty_colors);\t\t\t\t\t\\\nxfailed=PASS;\t\t\t\t\t\t\\\ncase \" $(XFAIL_TESTS) \" in\t\t\t\t\\\n  *[\\ \\\t]$$f[\\ \\\t]* | *[\\ \\\t]$$dir$$f[\\ \\\t]*) \\\n    xfailed=XFAIL;;\t\t\t\t\t\\\nesac;\t\t\t\t\t\t\t\\\ncase $$estatus:$$xfailed in\t\t\t\t\\\n    0:XFAIL) col=$$red; res=XPASS;;\t\t\t\\\n    0:*)     col=$$grn; res=PASS ;;\t\t\t\\\n    77:*)    col=$$blu; res=SKIP ;;\t\t\t\\\n    99:*)    col=$$red; res=FAIL ;;\t\t\t\\\n    *:XFAIL) col=$$lgn; res=XFAIL;;\t\t\t\\\n    *:*)     col=$$red; res=FAIL ;;\t\t\t\\\nesac;\t\t\t\t\t\t\t\\\necho \"$${col}$$res$${std}: $$f\";\t\t\t\\\necho \"$$res: $$f (exit: $$estatus)\" |\t\t\t\\\n  $(am__rst_section) >$@;\t\t\t\t\\\ncat $@-t >>$@;\t\t\t\t\t\t\\\nrm -f $@-t\n\n$(TEST_SUITE_LOG): $(TEST_LOGS)\n\t@$(am__sh_e_setup);\t\t\t\t\t\t\\\n\tlist='$(TEST_LOGS)';\t\t\t\t\t\t\\\n\tresults=`for f in $$list; do\t\t\t\t\t\\\n\t\t   read line < $$f && echo \"$$line\" || echo FAIL;\t\\\n\t\t done`;\t\t\t\t\t\t\t\\\n\tall=`echo \"$$results\" | sed '/^$$/d' | wc -l | sed -e 's/^[\t ]*//'`; \\\n\tfail=`echo \"$$results\" | grep -c '^FAIL'`;\t\t\t\\\n\tpass=`echo \"$$results\" | grep -c '^PASS'`;\t\t\t\\\n\tskip=`echo \"$$results\" | grep -c '^SKIP'`;\t\t\t\\\n\txfail=`echo \"$$results\" | grep -c '^XFAIL'`;\t\t\t\\\n\txpass=`echo \"$$results\" | grep -c '^XPASS'`;\t\t\t\\\n\tfailures=`expr $$fail + $$xpass`;\t\t\t\t\\\n\tall=`expr $$all - $$skip`;\t\t\t\t\t\\\n\tif test \"$$all\" -eq 1; then tests=test; All=;\t\t\t\\\n\telse tests=tests; All=\"All \"; fi;\t\t\t\t\\\n\tcase fail=$$fail:xpass=$$xpass:xfail=$$xfail in\t\t\t\\\n\t  fail=0:xpass=0:xfail=0)\t\t\t\t\t\\\n\t    msg=\"$$All$$all $$tests passed.  \";\t\t\t\t\\\n\t    exit=true;;\t\t\t\t\t\t\t\\\n\t  fail=0:xpass=0:xfail=*)\t\t\t\t\t\\\n\t    msg=\"$$All$$all $$tests behaved as expected\";\t\t\\\n\t    if test \"$$xfail\" -eq 1; then xfailures=failure;\t\t\\\n\t    else xfailures=failures; fi;\t\t\t\t\\\n\t    msg=\"$$msg ($$xfail expected $$xfailures).  \";\t\t\\\n\t    exit=true;;\t\t\t\t\t\t\t\\\n\t  fail=*:xpass=0:xfail=*)\t\t\t\t\t\\\n\t    msg=\"$$fail of $$all $$tests failed.  \";\t\t\t\\\n\t    exit=false;;\t\t\t\t\t\t\\\n\t  fail=*:xpass=*:xfail=*)\t\t\t\t\t\\\n\t    msg=\"$$failures of $$all $$tests did not behave as expected\"; \\\n\t    if test \"$$xpass\" -eq 1; then xpasses=pass;\t\t\t\\\n\t    else xpasses=passes; fi;\t\t\t\t\t\\\n\t    msg=\"$$msg ($$xpass unexpected $$xpasses).  \";\t\t\\\n\t    exit=false;;\t\t\t\t\t\t\\\n\t  *)\t\t\t\t\t\t\t\t\\\n\t    echo >&2 \"incorrect case\"; exit 4;;\t\t\t\t\\\n\tesac;\t\t\t\t\t\t\t\t\\\n\tif test \"$$skip\" -ne 0; then\t\t\t\t\t\\\n\t  if test \"$$skip\" -eq 1; then\t\t\t\t\t\\\n\t    msg=\"$$msg($$skip test was not run).  \";\t\t\t\\\n\t  else\t\t\t\t\t\t\t\t\\\n\t    msg=\"$$msg($$skip tests were not run).  \";\t\t\t\\\n\t  fi;\t\t\t\t\t\t\t\t\\\n\tfi;\t\t\t\t\t\t\t\t\\\n\t{\t\t\t\t\t\t\t\t\\\n\t  echo \"$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)\" |\t\\\n\t    $(am__rst_title);\t\t\t\t\t\t\\\n\t  echo \"$$msg\";\t\t\t\t\t\t\t\\\n\t  echo;\t\t\t\t\t\t\t\t\\\n\t  echo \".. contents:: :depth: 2\";\t\t\t\t\\\n\t  echo;\t\t\t\t\t\t\t\t\\\n\t  for f in $$list; do\t\t\t\t\t\t\\\n\t    read line < $$f;\t\t\t\t\t\t\\\n\t    case $$line in\t\t\t\t\t\t\\\n\t      PASS:*|XFAIL:*);;\t\t\t\t\t\t\\\n\t      *) echo; cat $$f;;\t\t\t\t\t\\\n\t    esac;\t\t\t\t\t\t\t\\\n\t  done;\t\t\t\t\t\t\t\t\\\n\t} >$(TEST_SUITE_LOG).tmp;\t\t\t\t\t\\\n\tmv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG);\t\t\t\\\n\tif test \"$$failures\" -ne 0; then\t\t\t\t\\\n\t  msg=\"$${msg}See $(subdir)/$(TEST_SUITE_LOG).  \";\t\t\\\n\t  if test -n \"$(PACKAGE_BUGREPORT)\"; then\t\t\t\\\n\t    msg=\"$${msg}Please report to $(PACKAGE_BUGREPORT).  \";\t\\\n\t  fi;\t\t\t\t\t\t\t\t\\\n\tfi;\t\t\t\t\t\t\t\t\\\n\ttest x\"$$VERBOSE\" = x || $$exit || cat $(TEST_SUITE_LOG);\t\\\n\t$(am__tty_colors);\t\t\t\t\t\t\\\n\tif $$exit; then\t\t\t\t\t\t\t\\\n\t  echo $(ECHO_N) \"$$grn$(ECHO_C)\";\t\t\t\t\\\n\t else\t\t\t\t\t\t\t\t\\\n\t  echo $(ECHO_N) \"$$red$(ECHO_C)\";\t\t\t\t\\\n\tfi;\t\t\t\t\t\t\t\t\\\n\techo \"$$msg\" | $(am__text_box);\t\t\t\t\t\\\n\techo $(ECHO_N) \"$$std$(ECHO_C)\";\t\t\t\t\\\n\t$$exit\n\n# Run all the tests.\ncheck-TESTS:\n\t@list='$(RECHECK_LOGS)'; test -z \"$$list\" || rm -f $$list\n\t@test -z \"$(TEST_SUITE_LOG)\" || rm -f $(TEST_SUITE_LOG)\n\t@set_logs=; if test \"X$(TEST_LOGS)\" = X.log; then\t\t\\\n\t  set_logs=TEST_LOGS=;\t\t\t\t\t\t\\\n\tfi;\t\t\t\t\t\t\t\t\\\n\t$(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) $$set_logs\n\n.log.html:\n\t@list='$(RST2HTML) $$RST2HTML rst2html rst2html.py';\t\t\\\n\tfor r2h in $$list; do\t\t\t\t\t\t\\\n\t  if ($$r2h --version) >/dev/null 2>&1; then\t\t\t\\\n\t    R2H=$$r2h;\t\t\t\t\t\t\t\\\n\t  fi;\t\t\t\t\t\t\t\t\\\n\tdone;\t\t\t\t\t\t\t\t\\\n\tif test -z \"$$R2H\"; then\t\t\t\t\t\\\n\t  echo >&2 \"cannot find rst2html, cannot create $@\";\t\t\\\n\t  exit 2;\t\t\t\t\t\t\t\\\n\tfi;\t\t\t\t\t\t\t\t\\\n\t$$R2H $< >$@.tmp\n\t@mv $@.tmp $@\n\n# Be sure to run check first, and then to convert the result.\n# Beware of concurrent executions.  Run \"check\" not \"check-TESTS\", as\n# check-SCRIPTS and other dependencies are rebuilt by the former only.\n# And expect check to fail.\ncheck-html:\n\t@if $(MAKE) $(AM_MAKEFLAGS) check; then\t\t\t\\\n\t  rv=0; else rv=$$?;\t\t\t\t\t\\\n\tfi;\t\t\t\t\t\t\t\\\n\t$(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_HTML) || exit 4;\t\\\n\texit $$rv\nrecheck recheck-html:\n\t@target=`echo $@ | sed 's,^re,,'`;\t\t\t\t\\\n\tlist='$(TEST_LOGS)';\t\t\t\t\t\t\\\n\tlist=`for f in $$list; do\t\t\t\t\t\\\n\t        test -f $$f || continue;\t\t\t\t\\\n\t        if read line < $$f; then\t\t\t\t\\\n\t          case $$line in FAIL*|XPASS*) echo $$f;; esac;\t\t\\\n\t        else echo $$f; fi;\t\t\t\t\t\\\n\t      done | tr '\\012\\015' '  '`;\t\t\t\t\\\n\t$(MAKE) $(AM_MAKEFLAGS) $$target AM_MAKEFLAGS='$(AM_MAKEFLAGS) TEST_LOGS=\"'\"$$list\"'\"'\nascii_tag.log: ascii_tag$(EXEEXT)\n\t@p='ascii_tag$(EXEEXT)'; $(am__check_pre) $(LOG_COMPILE) \"$$tst\" $(am__check_post)\nlong_tag.log: long_tag$(EXEEXT)\n\t@p='long_tag$(EXEEXT)'; $(am__check_pre) $(LOG_COMPILE) \"$$tst\" $(am__check_post)\nshort_tag.log: short_tag$(EXEEXT)\n\t@p='short_tag$(EXEEXT)'; $(am__check_pre) $(LOG_COMPILE) \"$$tst\" $(am__check_post)\nstrip_rw.log: strip_rw$(EXEEXT)\n\t@p='strip_rw$(EXEEXT)'; $(am__check_pre) $(LOG_COMPILE) \"$$tst\" $(am__check_post)\n.test.log:\n\t@p='$<'; $(am__check_pre) $(TEST_LOG_COMPILE) \"$$tst\" $(am__check_post)\n@am__EXEEXT_TRUE@.test$(EXEEXT).log:\n@am__EXEEXT_TRUE@\t@p='$<'; $(am__check_pre) $(TEST_LOG_COMPILE) \"$$tst\" $(am__check_post)\n\ndistdir: $(DISTFILES)\n\t@srcdirstrip=`echo \"$(srcdir)\" | sed 's/[].[^$$\\\\*]/\\\\\\\\&/g'`; \\\n\ttopsrcdirstrip=`echo \"$(top_srcdir)\" | sed 's/[].[^$$\\\\*]/\\\\\\\\&/g'`; \\\n\tlist='$(DISTFILES)'; \\\n\t  dist_files=`for file in $$list; do echo $$file; done | \\\n\t  sed -e \"s|^$$srcdirstrip/||;t\" \\\n\t      -e \"s|^$$topsrcdirstrip/|$(top_builddir)/|;t\"`; \\\n\tcase $$dist_files in \\\n\t  */*) $(MKDIR_P) `echo \"$$dist_files\" | \\\n\t\t\t   sed '/\\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \\\n\t\t\t   sort -u` ;; \\\n\tesac; \\\n\tfor file in $$dist_files; do \\\n\t  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \\\n\t  if test -d $$d/$$file; then \\\n\t    dir=`echo \"/$$file\" | sed -e 's,/[^/]*$$,,'`; \\\n\t    if test -d \"$(distdir)/$$file\"; then \\\n\t      find \"$(distdir)/$$file\" -type d ! -perm -700 -exec chmod u+rwx {} \\;; \\\n\t    fi; \\\n\t    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \\\n\t      cp -fpR $(srcdir)/$$file \"$(distdir)$$dir\" || exit 1; \\\n\t      find \"$(distdir)/$$file\" -type d ! -perm -700 -exec chmod u+rwx {} \\;; \\\n\t    fi; \\\n\t    cp -fpR $$d/$$file \"$(distdir)$$dir\" || exit 1; \\\n\t  else \\\n\t    test -f \"$(distdir)/$$file\" \\\n\t    || cp -p $$d/$$file \"$(distdir)/$$file\" \\\n\t    || exit 1; \\\n\t  fi; \\\n\tdone\ncheck-am: all-am\n\t$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)\n\t$(MAKE) $(AM_MAKEFLAGS) check-TESTS\ncheck: check-am\nall-am: Makefile\ninstalldirs:\ninstall: install-am\ninstall-exec: install-exec-am\ninstall-data: install-data-am\nuninstall: uninstall-am\n\ninstall-am: all-am\n\t@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am\n\ninstallcheck: installcheck-am\ninstall-strip:\n\t$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM=\"$(INSTALL_STRIP_PROGRAM)\" \\\n\t  install_sh_PROGRAM=\"$(INSTALL_STRIP_PROGRAM)\" INSTALL_STRIP_FLAG=-s \\\n\t  `test -z '$(STRIP)' || \\\n\t    echo \"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'\"` install\nmostlyclean-generic:\n\t-test -z \"$(TEST_LOGS)\" || rm -f $(TEST_LOGS)\n\t-test -z \"$(TEST_LOGS_TMP)\" || rm -f $(TEST_LOGS_TMP)\n\t-test -z \"$(TEST_SUITE_HTML)\" || rm -f $(TEST_SUITE_HTML)\n\t-test -z \"$(TEST_SUITE_LOG)\" || rm -f $(TEST_SUITE_LOG)\n\nclean-generic:\n\ndistclean-generic:\n\t-test -z \"$(CONFIG_CLEAN_FILES)\" || rm -f $(CONFIG_CLEAN_FILES)\n\t-test . = \"$(srcdir)\" || test -z \"$(CONFIG_CLEAN_VPATH_FILES)\" || rm -f $(CONFIG_CLEAN_VPATH_FILES)\n\nmaintainer-clean-generic:\n\t@echo \"This command is intended for maintainers to use\"\n\t@echo \"it deletes files that may require special tools to rebuild.\"\nclean: clean-am\n\nclean-am: clean-checkPROGRAMS clean-generic clean-libtool \\\n\tmostlyclean-am\n\ndistclean: distclean-am\n\t-rm -rf ./$(DEPDIR)\n\t-rm -f Makefile\ndistclean-am: clean-am distclean-compile distclean-generic \\\n\tdistclean-tags\n\ndvi: dvi-am\n\ndvi-am:\n\nhtml: html-am\n\nhtml-am:\n\ninfo: info-am\n\ninfo-am:\n\ninstall-data-am:\n\ninstall-dvi: install-dvi-am\n\ninstall-dvi-am:\n\ninstall-exec-am:\n\ninstall-html: install-html-am\n\ninstall-html-am:\n\ninstall-info: install-info-am\n\ninstall-info-am:\n\ninstall-man:\n\ninstall-pdf: install-pdf-am\n\ninstall-pdf-am:\n\ninstall-ps: install-ps-am\n\ninstall-ps-am:\n\ninstallcheck-am:\n\nmaintainer-clean: maintainer-clean-am\n\t-rm -rf ./$(DEPDIR)\n\t-rm -f Makefile\nmaintainer-clean-am: distclean-am maintainer-clean-generic\n\nmostlyclean: mostlyclean-am\n\nmostlyclean-am: mostlyclean-compile mostlyclean-generic \\\n\tmostlyclean-libtool\n\npdf: pdf-am\n\npdf-am:\n\nps: ps-am\n\nps-am:\n\nuninstall-am:\n\n.MAKE: check-am check-html install-am install-strip recheck \\\n\trecheck-html\n\n.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am check-html \\\n\tclean clean-checkPROGRAMS clean-generic clean-libtool ctags \\\n\tdistclean distclean-compile distclean-generic \\\n\tdistclean-libtool distclean-tags distdir dvi dvi-am html \\\n\thtml-am info info-am install install-am install-data \\\n\tinstall-data-am install-dvi install-dvi-am install-exec \\\n\tinstall-exec-am install-html install-html-am install-info \\\n\tinstall-info-am install-man install-pdf install-pdf-am \\\n\tinstall-ps install-ps-am install-strip installcheck \\\n\tinstallcheck-am installdirs maintainer-clean \\\n\tmaintainer-clean-generic mostlyclean mostlyclean-compile \\\n\tmostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \\\n\trecheck recheck-html tags uninstall uninstall-am\n\n\n# Tell versions [3.59,3.63) of GNU make to not export all variables.\n# Otherwise a system limit (for SysV at least) may be exceeded.\n.NOEXPORT:\n"
  },
  {
    "path": "src/main/jni/tiff/test/ascii_tag.c",
    "content": "/* $Id: ascii_tag.c,v 1.5 2006/03/23 14:54:02 dron Exp $ */\n\n/*\n * Copyright (c) 2004, Andrey Kiselev  <dron@ak4719.spb.edu>\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n/*\n * TIFF Library\n *\n * Module to test ASCII tags read/write functions.\n */\n\n#include \"tif_config.h\"\n\n#include <stdio.h>\n#include <string.h>\n\n#ifdef HAVE_UNISTD_H \n# include <unistd.h> \n#endif \n\n#include \"tiffio.h\"\n\nconst char\t*filename = \"ascii_test.tiff\";\n\nstatic struct Tags {\n\tttag_t\t\ttag;\n\tconst char\t*value;\n} ascii_tags[] = {\n\t{ TIFFTAG_DOCUMENTNAME, \"Test TIFF image\" },\n\t{ TIFFTAG_IMAGEDESCRIPTION, \"Temporary test image\" },\n\t{ TIFFTAG_MAKE, \"This is not scanned image\" },\n\t{ TIFFTAG_MODEL, \"No scanner\" },\n\t{ TIFFTAG_PAGENAME, \"Test page\" },\n\t{ TIFFTAG_SOFTWARE, \"Libtiff library\" },\n\t{ TIFFTAG_DATETIME, \"2004:09:10 16:09:00\" },\n\t{ TIFFTAG_ARTIST, \"Andrey V. Kiselev\" },\n\t{ TIFFTAG_HOSTCOMPUTER, \"Debian GNU/Linux (Sarge)\" },\n\t{ TIFFTAG_TARGETPRINTER, \"No printer\" },\n\t{ TIFFTAG_PIXAR_TEXTUREFORMAT, \"No texture\" },\n\t{ TIFFTAG_PIXAR_WRAPMODES, \"No wrap\" },\n\t{ TIFFTAG_COPYRIGHT, \"Copyright (c) 2004, Andrey Kiselev\" }\n};\n#define NTAGS   (sizeof (ascii_tags) / sizeof (ascii_tags[0]))\n\nconst char *ink_names = \"Red\\0Green\\0Blue\";\nconst int ink_names_size = 15;\n\nint\nmain(int argc, char **argv)\n{\n\tTIFF\t\t*tif;\n\tint\t\ti;\n\tunsigned char\tbuf[3] = { 0, 127, 255 };\n\tchar\t\t*value;\n\n\t/* Test whether we can write tags. */\n\ttif = TIFFOpen(filename, \"w\");\n\tif (!tif) {\n\t\tfprintf (stderr, \"Can't create test TIFF file %s.\\n\", filename);\n\t\treturn 1;\n\t}\n\n\tif (!TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, 1)) {\n\t\tfprintf (stderr, \"Can't set ImageWidth tag.\\n\");\n\t\tgoto failure;\n\t}\n\tif (!TIFFSetField(tif, TIFFTAG_IMAGELENGTH, 1)) {\n\t\tfprintf (stderr, \"Can't set ImageLength tag.\\n\");\n\t\tgoto failure;\n\t}\n\tif (!TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 8)) {\n\t\tfprintf (stderr, \"Can't set BitsPerSample tag.\\n\");\n\t\tgoto failure;\n\t}\n\tif (!TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 3)) {\n\t\tfprintf (stderr, \"Can't set SamplesPerPixel tag.\\n\");\n\t\tgoto failure;\n\t}\n\tif (!TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG)) {\n\t\tfprintf (stderr, \"Can't set PlanarConfiguration tag.\\n\");\n\t\tgoto failure;\n\t}\n\tif (!TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB)) {\n\t\tfprintf (stderr, \"Can't set PhotometricInterpretation tag.\\n\");\n\t\tgoto failure;\n\t}\n\n\tfor (i = 0; i < NTAGS; i++) {\n\t\tif (!TIFFSetField(tif, ascii_tags[i].tag,\n\t\t\t\t  ascii_tags[i].value)) {\n\t\t\tfprintf(stderr, \"Can't set tag %d.\\n\",\n\t\t\t\t(int)ascii_tags[i].tag);\n\t\t\tgoto failure;\n\t\t}\n\t}\n\n\t/* InkNames tag has special form, so we handle it separately. */\n\tif (!TIFFSetField(tif, TIFFTAG_NUMBEROFINKS, 3)) {\n\t\tfprintf (stderr, \"Can't set tag %d.\\n\", TIFFTAG_NUMBEROFINKS);\n\t\tgoto failure;\n\t}\n\tif (!TIFFSetField(tif, TIFFTAG_INKNAMES, ink_names_size, ink_names)) {\n\t\tfprintf (stderr, \"Can't set tag %d.\\n\", TIFFTAG_INKNAMES);\n\t\tgoto failure;\n\t}\n\n\t/* Write dummy pixel data. */\n\tif (!TIFFWriteScanline(tif, buf, 0, 0) < 0) {\n\t\tfprintf (stderr, \"Can't write image data.\\n\");\n\t\tgoto failure;\n\t}\n\n\tTIFFClose(tif);\n\t\n\t/* Ok, now test whether we can read written values. */\n\ttif = TIFFOpen(filename, \"r\");\n\tif (!tif) {\n\t\tfprintf (stderr, \"Can't open test TIFF file %s.\\n\", filename);\n\t\treturn 1;\n\t}\n\n\tfor (i = 0; i < NTAGS; i++) {\n\t\tif (!TIFFGetField(tif, ascii_tags[i].tag, &value)\n\t\t    || strcmp(value, ascii_tags[i].value)) {\n\t\t\tfprintf(stderr, \"Can't get tag %d.\\n\",\n\t\t\t\t(int)ascii_tags[i].tag);\n\t\t\tgoto failure;\n\t\t}\n\t}\n\n\tif (!TIFFGetField(tif, TIFFTAG_INKNAMES, &value)\n\t    || memcmp(value, ink_names, ink_names_size)) {\n\t\tfprintf (stderr, \"Can't get tag %d.\\n\", TIFFTAG_INKNAMES);\n\t\tgoto failure;\n\t}\n\n\tTIFFClose(tif);\n\t\n\t/* All tests passed; delete file and exit with success status. */\n\tunlink(filename);\n\treturn 0;\n\nfailure:\n\t/* Something goes wrong; close file and return unsuccessful status. */\n\tTIFFClose(tif);\n\tunlink(filename);\n\treturn 1;\n}\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiff/test/check_tag.c",
    "content": "/* $Id: check_tag.c,v 1.2 2006/03/23 14:54:02 dron Exp $ */\n\n/*\n * Copyright (c) 2004, Andrey Kiselev  <dron@ak4719.spb.edu>\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n/*\n * TIFF Library\n *\n * Module to test LONG tags read/write functions.\n */\n\n#include \"tiffio.h\"\n\nint\nCheckShortField(TIFF *tif, ttag_t field, uint16 value)\n{\n\tuint16 tmp = 0;\n\n\tif (!TIFFGetField(tif, field, &tmp)) {\n\t\tfprintf (stderr, \"Problem fetching tag %lu.\\n\",\n\t\t\t (unsigned long) field);\n\t\treturn -1;\n\t}\n\tif (tmp != value) {\n\t\tfprintf (stderr, \"Wrong SHORT value fetched for tag %lu.\\n\",\n\t\t\t (unsigned long) field);\n\t\treturn -1;\n\t}\n\n\treturn 0;\n}\n\nint\nCheckLongField(TIFF *tif, ttag_t field, uint32 value)\n{\n\tuint32 tmp = 0;\n\n\tif (!TIFFGetField(tif, field, &tmp)) {\n\t\tfprintf (stderr, \"Problem fetching tag %lu.\\n\",\n\t\t\t (unsigned long) field);\n\t\treturn -1;\n\t}\n\tif (tmp != value) {\n\t\tfprintf (stderr, \"Wrong LONG value fetched for tag %lu.\\n\",\n\t\t\t (unsigned long) field);\n\t\treturn -1;\n\t}\n\n\treturn 0;\n}\n\n\n"
  },
  {
    "path": "src/main/jni/tiff/test/long_tag.c",
    "content": "/* $Id: long_tag.c,v 1.3 2006/03/23 14:54:02 dron Exp $ */\n\n/*\n * Copyright (c) 2004, Andrey Kiselev  <dron@ak4719.spb.edu>\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n/*\n * TIFF Library\n *\n * Module to test LONG tags read/write functions.\n */\n\n#include \"tif_config.h\"\n\n#include <stdio.h>\n\n#ifdef HAVE_UNISTD_H \n# include <unistd.h> \n#endif \n\n#include \"tiffio.h\"\n\nextern int CheckLongField(TIFF *, ttag_t, uint32);\n\nconst char\t*filename = \"long_test.tiff\";\n\nstatic struct Tags {\n\tttag_t\t\ttag;\n\tshort\t\tcount;\n\tuint32\t\tvalue;\n} long_tags[] = {\n\t{ TIFFTAG_SUBFILETYPE, 1, FILETYPE_REDUCEDIMAGE|FILETYPE_PAGE|FILETYPE_MASK }\n};\n#define NTAGS   (sizeof (long_tags) / sizeof (long_tags[0]))\n\nconst uint32\twidth = 1;\nconst uint32\tlength = 1;\nconst uint32\trows_per_strip = 1;\n\nint\nmain(int argc, char **argv)\n{\n\tTIFF\t\t*tif;\n\tint\t\ti;\n\tunsigned char\tbuf[3] = { 0, 127, 255 };\n\n\t/* Test whether we can write tags. */\n\ttif = TIFFOpen(filename, \"w\");\n\tif (!tif) {\n\t\tfprintf (stderr, \"Can't create test TIFF file %s.\\n\", filename);\n\t\treturn 1;\n\t}\n\n\tif (!TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, width)) {\n\t\tfprintf (stderr, \"Can't set ImageWidth tag.\\n\");\n\t\tgoto failure;\n\t}\n\tif (!TIFFSetField(tif, TIFFTAG_IMAGELENGTH, length)) {\n\t\tfprintf (stderr, \"Can't set ImageLength tag.\\n\");\n\t\tgoto failure;\n\t}\n\tif (!TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 8)) {\n\t\tfprintf (stderr, \"Can't set BitsPerSample tag.\\n\");\n\t\tgoto failure;\n\t}\n\tif (!TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 3)) {\n\t\tfprintf (stderr, \"Can't set SamplesPerPixel tag.\\n\");\n\t\tgoto failure;\n\t}\n\tif (!TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, rows_per_strip)) {\n\t\tfprintf (stderr, \"Can't set SamplesPerPixel tag.\\n\");\n\t\tgoto failure;\n\t}\n\tif (!TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG)) {\n\t\tfprintf (stderr, \"Can't set PlanarConfiguration tag.\\n\");\n\t\tgoto failure;\n\t}\n\tif (!TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB)) {\n\t\tfprintf (stderr, \"Can't set PhotometricInterpretation tag.\\n\");\n\t\tgoto failure;\n\t}\n\n\tfor (i = 0; i < NTAGS; i++) {\n\t\tif (!TIFFSetField(tif, long_tags[i].tag,\n\t\t\t\t  long_tags[i].value)) {\n\t\t\tfprintf(stderr, \"Can't set tag %d.\\n\",\n\t\t\t\t(int)long_tags[i].tag);\n\t\t\tgoto failure;\n\t\t}\n\t}\n\n\t/* Write dummy pixel data. */\n\tif (!TIFFWriteScanline(tif, buf, 0, 0) < 0) {\n\t\tfprintf (stderr, \"Can't write image data.\\n\");\n\t\tgoto failure;\n\t}\n\n\tTIFFClose(tif);\n\t\n\t/* Ok, now test whether we can read written values. */\n\ttif = TIFFOpen(filename, \"r\");\n\tif (!tif) {\n\t\tfprintf (stderr, \"Can't open test TIFF file %s.\\n\", filename);\n\t\treturn 1;\n\t}\n\n\tif (CheckLongField(tif, TIFFTAG_IMAGEWIDTH, width) < 0)\n\t\tgoto failure;\n\n\tif (CheckLongField(tif, TIFFTAG_IMAGELENGTH, length) < 0)\n\t\tgoto failure;\n\n\tif (CheckLongField(tif, TIFFTAG_ROWSPERSTRIP, rows_per_strip) < 0)\n\t\tgoto failure;\n\n\tfor (i = 0; i < NTAGS; i++) {\n\t\tif (CheckLongField(tif, long_tags[i].tag,\n\t\t\t\t   long_tags[i].value) < 0)\n\t\t\tgoto failure;\n\t}\n\n\tTIFFClose(tif);\n\t\n\t/* All tests passed; delete file and exit with success status. */\n\tunlink(filename);\n\treturn 0;\n\nfailure:\n\t/* Something goes wrong; close file and return unsuccessful status. */\n\tTIFFClose(tif);\n\tunlink(filename);\n\treturn 1;\n}\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiff/test/short_tag.c",
    "content": "/* $Id: short_tag.c,v 1.6 2006/03/23 14:54:02 dron Exp $ */\n\n/*\n * Copyright (c) 2004, Andrey Kiselev  <dron@ak4719.spb.edu>\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n/*\n * TIFF Library\n *\n * Module to test SHORT tags read/write functions.\n */\n\n#include \"tif_config.h\"\n\n#include <stdio.h>\n\n#ifdef HAVE_UNISTD_H \n# include <unistd.h> \n#endif \n\n#include \"tiffio.h\"\n\nextern int CheckShortField(TIFF *, ttag_t, uint16);\n\nconst char\t*filename = \"short_test.tiff\";\n\n#define\tSPP\t3\t\t/* Samples per pixel */\nconst uint16\twidth = 1;\nconst uint16\tlength = 1;\nconst uint16\tbps = 8;\nconst uint16\tphotometric = PHOTOMETRIC_RGB;\nconst uint16\trows_per_strip = 1;\nconst uint16\tplanarconfig = PLANARCONFIG_CONTIG;\n\nstatic struct SingleTags {\n\tttag_t\t\ttag;\n\tuint16\t\tvalue;\n} short_single_tags[] = {\n\t{ TIFFTAG_COMPRESSION, COMPRESSION_NONE },\n\t{ TIFFTAG_FILLORDER, FILLORDER_MSB2LSB },\n\t{ TIFFTAG_ORIENTATION, ORIENTATION_BOTRIGHT },\n\t{ TIFFTAG_RESOLUTIONUNIT, RESUNIT_INCH },\n\t{ TIFFTAG_INKSET, INKSET_MULTIINK },\n\t{ TIFFTAG_MINSAMPLEVALUE, 23 },\n\t{ TIFFTAG_MAXSAMPLEVALUE, 241 },\n\t{ TIFFTAG_NUMBEROFINKS, SPP },\n\t{ TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_UINT }\n\t/*{ TIFFTAG_IMAGEDEPTH, 1 },\n\t{ TIFFTAG_TILEDEPTH, 1 }*/\n};\n#define NSINGLETAGS   (sizeof(short_single_tags) / sizeof(short_single_tags[0]))\n\nint\nmain(int argc, char **argv)\n{\n\tTIFF\t\t*tif;\n\tint\t\ti;\n\tunsigned char\tbuf[3] = { 0, 127, 255 };\n\n\t/* Test whether we can write tags. */\n\ttif = TIFFOpen(filename, \"w\");\n\tif (!tif) {\n\t\tfprintf (stderr, \"Can't create test TIFF file %s.\\n\", filename);\n\t\treturn 1;\n\t}\n\n\tif (!TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, width)) {\n\t\tfprintf (stderr, \"Can't set ImageWidth tag.\\n\");\n\t\tgoto failure;\n\t}\n\tif (!TIFFSetField(tif, TIFFTAG_IMAGELENGTH, length)) {\n\t\tfprintf (stderr, \"Can't set ImageLength tag.\\n\");\n\t\tgoto failure;\n\t}\n\tif (!TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, bps)) {\n\t\tfprintf (stderr, \"Can't set BitsPerSample tag.\\n\");\n\t\tgoto failure;\n\t}\n\tif (!TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, SPP)) {\n\t\tfprintf (stderr, \"Can't set SamplesPerPixel tag.\\n\");\n\t\tgoto failure;\n\t}\n\tif (!TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, rows_per_strip)) {\n\t\tfprintf (stderr, \"Can't set SamplesPerPixel tag.\\n\");\n\t\tgoto failure;\n\t}\n\tif (!TIFFSetField(tif, TIFFTAG_PLANARCONFIG, planarconfig)) {\n\t\tfprintf (stderr, \"Can't set PlanarConfiguration tag.\\n\");\n\t\tgoto failure;\n\t}\n\tif (!TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, photometric)) {\n\t\tfprintf (stderr, \"Can't set PhotometricInterpretation tag.\\n\");\n\t\tgoto failure;\n\t}\n\n\tfor (i = 0; i < NSINGLETAGS; i++) {\n\t\tif (!TIFFSetField(tif, short_single_tags[i].tag,\n\t\t\t\t  short_single_tags[i].value)) {\n\t\t\tfprintf(stderr, \"Can't set tag %d.\\n\",\n\t\t\t\t(int)short_single_tags[i].tag);\n\t\t\tgoto failure;\n\t\t}\n\t}\n\n\t/* Write dummy pixel data. */\n\tif (!TIFFWriteScanline(tif, buf, 0, 0) < 0) {\n\t\tfprintf (stderr, \"Can't write image data.\\n\");\n\t\tgoto failure;\n\t}\n\n\tTIFFClose(tif);\n\t\n\t/* Ok, now test whether we can read written values. */\n\ttif = TIFFOpen(filename, \"r\");\n\tif (!tif) {\n\t\tfprintf (stderr, \"Can't open test TIFF file %s.\\n\", filename);\n\t\treturn 1;\n\t}\n\t\n\tif (CheckLongField(tif, TIFFTAG_IMAGEWIDTH, width) < 0)\n\t\tgoto failure;\n\n\tif (CheckLongField(tif, TIFFTAG_IMAGELENGTH, length) < 0)\n\t\tgoto failure;\n\n\tif (CheckShortField(tif, TIFFTAG_BITSPERSAMPLE, bps) < 0)\n\t\tgoto failure;\n\n\tif (CheckShortField(tif, TIFFTAG_PHOTOMETRIC, photometric) < 0)\n\t\tgoto failure;\n\n\tif (CheckShortField(tif, TIFFTAG_SAMPLESPERPIXEL, SPP) < 0)\n\t\tgoto failure;\n\n\tif (CheckLongField(tif, TIFFTAG_ROWSPERSTRIP, rows_per_strip) < 0)\n\t\tgoto failure;\n\n\tif (CheckShortField(tif, TIFFTAG_PLANARCONFIG, planarconfig) < 0)\n\t\tgoto failure;\n\n\tfor (i = 0; i < NSINGLETAGS; i++) {\n\t\tif (CheckShortField(tif, short_single_tags[i].tag,\n\t\t\t\t    short_single_tags[i].value) < 0)\n\t\t\tgoto failure;\n\t}\n\n\tTIFFClose(tif);\n\t\n\t/* All tests passed; delete file and exit with success status. */\n\tunlink(filename);\n\treturn 0;\n\nfailure:\n\t/* Something goes wrong; close file and return unsuccessful status. */\n\tTIFFClose(tif);\n\tunlink(filename);\n\treturn 1;\n}\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiff/test/strip.c",
    "content": "/* $Id: strip.c,v 1.3.2.1 2009-01-01 17:52:51 bfriesen Exp $ */\n\n/*\n * Copyright (c) 2004, Andrey Kiselev  <dron@ak4719.spb.edu>\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n/*\n * TIFF Library\n *\n * Functions to test strip interface of libtiff.\n */\n\n#include <stdio.h>\n#include <string.h>\n\n#include \"tiffio.h\"\n\nint\nwrite_strips(TIFF *tif, const tdata_t array, const tsize_t size)\n{\n\ttstrip_t\tstrip, nstrips;\n\ttsize_t\t\tstripsize, offset;\n\n\tstripsize = TIFFStripSize(tif);\n\tif (!stripsize) {\n\t\tfprintf (stderr, \"Wrong size of strip.\\n\");\n\t\treturn -1;\n\t}\n\n\tnstrips = TIFFNumberOfStrips(tif);\n\tfor (offset = 0, strip = 0;\n\t     offset < size && strip < nstrips;\n\t     offset+=stripsize, strip++) {\n\t\t/*\n\t\t * Properly write last strip.\n\t\t */\n\t\ttsize_t\tbufsize = size - offset;\n\t\tif (bufsize > stripsize)\n\t\t\tbufsize = stripsize;\n\n\t\tif (TIFFWriteEncodedStrip(tif, strip, (char *)array + offset,\n\t\t\t\t\t  bufsize) != bufsize) {\n\t\t\tfprintf (stderr, \"Can't write strip %lu.\\n\",\n\t\t\t\t (unsigned long)strip);\n\t\t\treturn -1;\n\t\t}\n        }\n\n\treturn 0;\n}\n\nint\nread_strips(TIFF *tif, const tdata_t array, const tsize_t size)\n{\n\ttstrip_t\tstrip, nstrips;\n\ttsize_t\t\tstripsize, offset;\n\ttdata_t\t\tbuf = NULL;\n\n\tstripsize = TIFFStripSize(tif);\n\tif (!stripsize) {\n\t\tfprintf (stderr, \"Wrong size of strip.\\n\");\n\t\treturn -1;\n\t}\n\n\tbuf = _TIFFmalloc(stripsize);\n\tif (!buf) {\n\t\tfprintf (stderr, \"Can't allocate space for strip buffer.\\n\");\n\t\treturn -1;\n\t}\n\n\tnstrips = TIFFNumberOfStrips(tif);\n\tfor (offset = 0, strip = 0;\n\t     offset < size && strip < nstrips;\n\t     offset+=stripsize, strip++) {\n\t\t/*\n\t\t * Properly read last strip.\n\t\t */\n\t\ttsize_t\tbufsize = size - offset;\n\t\tif (bufsize > stripsize)\n\t\t\tbufsize = stripsize;\n\n\t\tif (TIFFReadEncodedStrip(tif, strip, buf, -1) != bufsize) {\n\t\t\tfprintf (stderr, \"Can't read strip %lu.\\n\",\n\t\t\t\t (unsigned long)strip);\n\t\t\treturn -1;\n\t\t}\n\t\tif (memcmp(buf, (char *)array + offset, bufsize) != 0) {\n\t\t\tfprintf (stderr, \"Wrong data read for strip %lu.\\n\",\n\t\t\t\t (unsigned long)strip);\n\t\t\t_TIFFfree(buf);\n\t\t\treturn -1;\n\t\t}\n        }\n\n\t_TIFFfree(buf);\n\n\treturn 0;\n}\n\nint\ncreate_image_striped(const char *name, uint32 width, uint32 length,\n\t\t      uint32 rowsperstrip, uint16 compression,\n\t\t      uint16 spp, uint16 bps, uint16 photometric,\n\t\t      uint16 sampleformat, uint16 planarconfig,\n\t\t      const tdata_t array, const tsize_t size)\n{\n\tTIFF\t\t*tif;\n\n\t/* Test whether we can write tags. */\n\ttif = TIFFOpen(name, \"w\");\n\tif (!tif)\n\t\tgoto openfailure;\n\n\tif (!TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, width)) {\n\t\tfprintf (stderr, \"Can't set ImageWidth tag.\\n\");\n\t\tgoto failure;\n\t}\n\tif (!TIFFSetField(tif, TIFFTAG_IMAGELENGTH, length)) {\n\t\tfprintf (stderr, \"Can't set ImageLength tag.\\n\");\n\t\tgoto failure;\n\t}\n\tif (!TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, bps)) {\n\t\tfprintf (stderr, \"Can't set BitsPerSample tag.\\n\");\n\t\tgoto failure;\n\t}\n\tif (!TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, spp)) {\n\t\tfprintf (stderr, \"Can't set SamplesPerPixel tag.\\n\");\n\t\tgoto failure;\n\t}\n\tif (!TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, rowsperstrip)) {\n\t\tfprintf (stderr, \"Can't set RowsPerStrip tag.\\n\");\n\t\tgoto failure;\n\t}\n\tif (!TIFFSetField(tif, TIFFTAG_PLANARCONFIG, planarconfig)) {\n\t\tfprintf (stderr, \"Can't set PlanarConfiguration tag.\\n\");\n\t\tgoto failure;\n\t}\n\tif (!TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, photometric)) {\n\t\tfprintf (stderr, \"Can't set PhotometricInterpretation tag.\\n\");\n\t\tgoto failure;\n\t}\n\n\tif (write_strips(tif, array, size) < 0) {\n\t\tfprintf (stderr, \"Can't write image data.\\n\");\n\t\tgoto failure;\n\t}\n\n\tTIFFClose(tif);\n\treturn 0;\n\nfailure:\n\tTIFFClose(tif);\nopenfailure:\n\tfprintf (stderr, \"Can't create test TIFF file %s:\\n\"\n\"    ImageWidth=%u, ImageLength=%u, RowsPerStrip=%u, Compression=%d,\\n\"\n\"    BitsPerSample=%d, SamplesPerPixel=%d, SampleFormat=%d,\\n\"\n\"    PlanarConfiguration=%d, PhotometricInterpretation=%d.\\n\",\n\t\t name, width, length, rowsperstrip, compression,\n\t\t bps, spp, sampleformat, planarconfig,\n\t\t photometric);\n\treturn -1;\n}\n\nint\nread_image_striped(const char *name, uint32 width, uint32 length,\n\t\t    uint32 rowsperstrip, uint16 compression,\n\t\t    uint16 spp, uint16 bps, uint16 photometric,\n\t\t    uint16 sampleformat, uint16 planarconfig,\n\t\t    const tdata_t array, const tsize_t size)\n{\n\tTIFF\t\t*tif;\n\tuint16\t\tvalue_u16;\n\tuint32\t\tvalue_u32;\n\n\t/* Test whether we can read written values. */\n\ttif = TIFFOpen(name, \"r\");\n\tif (!tif)\n\t\tgoto openfailure;\n\t\n\tif (TIFFIsTiled(tif)) {\n\t\tfprintf (stderr, \"Can't read image %s, it is tiled.\\n\",\n\t\t\t name);\n\t\tgoto failure;\n\t}\n\tif (!TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &value_u32)\n\t    || value_u32 != width) {\n\t\tfprintf (stderr, \"Can't get tag %d.\\n\", TIFFTAG_IMAGEWIDTH);\n\t\tgoto failure;\n\t}\n\tif (!TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &value_u32)\n\t    || value_u32 != length) {\n\t\tfprintf (stderr, \"Can't get tag %d.\\n\", TIFFTAG_IMAGELENGTH);\n\t\tgoto failure;\n\t}\n\tif (!TIFFGetField(tif, TIFFTAG_BITSPERSAMPLE, &value_u16)\n\t    || value_u16 != bps) {\n\t\tfprintf (stderr, \"Can't get tag %d.\\n\", TIFFTAG_BITSPERSAMPLE);\n\t\tgoto failure;\n\t}\n\tif (!TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &value_u16)\n\t    || value_u16 != photometric) {\n\t\tfprintf (stderr, \"Can't get tag %d.\\n\", TIFFTAG_PHOTOMETRIC);\n\t\tgoto failure;\n\t}\n\tif (!TIFFGetField(tif, TIFFTAG_SAMPLESPERPIXEL, &value_u16)\n\t    || value_u16 != spp) {\n\t\tfprintf (stderr, \"Can't get tag %d.\\n\", TIFFTAG_SAMPLESPERPIXEL);\n\t\tgoto failure;\n\t}\n\tif (!TIFFGetField(tif, TIFFTAG_ROWSPERSTRIP, &value_u32)\n\t    || value_u32 != rowsperstrip) {\n\t\tfprintf (stderr, \"Can't get tag %d.\\n\", TIFFTAG_ROWSPERSTRIP);\n\t\tgoto failure;\n\t}\n\tif (!TIFFGetField(tif, TIFFTAG_PLANARCONFIG, &value_u16)\n\t    || value_u16 != planarconfig) {\n\t\tfprintf (stderr, \"Can't get tag %d.\\n\", TIFFTAG_PLANARCONFIG);\n\t\tgoto failure;\n\t}\n\n\tif (read_strips(tif, array, size) < 0) {\n\t\tfprintf (stderr, \"Can't read image data.\\n\");\n\t\tgoto failure;\n\t}\n\n\tTIFFClose(tif);\n\treturn 0;\n\nfailure:\n\tTIFFClose(tif);\nopenfailure:\n\tfprintf (stderr, \"Can't read test TIFF file %s:\\n\"\n\"    ImageWidth=%u, ImageLength=%u, RowsPerStrip=%u, Compression=%d,\\n\"\n\"    BitsPerSample=%d, SamplesPerPixel=%d, SampleFormat=%d,\\n\"\n\"    PlanarConfiguration=%d, PhotometricInterpretation=%d.\\n\",\n\t\t name, width, length, rowsperstrip, compression,\n\t\t bps, spp, sampleformat, planarconfig,\n\t\t photometric);\n\treturn -1;\n}\n\nint\nwrite_scanlines(TIFF *tif, const tdata_t array, const tsize_t size)\n{\n\tuint32\t\tlength, row;\n\ttsize_t\t\tscanlinesize, offset;\n\n\t(void) size;\n\n\tif (!TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &length)) {\n\t\tfprintf (stderr, \"Can't get tag %d.\\n\", TIFFTAG_IMAGELENGTH);\n\t\treturn -1;\n\t}\n\t\n\tscanlinesize = TIFFScanlineSize(tif);\n\tif (!scanlinesize) {\n\t\tfprintf (stderr, \"Wrong size of scanline.\\n\");\n\t\treturn -1;\n\t}\n\n\tfor (offset = 0, row = 0; row < length; offset+=scanlinesize, row++) {\n\t\tif (TIFFWriteScanline(tif, (char *)array + offset, row, 0) < 0) {\n\t\t\tfprintf (stderr,\n\t\t\t\t \"Can't write image data at row %u.\\n\", row);\n\t\t\treturn -1;\n\t\t}\n        }\n\n\treturn 0;\n}\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiff/test/strip_rw.c",
    "content": "/* $Id: strip_rw.c,v 1.5 2006/03/23 14:54:02 dron Exp $ */\n\n/*\n * Copyright (c) 2004, Andrey Kiselev  <dron@ak4719.spb.edu>\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n/*\n * TIFF Library\n *\n * Test libtiff input/output routines.\n */\n\n#include \"tif_config.h\"\n\n#include <stdio.h>\n\n#ifdef HAVE_UNISTD_H \n# include <unistd.h> \n#endif \n\n#include \"tiffio.h\"\n#include \"test_arrays.h\"\n\nextern int\ncreate_image_striped(const char *, uint32, uint32, uint32, uint16, uint16,\n\t\t     uint16, uint16, uint16, uint16, const tdata_t,\n\t\t     const tsize_t);\nextern int\nread_image_striped(const char *, uint32, uint32, uint32, uint16, uint16,\n\t\t   uint16, uint16, uint16, uint16, const tdata_t,\n\t\t   const tsize_t);\n\nconst char\t*filename = \"strip_test.tiff\";\n\nint\nmain(int argc, char **argv)\n{\n\tuint32\t\trowsperstrip;\n\tuint16\t\tcompression;\n\tuint16\t\tspp, bps, photometric, sampleformat, planarconfig;\n\n\t/* \n\t * Test two special cases: image consisting from single line and image\n\t * consisting from single column.\n\t */\n\trowsperstrip = 1;\n\tcompression = COMPRESSION_NONE;\n\tspp = 1;\n\tbps = 8;\n        photometric = PHOTOMETRIC_MINISBLACK;\n\tsampleformat = SAMPLEFORMAT_UINT;\n\tplanarconfig = PLANARCONFIG_CONTIG;\n\n\tif (create_image_striped(filename, XSIZE * YSIZE, 1, rowsperstrip,\n\t\t\t\t  compression, spp, bps, photometric,\n\t\t\t\t  sampleformat, planarconfig,\n\t\t\t\t  (const tdata_t) byte_array1, byte_array1_size) < 0) {\n\t\tfprintf (stderr, \"Can't create TIFF file %s.\\n\", filename);\n\t\tgoto failure;\n\t}\n\tif (read_image_striped(filename, XSIZE * YSIZE, 1, rowsperstrip,\n\t\t\t\tcompression, spp, bps, photometric,\n\t\t\t\tsampleformat, planarconfig,\n\t\t\t\t(const tdata_t) byte_array1, byte_array1_size) < 0) {\n\t\tfprintf (stderr, \"Can't read TIFF file %s.\\n\", filename);\n\t\tgoto failure;\n\t}\n\tunlink(filename);\n\t\t\n\tif (create_image_striped(filename, 1, XSIZE * YSIZE, rowsperstrip,\n\t\t\t\t  compression, spp, bps, photometric,\n\t\t\t\t  sampleformat, planarconfig,\n\t\t\t\t  (const tdata_t) byte_array1, byte_array1_size) < 0) {\n\t\tfprintf (stderr, \"Can't create TIFF file %s.\\n\", filename);\n\t\tgoto failure;\n\t}\n\tif (read_image_striped(filename, 1, XSIZE * YSIZE, rowsperstrip,\n\t\t\t\tcompression, spp, bps, photometric,\n\t\t\t\tsampleformat, planarconfig,\n\t\t\t\t(const tdata_t) byte_array1, byte_array1_size) < 0) {\n\t\tfprintf (stderr, \"Can't read TIFF file %s.\\n\", filename);\n\t\tgoto failure;\n\t}\n\tunlink(filename);\n\t\t\n\t/* \n\t * Test one-channel image with different parameters.\n\t */\n\trowsperstrip = 1;\n\tspp = 1;\n\tbps = 8;\n        photometric = PHOTOMETRIC_MINISBLACK;\n\tsampleformat = SAMPLEFORMAT_UINT;\n\tplanarconfig = PLANARCONFIG_CONTIG;\n\n\tif (create_image_striped(filename, XSIZE, YSIZE, rowsperstrip,\n\t\t\t\t  compression, spp, bps, photometric,\n\t\t\t\t  sampleformat, planarconfig,\n\t\t\t\t  (const tdata_t) byte_array1, byte_array1_size) < 0) {\n\t\tfprintf (stderr, \"Can't create TIFF file %s.\\n\", filename);\n\t\tgoto failure;\n\t}\n\tif (read_image_striped(filename, XSIZE, YSIZE, rowsperstrip,\n\t\t\t\tcompression, spp, bps, photometric,\n\t\t\t\tsampleformat, planarconfig,\n\t\t\t\t(const tdata_t) byte_array1, byte_array1_size) < 0) {\n\t\tfprintf (stderr, \"Can't read TIFF file %s.\\n\", filename);\n\t\tgoto failure;\n\t}\n\tunlink(filename);\n\t\n\trowsperstrip = YSIZE;\n\tif (create_image_striped(filename, XSIZE, YSIZE, rowsperstrip,\n\t\t\t\t  compression, spp, bps, photometric,\n\t\t\t\t  sampleformat, planarconfig,\n\t\t\t\t  (const tdata_t) byte_array1, byte_array1_size) < 0) {\n\t\tfprintf (stderr, \"Can't create TIFF file %s.\\n\", filename);\n\t\tgoto failure;\n\t}\n\tif (read_image_striped(filename, XSIZE, YSIZE, rowsperstrip,\n\t\t\t\tcompression, spp, bps, photometric,\n\t\t\t\tsampleformat, planarconfig,\n\t\t\t\t(const tdata_t) byte_array1, byte_array1_size) < 0) {\n\t\tfprintf (stderr, \"Can't read TIFF file %s.\\n\", filename);\n\t\tgoto failure;\n\t}\n\tunlink(filename);\n\n\treturn 0;\n\nfailure:\n\tunlink(filename);\n\treturn 1;\n}\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiff/test/test_arrays.c",
    "content": "/* $Id: test_arrays.c,v 1.3 2006/03/23 14:54:02 dron Exp $ */\n\n/*\n * Copyright (c) 2004, Andrey Kiselev  <dron@ak4719.spb.edu>\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n/*\n * TIFF Library\n *\n * Numerical arrays used to test libtiff's read/write functions.\n */\n\n#include <stddef.h>\n\n#include \"test_arrays.h\"\n\nconst unsigned char byte_array1[XSIZE * YSIZE]=\n{\n86, 84, 86, 90, 89, 85, 90, 78, 77, 79, 75, 77, 79, 86,\n87, 83, 82, 87, 89, 88, 86, 87, 88, 87, 81, 84, 85, 85,\n84, 86, 88, 91, 96, 95, 97, 95, 89,\n85, 82, 81, 88, 89, 85, 89, 83, 74, 79, 76, 77, 80, 87,\n87, 84, 84, 88, 90, 89, 87, 85, 87, 88, 83, 80, 82, 84,\n85, 87, 90, 95, 96, 95, 95, 92, 90,\n85, 81, 79, 84, 90, 87, 88, 88, 73, 79, 75, 76, 79, 88,\n88, 87, 85, 90, 92, 89, 88, 88, 87, 86, 84, 82, 82, 83,\n87, 89, 93, 94, 93, 93, 92, 92, 96,\n85, 82, 76, 80, 88, 89, 88, 89, 73, 80, 75, 75, 77, 89,\n92, 93, 91, 89, 94, 92, 90, 89, 88, 84, 84, 82, 82, 85,\n88, 91, 94, 93, 93, 89, 90, 96, 96,\n87, 83, 75, 77, 83, 89, 90, 90, 74, 78, 76, 76, 76, 84,\n94, 100, 89, 92, 94, 92, 90, 89, 90, 85, 84, 83, 83, 87,\n91, 92, 88, 92, 91, 88, 90, 97, 95,\n89, 83, 74, 77, 82, 84, 90, 92, 78, 72, 76, 75, 75, 81,\n95, 101, 95, 92, 95, 93, 90, 89, 90, 87, 86, 84, 86, 88,\n90, 90, 87, 90, 89, 90, 89, 98, 98,\n92, 84, 75, 76, 81, 81, 86, 91, 81, 72, 74, 74, 75, 81,\n104, 108, 93, 92, 95, 94, 88, 87, 89, 87, 85, 85, 88, 89,\n93, 91, 88, 88, 91, 88, 91, 106, 108,\n93, 89, 78, 75, 77, 80, 85, 86, 85, 73, 72, 73, 74, 79,\n102, 101, 88, 92, 93, 91, 87, 87, 86, 87, 85, 86, 88, 89,\n94, 94, 90, 88, 85, 86, 98, 109, 113,\n92, 93, 83, 76, 74, 79, 84, 85, 81, 75, 72, 73, 74, 79,\n105, 86, 86, 92, 96, 98, 104, 86, 85, 85, 85, 88, 90, 90,\n93, 92, 88, 87, 86, 89, 97, 110, 109,\n92, 93, 89, 78, 79, 78, 89, 84, 75, 76, 73, 72, 73, 78,\n105, 83, 82, 88, 83, 107, 95, 84, 85, 84, 86, 87, 90, 91,\n92, 90, 88, 87, 89, 90, 91, 99, 107,\n96, 94, 91, 82, 84, 86, 91, 87, 75, 74, 73, 73, 73, 77,\n101, 86, 83, 89, 92, 99, 98, 86, 86, 87, 83, 84, 89, 89,\n92, 92, 92, 96, 96, 87, 91, 90, 98,\n96, 97, 94, 87, 88, 89, 92, 90, 79, 72, 73, 73, 74, 77,\n100, 92, 84, 86, 98, 100, 92, 87, 88, 88, 84, 83, 87, 89,\n91, 94, 94, 96, 93, 87, 87, 84, 109,\n93, 92, 95, 92, 94, 93, 92, 91, 82, 72, 73, 74, 74, 76,\n95, 89, 85, 84, 102, 89, 85, 88, 94, 86, 82, 83, 82, 91,\n94, 97, 90, 92, 85, 90, 85, 79, 125,\n89, 96, 94, 90, 94, 95, 91, 91, 85, 76, 72, 73, 74, 75,\n88, 100, 83, 84, 84, 83, 85, 88, 90, 85, 84, 83, 84, 88,\n92, 93, 90, 89, 84, 90, 94, 79, 139,\n93, 97, 97, 93, 92, 95, 91, 90, 87, 81, 74, 73, 73, 74,\n85, 97, 95, 95, 89, 86, 86, 92, 87, 85, 84, 90, 86, 85,\n91, 87, 87, 86, 93, 124, 140, 106, 143,\n101, 95, 97, 97, 96, 95, 84, 88, 87, 82, 78, 73, 73, 74,\n82, 92, 104, 95, 88, 89, 87, 89, 86, 85, 86, 87, 87, 81,\n81, 83, 91, 106, 131, 153, 151, 123, 133,\n99, 101, 102, 99, 96, 90, 83, 82, 85, 84, 79, 76, 74, 74,\n78, 81, 89, 96, 90, 93, 88, 88, 86, 88, 89, 95, 89, 82,\n81, 85, 104, 118, 141, 160, 129, 137, 147,\n103, 104, 98, 99, 90, 88, 81, 76, 81, 83, 79, 77, 75, 75,\n75, 76, 80, 90, 94, 87, 86, 87, 92, 85, 85, 85, 87, 87,\n89, 91, 112, 115, 145, 154, 145, 141, 147,\n106, 103, 100, 99, 92, 82, 78, 75, 78, 81, 79, 77, 77, 78,\n78, 76, 77, 81, 89, 87, 84, 84, 90, 86, 85, 84, 80, 85,\n97, 104, 119, 119, 149, 147, 144, 146, 152,\n107, 105, 103, 100, 93, 83, 78, 74, 74, 79, 78, 77, 76, 78,\n80, 79, 76, 78, 83, 84, 81, 81, 84, 83, 82, 78, 78, 85,\n86, 97, 105, 114, 145, 146, 148, 147, 150,\n107, 105, 103, 97, 92, 84, 72, 72, 75, 77, 76, 75, 76, 79,\n80, 80, 77, 76, 82, 81, 80, 81, 80, 80, 80, 77, 74, 74,\n73, 77, 91, 110, 132, 141, 152, 152, 145,\n107, 105, 103, 96, 92, 86, 73, 71, 73, 75, 75, 76, 76, 78,\n80, 80, 80, 98, 80, 80, 82, 82, 80, 78, 76, 73, 71, 72,\n71, 74, 80, 108, 119, 136, 158, 142, 137,\n107, 104, 101, 97, 85, 87, 75, 70, 70, 74, 74, 75, 77, 78,\n80, 82, 110, 117, 110, 78, 81, 83, 81, 78, 76, 73, 71, 69,\n68, 71, 74, 95, 120, 138, 148, 143, 139\n};\n\nconst size_t byte_array1_size = sizeof(byte_array1);\n\nconst unsigned char byte_array2[YSIZE * XSIZE] =\n{\n77, 73, 76, 80, 79, 75, 82, 65, 62, 64, 59, 59, 61, 72,\n70, 67, 65, 70, 71, 70, 68, 66, 65, 67, 66, 66, 66, 66,\n66, 66, 66, 66, 66, 65, 63, 63, 62,\n75, 71, 71, 79, 81, 75, 81, 73, 59, 65, 60, 60, 64, 73,\n73, 68, 66, 70, 72, 71, 68, 66, 66, 67, 66, 66, 66, 67,\n67, 67, 66, 67, 66, 64, 63, 63, 63,\n76, 71, 66, 73, 81, 78, 80, 79, 59, 66, 60, 59, 62, 74,\n74, 71, 67, 70, 73, 71, 68, 66, 65, 65, 66, 66, 67, 67,\n67, 67, 67, 67, 66, 64, 64, 64, 64,\n76, 72, 64, 68, 79, 81, 80, 80, 59, 68, 60, 59, 60, 75,\n75, 73, 67, 68, 73, 72, 68, 66, 65, 63, 67, 67, 67, 67,\n68, 67, 67, 66, 65, 64, 65, 65, 65,\n79, 72, 63, 66, 73, 80, 83, 82, 60, 65, 61, 61, 60, 66,\n75, 75, 65, 70, 73, 72, 68, 66, 65, 64, 68, 67, 68, 68,\n68, 67, 67, 66, 65, 65, 65, 66, 65,\n81, 73, 62, 65, 72, 74, 82, 85, 66, 59, 62, 60, 60, 63,\n75, 76, 68, 69, 72, 72, 68, 66, 66, 65, 67, 68, 68, 68,\n68, 68, 66, 66, 64, 66, 65, 66, 66,\n84, 74, 64, 64, 70, 71, 78, 84, 70, 58, 60, 59, 59, 63,\n75, 80, 73, 67, 72, 72, 68, 66, 66, 65, 66, 68, 68, 68,\n68, 68, 66, 65, 65, 65, 66, 67, 68,\n87, 81, 66, 63, 65, 68, 76, 76, 75, 59, 58, 59, 59, 60,\n71, 92, 65, 64, 74, 72, 69, 67, 65, 65, 65, 68, 69, 68,\n69, 67, 65, 65, 65, 65, 67, 68, 69,\n86, 86, 73, 64, 62, 67, 75, 76, 70, 61, 58, 58, 59, 60,\n81, 68, 59, 63, 74, 90, 99, 67, 65, 65, 64, 67, 68, 68,\n68, 67, 65, 65, 66, 65, 66, 68, 68,\n85, 85, 80, 66, 67, 67, 81, 74, 62, 63, 59, 58, 58, 60,\n93, 61, 59, 59, 68, 115, 76, 67, 66, 64, 64, 66, 68, 68,\n68, 66, 65, 65, 66, 65, 64, 65, 69,\n90, 87, 83, 71, 74, 77, 83, 79, 63, 60, 59, 59, 58, 58,\n90, 61, 59, 59, 67, 80, 71, 68, 66, 64, 63, 63, 68, 68,\n68, 66, 65, 66, 67, 65, 64, 62, 87,\n91, 92, 86, 76, 78, 81, 85, 82, 67, 59, 59, 59, 59, 60,\n88, 72, 59, 60, 74, 80, 70, 67, 66, 64, 62, 60, 65, 68,\n67, 66, 65, 67, 66, 64, 62, 59, 111,\n84, 84, 87, 85, 87, 85, 84, 84, 72, 59, 59, 59, 59, 59,\n73, 71, 62, 59, 100, 70, 70, 67, 66, 64, 60, 58, 58, 67,\n68, 66, 65, 66, 64, 63, 59, 56, 131,\n80, 90, 87, 83, 88, 89, 84, 83, 76, 64, 59, 59, 59, 58,\n59, 97, 64, 62, 71, 68, 70, 73, 66, 63, 61, 58, 58, 62,\n67, 66, 64, 65, 63, 63, 61, 57, 149,\n86, 91, 92, 87, 85, 88, 83, 81, 78, 69, 61, 59, 59, 59,\n59, 61, 83, 72, 67, 67, 69, 69, 66, 64, 61, 72, 56, 57,\n64, 64, 64, 64, 65, 115, 150, 93, 151,\n97, 89, 91, 92, 89, 88, 74, 80, 78, 71, 65, 59, 58, 59,\n58, 59, 71, 72, 67, 70, 70, 69, 67, 64, 63, 66, 56, 54,\n57, 59, 64, 87, 139, 162, 160, 128, 141,\n94, 96, 97, 94, 89, 82, 71, 70, 76, 73, 67, 61, 59, 59,\n58, 59, 61, 71, 67, 75, 70, 68, 70, 65, 63, 63, 59, 56,\n54, 55, 90, 121, 149, 168, 138, 144, 157,\n99, 100, 93, 93, 82, 80, 70, 62, 70, 72, 67, 63, 60, 60,\n58, 58, 60, 68, 70, 70, 69, 68, 79, 68, 64, 62, 60, 59,\n57, 57, 88, 120, 151, 162, 154, 149, 155,\n103, 99, 95, 94, 84, 73, 67, 62, 65, 69, 67, 64, 63, 64,\n63, 59, 60, 65, 71, 69, 69, 67, 78, 65, 63, 61, 59, 61,\n60, 68, 100, 128, 155, 155, 152, 155, 164,\n104, 102, 99, 95, 86, 74, 67, 61, 61, 66, 65, 63, 63, 64,\n65, 63, 60, 63, 70, 69, 67, 67, 67, 65, 62, 60, 58, 57,\n62, 58, 71, 117, 150, 154, 157, 155, 163,\n104, 101, 99, 91, 84, 74, 59, 59, 62, 64, 63, 61, 62, 64,\n64, 64, 61, 60, 69, 68, 67, 69, 67, 65, 62, 59, 58, 57,\n57, 56, 59, 104, 137, 147, 159, 161, 158,\n104, 101, 99, 90, 85, 77, 60, 57, 60, 62, 62, 62, 63, 64,\n65, 65, 66, 100, 67, 67, 69, 69, 67, 65, 63, 60, 58, 56,\n54, 55, 56, 77, 122, 142, 166, 157, 150,\n104, 101, 97, 92, 77, 79, 64, 57, 57, 62, 62, 62, 64, 65,\n66, 65, 115, 138, 129, 64, 68, 70, 68, 66, 64, 60, 58, 56,\n53, 53, 56, 62, 115, 143, 157, 156, 159\n};\n\nconst size_t byte_array2_size = sizeof(byte_array2);\n\nconst unsigned char byte_array3[YSIZE * XSIZE] =\n{\n211, 221, 216, 201, 205, 216, 195, 236, 244, 237, 250, 250, 248, 218,\n223, 232, 236, 224, 221, 221, 227, 231, 232, 227, 229, 227, 227, 225,\n227, 225, 226, 226, 226, 228, 234, 234, 234, 216, 226, 228, 205, 200,\n214, 198, 215, 250, 233, 247, 250, 242, 219, 220, 229, 235, 225, 217,\n220, 227, 232, 230, 228, 229, 228, 227, 224, 225, 223, 226, 225, 226,\n230, 233, 233, 234, 213, 227, 237, 220, 200, 204, 202, 201, 248, 231,\n246, 250, 245, 214, 215, 223, 232, 225, 218, 218, 225, 230, 232, 231,\n229, 227, 225, 224, 223, 226, 224, 225, 228, 229, 230, 232, 231, 215,\n223, 242, 233, 206, 200, 201, 197, 250, 227, 250, 249, 248, 211, 212,\n216, 233, 229, 216, 218, 225, 230, 232, 237, 226, 224, 224, 223, 225,\n225, 224, 225, 228, 229, 231, 229, 231, 208, 220, 247, 238, 221, 202,\n194, 194, 245, 237, 247, 247, 249, 234, 210, 212, 237, 222, 219, 217,\n226, 229, 232, 235, 222, 222, 223, 223, 223, 224, 224, 227, 226, 229,\n229, 228, 231, 200, 221, 247, 239, 224, 217, 196, 189, 229, 248, 245,\n248, 250, 241, 210, 210, 230, 225, 218, 218, 224, 230, 230, 229, 224,\n222, 222, 222, 222, 223, 225, 226, 231, 226, 228, 229, 230, 191, 216,\n246, 245, 226, 228, 207, 191, 221, 251, 248, 249, 251, 245, 214, 214,\n233, 229, 217, 217, 224, 229, 230, 229, 225, 220, 223, 221, 222, 224,\n224, 227, 230, 227, 226, 229, 230, 187, 199, 238, 248, 242, 231, 213,\n211, 209, 246, 248, 251, 251, 250, 226, 215, 236, 237, 217, 215, 222,\n226, 229, 229, 227, 222, 222, 223, 222, 225, 227, 228, 226, 227, 228,\n228, 230, 188, 189, 221, 243, 247, 237, 215, 209, 223, 241, 248, 248,\n250, 248, 228, 234, 251, 239, 219, 210, 205, 224, 229, 228, 230, 221,\n223, 223, 222, 226, 229, 228, 224, 227, 229, 230, 232, 190, 190, 201,\n235, 236, 238, 198, 214, 243, 238, 248, 248, 250, 249, 215, 244, 250,\n250, 240, 168, 220, 224, 228, 230, 231, 226, 221, 224, 223, 226, 230,\n227, 226, 226, 230, 233, 234, 179, 185, 195, 224, 215, 210, 195, 204,\n239, 245, 250, 250, 252, 254, 216, 243, 249, 249, 233, 210, 215, 223,\n227, 230, 234, 234, 224, 223, 223, 227, 230, 226, 226, 228, 231, 235,\n212, 178, 174, 190, 211, 207, 199, 189, 194, 230, 250, 250, 250, 253,\n253, 222, 225, 250, 248, 218, 216, 217, 225, 226, 232, 239, 242, 229,\n223, 224, 229, 230, 225, 228, 230, 236, 241, 183, 194, 194, 185, 190,\n185, 190, 191, 191, 219, 250, 251, 250, 253, 254, 241, 225, 246, 249,\n198, 217, 220, 224, 225, 234, 241, 242, 246, 224, 223, 227, 229, 227,\n228, 234, 237, 245, 149, 203, 178, 182, 193, 185, 179, 191, 194, 211,\n236, 252, 252, 254, 254, 253, 192, 240, 244, 235, 224, 220, 229, 224,\n236, 239, 243, 244, 236, 224, 229, 230, 229, 231, 230, 233, 244, 128,\n188, 177, 171, 184, 191, 182, 196, 197, 208, 224, 247, 253, 255, 252,\n250, 248, 226, 216, 228, 230, 220, 220, 227, 234, 237, 231, 247, 244,\n231, 231, 229, 228, 229, 182, 128, 196, 118, 160, 182, 174, 172, 179,\n183, 216, 203, 206, 220, 236, 253, 254, 253, 253, 249, 225, 219, 232,\n230, 220, 224, 227, 233, 237, 234, 244, 250, 245, 240, 224, 212, 174,\n123, 124, 176, 127, 171, 163, 161, 167, 177, 198, 221, 228, 212, 215,\n233, 245, 252, 255, 253, 252, 251, 223, 231, 216, 222, 227, 231, 231,\n234, 227, 238, 245, 249, 244, 210, 177, 124, 129, 134, 124, 113, 156,\n155, 172, 168, 197, 201, 224, 247, 224, 219, 233, 242, 249, 250, 252,\n254, 252, 230, 230, 224, 224, 225, 225, 227, 232, 232, 235, 239, 239,\n241, 213, 178, 131, 128, 128, 120, 114, 149, 157, 165, 168, 191, 218,\n231, 246, 237, 226, 234, 241, 243, 239, 244, 252, 249, 237, 225, 226,\n224, 227, 220, 229, 235, 235, 239, 238, 236, 230, 204, 177, 125, 131,\n127, 117, 111, 146, 151, 158, 166, 187, 215, 230, 246, 246, 231, 238,\n243, 246, 243, 241, 244, 253, 245, 226, 226, 229, 229, 229, 231, 236,\n238, 241, 240, 241, 235, 224, 188, 134, 123, 127, 116, 116, 144, 151,\n158, 173, 190, 214, 251, 250, 243, 236, 242, 249, 246, 241, 241, 244,\n251, 251, 228, 230, 230, 226, 232, 231, 236, 241, 243, 244, 243, 243,\n235, 200, 150, 128, 122, 119, 117, 144, 151, 156, 176, 190, 207, 246,\n253, 244, 239, 244, 246, 244, 242, 240, 243, 249, 198, 239, 234, 226,\n226, 228, 234, 238, 241, 244, 245, 247, 250, 244, 219, 182, 138, 118,\n118, 116, 143, 150, 162, 173, 208, 205, 238, 253, 251, 241, 244, 244,\n242, 243, 238, 246, 193, 146, 173, 246, 231, 223, 230, 232, 236, 240,\n245, 247, 252, 252, 245, 233, 195, 138, 114, 118, 108\n};\n\nconst size_t byte_array3_size = sizeof(byte_array3);\n\nconst float array_float1[YSIZE * XSIZE] =\n{\n234.866, 229.404, 234.866, 245.790, 243.059, 232.135, 245.790, 213.018,\n210.287, 215.749, 204.825, 210.287, 215.749, 234.866, 237.597, 226.673,\n223.942, 237.597, 243.059, 240.328, 234.866, 237.597, 240.328, 237.597,\n221.211, 229.404, 232.135, 232.135, 229.404, 234.866, 240.328, 248.521,\n262.176, 259.445, 264.907, 259.445, 243.059,\n232.135, 223.942, 221.211, 240.328, 243.059, 232.135, 243.059, 226.673,\n202.094, 215.749, 207.556, 210.287, 218.480, 237.597, 237.597, 229.404,\n229.404, 240.328, 245.790, 243.059, 237.597, 232.135, 237.597, 240.328,\n226.673, 218.480, 223.942, 229.404, 232.135, 237.597, 245.790, 259.445,\n262.176, 259.445, 259.445, 251.252, 245.790,\n232.135, 221.211, 215.749, 229.404, 245.790, 237.597, 240.328, 240.328,\n199.363, 215.749, 204.825, 207.556, 215.749, 240.328, 240.328, 237.597,\n232.135, 245.790, 251.252, 243.059, 240.328, 240.328, 237.597, 234.866,\n229.404, 223.942, 223.942, 226.673, 237.597, 243.059, 253.983, 256.714,\n253.983, 253.983, 251.252, 251.252, 262.176,\n232.135, 223.942, 207.556, 218.480, 240.328, 243.059, 240.328, 243.059,\n199.363, 218.480, 204.825, 204.825, 210.287, 243.059, 251.252, 253.983,\n248.521, 243.059, 256.714, 251.252, 245.790, 243.059, 240.328, 229.404,\n229.404, 223.942, 223.942, 232.135, 240.328, 248.521, 256.714, 253.983,\n253.983, 243.059, 245.790, 262.176, 262.176,\n237.597, 226.673, 204.825, 210.287, 226.673, 243.059, 245.790, 245.790,\n202.094, 213.018, 207.556, 207.556, 207.556, 229.404, 256.714, 273.100,\n243.059, 251.252, 256.714, 251.252, 245.790, 243.059, 245.790, 232.135,\n229.404, 226.673, 226.673, 237.597, 248.521, 251.252, 240.328, 251.252,\n248.521, 240.328, 245.790, 264.907, 259.445,\n243.059, 226.673, 202.094, 210.287, 223.942, 229.404, 245.790, 251.252,\n213.018, 196.632, 207.556, 204.825, 204.825, 221.211, 259.445, 275.831,\n259.445, 251.252, 259.445, 253.983, 245.790, 243.059, 245.790, 237.597,\n234.866, 229.404, 234.866, 240.328, 245.790, 245.790, 237.597, 245.790,\n243.059, 245.790, 243.059, 267.638, 267.638,\n251.252, 229.404, 204.825, 207.556, 221.211, 221.211, 234.866, 248.521,\n221.211, 196.632, 202.094, 202.094, 204.825, 221.211, 284.024, 294.948,\n253.983, 251.252, 259.445, 256.714, 240.328, 237.597, 243.059, 237.597,\n232.135, 232.135, 240.328, 243.059, 253.983, 248.521, 240.328, 240.328,\n248.521, 240.328, 248.521, 289.486, 294.948,\n253.983, 243.059, 213.018, 204.825, 210.287, 218.480, 232.135, 234.866,\n232.135, 199.363, 196.632, 199.363, 202.094, 215.749, 278.562, 275.831,\n240.328, 251.252, 253.983, 248.521, 237.597, 237.597, 234.866, 237.597,\n232.135, 234.866, 240.328, 243.059, 256.714, 256.714, 245.790, 240.328,\n232.135, 234.866, 267.638, 297.679, 308.603,\n251.252, 253.983, 226.673, 207.556, 202.094, 215.749, 229.404, 232.135,\n221.211, 204.825, 196.632, 199.363, 202.094, 215.749, 286.755, 234.866,\n234.866, 251.252, 262.176, 267.638, 284.024, 234.866, 232.135, 232.135,\n232.135, 240.328, 245.790, 245.790, 253.983, 251.252, 240.328, 237.597,\n234.866, 243.059, 264.907, 300.410, 297.679,\n251.252, 253.983, 243.059, 213.018, 215.749, 213.018, 243.059, 229.404,\n204.825, 207.556, 199.363, 196.632, 199.363, 213.018, 286.755, 226.673,\n223.942, 240.328, 226.673, 292.217, 259.445, 229.404, 232.135, 229.404,\n234.866, 237.597, 245.790, 248.521, 251.252, 245.790, 240.328, 237.597,\n243.059, 245.790, 248.521, 270.369, 292.217,\n262.176, 256.714, 248.521, 223.942, 229.404, 234.866, 248.521, 237.597,\n204.825, 202.094, 199.363, 199.363, 199.363, 210.287, 275.831, 234.866,\n226.673, 243.059, 251.252, 270.369, 267.638, 234.866, 234.866, 237.597,\n226.673, 229.404, 243.059, 243.059, 251.252, 251.252, 251.252, 262.176,\n262.176, 237.597, 248.521, 245.790, 267.638,\n262.176, 264.907, 256.714, 237.597, 240.328, 243.059, 251.252, 245.790,\n215.749, 196.632, 199.363, 199.363, 202.094, 210.287, 273.100, 251.252,\n229.404, 234.866, 267.638, 273.100, 251.252, 237.597, 240.328, 240.328,\n229.404, 226.673, 237.597, 243.059, 248.521, 256.714, 256.714, 262.176,\n253.983, 237.597, 237.597, 229.404, 297.679,\n253.983, 251.252, 259.445, 251.252, 256.714, 253.983, 251.252, 248.521,\n223.942, 196.632, 199.363, 202.094, 202.094, 207.556, 259.445, 243.059,\n232.135, 229.404, 278.562, 243.059, 232.135, 240.328, 256.714, 234.866,\n223.942, 226.673, 223.942, 248.521, 256.714, 264.907, 245.790, 251.252,\n232.135, 245.790, 232.135, 215.749, 341.375,\n243.059, 262.176, 256.714, 245.790, 256.714, 259.445, 248.521, 248.521,\n232.135, 207.556, 196.632, 199.363, 202.094, 204.825, 240.328, 273.100,\n226.673, 229.404, 229.404, 226.673, 232.135, 240.328, 245.790, 232.135,\n229.404, 226.673, 229.404, 240.328, 251.252, 253.983, 245.790, 243.059,\n229.404, 245.790, 256.714, 215.749, 379.609,\n253.983, 264.907, 264.907, 253.983, 251.252, 259.445, 248.521, 245.790,\n237.597, 221.211, 202.094, 199.363, 199.363, 202.094, 232.135, 264.907,\n259.445, 259.445, 243.059, 234.866, 234.866, 251.252, 237.597, 232.135,\n229.404, 245.790, 234.866, 232.135, 248.521, 237.597, 237.597, 234.866,\n253.983, 338.644, 382.340, 289.486, 390.533,\n275.831, 259.445, 264.907, 264.907, 262.176, 259.445, 229.404, 240.328,\n237.597, 223.942, 213.018, 199.363, 199.363, 202.094, 223.942, 251.252,\n284.024, 259.445, 240.328, 243.059, 237.597, 243.059, 234.866, 232.135,\n234.866, 237.597, 237.597, 221.211, 221.211, 226.673, 248.521, 289.486,\n357.761, 417.843, 412.381, 335.913, 363.223,\n270.369, 275.831, 278.562, 270.369, 262.176, 245.790, 226.673, 223.942,\n232.135, 229.404, 215.749, 207.556, 202.094, 202.094, 213.018, 221.211,\n243.059, 262.176, 245.790, 253.983, 240.328, 240.328, 234.866, 240.328,\n243.059, 259.445, 243.059, 223.942, 221.211, 232.135, 284.024, 322.258,\n385.071, 436.960, 352.299, 374.147, 401.457,\n281.293, 284.024, 267.638, 270.369, 245.790, 240.328, 221.211, 207.556,\n221.211, 226.673, 215.749, 210.287, 204.825, 204.825, 204.825, 207.556,\n218.480, 245.790, 256.714, 237.597, 234.866, 237.597, 251.252, 232.135,\n232.135, 232.135, 237.597, 237.597, 243.059, 248.521, 305.872, 314.065,\n395.995, 420.574, 395.995, 385.071, 401.457,\n289.486, 281.293, 273.100, 270.369, 251.252, 223.942, 213.018, 204.825,\n213.018, 221.211, 215.749, 210.287, 210.287, 213.018, 213.018, 207.556,\n210.287, 221.211, 243.059, 237.597, 229.404, 229.404, 245.790, 234.866,\n232.135, 229.404, 218.480, 232.135, 264.907, 284.024, 324.989, 324.989,\n406.919, 401.457, 393.264, 398.726, 415.112,\n292.217, 286.755, 281.293, 273.100, 253.983, 226.673, 213.018, 202.094,\n202.094, 215.749, 213.018, 210.287, 207.556, 213.018, 218.480, 215.749,\n207.556, 213.018, 226.673, 229.404, 221.211, 221.211, 229.404, 226.673,\n223.942, 213.018, 213.018, 232.135, 234.866, 264.907, 286.755, 311.334,\n395.995, 398.726, 404.188, 401.457, 409.650,\n292.217, 286.755, 281.293, 264.907, 251.252, 229.404, 196.632, 196.632,\n204.825, 210.287, 207.556, 204.825, 207.556, 215.749, 218.480, 218.480,\n210.287, 207.556, 223.942, 221.211, 218.480, 221.211, 218.480, 218.480,\n218.480, 210.287, 202.094, 202.094, 199.363, 210.287, 248.521, 300.410,\n360.492, 385.071, 415.112, 415.112, 395.995,\n292.217, 286.755, 281.293, 262.176, 251.252, 234.866, 199.363, 193.901,\n199.363, 204.825, 204.825, 207.556, 207.556, 213.018, 218.480, 218.480,\n218.480, 267.638, 218.480, 218.480, 223.942, 223.942, 218.480, 213.018,\n207.556, 199.363, 193.901, 196.632, 193.901, 202.094, 218.480, 294.948,\n324.989, 371.416, 431.498, 387.802, 374.147,\n292.217, 284.024, 275.831, 264.907, 232.135, 237.597, 204.825, 191.170,\n191.170, 202.094, 202.094, 204.825, 210.287, 213.018, 218.480, 223.942,\n300.410, 319.527, 300.410, 213.018, 221.211, 226.673, 221.211, 213.018,\n207.556, 199.363, 193.901, 188.439, 185.708, 193.901, 202.094, 259.445,\n327.720, 376.878, 404.188, 390.533, 379.609\n};\n\nconst size_t array_float1_size = sizeof(array_float1);\n\nconst float array_float2[YSIZE * XSIZE] =\n{\n210.287, 199.363, 207.556, 218.480, 215.749, 204.825, 223.942, 177.515,\n169.322, 174.784, 161.129, 161.129, 166.591, 196.632, 191.170, 182.977,\n177.515, 191.170, 193.901, 191.170, 185.708, 180.246, 177.515, 182.977,\n180.246, 180.246, 180.246, 180.246, 180.246, 180.246, 180.246, 180.246,\n180.246, 177.515, 172.053, 172.053, 169.322,\n204.825, 193.901, 193.901, 215.749, 221.211, 204.825, 221.211, 199.363,\n161.129, 177.515, 163.860, 163.860, 174.784, 199.363, 199.363, 185.708,\n180.246, 191.170, 196.632, 193.901, 185.708, 180.246, 180.246, 182.977,\n180.246, 180.246, 180.246, 182.977, 182.977, 182.977, 180.246, 182.977,\n180.246, 174.784, 172.053, 172.053, 172.053,\n207.556, 193.901, 180.246, 199.363, 221.211, 213.018, 218.480, 215.749,\n161.129, 180.246, 163.860, 161.129, 169.322, 202.094, 202.094, 193.901,\n182.977, 191.170, 199.363, 193.901, 185.708, 180.246, 177.515, 177.515,\n180.246, 180.246, 182.977, 182.977, 182.977, 182.977, 182.977, 182.977,\n180.246, 174.784, 174.784, 174.784, 174.784,\n207.556, 196.632, 174.784, 185.708, 215.749, 221.211, 218.480, 218.480,\n161.129, 185.708, 163.860, 161.129, 163.860, 204.825, 204.825, 199.363,\n182.977, 185.708, 199.363, 196.632, 185.708, 180.246, 177.515, 172.053,\n182.977, 182.977, 182.977, 182.977, 185.708, 182.977, 182.977, 180.246,\n177.515, 174.784, 177.515, 177.515, 177.515,\n215.749, 196.632, 172.053, 180.246, 199.363, 218.480, 226.673, 223.942,\n163.860, 177.515, 166.591, 166.591, 163.860, 180.246, 204.825, 204.825,\n177.515, 191.170, 199.363, 196.632, 185.708, 180.246, 177.515, 174.784,\n185.708, 182.977, 185.708, 185.708, 185.708, 182.977, 182.977, 180.246,\n177.515, 177.515, 177.515, 180.246, 177.515,\n221.211, 199.363, 169.322, 177.515, 196.632, 202.094, 223.942, 232.135,\n180.246, 161.129, 169.322, 163.860, 163.860, 172.053, 204.825, 207.556,\n185.708, 188.439, 196.632, 196.632, 185.708, 180.246, 180.246, 177.515,\n182.977, 185.708, 185.708, 185.708, 185.708, 185.708, 180.246, 180.246,\n174.784, 180.246, 177.515, 180.246, 180.246,\n229.404, 202.094, 174.784, 174.784, 191.170, 193.901, 213.018, 229.404,\n191.170, 158.398, 163.860, 161.129, 161.129, 172.053, 204.825, 218.480,\n199.363, 182.977, 196.632, 196.632, 185.708, 180.246, 180.246, 177.515,\n180.246, 185.708, 185.708, 185.708, 185.708, 185.708, 180.246, 177.515,\n177.515, 177.515, 180.246, 182.977, 185.708,\n237.597, 221.211, 180.246, 172.053, 177.515, 185.708, 207.556, 207.556,\n204.825, 161.129, 158.398, 161.129, 161.129, 163.860, 193.901, 251.252,\n177.515, 174.784, 202.094, 196.632, 188.439, 182.977, 177.515, 177.515,\n177.515, 185.708, 188.439, 185.708, 188.439, 182.977, 177.515, 177.515,\n177.515, 177.515, 182.977, 185.708, 188.439,\n234.866, 234.866, 199.363, 174.784, 169.322, 182.977, 204.825, 207.556,\n191.170, 166.591, 158.398, 158.398, 161.129, 163.860, 221.211, 185.708,\n161.129, 172.053, 202.094, 245.790, 270.369, 182.977, 177.515, 177.515,\n174.784, 182.977, 185.708, 185.708, 185.708, 182.977, 177.515, 177.515,\n180.246, 177.515, 180.246, 185.708, 185.708,\n232.135, 232.135, 218.480, 180.246, 182.977, 182.977, 221.211, 202.094,\n169.322, 172.053, 161.129, 158.398, 158.398, 163.860, 253.983, 166.591,\n161.129, 161.129, 185.708, 314.065, 207.556, 182.977, 180.246, 174.784,\n174.784, 180.246, 185.708, 185.708, 185.708, 180.246, 177.515, 177.515,\n180.246, 177.515, 174.784, 177.515, 188.439,\n245.790, 237.597, 226.673, 193.901, 202.094, 210.287, 226.673, 215.749,\n172.053, 163.860, 161.129, 161.129, 158.398, 158.398, 245.790, 166.591,\n161.129, 161.129, 182.977, 218.480, 193.901, 185.708, 180.246, 174.784,\n172.053, 172.053, 185.708, 185.708, 185.708, 180.246, 177.515, 180.246,\n182.977, 177.515, 174.784, 169.322, 237.597,\n248.521, 251.252, 234.866, 207.556, 213.018, 221.211, 232.135, 223.942,\n182.977, 161.129, 161.129, 161.129, 161.129, 163.860, 240.328, 196.632,\n161.129, 163.860, 202.094, 218.480, 191.170, 182.977, 180.246, 174.784,\n169.322, 163.860, 177.515, 185.708, 182.977, 180.246, 177.515, 182.977,\n180.246, 174.784, 169.322, 161.129, 303.141,\n229.404, 229.404, 237.597, 232.135, 237.597, 232.135, 229.404, 229.404,\n196.632, 161.129, 161.129, 161.129, 161.129, 161.129, 199.363, 193.901,\n169.322, 161.129, 273.100, 191.170, 191.170, 182.977, 180.246, 174.784,\n163.860, 158.398, 158.398, 182.977, 185.708, 180.246, 177.515, 180.246,\n174.784, 172.053, 161.129, 152.936, 357.761,\n218.480, 245.790, 237.597, 226.673, 240.328, 243.059, 229.404, 226.673,\n207.556, 174.784, 161.129, 161.129, 161.129, 158.398, 161.129, 264.907,\n174.784, 169.322, 193.901, 185.708, 191.170, 199.363, 180.246, 172.053,\n166.591, 158.398, 158.398, 169.322, 182.977, 180.246, 174.784, 177.515,\n172.053, 172.053, 166.591, 155.667, 406.919,\n234.866, 248.521, 251.252, 237.597, 232.135, 240.328, 226.673, 221.211,\n213.018, 188.439, 166.591, 161.129, 161.129, 161.129, 161.129, 166.591,\n226.673, 196.632, 182.977, 182.977, 188.439, 188.439, 180.246, 174.784,\n166.591, 196.632, 152.936, 155.667, 174.784, 174.784, 174.784, 174.784,\n177.515, 314.065, 409.650, 253.983, 412.381,\n264.907, 243.059, 248.521, 251.252, 243.059, 240.328, 202.094, 218.480,\n213.018, 193.901, 177.515, 161.129, 158.398, 161.129, 158.398, 161.129,\n193.901, 196.632, 182.977, 191.170, 191.170, 188.439, 182.977, 174.784,\n172.053, 180.246, 152.936, 147.474, 155.667, 161.129, 174.784, 237.597,\n379.609, 442.422, 436.960, 349.568, 385.071,\n256.714, 262.176, 264.907, 256.714, 243.059, 223.942, 193.901, 191.170,\n207.556, 199.363, 182.977, 166.591, 161.129, 161.129, 158.398, 161.129,\n166.591, 193.901, 182.977, 204.825, 191.170, 185.708, 191.170, 177.515,\n172.053, 172.053, 161.129, 152.936, 147.474, 150.205, 245.790, 330.451,\n406.919, 458.808, 376.878, 393.264, 428.767,\n270.369, 273.100, 253.983, 253.983, 223.942, 218.480, 191.170, 169.322,\n191.170, 196.632, 182.977, 172.053, 163.860, 163.860, 158.398, 158.398,\n163.860, 185.708, 191.170, 191.170, 188.439, 185.708, 215.749, 185.708,\n174.784, 169.322, 163.860, 161.129, 155.667, 155.667, 240.328, 327.720,\n412.381, 442.422, 420.574, 406.919, 423.305,\n281.293, 270.369, 259.445, 256.714, 229.404, 199.363, 182.977, 169.322,\n177.515, 188.439, 182.977, 174.784, 172.053, 174.784, 172.053, 161.129,\n163.860, 177.515, 193.901, 188.439, 188.439, 182.977, 213.018, 177.515,\n172.053, 166.591, 161.129, 166.591, 163.860, 185.708, 273.100, 349.568,\n423.305, 423.305, 415.112, 423.305, 447.884,\n284.024, 278.562, 270.369, 259.445, 234.866, 202.094, 182.977, 166.591,\n166.591, 180.246, 177.515, 172.053, 172.053, 174.784, 177.515, 172.053,\n163.860, 172.053, 191.170, 188.439, 182.977, 182.977, 182.977, 177.515,\n169.322, 163.860, 158.398, 155.667, 169.322, 158.398, 193.901, 319.527,\n409.650, 420.574, 428.767, 423.305, 445.153,\n284.024, 275.831, 270.369, 248.521, 229.404, 202.094, 161.129, 161.129,\n169.322, 174.784, 172.053, 166.591, 169.322, 174.784, 174.784, 174.784,\n166.591, 163.860, 188.439, 185.708, 182.977, 188.439, 182.977, 177.515,\n169.322, 161.129, 158.398, 155.667, 155.667, 152.936, 161.129, 284.024,\n374.147, 401.457, 434.229, 439.691, 431.498,\n284.024, 275.831, 270.369, 245.790, 232.135, 210.287, 163.860, 155.667,\n163.860, 169.322, 169.322, 169.322, 172.053, 174.784, 177.515, 177.515,\n180.246, 273.100, 182.977, 182.977, 188.439, 188.439, 182.977, 177.515,\n172.053, 163.860, 158.398, 152.936, 147.474, 150.205, 152.936, 210.287,\n333.182, 387.802, 453.346, 428.767, 409.650,\n284.024, 275.831, 264.907, 251.252, 210.287, 215.749, 174.784, 155.667,\n155.667, 169.322, 169.322, 169.322, 174.784, 177.515, 180.246, 177.515,\n314.065, 376.878, 352.299, 174.784, 185.708, 191.170, 185.708, 180.246,\n174.784, 163.860, 158.398, 152.936, 144.743, 144.743, 152.936, 169.322,\n314.065, 390.533, 428.767, 426.036, 434.229\n};\n\nconst size_t array_float2_size = sizeof(array_float2);\n\nconst double array_double1[YSIZE * XSIZE] =\n{\n148.914762, 145.451628, 148.914762, 155.841030, 154.109463, 147.183195,\n155.841030, 135.062226, 133.330659, 136.793793, 129.867525, 133.330659,\n136.793793, 148.914762, 150.646329, 143.720061, 141.988494, 150.646329,\n154.109463, 152.377896, 148.914762, 150.646329, 152.377896, 150.646329,\n140.256927, 145.451628, 147.183195, 147.183195, 145.451628, 148.914762,\n152.377896, 157.572597, 166.230432, 164.498865, 167.961999, 164.498865,\n154.109463,\n147.183195, 141.988494, 140.256927, 152.377896, 154.109463, 147.183195,\n154.109463, 143.720061, 128.135958, 136.793793, 131.599092, 133.330659,\n138.525360, 150.646329, 150.646329, 145.451628, 145.451628, 152.377896,\n155.841030, 154.109463, 150.646329, 147.183195, 150.646329, 152.377896,\n143.720061, 138.525360, 141.988494, 145.451628, 147.183195, 150.646329,\n155.841030, 164.498865, 166.230432, 164.498865, 164.498865, 159.304164,\n155.841030,\n147.183195, 140.256927, 136.793793, 145.451628, 155.841030, 150.646329,\n152.377896, 152.377896, 126.404391, 136.793793, 129.867525, 131.599092,\n136.793793, 152.377896, 152.377896, 150.646329, 147.183195, 155.841030,\n159.304164, 154.109463, 152.377896, 152.377896, 150.646329, 148.914762,\n145.451628, 141.988494, 141.988494, 143.720061, 150.646329, 154.109463,\n161.035731, 162.767298, 161.035731, 161.035731, 159.304164, 159.304164,\n166.230432,\n147.183195, 141.988494, 131.599092, 138.525360, 152.377896, 154.109463,\n152.377896, 154.109463, 126.404391, 138.525360, 129.867525, 129.867525,\n133.330659, 154.109463, 159.304164, 161.035731, 157.572597, 154.109463,\n162.767298, 159.304164, 155.841030, 154.109463, 152.377896, 145.451628,\n145.451628, 141.988494, 141.988494, 147.183195, 152.377896, 157.572597,\n162.767298, 161.035731, 161.035731, 154.109463, 155.841030, 166.230432,\n166.230432,\n150.646329, 143.720061, 129.867525, 133.330659, 143.720061, 154.109463,\n155.841030, 155.841030, 128.135958, 135.062226, 131.599092, 131.599092,\n131.599092, 145.451628, 162.767298, 173.156700, 154.109463, 159.304164,\n162.767298, 159.304164, 155.841030, 154.109463, 155.841030, 147.183195,\n145.451628, 143.720061, 143.720061, 150.646329, 157.572597, 159.304164,\n152.377896, 159.304164, 157.572597, 152.377896, 155.841030, 167.961999,\n164.498865,\n154.109463, 143.720061, 128.135958, 133.330659, 141.988494, 145.451628,\n155.841030, 159.304164, 135.062226, 124.672824, 131.599092, 129.867525,\n129.867525, 140.256927, 164.498865, 174.888267, 164.498865, 159.304164,\n164.498865, 161.035731, 155.841030, 154.109463, 155.841030, 150.646329,\n148.914762, 145.451628, 148.914762, 152.377896, 155.841030, 155.841030,\n150.646329, 155.841030, 154.109463, 155.841030, 154.109463, 169.693566,\n169.693566,\n159.304164, 145.451628, 129.867525, 131.599092, 140.256927, 140.256927,\n148.914762, 157.572597, 140.256927, 124.672824, 128.135958, 128.135958,\n129.867525, 140.256927, 180.082968, 187.009236, 161.035731, 159.304164,\n164.498865, 162.767298, 152.377896, 150.646329, 154.109463, 150.646329,\n147.183195, 147.183195, 152.377896, 154.109463, 161.035731, 157.572597,\n152.377896, 152.377896, 157.572597, 152.377896, 157.572597, 183.546102,\n187.009236,\n161.035731, 154.109463, 135.062226, 129.867525, 133.330659, 138.525360,\n147.183195, 148.914762, 147.183195, 126.404391, 124.672824, 126.404391,\n128.135958, 136.793793, 176.619834, 174.888267, 152.377896, 159.304164,\n161.035731, 157.572597, 150.646329, 150.646329, 148.914762, 150.646329,\n147.183195, 148.914762, 152.377896, 154.109463, 162.767298, 162.767298,\n155.841030, 152.377896, 147.183195, 148.914762, 169.693566, 188.740803,\n195.667071,\n159.304164, 161.035731, 143.720061, 131.599092, 128.135958, 136.793793,\n145.451628, 147.183195, 140.256927, 129.867525, 124.672824, 126.404391,\n128.135958, 136.793793, 181.814535, 148.914762, 148.914762, 159.304164,\n166.230432, 169.693566, 180.082968, 148.914762, 147.183195, 147.183195,\n147.183195, 152.377896, 155.841030, 155.841030, 161.035731, 159.304164,\n152.377896, 150.646329, 148.914762, 154.109463, 167.961999, 190.472370,\n188.740803,\n159.304164, 161.035731, 154.109463, 135.062226, 136.793793, 135.062226,\n154.109463, 145.451628, 129.867525, 131.599092, 126.404391, 124.672824,\n126.404391, 135.062226, 181.814535, 143.720061, 141.988494, 152.377896,\n143.720061, 185.277669, 164.498865, 145.451628, 147.183195, 145.451628,\n148.914762, 150.646329, 155.841030, 157.572597, 159.304164, 155.841030,\n152.377896, 150.646329, 154.109463, 155.841030, 157.572597, 171.425133,\n185.277669,\n166.230432, 162.767298, 157.572597, 141.988494, 145.451628, 148.914762,\n157.572597, 150.646329, 129.867525, 128.135958, 126.404391, 126.404391,\n126.404391, 133.330659, 174.888267, 148.914762, 143.720061, 154.109463,\n159.304164, 171.425133, 169.693566, 148.914762, 148.914762, 150.646329,\n143.720061, 145.451628, 154.109463, 154.109463, 159.304164, 159.304164,\n159.304164, 166.230432, 166.230432, 150.646329, 157.572597, 155.841030,\n169.693566,\n166.230432, 167.961999, 162.767298, 150.646329, 152.377896, 154.109463,\n159.304164, 155.841030, 136.793793, 124.672824, 126.404391, 126.404391,\n128.135958, 133.330659, 173.156700, 159.304164, 145.451628, 148.914762,\n169.693566, 173.156700, 159.304164, 150.646329, 152.377896, 152.377896,\n145.451628, 143.720061, 150.646329, 154.109463, 157.572597, 162.767298,\n162.767298, 166.230432, 161.035731, 150.646329, 150.646329, 145.451628,\n188.740803,\n161.035731, 159.304164, 164.498865, 159.304164, 162.767298, 161.035731,\n159.304164, 157.572597, 141.988494, 124.672824, 126.404391, 128.135958,\n128.135958, 131.599092, 164.498865, 154.109463, 147.183195, 145.451628,\n176.619834, 154.109463, 147.183195, 152.377896, 162.767298, 148.914762,\n141.988494, 143.720061, 141.988494, 157.572597, 162.767298, 167.961999,\n155.841030, 159.304164, 147.183195, 155.841030, 147.183195, 136.793793,\n216.445875,\n154.109463, 166.230432, 162.767298, 155.841030, 162.767298, 164.498865,\n157.572597, 157.572597, 147.183195, 131.599092, 124.672824, 126.404391,\n128.135958, 129.867525, 152.377896, 173.156700, 143.720061, 145.451628,\n145.451628, 143.720061, 147.183195, 152.377896, 155.841030, 147.183195,\n145.451628, 143.720061, 145.451628, 152.377896, 159.304164, 161.035731,\n155.841030, 154.109463, 145.451628, 155.841030, 162.767298, 136.793793,\n240.687813,\n161.035731, 167.961999, 167.961999, 161.035731, 159.304164, 164.498865,\n157.572597, 155.841030, 150.646329, 140.256927, 128.135958, 126.404391,\n126.404391, 128.135958, 147.183195, 167.961999, 164.498865, 164.498865,\n154.109463, 148.914762, 148.914762, 159.304164, 150.646329, 147.183195,\n145.451628, 155.841030, 148.914762, 147.183195, 157.572597, 150.646329,\n150.646329, 148.914762, 161.035731, 214.714308, 242.419380, 183.546102,\n247.614081,\n174.888267, 164.498865, 167.961999, 167.961999, 166.230432, 164.498865,\n145.451628, 152.377896, 150.646329, 141.988494, 135.062226, 126.404391,\n126.404391, 128.135958, 141.988494, 159.304164, 180.082968, 164.498865,\n152.377896, 154.109463, 150.646329, 154.109463, 148.914762, 147.183195,\n148.914762, 150.646329, 150.646329, 140.256927, 140.256927, 143.720061,\n157.572597, 183.546102, 226.835277, 264.929751, 261.466617, 212.982741,\n230.298411,\n171.425133, 174.888267, 176.619834, 171.425133, 166.230432, 155.841030,\n143.720061, 141.988494, 147.183195, 145.451628, 136.793793, 131.599092,\n128.135958, 128.135958, 135.062226, 140.256927, 154.109463, 166.230432,\n155.841030, 161.035731, 152.377896, 152.377896, 148.914762, 152.377896,\n154.109463, 164.498865, 154.109463, 141.988494, 140.256927, 147.183195,\n180.082968, 204.324906, 244.150947, 277.050720, 223.372143, 237.224679,\n254.540349,\n178.351401, 180.082968, 169.693566, 171.425133, 155.841030, 152.377896,\n140.256927, 131.599092, 140.256927, 143.720061, 136.793793, 133.330659,\n129.867525, 129.867525, 129.867525, 131.599092, 138.525360, 155.841030,\n162.767298, 150.646329, 148.914762, 150.646329, 159.304164, 147.183195,\n147.183195, 147.183195, 150.646329, 150.646329, 154.109463, 157.572597,\n193.935504, 199.130205, 251.077215, 266.661318, 251.077215, 244.150947,\n254.540349,\n183.546102, 178.351401, 173.156700, 171.425133, 159.304164, 141.988494,\n135.062226, 129.867525, 135.062226, 140.256927, 136.793793, 133.330659,\n133.330659, 135.062226, 135.062226, 131.599092, 133.330659, 140.256927,\n154.109463, 150.646329, 145.451628, 145.451628, 155.841030, 148.914762,\n147.183195, 145.451628, 138.525360, 147.183195, 167.961999, 180.082968,\n206.056473, 206.056473, 258.003483, 254.540349, 249.345648, 252.808782,\n263.198184,\n185.277669, 181.814535, 178.351401, 173.156700, 161.035731, 143.720061,\n135.062226, 128.135958, 128.135958, 136.793793, 135.062226, 133.330659,\n131.599092, 135.062226, 138.525360, 136.793793, 131.599092, 135.062226,\n143.720061, 145.451628, 140.256927, 140.256927, 145.451628, 143.720061,\n141.988494, 135.062226, 135.062226, 147.183195, 148.914762, 167.961999,\n181.814535, 197.398638, 251.077215, 252.808782, 256.271916, 254.540349,\n259.735050,\n185.277669, 181.814535, 178.351401, 167.961999, 159.304164, 145.451628,\n124.672824, 124.672824, 129.867525, 133.330659, 131.599092, 129.867525,\n131.599092, 136.793793, 138.525360, 138.525360, 133.330659, 131.599092,\n141.988494, 140.256927, 138.525360, 140.256927, 138.525360, 138.525360,\n138.525360, 133.330659, 128.135958, 128.135958, 126.404391, 133.330659,\n157.572597, 190.472370, 228.566844, 244.150947, 263.198184, 263.198184,\n251.077215,\n185.277669, 181.814535, 178.351401, 166.230432, 159.304164, 148.914762,\n126.404391, 122.941257, 126.404391, 129.867525, 129.867525, 131.599092,\n131.599092, 135.062226, 138.525360, 138.525360, 138.525360, 169.693566,\n138.525360, 138.525360, 141.988494, 141.988494, 138.525360, 135.062226,\n131.599092, 126.404391, 122.941257, 124.672824, 122.941257, 128.135958,\n138.525360, 187.009236, 206.056473, 235.493112, 273.587586, 245.882514,\n237.224679,\n185.277669, 180.082968, 174.888267, 167.961999, 147.183195, 150.646329,\n129.867525, 121.209690, 121.209690, 128.135958, 128.135958, 129.867525,\n133.330659, 135.062226, 138.525360, 141.988494, 190.472370, 202.593339,\n190.472370, 135.062226, 140.256927, 143.720061, 140.256927, 135.062226,\n131.599092, 126.404391, 122.941257, 119.478123, 117.746556, 122.941257,\n128.135958, 164.498865, 207.788040, 238.956246, 256.271916, 247.614081,\n240.687813\n};\n\nconst size_t array_double1_size = sizeof(array_double1);\n\nconst double array_double2[YSIZE * XSIZE] =\n{\n133.330659, 126.404391, 131.599092, 138.525360, 136.793793, 129.867525,\n141.988494, 112.551855, 107.357154, 110.820288, 102.162453, 102.162453,\n105.625587, 124.672824, 121.209690, 116.014989, 112.551855, 121.209690,\n122.941257, 121.209690, 117.746556, 114.283422, 112.551855, 116.014989,\n114.283422, 114.283422, 114.283422, 114.283422, 114.283422, 114.283422,\n114.283422, 114.283422, 114.283422, 112.551855, 109.088721, 109.088721,\n107.357154,\n129.867525, 122.941257, 122.941257, 136.793793, 140.256927, 129.867525,\n140.256927, 126.404391, 102.162453, 112.551855, 103.894020, 103.894020,\n110.820288, 126.404391, 126.404391, 117.746556, 114.283422, 121.209690,\n124.672824, 122.941257, 117.746556, 114.283422, 114.283422, 116.014989,\n114.283422, 114.283422, 114.283422, 116.014989, 116.014989, 116.014989,\n114.283422, 116.014989, 114.283422, 110.820288, 109.088721, 109.088721,\n109.088721,\n131.599092, 122.941257, 114.283422, 126.404391, 140.256927, 135.062226,\n138.525360, 136.793793, 102.162453, 114.283422, 103.894020, 102.162453,\n107.357154, 128.135958, 128.135958, 122.941257, 116.014989, 121.209690,\n126.404391, 122.941257, 117.746556, 114.283422, 112.551855, 112.551855,\n114.283422, 114.283422, 116.014989, 116.014989, 116.014989, 116.014989,\n116.014989, 116.014989, 114.283422, 110.820288, 110.820288, 110.820288,\n110.820288,\n131.599092, 124.672824, 110.820288, 117.746556, 136.793793, 140.256927,\n138.525360, 138.525360, 102.162453, 117.746556, 103.894020, 102.162453,\n103.894020, 129.867525, 129.867525, 126.404391, 116.014989, 117.746556,\n126.404391, 124.672824, 117.746556, 114.283422, 112.551855, 109.088721,\n116.014989, 116.014989, 116.014989, 116.014989, 117.746556, 116.014989,\n116.014989, 114.283422, 112.551855, 110.820288, 112.551855, 112.551855,\n112.551855,\n136.793793, 124.672824, 109.088721, 114.283422, 126.404391, 138.525360,\n143.720061, 141.988494, 103.894020, 112.551855, 105.625587, 105.625587,\n103.894020, 114.283422, 129.867525, 129.867525, 112.551855, 121.209690,\n126.404391, 124.672824, 117.746556, 114.283422, 112.551855, 110.820288,\n117.746556, 116.014989, 117.746556, 117.746556, 117.746556, 116.014989,\n116.014989, 114.283422, 112.551855, 112.551855, 112.551855, 114.283422,\n112.551855,\n140.256927, 126.404391, 107.357154, 112.551855, 124.672824, 128.135958,\n141.988494, 147.183195, 114.283422, 102.162453, 107.357154, 103.894020,\n103.894020, 109.088721, 129.867525, 131.599092, 117.746556, 119.478123,\n124.672824, 124.672824, 117.746556, 114.283422, 114.283422, 112.551855,\n116.014989, 117.746556, 117.746556, 117.746556, 117.746556, 117.746556,\n114.283422, 114.283422, 110.820288, 114.283422, 112.551855, 114.283422,\n114.283422,\n145.451628, 128.135958, 110.820288, 110.820288, 121.209690, 122.941257,\n135.062226, 145.451628, 121.209690, 100.430886, 103.894020, 102.162453,\n102.162453, 109.088721, 129.867525, 138.525360, 126.404391, 116.014989,\n124.672824, 124.672824, 117.746556, 114.283422, 114.283422, 112.551855,\n114.283422, 117.746556, 117.746556, 117.746556, 117.746556, 117.746556,\n114.283422, 112.551855, 112.551855, 112.551855, 114.283422, 116.014989,\n117.746556,\n150.646329, 140.256927, 114.283422, 109.088721, 112.551855, 117.746556,\n131.599092, 131.599092, 129.867525, 102.162453, 100.430886, 102.162453,\n102.162453, 103.894020, 122.941257, 159.304164, 112.551855, 110.820288,\n128.135958, 124.672824, 119.478123, 116.014989, 112.551855, 112.551855,\n112.551855, 117.746556, 119.478123, 117.746556, 119.478123, 116.014989,\n112.551855, 112.551855, 112.551855, 112.551855, 116.014989, 117.746556,\n119.478123,\n148.914762, 148.914762, 126.404391, 110.820288, 107.357154, 116.014989,\n129.867525, 131.599092, 121.209690, 105.625587, 100.430886, 100.430886,\n102.162453, 103.894020, 140.256927, 117.746556, 102.162453, 109.088721,\n128.135958, 155.841030, 171.425133, 116.014989, 112.551855, 112.551855,\n110.820288, 116.014989, 117.746556, 117.746556, 117.746556, 116.014989,\n112.551855, 112.551855, 114.283422, 112.551855, 114.283422, 117.746556,\n117.746556,\n147.183195, 147.183195, 138.525360, 114.283422, 116.014989, 116.014989,\n140.256927, 128.135958, 107.357154, 109.088721, 102.162453, 100.430886,\n100.430886, 103.894020, 161.035731, 105.625587, 102.162453, 102.162453,\n117.746556, 199.130205, 131.599092, 116.014989, 114.283422, 110.820288,\n110.820288, 114.283422, 117.746556, 117.746556, 117.746556, 114.283422,\n112.551855, 112.551855, 114.283422, 112.551855, 110.820288, 112.551855,\n119.478123,\n155.841030, 150.646329, 143.720061, 122.941257, 128.135958, 133.330659,\n143.720061, 136.793793, 109.088721, 103.894020, 102.162453, 102.162453,\n100.430886, 100.430886, 155.841030, 105.625587, 102.162453, 102.162453,\n116.014989, 138.525360, 122.941257, 117.746556, 114.283422, 110.820288,\n109.088721, 109.088721, 117.746556, 117.746556, 117.746556, 114.283422,\n112.551855, 114.283422, 116.014989, 112.551855, 110.820288, 107.357154,\n150.646329,\n157.572597, 159.304164, 148.914762, 131.599092, 135.062226, 140.256927,\n147.183195, 141.988494, 116.014989, 102.162453, 102.162453, 102.162453,\n102.162453, 103.894020, 152.377896, 124.672824, 102.162453, 103.894020,\n128.135958, 138.525360, 121.209690, 116.014989, 114.283422, 110.820288,\n107.357154, 103.894020, 112.551855, 117.746556, 116.014989, 114.283422,\n112.551855, 116.014989, 114.283422, 110.820288, 107.357154, 102.162453,\n192.203937,\n145.451628, 145.451628, 150.646329, 147.183195, 150.646329, 147.183195,\n145.451628, 145.451628, 124.672824, 102.162453, 102.162453, 102.162453,\n102.162453, 102.162453, 126.404391, 122.941257, 107.357154, 102.162453,\n173.156700, 121.209690, 121.209690, 116.014989, 114.283422, 110.820288,\n103.894020, 100.430886, 100.430886, 116.014989, 117.746556, 114.283422,\n112.551855, 114.283422, 110.820288, 109.088721, 102.162453, 96.967752,\n226.835277,\n138.525360, 155.841030, 150.646329, 143.720061, 152.377896, 154.109463,\n145.451628, 143.720061, 131.599092, 110.820288, 102.162453, 102.162453,\n102.162453, 100.430886, 102.162453, 167.961999, 110.820288, 107.357154,\n122.941257, 117.746556, 121.209690, 126.404391, 114.283422, 109.088721,\n105.625587, 100.430886, 100.430886, 107.357154, 116.014989, 114.283422,\n110.820288, 112.551855, 109.088721, 109.088721, 105.625587, 98.699319,\n258.003483,\n148.914762, 157.572597, 159.304164, 150.646329, 147.183195, 152.377896,\n143.720061, 140.256927, 135.062226, 119.478123, 105.625587, 102.162453,\n102.162453, 102.162453, 102.162453, 105.625587, 143.720061, 124.672824,\n116.014989, 116.014989, 119.478123, 119.478123, 114.283422, 110.820288,\n105.625587, 124.672824, 96.967752, 98.699319, 110.820288, 110.820288,\n110.820288, 110.820288, 112.551855, 199.130205, 259.735050, 161.035731,\n261.466617,\n167.961999, 154.109463, 157.572597, 159.304164, 154.109463, 152.377896,\n128.135958, 138.525360, 135.062226, 122.941257, 112.551855, 102.162453,\n100.430886, 102.162453, 100.430886, 102.162453, 122.941257, 124.672824,\n116.014989, 121.209690, 121.209690, 119.478123, 116.014989, 110.820288,\n109.088721, 114.283422, 96.967752, 93.504618, 98.699319, 102.162453,\n110.820288, 150.646329, 240.687813, 280.513854, 277.050720, 221.640576,\n244.150947,\n162.767298, 166.230432, 167.961999, 162.767298, 154.109463, 141.988494,\n122.941257, 121.209690, 131.599092, 126.404391, 116.014989, 105.625587,\n102.162453, 102.162453, 100.430886, 102.162453, 105.625587, 122.941257,\n116.014989, 129.867525, 121.209690, 117.746556, 121.209690, 112.551855,\n109.088721, 109.088721, 102.162453, 96.967752, 93.504618, 95.236185,\n155.841030, 209.519607, 258.003483, 290.903256, 238.956246, 249.345648,\n271.856019,\n171.425133, 173.156700, 161.035731, 161.035731, 141.988494, 138.525360,\n121.209690, 107.357154, 121.209690, 124.672824, 116.014989, 109.088721,\n103.894020, 103.894020, 100.430886, 100.430886, 103.894020, 117.746556,\n121.209690, 121.209690, 119.478123, 117.746556, 136.793793, 117.746556,\n110.820288, 107.357154, 103.894020, 102.162453, 98.699319, 98.699319,\n152.377896, 207.788040, 261.466617, 280.513854, 266.661318, 258.003483,\n268.392885,\n178.351401, 171.425133, 164.498865, 162.767298, 145.451628, 126.404391,\n116.014989, 107.357154, 112.551855, 119.478123, 116.014989, 110.820288,\n109.088721, 110.820288, 109.088721, 102.162453, 103.894020, 112.551855,\n122.941257, 119.478123, 119.478123, 116.014989, 135.062226, 112.551855,\n109.088721, 105.625587, 102.162453, 105.625587, 103.894020, 117.746556,\n173.156700, 221.640576, 268.392885, 268.392885, 263.198184, 268.392885,\n283.976988,\n180.082968, 176.619834, 171.425133, 164.498865, 148.914762, 128.135958,\n116.014989, 105.625587, 105.625587, 114.283422, 112.551855, 109.088721,\n109.088721, 110.820288, 112.551855, 109.088721, 103.894020, 109.088721,\n121.209690, 119.478123, 116.014989, 116.014989, 116.014989, 112.551855,\n107.357154, 103.894020, 100.430886, 98.699319, 107.357154, 100.430886,\n122.941257, 202.593339, 259.735050, 266.661318, 271.856019, 268.392885,\n282.245421,\n180.082968, 174.888267, 171.425133, 157.572597, 145.451628, 128.135958,\n102.162453, 102.162453, 107.357154, 110.820288, 109.088721, 105.625587,\n107.357154, 110.820288, 110.820288, 110.820288, 105.625587, 103.894020,\n119.478123, 117.746556, 116.014989, 119.478123, 116.014989, 112.551855,\n107.357154, 102.162453, 100.430886, 98.699319, 98.699319, 96.967752,\n102.162453, 180.082968, 237.224679, 254.540349, 275.319153, 278.782287,\n273.587586,\n180.082968, 174.888267, 171.425133, 155.841030, 147.183195, 133.330659,\n103.894020, 98.699319, 103.894020, 107.357154, 107.357154, 107.357154,\n109.088721, 110.820288, 112.551855, 112.551855, 114.283422, 173.156700,\n116.014989, 116.014989, 119.478123, 119.478123, 116.014989, 112.551855,\n109.088721, 103.894020, 100.430886, 96.967752, 93.504618, 95.236185,\n96.967752, 133.330659, 211.251174, 245.882514, 287.440122, 271.856019,\n259.735050,\n180.082968, 174.888267, 167.961999, 159.304164, 133.330659, 136.793793,\n110.820288, 98.699319, 98.699319, 107.357154, 107.357154, 107.357154,\n110.820288, 112.551855, 114.283422, 112.551855, 199.130205, 238.956246,\n223.372143, 110.820288, 117.746556, 121.209690, 117.746556, 114.283422,\n110.820288, 103.894020, 100.430886, 96.967752, 91.773051, 91.773051,\n96.967752, 107.357154, 199.130205, 247.614081, 271.856019, 270.124452,\n275.319153\n};\n\nconst size_t array_double2_size = sizeof(array_double2);\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiff/test/test_arrays.h",
    "content": "/* $Id: test_arrays.h,v 1.3 2006/03/23 14:54:02 dron Exp $ */\n\n/*\n * Copyright (c) 2004, Andrey Kiselev  <dron@ak4719.spb.edu>\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n/*\n * TIFF Library\n *\n * Few declarations for the test numerical arrays.\n */\n\n#ifndef _TEST_ARRAYS_ \n#define _TEST_ARRAYS_\n\n#include <stddef.h>\n\n#define XSIZE 37\n#define YSIZE 23\n\nextern const unsigned char byte_array1[];\nextern const size_t byte_array1_size;\n\nextern const unsigned char byte_array2[];\nextern const size_t byte_array2_size;\n\nextern const unsigned char byte_array3[];\nextern const size_t byte_array3_size;\n\nextern const float array_float1[];\nextern const size_t array_float1_size;\n\nextern const float array_float2[];\nextern const size_t array_float2_size;\n\nextern const double array_double1[];\nextern const size_t array_double1_size;\n\nextern const double array_double2[];\nextern const size_t array_double2_size;\n\n#endif /* _TEST_ARRAYS_ */\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiff/tools/Makefile.am",
    "content": "# Tag Image File Format (TIFF) Software\n#\n# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>\n#\n# Permission to use, copy, modify, distribute, and sell this software and \n# its documentation for any purpose is hereby granted without fee, provided\n# that (i) the above copyright notices and this permission notice appear in\n# all copies of the software and related documentation, and (ii) the names of\n# Sam Leffler and Silicon Graphics may not be used in any advertising or\n# publicity relating to the software without the specific, prior written\n# permission of Sam Leffler and Silicon Graphics.\n# \n# THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n# \n# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n# OF THIS SOFTWARE.\n\n# Process this file with automake to produce Makefile.in.\n\nLIBPORT = $(top_builddir)/port/libport.la\nLIBTIFF = $(top_builddir)/libtiff/libtiff.la\n\nEXTRA_DIST = Makefile.vc\n\nbin_PROGRAMS = \\\n\tbmp2tiff \\\n\tfax2ps \\\n\tfax2tiff \\\n\tgif2tiff \\\n\tpal2rgb \\\n\tppm2tiff \\\n\tras2tiff \\\n\traw2tiff \\\n\trgb2ycbcr \\\n\tthumbnail \\\n\ttiff2bw \\\n\ttiff2pdf \\\n\ttiff2ps \\\n\ttiff2rgba \\\n\ttiffcmp \\\n\ttiffcp \\\n\ttiffcrop \\\n\ttiffdither \\\n\ttiffdump \\\n\ttiffinfo \\\n\ttiffmedian \\\n\ttiffset \\\n\ttiffsplit\nif HAVE_OPENGL\nbin_PROGRAMS += tiffgt\nendif\n\nEXTRA_PROGRAMS = sgi2tiff sgisv ycbcr\n\nif HAVE_RPATH\nAM_LDFLAGS = $(LIBDIR)\nendif\n\nbmp2tiff_SOURCES = bmp2tiff.c\nbmp2tiff_LDADD = $(LIBTIFF) $(LIBPORT)\n\nfax2ps_SOURCES = fax2ps.c\nfax2ps_LDADD = $(LIBTIFF) $(LIBPORT)\n\nfax2tiff_SOURCES = fax2tiff.c\nfax2tiff_LDADD = $(LIBTIFF) $(LIBPORT)\n\ngif2tiff_SOURCES = gif2tiff.c\ngif2tiff_LDADD = $(LIBTIFF) $(LIBPORT)\n\npal2rgb_SOURCES = pal2rgb.c\npal2rgb_LDADD = $(LIBTIFF) $(LIBPORT)\n\nppm2tiff_SOURCES = ppm2tiff.c\nppm2tiff_LDADD = $(LIBTIFF) $(LIBPORT)\n\nras2tiff_SOURCES = ras2tiff.c rasterfile.h\nras2tiff_LDADD = $(LIBTIFF) $(LIBPORT)\n\nraw2tiff_SOURCES = raw2tiff.c\nraw2tiff_LDADD = $(LIBTIFF) $(LIBPORT)\n\nrgb2ycbcr_SOURCES = rgb2ycbcr.c\nrgb2ycbcr_LDADD = $(LIBTIFF) $(LIBPORT)\n\nthumbnail_SOURCES = thumbnail.c\nthumbnail_LDADD = $(LIBTIFF) $(LIBPORT)\n\ntiff2bw_SOURCES = tiff2bw.c\ntiff2bw_LDADD = $(LIBTIFF) $(LIBPORT)\n\ntiff2pdf_SOURCES = tiff2pdf.c\ntiff2pdf_LDADD = $(LIBTIFF) $(LIBPORT)\n\ntiff2ps_SOURCES = tiff2ps.c\ntiff2ps_LDADD = $(LIBTIFF) $(LIBPORT)\n\ntiff2rgba_SOURCES = tiff2rgba.c\ntiff2rgba_LDADD = $(LIBTIFF) $(LIBPORT)\n\ntiffcmp_SOURCES = tiffcmp.c\ntiffcmp_LDADD = $(LIBTIFF) $(LIBPORT)\n\ntiffcp_SOURCES = tiffcp.c\ntiffcp_LDADD = $(LIBTIFF) $(LIBPORT)\n\ntiffcrop_SOURCES = tiffcrop.c\ntiffcrop_LDADD = $(LIBTIFF) $(LIBPORT)\n\ntiffdither_SOURCES = tiffdither.c\ntiffdither_LDADD = $(LIBTIFF) $(LIBPORT)\n\ntiffdump_SOURCES = tiffdump.c\ntiffdump_LDADD = $(LIBTIFF) $(LIBPORT)\n\ntiffinfo_SOURCES = tiffinfo.c\ntiffinfo_LDADD = $(LIBTIFF) $(LIBPORT)\n\ntiffmedian_SOURCES = tiffmedian.c\ntiffmedian_LDADD = $(LIBTIFF) $(LIBPORT)\n\ntiffset_SOURCES = tiffset.c\ntiffset_LDADD = $(LIBTIFF) $(LIBPORT)\n\ntiffsplit_SOURCES = tiffsplit.c\ntiffsplit_LDADD = $(LIBTIFF) $(LIBPORT)\n\ntiffgt_SOURCES = tiffgt.c\ntiffgt_CFLAGS = $(CFLAGS) $(GLUT_CFLAGS) $(AM_CFLAGS)\ntiffgt_LDADD = $(LIBTIFF) $(LIBPORT) $(X_LIBS) $(GLUT_LIBS)\n\nINCLUDES = -I../libtiff -I$(top_srcdir)/libtiff\n\necho:\n\t(echo $(CFLAGS))\n\t(echo $(tiffgt_CFLAGS))\n\t(echo $(GL_CFLAGS))\n\t(echo $(GLU_CFLAGS))\n\t(echo $(GLUT_CFLAGS))\n"
  },
  {
    "path": "src/main/jni/tiff/tools/Makefile.in",
    "content": "# Makefile.in generated by automake 1.11 from Makefile.am.\n# @configure_input@\n\n# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,\n# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,\n# Inc.\n# This Makefile.in is free software; the Free Software Foundation\n# gives unlimited permission to copy and/or distribute it,\n# with or without modifications, as long as this notice is preserved.\n\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY, to the extent permitted by law; without\n# even the implied warranty of MERCHANTABILITY or FITNESS FOR A\n# PARTICULAR PURPOSE.\n\n@SET_MAKE@\n\n# Tag Image File Format (TIFF) Software\n#\n# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>\n#\n# Permission to use, copy, modify, distribute, and sell this software and \n# its documentation for any purpose is hereby granted without fee, provided\n# that (i) the above copyright notices and this permission notice appear in\n# all copies of the software and related documentation, and (ii) the names of\n# Sam Leffler and Silicon Graphics may not be used in any advertising or\n# publicity relating to the software without the specific, prior written\n# permission of Sam Leffler and Silicon Graphics.\n# \n# THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n# \n# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n# OF THIS SOFTWARE.\n\n# Process this file with automake to produce Makefile.in.\n\nVPATH = @srcdir@\npkgdatadir = $(datadir)/@PACKAGE@\npkgincludedir = $(includedir)/@PACKAGE@\npkglibdir = $(libdir)/@PACKAGE@\npkglibexecdir = $(libexecdir)/@PACKAGE@\nam__cd = CDPATH=\"$${ZSH_VERSION+.}$(PATH_SEPARATOR)\" && cd\ninstall_sh_DATA = $(install_sh) -c -m 644\ninstall_sh_PROGRAM = $(install_sh) -c\ninstall_sh_SCRIPT = $(install_sh) -c\nINSTALL_HEADER = $(INSTALL_DATA)\ntransform = $(program_transform_name)\nNORMAL_INSTALL = :\nPRE_INSTALL = :\nPOST_INSTALL = :\nNORMAL_UNINSTALL = :\nPRE_UNINSTALL = :\nPOST_UNINSTALL = :\nbuild_triplet = @build@\nhost_triplet = @host@\ntarget_triplet = @target@\nbin_PROGRAMS = bmp2tiff$(EXEEXT) fax2ps$(EXEEXT) fax2tiff$(EXEEXT) \\\n\tgif2tiff$(EXEEXT) pal2rgb$(EXEEXT) ppm2tiff$(EXEEXT) \\\n\tras2tiff$(EXEEXT) raw2tiff$(EXEEXT) rgb2ycbcr$(EXEEXT) \\\n\tthumbnail$(EXEEXT) tiff2bw$(EXEEXT) tiff2pdf$(EXEEXT) \\\n\ttiff2ps$(EXEEXT) tiff2rgba$(EXEEXT) tiffcmp$(EXEEXT) \\\n\ttiffcp$(EXEEXT) tiffcrop$(EXEEXT) tiffdither$(EXEEXT) \\\n\ttiffdump$(EXEEXT) tiffinfo$(EXEEXT) tiffmedian$(EXEEXT) \\\n\ttiffset$(EXEEXT) tiffsplit$(EXEEXT) $(am__EXEEXT_1)\n@HAVE_OPENGL_TRUE@am__append_1 = tiffgt\nEXTRA_PROGRAMS = sgi2tiff$(EXEEXT) sgisv$(EXEEXT) ycbcr$(EXEEXT)\nsubdir = tools\nDIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in\nACLOCAL_M4 = $(top_srcdir)/aclocal.m4\nam__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \\\n\t$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \\\n\t$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \\\n\t$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac\nam__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \\\n\t$(ACLOCAL_M4)\nmkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs\nCONFIG_HEADER = $(top_builddir)/libtiff/tif_config.h \\\n\t$(top_builddir)/libtiff/tiffconf.h\nCONFIG_CLEAN_FILES =\nCONFIG_CLEAN_VPATH_FILES =\n@HAVE_OPENGL_TRUE@am__EXEEXT_1 = tiffgt$(EXEEXT)\nam__installdirs = \"$(DESTDIR)$(bindir)\"\nPROGRAMS = $(bin_PROGRAMS)\nam_bmp2tiff_OBJECTS = bmp2tiff.$(OBJEXT)\nbmp2tiff_OBJECTS = $(am_bmp2tiff_OBJECTS)\nbmp2tiff_DEPENDENCIES = $(LIBTIFF) $(LIBPORT)\nAM_V_lt = $(am__v_lt_$(V))\nam__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))\nam__v_lt_0 = --silent\nam_fax2ps_OBJECTS = fax2ps.$(OBJEXT)\nfax2ps_OBJECTS = $(am_fax2ps_OBJECTS)\nfax2ps_DEPENDENCIES = $(LIBTIFF) $(LIBPORT)\nam_fax2tiff_OBJECTS = fax2tiff.$(OBJEXT)\nfax2tiff_OBJECTS = $(am_fax2tiff_OBJECTS)\nfax2tiff_DEPENDENCIES = $(LIBTIFF) $(LIBPORT)\nam_gif2tiff_OBJECTS = gif2tiff.$(OBJEXT)\ngif2tiff_OBJECTS = $(am_gif2tiff_OBJECTS)\ngif2tiff_DEPENDENCIES = $(LIBTIFF) $(LIBPORT)\nam_pal2rgb_OBJECTS = pal2rgb.$(OBJEXT)\npal2rgb_OBJECTS = $(am_pal2rgb_OBJECTS)\npal2rgb_DEPENDENCIES = $(LIBTIFF) $(LIBPORT)\nam_ppm2tiff_OBJECTS = ppm2tiff.$(OBJEXT)\nppm2tiff_OBJECTS = $(am_ppm2tiff_OBJECTS)\nppm2tiff_DEPENDENCIES = $(LIBTIFF) $(LIBPORT)\nam_ras2tiff_OBJECTS = ras2tiff.$(OBJEXT)\nras2tiff_OBJECTS = $(am_ras2tiff_OBJECTS)\nras2tiff_DEPENDENCIES = $(LIBTIFF) $(LIBPORT)\nam_raw2tiff_OBJECTS = raw2tiff.$(OBJEXT)\nraw2tiff_OBJECTS = $(am_raw2tiff_OBJECTS)\nraw2tiff_DEPENDENCIES = $(LIBTIFF) $(LIBPORT)\nam_rgb2ycbcr_OBJECTS = rgb2ycbcr.$(OBJEXT)\nrgb2ycbcr_OBJECTS = $(am_rgb2ycbcr_OBJECTS)\nrgb2ycbcr_DEPENDENCIES = $(LIBTIFF) $(LIBPORT)\nsgi2tiff_SOURCES = sgi2tiff.c\nsgi2tiff_OBJECTS = sgi2tiff.$(OBJEXT)\nsgi2tiff_LDADD = $(LDADD)\nsgisv_SOURCES = sgisv.c\nsgisv_OBJECTS = sgisv.$(OBJEXT)\nsgisv_LDADD = $(LDADD)\nam_thumbnail_OBJECTS = thumbnail.$(OBJEXT)\nthumbnail_OBJECTS = $(am_thumbnail_OBJECTS)\nthumbnail_DEPENDENCIES = $(LIBTIFF) $(LIBPORT)\nam_tiff2bw_OBJECTS = tiff2bw.$(OBJEXT)\ntiff2bw_OBJECTS = $(am_tiff2bw_OBJECTS)\ntiff2bw_DEPENDENCIES = $(LIBTIFF) $(LIBPORT)\nam_tiff2pdf_OBJECTS = tiff2pdf.$(OBJEXT)\ntiff2pdf_OBJECTS = $(am_tiff2pdf_OBJECTS)\ntiff2pdf_DEPENDENCIES = $(LIBTIFF) $(LIBPORT)\nam_tiff2ps_OBJECTS = tiff2ps.$(OBJEXT)\ntiff2ps_OBJECTS = $(am_tiff2ps_OBJECTS)\ntiff2ps_DEPENDENCIES = $(LIBTIFF) $(LIBPORT)\nam_tiff2rgba_OBJECTS = tiff2rgba.$(OBJEXT)\ntiff2rgba_OBJECTS = $(am_tiff2rgba_OBJECTS)\ntiff2rgba_DEPENDENCIES = $(LIBTIFF) $(LIBPORT)\nam_tiffcmp_OBJECTS = tiffcmp.$(OBJEXT)\ntiffcmp_OBJECTS = $(am_tiffcmp_OBJECTS)\ntiffcmp_DEPENDENCIES = $(LIBTIFF) $(LIBPORT)\nam_tiffcp_OBJECTS = tiffcp.$(OBJEXT)\ntiffcp_OBJECTS = $(am_tiffcp_OBJECTS)\ntiffcp_DEPENDENCIES = $(LIBTIFF) $(LIBPORT)\nam_tiffcrop_OBJECTS = tiffcrop.$(OBJEXT)\ntiffcrop_OBJECTS = $(am_tiffcrop_OBJECTS)\ntiffcrop_DEPENDENCIES = $(LIBTIFF) $(LIBPORT)\nam_tiffdither_OBJECTS = tiffdither.$(OBJEXT)\ntiffdither_OBJECTS = $(am_tiffdither_OBJECTS)\ntiffdither_DEPENDENCIES = $(LIBTIFF) $(LIBPORT)\nam_tiffdump_OBJECTS = tiffdump.$(OBJEXT)\ntiffdump_OBJECTS = $(am_tiffdump_OBJECTS)\ntiffdump_DEPENDENCIES = $(LIBTIFF) $(LIBPORT)\nam_tiffgt_OBJECTS = tiffgt-tiffgt.$(OBJEXT)\ntiffgt_OBJECTS = $(am_tiffgt_OBJECTS)\nam__DEPENDENCIES_1 =\ntiffgt_DEPENDENCIES = $(LIBTIFF) $(LIBPORT) $(am__DEPENDENCIES_1) \\\n\t$(am__DEPENDENCIES_1)\ntiffgt_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \\\n\t$(LIBTOOLFLAGS) --mode=link $(CCLD) $(tiffgt_CFLAGS) $(CFLAGS) \\\n\t$(AM_LDFLAGS) $(LDFLAGS) -o $@\nam_tiffinfo_OBJECTS = tiffinfo.$(OBJEXT)\ntiffinfo_OBJECTS = $(am_tiffinfo_OBJECTS)\ntiffinfo_DEPENDENCIES = $(LIBTIFF) $(LIBPORT)\nam_tiffmedian_OBJECTS = tiffmedian.$(OBJEXT)\ntiffmedian_OBJECTS = $(am_tiffmedian_OBJECTS)\ntiffmedian_DEPENDENCIES = $(LIBTIFF) $(LIBPORT)\nam_tiffset_OBJECTS = tiffset.$(OBJEXT)\ntiffset_OBJECTS = $(am_tiffset_OBJECTS)\ntiffset_DEPENDENCIES = $(LIBTIFF) $(LIBPORT)\nam_tiffsplit_OBJECTS = tiffsplit.$(OBJEXT)\ntiffsplit_OBJECTS = $(am_tiffsplit_OBJECTS)\ntiffsplit_DEPENDENCIES = $(LIBTIFF) $(LIBPORT)\nycbcr_SOURCES = ycbcr.c\nycbcr_OBJECTS = ycbcr.$(OBJEXT)\nycbcr_LDADD = $(LDADD)\nDEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/libtiff\ndepcomp = $(SHELL) $(top_srcdir)/config/depcomp\nam__depfiles_maybe = depfiles\nam__mv = mv -f\nCOMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \\\n\t$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)\nLTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \\\n\t$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \\\n\t$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \\\n\t$(AM_CFLAGS) $(CFLAGS)\nAM_V_CC = $(am__v_CC_$(V))\nam__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))\nam__v_CC_0 = @echo \"  CC    \" $@;\nAM_V_at = $(am__v_at_$(V))\nam__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))\nam__v_at_0 = @\nCCLD = $(CC)\nLINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \\\n\t$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \\\n\t$(AM_LDFLAGS) $(LDFLAGS) -o $@\nAM_V_CCLD = $(am__v_CCLD_$(V))\nam__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))\nam__v_CCLD_0 = @echo \"  CCLD  \" $@;\nAM_V_GEN = $(am__v_GEN_$(V))\nam__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))\nam__v_GEN_0 = @echo \"  GEN   \" $@;\nSOURCES = $(bmp2tiff_SOURCES) $(fax2ps_SOURCES) $(fax2tiff_SOURCES) \\\n\t$(gif2tiff_SOURCES) $(pal2rgb_SOURCES) $(ppm2tiff_SOURCES) \\\n\t$(ras2tiff_SOURCES) $(raw2tiff_SOURCES) $(rgb2ycbcr_SOURCES) \\\n\tsgi2tiff.c sgisv.c $(thumbnail_SOURCES) $(tiff2bw_SOURCES) \\\n\t$(tiff2pdf_SOURCES) $(tiff2ps_SOURCES) $(tiff2rgba_SOURCES) \\\n\t$(tiffcmp_SOURCES) $(tiffcp_SOURCES) $(tiffcrop_SOURCES) \\\n\t$(tiffdither_SOURCES) $(tiffdump_SOURCES) $(tiffgt_SOURCES) \\\n\t$(tiffinfo_SOURCES) $(tiffmedian_SOURCES) $(tiffset_SOURCES) \\\n\t$(tiffsplit_SOURCES) ycbcr.c\nDIST_SOURCES = $(bmp2tiff_SOURCES) $(fax2ps_SOURCES) \\\n\t$(fax2tiff_SOURCES) $(gif2tiff_SOURCES) $(pal2rgb_SOURCES) \\\n\t$(ppm2tiff_SOURCES) $(ras2tiff_SOURCES) $(raw2tiff_SOURCES) \\\n\t$(rgb2ycbcr_SOURCES) sgi2tiff.c sgisv.c $(thumbnail_SOURCES) \\\n\t$(tiff2bw_SOURCES) $(tiff2pdf_SOURCES) $(tiff2ps_SOURCES) \\\n\t$(tiff2rgba_SOURCES) $(tiffcmp_SOURCES) $(tiffcp_SOURCES) \\\n\t$(tiffcrop_SOURCES) $(tiffdither_SOURCES) $(tiffdump_SOURCES) \\\n\t$(tiffgt_SOURCES) $(tiffinfo_SOURCES) $(tiffmedian_SOURCES) \\\n\t$(tiffset_SOURCES) $(tiffsplit_SOURCES) ycbcr.c\nETAGS = etags\nCTAGS = ctags\nDISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)\nACLOCAL = @ACLOCAL@\nAMTAR = @AMTAR@\nAM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@\nAR = @AR@\nAS = @AS@\nAUTOCONF = @AUTOCONF@\nAUTOHEADER = @AUTOHEADER@\nAUTOMAKE = @AUTOMAKE@\nAWK = @AWK@\nCC = @CC@\nCCDEPMODE = @CCDEPMODE@\nCFLAGS = @CFLAGS@\nCPP = @CPP@\nCPPFLAGS = @CPPFLAGS@\nCXX = @CXX@\nCXXCPP = @CXXCPP@\nCXXDEPMODE = @CXXDEPMODE@\nCXXFLAGS = @CXXFLAGS@\nCYGPATH_W = @CYGPATH_W@\nDEFS = @DEFS@\nDEPDIR = @DEPDIR@\nDLLTOOL = @DLLTOOL@\nDSYMUTIL = @DSYMUTIL@\nDUMPBIN = @DUMPBIN@\nECHO_C = @ECHO_C@\nECHO_N = @ECHO_N@\nECHO_T = @ECHO_T@\nEGREP = @EGREP@\nEXEEXT = @EXEEXT@\nFGREP = @FGREP@\nGLUT_CFLAGS = @GLUT_CFLAGS@\nGLUT_LIBS = @GLUT_LIBS@\nGLU_CFLAGS = @GLU_CFLAGS@\nGLU_LIBS = @GLU_LIBS@\nGL_CFLAGS = @GL_CFLAGS@\nGL_LIBS = @GL_LIBS@\nGREP = @GREP@\nINSTALL = @INSTALL@\nINSTALL_DATA = @INSTALL_DATA@\nINSTALL_PROGRAM = @INSTALL_PROGRAM@\nINSTALL_SCRIPT = @INSTALL_SCRIPT@\nINSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@\nLD = @LD@\nLDFLAGS = @LDFLAGS@\nLIBDIR = @LIBDIR@\nLIBOBJS = @LIBOBJS@\nLIBS = @LIBS@\nLIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@\nLIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@\nLIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@\nLIBTIFF_MICRO_VERSION = @LIBTIFF_MICRO_VERSION@\nLIBTIFF_MINOR_VERSION = @LIBTIFF_MINOR_VERSION@\nLIBTIFF_RELEASE_DATE = @LIBTIFF_RELEASE_DATE@\nLIBTIFF_VERSION = @LIBTIFF_VERSION@\nLIBTIFF_VERSION_INFO = @LIBTIFF_VERSION_INFO@\nLIBTOOL = @LIBTOOL@\nLIPO = @LIPO@\nLN_S = @LN_S@\nLTLIBOBJS = @LTLIBOBJS@\nMAINT = @MAINT@\nMAKEINFO = @MAKEINFO@\nMKDIR_P = @MKDIR_P@\nNM = @NM@\nNMEDIT = @NMEDIT@\nOBJDUMP = @OBJDUMP@\nOBJEXT = @OBJEXT@\nOTOOL = @OTOOL@\nOTOOL64 = @OTOOL64@\nPACKAGE = @PACKAGE@\nPACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@\nPACKAGE_NAME = @PACKAGE_NAME@\nPACKAGE_STRING = @PACKAGE_STRING@\nPACKAGE_TARNAME = @PACKAGE_TARNAME@\nPACKAGE_URL = @PACKAGE_URL@\nPACKAGE_VERSION = @PACKAGE_VERSION@\nPATH_SEPARATOR = @PATH_SEPARATOR@\nPTHREAD_CC = @PTHREAD_CC@\nPTHREAD_CFLAGS = @PTHREAD_CFLAGS@\nPTHREAD_LIBS = @PTHREAD_LIBS@\nRANLIB = @RANLIB@\nSED = @SED@\nSET_MAKE = @SET_MAKE@\nSHELL = @SHELL@\nSTRIP = @STRIP@\nVERSION = @VERSION@\nXMKMF = @XMKMF@\nX_CFLAGS = @X_CFLAGS@\nX_EXTRA_LIBS = @X_EXTRA_LIBS@\nX_LIBS = @X_LIBS@\nX_PRE_LIBS = @X_PRE_LIBS@\nabs_builddir = @abs_builddir@\nabs_srcdir = @abs_srcdir@\nabs_top_builddir = @abs_top_builddir@\nabs_top_srcdir = @abs_top_srcdir@\nac_ct_CC = @ac_ct_CC@\nac_ct_CXX = @ac_ct_CXX@\nac_ct_DUMPBIN = @ac_ct_DUMPBIN@\nacx_pthread_config = @acx_pthread_config@\nam__include = @am__include@\nam__leading_dot = @am__leading_dot@\nam__quote = @am__quote@\nam__tar = @am__tar@\nam__untar = @am__untar@\nbindir = @bindir@\nbuild = @build@\nbuild_alias = @build_alias@\nbuild_cpu = @build_cpu@\nbuild_os = @build_os@\nbuild_vendor = @build_vendor@\nbuilddir = @builddir@\ndatadir = @datadir@\ndatarootdir = @datarootdir@\ndocdir = @docdir@\ndvidir = @dvidir@\nexec_prefix = @exec_prefix@\nhost = @host@\nhost_alias = @host_alias@\nhost_cpu = @host_cpu@\nhost_os = @host_os@\nhost_vendor = @host_vendor@\nhtmldir = @htmldir@\nincludedir = @includedir@\ninfodir = @infodir@\ninstall_sh = @install_sh@\nlibdir = @libdir@\nlibexecdir = @libexecdir@\nlocaledir = @localedir@\nlocalstatedir = @localstatedir@\nlt_ECHO = @lt_ECHO@\nmandir = @mandir@\nmkdir_p = @mkdir_p@\noldincludedir = @oldincludedir@\npdfdir = @pdfdir@\nprefix = @prefix@\nprogram_transform_name = @program_transform_name@\npsdir = @psdir@\nsbindir = @sbindir@\nsharedstatedir = @sharedstatedir@\nsrcdir = @srcdir@\nsysconfdir = @sysconfdir@\ntarget = @target@\ntarget_alias = @target_alias@\ntarget_cpu = @target_cpu@\ntarget_os = @target_os@\ntarget_vendor = @target_vendor@\ntop_build_prefix = @top_build_prefix@\ntop_builddir = @top_builddir@\ntop_srcdir = @top_srcdir@\nLIBPORT = $(top_builddir)/port/libport.la\nLIBTIFF = $(top_builddir)/libtiff/libtiff.la\nEXTRA_DIST = Makefile.vc\n@HAVE_RPATH_TRUE@AM_LDFLAGS = $(LIBDIR)\nbmp2tiff_SOURCES = bmp2tiff.c\nbmp2tiff_LDADD = $(LIBTIFF) $(LIBPORT)\nfax2ps_SOURCES = fax2ps.c\nfax2ps_LDADD = $(LIBTIFF) $(LIBPORT)\nfax2tiff_SOURCES = fax2tiff.c\nfax2tiff_LDADD = $(LIBTIFF) $(LIBPORT)\ngif2tiff_SOURCES = gif2tiff.c\ngif2tiff_LDADD = $(LIBTIFF) $(LIBPORT)\npal2rgb_SOURCES = pal2rgb.c\npal2rgb_LDADD = $(LIBTIFF) $(LIBPORT)\nppm2tiff_SOURCES = ppm2tiff.c\nppm2tiff_LDADD = $(LIBTIFF) $(LIBPORT)\nras2tiff_SOURCES = ras2tiff.c rasterfile.h\nras2tiff_LDADD = $(LIBTIFF) $(LIBPORT)\nraw2tiff_SOURCES = raw2tiff.c\nraw2tiff_LDADD = $(LIBTIFF) $(LIBPORT)\nrgb2ycbcr_SOURCES = rgb2ycbcr.c\nrgb2ycbcr_LDADD = $(LIBTIFF) $(LIBPORT)\nthumbnail_SOURCES = thumbnail.c\nthumbnail_LDADD = $(LIBTIFF) $(LIBPORT)\ntiff2bw_SOURCES = tiff2bw.c\ntiff2bw_LDADD = $(LIBTIFF) $(LIBPORT)\ntiff2pdf_SOURCES = tiff2pdf.c\ntiff2pdf_LDADD = $(LIBTIFF) $(LIBPORT)\ntiff2ps_SOURCES = tiff2ps.c\ntiff2ps_LDADD = $(LIBTIFF) $(LIBPORT)\ntiff2rgba_SOURCES = tiff2rgba.c\ntiff2rgba_LDADD = $(LIBTIFF) $(LIBPORT)\ntiffcmp_SOURCES = tiffcmp.c\ntiffcmp_LDADD = $(LIBTIFF) $(LIBPORT)\ntiffcp_SOURCES = tiffcp.c\ntiffcp_LDADD = $(LIBTIFF) $(LIBPORT)\ntiffcrop_SOURCES = tiffcrop.c\ntiffcrop_LDADD = $(LIBTIFF) $(LIBPORT)\ntiffdither_SOURCES = tiffdither.c\ntiffdither_LDADD = $(LIBTIFF) $(LIBPORT)\ntiffdump_SOURCES = tiffdump.c\ntiffdump_LDADD = $(LIBTIFF) $(LIBPORT)\ntiffinfo_SOURCES = tiffinfo.c\ntiffinfo_LDADD = $(LIBTIFF) $(LIBPORT)\ntiffmedian_SOURCES = tiffmedian.c\ntiffmedian_LDADD = $(LIBTIFF) $(LIBPORT)\ntiffset_SOURCES = tiffset.c\ntiffset_LDADD = $(LIBTIFF) $(LIBPORT)\ntiffsplit_SOURCES = tiffsplit.c\ntiffsplit_LDADD = $(LIBTIFF) $(LIBPORT)\ntiffgt_SOURCES = tiffgt.c\ntiffgt_CFLAGS = $(CFLAGS) $(GLUT_CFLAGS) $(AM_CFLAGS)\ntiffgt_LDADD = $(LIBTIFF) $(LIBPORT) $(X_LIBS) $(GLUT_LIBS)\nINCLUDES = -I../libtiff -I$(top_srcdir)/libtiff\nall: all-am\n\n.SUFFIXES:\n.SUFFIXES: .c .lo .o .obj\n$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)\n\t@for dep in $?; do \\\n\t  case '$(am__configure_deps)' in \\\n\t    *$$dep*) \\\n\t      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \\\n\t        && { if test -f $@; then exit 0; else break; fi; }; \\\n\t      exit 1;; \\\n\t  esac; \\\n\tdone; \\\n\techo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tools/Makefile'; \\\n\t$(am__cd) $(top_srcdir) && \\\n\t  $(AUTOMAKE) --foreign tools/Makefile\n.PRECIOUS: Makefile\nMakefile: $(srcdir)/Makefile.in $(top_builddir)/config.status\n\t@case '$?' in \\\n\t  *config.status*) \\\n\t    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \\\n\t  *) \\\n\t    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \\\n\t    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \\\n\tesac;\n\n$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n\n$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)\n\tcd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh\n$(am__aclocal_m4_deps):\ninstall-binPROGRAMS: $(bin_PROGRAMS)\n\t@$(NORMAL_INSTALL)\n\ttest -z \"$(bindir)\" || $(MKDIR_P) \"$(DESTDIR)$(bindir)\"\n\t@list='$(bin_PROGRAMS)'; test -n \"$(bindir)\" || list=; \\\n\tfor p in $$list; do echo \"$$p $$p\"; done | \\\n\tsed 's/$(EXEEXT)$$//' | \\\n\twhile read p p1; do if test -f $$p || test -f $$p1; \\\n\t  then echo \"$$p\"; echo \"$$p\"; else :; fi; \\\n\tdone | \\\n\tsed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \\\n\t    -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \\\n\tsed 'N;N;N;s,\\n, ,g' | \\\n\t$(AWK) 'BEGIN { files[\".\"] = \"\"; dirs[\".\"] = 1 } \\\n\t  { d=$$3; if (dirs[d] != 1) { print \"d\", d; dirs[d] = 1 } \\\n\t    if ($$2 == $$4) files[d] = files[d] \" \" $$1; \\\n\t    else { print \"f\", $$3 \"/\" $$4, $$1; } } \\\n\t  END { for (d in files) print \"f\", d, files[d] }' | \\\n\twhile read type dir files; do \\\n\t    if test \"$$dir\" = .; then dir=; else dir=/$$dir; fi; \\\n\t    test -z \"$$files\" || { \\\n\t    echo \" $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'\"; \\\n\t    $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files \"$(DESTDIR)$(bindir)$$dir\" || exit $$?; \\\n\t    } \\\n\t; done\n\nuninstall-binPROGRAMS:\n\t@$(NORMAL_UNINSTALL)\n\t@list='$(bin_PROGRAMS)'; test -n \"$(bindir)\" || list=; \\\n\tfiles=`for p in $$list; do echo \"$$p\"; done | \\\n\t  sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \\\n\t      -e 's/$$/$(EXEEXT)/' `; \\\n\ttest -n \"$$list\" || exit 0; \\\n\techo \" ( cd '$(DESTDIR)$(bindir)' && rm -f\" $$files \")\"; \\\n\tcd \"$(DESTDIR)$(bindir)\" && rm -f $$files\n\nclean-binPROGRAMS:\n\t@list='$(bin_PROGRAMS)'; test -n \"$$list\" || exit 0; \\\n\techo \" rm -f\" $$list; \\\n\trm -f $$list || exit $$?; \\\n\ttest -n \"$(EXEEXT)\" || exit 0; \\\n\tlist=`for p in $$list; do echo \"$$p\"; done | sed 's/$(EXEEXT)$$//'`; \\\n\techo \" rm -f\" $$list; \\\n\trm -f $$list\nbmp2tiff$(EXEEXT): $(bmp2tiff_OBJECTS) $(bmp2tiff_DEPENDENCIES) \n\t@rm -f bmp2tiff$(EXEEXT)\n\t$(AM_V_CCLD)$(LINK) $(bmp2tiff_OBJECTS) $(bmp2tiff_LDADD) $(LIBS)\nfax2ps$(EXEEXT): $(fax2ps_OBJECTS) $(fax2ps_DEPENDENCIES) \n\t@rm -f fax2ps$(EXEEXT)\n\t$(AM_V_CCLD)$(LINK) $(fax2ps_OBJECTS) $(fax2ps_LDADD) $(LIBS)\nfax2tiff$(EXEEXT): $(fax2tiff_OBJECTS) $(fax2tiff_DEPENDENCIES) \n\t@rm -f fax2tiff$(EXEEXT)\n\t$(AM_V_CCLD)$(LINK) $(fax2tiff_OBJECTS) $(fax2tiff_LDADD) $(LIBS)\ngif2tiff$(EXEEXT): $(gif2tiff_OBJECTS) $(gif2tiff_DEPENDENCIES) \n\t@rm -f gif2tiff$(EXEEXT)\n\t$(AM_V_CCLD)$(LINK) $(gif2tiff_OBJECTS) $(gif2tiff_LDADD) $(LIBS)\npal2rgb$(EXEEXT): $(pal2rgb_OBJECTS) $(pal2rgb_DEPENDENCIES) \n\t@rm -f pal2rgb$(EXEEXT)\n\t$(AM_V_CCLD)$(LINK) $(pal2rgb_OBJECTS) $(pal2rgb_LDADD) $(LIBS)\nppm2tiff$(EXEEXT): $(ppm2tiff_OBJECTS) $(ppm2tiff_DEPENDENCIES) \n\t@rm -f ppm2tiff$(EXEEXT)\n\t$(AM_V_CCLD)$(LINK) $(ppm2tiff_OBJECTS) $(ppm2tiff_LDADD) $(LIBS)\nras2tiff$(EXEEXT): $(ras2tiff_OBJECTS) $(ras2tiff_DEPENDENCIES) \n\t@rm -f ras2tiff$(EXEEXT)\n\t$(AM_V_CCLD)$(LINK) $(ras2tiff_OBJECTS) $(ras2tiff_LDADD) $(LIBS)\nraw2tiff$(EXEEXT): $(raw2tiff_OBJECTS) $(raw2tiff_DEPENDENCIES) \n\t@rm -f raw2tiff$(EXEEXT)\n\t$(AM_V_CCLD)$(LINK) $(raw2tiff_OBJECTS) $(raw2tiff_LDADD) $(LIBS)\nrgb2ycbcr$(EXEEXT): $(rgb2ycbcr_OBJECTS) $(rgb2ycbcr_DEPENDENCIES) \n\t@rm -f rgb2ycbcr$(EXEEXT)\n\t$(AM_V_CCLD)$(LINK) $(rgb2ycbcr_OBJECTS) $(rgb2ycbcr_LDADD) $(LIBS)\nsgi2tiff$(EXEEXT): $(sgi2tiff_OBJECTS) $(sgi2tiff_DEPENDENCIES) \n\t@rm -f sgi2tiff$(EXEEXT)\n\t$(AM_V_CCLD)$(LINK) $(sgi2tiff_OBJECTS) $(sgi2tiff_LDADD) $(LIBS)\nsgisv$(EXEEXT): $(sgisv_OBJECTS) $(sgisv_DEPENDENCIES) \n\t@rm -f sgisv$(EXEEXT)\n\t$(AM_V_CCLD)$(LINK) $(sgisv_OBJECTS) $(sgisv_LDADD) $(LIBS)\nthumbnail$(EXEEXT): $(thumbnail_OBJECTS) $(thumbnail_DEPENDENCIES) \n\t@rm -f thumbnail$(EXEEXT)\n\t$(AM_V_CCLD)$(LINK) $(thumbnail_OBJECTS) $(thumbnail_LDADD) $(LIBS)\ntiff2bw$(EXEEXT): $(tiff2bw_OBJECTS) $(tiff2bw_DEPENDENCIES) \n\t@rm -f tiff2bw$(EXEEXT)\n\t$(AM_V_CCLD)$(LINK) $(tiff2bw_OBJECTS) $(tiff2bw_LDADD) $(LIBS)\ntiff2pdf$(EXEEXT): $(tiff2pdf_OBJECTS) $(tiff2pdf_DEPENDENCIES) \n\t@rm -f tiff2pdf$(EXEEXT)\n\t$(AM_V_CCLD)$(LINK) $(tiff2pdf_OBJECTS) $(tiff2pdf_LDADD) $(LIBS)\ntiff2ps$(EXEEXT): $(tiff2ps_OBJECTS) $(tiff2ps_DEPENDENCIES) \n\t@rm -f tiff2ps$(EXEEXT)\n\t$(AM_V_CCLD)$(LINK) $(tiff2ps_OBJECTS) $(tiff2ps_LDADD) $(LIBS)\ntiff2rgba$(EXEEXT): $(tiff2rgba_OBJECTS) $(tiff2rgba_DEPENDENCIES) \n\t@rm -f tiff2rgba$(EXEEXT)\n\t$(AM_V_CCLD)$(LINK) $(tiff2rgba_OBJECTS) $(tiff2rgba_LDADD) $(LIBS)\ntiffcmp$(EXEEXT): $(tiffcmp_OBJECTS) $(tiffcmp_DEPENDENCIES) \n\t@rm -f tiffcmp$(EXEEXT)\n\t$(AM_V_CCLD)$(LINK) $(tiffcmp_OBJECTS) $(tiffcmp_LDADD) $(LIBS)\ntiffcp$(EXEEXT): $(tiffcp_OBJECTS) $(tiffcp_DEPENDENCIES) \n\t@rm -f tiffcp$(EXEEXT)\n\t$(AM_V_CCLD)$(LINK) $(tiffcp_OBJECTS) $(tiffcp_LDADD) $(LIBS)\ntiffcrop$(EXEEXT): $(tiffcrop_OBJECTS) $(tiffcrop_DEPENDENCIES) \n\t@rm -f tiffcrop$(EXEEXT)\n\t$(AM_V_CCLD)$(LINK) $(tiffcrop_OBJECTS) $(tiffcrop_LDADD) $(LIBS)\ntiffdither$(EXEEXT): $(tiffdither_OBJECTS) $(tiffdither_DEPENDENCIES) \n\t@rm -f tiffdither$(EXEEXT)\n\t$(AM_V_CCLD)$(LINK) $(tiffdither_OBJECTS) $(tiffdither_LDADD) $(LIBS)\ntiffdump$(EXEEXT): $(tiffdump_OBJECTS) $(tiffdump_DEPENDENCIES) \n\t@rm -f tiffdump$(EXEEXT)\n\t$(AM_V_CCLD)$(LINK) $(tiffdump_OBJECTS) $(tiffdump_LDADD) $(LIBS)\ntiffgt$(EXEEXT): $(tiffgt_OBJECTS) $(tiffgt_DEPENDENCIES) \n\t@rm -f tiffgt$(EXEEXT)\n\t$(AM_V_CCLD)$(tiffgt_LINK) $(tiffgt_OBJECTS) $(tiffgt_LDADD) $(LIBS)\ntiffinfo$(EXEEXT): $(tiffinfo_OBJECTS) $(tiffinfo_DEPENDENCIES) \n\t@rm -f tiffinfo$(EXEEXT)\n\t$(AM_V_CCLD)$(LINK) $(tiffinfo_OBJECTS) $(tiffinfo_LDADD) $(LIBS)\ntiffmedian$(EXEEXT): $(tiffmedian_OBJECTS) $(tiffmedian_DEPENDENCIES) \n\t@rm -f tiffmedian$(EXEEXT)\n\t$(AM_V_CCLD)$(LINK) $(tiffmedian_OBJECTS) $(tiffmedian_LDADD) $(LIBS)\ntiffset$(EXEEXT): $(tiffset_OBJECTS) $(tiffset_DEPENDENCIES) \n\t@rm -f tiffset$(EXEEXT)\n\t$(AM_V_CCLD)$(LINK) $(tiffset_OBJECTS) $(tiffset_LDADD) $(LIBS)\ntiffsplit$(EXEEXT): $(tiffsplit_OBJECTS) $(tiffsplit_DEPENDENCIES) \n\t@rm -f tiffsplit$(EXEEXT)\n\t$(AM_V_CCLD)$(LINK) $(tiffsplit_OBJECTS) $(tiffsplit_LDADD) $(LIBS)\nycbcr$(EXEEXT): $(ycbcr_OBJECTS) $(ycbcr_DEPENDENCIES) \n\t@rm -f ycbcr$(EXEEXT)\n\t$(AM_V_CCLD)$(LINK) $(ycbcr_OBJECTS) $(ycbcr_LDADD) $(LIBS)\n\nmostlyclean-compile:\n\t-rm -f *.$(OBJEXT)\n\ndistclean-compile:\n\t-rm -f *.tab.c\n\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bmp2tiff.Po@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fax2ps.Po@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fax2tiff.Po@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gif2tiff.Po@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pal2rgb.Po@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppm2tiff.Po@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ras2tiff.Po@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/raw2tiff.Po@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rgb2ycbcr.Po@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sgi2tiff.Po@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sgisv.Po@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/thumbnail.Po@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tiff2bw.Po@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tiff2pdf.Po@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tiff2ps.Po@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tiff2rgba.Po@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tiffcmp.Po@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tiffcp.Po@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tiffcrop.Po@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tiffdither.Po@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tiffdump.Po@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tiffgt-tiffgt.Po@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tiffinfo.Po@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tiffmedian.Po@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tiffset.Po@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tiffsplit.Po@am__quote@\n@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ycbcr.Po@am__quote@\n\n.c.o:\n@am__fastdepCC_TRUE@\t$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<\n@am__fastdepCC_TRUE@\t$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po\n@am__fastdepCC_FALSE@\t$(AM_V_CC) @AM_BACKSLASH@\n@AMDEP_TRUE@@am__fastdepCC_FALSE@\tsource='$<' object='$@' libtool=no @AMDEPBACKSLASH@\n@AMDEP_TRUE@@am__fastdepCC_FALSE@\tDEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@\n@am__fastdepCC_FALSE@\t$(COMPILE) -c $<\n\n.c.obj:\n@am__fastdepCC_TRUE@\t$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`\n@am__fastdepCC_TRUE@\t$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po\n@am__fastdepCC_FALSE@\t$(AM_V_CC) @AM_BACKSLASH@\n@AMDEP_TRUE@@am__fastdepCC_FALSE@\tsource='$<' object='$@' libtool=no @AMDEPBACKSLASH@\n@AMDEP_TRUE@@am__fastdepCC_FALSE@\tDEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@\n@am__fastdepCC_FALSE@\t$(COMPILE) -c `$(CYGPATH_W) '$<'`\n\n.c.lo:\n@am__fastdepCC_TRUE@\t$(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<\n@am__fastdepCC_TRUE@\t$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo\n@am__fastdepCC_FALSE@\t$(AM_V_CC) @AM_BACKSLASH@\n@AMDEP_TRUE@@am__fastdepCC_FALSE@\tsource='$<' object='$@' libtool=yes @AMDEPBACKSLASH@\n@AMDEP_TRUE@@am__fastdepCC_FALSE@\tDEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@\n@am__fastdepCC_FALSE@\t$(LTCOMPILE) -c -o $@ $<\n\ntiffgt-tiffgt.o: tiffgt.c\n@am__fastdepCC_TRUE@\t$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tiffgt_CFLAGS) $(CFLAGS) -MT tiffgt-tiffgt.o -MD -MP -MF $(DEPDIR)/tiffgt-tiffgt.Tpo -c -o tiffgt-tiffgt.o `test -f 'tiffgt.c' || echo '$(srcdir)/'`tiffgt.c\n@am__fastdepCC_TRUE@\t$(AM_V_at)$(am__mv) $(DEPDIR)/tiffgt-tiffgt.Tpo $(DEPDIR)/tiffgt-tiffgt.Po\n@am__fastdepCC_FALSE@\t$(AM_V_CC) @AM_BACKSLASH@\n@AMDEP_TRUE@@am__fastdepCC_FALSE@\tsource='tiffgt.c' object='tiffgt-tiffgt.o' libtool=no @AMDEPBACKSLASH@\n@AMDEP_TRUE@@am__fastdepCC_FALSE@\tDEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@\n@am__fastdepCC_FALSE@\t$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tiffgt_CFLAGS) $(CFLAGS) -c -o tiffgt-tiffgt.o `test -f 'tiffgt.c' || echo '$(srcdir)/'`tiffgt.c\n\ntiffgt-tiffgt.obj: tiffgt.c\n@am__fastdepCC_TRUE@\t$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tiffgt_CFLAGS) $(CFLAGS) -MT tiffgt-tiffgt.obj -MD -MP -MF $(DEPDIR)/tiffgt-tiffgt.Tpo -c -o tiffgt-tiffgt.obj `if test -f 'tiffgt.c'; then $(CYGPATH_W) 'tiffgt.c'; else $(CYGPATH_W) '$(srcdir)/tiffgt.c'; fi`\n@am__fastdepCC_TRUE@\t$(AM_V_at)$(am__mv) $(DEPDIR)/tiffgt-tiffgt.Tpo $(DEPDIR)/tiffgt-tiffgt.Po\n@am__fastdepCC_FALSE@\t$(AM_V_CC) @AM_BACKSLASH@\n@AMDEP_TRUE@@am__fastdepCC_FALSE@\tsource='tiffgt.c' object='tiffgt-tiffgt.obj' libtool=no @AMDEPBACKSLASH@\n@AMDEP_TRUE@@am__fastdepCC_FALSE@\tDEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@\n@am__fastdepCC_FALSE@\t$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tiffgt_CFLAGS) $(CFLAGS) -c -o tiffgt-tiffgt.obj `if test -f 'tiffgt.c'; then $(CYGPATH_W) 'tiffgt.c'; else $(CYGPATH_W) '$(srcdir)/tiffgt.c'; fi`\n\nmostlyclean-libtool:\n\t-rm -f *.lo\n\nclean-libtool:\n\t-rm -rf .libs _libs\n\nID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)\n\tlist='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \\\n\tunique=`for i in $$list; do \\\n\t    if test -f \"$$i\"; then echo $$i; else echo $(srcdir)/$$i; fi; \\\n\t  done | \\\n\t  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \\\n\t      END { if (nonempty) { for (i in files) print i; }; }'`; \\\n\tmkid -fID $$unique\ntags: TAGS\n\nTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \\\n\t\t$(TAGS_FILES) $(LISP)\n\tset x; \\\n\there=`pwd`; \\\n\tlist='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \\\n\tunique=`for i in $$list; do \\\n\t    if test -f \"$$i\"; then echo $$i; else echo $(srcdir)/$$i; fi; \\\n\t  done | \\\n\t  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \\\n\t      END { if (nonempty) { for (i in files) print i; }; }'`; \\\n\tshift; \\\n\tif test -z \"$(ETAGS_ARGS)$$*$$unique\"; then :; else \\\n\t  test -n \"$$unique\" || unique=$$empty_fix; \\\n\t  if test $$# -gt 0; then \\\n\t    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \\\n\t      \"$$@\" $$unique; \\\n\t  else \\\n\t    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \\\n\t      $$unique; \\\n\t  fi; \\\n\tfi\nctags: CTAGS\nCTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \\\n\t\t$(TAGS_FILES) $(LISP)\n\tlist='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \\\n\tunique=`for i in $$list; do \\\n\t    if test -f \"$$i\"; then echo $$i; else echo $(srcdir)/$$i; fi; \\\n\t  done | \\\n\t  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \\\n\t      END { if (nonempty) { for (i in files) print i; }; }'`; \\\n\ttest -z \"$(CTAGS_ARGS)$$unique\" \\\n\t  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \\\n\t     $$unique\n\nGTAGS:\n\there=`$(am__cd) $(top_builddir) && pwd` \\\n\t  && $(am__cd) $(top_srcdir) \\\n\t  && gtags -i $(GTAGS_ARGS) \"$$here\"\n\ndistclean-tags:\n\t-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags\n\ndistdir: $(DISTFILES)\n\t@srcdirstrip=`echo \"$(srcdir)\" | sed 's/[].[^$$\\\\*]/\\\\\\\\&/g'`; \\\n\ttopsrcdirstrip=`echo \"$(top_srcdir)\" | sed 's/[].[^$$\\\\*]/\\\\\\\\&/g'`; \\\n\tlist='$(DISTFILES)'; \\\n\t  dist_files=`for file in $$list; do echo $$file; done | \\\n\t  sed -e \"s|^$$srcdirstrip/||;t\" \\\n\t      -e \"s|^$$topsrcdirstrip/|$(top_builddir)/|;t\"`; \\\n\tcase $$dist_files in \\\n\t  */*) $(MKDIR_P) `echo \"$$dist_files\" | \\\n\t\t\t   sed '/\\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \\\n\t\t\t   sort -u` ;; \\\n\tesac; \\\n\tfor file in $$dist_files; do \\\n\t  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \\\n\t  if test -d $$d/$$file; then \\\n\t    dir=`echo \"/$$file\" | sed -e 's,/[^/]*$$,,'`; \\\n\t    if test -d \"$(distdir)/$$file\"; then \\\n\t      find \"$(distdir)/$$file\" -type d ! -perm -700 -exec chmod u+rwx {} \\;; \\\n\t    fi; \\\n\t    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \\\n\t      cp -fpR $(srcdir)/$$file \"$(distdir)$$dir\" || exit 1; \\\n\t      find \"$(distdir)/$$file\" -type d ! -perm -700 -exec chmod u+rwx {} \\;; \\\n\t    fi; \\\n\t    cp -fpR $$d/$$file \"$(distdir)$$dir\" || exit 1; \\\n\t  else \\\n\t    test -f \"$(distdir)/$$file\" \\\n\t    || cp -p $$d/$$file \"$(distdir)/$$file\" \\\n\t    || exit 1; \\\n\t  fi; \\\n\tdone\ncheck-am: all-am\ncheck: check-am\nall-am: Makefile $(PROGRAMS)\ninstalldirs:\n\tfor dir in \"$(DESTDIR)$(bindir)\"; do \\\n\t  test -z \"$$dir\" || $(MKDIR_P) \"$$dir\"; \\\n\tdone\ninstall: install-am\ninstall-exec: install-exec-am\ninstall-data: install-data-am\nuninstall: uninstall-am\n\ninstall-am: all-am\n\t@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am\n\ninstallcheck: installcheck-am\ninstall-strip:\n\t$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM=\"$(INSTALL_STRIP_PROGRAM)\" \\\n\t  install_sh_PROGRAM=\"$(INSTALL_STRIP_PROGRAM)\" INSTALL_STRIP_FLAG=-s \\\n\t  `test -z '$(STRIP)' || \\\n\t    echo \"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'\"` install\nmostlyclean-generic:\n\nclean-generic:\n\ndistclean-generic:\n\t-test -z \"$(CONFIG_CLEAN_FILES)\" || rm -f $(CONFIG_CLEAN_FILES)\n\t-test . = \"$(srcdir)\" || test -z \"$(CONFIG_CLEAN_VPATH_FILES)\" || rm -f $(CONFIG_CLEAN_VPATH_FILES)\n\nmaintainer-clean-generic:\n\t@echo \"This command is intended for maintainers to use\"\n\t@echo \"it deletes files that may require special tools to rebuild.\"\nclean: clean-am\n\nclean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am\n\ndistclean: distclean-am\n\t-rm -rf ./$(DEPDIR)\n\t-rm -f Makefile\ndistclean-am: clean-am distclean-compile distclean-generic \\\n\tdistclean-tags\n\ndvi: dvi-am\n\ndvi-am:\n\nhtml: html-am\n\nhtml-am:\n\ninfo: info-am\n\ninfo-am:\n\ninstall-data-am:\n\ninstall-dvi: install-dvi-am\n\ninstall-dvi-am:\n\ninstall-exec-am: install-binPROGRAMS\n\ninstall-html: install-html-am\n\ninstall-html-am:\n\ninstall-info: install-info-am\n\ninstall-info-am:\n\ninstall-man:\n\ninstall-pdf: install-pdf-am\n\ninstall-pdf-am:\n\ninstall-ps: install-ps-am\n\ninstall-ps-am:\n\ninstallcheck-am:\n\nmaintainer-clean: maintainer-clean-am\n\t-rm -rf ./$(DEPDIR)\n\t-rm -f Makefile\nmaintainer-clean-am: distclean-am maintainer-clean-generic\n\nmostlyclean: mostlyclean-am\n\nmostlyclean-am: mostlyclean-compile mostlyclean-generic \\\n\tmostlyclean-libtool\n\npdf: pdf-am\n\npdf-am:\n\nps: ps-am\n\nps-am:\n\nuninstall-am: uninstall-binPROGRAMS\n\n.MAKE: install-am install-strip\n\n.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \\\n\tclean-generic clean-libtool ctags distclean distclean-compile \\\n\tdistclean-generic distclean-libtool distclean-tags distdir dvi \\\n\tdvi-am html html-am info info-am install install-am \\\n\tinstall-binPROGRAMS install-data install-data-am install-dvi \\\n\tinstall-dvi-am install-exec install-exec-am install-html \\\n\tinstall-html-am install-info install-info-am install-man \\\n\tinstall-pdf install-pdf-am install-ps install-ps-am \\\n\tinstall-strip installcheck installcheck-am installdirs \\\n\tmaintainer-clean maintainer-clean-generic mostlyclean \\\n\tmostlyclean-compile mostlyclean-generic mostlyclean-libtool \\\n\tpdf pdf-am ps ps-am tags uninstall uninstall-am \\\n\tuninstall-binPROGRAMS\n\n\necho:\n\t(echo $(CFLAGS))\n\t(echo $(tiffgt_CFLAGS))\n\t(echo $(GL_CFLAGS))\n\t(echo $(GLU_CFLAGS))\n\t(echo $(GLUT_CFLAGS))\n\n# Tell versions [3.59,3.63) of GNU make to not export all variables.\n# Otherwise a system limit (for SysV at least) may be exceeded.\n.NOEXPORT:\n"
  },
  {
    "path": "src/main/jni/tiff/tools/Makefile.vc",
    "content": "# $Id: Makefile.vc,v 1.13 2007/02/24 15:26:09 dron Exp $\n#\n# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>\n#\n# Permission to use, copy, modify, distribute, and sell this software and \n# its documentation for any purpose is hereby granted without fee, provided\n# that (i) the above copyright notices and this permission notice appear in\n# all copies of the software and related documentation, and (ii) the names of\n# Sam Leffler and Silicon Graphics may not be used in any advertising or\n# publicity relating to the software without the specific, prior written\n# permission of Sam Leffler and Silicon Graphics.\n# \n# THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n# \n# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n# OF THIS SOFTWARE.\n#\n# Makefile for MS Visual C and Watcom C compilers.\n#\n# To build:\n# C:\\libtiff\\tools> nmake /f makefile.vc \n\n!INCLUDE ..\\nmake.opt\n\nTARGETS\t=\tbmp2tiff.exe tiffinfo.exe tiffdump.exe fax2tiff.exe \\\n\t\tfax2ps.exe gif2tiff.exe pal2rgb.exe ppm2tiff.exe \\\n\t\trgb2ycbcr.exe thumbnail.exe ras2tiff.exe raw2tiff.exe \\\n\t\ttiff2bw.exe tiff2rgba.exe tiff2pdf.exe tiff2ps.exe \\\n\t\ttiffcmp.exe tiffcp.exe tiffcrop.exe tiffdither.exe \\\n\t\ttiffmedian.exe tiffset.exe tiffsplit.exe \n\nINCL\t\t= \t-I..\\libtiff\nLIBS\t\t=\t$(LIBS) ..\\port\\libport.lib ..\\libtiff\\libtiff.lib\n\ndefault:\t$(TARGETS)\n\n.c.exe:\n\t$(CC) $(CFLAGS) $*.c $(EXTRA_OBJ) $(LIBS)\n\ntiffgt.exe:\n\t$(CC) $(CFLAGS) tiffgt.c $(EXTRA_OBJ) $(LIBS)\n\nclean:\n\t-del *.exe\n\t-del *.obj\n"
  },
  {
    "path": "src/main/jni/tiff/tools/bmp2tiff.c",
    "content": "/* $Id: bmp2tiff.c,v 1.20 2006/03/23 14:54:02 dron Exp $\n *\n * Project:  libtiff tools\n * Purpose:  Convert Windows BMP files in TIFF.\n * Author:   Andrey Kiselev, dron@ak4719.spb.edu\n *\n ******************************************************************************\n * Copyright (c) 2004, Andrey Kiselev <dron@ak4719.spb.edu>\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n#include \"tif_config.h\"\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <ctype.h>\n#include <sys/types.h>\n#include <sys/stat.h>\n\n#ifdef HAVE_UNISTD_H\n# include <unistd.h>\n#endif\n\n#if HAVE_FCNTL_H\n# include <fcntl.h>\n#endif\n\n#if HAVE_SYS_TYPES_H\n# include <sys/types.h>\n#endif\n\n#if HAVE_IO_H\n# include <io.h>\n#endif\n\n#include \"tiffio.h\"\n\n#ifndef O_BINARY\n# define O_BINARY 0\n#endif\n\nenum BMPType\n{\n    BMPT_WIN4,      /* BMP used in Windows 3.0/NT 3.51/95 */\n    BMPT_WIN5,      /* BMP used in Windows NT 4.0/98/Me/2000/XP */\n    BMPT_OS21,      /* BMP used in OS/2 PM 1.x */\n    BMPT_OS22       /* BMP used in OS/2 PM 2.x */\n};\n\n/*\n * Bitmap file consists of a BMPFileHeader structure followed by a\n * BMPInfoHeader structure. An array of BMPColorEntry structures (also called\n * a colour table) follows the bitmap information header structure. The colour\n * table is followed by a second array of indexes into the colour table (the\n * actual bitmap data). Data may be comressed, for 4-bpp and 8-bpp used RLE\n * compression.\n *\n * +---------------------+\n * | BMPFileHeader       |\n * +---------------------+\n * | BMPInfoHeader       |\n * +---------------------+\n * | BMPColorEntry array |\n * +---------------------+\n * | Colour-index array  |\n * +---------------------+\n *\n * All numbers stored in Intel order with least significant byte first.\n */\n\nenum BMPComprMethod\n{\n    BMPC_RGB = 0L,          /* Uncompressed */\n    BMPC_RLE8 = 1L,         /* RLE for 8 bpp images */\n    BMPC_RLE4 = 2L,         /* RLE for 4 bpp images */\n    BMPC_BITFIELDS = 3L,    /* Bitmap is not compressed and the colour table\n\t\t\t     * consists of three DWORD color masks that specify\n\t\t\t     * the red, green, and blue components of each\n\t\t\t     * pixel. This is valid when used with\n\t\t\t     * 16- and 32-bpp bitmaps. */\n    BMPC_JPEG = 4L,         /* Indicates that the image is a JPEG image. */\n    BMPC_PNG = 5L           /* Indicates that the image is a PNG image. */\n};\n\nenum BMPLCSType                 /* Type of logical color space. */\n{\n    BMPLT_CALIBRATED_RGB = 0,\t/* This value indicates that endpoints and\n\t\t\t\t * gamma values are given in the appropriate\n\t\t\t\t * fields. */\n    BMPLT_DEVICE_RGB = 1,\n    BMPLT_DEVICE_CMYK = 2\n};\n\ntypedef struct\n{\n    int32   iCIEX;\n    int32   iCIEY;\n    int32   iCIEZ;\n} BMPCIEXYZ;\n\ntypedef struct                  /* This structure contains the x, y, and z */\n{\t\t\t\t/* coordinates of the three colors that */\n\t\t\t\t/* correspond */\n    BMPCIEXYZ   iCIERed;        /* to the red, green, and blue endpoints for */\n    BMPCIEXYZ   iCIEGreen;      /* a specified logical color space. */\n    BMPCIEXYZ\tiCIEBlue;\n} BMPCIEXYZTriple;\n\ntypedef struct\n{\n    char\tbType[2];       /* Signature \"BM\" */\n    uint32\tiSize;          /* Size in bytes of the bitmap file. Should\n\t\t\t\t * always be ignored while reading because\n\t\t\t\t * of error in Windows 3.0 SDK's description\n\t\t\t\t * of this field */\n    uint16\tiReserved1;     /* Reserved, set as 0 */\n    uint16\tiReserved2;     /* Reserved, set as 0 */\n    uint32\tiOffBits;       /* Offset of the image from file start in bytes */\n} BMPFileHeader;\n\n/* File header size in bytes: */\nconst int       BFH_SIZE = 14;\n\ntypedef struct\n{\n    uint32\tiSize;          /* Size of BMPInfoHeader structure in bytes.\n\t\t\t\t * Should be used to determine start of the\n\t\t\t\t * colour table */\n    int32\tiWidth;         /* Image width */\n    int32\tiHeight;        /* Image height. If positive, image has bottom\n\t\t\t\t * left origin, if negative --- top left. */\n    int16\tiPlanes;        /* Number of image planes (must be set to 1) */\n    int16\tiBitCount;      /* Number of bits per pixel (1, 4, 8, 16, 24\n\t\t\t\t * or 32). If 0 then the number of bits per\n\t\t\t\t * pixel is specified or is implied by the\n\t\t\t\t * JPEG or PNG format. */\n    uint32\tiCompression;\t/* Compression method */\n    uint32\tiSizeImage;     /* Size of uncomressed image in bytes. May\n\t\t\t\t * be 0 for BMPC_RGB bitmaps. If iCompression\n\t\t\t\t * is BI_JPEG or BI_PNG, iSizeImage indicates\n\t\t\t\t * the size of the JPEG or PNG image buffer. */\n    int32\tiXPelsPerMeter; /* X resolution, pixels per meter (0 if not used) */\n    int32\tiYPelsPerMeter; /* Y resolution, pixels per meter (0 if not used) */\n    uint32\tiClrUsed;       /* Size of colour table. If 0, iBitCount should\n\t\t\t\t * be used to calculate this value\n\t\t\t\t * (1<<iBitCount). This value should be\n\t\t\t\t * unsigned for proper shifting. */\n    int32\tiClrImportant;  /* Number of important colours. If 0, all\n\t\t\t\t * colours are required */\n\n    /*\n     * Fields above should be used for bitmaps, compatible with Windows NT 3.51\n     * and earlier. Windows 98/Me, Windows 2000/XP introduces additional fields:\n     */\n\n    int32\tiRedMask;       /* Colour mask that specifies the red component\n\t\t\t\t * of each pixel, valid only if iCompression\n\t\t\t\t * is set to BI_BITFIELDS. */\n    int32\tiGreenMask;     /* The same for green component */\n    int32\tiBlueMask;      /* The same for blue component */\n    int32\tiAlphaMask;     /* Colour mask that specifies the alpha\n\t\t\t\t * component of each pixel. */\n    uint32\tiCSType;        /* Colour space of the DIB. */\n    BMPCIEXYZTriple sEndpoints; /* This member is ignored unless the iCSType\n\t\t\t\t * member specifies BMPLT_CALIBRATED_RGB. */\n    int32\tiGammaRed;      /* Toned response curve for red. This member\n\t\t\t\t * is ignored unless color values are\n\t\t\t\t * calibrated RGB values and iCSType is set to\n\t\t\t\t * BMPLT_CALIBRATED_RGB. Specified\n\t\t\t\t * in 16^16 format. */\n    int32\tiGammaGreen;    /* Toned response curve for green. */\n    int32\tiGammaBlue;     /* Toned response curve for blue. */\n} BMPInfoHeader;\n\n/*\n * Info header size in bytes:\n */\nconst unsigned int  BIH_WIN4SIZE = 40; /* for BMPT_WIN4 */\nconst unsigned int  BIH_WIN5SIZE = 57; /* for BMPT_WIN5 */\nconst unsigned int  BIH_OS21SIZE = 12; /* for BMPT_OS21 */\nconst unsigned int  BIH_OS22SIZE = 64; /* for BMPT_OS22 */\n\n/*\n * We will use plain byte array instead of this structure, but declaration\n * provided for reference\n */\ntypedef struct\n{\n    char       bBlue;\n    char       bGreen;\n    char       bRed;\n    char       bReserved;      /* Must be 0 */\n} BMPColorEntry;\n\nstatic\tuint16 compression = (uint16) -1;\nstatic\tint jpegcolormode = JPEGCOLORMODE_RGB;\nstatic\tint quality = 75;\t\t/* JPEG quality */\nstatic\tuint16 predictor = 0;\n\nstatic void usage(void);\nstatic int processCompressOptions(char*);\nstatic void rearrangePixels(char *, uint32, uint32);\n\nint\nmain(int argc, char* argv[])\n{\n\tuint32\twidth, length;\n\tuint16\tnbands = 1;\t\t/* number of bands in input image */\n        uint16\tdepth = 8;\t\t/* bits per pixel in input image */\n\tuint32\trowsperstrip = (uint32) -1;\n        uint16\tphotometric = PHOTOMETRIC_MINISBLACK;\n\tint\tfd = 0;\n\tstruct stat instat;\n\tchar\t*outfilename = NULL, *infilename = NULL;\n\tTIFF\t*out = NULL;\n\n\tBMPFileHeader file_hdr;\n        BMPInfoHeader info_hdr;\n        int     bmp_type;\n        uint32  clr_tbl_size, n_clr_elems = 3;\n        unsigned char *clr_tbl;\n\tunsigned short *red_tbl = NULL, *green_tbl = NULL, *blue_tbl = NULL;\n\tuint32\trow, clr;\n\n\tint\tc;\n\textern int optind;\n\textern char* optarg;\n\n\twhile ((c = getopt(argc, argv, \"c:r:o:h\")) != -1) {\n\t\tswitch (c) {\n\t\tcase 'c':\t\t/* compression scheme */\n\t\t\tif (!processCompressOptions(optarg))\n\t\t\t\tusage();\n\t\t\tbreak;\n\t\tcase 'r':\t\t/* rows/strip */\n\t\t\trowsperstrip = atoi(optarg);\n\t\t\tbreak;\n\t\tcase 'o':\n\t\t\toutfilename = optarg;\n\t\t\tbreak;\n\t\tcase 'h':\n\t\t\tusage();\n\t\tdefault:\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tif (argc - optind < 2)\n\t\tusage();\n\n\tif (outfilename == NULL)\n\t\toutfilename = argv[argc-1];\n\tout = TIFFOpen(outfilename, \"w\");\n\tif (out == NULL) {\n\t\tTIFFError(infilename, \"Cannot open file %s for output\",\n\t\t\t  outfilename);\n\t\tgoto bad3;\n\t}\n\t\n\n\twhile (optind < argc-1) {\n\t\tinfilename = argv[optind];\n\t\toptind++;\n\t    \n\t\tfd = open(infilename, O_RDONLY|O_BINARY, 0);\n\t\tif (fd < 0) {\n\t\t\tTIFFError(infilename, \"Cannot open input file\");\n\t\t\treturn -1;\n\t\t}\n\n\t\tread(fd, file_hdr.bType, 2);\n\t\tif(file_hdr.bType[0] != 'B' || file_hdr.bType[1] != 'M') {\n\t\t\tTIFFError(infilename, \"File is not BMP\");\n\t\t\tgoto bad;\n\t\t}\n\n/* -------------------------------------------------------------------- */\n/*      Read the BMPFileHeader. We need iOffBits value only             */\n/* -------------------------------------------------------------------- */\n\t\tlseek(fd, 10, SEEK_SET);\n\t\tread(fd, &file_hdr.iOffBits, 4);\n#ifdef WORDS_BIGENDIAN\n\t\tTIFFSwabLong(&file_hdr.iOffBits);\n#endif\n\t\tfstat(fd, &instat);\n\t\tfile_hdr.iSize = instat.st_size;\n\n/* -------------------------------------------------------------------- */\n/*      Read the BMPInfoHeader.                                         */\n/* -------------------------------------------------------------------- */\n\n\t\tlseek(fd, BFH_SIZE, SEEK_SET);\n\t\tread(fd, &info_hdr.iSize, 4);\n#ifdef WORDS_BIGENDIAN\n\t\tTIFFSwabLong(&info_hdr.iSize);\n#endif\n\n\t\tif (info_hdr.iSize == BIH_WIN4SIZE)\n\t\t\tbmp_type = BMPT_WIN4;\n\t\telse if (info_hdr.iSize == BIH_OS21SIZE)\n\t\t\tbmp_type = BMPT_OS21;\n\t\telse if (info_hdr.iSize == BIH_OS22SIZE\n\t\t\t || info_hdr.iSize == 16)\n\t\t\tbmp_type = BMPT_OS22;\n\t\telse\n\t\t\tbmp_type = BMPT_WIN5;\n\n\t\tif (bmp_type == BMPT_WIN4\n\t\t    || bmp_type == BMPT_WIN5\n\t\t    || bmp_type == BMPT_OS22) {\n\t\t\tread(fd, &info_hdr.iWidth, 4);\n\t\t\tread(fd, &info_hdr.iHeight, 4);\n\t\t\tread(fd, &info_hdr.iPlanes, 2);\n\t\t\tread(fd, &info_hdr.iBitCount, 2);\n\t\t\tread(fd, &info_hdr.iCompression, 4);\n\t\t\tread(fd, &info_hdr.iSizeImage, 4);\n\t\t\tread(fd, &info_hdr.iXPelsPerMeter, 4);\n\t\t\tread(fd, &info_hdr.iYPelsPerMeter, 4);\n\t\t\tread(fd, &info_hdr.iClrUsed, 4);\n\t\t\tread(fd, &info_hdr.iClrImportant, 4);\n#ifdef WORDS_BIGENDIAN\n\t\t\tTIFFSwabLong((uint32*) &info_hdr.iWidth);\n\t\t\tTIFFSwabLong((uint32*) &info_hdr.iHeight);\n\t\t\tTIFFSwabShort((uint16*) &info_hdr.iPlanes);\n\t\t\tTIFFSwabShort((uint16*) &info_hdr.iBitCount);\n\t\t\tTIFFSwabLong((uint32*) &info_hdr.iCompression);\n\t\t\tTIFFSwabLong((uint32*) &info_hdr.iSizeImage);\n\t\t\tTIFFSwabLong((uint32*) &info_hdr.iXPelsPerMeter);\n\t\t\tTIFFSwabLong((uint32*) &info_hdr.iYPelsPerMeter);\n\t\t\tTIFFSwabLong((uint32*) &info_hdr.iClrUsed);\n\t\t\tTIFFSwabLong((uint32*) &info_hdr.iClrImportant);\n#endif\n\t\t\tn_clr_elems = 4;\n\t\t}\n\n\t\tif (bmp_type == BMPT_OS22) {\n\t\t\t/* \n\t\t\t * FIXME: different info in different documents\n\t\t\t * regarding this!\n\t\t\t */\n\t\t\t n_clr_elems = 3;\n\t\t}\n\n\t\tif (bmp_type == BMPT_OS21) {\n\t\t\tint16  iShort;\n\n\t\t\tread(fd, &iShort, 2);\n#ifdef WORDS_BIGENDIAN\n\t\t\tTIFFSwabShort((uint16*) &iShort);\n#endif\n\t\t\tinfo_hdr.iWidth = iShort;\n\t\t\tread(fd, &iShort, 2);\n#ifdef WORDS_BIGENDIAN\n\t\t\tTIFFSwabShort((uint16*) &iShort);\n#endif\n\t\t\tinfo_hdr.iHeight = iShort;\n\t\t\tread(fd, &iShort, 2);\n#ifdef WORDS_BIGENDIAN\n\t\t\tTIFFSwabShort((uint16*) &iShort);\n#endif\n\t\t\tinfo_hdr.iPlanes = iShort;\n\t\t\tread(fd, &iShort, 2);\n#ifdef WORDS_BIGENDIAN\n\t\t\tTIFFSwabShort((uint16*) &iShort);\n#endif\n\t\t\tinfo_hdr.iBitCount = iShort;\n\t\t\tinfo_hdr.iCompression = BMPC_RGB;\n\t\t\tn_clr_elems = 3;\n\t\t}\n\n\t\tif (info_hdr.iBitCount != 1  && info_hdr.iBitCount != 4  &&\n\t\t    info_hdr.iBitCount != 8  && info_hdr.iBitCount != 16 &&\n\t\t    info_hdr.iBitCount != 24 && info_hdr.iBitCount != 32) {\n\t\t    TIFFError(infilename,\n\t\t\t      \"Cannot process BMP file with bit count %d\",\n\t\t\t      info_hdr.iBitCount);\n\t\t    close(fd);\n\t\t    return 0;\n\t\t}\n\n\t\twidth = info_hdr.iWidth;\n\t\tlength = (info_hdr.iHeight > 0) ? info_hdr.iHeight : -info_hdr.iHeight;\n\n\t\tswitch (info_hdr.iBitCount)\n\t\t{\n\t\t\tcase 1:\n\t\t\tcase 4:\n\t\t\tcase 8:\n\t\t\t\tnbands = 1;\n\t\t\t\tdepth = info_hdr.iBitCount;\n\t\t\t\tphotometric = PHOTOMETRIC_PALETTE;\n\t\t\t\t/* Allocate memory for colour table and read it. */\n\t\t\t\tif (info_hdr.iClrUsed)\n\t\t\t\t    clr_tbl_size =\n\t\t\t\t\t    ((uint32)(1<<depth)<info_hdr.iClrUsed)\n\t\t\t\t\t    ? (uint32) (1 << depth)\n\t\t\t\t\t    : info_hdr.iClrUsed;\n\t\t\t\telse\n\t\t\t\t    clr_tbl_size = 1 << depth;\n\t\t\t\tclr_tbl = (unsigned char *)\n\t\t\t\t\t_TIFFmalloc(n_clr_elems * clr_tbl_size);\n\t\t\t\tif (!clr_tbl) {\n\t\t\t\t\tTIFFError(infilename,\n\t\t\t\t\t\"Can't allocate space for color table\");\n\t\t\t\t\tgoto bad;\n\t\t\t\t}\n\n\t\t\t\tlseek(fd, BFH_SIZE + info_hdr.iSize, SEEK_SET);\n\t\t\t\tread(fd, clr_tbl, n_clr_elems * clr_tbl_size);\n\n\t\t\t\tred_tbl = (unsigned short*)\n\t\t\t\t\t_TIFFmalloc(1<<depth * sizeof(unsigned short));\n\t\t\t\tif (!red_tbl) {\n\t\t\t\t\tTIFFError(infilename,\n\t\t\t\t\"Can't allocate space for red component table\");\n\t\t\t\t\t_TIFFfree(clr_tbl);\n\t\t\t\t\tgoto bad1;\n\t\t\t\t}\n\t\t\t\tgreen_tbl = (unsigned short*)\n\t\t\t\t\t_TIFFmalloc(1<<depth * sizeof(unsigned short));\n\t\t\t\tif (!green_tbl) {\n\t\t\t\t\tTIFFError(infilename,\n\t\t\t\t\"Can't allocate space for green component table\");\n\t\t\t\t\t_TIFFfree(clr_tbl);\n\t\t\t\t\tgoto bad2;\n\t\t\t\t}\n\t\t\t\tblue_tbl = (unsigned short*)\n\t\t\t\t\t_TIFFmalloc(1<<depth * sizeof(unsigned short));\n\t\t\t\tif (!blue_tbl) {\n\t\t\t\t\tTIFFError(infilename,\n\t\t\t\t\"Can't allocate space for blue component table\");\n\t\t\t\t\t_TIFFfree(clr_tbl);\n\t\t\t\t\tgoto bad3;\n\t\t\t\t}\n\n\t\t\t\tfor(clr = 0; clr < clr_tbl_size; clr++) {\n\t\t\t\t    red_tbl[clr] = 257*clr_tbl[clr*n_clr_elems+2];\n\t\t\t\t    green_tbl[clr] = 257*clr_tbl[clr*n_clr_elems+1];\n\t\t\t\t    blue_tbl[clr] = 257*clr_tbl[clr*n_clr_elems];\n\t\t\t\t}\n\n\t\t\t\t_TIFFfree(clr_tbl);\n\t\t\t\tbreak;\n\t\t\tcase 16:\n\t\t\tcase 24:\n\t\t\t\tnbands = 3;\n\t\t\t\tdepth = info_hdr.iBitCount / nbands;\n\t\t\t\tphotometric = PHOTOMETRIC_RGB;\n\t\t\t\tbreak;\n\t\t\tcase 32:\n\t\t\t\tnbands = 3;\n\t\t\t\tdepth = 8;\n\t\t\t\tphotometric = PHOTOMETRIC_RGB;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\n/* -------------------------------------------------------------------- */\n/*  Create output file.                                                 */\n/* -------------------------------------------------------------------- */\n\n\t\tTIFFSetField(out, TIFFTAG_IMAGEWIDTH, width);\n\t\tTIFFSetField(out, TIFFTAG_IMAGELENGTH, length);\n\t\tTIFFSetField(out, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);\n\t\tTIFFSetField(out, TIFFTAG_SAMPLESPERPIXEL, nbands);\n\t\tTIFFSetField(out, TIFFTAG_BITSPERSAMPLE, depth);\n\t\tTIFFSetField(out, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);\n\t\tTIFFSetField(out, TIFFTAG_PHOTOMETRIC, photometric);\n\t\tTIFFSetField(out, TIFFTAG_ROWSPERSTRIP,\n\t\t\t     TIFFDefaultStripSize(out, rowsperstrip));\n\t\t\n\t\tif (red_tbl && green_tbl && blue_tbl) {\n\t\t\tTIFFSetField(out, TIFFTAG_COLORMAP,\n\t\t\t\t     red_tbl, green_tbl, blue_tbl);\n\t\t}\n\t\t\n\t\tif (compression == (uint16) -1)\n\t\t\tcompression = COMPRESSION_PACKBITS;\n\t\tTIFFSetField(out, TIFFTAG_COMPRESSION, compression);\n\t\tswitch (compression) {\n\t\tcase COMPRESSION_JPEG:\n\t\t\tif (photometric == PHOTOMETRIC_RGB\n\t\t\t    && jpegcolormode == JPEGCOLORMODE_RGB)\n\t\t\t\tphotometric = PHOTOMETRIC_YCBCR;\n\t\t\tTIFFSetField(out, TIFFTAG_JPEGQUALITY, quality);\n\t\t\tTIFFSetField(out, TIFFTAG_JPEGCOLORMODE, jpegcolormode);\n\t\t\tbreak;\n\t\tcase COMPRESSION_LZW:\n\t\tcase COMPRESSION_DEFLATE:\n\t\t\tif (predictor != 0)\n\t\t\t\tTIFFSetField(out, TIFFTAG_PREDICTOR, predictor);\n\t\t\tbreak;\n\t\t}\n\n/* -------------------------------------------------------------------- */\n/*  Read uncompressed image data.                                       */\n/* -------------------------------------------------------------------- */\n\n\t\tif (info_hdr.iCompression == BMPC_RGB) {\n\t\t\tuint32 offset, size;\n\t\t\tchar *scanbuf;\n\n\t\t\t/* XXX: Avoid integer overflow. We can calculate size\n\t\t\t * in one step using\n\t\t\t *\n\t\t\t *  size = ((width * info_hdr.iBitCount + 31) & ~31) / 8\n\t\t\t *\n\t\t\t * formulae, but we should check for overflow\n\t\t\t * conditions during calculation.\n\t\t\t */\n\t\t\tsize = width * info_hdr.iBitCount + 31;\n\t\t\tif (!width || !info_hdr.iBitCount\n\t\t\t    || (size - 31) / info_hdr.iBitCount != width ) {\n\t\t\t\tTIFFError(infilename,\n\t\t\t\t\t  \"Wrong image parameters; can't \"\n\t\t\t\t\t  \"allocate space for scanline buffer\");\n\t\t\t\tgoto bad3;\n\t\t\t}\n\t\t\tsize = (size & ~31) / 8;\n\n\t\t\tscanbuf = (char *) _TIFFmalloc(size);\n\t\t\tif (!scanbuf) {\n\t\t\t\tTIFFError(infilename,\n\t\t\t\t\"Can't allocate space for scanline buffer\");\n\t\t\t\tgoto bad3;\n\t\t\t}\n\n\t\t\tfor (row = 0; row < length; row++) {\n\t\t\t\tif (info_hdr.iHeight > 0)\n\t\t\t\t\toffset = file_hdr.iOffBits+(length-row-1)*size;\n\t\t\t\telse\n\t\t\t\t\toffset = file_hdr.iOffBits + row * size;\n\t\t\t\tif (lseek(fd, offset, SEEK_SET) == (off_t)-1) {\n\t\t\t\t\tTIFFError(infilename,\n\t\t\t\t\t\t  \"scanline %lu: Seek error\",\n\t\t\t\t\t\t  (unsigned long) row);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tif (read(fd, scanbuf, size) < 0) {\n\t\t\t\t\tTIFFError(infilename,\n\t\t\t\t\t\t  \"scanline %lu: Read error\",\n\t\t\t\t\t\t  (unsigned long) row);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\trearrangePixels(scanbuf, width, info_hdr.iBitCount);\n\n\t\t\t\tif (TIFFWriteScanline(out, scanbuf, row, 0)<0) {\n\t\t\t\t\tTIFFError(infilename,\n\t\t\t\t\t\t  \"scanline %lu: Write error\",\n\t\t\t\t\t\t  (unsigned long) row);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t_TIFFfree(scanbuf);\n\n/* -------------------------------------------------------------------- */\n/*  Read compressed image data.                                         */\n/* -------------------------------------------------------------------- */\n\n\t\t} else if ( info_hdr.iCompression == BMPC_RLE8\n\t\t\t    || info_hdr.iCompression == BMPC_RLE4 ) {\n\t\t\tuint32\t\ti, j, k, runlength;\n\t\t\tuint32\t\tcompr_size, uncompr_size;\n\t\t\tunsigned char   *comprbuf;\n\t\t\tunsigned char   *uncomprbuf;\n\n\t\t\tcompr_size = file_hdr.iSize - file_hdr.iOffBits;\n\t\t\tuncompr_size = width * length;\n\t\t\tcomprbuf = (unsigned char *) _TIFFmalloc( compr_size );\n\t\t\tif (!comprbuf) {\n\t\t\t\tTIFFError(infilename,\n\t\t\t\"Can't allocate space for compressed scanline buffer\");\n\t\t\t\tgoto bad3;\n\t\t\t}\n\t\t\tuncomprbuf = (unsigned char *)_TIFFmalloc(uncompr_size);\n\t\t\tif (!uncomprbuf) {\n\t\t\t\tTIFFError(infilename,\n\t\t\t\"Can't allocate space for uncompressed scanline buffer\");\n\t\t\t\tgoto bad3;\n\t\t\t}\n\n\t\t\tlseek(fd, file_hdr.iOffBits, SEEK_SET);\n\t\t\tread(fd, comprbuf, compr_size);\n\t\t\ti = 0;\n\t\t\tj = 0;\n\t\t\tif (info_hdr.iBitCount == 8) {\t\t/* RLE8 */\n\t\t\t    while(j < uncompr_size && i < compr_size) {\n\t\t\t\tif ( comprbuf[i] ) {\n\t\t\t\t    runlength = comprbuf[i++];\n\t\t\t\t    while( runlength > 0\n\t\t\t\t\t   && j < uncompr_size\n\t\t\t\t\t   && i < compr_size ) {\n\t\t\t\t\tuncomprbuf[j++] = comprbuf[i];\n\t\t\t\t\trunlength--;\n\t\t\t\t    }\n\t\t\t\t    i++;\n\t\t\t\t} else {\n\t\t\t\t    i++;\n\t\t\t\t    if (comprbuf[i] == 0) /* Next scanline */\n\t\t\t\t\ti++;\n\t\t\t\t    else if (comprbuf[i] == 1) /* End of image */\n\t\t\t\t\tbreak;\n\t\t\t\t    else if (comprbuf[i] == 2) { /* Move to... */\n\t\t\t\t\ti++;\n\t\t\t\t\tif (i < compr_size - 1) {\n\t\t\t\t\t    j+=comprbuf[i]+comprbuf[i+1]*width;\n\t\t\t\t\t    i += 2;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t    break;\n\t\t\t\t    } else {            /* Absolute mode */\n\t\t\t\t\trunlength = comprbuf[i++];\n\t\t\t\t\tfor (k = 0; k < runlength && j < uncompr_size && i < compr_size; k++)\n\t\t\t\t\t    uncomprbuf[j++] = comprbuf[i++];\n\t\t\t\t\tif ( k & 0x01 )\n\t\t\t\t\t    i++;\n\t\t\t\t    }\n\t\t\t\t}\n\t\t\t    }\n\t\t\t}\n\t\t\telse {\t\t\t\t    /* RLE4 */\n\t\t\t    while( j < uncompr_size && i < compr_size ) {\n\t\t\t\tif ( comprbuf[i] ) {\n\t\t\t\t    runlength = comprbuf[i++];\n\t\t\t\t    while( runlength > 0 && j < uncompr_size && i < compr_size ) {\n\t\t\t\t\tif ( runlength & 0x01 )\n\t\t\t\t\t    uncomprbuf[j++] = (comprbuf[i] & 0xF0) >> 4;\n\t\t\t\t\telse\n\t\t\t\t\t    uncomprbuf[j++] = comprbuf[i] & 0x0F;\n\t\t\t\t\trunlength--;\n\t\t\t\t    }\n\t\t\t\t    i++;\n\t\t\t\t} else {\n\t\t\t\t    i++;\n\t\t\t\t    if (comprbuf[i] == 0) /* Next scanline */\n\t\t\t\t\ti++;\n\t\t\t\t    else if (comprbuf[i] == 1) /* End of image */\n\t\t\t\t\tbreak;\n\t\t\t\t    else if (comprbuf[i] == 2) { /* Move to... */\n\t\t\t\t\ti++;\n\t\t\t\t\tif (i < compr_size - 1) {\n\t\t\t\t\t    j+=comprbuf[i]+comprbuf[i+1]*width;\n\t\t\t\t\t    i += 2;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t    break;\n\t\t\t\t    } else {            /* Absolute mode */\n\t\t\t\t\trunlength = comprbuf[i++];\n\t\t\t\t\tfor (k = 0; k < runlength && j < uncompr_size && i < compr_size; k++) {\n\t\t\t\t\t    if (k & 0x01)\n\t\t\t\t\t\tuncomprbuf[j++] = comprbuf[i++] & 0x0F;\n\t\t\t\t\t    else\n\t\t\t\t\t\tuncomprbuf[j++] = (comprbuf[i] & 0xF0) >> 4;\n\t\t\t\t\t}\n\t\t\t\t\tif (k & 0x01)\n\t\t\t\t\t    i++;\n\t\t\t\t    }\n\t\t\t\t}\n\t\t\t    }\n\t\t\t}\n\n\t\t\t_TIFFfree(comprbuf);\n\n\t\t\tfor (row = 0; row < length; row++) {\n\t\t\t\tif (TIFFWriteScanline(out,\n\t\t\t\t\tuncomprbuf + (length - row - 1) * width,\n\t\t\t\t\trow, 0) < 0) {\n\t\t\t\t\tTIFFError(infilename,\n\t\t\t\t\t\t\"scanline %lu: Write error.\\n\",\n\t\t\t\t\t\t  (unsigned long) row);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t_TIFFfree(uncomprbuf);\n\t\t}\n\t\tTIFFWriteDirectory(out);\n\t\tif (blue_tbl) {\n\t\t  _TIFFfree(blue_tbl);\n\t\t  blue_tbl=NULL;\n\t\t}\n\t\tif (green_tbl) {\n\t\t  _TIFFfree(green_tbl);\n\t\t  green_tbl=NULL;\n\t\t}\n\t\tif (red_tbl) {\n\t\t  _TIFFfree(red_tbl);\n\t\t  red_tbl=NULL;\n\t\t}\n\t}\n\nbad3:\n\tif (blue_tbl)\n\t\t_TIFFfree(blue_tbl);\nbad2:\n\tif (green_tbl)\n\t\t_TIFFfree(green_tbl);\nbad1:\n\tif (red_tbl)\n\t\t_TIFFfree(red_tbl);\nbad:\n        close(fd);\n\n\tif (out)\n\t\tTIFFClose(out);\n        return 0;\n}\n\n/*\n * Image data in BMP file stored in BGR (or ABGR) format. We should rearrange\n * pixels to RGB (RGBA) format.\n */\nstatic void\nrearrangePixels(char *buf, uint32 width, uint32 bit_count)\n{\n\tchar tmp;\n\tuint32 i;\n\n        switch(bit_count) {\n\t\tcase 16:    /* FIXME: need a sample file */\n                        break;\n                case 24:\n\t\t\tfor (i = 0; i < width; i++, buf += 3) {\n\t\t\t\ttmp = *buf;\n\t\t\t\t*buf = *(buf + 2);\n\t\t\t\t*(buf + 2) = tmp;\n\t\t\t}\n                        break;\n                case 32:\n\t\t\t{\n\t\t\t\tchar\t*buf1 = buf;\n\n\t\t\t\tfor (i = 0; i < width; i++, buf += 4) {\n\t\t\t\t\ttmp = *buf;\n\t\t\t\t\t*buf1++ = *(buf + 2);\n\t\t\t\t\t*buf1++ = *(buf + 1);\n\t\t\t\t\t*buf1++ = tmp;\n\t\t\t\t}\n\t\t\t}\n                        break;\n                default:\n                        break;\n        }\n}\n\nstatic int\nprocessCompressOptions(char* opt)\n{\n\tif (strcmp(opt, \"none\") == 0)\n\t\tcompression = COMPRESSION_NONE;\n\telse if (strcmp(opt, \"packbits\") == 0)\n\t\tcompression = COMPRESSION_PACKBITS;\n\telse if (strncmp(opt, \"jpeg\", 4) == 0) {\n\t\tchar* cp = strchr(opt, ':');\n\n                compression = COMPRESSION_JPEG;\n                while( cp )\n                {\n                    if (isdigit((int)cp[1]))\n\t\t\tquality = atoi(cp+1);\n                    else if (cp[1] == 'r' )\n\t\t\tjpegcolormode = JPEGCOLORMODE_RAW;\n                    else\n                        usage();\n\n                    cp = strchr(cp+1,':');\n                }\n\t} else if (strncmp(opt, \"lzw\", 3) == 0) {\n\t\tchar* cp = strchr(opt, ':');\n\t\tif (cp)\n\t\t\tpredictor = atoi(cp+1);\n\t\tcompression = COMPRESSION_LZW;\n\t} else if (strncmp(opt, \"zip\", 3) == 0) {\n\t\tchar* cp = strchr(opt, ':');\n\t\tif (cp)\n\t\t\tpredictor = atoi(cp+1);\n\t\tcompression = COMPRESSION_DEFLATE;\n\t} else\n\t\treturn (0);\n\treturn (1);\n}\n\nstatic char* stuff[] = {\n\"bmp2tiff --- convert Windows BMP files to TIFF\",\n\"usage: bmp2tiff [options] input.bmp [input2.bmp ...] output.tif\",\n\"where options are:\",\n\" -r #\t\tmake each strip have no more than # rows\",\n\"\",\n\" -c lzw[:opts]\tcompress output with Lempel-Ziv & Welch encoding\",\n\" -c zip[:opts]\tcompress output with deflate encoding\",\n\" -c jpeg[:opts]compress output with JPEG encoding\",\n\" -c packbits\tcompress output with packbits encoding\",\n\" -c none\tuse no compression algorithm on output\",\n\"\",\n\"JPEG options:\",\n\" #\t\tset compression quality level (0-100, default 75)\",\n\" r\t\toutput color image as RGB rather than YCbCr\",\n\"For example, -c jpeg:r:50 to get JPEG-encoded RGB data with 50% comp. quality\",\n\"\",\n\"LZW and deflate options:\",\n\" #\t\tset predictor value\",\n\"For example, -c lzw:2 to get LZW-encoded data with horizontal differencing\",\n\" -o out.tif\twrite output to out.tif\",\n\" -h\t\tthis help message\",\nNULL\n};\n\nstatic void\nusage(void)\n{\n\tchar buf[BUFSIZ];\n\tint i;\n\n\tsetbuf(stderr, buf);\n        fprintf(stderr, \"%s\\n\\n\", TIFFGetVersion());\n\tfor (i = 0; stuff[i] != NULL; i++)\n\t\tfprintf(stderr, \"%s\\n\", stuff[i]);\n\texit(-1);\n}\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiff/tools/fax2ps.c",
    "content": "/* $Id: fax2ps.c,v 1.22 2006/04/20 12:36:23 dron Exp $\" */\n\n/*\n * Copyright (c) 1991-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n#include \"tif_config.h\"\n\n#include <stdlib.h>\n#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#include <time.h>\n\n#ifdef HAVE_UNISTD_H\n# include <unistd.h>\n#endif\n\n#ifdef HAVE_FCNTL_H\n# include <fcntl.h>\n#endif\n\n#ifdef HAVE_IO_H\n# include <io.h>\n#endif\n\n#include \"tiffio.h\"\n\nfloat\tdefxres = 204.;\t\t/* default x resolution (pixels/inch) */\nfloat\tdefyres = 98.;\t\t/* default y resolution (lines/inch) */\nconst float half = 0.5;\nconst float points = 72.0;\nfloat\tpageWidth = 0;\t\t/* image page width (inches) */\nfloat\tpageHeight = 0;\t\t/* image page length (inches) */\nint\tscaleToPage = 0;\t/* if true, scale raster to page dimensions */\nint\ttotalPages = 0;\t\t/* total # pages printed */\nint\trow;\t\t\t/* current output row */\nint\tmaxline = 512;\t\t/* max output line of PostScript */\n\n/*\n * Turn a bit-mapped scanline into the appropriate sequence\n * of PostScript characters to be rendered.\n *  \n * Original version written by Bret D. Whissel,\n * Florida State University Meteorology Department\n * March 13-15, 1995.\n */\nstatic void\nprintruns(unsigned char* buf, uint32* runs, uint32* erun, uint32 lastx)\n{\n    static struct {\n\tchar white, black;\n\tunsigned short width;\n    } WBarr[] = {\n\t{ 'd', 'n', 512 }, { 'e', 'o', 256 }, { 'f', 'p', 128 },\n\t{ 'g', 'q',  64 }, { 'h', 'r',  32 }, { 'i', 's',  16 },\n\t{ 'j', 't',   8 }, { 'k', 'u',   4 }, { 'l', 'v',   2 },\n\t{ 'm', 'w',   1 }\n    };\n    static char* svalue =\n\t\" !\\\"#$&'*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abc\";\n    int colormode = 1;\t\t/* 0 for white, 1 for black */\n    uint32 runlength = 0;\n    int n = maxline;\n    uint32 x = 0;\n    int l;\n\n    (void) buf;\n    printf(\"%d m(\", row++);\n    while (runs < erun) {\n\tif (runlength <= 0) {\n\t    colormode ^= 1;\n\t    runlength = *runs++;\n\t    if (x+runlength > lastx)\n\t\trunlength = runs[-1] = lastx-x;\n\t    x += runlength;\n\t    if (!colormode && runs == erun)\t\n\t\tbreak;\t\t/* don't bother printing the final white run */\n\t}\n\t/*\n\t * If a runlength is greater than 6 pixels, then spit out\n\t * black or white characters until the runlength drops to\n\t * 6 or less.  Once a runlength is <= 6, then combine black\n\t * and white runlengths until a 6-pixel pattern is obtained.\n\t * Then write out the special character.  Six-pixel patterns\n\t * were selected since 64 patterns is the largest power of\n\t * two less than the 92 \"easily printable\" PostScript\n\t * characters (i.e., no escape codes or octal chars).\n\t */\n\tl = 0;\n\twhile (runlength > 6) {\t/* Run is greater than six... */\n\t    if (runlength >= WBarr[l].width) {\n\t\tif (n == 0) {\n\t\t    putchar('\\n');\n\t\t    n = maxline;\n\t\t}\n\t\tputchar(colormode ? WBarr[l].black : WBarr[l].white), n--;\n\t\trunlength -= WBarr[l].width;\n\t    } else\n\t\tl++;\n\t}\n\twhile (runlength > 0 && runlength <= 6) {\n\t    uint32 bitsleft = 6;\n\t    int t = 0;\n\t    while (bitsleft) {\n\t\tif (runlength <= bitsleft) {\n\t\t    if (colormode)\n\t\t\tt |= ((1 << runlength)-1) << (bitsleft-runlength);\n\t\t    bitsleft -= runlength;\n\t\t    runlength = 0;\n\t\t    if (bitsleft) {\n\t\t\tif (runs >= erun)\n\t\t\t    break;\n\t\t\tcolormode ^= 1;\n\t\t\trunlength = *runs++;\n\t\t\tif (x+runlength > lastx)\n\t\t\t    runlength = runs[-1] = lastx-x;\n\t\t\tx += runlength;\n\t\t    }\n\t\t} else {\t\t/* runlength exceeds bits left */\n\t\t    if (colormode)\n\t\t\tt |= ((1 << bitsleft)-1);\n\t\t    runlength -= bitsleft;\n\t\t    bitsleft = 0;\n\t\t}\n\t    }\n\t    if (n == 0) {\n\t\tputchar('\\n');\n\t\tn = maxline;\n\t    }\n\t    putchar(svalue[t]), n--;\n\t}\n    }\n    printf(\")s\\n\");\n}\n\n/* \n * Create a special PostScript font for printing FAX documents.  By taking\n * advantage of the font-cacheing mechanism, a substantial speed-up in \n * rendering time is realized. \n */\nstatic void\nemitFont(FILE* fd)\n{\n    static const char* fontPrologue[] = {\n\t\"/newfont 10 dict def newfont begin /FontType 3 def /FontMatrix [1\",\n\t\"0 0 1 0 0] def /FontBBox [0 0 512 1] def /Encoding 256 array def\",\n\t\"0 1 31{Encoding exch /255 put}for 120 1 255{Encoding exch /255\",\n\t\"put}for Encoding 37 /255 put Encoding 40 /255 put Encoding 41 /255\",\n\t\"put Encoding 92 /255 put /count 0 def /ls{Encoding exch count 3\",\n\t\"string cvs cvn put /count count 1 add def}def 32 1 36{ls}for\",\n\t\"38 1 39{ls}for 42 1 91{ls}for 93 1 99{ls}for /count 100\",\n\t\"def 100 1 119{ls}for /CharDict 5 dict def CharDict begin /white\",\n\t\"{dup 255 eq{pop}{1 dict begin 100 sub neg 512 exch bitshift\",\n\t\"/cw exch def cw 0 0 0 cw 1 setcachedevice end}ifelse}def /black\",\n\t\"{dup 255 eq{pop}{1 dict begin 110 sub neg 512 exch bitshift\",\n\t\"/cw exch def cw 0 0 0 cw 1 setcachedevice 0 0 moveto cw 0 rlineto\",\n\t\"0 1 rlineto cw neg 0 rlineto closepath fill end}ifelse}def /numbuild\",\n\t\"{dup 255 eq{pop}{6 0 0 0 6 1 setcachedevice 0 1 5{0 moveto\",\n\t\"dup 32 and 32 eq{1 0 rlineto 0 1 rlineto -1 0 rlineto closepath\",\n\t\"fill newpath}if 1 bitshift}for pop}ifelse}def /.notdef {}\",\n\t\"def /255 {}def end /BuildChar{exch begin dup 110 ge{Encoding\",\n\t\"exch get 3 string cvs cvi CharDict /black get}{dup 100 ge {Encoding\",\n\t\"exch get 3 string cvs cvi CharDict /white get}{Encoding exch get\",\n\t\"3 string cvs cvi CharDict /numbuild get}ifelse}ifelse exec end\",\n\t\"}def end /Bitfont newfont definefont 1 scalefont setfont\",\n\tNULL\n    };\n    int i;\n    for (i = 0; fontPrologue[i] != NULL; i++)\n\tfprintf(fd, \"%s\\n\", fontPrologue[i]);\n}\n\nvoid\nprintTIF(TIFF* tif, uint16 pageNumber)\n{\n    uint32 w, h;\n    uint16 unit, compression;\n    float xres, yres, scale = 1.0;\n    tstrip_t s, ns;\n    time_t creation_time;\n\n    TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &h);\n    TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &w);\n    if (!TIFFGetField(tif, TIFFTAG_COMPRESSION, &compression)\n\t|| compression < COMPRESSION_CCITTRLE\n\t|| compression > COMPRESSION_CCITT_T6)\n\treturn;\n    if (!TIFFGetField(tif, TIFFTAG_XRESOLUTION, &xres) || !xres) {\n\tTIFFWarning(TIFFFileName(tif),\n\t    \"No x-resolution, assuming %g dpi\", defxres);\n\txres = defxres;\n    }\n    if (!TIFFGetField(tif, TIFFTAG_YRESOLUTION, &yres) || !yres) {\n\tTIFFWarning(TIFFFileName(tif),\n\t    \"No y-resolution, assuming %g lpi\", defyres);\n\tyres = defyres;\t\t\t\t\t/* XXX */\n    }\n    if (TIFFGetField(tif, TIFFTAG_RESOLUTIONUNIT, &unit) &&\n      unit == RESUNIT_CENTIMETER) {\n\txres *= 2.54F;\n\tyres *= 2.54F;\n    }\n    if (pageWidth == 0)\n\tpageWidth = w / xres;\n    if (pageHeight == 0)\n\tpageHeight = h / yres;\n\n    printf(\"%%!PS-Adobe-3.0\\n\");\n    printf(\"%%%%Creator: fax2ps\\n\");\n#ifdef notdef\n    printf(\"%%%%Title: %s\\n\", file);\n#endif\n    creation_time = time(0);\n    printf(\"%%%%CreationDate: %s\", ctime(&creation_time));\n    printf(\"%%%%Origin: 0 0\\n\");\n    printf(\"%%%%BoundingBox: 0 0 %u %u\\n\",\n\t(int)(pageWidth * points), (int)(pageHeight * points));\t/* XXX */\n    printf(\"%%%%Pages: (atend)\\n\");\n    printf(\"%%%%EndComments\\n\");\n    printf(\"%%%%BeginProlog\\n\");\n    emitFont(stdout);\n    printf(\"/d{bind def}def\\n\"); /* bind and def proc */\n    printf(\"/m{0 exch moveto}d\\n\");\n    printf(\"/s{show}d\\n\");\n    printf(\"/p{showpage}d \\n\");\t/* end page */\n    printf(\"%%%%EndProlog\\n\");\n    printf(\"%%%%Page: \\\"%u\\\" %u\\n\", pageNumber, pageNumber);\n    printf(\"/$pageTop save def gsave\\n\");\n    if (scaleToPage)\n        scale = pageHeight / (h/yres) < pageWidth / (w/xres) ?\n            pageHeight / (h/yres) : pageWidth / (w/xres);\n    printf(\"%g %g translate\\n\",\n           points * (pageWidth - scale*w/xres) * half,\n           points * (scale*h/yres + (pageHeight - scale*h/yres) * half));\n    printf(\"%g %g scale\\n\", points/xres*scale, -points/yres*scale);\n    printf(\"0 setgray\\n\");\n    TIFFSetField(tif, TIFFTAG_FAXFILLFUNC, printruns);\n    ns = TIFFNumberOfStrips(tif);\n    row = 0;\n    for (s = 0; s < ns; s++)\n\t(void) TIFFReadEncodedStrip(tif, s, (tdata_t) NULL, (tsize_t) -1);\n    printf(\"p\\n\");\n    printf(\"grestore $pageTop restore\\n\");\n    totalPages++;\n}\n\n#define\tGetPageNumber(tif) \\\nTIFFGetField(tif, TIFFTAG_PAGENUMBER, &pn, &ptotal)\n\nint\nfindPage(TIFF* tif, uint16 pageNumber)\n{\n    uint16 pn = (uint16) -1;\n    uint16 ptotal = (uint16) -1;\n    if (GetPageNumber(tif)) {\n\twhile (pn != pageNumber && TIFFReadDirectory(tif) && GetPageNumber(tif))\n\t    ;\n\treturn (pn == pageNumber);\n    } else\n\treturn (TIFFSetDirectory(tif, (tdir_t)(pageNumber-1)));\n}\n\nvoid\nfax2ps(TIFF* tif, uint16 npages, uint16* pages, char* filename)\n{\n    if (npages > 0) {\n\tuint16 pn, ptotal;\n\tint i;\n\n\tif (!GetPageNumber(tif))\n\t    fprintf(stderr, \"%s: No page numbers, counting directories.\\n\",\n\t\tfilename);\n\tfor (i = 0; i < npages; i++) {\n\t    if (findPage(tif, pages[i]))\n\t\tprintTIF(tif, pages[i]);\n\t    else\n\t\tfprintf(stderr, \"%s: No page number %d\\n\", filename, pages[i]);\n\t}\n    } else {\n\tuint16 pageNumber = 0;\n\tdo\n\t    printTIF(tif, pageNumber++);\n\twhile (TIFFReadDirectory(tif));\n    }\n}\n\n#undef GetPageNumber\n\nstatic int\npcompar(const void* va, const void* vb)\n{\n    const int* pa = (const int*) va;\n    const int* pb = (const int*) vb;\n    return (*pa - *pb);\n}\n\nstatic\tvoid usage(int code);\n\nint\nmain(int argc, char** argv)\n{\n    extern int optind;\n    extern char* optarg;\n    uint16 *pages = NULL, npages = 0, pageNumber;\n    int c, dowarnings = 0;\t\t/* if 1, enable library warnings */\n    TIFF* tif;\n\n    while ((c = getopt(argc, argv, \"l:p:x:y:W:H:wS\")) != -1)\n\tswitch (c) {\n\tcase 'H':\t\t/* page height */\n\t    pageHeight = (float)atof(optarg);\n\t    break;\n\tcase 'S':\t\t/* scale to page */\n\t    scaleToPage = 1;\n\t    break;\n\tcase 'W':\t\t/* page width */\n\t    pageWidth = (float)atof(optarg);\n\t    break;\n\tcase 'p':\t\t/* print specific page */\n\t    pageNumber = (uint16)atoi(optarg);\n\t    if (pages)\n\t\tpages = (uint16*) realloc(pages, (npages+1)*sizeof(uint16));\n\t    else\n\t\tpages = (uint16*) malloc(sizeof(uint16));\n\t    pages[npages++] = pageNumber;\n\t    break;\n\tcase 'w':\n\t    dowarnings = 1;\n\t    break;\n\tcase 'x':\n\t    defxres = (float)atof(optarg);\n\t    break;\n\tcase 'y':\n\t    defyres = (float)atof(optarg);\n\t    break;\n\tcase 'l':\n\t    maxline = atoi(optarg);\n\t    break;\n\tcase '?':\n\t    usage(-1);\n\t}\n    if (npages > 0)\n\tqsort(pages, npages, sizeof(uint16), pcompar);\n    if (!dowarnings)\n\tTIFFSetWarningHandler(0);\n    if (optind < argc) {\n\tdo {\n\t    tif = TIFFOpen(argv[optind], \"r\");\n\t    if (tif) {\n\t\tfax2ps(tif, npages, pages, argv[optind]);\n\t\tTIFFClose(tif);\n\t    } else\n\t\tfprintf(stderr, \"%s: Can not open, or not a TIFF file.\\n\",\n\t\t    argv[optind]);\n\t} while (++optind < argc);\n    } else {\n\tint n;\n\tFILE* fd;\n\tchar buf[16*1024];\n\n\tfd = tmpfile();\n\tif (fd == NULL) {\n\t    fprintf(stderr, \"Could not create temporary file, exiting.\\n\");\n\t    fclose(fd);\n\t    exit(-2);\n\t}\n#if defined(HAVE_SETMODE) && defined(O_BINARY)\n\tsetmode(fileno(stdin), O_BINARY);\n#endif\n\twhile ((n = read(fileno(stdin), buf, sizeof (buf))) > 0)\n\t    write(fileno(fd), buf, n);\n\tlseek(fileno(fd), 0, SEEK_SET);\n#if defined(_WIN32) && defined(USE_WIN32_FILEIO)\n\ttif = TIFFFdOpen(_get_osfhandle(fileno(fd)), \"temp\", \"r\");\n#else\n\ttif = TIFFFdOpen(fileno(fd), \"temp\", \"r\");\n#endif\n\tif (tif) {\n\t    fax2ps(tif, npages, pages, \"<stdin>\");\n\t    TIFFClose(tif);\n\t} else\n\t    fprintf(stderr, \"Can not open, or not a TIFF file.\\n\");\n\tfclose(fd);\n    }\n    printf(\"%%%%Trailer\\n\");\n    printf(\"%%%%Pages: %u\\n\", totalPages);\n    printf(\"%%%%EOF\\n\");\n\n    return (0);\n}\n\nchar* stuff[] = {\n\"usage: fax2ps [options] [input.tif ...]\",\n\"where options are:\",\n\" -w            suppress warning messages\",\n\" -l chars      set maximum output line length for generated PostScript\",\n\" -p page#      select page to print (can use multiple times)\",\n\" -x xres       set default horizontal resolution of input data (dpi)\",\n\" -y yres       set default vertical resolution of input data (lpi)\",\n\" -S            scale output to page size\",\n\" -W width      set output page width (inches), default is 8.5\",\n\" -H height     set output page height (inches), default is 11\",\nNULL\n};\n\nstatic void\nusage(int code)\n{\n\tchar buf[BUFSIZ];\n\tint i;\n\n\tsetbuf(stderr, buf);\n        fprintf(stderr, \"%s\\n\\n\", TIFFGetVersion());\n\tfor (i = 0; stuff[i] != NULL; i++)\n\t\tfprintf(stderr, \"%s\\n\", stuff[i]);\n\texit(code);\n}\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiff/tools/fax2tiff.c",
    "content": "/* $Id: fax2tiff.c,v 1.19 2006/04/20 12:36:23 dron Exp $ */\n\n/*\n * Copyright (c) 1990-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n/* \n * Convert a CCITT Group 3 or 4 FAX file to TIFF Group 3 or 4 format.\n */\n#include \"tif_config.h\"\n\n#include <stdio.h>\n#include <stdlib.h>\t\t/* should have atof & getopt */\n\n#ifdef HAVE_UNISTD_H\n# include <unistd.h>\n#endif\n\n#ifdef HAVE_FCNTL_H\n# include <fcntl.h>\n#endif\n\n#ifdef HAVE_IO_H\n# include <io.h>\n#endif\n\n#include \"tiffiop.h\"\n\n#ifndef EXIT_SUCCESS\n# define EXIT_SUCCESS\t0\n#endif\n#ifndef EXIT_FAILURE\n# define EXIT_FAILURE\t1\n#endif\n\n#define TIFFhowmany8(x) (((x)&0x07)?((uint32)(x)>>3)+1:(uint32)(x)>>3)\n\nTIFF\t*faxTIFF;\nchar\t*rowbuf;\nchar\t*refbuf;\n\nuint32\txsize = 1728;\nint\tverbose;\nint\tstretch;\nuint16\tbadfaxrun;\nuint32\tbadfaxlines;\n\nint\tcopyFaxFile(TIFF* tifin, TIFF* tifout);\nstatic\tvoid usage(void);\n\nint\nmain(int argc, char* argv[])\n{\n\tFILE *in;\n\tTIFF *out = NULL;\n\tTIFFErrorHandler whandler = NULL;\n\tint compression_in = COMPRESSION_CCITTFAX3;\n\tint compression_out = COMPRESSION_CCITTFAX3;\n\tint fillorder_in = FILLORDER_LSB2MSB;\n\tint fillorder_out = FILLORDER_LSB2MSB;\n\tuint32 group3options_in = 0;\t/* 1d-encoded */\n\tuint32 group3options_out = 0;\t/* 1d-encoded */\n\tuint32 group4options_in = 0;\t/* compressed */\n\tuint32 group4options_out = 0;\t/* compressed */\n\tuint32 defrowsperstrip = (uint32) 0;\n\tuint32 rowsperstrip;\n\tint photometric_in = PHOTOMETRIC_MINISWHITE;\n\tint photometric_out = PHOTOMETRIC_MINISWHITE;\n\tint mode = FAXMODE_CLASSF;\n\tint rows;\n\tint c;\n\tint pn, npages;\n\tfloat resY = 196.0;\n\textern int optind;\n\textern char* optarg;\n\n\n\twhile ((c = getopt(argc, argv, \"R:X:o:1234ABLMPUW5678abcflmprsuvwz?\")) != -1)\n\t\tswitch (c) {\n\t\t\t/* input-related options */\n\t\tcase '3':\t\t/* input is g3-encoded */\n\t\t\tcompression_in = COMPRESSION_CCITTFAX3;\n\t\t\tbreak;\n\t\tcase '4':\t\t/* input is g4-encoded */\n\t\t\tcompression_in = COMPRESSION_CCITTFAX4;\n\t\t\tbreak;\n\t\tcase 'U':\t\t/* input is uncompressed (g3 and g4) */\n\t\t\tgroup3options_in |= GROUP3OPT_UNCOMPRESSED;\n\t\t\tgroup4options_in |= GROUP4OPT_UNCOMPRESSED;\n\t\t\tbreak;\n\t\tcase '1':\t\t/* input is 1d-encoded (g3 only) */\n\t\t\tgroup3options_in &= ~GROUP3OPT_2DENCODING;\n\t\t\tbreak;\n\t\tcase '2':\t\t/* input is 2d-encoded (g3 only) */\n\t\t\tgroup3options_in |= GROUP3OPT_2DENCODING;\n\t\t\tbreak;\n\t\tcase 'P':\t/* input has not-aligned EOL (g3 only) */\n\t\t\tgroup3options_in &= ~GROUP3OPT_FILLBITS;\n\t\t\tbreak;\n\t\tcase 'A':\t\t/* input has aligned EOL (g3 only) */\n\t\t\tgroup3options_in |= GROUP3OPT_FILLBITS;\n\t\t\tbreak;\n\t\tcase 'W':\t\t/* input has 0 mean white */\n\t\t\tphotometric_in = PHOTOMETRIC_MINISWHITE;\n\t\t\tbreak;\n\t\tcase 'B':\t\t/* input has 0 mean black */\n\t\t\tphotometric_in = PHOTOMETRIC_MINISBLACK;\n\t\t\tbreak;\n\t\tcase 'L':\t\t/* input has lsb-to-msb fillorder */\n\t\t\tfillorder_in = FILLORDER_LSB2MSB;\n\t\t\tbreak;\n\t\tcase 'M':\t\t/* input has msb-to-lsb fillorder */\n\t\t\tfillorder_in = FILLORDER_MSB2LSB;\n\t\t\tbreak;\n\t\tcase 'R':\t\t/* input resolution */\n\t\t\tresY = (float) atof(optarg);\n\t\t\tbreak;\n\t\tcase 'X':\t\t/* input width */\n\t\t\txsize = (uint32) atoi(optarg);\n\t\t\tbreak;\n\n\t\t\t/* output-related options */\n\t\tcase '7':\t\t/* generate g3-encoded output */\n\t\t\tcompression_out = COMPRESSION_CCITTFAX3;\n\t\t\tbreak;\n\t\tcase '8':\t\t/* generate g4-encoded output */\n\t\t\tcompression_out = COMPRESSION_CCITTFAX4;\n\t\t\tbreak;\n\t\tcase 'u':\t/* generate uncompressed output (g3 and g4) */\n\t\t\tgroup3options_out |= GROUP3OPT_UNCOMPRESSED;\n\t\t\tgroup4options_out |= GROUP4OPT_UNCOMPRESSED;\n\t\t\tbreak;\n\t\tcase '5':\t/* generate 1d-encoded output (g3 only) */\n\t\t\tgroup3options_out &= ~GROUP3OPT_2DENCODING;\n\t\t\tbreak;\n\t\tcase '6':\t/* generate 2d-encoded output (g3 only) */\n\t\t\tgroup3options_out |= GROUP3OPT_2DENCODING;\n\t\t\tbreak;\n\t\tcase 'c':\t\t/* generate \"classic\" g3 format */\n\t\t\tmode = FAXMODE_CLASSIC;\n\t\t\tbreak;\n\t\tcase 'f':\t\t/* generate Class F format */\n\t\t\tmode = FAXMODE_CLASSF;\n\t\t\tbreak;\n\t\tcase 'm':\t\t/* output's fillorder is msb-to-lsb */\n\t\t\tfillorder_out = FILLORDER_MSB2LSB;\n\t\t\tbreak;\n\t\tcase 'l':\t\t/* output's fillorder is lsb-to-msb */\n\t\t\tfillorder_out = FILLORDER_LSB2MSB;\n\t\t\tbreak;\n\t\tcase 'o':\n\t\t\tout = TIFFOpen(optarg, \"w\");\n\t\t\tif (out == NULL) {\n\t\t\t\tfprintf(stderr,\n\t\t\t\t    \"%s: Can not create or open %s\\n\",\n\t\t\t\t    argv[0], optarg);\n\t\t\t\treturn EXIT_FAILURE;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 'a':\t/* generate EOL-aligned output (g3 only) */\n\t\t\tgroup3options_out |= GROUP3OPT_FILLBITS;\n\t\t\tbreak;\n\t\tcase 'p':\t/* generate not EOL-aligned output (g3 only) */\n\t\t\tgroup3options_out &= ~GROUP3OPT_FILLBITS;\n\t\t\tbreak;\n\t\tcase 'r':\t\t/* rows/strip */\n\t\t\tdefrowsperstrip = atol(optarg);\n\t\t\tbreak;\n\t\tcase 's':\t\t/* stretch image by dup'ng scanlines */\n\t\t\tstretch = 1;\n\t\t\tbreak;\n\t\tcase 'w':\t\t/* undocumented -- for testing */\n\t\t\tphotometric_out = PHOTOMETRIC_MINISWHITE;\n\t\t\tbreak;\n\t\tcase 'b':\t\t/* undocumented -- for testing */\n\t\t\tphotometric_out = PHOTOMETRIC_MINISBLACK;\n\t\t\tbreak;\n\t\tcase 'z':\t\t/* undocumented -- for testing */\n\t\t\tcompression_out = COMPRESSION_LZW;\n\t\t\tbreak;\n\t\tcase 'v':\t\t/* -v for info */\n\t\t\tverbose++;\n\t\t\tbreak;\n\t\tcase '?':\n\t\t\tusage();\n\t\t\t/*NOTREACHED*/\n\t\t}\n\tnpages = argc - optind;\n\tif (npages < 1)\n\t\tusage();\n\n\trowbuf = _TIFFmalloc(TIFFhowmany8(xsize));\n\trefbuf = _TIFFmalloc(TIFFhowmany8(xsize));\n\tif (rowbuf == NULL || refbuf == NULL) {\n\t\tfprintf(stderr, \"%s: Not enough memory\\n\", argv[0]);\n\t\treturn (EXIT_FAILURE);\n\t}\n\n\tif (out == NULL) {\n\t\tout = TIFFOpen(\"fax.tif\", \"w\");\n\t\tif (out == NULL) {\n\t\t\tfprintf(stderr, \"%s: Can not create fax.tif\\n\",\n\t\t\t    argv[0]);\n\t\t\treturn (EXIT_FAILURE);\n\t\t}\n\t}\n\t\t\n\tfaxTIFF = TIFFClientOpen(\"(FakeInput)\", \"w\",\n\t/* TIFFClientOpen() fails if we don't set existing value here */\n\t\t\t\t TIFFClientdata(out),\n\t\t\t\t TIFFGetReadProc(out), TIFFGetWriteProc(out),\n\t\t\t\t TIFFGetSeekProc(out), TIFFGetCloseProc(out),\n\t\t\t\t TIFFGetSizeProc(out), TIFFGetMapFileProc(out),\n\t\t\t\t TIFFGetUnmapFileProc(out));\n\tif (faxTIFF == NULL) {\n\t\tfprintf(stderr, \"%s: Can not create fake input file\\n\",\n\t\t    argv[0]);\n\t\treturn (EXIT_FAILURE);\n\t}\n\tTIFFSetMode(faxTIFF, O_RDONLY);\n\tTIFFSetField(faxTIFF, TIFFTAG_IMAGEWIDTH,\txsize);\n\tTIFFSetField(faxTIFF, TIFFTAG_SAMPLESPERPIXEL,\t1);\n\tTIFFSetField(faxTIFF, TIFFTAG_BITSPERSAMPLE,\t1);\n\tTIFFSetField(faxTIFF, TIFFTAG_FILLORDER,\tfillorder_in);\n\tTIFFSetField(faxTIFF, TIFFTAG_PLANARCONFIG,\tPLANARCONFIG_CONTIG);\n\tTIFFSetField(faxTIFF, TIFFTAG_PHOTOMETRIC,\tphotometric_in);\n\tTIFFSetField(faxTIFF, TIFFTAG_YRESOLUTION,\tresY);\n\tTIFFSetField(faxTIFF, TIFFTAG_RESOLUTIONUNIT,\tRESUNIT_INCH);\n\t\n\t/* NB: this must be done after directory info is setup */\n\tTIFFSetField(faxTIFF, TIFFTAG_COMPRESSION, compression_in);\n\tif (compression_in == COMPRESSION_CCITTFAX3)\n\t\tTIFFSetField(faxTIFF, TIFFTAG_GROUP3OPTIONS, group3options_in);\n\telse if (compression_in == COMPRESSION_CCITTFAX4)\n\t\tTIFFSetField(faxTIFF, TIFFTAG_GROUP4OPTIONS, group4options_in);\n\tfor (pn = 0; optind < argc; pn++, optind++) {\n\t\tin = fopen(argv[optind], \"rb\");\n\t\tif (in == NULL) {\n\t\t\tfprintf(stderr,\n\t\t\t    \"%s: %s: Can not open\\n\", argv[0], argv[optind]);\n\t\t\tcontinue;\n\t\t}\n#if defined(_WIN32) && defined(USE_WIN32_FILEIO)\n                TIFFSetClientdata(faxTIFF, (thandle_t)_get_osfhandle(fileno(in)));\n#else\n                TIFFSetClientdata(faxTIFF, (thandle_t)fileno(in));\n#endif\n\t\tTIFFSetFileName(faxTIFF, (const char*)argv[optind]);\n\t\tTIFFSetField(out, TIFFTAG_IMAGEWIDTH, xsize);\n\t\tTIFFSetField(out, TIFFTAG_BITSPERSAMPLE, 1);\n\t\tTIFFSetField(out, TIFFTAG_COMPRESSION, compression_out);\n\t\tTIFFSetField(out, TIFFTAG_PHOTOMETRIC, photometric_out);\n\t\tTIFFSetField(out, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);\n\t\tTIFFSetField(out, TIFFTAG_SAMPLESPERPIXEL, 1);\n\t\tswitch (compression_out) {\n\t\t\t/* g3 */\n\t\t\tcase COMPRESSION_CCITTFAX3:\n\t\t\tTIFFSetField(out, TIFFTAG_GROUP3OPTIONS,\n\t\t\t\t     group3options_out);\n\t\t\tTIFFSetField(out, TIFFTAG_FAXMODE, mode);\n\t\t\trowsperstrip =\n\t\t\t\t(defrowsperstrip)?defrowsperstrip:(uint32)-1L;\n\t\t\tbreak;\n\n\t\t\t/* g4 */\n\t\t\tcase COMPRESSION_CCITTFAX4:\n\t\t\tTIFFSetField(out, TIFFTAG_GROUP4OPTIONS,\n\t\t\t\t     group4options_out);\n\t\t\tTIFFSetField(out, TIFFTAG_FAXMODE, mode);\n\t\t\trowsperstrip =\n\t\t\t\t(defrowsperstrip)?defrowsperstrip:(uint32)-1L;\n\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\trowsperstrip = (defrowsperstrip) ?\n\t\t\t\tdefrowsperstrip : TIFFDefaultStripSize(out, 0);\n\t\t}\n\t\tTIFFSetField(out, TIFFTAG_ROWSPERSTRIP, rowsperstrip);\n\t\tTIFFSetField(out, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);\n\t\tTIFFSetField(out, TIFFTAG_FILLORDER, fillorder_out);\n\t\tTIFFSetField(out, TIFFTAG_SOFTWARE, \"fax2tiff\");\n\t\tTIFFSetField(out, TIFFTAG_XRESOLUTION, 204.0);\n\t\tif (!stretch) {\n\t\t\tTIFFGetField(faxTIFF, TIFFTAG_YRESOLUTION, &resY);\n\t\t\tTIFFSetField(out, TIFFTAG_YRESOLUTION, resY);\n\t\t} else\n\t\t\tTIFFSetField(out, TIFFTAG_YRESOLUTION, 196.);\n\t\tTIFFSetField(out, TIFFTAG_RESOLUTIONUNIT, RESUNIT_INCH);\n\t\tTIFFSetField(out, TIFFTAG_PAGENUMBER, pn, npages);\n\n\t\tif (!verbose)\n\t\t    whandler = TIFFSetWarningHandler(NULL);\n\t\trows = copyFaxFile(faxTIFF, out);\n\t\tfclose(in);\n\t\tif (!verbose)\n\t\t    (void) TIFFSetWarningHandler(whandler);\n\n\t\tTIFFSetField(out, TIFFTAG_IMAGELENGTH, rows);\n\n\t\tif (verbose) {\n\t\t\tfprintf(stderr, \"%s:\\n\", argv[optind]);\n\t\t\tfprintf(stderr, \"%d rows in input\\n\", rows);\n\t\t\tfprintf(stderr, \"%ld total bad rows\\n\",\n\t\t\t    (long) badfaxlines);\n\t\t\tfprintf(stderr, \"%d max consecutive bad rows\\n\", badfaxrun);\n\t\t}\n\t\tif (compression_out == COMPRESSION_CCITTFAX3 &&\n\t\t    mode == FAXMODE_CLASSF) {\n\t\t\tTIFFSetField(out, TIFFTAG_BADFAXLINES, badfaxlines);\n\t\t\tTIFFSetField(out, TIFFTAG_CLEANFAXDATA, badfaxlines ?\n\t\t\t    CLEANFAXDATA_REGENERATED : CLEANFAXDATA_CLEAN);\n\t\t\tTIFFSetField(out, TIFFTAG_CONSECUTIVEBADFAXLINES, badfaxrun);\n\t\t}\n\t\tTIFFWriteDirectory(out);\n\t}\n\tTIFFClose(out);\n\t_TIFFfree(rowbuf);\n\t_TIFFfree(refbuf);\n\treturn (EXIT_SUCCESS);\n}\n\nint\ncopyFaxFile(TIFF* tifin, TIFF* tifout)\n{\n\tuint32 row;\n\tuint32 linesize = TIFFhowmany8(xsize);\n\tuint16 badrun;\n\tint ok;\n\n\ttifin->tif_rawdatasize = TIFFGetFileSize(tifin);\n\ttifin->tif_rawdata = _TIFFmalloc(tifin->tif_rawdatasize);\n\tif (tifin->tif_rawdata == NULL) {\n\t\tTIFFError(tifin->tif_name, \"Not enough memory\");\n\t\treturn (0);\n\t}\n\tif (!ReadOK(tifin, tifin->tif_rawdata, tifin->tif_rawdatasize)) {\n\t\tTIFFError(tifin->tif_name, \"Read error at scanline 0\");\n\t\treturn (0);\n\t}\n\ttifin->tif_rawcp = tifin->tif_rawdata;\n\ttifin->tif_rawcc = tifin->tif_rawdatasize;\n\n\t(*tifin->tif_setupdecode)(tifin);\n\t(*tifin->tif_predecode)(tifin, (tsample_t) 0);\n\ttifin->tif_row = 0;\n\tbadfaxlines = 0;\n\tbadfaxrun = 0;\n\n\t_TIFFmemset(refbuf, 0, linesize);\n\trow = 0;\n\tbadrun = 0;\t\t/* current run of bad lines */\n\twhile (tifin->tif_rawcc > 0) {\n\t\tok = (*tifin->tif_decoderow)(tifin, (tdata_t) rowbuf, \n\t\t\t\t\t     linesize, 0);\n\t\tif (!ok) {\n\t\t\tbadfaxlines++;\n\t\t\tbadrun++;\n\t\t\t/* regenerate line from previous good line */\n\t\t\t_TIFFmemcpy(rowbuf, refbuf, linesize);\n\t\t} else {\n\t\t\tif (badrun > badfaxrun)\n\t\t\t\tbadfaxrun = badrun;\n\t\t\tbadrun = 0;\n\t\t\t_TIFFmemcpy(refbuf, rowbuf, linesize);\n\t\t}\n\t\ttifin->tif_row++;\n\n\t\tif (TIFFWriteScanline(tifout, rowbuf, row, 0) < 0) {\n\t\t\tfprintf(stderr, \"%s: Write error at row %ld.\\n\",\n\t\t\t    tifout->tif_name, (long) row);\n\t\t\tbreak;\n\t\t}\n\t\trow++;\n\t\tif (stretch) {\n\t\t\tif (TIFFWriteScanline(tifout, rowbuf, row, 0) < 0) {\n\t\t\t\tfprintf(stderr, \"%s: Write error at row %ld.\\n\",\n\t\t\t\t    tifout->tif_name, (long) row);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\trow++;\n\t\t}\n\t}\n\tif (badrun > badfaxrun)\n\t\tbadfaxrun = badrun;\n\t_TIFFfree(tifin->tif_rawdata);\n\treturn (row);\n}\n\nchar* stuff[] = {\n\"usage: fax2tiff [options] input.raw...\",\n\"where options are:\",\n\" -3\t\tinput data is G3-encoded\t\t[default]\",\n\" -4\t\tinput data is G4-encoded\",\n\" -U\t\tinput data is uncompressed (G3 or G4)\",\n\" -1\t\tinput data is 1D-encoded (G3 only)\t[default]\",\n\" -2\t\tinput data is 2D-encoded (G3 only)\",\n\" -P\t\tinput is not EOL-aligned (G3 only)\t[default]\",\n\" -A\t\tinput is EOL-aligned (G3 only)\",\n\" -M\t\tinput data has MSB2LSB bit order\",\n\" -L\t\tinput data has LSB2MSB bit order\t[default]\",\n\" -B\t\tinput data has min 0 means black\",\n\" -W\t\tinput data has min 0 means white\t[default]\",\n\" -R #\t\tinput data has # resolution (lines/inch) [default is 196]\",\n\" -X #\t\tinput data has # width\t\t\t[default is 1728]\",\n\"\",\n\" -o out.tif\twrite output to out.tif\",\n\" -7\t\tgenerate G3-encoded output\t\t[default]\",\n\" -8\t\tgenerate G4-encoded output\",\n\" -u\t\tgenerate uncompressed output (G3 or G4)\",\n\" -5\t\tgenerate 1D-encoded output (G3 only)\",\n\" -6\t\tgenerate 2D-encoded output (G3 only)\t[default]\",\n\" -p\t\tgenerate not EOL-aligned output (G3 only)\",\n\" -a\t\tgenerate EOL-aligned output (G3 only)\t[default]\",\n\" -c\t\tgenerate \\\"classic\\\" TIFF format\",\n\" -f\t\tgenerate TIFF Class F (TIFF/F) format\t[default]\",\n\" -m\t\toutput fill order is MSB2LSB\",\n\" -l\t\toutput fill order is LSB2MSB\t\t[default]\",\n\" -r #\t\tmake each strip have no more than # rows\",\n\" -s\t\tstretch image by duplicating scanlines\",\n\" -v\t\tprint information about conversion work\",\n\" -z\t\tgenerate LZW compressed output\",\nNULL\n};\n\nstatic void\nusage(void)\n{\n\tchar buf[BUFSIZ];\n\tint i;\n\n\tsetbuf(stderr, buf);\n        fprintf(stderr, \"%s\\n\\n\", TIFFGetVersion());\n\tfor (i = 0; stuff[i] != NULL; i++)\n\t\tfprintf(stderr, \"%s\\n\", stuff[i]);\n\texit(EXIT_FAILURE);\n}\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiff/tools/gif2tiff.c",
    "content": "/* $Id: gif2tiff.c,v 1.8 2004/09/02 14:36:33 dron Exp $ */\n\n/*\n * Copyright (c) 1990-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n/*\n *\tconvert a GIF file into a TIFF file.\n *\tbased on Paul Haeberli's fromgif program which in turn is\n *\tbased on a GIF file reader by Marcel J.E. Mol March 23 1989 \n *\n *\tif input is 320 by 200 pixel aspect is probably 1.2\n *\tif input is 640 350 pixel aspect is probably 1.37\n *\n */\n#include \"tif_config.h\"\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n\n#ifdef HAVE_UNISTD_H\n# include <unistd.h>\n#endif\n\n#include \"tiffio.h\"\n\n#define\tGIFGAMMA\t(1.5)\t\t/* smaller makes output img brighter */\n#define\tIMAX\t\t0xffff\t\t/* max intensity value */\n#define EXTRAFUDGE\t128\t\t/* some people write BAD .gif files */\n\n#define\tstreq(a,b)\t(strcmp(a,b) == 0)\n#define\tstrneq(a,b,n)\t(strncmp(a,b,n) == 0)\n\nunsigned short gamtab[256];\n\nvoid\nmakegamtab(float gam)\n{\n    int i;\n\n    for(i=0; i<256; i++) \n\tgamtab[i] = (unsigned short) (IMAX*pow(i/255.0,gam)+0.5);\n}\n\nchar* stuff[] = {\n\"usage: gif2tiff [options] input.gif output.tif\",\n\"where options are:\",\n\" -r #\t\tmake each strip have no more than # rows\",\n\"\",\n\" -c lzw[:opts]\tcompress output with Lempel-Ziv & Welch encoding\",\n\" -c zip[:opts]\tcompress output with deflate encoding\",\n\" -c packbits\tcompress output with packbits encoding\",\n\" -c none\tuse no compression algorithm on output\",\n\"\",\n\"LZW and deflate options:\",\n\" #\t\tset predictor value\",\n\"For example, -c lzw:2 to get LZW-encoded data with horizontal differencing\",\nNULL\n};\n\nstatic void\nusage(void)\n{\n\tchar buf[BUFSIZ];\n\tint i;\n\n\tsetbuf(stderr, buf);\n        fprintf(stderr, \"%s\\n\\n\", TIFFGetVersion());\n\tfor (i = 0; stuff[i] != NULL; i++)\n\t\tfprintf(stderr, \"%s\\n\", stuff[i]);\n\texit(-1);\n}\n\n#define COLSIZE 256\n\nunsigned char *stackp;\nunsigned int prefix[4096];\nunsigned char suffix[4096];\nunsigned char stack[4096];\nint datasize,codesize,codemask;     /* Decoder working variables */\nint clear,eoi;                      /* Special code values */\nint avail, oldcode;\n\nFILE *infile;\nint global;                        /* Is there a global color map? */\nint globalbits;                     /* Number of bits of global colors */\nunsigned char globalmap[COLSIZE][3];/* RGB values for global color map */\nunsigned char *raster;              /* Decoded image data */\nunsigned long width, height;\nunsigned short red[COLSIZE];\nunsigned short green[COLSIZE];\nunsigned short blue[COLSIZE];\nchar *filename, *imagename;\n\nstatic\tuint16 compression = COMPRESSION_PACKBITS;\nstatic\tuint16 predictor = 0;\nstatic\tuint32 rowsperstrip = (uint32) -1;\nstatic\tint processCompressOptions(char*);\n\nint\tconvert(void);\nint\tchecksignature(void);\nvoid\treadscreen(void);\nint\treadgifimage(char*);\nvoid\treadextension(void);\nint\treadraster(void);\nint\tprocess(int, unsigned char**);\nvoid\tinitcolors(unsigned char [COLSIZE][3], int);\nvoid\trasterize(int, char*);\n\nint\nmain(int argc, char* argv[])\n{\n    extern int optind;\n    extern char *optarg;\n    int c, status;\n\n    while ((c = getopt(argc, argv, \"c:r:\")) != -1)\n\t    switch (c) {\n\t    case 'c':\t\t/* compression scheme */\n\t\t    if (!processCompressOptions(optarg))\n\t\t\t    usage();\n\t\t    break;\n\t    case 'r':\t\t/* rows/strip */\n\t\t    rowsperstrip = atoi(optarg);\n\t\t    break;\n\t    case '?':\n\t\t    usage();\n\t\t    /*NOTREACHED*/\n\t    }\n    if (argc - optind != 2)\n\t    usage();\n\n    makegamtab(GIFGAMMA);\n    filename = argv[optind];\n    imagename = argv[optind+1];\n    if ((infile = fopen(imagename, \"rb\")) != NULL) {\n\tint c;\n\tfclose(infile);\n\tprintf(\"overwrite %s? \", imagename); fflush(stdout);\n\tc = getc(stdin);\n\tif (c != 'y' && c != 'Y')\n\t    return (1);\n    }\n    if ((infile = fopen(filename, \"rb\")) == NULL) {\n\tperror(filename);\n\treturn (1);\n    }\n    status = convert();\n    fclose(infile);\n    return (status);\n}\n\nstatic int\nprocessCompressOptions(char* opt)\n{\n\tif (streq(opt, \"none\"))\n\t\tcompression = COMPRESSION_NONE;\n\telse if (streq(opt, \"packbits\"))\n\t\tcompression = COMPRESSION_PACKBITS;\n\telse if (strneq(opt, \"lzw\", 3)) {\n\t\tchar* cp = strchr(opt, ':');\n\t\tif (cp)\n\t\t\tpredictor = atoi(cp+1);\n\t\tcompression = COMPRESSION_LZW;\n\t} else if (strneq(opt, \"zip\", 3)) {\n\t\tchar* cp = strchr(opt, ':');\n\t\tif (cp)\n\t\t\tpredictor = atoi(cp+1);\n\t\tcompression = COMPRESSION_DEFLATE;\n\t} else\n\t\treturn (0);\n\treturn (1);\n}\n\nint\nconvert(void)\n{\n    int ch;\n    char* mode = \"w\";\n\n    if (!checksignature())\n        return (-1);\n    readscreen();\n    while ((ch = getc(infile)) != ';' && ch != EOF) {\n        switch (ch) {\n            case '\\0':  break;  /* this kludge for non-standard files */\n            case ',':   if (!readgifimage(mode))\n                           return (-1);\n\t\t\tmode = \"a\";\t\t/* subsequent images append */\n                        break;\n            case '!':   readextension();\n                        break;\n            default:    fprintf(stderr, \"illegal GIF block type\\n\");\n                        return (-1);\n        }\n    }\n    return (0);\n}\n\nint\nchecksignature(void)\n{\n    char buf[6];\n\n    fread(buf,1,6,infile);\n    if (strncmp(buf,\"GIF\",3)) {\n        fprintf(stderr, \"file is not a GIF file\\n\");\n        return 0;\n    }\n    if (strncmp(&buf[3],\"87a\",3)) {\n        fprintf(stderr, \"unknown GIF version number\\n\");\n        return 0;\n    }\n    return 1;\n}\n\n/*\n * \treadscreen - \n *\t\tGet information which is global to all the images stored \n *\tin the file\n */\nvoid\nreadscreen(void)\n{\n    unsigned char buf[7];\n\n    fread(buf,1,7,infile);\n    global = buf[4] & 0x80;\n    if (global) {\n        globalbits = (buf[4] & 0x07) + 1;\n        fread(globalmap,3,1<<globalbits,infile);\n    }\n}\n\nint\nreadgifimage(char* mode)\n{\n    unsigned char buf[9];\n    int local, interleaved;\n    unsigned char localmap[256][3];\n    int localbits;\n    int status;\n\n    if (fread(buf, 1, 9, infile) == 0) {\n        perror(filename);\n\treturn (0);\n    }\n    width = buf[4] + (buf[5] << 8);\n    height = buf[6] + (buf[7] << 8);\n    local = buf[8] & 0x80;\n    interleaved = buf[8] & 0x40;\n\n    if (local == 0 && global == 0) {\n        fprintf(stderr, \"no colormap present for image\\n\");\n        return (0);\n    }\n    if ((raster = (unsigned char*) _TIFFmalloc(width*height+EXTRAFUDGE)) == NULL) {\n        fprintf(stderr, \"not enough memory for image\\n\");\n        return (0);\n    }\n    if (local) {\n        localbits = (buf[8] & 0x7) + 1;\n\n        fprintf(stderr, \"   local colors: %d\\n\", 1<<localbits);\n\n        fread(localmap, 3, 1<<localbits, infile);\n        initcolors(localmap, 1<<localbits);\n    } else if (global) {\n        initcolors(globalmap, 1<<globalbits);\n    }\n    if ((status = readraster()))\n\trasterize(interleaved, mode);\n    _TIFFfree(raster);\n    return status;\n}\n\n/*\n * \treadextension -\n *\t\tRead a GIF extension block (and do nothing with it).\n *\n */\nvoid\nreadextension(void)\n{\n    int count;\n    char buf[255];\n\n    (void) getc(infile);\n    while ((count = getc(infile)))\n        fread(buf, 1, count, infile);\n}\n\n/*\n * \treadraster -\n *\t\tDecode a raster image\n *\n */\nint\nreadraster(void)\n{\n    unsigned char *fill = raster;\n    unsigned char buf[255];\n    register int bits=0;\n    register unsigned long datum=0;\n    register unsigned char *ch;\n    register int count, code;\n    int status = 1;\n\n    datasize = getc(infile);\n    clear = 1 << datasize;\n    eoi = clear + 1;\n    avail = clear + 2;\n    oldcode = -1;\n    codesize = datasize + 1;\n    codemask = (1 << codesize) - 1;\n    for (code = 0; code < clear; code++) {\n\tprefix[code] = 0;\n\tsuffix[code] = code;\n    }\n    stackp = stack;\n    for (count = getc(infile); count > 0; count = getc(infile)) {\n\tfread(buf,1,count,infile);\n\tfor (ch=buf; count-- > 0; ch++) {\n\t    datum += (unsigned long) *ch << bits;\n\t    bits += 8;\n\t    while (bits >= codesize) {\n\t\tcode = datum & codemask;\n\t\tdatum >>= codesize;\n\t\tbits -= codesize;\n\t\tif (code == eoi) {               /* This kludge put in */\n\t\t    goto exitloop;               /* because some GIF files*/\n\t\t}                                /* aren't standard */\n\t\tif (!process(code, &fill)) {\n\t\t    status = 0;\n\t\t    goto exitloop;\n\t\t}\n\t    }\n\t}\n\tif (fill >= raster + width*height) {\n\t    fprintf(stderr, \"raster full before eoi code\\n\");\n\t    break;\n\t}\n    }\nexitloop:\n    if (fill != raster + width*height)  {\n\tfprintf(stderr, \"warning: wrong rastersize: %ld bytes\\n\",\n\t\t\t\t\t\t      (long) (fill-raster));\n\tfprintf(stderr, \"         instead of %ld bytes\\n\",\n\t\t\t\t\t\t      (long) width*height);\n    }\n    return status;\n}\n\n/*\n * \tprocess - \n *\t\tProcess a compression code.  \"clear\" resets the code table.  \n *\tOtherwise make a new code table entry, and output the bytes \n *\tassociated with the code.\n */\nint\nprocess(register int code, unsigned char** fill)\n{\n    int incode;\n    static unsigned char firstchar;\n\n    if (code == clear) {\n\tcodesize = datasize + 1;\n\tcodemask = (1 << codesize) - 1;\n\tavail = clear + 2;\n\toldcode = -1;\n\treturn 1;\n    }\n\n    if (oldcode == -1) {\n\t*(*fill)++ = suffix[code];\n\tfirstchar = oldcode = code;\n\treturn 1;\n    }\n    if (code > avail) {\n\tfprintf(stderr, \"code %d too large for %d\\n\", code, avail);\n\treturn 0; \n    }\n\n    incode = code;\n    if (code == avail) {      /* the first code is always < avail */\n\t*stackp++ = firstchar;\n\tcode = oldcode;\n    }\n    while (code > clear) {\n\t*stackp++ = suffix[code];\n\tcode = prefix[code];\n    }\n\n    *stackp++ = firstchar = suffix[code];\n    prefix[avail] = oldcode;\n    suffix[avail] = firstchar;\n    avail++;\n\n    if (((avail & codemask) == 0) && (avail < 4096)) {\n\tcodesize++;\n\tcodemask += avail;\n    }\n    oldcode = incode;\n    do {\n\t*(*fill)++ = *--stackp;\n    } while (stackp > stack);\n    return 1;\n}\n\n/*\n * \tinitcolors -\n *\t\tConvert a color map (local or global) to arrays with R, G and B\n * \tvalues. \n *\n */\nvoid\ninitcolors(unsigned char colormap[COLSIZE][3], int ncolors)\n{\n    register int i;\n\n    for (i = 0; i < ncolors; i++) {\n        red[i]   = gamtab[colormap[i][0]];\n        green[i] = gamtab[colormap[i][1]];\n        blue[i]  = gamtab[colormap[i][2]];\n    }\n}\n\nvoid\nrasterize(int interleaved, char* mode)\n{\n    register unsigned long row;\n    unsigned char *newras;\n    unsigned char *ras;\n    TIFF *tif;\n    tstrip_t strip;\n    tsize_t stripsize;\n\n    if ((newras = (unsigned char*) _TIFFmalloc(width*height+EXTRAFUDGE)) == NULL) {\n        fprintf(stderr, \"not enough memory for image\\n\");\n        return;\n    }\n#define DRAWSEGMENT(offset, step) {\t\t\t\\\n        for (row = offset; row < height; row += step) {\t\\\n            _TIFFmemcpy(newras + row*width, ras, width);\\\n            ras += width;                            \t\\\n        }\t\t\t\t\t\t\\\n    }\n    ras = raster;\n    if (interleaved) {\n        DRAWSEGMENT(0, 8);\n        DRAWSEGMENT(4, 8);\n        DRAWSEGMENT(2, 4);\n        DRAWSEGMENT(1, 2);\n    } else \n        DRAWSEGMENT(0, 1);\n#undef DRAWSEGMENT\n\n    tif = TIFFOpen(imagename, mode);\n    if (!tif) {\n\tTIFFError(imagename,\"Can not open output image\");\n\texit(-1);\n    }\n    TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, (uint32) width);\n    TIFFSetField(tif, TIFFTAG_IMAGELENGTH, (uint32) height);\n    TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_PALETTE);\n    TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);\n    TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 1);\n    TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 8);\n    TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, \n\trowsperstrip = TIFFDefaultStripSize(tif, rowsperstrip));\n    TIFFSetField(tif, TIFFTAG_COMPRESSION, compression);\n    switch (compression) {\n    case COMPRESSION_LZW:\n    case COMPRESSION_DEFLATE:\n\t    if (predictor != 0)\n\t\t    TIFFSetField(tif, TIFFTAG_PREDICTOR, predictor);\n\t    break;\n    }\n    TIFFSetField(tif, TIFFTAG_COLORMAP, red, green, blue);\n    TIFFSetField(tif, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);\n    strip = 0;\n    stripsize = TIFFStripSize(tif);\n    for (row=0; row<height; row += rowsperstrip) {\n\tif (TIFFWriteEncodedStrip(tif, strip, newras+row*width, stripsize) < 0)\n\t    break;\n\tstrip++;\n    }\n    TIFFClose(tif);\n\n    _TIFFfree(newras);\n}\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiff/tools/pal2rgb.c",
    "content": "/* $Id: pal2rgb.c,v 1.10 2006/01/11 17:03:43 fwarmerdam Exp $ */\n\n/*\n * Copyright (c) 1988-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n#include \"tif_config.h\"\n\n#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n#include <ctype.h>\n\n#ifdef HAVE_UNISTD_H\n# include <unistd.h>\n#endif\n\n#include \"tiffio.h\"\n\n#define\tstreq(a,b)\t(strcmp(a,b) == 0)\n#define\tstrneq(a,b,n)\t(strncmp(a,b,n) == 0)\n\nstatic\tvoid usage(void);\nstatic\tvoid cpTags(TIFF* in, TIFF* out);\n\nstatic int\ncheckcmap(int n, uint16* r, uint16* g, uint16* b)\n{\n\twhile (n-- > 0)\n\t    if (*r++ >= 256 || *g++ >= 256 || *b++ >= 256)\n\t\treturn (16);\n\tfprintf(stderr, \"Warning, assuming 8-bit colormap.\\n\");\n\treturn (8);\n}\n\n#define\tCopyField(tag, v) \\\n    if (TIFFGetField(in, tag, &v)) TIFFSetField(out, tag, v)\n#define\tCopyField3(tag, v1, v2, v3) \\\n    if (TIFFGetField(in, tag, &v1, &v2, &v3)) TIFFSetField(out, tag, v1, v2, v3)\n\nstatic\tuint16 compression = (uint16) -1;\nstatic\tuint16 predictor = 0;\nstatic\tint quality = 75;\t/* JPEG quality */\nstatic\tint jpegcolormode = JPEGCOLORMODE_RGB;\nstatic\tint processCompressOptions(char*);\n\nint\nmain(int argc, char* argv[])\n{\n\tuint16 bitspersample, shortv;\n\tuint32 imagewidth, imagelength;\n\tuint16 config = PLANARCONFIG_CONTIG;\n\tuint32 rowsperstrip = (uint32) -1;\n\tuint16 photometric = PHOTOMETRIC_RGB;\n\tuint16 *rmap, *gmap, *bmap;\n\tuint32 row;\n\tint cmap = -1;\n\tTIFF *in, *out;\n\tint c;\n\textern int optind;\n\textern char* optarg;\n\n\twhile ((c = getopt(argc, argv, \"C:c:p:r:\")) != -1)\n\t\tswitch (c) {\n\t\tcase 'C':\t\t/* force colormap interpretation */\n\t\t\tcmap = atoi(optarg);\n\t\t\tbreak;\n\t\tcase 'c':\t\t/* compression scheme */\n\t\t\tif (!processCompressOptions(optarg))\n\t\t\t\tusage();\n\t\t\tbreak;\n\t\tcase 'p':\t\t/* planar configuration */\n\t\t\tif (streq(optarg, \"separate\"))\n\t\t\t\tconfig = PLANARCONFIG_SEPARATE;\n\t\t\telse if (streq(optarg, \"contig\"))\n\t\t\t\tconfig = PLANARCONFIG_CONTIG;\n\t\t\telse\n\t\t\t\tusage();\n\t\t\tbreak;\n\t\tcase 'r':\t\t/* rows/strip */\n\t\t\trowsperstrip = atoi(optarg);\n\t\t\tbreak;\n\t\tcase '?':\n\t\t\tusage();\n\t\t\t/*NOTREACHED*/\n\t\t}\n\tif (argc - optind != 2)\n\t\tusage();\n\tin = TIFFOpen(argv[optind], \"r\");\n\tif (in == NULL)\n\t\treturn (-1);\n\tif (!TIFFGetField(in, TIFFTAG_PHOTOMETRIC, &shortv) ||\n\t    shortv != PHOTOMETRIC_PALETTE) {\n\t\tfprintf(stderr, \"%s: Expecting a palette image.\\n\",\n\t\t    argv[optind]);\n\t\treturn (-1);\n\t}\n\tif (!TIFFGetField(in, TIFFTAG_COLORMAP, &rmap, &gmap, &bmap)) {\n\t\tfprintf(stderr,\n\t\t    \"%s: No colormap (not a valid palette image).\\n\",\n\t\t    argv[optind]);\n\t\treturn (-1);\n\t}\n\tbitspersample = 0;\n\tTIFFGetField(in, TIFFTAG_BITSPERSAMPLE, &bitspersample);\n\tif (bitspersample != 8) {\n\t\tfprintf(stderr, \"%s: Sorry, can only handle 8-bit images.\\n\",\n\t\t    argv[optind]);\n\t\treturn (-1);\n\t}\n\tout = TIFFOpen(argv[optind+1], \"w\");\n\tif (out == NULL)\n\t\treturn (-2);\n\tcpTags(in, out);\n\tTIFFGetField(in, TIFFTAG_IMAGEWIDTH, &imagewidth);\n\tTIFFGetField(in, TIFFTAG_IMAGELENGTH, &imagelength);\n\tif (compression != (uint16)-1)\n\t\tTIFFSetField(out, TIFFTAG_COMPRESSION, compression);\n\telse\n\t\tTIFFGetField(in, TIFFTAG_COMPRESSION, &compression);\n\tswitch (compression) {\n\tcase COMPRESSION_JPEG:\n\t\tif (jpegcolormode == JPEGCOLORMODE_RGB)\n\t\t\tphotometric = PHOTOMETRIC_YCBCR;\n\t\telse\n\t\t\tphotometric = PHOTOMETRIC_RGB;\n\t\tTIFFSetField(out, TIFFTAG_JPEGQUALITY, quality);\n\t\tTIFFSetField(out, TIFFTAG_JPEGCOLORMODE, jpegcolormode);\n\t\tbreak;\n\tcase COMPRESSION_LZW:\n\tcase COMPRESSION_DEFLATE:\n\t\tif (predictor != 0)\n\t\t\tTIFFSetField(out, TIFFTAG_PREDICTOR, predictor);\n\t\tbreak;\n\t}\n\tTIFFSetField(out, TIFFTAG_PHOTOMETRIC, photometric);\n\tTIFFSetField(out, TIFFTAG_SAMPLESPERPIXEL, 3);\n\tTIFFSetField(out, TIFFTAG_PLANARCONFIG, config);\n\tTIFFSetField(out, TIFFTAG_ROWSPERSTRIP,\n\t    rowsperstrip = TIFFDefaultStripSize(out, rowsperstrip));\n\t(void) TIFFGetField(in, TIFFTAG_PLANARCONFIG, &shortv);\n\tif (cmap == -1)\n\t\tcmap = checkcmap(1<<bitspersample, rmap, gmap, bmap);\n\tif (cmap == 16) {\n\t\t/*\n\t\t * Convert 16-bit colormap to 8-bit.\n\t\t */\n\t\tint i;\n\n\t\tfor (i = (1<<bitspersample)-1; i >= 0; i--) {\n#define\tCVT(x)\t\t(((x) * 255) / ((1L<<16)-1))\n\t\t\trmap[i] = CVT(rmap[i]);\n\t\t\tgmap[i] = CVT(gmap[i]);\n\t\t\tbmap[i] = CVT(bmap[i]);\n\t\t}\n\t}\n\t{ unsigned char *ibuf, *obuf;\n\t  register unsigned char* pp;\n\t  register uint32 x;\n\t  ibuf = (unsigned char*)_TIFFmalloc(TIFFScanlineSize(in));\n\t  obuf = (unsigned char*)_TIFFmalloc(TIFFScanlineSize(out));\n\t  switch (config) {\n\t  case PLANARCONFIG_CONTIG:\n\t\tfor (row = 0; row < imagelength; row++) {\n\t\t\tif (!TIFFReadScanline(in, ibuf, row, 0))\n\t\t\t\tgoto done;\n\t\t\tpp = obuf;\n\t\t\tfor (x = 0; x < imagewidth; x++) {\n\t\t\t\t*pp++ = (unsigned char) rmap[ibuf[x]];\n\t\t\t\t*pp++ = (unsigned char) gmap[ibuf[x]];\n\t\t\t\t*pp++ = (unsigned char) bmap[ibuf[x]];\n\t\t\t}\n\t\t\tif (!TIFFWriteScanline(out, obuf, row, 0))\n\t\t\t\tgoto done;\n\t\t}\n\t\tbreak;\n\t  case PLANARCONFIG_SEPARATE:\n\t\tfor (row = 0; row < imagelength; row++) {\n\t\t\tif (!TIFFReadScanline(in, ibuf, row, 0))\n\t\t\t\tgoto done;\n\t\t\tfor (pp = obuf, x = 0; x < imagewidth; x++)\n\t\t\t\t*pp++ = (unsigned char) rmap[ibuf[x]];\n\t\t\tif (!TIFFWriteScanline(out, obuf, row, 0))\n\t\t\t\tgoto done;\n\t\t\tfor (pp = obuf, x = 0; x < imagewidth; x++)\n\t\t\t\t*pp++ = (unsigned char) gmap[ibuf[x]];\n\t\t\tif (!TIFFWriteScanline(out, obuf, row, 0))\n\t\t\t\tgoto done;\n\t\t\tfor (pp = obuf, x = 0; x < imagewidth; x++)\n\t\t\t\t*pp++ = (unsigned char) bmap[ibuf[x]];\n\t\t\tif (!TIFFWriteScanline(out, obuf, row, 0))\n\t\t\t\tgoto done;\n\t\t}\n\t\tbreak;\n\t  }\n\t  _TIFFfree(ibuf);\n\t  _TIFFfree(obuf);\n\t}\ndone:\n\t(void) TIFFClose(in);\n\t(void) TIFFClose(out);\n\treturn (0);\n}\n\nstatic int\nprocessCompressOptions(char* opt)\n{\n\tif (streq(opt, \"none\"))\n\t\tcompression = COMPRESSION_NONE;\n\telse if (streq(opt, \"packbits\"))\n\t\tcompression = COMPRESSION_PACKBITS;\n\telse if (strneq(opt, \"jpeg\", 4)) {\n\t\tchar* cp = strchr(opt, ':');\n\n                compression = COMPRESSION_JPEG;\n                while( cp )\n                {\n                    if (isdigit((int)cp[1]))\n\t\t\tquality = atoi(cp+1);\n                    else if (cp[1] == 'r' )\n\t\t\tjpegcolormode = JPEGCOLORMODE_RAW;\n                    else\n                        usage();\n\n                    cp = strchr(cp+1,':');\n                }\n\t} else if (strneq(opt, \"lzw\", 3)) {\n\t\tchar* cp = strchr(opt, ':');\n\t\tif (cp)\n\t\t\tpredictor = atoi(cp+1);\n\t\tcompression = COMPRESSION_LZW;\n\t} else if (strneq(opt, \"zip\", 3)) {\n\t\tchar* cp = strchr(opt, ':');\n\t\tif (cp)\n\t\t\tpredictor = atoi(cp+1);\n\t\tcompression = COMPRESSION_DEFLATE;\n\t} else\n\t\treturn (0);\n\treturn (1);\n}\n\n#define\tCopyField(tag, v) \\\n    if (TIFFGetField(in, tag, &v)) TIFFSetField(out, tag, v)\n#define\tCopyField2(tag, v1, v2) \\\n    if (TIFFGetField(in, tag, &v1, &v2)) TIFFSetField(out, tag, v1, v2)\n#define\tCopyField3(tag, v1, v2, v3) \\\n    if (TIFFGetField(in, tag, &v1, &v2, &v3)) TIFFSetField(out, tag, v1, v2, v3)\n#define\tCopyField4(tag, v1, v2, v3, v4) \\\n    if (TIFFGetField(in, tag, &v1, &v2, &v3, &v4)) TIFFSetField(out, tag, v1, v2, v3, v4)\n\nstatic void\ncpTag(TIFF* in, TIFF* out, uint16 tag, uint16 count, TIFFDataType type)\n{\n\tswitch (type) {\n\tcase TIFF_SHORT:\n\t\tif (count == 1) {\n\t\t\tuint16 shortv;\n\t\t\tCopyField(tag, shortv);\n\t\t} else if (count == 2) {\n\t\t\tuint16 shortv1, shortv2;\n\t\t\tCopyField2(tag, shortv1, shortv2);\n\t\t} else if (count == 4) {\n\t\t\tuint16 *tr, *tg, *tb, *ta;\n\t\t\tCopyField4(tag, tr, tg, tb, ta);\n\t\t} else if (count == (uint16) -1) {\n\t\t\tuint16 shortv1;\n\t\t\tuint16* shortav;\n\t\t\tCopyField2(tag, shortv1, shortav);\n\t\t}\n\t\tbreak;\n\tcase TIFF_LONG:\n\t\t{ uint32 longv;\n\t\t  CopyField(tag, longv);\n\t\t}\n\t\tbreak;\n\tcase TIFF_RATIONAL:\n\t\tif (count == 1) {\n\t\t\tfloat floatv;\n\t\t\tCopyField(tag, floatv);\n\t\t} else if (count == (uint16) -1) {\n\t\t\tfloat* floatav;\n\t\t\tCopyField(tag, floatav);\n\t\t}\n\t\tbreak;\n\tcase TIFF_ASCII:\n\t\t{ char* stringv;\n\t\t  CopyField(tag, stringv);\n\t\t}\n\t\tbreak;\n\tcase TIFF_DOUBLE:\n\t\tif (count == 1) {\n\t\t\tdouble doublev;\n\t\t\tCopyField(tag, doublev);\n\t\t} else if (count == (uint16) -1) {\n\t\t\tdouble* doubleav;\n\t\t\tCopyField(tag, doubleav);\n\t\t}\n\t\tbreak;\n          default:\n                TIFFError(TIFFFileName(in),\n                          \"Data type %d is not supported, tag %d skipped.\",\n                          tag, type);\n\t}\n}\n\n#undef CopyField4\n#undef CopyField3\n#undef CopyField2\n#undef CopyField\n\nstatic struct cpTag {\n    uint16\ttag;\n    uint16\tcount;\n    TIFFDataType type;\n} tags[] = {\n    { TIFFTAG_IMAGEWIDTH,\t\t1, TIFF_LONG },\n    { TIFFTAG_IMAGELENGTH,\t\t1, TIFF_LONG },\n    { TIFFTAG_BITSPERSAMPLE,\t\t1, TIFF_SHORT },\n    { TIFFTAG_COMPRESSION,\t\t1, TIFF_SHORT },\n    { TIFFTAG_FILLORDER,\t\t1, TIFF_SHORT },\n    { TIFFTAG_ROWSPERSTRIP,\t\t1, TIFF_LONG },\n    { TIFFTAG_GROUP3OPTIONS,\t\t1, TIFF_LONG },\n    { TIFFTAG_SUBFILETYPE,\t\t1, TIFF_LONG },\n    { TIFFTAG_THRESHHOLDING,\t\t1, TIFF_SHORT },\n    { TIFFTAG_DOCUMENTNAME,\t\t1, TIFF_ASCII },\n    { TIFFTAG_IMAGEDESCRIPTION,\t\t1, TIFF_ASCII },\n    { TIFFTAG_MAKE,\t\t\t1, TIFF_ASCII },\n    { TIFFTAG_MODEL,\t\t\t1, TIFF_ASCII },\n    { TIFFTAG_ORIENTATION,\t\t1, TIFF_SHORT },\n    { TIFFTAG_MINSAMPLEVALUE,\t\t1, TIFF_SHORT },\n    { TIFFTAG_MAXSAMPLEVALUE,\t\t1, TIFF_SHORT },\n    { TIFFTAG_XRESOLUTION,\t\t1, TIFF_RATIONAL },\n    { TIFFTAG_YRESOLUTION,\t\t1, TIFF_RATIONAL },\n    { TIFFTAG_PAGENAME,\t\t\t1, TIFF_ASCII },\n    { TIFFTAG_XPOSITION,\t\t1, TIFF_RATIONAL },\n    { TIFFTAG_YPOSITION,\t\t1, TIFF_RATIONAL },\n    { TIFFTAG_GROUP4OPTIONS,\t\t1, TIFF_LONG },\n    { TIFFTAG_RESOLUTIONUNIT,\t\t1, TIFF_SHORT },\n    { TIFFTAG_PAGENUMBER,\t\t2, TIFF_SHORT },\n    { TIFFTAG_SOFTWARE,\t\t\t1, TIFF_ASCII },\n    { TIFFTAG_DATETIME,\t\t\t1, TIFF_ASCII },\n    { TIFFTAG_ARTIST,\t\t\t1, TIFF_ASCII },\n    { TIFFTAG_HOSTCOMPUTER,\t\t1, TIFF_ASCII },\n    { TIFFTAG_WHITEPOINT,\t\t1, TIFF_RATIONAL },\n    { TIFFTAG_PRIMARYCHROMATICITIES,\t(uint16) -1,TIFF_RATIONAL },\n    { TIFFTAG_HALFTONEHINTS,\t\t2, TIFF_SHORT },\n    { TIFFTAG_BADFAXLINES,\t\t1, TIFF_LONG },\n    { TIFFTAG_CLEANFAXDATA,\t\t1, TIFF_SHORT },\n    { TIFFTAG_CONSECUTIVEBADFAXLINES,\t1, TIFF_LONG },\n    { TIFFTAG_INKSET,\t\t\t1, TIFF_SHORT },\n    { TIFFTAG_INKNAMES,\t\t\t1, TIFF_ASCII },\n    { TIFFTAG_DOTRANGE,\t\t\t2, TIFF_SHORT },\n    { TIFFTAG_TARGETPRINTER,\t\t1, TIFF_ASCII },\n    { TIFFTAG_SAMPLEFORMAT,\t\t1, TIFF_SHORT },\n    { TIFFTAG_YCBCRCOEFFICIENTS,\t(uint16) -1,TIFF_RATIONAL },\n    { TIFFTAG_YCBCRSUBSAMPLING,\t\t2, TIFF_SHORT },\n    { TIFFTAG_YCBCRPOSITIONING,\t\t1, TIFF_SHORT },\n    { TIFFTAG_REFERENCEBLACKWHITE,\t(uint16) -1,TIFF_RATIONAL },\n};\n#define\tNTAGS\t(sizeof (tags) / sizeof (tags[0]))\n\nstatic void\ncpTags(TIFF* in, TIFF* out)\n{\n    struct cpTag *p;\n    for (p = tags; p < &tags[NTAGS]; p++)\n\tcpTag(in, out, p->tag, p->count, p->type);\n}\n#undef NTAGS\n\nchar* stuff[] = {\n\"usage: pal2rgb [options] input.tif output.tif\",\n\"where options are:\",\n\" -p contig\tpack samples contiguously (e.g. RGBRGB...)\",\n\" -p separate\tstore samples separately (e.g. RRR...GGG...BBB...)\",\n\" -r #\t\tmake each strip have no more than # rows\",\n\" -C 8\t\tassume 8-bit colormap values (instead of 16-bit)\",\n\" -C 16\t\tassume 16-bit colormap values\",\n\"\",\n\" -c lzw[:opts]\tcompress output with Lempel-Ziv & Welch encoding\",\n\" -c zip[:opts]\tcompress output with deflate encoding\",\n\" -c packbits\tcompress output with packbits encoding\",\n\" -c none\tuse no compression algorithm on output\",\n\"\",\n\"LZW and deflate options:\",\n\" #\t\tset predictor value\",\n\"For example, -c lzw:2 to get LZW-encoded data with horizontal differencing\",\nNULL\n};\n\nstatic void\nusage(void)\n{\n\tchar buf[BUFSIZ];\n\tint i;\n\n\tsetbuf(stderr, buf);\n        fprintf(stderr, \"%s\\n\\n\", TIFFGetVersion());\n\tfor (i = 0; stuff[i] != NULL; i++)\n\t\tfprintf(stderr, \"%s\\n\", stuff[i]);\n\texit(-1);\n}\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiff/tools/ppm2tiff.c",
    "content": "/* $Id: ppm2tiff.c,v 1.13 2006/04/20 12:36:23 dron Exp $ */\n\n/*\n * Copyright (c) 1991-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n#include \"tif_config.h\"\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <ctype.h>\n\n#ifdef HAVE_UNISTD_H\n# include <unistd.h>\n#endif\n\n#ifdef HAVE_FCNTL_H\n# include <fcntl.h>\n#endif\n\n#ifdef HAVE_IO_H\n# include <io.h>\n#endif\n\n#include \"tiffio.h\"\n\n#ifndef HAVE_GETOPT\nextern int getopt(int, char**, char*);\n#endif\n\n#define\tstreq(a,b)\t(strcmp(a,b) == 0)\n#define\tstrneq(a,b,n)\t(strncmp(a,b,n) == 0)\n\nstatic\tuint16 compression = COMPRESSION_PACKBITS;\nstatic\tuint16 predictor = 0;\nstatic\tint quality = 75;\t/* JPEG quality */\nstatic\tint jpegcolormode = JPEGCOLORMODE_RGB;\nstatic  uint32 g3opts;\n\nstatic\tvoid usage(void);\nstatic\tint processCompressOptions(char*);\n\nstatic void\nBadPPM(char* file)\n{\n\tfprintf(stderr, \"%s: Not a PPM file.\\n\", file);\n\texit(-2);\n}\n\nint\nmain(int argc, char* argv[])\n{\n\tuint16 photometric = 0;\n\tuint32 rowsperstrip = (uint32) -1;\n\tdouble resolution = -1;\n\tunsigned char *buf = NULL;\n\ttsize_t linebytes = 0;\n\tuint16 spp = 1;\n\tuint16 bpp = 8;\n\tTIFF *out;\n\tFILE *in;\n\tunsigned int w, h, prec, row;\n\tchar *infile;\n\tint c;\n\textern int optind;\n\textern char* optarg;\n\n\tif (argc < 2) {\n\t    fprintf(stderr, \"%s: Too few arguments\\n\", argv[0]);\n\t    usage();\n\t}\n\twhile ((c = getopt(argc, argv, \"c:r:R:\")) != -1)\n\t\tswitch (c) {\n\t\tcase 'c':\t\t/* compression scheme */\n\t\t\tif (!processCompressOptions(optarg))\n\t\t\t\tusage();\n\t\t\tbreak;\n\t\tcase 'r':\t\t/* rows/strip */\n\t\t\trowsperstrip = atoi(optarg);\n\t\t\tbreak;\n\t\tcase 'R':\t\t/* resolution */\n\t\t\tresolution = atof(optarg);\n\t\t\tbreak;\n\t\tcase '?':\n\t\t\tusage();\n\t\t\t/*NOTREACHED*/\n\t\t}\n\n\tif (optind + 2 < argc) {\n\t    fprintf(stderr, \"%s: Too many arguments\\n\", argv[0]);\n\t    usage();\n\t}\n\n\t/*\n\t * If only one file is specified, read input from\n\t * stdin; otherwise usage is: ppm2tiff input output.\n\t */\n\tif (argc - optind > 1) {\n\t\tinfile = argv[optind++];\n\t\tin = fopen(infile, \"rb\");\n\t\tif (in == NULL) {\n\t\t\tfprintf(stderr, \"%s: Can not open.\\n\", infile);\n\t\t\treturn (-1);\n\t\t}\n\t} else {\n\t\tinfile = \"<stdin>\";\n\t\tin = stdin;\n#if defined(HAVE_SETMODE) && defined(O_BINARY)\n\t\tsetmode(fileno(stdin), O_BINARY);\n#endif\n\t}\n\n\tif (fgetc(in) != 'P')\n\t\tBadPPM(infile);\n\tswitch (fgetc(in)) {\n\t\tcase '4':\t\t\t/* it's a PBM file */\n\t\t\tbpp = 1;\n\t\t\tspp = 1;\n\t\t\tphotometric = PHOTOMETRIC_MINISWHITE;\n\t\t\tbreak;\n\t\tcase '5':\t\t\t/* it's a PGM file */\n\t\t\tbpp = 8;\n\t\t\tspp = 1;\n\t\t\tphotometric = PHOTOMETRIC_MINISBLACK;\n\t\t\tbreak;\n\t\tcase '6':\t\t\t/* it's a PPM file */\n\t\t\tbpp = 8;\n\t\t\tspp = 3;\n\t\t\tphotometric = PHOTOMETRIC_RGB;\n\t\t\tif (compression == COMPRESSION_JPEG &&\n\t\t\t    jpegcolormode == JPEGCOLORMODE_RGB)\n\t\t\t\tphotometric = PHOTOMETRIC_YCBCR;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tBadPPM(infile);\n\t}\n\n\t/* Parse header */\n\twhile(1) {\n\t\tif (feof(in))\n\t\t\tBadPPM(infile);\n\t\tc = fgetc(in);\n\t\t/* Skip whitespaces (blanks, TABs, CRs, LFs) */\n\t\tif (strchr(\" \\t\\r\\n\", c))\n\t\t\tcontinue;\n\n\t\t/* Check for comment line */\n\t\tif (c == '#') {\n\t\t\tdo {\n\t\t\t    c = fgetc(in);\n\t\t\t} while(!strchr(\"\\r\\n\", c) || feof(in));\n\t\t\tcontinue;\n\t\t}\n\n\t\tungetc(c, in);\n\t\tbreak;\n\t}\n\tswitch (bpp) {\n\tcase 1:\n\t\tif (fscanf(in, \" %u %u\", &w, &h) != 2)\n\t\t\tBadPPM(infile);\n\t\tif (fgetc(in) != '\\n')\n\t\t\tBadPPM(infile);\n\t\tbreak;\n\tcase 8:\n\t\tif (fscanf(in, \" %u %u %u\", &w, &h, &prec) != 3)\n\t\t\tBadPPM(infile);\n\t\tif (fgetc(in) != '\\n' || prec != 255)\n\t\t\tBadPPM(infile);\n\t\tbreak;\n\t}\n\tout = TIFFOpen(argv[optind], \"w\");\n\tif (out == NULL)\n\t\treturn (-4);\n\tTIFFSetField(out, TIFFTAG_IMAGEWIDTH, (uint32) w);\n\tTIFFSetField(out, TIFFTAG_IMAGELENGTH, (uint32) h);\n\tTIFFSetField(out, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);\n\tTIFFSetField(out, TIFFTAG_SAMPLESPERPIXEL, spp);\n\tTIFFSetField(out, TIFFTAG_BITSPERSAMPLE, bpp);\n\tTIFFSetField(out, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);\n\tTIFFSetField(out, TIFFTAG_PHOTOMETRIC, photometric);\n\tTIFFSetField(out, TIFFTAG_COMPRESSION, compression);\n\tswitch (compression) {\n\tcase COMPRESSION_JPEG:\n\t\tTIFFSetField(out, TIFFTAG_JPEGQUALITY, quality);\n\t\tTIFFSetField(out, TIFFTAG_JPEGCOLORMODE, jpegcolormode);\n\t\tbreak;\n\tcase COMPRESSION_LZW:\n\tcase COMPRESSION_DEFLATE:\n\t\tif (predictor != 0)\n\t\t\tTIFFSetField(out, TIFFTAG_PREDICTOR, predictor);\n\t\tbreak;\n        case COMPRESSION_CCITTFAX3:\n\t\tTIFFSetField(out, TIFFTAG_GROUP3OPTIONS, g3opts);\n\t\tbreak;\n\t}\n\tswitch (bpp) {\n\t\tcase 1:\n\t\t\tlinebytes = (spp * w + (8 - 1)) / 8;\n\t\t\tif (rowsperstrip == (uint32) -1) {\n\t\t\t\tTIFFSetField(out, TIFFTAG_ROWSPERSTRIP, h);\n\t\t\t} else {\n\t\t\t\tTIFFSetField(out, TIFFTAG_ROWSPERSTRIP,\n\t\t\t\t    TIFFDefaultStripSize(out, rowsperstrip));\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 8:\n\t\t\tlinebytes = spp * w;\n\t\t\tTIFFSetField(out, TIFFTAG_ROWSPERSTRIP,\n\t\t\t    TIFFDefaultStripSize(out, rowsperstrip));\n\t\t\tbreak;\n\t}\n\tif (TIFFScanlineSize(out) > linebytes)\n\t\tbuf = (unsigned char *)_TIFFmalloc(linebytes);\n\telse\n\t\tbuf = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(out));\n\tif (resolution > 0) {\n\t\tTIFFSetField(out, TIFFTAG_XRESOLUTION, resolution);\n\t\tTIFFSetField(out, TIFFTAG_YRESOLUTION, resolution);\n\t\tTIFFSetField(out, TIFFTAG_RESOLUTIONUNIT, RESUNIT_INCH);\n\t}\n\tfor (row = 0; row < h; row++) {\n\t\tif (fread(buf, linebytes, 1, in) != 1) {\n\t\t\tfprintf(stderr, \"%s: scanline %lu: Read error.\\n\",\n\t\t\t    infile, (unsigned long) row);\n\t\t\tbreak;\n\t\t}\n\t\tif (TIFFWriteScanline(out, buf, row, 0) < 0)\n\t\t\tbreak;\n\t}\n\t(void) TIFFClose(out);\n\tif (buf)\n\t\t_TIFFfree(buf);\n\treturn (0);\n}\n\nstatic void\nprocessG3Options(char* cp)\n{\n\tg3opts = 0;\n        if( (cp = strchr(cp, ':')) ) {\n                do {\n                        cp++;\n                        if (strneq(cp, \"1d\", 2))\n                                g3opts &= ~GROUP3OPT_2DENCODING;\n                        else if (strneq(cp, \"2d\", 2))\n                                g3opts |= GROUP3OPT_2DENCODING;\n                        else if (strneq(cp, \"fill\", 4))\n                                g3opts |= GROUP3OPT_FILLBITS;\n                        else\n                                usage();\n                } while( (cp = strchr(cp, ':')) );\n        }\n}\n\nstatic int\nprocessCompressOptions(char* opt)\n{\n\tif (streq(opt, \"none\"))\n\t\tcompression = COMPRESSION_NONE;\n\telse if (streq(opt, \"packbits\"))\n\t\tcompression = COMPRESSION_PACKBITS;\n\telse if (strneq(opt, \"jpeg\", 4)) {\n\t\tchar* cp = strchr(opt, ':');\n\n                compression = COMPRESSION_JPEG;\n                while (cp)\n                {\n                    if (isdigit((int)cp[1]))\n\t\t\tquality = atoi(cp+1);\n                    else if (cp[1] == 'r' )\n\t\t\tjpegcolormode = JPEGCOLORMODE_RAW;\n                    else\n                        usage();\n\n                    cp = strchr(cp+1,':');\n                }\n\t} else if (strneq(opt, \"g3\", 2)) {\n\t\tprocessG3Options(opt);\n\t\tcompression = COMPRESSION_CCITTFAX3;\n\t} else if (streq(opt, \"g4\")) {\n\t\tcompression = COMPRESSION_CCITTFAX4;\n\t} else if (strneq(opt, \"lzw\", 3)) {\n\t\tchar* cp = strchr(opt, ':');\n\t\tif (cp)\n\t\t\tpredictor = atoi(cp+1);\n\t\tcompression = COMPRESSION_LZW;\n\t} else if (strneq(opt, \"zip\", 3)) {\n\t\tchar* cp = strchr(opt, ':');\n\t\tif (cp)\n\t\t\tpredictor = atoi(cp+1);\n\t\tcompression = COMPRESSION_DEFLATE;\n\t} else\n\t\treturn (0);\n\treturn (1);\n}\n\nchar* stuff[] = {\n\"usage: ppm2tiff [options] input.ppm output.tif\",\n\"where options are:\",\n\" -r #\t\tmake each strip have no more than # rows\",\n\" -R #\t\tset x&y resolution (dpi)\",\n\"\",\n\" -c jpeg[:opts]  compress output with JPEG encoding\",\n\" -c lzw[:opts]\tcompress output with Lempel-Ziv & Welch encoding\",\n\" -c zip[:opts]\tcompress output with deflate encoding\",\n\" -c packbits\tcompress output with packbits encoding (the default)\",\n\" -c g3[:opts]  compress output with CCITT Group 3 encoding\",\n\" -c g4         compress output with CCITT Group 4 encoding\",\n\" -c none\tuse no compression algorithm on output\",\n\"\",\n\"JPEG options:\",\n\" #\t\tset compression quality level (0-100, default 75)\",\n\" r\t\toutput color image as RGB rather than YCbCr\",\n\"LZW and deflate options:\",\n\" #\t\tset predictor value\",\n\"For example, -c lzw:2 to get LZW-encoded data with horizontal differencing\",\nNULL\n};\n\nstatic void\nusage(void)\n{\n\tchar buf[BUFSIZ];\n\tint i;\n\n\tsetbuf(stderr, buf);\n        fprintf(stderr, \"%s\\n\\n\", TIFFGetVersion());\n\tfor (i = 0; stuff[i] != NULL; i++)\n\t\tfprintf(stderr, \"%s\\n\", stuff[i]);\n\texit(-1);\n}\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiff/tools/ras2tiff.c",
    "content": "/* $Id: ras2tiff.c,v 1.15 2006/04/20 12:36:23 dron Exp $ */\n\n/*\n * Copyright (c) 1988-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n#include \"tif_config.h\"\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <ctype.h>\n\n#ifdef HAVE_UNISTD_H\n# include <unistd.h>\n#endif\n\n#include \"rasterfile.h\"\n#include \"tiffio.h\"\n\n#ifndef howmany\n#define\thowmany(x, y)\t(((x)+((y)-1))/(y))\n#endif\n#define\tstreq(a,b)\t(strcmp(a,b) == 0)\n#define\tstrneq(a,b,n)\t(strncmp(a,b,n) == 0)\n\nstatic\tuint16 compression = (uint16) -1;\nstatic\tint jpegcolormode = JPEGCOLORMODE_RGB;\nstatic\tint quality = 75;\t\t/* JPEG quality */\nstatic\tuint16 predictor = 0;\n\nstatic void usage(void);\nstatic\tint processCompressOptions(char*);\n\nint\nmain(int argc, char* argv[])\n{\n\tunsigned char* buf;\n\tlong row;\n\ttsize_t linebytes, scanline;\n\tTIFF *out;\n\tFILE *in;\n\tstruct rasterfile h;\n\tuint16 photometric;\n\tuint16 config = PLANARCONFIG_CONTIG;\n\tuint32 rowsperstrip = (uint32) -1;\n\tint c;\n\textern int optind;\n\textern char* optarg;\n\n\twhile ((c = getopt(argc, argv, \"c:r:h\")) != -1)\n\t\tswitch (c) {\n\t\tcase 'c':\t\t/* compression scheme */\n\t\t\tif (!processCompressOptions(optarg))\n\t\t\t\tusage();\n\t\t\tbreak;\n\t\tcase 'r':\t\t/* rows/strip */\n\t\t\trowsperstrip = atoi(optarg);\n\t\t\tbreak;\n\t\tcase 'h':\n\t\t\tusage();\n\t\t\t/*NOTREACHED*/\n\t\t}\n\tif (argc - optind != 2)\n\t\tusage();\n\tin = fopen(argv[optind], \"rb\");\n\tif (in == NULL) {\n\t\tfprintf(stderr, \"%s: Can not open.\\n\", argv[optind]);\n\t\treturn (-1);\n\t}\n\tif (fread(&h, sizeof (h), 1, in) != 1) {\n\t\tfprintf(stderr, \"%s: Can not read header.\\n\", argv[optind]);\n\t\treturn (-2);\n\t}\n\tif (strcmp(h.ras_magic, RAS_MAGIC) == 0) {\n#ifndef WORDS_BIGENDIAN\n\t\t\tTIFFSwabLong((uint32 *)&h.ras_width);\n\t\t\tTIFFSwabLong((uint32 *)&h.ras_height);\n\t\t\tTIFFSwabLong((uint32 *)&h.ras_depth);\n\t\t\tTIFFSwabLong((uint32 *)&h.ras_length);\n\t\t\tTIFFSwabLong((uint32 *)&h.ras_type);\n\t\t\tTIFFSwabLong((uint32 *)&h.ras_maptype);\n\t\t\tTIFFSwabLong((uint32 *)&h.ras_maplength);\n#endif\n\t} else if (strcmp(h.ras_magic, RAS_MAGIC_INV) == 0) {\n#ifdef WORDS_BIGENDIAN\n\t\t\tTIFFSwabLong((uint32 *)&h.ras_width);\n\t\t\tTIFFSwabLong((uint32 *)&h.ras_height);\n\t\t\tTIFFSwabLong((uint32 *)&h.ras_depth);\n\t\t\tTIFFSwabLong((uint32 *)&h.ras_length);\n\t\t\tTIFFSwabLong((uint32 *)&h.ras_type);\n\t\t\tTIFFSwabLong((uint32 *)&h.ras_maptype);\n\t\t\tTIFFSwabLong((uint32 *)&h.ras_maplength);\n#endif\n\t} else {\n\t\tfprintf(stderr, \"%s: Not a rasterfile.\\n\", argv[optind]);\n\t\treturn (-3);\n\t}\n\tout = TIFFOpen(argv[optind+1], \"w\");\n\tif (out == NULL)\n\t\treturn (-4);\n\tTIFFSetField(out, TIFFTAG_IMAGEWIDTH, (uint32) h.ras_width);\n\tTIFFSetField(out, TIFFTAG_IMAGELENGTH, (uint32) h.ras_height);\n\tTIFFSetField(out, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);\n\tTIFFSetField(out, TIFFTAG_SAMPLESPERPIXEL, h.ras_depth > 8 ? 3 : 1);\n\tTIFFSetField(out, TIFFTAG_BITSPERSAMPLE, h.ras_depth > 1 ? 8 : 1);\n\tTIFFSetField(out, TIFFTAG_PLANARCONFIG, config);\n\tif (h.ras_maptype != RMT_NONE) {\n\t\tuint16* red;\n\t\tregister uint16* map;\n\t\tregister int i, j;\n\t\tint mapsize;\n\n\t\tbuf = (unsigned char *)_TIFFmalloc(h.ras_maplength);\n\t\tif (buf == NULL) {\n\t\t\tfprintf(stderr, \"No space to read in colormap.\\n\");\n\t\t\treturn (-5);\n\t\t}\n\t\tif (fread(buf, h.ras_maplength, 1, in) != 1) {\n\t\t\tfprintf(stderr, \"%s: Read error on colormap.\\n\",\n\t\t\t    argv[optind]);\n\t\t\treturn (-6);\n\t\t}\n\t\tmapsize = 1<<h.ras_depth; \n\t\tif (h.ras_maplength > mapsize*3) {\n\t\t\tfprintf(stderr,\n\t\t\t    \"%s: Huh, %ld colormap entries, should be %d?\\n\",\n\t\t\t    argv[optind], h.ras_maplength, mapsize*3);\n\t\t\treturn (-7);\n\t\t}\n\t\tred = (uint16*)_TIFFmalloc(mapsize * 3 * sizeof (uint16));\n\t\tif (red == NULL) {\n\t\t\tfprintf(stderr, \"No space for colormap.\\n\");\n\t\t\treturn (-8);\n\t\t}\n\t\tmap = red;\n\t\tfor (j = 0; j < 3; j++) {\n#define\tSCALE(x)\t(((x)*((1L<<16)-1))/255)\n\t\t\tfor (i = h.ras_maplength/3; i-- > 0;)\n\t\t\t\t*map++ = SCALE(*buf++);\n\t\t\tif ((i = h.ras_maplength/3) < mapsize) {\n\t\t\t\ti = mapsize - i;\n\t\t\t\t_TIFFmemset(map, 0, i*sizeof (uint16));\n\t\t\t\tmap += i;\n\t\t\t}\n\t\t}\n\t\tTIFFSetField(out, TIFFTAG_COLORMAP,\n\t\t     red, red + mapsize, red + 2*mapsize);\n\t\tphotometric = PHOTOMETRIC_PALETTE;\n\t\tif (compression == (uint16) -1)\n\t\t\tcompression = COMPRESSION_PACKBITS;\n\t\tTIFFSetField(out, TIFFTAG_COMPRESSION, compression);\n\t} else {\n\t\t/* XXX this is bogus... */\n\t\tphotometric = h.ras_depth == 24 ?\n\t\t    PHOTOMETRIC_RGB : PHOTOMETRIC_MINISBLACK;\n\t\tif (compression == (uint16) -1)\n\t\t\tcompression = COMPRESSION_LZW;\n\t\tTIFFSetField(out, TIFFTAG_COMPRESSION, compression);\n\t}\n\tswitch (compression) {\n\tcase COMPRESSION_JPEG:\n\t\tif (photometric == PHOTOMETRIC_RGB && jpegcolormode == JPEGCOLORMODE_RGB)\n\t\t\tphotometric = PHOTOMETRIC_YCBCR;\n\t\tTIFFSetField(out, TIFFTAG_JPEGQUALITY, quality);\n\t\tTIFFSetField(out, TIFFTAG_JPEGCOLORMODE, jpegcolormode);\n\t\tbreak;\n\tcase COMPRESSION_LZW:\n\tcase COMPRESSION_DEFLATE:\n\t\tif (predictor != 0)\n\t\t\tTIFFSetField(out, TIFFTAG_PREDICTOR, predictor);\n\t\tbreak;\n\t}\n\tTIFFSetField(out, TIFFTAG_PHOTOMETRIC, photometric);\n\tlinebytes = ((h.ras_depth*h.ras_width+15) >> 3) &~ 1;\n\tscanline = TIFFScanlineSize(out);\n\tif (scanline > linebytes) {\n\t\tbuf = (unsigned char *)_TIFFmalloc(scanline);\n\t\t_TIFFmemset(buf+linebytes, 0, scanline-linebytes);\n\t} else\n\t\tbuf = (unsigned char *)_TIFFmalloc(linebytes);\n\tTIFFSetField(out, TIFFTAG_ROWSPERSTRIP,\n\t    TIFFDefaultStripSize(out, rowsperstrip));\n\tfor (row = 0; row < h.ras_height; row++) {\n\t\tif (fread(buf, linebytes, 1, in) != 1) {\n\t\t\tfprintf(stderr, \"%s: scanline %ld: Read error.\\n\",\n\t\t\t    argv[optind], row);\n\t\t\tbreak;\n\t\t}\n\t\tif (h.ras_type == RT_STANDARD && h.ras_depth == 24) {\n\t\t\ttsize_t cc = h.ras_width;\n\t\t\tunsigned char* cp = buf;\n#define\tSWAP(a,b)\t{ unsigned char t = (a); (a) = (b); (b) = t; }\n\t\t\tdo {\n\t\t\t\tSWAP(cp[0], cp[2]);\n\t\t\t\tcp += 3;\n\t\t\t} while (--cc);\n\t\t}\n\t\tif (TIFFWriteScanline(out, buf, row, 0) < 0)\n\t\t\tbreak;\n\t}\n\t(void) TIFFClose(out);\n\treturn (0);\n}\n\nstatic int\nprocessCompressOptions(char* opt)\n{\n\tif (streq(opt, \"none\"))\n\t\tcompression = COMPRESSION_NONE;\n\telse if (streq(opt, \"packbits\"))\n\t\tcompression = COMPRESSION_PACKBITS;\n\telse if (strneq(opt, \"jpeg\", 4)) {\n\t\tchar* cp = strchr(opt, ':');\n\n                compression = COMPRESSION_JPEG;\n                while( cp )\n                {\n                    if (isdigit((int)cp[1]))\n\t\t\tquality = atoi(cp+1);\n                    else if (cp[1] == 'r' )\n\t\t\tjpegcolormode = JPEGCOLORMODE_RAW;\n                    else\n                        usage();\n\n                    cp = strchr(cp+1,':');\n                }\n\t} else if (strneq(opt, \"lzw\", 3)) {\n\t\tchar* cp = strchr(opt, ':');\n\t\tif (cp)\n\t\t\tpredictor = atoi(cp+1);\n\t\tcompression = COMPRESSION_LZW;\n\t} else if (strneq(opt, \"zip\", 3)) {\n\t\tchar* cp = strchr(opt, ':');\n\t\tif (cp)\n\t\t\tpredictor = atoi(cp+1);\n\t\tcompression = COMPRESSION_DEFLATE;\n\t} else\n\t\treturn (0);\n\treturn (1);\n}\n\nchar* stuff[] = {\n\"usage: ras2tiff [options] input.ras output.tif\",\n\"where options are:\",\n\" -r #\t\tmake each strip have no more than # rows\",\n\"\",\n\" -c lzw[:opts]\tcompress output with Lempel-Ziv & Welch encoding\",\n\" -c zip[:opts]\tcompress output with deflate encoding\",\n\" -c jpeg[:opts]\tcompress output with JPEG encoding\",\n\" -c packbits\tcompress output with packbits encoding\",\n\" -c none\tuse no compression algorithm on output\",\n\"\",\n\"JPEG options:\",\n\" #\t\tset compression quality level (0-100, default 75)\",\n\" r\t\toutput color image as RGB rather than YCbCr\",\n\"For example, -c jpeg:r:50 to get JPEG-encoded RGB data with 50% comp. quality\",\n\"\",\n\"LZW and deflate options:\",\n\" #\t\tset predictor value\",\n\"For example, -c lzw:2 to get LZW-encoded data with horizontal differencing\",\n\" -h\t\tthis help message\",\nNULL\n};\n\nstatic void\nusage(void)\n{\n\tchar buf[BUFSIZ];\n\tint i;\n\n\tsetbuf(stderr, buf);\n        fprintf(stderr, \"%s\\n\\n\", TIFFGetVersion());\n\tfor (i = 0; stuff[i] != NULL; i++)\n\t\tfprintf(stderr, \"%s\\n\", stuff[i]);\n\texit(-1);\n}\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiff/tools/rasterfile.h",
    "content": "/* $Header: /cvs/maptools/cvsroot/libtiff/tools/rasterfile.h,v 1.3 2003/11/12 19:14:33 dron Exp $ */\n\n/*\n * Description of header for files containing raster images\n */\nstruct rasterfile {\n\tchar\tras_magic[4];\t\t/* magic number */\n\tlong\tras_width;\t\t/* width (pixels) of image */\n\tlong\tras_height;\t\t/* height (pixels) of image */\n\tlong\tras_depth;\t\t/* depth (1, 8, or 24 bits) of pixel */\n\tlong\tras_length;\t\t/* length (bytes) of image */\n\tlong\tras_type;\t\t/* type of file; see RT_* below */\n\tlong\tras_maptype;\t\t/* type of colormap; see RMT_* below */\n\tlong\tras_maplength;\t\t/* length (bytes) of following map */\n\t/* color map follows for ras_maplength bytes, followed by image */\n};\n#define\tRAS_MAGIC\t\"\\x59\\xa6\\x6a\\x95\"\n#define\tRAS_MAGIC_INV\t\"\\x95\\x6a\\xa6\\x59\"\n\n\t/* Sun supported ras_type's */\n#define RT_OLD\t\t0\t/* Raw pixrect image in 68000 byte order */\n#define RT_STANDARD\t1\t/* Raw pixrect image in 68000 byte order */\n#define RT_BYTE_ENCODED\t2\t/* Run-length compression of bytes */\n#define RT_EXPERIMENTAL 0xffff\t/* Reserved for testing */\n\n\t/* Sun registered ras_maptype's */\n#define RMT_RAW\t\t2\n\t/* Sun supported ras_maptype's */\n#define RMT_NONE\t0\t/* ras_maplength is expected to be 0 */\n#define RMT_EQUAL_RGB\t1\t/* red[ras_maplength/3],green[],blue[] */\n\n/*\n * NOTES:\n * \tEach line of the image is rounded out to a multiple of 16 bits.\n *   This corresponds to the rounding convention used by the memory pixrect\n *   package (/usr/include/pixrect/memvar.h) of the SunWindows system.\n *\tThe ras_encoding field (always set to 0 by Sun's supported software)\n *   was renamed to ras_length in release 2.0.  As a result, rasterfiles\n *   of type 0 generated by the old software claim to have 0 length; for\n *   compatibility, code reading rasterfiles must be prepared to compute the\n *   true length from the width, height, and depth fields.\n */\n"
  },
  {
    "path": "src/main/jni/tiff/tools/raw2tiff.c",
    "content": "/* $Id: raw2tiff.c,v 1.23 2006/03/23 14:54:02 dron Exp $\n *\n * Project:  libtiff tools\n * Purpose:  Convert raw byte sequences in TIFF images\n * Author:   Andrey Kiselev, dron@ak4719.spb.edu\n *\n ******************************************************************************\n * Copyright (c) 2002, Andrey Kiselev <dron@ak4719.spb.edu>\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n#include \"tif_config.h\"\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <sys/stat.h>\n#include <sys/types.h>\n#include <math.h>\n#include <ctype.h>\n\n#ifdef HAVE_UNISTD_H\n# include <unistd.h>\n#endif\n\n#if HAVE_FCNTL_H\n# include <fcntl.h>\n#endif\n\n#if HAVE_SYS_TYPES_H\n# include <sys/types.h>\n#endif\n\n#if HAVE_IO_H\n# include <io.h>\n#endif\n\n#include \"tiffio.h\"\n\n#ifndef HAVE_GETOPT\nextern int getopt(int, char**, char*);\n#endif\n\n#ifndef O_BINARY\n# define O_BINARY 0\n#endif\n\ntypedef enum {\n\tPIXEL,\n\tBAND\n} InterleavingType;\n\nstatic\tuint16 compression = (uint16) -1;\nstatic\tint jpegcolormode = JPEGCOLORMODE_RGB;\nstatic\tint quality = 75;\t\t/* JPEG quality */\nstatic\tuint16 predictor = 0;\n\nstatic void swapBytesInScanline(void *, uint32, TIFFDataType);\nstatic int guessSize(int, TIFFDataType, off_t, uint32, int,\n\t\t     uint32 *, uint32 *);\nstatic double correlation(void *, void *, uint32, TIFFDataType);\nstatic void usage(void);\nstatic\tint processCompressOptions(char*);\n\nint\nmain(int argc, char* argv[])\n{\n\tuint32\twidth = 0, length = 0, linebytes, bufsize;\n\tuint32\tnbands = 1;\t\t    /* number of bands in input image*/\n\toff_t\thdr_size = 0;\t\t    /* size of the header to skip */\n\tTIFFDataType dtype = TIFF_BYTE;\n\tint16\tdepth = 1;\t\t    /* bytes per pixel in input image */\n\tint\tswab = 0;\t\t    /* byte swapping flag */\n\tInterleavingType interleaving = 0;  /* interleaving type flag */\n\tuint32  rowsperstrip = (uint32) -1;\n\tuint16\tphotometric = PHOTOMETRIC_MINISBLACK;\n\tuint16\tconfig = PLANARCONFIG_CONTIG;\n\tuint16\tfillorder = FILLORDER_LSB2MSB;\n\tint\tfd;\n\tchar\t*outfilename = NULL;\n\tTIFF\t*out;\n\n\tuint32 row, col, band;\n\tint\tc;\n\tunsigned char *buf = NULL, *buf1 = NULL;\n\textern int optind;\n\textern char* optarg;\n\n\twhile ((c = getopt(argc, argv, \"c:r:H:w:l:b:d:LMp:si:o:h\")) != -1) {\n\t\tswitch (c) {\n\t\tcase 'c':\t\t/* compression scheme */\n\t\t\tif (!processCompressOptions(optarg))\n\t\t\t\tusage();\n\t\t\tbreak;\n\t\tcase 'r':\t\t/* rows/strip */\n\t\t\trowsperstrip = atoi(optarg);\n\t\t\tbreak;\n\t\tcase 'H':\t\t/* size of input image file header */\n\t\t\thdr_size = atoi(optarg);\n\t\t\tbreak;\n\t\tcase 'w':\t\t/* input image width */\n\t\t\twidth = atoi(optarg);\n\t\t\tbreak;\n\t\tcase 'l':\t\t/* input image length */\n\t\t\tlength = atoi(optarg);\n\t\t\tbreak;\n\t\tcase 'b':\t\t/* number of bands in input image */\n\t\t\tnbands = atoi(optarg);\n\t\t\tbreak;\n\t\tcase 'd':\t\t/* type of samples in input image */\n\t\t\tif (strncmp(optarg, \"byte\", 4) == 0)\n\t\t\t\tdtype = TIFF_BYTE;\n\t\t\telse if (strncmp(optarg, \"short\", 5) == 0)\n\t\t\t\tdtype = TIFF_SHORT;\n\t\t\telse if  (strncmp(optarg, \"long\", 4) == 0)\n\t\t\t\tdtype = TIFF_LONG;\n\t\t\telse if  (strncmp(optarg, \"sbyte\", 5) == 0)\n\t\t\t\tdtype = TIFF_SBYTE;\n\t\t\telse if  (strncmp(optarg, \"sshort\", 6) == 0)\n\t\t\t\tdtype = TIFF_SSHORT;\n\t\t\telse if  (strncmp(optarg, \"slong\", 5) == 0)\n\t\t\t\tdtype = TIFF_SLONG;\n\t\t\telse if  (strncmp(optarg, \"float\", 5) == 0)\n\t\t\t\tdtype = TIFF_FLOAT;\n\t\t\telse if  (strncmp(optarg, \"double\", 6) == 0)\n\t\t\t\tdtype = TIFF_DOUBLE;\n\t\t\telse\n\t\t\t\tdtype = TIFF_BYTE;\n\t\t\tdepth = TIFFDataWidth(dtype);\n\t\t\tbreak;\n\t\tcase 'L':\t\t/* input has lsb-to-msb fillorder */\n\t\t\tfillorder = FILLORDER_LSB2MSB;\n\t\t\tbreak;\n\t\tcase 'M':\t\t/* input has msb-to-lsb fillorder */\n\t\t\tfillorder = FILLORDER_MSB2LSB;\n\t\t\tbreak;\n\t\tcase 'p':\t\t/* photometric interpretation */\n\t\t\tif (strncmp(optarg, \"miniswhite\", 10) == 0)\n\t\t\t\tphotometric = PHOTOMETRIC_MINISWHITE;\n\t\t\telse if (strncmp(optarg, \"minisblack\", 10) == 0)\n\t\t\t\tphotometric = PHOTOMETRIC_MINISBLACK;\n\t\t\telse if (strncmp(optarg, \"rgb\", 3) == 0)\n\t\t\t\tphotometric = PHOTOMETRIC_RGB;\n\t\t\telse if (strncmp(optarg, \"cmyk\", 4) == 0)\n\t\t\t\tphotometric = PHOTOMETRIC_SEPARATED;\n\t\t\telse if (strncmp(optarg, \"ycbcr\", 5) == 0)\n\t\t\t\tphotometric = PHOTOMETRIC_YCBCR;\n\t\t\telse if (strncmp(optarg, \"cielab\", 6) == 0)\n\t\t\t\tphotometric = PHOTOMETRIC_CIELAB;\n\t\t\telse if (strncmp(optarg, \"icclab\", 6) == 0)\n\t\t\t\tphotometric = PHOTOMETRIC_ICCLAB;\n\t\t\telse if (strncmp(optarg, \"itulab\", 6) == 0)\n\t\t\t\tphotometric = PHOTOMETRIC_ITULAB;\n\t\t\telse\n\t\t\t\tphotometric = PHOTOMETRIC_MINISBLACK;\n\t\t\tbreak;\n\t\tcase 's':\t\t/* do we need to swap bytes? */\n\t\t\tswab = 1;\n\t\t\tbreak;\n\t\tcase 'i':\t\t/* type of interleaving */\n\t\t\tif (strncmp(optarg, \"pixel\", 4) == 0)\n\t\t\t\tinterleaving = PIXEL;\n\t\t\telse if  (strncmp(optarg, \"band\", 6) == 0)\n\t\t\t\tinterleaving = BAND;\n\t\t\telse\n\t\t\t\tinterleaving = 0;\n\t\t\tbreak;\n\t\tcase 'o':\n\t\t\toutfilename = optarg;\n\t\t\tbreak;\n\t\tcase 'h':\n\t\t\tusage();\n\t\tdefault:\n\t\t\tbreak;\n\t\t}\n        }\n\n        if (argc - optind < 2)\n\t\tusage();\n\n        fd = open(argv[optind], O_RDONLY|O_BINARY, 0);\n\tif (fd < 0) {\n\t\tfprintf(stderr, \"%s: %s: Cannot open input file.\\n\",\n\t\t\targv[0], argv[optind]);\n\t\treturn (-1);\n\t}\n\n\tif (guessSize(fd, dtype, hdr_size, nbands, swab, &width, &length) < 0)\n\t\treturn 1;\n\n\tif (outfilename == NULL)\n\t\toutfilename = argv[optind+1];\n\tout = TIFFOpen(outfilename, \"w\");\n\tif (out == NULL) {\n\t\tfprintf(stderr, \"%s: %s: Cannot open file for output.\\n\",\n\t\t\targv[0], outfilename);\n\t\treturn (-1);\n\t}\n\tTIFFSetField(out, TIFFTAG_IMAGEWIDTH, width);\n\tTIFFSetField(out, TIFFTAG_IMAGELENGTH, length);\n\tTIFFSetField(out, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);\n\tTIFFSetField(out, TIFFTAG_SAMPLESPERPIXEL, nbands);\n\tTIFFSetField(out, TIFFTAG_BITSPERSAMPLE, depth * 8);\n\tTIFFSetField(out, TIFFTAG_FILLORDER, fillorder);\n\tTIFFSetField(out, TIFFTAG_PLANARCONFIG, config);\n\tTIFFSetField(out, TIFFTAG_PHOTOMETRIC, photometric);\n\tswitch (dtype) {\n\tcase TIFF_BYTE:\n\tcase TIFF_SHORT:\n\tcase TIFF_LONG:\n\t\tTIFFSetField(out, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_UINT);\n\t\tbreak;\n\tcase TIFF_SBYTE:\n\tcase TIFF_SSHORT:\n\tcase TIFF_SLONG:\n\t\tTIFFSetField(out, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_INT);\n\t\tbreak;\n\tcase TIFF_FLOAT:\n\tcase TIFF_DOUBLE:\n\t\tTIFFSetField(out, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_IEEEFP);\n\t\tbreak;\n\tdefault:\n\t\tTIFFSetField(out, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_VOID);\n\t\tbreak;\n\t}\n\tif (compression == (uint16) -1)\n\t\tcompression = COMPRESSION_PACKBITS;\n\tTIFFSetField(out, TIFFTAG_COMPRESSION, compression);\n\tswitch (compression) {\n\tcase COMPRESSION_JPEG:\n\t\tif (photometric == PHOTOMETRIC_RGB\n\t\t    && jpegcolormode == JPEGCOLORMODE_RGB)\n\t\t\tphotometric = PHOTOMETRIC_YCBCR;\n\t\tTIFFSetField(out, TIFFTAG_JPEGQUALITY, quality);\n\t\tTIFFSetField(out, TIFFTAG_JPEGCOLORMODE, jpegcolormode);\n\t\tbreak;\n\tcase COMPRESSION_LZW:\n\tcase COMPRESSION_DEFLATE:\n\t\tif (predictor != 0)\n\t\t\tTIFFSetField(out, TIFFTAG_PREDICTOR, predictor);\n\t\tbreak;\n\t}\n\tswitch(interleaving) {\n\tcase BAND:\t\t\t\t/* band interleaved data */\n\t\tlinebytes = width * depth;\n\t\tbuf = (unsigned char *)_TIFFmalloc(linebytes);\n\t\tbreak;\n\tcase PIXEL:\t\t\t\t/* pixel interleaved data */\n\tdefault:\n\t\tlinebytes = width * nbands * depth;\n\t\tbreak;\n\t}\n\tbufsize = width * nbands * depth;\n\tbuf1 = (unsigned char *)_TIFFmalloc(bufsize);\n\n\trowsperstrip = TIFFDefaultStripSize(out, rowsperstrip);\n\tif (rowsperstrip > length) {\n\t\trowsperstrip = length;\n\t}\n\tTIFFSetField(out, TIFFTAG_ROWSPERSTRIP, rowsperstrip );\n\n\tlseek(fd, hdr_size, SEEK_SET);\t\t/* Skip the file header */\n\tfor (row = 0; row < length; row++) {\n\t\tswitch(interleaving) {\n\t\tcase BAND:\t\t\t/* band interleaved data */\n\t\t\tfor (band = 0; band < nbands; band++) {\n\t\t\t\tlseek(fd,\n\t\t\t\t      hdr_size + (length*band+row)*linebytes,\n\t\t\t\t      SEEK_SET);\n\t\t\t\tif (read(fd, buf, linebytes) < 0) {\n\t\t\t\t\tfprintf(stderr,\n\t\t\t\t\t\"%s: %s: scanline %lu: Read error.\\n\",\n\t\t\t\t\targv[0], argv[optind],\n\t\t\t\t\t(unsigned long) row);\n\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (swab)\t/* Swap bytes if needed */\n\t\t\t\t\tswapBytesInScanline(buf, width, dtype);\n\t\t\t\tfor (col = 0; col < width; col++)\n\t\t\t\t\tmemcpy(buf1 + (col*nbands+band)*depth,\n\t\t\t\t\t       buf + col * depth, depth);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase PIXEL:\t\t\t/* pixel interleaved data */\n\t\tdefault:\n\t\t\tif (read(fd, buf1, bufsize) < 0) {\n\t\t\t\tfprintf(stderr,\n\t\t\t\t\t\"%s: %s: scanline %lu: Read error.\\n\",\n\t\t\t\t\targv[0], argv[optind],\n\t\t\t\t\t(unsigned long) row);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (swab)\t\t/* Swap bytes if needed */\n\t\t\t\tswapBytesInScanline(buf1, width, dtype);\n\t\t\tbreak;\n\t\t}\n\t\t\t\t\n\t\tif (TIFFWriteScanline(out, buf1, row, 0) < 0) {\n\t\t\tfprintf(stderr,\t\"%s: %s: scanline %lu: Write error.\\n\",\n\t\t\t\targv[0], outfilename, (unsigned long) row);\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (buf)\n\t\t_TIFFfree(buf);\n\tif (buf1)\n\t\t_TIFFfree(buf1);\n\tTIFFClose(out);\n\treturn (0);\n}\n\nstatic void\nswapBytesInScanline(void *buf, uint32 width, TIFFDataType dtype)\n{\n\tswitch (dtype) {\n\t\tcase TIFF_SHORT:\n\t\tcase TIFF_SSHORT:\n\t\t\tTIFFSwabArrayOfShort((uint16*)buf,\n                                             (unsigned long)width);\n\t\t\tbreak;\n\t\tcase TIFF_LONG:\n\t\tcase TIFF_SLONG:\n\t\t\tTIFFSwabArrayOfLong((uint32*)buf,\n                                            (unsigned long)width);\n\t\t\tbreak;\n\t\t/* case TIFF_FLOAT: */\t/* FIXME */\n\t\tcase TIFF_DOUBLE:\n\t\t\tTIFFSwabArrayOfDouble((double*)buf,\n                                              (unsigned long)width);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tbreak;\n\t}\n}\n\nstatic int\nguessSize(int fd, TIFFDataType dtype, off_t hdr_size, uint32 nbands,\n\t  int swab, uint32 *width, uint32 *length)\n{\n\tconst float longt = 40.0;    /* maximum possible height/width ratio */\n\tchar\t    *buf1, *buf2;\n\tstruct stat filestat;\n\tuint32\t    w, h, scanlinesize, imagesize;\n\tuint32\t    depth = TIFFDataWidth(dtype);\n\tfloat\t    cor_coef = 0, tmp;\n\n\tfstat(fd, &filestat);\n\n\tif (filestat.st_size < hdr_size) {\n\t\tfprintf(stderr, \"Too large header size specified.\\n\");\n\t\treturn -1;\n\t}\n\n\timagesize = (filestat.st_size - hdr_size) / nbands / depth;\n\n\tif (*width != 0 && *length == 0) {\n\t\tfprintf(stderr,\t\"Image height is not specified.\\n\");\n\n\t\t*length = imagesize / *width;\n\t\t\n\t\tfprintf(stderr, \"Height is guessed as %lu.\\n\",\n\t\t\t(unsigned long)*length);\n\n\t\treturn 1;\n\t} else if (*width == 0 && *length != 0) {\n\t\tfprintf(stderr, \"Image width is not specified.\\n\");\n\n\t\t*width = imagesize / *length;\n\t\t\n\t\tfprintf(stderr,\t\"Width is guessed as %lu.\\n\",\n\t\t\t(unsigned long)*width);\n\n\t\treturn 1;\n\t} else if (*width == 0 && *length == 0) {\n\t\tfprintf(stderr,\t\"Image width and height are not specified.\\n\");\n\n\t\tfor (w = (uint32) sqrt(imagesize / longt);\n\t\t     w < sqrt(imagesize * longt);\n\t\t     w++) {\n\t\t\tif (imagesize % w == 0) {\n\t\t\t\tscanlinesize = w * depth;\n\t\t\t\tbuf1 = _TIFFmalloc(scanlinesize);\n\t\t\t\tbuf2 = _TIFFmalloc(scanlinesize);\n\t\t\t\th = imagesize / w;\n\t\t\t\tlseek(fd, hdr_size + (int)(h/2)*scanlinesize,\n\t\t\t\t      SEEK_SET);\n\t\t\t\tread(fd, buf1, scanlinesize);\n\t\t\t\tread(fd, buf2, scanlinesize);\n\t\t\t\tif (swab) {\n\t\t\t\t\tswapBytesInScanline(buf1, w, dtype);\n\t\t\t\t\tswapBytesInScanline(buf2, w, dtype);\n\t\t\t\t}\n\t\t\t\ttmp = (float) fabs(correlation(buf1, buf2,\n\t\t\t\t\t\t\t       w, dtype));\n\t\t\t\tif (tmp > cor_coef) {\n\t\t\t\t\tcor_coef = tmp;\n\t\t\t\t\t*width = w, *length = h;\n\t\t\t\t}\n\n\t\t\t\t_TIFFfree(buf1);\n\t\t\t\t_TIFFfree(buf2);\n\t\t\t}\n\t\t}\n\n\t\tfprintf(stderr,\n\t\t\t\"Width is guessed as %lu, height is guessed as %lu.\\n\",\n\t\t\t(unsigned long)*width, (unsigned long)*length);\n\n\t\treturn 1;\n\t} else {\n\t\tif (filestat.st_size<(off_t)(hdr_size+(*width)*(*length)*nbands*depth)) {\n\t\t\tfprintf(stderr, \"Input file too small.\\n\");\n\t\treturn -1;\n\t\t}\n\t}\n\n\treturn 1;\n}\n\n/* Calculate correlation coefficient between two numeric vectors */\nstatic double\ncorrelation(void *buf1, void *buf2, uint32 n_elem, TIFFDataType dtype)\n{\n\tdouble\tX, Y, M1 = 0.0, M2 = 0.0, D1 = 0.0, D2 = 0.0, K = 0.0;\n\tuint32\ti;\n\n\tswitch (dtype) {\n\t\tcase TIFF_BYTE:\n\t\tdefault:\n                        for (i = 0; i < n_elem; i++) {\n\t\t\t\tX = ((unsigned char *)buf1)[i];\n\t\t\t\tY = ((unsigned char *)buf2)[i];\n\t\t\t\tM1 += X, M2 += Y;\n\t\t\t\tD1 += X * X, D2 += Y * Y;\n\t\t\t\tK += X * Y;\n                        }\n\t\t\tbreak;\n\t\tcase TIFF_SBYTE:\n                        for (i = 0; i < n_elem; i++) {\n\t\t\t\tX = ((signed char *)buf1)[i];\n\t\t\t\tY = ((signed char *)buf2)[i];\n\t\t\t\tM1 += X, M2 += Y;\n\t\t\t\tD1 += X * X, D2 += Y * Y;\n\t\t\t\tK += X * Y;\n                        }\n\t\t\tbreak;\n\t\tcase TIFF_SHORT:\n                        for (i = 0; i < n_elem; i++) {\n\t\t\t\tX = ((uint16 *)buf1)[i];\n\t\t\t\tY = ((uint16 *)buf2)[i];\n\t\t\t\tM1 += X, M2 += Y;\n\t\t\t\tD1 += X * X, D2 += Y * Y;\n\t\t\t\tK += X * Y;\n                        }\n\t\t\tbreak;\n\t\tcase TIFF_SSHORT:\n                        for (i = 0; i < n_elem; i++) {\n\t\t\t\tX = ((int16 *)buf1)[i];\n\t\t\t\tY = ((int16 *)buf2)[i];\n\t\t\t\tM1 += X, M2 += Y;\n\t\t\t\tD1 += X * X, D2 += Y * Y;\n\t\t\t\tK += X * Y;\n                        }\n\t\t\tbreak;\n\t\tcase TIFF_LONG:\n                        for (i = 0; i < n_elem; i++) {\n\t\t\t\tX = ((uint32 *)buf1)[i];\n\t\t\t\tY = ((uint32 *)buf2)[i];\n\t\t\t\tM1 += X, M2 += Y;\n\t\t\t\tD1 += X * X, D2 += Y * Y;\n\t\t\t\tK += X * Y;\n                        }\n\t\t\tbreak;\n\t\tcase TIFF_SLONG:\n                        for (i = 0; i < n_elem; i++) {\n\t\t\t\tX = ((int32 *)buf1)[i];\n\t\t\t\tY = ((int32 *)buf2)[i];\n\t\t\t\tM1 += X, M2 += Y;\n\t\t\t\tD1 += X * X, D2 += Y * Y;\n\t\t\t\tK += X * Y;\n                        }\n\t\t\tbreak;\n\t\tcase TIFF_FLOAT:\n                        for (i = 0; i < n_elem; i++) {\n\t\t\t\tX = ((float *)buf1)[i];\n\t\t\t\tY = ((float *)buf2)[i];\n\t\t\t\tM1 += X, M2 += Y;\n\t\t\t\tD1 += X * X, D2 += Y * Y;\n\t\t\t\tK += X * Y;\n                        }\n\t\t\tbreak;\n\t\tcase TIFF_DOUBLE:\n                        for (i = 0; i < n_elem; i++) {\n\t\t\t\tX = ((double *)buf1)[i];\n\t\t\t\tY = ((double *)buf2)[i];\n\t\t\t\tM1 += X, M2 += Y;\n\t\t\t\tD1 += X * X, D2 += Y * Y;\n\t\t\t\tK += X * Y;\n                        }\n\t\t\tbreak;\n\t}\n\n\tM1 /= n_elem;\n\tM2 /= n_elem;\n\tD1 -= M1 * M1 * n_elem;\n\tD2 -= M2 * M2 * n_elem;\n\tK = (K - M1 * M2 * n_elem) / sqrt(D1 * D2);\n\n\treturn K;\n}\n\nstatic int\nprocessCompressOptions(char* opt)\n{\n\tif (strcmp(opt, \"none\") == 0)\n\t\tcompression = COMPRESSION_NONE;\n\telse if (strcmp(opt, \"packbits\") == 0)\n\t\tcompression = COMPRESSION_PACKBITS;\n\telse if (strncmp(opt, \"jpeg\", 4) == 0) {\n\t\tchar* cp = strchr(opt, ':');\n\n                compression = COMPRESSION_JPEG;\n                while( cp )\n                {\n                    if (isdigit((int)cp[1]))\n\t\t\tquality = atoi(cp+1);\n                    else if (cp[1] == 'r' )\n\t\t\tjpegcolormode = JPEGCOLORMODE_RAW;\n                    else\n                        usage();\n\n                    cp = strchr(cp+1,':');\n                }\n\t} else if (strncmp(opt, \"lzw\", 3) == 0) {\n\t\tchar* cp = strchr(opt, ':');\n\t\tif (cp)\n\t\t\tpredictor = atoi(cp+1);\n\t\tcompression = COMPRESSION_LZW;\n\t} else if (strncmp(opt, \"zip\", 3) == 0) {\n\t\tchar* cp = strchr(opt, ':');\n\t\tif (cp)\n\t\t\tpredictor = atoi(cp+1);\n\t\tcompression = COMPRESSION_DEFLATE;\n\t} else\n\t\treturn (0);\n\treturn (1);\n}\n\nstatic char* stuff[] = {\n\"raw2tiff --- tool for converting raw byte sequences in TIFF images\",\n\"usage: raw2tiff [options] input.raw output.tif\",\n\"where options are:\",\n\" -L\t\tinput data has LSB2MSB bit order (default)\",\n\" -M\t\tinput data has MSB2LSB bit order\",\n\" -r #\t\tmake each strip have no more than # rows\",\n\" -H #\t\tsize of input image file header in bytes (0 by default)\",\n\" -w #\t\twidth of input image in pixels\",\n\" -l #\t\tlength of input image in lines\",\n\" -b #\t\tnumber of bands in input image (1 by default)\",\n\"\",\n\" -d data_type\ttype of samples in input image\",\n\"where data_type may be:\",\n\" byte\t\t8-bit unsigned integer (default)\",\n\" short\t\t16-bit unsigned integer\",\n\" long\t\t32-bit unsigned integer\",\n\" sbyte\t\t8-bit signed integer\",\n\" sshort\t\t16-bit signed integer\",\n\" slong\t\t32-bit signed integer\",\n\" float\t\t32-bit IEEE floating point\",\n\" double\t\t64-bit IEEE floating point\",\n\"\",\n\" -p photo\tphotometric interpretation (color space) of the input image\",\n\"where photo may be:\",\n\" miniswhite\twhite color represented with 0 value\",\n\" minisblack\tblack color represented with 0 value (default)\",\n\" rgb\t\timage has RGB color model\",\n\" cmyk\t\timage has CMYK (separated) color model\",\n\" ycbcr\t\timage has YCbCr color model\",\n\" cielab\t\timage has CIE L*a*b color model\",\n\" icclab\t\timage has ICC L*a*b color model\",\n\" itulab\t\timage has ITU L*a*b color model\",\n\"\",\n\" -s\t\tswap bytes fetched from input file\",\n\"\",\n\" -i config\ttype of samples interleaving in input image\",\n\"where config may be:\",\n\" pixel\t\tpixel interleaved data (default)\",\n\" band\t\tband interleaved data\",\n\"\",\n\" -c lzw[:opts]\tcompress output with Lempel-Ziv & Welch encoding\",\n\" -c zip[:opts]\tcompress output with deflate encoding\",\n\" -c jpeg[:opts]\tcompress output with JPEG encoding\",\n\" -c packbits\tcompress output with packbits encoding\",\n\" -c none\tuse no compression algorithm on output\",\n\"\",\n\"JPEG options:\",\n\" #\t\tset compression quality level (0-100, default 75)\",\n\" r\t\toutput color image as RGB rather than YCbCr\",\n\"For example, -c jpeg:r:50 to get JPEG-encoded RGB data with 50% comp. quality\",\n\"\",\n\"LZW and deflate options:\",\n\" #\t\tset predictor value\",\n\"For example, -c lzw:2 to get LZW-encoded data with horizontal differencing\",\n\" -o out.tif\twrite output to out.tif\",\n\" -h\t\tthis help message\",\nNULL\n};\n\nstatic void\nusage(void)\n{\n\tchar buf[BUFSIZ];\n\tint i;\n\n\tsetbuf(stderr, buf);\n        fprintf(stderr, \"%s\\n\\n\", TIFFGetVersion());\n\tfor (i = 0; stuff[i] != NULL; i++)\n\t\tfprintf(stderr, \"%s\\n\", stuff[i]);\n\texit(-1);\n}\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiff/tools/rgb2ycbcr.c",
    "content": "/* $Id: rgb2ycbcr.c,v 1.9.2.1 2009-08-20 20:23:53 bfriesen Exp $ */\n\n/*\n * Copyright (c) 1991-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n#include \"tif_config.h\"\n\n#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n\n#ifdef HAVE_UNISTD_H\n# include <unistd.h>\n#endif\n\n#include \"tiffiop.h\"\n#include \"tiffio.h\"\n\n#define\tstreq(a,b)\t(strcmp(a,b) == 0)\n#define\tCopyField(tag, v) \\\n    if (TIFFGetField(in, tag, &v)) TIFFSetField(out, tag, v)\n\n#ifndef howmany\n#define\thowmany(x, y)\t(((x)+((y)-1))/(y))\n#endif\n#define\troundup(x, y)\t(howmany(x,y)*((uint32)(y)))\n\n#define\tLumaRed\t\tycbcrCoeffs[0]\n#define\tLumaGreen\tycbcrCoeffs[1]\n#define\tLumaBlue\tycbcrCoeffs[2]\n\nuint16\tcompression = COMPRESSION_PACKBITS;\nuint32\trowsperstrip = (uint32) -1;\n\nuint16\thorizSubSampling = 2;\t\t/* YCbCr horizontal subsampling */\nuint16\tvertSubSampling = 2;\t\t/* YCbCr vertical subsampling */\nfloat\tycbcrCoeffs[3] = { .299F, .587F, .114F };\n/* default coding range is CCIR Rec 601-1 with no headroom/footroom */\nfloat\trefBlackWhite[6] = { 0.F, 255.F, 128.F, 255.F, 128.F, 255.F };\n\nstatic\tint tiffcvt(TIFF* in, TIFF* out);\nstatic\tvoid usage(int code);\nstatic\tvoid setupLumaTables(void);\n\nint\nmain(int argc, char* argv[])\n{\n\tTIFF *in, *out;\n\tint c;\n\textern int optind;\n\textern char *optarg;\n\n\twhile ((c = getopt(argc, argv, \"c:h:r:v:z\")) != -1)\n\t\tswitch (c) {\n\t\tcase 'c':\n\t\t\tif (streq(optarg, \"none\"))\n\t\t\t    compression = COMPRESSION_NONE;\n\t\t\telse if (streq(optarg, \"packbits\"))\n\t\t\t    compression = COMPRESSION_PACKBITS;\n\t\t\telse if (streq(optarg, \"lzw\"))\n\t\t\t    compression = COMPRESSION_LZW;\n\t\t\telse if (streq(optarg, \"jpeg\"))\n\t\t\t    compression = COMPRESSION_JPEG;\n\t\t\telse if (streq(optarg, \"zip\"))\n\t\t\t    compression = COMPRESSION_ADOBE_DEFLATE;\n\t\t\telse\n\t\t\t    usage(-1);\n\t\t\tbreak;\n\t\tcase 'h':\n\t\t\thorizSubSampling = atoi(optarg);\n\t\t\tbreak;\n\t\tcase 'v':\n\t\t\tvertSubSampling = atoi(optarg);\n\t\t\tbreak;\n\t\tcase 'r':\n\t\t\trowsperstrip = atoi(optarg);\n\t\t\tbreak;\n\t\tcase 'z':\t/* CCIR Rec 601-1 w/ headroom/footroom */\n\t\t\trefBlackWhite[0] = 16.;\n\t\t\trefBlackWhite[1] = 235.;\n\t\t\trefBlackWhite[2] = 128.;\n\t\t\trefBlackWhite[3] = 240.;\n\t\t\trefBlackWhite[4] = 128.;\n\t\t\trefBlackWhite[5] = 240.;\n\t\t\tbreak;\n\t\tcase '?':\n\t\t\tusage(0);\n\t\t\t/*NOTREACHED*/\n\t\t}\n\tif (argc - optind < 2)\n\t\tusage(-1);\n\tout = TIFFOpen(argv[argc-1], \"w\");\n\tif (out == NULL)\n\t\treturn (-2);\n\tsetupLumaTables();\n\tfor (; optind < argc-1; optind++) {\n\t\tin = TIFFOpen(argv[optind], \"r\");\n\t\tif (in != NULL) {\n\t\t\tdo {\n\t\t\t\tif (!tiffcvt(in, out) ||\n\t\t\t\t    !TIFFWriteDirectory(out)) {\n\t\t\t\t\t(void) TIFFClose(out);\n\t\t\t\t\treturn (1);\n\t\t\t\t}\n\t\t\t} while (TIFFReadDirectory(in));\n\t\t\t(void) TIFFClose(in);\n\t\t}\n\t}\n\t(void) TIFFClose(out);\n\treturn (0);\n}\n\nfloat\t*lumaRed;\nfloat\t*lumaGreen;\nfloat\t*lumaBlue;\nfloat\tD1, D2;\nint\tYzero;\n\nstatic float*\nsetupLuma(float c)\n{\n\tfloat *v = (float *)_TIFFmalloc(256 * sizeof (float));\n\tint i;\n\tfor (i = 0; i < 256; i++)\n\t\tv[i] = c * i;\n\treturn (v);\n}\n\nstatic unsigned\nV2Code(float f, float RB, float RW, int CR)\n{\n\tunsigned int c = (unsigned int)((((f)*(RW-RB)/CR)+RB)+.5);\n\treturn (c > 255 ? 255 : c);\n}\n\nstatic void\nsetupLumaTables(void)\n{\n\tlumaRed = setupLuma(LumaRed);\n\tlumaGreen = setupLuma(LumaGreen);\n\tlumaBlue = setupLuma(LumaBlue);\n\tD1 = 1.F/(2.F - 2.F*LumaBlue);\n\tD2 = 1.F/(2.F - 2.F*LumaRed);\n\tYzero = V2Code(0, refBlackWhite[0], refBlackWhite[1], 255);\n}\n\nstatic void\ncvtClump(unsigned char* op, uint32* raster, uint32 ch, uint32 cw, uint32 w)\n{\n\tfloat Y, Cb = 0, Cr = 0;\n\tuint32 j, k;\n\t/*\n\t * Convert ch-by-cw block of RGB\n\t * to YCbCr and sample accordingly.\n\t */\n\tfor (k = 0; k < ch; k++) {\n\t\tfor (j = 0; j < cw; j++) {\n\t\t\tuint32 RGB = (raster - k*w)[j];\n\t\t\tY = lumaRed[TIFFGetR(RGB)] +\n\t\t\t    lumaGreen[TIFFGetG(RGB)] +\n\t\t\t    lumaBlue[TIFFGetB(RGB)];\n\t\t\t/* accumulate chrominance */\n\t\t\tCb += (TIFFGetB(RGB) - Y) * D1;\n\t\t\tCr += (TIFFGetR(RGB) - Y) * D2;\n\t\t\t/* emit luminence */\n\t\t\t*op++ = V2Code(Y,\n\t\t\t    refBlackWhite[0], refBlackWhite[1], 255);\n\t\t}\n\t\tfor (; j < horizSubSampling; j++)\n\t\t\t*op++ = Yzero;\n\t}\n\tfor (; k < vertSubSampling; k++) {\n\t\tfor (j = 0; j < horizSubSampling; j++)\n\t\t\t*op++ = Yzero;\n\t}\n\t/* emit sampled chrominance values */\n\t*op++ = V2Code(Cb / (ch*cw), refBlackWhite[2], refBlackWhite[3], 127);\n\t*op++ = V2Code(Cr / (ch*cw), refBlackWhite[4], refBlackWhite[5], 127);\n}\n#undef LumaRed\n#undef LumaGreen\n#undef LumaBlue\n#undef V2Code\n\n/*\n * Convert a strip of RGB data to YCbCr and\n * sample to generate the output data.\n */\nstatic void\ncvtStrip(unsigned char* op, uint32* raster, uint32 nrows, uint32 width)\n{\n\tuint32 x;\n\tint clumpSize = vertSubSampling * horizSubSampling + 2;\n\tuint32 *tp;\n\n\tfor (; nrows >= vertSubSampling; nrows -= vertSubSampling) {\n\t\ttp = raster;\n\t\tfor (x = width; x >= horizSubSampling; x -= horizSubSampling) {\n\t\t\tcvtClump(op, tp,\n\t\t\t    vertSubSampling, horizSubSampling, width);\n\t\t\top += clumpSize;\n\t\t\ttp += horizSubSampling;\n\t\t}\n\t\tif (x > 0) {\n\t\t\tcvtClump(op, tp, vertSubSampling, x, width);\n\t\t\top += clumpSize;\n\t\t}\n\t\traster -= vertSubSampling*width;\n\t}\n\tif (nrows > 0) {\n\t\ttp = raster;\n\t\tfor (x = width; x >= horizSubSampling; x -= horizSubSampling) {\n\t\t\tcvtClump(op, tp, nrows, horizSubSampling, width);\n\t\t\top += clumpSize;\n\t\t\ttp += horizSubSampling;\n\t\t}\n\t\tif (x > 0)\n\t\t\tcvtClump(op, tp, nrows, x, width);\n\t}\n}\n\nstatic int\ncvtRaster(TIFF* tif, uint32* raster, uint32 width, uint32 height)\n{\n\tuint32 y;\n\ttstrip_t strip = 0;\n\ttsize_t cc, acc;\n\tunsigned char* buf;\n\tuint32 rwidth = roundup(width, horizSubSampling);\n\tuint32 rheight = roundup(height, vertSubSampling);\n\tuint32 nrows = (rowsperstrip > rheight ? rheight : rowsperstrip);\n        uint32 rnrows = roundup(nrows,vertSubSampling);\n\n\tcc = rnrows*rwidth +\n\t    2*((rnrows*rwidth) / (horizSubSampling*vertSubSampling));\n\tbuf = (unsigned char*)_TIFFmalloc(cc);\n\tfor (y = height; (int32) y > 0; y -= nrows) {\n\t\tuint32 nr = (y > nrows ? nrows : y);\n\t\tcvtStrip(buf, raster + (y-1)*width, nr, width);\n\t\tnr = roundup(nr, vertSubSampling);\n\t\tacc = nr*rwidth +\n\t\t\t2*((nr*rwidth)/(horizSubSampling*vertSubSampling));\n\t\tif (!TIFFWriteEncodedStrip(tif, strip++, buf, acc)) {\n\t\t\t_TIFFfree(buf);\n\t\t\treturn (0);\n\t\t}\n\t}\n\t_TIFFfree(buf);\n\treturn (1);\n}\n\nstatic int\ntiffcvt(TIFF* in, TIFF* out)\n{\n\tuint32 width, height;\t\t/* image width & height */\n\tuint32* raster;\t\t\t/* retrieve RGBA image */\n\tuint16 shortv;\n\tfloat floatv;\n\tchar *stringv;\n\tuint32 longv;\n\n\tsize_t pixel_count;\n\tTIFFGetField(in, TIFFTAG_IMAGEWIDTH, &width);\n\tTIFFGetField(in, TIFFTAG_IMAGELENGTH, &height);\n\tpixel_count = width * height;\n\n\t/* XXX: Check the integer overflow. */\n\tif (!width || !height || pixel_count / width != height) {\n\t\tTIFFError(TIFFFileName(in),\n\t\t\t  \"Malformed input file; \"\n\t\t\t  \"can't allocate buffer for raster of %lux%lu size\",\n\t\t\t  (unsigned long)width, (unsigned long)height);\n\t\treturn 0;\n\t}\n\n\traster = (uint32*)_TIFFCheckMalloc(in, pixel_count, sizeof(uint32),\n\t\t\t\t\t   \"raster buffer\");\n\tif (raster == 0) {\n\t\tTIFFError(TIFFFileName(in),\n\t\t\t  \"Requested buffer size is %lu elements %lu each\",\n\t\t\t  (unsigned long)pixel_count,\n\t\t\t  (unsigned long)sizeof(uint32));\n\t\treturn (0);\n\t}\n\n\tif (!TIFFReadRGBAImage(in, width, height, raster, 0)) {\n\t\t_TIFFfree(raster);\n\t\treturn (0);\n\t}\n\n\tCopyField(TIFFTAG_SUBFILETYPE, longv);\n\tTIFFSetField(out, TIFFTAG_IMAGEWIDTH, width);\n\tTIFFSetField(out, TIFFTAG_IMAGELENGTH, height);\n\tTIFFSetField(out, TIFFTAG_BITSPERSAMPLE, 8);\n\tTIFFSetField(out, TIFFTAG_COMPRESSION, compression);\n\tTIFFSetField(out, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_YCBCR);\n\tif (compression == COMPRESSION_JPEG)\n\t\tTIFFSetField(out, TIFFTAG_JPEGCOLORMODE, JPEGCOLORMODE_RAW);\n\tCopyField(TIFFTAG_FILLORDER, shortv);\n\tTIFFSetField(out, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);\n\tTIFFSetField(out, TIFFTAG_SAMPLESPERPIXEL, 3);\n\tCopyField(TIFFTAG_XRESOLUTION, floatv);\n\tCopyField(TIFFTAG_YRESOLUTION, floatv);\n\tCopyField(TIFFTAG_RESOLUTIONUNIT, shortv);\n\tTIFFSetField(out, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);\n\t{ char buf[2048];\n\t  char *cp = strrchr(TIFFFileName(in), '/');\n\t  sprintf(buf, \"YCbCr conversion of %s\", cp ? cp+1 : TIFFFileName(in));\n\t  TIFFSetField(out, TIFFTAG_IMAGEDESCRIPTION, buf);\n\t}\n\tTIFFSetField(out, TIFFTAG_SOFTWARE, TIFFGetVersion());\n\tCopyField(TIFFTAG_DOCUMENTNAME, stringv);\n\n\tTIFFSetField(out, TIFFTAG_REFERENCEBLACKWHITE, refBlackWhite);\n\tTIFFSetField(out, TIFFTAG_YCBCRSUBSAMPLING,\n\t    horizSubSampling, vertSubSampling);\n\tTIFFSetField(out, TIFFTAG_YCBCRPOSITIONING, YCBCRPOSITION_CENTERED);\n\tTIFFSetField(out, TIFFTAG_YCBCRCOEFFICIENTS, ycbcrCoeffs);\n\trowsperstrip = TIFFDefaultStripSize(out, rowsperstrip);\n\tTIFFSetField(out, TIFFTAG_ROWSPERSTRIP, rowsperstrip);\n\n\treturn (cvtRaster(out, raster, width, height));\n}\n\nchar* stuff[] = {\n    \"usage: rgb2ycbcr [-c comp] [-r rows] [-h N] [-v N] input... output\\n\",\n    \"where comp is one of the following compression algorithms:\\n\",\n    \" jpeg\\t\\tJPEG encoding\\n\",\n    \" lzw\\t\\tLempel-Ziv & Welch encoding\\n\",\n    \" zip\\t\\tdeflate encoding\\n\",\n    \" packbits\\tPackBits encoding (default)\\n\",\n    \" none\\t\\tno compression\\n\",\n    \"and the other options are:\\n\",\n    \" -r\\trows/strip\\n\",\n    \" -h\\thorizontal sampling factor (1,2,4)\\n\",\n    \" -v\\tvertical sampling factor (1,2,4)\\n\",\n    NULL\n};\n\nstatic void\nusage(int code)\n{\n\tchar buf[BUFSIZ];\n\tint i;\n\n\tsetbuf(stderr, buf);\n       \n fprintf(stderr, \"%s\\n\\n\", TIFFGetVersion());\n\tfor (i = 0; stuff[i] != NULL; i++)\n\t\tfprintf(stderr, \"%s\\n\", stuff[i]);\n\texit(code);\n}\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiff/tools/sgi2tiff.c",
    "content": "/* $Id: sgi2tiff.c,v 1.5 2006/01/11 16:59:36 fwarmerdam Exp $ */\n\n/*\n * Copyright (c) 1991-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <gl/image.h>\n#include <ctype.h>\n\n#include \"tiffio.h\"\n\n#define\tstreq(a,b)\t(strcmp(a,b) == 0)\n#define\tstrneq(a,b,n)\t(strncmp(a,b,n) == 0)\n\nstatic\tshort config = PLANARCONFIG_CONTIG;\nstatic\tuint16 compression = COMPRESSION_PACKBITS;\nstatic\tuint16 predictor = 0;\nstatic\tuint16 fillorder = 0;\nstatic\tuint32 rowsperstrip = (uint32) -1;\nstatic\tint jpegcolormode = JPEGCOLORMODE_RGB;\nstatic\tint quality = 75;\t\t/* JPEG quality */\nstatic\tuint16 photometric;\n\nstatic\tvoid usage(void);\nstatic\tint cpContig(IMAGE*, TIFF*);\nstatic\tint cpSeparate(IMAGE*, TIFF*);\nstatic\tint processCompressOptions(char*);\n\n/* XXX image library has no prototypes */\nextern\tIMAGE* iopen(const char*, const char*);\nextern\tvoid iclose(IMAGE*);\nextern\tvoid getrow(IMAGE*, short*, int, int);\n\nint\nmain(int argc, char* argv[])\n{\n\tIMAGE *in;\n\tTIFF *out;\n\tint c;\n\textern int optind;\n\textern char* optarg;\n\n\twhile ((c = getopt(argc, argv, \"c:p:r:\")) != -1)\n\t\tswitch (c) {\n\t\tcase 'c':\t\t/* compression scheme */\n\t\t\tif (!processCompressOptions(optarg))\n\t\t\t\tusage();\n\t\t\tbreak;\n\t\tcase 'f':\t\t/* fill order */\n\t\t\tif (streq(optarg, \"lsb2msb\"))\n\t\t\t\tfillorder = FILLORDER_LSB2MSB;\n\t\t\telse if (streq(optarg, \"msb2lsb\"))\n\t\t\t\tfillorder = FILLORDER_MSB2LSB;\n\t\t\telse\n\t\t\t\tusage();\n\t\t\tbreak;\n\t\tcase 'p':\t\t/* planar configuration */\n\t\t\tif (streq(optarg, \"separate\"))\n\t\t\t\tconfig = PLANARCONFIG_SEPARATE;\n\t\t\telse if (streq(optarg, \"contig\"))\n\t\t\t\tconfig = PLANARCONFIG_CONTIG;\n\t\t\telse\n\t\t\t\tusage();\n\t\t\tbreak;\n\t\tcase 'r':\t\t/* rows/strip */\n\t\t\trowsperstrip = atoi(optarg);\n\t\t\tbreak;\n\t\tcase '?':\n\t\t\tusage();\n\t\t\t/*NOTREACHED*/\n\t\t}\n\tif (argc - optind != 2)\n\t\tusage();\n\tin = iopen(argv[optind], \"r\");\n\tif (in == NULL)\n\t\treturn (-1);\n\tout = TIFFOpen(argv[optind+1], \"w\");\n\tif (out == NULL)\n\t\treturn (-2);\n\tTIFFSetField(out, TIFFTAG_IMAGEWIDTH, (uint32) in->xsize);\n\tTIFFSetField(out, TIFFTAG_IMAGELENGTH, (uint32) in->ysize);\n\tTIFFSetField(out, TIFFTAG_BITSPERSAMPLE, 8);\n\tTIFFSetField(out, TIFFTAG_COMPRESSION, compression);\n\tif (in->zsize == 1)\n\t\tphotometric = PHOTOMETRIC_MINISBLACK;\n\telse\n\t\tphotometric = PHOTOMETRIC_RGB;\n\tswitch (compression) {\n\tcase COMPRESSION_JPEG:\n\t\tif (photometric == PHOTOMETRIC_RGB && jpegcolormode == JPEGCOLORMODE_RGB)\n\t\t\tphotometric = PHOTOMETRIC_YCBCR;\n\t\tTIFFSetField(out, TIFFTAG_JPEGQUALITY, quality);\n\t\tTIFFSetField(out, TIFFTAG_JPEGCOLORMODE, jpegcolormode);\n\t\tbreak;\n\tcase COMPRESSION_LZW:\n\tcase COMPRESSION_DEFLATE:\n\t\tif (predictor != 0)\n\t\t\tTIFFSetField(out, TIFFTAG_PREDICTOR, predictor);\n\t\tbreak;\n\t}\n\tTIFFSetField(out, TIFFTAG_PHOTOMETRIC, photometric);\n\tif (fillorder != 0)\n\t\tTIFFSetField(out, TIFFTAG_FILLORDER, fillorder);\n\tTIFFSetField(out, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);\n\tTIFFSetField(out, TIFFTAG_SAMPLESPERPIXEL, in->zsize);\n\tif (in->zsize > 3) {\n\t    uint16 v[1];\n\t    v[0] = EXTRASAMPLE_UNASSALPHA;\n\t    TIFFSetField(out, TIFFTAG_EXTRASAMPLES, 1, v);\n\t}\n\tTIFFSetField(out, TIFFTAG_MINSAMPLEVALUE, (uint16) in->min);\n\tTIFFSetField(out, TIFFTAG_MAXSAMPLEVALUE, (uint16) in->max);\n\tTIFFSetField(out, TIFFTAG_PLANARCONFIG, config);\n\tif (config != PLANARCONFIG_SEPARATE)\n\t\tTIFFSetField(out, TIFFTAG_ROWSPERSTRIP,\n\t\t    TIFFDefaultStripSize(out, rowsperstrip));\n\telse\t\t\t/* force 1 row/strip for library limitation */\n\t\tTIFFSetField(out, TIFFTAG_ROWSPERSTRIP, 1L);\n\tif (in->name[0] != '\\0')\n\t\tTIFFSetField(out, TIFFTAG_IMAGEDESCRIPTION, in->name);\n\tif (config == PLANARCONFIG_CONTIG)\n\t\tcpContig(in, out);\n\telse\n\t\tcpSeparate(in, out);\n\t(void) iclose(in);\n\t(void) TIFFClose(out);\n\treturn (0);\n}\n\nstatic int\nprocessCompressOptions(char* opt)\n{\n\tif (streq(opt, \"none\"))\n\t\tcompression = COMPRESSION_NONE;\n\telse if (streq(opt, \"packbits\"))\n\t\tcompression = COMPRESSION_PACKBITS;\n\telse if (strneq(opt, \"jpeg\", 4)) {\n\t\tchar* cp = strchr(opt, ':');\n\n                defcompression = COMPRESSION_JPEG;\n                while( cp )\n                {\n                    if (isdigit((int)cp[1]))\n\t\t\tquality = atoi(cp+1);\n                    else if (cp[1] == 'r' )\n\t\t\tjpegcolormode = JPEGCOLORMODE_RAW;\n                    else\n                        usage();\n\n                    cp = strchr(cp+1,':');\n                }\n\t} else if (strneq(opt, \"lzw\", 3)) {\n\t\tchar* cp = strchr(opt, ':');\n\t\tif (cp)\n\t\t\tpredictor = atoi(cp+1);\n\t\tcompression = COMPRESSION_LZW;\n\t} else if (strneq(opt, \"zip\", 3)) {\n\t\tchar* cp = strchr(opt, ':');\n\t\tif (cp)\n\t\t\tpredictor = atoi(cp+1);\n\t\tcompression = COMPRESSION_DEFLATE;\n\t} else\n\t\treturn (0);\n\treturn (1);\n}\n\nstatic int\ncpContig(IMAGE* in, TIFF* out)\n{\n\ttdata_t buf = _TIFFmalloc(TIFFScanlineSize(out));\n\tshort *r = NULL;\n\tint x, y;\n\n\tif (in->zsize == 3) {\n\t\tshort *g, *b;\n\n\t\tr = (short *)_TIFFmalloc(3 * in->xsize * sizeof (short));\n\t\tg = r + in->xsize;\n\t\tb = g + in->xsize;\n\t\tfor (y = in->ysize-1; y >= 0; y--) {\n\t\t\tuint8* pp = (uint8*) buf;\n\n\t\t\tgetrow(in, r, y, 0);\n\t\t\tgetrow(in, g, y, 1);\n\t\t\tgetrow(in, b, y, 2);\n\t\t\tfor (x = 0; x < in->xsize; x++) {\n\t\t\t\tpp[0] = r[x];\n\t\t\t\tpp[1] = g[x];\n\t\t\t\tpp[2] = b[x];\n\t\t\t\tpp += 3;\n\t\t\t}\n\t\t\tif (TIFFWriteScanline(out, buf, in->ysize-y-1, 0) < 0)\n\t\t\t\tgoto bad;\n\t\t}\n\t} else if (in->zsize == 4) {\n\t\tshort *g, *b, *a;\n\n\t\tr = (short *)_TIFFmalloc(4 * in->xsize * sizeof (short));\n\t\tg = r + in->xsize;\n\t\tb = g + in->xsize;\n\t\ta = b + in->xsize;\n\t\tfor (y = in->ysize-1; y >= 0; y--) {\n\t\t\tuint8* pp = (uint8*) buf;\n\n\t\t\tgetrow(in, r, y, 0);\n\t\t\tgetrow(in, g, y, 1);\n\t\t\tgetrow(in, b, y, 2);\n\t\t\tgetrow(in, a, y, 3);\n\t\t\tfor (x = 0; x < in->xsize; x++) {\n\t\t\t\tpp[0] = r[x];\n\t\t\t\tpp[1] = g[x];\n\t\t\t\tpp[2] = b[x];\n\t\t\t\tpp[3] = a[x];\n\t\t\t\tpp += 4;\n\t\t\t}\n\t\t\tif (TIFFWriteScanline(out, buf, in->ysize-y-1, 0) < 0)\n\t\t\t\tgoto bad;\n\t\t}\n\t} else {\n\t\tuint8* pp = (uint8*) buf;\n\n\t\tr = (short *)_TIFFmalloc(in->xsize * sizeof (short));\n\t\tfor (y = in->ysize-1; y >= 0; y--) {\n\t\t\tgetrow(in, r, y, 0);\n\t\t\tfor (x = in->xsize-1; x >= 0; x--)\n\t\t\t\tpp[x] = r[x];\n\t\t\tif (TIFFWriteScanline(out, buf, in->ysize-y-1, 0) < 0)\n\t\t\t\tgoto bad;\n\t\t}\n\t}\n\tif (r)\n\t\t_TIFFfree(r);\n\t_TIFFfree(buf);\n\treturn (1);\nbad:\n\tif (r)\n\t\t_TIFFfree(r);\n\t_TIFFfree(buf);\n\treturn (0);\n}\n\nstatic int\ncpSeparate(IMAGE* in, TIFF* out)\n{\n\ttdata_t buf = _TIFFmalloc(TIFFScanlineSize(out));\n\tshort *r = (short *)_TIFFmalloc(in->xsize * sizeof (short));\n\tuint8* pp = (uint8*) buf;\n\tint x, y, z;\n\n\tfor (z = 0; z < in->zsize; z++) {\n\t\tfor (y = in->ysize-1; y >= 0; y--) {\n\t\t\tgetrow(in, r, y, z);\n\t\t\tfor (x = 0; x < in->xsize; x++)\n\t\t\t\tpp[x] = r[x];\n\t\t\tif (TIFFWriteScanline(out, buf, in->ysize-y-1, z) < 0)\n\t\t\t\tgoto bad;\n\t\t}\n\t}\n\t_TIFFfree(r);\n\t_TIFFfree(buf);\n\treturn (1);\nbad:\n\t_TIFFfree(r);\n\t_TIFFfree(buf);\n\treturn (0);\n}\n\nchar* stuff[] = {\n\"usage: sgi2tiff [options] input.rgb output.tif\",\n\"where options are:\",\n\" -r #\t\tmake each strip have no more than # rows\",\n\"\",\n\" -p contig\tpack samples contiguously (e.g. RGBRGB...)\",\n\" -p separate\tstore samples separately (e.g. RRR...GGG...BBB...)\",\n\"\",\n\" -f lsb2msb\tforce lsb-to-msb FillOrder for output\",\n\" -f msb2lsb\tforce msb-to-lsb FillOrder for output\",\n\"\",\n\" -c lzw[:opts]\tcompress output with Lempel-Ziv & Welch encoding\",\n\" -c zip[:opts]\tcompress output with deflate encoding\",\n\" -c jpeg[:opts]compress output with JPEG encoding\",\n\" -c packbits\tcompress output with packbits encoding\",\n\" -c none\tuse no compression algorithm on output\",\n\"\",\n\"JPEG options:\",\n\" #\t\tset compression quality level (0-100, default 75)\",\n\" r\t\toutput color image as RGB rather than YCbCr\",\n\"\",\n\"LZW and deflate options:\",\n\" #\t\tset predictor value\",\n\"For example, -c lzw:2 to get LZW-encoded data with horizontal differencing\",\nNULL\n};\n\nstatic void\nusage(void)\n{\n\tchar buf[BUFSIZ];\n\tint i;\n\n\tsetbuf(stderr, buf);\n\tfor (i = 0; stuff[i] != NULL; i++)\n\t\tfprintf(stderr, \"%s\\n\", stuff[i]);\n\texit(-1);\n}\n"
  },
  {
    "path": "src/main/jni/tiff/tools/sgisv.c",
    "content": "/* $Id: sgisv.c,v 1.5 2006/10/13 10:26:56 dron Exp $ */\n\n/*\n * Copyright (c) 1990-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n#include <gl.h>\n#include <ctype.h>\n\n#include \"tiffio.h\"\n\ntypedef unsigned char unsigned char;\ntypedef unsigned long uint32;\n\n#define\tstreq(a,b)\t(strcmp(a,b) == 0)\n#define\tstrneq(a,b,n)\t(strncmp(a,b,n) == 0)\n\nuint32\trowsperstrip = (uint32) -1;\nuint16\tcompression = COMPRESSION_PACKBITS;\nuint16\tconfig = PLANARCONFIG_CONTIG;\nuint16\tpredictor = 0;\nint\txmaxscreen;\nint\tymaxscreen;\nuint16\tphotometric = PHOTOMETRIC_RGB;\nint\tjpegcolormode = JPEGCOLORMODE_RGB;\nint\tquality = 75;\t\t/* JPEG quality */\n\nstatic\tvoid usage(void);\nstatic\tvoid tiffsv(char*, int, int, int, int);\n\nint\nmain(int argc, char* argv[])\n{\n\tint c;\n\textern int optind;\n\textern char* optarg;\n\n\twhile ((c = getopt(argc, argv, \"c:p:r:\")) != -1)\n\t\tswitch (c) {\n\t\tcase 'b':\t\t/* save as b&w */\n\t\t\tphotometric = PHOTOMETRIC_MINISBLACK;\n\t\t\tbreak;\n\t\tcase 'c':\t\t/* compression scheme */\n\t\t\tif (streq(optarg, \"none\"))\n\t\t\t\tcompression = COMPRESSION_NONE;\n\t\t\telse if (streq(optarg, \"packbits\"))\n\t\t\t\tcompression = COMPRESSION_PACKBITS;\n\t\t\telse if (strneq(optarg, \"jpeg\", 4)) {\n\t\t\t\tchar* cp = strchr(optarg, ':');\n\t\t\t\tif (cp && isdigit(cp[1]))\n\t\t\t\t\tquality = atoi(cp+1);\n\t\t\t\tif (cp && strchr(cp, 'r'))\n\t\t\t\t\tjpegcolormode = JPEGCOLORMODE_RAW;\n\t\t\t\tcompression = COMPRESSION_JPEG;\n\t\t\t} else if (strneq(optarg, \"lzw\", 3)) {\n\t\t\t\tchar* cp = strchr(optarg, ':');\n\t\t\t\tif (cp)\n\t\t\t\t\tpredictor = atoi(cp+1);\n\t\t\t\tcompression = COMPRESSION_LZW;\n\t\t\t} else\n\t\t\t\tusage();\n\t\t\tbreak;\n\t\tcase 'p':\t\t/* planar configuration */\n\t\t\tif (streq(optarg, \"separate\"))\n\t\t\t\tconfig = PLANARCONFIG_SEPARATE;\n\t\t\telse if (streq(optarg, \"contig\"))\n\t\t\t\tconfig = PLANARCONFIG_CONTIG;\n\t\t\telse\n\t\t\t\tusage();\n\t\t\tbreak;\n\t\tcase 'r':\t\t/* rows/strip */\n\t\t\trowsperstrip = atoi(optarg);\n\t\t\tbreak;\n\t\tcase '?':\n\t\t\tusage();\n\t\t\t/*NOTREACHED*/\n\t\t}\n\tif (argc - optind != 1 && argc - optind != 5)\n\t\tusage();\n\txmaxscreen = getgdesc(GD_XPMAX)-1;\n\tymaxscreen = getgdesc(GD_YPMAX)-1;\n\tforeground();\n\tnoport();\n\twinopen(\"tiffsv\");\n\tif (argc - optind == 5)\n\t\ttiffsv(argv[optind],\n\t\t    atoi(argv[optind+1]), atoi(argv[optind+2]),\n\t\t    atoi(argv[optind+3]), atoi(argv[optind+4]));\n\telse\n\t\ttiffsv(argv[optind], 0, xmaxscreen, 0, ymaxscreen);\n\treturn (0);\n}\n\nchar* stuff[] = {\n\"usage: tiffsv [options] outimage.tif [x1 x2 y1 y2] [-b]\",\n\"where options are:\",\n\" -p contig\tpack samples contiguously (e.g. RGBRGB...)\",\n\" -p separate\tstore samples separately (e.g. RRR...GGG...BBB...)\",\n\"\",\n\" -r #\t\tmake each strip have no more than # rows\",\n\"\",\n\" -c lzw[:opts]\tcompress output with Lempel-Ziv & Welch encoding\",\n\" -c jpeg[:opts]compress output with JPEG encoding\",\n\" -c packbits\tcompress output with packbits encoding\",\n\" -c none\tuse no compression algorithm on output\",\n\"\",\n\"JPEG options:\",\n\" #\t\tset compression quality level (0-100, default 75)\",\n\" r\t\toutput color image as RGB rather than YCbCr\",\n\"\",\n\"LZW options:\",\n\" #\t\tset predictor value for Lempel-Ziv & Welch encoding\",\n\"For example, -c lzw:2 to get LZW-encoded data with horizontal differencing\",\nNULL\n};\n\nstatic void\nusage(void)\n{\n\tchar buf[BUFSIZ];\n\tint i;\n\n\tsetbuf(stderr, buf);\n\tfor (i = 0; stuff[i] != NULL; i++)\n\t\tfprintf(stderr, \"%s\\n\", stuff[i]);\n\texit(-1);\n}\n\nstatic void\nsvRGBSeparate(TIFF* tif, uint32* ss, int xsize, int ysize)\n{\n\ttsize_t stripsize = TIFFStripSize(tif);\n\tunsigned char *rbuf = (unsigned char *)_TIFFmalloc(3*stripsize);\n\tunsigned char *gbuf = rbuf + stripsize;\n\tunsigned char *bbuf = gbuf + stripsize;\n\tregister int y;\n\n\tfor (y = 0; y <= ysize; y += rowsperstrip) {\n\t\tunsigned char *rp, *gp, *bp;\n\t\tregister int x;\n\t\tregister uint32 n;\n\n\t\tn = rowsperstrip;\n\t\tif (n > ysize-y+1)\n\t\t\tn = ysize-y+1;\n\t\trp = rbuf; gp = gbuf; bp = bbuf;\n\t\tdo {\n\t\t\tfor (x = 0; x <= xsize; x++) {\n\t\t\t\tuint32 v = ss[x];\n\t\t\t\trp[x] = v;\n\t\t\t\tgp[x] = v >> 8;\n\t\t\t\tbp[x] = v >> 16;\n\t\t\t}\n\t\t\trp += xsize+1, gp += xsize+1, bp += xsize+1;\n\t\t\tss += xsize+1;\n\t\t} while (--n);\n\t\tif (TIFFWriteEncodedStrip(tif, TIFFComputeStrip(tif,y,0),\n\t\t    rbuf, stripsize) < 0)\n\t\t\tbreak;\n\t\tif (TIFFWriteEncodedStrip(tif, TIFFComputeStrip(tif,y,1),\n\t\t    gbuf, stripsize) < 0)\n\t\t\tbreak;\n\t\tif (TIFFWriteEncodedStrip(tif, TIFFComputeStrip(tif,y,2),\n\t\t    bbuf, stripsize) < 0)\n\t\t\tbreak;\n\t}\n\t_TIFFfree(rbuf);\n}\n\nstatic void\nsvRGBContig(TIFF* tif, uint32* ss, int xsize, int ysize)\n{\n\tregister int x, y;\n\ttsize_t stripsize = TIFFStripSize(tif);\n\tunsigned char *strip = (unsigned char *)_TIFFmalloc(stripsize);\n\n\tfor (y = 0; y <= ysize; y += rowsperstrip) {\n\t\tregister unsigned char *pp = strip;\n\t\tregister uint32 n;\n\n\t\tn = rowsperstrip;\n\t\tif (n > ysize-y+1)\n\t\t\tn = ysize-y+1;\n\t\tdo {\n\t\t\tfor (x = 0; x <= xsize; x++) {\n\t\t\t\tuint32 v = ss[x];\n\t\t\t\tpp[0] = v;\n\t\t\t\tpp[1] = v >> 8;\n\t\t\t\tpp[2] = v >> 16;\n\t\t\t\tpp += 3;\n\t\t\t}\n\t\t\tss += xsize+1;\n\t\t} while (--n);\n\t\tif (TIFFWriteEncodedStrip(tif, TIFFComputeStrip(tif,y,0),\n\t\t    strip, stripsize) < 0)\n\t\t\tbreak;\n\t}\n\t_TIFFfree(strip);\n}\n\n#undef RED\n#undef GREEN\n#undef BLUE\n#define\tCVT(x)\t(((x)*255)/100)\n#define\tRED\tCVT(28)\t\t/* 28% */\n#define\tGREEN\tCVT(59)\t\t/* 59% */\n#define\tBLUE\tCVT(11)\t\t/* 11% */\n\nstatic void\nsvGrey(TIFF* tif, uint32* ss, int xsize, int ysize)\n{\n\tregister int x, y;\n\tunsigned char *buf = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(tif));\n\n\tfor (y = 0; y <= ysize; y++) {\n\t\tfor (x = 0; x <= xsize; x++) {\n\t\t\tunsigned char *cp = (unsigned char *)&ss[x];\n\t\t\tbuf[x] = (RED*cp[3] + GREEN*cp[2] + BLUE*cp[1]) >> 8;\n\t\t}\n\t\tif (TIFFWriteScanline(tif, buf, (uint32) y, 0) < 0)\n\t\t\tbreak;\n\t\tss += xsize+1;\n\t}\n\t_TIFFfree(buf);\n}\n\n#define\tMIN(a,b)\t((a)<(b)?(a):(b))\n#define\tABS(x)\t\t((x)<0?-(x):(x))\n\nstatic void\ntiffsv(char* name, int x1, int x2, int y1, int y2)\n{\n\tTIFF *tif;\n\tint xsize, ysize;\n\tint xorg, yorg;\n\tuint32 *scrbuf;\n\n\txorg = MIN(x1,x2);\n\tyorg = MIN(y1,y2);\n\tif (xorg<0)\n\t\txorg = 0;\n\tif (yorg<0)\n\t\tyorg = 0;\n\txsize = ABS(x2-x1);\n\tysize = ABS(y2-y1);\n\tif (xorg+xsize > xmaxscreen)\n\t\txsize = xmaxscreen-xorg;\n\tif (yorg+ysize > ymaxscreen)\n\t\tysize = ymaxscreen-yorg;\n\ttif = TIFFOpen(name, \"w\");\n\tTIFFSetField(tif, TIFFTAG_IMAGEWIDTH, (uint32) (xsize+1));\n\tTIFFSetField(tif, TIFFTAG_IMAGELENGTH, (uint32) (ysize+1));\n\tTIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 8);\n\tTIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL,\n\t    photometric == PHOTOMETRIC_RGB ? 3 : 1);\n\tTIFFSetField(tif, TIFFTAG_PLANARCONFIG, config);\n\tTIFFSetField(tif, TIFFTAG_COMPRESSION, compression);\n\tswitch (compression) {\n\tcase COMPRESSION_JPEG:\n\t\tif (photometric == PHOTOMETRIC_RGB && jpegcolormode == JPEGCOLORMODE_RGB)\n\t\t\tphotometric = PHOTOMETRIC_YCBCR;\n\t\tTIFFSetField(tif, TIFFTAG_JPEGQUALITY, quality);\n\t\tTIFFSetField(tif, TIFFTAG_JPEGCOLORMODE, jpegcolormode);\n\t\tbreak;\n\tcase COMPRESSION_LZW:\n\t\tif (predictor != 0)\n\t\t\tTIFFSetField(tif, TIFFTAG_PREDICTOR, predictor);\n\t\tbreak;\n\t}\n\tTIFFSetField(tif, TIFFTAG_PHOTOMETRIC, photometric);\n\tTIFFSetField(tif, TIFFTAG_ORIENTATION, ORIENTATION_BOTLEFT);\n\trowsperstrip = TIFFDefaultStripSize(tif, rowsperstrip);\n\tTIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, rowsperstrip);\n\tscrbuf = (uint32 *)_TIFFmalloc((xsize+1)*(ysize+1)*sizeof (uint32));\n\treaddisplay(xorg, yorg, xorg+xsize, yorg+ysize, scrbuf, RD_FREEZE);\n\tif (photometric == PHOTOMETRIC_RGB) {\n\t\tif (config == PLANARCONFIG_SEPARATE)\n\t\t\tsvRGBSeparate(tif, scrbuf, xsize, ysize);\n\t\telse\n\t\t\tsvRGBContig(tif, scrbuf, xsize, ysize);\n\t} else\n\t\tsvGrey(tif, scrbuf, xsize, ysize);\n\t(void) TIFFClose(tif);\n\t_TIFFfree((char *)scrbuf);\n}\n"
  },
  {
    "path": "src/main/jni/tiff/tools/thumbnail.c",
    "content": "/* $Id: thumbnail.c,v 1.9 2005/06/23 10:54:02 dron Exp $ */\n\n/*\n * Copyright (c) 1994-1997 Sam Leffler\n * Copyright (c) 1994-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n#include \"tif_config.h\"\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n\n#ifdef HAVE_UNISTD_H\n# include <unistd.h>\n#endif\n\n#include \"tiffio.h\"\n\n#ifndef HAVE_GETOPT\nextern int getopt(int, char**, char*);\n#endif\n\n#define\tstreq(a,b)\t(strcmp(a,b) == 0)\n\n#ifndef TIFFhowmany8\n# define TIFFhowmany8(x) (((x)&0x07)?((uint32)(x)>>3)+1:(uint32)(x)>>3)\n#endif\n\ntypedef enum {\n    EXP50,\n    EXP60,\n    EXP70,\n    EXP80,\n    EXP90,\n    EXP,\n    LINEAR\n} Contrast;\n\nstatic\tuint32 tnw = 216;\t\t/* thumbnail width */\nstatic\tuint32 tnh = 274;\t\t/* thumbnail height */\nstatic\tContrast contrast = LINEAR;\t/* current contrast */\nstatic\tuint8* thumbnail;\n\nstatic\tint cpIFD(TIFF*, TIFF*);\nstatic\tint generateThumbnail(TIFF*, TIFF*);\nstatic\tvoid initScale();\nstatic\tvoid usage(void);\n\nextern\tchar* optarg;\nextern\tint optind;\n\nint\nmain(int argc, char* argv[])\n{\n    TIFF* in;\n    TIFF* out;\n    int c;\n\n    while ((c = getopt(argc, argv, \"w:h:c:\")) != -1) {\n\tswitch (c) {\n\tcase 'w':\ttnw = strtoul(optarg, NULL, 0); break;\n\tcase 'h':\ttnh = strtoul(optarg, NULL, 0); break;\n\tcase 'c':\tcontrast = streq(optarg, \"exp50\") ? EXP50 :\n\t\t\t\t   streq(optarg, \"exp60\") ? EXP60 :\n\t\t\t\t   streq(optarg, \"exp70\") ? EXP70 :\n\t\t\t\t   streq(optarg, \"exp80\") ? EXP80 :\n\t\t\t\t   streq(optarg, \"exp90\") ? EXP90 :\n\t\t\t\t   streq(optarg, \"exp\")   ? EXP :\n\t\t\t\t   streq(optarg, \"linear\")? LINEAR :\n\t\t\t\t\t\t\t    EXP;\n\t\t\tbreak;\n\tdefault:\tusage();\n\t}\n    }\n    if (argc-optind != 2)\n\tusage();\n\n    out = TIFFOpen(argv[optind+1], \"w\");\n    if (out == NULL)\n\treturn 2;\n    in = TIFFOpen(argv[optind], \"r\");\n\n    thumbnail = (uint8*) _TIFFmalloc(tnw * tnh);\n    if (!thumbnail) {\n\t    TIFFError(TIFFFileName(in),\n\t\t      \"Can't allocate space for thumbnail buffer.\");\n\t    return 1;\n    }\n\n    if (in != NULL) {\n\tinitScale();\n\tdo {\n\t    if (!generateThumbnail(in, out))\n\t\tgoto bad;\n\t    if (!cpIFD(in, out) || !TIFFWriteDirectory(out))\n\t\tgoto bad;\n\t} while (TIFFReadDirectory(in));\n\t(void) TIFFClose(in);\n    }\n    (void) TIFFClose(out);\n    return 0;\nbad:\n    (void) TIFFClose(out);\n    return 1;\n}\n\n#define\tCopyField(tag, v) \\\n    if (TIFFGetField(in, tag, &v)) TIFFSetField(out, tag, v)\n#define\tCopyField2(tag, v1, v2) \\\n    if (TIFFGetField(in, tag, &v1, &v2)) TIFFSetField(out, tag, v1, v2)\n#define\tCopyField3(tag, v1, v2, v3) \\\n    if (TIFFGetField(in, tag, &v1, &v2, &v3)) TIFFSetField(out, tag, v1, v2, v3)\n#define\tCopyField4(tag, v1, v2, v3, v4) \\\n    if (TIFFGetField(in, tag, &v1, &v2, &v3, &v4)) TIFFSetField(out, tag, v1, v2, v3, v4)\n\nstatic void\ncpTag(TIFF* in, TIFF* out, uint16 tag, uint16 count, TIFFDataType type)\n{\n\tswitch (type) {\n\tcase TIFF_SHORT:\n\t\tif (count == 1) {\n\t\t\tuint16 shortv;\n\t\t\tCopyField(tag, shortv);\n\t\t} else if (count == 2) {\n\t\t\tuint16 shortv1, shortv2;\n\t\t\tCopyField2(tag, shortv1, shortv2);\n\t\t} else if (count == 4) {\n\t\t\tuint16 *tr, *tg, *tb, *ta;\n\t\t\tCopyField4(tag, tr, tg, tb, ta);\n\t\t} else if (count == (uint16) -1) {\n\t\t\tuint16 shortv1;\n\t\t\tuint16* shortav;\n\t\t\tCopyField2(tag, shortv1, shortav);\n\t\t}\n\t\tbreak;\n\tcase TIFF_LONG:\n\t\t{ uint32 longv;\n\t\t  CopyField(tag, longv);\n\t\t}\n\t\tbreak;\n\tcase TIFF_RATIONAL:\n\t\tif (count == 1) {\n\t\t\tfloat floatv;\n\t\t\tCopyField(tag, floatv);\n\t\t} else if (count == (uint16) -1) {\n\t\t\tfloat* floatav;\n\t\t\tCopyField(tag, floatav);\n\t\t}\n\t\tbreak;\n\tcase TIFF_ASCII:\n\t\t{ char* stringv;\n\t\t  CopyField(tag, stringv);\n\t\t}\n\t\tbreak;\n\tcase TIFF_DOUBLE:\n\t\tif (count == 1) {\n\t\t\tdouble doublev;\n\t\t\tCopyField(tag, doublev);\n\t\t} else if (count == (uint16) -1) {\n\t\t\tdouble* doubleav;\n\t\t\tCopyField(tag, doubleav);\n\t\t}\n\t\tbreak;\n          default:\n                TIFFError(TIFFFileName(in),\n                          \"Data type %d is not supported, tag %d skipped.\",\n                          tag, type);\n\t}\n}\n\n#undef CopyField4\n#undef CopyField3\n#undef CopyField2\n#undef CopyField\n\nstatic struct cpTag {\n    uint16\ttag;\n    uint16\tcount;\n    TIFFDataType type;\n} tags[] = {\n    { TIFFTAG_IMAGEWIDTH,\t\t1, TIFF_LONG },\n    { TIFFTAG_IMAGELENGTH,\t\t1, TIFF_LONG },\n    { TIFFTAG_BITSPERSAMPLE,\t\t1, TIFF_SHORT },\n    { TIFFTAG_COMPRESSION,\t\t1, TIFF_SHORT },\n    { TIFFTAG_FILLORDER,\t\t1, TIFF_SHORT },\n    { TIFFTAG_SAMPLESPERPIXEL,\t\t1, TIFF_SHORT },\n    { TIFFTAG_ROWSPERSTRIP,\t\t1, TIFF_LONG },\n    { TIFFTAG_PLANARCONFIG,\t\t1, TIFF_SHORT },\n    { TIFFTAG_GROUP3OPTIONS,\t\t1, TIFF_LONG },\n    { TIFFTAG_SUBFILETYPE,\t\t1, TIFF_LONG },\n    { TIFFTAG_PHOTOMETRIC,\t\t1, TIFF_SHORT },\n    { TIFFTAG_THRESHHOLDING,\t\t1, TIFF_SHORT },\n    { TIFFTAG_DOCUMENTNAME,\t\t1, TIFF_ASCII },\n    { TIFFTAG_IMAGEDESCRIPTION,\t\t1, TIFF_ASCII },\n    { TIFFTAG_MAKE,\t\t\t1, TIFF_ASCII },\n    { TIFFTAG_MODEL,\t\t\t1, TIFF_ASCII },\n    { TIFFTAG_ORIENTATION,\t\t1, TIFF_SHORT },\n    { TIFFTAG_MINSAMPLEVALUE,\t\t1, TIFF_SHORT },\n    { TIFFTAG_MAXSAMPLEVALUE,\t\t1, TIFF_SHORT },\n    { TIFFTAG_XRESOLUTION,\t\t1, TIFF_RATIONAL },\n    { TIFFTAG_YRESOLUTION,\t\t1, TIFF_RATIONAL },\n    { TIFFTAG_PAGENAME,\t\t\t1, TIFF_ASCII },\n    { TIFFTAG_XPOSITION,\t\t1, TIFF_RATIONAL },\n    { TIFFTAG_YPOSITION,\t\t1, TIFF_RATIONAL },\n    { TIFFTAG_GROUP4OPTIONS,\t\t1, TIFF_LONG },\n    { TIFFTAG_RESOLUTIONUNIT,\t\t1, TIFF_SHORT },\n    { TIFFTAG_PAGENUMBER,\t\t2, TIFF_SHORT },\n    { TIFFTAG_SOFTWARE,\t\t\t1, TIFF_ASCII },\n    { TIFFTAG_DATETIME,\t\t\t1, TIFF_ASCII },\n    { TIFFTAG_ARTIST,\t\t\t1, TIFF_ASCII },\n    { TIFFTAG_HOSTCOMPUTER,\t\t1, TIFF_ASCII },\n    { TIFFTAG_WHITEPOINT,\t\t1, TIFF_RATIONAL },\n    { TIFFTAG_PRIMARYCHROMATICITIES,\t(uint16) -1,TIFF_RATIONAL },\n    { TIFFTAG_HALFTONEHINTS,\t\t2, TIFF_SHORT },\n    { TIFFTAG_BADFAXLINES,\t\t1, TIFF_LONG },\n    { TIFFTAG_CLEANFAXDATA,\t\t1, TIFF_SHORT },\n    { TIFFTAG_CONSECUTIVEBADFAXLINES,\t1, TIFF_LONG },\n    { TIFFTAG_INKSET,\t\t\t1, TIFF_SHORT },\n    { TIFFTAG_INKNAMES,\t\t\t1, TIFF_ASCII },\n    { TIFFTAG_DOTRANGE,\t\t\t2, TIFF_SHORT },\n    { TIFFTAG_TARGETPRINTER,\t\t1, TIFF_ASCII },\n    { TIFFTAG_SAMPLEFORMAT,\t\t1, TIFF_SHORT },\n    { TIFFTAG_YCBCRCOEFFICIENTS,\t(uint16) -1,TIFF_RATIONAL },\n    { TIFFTAG_YCBCRSUBSAMPLING,\t\t2, TIFF_SHORT },\n    { TIFFTAG_YCBCRPOSITIONING,\t\t1, TIFF_SHORT },\n    { TIFFTAG_REFERENCEBLACKWHITE,\t(uint16) -1,TIFF_RATIONAL },\n    { TIFFTAG_EXTRASAMPLES,\t\t(uint16) -1, TIFF_SHORT },\n};\n#define\tNTAGS\t(sizeof (tags) / sizeof (tags[0]))\n\nstatic void\ncpTags(TIFF* in, TIFF* out)\n{\n    struct cpTag *p;\n    for (p = tags; p < &tags[NTAGS]; p++)\n\tcpTag(in, out, p->tag, p->count, p->type);\n}\n#undef NTAGS\n\nstatic int\ncpStrips(TIFF* in, TIFF* out)\n{\n    tsize_t bufsize  = TIFFStripSize(in);\n    unsigned char *buf = (unsigned char *)_TIFFmalloc(bufsize);\n\n    if (buf) {\n\ttstrip_t s, ns = TIFFNumberOfStrips(in);\n\ttsize_t *bytecounts;\n\n\tTIFFGetField(in, TIFFTAG_STRIPBYTECOUNTS, &bytecounts);\n\tfor (s = 0; s < ns; s++) {\n\t    if (bytecounts[s] > bufsize) {\n\t\tbuf = (unsigned char *)_TIFFrealloc(buf, bytecounts[s]);\n\t\tif (!buf)\n\t\t    goto bad;\n\t\tbufsize = bytecounts[s];\n\t    }\n\t    if (TIFFReadRawStrip(in, s, buf, bytecounts[s]) < 0 ||\n\t\tTIFFWriteRawStrip(out, s, buf, bytecounts[s]) < 0) {\n\t\t_TIFFfree(buf);\n\t\treturn 0;\n\t    }\n\t}\n\t_TIFFfree(buf);\n\treturn 1;\n    }\n\nbad:\n\tTIFFError(TIFFFileName(in),\n\t\t  \"Can't allocate space for strip buffer.\");\n\treturn 0;\n}\n\nstatic int\ncpTiles(TIFF* in, TIFF* out)\n{\n    tsize_t bufsize = TIFFTileSize(in);\n    unsigned char *buf = (unsigned char *)_TIFFmalloc(bufsize);\n\n    if (buf) {\n\tttile_t t, nt = TIFFNumberOfTiles(in);\n\ttsize_t *bytecounts;\n\n\tTIFFGetField(in, TIFFTAG_TILEBYTECOUNTS, &bytecounts);\n\tfor (t = 0; t < nt; t++) {\n\t    if (bytecounts[t] > bufsize) {\n\t\tbuf = (unsigned char *)_TIFFrealloc(buf, bytecounts[t]);\n\t\tif (!buf)\n\t\t    goto bad;\n\t\tbufsize = bytecounts[t];\n\t    }\n\t    if (TIFFReadRawTile(in, t, buf, bytecounts[t]) < 0 ||\n\t\tTIFFWriteRawTile(out, t, buf, bytecounts[t]) < 0) {\n\t\t_TIFFfree(buf);\n\t\treturn 0;\n\t    }\n\t}\n\t_TIFFfree(buf);\n\treturn 1;\n    }\n\nbad:\n    TIFFError(TIFFFileName(in),\n\t\t  \"Can't allocate space for tile buffer.\");\n\treturn (0);\n}\n\nstatic int\ncpIFD(TIFF* in, TIFF* out)\n{\n    cpTags(in, out);\n    if (TIFFIsTiled(in)) {\n\tif (!cpTiles(in, out))\n\t    return (0);\n    } else {\n\tif (!cpStrips(in, out))\n\t    return (0);\n    }\n    return (1);\n}\n\nstatic\tuint16\tphotometric;\t\t/* current photometric of raster */\nstatic\tuint16\tfilterWidth;\t\t/* filter width in pixels */\nstatic\tuint32\tstepSrcWidth;\t\t/* src image stepping width */\nstatic\tuint32\tstepDstWidth;\t\t/* dest stepping width */\nstatic\tuint8* src0;\t\t\t/* horizontal bit stepping (start) */\nstatic\tuint8* src1;\t\t\t/* horizontal bit stepping (middle) */\nstatic\tuint8* src2;\t\t\t/* horizontal bit stepping (end) */\nstatic\tuint32* rowoff;\t\t\t/* row offset for stepping */\nstatic\tuint8 cmap[256];\t\t/* colormap indexes */\nstatic\tuint8 bits[256];\t\t/* count of bits set */\n\nstatic void\nsetupBitsTables()\n{\n    int i;\n    for (i = 0; i < 256; i++) {\n\tint n = 0;\n\tif (i&0x01) n++;\n\tif (i&0x02) n++;\n\tif (i&0x04) n++;\n\tif (i&0x08) n++;\n\tif (i&0x10) n++;\n\tif (i&0x20) n++;\n\tif (i&0x40) n++;\n\tif (i&0x80) n++;\n\tbits[i] = n;\n    }\n}\n\nstatic int clamp(float v, int low, int high)\n    { return (v < low ? low : v > high ? high : (int)v); }\n\n#ifndef M_E\n#define M_E\t\t2.7182818284590452354\n#endif\n\nstatic void\nexpFill(float pct[], uint32 p, uint32 n)\n{\n    uint32 i;\n    uint32 c = (p * n) / 100;\n    for (i = 1; i < c; i++)\n\tpct[i] = (float) (1-exp(i/((double)(n-1)))/ M_E);\n    for (; i < n; i++)\n\tpct[i] = 0.;\n}\n\nstatic void\nsetupCmap()\n{\n    float pct[256];\t\t\t/* known to be large enough */\n    uint32 i;\n    pct[0] = 1;\t\t\t\t/* force white */\n    switch (contrast) {\n    case EXP50: expFill(pct, 50, 256); break;\n    case EXP60:\texpFill(pct, 60, 256); break;\n    case EXP70:\texpFill(pct, 70, 256); break;\n    case EXP80:\texpFill(pct, 80, 256); break;\n    case EXP90:\texpFill(pct, 90, 256); break;\n    case EXP:\texpFill(pct, 100, 256); break;\n    case LINEAR:\n\tfor (i = 1; i < 256; i++)\n\t    pct[i] = 1-((float)i)/(256-1);\n\tbreak;\n    }\n    switch (photometric) {\n    case PHOTOMETRIC_MINISWHITE:\n\tfor (i = 0; i < 256; i++)\n\t    cmap[i] = clamp(255*pct[(256-1)-i], 0, 255);\n\tbreak;\n    case PHOTOMETRIC_MINISBLACK:\n\tfor (i = 0; i < 256; i++)\n\t    cmap[i] = clamp(255*pct[i], 0, 255);\n\tbreak;\n    }\n}\n\nstatic void\ninitScale()\n{\n    src0 = (uint8*) _TIFFmalloc(sizeof (uint8) * tnw);\n    src1 = (uint8*) _TIFFmalloc(sizeof (uint8) * tnw);\n    src2 = (uint8*) _TIFFmalloc(sizeof (uint8) * tnw);\n    rowoff = (uint32*) _TIFFmalloc(sizeof (uint32) * tnw);\n    filterWidth = 0;\n    stepDstWidth = stepSrcWidth = 0;\n    setupBitsTables();\n}\n\n/*\n * Calculate the horizontal accumulation parameteres\n * according to the widths of the src and dst images.\n */\nstatic void\nsetupStepTables(uint32 sw)\n{\n    if (stepSrcWidth != sw || stepDstWidth != tnw) {\n\tint step = sw;\n\tint limit = tnw;\n\tint err = 0;\n\tuint32 sx = 0;\n\tuint32 x;\n\tint fw;\n\tuint8 b;\n\tfor (x = 0; x < tnw; x++) {\n\t    uint32 sx0 = sx;\n\t    err += step;\n\t    while (err >= limit) {\n\t\terr -= limit;\n\t\tsx++;\n\t    }\n\t    rowoff[x] = sx0 >> 3;\n\t    fw = sx - sx0;\t\t/* width */\n\t    b = (fw < 8) ? 0xff<<(8-fw) : 0xff;\n\t    src0[x] = b >> (sx0&7);\n\t    fw -= 8 - (sx0&7);\n\t    if (fw < 0)\n\t\tfw = 0;\n\t    src1[x] = fw >> 3;\n\t    fw -= (fw>>3)<<3;\n\t    src2[x] = 0xff << (8-fw);\n\t}\n\tstepSrcWidth = sw;\n\tstepDstWidth = tnw;\n    }\n}\n\nstatic void\nsetrow(uint8* row, uint32 nrows, const uint8* rows[])\n{\n    uint32 x;\n    uint32 area = nrows * filterWidth;\n    for (x = 0; x < tnw; x++) {\n\tuint32 mask0 = src0[x];\n\tuint32 fw = src1[x];\n\tuint32 mask1 = src1[x];\n\tuint32 off = rowoff[x];\n\tuint32 acc = 0;\n\tuint32 y, i;\n\tfor (y = 0; y < nrows; y++) {\n\t    const uint8* src = rows[y] + off;\n\t    acc += bits[*src++ & mask0];\n\t    switch (fw) {\n\t    default:\n\t\tfor (i = fw; i > 8; i--)\n\t\t    acc += bits[*src++];\n\t\t/* fall thru... */\n\t    case 8: acc += bits[*src++];\n\t    case 7: acc += bits[*src++];\n\t    case 6: acc += bits[*src++];\n\t    case 5: acc += bits[*src++];\n\t    case 4: acc += bits[*src++];\n\t    case 3: acc += bits[*src++];\n\t    case 2: acc += bits[*src++];\n\t    case 1: acc += bits[*src++];\n\t    case 0: break;\n\t    }\n\t    acc += bits[*src & mask1];\n\t}\n\t*row++ = cmap[(255*acc)/area];\n    }\n}\n\n/*\n * Install the specified image.  The\n * image is resized to fit the display page using\n * a box filter.  The resultant pixels are mapped\n * with a user-selectable contrast curve.\n */\nstatic void\nsetImage1(const uint8* br, uint32 rw, uint32 rh)\n{\n    int step = rh;\n    int limit = tnh;\n    int err = 0;\n    int bpr = TIFFhowmany8(rw);\n    int sy = 0;\n    uint8* row = thumbnail;\n    uint32 dy;\n    for (dy = 0; dy < tnh; dy++) {\n\tconst uint8* rows[256];\n\tuint32 nrows = 1;\n\tfprintf(stderr, \"bpr=%d, sy=%d, bpr*sy=%d\\n\", bpr, sy, bpr*sy);\n\trows[0] = br + bpr*sy;\n\terr += step;\n\twhile (err >= limit) {\n\t    err -= limit;\n\t    sy++;\n\t    if (err >= limit)\n\t\trows[nrows++] = br + bpr*sy;\n\t}\n\tsetrow(row, nrows, rows);\n\trow += tnw;\n    }\n}\n\nstatic void\nsetImage(const uint8* br, uint32 rw, uint32 rh)\n{\n    filterWidth = (uint16) ceil((double) rw / (double) tnw);\n    setupStepTables(rw);\n    setImage1(br, rw, rh);\n}\n\nstatic int\ngenerateThumbnail(TIFF* in, TIFF* out)\n{\n    unsigned char* raster;\n    unsigned char* rp;\n    uint32 sw, sh, rps;\n    uint16 bps, spp;\n    tsize_t rowsize, rastersize;\n    tstrip_t s, ns = TIFFNumberOfStrips(in);\n    uint32 diroff[1];\n\n    TIFFGetField(in, TIFFTAG_IMAGEWIDTH, &sw);\n    TIFFGetField(in, TIFFTAG_IMAGELENGTH, &sh);\n    TIFFGetFieldDefaulted(in, TIFFTAG_BITSPERSAMPLE, &bps);\n    TIFFGetFieldDefaulted(in, TIFFTAG_SAMPLESPERPIXEL, &spp);\n    TIFFGetFieldDefaulted(in, TIFFTAG_ROWSPERSTRIP, &rps);\n    if (spp != 1 || bps != 1)\n\treturn 0;\n    rowsize = TIFFScanlineSize(in);\n    rastersize = sh * rowsize;\n    fprintf(stderr, \"rastersize=%u\\n\", (unsigned int)rastersize);\n    raster = (unsigned char*)_TIFFmalloc(rastersize);\n    if (!raster) {\n\t    TIFFError(TIFFFileName(in),\n\t\t      \"Can't allocate space for raster buffer.\");\n\t    return 0;\n    }\n    rp = raster;\n    for (s = 0; s < ns; s++) {\n\t(void) TIFFReadEncodedStrip(in, s, rp, -1);\n\trp += rps * rowsize;\n    }\n    TIFFGetField(in, TIFFTAG_PHOTOMETRIC, &photometric);\n    setupCmap();\n    setImage(raster, sw, sh);\n    _TIFFfree(raster);\n\n    TIFFSetField(out, TIFFTAG_SUBFILETYPE, FILETYPE_REDUCEDIMAGE);\n    TIFFSetField(out, TIFFTAG_IMAGEWIDTH, (uint32) tnw);\n    TIFFSetField(out, TIFFTAG_IMAGELENGTH, (uint32) tnh);\n    TIFFSetField(out, TIFFTAG_BITSPERSAMPLE, (uint16) 8);\n    TIFFSetField(out, TIFFTAG_SAMPLESPERPIXEL, (uint16) 1);\n    TIFFSetField(out, TIFFTAG_COMPRESSION, COMPRESSION_PACKBITS);\n    TIFFSetField(out, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISWHITE);\n    TIFFSetField(out, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);\n    TIFFSetField(out, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);\n    cpTag(in, out, TIFFTAG_SOFTWARE,\t\t(uint16) -1, TIFF_ASCII);\n    cpTag(in, out, TIFFTAG_IMAGEDESCRIPTION,\t(uint16) -1, TIFF_ASCII);\n    cpTag(in, out, TIFFTAG_DATETIME,\t\t(uint16) -1, TIFF_ASCII);\n    cpTag(in, out, TIFFTAG_HOSTCOMPUTER,\t(uint16) -1, TIFF_ASCII);\n    diroff[0] = 0;\n    TIFFSetField(out, TIFFTAG_SUBIFD, 1, diroff);\n    return (TIFFWriteEncodedStrip(out, 0, thumbnail, tnw*tnh) != -1 &&\n            TIFFWriteDirectory(out) != -1);\n}\n\nchar* stuff[] = {\n\"usage: thumbnail [options] input.tif output.tif\",\n\"where options are:\",\n\" -h #\t\tspecify thumbnail image height (default is 274)\",\n\" -w #\t\tspecify thumbnail image width (default is 216)\",\n\"\",\n\" -c linear\tuse linear contrast curve\",\n\" -c exp50\tuse 50% exponential contrast curve\",\n\" -c exp60\tuse 60% exponential contrast curve\",\n\" -c exp70\tuse 70% exponential contrast curve\",\n\" -c exp80\tuse 80% exponential contrast curve\",\n\" -c exp90\tuse 90% exponential contrast curve\",\n\" -c exp\t\tuse pure exponential contrast curve\",\nNULL\n};\n\nstatic void\nusage(void)\n{\n\tchar buf[BUFSIZ];\n\tint i;\n\n\tsetbuf(stderr, buf);\n        fprintf(stderr, \"%s\\n\\n\", TIFFGetVersion());\n\tfor (i = 0; stuff[i] != NULL; i++)\n\t\tfprintf(stderr, \"%s\\n\", stuff[i]);\n\texit(-1);\n}\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiff/tools/tiff2bw.c",
    "content": "/* $Id: tiff2bw.c,v 1.12 2006/01/11 17:03:43 fwarmerdam Exp $ */\n\n/*\n * Copyright (c) 1988-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n#include \"tif_config.h\"\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <ctype.h>\n\n#ifdef HAVE_UNISTD_H\n# include <unistd.h>\n#endif\n\n#include \"tiffio.h\"\n\n#define\tstreq(a,b)\t(strcmp((a),(b)) == 0)\n#define\tstrneq(a,b,n)\t(strncmp(a,b,n) == 0)\n\n/* x% weighting -> fraction of full color */\n#define\tPCT(x)\t(((x)*255+127)/100)\nint\tRED = PCT(30);\t\t/* 30% */\nint\tGREEN = PCT(59);\t/* 59% */\nint\tBLUE = PCT(11);\t\t/* 11% */\n\nstatic\tvoid usage(void);\nstatic\tint processCompressOptions(char*);\n\nstatic void\ncompresscontig(unsigned char* out, unsigned char* rgb, uint32 n)\n{\n\tregister int v, red = RED, green = GREEN, blue = BLUE;\n\n\twhile (n-- > 0) {\n\t\tv = red*(*rgb++);\n\t\tv += green*(*rgb++);\n\t\tv += blue*(*rgb++);\n\t\t*out++ = v>>8;\n\t}\n}\n\nstatic void\ncompresssep(unsigned char* out,\n\t    unsigned char* r, unsigned char* g, unsigned char* b, uint32 n)\n{\n\tregister uint32 red = RED, green = GREEN, blue = BLUE;\n\n\twhile (n-- > 0)\n\t\t*out++ = (unsigned char)\n\t\t\t((red*(*r++) + green*(*g++) + blue*(*b++)) >> 8);\n}\n\nstatic int\ncheckcmap(TIFF* tif, int n, uint16* r, uint16* g, uint16* b)\n{\n\twhile (n-- > 0)\n\t\tif (*r++ >= 256 || *g++ >= 256 || *b++ >= 256)\n\t\t\treturn (16);\n\tTIFFWarning(TIFFFileName(tif), \"Assuming 8-bit colormap\");\n\treturn (8);\n}\n\nstatic void\ncompresspalette(unsigned char* out, unsigned char* data, uint32 n, uint16* rmap, uint16* gmap, uint16* bmap)\n{\n\tregister int v, red = RED, green = GREEN, blue = BLUE;\n\n\twhile (n-- > 0) {\n\t\tunsigned int ix = *data++;\n\t\tv = red*rmap[ix];\n\t\tv += green*gmap[ix];\n\t\tv += blue*bmap[ix];\n\t\t*out++ = v>>8;\n\t}\n}\n\nstatic\tuint16 compression = (uint16) -1;\nstatic\tuint16 predictor = 0;\nstatic\tint jpegcolormode = JPEGCOLORMODE_RGB;\nstatic\tint quality = 75;\t\t/* JPEG quality */\n\nstatic\tvoid cpTags(TIFF* in, TIFF* out);\n\nint\nmain(int argc, char* argv[])\n{\n\tuint32 rowsperstrip = (uint32) -1;\n\tTIFF *in, *out;\n\tuint32 w, h;\n\tuint16 samplesperpixel;\n\tuint16 bitspersample;\n\tuint16 config;\n\tuint16 photometric;\n\tuint16* red;\n\tuint16* green;\n\tuint16* blue;\n\ttsize_t rowsize;\n\tregister uint32 row;\n\tregister tsample_t s;\n\tunsigned char *inbuf, *outbuf;\n\tchar thing[1024];\n\tint c;\n\textern int optind;\n\textern char *optarg;\n\n\twhile ((c = getopt(argc, argv, \"c:r:R:G:B:\")) != -1)\n\t\tswitch (c) {\n\t\tcase 'c':\t\t/* compression scheme */\n\t\t\tif (!processCompressOptions(optarg))\n\t\t\t\tusage();\n\t\t\tbreak;\n\t\tcase 'r':\t\t/* rows/strip */\n\t\t\trowsperstrip = atoi(optarg);\n\t\t\tbreak;\n\t\tcase 'R':\n\t\t\tRED = PCT(atoi(optarg));\n\t\t\tbreak;\n\t\tcase 'G':\n\t\t\tGREEN = PCT(atoi(optarg));\n\t\t\tbreak;\n\t\tcase 'B':\n\t\t\tBLUE = PCT(atoi(optarg));\n\t\t\tbreak;\n\t\tcase '?':\n\t\t\tusage();\n\t\t\t/*NOTREACHED*/\n\t\t}\n\tif (argc - optind < 2)\n\t\tusage();\n\tin = TIFFOpen(argv[optind], \"r\");\n\tif (in == NULL)\n\t\treturn (-1);\n\tphotometric = 0;\n\tTIFFGetField(in, TIFFTAG_PHOTOMETRIC, &photometric);\n\tif (photometric != PHOTOMETRIC_RGB && photometric != PHOTOMETRIC_PALETTE ) {\n\t\tfprintf(stderr,\n\t    \"%s: Bad photometric; can only handle RGB and Palette images.\\n\",\n\t\t    argv[optind]);\n\t\treturn (-1);\n\t}\n\tTIFFGetField(in, TIFFTAG_SAMPLESPERPIXEL, &samplesperpixel);\n\tif (samplesperpixel != 1 && samplesperpixel != 3) {\n\t\tfprintf(stderr, \"%s: Bad samples/pixel %u.\\n\",\n\t\t    argv[optind], samplesperpixel);\n\t\treturn (-1);\n\t}\n\tTIFFGetField(in, TIFFTAG_BITSPERSAMPLE, &bitspersample);\n\tif (bitspersample != 8) {\n\t\tfprintf(stderr,\n\t\t    \" %s: Sorry, only handle 8-bit samples.\\n\", argv[optind]);\n\t\treturn (-1);\n\t}\n\tTIFFGetField(in, TIFFTAG_IMAGEWIDTH, &w);\n\tTIFFGetField(in, TIFFTAG_IMAGELENGTH, &h);\n\tTIFFGetField(in, TIFFTAG_PLANARCONFIG, &config);\n\n\tout = TIFFOpen(argv[optind+1], \"w\");\n\tif (out == NULL)\n\t\treturn (-1);\n\tTIFFSetField(out, TIFFTAG_IMAGEWIDTH, w);\n\tTIFFSetField(out, TIFFTAG_IMAGELENGTH, h);\n\tTIFFSetField(out, TIFFTAG_BITSPERSAMPLE, 8);\n\tTIFFSetField(out, TIFFTAG_SAMPLESPERPIXEL, 1);\n\tTIFFSetField(out, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);\n\tcpTags(in, out);\n\tif (compression != (uint16) -1) {\n\t\tTIFFSetField(out, TIFFTAG_COMPRESSION, compression);\n\t\tswitch (compression) {\n\t\tcase COMPRESSION_JPEG:\n\t\t\tTIFFSetField(out, TIFFTAG_JPEGQUALITY, quality);\n\t\t\tTIFFSetField(out, TIFFTAG_JPEGCOLORMODE, jpegcolormode);\n\t\t\tbreak;\n\t\tcase COMPRESSION_LZW:\n\t\tcase COMPRESSION_DEFLATE:\n\t\t\tif (predictor != 0)\n\t\t\t\tTIFFSetField(out, TIFFTAG_PREDICTOR, predictor);\n\t\t\tbreak;\n\t\t}\n\t}\n\tTIFFSetField(out, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISBLACK);\n\tsprintf(thing, \"B&W version of %s\", argv[optind]);\n\tTIFFSetField(out, TIFFTAG_IMAGEDESCRIPTION, thing);\n\tTIFFSetField(out, TIFFTAG_SOFTWARE, \"tiff2bw\");\n\toutbuf = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(out));\n\tTIFFSetField(out, TIFFTAG_ROWSPERSTRIP,\n\t    TIFFDefaultStripSize(out, rowsperstrip));\n\n#define\tpack(a,b)\t((a)<<8 | (b))\n\tswitch (pack(photometric, config)) {\n\tcase pack(PHOTOMETRIC_PALETTE, PLANARCONFIG_CONTIG):\n\tcase pack(PHOTOMETRIC_PALETTE, PLANARCONFIG_SEPARATE):\n\t\tTIFFGetField(in, TIFFTAG_COLORMAP, &red, &green, &blue);\n\t\t/*\n\t\t * Convert 16-bit colormap to 8-bit (unless it looks\n\t\t * like an old-style 8-bit colormap).\n\t\t */\n\t\tif (checkcmap(in, 1<<bitspersample, red, green, blue) == 16) {\n\t\t\tint i;\n#define\tCVT(x)\t\t(((x) * 255L) / ((1L<<16)-1))\n\t\t\tfor (i = (1<<bitspersample)-1; i >= 0; i--) {\n\t\t\t\tred[i] = CVT(red[i]);\n\t\t\t\tgreen[i] = CVT(green[i]);\n\t\t\t\tblue[i] = CVT(blue[i]);\n\t\t\t}\n#undef CVT\n\t\t}\n\t\tinbuf = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(in));\n\t\tfor (row = 0; row < h; row++) {\n\t\t\tif (TIFFReadScanline(in, inbuf, row, 0) < 0)\n\t\t\t\tbreak;\n\t\t\tcompresspalette(outbuf, inbuf, w, red, green, blue);\n\t\t\tif (TIFFWriteScanline(out, outbuf, row, 0) < 0)\n\t\t\t\tbreak;\n\t\t}\n\t\tbreak;\n\tcase pack(PHOTOMETRIC_RGB, PLANARCONFIG_CONTIG):\n\t\tinbuf = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(in));\n\t\tfor (row = 0; row < h; row++) {\n\t\t\tif (TIFFReadScanline(in, inbuf, row, 0) < 0)\n\t\t\t\tbreak;\n\t\t\tcompresscontig(outbuf, inbuf, w);\n\t\t\tif (TIFFWriteScanline(out, outbuf, row, 0) < 0)\n\t\t\t\tbreak;\n\t\t}\n\t\tbreak;\n\tcase pack(PHOTOMETRIC_RGB, PLANARCONFIG_SEPARATE):\n\t\trowsize = TIFFScanlineSize(in);\n\t\tinbuf = (unsigned char *)_TIFFmalloc(3*rowsize);\n\t\tfor (row = 0; row < h; row++) {\n\t\t\tfor (s = 0; s < 3; s++)\n\t\t\t\tif (TIFFReadScanline(in,\n\t\t\t\t    inbuf+s*rowsize, row, s) < 0)\n\t\t\t\t\t return (-1);\n\t\t\tcompresssep(outbuf,\n\t\t\t    inbuf, inbuf+rowsize, inbuf+2*rowsize, w);\n\t\t\tif (TIFFWriteScanline(out, outbuf, row, 0) < 0)\n\t\t\t\tbreak;\n\t\t}\n\t\tbreak;\n\t}\n#undef pack\n\tTIFFClose(out);\n\treturn (0);\n}\n\nstatic int\nprocessCompressOptions(char* opt)\n{\n\tif (streq(opt, \"none\"))\n\t\tcompression = COMPRESSION_NONE;\n\telse if (streq(opt, \"packbits\"))\n\t\tcompression = COMPRESSION_PACKBITS;\n\telse if (strneq(opt, \"jpeg\", 4)) {\n\t\tchar* cp = strchr(opt, ':');\n\n                compression = COMPRESSION_JPEG;\n                while( cp )\n                {\n                    if (isdigit((int)cp[1]))\n\t\t\tquality = atoi(cp+1);\n                    else if (cp[1] == 'r' )\n\t\t\tjpegcolormode = JPEGCOLORMODE_RAW;\n                    else\n                        usage();\n\n                    cp = strchr(cp+1,':');\n                }\n\t} else if (strneq(opt, \"lzw\", 3)) {\n\t\tchar* cp = strchr(opt, ':');\n\t\tif (cp)\n\t\t\tpredictor = atoi(cp+1);\n\t\tcompression = COMPRESSION_LZW;\n\t} else if (strneq(opt, \"zip\", 3)) {\n\t\tchar* cp = strchr(opt, ':');\n\t\tif (cp)\n\t\t\tpredictor = atoi(cp+1);\n\t\tcompression = COMPRESSION_DEFLATE;\n\t} else\n\t\treturn (0);\n\treturn (1);\n}\n\n#define\tCopyField(tag, v) \\\n    if (TIFFGetField(in, tag, &v)) TIFFSetField(out, tag, v)\n#define\tCopyField2(tag, v1, v2) \\\n    if (TIFFGetField(in, tag, &v1, &v2)) TIFFSetField(out, tag, v1, v2)\n#define\tCopyField3(tag, v1, v2, v3) \\\n    if (TIFFGetField(in, tag, &v1, &v2, &v3)) TIFFSetField(out, tag, v1, v2, v3)\n#define\tCopyField4(tag, v1, v2, v3, v4) \\\n    if (TIFFGetField(in, tag, &v1, &v2, &v3, &v4)) TIFFSetField(out, tag, v1, v2, v3, v4)\n\nstatic void\ncpTag(TIFF* in, TIFF* out, uint16 tag, uint16 count, TIFFDataType type)\n{\n\tswitch (type) {\n\tcase TIFF_SHORT:\n\t\tif (count == 1) {\n\t\t\tuint16 shortv;\n\t\t\tCopyField(tag, shortv);\n\t\t} else if (count == 2) {\n\t\t\tuint16 shortv1, shortv2;\n\t\t\tCopyField2(tag, shortv1, shortv2);\n\t\t} else if (count == 4) {\n\t\t\tuint16 *tr, *tg, *tb, *ta;\n\t\t\tCopyField4(tag, tr, tg, tb, ta);\n\t\t} else if (count == (uint16) -1) {\n\t\t\tuint16 shortv1;\n\t\t\tuint16* shortav;\n\t\t\tCopyField2(tag, shortv1, shortav);\n\t\t}\n\t\tbreak;\n\tcase TIFF_LONG:\n\t\t{ uint32 longv;\n\t\t  CopyField(tag, longv);\n\t\t}\n\t\tbreak;\n\tcase TIFF_RATIONAL:\n\t\tif (count == 1) {\n\t\t\tfloat floatv;\n\t\t\tCopyField(tag, floatv);\n\t\t} else if (count == (uint16) -1) {\n\t\t\tfloat* floatav;\n\t\t\tCopyField(tag, floatav);\n\t\t}\n\t\tbreak;\n\tcase TIFF_ASCII:\n\t\t{ char* stringv;\n\t\t  CopyField(tag, stringv);\n\t\t}\n\t\tbreak;\n\tcase TIFF_DOUBLE:\n\t\tif (count == 1) {\n\t\t\tdouble doublev;\n\t\t\tCopyField(tag, doublev);\n\t\t} else if (count == (uint16) -1) {\n\t\t\tdouble* doubleav;\n\t\t\tCopyField(tag, doubleav);\n\t\t}\n\t\tbreak;\n          default:\n                TIFFError(TIFFFileName(in),\n                          \"Data type %d is not supported, tag %d skipped.\",\n                          tag, type);\n\t}\n}\n\n#undef CopyField4\n#undef CopyField3\n#undef CopyField2\n#undef CopyField\n\nstatic struct cpTag {\n\tuint16\ttag;\n\tuint16\tcount;\n\tTIFFDataType type;\n} tags[] = {\n\t{ TIFFTAG_SUBFILETYPE,\t\t1, TIFF_LONG },\n\t{ TIFFTAG_THRESHHOLDING,\t1, TIFF_SHORT },\n\t{ TIFFTAG_DOCUMENTNAME,\t\t1, TIFF_ASCII },\n\t{ TIFFTAG_IMAGEDESCRIPTION,\t1, TIFF_ASCII },\n\t{ TIFFTAG_MAKE,\t\t\t1, TIFF_ASCII },\n\t{ TIFFTAG_MODEL,\t\t1, TIFF_ASCII },\n\t{ TIFFTAG_MINSAMPLEVALUE,\t1, TIFF_SHORT },\n\t{ TIFFTAG_MAXSAMPLEVALUE,\t1, TIFF_SHORT },\n\t{ TIFFTAG_XRESOLUTION,\t\t1, TIFF_RATIONAL },\n\t{ TIFFTAG_YRESOLUTION,\t\t1, TIFF_RATIONAL },\n\t{ TIFFTAG_PAGENAME,\t\t1, TIFF_ASCII },\n\t{ TIFFTAG_XPOSITION,\t\t1, TIFF_RATIONAL },\n\t{ TIFFTAG_YPOSITION,\t\t1, TIFF_RATIONAL },\n\t{ TIFFTAG_RESOLUTIONUNIT,\t1, TIFF_SHORT },\n\t{ TIFFTAG_SOFTWARE,\t\t1, TIFF_ASCII },\n\t{ TIFFTAG_DATETIME,\t\t1, TIFF_ASCII },\n\t{ TIFFTAG_ARTIST,\t\t1, TIFF_ASCII },\n\t{ TIFFTAG_HOSTCOMPUTER,\t\t1, TIFF_ASCII },\n\t{ TIFFTAG_WHITEPOINT,\t\t1, TIFF_RATIONAL },\n\t{ TIFFTAG_PRIMARYCHROMATICITIES,(uint16) -1,TIFF_RATIONAL },\n\t{ TIFFTAG_HALFTONEHINTS,\t2, TIFF_SHORT },\n\t{ TIFFTAG_INKSET,\t\t1, TIFF_SHORT },\n\t{ TIFFTAG_DOTRANGE,\t\t2, TIFF_SHORT },\n\t{ TIFFTAG_TARGETPRINTER,\t1, TIFF_ASCII },\n\t{ TIFFTAG_SAMPLEFORMAT,\t\t1, TIFF_SHORT },\n\t{ TIFFTAG_YCBCRCOEFFICIENTS,\t(uint16) -1,TIFF_RATIONAL },\n\t{ TIFFTAG_YCBCRSUBSAMPLING,\t2, TIFF_SHORT },\n\t{ TIFFTAG_YCBCRPOSITIONING,\t1, TIFF_SHORT },\n\t{ TIFFTAG_REFERENCEBLACKWHITE,\t(uint16) -1,TIFF_RATIONAL },\n\t{ TIFFTAG_EXTRASAMPLES,\t\t(uint16) -1, TIFF_SHORT },\n\t{ TIFFTAG_SMINSAMPLEVALUE,\t1, TIFF_DOUBLE },\n\t{ TIFFTAG_SMAXSAMPLEVALUE,\t1, TIFF_DOUBLE },\n\t{ TIFFTAG_STONITS,\t\t1, TIFF_DOUBLE },\n};\n#define\tNTAGS\t(sizeof (tags) / sizeof (tags[0]))\n\nstatic void\ncpTags(TIFF* in, TIFF* out)\n{\n    struct cpTag *p;\n    for (p = tags; p < &tags[NTAGS]; p++)\n\tcpTag(in, out, p->tag, p->count, p->type);\n}\n#undef NTAGS\n\nchar* stuff[] = {\n\"usage: tiff2bw [options] input.tif output.tif\",\n\"where options are:\",\n\" -R %\t\tuse #% from red channel\",\n\" -G %\t\tuse #% from green channel\",\n\" -B %\t\tuse #% from blue channel\",\n\"\",\n\" -r #\t\tmake each strip have no more than # rows\",\n\"\",\n\" -c lzw[:opts]\tcompress output with Lempel-Ziv & Welch encoding\",\n\" -c zip[:opts]\tcompress output with deflate encoding\",\n\" -c packbits\tcompress output with packbits encoding\",\n\" -c g3[:opts]\tcompress output with CCITT Group 3 encoding\",\n\" -c g4\t\tcompress output with CCITT Group 4 encoding\",\n\" -c none\tuse no compression algorithm on output\",\n\"\",\n\"LZW and deflate options:\",\n\" #\t\tset predictor value\",\n\"For example, -c lzw:2 to get LZW-encoded data with horizontal differencing\",\nNULL\n};\n\nstatic void\nusage(void)\n{\n\tchar buf[BUFSIZ];\n\tint i;\n\n\tsetbuf(stderr, buf);\n        fprintf(stderr, \"%s\\n\\n\", TIFFGetVersion());\n\tfor (i = 0; stuff[i] != NULL; i++)\n\t\tfprintf(stderr, \"%s\\n\", stuff[i]);\n\texit(-1);\n}\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiff/tools/tiff2pdf.c",
    "content": "/* $Id: tiff2pdf.c,v 1.37.2.7 2009-01-01 00:10:43 bfriesen Exp $\n *\n * tiff2pdf - converts a TIFF image to a PDF document\n *\n * Copyright (c) 2003 Ross Finlayson\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the name of\n * Ross Finlayson may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Ross Finlayson.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL ROSS FINLAYSON BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n#include \"tif_config.h\"\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <ctype.h>\n#include <time.h>\n\n#if HAVE_UNISTD_H\n# include <unistd.h>\n#endif\n\n#ifdef HAVE_FCNTL_H\n# include <fcntl.h>\n#endif\n\n#ifdef HAVE_IO_H\n# include <io.h>\n#endif\n\n#include \"tiffio.h\"\n\n#ifndef HAVE_GETOPT\nextern int getopt(int, char**, char*);\n#endif\n\n#define TIFF2PDF_MODULE \"tiff2pdf\"\n\n#define PS_UNIT_SIZE\t72.0F\n\n/* This type is of PDF color spaces. */\ntypedef enum {\n\tT2P_CS_BILEVEL = 0x01,\t/* Bilevel, black and white */\n\tT2P_CS_GRAY = 0x02,\t/* Single channel */\n\tT2P_CS_RGB = 0x04,\t/* Three channel tristimulus RGB */\n\tT2P_CS_CMYK = 0x08,\t/* Four channel CMYK print inkset */\n\tT2P_CS_LAB = 0x10,\t/* Three channel L*a*b* color space */\n\tT2P_CS_PALETTE = 0x1000,/* One of the above with a color map */\n\tT2P_CS_CALGRAY = 0x20,\t/* Calibrated single channel */\n\tT2P_CS_CALRGB = 0x40,\t/* Calibrated three channel tristimulus RGB */\n\tT2P_CS_ICCBASED = 0x80\t/* ICC profile color specification */\n} t2p_cs_t;\n\n/* This type is of PDF compression types.  */\ntypedef enum{\n\tT2P_COMPRESS_NONE=0x00\n#ifdef CCITT_SUPPORT\n\t, T2P_COMPRESS_G4=0x01\n#endif\n#if defined(JPEG_SUPPORT) || defined(OJPEG_SUPPORT)\n\t, T2P_COMPRESS_JPEG=0x02\n#endif\n#ifdef ZIP_SUPPORT\n\t, T2P_COMPRESS_ZIP=0x04\n#endif\n} t2p_compress_t;\n\n/* This type is whether TIFF image data can be used in PDF without transcoding. */\ntypedef enum{\n\tT2P_TRANSCODE_RAW=0x01, /* The raw data from the input can be used without recompressing */\n\tT2P_TRANSCODE_ENCODE=0x02 /* The data from the input is perhaps unencoded and reencoded */\n} t2p_transcode_t;\n\n/* This type is of information about the data samples of the input image. */\ntypedef enum{\n\tT2P_SAMPLE_NOTHING=0x0000, /* The unencoded samples are normal for the output colorspace */\n\tT2P_SAMPLE_ABGR_TO_RGB=0x0001, /* The unencoded samples are the result of ReadRGBAImage */\n\tT2P_SAMPLE_RGBA_TO_RGB=0x0002, /* The unencoded samples are contiguous RGBA */\n\tT2P_SAMPLE_RGBAA_TO_RGB=0x0004, /* The unencoded samples are RGBA with premultiplied alpha */\n\tT2P_SAMPLE_YCBCR_TO_RGB=0x0008, \n\tT2P_SAMPLE_YCBCR_TO_LAB=0x0010, \n\tT2P_SAMPLE_REALIZE_PALETTE=0x0020, /* The unencoded samples are indexes into the color map */\n\tT2P_SAMPLE_SIGNED_TO_UNSIGNED=0x0040, /* The unencoded samples are signed instead of unsignd */\n\tT2P_SAMPLE_LAB_SIGNED_TO_UNSIGNED=0x0040, /* The L*a*b* samples have a* and b* signed */\n\tT2P_SAMPLE_PLANAR_SEPARATE_TO_CONTIG=0x0100 /* The unencoded samples are separate instead of contiguous */\n} t2p_sample_t;\n\n/* This type is of error status of the T2P struct. */\ntypedef enum{\n\tT2P_ERR_OK = 0, /* This is the value of t2p->t2p_error when there is no error */\n\tT2P_ERR_ERROR = 1 /* This is the value of t2p->t2p_error when there was an error */\n} t2p_err_t;\n\n/* This struct defines a logical page of a TIFF. */\ntypedef struct {\n\ttdir_t page_directory;\n\tuint32 page_number;\n\tttile_t page_tilecount;\n\tuint32 page_extra;\n} T2P_PAGE;\n\n/* This struct defines a PDF rectangle's coordinates. */\ntypedef struct {\n\tfloat x1;\n\tfloat y1;\n\tfloat x2;\n\tfloat y2;\n\tfloat mat[9];\n} T2P_BOX;\n\n/* This struct defines a tile of a PDF.  */\ntypedef struct {\n\tT2P_BOX tile_box;\n} T2P_TILE;\n\n/* This struct defines information about the tiles on a PDF page. */\ntypedef struct {\n\tttile_t tiles_tilecount;\n\tuint32 tiles_tilewidth;\n\tuint32 tiles_tilelength;\n\tuint32 tiles_tilecountx;\n\tuint32 tiles_tilecounty;\n\tuint32 tiles_edgetilewidth;\n\tuint32 tiles_edgetilelength;\n\tT2P_TILE* tiles_tiles;\n} T2P_TILES;\n\n/* This struct is the context of a function to generate PDF from a TIFF. */\ntypedef struct {\n\tt2p_err_t t2p_error;\n\tT2P_PAGE* tiff_pages;\n\tT2P_TILES* tiff_tiles;\n\ttdir_t tiff_pagecount;\n\tuint16 tiff_compression;\n\tuint16 tiff_photometric;\n\tuint16 tiff_fillorder;\n\tuint16 tiff_bitspersample;\n\tuint16 tiff_samplesperpixel;\n\tuint16 tiff_planar;\n\tuint32 tiff_width;\n\tuint32 tiff_length;\n\tfloat tiff_xres;\n\tfloat tiff_yres;\n\tuint16 tiff_orientation;\n\ttoff_t tiff_dataoffset;\n\ttsize_t tiff_datasize;\n\tuint16 tiff_resunit;\n\tuint16 pdf_centimeters;\n\tuint16 pdf_overrideres;\n\tuint16 pdf_overridepagesize;\n\tfloat pdf_defaultxres;\n\tfloat pdf_defaultyres;\n\tfloat pdf_xres;\n\tfloat pdf_yres;\n\tfloat pdf_defaultpagewidth;\n\tfloat pdf_defaultpagelength;\n\tfloat pdf_pagewidth;\n\tfloat pdf_pagelength;\n\tfloat pdf_imagewidth;\n\tfloat pdf_imagelength;\n\tT2P_BOX pdf_mediabox;\n\tT2P_BOX pdf_imagebox;\n\tuint16 pdf_majorversion;\n\tuint16 pdf_minorversion;\n\tuint32 pdf_catalog;\n\tuint32 pdf_pages;\n\tuint32 pdf_info;\n\tuint32 pdf_palettecs;\n\tuint16 pdf_fitwindow;\n\tuint32 pdf_startxref;\n\tunsigned char* pdf_fileid;\n\tunsigned char* pdf_datetime;\n\tunsigned char* pdf_creator;\n\tunsigned char* pdf_author;\n\tunsigned char* pdf_title;\n\tunsigned char* pdf_subject;\n\tunsigned char* pdf_keywords;\n\tt2p_cs_t pdf_colorspace;\n\tuint16 pdf_colorspace_invert;\n\tuint16 pdf_switchdecode;\n\tuint16 pdf_palettesize;\n\tunsigned char* pdf_palette;\n\tint pdf_labrange[4];\n\tt2p_compress_t pdf_defaultcompression;\n\tuint16 pdf_defaultcompressionquality;\n\tt2p_compress_t pdf_compression;\n\tuint16 pdf_compressionquality;\n\tuint16 pdf_nopassthrough;\n\tt2p_transcode_t pdf_transcode;\n\tt2p_sample_t pdf_sample;\n\tuint32* pdf_xrefoffsets;\n\tuint32 pdf_xrefcount;\n\ttdir_t pdf_page;\n#ifdef OJPEG_SUPPORT\n\ttdata_t pdf_ojpegdata;\n\tuint32 pdf_ojpegdatalength;\n\tuint32 pdf_ojpegiflength;\n#endif\n\tfloat tiff_whitechromaticities[2];\n\tfloat tiff_primarychromaticities[6];\n\tfloat tiff_referenceblackwhite[2];\n\tfloat* tiff_transferfunction[3];\n\tint pdf_image_interpolate;\t/* 0 (default) : do not interpolate,\n\t\t\t\t\t   1 : interpolate */\n\tuint16 tiff_transferfunctioncount;\n\tuint32 pdf_icccs;\n\tuint32 tiff_iccprofilelength;\n\ttdata_t tiff_iccprofile;\n\n\t/* fields for custom read/write procedures */\n\tFILE *outputfile;\n\tint outputdisable;\n\ttsize_t outputwritten;\n} T2P;\n\n/* These functions are called by main. */\n\nvoid tiff2pdf_usage(void);\nint tiff2pdf_match_paper_size(float*, float*, char*);\n\n/* These functions are used to generate a PDF from a TIFF. */ \n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\nT2P* t2p_init(void);\nvoid t2p_validate(T2P*);\ntsize_t t2p_write_pdf(T2P*, TIFF*, TIFF*);\nvoid t2p_free(T2P*);\n\n#ifdef __cplusplus\n}\n#endif\n\nvoid t2p_read_tiff_init(T2P*, TIFF*);\nint t2p_cmp_t2p_page(const void*, const void*);\nvoid t2p_read_tiff_data(T2P*, TIFF*);\nvoid t2p_read_tiff_size(T2P*, TIFF*);\nvoid t2p_read_tiff_size_tile(T2P*, TIFF*, ttile_t);\nint t2p_tile_is_right_edge(T2P_TILES, ttile_t);\nint t2p_tile_is_bottom_edge(T2P_TILES, ttile_t);\nint t2p_tile_is_edge(T2P_TILES, ttile_t);\nint t2p_tile_is_corner_edge(T2P_TILES, ttile_t);\ntsize_t t2p_readwrite_pdf_image(T2P*, TIFF*, TIFF*);\ntsize_t t2p_readwrite_pdf_image_tile(T2P*, TIFF*, TIFF*, ttile_t);\n#ifdef OJPEG_SUPPORT\nint t2p_process_ojpeg_tables(T2P*, TIFF*);\n#endif\n#ifdef JPEG_SUPPORT\nint t2p_process_jpeg_strip(unsigned char*, tsize_t*, unsigned char*, tsize_t*, tstrip_t, uint32);\n#endif\nvoid t2p_tile_collapse_left(tdata_t, tsize_t, uint32, uint32, uint32);\nvoid t2p_write_advance_directory(T2P*, TIFF*);\ntsize_t t2p_sample_planar_separate_to_contig(T2P*, unsigned char*, unsigned char*, tsize_t);\ntsize_t t2p_sample_realize_palette(T2P*, unsigned char*);\ntsize_t t2p_sample_abgr_to_rgb(tdata_t, uint32);\ntsize_t t2p_sample_rgba_to_rgb(tdata_t, uint32);\ntsize_t t2p_sample_rgbaa_to_rgb(tdata_t, uint32);\ntsize_t t2p_sample_lab_signed_to_unsigned(tdata_t, uint32);\ntsize_t t2p_write_pdf_header(T2P*, TIFF*);\ntsize_t t2p_write_pdf_obj_start(uint32, TIFF*);\ntsize_t t2p_write_pdf_obj_end(TIFF*);\ntsize_t t2p_write_pdf_name(unsigned char*, TIFF*);\ntsize_t t2p_write_pdf_string(unsigned char*, TIFF*);\ntsize_t t2p_write_pdf_stream(tdata_t, tsize_t, TIFF*);\ntsize_t t2p_write_pdf_stream_start(TIFF*);\ntsize_t t2p_write_pdf_stream_end(TIFF*);\ntsize_t t2p_write_pdf_stream_dict(tsize_t, uint32, TIFF*);\ntsize_t t2p_write_pdf_stream_dict_start(TIFF*);\ntsize_t t2p_write_pdf_stream_dict_end(TIFF*);\ntsize_t t2p_write_pdf_stream_length(tsize_t, TIFF*);\ntsize_t t2p_write_pdf_catalog(T2P*, TIFF*);\ntsize_t t2p_write_pdf_info(T2P*, TIFF*, TIFF*);\nvoid t2p_pdf_currenttime(T2P*);\nvoid t2p_pdf_tifftime(T2P*, TIFF*);\ntsize_t t2p_write_pdf_pages(T2P*, TIFF*);\ntsize_t t2p_write_pdf_page(uint32, T2P*, TIFF*);\nvoid t2p_compose_pdf_page(T2P*);\nvoid t2p_compose_pdf_page_orient(T2P_BOX*, uint16);\nvoid t2p_compose_pdf_page_orient_flip(T2P_BOX*, uint16);\ntsize_t t2p_write_pdf_page_content(T2P*, TIFF*);\ntsize_t t2p_write_pdf_xobject_stream_dict(ttile_t, T2P*, TIFF*);\ntsize_t t2p_write_pdf_xobject_cs(T2P*, TIFF*);\ntsize_t t2p_write_pdf_transfer(T2P*, TIFF*);\ntsize_t t2p_write_pdf_transfer_dict(T2P*, TIFF*, uint16);\ntsize_t t2p_write_pdf_transfer_stream(T2P*, TIFF*, uint16);\ntsize_t t2p_write_pdf_xobject_calcs(T2P*, TIFF*);\ntsize_t t2p_write_pdf_xobject_icccs(T2P*, TIFF*);\ntsize_t t2p_write_pdf_xobject_icccs_dict(T2P*, TIFF*);\ntsize_t t2p_write_pdf_xobject_icccs_stream(T2P*, TIFF*);\ntsize_t t2p_write_pdf_xobject_cs_stream(T2P*, TIFF*);\ntsize_t t2p_write_pdf_xobject_decode(T2P*, TIFF*);\ntsize_t t2p_write_pdf_xobject_stream_filter(ttile_t, T2P*, TIFF*);\ntsize_t t2p_write_pdf_xreftable(T2P*, TIFF*);\ntsize_t t2p_write_pdf_trailer(T2P*, TIFF*);\n\nstatic void\nt2p_disable(TIFF *tif)\n{\n\tT2P *t2p = (T2P*) TIFFClientdata(tif);\n\tt2p->outputdisable = 1;\n}\n\nstatic void\nt2p_enable(TIFF *tif)\n{\n\tT2P *t2p = (T2P*) TIFFClientdata(tif);\n\tt2p->outputdisable = 0;\n}\n\n/*\n * Procs for TIFFClientOpen\n */\n\nstatic tsize_t \nt2pReadFile(TIFF *tif, tdata_t data, tsize_t size)\n{\n\tthandle_t client = TIFFClientdata(tif);\n\tTIFFReadWriteProc proc =  TIFFGetReadProc(tif);\n\tif (proc)\n\t\treturn proc(client, data, size);\n\treturn -1;\n}\n\nstatic tsize_t \nt2pWriteFile(TIFF *tif, tdata_t data, tsize_t size)\n{\n\tthandle_t client = TIFFClientdata(tif);\n\tTIFFReadWriteProc proc =  TIFFGetWriteProc(tif);\n\tif (proc)\n\t\treturn proc(client, data, size);\n\treturn -1;\n}\n\nstatic toff_t\nt2pSeekFile(TIFF *tif, toff_t offset, int whence)\n{\n\tthandle_t client = TIFFClientdata(tif);\n\tTIFFSeekProc proc =  TIFFGetSeekProc(tif);\n\tif (proc)\n\t\treturn proc(client, offset, whence);\n\treturn -1;\n}\n\nstatic tsize_t \nt2p_readproc(thandle_t handle, tdata_t data, tsize_t size) \n{\n\t(void) handle, (void) data, (void) size;\n\treturn -1;\n}\n\nstatic tsize_t \nt2p_writeproc(thandle_t handle, tdata_t data, tsize_t size) \n{\n\tT2P *t2p = (T2P*) handle;\n\tif (t2p->outputdisable <= 0 && t2p->outputfile) {\n\t\ttsize_t written = fwrite(data, 1, size, t2p->outputfile);\n\t\tt2p->outputwritten += written;\n\t\treturn written;\n\t}\n\treturn size; \n}\n\nstatic toff_t \nt2p_seekproc(thandle_t handle, toff_t offset, int whence) \n{ \n\tT2P *t2p = (T2P*) handle;\n\tif (t2p->outputdisable <= 0 && t2p->outputfile)\n\t\treturn fseek(t2p->outputfile, offset, whence);\n\treturn offset;\n}\n\nstatic int \nt2p_closeproc(thandle_t handle)\n{ \n\t(void) handle;\n\treturn 0; \n}\n\nstatic toff_t \nt2p_sizeproc(thandle_t handle) \n{\n\t(void) handle;\n\treturn -1;\n}\n\nstatic int \nt2p_mapproc(thandle_t handle, tdata_t *data, toff_t *offset) \n{ \n\t(void) handle, (void) data, (void) offset;\n\treturn -1; \n}\n\nstatic void \nt2p_unmapproc(thandle_t handle, tdata_t data, toff_t offset)\n{ \n\t(void) handle, (void) data, (void) offset;\n}\n\n/*\n\n  This is the main function.\n\n  The program converts one TIFF file to one PDF file, including multiple page \n  TIFF files, tiled TIFF files, black and white. grayscale, and color TIFF \n  files that contain data of TIFF photometric interpretations of bilevel, \n  grayscale, RGB, YCbCr, CMYK separation, and ICC L*a*b* as supported by \n  libtiff and PDF.\n\n  If you have multiple TIFF files to convert into one PDF file then use tiffcp \n  or other program to concatenate the files into a multiple page TIFF file.  \n  If the input TIFF file is of huge dimensions (greater than 10000 pixels height\n  or width) convert the input image to a tiled TIFF if it is not already.\n\n  The standard output is standard output.  Set the output file name with the \n  \"-o output.pdf\" option.\n\n  All black and white files are compressed into a single strip CCITT G4 Fax \n  compressed PDF, unless tiled, where tiled black and white images are \n  compressed into tiled CCITT G4 Fax compressed PDF, libtiff CCITT support \n  is assumed.\n\n  Color and grayscale data can be compressed using either JPEG compression, \n  ITU-T T.81, or Zip/Deflate LZ77 compression, per PNG 1.2 and RFC 1951.  Set \n  the compression type using the -j or -z options.  JPEG compression support \n  requires that libtiff be configured with JPEG support, and Zip/Deflate \n  compression support requires that libtiff is configured with Zip support, \n  in tiffconf.h.  Use only one or the other of -j and -z.  The -q option \n  sets the image compression quality, that is 1-100 with libjpeg JPEG \n  compression and one of 1, 10, 11, 12, 13, 14, or 15 for PNG group compression \n  predictor methods, add 100, 200, ..., 900 to set zlib compression quality 1-9.\n  PNG Group differencing predictor methods are not currently implemented.\n\n  If the input TIFF contains single strip CCITT G4 Fax compressed information, \n  then that is written to the PDF file without transcoding, unless the options \n  of no compression and no passthrough are set, -d and -n.\n\n  If the input TIFF contains JPEG or single strip Zip/Deflate compressed \n  information, and they are configured, then that is written to the PDF file \n  without transcoding, unless the options of no compression and no passthrough \n  are set.\n\n  The default page size upon which the TIFF image is placed is determined by \n  the resolution and extent of the image data.  Default values for the TIFF \n  image resolution can be set using the -x and -y options.  The page size can \n  be set using the -p option for paper size, or -w and -l for paper width and \n  length, then each page of the TIFF image is centered on its page.  The \n  distance unit for default resolution and page width and length can be set \n  by the -u option, the default unit is inch.\n\n  Various items of the output document information can be set with the -e, -c, \n  -a, -t, -s, and -k tags.  Setting the argument of the option to \"\" for these \n  tags causes the relevant document information field to be not written.  Some \n  of the document information values otherwise get their information from the \n  input TIFF image, the software, author, document name, and image description.\n\n  The output PDF file conforms to the PDF 1.1 specification or PDF 1.2 if using \n  Zip/Deflate compression.  \n  \n  The Portable Document Format (PDF) specification is copyrighted by Adobe \n  Systems, Incorporated.  Todos derechos reservados.\n\n  Here is a listing of the usage example and the options to the tiff2pdf \n  program that is part of the libtiff distribution.  Options followed by \n  a colon have a required argument.\n  \n    usage:  tiff2pdf [options] input.tif\n\n    options:\n    -o: output to file name\n\n    -j: compress with JPEG (requires libjpeg configured with libtiff)\n    -z: compress with Zip/Deflate (requires zlib configured with libtiff)\n    -q: compression quality\n    -n: no compressed data passthrough\n    -d: do not compress (decompress)\n    -i: invert colors\n    -u: set distance unit, 'i' for inch, 'm' for centimeter\n    -x: set x resolution default\n    -y: set y resolution default\n    -w: width in units\n    -l: length in units\n    -r: 'd' for resolution default, 'o' for resolution override\n    -p: paper size, eg \"letter\", \"legal\", \"a4\"\n    -f: set pdf \"fit window\" user preference\n    -b:\tset PDF \"Interpolate\" user preference\n    -e: date, overrides image or current date/time default, YYYYMMDDHHMMSS\n    -c: creator, overrides image software default\n    -a: author, overrides image artist default\n    -t: title, overrides image document name default\n    -s: subject, overrides image image description default\n    -k: keywords\n\n    -h: usage\n\n    examples:\n\n        tiff2pdf -o output.pdf input.tiff\n\n    The above example would generate the file output.pdf from input.tiff.\n\n        tiff2pdf input.tiff\n\n    The above example would generate PDF output from input.tiff and write it \n    to standard output.\n\n        tiff2pdf -j -p letter -o output.pdf input.tiff\n\n    The above example would generate the file output.pdf from input.tiff, \n    putting the image pages on a letter sized page, compressing the output \n    with JPEG.\n\n\tPlease report bugs through:\n\t \n\thttp://bugzilla.remotesensing.org/buglist.cgi?product=libtiff\n\n    See also libtiff.3t, tiffcp.\n  */\n\nint main(int argc, char** argv){\n\n\textern char *optarg;\n\textern int optind;\n\tconst char *outfilename = NULL;\n\tT2P *t2p = NULL;\n\tTIFF *input = NULL, *output = NULL;\n\ttsize_t written = 0;\n\tint c;\n\t\n\tt2p = t2p_init();\n\n\tif (t2p == NULL){\n\t\tTIFFError(TIFF2PDF_MODULE, \"Can't initialize context\");\n\t\tgoto fail;\n\t}\n\n\twhile (argv &&\n\t       (c = getopt(argc, argv,\n\t\t\t   \"o:q:u:x:y:w:l:r:p:e:c:a:t:s:k:jzndifbh\")) != -1){\n\t\tswitch (c) {\n\t\t\tcase 'o':\n\t\t\t\toutfilename = optarg;\n\t\t\t\tbreak;\n#ifdef JPEG_SUPPORT\n\t\t\tcase 'j':  \n\t\t\t\tt2p->pdf_defaultcompression=T2P_COMPRESS_JPEG;\n\t\t\t\tbreak;\n#endif\n#ifndef JPEG_SUPPORT\n\t\t\tcase 'j':  \n\t\t\t\tTIFFWarning(\n\t\t\t\t\tTIFF2PDF_MODULE, \n\t\t\t\t\t\"JPEG support in libtiff required for JPEG compression, ignoring option\");\n\t\t\t\tbreak;\n#endif\n#ifdef ZIP_SUPPORT\n\t\t\tcase 'z':  \n\t\t\t\tt2p->pdf_defaultcompression=T2P_COMPRESS_ZIP;\n\t\t\t\tbreak;\n#endif\n#ifndef ZIP_SUPPORT\n\t\t\tcase 'z':  \n\t\t\t\tTIFFWarning(\n\t\t\t\t\tTIFF2PDF_MODULE, \n\t\t\t\t\t\"Zip support in libtiff required for Zip compression, ignoring option\");\n\t\t\t\tbreak;\n#endif\n\t\t\tcase 'q': \n\t\t\t\tt2p->pdf_defaultcompressionquality=atoi(optarg);\n\t\t\t\tbreak;\n\t\t\tcase 'n': \n\t\t\t\tt2p->pdf_nopassthrough=1;\n\t\t\t\tbreak;\n\t\t\tcase 'd': \n\t\t\t\tt2p->pdf_defaultcompression=T2P_COMPRESS_NONE;\n\t\t\t\tbreak;\n\t\t\tcase 'u': \n\t\t\t\tif(optarg[0]=='m'){\n\t\t\t\t\tt2p->pdf_centimeters=1;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'x': \n\t\t\t\tt2p->pdf_defaultxres = \n\t\t\t\t\t(float)atof(optarg) / (t2p->pdf_centimeters?2.54F:1.0F);\n\t\t\t\tbreak;\n\t\t\tcase 'y': \n\t\t\t\tt2p->pdf_defaultyres = \n\t\t\t\t\t(float)atof(optarg) / (t2p->pdf_centimeters?2.54F:1.0F);\n\t\t\t\tbreak;\n\t\t\tcase 'w': \n\t\t\t\tt2p->pdf_overridepagesize=1;\n\t\t\t\tt2p->pdf_defaultpagewidth = \n\t\t\t\t\t((float)atof(optarg) * PS_UNIT_SIZE) / (t2p->pdf_centimeters?2.54F:1.0F);\n\t\t\t\tbreak;\n\t\t\tcase 'l': \n\t\t\t\tt2p->pdf_overridepagesize=1;\n\t\t\t\tt2p->pdf_defaultpagelength = \n\t\t\t\t\t((float)atof(optarg) * PS_UNIT_SIZE) / (t2p->pdf_centimeters?2.54F:1.0F);\n\t\t\t\tbreak;\n\t\t\tcase 'r': \n\t\t\t\tif(optarg[0]=='o'){\n\t\t\t\t\tt2p->pdf_overrideres=1;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'p': \n\t\t\t\tif(tiff2pdf_match_paper_size(\n\t\t\t\t\t&(t2p->pdf_defaultpagewidth), \n\t\t\t\t\t&(t2p->pdf_defaultpagelength), \n\t\t\t\t\toptarg)){\n\t\t\t\t\tt2p->pdf_overridepagesize=1;\n\t\t\t\t} else {\n\t\t\t\t\tTIFFWarning(TIFF2PDF_MODULE, \n\t\t\t\t\t\"Unknown paper size %s, ignoring option\",\n\t\t\t\t\t\toptarg);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'i':\n\t\t\t\tt2p->pdf_colorspace_invert=1;\n\t\t\t\tbreak;\n\t\t\tcase 'f': \n\t\t\t\tt2p->pdf_fitwindow=1;\n\t\t\t\tbreak;\n\t\t\tcase 'e':\n\t\t\t\tt2p->pdf_datetime =\n\t\t\t\t\t(unsigned char*)_TIFFmalloc(17);\n\t\t\t\tif(t2p->pdf_datetime==NULL){\n\t\t\t\t\tTIFFError(TIFF2PDF_MODULE, \n\t\t\t\t\"Can't allocate %u bytes of memory for main\", \n\t\t\t\t\t\t17); \n\t\t\t\t\tgoto fail;\n\t\t\t\t}\n\t\t\t\tif(strlen(optarg)==0){\n\t\t\t\t\tt2p->pdf_datetime[0] = 0;\n\t\t\t\t} else {\n\t\t\t\t\tif(strlen(optarg)>14){optarg[14]=0;}\n\t\t\t\t\tt2p->pdf_datetime[0] = 'D';\n\t\t\t\t\tt2p->pdf_datetime[1] = ':';\n\t\t\t\t\tstrcpy((char *)t2p->pdf_datetime + 2,\n\t\t\t\t\t       optarg);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'c': \n\t\t\t\tt2p->pdf_creator = (unsigned char *)\n\t\t\t\t\t_TIFFmalloc(strlen(optarg) + 1);\n\t\t\t\tif(t2p->pdf_creator==NULL){\n\t\t\t\t\tTIFFError(TIFF2PDF_MODULE, \n\t\t\t\t\"Can't allocate %u bytes of memory for main\", \n\t\t\t\t\t\t  strlen(optarg) + 1); \n\t\t\t\t\tgoto fail;\n\t\t\t\t}\n\t\t\t\tstrcpy((char *)t2p->pdf_creator, optarg);\n\t\t\t\tt2p->pdf_creator[strlen(optarg)] = 0;\n\t\t\t\tbreak;\n\t\t\tcase 'a': \n\t\t\t\tt2p->pdf_author = (unsigned char *)\n\t\t\t\t\t_TIFFmalloc(strlen(optarg) + 1);\n\t\t\t\tif(t2p->pdf_author==NULL){\n\t\t\t\t\tTIFFError(\n\t\t\t\t\t\tTIFF2PDF_MODULE, \n\t\t\t\t\"Can't allocate %u bytes of memory for main\", \n\t\t\t\t\t\tstrlen(optarg) + 1); \n\t\t\t\t\tgoto fail;\n\t\t\t\t}\n\t\t\t\tstrcpy((char *)t2p->pdf_author, optarg);\n\t\t\t\tt2p->pdf_author[strlen(optarg)]=0;\n\t\t\t\tbreak;\n\t\t\tcase 't': \n\t\t\t\tt2p->pdf_title = (unsigned char*)\n\t\t\t\t\t_TIFFmalloc(strlen(optarg)+1);\n\t\t\t\tif(t2p->pdf_title==NULL){\n\t\t\t\t\tTIFFError(\n\t\t\t\t\t\tTIFF2PDF_MODULE, \n\t\t\t\t\"Can't allocate %u bytes of memory for main\", \n\t\t\t\t\t\tstrlen(optarg) + 1); \n\t\t\t\t\tgoto fail;\n\t\t\t\t}\n\t\t\t\tstrcpy((char *)t2p->pdf_title, optarg);\n\t\t\t\tt2p->pdf_title[strlen(optarg)] = 0;\n\t\t\t\tbreak;\n\t\t\tcase 's': \n\t\t\t\tt2p->pdf_subject = (unsigned char*)\n\t\t\t\t\t_TIFFmalloc(strlen(optarg) + 1);\n\t\t\t\tif(t2p->pdf_subject==NULL){\n\t\t\t\t\tTIFFError(\n\t\t\t\t\t\tTIFF2PDF_MODULE, \n\t\t\t\t\"Can't allocate %u bytes of memory for main\", \n\t\t\t\t\t\tstrlen(optarg)+1); \n\t\t\t\t\tgoto fail;\n\t\t\t\t}\n\t\t\t\tstrcpy((char *)t2p->pdf_subject, optarg);\n\t\t\t\tt2p->pdf_subject[strlen(optarg)]=0;\n\t\t\t\tbreak;\n\t\t\tcase 'k': \n\t\t\t\tt2p->pdf_keywords = (unsigned char*)\n\t\t\t\t\t_TIFFmalloc(strlen(optarg) + 1);\n\t\t\t\tif(t2p->pdf_keywords==NULL){\n\t\t\t\t\tTIFFError(\n\t\t\t\t\t\tTIFF2PDF_MODULE, \n\t\t\t\t\"Can't allocate %u bytes of memory for main\", \n\t\t\t\t\t\tstrlen(optarg) + 1); \n\t\t\t\t\tgoto fail;\n\t\t\t\t}\n\t\t\t\tstrcpy((char *)t2p->pdf_keywords, optarg);\n\t\t\t\tt2p->pdf_keywords[strlen(optarg)] = 0;\n\t\t\t\tbreak;\t\t\n\t\t\tcase 'b':\n\t\t\t\tt2p->pdf_image_interpolate = 1;\n\t\t\t\tbreak;\n\t\t\tcase 'h': \n\t\t\tcase '?': \n\t\t\t\ttiff2pdf_usage();\n\t\t\t\tgoto success;\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\t/*\n\t * Input\n\t */\n\tif(argc > optind) {\n\t\tinput = TIFFOpen(argv[optind++], \"r\");\n\t\tif (input==NULL) {\n\t\t\tTIFFError(TIFF2PDF_MODULE, \n\t\t\t\t  \"Can't open input file %s for reading\", \n\t\t\t\t  argv[optind-1]);\n\t\t\tgoto fail;\n\t\t}\n\t} else {\n\t\tTIFFError(TIFF2PDF_MODULE, \"No input file specified\"); \n\t\ttiff2pdf_usage();\n\t\tgoto fail;\n\t}\n\n\tif(argc > optind) {\n\t\tTIFFError(TIFF2PDF_MODULE, \n\t\t\t  \"No support for multiple input files\"); \n\t\ttiff2pdf_usage();\n\t\tgoto fail;\n\t}\n\n\t/*\n\t * Output\n\t */\n\tt2p->outputdisable = 0;\n\tif (outfilename) {\n\t\tt2p->outputfile = fopen(outfilename, \"wb\");\n\t\tif (t2p->outputfile == NULL) {\n\t\t\tTIFFError(TIFF2PDF_MODULE,\n\t\t\t\t  \"Can't open output file %s for writing\",\n\t\t\t\t  outfilename);\n\t\t\tgoto fail;\n\t\t}\n\t} else {\n\t\toutfilename = \"-\";\n\t\tt2p->outputfile = stdout;\n\t}\n\n\toutput = TIFFClientOpen(outfilename, \"w\", (thandle_t) t2p,\n\t\t\t\tt2p_readproc, t2p_writeproc, t2p_seekproc, \n\t\t\t\tt2p_closeproc, t2p_sizeproc, \n\t\t\t\tt2p_mapproc, t2p_unmapproc );\n\tif (output == NULL) {\n\t\tTIFFError(TIFF2PDF_MODULE,\n\t\t\t  \"Can't initialize output descriptor\");\n\t\tgoto fail;\n\t}\n\t\n\t/*\n\t * Validate\n\t */\n\tt2p_validate(t2p);\n\tt2pSeekFile(output, (toff_t) 0, SEEK_SET);\n\n\t/*\n\t * Write\n\t */\n\twritten = t2p_write_pdf(t2p, input, output);\n\tif (t2p->t2p_error != 0) {\n\t\tTIFFError(TIFF2PDF_MODULE,\n\t\t\t  \"An error occurred creating output PDF file\");\n\t\tgoto fail;\n\t}\n\nsuccess:\n\tif (output != NULL)\n\t\tTIFFClose(output);\n\tif (t2p != NULL)\n\t\tt2p_free(t2p);\n\treturn(EXIT_SUCCESS);\n\nfail:\n\tif(input != NULL)\n\t\tTIFFClose(input);\n\tif (output != NULL)\n\t\tTIFFClose(output);\n\tif (t2p != NULL)\n\t\tt2p_free(t2p);\n\treturn(EXIT_FAILURE);\n  \n}\n\nvoid tiff2pdf_usage(){\n\tchar* lines[]={\n\t\"usage:  tiff2pdf [options] input.tiff\",\n\t\"options:\",\n\t\" -o: output to file name\",\n#ifdef JPEG_SUPPORT\n\t\" -j: compress with JPEG\", \n#endif\n#ifdef ZIP_SUPPORT\n\t\" -z: compress with Zip/Deflate\",\n#endif\n\t\" -q: compression quality\",\n\t\" -n: no compressed data passthrough\",\n\t\" -d: do not compress (decompress)\",\n\t\" -i: invert colors\",\n\t\" -u: set distance unit, 'i' for inch, 'm' for centimeter\",\n\t\" -x: set x resolution default in dots per unit\",\n\t\" -y: set y resolution default in dots per unit\",\n\t\" -w: width in units\",\n\t\" -l: length in units\",\n\t\" -r: 'd' for resolution default, 'o' for resolution override\",\n\t\" -p: paper size, eg \\\"letter\\\", \\\"legal\\\", \\\"A4\\\"\",\n\t\" -f: set PDF \\\"Fit Window\\\" user preference\",\n\t\" -e: date, overrides image or current date/time default, YYYYMMDDHHMMSS\",\n\t\" -c: sets document creator, overrides image software default\",\n\t\" -a: sets document author, overrides image artist default\",\n\t\" -t: sets document title, overrides image document name default\",\n\t\" -s: sets document subject, overrides image image description default\",\n\t\" -k: sets document keywords\",\n\t\" -b: set PDF \\\"Interpolate\\\" user preference\",\n\t\" -h: usage\",\n\tNULL\n\t};\n\tint i=0;\n\n\tfprintf(stderr, \"%s\\n\\n\", TIFFGetVersion());\n\tfor (i=0;lines[i]!=NULL;i++){\n\t\tfprintf(stderr, \"%s\\n\", lines[i]);\n\t}\n\n\treturn;\n}\n\nint tiff2pdf_match_paper_size(float* width, float* length, char* papersize){\n\n\tsize_t i, len;\n\tconst char* sizes[]={\n\t\t\"LETTER\", \"A4\", \"LEGAL\",\n\t\t\"EXECUTIVE\", \"LETTER\", \"LEGAL\", \"LEDGER\", \"TABLOID\", \n\t\t\"A\", \"B\", \"C\", \"D\", \"E\", \"F\", \"G\", \"H\", \"J\", \"K\", \n\t\t\"A10\", \"A9\", \"A8\", \"A7\", \"A6\", \"A5\", \"A4\", \"A3\", \"A2\", \"A1\", \"A0\", \n\t\t\"2A0\", \"4A0\", \"2A\", \"4A\", \n\t\t\"B10\", \"B9\", \"B8\", \"B7\", \"B6\", \"B5\", \"B4\", \"B3\", \"B2\", \"B1\", \"B0\", \n\t\t\"JISB10\", \"JISB9\", \"JISB8\", \"JISB7\", \"JISB6\", \"JISB5\", \"JISB4\", \n\t\t\"JISB3\", \"JISB2\", \"JISB1\", \"JISB0\", \n\t\t\"C10\", \"C9\", \"C8\", \"C7\", \"C6\", \"C5\", \"C4\", \"C3\", \"C2\", \"C1\", \"C0\", \n\t\t\"RA2\", \"RA1\", \"RA0\", \"SRA4\", \"SRA3\", \"SRA2\", \"SRA1\", \"SRA0\", \n\t\t\"A3EXTRA\", \"A4EXTRA\", \n\t\t\"STATEMENT\", \"FOLIO\", \"QUARTO\", \n\t\tNULL\n\t} ;\n\tconst int widths[]={\n\t\t612, 595, 612,\n\t\t522, 612,612,792,792,\n\t\t612,792,1224,1584,2448,2016,792,2016,2448,2880,\n\t\t74,105,147,210,298,420,595,842,1191,1684,2384,3370,4768,3370,4768,\n\t\t88,125,176,249,354,499,709,1001,1417,2004,2835,\n\t\t91,128,181,258,363,516,729,1032,1460,2064,2920,\n\t\t79,113,162,230,323,459,649,918,1298,1298,2599,\n\t\t1219,1729,2438,638,907,1276,1814,2551,\n\t\t914,667,\n\t\t396, 612, 609, \n\t\t0\n\t};\n\tconst int lengths[]={\n\t\t792,842,1008,\n\t\t756,792,1008,1224,1224,\n\t\t792,1224,1584,2448,3168,2880,6480,10296,12672,10296,\n\t\t105,147,210,298,420,595,842,1191,1684,2384,3370,4768,6741,4768,6741,\n\t\t125,176,249,354,499,709,1001,1417,2004,2835,4008,\n\t\t128,181,258,363,516,729,1032,1460,2064,2920,4127,\n\t\t113,162,230,323,459,649,918,1298,1837,1837,3677,\n\t\t1729,2438,3458,907,1276,1814,2551,3628,\n\t\t1262,914,\n\t\t612, 936, 780, \n\t\t0\n\t};\n\n\tlen=strlen(papersize);\n\tfor(i=0;i<len;i++){\n\t\tpapersize[i]=toupper(papersize[i]);\n\t}\n\tfor(i=0;sizes[i]!=NULL; i++){\n\t\tif (strcmp( (const char*)papersize, sizes[i])==0){\n\t\t\t*width=(float)widths[i];\n\t\t\t*length=(float)lengths[i];\n\t\t\treturn(1);\n\t\t}\n\t}\n\n\treturn(0);\n}\n\n/*\n\tThis function allocates and initializes a T2P context struct pointer.\n*/\n\nT2P* t2p_init(){\n\n\tT2P* t2p = (T2P*) _TIFFmalloc(sizeof(T2P));\n\tif(t2p==NULL){\n\t\tTIFFError(\n\t\t\tTIFF2PDF_MODULE, \n\t\t\t\"Can't allocate %u bytes of memory for t2p_init\", \n\t\t\tsizeof(T2P));\n\t\treturn( (T2P*) NULL );\n\t}\n\t_TIFFmemset(t2p, 0x00, sizeof(T2P));\n\tt2p->pdf_majorversion=1;\n\tt2p->pdf_minorversion=1;\n\tt2p->pdf_defaultxres=300.0;\n\tt2p->pdf_defaultyres=300.0;\n\tt2p->pdf_defaultpagewidth=612.0;\n\tt2p->pdf_defaultpagelength=792.0;\n\tt2p->pdf_xrefcount=3; /* Catalog, Info, Pages */\n\t\n\treturn(t2p);\n}\n\n/*\n\tThis function frees a T2P context struct pointer and any allocated data fields of it.\n*/\n\nvoid t2p_free(T2P* t2p){\n\n\tint i=0;\n\n\tif(t2p != NULL){\n\t\tif(t2p->pdf_xrefoffsets != NULL){\n\t\t\t_TIFFfree( (tdata_t) t2p->pdf_xrefoffsets);\n\t\t}\n\t\tif(t2p->tiff_pages != NULL){\n\t\t\t_TIFFfree( (tdata_t) t2p->tiff_pages);\n\t\t}\n\t\tfor(i=0;i<t2p->tiff_pagecount;i++){\n\t\t\tif(t2p->tiff_tiles[i].tiles_tiles != NULL){\n\t\t\t\t_TIFFfree( (tdata_t) t2p->tiff_tiles[i].tiles_tiles);\n\t\t\t}\n\t\t}\n\t\tif(t2p->tiff_tiles != NULL){\n\t\t\t_TIFFfree( (tdata_t) t2p->tiff_tiles);\n\t\t}\n\t\tif(t2p->pdf_palette != NULL){\n\t\t\t_TIFFfree( (tdata_t) t2p->pdf_palette);\n\t\t}\n\t\tif(t2p->pdf_fileid != NULL){\n\t\t\t_TIFFfree( (tdata_t) t2p->pdf_fileid);\n\t\t}\n\t\tif(t2p->pdf_datetime != NULL){\n\t\t\t_TIFFfree( (tdata_t) t2p->pdf_datetime);\n\t\t}\n\t\tif(t2p->pdf_creator != NULL){\n\t\t\t_TIFFfree( (tdata_t) t2p->pdf_creator);\n\t\t}\n\t\tif(t2p->pdf_author != NULL){\n\t\t\t_TIFFfree( (tdata_t) t2p->pdf_author);\n\t\t}\n\t\tif(t2p->pdf_title != NULL){\n\t\t\t_TIFFfree( (tdata_t) t2p->pdf_title);\n\t\t}\n\t\tif(t2p->pdf_subject != NULL){\n\t\t\t_TIFFfree( (tdata_t) t2p->pdf_subject);\n\t\t}\n\t\tif(t2p->pdf_keywords != NULL){\n\t\t\t_TIFFfree( (tdata_t) t2p->pdf_keywords);\n\t\t}\n#ifdef OJPEG_SUPPORT\n\t\tif(t2p->pdf_ojpegdata != NULL){\n\t\t\t_TIFFfree( (tdata_t) t2p->pdf_ojpegdata);\n\t\t}\n#endif\n\t\t_TIFFfree( (tdata_t) t2p );\n\t}\n\n\treturn;\n}\n\n/*\n\tThis function validates the values of a T2P context struct pointer\n        before calling t2p_write_pdf with it.\n*/\n\nvoid t2p_validate(T2P* t2p){\n\n#ifdef JPEG_SUPPORT\n\tif(t2p->pdf_defaultcompression==T2P_COMPRESS_JPEG){\n\t\tif(t2p->pdf_defaultcompressionquality>100 ||\n\t\t\tt2p->pdf_defaultcompressionquality<1){\n\t\t\tt2p->pdf_defaultcompressionquality=0;\n\t\t}\n\t}\n#endif\n#ifdef ZIP_SUPPORT\n\tif(t2p->pdf_defaultcompression==T2P_COMPRESS_ZIP){\n \t\tuint16 m=t2p->pdf_defaultcompressionquality%100;\n \t\tif(t2p->pdf_defaultcompressionquality/100 > 9 ||\n \t\t\t(m>1 && m<10) || m>15){\n \t\t\tt2p->pdf_defaultcompressionquality=0;\n\t\t}\n\t\tif(t2p->pdf_defaultcompressionquality%100 !=0){\n \t\t\tt2p->pdf_defaultcompressionquality/=100;\n \t\t\tt2p->pdf_defaultcompressionquality*=100;\n\t\t\tTIFFError(\n\t\t\t\tTIFF2PDF_MODULE, \n\t\t\t\t\"PNG Group predictor differencing not implemented, assuming compression quality %u\", \n\t\t\t\tt2p->pdf_defaultcompressionquality);\n\t\t}\n\t\tt2p->pdf_defaultcompressionquality%=100;\n\t\tif(t2p->pdf_minorversion<2){t2p->pdf_minorversion=2;}\n\t}\n#endif\n\t(void)0;\n\n\treturn;\n}\n\n\n/*\n\tThis function scans the input TIFF file for pages.  It attempts\n        to determine which IFD's of the TIFF file contain image document\n        pages.  For each, it gathers some information that has to do\n        with the output of the PDF document as a whole.  \n*/\n\nvoid t2p_read_tiff_init(T2P* t2p, TIFF* input){\n\n\ttdir_t directorycount=0;\n\ttdir_t i=0;\n\tuint16 pagen=0;\n\tuint16 paged=0;\n\tuint16 xuint16=0;\n\n\tdirectorycount=TIFFNumberOfDirectories(input);\n\tt2p->tiff_pages = (T2P_PAGE*) _TIFFmalloc(directorycount * sizeof(T2P_PAGE));\n\tif(t2p->tiff_pages==NULL){\n\t\tTIFFError(\n\t\t\tTIFF2PDF_MODULE, \n\t\t\t\"Can't allocate %u bytes of memory for tiff_pages array, %s\", \n\t\t\tdirectorycount * sizeof(T2P_PAGE), \n\t\t\tTIFFFileName(input));\n\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\treturn;\n\t}\n\t_TIFFmemset( t2p->tiff_pages, 0x00, directorycount * sizeof(T2P_PAGE));\n\tt2p->tiff_tiles = (T2P_TILES*) _TIFFmalloc(directorycount * sizeof(T2P_TILES));\n\tif(t2p->tiff_tiles==NULL){\n\t\tTIFFError(\n\t\t\tTIFF2PDF_MODULE, \n\t\t\t\"Can't allocate %u bytes of memory for tiff_tiles array, %s\", \n\t\t\tdirectorycount * sizeof(T2P_TILES), \n\t\t\tTIFFFileName(input));\n\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\treturn;\n\t}\n\t_TIFFmemset( t2p->tiff_tiles, 0x00, directorycount * sizeof(T2P_TILES));\n\tfor(i=0;i<directorycount;i++){\n\t\tuint32 subfiletype = 0;\n\t\t\n\t\tif(!TIFFSetDirectory(input, i)){\n\t\t\tTIFFError(\n\t\t\t\tTIFF2PDF_MODULE, \n\t\t\t\t\"Can't set directory %u of input file %s\", \n\t\t\t\ti,\n\t\t\t\tTIFFFileName(input));\n\t\t\treturn;\n\t\t}\n\t\tif(TIFFGetField(input, TIFFTAG_PAGENUMBER, &pagen, &paged)){\n\t\t\tif((pagen>paged) && (paged != 0)){\n\t\t\t\tt2p->tiff_pages[t2p->tiff_pagecount].page_number = \n\t\t\t\t\tpaged;\n\t\t\t} else {\n\t\t\t\tt2p->tiff_pages[t2p->tiff_pagecount].page_number = \n\t\t\t\t\tpagen;\n\t\t\t}\n\t\t\tgoto ispage2;\n\t\t}\n\t\tif(TIFFGetField(input, TIFFTAG_SUBFILETYPE, &subfiletype)){\n\t\t\tif ( ((subfiletype & FILETYPE_PAGE) != 0)\n                             || (subfiletype == 0)){\n\t\t\t\tgoto ispage;\n\t\t\t} else {\n\t\t\t\tgoto isnotpage;\n\t\t\t}\n\t\t}\n\t\tif(TIFFGetField(input, TIFFTAG_OSUBFILETYPE, &subfiletype)){\n\t\t\tif ((subfiletype == OFILETYPE_IMAGE) \n\t\t\t\t|| (subfiletype == OFILETYPE_PAGE)\n\t\t\t\t|| (subfiletype == 0) ){\n\t\t\t\tgoto ispage;\n\t\t\t} else {\n\t\t\t\tgoto isnotpage;\n\t\t\t}\n\t\t}\n\t\tispage:\n\t\tt2p->tiff_pages[t2p->tiff_pagecount].page_number=t2p->tiff_pagecount;\n\t\tispage2:\n\t\tt2p->tiff_pages[t2p->tiff_pagecount].page_directory=i;\n\t\tif(TIFFIsTiled(input)){\n\t\t\tt2p->tiff_pages[t2p->tiff_pagecount].page_tilecount = \n\t\t\t\tTIFFNumberOfTiles(input);\n\t\t}\n\t\tt2p->tiff_pagecount++;\n\t\tisnotpage:\n\t\t(void)0;\n\t}\n\t\n\tqsort((void*) t2p->tiff_pages, t2p->tiff_pagecount,\n              sizeof(T2P_PAGE), t2p_cmp_t2p_page);\n\n\tfor(i=0;i<t2p->tiff_pagecount;i++){\n\t\tt2p->pdf_xrefcount += 5;\n\t\tTIFFSetDirectory(input, t2p->tiff_pages[i].page_directory );\n\t\tif((TIFFGetField(input, TIFFTAG_PHOTOMETRIC, &xuint16)\n                    && (xuint16==PHOTOMETRIC_PALETTE))\n\t\t   || TIFFGetField(input, TIFFTAG_INDEXED, &xuint16)) {\n\t\t\tt2p->tiff_pages[i].page_extra++;\n\t\t\tt2p->pdf_xrefcount++;\n\t\t}\n#ifdef ZIP_SUPPORT\n\t\tif (TIFFGetField(input, TIFFTAG_COMPRESSION, &xuint16)) {\n                        if( (xuint16== COMPRESSION_DEFLATE ||\n                             xuint16== COMPRESSION_ADOBE_DEFLATE) && \n                            ((t2p->tiff_pages[i].page_tilecount != 0) \n                             || TIFFNumberOfStrips(input)==1) &&\n                            (t2p->pdf_nopassthrough==0)\t){\n                                if(t2p->pdf_minorversion<2){t2p->pdf_minorversion=2;}\n                        }\n                }\n#endif\n\t\tif (TIFFGetField(input, TIFFTAG_TRANSFERFUNCTION,\n                                 &(t2p->tiff_transferfunction[0]),\n                                 &(t2p->tiff_transferfunction[1]),\n                                 &(t2p->tiff_transferfunction[2]))) {\n\t\t\tif(t2p->tiff_transferfunction[1] !=\n\t\t\t   t2p->tiff_transferfunction[0]) {\n\t\t\t\tt2p->tiff_transferfunctioncount = 3;\n\t\t\t\tt2p->tiff_pages[i].page_extra += 4;\n\t\t\t\tt2p->pdf_xrefcount += 4;\n\t\t\t} else {\n\t\t\t\tt2p->tiff_transferfunctioncount = 1;\n\t\t\t\tt2p->tiff_pages[i].page_extra += 2;\n\t\t\t\tt2p->pdf_xrefcount += 2;\n\t\t\t}\n\t\t\tif(t2p->pdf_minorversion < 2)\n\t\t\t\tt2p->pdf_minorversion = 2;\n                } else {\n\t\t\tt2p->tiff_transferfunctioncount=0;\n\t\t}\n\t\tif( TIFFGetField(\n\t\t\tinput, \n\t\t\tTIFFTAG_ICCPROFILE, \n\t\t\t&(t2p->tiff_iccprofilelength), \n\t\t\t&(t2p->tiff_iccprofile)) != 0){\n\t\t\tt2p->tiff_pages[i].page_extra++;\n\t\t\tt2p->pdf_xrefcount++;\n\t\t\tif(t2p->pdf_minorversion<3){t2p->pdf_minorversion=3;}\n\t\t}\n\t\tt2p->tiff_tiles[i].tiles_tilecount=\n\t\t\tt2p->tiff_pages[i].page_tilecount;\n\t\tif( (TIFFGetField(input, TIFFTAG_PLANARCONFIG, &xuint16) != 0)\n\t\t\t&& (xuint16 == PLANARCONFIG_SEPARATE ) ){\n\t\t\t\tTIFFGetField(input, TIFFTAG_SAMPLESPERPIXEL, &xuint16);\n\t\t\t\tt2p->tiff_tiles[i].tiles_tilecount/= xuint16;\n\t\t}\n\t\tif( t2p->tiff_tiles[i].tiles_tilecount > 0){\n\t\t\tt2p->pdf_xrefcount += \n\t\t\t\t(t2p->tiff_tiles[i].tiles_tilecount -1)*2;\n\t\t\tTIFFGetField(input, \n\t\t\t\tTIFFTAG_TILEWIDTH, \n\t\t\t\t&( t2p->tiff_tiles[i].tiles_tilewidth) );\n\t\t\tTIFFGetField(input, \n\t\t\t\tTIFFTAG_TILELENGTH, \n\t\t\t\t&( t2p->tiff_tiles[i].tiles_tilelength) );\n\t\t\tt2p->tiff_tiles[i].tiles_tiles = \n\t\t\t(T2P_TILE*) _TIFFmalloc(\n\t\t\t\tt2p->tiff_tiles[i].tiles_tilecount \n\t\t\t\t* sizeof(T2P_TILE) );\n\t\t\tif( t2p->tiff_tiles[i].tiles_tiles == NULL){\n\t\t\t\tTIFFError(\n\t\t\t\t\tTIFF2PDF_MODULE, \n\t\t\t\t\t\"Can't allocate %u bytes of memory for t2p_read_tiff_init, %s\", \n\t\t\t\t\tt2p->tiff_tiles[i].tiles_tilecount * sizeof(T2P_TILE), \n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn;\n}\n\n/*\n * This function is used by qsort to sort a T2P_PAGE* array of page structures\n * by page number.\n */\n\nint t2p_cmp_t2p_page(const void* e1, const void* e2){\n\n\treturn( ((T2P_PAGE*)e1)->page_number - ((T2P_PAGE*)e2)->page_number );\n}\n\n/*\n\tThis function sets the input directory to the directory of a given\n\tpage and determines information about the image.  It checks\n\tthe image characteristics to determine if it is possible to convert\n\tthe image data into a page of PDF output, setting values of the T2P\n\tstruct for this page.  It determines what color space is used in\n\tthe output PDF to represent the image.\n\t\n\tIt determines if the image can be converted as raw data without\n\trequiring transcoding of the image data.\n*/\n\nvoid t2p_read_tiff_data(T2P* t2p, TIFF* input){\n\n\tint i=0;\n\tuint16* r;\n\tuint16* g;\n\tuint16* b;\n\tuint16* a;\n\tuint16 xuint16;\n\tuint16* xuint16p;\n\tfloat* xfloatp;\n\n\tt2p->pdf_transcode = T2P_TRANSCODE_ENCODE;\n\tt2p->pdf_sample = T2P_SAMPLE_NOTHING;\n        t2p->pdf_switchdecode = t2p->pdf_colorspace_invert;\n        \n\t\n\tTIFFSetDirectory(input, t2p->tiff_pages[t2p->pdf_page].page_directory);\n\n\tTIFFGetField(input, TIFFTAG_IMAGEWIDTH, &(t2p->tiff_width));\n\tif(t2p->tiff_width == 0){\n\t\tTIFFError(\n\t\t\tTIFF2PDF_MODULE, \n\t\t\t\"No support for %s with zero width\", \n\t\t\tTIFFFileName(input)\t);\n\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\treturn;\n\t}\n\n\tTIFFGetField(input, TIFFTAG_IMAGELENGTH, &(t2p->tiff_length));\n\tif(t2p->tiff_length == 0){\n\t\tTIFFError(\n\t\t\tTIFF2PDF_MODULE, \n\t\t\t\"No support for %s with zero length\", \n\t\t\tTIFFFileName(input)\t);\n\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\treturn;\n\t}\n\n        if(TIFFGetField(input, TIFFTAG_COMPRESSION, &(t2p->tiff_compression)) == 0){\n                TIFFError(\n                        TIFF2PDF_MODULE, \n                        \"No support for %s with no compression tag\", \n                        TIFFFileName(input)     );\n                t2p->t2p_error = T2P_ERR_ERROR;\n                return;\n\n        }\n        if( TIFFIsCODECConfigured(t2p->tiff_compression) == 0){\n\t\tTIFFError(\n\t\t\tTIFF2PDF_MODULE, \n\t\t\t\"No support for %s with compression type %u:  not configured\", \n\t\t\tTIFFFileName(input), \n\t\t\tt2p->tiff_compression\t\n\t\t\t);\n\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\treturn;\n\t\n\t}\n\n\tTIFFGetFieldDefaulted(input, TIFFTAG_BITSPERSAMPLE, &(t2p->tiff_bitspersample));\n\tswitch(t2p->tiff_bitspersample){\n\t\tcase 1:\n\t\tcase 2:\n\t\tcase 4:\n\t\tcase 8:\n\t\t\tbreak;\n\t\tcase 0:\n\t\t\tTIFFWarning(\n\t\t\t\tTIFF2PDF_MODULE, \n\t\t\t\t\"Image %s has 0 bits per sample, assuming 1\",\n\t\t\t\tTIFFFileName(input));\n\t\t\tt2p->tiff_bitspersample=1;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tTIFFError(\n\t\t\t\tTIFF2PDF_MODULE, \n\t\t\t\t\"No support for %s with %u bits per sample\",\n\t\t\t\tTIFFFileName(input),\n\t\t\t\tt2p->tiff_bitspersample);\n\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\treturn;\n\t}\n\n\tTIFFGetFieldDefaulted(input, TIFFTAG_SAMPLESPERPIXEL, &(t2p->tiff_samplesperpixel));\n\tif(t2p->tiff_samplesperpixel>4){\n\t\tTIFFError(\n\t\t\tTIFF2PDF_MODULE, \n\t\t\t\"No support for %s with %u samples per pixel\",\n\t\t\tTIFFFileName(input),\n\t\t\tt2p->tiff_samplesperpixel);\n\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\treturn;\n\t}\n\tif(t2p->tiff_samplesperpixel==0){\n\t\tTIFFWarning(\n\t\t\tTIFF2PDF_MODULE, \n\t\t\t\"Image %s has 0 samples per pixel, assuming 1\",\n\t\t\tTIFFFileName(input));\n\t\tt2p->tiff_samplesperpixel=1;\n\t}\n\t\n\tif(TIFFGetField(input, TIFFTAG_SAMPLEFORMAT, &xuint16) != 0 ){\n\t\tswitch(xuint16){\n\t\t\tcase 0:\n\t\t\tcase 1:\n\t\t\tcase 4:\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tTIFFError(\n\t\t\t\t\tTIFF2PDF_MODULE, \n\t\t\t\t\t\"No support for %s with sample format %u\",\n\t\t\t\t\tTIFFFileName(input),\n\t\t\t\t\txuint16);\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\treturn;\n\t\t\t\tbreak;\n\t\t}\n\t}\n\t\n\tTIFFGetFieldDefaulted(input, TIFFTAG_FILLORDER, &(t2p->tiff_fillorder));\n\t\n        if(TIFFGetField(input, TIFFTAG_PHOTOMETRIC, &(t2p->tiff_photometric)) == 0){\n                TIFFError(\n                        TIFF2PDF_MODULE, \n                        \"No support for %s with no photometric interpretation tag\", \n                        TIFFFileName(input)     );\n                t2p->t2p_error = T2P_ERR_ERROR;\n                return;\n\n        }\n        \n\tswitch(t2p->tiff_photometric){\n\t\tcase PHOTOMETRIC_MINISWHITE:\n\t\tcase PHOTOMETRIC_MINISBLACK: \n\t\t\tif (t2p->tiff_bitspersample==1){\n\t\t\t\tt2p->pdf_colorspace=T2P_CS_BILEVEL;\n\t\t\t\tif(t2p->tiff_photometric==PHOTOMETRIC_MINISWHITE){\n\t\t\t\t\tt2p->pdf_switchdecode ^= 1;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tt2p->pdf_colorspace=T2P_CS_GRAY;\n\t\t\t\tif(t2p->tiff_photometric==PHOTOMETRIC_MINISWHITE){\n\t\t\t\t\tt2p->pdf_switchdecode ^= 1;\n\t\t\t\t} \n\t\t\t}\n\t\t\tbreak;\n\t\tcase PHOTOMETRIC_RGB: \n\t\t\tt2p->pdf_colorspace=T2P_CS_RGB;\n\t\t\tif(t2p->tiff_samplesperpixel == 3){\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(TIFFGetField(input, TIFFTAG_INDEXED, &xuint16)){\n\t\t\t\tif(xuint16==1)\n\t\t\t\t\tgoto photometric_palette;\n\t\t\t}\n\t\t\tif(t2p->tiff_samplesperpixel > 3) {\n\t\t\t\tif(t2p->tiff_samplesperpixel == 4) {\n\t\t\t\t\tt2p->pdf_colorspace = T2P_CS_RGB;\n\t\t\t\t\tif(TIFFGetField(input,\n\t\t\t\t\t\t\tTIFFTAG_EXTRASAMPLES,\n\t\t\t\t\t\t\t&xuint16, &xuint16p)\n\t\t\t\t\t   && xuint16 == 1) {\n\t\t\t\t\t\tif(xuint16p[0] == EXTRASAMPLE_ASSOCALPHA){\n\t\t\t\t\t\t\tt2p->pdf_sample=T2P_SAMPLE_RGBAA_TO_RGB;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(xuint16p[0] == EXTRASAMPLE_UNASSALPHA){\n\t\t\t\t\t\t\tt2p->pdf_sample=T2P_SAMPLE_RGBA_TO_RGB;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tTIFFWarning(\n\t\t\t\t\t\t\tTIFF2PDF_MODULE, \n\t\t\t\t\t\t\t\"RGB image %s has 4 samples per pixel, assuming RGBA\",\n\t\t\t\t\t\t\tTIFFFileName(input));\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tt2p->pdf_colorspace=T2P_CS_CMYK;\n\t\t\t\t\tt2p->pdf_switchdecode ^= 1;\n\t\t\t\t\tTIFFWarning(\n\t\t\t\t\t\tTIFF2PDF_MODULE, \n\t\t\t\t\t\t\"RGB image %s has 4 samples per pixel, assuming inverse CMYK\",\n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tTIFFError(\n\t\t\t\t\t\tTIFF2PDF_MODULE, \n\t\t\t\t\t\t\"No support for RGB image %s with %u samples per pixel\", \n\t\t\t\t\t\tTIFFFileName(input), \n\t\t\t\t\t\tt2p->tiff_samplesperpixel);\n\t\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tTIFFError(\n\t\t\t\t\tTIFF2PDF_MODULE, \n\t\t\t\t\t\"No support for RGB image %s with %u samples per pixel\", \n\t\t\t\t\tTIFFFileName(input), \n\t\t\t\t\tt2p->tiff_samplesperpixel);\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\tbreak;\n\t\t\t}\n\t\tcase PHOTOMETRIC_PALETTE: \n\t\t\tphotometric_palette:\n\t\t\tif(t2p->tiff_samplesperpixel!=1){\n\t\t\t\tTIFFError(\n\t\t\t\t\tTIFF2PDF_MODULE, \n\t\t\t\t\t\"No support for palettized image %s with not one sample per pixel\", \n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tt2p->pdf_colorspace=T2P_CS_RGB | T2P_CS_PALETTE;\n\t\t\tt2p->pdf_palettesize=0x0001<<t2p->tiff_bitspersample;\n\t\t\tif(!TIFFGetField(input, TIFFTAG_COLORMAP, &r, &g, &b)){\n\t\t\t\tTIFFError(\n\t\t\t\t\tTIFF2PDF_MODULE, \n\t\t\t\t\t\"Palettized image %s has no color map\", \n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\treturn;\n\t\t\t} \n\t\t\tif(t2p->pdf_palette != NULL){\n\t\t\t\t_TIFFfree(t2p->pdf_palette);\n\t\t\t\tt2p->pdf_palette=NULL;\n\t\t\t}\n\t\t\tt2p->pdf_palette = (unsigned char*)\n\t\t\t\t_TIFFmalloc(t2p->pdf_palettesize*3);\n\t\t\tif(t2p->pdf_palette==NULL){\n\t\t\t\tTIFFError(\n\t\t\t\t\tTIFF2PDF_MODULE, \n\t\t\t\t\t\"Can't allocate %u bytes of memory for t2p_read_tiff_image, %s\", \n\t\t\t\t\tt2p->pdf_palettesize, \n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tfor(i=0;i<t2p->pdf_palettesize;i++){\n\t\t\t\tt2p->pdf_palette[(i*3)]  = (unsigned char) (r[i]>>8);\n\t\t\t\tt2p->pdf_palette[(i*3)+1]= (unsigned char) (g[i]>>8);\n\t\t\t\tt2p->pdf_palette[(i*3)+2]= (unsigned char) (b[i]>>8);\n\t\t\t}\n\t\t\tt2p->pdf_palettesize *= 3;\n\t\t\tbreak;\n\t\tcase PHOTOMETRIC_SEPARATED:\n\t\t\tif(TIFFGetField(input, TIFFTAG_INDEXED, &xuint16)){\n\t\t\t\tif(xuint16==1){\n\t\t\t\t\t\tgoto photometric_palette_cmyk;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif( TIFFGetField(input, TIFFTAG_INKSET, &xuint16) ){\n\t\t\t\tif(xuint16 != INKSET_CMYK){\n\t\t\t\t\tTIFFError(\n\t\t\t\t\t\tTIFF2PDF_MODULE, \n\t\t\t\t\t\t\"No support for %s because its inkset is not CMYK\",\n\t\t\t\t\t\tTIFFFileName(input) );\n\t\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(t2p->tiff_samplesperpixel==4){\n\t\t\t\tt2p->pdf_colorspace=T2P_CS_CMYK;\n\t\t\t} else {\n\t\t\t\tTIFFError(\n\t\t\t\t\tTIFF2PDF_MODULE, \n\t\t\t\t\t\"No support for %s because it has %u samples per pixel\",\n\t\t\t\t\tTIFFFileName(input), \n\t\t\t\t\tt2p->tiff_samplesperpixel);\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tbreak;\n\t\t\tphotometric_palette_cmyk:\n\t\t\tif(t2p->tiff_samplesperpixel!=1){\n\t\t\t\tTIFFError(\n\t\t\t\t\tTIFF2PDF_MODULE, \n\t\t\t\t\t\"No support for palettized CMYK image %s with not one sample per pixel\", \n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tt2p->pdf_colorspace=T2P_CS_CMYK | T2P_CS_PALETTE;\n\t\t\tt2p->pdf_palettesize=0x0001<<t2p->tiff_bitspersample;\n\t\t\tif(!TIFFGetField(input, TIFFTAG_COLORMAP, &r, &g, &b, &a)){\n\t\t\t\tTIFFError(\n\t\t\t\t\tTIFF2PDF_MODULE, \n\t\t\t\t\t\"Palettized image %s has no color map\", \n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\treturn;\n\t\t\t} \n\t\t\tif(t2p->pdf_palette != NULL){\n\t\t\t\t_TIFFfree(t2p->pdf_palette);\n\t\t\t\tt2p->pdf_palette=NULL;\n\t\t\t}\n\t\t\tt2p->pdf_palette = (unsigned char*) \n\t\t\t\t_TIFFmalloc(t2p->pdf_palettesize*4);\n\t\t\tif(t2p->pdf_palette==NULL){\n\t\t\t\tTIFFError(\n\t\t\t\t\tTIFF2PDF_MODULE, \n\t\t\t\t\t\"Can't allocate %u bytes of memory for t2p_read_tiff_image, %s\", \n\t\t\t\t\tt2p->pdf_palettesize, \n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tfor(i=0;i<t2p->pdf_palettesize;i++){\n\t\t\t\tt2p->pdf_palette[(i*4)]  = (unsigned char) (r[i]>>8);\n\t\t\t\tt2p->pdf_palette[(i*4)+1]= (unsigned char) (g[i]>>8);\n\t\t\t\tt2p->pdf_palette[(i*4)+2]= (unsigned char) (b[i]>>8);\n\t\t\t\tt2p->pdf_palette[(i*4)+3]= (unsigned char) (a[i]>>8);\n\t\t\t}\n\t\t\tt2p->pdf_palettesize *= 4;\n\t\t\tbreak;\n\t\tcase PHOTOMETRIC_YCBCR:\n\t\t\tt2p->pdf_colorspace=T2P_CS_RGB;\n\t\t\tif(t2p->tiff_samplesperpixel==1){\n\t\t\t\tt2p->pdf_colorspace=T2P_CS_GRAY;\n\t\t\t\tt2p->tiff_photometric=PHOTOMETRIC_MINISBLACK;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tt2p->pdf_sample=T2P_SAMPLE_YCBCR_TO_RGB;\n#ifdef JPEG_SUPPORT\n\t\t\tif(t2p->pdf_defaultcompression==T2P_COMPRESS_JPEG){\n\t\t\t\tt2p->pdf_sample=T2P_SAMPLE_NOTHING;\n\t\t\t}\n#endif\n\t\t\tbreak;\n\t\tcase PHOTOMETRIC_CIELAB:\n\t\t\tt2p->pdf_labrange[0]= -127;\n\t\t\tt2p->pdf_labrange[1]= 127;\n\t\t\tt2p->pdf_labrange[2]= -127;\n\t\t\tt2p->pdf_labrange[3]= 127;\n\t\t\tt2p->pdf_sample=T2P_SAMPLE_LAB_SIGNED_TO_UNSIGNED;\n\t\t\tt2p->pdf_colorspace=T2P_CS_LAB;\n\t\t\tbreak;\n\t\tcase PHOTOMETRIC_ICCLAB:\n\t\t\tt2p->pdf_labrange[0]= 0;\n\t\t\tt2p->pdf_labrange[1]= 255;\n\t\t\tt2p->pdf_labrange[2]= 0;\n\t\t\tt2p->pdf_labrange[3]= 255;\n\t\t\tt2p->pdf_colorspace=T2P_CS_LAB;\n\t\t\tbreak;\n\t\tcase PHOTOMETRIC_ITULAB:\n\t\t\tt2p->pdf_labrange[0]=-85;\n\t\t\tt2p->pdf_labrange[1]=85;\n\t\t\tt2p->pdf_labrange[2]=-75;\n\t\t\tt2p->pdf_labrange[3]=124;\n\t\t\tt2p->pdf_sample=T2P_SAMPLE_LAB_SIGNED_TO_UNSIGNED;\n\t\t\tt2p->pdf_colorspace=T2P_CS_LAB;\n\t\t\tbreak;\n\t\tcase PHOTOMETRIC_LOGL:\n\t\tcase PHOTOMETRIC_LOGLUV:\n\t\t\tTIFFError(\n\t\t\t\tTIFF2PDF_MODULE, \n\t\t\t\t\"No support for %s with photometric interpretation LogL/LogLuv\", \n\t\t\t\tTIFFFileName(input));\n\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\treturn;\n\t\tdefault:\n\t\t\tTIFFError(\n\t\t\t\tTIFF2PDF_MODULE, \n\t\t\t\t\"No support for %s with photometric interpretation %u\", \n\t\t\t\tTIFFFileName(input),\n\t\t\t\tt2p->tiff_photometric);\n\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\treturn;\n\t}\n\n\tif(TIFFGetField(input, TIFFTAG_PLANARCONFIG, &(t2p->tiff_planar))){\n\t\tswitch(t2p->tiff_planar){\n\t\t\tcase 0:\n\t\t\t\tTIFFWarning(\n\t\t\t\t\tTIFF2PDF_MODULE, \n\t\t\t\t\t\"Image %s has planar configuration 0, assuming 1\", \n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\tt2p->tiff_planar=PLANARCONFIG_CONTIG;\n\t\t\tcase PLANARCONFIG_CONTIG:\n\t\t\t\tbreak;\n\t\t\tcase PLANARCONFIG_SEPARATE:\n\t\t\t\tt2p->pdf_sample=T2P_SAMPLE_PLANAR_SEPARATE_TO_CONTIG;\n\t\t\t\tif(t2p->tiff_bitspersample!=8){\n\t\t\t\t\tTIFFError(\n\t\t\t\t\t\tTIFF2PDF_MODULE, \n\t\t\t\t\t\t\"No support for %s with separated planar configuration and %u bits per sample\", \n\t\t\t\t\t\tTIFFFileName(input),\n\t\t\t\t\t\tt2p->tiff_bitspersample);\n\t\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tTIFFError(\n\t\t\t\t\tTIFF2PDF_MODULE, \n\t\t\t\t\t\"No support for %s with planar configuration %u\", \n\t\t\t\t\tTIFFFileName(input),\n\t\t\t\t\tt2p->tiff_planar);\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\treturn;\n\t\t}\n\t}\n\n        TIFFGetFieldDefaulted(input, TIFFTAG_ORIENTATION,\n                              &(t2p->tiff_orientation));\n        if(t2p->tiff_orientation>8){\n                TIFFWarning(TIFF2PDF_MODULE,\n                            \"Image %s has orientation %u, assuming 0\",\n                            TIFFFileName(input), t2p->tiff_orientation);\n                t2p->tiff_orientation=0;\n        }\n\n        if(TIFFGetField(input, TIFFTAG_XRESOLUTION, &(t2p->tiff_xres) ) == 0){\n                t2p->tiff_xres=0.0;\n        }\n        if(TIFFGetField(input, TIFFTAG_YRESOLUTION, &(t2p->tiff_yres) ) == 0){\n                t2p->tiff_yres=0.0;\n        }\n\tTIFFGetFieldDefaulted(input, TIFFTAG_RESOLUTIONUNIT,\n\t\t\t      &(t2p->tiff_resunit));\n\tif(t2p->tiff_resunit == RESUNIT_CENTIMETER) {\n\t\tt2p->tiff_xres *= 2.54F;\n\t\tt2p->tiff_yres *= 2.54F;\n\t} else if (t2p->tiff_resunit != RESUNIT_INCH\n\t\t   && t2p->pdf_centimeters != 0) {\n\t\tt2p->tiff_xres *= 2.54F;\n\t\tt2p->tiff_yres *= 2.54F;\n\t}\n\n\tt2p_compose_pdf_page(t2p);\n\n\tt2p->pdf_transcode = T2P_TRANSCODE_ENCODE;\n\tif(t2p->pdf_nopassthrough==0){\n#ifdef CCITT_SUPPORT\n\t\tif(t2p->tiff_compression==COMPRESSION_CCITTFAX4  \n\t\t\t){\n\t\t\tif(TIFFIsTiled(input) || (TIFFNumberOfStrips(input)==1) ){\n\t\t\t\tt2p->pdf_transcode = T2P_TRANSCODE_RAW;\n\t\t\t\tt2p->pdf_compression=T2P_COMPRESS_G4;\n\t\t\t}\n\t\t}\n#endif\n#ifdef ZIP_SUPPORT\n\t\tif(t2p->tiff_compression== COMPRESSION_ADOBE_DEFLATE \n\t\t\t|| t2p->tiff_compression==COMPRESSION_DEFLATE){\n\t\t\tif(TIFFIsTiled(input) || (TIFFNumberOfStrips(input)==1) ){\n\t\t\t\tt2p->pdf_transcode = T2P_TRANSCODE_RAW;\n\t\t\t\tt2p->pdf_compression=T2P_COMPRESS_ZIP;\n\t\t\t}\n\t\t}\n#endif\n#ifdef OJPEG_SUPPORT\n\t\tif(t2p->tiff_compression==COMPRESSION_OJPEG){\n\t\t\tt2p->pdf_transcode = T2P_TRANSCODE_RAW;\n\t\t\tt2p->pdf_compression=T2P_COMPRESS_JPEG;\n\t\t\tt2p_process_ojpeg_tables(t2p, input);\n\t\t}\n#endif\n#ifdef JPEG_SUPPORT\n\t\tif(t2p->tiff_compression==COMPRESSION_JPEG){\n\t\t\tt2p->pdf_transcode = T2P_TRANSCODE_RAW;\n\t\t\tt2p->pdf_compression=T2P_COMPRESS_JPEG;\n\t\t}\n#endif\n\t\t(void)0;\n\t}\n\n\tif(t2p->pdf_transcode!=T2P_TRANSCODE_RAW){\n\t\tt2p->pdf_compression = t2p->pdf_defaultcompression;\n\t}\n\n#ifdef JPEG_SUPPORT\n\tif(t2p->pdf_defaultcompression==T2P_COMPRESS_JPEG){\n\t\tif(t2p->pdf_colorspace & T2P_CS_PALETTE){\n\t\t\tt2p->pdf_sample|=T2P_SAMPLE_REALIZE_PALETTE;\n\t\t\tt2p->pdf_colorspace ^= T2P_CS_PALETTE;\n\t\t\tt2p->tiff_pages[t2p->pdf_page].page_extra--;\n\t\t}\n\t}\n\tif(t2p->tiff_compression==COMPRESSION_JPEG){\n\t\tif(t2p->tiff_planar==PLANARCONFIG_SEPARATE){\n\t\t\tTIFFError(\n\t\t\t\tTIFF2PDF_MODULE, \n\t\t\t\t\"No support for %s with JPEG compression and separated planar configuration\", \n\t\t\t\tTIFFFileName(input));\n\t\t\t\tt2p->t2p_error=T2P_ERR_ERROR;\n\t\t\treturn;\n\t\t}\n\t}\n#endif\n#ifdef OJPEG_SUPPORT\n\tif(t2p->tiff_compression==COMPRESSION_OJPEG){\n\t\tif(t2p->tiff_planar==PLANARCONFIG_SEPARATE){\n\t\t\tTIFFError(\n\t\t\t\tTIFF2PDF_MODULE, \n\t\t\t\t\"No support for %s with OJPEG compression and separated planar configuration\", \n\t\t\t\tTIFFFileName(input));\n\t\t\t\tt2p->t2p_error=T2P_ERR_ERROR;\n\t\t\treturn;\n\t\t}\n\t}\n#endif\n\n\tif(t2p->pdf_sample & T2P_SAMPLE_REALIZE_PALETTE){\n\t\tif(t2p->pdf_colorspace & T2P_CS_CMYK){\n\t\t\tt2p->tiff_samplesperpixel=4;\n\t\t\tt2p->tiff_photometric=PHOTOMETRIC_SEPARATED;\n\t\t} else {\n\t\t\tt2p->tiff_samplesperpixel=3;\n\t\t\tt2p->tiff_photometric=PHOTOMETRIC_RGB;\n\t\t}\n\t}\n\n\tif (TIFFGetField(input, TIFFTAG_TRANSFERFUNCTION,\n\t\t\t &(t2p->tiff_transferfunction[0]),\n\t\t\t &(t2p->tiff_transferfunction[1]),\n\t\t\t &(t2p->tiff_transferfunction[2]))) {\n\t\tif(t2p->tiff_transferfunction[1] !=\n\t\t   t2p->tiff_transferfunction[0]) {\n\t\t\tt2p->tiff_transferfunctioncount=3;\n\t\t} else {\n\t\t\tt2p->tiff_transferfunctioncount=1;\n\t\t}\n\t} else {\n\t\tt2p->tiff_transferfunctioncount=0;\n\t}\n\tif(TIFFGetField(input, TIFFTAG_WHITEPOINT, &xfloatp)!=0){\n\t\tt2p->tiff_whitechromaticities[0]=xfloatp[0];\n\t\tt2p->tiff_whitechromaticities[1]=xfloatp[1];\n\t\tif(t2p->pdf_colorspace & T2P_CS_GRAY){\n\t\t\tt2p->pdf_colorspace |= T2P_CS_CALGRAY;\n\t\t}\n\t\tif(t2p->pdf_colorspace & T2P_CS_RGB){\n\t\t\tt2p->pdf_colorspace |= T2P_CS_CALRGB;\n\t\t}\n\t}\n\tif(TIFFGetField(input, TIFFTAG_PRIMARYCHROMATICITIES, &xfloatp)!=0){\n\t\tt2p->tiff_primarychromaticities[0]=xfloatp[0];\n\t\tt2p->tiff_primarychromaticities[1]=xfloatp[1];\n\t\tt2p->tiff_primarychromaticities[2]=xfloatp[2];\n\t\tt2p->tiff_primarychromaticities[3]=xfloatp[3];\n\t\tt2p->tiff_primarychromaticities[4]=xfloatp[4];\n\t\tt2p->tiff_primarychromaticities[5]=xfloatp[5];\n\t\tif(t2p->pdf_colorspace & T2P_CS_RGB){\n\t\t\tt2p->pdf_colorspace |= T2P_CS_CALRGB;\n\t\t}\n\t}\n\tif(t2p->pdf_colorspace & T2P_CS_LAB){\n\t\tif(TIFFGetField(input, TIFFTAG_WHITEPOINT, &xfloatp) != 0){\n\t\t\tt2p->tiff_whitechromaticities[0]=xfloatp[0];\n\t\t\tt2p->tiff_whitechromaticities[1]=xfloatp[1];\n\t\t} else {\n\t\t\tt2p->tiff_whitechromaticities[0]=0.3457F; /* 0.3127F; */\n\t\t\tt2p->tiff_whitechromaticities[1]=0.3585F; /* 0.3290F; */\n\t\t}\n\t}\n\tif(TIFFGetField(input, \n\t\tTIFFTAG_ICCPROFILE, \n\t\t&(t2p->tiff_iccprofilelength), \n\t\t&(t2p->tiff_iccprofile))!=0){\n\t\tt2p->pdf_colorspace |= T2P_CS_ICCBASED;\n\t} else {\n\t\tt2p->tiff_iccprofilelength=0;\n\t\tt2p->tiff_iccprofile=NULL;\n\t}\n\t\n#ifdef CCITT_SUPPORT\n\tif( t2p->tiff_bitspersample==1 &&\n\t\tt2p->tiff_samplesperpixel==1){\n\t\tt2p->pdf_compression = T2P_COMPRESS_G4;\n\t}\n#endif\n\n\n\treturn;\n}\n\n/*\n\tThis function returns the necessary size of a data buffer to contain the raw or \n\tuncompressed image data from the input TIFF for a page.\n*/\n\nvoid t2p_read_tiff_size(T2P* t2p, TIFF* input){\n\n\tuint32* sbc=NULL;\n#if defined(JPEG_SUPPORT) || defined (OJPEG_SUPPORT)\n\tunsigned char* jpt=NULL;\n\ttstrip_t i=0;\n\ttstrip_t stripcount=0;\n#endif\n#ifdef OJPEG_SUPPORT\n        tsize_t k = 0;\n#endif\n\n\tif(t2p->pdf_transcode == T2P_TRANSCODE_RAW){\n#ifdef CCITT_SUPPORT\n\t\tif(t2p->pdf_compression == T2P_COMPRESS_G4 ){\n\t\t\tTIFFGetField(input, TIFFTAG_STRIPBYTECOUNTS, &sbc);\n\t\t\tt2p->tiff_datasize=sbc[0];\n\t\t\treturn;\n\t\t}\n#endif\n#ifdef ZIP_SUPPORT\n\t\tif(t2p->pdf_compression == T2P_COMPRESS_ZIP){\n\t\t\tTIFFGetField(input, TIFFTAG_STRIPBYTECOUNTS, &sbc);\n\t\t\tt2p->tiff_datasize=sbc[0];\n\t\t\treturn;\n\t\t}\n#endif\n#ifdef OJPEG_SUPPORT\n\t\tif(t2p->tiff_compression == COMPRESSION_OJPEG){\n\t\t\tif(!TIFFGetField(input, TIFFTAG_STRIPBYTECOUNTS, &sbc)){\n\t\t\t\tTIFFError(TIFF2PDF_MODULE, \n\t\t\t\t\t\"Input file %s missing field: TIFFTAG_STRIPBYTECOUNTS\",\n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tstripcount=TIFFNumberOfStrips(input);\n\t\t\tfor(i=0;i<stripcount;i++){\n\t\t\t\tk += sbc[i];\n\t\t\t}\n\t\t\tif(TIFFGetField(input, TIFFTAG_JPEGIFOFFSET, &(t2p->tiff_dataoffset))){\n\t\t\t\tif(t2p->tiff_dataoffset != 0){\n\t\t\t\t\tif(TIFFGetField(input, TIFFTAG_JPEGIFBYTECOUNT, &(t2p->tiff_datasize))!=0){\n\t\t\t\t\t\tif(t2p->tiff_datasize < k) {\n\t\t\t\t\t\t\tt2p->pdf_ojpegiflength=t2p->tiff_datasize;\n\t\t\t\t\t\t\tt2p->tiff_datasize+=k;\n\t\t\t\t\t\t\tt2p->tiff_datasize+=6;\n\t\t\t\t\t\t\tt2p->tiff_datasize+=2*stripcount;\n\t\t\t\t\t\t\tTIFFWarning(TIFF2PDF_MODULE, \n\t\t\t\t\t\t\t\t\"Input file %s has short JPEG interchange file byte count\", \n\t\t\t\t\t\t\t\tTIFFFileName(input));\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}else {\n\t\t\t\t\t\tTIFFError(TIFF2PDF_MODULE, \n\t\t\t\t\t\t\t\"Input file %s missing field: TIFFTAG_JPEGIFBYTECOUNT\",\n\t\t\t\t\t\t\tTIFFFileName(input));\n\t\t\t\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tt2p->tiff_datasize+=k;\n\t\t\tt2p->tiff_datasize+=2*stripcount;\n\t\t\tt2p->tiff_datasize+=2048;\n\t\t\treturn;\n\t\t}\n#endif\n#ifdef JPEG_SUPPORT\n\t\tif(t2p->tiff_compression == COMPRESSION_JPEG) {\n\t\t\tuint32 count = 0;\n\t\t\tif(TIFFGetField(input, TIFFTAG_JPEGTABLES, &count, &jpt) != 0 ){\n\t\t\t\tif(count > 4){\n\t\t\t\t\tt2p->tiff_datasize += count;\n\t\t\t\t\tt2p->tiff_datasize -= 2; /* don't use EOI of header */\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tt2p->tiff_datasize = 2; /* SOI for first strip */\n\t\t\t}\n\t\t\tstripcount=TIFFNumberOfStrips(input);\n\t\t\tif(!TIFFGetField(input, TIFFTAG_STRIPBYTECOUNTS, &sbc)){\n\t\t\t\tTIFFError(TIFF2PDF_MODULE, \n\t\t\t\t\t\"Input file %s missing field: TIFFTAG_STRIPBYTECOUNTS\",\n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tfor(i=0;i<stripcount;i++){\n\t\t\t\tt2p->tiff_datasize += sbc[i];\n\t\t\t\tt2p->tiff_datasize -=4; /* don't use SOI or EOI of strip */\n\t\t\t}\n\t\t\tt2p->tiff_datasize +=2; /* use EOI of last strip */\n\t\t}\n#endif\n\t\t(void) 0;\n\t}\n\tt2p->tiff_datasize=TIFFScanlineSize(input) * t2p->tiff_length;\n\tif(t2p->tiff_planar==PLANARCONFIG_SEPARATE){\n\t\tt2p->tiff_datasize*= t2p->tiff_samplesperpixel;\n\t}\n\n\treturn;\n}\n\n/*\n\tThis function returns the necessary size of a data buffer to contain the raw or \n\tuncompressed image data from the input TIFF for a tile of a page.\n*/\n\nvoid t2p_read_tiff_size_tile(T2P* t2p, TIFF* input, ttile_t tile){\n\n\tuint32* tbc = NULL;\n\tuint16 edge=0;\n#ifdef JPEG_SUPPORT\n\tunsigned char* jpt;\n#endif\n\n\tedge |= t2p_tile_is_right_edge(t2p->tiff_tiles[t2p->pdf_page], tile);\n\tedge |= t2p_tile_is_bottom_edge(t2p->tiff_tiles[t2p->pdf_page], tile);\n\t\n\tif(t2p->pdf_transcode==T2P_TRANSCODE_RAW){\n\t\tif(edge\n#if defined(JPEG_SUPPORT) || defined(OJPEG_SUPPORT)\n\t\t&& !(t2p->pdf_compression==T2P_COMPRESS_JPEG)\n#endif\n\t\t){\n\t\t\tt2p->tiff_datasize=TIFFTileSize(input);\n\t\t\treturn;\n\t\t} else {\n\t\t\tTIFFGetField(input, TIFFTAG_TILEBYTECOUNTS, &tbc);\n\t\t\tt2p->tiff_datasize=tbc[tile];\n#ifdef OJPEG_SUPPORT\n\t\t\tif(t2p->tiff_compression==COMPRESSION_OJPEG){\n\t\t\t\tt2p->tiff_datasize+=2048;\n\t\t\t\treturn;\n\t\t\t}\n#endif\n#ifdef JPEG_SUPPORT\n\t\t\tif(t2p->tiff_compression==COMPRESSION_JPEG) {\n\t\t\t\tuint32 count = 0;\n\t\t\t\tif(TIFFGetField(input, TIFFTAG_JPEGTABLES, &count, &jpt)!=0){\n\t\t\t\t\tif(count > 4){\n\t\t\t\t\t\tt2p->tiff_datasize += count;\n\t\t\t\t\t\tt2p->tiff_datasize -= 4; /* don't use EOI of header or SOI of tile */\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n#endif\n\t\t\treturn;\n\t\t}\n\t}\n\tt2p->tiff_datasize=TIFFTileSize(input);\n\tif(t2p->tiff_planar==PLANARCONFIG_SEPARATE){\n\t\tt2p->tiff_datasize*= t2p->tiff_samplesperpixel;\n\t}\n\n\treturn;\n}\n\n/*\n * This functions returns a non-zero value when the tile is on the right edge\n * and does not have full imaged tile width.\n */\n\nint t2p_tile_is_right_edge(T2P_TILES tiles, ttile_t tile){\n\n\tif( ((tile+1) % tiles.tiles_tilecountx == 0) \n\t\t&& (tiles.tiles_edgetilewidth != 0) ){\n\t\treturn(1);\n\t} else {\n\t\treturn(0);\n\t}\n}\n\n/*\n * This functions returns a non-zero value when the tile is on the bottom edge\n * and does not have full imaged tile length.\n */\n\nint t2p_tile_is_bottom_edge(T2P_TILES tiles, ttile_t tile){\n\n\tif( ((tile+1) > (tiles.tiles_tilecount-tiles.tiles_tilecountx) )\n\t\t&& (tiles.tiles_edgetilelength != 0) ){\n\t\treturn(1);\n\t} else {\n\t\treturn(0);\n\t}\n}\n\n/*\n * This function returns a non-zero value when the tile is a right edge tile\n * or a bottom edge tile.\n */\n\nint t2p_tile_is_edge(T2P_TILES tiles, ttile_t tile){\n\n\treturn(t2p_tile_is_right_edge(tiles, tile) | t2p_tile_is_bottom_edge(tiles, tile) );\n}\n\n/*\n\tThis function returns a non-zero value when the tile is a right edge tile and a bottom \n\tedge tile.\n*/\n\nint t2p_tile_is_corner_edge(T2P_TILES tiles, ttile_t tile){\n\n\treturn(t2p_tile_is_right_edge(tiles, tile) & t2p_tile_is_bottom_edge(tiles, tile) );\n}\n\n\n/*\n\tThis function reads the raster image data from the input TIFF for an image and writes \n\tthe data to the output PDF XObject image dictionary stream.  It returns the amount written \n\tor zero on error.\n*/\n\ntsize_t t2p_readwrite_pdf_image(T2P* t2p, TIFF* input, TIFF* output){\n\n\ttsize_t written=0;\n\tunsigned char* buffer=NULL;\n\tunsigned char* samplebuffer=NULL;\n\ttsize_t bufferoffset=0;\n\ttsize_t samplebufferoffset=0;\n\ttsize_t read=0;\n\ttstrip_t i=0;\n\ttstrip_t j=0;\n\ttstrip_t stripcount=0;\n\ttsize_t stripsize=0;\n\ttsize_t sepstripcount=0;\n\ttsize_t sepstripsize=0;\n#ifdef OJPEG_SUPPORT\n\ttoff_t inputoffset=0;\n\tuint16 h_samp=1;\n\tuint16 v_samp=1;\n\tuint16 ri=1;\n\tuint32 rows=0;\n#endif\n#ifdef JPEG_SUPPORT\n\tunsigned char* jpt;\n\tfloat* xfloatp;\n\tuint32* sbc;\n\tunsigned char* stripbuffer;\n\ttsize_t striplength=0;\n\tuint32 max_striplength=0;\n#endif\n\n\tif(t2p->pdf_transcode == T2P_TRANSCODE_RAW){\n#ifdef CCITT_SUPPORT\n\t\tif(t2p->pdf_compression == T2P_COMPRESS_G4){\n\t\t\tbuffer = (unsigned char*)\n\t\t\t\t_TIFFmalloc(t2p->tiff_datasize);\n\t\t\tif (buffer == NULL) {\n\t\t\t\tTIFFError(TIFF2PDF_MODULE, \n\t\"Can't allocate %u bytes of memory for t2p_readwrite_pdf_image, %s\", \n\t\t\t\t\tt2p->tiff_datasize, \n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\treturn(0);\n\t\t\t}\n\t\t\tTIFFReadRawStrip(input, 0, (tdata_t) buffer,\n\t\t\t\t\t t2p->tiff_datasize);\n\t\t\tif (t2p->tiff_fillorder==FILLORDER_LSB2MSB){\n\t\t\t\t\t/*\n\t\t\t\t\t * make sure is lsb-to-msb\n\t\t\t\t\t * bit-endianness fill order\n\t\t\t\t\t */\n\t\t\t\t\tTIFFReverseBits(buffer,\n\t\t\t\t\t\t\tt2p->tiff_datasize);\n\t\t\t}\n\t\t\tt2pWriteFile(output, (tdata_t) buffer,\n\t\t\t\t      t2p->tiff_datasize);\n\t\t\t_TIFFfree(buffer);\n\t\t\treturn(t2p->tiff_datasize);\n\t\t}\n#endif\n#ifdef ZIP_SUPPORT\n\t\tif (t2p->pdf_compression == T2P_COMPRESS_ZIP) {\n\t\t\tbuffer = (unsigned char*)\n\t\t\t\t_TIFFmalloc(t2p->tiff_datasize);\n                        memset(buffer, 0, t2p->tiff_datasize);\n\t\t\tif(buffer == NULL){\n\t\t\t\tTIFFError(TIFF2PDF_MODULE, \n\t\"Can't allocate %u bytes of memory for t2p_readwrite_pdf_image, %s\", \n\t\t\t\t\tt2p->tiff_datasize, \n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\treturn(0);\n\t\t\t}\n\t\t\tTIFFReadRawStrip(input, 0, (tdata_t) buffer,\n\t\t\t\t\t t2p->tiff_datasize);\n\t\t\tif (t2p->tiff_fillorder==FILLORDER_LSB2MSB) {\n\t\t\t\t\tTIFFReverseBits(buffer,\n\t\t\t\t\t\t\tt2p->tiff_datasize);\n\t\t\t}\n\t\t\tt2pWriteFile(output, (tdata_t) buffer,\n\t\t\t\t      t2p->tiff_datasize);\n\t\t\t_TIFFfree(buffer);\n\t\t\treturn(t2p->tiff_datasize);\n\t\t}\n#endif\n#ifdef OJPEG_SUPPORT\n\t\tif(t2p->tiff_compression == COMPRESSION_OJPEG) {\n\n\t\t\tif(t2p->tiff_dataoffset != 0) {\n\t\t\t\tbuffer = (unsigned char*)\n\t\t\t\t\t_TIFFmalloc(t2p->tiff_datasize);\n                                memset(buffer, 0, t2p->tiff_datasize);\n\t\t\t\tif(buffer == NULL) {\n\t\t\t\t\tTIFFError(TIFF2PDF_MODULE, \n\t\"Can't allocate %u bytes of memory for t2p_readwrite_pdf_image, %s\", \n\t\t\t\t\t\tt2p->tiff_datasize, \n\t\t\t\t\t\tTIFFFileName(input));\n\t\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\t\treturn(0);\n\t\t\t\t}\n\t\t\t\tif(t2p->pdf_ojpegiflength==0){\n\t\t\t\t\tinputoffset=t2pSeekFile(input, 0,\n\t\t\t\t\t\t\t\t SEEK_CUR);\n\t\t\t\t\tt2pSeekFile(input,\n\t\t\t\t\t\t     t2p->tiff_dataoffset,\n\t\t\t\t\t\t     SEEK_SET);\n\t\t\t\t\tt2pReadFile(input, (tdata_t) buffer,\n\t\t\t\t\t\t     t2p->tiff_datasize);\n\t\t\t\t\tt2pSeekFile(input, inputoffset,\n\t\t\t\t\t\t     SEEK_SET);\n\t\t\t\t\tt2pWriteFile(output, (tdata_t) buffer,\n\t\t\t\t\t\t      t2p->tiff_datasize);\n\t\t\t\t\t_TIFFfree(buffer);\n\t\t\t\t\treturn(t2p->tiff_datasize);\n\t\t\t\t} else {\n\t\t\t\t\tinputoffset=t2pSeekFile(input, 0,\n\t\t\t\t\t\t\t\t SEEK_CUR);\n\t\t\t\t\tt2pSeekFile(input,\n\t\t\t\t\t\t     t2p->tiff_dataoffset,\n\t\t\t\t\t\t     SEEK_SET);\n\t\t\t\t\tbufferoffset = t2pReadFile(input,\n\t\t\t\t\t\t(tdata_t) buffer,\n\t\t\t\t\t\tt2p->pdf_ojpegiflength);\n\t\t\t\t\tt2p->pdf_ojpegiflength = 0;\n\t\t\t\t\tt2pSeekFile(input, inputoffset,\n\t\t\t\t\t\t     SEEK_SET);\n\t\t\t\t\tTIFFGetField(input,\n\t\t\t\t\t\t     TIFFTAG_YCBCRSUBSAMPLING,\n\t\t\t\t\t\t     &h_samp, &v_samp);\n\t\t\t\t\tbuffer[bufferoffset++]= 0xff;\n\t\t\t\t\tbuffer[bufferoffset++]= 0xdd;\n\t\t\t\t\tbuffer[bufferoffset++]= 0x00;\n\t\t\t\t\tbuffer[bufferoffset++]= 0x04;\n\t\t\t\t\th_samp*=8;\n\t\t\t\t\tv_samp*=8;\n\t\t\t\t\tri=(t2p->tiff_width+h_samp-1) / h_samp;\n\t\t\t\t\tTIFFGetField(input,\n\t\t\t\t\t\t     TIFFTAG_ROWSPERSTRIP,\n\t\t\t\t\t\t     &rows);\n\t\t\t\t\tri*=(rows+v_samp-1)/v_samp;\n\t\t\t\t\tbuffer[bufferoffset++]= (ri>>8) & 0xff;\n\t\t\t\t\tbuffer[bufferoffset++]= ri & 0xff;\n\t\t\t\t\tstripcount=TIFFNumberOfStrips(input);\n\t\t\t\t\tfor(i=0;i<stripcount;i++){\n\t\t\t\t\t\tif(i != 0 ){ \n\t\t\t\t\t\t\tbuffer[bufferoffset++]=0xff;\n\t\t\t\t\t\t\tbuffer[bufferoffset++]=(0xd0 | ((i-1)%8));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbufferoffset+=TIFFReadRawStrip(input, \n\t\t\t\t\t\t\ti, \n\t\t\t\t\t\t\t(tdata_t) &(((unsigned char*)buffer)[bufferoffset]), \n\t\t\t\t\t\t\t-1);\n\t\t\t\t\t}\n\t\t\t\t\tt2pWriteFile(output, (tdata_t) buffer, bufferoffset);\n\t\t\t\t\t_TIFFfree(buffer);\n\t\t\t\t\treturn(bufferoffset);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif(! t2p->pdf_ojpegdata){\n\t\t\t\t\tTIFFError(TIFF2PDF_MODULE, \n\t\t\t\t\"No support for OJPEG image %s with bad tables\", \n\t\t\t\t\t\tTIFFFileName(input));\n\t\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\t\treturn(0);\n\t\t\t\t}\n\t\t\t\tbuffer = (unsigned char*)\n\t\t\t\t\t_TIFFmalloc(t2p->tiff_datasize);\n                                memset(buffer, 0, t2p->tiff_datasize);\n\t\t\t\tif(buffer==NULL){\n\t\t\t\t\tTIFFError(TIFF2PDF_MODULE, \n\t\"Can't allocate %u bytes of memory for t2p_readwrite_pdf_image, %s\", \n\t\t\t\t\t\tt2p->tiff_datasize, \n\t\t\t\t\t\tTIFFFileName(input));\n\t\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\t\treturn(0);\n\t\t\t\t}\n\t\t\t\t_TIFFmemcpy(buffer, t2p->pdf_ojpegdata, t2p->pdf_ojpegdatalength);\n\t\t\t\tbufferoffset=t2p->pdf_ojpegdatalength;\n\t\t\t\tstripcount=TIFFNumberOfStrips(input);\n\t\t\t\tfor(i=0;i<stripcount;i++){\n\t\t\t\t\tif(i != 0){\n\t\t\t\t\t\tbuffer[bufferoffset++]=0xff;\n\t\t\t\t\t\tbuffer[bufferoffset++]=(0xd0 | ((i-1)%8));\n\t\t\t\t\t}\n\t\t\t\t\tbufferoffset+=TIFFReadRawStrip(input, \n\t\t\t\t\t\ti, \n\t\t\t\t\t\t(tdata_t) &(((unsigned char*)buffer)[bufferoffset]), \n\t\t\t\t\t\t-1);\n\t\t\t\t}\n\t\t\t\tif( ! ( (buffer[bufferoffset-1]==0xd9) && (buffer[bufferoffset-2]==0xff) ) ){\n\t\t\t\t\t\tbuffer[bufferoffset++]=0xff;\n\t\t\t\t\t\tbuffer[bufferoffset++]=0xd9;\n\t\t\t\t}\n\t\t\t\tt2pWriteFile(output, (tdata_t) buffer, bufferoffset);\n\t\t\t\t_TIFFfree(buffer);\n\t\t\t\treturn(bufferoffset);\n\t\t\t\tTIFFError(TIFF2PDF_MODULE, \n\t\"No support for OJPEG image %s with no JPEG File Interchange offset\", \n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\treturn(0);\n\t\t\t}\n\t\t\treturn(t2p->tiff_datasize);\n\t\t}\n#endif\n#ifdef JPEG_SUPPORT\n\t\tif(t2p->tiff_compression == COMPRESSION_JPEG) {\n\t\t\tuint32 count = 0;\n\t\t\tbuffer = (unsigned char*)\n\t\t\t\t_TIFFmalloc(t2p->tiff_datasize);\n                        memset(buffer, 0, t2p->tiff_datasize);\n\t\t\tif(buffer==NULL){\n\t\t\t\tTIFFError(TIFF2PDF_MODULE, \n\t\"Can't allocate %u bytes of memory for t2p_readwrite_pdf_image, %s\", \n\t\t\t\t\tt2p->tiff_datasize, \n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\treturn(0);\n\t\t\t}\n\t\t\tif (TIFFGetField(input, TIFFTAG_JPEGTABLES, &count, &jpt) != 0) {\n\t\t\t\tif(count > 4) {\n\t\t\t\t\t_TIFFmemcpy(buffer, jpt, count);\n\t\t\t\t\tbufferoffset += count - 2;\n\t\t\t\t}\n\t\t\t}\n\t\t\tstripcount=TIFFNumberOfStrips(input);\n\t\t\tTIFFGetField(input, TIFFTAG_STRIPBYTECOUNTS, &sbc);\n\t\t\tfor(i=0;i<stripcount;i++){\n\t\t\t\tif(sbc[i]>max_striplength) max_striplength=sbc[i];\n\t\t\t}\n\t\t\tstripbuffer = (unsigned char*)\n\t\t\t\t_TIFFmalloc(max_striplength);\n\t\t\tif(stripbuffer==NULL){\n\t\t\t\tTIFFError(TIFF2PDF_MODULE, \n\t\"Can't allocate %u bytes of memory for t2p_readwrite_pdf_image, %s\", \n\t\t\t\t\tmax_striplength, \n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\t_TIFFfree(buffer);\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\treturn(0);\n\t\t\t}\n\t\t\tfor(i=0;i<stripcount;i++){\n\t\t\t\tstriplength=TIFFReadRawStrip(input, i, (tdata_t) stripbuffer, -1);\n\t\t\t\tif(!t2p_process_jpeg_strip(\n\t\t\t\t\tstripbuffer, \n\t\t\t\t\t&striplength, \n\t\t\t\t\tbuffer, \n\t\t\t\t\t&bufferoffset, \n\t\t\t\t\ti, \n\t\t\t\t\tt2p->tiff_length)){\n\t\t\t\t\t\tTIFFError(TIFF2PDF_MODULE, \n\t\t\t\t\"Can't process JPEG data in input file %s\", \n\t\t\t\t\t\t\tTIFFFileName(input));\n\t\t\t\t\t\t_TIFFfree(samplebuffer);\n\t\t\t\t\t\t_TIFFfree(buffer);\n\t\t\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\t\t\treturn(0);\n\t\t\t\t}\n\t\t\t}\n\t\t\tbuffer[bufferoffset++]=0xff; \n\t\t\tbuffer[bufferoffset++]=0xd9;\n\t\t\tt2pWriteFile(output, (tdata_t) buffer, bufferoffset);\n\t\t\t_TIFFfree(stripbuffer);\n\t\t\t_TIFFfree(buffer);\n\t\t\treturn(bufferoffset);\n\t\t}\n#endif\n\t\t(void)0;\n\t}\n\n\tif(t2p->pdf_sample==T2P_SAMPLE_NOTHING){\n\t\tbuffer = (unsigned char*) _TIFFmalloc(t2p->tiff_datasize);\n                memset(buffer, 0, t2p->tiff_datasize);\n\t\tif(buffer==NULL){\n\t\t\tTIFFError(TIFF2PDF_MODULE, \n\t\"Can't allocate %u bytes of memory for t2p_readwrite_pdf_image, %s\", \n\t\t\t\tt2p->tiff_datasize, \n\t\t\t\tTIFFFileName(input));\n\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\treturn(0);\n\t\t}\n\t\tstripsize=TIFFStripSize(input);\n\t\tstripcount=TIFFNumberOfStrips(input);\n\t\tfor(i=0;i<stripcount;i++){\n\t\t\tread = \n\t\t\t\tTIFFReadEncodedStrip(input, \n\t\t\t\ti, \n\t\t\t\t(tdata_t) &buffer[bufferoffset], \n\t\t\t\tstripsize);\n\t\t\tif(read==-1){\n\t\t\t\tTIFFError(TIFF2PDF_MODULE, \n\t\t\t\t\t\"Error on decoding strip %u of %s\", \n\t\t\t\t\ti, \n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\t_TIFFfree(buffer);\n\t\t\t\tt2p->t2p_error=T2P_ERR_ERROR;\n\t\t\t\treturn(0);\n\t\t\t}\n\t\t\tbufferoffset+=read;\n\t\t}\n\t} else {\n\t\tif(t2p->pdf_sample & T2P_SAMPLE_PLANAR_SEPARATE_TO_CONTIG){\n\t\t\n\t\t\tsepstripsize=TIFFStripSize(input);\n\t\t\tsepstripcount=TIFFNumberOfStrips(input);\n\t\t\n\t\t\tstripsize=sepstripsize*t2p->tiff_samplesperpixel;\n\t\t\tstripcount=sepstripcount/t2p->tiff_samplesperpixel;\n\t\t\t\n\t\t\tbuffer = (unsigned char*) _TIFFmalloc(t2p->tiff_datasize);\n                        memset(buffer, 0, t2p->tiff_datasize);\n\t\t\tif(buffer==NULL){\n\t\t\t\tTIFFError(TIFF2PDF_MODULE, \n\t\"Can't allocate %u bytes of memory for t2p_readwrite_pdf_image, %s\", \n\t\t\t\t\tt2p->tiff_datasize, \n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\treturn(0);\n\t\t\t}\n\t\t\tsamplebuffer = (unsigned char*) _TIFFmalloc(stripsize);\n\t\t\tif(samplebuffer==NULL){\n\t\t\t\tTIFFError(TIFF2PDF_MODULE, \n\t\"Can't allocate %u bytes of memory for t2p_readwrite_pdf_image, %s\", \n\t\t\t\t\tt2p->tiff_datasize, \n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\treturn(0);\n\t\t\t}\n\t\t\tfor(i=0;i<stripcount;i++){\n\t\t\t\tsamplebufferoffset=0;\n\t\t\t\tfor(j=0;j<t2p->tiff_samplesperpixel;j++){\n\t\t\t\t\tread = \n\t\t\t\t\t\tTIFFReadEncodedStrip(input, \n\t\t\t\t\t\t\ti + j*stripcount, \n\t\t\t\t\t\t\t(tdata_t) &(samplebuffer[samplebufferoffset]), \n\t\t\t\t\t\t\tsepstripsize);\n\t\t\t\t\tif(read==-1){\n\t\t\t\t\t\tTIFFError(TIFF2PDF_MODULE, \n\t\t\t\t\t\"Error on decoding strip %u of %s\", \n\t\t\t\t\t\t\ti + j*stripcount, \n\t\t\t\t\t\t\tTIFFFileName(input));\n\t\t\t\t\t\t\t_TIFFfree(buffer);\n\t\t\t\t\t\tt2p->t2p_error=T2P_ERR_ERROR;\n\t\t\t\t\t\treturn(0);\n\t\t\t\t\t}\n\t\t\t\t\tsamplebufferoffset+=read;\n\t\t\t\t}\n\t\t\t\tt2p_sample_planar_separate_to_contig(\n\t\t\t\t\tt2p,\n\t\t\t\t\t&(buffer[bufferoffset]),\n\t\t\t\t\tsamplebuffer, \n\t\t\t\t\tsamplebufferoffset); \n\t\t\t\tbufferoffset+=samplebufferoffset;\n\t\t\t}\n\t\t\t_TIFFfree(samplebuffer);\n\t\t\tgoto dataready;\n\t\t}\n\n\t\tbuffer = (unsigned char*) _TIFFmalloc(t2p->tiff_datasize);\n                memset(buffer, 0, t2p->tiff_datasize);\n\t\tif(buffer==NULL){\n\t\t\tTIFFError(TIFF2PDF_MODULE, \n\t\"Can't allocate %u bytes of memory for t2p_readwrite_pdf_image, %s\", \n\t\t\t\tt2p->tiff_datasize, \n\t\t\t\tTIFFFileName(input));\n\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\treturn(0);\n\t\t}\n\t\tstripsize=TIFFStripSize(input);\n\t\tstripcount=TIFFNumberOfStrips(input);\n\t\tfor(i=0;i<stripcount;i++){\n\t\t\tread = \n\t\t\t\tTIFFReadEncodedStrip(input, \n\t\t\t\ti, \n\t\t\t\t(tdata_t) &buffer[bufferoffset], \n\t\t\t\tstripsize);\n\t\t\tif(read==-1){\n\t\t\t\tTIFFError(TIFF2PDF_MODULE, \n\t\t\t\t\t\"Error on decoding strip %u of %s\", \n\t\t\t\t\ti, \n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\t_TIFFfree(samplebuffer);\n\t\t\t\t_TIFFfree(buffer);\n\t\t\t\tt2p->t2p_error=T2P_ERR_ERROR;\n\t\t\t\treturn(0);\n\t\t\t}\n\t\t\tbufferoffset+=read;\n\t\t}\n\n\t\tif(t2p->pdf_sample & T2P_SAMPLE_REALIZE_PALETTE){\n\t\t\tsamplebuffer=(unsigned char*)_TIFFrealloc( \n\t\t\t\t(tdata_t) buffer, \n\t\t\t\tt2p->tiff_datasize * t2p->tiff_samplesperpixel);\n\t\t\tif(samplebuffer==NULL){\n\t\t\t\tTIFFError(TIFF2PDF_MODULE, \n\t\"Can't allocate %u bytes of memory for t2p_readwrite_pdf_image, %s\", \n\t\t\t\t\tt2p->tiff_datasize, \n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t  _TIFFfree(buffer);\n\t\t\t} else {\n\t\t\t\tbuffer=samplebuffer;\n\t\t\t\tt2p->tiff_datasize *= t2p->tiff_samplesperpixel;\n\t\t\t}\n\t\t\tt2p_sample_realize_palette(t2p, buffer);\n\t\t}\n\n\t\tif(t2p->pdf_sample & T2P_SAMPLE_RGBA_TO_RGB){\n\t\t\tt2p->tiff_datasize=t2p_sample_rgba_to_rgb(\n\t\t\t\t(tdata_t)buffer, \n\t\t\t\tt2p->tiff_width*t2p->tiff_length);\n\t\t}\n\n\t\tif(t2p->pdf_sample & T2P_SAMPLE_RGBAA_TO_RGB){\n\t\t\tt2p->tiff_datasize=t2p_sample_rgbaa_to_rgb(\n\t\t\t\t(tdata_t)buffer, \n\t\t\t\tt2p->tiff_width*t2p->tiff_length);\n\t\t}\n\n\t\tif(t2p->pdf_sample & T2P_SAMPLE_YCBCR_TO_RGB){\n\t\t\tsamplebuffer=(unsigned char*)_TIFFrealloc(\n\t\t\t\t(tdata_t)buffer, \n\t\t\t\tt2p->tiff_width*t2p->tiff_length*4);\n\t\t\tif(samplebuffer==NULL){\n\t\t\t\tTIFFError(TIFF2PDF_MODULE, \n\t\"Can't allocate %u bytes of memory for t2p_readwrite_pdf_image, %s\", \n\t\t\t\t\tt2p->tiff_datasize, \n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\t_TIFFfree(buffer);\n\t\t\t\treturn(0);\n\t\t\t} else {\n\t\t\t\tbuffer=samplebuffer;\n\t\t\t}\n\t\t\tif(!TIFFReadRGBAImageOriented(\n\t\t\t\tinput, \n\t\t\t\tt2p->tiff_width, \n\t\t\t\tt2p->tiff_length, \n\t\t\t\t(uint32*)buffer, \n\t\t\t\tORIENTATION_TOPLEFT,\n\t\t\t\t0)){\n\t\t\t\tTIFFError(TIFF2PDF_MODULE, \n\t\"Can't use TIFFReadRGBAImageOriented to extract RGB image from %s\", \n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\treturn(0);\n\t\t\t}\n\t\t\tt2p->tiff_datasize=t2p_sample_abgr_to_rgb(\n\t\t\t\t(tdata_t) buffer, \n\t\t\t\tt2p->tiff_width*t2p->tiff_length);\n\n\t\t}\n\n\t\tif(t2p->pdf_sample & T2P_SAMPLE_LAB_SIGNED_TO_UNSIGNED){\n\t\t\tt2p->tiff_datasize=t2p_sample_lab_signed_to_unsigned(\n\t\t\t\t(tdata_t)buffer, \n\t\t\t\tt2p->tiff_width*t2p->tiff_length);\n\t\t}\n\t}\n\ndataready:\n\n\tt2p_disable(output);\n\tTIFFSetField(output, TIFFTAG_PHOTOMETRIC, t2p->tiff_photometric);\n\tTIFFSetField(output, TIFFTAG_BITSPERSAMPLE, t2p->tiff_bitspersample);\n\tTIFFSetField(output, TIFFTAG_SAMPLESPERPIXEL, t2p->tiff_samplesperpixel);\n\tTIFFSetField(output, TIFFTAG_IMAGEWIDTH, t2p->tiff_width);\n\tTIFFSetField(output, TIFFTAG_IMAGELENGTH, t2p->tiff_length);\n\tTIFFSetField(output, TIFFTAG_ROWSPERSTRIP, t2p->tiff_length);\n\tTIFFSetField(output, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);\n\tTIFFSetField(output, TIFFTAG_FILLORDER, FILLORDER_MSB2LSB);\n\n\tswitch(t2p->pdf_compression){\n\tcase T2P_COMPRESS_NONE:\n\t\tTIFFSetField(output, TIFFTAG_COMPRESSION, COMPRESSION_NONE);\n\t\tbreak;\n#ifdef CCITT_SUPPORT\n\tcase T2P_COMPRESS_G4:\n\t\tTIFFSetField(output, TIFFTAG_COMPRESSION, COMPRESSION_CCITTFAX4);\n\t\tbreak;\n#endif\n#ifdef JPEG_SUPPORT\n\tcase T2P_COMPRESS_JPEG:\n\t\tif(t2p->tiff_photometric==PHOTOMETRIC_YCBCR) {\n\t\t\tuint16 hor = 0, ver = 0;\n\t\t\tif (TIFFGetField(input, TIFFTAG_YCBCRSUBSAMPLING, &hor, &ver) !=0 ) {\n\t\t\t\tif(hor != 0 && ver != 0){\n\t\t\t\t\tTIFFSetField(output, TIFFTAG_YCBCRSUBSAMPLING, hor, ver);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(TIFFGetField(input, TIFFTAG_REFERENCEBLACKWHITE, &xfloatp)!=0){\n\t\t\t\tTIFFSetField(output, TIFFTAG_REFERENCEBLACKWHITE, xfloatp);\n\t\t\t}\n\t\t}\n\t\tif(TIFFSetField(output, TIFFTAG_COMPRESSION, COMPRESSION_JPEG)==0){\n\t\t\tTIFFError(TIFF2PDF_MODULE, \n\t\t\"Unable to use JPEG compression for input %s and output %s\", \n\t\t\t\tTIFFFileName(input),\n\t\t\t\tTIFFFileName(output));\n\t\t\t_TIFFfree(buffer);\n\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\treturn(0);\n\t\t}\n\t\tTIFFSetField(output, TIFFTAG_JPEGTABLESMODE, 0);\n\n\t\tif(t2p->pdf_colorspace & (T2P_CS_RGB | T2P_CS_LAB)){\n\t\t\tTIFFSetField(output, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_YCBCR);\n\t\t\tif(t2p->tiff_photometric != PHOTOMETRIC_YCBCR){\n\t\t\t\tTIFFSetField(output, TIFFTAG_JPEGCOLORMODE, JPEGCOLORMODE_RGB);\n\t\t\t} else {\n\t\t\t\tTIFFSetField(output, TIFFTAG_JPEGCOLORMODE, JPEGCOLORMODE_RAW);\n\t\t\t}\n\t\t}\n\t\tif(t2p->pdf_colorspace & T2P_CS_GRAY){\n\t\t\t(void)0;\n\t\t}\n\t\tif(t2p->pdf_colorspace & T2P_CS_CMYK){\n\t\t\t(void)0;\n\t\t}\n\t\tif(t2p->pdf_defaultcompressionquality != 0){\n\t\t\tTIFFSetField(output, \n\t\t\t\tTIFFTAG_JPEGQUALITY, \n\t\t\t\tt2p->pdf_defaultcompressionquality);\n\t\t}\n\t\n\t\tbreak;\n#endif\n#ifdef ZIP_SUPPORT\n\tcase T2P_COMPRESS_ZIP:\n\t\tTIFFSetField(output, TIFFTAG_COMPRESSION, COMPRESSION_DEFLATE);\n\t\tif(t2p->pdf_defaultcompressionquality%100 != 0){\n\t\t\tTIFFSetField(output, \n\t\t\t\tTIFFTAG_PREDICTOR, \n\t\t\t\tt2p->pdf_defaultcompressionquality % 100);\n\t\t}\n\t\tif(t2p->pdf_defaultcompressionquality/100 != 0){\n\t\t\tTIFFSetField(output, \n\t\t\t\tTIFFTAG_ZIPQUALITY, \n\t\t\t\t(t2p->pdf_defaultcompressionquality / 100));\n\t\t}\n\t\tbreak;\n#endif\n\tdefault:\n\t\tbreak;\n\t}\n\n\tt2p_enable(output);\n\tt2p->outputwritten = 0;\n#ifdef JPEG_SUPPORT\n\tif(t2p->pdf_compression == T2P_COMPRESS_JPEG\n\t   && t2p->tiff_photometric == PHOTOMETRIC_YCBCR){\n\t\tbufferoffset = TIFFWriteEncodedStrip(output, (tstrip_t)0,\n\t\t\t\t\t\t     buffer,\n\t\t\t\t\t\t     stripsize * stripcount); \n\t} else\n#endif\n\t{\n\t\tbufferoffset = TIFFWriteEncodedStrip(output, (tstrip_t)0,\n\t\t\t\t\t\t     buffer,\n\t\t\t\t\t\t     t2p->tiff_datasize); \n\t}\n\tif (buffer != NULL) {\n\t\t_TIFFfree(buffer);\n\t\tbuffer=NULL;\n\t}\n\n\tif (bufferoffset == (tsize_t)-1) {\n\t\tTIFFError(TIFF2PDF_MODULE, \n\t\t\t  \"Error writing encoded strip to output PDF %s\", \n\t\t\t  TIFFFileName(output));\n\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\treturn(0);\n\t}\n\t\n\twritten = t2p->outputwritten;\n\treturn(written);\n}\n\n/*\n * This function reads the raster image data from the input TIFF for an image\n * tile and writes the data to the output PDF XObject image dictionary stream\n * for the tile.  It returns the amount written or zero on error.\n */\n\ntsize_t t2p_readwrite_pdf_image_tile(T2P* t2p, TIFF* input, TIFF* output, ttile_t tile){\n\n\tuint16 edge=0;\n\ttsize_t written=0;\n\tunsigned char* buffer=NULL;\n\ttsize_t bufferoffset=0;\n\tunsigned char* samplebuffer=NULL;\n\ttsize_t samplebufferoffset=0;\n\ttsize_t read=0;\n\tuint16 i=0;\n\tttile_t tilecount=0;\n\ttsize_t tilesize=0;\n\tttile_t septilecount=0;\n\ttsize_t septilesize=0;\n#ifdef JPEG_SUPPORT\n\tunsigned char* jpt;\n\tfloat* xfloatp;\n\tuint32 xuint32=0;\n#endif\n\n\tedge |= t2p_tile_is_right_edge(t2p->tiff_tiles[t2p->pdf_page], tile);\n\tedge |= t2p_tile_is_bottom_edge(t2p->tiff_tiles[t2p->pdf_page], tile);\n\n\tif( (t2p->pdf_transcode == T2P_TRANSCODE_RAW) && ((edge == 0)\n#if defined(JPEG_SUPPORT) || defined(OJPEG_SUPPORT)\n\t\t|| (t2p->pdf_compression == T2P_COMPRESS_JPEG)\n#endif\n\t)\n\t){\n#ifdef CCITT_SUPPORT\n\t\tif(t2p->pdf_compression == T2P_COMPRESS_G4){\n\t\t\tbuffer= (unsigned char*) _TIFFmalloc(t2p->tiff_datasize);\n\t\t\tif(buffer==NULL){\n\t\t\t\tTIFFError(TIFF2PDF_MODULE, \n\t\t\t\t\t\"Can't allocate %u bytes of memory \"\n                                        \"for t2p_readwrite_pdf_image_tile, %s\", \n\t\t\t\t\tt2p->tiff_datasize, \n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\treturn(0);\n\t\t\t}\n\t\t\tTIFFReadRawTile(input, tile, (tdata_t) buffer, t2p->tiff_datasize);\n\t\t\tif (t2p->tiff_fillorder==FILLORDER_LSB2MSB){\n\t\t\t\t\tTIFFReverseBits(buffer, t2p->tiff_datasize);\n\t\t\t}\n\t\t\tt2pWriteFile(output, (tdata_t) buffer, t2p->tiff_datasize);\n\t\t\t_TIFFfree(buffer);\n\t\t\treturn(t2p->tiff_datasize);\n\t\t}\n#endif\n#ifdef ZIP_SUPPORT\n\t\tif(t2p->pdf_compression == T2P_COMPRESS_ZIP){\n\t\t\tbuffer= (unsigned char*) _TIFFmalloc(t2p->tiff_datasize);\n\t\t\tif(buffer==NULL){\n\t\t\t\tTIFFError(TIFF2PDF_MODULE, \n\t\t\t\t\t\"Can't allocate %u bytes of memory \"\n                                        \"for t2p_readwrite_pdf_image_tile, %s\", \n\t\t\t\t\tt2p->tiff_datasize, \n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\treturn(0);\n\t\t\t}\n\t\t\tTIFFReadRawTile(input, tile, (tdata_t) buffer, t2p->tiff_datasize);\n\t\t\tif (t2p->tiff_fillorder==FILLORDER_LSB2MSB){\n\t\t\t\t\tTIFFReverseBits(buffer, t2p->tiff_datasize);\n\t\t\t}\n\t\t\tt2pWriteFile(output, (tdata_t) buffer, t2p->tiff_datasize);\n\t\t\t_TIFFfree(buffer);\n\t\t\treturn(t2p->tiff_datasize);\n\t\t}\n#endif\n#ifdef OJPEG_SUPPORT\n\t\tif(t2p->tiff_compression == COMPRESSION_OJPEG){\n\t\t\tif(! t2p->pdf_ojpegdata){\n\t\t\t\tTIFFError(TIFF2PDF_MODULE, \n\t\t\t\t\t\"No support for OJPEG image %s with \"\n                                        \"bad tables\", \n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\treturn(0);\n\t\t\t}\n\t\t\tbuffer=(unsigned char*) _TIFFmalloc(t2p->tiff_datasize);\n\t\t\tif(buffer==NULL){\n\t\t\t\tTIFFError(TIFF2PDF_MODULE, \n\t\t\t\t\t\"Can't allocate %u bytes of memory \"\n                                        \"for t2p_readwrite_pdf_image, %s\", \n\t\t\t\t\tt2p->tiff_datasize, \n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\treturn(0);\n\t\t\t}\n\t\t\t_TIFFmemcpy(buffer, t2p->pdf_ojpegdata, t2p->pdf_ojpegdatalength);\n\t\t\tif(edge!=0){\n\t\t\t\tif(t2p_tile_is_bottom_edge(t2p->tiff_tiles[t2p->pdf_page], tile)){\n\t\t\t\t\tbuffer[7]=\n\t\t\t\t\t\t(t2p->tiff_tiles[t2p->pdf_page].tiles_edgetilelength >> 8) & 0xff;\n\t\t\t\t\tbuffer[8]=\n\t\t\t\t\t\t(t2p->tiff_tiles[t2p->pdf_page].tiles_edgetilelength ) & 0xff;\n\t\t\t\t}\n\t\t\t\tif(t2p_tile_is_right_edge(t2p->tiff_tiles[t2p->pdf_page], tile)){\n\t\t\t\t\tbuffer[9]=\n\t\t\t\t\t\t(t2p->tiff_tiles[t2p->pdf_page].tiles_edgetilewidth >> 8) & 0xff;\n\t\t\t\t\tbuffer[10]=\n\t\t\t\t\t\t(t2p->tiff_tiles[t2p->pdf_page].tiles_edgetilewidth ) & 0xff;\n\t\t\t\t}\n\t\t\t}\n\t\t\tbufferoffset=t2p->pdf_ojpegdatalength;\n\t\t\tbufferoffset+=TIFFReadRawTile(input, \n\t\t\t\t\ttile, \n\t\t\t\t\t(tdata_t) &(((unsigned char*)buffer)[bufferoffset]), \n\t\t\t\t\t-1);\n\t\t\t((unsigned char*)buffer)[bufferoffset++]=0xff;\n\t\t\t((unsigned char*)buffer)[bufferoffset++]=0xd9;\n\t\t\tt2pWriteFile(output, (tdata_t) buffer, bufferoffset);\n\t\t\t_TIFFfree(buffer);\n\t\t\treturn(bufferoffset);\n\t\t}\n#endif\n#ifdef JPEG_SUPPORT\n\t\tif(t2p->tiff_compression == COMPRESSION_JPEG){\n\t\t\tunsigned char table_end[2];\n\t\t\tuint32 count = 0;\n\t\t\tbuffer= (unsigned char*) _TIFFmalloc(t2p->tiff_datasize);\n\t\t\tif(buffer==NULL){\n\t\t\t\tTIFFError(TIFF2PDF_MODULE, \n\t\t\t\t\t\"Can't allocate %u bytes of memory \"\n                                        \"for t2p_readwrite_pdf_image_tile, %s\", \n\t\t\t\t\tt2p->tiff_datasize, \n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\treturn(0);\n\t\t\t}\n\t\t\tif(TIFFGetField(input, TIFFTAG_JPEGTABLES, &count, &jpt) != 0) {\n\t\t\t\tif (count > 0) {\n\t\t\t\t\t_TIFFmemcpy(buffer, jpt, count);\n\t\t\t\t\tbufferoffset += count - 2;\n\t\t\t\t\ttable_end[0] = buffer[bufferoffset-2];\n\t\t\t\t\ttable_end[1] = buffer[bufferoffset-1];\n\t\t\t\t}\n\t\t\t\tif (count > 0) {\n\t\t\t\t\txuint32 = bufferoffset;\n\t\t\t\t\tbufferoffset += TIFFReadRawTile(\n\t\t\t\t\t\tinput, \n\t\t\t\t\t\ttile, \n\t\t\t\t\t\t(tdata_t) &(((unsigned char*)buffer)[bufferoffset-2]), \n\t\t\t\t\t\t-1);\n\t\t\t\t\t\tbuffer[xuint32-2]=table_end[0];\n\t\t\t\t\t\tbuffer[xuint32-1]=table_end[1];\n\t\t\t\t} else {\n\t\t\t\t\tbufferoffset += TIFFReadRawTile(\n\t\t\t\t\t\tinput, \n\t\t\t\t\t\ttile, \n\t\t\t\t\t\t(tdata_t) &(((unsigned char*)buffer)[bufferoffset]), \n\t\t\t\t\t\t-1);\n\t\t\t\t}\n\t\t\t}\n\t\t\tt2pWriteFile(output, (tdata_t) buffer, bufferoffset);\n\t\t\t_TIFFfree(buffer);\n\t\t\treturn(bufferoffset);\n\t\t}\n#endif\n\t\t(void)0;\n\t}\n\n\tif(t2p->pdf_sample==T2P_SAMPLE_NOTHING){\n\t\tbuffer = (unsigned char*) _TIFFmalloc(t2p->tiff_datasize);\n\t\tif(buffer==NULL){\n\t\t\tTIFFError(TIFF2PDF_MODULE, \n\t\t\t\t\"Can't allocate %u bytes of memory for \"\n                                \"t2p_readwrite_pdf_image_tile, %s\", \n\t\t\t\tt2p->tiff_datasize, \n\t\t\t\tTIFFFileName(input));\n\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\treturn(0);\n\t\t}\n\n\t\tread = TIFFReadEncodedTile(\n\t\t\tinput, \n\t\t\ttile, \n\t\t\t(tdata_t) &buffer[bufferoffset], \n\t\t\tt2p->tiff_datasize);\n\t\tif(read==-1){\n\t\t\tTIFFError(TIFF2PDF_MODULE, \n\t\t\t\t\"Error on decoding tile %u of %s\", \n\t\t\t\ttile, \n\t\t\t\tTIFFFileName(input));\n\t\t\t_TIFFfree(buffer);\n\t\t\tt2p->t2p_error=T2P_ERR_ERROR;\n\t\t\treturn(0);\n\t\t}\n\n\t} else {\n\n\t\tif(t2p->pdf_sample == T2P_SAMPLE_PLANAR_SEPARATE_TO_CONTIG){\n\t\t\tseptilesize=TIFFTileSize(input);\n\t\t\tseptilecount=TIFFNumberOfTiles(input);\n\t\t\ttilesize=septilesize*t2p->tiff_samplesperpixel;\n\t\t\ttilecount=septilecount/t2p->tiff_samplesperpixel;\n\t\t\tbuffer = (unsigned char*) _TIFFmalloc(t2p->tiff_datasize);\n\t\t\tif(buffer==NULL){\n\t\t\t\tTIFFError(TIFF2PDF_MODULE, \n\t\t\t\t\t\"Can't allocate %u bytes of memory \"\n                                        \"for t2p_readwrite_pdf_image_tile, %s\", \n\t\t\t\t\tt2p->tiff_datasize, \n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\treturn(0);\n\t\t\t}\n\t\t\tsamplebuffer = (unsigned char*) _TIFFmalloc(t2p->tiff_datasize);\n\t\t\tif(samplebuffer==NULL){\n\t\t\t\tTIFFError(TIFF2PDF_MODULE, \n\t\t\t\t\t\"Can't allocate %u bytes of memory \"\n                                        \"for t2p_readwrite_pdf_image_tile, %s\", \n\t\t\t\t\tt2p->tiff_datasize, \n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\treturn(0);\n\t\t\t}\n\t\t\tsamplebufferoffset=0;\n\t\t\tfor(i=0;i<t2p->tiff_samplesperpixel;i++){\n\t\t\t\tread = \n\t\t\t\t\tTIFFReadEncodedTile(input, \n\t\t\t\t\t\ttile + i*tilecount, \n\t\t\t\t\t\t(tdata_t) &(samplebuffer[samplebufferoffset]), \n\t\t\t\t\t\tseptilesize);\n\t\t\t\tif(read==-1){\n\t\t\t\t\tTIFFError(TIFF2PDF_MODULE, \n\t\t\t\t\t\t\"Error on decoding tile %u of %s\", \n\t\t\t\t\t\ttile + i*tilecount, \n\t\t\t\t\t\tTIFFFileName(input));\n\t\t\t\t\t\t_TIFFfree(samplebuffer);\n\t\t\t\t\t\t_TIFFfree(buffer);\n\t\t\t\t\tt2p->t2p_error=T2P_ERR_ERROR;\n\t\t\t\t\treturn(0);\n\t\t\t\t}\n\t\t\t\tsamplebufferoffset+=read;\n\t\t\t}\n\t\t\tt2p_sample_planar_separate_to_contig(\n\t\t\t\tt2p,\n\t\t\t\t&(buffer[bufferoffset]),\n\t\t\t\tsamplebuffer, \n\t\t\t\tsamplebufferoffset); \n\t\t\tbufferoffset+=samplebufferoffset;\n\t\t\t_TIFFfree(samplebuffer);\n\t\t}\n\n\t\tif(buffer==NULL){\n\t\t\tbuffer = (unsigned char*) _TIFFmalloc(t2p->tiff_datasize);\n\t\t\tif(buffer==NULL){\n\t\t\t\tTIFFError(TIFF2PDF_MODULE, \n\t\t\t\t\t\"Can't allocate %u bytes of memory \"\n                                        \"for t2p_readwrite_pdf_image_tile, %s\", \n\t\t\t\t\tt2p->tiff_datasize, \n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\treturn(0);\n\t\t\t}\n\t\t\tread = TIFFReadEncodedTile(\n\t\t\t\tinput, \n\t\t\t\ttile, \n\t\t\t\t(tdata_t) &buffer[bufferoffset], \n\t\t\t\tt2p->tiff_datasize);\n\t\t\tif(read==-1){\n\t\t\t\tTIFFError(TIFF2PDF_MODULE, \n\t\t\t\t\t\"Error on decoding tile %u of %s\", \n\t\t\t\t\ttile, \n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\t_TIFFfree(buffer);\n\t\t\t\tt2p->t2p_error=T2P_ERR_ERROR;\n\t\t\t\treturn(0);\n\t\t\t}\n\t\t}\n\n\t\tif(t2p->pdf_sample & T2P_SAMPLE_RGBA_TO_RGB){\n\t\t\tt2p->tiff_datasize=t2p_sample_rgba_to_rgb(\n\t\t\t\t(tdata_t)buffer, \n\t\t\t\tt2p->tiff_tiles[t2p->pdf_page].tiles_tilewidth\n\t\t\t\t*t2p->tiff_tiles[t2p->pdf_page].tiles_tilelength);\n\t\t}\n\n\t\tif(t2p->pdf_sample & T2P_SAMPLE_RGBAA_TO_RGB){\n\t\t\tt2p->tiff_datasize=t2p_sample_rgbaa_to_rgb(\n\t\t\t\t(tdata_t)buffer, \n\t\t\t\tt2p->tiff_tiles[t2p->pdf_page].tiles_tilewidth\n\t\t\t\t*t2p->tiff_tiles[t2p->pdf_page].tiles_tilelength);\n\t\t}\n\n\t\tif(t2p->pdf_sample & T2P_SAMPLE_YCBCR_TO_RGB){\n\t\t\tTIFFError(TIFF2PDF_MODULE, \n\t\t\t\t\"No support for YCbCr to RGB in tile for %s\", \n\t\t\t\tTIFFFileName(input));\n\t\t\t_TIFFfree(buffer);\n\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\treturn(0);\n\t\t}\n\n\t\tif(t2p->pdf_sample & T2P_SAMPLE_LAB_SIGNED_TO_UNSIGNED){\n\t\t\tt2p->tiff_datasize=t2p_sample_lab_signed_to_unsigned(\n\t\t\t\t(tdata_t)buffer, \n\t\t\t\tt2p->tiff_tiles[t2p->pdf_page].tiles_tilewidth\n\t\t\t\t*t2p->tiff_tiles[t2p->pdf_page].tiles_tilelength);\n\t\t}\n\t}\n\n\tif(t2p_tile_is_right_edge(t2p->tiff_tiles[t2p->pdf_page], tile) != 0){\n\t\tt2p_tile_collapse_left(\n\t\t\tbuffer, \n\t\t\tTIFFTileRowSize(input),\n\t\t\tt2p->tiff_tiles[t2p->pdf_page].tiles_tilewidth,\n\t\t\tt2p->tiff_tiles[t2p->pdf_page].tiles_edgetilewidth, \n\t\t\tt2p->tiff_tiles[t2p->pdf_page].tiles_tilelength);\n\t}\n\n\n\tt2p_disable(output);\n\tTIFFSetField(output, TIFFTAG_PHOTOMETRIC, t2p->tiff_photometric);\n\tTIFFSetField(output, TIFFTAG_BITSPERSAMPLE, t2p->tiff_bitspersample);\n\tTIFFSetField(output, TIFFTAG_SAMPLESPERPIXEL, t2p->tiff_samplesperpixel);\n\tif(t2p_tile_is_right_edge(t2p->tiff_tiles[t2p->pdf_page], tile) == 0){\n\t\tTIFFSetField(\n\t\t\toutput, \n\t\t\tTIFFTAG_IMAGEWIDTH, \n\t\t\tt2p->tiff_tiles[t2p->pdf_page].tiles_tilewidth);\n\t} else {\n\t\tTIFFSetField(\n\t\t\toutput, \n\t\t\tTIFFTAG_IMAGEWIDTH, \n\t\t\tt2p->tiff_tiles[t2p->pdf_page].tiles_edgetilewidth);\n\t}\n\tif(t2p_tile_is_bottom_edge(t2p->tiff_tiles[t2p->pdf_page], tile) == 0){\n\t\tTIFFSetField(\n\t\t\toutput, \n\t\t\tTIFFTAG_IMAGELENGTH, \n\t\t\tt2p->tiff_tiles[t2p->pdf_page].tiles_tilelength);\n\t\tTIFFSetField(\n\t\t\toutput, \n\t\t\tTIFFTAG_ROWSPERSTRIP, \n\t\t\tt2p->tiff_tiles[t2p->pdf_page].tiles_tilelength);\n\t} else {\n\t\tTIFFSetField(\n\t\t\toutput, \n\t\t\tTIFFTAG_IMAGELENGTH, \n\t\t\tt2p->tiff_tiles[t2p->pdf_page].tiles_edgetilelength);\n\t\tTIFFSetField(\n\t\t\toutput, \n\t\t\tTIFFTAG_ROWSPERSTRIP, \n\t\t\tt2p->tiff_tiles[t2p->pdf_page].tiles_edgetilelength);\n\t}\n\tTIFFSetField(output, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);\n\tTIFFSetField(output, TIFFTAG_FILLORDER, FILLORDER_MSB2LSB);\n\n\tswitch(t2p->pdf_compression){\n\tcase T2P_COMPRESS_NONE:\n\t\tTIFFSetField(output, TIFFTAG_COMPRESSION, COMPRESSION_NONE);\n\t\tbreak;\n#ifdef CCITT_SUPPORT\n\tcase T2P_COMPRESS_G4:\n\t\tTIFFSetField(output, TIFFTAG_COMPRESSION, COMPRESSION_CCITTFAX4);\n\t\tbreak;\n#endif\n#ifdef JPEG_SUPPORT\n\tcase T2P_COMPRESS_JPEG:\n\t\tif (t2p->tiff_photometric==PHOTOMETRIC_YCBCR) {\n\t\t\tuint16 hor = 0, ver = 0;\n\t\t\tif (TIFFGetField(input, TIFFTAG_YCBCRSUBSAMPLING, &hor, &ver)!=0) {\n\t\t\t\tif (hor != 0 && ver != 0) {\n\t\t\t\t\tTIFFSetField(output, TIFFTAG_YCBCRSUBSAMPLING, hor, ver);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(TIFFGetField(input, TIFFTAG_REFERENCEBLACKWHITE, &xfloatp)!=0){\n\t\t\t\tTIFFSetField(output, TIFFTAG_REFERENCEBLACKWHITE, xfloatp);\n\t\t\t}\n\t\t}\n\t\tTIFFSetField(output, TIFFTAG_COMPRESSION, COMPRESSION_JPEG);\n\t\tTIFFSetField(output, TIFFTAG_JPEGTABLESMODE, 0); /* JPEGTABLESMODE_NONE */\n\t\tif(t2p->pdf_colorspace & (T2P_CS_RGB | T2P_CS_LAB)){\n\t\t\tTIFFSetField(output, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_YCBCR);\n\t\t\tif(t2p->tiff_photometric != PHOTOMETRIC_YCBCR){\n\t\t\t\tTIFFSetField(output, TIFFTAG_JPEGCOLORMODE, JPEGCOLORMODE_RGB);\n\t\t\t} else {\n\t\t\t\tTIFFSetField(output, TIFFTAG_JPEGCOLORMODE, JPEGCOLORMODE_RAW);\n\t\t\t}\n\t\t}\n\t\tif(t2p->pdf_colorspace & T2P_CS_GRAY){\n\t\t\t(void)0;\n\t\t}\n\t\tif(t2p->pdf_colorspace & T2P_CS_CMYK){\n\t\t\t(void)0;\n\t\t}\n\t\tif(t2p->pdf_defaultcompressionquality != 0){\n\t\t\tTIFFSetField(output, \n\t\t\t\tTIFFTAG_JPEGQUALITY, \n\t\t\t\tt2p->pdf_defaultcompressionquality);\n\t\t}\n\t\tbreak;\n#endif\n#ifdef ZIP_SUPPORT\n\tcase T2P_COMPRESS_ZIP:\n\t\tTIFFSetField(output, TIFFTAG_COMPRESSION, COMPRESSION_DEFLATE);\n\t\tif(t2p->pdf_defaultcompressionquality%100 != 0){\n\t\t\tTIFFSetField(output, \n\t\t\t\tTIFFTAG_PREDICTOR, \n\t\t\t\tt2p->pdf_defaultcompressionquality % 100);\n\t\t}\n\t\tif(t2p->pdf_defaultcompressionquality/100 != 0){\n\t\t\tTIFFSetField(output, \n\t\t\t\tTIFFTAG_ZIPQUALITY, \n\t\t\t\t(t2p->pdf_defaultcompressionquality / 100));\n\t\t}\n\t\tbreak;\n#endif\n\tdefault:\n\t\tbreak;\n\t}\n\n\tt2p_enable(output);\n\tt2p->outputwritten = 0;\n\tbufferoffset = TIFFWriteEncodedStrip(output, (tstrip_t) 0, buffer,\n\t\t\t\t\t     TIFFStripSize(output)); \n\tif (buffer != NULL) {\n\t\t_TIFFfree(buffer);\n\t\tbuffer = NULL;\n\t}\n\tif (bufferoffset == -1) {\n\t\tTIFFError(TIFF2PDF_MODULE, \n\t\t\t  \"Error writing encoded tile to output PDF %s\", \n\t\t\t  TIFFFileName(output));\n\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\treturn(0);\n\t}\n\t\n\twritten = t2p->outputwritten;\n\t\n\treturn(written);\n}\n\n#ifdef OJPEG_SUPPORT\nint t2p_process_ojpeg_tables(T2P* t2p, TIFF* input){\n\tuint16 proc=0;\n\tvoid* q;\n\tuint32 q_length=0;\n\tvoid* dc;\n\tuint32 dc_length=0;\n\tvoid* ac;\n\tuint32 ac_length=0;\n\tuint16* lp;\n\tuint16* pt;\n\tuint16 h_samp=1;\n\tuint16 v_samp=1;\n\tunsigned char* ojpegdata;\n\tuint16 table_count;\n\tuint32 offset_table;\n\tuint32 offset_ms_l;\n\tuint32 code_count;\n\tuint32 i=0;\n\tuint32 dest=0;\n\tuint16 ri=0;\n\tuint32 rows=0;\n\t\n\tif(!TIFFGetField(input, TIFFTAG_JPEGPROC, &proc)){\n\t\tTIFFError(TIFF2PDF_MODULE, \n\t\t\t\"Missing JPEGProc field in OJPEG image %s\", \n\t\t\tTIFFFileName(input));\n\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\treturn(0);\n\t}\n\tif(proc!=JPEGPROC_BASELINE && proc!=JPEGPROC_LOSSLESS){\n\t\tTIFFError(TIFF2PDF_MODULE, \n\t\t\t\"Bad JPEGProc field in OJPEG image %s\", \n\t\t\tTIFFFileName(input));\n\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\treturn(0);\n\t}\n\tif(!TIFFGetField(input, TIFFTAG_JPEGQTABLES, &q_length, &q)){\n\t\tTIFFError(TIFF2PDF_MODULE, \n\t\t\t\"Missing JPEGQTables field in OJPEG image %s\", \n\t\t\tTIFFFileName(input));\n\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\treturn(0);\n\t}\n\tif(q_length < (64U * t2p->tiff_samplesperpixel)){\n\t\tTIFFError(TIFF2PDF_MODULE, \n\t\t\t\"Bad JPEGQTables field in OJPEG image %s\", \n\t\t\tTIFFFileName(input));\n\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\treturn(0);\n\t} \n\tif(!TIFFGetField(input, TIFFTAG_JPEGDCTABLES, &dc_length, &dc)){\n\t\tTIFFError(TIFF2PDF_MODULE, \n\t\t\t\"Missing JPEGDCTables field in OJPEG image %s\", \n\t\t\tTIFFFileName(input));\n\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\treturn(0);\n\t}\n\tif(proc==JPEGPROC_BASELINE){\n\t\tif(!TIFFGetField(input, TIFFTAG_JPEGACTABLES, &ac_length, &ac)){\n\t\t\tTIFFError(TIFF2PDF_MODULE, \n\t\t\t\t\"Missing JPEGACTables field in OJPEG image %s\", \n\t\t\t\tTIFFFileName(input));\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\treturn(0);\n\t\t}\n\t} else {\n\t\tif(!TIFFGetField(input, TIFFTAG_JPEGLOSSLESSPREDICTORS, &lp)){\n\t\t\tTIFFError(TIFF2PDF_MODULE, \n\t\t\t\t\"Missing JPEGLosslessPredictors field in OJPEG image %s\", \n\t\t\t\tTIFFFileName(input));\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\treturn(0);\n\t\t}\n\t\tif(!TIFFGetField(input, TIFFTAG_JPEGPOINTTRANSFORM, &pt)){\n\t\t\tTIFFError(TIFF2PDF_MODULE, \n\t\t\t\t\"Missing JPEGPointTransform field in OJPEG image %s\", \n\t\t\t\tTIFFFileName(input));\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\treturn(0);\n\t\t}\n\t}\n\tif(!TIFFGetField(input, TIFFTAG_YCBCRSUBSAMPLING, &h_samp, &v_samp)){\n\t\th_samp=1;\n\t\tv_samp=1;\n\t}\n\tif(t2p->pdf_ojpegdata != NULL){\n\t\t_TIFFfree(t2p->pdf_ojpegdata);\n\t\tt2p->pdf_ojpegdata=NULL;\n\t} \n\tt2p->pdf_ojpegdata = _TIFFmalloc(2048);\n\tif(t2p->pdf_ojpegdata == NULL){\n\t\tTIFFError(TIFF2PDF_MODULE, \n\t\t\t\"Can't allocate %u bytes of memory for t2p_process_ojpeg_tables, %s\", \n\t\t\t2048, \n\t\t\tTIFFFileName(input));\n\t\treturn(0);\n\t}\n\t_TIFFmemset(t2p->pdf_ojpegdata, 0x00, 2048);\n\tt2p->pdf_ojpegdatalength = 0;\n\ttable_count=t2p->tiff_samplesperpixel;\n\tif(proc==JPEGPROC_BASELINE){\n\t\tif(table_count>2) table_count=2;\n\t}\n\tojpegdata=(unsigned char*)t2p->pdf_ojpegdata;\n\tojpegdata[t2p->pdf_ojpegdatalength++]=0xff;\n\tojpegdata[t2p->pdf_ojpegdatalength++]=0xd8;\n\tojpegdata[t2p->pdf_ojpegdatalength++]=0xff;\n\tif(proc==JPEGPROC_BASELINE){\n\t\tojpegdata[t2p->pdf_ojpegdatalength++]=0xc0;\n\t} else {\n\t\tojpegdata[t2p->pdf_ojpegdatalength++]=0xc3;\n\t}\n\tojpegdata[t2p->pdf_ojpegdatalength++]=0x00;\n\tojpegdata[t2p->pdf_ojpegdatalength++]=(8 + 3*t2p->tiff_samplesperpixel);\n\tojpegdata[t2p->pdf_ojpegdatalength++]=(t2p->tiff_bitspersample & 0xff);\n\tif(TIFFIsTiled(input)){\n\t\tojpegdata[t2p->pdf_ojpegdatalength++]=\n\t\t\t(t2p->tiff_tiles[t2p->pdf_page].tiles_tilelength >> 8) & 0xff;\n\t\tojpegdata[t2p->pdf_ojpegdatalength++]=\n\t\t\t(t2p->tiff_tiles[t2p->pdf_page].tiles_tilelength ) & 0xff;\n\t\tojpegdata[t2p->pdf_ojpegdatalength++]=\n\t\t\t(t2p->tiff_tiles[t2p->pdf_page].tiles_tilewidth >> 8) & 0xff;\n\t\tojpegdata[t2p->pdf_ojpegdatalength++]=\n\t\t\t(t2p->tiff_tiles[t2p->pdf_page].tiles_tilewidth ) & 0xff;\n\t} else {\n\t\tojpegdata[t2p->pdf_ojpegdatalength++]=\n\t\t\t(t2p->tiff_length >> 8) & 0xff;\n\t\tojpegdata[t2p->pdf_ojpegdatalength++]=\n\t\t\t(t2p->tiff_length ) & 0xff;\n\t\tojpegdata[t2p->pdf_ojpegdatalength++]=\n\t\t\t(t2p->tiff_width >> 8) & 0xff;\n\t\tojpegdata[t2p->pdf_ojpegdatalength++]=\n\t\t\t(t2p->tiff_width ) & 0xff;\n\t}\n\tojpegdata[t2p->pdf_ojpegdatalength++]=(t2p->tiff_samplesperpixel & 0xff);\n\tfor(i=0;i<t2p->tiff_samplesperpixel;i++){\n\t\tojpegdata[t2p->pdf_ojpegdatalength++]=i;\n\t\tif(i==0){\n\t\t\tojpegdata[t2p->pdf_ojpegdatalength] |= h_samp<<4 & 0xf0;;\n\t\t\tojpegdata[t2p->pdf_ojpegdatalength++] |= v_samp & 0x0f;\n\t\t} else {\n\t\t\t\tojpegdata[t2p->pdf_ojpegdatalength++]= 0x11;\n\t\t}\n\t\tojpegdata[t2p->pdf_ojpegdatalength++]=i;\n\t}\n\tfor(dest=0;dest<t2p->tiff_samplesperpixel;dest++){\n\t\tojpegdata[t2p->pdf_ojpegdatalength++]=0xff;\n\t\tojpegdata[t2p->pdf_ojpegdatalength++]=0xdb;\n\t\tojpegdata[t2p->pdf_ojpegdatalength++]=0x00;\n\t\tojpegdata[t2p->pdf_ojpegdatalength++]=0x43;\n\t\tojpegdata[t2p->pdf_ojpegdatalength++]=dest;\n\t\t_TIFFmemcpy( &(ojpegdata[t2p->pdf_ojpegdatalength++]), \n\t\t\t&(((unsigned char*)q)[64*dest]), 64);\n\t\tt2p->pdf_ojpegdatalength+=64;\n\t}\n\toffset_table=0;\n\tfor(dest=0;dest<table_count;dest++){\n\t\tojpegdata[t2p->pdf_ojpegdatalength++]=0xff;\n\t\tojpegdata[t2p->pdf_ojpegdatalength++]=0xc4;\n\t\toffset_ms_l=t2p->pdf_ojpegdatalength;\n\t\tt2p->pdf_ojpegdatalength+=2;\n\t\tojpegdata[t2p->pdf_ojpegdatalength++]=dest & 0x0f;\n\t\t_TIFFmemcpy( &(ojpegdata[t2p->pdf_ojpegdatalength]), \n\t\t\t&(((unsigned char*)dc)[offset_table]), 16);\n\t\tcode_count=0;\n\t\toffset_table+=16;\n\t\tfor(i=0;i<16;i++){\n\t\t\tcode_count+=ojpegdata[t2p->pdf_ojpegdatalength++];\n\t\t}\n\t\tojpegdata[offset_ms_l]=((19+code_count)>>8) & 0xff;\n\t\tojpegdata[offset_ms_l+1]=(19+code_count) & 0xff;\n\t\t_TIFFmemcpy( &(ojpegdata[t2p->pdf_ojpegdatalength]), \n\t\t\t&(((unsigned char*)dc)[offset_table]), code_count);\n\t\toffset_table+=code_count;\n\t\tt2p->pdf_ojpegdatalength+=code_count;\n\t}\n\tif(proc==JPEGPROC_BASELINE){\n\toffset_table=0;\n\t\tfor(dest=0;dest<table_count;dest++){\n\t\t\tojpegdata[t2p->pdf_ojpegdatalength++]=0xff;\n\t\t\tojpegdata[t2p->pdf_ojpegdatalength++]=0xc4;\n\t\t\toffset_ms_l=t2p->pdf_ojpegdatalength;\n\t\t\tt2p->pdf_ojpegdatalength+=2;\n\t\t\tojpegdata[t2p->pdf_ojpegdatalength] |= 0x10;\n\t\t\tojpegdata[t2p->pdf_ojpegdatalength++] |=dest & 0x0f;\n\t\t\t_TIFFmemcpy( &(ojpegdata[t2p->pdf_ojpegdatalength]), \n\t\t\t\t&(((unsigned char*)ac)[offset_table]), 16);\n\t\t\tcode_count=0;\n\t\t\toffset_table+=16;\n\t\t\tfor(i=0;i<16;i++){\n\t\t\t\tcode_count+=ojpegdata[t2p->pdf_ojpegdatalength++];\n\t\t\t}\t\n\t\t\tojpegdata[offset_ms_l]=((19+code_count)>>8) & 0xff;\n\t\t\tojpegdata[offset_ms_l+1]=(19+code_count) & 0xff;\n\t\t\t_TIFFmemcpy( &(ojpegdata[t2p->pdf_ojpegdatalength]), \n\t\t\t\t&(((unsigned char*)ac)[offset_table]), code_count);\n\t\t\toffset_table+=code_count;\n\t\t\tt2p->pdf_ojpegdatalength+=code_count;\n\t\t}\n\t}\n\tif(TIFFNumberOfStrips(input)>1){\n\t\tojpegdata[t2p->pdf_ojpegdatalength++]=0xff;\n\t\tojpegdata[t2p->pdf_ojpegdatalength++]=0xdd;\n\t\tojpegdata[t2p->pdf_ojpegdatalength++]=0x00;\n\t\tojpegdata[t2p->pdf_ojpegdatalength++]=0x04;\n\t\th_samp*=8;\n\t\tv_samp*=8;\n\t\tri=(t2p->tiff_width+h_samp-1) / h_samp;\n\t\tTIFFGetField(input, TIFFTAG_ROWSPERSTRIP, &rows);\n\t\tri*=(rows+v_samp-1)/v_samp;\n\t\tojpegdata[t2p->pdf_ojpegdatalength++]= (ri>>8) & 0xff;\n\t\tojpegdata[t2p->pdf_ojpegdatalength++]= ri & 0xff;\n\t}\n\tojpegdata[t2p->pdf_ojpegdatalength++]=0xff;\n\tojpegdata[t2p->pdf_ojpegdatalength++]=0xda;\n\tojpegdata[t2p->pdf_ojpegdatalength++]=0x00;\n\tojpegdata[t2p->pdf_ojpegdatalength++]=(6 + 2*t2p->tiff_samplesperpixel);\n\tojpegdata[t2p->pdf_ojpegdatalength++]=t2p->tiff_samplesperpixel & 0xff;\n\tfor(i=0;i<t2p->tiff_samplesperpixel;i++){\n\t\tojpegdata[t2p->pdf_ojpegdatalength++]= i & 0xff;\n\t\tif(proc==JPEGPROC_BASELINE){\n\t\t\tojpegdata[t2p->pdf_ojpegdatalength] |= \n\t\t\t\t( ( (i>(table_count-1U)) ? (table_count-1U) : i) << 4U) & 0xf0;\n\t\t\tojpegdata[t2p->pdf_ojpegdatalength++] |= \n\t\t\t\t( (i>(table_count-1U)) ? (table_count-1U) : i) & 0x0f;\n\t\t} else {\n\t\t\tojpegdata[t2p->pdf_ojpegdatalength++] =  (i << 4) & 0xf0;\n\t\t}\n\t}\n\tif(proc==JPEGPROC_BASELINE){\n\t\tt2p->pdf_ojpegdatalength++;\n\t\tojpegdata[t2p->pdf_ojpegdatalength++]=0x3f;\n\t\tt2p->pdf_ojpegdatalength++;\n\t} else {\n\t\tojpegdata[t2p->pdf_ojpegdatalength++]= (lp[0] & 0xff);\n\t\tt2p->pdf_ojpegdatalength++;\n\t\tojpegdata[t2p->pdf_ojpegdatalength++]= (pt[0] & 0x0f);\n\t}\n\n\treturn(1);\n}\n#endif\n\n#ifdef JPEG_SUPPORT\nint t2p_process_jpeg_strip(\n\tunsigned char* strip, \n\ttsize_t* striplength, \n\tunsigned char* buffer, \n\ttsize_t* bufferoffset, \n\ttstrip_t no, \n\tuint32 height){\n\n\ttsize_t i=0;\n\tuint16 ri =0;\n\tuint16 v_samp=1;\n\tuint16 h_samp=1;\n\tint j=0;\n\t\n\ti++;\n\t\n\twhile(i<(*striplength)){\n\t\tswitch( strip[i] ){\n\t\t\tcase 0xd8:\n\t\t\t\ti+=2;\n\t\t\t\tbreak;\n\t\t\tcase 0xc0:\n\t\t\tcase 0xc1:\n\t\t\tcase 0xc3:\n\t\t\tcase 0xc9:\n\t\t\tcase 0xca:\n\t\t\t\tif(no==0){\n\t\t\t\t\t_TIFFmemcpy(&(buffer[*bufferoffset]), &(strip[i-1]), strip[i+2]+2);\n\t\t\t\t\tfor(j=0;j<buffer[*bufferoffset+9];j++){\n\t\t\t\t\t\tif( (buffer[*bufferoffset+11+(2*j)]>>4) > h_samp) \n\t\t\t\t\t\t\th_samp = (buffer[*bufferoffset+11+(2*j)]>>4);\n\t\t\t\t\t\tif( (buffer[*bufferoffset+11+(2*j)] & 0x0f) > v_samp) \n\t\t\t\t\t\t\tv_samp = (buffer[*bufferoffset+11+(2*j)] & 0x0f);\n\t\t\t\t\t}\n\t\t\t\t\tv_samp*=8;\n\t\t\t\t\th_samp*=8;\n\t\t\t\t\tri=((( ((uint16)(buffer[*bufferoffset+5])<<8) | \n\t\t\t\t\t(uint16)(buffer[*bufferoffset+6]) )+v_samp-1)/ \n\t\t\t\t\tv_samp);\n\t\t\t\t\tri*=((( ((uint16)(buffer[*bufferoffset+7])<<8) | \n\t\t\t\t\t(uint16)(buffer[*bufferoffset+8]) )+h_samp-1)/ \n\t\t\t\t\th_samp);\n\t\t\t\t\tbuffer[*bufferoffset+5]=\n                                          (unsigned char) ((height>>8) & 0xff);\n\t\t\t\t\tbuffer[*bufferoffset+6]=\n                                            (unsigned char) (height & 0xff);\n\t\t\t\t\t*bufferoffset+=strip[i+2]+2;\n\t\t\t\t\ti+=strip[i+2]+2;\n\n\t\t\t\t\tbuffer[(*bufferoffset)++]=0xff;\n\t\t\t\t\tbuffer[(*bufferoffset)++]=0xdd;\n\t\t\t\t\tbuffer[(*bufferoffset)++]=0x00;\n\t\t\t\t\tbuffer[(*bufferoffset)++]=0x04;\n\t\t\t\t\tbuffer[(*bufferoffset)++]=(ri >> 8) & 0xff;\n\t\t\t\t\tbuffer[(*bufferoffset)++]= ri & 0xff;\n\t\t\t\t} else {\n\t\t\t\t\ti+=strip[i+2]+2;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 0xc4:\n\t\t\tcase 0xdb:\n\t\t\t\t_TIFFmemcpy(&(buffer[*bufferoffset]), &(strip[i-1]), strip[i+2]+2);\n\t\t\t\t*bufferoffset+=strip[i+2]+2;\n\t\t\t\ti+=strip[i+2]+2;\n\t\t\t\tbreak;\n\t\t\tcase 0xda:\n\t\t\t\tif(no==0){\n\t\t\t\t\t_TIFFmemcpy(&(buffer[*bufferoffset]), &(strip[i-1]), strip[i+2]+2);\n\t\t\t\t\t*bufferoffset+=strip[i+2]+2;\n\t\t\t\t\ti+=strip[i+2]+2;\n\t\t\t\t} else {\n\t\t\t\t\tbuffer[(*bufferoffset)++]=0xff;\n\t\t\t\t\tbuffer[(*bufferoffset)++]=\n                                            (unsigned char)(0xd0 | ((no-1)%8));\n\t\t\t\t\ti+=strip[i+2]+2;\n\t\t\t\t}\n\t\t\t\t_TIFFmemcpy(&(buffer[*bufferoffset]), &(strip[i-1]), (*striplength)-i-1);\n\t\t\t\t*bufferoffset+=(*striplength)-i-1;\n\t\t\t\treturn(1);\n\t\t\tdefault:\n\t\t\t\ti+=strip[i+2]+2;\n\t\t}\n\t}\n\t\n\n\treturn(0);\n}\n#endif\n\n/*\n\tThis functions converts a tilewidth x tilelength buffer of samples into an edgetilewidth x \n\ttilelength buffer of samples.\n*/\nvoid t2p_tile_collapse_left(\n\ttdata_t buffer, \n\ttsize_t scanwidth, \n\tuint32 tilewidth, \n\tuint32 edgetilewidth, \n\tuint32 tilelength){\n\t\n\tuint32 i=0;\n\ttsize_t edgescanwidth=0;\n\t\n\tedgescanwidth = (scanwidth * edgetilewidth + (tilewidth - 1))/ tilewidth;\n\tfor(i=i;i<tilelength;i++){\n\t\t_TIFFmemcpy( \n\t\t\t&(((char*)buffer)[edgescanwidth*i]), \n\t\t\t&(((char*)buffer)[scanwidth*i]), \n\t\t\tedgescanwidth);\n\t}\n\t\n\treturn;\n}\n\n\n/*\n * This function calls TIFFWriteDirectory on the output after blanking its\n * output by replacing the read, write, and seek procedures with empty\n * implementations, then it replaces the original implementations.\n */\n\nvoid\nt2p_write_advance_directory(T2P* t2p, TIFF* output)\n{\n\tt2p_disable(output);\n\tif(!TIFFWriteDirectory(output)){\n\t\tTIFFError(TIFF2PDF_MODULE, \n\t\t\t\"Error writing virtual directory to output PDF %s\", \n\t\t\tTIFFFileName(output));\n\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\treturn;\n\t}\n\tt2p_enable(output);\n\treturn;\n}\n\ntsize_t t2p_sample_planar_separate_to_contig(\n\t\t\t\t\t\t\t\t\t\t\tT2P* t2p, \n\t\t\t\t\t\t\t\t\t\t\tunsigned char* buffer, \n\t\t\t\t\t\t\t\t\t\t\tunsigned char* samplebuffer, \n\t\t\t\t\t\t\t\t\t\t\ttsize_t samplebuffersize){\n\n\ttsize_t stride=0;\n\ttsize_t i=0;\n\ttsize_t j=0;\n\t\n\tstride=samplebuffersize/t2p->tiff_samplesperpixel;\n\tfor(i=0;i<stride;i++){\n\t\tfor(j=0;j<t2p->tiff_samplesperpixel;j++){\n\t\t\tbuffer[i*t2p->tiff_samplesperpixel + j] = samplebuffer[i + j*stride];\n\t\t}\n\t}\n\n\treturn(samplebuffersize);\n}\n\ntsize_t t2p_sample_realize_palette(T2P* t2p, unsigned char* buffer){\n\n\tuint32 sample_count=0;\n\tuint16 component_count=0;\n\tuint32 palette_offset=0;\n\tuint32 sample_offset=0;\n\tuint32 i=0;\n\tuint32 j=0;\n\tsample_count=t2p->tiff_width*t2p->tiff_length;\n\tcomponent_count=t2p->tiff_samplesperpixel;\n\t\n\tfor(i=sample_count;i>0;i--){\n\t\tpalette_offset=buffer[i-1] * component_count;\n\t\tsample_offset= (i-1) * component_count;\n\t\tfor(j=0;j<component_count;j++){\n\t\t\tbuffer[sample_offset+j]=t2p->pdf_palette[palette_offset+j];\n\t\t}\n\t}\n\n\treturn(0);\n}\n\n/*\n\tThis functions converts in place a buffer of ABGR interleaved data\n\tinto RGB interleaved data, discarding A.\n*/\n\ntsize_t t2p_sample_abgr_to_rgb(tdata_t data, uint32 samplecount)\n{\n\tuint32 i=0;\n\tuint32 sample=0;\n\t\n\tfor(i=0;i<samplecount;i++){\n\t\tsample=((uint32*)data)[i];\n\t\t((char*)data)[i*3]= (char) (sample & 0xff);\n\t\t((char*)data)[i*3+1]= (char) ((sample>>8) & 0xff);\n\t\t((char*)data)[i*3+2]= (char) ((sample>>16) & 0xff);\n\t}\n\n\treturn(i*3);\n}\n\n/*\n * This functions converts in place a buffer of RGBA interleaved data\n * into RGB interleaved data, discarding A.\n */\n\ntsize_t\nt2p_sample_rgbaa_to_rgb(tdata_t data, uint32 samplecount)\n{\n\tuint32 i;\n\t\n\tfor(i = 0; i < samplecount; i++)\n\t\tmemcpy((uint8*)data + i * 3, (uint8*)data + i * 4, 3);\n\n\treturn(i * 3);\n}\n\n/*\n * This functions converts in place a buffer of RGBA interleaved data\n * into RGB interleaved data, adding 255-A to each component sample.\n */\n\ntsize_t\nt2p_sample_rgba_to_rgb(tdata_t data, uint32 samplecount)\n{\n\tuint32 i = 0;\n\tuint32 sample = 0;\n\tuint8 alpha = 0;\n\t\n\tfor (i = 0; i < samplecount; i++) {\n\t\tsample=((uint32*)data)[i];\n\t\talpha=(uint8)((255 - (sample & 0xff)));\n\t\t((uint8 *)data)[i * 3] = (uint8) ((sample >> 24) & 0xff) + alpha;\n\t\t((uint8 *)data)[i * 3 + 1] = (uint8) ((sample >> 16) & 0xff) + alpha;\n\t\t((uint8 *)data)[i * 3 + 2] = (uint8) ((sample >> 8) & 0xff) + alpha;\n\t\t\n\t}\n\n\treturn (i * 3);\n}\n\n/*\n\tThis function converts the a and b samples of Lab data from signed\n\tto unsigned.\n*/\n\ntsize_t t2p_sample_lab_signed_to_unsigned(tdata_t buffer, uint32 samplecount){\n\n\tuint32 i=0;\n\n\tfor(i=0;i<samplecount;i++){\n\t\tif( (((unsigned char*)buffer)[(i*3)+1] & 0x80) !=0){\n\t\t\t((unsigned char*)buffer)[(i*3)+1] =\n\t\t\t\t(unsigned char)(0x80 + ((char*)buffer)[(i*3)+1]);\n\t\t} else {\n\t\t\t((unsigned char*)buffer)[(i*3)+1] |= 0x80;\n\t\t}\n\t\tif( (((unsigned char*)buffer)[(i*3)+2] & 0x80) !=0){\n\t\t\t((unsigned char*)buffer)[(i*3)+2] =\n\t\t\t\t(unsigned char)(0x80 + ((char*)buffer)[(i*3)+2]);\n\t\t} else {\n\t\t\t((unsigned char*)buffer)[(i*3)+2] |= 0x80;\n\t\t}\n\t}\n\n\treturn(samplecount*3);\n}\n\n/* \n\tThis function writes the PDF header to output.\n*/\n\ntsize_t t2p_write_pdf_header(T2P* t2p, TIFF* output){\n\n\ttsize_t written=0;\n\tchar buffer[16];\n\tint buflen=0;\n\t\n\tbuflen=sprintf(buffer, \"%%PDF-%u.%u \", t2p->pdf_majorversion&0xff, t2p->pdf_minorversion&0xff);\n\twritten += t2pWriteFile(output, (tdata_t) buffer, buflen);\n\twritten += t2pWriteFile(output, (tdata_t)\"\\n%\\342\\343\\317\\323\\n\", 7);\n\n\treturn(written);\n}\n\n/*\n\tThis function writes the beginning of a PDF object to output.\n*/\n\ntsize_t t2p_write_pdf_obj_start(uint32 number, TIFF* output){\n\n\ttsize_t written=0;\n\tchar buffer[16];\n\tint buflen=0;\n\n\tbuflen=sprintf(buffer, \"%lu\", (unsigned long)number);\n\twritten += t2pWriteFile(output, (tdata_t) buffer, buflen );\n\twritten += t2pWriteFile(output, (tdata_t) \" 0 obj\\n\", 7);\n\n\treturn(written);\n}\n\n/*\n\tThis function writes the end of a PDF object to output.\n*/\n\ntsize_t t2p_write_pdf_obj_end(TIFF* output){\n\n\ttsize_t written=0;\n\n\twritten += t2pWriteFile(output, (tdata_t) \"endobj\\n\", 7);\n\n\treturn(written);\n}\n\n/*\n\tThis function writes a PDF name object to output.\n*/\n\ntsize_t t2p_write_pdf_name(unsigned char* name, TIFF* output){\n\n\ttsize_t written=0;\n\tuint32 i=0;\n\tchar buffer[64];\n\tuint16 nextchar=0;\n\tuint32 namelen=0;\n\t\n\tnamelen = strlen((char *)name);\n\tif (namelen>126) {\n\t\tnamelen=126;\n\t}\n\twritten += t2pWriteFile(output, (tdata_t) \"/\", 1);\n\tfor (i=0;i<namelen;i++){\n\t\tif ( ((unsigned char)name[i]) < 0x21){\n\t\t\tsprintf(buffer, \"#%.2X\", name[i]);\n\t\t\tbuffer[sizeof(buffer) - 1] = '\\0';\n\t\t\twritten += t2pWriteFile(output, (tdata_t) buffer, 3);\n\t\t\tnextchar=1;\n\t\t}\n\t\tif ( ((unsigned char)name[i]) > 0x7E){\n\t\t\tsprintf(buffer, \"#%.2X\", name[i]);\n\t\t\tbuffer[sizeof(buffer) - 1] = '\\0';\n\t\t\twritten += t2pWriteFile(output, (tdata_t) buffer, 3);\n\t\t\tnextchar=1;\n\t\t}\n\t\tif (nextchar==0){\n\t\t\tswitch (name[i]){\n\t\t\t\tcase 0x23:\n\t\t\t\t\tsprintf(buffer, \"#%.2X\", name[i]);\n\t\t\t\t\tbuffer[sizeof(buffer) - 1] = '\\0';\n\t\t\t\t\twritten += t2pWriteFile(output, (tdata_t) buffer, 3);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 0x25:\n\t\t\t\t\tsprintf(buffer, \"#%.2X\", name[i]);\n\t\t\t\t\tbuffer[sizeof(buffer) - 1] = '\\0';\n\t\t\t\t\twritten += t2pWriteFile(output, (tdata_t) buffer, 3);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 0x28:\n\t\t\t\t\tsprintf(buffer, \"#%.2X\", name[i]);\n\t\t\t\t\tbuffer[sizeof(buffer) - 1] = '\\0';\n\t\t\t\t\twritten += t2pWriteFile(output, (tdata_t) buffer, 3);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 0x29:\n\t\t\t\t\tsprintf(buffer, \"#%.2X\", name[i]); \n\t\t\t\t\tbuffer[sizeof(buffer) - 1] = '\\0';\n\t\t\t\t\twritten += t2pWriteFile(output, (tdata_t) buffer, 3);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 0x2F:\n\t\t\t\t\tsprintf(buffer, \"#%.2X\", name[i]); \n\t\t\t\t\tbuffer[sizeof(buffer) - 1] = '\\0';\n\t\t\t\t\twritten += t2pWriteFile(output, (tdata_t) buffer, 3);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 0x3C:\n\t\t\t\t\tsprintf(buffer, \"#%.2X\", name[i]); \n\t\t\t\t\tbuffer[sizeof(buffer) - 1] = '\\0';\n\t\t\t\t\twritten += t2pWriteFile(output, (tdata_t) buffer, 3);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 0x3E:\n\t\t\t\t\tsprintf(buffer, \"#%.2X\", name[i]);\n\t\t\t\t\tbuffer[sizeof(buffer) - 1] = '\\0';\n\t\t\t\t\twritten += t2pWriteFile(output, (tdata_t) buffer, 3);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 0x5B:\n\t\t\t\t\tsprintf(buffer, \"#%.2X\", name[i]); \n\t\t\t\t\tbuffer[sizeof(buffer) - 1] = '\\0';\n\t\t\t\t\twritten += t2pWriteFile(output, (tdata_t) buffer, 3);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 0x5D:\n\t\t\t\t\tsprintf(buffer, \"#%.2X\", name[i]);\n\t\t\t\t\tbuffer[sizeof(buffer) - 1] = '\\0';\n\t\t\t\t\twritten += t2pWriteFile(output, (tdata_t) buffer, 3);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 0x7B:\n\t\t\t\t\tsprintf(buffer, \"#%.2X\", name[i]); \n\t\t\t\t\tbuffer[sizeof(buffer) - 1] = '\\0';\n\t\t\t\t\twritten += t2pWriteFile(output, (tdata_t) buffer, 3);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 0x7D:\n\t\t\t\t\tsprintf(buffer, \"#%.2X\", name[i]); \n\t\t\t\t\tbuffer[sizeof(buffer) - 1] = '\\0';\n\t\t\t\t\twritten += t2pWriteFile(output, (tdata_t) buffer, 3);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\twritten += t2pWriteFile(output, (tdata_t) &name[i], 1);\n\t\t\t}\n\t\t}\n\t\tnextchar=0;\n\t}\n\twritten += t2pWriteFile(output, (tdata_t) \" \", 1);\n\n\treturn(written);\n}\n\n/*\n\tThis function writes a PDF string object to output.\n*/\n\t\ntsize_t t2p_write_pdf_string(unsigned char* pdfstr, TIFF* output){\n\n\ttsize_t written = 0;\n\tuint32 i = 0;\n\tchar buffer[64];\n\tuint32 len = 0;\n\t\n\tlen = strlen((char *)pdfstr);\n\twritten += t2pWriteFile(output, (tdata_t) \"(\", 1);\n\tfor (i=0; i<len; i++) {\n\t\tif((pdfstr[i]&0x80) || (pdfstr[i]==127) || (pdfstr[i]<32)){\n\t\t\tsprintf(buffer, \"\\\\%.3hho\", pdfstr[i]);\n\t\t\tbuffer[sizeof(buffer) - 1] = '\\0';\n\t\t\twritten += t2pWriteFile(output, (tdata_t) buffer, 4);\n\t\t} else {\n\t\t\tswitch (pdfstr[i]){\n\t\t\t\tcase 0x08:\n\t\t\t\t\twritten += t2pWriteFile(output, (tdata_t) \"\\\\b\", 2);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 0x09:\n\t\t\t\t\twritten += t2pWriteFile(output, (tdata_t) \"\\\\t\", 2);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 0x0A:\n\t\t\t\t\twritten += t2pWriteFile(output, (tdata_t) \"\\\\n\", 2);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 0x0C:\n\t\t\t\t\twritten += t2pWriteFile(output, (tdata_t) \"\\\\f\", 2);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 0x0D:\n\t\t\t\t\twritten += t2pWriteFile(output, (tdata_t) \"\\\\r\", 2);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 0x28:\n\t\t\t\t\twritten += t2pWriteFile(output, (tdata_t) \"\\\\(\", 2);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 0x29:\n\t\t\t\t\twritten += t2pWriteFile(output, (tdata_t) \"\\\\)\", 2);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 0x5C:\n\t\t\t\t\twritten += t2pWriteFile(output, (tdata_t) \"\\\\\\\\\", 2);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\twritten += t2pWriteFile(output, (tdata_t) &pdfstr[i], 1);\n\t\t\t}\n\t\t}\n\t}\n\twritten += t2pWriteFile(output, (tdata_t) \") \", 1);\n\n\treturn(written);\n}\n\n\n/*\n\tThis function writes a buffer of data to output.\n*/\n\ntsize_t t2p_write_pdf_stream(tdata_t buffer, tsize_t len, TIFF* output){\n\n\ttsize_t written=0;\n\n\twritten += t2pWriteFile(output, (tdata_t) buffer, len);\n\n\treturn(written);\n}\n\n/*\n\tThis functions writes the beginning of a PDF stream to output.\n*/\n\ntsize_t t2p_write_pdf_stream_start(TIFF* output){\n\n\ttsize_t written=0;\n\n\twritten += t2pWriteFile(output, (tdata_t) \"stream\\n\", 7);\n\n\treturn(written);\n}\n\n/*\n\tThis function writes the end of a PDF stream to output. \n*/\n\ntsize_t t2p_write_pdf_stream_end(TIFF* output){\n\n\ttsize_t written=0;\n\n\twritten += t2pWriteFile(output, (tdata_t) \"\\nendstream\\n\", 11);\n\n\treturn(written);\n}\n\n/*\n\tThis function writes a stream dictionary for a PDF stream to output.\n*/\n\ntsize_t t2p_write_pdf_stream_dict(tsize_t len, uint32 number, TIFF* output){\n\t\n\ttsize_t written=0;\n\tchar buffer[16];\n\tint buflen=0;\n\t\n\twritten += t2pWriteFile(output, (tdata_t) \"/Length \", 8);\n\tif(len!=0){\n\t\twritten += t2p_write_pdf_stream_length(len, output);\n\t} else {\n\t\tbuflen=sprintf(buffer, \"%lu\", (unsigned long)number);\n\t\twritten += t2pWriteFile(output, (tdata_t) buffer, buflen);\n\t\twritten += t2pWriteFile(output, (tdata_t) \" 0 R \\n\", 6);\n\t}\n\t\n\treturn(written);\n}\n\n/*\n\tThis functions writes the beginning of a PDF stream dictionary to output.\n*/\n\ntsize_t t2p_write_pdf_stream_dict_start(TIFF* output){\n\n\ttsize_t written=0;\n\n\twritten += t2pWriteFile(output, (tdata_t) \"<< \\n\", 4);\n\n\treturn(written);\n}\n\n/*\n\tThis function writes the end of a PDF stream dictionary to output. \n*/\n\ntsize_t t2p_write_pdf_stream_dict_end(TIFF* output){\n\n\ttsize_t written=0;\n\n\twritten += t2pWriteFile(output, (tdata_t) \" >>\\n\", 4);\n\n\treturn(written);\n}\n\n/*\n\tThis function writes a number to output.\n*/\n\ntsize_t t2p_write_pdf_stream_length(tsize_t len, TIFF* output){\n\n\ttsize_t written=0;\n\tchar buffer[16];\n\tint buflen=0;\n\n\tbuflen=sprintf(buffer, \"%lu\", (unsigned long)len);\n\twritten += t2pWriteFile(output, (tdata_t) buffer, buflen);\n\twritten += t2pWriteFile(output, (tdata_t) \"\\n\", 1);\n\n\treturn(written);\n}\n\n/*\n\tThis function writes the PDF Catalog structure to output.\n*/\n\ntsize_t t2p_write_pdf_catalog(T2P* t2p, TIFF* output){\n\n\ttsize_t written=0;\n\tchar buffer[16];\n\tint buflen=0;\n\n\twritten += t2pWriteFile(output, \n\t\t(tdata_t)\"<< \\n/Type /Catalog \\n/Pages \", \n\t\t27);\n\tbuflen=sprintf(buffer, \"%lu\", (unsigned long)t2p->pdf_pages);\n\twritten += t2pWriteFile(output, (tdata_t) buffer, buflen );\n\twritten += t2pWriteFile(output, (tdata_t) \" 0 R \\n\", 6);\n\tif(t2p->pdf_fitwindow){\n\t\twritten += t2pWriteFile(output, \n\t\t\t(tdata_t) \"/ViewerPreferences <</FitWindow true>>\\n\", \n\t\t\t39);\n\t}\n\twritten += t2pWriteFile(output, (tdata_t)\">>\\n\", 3);\n\n\treturn(written);\n}\n\n/*\n\tThis function writes the PDF Info structure to output.\n*/\n\ntsize_t t2p_write_pdf_info(T2P* t2p, TIFF* input, TIFF* output){\n\n\ttsize_t written = 0;\n\tunsigned char* info;\n\tchar buffer[512];\n\tint buflen = 0;\n\t\n\tif(t2p->pdf_datetime==NULL){\n\t\tt2p_pdf_tifftime(t2p, input);\n\t}\n\tif(strlen((char *)t2p->pdf_datetime) > 0){\n\t\twritten += t2pWriteFile(output, (tdata_t) \"<< \\n/CreationDate \", 18);\n\t\twritten += t2p_write_pdf_string(t2p->pdf_datetime, output);\n\t\twritten += t2pWriteFile(output, (tdata_t) \"\\n/ModDate \", 10);\n\t\twritten += t2p_write_pdf_string(t2p->pdf_datetime, output);\n\t}\n\twritten += t2pWriteFile(output, (tdata_t) \"\\n/Producer \", 11);\n\t_TIFFmemset((tdata_t)buffer, 0x00, sizeof(buffer));\n\tbuflen = sprintf(buffer, \"libtiff / tiff2pdf - %d\", TIFFLIB_VERSION);\n\twritten += t2p_write_pdf_string((unsigned char*)buffer, output);\n\twritten += t2pWriteFile(output, (tdata_t) \"\\n\", 1);\n\tif(t2p->pdf_creator != NULL){ \n\t\tif(strlen((char *)t2p->pdf_creator)>0){\n\t\t\tif(strlen((char *)t2p->pdf_creator) > 511) {\n\t\t\t\tt2p->pdf_creator[512] = '\\0';\n\t\t\t}\n\t\t\twritten += t2pWriteFile(output, (tdata_t) \"/Creator \", 9);\n\t\t\twritten += t2p_write_pdf_string(t2p->pdf_creator, output);\n\t\t\twritten += t2pWriteFile(output, (tdata_t) \"\\n\", 1);\n\t\t}\n\t} else{\n\t\tif( TIFFGetField(input, TIFFTAG_SOFTWARE, &info) != 0){\n\t\t\tif(strlen((char *)info) > 511) {\n\t\t\t\tinfo[512] = '\\0';\n\t\t\t}\n\t\t\twritten += t2pWriteFile(output, (tdata_t) \"/Creator \", 9);\n\t\t\twritten += t2p_write_pdf_string(info, output);\n\t\t\twritten += t2pWriteFile(output, (tdata_t) \"\\n\", 1);\n\t\t}\n\t}\n\tif(t2p->pdf_author != NULL) { \n\t\tif(strlen((char *)t2p->pdf_author) > 0) {\n\t\t\tif(strlen((char *)t2p->pdf_author) > 511) {\n\t\t\t\tt2p->pdf_author[512] = '\\0';\n\t\t\t}\n\t\t\twritten += t2pWriteFile(output, (tdata_t) \"/Author \", 8);\n\t\t\twritten += t2p_write_pdf_string(t2p->pdf_author, output);\n\t\t\twritten += t2pWriteFile(output, (tdata_t) \"\\n\", 1);\n\t\t}\n\t} else{\n\t\tif( TIFFGetField(input, TIFFTAG_ARTIST, &info) != 0){\n\t\t\tif(strlen((char *)info) > 511) {\n\t\t\t\tinfo[512] = '\\0';\n\t\t\t}\n\t\t\twritten += t2pWriteFile(output, (tdata_t) \"/Author \", 8);\n\t\t\twritten += t2p_write_pdf_string(info, output);\n\t\t\twritten += t2pWriteFile(output, (tdata_t) \"\\n\", 1);\n\t\t} else if ( TIFFGetField(input, TIFFTAG_COPYRIGHT, &info) != 0){\n\t\t\tif(strlen((char *)info) > 511) {\n\t\t\t\tinfo[512] = '\\0';\n\t\t\t}\n\t\t\twritten += t2pWriteFile(output, (tdata_t) \"/Author \", 8);\n\t\t\twritten += t2p_write_pdf_string(info, output);\n\t\t\twritten += t2pWriteFile(output, (tdata_t) \"\\n\", 1);\n\t\t} \n\t}\n\tif(t2p->pdf_title != NULL) {\n\t\tif(strlen((char *)t2p->pdf_title) > 0) {\n\t\t\tif(strlen((char *)t2p->pdf_title) > 511) {\n\t\t\t\tt2p->pdf_title[512] = '\\0';\n\t\t\t}\n\t\t\twritten += t2pWriteFile(output, (tdata_t) \"/Title \", 7);\n\t\t\twritten += t2p_write_pdf_string(t2p->pdf_title, output);\n\t\t\twritten += t2pWriteFile(output, (tdata_t) \"\\n\", 1);\n\t\t}\n\t} else{\n\t\tif( TIFFGetField(input, TIFFTAG_DOCUMENTNAME, &info) != 0){\n\t\t\tif(strlen((char *)info) > 511) {\n\t\t\t\tinfo[512] = '\\0';\n\t\t\t}\n\t\t\twritten += t2pWriteFile(output, (tdata_t) \"/Title \", 7);\n\t\t\twritten += t2p_write_pdf_string(info, output);\n\t\t\twritten += t2pWriteFile(output, (tdata_t) \"\\n\", 1);\n\t\t}\n\t}\n\tif(t2p->pdf_subject != NULL) {\n\t\tif(strlen((char *)t2p->pdf_subject) > 0) {\n\t\t\tif(strlen((char *)t2p->pdf_subject) > 511) {\n\t\t\t\tt2p->pdf_subject[512] = '\\0';\n\t\t\t}\n\t\t\twritten += t2pWriteFile(output, (tdata_t) \"/Subject \", 9);\n\t\t\twritten += t2p_write_pdf_string(t2p->pdf_subject, output);\n\t\t\twritten += t2pWriteFile(output, (tdata_t) \"\\n\", 1);\n\t\t}\n\t} else {\n\t\tif(TIFFGetField(input, TIFFTAG_IMAGEDESCRIPTION, &info) != 0) {\n\t\t\tif(strlen((char *)info) > 511) {\n\t\t\t\tinfo[512] = '\\0';\n\t\t\t}\n\t\t\twritten += t2pWriteFile(output, (tdata_t) \"/Subject \", 9);\n\t\t\twritten += t2p_write_pdf_string(info, output);\n\t\t\twritten += t2pWriteFile(output, (tdata_t) \"\\n\", 1);\n\t\t}\n\t}\n\tif(t2p->pdf_keywords != NULL) { \n\t\tif(strlen((char *)t2p->pdf_keywords) > 0) {\n\t\t\tif(strlen((char *)t2p->pdf_keywords) > 511) {\n\t\t\t\tt2p->pdf_keywords[512] = '\\0';\n\t\t\t}\n\t\t\twritten += t2pWriteFile(output, (tdata_t) \"/Keywords \", 10);\n\t\t\twritten += t2p_write_pdf_string(t2p->pdf_keywords, output);\n\t\t\twritten += t2pWriteFile(output, (tdata_t) \"\\n\", 1);\n\t\t}\n\t}\n\twritten += t2pWriteFile(output, (tdata_t) \">> \\n\", 4);\t\n\n\treturn(written);\n}\n\n/*\n * This function fills a string of a T2P struct with the current time as a PDF\n * date string, it is called by t2p_pdf_tifftime.\n */\n\nvoid t2p_pdf_currenttime(T2P* t2p)\n{\n\n\tstruct tm* currenttime;\n\ttime_t timenow;\n\n\ttimenow=time(0);\n\tcurrenttime=localtime(&timenow);\n\tsprintf((char *)t2p->pdf_datetime, \"D:%.4d%.2d%.2d%.2d%.2d%.2d\",\n\t\t(currenttime->tm_year+1900) % 65536, \n\t\t(currenttime->tm_mon+1) % 256, \n\t\t(currenttime->tm_mday) % 256, \n\t\t(currenttime->tm_hour) % 256, \n\t\t(currenttime->tm_min) % 256, \n\t\t(currenttime->tm_sec) % 256);\n\n\treturn;\n}\n\n/*\n * This function fills a string of a T2P struct with the date and time of a\n * TIFF file if it exists or the current time as a PDF date string.\n */\n\nvoid t2p_pdf_tifftime(T2P* t2p, TIFF* input){\n\n\tchar* datetime;\n\n\tt2p->pdf_datetime = (unsigned char*) _TIFFmalloc(19);\n\tif(t2p->pdf_datetime == NULL){\n\t\tTIFFError(TIFF2PDF_MODULE, \n\t\t\"Can't allocate %u bytes of memory for t2p_pdf_tiff_time\", 17); \n\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\treturn;\n\t}\n\tt2p->pdf_datetime[16] = '\\0';\n\tif( TIFFGetField(input, TIFFTAG_DATETIME, &datetime) != 0 \n\t    && (strlen(datetime) >= 19) ){\n\t\tt2p->pdf_datetime[0]='D';\n\t\tt2p->pdf_datetime[1]=':';\n\t\tt2p->pdf_datetime[2]=datetime[0];\n\t\tt2p->pdf_datetime[3]=datetime[1];\n\t\tt2p->pdf_datetime[4]=datetime[2];\n\t\tt2p->pdf_datetime[5]=datetime[3];\n\t\tt2p->pdf_datetime[6]=datetime[5];\n\t\tt2p->pdf_datetime[7]=datetime[6];\n\t\tt2p->pdf_datetime[8]=datetime[8];\n\t\tt2p->pdf_datetime[9]=datetime[9];\n\t\tt2p->pdf_datetime[10]=datetime[11];\n\t\tt2p->pdf_datetime[11]=datetime[12];\n\t\tt2p->pdf_datetime[12]=datetime[14];\n\t\tt2p->pdf_datetime[13]=datetime[15];\n\t\tt2p->pdf_datetime[14]=datetime[17];\n\t\tt2p->pdf_datetime[15]=datetime[18];\n\t} else {\n\t\tt2p_pdf_currenttime(t2p);\n\t}\n\n\treturn;\n}\n\n/*\n * This function writes a PDF Pages Tree structure to output.\n */\n\ntsize_t t2p_write_pdf_pages(T2P* t2p, TIFF* output)\n{\n\ttsize_t written=0;\n\ttdir_t i=0;\n\tchar buffer[16];\n\tint buflen=0;\n\n\tint page=0;\n\twritten += t2pWriteFile(output, \n\t\t(tdata_t) \"<< \\n/Type /Pages \\n/Kids [ \", 26);\n\tpage = t2p->pdf_pages+1;\n\tfor (i=0;i<t2p->tiff_pagecount;i++){\n\t\tbuflen=sprintf(buffer, \"%d\", page);\n\t\twritten += t2pWriteFile(output, (tdata_t) buffer, buflen);\n\t\twritten += t2pWriteFile(output, (tdata_t) \" 0 R \", 5);\n\t\tif ( ((i+1)%8)==0 ) {\n\t\t\twritten += t2pWriteFile(output, (tdata_t) \"\\n\", 1);\n\t\t}\n\t\tpage +=3;\n\t\tpage += t2p->tiff_pages[i].page_extra;\n\t\tif(t2p->tiff_pages[i].page_tilecount>0){\n\t\t\tpage += (2 * t2p->tiff_pages[i].page_tilecount);\n\t\t} else {\n\t\t\tpage +=2;\n\t\t}\n\t}\n\twritten += t2pWriteFile(output, (tdata_t) \"] \\n/Count \", 10);\n\t_TIFFmemset(buffer, 0x00, 16);\n\tbuflen=sprintf(buffer, \"%d\", t2p->tiff_pagecount);\n\twritten += t2pWriteFile(output, (tdata_t) buffer, buflen);\n\twritten += t2pWriteFile(output, (tdata_t) \" \\n>> \\n\", 6);\n\n\treturn(written);\n}\n\n/*\n\tThis function writes a PDF Page structure to output.\n*/\n\ntsize_t t2p_write_pdf_page(uint32 object, T2P* t2p, TIFF* output){\n\n\tunsigned int i=0;\n\ttsize_t written=0;\n\tchar buffer[16];\n\tint buflen=0;\n\t\n\twritten += t2pWriteFile(output, (tdata_t) \"<<\\n/Type /Page \\n/Parent \", 24);\n\tbuflen=sprintf(buffer, \"%lu\", (unsigned long)t2p->pdf_pages);\n\twritten += t2pWriteFile(output, (tdata_t) buffer, buflen);\n\twritten += t2pWriteFile(output, (tdata_t) \" 0 R \\n\", 6);\n\twritten += t2pWriteFile(output, (tdata_t) \"/MediaBox [\", 11); \n\tbuflen=sprintf(buffer, \"%.4f\",t2p->pdf_mediabox.x1);\n\twritten += t2pWriteFile(output, (tdata_t) buffer, buflen);\n\twritten += t2pWriteFile(output, (tdata_t) \" \", 1); \n\tbuflen=sprintf(buffer, \"%.4f\",t2p->pdf_mediabox.y1);\n\twritten += t2pWriteFile(output, (tdata_t) buffer, buflen);\n\twritten += t2pWriteFile(output, (tdata_t) \" \", 1); \n\tbuflen=sprintf(buffer, \"%.4f\",t2p->pdf_mediabox.x2);\n\twritten += t2pWriteFile(output, (tdata_t) buffer, buflen);\n\twritten += t2pWriteFile(output, (tdata_t) \" \", 1); \n\tbuflen=sprintf(buffer, \"%.4f\",t2p->pdf_mediabox.y2);\n\twritten += t2pWriteFile(output, (tdata_t) buffer, buflen);\n\twritten += t2pWriteFile(output, (tdata_t) \"] \\n\", 3); \n\twritten += t2pWriteFile(output, (tdata_t) \"/Contents \", 10);\n\tbuflen=sprintf(buffer, \"%lu\", (unsigned long)(object + 1));\n\twritten += t2pWriteFile(output, (tdata_t) buffer, buflen);\n\twritten += t2pWriteFile(output, (tdata_t) \" 0 R \\n\", 6);\n\twritten += t2pWriteFile(output, (tdata_t) \"/Resources << \\n\", 15);\n\tif( t2p->tiff_tiles[t2p->pdf_page].tiles_tilecount != 0 ){\n\t\twritten += t2pWriteFile(output, (tdata_t) \"/XObject <<\\n\", 12);\n\t\tfor(i=0;i<t2p->tiff_tiles[t2p->pdf_page].tiles_tilecount;i++){\n\t\t\twritten += t2pWriteFile(output, (tdata_t) \"/Im\", 3);\n\t\t\tbuflen = sprintf(buffer, \"%u\", t2p->pdf_page+1);\n\t\t\twritten += t2pWriteFile(output, (tdata_t) buffer, buflen);\n\t\t\twritten += t2pWriteFile(output, (tdata_t) \"_\", 1);\n\t\t\tbuflen = sprintf(buffer, \"%u\", i+1);\n\t\t\twritten += t2pWriteFile(output, (tdata_t) buffer, buflen);\n\t\t\twritten += t2pWriteFile(output, (tdata_t) \" \", 1);\n\t\t\tbuflen = sprintf(\n\t\t\t\tbuffer, \n\t\t\t\t\"%lu\", \n\t\t\t\t(unsigned long)(object+3+(2*i)+t2p->tiff_pages[t2p->pdf_page].page_extra)); \n\t\t\twritten += t2pWriteFile(output, (tdata_t) buffer, buflen);\n\t\t\twritten += t2pWriteFile(output, (tdata_t) \" 0 R \", 5);\n\t\t\tif(i%4==3){\n\t\t\t\twritten += t2pWriteFile(output, (tdata_t) \"\\n\", 1);\n\t\t\t}\n\t\t}\n\t\twritten += t2pWriteFile(output, (tdata_t) \">>\\n\", 3);\n\t} else {\n\t\t\twritten += t2pWriteFile(output, (tdata_t) \"/XObject <<\\n\", 12);\n\t\t\twritten += t2pWriteFile(output, (tdata_t) \"/Im\", 3);\n\t\t\tbuflen = sprintf(buffer, \"%u\", t2p->pdf_page+1);\n\t\t\twritten += t2pWriteFile(output, (tdata_t) buffer, buflen);\n\t\t\twritten += t2pWriteFile(output, (tdata_t) \" \", 1);\n\t\t\tbuflen = sprintf(\n\t\t\t\tbuffer, \n\t\t\t\t\"%lu\", \n\t\t\t\t(unsigned long)(object+3+(2*i)+t2p->tiff_pages[t2p->pdf_page].page_extra)); \n\t\t\twritten += t2pWriteFile(output, (tdata_t) buffer, buflen);\n\t\t\twritten += t2pWriteFile(output, (tdata_t) \" 0 R \", 5);\n\t\twritten += t2pWriteFile(output, (tdata_t) \">>\\n\", 3);\n\t}\n\tif(t2p->tiff_transferfunctioncount != 0) {\n\t\twritten += t2pWriteFile(output, (tdata_t) \"/ExtGState <<\", 13);\n\t\tt2pWriteFile(output, (tdata_t) \"/GS1 \", 5);\n\t\tbuflen = sprintf(\n\t\t\tbuffer, \n\t\t\t\"%lu\", \n\t\t\t(unsigned long)(object + 3)); \n\t\twritten += t2pWriteFile(output, (tdata_t) buffer, buflen);\n\t\twritten += t2pWriteFile(output, (tdata_t) \" 0 R \", 5);\n\t\twritten += t2pWriteFile(output, (tdata_t) \">> \\n\", 4);\n\t}\n\twritten += t2pWriteFile(output, (tdata_t) \"/ProcSet [ \", 11);\n\tif(t2p->pdf_colorspace == T2P_CS_BILEVEL \n\t\t|| t2p->pdf_colorspace == T2P_CS_GRAY\n\t\t){\n\t\twritten += t2pWriteFile(output, (tdata_t) \"/ImageB \", 8);\n\t} else {\n\t\twritten += t2pWriteFile(output, (tdata_t) \"/ImageC \", 8);\n\t\tif(t2p->pdf_colorspace & T2P_CS_PALETTE){\n\t\t\twritten += t2pWriteFile(output, (tdata_t) \"/ImageI \", 8);\n\t\t}\n\t}\n\twritten += t2pWriteFile(output, (tdata_t) \"]\\n>>\\n>>\\n\", 8);\n\n\treturn(written);\n}\n\n/*\n\tThis function composes the page size and image and tile locations on a page.\n*/\n\nvoid t2p_compose_pdf_page(T2P* t2p){\n\n\tuint32 i=0;\n\tuint32 i2=0;\n\tT2P_TILE* tiles=NULL;\n\tT2P_BOX* boxp=NULL;\n\tuint32 tilecountx=0;\n\tuint32 tilecounty=0;\n\tuint32 tilewidth=0;\n\tuint32 tilelength=0;\n\tint istiled=0;\n\tfloat f=0;\n\t\n\tt2p->pdf_xres = t2p->tiff_xres;\n\tt2p->pdf_yres = t2p->tiff_yres;\n\tif(t2p->pdf_overrideres) {\n\t\tt2p->pdf_xres = t2p->pdf_defaultxres;\n\t\tt2p->pdf_yres = t2p->pdf_defaultyres;\n\t}\n\tif(t2p->pdf_xres == 0.0)\n\t\tt2p->pdf_xres = t2p->pdf_defaultxres;\n\tif(t2p->pdf_yres == 0.0)\n\t\tt2p->pdf_yres = t2p->pdf_defaultyres;\n\tif (t2p->tiff_resunit != RESUNIT_CENTIMETER\t/* RESUNIT_NONE and */\n\t    && t2p->tiff_resunit != RESUNIT_INCH) {\t/* other cases */\n\t\tt2p->pdf_imagewidth = ((float)(t2p->tiff_width))/t2p->pdf_xres;\n\t\tt2p->pdf_imagelength = ((float)(t2p->tiff_length))/t2p->pdf_yres;\n\t} else {\n\t\tt2p->pdf_imagewidth = \n\t\t\t((float)(t2p->tiff_width))*PS_UNIT_SIZE/t2p->pdf_xres;\n\t\tt2p->pdf_imagelength = \n\t\t\t((float)(t2p->tiff_length))*PS_UNIT_SIZE/t2p->pdf_yres;\n\t}\n\tif(t2p->pdf_overridepagesize != 0) {\n\t\tt2p->pdf_pagewidth = t2p->pdf_defaultpagewidth;\n\t\tt2p->pdf_pagelength = t2p->pdf_defaultpagelength;\n\t} else {\n\t\tt2p->pdf_pagewidth = t2p->pdf_imagewidth;\n\t\tt2p->pdf_pagelength = t2p->pdf_imagelength;\n\t}\n\tt2p->pdf_mediabox.x1=0.0;\n\tt2p->pdf_mediabox.y1=0.0;\n\tt2p->pdf_mediabox.x2=t2p->pdf_pagewidth;\n\tt2p->pdf_mediabox.y2=t2p->pdf_pagelength;\n\tt2p->pdf_imagebox.x1=0.0;\n\tt2p->pdf_imagebox.y1=0.0;\n\tt2p->pdf_imagebox.x2=t2p->pdf_imagewidth;\n\tt2p->pdf_imagebox.y2=t2p->pdf_imagelength;\n\tif(t2p->pdf_overridepagesize!=0){\n\t\tt2p->pdf_imagebox.x1+=((t2p->pdf_pagewidth-t2p->pdf_imagewidth)/2.0F);\n\t\tt2p->pdf_imagebox.y1+=((t2p->pdf_pagelength-t2p->pdf_imagelength)/2.0F);\n\t\tt2p->pdf_imagebox.x2+=((t2p->pdf_pagewidth-t2p->pdf_imagewidth)/2.0F);\n\t\tt2p->pdf_imagebox.y2+=((t2p->pdf_pagelength-t2p->pdf_imagelength)/2.0F);\n\t}\n\tif(t2p->tiff_orientation > 4){\n\t\tf=t2p->pdf_mediabox.x2;\n\t\tt2p->pdf_mediabox.x2=t2p->pdf_mediabox.y2;\n\t\tt2p->pdf_mediabox.y2=f;\n\t}\n\tistiled=((t2p->tiff_tiles[t2p->pdf_page]).tiles_tilecount==0) ? 0 : 1;\n\tif(istiled==0){\n\t\tt2p_compose_pdf_page_orient(&(t2p->pdf_imagebox), t2p->tiff_orientation);\n\t\treturn;\n\t} else {\n\t\ttilewidth=(t2p->tiff_tiles[t2p->pdf_page]).tiles_tilewidth;\n\t\ttilelength=(t2p->tiff_tiles[t2p->pdf_page]).tiles_tilelength;\n\t\ttilecountx=(t2p->tiff_width + \n\t\t\ttilewidth -1)/ \n\t\t\ttilewidth;\n\t\t(t2p->tiff_tiles[t2p->pdf_page]).tiles_tilecountx=tilecountx;\n\t\ttilecounty=(t2p->tiff_length + \n\t\t\ttilelength -1)/ \n\t\t\ttilelength;\n\t\t(t2p->tiff_tiles[t2p->pdf_page]).tiles_tilecounty=tilecounty;\n\t\t(t2p->tiff_tiles[t2p->pdf_page]).tiles_edgetilewidth=\n\t\t\tt2p->tiff_width % tilewidth;\n\t\t(t2p->tiff_tiles[t2p->pdf_page]).tiles_edgetilelength=\n\t\t\tt2p->tiff_length % tilelength;\n\t\ttiles=(t2p->tiff_tiles[t2p->pdf_page]).tiles_tiles;\n\t\tfor(i2=0;i2<tilecounty-1;i2++){\n\t\t\tfor(i=0;i<tilecountx-1;i++){\n\t\t\t\tboxp=&(tiles[i2*tilecountx+i].tile_box);\n\t\t\t\tboxp->x1 = \n\t\t\t\t\tt2p->pdf_imagebox.x1 \n\t\t\t\t\t+ ((float)(t2p->pdf_imagewidth * i * tilewidth)\n\t\t\t\t\t/ (float)t2p->tiff_width);\n\t\t\t\tboxp->x2 = \n\t\t\t\t\tt2p->pdf_imagebox.x1 \n\t\t\t\t\t+ ((float)(t2p->pdf_imagewidth * (i+1) * tilewidth)\n\t\t\t\t\t/ (float)t2p->tiff_width);\n\t\t\t\tboxp->y1 = \n\t\t\t\t\tt2p->pdf_imagebox.y2 \n\t\t\t\t\t- ((float)(t2p->pdf_imagelength * (i2+1) * tilelength)\n\t\t\t\t\t/ (float)t2p->tiff_length);\n\t\t\t\tboxp->y2 = \n\t\t\t\t\tt2p->pdf_imagebox.y2 \n\t\t\t\t\t- ((float)(t2p->pdf_imagelength * i2 * tilelength)\n\t\t\t\t\t/ (float)t2p->tiff_length);\n\t\t\t}\n\t\t\tboxp=&(tiles[i2*tilecountx+i].tile_box);\n\t\t\tboxp->x1 = \n\t\t\t\tt2p->pdf_imagebox.x1 \n\t\t\t\t+ ((float)(t2p->pdf_imagewidth * i * tilewidth)\n\t\t\t\t/ (float)t2p->tiff_width);\n\t\t\tboxp->x2 = t2p->pdf_imagebox.x2;\n\t\t\tboxp->y1 = \n\t\t\t\tt2p->pdf_imagebox.y2 \n\t\t\t\t- ((float)(t2p->pdf_imagelength * (i2+1) * tilelength)\n\t\t\t\t/ (float)t2p->tiff_length);\n\t\t\tboxp->y2 = \n\t\t\t\tt2p->pdf_imagebox.y2 \n\t\t\t\t- ((float)(t2p->pdf_imagelength * i2 * tilelength)\n\t\t\t\t/ (float)t2p->tiff_length);\n\t\t}\n\t\tfor(i=0;i<tilecountx-1;i++){\n\t\t\tboxp=&(tiles[i2*tilecountx+i].tile_box);\n\t\t\tboxp->x1 = \n\t\t\t\tt2p->pdf_imagebox.x1 \n\t\t\t\t+ ((float)(t2p->pdf_imagewidth * i * tilewidth)\n\t\t\t\t/ (float)t2p->tiff_width);\n\t\t\tboxp->x2 = \n\t\t\t\tt2p->pdf_imagebox.x1 \n\t\t\t\t+ ((float)(t2p->pdf_imagewidth * (i+1) * tilewidth)\n\t\t\t\t/ (float)t2p->tiff_width);\n\t\t\tboxp->y1 = t2p->pdf_imagebox.y1;\n\t\t\tboxp->y2 = \n\t\t\t\tt2p->pdf_imagebox.y2 \n\t\t\t\t- ((float)(t2p->pdf_imagelength * i2 * tilelength)\n\t\t\t\t/ (float)t2p->tiff_length);\n\t\t}\n\t\tboxp=&(tiles[i2*tilecountx+i].tile_box);\n\t\tboxp->x1 = \n\t\t\tt2p->pdf_imagebox.x1 \n\t\t\t+ ((float)(t2p->pdf_imagewidth * i * tilewidth)\n\t\t\t/ (float)t2p->tiff_width);\n\t\tboxp->x2 = t2p->pdf_imagebox.x2;\n\t\tboxp->y1 = t2p->pdf_imagebox.y1;\n\t\tboxp->y2 = \n\t\t\tt2p->pdf_imagebox.y2 \n\t\t\t- ((float)(t2p->pdf_imagelength * i2 * tilelength)\n\t\t\t/ (float)t2p->tiff_length);\n\t}\n\tif(t2p->tiff_orientation==0 || t2p->tiff_orientation==1){\n\t\tfor(i=0;i<(t2p->tiff_tiles[t2p->pdf_page]).tiles_tilecount;i++){\n\t\t\tt2p_compose_pdf_page_orient( &(tiles[i].tile_box) , 0);\n\t\t}\n\t\treturn;\n\t}\n\tfor(i=0;i<(t2p->tiff_tiles[t2p->pdf_page]).tiles_tilecount;i++){\n\t\tboxp=&(tiles[i].tile_box);\n\t\tboxp->x1 -= t2p->pdf_imagebox.x1;\n\t\tboxp->x2 -= t2p->pdf_imagebox.x1;\n\t\tboxp->y1 -= t2p->pdf_imagebox.y1;\n\t\tboxp->y2 -= t2p->pdf_imagebox.y1;\n\t\tif(t2p->tiff_orientation==2 || t2p->tiff_orientation==3){\n\t\t\tboxp->x1 = t2p->pdf_imagebox.x2 - t2p->pdf_imagebox.x1 - boxp->x1;\n\t\t\tboxp->x2 = t2p->pdf_imagebox.x2 - t2p->pdf_imagebox.x1 - boxp->x2;\n\t\t}\n\t\tif(t2p->tiff_orientation==3 || t2p->tiff_orientation==4){\n\t\t\tboxp->y1 = t2p->pdf_imagebox.y2 - t2p->pdf_imagebox.y1 - boxp->y1;\n\t\t\tboxp->y2 = t2p->pdf_imagebox.y2 - t2p->pdf_imagebox.y1 - boxp->y2;\n\t\t}\n\t\tif(t2p->tiff_orientation==8 || t2p->tiff_orientation==5){\n\t\t\tboxp->y1 = t2p->pdf_imagebox.y2 - t2p->pdf_imagebox.y1 - boxp->y1;\n\t\t\tboxp->y2 = t2p->pdf_imagebox.y2 - t2p->pdf_imagebox.y1 - boxp->y2;\n\t\t}\n\t\tif(t2p->tiff_orientation==5 || t2p->tiff_orientation==6){\n\t\t\tboxp->x1 = t2p->pdf_imagebox.x2 - t2p->pdf_imagebox.x1 - boxp->x1;\n\t\t\tboxp->x2 = t2p->pdf_imagebox.x2 - t2p->pdf_imagebox.x1 - boxp->x2;\n\t\t}\n\t\tif(t2p->tiff_orientation > 4){\n\t\t\tf=boxp->x1;\n\t\t\tboxp->x1 = boxp->y1;\n\t\t\tboxp->y1 = f;\n\t\t\tf=boxp->x2;\n\t\t\tboxp->x2 = boxp->y2;\n\t\t\tboxp->y2 = f; \n\t\t\tt2p_compose_pdf_page_orient_flip(boxp, t2p->tiff_orientation);\n\t\t} else {\n\t\t\tt2p_compose_pdf_page_orient(boxp, t2p->tiff_orientation);\n\t\t}\n\t\t\n\t}\n\n\treturn;\n}\n\nvoid t2p_compose_pdf_page_orient(T2P_BOX* boxp, uint16 orientation){\n\n\tfloat m1[9];\n\tfloat f=0.0;\n\t\n\tif( boxp->x1 > boxp->x2){\n\t\tf=boxp->x1;\n\t\tboxp->x1=boxp->x2;\n\t\tboxp->x2 = f;\n\t}\n\tif( boxp->y1 > boxp->y2){\n\t\tf=boxp->y1;\n\t\tboxp->y1=boxp->y2;\n\t\tboxp->y2 = f;\n\t}\n\tboxp->mat[0]=m1[0]=boxp->x2-boxp->x1;\n\tboxp->mat[1]=m1[1]=0.0;\n\tboxp->mat[2]=m1[2]=0.0;\n\tboxp->mat[3]=m1[3]=0.0;\n\tboxp->mat[4]=m1[4]=boxp->y2-boxp->y1;\n\tboxp->mat[5]=m1[5]=0.0;\n\tboxp->mat[6]=m1[6]=boxp->x1;\n\tboxp->mat[7]=m1[7]=boxp->y1;\n\tboxp->mat[8]=m1[8]=1.0;\n\tswitch(orientation){\n\t\tcase 0:\n\t\tcase 1:\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tboxp->mat[0]=0.0F-m1[0];\n\t\t\tboxp->mat[6]+=m1[0];\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\tboxp->mat[0]=0.0F-m1[0];\n\t\t\tboxp->mat[4]=0.0F-m1[4];\n\t\t\tboxp->mat[6]+=m1[0];\n\t\t\tboxp->mat[7]+=m1[4];\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\tboxp->mat[4]=0.0F-m1[4];\n\t\t\tboxp->mat[7]+=m1[4];\n\t\t\tbreak;\n\t\tcase 5:\n\t\t\tboxp->mat[0]=0.0F;\n\t\t\tboxp->mat[1]=0.0F-m1[0];\n\t\t\tboxp->mat[3]=0.0F-m1[4];\n\t\t\tboxp->mat[4]=0.0F;\n\t\t\tboxp->mat[6]+=m1[4];\n\t\t\tboxp->mat[7]+=m1[0];\n\t\t\tbreak;\n\t\tcase 6:\n\t\t\tboxp->mat[0]=0.0F;\n\t\t\tboxp->mat[1]=0.0F-m1[0];\n\t\t\tboxp->mat[3]=m1[4];\n\t\t\tboxp->mat[4]=0.0F;\n\t\t\tboxp->mat[7]+=m1[0];\n\t\t\tbreak;\n\t\tcase 7:\n\t\t\tboxp->mat[0]=0.0F;\n\t\t\tboxp->mat[1]=m1[0];\n\t\t\tboxp->mat[3]=m1[4];\n\t\t\tboxp->mat[4]=0.0F;\n\t\t\tbreak;\n\t\tcase 8:\n\t\t\tboxp->mat[0]=0.0F;\n\t\t\tboxp->mat[1]=m1[0];\n\t\t\tboxp->mat[3]=0.0F-m1[4];\n\t\t\tboxp->mat[4]=0.0F;\n\t\t\tboxp->mat[6]+=m1[4];\n\t\t\tbreak;\n\t}\n\n\treturn;\n}\n\nvoid t2p_compose_pdf_page_orient_flip(T2P_BOX* boxp, uint16 orientation){\n\n\tfloat m1[9];\n\tfloat f=0.0;\n\t\n\tif( boxp->x1 > boxp->x2){\n\t\tf=boxp->x1;\n\t\tboxp->x1=boxp->x2;\n\t\tboxp->x2 = f;\n\t}\n\tif( boxp->y1 > boxp->y2){\n\t\tf=boxp->y1;\n\t\tboxp->y1=boxp->y2;\n\t\tboxp->y2 = f;\n\t}\n\tboxp->mat[0]=m1[0]=boxp->x2-boxp->x1;\n\tboxp->mat[1]=m1[1]=0.0F;\n\tboxp->mat[2]=m1[2]=0.0F;\n\tboxp->mat[3]=m1[3]=0.0F;\n\tboxp->mat[4]=m1[4]=boxp->y2-boxp->y1;\n\tboxp->mat[5]=m1[5]=0.0F;\n\tboxp->mat[6]=m1[6]=boxp->x1;\n\tboxp->mat[7]=m1[7]=boxp->y1;\n\tboxp->mat[8]=m1[8]=1.0F;\n\tswitch(orientation){\n\t\tcase 5:\n\t\t\tboxp->mat[0]=0.0F;\n\t\t\tboxp->mat[1]=0.0F-m1[4];\n\t\t\tboxp->mat[3]=0.0F-m1[0];\n\t\t\tboxp->mat[4]=0.0F;\n\t\t\tboxp->mat[6]+=m1[0];\n\t\t\tboxp->mat[7]+=m1[4];\n\t\t\tbreak;\n\t\tcase 6:\n\t\t\tboxp->mat[0]=0.0F;\n\t\t\tboxp->mat[1]=0.0F-m1[4];\n\t\t\tboxp->mat[3]=m1[0];\n\t\t\tboxp->mat[4]=0.0F;\n\t\t\tboxp->mat[7]+=m1[4];\n\t\t\tbreak;\n\t\tcase 7:\n\t\t\tboxp->mat[0]=0.0F;\n\t\t\tboxp->mat[1]=m1[4];\n\t\t\tboxp->mat[3]=m1[0];\n\t\t\tboxp->mat[4]=0.0F;\n\t\t\tbreak;\n\t\tcase 8:\n\t\t\tboxp->mat[0]=0.0F;\n\t\t\tboxp->mat[1]=m1[4];\n\t\t\tboxp->mat[3]=0.0F-m1[0];\n\t\t\tboxp->mat[4]=0.0F;\n\t\t\tboxp->mat[6]+=m1[0];\n\t\t\tbreak;\n\t}\n\n\treturn;\n}\n\n/*\n\tThis function writes a PDF Contents stream to output.\n*/\n\ntsize_t t2p_write_pdf_page_content_stream(T2P* t2p, TIFF* output){\n\n\ttsize_t written=0;\n\tttile_t i=0;\n\tchar buffer[512];\n\tint buflen=0;\n\tT2P_BOX box;\n\t\n\tif(t2p->tiff_tiles[t2p->pdf_page].tiles_tilecount>0){ \n\t\tfor(i=0;i<t2p->tiff_tiles[t2p->pdf_page].tiles_tilecount; i++){\n\t\t\tbox=t2p->tiff_tiles[t2p->pdf_page].tiles_tiles[i].tile_box;\n\t\t\tbuflen=sprintf(buffer, \n\t\t\t\t\"q %s %.4f %.4f %.4f %.4f %.4f %.4f cm /Im%d_%ld Do Q\\n\", \n\t\t\t\tt2p->tiff_transferfunctioncount?\"/GS1 gs \":\"\",\n\t\t\t\tbox.mat[0],\n\t\t\t\tbox.mat[1],\n\t\t\t\tbox.mat[3],\n\t\t\t\tbox.mat[4],\n\t\t\t\tbox.mat[6],\n\t\t\t\tbox.mat[7],\n\t\t\t\tt2p->pdf_page + 1, \n\t\t\t\t(long)(i + 1));\n\t\t\twritten += t2p_write_pdf_stream(buffer, buflen, output);\n\t\t}\n\t} else {\n\t\tbox=t2p->pdf_imagebox;\n\t\tbuflen=sprintf(buffer, \n\t\t\t\"q %s %.4f %.4f %.4f %.4f %.4f %.4f cm /Im%d Do Q\\n\", \n\t\t\tt2p->tiff_transferfunctioncount?\"/GS1 gs \":\"\",\n\t\t\tbox.mat[0],\n\t\t\tbox.mat[1],\n\t\t\tbox.mat[3],\n\t\t\tbox.mat[4],\n\t\t\tbox.mat[6],\n\t\t\tbox.mat[7],\n\t\t\tt2p->pdf_page+1);\n\t\twritten += t2p_write_pdf_stream(buffer, buflen, output);\n\t}\n\n\treturn(written);\n}\n\n/*\n\tThis function writes a PDF Image XObject stream dictionary to output. \n*/\n\ntsize_t t2p_write_pdf_xobject_stream_dict(ttile_t tile, \n\t\t\t\t\t\t\t\t\t\t\t\tT2P* t2p, \n\t\t\t\t\t\t\t\t\t\t\t\tTIFF* output){\n\n\ttsize_t written=0;\n\tchar buffer[16];\n\tint buflen=0;\n\n\twritten += t2p_write_pdf_stream_dict(0, t2p->pdf_xrefcount+1, output); \n\twritten += t2pWriteFile(output, \n\t\t(tdata_t) \"/Type /XObject \\n/Subtype /Image \\n/Name /Im\", \n\t\t42);\n\tbuflen=sprintf(buffer, \"%u\", t2p->pdf_page+1);\n\twritten += t2pWriteFile(output, (tdata_t) buffer, buflen);\n\tif(tile != 0){\n\t\twritten += t2pWriteFile(output, (tdata_t) \"_\", 1);\n\t\tbuflen=sprintf(buffer, \"%lu\", (unsigned long)tile);\n\t\twritten += t2pWriteFile(output, (tdata_t) buffer, buflen);\n\t}\n\twritten += t2pWriteFile(output, (tdata_t) \"\\n/Width \", 8);\n\t_TIFFmemset((tdata_t)buffer, 0x00, 16);\n\tif(tile==0){\n\t\tbuflen=sprintf(buffer, \"%lu\", (unsigned long)t2p->tiff_width);\n\t} else {\n\t\tif(t2p_tile_is_right_edge(t2p->tiff_tiles[t2p->pdf_page], tile-1)!=0){\n\t\t\tbuflen=sprintf(\n\t\t\t\tbuffer, \n\t\t\t\t\"%lu\", \n\t\t\t\t(unsigned long)t2p->tiff_tiles[t2p->pdf_page].tiles_edgetilewidth);\n\t\t} else {\n\t\t\tbuflen=sprintf(\n\t\t\t\tbuffer, \n\t\t\t\t\"%lu\", \n\t\t\t\t(unsigned long)t2p->tiff_tiles[t2p->pdf_page].tiles_tilewidth);\n\t\t}\n\t}\n\twritten += t2pWriteFile(output, (tdata_t) buffer, buflen);\n\twritten += t2pWriteFile(output, (tdata_t) \"\\n/Height \", 9);\n\t_TIFFmemset((tdata_t)buffer, 0x00, 16);\n\tif(tile==0){\n\t\tbuflen=sprintf(buffer, \"%lu\", (unsigned long)t2p->tiff_length);\n\t} else {\n\t\tif(t2p_tile_is_bottom_edge(t2p->tiff_tiles[t2p->pdf_page], tile-1)!=0){\n\t\t\tbuflen=sprintf(\n\t\t\t\tbuffer, \n\t\t\t\t\"%lu\", \n\t\t\t\t(unsigned long)t2p->tiff_tiles[t2p->pdf_page].tiles_edgetilelength);\n\t\t} else {\n\t\t\tbuflen=sprintf(\n\t\t\t\tbuffer, \n\t\t\t\t\"%lu\", \n\t\t\t\t(unsigned long)t2p->tiff_tiles[t2p->pdf_page].tiles_tilelength);\n\t\t}\n\t}\n\twritten += t2pWriteFile(output, (tdata_t) buffer, buflen);\n\twritten += t2pWriteFile(output, (tdata_t) \"\\n/BitsPerComponent \", 19);\n\t_TIFFmemset((tdata_t)buffer, 0x00, 16);\n\tbuflen=sprintf(buffer, \"%u\", t2p->tiff_bitspersample);\n\twritten += t2pWriteFile(output, (tdata_t) buffer, buflen);\n\twritten += t2pWriteFile(output, (tdata_t) \"\\n/ColorSpace \", 13);\n\twritten += t2p_write_pdf_xobject_cs(t2p, output);\n\tif (t2p->pdf_image_interpolate)\n\t\twritten += t2pWriteFile(output,\n\t\t\t\t\t (tdata_t) \"\\n/Interpolate true\", 18);\n\tif( (t2p->pdf_switchdecode != 0)\n#ifdef CCITT_SUPPORT\n\t\t&& ! (t2p->pdf_colorspace == T2P_CS_BILEVEL \n\t\t&& t2p->pdf_compression == T2P_COMPRESS_G4)\n#endif\n\t\t){\n\t\twritten += t2p_write_pdf_xobject_decode(t2p, output);\n\t}\n\twritten += t2p_write_pdf_xobject_stream_filter(tile, t2p, output);\n\t\n\treturn(written);\n}\n\n/*\n * \tThis function writes a PDF Image XObject Colorspace name to output.\n */\n\n\ntsize_t t2p_write_pdf_xobject_cs(T2P* t2p, TIFF* output){\n\n\ttsize_t written=0;\n\tchar buffer[128];\n\tint buflen=0;\n\n\tfloat X_W=1.0;\n\tfloat Y_W=1.0;\n\tfloat Z_W=1.0;\n\t\n\tif( (t2p->pdf_colorspace & T2P_CS_ICCBASED) != 0){\n\t\twritten += t2p_write_pdf_xobject_icccs(t2p, output);\n\t\treturn(written);\n\t}\n\tif( (t2p->pdf_colorspace & T2P_CS_PALETTE) != 0){\n\t\twritten += t2pWriteFile(output, (tdata_t) \"[ /Indexed \", 11);\n\t\tt2p->pdf_colorspace ^= T2P_CS_PALETTE;\n\t\twritten += t2p_write_pdf_xobject_cs(t2p, output);\n\t\tt2p->pdf_colorspace |= T2P_CS_PALETTE;\n\t\tbuflen=sprintf(buffer, \"%u\", (0x0001 << t2p->tiff_bitspersample)-1 );\n\t\twritten += t2pWriteFile(output, (tdata_t) buffer, buflen);\n\t\twritten += t2pWriteFile(output, (tdata_t) \" \", 1);\n\t\t_TIFFmemset(buffer, 0x00, 16);\n\t\tbuflen=sprintf(buffer, \"%lu\", (unsigned long)t2p->pdf_palettecs ); \n\t\twritten += t2pWriteFile(output, (tdata_t) buffer, buflen);\n\t\twritten += t2pWriteFile(output, (tdata_t) \" 0 R ]\\n\", 7);\n\t\treturn(written);\n\t}\n\tif(t2p->pdf_colorspace & T2P_CS_BILEVEL){\n\t\t\twritten += t2pWriteFile(output, (tdata_t) \"/DeviceGray \\n\", 13);\n\t}\n\tif(t2p->pdf_colorspace & T2P_CS_GRAY){\n\t\t\tif(t2p->pdf_colorspace & T2P_CS_CALGRAY){\n\t\t\t\twritten += t2p_write_pdf_xobject_calcs(t2p, output);\n\t\t\t} else {\n\t\t\t\twritten += t2pWriteFile(output, (tdata_t) \"/DeviceGray \\n\", 13);\n\t\t\t}\n\t}\n\tif(t2p->pdf_colorspace & T2P_CS_RGB){\n\t\t\tif(t2p->pdf_colorspace & T2P_CS_CALRGB){\n\t\t\t\twritten += t2p_write_pdf_xobject_calcs(t2p, output);\n\t\t\t} else {\n\t\t\t\twritten += t2pWriteFile(output, (tdata_t) \"/DeviceRGB \\n\", 12);\n\t\t\t}\n\t}\n\tif(t2p->pdf_colorspace & T2P_CS_CMYK){\n\t\t\twritten += t2pWriteFile(output, (tdata_t) \"/DeviceCMYK \\n\", 13);\n\t}\n\tif(t2p->pdf_colorspace & T2P_CS_LAB){\n\t\t\twritten += t2pWriteFile(output, (tdata_t) \"[/Lab << \\n\", 10);\n\t\t\twritten += t2pWriteFile(output, (tdata_t) \"/WhitePoint \", 12);\n\t\t\tX_W = t2p->tiff_whitechromaticities[0];\n\t\t\tY_W = t2p->tiff_whitechromaticities[1];\n\t\t\tZ_W = 1.0F - (X_W + Y_W);\n\t\t\tX_W /= Y_W;\n\t\t\tZ_W /= Y_W;\n\t\t\tY_W = 1.0F;\n\t\t\tbuflen=sprintf(buffer, \"[%.4f %.4f %.4f] \\n\", X_W, Y_W, Z_W);\n\t\t\twritten += t2pWriteFile(output, (tdata_t) buffer, buflen);\n\t\t\tX_W = 0.3457F; /* 0.3127F; */ /* D50, commented D65 */\n\t\t\tY_W = 0.3585F; /* 0.3290F; */\n\t\t\tZ_W = 1.0F - (X_W + Y_W);\n\t\t\tX_W /= Y_W;\n\t\t\tZ_W /= Y_W;\n\t\t\tY_W = 1.0F;\n\t\t\tbuflen=sprintf(buffer, \"[%.4f %.4f %.4f] \\n\", X_W, Y_W, Z_W);\n\t\t\twritten += t2pWriteFile(output, (tdata_t) buffer, buflen);\n\t\t\twritten += t2pWriteFile(output, (tdata_t) \"/Range \", 7);\n\t\t\tbuflen=sprintf(buffer, \"[%d %d %d %d] \\n\", \n\t\t\t\tt2p->pdf_labrange[0], \n\t\t\t\tt2p->pdf_labrange[1], \n\t\t\t\tt2p->pdf_labrange[2], \n\t\t\t\tt2p->pdf_labrange[3]);\n\t\t\twritten += t2pWriteFile(output, (tdata_t) buffer, buflen);\n\t\t\twritten += t2pWriteFile(output, (tdata_t) \">>] \\n\", 5);\n\t\t\t\n\t}\n\t\n\treturn(written);\n}\n\ntsize_t t2p_write_pdf_transfer(T2P* t2p, TIFF* output){\n\n\ttsize_t written=0;\n\tchar buffer[16];\n\tint buflen=0;\n\n\twritten += t2pWriteFile(output, (tdata_t) \"<< /Type /ExtGState \\n/TR \", 25);\n\tif(t2p->tiff_transferfunctioncount == 1){\n\t\tbuflen=sprintf(buffer, \"%lu\",\n\t\t\t       (unsigned long)(t2p->pdf_xrefcount + 1));\n\t\twritten += t2pWriteFile(output, (tdata_t) buffer, buflen);\n\t\twritten += t2pWriteFile(output, (tdata_t) \" 0 R \", 5);\n\t} else {\n\t\twritten += t2pWriteFile(output, (tdata_t) \"[ \", 2);\n\t\tbuflen=sprintf(buffer, \"%lu\",\n\t\t\t       (unsigned long)(t2p->pdf_xrefcount + 1));\n\t\twritten += t2pWriteFile(output, (tdata_t) buffer, buflen);\n\t\twritten += t2pWriteFile(output, (tdata_t) \" 0 R \", 5);\n\t\tbuflen=sprintf(buffer, \"%lu\",\n\t\t\t       (unsigned long)(t2p->pdf_xrefcount + 2));\n\t\twritten += t2pWriteFile(output, (tdata_t) buffer, buflen);\n\t\twritten += t2pWriteFile(output, (tdata_t) \" 0 R \", 5);\n\t\tbuflen=sprintf(buffer, \"%lu\",\n\t\t\t       (unsigned long)(t2p->pdf_xrefcount + 3));\n\t\twritten += t2pWriteFile(output, (tdata_t) buffer, buflen);\n\t\twritten += t2pWriteFile(output, (tdata_t) \" 0 R \", 5);\n\t\twritten += t2pWriteFile(output, (tdata_t) \"/Identity ] \", 12);\n\t}\n\n\twritten += t2pWriteFile(output, (tdata_t) \" >> \\n\", 5);\n\n\treturn(written);\n}\n\ntsize_t t2p_write_pdf_transfer_dict(T2P* t2p, TIFF* output, uint16 i){\n\n\ttsize_t written=0;\n\tchar buffer[32];\n\tint buflen=0;\n\t(void)i; // XXX\n\n\twritten += t2pWriteFile(output, (tdata_t) \"/FunctionType 0 \\n\", 17);\n\twritten += t2pWriteFile(output, (tdata_t) \"/Domain [0.0 1.0] \\n\", 19);\n\twritten += t2pWriteFile(output, (tdata_t) \"/Range [0.0 1.0] \\n\", 18);\n\tbuflen=sprintf(buffer, \"/Size [%u] \\n\", (1<<t2p->tiff_bitspersample));\n\twritten += t2pWriteFile(output, (tdata_t) buffer, buflen);\n\twritten += t2pWriteFile(output, (tdata_t) \"/BitsPerSample 16 \\n\", 19);\n\twritten += t2p_write_pdf_stream_dict(1<<(t2p->tiff_bitspersample+1), 0, output);\n\n\treturn(written);\n}\n\ntsize_t t2p_write_pdf_transfer_stream(T2P* t2p, TIFF* output, uint16 i){\n\n\ttsize_t written=0;\n\n\twritten += t2p_write_pdf_stream(\n\t\tt2p->tiff_transferfunction[i], \n\t\t(1<<(t2p->tiff_bitspersample+1)), \n\t\toutput);\n\n\treturn(written);\n}\n\n/*\n\tThis function writes a PDF Image XObject Colorspace array to output.\n*/\n\ntsize_t t2p_write_pdf_xobject_calcs(T2P* t2p, TIFF* output){\n\n\ttsize_t written=0;\n\tchar buffer[128];\n\tint buflen=0;\n\t\n\tfloat X_W=0.0;\n\tfloat Y_W=0.0;\n\tfloat Z_W=0.0;\n\tfloat X_R=0.0;\n\tfloat Y_R=0.0;\n\tfloat Z_R=0.0;\n\tfloat X_G=0.0;\n\tfloat Y_G=0.0;\n\tfloat Z_G=0.0;\n\tfloat X_B=0.0;\n\tfloat Y_B=0.0;\n\tfloat Z_B=0.0;\n\tfloat x_w=0.0;\n\tfloat y_w=0.0;\n\tfloat z_w=0.0;\n\tfloat x_r=0.0;\n\tfloat y_r=0.0;\n\tfloat x_g=0.0;\n\tfloat y_g=0.0;\n\tfloat x_b=0.0;\n\tfloat y_b=0.0;\n\tfloat R=1.0;\n\tfloat G=1.0;\n\tfloat B=1.0;\n\t\n\twritten += t2pWriteFile(output, (tdata_t) \"[\", 1);\n\tif(t2p->pdf_colorspace & T2P_CS_CALGRAY){\n\t\twritten += t2pWriteFile(output, (tdata_t) \"/CalGray \", 9);\n\t\tX_W = t2p->tiff_whitechromaticities[0];\n\t\tY_W = t2p->tiff_whitechromaticities[1];\n\t\tZ_W = 1.0F - (X_W + Y_W);\n\t\tX_W /= Y_W;\n\t\tZ_W /= Y_W;\n\t\tY_W = 1.0F;\n\t}\n\tif(t2p->pdf_colorspace & T2P_CS_CALRGB){\n\t\twritten += t2pWriteFile(output, (tdata_t) \"/CalRGB \", 8);\n\t\tx_w = t2p->tiff_whitechromaticities[0];\n\t\ty_w = t2p->tiff_whitechromaticities[1];\n\t\tx_r = t2p->tiff_primarychromaticities[0];\n\t\ty_r = t2p->tiff_primarychromaticities[1];\n\t\tx_g = t2p->tiff_primarychromaticities[2];\n\t\ty_g = t2p->tiff_primarychromaticities[3];\n\t\tx_b = t2p->tiff_primarychromaticities[4];\n\t\ty_b = t2p->tiff_primarychromaticities[5];\n\t\tz_w = y_w * ((x_g - x_b)*y_r - (x_r-x_b)*y_g + (x_r-x_g)*y_b);\n\t\tY_R = (y_r/R) * ((x_g-x_b)*y_w - (x_w-x_b)*y_g + (x_w-x_g)*y_b) / z_w;\n\t\tX_R = Y_R * x_r / y_r;\n\t\tZ_R = Y_R * (((1-x_r)/y_r)-1);\n\t\tY_G = ((0.0F-(y_g))/G) * ((x_r-x_b)*y_w - (x_w-x_b)*y_r + (x_w-x_r)*y_b) / z_w;\n\t\tX_G = Y_G * x_g / y_g;\n\t\tZ_G = Y_G * (((1-x_g)/y_g)-1);\n\t\tY_B = (y_b/B) * ((x_r-x_g)*y_w - (x_w-x_g)*y_r + (x_w-x_r)*y_g) / z_w;\n\t\tX_B = Y_B * x_b / y_b;\n\t\tZ_B = Y_B * (((1-x_b)/y_b)-1);\n\t\tX_W = (X_R * R) + (X_G * G) + (X_B * B);\n\t\tY_W = (Y_R * R) + (Y_G * G) + (Y_B * B);\n\t\tZ_W = (Z_R * R) + (Z_G * G) + (Z_B * B);\n\t\tX_W /= Y_W;\n\t\tZ_W /= Y_W;\n\t\tY_W = 1.0;\n\t}\n\twritten += t2pWriteFile(output, (tdata_t) \"<< \\n\", 4);\n\tif(t2p->pdf_colorspace & T2P_CS_CALGRAY){\n\t\twritten += t2pWriteFile(output, (tdata_t) \"/WhitePoint \", 12);\n\t\tbuflen=sprintf(buffer, \"[%.4f %.4f %.4f] \\n\", X_W, Y_W, Z_W);\n\t\twritten += t2pWriteFile(output, (tdata_t) buffer, buflen);\n\t\twritten += t2pWriteFile(output, (tdata_t) \"/Gamma 2.2 \\n\", 12);\n\t}\n\tif(t2p->pdf_colorspace & T2P_CS_CALRGB){\n\t\twritten += t2pWriteFile(output, (tdata_t) \"/WhitePoint \", 12);\n\t\tbuflen=sprintf(buffer, \"[%.4f %.4f %.4f] \\n\", X_W, Y_W, Z_W);\n\t\twritten += t2pWriteFile(output, (tdata_t) buffer, buflen);\n\t\twritten += t2pWriteFile(output, (tdata_t) \"/Matrix \", 8);\n\t\tbuflen=sprintf(buffer, \"[%.4f %.4f %.4f %.4f %.4f %.4f %.4f %.4f %.4f] \\n\", \n\t\t\tX_R, Y_R, Z_R, \n\t\t\tX_G, Y_G, Z_G, \n\t\t\tX_B, Y_B, Z_B); \n\t\twritten += t2pWriteFile(output, (tdata_t) buffer, buflen);\n\t\twritten += t2pWriteFile(output, (tdata_t) \"/Gamma [2.2 2.2 2.2] \\n\", 22);\n\t}\n\twritten += t2pWriteFile(output, (tdata_t) \">>] \\n\", 5);\n\n\treturn(written);\n}\n\n/*\n\tThis function writes a PDF Image XObject Colorspace array to output.\n*/\n\ntsize_t t2p_write_pdf_xobject_icccs(T2P* t2p, TIFF* output){\n\n\ttsize_t written=0;\n\tchar buffer[16];\n\tint buflen=0;\n\t\n\twritten += t2pWriteFile(output, (tdata_t) \"[/ICCBased \", 11);\n\tbuflen=sprintf(buffer, \"%lu\", (unsigned long)t2p->pdf_icccs);\n\twritten += t2pWriteFile(output, (tdata_t) buffer, buflen);\n\twritten += t2pWriteFile(output, (tdata_t) \" 0 R] \\n\", 7);\n\n\treturn(written);\n}\n\ntsize_t t2p_write_pdf_xobject_icccs_dict(T2P* t2p, TIFF* output){\n\n\ttsize_t written=0;\n\tchar buffer[16];\n\tint buflen=0;\n\t\n\twritten += t2pWriteFile(output, (tdata_t) \"/N \", 3);\n\tbuflen=sprintf(buffer, \"%u \\n\", t2p->tiff_samplesperpixel);\n\twritten += t2pWriteFile(output, (tdata_t) buffer, buflen);\n\twritten += t2pWriteFile(output, (tdata_t) \"/Alternate \", 11);\n\tt2p->pdf_colorspace ^= T2P_CS_ICCBASED;\n\twritten += t2p_write_pdf_xobject_cs(t2p, output);\n\tt2p->pdf_colorspace |= T2P_CS_ICCBASED;\n\twritten += t2p_write_pdf_stream_dict(t2p->tiff_iccprofilelength, 0, output);\n\t\n\treturn(written);\n}\n\ntsize_t t2p_write_pdf_xobject_icccs_stream(T2P* t2p, TIFF* output){\n\n\ttsize_t written=0;\n\n\twritten += t2p_write_pdf_stream(\n\t\t\t\t(tdata_t) t2p->tiff_iccprofile, \n\t\t\t\t(tsize_t) t2p->tiff_iccprofilelength, \n\t\t\t\toutput);\n\t\n\treturn(written);\n}\n\n/*\n\tThis function writes a palette stream for an indexed color space to output.\n*/\n\ntsize_t t2p_write_pdf_xobject_palettecs_stream(T2P* t2p, TIFF* output){\n\n\ttsize_t written=0;\n\n\twritten += t2p_write_pdf_stream(\n\t\t\t\t(tdata_t) t2p->pdf_palette, \n\t\t\t\t(tsize_t) t2p->pdf_palettesize, \n\t\t\t\toutput);\n\t\n\treturn(written);\n}\n\n/*\n\tThis function writes a PDF Image XObject Decode array to output.\n*/\n\ntsize_t t2p_write_pdf_xobject_decode(T2P* t2p, TIFF* output){\n\n\ttsize_t written=0;\n\tint i=0;\n\n\twritten += t2pWriteFile(output, (tdata_t) \"/Decode [ \", 10);\n\tfor (i=0;i<t2p->tiff_samplesperpixel;i++){\n\t\twritten += t2pWriteFile(output, (tdata_t) \"1 0 \", 4);\n\t}\n\twritten += t2pWriteFile(output, (tdata_t) \"]\\n\", 2);\n\n\treturn(written);\n}\n\n/*\n\tThis function writes a PDF Image XObject stream filter name and parameters to \n\toutput.\n*/\n\ntsize_t t2p_write_pdf_xobject_stream_filter(ttile_t tile, T2P* t2p, TIFF* output){\n\n\ttsize_t written=0;\n\tchar buffer[16];\n\tint buflen=0;\n\n\tif(t2p->pdf_compression==T2P_COMPRESS_NONE){\n\t\treturn(written);\n\t}\n\twritten += t2pWriteFile(output, (tdata_t) \"/Filter \", 8);\n\tswitch(t2p->pdf_compression){\n#ifdef CCITT_SUPPORT\n\t\tcase T2P_COMPRESS_G4:\n\t\t\twritten += t2pWriteFile(output, (tdata_t) \"/CCITTFaxDecode \", 16);\n\t\t\twritten += t2pWriteFile(output, (tdata_t) \"/DecodeParms \", 13);\n\t\t\twritten += t2pWriteFile(output, (tdata_t) \"<< /K -1 \", 9);\n\t\t\tif(tile==0){\n\t\t\t\twritten += t2pWriteFile(output, (tdata_t) \"/Columns \", 9);\n\t\t\t\tbuflen=sprintf(buffer, \"%lu\",\n\t\t\t\t\t       (unsigned long)t2p->tiff_width);\n\t\t\t\twritten += t2pWriteFile(output, (tdata_t) buffer, buflen);\n\t\t\t\twritten += t2pWriteFile(output, (tdata_t) \" /Rows \", 7);\n\t\t\t\tbuflen=sprintf(buffer, \"%lu\",\n\t\t\t\t\t       (unsigned long)t2p->tiff_length);\n\t\t\t\twritten += t2pWriteFile(output, (tdata_t) buffer, buflen);\n\t\t\t} else {\n\t\t\t\tif(t2p_tile_is_right_edge(t2p->tiff_tiles[t2p->pdf_page], tile-1)==0){\n\t\t\t\t\twritten += t2pWriteFile(output, (tdata_t) \"/Columns \", 9);\n\t\t\t\t\tbuflen=sprintf(\n\t\t\t\t\t\tbuffer, \n\t\t\t\t\t\t\"%lu\", \n\t\t\t\t\t\t(unsigned long)t2p->tiff_tiles[t2p->pdf_page].tiles_tilewidth);\n\t\t\t\t\twritten += t2pWriteFile(output, (tdata_t) buffer, buflen);\n\t\t\t\t} else {\n\t\t\t\t\twritten += t2pWriteFile(output, (tdata_t) \"/Columns \", 9);\n\t\t\t\t\tbuflen=sprintf(\n\t\t\t\t\t\tbuffer, \n\t\t\t\t\t\t\"%lu\", \n\t\t\t\t\t\t(unsigned long)t2p->tiff_tiles[t2p->pdf_page].tiles_edgetilewidth);\n\t\t\t\t\twritten += t2pWriteFile(output, (tdata_t) buffer, buflen);\n\t\t\t\t}\n\t\t\t\tif(t2p_tile_is_bottom_edge(t2p->tiff_tiles[t2p->pdf_page], tile-1)==0){\n\t\t\t\t\twritten += t2pWriteFile(output, (tdata_t) \" /Rows \", 7);\n\t\t\t\t\tbuflen=sprintf(\n\t\t\t\t\t\tbuffer, \n\t\t\t\t\t\t\"%lu\", \n\t\t\t\t\t\t(unsigned long)t2p->tiff_tiles[t2p->pdf_page].tiles_tilelength);\n\t\t\t\t\twritten += t2pWriteFile(output, (tdata_t) buffer, buflen);\n\t\t\t\t} else {\n\t\t\t\t\twritten += t2pWriteFile(output, (tdata_t) \" /Rows \", 7);\n\t\t\t\t\tbuflen=sprintf(\n\t\t\t\t\t\tbuffer, \n\t\t\t\t\t\t\"%lu\", \n\t\t\t\t\t\t(unsigned long)t2p->tiff_tiles[t2p->pdf_page].tiles_edgetilelength);\n\t\t\t\t\twritten += t2pWriteFile(output, (tdata_t) buffer, buflen);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(t2p->pdf_switchdecode == 0){\n\t\t\t\twritten += t2pWriteFile(output, (tdata_t) \" /BlackIs1 true \", 16);\n\t\t\t}\n\t\t\twritten += t2pWriteFile(output, (tdata_t) \">>\\n\", 3);\n\t\t\tbreak;\n#endif\n#ifdef JPEG_SUPPORT\n\t\tcase T2P_COMPRESS_JPEG:\n\t\t\twritten += t2pWriteFile(output, (tdata_t) \"/DCTDecode \", 11);\n\n\t\t\tif(t2p->tiff_photometric != PHOTOMETRIC_YCBCR) {\n\t\t\t\twritten += t2pWriteFile(output, (tdata_t) \"/DecodeParms \", 13);\n\t\t\t\twritten += t2pWriteFile(output, (tdata_t) \"<< /ColorTransform 0 >>\\n\", 24);\n\t\t\t}\n\t\t\tbreak;\n#endif\n#ifdef ZIP_SUPPORT\n\t\tcase T2P_COMPRESS_ZIP:\n\t\t\twritten += t2pWriteFile(output, (tdata_t) \"/FlateDecode \", 13);\n\t\t\tif(t2p->pdf_compressionquality%100){\n\t\t\t\twritten += t2pWriteFile(output, (tdata_t) \"/DecodeParms \", 13);\n\t\t\t\twritten += t2pWriteFile(output, (tdata_t) \"<< /Predictor \", 14);\n\t\t\t\t_TIFFmemset(buffer, 0x00, 16);\n\t\t\t\tbuflen=sprintf(buffer, \"%u\", t2p->pdf_compressionquality%100);\n\t\t\t\twritten += t2pWriteFile(output, (tdata_t) buffer, buflen);\n\t\t\t\twritten += t2pWriteFile(output, (tdata_t) \" /Columns \", 10);\n\t\t\t\t_TIFFmemset(buffer, 0x00, 16);\n\t\t\t\tbuflen = sprintf(buffer, \"%lu\",\n\t\t\t\t\t\t (unsigned long)t2p->tiff_width);\n\t\t\t\twritten += t2pWriteFile(output, (tdata_t) buffer, buflen);\n\t\t\t\twritten += t2pWriteFile(output, (tdata_t) \" /Colors \", 9);\n\t\t\t\t_TIFFmemset(buffer, 0x00, 16);\n\t\t\t\tbuflen=sprintf(buffer, \"%u\", t2p->tiff_samplesperpixel);\n\t\t\t\twritten += t2pWriteFile(output, (tdata_t) buffer, buflen);\n\t\t\t\twritten += t2pWriteFile(output, (tdata_t) \" /BitsPerComponent \", 19);\n\t\t\t\t_TIFFmemset(buffer, 0x00, 16);\n\t\t\t\tbuflen=sprintf(buffer, \"%u\", t2p->tiff_bitspersample);\n\t\t\t\twritten += t2pWriteFile(output, (tdata_t) buffer, buflen);\n\t\t\t\twritten += t2pWriteFile(output, (tdata_t) \">>\\n\", 3);\n\t\t\t}\n\t\t\tbreak;\n#endif\n\t\tdefault:\n\t\t\tbreak;\n\t}\n\n\treturn(written);\n}\n\n/*\n\tThis function writes a PDF xref table to output.\n*/\n\ntsize_t t2p_write_pdf_xreftable(T2P* t2p, TIFF* output){\n\n\ttsize_t written=0;\n\tchar buffer[21];\n\tint buflen=0;\n\tuint32 i=0;\n\n\twritten += t2pWriteFile(output, (tdata_t) \"xref\\n0 \", 7);\n\tbuflen=sprintf(buffer, \"%lu\", (unsigned long)(t2p->pdf_xrefcount + 1));\n\twritten += t2pWriteFile(output, (tdata_t) buffer, buflen);\n\twritten += t2pWriteFile(output, (tdata_t) \" \\n0000000000 65535 f \\n\", 22);\n\tfor (i=0;i<t2p->pdf_xrefcount;i++){\n\t\tsprintf(buffer, \"%.10lu 00000 n \\n\",\n\t\t\t(unsigned long)t2p->pdf_xrefoffsets[i]);\n\t\twritten += t2pWriteFile(output, (tdata_t) buffer, 20);\n\t}\n\n\treturn(written);\n}\n\n/*\n * This function writes a PDF trailer to output.\n */\n\ntsize_t t2p_write_pdf_trailer(T2P* t2p, TIFF* output)\n{\n\n\ttsize_t written = 0;\n\tchar buffer[32];\n\tint buflen = 0;\n\tchar fileidbuf[16];\n\tint i = 0;\n\n\t((int*)fileidbuf)[0] = rand();\n\t((int*)fileidbuf)[1] = rand();\n\t((int*)fileidbuf)[2] = rand();\n\t((int*)fileidbuf)[3] = rand();\n\tt2p->pdf_fileid = (unsigned char*)_TIFFmalloc(33);\n\tif(t2p->pdf_fileid == NULL) {\n\t\tTIFFError(\n\t\t\tTIFF2PDF_MODULE, \n\t\t\"Can't allocate %u bytes of memory for t2p_write_pdf_trailer\", \n\t\t\t33 );\n\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\treturn(0);\n\t}\n\t_TIFFmemset(t2p->pdf_fileid, 0x00, 33);\n\tfor (i = 0; i < 16; i++) {\n\t\tsprintf((char *)t2p->pdf_fileid + 2 * i,\n\t\t\t\"%.2hhX\", fileidbuf[i]);\n\t}\n\twritten += t2pWriteFile(output, (tdata_t) \"trailer\\n<<\\n/Size \", 17);\n\tbuflen = sprintf(buffer, \"%lu\", (unsigned long)(t2p->pdf_xrefcount+1));\n\twritten += t2pWriteFile(output, (tdata_t) buffer, buflen);\n\t_TIFFmemset(buffer, 0x00, 32);\t\n\twritten += t2pWriteFile(output, (tdata_t) \"\\n/Root \", 7);\n\tbuflen=sprintf(buffer, \"%lu\", (unsigned long)t2p->pdf_catalog);\n\twritten += t2pWriteFile(output, (tdata_t) buffer, buflen);\n\t_TIFFmemset(buffer, 0x00, 32);\t\n\twritten += t2pWriteFile(output, (tdata_t) \" 0 R \\n/Info \", 12);\n\tbuflen=sprintf(buffer, \"%lu\", (unsigned long)t2p->pdf_info);\n\twritten += t2pWriteFile(output, (tdata_t) buffer, buflen);\n\t_TIFFmemset(buffer, 0x00, 32);\t\n\twritten += t2pWriteFile(output, (tdata_t) \" 0 R \\n/ID[<\", 11);\n\twritten += t2pWriteFile(output, (tdata_t) t2p->pdf_fileid, 32);\n\twritten += t2pWriteFile(output, (tdata_t) \"><\", 2);\n\twritten += t2pWriteFile(output, (tdata_t) t2p->pdf_fileid, 32);\n\twritten += t2pWriteFile(output, (tdata_t) \">]\\n>>\\nstartxref\\n\", 16);\n\tbuflen=sprintf(buffer, \"%lu\", (unsigned long)t2p->pdf_startxref);\n\twritten += t2pWriteFile(output, (tdata_t) buffer, buflen);\n\t_TIFFmemset(buffer, 0x00, 32);\t\n\twritten += t2pWriteFile(output, (tdata_t) \"\\n%%EOF\\n\", 7);\n\n\treturn(written);\n}\n \n/*\n\n  This function writes a PDF to a file given a pointer to a TIFF.\n\n  The idea with using a TIFF* as output for a PDF file is that the file \n  can be created with TIFFClientOpen for memory-mapped use within the TIFF \n  library, and TIFFWriteEncodedStrip can be used to write compressed data to \n  the output.  The output is not actually a TIFF file, it is a PDF file.  \n\n  This function uses only t2pWriteFile and TIFFWriteEncodedStrip to write to \n  the output TIFF file.  When libtiff would otherwise be writing data to the \n  output file, the write procedure of the TIFF structure is replaced with an \n  empty implementation.\n\n  The first argument to the function is an initialized and validated T2P \n  context struct pointer.\n\n  The second argument to the function is the TIFF* that is the input that has \n  been opened for reading and no other functions have been called upon it.\n\n  The third argument to the function is the TIFF* that is the output that has \n  been opened for writing.  It has to be opened so that it hasn't written any \n  data to the output.  If the output is seekable then it's OK to seek to the \n  beginning of the file.  The function only writes to the output PDF and does \n  not seek.  See the example usage in the main() function.\n\n\tTIFF* output = TIFFOpen(\"output.pdf\", \"w\");\n\tassert(output != NULL);\n\n\tif(output->tif_seekproc != NULL){\n\t\tt2pSeekFile(output, (toff_t) 0, SEEK_SET);\n\t}\n\n  This function returns the file size of the output PDF file.  On error it \n  returns zero and the t2p->t2p_error variable is set to T2P_ERR_ERROR.\n\n  After this function completes, call t2p_free on t2p, TIFFClose on input, \n  and TIFFClose on output.\n*/\n\ntsize_t t2p_write_pdf(T2P* t2p, TIFF* input, TIFF* output){\n\n\ttsize_t written=0;\n\tttile_t i2=0;\n\ttsize_t streamlen=0;\n\tuint16 i=0;\n\n\tt2p_read_tiff_init(t2p, input);\n\tif(t2p->t2p_error!=T2P_ERR_OK){return(0);}\n\tt2p->pdf_xrefoffsets= (uint32*) _TIFFmalloc(t2p->pdf_xrefcount * sizeof(uint32) );\n\tif(t2p->pdf_xrefoffsets==NULL){\n\t\tTIFFError(\n\t\t\tTIFF2PDF_MODULE, \n\t\t\t\"Can't allocate %u bytes of memory for t2p_write_pdf\", \n\t\t\tt2p->pdf_xrefcount * sizeof(uint32) );\n\t\treturn(written);\n\t}\n\tt2p->pdf_xrefcount=0;\n\tt2p->pdf_catalog=1;\n\tt2p->pdf_info=2;\n\tt2p->pdf_pages=3;\n\twritten += t2p_write_pdf_header(t2p, output);\n\tt2p->pdf_xrefoffsets[t2p->pdf_xrefcount++]=written;\n\tt2p->pdf_catalog=t2p->pdf_xrefcount;\n\twritten += t2p_write_pdf_obj_start(t2p->pdf_xrefcount, output);\n\twritten += t2p_write_pdf_catalog(t2p, output);\n\twritten += t2p_write_pdf_obj_end(output);\n\tt2p->pdf_xrefoffsets[t2p->pdf_xrefcount++]=written;\n\tt2p->pdf_info=t2p->pdf_xrefcount;\n\twritten += t2p_write_pdf_obj_start(t2p->pdf_xrefcount, output);\n\twritten += t2p_write_pdf_info(t2p, input, output);\n\twritten += t2p_write_pdf_obj_end(output);\n\tt2p->pdf_xrefoffsets[t2p->pdf_xrefcount++]=written;\n\tt2p->pdf_pages=t2p->pdf_xrefcount;\n\twritten += t2p_write_pdf_obj_start(t2p->pdf_xrefcount, output);\n\twritten += t2p_write_pdf_pages(t2p, output);\n\twritten += t2p_write_pdf_obj_end(output);\n\tfor(t2p->pdf_page=0;t2p->pdf_page<t2p->tiff_pagecount;t2p->pdf_page++){\n\t\tt2p_read_tiff_data(t2p, input);\n\t\tif(t2p->t2p_error!=T2P_ERR_OK){return(0);}\n\t\tt2p->pdf_xrefoffsets[t2p->pdf_xrefcount++]=written;\n\t\twritten += t2p_write_pdf_obj_start(t2p->pdf_xrefcount, output);\n\t\twritten += t2p_write_pdf_page(t2p->pdf_xrefcount, t2p, output);\n\t\twritten += t2p_write_pdf_obj_end(output);\n\t\tt2p->pdf_xrefoffsets[t2p->pdf_xrefcount++]=written;\n\t\twritten += t2p_write_pdf_obj_start(t2p->pdf_xrefcount, output);\n\t\twritten += t2p_write_pdf_stream_dict_start(output);\n\t\twritten += t2p_write_pdf_stream_dict(0, t2p->pdf_xrefcount+1, output);\n\t\twritten += t2p_write_pdf_stream_dict_end(output);\n\t\twritten += t2p_write_pdf_stream_start(output);\n\t\tstreamlen=written;\n\t\twritten += t2p_write_pdf_page_content_stream(t2p, output);\n\t\tstreamlen=written-streamlen;\n\t\twritten += t2p_write_pdf_stream_end(output);\n\t\twritten += t2p_write_pdf_obj_end(output);\n\t\tt2p->pdf_xrefoffsets[t2p->pdf_xrefcount++]=written;\n\t\twritten += t2p_write_pdf_obj_start(t2p->pdf_xrefcount, output);\n\t\twritten += t2p_write_pdf_stream_length(streamlen, output);\n\t\twritten += t2p_write_pdf_obj_end(output);\n\t\tif(t2p->tiff_transferfunctioncount != 0){\n\t\t\tt2p->pdf_xrefoffsets[t2p->pdf_xrefcount++]=written;\n\t\t\twritten += t2p_write_pdf_obj_start(t2p->pdf_xrefcount, output);\n\t\t\twritten += t2p_write_pdf_transfer(t2p, output);\n\t\t\twritten += t2p_write_pdf_obj_end(output);\n\t\t\tfor(i=0; i < t2p->tiff_transferfunctioncount; i++){\n\t\t\t\tt2p->pdf_xrefoffsets[t2p->pdf_xrefcount++]=written;\n\t\t\t\twritten += t2p_write_pdf_obj_start(t2p->pdf_xrefcount, output);\n\t\t\t\twritten += t2p_write_pdf_stream_dict_start(output);\n\t\t\t\twritten += t2p_write_pdf_transfer_dict(t2p, output, i);\n\t\t\t\twritten += t2p_write_pdf_stream_dict_end(output);\n\t\t\t\twritten += t2p_write_pdf_stream_start(output);\n\t\t\t\tstreamlen=written;\n\t\t\t\twritten += t2p_write_pdf_transfer_stream(t2p, output, i);\n\t\t\t\tstreamlen=written-streamlen;\n\t\t\t\twritten += t2p_write_pdf_stream_end(output);\n\t\t\t\twritten += t2p_write_pdf_obj_end(output);\n\t\t\t}\n\t\t}\n\t\tif( (t2p->pdf_colorspace & T2P_CS_PALETTE) != 0){\n\t\t\tt2p->pdf_xrefoffsets[t2p->pdf_xrefcount++]=written;\n\t\t\tt2p->pdf_palettecs=t2p->pdf_xrefcount;\n\t\t\twritten += t2p_write_pdf_obj_start(t2p->pdf_xrefcount, output);\n\t\t\twritten += t2p_write_pdf_stream_dict_start(output);\n\t\t\twritten += t2p_write_pdf_stream_dict(t2p->pdf_palettesize, 0, output);\n\t\t\twritten += t2p_write_pdf_stream_dict_end(output);\n\t\t\twritten += t2p_write_pdf_stream_start(output);\n\t\t\tstreamlen=written;\n\t\t\twritten += t2p_write_pdf_xobject_palettecs_stream(t2p, output);\n\t\t\tstreamlen=written-streamlen;\n\t\t\twritten += t2p_write_pdf_stream_end(output);\n\t\t\twritten += t2p_write_pdf_obj_end(output);\n\t\t}\n\t\tif( (t2p->pdf_colorspace & T2P_CS_ICCBASED) != 0){\n\t\t\tt2p->pdf_xrefoffsets[t2p->pdf_xrefcount++]=written;\n\t\t\tt2p->pdf_icccs=t2p->pdf_xrefcount;\n\t\t\twritten += t2p_write_pdf_obj_start(t2p->pdf_xrefcount, output);\n\t\t\twritten += t2p_write_pdf_stream_dict_start(output);\n\t\t\twritten += t2p_write_pdf_xobject_icccs_dict(t2p, output);\n\t\t\twritten += t2p_write_pdf_stream_dict_end(output);\n\t\t\twritten += t2p_write_pdf_stream_start(output);\n\t\t\tstreamlen=written;\n\t\t\twritten += t2p_write_pdf_xobject_icccs_stream(t2p, output);\n\t\t\tstreamlen=written-streamlen;\n\t\t\twritten += t2p_write_pdf_stream_end(output);\n\t\t\twritten += t2p_write_pdf_obj_end(output);\n\t\t}\n\t\tif(t2p->tiff_tiles[t2p->pdf_page].tiles_tilecount !=0){\n\t\t\tfor(i2=0;i2<t2p->tiff_tiles[t2p->pdf_page].tiles_tilecount;i2++){\n\t\t\t\tt2p->pdf_xrefoffsets[t2p->pdf_xrefcount++]=written;\n\t\t\t\twritten += t2p_write_pdf_obj_start(t2p->pdf_xrefcount, output);\n\t\t\t\twritten += t2p_write_pdf_stream_dict_start(output);\n\t\t\t\twritten += t2p_write_pdf_xobject_stream_dict(\n\t\t\t\t\ti2+1, \n\t\t\t\t\tt2p, \n\t\t\t\t\toutput);\n\t\t\t\twritten += t2p_write_pdf_stream_dict_end(output);\n\t\t\t\twritten += t2p_write_pdf_stream_start(output);\n\t\t\t\tstreamlen=written;\n\t\t\t\tt2p_read_tiff_size_tile(t2p, input, i2);\n\t\t\t\twritten += t2p_readwrite_pdf_image_tile(t2p, input, output, i2);\n\t\t\t\tt2p_write_advance_directory(t2p, output);\n\t\t\t\tif(t2p->t2p_error!=T2P_ERR_OK){return(0);}\n\t\t\t\tstreamlen=written-streamlen;\n\t\t\t\twritten += t2p_write_pdf_stream_end(output);\n\t\t\t\twritten += t2p_write_pdf_obj_end(output);\n\t\t\t\tt2p->pdf_xrefoffsets[t2p->pdf_xrefcount++]=written;\n\t\t\t\twritten += t2p_write_pdf_obj_start(t2p->pdf_xrefcount, output);\n\t\t\t\twritten += t2p_write_pdf_stream_length(streamlen, output);\n\t\t\t\twritten += t2p_write_pdf_obj_end(output);\n\t\t\t}\n\t\t} else {\n\t\t\tt2p->pdf_xrefoffsets[t2p->pdf_xrefcount++]=written;\n\t\t\twritten += t2p_write_pdf_obj_start(t2p->pdf_xrefcount, output);\n\t\t\twritten += t2p_write_pdf_stream_dict_start(output);\n\t\t\twritten += t2p_write_pdf_xobject_stream_dict(\n\t\t\t\t0, \n\t\t\t\tt2p, \n\t\t\t\toutput);\n\t\t\twritten += t2p_write_pdf_stream_dict_end(output);\n\t\t\twritten += t2p_write_pdf_stream_start(output);\n\t\t\tstreamlen=written;\n\t\t\tt2p_read_tiff_size(t2p, input);\n\t\t\twritten += t2p_readwrite_pdf_image(t2p, input, output);\n\t\t\tt2p_write_advance_directory(t2p, output);\n\t\t\tif(t2p->t2p_error!=T2P_ERR_OK){return(0);}\n\t\t\tstreamlen=written-streamlen;\n\t\t\twritten += t2p_write_pdf_stream_end(output);\n\t\t\twritten += t2p_write_pdf_obj_end(output);\n\t\t\tt2p->pdf_xrefoffsets[t2p->pdf_xrefcount++]=written;\n\t\t\twritten += t2p_write_pdf_obj_start(t2p->pdf_xrefcount, output);\n\t\t\twritten += t2p_write_pdf_stream_length(streamlen, output);\n\t\t\twritten += t2p_write_pdf_obj_end(output);\n\t\t}\n\t}\n\tt2p->pdf_startxref = written;\n\twritten += t2p_write_pdf_xreftable(t2p, output);\n\twritten += t2p_write_pdf_trailer(t2p, output);\n\tt2p_disable(output);\n\n\treturn(written);\n}\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiff/tools/tiff2ps.c",
    "content": "/* $Id: tiff2ps.c,v 1.35.2.3 2009-01-12 16:25:18 bfriesen Exp $ */\n\n/*\n * Copyright (c) 1988-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n#include \"tif_config.h\"\n\n#include <stdio.h>\n#include <stdlib.h>\t\t\t/* for atof */\n#include <math.h>\n#include <time.h>\n#include <string.h>\n\n#ifdef HAVE_UNISTD_H\n# include <unistd.h>\n#endif\n\n#include \"tiffio.h\"\n\n/*\n * Revision history\n *\n * 2005-June-3\n *    Richard Nolde: Added support for rotations of 90, 180, 270\n *    and auto using -r <90|180|270|auto>.  Auto picks the best\n *    fit for the image on the specified paper size (eg portrait\n *    or landscape) if -h or -w is specified. Rotation is in\n *    degrees counterclockwise since that is how Postscript does\n *    it.  Auto rotates 90 degrees ccw to produce landscape.\n *\n *    Added maxPageWidth option using -W flag. MaxPageHeight and\n *    MaxPageWidth are mutually exclusive since the aspect ratio\n *    cannot be maintained if you set both.\n *    Rewrote PlaceImage to allow maxPageHeight and maxPageWidth\n *    options to work with values smaller or larger than the\n *    physical paper size and still preserve the aspect ratio.\n *    This is accomplished by creating multiple pages across\n *    as well as down if need be.\n *\n * 2001-Mar-21\n *    I (Bruce A. Mallett) added this revision history comment ;)\n *\n *    Fixed PS_Lvl2page() code which outputs non-ASCII85 raw\n *    data.  Moved test for when to output a line break to\n *    *after* the output of a character.  This just serves\n *    to fix an eye-nuisance where the first line of raw\n *    data was one character shorter than subsequent lines.\n *\n *    Added an experimental ASCII85 encoder which can be used\n *    only when there is a single buffer of bytes to be encoded.\n *    This version is much faster at encoding a straight-line\n *    buffer of data because it can avoid alot of the loop\n *    overhead of the byte-by-bye version.  To use this version\n *    you need to define EXP_ASCII85ENCODER (experimental ...).\n *\n *    Added bug fix given by Michael Schmidt to PS_Lvl2page()\n *    in which an end-of-data marker ('>') was not being output\n *    when producing non-ASCII85 encoded PostScript Level 2\n *    data.\n *\n *    Fixed PS_Lvl2colorspace() so that it no longer assumes that\n *    a TIFF having more than 2 planes is a CMYK.  This routine\n *    no longer looks at the samples per pixel but instead looks\n *    at the \"photometric\" value.  This change allows support of\n *    CMYK TIFFs.\n *\n *    Modified the PostScript L2 imaging loop so as to test if\n *    the input stream is still open before attempting to do a\n *    flushfile on it.  This was done because some RIPs close\n *    the stream after doing the image operation.\n *\n *    Got rid of the realloc() being done inside a loop in the\n *    PSRawDataBW() routine.  The code now walks through the\n *    byte-size array outside the loop to determine the largest\n *    size memory block that will be needed.\n *\n *    Added \"-m\" switch to ask tiff2ps to, where possible, use the\n *    \"imagemask\" operator instead of the \"image\" operator.\n *\n *    Added the \"-i #\" switch to allow interpolation to be disabled.\n *\n *    Unrolled a loop or two to improve performance.\n */\n\n/*\n * Define EXP_ASCII85ENCODER if you want to use an experimental\n * version of the ASCII85 encoding routine.  The advantage of\n * using this routine is that tiff2ps will convert to ASCII85\n * encoding at between 3 and 4 times the speed as compared to\n * using the old (non-experimental) encoder.  The disadvantage\n * is that you will be using a new (and unproven) encoding\n * routine.  So user beware, you have been warned!\n */\n\n#define\tEXP_ASCII85ENCODER\n\n/*\n * NB: this code assumes uint32 works with printf's %l[ud].\n */\n#ifndef TRUE\n#define\tTRUE\t1\n#define\tFALSE\t0\n#endif\n\n#define HORIZONTAL 1\n#define VERTICAL   2\n\nint\tascii85 = FALSE;\t\t/* use ASCII85 encoding */\nint\tinterpolate = TRUE;\t\t/* interpolate level2 image */\nint\tlevel2 = FALSE;\t\t\t/* generate PostScript level 2 */\nint\tlevel3 = FALSE;\t\t\t/* generate PostScript level 3 */\nint\tprintAll = FALSE;\t\t/* print all images in file */\nint\tgenerateEPSF = TRUE;\t\t/* generate Encapsulated PostScript */\nint\tPSduplex = FALSE;\t\t/* enable duplex printing */\nint\tPStumble = FALSE;\t\t/* enable top edge binding */\nint\tPSavoiddeadzone = TRUE;\t\t/* enable avoiding printer deadzone */\ndouble\tmaxPageHeight = 0;\t\t/* maximum height to select from image and print per page */\ndouble\tmaxPageWidth  = 0;\t\t/* maximum width  to select from image and print per page */\ndouble\tsplitOverlap = 0;\t\t/* amount for split pages to overlag */\nint\trotate = FALSE;\t\t\t/* rotate image by angle 90, 180, 270 degrees */\nint\trotation = 0;                   /* optional value for rotation angle */\nchar\t*filename;\t\t\t/* input filename */\nint\tuseImagemask = FALSE;\t\t/* Use imagemask instead of image operator */\nuint16\tres_unit = 0;\t\t\t/* Resolution units: 2 - inches, 3 - cm */\n\n/*\n * ASCII85 Encoding Support.\n */\nunsigned char ascii85buf[10];\nint\tascii85count;\nint\tascii85breaklen;\n\nint\tTIFF2PS(FILE*, TIFF*, double, double, double, double, int);\nvoid\tPSpage(FILE*, TIFF*, uint32, uint32);\nvoid\tPSColorContigPreamble(FILE*, uint32, uint32, int);\nvoid\tPSColorSeparatePreamble(FILE*, uint32, uint32, int);\nvoid\tPSDataColorContig(FILE*, TIFF*, uint32, uint32, int);\nvoid\tPSDataColorSeparate(FILE*, TIFF*, uint32, uint32, int);\nvoid\tPSDataPalette(FILE*, TIFF*, uint32, uint32);\nvoid\tPSDataBW(FILE*, TIFF*, uint32, uint32);\nvoid\tPSRawDataBW(FILE*, TIFF*, uint32, uint32);\nvoid\tAscii85Init(void);\nvoid\tAscii85Put(unsigned char code, FILE* fd);\nvoid\tAscii85Flush(FILE* fd);\nvoid    PSHead(FILE*, TIFF*, uint32, uint32, double, double, double, double);\nvoid\tPSTail(FILE*, int);\n\n#if\tdefined( EXP_ASCII85ENCODER)\nint Ascii85EncodeBlock( uint8 * ascii85_p, unsigned f_eod, const uint8 * raw_p, int raw_l );\n#endif\n\nstatic\tvoid usage(int);\n\nint\nmain(int argc, char* argv[])\n{\n\tint dirnum = -1, c, np = 0;\n\tint centered = 0;\n\tdouble bottommargin = 0;\n\tdouble leftmargin = 0;\n\tdouble pageWidth = 0;\n\tdouble pageHeight = 0;\n\tuint32 diroff = 0;\n\textern char *optarg;\n\textern int optind;\n\tFILE* output = stdout;\n\n\twhile ((c = getopt(argc, argv, \"b:d:h:H:W:L:i:w:l:o:O:r:acelmxyzps1238DT\")) != -1)\n\t\tswitch (c) {\n\t\tcase 'b':\n\t\t\tbottommargin = atof(optarg);\n\t\t\tbreak;\n\t\tcase 'c':\n\t\t\tcentered = 1;\n\t\t\tbreak;\n\t\tcase 'd':\n\t\t\tdirnum = atoi(optarg);\n\t\t\tbreak;\n\t\tcase 'D':\n\t\t\tPSduplex = TRUE;\n\t\t\tbreak;\n\t\tcase 'i':\n\t\t\tinterpolate = atoi(optarg) ? TRUE:FALSE;\n\t\t\tbreak;\n\t\tcase 'T':\n\t\t\tPStumble = TRUE;\n\t\t\tbreak;\n\t\tcase 'e':\n\t\t\tPSavoiddeadzone = FALSE;\n\t\t\tgenerateEPSF = TRUE;\n\t\t\tbreak;\n\t\tcase 'h':\n\t\t\tpageHeight = atof(optarg);\n\t\t\tbreak;\n\t\tcase 'H':\n\t\t\tmaxPageHeight = atof(optarg);\n\t\t\tif (pageHeight==0) pageHeight = maxPageHeight;\n\t\t\tbreak;\n\t\tcase 'W':\n\t\t\tmaxPageWidth = atof(optarg);\n\t\t\tif (pageWidth==0) pageWidth = maxPageWidth;\n\t\t\tbreak;\n\t\tcase 'L':\n\t\t\tsplitOverlap = atof(optarg);\n\t\t\tbreak;\n\t\tcase 'm':\n\t\t\tuseImagemask = TRUE;\n\t\t\tbreak;\n\t\tcase 'o':\n\t\t\tdiroff = (uint32) strtoul(optarg, NULL, 0);\n\t\t\tbreak;\n\t\tcase 'O':\t\t/* XXX too bad -o is already taken */\n\t\t\toutput = fopen(optarg, \"w\");\n\t\t\tif (output == NULL) {\n\t\t\t\tfprintf(stderr,\n\t\t\t\t    \"%s: %s: Cannot open output file.\\n\",\n\t\t\t\t    argv[0], optarg);\n\t\t\t\texit(-2);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 'l':\n\t\t\tleftmargin = atof(optarg);\n\t\t\tbreak;\n\t\tcase 'a':\n\t\t\tprintAll = TRUE;\n\t\t\t/* fall thru... */\n\t\tcase 'p':\n\t\t\tgenerateEPSF = FALSE;\n\t\t\tbreak;\n\t\tcase 'r':\n\t\t\trotate = TRUE;\n                        if (strcmp (optarg, \"auto\") == 0)\n                          rotation = 0;\n                        else\n \t\t\t  rotation = atoi(optarg);\n                        switch (rotation)\n                          {\n\t\t\t  case   0:\n                          case  90:\n                          case 180:\n                          case 270:\n\t\t\t    break;\n\t\t\t  default:\n                            fprintf (stderr, \"Rotation angle must be 90, 180, 270 (degrees ccw) or auto\\n\");\n\t\t\t    exit (-2);\n\t\t\t  }\n\t\t\tbreak;\n\t\tcase 's':\n\t\t\tprintAll = FALSE;\n\t\t\tbreak;\n\t\tcase 'w':\n\t\t\tpageWidth = atof(optarg);\n\t\t\tbreak;\n\t\tcase 'z':\n\t\t\tPSavoiddeadzone = FALSE;\n\t\t\tbreak;\n\t\tcase '1':\n\t\t\tlevel2 = FALSE;\n\t\t\tlevel3 = FALSE;\n\t\t\tascii85 = FALSE;\n\t\t\tbreak;\n\t\tcase '2':\n\t\t\tlevel2 = TRUE;\n\t\t\tascii85 = TRUE;\t\t\t/* default to yes */\n\t\t\tbreak;\n\t\tcase '3':\n\t\t\tlevel3 = TRUE;\n\t\t\tascii85 = TRUE;\t\t\t/* default to yes */\n\t\t\tbreak;\n\t\tcase '8':\n\t\t\tascii85 = FALSE;\n\t\t\tbreak;\n\t\tcase 'x':\n\t\t\tres_unit = RESUNIT_CENTIMETER;\n\t\t\tbreak;\n\t\tcase 'y':\n\t\t\tres_unit = RESUNIT_INCH;\n\t\t\tbreak;\n\t\tcase '?':\n\t\t\tusage(-1);\n\t\t}\n\tfor (; argc - optind > 0; optind++) {\n\t\tTIFF* tif = TIFFOpen(filename = argv[optind], \"r\");\n\t\tif (tif != NULL) {\n\t\t\tif (dirnum != -1\n                            && !TIFFSetDirectory(tif, (tdir_t)dirnum))\n\t\t\t\treturn (-1);\n\t\t\telse if (diroff != 0 &&\n\t\t\t    !TIFFSetSubDirectory(tif, diroff))\n\t\t\t\treturn (-1);\n\t\t\tnp = TIFF2PS(output, tif, pageWidth, pageHeight,\n\t\t\t\tleftmargin, bottommargin, centered);\n\t\t\tTIFFClose(tif);\n\t\t}\n\t}\n\tif (np)\n\t\tPSTail(output, np);\n\telse\n\t\tusage(-1);\n\tif (output != stdout)\n\t\tfclose(output);\n\treturn (0);\n}\n\nstatic\tuint16 samplesperpixel;\nstatic\tuint16 bitspersample;\nstatic\tuint16 planarconfiguration;\nstatic\tuint16 photometric;\nstatic\tuint16 compression;\nstatic\tuint16 extrasamples;\nstatic\tint alpha;\n\nstatic int\ncheckImage(TIFF* tif)\n{\n\tswitch (photometric) {\n\tcase PHOTOMETRIC_YCBCR:\n\t\tif ((compression == COMPRESSION_JPEG || compression == COMPRESSION_OJPEG)\n\t\t\t&& planarconfiguration == PLANARCONFIG_CONTIG) {\n\t\t\t/* can rely on libjpeg to convert to RGB */\n\t\t\tTIFFSetField(tif, TIFFTAG_JPEGCOLORMODE,\n\t\t\t\t     JPEGCOLORMODE_RGB);\n\t\t\tphotometric = PHOTOMETRIC_RGB;\n\t\t} else {\n\t\t\tif (level2 || level3)\n\t\t\t\tbreak;\n\t\t\tTIFFError(filename, \"Can not handle image with %s\",\n\t\t\t    \"PhotometricInterpretation=YCbCr\");\n\t\t\treturn (0);\n\t\t}\n\t\t/* fall thru... */\n\tcase PHOTOMETRIC_RGB:\n\t\tif (alpha && bitspersample != 8) {\n\t\t\tTIFFError(filename,\n\t\t\t    \"Can not handle %d-bit/sample RGB image with alpha\",\n\t\t\t    bitspersample);\n\t\t\treturn (0);\n\t\t}\n\t\t/* fall thru... */\n\tcase PHOTOMETRIC_SEPARATED:\n\tcase PHOTOMETRIC_PALETTE:\n\tcase PHOTOMETRIC_MINISBLACK:\n\tcase PHOTOMETRIC_MINISWHITE:\n\t\tbreak;\n\tcase PHOTOMETRIC_LOGL:\n\tcase PHOTOMETRIC_LOGLUV:\n\t\tif (compression != COMPRESSION_SGILOG &&\n\t\t    compression != COMPRESSION_SGILOG24) {\n\t\t\tTIFFError(filename,\n\t\t    \"Can not handle %s data with compression other than SGILog\",\n\t\t\t    (photometric == PHOTOMETRIC_LOGL) ?\n\t\t\t\t\"LogL\" : \"LogLuv\"\n\t\t\t);\n\t\t\treturn (0);\n\t\t}\n\t\t/* rely on library to convert to RGB/greyscale */\n\t\tTIFFSetField(tif, TIFFTAG_SGILOGDATAFMT, SGILOGDATAFMT_8BIT);\n\t\tphotometric = (photometric == PHOTOMETRIC_LOGL) ?\n\t\t    PHOTOMETRIC_MINISBLACK : PHOTOMETRIC_RGB;\n\t\tbitspersample = 8;\n\t\tbreak;\n\tcase PHOTOMETRIC_CIELAB:\n\t\t/* fall thru... */\n\tdefault:\n\t\tTIFFError(filename,\n\t\t    \"Can not handle image with PhotometricInterpretation=%d\",\n\t\t    photometric);\n\t\treturn (0);\n\t}\n\tswitch (bitspersample) {\n\tcase 1: case 2:\n\tcase 4: case 8:\n\tcase 16:\n\t\tbreak;\n\tdefault:\n\t\tTIFFError(filename, \"Can not handle %d-bit/sample image\",\n\t\t    bitspersample);\n\t\treturn (0);\n\t}\n\tif (planarconfiguration == PLANARCONFIG_SEPARATE && extrasamples > 0)\n\t\tTIFFWarning(filename, \"Ignoring extra samples\");\n\treturn (1);\n}\n\n#define PS_UNIT_SIZE\t72.0F\n#define\tPSUNITS(npix,res)\t((npix) * (PS_UNIT_SIZE / (res)))\n\nstatic\tchar RGBcolorimage[] = \"\\\n/bwproc {\\n\\\n    rgbproc\\n\\\n    dup length 3 idiv string 0 3 0\\n\\\n    5 -1 roll {\\n\\\n\tadd 2 1 roll 1 sub dup 0 eq {\\n\\\n\t    pop 3 idiv\\n\\\n\t    3 -1 roll\\n\\\n\t    dup 4 -1 roll\\n\\\n\t    dup 3 1 roll\\n\\\n\t    5 -1 roll put\\n\\\n\t    1 add 3 0\\n\\\n\t} { 2 1 roll } ifelse\\n\\\n    } forall\\n\\\n    pop pop pop\\n\\\n} def\\n\\\n/colorimage where {pop} {\\n\\\n    /colorimage {pop pop /rgbproc exch def {bwproc} image} bind def\\n\\\n} ifelse\\n\\\n\";\n\n/*\n * Adobe Photoshop requires a comment line of the form:\n *\n * %ImageData: <cols> <rows> <depth>  <main channels> <pad channels>\n *\t<block size> <1 for binary|2 for hex> \"data start\"\n *\n * It is claimed to be part of some future revision of the EPS spec.\n */\nstatic void\nPhotoshopBanner(FILE* fd, uint32 w, uint32 h, int bs, int nc, char* startline)\n{\n\tfprintf(fd, \"%%ImageData: %ld %ld %d %d 0 %d 2 \\\"\",\n\t    (long) w, (long) h, bitspersample, nc, bs);\n\tfprintf(fd, startline, nc);\n\tfprintf(fd, \"\\\"\\n\");\n}\n\n/*\n *   pw : image width in pixels\n *   ph : image height in pixels\n * pprw : image width in PS units (72 dpi)\n * pprh : image height in PS units (72 dpi)\n */\nstatic void\nsetupPageState(TIFF* tif, uint32* pw, uint32* ph, double* pprw, double* pprh)\n{\n\tfloat xres = 0.0F, yres = 0.0F;\n\n\tTIFFGetField(tif, TIFFTAG_IMAGEWIDTH, pw);\n\tTIFFGetField(tif, TIFFTAG_IMAGELENGTH, ph);\n\tif (res_unit == 0)\n\t\tTIFFGetFieldDefaulted(tif, TIFFTAG_RESOLUTIONUNIT, &res_unit);\n\t/*\n\t * Calculate printable area.\n\t */\n\tif (!TIFFGetField(tif, TIFFTAG_XRESOLUTION, &xres)\n            || fabs(xres) < 0.0000001)\n\t\txres = PS_UNIT_SIZE;\n\tif (!TIFFGetField(tif, TIFFTAG_YRESOLUTION, &yres)\n            || fabs(yres) < 0.0000001)\n\t\tyres = PS_UNIT_SIZE;\n\tswitch (res_unit) {\n\tcase RESUNIT_CENTIMETER:\n\t\txres *= 2.54F, yres *= 2.54F;\n\t\tbreak;\n\tcase RESUNIT_INCH:\n\t\tbreak;\n\tcase RESUNIT_NONE:\n\tdefault:\n\t\t/*\n\t\t * check that the resolution is not inches before scaling it\n\t\t */\n\t\tif (xres != PS_UNIT_SIZE || yres != PS_UNIT_SIZE)\n\t\t\txres *= PS_UNIT_SIZE, yres *= PS_UNIT_SIZE;\n\t\tbreak;\n\t}\n\t*pprh = PSUNITS(*ph, yres);\n\t*pprw = PSUNITS(*pw, xres);\n}\n\nstatic int\nisCCITTCompression(TIFF* tif)\n{\n    uint16 compress;\n    TIFFGetField(tif, TIFFTAG_COMPRESSION, &compress);\n    return (compress == COMPRESSION_CCITTFAX3 ||\n\t    compress == COMPRESSION_CCITTFAX4 ||\n\t    compress == COMPRESSION_CCITTRLE ||\n\t    compress == COMPRESSION_CCITTRLEW);\n}\n\nstatic\ttsize_t tf_bytesperrow;\nstatic\ttsize_t ps_bytesperrow;\nstatic\ttsize_t\ttf_rowsperstrip;\nstatic\ttsize_t\ttf_numberstrips;\nstatic\tchar *hex = \"0123456789abcdef\";\n\n/*\n * imagewidth & imageheight are 1/72 inches\n * pagewidth & pageheight are inches\n */\nint\nPlaceImage(TIFF *tif, FILE *fp, int *npages, uint32 w, uint32 h,\n           double pagewidth, double pageheight,\n\t   double imagewidth, double imageheight,\n           int splitpage, double lm, double bm, int cnt)\n{\n        int    i       = 0;\n        int    ximages = 0;\n        int    splitaxis = 0;\n\tdouble xtran = 0;\n\tdouble ytran = 0;\n\tdouble xscale = 1;\n\tdouble yscale = 1;\n\tdouble left_margin    = 0;\n\tdouble bottom_margin  = 0;\n\tdouble left_offset    = lm * PS_UNIT_SIZE;\n\tdouble bottom_offset  = bm * PS_UNIT_SIZE;\n\tdouble splitwidth     = 0;\n\tdouble splitheight    = 0;\n\tdouble subimageheight = 0;\n\tdouble subimagewidth  = 0;\n\tdouble overlap        = 0;\n\tdouble overlapspace   = 0;\n\n\tpagewidth *= PS_UNIT_SIZE;\n\tpageheight *= PS_UNIT_SIZE;\n\n\tsplitheight = maxPageHeight * PS_UNIT_SIZE;\n\tsplitwidth  = maxPageWidth  * PS_UNIT_SIZE;\n\toverlap     = splitOverlap  * PS_UNIT_SIZE;\n        /* These have to be mutually exclusive to maintain the aspect ratio */\n        if (splitheight != 0)\n          splitaxis = VERTICAL;\n        else {\n           if (splitwidth != 0)\n             splitaxis = HORIZONTAL;\n           else {\n             fprintf (stderr, \"You must specify either a maximum page height or width\\n\");\n             return (0);\n           }\n        }\n\n        if (splitaxis == VERTICAL) {\n  \t  if (imageheight <= splitheight) {\n\t    /* Simple case, no splitting or scaling for image height */\n\t    yscale = imageheight;\n\t    ytran = pageheight - imageheight;\n\t  } else { /* imageheight > splitheight */\n\t      subimageheight = imageheight - ((splitheight - overlap) * splitpage);\n\n              yscale = imageheight * (pageheight / splitheight);\n\t      ytran  = pageheight - subimageheight * (pageheight / splitheight);\n\t    \n              if (subimageheight > splitheight) {\n\t        splitpage++;\n\t      } else {\n\t\t  splitpage = 0;\n\t          } \n\t  }\n\t  bottom_offset += ytran / (cnt?2:1);\n          left_margin = left_offset / (cnt ? 2 : 1);\n\t  /*\n           * WIDTH: We can't rescale height based on width so we need to make multiple\n           *   pages from each horizontal segment if the image is wider than pagewidth\n           */\n\n          ximages = ceil (imagewidth / pagewidth);\n          overlapspace = (ximages - 1) * overlap;\n          if (((imagewidth + overlapspace) * (pageheight / splitheight)) > (ximages * pagewidth)) {\n            ximages++;\n            overlapspace += overlap;\n\t  }\n          xscale = (imagewidth + overlapspace) * (pageheight / splitheight);\n\t  if (imagewidth <= pagewidth) {\n            left_offset = left_margin;\n            bottom_offset = bottom_margin;\n\t    fprintf(fp, \"%f %f translate\\n\", left_offset, bottom_offset);\n\t    fprintf(fp, \"%f %f scale\\n\", xscale, yscale);\n\t  } else {\n            for (i = 0; i < ximages; i++) {\n              xtran = i * (pagewidth - ((i > 0) ? overlap : 0));\n\t      left_offset = -xtran + left_margin;\n\n \t      fprintf(fp, \"%f %f translate\\n\", left_offset, bottom_offset);\n\t      fprintf(fp, \"%f %f scale\\n\", xscale, yscale);\n\n              if ( i < (ximages - 1)) {\n  \t        PSpage(fp, tif, w, h);\n\t        fprintf(fp, \"end\\n\");\n\t        fprintf(fp, \"grestore\\n\");\n\t        fprintf(fp, \"showpage\\n\");\n \t        (*npages)++;\n\t        fprintf(fp, \"%%%%Page: %d %d\\n\", (*npages), (*npages));\n\t        fprintf(fp, \"gsave\\n\");\n\t        fprintf(fp, \"100 dict begin\\n\");\n\t        }\n\t    }\n\t  }\n        } else {  /* splitaxis is HORIZONTAL */\n          ximages = ceil (imagewidth / splitwidth);\n          overlapspace = (ximages - 1) * overlap;\n          if (((imagewidth + overlapspace) * (pagewidth / splitwidth)) > (ximages * pagewidth)) {\n            ximages++;\n            overlapspace += overlap;\n\t  }\n  \t  if (ximages == 1) {\n\t    /* Simple case, no splitting or scaling for image width */\n\t    xscale = imagewidth;\n\t    xtran = 0;\n            splitpage = 0;\n\t  } else {\n\t      subimagewidth  = imagewidth  - ((splitwidth - overlap) * splitpage);\n\n              xscale = imagewidth * (pagewidth / splitwidth);\n\t      xtran  = imagewidth - (subimagewidth * (pagewidth / splitwidth));\n\n              splitheight = pageheight;\n\t      subimageheight = imageheight - ((splitheight - overlap) * splitpage);\n              yscale = (imageheight + overlapspace);\n\t      ytran  = pageheight - subimageheight  + (overlapspace * (pagewidth / splitwidth));\n\n              if (subimageheight > splitheight) {\n\t        splitpage++;\n\t      } else {\n\t\t  splitpage = 0;\n\t          } \n\t  }\n          bottom_margin = bottom_offset / (cnt ? 2 : 1);\n \t  bottom_offset = bottom_margin + ytran;\n          left_margin = left_offset / (cnt ? 2 : 1);\n\t  if (imagewidth <= pagewidth) {\n            left_offset = left_margin;\n            bottom_offset = bottom_margin;\n\t    fprintf(fp, \"%f %f translate\\n\", left_offset, bottom_offset);\n\t    fprintf(fp, \"%f %f scale\\n\", xscale, yscale);\n\t  } else {\n              for (i = 0; i < ximages; i++) {\n                xtran = i * (pagewidth - ((i > 0) ? overlap : 0));\n\t        left_offset = left_margin - xtran;\n \t        fprintf(fp, \"%f %f translate\\n\", left_offset, bottom_offset);\n\t        fprintf(fp, \"%f %f scale\\n\", xscale, yscale);\n                if ( i < (ximages - 1)) {\n  \t          PSpage(fp, tif, w, h);\n\t          fprintf(fp, \"end\\n\");\n\t          fprintf(fp, \"grestore\\n\");\n\t          fprintf(fp, \"showpage\\n\");\n \t          (*npages)++;\n\t          fprintf(fp, \"%%%%Page: %d %d\\n\", (*npages), (*npages));\n\t          fprintf(fp, \"gsave\\n\");\n\t          fprintf(fp, \"100 dict begin\\n\");\n\t        }\n\t      }\n\t  }\n\t}\n\n\tif (rotate)\n\t    {\n\t    if (rotation == 180 )\n              {\n    \t      fprintf(fp, \"%f %f translate\\n\", left_offset, bottom_offset);\n\t      fprintf(fp, \"%f %f scale\\n\", xscale, yscale);\n              }\n            else\n              {\n    \t      fprintf(fp, \"%f %f translate\\n\", bottom_offset, left_offset);\n\t      fprintf(fp, \"%f %f scale\\n\", yscale, xscale);\n              }\n\t    fprintf (fp, \"1 1 translate %d rotate\\n\", rotation);\n            }\n\n\treturn splitpage;\n} \n\n/* returns the sequence number of the page processed */\nint\nTIFF2PS(FILE* fd, TIFF* tif,\n\tdouble pw, double ph, double lm, double bm, int cnt)\n{\n\tuint32 w = 0, h = 0;\n\tfloat  ox, oy;\n        double maxsource, maxtarget;    /* Used for auto rotations */\n        double hcenter, vcenter;        /* Used for centering */\n        double prw, prh;    /* Original Image width and height in Postscript points */\n\tdouble psw, psh;    /* Scaled image width and height in Postscript points */\n\tdouble xscale = 1.0, yscale = 1.0, scale = 1.0;\n\tdouble left_offset = lm * PS_UNIT_SIZE;\n\tdouble bottom_offset = bm * PS_UNIT_SIZE;\n\tuint32 subfiletype;\n\tuint16* sampleinfo;\n\tstatic int npages = 0;\n\tint split;\n\n\tif (!TIFFGetField(tif, TIFFTAG_XPOSITION, &ox))\n\t\tox = 0;\n\tif (!TIFFGetField(tif, TIFFTAG_YPOSITION, &oy))\n\t\toy = 0;\n\tdo {\n\t\ttf_numberstrips = TIFFNumberOfStrips(tif);\n\t\tTIFFGetFieldDefaulted(tif, TIFFTAG_ROWSPERSTRIP,\n\t\t    &tf_rowsperstrip);\n\t\tsetupPageState(tif, &w, &h, &prw, &prh);\n                if (pw != 0) {\n                    psw = pw * PS_UNIT_SIZE;\n\t\t    if (res_unit == RESUNIT_CENTIMETER)\n\t\t\tpsw *= 2.54F;\n\t\t}\n                else\n                  psw = prw;\n\n                if (ph != 0) {\n                    psh = ph * PS_UNIT_SIZE;\n \t\t    if (res_unit == RESUNIT_CENTIMETER)\n\t\t\tpsh *= 2.54F;\n\t\t}\n                else\n                  psh = prh;\n\n                /* auto rotate for best fit */\n                if (rotate && rotation == 0) {\n                  maxsource = (prw >= prh) ? prw : prh;\n                  maxtarget = (psw >= psh) ? psw : psh;\n                  if (((maxsource == prw) && (maxtarget != psw)) ||\n                      ((maxsource == prh) && (maxtarget != psh))) {\n\t\t    rotation = 90;\n\t\t  } \n\t\t}\n\n                /* scaling depends on rotation and new page size */\n                switch (rotation) {\n                  case   0:  \n                  case 180:\n                    xscale = (psw - left_offset)/prw;\n                    yscale = (psh - bottom_offset)/prh;\n\t\t    if (!npages)\n\t\t      PSHead(fd, tif, w, h, psw, psh, ox, oy);\n                    break;\n\t\t  case  90:\n                  case 270:\n                    xscale = (psw - bottom_offset) /prh;\n                    yscale = (psh - left_offset) /prw;\n\t\t    if (!npages)\n\t\t      PSHead(fd, tif, w, h, psh, psw, oy, ox);\n                    break;\n\t\t}\n\t\tTIFFGetFieldDefaulted(tif, TIFFTAG_BITSPERSAMPLE,\n\t\t    &bitspersample);\n\t\tTIFFGetFieldDefaulted(tif, TIFFTAG_SAMPLESPERPIXEL,\n\t\t    &samplesperpixel);\n\t\tTIFFGetFieldDefaulted(tif, TIFFTAG_PLANARCONFIG,\n\t\t    &planarconfiguration);\n\t\tTIFFGetField(tif, TIFFTAG_COMPRESSION, &compression);\n\t\tTIFFGetFieldDefaulted(tif, TIFFTAG_EXTRASAMPLES,\n\t\t    &extrasamples, &sampleinfo);\n\t\talpha = (extrasamples == 1 &&\n\t\t\t sampleinfo[0] == EXTRASAMPLE_ASSOCALPHA);\n\t\tif (!TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &photometric)) {\n\t\t\tswitch (samplesperpixel - extrasamples) {\n\t\t\tcase 1:\n\t\t\t\tif (isCCITTCompression(tif))\n\t\t\t\t\tphotometric = PHOTOMETRIC_MINISWHITE;\n\t\t\t\telse\n\t\t\t\t\tphotometric = PHOTOMETRIC_MINISBLACK;\n\t\t\t\tbreak;\n\t\t\tcase 3:\n\t\t\t\tphotometric = PHOTOMETRIC_RGB;\n\t\t\t\tbreak;\n\t\t\tcase 4:\n\t\t\t\tphotometric = PHOTOMETRIC_SEPARATED;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (checkImage(tif)) {\n\t\t\ttf_bytesperrow = TIFFScanlineSize(tif);\n\t\t\tnpages++;\n\t\t\tfprintf(fd, \"%%%%Page: %d %d\\n\", npages, npages);\n\t\t\tif (!generateEPSF && ( level2 || level3 )) {\n\t\t\t\tfprintf(fd,\n\t\"1 dict begin /PageSize [ %f %f ] def currentdict end setpagedevice\\n\",\n\t\t\t\t\tpsw, psh);\n\t\t\t\tfputs(\n\t\"<<\\n  /Policies <<\\n    /PageSize 3\\n  >>\\n>> setpagedevice\\n\",\n\t\t\t\t      fd);\n\t\t\t}\n\t\t\tfprintf(fd, \"gsave\\n\");\n\t\t\tfprintf(fd, \"100 dict begin\\n\");\n                        /* N.B. Setting maxPageHeight also sets ph if not set explicitly */\n\t\t\tif (pw != 0 || ph != 0) {\n\t\t\t\tif (maxPageHeight || maxPageWidth)  { /* used -H or -W options */\n\t\t\t\t  split = PlaceImage(tif,fd,&npages,w,h,pw,ph,prw,prh,\n\t\t\t\t     0,lm,bm,cnt);\n\t\t\t\t\twhile( split ) {\n\t\t\t\t\t    PSpage(fd, tif, w, h);\n\t\t\t\t\t    fprintf(fd, \"end\\n\");\n\t\t\t\t\t    fprintf(fd, \"grestore\\n\");\n\t\t\t\t\t    fprintf(fd, \"showpage\\n\");\n\t\t\t\t\t    npages++;\n\t\t\t\t\t    fprintf(fd, \"%%%%Page: %d %d\\n\",\n\t\t\t\t\t\t    npages, npages);\n\t\t\t\t\t    fprintf(fd, \"gsave\\n\");\n\t\t\t\t\t    fprintf(fd, \"100 dict begin\\n\");\n\t\t\t\t\t    split = PlaceImage(tif,fd,&npages,w,h,pw,ph,prw,prh,\n\t\t\t\t\t\tsplit,lm,bm,cnt);\n\t\t\t\t\t}\n\t\t\t\t} \n                                else {\n\t\t\t\t    /* NB: maintain image aspect ratio */\n                                    scale = (xscale < yscale) ? xscale : yscale; \n\t\t\t\t    if (scale > 1.0)\n\t\t\t\t       \tscale = 1.0;\n\n                                    /* Adjust offsets for centering */\n\t\t\t\t    if (cnt) {\n                                      switch (rotation) {\n\t\t\t\t\tcase   90:\n                                        case  270:\n\t\t\t\t\t    hcenter = (psw - prh * scale) / 2;\n\t\t\t\t\t    vcenter = (psh - prw * scale) / 2;\n                                            break;\n\t\t\t\t\tcase    0:\n                                        case  180:\n\t\t\t\t\tdefault:\n\t\t\t\t\t    hcenter = (psw - prw * scale) / 2;\n\t\t\t\t\t    vcenter = (psh - prh * scale) / 2;\n                                            break;\n\t\t\t\t      }\n\t\t\t\t    }\n\t\t\t\t  else \n                                      hcenter = 0.0, vcenter = 0.0;\n                                  if (cnt)\n  \t\t\t\t     fprintf (fd, \"%f %f translate\\n\", hcenter, vcenter);\n                                  switch (rotation) {\n \t\t\t\t    case 0:\n\t\t\t\t        fprintf (fd, \"%f %f scale\\n\", prw * scale, prh * scale);\n                                        break;\n \t\t\t       \t    case 90:\n\t\t\t\t\tfprintf (fd, \"%f %f scale\\n1 0 translate 90 rotate\\n\", prh * scale, prw * scale);\n                                        break;\n                                    case 180:\n\t\t\t\t\tfprintf (fd, \"%f %f scale\\n1 1 translate 180 rotate\\n\", prw * scale, prh * scale);\n\t\t\t\t\tbreak;\n\t\t\t\t    case 270:\n\t\t\t\t\tfprintf (fd, \"%f %f scale\\n0 1 translate 270 rotate\\n\", prh * scale, prw * scale);\n\t\t\t\t        break;\n\t\t\t            default:\n\t\t\t                fprintf (stderr, \"Unsupported angle. No rotation\\n\");\n\t\t\t\t\tfprintf (fd, \"%f %f scale\\n\", prw * scale, prh * scale);\n                                        break;\n\t\t\t\t  }\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t    if (rotate)\n                              {\n\t\t\t      /* Width and height have already been enchanged for 90/270 rotations */\n\t\t\t      switch (rotation) {\n\t\t\t         case   0:\n\t\t\t             fprintf (fd, \"%f %f scale\\n\", prw, prh);\n\t\t\t\t case  90:\n\t\t\t\t     fprintf (fd, \"%f %f scale\\n1 0 translate 90 rotate\\n\", prw, prh); \n                                     break;\n                                 case 180:\n\t\t\t             fprintf (fd, \"%f %f scale\\n1 1 translate 180 rotate\\n\", prw, prh);\n                                     break;\n\t\t\t         case 270:\n\t\t\t\t     fprintf (fd, \"%f %f scale\\n0 1 translate 270 rotate\\n\", prw, prh); \n                                     break;\n\t\t\t         default:\n\t\t\t             fprintf (stderr, \"Unsupported angle. No rotation\\n\");\n\t\t\t             fprintf( fd, \"%f %f scale\\n\", prw, prh);\n                                     break;\n\t\t\t         }\n\t\t\t      }\n                            else\n\t\t\t      {\n\t\t\t      /* fprintf (stderr, \"No rotation\\n\"); */\n\t\t\t      fprintf (fd, \"%f %f scale\\n\", prw, prh);\n\t\t\t      }\n\t\t\t}\n\t\t\tPSpage(fd, tif, w, h);\n\t\t\tfprintf(fd, \"end\\n\");\n\t\t\tfprintf(fd, \"grestore\\n\");\n\t\t\tfprintf(fd, \"showpage\\n\");\n\t\t}\n\t\tif (generateEPSF)\n\t\t\tbreak;\n\t\tTIFFGetFieldDefaulted(tif, TIFFTAG_SUBFILETYPE, &subfiletype);\n\t} while (((subfiletype & FILETYPE_PAGE) || printAll) &&\n\t    TIFFReadDirectory(tif));\n\n\treturn(npages);\n}\n\nstatic char DuplexPreamble[] = \"\\\n%%BeginFeature: *Duplex True\\n\\\nsystemdict begin\\n\\\n  /languagelevel where { pop languagelevel } { 1 } ifelse\\n\\\n  2 ge { 1 dict dup /Duplex true put setpagedevice }\\n\\\n  { statusdict /setduplex known { statusdict begin setduplex true end } if\\n\\\n  } ifelse\\n\\\nend\\n\\\n%%EndFeature\\n\\\n\";\n\nstatic char TumblePreamble[] = \"\\\n%%BeginFeature: *Tumble True\\n\\\nsystemdict begin\\n\\\n  /languagelevel where { pop languagelevel } { 1 } ifelse\\n\\\n  2 ge { 1 dict dup /Tumble true put setpagedevice }\\n\\\n  { statusdict /settumble known { statusdict begin true settumble end } if\\n\\\n  } ifelse\\n\\\nend\\n\\\n%%EndFeature\\n\\\n\";\n\nstatic char AvoidDeadZonePreamble[] = \"\\\ngsave newpath clippath pathbbox grestore\\n\\\n  4 2 roll 2 copy translate\\n\\\n  exch 3 1 roll sub 3 1 roll sub exch\\n\\\n  currentpagedevice /PageSize get aload pop\\n\\\n  exch 3 1 roll div 3 1 roll div abs exch abs\\n\\\n  2 copy gt { exch } if pop\\n\\\n  dup 1 lt { dup scale } { pop } ifelse\\n\\\n\";\n\nvoid\nPSHead(FILE *fd, TIFF *tif, uint32 w, uint32 h,\n       double pw, double ph, double ox, double oy)\n{\n\ttime_t t;\n\n\t(void) tif; (void) w; (void) h;\n\tt = time(0);\n\tfprintf(fd, \"%%!PS-Adobe-3.0%s\\n\", generateEPSF ? \" EPSF-3.0\" : \"\");\n\tfprintf(fd, \"%%%%Creator: tiff2ps\\n\");\n\tfprintf(fd, \"%%%%Title: %s\\n\", filename);\n\tfprintf(fd, \"%%%%CreationDate: %s\", ctime(&t));\n\tfprintf(fd, \"%%%%DocumentData: Clean7Bit\\n\");\n\tfprintf(fd, \"%%%%Origin: %ld %ld\\n\", (long) ox, (long) oy);\n\t/* NB: should use PageBoundingBox */\n        if (rotate && (rotation == 90 || rotation == 270))\n \t  fprintf(fd, \"%%%%BoundingBox: 0 0 %ld %ld\\n\",\n\t    (long) ceil(ph), (long) ceil(pw));\n        else\n          fprintf(fd, \"%%%%BoundingBox: 0 0 %ld %ld\\n\",\n\t    (long) ceil(pw), (long) ceil(ph));         \n\n\tfprintf(fd, \"%%%%LanguageLevel: %d\\n\", (level3 ? 3 : (level2 ? 2 : 1)));\n\tfprintf(fd, \"%%%%Pages: (atend)\\n\");\n\tfprintf(fd, \"%%%%EndComments\\n\");\n\tfprintf(fd, \"%%%%BeginSetup\\n\");\n\tif (PSduplex)\n\t\tfprintf(fd, \"%s\", DuplexPreamble);\n\tif (PStumble)\n\t\tfprintf(fd, \"%s\", TumblePreamble);\n\tif (PSavoiddeadzone && (level2 || level3))\n\t\tfprintf(fd, \"%s\", AvoidDeadZonePreamble);\n\tfprintf(fd, \"%%%%EndSetup\\n\");\n}\n\nvoid\nPSTail(FILE *fd, int npages)\n{\n\tfprintf(fd, \"%%%%Trailer\\n\");\n\tfprintf(fd, \"%%%%Pages: %d\\n\", npages);\n\tfprintf(fd, \"%%%%EOF\\n\");\n}\n\nstatic int\ncheckcmap(TIFF* tif, int n, uint16* r, uint16* g, uint16* b)\n{\n\t(void) tif;\n\twhile (n-- > 0)\n\t\tif (*r++ >= 256 || *g++ >= 256 || *b++ >= 256)\n\t\t\treturn (16);\n\tTIFFWarning(filename, \"Assuming 8-bit colormap\");\n\treturn (8);\n}\n\nstatic void\nPS_Lvl2colorspace(FILE* fd, TIFF* tif)\n{\n\tuint16 *rmap, *gmap, *bmap;\n\tint i, num_colors;\n\tconst char * colorspace_p;\n\n\tswitch ( photometric )\n\t{\n\tcase PHOTOMETRIC_SEPARATED:\n\t\tcolorspace_p = \"CMYK\";\n\t\tbreak;\n\n\tcase PHOTOMETRIC_RGB:\n\t\tcolorspace_p = \"RGB\";\n\t\tbreak;\n\n\tdefault:\n\t\tcolorspace_p = \"Gray\";\n\t}\n\n\t/*\n\t * Set up PostScript Level 2 colorspace according to\n\t * section 4.8 in the PostScript refenence manual.\n\t */\n\tfputs(\"% PostScript Level 2 only.\\n\", fd);\n\tif (photometric != PHOTOMETRIC_PALETTE) {\n\t\tif (photometric == PHOTOMETRIC_YCBCR) {\n\t\t    /* MORE CODE HERE */\n\t\t}\n\t\tfprintf(fd, \"/Device%s setcolorspace\\n\", colorspace_p );\n\t\treturn;\n\t}\n\n\t/*\n\t * Set up an indexed/palette colorspace\n\t */\n\tnum_colors = (1 << bitspersample);\n\tif (!TIFFGetField(tif, TIFFTAG_COLORMAP, &rmap, &gmap, &bmap)) {\n\t\tTIFFError(filename,\n\t\t\t\"Palette image w/o \\\"Colormap\\\" tag\");\n\t\treturn;\n\t}\n\tif (checkcmap(tif, num_colors, rmap, gmap, bmap) == 16) {\n\t\t/*\n\t\t * Convert colormap to 8-bits values.\n\t\t */\n#define\tCVT(x)\t\t(((x) * 255) / ((1L<<16)-1))\n\t\tfor (i = 0; i < num_colors; i++) {\n\t\t\trmap[i] = CVT(rmap[i]);\n\t\t\tgmap[i] = CVT(gmap[i]);\n\t\t\tbmap[i] = CVT(bmap[i]);\n\t\t}\n#undef CVT\n\t}\n\tfprintf(fd, \"[ /Indexed /DeviceRGB %d\", num_colors - 1);\n\tif (ascii85) {\n\t\tAscii85Init();\n\t\tfputs(\"\\n<~\", fd);\n\t\tascii85breaklen -= 2;\n\t} else\n\t\tfputs(\" <\", fd);\n\tfor (i = 0; i < num_colors; i++) {\n\t\tif (ascii85) {\n\t\t\tAscii85Put((unsigned char)rmap[i], fd);\n\t\t\tAscii85Put((unsigned char)gmap[i], fd);\n\t\t\tAscii85Put((unsigned char)bmap[i], fd);\n\t\t} else {\n\t\t\tfputs((i % 8) ? \" \" : \"\\n  \", fd);\n\t\t\tfprintf(fd, \"%02x%02x%02x\",\n\t\t\t    rmap[i], gmap[i], bmap[i]);\n\t\t}\n\t}\n\tif (ascii85)\n\t\tAscii85Flush(fd);\n\telse\n\t\tfputs(\">\\n\", fd);\n\tfputs(\"] setcolorspace\\n\", fd);\n}\n\nstatic int\nPS_Lvl2ImageDict(FILE* fd, TIFF* tif, uint32 w, uint32 h)\n{\n\tint use_rawdata;\n\tuint32 tile_width, tile_height;\n\tuint16 predictor, minsamplevalue, maxsamplevalue;\n\tint repeat_count;\n\tchar im_h[64], im_x[64], im_y[64];\n\tchar * imageOp = \"image\";\n\n\tif ( useImagemask && (bitspersample == 1) )\n\t\timageOp = \"imagemask\";\n\n\t(void)strcpy(im_x, \"0\");\n\t(void)sprintf(im_y, \"%lu\", (long) h);\n\t(void)sprintf(im_h, \"%lu\", (long) h);\n\ttile_width = w;\n\ttile_height = h;\n\tif (TIFFIsTiled(tif)) {\n\t\trepeat_count = TIFFNumberOfTiles(tif);\n\t\tTIFFGetField(tif, TIFFTAG_TILEWIDTH, &tile_width);\n\t\tTIFFGetField(tif, TIFFTAG_TILELENGTH, &tile_height);\n\t\tif (tile_width > w || tile_height > h ||\n\t\t    (w % tile_width) != 0 || (h % tile_height != 0)) {\n\t\t\t/*\n\t\t\t * The tiles does not fit image width and height.\n\t\t\t * Set up a clip rectangle for the image unit square.\n\t\t\t */\n\t\t\tfputs(\"0 0 1 1 rectclip\\n\", fd);\n\t\t}\n\t\tif (tile_width < w) {\n\t\t\tfputs(\"/im_x 0 def\\n\", fd);\n\t\t\t(void)strcpy(im_x, \"im_x neg\");\n\t\t}\n\t\tif (tile_height < h) {\n\t\t\tfputs(\"/im_y 0 def\\n\", fd);\n\t\t\t(void)sprintf(im_y, \"%lu im_y sub\", (unsigned long) h);\n\t\t}\n\t} else {\n\t\trepeat_count = tf_numberstrips;\n\t\ttile_height = tf_rowsperstrip;\n\t\tif (tile_height > h)\n\t\t\ttile_height = h;\n\t\tif (repeat_count > 1) {\n\t\t\tfputs(\"/im_y 0 def\\n\", fd);\n\t\t\tfprintf(fd, \"/im_h %lu def\\n\",\n\t\t\t    (unsigned long) tile_height);\n\t\t\t(void)strcpy(im_h, \"im_h\");\n\t\t\t(void)sprintf(im_y, \"%lu im_y sub\", (unsigned long) h);\n\t\t}\n\t}\n\n\t/*\n\t * Output start of exec block\n\t */\n\tfputs(\"{ % exec\\n\", fd);\n\n\tif (repeat_count > 1)\n\t\tfprintf(fd, \"%d { %% repeat\\n\", repeat_count);\n\n\t/*\n\t * Output filter options and image dictionary.\n\t */\n\tif (ascii85)\n\t\tfputs(\" /im_stream currentfile /ASCII85Decode filter def\\n\",\n\t\t    fd);\n\tfputs(\" <<\\n\", fd);\n\tfputs(\"  /ImageType 1\\n\", fd);\n\tfprintf(fd, \"  /Width %lu\\n\", (unsigned long) tile_width);\n\t/*\n\t * Workaround for some software that may crash when last strip\n\t * of image contains fewer number of scanlines than specified\n\t * by the `/Height' variable. So for stripped images with multiple\n\t * strips we will set `/Height' as `im_h', because one is \n\t * recalculated for each strip - including the (smaller) final strip.\n\t * For tiled images and images with only one strip `/Height' will\n\t * contain number of scanlines in tile (or image height in case of\n\t * one-stripped image).\n\t */\n\tif (TIFFIsTiled(tif) || tf_numberstrips == 1)\n\t\tfprintf(fd, \"  /Height %lu\\n\", (unsigned long) tile_height);\n\telse\n\t\tfprintf(fd, \"  /Height im_h\\n\");\n\t\n\tif (planarconfiguration == PLANARCONFIG_SEPARATE && samplesperpixel > 1)\n\t\tfputs(\"  /MultipleDataSources true\\n\", fd);\n\tfprintf(fd, \"  /ImageMatrix [ %lu 0 0 %ld %s %s ]\\n\",\n\t    (unsigned long) w, - (long)h, im_x, im_y);\n\tfprintf(fd, \"  /BitsPerComponent %d\\n\", bitspersample);\n\tfprintf(fd, \"  /Interpolate %s\\n\", interpolate ? \"true\" : \"false\");\n\n\tswitch (samplesperpixel - extrasamples) {\n\tcase 1:\n\t\tswitch (photometric) {\n\t\tcase PHOTOMETRIC_MINISBLACK:\n\t\t\tfputs(\"  /Decode [0 1]\\n\", fd);\n\t\t\tbreak;\n\t\tcase PHOTOMETRIC_MINISWHITE:\n\t\t\tswitch (compression) {\n\t\t\tcase COMPRESSION_CCITTRLE:\n\t\t\tcase COMPRESSION_CCITTRLEW:\n\t\t\tcase COMPRESSION_CCITTFAX3:\n\t\t\tcase COMPRESSION_CCITTFAX4:\n\t\t\t\t/*\n\t\t\t\t * Manage inverting with /Blackis1 flag\n\t\t\t\t * since there migth be uncompressed parts\n\t\t\t\t */\n\t\t\t\tfputs(\"  /Decode [0 1]\\n\", fd);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\t/*\n\t\t\t\t * ERROR...\n\t\t\t\t */\n\t\t\t\tfputs(\"  /Decode [1 0]\\n\", fd);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase PHOTOMETRIC_PALETTE:\n\t\t\tTIFFGetFieldDefaulted(tif, TIFFTAG_MINSAMPLEVALUE,\n\t\t\t    &minsamplevalue);\n\t\t\tTIFFGetFieldDefaulted(tif, TIFFTAG_MAXSAMPLEVALUE,\n\t\t\t    &maxsamplevalue);\n\t\t\tfprintf(fd, \"  /Decode [%u %u]\\n\",\n\t\t\t\t    minsamplevalue, maxsamplevalue);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\t/*\n\t\t\t * ERROR ?\n\t\t\t */\n\t\t\tfputs(\"  /Decode [0 1]\\n\", fd);\n\t\t\tbreak;\n\t\t}\n\t\tbreak;\n\tcase 3:\n\t\tswitch (photometric) {\n\t\tcase PHOTOMETRIC_RGB:\n\t\t\tfputs(\"  /Decode [0 1 0 1 0 1]\\n\", fd);\n\t\t\tbreak;\n\t\tcase PHOTOMETRIC_MINISWHITE:\n\t\tcase PHOTOMETRIC_MINISBLACK:\n\t\tdefault:\n\t\t\t/*\n\t\t\t * ERROR??\n\t\t\t */\n\t\t\tfputs(\"  /Decode [0 1 0 1 0 1]\\n\", fd);\n\t\t\tbreak;\n\t\t}\n\t\tbreak;\n\tcase 4:\n\t\t/*\n\t\t * ERROR??\n\t\t */\n\t\tfputs(\"  /Decode [0 1 0 1 0 1 0 1]\\n\", fd);\n\t\tbreak;\n\t}\n\tfputs(\"  /DataSource\", fd);\n\tif (planarconfiguration == PLANARCONFIG_SEPARATE &&\n\t    samplesperpixel > 1)\n\t\tfputs(\" [\", fd);\n\tif (ascii85)\n\t\tfputs(\" im_stream\", fd);\n\telse\n\t\tfputs(\" currentfile /ASCIIHexDecode filter\", fd);\n\n\tuse_rawdata = TRUE;\n\tswitch (compression) {\n\tcase COMPRESSION_NONE:\t\t/* 1: uncompressed */\n\t\tbreak;\n\tcase COMPRESSION_CCITTRLE:\t/* 2: CCITT modified Huffman RLE */\n\tcase COMPRESSION_CCITTRLEW:\t/* 32771: #1 w/ word alignment */\n\tcase COMPRESSION_CCITTFAX3:\t/* 3: CCITT Group 3 fax encoding */\n\tcase COMPRESSION_CCITTFAX4:\t/* 4: CCITT Group 4 fax encoding */\n\t\tfputs(\"\\n\\t<<\\n\", fd);\n\t\tif (compression == COMPRESSION_CCITTFAX3) {\n\t\t\tuint32 g3_options;\n\n\t\t\tfputs(\"\\t /EndOfLine true\\n\", fd);\n\t\t\tfputs(\"\\t /EndOfBlock false\\n\", fd);\n\t\t\tif (!TIFFGetField(tif, TIFFTAG_GROUP3OPTIONS,\n\t\t\t\t\t    &g3_options))\n\t\t\t\tg3_options = 0;\n\t\t\tif (g3_options & GROUP3OPT_2DENCODING)\n\t\t\t\tfprintf(fd, \"\\t /K %s\\n\", im_h);\n\t\t\tif (g3_options & GROUP3OPT_UNCOMPRESSED)\n\t\t\t\tfputs(\"\\t /Uncompressed true\\n\", fd);\n\t\t\tif (g3_options & GROUP3OPT_FILLBITS)\n\t\t\t\tfputs(\"\\t /EncodedByteAlign true\\n\", fd);\n\t\t}\n\t\tif (compression == COMPRESSION_CCITTFAX4) {\n\t\t\tuint32 g4_options;\n\n\t\t\tfputs(\"\\t /K -1\\n\", fd);\n\t\t\tTIFFGetFieldDefaulted(tif, TIFFTAG_GROUP4OPTIONS,\n\t\t\t\t\t       &g4_options);\n\t\t\tif (g4_options & GROUP4OPT_UNCOMPRESSED)\n\t\t\t\tfputs(\"\\t /Uncompressed true\\n\", fd);\n\t\t}\n\t\tif (!(tile_width == w && w == 1728U))\n\t\t\tfprintf(fd, \"\\t /Columns %lu\\n\",\n\t\t\t    (unsigned long) tile_width);\n\t\tfprintf(fd, \"\\t /Rows %s\\n\", im_h);\n\t\tif (compression == COMPRESSION_CCITTRLE ||\n\t\t    compression == COMPRESSION_CCITTRLEW) {\n\t\t\tfputs(\"\\t /EncodedByteAlign true\\n\", fd);\n\t\t\tfputs(\"\\t /EndOfBlock false\\n\", fd);\n\t\t}\n\t\tif (photometric == PHOTOMETRIC_MINISBLACK)\n\t\t\tfputs(\"\\t /BlackIs1 true\\n\", fd);\n\t\tfprintf(fd, \"\\t>> /CCITTFaxDecode filter\");\n\t\tbreak;\n\tcase COMPRESSION_LZW:\t/* 5: Lempel-Ziv & Welch */\n\t\tTIFFGetFieldDefaulted(tif, TIFFTAG_PREDICTOR, &predictor);\n\t\tif (predictor == 2) {\n\t\t\tfputs(\"\\n\\t<<\\n\", fd);\n\t\t\tfprintf(fd, \"\\t /Predictor %u\\n\", predictor);\n\t\t\tfprintf(fd, \"\\t /Columns %lu\\n\",\n\t\t\t    (unsigned long) tile_width);\n\t\t\tfprintf(fd, \"\\t /Colors %u\\n\", samplesperpixel);\n\t\t\tfprintf(fd, \"\\t /BitsPerComponent %u\\n\",\n\t\t\t    bitspersample);\n\t\t\tfputs(\"\\t>>\", fd);\n\t\t}\n\t\tfputs(\" /LZWDecode filter\", fd);\n\t\tbreak;\n\tcase COMPRESSION_DEFLATE:\t/* 5: ZIP */\n\tcase COMPRESSION_ADOBE_DEFLATE:\n\t\tif ( level3 ) {\n\t\t\t TIFFGetFieldDefaulted(tif, TIFFTAG_PREDICTOR, &predictor);\n\t\t\t if (predictor > 1) {\n\t\t\t\tfprintf(fd, \"\\t %% PostScript Level 3 only.\");\n\t\t\t\tfputs(\"\\n\\t<<\\n\", fd);\n\t\t\t\tfprintf(fd, \"\\t /Predictor %u\\n\", predictor);\n\t\t\t\tfprintf(fd, \"\\t /Columns %lu\\n\",\n\t\t\t\t\t(unsigned long) tile_width);\n\t\t\t\tfprintf(fd, \"\\t /Colors %u\\n\", samplesperpixel);\n\t\t\t\t\tfprintf(fd, \"\\t /BitsPerComponent %u\\n\",\n\t\t\t\t\tbitspersample);\n\t\t\t\tfputs(\"\\t>>\", fd);\n\t\t\t }\n\t\t\t fputs(\" /FlateDecode filter\", fd);\n\t\t} else {\n\t\t\tuse_rawdata = FALSE ;\n\t\t}\n\t\tbreak;\n\tcase COMPRESSION_PACKBITS:\t/* 32773: Macintosh RLE */\n\t\tfputs(\" /RunLengthDecode filter\", fd);\n\t\tuse_rawdata = TRUE;\n\t    break;\n\tcase COMPRESSION_OJPEG:\t\t/* 6: !6.0 JPEG */\n\tcase COMPRESSION_JPEG:\t\t/* 7: %JPEG DCT compression */\n#ifdef notdef\n\t\t/*\n\t\t * Code not tested yet\n\t\t */\n\t\tfputs(\" /DCTDecode filter\", fd);\n\t\tuse_rawdata = TRUE;\n#else\n\t\tuse_rawdata = FALSE;\n#endif\n\t\tbreak;\n\tcase COMPRESSION_NEXT:\t\t/* 32766: NeXT 2-bit RLE */\n\tcase COMPRESSION_THUNDERSCAN:\t/* 32809: ThunderScan RLE */\n\tcase COMPRESSION_PIXARFILM:\t/* 32908: Pixar companded 10bit LZW */\n\tcase COMPRESSION_JBIG:\t\t/* 34661: ISO JBIG */\n\t\tuse_rawdata = FALSE;\n\t\tbreak;\n\tcase COMPRESSION_SGILOG:\t/* 34676: SGI LogL or LogLuv */\n\tcase COMPRESSION_SGILOG24:\t/* 34677: SGI 24-bit LogLuv */\n\t\tuse_rawdata = FALSE;\n\t\tbreak;\n\tdefault:\n\t\t/*\n\t\t * ERROR...\n\t\t */\n\t\tuse_rawdata = FALSE;\n\t\tbreak;\n\t}\n\tif (planarconfiguration == PLANARCONFIG_SEPARATE &&\n\t    samplesperpixel > 1) {\n\t\tuint16 i;\n\n\t\t/*\n\t\t * NOTE: This code does not work yet...\n\t\t */\n\t\tfor (i = 1; i < samplesperpixel; i++)\n\t\t\tfputs(\" dup\", fd);\n\t\tfputs(\" ]\", fd);\n\t}\n\n\tfprintf( fd, \"\\n >> %s\\n\", imageOp );\n\tif (ascii85)\n\t\tfputs(\" im_stream status { im_stream flushfile } if\\n\", fd);\n\tif (repeat_count > 1) {\n\t\tif (tile_width < w) {\n\t\t\tfprintf(fd, \" /im_x im_x %lu add def\\n\",\n\t\t\t    (unsigned long) tile_width);\n\t\t\tif (tile_height < h) {\n\t\t\t\tfprintf(fd, \" im_x %lu ge {\\n\",\n\t\t\t\t    (unsigned long) w);\n\t\t\t\tfputs(\"  /im_x 0 def\\n\", fd);\n\t\t\t\tfprintf(fd, \" /im_y im_y %lu add def\\n\",\n\t\t\t\t    (unsigned long) tile_height);\n\t\t\t\tfputs(\" } if\\n\", fd);\n\t\t\t}\n\t\t}\n\t\tif (tile_height < h) {\n\t\t\tif (tile_width >= w) {\n\t\t\t\tfprintf(fd, \" /im_y im_y %lu add def\\n\",\n\t\t\t\t    (unsigned long) tile_height);\n\t\t\t\tif (!TIFFIsTiled(tif)) {\n\t\t\t\t\tfprintf(fd, \" /im_h %lu im_y sub\",\n\t\t\t\t\t    (unsigned long) h);\n\t\t\t\t\tfprintf(fd, \" dup %lu gt { pop\",\n\t\t\t\t\t    (unsigned long) tile_height);\n\t\t\t\t\tfprintf(fd, \" %lu } if def\\n\",\n\t\t\t\t\t    (unsigned long) tile_height);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfputs(\"} repeat\\n\", fd);\n\t}\n\t/*\n\t * End of exec function\n\t */\n\tfputs(\"}\\n\", fd);\n\n\treturn(use_rawdata);\n}\n\n/* Flip the byte order of buffers with 16 bit samples */\nstatic void\nPS_FlipBytes(unsigned char* buf, int count)\n{\n\tint i;\n\tunsigned char temp;\n\n\tif (count <= 0 || bitspersample <= 8) {\n\t\treturn;\n\t}\n\n\tcount--;\n\n\tfor (i = 0; i < count; i += 2) {\n\t\ttemp = buf[i];\n\t\tbuf[i] = buf[i + 1];\n\t\tbuf[i + 1] = temp;\n\t}\n}\n\n#define MAXLINE\t\t36\n\nint\nPS_Lvl2page(FILE* fd, TIFF* tif, uint32 w, uint32 h)\n{\n\tuint16 fillorder;\n\tint use_rawdata, tiled_image, breaklen = MAXLINE;\n\tuint32 chunk_no, num_chunks, *bc;\n\tunsigned char *buf_data, *cp;\n\ttsize_t chunk_size, byte_count;\n\n#if defined( EXP_ASCII85ENCODER )\n\tint\t\t\tascii85_l;\t/* Length, in bytes, of ascii85_p[] data */\n\tuint8\t\t*\tascii85_p = 0;\t/* Holds ASCII85 encoded data */\n#endif\n\n\tPS_Lvl2colorspace(fd, tif);\n\tuse_rawdata = PS_Lvl2ImageDict(fd, tif, w, h);\n\n/* See http://bugzilla.remotesensing.org/show_bug.cgi?id=80 */\n#ifdef ENABLE_BROKEN_BEGINENDDATA\n\tfputs(\"%%BeginData:\\n\", fd);\n#endif\n\tfputs(\"exec\\n\", fd);\n\n\ttiled_image = TIFFIsTiled(tif);\n\tif (tiled_image) {\n\t\tnum_chunks = TIFFNumberOfTiles(tif);\n\t\tTIFFGetField(tif, TIFFTAG_TILEBYTECOUNTS, &bc);\n\t} else {\n\t\tnum_chunks = TIFFNumberOfStrips(tif);\n\t\tTIFFGetField(tif, TIFFTAG_STRIPBYTECOUNTS, &bc);\n\t}\n\n\tif (use_rawdata) {\n\t\tchunk_size = (tsize_t) bc[0];\n\t\tfor (chunk_no = 1; chunk_no < num_chunks; chunk_no++)\n\t\t\tif ((tsize_t) bc[chunk_no] > chunk_size)\n\t\t\t\tchunk_size = (tsize_t) bc[chunk_no];\n\t} else {\n\t\tif (tiled_image)\n\t\t\tchunk_size = TIFFTileSize(tif);\n\t\telse\n\t\t\tchunk_size = TIFFStripSize(tif);\n\t}\n\tbuf_data = (unsigned char *)_TIFFmalloc(chunk_size);\n\tif (!buf_data) {\n\t\tTIFFError(filename, \"Can't alloc %u bytes for %s.\",\n\t\t\tchunk_size, tiled_image ? \"tiles\" : \"strips\");\n\t\treturn(FALSE);\n\t}\n\n#if defined( EXP_ASCII85ENCODER )\n\tif ( ascii85 ) {\n\t    /*\n\t     * Allocate a buffer to hold the ASCII85 encoded data.  Note\n\t     * that it is allocated with sufficient room to hold the\n\t     * encoded data (5*chunk_size/4) plus the EOD marker (+8)\n\t     * and formatting line breaks.  The line breaks are more\n\t     * than taken care of by using 6*chunk_size/4 rather than\n\t     * 5*chunk_size/4.\n\t     */\n\n\t    ascii85_p = _TIFFmalloc( (chunk_size+(chunk_size/2)) + 8 );\n\n\t    if ( !ascii85_p ) {\n\t\t_TIFFfree( buf_data );\n\n\t\tTIFFError( filename, \"Cannot allocate ASCII85 encoding buffer.\" );\n\t\treturn ( FALSE );\n\t    }\n\t}\n#endif\n\n\tTIFFGetFieldDefaulted(tif, TIFFTAG_FILLORDER, &fillorder);\n\tfor (chunk_no = 0; chunk_no < num_chunks; chunk_no++) {\n\t\tif (ascii85)\n\t\t\tAscii85Init();\n\t\telse\n\t\t\tbreaklen = MAXLINE;\n\t\tif (use_rawdata) {\n\t\t\tif (tiled_image)\n\t\t\t\tbyte_count = TIFFReadRawTile(tif, chunk_no,\n\t\t\t\t\t\t  buf_data, chunk_size);\n\t\t\telse\n\t\t\t\tbyte_count = TIFFReadRawStrip(tif, chunk_no,\n\t\t\t\t\t\t  buf_data, chunk_size);\n\t\t\tif (fillorder == FILLORDER_LSB2MSB)\n\t\t\t    TIFFReverseBits(buf_data, byte_count);\n\t\t} else {\n\t\t\tif (tiled_image)\n\t\t\t\tbyte_count = TIFFReadEncodedTile(tif,\n\t\t\t\t\t\tchunk_no, buf_data,\n\t\t\t\t\t\tchunk_size);\n\t\t\telse\n\t\t\t\tbyte_count = TIFFReadEncodedStrip(tif,\n\t\t\t\t\t\tchunk_no, buf_data,\n\t\t\t\t\t\tchunk_size);\n\t\t}\n\t\tif (byte_count < 0) {\n\t\t\tTIFFError(filename, \"Can't read %s %d.\",\n\t\t\t\ttiled_image ? \"tile\" : \"strip\", chunk_no);\n\t\t\tif (ascii85)\n\t\t\t\tAscii85Put('\\0', fd);\n\t\t}\n\t\t/*\n\t\t * for 16 bits, the two bytes must be most significant\n\t\t * byte first\n\t\t */\n\t\tif (bitspersample == 16 && !TIFFIsBigEndian(tif)) {\n\t\t\tPS_FlipBytes(buf_data, byte_count);\n\t\t}\n\t\t/*\n\t\t * For images with alpha, matte against a white background;\n\t\t * i.e. Cback * (1 - Aimage) where Cback = 1. We will fill the\n\t\t * lower part of the buffer with the modified values.\n\t\t *\n\t\t * XXX: needs better solution\n\t\t */\n\t\tif (alpha) {\n\t\t\tint adjust, i, j = 0;\n\t\t\tint ncomps = samplesperpixel - extrasamples;\n\t\t\tfor (i = 0; i < byte_count; i+=samplesperpixel) {\n\t\t\t\tadjust = 255 - buf_data[i + ncomps];\n\t\t\t\tswitch (ncomps) {\n\t\t\t\t\tcase 1:\n\t\t\t\t\t\tbuf_data[j++] = buf_data[i] + adjust;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 2:\n\t\t\t\t\t\tbuf_data[j++] = buf_data[i] + adjust;\n\t\t\t\t\t\tbuf_data[j++] = buf_data[i+1] + adjust;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 3:\n\t\t\t\t\t\tbuf_data[j++] = buf_data[i] + adjust;\n\t\t\t\t\t\tbuf_data[j++] = buf_data[i+1] + adjust;\n\t\t\t\t\t\tbuf_data[j++] = buf_data[i+2] + adjust;\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tbyte_count -= j;\n\t\t}\n\n\t\tif (ascii85) {\n#if defined( EXP_ASCII85ENCODER )\n\t\t\tascii85_l = Ascii85EncodeBlock(ascii85_p, 1, buf_data, byte_count );\n\n\t\t\tif ( ascii85_l > 0 )\n\t\t\t\tfwrite( ascii85_p, ascii85_l, 1, fd );\n#else\n\t\t\tfor (cp = buf_data; byte_count > 0; byte_count--)\n\t\t\t\tAscii85Put(*cp++, fd);\n#endif\n\t\t}\n\t\telse\n\t\t{\n\t\t\tfor (cp = buf_data; byte_count > 0; byte_count--) {\n\t\t\t\tputc(hex[((*cp)>>4)&0xf], fd);\n\t\t\t\tputc(hex[(*cp)&0xf], fd);\n\t\t\t\tcp++;\n\n\t\t\t\tif (--breaklen <= 0) {\n\t\t\t\t\tputc('\\n', fd);\n\t\t\t\t\tbreaklen = MAXLINE;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif ( !ascii85 ) {\n\t\t\tif ( level2 || level3 )\n\t\t\t\tputc( '>', fd );\n\t\t\tputc('\\n', fd);\n\t\t}\n#if !defined( EXP_ASCII85ENCODER )\n\t\telse\n\t\t\tAscii85Flush(fd);\n#endif\n\t}\n\n#if defined( EXP_ASCII85ENCODER )\n\tif ( ascii85_p )\n\t    _TIFFfree( ascii85_p );\n#endif\n       \n\t_TIFFfree(buf_data);\n#ifdef ENABLE_BROKEN_BEGINENDDATA\n\tfputs(\"%%EndData\\n\", fd);\n#endif\n\treturn(TRUE);\n}\n\nvoid\nPSpage(FILE* fd, TIFF* tif, uint32 w, uint32 h)\n{\n\tchar\t*\timageOp = \"image\";\n\n\tif ( useImagemask && (bitspersample == 1) )\n\t\timageOp = \"imagemask\";\n\n\tif ((level2 || level3) && PS_Lvl2page(fd, tif, w, h))\n\t\treturn;\n\tps_bytesperrow = tf_bytesperrow - (extrasamples * bitspersample / 8)*w;\n\tswitch (photometric) {\n\tcase PHOTOMETRIC_RGB:\n\t\tif (planarconfiguration == PLANARCONFIG_CONTIG) {\n\t\t\tfprintf(fd, \"%s\", RGBcolorimage);\n\t\t\tPSColorContigPreamble(fd, w, h, 3);\n\t\t\tPSDataColorContig(fd, tif, w, h, 3);\n\t\t} else {\n\t\t\tPSColorSeparatePreamble(fd, w, h, 3);\n\t\t\tPSDataColorSeparate(fd, tif, w, h, 3);\n\t\t}\n\t\tbreak;\n\tcase PHOTOMETRIC_SEPARATED:\n\t\t/* XXX should emit CMYKcolorimage */\n\t\tif (planarconfiguration == PLANARCONFIG_CONTIG) {\n\t\t\tPSColorContigPreamble(fd, w, h, 4);\n\t\t\tPSDataColorContig(fd, tif, w, h, 4);\n\t\t} else {\n\t\t\tPSColorSeparatePreamble(fd, w, h, 4);\n\t\t\tPSDataColorSeparate(fd, tif, w, h, 4);\n\t\t}\n\t\tbreak;\n\tcase PHOTOMETRIC_PALETTE:\n\t\tfprintf(fd, \"%s\", RGBcolorimage);\n\t\tPhotoshopBanner(fd, w, h, 1, 3, \"false 3 colorimage\");\n\t\tfprintf(fd, \"/scanLine %ld string def\\n\",\n\t\t    (long) ps_bytesperrow * 3L);\n\t\tfprintf(fd, \"%lu %lu 8\\n\",\n\t\t    (unsigned long) w, (unsigned long) h);\n\t\tfprintf(fd, \"[%lu 0 0 -%lu 0 %lu]\\n\",\n\t\t    (unsigned long) w, (unsigned long) h, (unsigned long) h);\n\t\tfprintf(fd, \"{currentfile scanLine readhexstring pop} bind\\n\");\n\t\tfprintf(fd, \"false 3 colorimage\\n\");\n\t\tPSDataPalette(fd, tif, w, h);\n\t\tbreak;\n\tcase PHOTOMETRIC_MINISBLACK:\n\tcase PHOTOMETRIC_MINISWHITE:\n\t\tPhotoshopBanner(fd, w, h, 1, 1, imageOp);\n\t\tfprintf(fd, \"/scanLine %ld string def\\n\",\n\t\t    (long) ps_bytesperrow);\n\t\tfprintf(fd, \"%lu %lu %d\\n\",\n\t\t    (unsigned long) w, (unsigned long) h, bitspersample);\n\t\tfprintf(fd, \"[%lu 0 0 -%lu 0 %lu]\\n\",\n\t\t    (unsigned long) w, (unsigned long) h, (unsigned long) h);\n\t\tfprintf(fd,\n\t\t    \"{currentfile scanLine readhexstring pop} bind\\n\");\n\t\tfprintf(fd, \"%s\\n\", imageOp);\n\t\tPSDataBW(fd, tif, w, h);\n\t\tbreak;\n\t}\n\tputc('\\n', fd);\n}\n\nvoid\nPSColorContigPreamble(FILE* fd, uint32 w, uint32 h, int nc)\n{\n\tps_bytesperrow = nc * (tf_bytesperrow / samplesperpixel);\n\tPhotoshopBanner(fd, w, h, 1, nc, \"false %d colorimage\");\n\tfprintf(fd, \"/line %ld string def\\n\", (long) ps_bytesperrow);\n\tfprintf(fd, \"%lu %lu %d\\n\",\n\t    (unsigned long) w, (unsigned long) h, bitspersample);\n\tfprintf(fd, \"[%lu 0 0 -%lu 0 %lu]\\n\",\n\t    (unsigned long) w, (unsigned long) h, (unsigned long) h);\n\tfprintf(fd, \"{currentfile line readhexstring pop} bind\\n\");\n\tfprintf(fd, \"false %d colorimage\\n\", nc);\n}\n\nvoid\nPSColorSeparatePreamble(FILE* fd, uint32 w, uint32 h, int nc)\n{\n\tint i;\n\n\tPhotoshopBanner(fd, w, h, ps_bytesperrow, nc, \"true %d colorimage\");\n\tfor (i = 0; i < nc; i++)\n\t\tfprintf(fd, \"/line%d %ld string def\\n\",\n\t\t    i, (long) ps_bytesperrow);\n\tfprintf(fd, \"%lu %lu %d\\n\",\n\t    (unsigned long) w, (unsigned long) h, bitspersample);\n\tfprintf(fd, \"[%lu 0 0 -%lu 0 %lu] \\n\",\n\t    (unsigned long) w, (unsigned long) h, (unsigned long) h);\n\tfor (i = 0; i < nc; i++)\n\t\tfprintf(fd, \"{currentfile line%d readhexstring pop}bind\\n\", i);\n\tfprintf(fd, \"true %d colorimage\\n\", nc);\n}\n\n#define\tDOBREAK(len, howmany, fd) \\\n\tif (((len) -= (howmany)) <= 0) {\t\\\n\t\tputc('\\n', fd);\t\t\t\\\n\t\t(len) = MAXLINE-(howmany);\t\\\n\t}\n#define\tPUTHEX(c,fd)\tputc(hex[((c)>>4)&0xf],fd); putc(hex[(c)&0xf],fd)\n\nvoid\nPSDataColorContig(FILE* fd, TIFF* tif, uint32 w, uint32 h, int nc)\n{\n\tuint32 row;\n\tint breaklen = MAXLINE, cc, es = samplesperpixel - nc;\n\tunsigned char *tf_buf;\n\tunsigned char *cp, c;\n\n\t(void) w;\n\ttf_buf = (unsigned char *) _TIFFmalloc(tf_bytesperrow);\n\tif (tf_buf == NULL) {\n\t\tTIFFError(filename, \"No space for scanline buffer\");\n\t\treturn;\n\t}\n\tfor (row = 0; row < h; row++) {\n\t\tif (TIFFReadScanline(tif, tf_buf, row, 0) < 0)\n\t\t\tbreak;\n\t\tcp = tf_buf;\n\t\t/*\n\t\t * for 16 bits, the two bytes must be most significant\n\t\t * byte first\n\t\t */\n\t\tif (bitspersample == 16 && !HOST_BIGENDIAN) {\n\t\t\tPS_FlipBytes(cp, tf_bytesperrow);\n\t\t}\n\t\tif (alpha) {\n\t\t\tint adjust;\n\t\t\tcc = 0;\n\t\t\tfor (; cc < tf_bytesperrow; cc += samplesperpixel) {\n\t\t\t\tDOBREAK(breaklen, nc, fd);\n\t\t\t\t/*\n\t\t\t\t * For images with alpha, matte against\n\t\t\t\t * a white background; i.e.\n\t\t\t\t *    Cback * (1 - Aimage)\n\t\t\t\t * where Cback = 1.\n\t\t\t\t */\n\t\t\t\tadjust = 255 - cp[nc];\n\t\t\t\tswitch (nc) {\n\t\t\t\tcase 4: c = *cp++ + adjust; PUTHEX(c,fd);\n\t\t\t\tcase 3: c = *cp++ + adjust; PUTHEX(c,fd);\n\t\t\t\tcase 2: c = *cp++ + adjust; PUTHEX(c,fd);\n\t\t\t\tcase 1: c = *cp++ + adjust; PUTHEX(c,fd);\n\t\t\t\t}\n\t\t\t\tcp += es;\n\t\t\t}\n\t\t} else {\n\t\t\tcc = 0;\n\t\t\tfor (; cc < tf_bytesperrow; cc += samplesperpixel) {\n\t\t\t\tDOBREAK(breaklen, nc, fd);\n\t\t\t\tswitch (nc) {\n\t\t\t\tcase 4: c = *cp++; PUTHEX(c,fd);\n\t\t\t\tcase 3: c = *cp++; PUTHEX(c,fd);\n\t\t\t\tcase 2: c = *cp++; PUTHEX(c,fd);\n\t\t\t\tcase 1: c = *cp++; PUTHEX(c,fd);\n\t\t\t\t}\n\t\t\t\tcp += es;\n\t\t\t}\n\t\t}\n\t}\n\t_TIFFfree((char *) tf_buf);\n}\n\nvoid\nPSDataColorSeparate(FILE* fd, TIFF* tif, uint32 w, uint32 h, int nc)\n{\n\tuint32 row;\n\tint breaklen = MAXLINE, cc;\n\ttsample_t s, maxs;\n\tunsigned char *tf_buf;\n\tunsigned char *cp, c;\n\n\t(void) w;\n\ttf_buf = (unsigned char *) _TIFFmalloc(tf_bytesperrow);\n\tif (tf_buf == NULL) {\n\t\tTIFFError(filename, \"No space for scanline buffer\");\n\t\treturn;\n\t}\n\tmaxs = (samplesperpixel > nc ? nc : samplesperpixel);\n\tfor (row = 0; row < h; row++) {\n\t\tfor (s = 0; s < maxs; s++) {\n\t\t\tif (TIFFReadScanline(tif, tf_buf, row, s) < 0)\n\t\t\t\tbreak;\n\t\t\tfor (cp = tf_buf, cc = 0; cc < tf_bytesperrow; cc++) {\n\t\t\t\tDOBREAK(breaklen, 1, fd);\n\t\t\t\tc = *cp++;\n\t\t\t\tPUTHEX(c,fd);\n\t\t\t}\n\t\t}\n\t}\n\t_TIFFfree((char *) tf_buf);\n}\n\n#define\tPUTRGBHEX(c,fd) \\\n\tPUTHEX(rmap[c],fd); PUTHEX(gmap[c],fd); PUTHEX(bmap[c],fd)\n\nvoid\nPSDataPalette(FILE* fd, TIFF* tif, uint32 w, uint32 h)\n{\n\tuint16 *rmap, *gmap, *bmap;\n\tuint32 row;\n\tint breaklen = MAXLINE, cc, nc;\n\tunsigned char *tf_buf;\n\tunsigned char *cp, c;\n\n\t(void) w;\n\tif (!TIFFGetField(tif, TIFFTAG_COLORMAP, &rmap, &gmap, &bmap)) {\n\t\tTIFFError(filename, \"Palette image w/o \\\"Colormap\\\" tag\");\n\t\treturn;\n\t}\n\tswitch (bitspersample) {\n\tcase 8:\tcase 4: case 2: case 1:\n\t\tbreak;\n\tdefault:\n\t\tTIFFError(filename, \"Depth %d not supported\", bitspersample);\n\t\treturn;\n\t}\n\tnc = 3 * (8 / bitspersample);\n\ttf_buf = (unsigned char *) _TIFFmalloc(tf_bytesperrow);\n\tif (tf_buf == NULL) {\n\t\tTIFFError(filename, \"No space for scanline buffer\");\n\t\treturn;\n\t}\n\tif (checkcmap(tif, 1<<bitspersample, rmap, gmap, bmap) == 16) {\n\t\tint i;\n#define\tCVT(x)\t\t((unsigned short) (((x) * 255) / ((1U<<16)-1)))\n\t\tfor (i = (1<<bitspersample)-1; i >= 0; i--) {\n\t\t\trmap[i] = CVT(rmap[i]);\n\t\t\tgmap[i] = CVT(gmap[i]);\n\t\t\tbmap[i] = CVT(bmap[i]);\n\t\t}\n#undef CVT\n\t}\n\tfor (row = 0; row < h; row++) {\n\t\tif (TIFFReadScanline(tif, tf_buf, row, 0) < 0)\n\t\t\tbreak;\n\t\tfor (cp = tf_buf, cc = 0; cc < tf_bytesperrow; cc++) {\n\t\t\tDOBREAK(breaklen, nc, fd);\n\t\t\tswitch (bitspersample) {\n\t\t\tcase 8:\n\t\t\t\tc = *cp++; PUTRGBHEX(c, fd);\n\t\t\t\tbreak;\n\t\t\tcase 4:\n\t\t\t\tc = *cp++; PUTRGBHEX(c&0xf, fd);\n\t\t\t\tc >>= 4;   PUTRGBHEX(c, fd);\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\tc = *cp++; PUTRGBHEX(c&0x3, fd);\n\t\t\t\tc >>= 2;   PUTRGBHEX(c&0x3, fd);\n\t\t\t\tc >>= 2;   PUTRGBHEX(c&0x3, fd);\n\t\t\t\tc >>= 2;   PUTRGBHEX(c, fd);\n\t\t\t\tbreak;\n\t\t\tcase 1:\n\t\t\t\tc = *cp++; PUTRGBHEX(c&0x1, fd);\n\t\t\t\tc >>= 1;   PUTRGBHEX(c&0x1, fd);\n\t\t\t\tc >>= 1;   PUTRGBHEX(c&0x1, fd);\n\t\t\t\tc >>= 1;   PUTRGBHEX(c&0x1, fd);\n\t\t\t\tc >>= 1;   PUTRGBHEX(c&0x1, fd);\n\t\t\t\tc >>= 1;   PUTRGBHEX(c&0x1, fd);\n\t\t\t\tc >>= 1;   PUTRGBHEX(c&0x1, fd);\n\t\t\t\tc >>= 1;   PUTRGBHEX(c, fd);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\t_TIFFfree((char *) tf_buf);\n}\n\nvoid\nPSDataBW(FILE* fd, TIFF* tif, uint32 w, uint32 h)\n{\n\tint breaklen = MAXLINE;\n\tunsigned char* tf_buf;\n\tunsigned char* cp;\n\ttsize_t stripsize = TIFFStripSize(tif);\n\ttstrip_t s;\n\n#if defined( EXP_ASCII85ENCODER )\n\tint\tascii85_l;\t\t/* Length, in bytes, of ascii85_p[] data */\n\tuint8\t*ascii85_p = 0;\t\t/* Holds ASCII85 encoded data */\n#endif\n\n\t(void) w; (void) h;\n\ttf_buf = (unsigned char *) _TIFFmalloc(stripsize);\n        memset(tf_buf, 0, stripsize);\n\tif (tf_buf == NULL) {\n\t\tTIFFError(filename, \"No space for scanline buffer\");\n\t\treturn;\n\t}\n\n#if defined( EXP_ASCII85ENCODER )\n\tif ( ascii85 ) {\n\t    /*\n\t     * Allocate a buffer to hold the ASCII85 encoded data.  Note\n\t     * that it is allocated with sufficient room to hold the\n\t     * encoded data (5*stripsize/4) plus the EOD marker (+8)\n\t     * and formatting line breaks.  The line breaks are more\n\t     * than taken care of by using 6*stripsize/4 rather than\n\t     * 5*stripsize/4.\n\t     */\n\n\t    ascii85_p = _TIFFmalloc( (stripsize+(stripsize/2)) + 8 );\n\n\t    if ( !ascii85_p ) {\n\t\t_TIFFfree( tf_buf );\n\n\t\tTIFFError( filename, \"Cannot allocate ASCII85 encoding buffer.\" );\n\t\treturn;\n\t    }\n\t}\n#endif\n\n\tif (ascii85)\n\t\tAscii85Init();\n\n\tfor (s = 0; s < TIFFNumberOfStrips(tif); s++) {\n\t\tint cc = TIFFReadEncodedStrip(tif, s, tf_buf, stripsize);\n\t\tif (cc < 0) {\n\t\t\tTIFFError(filename, \"Can't read strip\");\n\t\t\tbreak;\n\t\t}\n\t\tcp = tf_buf;\n\t\tif (photometric == PHOTOMETRIC_MINISWHITE) {\n\t\t\tfor (cp += cc; --cp >= tf_buf;)\n\t\t\t\t*cp = ~*cp;\n\t\t\tcp++;\n\t\t}\n\t\t/*\n\t\t * for 16 bits, the two bytes must be most significant\n\t\t * byte first\n\t\t */\n\t\tif (bitspersample == 16 && !HOST_BIGENDIAN) {\n\t\t\tPS_FlipBytes(cp, cc);\n\t\t}\n\t\tif (ascii85) {\n#if defined( EXP_ASCII85ENCODER )\n\t\t\tif (alpha) {\n\t\t\t\tint adjust, i;\n\t\t\t\tfor (i = 0; i < cc; i+=2) {\n\t\t\t\t\tadjust = 255 - cp[i + 1];\n\t\t\t\t    cp[i / 2] = cp[i] + adjust;\n\t\t\t\t}\n\t\t\t\tcc /= 2;\n\t\t\t}\n\n\t\t\tascii85_l = Ascii85EncodeBlock( ascii85_p, 1, cp, cc );\n\n\t\t\tif ( ascii85_l > 0 )\n\t\t\t    fwrite( ascii85_p, ascii85_l, 1, fd );\n#else\n\t\t\twhile (cc-- > 0)\n\t\t\t\tAscii85Put(*cp++, fd);\n#endif /* EXP_ASCII85_ENCODER */\n\t\t} else {\n\t\t\tunsigned char c;\n\n\t\t\tif (alpha) {\n\t\t\t\tint adjust;\n\t\t\t\twhile (cc-- > 0) {\n\t\t\t\t\tDOBREAK(breaklen, 1, fd);\n\t\t\t\t\t/*\n\t\t\t\t\t * For images with alpha, matte against\n\t\t\t\t\t * a white background; i.e.\n\t\t\t\t\t *    Cback * (1 - Aimage)\n\t\t\t\t\t * where Cback = 1.\n\t\t\t\t\t */\n\t\t\t\t\tadjust = 255 - cp[1];\n\t\t\t\t\tc = *cp++ + adjust; PUTHEX(c,fd);\n\t\t\t\t\tcp++, cc--;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\twhile (cc-- > 0) {\n\t\t\t\t\tc = *cp++;\n\t\t\t\t\tDOBREAK(breaklen, 1, fd);\n\t\t\t\t\tPUTHEX(c, fd);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif ( !ascii85 )\n\t{\n\t    if ( level2 || level3)\n\t\tfputs(\">\\n\", fd);\n\t}\n#if !defined( EXP_ASCII85ENCODER )\n\telse\n\t    Ascii85Flush(fd);\n#else\n\tif ( ascii85_p )\n\t    _TIFFfree( ascii85_p );\n#endif\n\n\t_TIFFfree(tf_buf);\n}\n\nvoid\nPSRawDataBW(FILE* fd, TIFF* tif, uint32 w, uint32 h)\n{\n\tuint32 *bc;\n\tuint32 bufsize;\n\tint breaklen = MAXLINE, cc;\n\tuint16 fillorder;\n\tunsigned char *tf_buf;\n\tunsigned char *cp, c;\n\ttstrip_t s;\n\n#if defined( EXP_ASCII85ENCODER )\n\tint\t\t\tascii85_l;\t\t/* Length, in bytes, of ascii85_p[] data */\n\tuint8\t\t*\tascii85_p = 0;\t\t/* Holds ASCII85 encoded data */\n#endif\n\n\t(void) w; (void) h;\n\tTIFFGetFieldDefaulted(tif, TIFFTAG_FILLORDER, &fillorder);\n\tTIFFGetField(tif, TIFFTAG_STRIPBYTECOUNTS, &bc);\n\n\t/*\n\t * Find largest strip:\n\t */\n\n\tbufsize = bc[0];\n\n\tfor ( s = 0; ++s < (tstrip_t)tf_numberstrips; ) {\n\t\tif ( bc[s] > bufsize )\n\t\t\tbufsize = bc[s];\n\t}\n\n\ttf_buf = (unsigned char*) _TIFFmalloc(bufsize);\n\tif (tf_buf == NULL) {\n\t\tTIFFError(filename, \"No space for strip buffer\");\n\t\treturn;\n\t}\n\n#if defined( EXP_ASCII85ENCODER )\n\tif ( ascii85 ) {\n\t    /*\n\t     * Allocate a buffer to hold the ASCII85 encoded data.  Note\n\t     * that it is allocated with sufficient room to hold the\n\t     * encoded data (5*bufsize/4) plus the EOD marker (+8)\n\t     * and formatting line breaks.  The line breaks are more\n\t     * than taken care of by using 6*bufsize/4 rather than\n\t     * 5*bufsize/4.\n\t     */\n\n\t    ascii85_p = _TIFFmalloc( (bufsize+(bufsize/2)) + 8 );\n\n\t    if ( !ascii85_p ) {\n\t\t_TIFFfree( tf_buf );\n\n\t\tTIFFError( filename, \"Cannot allocate ASCII85 encoding buffer.\" );\n\t\treturn;\n\t    }\n\t}\n#endif\n\n\tfor (s = 0; s < (tstrip_t) tf_numberstrips; s++) {\n\t\tcc = TIFFReadRawStrip(tif, s, tf_buf, bc[s]);\n\t\tif (cc < 0) {\n\t\t\tTIFFError(filename, \"Can't read strip\");\n\t\t\tbreak;\n\t\t}\n\t\tif (fillorder == FILLORDER_LSB2MSB)\n\t\t\tTIFFReverseBits(tf_buf, cc);\n\t\tif (!ascii85) {\n\t\t\tfor (cp = tf_buf; cc > 0; cc--) {\n\t\t\t\tDOBREAK(breaklen, 1, fd);\n\t\t\t\tc = *cp++;\n\t\t\t\tPUTHEX(c, fd);\n\t\t\t}\n\t\t\tfputs(\">\\n\", fd);\n\t\t\tbreaklen = MAXLINE;\n\t\t} else {\n\t\t\tAscii85Init();\n#if defined( EXP_ASCII85ENCODER )\n\t\t\tascii85_l = Ascii85EncodeBlock( ascii85_p, 1, tf_buf, cc );\n\n\t\t\tif ( ascii85_l > 0 )\n\t\t\t\tfwrite( ascii85_p, ascii85_l, 1, fd );\n#else\n\t\t\tfor (cp = tf_buf; cc > 0; cc--)\n\t\t\t\tAscii85Put(*cp++, fd);\n\t\t\tAscii85Flush(fd);\n#endif\t/* EXP_ASCII85ENCODER */\n\t\t}\n\t}\n\t_TIFFfree((char *) tf_buf);\n\n#if defined( EXP_ASCII85ENCODER )\n\tif ( ascii85_p )\n\t\t_TIFFfree( ascii85_p );\n#endif\n}\n\nvoid\nAscii85Init(void)\n{\n\tascii85breaklen = 2*MAXLINE;\n\tascii85count = 0;\n}\n\nstatic char*\nAscii85Encode(unsigned char* raw)\n{\n\tstatic char encoded[6];\n\tuint32 word;\n\n\tword = (((raw[0]<<8)+raw[1])<<16) + (raw[2]<<8) + raw[3];\n\tif (word != 0L) {\n\t\tuint32 q;\n\t\tuint16 w1;\n\n\t\tq = word / (85L*85*85*85);\t/* actually only a byte */\n\t\tencoded[0] = (char) (q + '!');\n\n\t\tword -= q * (85L*85*85*85); q = word / (85L*85*85);\n\t\tencoded[1] = (char) (q + '!');\n\n\t\tword -= q * (85L*85*85); q = word / (85*85);\n\t\tencoded[2] = (char) (q + '!');\n\n\t\tw1 = (uint16) (word - q*(85L*85));\n\t\tencoded[3] = (char) ((w1 / 85) + '!');\n\t\tencoded[4] = (char) ((w1 % 85) + '!');\n\t\tencoded[5] = '\\0';\n\t} else\n\t\tencoded[0] = 'z', encoded[1] = '\\0';\n\treturn (encoded);\n}\n\nvoid\nAscii85Put(unsigned char code, FILE* fd)\n{\n\tascii85buf[ascii85count++] = code;\n\tif (ascii85count >= 4) {\n\t\tunsigned char* p;\n\t\tint n;\n\n\t\tfor (n = ascii85count, p = ascii85buf; n >= 4; n -= 4, p += 4) {\n\t\t\tchar* cp;\n\t\t\tfor (cp = Ascii85Encode(p); *cp; cp++) {\n\t\t\t\tputc(*cp, fd);\n\t\t\t\tif (--ascii85breaklen == 0) {\n\t\t\t\t\tputc('\\n', fd);\n\t\t\t\t\tascii85breaklen = 2*MAXLINE;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t_TIFFmemcpy(ascii85buf, p, n);\n\t\tascii85count = n;\n\t}\n}\n\nvoid\nAscii85Flush(FILE* fd)\n{\n\tif (ascii85count > 0) {\n\t\tchar* res;\n\t\t_TIFFmemset(&ascii85buf[ascii85count], 0, 3);\n\t\tres = Ascii85Encode(ascii85buf);\n\t\tfwrite(res[0] == 'z' ? \"!!!!\" : res, ascii85count + 1, 1, fd);\n\t}\n\tfputs(\"~>\\n\", fd);\n}\n#if\tdefined( EXP_ASCII85ENCODER)\n\f\n#define A85BREAKCNTR    ascii85breaklen\n#define A85BREAKLEN     (2*MAXLINE)\n\n/*****************************************************************************\n*\n* Name:         Ascii85EncodeBlock( ascii85_p, f_eod, raw_p, raw_l )\n*\n* Description:  This routine will encode the raw data in the buffer described\n*               by raw_p and raw_l into ASCII85 format and store the encoding\n*               in the buffer given by ascii85_p.\n*\n* Parameters:   ascii85_p   -   A buffer supplied by the caller which will\n*                               contain the encoded ASCII85 data.\n*               f_eod       -   Flag: Nz means to end the encoded buffer with\n*                               an End-Of-Data marker.\n*               raw_p       -   Pointer to the buffer of data to be encoded\n*               raw_l       -   Number of bytes in raw_p[] to be encoded\n*\n* Returns:      (int)   <   0   Error, see errno\n*                       >=  0   Number of bytes written to ascii85_p[].\n*\n* Notes:        An external variable given by A85BREAKCNTR is used to\n*               determine when to insert newline characters into the\n*               encoded data.  As each byte is placed into ascii85_p this\n*               external is decremented.  If the variable is decrement to\n*               or past zero then a newline is inserted into ascii85_p\n*               and the A85BREAKCNTR is then reset to A85BREAKLEN.\n*                   Note:  for efficiency reasons the A85BREAKCNTR variable\n*                          is not actually checked on *every* character\n*                          placed into ascii85_p but often only for every\n*                          5 characters.\n*\n*               THE CALLER IS RESPONSIBLE FOR ENSURING THAT ASCII85_P[] IS\n*               SUFFICIENTLY LARGE TO THE ENCODED DATA!\n*                   You will need at least 5 * (raw_l/4) bytes plus space for\n*                   newline characters and space for an EOD marker (if\n*                   requested).  A safe calculation is to use 6*(raw_l/4) + 8\n*                   to size ascii85_p.\n*\n*****************************************************************************/\n\nint Ascii85EncodeBlock( uint8 * ascii85_p, unsigned f_eod, const uint8 * raw_p, int raw_l )\n\n{\n    char                        ascii85[5];     /* Encoded 5 tuple */\n    int                         ascii85_l;      /* Number of bytes written to ascii85_p[] */\n    int                         rc;             /* Return code */\n    uint32                      val32;          /* Unencoded 4 tuple */\n\n    ascii85_l = 0;                              /* Nothing written yet */\n\n    if ( raw_p )\n    {\n        --raw_p;                                /* Prepare for pre-increment fetches */\n\n        for ( ; raw_l > 3; raw_l -= 4 )\n        {\n            val32  = *(++raw_p) << 24;\n            val32 += *(++raw_p) << 16;\n            val32 += *(++raw_p) <<  8;\n            val32 += *(++raw_p);\n    \n            if ( val32 == 0 )                   /* Special case */\n            {\n                ascii85_p[ascii85_l] = 'z';\n                rc = 1;\n            }\n    \n            else\n            {\n                ascii85[4] = (char) ((val32 % 85) + 33);\n                val32 /= 85;\n    \n                ascii85[3] = (char) ((val32 % 85) + 33);\n                val32 /= 85;\n    \n                ascii85[2] = (char) ((val32 % 85) + 33);\n                val32 /= 85;\n    \n                ascii85[1] = (char) ((val32 % 85) + 33);\n                ascii85[0] = (char) ((val32 / 85) + 33);\n\n                _TIFFmemcpy( &ascii85_p[ascii85_l], ascii85, sizeof(ascii85) );\n                rc = sizeof(ascii85);\n            }\n    \n            ascii85_l += rc;\n    \n            if ( (A85BREAKCNTR -= rc) <= 0 )\n            {\n                ascii85_p[ascii85_l] = '\\n';\n                ++ascii85_l;\n                A85BREAKCNTR = A85BREAKLEN;\n            }\n        }\n    \n        /*\n         * Output any straggler bytes:\n         */\n    \n        if ( raw_l > 0 )\n        {\n            int             len;                /* Output this many bytes */\n    \n            len = raw_l + 1;\n            val32 = *++raw_p << 24;             /* Prime the pump */\n    \n            if ( --raw_l > 0 )  val32 += *(++raw_p) << 16;\n            if ( --raw_l > 0 )  val32 += *(++raw_p) <<  8;\n    \n            val32 /= 85;\n    \n            ascii85[3] = (char) ((val32 % 85) + 33);\n            val32 /= 85;\n    \n            ascii85[2] = (char) ((val32 % 85) + 33);\n            val32 /= 85;\n    \n            ascii85[1] = (char) ((val32 % 85) + 33);\n            ascii85[0] = (char) ((val32 / 85) + 33);\n    \n            _TIFFmemcpy( &ascii85_p[ascii85_l], ascii85, len );\n            ascii85_l += len;\n        }\n    }\n\n    /*\n     * If requested add an ASCII85 End Of Data marker:\n     */\n\n    if ( f_eod )\n    {\n        ascii85_p[ascii85_l++] = '~';\n        ascii85_p[ascii85_l++] = '>';\n        ascii85_p[ascii85_l++] = '\\n';\n    }\n\n    return ( ascii85_l );\n\n}   /* Ascii85EncodeBlock() */\n\n#endif\t/* EXP_ASCII85ENCODER */\n\n\nchar* stuff[] = {\n\"usage: tiff2ps [options] input.tif ...\",\n\"where options are:\",\n\" -1            generate PostScript Level 1 (default)\",\n\" -2            generate PostScript Level 2\",\n\" -3            generate PostScript Level 3\",\n\" -8            disable use of ASCII85 encoding with PostScript Level 2/3\",\n\" -a            convert all directories in file (default is first)\",\n\" -b #          set the bottom margin to # inches\",\n\" -c            center image (-b and -l still add to this)\",\n\" -d #          convert directory number #\",\n\" -D            enable duplex printing (two pages per sheet of paper)\",\n\" -e            generate Encapsulated PostScript (EPS) (implies -z)\",\n\" -h #          assume printed page height is # inches (default 11)\",\n\" -w #          assume printed page width is # inches (default 8.5)\",\n\" -H #          split image if height is more than # inches\",\n\" -W #          split image if width is more than # inches\",\n\" -L #          overLap split images by # inches\",\n\" -i #          enable/disable (Nz/0) pixel interpolation (default: enable)\",\n\" -l #          set the left margin to # inches\",\n\" -m            use \\\"imagemask\\\" operator instead of \\\"image\\\"\",\n\" -o #          convert directory at file offset #\",\n\" -O file       write PostScript to file instead of standard output\",\n\" -p            generate regular PostScript\",\n\" -r # or auto  rotate by 90, 180, 270 degrees or auto\",\n\" -s            generate PostScript for a single image\",\n\" -T            print pages for top edge binding\",\n\" -x            override resolution units as centimeters\",\n\" -y            override resolution units as inches\",\n\" -z            enable printing in the deadzone (only for PostScript Level 2/3)\",\nNULL\n};\n\nstatic void\nusage(int code)\n{\n\tchar buf[BUFSIZ];\n\tint i;\n\n\tsetbuf(stderr, buf);\n        fprintf(stderr, \"%s\\n\\n\", TIFFGetVersion());\n\tfor (i = 0; stuff[i] != NULL; i++)\n\t\tfprintf(stderr, \"%s\\n\", stuff[i]);\n\texit(code);\n}\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiff/tools/tiff2rgba.c",
    "content": "/* $Id: tiff2rgba.c,v 1.13.2.1 2009-08-20 20:23:53 bfriesen Exp $ */\n\n/*\n * Copyright (c) 1991-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n#include \"tif_config.h\"\n\n#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n\n#ifdef HAVE_UNISTD_H\n# include <unistd.h>\n#endif\n\n#include \"tiffiop.h\"\n#include \"tiffio.h\"\n\n#define\tstreq(a,b)\t(strcmp(a,b) == 0)\n#define\tCopyField(tag, v) \\\n    if (TIFFGetField(in, tag, &v)) TIFFSetField(out, tag, v)\n\n#ifndef howmany\n#define\thowmany(x, y)\t(((x)+((y)-1))/(y))\n#endif\n#define\troundup(x, y)\t(howmany(x,y)*((uint32)(y)))\n\nuint16\tcompression = COMPRESSION_PACKBITS;\nuint32\trowsperstrip = (uint32) -1;\nint\tprocess_by_block = 0; /* default is whole image at once */\nint     no_alpha = 0;\n\n\nstatic\tint tiffcvt(TIFF* in, TIFF* out);\nstatic\tvoid usage(int code);\n\nint\nmain(int argc, char* argv[])\n{\n    TIFF *in, *out;\n    int c;\n    extern int optind;\n    extern char *optarg;\n\n    while ((c = getopt(argc, argv, \"c:r:t:bn\")) != -1)\n        switch (c) {\n          case 'b':\n            process_by_block = 1;\n            break;\n            \n          case 'c':\n            if (streq(optarg, \"none\"))\n                compression = COMPRESSION_NONE;\n            else if (streq(optarg, \"packbits\"))\n                compression = COMPRESSION_PACKBITS;\n            else if (streq(optarg, \"lzw\"))\n                compression = COMPRESSION_LZW;\n            else if (streq(optarg, \"jpeg\"))\n                compression = COMPRESSION_JPEG;\n            else if (streq(optarg, \"zip\"))\n                compression = COMPRESSION_DEFLATE;\n            else\n                usage(-1);\n            break;\n\n          case 'r':\n            rowsperstrip = atoi(optarg);\n            break;\n\n          case 't':\n            rowsperstrip = atoi(optarg);\n            break;\n            \n          case 'n':\n            no_alpha = 1;\n            break;\n            \n          case '?':\n            usage(0);\n            /*NOTREACHED*/\n        }\n\n    if (argc - optind < 2)\n        usage(-1);\n\n    out = TIFFOpen(argv[argc-1], \"w\");\n    if (out == NULL)\n        return (-2);\n\n    for (; optind < argc-1; optind++) {\n        in = TIFFOpen(argv[optind], \"r\");\n        if (in != NULL) {\n            do {\n                if (!tiffcvt(in, out) ||\n                    !TIFFWriteDirectory(out)) {\n                    (void) TIFFClose(out);\n                    return (1);\n                }\n            } while (TIFFReadDirectory(in));\n            (void) TIFFClose(in);\n        }\n    }\n    (void) TIFFClose(out);\n    return (0);\n}\n\nstatic int\ncvt_by_tile( TIFF *in, TIFF *out )\n\n{\n    uint32* raster;\t\t\t/* retrieve RGBA image */\n    uint32  width, height;\t\t/* image width & height */\n    uint32  tile_width, tile_height;\n    uint32  row, col;\n    uint32  *wrk_line;\n    int\t    ok = 1;\n\n    TIFFGetField(in, TIFFTAG_IMAGEWIDTH, &width);\n    TIFFGetField(in, TIFFTAG_IMAGELENGTH, &height);\n\n    if( !TIFFGetField(in, TIFFTAG_TILEWIDTH, &tile_width)\n        || !TIFFGetField(in, TIFFTAG_TILELENGTH, &tile_height) ) {\n        TIFFError(TIFFFileName(in), \"Source image not tiled\");\n        return (0);\n    }\n    \n    TIFFSetField(out, TIFFTAG_TILEWIDTH, tile_width );\n    TIFFSetField(out, TIFFTAG_TILELENGTH, tile_height );\n\n    /*\n     * Allocate tile buffer\n     */\n    raster = (uint32*)_TIFFmalloc(tile_width * tile_height * sizeof (uint32));\n    if (raster == 0) {\n        TIFFError(TIFFFileName(in), \"No space for raster buffer\");\n        return (0);\n    }\n\n    /*\n     * Allocate a scanline buffer for swapping during the vertical\n     * mirroring pass.\n     */\n    wrk_line = (uint32*)_TIFFmalloc(tile_width * sizeof (uint32));\n    if (!wrk_line) {\n        TIFFError(TIFFFileName(in), \"No space for raster scanline buffer\");\n        ok = 0;\n    }\n    \n    /*\n     * Loop over the tiles.\n     */\n    for( row = 0; ok && row < height; row += tile_height )\n    {\n        for( col = 0; ok && col < width; col += tile_width )\n        {\n            uint32 i_row;\n\n            /* Read the tile into an RGBA array */\n            if (!TIFFReadRGBATile(in, col, row, raster)) {\n                ok = 0;\n                break;\n            }\n\n\n\t    /*\n\t     * XXX: raster array has 4-byte unsigned integer type, that is why\n\t     * we should rearrange it here.\n\t     */\n#if HOST_BIGENDIAN\n\t    TIFFSwabArrayOfLong(raster, tile_width * tile_height);\n#endif\n\n            /*\n             * For some reason the TIFFReadRGBATile() function chooses the\n             * lower left corner as the origin.  Vertically mirror scanlines.\n             */\n            for( i_row = 0; i_row < tile_height / 2; i_row++ )\n            {\n                uint32\t*top_line, *bottom_line;\n\n                top_line = raster + tile_width * i_row;\n                bottom_line = raster + tile_width * (tile_height-i_row-1);\n\n                _TIFFmemcpy(wrk_line, top_line, 4*tile_width);\n                _TIFFmemcpy(top_line, bottom_line, 4*tile_width);\n                _TIFFmemcpy(bottom_line, wrk_line, 4*tile_width);\n            }\n\n            /*\n             * Write out the result in a tile.\n             */\n\n            if( TIFFWriteEncodedTile( out,\n                                      TIFFComputeTile( out, col, row, 0, 0),\n                                      raster,\n                                      4 * tile_width * tile_height ) == -1 )\n            {\n                ok = 0;\n                break;\n            }\n        }\n    }\n\n    _TIFFfree( raster );\n    _TIFFfree( wrk_line );\n\n    return ok;\n}\n\nstatic int\ncvt_by_strip( TIFF *in, TIFF *out )\n\n{\n    uint32* raster;\t\t\t/* retrieve RGBA image */\n    uint32  width, height;\t\t/* image width & height */\n    uint32  row;\n    uint32  *wrk_line;\n    int\t    ok = 1;\n\n    TIFFGetField(in, TIFFTAG_IMAGEWIDTH, &width);\n    TIFFGetField(in, TIFFTAG_IMAGELENGTH, &height);\n\n    if( !TIFFGetField(in, TIFFTAG_ROWSPERSTRIP, &rowsperstrip) ) {\n        TIFFError(TIFFFileName(in), \"Source image not in strips\");\n        return (0);\n    }\n    \n    TIFFSetField(out, TIFFTAG_ROWSPERSTRIP, rowsperstrip);\n\n    /*\n     * Allocate strip buffer\n     */\n    raster = (uint32*)_TIFFmalloc(width * rowsperstrip * sizeof (uint32));\n    if (raster == 0) {\n        TIFFError(TIFFFileName(in), \"No space for raster buffer\");\n        return (0);\n    }\n\n    /*\n     * Allocate a scanline buffer for swapping during the vertical\n     * mirroring pass.\n     */\n    wrk_line = (uint32*)_TIFFmalloc(width * sizeof (uint32));\n    if (!wrk_line) {\n        TIFFError(TIFFFileName(in), \"No space for raster scanline buffer\");\n        ok = 0;\n    }\n    \n    /*\n     * Loop over the strips.\n     */\n    for( row = 0; ok && row < height; row += rowsperstrip )\n    {\n        int\trows_to_write, i_row;\n\n        /* Read the strip into an RGBA array */\n        if (!TIFFReadRGBAStrip(in, row, raster)) {\n            ok = 0;\n            break;\n        }\n\n\t/*\n\t * XXX: raster array has 4-byte unsigned integer type, that is why\n\t * we should rearrange it here.\n\t */\n#if HOST_BIGENDIAN\n\tTIFFSwabArrayOfLong(raster, width * rowsperstrip);\n#endif\n\n        /*\n         * Figure out the number of scanlines actually in this strip.\n         */\n        if( row + rowsperstrip > height )\n            rows_to_write = height - row;\n        else\n            rows_to_write = rowsperstrip;\n\n        /*\n         * For some reason the TIFFReadRGBAStrip() function chooses the\n         * lower left corner as the origin.  Vertically mirror scanlines.\n         */\n\n        for( i_row = 0; i_row < rows_to_write / 2; i_row++ )\n        {\n            uint32\t*top_line, *bottom_line;\n\n            top_line = raster + width * i_row;\n            bottom_line = raster + width * (rows_to_write-i_row-1);\n\n            _TIFFmemcpy(wrk_line, top_line, 4*width);\n            _TIFFmemcpy(top_line, bottom_line, 4*width);\n            _TIFFmemcpy(bottom_line, wrk_line, 4*width);\n        }\n\n        /*\n         * Write out the result in a strip\n         */\n\n        if( TIFFWriteEncodedStrip( out, row / rowsperstrip, raster,\n                                   4 * rows_to_write * width ) == -1 )\n        {\n            ok = 0;\n            break;\n        }\n    }\n\n    _TIFFfree( raster );\n    _TIFFfree( wrk_line );\n\n    return ok;\n}\n\n/*\n * cvt_whole_image()\n *\n * read the whole image into one big RGBA buffer and then write out\n * strips from that.  This is using the traditional TIFFReadRGBAImage()\n * API that we trust.\n */\n\nstatic int\ncvt_whole_image( TIFF *in, TIFF *out )\n\n{\n    uint32* raster;\t\t\t/* retrieve RGBA image */\n    uint32  width, height;\t\t/* image width & height */\n    uint32  row;\n    size_t pixel_count;\n        \n    TIFFGetField(in, TIFFTAG_IMAGEWIDTH, &width);\n    TIFFGetField(in, TIFFTAG_IMAGELENGTH, &height);\n    pixel_count = width * height;\n\n    /* XXX: Check the integer overflow. */\n    if (!width || !height || pixel_count / width != height) {\n        TIFFError(TIFFFileName(in),\n\t\t  \"Malformed input file; can't allocate buffer for raster of %lux%lu size\",\n\t\t  (unsigned long)width, (unsigned long)height);\n        return 0;\n    }\n\n    rowsperstrip = TIFFDefaultStripSize(out, rowsperstrip);\n    TIFFSetField(out, TIFFTAG_ROWSPERSTRIP, rowsperstrip);\n\n    raster = (uint32*)_TIFFCheckMalloc(in, pixel_count, sizeof(uint32), \"raster buffer\");\n    if (raster == 0) {\n        TIFFError(TIFFFileName(in), \"Requested buffer size is %lu elements %lu each\",\n\t\t  (unsigned long)pixel_count, (unsigned long)sizeof(uint32));\n        return (0);\n    }\n\n    /* Read the image in one chunk into an RGBA array */\n    if (!TIFFReadRGBAImageOriented(in, width, height, raster,\n                                   ORIENTATION_TOPLEFT, 0)) {\n        _TIFFfree(raster);\n        return (0);\n    }\n\n    /*\n     * XXX: raster array has 4-byte unsigned integer type, that is why\n     * we should rearrange it here.\n     */\n#if HOST_BIGENDIAN\n    TIFFSwabArrayOfLong(raster, width * height);\n#endif\n\n    /*\n     * Do we want to strip away alpha components?\n     */\n    if (no_alpha)\n    {\n        size_t count = pixel_count;\n        unsigned char *src, *dst;\n\n\tsrc = dst = (unsigned char *) raster;\n        while (count > 0)\n        {\n\t    *(dst++) = *(src++);\n\t    *(dst++) = *(src++);\n\t    *(dst++) = *(src++);\n\t    src++;\n\t    count--;\n        }\n    }\n\n    /*\n     * Write out the result in strips\n     */\n    for (row = 0; row < height; row += rowsperstrip)\n    {\n        unsigned char * raster_strip;\n        int\trows_to_write;\n        int\tbytes_per_pixel;\n\n        if (no_alpha)\n        {\n            raster_strip = ((unsigned char *) raster) + 3 * row * width;\n            bytes_per_pixel = 3;\n        }\n        else\n        {\n            raster_strip = (unsigned char *) (raster + row * width);\n            bytes_per_pixel = 4;\n        }\n\n        if( row + rowsperstrip > height )\n            rows_to_write = height - row;\n        else\n            rows_to_write = rowsperstrip;\n\n        if( TIFFWriteEncodedStrip( out, row / rowsperstrip, raster_strip,\n                             bytes_per_pixel * rows_to_write * width ) == -1 )\n        {\n            _TIFFfree( raster );\n            return 0;\n        }\n    }\n\n    _TIFFfree( raster );\n\n    return 1;\n}\n\n\nstatic int\ntiffcvt(TIFF* in, TIFF* out)\n{\n\tuint32 width, height;\t\t/* image width & height */\n\tuint16 shortv;\n\tfloat floatv;\n\tchar *stringv;\n\tuint32 longv;\n        uint16 v[1];\n\n\tTIFFGetField(in, TIFFTAG_IMAGEWIDTH, &width);\n\tTIFFGetField(in, TIFFTAG_IMAGELENGTH, &height);\n\n\tCopyField(TIFFTAG_SUBFILETYPE, longv);\n\tTIFFSetField(out, TIFFTAG_IMAGEWIDTH, width);\n\tTIFFSetField(out, TIFFTAG_IMAGELENGTH, height);\n\tTIFFSetField(out, TIFFTAG_BITSPERSAMPLE, 8);\n\tTIFFSetField(out, TIFFTAG_COMPRESSION, compression);\n\tTIFFSetField(out, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB);\n\n\tCopyField(TIFFTAG_FILLORDER, shortv);\n\tTIFFSetField(out, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);\n\n        if( no_alpha )\n            TIFFSetField(out, TIFFTAG_SAMPLESPERPIXEL, 3);\n        else\n            TIFFSetField(out, TIFFTAG_SAMPLESPERPIXEL, 4);\n\n        if( !no_alpha )\n        {\n            v[0] = EXTRASAMPLE_ASSOCALPHA;\n            TIFFSetField(out, TIFFTAG_EXTRASAMPLES, 1, v);\n        }\n\n\tCopyField(TIFFTAG_XRESOLUTION, floatv);\n\tCopyField(TIFFTAG_YRESOLUTION, floatv);\n\tCopyField(TIFFTAG_RESOLUTIONUNIT, shortv);\n\tTIFFSetField(out, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);\n\tTIFFSetField(out, TIFFTAG_SOFTWARE, TIFFGetVersion());\n\tCopyField(TIFFTAG_DOCUMENTNAME, stringv);\n\n        if( process_by_block && TIFFIsTiled( in ) )\n            return( cvt_by_tile( in, out ) );\n        else if( process_by_block )\n            return( cvt_by_strip( in, out ) );\n        else\n            return( cvt_whole_image( in, out ) );\n}\n\nstatic char* stuff[] = {\n    \"usage: tiff2rgba [-c comp] [-r rows] [-b] input... output\",\n    \"where comp is one of the following compression algorithms:\",\n    \" jpeg\\t\\tJPEG encoding\",\n    \" zip\\t\\tLempel-Ziv & Welch encoding\",\n    \" lzw\\t\\tLempel-Ziv & Welch encoding\",\n    \" packbits\\tPackBits encoding\",\n    \" none\\t\\tno compression\",\n    \"and the other options are:\",\n    \" -r\\trows/strip\",\n    \" -b (progress by block rather than as a whole image)\",\n    \" -n don't emit alpha component.\",\n    NULL\n};\n\nstatic void\nusage(int code)\n{\n\tchar buf[BUFSIZ];\n\tint i;\n\n\tsetbuf(stderr, buf);\n        fprintf(stderr, \"%s\\n\\n\", TIFFGetVersion());\n\tfor (i = 0; stuff[i] != NULL; i++)\n\t\tfprintf(stderr, \"%s\\n\", stuff[i]);\n\texit(code);\n}\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiff/tools/tiffcmp.c",
    "content": "/* $Id: tiffcmp.c,v 1.13 2006/06/08 11:52:27 dron Exp $ */\n\n/*\n * Copyright (c) 1988-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n#include \"tif_config.h\"\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n\n#ifdef HAVE_UNISTD_H\n# include <unistd.h>\n#endif\n\n#include \"tiffio.h\"\n\n#ifndef HAVE_GETOPT\nextern int getopt(int, char**, char*);\n#endif\n\nstatic\tint stopondiff = 1;\nstatic\tint stoponfirsttag = 1;\nstatic\tuint16 bitspersample = 1;\nstatic\tuint16 samplesperpixel = 1;\nstatic\tuint16 sampleformat = SAMPLEFORMAT_UINT;\nstatic\tuint32 imagewidth;\nstatic\tuint32 imagelength;\n\nstatic\tvoid usage(void);\nstatic\tint tiffcmp(TIFF*, TIFF*);\nstatic\tint cmptags(TIFF*, TIFF*);\nstatic\tint ContigCompare(int, uint32, unsigned char*, unsigned char*, int);\nstatic\tint SeparateCompare(int, int, uint32, unsigned char*, unsigned char*);\nstatic\tvoid PrintIntDiff(uint32, int, uint32, uint32, uint32);\nstatic\tvoid PrintFloatDiff(uint32, int, uint32, double, double);\n\nstatic\tvoid leof(const char*, uint32, int);\n\nint\nmain(int argc, char* argv[])\n{\n\tTIFF *tif1, *tif2;\n\tint c, dirnum;\n\textern int optind;\n\textern char* optarg;\n\n\twhile ((c = getopt(argc, argv, \"ltz:\")) != -1)\n\t\tswitch (c) {\n\t\tcase 'l':\n\t\t\tstopondiff = 0;\n\t\t\tbreak;\n\t\tcase 'z':\n\t\t\tstopondiff = atoi(optarg);\n\t\t\tbreak;\n\t\tcase 't':\n\t\t\tstoponfirsttag = 0;\n\t\t\tbreak;\n\t\tcase '?':\n\t\t\tusage();\n\t\t\t/*NOTREACHED*/\n\t\t}\n\tif (argc - optind < 2)\n\t\tusage();\n\ttif1 = TIFFOpen(argv[optind], \"r\");\n\tif (tif1 == NULL)\n\t\treturn (-1);\n\ttif2 = TIFFOpen(argv[optind+1], \"r\");\n\tif (tif2 == NULL)\n\t\treturn (-2);\n\tdirnum = 0;\n\twhile (tiffcmp(tif1, tif2)) {\n\t\tif (!TIFFReadDirectory(tif1)) {\n\t\t\tif (!TIFFReadDirectory(tif2))\n\t\t\t\tbreak;\n\t\t\tprintf(\"No more directories for %s\\n\",\n\t\t\t    TIFFFileName(tif1));\n\t\t\treturn (1);\n\t\t} else if (!TIFFReadDirectory(tif2)) {\n\t\t\tprintf(\"No more directories for %s\\n\",\n\t\t\t    TIFFFileName(tif2));\n\t\t\treturn (1);\n\t\t}\n\t\tprintf(\"Directory %d:\\n\", ++dirnum);\n\t}\n\n\tTIFFClose(tif1);\n\tTIFFClose(tif2);\n\treturn (0);\n}\n\nchar* stuff[] = {\n\"usage: tiffcmp [options] file1 file2\",\n\"where options are:\",\n\" -l\t\tlist each byte of image data that differs between the files\",\n\" -z #\t\tlist specified number of bytes that differs between the files\",\n\" -t\t\tignore any differences in directory tags\",\nNULL\n};\n\nstatic void\nusage(void)\n{\n\tchar buf[BUFSIZ];\n\tint i;\n\n\tsetbuf(stderr, buf);\n        fprintf(stderr, \"%s\\n\\n\", TIFFGetVersion());\n\tfor (i = 0; stuff[i] != NULL; i++)\n\t\tfprintf(stderr, \"%s\\n\", stuff[i]);\n\texit(-1);\n}\n\n#define\tcheckEOF(tif, row, sample) { \\\n\tleof(TIFFFileName(tif), row, sample); \\\n\tgoto bad; \\\n}\n\nstatic\tint CheckShortTag(TIFF*, TIFF*, int, char*);\nstatic\tint CheckShort2Tag(TIFF*, TIFF*, int, char*);\nstatic\tint CheckShortArrayTag(TIFF*, TIFF*, int, char*);\nstatic\tint CheckLongTag(TIFF*, TIFF*, int, char*);\nstatic\tint CheckFloatTag(TIFF*, TIFF*, int, char*);\nstatic\tint CheckStringTag(TIFF*, TIFF*, int, char*);\n\nstatic int\ntiffcmp(TIFF* tif1, TIFF* tif2)\n{\n\tuint16 config1, config2;\n\ttsize_t size1;\n\tuint32 row;\n\ttsample_t s;\n\tunsigned char *buf1, *buf2;\n\n\tif (!CheckShortTag(tif1, tif2, TIFFTAG_BITSPERSAMPLE, \"BitsPerSample\"))\n\t\treturn (0);\n\tif (!CheckShortTag(tif1, tif2, TIFFTAG_SAMPLESPERPIXEL, \"SamplesPerPixel\"))\n\t\treturn (0);\n\tif (!CheckLongTag(tif1, tif2, TIFFTAG_IMAGEWIDTH, \"ImageWidth\"))\n\t\treturn (0);\n\tif (!cmptags(tif1, tif2))\n\t\treturn (1);\n\t(void) TIFFGetField(tif1, TIFFTAG_BITSPERSAMPLE, &bitspersample);\n\t(void) TIFFGetField(tif1, TIFFTAG_SAMPLESPERPIXEL, &samplesperpixel);\n\t(void) TIFFGetField(tif1, TIFFTAG_SAMPLEFORMAT, &sampleformat);\n\t(void) TIFFGetField(tif1, TIFFTAG_IMAGEWIDTH, &imagewidth);\n\t(void) TIFFGetField(tif1, TIFFTAG_IMAGELENGTH, &imagelength);\n\t(void) TIFFGetField(tif1, TIFFTAG_PLANARCONFIG, &config1);\n\t(void) TIFFGetField(tif2, TIFFTAG_PLANARCONFIG, &config2);\n\tbuf1 = (unsigned char *)_TIFFmalloc(size1 = TIFFScanlineSize(tif1));\n\tbuf2 = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(tif2));\n\tif (buf1 == NULL || buf2 == NULL) {\n\t\tfprintf(stderr, \"No space for scanline buffers\\n\");\n\t\texit(-1);\n\t}\n\tif (config1 != config2 && bitspersample != 8 && samplesperpixel > 1) {\n\t\tfprintf(stderr,\n\"Can't handle different planar configuration w/ different bits/sample\\n\");\n\t\tgoto bad;\n\t}\n#define\tpack(a,b)\t((a)<<8)|(b)\n\tswitch (pack(config1, config2)) {\n\tcase pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_CONTIG):\n\t\tfor (row = 0; row < imagelength; row++) {\n\t\t\tif (TIFFReadScanline(tif2, buf2, row, 0) < 0)\n\t\t\t\tcheckEOF(tif2, row, -1)\n\t\t\tfor (s = 0; s < samplesperpixel; s++) {\n\t\t\t\tif (TIFFReadScanline(tif1, buf1, row, s) < 0)\n\t\t\t\t\tcheckEOF(tif1, row, s)\n\t\t\t\tif (SeparateCompare(1, s, row, buf2, buf1) < 0)\n\t\t\t\t\tgoto bad1;\n\t\t\t}\n\t\t}\n\t\tbreak;\n\tcase pack(PLANARCONFIG_CONTIG, PLANARCONFIG_SEPARATE):\n\t\tfor (row = 0; row < imagelength; row++) {\n\t\t\tif (TIFFReadScanline(tif1, buf1, row, 0) < 0)\n\t\t\t\tcheckEOF(tif1, row, -1)\n\t\t\tfor (s = 0; s < samplesperpixel; s++) {\n\t\t\t\tif (TIFFReadScanline(tif2, buf2, row, s) < 0)\n\t\t\t\t\tcheckEOF(tif2, row, s)\n\t\t\t\tif (SeparateCompare(0, s, row, buf1, buf2) < 0)\n\t\t\t\t\tgoto bad1;\n\t\t\t}\n\t\t}\n\t\tbreak;\n\tcase pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_SEPARATE):\n\t\tfor (s = 0; s < samplesperpixel; s++)\n\t\t\tfor (row = 0; row < imagelength; row++) {\n\t\t\t\tif (TIFFReadScanline(tif1, buf1, row, s) < 0)\n\t\t\t\t\tcheckEOF(tif1, row, s)\n\t\t\t\tif (TIFFReadScanline(tif2, buf2, row, s) < 0)\n\t\t\t\t\tcheckEOF(tif2, row, s)\n\t\t\t\tif (ContigCompare(s, row, buf1, buf2, size1) < 0)\n\t\t\t\t\tgoto bad1;\n\t\t\t}\n\t\tbreak;\n\tcase pack(PLANARCONFIG_CONTIG, PLANARCONFIG_CONTIG):\n\t\tfor (row = 0; row < imagelength; row++) {\n\t\t\tif (TIFFReadScanline(tif1, buf1, row, 0) < 0)\n\t\t\t\tcheckEOF(tif1, row, -1)\n\t\t\tif (TIFFReadScanline(tif2, buf2, row, 0) < 0)\n\t\t\t\tcheckEOF(tif2, row, -1)\n\t\t\tif (ContigCompare(-1, row, buf1, buf2, size1) < 0)\n\t\t\t\tgoto bad1;\n\t\t}\n\t\tbreak;\n\t}\n\tif (buf1) _TIFFfree(buf1);\n\tif (buf2) _TIFFfree(buf2);\n\treturn (1);\nbad:\n\tif (stopondiff)\n\t\texit(1);\nbad1:\n\tif (buf1) _TIFFfree(buf1);\n\tif (buf2) _TIFFfree(buf2);\n\treturn (0);\n}\n\n#define\tCmpShortField(tag, name) \\\n\tif (!CheckShortTag(tif1, tif2, tag, name) && stoponfirsttag) return (0)\n#define\tCmpShortField2(tag, name) \\\n\tif (!CheckShort2Tag(tif1, tif2, tag, name) && stoponfirsttag) return (0)\n#define\tCmpLongField(tag, name) \\\n\tif (!CheckLongTag(tif1, tif2, tag, name) && stoponfirsttag) return (0)\n#define\tCmpFloatField(tag, name) \\\n\tif (!CheckFloatTag(tif1, tif2, tag, name) && stoponfirsttag) return (0)\n#define\tCmpStringField(tag, name) \\\n\tif (!CheckStringTag(tif1, tif2, tag, name) && stoponfirsttag) return (0)\n#define\tCmpShortArrayField(tag, name) \\\n\tif (!CheckShortArrayTag(tif1, tif2, tag, name) && stoponfirsttag) return (0)\n\nstatic int\ncmptags(TIFF* tif1, TIFF* tif2)\n{\n\tCmpLongField(TIFFTAG_SUBFILETYPE,\t\"SubFileType\");\n\tCmpLongField(TIFFTAG_IMAGEWIDTH,\t\"ImageWidth\");\n\tCmpLongField(TIFFTAG_IMAGELENGTH,\t\"ImageLength\");\n\tCmpShortField(TIFFTAG_BITSPERSAMPLE,\t\"BitsPerSample\");\n\tCmpShortField(TIFFTAG_COMPRESSION,\t\"Compression\");\n\tCmpShortField(TIFFTAG_PREDICTOR,\t\"Predictor\");\n\tCmpShortField(TIFFTAG_PHOTOMETRIC,\t\"PhotometricInterpretation\");\n\tCmpShortField(TIFFTAG_THRESHHOLDING,\t\"Thresholding\");\n\tCmpShortField(TIFFTAG_FILLORDER,\t\"FillOrder\");\n\tCmpShortField(TIFFTAG_ORIENTATION,\t\"Orientation\");\n\tCmpShortField(TIFFTAG_SAMPLESPERPIXEL,\t\"SamplesPerPixel\");\n\tCmpShortField(TIFFTAG_MINSAMPLEVALUE,\t\"MinSampleValue\");\n\tCmpShortField(TIFFTAG_MAXSAMPLEVALUE,\t\"MaxSampleValue\");\n\tCmpShortField(TIFFTAG_SAMPLEFORMAT,\t\"SampleFormat\");\n\tCmpFloatField(TIFFTAG_XRESOLUTION,\t\"XResolution\");\n\tCmpFloatField(TIFFTAG_YRESOLUTION,\t\"YResolution\");\n\tCmpLongField(TIFFTAG_GROUP3OPTIONS,\t\"Group3Options\");\n\tCmpLongField(TIFFTAG_GROUP4OPTIONS,\t\"Group4Options\");\n\tCmpShortField(TIFFTAG_RESOLUTIONUNIT,\t\"ResolutionUnit\");\n\tCmpShortField(TIFFTAG_PLANARCONFIG,\t\"PlanarConfiguration\");\n\tCmpLongField(TIFFTAG_ROWSPERSTRIP,\t\"RowsPerStrip\");\n\tCmpFloatField(TIFFTAG_XPOSITION,\t\"XPosition\");\n\tCmpFloatField(TIFFTAG_YPOSITION,\t\"YPosition\");\n\tCmpShortField(TIFFTAG_GRAYRESPONSEUNIT, \"GrayResponseUnit\");\n\tCmpShortField(TIFFTAG_COLORRESPONSEUNIT, \"ColorResponseUnit\");\n#ifdef notdef\n\t{ uint16 *graycurve;\n\t  CmpField(TIFFTAG_GRAYRESPONSECURVE, graycurve);\n\t}\n\t{ uint16 *red, *green, *blue;\n\t  CmpField3(TIFFTAG_COLORRESPONSECURVE, red, green, blue);\n\t}\n\t{ uint16 *red, *green, *blue;\n\t  CmpField3(TIFFTAG_COLORMAP, red, green, blue);\n\t}\n#endif\n\tCmpShortField2(TIFFTAG_PAGENUMBER,\t\"PageNumber\");\n\tCmpStringField(TIFFTAG_ARTIST,\t\t\"Artist\");\n\tCmpStringField(TIFFTAG_IMAGEDESCRIPTION,\"ImageDescription\");\n\tCmpStringField(TIFFTAG_MAKE,\t\t\"Make\");\n\tCmpStringField(TIFFTAG_MODEL,\t\t\"Model\");\n\tCmpStringField(TIFFTAG_SOFTWARE,\t\"Software\");\n\tCmpStringField(TIFFTAG_DATETIME,\t\"DateTime\");\n\tCmpStringField(TIFFTAG_HOSTCOMPUTER,\t\"HostComputer\");\n\tCmpStringField(TIFFTAG_PAGENAME,\t\"PageName\");\n\tCmpStringField(TIFFTAG_DOCUMENTNAME,\t\"DocumentName\");\n\tCmpShortField(TIFFTAG_MATTEING,\t\t\"Matteing\");\n\tCmpShortArrayField(TIFFTAG_EXTRASAMPLES,\"ExtraSamples\");\n\treturn (1);\n}\n\nstatic int\nContigCompare(int sample, uint32 row,\n\t      unsigned char* p1, unsigned char* p2, int size)\n{\n    uint32 pix;\n    int ppb = 8 / bitspersample;\n    int\t samples_to_test;\n\n    if (memcmp(p1, p2, size) == 0)\n        return 0;\n\n    samples_to_test = (sample == -1) ? samplesperpixel : 1;\n\n    switch (bitspersample) {\n      case 1: case 2: case 4: case 8: \n      {\n          unsigned char *pix1 = p1, *pix2 = p2;\n\n          for (pix = 0; pix < imagewidth; pix += ppb) {\n              int\t\ts;\n\n              for(s = 0; s < samples_to_test; s++) {\n                  if (*pix1 != *pix2) {\n                      if( sample == -1 )\n                          PrintIntDiff(row, s, pix, *pix1, *pix2);\n                      else\n                          PrintIntDiff(row, sample, pix, *pix1, *pix2);\n                  }\n\n                  pix1++;\n                  pix2++;\n              }\n          }\n          break;\n      }\n      case 16: \n      {\n          uint16 *pix1 = (uint16 *)p1, *pix2 = (uint16 *)p2;\n\n          for (pix = 0; pix < imagewidth; pix++) {\n              int\ts;\n\n              for(s = 0; s < samples_to_test; s++) {\n                  if (*pix1 != *pix2)\n                      PrintIntDiff(row, sample, pix, *pix1, *pix2);\n                        \n                  pix1++;\n                  pix2++;\n              }\n          }\n          break;\n      }\n      case 32: \n\tif (sampleformat == SAMPLEFORMAT_UINT\n\t    || sampleformat == SAMPLEFORMAT_INT) {\n\t\tuint32 *pix1 = (uint32 *)p1, *pix2 = (uint32 *)p2;\n\n\t\tfor (pix = 0; pix < imagewidth; pix++) {\n\t\t\tint\ts;\n\n\t\t\tfor(s = 0; s < samples_to_test; s++) {\n\t\t\t\tif (*pix1 != *pix2) {\n\t\t\t\t\tPrintIntDiff(row, sample, pix,\n\t\t\t\t\t\t     *pix1, *pix2);\n\t\t\t\t}\n                        \n\t\t\t\tpix1++;\n\t\t\t\tpix2++;\n\t\t\t}\n\t\t}\n\t} else if (sampleformat == SAMPLEFORMAT_IEEEFP) {\n\t\tfloat *pix1 = (float *)p1, *pix2 = (float *)p2;\n\n\t\tfor (pix = 0; pix < imagewidth; pix++) {\n\t\t\tint\ts;\n\n\t\t\tfor(s = 0; s < samples_to_test; s++) {\n\t\t\t\tif (fabs(*pix1 - *pix2) < 0.000000000001) {\n\t\t\t\t\tPrintFloatDiff(row, sample, pix,\n\t\t\t\t\t\t       *pix1, *pix2);\n\t\t\t\t}\n                        \n\t\t\t\tpix1++;\n\t\t\t\tpix2++;\n\t\t\t}\n\t\t}\n\t} else {\n\t\t  fprintf(stderr, \"Sample format %d is not supported.\\n\",\n\t\t\t  sampleformat);\n\t\t  return -1;\n\t}\n        break;\n      default:\n\tfprintf(stderr, \"Bit depth %d is not supported.\\n\", bitspersample);\n\treturn -1;\n    }\n\n    return 0;\n}\n\nstatic void\nPrintIntDiff(uint32 row, int sample, uint32 pix, uint32 w1, uint32 w2)\n{\n\tif (sample < 0)\n\t\tsample = 0;\n\tswitch (bitspersample) {\n\tcase 1:\n\tcase 2:\n\tcase 4:\n\t    {\n\t\tint32 mask1, mask2, s;\n\n\t\tmask1 =  ~((-1) << bitspersample);\n\t\ts = (8 - bitspersample);\n\t\tmask2 = mask1 << s;\n\t\tfor (; mask2 && pix < imagewidth;\n\t\t     mask2 >>= bitspersample, s -= bitspersample, pix++) {\n\t\t\tif ((w1 & mask2) ^ (w2 & mask2)) {\n\t\t\t\tprintf(\n\t\t\t\"Scanline %lu, pixel %lu, sample %d: %01x %01x\\n\",\n\t    \t\t\t\t(unsigned long) row,\n\t\t\t\t\t(unsigned long) pix,\n\t\t\t\t\tsample,\n\t\t\t\t\t(unsigned int)((w1 >> s) & mask1),\n\t\t\t\t\t(unsigned int)((w2 >> s) & mask1));\n\t\t\t\tif (--stopondiff == 0)\n\t\t\t\t\texit(1);\n\t\t\t}\n\t\t}\n\t\tbreak;\n\t    }\n\tcase 8: \n\t\tprintf(\"Scanline %lu, pixel %lu, sample %d: %02x %02x\\n\",\n\t\t       (unsigned long) row, (unsigned long) pix, sample,\n\t\t       (unsigned int) w1, (unsigned int) w2);\n\t\tif (--stopondiff == 0)\n\t\t\texit(1);\n\t\tbreak;\n\tcase 16:\n\t\tprintf(\"Scanline %lu, pixel %lu, sample %d: %04x %04x\\n\",\n\t\t    (unsigned long) row, (unsigned long) pix, sample,\n\t\t    (unsigned int) w1, (unsigned int) w2);\n\t\tif (--stopondiff == 0)\n\t\t\texit(1);\n\t\tbreak;\n\tcase 32:\n\t\tprintf(\"Scanline %lu, pixel %lu, sample %d: %08x %08x\\n\",\n\t\t    (unsigned long) row, (unsigned long) pix, sample,\n\t\t    (unsigned int) w1, (unsigned int) w2);\n\t\tif (--stopondiff == 0)\n\t\t\texit(1);\n\t\tbreak;\n\tdefault:\n\t\tbreak;\n\t}\n}\n\nstatic void\nPrintFloatDiff(uint32 row, int sample, uint32 pix, double w1, double w2)\n{\n\tif (sample < 0)\n\t\tsample = 0;\n\tswitch (bitspersample) {\n\tcase 32: \n\t\tprintf(\"Scanline %lu, pixel %lu, sample %d: %g %g\\n\",\n\t\t    (long) row, (long) pix, sample, w1, w2);\n\t\tif (--stopondiff == 0)\n\t\t\texit(1);\n\t\tbreak;\n\tdefault:\n\t\tbreak;\n\t}\n}\n\nstatic int\nSeparateCompare(int reversed, int sample, uint32 row,\n\t\tunsigned char* cp1, unsigned char* p2)\n{\n\tuint32 npixels = imagewidth;\n\tint pixel;\n\n\tcp1 += sample;\n\tfor (pixel = 0; npixels-- > 0; pixel++, cp1 += samplesperpixel, p2++) {\n\t\tif (*cp1 != *p2) {\n\t\t\tprintf(\"Scanline %lu, pixel %lu, sample %ld: \",\n\t\t\t    (long) row, (long) pixel, (long) sample);\n\t\t\tif (reversed)\n\t\t\t\tprintf(\"%02x %02x\\n\", *p2, *cp1);\n\t\t\telse\n\t\t\t\tprintf(\"%02x %02x\\n\", *cp1, *p2);\n\t\t\tif (--stopondiff == 0)\n\t\t\t\texit(1);\n\t\t}\n\t}\n\n\treturn 0;\n}\n\nstatic int\ncheckTag(TIFF* tif1, TIFF* tif2, int tag, char* name, void* p1, void* p2)\n{\n\n\tif (TIFFGetField(tif1, tag, p1)) {\n\t\tif (!TIFFGetField(tif2, tag, p2)) {\n\t\t\tprintf(\"%s tag appears only in %s\\n\",\n\t\t\t    name, TIFFFileName(tif1));\n\t\t\treturn (0);\n\t\t}\n\t\treturn (1);\n\t} else if (TIFFGetField(tif2, tag, p2)) {\n\t\tprintf(\"%s tag appears only in %s\\n\", name, TIFFFileName(tif2));\n\t\treturn (0);\n\t}\n\treturn (-1);\n}\n\n#define\tCHECK(cmp, fmt) {\t\t\t\t\\\n\tswitch (checkTag(tif1,tif2,tag,name,&v1,&v2)) {\t\\\n\tcase 1:\tif (cmp)\t\t\t\t\\\n\tcase -1:\treturn (1);\t\t\t\\\n\t\tprintf(fmt, name, v1, v2);\t\t\\\n\t}\t\t\t\t\t\t\\\n\treturn (0);\t\t\t\t\t\\\n}\n\nstatic int\nCheckShortTag(TIFF* tif1, TIFF* tif2, int tag, char* name)\n{\n\tuint16 v1, v2;\n\tCHECK(v1 == v2, \"%s: %u %u\\n\");\n}\n\nstatic int\nCheckShort2Tag(TIFF* tif1, TIFF* tif2, int tag, char* name)\n{\n\tuint16 v11, v12, v21, v22;\n\n\tif (TIFFGetField(tif1, tag, &v11, &v12)) {\n\t\tif (!TIFFGetField(tif2, tag, &v21, &v22)) {\n\t\t\tprintf(\"%s tag appears only in %s\\n\",\n\t\t\t    name, TIFFFileName(tif1));\n\t\t\treturn (0);\n\t\t}\n\t\tif (v11 == v21 && v12 == v22)\n\t\t\treturn (1);\n\t\tprintf(\"%s: <%u,%u> <%u,%u>\\n\", name, v11, v12, v21, v22);\n\t} else if (TIFFGetField(tif2, tag, &v21, &v22))\n\t\tprintf(\"%s tag appears only in %s\\n\", name, TIFFFileName(tif2));\n\telse\n\t\treturn (1);\n\treturn (0);\n}\n\nstatic int\nCheckShortArrayTag(TIFF* tif1, TIFF* tif2, int tag, char* name)\n{\n\tuint16 n1, *a1;\n\tuint16 n2, *a2;\n\n\tif (TIFFGetField(tif1, tag, &n1, &a1)) {\n\t\tif (!TIFFGetField(tif2, tag, &n2, &a2)) {\n\t\t\tprintf(\"%s tag appears only in %s\\n\",\n\t\t\t    name, TIFFFileName(tif1));\n\t\t\treturn (0);\n\t\t}\n\t\tif (n1 == n2) {\n\t\t\tchar* sep;\n\t\t\tuint16 i;\n\n\t\t\tif (memcmp(a1, a2, n1 * sizeof(uint16)) == 0)\n\t\t\t\treturn (1);\n\t\t\tprintf(\"%s: value mismatch, <%u:\", name, n1);\n\t\t\tsep = \"\";\n\t\t\tfor (i = 0; i < n1; i++)\n\t\t\t\tprintf(\"%s%u\", sep, a1[i]), sep = \",\";\n\t\t\tprintf(\"> and <%u: \", n2);\n\t\t\tsep = \"\";\n\t\t\tfor (i = 0; i < n2; i++)\n\t\t\t\tprintf(\"%s%u\", sep, a2[i]), sep = \",\";\n\t\t\tprintf(\">\\n\");\n\t\t} else\n\t\t\tprintf(\"%s: %u items in %s, %u items in %s\", name,\n\t\t\t    n1, TIFFFileName(tif1),\n\t\t\t    n2, TIFFFileName(tif2)\n\t\t\t);\n\t} else if (TIFFGetField(tif2, tag, &n2, &a2))\n\t\tprintf(\"%s tag appears only in %s\\n\", name, TIFFFileName(tif2));\n\telse\n\t\treturn (1);\n\treturn (0);\n}\n\nstatic int\nCheckLongTag(TIFF* tif1, TIFF* tif2, int tag, char* name)\n{\n\tuint32 v1, v2;\n\tCHECK(v1 == v2, \"%s: %u %u\\n\");\n}\n\nstatic int\nCheckFloatTag(TIFF* tif1, TIFF* tif2, int tag, char* name)\n{\n\tfloat v1, v2;\n\tCHECK(v1 == v2, \"%s: %g %g\\n\");\n}\n\nstatic int\nCheckStringTag(TIFF* tif1, TIFF* tif2, int tag, char* name)\n{\n\tchar *v1, *v2;\n\tCHECK(strcmp(v1, v2) == 0, \"%s: \\\"%s\\\" \\\"%s\\\"\\n\");\n}\n\nstatic void\nleof(const char* name, uint32 row, int s)\n{\n\n\tprintf(\"%s: EOF at scanline %lu\", name, (unsigned long)row);\n\tif (s >= 0)\n\t\tprintf(\", sample %d\", s);\n\tprintf(\"\\n\");\n}\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiff/tools/tiffcp.c",
    "content": "/* $Id: tiffcp.c,v 1.37.2.1 2009-01-01 00:10:43 bfriesen Exp $ */\n\n/*\n * Copyright (c) 1988-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n *\n *  Revised:  2/18/01 BAR -- added syntax for extracting single images from\n *                          multi-image TIFF files.\n *\n *    New syntax is:  sourceFileName,image#\n *\n * image# ranges from 0..<n-1> where n is the # of images in the file.\n * There may be no white space between the comma and the filename or\n * image number.\n *\n *    Example:   tiffcp source.tif,1 destination.tif\n *\n * Copies the 2nd image in source.tif to the destination.\n *\n *****\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n#include \"tif_config.h\"\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n#include <ctype.h>\n#include <assert.h>\n\n#ifdef HAVE_UNISTD_H\n# include <unistd.h>\n#endif\n\n#include \"tiffio.h\"\n\n#ifndef HAVE_GETOPT\nextern int getopt(int, char**, char*);\n#endif\n\n#if defined(VMS)\n# define unlink delete\n#endif\n\n#define\tstreq(a,b)\t(strcmp(a,b) == 0)\n#define\tstrneq(a,b,n)\t(strncmp(a,b,n) == 0)\n\n#define\tTRUE\t1\n#define\tFALSE\t0\n\nstatic  int outtiled = -1;\nstatic  uint32 tilewidth;\nstatic  uint32 tilelength;\n\nstatic\tuint16 config;\nstatic\tuint16 compression;\nstatic\tuint16 predictor;\nstatic\tuint16 fillorder;\nstatic\tuint16 orientation;\nstatic\tuint32 rowsperstrip;\nstatic\tuint32 g3opts;\nstatic\tint ignore = FALSE;\t\t/* if true, ignore read errors */\nstatic\tuint32 defg3opts = (uint32) -1;\nstatic\tint quality = 75;\t\t/* JPEG quality */\nstatic\tint jpegcolormode = JPEGCOLORMODE_RGB;\nstatic\tuint16 defcompression = (uint16) -1;\nstatic\tuint16 defpredictor = (uint16) -1;\n\nstatic\tint tiffcp(TIFF*, TIFF*);\nstatic\tint processCompressOptions(char*);\nstatic\tvoid usage(void);\n\nstatic char comma = ',';  /* (default) comma separator character */\nstatic TIFF* bias = NULL;\nstatic int pageNum = 0;\n\nstatic int nextSrcImage (TIFF *tif, char **imageSpec)\n/*\n  seek to the next image specified in *imageSpec\n  returns 1 if success, 0 if no more images to process\n  *imageSpec=NULL if subsequent images should be processed in sequence\n*/\n{\n  if (**imageSpec == comma) {  /* if not @comma, we've done all images */\n    char *start = *imageSpec + 1;\n    tdir_t nextImage = (tdir_t)strtol(start, imageSpec, 0);\n    if (start == *imageSpec) nextImage = TIFFCurrentDirectory (tif);\n    if (**imageSpec)\n    {\n      if (**imageSpec == comma) {  \n        /* a trailing comma denotes remaining images in sequence */\n        if ((*imageSpec)[1] == '\\0') *imageSpec = NULL;\n      }else{\n        fprintf (stderr, \n          \"Expected a %c separated image # list after %s\\n\",\n          comma, TIFFFileName (tif));\n        exit (-4);   /* syntax error */\n      }\n    }\n    if (TIFFSetDirectory (tif, nextImage)) return 1;  \n    fprintf (stderr, \"%s%c%d not found!\\n\", \n             TIFFFileName(tif), comma, (int) nextImage); \n  }\n  return 0;\n}\n\n  \nstatic TIFF* openSrcImage (char **imageSpec)\n/*\n  imageSpec points to a pointer to a filename followed by optional ,image#'s\n  Open the TIFF file and assign *imageSpec to either NULL if there are\n  no images specified, or a pointer to the next image number text\n*/\n{\n    TIFF *tif;\n    char *fn = *imageSpec;\n    *imageSpec = strchr (fn, comma);\n    if (*imageSpec) {  /* there is at least one image number specifier */\n        **imageSpec = '\\0'; \n        tif = TIFFOpen (fn, \"r\");\n        /* but, ignore any single trailing comma */\n        if (!(*imageSpec)[1]) {*imageSpec = NULL; return tif;}\n        if (tif) { \n            **imageSpec = comma;  /* replace the comma */\n            if (!nextSrcImage(tif, imageSpec)) {\n              TIFFClose (tif);\n              tif = NULL;\n            }\n        }\n    }else\n        tif = TIFFOpen (fn, \"r\");\n    return tif;\n}\n\n\nint\nmain(int argc, char* argv[])\n{\n\tuint16 defconfig = (uint16) -1;\n\tuint16 deffillorder = 0;\n\tuint32 deftilewidth = (uint32) -1;\n\tuint32 deftilelength = (uint32) -1;\n\tuint32 defrowsperstrip = (uint32) 0;\n\tuint32 diroff = 0;\n\tTIFF* in;\n\tTIFF* out;\n\tchar mode[10];\n\tchar* mp = mode;\n\tint c;\n\textern int optind;\n\textern char* optarg;\n\n\t*mp++ = 'w';\n\t*mp = '\\0';\n\twhile ((c = getopt(argc, argv, \",:b:c:f:l:o:z:p:r:w:aistBLMC\")) != -1)\n\t\tswitch (c) {\n                case ',':\n                        if (optarg[0] != '=') usage();\n                        comma = optarg[1];\n                        break;\n                case 'b':   /* this file is bias image subtracted from others */\n                        if (bias) {\n                          fputs (\"Only 1 bias image may be specified\\n\", stderr);\n                          exit (-2);\n                        }\n                        {\n                          uint16    samples = (uint16) -1;\n                          char **biasFn = &optarg;\n                          bias = openSrcImage (biasFn);\n                          if (!bias) exit (-5);\n                          if (TIFFIsTiled (bias)) {\n                     fputs (\"Bias image must be organized in strips\\n\", stderr);\n                            exit (-7);\n                          }\n\t\t\t  TIFFGetField(bias, TIFFTAG_SAMPLESPERPIXEL, &samples);\n                          if (samples != 1) {\n                     fputs (\"Bias image must be monochrome\\n\", stderr);\n                            exit (-7);\n                          }\n                        }\n                        break;\n\t\tcase 'a':\t\t/* append to output */\n\t\t\tmode[0] = 'a';\n\t\t\tbreak;\n\t\tcase 'c':\t\t/* compression scheme */\n\t\t\tif (!processCompressOptions(optarg))\n\t\t\t\tusage();\n\t\t\tbreak;\n\t\tcase 'f':\t\t/* fill order */\n\t\t\tif (streq(optarg, \"lsb2msb\"))\n\t\t\t\tdeffillorder = FILLORDER_LSB2MSB;\n\t\t\telse if (streq(optarg, \"msb2lsb\"))\n\t\t\t\tdeffillorder = FILLORDER_MSB2LSB;\n\t\t\telse\n\t\t\t\tusage();\n\t\t\tbreak;\n\t\tcase 'i':\t\t/* ignore errors */\n\t\t\tignore = TRUE;\n\t\t\tbreak;\n\t\tcase 'l':\t\t/* tile length */\n\t\t\touttiled = TRUE;\n\t\t\tdeftilelength = atoi(optarg);\n\t\t\tbreak;\n\t\tcase 'o':\t\t/* initial directory offset */\n\t\t\tdiroff = strtoul(optarg, NULL, 0);\n\t\t\tbreak;\n\t\tcase 'p':\t\t/* planar configuration */\n\t\t\tif (streq(optarg, \"separate\"))\n\t\t\t\tdefconfig = PLANARCONFIG_SEPARATE;\n\t\t\telse if (streq(optarg, \"contig\"))\n\t\t\t\tdefconfig = PLANARCONFIG_CONTIG;\n\t\t\telse\n\t\t\t\tusage();\n\t\t\tbreak;\n\t\tcase 'r':\t\t/* rows/strip */\n\t\t\tdefrowsperstrip = atol(optarg);\n\t\t\tbreak;\n\t\tcase 's':\t\t/* generate stripped output */\n\t\t\touttiled = FALSE;\n\t\t\tbreak;\n\t\tcase 't':\t\t/* generate tiled output */\n\t\t\touttiled = TRUE;\n\t\t\tbreak;\n\t\tcase 'w':\t\t/* tile width */\n\t\t\touttiled = TRUE;\n\t\t\tdeftilewidth = atoi(optarg);\n\t\t\tbreak;\n\t\tcase 'B':\n\t\t\t*mp++ = 'b'; *mp = '\\0';\n\t\t\tbreak;\n\t\tcase 'L':\n\t\t\t*mp++ = 'l'; *mp = '\\0';\n\t\t\tbreak;\n\t\tcase 'M':\n\t\t\t*mp++ = 'm'; *mp = '\\0';\n\t\t\tbreak;\n\t\tcase 'C':\n\t\t\t*mp++ = 'c'; *mp = '\\0';\n\t\t\tbreak;\n\t\tcase '?':\n\t\t\tusage();\n\t\t\t/*NOTREACHED*/\n\t\t}\n\tif (argc - optind < 2)\n\t\tusage();\n\tout = TIFFOpen(argv[argc-1], mode);\n\tif (out == NULL)\n\t\treturn (-2);\n\tif ((argc - optind) == 2)\n\t  pageNum = -1;\n\tfor (; optind < argc-1 ; optind++) {\n                char *imageCursor = argv[optind];\n\t\tin = openSrcImage (&imageCursor);\n\t\tif (in == NULL)\n\t\t\treturn (-3);\n\t\tif (diroff != 0 && !TIFFSetSubDirectory(in, diroff)) {\n\t\t\tTIFFError(TIFFFileName(in),\n\t\t\t    \"Error, setting subdirectory at %#x\", diroff);\n\t\t\t(void) TIFFClose(out);\n\t\t\treturn (1);\n\t\t}\n                for (;;) {\n                   config = defconfig;\n                   compression = defcompression;\n                   predictor = defpredictor;\n                   fillorder = deffillorder;\n                   rowsperstrip = defrowsperstrip;\n                   tilewidth = deftilewidth;\n                   tilelength = deftilelength;\n                   g3opts = defg3opts;\n                   if (!tiffcp(in, out) || !TIFFWriteDirectory(out)) {\n                        TIFFClose(out);\n                        return (1);\n                   }\n                   if (imageCursor) { /* seek next image directory */\n                        if (!nextSrcImage(in, &imageCursor)) break;\n                   }else\n                        if (!TIFFReadDirectory(in)) break;\n\t\t}\n\t\tTIFFClose(in);\n\t}\n\n        TIFFClose(out);\n        return (0);\n}\n\n\nstatic void\nprocessG3Options(char* cp)\n{\n\tif( (cp = strchr(cp, ':')) ) {\n\t\tif (defg3opts == (uint32) -1)\n\t\t\tdefg3opts = 0;\n\t\tdo {\n\t\t\tcp++;\n\t\t\tif (strneq(cp, \"1d\", 2))\n\t\t\t\tdefg3opts &= ~GROUP3OPT_2DENCODING;\n\t\t\telse if (strneq(cp, \"2d\", 2))\n\t\t\t\tdefg3opts |= GROUP3OPT_2DENCODING;\n\t\t\telse if (strneq(cp, \"fill\", 4))\n\t\t\t\tdefg3opts |= GROUP3OPT_FILLBITS;\n\t\t\telse\n\t\t\t\tusage();\n\t\t} while( (cp = strchr(cp, ':')) );\n\t}\n}\n\nstatic int\nprocessCompressOptions(char* opt)\n{\n\tif (streq(opt, \"none\")) {\n\t\tdefcompression = COMPRESSION_NONE;\n\t} else if (streq(opt, \"packbits\")) {\n\t\tdefcompression = COMPRESSION_PACKBITS;\n\t} else if (strneq(opt, \"jpeg\", 4)) {\n\t\tchar* cp = strchr(opt, ':');\n\n                defcompression = COMPRESSION_JPEG;\n                while( cp )\n                {\n                    if (isdigit((int)cp[1]))\n\t\t\tquality = atoi(cp+1);\n                    else if (cp[1] == 'r' )\n\t\t\tjpegcolormode = JPEGCOLORMODE_RAW;\n                    else\n                        usage();\n\n                    cp = strchr(cp+1,':');\n                }\n\t} else if (strneq(opt, \"g3\", 2)) {\n\t\tprocessG3Options(opt);\n\t\tdefcompression = COMPRESSION_CCITTFAX3;\n\t} else if (streq(opt, \"g4\")) {\n\t\tdefcompression = COMPRESSION_CCITTFAX4;\n\t} else if (strneq(opt, \"lzw\", 3)) {\n\t\tchar* cp = strchr(opt, ':');\n\t\tif (cp)\n\t\t\tdefpredictor = atoi(cp+1);\n\t\tdefcompression = COMPRESSION_LZW;\n\t} else if (strneq(opt, \"zip\", 3)) {\n\t\tchar* cp = strchr(opt, ':');\n\t\tif (cp)\n\t\t\tdefpredictor = atoi(cp+1);\n\t\tdefcompression = COMPRESSION_ADOBE_DEFLATE;\n\t} else if (strneq(opt, \"jbig\", 4)) {\n\t\tdefcompression = COMPRESSION_JBIG;\n\t} else\n\t\treturn (0);\n\treturn (1);\n}\n\nchar* stuff[] = {\n\"usage: tiffcp [options] input... output\",\n\"where options are:\",\n\" -a\t\tappend to output instead of overwriting\",\n\" -o offset\tset initial directory offset\",\n\" -p contig\tpack samples contiguously (e.g. RGBRGB...)\",\n\" -p separate\tstore samples separately (e.g. RRR...GGG...BBB...)\",\n\" -s\t\twrite output in strips\",\n\" -t\t\twrite output in tiles\",\n\" -i\t\tignore read errors\",\n\" -b file[,#]\tbias (dark) monochrome image to be subtracted from all others\",\n\" -,=%\t\tuse % rather than , to separate image #'s (per Note below)\",           \n\"\",\n\" -r #\t\tmake each strip have no more than # rows\",\n\" -w #\t\tset output tile width (pixels)\",\n\" -l #\t\tset output tile length (pixels)\",\n\"\",\n\" -f lsb2msb\tforce lsb-to-msb FillOrder for output\",\n\" -f msb2lsb\tforce msb-to-lsb FillOrder for output\",\n\"\",\n\" -c lzw[:opts]\tcompress output with Lempel-Ziv & Welch encoding\",\n\" -c zip[:opts]\tcompress output with deflate encoding\",\n\" -c jpeg[:opts]\tcompress output with JPEG encoding\",\n\" -c jbig\tcompress output with ISO JBIG encoding\",\n\" -c packbits\tcompress output with packbits encoding\",\n\" -c g3[:opts]\tcompress output with CCITT Group 3 encoding\",\n\" -c g4\t\tcompress output with CCITT Group 4 encoding\",\n\" -c none\tuse no compression algorithm on output\",\n\"\",\n\"Group 3 options:\",\n\" 1d\t\tuse default CCITT Group 3 1D-encoding\",\n\" 2d\t\tuse optional CCITT Group 3 2D-encoding\",\n\" fill\t\tbyte-align EOL codes\",\n\"For example, -c g3:2d:fill to get G3-2D-encoded data with byte-aligned EOLs\",\n\"\",\n\"JPEG options:\",\n\" #\t\tset compression quality level (0-100, default 75)\",\n\" r\t\toutput color image as RGB rather than YCbCr\",\n\"For example, -c jpeg:r:50 to get JPEG-encoded RGB data with 50% comp. quality\",\n\"\",\n\"LZW and deflate options:\",\n\" #\t\tset predictor value\",\n\"For example, -c lzw:2 to get LZW-encoded data with horizontal differencing\",\n\"\",\n\"Note that input filenames may be of the form filename,x,y,z\",\n\"where x, y, and z specify image numbers in the filename to copy.\",\n\"example:  tiffcp -c none -b esp.tif,1 esp.tif,0 test.tif\",\n\"  subtract 2nd image in esp.tif from 1st yielding uncompressed result test.tif\",\nNULL\n};\n\nstatic void\nusage(void)\n{\n\tchar buf[BUFSIZ];\n\tint i;\n\n\tsetbuf(stderr, buf);\n        fprintf(stderr, \"%s\\n\\n\", TIFFGetVersion());\n\tfor (i = 0; stuff[i] != NULL; i++)\n\t\tfprintf(stderr, \"%s\\n\", stuff[i]);\n\texit(-1);\n}\n\n#define\tCopyField(tag, v) \\\n    if (TIFFGetField(in, tag, &v)) TIFFSetField(out, tag, v)\n#define\tCopyField2(tag, v1, v2) \\\n    if (TIFFGetField(in, tag, &v1, &v2)) TIFFSetField(out, tag, v1, v2)\n#define\tCopyField3(tag, v1, v2, v3) \\\n    if (TIFFGetField(in, tag, &v1, &v2, &v3)) TIFFSetField(out, tag, v1, v2, v3)\n#define\tCopyField4(tag, v1, v2, v3, v4) \\\n    if (TIFFGetField(in, tag, &v1, &v2, &v3, &v4)) TIFFSetField(out, tag, v1, v2, v3, v4)\n\nstatic void\ncpTag(TIFF* in, TIFF* out, uint16 tag, uint16 count, TIFFDataType type)\n{\n\tswitch (type) {\n\tcase TIFF_SHORT:\n\t\tif (count == 1) {\n\t\t\tuint16 shortv;\n\t\t\tCopyField(tag, shortv);\n\t\t} else if (count == 2) {\n\t\t\tuint16 shortv1, shortv2;\n\t\t\tCopyField2(tag, shortv1, shortv2);\n\t\t} else if (count == 4) {\n\t\t\tuint16 *tr, *tg, *tb, *ta;\n\t\t\tCopyField4(tag, tr, tg, tb, ta);\n\t\t} else if (count == (uint16) -1) {\n\t\t\tuint16 shortv1;\n\t\t\tuint16* shortav;\n\t\t\tCopyField2(tag, shortv1, shortav);\n\t\t}\n\t\tbreak;\n\tcase TIFF_LONG:\n\t\t{ uint32 longv;\n\t\t  CopyField(tag, longv);\n\t\t}\n\t\tbreak;\n\tcase TIFF_RATIONAL:\n\t\tif (count == 1) {\n\t\t\tfloat floatv;\n\t\t\tCopyField(tag, floatv);\n\t\t} else if (count == (uint16) -1) {\n\t\t\tfloat* floatav;\n\t\t\tCopyField(tag, floatav);\n\t\t}\n\t\tbreak;\n\tcase TIFF_ASCII:\n\t\t{ char* stringv;\n\t\t  CopyField(tag, stringv);\n\t\t}\n\t\tbreak;\n\tcase TIFF_DOUBLE:\n\t\tif (count == 1) {\n\t\t\tdouble doublev;\n\t\t\tCopyField(tag, doublev);\n\t\t} else if (count == (uint16) -1) {\n\t\t\tdouble* doubleav;\n\t\t\tCopyField(tag, doubleav);\n\t\t}\n\t\tbreak;\n          default:\n                TIFFError(TIFFFileName(in),\n                          \"Data type %d is not supported, tag %d skipped.\",\n                          tag, type);\n\t}\n}\n\nstatic struct cpTag {\n\tuint16\ttag;\n\tuint16\tcount;\n\tTIFFDataType type;\n} tags[] = {\n\t{ TIFFTAG_SUBFILETYPE,\t\t1, TIFF_LONG },\n\t{ TIFFTAG_THRESHHOLDING,\t1, TIFF_SHORT },\n\t{ TIFFTAG_DOCUMENTNAME,\t\t1, TIFF_ASCII },\n\t{ TIFFTAG_IMAGEDESCRIPTION,\t1, TIFF_ASCII },\n\t{ TIFFTAG_MAKE,\t\t\t1, TIFF_ASCII },\n\t{ TIFFTAG_MODEL,\t\t1, TIFF_ASCII },\n\t{ TIFFTAG_MINSAMPLEVALUE,\t1, TIFF_SHORT },\n\t{ TIFFTAG_MAXSAMPLEVALUE,\t1, TIFF_SHORT },\n\t{ TIFFTAG_XRESOLUTION,\t\t1, TIFF_RATIONAL },\n\t{ TIFFTAG_YRESOLUTION,\t\t1, TIFF_RATIONAL },\n\t{ TIFFTAG_PAGENAME,\t\t1, TIFF_ASCII },\n\t{ TIFFTAG_XPOSITION,\t\t1, TIFF_RATIONAL },\n\t{ TIFFTAG_YPOSITION,\t\t1, TIFF_RATIONAL },\n\t{ TIFFTAG_RESOLUTIONUNIT,\t1, TIFF_SHORT },\n\t{ TIFFTAG_SOFTWARE,\t\t1, TIFF_ASCII },\n\t{ TIFFTAG_DATETIME,\t\t1, TIFF_ASCII },\n\t{ TIFFTAG_ARTIST,\t\t1, TIFF_ASCII },\n\t{ TIFFTAG_HOSTCOMPUTER,\t\t1, TIFF_ASCII },\n\t{ TIFFTAG_WHITEPOINT,\t\t(uint16) -1, TIFF_RATIONAL },\n\t{ TIFFTAG_PRIMARYCHROMATICITIES,(uint16) -1,TIFF_RATIONAL },\n\t{ TIFFTAG_HALFTONEHINTS,\t2, TIFF_SHORT },\n\t{ TIFFTAG_INKSET,\t\t1, TIFF_SHORT },\n\t{ TIFFTAG_DOTRANGE,\t\t2, TIFF_SHORT },\n\t{ TIFFTAG_TARGETPRINTER,\t1, TIFF_ASCII },\n\t{ TIFFTAG_SAMPLEFORMAT,\t\t1, TIFF_SHORT },\n\t{ TIFFTAG_YCBCRCOEFFICIENTS,\t(uint16) -1,TIFF_RATIONAL },\n\t{ TIFFTAG_YCBCRSUBSAMPLING,\t2, TIFF_SHORT },\n\t{ TIFFTAG_YCBCRPOSITIONING,\t1, TIFF_SHORT },\n\t{ TIFFTAG_REFERENCEBLACKWHITE,\t(uint16) -1,TIFF_RATIONAL },\n\t{ TIFFTAG_EXTRASAMPLES,\t\t(uint16) -1, TIFF_SHORT },\n\t{ TIFFTAG_SMINSAMPLEVALUE,\t1, TIFF_DOUBLE },\n\t{ TIFFTAG_SMAXSAMPLEVALUE,\t1, TIFF_DOUBLE },\n\t{ TIFFTAG_STONITS,\t\t1, TIFF_DOUBLE },\n};\n#define\tNTAGS\t(sizeof (tags) / sizeof (tags[0]))\n\n#define\tCopyTag(tag, count, type)\tcpTag(in, out, tag, count, type)\n\ntypedef int (*copyFunc)\n    (TIFF* in, TIFF* out, uint32 l, uint32 w, uint16 samplesperpixel);\nstatic\tcopyFunc pickCopyFunc(TIFF*, TIFF*, uint16, uint16);\n\nstatic int\ntiffcp(TIFF* in, TIFF* out)\n{\n\tuint16 bitspersample, samplesperpixel;\n\tcopyFunc cf;\n\tuint32 width, length;\n\tstruct cpTag* p;\n\n\tCopyField(TIFFTAG_IMAGEWIDTH, width);\n\tCopyField(TIFFTAG_IMAGELENGTH, length);\n\tCopyField(TIFFTAG_BITSPERSAMPLE, bitspersample);\n\tCopyField(TIFFTAG_SAMPLESPERPIXEL, samplesperpixel);\n\tif (compression != (uint16)-1)\n\t\tTIFFSetField(out, TIFFTAG_COMPRESSION, compression);\n\telse\n\t\tCopyField(TIFFTAG_COMPRESSION, compression);\n\tif (compression == COMPRESSION_JPEG) {\n\t    uint16 input_compression, input_photometric;\n\n            if (TIFFGetField(in, TIFFTAG_COMPRESSION, &input_compression)\n                 && input_compression == COMPRESSION_JPEG) {\n                TIFFSetField(in, TIFFTAG_JPEGCOLORMODE, JPEGCOLORMODE_RGB);\n            }\n\t    if (TIFFGetField(in, TIFFTAG_PHOTOMETRIC, &input_photometric)) {\n\t\tif(input_photometric == PHOTOMETRIC_RGB) {\n\t\t\tif (jpegcolormode == JPEGCOLORMODE_RGB)\n\t\t    \t\tTIFFSetField(out, TIFFTAG_PHOTOMETRIC,\n\t\t\t\t\t     PHOTOMETRIC_YCBCR);\n\t\t\telse\n\t\t    \t\tTIFFSetField(out, TIFFTAG_PHOTOMETRIC,\n\t\t\t\t\t     PHOTOMETRIC_RGB);\n\t\t} else\n\t\t\tTIFFSetField(out, TIFFTAG_PHOTOMETRIC,\n\t\t\t\t     input_photometric);\n\t    }\n        }\n\telse if (compression == COMPRESSION_SGILOG\n\t\t || compression == COMPRESSION_SGILOG24)\n\t\tTIFFSetField(out, TIFFTAG_PHOTOMETRIC,\n\t\t    samplesperpixel == 1 ?\n\t\t\tPHOTOMETRIC_LOGL : PHOTOMETRIC_LOGLUV);\n\telse\n\t\tCopyTag(TIFFTAG_PHOTOMETRIC, 1, TIFF_SHORT);\n\tif (fillorder != 0)\n\t\tTIFFSetField(out, TIFFTAG_FILLORDER, fillorder);\n\telse\n\t\tCopyTag(TIFFTAG_FILLORDER, 1, TIFF_SHORT);\n\t/*\n\t * Will copy `Orientation' tag from input image\n\t */\n\tTIFFGetFieldDefaulted(in, TIFFTAG_ORIENTATION, &orientation);\n\tswitch (orientation) {\n\t\tcase ORIENTATION_BOTRIGHT:\n\t\tcase ORIENTATION_RIGHTBOT:\t/* XXX */\n\t\t\tTIFFWarning(TIFFFileName(in), \"using bottom-left orientation\");\n\t\t\torientation = ORIENTATION_BOTLEFT;\n\t\t/* fall thru... */\n\t\tcase ORIENTATION_LEFTBOT:\t/* XXX */\n\t\tcase ORIENTATION_BOTLEFT:\n\t\t\tbreak;\n\t\tcase ORIENTATION_TOPRIGHT:\n\t\tcase ORIENTATION_RIGHTTOP:\t/* XXX */\n\t\tdefault:\n\t\t\tTIFFWarning(TIFFFileName(in), \"using top-left orientation\");\n\t\t\torientation = ORIENTATION_TOPLEFT;\n\t\t/* fall thru... */\n\t\tcase ORIENTATION_LEFTTOP:\t/* XXX */\n\t\tcase ORIENTATION_TOPLEFT:\n\t\t\tbreak;\n\t}\n\tTIFFSetField(out, TIFFTAG_ORIENTATION, orientation);\n\t/*\n\t * Choose tiles/strip for the output image according to\n\t * the command line arguments (-tiles, -strips) and the\n\t * structure of the input image.\n\t */\n\tif (outtiled == -1)\n\t\touttiled = TIFFIsTiled(in);\n\tif (outtiled) {\n\t\t/*\n\t\t * Setup output file's tile width&height.  If either\n\t\t * is not specified, use either the value from the\n\t\t * input image or, if nothing is defined, use the\n\t\t * library default.\n\t\t */\n\t\tif (tilewidth == (uint32) -1)\n\t\t\tTIFFGetField(in, TIFFTAG_TILEWIDTH, &tilewidth);\n\t\tif (tilelength == (uint32) -1)\n\t\t\tTIFFGetField(in, TIFFTAG_TILELENGTH, &tilelength);\n\t\tTIFFDefaultTileSize(out, &tilewidth, &tilelength);\n\t\tTIFFSetField(out, TIFFTAG_TILEWIDTH, tilewidth);\n\t\tTIFFSetField(out, TIFFTAG_TILELENGTH, tilelength);\n\t} else {\n\t\t/*\n\t\t * RowsPerStrip is left unspecified: use either the\n\t\t * value from the input image or, if nothing is defined,\n\t\t * use the library default.\n\t\t */\n\t\tif (rowsperstrip == (uint32) 0) {\n\t\t\tif (!TIFFGetField(in, TIFFTAG_ROWSPERSTRIP,\n\t\t\t\t\t  &rowsperstrip)) {\n\t\t\t\trowsperstrip =\n\t\t\t\t\tTIFFDefaultStripSize(out, rowsperstrip);\n\t\t\t}\n\t\t\tif (rowsperstrip > length && rowsperstrip != (uint32)-1)\n\t\t\t\trowsperstrip = length;\n\t\t}\n\t\telse if (rowsperstrip == (uint32) -1)\n\t\t\trowsperstrip = length;\n\t\tTIFFSetField(out, TIFFTAG_ROWSPERSTRIP, rowsperstrip);\n\t}\n\tif (config != (uint16) -1)\n\t\tTIFFSetField(out, TIFFTAG_PLANARCONFIG, config);\n\telse\n\t\tCopyField(TIFFTAG_PLANARCONFIG, config);\n\tif (samplesperpixel <= 4)\n\t\tCopyTag(TIFFTAG_TRANSFERFUNCTION, 4, TIFF_SHORT);\n\tCopyTag(TIFFTAG_COLORMAP, 4, TIFF_SHORT);\n/* SMinSampleValue & SMaxSampleValue */\n\tswitch (compression) {\n\tcase COMPRESSION_JPEG:\n\t\tTIFFSetField(out, TIFFTAG_JPEGQUALITY, quality);\n\t\tTIFFSetField(out, TIFFTAG_JPEGCOLORMODE, jpegcolormode);\n\t\tbreak;\n\tcase COMPRESSION_JBIG:\n\t\tCopyTag(TIFFTAG_FAXRECVPARAMS, 1, TIFF_LONG);\n\t\tCopyTag(TIFFTAG_FAXRECVTIME, 1, TIFF_LONG);\n\t\tCopyTag(TIFFTAG_FAXSUBADDRESS, 1, TIFF_ASCII);\n\t\tCopyTag(TIFFTAG_FAXDCS, 1, TIFF_ASCII);\n\t\tbreak;\n\tcase COMPRESSION_LZW:\n\tcase COMPRESSION_ADOBE_DEFLATE:\n\tcase COMPRESSION_DEFLATE:\n\t\tif (predictor != (uint16)-1)\n\t\t\tTIFFSetField(out, TIFFTAG_PREDICTOR, predictor);\n\t\telse\n\t\t\tCopyField(TIFFTAG_PREDICTOR, predictor);\n\t\tbreak;\n\tcase COMPRESSION_CCITTFAX3:\n\tcase COMPRESSION_CCITTFAX4:\n\t\tif (compression == COMPRESSION_CCITTFAX3) {\n\t\t\tif (g3opts != (uint32) -1)\n\t\t\t\tTIFFSetField(out, TIFFTAG_GROUP3OPTIONS,\n\t\t\t\t    g3opts);\n\t\t\telse\n\t\t\t\tCopyField(TIFFTAG_GROUP3OPTIONS, g3opts);\n\t\t} else\n\t\t\tCopyTag(TIFFTAG_GROUP4OPTIONS, 1, TIFF_LONG);\n\t\tCopyTag(TIFFTAG_BADFAXLINES, 1, TIFF_LONG);\n\t\tCopyTag(TIFFTAG_CLEANFAXDATA, 1, TIFF_LONG);\n\t\tCopyTag(TIFFTAG_CONSECUTIVEBADFAXLINES, 1, TIFF_LONG);\n\t\tCopyTag(TIFFTAG_FAXRECVPARAMS, 1, TIFF_LONG);\n\t\tCopyTag(TIFFTAG_FAXRECVTIME, 1, TIFF_LONG);\n\t\tCopyTag(TIFFTAG_FAXSUBADDRESS, 1, TIFF_ASCII);\n\t\tbreak;\n\t}\n\t{ uint32 len32;\n\t  void** data;\n\t  if (TIFFGetField(in, TIFFTAG_ICCPROFILE, &len32, &data))\n\t\tTIFFSetField(out, TIFFTAG_ICCPROFILE, len32, data);\n\t}\n\t{ uint16 ninks;\n\t  const char* inknames;\n\t  if (TIFFGetField(in, TIFFTAG_NUMBEROFINKS, &ninks)) {\n\t\tTIFFSetField(out, TIFFTAG_NUMBEROFINKS, ninks);\n\t\tif (TIFFGetField(in, TIFFTAG_INKNAMES, &inknames)) {\n\t\t    int inknameslen = strlen(inknames) + 1;\n\t\t    const char* cp = inknames;\n\t\t    while (ninks > 1) {\n\t\t\t    cp = strchr(cp, '\\0');\n\t\t\t    if (cp) {\n\t\t\t\t    cp++;\n\t\t\t\t    inknameslen += (strlen(cp) + 1);\n\t\t\t    }\n\t\t\t    ninks--;\n\t\t    }\n\t\t    TIFFSetField(out, TIFFTAG_INKNAMES, inknameslen, inknames);\n\t\t}\n\t  }\n\t}\n\t{\n\t  unsigned short pg0, pg1;\n\t  if (TIFFGetField(in, TIFFTAG_PAGENUMBER, &pg0, &pg1)) {\n\t\tif (pageNum < 0) /* only one input file */\n\t\t\tTIFFSetField(out, TIFFTAG_PAGENUMBER, pg0, pg1);\n\t\telse \n\t\t\tTIFFSetField(out, TIFFTAG_PAGENUMBER, pageNum++, 0);\n\t  }\n\t}\n\n\tfor (p = tags; p < &tags[NTAGS]; p++)\n\t\tCopyTag(p->tag, p->count, p->type);\n\n\tcf = pickCopyFunc(in, out, bitspersample, samplesperpixel);\n\treturn (cf ? (*cf)(in, out, length, width, samplesperpixel) : FALSE);\n}\n\n/*\n * Copy Functions.\n */\n#define\tDECLAREcpFunc(x) \\\nstatic int x(TIFF* in, TIFF* out, \\\n    uint32 imagelength, uint32 imagewidth, tsample_t spp)\n\n#define\tDECLAREreadFunc(x) \\\nstatic int x(TIFF* in, \\\n    uint8* buf, uint32 imagelength, uint32 imagewidth, tsample_t spp)\ntypedef int (*readFunc)(TIFF*, uint8*, uint32, uint32, tsample_t);\n\n#define\tDECLAREwriteFunc(x) \\\nstatic int x(TIFF* out, \\\n    uint8* buf, uint32 imagelength, uint32 imagewidth, tsample_t spp)\ntypedef int (*writeFunc)(TIFF*, uint8*, uint32, uint32, tsample_t);\n\n/*\n * Contig -> contig by scanline for rows/strip change.\n */\nDECLAREcpFunc(cpContig2ContigByRow)\n{\n\ttdata_t buf = _TIFFmalloc(TIFFScanlineSize(in));\n\tuint32 row;\n\n\t(void) imagewidth; (void) spp;\n\tfor (row = 0; row < imagelength; row++) {\n\t\tif (TIFFReadScanline(in, buf, row, 0) < 0 && !ignore) {\n\t\t\tTIFFError(TIFFFileName(in),\n\t\t\t\t  \"Error, can't read scanline %lu\",\n\t\t\t\t  (unsigned long) row);\n\t\t\tgoto bad;\n\t\t}\n\t\tif (TIFFWriteScanline(out, buf, row, 0) < 0) {\n\t\t\tTIFFError(TIFFFileName(out),\n\t\t\t\t  \"Error, can't write scanline %lu\",\n\t\t\t\t  (unsigned long) row);\n\t\t\tgoto bad;\n\t\t}\n\t}\n\t_TIFFfree(buf);\n\treturn 1;\nbad:\n\t_TIFFfree(buf);\n\treturn 0;\n}\n\n\ntypedef void biasFn (void *image, void *bias, uint32 pixels);\n\n#define subtract(bits) \\\nstatic void subtract##bits (void *i, void *b, uint32 pixels)\\\n{\\\n   uint##bits *image = i;\\\n   uint##bits *bias = b;\\\n   while (pixels--) {\\\n     *image = *image > *bias ? *image-*bias : 0;\\\n     image++, bias++; \\\n   } \\\n}\n\nsubtract(8)\nsubtract(16)\nsubtract(32)\n\nstatic biasFn *lineSubtractFn (unsigned bits)\n{\n    switch (bits) {\n      case  8:  return subtract8;\n      case 16:  return subtract16;\n      case 32:  return subtract32;\n    }\n    return NULL;\n}\n\n/*\n * Contig -> contig by scanline while subtracting a bias image.\n */\nDECLAREcpFunc(cpBiasedContig2Contig)\n{\n\tif (spp == 1) {\n\t  tsize_t biasSize = TIFFScanlineSize(bias);\n\t  tsize_t bufSize = TIFFScanlineSize(in);\n\t  tdata_t buf, biasBuf;\n\t  uint32 biasWidth = 0, biasLength = 0;\n\t  TIFFGetField(bias, TIFFTAG_IMAGEWIDTH, &biasWidth);\n\t  TIFFGetField(bias, TIFFTAG_IMAGELENGTH, &biasLength);\n\t  if (biasSize == bufSize && \n\t      imagelength == biasLength && imagewidth == biasWidth) {\n\t\tuint16 sampleBits = 0;\n\t\tbiasFn *subtractLine;\n\t\tTIFFGetField(in, TIFFTAG_BITSPERSAMPLE, &sampleBits);\n\t\tsubtractLine = lineSubtractFn (sampleBits);\n\t\tif (subtractLine) {\n\t\t\tuint32 row;\n\t\t\tbuf = _TIFFmalloc(bufSize);\n\t\t\tbiasBuf = _TIFFmalloc(bufSize);\n\t\t\tfor (row = 0; row < imagelength; row++) {\n\t\t\t\tif (TIFFReadScanline(in, buf, row, 0) < 0\n\t\t\t\t    && !ignore) {\n\t\t\t\t\tTIFFError(TIFFFileName(in),\n\t\t\t\t\t\"Error, can't read scanline %lu\",\n\t\t\t\t\t(unsigned long) row);\n\t\t\t\t\tgoto bad;\n\t\t\t\t}\n\t\t\t\tif (TIFFReadScanline(bias, biasBuf, row, 0) < 0\n\t\t\t\t    && !ignore) {\n\t\t\t\t\tTIFFError(TIFFFileName(in),\n\t\t\t\t\t\"Error, can't read biased scanline %lu\",\n\t\t\t\t\t(unsigned long) row);\n\t\t\t\t\tgoto bad;\n\t\t\t\t}\n\t\t\t\tsubtractLine (buf, biasBuf, imagewidth);\n\t\t\t\tif (TIFFWriteScanline(out, buf, row, 0) < 0) {\n\t\t\t\t\tTIFFError(TIFFFileName(out),\n\t\t\t\t\t\"Error, can't write scanline %lu\",\n\t\t\t\t\t(unsigned long) row);\n\t\t\t\t\tgoto bad;\n\t\t\t\t}\n\t\t\t}\n\t\t\n\t\t\t_TIFFfree(buf);\n\t\t\t_TIFFfree(biasBuf);\n\t\t\tTIFFSetDirectory(bias,\n\t\t\t\tTIFFCurrentDirectory(bias)); /* rewind */\n\t\t\treturn 1;\nbad:\n\t\t\t_TIFFfree(buf);\n\t\t\t_TIFFfree(biasBuf);\n\t\t\treturn 0;\n\t    } else {\n\t      TIFFError(TIFFFileName(in),\n\t\t\t\"No support for biasing %d bit pixels\\n\",\n\t\t\tsampleBits);\n\t      return 0;\n\t    }\n\t  }\n\t  TIFFError(TIFFFileName(in),\n\t\t    \"Bias image %s,%d\\nis not the same size as %s,%d\\n\",\n\t\t    TIFFFileName(bias), TIFFCurrentDirectory(bias),\n\t\t    TIFFFileName(in), TIFFCurrentDirectory(in));\n\t  return 0;\n\t} else {\n\t  TIFFError(TIFFFileName(in),\n\t\t    \"Can't bias %s,%d as it has >1 Sample/Pixel\\n\",\n\t\t    TIFFFileName(in), TIFFCurrentDirectory(in));\n\t  return 0;\n\t}\n\n}\n\n\n/*\n * Strip -> strip for change in encoding.\n */\nDECLAREcpFunc(cpDecodedStrips)\n{\n\ttsize_t stripsize  = TIFFStripSize(in);\n\ttdata_t buf = _TIFFmalloc(stripsize);\n\n\t(void) imagewidth; (void) spp;\n\tif (buf) {\n\t\ttstrip_t s, ns = TIFFNumberOfStrips(in);\n\t\tuint32 row = 0;\n\t\tfor (s = 0; s < ns; s++) {\n\t\t\ttsize_t cc = (row + rowsperstrip > imagelength) ?\n\t\t\t    TIFFVStripSize(in, imagelength - row) : stripsize;\n\t\t\tif (TIFFReadEncodedStrip(in, s, buf, cc) < 0\n\t\t\t    && !ignore) {\n\t\t\t\tTIFFError(TIFFFileName(in),\n\t\t\t\t\t  \"Error, can't read strip %lu\",\n\t\t\t\t\t  (unsigned long) s);\n\t\t\t\tgoto bad;\n\t\t\t}\n\t\t\tif (TIFFWriteEncodedStrip(out, s, buf, cc) < 0) {\n\t\t\t\tTIFFError(TIFFFileName(out),\n\t\t\t\t\t  \"Error, can't write strip %lu\",\n\t\t\t\t\t  (unsigned long) s);\n\t\t\t\tgoto bad;\n\t\t\t}\n\t\t\trow += rowsperstrip;\n\t\t}\n\t\t_TIFFfree(buf);\n\t\treturn 1;\n\t} else {\n\t\tTIFFError(TIFFFileName(in),\n\t\t\t  \"Error, can't allocate memory buffer of size %lu \"\n\t\t\t  \"to read strips\", (unsigned long) stripsize);\n\t\treturn 0;\n\t}\n\nbad:\n\t_TIFFfree(buf);\n\treturn 0;\n}\n\n/*\n * Separate -> separate by row for rows/strip change.\n */\nDECLAREcpFunc(cpSeparate2SeparateByRow)\n{\n\ttdata_t buf = _TIFFmalloc(TIFFScanlineSize(in));\n\tuint32 row;\n\ttsample_t s;\n\n\t(void) imagewidth;\n\tfor (s = 0; s < spp; s++) {\n\t\tfor (row = 0; row < imagelength; row++) {\n\t\t\tif (TIFFReadScanline(in, buf, row, s) < 0 && !ignore) {\n\t\t\t\tTIFFError(TIFFFileName(in),\n\t\t\t\t\t  \"Error, can't read scanline %lu\",\n\t\t\t\t\t  (unsigned long) row);\n\t\t\t\tgoto bad;\n\t\t\t}\n\t\t\tif (TIFFWriteScanline(out, buf, row, s) < 0) {\n\t\t\t\tTIFFError(TIFFFileName(out),\n\t\t\t\t\t  \"Error, can't write scanline %lu\",\n\t\t\t\t\t  (unsigned long) row);\n\t\t\t\tgoto bad;\n\t\t\t}\n\t\t}\n\t}\n\t_TIFFfree(buf);\n\treturn 1;\nbad:\n\t_TIFFfree(buf);\n\treturn 0;\n}\n\n/*\n * Contig -> separate by row.\n */\nDECLAREcpFunc(cpContig2SeparateByRow)\n{\n\ttdata_t inbuf = _TIFFmalloc(TIFFScanlineSize(in));\n\ttdata_t outbuf = _TIFFmalloc(TIFFScanlineSize(out));\n\tregister uint8 *inp, *outp;\n\tregister uint32 n;\n\tuint32 row;\n\ttsample_t s;\n\n\t/* unpack channels */\n\tfor (s = 0; s < spp; s++) {\n\t\tfor (row = 0; row < imagelength; row++) {\n\t\t\tif (TIFFReadScanline(in, inbuf, row, 0) < 0\n\t\t\t    && !ignore) {\n\t\t\t\tTIFFError(TIFFFileName(in),\n\t\t\t\t\t  \"Error, can't read scanline %lu\",\n\t\t\t\t\t  (unsigned long) row);\n\t\t\t\tgoto bad;\n\t\t\t}\n\t\t\tinp = ((uint8*)inbuf) + s;\n\t\t\toutp = (uint8*)outbuf;\n\t\t\tfor (n = imagewidth; n-- > 0;) {\n\t\t\t\t*outp++ = *inp;\n\t\t\t\tinp += spp;\n\t\t\t}\n\t\t\tif (TIFFWriteScanline(out, outbuf, row, s) < 0) {\n\t\t\t\tTIFFError(TIFFFileName(out),\n\t\t\t\t\t  \"Error, can't write scanline %lu\",\n\t\t\t\t\t  (unsigned long) row);\n\t\t\t\tgoto bad;\n\t\t\t}\n\t\t}\n\t}\n\tif (inbuf) _TIFFfree(inbuf);\n\tif (outbuf) _TIFFfree(outbuf);\n\treturn 1;\nbad:\n\tif (inbuf) _TIFFfree(inbuf);\n\tif (outbuf) _TIFFfree(outbuf);\n\treturn 0;\n}\n\n/*\n * Separate -> contig by row.\n */\nDECLAREcpFunc(cpSeparate2ContigByRow)\n{\n\ttdata_t inbuf = _TIFFmalloc(TIFFScanlineSize(in));\n\ttdata_t outbuf = _TIFFmalloc(TIFFScanlineSize(out));\n\tregister uint8 *inp, *outp;\n\tregister uint32 n;\n\tuint32 row;\n\ttsample_t s;\n\n\tfor (row = 0; row < imagelength; row++) {\n\t\t/* merge channels */\n\t\tfor (s = 0; s < spp; s++) {\n\t\t\tif (TIFFReadScanline(in, inbuf, row, s) < 0\n\t\t\t    && !ignore) {\n\t\t\t\tTIFFError(TIFFFileName(in),\n\t\t\t\t\t  \"Error, can't read scanline %lu\",\n\t\t\t\t\t  (unsigned long) row);\n\t\t\t\tgoto bad;\n\t\t\t}\n\t\t\tinp = (uint8*)inbuf;\n\t\t\toutp = ((uint8*)outbuf) + s;\n\t\t\tfor (n = imagewidth; n-- > 0;) {\n\t\t\t\t*outp = *inp++;\n\t\t\t\toutp += spp;\n\t\t\t}\n\t\t}\n\t\tif (TIFFWriteScanline(out, outbuf, row, 0) < 0) {\n\t\t\tTIFFError(TIFFFileName(out),\n\t\t\t\t  \"Error, can't write scanline %lu\",\n\t\t\t\t  (unsigned long) row);\n\t\t\tgoto bad;\n\t\t}\n\t}\n\tif (inbuf) _TIFFfree(inbuf);\n\tif (outbuf) _TIFFfree(outbuf);\n\treturn 1;\nbad:\n\tif (inbuf) _TIFFfree(inbuf);\n\tif (outbuf) _TIFFfree(outbuf);\n\treturn 0;\n}\n\nstatic void\ncpStripToTile(uint8* out, uint8* in,\n\tuint32 rows, uint32 cols, int outskew, int inskew)\n{\n\twhile (rows-- > 0) {\n\t\tuint32 j = cols;\n\t\twhile (j-- > 0)\n\t\t\t*out++ = *in++;\n\t\tout += outskew;\n\t\tin += inskew;\n\t}\n}\n\nstatic void\ncpContigBufToSeparateBuf(uint8* out, uint8* in,\n           uint32 rows, uint32 cols, int outskew, int inskew, tsample_t spp,\n           int bytes_per_sample )\n{\n\twhile (rows-- > 0) {\n\t\tuint32 j = cols;\n\t\twhile (j-- > 0)\n                {\n                        int n = bytes_per_sample;\n\n                        while( n-- ) {\n                            *out++ = *in++;\n                        }\n                        in += (spp-1) * bytes_per_sample;\n                }\n\t\tout += outskew;\n\t\tin += inskew;\n\t}\n}\n\nstatic void\ncpSeparateBufToContigBuf(uint8* out, uint8* in,\n\tuint32 rows, uint32 cols, int outskew, int inskew, tsample_t spp,\n                         int bytes_per_sample)\n{\n\twhile (rows-- > 0) {\n\t\tuint32 j = cols;\n\t\twhile (j-- > 0) {\n                        int n = bytes_per_sample;\n\n                        while( n-- ) {\n                                *out++ = *in++;\n                        }\n                        out += (spp-1)*bytes_per_sample;\n                }\n\t\tout += outskew;\n\t\tin += inskew;\n\t}\n}\n\nstatic int\ncpImage(TIFF* in, TIFF* out, readFunc fin, writeFunc fout,\n\tuint32 imagelength, uint32 imagewidth, tsample_t spp)\n{\n\tint status = 0;\n\ttdata_t buf = NULL;\n\ttsize_t scanlinesize = TIFFRasterScanlineSize(in);\n        tsize_t bytes = scanlinesize * (tsize_t)imagelength;                                      \n        /*\n         * XXX: Check for integer overflow.\n         */\n        if (scanlinesize\n\t    && imagelength\n\t    && bytes / (tsize_t)imagelength == scanlinesize) {\n                buf = _TIFFmalloc(bytes);\n\t\tif (buf) {\n\t\t\tif ((*fin)(in, (uint8*)buf, imagelength, \n\t\t\t\t   imagewidth, spp)) {\n\t\t\t\tstatus = (*fout)(out, (uint8*)buf,\n\t\t\t\t\t\t imagelength, imagewidth, spp);\n\t\t\t}\n\t\t\t_TIFFfree(buf);\n\t\t} else {\n\t\t\tTIFFError(TIFFFileName(in),\n\t\t\t\t\"Error, can't allocate space for image buffer\");\n\t\t}\n\t} else {\n\t\tTIFFError(TIFFFileName(in), \"Error, no space for image buffer\");\n\t}\n\n\treturn status;\n}\n\nDECLAREreadFunc(readContigStripsIntoBuffer)\n{\n\ttsize_t scanlinesize = TIFFScanlineSize(in);\n\tuint8* bufp = buf;\n\tuint32 row;\n\n\t(void) imagewidth; (void) spp;\n\tfor (row = 0; row < imagelength; row++) {\n\t\tif (TIFFReadScanline(in, (tdata_t) bufp, row, 0) < 0\n\t\t    && !ignore) {\n\t\t\tTIFFError(TIFFFileName(in),\n\t\t\t\t  \"Error, can't read scanline %lu\",\n\t\t\t\t  (unsigned long) row);\n\t\t\treturn 0;\n\t\t}\n\t\tbufp += scanlinesize;\n\t}\n\n\treturn 1;\n}\n\nDECLAREreadFunc(readSeparateStripsIntoBuffer)\n{\n\tint status = 1;\n\ttsize_t scanlinesize = TIFFScanlineSize(in);\n\ttdata_t scanline = _TIFFmalloc(scanlinesize);\n\tif (!scanlinesize)\n\t\treturn 0;\n\n\t(void) imagewidth;\n\tif (scanline) {\n\t\tuint8* bufp = (uint8*) buf;\n\t\tuint32 row;\n\t\ttsample_t s;\n\t\tfor (row = 0; row < imagelength; row++) {\n\t\t\t/* merge channels */\n\t\t\tfor (s = 0; s < spp; s++) {\n\t\t\t\tuint8* bp = bufp + s;\n\t\t\t\ttsize_t n = scanlinesize;\n                                uint8* sbuf = scanline;\n\n\t\t\t\tif (TIFFReadScanline(in, scanline, row, s) < 0\n\t\t\t\t    && !ignore) {\n\t\t\t\t\tTIFFError(TIFFFileName(in),\n\t\t\t\t\t\"Error, can't read scanline %lu\",\n\t\t\t\t\t(unsigned long) row);\n\t\t\t\t\tstatus = 0;\n\t\t\t\t\tgoto done;\n\t\t\t\t}\n\t\t\t\twhile (n-- > 0)\n\t\t\t\t\t*bp = *sbuf++, bp += spp;\n\t\t\t}\n\t\t\tbufp += scanlinesize * spp;\n\t\t}\n\t}\n\ndone:\n\t_TIFFfree(scanline);\n\treturn status;\n}\n\nDECLAREreadFunc(readContigTilesIntoBuffer)\n{\n\tint status = 1;\n\ttdata_t tilebuf = _TIFFmalloc(TIFFTileSize(in));\n\tuint32 imagew = TIFFScanlineSize(in);\n\tuint32 tilew  = TIFFTileRowSize(in);\n\tint iskew = imagew - tilew;\n\tuint8* bufp = (uint8*) buf;\n\tuint32 tw, tl;\n\tuint32 row;\n\n\t(void) spp;\n\tif (tilebuf == 0)\n\t\treturn 0;\n\t(void) TIFFGetField(in, TIFFTAG_TILEWIDTH, &tw);\n\t(void) TIFFGetField(in, TIFFTAG_TILELENGTH, &tl);\n        \n\tfor (row = 0; row < imagelength; row += tl) {\n\t\tuint32 nrow = (row+tl > imagelength) ? imagelength-row : tl;\n\t\tuint32 colb = 0;\n\t\tuint32 col;\n\n\t\tfor (col = 0; col < imagewidth; col += tw) {\n\t\t\tif (TIFFReadTile(in, tilebuf, col, row, 0, 0) < 0\n\t\t\t    && !ignore) {\n\t\t\t\tTIFFError(TIFFFileName(in),\n\t\t\t\t\t  \"Error, can't read tile at %lu %lu\",\n\t\t\t\t\t  (unsigned long) col,\n\t\t\t\t\t  (unsigned long) row);\n\t\t\t\tstatus = 0;\n\t\t\t\tgoto done;\n\t\t\t}\n\t\t\tif (colb + tilew > imagew) {\n\t\t\t\tuint32 width = imagew - colb;\n\t\t\t\tuint32 oskew = tilew - width;\n\t\t\t\tcpStripToTile(bufp + colb,\n                                              tilebuf, nrow, width,\n                                              oskew + iskew, oskew );\n\t\t\t} else\n\t\t\t\tcpStripToTile(bufp + colb,\n                                              tilebuf, nrow, tilew,\n                                              iskew, 0);\n\t\t\tcolb += tilew;\n\t\t}\n\t\tbufp += imagew * nrow;\n\t}\ndone:\n\t_TIFFfree(tilebuf);\n\treturn status;\n}\n\nDECLAREreadFunc(readSeparateTilesIntoBuffer)\n{\n\tint status = 1;\n\tuint32 imagew = TIFFRasterScanlineSize(in);\n\tuint32 tilew = TIFFTileRowSize(in);\n\tint iskew  = imagew - tilew*spp;\n\ttdata_t tilebuf = _TIFFmalloc(TIFFTileSize(in));\n\tuint8* bufp = (uint8*) buf;\n\tuint32 tw, tl;\n\tuint32 row;\n        uint16 bps, bytes_per_sample;\n\n\tif (tilebuf == 0)\n\t\treturn 0;\n\t(void) TIFFGetField(in, TIFFTAG_TILEWIDTH, &tw);\n\t(void) TIFFGetField(in, TIFFTAG_TILELENGTH, &tl);\n\t(void) TIFFGetField(in, TIFFTAG_BITSPERSAMPLE, &bps);\n        assert( bps % 8 == 0 );\n        bytes_per_sample = bps/8;\n\n\tfor (row = 0; row < imagelength; row += tl) {\n\t\tuint32 nrow = (row+tl > imagelength) ? imagelength-row : tl;\n\t\tuint32 colb = 0;\n\t\tuint32 col;\n\n\t\tfor (col = 0; col < imagewidth; col += tw) {\n\t\t\ttsample_t s;\n\n\t\t\tfor (s = 0; s < spp; s++) {\n\t\t\t\tif (TIFFReadTile(in, tilebuf, col, row, 0, s) < 0\n\t\t\t\t    && !ignore) {\n\t\t\t\t\tTIFFError(TIFFFileName(in),\n\t\t\t\t\t  \"Error, can't read tile at %lu %lu, \"\n\t\t\t\t\t  \"sample %lu\",\n\t\t\t\t\t  (unsigned long) col,\n\t\t\t\t\t  (unsigned long) row,\n\t\t\t\t\t  (unsigned long) s);\n\t\t\t\t\tstatus = 0;\n\t\t\t\t\tgoto done;\n\t\t\t\t}\n\t\t\t\t/*\n\t\t\t\t * Tile is clipped horizontally.  Calculate\n\t\t\t\t * visible portion and skewing factors.\n\t\t\t\t */\n\t\t\t\tif (colb + tilew*spp > imagew) {\n\t\t\t\t\tuint32 width = imagew - colb;\n\t\t\t\t\tint oskew = tilew*spp - width;\n\t\t\t\t\tcpSeparateBufToContigBuf(\n                                            bufp+colb+s*bytes_per_sample,\n\t\t\t\t\t    tilebuf, nrow,\n                                            width/(spp*bytes_per_sample),\n\t\t\t\t\t    oskew + iskew,\n                                            oskew/spp, spp,\n                                            bytes_per_sample);\n\t\t\t\t} else\n\t\t\t\t\tcpSeparateBufToContigBuf(\n                                            bufp+colb+s*bytes_per_sample,\n\t\t\t\t\t    tilebuf, nrow, tw,\n\t\t\t\t\t    iskew, 0, spp,\n                                            bytes_per_sample);\n\t\t\t}\n\t\t\tcolb += tilew*spp;\n\t\t}\n\t\tbufp += imagew * nrow;\n\t}\ndone:\n\t_TIFFfree(tilebuf);\n\treturn status;\n}\n\nDECLAREwriteFunc(writeBufferToContigStrips)\n{\n\tuint32 row, rowsperstrip;\n\ttstrip_t strip = 0;\n\n\t(void) imagewidth; (void) spp;\n\t(void) TIFFGetFieldDefaulted(out, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);\n\tfor (row = 0; row < imagelength; row += rowsperstrip) {\n\t\tuint32 nrows = (row+rowsperstrip > imagelength) ?\n\t\t    imagelength-row : rowsperstrip;\n\t\ttsize_t stripsize = TIFFVStripSize(out, nrows);\n\t\tif (TIFFWriteEncodedStrip(out, strip++, buf, stripsize) < 0) {\n\t\t\tTIFFError(TIFFFileName(out),\n\t\t\t\t  \"Error, can't write strip %u\", strip - 1);\n\t\t\treturn 0;\n\t\t}\n\t\tbuf += stripsize;\n\t}\n\treturn 1;\n}\n\nDECLAREwriteFunc(writeBufferToSeparateStrips)\n{\n\tuint32 rowsize = imagewidth * spp;\n\tuint32 rowsperstrip;\n\ttdata_t obuf = _TIFFmalloc(TIFFStripSize(out));\n\ttstrip_t strip = 0;\n\ttsample_t s;\n\n\tif (obuf == NULL)\n\t\treturn (0);\n\t(void) TIFFGetFieldDefaulted(out, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);\n\tfor (s = 0; s < spp; s++) {\n\t\tuint32 row;\n\t\tfor (row = 0; row < imagelength; row += rowsperstrip) {\n\t\t\tuint32 nrows = (row+rowsperstrip > imagelength) ?\n\t\t\t    imagelength-row : rowsperstrip;\n\t\t\ttsize_t stripsize = TIFFVStripSize(out, nrows);\n\n\t\t\tcpContigBufToSeparateBuf(\n\t\t\t    obuf, (uint8*) buf + row*rowsize + s, \n\t\t\t    nrows, imagewidth, 0, 0, spp, 1);\n\t\t\tif (TIFFWriteEncodedStrip(out, strip++, obuf, stripsize) < 0) {\n\t\t\t\tTIFFError(TIFFFileName(out),\n\t\t\t\t\t  \"Error, can't write strip %u\",\n\t\t\t\t\t  strip - 1);\n\t\t\t\t_TIFFfree(obuf);\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n\t_TIFFfree(obuf);\n\treturn 1;\n\n}\n\nDECLAREwriteFunc(writeBufferToContigTiles)\n{\n\tuint32 imagew = TIFFScanlineSize(out);\n\tuint32 tilew  = TIFFTileRowSize(out);\n\tint iskew = imagew - tilew;\n\ttdata_t obuf = _TIFFmalloc(TIFFTileSize(out));\n\tuint8* bufp = (uint8*) buf;\n\tuint32 tl, tw;\n\tuint32 row;\n\n\t(void) spp;\n\tif (obuf == NULL)\n\t\treturn 0;\n\t(void) TIFFGetField(out, TIFFTAG_TILELENGTH, &tl);\n\t(void) TIFFGetField(out, TIFFTAG_TILEWIDTH, &tw);\n\tfor (row = 0; row < imagelength; row += tilelength) {\n\t\tuint32 nrow = (row+tl > imagelength) ? imagelength-row : tl;\n\t\tuint32 colb = 0;\n\t\tuint32 col;\n\n\t\tfor (col = 0; col < imagewidth; col += tw) {\n\t\t\t/*\n\t\t\t * Tile is clipped horizontally.  Calculate\n\t\t\t * visible portion and skewing factors.\n\t\t\t */\n\t\t\tif (colb + tilew > imagew) {\n\t\t\t\tuint32 width = imagew - colb;\n\t\t\t\tint oskew = tilew - width;\n\t\t\t\tcpStripToTile(obuf, bufp + colb, nrow, width,\n\t\t\t\t    oskew, oskew + iskew);\n\t\t\t} else\n\t\t\t\tcpStripToTile(obuf, bufp + colb, nrow, tilew,\n\t\t\t\t    0, iskew);\n\t\t\tif (TIFFWriteTile(out, obuf, col, row, 0, 0) < 0) {\n\t\t\t\tTIFFError(TIFFFileName(out),\n\t\t\t\t\t  \"Error, can't write tile at %lu %lu\",\n\t\t\t\t\t  (unsigned long) col,\n\t\t\t\t\t  (unsigned long) row);\n\t\t\t\t_TIFFfree(obuf);\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\tcolb += tilew;\n\t\t}\n\t\tbufp += nrow * imagew;\n\t}\n\t_TIFFfree(obuf);\n\treturn 1;\n}\n\nDECLAREwriteFunc(writeBufferToSeparateTiles)\n{\n\tuint32 imagew = TIFFScanlineSize(out);\n\ttsize_t tilew  = TIFFTileRowSize(out);\n\tuint32 iimagew = TIFFRasterScanlineSize(out);\n\tint iskew = iimagew - tilew*spp;\n\ttdata_t obuf = _TIFFmalloc(TIFFTileSize(out));\n\tuint8* bufp = (uint8*) buf;\n\tuint32 tl, tw;\n\tuint32 row;\n        uint16 bps, bytes_per_sample;\n\n\tif (obuf == NULL)\n\t\treturn 0;\n\t(void) TIFFGetField(out, TIFFTAG_TILELENGTH, &tl);\n\t(void) TIFFGetField(out, TIFFTAG_TILEWIDTH, &tw);\n\t(void) TIFFGetField(out, TIFFTAG_BITSPERSAMPLE, &bps);\n        assert( bps % 8 == 0 );\n        bytes_per_sample = bps/8;\n        \n\tfor (row = 0; row < imagelength; row += tl) {\n\t\tuint32 nrow = (row+tl > imagelength) ? imagelength-row : tl;\n\t\tuint32 colb = 0;\n\t\tuint32 col;\n\n\t\tfor (col = 0; col < imagewidth; col += tw) {\n\t\t\ttsample_t s;\n\t\t\tfor (s = 0; s < spp; s++) {\n\t\t\t\t/*\n\t\t\t\t * Tile is clipped horizontally.  Calculate\n\t\t\t\t * visible portion and skewing factors.\n\t\t\t\t */\n\t\t\t\tif (colb + tilew > imagew) {\n\t\t\t\t\tuint32 width = (imagew - colb);\n\t\t\t\t\tint oskew = tilew - width;\n\n\t\t\t\t\tcpContigBufToSeparateBuf(obuf,\n\t\t\t\t\t    bufp + (colb*spp) + s,\n\t\t\t\t\t    nrow, width/bytes_per_sample,\n\t\t\t\t\t    oskew, (oskew*spp)+iskew, spp,\n                                            bytes_per_sample);\n\t\t\t\t} else\n\t\t\t\t\tcpContigBufToSeparateBuf(obuf,\n\t\t\t\t\t    bufp + (colb*spp) + s,\n\t\t\t\t\t    nrow, tilewidth,\n\t\t\t\t\t    0, iskew, spp,\n                                            bytes_per_sample);\n\t\t\t\tif (TIFFWriteTile(out, obuf, col, row, 0, s) < 0) {\n\t\t\t\t\tTIFFError(TIFFFileName(out),\n\t\t\t\t\t\"Error, can't write tile at %lu %lu \"\n\t\t\t\t\t\"sample %lu\",\n\t\t\t\t\t(unsigned long) col,\n\t\t\t\t\t(unsigned long) row,\n\t\t\t\t\t(unsigned long) s);\n\t\t\t\t\t_TIFFfree(obuf);\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\tcolb += tilew;\n\t\t}\n\t\tbufp += nrow * iimagew;\n\t}\n\t_TIFFfree(obuf);\n\treturn 1;\n}\n\n/*\n * Contig strips -> contig tiles.\n */\nDECLAREcpFunc(cpContigStrips2ContigTiles)\n{\n\treturn cpImage(in, out,\n\t    readContigStripsIntoBuffer,\n\t    writeBufferToContigTiles,\n\t    imagelength, imagewidth, spp);\n}\n\n/*\n * Contig strips -> separate tiles.\n */\nDECLAREcpFunc(cpContigStrips2SeparateTiles)\n{\n\treturn cpImage(in, out,\n\t    readContigStripsIntoBuffer,\n\t    writeBufferToSeparateTiles,\n\t    imagelength, imagewidth, spp);\n}\n\n/*\n * Separate strips -> contig tiles.\n */\nDECLAREcpFunc(cpSeparateStrips2ContigTiles)\n{\n\treturn cpImage(in, out,\n\t    readSeparateStripsIntoBuffer,\n\t    writeBufferToContigTiles,\n\t    imagelength, imagewidth, spp);\n}\n\n/*\n * Separate strips -> separate tiles.\n */\nDECLAREcpFunc(cpSeparateStrips2SeparateTiles)\n{\n\treturn cpImage(in, out,\n\t    readSeparateStripsIntoBuffer,\n\t    writeBufferToSeparateTiles,\n\t    imagelength, imagewidth, spp);\n}\n\n/*\n * Contig strips -> contig tiles.\n */\nDECLAREcpFunc(cpContigTiles2ContigTiles)\n{\n\treturn cpImage(in, out,\n\t    readContigTilesIntoBuffer,\n\t    writeBufferToContigTiles,\n\t    imagelength, imagewidth, spp);\n}\n\n/*\n * Contig tiles -> separate tiles.\n */\nDECLAREcpFunc(cpContigTiles2SeparateTiles)\n{\n\treturn cpImage(in, out,\n\t    readContigTilesIntoBuffer,\n\t    writeBufferToSeparateTiles,\n\t    imagelength, imagewidth, spp);\n}\n\n/*\n * Separate tiles -> contig tiles.\n */\nDECLAREcpFunc(cpSeparateTiles2ContigTiles)\n{\n\treturn cpImage(in, out,\n\t    readSeparateTilesIntoBuffer,\n\t    writeBufferToContigTiles,\n\t    imagelength, imagewidth, spp);\n}\n\n/*\n * Separate tiles -> separate tiles (tile dimension change).\n */\nDECLAREcpFunc(cpSeparateTiles2SeparateTiles)\n{\n\treturn cpImage(in, out,\n\t    readSeparateTilesIntoBuffer,\n\t    writeBufferToSeparateTiles,\n\t    imagelength, imagewidth, spp);\n}\n\n/*\n * Contig tiles -> contig tiles (tile dimension change).\n */\nDECLAREcpFunc(cpContigTiles2ContigStrips)\n{\n\treturn cpImage(in, out,\n\t    readContigTilesIntoBuffer,\n\t    writeBufferToContigStrips,\n\t    imagelength, imagewidth, spp);\n}\n\n/*\n * Contig tiles -> separate strips.\n */\nDECLAREcpFunc(cpContigTiles2SeparateStrips)\n{\n\treturn cpImage(in, out,\n\t    readContigTilesIntoBuffer,\n\t    writeBufferToSeparateStrips,\n\t    imagelength, imagewidth, spp);\n}\n\n/*\n * Separate tiles -> contig strips.\n */\nDECLAREcpFunc(cpSeparateTiles2ContigStrips)\n{\n\treturn cpImage(in, out,\n\t    readSeparateTilesIntoBuffer,\n\t    writeBufferToContigStrips,\n\t    imagelength, imagewidth, spp);\n}\n\n/*\n * Separate tiles -> separate strips.\n */\nDECLAREcpFunc(cpSeparateTiles2SeparateStrips)\n{\n\treturn cpImage(in, out,\n\t    readSeparateTilesIntoBuffer,\n\t    writeBufferToSeparateStrips,\n\t    imagelength, imagewidth, spp);\n}\n\n/*\n * Select the appropriate copy function to use.\n */\nstatic copyFunc\npickCopyFunc(TIFF* in, TIFF* out, uint16 bitspersample, uint16 samplesperpixel)\n{\n\tuint16 shortv;\n\tuint32 w, l, tw, tl;\n\tint bychunk;\n\n\t(void) TIFFGetField(in, TIFFTAG_PLANARCONFIG, &shortv);\n\tif (shortv != config && bitspersample != 8 && samplesperpixel > 1) {\n\t\tfprintf(stderr,\n\"%s: Cannot handle different planar configuration w/ bits/sample != 8\\n\",\n\t\t    TIFFFileName(in));\n\t\treturn (NULL);\n\t}\n\tTIFFGetField(in, TIFFTAG_IMAGEWIDTH, &w);\n\tTIFFGetField(in, TIFFTAG_IMAGELENGTH, &l);\n        if (!(TIFFIsTiled(out) || TIFFIsTiled(in))) {\n\t    uint32 irps = (uint32) -1L;\n\t    TIFFGetField(in, TIFFTAG_ROWSPERSTRIP, &irps);\n            /* if biased, force decoded copying to allow image subtraction */\n\t    bychunk = !bias && (rowsperstrip == irps);\n\t}else{  /* either in or out is tiled */\n            if (bias) {\n                  fprintf(stderr,\n\"%s: Cannot handle tiled configuration w/bias image\\n\",\n                  TIFFFileName(in));\n                  return (NULL);\n            }\n\t    if (TIFFIsTiled(out)) {\n\t\tif (!TIFFGetField(in, TIFFTAG_TILEWIDTH, &tw))\n\t\t\ttw = w;\n\t\tif (!TIFFGetField(in, TIFFTAG_TILELENGTH, &tl))\n\t\t\ttl = l;\n\t\tbychunk = (tw == tilewidth && tl == tilelength);\n\t    } else {  /* out's not, so in must be tiled */\n\t\tTIFFGetField(in, TIFFTAG_TILEWIDTH, &tw);\n\t\tTIFFGetField(in, TIFFTAG_TILELENGTH, &tl);\n\t\tbychunk = (tw == w && tl == rowsperstrip);\n            }\n\t}\n#define\tT 1\n#define\tF 0\n#define pack(a,b,c,d,e)\t((long)(((a)<<11)|((b)<<3)|((c)<<2)|((d)<<1)|(e)))\n\tswitch(pack(shortv,config,TIFFIsTiled(in),TIFFIsTiled(out),bychunk)) {\n/* Strips -> Tiles */\n\tcase pack(PLANARCONFIG_CONTIG,   PLANARCONFIG_CONTIG,   F,T,F):\n\tcase pack(PLANARCONFIG_CONTIG,   PLANARCONFIG_CONTIG,   F,T,T):\n\t\treturn cpContigStrips2ContigTiles;\n\tcase pack(PLANARCONFIG_CONTIG,   PLANARCONFIG_SEPARATE, F,T,F):\n\tcase pack(PLANARCONFIG_CONTIG,   PLANARCONFIG_SEPARATE, F,T,T):\n\t\treturn cpContigStrips2SeparateTiles;\n        case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_CONTIG,   F,T,F):\n        case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_CONTIG,   F,T,T):\n\t\treturn cpSeparateStrips2ContigTiles;\n\tcase pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_SEPARATE, F,T,F):\n\tcase pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_SEPARATE, F,T,T):\n\t\treturn cpSeparateStrips2SeparateTiles;\n/* Tiles -> Tiles */\n\tcase pack(PLANARCONFIG_CONTIG,   PLANARCONFIG_CONTIG,   T,T,F):\n\tcase pack(PLANARCONFIG_CONTIG,   PLANARCONFIG_CONTIG,   T,T,T):\n\t\treturn cpContigTiles2ContigTiles;\n\tcase pack(PLANARCONFIG_CONTIG,   PLANARCONFIG_SEPARATE, T,T,F):\n\tcase pack(PLANARCONFIG_CONTIG,   PLANARCONFIG_SEPARATE, T,T,T):\n\t\treturn cpContigTiles2SeparateTiles;\n        case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_CONTIG,   T,T,F):\n        case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_CONTIG,   T,T,T):\n\t\treturn cpSeparateTiles2ContigTiles;\n\tcase pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_SEPARATE, T,T,F):\n\tcase pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_SEPARATE, T,T,T):\n\t\treturn cpSeparateTiles2SeparateTiles;\n/* Tiles -> Strips */\n\tcase pack(PLANARCONFIG_CONTIG,   PLANARCONFIG_CONTIG,   T,F,F):\n\tcase pack(PLANARCONFIG_CONTIG,   PLANARCONFIG_CONTIG,   T,F,T):\n\t\treturn cpContigTiles2ContigStrips;\n\tcase pack(PLANARCONFIG_CONTIG,   PLANARCONFIG_SEPARATE, T,F,F):\n\tcase pack(PLANARCONFIG_CONTIG,   PLANARCONFIG_SEPARATE, T,F,T):\n\t\treturn cpContigTiles2SeparateStrips;\n        case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_CONTIG,   T,F,F):\n        case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_CONTIG,   T,F,T):\n\t\treturn cpSeparateTiles2ContigStrips;\n\tcase pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_SEPARATE, T,F,F):\n\tcase pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_SEPARATE, T,F,T):\n\t\treturn cpSeparateTiles2SeparateStrips;\n/* Strips -> Strips */\n\tcase pack(PLANARCONFIG_CONTIG,   PLANARCONFIG_CONTIG,   F,F,F):\n\t\treturn bias ? cpBiasedContig2Contig : cpContig2ContigByRow;\n\tcase pack(PLANARCONFIG_CONTIG,   PLANARCONFIG_CONTIG,   F,F,T):\n\t\treturn cpDecodedStrips;\n\tcase pack(PLANARCONFIG_CONTIG, PLANARCONFIG_SEPARATE,   F,F,F):\n\tcase pack(PLANARCONFIG_CONTIG, PLANARCONFIG_SEPARATE,   F,F,T):\n\t\treturn cpContig2SeparateByRow;\n\tcase pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_CONTIG,   F,F,F):\n\tcase pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_CONTIG,   F,F,T):\n\t\treturn cpSeparate2ContigByRow;\n\tcase pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_SEPARATE, F,F,F):\n\tcase pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_SEPARATE, F,F,T):\n\t\treturn cpSeparate2SeparateByRow;\n\t}\n#undef pack\n#undef F\n#undef T\n\tfprintf(stderr, \"tiffcp: %s: Don't know how to copy/convert image.\\n\",\n\t    TIFFFileName(in));\n\treturn (NULL);\n}\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiff/tools/tiffcrop.c",
    "content": "/* $Id: tiffcrop.c,v 1.3.2.9 2009-11-03 15:24:12 bfriesen Exp $ */\n\n/* tiffcrop.c -- a port of tiffcp.c extended to include manipulations of\n * the image data through additional options listed below\n *\n * Original code:\n * Copyright (c) 1988-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n * Additions (c) Richard Nolde 2006-2009 \n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS OR ANY OTHER COPYRIGHT  \n * HOLDERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL \n * DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, \n * DATA OR PROFITS, WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND \n * ON ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE\n * OR PERFORMANCE OF THIS SOFTWARE.\n *\n * Some portions of the current code are derived from tiffcp, primarly in \n * the areas of lowlevel reading and writing of TAGS, scanlines and tiles though\n * some of the original functions have been extended to support arbitrary bit\n * depths. These functions are presented at the top of this file.\n *\n * Add support for the options below to extract sections of image(s) \n * and to modify the whole image or selected portions of each image by\n * rotations, mirroring, and colorscale/colormap inversion of selected\n * types of TIFF images when appropriate. Some color model dependent \n * functions are restricted to bilevel or 8 bit per sample data.\n * See the man page for the full explanations.\n *\n * New Options: \n * -h             Display the syntax guide.\n * -v             Report the version and last build date for tiffcrop and libtiff.\n * -z x1,y1,x2,y2:x3,y3,x4,y4:..xN,yN,xN + 1, yN + 1 \n *                Specify a series of coordinates to define rectangular\n *                regions by the top left and lower right corners.\n * -e c|d|i|m|s   export mode for images and selections from input images\n *   combined     All images and selections are written to a single file (default)\n *                with multiple selections from one image combined into a single image\n *   divided      All images and selections are written to a single file\n *                with each selection from one image written to a new image\n *   image        Each input image is written to a new file (numeric filename sequence)\n *                with multiple selections from the image combined into one image\n *   multiple     Each input image is written to a new file (numeric filename sequence)\n *                with each selection from the image written to a new image\n *   separated    Individual selections from each image are written to separate files\n * -U units       [in, cm, px ] inches, centimeters or pixels\n * -H #           Set horizontal resolution of output images to #\n * -V #           Set vertical resolution of output images to #\n * -J #           Horizontal margin of output page to # expressed in current\n *                units when sectioning image into columns x rows \n *                using the -S cols:rows option.\n * -K #           Vertical margin of output page to # expressed in current\n *                units when sectioning image into columns x rows\n *                using the -S cols:rows option.\n * -X #           Horizontal dimension of region to extract expressed in current\n *                units\n * -Y #           Vertical dimension of region to extract expressed in current\n *                units\n * -O orient      Orientation for output image, portrait, landscape, auto\n * -P page        Page size for output image segments, eg letter, legal, tabloid,\n *                etc.\n * -S cols:rows   Divide the image into equal sized segments using cols across\n *                and rows down\n * -E t|l|r|b     Edge to use as origin\n * -m #,#,#,#     Margins from edges for selection: top, left, bottom, right\n *                (commas separated)\n * -Z #:#,#:#     Zones of the image designated as zone X of Y, \n *                eg 1:3 would be first of three equal portions measured\n *                from reference edge\n * -N odd|even|#,#-#,#|last \n *                Select sequences and/or ranges of images within file\n *                to process. The words odd or even may be used to specify\n *                all odd or even numbered images the word last may be used\n *                in place of a number in the sequence to indicate the final\n *                image in the file without knowing how many images there are.\n * -R #           Rotate image or crop selection by 90,180,or 270 degrees\n *                clockwise  \n * -F h|v         Flip (mirror) image or crop selection horizontally\n *                or vertically \n * -I [black|white|data|both]\n *                Invert color space, eg dark to light for bilevel and grayscale images\n *                If argument is white or black, set the PHOTOMETRIC_INTERPRETATION \n *                tag to MinIsBlack or MinIsWhite without altering the image data\n *                If the argument is data or both, the image data are modified:\n *                both inverts the data and the PHOTOMETRIC_INTERPRETATION tag,\n *                data inverts the data but not the PHOTOMETRIC_INTERPRETATION tag\n * -D input:<filename1>,output:<filename2>,format:<raw|txt>,level:N,debug:N\n *                Dump raw data for input and/or output images to individual files\n *                in raw (binary) format or text (ASCII) representing binary data\n *                as strings of 1s and 0s. The filename arguments are used as stems\n *                from which individual files are created for each image. Text format\n *                includes annotations for image parameters and scanline info. Level\n *                selects which functions dump data, with higher numbers selecting\n *                lower level, scanline level routines. Debug reports a limited set\n *                of messages to monitor progess without enabling dump logs.\n */\n\nstatic   char tiffcrop_version_id[] = \"2.2\";\nstatic   char tiffcrop_rev_date[] = \"11-03-2009\";\n\n#include \"tif_config.h\"\n#include \"tiffiop.h\"\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n#include <ctype.h>\n#include <limits.h>\n#include <sys/stat.h>\n#include <assert.h>\n\n#ifdef HAVE_UNISTD_H\n# include <unistd.h>\n#endif\n\n#ifdef HAVE_STDINT_H\n# include <stdint.h>\n#endif\n\n#ifndef HAVE_GETOPT\nextern int getopt(int, char**, char*);\n#endif\n\n#include \"tiffio.h\"\n\n#if defined(VMS)\n# define unlink delete\n#endif\n\n#ifndef PATH_MAX\n#define PATH_MAX 1024\n#endif\n\n#ifndef streq\n#define\tstreq(a,b)\t(strcmp((a),(b)) == 0)\n#endif\n#define\tstrneq(a,b,n)\t(strncmp((a),(b),(n)) == 0)\n\n/* NB: the uint32 casts are to silence certain ANSI-C compilers */\n#define TIFFhowmany(x, y) ((((uint32)(x))+(((uint32)(y))-1))/((uint32)(y)))\n#define TIFFhowmany8(x) (((x)&0x07)?((uint32)(x)>>3)+1:(uint32)(x)>>3)\n\n#define\tTRUE\t1\n#define\tFALSE\t0\n\n/*\n * Definitions and data structures required to support cropping and image\n * manipulations.\n */\n\n#define EDGE_TOP      1\n#define EDGE_LEFT     2\n#define EDGE_BOTTOM   3\n#define EDGE_RIGHT    4\n#define EDGE_CENTER   5\n\n#define MIRROR_HORIZ  1\n#define MIRROR_VERT   2\n#define MIRROR_BOTH   3\n#define ROTATECW_90   8\n#define ROTATECW_180 16\n#define ROTATECW_270 32\n#define ROTATE_ANY ROTATECW_90 || ROTATECW_180 || ROTATECW_270 \n\n#define CROP_NONE     0\n#define CROP_MARGINS  1\n#define CROP_WIDTH    2\n#define CROP_LENGTH   4\n#define CROP_ZONES    8\n#define CROP_REGIONS 16\n#define CROP_ROTATE  32\n#define CROP_MIRROR  64\n#define CROP_INVERT 128\n\n/* Modes for writing out images and selections */\n#define ONE_FILE_COMPOSITE       0 /* One file, sections combined sections */\n#define ONE_FILE_SEPARATED       1 /* One file, sections to new IFDs */\n#define FILE_PER_IMAGE_COMPOSITE 2 /* One file per image, combined sections */\n#define FILE_PER_IMAGE_SEPARATED 3 /* One file per input image */\n#define FILE_PER_SELECTION       4 /* One file per selection */\n\n#define COMPOSITE_IMAGES         0 /* Selections combined into one image */  \n#define SEPARATED_IMAGES         1 /* Selections saved to separate images */\n\n#define STRIP    1\n#define TILE     2\n\n#define MAX_REGIONS   8  /* number of regions to extract from a single page */\n#define MAX_OUTBUFFS  8  /* must match larger of zones or regions */\n#define MAX_SECTIONS 32  /* number of sections per page to write to output */\n#define MAX_IMAGES 2048  /* number of images in descrete list, not in the file */\n#define MAX_SAMPLES   8  /* maximum number of samples per pixel supported */\n#define MAX_BITS_PER_SAMPLE 64 /* maximum bit depth supported */\n\n#define DUMP_NONE   0\n#define DUMP_TEXT   1\n#define DUMP_RAW    2\n\n/* Offsets into buffer for margins and fixed width and length segments */\nstruct offset {\n  uint32  tmargin;\n  uint32  lmargin;\n  uint32  bmargin;\n  uint32  rmargin;\n  uint32  crop_width;\n  uint32  crop_length;\n  uint32  startx;\n  uint32  endx;\n  uint32  starty;\n  uint32  endy;\n};\n\n/* Description of a zone within the image. Position 1 of 3 zones would be \n * the first third of the image. These are computed after margins and \n * width/length requests are applied so that you can extract multiple \n * zones from within a larger region for OCR or barcode recognition.\n */\n\nstruct  buffinfo {\n  uint32 size;           /* size of this buffer */\n  unsigned char *buffer; /* address of the allocated buffer */\n};\n\nstruct  zone {\n  int   position;  /* ordinal of segment to be extracted */\n  int   total;     /* total equal sized divisions of crop area */\n  };\n\nstruct  pageseg {\n  uint32 x1;        /* index of left edge */\n  uint32 x2;        /* index of right edge */\n  uint32 y1;        /* index of top edge */\n  uint32 y2;        /* index of bottom edge */\n  int    position;  /* ordinal of segment to be extracted */\n  int    total;     /* total equal sized divisions of crop area */\n  uint32 buffsize;  /* size of buffer needed to hold the cropped zone */\n};\n\nstruct  coordpairs {\n  double X1;        /* index of left edge in current units */\n  double X2;        /* index of right edge in current units */\n  double Y1;        /* index of top edge in current units */\n  double Y2;        /* index of bottom edge in current units */\n};\n\nstruct  region {\n  uint32 x1;        /* pixel offset of left edge */\n  uint32 x2;        /* pixel offset of right edge */\n  uint32 y1;        /* pixel offset of top edge */\n  uint32 y2;        /* picel offset of bottom edge */\n  uint32 width;     /* width in pixels */\n  uint32 length;    /* length in pixels */\n  uint32 buffsize;  /* size of buffer needed to hold the cropped region */\n  unsigned char *buffptr; /* address of start of the region */\n};\n\n/* Cropping parameters from command line and image data \n * Note: This should be renamed to proc_opts and expanded to include all current globals\n * if possible, but each function that accesses global variables will have to be redone.\n */\nstruct crop_mask {\n  double width;           /* Selection width for master crop region in requested units */\n  double length;          /* Selection length for master crop region in requesed units */\n  double margins[4];      /* Top, left, bottom, right margins */\n  float  xres;            /* Horizontal resolution read from image*/\n  float  yres;            /* Vertical resolution read from image */\n  uint32 combined_width;  /* Width of combined cropped zones */\n  uint32 combined_length; /* Length of combined cropped zones */\n  uint32 bufftotal;       /* Size of buffer needed to hold all the cropped region */\n  uint16 img_mode;        /* Composite or separate images created from zones or regions */\n  uint16 exp_mode;        /* Export input images or selections to one or more files */\n  uint16 crop_mode;       /* Crop options to be applied */\n  uint16 res_unit;        /* Resolution unit for margins and selections */\n  uint16 edge_ref;        /* Reference edge for sections extraction and combination */\n  uint16 rotation;        /* Clockwise rotation of the extracted region or image */\n  uint16 mirror;          /* Mirror extracted region or image horizontally or vertically */\n  uint16 invert;          /* Invert the color map of image or region */\n  uint16 photometric;     /* Status of photometric interpretation for inverted image */\n  uint16 selections;      /* Number of regions or zones selected */\n  uint16 regions;         /* Number of regions delimited by corner coordinates */\n  struct region regionlist[MAX_REGIONS]; /* Regions within page or master crop region */\n  uint16 zones;           /* Number of zones delimited by Ordinal:Total requested */\n  struct zone zonelist[MAX_REGIONS]; /* Zones indices to define a region */\n  struct coordpairs corners[MAX_REGIONS]; /* Coordinates of upper left and lower right corner */\n};\n\n#define MAX_PAPERNAMES 49\n#define MAX_PAPERNAME_LENGTH 15\n#define DEFAULT_RESUNIT      RESUNIT_INCH\n#define DEFAULT_PAGE_HEIGHT   14.0\n#define DEFAULT_PAGE_WIDTH     8.5\n#define DEFAULT_RESOLUTION   300\n#define DEFAULT_PAPER_SIZE  \"legal\"\n\n#define ORIENTATION_NONE       0\n#define ORIENTATION_PORTRAIT   1\n#define ORIENTATION_LANDSCAPE  2\n#define ORIENTATION_SEASCAPE   4\n#define ORIENTATION_AUTO      16\n\n#define PAGE_MODE_NONE         0\n#define PAGE_MODE_RESOLUTION   1\n#define PAGE_MODE_PAPERSIZE    2\n#define PAGE_MODE_MARGINS      4\n#define PAGE_MODE_ROWSCOLS     8\n\n#define INVERT_DATA_ONLY      10\n#define INVERT_DATA_AND_TAG   11\n\nstruct paperdef {\n  char   name[MAX_PAPERNAME_LENGTH];\n  double width;\n  double length;\n  double asratio;\n  };\n\n/* Paper Size       Width   Length  Aspect Ratio */\nstruct paperdef PaperTable[MAX_PAPERNAMES] = {\n  {\"default\",         8.500,  14.000,  0.607},\n  {\"pa4\",             8.264,  11.000,  0.751},\n  {\"letter\",          8.500,  11.000,  0.773},\n  {\"legal\",           8.500,  14.000,  0.607},\n  {\"half-letter\",     8.500,   5.514,  1.542},\n  {\"executive\",       7.264,  10.528,  0.690},\n  {\"tabloid\",        11.000,  17.000,  0.647},\n  {\"11x17\",          11.000,  17.000,  0.647},\n  {\"ledger\",         17.000,  11.000,  1.545},\n  {\"archa\",           9.000,  12.000,  0.750},\n  {\"archb\",          12.000,  18.000,  0.667},\n  {\"archc\",          18.000,  24.000,  0.750},\n  {\"archd\",          24.000,  36.000,  0.667},\n  {\"arche\",          36.000,  48.000,  0.750},\n  {\"csheet\",         17.000,  22.000,  0.773},\n  {\"dsheet\",         22.000,  34.000,  0.647},\n  {\"esheet\",         34.000,  44.000,  0.773},\n  {\"superb\",         11.708,  17.042,  0.687},\n  {\"commercial\",      4.139,   9.528,  0.434},\n  {\"monarch\",         3.889,   7.528,  0.517},\n  {\"envelope-dl\",     4.333,   8.681,  0.499},\n  {\"envelope-c5\",     6.389,   9.028,  0.708},\n  {\"europostcard\",    4.139,   5.833,  0.710},\n  {\"a0\",             33.111,  46.806,  0.707},\n  {\"a1\",             23.389,  33.111,  0.706},\n  {\"a2\",             16.542,  23.389,  0.707},\n  {\"a3\",             11.694,  16.542,  0.707},\n  {\"a4\",              8.264,  11.694,  0.707},\n  {\"a5\",              5.833,   8.264,  0.706},\n  {\"a6\",              4.125,   5.833,  0.707},\n  {\"a7\",              2.917,   4.125,  0.707},\n  {\"a8\",              2.056,   2.917,  0.705},\n  {\"a9\",              1.458,   2.056,  0.709},\n  {\"a10\",             1.014,   1.458,  0.695},\n  {\"b0\",             39.375,  55.667,  0.707},\n  {\"b1\",             27.833,  39.375,  0.707},\n  {\"b2\",             19.681,  27.833,  0.707},\n  {\"b3\",             13.903,  19.681,  0.706},\n  {\"b4\",              9.847,  13.903,  0.708},\n  {\"b5\",              6.931,   9.847,  0.704},\n  {\"b6\",              4.917,   6.931,  0.709},\n  {\"c0\",             36.097,  51.069,  0.707},\n  {\"c1\",             25.514,  36.097,  0.707},\n  {\"c2\",             18.028,  25.514,  0.707},\n  {\"c3\",             12.750,  18.028,  0.707},\n  {\"c4\",              9.014,  12.750,  0.707},\n  {\"c5\",              6.375,   9.014,  0.707},\n  {\"c6\",              4.486,   6.375,  0.704},\n  {\"\",                0.000,   0.000,  1.000},\n};\n\n/* Structure to define in input image parameters */\nstruct image_data {\n  float  xres;\n  float  yres;\n  uint32 width;\n  uint32 length;\n  uint16 res_unit;\n  uint16 bps;\n  uint16 spp;\n  uint16 planar;\n  uint16 photometric;\n  uint16 orientation;\n  uint16 adjustments;\n};\n\n/* Structure to define the output image modifiers */\nstruct pagedef {\n  char          name[16];\n  double        width;    /* width in pixels */\n  double        length;   /* length in pixels */\n  double        hmargin;  /* margins to subtract from width of sections */\n  double        vmargin;  /* margins to subtract from height of sections */\n  double        hres;     /* horizontal resolution for output */\n  double        vres;     /* vertical resolution for output */\n  uint32        mode;     /* bitmask of modifiers to page format */\n  uint16        res_unit; /* resolution unit for output image */\n  unsigned int  rows;     /* number of section rows */\n  unsigned int  cols;     /* number of section cols */\n  unsigned int  orient;   /* portrait, landscape, seascape, auto */\n};\n\nstruct dump_opts {\n  int  debug;\n  int  format;\n  int  level;\n  char mode[4];\n  char infilename[PATH_MAX + 1];\n  char outfilename[PATH_MAX + 1];\n  FILE *infile;\n  FILE *outfile;\n  };\n\n/* globals */\nstatic int    outtiled = -1;\nstatic uint32 tilewidth = 0;\nstatic uint32 tilelength = 0;\n\nstatic uint16 config = 0;\nstatic uint16 compression = 0;\nstatic uint16 predictor = 0;\nstatic uint16 fillorder = 0;\nstatic uint32 rowsperstrip = 0;\nstatic uint32 g3opts = 0;\nstatic int    ignore = FALSE;\t\t/* if true, ignore read errors */\nstatic uint32 defg3opts = (uint32) -1;\nstatic int    quality = 100;\t\t/* JPEG quality */\nstatic int    jpegcolormode = -1;       /* was JPEGCOLORMODE_RGB; */\nstatic uint16 defcompression = (uint16) -1;\nstatic uint16 defpredictor = (uint16) -1;\nstatic int    pageNum = 0;\nstatic int    little_endian = 1;\n\n/* Functions adapted from tiffcp with additions or significant modifications */\nstatic int  readContigStripsIntoBuffer   (TIFF*, uint8*);\nstatic int  readSeparateStripsIntoBuffer (TIFF*, uint8*, uint32, uint32, tsample_t, struct dump_opts *);\nstatic int  readContigTilesIntoBuffer    (TIFF*, uint8*, uint32, uint32, uint32, uint32, tsample_t, uint16);\nstatic int  readSeparateTilesIntoBuffer  (TIFF*, uint8*, uint32, uint32, uint32, uint32, tsample_t, uint16);\nstatic int  writeBufferToContigStrips    (TIFF*, uint8*, uint32);\nstatic int  writeBufferToContigTiles     (TIFF*, uint8*, uint32, uint32, tsample_t, struct dump_opts *);\nstatic int  writeBufferToSeparateStrips  (TIFF*, uint8*, uint32, uint32, tsample_t, struct dump_opts *);\nstatic int  writeBufferToSeparateTiles   (TIFF*, uint8*, uint32, uint32, tsample_t, struct dump_opts *);\nstatic int  extractContigSamplesToBuffer (uint8 *, uint8 *, uint32, uint32, tsample_t, \n                                         uint16, uint16, struct dump_opts *);\nstatic int processCompressOptions(char*);\nstatic void usage(void);\n\n/* All other functions by Richard Nolde,  not found in tiffcp */\nstatic void initImageData (struct image_data *);\nstatic void initCropMasks (struct crop_mask *);\nstatic void initPageSetup (struct pagedef *, struct pageseg *, struct buffinfo []);\nstatic void initDumpOptions(struct dump_opts *);\n\n/* Command line and file naming functions */\nvoid  process_command_opts (int, char *[], char *, char *, uint32 *,\n\t                    uint16 *, uint16 *, uint32 *, uint32 *, uint32 *,\n\t\t            struct crop_mask *, struct pagedef *, \n                            struct dump_opts *, \n                            unsigned int *, unsigned int *);\nstatic  int update_output_file (TIFF **, char *, int, char *, unsigned int *);\n\n\n/*  * High level functions for whole image manipulation */\nstatic int  get_page_geometry (char *, struct pagedef*);\nstatic int  computeInputPixelOffsets(struct crop_mask *, struct image_data *, \n                                     struct offset *);\nstatic int  computeOutputPixelOffsets (struct crop_mask *, struct image_data *,\n\t\t\t\t       struct pagedef *, struct pageseg *,\n                                       struct dump_opts *);\nstatic int  loadImage(TIFF *, struct image_data *, struct dump_opts *, unsigned char **);\nstatic int  correct_orientation(struct image_data *, unsigned char **);\nstatic int  getCropOffsets(struct image_data *, struct crop_mask *, struct dump_opts *);\nstatic int  processCropSelections(struct image_data *, struct crop_mask *, \n                                  unsigned char **, struct buffinfo []);\nstatic int  writeSelections(TIFF *, TIFF **, struct crop_mask *, struct image_data *,\n                            struct dump_opts *, struct buffinfo [],\n                            char *, char *, unsigned int*, unsigned int);\n\n/* Section functions */\nstatic int  createImageSection(uint32, unsigned char **);\nstatic int  extractImageSection(struct image_data *, struct pageseg *, \n                                unsigned char *, unsigned char *);\nstatic int  writeSingleSection(TIFF *, TIFF *, struct image_data *,\n                               struct dump_opts *, uint32, uint32,\n\t\t\t       double, double, unsigned char *);\nstatic int  writeImageSections(TIFF *, TIFF *, struct image_data *,\n                               struct pagedef *, struct pageseg *, \n                               struct dump_opts *, unsigned char *, \n                               unsigned char **);\n/* Whole image functions */\nstatic int  createCroppedImage(struct image_data *, struct crop_mask *, \n                               unsigned char **, unsigned char **);\nstatic int  writeCroppedImage(TIFF *, TIFF *, struct image_data *image,\n                              struct dump_opts * dump,\n                              uint32, uint32, unsigned char *, int, int);\n\n/* Image manipulation functions */\nstatic int rotateContigSamples8bits(uint16, uint16, uint16, uint32, \n                                    uint32,   uint32, uint8 *, uint8 *);\nstatic int rotateContigSamples16bits(uint16, uint16, uint16, uint32, \n                                     uint32,   uint32, uint8 *, uint8 *);\nstatic int rotateContigSamples24bits(uint16, uint16, uint16, uint32, \n                                     uint32,   uint32, uint8 *, uint8 *);\nstatic int rotateContigSamples32bits(uint16, uint16, uint16, uint32, \n                                     uint32,   uint32, uint8 *, uint8 *);\nstatic int rotateImage(uint16, struct image_data *, uint32 *, uint32 *,\n \t\t       unsigned char **);\nstatic int mirrorImage(uint16, uint16, uint16, uint32, uint32,\n\t\t       unsigned char *);\nstatic int invertImage(uint16, uint16, uint16, uint32, uint32,\n\t\t       unsigned char *);\n\n/* Functions to reverse the sequence of samples in a scanline */\nstatic int reverseSamples8bits  (uint16, uint16, uint32, uint8 *, uint8 *);\nstatic int reverseSamples16bits (uint16, uint16, uint32, uint8 *, uint8 *);\nstatic int reverseSamples24bits (uint16, uint16, uint32, uint8 *, uint8 *);\nstatic int reverseSamples32bits (uint16, uint16, uint32, uint8 *, uint8 *);\nstatic int reverseSamplesBytes  (uint16, uint16, uint32, uint8 *, uint8 *);\n\n/* Functions for manipulating individual samples in an image */\nstatic int extractSeparateRegion(struct image_data *, struct crop_mask *,\n\t\t \t\t unsigned char *, unsigned char *, int);\nstatic int extractCompositeRegions(struct image_data *,  struct crop_mask *,\n\t\t\t\t   unsigned char *, unsigned char *);\nstatic int extractContigSamples8bits (uint8 *, uint8 *, uint32,\n \t                             tsample_t, uint16, uint16, \n                                     tsample_t, uint32, uint32);\nstatic int extractContigSamples16bits (uint8 *, uint8 *, uint32,\n \t                              tsample_t, uint16, uint16, \n                                      tsample_t, uint32, uint32);\nstatic int extractContigSamples24bits (uint8 *, uint8 *, uint32,\n \t                              tsample_t, uint16, uint16, \n                                      tsample_t, uint32, uint32);\nstatic int extractContigSamples32bits (uint8 *, uint8 *, uint32,\n\t                              tsample_t, uint16, uint16, \n                                      tsample_t, uint32, uint32);\nstatic int extractContigSamplesBytes (uint8 *, uint8 *, uint32, \n                                      tsample_t, uint16, uint16, \n\t\t\t\t      tsample_t, uint32, uint32);\nstatic int extractContigSamplesShifted8bits (uint8 *, uint8 *, uint32,\n \t                                     tsample_t, uint16, uint16,\n                                             tsample_t, uint32, uint32,\n                                             int);\nstatic int extractContigSamplesShifted16bits (uint8 *, uint8 *, uint32,\n \t                                      tsample_t, uint16, uint16, \n\t\t\t\t              tsample_t, uint32, uint32,\n                                              int);\nstatic int extractContigSamplesShifted24bits (uint8 *, uint8 *, uint32,\n \t                                      tsample_t, uint16, uint16, \n\t\t\t\t              tsample_t, uint32, uint32,\n                                              int);\nstatic int extractContigSamplesShifted32bits (uint8 *, uint8 *, uint32,\n\t                                      tsample_t, uint16, uint16, \n\t\t\t\t              tsample_t, uint32, uint32,\n                                              int);\nstatic int extractContigSamplesToTileBuffer(uint8 *, uint8 *, uint32, uint32,\n  \t                                    uint32, uint32, tsample_t, uint16,\n\t\t\t\t\t    uint16, uint16, struct dump_opts *);\n\n/* Functions to combine separate planes into interleaved planes */\nstatic int combineSeparateSamples8bits (uint8 *[], uint8 *, uint32, uint32,\n                                        uint16, uint16, FILE *, int, int);\nstatic int combineSeparateSamples16bits (uint8 *[], uint8 *, uint32, uint32,\n                                         uint16, uint16, FILE *, int, int);\nstatic int combineSeparateSamples24bits (uint8 *[], uint8 *, uint32, uint32,\n                                         uint16, uint16, FILE *, int, int);\nstatic int combineSeparateSamples32bits (uint8 *[], uint8 *, uint32, uint32,\n                                         uint16, uint16, FILE *, int, int);\nstatic int combineSeparateSamplesBytes (unsigned char *[], unsigned char *,\n\t\t\t\t\tuint32, uint32, tsample_t, uint16,\n                                        FILE *, int, int);\n\nstatic int combineSeparateTileSamples8bits (uint8 *[], uint8 *, uint32, uint32,\n                                            uint32, uint32, uint16, uint16, \n                                            FILE *, int, int);\nstatic int combineSeparateTileSamples16bits (uint8 *[], uint8 *, uint32, uint32,\n                                             uint32, uint32, uint16, uint16,\n                                             FILE *, int, int);\nstatic int combineSeparateTileSamples24bits (uint8 *[], uint8 *, uint32, uint32,\n                                             uint32, uint32, uint16, uint16,\n                                             FILE *, int, int);\nstatic int combineSeparateTileSamples32bits (uint8 *[], uint8 *, uint32, uint32,\n                                             uint32, uint32, uint16, uint16,\n                                             FILE *, int, int);\nstatic int combineSeparateTileSamplesBytes (unsigned char *[], unsigned char *,\n\t\t\t  \t\t    uint32, uint32, uint32, uint32, \n                                            tsample_t, uint16, FILE *, int, int);\n\n/* Dump functions for debugging */\nstatic void dump_info  (FILE *, int, char *, char *, ...);\nstatic int  dump_data  (FILE *, int, char *, unsigned char *, uint32);\nstatic int  dump_byte  (FILE *, int, char *, unsigned char);\nstatic int  dump_short (FILE *, int, char *, uint16);\nstatic int  dump_long  (FILE *, int, char *, uint32);\nstatic int  dump_wide  (FILE *, int, char *, uint64);\nstatic int  dump_buffer (FILE *, int, uint32, uint32, uint32, unsigned char *);\n\n/* End function declarations */\n/* Functions derived in whole or in part from tiffcp */\n/* The following functions are taken largely intact from tiffcp */\n\nstatic   char* stuff[] = {\n\"usage: tiffcrop [options] source1 ... sourceN  destination\",\n\"where options are:\",\n\" -h\t\tPrint this syntax listing\",\n\" -v\t\tPrint tiffcrop version identifier and last revision date\",\n\" \",\n\" -a\t\tAppend to output instead of overwriting\",\n\" -d offset\tSet initial directory offset, counting first image as one, not zero\",\n\" -p contig\tPack samples contiguously (e.g. RGBRGB...)\",\n\" -p separate\tStore samples separately (e.g. RRR...GGG...BBB...)\",\n\" -s\t\tWrite output in strips\",\n\" -t\t\tWrite output in tiles\",\n\" -i\t\tIgnore read errors\",\n\" \",\n\" -r #\t\tMake each strip have no more than # rows\",\n\" -w #\t\tSet output tile width (pixels)\",\n\" -l #\t\tSet output tile length (pixels)\",\n\" \",\n\" -f lsb2msb\tForce lsb-to-msb FillOrder for output\",\n\" -f msb2lsb\tForce msb-to-lsb FillOrder for output\",\n\"\",\n\" -c lzw[:opts]\tCompress output with Lempel-Ziv & Welch encoding\",\n\" -c zip[:opts]\tCompress output with deflate encoding\",\n\" -c jpeg[:opts]\tcompress output with JPEG encoding\",\n\" -c packbits\tCompress output with packbits encoding\",\n\" -c g3[:opts]\tCompress output with CCITT Group 3 encoding\",\n\" -c g4\t\tCompress output with CCITT Group 4 encoding\",\n\" -c none\tUse no compression algorithm on output\",\n\" \",\n\"Group 3 options:\",\n\" 1d\t\tUse default CCITT Group 3 1D-encoding\",\n\" 2d\t\tUse optional CCITT Group 3 2D-encoding\",\n\" fill\t\tByte-align EOL codes\",\n\"For example, -c g3:2d:fill to get G3-2D-encoded data with byte-aligned EOLs\",\n\" \",\n\"JPEG options:\",\n\" #\t\tSet compression quality level (0-100, default 100)\",\n\" r\t\tOutput color image as raw RGB rather than YCbCr\",\n\" a\t\tOutput color image as RGB or YCbCr with auto detection\",\n\"For example, -c jpeg:r:50 to get JPEG-encoded RGB data with 50% comp. quality\",\n\" \",\n\"LZW and deflate options:\",\n\" #\t\tSet predictor value\",\n\"For example, -c lzw:2 to get LZW-encoded data with horizontal differencing\",\n\" \",\n\"Page and selection options:\",\n\" -N odd|even|#,#-#,#|last         sequences and ranges of images within file to process\",\n\"             The words odd or even may be used to specify all odd or even numbered images.\",\n\"             The word last may be used in place of a number in the sequence to indicate.\",\n\"             The final image in the file without knowing how many images there are.\",\n\"             Numbers are counted from one even though TIFF IFDs are counted from zero.\",\n\" \",\n\" -E t|l|r|b  edge to use as origin for width and length of crop region\",\n\" -U units    [in, cm, px ] inches, centimeters or pixels\",\n\" \",\n\" -m #,#,#,#  margins from edges for selection: top, left, bottom, right separated by commas\",\n\" -X #        horizontal dimension of region to extract expressed in current units\",\n\" -Y #        vertical dimension of region to extract expressed in current units\",\n\" -Z #:#,#:#  zones of the image designated as position X of Y,\",\n\"             eg 1:3 would be first of three equal portions measured from reference edge\",\n\" -z x1,y1,x2,y2:...:xN,yN,xN+1,yN+1\",\n\"             regions of the image designated by upper left and lower right coordinates\",\n\"\",\n\"Export grouping options:\",\n\" -e c|d|i|m|s    export mode for images and selections from input images.\",\n\"                 When exporting a composite image from multiple zones or regions\",\n\"                 (combined and image modes), the selections must have equal sizes\",\n\"                 for the axis perpendicular to the edge specified with -E.\",\n\"    c|combined   All images and selections are written to a single file (default).\",\n\"                 with multiple selections from one image combined into a single image.\",\n\"    d|divided    All images and selections are written to a single file\",\n\"                 with each selection from one image written to a new image.\",\n\"    i|image      Each input image is written to a new file (numeric filename sequence)\",\n\"                 with multiple selections from the image combined into one image.\",\n\"    m|multiple   Each input image is written to a new file (numeric filename sequence)\",\n\"                 with each selection from the image written to a new image.\",\n\"    s|separated  Individual selections from each image are written to separate files.\",\n\"\",\n\"Output options:\",\n\" -H #        Set horizontal resolution of output images to #\",\n\" -V #        Set vertical resolution of output images to #\",\n\" -J #        Set horizontal margin of output page to # expressed in current units\",\n\"             when sectioning image into columns x rows using the -S cols:rows option\",\n\" -K #        Set verticalal margin of output page to # expressed in current units\",\n\"             when sectioning image into columns x rows using the -S cols:rows option\",\n\" \",\n\" -O orient    orientation for output image, portrait, landscape, auto\",\n\" -P page      page size for output image segments, eg letter, legal, tabloid, etc\",\n\" -S cols:rows Divide the image into equal sized segments using cols across and rows down.\",\n\" \",\n\" -F hor|vert|both\",\n\"             flip (mirror) image or region horizontally, vertically, or both\",\n\" -R #        [90,180,or 270] degrees clockwise rotation of image or extracted region\",\n\" -I [black|white|data|both]\",\n\"             invert color space, eg dark to light for bilevel and grayscale images\",\n\"             If argument is white or black, set the PHOTOMETRIC_INTERPRETATION \",\n\"             tag to MinIsBlack or MinIsWhite without altering the image data\",\n\"             If the argument is data or both, the image data are modified:\",\n\"             both inverts the data and the PHOTOMETRIC_INTERPRETATION tag,\",\n\"             data inverts the data but not the PHOTOMETRIC_INTERPRETATION tag\",\n\" \",\n\"-D opt1:value1,opt2:value2,opt3:value3:opt4:value4\",\n\"             Debug/dump program progress and/or data to non-TIFF files.\",\n\"             Options include the following and must be joined as a comma\",\n\"             separate list. The use of this option is generally limited to\",\n\"             program debugging and development of future options.\",\n\" \",\n\"   debug:N   Display limited program progress indicators where larger N\",\n\"             increase the level of detail. Note: Tiffcrop may be compiled with\",\n\"             -DDEVELMODE to enable additional very low level debug reporting.\",\n\"\",\n\"   Format:txt|raw  Format any logged data as ASCII text or raw binary \",\n\"             values. ASCII text dumps include strings of ones and zeroes\",\n\"             representing the binary values in the image data plus identifying headers.\",\n\" \",\n\"   level:N   Specify the level of detail presented in the dump files.\",\n\"             This can vary from dumps of the entire input or output image data to dumps\",\n\"             of data processed by specific functions. Current range of levels is 1 to 3.\",\n\" \",\n\"   input:full-path-to-directory/input-dumpname\",\n\" \",\n\"   output:full-path-to-directory/output-dumpnaem\",\n\" \",\n\"             When dump files are being written, each image will be written to a separate\",\n\"             file with the name built by adding a numeric sequence value to the dumpname\",\n\"             and an extension of .txt for ASCII dumps or .bin for binary dumps.\",\n\" \",\n\"             The four debug/dump options are independent, though it makes little sense to\",\n\"             specify a dump file without specifying a detail level.\",\n\" \",\nNULL\n};\n\n/* This function could be modified to pass starting sample offset \n * and number of samples as args to select fewer than spp\n * from input image. These would then be passed to individual \n * extractContigSampleXX routines.\n */\nstatic int readContigTilesIntoBuffer (TIFF* in, uint8* buf, \n                                      uint32 imagelength, \n                                      uint32 imagewidth, \n                                      uint32 tw, uint32 tl,\n                                      tsample_t spp, uint16 bps)\n  {\n  int status = 1;\n  tsample_t sample = 0;\n  tsample_t count = spp; \n  uint32 row, col, trow;\n  uint32 nrow, ncol;\n  uint32 dst_rowsize, shift_width;\n  uint32 bytes_per_sample, bytes_per_pixel;\n  uint32 trailing_bits, prev_trailing_bits;\n  uint32 tile_rowsize  = TIFFTileRowSize(in);\n  uint32 src_offset, dst_offset;\n  uint32 row_offset, col_offset;\n  uint8 *bufp = (uint8*) buf;\n  unsigned char *src = NULL;\n  unsigned char *dst = NULL;\n  tsize_t tbytes = 0, tile_buffsize = 0;\n  tsize_t tilesize = TIFFTileSize(in);\n  unsigned char *tilebuf = NULL;\n\n  bytes_per_sample = (bps + 7) / 8; \n  bytes_per_pixel  = ((bps * spp) + 7) / 8;\n\n  if ((bps % 8) == 0)\n    shift_width = 0;\n  else\n    {\n    if (bytes_per_pixel < (bytes_per_sample + 1))\n      shift_width = bytes_per_pixel;\n    else\n      shift_width = bytes_per_sample + 1;\n    }\n\n  tile_buffsize = tilesize;\n\n  if (tilesize < (tsize_t)(tl * tile_rowsize))\n    {\n#ifdef DEBUG2\n    TIFFError(\"readContigTilesIntoBuffer\",\n\t      \"Tilesize %lu is too small, using alternate calculation %u\",\n              tilesize, tl * tile_rowsize);\n#endif\n    tile_buffsize = tl * tile_rowsize;\n    } \n\n  tilebuf = _TIFFmalloc(tile_buffsize);\n  if (tilebuf == 0)\n    return 0;\n\n  dst_rowsize = ((imagewidth * bps * spp) + 7) / 8;  \n  for (row = 0; row < imagelength; row += tl)\n    {\n    nrow = (row + tl > imagelength) ? imagelength - row : tl;\n    for (col = 0; col < imagewidth; col += tw)\n      {\n      tbytes = TIFFReadTile(in, tilebuf, col, row, 0, 0);\n      if (tbytes < tilesize  && !ignore)\n        {\n\tTIFFError(TIFFFileName(in),\n\t\t  \"Error, can't read tile at row %lu col %lu, Read %lu bytes of %lu\",\n\t\t  (unsigned long) col, (unsigned long) row, (unsigned long)tbytes,\n                  (unsigned long)tilesize);\n\t\t  status = 0;\n                  _TIFFfree(tilebuf);\n\t\t  return status;\n\t}\n      \n      row_offset = row * dst_rowsize;\n      col_offset = ((col * bps * spp) + 7)/ 8;\n      bufp = buf + row_offset + col_offset;\n\n      if (col + tw > imagewidth)\n\tncol = imagewidth - col;\n      else\n        ncol = tw;\n\n      /* Each tile scanline will start on a byte boundary but it\n       * has to be merged into the scanline for the entire\n       * image buffer and the previous segment may not have\n       * ended on a byte boundary\n       */\n      /* Optimization for common bit depths, all samples */\n      if (((bps % 8) == 0) && (count == spp))\n        {\n\tfor (trow = 0; trow < nrow; trow++)\n          {\n\t  src_offset = trow * tile_rowsize;\n\t  _TIFFmemcpy (bufp, tilebuf + src_offset, (ncol * spp * bps) / 8);\n          bufp += (imagewidth * bps * spp) / 8;\n\t  }\n        }\n      else\n        {\n\t/* Bit depths not a multiple of 8 and/or extract fewer than spp samples */\n        prev_trailing_bits = trailing_bits = 0;\n        trailing_bits = (ncol * bps * spp) % 8;\n\n\t/*\tfor (trow = 0; tl < nrow; trow++) */\n\tfor (trow = 0; trow < nrow; trow++)\n          {\n\t  src_offset = trow * tile_rowsize;\n          src = tilebuf + src_offset;\n\t  dst_offset = (row + trow) * dst_rowsize;\n          dst = buf + dst_offset + col_offset;\n          switch (shift_width)\n            {\n            case 0: if (extractContigSamplesBytes (src, dst, ncol, sample,\n                                                   spp, bps, count, 0, ncol))\n                      {\n\t\t      TIFFError(\"readContigTilesIntoBuffer\",\n                                \"Unable to extract row %d from tile %lu\", \n\t\t\t\trow, (unsigned long)TIFFCurrentTile(in));\n\t\t      return 1;\n\t\t      }\n\t\t    break;\n            case 1: if (bps == 1)\n                      { \n                      if (extractContigSamplesShifted8bits (src, dst, ncol,\n                                                            sample, spp,\n                                                            bps, count,\n                                                            0, ncol,\n                                                            prev_trailing_bits))\n                        {\n\t\t        TIFFError(\"readContigTilesIntoBuffer\",\n                                  \"Unable to extract row %d from tile %lu\", \n\t\t\t\t  row, (unsigned long)TIFFCurrentTile(in));\n\t\t        return 1;\n\t\t        }\n\t\t      break;\n\t\t      }\n                    else\n                      if (extractContigSamplesShifted16bits (src, dst, ncol,\n                                                             sample, spp,\n                                                             bps, count,\n                                                             0, ncol,\n                                                             prev_trailing_bits))\n                        {\n\t\t        TIFFError(\"readContigTilesIntoBuffer\",\n                                  \"Unable to extract row %d from tile %lu\", \n\t\t\t  \t  row, (unsigned long)TIFFCurrentTile(in));\n\t\t        return 1;\n\t\t        }\n\t            break;\n            case 2: if (extractContigSamplesShifted24bits (src, dst, ncol,\n                                                           sample, spp,\n                                                           bps, count,\n                                                           0, ncol,\n                                                           prev_trailing_bits))\n                      {\n\t\t      TIFFError(\"readContigTilesIntoBuffer\",\n                                \"Unable to extract row %d from tile %lu\", \n\t\t  \t        row, (unsigned long)TIFFCurrentTile(in));\n\t\t      return 1;\n\t\t      }\n\t\t    break;\n            case 3:\n            case 4:\n            case 5: if (extractContigSamplesShifted32bits (src, dst, ncol,\n                                                           sample, spp,\n                                                           bps, count,\n                                                           0, ncol,\n                                                           prev_trailing_bits))\n                      {\n\t\t      TIFFError(\"readContigTilesIntoBuffer\",\n                                \"Unable to extract row %d from tile %lu\", \n\t\t\t        row, (unsigned long)TIFFCurrentTile(in));\n\t\t      return 1;\n\t\t      }\n\t\t    break;\n            default: TIFFError(\"readContigTilesIntoBuffer\", \"Unsupported bit depth %d\", bps);\n\t\t     return 1;\n\t    }\n          }\n        prev_trailing_bits += trailing_bits;\n        if (prev_trailing_bits > 7)\n\t  prev_trailing_bits-= 8;\n\t}\n      }\n    }\n\n  _TIFFfree(tilebuf);\n  return status;\n  }\n\nstatic int  readSeparateTilesIntoBuffer (TIFF* in, uint8 *obuf, \n\t\t\t\t\t uint32 imagelength, uint32 imagewidth, \n                                         uint32 tw, uint32 tl,\n                                         uint16 spp, uint16 bps)\n  {\n  int     i, status = 1, sample;\n  int     shift_width, bytes_per_pixel;\n  uint16  bytes_per_sample;\n  uint32  row, col;     /* Current row and col of image */\n  uint32  nrow, ncol;   /* Number of rows and cols in current tile */\n  uint32  row_offset, col_offset; /* Output buffer offsets */\n  tsize_t tbytes = 0, tilesize = TIFFTileSize(in);\n  tsample_t s;\n  uint8*  bufp = (uint8*)obuf;\n  unsigned char *srcbuffs[MAX_SAMPLES];\n  unsigned char *tbuff = NULL;\n\n  bytes_per_sample = (bps + 7) / 8;\n\n  for (sample = 0; (sample < spp) && (sample < MAX_SAMPLES); sample++)\n    {\n    srcbuffs[sample] = NULL;\n    tbuff = (unsigned char *)_TIFFmalloc(tilesize + 8);\n    if (!tbuff)\n      {\n      TIFFError (\"readSeparateStripsIntoBuffer\", \n                 \"Unable to allocate tile read buffer for sample %d\", sample);\n      for (i = 0; i < sample; i++)\n        _TIFFfree (srcbuffs[i]);\n      return 0;\n      }\n    srcbuffs[sample] = tbuff;\n    } \n  /* Each tile contains only the data for a single plane\n   * arranged in scanlines of tw * bytes_per_sample bytes.\n   */\n  for (row = 0; row < imagelength; row += tl)\n    {\n    nrow = (row + tl > imagelength) ? imagelength - row : tl;\n    for (col = 0; col < imagewidth; col += tw)\n      {\n      for (s = 0; s < spp; s++)\n        {  /* Read each plane of a tile set into srcbuffs[s] */\n\ttbytes = TIFFReadTile(in, srcbuffs[s], col, row, 0, s);\n        if (tbytes < 0  && !ignore)\n          {\n\t  TIFFError(TIFFFileName(in),\n                 \"Error, can't read tile for row %lu col %lu, \"\n\t\t \"sample %lu\",\n\t\t (unsigned long) col, (unsigned long) row,\n\t\t (unsigned long) s);\n\t\t status = 0;\n          for (sample = 0; (sample < spp) && (sample < MAX_SAMPLES); sample++)\n            {\n            tbuff = srcbuffs[sample];\n            if (tbuff != NULL)\n              _TIFFfree(tbuff);\n            }\n          return status;\n\t  }\n\t}\n     /* Tiles on the right edge may be padded out to tw \n      * which must be a multiple of 16.\n      * Ncol represents the visible (non padding) portion.  \n      */\n      if (col + tw > imagewidth)\n        ncol = imagewidth - col;\n      else\n        ncol = tw;\n\n      row_offset = row * (((imagewidth * spp * bps) + 7) / 8);\n      col_offset = ((col * spp * bps) + 7) / 8;\n      bufp = obuf + row_offset + col_offset;\n\n      if ((bps % 8) == 0)\n        {\n        if (combineSeparateTileSamplesBytes(srcbuffs, bufp, ncol, nrow, imagewidth,\n\t\t\t\t\t    tw, spp, bps, NULL, 0, 0))\n\t  {\n          status = 0;\n          break;\n      \t  }\n\t}\n      else\n        {\n        bytes_per_pixel  = ((bps * spp) + 7) / 8;\n        if (bytes_per_pixel < (bytes_per_sample + 1))\n          shift_width = bytes_per_pixel;\n        else\n          shift_width = bytes_per_sample + 1;\n\n        switch (shift_width)\n          {\n          case 1: if (combineSeparateTileSamples8bits (srcbuffs, bufp, ncol, nrow,\n                                                       imagewidth, tw, spp, bps, \n\t\t\t\t\t\t       NULL, 0, 0))\n\t            {\n                    status = 0;\n                    break;\n      \t            }\n\t          break;\n          case 2: if (combineSeparateTileSamples16bits (srcbuffs, bufp, ncol, nrow,\n                                                       imagewidth, tw, spp, bps, \n\t\t\t\t\t\t       NULL, 0, 0))\n\t            {\n                    status = 0;\n                    break;\n\t\t    }\n\t          break;\n          case 3: if (combineSeparateTileSamples24bits (srcbuffs, bufp, ncol, nrow,\n                                                       imagewidth, tw, spp, bps, \n\t\t\t\t\t\t       NULL, 0, 0))\n\t            {\n                    status = 0;\n                    break;\n       \t            }\n                  break;\n          case 4: \n          case 5:\n          case 6:\n          case 7:\n          case 8: if (combineSeparateTileSamples32bits (srcbuffs, bufp, ncol, nrow,\n                                                       imagewidth, tw, spp, bps, \n\t\t\t\t\t\t       NULL, 0, 0))\n\t            {\n                    status = 0;\n                    break;\n\t\t    }\n\t          break;\n          default: TIFFError (\"readSeparateTilesIntoBuffer\", \"Unsupported bit depth: %d\", bps);\n                  status = 0;\n                  break;\n          }\n        }\n      }\n    }\n\n  for (sample = 0; (sample < spp) && (sample < MAX_SAMPLES); sample++)\n    {\n    tbuff = srcbuffs[sample];\n    if (tbuff != NULL)\n      _TIFFfree(tbuff);\n    }\n \n  return status;\n  }\n\nstatic int writeBufferToContigStrips(TIFF* out, uint8* buf, uint32 imagelength)\n  {\n  uint32 row, nrows, rowsperstrip;\n  tstrip_t strip = 0;\n  tsize_t stripsize;\n\n  TIFFGetFieldDefaulted(out, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);\n  for (row = 0; row < imagelength; row += rowsperstrip)\n    {\n    nrows = (row + rowsperstrip > imagelength) ?\n\t     imagelength - row : rowsperstrip;\n    stripsize = TIFFVStripSize(out, nrows);\n    if (TIFFWriteEncodedStrip(out, strip++, buf, stripsize) < 0)\n      {\n      TIFFError(TIFFFileName(out), \"Error, can't write strip %u\", strip - 1);\n      return 1;\n      }\n    buf += stripsize;\n    }\n\n  return 0;\n  }\n\n/* Abandon plans to modify code so that plannar orientation separate images\n * do not have all samples for each channel written before all samples\n * for the next channel have been abandoned.\n * Libtiff internals seem to depend on all data for a given sample\n * being contiguous within a strip or tile when PLANAR_CONFIG is \n * separate. All strips or tiles of a given plane are written\n * before any strips or tiles of a different plane are stored.\n */\nstatic int \nwriteBufferToSeparateStrips (TIFF* out, uint8* buf, \n\t\t\t     uint32 length, uint32 width, uint16 spp,\n\t\t\t     struct dump_opts *dump)\n  {\n  uint8   *src;\n  uint16   bps;\n  uint32   row, nrows, rowsize, rowsperstrip;\n  uint32   bytes_per_sample;\n  tsample_t s;\n  tstrip_t strip = 0;\n  tsize_t  stripsize = TIFFStripSize(out);\n  tsize_t  rowstripsize,  scanlinesize = TIFFScanlineSize(out);\n  tsize_t  total_bytes = 0;\n  tdata_t  obuf;\n\n  (void) TIFFGetFieldDefaulted(out, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);\n  (void) TIFFGetField(out, TIFFTAG_BITSPERSAMPLE, &bps);\n  bytes_per_sample = (bps + 7) / 8;\n  rowsize = ((bps * spp * width) + 7) / 8; /* source has interleaved samples */\n  rowstripsize = rowsperstrip * bytes_per_sample * (width + 1); \n\n  obuf = _TIFFmalloc (rowstripsize);\n  if (obuf == NULL)\n    return 1;\n  \n  for (s = 0; s < spp; s++)\n    {\n    for (row = 0; row < length; row += rowsperstrip)\n      {\n      nrows = (row + rowsperstrip > length) ? length - row : rowsperstrip;\n\n      stripsize = TIFFVStripSize(out, nrows);\n      src = buf + (row * rowsize);\n      total_bytes += stripsize;\n      memset (obuf, '\\0', rowstripsize);\n      if (extractContigSamplesToBuffer(obuf, src, nrows, width, s, spp, bps, dump))\n        {\n        _TIFFfree(obuf);\n        return 1;\n\t}\n      if ((dump->outfile != NULL) && (dump->level == 1))\n        {\n        dump_info(dump->outfile, dump->format,\"\", \n                  \"Sample %2d, Strip: %2d, bytes: %4d, Row %4d, bytes: %4d, Input offset: %6d\", \n                  s + 1, strip + 1, stripsize, row + 1, scanlinesize, src - buf);\n        dump_buffer(dump->outfile, dump->format, nrows, scanlinesize, row, obuf);\n\t}\n\n      if (TIFFWriteEncodedStrip(out, strip++, obuf, stripsize) < 0)\n        {\n\tTIFFError(TIFFFileName(out), \"Error, can't write strip %u\", strip - 1);\n\t_TIFFfree(obuf);\n\treturn 1;\n\t}\n      }\n    }      \n\n  _TIFFfree(obuf);\n  return 0;\n}\n\n/* Extract all planes from contiguous buffer into a single tile buffer \n * to be written out as a tile.\n */\nstatic int writeBufferToContigTiles (TIFF* out, uint8* buf, uint32 imagelength,\n\t\t\t\t       uint32 imagewidth, tsample_t spp, \n                                       struct dump_opts* dump)\n  {\n  uint16 bps;\n  uint32 tl, tw;\n  uint32 row, col, nrow, ncol;\n  uint32 src_rowsize, col_offset;\n  uint32 tile_rowsize  = TIFFTileRowSize(out);\n  uint8* bufp = (uint8*) buf;\n  tsize_t tile_buffsize = 0;\n  tsize_t tilesize = TIFFTileSize(out);\n  unsigned char *tilebuf = NULL;\n\n  TIFFGetField(out, TIFFTAG_TILELENGTH, &tl);\n  TIFFGetField(out, TIFFTAG_TILEWIDTH, &tw);\n  TIFFGetField(out, TIFFTAG_BITSPERSAMPLE, &bps);\n\n  tile_buffsize = tilesize;\n  if (tilesize < (tsize_t)(tl * tile_rowsize))\n    {\n#ifdef DEBUG2\n    TIFFError(\"writeBufferToContigTiles\",\n\t      \"Tilesize %lu is too small, using alternate calculation %u\",\n              tilesize, tl * tile_rowsize);\n#endif\n    tile_buffsize = tl * tile_rowsize;\n    }\n\n  tilebuf = _TIFFmalloc(tile_buffsize);\n  if (tilebuf == 0)\n    return 1;\n\n  src_rowsize = ((imagewidth * spp * bps) + 7) / 8;\n  for (row = 0; row < imagelength; row += tl)\n    {\n    nrow = (row + tl > imagelength) ? imagelength - row : tl;\n    for (col = 0; col < imagewidth; col += tw)\n      {\n      /* Calculate visible portion of tile. */\n      if (col + tw > imagewidth)\n\tncol = imagewidth - col;\n      else\n        ncol = tw;\n\n      col_offset = (((col * bps * spp) + 7) / 8);\n      bufp = buf + (row * src_rowsize) + col_offset;\n      if (extractContigSamplesToTileBuffer(tilebuf, bufp, nrow, ncol, imagewidth,\n\t\t\t\t\t   tw, 0, spp, spp, bps, dump) > 0)\n        {\n\tTIFFError(\"writeBufferToContigTiles\", \n                  \"Unable to extract data to tile for row %lu, col %lu\",\n                  (unsigned long) row, (unsigned long)col);\n\t_TIFFfree(tilebuf);\n\treturn 1;\n        }\n\n      if (TIFFWriteTile(out, tilebuf, col, row, 0, 0) < 0)\n        {\n\tTIFFError(\"writeBufferToContigTiles\",\n\t          \"Cannot write tile at %lu %lu\",\n\t          (unsigned long) col, (unsigned long) row);\n\t _TIFFfree(tilebuf);\n\treturn 1;\n\t}\n      }\n    }\n  _TIFFfree(tilebuf);\n\n  return 0;\n  } /* end writeBufferToContigTiles */\n\n/* Extract each plane from contiguous buffer into a single tile buffer \n * to be written out as a tile.\n */\nstatic int writeBufferToSeparateTiles (TIFF* out, uint8* buf, uint32 imagelength,\n\t\t\t\t       uint32 imagewidth, tsample_t spp, \n                                       struct dump_opts * dump)\n  {\n  tdata_t obuf = _TIFFmalloc(TIFFTileSize(out));\n  uint32 tl, tw;\n  uint32 row, col, nrow, ncol;\n  uint32 src_rowsize, col_offset;\n  uint16 bps;\n  tsample_t s;\n  uint8* bufp = (uint8*) buf;\n\n  if (obuf == NULL)\n    return 1;\n\n  TIFFGetField(out, TIFFTAG_TILELENGTH, &tl);\n  TIFFGetField(out, TIFFTAG_TILEWIDTH, &tw);\n  TIFFGetField(out, TIFFTAG_BITSPERSAMPLE, &bps);\n  src_rowsize = ((imagewidth * spp * bps) + 7) / 8;\n         \n  for (row = 0; row < imagelength; row += tl)\n    {\n    nrow = (row + tl > imagelength) ? imagelength - row : tl;\n    for (col = 0; col < imagewidth; col += tw)\n      {\n      /* Calculate visible portion of tile. */\n      if (col + tw > imagewidth)\n\tncol = imagewidth - col;\n      else\n        ncol = tw;\n\n      col_offset = (((col * bps * spp) + 7) / 8);\n      bufp = buf + (row * src_rowsize) + col_offset;\n\n      for (s = 0; s < spp; s++)\n        {\n\tif (extractContigSamplesToTileBuffer(obuf, bufp, nrow, ncol, imagewidth,\n\t\t\t\t\t     tw, s, 1, spp, bps, dump) > 0)\n          {\n\t  TIFFError(\"writeBufferToSeparateTiles\", \n                    \"Unable to extract data to tile for row %lu, col %lu sample %d\",\n                    (unsigned long) row, (unsigned long)col, (int)s);\n\t  _TIFFfree(obuf);\n\t  return 1;\n          }\n\n\tif (TIFFWriteTile(out, obuf, col, row, 0, s) < 0)\n          {\n\t   TIFFError(\"writeBufferToseparateTiles\",\n\t             \"Cannot write tile at %lu %lu sample %lu\",\n\t             (unsigned long) col, (unsigned long) row,\n\t             (unsigned long) s);\n\t   _TIFFfree(obuf);\n\t   return 1;\n\t  }\n\t}\n      }\n    }\n  _TIFFfree(obuf);\n\n  return 0;\n  } /* end writeBufferToSeparateTiles */\n\nstatic void\nprocessG3Options(char* cp)\n{\n\tif( (cp = strchr(cp, ':')) ) {\n\t\tif (defg3opts == (uint32) -1)\n\t\t\tdefg3opts = 0;\n\t\tdo {\n\t\t\tcp++;\n\t\t\tif (strneq(cp, \"1d\", 2))\n\t\t\t\tdefg3opts &= ~GROUP3OPT_2DENCODING;\n\t\t\telse if (strneq(cp, \"2d\", 2))\n\t\t\t\tdefg3opts |= GROUP3OPT_2DENCODING;\n\t\t\telse if (strneq(cp, \"fill\", 4))\n\t\t\t\tdefg3opts |= GROUP3OPT_FILLBITS;\n\t\t\telse\n\t\t\t\tusage();\n\t\t} while( (cp = strchr(cp, ':')) );\n\t}\n}\n\nstatic int\nprocessCompressOptions(char* opt)\n  {\n  char* cp = NULL;\n\n  if (strneq(opt, \"none\",4))\n    {\n    defcompression = COMPRESSION_NONE;\n    /* DELETE ME:  This should not be needed */\n    cp = strchr(opt, ':');\n    if (cp)\n      {\n      if (cp[1] == 'r' )\n\tjpegcolormode = JPEGCOLORMODE_RAW;\n      else if (cp[1] == 'a' )\n\tjpegcolormode = JPEGCOLORMODE_RGB;\n      }\n    /* end DELETE ME: */\n    }\n  else if (streq(opt, \"packbits\"))\n    {\n    defcompression = COMPRESSION_PACKBITS;\n    }\n  else if (strneq(opt, \"jpeg\", 4))\n    {\n    cp = strchr(opt, ':');\n    defcompression = COMPRESSION_JPEG;\n    while ( cp )\n      {\n      if (isdigit((int)cp[1]))\n\tquality = atoi(cp+1);\n      else if (cp[1] == 'r' )\n\tjpegcolormode = JPEGCOLORMODE_RAW;\n      else if (cp[1] == 'a' )\n\tjpegcolormode = JPEGCOLORMODE_RGB;\n      else\n        usage();\n      cp = strchr(cp+1,':');\n      }\n    }\n  else if (strneq(opt, \"g3\", 2))\n    {\n    processG3Options(opt);\n    defcompression = COMPRESSION_CCITTFAX3;\n    }\n  else if (streq(opt, \"g4\"))\n    {\n    defcompression = COMPRESSION_CCITTFAX4;\n    }\n  else if (strneq(opt, \"lzw\", 3))\n    {\n    cp = strchr(opt, ':');\n    if (cp)\n      defpredictor = atoi(cp+1);\n    defcompression = COMPRESSION_LZW;\n    }\n  else if (strneq(opt, \"zip\", 3))\n    {\n    cp = strchr(opt, ':');\n    if (cp)\n      defpredictor = atoi(cp+1);\n    defcompression = COMPRESSION_ADOBE_DEFLATE;\n   }\n  else\n    return (0);\n\n  return (1);\n  }\n\nstatic void\nusage(void)\n  {\n  char buf[BUFSIZ];\n  int i;\n\n  setbuf(stderr, buf);\n  fprintf(stderr, \"\\n%s\\n\", TIFFGetVersion());\n  for (i = 0; stuff[i] != NULL; i++)\n    fprintf(stderr, \"%s\\n\", stuff[i]);\n  exit(-1);\n  }\n\n#define\tCopyField(tag, v) \\\n    if (TIFFGetField(in, tag, &v)) TIFFSetField(out, tag, v)\n#define\tCopyField2(tag, v1, v2) \\\n    if (TIFFGetField(in, tag, &v1, &v2)) TIFFSetField(out, tag, v1, v2)\n#define\tCopyField3(tag, v1, v2, v3) \\\n    if (TIFFGetField(in, tag, &v1, &v2, &v3)) TIFFSetField(out, tag, v1, v2, v3)\n#define\tCopyField4(tag, v1, v2, v3, v4) \\\n    if (TIFFGetField(in, tag, &v1, &v2, &v3, &v4)) TIFFSetField(out, tag, v1, v2, v3, v4)\n\nstatic void\ncpTag(TIFF* in, TIFF* out, uint16 tag, uint16 count, TIFFDataType type)\n{\n\tswitch (type) {\n\tcase TIFF_SHORT:\n\t\tif (count == 1) {\n\t\t\tuint16 shortv;\n\t\t\tCopyField(tag, shortv);\n\t\t} else if (count == 2) {\n\t\t\tuint16 shortv1, shortv2;\n\t\t\tCopyField2(tag, shortv1, shortv2);\n\t\t} else if (count == 4) {\n\t\t\tuint16 *tr, *tg, *tb, *ta;\n\t\t\tCopyField4(tag, tr, tg, tb, ta);\n\t\t} else if (count == (uint16) -1) {\n\t\t\tuint16 shortv1;\n\t\t\tuint16* shortav;\n\t\t\tCopyField2(tag, shortv1, shortav);\n\t\t}\n\t\tbreak;\n\tcase TIFF_LONG:\n\t\t{ uint32 longv;\n\t\t  CopyField(tag, longv);\n\t\t}\n\t\tbreak;\n\tcase TIFF_RATIONAL:\n\t\tif (count == 1) {\n\t\t\tfloat floatv;\n\t\t\tCopyField(tag, floatv);\n\t\t} else if (count == (uint16) -1) {\n\t\t\tfloat* floatav;\n\t\t\tCopyField(tag, floatav);\n\t\t}\n\t\tbreak;\n\tcase TIFF_ASCII:\n\t\t{ char* stringv;\n\t\t  CopyField(tag, stringv);\n\t\t}\n\t\tbreak;\n\tcase TIFF_DOUBLE:\n\t\tif (count == 1) {\n\t\t\tdouble doublev;\n\t\t\tCopyField(tag, doublev);\n\t\t} else if (count == (uint16) -1) {\n\t\t\tdouble* doubleav;\n\t\t\tCopyField(tag, doubleav);\n\t\t}\n\t\tbreak;\n          default:\n                TIFFError(TIFFFileName(in),\n                          \"Data type %d is not supported, tag %d skipped.\",\n                          tag, type);\n\t}\n}\n\nstatic struct cpTag {\n\tuint16\ttag;\n\tuint16\tcount;\n\tTIFFDataType type;\n} tags[] = {\n\t{ TIFFTAG_SUBFILETYPE,\t\t1, TIFF_LONG },\n\t{ TIFFTAG_THRESHHOLDING,\t1, TIFF_SHORT },\n\t{ TIFFTAG_DOCUMENTNAME,\t\t1, TIFF_ASCII },\n\t{ TIFFTAG_IMAGEDESCRIPTION,\t1, TIFF_ASCII },\n\t{ TIFFTAG_MAKE,\t\t\t1, TIFF_ASCII },\n\t{ TIFFTAG_MODEL,\t\t1, TIFF_ASCII },\n\t{ TIFFTAG_MINSAMPLEVALUE,\t1, TIFF_SHORT },\n\t{ TIFFTAG_MAXSAMPLEVALUE,\t1, TIFF_SHORT },\n\t{ TIFFTAG_XRESOLUTION,\t\t1, TIFF_RATIONAL },\n\t{ TIFFTAG_YRESOLUTION,\t\t1, TIFF_RATIONAL },\n\t{ TIFFTAG_PAGENAME,\t\t1, TIFF_ASCII },\n\t{ TIFFTAG_XPOSITION,\t\t1, TIFF_RATIONAL },\n\t{ TIFFTAG_YPOSITION,\t\t1, TIFF_RATIONAL },\n\t{ TIFFTAG_RESOLUTIONUNIT,\t1, TIFF_SHORT },\n\t{ TIFFTAG_SOFTWARE,\t\t1, TIFF_ASCII },\n\t{ TIFFTAG_DATETIME,\t\t1, TIFF_ASCII },\n\t{ TIFFTAG_ARTIST,\t\t1, TIFF_ASCII },\n\t{ TIFFTAG_HOSTCOMPUTER,\t\t1, TIFF_ASCII },\n\t{ TIFFTAG_WHITEPOINT,\t\t(uint16) -1, TIFF_RATIONAL },\n\t{ TIFFTAG_PRIMARYCHROMATICITIES,(uint16) -1,TIFF_RATIONAL },\n\t{ TIFFTAG_HALFTONEHINTS,\t2, TIFF_SHORT },\n\t{ TIFFTAG_INKSET,\t\t1, TIFF_SHORT },\n\t{ TIFFTAG_DOTRANGE,\t\t2, TIFF_SHORT },\n\t{ TIFFTAG_TARGETPRINTER,\t1, TIFF_ASCII },\n\t{ TIFFTAG_SAMPLEFORMAT,\t\t1, TIFF_SHORT },\n\t{ TIFFTAG_YCBCRCOEFFICIENTS,\t(uint16) -1,TIFF_RATIONAL },\n\t{ TIFFTAG_YCBCRSUBSAMPLING,\t2, TIFF_SHORT },\n\t{ TIFFTAG_YCBCRPOSITIONING,\t1, TIFF_SHORT },\n\t{ TIFFTAG_REFERENCEBLACKWHITE,\t(uint16) -1,TIFF_RATIONAL },\n\t{ TIFFTAG_EXTRASAMPLES,\t\t(uint16) -1, TIFF_SHORT },\n\t{ TIFFTAG_SMINSAMPLEVALUE,\t1, TIFF_DOUBLE },\n\t{ TIFFTAG_SMAXSAMPLEVALUE,\t1, TIFF_DOUBLE },\n\t{ TIFFTAG_STONITS,\t\t1, TIFF_DOUBLE },\n};\n#define\tNTAGS\t(sizeof (tags) / sizeof (tags[0]))\n\n#define\tCopyTag(tag, count, type)\tcpTag(in, out, tag, count, type)\n\n/* Fucntions written by Richard Nolde, with exceptions noted. */\nvoid  process_command_opts (int argc, char *argv[], char *mp, char *mode, uint32 *dirnum,\n\t                    uint16 *defconfig, uint16 *deffillorder, uint32 *deftilewidth,\n                            uint32 *deftilelength, uint32 *defrowsperstrip,\n\t\t            struct crop_mask *crop_data, struct pagedef *page, \n                            struct dump_opts *dump,\n                            unsigned int     *imagelist, unsigned int   *image_count )\n    {\n    int   c, good_args = 0;\n    char *opt_offset   = NULL;    /* Position in string of value sought */\n    char *opt_ptr      = NULL;    /* Pointer to next token in option set */\n    char *sep          = NULL;    /* Pointer to a token separator */\n    unsigned int  i, j, start, end;\n    extern int   optind;\n    extern char* optarg;\n\n    *mp++ = 'w';\n    *mp = '\\0';\n    while ((c = getopt(argc, argv,\n       \"ac:d:e:f:hil:m:p:r:stvw:z:BCD:E:F:H:I:J:K:LMN:O:P:R:S:U:V:X:Y:Z:\")) != -1)\n      {\n    good_args++;\n    switch (c) {\n      case 'a': mode[0] = 'a';\t/* append to output */\n\t\tbreak;\n      case 'c':\tif (!processCompressOptions(optarg)) /* compression scheme */\n\t\t  {\n\t\t  TIFFError (\"Unknown compression option\", \"%s\", optarg);\n                  TIFFError (\"For valid options type\", \"tiffcrop -h\");\n                  exit (-1);\n                  }\n\t\tbreak;\n      case 'd':\tstart = strtoul(optarg, NULL, 0); /* initial IFD offset */\n\t        if (start == 0)\n                  {\n\t\t  TIFFError (\"\",\"Directory offset must be greater than zero\");\n\t\t  TIFFError (\"For valid options type\", \"tiffcrop -h\");\n                  exit (-1);\n\t\t  }\n\t        *dirnum = start - 1;\n\t\tbreak;\n      case 'e': switch (tolower(optarg[0])) /* image export modes*/\n                  {\n\t\t  case 'c': crop_data->exp_mode = ONE_FILE_COMPOSITE;\n \t\t            crop_data->img_mode = COMPOSITE_IMAGES;\n\t\t            break; /* Composite */\n\t\t  case 'd': crop_data->exp_mode = ONE_FILE_SEPARATED;\n \t\t            crop_data->img_mode = SEPARATED_IMAGES;\n\t\t            break; /* Divided */\n\t\t  case 'i': crop_data->exp_mode = FILE_PER_IMAGE_COMPOSITE;\n \t\t            crop_data->img_mode = COMPOSITE_IMAGES;\n\t\t            break; /* Image */\n\t\t  case 'm': crop_data->exp_mode = FILE_PER_IMAGE_SEPARATED;\n \t\t            crop_data->img_mode = SEPARATED_IMAGES;\n\t\t            break; /* Multiple */\n\t\t  case 's': crop_data->exp_mode = FILE_PER_SELECTION;\n \t\t            crop_data->img_mode = SEPARATED_IMAGES;\n\t\t            break; /* Sections */\n\t\t  default:  TIFFError (\"Unknown export mode\",\"%s\", optarg);\n                            TIFFError (\"For valid options type\", \"tiffcrop -h\");\n                            exit (-1);\n                  }\n\t        break;\n      case 'f':\tif (streq(optarg, \"lsb2msb\"))\t   /* fill order */\n\t\t  *deffillorder = FILLORDER_LSB2MSB;\n\t\telse if (streq(optarg, \"msb2lsb\"))\n\t\t  *deffillorder = FILLORDER_MSB2LSB;\n\t\telse\n\t\t  {\n\t\t  TIFFError (\"Unknown fill order\", \"%s\", optarg);\n                  TIFFError (\"For valid options type\", \"tiffcrop -h\");\n                  exit (-1);\n                  }\n\t\tbreak;\n      case 'h':\tusage();\n\t\tbreak;\n      case 'i':\tignore = TRUE;\t\t/* ignore errors */\n\t\tbreak;\n      case 'l':\touttiled = TRUE;\t /* tile length */\n\t\t*deftilelength = atoi(optarg);\n\t\tbreak;\n      case 'p': /* planar configuration */\n\t\tif (streq(optarg, \"separate\"))\n\t\t  *defconfig = PLANARCONFIG_SEPARATE;\n\t\telse if (streq(optarg, \"contig\"))\n\t\t  *defconfig = PLANARCONFIG_CONTIG;\n\t\telse\n\t\t  {\n\t\t  TIFFError (\"Unkown planar configuration\", \"%s\", optarg);\n                  TIFFError (\"For valid options type\", \"tiffcrop -h\");\n                  exit (-1);\n                  }\n\t\tbreak;\n      case 'r':\t/* rows/strip */\n\t\t*defrowsperstrip = atol(optarg);\n\t\tbreak;\n      case 's':\t/* generate stripped output */\n\t\touttiled = FALSE;\n\t\tbreak;\n      case 't':\t/* generate tiled output */\n\t\touttiled = TRUE;\n\t\tbreak;\n      case 'v': TIFFError(\"Library Release\", \"%s\", TIFFGetVersion());\n                TIFFError (\"Tiffcrop version\", \"%s, last updated: %s\", \n\t\t\t   tiffcrop_version_id, tiffcrop_rev_date);\n \t        TIFFError (\"Tiffcp code\", \"Copyright (c) 1988-1997 Sam Leffler\");\n\t\tTIFFError (\"           \", \"Copyright (c) 1991-1997 Silicon Graphics, Inc\");\n                TIFFError (\"Tiffcrop additions\", \"Copyright (c) 2007-2009 Richard Nolde\");\n\t        exit (0);\n\t\tbreak;\n      case 'w':\t/* tile width */\n\t\touttiled = TRUE;\n\t\t*deftilewidth = atoi(optarg);\n\t\tbreak;\n      case 'z': /* regions of an image specified as x1,y1,x2,y2:x3,y3,x4,y4 etc */\n\t        crop_data->crop_mode |= CROP_REGIONS;\n\t\tfor (i = 0, opt_ptr = strtok (optarg, \":\");\n                   ((opt_ptr != NULL) &&  (i < MAX_REGIONS));\n                    (opt_ptr = strtok (NULL, \":\")), i++)\n                    {\n\t\t    crop_data->regions++;\n                    if (sscanf(opt_ptr, \"%lf,%lf,%lf,%lf\",\n\t\t\t       &crop_data->corners[i].X1, &crop_data->corners[i].Y1,\n\t\t\t       &crop_data->corners[i].X2, &crop_data->corners[i].Y2) != 4)\n                      {\n                      TIFFError (\"Unable to parse coordinates for region\", \"%d %s\", i, optarg);\n\t\t      TIFFError (\"For valid options type\", \"tiffcrop -h\");\n                      exit (-1);\n\t\t      }\n                    }\n                /*  check for remaining elements over MAX_REGIONS */\n                if ((opt_ptr != NULL) && (i >= MAX_REGIONS))\n                  {\n\t\t  TIFFError (\"Region list exceeds limit of\", \"%d regions %s\", MAX_REGIONS, optarg);\n\t\t  TIFFError (\"For valid options type\", \"tiffcrop -h\");\n                  exit (-1);;\n                  }\n\t\tbreak;\n      /* options for file open modes */\n      case 'B': *mp++ = 'b'; *mp = '\\0';\n\t\tbreak;\n      case 'L': *mp++ = 'l'; *mp = '\\0';\n\t\tbreak;\n      case 'M': *mp++ = 'm'; *mp = '\\0';\n\t\tbreak;\n      case 'C': *mp++ = 'c'; *mp = '\\0';\n\t\tbreak;\n      /* options for Debugging / data dump */\n      case 'D': for (i = 0, opt_ptr = strtok (optarg, \",\");\n                    (opt_ptr != NULL);\n                    (opt_ptr = strtok (NULL, \",\")), i++)\n                    {\n\t\t    opt_offset = strpbrk(opt_ptr, \":=\");\n\t\t    /*\n\t\t    opt_offset = strchr(opt_ptr, ':');\n\t\t    */\n                    if (opt_offset == NULL)\n                      {\n                      TIFFError(\"Invalid dump option\", \"%s\", optarg);\n                      TIFFError (\"For valid options type\", \"tiffcrop -h\");\n                      exit (-1);\n\t\t      }\n                      \n                    *opt_offset = '\\0';\n                    /* convert option to lowercase */\n                    end = strlen (opt_ptr);\n                    for (i = 0; i < end; i++)\n                      *(opt_ptr + i) = tolower(*(opt_ptr + i));\n                    /* Look for dump format specification */\n                    if (strncmp(opt_ptr, \"for\", 3) == 0)\n                      {\n\t\t      /* convert value to lowercase */\n                      end = strlen (opt_offset + 1);\n                      for (i = 1; i <= end; i++)\n                        *(opt_offset + i) = tolower(*(opt_offset + i));\n                      /* check dump format value */\n\t\t      if (strncmp (opt_offset + 1, \"txt\", 3) == 0)\n                        {\n                        dump->format = DUMP_TEXT;\n                        strcpy (dump->mode, \"w\");\n                        }\n                      else\n                        {\n\t\t        if (strncmp(opt_offset + 1, \"raw\", 3) == 0)\n                          {\n                          dump->format = DUMP_RAW;\n                          strcpy (dump->mode, \"wb\");\n                          }\n                        else\n                          {\n                          TIFFError(\"parse_command_opts\", \"Unknown dump format %s\", opt_offset + 1);\n                          TIFFError (\"For valid options type\", \"tiffcrop -h\");\n                          exit (-1);\n\t\t          }\n\t\t\t}\n                      }\n\t\t    else\n                      { /* Look for dump level specification */\n                      if (strncmp (opt_ptr, \"lev\", 3) == 0)\n                        dump->level = atoi(opt_offset + 1);\n                      /* Look for input data dump file name */\n                      if (strncmp (opt_ptr, \"in\", 2) == 0)\n                        strncpy (dump->infilename, opt_offset + 1, PATH_MAX - 20);\n                       /* Look for output data dump file name */\n                      if (strncmp (opt_ptr, \"out\", 3) == 0)\n                          strncpy (dump->outfilename, opt_offset + 1, PATH_MAX - 20);\n                      if (strncmp (opt_ptr, \"deb\", 3) == 0)\n\t\t\tdump->debug = atoi(opt_offset + 1);\n\t\t      }\n                    }\n\t        if ((strlen(dump->infilename)) || (strlen(dump->outfilename)))\n                  {\n\t\t  if (dump->level == 1)\n                    TIFFError(\"\",\"Defaulting to dump level 1, no data.\");\n\t          if (dump->format == DUMP_NONE)\n                    {\n\t\t    TIFFError(\"\", \"You must specify a dump format for dump files\");\n\t\t    TIFFError (\"For valid options type\", \"tiffcrop -h\");\n\t\t    exit (-1);\n\t\t    }\n                  }\n\t        break;\n\n      /* image manipulation routine options */\n      case 'm': /* margins to exclude from selection, uppercase M was already used */\n\t\t/* order of values must be TOP, LEFT, BOTTOM, RIGHT */\n\t\tcrop_data->crop_mode |= CROP_MARGINS;\n                for (i = 0, opt_ptr = strtok (optarg, \",:\");\n                    ((opt_ptr != NULL) &&  (i < 4));\n                     (opt_ptr = strtok (NULL, \",:\")), i++)\n                    {\n\t\t    crop_data->margins[i] = atof(opt_ptr);\n                    }\n\t\tbreak;\n      case 'E':\t/* edge reference */\n\t\tswitch (tolower(optarg[0]))\n                  {\n\t\t  case 't': crop_data->edge_ref = EDGE_TOP;\n                            break;\n                  case 'b': crop_data->edge_ref = EDGE_BOTTOM;\n                             break;\n                  case 'l': crop_data->edge_ref = EDGE_LEFT;\n                            break;\n                  case 'r': crop_data->edge_ref = EDGE_RIGHT;\n                            break;\n\t\t  default:  TIFFError (\"Edge reference must be top, bottom, left, or right\", \"%s\", optarg);\n\t\t\t    TIFFError (\"For valid options type\", \"tiffcrop -h\");\n                            exit (-1);\n\t\t  }\n\t\tbreak;\n      case 'F': /* flip eg mirror image or cropped segment, M was already used */\n\t\tcrop_data->crop_mode |= CROP_MIRROR;\n\t\tswitch (tolower(optarg[0]))\n                  {\n\t\t  case  'h': crop_data->mirror = MIRROR_HORIZ;\n                             break;\n                  case  'v': crop_data->mirror = MIRROR_VERT;\n                             break;\n                  case  'b': crop_data->mirror = MIRROR_BOTH;\n                             break;\n\t\t  default:   TIFFError (\"Flip mode must be horiz, vert, or both\", \"%s\", optarg);\n\t\t\t     TIFFError (\"For valid options type\", \"tiffcrop -h\");\n                             exit (-1);\n\t\t  }\n\t\tbreak;\n      case 'H': /* set horizontal resolution to new value */\n\t\tpage->hres = atof (optarg);\n                page->mode |= PAGE_MODE_RESOLUTION;\n\t\tbreak;\n      case 'I': /* invert the color space, eg black to white */\n\t\tcrop_data->crop_mode |= CROP_INVERT;\n                /* The PHOTOMETIC_INTERPRETATION tag may be updated */\n                if (streq(optarg, \"black\"))\n                  {\n\t\t  crop_data->photometric = PHOTOMETRIC_MINISBLACK;\n\t\t  continue;\n                  }\n                if (streq(optarg, \"white\"))\n                  {\n\t\t  crop_data->photometric = PHOTOMETRIC_MINISWHITE;\n                  continue;\n                  }\n                if (streq(optarg, \"data\")) \n                  {\n\t\t  crop_data->photometric = INVERT_DATA_ONLY;\n                  continue;\n                  }\n                if (streq(optarg, \"both\"))\n                  {\n\t\t  crop_data->photometric = INVERT_DATA_AND_TAG;\n                  continue;\n                  }\n\n\t\tTIFFError(\"Missing or unknown option for inverting PHOTOMETRIC_INTERPRETATION\", \"%s\", optarg);\n\t\tTIFFError (\"For valid options type\", \"tiffcrop -h\");\n                exit (-1);\n\t\tbreak;\n      case 'J': /* horizontal margin for sectioned ouput pages */ \n\t\tpage->hmargin = atof(optarg);\n                page->mode |= PAGE_MODE_MARGINS;\n\t\tbreak;\n      case 'K': /* vertical margin for sectioned ouput pages*/ \n                page->vmargin = atof(optarg);\n                page->mode |= PAGE_MODE_MARGINS;\n\t\tbreak;\n      case 'N':\t/* list of images to process */\n                for (i = 0, opt_ptr = strtok (optarg, \",\");\n                    ((opt_ptr != NULL) &&  (i < MAX_IMAGES));\n                     (opt_ptr = strtok (NULL, \",\")))\n                     { /* We do not know how many images are in file yet \n\t\t\t* so we build a list to include the maximum allowed\n                        * and follow it until we hit the end of the file.\n                        * Image count is not accurate for odd, even, last\n                        * so page numbers won't be valid either.\n                        */\n\t\t     if (streq(opt_ptr, \"odd\"))\n                       {\n\t\t       for (j = 1; j <= MAX_IMAGES; j += 2)\n\t\t\t imagelist[i++] = j;\n                       *image_count = (MAX_IMAGES - 1) / 2;\n                       break;\n\t\t       }\n\t\t     else\n                       {\n\t\t       if (streq(opt_ptr, \"even\"))\n                         {\n\t\t\t for (j = 2; j <= MAX_IMAGES; j += 2)\n\t\t\t   imagelist[i++] = j;\n                         *image_count = MAX_IMAGES / 2;\n                         break;\n\t\t\t }\n\t\t       else\n                         {\n\t\t\t if (streq(opt_ptr, \"last\"))\n\t\t\t   imagelist[i++] = MAX_IMAGES;\n\t\t\t else  /* single value between commas */\n\t\t\t   {\n\t\t\t   sep = strpbrk(opt_ptr, \":-\");\n\t\t\t   if (!sep)\n\t\t\t     imagelist[i++] = atoi(opt_ptr);\n                           else\n                             {\n\t\t\t     *sep = '\\0';\n                             start = atoi (opt_ptr);\n                             if (!strcmp((sep + 1), \"last\"))\n\t\t\t       end = MAX_IMAGES;\n                             else\n                               end = atoi (sep + 1);\n                             for (j = start; j <= end && j - start + i < MAX_IMAGES; j++)\n\t\t\t       imagelist[i++] = j;\n\t\t\t     }\n\t\t\t   }\n\t\t\t }\n\t\t      }\n\t\t    }\n                *image_count = i;\n\t\tbreak;\n      case 'O': /* page orientation */ \n\t\tswitch (tolower(optarg[0]))\n                  {\n\t\t  case  'a': page->orient = ORIENTATION_AUTO;\n                             break;\n\t\t  case  'p': page->orient = ORIENTATION_PORTRAIT;\n                             break;\n\t\t  case  'l': page->orient = ORIENTATION_LANDSCAPE;\n                             break;\n\t\t  default:  TIFFError (\"Orientation must be portrait, landscape, or auto.\", \"%s\", optarg);\n\t\t\t    TIFFError (\"For valid options type\", \"tiffcrop -h\");\n                            exit (-1);\n\t\t  }\n\t\tbreak;\n      case 'P': /* page size selection */ \n                if (get_page_geometry (optarg, page))\n                  {\n\t\t  if (!strcmp(optarg, \"list\"))\n                    {\n\t\t    TIFFError(\"\", \"Name            Width   Length (in inches)\");\n                    for (i = 0; i < MAX_PAPERNAMES - 1; i++)\n                      TIFFError (\"\", \"%-15.15s %5.2f   %5.2f\", \n\t\t\t       PaperTable[i].name, PaperTable[i].width, \n                               PaperTable[i].length);\n\t\t    exit (-1);                   \n                    }\n     \n\t\t  TIFFError (\"Invalid paper size\", \"%s\", optarg);\n                  TIFFError (\"\", \"Select one of:\");\n\t\t  TIFFError(\"\", \"Name            Width   Length (in inches)\");\n                  for (i = 0; i < MAX_PAPERNAMES - 1; i++)\n                    TIFFError (\"\", \"%-15.15s %5.2f   %5.2f\", \n\t\t\t       PaperTable[i].name, PaperTable[i].width, \n                               PaperTable[i].length);\n\t\t  exit (-1);\n\t\t  }\n\t\telse\n                  {\n                  page->mode |= PAGE_MODE_PAPERSIZE;\n\t\t  }\n\t\tbreak;\n      case 'R': /* rotate image or cropped segment */\n\t\tcrop_data->crop_mode |= CROP_ROTATE;\n\t\tswitch (strtoul(optarg, NULL, 0))\n                  {\n\t\t  case  90:  crop_data->rotation = (uint16)90;\n                             break;\n                  case  180: crop_data->rotation = (uint16)180;\n                             break;\n                  case  270: crop_data->rotation = (uint16)270;\n                             break;\n\t\t  default:   TIFFError (\"Rotation must be 90, 180, or 270 degrees clockwise\", \"%s\", optarg);\n\t\t\t     TIFFError (\"For valid options type\", \"tiffcrop -h\");\n                             exit (-1);\n\t\t  }\n\t\tbreak;\n      case 'S':\t/* subdivide into Cols:Rows sections, eg 3:2 would be 3 across and 2 down */\n\t\tsep = strpbrk(optarg, \",:\");\n\t\tif (sep)\n                  {\n                  *sep = '\\0';\n                  page->cols = atoi(optarg);\n                  page->rows = atoi(sep +1);\n\t\t  }\n                else\n                  {\n                  page->cols = atoi(optarg);\n                  page->rows = atoi(optarg);\n\t\t  }\n                if ((page->cols * page->rows) > MAX_SECTIONS)\n                  {\n\t\t  TIFFError (\"Limit for subdivisions, ie rows x columns, exceeded\", \"%d\", MAX_SECTIONS);\n\t\t  exit (-1);\n                  }\n                page->mode |= PAGE_MODE_ROWSCOLS;\n\t\tbreak;\n      case 'U':\t/* units for measurements and offsets */\n\t\tif (streq(optarg, \"in\"))\n                  {\n\t\t  crop_data->res_unit = RESUNIT_INCH;\n\t\t  page->res_unit = RESUNIT_INCH;\n\t\t  }\n\t\telse if (streq(optarg, \"cm\"))\n\t\t  {\n\t\t  crop_data->res_unit = RESUNIT_CENTIMETER;\n\t\t  page->res_unit = RESUNIT_CENTIMETER;\n\t\t  }\n\t\telse if (streq(optarg, \"px\"))\n\t\t  {\n\t\t  crop_data->res_unit = RESUNIT_NONE;\n\t\t  page->res_unit = RESUNIT_NONE;\n\t\t  }\n\t\telse\n                  {\n\t\t  TIFFError (\"Illegal unit of measure\",\"%s\", optarg);\n\t\t  TIFFError (\"For valid options type\", \"tiffcrop -h\");\n                  exit (-1);\n\t\t  }\n\t\tbreak;\n      case 'V': /* set vertical resolution to new value */\n\t\tpage->vres = atof (optarg);\n                page->mode |= PAGE_MODE_RESOLUTION;\n\t\tbreak;\n      case 'X':\t/* selection width */\n\t\tcrop_data->crop_mode |= CROP_WIDTH;\n\t\tcrop_data->width = atof(optarg);\n\t\tbreak;\n      case 'Y':\t/* selection length */\n\t\tcrop_data->crop_mode |= CROP_LENGTH;\n\t\tcrop_data->length = atof(optarg);\n\t\tbreak;\n      case 'Z': /* zones of an image X:Y read as zone X of Y */\n\t\tcrop_data->crop_mode |= CROP_ZONES;\n\t\tfor (i = 0, opt_ptr = strtok (optarg, \",\");\n                   ((opt_ptr != NULL) &&  (i < MAX_REGIONS));\n                    (opt_ptr = strtok (NULL, \",\")), i++)\n                    {\n\t\t    crop_data->zones++;\n\t\t    opt_offset = strchr(opt_ptr, ':');\n                    *opt_offset = '\\0';\n                    crop_data->zonelist[i].position = atoi(opt_ptr);\n                    crop_data->zonelist[i].total    = atoi(opt_offset + 1);\n                    }\n                /*  check for remaining elements over MAX_REGIONS */\n                if ((opt_ptr != NULL) && (i >= MAX_REGIONS))\n                  {\n\t\t  TIFFError(\"Zone list exceeds region limit\", \"%d\",  MAX_REGIONS);\n\t\t  exit (-1);\n                  }\n\t\tbreak;\n    case '?':\tTIFFError (\"For valid options type\", \"tiffcrop -h\");\n                exit (-1);\n\t\t/*NOTREACHED*/\n      }\n    }\n  }  /* end process_command_opts */\n\n/* Start a new output file if one has not been previously opened or\n * autoindex is set to non-zero. Update page and file counters\n * so TIFFTAG PAGENUM will be correct in image.\n */\nstatic int \nupdate_output_file (TIFF **tiffout, char *mode, int autoindex,\n                    char *outname, unsigned int *page)\n  {\n  static int findex = 0;    /* file sequence indicator */\n  char  *sep;\n  char   filenum[16];\n  char   export_ext[16];\n  char   exportname[PATH_MAX];\n\n  strcpy (export_ext, \".tiff\");\n  if (autoindex && (*tiffout != NULL))\n    {   \n    /* Close any export file that was previously opened */\n    TIFFClose (*tiffout);\n    *tiffout = NULL;\n    }\n\n  strncpy (exportname, outname, PATH_MAX - 15);\n  if (*tiffout == NULL)   /* This is a new export file */\n    {\n    if (autoindex)\n      { /* create a new filename for each export */\n      findex++;\n      if ((sep = strstr(exportname, \".tif\")) || (sep = strstr(exportname, \".TIF\")))\n        {\n        strncpy (export_ext, sep, 5);\n        *sep = '\\0';\n        }\n      else\n        strncpy (export_ext, \".tiff\", 5);\n      export_ext[5] = '\\0';\n\n      sprintf (filenum, \"-%03d%s\", findex, export_ext);\n      filenum[15] = '\\0';\n      strncat (exportname, filenum, 14);\n      }\n\n    *tiffout = TIFFOpen(exportname, mode);\n    if (*tiffout == NULL)\n      {\n      TIFFError(\"update_output_file\", \"Unable to open output file %s\\n\", exportname);\n      return 1;\n      }\n    *page = 0; \n\n    return 0;\n    }\n  else \n    (*page)++;\n\n  return 0;\n  } /* end update_output_file */\n\n\nint\nmain(int argc, char* argv[])\n  {\n  extern int optind;\n  uint16 defconfig = (uint16) -1;\n  uint16 deffillorder = 0;\n  uint32 deftilewidth = (uint32) 0;\n  uint32 deftilelength = (uint32) 0;\n  uint32 defrowsperstrip = (uint32) 0;\n  uint32 dirnum = 0;\n\n  TIFF *in = NULL;\n  TIFF *out = NULL;\n  char  mode[10];\n  char *mp = mode;\n\n  /** RJN additions **/\n  struct image_data image;     /* Image parameters for one image */\n  struct crop_mask  crop;      /* Cropping parameters for all images */\n  struct pagedef    page;      /* Page definition for output pages */\n  struct pageseg    sections[MAX_SECTIONS];  /* Sections of one output page */\n  struct buffinfo   seg_buffs[MAX_SECTIONS]; /* Segment buffer sizes and pointers */\n  struct dump_opts  dump;                  /* Data dump options */\n  unsigned char *read_buff    = NULL;      /* Input image data buffer */\n  unsigned char *crop_buff    = NULL;      /* Crop area buffer */\n  unsigned char *sect_buff    = NULL;      /* Image section buffer */\n  unsigned char *sect_src     = NULL;      /* Image section buffer pointer */\n  unsigned int  imagelist[MAX_IMAGES + 1]; /* individually specified images */\n  unsigned int  image_count  = 0;\n  unsigned int  dump_images  = 0;\n  unsigned int  next_image   = 0;\n  unsigned int  next_page    = 0;\n  unsigned int  total_pages  = 0;\n  unsigned int  total_images = 0;\n  unsigned int  end_of_input = FALSE;\n  int    seg, length;\n  char   temp_filename[PATH_MAX + 1];\n  memset (temp_filename, '\\0', PATH_MAX + 1);              \n  little_endian = *((unsigned char *)&little_endian) & '1';\n\n  initImageData(&image);\n  initCropMasks(&crop);\n  initPageSetup(&page, sections, seg_buffs);\n  initDumpOptions(&dump);\n\n  process_command_opts (argc, argv, mp, mode, &dirnum, &defconfig, \n                        &deffillorder, &deftilewidth, &deftilelength, &defrowsperstrip,\n\t                &crop, &page, &dump, imagelist, &image_count);\n\n  if (argc - optind < 2)\n    usage();\n\n  if ((argc - optind) == 2)\n    pageNum = -1;\n  else\n    total_images = 0;\n  /* read multiple input files and write to output file(s) */\n  while (optind < argc - 1)\n    {\n    in = TIFFOpen (argv[optind], \"r\");\n    if (in == NULL)\n      return (-3);\n\n    /* If only one input file is specified, we can use directory count */\n    total_images = TIFFNumberOfDirectories(in); \n    if (image_count == 0)\n      {\n      dirnum = 0;\n      total_pages = total_images; /* Only valid with single input file */\n      }\n    else\n      {\n      dirnum = (tdir_t)(imagelist[next_image] - 1);\n      next_image++;\n\n      /* Total pages only valid for enumerated list of pages not derived\n       * using odd, even, or last keywords.\n       */\n      if (image_count >  total_images)\n\timage_count = total_images;\n      \n      total_pages = image_count;\n      }\n\n    /* MAX_IMAGES is used for special case \"last\" in selection list */\n    if (dirnum == (MAX_IMAGES - 1))\n      dirnum = total_images - 1;\n\n    if (dirnum > (total_images))\n      {\n      TIFFError (TIFFFileName(in), \n      \"Invalid image number %d, File contains only %d images\", \n\t\t (int)dirnum + 1, total_images);\n      if (out != NULL)\n        (void) TIFFClose(out);\n      return (1);\n      }\n\n    if (dirnum != 0 && !TIFFSetDirectory(in, (tdir_t)dirnum))\n      {\n      TIFFError(TIFFFileName(in),\"Error, setting subdirectory at %d\", dirnum);\n      if (out != NULL)\n        (void) TIFFClose(out);\n      return (1);\n      }\n\n    end_of_input = FALSE;\n    while (end_of_input == FALSE)\n      {\n      config = defconfig;\n      compression = defcompression;\n      predictor = defpredictor;\n      fillorder = deffillorder;\n      rowsperstrip = defrowsperstrip;\n      tilewidth = deftilewidth;\n      tilelength = deftilelength;\n      g3opts = defg3opts;\n\n      if (dump.format != DUMP_NONE)\n        {\n        /* manage input and/or output dump files here */\n\tdump_images++;\n        length = strlen(dump.infilename);\n        if (length > 0)\n          {\n          if (dump.infile != NULL)\n            fclose (dump.infile);\n\n          sprintf (temp_filename, \"%s-read-%03d.%s\", dump.infilename, dump_images,\n                  (dump.format == DUMP_TEXT) ? \"txt\" : \"raw\");\n          if ((dump.infile = fopen(temp_filename, dump.mode)) == NULL)\n            {\n\t    TIFFError (\"Unable to open dump file for writing\", \"%s\", temp_filename);\n\t    exit (-1);\n            }\n          dump_info(dump.infile, dump.format, \"Reading image\",\"%d from %s\", \n                    dump_images, TIFFFileName(in));\n          } \n        length = strlen(dump.outfilename);\n        if (length > 0)\n          {\n          if (dump.outfile != NULL)\n            fclose (dump.outfile);\n\n          sprintf (temp_filename, \"%s-write-%03d.%s\", dump.outfilename, dump_images,\n                  (dump.format == DUMP_TEXT) ? \"txt\" : \"raw\");\n          if ((dump.outfile = fopen(temp_filename, dump.mode)) == NULL)\n            {\n\t      TIFFError (\"Unable to open dump file for writing\", \"%s\", temp_filename);\n\t    exit (-1);\n            }\n          dump_info(dump.outfile, dump.format, \"Writing image\",\"%d from %s\", \n                    dump_images, TIFFFileName(in));\n          } \n        }\n\n      if (dump.debug)\n         TIFFError(\"main\", \"Reading image %4d of %4d total pages.\", dirnum + 1, total_pages);\n\n      if (loadImage(in, &image, &dump, &read_buff))\n        {\n        TIFFError(\"main\", \"Unable to load source image\");\n        exit (-1);\n        }\n\n      /* Correct the image orientation if it was not ORIENTATION_TOPLEFT.\n       */\n      if (image.adjustments != 0)\n        {\n\tif (correct_orientation(&image, &read_buff))\n\t    TIFFError(\"main\", \"Unable to correct image orientation\");\n        }\n\n      if (getCropOffsets(&image, &crop, &dump))\n        {\n        TIFFError(\"main\", \"Unable to define crop regions\");\n        exit (-1);\n\t}\n\n      if (crop.selections > 0)\n        {\n        if (processCropSelections(&image, &crop, &read_buff, seg_buffs))\n          {\n          TIFFError(\"main\", \"Unable to process image selections\");\n          exit (-1);\n\t  }\n\t}\n      else  /* Single image segment without zones or regions */\n        {\n        if (createCroppedImage(&image, &crop, &read_buff, &crop_buff))\n          {\n          TIFFError(\"main\", \"Unable to create output image\");\n          exit (-1);\n\t  }\n\t}\n      if (page.mode == PAGE_MODE_NONE)\n        {  /* Whole image or sections not based on output page size */\n        if (crop.selections > 0)\n          {\n\t  writeSelections(in, &out, &crop, &image, &dump, seg_buffs,\n                          mp, argv[argc - 1], &next_page, total_pages);\n          }\n\telse  /* One file all images and sections */\n          {\n\t  if (update_output_file (&out, mp, crop.exp_mode, argv[argc - 1],\n                                  &next_page))\n             exit (1);\n          if (writeCroppedImage(in, out, &image, &dump,crop.combined_width, \n                                crop.combined_length, crop_buff, next_page, total_pages))\n            {\n             TIFFError(\"main\", \"Unable to write new image\");\n             exit (-1);\n\t    }\n          }\n\t}\n      else\n        {\n\t/* If we used a crop buffer, our data is there, otherwise it is\n         * in the read_buffer\n         */\n\tif (crop_buff != NULL)  \n\t  sect_src = crop_buff;\n        else\n          sect_src = read_buff;\n        /* Break input image into pages or rows and columns */\n        if (computeOutputPixelOffsets(&crop, &image, &page, sections, &dump))\n          {\n          TIFFError(\"main\", \"Unable to compute output section data\");\n          exit (-1);\n\t  }\n        /* If there are multiple files on the command line, the final one is assumed \n         * to be the output filename into which the images are written.\n         */\n\tif (update_output_file (&out, mp, crop.exp_mode, argv[argc - 1], &next_page))\n          exit (1);\n\n\tif (writeImageSections(in, out, &image, &page, sections, &dump, sect_src, &sect_buff))\n          {\n          TIFFError(\"main\", \"Unable to write image sections\");\n          exit (-1);\n\t  }\n        }\n\n      /* No image list specified, just read the next image */\n      if (image_count == 0)\n        dirnum++;\n      else\n        {\n\tdirnum = (tdir_t)(imagelist[next_image] - 1);\n        next_image++;\n        }\n\n      if (dirnum == MAX_IMAGES - 1)\n        dirnum = TIFFNumberOfDirectories(in) - 1;\n\n      if (!TIFFSetDirectory(in, (tdir_t)dirnum))\n        end_of_input = TRUE;\n      }\n    TIFFClose(in);\n    optind++;\n    }\n\n  /* If we did not use the read buffer as the crop buffer */\n  if (read_buff)\n    _TIFFfree(read_buff);\n\n  if (crop_buff)\n    _TIFFfree(crop_buff);\n\n  if (sect_buff)\n    _TIFFfree(sect_buff);\n\n   /* Clean up any segment buffers used for zones or regions */\n  for (seg = 0; seg < crop.selections; seg++)\n    _TIFFfree (seg_buffs[seg].buffer);\n\n  if (dump.format != DUMP_NONE)\n    {\n    if (dump.infile != NULL)\n     fclose (dump.infile);\n\n    if (dump.outfile != NULL)\n      {\n      dump_info (dump.outfile, dump.format, \"\", \"Completed run for %s\", TIFFFileName(out));\n      fclose (dump.outfile);\n      }\n    }\n\n  TIFFClose(out);\n\n  return (0);\n  } /* end main */\n\n\n/* Debugging functions */\nstatic int dump_data (FILE *dumpfile, int format, char *dump_tag, unsigned char *data, uint32 count)\n  {\n  int j, k;\n  uint32 i;\n  char  dump_array[10];\n  unsigned char bitset;\n\n  if (dumpfile == NULL)\n    {\n    TIFFError (\"\", \"Invalid FILE pointer for dump file\\n\");\n    return (1);\n    }\n\n  if (format == DUMP_TEXT)\n    {\n    fprintf (dumpfile,\" %s  \", dump_tag);\n    for (i = 0; i < count; i++)\n      {\n      for (j = 0, k = 7; j < 8; j++, k--)\n        {\n\tbitset = (*(data + i)) & (((unsigned char)1 << k)) ? 1 : 0;\n        sprintf(&dump_array[j], (bitset) ? \"1\" : \"0\");\n        }\n      dump_array[8] = '\\0';\n      fprintf (dumpfile,\" %s\", dump_array);\n      }\n    fprintf (dumpfile,\"\\n\");\n    }\n  else\n    {\n    if ((fwrite (data, 1, count, dumpfile)) != count)\n      {\n      TIFFError (\"\", \"Unable to write binary data to dump file\\n\");\n      return (1);\n      }\n    }\n\n  return (0);\n  }\n\nstatic int dump_byte (FILE *dumpfile, int format, char *dump_tag, unsigned char data)\n  {\n  int j, k;\n  char  dump_array[10];\n  unsigned char bitset;\n\n  if (dumpfile == NULL)\n    {\n    TIFFError (\"\", \"Invalid FILE pointer for dump file\\n\");\n    return (1);\n    }\n\n  if (format == DUMP_TEXT)\n    {\n    fprintf (dumpfile,\" %s  \", dump_tag);\n    for (j = 0, k = 7; j < 8; j++, k--)\n      {\n      bitset = data & (((unsigned char)1 << k)) ? 1 : 0;\n      sprintf(&dump_array[j], (bitset) ? \"1\" : \"0\");\n      }\n    dump_array[8] = '\\0';\n    fprintf (dumpfile,\" %s\\n\", dump_array);\n    }\n  else\n    {\n    if ((fwrite (&data, 1, 1, dumpfile)) != 1)\n      {\n      TIFFError (\"\", \"Unable to write binary data to dump file\\n\");\n      return (1);\n      }\n    }\n\n  return (0);\n  }\n\nstatic int dump_short (FILE *dumpfile, int format, char *dump_tag, uint16 data)\n  {\n  int j, k;\n  char  dump_array[20];\n  unsigned char bitset;\n\n  if (dumpfile == NULL)\n    {\n    TIFFError (\"\", \"Invalid FILE pointer for dump file\\n\");\n    return (1);\n    }\n\n  if (format == DUMP_TEXT)\n    {\n    fprintf (dumpfile,\" %s  \", dump_tag);\n    for (j = 0, k = 15; k >= 0; j++, k--)\n      {\n      bitset = data & (((unsigned char)1 << k)) ? 1 : 0;\n      sprintf(&dump_array[j], (bitset) ? \"1\" : \"0\");\n      if ((k % 8) == 0)\n          sprintf(&dump_array[++j], \" \");\n      }\n    dump_array[17] = '\\0';\n    fprintf (dumpfile,\" %s\\n\", dump_array);\n    }\n  else\n    {\n    if ((fwrite (&data, 2, 1, dumpfile)) != 2)\n      {\n      TIFFError (\"\", \"Unable to write binary data to dump file\\n\");\n      return (1);\n      }\n    }\n\n  return (0);\n  }\n\nstatic int dump_long (FILE *dumpfile, int format, char *dump_tag, uint32 data)\n  {\n  int j, k;\n  char  dump_array[40];\n  unsigned char bitset;\n\n  if (dumpfile == NULL)\n    {\n    TIFFError (\"\", \"Invalid FILE pointer for dump file\\n\");\n    return (1);\n    }\n\n  if (format == DUMP_TEXT)\n    {\n    fprintf (dumpfile,\" %s  \", dump_tag);\n    for (j = 0, k = 31; k >= 0; j++, k--)\n      {\n      bitset = data & (((uint32)1 << k)) ? 1 : 0;\n      sprintf(&dump_array[j], (bitset) ? \"1\" : \"0\");\n      if ((k % 8) == 0)\n          sprintf(&dump_array[++j], \" \");\n      }\n    dump_array[35] = '\\0';\n    fprintf (dumpfile,\" %s\\n\", dump_array);\n    }\n  else\n    {\n    if ((fwrite (&data, 4, 1, dumpfile)) != 4)\n      {\n      TIFFError (\"\", \"Unable to write binary data to dump file\\n\");\n      return (1);\n      }\n    }\n  return (0);\n  }\n\nstatic int dump_wide (FILE *dumpfile, int format, char *dump_tag, uint64 data)\n  {\n  int j, k;\n  char  dump_array[80];\n  unsigned char bitset;\n\n  if (dumpfile == NULL)\n    {\n    TIFFError (\"\", \"Invalid FILE pointer for dump file\\n\");\n    return (1);\n    }\n\n  if (format == DUMP_TEXT)\n    {\n    fprintf (dumpfile,\" %s  \", dump_tag);\n    for (j = 0, k = 63; k >= 0; j++, k--)\n      {\n      bitset = data & (((uint64)1 << k)) ? 1 : 0;\n      sprintf(&dump_array[j], (bitset) ? \"1\" : \"0\");\n      if ((k % 8) == 0)\n          sprintf(&dump_array[++j], \" \");\n      }\n    dump_array[71] = '\\0';\n    fprintf (dumpfile,\" %s\\n\", dump_array);\n    }\n  else\n    {\n    if ((fwrite (&data, 8, 1, dumpfile)) != 8)\n      {\n      TIFFError (\"\", \"Unable to write binary data to dump file\\n\");\n      return (1);\n      }\n    }\n\n  return (0);\n  }\n\nstatic void dump_info(FILE *dumpfile, int format, char *prefix, char *msg, ...)\n  {\n  if (format == DUMP_TEXT)\n    {\n    va_list ap;\n    va_start(ap, msg);\n    fprintf(dumpfile, \"%s \", prefix);\n    vfprintf(dumpfile, msg, ap);\n    fprintf(dumpfile, \"\\n\");\n    }\n  }\n\nstatic int dump_buffer (FILE* dumpfile, int format, uint32 rows, uint32 width, \n                 uint32 row, unsigned char *buff)\n  {\n  int j, k;\n  uint32 i;\n  unsigned char * dump_ptr;\n\n  if (dumpfile == NULL)\n    {\n    TIFFError (\"\", \"Invalid FILE pointer for dump file\\n\");\n    return (1);\n    }\n\n  for (i = 0; i < rows; i++)\n    {\n    dump_ptr = buff + (i * width);\n    if (format == DUMP_TEXT)\n      dump_info (dumpfile, format, \"\", \n                 \"Row %4d, %d bytes at offset %d\",\n\t         row + i + 1, width, row * width);\n     \n    for (j = 0, k = width; k >= 10; j += 10, k -= 10, dump_ptr += 10)\n      dump_data (dumpfile, format, \"\", dump_ptr, 10);\n    if (k > 0)\n      dump_data (dumpfile, format, \"\", dump_ptr, k);\n    }\n  return (0);\n  }\n\n/* Extract one or more samples from an interleaved buffer. If count == 1,\n * only the sample plane indicated by sample will be extracted.  If count > 1, \n * count samples beginning at sample will be extracted. Portions of a \n * scanline can be extracted by specifying a start and end value.\n */\n\nstatic int \nextractContigSamplesBytes (uint8 *in, uint8 *out, uint32 cols, \n                           tsample_t sample, uint16 spp, uint16 bps, \n                           tsample_t count, uint32 start, uint32 end)\n  {\n  int i, bytes_per_sample, sindex;\n  uint32 col, dst_rowsize, bit_offset;\n  uint32 src_byte, src_bit;\n  uint8 *src = in;\n  uint8 *dst = out;\n\n  if ((src == NULL) || (dst == NULL))\n    {\n    TIFFError(\"extractContigSamplesBytes\",\"Invalid input or output buffer\");\n    return (1);\n    }\n\n  if ((start > end) || (start > cols))\n    {\n    TIFFError (\"extractContigSamplesBytes\", \n               \"Invalid start column value %d ignored\", start);\n    start = 0;\n    }\n  if ((end == 0) || (end > cols))\n    {\n    TIFFError (\"extractContigSamplesBytes\", \n               \"Invalid end column value %d ignored\", end);\n    end = cols;\n    }\n\n  dst_rowsize = (bps * (end - start) * count) / 8;\n\n  bytes_per_sample = (bps + 7) / 8; \n  /* Optimize case for copying all samples */\n  if (count == spp)\n    {\n    src = in + (start * spp * bytes_per_sample);\n    _TIFFmemcpy (dst, src, dst_rowsize);\n    }\n  else\n    {\n    for (col = start; col < end; col++)\n      {\n      for (sindex = sample; (sindex < spp) && (sindex < (sample + count)); sindex++)\n        {\n        bit_offset = col * bps * spp;\n        if (sindex == 0)\n          {\n          src_byte = bit_offset / 8;\n          src_bit  = bit_offset % 8;\n          }\n        else\n          {\n          src_byte = (bit_offset + (sindex * bps)) / 8;\n          src_bit  = (bit_offset + (sindex * bps)) % 8;\n          }\n        src = in + src_byte;\n        for (i = 0; i < bytes_per_sample; i++)\n            *dst++ = *src++;\n        }\n      }\n    }\n\n  return (0);\n  } /* end extractContigSamplesBytes */\n\nstatic int\nextractContigSamples8bits (uint8 *in, uint8 *out, uint32 cols,\n                           tsample_t sample, uint16 spp, uint16 bps, \n                           tsample_t count, uint32 start, uint32 end)\n  {\n  int    ready_bits = 0, sindex = 0;\n  uint32 col, src_byte, src_bit, bit_offset;\n  uint8  maskbits = 0, matchbits = 0;\n  uint8  buff1 = 0, buff2 = 0;\n  uint8 *src = in;\n  uint8 *dst = out;\n\n  if ((src == NULL) || (dst == NULL))\n    {\n    TIFFError(\"extractContigSamples8bits\",\"Invalid input or output buffer\");\n    return (1);\n    }\n\n  if ((start > end) || (start > cols))\n    {\n    TIFFError (\"extractContigSamples8bits\", \n               \"Invalid start column value %d ignored\", start);\n    start = 0;\n    }\n  if ((end == 0) || (end > cols))\n    {\n    TIFFError (\"extractContigSamples8bits\", \n               \"Invalid end column value %d ignored\", end);\n    end = cols;\n    }\n  \n  ready_bits = 0;\n  maskbits =  (uint8)-1 >> ( 8 - bps);\n  buff1 = buff2 = 0;\n  for (col = start; col < end; col++)\n    {    /* Compute src byte(s) and bits within byte(s) */\n    bit_offset = col * bps * spp;\n    for (sindex = sample; (sindex < spp) && (sindex < (sample + count)); sindex++)\n      {\n      if (sindex == 0)\n        {\n        src_byte = bit_offset / 8;\n        src_bit  = bit_offset % 8;\n        }\n      else\n        {\n        src_byte = (bit_offset + (sindex * bps)) / 8;\n        src_bit  = (bit_offset + (sindex * bps)) % 8;\n        }\n\n      src = in + src_byte;\n      matchbits = maskbits << (8 - src_bit - bps); \n      buff1 = ((*src) & matchbits) << (src_bit);\n\n      /* If we have a full buffer's worth, write it out */\n      if (ready_bits >= 8)\n        {\n        *dst++ = buff2;\n        buff2 = buff1;\n        ready_bits -= 8;\n        }\n      else\n        buff2 = (buff2 | (buff1 >> ready_bits));\n      ready_bits += bps;\n      }\n    }\n\n  while (ready_bits > 0)\n    {\n    buff1 = (buff2 & ((unsigned int)255 << (8 - ready_bits)));\n    *dst++ = buff1;\n    ready_bits -= 8;\n    }\n\n  return (0);\n  } /* end extractContigSamples8bits */\n\nstatic int\nextractContigSamples16bits (uint8 *in, uint8 *out, uint32 cols, \n                            tsample_t sample, uint16 spp, uint16 bps, \n                            tsample_t count, uint32 start, uint32 end)\n  {\n  int    ready_bits = 0, sindex = 0;\n  uint32 col, src_byte, src_bit, bit_offset;\n  uint16 maskbits = 0, matchbits = 0;\n  uint16 buff1 = 0, buff2 = 0;\n  uint8  bytebuff = 0;\n  uint8 *src = in;\n  uint8 *dst = out;\n\n  if ((src == NULL) || (dst == NULL))\n    {\n    TIFFError(\"extractContigSamples16bits\",\"Invalid input or output buffer\");\n    return (1);\n    }\n\n  if ((start > end) || (start > cols))\n    {\n    TIFFError (\"extractContigSamples16bits\", \n               \"Invalid start column value %d ignored\", start);\n    start = 0;\n    }\n  if ((end == 0) || (end > cols))\n    {\n    TIFFError (\"extractContigSamples16bits\", \n               \"Invalid end column value %d ignored\", end);\n    end = cols;\n    }\n\n  ready_bits = 0;\n  maskbits = (uint16)-1 >> (16 - bps);\n\n  for (col = start; col < end; col++)\n    {    /* Compute src byte(s) and bits within byte(s) */\n    bit_offset = col * bps * spp;\n    for (sindex = sample; (sindex < spp) && (sindex < (sample + count)); sindex++)\n      {\n      if (sindex == 0)\n        {\n        src_byte = bit_offset / 8;\n        src_bit  = bit_offset % 8;\n        }\n      else\n        {\n        src_byte = (bit_offset + (sindex * bps)) / 8;\n        src_bit  = (bit_offset + (sindex * bps)) % 8;\n        }\n\n      src = in + src_byte;\n      matchbits = maskbits << (16 - src_bit - bps); \n\n      if (little_endian)\n        buff1 = (src[0] << 8) | src[1];\n      else\n        buff1 = (src[1] << 8) | src[0];\n\n      buff1 = (buff1 & matchbits) << (src_bit);\n      if (ready_bits < 8) /* add another bps bits to the buffer */\n        { \n        bytebuff = 0;\n        buff2 = (buff2 | (buff1 >> ready_bits));\n        }\n      else /* If we have a full buffer's worth, write it out */\n        {\n        bytebuff = (buff2 >> 8);\n        *dst++ = bytebuff;\n        ready_bits -= 8;\n        /* shift in new bits */\n        buff2 = ((buff2 << 8) | (buff1 >> ready_bits));\n        }\n      ready_bits += bps;\n      }\n    }\n\n  /* catch any trailing bits at the end of the line */\n  while (ready_bits > 0)\n    {\n    bytebuff = (buff2 >> 8);\n    *dst++ = bytebuff;\n    ready_bits -= 8;\n    }\n  \n  return (0);\n  } /* end extractContigSamples16bits */\n\n\nstatic int\nextractContigSamples24bits (uint8 *in, uint8 *out, uint32 cols,\n \t                    tsample_t sample, uint16 spp, uint16 bps, \n                            tsample_t count, uint32 start, uint32 end)\n  {\n  int    ready_bits = 0, sindex = 0;\n  uint32 col, src_byte, src_bit, bit_offset;\n  uint32 maskbits = 0, matchbits = 0;\n  uint32 buff1 = 0, buff2 = 0;\n  uint8  bytebuff1 = 0, bytebuff2 = 0;\n  uint8 *src = in;\n  uint8 *dst = out;\n\n  if ((in == NULL) || (out == NULL))\n    {\n    TIFFError(\"extractContigSamples24bits\",\"Invalid input or output buffer\");\n    return (1);\n    }\n\n  if ((start > end) || (start > cols))\n    {\n    TIFFError (\"extractContigSamples24bits\", \n               \"Invalid start column value %d ignored\", start);\n    start = 0;\n    }\n  if ((end == 0) || (end > cols))\n    {\n    TIFFError (\"extractContigSamples24bits\", \n               \"Invalid end column value %d ignored\", end);\n    end = cols;\n    }\n\n  ready_bits = 0;\n  maskbits =  (uint32)-1 >> ( 32 - bps);\n  for (col = start; col < end; col++)\n    {\n    /* Compute src byte(s) and bits within byte(s) */\n    bit_offset = col * bps * spp;\n    for (sindex = sample; (sindex < spp) && (sindex < (sample + count)); sindex++)\n      {\n      if (sindex == 0)\n        {\n        src_byte = bit_offset / 8;\n        src_bit  = bit_offset % 8;\n        }\n      else\n        {\n        src_byte = (bit_offset + (sindex * bps)) / 8;\n        src_bit  = (bit_offset + (sindex * bps)) % 8;\n        }\n\n      src = in + src_byte;\n      matchbits = maskbits << (32 - src_bit - bps); \n      if (little_endian)\n\tbuff1 = (src[0] << 24) | (src[1] << 16) | (src[2] << 8) | src[3];\n      else\n\tbuff1 = (src[3] << 24) | (src[2] << 16) | (src[1] << 8) | src[0];\n      buff1 = (buff1 & matchbits) << (src_bit);\n\n      if (ready_bits < 16) /* add another bps bits to the buffer */\n        {\n        bytebuff1 = bytebuff2 = 0;\n        buff2 = (buff2 | (buff1 >> ready_bits));\n        }\n      else /* If we have a full buffer's worth, write it out */\n        {\n        bytebuff1 = (buff2 >> 24);\n        *dst++ = bytebuff1;\n        bytebuff2 = (buff2 >> 16);\n        *dst++ = bytebuff2;\n        ready_bits -= 16;\n\n        /* shift in new bits */\n        buff2 = ((buff2 << 16) | (buff1 >> ready_bits));\n        }\n      ready_bits += bps;\n      }\n    }\n\n  /* catch any trailing bits at the end of the line */\n  while (ready_bits > 0)\n    {\n    bytebuff1 = (buff2 >> 24);\n    *dst++ = bytebuff1;\n\n    buff2 = (buff2 << 8);\n    bytebuff2 = bytebuff1;\n    ready_bits -= 8;\n    } \n  \n  return (0);\n  } /* end extractContigSamples24bits */\n\nstatic int\nextractContigSamples32bits (uint8 *in, uint8 *out, uint32 cols,\n                            tsample_t sample, uint16 spp, uint16 bps, \n \t\t\t    tsample_t count, uint32 start, uint32 end)\n  {\n  int    ready_bits = 0, sindex = 0, shift_width = 0;\n  uint32 col, src_byte, src_bit, bit_offset;\n  uint32 longbuff1 = 0, longbuff2 = 0;\n  uint64 maskbits = 0, matchbits = 0;\n  uint64 buff1 = 0, buff2 = 0, buff3 = 0;\n  uint8  bytebuff1 = 0, bytebuff2 = 0, bytebuff3 = 0, bytebuff4 = 0;\n  uint8 *src = in;\n  uint8 *dst = out;\n\n  if ((in == NULL) || (out == NULL))\n    {\n    TIFFError(\"extractContigSamples32bits\",\"Invalid input or output buffer\");\n    return (1);\n    }\n\n\n  if ((start > end) || (start > cols))\n    {\n    TIFFError (\"extractContigSamples32bits\", \n               \"Invalid start column value %d ignored\", start);\n    start = 0;\n    }\n  if ((end == 0) || (end > cols))\n    {\n    TIFFError (\"extractContigSamples32bits\", \n               \"Invalid end column value %d ignored\", end);\n    end = cols;\n    }\n\n  shift_width = ((bps + 7) / 8) + 1; \n  ready_bits = 0;\n  maskbits =  (uint64)-1 >> ( 64 - bps);\n  for (col = start; col < end; col++)\n    {\n    /* Compute src byte(s) and bits within byte(s) */\n    bit_offset = col * bps * spp;\n    for (sindex = sample; (sindex < spp) && (sindex < (sample + count)); sindex++)\n      {\n      if (sindex == 0)\n        {\n        src_byte = bit_offset / 8;\n        src_bit  = bit_offset % 8;\n        }\n      else\n        {\n        src_byte = (bit_offset + (sindex * bps)) / 8;\n        src_bit  = (bit_offset + (sindex * bps)) % 8;\n        }\n\n      src = in + src_byte;\n      matchbits = maskbits << (64 - src_bit - bps); \n      if (little_endian)\n        {\n\tlongbuff1 = (src[0] << 24) | (src[1] << 16)  | (src[2] << 8) | src[3];\n\tlongbuff2 = longbuff1;\n        }\n      else\n        {\n\tlongbuff1 = (src[3] << 24) | (src[2] << 16) | (src[1] << 8) | src[0];\n\tlongbuff2 = longbuff1;\n\t}\n\n      buff3 = ((uint64)longbuff1 << 32) | longbuff2;\n      buff1 = (buff3 & matchbits) << (src_bit);\n\n      /* If we have a full buffer's worth, write it out */\n      if (ready_bits >= 32)\n        {\n        bytebuff1 = (buff2 >> 56);\n        *dst++ = bytebuff1;\n        bytebuff2 = (buff2 >> 48);\n        *dst++ = bytebuff2;\n        bytebuff3 = (buff2 >> 40);\n        *dst++ = bytebuff3;\n        bytebuff4 = (buff2 >> 32);\n        *dst++ = bytebuff4;\n        ready_bits -= 32;\n                    \n        /* shift in new bits */\n        buff2 = ((buff2 << 32) | (buff1 >> ready_bits));\n        }\n      else\n        { /* add another bps bits to the buffer */\n        bytebuff1 = bytebuff2 = bytebuff3 = bytebuff4 = 0;\n        buff2 = (buff2 | (buff1 >> ready_bits));\n        }\n      ready_bits += bps;\n      }\n    }\n  while (ready_bits > 0)\n    {\n    bytebuff1 = (buff2 >> 56);\n    *dst++ = bytebuff1;\n    buff2 = (buff2 << 8);\n    ready_bits -= 8;\n    }\n  \n  return (0);\n  } /* end extractContigSamples32bits */\n\nstatic int\nextractContigSamplesShifted8bits (uint8 *in, uint8 *out, uint32 cols,\n                                  tsample_t sample, uint16 spp, uint16 bps, \n\t\t\t          tsample_t count, uint32 start, uint32 end,\n \t                          int shift)\n  {\n  int    ready_bits = 0, sindex = 0;\n  uint32 col, src_byte, src_bit, bit_offset;\n  uint8  maskbits = 0, matchbits = 0;\n  uint8  buff1 = 0, buff2 = 0;\n  uint8 *src = in;\n  uint8 *dst = out;\n\n  if ((src == NULL) || (dst == NULL))\n    {\n    TIFFError(\"extractContigSamplesShifted8bits\",\"Invalid input or output buffer\");\n    return (1);\n    }\n\n  if ((start > end) || (start > cols))\n    {\n    TIFFError (\"extractContigSamplesShifted8bits\", \n               \"Invalid start column value %d ignored\", start);\n    start = 0;\n    }\n  if ((end == 0) || (end > cols))\n    {\n    TIFFError (\"extractContigSamplesShifted8bits\", \n               \"Invalid end column value %d ignored\", end);\n    end = cols;\n    }\n\n  ready_bits = shift;\n  maskbits =  (uint8)-1 >> ( 8 - bps);\n  buff1 = buff2 = 0;\n  for (col = start; col < end; col++)\n    {    /* Compute src byte(s) and bits within byte(s) */\n    bit_offset = col * bps * spp;\n    for (sindex = sample; (sindex < spp) && (sindex < (sample + count)); sindex++)\n      {\n      if (sindex == 0)\n        {\n        src_byte = bit_offset / 8;\n        src_bit  = bit_offset % 8;\n        }\n      else\n        {\n        src_byte = (bit_offset + (sindex * bps)) / 8;\n        src_bit  = (bit_offset + (sindex * bps)) % 8;\n        }\n\n      src = in + src_byte;\n      matchbits = maskbits << (8 - src_bit - bps); \n      buff1 = ((*src) & matchbits) << (src_bit);\n      if ((col == start) && (sindex == sample))\n        buff2 = *src & ((uint8)-1) << (shift);\n\n      /* If we have a full buffer's worth, write it out */\n      if (ready_bits >= 8)\n        {\n        *dst++ |= buff2;\n        buff2 = buff1;\n        ready_bits -= 8;\n        }\n      else\n\tbuff2 = buff2 | (buff1 >> ready_bits);\n      ready_bits += bps;\n      }\n    }\n\n  while (ready_bits > 0)\n    {\n    buff1 = (buff2 & ((unsigned int)255 << (8 - ready_bits)));\n    *dst++ = buff1;\n    ready_bits -= 8;\n    }\n\n  return (0);\n  } /* end extractContigSamplesShifted8bits */\n\nstatic int\nextractContigSamplesShifted16bits (uint8 *in, uint8 *out, uint32 cols, \n                                   tsample_t sample, uint16 spp, uint16 bps, \n  \t\t\t           tsample_t count, uint32 start, uint32 end,\n \t                           int shift)\n  {\n  int    ready_bits = 0, sindex = 0;\n  uint32 col, src_byte, src_bit, bit_offset;\n  uint16 maskbits = 0, matchbits = 0;\n  uint16 buff1 = 0, buff2 = 0;\n  uint8  bytebuff = 0;\n  uint8 *src = in;\n  uint8 *dst = out;\n  \n  if ((src == NULL) || (dst == NULL))\n    {\n    TIFFError(\"extractContigSamplesShifted16bits\",\"Invalid input or output buffer\");\n    return (1);\n    }\n\n  if ((start > end) || (start > cols))\n    {\n    TIFFError (\"extractContigSamplesShifted16bits\", \n               \"Invalid start column value %d ignored\", start);\n    start = 0;\n    }\n  if ((end == 0) || (end > cols))\n    {\n    TIFFError (\"extractContigSamplesShifted16bits\", \n               \"Invalid end column value %d ignored\", end);\n    end = cols;\n    }\n\n  ready_bits = shift;\n  maskbits = (uint16)-1 >> (16 - bps);\n  for (col = start; col < end; col++)\n    {    /* Compute src byte(s) and bits within byte(s) */\n    bit_offset = col * bps * spp;\n    for (sindex = sample; (sindex < spp) && (sindex < (sample + count)); sindex++)\n      {\n      if (sindex == 0)\n        {\n        src_byte = bit_offset / 8;\n        src_bit  = bit_offset % 8;\n        }\n      else\n        {\n        src_byte = (bit_offset + (sindex * bps)) / 8;\n        src_bit  = (bit_offset + (sindex * bps)) % 8;\n        }\n\n      src = in + src_byte;\n      matchbits = maskbits << (16 - src_bit - bps); \n      if (little_endian)\n        buff1 = (src[0] << 8) | src[1];\n      else\n        buff1 = (src[1] << 8) | src[0];\n\n      if ((col == start) && (sindex == sample))\n        buff2 = buff1 & ((uint16)-1) << (8 - shift);\n\n      buff1 = (buff1 & matchbits) << (src_bit);\n\n      if (ready_bits < 8) /* add another bps bits to the buffer */\n        buff2 = buff2 | (buff1 >> ready_bits);\n      else  /* If we have a full buffer's worth, write it out */\n        {\n        bytebuff = (buff2 >> 8);\n        *dst++ = bytebuff;\n        ready_bits -= 8;\n        /* shift in new bits */\n        buff2 = ((buff2 << 8) | (buff1 >> ready_bits));\n        }\n\n      ready_bits += bps;\n      }\n    }\n\n  /* catch any trailing bits at the end of the line */\n  while (ready_bits > 0)\n    {\n    bytebuff = (buff2 >> 8);\n    *dst++ = bytebuff;\n    ready_bits -= 8;\n    }\n  \n  return (0);\n  } /* end extractContigSamplesShifted16bits */\n\n\nstatic int\nextractContigSamplesShifted24bits (uint8 *in, uint8 *out, uint32 cols,\n \t                           tsample_t sample, uint16 spp, uint16 bps, \n                                   tsample_t count, uint32 start, uint32 end,\n\t                           int shift)\n  {\n  int    ready_bits = 0, sindex = 0;\n  uint32 col, src_byte, src_bit, bit_offset;\n  uint32 maskbits = 0, matchbits = 0;\n  uint32 buff1 = 0, buff2 = 0;\n  uint8  bytebuff1 = 0, bytebuff2 = 0;\n  uint8 *src = in;\n  uint8 *dst = out;\n\n  if ((in == NULL) || (out == NULL))\n    {\n    TIFFError(\"extractContigSamplesShifted24bits\",\"Invalid input or output buffer\");\n    return (1);\n    }\n\n  if ((start > end) || (start > cols))\n    {\n    TIFFError (\"extractContigSamplesShifted24bits\", \n               \"Invalid start column value %d ignored\", start);\n    start = 0;\n    }\n  if ((end == 0) || (end > cols))\n    {\n    TIFFError (\"extractContigSamplesShifted24bits\", \n               \"Invalid end column value %d ignored\", end);\n    end = cols;\n    }\n\n  ready_bits = shift;\n  maskbits =  (uint32)-1 >> ( 32 - bps);\n  for (col = start; col < end; col++)\n    {\n    /* Compute src byte(s) and bits within byte(s) */\n    bit_offset = col * bps * spp;\n    for (sindex = sample; (sindex < spp) && (sindex < (sample + count)); sindex++)\n      {\n      if (sindex == 0)\n        {\n        src_byte = bit_offset / 8;\n        src_bit  = bit_offset % 8;\n        }\n      else\n        {\n        src_byte = (bit_offset + (sindex * bps)) / 8;\n        src_bit  = (bit_offset + (sindex * bps)) % 8;\n        }\n\n      src = in + src_byte;\n      matchbits = maskbits << (32 - src_bit - bps); \n      if (little_endian)\n\tbuff1 = (src[0] << 24) | (src[1] << 16) | (src[2] << 8) | src[3];\n      else\n\tbuff1 = (src[3] << 24) | (src[2] << 16) | (src[1] << 8) | src[0];\n\n      if ((col == start) && (sindex == sample))\n        buff2 = buff1 & ((uint32)-1) << (16 - shift);\n\n      buff1 = (buff1 & matchbits) << (src_bit);\n\n      if (ready_bits < 16)  /* add another bps bits to the buffer */\n        {\n        bytebuff1 = bytebuff2 = 0;\n        buff2 = (buff2 | (buff1 >> ready_bits));\n        }\n      else /* If we have a full buffer's worth, write it out */\n        {\n        bytebuff1 = (buff2 >> 24);\n        *dst++ = bytebuff1;\n        bytebuff2 = (buff2 >> 16);\n        *dst++ = bytebuff2;\n        ready_bits -= 16;\n\n        /* shift in new bits */\n        buff2 = ((buff2 << 16) | (buff1 >> ready_bits));\n        }\n      ready_bits += bps;\n      }\n    }\n\n  /* catch any trailing bits at the end of the line */\n  while (ready_bits > 0)\n    {\n    bytebuff1 = (buff2 >> 24);\n    *dst++ = bytebuff1;\n\n    buff2 = (buff2 << 8);\n    bytebuff2 = bytebuff1;\n    ready_bits -= 8;\n    }\n   \n  return (0);\n  } /* end extractContigSamplesShifted24bits */\n\nstatic int\nextractContigSamplesShifted32bits (uint8 *in, uint8 *out, uint32 cols,\n                                   tsample_t sample, uint16 spp, uint16 bps, \n \t\t\t           tsample_t count, uint32 start, uint32 end,\n\t                           int shift)\n  {\n  int    ready_bits = 0, sindex = 0, shift_width = 0;\n  uint32 col, src_byte, src_bit, bit_offset;\n  uint32 longbuff1 = 0, longbuff2 = 0;\n  uint64 maskbits = 0, matchbits = 0;\n  uint64 buff1 = 0, buff2 = 0, buff3 = 0;\n  uint8  bytebuff1 = 0, bytebuff2 = 0, bytebuff3 = 0, bytebuff4 = 0;\n  uint8 *src = in;\n  uint8 *dst = out;\n\n  if ((in == NULL) || (out == NULL))\n    {\n    TIFFError(\"extractContigSamplesShifted32bits\",\"Invalid input or output buffer\");\n    return (1);\n    }\n\n\n  if ((start > end) || (start > cols))\n    {\n    TIFFError (\"extractContigSamplesShifted32bits\", \n               \"Invalid start column value %d ignored\", start);\n    start = 0;\n    }\n  if ((end == 0) || (end > cols))\n    {\n    TIFFError (\"extractContigSamplesShifted32bits\", \n               \"Invalid end column value %d ignored\", end);\n    end = cols;\n    }\n\n  shift_width = ((bps + 7) / 8) + 1; \n  ready_bits = shift;\n  maskbits =  (uint64)-1 >> ( 64 - bps);\n  for (col = start; col < end; col++)\n    {\n    /* Compute src byte(s) and bits within byte(s) */\n    bit_offset = col * bps * spp;\n    for (sindex = sample; (sindex < spp) && (sindex < (sample + count)); sindex++)\n      {\n      if (sindex == 0)\n        {\n        src_byte = bit_offset / 8;\n        src_bit  = bit_offset % 8;\n        }\n      else\n        {\n        src_byte = (bit_offset + (sindex * bps)) / 8;\n        src_bit  = (bit_offset + (sindex * bps)) % 8;\n        }\n\n      src = in + src_byte;\n      matchbits = maskbits << (64 - src_bit - bps); \n      if (little_endian)\n        {\n\tlongbuff1 = (src[0] << 24) | (src[1] << 16) | (src[2] << 8) | src[3];\n\tlongbuff2 = longbuff1;\n        }\n      else\n        {\n\tlongbuff1 = (src[3] << 24) | (src[2] << 16) | (src[1] << 8) | src[0];\n\tlongbuff2 = longbuff1;\n\t}\n\n      buff3 = ((uint64)longbuff1 << 32) | longbuff2;\n      if ((col == start) && (sindex == sample))\n        buff2 = buff3 & ((uint64)-1) << (32 - shift);\n\n      buff1 = (buff3 & matchbits) << (src_bit);\n\n      if (ready_bits < 32)\n        { /* add another bps bits to the buffer */\n        bytebuff1 = bytebuff2 = bytebuff3 = bytebuff4 = 0;\n        buff2 = (buff2 | (buff1 >> ready_bits));\n        }\n      else  /* If we have a full buffer's worth, write it out */\n        {\n        bytebuff1 = (buff2 >> 56);\n        *dst++ = bytebuff1;\n        bytebuff2 = (buff2 >> 48);\n        *dst++ = bytebuff2;\n        bytebuff3 = (buff2 >> 40);\n        *dst++ = bytebuff3;\n        bytebuff4 = (buff2 >> 32);\n        *dst++ = bytebuff4;\n        ready_bits -= 32;\n                    \n        /* shift in new bits */\n        buff2 = ((buff2 << 32) | (buff1 >> ready_bits));\n        }\n      ready_bits += bps;\n      }\n    }\n  while (ready_bits > 0)\n    {\n    bytebuff1 = (buff2 >> 56);\n    *dst++ = bytebuff1;\n    buff2 = (buff2 << 8);\n    ready_bits -= 8;\n    }\n  \n  return (0);\n  } /* end extractContigSamplesShifted32bits */\n\nstatic int\nextractContigSamplesToBuffer(uint8 *out, uint8 *in, uint32 rows, uint32 cols,\n  \t                     tsample_t sample, uint16 spp, uint16 bps, \n                             struct dump_opts *dump)\n  {\n  int    shift_width, bytes_per_sample, bytes_per_pixel;\n  uint32 src_rowsize, src_offset, row, first_col = 0;\n  uint32 dst_rowsize, dst_offset;\n  tsample_t count = 1;\n  uint8 *src, *dst;\n\n  bytes_per_sample = (bps + 7) / 8; \n  bytes_per_pixel  = ((bps * spp) + 7) / 8;\n  if ((bps % 8) == 0)\n    shift_width = 0;\n  else\n    {\n    if (bytes_per_pixel < (bytes_per_sample + 1))\n      shift_width = bytes_per_pixel;\n    else\n      shift_width = bytes_per_sample + 1;\n    }\n  src_rowsize = ((bps * spp * cols) + 7) / 8;\n  dst_rowsize = ((bps * cols) + 7) / 8;\n\n  if ((dump->outfile != NULL) && (dump->level == 4))\n    {\n    dump_info  (dump->outfile, dump->format, \"extractContigSamplesToBuffer\", \n                \"Sample %d, %d rows\", sample + 1, rows + 1);\n    }\n  for (row = 0; row < rows; row++)\n    {\n    src_offset = row * src_rowsize;\n    dst_offset = row * dst_rowsize;\n    src = in + src_offset;\n    dst = out + dst_offset;\n\n    /* pack the data into the scanline */\n    switch (shift_width)\n      {  \n      case 0: if (extractContigSamplesBytes (src, dst, cols, sample,\n                                             spp, bps,  count, first_col, cols))  \n                return (1);\n \t      break;\n      case 1: if (bps == 1)\n                {\n                if (extractContigSamples8bits (src, dst, cols, sample,\n                                               spp, bps, count, first_col, cols))\n\t          return (1);\n\t        break;\n\t\t}\n\t      else\n                 if (extractContigSamples16bits (src, dst, cols, sample,\n                                                 spp, bps, count, first_col, cols))\n\t         return (1);\n\t      break;\n      case 2: if (extractContigSamples24bits (src, dst, cols, sample,\n                                              spp, bps,  count, first_col, cols))\n\t         return (1);\n\t      break;\n      case 3:\n      case 4: \n      case 5: if (extractContigSamples32bits (src, dst, cols, sample,\n                                              spp, bps,  count, first_col, cols))\n\t         return (1);\n\t      break;\n      default: TIFFError (\"extractContigSamplesToBuffer\", \"Unsupported bit depth: %d\", bps);\n\t       return (1);\n      }\n    if ((dump->outfile != NULL) && (dump->level == 4))\n      dump_buffer(dump->outfile, dump->format, 1, dst_rowsize, row, dst);\n    }\n\n  return (0);\n  } /* end extractContigSamplesToBuffer */\n\nstatic int\nextractContigSamplesToTileBuffer(uint8 *out, uint8 *in, uint32 rows, uint32 cols,\n  \t                         uint32 imagewidth, uint32 tilewidth, tsample_t sample,\n\t\t\t\t uint16 count, uint16 spp, uint16 bps, struct dump_opts *dump)\n  {\n  int    shift_width, bytes_per_sample, bytes_per_pixel;\n  uint32 src_rowsize, src_offset, row;\n  uint32 dst_rowsize, dst_offset;\n  uint8 *src, *dst;\n\n  bytes_per_sample = (bps + 7) / 8; \n  bytes_per_pixel  = ((bps * spp) + 7) / 8;\n  if ((bps % 8) == 0)\n    shift_width = 0;\n  else\n    {\n    if (bytes_per_pixel < (bytes_per_sample + 1))\n      shift_width = bytes_per_pixel;\n    else\n      shift_width = bytes_per_sample + 1;\n    }\n\n  if ((dump->outfile != NULL) && (dump->level == 4))\n    {\n    dump_info  (dump->outfile, dump->format, \"extractContigSamplesToTileBuffer\", \n                \"Sample %d, %d rows\", sample + 1, rows + 1);\n    }\n\n  src_rowsize = ((bps * spp * imagewidth) + 7) / 8;\n  dst_rowsize = ((bps * tilewidth * count) + 7) / 8;\n\n  for (row = 0; row < rows; row++)\n    {\n    src_offset = row * src_rowsize;\n    dst_offset = row * dst_rowsize;\n    src = in + src_offset;\n    dst = out + dst_offset;\n\n    /* pack the data into the scanline */\n    switch (shift_width)\n      {  \n      case 0: if (extractContigSamplesBytes (src, dst, cols, sample,\n                                             spp, bps,  count, 0, cols))  \n                return (1);\n \t      break;\n      case 1: if (bps == 1)\n                {\n                if (extractContigSamples8bits (src, dst, cols, sample,\n                                               spp, bps, count, 0, cols))\n\t          return (1);\n\t        break;\n\t\t}\n\t      else\n                 if (extractContigSamples16bits (src, dst, cols, sample,\n                                                 spp, bps, count, 0, cols))\n\t         return (1);\n\t      break;\n      case 2: if (extractContigSamples24bits (src, dst, cols, sample,\n                                              spp, bps,  count, 0, cols))\n\t         return (1);\n\t      break;\n      case 3:\n      case 4: \n      case 5: if (extractContigSamples32bits (src, dst, cols, sample,\n                                              spp, bps,  count, 0, cols))\n\t         return (1);\n\t      break;\n      default: TIFFError (\"extractContigSamplesToTileBuffer\", \"Unsupported bit depth: %d\", bps);\n\t       return (1);\n      }\n    if ((dump->outfile != NULL) && (dump->level == 4))\n      dump_buffer(dump->outfile, dump->format, 1, dst_rowsize, row, dst);\n    }\n\n  return (0);\n  } /* end extractContigSamplesToTileBuffer */\n\nstatic int readContigStripsIntoBuffer (TIFF* in, uint8* buf)\n  {\n  uint8* bufp = buf;\n  int32  bytes_read = 0;\n  uint16 strip, nstrips   = TIFFNumberOfStrips(in);\n  uint32 stripsize = TIFFStripSize(in);\n  uint32 rows = 0;\n  uint32 rps = TIFFGetFieldDefaulted(in, TIFFTAG_ROWSPERSTRIP, &rps);\n  tsize_t scanline_size = TIFFScanlineSize(in);\n\n  for (strip = 0; strip < nstrips; strip++)\n    {\n    bytes_read = TIFFReadEncodedStrip (in, strip, bufp, -1);\n    rows = bytes_read / scanline_size;\n    if ((strip < (nstrips - 1)) && (bytes_read != (int32)stripsize))\n      TIFFError(\"\", \"Strip %d: read %lu bytes, strip size %lu\",\n\t\t(int)strip + 1, (unsigned long) bytes_read, (unsigned long)stripsize);\n\n    if (bytes_read < 0 && !ignore)\n      {\n      TIFFError(\"\", \"Error reading strip %lu after %lu rows\",\n\t\t(unsigned long) strip, (unsigned long)rows);\n      return 0;\n      }\n    bufp += bytes_read;\n    }\n\n return 1;\n  } /* end readContigStripsIntoBuffer */\n\nstatic int \ncombineSeparateSamplesBytes (unsigned char *srcbuffs[], unsigned char *out,\n                             uint32 cols, uint32 rows, uint16 spp, uint16 bps,\n                             FILE *dumpfile, int format, int level)\n  {\n  int i, bytes_per_sample;\n  uint32 row, col, col_offset, src_rowsize, dst_rowsize, row_offset;\n  unsigned char *src;\n  unsigned char *dst;\n  tsample_t s;\n\n  src = srcbuffs[0];\n  dst = out;\n  if ((src == NULL) || (dst == NULL))\n    {\n    TIFFError(\"combineSeparateSamplesBytes\",\"Invalid buffer address\");\n    return (1);\n    }\n\n  bytes_per_sample = (bps + 7) / 8; \n\n  src_rowsize = ((bps * cols) + 7) / 8;\n  dst_rowsize = ((bps * spp * cols) + 7) / 8;\n  for (row = 0; row < rows; row++)\n    {\n    if ((dumpfile != NULL) && (level == 2))\n      {\n      for (s = 0; s < spp; s++)\n        {\n        dump_info (dumpfile, format, \"combineSeparateSamplesBytes\",\"Input data, Sample %d\", s);\n        dump_buffer(dumpfile, format, 1, cols, row, srcbuffs[s] + (row * src_rowsize));\n        }\n      }\n    dst = out + (row * dst_rowsize);\n    row_offset = row * src_rowsize;\n    for (col = 0; col < cols; col++)\n      {\n      col_offset = row_offset + (col * (bps / 8)); \n      for (s = 0; (s < spp) && (s < MAX_SAMPLES); s++)\n        {\n        src = srcbuffs[s] + col_offset; \n        for (i = 0; i < bytes_per_sample; i++)\n          *(dst + i) = *(src + i);\n        src += bytes_per_sample;\n        dst += bytes_per_sample;\n        }   \n      }\n\n    if ((dumpfile != NULL) && (level == 2))\n      {\n      dump_info (dumpfile, format, \"combineSeparateSamplesBytes\",\"Output data, combined samples\");\n      dump_buffer(dumpfile, format, 1, dst_rowsize, row, out + (row * dst_rowsize));\n      }\n    }\n\n  return (0);\n  } /* end combineSeparateSamplesBytes */\n\nstatic int\ncombineSeparateSamples8bits (uint8 *in[], uint8 *out, uint32 cols,\n                            uint32 rows, uint16 spp, uint16 bps, \n \t                    FILE *dumpfile, int format, int level)\n  {\n  int    ready_bits = 0;\n  int    bytes_per_sample = 0;\n  uint32 src_rowsize, dst_rowsize, src_offset; \n  uint32 bit_offset;\n  uint32 row, col, src_byte = 0, src_bit = 0;\n  uint8  maskbits = 0, matchbits = 0;\n  uint8  buff1 = 0, buff2 = 0;\n  tsample_t s;\n  unsigned char *src = in[0];\n  unsigned char *dst = out;\n  char           action[32];\n\n  if ((src == NULL) || (dst == NULL))\n    {\n    TIFFError(\"combineSeparateSamples8bits\",\"Invalid input or output buffer\");\n    return (1);\n    }\n\n  bytes_per_sample = (bps + 7) / 8; \n  src_rowsize = ((bps * cols) + 7) / 8;\n  dst_rowsize = ((bps * cols * spp) + 7) / 8;\n  maskbits =  (uint8)-1 >> ( 8 - bps);\n\n  for (row = 0; row < rows; row++)\n    {\n    ready_bits = 0;\n    buff1 = buff2 = 0;\n    dst = out + (row * dst_rowsize);\n    src_offset = row * src_rowsize;\n    for (col = 0; col < cols; col++)\n      {\n      /* Compute src byte(s) and bits within byte(s) */\n      bit_offset = col * bps;\n      src_byte = bit_offset / 8;\n      src_bit  = bit_offset % 8;\n\n      matchbits = maskbits << (8 - src_bit - bps); \n      /* load up next sample from each plane */\n      for (s = 0; s < spp; s++)\n        {\n\tsrc = in[s] + src_offset + src_byte;\n        buff1 = ((*src) & matchbits) << (src_bit);\n\n        /* If we have a full buffer's worth, write it out */\n        if (ready_bits >= 8)\n          {\n          *dst++ = buff2;\n          buff2 = buff1;\n          ready_bits -= 8;\n          strcpy (action, \"Flush\");\n          }\n        else\n          {\n          buff2 = (buff2 | (buff1 >> ready_bits));\n          strcpy (action, \"Update\");\n          }\n        ready_bits += bps;\n \n        if ((dumpfile != NULL) && (level == 3))\n          {\n          dump_info (dumpfile, format, \"\",\n                   \"Row %3d, Col %3d, Samples %d, Src byte offset %3d  bit offset %2d  Dst offset %3d\",\n\t\t   row + 1, col + 1, s, src_byte, src_bit, dst - out);\n          dump_byte (dumpfile, format, \"Match bits\", matchbits);\n          dump_byte (dumpfile, format, \"Src   bits\", *src);\n          dump_byte (dumpfile, format, \"Buff1 bits\", buff1);\n          dump_byte (dumpfile, format, \"Buff2 bits\", buff2);\n          dump_info (dumpfile, format, \"\",\"%s\", action); \n\t  }\n        }\n      }\n\n    if (ready_bits > 0)\n      {\n      buff1 = (buff2 & ((unsigned int)255 << (8 - ready_bits)));\n      *dst++ = buff1;\n      if ((dumpfile != NULL) && (level == 3))\n        {\n        dump_info (dumpfile, format, \"\",\n\t         \"Row %3d, Col %3d, Src byte offset %3d  bit offset %2d  Dst offset %3d\",\n\t         row + 1, col + 1, src_byte, src_bit, dst - out);\n                 dump_byte (dumpfile, format, \"Final bits\", buff1);\n        }\n      }\n\n    if ((dumpfile != NULL) && (level >= 2))\n      {\n      dump_info (dumpfile, format, \"combineSeparateSamples8bits\",\"Output data\");\n      dump_buffer(dumpfile, format, 1, dst_rowsize, row, out + (row * dst_rowsize));\n      }\n    }\n\n  return (0);\n  } /* end combineSeparateSamples8bits */\n\nstatic int\ncombineSeparateSamples16bits (uint8 *in[], uint8 *out, uint32 cols,\n                              uint32 rows, uint16 spp, uint16 bps, \n \t                      FILE *dumpfile, int format, int level)\n  {\n  int    ready_bits = 0, bytes_per_sample = 0;\n  uint32 src_rowsize, dst_rowsize; \n  uint32 bit_offset, src_offset;\n  uint32 row, col, src_byte = 0, src_bit = 0;\n  uint16 maskbits = 0, matchbits = 0;\n  uint16 buff1 = 0, buff2 = 0;\n  uint8  bytebuff = 0;\n  tsample_t s;\n  unsigned char *src = in[0];\n  unsigned char *dst = out;\n  char           action[8];\n\n  if ((src == NULL) || (dst == NULL))\n    {\n    TIFFError(\"combineSeparateSamples16bits\",\"Invalid input or output buffer\");\n    return (1);\n    }\n\n  bytes_per_sample = (bps + 7) / 8; \n  src_rowsize = ((bps * cols) + 7) / 8;\n  dst_rowsize = ((bps * cols * spp) + 7) / 8;\n  maskbits = (uint16)-1 >> (16 - bps);\n\n  for (row = 0; row < rows; row++)\n    {\n    ready_bits = 0;\n    buff1 = buff2 = 0;\n    dst = out + (row * dst_rowsize);\n    src_offset = row * src_rowsize;\n    for (col = 0; col < cols; col++)\n      {\n      /* Compute src byte(s) and bits within byte(s) */\n      bit_offset = col * bps;\n      src_byte = bit_offset / 8;\n      src_bit  = bit_offset % 8;\n\n      matchbits = maskbits << (16 - src_bit - bps); \n      for (s = 0; s < spp; s++)\n        {\n\tsrc = in[s] + src_offset + src_byte;\n        if (little_endian)\n          buff1 = (src[0] << 8) | src[1];\n        else\n          buff1 = (src[1] << 8) | src[0];\n\n\tbuff1 = (buff1 & matchbits) << (src_bit);\n\n\t/* If we have a full buffer's worth, write it out */\n\tif (ready_bits >= 8)\n\t  {\n\t    bytebuff = (buff2 >> 8);\n\t    *dst++ = bytebuff;\n\t    ready_bits -= 8;\n\t    /* shift in new bits */\n\t    buff2 = ((buff2 << 8) | (buff1 >> ready_bits));\n\t    strcpy (action, \"Flush\");\n\t  }\n\telse\n\t  { /* add another bps bits to the buffer */\n\t    bytebuff = 0;\n\t    buff2 = (buff2 | (buff1 >> ready_bits));\n\t    strcpy (action, \"Update\");\n\t  }\n\tready_bits += bps;\n\n\tif ((dumpfile != NULL) && (level == 3))\n\t  {\n\t  dump_info (dumpfile, format, \"\",\n\t\t       \"Row %3d, Col %3d, Samples %d, Src byte offset %3d  bit offset %2d  Dst offset %3d\",\n\t\t       row + 1, col + 1, s, src_byte, src_bit, dst - out);\n\n\t  dump_short (dumpfile, format, \"Match bits\", matchbits);\n\t  dump_data  (dumpfile, format, \"Src   bits\", src, 2);\n\t  dump_short (dumpfile, format, \"Buff1 bits\", buff1);\n\t  dump_short (dumpfile, format, \"Buff2 bits\", buff2);\n\t  dump_byte  (dumpfile, format, \"Write byte\", bytebuff);\n\t  dump_info  (dumpfile, format, \"\",\"Ready bits:  %d, %s\", ready_bits, action); \n\t  }\n\t}\n      }\n\n    /* catch any trailing bits at the end of the line */\n    if (ready_bits > 0)\n      {\n      bytebuff = (buff2 >> 8);\n      *dst++ = bytebuff;\n      if ((dumpfile != NULL) && (level == 3))\n\t{\n\tdump_info (dumpfile, format, \"\",\n\t\t       \"Row %3d, Col %3d, Src byte offset %3d  bit offset %2d  Dst offset %3d\",\n\t\t       row + 1, col + 1, src_byte, src_bit, dst - out);\n\tdump_byte (dumpfile, format, \"Final bits\", bytebuff);\n\t}\n      }\n\n    if ((dumpfile != NULL) && (level == 2))\n      {\n      dump_info (dumpfile, format, \"combineSeparateSamples16bits\",\"Output data\");\n      dump_buffer(dumpfile, format, 1, dst_rowsize, row, out + (row * dst_rowsize));\n      }\n    }\n\n  return (0);\n  } /* end combineSeparateSamples16bits */\n\nstatic int\ncombineSeparateSamples24bits (uint8 *in[], uint8 *out, uint32 cols,\n                              uint32 rows, uint16 spp, uint16 bps, \n\t                      FILE *dumpfile, int format, int level)\n  {\n  int    ready_bits = 0, bytes_per_sample = 0;\n  uint32 src_rowsize, dst_rowsize; \n  uint32 bit_offset, src_offset;\n  uint32 row, col, src_byte = 0, src_bit = 0;\n  uint32 maskbits = 0, matchbits = 0;\n  uint32 buff1 = 0, buff2 = 0;\n  uint8  bytebuff1 = 0, bytebuff2 = 0;\n  tsample_t s;\n  unsigned char *src = in[0];\n  unsigned char *dst = out;\n  char           action[8];\n\n  if ((src == NULL) || (dst == NULL))\n    {\n    TIFFError(\"combineSeparateSamples24bits\",\"Invalid input or output buffer\");\n    return (1);\n    }\n\n  bytes_per_sample = (bps + 7) / 8; \n  src_rowsize = ((bps * cols) + 7) / 8;\n  dst_rowsize = ((bps * cols * spp) + 7) / 8;\n  maskbits =  (uint32)-1 >> ( 32 - bps);\n\n  for (row = 0; row < rows; row++)\n    {\n    ready_bits = 0;\n    buff1 = buff2 = 0;\n    dst = out + (row * dst_rowsize);\n    src_offset = row * src_rowsize;\n    for (col = 0; col < cols; col++)\n      {\n      /* Compute src byte(s) and bits within byte(s) */\n      bit_offset = col * bps;\n      src_byte = bit_offset / 8;\n      src_bit  = bit_offset % 8;\n\n      matchbits = maskbits << (32 - src_bit - bps); \n      for (s = 0; s < spp; s++)\n        {\n\tsrc = in[s] + src_offset + src_byte;\n        if (little_endian)\n\t  buff1 = (src[0] << 24) | (src[1] << 16) | (src[2] << 8) | src[3];\n        else\n\t  buff1 = (src[3] << 24) | (src[2] << 16) | (src[1] << 8) | src[0];\n\tbuff1 = (buff1 & matchbits) << (src_bit);\n\n\t/* If we have a full buffer's worth, write it out */\n\tif (ready_bits >= 16)\n\t  {\n\t    bytebuff1 = (buff2 >> 24);\n\t    *dst++ = bytebuff1;\n\t    bytebuff2 = (buff2 >> 16);\n\t    *dst++ = bytebuff2;\n\t    ready_bits -= 16;\n\n\t    /* shift in new bits */\n\t    buff2 = ((buff2 << 16) | (buff1 >> ready_bits));\n\t    strcpy (action, \"Flush\");\n\t  }\n\telse\n\t  { /* add another bps bits to the buffer */\n\t    bytebuff1 = bytebuff2 = 0;\n\t    buff2 = (buff2 | (buff1 >> ready_bits));\n\t    strcpy (action, \"Update\");\n\t  }\n\tready_bits += bps;\n\n\tif ((dumpfile != NULL) && (level == 3))\n\t  {\n\t  dump_info (dumpfile, format, \"\",\n\t\t       \"Row %3d, Col %3d, Samples %d, Src byte offset %3d  bit offset %2d  Dst offset %3d\",\n\t\t       row + 1, col + 1, s, src_byte, src_bit, dst - out);\n\t  dump_long (dumpfile, format, \"Match bits \", matchbits);\n\t  dump_data (dumpfile, format, \"Src   bits \", src, 4);\n\t  dump_long (dumpfile, format, \"Buff1 bits \", buff1);\n\t  dump_long (dumpfile, format, \"Buff2 bits \", buff2);\n\t  dump_byte (dumpfile, format, \"Write bits1\", bytebuff1);\n\t  dump_byte (dumpfile, format, \"Write bits2\", bytebuff2);\n\t  dump_info (dumpfile, format, \"\",\"Ready bits:   %d, %s\", ready_bits, action); \n\t  }\n\t}\n      }\n\n    /* catch any trailing bits at the end of the line */\n    while (ready_bits > 0)\n      {\n\tbytebuff1 = (buff2 >> 24);\n\t*dst++ = bytebuff1;\n\n\tbuff2 = (buff2 << 8);\n\tbytebuff2 = bytebuff1;\n\tready_bits -= 8;\n      }\n \n    if ((dumpfile != NULL) && (level == 3))\n      {\n      dump_info (dumpfile, format, \"\",\n\t\t   \"Row %3d, Col %3d, Src byte offset %3d  bit offset %2d  Dst offset %3d\",\n\t\t   row + 1, col + 1, src_byte, src_bit, dst - out);\n\n      dump_long (dumpfile, format, \"Match bits \", matchbits);\n      dump_data (dumpfile, format, \"Src   bits \", src, 4);\n      dump_long (dumpfile, format, \"Buff1 bits \", buff1);\n      dump_long (dumpfile, format, \"Buff2 bits \", buff2);\n      dump_byte (dumpfile, format, \"Write bits1\", bytebuff1);\n      dump_byte (dumpfile, format, \"Write bits2\", bytebuff2);\n      dump_info (dumpfile, format, \"\", \"Ready bits:  %2d\", ready_bits); \n      }\n\n    if ((dumpfile != NULL) && (level == 2))\n      {\n      dump_info (dumpfile, format, \"combineSeparateSamples24bits\",\"Output data\");\n      dump_buffer(dumpfile, format, 1, dst_rowsize, row, out + (row * dst_rowsize));\n      }\n    }\n  \n  return (0);\n  } /* end combineSeparateSamples24bits */\n\nstatic int\ncombineSeparateSamples32bits (uint8 *in[], uint8 *out, uint32 cols,\n                              uint32 rows, uint16 spp, uint16 bps, \n\t                      FILE *dumpfile, int format, int level)\n  {\n  int    ready_bits = 0, bytes_per_sample = 0, shift_width = 0;\n  uint32 src_rowsize, dst_rowsize, bit_offset, src_offset;\n  uint32 src_byte = 0, src_bit = 0;\n  uint32 row, col;\n  uint32 longbuff1 = 0, longbuff2 = 0;\n  uint64 maskbits = 0, matchbits = 0;\n  uint64 buff1 = 0, buff2 = 0, buff3 = 0;\n  uint8  bytebuff1 = 0, bytebuff2 = 0, bytebuff3 = 0, bytebuff4 = 0;\n  tsample_t s;\n  unsigned char *src = in[0];\n  unsigned char *dst = out;\n  char           action[8];\n\n  if ((src == NULL) || (dst == NULL))\n    {\n    TIFFError(\"combineSeparateSamples32bits\",\"Invalid input or output buffer\");\n    return (1);\n    }\n\n  bytes_per_sample = (bps + 7) / 8; \n  src_rowsize = ((bps * cols) + 7) / 8;\n  dst_rowsize = ((bps * cols * spp) + 7) / 8;\n  maskbits =  (uint64)-1 >> ( 64 - bps);\n  shift_width = ((bps + 7) / 8) + 1; \n\n  for (row = 0; row < rows; row++)\n    {\n    ready_bits = 0;\n    buff1 = buff2 = 0;\n    dst = out + (row * dst_rowsize);\n    src_offset = row * src_rowsize;\n    for (col = 0; col < cols; col++)\n      {\n      /* Compute src byte(s) and bits within byte(s) */\n      bit_offset = col * bps;\n      src_byte = bit_offset / 8;\n      src_bit  = bit_offset % 8;\n\n      matchbits = maskbits << (64 - src_bit - bps); \n      for (s = 0; s < spp; s++)\n\t{\n\tsrc = in[s] + src_offset + src_byte;\n\tif (little_endian)\n\t  {\n\t  longbuff1 = (src[0] << 24) | (src[1] << 16) | (src[2] << 8) | src[3];\n          longbuff2 = longbuff1;\n\t  }\n\telse\n\t  {\n\t  longbuff1 = (src[3] << 24) | (src[2] << 16) | (src[1] << 8) | src[0];\n          longbuff2 = longbuff1;\n\t  }\n\tbuff3 = ((uint64)longbuff1 << 32) | longbuff2;\n\tbuff1 = (buff3 & matchbits) << (src_bit);\n\n\t/* If we have a full buffer's worth, write it out */\n\tif (ready_bits >= 32)\n\t  {\n\t  bytebuff1 = (buff2 >> 56);\n\t  *dst++ = bytebuff1;\n\t  bytebuff2 = (buff2 >> 48);\n\t  *dst++ = bytebuff2;\n\t  bytebuff3 = (buff2 >> 40);\n\t  *dst++ = bytebuff3;\n\t  bytebuff4 = (buff2 >> 32);\n\t  *dst++ = bytebuff4;\n\t  ready_bits -= 32;\n                    \n\t  /* shift in new bits */\n\t  buff2 = ((buff2 << 32) | (buff1 >> ready_bits));\n\t  strcpy (action, \"Flush\");\n\t  }\n\telse\n\t  { /* add another bps bits to the buffer */\n\t  bytebuff1 = bytebuff2 = bytebuff3 = bytebuff4 = 0;\n\t  buff2 = (buff2 | (buff1 >> ready_bits));\n\t  strcpy (action, \"Update\");\n\t  }\n\tready_bits += bps;\n\n\tif ((dumpfile != NULL) && (level == 3))\n\t  { \n\t  dump_info (dumpfile, format, \"\",\n\t\t     \"Row %3d, Col %3d, Sample %d, Src byte offset %3d  bit offset %2d  Dst offset %3d\",\n\t\t     row + 1, col + 1, s, src_byte, src_bit, dst - out);\n\t  dump_wide (dumpfile, format, \"Match bits \", matchbits);\n\t  dump_data (dumpfile, format, \"Src   bits \", src, 8);\n\t  dump_wide (dumpfile, format, \"Buff1 bits \", buff1);\n\t  dump_wide (dumpfile, format, \"Buff2 bits \", buff2);\n\t  dump_info (dumpfile, format, \"\", \"Ready bits:   %d, %s\", ready_bits, action); \n\t  }\n\t}\n      }\n    while (ready_bits > 0)\n      {\n      bytebuff1 = (buff2 >> 56);\n      *dst++ = bytebuff1;\n      buff2 = (buff2 << 8);\n      ready_bits -= 8;\n      }\n\n    if ((dumpfile != NULL) && (level == 3))\n      {\n      dump_info (dumpfile, format, \"\",\n\t         \"Row %3d, Col %3d, Src byte offset %3d  bit offset %2d  Dst offset %3d\",\n\t\t row + 1, col + 1, src_byte, src_bit, dst - out);\n\n      dump_long (dumpfile, format, \"Match bits \", matchbits);\n      dump_data (dumpfile, format, \"Src   bits \", src, 4);\n      dump_long (dumpfile, format, \"Buff1 bits \", buff1);\n      dump_long (dumpfile, format, \"Buff2 bits \", buff2);\n      dump_byte (dumpfile, format, \"Write bits1\", bytebuff1);\n      dump_byte (dumpfile, format, \"Write bits2\", bytebuff2);\n      dump_info (dumpfile, format, \"\", \"Ready bits:  %2d\", ready_bits); \n      }\n\n    if ((dumpfile != NULL) && (level == 2))\n      {\n      dump_info (dumpfile, format, \"combineSeparateSamples32bits\",\"Output data\");\n      dump_buffer(dumpfile, format, 1, dst_rowsize, row, out);\n      }\n    }\n  \n  return (0);\n  } /* end combineSeparateSamples32bits */\n\nstatic int \ncombineSeparateTileSamplesBytes (unsigned char *srcbuffs[], unsigned char *out,\n                                 uint32 cols, uint32 rows, uint32 imagewidth,\n                                 uint32 tw, uint16 spp, uint16 bps,\n                                 FILE *dumpfile, int format, int level)\n  {\n  int i, bytes_per_sample;\n  uint32 row, col, col_offset, src_rowsize, dst_rowsize, src_offset;\n  unsigned char *src;\n  unsigned char *dst;\n  tsample_t s;\n\n  src = srcbuffs[0];\n  dst = out;\n  if ((src == NULL) || (dst == NULL))\n    {\n    TIFFError(\"combineSeparateTileSamplesBytes\",\"Invalid buffer address\");\n    return (1);\n    }\n\n  bytes_per_sample = (bps + 7) / 8; \n  src_rowsize = ((bps * tw) + 7) / 8;\n  dst_rowsize = imagewidth * bytes_per_sample * spp;\n  for (row = 0; row < rows; row++)\n    {\n    if ((dumpfile != NULL) && (level == 2))\n      {\n      for (s = 0; s < spp; s++)\n        {\n        dump_info (dumpfile, format, \"combineSeparateTileSamplesBytes\",\"Input data, Sample %d\", s);\n        dump_buffer(dumpfile, format, 1, cols, row, srcbuffs[s] + (row * src_rowsize));\n        }\n      }\n    dst = out + (row * dst_rowsize);\n    src_offset = row * src_rowsize;\n#ifdef DEVELMODE\n    TIFFError(\"\",\"Tile row %4d, Src offset %6d   Dst offset %6d\", \n              row, src_offset, dst - out);\n#endif\n    for (col = 0; col < cols; col++)\n      {\n      col_offset = src_offset + (col * (bps / 8)); \n      for (s = 0; (s < spp) && (s < MAX_SAMPLES); s++)\n        {\n        src = srcbuffs[s] + col_offset; \n        for (i = 0; i < bytes_per_sample; i++)\n          *(dst + i) = *(src + i);\n        dst += bytes_per_sample;\n        }   \n      }\n\n    if ((dumpfile != NULL) && (level == 2))\n      {\n      dump_info (dumpfile, format, \"combineSeparateTileSamplesBytes\",\"Output data, combined samples\");\n      dump_buffer(dumpfile, format, 1, dst_rowsize, row, out + (row * dst_rowsize));\n      }\n    }\n\n  return (0);\n  } /* end combineSeparateTileSamplesBytes */\n\nstatic int\ncombineSeparateTileSamples8bits (uint8 *in[], uint8 *out, uint32 cols,\n                                 uint32 rows, uint32 imagewidth, \n                                 uint32 tw, uint16 spp, uint16 bps, \n \t                         FILE *dumpfile, int format, int level)\n  {\n  int    ready_bits = 0;\n  uint32 src_rowsize, dst_rowsize, src_offset; \n  uint32 bit_offset;\n  uint32 row, col, src_byte = 0, src_bit = 0;\n  uint8  maskbits = 0, matchbits = 0;\n  uint8  buff1 = 0, buff2 = 0;\n  tsample_t s;\n  unsigned char *src = in[0];\n  unsigned char *dst = out;\n  char           action[32];\n\n  if ((src == NULL) || (dst == NULL))\n    {\n    TIFFError(\"combineSeparateTileSamples8bits\",\"Invalid input or output buffer\");\n    return (1);\n    }\n\n  src_rowsize = ((bps * tw) + 7) / 8;\n  dst_rowsize = ((imagewidth * bps * spp) + 7) / 8;\n  maskbits =  (uint8)-1 >> ( 8 - bps);\n\n  for (row = 0; row < rows; row++)\n    {\n    ready_bits = 0;\n    buff1 = buff2 = 0;\n    dst = out + (row * dst_rowsize);\n    src_offset = row * src_rowsize;\n    for (col = 0; col < cols; col++)\n      {\n      /* Compute src byte(s) and bits within byte(s) */\n      bit_offset = col * bps;\n      src_byte = bit_offset / 8;\n      src_bit  = bit_offset % 8;\n\n      matchbits = maskbits << (8 - src_bit - bps); \n      /* load up next sample from each plane */\n      for (s = 0; s < spp; s++)\n        {\n\tsrc = in[s] + src_offset + src_byte;\n        buff1 = ((*src) & matchbits) << (src_bit);\n\n        /* If we have a full buffer's worth, write it out */\n        if (ready_bits >= 8)\n          {\n          *dst++ = buff2;\n          buff2 = buff1;\n          ready_bits -= 8;\n          strcpy (action, \"Flush\");\n          }\n        else\n          {\n          buff2 = (buff2 | (buff1 >> ready_bits));\n          strcpy (action, \"Update\");\n          }\n        ready_bits += bps;\n \n        if ((dumpfile != NULL) && (level == 3))\n          {\n          dump_info (dumpfile, format, \"\",\n                   \"Row %3d, Col %3d, Samples %d, Src byte offset %3d  bit offset %2d  Dst offset %3d\",\n\t\t   row + 1, col + 1, s, src_byte, src_bit, dst - out);\n          dump_byte (dumpfile, format, \"Match bits\", matchbits);\n          dump_byte (dumpfile, format, \"Src   bits\", *src);\n          dump_byte (dumpfile, format, \"Buff1 bits\", buff1);\n          dump_byte (dumpfile, format, \"Buff2 bits\", buff2);\n          dump_info (dumpfile, format, \"\",\"%s\", action); \n\t  }\n        }\n      }\n\n    if (ready_bits > 0)\n      {\n      buff1 = (buff2 & ((unsigned int)255 << (8 - ready_bits)));\n      *dst++ = buff1;\n      if ((dumpfile != NULL) && (level == 3))\n        {\n        dump_info (dumpfile, format, \"\",\n\t         \"Row %3d, Col %3d, Src byte offset %3d  bit offset %2d  Dst offset %3d\",\n\t         row + 1, col + 1, src_byte, src_bit, dst - out);\n                 dump_byte (dumpfile, format, \"Final bits\", buff1);\n        }\n      }\n\n    if ((dumpfile != NULL) && (level >= 2))\n      {\n      dump_info (dumpfile, format, \"combineSeparateTileSamples8bits\",\"Output data\");\n      dump_buffer(dumpfile, format, 1, dst_rowsize, row, out + (row * dst_rowsize));\n      }\n    }\n\n  return (0);\n  } /* end combineSeparateTileSamples8bits */\n\nstatic int\ncombineSeparateTileSamples16bits (uint8 *in[], uint8 *out, uint32 cols,\n                                  uint32 rows, uint32 imagewidth, \n                                  uint32 tw, uint16 spp, uint16 bps, \n \t                          FILE *dumpfile, int format, int level)\n  {\n  int    ready_bits = 0;\n  uint32 src_rowsize, dst_rowsize; \n  uint32 bit_offset, src_offset;\n  uint32 row, col, src_byte = 0, src_bit = 0;\n  uint16 maskbits = 0, matchbits = 0;\n  uint16 buff1 = 0, buff2 = 0;\n  uint8  bytebuff = 0;\n  tsample_t s;\n  unsigned char *src = in[0];\n  unsigned char *dst = out;\n  char           action[8];\n\n  if ((src == NULL) || (dst == NULL))\n    {\n    TIFFError(\"combineSeparateTileSamples16bits\",\"Invalid input or output buffer\");\n    return (1);\n    }\n\n  src_rowsize = ((bps * tw) + 7) / 8;\n  dst_rowsize = ((imagewidth * bps * spp) + 7) / 8;\n  maskbits = (uint16)-1 >> (16 - bps);\n\n  for (row = 0; row < rows; row++)\n    {\n    ready_bits = 0;\n    buff1 = buff2 = 0;\n    dst = out + (row * dst_rowsize);\n    src_offset = row * src_rowsize;\n    for (col = 0; col < cols; col++)\n      {\n      /* Compute src byte(s) and bits within byte(s) */\n      bit_offset = col * bps;\n      src_byte = bit_offset / 8;\n      src_bit  = bit_offset % 8;\n\n      matchbits = maskbits << (16 - src_bit - bps); \n      for (s = 0; s < spp; s++)\n        {\n\tsrc = in[s] + src_offset + src_byte;\n        if (little_endian)\n          buff1 = (src[0] << 8) | src[1];\n        else\n          buff1 = (src[1] << 8) | src[0];\n\tbuff1 = (buff1 & matchbits) << (src_bit);\n\n\t/* If we have a full buffer's worth, write it out */\n\tif (ready_bits >= 8)\n\t  {\n\t    bytebuff = (buff2 >> 8);\n\t    *dst++ = bytebuff;\n\t    ready_bits -= 8;\n\t    /* shift in new bits */\n\t    buff2 = ((buff2 << 8) | (buff1 >> ready_bits));\n\t    strcpy (action, \"Flush\");\n\t  }\n\telse\n\t  { /* add another bps bits to the buffer */\n\t    bytebuff = 0;\n\t    buff2 = (buff2 | (buff1 >> ready_bits));\n\t    strcpy (action, \"Update\");\n\t  }\n\tready_bits += bps;\n\n\tif ((dumpfile != NULL) && (level == 3))\n\t  {\n\t  dump_info (dumpfile, format, \"\",\n\t\t       \"Row %3d, Col %3d, Samples %d, Src byte offset %3d  bit offset %2d  Dst offset %3d\",\n\t\t       row + 1, col + 1, s, src_byte, src_bit, dst - out);\n\n\t  dump_short (dumpfile, format, \"Match bits\", matchbits);\n\t  dump_data  (dumpfile, format, \"Src   bits\", src, 2);\n\t  dump_short (dumpfile, format, \"Buff1 bits\", buff1);\n\t  dump_short (dumpfile, format, \"Buff2 bits\", buff2);\n\t  dump_byte  (dumpfile, format, \"Write byte\", bytebuff);\n\t  dump_info  (dumpfile, format, \"\",\"Ready bits:  %d, %s\", ready_bits, action); \n\t  }\n\t}\n      }\n\n    /* catch any trailing bits at the end of the line */\n    if (ready_bits > 0)\n      {\n      bytebuff = (buff2 >> 8);\n      *dst++ = bytebuff;\n      if ((dumpfile != NULL) && (level == 3))\n\t{\n\tdump_info (dumpfile, format, \"\",\n\t\t       \"Row %3d, Col %3d, Src byte offset %3d  bit offset %2d  Dst offset %3d\",\n\t\t       row + 1, col + 1, src_byte, src_bit, dst - out);\n\tdump_byte (dumpfile, format, \"Final bits\", bytebuff);\n\t}\n      }\n\n    if ((dumpfile != NULL) && (level == 2))\n      {\n      dump_info (dumpfile, format, \"combineSeparateTileSamples16bits\",\"Output data\");\n      dump_buffer(dumpfile, format, 1, dst_rowsize, row, out + (row * dst_rowsize));\n      }\n    }\n\n  return (0);\n  } /* end combineSeparateTileSamples16bits */\n\nstatic int\ncombineSeparateTileSamples24bits (uint8 *in[], uint8 *out, uint32 cols,\n                                  uint32 rows, uint32 imagewidth, \n                                  uint32 tw, uint16 spp, uint16 bps, \n \t                          FILE *dumpfile, int format, int level)\n  {\n  int    ready_bits = 0;\n  uint32 src_rowsize, dst_rowsize; \n  uint32 bit_offset, src_offset;\n  uint32 row, col, src_byte = 0, src_bit = 0;\n  uint32 maskbits = 0, matchbits = 0;\n  uint32 buff1 = 0, buff2 = 0;\n  uint8  bytebuff1 = 0, bytebuff2 = 0;\n  tsample_t s;\n  unsigned char *src = in[0];\n  unsigned char *dst = out;\n  char           action[8];\n\n  if ((src == NULL) || (dst == NULL))\n    {\n    TIFFError(\"combineSeparateTileSamples24bits\",\"Invalid input or output buffer\");\n    return (1);\n    }\n\n  src_rowsize = ((bps * tw) + 7) / 8;\n  dst_rowsize = ((imagewidth * bps * spp) + 7) / 8;\n  maskbits =  (uint32)-1 >> ( 32 - bps);\n\n  for (row = 0; row < rows; row++)\n    {\n    ready_bits = 0;\n    buff1 = buff2 = 0;\n    dst = out + (row * dst_rowsize);\n    src_offset = row * src_rowsize;\n    for (col = 0; col < cols; col++)\n      {\n      /* Compute src byte(s) and bits within byte(s) */\n      bit_offset = col * bps;\n      src_byte = bit_offset / 8;\n      src_bit  = bit_offset % 8;\n\n      matchbits = maskbits << (32 - src_bit - bps); \n      for (s = 0; s < spp; s++)\n        {\n\tsrc = in[s] + src_offset + src_byte;\n        if (little_endian)\n\t  buff1 = (src[0] << 24) | (src[1] << 16) | (src[2] << 8) | src[3];\n        else\n\t  buff1 = (src[3] << 24) | (src[2] << 16) | (src[1] << 8) | src[0];\n\tbuff1 = (buff1 & matchbits) << (src_bit);\n\n\t/* If we have a full buffer's worth, write it out */\n\tif (ready_bits >= 16)\n\t  {\n\t    bytebuff1 = (buff2 >> 24);\n\t    *dst++ = bytebuff1;\n\t    bytebuff2 = (buff2 >> 16);\n\t    *dst++ = bytebuff2;\n\t    ready_bits -= 16;\n\n\t    /* shift in new bits */\n\t    buff2 = ((buff2 << 16) | (buff1 >> ready_bits));\n\t    strcpy (action, \"Flush\");\n\t  }\n\telse\n\t  { /* add another bps bits to the buffer */\n\t    bytebuff1 = bytebuff2 = 0;\n\t    buff2 = (buff2 | (buff1 >> ready_bits));\n\t    strcpy (action, \"Update\");\n\t  }\n\tready_bits += bps;\n\n\tif ((dumpfile != NULL) && (level == 3))\n\t  {\n\t  dump_info (dumpfile, format, \"\",\n\t\t       \"Row %3d, Col %3d, Samples %d, Src byte offset %3d  bit offset %2d  Dst offset %3d\",\n\t\t       row + 1, col + 1, s, src_byte, src_bit, dst - out);\n\t  dump_long (dumpfile, format, \"Match bits \", matchbits);\n\t  dump_data (dumpfile, format, \"Src   bits \", src, 4);\n\t  dump_long (dumpfile, format, \"Buff1 bits \", buff1);\n\t  dump_long (dumpfile, format, \"Buff2 bits \", buff2);\n\t  dump_byte (dumpfile, format, \"Write bits1\", bytebuff1);\n\t  dump_byte (dumpfile, format, \"Write bits2\", bytebuff2);\n\t  dump_info (dumpfile, format, \"\",\"Ready bits:   %d, %s\", ready_bits, action); \n\t  }\n\t}\n      }\n\n    /* catch any trailing bits at the end of the line */\n    while (ready_bits > 0)\n      {\n\tbytebuff1 = (buff2 >> 24);\n\t*dst++ = bytebuff1;\n\n\tbuff2 = (buff2 << 8);\n\tbytebuff2 = bytebuff1;\n\tready_bits -= 8;\n      }\n \n    if ((dumpfile != NULL) && (level == 3))\n      {\n      dump_info (dumpfile, format, \"\",\n\t\t   \"Row %3d, Col %3d, Src byte offset %3d  bit offset %2d  Dst offset %3d\",\n\t\t   row + 1, col + 1, src_byte, src_bit, dst - out);\n\n      dump_long (dumpfile, format, \"Match bits \", matchbits);\n      dump_data (dumpfile, format, \"Src   bits \", src, 4);\n      dump_long (dumpfile, format, \"Buff1 bits \", buff1);\n      dump_long (dumpfile, format, \"Buff2 bits \", buff2);\n      dump_byte (dumpfile, format, \"Write bits1\", bytebuff1);\n      dump_byte (dumpfile, format, \"Write bits2\", bytebuff2);\n      dump_info (dumpfile, format, \"\", \"Ready bits:  %2d\", ready_bits); \n      }\n\n    if ((dumpfile != NULL) && (level == 2))\n      {\n      dump_info (dumpfile, format, \"combineSeparateTileSamples24bits\",\"Output data\");\n      dump_buffer(dumpfile, format, 1, dst_rowsize, row, out + (row * dst_rowsize));\n      }\n    }\n  \n  return (0);\n  } /* end combineSeparateTileSamples24bits */\n\nstatic int\ncombineSeparateTileSamples32bits (uint8 *in[], uint8 *out, uint32 cols,\n                                  uint32 rows, uint32 imagewidth, \n                                  uint32 tw, uint16 spp, uint16 bps, \n \t                          FILE *dumpfile, int format, int level)\n  {\n  int    ready_bits = 0, shift_width = 0;\n  uint32 src_rowsize, dst_rowsize, bit_offset, src_offset;\n  uint32 src_byte = 0, src_bit = 0;\n  uint32 row, col;\n  uint32 longbuff1 = 0, longbuff2 = 0;\n  uint64 maskbits = 0, matchbits = 0;\n  uint64 buff1 = 0, buff2 = 0, buff3 = 0;\n  uint8  bytebuff1 = 0, bytebuff2 = 0, bytebuff3 = 0, bytebuff4 = 0;\n  tsample_t s;\n  unsigned char *src = in[0];\n  unsigned char *dst = out;\n  char           action[8];\n\n  if ((src == NULL) || (dst == NULL))\n    {\n    TIFFError(\"combineSeparateTileSamples32bits\",\"Invalid input or output buffer\");\n    return (1);\n    }\n\n  src_rowsize = ((bps * tw) + 7) / 8;\n  dst_rowsize = ((imagewidth * bps * spp) + 7) / 8;\n  maskbits =  (uint64)-1 >> ( 64 - bps);\n  shift_width = ((bps + 7) / 8) + 1; \n\n  for (row = 0; row < rows; row++)\n    {\n    ready_bits = 0;\n    buff1 = buff2 = 0;\n    dst = out + (row * dst_rowsize);\n    src_offset = row * src_rowsize;\n    for (col = 0; col < cols; col++)\n      {\n      /* Compute src byte(s) and bits within byte(s) */\n      bit_offset = col * bps;\n      src_byte = bit_offset / 8;\n      src_bit  = bit_offset % 8;\n\n      matchbits = maskbits << (64 - src_bit - bps); \n      for (s = 0; s < spp; s++)\n\t{\n\tsrc = in[s] + src_offset + src_byte;\n\tif (little_endian)\n\t  {\n\t  longbuff1 = (src[0] << 24) | (src[1] << 16) | (src[2] << 8) | src[3];\n\t  longbuff2 = longbuff1;\n\t  }\n\telse\n\t  {\n\t  longbuff1 = (src[3] << 24) | (src[2] << 16) | (src[1] << 8) | src[0];\n          longbuff2 = longbuff1;\n\t  }\n\n\tbuff3 = ((uint64)longbuff1 << 32) | longbuff2;\n\tbuff1 = (buff3 & matchbits) << (src_bit);\n\n\t/* If we have a full buffer's worth, write it out */\n\tif (ready_bits >= 32)\n\t  {\n\t  bytebuff1 = (buff2 >> 56);\n\t  *dst++ = bytebuff1;\n\t  bytebuff2 = (buff2 >> 48);\n\t  *dst++ = bytebuff2;\n\t  bytebuff3 = (buff2 >> 40);\n\t  *dst++ = bytebuff3;\n\t  bytebuff4 = (buff2 >> 32);\n\t  *dst++ = bytebuff4;\n\t  ready_bits -= 32;\n                    \n\t  /* shift in new bits */\n\t  buff2 = ((buff2 << 32) | (buff1 >> ready_bits));\n\t  strcpy (action, \"Flush\");\n\t  }\n\telse\n\t  { /* add another bps bits to the buffer */\n\t  bytebuff1 = bytebuff2 = bytebuff3 = bytebuff4 = 0;\n\t  buff2 = (buff2 | (buff1 >> ready_bits));\n\t  strcpy (action, \"Update\");\n\t  }\n\tready_bits += bps;\n\n\tif ((dumpfile != NULL) && (level == 3))\n\t  { \n\t  dump_info (dumpfile, format, \"\",\n\t\t     \"Row %3d, Col %3d, Sample %d, Src byte offset %3d  bit offset %2d  Dst offset %3d\",\n\t\t     row + 1, col + 1, s, src_byte, src_bit, dst - out);\n\t  dump_wide (dumpfile, format, \"Match bits \", matchbits);\n\t  dump_data (dumpfile, format, \"Src   bits \", src, 8);\n\t  dump_wide (dumpfile, format, \"Buff1 bits \", buff1);\n\t  dump_wide (dumpfile, format, \"Buff2 bits \", buff2);\n\t  dump_info (dumpfile, format, \"\", \"Ready bits:   %d, %s\", ready_bits, action); \n\t  }\n\t}\n      }\n    while (ready_bits > 0)\n      {\n      bytebuff1 = (buff2 >> 56);\n      *dst++ = bytebuff1;\n      buff2 = (buff2 << 8);\n      ready_bits -= 8;\n      }\n\n    if ((dumpfile != NULL) && (level == 3))\n      {\n      dump_info (dumpfile, format, \"\",\n\t         \"Row %3d, Col %3d, Src byte offset %3d  bit offset %2d  Dst offset %3d\",\n\t\t row + 1, col + 1, src_byte, src_bit, dst - out);\n\n      dump_long (dumpfile, format, \"Match bits \", matchbits);\n      dump_data (dumpfile, format, \"Src   bits \", src, 4);\n      dump_long (dumpfile, format, \"Buff1 bits \", buff1);\n      dump_long (dumpfile, format, \"Buff2 bits \", buff2);\n      dump_byte (dumpfile, format, \"Write bits1\", bytebuff1);\n      dump_byte (dumpfile, format, \"Write bits2\", bytebuff2);\n      dump_info (dumpfile, format, \"\", \"Ready bits:  %2d\", ready_bits); \n      }\n\n    if ((dumpfile != NULL) && (level == 2))\n      {\n      dump_info (dumpfile, format, \"combineSeparateTileSamples32bits\",\"Output data\");\n      dump_buffer(dumpfile, format, 1, dst_rowsize, row, out);\n      }\n    }\n  \n  return (0);\n  } /* end combineSeparateTileSamples32bits */\n\n\nstatic int readSeparateStripsIntoBuffer (TIFF *in, uint8 *obuf, uint32 length, \n                                         uint32 width, uint16 spp,\n                                         struct dump_opts *dump)\n  {\n  int i, j, bytes_per_sample, bytes_per_pixel, shift_width, result = 1;\n  int32  bytes_read = 0;\n  uint16 bps, nstrips, planar, strips_per_sample;\n  uint32 src_rowsize, dst_rowsize, rows_processed, rps;\n  uint32 rows_this_strip = 0;\n  tsample_t s;\n  tstrip_t  strip;\n  tsize_t scanlinesize = TIFFScanlineSize(in);\n  tsize_t stripsize    = TIFFStripSize(in);\n  unsigned char *srcbuffs[MAX_SAMPLES];\n  unsigned char *buff = NULL;\n  unsigned char *dst = NULL;\n\n  if (obuf == NULL)\n    {\n    TIFFError(\"readSeparateStripsIntoBuffer\",\"Invalid buffer argument\");\n    return (0);\n    }\n\n  memset (srcbuffs, '\\0', sizeof(srcbuffs));\n  TIFFGetField(in, TIFFTAG_BITSPERSAMPLE, &bps);\n  TIFFGetFieldDefaulted(in, TIFFTAG_PLANARCONFIG, &planar);\n  TIFFGetFieldDefaulted(in, TIFFTAG_ROWSPERSTRIP, &rps);\n  if (rps > length)\n    rps = length;\n\n  bytes_per_sample = (bps + 7) / 8; \n  bytes_per_pixel  = ((bps * spp) + 7) / 8;\n  if (bytes_per_pixel < (bytes_per_sample + 1))\n    shift_width = bytes_per_pixel;\n  else\n    shift_width = bytes_per_sample + 1;\n\n  src_rowsize = ((bps * width) + 7) / 8;\n  dst_rowsize = ((bps * width * spp) + 7) / 8;\n  dst = obuf;\n\n  if ((dump->infile != NULL) && (dump->level == 3))\n    {\n    dump_info  (dump->infile, dump->format, \"\", \n                \"Image width %d, length %d, Scanline size, %4d bytes\",\n                width, length,  scanlinesize);\n    dump_info  (dump->infile, dump->format, \"\", \n                \"Bits per sample %d, Samples per pixel %d, Shift width %d\",\n\t\tbps, spp, shift_width);\n    }\n\n  /* Libtiff seems to assume/require that data for separate planes are \n   * written one complete plane after another and not interleaved in any way.\n   * Multiple scanlines and possibly strips of the same plane must be \n   * written before data for any other plane.\n   */\n  nstrips = TIFFNumberOfStrips(in);\n  strips_per_sample = nstrips /spp;\n\n  for (s = 0; (s < spp) && (s < MAX_SAMPLES); s++)\n    {\n    srcbuffs[s] = NULL;\n    buff = _TIFFmalloc(stripsize);\n    if (!buff)\n      {\n      TIFFError (\"readSeparateStripsIntoBuffer\", \n                 \"Unable to allocate strip read buffer for sample %d\", s);\n      for (i = 0; i < s; i++)\n        _TIFFfree (srcbuffs[i]);\n      return 0;\n      }\n    srcbuffs[s] = buff;\n    }\n\n  rows_processed = 0;\n  for (j = 0; (j < strips_per_sample) && (result == 1); j++)\n    {\n    for (s = 0; (s < spp) && (s < MAX_SAMPLES); s++)\n      {\n      buff = srcbuffs[s];\n      strip = (s * strips_per_sample) + j; \n      bytes_read = TIFFReadEncodedStrip (in, strip, buff, stripsize);\n      rows_this_strip = bytes_read / src_rowsize;\n      if (bytes_read < 0 && !ignore)\n        {\n        TIFFError(TIFFFileName(in),\n\t          \"Error, can't read strip %lu for sample %d\",\n         \t   (unsigned long) strip, s + 1);\n        result = 0;\n        break;\n        }\n#ifdef DEVELMODE\n      TIFFError(\"\", \"Strip %2d, read %5d bytes for %4d scanlines, shift width %d\", \n\t\tstrip, bytes_read, rows_this_strip, shift_width);\n#endif\n      }\n\n    if (rps > rows_this_strip)\n      rps = rows_this_strip;\n    dst = obuf + (dst_rowsize * rows_processed);\n    if ((bps % 8) == 0)\n      {\n      if (combineSeparateSamplesBytes (srcbuffs, dst, width, rps,\n                                       spp, bps, dump->infile, \n                                       dump->format, dump->level))\n        {\n        result = 0;\n        break;\n\t}\n      }\n    else\n      {\n      switch (shift_width)\n        {\n        case 1: if (combineSeparateSamples8bits (srcbuffs, dst, width, rps,\n                                                 spp, bps, dump->infile,\n                                                 dump->format, dump->level))\n\t          {\n                  result = 0;\n                  break;\n      \t          }\n\t        break;\n        case 2: if (combineSeparateSamples16bits (srcbuffs, dst, width, rps,\n                                                  spp, bps, dump->infile,\n                                                  dump->format, dump->level))\n\t          {\n                  result = 0;\n                  break;\n\t\t  }\n\t        break;\n        case 3: if (combineSeparateSamples24bits (srcbuffs, dst, width, rps,\n                                                  spp, bps, dump->infile,\n                                                  dump->format, dump->level))\n\t          {\n                  result = 0;\n                  break;\n       \t          }\n                break;\n        case 4: \n        case 5:\n        case 6:\n        case 7:\n        case 8: if (combineSeparateSamples32bits (srcbuffs, dst, width, rps,\n                                                  spp, bps, dump->infile,\n                                                  dump->format, dump->level))\n\t          {\n                  result = 0;\n                  break;\n\t\t  }\n\t        break;\n        default: TIFFError (\"readSeparateStripsIntoBuffer\", \"Unsupported bit depth: %d\", bps);\n                  result = 0;\n                  break;\n        }\n      }\n \n    if ((rows_processed + rps) > length)\n      {\n      rows_processed = length;\n      rps = length - rows_processed;\n      }\n    else\n      rows_processed += rps;\n    }\n\n  /* free any buffers allocated for each plane or scanline and \n   * any temporary buffers \n   */\n  for (s = 0; (s < spp) && (s < MAX_SAMPLES); s++)\n    {\n    buff = srcbuffs[s];\n    if (buff != NULL)\n      _TIFFfree(buff);\n    }\n\n  return (result);\n  } /* end readSeparateStripsIntoBuffer */\n\nstatic int\nget_page_geometry (char *name, struct pagedef *page)\n    {\n    char *ptr;\n    int n; \n\n    for (ptr = name; *ptr; ptr++)\n      *ptr = (char)tolower((int)*ptr);\n\n    for (n = 0; n < MAX_PAPERNAMES; n++)\n      {\n      if (strcmp(name, PaperTable[n].name) == 0)\n        {\n\tpage->width = PaperTable[n].width;\n\tpage->length = PaperTable[n].length;\n        strncpy (page->name, PaperTable[n].name, 15);\n        page->name[15] = '\\0';\n        return (0);\n        }\n      }\n\n  return (1);\n  }\n\n\nstatic void\ninitPageSetup (struct pagedef *page, struct pageseg *pagelist, \n               struct buffinfo seg_buffs[])\n   {\n   int i; \n\n   strcpy (page->name, \"\");\n   page->mode = PAGE_MODE_NONE;\n   page->res_unit = RESUNIT_NONE;\n   page->hres = 0.0;\n   page->vres = 0.0;\n   page->width = 0.0;\n   page->length = 0.0;\n   page->hmargin = 0.0;\n   page->vmargin = 0.0;\n   page->rows = 0;\n   page->cols = 0;\n   page->orient = ORIENTATION_NONE;\n\n   for (i = 0; i < MAX_SECTIONS; i++)\n     {\n     pagelist[i].x1 = (uint32)0;\n     pagelist[i].x2 = (uint32)0;\n     pagelist[i].y1 = (uint32)0;\n     pagelist[i].y2 = (uint32)0;\n     pagelist[i].buffsize = (uint32)0;\n     pagelist[i].position = 0;\n     pagelist[i].total = 0;\n     }\n\n   for (i = 0; i < MAX_OUTBUFFS; i++)\n     {\n     seg_buffs[i].size = 0;\n     seg_buffs[i].buffer = NULL;\n     }\n   }\n\nstatic void\ninitImageData (struct image_data *image)\n  {\n  image->xres = 0.0;\n  image->yres = 0.0;\n  image->width = 0;\n  image->length = 0;\n  image->res_unit = RESUNIT_NONE;\n  image->bps = 0;\n  image->spp = 0;\n  image->planar = 0;\n  image->photometric = 0;\n  image->orientation = 0;\n  image->adjustments = 0;\n  }\n\nstatic void\ninitCropMasks (struct crop_mask *cps)\n   {\n   int i;\n\n   cps->crop_mode = CROP_NONE;\n   cps->res_unit  = RESUNIT_NONE;\n   cps->edge_ref  = EDGE_TOP;\n   cps->width = 0;\n   cps->length = 0;\n   for (i = 0; i < 4; i++)\n     cps->margins[i] = 0.0;\n   cps->bufftotal = (uint32)0;\n   cps->combined_width = (uint32)0;\n   cps->combined_length = (uint32)0;\n   cps->rotation = (uint16)0;\n   cps->photometric = INVERT_DATA_AND_TAG;\n   cps->mirror   = (uint16)0;\n   cps->invert   = (uint16)0;\n   cps->zones    = (uint32)0;\n   cps->regions  = (uint32)0;\n   for (i = 0; i < MAX_REGIONS; i++)\n     {\n     cps->corners[i].X1 = 0.0;\n     cps->corners[i].X2 = 0.0;\n     cps->corners[i].Y1 = 0.0;\n     cps->corners[i].Y2 = 0.0;\n     cps->regionlist[i].x1 = 0;\n     cps->regionlist[i].x2 = 0;\n     cps->regionlist[i].y1 = 0;\n     cps->regionlist[i].y2 = 0;\n     cps->regionlist[i].width = 0;\n     cps->regionlist[i].length = 0;\n     cps->regionlist[i].buffsize = 0;\n     cps->regionlist[i].buffptr = NULL;\n     cps->zonelist[i].position = 0;\n     cps->zonelist[i].total = 0;\n     }\n   cps->exp_mode = ONE_FILE_COMPOSITE;\n   cps->img_mode = COMPOSITE_IMAGES;\n   }\n\nstatic void initDumpOptions(struct dump_opts *dump)\n  {\n  dump->debug  = 0;\n  dump->format = DUMP_NONE;\n  dump->level  = 1;\n  sprintf (dump->mode, \"w\");\n  memset (dump->infilename, '\\0', PATH_MAX + 1);\n  memset (dump->outfilename, '\\0',PATH_MAX + 1);\n  dump->infile = NULL;\n  dump->outfile = NULL;\n  }\n\n/* Compute pixel offsets into the image for margins and fixed regions */\nstatic int\ncomputeInputPixelOffsets(struct crop_mask *crop, struct image_data *image,\n                         struct offset *off)\n  {\n  double scale;\n  float xres, yres;\n  /* Values for these offsets are in pixels from start of image, not bytes,\n   * and are indexed from zero to width - 1 or length - 1 */\n  uint32 tmargin, bmargin, lmargin, rmargin;\n  uint32 startx, endx;   /* offsets of first and last columns to extract */\n  uint32 starty, endy;   /* offsets of first and last row to extract */\n  uint32 width, length, crop_width, crop_length; \n  uint32 i, max_width, max_length, zwidth, zlength, buffsize;\n  uint32 x1, x2, y1, y2;\n\n  if (image->res_unit != RESUNIT_INCH && image->res_unit != RESUNIT_CENTIMETER)\n    {\n    xres = 1.0;\n    yres = 1.0;\n    }\n  else\n    {\n    if (((image->xres == 0) || (image->yres == 0)) && \n         (crop->res_unit != RESUNIT_NONE) &&\n\t((crop->crop_mode & CROP_REGIONS) || (crop->crop_mode & CROP_MARGINS) ||\n \t (crop->crop_mode & CROP_LENGTH)  || (crop->crop_mode & CROP_WIDTH)))\n      {\n      TIFFError(\"computeInputPixelOffsets\", \"Cannot compute margins or fixed size sections without image resolution\");\n      TIFFError(\"computeInputPixelOffsets\", \"Specify units in pixels and try again\");\n      return (-1);\n      }\n    xres = image->xres;\n    yres = image->yres;\n    }\n\n  /* Translate user units to image units */\n  scale = 1.0;\n  switch (crop->res_unit) {\n    case RESUNIT_CENTIMETER:\n         if (image->res_unit == RESUNIT_INCH)\n\t   scale = 1.0/2.54;\n\t break;\n    case RESUNIT_INCH:\n\t if (image->res_unit == RESUNIT_CENTIMETER)\n\t     scale = 2.54;\n\t break;\n    case RESUNIT_NONE: /* Dimensions in pixels */\n    default:\n    break;\n    }\n\n  if (crop->crop_mode & CROP_REGIONS)\n    {\n    max_width = max_length = 0;\n    for (i = 0; i < crop->regions; i++)\n      {\n      if ((crop->res_unit == RESUNIT_INCH) || (crop->res_unit == RESUNIT_CENTIMETER))\n        {\n\tx1 = (uint32) (crop->corners[i].X1 * scale * xres);\n\tx2 = (uint32) (crop->corners[i].X2 * scale * xres);\n\ty1 = (uint32) (crop->corners[i].Y1 * scale * yres);\n\ty2 = (uint32) (crop->corners[i].Y2 * scale * yres);\n        }\n      else\n        {\n\tx1 = (uint32) (crop->corners[i].X1);\n\tx2 = (uint32) (crop->corners[i].X2);\n\ty1 = (uint32) (crop->corners[i].Y1);\n\ty2 = (uint32) (crop->corners[i].Y2);       \n\t}\n      if (x1 < 1)\n        crop->regionlist[i].x1 = 0;\n      else\n        crop->regionlist[i].x1 = (uint32) (x1 - 1);\n\n      if (x2 > image->width - 1)\n        crop->regionlist[i].x2 = image->width - 1;\n      else\n        crop->regionlist[i].x2 = (uint32) (x2 - 1);\n      zwidth  = crop->regionlist[i].x2 - crop->regionlist[i].x1 + 1; \n\n      if (y1 < 1)\n        crop->regionlist[i].y1 = 0;\n      else\n        crop->regionlist[i].y1 = (uint32) (y1 - 1);\n\n      if (y2 > image->length - 1)\n        crop->regionlist[i].y2 = image->length - 1;\n      else\n        crop->regionlist[i].y2 = (uint32) (y2 - 1);\n\n      zlength = crop->regionlist[i].y2 - crop->regionlist[i].y1 + 1; \n\n      if (zwidth > max_width)\n        max_width = zwidth;\n      if (zlength > max_length)\n        max_length = zlength;\n\n      buffsize = (uint32)\n          (((zwidth * image->bps * image->spp + 7 ) / 8) * (zlength + 1));\n\n      crop->regionlist[i].buffsize = buffsize;\n      crop->bufftotal += buffsize;\n      if (crop->img_mode == COMPOSITE_IMAGES)\n        {\n        switch (crop->edge_ref)\n          {\n          case EDGE_LEFT:\n          case EDGE_RIGHT:\n               crop->combined_length = zlength;\n               crop->combined_width += zwidth;\n               break;\n          case EDGE_BOTTOM:\n          case EDGE_TOP:  /* width from left, length from top */\n          default:\n               crop->combined_width = zwidth;\n               crop->combined_length += zlength;\n\t       break;\n          }\n\t}\n      }\n    return (0);\n    }\n  \n  /* Convert crop margins into offsets into image\n   * Margins are expressed as pixel rows and columns, not bytes\n   */\n  if (crop->crop_mode & CROP_MARGINS)\n    {\n    if (crop->res_unit != RESUNIT_INCH && crop->res_unit != RESUNIT_CENTIMETER)\n      { /* User has specified pixels as reference unit */\n      tmargin = (uint32)(crop->margins[0]);\n      lmargin = (uint32)(crop->margins[1]);\n      bmargin = (uint32)(crop->margins[2]);\n      rmargin = (uint32)(crop->margins[3]);\n      }\n    else\n      { /* inches or centimeters specified */\n      tmargin = (uint32)(crop->margins[0] * scale * yres);\n      lmargin = (uint32)(crop->margins[1] * scale * xres);\n      bmargin = (uint32)(crop->margins[2] * scale * yres);\n      rmargin = (uint32)(crop->margins[3] * scale * xres);\n      }\n\n    if ((lmargin + rmargin) > image->width)\n      {\n      TIFFError(\"computeInputPixelOffsets\", \"Combined left and right margins exceed image width\");\n      lmargin = (uint32) 0;\n      rmargin = (uint32) 0;\n      return (-1);\n      }\n    if ((tmargin + bmargin) > image->length)\n      {\n      TIFFError(\"computeInputPixelOffsets\", \"Combined top and bottom margins exceed image length\"); \n      tmargin = (uint32) 0; \n      bmargin = (uint32) 0;\n      return (-1);\n      }\n    }\n  else\n    { /* no margins requested */\n    tmargin = (uint32) 0;\n    lmargin = (uint32) 0;\n    bmargin = (uint32) 0;\n    rmargin = (uint32) 0;\n    }\n\n  /* Width, height, and margins are expressed as pixel offsets into image */\n  if (crop->res_unit != RESUNIT_INCH && crop->res_unit != RESUNIT_CENTIMETER)\n    {\n    if (crop->crop_mode & CROP_WIDTH)\n      width = (uint32)crop->width;\n    else\n      width = image->width - lmargin - rmargin;\n\n    if (crop->crop_mode & CROP_LENGTH)\n      length  = (uint32)crop->length;\n    else\n      length = image->length - tmargin - bmargin;\n    }\n  else\n    {\n    if (crop->crop_mode & CROP_WIDTH)\n      width = (uint32)(crop->width * scale * image->xres);\n    else\n      width = image->width - lmargin - rmargin;\n\n    if (crop->crop_mode & CROP_LENGTH)\n      length  = (uint32)(crop->length * scale * image->yres);\n    else\n      length = image->length - tmargin - bmargin;\n    }\n\n  off->tmargin = tmargin;\n  off->bmargin = bmargin;\n  off->lmargin = lmargin;\n  off->rmargin = rmargin;\n\n  /* Calculate regions defined by margins, width, and length. \n   * Coordinates expressed as 0 to imagewidth - 1, imagelength - 1,\n   * since they are used to compute offsets into buffers */\n  switch (crop->edge_ref) {\n    case EDGE_BOTTOM:\n         startx = lmargin;\n         if ((startx + width) >= (image->width - rmargin))\n           endx = image->width - rmargin - 1;\n         else\n           endx = startx + width - 1;\n\n         endy = image->length - bmargin - 1;\n         if ((endy - length) <= tmargin)\n           starty = tmargin;\n         else\n           starty = endy - length + 1;\n         break;\n    case EDGE_RIGHT:\n         endx = image->width - rmargin - 1;\n         if ((endx - width) <= lmargin)\n           startx = lmargin;\n         else\n           startx = endx - width + 1;\n\n         starty = tmargin;\n         if ((starty + length) >= (image->length - bmargin))\n           endy = image->length - bmargin - 1;\n         else\n           endy = starty + length - 1;\n         break;\n    case EDGE_TOP:  /* width from left, length from top */\n    case EDGE_LEFT:\n    default:\n         startx = lmargin;\n         if ((startx + width) >= (image->width - rmargin))\n           endx = image->width - rmargin - 1;\n         else\n           endx = startx + width - 1;\n\n         starty = tmargin;\n         if ((starty + length) >= (image->length - bmargin))\n           endy = image->length - bmargin - 1;\n         else\n           endy = starty + length - 1;\n         break;\n    }\n  off->startx = startx;\n  off->starty = starty;\n  off->endx   = endx;\n  off->endy   = endy;\n\n  crop_width  = endx - startx + 1;\n  crop_length = endy - starty + 1;\n\n  if (crop_width <= 0)\n    {\n    TIFFError(\"computeInputPixelOffsets\", \n               \"Invalid left/right margins and /or image crop width requested\");\n    return (-1);\n    }\n  if (crop_width > image->width)\n    crop_width = image->width;\n\n  if (crop_length <= 0)\n    {\n    TIFFError(\"computeInputPixelOffsets\", \n              \"Invalid top/bottom margins and /or image crop length requested\");\n    return (-1);\n    }\n  if (crop_length > image->length)\n    crop_length = image->length;\n\n  off->crop_width = crop_width;\n  off->crop_length = crop_length;\n\n  return (0);\n  } /* end computeInputPixelOffsets */\n\n/* \n * Translate crop options into pixel offsets for one or more regions of the image.\n * Options are applied in this order: margins, specific width and length, zones,\n * but all are optional. Margins are relative to each edge. Width, length and\n * zones are relative to the specified reference edge. Zones are expressed as\n * X:Y where X is the ordinal value in a set of Y equal sized portions. eg.\n * 2:3 would indicate the middle third of the region qualified by margins and\n * any explicit width and length specified. Regions are specified by coordinates\n * of the top left and lower right corners with range 1 to width or height.\n */\n\nstatic int\ngetCropOffsets(struct image_data *image, struct crop_mask *crop, struct dump_opts *dump)\n  {\n  struct offset offsets;\n  int    i;\n  int32  test2;\n  uint32 test, seg, total, need_buff = 0;\n  uint32 buffsize;\n  uint32 zwidth, zlength;\n\n  memset(&offsets, '\\0', sizeof(struct offset));\n  crop->bufftotal = 0;\n  crop->combined_width  = (uint32)0;\n  crop->combined_length = (uint32)0;\n  crop->selections = 0;\n\n  /* Compute pixel offsets if margins or fixed width or length specified */\n  if ((crop->crop_mode & CROP_MARGINS) ||\n      (crop->crop_mode & CROP_REGIONS) ||\n      (crop->crop_mode & CROP_LENGTH)  || \n      (crop->crop_mode & CROP_WIDTH))\n    {\n    if (computeInputPixelOffsets(crop, image, &offsets))\n      {\n      TIFFError (\"getCropOffsets\", \"Unable to compute crop margins\");\n      return (-1);\n      }\n    need_buff = TRUE;\n    crop->selections = crop->regions;\n    /* Regions are only calculated from top and left edges with no margins */\n    if (crop->crop_mode & CROP_REGIONS)\n      return (0);\n    }\n  else\n    { /* cropped area is the full image */\n    offsets.tmargin = 0;\n    offsets.lmargin = 0;\n    offsets.bmargin = 0;\n    offsets.rmargin = 0;\n    offsets.crop_width = image->width;\n    offsets.crop_length = image->length;\n    offsets.startx = 0;\n    offsets.endx = image->width - 1;\n    offsets.starty = 0;\n    offsets.endy = image->length - 1;\n    need_buff = FALSE;\n    }\n\n  if (dump->outfile != NULL)\n    {\n    dump_info (dump->outfile, dump->format, \"\", \"Margins: Top: %d  Left: %d  Bottom: %d  Right: %d\", \n           offsets.tmargin, offsets.lmargin, offsets.bmargin, offsets.rmargin); \n    dump_info (dump->outfile, dump->format, \"\", \"Crop region within margins: Adjusted Width:  %6d  Length: %6d\", \n           offsets.crop_width, offsets.crop_length);\n    }\n\n  if (!(crop->crop_mode & CROP_ZONES)) /* no crop zones requested */\n    {\n    if (need_buff == FALSE)  /* No margins or fixed width or length areas */\n      {\n      crop->selections = 0;\n      crop->combined_width  = image->width;\n      crop->combined_length = image->length;\n      return (0);\n      }\n    else \n      {\n      /* Use one region for margins and fixed width or length areas\n       * even though it was not formally declared as a region.\n       */\n      crop->selections = 1;\n      crop->zones = 1;\n      crop->zonelist[0].total = 1;\n      crop->zonelist[0].position = 1;\n      }\n    }     \n  else\n    crop->selections = crop->zones;\n\n  for (i = 0; i < crop->zones; i++)\n    {\n    seg = crop->zonelist[i].position;\n    total = crop->zonelist[i].total;\n\n    switch (crop->edge_ref) \n      {\n      case EDGE_LEFT: /* zones from left to right, length from top */\n           zlength = offsets.crop_length;\n\t   crop->regionlist[i].y1 = offsets.starty;\n           crop->regionlist[i].y2 = offsets.endy;\n\n           crop->regionlist[i].x1 = offsets.startx + \n                                  (uint32)(offsets.crop_width * 1.0 * (seg - 1) / total);\n           test = offsets.startx + \n                  (uint32)(offsets.crop_width * 1.0 * seg / total);\n           if (test > image->width - 1)\n             crop->regionlist[i].x2 = image->width - 1;\n           else\n             crop->regionlist[i].x2 = test - 1;\n           zwidth = crop->regionlist[i].x2 - crop->regionlist[i].x1  + 1;\n\n\t   /* This is passed to extractCropZone or extractCompositeZones */\n           crop->combined_length = (uint32)zlength;\n           if (crop->exp_mode == COMPOSITE_IMAGES)\n             crop->combined_width += (uint32)zwidth;\n           else\n             crop->combined_width = (uint32)zwidth;\n           break;\n      case EDGE_BOTTOM: /* width from left, zones from bottom to top */\n           zwidth = offsets.crop_width;\n\t   crop->regionlist[i].x1 = offsets.startx;\n           crop->regionlist[i].x2 = offsets.endx;\n\n           test2 = offsets.endy - (uint32)(offsets.crop_length * 1.0 * seg / total);\n           if (test2 < 1 )\n\t     crop->regionlist[i].y1 = 0;\n           else\n\t     crop->regionlist[i].y1 = test2 + 1;\n\n           test = offsets.endy - (uint32)(offsets.crop_length * 1.0 * (seg - 1) / total);\n           if (test > (image->length - 1))\n             crop->regionlist[i].y2 = image->length - 1;\n           else \n             crop->regionlist[i].y2 = test;\n           zlength = crop->regionlist[i].y2 - crop->regionlist[i].y1 + 1;\n\n\t   /* This is passed to extractCropZone or extractCompositeZones */\n           if (crop->exp_mode == COMPOSITE_IMAGES)\n             crop->combined_length += (uint32)zlength;\n           else\n             crop->combined_length = (uint32)zlength;\n           crop->combined_width = (uint32)zwidth;\n           break;\n      case EDGE_RIGHT: /* zones from right to left, length from top */\n           zlength = offsets.crop_length;\n\t   crop->regionlist[i].y1 = offsets.starty;\n           crop->regionlist[i].y2 = offsets.endy;\n\n           crop->regionlist[i].x1 = offsets.startx +\n                                  (uint32)(offsets.crop_width  * (total - seg) * 1.0 / total);\n           test = offsets.startx + \n\t          (uint32)(offsets.crop_width * (total - seg + 1) * 1.0 / total);\n\n           if (test > image->width - 1)\n             crop->regionlist[i].x2 = image->width - 1;\n           else\n             crop->regionlist[i].x2 = test - 1;\n           zwidth = crop->regionlist[i].x2 - crop->regionlist[i].x1  + 1;\n\n\t   /* This is passed to extractCropZone or extractCompositeZones */\n           crop->combined_length = (uint32)zlength;\n           if (crop->exp_mode == COMPOSITE_IMAGES)\n             crop->combined_width += (uint32)zwidth;\n           else\n             crop->combined_width = (uint32)zwidth;\n           break;\n      case EDGE_TOP: /* width from left, zones from top to bottom */\n      default:\n           zwidth = offsets.crop_width;\n\t   crop->regionlist[i].x1 = offsets.startx;\n           crop->regionlist[i].x2 = offsets.endx;\n\n           crop->regionlist[i].y1 = offsets.starty + (uint32)(offsets.crop_length * 1.0 * (seg - 1) / total);\n           test = offsets.starty + (uint32)(offsets.crop_length * 1.0 * seg / total);\n\t   if (test > image->length - 1)\n\t     crop->regionlist[i].y2 = image->length - 1;\n           else\n\t     crop->regionlist[i].y2 = test - 1;\n           zlength = crop->regionlist[i].y2 - crop->regionlist[i].y1 + 1;\n\n\t   /* This is passed to extractCropZone or extractCompositeZones */\n           if (crop->exp_mode == COMPOSITE_IMAGES)\n             crop->combined_length += (uint32)zlength;\n           else\n             crop->combined_length = (uint32)zlength;\n           crop->combined_width = (uint32)zwidth;\n           break;\n      } /* end switch statement */\n\n    buffsize = (uint32)\n          ((((zwidth * image->bps * image->spp) + 7 ) / 8) * (zlength + 1));\n    crop->regionlist[i].width = (uint32) zwidth;\n    crop->regionlist[i].length = (uint32) zlength;\n    crop->regionlist[i].buffsize = buffsize;\n    crop->bufftotal += buffsize;\n\n\n  if (dump->outfile != NULL)\n    dump_info (dump->outfile, dump->format, \"\",  \"Zone %d, width: %4d, length: %4d, x1: %4d  x2: %4d  y1: %4d  y2: %4d\",\n                    i + 1, (uint32)zwidth, (uint32)zlength,\n\t\t    crop->regionlist[i].x1, crop->regionlist[i].x2, \n                    crop->regionlist[i].y1, crop->regionlist[i].y2);\n    }\n\n  return (0);\n  } /* end getCropOffsets */\n\n\nstatic int\ncomputeOutputPixelOffsets (struct crop_mask *crop, struct image_data *image,\n                           struct pagedef *page, struct pageseg *sections,\n                           struct dump_opts* dump)\n  {\n  double scale;\n  uint32 iwidth, ilength;          /* Input image width and length */\n  uint32 owidth, olength;          /* Output image width and length */\n  uint32 pwidth, plength;          /* Output page width and length */\n  uint32 orows, ocols;             /* rows and cols for output */\n  uint32 hmargin, vmargin;         /* Horizontal and vertical margins */\n  uint32 x1, x2, y1, y2, line_bytes;\n  unsigned int orientation;\n  uint32 i, j, k;\n \n  scale = 1.0;\n  if (page->res_unit == RESUNIT_NONE)\n    page->res_unit = image->res_unit;\n\n  switch (image->res_unit) {\n    case RESUNIT_CENTIMETER:\n         if (page->res_unit == RESUNIT_INCH)\n\t   scale = 1.0/2.54;\n\t break;\n    case RESUNIT_INCH:\n\t if (page->res_unit == RESUNIT_CENTIMETER)\n\t     scale = 2.54;\n\t break;\n    case RESUNIT_NONE: /* Dimensions in pixels */\n    default:\n    break;\n    }\n\n  /* get width, height, resolutions of input image selection */\n  if (crop->combined_width > 0)\n    iwidth = crop->combined_width;\n  else\n    iwidth = image->width;\n  if (crop->combined_length > 0)\n    ilength = crop->combined_length;\n  else\n    ilength = image->length;\n\n  if (page->hres <= 1.0)\n    page->hres = image->xres;\n  if (page->vres <= 1.0)\n    page->vres = image->yres;\n\n  if ((page->hres < 1.0) || (page->vres < 1.0))\n    {\n    TIFFError(\"computeOutputPixelOffsets\",\n    \"Invalid horizontal or vertical resolution specified or read from input image\");\n    return (1);\n    }\n\n  /* If no page sizes are being specified, we just use the input image size to\n   * calculate maximum margins that can be taken from image.\n   */\n  if (page->width <= 0)\n    pwidth = iwidth;\n  else\n    pwidth = page->width;\n\n  if (page->length <= 0)\n    plength = ilength;\n  else\n    plength = page->length;\n\n  if (dump->debug)\n    {\n    TIFFError(\"\", \"Page size: %s, Vres: %3.2f, Hres: %3.2f, \"\n                   \"Hmargin: %3.2f, Vmargin: %3.2f\\n\",\n\t     page->name, page->vres, page->hres,\n             page->hmargin, page->vmargin);\n    TIFFError(\"\", \"Res_unit: %d, Scale: %3.2f, Page width: %d, length: %d\\n\", \n           page->res_unit, scale, pwidth, plength);\n    }\n\n  /* compute margins at specified unit and resolution */\n  if (page->mode & PAGE_MODE_MARGINS)\n    {\n    if (page->res_unit == RESUNIT_INCH || page->res_unit == RESUNIT_CENTIMETER)\n      { /* inches or centimeters specified */\n      hmargin = (uint32)(page->hmargin * scale * page->hres * ((image->bps + 7)/ 8));\n      vmargin = (uint32)(page->vmargin * scale * page->vres * ((image->bps + 7)/ 8));\n      }\n    else\n      { /* Otherwise user has specified pixels as reference unit */\n      hmargin = (uint32)(page->hmargin * scale * ((image->bps + 7)/ 8));\n      vmargin = (uint32)(page->vmargin * scale * ((image->bps + 7)/ 8));\n      }\n\n    if ((hmargin * 2.0) > (pwidth * page->hres))\n      {\n      TIFFError(\"computeOutputPixelOffsets\", \n                \"Combined left and right margins exceed page width\");\n      hmargin = (uint32) 0;\n      return (-1);\n      }\n    if ((vmargin * 2.0) > (plength * page->vres))\n      {\n      TIFFError(\"computeOutputPixelOffsets\", \n                \"Combined top and bottom margins exceed page length\"); \n      vmargin = (uint32) 0; \n      return (-1);\n      }\n    }\n  else\n    {\n    hmargin = 0;\n    vmargin = 0;\n    }\n\n  if (page->mode & PAGE_MODE_ROWSCOLS )\n    {\n    /* Maybe someday but not for now */\n    if (page->mode & PAGE_MODE_MARGINS)\n      TIFFError(\"computeOutputPixelOffsets\", \n      \"Output margins cannot be specified with rows and columns\"); \n\n    owidth  = TIFFhowmany(iwidth, page->cols);\n    olength = TIFFhowmany(ilength, page->rows);\n    }\n  else\n    {\n    if (page->mode & PAGE_MODE_PAPERSIZE )\n      {\n      owidth  = (uint32)((pwidth * page->hres) - (hmargin * 2));\n      olength = (uint32)((plength * page->vres) - (vmargin * 2));\n      }\n    else\n      {\n      owidth = (uint32)(iwidth - (hmargin * 2 * page->hres));\n      olength = (uint32)(ilength - (vmargin * 2 * page->vres));\n      }\n    }\n\n  if (owidth > iwidth)\n    owidth = iwidth;\n  if (olength > ilength)\n    olength = ilength;\n\n  /* Compute the number of pages required for Portrait or Landscape */\n  switch (page->orient)\n    {\n    case ORIENTATION_NONE:\n    case ORIENTATION_PORTRAIT:\n         ocols = TIFFhowmany(iwidth, owidth);\n         orows = TIFFhowmany(ilength, olength);\n         orientation = ORIENTATION_PORTRAIT;\n         break;\n\n    case ORIENTATION_LANDSCAPE:\n         ocols = TIFFhowmany(iwidth, olength);\n         orows = TIFFhowmany(ilength, owidth);\n         x1 = olength;\n         olength = owidth;\n         owidth = x1;\n         orientation = ORIENTATION_LANDSCAPE;\n         break;\n\n    case ORIENTATION_AUTO:\n    default:\n         x1 = TIFFhowmany(iwidth, owidth);\n         x2 = TIFFhowmany(ilength, olength); \n         y1 = TIFFhowmany(iwidth, olength);\n         y2 = TIFFhowmany(ilength, owidth); \n\n         if ( (x1 * x2) < (y1 * y2))\n           { /* Portrait */\n           ocols = x1;\n           orows = x2;\n           orientation = ORIENTATION_PORTRAIT;\n\t   }\n         else\n           { /* Landscape */\n           ocols = y1;\n           orows = y2;\n           x1 = olength;\n           olength = owidth;\n           owidth = x1;\n           orientation = ORIENTATION_LANDSCAPE;\n           }\n    }\n\n  if (ocols < 1)\n    ocols = 1;\n  if (orows < 1)\n    orows = 1;\n\n  /* If user did not specify rows and cols, set them from calcuation */\n  if (page->rows < 1)\n    page->rows = orows;\n  if (page->cols < 1)\n    page->cols = ocols;\n\n  line_bytes = TIFFhowmany8(owidth * image->bps) * image->spp;\n\n  if ((page->rows * page->cols) > MAX_SECTIONS)\n   {\n   TIFFError(\"computeOutputPixelOffsets\",\n\t     \"Rows and Columns exceed maximum sections\\nIncrease resolution or reduce sections\");\n   return (-1);\n   }\n\n  /* build the list of offsets for each output section */\n  for (k = 0, i = 0 && k <= MAX_SECTIONS; i < orows; i++)\n    {\n    y1 = (uint32)(olength * i);\n    y2 = (uint32)(olength * (i +  1) - 1);\n    if (y2 >= ilength)\n      y2 = ilength - 1;\n    for (j = 0; j < ocols; j++, k++)\n      {\n      x1 = (uint32)(owidth * j); \n      x2 = (uint32)(owidth * (j + 1) - 1);\n      if (x2 >= iwidth)\n        x2 = iwidth - 1;\n      sections[k].x1 = x1;\n      sections[k].x2 = x2;\n      sections[k].y1 = y1;\n      sections[k].y2 = y2;\n      sections[k].buffsize = line_bytes * olength;\n      sections[k].position = k + 1;\n      sections[k].total = orows * ocols;\n      } \n    } \n  return (0);\n  } /* end computeOutputPixelOffsets */\n\nstatic int\nloadImage(TIFF* in, struct image_data *image, struct dump_opts *dump, unsigned char **read_ptr)\n  {\n  uint32   i;\n  float    xres = 0.0, yres = 0.0;\n  uint16   nstrips = 0, ntiles = 0, planar = 0;\n  uint16   bps = 0, spp = 0, res_unit = 0;\n  uint16   photometric = 0, orientation = 0, input_compression = 0;\n  uint32   width = 0, length = 0;\n  uint32   stsize = 0, tlsize = 0, buffsize = 0, scanlinesize = 0;\n  uint32   tw = 0, tl = 0;       /* Tile width and length */\n  uint32   tile_rowsize = 0;\n  unsigned char *read_buff = NULL;\n  unsigned char *new_buff  = NULL;\n  int      readunit = 0;\n  static   uint32  prev_readsize = 0;\n\n  TIFFGetFieldDefaulted(in, TIFFTAG_BITSPERSAMPLE, &bps);\n  TIFFGetFieldDefaulted(in, TIFFTAG_SAMPLESPERPIXEL, &spp);\n  TIFFGetFieldDefaulted(in, TIFFTAG_PLANARCONFIG, &planar);\n  TIFFGetFieldDefaulted(in, TIFFTAG_ORIENTATION, &orientation);\n  if (! TIFFGetFieldDefaulted(in, TIFFTAG_PHOTOMETRIC, &photometric))\n    TIFFError(\"loadImage\",\"Image lacks Photometric interpreation tag\");\n  if (! TIFFGetField(in, TIFFTAG_IMAGEWIDTH,  &width))\n    TIFFError(\"loadimage\",\"Image lacks image width tag\");\n  if(! TIFFGetField(in, TIFFTAG_IMAGELENGTH, &length))\n    TIFFError(\"loadimage\",\"Image lacks image length tag\");\n  TIFFGetFieldDefaulted(in, TIFFTAG_XRESOLUTION, &xres);\n  TIFFGetFieldDefaulted(in, TIFFTAG_YRESOLUTION, &yres);\n  if (!TIFFGetFieldDefaulted(in, TIFFTAG_RESOLUTIONUNIT, &res_unit))\n    res_unit = RESUNIT_INCH;\n  if (!TIFFGetField(in, TIFFTAG_COMPRESSION, &input_compression))\n    input_compression = COMPRESSION_NONE;\n  scanlinesize = TIFFScanlineSize(in);\n\n  image->bps = bps;\n  image->spp = spp;\n  image->planar = planar;\n  image->width = width;\n  image->length = length;\n  image->xres = xres;\n  image->yres = yres;\n  image->res_unit = res_unit;\n  image->photometric = photometric;\n  image->orientation = orientation;\n  switch (orientation)\n    {\n    case 0:\n    case ORIENTATION_TOPLEFT:\n         image->adjustments = 0;\n\t break;\n    case ORIENTATION_TOPRIGHT:\n         image->adjustments = MIRROR_HORIZ;\n\t break;\n    case ORIENTATION_BOTRIGHT:\n         image->adjustments = ROTATECW_180;\n\t break;\n    case ORIENTATION_BOTLEFT:\n         image->adjustments = MIRROR_VERT; \n\t break;\n    case ORIENTATION_LEFTTOP:\n         image->adjustments = MIRROR_VERT | ROTATECW_90;\n\t break;\n    case ORIENTATION_RIGHTTOP:\n         image->adjustments = ROTATECW_90;\n\t break;\n    case ORIENTATION_RIGHTBOT:\n         image->adjustments = MIRROR_VERT | ROTATECW_270;\n\t break; \n    case ORIENTATION_LEFTBOT:\n         image->adjustments = ROTATECW_270;\n\t break;\n    default:\n         image->adjustments = 0;\n         image->orientation = ORIENTATION_TOPLEFT;\n   }\n\n  if ((bps == 0) || (spp == 0))\n    {\n    TIFFError(\"loadImage\", \"Invalid samples per pixel (%d) or bits per sample (%d)\",\n\t       spp, bps);\n    return (-1);\n    }\n\n  if (TIFFIsTiled(in))\n    {\n    readunit = TILE;\n    tlsize = TIFFTileSize(in);\n    ntiles = TIFFNumberOfTiles(in);\n    TIFFGetField(in, TIFFTAG_TILEWIDTH, &tw);\n    TIFFGetField(in, TIFFTAG_TILELENGTH, &tl);\n\n    tile_rowsize  = TIFFTileRowSize(in);      \n    buffsize = tlsize * ntiles;\n    \n    if (buffsize < (uint32)(ntiles * tl * tile_rowsize))\n      {\n      buffsize = ntiles * tl * tile_rowsize;\n#ifdef DEBUG2\n      TIFFError(\"loadImage\",\n\t        \"Tilesize %u is too small, using ntiles * tilelength * tilerowsize %lu\",\n                tlsize, (unsigned long)buffsize);\n#endif\n      }\n    \n    if (dump->infile != NULL)\n      dump_info (dump->infile, dump->format, \"\", \n                 \"Tilesize: %u, Number of Tiles: %u, Tile row size: %u\",\n                 tlsize, ntiles, tile_rowsize);\n    }\n  else\n    {\n    readunit = STRIP;\n    TIFFGetFieldDefaulted(in, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);\n    stsize = TIFFStripSize(in);\n    nstrips = TIFFNumberOfStrips(in);\n    buffsize = stsize * nstrips;\n    if (buffsize < (uint32) (((length * width * spp * bps) + 7) / 8))\n      {\n      buffsize =  ((length * width * spp * bps) + 7) / 8;\n#ifdef DEBUG2\n      TIFFError(\"loadImage\",\n\t        \"Stripsize %u is too small, using imagelength * width * spp * bps / 8 = %lu\",\n                stsize, (unsigned long)buffsize);\n#endif\n      }\n\n    if (dump->infile != NULL)\n      dump_info (dump->infile, dump->format, \"\",\n                 \"Stripsize: %u, Number of Strips: %u, Rows per Strip: %u, Scanline size: %u\",\n\t\t stsize, nstrips, rowsperstrip, scanlinesize);\n    }\n  \n  if (input_compression == COMPRESSION_JPEG)\n    {\n    jpegcolormode = JPEGCOLORMODE_RGB;\n    TIFFSetField(in, TIFFTAG_JPEGCOLORMODE, JPEGCOLORMODE_RGB);\n    }\n\n  read_buff = *read_ptr;\n  if (!read_buff)\n    read_buff = (unsigned char *)_TIFFmalloc(buffsize);\n  else\n    {\n    if (prev_readsize < buffsize)\n      {\n      new_buff = _TIFFrealloc(read_buff, buffsize);\n      if (!new_buff)\n        {\n\tfree (read_buff);\n        read_buff = (unsigned char *)_TIFFmalloc(buffsize);\n        }\n      else\n        read_buff = new_buff;\n      }\n    }\n\n  if (!read_buff)\n    {\n    TIFFError(\"loadImage\", \"Unable to allocate/reallocate read buffer\");\n    return (-1);\n    }\n\n  prev_readsize = buffsize;\n  *read_ptr = read_buff;\n\n  /* N.B. The read functions used copy separate plane data into a buffer as interleaved\n   * samples rather than separate planes so the same logic works to extract regions\n   * regardless of the way the data are organized in the input file.\n   */\n  switch (readunit) {\n    case STRIP:\n         if (planar == PLANARCONFIG_CONTIG)\n           {\n\t     if (!(readContigStripsIntoBuffer(in, read_buff)))\n\t     {\n\t     TIFFError(\"loadImage\", \"Unable to read contiguous strips into buffer\");\n\t     return (-1);\n             }\n           }\n         else\n           {\n\t   if (!(readSeparateStripsIntoBuffer(in, read_buff, length, width, spp, dump)))\n\t     {\n\t     TIFFError(\"loadImage\", \"Unable to read separate strips into buffer\");\n\t     return (-1);\n             }\n           }\n         break;\n\n    case TILE:\n         if (planar == PLANARCONFIG_CONTIG)\n           {\n\t   if (!(readContigTilesIntoBuffer(in, read_buff, length, width, tw, tl, spp, bps)))\n\t     {\n\t     TIFFError(\"loadImage\", \"Unable to read contiguous tiles into buffer\");\n\t     return (-1);\n             }\n           }\n         else\n           {\n\t   if (!(readSeparateTilesIntoBuffer(in, read_buff, length, width, tw, tl, spp, bps)))\n\t     {\n\t     TIFFError(\"loadImage\", \"Unable to read separate tiles into buffer\");\n\t     return (-1);\n             }\n           }\n         break;\n    default: TIFFError(\"loadImage\", \"Unsupported image file format\");\n          return (-1);\n          break;\n    }\n  if ((dump->infile != NULL) && (dump->level == 2))\n    {\n    dump_info  (dump->infile, dump->format, \"loadImage\", \n                \"Image width %d, length %d, Raw image data, %4d bytes\",\n                width, length,  buffsize);\n    dump_info  (dump->infile, dump->format, \"\", \n                \"Bits per sample %d, Samples per pixel %d\", bps, spp);\n\n    for (i = 0; i < length; i++)\n      dump_buffer(dump->infile, dump->format, 1, scanlinesize, \n                  i, read_buff + (i * scanlinesize));\n    }\n  return (0);\n  }   /* end loadImage */\n\nstatic int  correct_orientation(struct image_data *image, unsigned char **work_buff_ptr)\n  {\n  uint16 mirror, rotation;\n  unsigned char *work_buff;\n\n  work_buff = *work_buff_ptr;\n  if ((image == NULL) || (work_buff == NULL))\n    {\n    TIFFError (\"correct_orientatin\", \"Invalid image or buffer pointer\");\n    return (-1);\n    }\n\n  if ((image->adjustments & MIRROR_HORIZ) || (image->adjustments & MIRROR_VERT))\n    {\n    mirror = (uint16)(image->adjustments & MIRROR_BOTH);\n    if (mirrorImage(image->spp, image->bps, mirror, \n        image->width, image->length, work_buff))\n      {\n      TIFFError (\"correct_orientation\", \"Unable to mirror image\");\n      return (-1);\n      }\n    }\n\n  if (image->adjustments & ROTATE_ANY)\n    {\n    if (image->adjustments & ROTATECW_90)\n      rotation = (uint16) 90;\n    else\n    if (image->adjustments & ROTATECW_180)\n      rotation = (uint16) 180;\n    else\n    if (image->adjustments & ROTATECW_270)\n      rotation = (uint16) 270;\n    else\n      {\n      TIFFError (\"correct_orientation\", \"Invalid rotation value: %d\", \n                  image->adjustments & ROTATE_ANY);\n      return (-1);\n      }\n \n    if (rotateImage(rotation, image, &image->width, &image->length, work_buff_ptr))\n      {\n      TIFFError (\"correct_orientation\", \"Unable to rotate image\");\n      return (-1);\n      }\n    image->orientation = ORIENTATION_TOPLEFT;\n    }\n\n  return (0);\n  } /* end correct_orientation */\n\n\n/* Extract multiple zones from an image and combine into a single composite image */\nstatic int\nextractCompositeRegions(struct image_data *image,  struct crop_mask *crop, \n                        unsigned char *read_buff, unsigned char *crop_buff)\n  {\n  int       shift_width, bytes_per_sample, bytes_per_pixel;\n  uint32    i, trailing_bits, prev_trailing_bits;\n  uint32    row, first_row, last_row, first_col, last_col;\n  uint32    src_rowsize, dst_rowsize, src_offset, dst_offset;\n  uint32    crop_width, crop_length, img_width, img_length;\n  uint32    prev_length, prev_width, composite_width;\n  uint16    bps, spp;\n  uint8    *src, *dst;\n  tsample_t count, sample = 0;   /* Update to extract one or more samples */\n\n  img_width = image->width;\n  img_length = image->length;\n  bps = image->bps;\n  spp = image->spp;\n  count = spp;\n\n  bytes_per_sample = (bps + 7) / 8; \n  bytes_per_pixel  = ((bps * spp) + 7) / 8;\n  if ((bps % 8) == 0)\n    shift_width = 0;\n  else\n    {\n    if (bytes_per_pixel < (bytes_per_sample + 1))\n      shift_width = bytes_per_pixel;\n    else\n      shift_width = bytes_per_sample + 1;\n    }\n  src = read_buff;\n  dst = crop_buff;\n\n  /* These are setup for adding additional sections */\n  prev_width = prev_length = 0;\n  prev_trailing_bits = trailing_bits = 0;\n  composite_width = crop->combined_width;\n  crop->combined_width = 0;\n  crop->combined_length = 0;\n\n  for (i = 0; i < crop->selections; i++)\n    {\n    /* rows, columns, width, length are expressed in pixels */\n    first_row = crop->regionlist[i].y1;\n    last_row  = crop->regionlist[i].y2;\n    first_col = crop->regionlist[i].x1;\n    last_col  = crop->regionlist[i].x2;\n\n    crop_width = last_col - first_col + 1;\n    crop_length = last_row - first_row + 1;\n\n    /* These should not be needed for composite images */\n    crop->regionlist[i].width = crop_width;\n    crop->regionlist[i].length = crop_length;\n    crop->regionlist[i].buffptr = crop_buff;\n\n    src_rowsize = ((img_width * bps * spp) + 7) / 8;\n    dst_rowsize = (((crop_width * bps * count) + 7) / 8);\n\n    switch (crop->edge_ref)\n      {\n      default:\n      case EDGE_TOP:\n      case EDGE_BOTTOM:\n\t   if ((i > 0) && (crop_width != crop->regionlist[i - 1].width))\n             {\n\t     TIFFError (\"extractCompositeRegions\", \n                          \"Only equal width regions can be combined for -E top or bottom\");\n\t     return (1);\n             }\n\n           crop->combined_width = crop_width;\n           crop->combined_length += crop_length;\n\n           for (row = first_row; row <= last_row; row++)\n             {\n\t     src_offset = row * src_rowsize;\n\t     dst_offset = (row - first_row) * dst_rowsize;\n             src = read_buff + src_offset;\n             dst = crop_buff + dst_offset + (prev_length * dst_rowsize);\n             switch (shift_width)\n               {\n               case 0: if (extractContigSamplesBytes (src, dst, img_width, sample,\n                                                      spp, bps, count, first_col,\n                                                      last_col + 1))\n                         {\n\t\t         TIFFError(\"extractCompositeRegions\",\n                                   \"Unable to extract row %d\", row);\n\t\t         return (1);\n\t\t         }\n\t\t       break;\n               case 1: if (bps == 1)\n                         { \n                         if (extractContigSamplesShifted8bits (src, dst, img_width,\n                                                               sample, spp, bps, count, \n                                                               first_col, last_col + 1,\n                                                               prev_trailing_bits))\n                           {\n\t\t           TIFFError(\"extractCompositeRegions\",\n                                     \"Unable to extract row %d\", row);\n\t\t           return (1);\n\t\t           }\n\t\t         break;\n\t\t\t }\n                       else\n                         if (extractContigSamplesShifted16bits (src, dst, img_width,\n                                                                sample, spp, bps, count, \n                                                                first_col, last_col + 1,\n                                                                prev_trailing_bits))\n                           {\n\t\t           TIFFError(\"extractCompositeRegions\",\n                                     \"Unable to extract row %d\", row);\n\t\t           return (1);\n\t\t           }\n\t\t        break;\n               case 2:  if (extractContigSamplesShifted24bits (src, dst, img_width,\n                                                               sample, spp, bps, count, \n                                                               first_col, last_col + 1,\n                                                               prev_trailing_bits))\n                          {\n\t\t          TIFFError(\"extractCompositeRegions\",\n                                    \"Unable to extract row %d\", row);\n\t\t          return (1);\n\t\t          }\n\t\t        break;\n               case 3:\n               case 4:\n               case 5:  if (extractContigSamplesShifted32bits (src, dst, img_width,\n                                                               sample, spp, bps, count, \n                                                               first_col, last_col + 1,\n                                                               prev_trailing_bits))\n                          {\n\t\t          TIFFError(\"extractCompositeRegions\",\n                                    \"Unable to extract row %d\", row);\n\t\t          return (1);\n\t\t          }\n\t\t        break;\n               default: TIFFError(\"extractCompositeRegions\", \"Unsupported bit depth %d\", bps);\n\t\t        return (1);\n\t       }\n             }\n           prev_length += crop_length;\n\t   break;\n      case EDGE_LEFT:  /* splice the pieces of each row together, side by side */\n      case EDGE_RIGHT:\n\t   if ((i > 0) && (crop_length != crop->regionlist[i - 1].length))\n             {\n\t     TIFFError (\"extractCompositeRegions\", \n                          \"Only equal length regions can be combined for -E left or right\");\n\t     return (1);\n             }\n           crop->combined_width += crop_width;\n           crop->combined_length = crop_length;\n           dst_rowsize = (((composite_width * bps * count) + 7) / 8);\n           trailing_bits = (crop_width * bps * count) % 8;\n           for (row = first_row; row <= last_row; row++)\n             {\n\t     src_offset = row * src_rowsize;\n\t     dst_offset = (row - first_row) * dst_rowsize;\n             src = read_buff + src_offset;\n             dst = crop_buff + dst_offset + prev_width;\n\n             switch (shift_width)\n               {\n               case 0: if (extractContigSamplesBytes (src, dst, img_width,\n                                                      sample, spp, bps, count,\n                                                      first_col, last_col + 1))\n                         {\n\t\t         TIFFError(\"extractCompositeRegions\",\n                                   \"Unable to extract row %d\", row);\n\t\t         return (1);\n\t\t         }\n\t\t       break;\n               case 1: if (bps == 1)\n                         { \n                         if (extractContigSamplesShifted8bits (src, dst, img_width,\n                                                               sample, spp, bps, count, \n                                                               first_col, last_col + 1,\n                                                               prev_trailing_bits))\n                           {\n\t\t           TIFFError(\"extractCompositeRegions\",\n                                     \"Unable to extract row %d\", row);\n\t\t           return (1);\n\t\t           }\n\t\t         break;\n\t\t\t }\n                       else\n                         if (extractContigSamplesShifted16bits (src, dst, img_width,\n                                                                sample, spp, bps, count, \n                                                                first_col, last_col + 1,\n                                                                prev_trailing_bits))\n                           {\n\t\t           TIFFError(\"extractCompositeRegions\",\n                                     \"Unable to extract row %d\", row);\n\t\t           return (1);\n\t\t           }\n\t\t        break;\n              case 2:  if (extractContigSamplesShifted24bits (src, dst, img_width,\n                                                               sample, spp, bps, count, \n                                                               first_col, last_col + 1,\n                                                               prev_trailing_bits))\n                          {\n\t\t          TIFFError(\"extractCompositeRegions\",\n                                    \"Unable to extract row %d\", row);\n\t\t          return (1);\n\t\t          }\n\t\t        break;\n               case 3:\n               case 4:\n               case 5:  if (extractContigSamplesShifted32bits (src, dst, img_width,\n                                                               sample, spp, bps, count, \n                                                               first_col, last_col + 1,\n                                                               prev_trailing_bits))\n                          {\n\t\t          TIFFError(\"extractCompositeRegions\",\n                                    \"Unable to extract row %d\", row);\n\t\t          return (1);\n\t\t          }\n\t\t        break;\n               default: TIFFError(\"extractCompositeRegions\", \"Unsupported bit depth %d\", bps);\n\t\t        return (1);\n\t       }\n\t     }\n\t   prev_width += (crop_width * bps * count) / 8;\n           prev_trailing_bits += trailing_bits;\n           if (prev_trailing_bits > 7)\n\t     prev_trailing_bits-= 8;\n\t   break;\n      }\n    }\n  if (crop->combined_width != composite_width)\n    TIFFError(\"combineSeparateRegions\",\"Combined width does not match composite width\");\n      \n  return (0);\n  }  /* end extractCompositeRegions */\n\n/* Copy a single region of input buffer to an output buffer. \n * The read functions used copy separate plane data into a buffer \n * as interleaved samples rather than separate planes so the same\n * logic works to extract regions regardless of the way the data \n * are organized in the input file. This function can be used to\n * extract one or more samples from the input image by updating the \n * parameters for starting sample and number of samples to copy in the\n * fifth and eighth arguments of the call to extractContigSamples.\n * They would be passed as new elements of the crop_mask struct.\n */\n\nstatic int\nextractSeparateRegion(struct image_data *image,  struct crop_mask *crop,\n                      unsigned char *read_buff, unsigned char *crop_buff,\n                      int region)\n  {\n  int     shift_width, prev_trailing_bits = 0;\n  uint32  bytes_per_sample, bytes_per_pixel;\n  uint32  src_rowsize, dst_rowsize;\n  uint32  row, first_row, last_row, first_col, last_col;\n  uint32  src_offset, dst_offset;\n  uint32  crop_width, crop_length, img_width, img_length;\n  uint16  bps, spp;\n  uint8  *src, *dst;\n  tsample_t count, sample = 0;   /* Update to extract more or more samples */\n\n  img_width = image->width;\n  img_length = image->length;\n  bps = image->bps;\n  spp = image->spp;\n  count = spp;\n\n  bytes_per_sample = (bps + 7) / 8; \n  bytes_per_pixel  = ((bps * spp) + 7) / 8;\n  if ((bps % 8) == 0)\n    shift_width = 0; /* Byte aligned data only */\n  else\n    {\n    if (bytes_per_pixel < (bytes_per_sample + 1))\n      shift_width = bytes_per_pixel;\n    else\n      shift_width = bytes_per_sample + 1;\n    }\n\n  /* rows, columns, width, length are expressed in pixels */\n  first_row = crop->regionlist[region].y1;\n  last_row  = crop->regionlist[region].y2;\n  first_col = crop->regionlist[region].x1;\n  last_col  = crop->regionlist[region].x2;\n\n  crop_width = last_col - first_col + 1;\n  crop_length = last_row - first_row + 1;\n\n  crop->regionlist[region].width = crop_width;\n  crop->regionlist[region].length = crop_length;\n  crop->regionlist[region].buffptr = crop_buff;\n\n  src = read_buff;\n  dst = crop_buff;\n  src_rowsize = ((img_width * bps * spp) + 7) / 8;\n  dst_rowsize = (((crop_width * bps * spp) + 7) / 8);\n\n  for (row = first_row; row <= last_row; row++)\n    {\n    src_offset = row * src_rowsize;\n    dst_offset = (row  - first_row) * dst_rowsize;\n    src = read_buff + src_offset;\n    dst = crop_buff + dst_offset;\n\n    switch (shift_width)\n      {\n      case 0: if (extractContigSamplesBytes (src, dst, img_width, sample,\n                                             spp, bps, count, first_col,\n                                             last_col + 1))\n                {\n\t        TIFFError(\"extractSeparateRegion\",\n                          \"Unable to extract row %d\", row);\n\t        return (1);\n\t        }\n\t      break;\n      case 1: if (bps == 1)\n                { \n                if (extractContigSamplesShifted8bits (src, dst, img_width,\n                                                      sample, spp, bps, count, \n                                                      first_col, last_col + 1,\n                                                      prev_trailing_bits))\n                  {\n\t\t  TIFFError(\"extractSeparateRegion\",\n                            \"Unable to extract row %d\", row);\n\t\t  return (1);\n\t\t  }\n\t\t  break;\n\t\t}\n              else\n                if (extractContigSamplesShifted16bits (src, dst, img_width,\n                                                       sample, spp, bps, count, \n                                                       first_col, last_col + 1,\n                                                       prev_trailing_bits))\n                  {\n\t\t  TIFFError(\"extractSeparateRegion\",\n                            \"Unable to extract row %d\", row);\n\t\t  return (1);\n\t\t  }\n\t      break;\n      case 2:  if (extractContigSamplesShifted24bits (src, dst, img_width,\n                                                     sample, spp, bps, count, \n                                                     first_col, last_col + 1,\n                                                     prev_trailing_bits))\n                {\n\t\tTIFFError(\"extractSeparateRegion\",\n                          \"Unable to extract row %d\", row);\n\t\treturn (1);\n\t\t}\n\t      break;\n      case 3:\n      case 4:\n      case 5:  if (extractContigSamplesShifted32bits (src, dst, img_width,\n                                                     sample, spp, bps, count, \n                                                     first_col, last_col + 1,\n                                                     prev_trailing_bits))\n                {\n\t\tTIFFError(\"extractSeparateRegion\",\n                          \"Unable to extract row %d\", row);\n\t\treturn (1);\n\t\t}\n\t      break;\n      default: TIFFError(\"extractSeparateRegion\", \"Unsupported bit depth %d\", bps);\n\t       return (1);\n      }\n    }\n          \n  return (0);\n  }  /* end extractSeparateRegion */\n\nstatic int\nextractImageSection(struct image_data *image, struct pageseg *section, \n                    unsigned char *src_buff, unsigned char *sect_buff)\n  {\n  unsigned  char  bytebuff1, bytebuff2;\n  unsigned  char *src, *dst;\n\n  uint32    img_width, img_length, img_rowsize;\n  uint32    j, shift1, shift2, trailing_bits;\n  uint32    row, first_row, last_row, first_col, last_col;\n  uint32    src_offset, dst_offset, row_offset, col_offset;\n  uint32    offset1, offset2, full_bytes;\n  uint32    sect_width, sect_length;\n  uint16    bps, spp;\n\n#ifdef DEVELMODE\n  int      k;\n  unsigned char bitset;\n  static char *bitarray = NULL;\n#endif\n\n  img_width = image->width;\n  img_length = image->length;\n  bps = image->bps;\n  spp = image->spp;\n\n  src = src_buff;\n  dst = sect_buff;\n  src_offset = 0;\n  dst_offset = 0;\n\n#ifdef DEVELMODE\n  if (bitarray == NULL)\n    {\n    if ((bitarray = (char *)malloc(img_width)) == NULL)\n      {\n      TIFFError (\"\", \"DEBUG: Unable to allocate debugging bitarray\\n\");\n      return (-1);\n      }\n    }\n#endif\n\n  /* rows, columns, width, length are expressed in pixels */\n  first_row = section->y1;\n  last_row  = section->y2;\n  first_col = section->x1;\n  last_col  = section->x2;\n\n  sect_width = last_col - first_col + 1;\n  sect_length = last_row - first_row + 1;\n  img_rowsize = ((img_width * bps + 7) / 8) * spp;\n  full_bytes = (sect_width * spp * bps) / 8;   /* number of COMPLETE bytes per row in section */\n  trailing_bits = (sect_width * bps) % 8;\n\n#ifdef DEVELMODE\n    TIFFError (\"\", \"First row: %d, last row: %d, First col: %d, last col: %d\\n\",\n           first_row, last_row, first_col, last_col);\n    TIFFError (\"\", \"Image width: %d, Image length: %d, bps: %d, spp: %d\\n\",\n\t   img_width, img_length, bps, spp);\n    TIFFError (\"\", \"Sect  width: %d,  Sect length: %d, full bytes: %d trailing bits %d\\n\", \n           sect_width, sect_length, full_bytes, trailing_bits);\n#endif\n\n  if ((bps % 8) == 0)\n    {\n    col_offset = first_col * spp * bps / 8;\n    for (row = first_row; row <= last_row; row++)\n      {\n      /* row_offset = row * img_width * spp * bps / 8; */\n      row_offset = row * img_rowsize;\n      src_offset = row_offset + col_offset;\n\n#ifdef DEVELMODE\n        TIFFError (\"\", \"Src offset: %8d, Dst offset: %8d\\n\", src_offset, dst_offset); \n#endif\n      _TIFFmemcpy (sect_buff + dst_offset, src_buff + src_offset, full_bytes);\n      dst_offset += full_bytes;\n      }        \n    }\n  else\n    { /* bps != 8 */\n    shift1  = spp * ((first_col * bps) % 8);\n    shift2  = spp * ((last_col * bps) % 8);\n    for (row = first_row; row <= last_row; row++)\n      {\n      /* pull out the first byte */\n      row_offset = row * img_rowsize;\n      offset1 = row_offset + (first_col * bps / 8);\n      offset2 = row_offset + (last_col * bps / 8);\n\n#ifdef DEVELMODE\n      for (j = 0, k = 7; j < 8; j++, k--)\n        {\n        bitset = *(src_buff + offset1) & (((unsigned char)1 << k)) ? 1 : 0;\n        sprintf(&bitarray[j], (bitset) ? \"1\" : \"0\");\n        }\n      sprintf(&bitarray[8], \" \");\n      sprintf(&bitarray[9], \" \");\n      for (j = 10, k = 7; j < 18; j++, k--)\n        {\n        bitset = *(src_buff + offset2) & (((unsigned char)1 << k)) ? 1 : 0;\n        sprintf(&bitarray[j], (bitset) ? \"1\" : \"0\");\n        }\n      bitarray[18] = '\\0';\n      TIFFError (\"\", \"Row: %3d Offset1: %d,  Shift1: %d,    Offset2: %d,  Shift2:  %d\\n\", \n                 row, offset1, shift1, offset2, shift2); \n#endif\n\n      bytebuff1 = bytebuff2 = 0;\n      if (shift1 == 0) /* the region is byte and sample alligned */\n        {\n\t_TIFFmemcpy (sect_buff + dst_offset, src_buff + offset1, full_bytes);\n\n#ifdef DEVELMODE\n\tTIFFError (\"\", \"        Alligned data src offset1: %8d, Dst offset: %8d\\n\", offset1, dst_offset); \n\tsprintf(&bitarray[18], \"\\n\");\n\tsprintf(&bitarray[19], \"\\t\");\n        for (j = 20, k = 7; j < 28; j++, k--)\n          {\n          bitset = *(sect_buff + dst_offset) & (((unsigned char)1 << k)) ? 1 : 0;\n          sprintf(&bitarray[j], (bitset) ? \"1\" : \"0\");\n          }\n        bitarray[28] = ' ';\n        bitarray[29] = ' ';\n#endif\n        dst_offset += full_bytes;\n\n        if (trailing_bits != 0)\n          {\n\t  bytebuff2 = src_buff[offset2] & ((unsigned char)255 << (7 - shift2));\n          sect_buff[dst_offset] = bytebuff2;\n#ifdef DEVELMODE\n\t  TIFFError (\"\", \"        Trailing bits src offset:  %8d, Dst offset: %8d\\n\", \n                              offset2, dst_offset); \n          for (j = 30, k = 7; j < 38; j++, k--)\n            {\n            bitset = *(sect_buff + dst_offset) & (((unsigned char)1 << k)) ? 1 : 0;\n            sprintf(&bitarray[j], (bitset) ? \"1\" : \"0\");\n            }\n          bitarray[38] = '\\0';\n          TIFFError (\"\", \"\\tFirst and last bytes before and after masking:\\n\\t%s\\n\\n\", bitarray);\n#endif\n          dst_offset++;\n          }\n        }\n      else   /* each destination byte will have to be built from two source bytes*/\n        {\n#ifdef DEVELMODE\n\t  TIFFError (\"\", \"        Unalligned data src offset: %8d, Dst offset: %8d\\n\", offset1 , dst_offset); \n#endif\n        for (j = 0; j <= full_bytes; j++) \n          {\n\t  bytebuff1 = src_buff[offset1 + j] & ((unsigned char)255 >> shift1);\n\t  bytebuff2 = src_buff[offset1 + j + 1] & ((unsigned char)255 << (7 - shift1));\n          sect_buff[dst_offset + j] = (bytebuff1 << shift1) | (bytebuff2 >> (8 - shift1));\n          }\n#ifdef DEVELMODE\n\tsprintf(&bitarray[18], \"\\n\");\n\tsprintf(&bitarray[19], \"\\t\");\n        for (j = 20, k = 7; j < 28; j++, k--)\n          {\n          bitset = *(sect_buff + dst_offset) & (((unsigned char)1 << k)) ? 1 : 0;\n          sprintf(&bitarray[j], (bitset) ? \"1\" : \"0\");\n          }\n        bitarray[28] = ' ';\n        bitarray[29] = ' ';\n#endif\n        dst_offset += full_bytes;\n\n        if (trailing_bits != 0)\n          {\n#ifdef DEVELMODE\n\t    TIFFError (\"\", \"        Trailing bits   src offset: %8d, Dst offset: %8d\\n\", offset1 + full_bytes, dst_offset); \n#endif\n\t  if (shift2 > shift1)\n            {\n\t    bytebuff1 = src_buff[offset1 + full_bytes] & ((unsigned char)255 << (7 - shift2));\n            bytebuff2 = bytebuff1 & ((unsigned char)255 << shift1);\n            sect_buff[dst_offset] = bytebuff2;\n#ifdef DEVELMODE\n\t    TIFFError (\"\", \"        Shift2 > Shift1\\n\"); \n#endif\n            }\n          else\n            {\n\t    if (shift2 < shift1)\n              {\n              bytebuff2 = ((unsigned char)255 << (shift1 - shift2 - 1));\n\t      sect_buff[dst_offset] &= bytebuff2;\n#ifdef DEVELMODE\n\t      TIFFError (\"\", \"        Shift2 < Shift1\\n\"); \n#endif\n              }\n#ifdef DEVELMODE\n            else\n\t      TIFFError (\"\", \"        Shift2 == Shift1\\n\"); \n#endif\n            }\n\t  }\n#ifdef DEVELMODE\n\t  sprintf(&bitarray[28], \" \");\n\t  sprintf(&bitarray[29], \" \");\n          for (j = 30, k = 7; j < 38; j++, k--)\n            {\n            bitset = *(sect_buff + dst_offset) & (((unsigned char)1 << k)) ? 1 : 0;\n            sprintf(&bitarray[j], (bitset) ? \"1\" : \"0\");\n            }\n          bitarray[38] = '\\0';\n          TIFFError (\"\", \"\\tFirst and last bytes before and after masking:\\n\\t%s\\n\\n\", bitarray);\n#endif\n        dst_offset++;\n        }\n      }\n    }\n\n  return (0);\n  } /* end extractImageSection */\n\nstatic int \nwriteSelections(TIFF *in, TIFF **out, struct crop_mask *crop, \n                struct image_data *image, struct dump_opts *dump,\n                struct buffinfo seg_buffs[], char *mp, char *filename, \n                unsigned int *page, unsigned int total_pages)\n  {\n  int i, page_count;\n  int autoindex = 0;\n  unsigned char *crop_buff = NULL;\n\n  /* Where we open a new file depends on the export mode */  \n  switch (crop->exp_mode)\n    {\n    case ONE_FILE_COMPOSITE: /* Regions combined into single image */\n         autoindex = 0;\n         crop_buff = seg_buffs[0].buffer;\n         if (update_output_file (out, mp, autoindex, filename, page))\n           return (1);\n         page_count = total_pages;\n         if (writeCroppedImage(in, *out, image, dump,\n                               crop->combined_width, \n                               crop->combined_length,\n                               crop_buff, *page, total_pages))\n            {\n             TIFFError(\"writeRegions\", \"Unable to write new image\");\n             return (-1);\n             }\n\t break;\n    case ONE_FILE_SEPARATED: /* Regions as separated images */\n         autoindex = 0;\n         if (update_output_file (out, mp, autoindex, filename, page))\n           return (1);\n         page_count = crop->selections * total_pages;\n         for (i = 0; i < crop->selections; i++)\n           {\n           crop_buff = seg_buffs[i].buffer;\n           if (writeCroppedImage(in, *out, image, dump,\n                                 crop->regionlist[i].width, \n                                 crop->regionlist[i].length, \n                                 crop_buff, *page, page_count))\n             {\n             TIFFError(\"writeRegions\", \"Unable to write new image\");\n             return (-1);\n             }\n\t   }\n         break;\n    case FILE_PER_IMAGE_COMPOSITE: /* Regions as composite image */\n         autoindex = 1;\n         if (update_output_file (out, mp, autoindex, filename, page))\n           return (1);\n\n         crop_buff = seg_buffs[0].buffer;\n         if (writeCroppedImage(in, *out, image, dump,\n                               crop->combined_width, \n                               crop->combined_length, \n                               crop_buff, *page, total_pages))\n           {\n           TIFFError(\"writeRegions\", \"Unable to write new image\");\n           return (-1);\n           }\n         break;\n    case FILE_PER_IMAGE_SEPARATED: /* Regions as separated images */\n         autoindex = 1;\n         page_count = crop->selections;\n         if (update_output_file (out, mp, autoindex, filename, page))\n           return (1);\n                \n         for (i = 0; i < crop->selections; i++)\n           {\n           crop_buff = seg_buffs[i].buffer;\n           /* Write the current region to the current file */\n           if (writeCroppedImage(in, *out, image, dump,\n                                 crop->regionlist[i].width, \n                                 crop->regionlist[i].length, \n                                 crop_buff, *page, page_count))\n             {\n             TIFFError(\"writeRegions\", \"Unable to write new image\");\n             return (-1);\n             }\n           }\n         break;\n    case FILE_PER_SELECTION:\n         autoindex = 1;\n\t page_count = 1;\n         for (i = 0; i < crop->selections; i++)\n           {\n           if (update_output_file (out, mp, autoindex, filename, page))\n             return (1);\n\n           crop_buff = seg_buffs[i].buffer;\n           /* Write the current region to the current file */\n           if (writeCroppedImage(in, *out, image, dump,\n                                 crop->regionlist[i].width, \n                                 crop->regionlist[i].length, \n                                 crop_buff, *page, page_count))\n             {\n             TIFFError(\"writeRegions\", \"Unable to write new image\");\n             return (-1);\n             }\n           }\n\t break;\n    default: return (1);\n    }\n\n  return (0);\n  } /* end writeRegions */\n\nstatic int\nwriteImageSections(TIFF *in, TIFF *out, struct image_data *image,\n\t\t   struct pagedef *page, struct pageseg *sections,\n\t\t   struct dump_opts * dump, unsigned char *src_buff,\n                   unsigned char **sect_buff_ptr)\n  {\n  double  hres, vres;\n  uint32  i, k, width, length, sectsize;\n  unsigned char *sect_buff = *sect_buff_ptr;\n\n  hres = page->hres;\n  vres = page->vres;\n\n  k = page->cols * page->rows;\n  if ((k < 1) || (k > MAX_SECTIONS))\n   {\n   TIFFError(\"writeImageSections\",\n\t     \"%d Rows and Columns exceed maximum sections\\nIncrease resolution or reduce sections\", k);\n   return (-1);\n   }\n\n  for (i = 0; i < k; i++)\n    {\n    width  = sections[i].x2 - sections[i].x1 + 1;\n    length = sections[i].y2 - sections[i].y1 + 1;\n    sectsize = (uint32)\n\t    ceil((width * image->bps + 7) / (double)8) * image->spp * length;\n    /* allocate a buffer if we don't have one already */\n    if (createImageSection(sectsize, sect_buff_ptr))\n      {\n      TIFFError(\"writeImageSections\", \"Unable to allocate section buffer\");\n      exit (-1);\n      }\n    sect_buff = *sect_buff_ptr;\n\n    if (extractImageSection (image, &sections[i], src_buff, sect_buff))\n      {\n      TIFFError(\"writeImageSections\", \"Unable to extract image sections\");\n      exit (-1);\n      }\n\n  /* call the write routine here instead of outside the loop */\n    if (writeSingleSection(in, out, image, dump, width, length, hres, vres, sect_buff))\n      {\n      TIFFError(\"writeImageSections\", \"Unable to write image section\");\n      exit (-1);\n      }\n    }\n\n  return (0);\n  } /* end writeImageSections */\n\n/* Code in this function is heavily indebted to code in tiffcp\n * with modifications by Richard Nolde to handle orientation correctly.\n * It will have to be updated significantly if support is added to\n * extract one or more samples from original image since the \n * original code assumes we are always copying all samples.\n */\nstatic int  \nwriteSingleSection(TIFF *in, TIFF *out, struct image_data *image,\n                   struct dump_opts *dump, uint32 width, uint32 length,\n                   double hres, double vres,\n                   unsigned char *sect_buff)\n  {\n  uint16 bps, spp;\n  uint16 input_compression, input_photometric;\n  uint16 input_jpeg_colormode, input_planar;\n  struct cpTag* p;\n\n  TIFFGetField(in, TIFFTAG_PHOTOMETRIC, &input_photometric);\n  TIFFGetField(in, TIFFTAG_PHOTOMETRIC, &spp);\n  TIFFGetField(in, TIFFTAG_PHOTOMETRIC, &bps);\n\n  TIFFSetField(out, TIFFTAG_IMAGEWIDTH, width);\n  TIFFSetField(out, TIFFTAG_IMAGELENGTH, length);\n\n  CopyField(TIFFTAG_BITSPERSAMPLE, bps);\n  CopyField(TIFFTAG_SAMPLESPERPIXEL, spp);\n\n\n  TIFFGetField(in, TIFFTAG_COMPRESSION, &input_compression);\n  /* This is the global variable compression which is set \n   * if the user has specified a command line option for \n   * a compression option.  Should be passed around in one\n   * of the parameters instead of as a global. If no user\n   * option specified it will still be (uint16) -1. */\n  if (compression != (uint16)-1)\n    TIFFSetField(out, TIFFTAG_COMPRESSION, compression);\n  else\n    { /* OJPEG is no longer supported for writing so upgrade to JPEG */\n    if (input_compression == COMPRESSION_OJPEG)\n      {\n      TIFFSetField(out, TIFFTAG_COMPRESSION, COMPRESSION_JPEG);\n      compression = COMPRESSION_JPEG;\n      }\n    else /* Use the compression from the input file */\n      CopyField(TIFFTAG_COMPRESSION, compression);\n    }\n\n  TIFFGetField(in, TIFFTAG_JPEGCOLORMODE, &input_jpeg_colormode);\n#ifdef DEBUG2\n  TIFFError(\"writeSingleSection\", \"Input compression: %s\",\n\t    (input_compression == COMPRESSION_OJPEG) ? \"Old Jpeg\" :\n\t    ((input_compression == COMPRESSION_JPEG) ?  \"New Jpeg\" : \"Non Jpeg\"));\n#endif\n  if (compression == COMPRESSION_JPEG)\n    {\n    if ((input_photometric == PHOTOMETRIC_PALETTE) ||  /* color map indexed */\n        (input_photometric == PHOTOMETRIC_MASK))       /* $holdout mask */\n      {\n      TIFFError (\"writeSingleSection\",\n                 \"JPEG compression cannot be used with %s image data\",\n\t\t (input_photometric == PHOTOMETRIC_PALETTE) ?\n                 \"palette\" : \"mask\");\n      return (-1);\n      }\n    if (input_photometric == PHOTOMETRIC_RGB)\n      {\n      if (jpegcolormode == JPEGCOLORMODE_RGB)\n\tTIFFSetField(out, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_YCBCR);\n      else\n\tTIFFSetField(out, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB);\n      } \n    else\n\tTIFFSetField(out, TIFFTAG_PHOTOMETRIC, input_photometric);\n    }\n  else\n    {\n    if (compression == COMPRESSION_SGILOG || compression == COMPRESSION_SGILOG24)\n      TIFFSetField(out, TIFFTAG_PHOTOMETRIC, spp == 1 ?\n\t\t\tPHOTOMETRIC_LOGL : PHOTOMETRIC_LOGLUV);\n    else\n      TIFFSetField(out, TIFFTAG_PHOTOMETRIC, image->photometric);\n    }\n\n  if (((input_photometric == PHOTOMETRIC_LOGL) ||\n       (input_photometric ==  PHOTOMETRIC_LOGLUV)) &&\n      ((compression != COMPRESSION_SGILOG) && \n       (compression != COMPRESSION_SGILOG24)))\n    {\n    TIFFError(\"writeCroppedImage\",\n              \"LogL and LogLuv source data require SGI_LOG or SGI_LOG24 compression\");\n    return (-1);\n    }\n\n  if (fillorder != 0)\n    TIFFSetField(out, TIFFTAG_FILLORDER, fillorder);\n  else\n    CopyTag(TIFFTAG_FILLORDER, 1, TIFF_SHORT);\n\n  /* The loadimage function reads input orientation and sets\n   * image->orientation. The correct_image_orientation function\n   * applies the required rotation and mirror operations to \n   * present the data in TOPLEFT orientation and updates \n   * image->orientation if any transforms are performed, \n   * as per EXIF standard.\n   */\n  TIFFSetField(out, TIFFTAG_ORIENTATION, image->orientation);\n\n  /*\n   * Choose tiles/strip for the output image according to\n   * the command line arguments (-tiles, -strips) and the\n   * structure of the input image.\n   */\n  if (outtiled == -1)\n    outtiled = TIFFIsTiled(in);\n  if (outtiled) {\n    /*\n     * Setup output file's tile width&height.  If either\n     * is not specified, use either the value from the\n     * input image or, if nothing is defined, use the\n     * library default.\n     */\n    if (tilewidth == (uint32) 0)\n      TIFFGetField(in, TIFFTAG_TILEWIDTH, &tilewidth);\n    if (tilelength == (uint32) 0)\n      TIFFGetField(in, TIFFTAG_TILELENGTH, &tilelength);\n\n    if (tilewidth == 0 || tilelength == 0)\n      TIFFDefaultTileSize(out, &tilewidth, &tilelength);\n    TIFFDefaultTileSize(out, &tilewidth, &tilelength);\n    TIFFSetField(out, TIFFTAG_TILEWIDTH, tilewidth);\n    TIFFSetField(out, TIFFTAG_TILELENGTH, tilelength);\n    } else {\n       /*\n\t* RowsPerStrip is left unspecified: use either the\n\t* value from the input image or, if nothing is defined,\n\t* use the library default.\n\t*/\n\tif (rowsperstrip == (uint32) 0)\n          {\n\t  if (!TIFFGetField(in, TIFFTAG_ROWSPERSTRIP, &rowsperstrip))\n\t    rowsperstrip = TIFFDefaultStripSize(out, rowsperstrip);\n          if (compression != COMPRESSION_JPEG)\n            {\n  \t    if (rowsperstrip > length)\n\t      rowsperstrip = length;\n\t    }\n\t  }\n\telse \n          if (rowsperstrip == (uint32) -1)\n\t    rowsperstrip = length;\n\tTIFFSetField(out, TIFFTAG_ROWSPERSTRIP, rowsperstrip);\n\t}\n\n  TIFFGetFieldDefaulted(in, TIFFTAG_PLANARCONFIG, &input_planar);\n  if (config != (uint16) -1)\n    TIFFSetField(out, TIFFTAG_PLANARCONFIG, config);\n  else\n    CopyField(TIFFTAG_PLANARCONFIG, config);\n  if (spp <= 4)\n    CopyTag(TIFFTAG_TRANSFERFUNCTION, 4, TIFF_SHORT);\n  CopyTag(TIFFTAG_COLORMAP, 4, TIFF_SHORT);\n\n/* SMinSampleValue & SMaxSampleValue */\n  switch (compression) {\n    /* These are references to GLOBAL variables set by defaults\n     * and /or the compression flag\n     */\n    case COMPRESSION_JPEG:\n         if (((bps % 8) == 0) || ((bps % 12) == 0))\n\t   {\n           TIFFSetField(out, TIFFTAG_JPEGQUALITY, quality);\n\t   TIFFSetField(out, TIFFTAG_JPEGCOLORMODE, JPEGCOLORMODE_RGB);\n           }\n         else\n           {\n\t   TIFFError(\"writeCroppedImage\",\n                     \"JPEG compression requires 8 or 12 bits per sample\");\n           return (-1);\n           }\n\t break;\n   case COMPRESSION_LZW:\n   case COMPRESSION_ADOBE_DEFLATE:\n   case COMPRESSION_DEFLATE:\n\tif (predictor != (uint16)-1)\n          TIFFSetField(out, TIFFTAG_PREDICTOR, predictor);\n\telse\n\t  CopyField(TIFFTAG_PREDICTOR, predictor);\n\tbreak;\n   case COMPRESSION_CCITTFAX3:\n   case COMPRESSION_CCITTFAX4:\n\tif (compression == COMPRESSION_CCITTFAX3) {\n          if (g3opts != (uint32) -1)\n\t    TIFFSetField(out, TIFFTAG_GROUP3OPTIONS, g3opts);\n\t  else\n\t    CopyField(TIFFTAG_GROUP3OPTIONS, g3opts);\n\t} else\n\t    CopyTag(TIFFTAG_GROUP4OPTIONS, 1, TIFF_LONG);\n\t    CopyTag(TIFFTAG_BADFAXLINES, 1, TIFF_LONG);\n\t    CopyTag(TIFFTAG_CLEANFAXDATA, 1, TIFF_LONG);\n\t    CopyTag(TIFFTAG_CONSECUTIVEBADFAXLINES, 1, TIFF_LONG);\n\t    CopyTag(TIFFTAG_FAXRECVPARAMS, 1, TIFF_LONG);\n\t    CopyTag(TIFFTAG_FAXRECVTIME, 1, TIFF_LONG);\n\t    CopyTag(TIFFTAG_FAXSUBADDRESS, 1, TIFF_ASCII);\n\tbreak;\n   }\n   { uint32 len32;\n     void** data;\n     if (TIFFGetField(in, TIFFTAG_ICCPROFILE, &len32, &data))\n       TIFFSetField(out, TIFFTAG_ICCPROFILE, len32, data);\n   }\n   { uint16 ninks;\n     const char* inknames;\n     if (TIFFGetField(in, TIFFTAG_NUMBEROFINKS, &ninks)) {\n       TIFFSetField(out, TIFFTAG_NUMBEROFINKS, ninks);\n       if (TIFFGetField(in, TIFFTAG_INKNAMES, &inknames)) {\n\t int inknameslen = strlen(inknames) + 1;\n\t const char* cp = inknames;\n\t while (ninks > 1) {\n\t   cp = strchr(cp, '\\0');\n\t   if (cp) {\n\t     cp++;\n\t     inknameslen += (strlen(cp) + 1);\n\t   }\n\t   ninks--;\n         }\n\t TIFFSetField(out, TIFFTAG_INKNAMES, inknameslen, inknames);\n       }\n     }\n   }\n   {\n   unsigned short pg0, pg1;\n   if (TIFFGetField(in, TIFFTAG_PAGENUMBER, &pg0, &pg1)) {\n     if (pageNum < 0) /* only one input file */\n\tTIFFSetField(out, TIFFTAG_PAGENUMBER, pg0, pg1);\n     else \n\tTIFFSetField(out, TIFFTAG_PAGENUMBER, pageNum++, 0);\n     }\n   }\n\n  for (p = tags; p < &tags[NTAGS]; p++)\n\t\tCopyTag(p->tag, p->count, p->type);\n\n  /* Update these since they are overwritten from input res by loop above */\n  TIFFSetField(out, TIFFTAG_XRESOLUTION, (float)hres);\n  TIFFSetField(out, TIFFTAG_YRESOLUTION, (float)vres);\n\n  /* Compute the tile or strip dimensions and write to disk */\n  if (outtiled)\n    {\n    if (config == PLANARCONFIG_CONTIG)\n      writeBufferToContigTiles (out, sect_buff, length, width, spp, dump);\n    else\n      writeBufferToSeparateTiles (out, sect_buff, length, width, spp, dump);\n    }\n  else\n    {\n    if (config == PLANARCONFIG_CONTIG)\n      writeBufferToContigStrips (out, sect_buff, length);\n    else\n      writeBufferToSeparateStrips(out, sect_buff, length, width, spp, dump);\n    }\n\n  if (!TIFFWriteDirectory(out))\n    {\n    TIFFClose(out);\n    return (-1);\n    }\n\n  return (0);\n  } /* end writeSingleSection */\n\n\n/* Create a buffer to write one section at a time */\nstatic int\ncreateImageSection(uint32 sectsize, unsigned char **sect_buff_ptr)\n  {\n  unsigned  char *sect_buff = NULL;\n  unsigned  char *new_buff  = NULL;\n  static    uint32  prev_sectsize = 0;\n  \n  sect_buff = *sect_buff_ptr;\n\n  if (!sect_buff)\n    {\n    sect_buff = (unsigned char *)_TIFFmalloc(sectsize);\n    *sect_buff_ptr = sect_buff;\n    _TIFFmemset(sect_buff, 0, sectsize);\n    }\n  else\n    {\n    if (prev_sectsize < sectsize)\n      {\n      new_buff = _TIFFrealloc(sect_buff, sectsize);\n      if (!new_buff)\n        {\n\tfree (sect_buff);\n        sect_buff = (unsigned char *)_TIFFmalloc(sectsize);\n        }\n      else\n        sect_buff = new_buff;\n\n      _TIFFmemset(sect_buff, 0, sectsize);\n      }\n    }\n\n  if (!sect_buff)\n    {\n    TIFFError(\"createImageSection\", \"Unable to allocate/reallocate section buffer\");\n    return (-1);\n    }\n  prev_sectsize = sectsize;\n  *sect_buff_ptr = sect_buff;\n\n  return (0);\n  }  /* end createImageSection */\n\n\n/* Process selections defined by regions, zones, margins, or fixed sized areas */\nstatic int\nprocessCropSelections(struct image_data *image, struct crop_mask *crop, \n                      unsigned char **read_buff_ptr, struct buffinfo seg_buffs[])\n  {\n  int       i;\n  uint32    width, length, total_width, total_length;\n  tsize_t   cropsize;\n  unsigned  char *crop_buff = NULL;\n  unsigned  char *read_buff = NULL;\n  unsigned  char *next_buff = NULL;\n  tsize_t   prev_cropsize = 0;\n\n  read_buff = *read_buff_ptr;\n\n  if (crop->img_mode == COMPOSITE_IMAGES)\n    {\n    cropsize = crop->bufftotal;\n    crop_buff = seg_buffs[0].buffer; \n    if (!crop_buff)\n      crop_buff = (unsigned char *)_TIFFmalloc(cropsize);\n    else\n      {\n      prev_cropsize = seg_buffs[0].size;\n      if (prev_cropsize < cropsize)\n        {\n        next_buff = _TIFFrealloc(crop_buff, cropsize);\n        if (! next_buff)\n          {\n          _TIFFfree (crop_buff);\n          crop_buff = (unsigned char *)_TIFFmalloc(cropsize);\n          }\n        else\n          crop_buff = next_buff;\n        }\n      }\n\n    if (!crop_buff)\n      {\n      TIFFError(\"processCropSelections\", \"Unable to allocate/reallocate crop buffer\");\n      return (-1);\n      }\n \n    _TIFFmemset(crop_buff, 0, cropsize);\n    seg_buffs[0].buffer = crop_buff;\n    seg_buffs[0].size = cropsize;\n\n    /* Checks for matching width or length as required */\n    if (extractCompositeRegions(image, crop, read_buff, crop_buff) != 0)\n      return (1);\n\n    if (crop->crop_mode & CROP_INVERT)\n      {\n      switch (crop->photometric)\n        {\n        /* Just change the interpretation */\n        case PHOTOMETRIC_MINISWHITE:\n        case PHOTOMETRIC_MINISBLACK:\n\t     image->photometric = crop->photometric;\n\t     break;\n        case INVERT_DATA_ONLY:\n        case INVERT_DATA_AND_TAG:\n             if (invertImage(image->photometric, image->spp, image->bps, \n                             crop->combined_width, crop->combined_length, crop_buff))\n               {\n               TIFFError(\"processCropSelections\", \n                         \"Failed to invert colorspace for composite regions\");\n               return (-1);\n               }\n             if (crop->photometric == INVERT_DATA_AND_TAG)\n               {\n               switch (image->photometric)\n                 {\n                 case PHOTOMETRIC_MINISWHITE:\n \t              image->photometric = PHOTOMETRIC_MINISBLACK;\n\t              break;\n                 case PHOTOMETRIC_MINISBLACK:\n \t              image->photometric = PHOTOMETRIC_MINISWHITE;\n\t              break;\n                 default:\n\t              break;\n\t         }\n\t       }\n             break;\n        default: break;\n        }\n      }\n\n    /* Mirror and Rotate will not work with multiple regions unless they are the same width */\n    if (crop->crop_mode & CROP_MIRROR)\n      {\n      if (mirrorImage(image->spp, image->bps, crop->mirror, \n                      crop->combined_width, crop->combined_length, crop_buff))\n        {\n        TIFFError(\"processCropSelections\", \"Failed to mirror composite regions %s\", \n\t         (crop->rotation == MIRROR_HORIZ) ? \"horizontally\" : \"vertically\");\n        return (-1);\n        }\n      }\n\n    if (crop->crop_mode & CROP_ROTATE) /* rotate should be last as it can reallocate the buffer */\n      {\n      if (rotateImage(crop->rotation, image, &crop->combined_width, \n                      &crop->combined_length, &crop_buff))\n        {\n        TIFFError(\"processCropSelections\", \n                  \"Failed to rotate composite regions by %d degrees\", crop->rotation);\n        return (-1);\n        }\n      seg_buffs[0].buffer = crop_buff;\n      seg_buffs[0].size = (((crop->combined_width * image->bps + 7 ) / 8)\n                            * image->spp) * crop->combined_length; \n      }\n    }\n  else  /* Separated Images */\n    {\n    total_width = total_length = 0;\n    for (i = 0; i < crop->selections; i++)\n      {\n      cropsize = crop->bufftotal;\n      crop_buff = seg_buffs[i].buffer; \n      if (!crop_buff)\n        crop_buff = (unsigned char *)_TIFFmalloc(cropsize);\n      else\n        {\n        prev_cropsize = seg_buffs[0].size;\n        if (prev_cropsize < cropsize)\n          {\n          next_buff = _TIFFrealloc(crop_buff, cropsize);\n          if (! next_buff)\n            {\n            _TIFFfree (crop_buff);\n            crop_buff = (unsigned char *)_TIFFmalloc(cropsize);\n            }\n          else\n            crop_buff = next_buff;\n          }\n        }\n\n      if (!crop_buff)\n        {\n        TIFFError(\"processCropSelections\", \"Unable to allocate/reallocate crop buffer\");\n        return (-1);\n        }\n \n      _TIFFmemset(crop_buff, 0, cropsize);\n      seg_buffs[i].buffer = crop_buff;\n      seg_buffs[i].size = cropsize;\n\n      if (extractSeparateRegion(image, crop, read_buff, crop_buff, i))\n        {\n\tTIFFError(\"processCropSelections\", \"Unable to extract cropped region %d from image\", i);\n        return (-1);\n        }\n    \n      width  = crop->regionlist[i].width;\n      length = crop->regionlist[i].length;\n\n      if (crop->crop_mode & CROP_INVERT)\n        {\n        switch (crop->photometric)\n          {\n          /* Just change the interpretation */\n          case PHOTOMETRIC_MINISWHITE:\n          case PHOTOMETRIC_MINISBLACK:\n\t       image->photometric = crop->photometric;\n\t       break;\n          case INVERT_DATA_ONLY:\n          case INVERT_DATA_AND_TAG:\n               if (invertImage(image->photometric, image->spp, image->bps, \n                               width, length, crop_buff))\n                 {\n                 TIFFError(\"processCropSelections\", \n                           \"Failed to invert colorspace for region\");\n                 return (-1);\n                 }\n               if (crop->photometric == INVERT_DATA_AND_TAG)\n                 {\n                 switch (image->photometric)\n                   {\n                   case PHOTOMETRIC_MINISWHITE:\n \t                image->photometric = PHOTOMETRIC_MINISBLACK;\n\t                break;\n                   case PHOTOMETRIC_MINISBLACK:\n \t                image->photometric = PHOTOMETRIC_MINISWHITE;\n\t                break;\n                   default:\n\t                break;\n\t           }\n\t         }\n               break;\n          default: break;\n          }\n        }\n\n      if (crop->crop_mode & CROP_MIRROR)\n        {\n        if (mirrorImage(image->spp, image->bps, crop->mirror, \n                        width, length, crop_buff))\n          {\n          TIFFError(\"processCropSelections\", \"Failed to mirror crop region %s\", \n\t           (crop->rotation == MIRROR_HORIZ) ? \"horizontally\" : \"vertically\");\n          return (-1);\n          }\n        }\n\n      if (crop->crop_mode & CROP_ROTATE) /* rotate should be last as it can reallocate the buffer */\n        {\n\tif (rotateImage(crop->rotation, image, &crop->regionlist[i].width, \n\t\t\t&crop->regionlist[i].length, &crop_buff))\n          {\n          TIFFError(\"processCropSelections\", \n                    \"Failed to rotate crop region by %d degrees\", crop->rotation);\n          return (-1);\n          }\n        total_width  += crop->regionlist[i].width;\n        total_length += crop->regionlist[i].length;\n        crop->combined_width = total_width;\n        crop->combined_length = total_length;\n        seg_buffs[i].buffer = crop_buff;\n        seg_buffs[i].size = (((crop->regionlist[i].width * image->bps + 7 ) / 8)\n                               * image->spp) * crop->regionlist[i].length; \n        }\n      }\n    }\n  return (0);\n  } /* end processCropSelections */\n\n/* Copy the crop section of the data from the current image into a buffer\n * and adjust the IFD values to reflect the new size. If no cropping is\n * required, use the origial read buffer as the crop buffer.\n *\n * There is quite a bit of redundancy between this routine and the more\n * specialized processCropSelections, but this provides\n * the most optimized path when no Zones or Regions are required.\n */\nstatic int\ncreateCroppedImage(struct image_data *image, struct crop_mask *crop, \n                   unsigned char **read_buff_ptr, unsigned char **crop_buff_ptr)\n  {\n  tsize_t   cropsize;\n  unsigned  char *read_buff = NULL;\n  unsigned  char *crop_buff = NULL;\n  unsigned  char *new_buff  = NULL;\n  static    tsize_t  prev_cropsize = 0;\n\n  read_buff = *read_buff_ptr;\n\n  /* process full image, no crop buffer needed */\n  crop_buff = read_buff;\n  *crop_buff_ptr = read_buff;\n  crop->combined_width = image->width;\n  crop->combined_length = image->length;\n\n  cropsize = crop->bufftotal;\n  crop_buff = *crop_buff_ptr;\n  if (!crop_buff)\n    {\n    crop_buff = (unsigned char *)_TIFFmalloc(cropsize);\n    *crop_buff_ptr = crop_buff;\n    _TIFFmemset(crop_buff, 0, cropsize);\n    prev_cropsize = cropsize;\n    }\n  else\n    {\n    if (prev_cropsize < cropsize)\n      {\n      new_buff = _TIFFrealloc(crop_buff, cropsize);\n      if (!new_buff)\n        {\n\tfree (crop_buff);\n        crop_buff = (unsigned char *)_TIFFmalloc(cropsize);\n        }\n      else\n        crop_buff = new_buff;\n      _TIFFmemset(crop_buff, 0, cropsize);\n      }\n    }\n\n  if (!crop_buff)\n    {\n    TIFFError(\"createCroppedImage\", \"Unable to allocate/reallocate crop buffer\");\n    return (-1);\n    }\n  *crop_buff_ptr = crop_buff;\n\n  if (crop->crop_mode & CROP_INVERT)\n    {\n    switch (crop->photometric)\n      {\n      /* Just change the interpretation */\n      case PHOTOMETRIC_MINISWHITE:\n      case PHOTOMETRIC_MINISBLACK:\n\t   image->photometric = crop->photometric;\n\t   break;\n      case INVERT_DATA_ONLY:\n      case INVERT_DATA_AND_TAG:\n           if (invertImage(image->photometric, image->spp, image->bps, \n                           crop->combined_width, crop->combined_length, crop_buff))\n             {\n             TIFFError(\"createCroppedImage\", \n                       \"Failed to invert colorspace for image or cropped selection\");\n             return (-1);\n             }\n           if (crop->photometric == INVERT_DATA_AND_TAG)\n             {\n             switch (image->photometric)\n               {\n               case PHOTOMETRIC_MINISWHITE:\n \t            image->photometric = PHOTOMETRIC_MINISBLACK;\n\t            break;\n               case PHOTOMETRIC_MINISBLACK:\n \t            image->photometric = PHOTOMETRIC_MINISWHITE;\n\t            break;\n               default:\n\t            break;\n\t       }\n\t     }\n           break;\n      default: break;\n      }\n    }\n\n  if (crop->crop_mode & CROP_MIRROR)\n    {\n    if (mirrorImage(image->spp, image->bps, crop->mirror, \n                    crop->combined_width, crop->combined_length, crop_buff))\n      {\n      TIFFError(\"createCroppedImage\", \"Failed to mirror image or cropped selection %s\", \n\t       (crop->rotation == MIRROR_HORIZ) ? \"horizontally\" : \"vertically\");\n      return (-1);\n      }\n    }\n\n  if (crop->crop_mode & CROP_ROTATE) /* rotate should be last as it can reallocate the buffer */\n    {\n    if (rotateImage(crop->rotation, image, &crop->combined_width, \n                    &crop->combined_length, crop_buff_ptr))\n      {\n      TIFFError(\"createCroppedImage\", \n                \"Failed to rotate image or cropped selection by %d degrees\", crop->rotation);\n      return (-1);\n      }\n    }\n\n  if (crop_buff == read_buff) /* we used the read buffer for the crop buffer */\n    *read_buff_ptr = NULL;    /* so we don't try to free it later */\n\n  return (0);\n  } /* end createCroppedImage */\n\n\n/* Code in this function is heavily indebted to code in tiffcp\n * with modifications by Richard Nolde to handle orientation correctly.\n * It will have to be updated significantly if support is added to\n * extract one or more samples from original image since the \n * original code assumes we are always copying all samples.\n * Use of global variables for config, compression and others\n * should be replaced by addition to the crop_mask struct (which\n * will be renamed to proc_opts indicating that is controlls\n * user supplied processing options, not just cropping) and \n * then passed in as an argument.\n */\nstatic int  \nwriteCroppedImage(TIFF *in, TIFF *out, struct image_data *image, \n                  struct dump_opts *dump, uint32 width, uint32 length, \n                  unsigned char *crop_buff, int pagenum, int total_pages)\n  {\n  uint16 bps, spp;\n  uint16 input_compression, input_photometric;\n  uint16 input_jpeg_colormode, input_planar;\n  struct cpTag* p;\n\n  TIFFGetField(in, TIFFTAG_PHOTOMETRIC, &input_photometric);\n  TIFFGetField(in, TIFFTAG_PHOTOMETRIC, &spp);\n  TIFFGetField(in, TIFFTAG_PHOTOMETRIC, &bps);\n\n  TIFFSetField(out, TIFFTAG_IMAGEWIDTH, width);\n  TIFFSetField(out, TIFFTAG_IMAGELENGTH, length);\n\n  CopyField(TIFFTAG_BITSPERSAMPLE, bps);\n  CopyField(TIFFTAG_SAMPLESPERPIXEL, spp);\n\n  TIFFGetField(in, TIFFTAG_COMPRESSION, &input_compression);\n  if (compression != (uint16)-1)\n    TIFFSetField(out, TIFFTAG_COMPRESSION, compression);\n  else\n    {\n    if (input_compression == COMPRESSION_OJPEG)\n      {\n      TIFFSetField(out, TIFFTAG_COMPRESSION, COMPRESSION_JPEG);\n      compression = COMPRESSION_JPEG;\n      }\n    else\n      CopyField(TIFFTAG_COMPRESSION, compression);\n    }\n\n  TIFFGetField(in, TIFFTAG_JPEGCOLORMODE, &input_jpeg_colormode);\n#ifdef DEBUG2\n  TIFFError(\"writeCroppedImage\", \"Input compression: %s\",\n\t    (input_compression == COMPRESSION_OJPEG) ? \"Old Jpeg\" :\n\t    ((input_compression == COMPRESSION_JPEG) ?  \"New Jpeg\" : \"Non Jpeg\"));\n#endif\n  if (compression == COMPRESSION_JPEG)\n    {\n    if ((input_photometric == PHOTOMETRIC_PALETTE) ||  /* color map indexed */\n        (input_photometric == PHOTOMETRIC_MASK))       /* $holdout mask */\n      {\n      TIFFError (\"writeCroppedImage\",\n                 \"JPEG compression cannot be used with %s image data\",\n      \t        (input_photometric == PHOTOMETRIC_PALETTE) ?\n                 \"palette\" : \"mask\");\n      return (-1);\n      }\n    if (input_photometric == PHOTOMETRIC_RGB)\n      {\n      if (jpegcolormode == JPEGCOLORMODE_RGB)\n\tTIFFSetField(out, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_YCBCR);\n      else\n        TIFFSetField(out, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB);\n      } \n    else\n      TIFFSetField(out, TIFFTAG_PHOTOMETRIC, input_photometric);\n    }\n  else\n    {\n    if (compression == COMPRESSION_SGILOG || compression == COMPRESSION_SGILOG24)\n      {\n      TIFFSetField(out, TIFFTAG_PHOTOMETRIC, spp == 1 ?\n\t\t\tPHOTOMETRIC_LOGL : PHOTOMETRIC_LOGLUV);\n      }\n    else\n      {\n      if (input_compression == COMPRESSION_SGILOG ||\n          input_compression == COMPRESSION_SGILOG24)\n        {\n        TIFFSetField(out, TIFFTAG_PHOTOMETRIC, spp == 1 ?\n\t\t\t  PHOTOMETRIC_LOGL : PHOTOMETRIC_LOGLUV);\n        }\n      else\n        TIFFSetField(out, TIFFTAG_PHOTOMETRIC, image->photometric);\n      }\n    }\n\n  if (((input_photometric == PHOTOMETRIC_LOGL) ||\n       (input_photometric ==  PHOTOMETRIC_LOGLUV)) &&\n      ((compression != COMPRESSION_SGILOG) && \n       (compression != COMPRESSION_SGILOG24)))\n    {\n    TIFFError(\"writeCroppedImage\",\n              \"LogL and LogLuv source data require SGI_LOG or SGI_LOG24 compression\");\n    return (-1);\n    }\n\n  if (fillorder != 0)\n    TIFFSetField(out, TIFFTAG_FILLORDER, fillorder);\n  else\n    CopyTag(TIFFTAG_FILLORDER, 1, TIFF_SHORT);\n\n  /* The loadimage function reads input orientation and sets\n   * image->orientation. The correct_image_orientation function\n   * applies the required rotation and mirror operations to \n   * present the data in TOPLEFT orientation and updates \n   * image->orientation if any transforms are performed, \n   * as per EXIF standard. \n   */\n  TIFFSetField(out, TIFFTAG_ORIENTATION, image->orientation);\n\t\n  /*\n   * Choose tiles/strip for the output image according to\n   * the command line arguments (-tiles, -strips) and the\n   * structure of the input image.\n   */\n  if (outtiled == -1)\n    outtiled = TIFFIsTiled(in);\n  if (outtiled) {\n    /*\n     * Setup output file's tile width&height.  If either\n     * is not specified, use either the value from the\n     * input image or, if nothing is defined, use the\n     * library default.\n     */\n    if (tilewidth == (uint32) 0)\n      TIFFGetField(in, TIFFTAG_TILEWIDTH, &tilewidth);\n    if (tilelength == (uint32) 0)\n      TIFFGetField(in, TIFFTAG_TILELENGTH, &tilelength);\n\n    if (tilewidth == 0 || tilelength == 0)\n      TIFFDefaultTileSize(out, &tilewidth, &tilelength);\n    TIFFSetField(out, TIFFTAG_TILEWIDTH, tilewidth);\n    TIFFSetField(out, TIFFTAG_TILELENGTH, tilelength);\n    } else {\n       /*\n\t* RowsPerStrip is left unspecified: use either the\n\t* value from the input image or, if nothing is defined,\n\t* use the library default.\n\t*/\n\tif (rowsperstrip == (uint32) 0)\n          {\n\t  if (!TIFFGetField(in, TIFFTAG_ROWSPERSTRIP, &rowsperstrip))\n\t    rowsperstrip = TIFFDefaultStripSize(out, rowsperstrip);\n          if (compression != COMPRESSION_JPEG)\n            {\n  \t    if (rowsperstrip > length)\n\t      rowsperstrip = length;\n\t    }\n\t  }\n\telse \n          if (rowsperstrip == (uint32) -1)\n\t    rowsperstrip = length;\n\tTIFFSetField(out, TIFFTAG_ROWSPERSTRIP, rowsperstrip);\n\t}\n\n  TIFFGetFieldDefaulted(in, TIFFTAG_PLANARCONFIG, &input_planar);\n  if (config != (uint16) -1)\n    TIFFSetField(out, TIFFTAG_PLANARCONFIG, config);\n  else\n    CopyField(TIFFTAG_PLANARCONFIG, config);\n  if (spp <= 4)\n    CopyTag(TIFFTAG_TRANSFERFUNCTION, 4, TIFF_SHORT);\n  CopyTag(TIFFTAG_COLORMAP, 4, TIFF_SHORT);\n\n/* SMinSampleValue & SMaxSampleValue */\n  switch (compression) {\n    case COMPRESSION_JPEG:\n         if (((bps % 8) == 0) || ((bps % 12) == 0))\n\t   {\n           TIFFSetField(out, TIFFTAG_JPEGQUALITY, quality);\n\t   TIFFSetField(out, TIFFTAG_JPEGCOLORMODE, JPEGCOLORMODE_RGB);\n           }\n         else\n           {\n\t   TIFFError(\"writeCroppedImage\",\n                     \"JPEG compression requires 8 or 12 bits per sample\");\n           return (-1);\n           }\n\t break;\n   case COMPRESSION_LZW:\n   case COMPRESSION_ADOBE_DEFLATE:\n   case COMPRESSION_DEFLATE:\n\tif (predictor != (uint16)-1)\n          TIFFSetField(out, TIFFTAG_PREDICTOR, predictor);\n\telse\n\t  CopyField(TIFFTAG_PREDICTOR, predictor);\n\tbreak;\n   case COMPRESSION_CCITTFAX3:\n   case COMPRESSION_CCITTFAX4:\n        if (bps != 1)\n          {\n\t  TIFFError(\"writeCroppedImage\",\n            \"Group 3/4 compression is not usable with bps > 1\");\n          return (-1);\n\t  }\n\tif (compression == COMPRESSION_CCITTFAX3) {\n          if (g3opts != (uint32) -1)\n\t    TIFFSetField(out, TIFFTAG_GROUP3OPTIONS, g3opts);\n\t  else\n\t    CopyField(TIFFTAG_GROUP3OPTIONS, g3opts);\n\t} else\n\t    CopyTag(TIFFTAG_GROUP4OPTIONS, 1, TIFF_LONG);\n\t    CopyTag(TIFFTAG_BADFAXLINES, 1, TIFF_LONG);\n\t    CopyTag(TIFFTAG_CLEANFAXDATA, 1, TIFF_LONG);\n\t    CopyTag(TIFFTAG_CONSECUTIVEBADFAXLINES, 1, TIFF_LONG);\n\t    CopyTag(TIFFTAG_FAXRECVPARAMS, 1, TIFF_LONG);\n\t    CopyTag(TIFFTAG_FAXRECVTIME, 1, TIFF_LONG);\n\t    CopyTag(TIFFTAG_FAXSUBADDRESS, 1, TIFF_ASCII);\n\t break;\n    case COMPRESSION_NONE:\n         break;\n    default: break;\n   }\n   { uint32 len32;\n     void** data;\n     if (TIFFGetField(in, TIFFTAG_ICCPROFILE, &len32, &data))\n       TIFFSetField(out, TIFFTAG_ICCPROFILE, len32, data);\n   }\n   { uint16 ninks;\n     const char* inknames;\n     if (TIFFGetField(in, TIFFTAG_NUMBEROFINKS, &ninks)) {\n       TIFFSetField(out, TIFFTAG_NUMBEROFINKS, ninks);\n       if (TIFFGetField(in, TIFFTAG_INKNAMES, &inknames)) {\n\t int inknameslen = strlen(inknames) + 1;\n\t const char* cp = inknames;\n\t while (ninks > 1) {\n\t   cp = strchr(cp, '\\0');\n\t   if (cp) {\n\t     cp++;\n\t     inknameslen += (strlen(cp) + 1);\n\t   }\n\t   ninks--;\n         }\n\t TIFFSetField(out, TIFFTAG_INKNAMES, inknameslen, inknames);\n       }\n     }\n   }\n   {\n   unsigned short pg0, pg1;\n   if (TIFFGetField(in, TIFFTAG_PAGENUMBER, &pg0, &pg1)) {\n     TIFFSetField(out, TIFFTAG_PAGENUMBER, pagenum, total_pages);\n     }\n   }\n\n  for (p = tags; p < &tags[NTAGS]; p++)\n\t\tCopyTag(p->tag, p->count, p->type);\n\n  /* Compute the tile or strip dimensions and write to disk */\n  if (outtiled)\n    {\n    if (config == PLANARCONFIG_CONTIG)\n      {\n      if (writeBufferToContigTiles (out, crop_buff, length, width, spp, dump))\n        TIFFError(\"\",\"Unable to write contiguous tile data for page %d\", pagenum);\n      }\n    else\n      {\n      if (writeBufferToSeparateTiles (out, crop_buff, length, width, spp, dump))\n        TIFFError(\"\",\"Unable to write separate tile data for page %d\", pagenum);\n      }\n    }\n  else\n    {\n    if (config == PLANARCONFIG_CONTIG)\n      {\n      if (writeBufferToContigStrips (out, crop_buff, length))\n        TIFFError(\"\",\"Unable to write contiguous strip data for page %d\", pagenum);\n      }\n    else\n      {\n      if (writeBufferToSeparateStrips(out, crop_buff, length, width, spp, dump))\n        TIFFError(\"\",\"Unable to write separate strip data for page %d\", pagenum);\n      }\n    }\n\n  if (!TIFFWriteDirectory(out))\n    {\n    TIFFError(\"\",\"Failed to write IFD for page number %d\", pagenum);\n    TIFFClose(out);\n    return (-1);\n    }\n\n  return (0);\n  } /* end writeCroppedImage */\n\nstatic int\nrotateContigSamples8bits(uint16 rotation, uint16 spp, uint16 bps, uint32 width, \n                         uint32 length,   uint32 col, uint8 *src, uint8 *dst)\n  {\n  int      ready_bits = 0;\n  uint32   src_byte = 0, src_bit = 0;\n  uint32   row, rowsize = 0, bit_offset = 0;\n  uint8    matchbits = 0, maskbits = 0;\n  uint8    buff1 = 0, buff2 = 0;\n  uint8   *next;\n  tsample_t sample;\n\n  if ((src == NULL) || (dst == NULL))\n    {\n    TIFFError(\"rotateContigSamples8bits\",\"Invalid src or destination buffer\");\n    return (1);\n    }\n\n  rowsize = ((bps * spp * width) + 7) / 8;\n  ready_bits = 0;\n  maskbits =  (uint8)-1 >> ( 8 - bps);\n  buff1 = buff2 = 0;\n\n  for (row = 0; row < length ; row++)\n    {\n    bit_offset = col * bps * spp;\n    for (sample = 0; sample < spp; sample++)\n      {\n      if (sample == 0)\n        {\n        src_byte = bit_offset / 8;\n        src_bit  = bit_offset % 8;\n        }\n      else\n        {\n        src_byte = (bit_offset + (sample * bps)) / 8;\n        src_bit  = (bit_offset + (sample * bps)) % 8;\n        }\n\n      switch (rotation)\n\t{\n        case  90: next = src + src_byte - (row * rowsize);\n                  break;\n        case 270: next = src + src_byte + (row * rowsize);\n\t          break;\n\tdefault:  TIFFError(\"rotateContigSamples8bits\", \"Invalid rotation %d\", rotation);\n                  return (1);\n        }\n      matchbits = maskbits << (8 - src_bit - bps); \n      buff1 = ((*next) & matchbits) << (src_bit);\n\n       /* If we have a full buffer's worth, write it out */\n      if (ready_bits >= 8)\n        {\n        *dst++ = buff2;\n        buff2 = buff1;\n        ready_bits -= 8;\n        }\n      else\n        {\n        buff2 = (buff2 | (buff1 >> ready_bits));\n        }\n      ready_bits += bps;\n      }\n    }\n\n  if (ready_bits > 0)\n    {\n    buff1 = (buff2 & ((unsigned int)255 << (8 - ready_bits)));\n    *dst++ = buff1;\n    }\n\n  return (0);\n  }  /* end rotateContigSamples8bits */\n\n\nstatic int\nrotateContigSamples16bits(uint16 rotation, uint16 spp, uint16 bps, uint32 width, \n                         uint32 length,   uint32 col, uint8 *src, uint8 *dst)\n  {\n  int      ready_bits = 0;\n  uint32   row, rowsize, bit_offset;\n  uint32   src_byte = 0, src_bit = 0;\n  uint16   matchbits = 0, maskbits = 0;\n  uint16   buff1 = 0, buff2 = 0;\n  uint8    bytebuff = 0;\n  uint8   *next;\n  tsample_t sample;\n\n  if ((src == NULL) || (dst == NULL))\n    {\n    TIFFError(\"rotateContigSamples16bits\",\"Invalid src or destination buffer\");\n    return (1);\n    }\n\n  rowsize = ((bps * spp * width) + 7) / 8;\n  ready_bits = 0;\n  maskbits =  (uint16)-1 >> (16 - bps);\n  buff1 = buff2 = 0;\n  for (row = 0; row < length; row++)\n    {\n    bit_offset = col * bps * spp;\n    for (sample = 0; sample < spp; sample++)\n      {\n      if (sample == 0)\n        {\n        src_byte = bit_offset / 8;\n        src_bit  = bit_offset % 8;\n        }\n      else\n        {\n        src_byte = (bit_offset + (sample * bps)) / 8;\n        src_bit  = (bit_offset + (sample * bps)) % 8;\n        }\n\n      switch (rotation)\n\t{\n        case  90: next = src + src_byte - (row * rowsize);\n                  break;\n        case 270: next = src + src_byte + (row * rowsize);\n\t          break;\n\tdefault:  TIFFError(\"rotateContigSamples8bits\", \"Invalid rotation %d\", rotation);\n                  return (1);\n        }\n      matchbits = maskbits << (16 - src_bit - bps); \n      if (little_endian)\n        buff1 = (next[0] << 8) | next[1];\n      else\n        buff1 = (next[1] << 8) | next[0];\n\n      buff1 = (buff1 & matchbits) << (src_bit);\n\n      /* If we have a full buffer's worth, write it out */\n      if (ready_bits >= 8)\n        {\n        bytebuff = (buff2 >> 8);\n        *dst++ = bytebuff;\n        ready_bits -= 8;\n        /* shift in new bits */\n        buff2 = ((buff2 << 8) | (buff1 >> ready_bits));\n        }\n      else\n        { /* add another bps bits to the buffer */\n        bytebuff = 0;\n        buff2 = (buff2 | (buff1 >> ready_bits));\n        }\n      ready_bits += bps;\n      }\n    }\n\n  if (ready_bits > 0)\n    {\n    bytebuff = (buff2 >> 8);\n    *dst++ = bytebuff;\n    }\n\n  return (0);\n  }  /* end rotateContigSamples16bits */\n\nstatic int\nrotateContigSamples24bits(uint16 rotation, uint16 spp, uint16 bps, uint32 width, \n                          uint32 length,   uint32 col, uint8 *src, uint8 *dst)\n  {\n  int      ready_bits = 0;\n  uint32   row, rowsize, bit_offset;\n  uint32   src_byte = 0, src_bit = 0;\n  uint32   matchbits = 0, maskbits = 0;\n  uint32   buff1 = 0, buff2 = 0;\n  uint8    bytebuff1 = 0, bytebuff2 = 0;\n  uint8   *next;\n  tsample_t sample;\n\n\n  if ((src == NULL) || (dst == NULL))\n    {\n    TIFFError(\"rotateContigSamples24bits\",\"Invalid src or destination buffer\");\n    return (1);\n    }\n\n  rowsize = ((bps * spp * width) + 7) / 8;\n  ready_bits = 0;\n  maskbits =  (uint32)-1 >> (32 - bps);\n  buff1 = buff2 = 0;\n  for (row = 0; row < length; row++)\n    {\n    bit_offset = col * bps * spp;\n    for (sample = 0; sample < spp; sample++)\n      {\n      if (sample == 0)\n        {\n        src_byte = bit_offset / 8;\n        src_bit  = bit_offset % 8;\n        }\n      else\n        {\n        src_byte = (bit_offset + (sample * bps)) / 8;\n        src_bit  = (bit_offset + (sample * bps)) % 8;\n        }\n\n      switch (rotation)\n\t{\n        case  90: next = src + src_byte - (row * rowsize);\n                  break;\n        case 270: next = src + src_byte + (row * rowsize);\n\t          break;\n\tdefault:  TIFFError(\"rotateContigSamples8bits\", \"Invalid rotation %d\", rotation);\n                  return (1);\n        }\n      matchbits = maskbits << (32 - src_bit - bps); \n      if (little_endian)\n\tbuff1 = (next[0] << 24) | (next[1] << 16) | (next[2] << 8) | next[3];\n      else\n\tbuff1 = (next[3] << 24) | (next[2] << 16) | (next[1] << 8) | next[0];\n      buff1 = (buff1 & matchbits) << (src_bit);\n\n      /* If we have a full buffer's worth, write it out */\n      if (ready_bits >= 16)\n        {\n        bytebuff1 = (buff2 >> 24);\n        *dst++ = bytebuff1;\n        bytebuff2 = (buff2 >> 16);\n        *dst++ = bytebuff2;\n        ready_bits -= 16;\n\n        /* shift in new bits */\n        buff2 = ((buff2 << 16) | (buff1 >> ready_bits));\n        }\n      else\n        { /* add another bps bits to the buffer */\n        bytebuff1 = bytebuff2 = 0;\n        buff2 = (buff2 | (buff1 >> ready_bits));\n        }\n      ready_bits += bps;\n      }\n    }\n\n /* catch any trailing bits at the end of the line */\n  while (ready_bits > 0)\n    {\n    bytebuff1 = (buff2 >> 24);\n    *dst++ = bytebuff1;\n\n    buff2 = (buff2 << 8);\n    bytebuff2 = bytebuff1;\n    ready_bits -= 8;\n    }\n \n  return (0);\n  }  /* end rotateContigSamples24bits */\n\nstatic int\nrotateContigSamples32bits(uint16 rotation, uint16 spp, uint16 bps, uint32 width, \n                          uint32 length,   uint32 col, uint8 *src, uint8 *dst)\n  {\n  int    ready_bits = 0, shift_width = 0;\n  int    bytes_per_sample, bytes_per_pixel;\n  uint32 row, rowsize, bit_offset;\n  uint32 src_byte, src_bit;\n  uint32 longbuff1 = 0, longbuff2 = 0;\n  uint64 maskbits = 0, matchbits = 0;\n  uint64 buff1 = 0, buff2 = 0, buff3 = 0;\n  uint8  bytebuff1 = 0, bytebuff2 = 0, bytebuff3 = 0, bytebuff4 = 0;\n  uint8   *next;\n  tsample_t sample;\n\n\n  if ((src == NULL) || (dst == NULL))\n    {\n    TIFFError(\"rotateContigSamples24bits\",\"Invalid src or destination buffer\");\n    return (1);\n    }\n\n  bytes_per_sample = (bps + 7) / 8;\n  bytes_per_pixel  = ((bps * spp) + 7) / 8;\n  if (bytes_per_pixel < (bytes_per_sample + 1))\n    shift_width = bytes_per_pixel;\n  else\n    shift_width = bytes_per_sample + 1;\n\n  rowsize = ((bps * spp * width) + 7) / 8;\n  ready_bits = 0;\n  maskbits =  (uint64)-1 >> (64 - bps);\n  buff1 = buff2 = 0;\n  for (row = 0; row < length; row++)\n    {\n    bit_offset = col * bps * spp;\n    for (sample = 0; sample < spp; sample++)\n      {\n      if (sample == 0)\n        {\n        src_byte = bit_offset / 8;\n        src_bit  = bit_offset % 8;\n        }\n      else\n        {\n        src_byte = (bit_offset + (sample * bps)) / 8;\n        src_bit  = (bit_offset + (sample * bps)) % 8;\n        }\n\n      switch (rotation)\n\t{\n        case  90: next = src + src_byte - (row * rowsize);\n                  break;\n        case 270: next = src + src_byte + (row * rowsize);\n\t          break;\n\tdefault:  TIFFError(\"rotateContigSamples8bits\", \"Invalid rotation %d\", rotation);\n                  return (1);\n        }\n      matchbits = maskbits << (64 - src_bit - bps); \n      if (little_endian)\n        {\n\tlongbuff1 = (next[0] << 24) | (next[1] << 16) | (next[2] << 8) | next[3];\n        longbuff2 = longbuff1;\n        }\n      else\n        {\n\tlongbuff1 = (next[3] << 24) | (next[2] << 16) | (next[1] << 8) | next[0];\n        longbuff2 = longbuff1;\n\t}\n\n      buff3 = ((uint64)longbuff1 << 32) | longbuff2;\n      buff1 = (buff3 & matchbits) << (src_bit);\n\n      if (ready_bits < 32)\n        { /* add another bps bits to the buffer */\n        bytebuff1 = bytebuff2 = bytebuff3 = bytebuff4 = 0;\n        buff2 = (buff2 | (buff1 >> ready_bits));\n        }\n      else /* If we have a full buffer's worth, write it out */\n        {\n        bytebuff1 = (buff2 >> 56);\n        *dst++ = bytebuff1;\n        bytebuff2 = (buff2 >> 48);\n        *dst++ = bytebuff2;\n        bytebuff3 = (buff2 >> 40);\n        *dst++ = bytebuff3;\n        bytebuff4 = (buff2 >> 32);\n        *dst++ = bytebuff4;\n        ready_bits -= 32;\n                    \n        /* shift in new bits */\n        buff2 = ((buff2 << 32) | (buff1 >> ready_bits));\n        }\n      ready_bits += bps;\n      }\n    }\n  while (ready_bits > 0)\n    {\n    bytebuff1 = (buff2 >> 56);\n    *dst++ = bytebuff1;\n    buff2 = (buff2 << 8);\n    ready_bits -= 8;\n    }\n\n  return (0);\n  } /* end rotateContigSamples32bits */\n\n\n/* Rotate an image by a multiple of 90 degrees clockwise */\nstatic int\nrotateImage(uint16 rotation, struct image_data *image, uint32 *img_width, \n            uint32 *img_length, unsigned char **ibuff_ptr)\n  {\n  int      shift_width;\n  uint32   bytes_per_pixel, bytes_per_sample;\n  uint32   row, rowsize, src_offset, dst_offset;\n  uint32   i, col, width, length;\n  uint32   colsize, buffsize, col_offset, pix_offset;\n  unsigned char *ibuff;\n  unsigned char *src;\n  unsigned char *dst;\n  uint16   spp, bps;\n  float    res_temp;\n  unsigned char *rbuff = NULL;\n\n  width  = *img_width;\n  length = *img_length;\n  spp = image->spp;\n  bps = image->bps;\n\n  rowsize = ((bps * spp * width) + 7) / 8;\n  colsize = ((bps * spp * length) + 7) / 8;\n  if ((colsize * width) > (rowsize * length))\n    buffsize = (colsize + 1) * width;\n  else\n    buffsize = (rowsize + 1) * length;\n\n  bytes_per_sample = (bps + 7) / 8;\n  bytes_per_pixel  = ((bps * spp) + 7) / 8;\n  if (bytes_per_pixel < (bytes_per_sample + 1))\n    shift_width = bytes_per_pixel;\n  else\n    shift_width = bytes_per_sample + 1;\n\n  switch (rotation)\n    {\n    case 0:\n    case 360: return (0);\n    case 90:\n    case 180:\n    case 270: break;\n    default:  TIFFError(\"rotateImage\", \"Invalid rotation angle %d\", rotation);\n              return (-1);\n    }\n\n  if (!(rbuff = (unsigned char *)_TIFFmalloc(buffsize)))\n    {\n    TIFFError(\"rotateImage\", \"Unable to allocate rotation buffer of %1u bytes\", buffsize);\n    return (-1);\n    }\n  _TIFFmemset(rbuff, '\\0', buffsize);\n\n  ibuff = *ibuff_ptr;\n  switch (rotation)\n    {\n    case 180: if ((bps % 8) == 0) /* byte alligned data */\n                { \n                src = ibuff;\n                pix_offset = (spp * bps) / 8;\n                for (row = 0; row < length; row++)\n                   {\n\t\t   dst_offset = (length - row - 1) * rowsize;\n                   for (col = 0; col < width; col++)\n                     { \n\t\t     col_offset = (width - col - 1) * pix_offset;\n                     dst = rbuff + dst_offset + col_offset;\n\n\t\t     for (i = 0; i  < bytes_per_pixel; i++)\n\t\t       *dst++ = *src++;\n                     }\n                   }\n                }\n\t      else\n                { /* non 8 bit per sample data */ \n                for (row = 0; row < length; row++)\n                  {\n\t\t  src_offset = row * rowsize;\n\t\t  dst_offset = (length - row - 1) * rowsize;\n\t\t  src = ibuff + src_offset;\n                  dst = rbuff + dst_offset;\n                  switch (shift_width)\n                    {\n                    case 1: if (bps == 1)\n\t\t\t      {\n                              if (reverseSamples8bits(spp, bps, width, src, dst))\n                                {\n\t\t                _TIFFfree(rbuff);\n                                return (-1);\n                                }\n                              break;\n                              }\n                            if (reverseSamples16bits(spp, bps, width, src, dst))\n                              {\n\t\t              _TIFFfree(rbuff);\n                              return (-1);\n                              }\n                             break;\n                    case 2: if (reverseSamples24bits(spp, bps, width, src, dst))\n                              {\n\t\t              _TIFFfree(rbuff);\n                              return (-1);\n                              }\n                             break;\n                    case 3: \n                    case 4: \n                    case 5: if (reverseSamples32bits(spp, bps, width, src, dst))\n                              {\n\t\t              _TIFFfree(rbuff);\n                              return (-1);\n                              }\n                             break;\n                    default: TIFFError(\"rotateImage\",\"Unsupported bit depth %d\", bps);\n\t\t             _TIFFfree(rbuff);\n                             return (-1);      \n                    }\n\t\t  }\n\t\t}\n              _TIFFfree(ibuff);\n              *(ibuff_ptr) = rbuff;\n              break;\n\n    case 90:  if ((bps % 8) == 0) /* byte aligned data */\n                {\n                for (col = 0; col < width; col++)\n                  {\n\t\t  src_offset = ((length - 1) * rowsize) + (col * bytes_per_pixel);\n                  dst_offset = col * colsize;\n\t\t  src = ibuff + src_offset;\n\t\t  dst = rbuff + dst_offset;\n                  for (row = length; row > 0; row--)\n                    {\n                    for (i = 0; i < bytes_per_pixel; i++)\n                      *dst++ = *(src + i);\n\t\t    src -= rowsize;\n                    }\n\t\t  }\n\t\t}\n              else\n                { /* non 8 bit per sample data */ \n                for (col = 0; col < width; col++)\n                  {\n\t\t  src_offset = (length - 1) * rowsize;\n                  dst_offset = col * colsize;\n\t\t  src = ibuff + src_offset;\n\t\t  dst = rbuff + dst_offset;\n                  switch (shift_width)\n                    {\n                    case 1: if (bps == 1)\n\t\t\t      {\n                              if (rotateContigSamples8bits(rotation, spp, bps, width, \n\t\t\t\t   \t                 length, col, src, dst))\n                                {\n\t\t                _TIFFfree(rbuff);\n                                return (-1);\n                                }\n                              break;\n                              }\n                            if (rotateContigSamples16bits(rotation, spp, bps, width, \n\t\t\t\t   \t                 length, col, src, dst))\n                              {\n\t                      _TIFFfree(rbuff);\n                              return (-1);\n\t\t              }\n\t\t            break;\n                    case 2: if (rotateContigSamples24bits(rotation, spp, bps, width, \n\t\t\t\t\t                  length, col, src, dst))\n                              {\n\t\t              _TIFFfree(rbuff);\n                              return (-1);\n                              }\n                             break;\n                    case 3: \n                    case 4: \n                    case 5: if (rotateContigSamples32bits(rotation, spp, bps, width, \n\t\t\t\t\t                  length, col, src, dst))\n                              {\n\t\t              _TIFFfree(rbuff);\n                              return (-1);\n                              }\n                             break;\n                    default: TIFFError(\"rotateImage\",\"Unsupported bit depth %d\", bps);\n\t\t             _TIFFfree(rbuff);\n                             return (-1);      \n\t\t    }\n\t\t  }\n\t\t}\n              _TIFFfree(ibuff);\n              *(ibuff_ptr) = rbuff;\n\n              *img_width = length;\n              *img_length = width;\n              image->width = length;\n              image->length = width;\n              res_temp = image->xres;\n              image->xres = image->yres;\n              image->yres = res_temp;\n\t      break;\n\n    case 270: if ((bps % 8) == 0) /* byte aligned data */\n                {\n                for (col = 0; col < width; col++)\n                  {\n\t\t  src_offset = col * bytes_per_pixel;\n                  dst_offset = (width - col - 1) * colsize;\n\t\t  src = ibuff + src_offset;\n\t\t  dst = rbuff + dst_offset;\n                  for (row = length; row > 0; row--)\n                    {\n                    for (i = 0; i < bytes_per_pixel; i++)\n                      *dst++ = *(src + i);\n\t\t    src += rowsize;\n                    }\n\t\t  }\n\t\t}\n              else\n                { /* non 8 bit per sample data */ \n                for (col = 0; col < width; col++)\n                  {\n\t\t  src_offset = 0;\n                  dst_offset = (width - col - 1) * colsize;\n\t\t  src = ibuff + src_offset;\n\t\t  dst = rbuff + dst_offset;\n                  switch (shift_width)\n                    {\n                    case 1: if (bps == 1)\n\t\t\t      {\n                              if (rotateContigSamples8bits(rotation, spp, bps, width, \n\t\t\t\t   \t                 length, col, src, dst))\n                                {\n\t\t                _TIFFfree(rbuff);\n                                return (-1);\n                                }\n                              break;\n                              }\n                            if (rotateContigSamples16bits(rotation, spp, bps, width, \n\t\t\t\t   \t                 length, col, src, dst))\n                              {\n\t                      _TIFFfree(rbuff);\n                              return (-1);\n\t\t              }\n\t\t            break;\n                    case 2: if (rotateContigSamples24bits(rotation, spp, bps, width, \n\t\t\t\t\t                  length, col, src, dst))\n                              {\n\t\t              _TIFFfree(rbuff);\n                              return (-1);\n                              }\n                             break;\n                    case 3: \n                    case 4: \n                    case 5: if (rotateContigSamples32bits(rotation, spp, bps, width, \n\t\t\t\t\t                  length, col, src, dst))\n                              {\n\t\t              _TIFFfree(rbuff);\n                              return (-1);\n                              }\n                             break;\n                    default: TIFFError(\"rotateImage\",\"Unsupported bit depth %d\", bps);\n\t\t             _TIFFfree(rbuff);\n                             return (-1);      \n\t\t    }\n\t\t  }\n\t\t}\n              _TIFFfree(ibuff);\n              *(ibuff_ptr) = rbuff;\n\n              *img_width = length;\n              *img_length = width;\n              image->width = length;\n              image->length = width;\n              res_temp = image->xres;\n              image->xres = image->yres;\n              image->yres = res_temp;\n              break;\n    default:\n              break;\n    }\n\n  return (0);\n  } /* end rotateImage */\n\nstatic int\nreverseSamples8bits (uint16 spp, uint16 bps, uint32 width, \n                     uint8 *ibuff, uint8 *obuff)\n  {\n  int      ready_bits = 0;\n  uint32   col;\n  uint32   src_byte, src_bit;\n  uint32   bit_offset = 0;\n  uint8    match_bits = 0, mask_bits = 0;\n  uint8    buff1 = 0, buff2 = 0;\n  unsigned char *src;\n  unsigned char *dst;\n  tsample_t sample;\n\n  if ((ibuff == NULL) || (obuff == NULL))\n    {\n    TIFFError(\"reverseSamples8bits\",\"Invalid image or work buffer\");\n    return (1);\n    }\n\n  ready_bits = 0;\n  mask_bits =  (uint8)-1 >> ( 8 - bps);\n  dst = obuff;\n  for (col = width; col > 0; col--)\n    {\n    /* Compute src byte(s) and bits within byte(s) */\n    bit_offset = (col - 1) * bps * spp;\n    for (sample = 0; sample < spp; sample++)\n      {\n      if (sample == 0)\n        {\n        src_byte = bit_offset / 8;\n        src_bit  = bit_offset % 8;\n        }\n      else\n        {\n        src_byte = (bit_offset + (sample * bps)) / 8;\n        src_bit  = (bit_offset + (sample * bps)) % 8;\n        }\n\n      src = ibuff + src_byte;\n      match_bits = mask_bits << (8 - src_bit - bps); \n      buff1 = ((*src) & match_bits) << (src_bit);\n\n      if (ready_bits < 8)\n        buff2 = (buff2 | (buff1 >> ready_bits));\n      else  /* If we have a full buffer's worth, write it out */\n        {\n        *dst++ = buff2;\n        buff2 = buff1;\n        ready_bits -= 8;\n        }\n      ready_bits += bps;\n      }\n    }\n  if (ready_bits > 0)\n    {\n    buff1 = (buff2 & ((unsigned int)255 << (8 - ready_bits)));\n    *dst++ = buff1;\n    }\n\n  return (0);\n  } /* end reverseSamples8bits */\n\n\nstatic int\nreverseSamples16bits (uint16 spp, uint16 bps, uint32 width, \n                      uint8 *ibuff, uint8 *obuff)\n  {\n  int      ready_bits = 0;\n  uint32   col;\n  uint32   src_byte = 0, high_bit = 0;\n  uint32   bit_offset = 0;\n  uint16   match_bits = 0, mask_bits = 0;\n  uint16   buff1 = 0, buff2 = 0;\n  uint8    bytebuff = 0;\n  unsigned char *src;\n  unsigned char *dst;\n  tsample_t sample;\n\n  if ((ibuff == NULL) || (obuff == NULL))\n    {\n    TIFFError(\"reverseSample16bits\",\"Invalid image or work buffer\");\n    return (1);\n    }\n\n  ready_bits = 0;\n  mask_bits =  (uint16)-1 >> (16 - bps);\n  dst = obuff;\n  for (col = width; col > 0; col--)\n    {\n    /* Compute src byte(s) and bits within byte(s) */\n    bit_offset = (col - 1) * bps * spp;\n    for (sample = 0; sample < spp; sample++)\n      {\n      if (sample == 0)\n        {\n        src_byte = bit_offset / 8;\n        high_bit  = bit_offset % 8;\n        }\n      else\n        {\n        src_byte = (bit_offset + (sample * bps)) / 8;\n        high_bit  = (bit_offset + (sample * bps)) % 8;\n        }\n\n      src = ibuff + src_byte;\n      match_bits = mask_bits << (16 - high_bit - bps); \n      if (little_endian)\n        buff1 = (src[0] << 8) | src[1];\n      else\n        buff1 = (src[1] << 8) | src[0];\n      buff1 = (buff1 & match_bits) << (high_bit);\n      \n      if (ready_bits < 8)\n        { /* add another bps bits to the buffer */\n        bytebuff = 0;\n        buff2 = (buff2 | (buff1 >> ready_bits));\n        }\n      else /* If we have a full buffer's worth, write it out */\n        {\n        bytebuff = (buff2 >> 8);\n        *dst++ = bytebuff;\n        ready_bits -= 8;\n        /* shift in new bits */\n        buff2 = ((buff2 << 8) | (buff1 >> ready_bits));\n        }\n      ready_bits += bps;\n      }\n    }\n\n  if (ready_bits > 0)\n    {\n    bytebuff = (buff2 >> 8);\n    *dst++ = bytebuff;\n    }\n\n  return (0);\n  } /* end reverseSamples16bits */\n\nstatic int\nreverseSamples24bits (uint16 spp, uint16 bps, uint32 width, \n                      uint8 *ibuff, uint8 *obuff)\n  {\n  int      ready_bits = 0;\n  uint32   col;\n  uint32   src_byte = 0, high_bit = 0;\n  uint32   bit_offset = 0;\n  uint32   match_bits = 0, mask_bits = 0;\n  uint32   buff1 = 0, buff2 = 0;\n  uint8    bytebuff1 = 0, bytebuff2 = 0;\n  unsigned char *src;\n  unsigned char *dst;\n  tsample_t sample;\n\n  if ((ibuff == NULL) || (obuff == NULL))\n    {\n    TIFFError(\"reverseSamples24bits\",\"Invalid image or work buffer\");\n    return (1);\n    }\n\n  ready_bits = 0;\n  mask_bits =  (uint32)-1 >> (32 - bps);\n  dst = obuff;\n  for (col = width; col > 0; col--)\n    {\n    /* Compute src byte(s) and bits within byte(s) */\n    bit_offset = (col - 1) * bps * spp;\n    for (sample = 0; sample < spp; sample++)\n      {\n      if (sample == 0)\n        {\n        src_byte = bit_offset / 8;\n        high_bit  = bit_offset % 8;\n        }\n      else\n        {\n        src_byte = (bit_offset + (sample * bps)) / 8;\n        high_bit  = (bit_offset + (sample * bps)) % 8;\n        }\n\n      src = ibuff + src_byte;\n      match_bits = mask_bits << (32 - high_bit - bps); \n      if (little_endian)\n\tbuff1 = (src[0] << 24) | (src[1] << 16) | (src[2] << 8) | src[3];\n      else\n\tbuff1 = (src[3] << 24) | (src[2] << 16) | (src[1] << 8) | src[0];\n      buff1 = (buff1 & match_bits) << (high_bit);\n\n      if (ready_bits < 16)\n        { /* add another bps bits to the buffer */\n        bytebuff1 = bytebuff2 = 0;\n        buff2 = (buff2 | (buff1 >> ready_bits));\n        }\n      else /* If we have a full buffer's worth, write it out */\n        {\n        bytebuff1 = (buff2 >> 24);\n        *dst++ = bytebuff1;\n        bytebuff2 = (buff2 >> 16);\n        *dst++ = bytebuff2;\n        ready_bits -= 16;\n\n        /* shift in new bits */\n        buff2 = ((buff2 << 16) | (buff1 >> ready_bits));\n        }\n      ready_bits += bps;\n      }\n    }\n\n /* catch any trailing bits at the end of the line */\n  while (ready_bits > 0)\n    {\n    bytebuff1 = (buff2 >> 24);\n    *dst++ = bytebuff1;\n\n    buff2 = (buff2 << 8);\n    bytebuff2 = bytebuff1;\n    ready_bits -= 8;\n    }\n \n  return (0);\n  } /* end reverseSamples24bits */\n\n\nstatic int\nreverseSamples32bits (uint16 spp, uint16 bps, uint32 width, \n                      uint8 *ibuff, uint8 *obuff)\n  {\n  int    ready_bits = 0, shift_width = 0;\n  int    bytes_per_sample, bytes_per_pixel;\n  uint32 bit_offset;\n  uint32 src_byte = 0, high_bit = 0;\n  uint32 col;\n  uint32 longbuff1 = 0, longbuff2 = 0;\n  uint64 mask_bits = 0, match_bits = 0;\n  uint64 buff1 = 0, buff2 = 0, buff3 = 0;\n  uint8  bytebuff1 = 0, bytebuff2 = 0, bytebuff3 = 0, bytebuff4 = 0;\n  unsigned char *src;\n  unsigned char *dst;\n  tsample_t sample;\n\n  if ((ibuff == NULL) || (obuff == NULL))\n    {\n    TIFFError(\"reverseSamples32bits\",\"Invalid image or work buffer\");\n    return (1);\n    }\n\n  ready_bits = 0;\n  mask_bits =  (uint64)-1 >> (64 - bps);\n  dst = obuff;\n\n  bytes_per_sample = (bps + 7) / 8;\n  bytes_per_pixel  = ((bps * spp) + 7) / 8;\n  if (bytes_per_pixel < (bytes_per_sample + 1))\n    shift_width = bytes_per_pixel;\n  else\n    shift_width = bytes_per_sample + 1;\n\n  for (col = width; col > 0; col--)\n    {\n    /* Compute src byte(s) and bits within byte(s) */\n    bit_offset = (col - 1) * bps * spp;\n    for (sample = 0; sample < spp; sample++)\n      {\n      if (sample == 0)\n        {\n        src_byte = bit_offset / 8;\n        high_bit  = bit_offset % 8;\n        }\n      else\n        {\n        src_byte = (bit_offset + (sample * bps)) / 8;\n        high_bit  = (bit_offset + (sample * bps)) % 8;\n        }\n\n      src = ibuff + src_byte;\n      match_bits = mask_bits << (64 - high_bit - bps); \n      if (little_endian)\n        {\n\tlongbuff1 = (src[0] << 24) | (src[1] << 16) | (src[2] << 8) | src[3];\n        longbuff2 = longbuff1;\n        }\n      else\n        {\n\tlongbuff1 = (src[3] << 24) | (src[2] << 16) | (src[1] << 8) | src[0];\n        longbuff2 = longbuff1;\n\t}\n      buff3 = ((uint64)longbuff1 << 32) | longbuff2;\n      buff1 = (buff3 & match_bits) << (high_bit);\n\n      if (ready_bits < 32)\n        { /* add another bps bits to the buffer */\n        bytebuff1 = bytebuff2 = bytebuff3 = bytebuff4 = 0;\n        buff2 = (buff2 | (buff1 >> ready_bits));\n        }\n      else /* If we have a full buffer's worth, write it out */\n        {\n        bytebuff1 = (buff2 >> 56);\n        *dst++ = bytebuff1;\n        bytebuff2 = (buff2 >> 48);\n        *dst++ = bytebuff2;\n        bytebuff3 = (buff2 >> 40);\n        *dst++ = bytebuff3;\n        bytebuff4 = (buff2 >> 32);\n        *dst++ = bytebuff4;\n        ready_bits -= 32;\n                    \n        /* shift in new bits */\n        buff2 = ((buff2 << 32) | (buff1 >> ready_bits));\n        }\n      ready_bits += bps;\n      }\n    }\n  while (ready_bits > 0)\n    {\n    bytebuff1 = (buff2 >> 56);\n    *dst++ = bytebuff1;\n    buff2 = (buff2 << 8);\n    ready_bits -= 8;\n    }\n\n  return (0);\n  } /* end reverseSamples32bits */\n\nstatic int\nreverseSamplesBytes (uint16 spp, uint16 bps, uint32 width, \n                     uint8 *src, uint8 *dst)\n  {\n  int i;\n  uint32  col, bytes_per_pixel, col_offset;\n  uint8   bytebuff1;\n  unsigned char swapbuff[32];\n  \n  if ((src == NULL) || (dst == NULL))\n    {\n    TIFFError(\"reverseSamplesBytes\",\"Invalid input or output buffer\");\n    return (1);\n    }\n\n  bytes_per_pixel  = ((bps * spp) + 7) / 8;\n  switch (bps / 8)\n     {\n     case 8:  /* Use memcpy for multiple bytes per sample data */\n     case 4:\n     case 3:\n     case 2: for (col = 0; col < (width / 2); col++)\n               {\n\t       col_offset = col * bytes_per_pixel;                     \n\t       _TIFFmemcpy (swapbuff, src + col_offset, bytes_per_pixel);\n\t       _TIFFmemcpy (src + col_offset, dst - col_offset - bytes_per_pixel, bytes_per_pixel);\n\t       _TIFFmemcpy (dst - col_offset - bytes_per_pixel, swapbuff, bytes_per_pixel);\n               }\n\t     break;\n     case 1: /* Use byte copy only for single byte per sample data */\n             for (col = 0; col < (width / 2); col++)\n               { \n\t       for (i = 0; i < spp; i++)\n                  {\n\t\t  bytebuff1 = *src;\n\t\t  *src++ = *(dst - spp + i);\n                  *(dst - spp + i) = bytebuff1;\n\t\t  }\n\t\tdst -= spp;\n                }\n\t     break;\n     default: TIFFError(\"reverseSamplesBytes\",\"Unsupported bit depth %d\", bps);\n       return (1);\n     }\n  return (0);\n  } /* end reverseSamplesBytes */\n\n\n/* Mirror an image horizontally or vertically */\nstatic int\nmirrorImage(uint16 spp, uint16 bps, uint16 mirror, uint32 width, uint32 length, unsigned char *ibuff)\n  {\n  int      shift_width;\n  uint32   bytes_per_pixel, bytes_per_sample;\n  uint32   row, rowsize, row_offset;\n  unsigned char *line_buff = NULL;\n  unsigned char *src;\n  unsigned char *dst;\n\n  src = ibuff;\n  rowsize = ((width * bps * spp) + 7) / 8;\n  switch (mirror)\n    {\n    case MIRROR_BOTH:\n    case MIRROR_VERT: \n             line_buff = (unsigned char *)_TIFFmalloc(rowsize);\n             if (line_buff == NULL)\n               {\n\t       TIFFError (\"mirrorImage\", \"Unable to allocate mirror line buffer of %1u bytes\", rowsize);\n               return (-1);\n               }\n\n             dst = ibuff + (rowsize * (length - 1));\n             for (row = 0; row < length / 2; row++)\n               {\n\t      _TIFFmemcpy(line_buff, src, rowsize);\n\t      _TIFFmemcpy(src, dst,  rowsize);\n\t      _TIFFmemcpy(dst, line_buff, rowsize);\n               src += (rowsize);\n               dst -= (rowsize);                                 \n               }\n             if (line_buff)\n               _TIFFfree(line_buff);\n             if (mirror == MIRROR_VERT)\n               break;\n    case MIRROR_HORIZ :\n              if ((bps % 8) == 0) /* byte alligned data */\n                { \n                for (row = 0; row < length; row++)\n                  {\n\t\t  row_offset = row * rowsize;\n                  src = ibuff + row_offset;\n                  dst = ibuff + row_offset + rowsize;\n                  if (reverseSamplesBytes(spp, bps, width, src, dst))\n                    {\n\t\t    return (-1);\n                    }\n\t\t  }\n\t\t}\n\t      else\n                { /* non 8 bit per sample  data */\n                if (!(line_buff = (unsigned char *)_TIFFmalloc(rowsize + 1)))\n                  {\n                  TIFFError(\"mirrorImage\", \"Unable to allocate mirror line buffer\");\n                  return (-1);\n                  }\n                bytes_per_sample = (bps + 7) / 8;\n                bytes_per_pixel  = ((bps * spp) + 7) / 8;\n                if (bytes_per_pixel < (bytes_per_sample + 1))\n                  shift_width = bytes_per_pixel;\n                else\n                  shift_width = bytes_per_sample + 1;\n\n                for (row = 0; row < length; row++)\n                  {\n\t\t  row_offset = row * rowsize;\n                  src = ibuff + row_offset;\n                  _TIFFmemset (line_buff, '\\0', rowsize);\n                  switch (shift_width)\n                    {\n                    case 1: if (reverseSamples16bits(spp, bps, width, src, line_buff))\n                              {\n\t\t              _TIFFfree(line_buff);\n                              return (-1);\n                              }\n                             _TIFFmemcpy (src, line_buff, rowsize);\n                             break;\n                    case 2: if (reverseSamples24bits(spp, bps, width, src, line_buff))\n                              {\n\t\t              _TIFFfree(line_buff);\n                              return (-1);\n                              }\n                             _TIFFmemcpy (src, line_buff, rowsize);\n                             break;\n                    case 3: \n                    case 4: \n                    case 5: if (reverseSamples32bits(spp, bps, width, src, line_buff))\n                              {\n\t\t              _TIFFfree(line_buff);\n                              return (-1);\n                              }\n                             _TIFFmemcpy (src, line_buff, rowsize);\n                             break;\n                    default: TIFFError(\"mirrorImage\",\"Unsupported bit depth %d\", bps);\n\t\t             _TIFFfree(line_buff);\n                             return (-1);      \n                    }\n\t\t  }\n                if (line_buff)\n                  _TIFFfree(line_buff);\n\t\t}\n             break;\n\n    default: TIFFError (\"mirrorImage\", \"Invalid mirror axis %d\", mirror);\n             return (-1);\n             break;\n    }\n\n  return (0);\n  }\n\n/* Invert the light and dark values for a bilevel or grayscale image */\nstatic int\ninvertImage(uint16 photometric, uint16 spp, uint16 bps, uint32 width, uint32 length, unsigned char *work_buff)\n  {\n  uint32   row, col;\n  unsigned char  bytebuff1, bytebuff2, bytebuff3, bytebuff4;\n  unsigned char *src;\n  uint16        *src_uint16;\n  uint32        *src_uint32;\n\n  if (spp != 1)\n    {\n    TIFFError(\"invertImage\", \"Image inversion not supported for more than one sample per pixel\");\n    return (-1);\n    }\n\n  if (photometric !=  PHOTOMETRIC_MINISWHITE && photometric !=  PHOTOMETRIC_MINISBLACK)\n    {\n    TIFFError(\"invertImage\", \"Only black and white and grayscale images can be inverted\");\n    return (-1);\n    }\n\n  src = work_buff;\n  if (src == NULL)\n    {\n    TIFFError (\"invertImage\", \"Invalid crop buffer passed to invertImage\");\n    return (-1);\n    }\n\n  switch (bps)\n    {\n    case 32: src_uint32 = (uint32 *)src;\n             for (row = 0; row < length; row++)\n               for (col = 0; col < width; col++)\n                 {\n\t\t *src_uint32 = (uint32)0xFFFFFFFF - *src_uint32;\n                  src_uint32++;\n                 }\n            break;\n    case 16: src_uint16 = (uint16 *)src;\n             for (row = 0; row < length; row++)\n               for (col = 0; col < width; col++)\n                 {\n\t\t *src_uint16 = (uint16)0xFFFF - *src_uint16;\n                  src_uint16++;\n                 }\n            break;\n    case 8: for (row = 0; row < length; row++)\n              for (col = 0; col < width; col++)\n                {\n\t\t*src = (uint8)255 - *src;\n                 src++;\n                }\n            break;\n    case 4: for (row = 0; row < length; row++)\n              for (col = 0; col < width; col++)\n                {\n\t\tbytebuff1 = 16 - (uint8)(*src & 240 >> 4);\n\t\tbytebuff2 = 16 - (*src & 15);\n\t\t*src = bytebuff1 << 4 & bytebuff2;\n                src++;\n                }\n            break;\n    case 2: for (row = 0; row < length; row++)\n              for (col = 0; col < width; col++)\n                {\n\t\tbytebuff1 = 4 - (uint8)(*src & 192 >> 6);\n\t\tbytebuff2 = 4 - (uint8)(*src & 48  >> 4);\n\t\tbytebuff3 = 4 - (uint8)(*src & 12  >> 2);\n\t\tbytebuff4 = 4 - (uint8)(*src & 3);\n\t\t*src = (bytebuff1 << 6) || (bytebuff2 << 4) || (bytebuff3 << 2) || bytebuff4;\n                src++;\n                }\n            break;\n    case 1: for (row = 0; row < length; row++)\n              for (col = 0; col < width; col += 8 /(spp * bps))\n                {\n                *src = ~(*src);\n                src++;\n                }\n            break;\n    default: TIFFError(\"invertImage\", \"Unsupported bit depth %d\", bps);\n      return (-1);\n    }\n\n  return (0);\n  }\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiff/tools/tiffdither.c",
    "content": "/* $Id: tiffdither.c,v 1.9 2005/04/27 18:37:19 dron Exp $ */\n\n/*\n * Copyright (c) 1988-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n#include \"tif_config.h\"\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n#ifdef HAVE_UNISTD_H\n# include <unistd.h>\n#endif\n\n#include \"tiffio.h\"\n\n#define\tstreq(a,b)\t(strcmp(a,b) == 0)\n#define\tstrneq(a,b,n)\t(strncmp(a,b,n) == 0)\n\n#define\tCopyField(tag, v) \\\n\tif (TIFFGetField(in, tag, &v)) TIFFSetField(out, tag, v)\n\nuint32\timagewidth;\nuint32\timagelength;\nint\tthreshold = 128;\n\nstatic\tvoid usage(void);\n\n/* \n * Floyd-Steinberg error propragation with threshold.\n * This code is stolen from tiffmedian.\n */\nstatic void\nfsdither(TIFF* in, TIFF* out)\n{\n\tunsigned char *outline, *inputline, *inptr;\n\tshort *thisline, *nextline, *tmpptr;\n\tregister unsigned char\t*outptr;\n\tregister short *thisptr, *nextptr;\n\tregister uint32 i, j;\n\tuint32 imax, jmax;\n\tint lastline, lastpixel;\n\tint bit;\n\ttsize_t outlinesize;\n\n\timax = imagelength - 1;\n\tjmax = imagewidth - 1;\n\tinputline = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(in));\n\tthisline = (short *)_TIFFmalloc(imagewidth * sizeof (short));\n\tnextline = (short *)_TIFFmalloc(imagewidth * sizeof (short));\n\toutlinesize = TIFFScanlineSize(out);\n\toutline = (unsigned char *) _TIFFmalloc(outlinesize);\n\n\t/*\n\t * Get first line\n\t */\n\tif (TIFFReadScanline(in, inputline, 0, 0) <= 0)\n\t\treturn;\n\tinptr = inputline;\n\tnextptr = nextline;\n\tfor (j = 0; j < imagewidth; ++j)\n\t\t*nextptr++ = *inptr++;\n\tfor (i = 1; i < imagelength; ++i) {\n\t\ttmpptr = thisline;\n\t\tthisline = nextline;\n\t\tnextline = tmpptr;\n\t\tlastline = (i == imax);\n\t\tif (TIFFReadScanline(in, inputline, i, 0) <= 0)\n\t\t\tbreak;\n\t\tinptr = inputline;\n\t\tnextptr = nextline;\n\t\tfor (j = 0; j < imagewidth; ++j)\n\t\t\t*nextptr++ = *inptr++;\n\t\tthisptr = thisline;\n\t\tnextptr = nextline;\n\t\t_TIFFmemset(outptr = outline, 0, outlinesize);\n\t\tbit = 0x80;\n\t\tfor (j = 0; j < imagewidth; ++j) {\n\t\t\tregister int v;\n\n\t\t\tlastpixel = (j == jmax);\n\t\t\tv = *thisptr++;\n\t\t\tif (v < 0)\n\t\t\t\tv = 0;\n\t\t\telse if (v > 255)\n\t\t\t\tv = 255;\n\t\t\tif (v > threshold) {\n\t\t\t\t*outptr |= bit;\n\t\t\t\tv -= 255;\n\t\t\t}\n\t\t\tbit >>= 1;\n\t\t\tif (bit == 0) {\n\t\t\t\toutptr++;\n\t\t\t\tbit = 0x80;\n\t\t\t}\n\t\t\tif (!lastpixel)\n\t\t\t\tthisptr[0] += v * 7 / 16;\n\t\t\tif (!lastline) {\n\t\t\t\tif (j != 0)\n\t\t\t\t\tnextptr[-1] += v * 3 / 16;\n\t\t\t\t*nextptr++ += v * 5 / 16;\n\t\t\t\tif (!lastpixel)\n\t\t\t\t\tnextptr[0] += v / 16;\n\t\t\t}\n\t\t}\n\t\tif (TIFFWriteScanline(out, outline, i-1, 0) < 0)\n\t\t\tbreak;\n\t}\n\t_TIFFfree(inputline);\n\t_TIFFfree(thisline);\n\t_TIFFfree(nextline);\n\t_TIFFfree(outline);\n}\n\nstatic\tuint16 compression = COMPRESSION_PACKBITS;\nstatic\tuint16 predictor = 0;\nstatic\tuint32 group3options = 0;\n\nstatic void\nprocessG3Options(char* cp)\n{\n\tif ((cp = strchr(cp, ':'))) {\n\t\tdo {\n\t\t\tcp++;\n\t\t\tif (strneq(cp, \"1d\", 2))\n\t\t\t\tgroup3options &= ~GROUP3OPT_2DENCODING;\n\t\t\telse if (strneq(cp, \"2d\", 2))\n\t\t\t\tgroup3options |= GROUP3OPT_2DENCODING;\n\t\t\telse if (strneq(cp, \"fill\", 4))\n\t\t\t\tgroup3options |= GROUP3OPT_FILLBITS;\n\t\t\telse\n\t\t\t\tusage();\n\t\t} while ((cp = strchr(cp, ':')));\n\t}\n}\n\nstatic int\nprocessCompressOptions(char* opt)\n{\n\tif (streq(opt, \"none\"))\n\t\tcompression = COMPRESSION_NONE;\n\telse if (streq(opt, \"packbits\"))\n\t\tcompression = COMPRESSION_PACKBITS;\n\telse if (strneq(opt, \"g3\", 2)) {\n\t\tprocessG3Options(opt);\n\t\tcompression = COMPRESSION_CCITTFAX3;\n\t} else if (streq(opt, \"g4\"))\n\t\tcompression = COMPRESSION_CCITTFAX4;\n\telse if (strneq(opt, \"lzw\", 3)) {\n\t\tchar* cp = strchr(opt, ':');\n\t\tif (cp)\n\t\t\tpredictor = atoi(cp+1);\n\t\tcompression = COMPRESSION_LZW;\n\t} else if (strneq(opt, \"zip\", 3)) {\n\t\tchar* cp = strchr(opt, ':');\n\t\tif (cp)\n\t\t\tpredictor = atoi(cp+1);\n\t\tcompression = COMPRESSION_DEFLATE;\n\t} else\n\t\treturn (0);\n\treturn (1);\n}\n\nint\nmain(int argc, char* argv[])\n{\n\tTIFF *in, *out;\n\tuint16 samplesperpixel, bitspersample = 1, shortv;\n\tfloat floatv;\n\tchar thing[1024];\n\tuint32 rowsperstrip = (uint32) -1;\n\tint onestrip = 0;\n\tuint16 fillorder = 0;\n\tint c;\n\textern int optind;\n\textern char *optarg;\n\n\twhile ((c = getopt(argc, argv, \"c:f:r:t:\")) != -1)\n\t\tswitch (c) {\n\t\tcase 'c':\t\t/* compression scheme */\n\t\t\tif (!processCompressOptions(optarg))\n\t\t\t\tusage();\n\t\t\tbreak;\n\t\tcase 'f':\t\t/* fill order */\n\t\t\tif (streq(optarg, \"lsb2msb\"))\n\t\t\t\tfillorder = FILLORDER_LSB2MSB;\n\t\t\telse if (streq(optarg, \"msb2lsb\"))\n\t\t\t\tfillorder = FILLORDER_MSB2LSB;\n\t\t\telse\n\t\t\t\tusage();\n\t\t\tbreak;\n\t\tcase 'r':\t\t/* rows/strip */\n\t\t\trowsperstrip = atoi(optarg);\n\t\t\tonestrip = 0;\n\t\t\tbreak;\n\t\tcase 't':\n\t\t\tthreshold = atoi(optarg);\n\t\t\tif (threshold < 0)\n\t\t\t\tthreshold = 0;\n\t\t\telse if (threshold > 255)\n\t\t\t\tthreshold = 255;\n\t\t\tbreak;\n\t\tcase '?':\n\t\t\tusage();\n\t\t\t/*NOTREACHED*/\n\t\t}\n\tif (argc - optind < 2)\n\t\tusage();\n\tin = TIFFOpen(argv[optind], \"r\");\n\tif (in == NULL)\n\t\treturn (-1);\n\tTIFFGetField(in, TIFFTAG_SAMPLESPERPIXEL, &samplesperpixel);\n\tif (samplesperpixel != 1) {\n\t\tfprintf(stderr, \"%s: Not a b&w image.\\n\", argv[0]);\n\t\treturn (-1);\n\t}\n\tTIFFGetField(in, TIFFTAG_BITSPERSAMPLE, &bitspersample);\n\tif (bitspersample != 8) {\n\t\tfprintf(stderr,\n\t\t    \" %s: Sorry, only handle 8-bit samples.\\n\", argv[0]);\n\t\treturn (-1);\n\t}\n\tout = TIFFOpen(argv[optind+1], \"w\");\n\tif (out == NULL)\n\t\treturn (-1);\n\tCopyField(TIFFTAG_IMAGEWIDTH, imagewidth);\n\tTIFFGetField(in, TIFFTAG_IMAGELENGTH, &imagelength);\n\tTIFFSetField(out, TIFFTAG_IMAGELENGTH, imagelength-1);\n\tTIFFSetField(out, TIFFTAG_BITSPERSAMPLE, 1);\n\tTIFFSetField(out, TIFFTAG_SAMPLESPERPIXEL, 1);\n\tTIFFSetField(out, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);\n\tTIFFSetField(out, TIFFTAG_COMPRESSION, compression);\n\tif (fillorder)\n\t\tTIFFSetField(out, TIFFTAG_FILLORDER, fillorder);\n\telse\n\t\tCopyField(TIFFTAG_FILLORDER, shortv);\n\tsprintf(thing, \"Dithered B&W version of %s\", argv[optind]);\n\tTIFFSetField(out, TIFFTAG_IMAGEDESCRIPTION, thing);\n\tCopyField(TIFFTAG_PHOTOMETRIC, shortv);\n\tCopyField(TIFFTAG_ORIENTATION, shortv);\n\tCopyField(TIFFTAG_XRESOLUTION, floatv);\n\tCopyField(TIFFTAG_YRESOLUTION, floatv);\n\tCopyField(TIFFTAG_RESOLUTIONUNIT, shortv);\n\tif (onestrip)\n\t\trowsperstrip = imagelength-1;\n\telse\n\t\trowsperstrip = TIFFDefaultStripSize(out, rowsperstrip);\n\tTIFFSetField(out, TIFFTAG_ROWSPERSTRIP, rowsperstrip);\n\tswitch (compression) {\n\tcase COMPRESSION_CCITTFAX3:\n\t\tTIFFSetField(out, TIFFTAG_GROUP3OPTIONS, group3options);\n\t\tbreak;\n\tcase COMPRESSION_LZW:\n\tcase COMPRESSION_DEFLATE:\n\t\tif (predictor)\n\t\t\tTIFFSetField(out, TIFFTAG_PREDICTOR, predictor);\n\t\tbreak;\n\t}\n\tfsdither(in, out);\n\tTIFFClose(in);\n\tTIFFClose(out);\n\treturn (0);\n}\n\nchar* stuff[] = {\n\"usage: tiffdither [options] input.tif output.tif\",\n\"where options are:\",\n\" -r #\t\tmake each strip have no more than # rows\",\n\" -f lsb2msb\tforce lsb-to-msb FillOrder for output\",\n\" -f msb2lsb\tforce msb-to-lsb FillOrder for output\",\n\" -c lzw[:opts]\tcompress output with Lempel-Ziv & Welch encoding\",\n\" -c zip[:opts]\tcompress output with deflate encoding\",\n\" -c packbits\tcompress output with packbits encoding\",\n\" -c g3[:opts]\tcompress output with CCITT Group 3 encoding\",\n\" -c g4\t\tcompress output with CCITT Group 4 encoding\",\n\" -c none\tuse no compression algorithm on output\",\n\"\",\n\"Group 3 options:\",\n\" 1d\t\tuse default CCITT Group 3 1D-encoding\",\n\" 2d\t\tuse optional CCITT Group 3 2D-encoding\",\n\" fill\t\tbyte-align EOL codes\",\n\"For example, -c g3:2d:fill to get G3-2D-encoded data with byte-aligned EOLs\",\n\"\",\n\"LZW and deflate options:\",\n\" #\t\tset predictor value\",\n\"For example, -c lzw:2 to get LZW-encoded data with horizontal differencing\",\nNULL\n};\n\nstatic void\nusage(void)\n{\n\tchar buf[BUFSIZ];\n\tint i;\n\n\tsetbuf(stderr, buf);\n        fprintf(stderr, \"%s\\n\\n\", TIFFGetVersion());\n\tfor (i = 0; stuff[i] != NULL; i++)\n\t\tfprintf(stderr, \"%s\\n\", stuff[i]);\n\texit(-1);\n}\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiff/tools/tiffdump.c",
    "content": "/* $Id: tiffdump.c,v 1.13 2005/11/21 03:35:06 fwarmerdam Exp $ */\n\n/*\n * Copyright (c) 1988-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n#include \"tif_config.h\"\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n#ifdef HAVE_UNISTD_H\n# include <unistd.h>\n#endif\n\n#ifdef HAVE_FCNTL_H\n# include <fcntl.h>\n#endif\n\n#ifdef HAVE_SYS_TYPES_H\n# include <sys/types.h>\n#endif\n\n#ifdef HAVE_IO_H\n# include <io.h>\n#endif\n\n#include \"tiffio.h\"\n\n#ifndef O_BINARY\n# define O_BINARY\t0\n#endif\n\nchar*\tappname;\nchar*\tcurfile;\nint\tswabflag;\nint\tbigendian;\nint\ttypeshift[14];\t\t/* data type shift counts */\nlong\ttypemask[14];\t\t/* data type masks */\nuint32\tmaxitems = 24;\t\t/* maximum indirect data items to print */\n\nchar*\tbytefmt = \"%s%#02x\";\t\t/* BYTE */\nchar*\tsbytefmt = \"%s%d\";\t\t/* SBYTE */\nchar*\tshortfmt = \"%s%u\";\t\t/* SHORT */\nchar*\tsshortfmt = \"%s%d\";\t\t/* SSHORT */\nchar*\tlongfmt = \"%s%lu\";\t\t/* LONG */\nchar*\tslongfmt = \"%s%ld\";\t\t/* SLONG */\nchar*\trationalfmt = \"%s%g\";\t\t/* RATIONAL */\nchar*\tsrationalfmt = \"%s%g\";\t\t/* SRATIONAL */\nchar*\tfloatfmt = \"%s%g\";\t\t/* FLOAT */\nchar*\tdoublefmt = \"%s%g\";\t\t/* DOUBLE */\nchar*\tifdfmt = \"%s%#04x\";\t\t/* IFD offset */\n\nstatic\tvoid dump(int, off_t);\nextern\tint optind;\nextern\tchar* optarg;\n\nvoid\nusage()\n{\n\tfprintf(stderr, \"usage: %s [-h] [-o offset] [-m maxitems] file.tif ...\\n\", appname);\n\texit(-1);\n}\n\nint\nmain(int argc, char* argv[])\n{\n\tint one = 1, fd;\n\tint multiplefiles = (argc > 1);\n\tint c;\n\tuint32 diroff = (uint32) 0;\n\tbigendian = (*(char *)&one == 0);\n\n\tappname = argv[0];\n\twhile ((c = getopt(argc, argv, \"m:o:h\")) != -1) {\n\t\tswitch (c) {\n\t\tcase 'h':\t\t\t/* print values in hex */\n\t\t\tshortfmt = \"%s%#x\";\n\t\t\tsshortfmt = \"%s%#x\";\n\t\t\tlongfmt = \"%s%#lx\";\n\t\t\tslongfmt = \"%s%#lx\";\n\t\t\tbreak;\n\t\tcase 'o':\n\t\t\tdiroff = (uint32) strtoul(optarg, NULL, 0);\n\t\t\tbreak;\n\t\tcase 'm':\n\t\t\tmaxitems = strtoul(optarg, NULL, 0);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tusage();\n\t\t}\n\t}\n\tif (optind >= argc)\n\t\tusage();\n\tfor (; optind < argc; optind++) {\n\t\tfd = open(argv[optind], O_RDONLY|O_BINARY, 0);\n\t\tif (fd < 0) {\n\t\t\tperror(argv[0]);\n\t\t\treturn (-1);\n\t\t}\n\t\tif (multiplefiles)\n\t\t\tprintf(\"%s:\\n\", argv[optind]);\n\t\tcurfile = argv[optind];\n\t\tswabflag = 0;\n\t\tdump(fd, diroff);\n\t\tclose(fd);\n\t}\n\treturn (0);\n}\n\nstatic\tTIFFHeader hdr;\n\n#define\tord(e)\t((int)e)\n\n/*\n * Initialize shift & mask tables and byte\n * swapping state according to the file\n * byte order.\n */\nstatic void\nInitByteOrder(int magic)\n{\n\ttypemask[0] = 0;\n\ttypemask[ord(TIFF_BYTE)] = 0xff;\n\ttypemask[ord(TIFF_SBYTE)] = 0xff;\n\ttypemask[ord(TIFF_UNDEFINED)] = 0xff;\n\ttypemask[ord(TIFF_SHORT)] = 0xffff;\n\ttypemask[ord(TIFF_SSHORT)] = 0xffff;\n\ttypemask[ord(TIFF_LONG)] = 0xffffffff;\n\ttypemask[ord(TIFF_SLONG)] = 0xffffffff;\n\ttypemask[ord(TIFF_IFD)] = 0xffffffff;\n\ttypemask[ord(TIFF_RATIONAL)] = 0xffffffff;\n\ttypemask[ord(TIFF_SRATIONAL)] = 0xffffffff;\n\ttypemask[ord(TIFF_FLOAT)] = 0xffffffff;\n\ttypemask[ord(TIFF_DOUBLE)] = 0xffffffff;\n\ttypeshift[0] = 0;\n\ttypeshift[ord(TIFF_LONG)] = 0;\n\ttypeshift[ord(TIFF_SLONG)] = 0;\n\ttypeshift[ord(TIFF_IFD)] = 0;\n\ttypeshift[ord(TIFF_RATIONAL)] = 0;\n\ttypeshift[ord(TIFF_SRATIONAL)] = 0;\n\ttypeshift[ord(TIFF_FLOAT)] = 0;\n\ttypeshift[ord(TIFF_DOUBLE)] = 0;\n\tif (magic == TIFF_BIGENDIAN || magic == MDI_BIGENDIAN) {\n\t\ttypeshift[ord(TIFF_BYTE)] = 24;\n\t\ttypeshift[ord(TIFF_SBYTE)] = 24;\n\t\ttypeshift[ord(TIFF_SHORT)] = 16;\n\t\ttypeshift[ord(TIFF_SSHORT)] = 16;\n\t\tswabflag = !bigendian;\n\t} else {\n\t\ttypeshift[ord(TIFF_BYTE)] = 0;\n\t\ttypeshift[ord(TIFF_SBYTE)] = 0;\n\t\ttypeshift[ord(TIFF_SHORT)] = 0;\n\t\ttypeshift[ord(TIFF_SSHORT)] = 0;\n\t\tswabflag = bigendian;\n\t}\n}\n\nstatic\toff_t ReadDirectory(int, unsigned, off_t);\nstatic\tvoid ReadError(char*);\nstatic\tvoid Error(const char*, ...);\nstatic\tvoid Fatal(const char*, ...);\n\nstatic void\ndump(int fd, off_t diroff)\n{\n\tunsigned i;\n\n\tlseek(fd, (off_t) 0, 0);\n\tif (read(fd, (char*) &hdr, sizeof (hdr)) != sizeof (hdr))\n\t\tReadError(\"TIFF header\");\n\t/*\n\t * Setup the byte order handling.\n\t */\n\tif (hdr.tiff_magic != TIFF_BIGENDIAN && hdr.tiff_magic != TIFF_LITTLEENDIAN &&\n#if HOST_BIGENDIAN\n\t    // MDI is sensitive to the host byte order, unlike TIFF\n\t    MDI_BIGENDIAN != hdr.tiff_magic )\n#else\n\t    MDI_LITTLEENDIAN != hdr.tiff_magic )\n#endif\n\t\tFatal(\"Not a TIFF or MDI file, bad magic number %u (%#x)\",\n\t\t    hdr.tiff_magic, hdr.tiff_magic);\n\tInitByteOrder(hdr.tiff_magic);\n\t/*\n\t * Swap header if required.\n\t */\n\tif (swabflag) {\n\t\tTIFFSwabShort(&hdr.tiff_version);\n\t\tTIFFSwabLong(&hdr.tiff_diroff);\n\t}\n\t/*\n\t * Now check version (if needed, it's been byte-swapped).\n\t * Note that this isn't actually a version number, it's a\n\t * magic number that doesn't change (stupid).\n\t */\n\tif (hdr.tiff_version != TIFF_VERSION)\n\t\tFatal(\"Not a TIFF file, bad version number %u (%#x)\",\n\t\t    hdr.tiff_version, hdr.tiff_version); \n\tprintf(\"Magic: %#x <%s-endian> Version: %#x\\n\",\n\t    hdr.tiff_magic,\n\t    hdr.tiff_magic == TIFF_BIGENDIAN ? \"big\" : \"little\",\n\t    hdr.tiff_version);\n\tif (diroff == 0)\n\t    diroff = hdr.tiff_diroff;\n\tfor (i = 0; diroff != 0; i++) {\n\t\tif (i > 0)\n\t\t\tputchar('\\n');\n\t\tdiroff = ReadDirectory(fd, i, diroff);\n\t}\n}\n\nstatic int datawidth[] = {\n    0,\t/* nothing */\n    1,\t/* TIFF_BYTE */\n    1,\t/* TIFF_ASCII */\n    2,\t/* TIFF_SHORT */\n    4,\t/* TIFF_LONG */\n    8,\t/* TIFF_RATIONAL */\n    1,\t/* TIFF_SBYTE */\n    1,\t/* TIFF_UNDEFINED */\n    2,\t/* TIFF_SSHORT */\n    4,\t/* TIFF_SLONG */\n    8,\t/* TIFF_SRATIONAL */\n    4,\t/* TIFF_FLOAT */\n    8,\t/* TIFF_DOUBLE */\n    4\t/* TIFF_IFD */\n};\n#define\tNWIDTHS\t(sizeof (datawidth) / sizeof (datawidth[0]))\nstatic\tint TIFFFetchData(int, TIFFDirEntry*, void*);\nstatic\tvoid PrintTag(FILE*, uint16);\nstatic\tvoid PrintType(FILE*, uint16);\nstatic\tvoid PrintData(FILE*, uint16, uint32, unsigned char*);\nstatic\tvoid PrintByte(FILE*, const char*, TIFFDirEntry*);\nstatic\tvoid PrintShort(FILE*, const char*, TIFFDirEntry*);\nstatic\tvoid PrintLong(FILE*, const char*, TIFFDirEntry*);\n\n/*\n * Read the next TIFF directory from a file\n * and convert it to the internal format.\n * We read directories sequentially.\n */\nstatic off_t\nReadDirectory(int fd, unsigned ix, off_t off)\n{\n\tregister TIFFDirEntry *dp;\n\tregister unsigned int n;\n\tTIFFDirEntry *dir = 0;\n\tuint16 dircount;\n\tint space;\n\tuint32 nextdiroff = 0;\n\n\tif (off == 0)\t\t\t/* no more directories */\n\t\tgoto done;\n\tif (lseek(fd, (off_t) off, 0) != off) {\n\t\tFatal(\"Seek error accessing TIFF directory\");\n\t\tgoto done;\n\t}\n\tif (read(fd, (char*) &dircount, sizeof (uint16)) != sizeof (uint16)) {\n\t\tReadError(\"directory count\");\n\t\tgoto done;\n\t}\n\tif (swabflag)\n\t\tTIFFSwabShort(&dircount);\n\tdir = (TIFFDirEntry *)_TIFFmalloc(dircount * sizeof (TIFFDirEntry));\n\tif (dir == NULL) {\n\t\tFatal(\"No space for TIFF directory\");\n\t\tgoto done;\n\t}\n\tn = read(fd, (char*) dir, dircount*sizeof (*dp));\n\tif (n != dircount*sizeof (*dp)) {\n\t\tn /= sizeof (*dp);\n\t\tError(\n\t    \"Could only read %u of %u entries in directory at offset %#lx\",\n\t\t    n, dircount, (unsigned long) off);\n\t\tdircount = n;\n\t}\n\tif (read(fd, (char*) &nextdiroff, sizeof (uint32)) != sizeof (uint32))\n\t\tnextdiroff = 0;\n\tif (swabflag)\n\t\tTIFFSwabLong(&nextdiroff);\n\tprintf(\"Directory %u: offset %lu (%#lx) next %lu (%#lx)\\n\", ix,\n\t    (unsigned long)off, (unsigned long)off,\n\t    (unsigned long)nextdiroff, (unsigned long)nextdiroff);\n\tfor (dp = dir, n = dircount; n > 0; n--, dp++) {\n\t\tif (swabflag) {\n\t\t\tTIFFSwabArrayOfShort(&dp->tdir_tag, 2);\n\t\t\tTIFFSwabArrayOfLong(&dp->tdir_count, 2);\n\t\t}\n\t\tPrintTag(stdout, dp->tdir_tag);\n\t\tputchar(' ');\n\t\tPrintType(stdout, dp->tdir_type);\n\t\tputchar(' ');\n\t\tprintf(\"%lu<\", (unsigned long) dp->tdir_count);\n\t\tif (dp->tdir_type >= NWIDTHS) {\n\t\t\tprintf(\">\\n\");\n\t\t\tcontinue;\n\t\t}\n\t\tspace = dp->tdir_count * datawidth[dp->tdir_type];\n\t\tif (space <= 0) {\n\t\t\tprintf(\">\\n\");\n\t\t\tError(\"Invalid count for tag %u\", dp->tdir_tag);\n\t\t\tcontinue;\n                }\n\t\tif (space <= 4) {\n\t\t\tswitch (dp->tdir_type) {\n\t\t\tcase TIFF_FLOAT:\n\t\t\tcase TIFF_UNDEFINED:\n\t\t\tcase TIFF_ASCII: {\n\t\t\t\tunsigned char data[4];\n\t\t\t\t_TIFFmemcpy(data, &dp->tdir_offset, 4);\n\t\t\t\tif (swabflag)\n\t\t\t\t\tTIFFSwabLong((uint32*) data);\n\t\t\t\tPrintData(stdout,\n\t\t\t\t    dp->tdir_type, dp->tdir_count, data);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase TIFF_BYTE:\n\t\t\t\tPrintByte(stdout, bytefmt, dp);\n\t\t\t\tbreak;\n\t\t\tcase TIFF_SBYTE:\n\t\t\t\tPrintByte(stdout, sbytefmt, dp);\n\t\t\t\tbreak;\n\t\t\tcase TIFF_SHORT:\n\t\t\t\tPrintShort(stdout, shortfmt, dp);\n\t\t\t\tbreak;\n\t\t\tcase TIFF_SSHORT:\n\t\t\t\tPrintShort(stdout, sshortfmt, dp);\n\t\t\t\tbreak;\n\t\t\tcase TIFF_LONG:\n\t\t\t\tPrintLong(stdout, longfmt, dp);\n\t\t\t\tbreak;\n\t\t\tcase TIFF_SLONG:\n\t\t\t\tPrintLong(stdout, slongfmt, dp);\n\t\t\t\tbreak;\n\t\t\tcase TIFF_IFD:\n\t\t\t\tPrintLong(stdout, ifdfmt, dp);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t} else {\n\t\t\tunsigned char *data = (unsigned char *)_TIFFmalloc(space);\n\t\t\tif (data) {\n\t\t\t\tif (TIFFFetchData(fd, dp, data)) {\n\t\t\t\t\tif (dp->tdir_count > maxitems) {\n\t\t\t\t\t\tPrintData(stdout, dp->tdir_type,\n\t\t\t\t\t\t    maxitems, data);\n\t\t\t\t\t\tprintf(\" ...\");\n\t\t\t\t\t} else\n\t\t\t\t\t\tPrintData(stdout, dp->tdir_type,\n\t\t\t\t\t\t    dp->tdir_count, data);\n                                }\n\t\t\t\t_TIFFfree(data);\n\t\t\t} else\n\t\t\t\tError(\"No space for data for tag %u\",\n\t\t\t\t    dp->tdir_tag);\n\t\t}\n\t\tprintf(\">\\n\");\n\t}\ndone:\n\tif (dir)\n\t\t_TIFFfree((char *)dir);\n\treturn (nextdiroff);\n}\n\nstatic\tstruct tagname {\n\tuint16\ttag;\n\tchar*\tname;\n} tagnames[] = {\n    { TIFFTAG_SUBFILETYPE,\t\"SubFileType\" },\n    { TIFFTAG_OSUBFILETYPE,\t\"OldSubFileType\" },\n    { TIFFTAG_IMAGEWIDTH,\t\"ImageWidth\" },\n    { TIFFTAG_IMAGELENGTH,\t\"ImageLength\" },\n    { TIFFTAG_BITSPERSAMPLE,\t\"BitsPerSample\" },\n    { TIFFTAG_COMPRESSION,\t\"Compression\" },\n    { TIFFTAG_PHOTOMETRIC,\t\"Photometric\" },\n    { TIFFTAG_THRESHHOLDING,\t\"Threshholding\" },\n    { TIFFTAG_CELLWIDTH,\t\"CellWidth\" },\n    { TIFFTAG_CELLLENGTH,\t\"CellLength\" },\n    { TIFFTAG_FILLORDER,\t\"FillOrder\" },\n    { TIFFTAG_DOCUMENTNAME,\t\"DocumentName\" },\n    { TIFFTAG_IMAGEDESCRIPTION,\t\"ImageDescription\" },\n    { TIFFTAG_MAKE,\t\t\"Make\" },\n    { TIFFTAG_MODEL,\t\t\"Model\" },\n    { TIFFTAG_STRIPOFFSETS,\t\"StripOffsets\" },\n    { TIFFTAG_ORIENTATION,\t\"Orientation\" },\n    { TIFFTAG_SAMPLESPERPIXEL,\t\"SamplesPerPixel\" },\n    { TIFFTAG_ROWSPERSTRIP,\t\"RowsPerStrip\" },\n    { TIFFTAG_STRIPBYTECOUNTS,\t\"StripByteCounts\" },\n    { TIFFTAG_MINSAMPLEVALUE,\t\"MinSampleValue\" },\n    { TIFFTAG_MAXSAMPLEVALUE,\t\"MaxSampleValue\" },\n    { TIFFTAG_XRESOLUTION,\t\"XResolution\" },\n    { TIFFTAG_YRESOLUTION,\t\"YResolution\" },\n    { TIFFTAG_PLANARCONFIG,\t\"PlanarConfig\" },\n    { TIFFTAG_PAGENAME,\t\t\"PageName\" },\n    { TIFFTAG_XPOSITION,\t\"XPosition\" },\n    { TIFFTAG_YPOSITION,\t\"YPosition\" },\n    { TIFFTAG_FREEOFFSETS,\t\"FreeOffsets\" },\n    { TIFFTAG_FREEBYTECOUNTS,\t\"FreeByteCounts\" },\n    { TIFFTAG_GRAYRESPONSEUNIT,\t\"GrayResponseUnit\" },\n    { TIFFTAG_GRAYRESPONSECURVE,\"GrayResponseCurve\" },\n    { TIFFTAG_GROUP3OPTIONS,\t\"Group3Options\" },\n    { TIFFTAG_GROUP4OPTIONS,\t\"Group4Options\" },\n    { TIFFTAG_RESOLUTIONUNIT,\t\"ResolutionUnit\" },\n    { TIFFTAG_PAGENUMBER,\t\"PageNumber\" },\n    { TIFFTAG_COLORRESPONSEUNIT,\"ColorResponseUnit\" },\n    { TIFFTAG_TRANSFERFUNCTION,\t\"TransferFunction\" },\n    { TIFFTAG_SOFTWARE,\t\t\"Software\" },\n    { TIFFTAG_DATETIME,\t\t\"DateTime\" },\n    { TIFFTAG_ARTIST,\t\t\"Artist\" },\n    { TIFFTAG_HOSTCOMPUTER,\t\"HostComputer\" },\n    { TIFFTAG_PREDICTOR,\t\"Predictor\" },\n    { TIFFTAG_WHITEPOINT,\t\"Whitepoint\" },\n    { TIFFTAG_PRIMARYCHROMATICITIES,\"PrimaryChromaticities\" },\n    { TIFFTAG_COLORMAP,\t\t\"Colormap\" },\n    { TIFFTAG_HALFTONEHINTS,\t\"HalftoneHints\" },\n    { TIFFTAG_TILEWIDTH,\t\"TileWidth\" },\n    { TIFFTAG_TILELENGTH,\t\"TileLength\" },\n    { TIFFTAG_TILEOFFSETS,\t\"TileOffsets\" },\n    { TIFFTAG_TILEBYTECOUNTS,\t\"TileByteCounts\" },\n    { TIFFTAG_BADFAXLINES,\t\"BadFaxLines\" },\n    { TIFFTAG_CLEANFAXDATA,\t\"CleanFaxData\" },\n    { TIFFTAG_CONSECUTIVEBADFAXLINES, \"ConsecutiveBadFaxLines\" },\n    { TIFFTAG_SUBIFD,\t\t\"SubIFD\" },\n    { TIFFTAG_INKSET,\t\t\"InkSet\" },\n    { TIFFTAG_INKNAMES,\t\t\"InkNames\" },\n    { TIFFTAG_NUMBEROFINKS,\t\"NumberOfInks\" },\n    { TIFFTAG_DOTRANGE,\t\t\"DotRange\" },\n    { TIFFTAG_TARGETPRINTER,\t\"TargetPrinter\" },\n    { TIFFTAG_EXTRASAMPLES,\t\"ExtraSamples\" },\n    { TIFFTAG_SAMPLEFORMAT,\t\"SampleFormat\" },\n    { TIFFTAG_SMINSAMPLEVALUE,\t\"SMinSampleValue\" },\n    { TIFFTAG_SMAXSAMPLEVALUE,\t\"SMaxSampleValue\" },\n    { TIFFTAG_JPEGPROC,\t\t\"JPEGProcessingMode\" },\n    { TIFFTAG_JPEGIFOFFSET,\t\"JPEGInterchangeFormat\" },\n    { TIFFTAG_JPEGIFBYTECOUNT,\t\"JPEGInterchangeFormatLength\" },\n    { TIFFTAG_JPEGRESTARTINTERVAL,\"JPEGRestartInterval\" },\n    { TIFFTAG_JPEGLOSSLESSPREDICTORS,\"JPEGLosslessPredictors\" },\n    { TIFFTAG_JPEGPOINTTRANSFORM,\"JPEGPointTransform\" },\n    { TIFFTAG_JPEGTABLES,       \"JPEGTables\" },\n    { TIFFTAG_JPEGQTABLES,\t\"JPEGQTables\" },\n    { TIFFTAG_JPEGDCTABLES,\t\"JPEGDCTables\" },\n    { TIFFTAG_JPEGACTABLES,\t\"JPEGACTables\" },\n    { TIFFTAG_YCBCRCOEFFICIENTS,\"YCbCrCoefficients\" },\n    { TIFFTAG_YCBCRSUBSAMPLING,\t\"YCbCrSubsampling\" },\n    { TIFFTAG_YCBCRPOSITIONING,\t\"YCbCrPositioning\" },\n    { TIFFTAG_REFERENCEBLACKWHITE, \"ReferenceBlackWhite\" },\n    { TIFFTAG_REFPTS,\t\t\"IgReferencePoints (Island Graphics)\" },\n    { TIFFTAG_REGIONTACKPOINT,\t\"IgRegionTackPoint (Island Graphics)\" },\n    { TIFFTAG_REGIONWARPCORNERS,\"IgRegionWarpCorners (Island Graphics)\" },\n    { TIFFTAG_REGIONAFFINE,\t\"IgRegionAffine (Island Graphics)\" },\n    { TIFFTAG_MATTEING,\t\t\"OBSOLETE Matteing (Silicon Graphics)\" },\n    { TIFFTAG_DATATYPE,\t\t\"OBSOLETE DataType (Silicon Graphics)\" },\n    { TIFFTAG_IMAGEDEPTH,\t\"ImageDepth (Silicon Graphics)\" },\n    { TIFFTAG_TILEDEPTH,\t\"TileDepth (Silicon Graphics)\" },\n    { 32768,\t\t\t\"OLD BOGUS Matteing tag\" },\n    { TIFFTAG_COPYRIGHT,\t\"Copyright\" },\n    { TIFFTAG_ICCPROFILE,\t\"ICC Profile\" },\n    { TIFFTAG_JBIGOPTIONS,\t\"JBIG Options\" },\n    { TIFFTAG_STONITS,\t\t\"StoNits\" },\n};\n#define\tNTAGS\t(sizeof (tagnames) / sizeof (tagnames[0]))\n\nstatic void\nPrintTag(FILE* fd, uint16 tag)\n{\n\tregister struct tagname *tp;\n\n\tfor (tp = tagnames; tp < &tagnames[NTAGS]; tp++)\n\t\tif (tp->tag == tag) {\n\t\t\tfprintf(fd, \"%s (%u)\", tp->name, tag);\n\t\t\treturn;\n\t\t}\n\tfprintf(fd, \"%u (%#x)\", tag, tag);\n}\n\nstatic void\nPrintType(FILE* fd, uint16 type)\n{\n\tstatic char *typenames[] = {\n\t    \"0\",\n\t    \"BYTE\",\n\t    \"ASCII\",\n\t    \"SHORT\",\n\t    \"LONG\",\n\t    \"RATIONAL\",\n\t    \"SBYTE\",\n\t    \"UNDEFINED\",\n\t    \"SSHORT\",\n\t    \"SLONG\",\n\t    \"SRATIONAL\",\n\t    \"FLOAT\",\n\t    \"DOUBLE\"\n\t};\n#define\tNTYPES\t(sizeof (typenames) / sizeof (typenames[0]))\n\n\tif (type < NTYPES)\n\t\tfprintf(fd, \"%s (%u)\", typenames[type], type);\n\telse\n\t\tfprintf(fd, \"%u (%#x)\", type, type);\n}\n#undef\tNTYPES\n\nstatic void\nPrintByte(FILE* fd, const char* fmt, TIFFDirEntry* dp)\n{\n\tchar* sep = \"\";\n\n\tif (hdr.tiff_magic == TIFF_BIGENDIAN) {\n\t\tswitch ((int)dp->tdir_count) {\n\t\tcase 4: fprintf(fd, fmt, sep, dp->tdir_offset&0xff);\n\t\t\tsep = \" \";\n\t\tcase 3: fprintf(fd, fmt, sep, (dp->tdir_offset>>8)&0xff);\n\t\t\tsep = \" \";\n\t\tcase 2: fprintf(fd, fmt, sep, (dp->tdir_offset>>16)&0xff);\n\t\t\tsep = \" \";\n\t\tcase 1: fprintf(fd, fmt, sep, dp->tdir_offset>>24);\n\t\t}\n\t} else {\n\t\tswitch ((int)dp->tdir_count) {\n\t\tcase 4: fprintf(fd, fmt, sep, dp->tdir_offset>>24);\n\t\t\tsep = \" \";\n\t\tcase 3: fprintf(fd, fmt, sep, (dp->tdir_offset>>16)&0xff);\n\t\t\tsep = \" \";\n\t\tcase 2: fprintf(fd, fmt, sep, (dp->tdir_offset>>8)&0xff);\n\t\t\tsep = \" \";\n\t\tcase 1: fprintf(fd, fmt, sep, dp->tdir_offset&0xff);\n\t\t}\n\t}\n}\n\nstatic void\nPrintShort(FILE* fd, const char* fmt, TIFFDirEntry* dp)\n{\n\tchar *sep = \"\";\n\n\tif (hdr.tiff_magic == TIFF_BIGENDIAN) {\n\t\tswitch (dp->tdir_count) {\n\t\tcase 2: fprintf(fd, fmt, sep, dp->tdir_offset&0xffff);\n\t\t\tsep = \" \";\n\t\tcase 1: fprintf(fd, fmt, sep, dp->tdir_offset>>16);\n\t\t}\n\t} else {\n\t\tswitch (dp->tdir_count) {\n\t\tcase 2: fprintf(fd, fmt, sep, dp->tdir_offset>>16);\n\t\t\tsep = \" \";\n\t\tcase 1: fprintf(fd, fmt, sep, dp->tdir_offset&0xffff);\n\t\t}\n\t}\n}\n\nstatic void\nPrintLong(FILE* fd, const char* fmt, TIFFDirEntry* dp)\n{\n\tfprintf(fd, fmt, \"\", (long) dp->tdir_offset);\n}\n\n#include <ctype.h>\n\nstatic void\nPrintASCII(FILE* fd, uint32 cc, const unsigned char* cp)\n{\n\tfor (; cc > 0; cc--, cp++) {\n\t\tconst char* tp;\n\n\t\tif (isprint(*cp)) {\n\t\t\tfputc(*cp, fd);\n\t\t\tcontinue;\n\t\t}\n\t\tfor (tp = \"\\tt\\bb\\rr\\nn\\vv\"; *tp; tp++)\n\t\t\tif (*tp++ == *cp)\n\t\t\t\tbreak;\n\t\tif (*tp)\n\t\t\tfprintf(fd, \"\\\\%c\", *tp);\n\t\telse if (*cp)\n\t\t\tfprintf(fd, \"\\\\%03o\", *cp);\n\t\telse\n\t\t\tfprintf(fd, \"\\\\0\");\n\t}\n}\n\nstatic void\nPrintData(FILE* fd, uint16 type, uint32 count, unsigned char* data)\n{\n\tchar* sep = \"\";\n\n\tswitch (type) {\n\tcase TIFF_BYTE:\n\t\twhile (count-- > 0)\n\t\t\tfprintf(fd, bytefmt, sep, *data++), sep = \" \";\n\t\tbreak;\n\tcase TIFF_SBYTE:\n\t\twhile (count-- > 0)\n\t\t\tfprintf(fd, sbytefmt, sep, *(char *)data++), sep = \" \";\n\t\tbreak;\n\tcase TIFF_UNDEFINED:\n\t\twhile (count-- > 0)\n\t\t\tfprintf(fd, bytefmt, sep, *data++), sep = \" \";\n\t\tbreak;\n\tcase TIFF_ASCII:\n\t\tPrintASCII(fd, count, data);\n\t\tbreak;\n\tcase TIFF_SHORT: {\n\t\tuint16 *wp = (uint16*)data;\n\t\twhile (count-- > 0)\n\t\t\tfprintf(fd, shortfmt, sep, *wp++), sep = \" \";\n\t\tbreak;\n\t}\n\tcase TIFF_SSHORT: {\n\t\tint16 *wp = (int16*)data;\n\t\twhile (count-- > 0)\n\t\t\tfprintf(fd, sshortfmt, sep, *wp++), sep = \" \";\n\t\tbreak;\n\t}\n\tcase TIFF_LONG: {\n\t\tuint32 *lp = (uint32*)data;\n\t\twhile (count-- > 0) {\n\t\t\tfprintf(fd, longfmt, sep, (unsigned long) *lp++);\n\t\t\tsep = \" \";\n\t\t}\n\t\tbreak;\n\t}\n\tcase TIFF_SLONG: {\n\t\tint32 *lp = (int32*)data;\n\t\twhile (count-- > 0)\n\t\t\tfprintf(fd, slongfmt, sep, (long) *lp++), sep = \" \";\n\t\tbreak;\n\t}\n\tcase TIFF_RATIONAL: {\n\t\tuint32 *lp = (uint32*)data;\n\t\twhile (count-- > 0) {\n\t\t\tif (lp[1] == 0)\n\t\t\t\tfprintf(fd, \"%sNan (%lu/%lu)\", sep,\n\t\t\t\t    (unsigned long) lp[0],\n\t\t\t\t    (unsigned long) lp[1]);\n\t\t\telse\n\t\t\t\tfprintf(fd, rationalfmt, sep,\n\t\t\t\t    (double)lp[0] / (double)lp[1]);\n\t\t\tsep = \" \";\n\t\t\tlp += 2;\n\t\t}\n\t\tbreak;\n\t}\n\tcase TIFF_SRATIONAL: {\n\t\tint32 *lp = (int32*)data;\n\t\twhile (count-- > 0) {\n\t\t\tif (lp[1] == 0)\n\t\t\t\tfprintf(fd, \"%sNan (%ld/%ld)\", sep,\n\t\t\t\t    (long) lp[0], (long) lp[1]);\n\t\t\telse\n\t\t\t\tfprintf(fd, srationalfmt, sep,\n\t\t\t\t    (double)lp[0] / (double)lp[1]);\n\t\t\tsep = \" \";\n\t\t\tlp += 2;\n\t\t}\n\t\tbreak;\n\t}\n\tcase TIFF_FLOAT: {\n\t\tfloat *fp = (float *)data;\n\t\twhile (count-- > 0)\n\t\t\tfprintf(fd, floatfmt, sep, *fp++), sep = \" \";\n\t\tbreak;\n\t}\n\tcase TIFF_DOUBLE: {\n\t\tdouble *dp = (double *)data;\n\t\twhile (count-- > 0)\n\t\t\tfprintf(fd, doublefmt, sep, *dp++), sep = \" \";\n\t\tbreak;\n\t}\n\tcase TIFF_IFD: {\n\t\tuint32 *lp = (uint32*)data;\n\t\twhile (count-- > 0) {\n\t\t\tfprintf(fd, ifdfmt, sep, (unsigned long) *lp++);\n\t\t\tsep = \" \";\n\t\t}\n\t\tbreak;\n\t}\n\t}\n}\n\n/*\n * Fetch a contiguous directory item.\n */\nstatic int\nTIFFFetchData(int fd, TIFFDirEntry* dir, void* cp)\n{\n\tint cc, w;\n\n\tw = (dir->tdir_type < NWIDTHS ? datawidth[dir->tdir_type] : 0);\n\tcc = dir->tdir_count * w;\n\tif (lseek(fd, (off_t)dir->tdir_offset, 0) != (off_t)-1\n\t    && read(fd, cp, cc) != -1) {\n\t\tif (swabflag) {\n\t\t\tswitch (dir->tdir_type) {\n\t\t\tcase TIFF_SHORT:\n\t\t\tcase TIFF_SSHORT:\n\t\t\t\tTIFFSwabArrayOfShort((uint16*) cp,\n\t\t\t\t    dir->tdir_count);\n\t\t\t\tbreak;\n\t\t\tcase TIFF_LONG:\n\t\t\tcase TIFF_SLONG:\n\t\t\tcase TIFF_FLOAT:\n\t\t\tcase TIFF_IFD:\n\t\t\t\tTIFFSwabArrayOfLong((uint32*) cp,\n\t\t\t\t    dir->tdir_count);\n\t\t\t\tbreak;\n\t\t\tcase TIFF_RATIONAL:\n\t\t\t\tTIFFSwabArrayOfLong((uint32*) cp,\n\t\t\t\t    2*dir->tdir_count);\n\t\t\t\tbreak;\n\t\t\tcase TIFF_DOUBLE:\n\t\t\t\tTIFFSwabArrayOfDouble((double*) cp,\n\t\t\t\t    dir->tdir_count);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn (cc);\n\t}\n\tError(\"Error while reading data for tag %u\", dir->tdir_tag);\n\treturn (0);\n}\n\nstatic void\nReadError(char* what)\n{\n\tFatal(\"Error while reading %s\", what);\n}\n\n#include <stdarg.h>\n\nstatic void\nvError(FILE* fd, const char* fmt, va_list ap)\n{\n\tfprintf(fd, \"%s: \", curfile);\n\tvfprintf(fd, fmt, ap);\n\tfprintf(fd, \".\\n\");\n}\n\nstatic void\nError(const char* fmt, ...)\n{\n\tva_list ap;\n\tva_start(ap, fmt);\n\tvError(stderr, fmt, ap);\n\tva_end(ap);\n}\n\nstatic void\nFatal(const char* fmt, ...)\n{\n\tva_list ap;\n\tva_start(ap, fmt);\n\tvError(stderr, fmt, ap);\n\tva_end(ap);\n\texit(-1);\n}\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiff/tools/tiffgt.c",
    "content": "/* $Id: tiffgt.c,v 1.7.2.1 2009-08-30 16:21:46 bfriesen Exp $ */\n\n/*\n * Copyright (c) 1988-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n * Copyright (c) 2003, Andrey Kiselev <dron@ak4719.spb.edu>\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n#include \"tif_config.h\"\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <unistd.h>\n\n#if HAVE_APPLE_OPENGL_FRAMEWORK\n# include <OpenGL/gl.h>\n# include <GLUT/glut.h>\n#else\n# include <GL/gl.h>\n# include <GL/glut.h>\n#endif\n\n#include \"tiffio.h\"\n\n#ifndef HAVE_GETOPT\nextern int getopt(int, char**, char*);\n#endif\n\nstatic  uint32  width = 0, height = 0;          /* window width & height */\nstatic  uint32* raster = NULL;                  /* displayable image */\nstatic TIFFRGBAImage img;\nstatic int      order0 = 0, order;\nstatic uint16   photo0 = (uint16) -1, photo;\nstatic int      stoponerr = 0;                  /* stop on read error */\nstatic int      verbose = 0;\n#define TITLE_LENGTH    1024\nstatic char     title[TITLE_LENGTH];            /* window title line */\nstatic uint32   xmax, ymax;\nstatic char**   filelist = NULL;\nstatic int      fileindex;\nstatic int      filenum;\nstatic TIFFErrorHandler oerror;\nstatic TIFFErrorHandler owarning;\n\nstatic void\tcleanup_and_exit(void);\nstatic int\tinitImage(void);\nstatic int\tprevImage(void);\nstatic int\tnextImage(void);\nstatic void\tsetWindowSize(void);\nstatic void\tusage(void);\nstatic uint16\tphotoArg(const char*);\nstatic void\traster_draw(void);\nstatic void\traster_reshape(int, int);\nstatic void\traster_keys(unsigned char, int, int);\nstatic void\traster_special(int, int, int);\n\nextern  char* optarg;\nextern  int optind;\nstatic TIFF* tif = NULL;\n\nint\nmain(int argc, char* argv[])\n{\n        int c;\n        int dirnum = -1;\n        uint32 diroff = 0;\n\n        oerror = TIFFSetErrorHandler(NULL);\n        owarning = TIFFSetWarningHandler(NULL);\n        while ((c = getopt(argc, argv, \"d:o:p:eflmsvw?\")) != -1)\n            switch (c) {\n            case 'd':\n                dirnum = atoi(optarg);\n                break;\n            case 'e':\n                oerror = TIFFSetErrorHandler(oerror);\n                break;\n            case 'l':\n                order0 = FILLORDER_LSB2MSB;\n                break;\n            case 'm':\n                order0 = FILLORDER_MSB2LSB;\n                break;\n            case 'o':\n                diroff = strtoul(optarg, NULL, 0);\n                break;\n            case 'p':\n                photo0 = photoArg(optarg);\n                break;\n            case 's':\n                stoponerr = 1;\n                break;\n            case 'w':\n                owarning = TIFFSetWarningHandler(owarning);\n                break;\n            case 'v':\n                verbose = 1;\n                break;\n            case '?':\n                usage();\n                /*NOTREACHED*/\n            }\n        filenum = argc - optind;\n        if ( filenum < 1)\n                usage();\n\n        glutInit(&argc, argv);\n        glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);\n\n        /*\n         * Get the screen size\n         */\n        xmax = glutGet(GLUT_SCREEN_WIDTH);\n        ymax = glutGet(GLUT_SCREEN_HEIGHT);\n\n        /*\n         * Use 90% of the screen size\n         */\n        xmax = xmax - xmax / 10.0;\n        ymax = ymax - ymax / 10.0;\n\n        filelist = (char **) _TIFFmalloc(filenum * sizeof(char*));\n        if (!filelist) {\n                TIFFError(argv[0], \"Can not allocate space for the file list.\");\n                return 1;\n        }\n        _TIFFmemcpy(filelist, argv + optind, filenum * sizeof(char*));\n        fileindex = -1;\n        if (nextImage() < 0) {\n                _TIFFfree(filelist);\n                return 2;\n        }\n        /*\n         * Set initial directory if user-specified\n         * file was opened successfully.\n         */\n        if (dirnum != -1 && !TIFFSetDirectory(tif, dirnum))\n            TIFFError(argv[0], \"Error, seeking to directory %d\", dirnum);\n        if (diroff != 0 && !TIFFSetSubDirectory(tif, diroff))\n            TIFFError(argv[0], \"Error, setting subdirectory at %#x\", diroff);\n        order = order0;\n        photo = photo0;\n\tif (initImage() < 0){\n                _TIFFfree(filelist);\n                return 3;\n        }\n        /*\n         * Create a new window or reconfigure an existing\n         * one to suit the image to be displayed.\n         */\n        glutInitWindowSize(width, height);\n        snprintf(title, TITLE_LENGTH - 1, \"%s [%u]\", filelist[fileindex],\n                (unsigned int) TIFFCurrentDirectory(tif));\n        glutCreateWindow(title);\n        glutDisplayFunc(raster_draw);\n        glutReshapeFunc(raster_reshape);\n        glutKeyboardFunc(raster_keys);\n        glutSpecialFunc(raster_special);\n        glutMainLoop();\n\n        cleanup_and_exit();\n        return 0;\n}\n\nstatic void \ncleanup_and_exit(void)\n{\n        TIFFRGBAImageEnd(&img);\n        if (filelist != NULL)\n                _TIFFfree(filelist);\n        if (raster != NULL)\n                _TIFFfree(raster);\n        if (tif != NULL)\n                TIFFClose(tif);\n        exit(0);\n}\n\nstatic int\ninitImage(void)\n{\n        uint32 w, h;\n\n        if (order)\n                TIFFSetField(tif, TIFFTAG_FILLORDER, order);\n        if (photo != (uint16) -1)\n                TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, photo);\n        if (!TIFFRGBAImageBegin(&img, tif, stoponerr, title)) {\n                TIFFError(filelist[fileindex], \"%s\", title);\n                TIFFClose(tif);\n                tif = NULL;\n                return -1;\n        }\n\n        /*\n         * Setup the image raster as required.\n         */\n        h = img.height;\n        w = img.width;\n        if (h > ymax) {\n                w = (int)(w * ((float)ymax / h));\n                h = ymax;\n        }\n        if (w > xmax) {\n                h = (int)(h * ((float)xmax / w));\n                w = xmax;\n        }\n\n        if (w != width || h != height) {\n            if (raster != NULL)\n                _TIFFfree(raster), raster = NULL;\n            raster = (uint32*) _TIFFmalloc(img.width * img.height * sizeof (uint32));\n            if (raster == NULL) {\n                width = height = 0;\n                TIFFError(filelist[fileindex], \"No space for raster buffer\");\n                cleanup_and_exit();\n            }\n            width = w;\n            height = h;\n        }\n        TIFFRGBAImageGet(&img, raster, img.width, img.height);\n#if HOST_BIGENDIAN\n        TIFFSwabArrayOfLong(raster,img.width*img.height);\n#endif\n\treturn 0;\n}\n\nstatic int\nprevImage(void)\n{\n        if (fileindex > 0)\n                fileindex--;\n        else if (tif)\n                return fileindex;\n        if (tif)\n                TIFFClose(tif);\n        tif = TIFFOpen(filelist[fileindex], \"r\");\n        if (tif == NULL)\n                return -1;\n        return fileindex;\n}\n\nstatic int\nnextImage(void)\n{\n        if (fileindex < filenum - 1)\n                fileindex++;\n        else if (tif)\n                return fileindex;\n        if (tif)\n                TIFFClose(tif);\n        tif = TIFFOpen(filelist[fileindex], \"r\");\n        if (tif == NULL)\n                return -1;\n        return fileindex;\n}\n\nstatic void\nsetWindowSize(void)\n{\n        glutReshapeWindow(width, height);\n}\n\nstatic void\nraster_draw(void)\n{\n  glDrawPixels(img.width, img.height, GL_RGBA, GL_UNSIGNED_BYTE, (const GLvoid *) raster);\n}\n\nstatic void\nraster_reshape(int win_w, int win_h)\n{\n        GLfloat xratio = (GLfloat)win_w/img.width;\n        GLfloat yratio = (GLfloat)win_h/img.height;\n        int     ratio = (int)(((xratio > yratio)?xratio:yratio) * 100);\n\n        glPixelZoom(xratio, yratio);\n        glViewport(0, 0, win_w, win_h);\n        snprintf(title, 1024, \"%s [%u] %d%%\", filelist[fileindex],\n                (unsigned int) TIFFCurrentDirectory(tif), ratio);\n        glutSetWindowTitle(title);\n}\n\nstatic void\nraster_keys(unsigned char key, int x, int y)\n{\n        switch (key) {\n                case 'b':                       /* photometric MinIsBlack */\n                    photo = PHOTOMETRIC_MINISBLACK;\n                    initImage();\n                    break;\n                case 'l':                       /* lsb-to-msb FillOrder */\n                    order = FILLORDER_LSB2MSB;\n                    initImage();\n                    break;\n                case 'm':                       /* msb-to-lsb FillOrder */\n                    order = FILLORDER_MSB2LSB;\n                    initImage();\n                    break;\n                case 'w':                       /* photometric MinIsWhite */\n                    photo = PHOTOMETRIC_MINISWHITE;\n                    initImage();\n                    break;\n                case 'W':                       /* toggle warnings */\n                    owarning = TIFFSetWarningHandler(owarning);\n                    initImage();\n                    break;\n                case 'E':                       /* toggle errors */\n                    oerror = TIFFSetErrorHandler(oerror);\n                    initImage();\n                    break;\n                case 'z':                       /* reset to defaults */\n                case 'Z':\n                    order = order0;\n                    photo = photo0;\n                    if (owarning == NULL)\n                        owarning = TIFFSetWarningHandler(NULL);\n                    if (oerror == NULL)\n                        oerror = TIFFSetErrorHandler(NULL);\n                    initImage();\n                    break;\n                case 'q':                       /* exit */\n                case '\\033':\n                    cleanup_and_exit();\n        }\n        glutPostRedisplay();\n}\n\nstatic void\nraster_special(int key, int x, int y)\n{\n        switch (key) {\n                case GLUT_KEY_PAGE_UP:          /* previous logical image */\n                    if (TIFFCurrentDirectory(tif) > 0) {\n                            if (TIFFSetDirectory(tif,\n                                                 TIFFCurrentDirectory(tif)-1)) {\n                                    initImage();\n                                    setWindowSize();\n                        }\n                    } else {\n                            TIFFRGBAImageEnd(&img);\n                            prevImage();\n                            initImage();\n                            setWindowSize();\n                    }\n                break;\n                case GLUT_KEY_PAGE_DOWN:        /* next logical image */\n                    if (!TIFFLastDirectory(tif)) {\n                            if (TIFFReadDirectory(tif)) {\n                                    initImage();\n                                    setWindowSize();\n                            }\n                    } else {\n                            TIFFRGBAImageEnd(&img);\n                            nextImage();\n                            initImage();\n                            setWindowSize();\n                    }\n                break;\n                case GLUT_KEY_HOME:             /* 1st image in current file */\n                        if (TIFFSetDirectory(tif, 0)) {\n                                TIFFRGBAImageEnd(&img);\n                                initImage();\n                                setWindowSize();\n                        }\n                break;\n                case GLUT_KEY_END:              /* last image in current file */\n                        TIFFRGBAImageEnd(&img);\n                        while (!TIFFLastDirectory(tif))\n                                TIFFReadDirectory(tif);\n                        initImage();\n                        setWindowSize();\n                break;\n        }\n        glutPostRedisplay();\n}\n\n\n\nchar* stuff[] = {\n\"usage: tiffgt [options] file.tif\",\n\"where options are:\",\n\" -c            use colormap visual\",\n\" -d dirnum     set initial directory (default is 0)\",\n\" -e            enable display of TIFF error messages\",\n\" -l            force lsb-to-msb FillOrder\",\n\" -m            force msb-to-lsb FillOrder\",\n\" -o offset     set initial directory offset\",\n\" -p photo      override photometric interpretation\",\n\" -r            use fullcolor visual\",\n\" -s            stop decoding on first error (default is ignore errors)\",\n\" -v            enable verbose mode\",\n\" -w            enable display of TIFF warning messages\",\nNULL\n};\n\nstatic void\nusage(void)\n{\n        char buf[BUFSIZ];\n        int i;\n\n        setbuf(stderr, buf);\n                fprintf(stderr, \"%s\\n\\n\", TIFFGetVersion());\n        for (i = 0; stuff[i] != NULL; i++)\n                fprintf(stderr, \"%s\\n\", stuff[i]);\n        exit(-1);\n}\n\nstatic uint16\nphotoArg(const char* arg)\n{\n        if (strcmp(arg, \"miniswhite\") == 0)\n            return (PHOTOMETRIC_MINISWHITE);\n        else if (strcmp(arg, \"minisblack\") == 0)\n            return (PHOTOMETRIC_MINISBLACK);\n        else if (strcmp(arg, \"rgb\") == 0)\n            return (PHOTOMETRIC_RGB);\n        else if (strcmp(arg, \"palette\") == 0)\n            return (PHOTOMETRIC_PALETTE);\n        else if (strcmp(arg, \"mask\") == 0)\n            return (PHOTOMETRIC_MASK);\n        else if (strcmp(arg, \"separated\") == 0)\n            return (PHOTOMETRIC_SEPARATED);\n        else if (strcmp(arg, \"ycbcr\") == 0)\n            return (PHOTOMETRIC_YCBCR);\n        else if (strcmp(arg, \"cielab\") == 0)\n            return (PHOTOMETRIC_CIELAB);\n        else if (strcmp(arg, \"logl\") == 0)\n            return (PHOTOMETRIC_LOGL);\n        else if (strcmp(arg, \"logluv\") == 0)\n            return (PHOTOMETRIC_LOGLUV);\n        else\n            return ((uint16) -1);\n}\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiff/tools/tiffinfo.c",
    "content": "/* $Id: tiffinfo.c,v 1.8 2005/12/09 14:52:48 dron Exp $ */\n\n/*\n * Copyright (c) 1988-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n#include \"tif_config.h\"\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n#ifdef HAVE_STRINGS_H\n# include <strings.h>\n#endif\n\n#ifdef HAVE_UNISTD_H\n# include <unistd.h>\n#endif\n\n#include \"tiffio.h\"\n\n#define\tstreq(a,b)\t(strcasecmp(a,b) == 0)\n\nint\tshowdata = 0;\t\t\t/* show data */\nint\trawdata = 0;\t\t\t/* show raw/decoded data */\nint\tshowwords = 0;\t\t\t/* show data as bytes/words */\nint\treaddata = 0;\t\t\t/* read data in file */\nint\tstoponerr = 1;\t\t\t/* stop on first read error */\n\nstatic\tvoid usage(void);\nstatic\tvoid tiffinfo(TIFF*, uint16, long);\n\nint\nmain(int argc, char* argv[])\n{\n\tint dirnum = -1, multiplefiles, c;\n\tuint16 order = 0;\n\tTIFF* tif;\n\textern int optind;\n\textern char* optarg;\n\tlong flags = 0;\n\tuint32 diroff = 0;\n\tint chopstrips = 0;\t\t/* disable strip chopping */\n\n\twhile ((c = getopt(argc, argv, \"f:o:cdDSjilmrsvwz0123456789\")) != -1)\n\t\tswitch (c) {\n\t\tcase '0': case '1': case '2': case '3':\n\t\tcase '4': case '5': case '6': case '7':\n\t\tcase '8': case '9':\n\t\t\tdirnum = atoi(&argv[optind-1][1]);\n\t\t\tbreak;\n\t\tcase 'd':\n\t\t\tshowdata++;\n\t\t\t/* fall thru... */\n\t\tcase 'D':\n\t\t\treaddata++;\n\t\t\tbreak;\n\t\tcase 'c':\n\t\t\tflags |= TIFFPRINT_COLORMAP | TIFFPRINT_CURVES;\n\t\t\tbreak;\n\t\tcase 'f':\t\t/* fill order */\n\t\t\tif (streq(optarg, \"lsb2msb\"))\n\t\t\t\torder = FILLORDER_LSB2MSB;\n\t\t\telse if (streq(optarg, \"msb2lsb\"))\n\t\t\t\torder = FILLORDER_MSB2LSB;\n\t\t\telse\n\t\t\t\tusage();\n\t\t\tbreak;\n\t\tcase 'i':\n\t\t\tstoponerr = 0;\n\t\t\tbreak;\n\t\tcase 'o':\n\t\t\tdiroff = strtoul(optarg, NULL, 0);\n\t\t\tbreak;\n\t\tcase 'j':\n\t\t\tflags |= TIFFPRINT_JPEGQTABLES |\n\t\t\t\t TIFFPRINT_JPEGACTABLES |\n\t\t\t\t TIFFPRINT_JPEGDCTABLES;\n\t\t\tbreak;\n\t\tcase 'r':\n\t\t\trawdata = 1;\n\t\t\tbreak;\n\t\tcase 's':\n\t\t\tflags |= TIFFPRINT_STRIPS;\n\t\t\tbreak;\n\t\tcase 'w':\n\t\t\tshowwords = 1;\n\t\t\tbreak;\n\t\tcase 'z':\n\t\t\tchopstrips = 1;\n\t\t\tbreak;\n\t\tcase '?':\n\t\t\tusage();\n\t\t\t/*NOTREACHED*/\n\t\t}\n\tif (optind >= argc)\n\t\tusage();\n\tmultiplefiles = (argc - optind > 1);\n\tfor (; optind < argc; optind++) {\n\t\tif (multiplefiles)\n\t\t\tprintf(\"%s:\\n\", argv[optind]);\n\t\ttif = TIFFOpen(argv[optind], chopstrips ? \"rC\" : \"rc\");\n\t\tif (tif != NULL) {\n\t\t\tif (dirnum != -1) {\n\t\t\t\tif (TIFFSetDirectory(tif, (tdir_t) dirnum))\n\t\t\t\t\ttiffinfo(tif, order, flags);\n\t\t\t} else if (diroff != 0) {\n\t\t\t\tif (TIFFSetSubDirectory(tif, diroff))\n\t\t\t\t\ttiffinfo(tif, order, flags);\n\t\t\t} else {\n\t\t\t\tdo {\n\t\t\t\t\tuint32 offset;\n\n\t\t\t\t\ttiffinfo(tif, order, flags);\n\t\t\t\t\tif (TIFFGetField(tif, TIFFTAG_EXIFIFD,\n\t\t\t\t\t\t\t &offset)) {\n\t\t\t\t\t\tif (TIFFReadEXIFDirectory(tif, offset))\n\t\t\t\t\t\t\ttiffinfo(tif, order, flags);\n\t\t\t\t\t}\n\t\t\t\t} while (TIFFReadDirectory(tif));\n\t\t\t}\n\t\t\tTIFFClose(tif);\n\t\t}\n\t}\n\treturn (0);\n}\n\nchar* stuff[] = {\n\"usage: tiffinfo [options] input...\",\n\"where options are:\",\n\" -D\t\tread data\",\n\" -i\t\tignore read errors\",\n\" -c\t\tdisplay data for grey/color response curve or colormap\",\n\" -d\t\tdisplay raw/decoded image data\",\n\" -f lsb2msb\tforce lsb-to-msb FillOrder for input\",\n\" -f msb2lsb\tforce msb-to-lsb FillOrder for input\",\n\" -j\t\tshow JPEG tables\",\n\" -o offset\tset initial directory offset\",\n\" -r\t\tread/display raw image data instead of decoded data\",\n\" -s\t\tdisplay strip offsets and byte counts\",\n\" -w\t\tdisplay raw data in words rather than bytes\",\n\" -z\t\tenable strip chopping\",\n\" -#\t\tset initial directory (first directory is # 0)\",\nNULL\n};\n\nstatic void\nusage(void)\n{\n\tchar buf[BUFSIZ];\n\tint i;\n\n\tsetbuf(stderr, buf);\n        fprintf(stderr, \"%s\\n\\n\", TIFFGetVersion());\n\tfor (i = 0; stuff[i] != NULL; i++)\n\t\tfprintf(stderr, \"%s\\n\", stuff[i]);\n\texit(-1);\n}\n\nstatic void\nShowStrip(tstrip_t strip, unsigned char* pp, uint32 nrow, tsize_t scanline)\n{\n\tregister tsize_t cc;\n\n\tprintf(\"Strip %lu:\\n\", (unsigned long) strip);\n\twhile (nrow-- > 0) {\n\t\tfor (cc = 0; cc < scanline; cc++) {\n\t\t\tprintf(\" %02x\", *pp++);\n\t\t\tif (((cc+1) % 24) == 0)\n\t\t\t\tputchar('\\n');\n\t\t}\n\t\tputchar('\\n');\n\t}\n}\n\nvoid\nTIFFReadContigStripData(TIFF* tif)\n{\n\tunsigned char *buf;\n\ttsize_t scanline = TIFFScanlineSize(tif);\n\n\tbuf = (unsigned char *)_TIFFmalloc(TIFFStripSize(tif));\n\tif (buf) {\n\t\tuint32 row, h;\n\t\tuint32 rowsperstrip = (uint32)-1;\n\n\t\tTIFFGetField(tif, TIFFTAG_IMAGELENGTH, &h);\n\t\tTIFFGetField(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);\n\t\tfor (row = 0; row < h; row += rowsperstrip) {\n\t\t\tuint32 nrow = (row+rowsperstrip > h ?\n\t\t\t    h-row : rowsperstrip);\n\t\t\ttstrip_t strip = TIFFComputeStrip(tif, row, 0);\n\t\t\tif (TIFFReadEncodedStrip(tif, strip, buf, nrow*scanline) < 0) {\n\t\t\t\tif (stoponerr)\n\t\t\t\t\tbreak;\n\t\t\t} else if (showdata)\n\t\t\t\tShowStrip(strip, buf, nrow, scanline);\n\t\t}\n\t\t_TIFFfree(buf);\n\t}\n}\n\nvoid\nTIFFReadSeparateStripData(TIFF* tif)\n{\n\tunsigned char *buf;\n\ttsize_t scanline = TIFFScanlineSize(tif);\n\n\tbuf = (unsigned char *)_TIFFmalloc(TIFFStripSize(tif));\n\tif (buf) {\n\t\tuint32 row, h;\n\t\tuint32 rowsperstrip = (uint32)-1;\n\t\ttsample_t s, samplesperpixel;\n\n\t\tTIFFGetField(tif, TIFFTAG_IMAGELENGTH, &h);\n\t\tTIFFGetField(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);\n\t\tTIFFGetField(tif, TIFFTAG_SAMPLESPERPIXEL, &samplesperpixel);\n\t\tfor (row = 0; row < h; row += rowsperstrip) {\n\t\t\tfor (s = 0; s < samplesperpixel; s++) {\n\t\t\t\tuint32 nrow = (row+rowsperstrip > h ?\n\t\t\t\t    h-row : rowsperstrip);\n\t\t\t\ttstrip_t strip = TIFFComputeStrip(tif, row, s);\n\t\t\t\tif (TIFFReadEncodedStrip(tif, strip, buf, nrow*scanline) < 0) {\n\t\t\t\t\tif (stoponerr)\n\t\t\t\t\t\tbreak;\n\t\t\t\t} else if (showdata)\n\t\t\t\t\tShowStrip(strip, buf, nrow, scanline);\n\t\t\t}\n\t\t}\n\t\t_TIFFfree(buf);\n\t}\n}\n\nstatic void\nShowTile(uint32 row, uint32 col, tsample_t sample,\n    unsigned char* pp, uint32 nrow, uint32 rowsize)\n{\n\tuint32 cc;\n\n\tprintf(\"Tile (%lu,%lu\", (unsigned long) row, (unsigned long) col);\n\tif (sample != (tsample_t) -1)\n\t\tprintf(\",%u\", sample);\n\tprintf(\"):\\n\");\n\twhile (nrow-- > 0) {\n\t\tfor (cc = 0; cc < rowsize; cc++) {\n\t\t\tprintf(\" %02x\", *pp++);\n\t\t\tif (((cc+1) % 24) == 0)\n\t\t\t\tputchar('\\n');\n\t\t}\n\t\tputchar('\\n');\n\t}\n}\n\nvoid\nTIFFReadContigTileData(TIFF* tif)\n{\n\tunsigned char *buf;\n\ttsize_t rowsize = TIFFTileRowSize(tif);\n\n\tbuf = (unsigned char *)_TIFFmalloc(TIFFTileSize(tif));\n\tif (buf) {\n\t\tuint32 tw, th, w, h;\n\t\tuint32 row, col;\n\n\t\tTIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &w);\n\t\tTIFFGetField(tif, TIFFTAG_IMAGELENGTH, &h);\n\t\tTIFFGetField(tif, TIFFTAG_TILEWIDTH, &tw);\n\t\tTIFFGetField(tif, TIFFTAG_TILELENGTH, &th);\n\t\tfor (row = 0; row < h; row += th) {\n\t\t\tfor (col = 0; col < w; col += tw) {\n\t\t\t\tif (TIFFReadTile(tif, buf, col, row, 0, 0) < 0) {\n\t\t\t\t\tif (stoponerr)\n\t\t\t\t\t\tbreak;\n\t\t\t\t} else if (showdata)\n\t\t\t\t\tShowTile(row, col, (tsample_t) -1, buf, th, rowsize);\n\t\t\t}\n\t\t}\n\t\t_TIFFfree(buf);\n\t}\n}\n\nvoid\nTIFFReadSeparateTileData(TIFF* tif)\n{\n\tunsigned char *buf;\n\ttsize_t rowsize = TIFFTileRowSize(tif);\n\n\tbuf = (unsigned char *)_TIFFmalloc(TIFFTileSize(tif));\n\tif (buf) {\n\t\tuint32 tw, th, w, h;\n\t\tuint32 row, col;\n\t\ttsample_t s, samplesperpixel;\n\n\t\tTIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &w);\n\t\tTIFFGetField(tif, TIFFTAG_IMAGELENGTH, &h);\n\t\tTIFFGetField(tif, TIFFTAG_TILEWIDTH, &tw);\n\t\tTIFFGetField(tif, TIFFTAG_TILELENGTH, &th);\n\t\tTIFFGetField(tif, TIFFTAG_SAMPLESPERPIXEL, &samplesperpixel);\n\t\tfor (row = 0; row < h; row += th) {\n\t\t\tfor (col = 0; col < w; col += tw) {\n\t\t\t\tfor (s = 0; s < samplesperpixel; s++) {\n\t\t\t\t\tif (TIFFReadTile(tif, buf, col, row, 0, s) < 0) {\n\t\t\t\t\t\tif (stoponerr)\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t} else if (showdata)\n\t\t\t\t\t\tShowTile(row, col, s, buf, th, rowsize);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t_TIFFfree(buf);\n\t}\n}\n\nvoid\nTIFFReadData(TIFF* tif)\n{\n\tuint16 config;\n\n\tTIFFGetField(tif, TIFFTAG_PLANARCONFIG, &config);\n\tif (TIFFIsTiled(tif)) {\n\t\tif (config == PLANARCONFIG_CONTIG)\n\t\t\tTIFFReadContigTileData(tif);\n\t\telse\n\t\t\tTIFFReadSeparateTileData(tif);\n\t} else {\n\t\tif (config == PLANARCONFIG_CONTIG)\n\t\t\tTIFFReadContigStripData(tif);\n\t\telse\n\t\t\tTIFFReadSeparateStripData(tif);\n\t}\n}\n\nstatic void\nShowRawBytes(unsigned char* pp, uint32 n)\n{\n\tuint32 i;\n\n\tfor (i = 0; i < n; i++) {\n\t\tprintf(\" %02x\", *pp++);\n\t\tif (((i+1) % 24) == 0)\n\t\t\tprintf(\"\\n \");\n\t}\n\tputchar('\\n');\n}\n\nstatic void\nShowRawWords(uint16* pp, uint32 n)\n{\n\tuint32 i;\n\n\tfor (i = 0; i < n; i++) {\n\t\tprintf(\" %04x\", *pp++);\n\t\tif (((i+1) % 15) == 0)\n\t\t\tprintf(\"\\n \");\n\t}\n\tputchar('\\n');\n}\n\nvoid\nTIFFReadRawData(TIFF* tif, int bitrev)\n{\n\ttstrip_t nstrips = TIFFNumberOfStrips(tif);\n\tconst char* what = TIFFIsTiled(tif) ? \"Tile\" : \"Strip\";\n\tuint32* stripbc;\n\n\tTIFFGetField(tif, TIFFTAG_STRIPBYTECOUNTS, &stripbc);\n\tif (nstrips > 0) {\n\t\tuint32 bufsize = stripbc[0];\n\t\ttdata_t buf = _TIFFmalloc(bufsize);\n\t\ttstrip_t s;\n\n\t\tfor (s = 0; s < nstrips; s++) {\n\t\t\tif (stripbc[s] > bufsize) {\n\t\t\t\tbuf = _TIFFrealloc(buf, stripbc[s]);\n\t\t\t\tbufsize = stripbc[s];\n\t\t\t}\n\t\t\tif (buf == NULL) {\n\t\t\t\tfprintf(stderr,\n\t\t\t\t   \"Cannot allocate buffer to read strip %lu\\n\",\n\t\t\t\t    (unsigned long) s);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (TIFFReadRawStrip(tif, s, buf, stripbc[s]) < 0) {\n\t\t\t\tfprintf(stderr, \"Error reading strip %lu\\n\",\n\t\t\t\t    (unsigned long) s);\n\t\t\t\tif (stoponerr)\n\t\t\t\t\tbreak;\n\t\t\t} else if (showdata) {\n\t\t\t\tif (bitrev) {\n\t\t\t\t\tTIFFReverseBits(buf, stripbc[s]);\n\t\t\t\t\tprintf(\"%s %lu: (bit reversed)\\n \",\n\t\t\t\t\t    what, (unsigned long) s);\n\t\t\t\t} else\n\t\t\t\t\tprintf(\"%s %lu:\\n \", what,\n\t\t\t\t\t    (unsigned long) s);\n\t\t\t\tif (showwords)\n\t\t\t\t\tShowRawWords((uint16*) buf, stripbc[s]>>1);\n\t\t\t\telse\n\t\t\t\t\tShowRawBytes((unsigned char*) buf, stripbc[s]);\n\t\t\t}\n\t\t}\n\t\tif (buf != NULL)\n\t\t\t_TIFFfree(buf);\n\t}\n}\n\nstatic void\ntiffinfo(TIFF* tif, uint16 order, long flags)\n{\n\tTIFFPrintDirectory(tif, stdout, flags);\n\tif (!readdata)\n\t\treturn;\n\tif (rawdata) {\n\t\tif (order) {\n\t\t\tuint16 o;\n\t\t\tTIFFGetFieldDefaulted(tif,\n\t\t\t    TIFFTAG_FILLORDER, &o);\n\t\t\tTIFFReadRawData(tif, o != order);\n\t\t} else\n\t\t\tTIFFReadRawData(tif, 0);\n\t} else {\n\t\tif (order)\n\t\t\tTIFFSetField(tif, TIFFTAG_FILLORDER, order);\n\t\tTIFFReadData(tif);\n\t}\n}\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiff/tools/tiffmedian.c",
    "content": "/* $Id: tiffmedian.c,v 1.8 2004/09/09 18:06:14 fwarmerdam Exp $ */\n\n/*\n * Apply median cut on an image.\n *\n * tiffmedian [-c n] [-f] input output\n *     -C n\t\t- set colortable size.  Default is 256.\n *     -f\t\t- use Floyd-Steinberg dithering.\n *     -c lzw\t\t- compress output with LZW \n *     -c none\t\t- use no compression on output\n *     -c packbits\t- use packbits compression on output\n *     -r n\t\t- create output with n rows/strip of data\n * (by default the compression scheme and rows/strip are taken\n *  from the input file)\n *\n * Notes:\n *\n * [1] Floyd-Steinberg dither:\n *  I should point out that the actual fractions we used were, assuming\n *  you are at X, moving left to right:\n *\n *\t\t    X     7/16\n *\t     3/16   5/16  1/16    \n *\n *  Note that the error goes to four neighbors, not three.  I think this\n *  will probably do better (at least for black and white) than the\n *  3/8-3/8-1/4 distribution, at the cost of greater processing.  I have\n *  seen the 3/8-3/8-1/4 distribution described as \"our\" algorithm before,\n *  but I have no idea who the credit really belongs to.\n\n *  Also, I should add that if you do zig-zag scanning (see my immediately\n *  previous message), it is sufficient (but not quite as good) to send\n *  half the error one pixel ahead (e.g. to the right on lines you scan\n *  left to right), and half one pixel straight down.  Again, this is for\n *  black and white;  I've not tried it with color.\n *  -- \n *\t\t\t\t\t    Lou Steinberg\n *\n * [2] Color Image Quantization for Frame Buffer Display, Paul Heckbert,\n *\tSiggraph '82 proceedings, pp. 297-307\n */\n\n#include \"tif_config.h\"\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n#ifdef HAVE_UNISTD_H\n# include <unistd.h>\n#endif\n\n#include \"tiffio.h\"\n\n#define\tMAX_CMAP_SIZE\t256\n\n#define\tstreq(a,b)\t(strcmp(a,b) == 0)\n#define\tstrneq(a,b,n)\t(strncmp(a,b,n) == 0)\n\n#define\tCOLOR_DEPTH\t8\n#define\tMAX_COLOR\t256\n\n#define\tB_DEPTH\t\t5\t\t/* # bits/pixel to use */\n#define\tB_LEN\t\t(1L<<B_DEPTH)\n\n#define\tC_DEPTH\t\t2\n#define\tC_LEN\t\t(1L<<C_DEPTH)\t/* # cells/color to use */\n\n#define\tCOLOR_SHIFT\t(COLOR_DEPTH-B_DEPTH)\n\ntypedef\tstruct colorbox {\n\tstruct\tcolorbox *next, *prev;\n\tint\trmin, rmax;\n\tint\tgmin, gmax;\n\tint\tbmin, bmax;\n\tuint32\ttotal;\n} Colorbox;\n\ntypedef struct {\n\tint\tnum_ents;\n\tint\tentries[MAX_CMAP_SIZE][2];\n} C_cell;\n\nuint16\trm[MAX_CMAP_SIZE], gm[MAX_CMAP_SIZE], bm[MAX_CMAP_SIZE];\nint\tnum_colors;\nuint32\thistogram[B_LEN][B_LEN][B_LEN];\nColorbox *freeboxes;\nColorbox *usedboxes;\nC_cell\t**ColorCells;\nTIFF\t*in, *out;\nuint32\trowsperstrip = (uint32) -1;\nuint16\tcompression = (uint16) -1;\nuint16\tbitspersample = 1;\nuint16\tsamplesperpixel;\nuint32\timagewidth;\nuint32\timagelength;\nuint16\tpredictor = 0;\n\nstatic\tvoid get_histogram(TIFF*, Colorbox*);\nstatic\tvoid splitbox(Colorbox*);\nstatic\tvoid shrinkbox(Colorbox*);\nstatic\tvoid map_colortable(void);\nstatic\tvoid quant(TIFF*, TIFF*);\nstatic\tvoid quant_fsdither(TIFF*, TIFF*);\nstatic\tColorbox* largest_box(void);\n\nstatic\tvoid usage(void);\nstatic\tint processCompressOptions(char*);\n\n#define\tCopyField(tag, v) \\\n\tif (TIFFGetField(in, tag, &v)) TIFFSetField(out, tag, v)\n\nint\nmain(int argc, char* argv[])\n{\n\tint i, dither = 0;\n\tuint16 shortv, config, photometric;\n\tColorbox *box_list, *ptr;\n\tfloat floatv;\n\tuint32 longv;\n\tint c;\n\textern int optind;\n\textern char* optarg;\n\n\tnum_colors = MAX_CMAP_SIZE;\n\twhile ((c = getopt(argc, argv, \"c:C:r:f\")) != -1)\n\t\tswitch (c) {\n\t\tcase 'c':\t\t/* compression scheme */\n\t\t\tif (!processCompressOptions(optarg))\n\t\t\t\tusage();\n\t\t\tbreak;\n\t\tcase 'C':\t\t/* set colormap size */\n\t\t\tnum_colors = atoi(optarg);\n\t\t\tif (num_colors > MAX_CMAP_SIZE) {\n\t\t\t\tfprintf(stderr,\n\t\t\t\t   \"-c: colormap too big, max %d\\n\",\n\t\t\t\t   MAX_CMAP_SIZE);\n\t\t\t\tusage();\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 'f':\t\t/* dither */\n\t\t\tdither = 1;\n\t\t\tbreak;\n\t\tcase 'r':\t\t/* rows/strip */\n\t\t\trowsperstrip = atoi(optarg);\n\t\t\tbreak;\n\t\tcase '?':\n\t\t\tusage();\n\t\t\t/*NOTREACHED*/\n\t\t}\n\tif (argc - optind != 2)\n\t\tusage();\n\tin = TIFFOpen(argv[optind], \"r\");\n\tif (in == NULL)\n\t\treturn (-1);\n\tTIFFGetField(in, TIFFTAG_IMAGEWIDTH, &imagewidth);\n\tTIFFGetField(in, TIFFTAG_IMAGELENGTH, &imagelength);\n\tTIFFGetField(in, TIFFTAG_BITSPERSAMPLE, &bitspersample);\n\tTIFFGetField(in, TIFFTAG_SAMPLESPERPIXEL, &samplesperpixel);\n\tif (bitspersample != 8 && bitspersample != 16) {\n\t\tfprintf(stderr, \"%s: Image must have at least 8-bits/sample\\n\",\n\t\t    argv[optind]);\n\t\treturn (-3);\n\t}\n\tif (!TIFFGetField(in, TIFFTAG_PHOTOMETRIC, &photometric) ||\n\t    photometric != PHOTOMETRIC_RGB || samplesperpixel < 3) {\n\t\tfprintf(stderr, \"%s: Image must have RGB data\\n\", argv[optind]);\n\t\treturn (-4);\n\t}\n\tTIFFGetField(in, TIFFTAG_PLANARCONFIG, &config);\n\tif (config != PLANARCONFIG_CONTIG) {\n\t\tfprintf(stderr, \"%s: Can only handle contiguous data packing\\n\",\n\t\t    argv[optind]);\n\t\treturn (-5);\n\t}\n\n\t/*\n\t * STEP 1:  create empty boxes\n\t */\n\tusedboxes = NULL;\n\tbox_list = freeboxes = (Colorbox *)_TIFFmalloc(num_colors*sizeof (Colorbox));\n\tfreeboxes[0].next = &freeboxes[1];\n\tfreeboxes[0].prev = NULL;\n\tfor (i = 1; i < num_colors-1; ++i) {\n\t\tfreeboxes[i].next = &freeboxes[i+1];\n\t\tfreeboxes[i].prev = &freeboxes[i-1];\n\t}\n\tfreeboxes[num_colors-1].next = NULL;\n\tfreeboxes[num_colors-1].prev = &freeboxes[num_colors-2];\n\n\t/*\n\t * STEP 2: get histogram, initialize first box\n\t */\n\tptr = freeboxes;\n\tfreeboxes = ptr->next;\n\tif (freeboxes)\n\t\tfreeboxes->prev = NULL;\n\tptr->next = usedboxes;\n\tusedboxes = ptr;\n\tif (ptr->next)\n\t\tptr->next->prev = ptr;\n\tget_histogram(in, ptr);\n\n\t/*\n\t * STEP 3: continually subdivide boxes until no more free\n\t * boxes remain or until all colors assigned.\n\t */\n\twhile (freeboxes != NULL) {\n\t\tptr = largest_box();\n\t\tif (ptr != NULL)\n\t\t\tsplitbox(ptr);\n\t\telse\n\t\t\tfreeboxes = NULL;\n\t}\n\n\t/*\n\t * STEP 4: assign colors to all boxes\n\t */\n\tfor (i = 0, ptr = usedboxes; ptr != NULL; ++i, ptr = ptr->next) {\n\t\trm[i] = ((ptr->rmin + ptr->rmax) << COLOR_SHIFT) / 2;\n\t\tgm[i] = ((ptr->gmin + ptr->gmax) << COLOR_SHIFT) / 2;\n\t\tbm[i] = ((ptr->bmin + ptr->bmax) << COLOR_SHIFT) / 2;\n\t}\n\n\t/* We're done with the boxes now */\n\t_TIFFfree(box_list);\n\tfreeboxes = usedboxes = NULL;\n\n\t/*\n\t * STEP 5: scan histogram and map all values to closest color\n\t */\n\t/* 5a: create cell list as described in Heckbert[2] */\n\tColorCells = (C_cell **)_TIFFmalloc(C_LEN*C_LEN*C_LEN*sizeof (C_cell*));\n\t_TIFFmemset(ColorCells, 0, C_LEN*C_LEN*C_LEN*sizeof (C_cell*));\n\t/* 5b: create mapping from truncated pixel space to color\n\t   table entries */\n\tmap_colortable();\n\n\t/*\n\t * STEP 6: scan image, match input values to table entries\n\t */\n\tout = TIFFOpen(argv[optind+1], \"w\");\n\tif (out == NULL)\n\t\treturn (-2);\n\n\tCopyField(TIFFTAG_SUBFILETYPE, longv);\n\tCopyField(TIFFTAG_IMAGEWIDTH, longv);\n\tTIFFSetField(out, TIFFTAG_BITSPERSAMPLE, (short)COLOR_DEPTH);\n\tif (compression != (uint16)-1) {\n\t\tTIFFSetField(out, TIFFTAG_COMPRESSION, compression);\n\t\tswitch (compression) {\n\t\tcase COMPRESSION_LZW:\n\t\tcase COMPRESSION_DEFLATE:\n\t\t\tif (predictor != 0)\n\t\t\t\tTIFFSetField(out, TIFFTAG_PREDICTOR, predictor);\n\t\t\tbreak;\n\t\t}\n\t} else\n\t\tCopyField(TIFFTAG_COMPRESSION, compression);\n\tTIFFSetField(out, TIFFTAG_PHOTOMETRIC, (short)PHOTOMETRIC_PALETTE);\n\tCopyField(TIFFTAG_ORIENTATION, shortv);\n\tTIFFSetField(out, TIFFTAG_SAMPLESPERPIXEL, (short)1);\n\tCopyField(TIFFTAG_PLANARCONFIG, shortv);\n\tTIFFSetField(out, TIFFTAG_ROWSPERSTRIP,\n\t    TIFFDefaultStripSize(out, rowsperstrip));\n\tCopyField(TIFFTAG_MINSAMPLEVALUE, shortv);\n\tCopyField(TIFFTAG_MAXSAMPLEVALUE, shortv);\n\tCopyField(TIFFTAG_RESOLUTIONUNIT, shortv);\n\tCopyField(TIFFTAG_XRESOLUTION, floatv);\n\tCopyField(TIFFTAG_YRESOLUTION, floatv);\n\tCopyField(TIFFTAG_XPOSITION, floatv);\n\tCopyField(TIFFTAG_YPOSITION, floatv);\n\n\tif (dither)\n\t\tquant_fsdither(in, out);\n\telse\n\t\tquant(in, out);\n\t/*\n\t * Scale colormap to TIFF-required 16-bit values.\n\t */\n#define\tSCALE(x)\t(((x)*((1L<<16)-1))/255)\n\tfor (i = 0; i < MAX_CMAP_SIZE; ++i) {\n\t\trm[i] = SCALE(rm[i]);\n\t\tgm[i] = SCALE(gm[i]);\n\t\tbm[i] = SCALE(bm[i]);\n\t}\n\tTIFFSetField(out, TIFFTAG_COLORMAP, rm, gm, bm);\n\t(void) TIFFClose(out);\n\treturn (0);\n}\n\nstatic int\nprocessCompressOptions(char* opt)\n{\n\tif (streq(opt, \"none\"))\n\t\tcompression = COMPRESSION_NONE;\n\telse if (streq(opt, \"packbits\"))\n\t\tcompression = COMPRESSION_PACKBITS;\n\telse if (strneq(opt, \"lzw\", 3)) {\n\t\tchar* cp = strchr(opt, ':');\n\t\tif (cp)\n\t\t\tpredictor = atoi(cp+1);\n\t\tcompression = COMPRESSION_LZW;\n\t} else if (strneq(opt, \"zip\", 3)) {\n\t\tchar* cp = strchr(opt, ':');\n\t\tif (cp)\n\t\t\tpredictor = atoi(cp+1);\n\t\tcompression = COMPRESSION_DEFLATE;\n\t} else\n\t\treturn (0);\n\treturn (1);\n}\n\nchar* stuff[] = {\n\"usage: tiffmedian [options] input.tif output.tif\",\n\"where options are:\",\n\" -r #\t\tmake each strip have no more than # rows\",\n\" -C #\t\tcreate a colormap with # entries\",\n\" -f\t\tuse Floyd-Steinberg dithering\",\n\" -c lzw[:opts]\tcompress output with Lempel-Ziv & Welch encoding\",\n\" -c zip[:opts]\tcompress output with deflate encoding\",\n\" -c packbits\tcompress output with packbits encoding\",\n\" -c none\tuse no compression algorithm on output\",\n\"\",\n\"LZW and deflate options:\",\n\" #\t\tset predictor value\",\n\"For example, -c lzw:2 to get LZW-encoded data with horizontal differencing\",\nNULL\n};\n\nstatic void\nusage(void)\n{\n\tchar buf[BUFSIZ];\n\tint i;\n\n\tsetbuf(stderr, buf);\n        fprintf(stderr, \"%s\\n\\n\", TIFFGetVersion());\n\tfor (i = 0; stuff[i] != NULL; i++)\n\t\tfprintf(stderr, \"%s\\n\", stuff[i]);\n\texit(-1);\n}\n\nstatic void\nget_histogram(TIFF* in, Colorbox* box)\n{\n\tregister unsigned char *inptr;\n\tregister int red, green, blue;\n\tregister uint32 j, i;\n\tunsigned char *inputline;\n\n\tinputline = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(in));\n\tif (inputline == NULL) {\n\t\tfprintf(stderr, \"No space for scanline buffer\\n\");\n\t\texit(-1);\n\t}\n\tbox->rmin = box->gmin = box->bmin = 999;\n\tbox->rmax = box->gmax = box->bmax = -1;\n\tbox->total = imagewidth * imagelength;\n\n\t{ register uint32 *ptr = &histogram[0][0][0];\n\t  for (i = B_LEN*B_LEN*B_LEN; i-- > 0;)\n\t\t*ptr++ = 0;\n\t}\n\tfor (i = 0; i < imagelength; i++) {\n\t\tif (TIFFReadScanline(in, inputline, i, 0) <= 0)\n\t\t\tbreak;\n\t\tinptr = inputline;\n\t\tfor (j = imagewidth; j-- > 0;) {\n\t\t\tred = *inptr++ >> COLOR_SHIFT;\n\t\t\tgreen = *inptr++ >> COLOR_SHIFT;\n\t\t\tblue = *inptr++ >> COLOR_SHIFT;\n\t\t\tif (red < box->rmin)\n\t\t\t\tbox->rmin = red;\n\t\t        if (red > box->rmax)\n\t\t\t\tbox->rmax = red;\n\t\t        if (green < box->gmin)\n\t\t\t\tbox->gmin = green;\n\t\t        if (green > box->gmax)\n\t\t\t\tbox->gmax = green;\n\t\t        if (blue < box->bmin)\n\t\t\t\tbox->bmin = blue;\n\t\t        if (blue > box->bmax)\n\t\t\t\tbox->bmax = blue;\n\t\t        histogram[red][green][blue]++;\n\t\t}\n\t}\n\t_TIFFfree(inputline);\n}\n\nstatic Colorbox *\nlargest_box(void)\n{\n\tregister Colorbox *p, *b;\n\tregister uint32 size;\n\n\tb = NULL;\n\tsize = 0;\n\tfor (p = usedboxes; p != NULL; p = p->next)\n\t\tif ((p->rmax > p->rmin || p->gmax > p->gmin ||\n\t\t    p->bmax > p->bmin) &&  p->total > size)\n\t\t        size = (b = p)->total;\n\treturn (b);\n}\n\nstatic void\nsplitbox(Colorbox* ptr)\n{\n\tuint32\t\thist2[B_LEN];\n\tint\t\tfirst=0, last=0;\n\tregister Colorbox\t*new;\n\tregister uint32\t*iptr, *histp;\n\tregister int\ti, j;\n\tregister int\tir,ig,ib;\n\tregister uint32 sum, sum1, sum2;\n\tenum { RED, GREEN, BLUE } axis;\n\n\t/*\n\t * See which axis is the largest, do a histogram along that\n\t * axis.  Split at median point.  Contract both new boxes to\n\t * fit points and return\n\t */\n\ti = ptr->rmax - ptr->rmin;\n\tif (i >= ptr->gmax - ptr->gmin && i >= ptr->bmax - ptr->bmin)\n\t\taxis = RED;\n\telse if (ptr->gmax - ptr->gmin >= ptr->bmax - ptr->bmin)\n\t\taxis = GREEN;\n\telse\n\t\taxis = BLUE;\n\t/* get histogram along longest axis */\n\tswitch (axis) {\n\tcase RED:\n\t\thistp = &hist2[ptr->rmin];\n\t        for (ir = ptr->rmin; ir <= ptr->rmax; ++ir) {\n\t\t\t*histp = 0;\n\t\t\tfor (ig = ptr->gmin; ig <= ptr->gmax; ++ig) {\n\t\t\t\tiptr = &histogram[ir][ig][ptr->bmin];\n\t\t\t\tfor (ib = ptr->bmin; ib <= ptr->bmax; ++ib)\n\t\t\t\t\t*histp += *iptr++;\n\t\t\t}\n\t\t\thistp++;\n\t        }\n\t        first = ptr->rmin;\n\t\tlast = ptr->rmax;\n\t        break;\n\tcase GREEN:\n\t        histp = &hist2[ptr->gmin];\n\t        for (ig = ptr->gmin; ig <= ptr->gmax; ++ig) {\n\t\t\t*histp = 0;\n\t\t\tfor (ir = ptr->rmin; ir <= ptr->rmax; ++ir) {\n\t\t\t\tiptr = &histogram[ir][ig][ptr->bmin];\n\t\t\t\tfor (ib = ptr->bmin; ib <= ptr->bmax; ++ib)\n\t\t\t\t\t*histp += *iptr++;\n\t\t\t}\n\t\t\thistp++;\n\t        }\n\t        first = ptr->gmin;\n\t\tlast = ptr->gmax;\n\t        break;\n\tcase BLUE:\n\t        histp = &hist2[ptr->bmin];\n\t        for (ib = ptr->bmin; ib <= ptr->bmax; ++ib) {\n\t\t\t*histp = 0;\n\t\t\tfor (ir = ptr->rmin; ir <= ptr->rmax; ++ir) {\n\t\t\t\tiptr = &histogram[ir][ptr->gmin][ib];\n\t\t\t\tfor (ig = ptr->gmin; ig <= ptr->gmax; ++ig) {\n\t\t\t\t\t*histp += *iptr;\n\t\t\t\t\tiptr += B_LEN;\n\t\t\t\t}\n\t\t\t}\n\t\t\thistp++;\n\t        }\n\t        first = ptr->bmin;\n\t\tlast = ptr->bmax;\n\t        break;\n\t}\n\t/* find median point */\n\tsum2 = ptr->total / 2;\n\thistp = &hist2[first];\n\tsum = 0;\n\tfor (i = first; i <= last && (sum += *histp++) < sum2; ++i)\n\t\t;\n\tif (i == first)\n\t\ti++;\n\n\t/* Create new box, re-allocate points */\n\tnew = freeboxes;\n\tfreeboxes = new->next;\n\tif (freeboxes)\n\t\tfreeboxes->prev = NULL;\n\tif (usedboxes)\n\t\tusedboxes->prev = new;\n\tnew->next = usedboxes;\n\tusedboxes = new;\n\n\thistp = &hist2[first];\n\tfor (sum1 = 0, j = first; j < i; j++)\n\t\tsum1 += *histp++;\n\tfor (sum2 = 0, j = i; j <= last; j++)\n\t    sum2 += *histp++;\n\tnew->total = sum1;\n\tptr->total = sum2;\n\n\tnew->rmin = ptr->rmin;\n\tnew->rmax = ptr->rmax;\n\tnew->gmin = ptr->gmin;\n\tnew->gmax = ptr->gmax;\n\tnew->bmin = ptr->bmin;\n\tnew->bmax = ptr->bmax;\n\tswitch (axis) {\n\tcase RED:\n\t\tnew->rmax = i-1;\n\t        ptr->rmin = i;\n\t        break;\n\tcase GREEN:\n\t        new->gmax = i-1;\n\t        ptr->gmin = i;\n\t        break;\n\tcase BLUE:\n\t        new->bmax = i-1;\n\t        ptr->bmin = i;\n\t        break;\n\t}\n\tshrinkbox(new);\n\tshrinkbox(ptr);\n}\n\nstatic void\nshrinkbox(Colorbox* box)\n{\n\tregister uint32 *histp;\n\tregister int\tir, ig, ib;\n\n\tif (box->rmax > box->rmin) {\n\t\tfor (ir = box->rmin; ir <= box->rmax; ++ir)\n\t\t\tfor (ig = box->gmin; ig <= box->gmax; ++ig) {\n\t\t\t\thistp = &histogram[ir][ig][box->bmin];\n\t\t\t        for (ib = box->bmin; ib <= box->bmax; ++ib)\n\t\t\t\t\tif (*histp++ != 0) {\n\t\t\t\t\t\tbox->rmin = ir;\n\t\t\t\t\t\tgoto have_rmin;\n\t\t\t\t\t}\n\t\t\t}\n\thave_rmin:\n\t\tif (box->rmax > box->rmin)\n\t\t\tfor (ir = box->rmax; ir >= box->rmin; --ir)\n\t\t\t\tfor (ig = box->gmin; ig <= box->gmax; ++ig) {\n\t\t\t\t\thistp = &histogram[ir][ig][box->bmin];\n\t\t\t\t\tib = box->bmin;\n\t\t\t\t\tfor (; ib <= box->bmax; ++ib)\n\t\t\t\t\t\tif (*histp++ != 0) {\n\t\t\t\t\t\t\tbox->rmax = ir;\n\t\t\t\t\t\t\tgoto have_rmax;\n\t\t\t\t\t\t}\n\t\t\t        }\n\t}\nhave_rmax:\n\tif (box->gmax > box->gmin) {\n\t\tfor (ig = box->gmin; ig <= box->gmax; ++ig)\n\t\t\tfor (ir = box->rmin; ir <= box->rmax; ++ir) {\n\t\t\t\thistp = &histogram[ir][ig][box->bmin];\n\t\t\t        for (ib = box->bmin; ib <= box->bmax; ++ib)\n\t\t\t\tif (*histp++ != 0) {\n\t\t\t\t\tbox->gmin = ig;\n\t\t\t\t\tgoto have_gmin;\n\t\t\t\t}\n\t\t\t}\n\thave_gmin:\n\t\tif (box->gmax > box->gmin)\n\t\t\tfor (ig = box->gmax; ig >= box->gmin; --ig)\n\t\t\t\tfor (ir = box->rmin; ir <= box->rmax; ++ir) {\n\t\t\t\t\thistp = &histogram[ir][ig][box->bmin];\n\t\t\t\t\tib = box->bmin;\n\t\t\t\t\tfor (; ib <= box->bmax; ++ib)\n\t\t\t\t\t\tif (*histp++ != 0) {\n\t\t\t\t\t\t\tbox->gmax = ig;\n\t\t\t\t\t\t\tgoto have_gmax;\n\t\t\t\t\t\t}\n\t\t\t        }\n\t}\nhave_gmax:\n\tif (box->bmax > box->bmin) {\n\t\tfor (ib = box->bmin; ib <= box->bmax; ++ib)\n\t\t\tfor (ir = box->rmin; ir <= box->rmax; ++ir) {\n\t\t\t\thistp = &histogram[ir][box->gmin][ib];\n\t\t\t        for (ig = box->gmin; ig <= box->gmax; ++ig) {\n\t\t\t\t\tif (*histp != 0) {\n\t\t\t\t\t\tbox->bmin = ib;\n\t\t\t\t\t\tgoto have_bmin;\n\t\t\t\t\t}\n\t\t\t\t\thistp += B_LEN;\n\t\t\t        }\n\t\t        }\n\thave_bmin:\n\t\tif (box->bmax > box->bmin)\n\t\t\tfor (ib = box->bmax; ib >= box->bmin; --ib)\n\t\t\t\tfor (ir = box->rmin; ir <= box->rmax; ++ir) {\n\t\t\t\t\thistp = &histogram[ir][box->gmin][ib];\n\t\t\t\t\tig = box->gmin;\n\t\t\t\t\tfor (; ig <= box->gmax; ++ig) {\n\t\t\t\t\t\tif (*histp != 0) {\n\t\t\t\t\t\t\tbox->bmax = ib;\n\t\t\t\t\t\t\tgoto have_bmax;\n\t\t\t\t\t\t}\n\t\t\t\t\t\thistp += B_LEN;\n\t\t\t\t\t}\n\t\t\t        }\n\t}\nhave_bmax:\n\t;\n}\n\nstatic C_cell *\ncreate_colorcell(int red, int green, int blue)\n{\n\tregister int ir, ig, ib, i;\n\tregister C_cell *ptr;\n\tint mindist, next_n;\n\tregister int tmp, dist, n;\n\n\tir = red >> (COLOR_DEPTH-C_DEPTH);\n\tig = green >> (COLOR_DEPTH-C_DEPTH);\n\tib = blue >> (COLOR_DEPTH-C_DEPTH);\n\tptr = (C_cell *)_TIFFmalloc(sizeof (C_cell));\n\t*(ColorCells + ir*C_LEN*C_LEN + ig*C_LEN + ib) = ptr;\n\tptr->num_ents = 0;\n\n\t/*\n\t * Step 1: find all colors inside this cell, while we're at\n\t *\t   it, find distance of centermost point to furthest corner\n\t */\n\tmindist = 99999999;\n\tfor (i = 0; i < num_colors; ++i) {\n\t\tif (rm[i]>>(COLOR_DEPTH-C_DEPTH) != ir  ||\n\t\t    gm[i]>>(COLOR_DEPTH-C_DEPTH) != ig  ||\n\t\t    bm[i]>>(COLOR_DEPTH-C_DEPTH) != ib)\n\t\t\tcontinue;\n\t\tptr->entries[ptr->num_ents][0] = i;\n\t\tptr->entries[ptr->num_ents][1] = 0;\n\t\t++ptr->num_ents;\n\t        tmp = rm[i] - red;\n\t        if (tmp < (MAX_COLOR/C_LEN/2))\n\t\t\ttmp = MAX_COLOR/C_LEN-1 - tmp;\n\t        dist = tmp*tmp;\n\t        tmp = gm[i] - green;\n\t        if (tmp < (MAX_COLOR/C_LEN/2))\n\t\t\ttmp = MAX_COLOR/C_LEN-1 - tmp;\n\t        dist += tmp*tmp;\n\t        tmp = bm[i] - blue;\n\t        if (tmp < (MAX_COLOR/C_LEN/2))\n\t\t\ttmp = MAX_COLOR/C_LEN-1 - tmp;\n\t        dist += tmp*tmp;\n\t        if (dist < mindist)\n\t\t\tmindist = dist;\n\t}\n\n\t/*\n\t * Step 3: find all points within that distance to cell.\n\t */\n\tfor (i = 0; i < num_colors; ++i) {\n\t\tif (rm[i] >> (COLOR_DEPTH-C_DEPTH) == ir  &&\n\t\t    gm[i] >> (COLOR_DEPTH-C_DEPTH) == ig  &&\n\t\t    bm[i] >> (COLOR_DEPTH-C_DEPTH) == ib)\n\t\t\tcontinue;\n\t\tdist = 0;\n\t        if ((tmp = red - rm[i]) > 0 ||\n\t\t    (tmp = rm[i] - (red + MAX_COLOR/C_LEN-1)) > 0 )\n\t\t\tdist += tmp*tmp;\n\t        if ((tmp = green - gm[i]) > 0 ||\n\t\t    (tmp = gm[i] - (green + MAX_COLOR/C_LEN-1)) > 0 )\n\t\t\tdist += tmp*tmp;\n\t        if ((tmp = blue - bm[i]) > 0 ||\n\t\t    (tmp = bm[i] - (blue + MAX_COLOR/C_LEN-1)) > 0 )\n\t\t\tdist += tmp*tmp;\n\t        if (dist < mindist) {\n\t\t\tptr->entries[ptr->num_ents][0] = i;\n\t\t\tptr->entries[ptr->num_ents][1] = dist;\n\t\t\t++ptr->num_ents;\n\t        }\n\t}\n\n\t/*\n\t * Sort color cells by distance, use cheap exchange sort\n\t */\n\tfor (n = ptr->num_ents - 1; n > 0; n = next_n) {\n\t\tnext_n = 0;\n\t\tfor (i = 0; i < n; ++i)\n\t\t\tif (ptr->entries[i][1] > ptr->entries[i+1][1]) {\n\t\t\t\ttmp = ptr->entries[i][0];\n\t\t\t\tptr->entries[i][0] = ptr->entries[i+1][0];\n\t\t\t\tptr->entries[i+1][0] = tmp;\n\t\t\t\ttmp = ptr->entries[i][1];\n\t\t\t\tptr->entries[i][1] = ptr->entries[i+1][1];\n\t\t\t\tptr->entries[i+1][1] = tmp;\n\t\t\t\tnext_n = i;\n\t\t        }\n\t}\n\treturn (ptr);\n}\n\nstatic void\nmap_colortable(void)\n{\n\tregister uint32 *histp = &histogram[0][0][0];\n\tregister C_cell *cell;\n\tregister int j, tmp, d2, dist;\n\tint ir, ig, ib, i;\n\n\tfor (ir = 0; ir < B_LEN; ++ir)\n\t\tfor (ig = 0; ig < B_LEN; ++ig)\n\t\t\tfor (ib = 0; ib < B_LEN; ++ib, histp++) {\n\t\t\t\tif (*histp == 0) {\n\t\t\t\t\t*histp = -1;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tcell = *(ColorCells +\n\t\t\t\t    (((ir>>(B_DEPTH-C_DEPTH)) << C_DEPTH*2) +\n\t\t\t\t    ((ig>>(B_DEPTH-C_DEPTH)) << C_DEPTH) +\n\t\t\t\t    (ib>>(B_DEPTH-C_DEPTH))));\n\t\t\t\tif (cell == NULL )\n\t\t\t\t\tcell = create_colorcell(\n\t\t\t\t\t    ir << COLOR_SHIFT,\n\t\t\t\t\t    ig << COLOR_SHIFT,\n\t\t\t\t\t    ib << COLOR_SHIFT);\n\t\t\t\tdist = 9999999;\n\t\t\t\tfor (i = 0; i < cell->num_ents &&\n\t\t\t\t    dist > cell->entries[i][1]; ++i) {\n\t\t\t\t\tj = cell->entries[i][0];\n\t\t\t\t\td2 = rm[j] - (ir << COLOR_SHIFT);\n\t\t\t\t\td2 *= d2;\n\t\t\t\t\ttmp = gm[j] - (ig << COLOR_SHIFT);\n\t\t\t\t\td2 += tmp*tmp;\n\t\t\t\t\ttmp = bm[j] - (ib << COLOR_SHIFT);\n\t\t\t\t\td2 += tmp*tmp;\n\t\t\t\t\tif (d2 < dist) {\n\t\t\t\t\t\tdist = d2;\n\t\t\t\t\t\t*histp = j;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n}\n\n/*\n * straight quantization.  Each pixel is mapped to the colors\n * closest to it.  Color values are rounded to the nearest color\n * table entry.\n */\nstatic void\nquant(TIFF* in, TIFF* out)\n{\n\tunsigned char\t*outline, *inputline;\n\tregister unsigned char\t*outptr, *inptr;\n\tregister uint32 i, j;\n\tregister int red, green, blue;\n\n\tinputline = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(in));\n\toutline = (unsigned char *)_TIFFmalloc(imagewidth);\n\tfor (i = 0; i < imagelength; i++) {\n\t\tif (TIFFReadScanline(in, inputline, i, 0) <= 0)\n\t\t\tbreak;\n\t\tinptr = inputline;\n\t\toutptr = outline;\n\t\tfor (j = 0; j < imagewidth; j++) {\n\t\t\tred = *inptr++ >> COLOR_SHIFT;\n\t\t\tgreen = *inptr++ >> COLOR_SHIFT;\n\t\t\tblue = *inptr++ >> COLOR_SHIFT;\n\t\t\t*outptr++ = (unsigned char)histogram[red][green][blue];\n\t\t}\n\t\tif (TIFFWriteScanline(out, outline, i, 0) < 0)\n\t\t\tbreak;\n\t}\n\t_TIFFfree(inputline);\n\t_TIFFfree(outline);\n}\n\n#define\tSWAP(type,a,b)\t{ type p; p = a; a = b; b = p; }\n\n#define\tGetInputLine(tif, row, bad)\t\t\t\t\\\n\tif (TIFFReadScanline(tif, inputline, row, 0) <= 0)\t\\\n\t\tbad;\t\t\t\t\t\t\\\n\tinptr = inputline;\t\t\t\t\t\\\n\tnextptr = nextline;\t\t\t\t\t\\\n\tfor (j = 0; j < imagewidth; ++j) {\t\t\t\\\n\t\t*nextptr++ = *inptr++;\t\t\t\t\\\n\t\t*nextptr++ = *inptr++;\t\t\t\t\\\n\t\t*nextptr++ = *inptr++;\t\t\t\t\\\n\t}\n#define\tGetComponent(raw, cshift, c)\t\t\t\t\\\n\tcshift = raw;\t\t\t\t\t\t\\\n\tif (cshift < 0)\t\t\t\t\t\t\\\n\t\tcshift = 0;\t\t\t\t\t\\\n\telse if (cshift >= MAX_COLOR)\t\t\t\t\\\n\t\tcshift = MAX_COLOR-1;\t\t\t\t\\\n\tc = cshift;\t\t\t\t\t\t\\\n\tcshift >>= COLOR_SHIFT;\n\nstatic void\nquant_fsdither(TIFF* in, TIFF* out)\n{\n\tunsigned char *outline, *inputline, *inptr;\n\tshort *thisline, *nextline;\n\tregister unsigned char\t*outptr;\n\tregister short *thisptr, *nextptr;\n\tregister uint32 i, j;\n\tuint32 imax, jmax;\n\tint lastline, lastpixel;\n\n\timax = imagelength - 1;\n\tjmax = imagewidth - 1;\n\tinputline = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(in));\n\tthisline = (short *)_TIFFmalloc(imagewidth * 3 * sizeof (short));\n\tnextline = (short *)_TIFFmalloc(imagewidth * 3 * sizeof (short));\n\toutline = (unsigned char *) _TIFFmalloc(TIFFScanlineSize(out));\n\n\tGetInputLine(in, 0, goto bad);\t\t/* get first line */\n\tfor (i = 1; i <= imagelength; ++i) {\n\t\tSWAP(short *, thisline, nextline);\n\t\tlastline = (i >= imax);\n\t\tif (i <= imax)\n\t\t\tGetInputLine(in, i, break);\n\t\tthisptr = thisline;\n\t\tnextptr = nextline;\n\t\toutptr = outline;\n\t\tfor (j = 0; j < imagewidth; ++j) {\n\t\t\tint red, green, blue;\n\t\t\tregister int oval, r2, g2, b2;\n\n\t\t\tlastpixel = (j == jmax);\n\t\t\tGetComponent(*thisptr++, r2, red);\n\t\t\tGetComponent(*thisptr++, g2, green);\n\t\t\tGetComponent(*thisptr++, b2, blue);\n\t\t\toval = histogram[r2][g2][b2];\n\t\t\tif (oval == -1) {\n\t\t\t\tint ci;\n\t\t\t\tregister int cj, tmp, d2, dist;\n\t\t\t\tregister C_cell\t*cell;\n\n\t\t\t\tcell = *(ColorCells +\n\t\t\t\t    (((r2>>(B_DEPTH-C_DEPTH)) << C_DEPTH*2) +\n\t\t\t\t    ((g2>>(B_DEPTH-C_DEPTH)) << C_DEPTH ) +\n\t\t\t\t    (b2>>(B_DEPTH-C_DEPTH))));\n\t\t\t\tif (cell == NULL)\n\t\t\t\t\tcell = create_colorcell(red,\n\t\t\t\t\t    green, blue);\n\t\t\t\tdist = 9999999;\n\t\t\t\tfor (ci = 0; ci < cell->num_ents && dist > cell->entries[ci][1]; ++ci) {\n\t\t\t\t\tcj = cell->entries[ci][0];\n\t\t\t\t\td2 = (rm[cj] >> COLOR_SHIFT) - r2;\n\t\t\t\t\td2 *= d2;\n\t\t\t\t\ttmp = (gm[cj] >> COLOR_SHIFT) - g2;\n\t\t\t\t\td2 += tmp*tmp;\n\t\t\t\t\ttmp = (bm[cj] >> COLOR_SHIFT) - b2;\n\t\t\t\t\td2 += tmp*tmp;\n\t\t\t\t\tif (d2 < dist) {\n\t\t\t\t\t\tdist = d2;\n\t\t\t\t\t\toval = cj;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\thistogram[r2][g2][b2] = oval;\n\t\t\t}\n\t\t\t*outptr++ = oval;\n\t\t\tred -= rm[oval];\n\t\t\tgreen -= gm[oval];\n\t\t\tblue -= bm[oval];\n\t\t\tif (!lastpixel) {\n\t\t\t\tthisptr[0] += blue * 7 / 16;\n\t\t\t\tthisptr[1] += green * 7 / 16;\n\t\t\t\tthisptr[2] += red * 7 / 16;\n\t\t\t}\n\t\t\tif (!lastline) {\n\t\t\t\tif (j != 0) {\n\t\t\t\t\tnextptr[-3] += blue * 3 / 16;\n\t\t\t\t\tnextptr[-2] += green * 3 / 16;\n\t\t\t\t\tnextptr[-1] += red * 3 / 16;\n\t\t\t\t}\n\t\t\t\tnextptr[0] += blue * 5 / 16;\n\t\t\t\tnextptr[1] += green * 5 / 16;\n\t\t\t\tnextptr[2] += red * 5 / 16;\n\t\t\t\tif (!lastpixel) {\n\t\t\t\t\tnextptr[3] += blue / 16;\n\t\t\t\t        nextptr[4] += green / 16;\n\t\t\t\t        nextptr[5] += red / 16;\n\t\t\t\t}\n\t\t\t\tnextptr += 3;\n\t\t\t}\n\t\t}\n\t\tif (TIFFWriteScanline(out, outline, i-1, 0) < 0)\n\t\t\tbreak;\n\t}\nbad:\n\t_TIFFfree(inputline);\n\t_TIFFfree(thisline);\n\t_TIFFfree(nextline);\n\t_TIFFfree(outline);\n}\n"
  },
  {
    "path": "src/main/jni/tiff/tools/tiffset.c",
    "content": "/******************************************************************************\n * $Id: tiffset.c,v 1.12 2007/02/24 17:14:14 dron Exp $\n *\n * Project:  libtiff tools\n * Purpose:  Mainline for setting metadata in existing TIFF files.\n * Author:   Frank Warmerdam, warmerdam@pobox.com\n *\n ******************************************************************************\n * Copyright (c) 2000, Frank Warmerdam\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n ******************************************************************************\n *\n * $Log: tiffset.c,v $\n * Revision 1.12  2007/02/24 17:14:14  dron\n * Properly handle tags with TIFF_VARIABLE writecount. As per bug\n * http://bugzilla.remotesensing.org/show_bug.cgi?id=1350\n *\n * Revision 1.11  2005/09/13 14:13:42  dron\n * Avoid warnings.\n *\n * Revision 1.10  2005/02/24 14:47:11  fwarmerdam\n * Updated header.\n *\n */\n\n\n#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n\n#include \"tiffio.h\"\n\nstatic char* usageMsg[] = {\n\"usage: tiffset [options] filename\",\n\"where options are:\",\n\" -s <tagname> [count] <value>...   set the tag value\",\n\" -sf <tagname> <filename>  read the tag value from file (for ASCII tags only)\",\nNULL\n};\n\nstatic void\nusage(void)\n{\n\tint i;\n\tfor (i = 0; usageMsg[i]; i++)\n\t\tfprintf(stderr, \"%s\\n\", usageMsg[i]);\n\texit(-1);\n}\n\nstatic const TIFFFieldInfo *\nGetField(TIFF *tiff, const char *tagname)\n{\n    const TIFFFieldInfo *fip;\n\n    if( atoi(tagname) > 0 )\n        fip = TIFFFieldWithTag(tiff, (ttag_t)atoi(tagname));\n    else\n        fip = TIFFFieldWithName(tiff, tagname);\n\n    if (!fip) {\n        fprintf( stderr, \"Field name %s not recognised.\\n\", tagname );\n        return (TIFFFieldInfo *)NULL;\n    }\n\n    return fip;\n}\n\nint\nmain(int argc, char* argv[])\n{\n    TIFF *tiff;\n    int  arg_index;\n\n    if (argc < 2)\n        usage();\n\n    tiff = TIFFOpen(argv[argc-1], \"r+\");\n    if (tiff == NULL)\n        return 2;\n\n    for( arg_index = 1; arg_index < argc-1; arg_index++ ) {\n        if (strcmp(argv[arg_index],\"-s\") == 0 && arg_index < argc-3) {\n            const TIFFFieldInfo *fip;\n            const char *tagname;\n\n            arg_index++;\n            tagname = argv[arg_index];\n            fip = GetField(tiff, tagname);\n\n            if (!fip)\n                return 3;\n\n            arg_index++;\n            if (fip->field_type == TIFF_ASCII) {\n                if (TIFFSetField(tiff, fip->field_tag, argv[arg_index]) != 1)\n                    fprintf( stderr, \"Failed to set %s=%s\\n\",\n                             fip->field_name, argv[arg_index] );\n            } else if (fip->field_writecount > 0\n\t\t       || fip->field_writecount == TIFF_VARIABLE) {\n                int     ret = 1;\n                short   wc;\n\n                if (fip->field_writecount == TIFF_VARIABLE)\n                        wc = atoi(argv[arg_index++]);\n                else\n                        wc = fip->field_writecount;\n\n                if (argc - arg_index < wc) {\n                    fprintf( stderr,\n                             \"Number of tag values is not enough. \"\n                             \"Expected %d values for %s tag, got %d\\n\",\n                             wc, fip->field_name, argc - arg_index);\n                    return 4;\n                }\n                    \n                if (wc > 1) {\n                        int     i, size;\n                        void    *array;\n\n                        switch (fip->field_type) {\n                                /*\n                                 * XXX: We can't use TIFFDataWidth()\n                                 * to determine the space needed to store\n                                 * the value. For TIFF_RATIONAL values\n                                 * TIFFDataWidth() returns 8, but we use 4-byte\n                                 * float to represent rationals.\n                                 */\n                                case TIFF_BYTE:\n                                case TIFF_ASCII:\n                                case TIFF_SBYTE:\n                                case TIFF_UNDEFINED:\n\t\t\t\tdefault:\n                                    size = 1;\n                                    break;\n\n                                case TIFF_SHORT:\n                                case TIFF_SSHORT:\n                                    size = 2;\n                                    break;\n\n                                case TIFF_LONG:\n                                case TIFF_SLONG:\n                                case TIFF_FLOAT:\n                                case TIFF_IFD:\n                                case TIFF_RATIONAL:\n                                case TIFF_SRATIONAL:\n                                    size = 4;\n                                    break;\n\n                                case TIFF_DOUBLE:\n                                    size = 8;\n                                    break;\n                        }\n\n                        array = _TIFFmalloc(wc * size);\n                        if (!array) {\n                                fprintf(stderr, \"No space for %s tag\\n\",\n                                        tagname);\n                                return 4;\n                        }\n\n                        switch (fip->field_type) {\n                            case TIFF_BYTE:\n                                for (i = 0; i < wc; i++)\n                                    ((uint8 *)array)[i] = atoi(argv[arg_index+i]);\n                                break;\n                            case TIFF_SHORT:\n                                for (i = 0; i < wc; i++)\n                                    ((uint16 *)array)[i] = atoi(argv[arg_index+i]);\n                                break;\n                            case TIFF_SBYTE:\n                                for (i = 0; i < wc; i++)\n                                    ((int8 *)array)[i] = atoi(argv[arg_index+i]);\n                                break;\n                            case TIFF_SSHORT:\n                                for (i = 0; i < wc; i++)\n                                    ((int16 *)array)[i] = atoi(argv[arg_index+i]);\n                                break;\n                            case TIFF_LONG:\n                                for (i = 0; i < wc; i++)\n                                    ((uint32 *)array)[i] = atol(argv[arg_index+i]);\n                                break;\n                            case TIFF_SLONG:\n                            case TIFF_IFD:\n                                for (i = 0; i < wc; i++)\n                                    ((uint32 *)array)[i] = atol(argv[arg_index+i]);\n                                break;\n                            case TIFF_DOUBLE:\n                                for (i = 0; i < wc; i++)\n                                    ((double *)array)[i] = atof(argv[arg_index+i]);\n                                break;\n                            case TIFF_RATIONAL:\n                            case TIFF_SRATIONAL:\n                            case TIFF_FLOAT:\n                                for (i = 0; i < wc; i++)\n                                    ((float *)array)[i] = (float)atof(argv[arg_index+i]);\n                                break;\n                            default:\n                                break;\n                        }\n                \n                        if (fip->field_passcount) {\n                                ret = TIFFSetField(tiff, fip->field_tag,\n                                                   wc, array);\n                        } else {\n                                ret = TIFFSetField(tiff, fip->field_tag,\n                                                   array);\n                        }\n\n                        _TIFFfree(array);\n                } else {\n                        switch (fip->field_type) {\n                            case TIFF_BYTE:\n                            case TIFF_SHORT:\n                            case TIFF_SBYTE:\n                            case TIFF_SSHORT:\n                                ret = TIFFSetField(tiff, fip->field_tag,\n                                                   atoi(argv[arg_index++]));\n                                break;\n                            case TIFF_LONG:\n                            case TIFF_SLONG:\n                            case TIFF_IFD:\n                                ret = TIFFSetField(tiff, fip->field_tag,\n                                                   atol(argv[arg_index++]));\n                                break;\n                            case TIFF_DOUBLE:\n                                ret = TIFFSetField(tiff, fip->field_tag,\n                                                   atof(argv[arg_index++]));\n                                break;\n                            case TIFF_RATIONAL:\n                            case TIFF_SRATIONAL:\n                            case TIFF_FLOAT:\n                                ret = TIFFSetField(tiff, fip->field_tag,\n                                                   (float)atof(argv[arg_index++]));\n                                break;\n                            default:\n                                break;\n                        }\n                }\n\n                if (ret != 1)\n                    fprintf(stderr, \"Failed to set %s\\n\", fip->field_name);\n                arg_index += wc;\n            }\n        } else if (strcmp(argv[arg_index],\"-sf\") == 0 && arg_index < argc-3) {\n            FILE    *fp;\n            const TIFFFieldInfo *fip;\n            char    *text;\n            int     len;\n\n            arg_index++;\n            fip = GetField(tiff, argv[arg_index]);\n\n            if (!fip)\n                return 3;\n\n            if (fip->field_type != TIFF_ASCII) {\n                fprintf( stderr,\n                         \"Only ASCII tags can be set from file. \"\n                         \"%s is not ASCII tag.\\n\", fip->field_name );\n                return 5;\n            }\n\n            arg_index++;\n            fp = fopen( argv[arg_index], \"rt\" );\n            if(fp == NULL) {\n                perror( argv[arg_index] );\n                continue;\n            }\n\n            text = (char *) malloc(1000000);\n            len = fread( text, 1, 999999, fp );\n            text[len] = '\\0';\n\n            fclose( fp );\n\n            if(TIFFSetField( tiff, fip->field_tag, text ) != 1) {\n                fprintf(stderr, \"Failed to set %s from file %s\\n\", \n                        fip->field_name, argv[arg_index]);\n            }\n\n            _TIFFfree( text );\n            arg_index++;\n        } else {\n            fprintf(stderr, \"Unrecognised option: %s\\n\",\n                    argv[arg_index]);\n            usage();\n        }\n    }\n\n    TIFFRewriteDirectory(tiff);\n    TIFFClose(tiff);\n    return 0;\n}\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiff/tools/tiffsplit.c",
    "content": "/* $Id: tiffsplit.c,v 1.14.2.3 2009-01-21 04:49:44 fwarmerdam Exp $ */\n\n/*\n * Copyright (c) 1992-1997 Sam Leffler\n * Copyright (c) 1992-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n#include \"tif_config.h\"\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n#include \"tiffio.h\"\n\n#ifndef HAVE_GETOPT\nextern int getopt(int, char**, char*);\n#endif\n\n#define\tCopyField(tag, v) \\\n    if (TIFFGetField(in, tag, &v)) TIFFSetField(out, tag, v)\n#define\tCopyField2(tag, v1, v2) \\\n    if (TIFFGetField(in, tag, &v1, &v2)) TIFFSetField(out, tag, v1, v2)\n#define\tCopyField3(tag, v1, v2, v3) \\\n    if (TIFFGetField(in, tag, &v1, &v2, &v3)) TIFFSetField(out, tag, v1, v2, v3)\n\n#define PATH_LENGTH 8192\n\nstatic const char TIFF_SUFFIX[] = \".tif\";\n\nstatic\tchar fname[PATH_LENGTH];\n\nstatic\tint tiffcp(TIFF*, TIFF*);\nstatic\tvoid newfilename(void);\nstatic\tint cpStrips(TIFF*, TIFF*);\nstatic\tint cpTiles(TIFF*, TIFF*);\n\nint\nmain(int argc, char* argv[])\n{\n\tTIFF *in, *out;\n\n\tif (argc < 2) {\n                fprintf(stderr, \"%s\\n\\n\", TIFFGetVersion());\n\t\tfprintf(stderr, \"usage: tiffsplit input.tif [prefix]\\n\");\n\t\treturn (-3);\n\t}\n\tif (argc > 2) {\n\t\tstrncpy(fname, argv[2], sizeof(fname));\n\t\tfname[sizeof(fname) - 1] = '\\0';\n\t}\n\tin = TIFFOpen(argv[1], \"r\");\n\tif (in != NULL) {\n\t\tdo {\n\t\t\tsize_t path_len;\n\t\t\tchar *path;\n\t\t\t\n\t\t\tnewfilename();\n\n\t\t\tpath_len = strlen(fname) + sizeof(TIFF_SUFFIX);\n\t\t\tpath = (char *) _TIFFmalloc(path_len);\n\t\t\tstrncpy(path, fname, path_len);\n\t\t\tpath[path_len - 1] = '\\0';\n\t\t\tstrncat(path, TIFF_SUFFIX, path_len - strlen(path) - 1);\n\t\t\tout = TIFFOpen(path, TIFFIsBigEndian(in)?\"wb\":\"wl\");\n\t\t\t_TIFFfree(path);\n\n\t\t\tif (out == NULL)\n\t\t\t\treturn (-2);\n\t\t\tif (!tiffcp(in, out))\n\t\t\t\treturn (-1);\n\t\t\tTIFFClose(out);\n\t\t} while (TIFFReadDirectory(in));\n\t\t(void) TIFFClose(in);\n\t}\n\treturn (0);\n}\n\nstatic void\nnewfilename(void)\n{\n\tstatic int first = 1;\n\tstatic long lastTurn;\n\tstatic long fnum;\n\tstatic short defname;\n\tstatic char *fpnt;\n\n\tif (first) {\n\t\tif (fname[0]) {\n\t\t\tfpnt = fname + strlen(fname);\n\t\t\tdefname = 0;\n\t\t} else {\n\t\t\tfname[0] = 'x';\n\t\t\tfpnt = fname + 1;\n\t\t\tdefname = 1;\n\t\t}\n\t\tfirst = 0;\n\t}\n#define\tMAXFILES\t17576\n\tif (fnum == MAXFILES) {\n\t\tif (!defname || fname[0] == 'z') {\n\t\t\tfprintf(stderr, \"tiffsplit: too many files.\\n\");\n\t\t\texit(1);\n\t\t}\n\t\tfname[0]++;\n\t\tfnum = 0;\n\t}\n\tif (fnum % 676 == 0) {\n\t\tif (fnum != 0) {\n\t\t\t/*\n                         * advance to next letter every 676 pages\n\t\t\t * condition for 'z'++ will be covered above\n                         */\n\t\t\tfpnt[0]++;\n\t\t} else {\n\t\t\t/*\n                         * set to 'a' if we are on the very first file\n                         */\n\t\t\tfpnt[0] = 'a';\n\t\t}\n\t\t/*\n                 * set the value of the last turning point\n                 */\n\t\tlastTurn = fnum;\n\t}\n\t/* \n         * start from 0 every 676 times (provided by lastTurn)\n         * this keeps us within a-z boundaries\n         */\n\tfpnt[1] = (char)((fnum - lastTurn) / 26) + 'a';\n\t/* \n         * cycle last letter every file, from a-z, then repeat\n         */\n\tfpnt[2] = (char)(fnum % 26) + 'a';\n\tfnum++;\n}\n\nstatic int\ntiffcp(TIFF* in, TIFF* out)\n{\n\tuint16 bitspersample, samplesperpixel, compression, shortv, *shortav;\n\tuint32 w, l;\n\tfloat floatv;\n\tchar *stringv;\n\tuint32 longv;\n\n\tCopyField(TIFFTAG_SUBFILETYPE, longv);\n\tCopyField(TIFFTAG_TILEWIDTH, w);\n\tCopyField(TIFFTAG_TILELENGTH, l);\n\tCopyField(TIFFTAG_IMAGEWIDTH, w);\n\tCopyField(TIFFTAG_IMAGELENGTH, l);\n\tCopyField(TIFFTAG_BITSPERSAMPLE, bitspersample);\n\tCopyField(TIFFTAG_SAMPLESPERPIXEL, samplesperpixel);\n\tCopyField(TIFFTAG_COMPRESSION, compression);\n\tif (compression == COMPRESSION_JPEG) {\n\t\tuint16 count = 0;\n\t\tvoid *table = NULL;\n\t\tif (TIFFGetField(in, TIFFTAG_JPEGTABLES, &count, &table)\n\t\t    && count > 0 && table) {\n\t\t    TIFFSetField(out, TIFFTAG_JPEGTABLES, count, table);\n\t\t}\n\t}\n        CopyField(TIFFTAG_PHOTOMETRIC, shortv);\n\tCopyField(TIFFTAG_PREDICTOR, shortv);\n\tCopyField(TIFFTAG_THRESHHOLDING, shortv);\n\tCopyField(TIFFTAG_FILLORDER, shortv);\n\tCopyField(TIFFTAG_ORIENTATION, shortv);\n\tCopyField(TIFFTAG_MINSAMPLEVALUE, shortv);\n\tCopyField(TIFFTAG_MAXSAMPLEVALUE, shortv);\n\tCopyField(TIFFTAG_XRESOLUTION, floatv);\n\tCopyField(TIFFTAG_YRESOLUTION, floatv);\n\tCopyField(TIFFTAG_GROUP3OPTIONS, longv);\n\tCopyField(TIFFTAG_GROUP4OPTIONS, longv);\n\tCopyField(TIFFTAG_RESOLUTIONUNIT, shortv);\n\tCopyField(TIFFTAG_PLANARCONFIG, shortv);\n\tCopyField(TIFFTAG_ROWSPERSTRIP, longv);\n\tCopyField(TIFFTAG_XPOSITION, floatv);\n\tCopyField(TIFFTAG_YPOSITION, floatv);\n\tCopyField(TIFFTAG_IMAGEDEPTH, longv);\n\tCopyField(TIFFTAG_TILEDEPTH, longv);\n\tCopyField(TIFFTAG_SAMPLEFORMAT, shortv);\n\tCopyField2(TIFFTAG_EXTRASAMPLES, shortv, shortav);\n\t{ uint16 *red, *green, *blue;\n\t  CopyField3(TIFFTAG_COLORMAP, red, green, blue);\n\t}\n\t{ uint16 shortv2;\n\t  CopyField2(TIFFTAG_PAGENUMBER, shortv, shortv2);\n\t}\n\tCopyField(TIFFTAG_ARTIST, stringv);\n\tCopyField(TIFFTAG_IMAGEDESCRIPTION, stringv);\n\tCopyField(TIFFTAG_MAKE, stringv);\n\tCopyField(TIFFTAG_MODEL, stringv);\n\tCopyField(TIFFTAG_SOFTWARE, stringv);\n\tCopyField(TIFFTAG_DATETIME, stringv);\n\tCopyField(TIFFTAG_HOSTCOMPUTER, stringv);\n\tCopyField(TIFFTAG_PAGENAME, stringv);\n\tCopyField(TIFFTAG_DOCUMENTNAME, stringv);\n\tCopyField(TIFFTAG_BADFAXLINES, longv);\n\tCopyField(TIFFTAG_CLEANFAXDATA, longv);\n\tCopyField(TIFFTAG_CONSECUTIVEBADFAXLINES, longv);\n\tCopyField(TIFFTAG_FAXRECVPARAMS, longv);\n\tCopyField(TIFFTAG_FAXRECVTIME, longv);\n\tCopyField(TIFFTAG_FAXSUBADDRESS, stringv);\n\tCopyField(TIFFTAG_FAXDCS, stringv);\n\tif (TIFFIsTiled(in))\n\t\treturn (cpTiles(in, out));\n\telse\n\t\treturn (cpStrips(in, out));\n}\n\nstatic int\ncpStrips(TIFF* in, TIFF* out)\n{\n\ttsize_t bufsize  = TIFFStripSize(in);\n\tunsigned char *buf = (unsigned char *)_TIFFmalloc(bufsize);\n\n\tif (buf) {\n\t\ttstrip_t s, ns = TIFFNumberOfStrips(in);\n\t\tuint32 *bytecounts;\n\n\t\tTIFFGetField(in, TIFFTAG_STRIPBYTECOUNTS, &bytecounts);\n\t\tfor (s = 0; s < ns; s++) {\n\t\t\tif (bytecounts[s] > (uint32)bufsize) {\n\t\t\t\tbuf = (unsigned char *)_TIFFrealloc(buf, bytecounts[s]);\n\t\t\t\tif (!buf)\n\t\t\t\t\treturn (0);\n\t\t\t\tbufsize = bytecounts[s];\n\t\t\t}\n\t\t\tif (TIFFReadRawStrip(in, s, buf, bytecounts[s]) < 0 ||\n\t\t\t    TIFFWriteRawStrip(out, s, buf, bytecounts[s]) < 0) {\n\t\t\t\t_TIFFfree(buf);\n\t\t\t\treturn (0);\n\t\t\t}\n\t\t}\n\t\t_TIFFfree(buf);\n\t\treturn (1);\n\t}\n\treturn (0);\n}\n\nstatic int\ncpTiles(TIFF* in, TIFF* out)\n{\n\ttsize_t bufsize = TIFFTileSize(in);\n\tunsigned char *buf = (unsigned char *)_TIFFmalloc(bufsize);\n\n\tif (buf) {\n\t\tttile_t t, nt = TIFFNumberOfTiles(in);\n\t\tuint32 *bytecounts;\n\n\t\tTIFFGetField(in, TIFFTAG_TILEBYTECOUNTS, &bytecounts);\n\t\tfor (t = 0; t < nt; t++) {\n\t\t\tif (bytecounts[t] > (uint32) bufsize) {\n\t\t\t\tbuf = (unsigned char *)_TIFFrealloc(buf, bytecounts[t]);\n\t\t\t\tif (!buf)\n\t\t\t\t\treturn (0);\n\t\t\t\tbufsize = bytecounts[t];\n\t\t\t}\n\t\t\tif (TIFFReadRawTile(in, t, buf, bytecounts[t]) < 0 ||\n\t\t\t    TIFFWriteRawTile(out, t, buf, bytecounts[t]) < 0) {\n\t\t\t\t_TIFFfree(buf);\n\t\t\t\treturn (0);\n\t\t\t}\n\t\t}\n\t\t_TIFFfree(buf);\n\t\treturn (1);\n\t}\n\treturn (0);\n}\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiff/tools/ycbcr.c",
    "content": "float\tycbcrCoeffs[3] = { .299, .587, .114 };\n/* default coding range is CCIR Rec 601-1 with no headroom/footroom */\nunsigned long refBlackWhite[6] = { 0, 255, 128, 255, 128, 255 };\n\n#define\tLumaRed\t\tycbcrCoeffs[0]\n#define\tLumaGreen\tycbcrCoeffs[1]\n#define\tLumaBlue\tycbcrCoeffs[2]\n\nlong\teRtotal = 0;\nlong\teGtotal = 0;\nlong\teBtotal = 0;\nlong\tpreveRtotal = 0;\nlong\tpreveGtotal = 0;\nlong\tpreveBtotal = 0;\nunsigned long AbseRtotal = 0;\nunsigned long AbseGtotal = 0;\nunsigned long AbseBtotal = 0;\nunsigned long eCodes = 0;\nunsigned long preveCodes = 0;\nunsigned long eBits = 0;\nunsigned long preveBits = 0;\n\nstatic\tvoid setupLumaTables();\nstatic int abs(int v) { return (v < 0 ? -v : v); }\nstatic double pct(int v,double range) { return (v*100. / range); }\nstatic void check(int R, int G, int B);\n\nfloat\tD1, D2;\nfloat\tD3, D4;\nfloat\tD5, D6;\n\nint\nmain(int argc, char** argv)\n{\n    int R, G, B;\n\n    if (argc > 1) {\n\trefBlackWhite[0] = 16;\n\trefBlackWhite[1] = 235;\n\trefBlackWhite[2] = 128;\n\trefBlackWhite[3] = 240;\n\trefBlackWhite[4] = 128;\n\trefBlackWhite[5] = 240;\n    }\n    D3 = 2 - 2*LumaRed;\n    D4 = 2 - 2*LumaBlue;\n    D1 = 1. / D3;\n    D2 = 1. / D4;\n    D5 = D3*LumaRed / LumaGreen;\n    D6 = D4*LumaBlue / LumaGreen;\n    setupLumaTables();\n    for (R = 0; R < 256; R++) {\n\tfor (G = 0; G < 256; G++)\n\t    for (B = 0; B < 256; B++)\n\t\tcheck(R, G, B);\n\tprintf(\"[%3u] c %u/%u b %u/%u (R %u/%d/%u G %u/%d/%u B %u/%d/%u)\\n\"\n\t    , R\n\t    , eCodes - preveCodes, eCodes\n\t    , eBits - preveBits, eBits\n\t    , abs(AbseRtotal - preveRtotal), eRtotal , AbseRtotal\n\t    , abs(AbseGtotal - preveGtotal), eGtotal , AbseGtotal\n\t    , abs(AbseBtotal - preveBtotal), eBtotal , AbseBtotal\n\t);\n\tpreveRtotal = AbseRtotal;\n\tpreveGtotal = AbseGtotal;\n\tpreveBtotal = AbseBtotal;\n\tpreveCodes = eCodes;\n\tpreveBits = eBits;\n    }\n    printf(\"%u total codes\\n\", 256*256*256);\n    printf(\"total error: %u codes %u bits (R %d/%u G %d/%u B %d/%u)\\n\"\n\t, eCodes\n\t, eBits\n\t, eRtotal , AbseRtotal\n\t, eGtotal , AbseGtotal\n\t, eBtotal , AbseBtotal\n    );\n    return (0);\n}\n\nfloat\t*lumaRed;\nfloat\t*lumaGreen;\nfloat\t*lumaBlue;\n\nstatic float*\nsetupLuma(float c)\n{\n    float *v = (float *)_TIFFmalloc(256 * sizeof (float));\n    int i;\n    for (i = 0; i < 256; i++)\n\tv[i] = c * i;\n    return (v);\n}\n\nstatic void\nsetupLumaTables(void)\n{\n    lumaRed = setupLuma(LumaRed);\n    lumaGreen = setupLuma(LumaGreen);\n    lumaBlue = setupLuma(LumaBlue);\n}\n\nstatic unsigned\nV2Code(float f, unsigned long RB, unsigned long RW, int CR)\n{\n    unsigned int c = (unsigned int)((((f)*(RW-RB)/CR)+RB)+.5);\n    return (c > 255 ? 255 : c);\n}\n\n#define\tCode2V(c, RB, RW, CR)\t((((c)-(int)RB)*(float)CR)/(float)(RW-RB))\n\n#define\tCLAMP(f,min,max) \\\n    (int)((f)+.5 < (min) ? (min) : (f)+.5 > (max) ? (max) : (f)+.5)\n\nstatic\nvoid\ncheck(int R, int G, int B)\n{\n    float Y, Cb, Cr;\n    int iY, iCb, iCr;\n    float rY, rCb, rCr;\n    float rR, rG, rB;\n    int eR, eG, eB;\n\n    Y = lumaRed[R] + lumaGreen[G] + lumaBlue[B];\n    Cb = (B - Y)*D2;\n    Cr = (R - Y)*D1;\n    iY = V2Code(Y, refBlackWhite[0], refBlackWhite[1], 255);\n    iCb = V2Code(Cb, refBlackWhite[2], refBlackWhite[3], 127);\n    iCr = V2Code(Cr, refBlackWhite[4], refBlackWhite[5], 127);\n    rCb = Code2V(iCb, refBlackWhite[2], refBlackWhite[3], 127);\n    rCr = Code2V(iCr, refBlackWhite[4], refBlackWhite[5], 127);\n    rY = Code2V(iY, refBlackWhite[0], refBlackWhite[1], 255);\n    rR = rY + rCr*D3;\n    rB = rY + rCb*D4;\n    rG = rY - rCb*D6 - rCr*D5;\n    eR = R - CLAMP(rR,0,255);\n    eG = G - CLAMP(rG,0,255);\n    eB = B - CLAMP(rB,0,255);\n    if (abs(eR) > 1 || abs(eG) > 1 || abs(eB) > 1) {\n\tprintf(\"R %u G %u B %u\", R, G, B);\n\tprintf(\" Y %g Cb %g Cr %g\", Y, Cb, Cr);\n\tprintf(\" iY %u iCb %u iCr %u\", iY, iCb, iCr);\n\tprintf(\"\\n -> Y %g Cb %g Cr %g\", rY, rCb, rCr);\n\tprintf(\" R %g (%u) G %g (%u) B %g (%u) E=[%d %d %d])\\n\"\n\t    , rR, CLAMP(rR,0,255)\n\t    , rG, CLAMP(rG,0,255)\n\t    , rB, CLAMP(rB,0,255)\n\t    , eR, eG, eB\n\t);\n    }\n    eRtotal += eR;\n    eGtotal += eG;\n    eBtotal += eB;\n    AbseRtotal += abs(eR);\n    AbseGtotal += abs(eG);\n    AbseBtotal += abs(eB);\n    if (eR | eG | eB)\n\teCodes++;\n    eBits += abs(eR) + abs(eG) + abs(eB);\n}\n"
  },
  {
    "path": "src/main/jni/tiff.h",
    "content": "/* $Id: tiff.h,v 1.43 2006-10-05 15:20:40 dron Exp $ */\n\n/*\n * Copyright (c) 1988-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \n * OF THIS SOFTWARE.\n */\n\n#ifndef _TIFF_\n#define\t_TIFF_\n\n#include \"tiffconf.h\"\n\n/*\n * Tag Image File Format (TIFF)\n *\n * Based on Rev 6.0 from:\n *    Developer's Desk\n *    Aldus Corporation\n *    411 First Ave. South\n *    Suite 200\n *    Seattle, WA  98104\n *    206-622-5500\n *    \n *    (http://partners.adobe.com/asn/developer/PDFS/TN/TIFF6.pdf)\n *\n * For Big TIFF design notes see the following link\n *    http://www.remotesensing.org/libtiff/bigtiffdesign.html\n */\n#define\tTIFF_VERSION\t        42\n#define TIFF_BIGTIFF_VERSION    43\n\n#define\tTIFF_BIGENDIAN\t\t0x4d4d\n#define\tTIFF_LITTLEENDIAN\t0x4949\n#define\tMDI_LITTLEENDIAN        0x5045\n#define\tMDI_BIGENDIAN           0x4550\n/*\n * Intrinsic data types required by the file format:\n *\n * 8-bit quantities\tint8/uint8\n * 16-bit quantities\tint16/uint16\n * 32-bit quantities\tint32/uint32\n * strings\t\tunsigned char*\n */\n\n#ifndef HAVE_INT8\ntypedef\tsigned char int8;\t/* NB: non-ANSI compilers may not grok */\n#endif\ntypedef\tunsigned char uint8;\n#ifndef HAVE_INT16\ntypedef\tshort int16;\n#endif\ntypedef\tunsigned short uint16;\t/* sizeof (uint16) must == 2 */\n#if SIZEOF_INT == 4\n#ifndef HAVE_INT32\ntypedef\tint int32;\n#endif\ntypedef\tunsigned int uint32;\t/* sizeof (uint32) must == 4 */\n#elif SIZEOF_LONG == 4\n#ifndef HAVE_INT32\ntypedef\tlong int32;\n#endif\ntypedef\tunsigned long uint32;\t/* sizeof (uint32) must == 4 */\n#endif\n\n/* For TIFFReassignTagToIgnore */\nenum TIFFIgnoreSense /* IGNORE tag table */\n{\n\tTIS_STORE,\n\tTIS_EXTRACT,\n\tTIS_EMPTY\n};\n\n/*\n * TIFF header.\n */\ntypedef\tstruct {\n\tuint16\ttiff_magic;\t/* magic number (defines byte order) */\n#define TIFF_MAGIC_SIZE\t\t2\n\tuint16\ttiff_version;\t/* TIFF version number */\n#define TIFF_VERSION_SIZE\t2\n\tuint32\ttiff_diroff;\t/* byte offset to first directory */\n#define TIFF_DIROFFSET_SIZE\t4\n} TIFFHeader;\n\n\n/*\n * TIFF Image File Directories are comprised of a table of field\n * descriptors of the form shown below.  The table is sorted in\n * ascending order by tag.  The values associated with each entry are\n * disjoint and may appear anywhere in the file (so long as they are\n * placed on a word boundary).\n *\n * If the value is 4 bytes or less, then it is placed in the offset\n * field to save space.  If the value is less than 4 bytes, it is\n * left-justified in the offset field.\n */\ntypedef\tstruct {\n\tuint16\t\ttdir_tag;\t/* see below */\n\tuint16\t\ttdir_type;\t/* data type; see below */\n\tuint32\t\ttdir_count;\t/* number of items; length in spec */\n\tuint32\t\ttdir_offset;\t/* byte offset to field data */\n} TIFFDirEntry;\n\n/*\n * NB: In the comments below,\n *  - items marked with a + are obsoleted by revision 5.0,\n *  - items marked with a ! are introduced in revision 6.0.\n *  - items marked with a % are introduced post revision 6.0.\n *  - items marked with a $ are obsoleted by revision 6.0.\n *  - items marked with a & are introduced by Adobe DNG specification.\n */\n\n/*\n * Tag data type information.\n *\n * Note: RATIONALs are the ratio of two 32-bit integer values.\n */\ntypedef\tenum {\n\tTIFF_NOTYPE\t= 0,\t/* placeholder */\n\tTIFF_BYTE\t= 1,\t/* 8-bit unsigned integer */\n\tTIFF_ASCII\t= 2,\t/* 8-bit bytes w/ last byte null */\n\tTIFF_SHORT\t= 3,\t/* 16-bit unsigned integer */\n\tTIFF_LONG\t= 4,\t/* 32-bit unsigned integer */\n\tTIFF_RATIONAL\t= 5,\t/* 64-bit unsigned fraction */\n\tTIFF_SBYTE\t= 6,\t/* !8-bit signed integer */\n\tTIFF_UNDEFINED\t= 7,\t/* !8-bit untyped data */\n\tTIFF_SSHORT\t= 8,\t/* !16-bit signed integer */\n\tTIFF_SLONG\t= 9,\t/* !32-bit signed integer */\n\tTIFF_SRATIONAL\t= 10,\t/* !64-bit signed fraction */\n\tTIFF_FLOAT\t= 11,\t/* !32-bit IEEE floating point */\n\tTIFF_DOUBLE\t= 12,\t/* !64-bit IEEE floating point */\n\tTIFF_IFD\t= 13\t/* %32-bit unsigned integer (offset) */\n} TIFFDataType;\n\n/*\n * TIFF Tag Definitions.\n */\n#define\tTIFFTAG_SUBFILETYPE\t\t254\t/* subfile data descriptor */\n#define\t    FILETYPE_REDUCEDIMAGE\t0x1\t/* reduced resolution version */\n#define\t    FILETYPE_PAGE\t\t0x2\t/* one page of many */\n#define\t    FILETYPE_MASK\t\t0x4\t/* transparency mask */\n#define\tTIFFTAG_OSUBFILETYPE\t\t255\t/* +kind of data in subfile */\n#define\t    OFILETYPE_IMAGE\t\t1\t/* full resolution image data */\n#define\t    OFILETYPE_REDUCEDIMAGE\t2\t/* reduced size image data */\n#define\t    OFILETYPE_PAGE\t\t3\t/* one page of many */\n#define\tTIFFTAG_IMAGEWIDTH\t\t256\t/* image width in pixels */\n#define\tTIFFTAG_IMAGELENGTH\t\t257\t/* image height in pixels */\n#define\tTIFFTAG_BITSPERSAMPLE\t\t258\t/* bits per channel (sample) */\n#define\tTIFFTAG_COMPRESSION\t\t259\t/* data compression technique */\n#define\t    COMPRESSION_NONE\t\t1\t/* dump mode */\n#define\t    COMPRESSION_CCITTRLE\t2\t/* CCITT modified Huffman RLE */\n#define\t    COMPRESSION_CCITTFAX3\t3\t/* CCITT Group 3 fax encoding */\n#define     COMPRESSION_CCITT_T4        3       /* CCITT T.4 (TIFF 6 name) */\n#define\t    COMPRESSION_CCITTFAX4\t4\t/* CCITT Group 4 fax encoding */\n#define     COMPRESSION_CCITT_T6        4       /* CCITT T.6 (TIFF 6 name) */\n#define\t    COMPRESSION_LZW\t\t5       /* Lempel-Ziv  & Welch */\n#define\t    COMPRESSION_OJPEG\t\t6\t/* !6.0 JPEG */\n#define\t    COMPRESSION_JPEG\t\t7\t/* %JPEG DCT compression */\n#define\t    COMPRESSION_NEXT\t\t32766\t/* NeXT 2-bit RLE */\n#define\t    COMPRESSION_CCITTRLEW\t32771\t/* #1 w/ word alignment */\n#define\t    COMPRESSION_PACKBITS\t32773\t/* Macintosh RLE */\n#define\t    COMPRESSION_THUNDERSCAN\t32809\t/* ThunderScan RLE */\n/* codes 32895-32898 are reserved for ANSI IT8 TIFF/IT <dkelly@apago.com) */\n#define\t    COMPRESSION_IT8CTPAD\t32895   /* IT8 CT w/padding */\n#define\t    COMPRESSION_IT8LW\t\t32896   /* IT8 Linework RLE */\n#define\t    COMPRESSION_IT8MP\t\t32897   /* IT8 Monochrome picture */\n#define\t    COMPRESSION_IT8BL\t\t32898   /* IT8 Binary line art */\n/* compression codes 32908-32911 are reserved for Pixar */\n#define     COMPRESSION_PIXARFILM\t32908   /* Pixar companded 10bit LZW */\n#define\t    COMPRESSION_PIXARLOG\t32909   /* Pixar companded 11bit ZIP */\n#define\t    COMPRESSION_DEFLATE\t\t32946\t/* Deflate compression */\n#define     COMPRESSION_ADOBE_DEFLATE   8       /* Deflate compression,\n\t\t\t\t\t\t   as recognized by Adobe */\n/* compression code 32947 is reserved for Oceana Matrix <dev@oceana.com> */\n#define     COMPRESSION_DCS             32947   /* Kodak DCS encoding */\n#define\t    COMPRESSION_JBIG\t\t34661\t/* ISO JBIG */\n#define     COMPRESSION_SGILOG\t\t34676\t/* SGI Log Luminance RLE */\n#define     COMPRESSION_SGILOG24\t34677\t/* SGI Log 24-bit packed */\n#define     COMPRESSION_JP2000          34712   /* Leadtools JPEG2000 */\n#define\tTIFFTAG_PHOTOMETRIC\t\t262\t/* photometric interpretation */\n#define\t    PHOTOMETRIC_MINISWHITE\t0\t/* min value is white */\n#define\t    PHOTOMETRIC_MINISBLACK\t1\t/* min value is black */\n#define\t    PHOTOMETRIC_RGB\t\t2\t/* RGB color model */\n#define\t    PHOTOMETRIC_PALETTE\t\t3\t/* color map indexed */\n#define\t    PHOTOMETRIC_MASK\t\t4\t/* $holdout mask */\n#define\t    PHOTOMETRIC_SEPARATED\t5\t/* !color separations */\n#define\t    PHOTOMETRIC_YCBCR\t\t6\t/* !CCIR 601 */\n#define\t    PHOTOMETRIC_CIELAB\t\t8\t/* !1976 CIE L*a*b* */\n#define\t    PHOTOMETRIC_ICCLAB\t\t9\t/* ICC L*a*b* [Adobe TIFF Technote 4] */\n#define\t    PHOTOMETRIC_ITULAB\t\t10\t/* ITU L*a*b* */\n#define     PHOTOMETRIC_LOGL\t\t32844\t/* CIE Log2(L) */\n#define     PHOTOMETRIC_LOGLUV\t\t32845\t/* CIE Log2(L) (u',v') */\n#define\tTIFFTAG_THRESHHOLDING\t\t263\t/* +thresholding used on data */\n#define\t    THRESHHOLD_BILEVEL\t\t1\t/* b&w art scan */\n#define\t    THRESHHOLD_HALFTONE\t\t2\t/* or dithered scan */\n#define\t    THRESHHOLD_ERRORDIFFUSE\t3\t/* usually floyd-steinberg */\n#define\tTIFFTAG_CELLWIDTH\t\t264\t/* +dithering matrix width */\n#define\tTIFFTAG_CELLLENGTH\t\t265\t/* +dithering matrix height */\n#define\tTIFFTAG_FILLORDER\t\t266\t/* data order within a byte */\n#define\t    FILLORDER_MSB2LSB\t\t1\t/* most significant -> least */\n#define\t    FILLORDER_LSB2MSB\t\t2\t/* least significant -> most */\n#define\tTIFFTAG_DOCUMENTNAME\t\t269\t/* name of doc. image is from */\n#define\tTIFFTAG_IMAGEDESCRIPTION\t270\t/* info about image */\n#define\tTIFFTAG_MAKE\t\t\t271\t/* scanner manufacturer name */\n#define\tTIFFTAG_MODEL\t\t\t272\t/* scanner model name/number */\n#define\tTIFFTAG_STRIPOFFSETS\t\t273\t/* offsets to data strips */\n#define\tTIFFTAG_ORIENTATION\t\t274\t/* +image orientation */\n#define\t    ORIENTATION_TOPLEFT\t\t1\t/* row 0 top, col 0 lhs */\n#define\t    ORIENTATION_TOPRIGHT\t2\t/* row 0 top, col 0 rhs */\n#define\t    ORIENTATION_BOTRIGHT\t3\t/* row 0 bottom, col 0 rhs */\n#define\t    ORIENTATION_BOTLEFT\t\t4\t/* row 0 bottom, col 0 lhs */\n#define\t    ORIENTATION_LEFTTOP\t\t5\t/* row 0 lhs, col 0 top */\n#define\t    ORIENTATION_RIGHTTOP\t6\t/* row 0 rhs, col 0 top */\n#define\t    ORIENTATION_RIGHTBOT\t7\t/* row 0 rhs, col 0 bottom */\n#define\t    ORIENTATION_LEFTBOT\t\t8\t/* row 0 lhs, col 0 bottom */\n#define\tTIFFTAG_SAMPLESPERPIXEL\t\t277\t/* samples per pixel */\n#define\tTIFFTAG_ROWSPERSTRIP\t\t278\t/* rows per strip of data */\n#define\tTIFFTAG_STRIPBYTECOUNTS\t\t279\t/* bytes counts for strips */\n#define\tTIFFTAG_MINSAMPLEVALUE\t\t280\t/* +minimum sample value */\n#define\tTIFFTAG_MAXSAMPLEVALUE\t\t281\t/* +maximum sample value */\n#define\tTIFFTAG_XRESOLUTION\t\t282\t/* pixels/resolution in x */\n#define\tTIFFTAG_YRESOLUTION\t\t283\t/* pixels/resolution in y */\n#define\tTIFFTAG_PLANARCONFIG\t\t284\t/* storage organization */\n#define\t    PLANARCONFIG_CONTIG\t\t1\t/* single image plane */\n#define\t    PLANARCONFIG_SEPARATE\t2\t/* separate planes of data */\n#define\tTIFFTAG_PAGENAME\t\t285\t/* page name image is from */\n#define\tTIFFTAG_XPOSITION\t\t286\t/* x page offset of image lhs */\n#define\tTIFFTAG_YPOSITION\t\t287\t/* y page offset of image lhs */\n#define\tTIFFTAG_FREEOFFSETS\t\t288\t/* +byte offset to free block */\n#define\tTIFFTAG_FREEBYTECOUNTS\t\t289\t/* +sizes of free blocks */\n#define\tTIFFTAG_GRAYRESPONSEUNIT\t290\t/* $gray scale curve accuracy */\n#define\t    GRAYRESPONSEUNIT_10S\t1\t/* tenths of a unit */\n#define\t    GRAYRESPONSEUNIT_100S\t2\t/* hundredths of a unit */\n#define\t    GRAYRESPONSEUNIT_1000S\t3\t/* thousandths of a unit */\n#define\t    GRAYRESPONSEUNIT_10000S\t4\t/* ten-thousandths of a unit */\n#define\t    GRAYRESPONSEUNIT_100000S\t5\t/* hundred-thousandths */\n#define\tTIFFTAG_GRAYRESPONSECURVE\t291\t/* $gray scale response curve */\n#define\tTIFFTAG_GROUP3OPTIONS\t\t292\t/* 32 flag bits */\n#define\tTIFFTAG_T4OPTIONS\t\t292\t/* TIFF 6.0 proper name alias */\n#define\t    GROUP3OPT_2DENCODING\t0x1\t/* 2-dimensional coding */\n#define\t    GROUP3OPT_UNCOMPRESSED\t0x2\t/* data not compressed */\n#define\t    GROUP3OPT_FILLBITS\t\t0x4\t/* fill to byte boundary */\n#define\tTIFFTAG_GROUP4OPTIONS\t\t293\t/* 32 flag bits */\n#define TIFFTAG_T6OPTIONS               293     /* TIFF 6.0 proper name */\n#define\t    GROUP4OPT_UNCOMPRESSED\t0x2\t/* data not compressed */\n#define\tTIFFTAG_RESOLUTIONUNIT\t\t296\t/* units of resolutions */\n#define\t    RESUNIT_NONE\t\t1\t/* no meaningful units */\n#define\t    RESUNIT_INCH\t\t2\t/* english */\n#define\t    RESUNIT_CENTIMETER\t\t3\t/* metric */\n#define\tTIFFTAG_PAGENUMBER\t\t297\t/* page numbers of multi-page */\n#define\tTIFFTAG_COLORRESPONSEUNIT\t300\t/* $color curve accuracy */\n#define\t    COLORRESPONSEUNIT_10S\t1\t/* tenths of a unit */\n#define\t    COLORRESPONSEUNIT_100S\t2\t/* hundredths of a unit */\n#define\t    COLORRESPONSEUNIT_1000S\t3\t/* thousandths of a unit */\n#define\t    COLORRESPONSEUNIT_10000S\t4\t/* ten-thousandths of a unit */\n#define\t    COLORRESPONSEUNIT_100000S\t5\t/* hundred-thousandths */\n#define\tTIFFTAG_TRANSFERFUNCTION\t301\t/* !colorimetry info */\n#define\tTIFFTAG_SOFTWARE\t\t305\t/* name & release */\n#define\tTIFFTAG_DATETIME\t\t306\t/* creation date and time */\n#define\tTIFFTAG_ARTIST\t\t\t315\t/* creator of image */\n#define\tTIFFTAG_HOSTCOMPUTER\t\t316\t/* machine where created */\n#define\tTIFFTAG_PREDICTOR\t\t317\t/* prediction scheme w/ LZW */\n#define     PREDICTOR_NONE\t\t1\t/* no prediction scheme used */\n#define     PREDICTOR_HORIZONTAL\t2\t/* horizontal differencing */\n#define     PREDICTOR_FLOATINGPOINT\t3\t/* floating point predictor */\n#define\tTIFFTAG_WHITEPOINT\t\t318\t/* image white point */\n#define\tTIFFTAG_PRIMARYCHROMATICITIES\t319\t/* !primary chromaticities */\n#define\tTIFFTAG_COLORMAP\t\t320\t/* RGB map for pallette image */\n#define\tTIFFTAG_HALFTONEHINTS\t\t321\t/* !highlight+shadow info */\n#define\tTIFFTAG_TILEWIDTH\t\t322\t/* !tile width in pixels */\n#define\tTIFFTAG_TILELENGTH\t\t323\t/* !tile height in pixels */\n#define TIFFTAG_TILEOFFSETS\t\t324\t/* !offsets to data tiles */\n#define TIFFTAG_TILEBYTECOUNTS\t\t325\t/* !byte counts for tiles */\n#define\tTIFFTAG_BADFAXLINES\t\t326\t/* lines w/ wrong pixel count */\n#define\tTIFFTAG_CLEANFAXDATA\t\t327\t/* regenerated line info */\n#define\t    CLEANFAXDATA_CLEAN\t\t0\t/* no errors detected */\n#define\t    CLEANFAXDATA_REGENERATED\t1\t/* receiver regenerated lines */\n#define\t    CLEANFAXDATA_UNCLEAN\t2\t/* uncorrected errors exist */\n#define\tTIFFTAG_CONSECUTIVEBADFAXLINES\t328\t/* max consecutive bad lines */\n#define\tTIFFTAG_SUBIFD\t\t\t330\t/* subimage descriptors */\n#define\tTIFFTAG_INKSET\t\t\t332\t/* !inks in separated image */\n#define\t    INKSET_CMYK\t\t\t1\t/* !cyan-magenta-yellow-black color */\n#define\t    INKSET_MULTIINK\t\t2\t/* !multi-ink or hi-fi color */\n#define\tTIFFTAG_INKNAMES\t\t333\t/* !ascii names of inks */\n#define\tTIFFTAG_NUMBEROFINKS\t\t334\t/* !number of inks */\n#define\tTIFFTAG_DOTRANGE\t\t336\t/* !0% and 100% dot codes */\n#define\tTIFFTAG_TARGETPRINTER\t\t337\t/* !separation target */\n#define\tTIFFTAG_EXTRASAMPLES\t\t338\t/* !info about extra samples */\n#define\t    EXTRASAMPLE_UNSPECIFIED\t0\t/* !unspecified data */\n#define\t    EXTRASAMPLE_ASSOCALPHA\t1\t/* !associated alpha data */\n#define\t    EXTRASAMPLE_UNASSALPHA\t2\t/* !unassociated alpha data */\n#define\tTIFFTAG_SAMPLEFORMAT\t\t339\t/* !data sample format */\n#define\t    SAMPLEFORMAT_UINT\t\t1\t/* !unsigned integer data */\n#define\t    SAMPLEFORMAT_INT\t\t2\t/* !signed integer data */\n#define\t    SAMPLEFORMAT_IEEEFP\t\t3\t/* !IEEE floating point data */\n#define\t    SAMPLEFORMAT_VOID\t\t4\t/* !untyped data */\n#define\t    SAMPLEFORMAT_COMPLEXINT\t5\t/* !complex signed int */\n#define\t    SAMPLEFORMAT_COMPLEXIEEEFP\t6\t/* !complex ieee floating */\n#define\tTIFFTAG_SMINSAMPLEVALUE\t\t340\t/* !variable MinSampleValue */\n#define\tTIFFTAG_SMAXSAMPLEVALUE\t\t341\t/* !variable MaxSampleValue */\n#define\tTIFFTAG_CLIPPATH\t\t343\t/* %ClipPath\n\t\t\t\t\t\t   [Adobe TIFF technote 2] */\n#define\tTIFFTAG_XCLIPPATHUNITS\t\t344\t/* %XClipPathUnits\n\t\t\t\t\t\t   [Adobe TIFF technote 2] */\n#define\tTIFFTAG_YCLIPPATHUNITS\t\t345\t/* %YClipPathUnits\n\t\t\t\t\t\t   [Adobe TIFF technote 2] */\n#define\tTIFFTAG_INDEXED\t\t\t346\t/* %Indexed\n\t\t\t\t\t\t   [Adobe TIFF Technote 3] */\n#define\tTIFFTAG_JPEGTABLES\t\t347\t/* %JPEG table stream */\n#define\tTIFFTAG_OPIPROXY\t\t351\t/* %OPI Proxy [Adobe TIFF technote] */\n/*\n * Tags 512-521 are obsoleted by Technical Note #2 which specifies a\n * revised JPEG-in-TIFF scheme.\n */\n#define\tTIFFTAG_JPEGPROC\t\t512\t/* !JPEG processing algorithm */\n#define\t    JPEGPROC_BASELINE\t\t1\t/* !baseline sequential */\n#define\t    JPEGPROC_LOSSLESS\t\t14\t/* !Huffman coded lossless */\n#define\tTIFFTAG_JPEGIFOFFSET\t\t513\t/* !pointer to SOI marker */\n#define\tTIFFTAG_JPEGIFBYTECOUNT\t\t514\t/* !JFIF stream length */\n#define\tTIFFTAG_JPEGRESTARTINTERVAL\t515\t/* !restart interval length */\n#define\tTIFFTAG_JPEGLOSSLESSPREDICTORS\t517\t/* !lossless proc predictor */\n#define\tTIFFTAG_JPEGPOINTTRANSFORM\t518\t/* !lossless point transform */\n#define\tTIFFTAG_JPEGQTABLES\t\t519\t/* !Q matrice offsets */\n#define\tTIFFTAG_JPEGDCTABLES\t\t520\t/* !DCT table offsets */\n#define\tTIFFTAG_JPEGACTABLES\t\t521\t/* !AC coefficient offsets */\n#define\tTIFFTAG_YCBCRCOEFFICIENTS\t529\t/* !RGB -> YCbCr transform */\n#define\tTIFFTAG_YCBCRSUBSAMPLING\t530\t/* !YCbCr subsampling factors */\n#define\tTIFFTAG_YCBCRPOSITIONING\t531\t/* !subsample positioning */\n#define\t    YCBCRPOSITION_CENTERED\t1\t/* !as in PostScript Level 2 */\n#define\t    YCBCRPOSITION_COSITED\t2\t/* !as in CCIR 601-1 */\n#define\tTIFFTAG_REFERENCEBLACKWHITE\t532\t/* !colorimetry info */\n#define\tTIFFTAG_XMLPACKET\t\t700\t/* %XML packet\n\t\t\t\t\t\t   [Adobe XMP Specification,\n\t\t\t\t\t\t   January 2004 */\n#define TIFFTAG_OPIIMAGEID\t\t32781\t/* %OPI ImageID\n\t\t\t\t\t\t   [Adobe TIFF technote] */\n/* tags 32952-32956 are private tags registered to Island Graphics */\n#define TIFFTAG_REFPTS\t\t\t32953\t/* image reference points */\n#define TIFFTAG_REGIONTACKPOINT\t\t32954\t/* region-xform tack point */\n#define TIFFTAG_REGIONWARPCORNERS\t32955\t/* warp quadrilateral */\n#define TIFFTAG_REGIONAFFINE\t\t32956\t/* affine transformation mat */\n/* tags 32995-32999 are private tags registered to SGI */\n#define\tTIFFTAG_MATTEING\t\t32995\t/* $use ExtraSamples */\n#define\tTIFFTAG_DATATYPE\t\t32996\t/* $use SampleFormat */\n#define\tTIFFTAG_IMAGEDEPTH\t\t32997\t/* z depth of image */\n#define\tTIFFTAG_TILEDEPTH\t\t32998\t/* z depth/data tile */\n/* tags 33300-33309 are private tags registered to Pixar */\n/*\n * TIFFTAG_PIXAR_IMAGEFULLWIDTH and TIFFTAG_PIXAR_IMAGEFULLLENGTH\n * are set when an image has been cropped out of a larger image.  \n * They reflect the size of the original uncropped image.\n * The TIFFTAG_XPOSITION and TIFFTAG_YPOSITION can be used\n * to determine the position of the smaller image in the larger one.\n */\n#define TIFFTAG_PIXAR_IMAGEFULLWIDTH    33300   /* full image size in x */\n#define TIFFTAG_PIXAR_IMAGEFULLLENGTH   33301   /* full image size in y */\n /* Tags 33302-33306 are used to identify special image modes and data\n  * used by Pixar's texture formats.\n  */\n#define TIFFTAG_PIXAR_TEXTUREFORMAT\t33302\t/* texture map format */\n#define TIFFTAG_PIXAR_WRAPMODES\t\t33303\t/* s & t wrap modes */\n#define TIFFTAG_PIXAR_FOVCOT\t\t33304\t/* cotan(fov) for env. maps */\n#define TIFFTAG_PIXAR_MATRIX_WORLDTOSCREEN 33305\n#define TIFFTAG_PIXAR_MATRIX_WORLDTOCAMERA 33306\n/* tag 33405 is a private tag registered to Eastman Kodak */\n#define TIFFTAG_WRITERSERIALNUMBER      33405   /* device serial number */\n/* tag 33432 is listed in the 6.0 spec w/ unknown ownership */\n#define\tTIFFTAG_COPYRIGHT\t\t33432\t/* copyright string */\n/* IPTC TAG from RichTIFF specifications */\n#define TIFFTAG_RICHTIFFIPTC\t\t33723\n/* 34016-34029 are reserved for ANSI IT8 TIFF/IT <dkelly@apago.com) */\n#define TIFFTAG_IT8SITE\t\t\t34016\t/* site name */\n#define TIFFTAG_IT8COLORSEQUENCE\t34017\t/* color seq. [RGB,CMYK,etc] */\n#define TIFFTAG_IT8HEADER\t\t34018\t/* DDES Header */\n#define TIFFTAG_IT8RASTERPADDING\t34019\t/* raster scanline padding */\n#define TIFFTAG_IT8BITSPERRUNLENGTH\t34020\t/* # of bits in short run */\n#define TIFFTAG_IT8BITSPEREXTENDEDRUNLENGTH 34021/* # of bits in long run */\n#define TIFFTAG_IT8COLORTABLE\t\t34022\t/* LW colortable */\n#define TIFFTAG_IT8IMAGECOLORINDICATOR\t34023\t/* BP/BL image color switch */\n#define TIFFTAG_IT8BKGCOLORINDICATOR\t34024\t/* BP/BL bg color switch */\n#define TIFFTAG_IT8IMAGECOLORVALUE\t34025\t/* BP/BL image color value */\n#define TIFFTAG_IT8BKGCOLORVALUE\t34026\t/* BP/BL bg color value */\n#define TIFFTAG_IT8PIXELINTENSITYRANGE\t34027\t/* MP pixel intensity value */\n#define TIFFTAG_IT8TRANSPARENCYINDICATOR 34028\t/* HC transparency switch */\n#define TIFFTAG_IT8COLORCHARACTERIZATION 34029\t/* color character. table */\n#define TIFFTAG_IT8HCUSAGE\t\t34030\t/* HC usage indicator */\n#define TIFFTAG_IT8TRAPINDICATOR\t34031\t/* Trapping indicator\n\t\t\t\t\t\t   (untrapped=0, trapped=1) */\n#define TIFFTAG_IT8CMYKEQUIVALENT\t34032\t/* CMYK color equivalents */\n/* tags 34232-34236 are private tags registered to Texas Instruments */\n#define TIFFTAG_FRAMECOUNT              34232   /* Sequence Frame Count */\n/* tag 34377 is private tag registered to Adobe for PhotoShop */\n#define TIFFTAG_PHOTOSHOP\t\t34377 \n/* tags 34665, 34853 and 40965 are documented in EXIF specification */\n#define TIFFTAG_EXIFIFD\t\t\t34665\t/* Pointer to EXIF private directory */\n/* tag 34750 is a private tag registered to Adobe? */\n#define TIFFTAG_ICCPROFILE\t\t34675\t/* ICC profile data */\n/* tag 34750 is a private tag registered to Pixel Magic */\n#define\tTIFFTAG_JBIGOPTIONS\t\t34750\t/* JBIG options */\n#define TIFFTAG_GPSIFD\t\t\t34853\t/* Pointer to GPS private directory */\n/* tags 34908-34914 are private tags registered to SGI */\n#define\tTIFFTAG_FAXRECVPARAMS\t\t34908\t/* encoded Class 2 ses. parms */\n#define\tTIFFTAG_FAXSUBADDRESS\t\t34909\t/* received SubAddr string */\n#define\tTIFFTAG_FAXRECVTIME\t\t34910\t/* receive time (secs) */\n#define\tTIFFTAG_FAXDCS\t\t\t34911\t/* encoded fax ses. params, Table 2/T.30 */\n/* tags 37439-37443 are registered to SGI <gregl@sgi.com> */\n#define TIFFTAG_STONITS\t\t\t37439\t/* Sample value to Nits */\n/* tag 34929 is a private tag registered to FedEx */\n#define\tTIFFTAG_FEDEX_EDR\t\t34929\t/* unknown use */\n#define TIFFTAG_INTEROPERABILITYIFD\t40965\t/* Pointer to Interoperability private directory */\n/* Adobe Digital Negative (DNG) format tags */\n#define TIFFTAG_DNGVERSION\t\t50706\t/* &DNG version number */\n#define TIFFTAG_DNGBACKWARDVERSION\t50707\t/* &DNG compatibility version */\n#define TIFFTAG_UNIQUECAMERAMODEL\t50708\t/* &name for the camera model */\n#define TIFFTAG_LOCALIZEDCAMERAMODEL\t50709\t/* &localized camera model\n\t\t\t\t\t\t   name */\n#define TIFFTAG_CFAPLANECOLOR\t\t50710\t/* &CFAPattern->LinearRaw space\n\t\t\t\t\t\t   mapping */\n#define TIFFTAG_CFALAYOUT\t\t50711\t/* &spatial layout of the CFA */\n#define TIFFTAG_LINEARIZATIONTABLE\t50712\t/* &lookup table description */\n#define TIFFTAG_BLACKLEVELREPEATDIM\t50713\t/* &repeat pattern size for\n\t\t\t\t\t\t   the BlackLevel tag */\n#define TIFFTAG_BLACKLEVEL\t\t50714\t/* &zero light encoding level */\n#define TIFFTAG_BLACKLEVELDELTAH\t50715\t/* &zero light encoding level\n\t\t\t\t\t\t   differences (columns) */\n#define TIFFTAG_BLACKLEVELDELTAV\t50716\t/* &zero light encoding level\n\t\t\t\t\t\t   differences (rows) */\n#define TIFFTAG_WHITELEVEL\t\t50717\t/* &fully saturated encoding\n\t\t\t\t\t\t   level */\n#define TIFFTAG_DEFAULTSCALE\t\t50718\t/* &default scale factors */\n#define TIFFTAG_DEFAULTCROPORIGIN\t50719\t/* &origin of the final image\n\t\t\t\t\t\t   area */\n#define TIFFTAG_DEFAULTCROPSIZE\t\t50720\t/* &size of the final image \n\t\t\t\t\t\t   area */\n#define TIFFTAG_COLORMATRIX1\t\t50721\t/* &XYZ->reference color space\n\t\t\t\t\t\t   transformation matrix 1 */\n#define TIFFTAG_COLORMATRIX2\t\t50722\t/* &XYZ->reference color space\n\t\t\t\t\t\t   transformation matrix 2 */\n#define TIFFTAG_CAMERACALIBRATION1\t50723\t/* &calibration matrix 1 */\n#define TIFFTAG_CAMERACALIBRATION2\t50724\t/* &calibration matrix 2 */\n#define TIFFTAG_REDUCTIONMATRIX1\t50725\t/* &dimensionality reduction\n\t\t\t\t\t\t   matrix 1 */\n#define TIFFTAG_REDUCTIONMATRIX2\t50726\t/* &dimensionality reduction\n\t\t\t\t\t\t   matrix 2 */\n#define TIFFTAG_ANALOGBALANCE\t\t50727\t/* &gain applied the stored raw\n\t\t\t\t\t\t   values*/\n#define TIFFTAG_ASSHOTNEUTRAL\t\t50728\t/* &selected white balance in\n\t\t\t\t\t\t   linear reference space */\n#define TIFFTAG_ASSHOTWHITEXY\t\t50729\t/* &selected white balance in\n\t\t\t\t\t\t   x-y chromaticity\n\t\t\t\t\t\t   coordinates */\n#define TIFFTAG_BASELINEEXPOSURE\t50730\t/* &how much to move the zero\n\t\t\t\t\t\t   point */\n#define TIFFTAG_BASELINENOISE\t\t50731\t/* &relative noise level */\n#define TIFFTAG_BASELINESHARPNESS\t50732\t/* &relative amount of\n\t\t\t\t\t\t   sharpening */\n#define TIFFTAG_BAYERGREENSPLIT\t\t50733\t/* &how closely the values of\n\t\t\t\t\t\t   the green pixels in the\n\t\t\t\t\t\t   blue/green rows track the\n\t\t\t\t\t\t   values of the green pixels\n\t\t\t\t\t\t   in the red/green rows */\n#define TIFFTAG_LINEARRESPONSELIMIT\t50734\t/* &non-linear encoding range */\n#define TIFFTAG_CAMERASERIALNUMBER\t50735\t/* &camera's serial number */\n#define TIFFTAG_LENSINFO\t\t50736\t/* info about the lens */\n#define TIFFTAG_CHROMABLURRADIUS\t50737\t/* &chroma blur radius */\n#define TIFFTAG_ANTIALIASSTRENGTH\t50738\t/* &relative strength of the\n\t\t\t\t\t\t   camera's anti-alias filter */\n#define TIFFTAG_SHADOWSCALE\t\t50739\t/* &used by Adobe Camera Raw */\n#define TIFFTAG_DNGPRIVATEDATA\t\t50740\t/* &manufacturer's private data */\n#define TIFFTAG_MAKERNOTESAFETY\t\t50741\t/* &whether the EXIF MakerNote\n\t\t\t\t\t\t   tag is safe to preserve\n\t\t\t\t\t\t   along with the rest of the\n\t\t\t\t\t\t   EXIF data */\n#define\tTIFFTAG_CALIBRATIONILLUMINANT1\t50778\t/* &illuminant 1 */\n#define TIFFTAG_CALIBRATIONILLUMINANT2\t50779\t/* &illuminant 2 */\n#define TIFFTAG_BESTQUALITYSCALE\t50780\t/* &best quality multiplier */\n#define TIFFTAG_RAWDATAUNIQUEID\t\t50781\t/* &unique identifier for\n\t\t\t\t\t\t   the raw image data */\n#define TIFFTAG_ORIGINALRAWFILENAME\t50827\t/* &file name of the original\n\t\t\t\t\t\t   raw file */\n#define TIFFTAG_ORIGINALRAWFILEDATA\t50828\t/* &contents of the original\n\t\t\t\t\t\t   raw file */\n#define TIFFTAG_ACTIVEAREA\t\t50829\t/* &active (non-masked) pixels\n\t\t\t\t\t\t   of the sensor */\n#define TIFFTAG_MASKEDAREAS\t\t50830\t/* &list of coordinates\n\t\t\t\t\t\t   of fully masked pixels */\n#define TIFFTAG_ASSHOTICCPROFILE\t50831\t/* &these two tags used to */\n#define TIFFTAG_ASSHOTPREPROFILEMATRIX\t50832\t/* map cameras's color space\n\t\t\t\t\t\t   into ICC profile space */\n#define TIFFTAG_CURRENTICCPROFILE\t50833\t/* & */\n#define TIFFTAG_CURRENTPREPROFILEMATRIX\t50834\t/* & */\n/* tag 65535 is an undefined tag used by Eastman Kodak */\n#define TIFFTAG_DCSHUESHIFTVALUES       65535   /* hue shift correction data */\n\n/*\n * The following are ``pseudo tags'' that can be used to control\n * codec-specific functionality.  These tags are not written to file.\n * Note that these values start at 0xffff+1 so that they'll never\n * collide with Aldus-assigned tags.\n *\n * If you want your private pseudo tags ``registered'' (i.e. added to\n * this file), please post a bug report via the tracking system at\n * http://www.remotesensing.org/libtiff/bugs.html with the appropriate\n * C definitions to add.\n */\n#define\tTIFFTAG_FAXMODE\t\t\t65536\t/* Group 3/4 format control */\n#define\t    FAXMODE_CLASSIC\t0x0000\t\t/* default, include RTC */\n#define\t    FAXMODE_NORTC\t0x0001\t\t/* no RTC at end of data */\n#define\t    FAXMODE_NOEOL\t0x0002\t\t/* no EOL code at end of row */\n#define\t    FAXMODE_BYTEALIGN\t0x0004\t\t/* byte align row */\n#define\t    FAXMODE_WORDALIGN\t0x0008\t\t/* word align row */\n#define\t    FAXMODE_CLASSF\tFAXMODE_NORTC\t/* TIFF Class F */\n#define\tTIFFTAG_JPEGQUALITY\t\t65537\t/* Compression quality level */\n/* Note: quality level is on the IJG 0-100 scale.  Default value is 75 */\n#define\tTIFFTAG_JPEGCOLORMODE\t\t65538\t/* Auto RGB<=>YCbCr convert? */\n#define\t    JPEGCOLORMODE_RAW\t0x0000\t\t/* no conversion (default) */\n#define\t    JPEGCOLORMODE_RGB\t0x0001\t\t/* do auto conversion */\n#define\tTIFFTAG_JPEGTABLESMODE\t\t65539\t/* What to put in JPEGTables */\n#define\t    JPEGTABLESMODE_QUANT 0x0001\t\t/* include quantization tbls */\n#define\t    JPEGTABLESMODE_HUFF\t0x0002\t\t/* include Huffman tbls */\n/* Note: default is JPEGTABLESMODE_QUANT | JPEGTABLESMODE_HUFF */\n#define\tTIFFTAG_FAXFILLFUNC\t\t65540\t/* G3/G4 fill function */\n#define\tTIFFTAG_PIXARLOGDATAFMT\t\t65549\t/* PixarLogCodec I/O data sz */\n#define\t    PIXARLOGDATAFMT_8BIT\t0\t/* regular u_char samples */\n#define\t    PIXARLOGDATAFMT_8BITABGR\t1\t/* ABGR-order u_chars */\n#define\t    PIXARLOGDATAFMT_11BITLOG\t2\t/* 11-bit log-encoded (raw) */\n#define\t    PIXARLOGDATAFMT_12BITPICIO\t3\t/* as per PICIO (1.0==2048) */\n#define\t    PIXARLOGDATAFMT_16BIT\t4\t/* signed short samples */\n#define\t    PIXARLOGDATAFMT_FLOAT\t5\t/* IEEE float samples */\n/* 65550-65556 are allocated to Oceana Matrix <dev@oceana.com> */\n#define TIFFTAG_DCSIMAGERTYPE           65550   /* imager model & filter */\n#define     DCSIMAGERMODEL_M3           0       /* M3 chip (1280 x 1024) */\n#define     DCSIMAGERMODEL_M5           1       /* M5 chip (1536 x 1024) */\n#define     DCSIMAGERMODEL_M6           2       /* M6 chip (3072 x 2048) */\n#define     DCSIMAGERFILTER_IR          0       /* infrared filter */\n#define     DCSIMAGERFILTER_MONO        1       /* monochrome filter */\n#define     DCSIMAGERFILTER_CFA         2       /* color filter array */\n#define     DCSIMAGERFILTER_OTHER       3       /* other filter */\n#define TIFFTAG_DCSINTERPMODE           65551   /* interpolation mode */\n#define     DCSINTERPMODE_NORMAL        0x0     /* whole image, default */\n#define     DCSINTERPMODE_PREVIEW       0x1     /* preview of image (384x256) */\n#define TIFFTAG_DCSBALANCEARRAY         65552   /* color balance values */\n#define TIFFTAG_DCSCORRECTMATRIX        65553   /* color correction values */\n#define TIFFTAG_DCSGAMMA                65554   /* gamma value */\n#define TIFFTAG_DCSTOESHOULDERPTS       65555   /* toe & shoulder points */\n#define TIFFTAG_DCSCALIBRATIONFD        65556   /* calibration file desc */\n/* Note: quality level is on the ZLIB 1-9 scale. Default value is -1 */\n#define\tTIFFTAG_ZIPQUALITY\t\t65557\t/* compression quality level */\n#define\tTIFFTAG_PIXARLOGQUALITY\t\t65558\t/* PixarLog uses same scale */\n/* 65559 is allocated to Oceana Matrix <dev@oceana.com> */\n#define TIFFTAG_DCSCLIPRECTANGLE\t65559\t/* area of image to acquire */\n#define TIFFTAG_SGILOGDATAFMT\t\t65560\t/* SGILog user data format */\n#define     SGILOGDATAFMT_FLOAT\t\t0\t/* IEEE float samples */\n#define     SGILOGDATAFMT_16BIT\t\t1\t/* 16-bit samples */\n#define     SGILOGDATAFMT_RAW\t\t2\t/* uninterpreted data */\n#define     SGILOGDATAFMT_8BIT\t\t3\t/* 8-bit RGB monitor values */\n#define TIFFTAG_SGILOGENCODE\t\t65561 /* SGILog data encoding control*/\n#define     SGILOGENCODE_NODITHER\t0     /* do not dither encoded values*/\n#define     SGILOGENCODE_RANDITHER\t1     /* randomly dither encd values */\n\n/*\n * EXIF tags\n */\n#define EXIFTAG_EXPOSURETIME\t\t33434\t/* Exposure time */\n#define EXIFTAG_FNUMBER\t\t\t33437\t/* F number */\n#define EXIFTAG_EXPOSUREPROGRAM\t\t34850\t/* Exposure program */\n#define EXIFTAG_SPECTRALSENSITIVITY\t34852\t/* Spectral sensitivity */\n#define EXIFTAG_ISOSPEEDRATINGS\t\t34855\t/* ISO speed rating */\n#define EXIFTAG_OECF\t\t\t34856\t/* Optoelectric conversion\n\t\t\t\t\t\t   factor */\n#define EXIFTAG_EXIFVERSION\t\t36864\t/* Exif version */\n#define EXIFTAG_DATETIMEORIGINAL\t36867\t/* Date and time of original\n\t\t\t\t\t\t   data generation */\n#define EXIFTAG_DATETIMEDIGITIZED\t36868\t/* Date and time of digital\n\t\t\t\t\t\t   data generation */\n#define EXIFTAG_COMPONENTSCONFIGURATION\t37121\t/* Meaning of each component */\n#define EXIFTAG_COMPRESSEDBITSPERPIXEL\t37122\t/* Image compression mode */\n#define EXIFTAG_SHUTTERSPEEDVALUE\t37377\t/* Shutter speed */\n#define EXIFTAG_APERTUREVALUE\t\t37378\t/* Aperture */\n#define EXIFTAG_BRIGHTNESSVALUE\t\t37379\t/* Brightness */\n#define EXIFTAG_EXPOSUREBIASVALUE\t37380\t/* Exposure bias */\n#define EXIFTAG_MAXAPERTUREVALUE\t37381\t/* Maximum lens aperture */\n#define EXIFTAG_SUBJECTDISTANCE\t\t37382\t/* Subject distance */\n#define EXIFTAG_METERINGMODE\t\t37383\t/* Metering mode */\n#define EXIFTAG_LIGHTSOURCE\t\t37384\t/* Light source */\n#define EXIFTAG_FLASH\t\t\t37385\t/* Flash */\n#define EXIFTAG_FOCALLENGTH\t\t37386\t/* Lens focal length */\n#define EXIFTAG_SUBJECTAREA\t\t37396\t/* Subject area */\n#define EXIFTAG_MAKERNOTE\t\t37500\t/* Manufacturer notes */\n#define EXIFTAG_USERCOMMENT\t\t37510\t/* User comments */\n#define EXIFTAG_SUBSECTIME\t\t37520\t/* DateTime subseconds */\n#define EXIFTAG_SUBSECTIMEORIGINAL\t37521\t/* DateTimeOriginal subseconds */\n#define EXIFTAG_SUBSECTIMEDIGITIZED\t37522\t/* DateTimeDigitized subseconds */\n#define EXIFTAG_FLASHPIXVERSION\t\t40960\t/* Supported Flashpix version */\n#define EXIFTAG_COLORSPACE\t\t40961\t/* Color space information */\n#define EXIFTAG_PIXELXDIMENSION\t\t40962\t/* Valid image width */\n#define EXIFTAG_PIXELYDIMENSION\t\t40963\t/* Valid image height */\n#define EXIFTAG_RELATEDSOUNDFILE\t40964\t/* Related audio file */\n#define EXIFTAG_FLASHENERGY\t\t41483\t/* Flash energy */\n#define EXIFTAG_SPATIALFREQUENCYRESPONSE 41484\t/* Spatial frequency response */\n#define EXIFTAG_FOCALPLANEXRESOLUTION\t41486\t/* Focal plane X resolution */\n#define EXIFTAG_FOCALPLANEYRESOLUTION\t41487\t/* Focal plane Y resolution */\n#define EXIFTAG_FOCALPLANERESOLUTIONUNIT 41488\t/* Focal plane resolution unit */\n#define EXIFTAG_SUBJECTLOCATION\t\t41492\t/* Subject location */\n#define EXIFTAG_EXPOSUREINDEX\t\t41493\t/* Exposure index */\n#define EXIFTAG_SENSINGMETHOD\t\t41495\t/* Sensing method */\n#define EXIFTAG_FILESOURCE\t\t41728\t/* File source */\n#define EXIFTAG_SCENETYPE\t\t41729\t/* Scene type */\n#define EXIFTAG_CFAPATTERN\t\t41730\t/* CFA pattern */\n#define EXIFTAG_CUSTOMRENDERED\t\t41985\t/* Custom image processing */\n#define EXIFTAG_EXPOSUREMODE\t\t41986\t/* Exposure mode */\n#define EXIFTAG_WHITEBALANCE\t\t41987\t/* White balance */\n#define EXIFTAG_DIGITALZOOMRATIO\t41988\t/* Digital zoom ratio */\n#define EXIFTAG_FOCALLENGTHIN35MMFILM\t41989\t/* Focal length in 35 mm film */\n#define EXIFTAG_SCENECAPTURETYPE\t41990\t/* Scene capture type */\n#define EXIFTAG_GAINCONTROL\t\t41991\t/* Gain control */\n#define EXIFTAG_CONTRAST\t\t41992\t/* Contrast */\n#define EXIFTAG_SATURATION\t\t41993\t/* Saturation */\n#define EXIFTAG_SHARPNESS\t\t41994\t/* Sharpness */\n#define EXIFTAG_DEVICESETTINGDESCRIPTION 41995\t/* Device settings description */\n#define EXIFTAG_SUBJECTDISTANCERANGE\t41996\t/* Subject distance range */\n#define EXIFTAG_GAINCONTROL\t\t41991\t/* Gain control */\n#define EXIFTAG_GAINCONTROL\t\t41991\t/* Gain control */\n#define EXIFTAG_IMAGEUNIQUEID\t\t42016\t/* Unique image ID */\n\n#endif /* _TIFF_ */\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiffconf.h",
    "content": "/* libtiff/tiffconf.h.  Generated from tiffconf.h.in by configure.  */\n/*\n  Configuration defines for installed libtiff.\n  This file maintained for backward compatibility. Do not use definitions\n  from this file in your programs.\n*/\n\n#ifndef _TIFFCONF_\n#define _TIFFCONF_\n\n/* Define to 1 if the system has the type `int16'. */\n/* #undef HAVE_INT16 */\n\n/* Define to 1 if the system has the type `int32'. */\n/* #undef HAVE_INT32 */\n\n/* Define to 1 if the system has the type `int8'. */\n/* #undef HAVE_INT8 */\n\n/* The size of a `int', as computed by sizeof. */\n#define SIZEOF_INT 4\n\n/* The size of a `long', as computed by sizeof. */\n#define SIZEOF_LONG 4\n\n/* Compatibility stuff. */\n\n/* Define as 0 or 1 according to the floating point format suported by the\n   machine */\n#define HAVE_IEEEFP 1\n\n/* Set the native cpu bit order (FILLORDER_LSB2MSB or FILLORDER_MSB2LSB) */\n#define HOST_FILLORDER FILLORDER_LSB2MSB\n\n/* Native cpu byte order: 1 if big-endian (Motorola) or 0 if little-endian\n   (Intel) */\n#define HOST_BIGENDIAN 0\n\n/* Support CCITT Group 3 & 4 algorithms */\n#define CCITT_SUPPORT 1\n\n/* Support JPEG compression (requires IJG JPEG library) */\n#define JPEG_SUPPORT 1\n\n/* Support JBIG compression (requires JBIG-KIT library) */\n/* #undef JBIG_SUPPORT */\n\n/* Support LogLuv high dynamic range encoding */\n#define LOGLUV_SUPPORT 1\n\n/* Support LZW algorithm */\n#define LZW_SUPPORT 1\n\n/* Support NeXT 2-bit RLE algorithm */\n#define NEXT_SUPPORT 1\n\n/* Support Old JPEG compresson (read contrib/ojpeg/README first! Compilation\n   fails with unpatched IJG JPEG library) */\n#define OJPEG_SUPPORT 1\n\n/* Support Macintosh PackBits algorithm */\n#define PACKBITS_SUPPORT 1\n\n/* Support Pixar log-format algorithm (requires Zlib) */\n#define PIXARLOG_SUPPORT 1\n\n/* Support ThunderScan 4-bit RLE algorithm */\n#define THUNDER_SUPPORT 1\n\n/* Support Deflate compression */\n#define ZIP_SUPPORT 1\n\n/* Support strip chopping (whether or not to convert single-strip uncompressed\n   images to mutiple strips of ~8Kb to reduce memory usage) */\n#define STRIPCHOP_DEFAULT TIFF_STRIPCHOP\n\n/* Enable SubIFD tag (330) support */\n#define SUBIFD_SUPPORT 1\n\n/* Treat extra sample as alpha (default enabled). The RGBA interface will\n   treat a fourth sample with no EXTRASAMPLE_ value as being ASSOCALPHA. Many\n   packages produce RGBA files but don't mark the alpha properly. */\n#define DEFAULT_EXTRASAMPLE_AS_ALPHA 1\n\n/* Pick up YCbCr subsampling info from the JPEG data stream to support files\n   lacking the tag (default enabled). */\n#define CHECK_JPEG_YCBCR_SUBSAMPLING 1\n\n/* Support MS MDI magic number files as TIFF */\n#define MDI_SUPPORT 1\n\n/*\n * Feature support definitions.\n * XXX: These macros are obsoleted. Don't use them in your apps!\n * Macros stays here for backward compatibility and should be always defined.\n */\n#define COLORIMETRY_SUPPORT\n#define YCBCR_SUPPORT\n#define CMYK_SUPPORT\n#define ICC_SUPPORT\n#define PHOTOSHOP_SUPPORT\n#define IPTC_SUPPORT\n\n#endif /* _TIFFCONF_ */\n"
  },
  {
    "path": "src/main/jni/tiffio.h",
    "content": "/* $Id: tiffio.h,v 1.56.2.3 2009-01-01 00:10:43 bfriesen Exp $ */\n\n/*\n * Copyright (c) 1988-1997 Sam Leffler\n * Copyright (c) 1991-1997 Silicon Graphics, Inc.\n *\n * Permission to use, copy, modify, distribute, and sell this software and \n * its documentation for any purpose is hereby granted without fee, provided\n * that (i) the above copyright notices and this permission notice appear in\n * all copies of the software and related documentation, and (ii) the names of\n * Sam Leffler and Silicon Graphics may not be used in any advertising or\n * publicity relating to the software without the specific, prior written\n * permission of Sam Leffler and Silicon Graphics.\n * \n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND, \n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  \n * \n * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\n * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\n * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF\n * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE\n * OF THIS SOFTWARE.\n */\n\n#ifndef _TIFFIO_\n#define\t_TIFFIO_\n\n/*\n * TIFF I/O Library Definitions.\n */\n#include \"tiff.h\"\n#include \"tiffvers.h\"\n\n/*\n * TIFF is defined as an incomplete type to hide the\n * library's internal data structures from clients.\n */\ntypedef\tstruct tiff TIFF;\n\n/*\n * The following typedefs define the intrinsic size of\n * data types used in the *exported* interfaces.  These\n * definitions depend on the proper definition of types\n * in tiff.h.  Note also that the varargs interface used\n * to pass tag types and values uses the types defined in\n * tiff.h directly.\n *\n * NB: ttag_t is unsigned int and not unsigned short because\n *     ANSI C requires that the type before the ellipsis be a\n *     promoted type (i.e. one of int, unsigned int, pointer,\n *     or double) and because we defined pseudo-tags that are\n *     outside the range of legal Aldus-assigned tags.\n * NB: tsize_t is int32 and not uint32 because some functions\n *     return -1.\n * NB: toff_t is not off_t for many reasons; TIFFs max out at\n *     32-bit file offsets being the most important, and to ensure\n *     that it is unsigned, rather than signed.\n */\ntypedef uint32 ttag_t;          /* directory tag */\ntypedef uint16 tdir_t;          /* directory index */\ntypedef uint16 tsample_t;       /* sample number */\ntypedef uint32 tstrile_t;       /* strip or tile number */\ntypedef tstrile_t tstrip_t;     /* strip number */\ntypedef tstrile_t ttile_t;      /* tile number */\ntypedef int32 tsize_t;          /* i/o size in bytes */\ntypedef void* tdata_t;          /* image data ref */\ntypedef uint32 toff_t;          /* file offset */\n\n#if !defined(__WIN32__) && (defined(_WIN32) || defined(WIN32))\n#define __WIN32__\n#endif\n\n/*\n * On windows you should define USE_WIN32_FILEIO if you are using tif_win32.c\n * or AVOID_WIN32_FILEIO if you are using something else (like tif_unix.c).\n *\n * By default tif_unix.c is assumed.\n */\n\n#if defined(_WINDOWS) || defined(__WIN32__) || defined(_Windows)\n#  if !defined(__CYGWIN) && !defined(AVOID_WIN32_FILEIO) && !defined(USE_WIN32_FILEIO)\n#    define AVOID_WIN32_FILEIO\n#  endif\n#endif\n\n#if defined(USE_WIN32_FILEIO)\n# define VC_EXTRALEAN\n# include <windows.h>\n# ifdef __WIN32__\nDECLARE_HANDLE(thandle_t);\t/* Win32 file handle */\n# else\ntypedef\tHFILE thandle_t;\t/* client data handle */\n# endif /* __WIN32__ */\n#else\ntypedef\tvoid* thandle_t;\t/* client data handle */\n#endif /* USE_WIN32_FILEIO */\n\n/*\n * Flags to pass to TIFFPrintDirectory to control\n * printing of data structures that are potentially\n * very large.   Bit-or these flags to enable printing\n * multiple items.\n */\n#define\tTIFFPRINT_NONE\t\t0x0\t\t/* no extra info */\n#define\tTIFFPRINT_STRIPS\t0x1\t\t/* strips/tiles info */\n#define\tTIFFPRINT_CURVES\t0x2\t\t/* color/gray response curves */\n#define\tTIFFPRINT_COLORMAP\t0x4\t\t/* colormap */\n#define\tTIFFPRINT_JPEGQTABLES\t0x100\t\t/* JPEG Q matrices */\n#define\tTIFFPRINT_JPEGACTABLES\t0x200\t\t/* JPEG AC tables */\n#define\tTIFFPRINT_JPEGDCTABLES\t0x200\t\t/* JPEG DC tables */\n\n/* \n * Colour conversion stuff\n */\n\n/* reference white */\n#define D65_X0 (95.0470F)\n#define D65_Y0 (100.0F)\n#define D65_Z0 (108.8827F)\n\n#define D50_X0 (96.4250F)\n#define D50_Y0 (100.0F)\n#define D50_Z0 (82.4680F)\n\n/* Structure for holding information about a display device. */\n\ntypedef\tunsigned char TIFFRGBValue;\t\t/* 8-bit samples */\n\ntypedef struct {\n\tfloat d_mat[3][3]; \t\t/* XYZ -> luminance matrix */\n\tfloat d_YCR;\t\t\t/* Light o/p for reference white */\n\tfloat d_YCG;\n\tfloat d_YCB;\n\tuint32 d_Vrwr;\t\t\t/* Pixel values for ref. white */\n\tuint32 d_Vrwg;\n\tuint32 d_Vrwb;\n\tfloat d_Y0R;\t\t\t/* Residual light for black pixel */\n\tfloat d_Y0G;\n\tfloat d_Y0B;\n\tfloat d_gammaR;\t\t\t/* Gamma values for the three guns */\n\tfloat d_gammaG;\n\tfloat d_gammaB;\n} TIFFDisplay;\n\ntypedef struct {\t\t\t\t/* YCbCr->RGB support */\n\tTIFFRGBValue* clamptab;\t\t\t/* range clamping table */\n\tint*\tCr_r_tab;\n\tint*\tCb_b_tab;\n\tint32*\tCr_g_tab;\n\tint32*\tCb_g_tab;\n        int32*  Y_tab;\n} TIFFYCbCrToRGB;\n\ntypedef struct {\t\t\t\t/* CIE Lab 1976->RGB support */\n\tint\trange;\t\t\t\t/* Size of conversion table */\n#define CIELABTORGB_TABLE_RANGE 1500\n\tfloat\trstep, gstep, bstep;\n\tfloat\tX0, Y0, Z0;\t\t\t/* Reference white point */\n\tTIFFDisplay display;\n\tfloat\tYr2r[CIELABTORGB_TABLE_RANGE + 1];  /* Conversion of Yr to r */\n\tfloat\tYg2g[CIELABTORGB_TABLE_RANGE + 1];  /* Conversion of Yg to g */\n\tfloat\tYb2b[CIELABTORGB_TABLE_RANGE + 1];  /* Conversion of Yb to b */\n} TIFFCIELabToRGB;\n\n/*\n * RGBA-style image support.\n */\ntypedef struct _TIFFRGBAImage TIFFRGBAImage;\n/*\n * The image reading and conversion routines invoke\n * ``put routines'' to copy/image/whatever tiles of\n * raw image data.  A default set of routines are \n * provided to convert/copy raw image data to 8-bit\n * packed ABGR format rasters.  Applications can supply\n * alternate routines that unpack the data into a\n * different format or, for example, unpack the data\n * and draw the unpacked raster on the display.\n */\ntypedef void (*tileContigRoutine)\n    (TIFFRGBAImage*, uint32*, uint32, uint32, uint32, uint32, int32, int32,\n\tunsigned char*);\ntypedef void (*tileSeparateRoutine)\n    (TIFFRGBAImage*, uint32*, uint32, uint32, uint32, uint32, int32, int32,\n\tunsigned char*, unsigned char*, unsigned char*, unsigned char*);\n/*\n * RGBA-reader state.\n */\nstruct _TIFFRGBAImage {\n\tTIFF* tif;                              /* image handle */\n\tint stoponerr;                          /* stop on read error */\n\tint isContig;                           /* data is packed/separate */\n\tint alpha;                              /* type of alpha data present */\n\tuint32 width;                           /* image width */\n\tuint32 height;                          /* image height */\n\tuint16 bitspersample;                   /* image bits/sample */\n\tuint16 samplesperpixel;                 /* image samples/pixel */\n\tuint16 orientation;                     /* image orientation */\n\tuint16 req_orientation;                 /* requested orientation */\n\tuint16 photometric;                     /* image photometric interp */\n\tuint16* redcmap;                        /* colormap pallete */\n\tuint16* greencmap;\n\tuint16* bluecmap;\n\t/* get image data routine */\n\tint (*get)(TIFFRGBAImage*, uint32*, uint32, uint32);\n\t/* put decoded strip/tile */\n\tunion {\n\t    void (*any)(TIFFRGBAImage*);\n\t    tileContigRoutine contig;\n\t    tileSeparateRoutine separate;\n\t} put;\n\tTIFFRGBValue* Map;                      /* sample mapping array */\n\tuint32** BWmap;                         /* black&white map */\n\tuint32** PALmap;                        /* palette image map */\n\tTIFFYCbCrToRGB* ycbcr;                  /* YCbCr conversion state */\n\tTIFFCIELabToRGB* cielab;                /* CIE L*a*b conversion state */\n\n\tint row_offset;\n\tint col_offset;\n};\n\n/*\n * Macros for extracting components from the\n * packed ABGR form returned by TIFFReadRGBAImage.\n */\n#define\tTIFFGetR(abgr)\t((abgr) & 0xff)\n#define\tTIFFGetG(abgr)\t(((abgr) >> 8) & 0xff)\n#define\tTIFFGetB(abgr)\t(((abgr) >> 16) & 0xff)\n#define\tTIFFGetA(abgr)\t(((abgr) >> 24) & 0xff)\n\n/*\n * A CODEC is a software package that implements decoding,\n * encoding, or decoding+encoding of a compression algorithm.\n * The library provides a collection of builtin codecs.\n * More codecs may be registered through calls to the library\n * and/or the builtin implementations may be overridden.\n */\ntypedef\tint (*TIFFInitMethod)(TIFF*, int);\ntypedef struct {\n\tchar*\t\tname;\n\tuint16\t\tscheme;\n\tTIFFInitMethod\tinit;\n} TIFFCodec;\n\n#include <stdio.h>\n#include <stdarg.h>\n\n/* share internal LogLuv conversion routines? */\n#ifndef LOGLUV_PUBLIC\n#define LOGLUV_PUBLIC\t\t1\n#endif\n\n#if !defined(__GNUC__) && !defined(__attribute__)\n#  define __attribute__(x) /*nothing*/\n#endif\n\n#if defined(c_plusplus) || defined(__cplusplus)\nextern \"C\" {\n#endif\ntypedef\tvoid (*TIFFErrorHandler)(const char*, const char*, va_list);\ntypedef\tvoid (*TIFFErrorHandlerExt)(thandle_t, const char*, const char*, va_list);\ntypedef\ttsize_t (*TIFFReadWriteProc)(thandle_t, tdata_t, tsize_t);\ntypedef\ttoff_t (*TIFFSeekProc)(thandle_t, toff_t, int);\ntypedef\tint (*TIFFCloseProc)(thandle_t);\ntypedef\ttoff_t (*TIFFSizeProc)(thandle_t);\ntypedef\tint (*TIFFMapFileProc)(thandle_t, tdata_t*, toff_t*);\ntypedef\tvoid (*TIFFUnmapFileProc)(thandle_t, tdata_t, toff_t);\ntypedef\tvoid (*TIFFExtendProc)(TIFF*); \n\nextern\tconst char* TIFFGetVersion(void);\n\nextern\tconst TIFFCodec* TIFFFindCODEC(uint16);\nextern\tTIFFCodec* TIFFRegisterCODEC(uint16, const char*, TIFFInitMethod);\nextern\tvoid TIFFUnRegisterCODEC(TIFFCodec*);\nextern  int TIFFIsCODECConfigured(uint16);\nextern\tTIFFCodec* TIFFGetConfiguredCODECs(void);\n\n/*\n * Auxiliary functions.\n */\n\nextern\ttdata_t _TIFFmalloc(tsize_t);\nextern\ttdata_t _TIFFrealloc(tdata_t, tsize_t);\nextern\tvoid _TIFFmemset(tdata_t, int, tsize_t);\nextern\tvoid _TIFFmemcpy(tdata_t, const tdata_t, tsize_t);\nextern\tint _TIFFmemcmp(const tdata_t, const tdata_t, tsize_t);\nextern\tvoid _TIFFfree(tdata_t);\n\n/*\n** Stuff, related to tag handling and creating custom tags.\n*/\nextern  int  TIFFGetTagListCount( TIFF * );\nextern  ttag_t TIFFGetTagListEntry( TIFF *, int tag_index );\n    \n#define\tTIFF_ANY\tTIFF_NOTYPE\t/* for field descriptor searching */\n#define\tTIFF_VARIABLE\t-1\t\t/* marker for variable length tags */\n#define\tTIFF_SPP\t-2\t\t/* marker for SamplesPerPixel tags */\n#define\tTIFF_VARIABLE2\t-3\t\t/* marker for uint32 var-length tags */\n\n#define FIELD_CUSTOM    65    \n\ntypedef\tstruct {\n\tttag_t\tfield_tag;\t\t/* field's tag */\n\tshort\tfield_readcount;\t/* read count/TIFF_VARIABLE/TIFF_SPP */\n\tshort\tfield_writecount;\t/* write count/TIFF_VARIABLE */\n\tTIFFDataType field_type;\t/* type of associated data */\n        unsigned short field_bit;\t/* bit in fieldsset bit vector */\n\tunsigned char field_oktochange;\t/* if true, can change while writing */\n\tunsigned char field_passcount;\t/* if true, pass dir count on set */\n\tchar\t*field_name;\t\t/* ASCII name */\n} TIFFFieldInfo;\n\ntypedef struct _TIFFTagValue {\n    const TIFFFieldInfo  *info;\n    int             count;\n    void           *value;\n} TIFFTagValue;\n\nextern\tvoid TIFFMergeFieldInfo(TIFF*, const TIFFFieldInfo[], int);\nextern\tconst TIFFFieldInfo* TIFFFindFieldInfo(TIFF*, ttag_t, TIFFDataType);\nextern  const TIFFFieldInfo* TIFFFindFieldInfoByName(TIFF* , const char *,\n\t\t\t\t\t\t     TIFFDataType);\nextern\tconst TIFFFieldInfo* TIFFFieldWithTag(TIFF*, ttag_t);\nextern\tconst TIFFFieldInfo* TIFFFieldWithName(TIFF*, const char *);\n\ntypedef\tint (*TIFFVSetMethod)(TIFF*, ttag_t, va_list);\ntypedef\tint (*TIFFVGetMethod)(TIFF*, ttag_t, va_list);\ntypedef\tvoid (*TIFFPrintMethod)(TIFF*, FILE*, long);\n    \ntypedef struct {\n    TIFFVSetMethod\tvsetfield;\t/* tag set routine */\n    TIFFVGetMethod\tvgetfield;\t/* tag get routine */\n    TIFFPrintMethod\tprintdir;\t/* directory print routine */\n} TIFFTagMethods;\n        \nextern  TIFFTagMethods *TIFFAccessTagMethods( TIFF * );\nextern  void *TIFFGetClientInfo( TIFF *, const char * );\nextern  void TIFFSetClientInfo( TIFF *, void *, const char * );\n\nextern\tvoid TIFFCleanup(TIFF*);\nextern\tvoid TIFFClose(TIFF*);\nextern\tint TIFFFlush(TIFF*);\nextern\tint TIFFFlushData(TIFF*);\nextern\tint TIFFGetField(TIFF*, ttag_t, ...);\nextern\tint TIFFVGetField(TIFF*, ttag_t, va_list);\nextern\tint TIFFGetFieldDefaulted(TIFF*, ttag_t, ...);\nextern\tint TIFFVGetFieldDefaulted(TIFF*, ttag_t, va_list);\nextern\tint TIFFReadDirectory(TIFF*);\nextern\tint TIFFReadCustomDirectory(TIFF*, toff_t, const TIFFFieldInfo[],\n\t\t\t\t    size_t);\nextern\tint TIFFReadEXIFDirectory(TIFF*, toff_t);\nextern\ttsize_t TIFFScanlineSize(TIFF*);\nextern\ttsize_t TIFFOldScanlineSize(TIFF*);\nextern\ttsize_t TIFFNewScanlineSize(TIFF*);\nextern\ttsize_t TIFFRasterScanlineSize(TIFF*);\nextern\ttsize_t TIFFStripSize(TIFF*);\nextern\ttsize_t TIFFRawStripSize(TIFF*, tstrip_t);\nextern\ttsize_t TIFFVStripSize(TIFF*, uint32);\nextern\ttsize_t TIFFTileRowSize(TIFF*);\nextern\ttsize_t TIFFTileSize(TIFF*);\nextern\ttsize_t TIFFVTileSize(TIFF*, uint32);\nextern\tuint32 TIFFDefaultStripSize(TIFF*, uint32);\nextern\tvoid TIFFDefaultTileSize(TIFF*, uint32*, uint32*);\nextern\tint TIFFFileno(TIFF*);\nextern  int TIFFSetFileno(TIFF*, int);\nextern  thandle_t TIFFClientdata(TIFF*);\nextern  thandle_t TIFFSetClientdata(TIFF*, thandle_t);\nextern\tint TIFFGetMode(TIFF*);\nextern\tint TIFFSetMode(TIFF*, int);\nextern\tint TIFFIsTiled(TIFF*);\nextern\tint TIFFIsByteSwapped(TIFF*);\nextern\tint TIFFIsUpSampled(TIFF*);\nextern\tint TIFFIsMSB2LSB(TIFF*);\nextern\tint TIFFIsBigEndian(TIFF*);\nextern\tTIFFReadWriteProc TIFFGetReadProc(TIFF*);\nextern\tTIFFReadWriteProc TIFFGetWriteProc(TIFF*);\nextern\tTIFFSeekProc TIFFGetSeekProc(TIFF*);\nextern\tTIFFCloseProc TIFFGetCloseProc(TIFF*);\nextern\tTIFFSizeProc TIFFGetSizeProc(TIFF*);\nextern\tTIFFMapFileProc TIFFGetMapFileProc(TIFF*);\nextern\tTIFFUnmapFileProc TIFFGetUnmapFileProc(TIFF*);\nextern\tuint32 TIFFCurrentRow(TIFF*);\nextern\ttdir_t TIFFCurrentDirectory(TIFF*);\nextern\ttdir_t TIFFNumberOfDirectories(TIFF*);\nextern\tuint32 TIFFCurrentDirOffset(TIFF*);\nextern\ttstrip_t TIFFCurrentStrip(TIFF*);\nextern\tttile_t TIFFCurrentTile(TIFF*);\nextern\tint TIFFReadBufferSetup(TIFF*, tdata_t, tsize_t);\nextern\tint TIFFWriteBufferSetup(TIFF*, tdata_t, tsize_t);\nextern\tint TIFFSetupStrips(TIFF *);\nextern  int TIFFWriteCheck(TIFF*, int, const char *);\nextern\tvoid TIFFFreeDirectory(TIFF*);\nextern  int TIFFCreateDirectory(TIFF*);\nextern\tint TIFFLastDirectory(TIFF*);\nextern\tint TIFFSetDirectory(TIFF*, tdir_t);\nextern\tint TIFFSetSubDirectory(TIFF*, uint32);\nextern\tint TIFFUnlinkDirectory(TIFF*, tdir_t);\nextern\tint TIFFSetField(TIFF*, ttag_t, ...);\nextern\tint TIFFVSetField(TIFF*, ttag_t, va_list);\nextern\tint TIFFWriteDirectory(TIFF *);\nextern\tint TIFFCheckpointDirectory(TIFF *);\nextern\tint TIFFRewriteDirectory(TIFF *);\nextern\tint TIFFReassignTagToIgnore(enum TIFFIgnoreSense, int);\n\n#if defined(c_plusplus) || defined(__cplusplus)\nextern\tvoid TIFFPrintDirectory(TIFF*, FILE*, long = 0);\nextern\tint TIFFReadScanline(TIFF*, tdata_t, uint32, tsample_t = 0);\nextern\tint TIFFWriteScanline(TIFF*, tdata_t, uint32, tsample_t = 0);\nextern\tint TIFFReadRGBAImage(TIFF*, uint32, uint32, uint32*, int = 0);\nextern\tint TIFFReadRGBAImageOriented(TIFF*, uint32, uint32, uint32*,\n\t\t\t\t      int = ORIENTATION_BOTLEFT, int = 0);\n#else\nextern\tvoid TIFFPrintDirectory(TIFF*, FILE*, long);\nextern\tint TIFFReadScanline(TIFF*, tdata_t, uint32, tsample_t);\nextern\tint TIFFWriteScanline(TIFF*, tdata_t, uint32, tsample_t);\nextern\tint TIFFReadRGBAImage(TIFF*, uint32, uint32, uint32*, int);\nextern\tint TIFFReadRGBAImageOriented(TIFF*, uint32, uint32, uint32*, int, int);\n#endif\n\nextern\tint TIFFReadRGBAStrip(TIFF*, tstrip_t, uint32 * );\nextern\tint TIFFReadRGBATile(TIFF*, uint32, uint32, uint32 * );\nextern\tint TIFFRGBAImageOK(TIFF*, char [1024]);\nextern\tint TIFFRGBAImageBegin(TIFFRGBAImage*, TIFF*, int, char [1024]);\nextern\tint TIFFRGBAImageGet(TIFFRGBAImage*, uint32*, uint32, uint32);\nextern\tvoid TIFFRGBAImageEnd(TIFFRGBAImage*);\nextern\tTIFF* TIFFOpen(const char*, const char*);\n# ifdef __WIN32__\nextern\tTIFF* TIFFOpenW(const wchar_t*, const char*);\n# endif /* __WIN32__ */\nextern\tTIFF* TIFFFdOpen(int, const char*, const char*);\nextern\tTIFF* TIFFClientOpen(const char*, const char*,\n\t    thandle_t,\n\t    TIFFReadWriteProc, TIFFReadWriteProc,\n\t    TIFFSeekProc, TIFFCloseProc,\n\t    TIFFSizeProc,\n\t    TIFFMapFileProc, TIFFUnmapFileProc);\nextern\tconst char* TIFFFileName(TIFF*);\nextern\tconst char* TIFFSetFileName(TIFF*, const char *);\nextern void TIFFError(const char*, const char*, ...) __attribute__((format (printf,2,3)));\nextern void TIFFErrorExt(thandle_t, const char*, const char*, ...) __attribute__((format (printf,3,4)));\nextern void TIFFWarning(const char*, const char*, ...) __attribute__((format (printf,2,3)));\nextern void TIFFWarningExt(thandle_t, const char*, const char*, ...) __attribute__((format (printf,3,4)));\nextern\tTIFFErrorHandler TIFFSetErrorHandler(TIFFErrorHandler);\nextern\tTIFFErrorHandlerExt TIFFSetErrorHandlerExt(TIFFErrorHandlerExt);\nextern\tTIFFErrorHandler TIFFSetWarningHandler(TIFFErrorHandler);\nextern\tTIFFErrorHandlerExt TIFFSetWarningHandlerExt(TIFFErrorHandlerExt);\nextern\tTIFFExtendProc TIFFSetTagExtender(TIFFExtendProc);\nextern\tttile_t TIFFComputeTile(TIFF*, uint32, uint32, uint32, tsample_t);\nextern\tint TIFFCheckTile(TIFF*, uint32, uint32, uint32, tsample_t);\nextern\tttile_t TIFFNumberOfTiles(TIFF*);\nextern\ttsize_t TIFFReadTile(TIFF*,\n\t    tdata_t, uint32, uint32, uint32, tsample_t);\nextern\ttsize_t TIFFWriteTile(TIFF*,\n\t    tdata_t, uint32, uint32, uint32, tsample_t);\nextern\ttstrip_t TIFFComputeStrip(TIFF*, uint32, tsample_t);\nextern\ttstrip_t TIFFNumberOfStrips(TIFF*);\nextern\ttsize_t TIFFReadEncodedStrip(TIFF*, tstrip_t, tdata_t, tsize_t);\nextern\ttsize_t TIFFReadRawStrip(TIFF*, tstrip_t, tdata_t, tsize_t);\nextern\ttsize_t TIFFReadEncodedTile(TIFF*, ttile_t, tdata_t, tsize_t);\nextern\ttsize_t TIFFReadRawTile(TIFF*, ttile_t, tdata_t, tsize_t);\nextern\ttsize_t TIFFWriteEncodedStrip(TIFF*, tstrip_t, tdata_t, tsize_t);\nextern\ttsize_t TIFFWriteRawStrip(TIFF*, tstrip_t, tdata_t, tsize_t);\nextern\ttsize_t TIFFWriteEncodedTile(TIFF*, ttile_t, tdata_t, tsize_t);\nextern\ttsize_t TIFFWriteRawTile(TIFF*, ttile_t, tdata_t, tsize_t);\nextern\tint TIFFDataWidth(TIFFDataType);    /* table of tag datatype widths */\nextern\tvoid TIFFSetWriteOffset(TIFF*, toff_t);\nextern\tvoid TIFFSwabShort(uint16*);\nextern\tvoid TIFFSwabLong(uint32*);\nextern\tvoid TIFFSwabDouble(double*);\nextern\tvoid TIFFSwabArrayOfShort(uint16*, unsigned long);\nextern\tvoid TIFFSwabArrayOfTriples(uint8*, unsigned long);\nextern\tvoid TIFFSwabArrayOfLong(uint32*, unsigned long);\nextern\tvoid TIFFSwabArrayOfDouble(double*, unsigned long);\nextern\tvoid TIFFReverseBits(unsigned char *, unsigned long);\nextern\tconst unsigned char* TIFFGetBitRevTable(int);\n\n#ifdef LOGLUV_PUBLIC\n#define U_NEU\t\t0.210526316\n#define V_NEU\t\t0.473684211\n#define UVSCALE\t\t410.\nextern\tdouble LogL16toY(int);\nextern\tdouble LogL10toY(int);\nextern\tvoid XYZtoRGB24(float*, uint8*);\nextern\tint uv_decode(double*, double*, int);\nextern\tvoid LogLuv24toXYZ(uint32, float*);\nextern\tvoid LogLuv32toXYZ(uint32, float*);\n#if defined(c_plusplus) || defined(__cplusplus)\nextern\tint LogL16fromY(double, int = SGILOGENCODE_NODITHER);\nextern\tint LogL10fromY(double, int = SGILOGENCODE_NODITHER);\nextern\tint uv_encode(double, double, int = SGILOGENCODE_NODITHER);\nextern\tuint32 LogLuv24fromXYZ(float*, int = SGILOGENCODE_NODITHER);\nextern\tuint32 LogLuv32fromXYZ(float*, int = SGILOGENCODE_NODITHER);\n#else\nextern\tint LogL16fromY(double, int);\nextern\tint LogL10fromY(double, int);\nextern\tint uv_encode(double, double, int);\nextern\tuint32 LogLuv24fromXYZ(float*, int);\nextern\tuint32 LogLuv32fromXYZ(float*, int);\n#endif\n#endif /* LOGLUV_PUBLIC */\n    \nextern int TIFFCIELabToRGBInit(TIFFCIELabToRGB*, TIFFDisplay *, float*);\nextern void TIFFCIELabToXYZ(TIFFCIELabToRGB *, uint32, int32, int32,\n\t\t\t    float *, float *, float *);\nextern void TIFFXYZToRGB(TIFFCIELabToRGB *, float, float, float,\n\t\t\t uint32 *, uint32 *, uint32 *);\n\nextern int TIFFYCbCrToRGBInit(TIFFYCbCrToRGB*, float*, float*);\nextern void TIFFYCbCrtoRGB(TIFFYCbCrToRGB *, uint32, int32, int32,\n\t\t\t   uint32 *, uint32 *, uint32 *);\n\n#if defined(c_plusplus) || defined(__cplusplus)\n}\n#endif\n\n#endif /* _TIFFIO_ */\n\n/* vim: set ts=8 sts=8 sw=8 noet: */\n"
  },
  {
    "path": "src/main/jni/tiffvers.h",
    "content": "#define TIFFLIB_VERSION_STR \"LIBTIFF, Version 3.9.2\\nCopyright (c) 1988-1996 Sam Leffler\\nCopyright (c) 1991-1996 Silicon Graphics, Inc.\"\n/*\n * This define can be used in code that requires\n * compilation-related definitions specific to a\n * version or versions of the library.  Runtime\n * version checking should be done based on the\n * string returned by TIFFGetVersion.\n */\n#define TIFFLIB_VERSION 20091104\n"
  },
  {
    "path": "src/main/res/values/strings.xml",
    "content": "<resources>\n    <string name=\"app_name\">TiffBitmapFactory</string>\n</resources>\n"
  }
]