| OLD | NEW |
| 1 /* $Id: tif_getimage.c,v 1.82 2012-06-06 00:17:49 fwarmerdam Exp $ */ | 1 /* $Id: tif_getimage.c,v 1.90 2015-06-17 01:34:08 bfriesen Exp $ */ |
| 2 | 2 |
| 3 /* | 3 /* |
| 4 * Copyright (c) 1991-1997 Sam Leffler | 4 * Copyright (c) 1991-1997 Sam Leffler |
| 5 * Copyright (c) 1991-1997 Silicon Graphics, Inc. | 5 * Copyright (c) 1991-1997 Silicon Graphics, Inc. |
| 6 * | 6 * |
| 7 * Permission to use, copy, modify, distribute, and sell this software and | 7 * Permission to use, copy, modify, distribute, and sell this software and |
| 8 * its documentation for any purpose is hereby granted without fee, provided | 8 * its documentation for any purpose is hereby granted without fee, provided |
| 9 * that (i) the above copyright notices and this permission notice appear in | 9 * that (i) the above copyright notices and this permission notice appear in |
| 10 * all copies of the software and related documentation, and (ii) the names of | 10 * all copies of the software and related documentation, and (ii) the names of |
| 11 * Sam Leffler and Silicon Graphics may not be used in any advertising or | 11 * Sam Leffler and Silicon Graphics may not be used in any advertising or |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 td->td_compression != COMPRESSION_SGILOG24) { | 175 td->td_compression != COMPRESSION_SGILOG24) { |
| 176 sprintf(emsg, "Sorry, LogLuv data must have %s=%
d or %d", | 176 sprintf(emsg, "Sorry, LogLuv data must have %s=%
d or %d", |
| 177 "Compression", COMPRESSION_SGILOG, COMPRESSI
ON_SGILOG24); | 177 "Compression", COMPRESSION_SGILOG, COMPRESSI
ON_SGILOG24); |
| 178 return (0); | 178 return (0); |
| 179 } | 179 } |
| 180 if (td->td_planarconfig != PLANARCONFIG_CONTIG) { | 180 if (td->td_planarconfig != PLANARCONFIG_CONTIG) { |
| 181 sprintf(emsg, "Sorry, can not handle LogLuv imag
es with %s=%d", | 181 sprintf(emsg, "Sorry, can not handle LogLuv imag
es with %s=%d", |
| 182 "Planarconfiguration", td->td_planarconfig); | 182 "Planarconfiguration", td->td_planarconfig); |
| 183 return (0); | 183 return (0); |
| 184 } | 184 } |
| 185 if( td->td_samplesperpixel != 3 ) |
| 186 { |
| 187 sprintf(emsg, |
| 188 "Sorry, can not handle image with %s=%d", |
| 189 "Samples/pixel", td->td_samplesperpixel); |
| 190 return 0; |
| 191 } |
| 185 break; | 192 break; |
| 186 case PHOTOMETRIC_CIELAB: | 193 case PHOTOMETRIC_CIELAB: |
| 194 if( td->td_samplesperpixel != 3 || td->td_bitspersample != 8 ) |
| 195 { |
| 196 sprintf(emsg, |
| 197 "Sorry, can not handle image with %s=%d and %s=%d", |
| 198 "Samples/pixel", td->td_samplesperpixel, |
| 199 "Bits/sample", td->td_bitspersample); |
| 200 return 0; |
| 201 } |
| 187 break; | 202 break; |
| 188 default: | 203 default: |
| 189 sprintf(emsg, "Sorry, can not handle image with %s=%d", | 204 sprintf(emsg, "Sorry, can not handle image with %s=%d", |
| 190 photoTag, photometric); | 205 photoTag, photometric); |
| 191 return (0); | 206 return (0); |
| 192 } | 207 } |
| 193 return (1); | 208 return (1); |
| 194 } | 209 } |
| 195 | 210 |
| 196 void | 211 void |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 { | 605 { |
| 591 TIFF* tif = img->tif; | 606 TIFF* tif = img->tif; |
| 592 tileContigRoutine put = img->put.contig; | 607 tileContigRoutine put = img->put.contig; |
| 593 uint32 col, row, y, rowstoread; | 608 uint32 col, row, y, rowstoread; |
| 594 tmsize_t pos; | 609 tmsize_t pos; |
| 595 uint32 tw, th; | 610 uint32 tw, th; |
| 596 unsigned char* buf; | 611 unsigned char* buf; |
| 597 int32 fromskew, toskew; | 612 int32 fromskew, toskew; |
| 598 uint32 nrow; | 613 uint32 nrow; |
| 599 int ret = 1, flip; | 614 int ret = 1, flip; |
| 615 uint32 this_tw, tocol; |
| 616 int32 this_toskew, leftmost_toskew; |
| 617 int32 leftmost_fromskew; |
| 618 uint32 leftmost_tw; |
| 600 | 619 |
| 601 buf = (unsigned char*) _TIFFmalloc(TIFFTileSize(tif)); | 620 buf = (unsigned char*) _TIFFmalloc(TIFFTileSize(tif)); |
| 602 if (buf == 0) { | 621 if (buf == 0) { |
| 603 TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "%s", "No s
pace for tile buffer"); | 622 TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "%s", "No s
pace for tile buffer"); |
| 604 return (0); | 623 return (0); |
| 605 } | 624 } |
| 606 _TIFFmemset(buf, 0, TIFFTileSize(tif)); | 625 _TIFFmemset(buf, 0, TIFFTileSize(tif)); |
| 607 TIFFGetField(tif, TIFFTAG_TILEWIDTH, &tw); | 626 TIFFGetField(tif, TIFFTAG_TILEWIDTH, &tw); |
| 608 TIFFGetField(tif, TIFFTAG_TILELENGTH, &th); | 627 TIFFGetField(tif, TIFFTAG_TILELENGTH, &th); |
| 609 | 628 |
| 610 flip = setorientation(img); | 629 flip = setorientation(img); |
| 611 if (flip & FLIP_VERTICALLY) { | 630 if (flip & FLIP_VERTICALLY) { |
| 612 y = h - 1; | 631 y = h - 1; |
| 613 toskew = -(int32)(tw + w); | 632 toskew = -(int32)(tw + w); |
| 614 } | 633 } |
| 615 else { | 634 else { |
| 616 y = 0; | 635 y = 0; |
| 617 toskew = -(int32)(tw - w); | 636 toskew = -(int32)(tw - w); |
| 618 } | 637 } |
| 619 | 638 |
| 639 /* |
| 640 * Leftmost tile is clipped on left side if col_offset > 0. |
| 641 */ |
| 642 leftmost_fromskew = img->col_offset % tw; |
| 643 leftmost_tw = tw - leftmost_fromskew; |
| 644 leftmost_toskew = toskew + leftmost_fromskew; |
| 620 for (row = 0; row < h; row += nrow) | 645 for (row = 0; row < h; row += nrow) |
| 621 { | 646 { |
| 622 rowstoread = th - (row + img->row_offset) % th; | 647 rowstoread = th - (row + img->row_offset) % th; |
| 623 nrow = (row + rowstoread > h ? h - row : rowstoread); | 648 nrow = (row + rowstoread > h ? h - row : rowstoread); |
| 624 » for (col = 0; col < w; col += tw) | 649 » fromskew = leftmost_fromskew; |
| 650 » this_tw = leftmost_tw; |
| 651 » this_toskew = leftmost_toskew; |
| 652 » tocol = 0; |
| 653 » col = img->col_offset; |
| 654 » while (tocol < w) |
| 625 { | 655 { |
| 626 » if (TIFFReadTile(tif, buf, col+img->col_offset, | 656 » if (TIFFReadTile(tif, buf, col, |
| 627 row+img->row_offset, 0, 0)==(tmsize_t)(-1) && img->
stoponerr) | 657 row+img->row_offset, 0, 0)==(tmsize_t)(-1) && img->
stoponerr) |
| 628 { | 658 { |
| 629 ret = 0; | 659 ret = 0; |
| 630 break; | 660 break; |
| 631 } | 661 } |
| 632 » | 662 pos = ((row+img->row_offset) % th) * TIFFTileRowSize(tif) + \ |
| 633 » pos = ((row+img->row_offset) % th) * TIFFTileRowSize(tif); | 663 » » ((tmsize_t) fromskew * img->samplesperpixel); |
| 634 | 664 » if (tocol + this_tw > w) |
| 635 » if (col + tw > w) | 665 » { |
| 636 { | 666 » » /* |
| 637 /* | 667 » » * Rightmost tile is clipped on right side. |
| 638 * Tile is clipped horizontally. Calculate | 668 » » */ |
| 639 * visible portion and skewing factors. | 669 » » fromskew = tw - (w - tocol); |
| 640 */ | 670 » » this_tw = tw - fromskew; |
| 641 uint32 npix = w - col; | 671 » » this_toskew = toskew + fromskew; |
| 642 fromskew = tw - npix; | 672 » } |
| 643 (*put)(img, raster+y*w+col, col, y, | 673 » (*put)(img, raster+y*w+tocol, tocol, y, this_tw, nrow, fromskew, thi
s_toskew, buf + pos); |
| 644 npix, nrow, fromskew, toskew + fromskew, buf + pos); | 674 » tocol += this_tw; |
| 645 } | 675 » col += this_tw; |
| 646 else | 676 » /* |
| 647 { | 677 » * After the leftmost tile, tiles are no longer clipped on left side
. |
| 648 (*put)(img, raster+y*w+col, col, y, tw, nrow, 0, toskew, buf + p
os); | 678 » */ |
| 649 } | 679 » fromskew = 0; |
| 650 } | 680 » this_tw = tw; |
| 681 » this_toskew = toskew; |
| 682 » } |
| 651 | 683 |
| 652 y += (flip & FLIP_VERTICALLY ? -(int32) nrow : (int32) nrow); | 684 y += (flip & FLIP_VERTICALLY ? -(int32) nrow : (int32) nrow); |
| 653 } | 685 } |
| 654 _TIFFfree(buf); | 686 _TIFFfree(buf); |
| 655 | 687 |
| 656 if (flip & FLIP_HORIZONTALLY) { | 688 if (flip & FLIP_HORIZONTALLY) { |
| 657 uint32 line; | 689 uint32 line; |
| 658 | 690 |
| 659 for (line = 0; line < h; line++) { | 691 for (line = 0; line < h; line++) { |
| 660 uint32 *left = raster + (line * w); | 692 uint32 *left = raster + (line * w); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 691 unsigned char* p1; | 723 unsigned char* p1; |
| 692 unsigned char* p2; | 724 unsigned char* p2; |
| 693 unsigned char* pa; | 725 unsigned char* pa; |
| 694 tmsize_t tilesize; | 726 tmsize_t tilesize; |
| 695 tmsize_t bufsize; | 727 tmsize_t bufsize; |
| 696 int32 fromskew, toskew; | 728 int32 fromskew, toskew; |
| 697 int alpha = img->alpha; | 729 int alpha = img->alpha; |
| 698 uint32 nrow; | 730 uint32 nrow; |
| 699 int ret = 1, flip; | 731 int ret = 1, flip; |
| 700 int colorchannels; | 732 int colorchannels; |
| 733 uint32 this_tw, tocol; |
| 734 int32 this_toskew, leftmost_toskew; |
| 735 int32 leftmost_fromskew; |
| 736 uint32 leftmost_tw; |
| 701 | 737 |
| 702 tilesize = TIFFTileSize(tif); | 738 tilesize = TIFFTileSize(tif); |
| 703 bufsize = TIFFSafeMultiply(tmsize_t,alpha?4:3,tilesize); | 739 bufsize = TIFFSafeMultiply(tmsize_t,alpha?4:3,tilesize); |
| 704 if (bufsize == 0) { | 740 if (bufsize == 0) { |
| 705 TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "Integer ov
erflow in %s", "gtTileSeparate"); | 741 TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "Integer ov
erflow in %s", "gtTileSeparate"); |
| 706 return (0); | 742 return (0); |
| 707 } | 743 } |
| 708 buf = (unsigned char*) _TIFFmalloc(bufsize); | 744 buf = (unsigned char*) _TIFFmalloc(bufsize); |
| 709 if (buf == 0) { | 745 if (buf == 0) { |
| 710 TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "%s", "No s
pace for tile buffer"); | 746 TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "%s", "No s
pace for tile buffer"); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 735 case PHOTOMETRIC_PALETTE: | 771 case PHOTOMETRIC_PALETTE: |
| 736 colorchannels = 1; | 772 colorchannels = 1; |
| 737 p2 = p1 = p0; | 773 p2 = p1 = p0; |
| 738 break; | 774 break; |
| 739 | 775 |
| 740 default: | 776 default: |
| 741 colorchannels = 3; | 777 colorchannels = 3; |
| 742 break; | 778 break; |
| 743 } | 779 } |
| 744 | 780 |
| 781 /* |
| 782 * Leftmost tile is clipped on left side if col_offset > 0. |
| 783 */ |
| 784 leftmost_fromskew = img->col_offset % tw; |
| 785 leftmost_tw = tw - leftmost_fromskew; |
| 786 leftmost_toskew = toskew + leftmost_fromskew; |
| 745 for (row = 0; row < h; row += nrow) | 787 for (row = 0; row < h; row += nrow) |
| 746 { | 788 { |
| 747 rowstoread = th - (row + img->row_offset) % th; | 789 rowstoread = th - (row + img->row_offset) % th; |
| 748 nrow = (row + rowstoread > h ? h - row : rowstoread); | 790 nrow = (row + rowstoread > h ? h - row : rowstoread); |
| 749 » » for (col = 0; col < w; col += tw) | 791 » » fromskew = leftmost_fromskew; |
| 792 » » this_tw = leftmost_tw; |
| 793 » » this_toskew = leftmost_toskew; |
| 794 » » tocol = 0; |
| 795 » » col = img->col_offset; |
| 796 » » while (tocol < w) |
| 750 { | 797 { |
| 751 » » » if (TIFFReadTile(tif, p0, col+img->col_offset, | 798 » » » if (TIFFReadTile(tif, p0, col, |
| 752 row+img->row_offset,0,0)==(tmsize_t)(-1) && img->sto
ponerr) | 799 row+img->row_offset,0,0)==(tmsize_t)(-1) && img->sto
ponerr) |
| 753 { | 800 { |
| 754 ret = 0; | 801 ret = 0; |
| 755 break; | 802 break; |
| 756 } | 803 } |
| 757 if (colorchannels > 1 | 804 if (colorchannels > 1 |
| 758 && TIFFReadTile(tif, p1, col+img->col_offset, | 805 && TIFFReadTile(tif, p1, col, |
| 759 row+img->row_offset,0,1) == (tmsize_
t)(-1) | 806 row+img->row_offset,0,1) == (tmsize_
t)(-1) |
| 760 && img->stoponerr) | 807 && img->stoponerr) |
| 761 { | 808 { |
| 762 ret = 0; | 809 ret = 0; |
| 763 break; | 810 break; |
| 764 } | 811 } |
| 765 if (colorchannels > 1 | 812 if (colorchannels > 1 |
| 766 && TIFFReadTile(tif, p2, col+img->col_offset, | 813 && TIFFReadTile(tif, p2, col, |
| 767 row+img->row_offset,0,2) == (tmsize_
t)(-1) | 814 row+img->row_offset,0,2) == (tmsize_
t)(-1) |
| 768 && img->stoponerr) | 815 && img->stoponerr) |
| 769 { | 816 { |
| 770 ret = 0; | 817 ret = 0; |
| 771 break; | 818 break; |
| 772 } | 819 } |
| 773 if (alpha | 820 if (alpha |
| 774 && TIFFReadTile(tif,pa,col+img->col_offset, | 821 && TIFFReadTile(tif,pa,col, |
| 775 row+img->row_offset,0,colorchannels)
== (tmsize_t)(-1) | 822 row+img->row_offset,0,colorchannels)
== (tmsize_t)(-1) |
| 776 && img->stoponerr) | 823 && img->stoponerr) |
| 777 { | 824 { |
| 778 ret = 0; | 825 ret = 0; |
| 779 break; | 826 break; |
| 780 } | 827 } |
| 781 | 828 |
| 782 » » » pos = ((row+img->row_offset) % th) * TIFFTileRowSize(tif
); | 829 » » » pos = ((row+img->row_offset) % th) * TIFFTileRowSize(tif
) + \ |
| 783 | 830 » » » ((tmsize_t) fromskew * img->samplesperpixel); |
| 784 » » » if (col + tw > w) | 831 » » » if (tocol + this_tw > w) |
| 785 { | 832 { |
| 786 /* | 833 /* |
| 787 » » » » * Tile is clipped horizontally. Calculate | 834 » » » » * Rightmost tile is clipped on right side. |
| 788 » » » » * visible portion and skewing factors. | |
| 789 */ | 835 */ |
| 790 » » » » uint32 npix = w - col; | 836 » » » » fromskew = tw - (w - tocol); |
| 791 » » » » fromskew = tw - npix; | 837 » » » » this_tw = tw - fromskew; |
| 792 » » » » (*put)(img, raster+y*w+col, col, y, | 838 » » » » this_toskew = toskew + fromskew; |
| 793 » » » » npix, nrow, fromskew, toskew + fromskew, | |
| 794 » » » » p0 + pos, p1 + pos, p2 + pos, (alpha?(pa+pos
):NULL)); | |
| 795 » » » } else { | |
| 796 » » » » (*put)(img, raster+y*w+col, col, y, | |
| 797 » » » » tw, nrow, 0, toskew, p0 + pos, p1 + pos, p2
+ pos, (alpha?(pa+pos):NULL)); | |
| 798 } | 839 } |
| 840 (*put)(img, raster+y*w+tocol, tocol, y, this_tw, nrow, f
romskew, this_toskew, \ |
| 841 p0 + pos, p1 + pos, p2 + pos, (alpha?(pa+pos):NU
LL)); |
| 842 tocol += this_tw; |
| 843 col += this_tw; |
| 844 /* |
| 845 * After the leftmost tile, tiles are no longer clipped o
n left side. |
| 846 */ |
| 847 fromskew = 0; |
| 848 this_tw = tw; |
| 849 this_toskew = toskew; |
| 799 } | 850 } |
| 800 | 851 |
| 801 y += (flip & FLIP_VERTICALLY ?-(int32) nrow : (int32) nrow); | 852 y += (flip & FLIP_VERTICALLY ?-(int32) nrow : (int32) nrow); |
| 802 } | 853 } |
| 803 | 854 |
| 804 if (flip & FLIP_HORIZONTALLY) { | 855 if (flip & FLIP_HORIZONTALLY) { |
| 805 uint32 line; | 856 uint32 line; |
| 806 | 857 |
| 807 for (line = 0; line < h; line++) { | 858 for (line = 0; line < h; line++) { |
| 808 uint32 *left = raster + (line * w); | 859 uint32 *left = raster + (line * w); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 835 uint32 row, y, nrow, nrowsub, rowstoread; | 886 uint32 row, y, nrow, nrowsub, rowstoread; |
| 836 tmsize_t pos; | 887 tmsize_t pos; |
| 837 unsigned char* buf; | 888 unsigned char* buf; |
| 838 uint32 rowsperstrip; | 889 uint32 rowsperstrip; |
| 839 uint16 subsamplinghor,subsamplingver; | 890 uint16 subsamplinghor,subsamplingver; |
| 840 uint32 imagewidth = img->width; | 891 uint32 imagewidth = img->width; |
| 841 tmsize_t scanline; | 892 tmsize_t scanline; |
| 842 int32 fromskew, toskew; | 893 int32 fromskew, toskew; |
| 843 int ret = 1, flip; | 894 int ret = 1, flip; |
| 844 | 895 |
| 896 TIFFGetFieldDefaulted(tif, TIFFTAG_YCBCRSUBSAMPLING, &subsamplinghor, &s
ubsamplingver); |
| 897 if( subsamplingver == 0 ) { |
| 898 TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "Invalid ve
rtical YCbCr subsampling"); |
| 899 return (0); |
| 900 } |
| 901 |
| 845 buf = (unsigned char*) _TIFFmalloc(TIFFStripSize(tif)); | 902 buf = (unsigned char*) _TIFFmalloc(TIFFStripSize(tif)); |
| 846 if (buf == 0) { | 903 if (buf == 0) { |
| 847 TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "No space f
or strip buffer"); | 904 TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "No space f
or strip buffer"); |
| 848 return (0); | 905 return (0); |
| 849 } | 906 } |
| 850 _TIFFmemset(buf, 0, TIFFStripSize(tif)); | 907 _TIFFmemset(buf, 0, TIFFStripSize(tif)); |
| 851 | 908 |
| 852 flip = setorientation(img); | 909 flip = setorientation(img); |
| 853 if (flip & FLIP_VERTICALLY) { | 910 if (flip & FLIP_VERTICALLY) { |
| 854 y = h - 1; | 911 y = h - 1; |
| 855 toskew = -(int32)(w + w); | 912 toskew = -(int32)(w + w); |
| 856 } else { | 913 } else { |
| 857 y = 0; | 914 y = 0; |
| 858 toskew = -(int32)(w - w); | 915 toskew = -(int32)(w - w); |
| 859 } | 916 } |
| 860 | 917 |
| 861 TIFFGetFieldDefaulted(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip); | 918 TIFFGetFieldDefaulted(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip); |
| 862 » TIFFGetFieldDefaulted(tif, TIFFTAG_YCBCRSUBSAMPLING, &subsamplinghor, &s
ubsamplingver); | 919 |
| 863 scanline = TIFFScanlineSize(tif); | 920 scanline = TIFFScanlineSize(tif); |
| 864 fromskew = (w < imagewidth ? imagewidth - w : 0); | 921 fromskew = (w < imagewidth ? imagewidth - w : 0); |
| 865 for (row = 0; row < h; row += nrow) | 922 for (row = 0; row < h; row += nrow) |
| 866 { | 923 { |
| 867 rowstoread = rowsperstrip - (row + img->row_offset) % rowsperstr
ip; | 924 rowstoread = rowsperstrip - (row + img->row_offset) % rowsperstr
ip; |
| 868 nrow = (row + rowstoread > h ? h - row : rowstoread); | 925 nrow = (row + rowstoread > h ? h - row : rowstoread); |
| 869 nrowsub = nrow; | 926 nrowsub = nrow; |
| 870 if ((nrowsub%subsamplingver)!=0) | 927 if ((nrowsub%subsamplingver)!=0) |
| 871 nrowsub+=subsamplingver-nrowsub%subsamplingver; | 928 nrowsub+=subsamplingver-nrowsub%subsamplingver; |
| 872 if (TIFFReadEncodedStrip(tif, | 929 if (TIFFReadEncodedStrip(tif, |
| 873 TIFFComputeStrip(tif,row+img->row_offset, 0), | 930 TIFFComputeStrip(tif,row+img->row_offset, 0), |
| 874 buf, | 931 buf, |
| 875 ((row + img->row_offset)%rowsperstrip + nrowsub) * scanline)
==(tmsize_t)(-1) | 932 ((row + img->row_offset)%rowsperstrip + nrowsub) * scanline)
==(tmsize_t)(-1) |
| 876 && img->stoponerr) | 933 && img->stoponerr) |
| 877 { | 934 { |
| 878 ret = 0; | 935 ret = 0; |
| 879 break; | 936 break; |
| 880 } | 937 } |
| 881 | 938 |
| 882 » » pos = ((row + img->row_offset) % rowsperstrip) * scanline; | 939 » » pos = ((row + img->row_offset) % rowsperstrip) * scanline + \ |
| 940 » » » ((tmsize_t) img->col_offset * img->samplesperpixel); |
| 883 (*put)(img, raster+y*w, 0, y, w, nrow, fromskew, toskew, buf + p
os); | 941 (*put)(img, raster+y*w, 0, y, w, nrow, fromskew, toskew, buf + p
os); |
| 884 y += (flip & FLIP_VERTICALLY ? -(int32) nrow : (int32) nrow); | 942 y += (flip & FLIP_VERTICALLY ? -(int32) nrow : (int32) nrow); |
| 885 } | 943 } |
| 886 | 944 |
| 887 if (flip & FLIP_HORIZONTALLY) { | 945 if (flip & FLIP_HORIZONTALLY) { |
| 888 uint32 line; | 946 uint32 line; |
| 889 | 947 |
| 890 for (line = 0; line < h; line++) { | 948 for (line = 0; line < h; line++) { |
| 891 uint32 *left = raster + (line * w); | 949 uint32 *left = raster + (line * w); |
| 892 uint32 *right = left + w - 1; | 950 uint32 *right = left + w - 1; |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1003 { | 1061 { |
| 1004 if (TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, offs
et_row, colorchannels), | 1062 if (TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, offs
et_row, colorchannels), |
| 1005 pa, ((row + img->row_offset)%rowsperstrip + nrow) *
scanline)==(tmsize_t)(-1) | 1063 pa, ((row + img->row_offset)%rowsperstrip + nrow) *
scanline)==(tmsize_t)(-1) |
| 1006 && img->stoponerr) | 1064 && img->stoponerr) |
| 1007 { | 1065 { |
| 1008 ret = 0; | 1066 ret = 0; |
| 1009 break; | 1067 break; |
| 1010 } | 1068 } |
| 1011 } | 1069 } |
| 1012 | 1070 |
| 1013 » » pos = ((row + img->row_offset) % rowsperstrip) * scanline; | 1071 » » pos = ((row + img->row_offset) % rowsperstrip) * scanline + \ |
| 1072 » » » ((tmsize_t) img->col_offset * img->samplesperpixel); |
| 1014 (*put)(img, raster+y*w, 0, y, w, nrow, fromskew, toskew, p0 + po
s, p1 + pos, | 1073 (*put)(img, raster+y*w, 0, y, w, nrow, fromskew, toskew, p0 + po
s, p1 + pos, |
| 1015 p2 + pos, (alpha?(pa+pos):NULL)); | 1074 p2 + pos, (alpha?(pa+pos):NULL)); |
| 1016 y += (flip & FLIP_VERTICALLY ? -(int32) nrow : (int32) nrow); | 1075 y += (flip & FLIP_VERTICALLY ? -(int32) nrow : (int32) nrow); |
| 1017 } | 1076 } |
| 1018 | 1077 |
| 1019 if (flip & FLIP_HORIZONTALLY) { | 1078 if (flip & FLIP_HORIZONTALLY) { |
| 1020 uint32 line; | 1079 uint32 line; |
| 1021 | 1080 |
| 1022 for (line = 0; line < h; line++) { | 1081 for (line = 0; line < h; line++) { |
| 1023 uint32 *left = raster + (line * w); | 1082 uint32 *left = raster + (line * w); |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1436 cp += toskew; | 1495 cp += toskew; |
| 1437 wp += fromskew; | 1496 wp += fromskew; |
| 1438 } | 1497 } |
| 1439 } | 1498 } |
| 1440 | 1499 |
| 1441 /* | 1500 /* |
| 1442 * 8-bit packed CMYK samples w/o Map => RGB | 1501 * 8-bit packed CMYK samples w/o Map => RGB |
| 1443 * | 1502 * |
| 1444 * NB: The conversion of CMYK->RGB is *very* crude. | 1503 * NB: The conversion of CMYK->RGB is *very* crude. |
| 1445 */ | 1504 */ |
| 1446 /*DECLAREContigPutFunc(putRGBcontig8bitCMYKtile) | 1505 DECLAREContigPutFunc(putRGBcontig8bitCMYKtile) |
| 1447 { | 1506 { |
| 1448 int samplesperpixel = img->samplesperpixel; | 1507 int samplesperpixel = img->samplesperpixel; |
| 1449 uint16 r, g, b, k; | 1508 uint16 r, g, b, k; |
| 1450 » | 1509 |
| 1451 (void) x; (void) y; | 1510 (void) x; (void) y; |
| 1452 fromskew *= samplesperpixel; | 1511 fromskew *= samplesperpixel; |
| 1453 while (h-- > 0) { | 1512 while (h-- > 0) { |
| 1454 » » UNROLL8(w, NOP, | 1513 » UNROLL8(w, NOP, |
| 1455 » » k = 255 - pp[3]; | 1514 » k = 255 - pp[3]; |
| 1456 » » r = (k*(255-pp[0]))/255; | 1515 » r = (k*(255-pp[0]))/255; |
| 1457 » » g = (k*(255-pp[1]))/255; | 1516 » g = (k*(255-pp[1]))/255; |
| 1458 » » b = (k*(255-pp[2]))/255; | 1517 » b = (k*(255-pp[2]))/255; |
| 1459 » » *cp++ = PACK(r, g, b); | 1518 » *cp++ = PACK(r, g, b); |
| 1460 » » pp += samplesperpixel); | 1519 » pp += samplesperpixel); |
| 1461 » » cp += toskew; | 1520 » cp += toskew; |
| 1462 » » pp += fromskew; | 1521 » pp += fromskew; |
| 1463 }*/ | 1522 } |
| 1464 /* Modify in 20090723 by Sunliang.Liu */ | |
| 1465 DECLAREContigPutFunc(putRGBcontig8bitCMYKtile) | |
| 1466 { | |
| 1467 » int samplesperpixel = img->samplesperpixel; | |
| 1468 » uint8 r, g, b, k; | |
| 1469 | |
| 1470 » (void) x; (void) y; | |
| 1471 » fromskew *= samplesperpixel; | |
| 1472 » while (h-- > 0) { | |
| 1473 » » UNROLL8(w, NOP, | |
| 1474 » » » if(!TIFFCmyk2Rgb(img->tif->tif_clientdata,pp[0],pp[1],pp
[2],pp[3], | |
| 1475 » » » » &r,&g,&b)){ | |
| 1476 » » » » » k = 255 - pp[3]; | |
| 1477 » » » » » r = (k*(255-pp[0]))/255; | |
| 1478 » » » » » g = (k*(255-pp[1]))/255; | |
| 1479 » » » » » b = (k*(255-pp[2]))/255; | |
| 1480 » » » } | |
| 1481 | |
| 1482 » » » *cp++ = PACK(r, g, b); | |
| 1483 » » » pp += samplesperpixel); | |
| 1484 » » » cp += toskew; | |
| 1485 » » » pp += fromskew; | |
| 1486 » } | |
| 1487 } | 1523 } |
| 1488 | 1524 |
| 1489 /* | 1525 /* |
| 1490 * 16-bit packed CMYK samples w/o Map => RGB(8-bit) | |
| 1491 * | |
| 1492 * NB: The conversion of CMYK->RGB is *very* crude. | |
| 1493 */ | |
| 1494 DECLAREContigPutFunc(putRGBcontig16bitCMYKtile) | |
| 1495 { | |
| 1496 int samplesperpixel = img->samplesperpixel; | |
| 1497 uint16* wp = (uint16*)pp; | |
| 1498 uint8 C, M, Y, K; | |
| 1499 uint8 r, g, b; | |
| 1500 | |
| 1501 (void) x; (void) y; | |
| 1502 fromskew *= samplesperpixel; | |
| 1503 while (h-- > 0) { | |
| 1504 UNROLL8(w, NOP, | |
| 1505 C = wp[0]>>8;M = wp[1]>>8;Y = wp[2]>>8;K = wp[3]>>8; | |
| 1506 if(!TIFFCmyk2Rgb(img->tif->tif_clientdata,C,M,Y,K, | |
| 1507 &r,&g,&b)){ | |
| 1508 K = 255 - K; | |
| 1509 r = (K*(255-C))/255; | |
| 1510 g = (K*(255-M))/255; | |
| 1511 b = (K*(255-Y))/255; | |
| 1512 } | |
| 1513 | |
| 1514 *cp++ = PACK(r, g, b); | |
| 1515 wp += samplesperpixel); | |
| 1516 cp += toskew; | |
| 1517 wp += fromskew; | |
| 1518 } | |
| 1519 } | |
| 1520 | |
| 1521 /* | |
| 1522 * 8-bit packed CMYK samples w/Map => RGB | 1526 * 8-bit packed CMYK samples w/Map => RGB |
| 1523 * | 1527 * |
| 1524 * NB: The conversion of CMYK->RGB is *very* crude. | 1528 * NB: The conversion of CMYK->RGB is *very* crude. |
| 1525 */ | 1529 */ |
| 1526 /* | |
| 1527 DECLAREContigPutFunc(putRGBcontig8bitCMYKMaptile) | 1530 DECLAREContigPutFunc(putRGBcontig8bitCMYKMaptile) |
| 1528 { | 1531 { |
| 1529 int samplesperpixel = img->samplesperpixel; | 1532 int samplesperpixel = img->samplesperpixel; |
| 1530 TIFFRGBValue* Map = img->Map; | 1533 TIFFRGBValue* Map = img->Map; |
| 1531 uint16 r, g, b, k; | 1534 uint16 r, g, b, k; |
| 1532 | 1535 |
| 1533 (void) y; | 1536 (void) y; |
| 1534 fromskew *= samplesperpixel; | 1537 fromskew *= samplesperpixel; |
| 1535 while (h-- > 0) { | 1538 while (h-- > 0) { |
| 1536 for (x = w; x-- > 0;) { | 1539 for (x = w; x-- > 0;) { |
| 1537 k = 255 - pp[3]; | 1540 k = 255 - pp[3]; |
| 1538 r = (k*(255-pp[0]))/255; | 1541 r = (k*(255-pp[0]))/255; |
| 1539 g = (k*(255-pp[1]))/255; | 1542 g = (k*(255-pp[1]))/255; |
| 1540 b = (k*(255-pp[2]))/255; | 1543 b = (k*(255-pp[2]))/255; |
| 1541 *cp++ = PACK(Map[r], Map[g], Map[b]); | 1544 *cp++ = PACK(Map[r], Map[g], Map[b]); |
| 1542 pp += samplesperpixel; | 1545 pp += samplesperpixel; |
| 1543 } | 1546 } |
| 1544 pp += fromskew; | 1547 pp += fromskew; |
| 1545 cp += toskew; | 1548 cp += toskew; |
| 1546 } | 1549 } |
| 1547 }*/ | |
| 1548 /* Modify in 20090723 by Sunliang.Liu */ | |
| 1549 DECLAREContigPutFunc(putRGBcontig8bitCMYKMaptile) | |
| 1550 { | |
| 1551 int samplesperpixel = img->samplesperpixel; | |
| 1552 TIFFRGBValue* Map = img->Map; | |
| 1553 uint8 r, g, b, k; | |
| 1554 | |
| 1555 (void) y; | |
| 1556 fromskew *= samplesperpixel; | |
| 1557 while (h-- > 0) { | |
| 1558 for (x = w; x-- > 0;) { | |
| 1559 if(!TIFFCmyk2Rgb(img->tif->tif_clientdata,pp[0],pp[1],pp
[2],pp[3], | |
| 1560 &r,&g,&b)){ | |
| 1561 k = 255 - pp[3]; | |
| 1562 r = (k*(255-pp[0]))/255; | |
| 1563 g = (k*(255-pp[1]))/255; | |
| 1564 b = (k*(255-pp[2]))/255; | |
| 1565 } | |
| 1566 *cp++ = PACK(Map[r], Map[g], Map[b]); | |
| 1567 pp += samplesperpixel; | |
| 1568 } | |
| 1569 pp += fromskew; | |
| 1570 cp += toskew; | |
| 1571 } | |
| 1572 } | |
| 1573 | |
| 1574 /* | |
| 1575 * 16-bit packed CMYK samples w/Map => RGB(8-bit) | |
| 1576 * | |
| 1577 * NB: The conversion of CMYK->RGB is *very* crude. | |
| 1578 */ | |
| 1579 DECLAREContigPutFunc(putRGBcontig16bitCMYKMaptile) | |
| 1580 { | |
| 1581 int samplesperpixel = img->samplesperpixel; | |
| 1582 TIFFRGBValue* Map = img->Map; | |
| 1583 uint16* wp = (uint16*)pp; | |
| 1584 uint8 C, M, Y, K; | |
| 1585 uint8 r, g, b; | |
| 1586 | |
| 1587 (void) y; | |
| 1588 fromskew *= samplesperpixel; | |
| 1589 while (h-- > 0) { | |
| 1590 for (x = w; x-- > 0;) { | |
| 1591 C = wp[0]>>8;M = wp[1]>>8;Y = wp[2]>>8;K = wp[3]>>8; | |
| 1592 if(!TIFFCmyk2Rgb(img->tif->tif_clientdata,C,M,Y,K, | |
| 1593 &r,&g,&b)){ | |
| 1594 K = 255 - K; | |
| 1595 r = (K*(255-C))/255; | |
| 1596 g = (K*(255-M))/255; | |
| 1597 b = (K*(255-Y))/255; | |
| 1598 } | |
| 1599 *cp++ = PACK(Map[r], Map[g], Map[b]); | |
| 1600 wp += samplesperpixel; | |
| 1601 } | |
| 1602 wp += fromskew; | |
| 1603 cp += toskew; | |
| 1604 } | |
| 1605 } | 1550 } |
| 1606 | 1551 |
| 1607 #define DECLARESepPutFunc(name) \ | 1552 #define DECLARESepPutFunc(name) \ |
| 1608 static void name(\ | 1553 static void name(\ |
| 1609 TIFFRGBAImage* img,\ | 1554 TIFFRGBAImage* img,\ |
| 1610 uint32* cp,\ | 1555 uint32* cp,\ |
| 1611 uint32 x, uint32 y, \ | 1556 uint32 x, uint32 y, \ |
| 1612 uint32 w, uint32 h,\ | 1557 uint32 w, uint32 h,\ |
| 1613 int32 fromskew, int32 toskew,\ | 1558 int32 fromskew, int32 toskew,\ |
| 1614 unsigned char* r, unsigned char* g, unsigned char* b, unsigned char* a\ | 1559 unsigned char* r, unsigned char* g, unsigned char* b, unsigned char* a\ |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1959 /* | 1904 /* |
| 1960 * 8-bit packed YCbCr samples w/ 4,2 subsampling => RGB | 1905 * 8-bit packed YCbCr samples w/ 4,2 subsampling => RGB |
| 1961 */ | 1906 */ |
| 1962 DECLAREContigPutFunc(putcontig8bitYCbCr42tile) | 1907 DECLAREContigPutFunc(putcontig8bitYCbCr42tile) |
| 1963 { | 1908 { |
| 1964 uint32* cp1 = cp+w+toskew; | 1909 uint32* cp1 = cp+w+toskew; |
| 1965 int32 incr = 2*toskew+w; | 1910 int32 incr = 2*toskew+w; |
| 1966 | 1911 |
| 1967 (void) y; | 1912 (void) y; |
| 1968 fromskew = (fromskew * 10) / 4; | 1913 fromskew = (fromskew * 10) / 4; |
| 1969 if ((h & 3) == 0 && (w & 1) == 0) { | 1914 if ((w & 3) == 0 && (h & 1) == 0) { |
| 1970 for (; h >= 2; h -= 2) { | 1915 for (; h >= 2; h -= 2) { |
| 1971 x = w>>2; | 1916 x = w>>2; |
| 1972 do { | 1917 do { |
| 1973 int32 Cb = pp[8]; | 1918 int32 Cb = pp[8]; |
| 1974 int32 Cr = pp[9]; | 1919 int32 Cr = pp[9]; |
| 1975 | 1920 |
| 1976 YCbCrtoRGB(cp [0], pp[0]); | 1921 YCbCrtoRGB(cp [0], pp[0]); |
| 1977 YCbCrtoRGB(cp [1], pp[1]); | 1922 YCbCrtoRGB(cp [1], pp[1]); |
| 1978 YCbCrtoRGB(cp [2], pp[2]); | 1923 YCbCrtoRGB(cp [2], pp[2]); |
| 1979 YCbCrtoRGB(cp [3], pp[3]); | 1924 YCbCrtoRGB(cp [3], pp[3]); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2036 | 1981 |
| 2037 /* | 1982 /* |
| 2038 * 8-bit packed YCbCr samples w/ 4,1 subsampling => RGB | 1983 * 8-bit packed YCbCr samples w/ 4,1 subsampling => RGB |
| 2039 */ | 1984 */ |
| 2040 DECLAREContigPutFunc(putcontig8bitYCbCr41tile) | 1985 DECLAREContigPutFunc(putcontig8bitYCbCr41tile) |
| 2041 { | 1986 { |
| 2042 (void) y; | 1987 (void) y; |
| 2043 /* XXX adjust fromskew */ | 1988 /* XXX adjust fromskew */ |
| 2044 do { | 1989 do { |
| 2045 x = w>>2; | 1990 x = w>>2; |
| 2046 » do { | 1991 » while(x>0) { |
| 2047 int32 Cb = pp[4]; | 1992 int32 Cb = pp[4]; |
| 2048 int32 Cr = pp[5]; | 1993 int32 Cr = pp[5]; |
| 2049 | 1994 |
| 2050 YCbCrtoRGB(cp [0], pp[0]); | 1995 YCbCrtoRGB(cp [0], pp[0]); |
| 2051 YCbCrtoRGB(cp [1], pp[1]); | 1996 YCbCrtoRGB(cp [1], pp[1]); |
| 2052 YCbCrtoRGB(cp [2], pp[2]); | 1997 YCbCrtoRGB(cp [2], pp[2]); |
| 2053 YCbCrtoRGB(cp [3], pp[3]); | 1998 YCbCrtoRGB(cp [3], pp[3]); |
| 2054 | 1999 |
| 2055 cp += 4; | 2000 cp += 4; |
| 2056 pp += 6; | 2001 pp += 6; |
| 2057 » } while (--x); | 2002 » » x--; |
| 2003 » } |
| 2058 | 2004 |
| 2059 if( (w&3) != 0 ) | 2005 if( (w&3) != 0 ) |
| 2060 { | 2006 { |
| 2061 int32 Cb = pp[4]; | 2007 int32 Cb = pp[4]; |
| 2062 int32 Cr = pp[5]; | 2008 int32 Cr = pp[5]; |
| 2063 | 2009 |
| 2064 switch( (w&3) ) { | 2010 switch( (w&3) ) { |
| 2065 case 3: YCbCrtoRGB(cp [2], pp[2]); | 2011 case 3: YCbCrtoRGB(cp [2], pp[2]); |
| 2066 case 2: YCbCrtoRGB(cp [1], pp[1]); | 2012 case 2: YCbCrtoRGB(cp [1], pp[1]); |
| 2067 case 1: YCbCrtoRGB(cp [0], pp[0]); | 2013 case 1: YCbCrtoRGB(cp [0], pp[0]); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2138 | 2084 |
| 2139 /* | 2085 /* |
| 2140 * 8-bit packed YCbCr samples w/ 2,1 subsampling => RGB | 2086 * 8-bit packed YCbCr samples w/ 2,1 subsampling => RGB |
| 2141 */ | 2087 */ |
| 2142 DECLAREContigPutFunc(putcontig8bitYCbCr21tile) | 2088 DECLAREContigPutFunc(putcontig8bitYCbCr21tile) |
| 2143 { | 2089 { |
| 2144 (void) y; | 2090 (void) y; |
| 2145 fromskew = (fromskew * 4) / 2; | 2091 fromskew = (fromskew * 4) / 2; |
| 2146 do { | 2092 do { |
| 2147 x = w>>1; | 2093 x = w>>1; |
| 2148 » » do { | 2094 » » while(x>0) { |
| 2149 int32 Cb = pp[2]; | 2095 int32 Cb = pp[2]; |
| 2150 int32 Cr = pp[3]; | 2096 int32 Cr = pp[3]; |
| 2151 | 2097 |
| 2152 YCbCrtoRGB(cp[0], pp[0]); | 2098 YCbCrtoRGB(cp[0], pp[0]); |
| 2153 YCbCrtoRGB(cp[1], pp[1]); | 2099 YCbCrtoRGB(cp[1], pp[1]); |
| 2154 | 2100 |
| 2155 cp += 2; | 2101 cp += 2; |
| 2156 pp += 4; | 2102 pp += 4; |
| 2157 » » } while (--x); | 2103 » » » x --; |
| 2104 » » } |
| 2158 | 2105 |
| 2159 if( (w&1) != 0 ) | 2106 if( (w&1) != 0 ) |
| 2160 { | 2107 { |
| 2161 int32 Cb = pp[2]; | 2108 int32 Cb = pp[2]; |
| 2162 int32 Cr = pp[3]; | 2109 int32 Cr = pp[3]; |
| 2163 | 2110 |
| 2164 YCbCrtoRGB(cp[0], pp[0]); | 2111 YCbCrtoRGB(cp[0], pp[0]); |
| 2165 | 2112 |
| 2166 cp += 1; | 2113 cp += 1; |
| 2167 pp += 4; | 2114 pp += 4; |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2305 refWhite[0] = whitePoint[0] / whitePoint[1] * refWhite[1]; | 2252 refWhite[0] = whitePoint[0] / whitePoint[1] * refWhite[1]; |
| 2306 refWhite[2] = (1.0F - whitePoint[0] - whitePoint[1]) | 2253 refWhite[2] = (1.0F - whitePoint[0] - whitePoint[1]) |
| 2307 / whitePoint[1] * refWhite[1]; | 2254 / whitePoint[1] * refWhite[1]; |
| 2308 if (TIFFCIELabToRGBInit(img->cielab, &display_sRGB, refWhite) < 0) { | 2255 if (TIFFCIELabToRGBInit(img->cielab, &display_sRGB, refWhite) < 0) { |
| 2309 TIFFErrorExt(img->tif->tif_clientdata, module, | 2256 TIFFErrorExt(img->tif->tif_clientdata, module, |
| 2310 "Failed to initialize CIE L*a*b*->RGB conversion state."); | 2257 "Failed to initialize CIE L*a*b*->RGB conversion state."); |
| 2311 _TIFFfree(img->cielab); | 2258 _TIFFfree(img->cielab); |
| 2312 return NULL; | 2259 return NULL; |
| 2313 } | 2260 } |
| 2314 | 2261 |
| 2315 » return (tileContigRoutine)putcontig8bitCIELab; | 2262 » return putcontig8bitCIELab; |
| 2316 } | 2263 } |
| 2317 | 2264 |
| 2318 /* | 2265 /* |
| 2319 * Greyscale images with less than 8 bits/sample are handled | 2266 * Greyscale images with less than 8 bits/sample are handled |
| 2320 * with a table to avoid lots of shifts and masks. The table | 2267 * with a table to avoid lots of shifts and masks. The table |
| 2321 * is setup so that put*bwtile (below) can retrieve 8/bitspersample | 2268 * is setup so that put*bwtile (below) can retrieve 8/bitspersample |
| 2322 * pixel values simply by indexing into the table with one | 2269 * pixel values simply by indexing into the table with one |
| 2323 * number. | 2270 * number. |
| 2324 */ | 2271 */ |
| 2325 static int | 2272 static int |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2587 { | 2534 { |
| 2588 if (BuildMapBitdepth16To8(img)) | 2535 if (BuildMapBitdepth16To8(img)) |
| 2589 img->put.contig = putRGB
contig16bittile; | 2536 img->put.contig = putRGB
contig16bittile; |
| 2590 } | 2537 } |
| 2591 break; | 2538 break; |
| 2592 } | 2539 } |
| 2593 break; | 2540 break; |
| 2594 case PHOTOMETRIC_SEPARATED: | 2541 case PHOTOMETRIC_SEPARATED: |
| 2595 if (buildMap(img)) { | 2542 if (buildMap(img)) { |
| 2596 if (img->bitspersample == 8) { | 2543 if (img->bitspersample == 8) { |
| 2597 » » » » if (!img->Map) | 2544 » » » » » if (!img->Map) |
| 2598 » » » » » img->put.contig = putRGBcontig8bitCMYKti
le; | 2545 » » » » » » img->put.contig = putRGBcontig8b
itCMYKtile; |
| 2599 » » » » else | 2546 » » » » » else |
| 2600 » » » » » img->put.contig = putRGBcontig8bitCMYKMa
ptile; | 2547 » » » » » » img->put.contig = putRGBcontig8b
itCMYKMaptile; |
| 2548 » » » » } |
| 2601 } | 2549 } |
| 2602 » » » else if(img->bitspersample == 16) /*LiuSunliang added 16
bpp CMYK support.*/ | 2550 » » » break; |
| 2603 » » » { | 2551 » » case PHOTOMETRIC_PALETTE: |
| 2604 » » » » if (!img->Map) | |
| 2605 » » » » » img->put.contig = putRGBcontig16bitCMYKt
ile; | |
| 2606 » » » » else | |
| 2607 » » » » » img->put.contig = putRGBcontig16bitCMYKM
aptile; | |
| 2608 » » » } | |
| 2609 » » } | |
| 2610 » » break; | |
| 2611 » case PHOTOMETRIC_PALETTE: | |
| 2612 if (buildMap(img)) { | 2552 if (buildMap(img)) { |
| 2613 switch (img->bitspersample) { | 2553 switch (img->bitspersample) { |
| 2614 case 8: | 2554 case 8: |
| 2615 img->put.contig = put8bitcmaptil
e; | 2555 img->put.contig = put8bitcmaptil
e; |
| 2616 break; | 2556 break; |
| 2617 case 4: | 2557 case 4: |
| 2618 img->put.contig = put4bitcmaptil
e; | 2558 img->put.contig = put4bitcmaptil
e; |
| 2619 break; | 2559 break; |
| 2620 case 2: | 2560 case 2: |
| 2621 img->put.contig = put2bitcmaptil
e; | 2561 img->put.contig = put2bitcmaptil
e; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2655 if ((img->bitspersample==8) && (img->samplesperpixel==3)
) | 2595 if ((img->bitspersample==8) && (img->samplesperpixel==3)
) |
| 2656 { | 2596 { |
| 2657 if (initYCbCrConversion(img)!=0) | 2597 if (initYCbCrConversion(img)!=0) |
| 2658 { | 2598 { |
| 2659 /* | 2599 /* |
| 2660 * The 6.0 spec says that subsampling mu
st be | 2600 * The 6.0 spec says that subsampling mu
st be |
| 2661 * one of 1, 2, or 4, and that vertical
subsampling | 2601 * one of 1, 2, or 4, and that vertical
subsampling |
| 2662 * must always be <= horizontal subsampl
ing; so | 2602 * must always be <= horizontal subsampl
ing; so |
| 2663 * there are only a few possibilities an
d we just | 2603 * there are only a few possibilities an
d we just |
| 2664 * enumerate the cases. | 2604 * enumerate the cases. |
| 2665 » » » » » * Joris: added support for the [1,2] ca
se, nonetheless, to accomodate | 2605 » » » » » * Joris: added support for the [1,2] ca
se, nonetheless, to accommodate |
| 2666 * some OJPEG files | 2606 * some OJPEG files |
| 2667 */ | 2607 */ |
| 2668 uint16 SubsamplingHor; | 2608 uint16 SubsamplingHor; |
| 2669 uint16 SubsamplingVer; | 2609 uint16 SubsamplingVer; |
| 2670 TIFFGetFieldDefaulted(img->tif, TIFFTAG_
YCBCRSUBSAMPLING, &SubsamplingHor, &SubsamplingVer); | 2610 TIFFGetFieldDefaulted(img->tif, TIFFTAG_
YCBCRSUBSAMPLING, &SubsamplingHor, &SubsamplingVer); |
| 2671 switch ((SubsamplingHor<<4)|SubsamplingV
er) { | 2611 switch ((SubsamplingHor<<4)|SubsamplingV
er) { |
| 2672 case 0x44: | 2612 case 0x44: |
| 2673 img->put.contig = putcon
tig8bitYCbCr44tile; | 2613 img->put.contig = putcon
tig8bitYCbCr44tile; |
| 2674 break; | 2614 break; |
| 2675 case 0x42: | 2615 case 0x42: |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2979 } | 2919 } |
| 2980 | 2920 |
| 2981 /* vim: set ts=8 sts=8 sw=8 noet: */ | 2921 /* vim: set ts=8 sts=8 sw=8 noet: */ |
| 2982 /* | 2922 /* |
| 2983 * Local Variables: | 2923 * Local Variables: |
| 2984 * mode: c | 2924 * mode: c |
| 2985 * c-basic-offset: 8 | 2925 * c-basic-offset: 8 |
| 2986 * fill-column: 78 | 2926 * fill-column: 78 |
| 2987 * End: | 2927 * End: |
| 2988 */ | 2928 */ |
| 2989 | |
| OLD | NEW |