changeset 53518:4397fa4529b2 jdk-11.0.9+11 jdk-11.0.9-ga

8253019: Enhanced JPEG decoding Reviewed-by: rhalade, mschoene, serb, psadhukhan
author prr
date Fri, 11 Sep 2020 16:12:45 +0000
parents ef1ab1bede2c
children 642814a1d168
files src/java.desktop/share/native/libjavajpeg/jdhuff.c src/java.desktop/share/native/libjavajpeg/jdinput.c src/java.desktop/share/native/libjavajpeg/jdmarker.c src/java.desktop/share/native/libjavajpeg/jpeglib.h
diffstat 4 files changed, 6 insertions(+), 48 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.desktop/share/native/libjavajpeg/jdhuff.c	Thu Jul 02 12:02:08 2020 -0700
+++ b/src/java.desktop/share/native/libjavajpeg/jdhuff.c	Fri Sep 11 16:12:45 2020 +0000
@@ -121,8 +121,7 @@
     compptr = cinfo->cur_comp_info[ci];
     /* Precalculate which table to use for each block */
     entropy->dc_cur_tbls[blkn] = entropy->dc_derived_tbls[compptr->dc_tbl_no];
-    entropy->ac_cur_tbls[blkn] =    /* AC needs no table when not present */
-      cinfo->lim_Se ? entropy->ac_derived_tbls[compptr->ac_tbl_no] : NULL;
+    entropy->ac_cur_tbls[blkn] = entropy->ac_derived_tbls[compptr->ac_tbl_no];
     /* Decide whether we really care about the coefficient values */
     if (compptr->component_needed) {
       entropy->dc_needed[blkn] = TRUE;
--- a/src/java.desktop/share/native/libjavajpeg/jdinput.c	Thu Jul 02 12:02:08 2020 -0700
+++ b/src/java.desktop/share/native/libjavajpeg/jdinput.c	Fri Sep 11 16:12:45 2020 +0000
@@ -74,39 +74,6 @@
                                    compptr->v_samp_factor);
   }
 
-  /* Derive lim_Se */
-  if (cinfo->is_baseline || (cinfo->progressive_mode &&
-      cinfo->comps_in_scan)) { /* no pseudo SOS marker */
-    cinfo->lim_Se = DCTSIZE2-1;
-  } else {
-    switch (cinfo->Se) {
-    case (1*1-1):
-    case (2*2-1):
-    case (3*3-1):
-    case (4*4-1):
-    case (5*5-1):
-    case (6*6-1):
-    case (7*7-1):
-         cinfo->lim_Se = cinfo->Se;
-         break;
-    case (8*8-1):
-    case (9*9-1):
-    case (10*10-1):
-    case (11*11-1):
-    case (12*12-1):
-    case (13*13-1):
-    case (14*14-1):
-    case (15*15-1):
-    case (16*16-1):
-         cinfo->lim_Se = DCTSIZE2-1;
-         break;
-    default:
-      ERREXIT4(cinfo, JERR_BAD_PROGRESSION,
-               cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al);
-      break;
-    }
-  }
-
   /* We initialize DCT_scaled_size and min_DCT_scaled_size to DCTSIZE.
    * In the full decompressor, this will be overridden by jdmaster.c;
    * but in the transcoder, jdmaster.c is not used, so we must do it here.
--- a/src/java.desktop/share/native/libjavajpeg/jdmarker.c	Thu Jul 02 12:02:08 2020 -0700
+++ b/src/java.desktop/share/native/libjavajpeg/jdmarker.c	Fri Sep 11 16:12:45 2020 +0000
@@ -238,7 +238,7 @@
 
 
 LOCAL(boolean)
-get_sof (j_decompress_ptr cinfo, boolean is_baseline, boolean is_prog, boolean is_arith)
+get_sof (j_decompress_ptr cinfo, boolean is_prog, boolean is_arith)
 /* Process a SOFn marker */
 {
   INT32 length;
@@ -246,7 +246,6 @@
   jpeg_component_info * compptr;
   INPUT_VARS(cinfo);
 
-  cinfo->is_baseline = is_baseline;
   cinfo->progressive_mode = is_prog;
   cinfo->arith_code = is_arith;
 
@@ -999,27 +998,23 @@
       break;
 
     case M_SOF0:                /* Baseline */
-      if (! get_sof(cinfo, TRUE, FALSE, FALSE))
-        return JPEG_SUSPENDED;
-      break;
-
     case M_SOF1:                /* Extended sequential, Huffman */
-      if (! get_sof(cinfo, FALSE, FALSE, FALSE))
+      if (! get_sof(cinfo, FALSE, FALSE))
         return JPEG_SUSPENDED;
       break;
 
     case M_SOF2:                /* Progressive, Huffman */
-      if (! get_sof(cinfo, FALSE, TRUE, FALSE))
+      if (! get_sof(cinfo, TRUE, FALSE))
         return JPEG_SUSPENDED;
       break;
 
     case M_SOF9:                /* Extended sequential, arithmetic */
-      if (! get_sof(cinfo, FALSE, FALSE, TRUE))
+      if (! get_sof(cinfo, FALSE, TRUE))
         return JPEG_SUSPENDED;
       break;
 
     case M_SOF10:               /* Progressive, arithmetic */
-      if (! get_sof(cinfo, FALSE, TRUE, TRUE))
+      if (! get_sof(cinfo, TRUE, TRUE))
         return JPEG_SUSPENDED;
       break;
 
--- a/src/java.desktop/share/native/libjavajpeg/jpeglib.h	Thu Jul 02 12:02:08 2020 -0700
+++ b/src/java.desktop/share/native/libjavajpeg/jpeglib.h	Fri Sep 11 16:12:45 2020 +0000
@@ -539,7 +539,6 @@
   jpeg_component_info * comp_info;
   /* comp_info[i] describes component that appears i'th in SOF */
 
-  boolean is_baseline;          /* TRUE if Baseline SOF0 encountered */
   boolean progressive_mode;     /* TRUE if SOFn specifies progressive mode */
   boolean arith_code;           /* TRUE=arithmetic coding, FALSE=Huffman */
 
@@ -612,8 +611,6 @@
 
   int Ss, Se, Ah, Al;           /* progressive JPEG parameters for scan */
 
-  int lim_Se;                   /* min( Se, DCTSIZE2-1 ) for entropy decode */
-
   /* This field is shared between entropy decoder and marker parser.
    * It is either zero or the code of a JPEG marker that has been
    * read from the data source, but has not yet been processed.