Skip to content

Commit

Permalink
8324233: Update JPEG Image Decoding Software to 9f
Browse files Browse the repository at this point in the history
Backport-of: b99eb45828317e4c195b46eb0c9371d4645f2c6c
  • Loading branch information
jayathirthrao authored and kevinrushforth committed Feb 29, 2024
1 parent 8d26e07 commit e54102c
Show file tree
Hide file tree
Showing 28 changed files with 367 additions and 289 deletions.
16 changes: 4 additions & 12 deletions modules/javafx.graphics/src/main/legal/jpeg_fx.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,16 @@
## Independent JPEG Group (IJG) JPEG v9e
## Independent JPEG Group (IJG) JPEG version 9f

### IJG License
```
Copyright (C) 1991-1998, Thomas G. Lane.
Copyright (C) 1991-2024, Thomas G. Lane, Guido Vollbeding.
/*
* jcapimin.c
*
* Copyright (C) 1994-1998, Thomas G. Lane.
* Modified 2003-2010 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file.
*/
[From the README file]
The authors make NO WARRANTY or representation, either express or implied,
with respect to this software, its quality, accuracy, merchantability, or
fitness for a particular purpose. This software is provided "AS IS", and you,
its user, assume the entire risk as to its quality and accuracy.
This software is copyright (C) 1991-2022, Thomas G. Lane, Guido Vollbeding.
This software is copyright (C) 1991-2024, Thomas G. Lane, Guido Vollbeding.
All Rights Reserved except as specified below.
Permission is hereby granted to use, copy, modify, and distribute this
Expand Down
10 changes: 5 additions & 5 deletions modules/javafx.graphics/src/main/native-iio/libjpeg/README
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
The Independent JPEG Group's JPEG software
==========================================

README for release 9e of 16-Jan-2022
README for release 9f of 14-Jan-2024
====================================

This distribution contains the ninth public release of the Independent JPEG
Expand Down Expand Up @@ -116,7 +116,7 @@ with respect to this software, its quality, accuracy, merchantability, or
fitness for a particular purpose. This software is provided "AS IS", and you,
its user, assume the entire risk as to its quality and accuracy.

This software is copyright (C) 1991-2022, Thomas G. Lane, Guido Vollbeding.
This software is copyright (C) 1991-2024, Thomas G. Lane, Guido Vollbeding.
All Rights Reserved except as specified below.

Permission is hereby granted to use, copy, modify, and distribute this
Expand Down Expand Up @@ -240,9 +240,9 @@ The "official" archive site for this software is www.ijg.org.
The most recent released version can always be found there in
directory "files". This particular version will be archived
in Windows-compatible "zip" archive format as
https://www.ijg.org/files/jpegsr9e.zip, and
https://www.ijg.org/files/jpegsr9f.zip, and
in Unix-compatible "tar.gz" archive format as
https://www.ijg.org/files/jpegsrc.v9e.tar.gz.
https://www.ijg.org/files/jpegsrc.v9f.tar.gz.

The JPEG FAQ (Frequently Asked Questions) article is a source of some
general information about JPEG.
Expand Down Expand Up @@ -371,4 +371,4 @@ to overcome the limitations of the original JPEG specification,
and is the first true source reference JPEG codec.
More features are being prepared for coming releases...

Please send bug reports, offers of help, etc. to jpeg-info@jpegclub.org.
Please send bug reports, offers of help, etc. to jpeg-info@ijg.org.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ section from README.

3) OpenJFX imports only the JPEG library source with some exceptions.
OpenJFX does not need any other applications or tools provided by IJG libjpeg.
Copy only the same 41 .c and 9 .h files as are already there.
Copy only the same 41 .c and 8 .h files as are already there. jconfig.h file
is not present in IJG code, so keep it as it is.

4) The following files contain local modifications of libjpeg for JavaFX:
* jchuff.c
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* jccoefct.c
*
* Copyright (C) 1994-1997, Thomas G. Lane.
* Modified 2003-2020 by Guido Vollbeding.
* Modified 2003-2022 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file.
*
Expand Down Expand Up @@ -41,9 +41,9 @@ typedef struct {
int MCU_rows_per_iMCU_row; /* number of such rows needed */

/* For single-pass compression, it's sufficient to buffer just one MCU
* (although this may prove a bit slow in practice). We append a
* workspace of C_MAX_BLOCKS_IN_MCU coefficient blocks, and reuse it
* for each MCU constructed and sent.
* (although this may prove a bit slow in practice).
* We append a workspace of C_MAX_BLOCKS_IN_MCU coefficient blocks,
* and reuse it for each MCU constructed and sent.
* In multi-pass modes, this array points to the current MCU's blocks
* within the virtual arrays.
*/
Expand Down
35 changes: 16 additions & 19 deletions modules/javafx.graphics/src/main/native-iio/libjpeg/jccolor.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* jccolor.c
*
* Copyright (C) 1991-1996, Thomas G. Lane.
* Modified 2011-2019 by Guido Vollbeding.
* Modified 2011-2023 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file.
*
Expand Down Expand Up @@ -40,10 +40,10 @@ typedef my_color_converter * my_cconvert_ptr;
* Note that the derived conversion coefficients given in some of these
* documents are imprecise. The general conversion equations are
* Y = Kr * R + (1 - Kr - Kb) * G + Kb * B
* Cb = 0.5 * (B - Y) / (1 - Kb)
* Cr = 0.5 * (R - Y) / (1 - Kr)
* Cb = (B - Y) / (1 - Kb) / K
* Cr = (R - Y) / (1 - Kr) / K
* With Kr = 0.299 and Kb = 0.114 (derived according to SMPTE RP 177-1993
* from the 1953 FCC NTSC primaries and CIE Illuminant C),
* from the 1953 FCC NTSC primaries and CIE Illuminant C), K = 2 for sYCC,
* the conversion equations to be implemented are therefore
* Y = 0.299 * R + 0.587 * G + 0.114 * B
* Cb = -0.168735892 * R - 0.331264108 * G + 0.5 * B + CENTERJSAMPLE
Expand All @@ -62,8 +62,8 @@ typedef my_color_converter * my_cconvert_ptr;
* by precalculating the constants times R,G,B for all possible values.
* For 8-bit JSAMPLEs this is very reasonable (only 256 entries per table);
* for 9-bit to 12-bit samples it is still acceptable. It's not very
* reasonable for 16-bit samples, but if you want lossless storage you
* shouldn't be changing colorspace anyway.
* reasonable for 16-bit samples, but if you want lossless storage
* you shouldn't be changing colorspace anyway.
* The CENTERJSAMPLE offsets and the rounding fudge-factor of 0.5 are included
* in the tables to save adding them separately in the inner loop.
*/
Expand Down Expand Up @@ -110,16 +110,16 @@ rgb_ycc_start (j_compress_ptr cinfo)
for (i = 0; i <= MAXJSAMPLE; i++) {
rgb_ycc_tab[i+R_Y_OFF] = FIX(0.299) * i;
rgb_ycc_tab[i+G_Y_OFF] = FIX(0.587) * i;
rgb_ycc_tab[i+B_Y_OFF] = FIX(0.114) * i + ONE_HALF;
rgb_ycc_tab[i+B_Y_OFF] = FIX(0.114) * i + ONE_HALF;
rgb_ycc_tab[i+R_CB_OFF] = (- FIX(0.168735892)) * i;
rgb_ycc_tab[i+G_CB_OFF] = (- FIX(0.331264108)) * i;
/* We use a rounding fudge-factor of 0.5-epsilon for Cb and Cr.
* This ensures that the maximum output will round to MAXJSAMPLE
* not MAXJSAMPLE+1, and thus that we don't have to range-limit.
*/
rgb_ycc_tab[i+B_CB_OFF] = FIX(0.5) * i + CBCR_OFFSET + ONE_HALF-1;
rgb_ycc_tab[i+B_CB_OFF] = (i << (SCALEBITS-1)) + CBCR_OFFSET + ONE_HALF-1;
/* B=>Cb and R=>Cr tables are the same
rgb_ycc_tab[i+R_CR_OFF] = FIX(0.5) * i + CBCR_OFFSET + ONE_HALF-1;
rgb_ycc_tab[i+R_CR_OFF] = (i << (SCALEBITS-1)) + CBCR_OFFSET + ONE_HALF-1;
*/
rgb_ycc_tab[i+G_CR_OFF] = (- FIX(0.418687589)) * i;
rgb_ycc_tab[i+B_CR_OFF] = (- FIX(0.081312411)) * i;
Expand Down Expand Up @@ -190,8 +190,8 @@ rgb_ycc_convert (j_compress_ptr cinfo,

/*
* Convert some rows of samples to the JPEG colorspace.
* This version handles RGB->grayscale conversion, which is the same
* as the RGB->Y portion of RGB->YCbCr.
* This version handles RGB->grayscale conversion,
* which is the same as the RGB->Y portion of RGB->YCbCr.
* We assume rgb_ycc_start has been called (we only use the Y tables).
*/

Expand All @@ -201,7 +201,7 @@ rgb_gray_convert (j_compress_ptr cinfo,
JDIMENSION output_row, int num_rows)
{
my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
register int r, g, b;
register INT32 y;
register INT32 * ctab = cconvert->rgb_ycc_tab;
register JSAMPROW inptr;
register JSAMPROW outptr;
Expand All @@ -212,14 +212,11 @@ rgb_gray_convert (j_compress_ptr cinfo,
inptr = *input_buf++;
outptr = output_buf[0][output_row++];
for (col = 0; col < num_cols; col++) {
r = GETJSAMPLE(inptr[RGB_RED]);
g = GETJSAMPLE(inptr[RGB_GREEN]);
b = GETJSAMPLE(inptr[RGB_BLUE]);
y = ctab[R_Y_OFF + GETJSAMPLE(inptr[RGB_RED])];
y += ctab[G_Y_OFF + GETJSAMPLE(inptr[RGB_GREEN])];
y += ctab[B_Y_OFF + GETJSAMPLE(inptr[RGB_BLUE])];
inptr += RGB_PIXELSIZE;
/* Y */
outptr[col] = (JSAMPLE)
((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF])
>> SCALEBITS);
outptr[col] = (JSAMPLE) (y >> SCALEBITS);
}
}
}
Expand Down
Loading

1 comment on commit e54102c

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.