summaryrefslogtreecommitdiff
path: root/cjpeg.c
diff options
context:
space:
mode:
Diffstat (limited to 'cjpeg.c')
-rw-r--r--cjpeg.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/cjpeg.c b/cjpeg.c
index e80d16b..1c2d632 100644
--- a/cjpeg.c
+++ b/cjpeg.c
@@ -5,7 +5,7 @@
* Copyright (C) 1991-1998, Thomas G. Lane.
* Modified 2003-2011 by Guido Vollbeding.
* libjpeg-turbo Modifications:
- * Copyright (C) 2010, 2013-2014, 2017, D. R. Commander.
+ * Copyright (C) 2010, 2013-2014, 2017, 2019-2020, D. R. Commander.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
*
@@ -69,9 +69,9 @@ static const char * const cdjpeg_message_table[] = {
* 2) assume we can push back more than one character (works in
* some C implementations, but unportable);
* 3) provide our own buffering (breaks input readers that want to use
- * stdio directly, such as the RLE library);
+ * stdio directly);
* or 4) don't put back the data, and modify the input_init methods to assume
- * they start reading after the start of file (also breaks RLE library).
+ * they start reading after the start of file.
* #1 is attractive for MS-DOS but is untenable on Unix.
*
* The most portable solution for file types that can't be identified by their
@@ -117,10 +117,6 @@ select_file_type(j_compress_ptr cinfo, FILE *infile)
case 'P':
return jinit_read_ppm(cinfo);
#endif
-#ifdef RLE_SUPPORTED
- case 'R':
- return jinit_read_rle(cinfo);
-#endif
#ifdef TARGA_SUPPORTED
case 0x00:
return jinit_read_targa(cinfo);
@@ -146,7 +142,8 @@ select_file_type(j_compress_ptr cinfo, FILE *infile)
static const char *progname; /* program name for error messages */
static char *icc_filename; /* for -icc switch */
static char *outfilename; /* for -outfile switch */
-boolean memdst; /* for -memdst switch */
+static boolean memdst; /* for -memdst switch */
+static boolean report; /* for -report switch */
LOCAL(void)
@@ -179,15 +176,15 @@ usage(void)
fprintf(stderr, " -arithmetic Use arithmetic coding\n");
#endif
#ifdef DCT_ISLOW_SUPPORTED
- fprintf(stderr, " -dct int Use integer DCT method%s\n",
+ fprintf(stderr, " -dct int Use accurate integer DCT method%s\n",
(JDCT_DEFAULT == JDCT_ISLOW ? " (default)" : ""));
#endif
#ifdef DCT_IFAST_SUPPORTED
- fprintf(stderr, " -dct fast Use fast integer DCT (less accurate)%s\n",
+ fprintf(stderr, " -dct fast Use less accurate integer DCT method [legacy feature]%s\n",
(JDCT_DEFAULT == JDCT_IFAST ? " (default)" : ""));
#endif
#ifdef DCT_FLOAT_SUPPORTED
- fprintf(stderr, " -dct float Use floating-point DCT method%s\n",
+ fprintf(stderr, " -dct float Use floating-point DCT method [legacy feature]%s\n",
(JDCT_DEFAULT == JDCT_FLOAT ? " (default)" : ""));
#endif
fprintf(stderr, " -icc FILE Embed ICC profile contained in FILE\n");
@@ -200,6 +197,7 @@ usage(void)
#if JPEG_LIB_VERSION >= 80 || defined(MEM_SRCDST_SUPPORTED)
fprintf(stderr, " -memdst Compress to memory instead of file (useful for benchmarking)\n");
#endif
+ fprintf(stderr, " -report Report compression progress\n");
fprintf(stderr, " -verbose or -debug Emit debug output\n");
fprintf(stderr, " -version Print version information and exit\n");
fprintf(stderr, "Switches for wizards:\n");
@@ -244,6 +242,7 @@ parse_switches(j_compress_ptr cinfo, int argc, char **argv,
icc_filename = NULL;
outfilename = NULL;
memdst = FALSE;
+ report = FALSE;
cinfo->err->trace_level = 0;
/* Scan command line options, adjust parameters */
@@ -395,6 +394,9 @@ parse_switches(j_compress_ptr cinfo, int argc, char **argv,
qtablefile = argv[argn];
/* We postpone actually reading the file in case -quality comes later. */
+ } else if (keymatch(arg, "report", 3)) {
+ report = TRUE;
+
} else if (keymatch(arg, "restart", 1)) {
/* Restart interval in MCU rows (or in MCUs with 'b'). */
long lval;
@@ -509,9 +511,7 @@ main(int argc, char **argv)
{
struct jpeg_compress_struct cinfo;
struct jpeg_error_mgr jerr;
-#ifdef PROGRESS_REPORT
struct cdjpeg_progress_mgr progress;
-#endif
int file_index;
cjpeg_source_ptr src_mgr;
FILE *input_file;
@@ -632,9 +632,10 @@ main(int argc, char **argv)
fclose(icc_file);
}
-#ifdef PROGRESS_REPORT
- start_progress_monitor((j_common_ptr)&cinfo, &progress);
-#endif
+ if (report) {
+ start_progress_monitor((j_common_ptr)&cinfo, &progress);
+ progress.report = report;
+ }
/* Figure out the input file format, and set up to read it. */
src_mgr = select_file_type(&cinfo, input_file);
@@ -680,9 +681,8 @@ main(int argc, char **argv)
if (output_file != stdout && output_file != NULL)
fclose(output_file);
-#ifdef PROGRESS_REPORT
- end_progress_monitor((j_common_ptr)&cinfo);
-#endif
+ if (report)
+ end_progress_monitor((j_common_ptr)&cinfo);
if (memdst) {
fprintf(stderr, "Compressed size: %lu bytes\n", outsize);