diff options
-rw-r--r-- | lib/libpgm.h | 9 | ||||
-rw-r--r-- | lib/libpgm1.c | 25 | ||||
-rw-r--r-- | lib/libpgm2.c | 29 |
3 files changed, 0 insertions, 63 deletions
diff --git a/lib/libpgm.h b/lib/libpgm.h index ba51f9a9..7523faaf 100644 --- a/lib/libpgm.h +++ b/lib/libpgm.h @@ -12,13 +12,4 @@ pgm_readpgminitrest(FILE * const file, int * const rowsP, gray * const maxvalP); -gray -pgm_getrawsample(FILE * const file, - gray const maxval); - -void -pgm_writerawsample(FILE * const fileP, - gray const val, - gray const maxval); - #endif diff --git a/lib/libpgm1.c b/lib/libpgm1.c index f5d89f9c..f615069d 100644 --- a/lib/libpgm1.c +++ b/lib/libpgm1.c @@ -166,31 +166,6 @@ pgm_readpgminit(FILE * const fileP, -gray -pgm_getrawsample(FILE * const file, - gray const maxval) { - - if (maxval < 256) { - /* The sample is just one byte. Read it. */ - return(pm_getrawbyte(file)); - } else { - /* The sample is two bytes. Read both. */ - unsigned char byte_pair[2]; - size_t pairs_read; - - pairs_read = fread(&byte_pair, 2, 1, file); - if (pairs_read == 0) - pm_error("EOF /read error while reading a long sample"); - /* This could be a few instructions faster if exploited the internal - format (i.e. endianness) of a pixval. Then we might be able to - skip the shifting and oring. - */ - return((byte_pair[0]<<8) | byte_pair[1]); - } -} - - - static void readRpgmRow(FILE * const fileP, gray * const grayrow, diff --git a/lib/libpgm2.c b/lib/libpgm2.c index 7a04f09b..9f607d73 100644 --- a/lib/libpgm2.c +++ b/lib/libpgm2.c @@ -57,35 +57,6 @@ putus(unsigned short const n, -void -pgm_writerawsample(FILE * const fileP, - gray const val, - gray const maxval) { - - if (maxval < 256) { - /* Samples fit in one byte, so write just one byte */ - int rc; - rc = putc(val, fileP); - if (rc == EOF) - pm_error("Error writing single byte sample to file"); - } else { - /* Samples are too big for one byte, so write two */ - int n_written; - unsigned char outval[2]; - /* We could save a few instructions if we exploited the internal - format of a gray, i.e. its endianness. Then we might be able - to skip the shifting and anding. - */ - outval[0] = val >> 8; - outval[1] = val & 0xFF; - n_written = fwrite(&outval, 2, 1, fileP); - if (n_written == 0) - pm_error("Error writing double byte sample to file"); - } -} - - - static void format1bpsRow(const gray * const grayrow, unsigned int const cols, |