aboutsummaryrefslogtreecommitdiff
path: root/cjpeg.c
diff options
context:
space:
mode:
authordcommander <dcommander@632fc199-4ca6-4c93-a231-07263d6284db>2014-05-09 18:00:32 +0000
committerdcommander <dcommander@632fc199-4ca6-4c93-a231-07263d6284db>2014-05-09 18:00:32 +0000
commitc9101fd20ef8d13e640b78335256b73212d3fbbe (patch)
tree15635e90fb161603a0e0f1308a246d7f590d1c2b /cjpeg.c
parentf5fd2d3ef36c2f5d509d51e7d34fdb1dc792556f (diff)
Convert tabs to spaces in the libjpeg code and the SIMD code (TurboJPEG retains the use of tabs for historical reasons. They were annoying in the libjpeg code primarily because they were not consistently used and because they were used to format as well as indent the code. In the case of TurboJPEG, tabs are used just to indent the code, so even if the editor assumes a different tab width, the code will still be readable.)
git-svn-id: svn://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1278 632fc199-4ca6-4c93-a231-07263d6284db
Diffstat (limited to 'cjpeg.c')
-rw-r--r--cjpeg.c174
1 files changed, 87 insertions, 87 deletions
diff --git a/cjpeg.c b/cjpeg.c
index 7f03819..4429c49 100644
--- a/cjpeg.c
+++ b/cjpeg.c
@@ -13,8 +13,8 @@
*
* Two different command line styles are permitted, depending on the
* compile-time switch TWO_FILE_COMMANDLINE:
- * cjpeg [options] inputfile outputfile
- * cjpeg [options] [inputfile]
+ * cjpeg [options] inputfile outputfile
+ * cjpeg [options] [inputfile]
* In the second style, output is always to standard output, which you'd
* normally redirect to a file or pipe to some other program. Input is
* either from a named file or from standard input (typically redirected).
@@ -22,28 +22,28 @@
* don't support pipes. Also, you MUST use the first style if your system
* doesn't do binary I/O to stdin/stdout.
* To simplify script writing, the "-outfile" switch is provided. The syntax
- * cjpeg [options] -outfile outputfile inputfile
+ * cjpeg [options] -outfile outputfile inputfile
* works regardless of which command line style is used.
*/
-#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */
-#include "jversion.h" /* for version message */
+#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */
+#include "jversion.h" /* for version message */
#include "jconfigint.h"
-#ifdef USE_CCOMMAND /* command-line reader for Macintosh */
+#ifdef USE_CCOMMAND /* command-line reader for Macintosh */
#ifdef __MWERKS__
#include <SIOUX.h> /* Metrowerks needs this */
-#include <console.h> /* ... and this */
+#include <console.h> /* ... and this */
#endif
#ifdef THINK_C
-#include <console.h> /* Think declares it here */
+#include <console.h> /* Think declares it here */
#endif
#endif
/* Create the add-on message string table. */
-#define JMESSAGE(code,string) string ,
+#define JMESSAGE(code,string) string ,
static const char * const cdjpeg_message_table[] = {
#include "cderror.h"
@@ -77,7 +77,7 @@ static const char * const cdjpeg_message_table[] = {
* seldom-used ID field), so we provide a switch to force Targa input mode.
*/
-static boolean is_targa; /* records user -targa switch */
+static boolean is_targa; /* records user -targa switch */
LOCAL(cjpeg_source_ptr)
@@ -124,7 +124,7 @@ select_file_type (j_compress_ptr cinfo, FILE * infile)
break;
}
- return NULL; /* suppress compiler warnings */
+ return NULL; /* suppress compiler warnings */
}
@@ -137,8 +137,8 @@ select_file_type (j_compress_ptr cinfo, FILE * infile)
*/
-static const char * progname; /* program name for error messages */
-static char * outfilename; /* for -outfile switch */
+static const char * progname; /* program name for error messages */
+static char * outfilename; /* for -outfile switch */
boolean memdst; /* for -memdst switch */
@@ -172,15 +172,15 @@ usage (void)
#endif
#ifdef DCT_ISLOW_SUPPORTED
fprintf(stderr, " -dct int Use integer DCT method%s\n",
- (JDCT_DEFAULT == JDCT_ISLOW ? " (default)" : ""));
+ (JDCT_DEFAULT == JDCT_ISLOW ? " (default)" : ""));
#endif
#ifdef DCT_IFAST_SUPPORTED
fprintf(stderr, " -dct fast Use fast integer DCT (less accurate)%s\n",
- (JDCT_DEFAULT == JDCT_IFAST ? " (default)" : ""));
+ (JDCT_DEFAULT == JDCT_IFAST ? " (default)" : ""));
#endif
#ifdef DCT_FLOAT_SUPPORTED
fprintf(stderr, " -dct float Use floating-point DCT method%s\n",
- (JDCT_DEFAULT == JDCT_FLOAT ? " (default)" : ""));
+ (JDCT_DEFAULT == JDCT_FLOAT ? " (default)" : ""));
#endif
fprintf(stderr, " -restart N Set restart interval in rows, or in blocks with B\n");
#ifdef INPUT_SMOOTHING_SUPPORTED
@@ -206,7 +206,7 @@ usage (void)
LOCAL(int)
parse_switches (j_compress_ptr cinfo, int argc, char **argv,
- int last_file_arg_seen, boolean for_real)
+ int last_file_arg_seen, boolean for_real)
/* Parse optional switches.
* Returns argv[] index of first file-name argument (== argc if none).
* Any file names with indexes <= last_file_arg_seen are ignored;
@@ -220,15 +220,15 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv,
char * arg;
boolean force_baseline;
boolean simple_progressive;
- char * qualityarg = NULL; /* saves -quality parm if any */
- char * qtablefile = NULL; /* saves -qtables filename if any */
- char * qslotsarg = NULL; /* saves -qslots parm if any */
- char * samplearg = NULL; /* saves -sample parm if any */
- char * scansarg = NULL; /* saves -scans parm if any */
+ char * qualityarg = NULL; /* saves -quality parm if any */
+ char * qtablefile = NULL; /* saves -qtables filename if any */
+ char * qslotsarg = NULL; /* saves -qslots parm if any */
+ char * samplearg = NULL; /* saves -sample parm if any */
+ char * scansarg = NULL; /* saves -scans parm if any */
/* Set up default JPEG parameters. */
- force_baseline = FALSE; /* by default, allow 16-bit quantizers */
+ force_baseline = FALSE; /* by default, allow 16-bit quantizers */
simple_progressive = FALSE;
is_targa = FALSE;
outfilename = NULL;
@@ -242,12 +242,12 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv,
if (*arg != '-') {
/* Not a switch, must be a file name argument */
if (argn <= last_file_arg_seen) {
- outfilename = NULL; /* -outfile applies to just one input file */
- continue; /* ignore this name if previously processed */
+ outfilename = NULL; /* -outfile applies to just one input file */
+ continue; /* ignore this name if previously processed */
}
- break; /* else done parsing switches */
+ break; /* else done parsing switches */
}
- arg++; /* advance past switch marker character */
+ arg++; /* advance past switch marker character */
if (keymatch(arg, "arithmetic", 1)) {
/* Use arithmetic coding. */
@@ -255,7 +255,7 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv,
cinfo->arith_code = TRUE;
#else
fprintf(stderr, "%s: sorry, arithmetic coding not supported\n",
- progname);
+ progname);
exit(EXIT_FAILURE);
#endif
@@ -265,16 +265,16 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv,
} else if (keymatch(arg, "dct", 2)) {
/* Select DCT algorithm. */
- if (++argn >= argc) /* advance to next argument */
- usage();
+ if (++argn >= argc) /* advance to next argument */
+ usage();
if (keymatch(argv[argn], "int", 1)) {
- cinfo->dct_method = JDCT_ISLOW;
+ cinfo->dct_method = JDCT_ISLOW;
} else if (keymatch(argv[argn], "fast", 2)) {
- cinfo->dct_method = JDCT_IFAST;
+ cinfo->dct_method = JDCT_IFAST;
} else if (keymatch(argv[argn], "float", 2)) {
- cinfo->dct_method = JDCT_FLOAT;
+ cinfo->dct_method = JDCT_FLOAT;
} else
- usage();
+ usage();
} else if (keymatch(arg, "debug", 1) || keymatch(arg, "verbose", 1)) {
/* Enable debug printouts. */
@@ -282,12 +282,12 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv,
static boolean printed_version = FALSE;
if (! printed_version) {
- fprintf(stderr, "%s version %s (build %s)\n",
- PACKAGE_NAME, VERSION, BUILD);
- fprintf(stderr, "%s\n\n", JCOPYRIGHT);
- fprintf(stderr, "Emulating The Independent JPEG Group's software, version %s\n\n",
- JVERSION);
- printed_version = TRUE;
+ fprintf(stderr, "%s version %s (build %s)\n",
+ PACKAGE_NAME, VERSION, BUILD);
+ fprintf(stderr, "%s\n\n", JCOPYRIGHT);
+ fprintf(stderr, "Emulating The Independent JPEG Group's software, version %s\n\n",
+ JVERSION);
+ printed_version = TRUE;
}
cinfo->err->trace_level++;
@@ -304,12 +304,12 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv,
long lval;
char ch = 'x';
- if (++argn >= argc) /* advance to next argument */
- usage();
+ if (++argn >= argc) /* advance to next argument */
+ usage();
if (sscanf(argv[argn], "%ld%c", &lval, &ch) < 1)
- usage();
+ usage();
if (ch == 'm' || ch == 'M')
- lval *= 1000L;
+ lval *= 1000L;
cinfo->mem->max_memory_to_use = lval * 1000L;
} else if (keymatch(arg, "optimize", 1) || keymatch(arg, "optimise", 1)) {
@@ -318,15 +318,15 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv,
cinfo->optimize_coding = TRUE;
#else
fprintf(stderr, "%s: sorry, entropy optimization was not compiled in\n",
- progname);
+ progname);
exit(EXIT_FAILURE);
#endif
} else if (keymatch(arg, "outfile", 4)) {
/* Set output file name. */
- if (++argn >= argc) /* advance to next argument */
- usage();
- outfilename = argv[argn]; /* save it away for later use */
+ if (++argn >= argc) /* advance to next argument */
+ usage();
+ outfilename = argv[argn]; /* save it away for later use */
} else if (keymatch(arg, "progressive", 1)) {
/* Select simple progressive mode. */
@@ -335,7 +335,7 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv,
/* We must postpone execution until num_components is known. */
#else
fprintf(stderr, "%s: sorry, progressive output was not compiled in\n",
- progname);
+ progname);
exit(EXIT_FAILURE);
#endif
@@ -351,14 +351,14 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv,
} else if (keymatch(arg, "quality", 1)) {
/* Quality ratings (quantization table scaling factors). */
- if (++argn >= argc) /* advance to next argument */
- usage();
+ if (++argn >= argc) /* advance to next argument */
+ usage();
qualityarg = argv[argn];
} else if (keymatch(arg, "qslots", 2)) {
/* Quantization table slot numbers. */
- if (++argn >= argc) /* advance to next argument */
- usage();
+ if (++argn >= argc) /* advance to next argument */
+ usage();
qslotsarg = argv[argn];
/* Must delay setting qslots until after we have processed any
* colorspace-determining switches, since jpeg_set_colorspace sets
@@ -367,8 +367,8 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv,
} else if (keymatch(arg, "qtables", 2)) {
/* Quantization tables fetched from file. */
- if (++argn >= argc) /* advance to next argument */
- usage();
+ if (++argn >= argc) /* advance to next argument */
+ usage();
qtablefile = argv[argn];
/* We postpone actually reading the file in case -quality comes later. */
@@ -377,24 +377,24 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv,
long lval;
char ch = 'x';
- if (++argn >= argc) /* advance to next argument */
- usage();
+ if (++argn >= argc) /* advance to next argument */
+ usage();
if (sscanf(argv[argn], "%ld%c", &lval, &ch) < 1)
- usage();
+ usage();
if (lval < 0 || lval > 65535L)
- usage();
+ usage();
if (ch == 'b' || ch == 'B') {
- cinfo->restart_interval = (unsigned int) lval;
- cinfo->restart_in_rows = 0; /* else prior '-restart n' overrides me */
+ cinfo->restart_interval = (unsigned int) lval;
+ cinfo->restart_in_rows = 0; /* else prior '-restart n' overrides me */
} else {
- cinfo->restart_in_rows = (int) lval;
- /* restart_interval will be computed during startup */
+ cinfo->restart_in_rows = (int) lval;
+ /* restart_interval will be computed during startup */
}
} else if (keymatch(arg, "sample", 2)) {
/* Set sampling factors. */
- if (++argn >= argc) /* advance to next argument */
- usage();
+ if (++argn >= argc) /* advance to next argument */
+ usage();
samplearg = argv[argn];
/* Must delay setting sample factors until after we have processed any
* colorspace-determining switches, since jpeg_set_colorspace sets
@@ -404,13 +404,13 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv,
} else if (keymatch(arg, "scans", 4)) {
/* Set scan script. */
#ifdef C_MULTISCAN_FILES_SUPPORTED
- if (++argn >= argc) /* advance to next argument */
- usage();
+ if (++argn >= argc) /* advance to next argument */
+ usage();
scansarg = argv[argn];
/* We must postpone reading the file in case -progressive appears. */
#else
fprintf(stderr, "%s: sorry, multi-scan output was not compiled in\n",
- progname);
+ progname);
exit(EXIT_FAILURE);
#endif
@@ -418,12 +418,12 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv,
/* Set input smoothing factor. */
int val;
- if (++argn >= argc) /* advance to next argument */
- usage();
+ if (++argn >= argc) /* advance to next argument */
+ usage();
if (sscanf(argv[argn], "%d", &val) != 1)
- usage();
+ usage();
if (val < 0 || val > 100)
- usage();
+ usage();
cinfo->smoothing_factor = val;
} else if (keymatch(arg, "targa", 1)) {
@@ -431,7 +431,7 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv,
is_targa = TRUE;
} else {
- usage(); /* bogus switch */
+ usage(); /* bogus switch */
}
}
@@ -441,35 +441,35 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv,
/* Set quantization tables for selected quality. */
/* Some or all may be overridden if -qtables is present. */
- if (qualityarg != NULL) /* process -quality if it was present */
+ if (qualityarg != NULL) /* process -quality if it was present */
if (! set_quality_ratings(cinfo, qualityarg, force_baseline))
- usage();
+ usage();
- if (qtablefile != NULL) /* process -qtables if it was present */
+ if (qtablefile != NULL) /* process -qtables if it was present */
if (! read_quant_tables(cinfo, qtablefile, force_baseline))
- usage();
+ usage();
- if (qslotsarg != NULL) /* process -qslots if it was present */
+ if (qslotsarg != NULL) /* process -qslots if it was present */
if (! set_quant_slots(cinfo, qslotsarg))
- usage();
+ usage();
- if (samplearg != NULL) /* process -sample if it was present */
+ if (samplearg != NULL) /* process -sample if it was present */
if (! set_sample_factors(cinfo, samplearg))
- usage();
+ usage();
#ifdef C_PROGRESSIVE_SUPPORTED
- if (simple_progressive) /* process -progressive; -scans can override */
+ if (simple_progressive) /* process -progressive; -scans can override */
jpeg_simple_progression(cinfo);
#endif
#ifdef C_MULTISCAN_FILES_SUPPORTED
- if (scansarg != NULL) /* process -scans if it was present */
+ if (scansarg != NULL) /* process -scans if it was present */
if (! read_scan_script(cinfo, scansarg))
- usage();
+ usage();
#endif
}
- return argn; /* return index of next arg (file name) */
+ return argn; /* return index of next arg (file name) */
}
@@ -500,7 +500,7 @@ main (int argc, char **argv)
progname = argv[0];
if (progname == NULL || progname[0] == 0)
- progname = "cjpeg"; /* in case C library doesn't provide it */
+ progname = "cjpeg"; /* in case C library doesn't provide it */
/* Initialize the JPEG compression object with default error handling. */
cinfo.err = jpeg_std_error(&jerr);
@@ -637,5 +637,5 @@ main (int argc, char **argv)
/* All done. */
exit(jerr.num_warnings ? EXIT_WARNING : EXIT_SUCCESS);
- return 0; /* suppress no-return-value warnings */
+ return 0; /* suppress no-return-value warnings */
}