(1)static int reverseSamplesBytes (uint16 spp, uint16 bps, uint32 width, uint8 src, uint8 dst) |
(2) |
(3)int i; |
(4)uint32 col, bytes_per_pixel, col_offset; |
(5)uint8 bytebuff1; |
(6)unsigned char swapbuff; |
(7)if ((src == NULL) (dst == NULL)) |
(8)TIFFError(“reverseSamplesBytes”, “Invalid input or output buffer”); |
(9)return ; |
(10) |
(11)bytes_per_pixel = ((bps spp) + 7) / 8; |
(12)switch (bps / 8)… |
(13)case : for (col = 0; col < (width / 2); col++) |
(14)col_offset = col bytes_per_pixel; |
(15)_TIFFmemcpy (swapbuff, src + col_offset, bytes_per_pixel); |
(16)_TIFFmemcpy (src + col_offset, dst - col_offset - bytes_per_pixel, bytes_per_pixel); |
(17)_TIFFmemcpy (dst - col_offset - bytes_per_pixel, swapbuff, bytes_per_pixel); |
(18) |
(19)break; |
(20)case : / Use byte copy only for single byte per sample data / |
(21)for (col = 0; col < (width / 2); col++) |
(22)for (i = 0; i < spp; i++) |
(23)bytebuff1 = src; |
(24)src++ = (dst - spp + i); |
(25)(dst - spp + i) = bytebuff1; |
(26) |
(27)dst -= spp; |
(28) |
(29)… |