Skip to content

Commit 3ccf487

Browse files
prraceslowhog
authored andcommitted
8253019: Enhanced JPEG decoding
Reviewed-by: rhalade, mschoene, serb, psadhukhan
1 parent cfb02d4 commit 3ccf487

File tree

4 files changed

+6
-48
lines changed

4 files changed

+6
-48
lines changed

src/java.desktop/share/native/libjavajpeg/jdhuff.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,7 @@ start_pass_huff_decoder (j_decompress_ptr cinfo)
121121
compptr = cinfo->cur_comp_info[ci];
122122
/* Precalculate which table to use for each block */
123123
entropy->dc_cur_tbls[blkn] = entropy->dc_derived_tbls[compptr->dc_tbl_no];
124-
entropy->ac_cur_tbls[blkn] = /* AC needs no table when not present */
125-
cinfo->lim_Se ? entropy->ac_derived_tbls[compptr->ac_tbl_no] : NULL;
124+
entropy->ac_cur_tbls[blkn] = entropy->ac_derived_tbls[compptr->ac_tbl_no];
126125
/* Decide whether we really care about the coefficient values */
127126
if (compptr->component_needed) {
128127
entropy->dc_needed[blkn] = TRUE;

src/java.desktop/share/native/libjavajpeg/jdinput.c

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -74,39 +74,6 @@ initial_setup (j_decompress_ptr cinfo)
7474
compptr->v_samp_factor);
7575
}
7676

77-
/* Derive lim_Se */
78-
if (cinfo->is_baseline || (cinfo->progressive_mode &&
79-
cinfo->comps_in_scan)) { /* no pseudo SOS marker */
80-
cinfo->lim_Se = DCTSIZE2-1;
81-
} else {
82-
switch (cinfo->Se) {
83-
case (1*1-1):
84-
case (2*2-1):
85-
case (3*3-1):
86-
case (4*4-1):
87-
case (5*5-1):
88-
case (6*6-1):
89-
case (7*7-1):
90-
cinfo->lim_Se = cinfo->Se;
91-
break;
92-
case (8*8-1):
93-
case (9*9-1):
94-
case (10*10-1):
95-
case (11*11-1):
96-
case (12*12-1):
97-
case (13*13-1):
98-
case (14*14-1):
99-
case (15*15-1):
100-
case (16*16-1):
101-
cinfo->lim_Se = DCTSIZE2-1;
102-
break;
103-
default:
104-
ERREXIT4(cinfo, JERR_BAD_PROGRESSION,
105-
cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al);
106-
break;
107-
}
108-
}
109-
11077
/* We initialize DCT_scaled_size and min_DCT_scaled_size to DCTSIZE.
11178
* In the full decompressor, this will be overridden by jdmaster.c;
11279
* but in the transcoder, jdmaster.c is not used, so we must do it here.

src/java.desktop/share/native/libjavajpeg/jdmarker.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -238,15 +238,14 @@ get_soi (j_decompress_ptr cinfo)
238238

239239

240240
LOCAL(boolean)
241-
get_sof (j_decompress_ptr cinfo, boolean is_baseline, boolean is_prog, boolean is_arith)
241+
get_sof (j_decompress_ptr cinfo, boolean is_prog, boolean is_arith)
242242
/* Process a SOFn marker */
243243
{
244244
INT32 length;
245245
int c, ci;
246246
jpeg_component_info * compptr;
247247
INPUT_VARS(cinfo);
248248

249-
cinfo->is_baseline = is_baseline;
250249
cinfo->progressive_mode = is_prog;
251250
cinfo->arith_code = is_arith;
252251

@@ -999,27 +998,23 @@ read_markers (j_decompress_ptr cinfo)
999998
break;
1000999

10011000
case M_SOF0: /* Baseline */
1002-
if (! get_sof(cinfo, TRUE, FALSE, FALSE))
1003-
return JPEG_SUSPENDED;
1004-
break;
1005-
10061001
case M_SOF1: /* Extended sequential, Huffman */
1007-
if (! get_sof(cinfo, FALSE, FALSE, FALSE))
1002+
if (! get_sof(cinfo, FALSE, FALSE))
10081003
return JPEG_SUSPENDED;
10091004
break;
10101005

10111006
case M_SOF2: /* Progressive, Huffman */
1012-
if (! get_sof(cinfo, FALSE, TRUE, FALSE))
1007+
if (! get_sof(cinfo, TRUE, FALSE))
10131008
return JPEG_SUSPENDED;
10141009
break;
10151010

10161011
case M_SOF9: /* Extended sequential, arithmetic */
1017-
if (! get_sof(cinfo, FALSE, FALSE, TRUE))
1012+
if (! get_sof(cinfo, FALSE, TRUE))
10181013
return JPEG_SUSPENDED;
10191014
break;
10201015

10211016
case M_SOF10: /* Progressive, arithmetic */
1022-
if (! get_sof(cinfo, FALSE, TRUE, TRUE))
1017+
if (! get_sof(cinfo, TRUE, TRUE))
10231018
return JPEG_SUSPENDED;
10241019
break;
10251020

src/java.desktop/share/native/libjavajpeg/jpeglib.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,6 @@ struct jpeg_decompress_struct {
539539
jpeg_component_info * comp_info;
540540
/* comp_info[i] describes component that appears i'th in SOF */
541541

542-
boolean is_baseline; /* TRUE if Baseline SOF0 encountered */
543542
boolean progressive_mode; /* TRUE if SOFn specifies progressive mode */
544543
boolean arith_code; /* TRUE=arithmetic coding, FALSE=Huffman */
545544

@@ -612,8 +611,6 @@ struct jpeg_decompress_struct {
612611

613612
int Ss, Se, Ah, Al; /* progressive JPEG parameters for scan */
614613

615-
int lim_Se; /* min( Se, DCTSIZE2-1 ) for entropy decode */
616-
617614
/* This field is shared between entropy decoder and marker parser.
618615
* It is either zero or the code of a JPEG marker that has been
619616
* read from the data source, but has not yet been processed.

0 commit comments

Comments
 (0)