diff options
author | warmerda <warmerda> | 2009-06-21 19:44:48 +0000 |
---|---|---|
committer | warmerda <warmerda> | 2009-06-21 19:44:48 +0000 |
commit | b44e0c72d1e1bff5181348d107ae5e2d8371cd50 (patch) | |
tree | f0014f040940fe9a542cf7c44b159c4aaa6bd280 | |
parent | 4f096b8a055939da7eb2a5d60117c0a9143863e1 (diff) | |
download | libjpeg-b44e0c72d1e1bff5181348d107ae5e2d8371cd50.tar.gz |
fix 16bit pnm byte order to be bigendian per bug #2809967
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | rdppm.c | 16 | ||||
-rw-r--r-- | wrppm.c | 2 |
3 files changed, 14 insertions, 9 deletions
@@ -1,3 +1,8 @@ +2009-06-21 Frank Warmerdam <warmerdam@pobox.com> + + * rdppm.c, wrppm.c: Fix byte order for 16bit pnm. Should be bigendian. + http://sourceforge.net/support/tracker.php?aid=2809967 + 2006-02-25 Paul van den Berg <paulberg@wanadoo.nl> * created branch jpeg6b_vollbeding @@ -250,8 +250,8 @@ get_word_gray_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) bufferptr = source->iobuffer; for (col = cinfo->image_width; col > 0; col--) { register int temp; - temp = UCH(*bufferptr++); - temp |= UCH(*bufferptr++) << 8; + temp = UCH(*bufferptr++) << 8; + temp |= UCH(*bufferptr++); *ptr++ = rescale[temp]; } return 1; @@ -274,14 +274,14 @@ get_word_rgb_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) bufferptr = source->iobuffer; for (col = cinfo->image_width; col > 0; col--) { register int temp; - temp = UCH(*bufferptr++); - temp |= UCH(*bufferptr++) << 8; + temp = UCH(*bufferptr++) << 8; + temp |= UCH(*bufferptr++); *ptr++ = rescale[temp]; - temp = UCH(*bufferptr++); - temp |= UCH(*bufferptr++) << 8; + temp = UCH(*bufferptr++) << 8; + temp |= UCH(*bufferptr++); *ptr++ = rescale[temp]; - temp = UCH(*bufferptr++); - temp |= UCH(*bufferptr++) << 8; + temp = UCH(*bufferptr++) << 8; + temp |= UCH(*bufferptr++); *ptr++ = rescale[temp]; } return 1; @@ -43,8 +43,8 @@ /* The word-per-sample format always puts the LSB first. */ #define PUTPPMSAMPLE(ptr,v) \ { register int val_ = v; \ - *ptr++ = (char) (val_ & 0xFF); \ *ptr++ = (char) ((val_ >> 8) & 0xFF); \ + *ptr++ = (char) (val_ & 0xFF); \ } #define BYTESPERSAMPLE 2 #define PPM_MAXVAL ((1<<BITS_IN_JSAMPLE)-1) |