AWARE [SYSTEMS] Imaging expertise for the Delphi developer
AWare Systems, Imaging expertise for the Delphi developer, Home TIFF and LibTiff Mailing List Archive

LibTiff Mailing List

TIFF and LibTiff Mailing List Archive
November 2004

Previous Thread
Next Thread

Previous by Thread
Next by Thread

Previous by Date
Next by Date

Contact

The TIFF Mailing List Homepage
This list is run by Frank Warmerdam
Archive maintained by AWare Systems



Valid HTML 4.01!



Thread

2004.11.04 06:42 "N TIFFTAG_TRANSFERFUNCTION", by Kai-uwe Behrmann
2004.11.04 08:21 "Re: N TIFFTAG_TRANSFERFUNCTION", by Kai-uwe Behrmann
2004.11.04 08:38 "Re: N TIFFTAG_TRANSFERFUNCTION", by Ross A Finlayson
2004.11.04 09:00 "Re: N TIFFTAG_TRANSFERFUNCTION", by Kai-uwe Behrmann

2004.11.04 08:38 "Re: N TIFFTAG_TRANSFERFUNCTION", by Ross A Finlayson

Hi Kai-Uwe,

I'm uncertain of the answer for that.  I think instead you should compare
the pointers to each other because if there is only one transfer function
that each of the three pointers is set to the same value.  So tiff2pdf
compares the first to the second pointer to see if they are different.  If
they are the same, then there is only one transfer function, otherwise,
three.  I looked at the source code where that is done before I coded
that.

Here is some copied code, from tif_dirread.c:

                case TIFFTAG_TRANSFERFUNCTION:
                        /*
                         * TransferFunction can have either 1x or 3x data
                         * values; Colormap can have only 3x items.
                         */
                        v = 1L<<td->td_bitspersample;
                        if (dp->tdir_tag == TIFFTAG_COLORMAP ||
                            dp->tdir_count != (uint32) v) {
                                if (!CheckDirCount(tif, dp,
(uint32)(3*v)))
                                        break;
                        }
                        v *= sizeof (uint16);
                        cp = CheckMalloc(tif, dp->tdir_count, sizeof
(uint16),
                            "to read \"TransferFunction\" tag");
                        if (cp != NULL) {
                                if (TIFFFetchData(tif, dp, cp)) {
                                        /*
                                         * This deals with there being
only
                                         * one array to apply to all
samples.
                                         */
                                        uint32 c =
                                            (uint32)1 <<
td->td_bitspersample;
                                        if (dp->tdir_count == c)
                                                v = 0;
                                        TIFFSetField(tif, dp->tdir_tag,
                                            cp, cp+v, cp+2*v);
                                }
                                _TIFFfree(cp);
                        }
                        break;

It sets the pointers to cp, cp+v, and cp+2*v.  So, if there is only one
transfer function, then each pointer is set to cp, where v==0.  So, if cp
!= cp+v, then there are multiple transfer functions for the multiple
channels, to get the transfer function count.

The answer of one for all or three separate transfer functions is whether
r_uint16 == g_uint16 in your example.  Is that not so?

Then, I have a question, it is off-topic, but I wonder if the fax codec
supports uncompressed mode anymore.  I tinker upon a fax codec, and want
to understand libtiff's fax compression codec.  Are you familiar with any
limits of the libtiff fax codec?

Warm regards,

Ross F.