cjpeg option for baseline quant tables
Add command line option -quant-baseline to cjpeg to force quantization table entries to be in 1-255 range for JPEG baseline compatibility. See related discussion in #145
This commit is contained in:
7
cjpeg.c
7
cjpeg.c
@@ -207,6 +207,7 @@ usage (void)
|
|||||||
fprintf(stderr, " -dct float Use floating-point DCT method%s\n",
|
fprintf(stderr, " -dct float Use floating-point DCT method%s\n",
|
||||||
(JDCT_DEFAULT == JDCT_FLOAT ? " (default)" : ""));
|
(JDCT_DEFAULT == JDCT_FLOAT ? " (default)" : ""));
|
||||||
#endif
|
#endif
|
||||||
|
fprintf(stderr, " -quant-baseline Use 8-bit quantization table entries for baseline JPEG compatibility\n");
|
||||||
fprintf(stderr, " -quant-table N Use predefined quantization table N:\n");
|
fprintf(stderr, " -quant-table N Use predefined quantization table N:\n");
|
||||||
fprintf(stderr, " - 0 JPEG Annex K\n");
|
fprintf(stderr, " - 0 JPEG Annex K\n");
|
||||||
fprintf(stderr, " - 1 Flat\n");
|
fprintf(stderr, " - 1 Flat\n");
|
||||||
@@ -450,7 +451,7 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv,
|
|||||||
qtablefile = argv[argn];
|
qtablefile = argv[argn];
|
||||||
/* We postpone actually reading the file in case -quality comes later. */
|
/* We postpone actually reading the file in case -quality comes later. */
|
||||||
|
|
||||||
} else if (keymatch(arg, "quant-table", 2)) {
|
} else if (keymatch(arg, "quant-table", 7)) {
|
||||||
int val;
|
int val;
|
||||||
if (++argn >= argc) /* advance to next argument */
|
if (++argn >= argc) /* advance to next argument */
|
||||||
usage();
|
usage();
|
||||||
@@ -462,6 +463,10 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv,
|
|||||||
}
|
}
|
||||||
jpeg_set_quality(cinfo, 75, TRUE);
|
jpeg_set_quality(cinfo, 75, TRUE);
|
||||||
|
|
||||||
|
} else if (keymatch(arg, "quant-baseline", 7)) {
|
||||||
|
/* Force quantization table to meet baseline requirements */
|
||||||
|
force_baseline = TRUE;
|
||||||
|
|
||||||
} else if (keymatch(arg, "restart", 1)) {
|
} else if (keymatch(arg, "restart", 1)) {
|
||||||
/* Restart interval in MCU rows (or in MCUs with 'b'). */
|
/* Restart interval in MCU rows (or in MCUs with 'b'). */
|
||||||
long lval;
|
long lval;
|
||||||
|
|||||||
Reference in New Issue
Block a user