AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

1994.12.09 03:22 "Minor mods to YCBCR support", by Gordon Clare

A couple of routines used for working out the size of tiles and strips don't work for YCbCr if extra samples are present. The mods are only trivial, and apologies if it's already been fixed. I'm currently using:

VERSION         3.3beta
tiff.alpha      define ALPHA 015

The mods are to tif_strip.c and tif_tile.c:

diff -c OLD/tif_strip.c NEW/tif_strip.c
*** OLD/tif_strip.c Tue Oct 11 17:37:30 1994
--- NEW/tif_strip.c Fri Dec  9 13:59:51 1994
***************
*** 98,104 ****
                    td->td_ycbcrsubsampling[0]*td->td_ycbcrsubsampling[1];
                nrows = roundup(nrows, td->td_ycbcrsubsampling[1]);
                /* NB: don't need howmany here 'cuz everything is rounded */
!               return (nrows*scanline + 2*(nrows*scanline / samplingarea));
        } else
  #endif
                return (nrows * TIFFScanlineSize(tif));
--- 98,104 ----
                    td->td_ycbcrsubsampling[0]*td->td_ycbcrsubsampling[1];
                nrows = roundup(nrows, td->td_ycbcrsubsampling[1]);
                /* NB: don't need howmany here 'cuz everything is rounded */
!               return (nrows*scanline*(td->td_samplesperpixel-2) + 2*(nrows*scanline / samplingarea));
        } else
  #endif
                return (nrows * TIFFScanlineSize(tif));

diff -c OLD/tif_tile.c NEW/tif_tile.c
*** OLD/tif_tile.c Mon Dec  5 10:46:22 1994
--- NEW/tif_tile.c Fri Dec  9 13:59:53 1994
***************
*** 175,181 ****
                    td->td_ycbcrsubsampling[0]*td->td_ycbcrsubsampling[1];
                nrows = roundup(nrows, td->td_ycbcrsubsampling[1]);
                /* NB: don't need howmany here 'cuz everything is rounded */
!               tilesize = nrows*rowsize + 2*(nrows*rowsize / samplingarea);
        } else
  #endif
                tilesize = nrows * TIFFTileRowSize(tif);
--- 175,182 ----
                    td->td_ycbcrsubsampling[0]*td->td_ycbcrsubsampling[1];
                nrows = roundup(nrows, td->td_ycbcrsubsampling[1]);
                /* NB: don't need howmany here 'cuz everything is rounded */
!               tilesize = nrows*rowsize*(td->td_samplesperpixel-2)
!                               + 2*(nrows*rowsize / samplingarea);
        } else
  #endif
                tilesize = nrows * TIFFTileRowSize(tif);

- gordon

---
    Never keep a dog and bark for yourself.                     -- harrison
Gordon Clare                                 Net: gordon@research.canon.oz.au
Canon Information Systems Research Australia  Ph: +61 2 805 2738
P.O. Box 313 North Ryde, NSW, Australia 2113 Fax: +61 2 805 2929