Merge branch 'main' into dev
This commit is contained in:
@@ -101,6 +101,10 @@ strides to pass to `tjDecompressToYUVPlanes()`. This caused a buffer overrun
|
||||
and subsequent segfault if the desired image dimensions exceeded the scaled
|
||||
image dimensions.
|
||||
|
||||
7. Fixed an issue whereby, when decompressing a 12-bit-per-component JPEG image
|
||||
(`-DWITH_12BIT=1`) using an alpha-enabled output color space such as
|
||||
`JCS_EXT_RGBA`, the alpha channel was set to 255 rather than 4095.
|
||||
|
||||
|
||||
2.1.4
|
||||
=====
|
||||
|
||||
@@ -398,7 +398,7 @@ public class TJDecompressor implements Closeable {
|
||||
int pitch, int desiredHeight, int pixelFormat,
|
||||
int flags) throws TJException {
|
||||
if (jpegBuf == null && yuvImage == null)
|
||||
throw new IllegalStateException(NO_ASSOC_ERROR);
|
||||
throw new IllegalStateException("No source image is associated with this instance");
|
||||
if (dstBuf == null || x < 0 || y < 0 || pitch < 0 ||
|
||||
(yuvImage != null && (desiredWidth < 0 || desiredHeight < 0)) ||
|
||||
pixelFormat < 0 || pixelFormat >= TJ.NUMPF || flags < 0)
|
||||
@@ -681,7 +681,7 @@ public class TJDecompressor implements Closeable {
|
||||
int stride, int desiredHeight, int pixelFormat,
|
||||
int flags) throws TJException {
|
||||
if (jpegBuf == null && yuvImage == null)
|
||||
throw new IllegalStateException(NO_ASSOC_ERROR);
|
||||
throw new IllegalStateException("No source image is associated with this instance");
|
||||
if (dstBuf == null || x < 0 || y < 0 || stride < 0 ||
|
||||
(yuvImage != null && (desiredWidth < 0 || desiredHeight < 0)) ||
|
||||
pixelFormat < 0 || pixelFormat >= TJ.NUMPF || flags < 0)
|
||||
|
||||
20
jdcolext.c
20
jdcolext.c
@@ -4,7 +4,7 @@
|
||||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2009, 2011, 2015, 2022, D. R. Commander.
|
||||
* Copyright (C) 2009, 2011, 2015, 2022-2023, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*
|
||||
@@ -63,10 +63,10 @@ ycc_rgb_convert_internal(j_decompress_ptr cinfo, _JSAMPIMAGE input_buf,
|
||||
((int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],
|
||||
SCALEBITS))];
|
||||
outptr[RGB_BLUE] = range_limit[y + Cbbtab[cb]];
|
||||
/* Set unused byte to 0xFF so it can be interpreted as an opaque */
|
||||
/* alpha channel value */
|
||||
/* Set unused byte to _MAXJSAMPLE so it can be interpreted as an */
|
||||
/* opaque alpha channel value */
|
||||
#ifdef RGB_ALPHA
|
||||
outptr[RGB_ALPHA] = 0xFF;
|
||||
outptr[RGB_ALPHA] = _MAXJSAMPLE;
|
||||
#endif
|
||||
outptr += RGB_PIXELSIZE;
|
||||
}
|
||||
@@ -98,10 +98,10 @@ gray_rgb_convert_internal(j_decompress_ptr cinfo, _JSAMPIMAGE input_buf,
|
||||
outptr = *output_buf++;
|
||||
for (col = 0; col < num_cols; col++) {
|
||||
outptr[RGB_RED] = outptr[RGB_GREEN] = outptr[RGB_BLUE] = inptr[col];
|
||||
/* Set unused byte to 0xFF so it can be interpreted as an opaque */
|
||||
/* alpha channel value */
|
||||
/* Set unused byte to _MAXJSAMPLE so it can be interpreted as an */
|
||||
/* opaque alpha channel value */
|
||||
#ifdef RGB_ALPHA
|
||||
outptr[RGB_ALPHA] = 0xFF;
|
||||
outptr[RGB_ALPHA] = _MAXJSAMPLE;
|
||||
#endif
|
||||
outptr += RGB_PIXELSIZE;
|
||||
}
|
||||
@@ -134,10 +134,10 @@ rgb_rgb_convert_internal(j_decompress_ptr cinfo, _JSAMPIMAGE input_buf,
|
||||
outptr[RGB_RED] = inptr0[col];
|
||||
outptr[RGB_GREEN] = inptr1[col];
|
||||
outptr[RGB_BLUE] = inptr2[col];
|
||||
/* Set unused byte to 0xFF so it can be interpreted as an opaque */
|
||||
/* alpha channel value */
|
||||
/* Set unused byte to _MAXJSAMPLE so it can be interpreted as an */
|
||||
/* opaque alpha channel value */
|
||||
#ifdef RGB_ALPHA
|
||||
outptr[RGB_ALPHA] = 0xFF;
|
||||
outptr[RGB_ALPHA] = _MAXJSAMPLE;
|
||||
#endif
|
||||
outptr += RGB_PIXELSIZE;
|
||||
}
|
||||
|
||||
20
jdmrgext.c
20
jdmrgext.c
@@ -4,7 +4,7 @@
|
||||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2011, 2015, 2020, 2022, D. R. Commander.
|
||||
* Copyright (C) 2011, 2015, 2020, 2022-2023, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*
|
||||
@@ -57,7 +57,7 @@ h2v1_merged_upsample_internal(j_decompress_ptr cinfo, _JSAMPIMAGE input_buf,
|
||||
outptr[RGB_GREEN] = range_limit[y + cgreen];
|
||||
outptr[RGB_BLUE] = range_limit[y + cblue];
|
||||
#ifdef RGB_ALPHA
|
||||
outptr[RGB_ALPHA] = 0xFF;
|
||||
outptr[RGB_ALPHA] = _MAXJSAMPLE;
|
||||
#endif
|
||||
outptr += RGB_PIXELSIZE;
|
||||
y = *inptr0++;
|
||||
@@ -65,7 +65,7 @@ h2v1_merged_upsample_internal(j_decompress_ptr cinfo, _JSAMPIMAGE input_buf,
|
||||
outptr[RGB_GREEN] = range_limit[y + cgreen];
|
||||
outptr[RGB_BLUE] = range_limit[y + cblue];
|
||||
#ifdef RGB_ALPHA
|
||||
outptr[RGB_ALPHA] = 0xFF;
|
||||
outptr[RGB_ALPHA] = _MAXJSAMPLE;
|
||||
#endif
|
||||
outptr += RGB_PIXELSIZE;
|
||||
}
|
||||
@@ -81,7 +81,7 @@ h2v1_merged_upsample_internal(j_decompress_ptr cinfo, _JSAMPIMAGE input_buf,
|
||||
outptr[RGB_GREEN] = range_limit[y + cgreen];
|
||||
outptr[RGB_BLUE] = range_limit[y + cblue];
|
||||
#ifdef RGB_ALPHA
|
||||
outptr[RGB_ALPHA] = 0xFF;
|
||||
outptr[RGB_ALPHA] = _MAXJSAMPLE;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -131,7 +131,7 @@ h2v2_merged_upsample_internal(j_decompress_ptr cinfo, _JSAMPIMAGE input_buf,
|
||||
outptr0[RGB_GREEN] = range_limit[y + cgreen];
|
||||
outptr0[RGB_BLUE] = range_limit[y + cblue];
|
||||
#ifdef RGB_ALPHA
|
||||
outptr0[RGB_ALPHA] = 0xFF;
|
||||
outptr0[RGB_ALPHA] = _MAXJSAMPLE;
|
||||
#endif
|
||||
outptr0 += RGB_PIXELSIZE;
|
||||
y = *inptr00++;
|
||||
@@ -139,7 +139,7 @@ h2v2_merged_upsample_internal(j_decompress_ptr cinfo, _JSAMPIMAGE input_buf,
|
||||
outptr0[RGB_GREEN] = range_limit[y + cgreen];
|
||||
outptr0[RGB_BLUE] = range_limit[y + cblue];
|
||||
#ifdef RGB_ALPHA
|
||||
outptr0[RGB_ALPHA] = 0xFF;
|
||||
outptr0[RGB_ALPHA] = _MAXJSAMPLE;
|
||||
#endif
|
||||
outptr0 += RGB_PIXELSIZE;
|
||||
y = *inptr01++;
|
||||
@@ -147,7 +147,7 @@ h2v2_merged_upsample_internal(j_decompress_ptr cinfo, _JSAMPIMAGE input_buf,
|
||||
outptr1[RGB_GREEN] = range_limit[y + cgreen];
|
||||
outptr1[RGB_BLUE] = range_limit[y + cblue];
|
||||
#ifdef RGB_ALPHA
|
||||
outptr1[RGB_ALPHA] = 0xFF;
|
||||
outptr1[RGB_ALPHA] = _MAXJSAMPLE;
|
||||
#endif
|
||||
outptr1 += RGB_PIXELSIZE;
|
||||
y = *inptr01++;
|
||||
@@ -155,7 +155,7 @@ h2v2_merged_upsample_internal(j_decompress_ptr cinfo, _JSAMPIMAGE input_buf,
|
||||
outptr1[RGB_GREEN] = range_limit[y + cgreen];
|
||||
outptr1[RGB_BLUE] = range_limit[y + cblue];
|
||||
#ifdef RGB_ALPHA
|
||||
outptr1[RGB_ALPHA] = 0xFF;
|
||||
outptr1[RGB_ALPHA] = _MAXJSAMPLE;
|
||||
#endif
|
||||
outptr1 += RGB_PIXELSIZE;
|
||||
}
|
||||
@@ -171,14 +171,14 @@ h2v2_merged_upsample_internal(j_decompress_ptr cinfo, _JSAMPIMAGE input_buf,
|
||||
outptr0[RGB_GREEN] = range_limit[y + cgreen];
|
||||
outptr0[RGB_BLUE] = range_limit[y + cblue];
|
||||
#ifdef RGB_ALPHA
|
||||
outptr0[RGB_ALPHA] = 0xFF;
|
||||
outptr0[RGB_ALPHA] = _MAXJSAMPLE;
|
||||
#endif
|
||||
y = *inptr01;
|
||||
outptr1[RGB_RED] = range_limit[y + cred];
|
||||
outptr1[RGB_GREEN] = range_limit[y + cgreen];
|
||||
outptr1[RGB_BLUE] = range_limit[y + cblue];
|
||||
#ifdef RGB_ALPHA
|
||||
outptr1[RGB_ALPHA] = 0xFF;
|
||||
outptr1[RGB_ALPHA] = _MAXJSAMPLE;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
21
rdppm.c
21
rdppm.c
@@ -5,7 +5,7 @@
|
||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||
* Modified 2009 by Bill Allombert, Guido Vollbeding.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2015-2017, 2020-2022, D. R. Commander.
|
||||
* Copyright (C) 2015-2017, 2020-2023, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*
|
||||
@@ -180,13 +180,13 @@ get_text_gray_rgb_row(j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
|
||||
if (maxval == _MAXJSAMPLE) {
|
||||
if (aindex >= 0)
|
||||
GRAY_RGB_READ_LOOP((_JSAMPLE)read_pbm_integer(cinfo, infile, maxval),
|
||||
ptr[aindex] = 0xFF;)
|
||||
ptr[aindex] = _MAXJSAMPLE;)
|
||||
else
|
||||
GRAY_RGB_READ_LOOP((_JSAMPLE)read_pbm_integer(cinfo, infile, maxval), {})
|
||||
} else {
|
||||
if (aindex >= 0)
|
||||
GRAY_RGB_READ_LOOP(rescale[read_pbm_integer(cinfo, infile, maxval)],
|
||||
ptr[aindex] = 0xFF;)
|
||||
ptr[aindex] = _MAXJSAMPLE;)
|
||||
else
|
||||
GRAY_RGB_READ_LOOP(rescale[read_pbm_integer(cinfo, infile, maxval)], {})
|
||||
}
|
||||
@@ -254,13 +254,13 @@ get_text_rgb_row(j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
|
||||
if (maxval == _MAXJSAMPLE) {
|
||||
if (aindex >= 0)
|
||||
RGB_READ_LOOP((_JSAMPLE)read_pbm_integer(cinfo, infile, maxval),
|
||||
ptr[aindex] = 0xFF;)
|
||||
ptr[aindex] = _MAXJSAMPLE;)
|
||||
else
|
||||
RGB_READ_LOOP((_JSAMPLE)read_pbm_integer(cinfo, infile, maxval), {})
|
||||
} else {
|
||||
if (aindex >= 0)
|
||||
RGB_READ_LOOP(rescale[read_pbm_integer(cinfo, infile, maxval)],
|
||||
ptr[aindex] = 0xFF;)
|
||||
ptr[aindex] = _MAXJSAMPLE;)
|
||||
else
|
||||
RGB_READ_LOOP(rescale[read_pbm_integer(cinfo, infile, maxval)], {})
|
||||
}
|
||||
@@ -346,12 +346,13 @@ get_gray_rgb_row(j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
|
||||
bufferptr = source->iobuffer;
|
||||
if (maxval == _MAXJSAMPLE) {
|
||||
if (aindex >= 0)
|
||||
GRAY_RGB_READ_LOOP(*bufferptr++, ptr[aindex] = 0xFF;)
|
||||
GRAY_RGB_READ_LOOP(*bufferptr++, ptr[aindex] = _MAXJSAMPLE;)
|
||||
else
|
||||
GRAY_RGB_READ_LOOP(*bufferptr++, {})
|
||||
} else {
|
||||
if (aindex >= 0)
|
||||
GRAY_RGB_READ_LOOP(rescale[UCH(*bufferptr++)], ptr[aindex] = 0xFF;)
|
||||
GRAY_RGB_READ_LOOP(rescale[UCH(*bufferptr++)],
|
||||
ptr[aindex] = _MAXJSAMPLE;)
|
||||
else
|
||||
GRAY_RGB_READ_LOOP(rescale[UCH(*bufferptr++)], {})
|
||||
}
|
||||
@@ -414,12 +415,12 @@ get_rgb_row(j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
|
||||
bufferptr = source->iobuffer;
|
||||
if (maxval == _MAXJSAMPLE) {
|
||||
if (aindex >= 0)
|
||||
RGB_READ_LOOP(*bufferptr++, ptr[aindex] = 0xFF;)
|
||||
RGB_READ_LOOP(*bufferptr++, ptr[aindex] = _MAXJSAMPLE;)
|
||||
else
|
||||
RGB_READ_LOOP(*bufferptr++, {})
|
||||
} else {
|
||||
if (aindex >= 0)
|
||||
RGB_READ_LOOP(rescale[UCH(*bufferptr++)], ptr[aindex] = 0xFF;)
|
||||
RGB_READ_LOOP(rescale[UCH(*bufferptr++)], ptr[aindex] = _MAXJSAMPLE;)
|
||||
else
|
||||
RGB_READ_LOOP(rescale[UCH(*bufferptr++)], {})
|
||||
}
|
||||
@@ -544,7 +545,7 @@ get_word_rgb_row(j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
|
||||
ERREXIT(cinfo, JERR_PPM_OUTOFRANGE);
|
||||
ptr[bindex] = rescale[temp];
|
||||
if (aindex >= 0)
|
||||
ptr[aindex] = 0xFF;
|
||||
ptr[aindex] = _MAXJSAMPLE;
|
||||
ptr += ps;
|
||||
}
|
||||
return 1;
|
||||
|
||||
Reference in New Issue
Block a user