X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2Fjpeg%2Flibijg%2Fjcmarker.c;h=fc388d579b44f0cb43cfb3cecf58558067713d4a;hb=c4220b95e9d5e902a7468e408435bf6dea4950eb;hp=6f089d573cffec3c84319f7acd19e3bdebc5bbb5;hpb=8c2e140c99ed3c497ddb53ec9fbf2708c3a1b341;p=gdcm.git diff --git a/src/jpeg/libijg/jcmarker.c b/src/jpeg/libijg/jcmarker.c index 6f089d57..fc388d57 100644 --- a/src/jpeg/libijg/jcmarker.c +++ b/src/jpeg/libijg/jcmarker.c @@ -257,8 +257,9 @@ emit_dac (j_compress_ptr cinfo) emit_byte(cinfo, cinfo->arith_ac_K[i]); } } +#else + (void)cinfo; #endif /* C_ARITH_CODING_SUPPORTED */ - cinfo = 0; } @@ -323,7 +324,7 @@ emit_sos (j_compress_ptr cinfo) emit_byte(cinfo, compptr->component_id); td = compptr->dc_tbl_no; ta = compptr->ac_tbl_no; - if (cinfo->progressive_mode) { + if (cinfo->process == JPROC_PROGRESSIVE) { /* Progressive mode: only DC or only AC tables are used in one scan; * furthermore, Huffman coding of DC refinement uses no table at all. * We emit 0 for unused field(s); this is recommended by the P&M text @@ -497,21 +498,23 @@ write_frame_header (j_compress_ptr cinfo) int ci, prec; boolean is_baseline; jpeg_component_info *compptr; - - /* Emit DQT for each quantization table. - * Note that emit_dqt() suppresses any duplicate tables. - */ + prec = 0; - for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; - ci++, compptr++) { - prec += emit_dqt(cinfo, compptr->quant_tbl_no); + if (cinfo->process != JPROC_LOSSLESS) { + /* Emit DQT for each quantization table. + * Note that emit_dqt() suppresses any duplicate tables. + */ + for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; + ci++, compptr++) { + prec += emit_dqt(cinfo, compptr->quant_tbl_no); + } + /* now prec is nonzero iff there are any 16-bit quant tables. */ } - /* now prec is nonzero iff there are any 16-bit quant tables. */ /* Check for a non-baseline specification. * Note we assume that Huffman table numbers won't be changed later. */ - if (cinfo->arith_code || cinfo->progressive_mode || + if (cinfo->arith_code || cinfo->process != JPROC_SEQUENTIAL || cinfo->data_precision != 8) { is_baseline = FALSE; } else { @@ -530,10 +533,17 @@ write_frame_header (j_compress_ptr cinfo) /* Emit the proper SOF marker */ if (cinfo->arith_code) { - emit_sof(cinfo, M_SOF9); /* SOF code for arithmetic coding */ + if (cinfo->process == JPROC_PROGRESSIVE) + emit_sof(cinfo, M_SOF10); /* SOF code for progressive arithmetic */ + else if (cinfo->process == JPROC_LOSSLESS) + emit_sof(cinfo, M_SOF11); /* SOF code for lossless arithmetic */ + else + emit_sof(cinfo, M_SOF9); /* SOF code for sequential arithmetic */ } else { - if (cinfo->progressive_mode) + if (cinfo->process == JPROC_PROGRESSIVE) emit_sof(cinfo, M_SOF2); /* SOF code for progressive Huffman */ + else if (cinfo->process == JPROC_LOSSLESS) + emit_sof(cinfo, M_SOF3); /* SOF code for lossless Huffman */ else if (is_baseline) emit_sof(cinfo, M_SOF0); /* SOF code for baseline implementation */ else @@ -567,7 +577,7 @@ write_scan_header (j_compress_ptr cinfo) */ for (i = 0; i < cinfo->comps_in_scan; i++) { compptr = cinfo->cur_comp_info[i]; - if (cinfo->progressive_mode) { + if (cinfo->process == JPROC_PROGRESSIVE) { /* Progressive mode: only DC or only AC tables are used in one scan */ if (cinfo->Ss == 0) { if (cinfo->Ah == 0) /* DC needs no table for refinement scan */ @@ -575,6 +585,9 @@ write_scan_header (j_compress_ptr cinfo) } else { emit_dht(cinfo, compptr->ac_tbl_no, TRUE); } + } else if (cinfo->process == JPROC_LOSSLESS) { + /* Lossless mode: only DC tables are used */ + emit_dht(cinfo, compptr->dc_tbl_no, FALSE); } else { /* Sequential mode: need both DC and AC tables */ emit_dht(cinfo, compptr->dc_tbl_no, FALSE);