Eliminate support for compilers w/o unsigned char
libjpeg-turbo has never really supported such compilers, since (AFAIK) they are non-existent on any modern computing platform and thus impossible for us to test. (Also, the TurboJPEG API would break without unsigned chars.) Furthermore, the unified CMake-based build system introduced in 2.0 always defines HAVE_UNSIGNED_CHAR, so retaining other code paths is pointless. Eliminating support for compilers without unsigned char eliminates the need for the GETJSAMPLE() macro, which improves the readability of many parts of the code as well as improving the performance of writing Targa and Windows BMP files. Fixes #317
This commit is contained in:
16
wrppm.c
16
wrppm.c
@@ -108,17 +108,17 @@ copy_pixel_rows(j_decompress_ptr cinfo, djpeg_dest_ptr dinfo,
|
||||
ppm_dest_ptr dest = (ppm_dest_ptr)dinfo;
|
||||
register char *bufferptr;
|
||||
register JSAMPROW ptr;
|
||||
#if BITS_IN_JSAMPLE != 8 || (!defined(HAVE_UNSIGNED_CHAR) && !defined(__CHAR_UNSIGNED__))
|
||||
#if BITS_IN_JSAMPLE != 8
|
||||
register JDIMENSION col;
|
||||
#endif
|
||||
|
||||
ptr = dest->pub.buffer[0];
|
||||
bufferptr = dest->iobuffer;
|
||||
#if BITS_IN_JSAMPLE == 8 && (defined(HAVE_UNSIGNED_CHAR) || defined(__CHAR_UNSIGNED__))
|
||||
#if BITS_IN_JSAMPLE == 8
|
||||
MEMCOPY(bufferptr, ptr, dest->samples_per_row);
|
||||
#else
|
||||
for (col = dest->samples_per_row; col > 0; col--) {
|
||||
PUTPPMSAMPLE(bufferptr, GETJSAMPLE(*ptr++));
|
||||
PUTPPMSAMPLE(bufferptr, *ptr++);
|
||||
}
|
||||
#endif
|
||||
(void)JFWRITE(dest->pub.output_file, dest->iobuffer, dest->buffer_width);
|
||||
@@ -200,10 +200,10 @@ put_demapped_rgb(j_decompress_ptr cinfo, djpeg_dest_ptr dinfo,
|
||||
ptr = dest->pub.buffer[0];
|
||||
bufferptr = dest->iobuffer;
|
||||
for (col = cinfo->output_width; col > 0; col--) {
|
||||
pixval = GETJSAMPLE(*ptr++);
|
||||
PUTPPMSAMPLE(bufferptr, GETJSAMPLE(color_map0[pixval]));
|
||||
PUTPPMSAMPLE(bufferptr, GETJSAMPLE(color_map1[pixval]));
|
||||
PUTPPMSAMPLE(bufferptr, GETJSAMPLE(color_map2[pixval]));
|
||||
pixval = *ptr++;
|
||||
PUTPPMSAMPLE(bufferptr, color_map0[pixval]);
|
||||
PUTPPMSAMPLE(bufferptr, color_map1[pixval]);
|
||||
PUTPPMSAMPLE(bufferptr, color_map2[pixval]);
|
||||
}
|
||||
(void)JFWRITE(dest->pub.output_file, dest->iobuffer, dest->buffer_width);
|
||||
}
|
||||
@@ -222,7 +222,7 @@ put_demapped_gray(j_decompress_ptr cinfo, djpeg_dest_ptr dinfo,
|
||||
ptr = dest->pub.buffer[0];
|
||||
bufferptr = dest->iobuffer;
|
||||
for (col = cinfo->output_width; col > 0; col--) {
|
||||
PUTPPMSAMPLE(bufferptr, GETJSAMPLE(color_map[GETJSAMPLE(*ptr++)]));
|
||||
PUTPPMSAMPLE(bufferptr, color_map[*ptr++]);
|
||||
}
|
||||
(void)JFWRITE(dest->pub.output_file, dest->iobuffer, dest->buffer_width);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user