8253019: Enhanced JPEG decoding jdk8u272-b10 jdk8u272-ga jdk8u275-b00

Fri, 11 Sep 2020 16:12:45 +0000

author
prr
date
Fri, 11 Sep 2020 16:12:45 +0000
changeset 14221
badfd40f15ac
parent 14220
276130887f7b
child 14222
5a272e10d7e7
child 14224
a08759391dc3

8253019: Enhanced JPEG decoding
Reviewed-by: rhalade, mschoene, serb, psadhukhan

src/share/native/sun/awt/image/jpeg/jdhuff.c file | annotate | diff | comparison | revisions
src/share/native/sun/awt/image/jpeg/jdinput.c file | annotate | diff | comparison | revisions
src/share/native/sun/awt/image/jpeg/jdmarker.c file | annotate | diff | comparison | revisions
src/share/native/sun/awt/image/jpeg/jpeglib.h file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/native/sun/awt/image/jpeg/jdhuff.c	Thu Jul 02 12:02:08 2020 -0700
     1.2 +++ b/src/share/native/sun/awt/image/jpeg/jdhuff.c	Fri Sep 11 16:12:45 2020 +0000
     1.3 @@ -121,8 +121,7 @@
     1.4      compptr = cinfo->cur_comp_info[ci];
     1.5      /* Precalculate which table to use for each block */
     1.6      entropy->dc_cur_tbls[blkn] = entropy->dc_derived_tbls[compptr->dc_tbl_no];
     1.7 -    entropy->ac_cur_tbls[blkn] =    /* AC needs no table when not present */
     1.8 -      cinfo->lim_Se ? entropy->ac_derived_tbls[compptr->ac_tbl_no] : NULL;
     1.9 +    entropy->ac_cur_tbls[blkn] = entropy->ac_derived_tbls[compptr->ac_tbl_no];
    1.10      /* Decide whether we really care about the coefficient values */
    1.11      if (compptr->component_needed) {
    1.12        entropy->dc_needed[blkn] = TRUE;
     2.1 --- a/src/share/native/sun/awt/image/jpeg/jdinput.c	Thu Jul 02 12:02:08 2020 -0700
     2.2 +++ b/src/share/native/sun/awt/image/jpeg/jdinput.c	Fri Sep 11 16:12:45 2020 +0000
     2.3 @@ -74,39 +74,6 @@
     2.4                                     compptr->v_samp_factor);
     2.5    }
     2.6  
     2.7 -  /* Derive lim_Se */
     2.8 -  if (cinfo->is_baseline || (cinfo->progressive_mode &&
     2.9 -      cinfo->comps_in_scan)) { /* no pseudo SOS marker */
    2.10 -    cinfo->lim_Se = DCTSIZE2-1;
    2.11 -  } else {
    2.12 -    switch (cinfo->Se) {
    2.13 -    case (1*1-1):
    2.14 -    case (2*2-1):
    2.15 -    case (3*3-1):
    2.16 -    case (4*4-1):
    2.17 -    case (5*5-1):
    2.18 -    case (6*6-1):
    2.19 -    case (7*7-1):
    2.20 -         cinfo->lim_Se = cinfo->Se;
    2.21 -         break;
    2.22 -    case (8*8-1):
    2.23 -    case (9*9-1):
    2.24 -    case (10*10-1):
    2.25 -    case (11*11-1):
    2.26 -    case (12*12-1):
    2.27 -    case (13*13-1):
    2.28 -    case (14*14-1):
    2.29 -    case (15*15-1):
    2.30 -    case (16*16-1):
    2.31 -         cinfo->lim_Se = DCTSIZE2-1;
    2.32 -         break;
    2.33 -    default:
    2.34 -      ERREXIT4(cinfo, JERR_BAD_PROGRESSION,
    2.35 -               cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al);
    2.36 -      break;
    2.37 -    }
    2.38 -  }
    2.39 -
    2.40    /* We initialize DCT_scaled_size and min_DCT_scaled_size to DCTSIZE.
    2.41     * In the full decompressor, this will be overridden by jdmaster.c;
    2.42     * but in the transcoder, jdmaster.c is not used, so we must do it here.
     3.1 --- a/src/share/native/sun/awt/image/jpeg/jdmarker.c	Thu Jul 02 12:02:08 2020 -0700
     3.2 +++ b/src/share/native/sun/awt/image/jpeg/jdmarker.c	Fri Sep 11 16:12:45 2020 +0000
     3.3 @@ -238,7 +238,7 @@
     3.4  
     3.5  
     3.6  LOCAL(boolean)
     3.7 -get_sof (j_decompress_ptr cinfo, boolean is_baseline, boolean is_prog, boolean is_arith)
     3.8 +get_sof (j_decompress_ptr cinfo, boolean is_prog, boolean is_arith)
     3.9  /* Process a SOFn marker */
    3.10  {
    3.11    INT32 length;
    3.12 @@ -246,7 +246,6 @@
    3.13    jpeg_component_info * compptr;
    3.14    INPUT_VARS(cinfo);
    3.15  
    3.16 -  cinfo->is_baseline = is_baseline;
    3.17    cinfo->progressive_mode = is_prog;
    3.18    cinfo->arith_code = is_arith;
    3.19  
    3.20 @@ -999,27 +998,23 @@
    3.21        break;
    3.22  
    3.23      case M_SOF0:                /* Baseline */
    3.24 -      if (! get_sof(cinfo, TRUE, FALSE, FALSE))
    3.25 -        return JPEG_SUSPENDED;
    3.26 -      break;
    3.27 -
    3.28      case M_SOF1:                /* Extended sequential, Huffman */
    3.29 -      if (! get_sof(cinfo, FALSE, FALSE, FALSE))
    3.30 +      if (! get_sof(cinfo, FALSE, FALSE))
    3.31          return JPEG_SUSPENDED;
    3.32        break;
    3.33  
    3.34      case M_SOF2:                /* Progressive, Huffman */
    3.35 -      if (! get_sof(cinfo, FALSE, TRUE, FALSE))
    3.36 +      if (! get_sof(cinfo, TRUE, FALSE))
    3.37          return JPEG_SUSPENDED;
    3.38        break;
    3.39  
    3.40      case M_SOF9:                /* Extended sequential, arithmetic */
    3.41 -      if (! get_sof(cinfo, FALSE, FALSE, TRUE))
    3.42 +      if (! get_sof(cinfo, FALSE, TRUE))
    3.43          return JPEG_SUSPENDED;
    3.44        break;
    3.45  
    3.46      case M_SOF10:               /* Progressive, arithmetic */
    3.47 -      if (! get_sof(cinfo, FALSE, TRUE, TRUE))
    3.48 +      if (! get_sof(cinfo, TRUE, TRUE))
    3.49          return JPEG_SUSPENDED;
    3.50        break;
    3.51  
     4.1 --- a/src/share/native/sun/awt/image/jpeg/jpeglib.h	Thu Jul 02 12:02:08 2020 -0700
     4.2 +++ b/src/share/native/sun/awt/image/jpeg/jpeglib.h	Fri Sep 11 16:12:45 2020 +0000
     4.3 @@ -539,7 +539,6 @@
     4.4    jpeg_component_info * comp_info;
     4.5    /* comp_info[i] describes component that appears i'th in SOF */
     4.6  
     4.7 -  boolean is_baseline;          /* TRUE if Baseline SOF0 encountered */
     4.8    boolean progressive_mode;     /* TRUE if SOFn specifies progressive mode */
     4.9    boolean arith_code;           /* TRUE=arithmetic coding, FALSE=Huffman */
    4.10  
    4.11 @@ -612,8 +611,6 @@
    4.12  
    4.13    int Ss, Se, Ah, Al;           /* progressive JPEG parameters for scan */
    4.14  
    4.15 -  int lim_Se;                   /* min( Se, DCTSIZE2-1 ) for entropy decode */
    4.16 -
    4.17    /* This field is shared between entropy decoder and marker parser.
    4.18     * It is either zero or the code of a JPEG marker that has been
    4.19     * read from the data source, but has not yet been processed.

mercurial