| Index: third_party/libjpeg_turbo/cjpeg.c
|
| ===================================================================
|
| --- third_party/libjpeg_turbo/cjpeg.c (revision 95020)
|
| +++ third_party/libjpeg_turbo/cjpeg.c (working copy)
|
| @@ -2,6 +2,8 @@
|
| * cjpeg.c
|
| *
|
| * Copyright (C) 1991-1998, Thomas G. Lane.
|
| + * Modified 2003-2008 by Guido Vollbeding.
|
| + * Copyright (C) 2010, D. R. Commander.
|
| * This file is part of the Independent JPEG Group's software.
|
| * For conditions of distribution and use, see the accompanying README file.
|
| *
|
| @@ -25,6 +27,7 @@
|
|
|
| #include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */
|
| #include "jversion.h" /* for version message */
|
| +#include "config.h"
|
|
|
| #ifdef USE_CCOMMAND /* command-line reader for Macintosh */
|
| #ifdef __MWERKS__
|
| @@ -149,7 +152,7 @@
|
| #endif
|
|
|
| fprintf(stderr, "Switches (names may be abbreviated):\n");
|
| - fprintf(stderr, " -quality N Compression quality (0..100; 5-95 is useful range)\n");
|
| + fprintf(stderr, " -quality N[,...] Compression quality (0..100; 5-95 is useful range)\n");
|
| fprintf(stderr, " -grayscale Create monochrome JPEG file\n");
|
| #ifdef ENTROPY_OPT_SUPPORTED
|
| fprintf(stderr, " -optimize Optimize Huffman table (smaller file, but slow compression)\n");
|
| @@ -209,21 +212,16 @@
|
| {
|
| int argn;
|
| char * arg;
|
| - int quality; /* -quality parameter */
|
| - int q_scale_factor; /* scaling percentage for -qtables */
|
| 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 */
|
|
|
| /* Set up default JPEG parameters. */
|
| - /* Note that default -quality level need not, and does not,
|
| - * match the default scaling for an explicit -qtables argument.
|
| - */
|
| - quality = 75; /* default -quality value */
|
| - q_scale_factor = 100; /* default to no scaling for -qtables */
|
| +
|
| force_baseline = FALSE; /* by default, allow 16-bit quantizers */
|
| simple_progressive = FALSE;
|
| is_targa = FALSE;
|
| @@ -277,7 +275,10 @@
|
| static boolean printed_version = FALSE;
|
|
|
| if (! printed_version) {
|
| - fprintf(stderr, "Independent JPEG Group's CJPEG, version %s\n%s\n",
|
| + fprintf(stderr, "%s version %s (build %s)\n",
|
| + PACKAGE_NAME, VERSION, BUILD);
|
| + fprintf(stderr, "%s\n\n", LJTCOPYRIGHT);
|
| + fprintf(stderr, "Based on Independent JPEG Group's libjpeg, version %s\n%s\n\n",
|
| JVERSION, JCOPYRIGHT);
|
| printed_version = TRUE;
|
| }
|
| @@ -328,13 +329,10 @@
|
| #endif
|
|
|
| } else if (keymatch(arg, "quality", 1)) {
|
| - /* Quality factor (quantization table scaling factor). */
|
| + /* Quality ratings (quantization table scaling factors). */
|
| if (++argn >= argc) /* advance to next argument */
|
| usage();
|
| - if (sscanf(argv[argn], "%d", &quality) != 1)
|
| - usage();
|
| - /* Change scale factor in case -qtables is present. */
|
| - q_scale_factor = jpeg_quality_scaling(quality);
|
| + qualityarg = argv[argn];
|
|
|
| } else if (keymatch(arg, "qslots", 2)) {
|
| /* Quantization table slot numbers. */
|
| @@ -382,7 +380,7 @@
|
| * default sampling factors.
|
| */
|
|
|
| - } else if (keymatch(arg, "scans", 2)) {
|
| + } else if (keymatch(arg, "scans", 4)) {
|
| /* Set scan script. */
|
| #ifdef C_MULTISCAN_FILES_SUPPORTED
|
| if (++argn >= argc) /* advance to next argument */
|
| @@ -422,11 +420,12 @@
|
|
|
| /* Set quantization tables for selected quality. */
|
| /* Some or all may be overridden if -qtables is present. */
|
| - jpeg_set_quality(cinfo, quality, force_baseline);
|
| + if (qualityarg != NULL) /* process -quality if it was present */
|
| + if (! set_quality_ratings(cinfo, qualityarg, force_baseline))
|
| + usage();
|
|
|
| if (qtablefile != NULL) /* process -qtables if it was present */
|
| - if (! read_quant_tables(cinfo, qtablefile,
|
| - q_scale_factor, force_baseline))
|
| + if (! read_quant_tables(cinfo, qtablefile, force_baseline))
|
| usage();
|
|
|
| if (qslotsarg != NULL) /* process -qslots if it was present */
|
|
|