Add option to split DC scans
Command line option -split-dc-scan is added to code DC scans independently (instead of interleaved). It should be determined whether this option introduces any decoder compatibility issues ( see #83 ) Option -multidcscan is renamed to -opt-dc-scan
This commit is contained in:
9
cjpeg.c
9
cjpeg.c
@@ -174,7 +174,8 @@ usage (void)
|
||||
#endif
|
||||
fprintf(stderr, " -revert Revert to standard defaults (instead of mozjpeg defaults)\n");
|
||||
fprintf(stderr, " -fastcrush Disable progressive scan optimization\n");
|
||||
fprintf(stderr, " -multidcscan Use multiple DC scans (may be incompatible with some JPEG decoders)\n");
|
||||
fprintf(stderr, " -opt-dc-scan Optimize DC scans (may be incompatible with some JPEG decoders)\n");
|
||||
fprintf(stderr, " -split-dc-scan Use one DC scan per component (may be incompatible with some JPEG decoders?)\n");
|
||||
fprintf(stderr, " -notrellis Disable trellis optimization\n");
|
||||
fprintf(stderr, " -tune-psnr Tune trellis optimization for PSNR\n");
|
||||
fprintf(stderr, " -tune-hvs-psnr Tune trellis optimization for PSNR-HVS (default)\n");
|
||||
@@ -353,7 +354,7 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv,
|
||||
lval *= 1000L;
|
||||
cinfo->mem->max_memory_to_use = lval * 1000L;
|
||||
|
||||
} else if (keymatch(arg, "multidcscan", 3)) {
|
||||
} else if (keymatch(arg, "opt-dc-scan", 6)) {
|
||||
cinfo->one_dc_scan = FALSE;
|
||||
|
||||
} else if (keymatch(arg, "optimize", 1) || keymatch(arg, "optimise", 1)) {
|
||||
@@ -479,6 +480,10 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv,
|
||||
usage();
|
||||
cinfo->smoothing_factor = val;
|
||||
|
||||
} else if (keymatch(arg, "split-dc-scans", 3)) {
|
||||
cinfo->one_dc_scan = FALSE;
|
||||
cinfo->sep_dc_scan = TRUE;
|
||||
|
||||
} else if (keymatch(arg, "targa", 1)) {
|
||||
/* Input file is Targa format. */
|
||||
is_targa = TRUE;
|
||||
|
||||
@@ -757,7 +757,7 @@ select_scans (j_compress_ptr cinfo, int next_scan_number)
|
||||
if (cinfo->num_scans > cinfo->num_scans_luma && !cinfo->one_dc_scan) {
|
||||
base_scan_idx = cinfo->num_scans_luma;
|
||||
|
||||
if (master->interleave_chroma_dc)
|
||||
if (master->interleave_chroma_dc && !cinfo->sep_dc_scan)
|
||||
copy_buffer(cinfo, base_scan_idx);
|
||||
else {
|
||||
copy_buffer(cinfo, base_scan_idx+1);
|
||||
|
||||
@@ -840,6 +840,11 @@ jpeg_simple_progression (j_compress_ptr cinfo)
|
||||
/* Initial DC scan */
|
||||
if (cinfo->one_dc_scan)
|
||||
scanptr = fill_dc_scans(scanptr, ncomps, 0, 0);
|
||||
else if (cinfo->sep_dc_scan) {
|
||||
scanptr = fill_a_scan(scanptr, 0, 0, 0, 0, 0);
|
||||
scanptr = fill_a_scan(scanptr, 1, 0, 0, 0, 0);
|
||||
scanptr = fill_a_scan(scanptr, 2, 0, 0, 0, 0);
|
||||
}
|
||||
else {
|
||||
scanptr = fill_dc_scans(scanptr, 1, 0, 0);
|
||||
scanptr = fill_a_scan_pair(scanptr, 1, 0, 0, 0, 0);
|
||||
|
||||
@@ -379,6 +379,7 @@ struct jpeg_compress_struct {
|
||||
boolean use_moz_defaults; /* TRUE=use Mozilla defaults */
|
||||
boolean optimize_scans; /* TRUE=optimize progressive coding scans */
|
||||
boolean one_dc_scan; /* TRUE=use a single DC scan interleaving all components */
|
||||
boolean sep_dc_scan; /* TRUE=each DC scan is separate */
|
||||
boolean trellis_quant; /* TRUE=use trellis quantization */
|
||||
boolean trellis_quant_dc; /* TRUE=use trellis quant for DC coefficient */
|
||||
boolean trellis_eob_opt; /* TRUE=optimize for sequences of EOB */
|
||||
|
||||
Reference in New Issue
Block a user