summaryrefslogtreecommitdiff
path: root/cjpeg.c
diff options
context:
space:
mode:
authorhbono@chromium.org <hbono@chromium.org@4ff67af0-8c30-449e-8e8b-ad334ec8d88c>2011-08-03 03:13:08 +0000
committerhbono@chromium.org <hbono@chromium.org@4ff67af0-8c30-449e-8e8b-ad334ec8d88c>2011-08-03 03:13:08 +0000
commit9862697206250265c6bb37a4186b0a411c78de3b (patch)
tree1713b1df6c111f7d47cceb3cf138e7584ac764d0 /cjpeg.c
parent0758f15d76566a0504857c18bdce8530074f816a (diff)
Updates libjpeg-turbo to 1.1.90
This change updates our copy of libjpeg-turbo to 1.1.90 (r677), which supports ARM NEON. BUG=none TEST=none Review URL: http://codereview.chromium.org/7554002 git-svn-id: http://src.chromium.org/svn/trunk/deps/third_party/libjpeg_turbo@95196 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
Diffstat (limited to 'cjpeg.c')
-rw-r--r--cjpeg.c35
1 files changed, 17 insertions, 18 deletions
diff --git a/cjpeg.c b/cjpeg.c
index f2a929f..3daa259 100644
--- a/cjpeg.c
+++ b/cjpeg.c
@@ -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 @@ usage (void)
#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 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv,
{
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 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv,
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 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv,
#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 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv,
* 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 @@ 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. */
- 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 */