Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(147)

Side by Side Diff: third_party/libjpeg_turbo/djpeg.c

Issue 7554002: Updates libjpeg-turbo to 1.1.90 (r677) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/
Patch Set: '' Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « third_party/libjpeg_turbo/cjpeg.c ('k') | third_party/libjpeg_turbo/example.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * djpeg.c 2 * djpeg.c
3 * 3 *
4 * Copyright (C) 1991-1997, Thomas G. Lane. 4 * Copyright (C) 1991-1997, Thomas G. Lane.
5 * Copyright (C) 2010-2011, D. R. Commander.
5 * This file is part of the Independent JPEG Group's software. 6 * This file is part of the Independent JPEG Group's software.
6 * For conditions of distribution and use, see the accompanying README file. 7 * For conditions of distribution and use, see the accompanying README file.
7 * 8 *
8 * This file contains a command-line user interface for the JPEG decompressor. 9 * This file contains a command-line user interface for the JPEG decompressor.
9 * It should work on any system with Unix- or MS-DOS-style command lines. 10 * It should work on any system with Unix- or MS-DOS-style command lines.
10 * 11 *
11 * Two different command line styles are permitted, depending on the 12 * Two different command line styles are permitted, depending on the
12 * compile-time switch TWO_FILE_COMMANDLINE: 13 * compile-time switch TWO_FILE_COMMANDLINE:
13 * djpeg [options] inputfile outputfile 14 * djpeg [options] inputfile outputfile
14 * djpeg [options] [inputfile] 15 * djpeg [options] [inputfile]
15 * In the second style, output is always to standard output, which you'd 16 * In the second style, output is always to standard output, which you'd
16 * normally redirect to a file or pipe to some other program. Input is 17 * normally redirect to a file or pipe to some other program. Input is
17 * either from a named file or from standard input (typically redirected). 18 * either from a named file or from standard input (typically redirected).
18 * The second style is convenient on Unix but is unhelpful on systems that 19 * The second style is convenient on Unix but is unhelpful on systems that
19 * don't support pipes. Also, you MUST use the first style if your system 20 * don't support pipes. Also, you MUST use the first style if your system
20 * doesn't do binary I/O to stdin/stdout. 21 * doesn't do binary I/O to stdin/stdout.
21 * To simplify script writing, the "-outfile" switch is provided. The syntax 22 * To simplify script writing, the "-outfile" switch is provided. The syntax
22 * djpeg [options] -outfile outputfile inputfile 23 * djpeg [options] -outfile outputfile inputfile
23 * works regardless of which command line style is used. 24 * works regardless of which command line style is used.
24 */ 25 */
25 26
26 #include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ 27 #include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */
27 #include "jversion.h" /* for version message */ 28 #include "jversion.h" /* for version message */
29 #include "config.h"
28 30
29 #include <ctype.h> /* to declare isprint() */ 31 #include <ctype.h> /* to declare isprint() */
30 32
31 #ifdef USE_CCOMMAND /* command-line reader for Macintosh */ 33 #ifdef USE_CCOMMAND /* command-line reader for Macintosh */
32 #ifdef __MWERKS__ 34 #ifdef __MWERKS__
33 #include <SIOUX.h> /* Metrowerks needs this */ 35 #include <SIOUX.h> /* Metrowerks needs this */
34 #include <console.h> /* ... and this */ 36 #include <console.h> /* ... and this */
35 #endif 37 #endif
36 #ifdef THINK_C 38 #ifdef THINK_C
37 #include <console.h> /* Think declares it here */ 39 #include <console.h> /* Think declares it here */
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 #ifdef TWO_FILE_COMMANDLINE 96 #ifdef TWO_FILE_COMMANDLINE
95 fprintf(stderr, "inputfile outputfile\n"); 97 fprintf(stderr, "inputfile outputfile\n");
96 #else 98 #else
97 fprintf(stderr, "[inputfile]\n"); 99 fprintf(stderr, "[inputfile]\n");
98 #endif 100 #endif
99 101
100 fprintf(stderr, "Switches (names may be abbreviated):\n"); 102 fprintf(stderr, "Switches (names may be abbreviated):\n");
101 fprintf(stderr, " -colors N Reduce image to no more than N colors\n"); 103 fprintf(stderr, " -colors N Reduce image to no more than N colors\n");
102 fprintf(stderr, " -fast Fast, low-quality processing\n"); 104 fprintf(stderr, " -fast Fast, low-quality processing\n");
103 fprintf(stderr, " -grayscale Force grayscale output\n"); 105 fprintf(stderr, " -grayscale Force grayscale output\n");
106 fprintf(stderr, " -rgb Force RGB output\n");
104 #ifdef IDCT_SCALING_SUPPORTED 107 #ifdef IDCT_SCALING_SUPPORTED
105 fprintf(stderr, " -scale M/N Scale output image by fraction M/N, eg, 1/8\ n"); 108 fprintf(stderr, " -scale M/N Scale output image by fraction M/N, eg, 1/8\ n");
106 #endif 109 #endif
107 #ifdef BMP_SUPPORTED 110 #ifdef BMP_SUPPORTED
108 fprintf(stderr, " -bmp Select BMP output format (Windows style)%s\n ", 111 fprintf(stderr, " -bmp Select BMP output format (Windows style)%s\n ",
109 (DEFAULT_FMT == FMT_BMP ? " (default)" : "")); 112 (DEFAULT_FMT == FMT_BMP ? " (default)" : ""));
110 #endif 113 #endif
111 #ifdef GIF_SUPPORTED 114 #ifdef GIF_SUPPORTED
112 fprintf(stderr, " -gif Select GIF output format%s\n", 115 fprintf(stderr, " -gif Select GIF output format%s\n",
113 (DEFAULT_FMT == FMT_GIF ? " (default)" : "")); 116 (DEFAULT_FMT == FMT_GIF ? " (default)" : ""));
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 cinfo->dither_mode = JDITHER_ORDERED; 236 cinfo->dither_mode = JDITHER_ORDERED;
234 } else 237 } else
235 usage(); 238 usage();
236 239
237 } else if (keymatch(arg, "debug", 1) || keymatch(arg, "verbose", 1)) { 240 } else if (keymatch(arg, "debug", 1) || keymatch(arg, "verbose", 1)) {
238 /* Enable debug printouts. */ 241 /* Enable debug printouts. */
239 /* On first -d, print version identification */ 242 /* On first -d, print version identification */
240 static boolean printed_version = FALSE; 243 static boolean printed_version = FALSE;
241 244
242 if (! printed_version) { 245 if (! printed_version) {
243 » fprintf(stderr, "Independent JPEG Group's DJPEG, version %s\n%s\n", 246 » fprintf(stderr, "%s version %s (build %s)\n",
247 » » PACKAGE_NAME, VERSION, BUILD);
248 » fprintf(stderr, "%s\n\n", LJTCOPYRIGHT);
249 » fprintf(stderr, "Based on Independent JPEG Group's libjpeg, version %s\n %s\n\n",
244 JVERSION, JCOPYRIGHT); 250 JVERSION, JCOPYRIGHT);
245 printed_version = TRUE; 251 printed_version = TRUE;
246 } 252 }
247 cinfo->err->trace_level++; 253 cinfo->err->trace_level++;
248 254
249 } else if (keymatch(arg, "fast", 1)) { 255 } else if (keymatch(arg, "fast", 1)) {
250 /* Select recommended processing options for quick-and-dirty output. */ 256 /* Select recommended processing options for quick-and-dirty output. */
251 cinfo->two_pass_quantize = FALSE; 257 cinfo->two_pass_quantize = FALSE;
252 cinfo->dither_mode = JDITHER_ORDERED; 258 cinfo->dither_mode = JDITHER_ORDERED;
253 if (! cinfo->quantize_colors) /* don't override an earlier -colors */ 259 if (! cinfo->quantize_colors) /* don't override an earlier -colors */
254 cinfo->desired_number_of_colors = 216; 260 cinfo->desired_number_of_colors = 216;
255 cinfo->dct_method = JDCT_FASTEST; 261 cinfo->dct_method = JDCT_FASTEST;
256 cinfo->do_fancy_upsampling = FALSE; 262 cinfo->do_fancy_upsampling = FALSE;
257 263
258 } else if (keymatch(arg, "gif", 1)) { 264 } else if (keymatch(arg, "gif", 1)) {
259 /* GIF output format. */ 265 /* GIF output format. */
260 requested_fmt = FMT_GIF; 266 requested_fmt = FMT_GIF;
261 267
262 } else if (keymatch(arg, "grayscale", 2) || keymatch(arg, "greyscale",2)) { 268 } else if (keymatch(arg, "grayscale", 2) || keymatch(arg, "greyscale",2)) {
263 /* Force monochrome output. */ 269 /* Force monochrome output. */
264 cinfo->out_color_space = JCS_GRAYSCALE; 270 cinfo->out_color_space = JCS_GRAYSCALE;
265 271
272 } else if (keymatch(arg, "rgb", 2)) {
273 /* Force RGB output. */
274 cinfo->out_color_space = JCS_RGB;
275
266 } else if (keymatch(arg, "map", 3)) { 276 } else if (keymatch(arg, "map", 3)) {
267 /* Quantize to a color map taken from an input file. */ 277 /* Quantize to a color map taken from an input file. */
268 if (++argn >= argc) /* advance to next argument */ 278 if (++argn >= argc) /* advance to next argument */
269 usage(); 279 usage();
270 if (for_real) { /* too expensive to do twice! */ 280 if (for_real) { /* too expensive to do twice! */
271 #ifdef QUANT_2PASS_SUPPORTED /* otherwise can't quantize to supplied map */ 281 #ifdef QUANT_2PASS_SUPPORTED /* otherwise can't quantize to supplied map */
272 FILE * mapfile; 282 FILE * mapfile;
273 283
274 if ((mapfile = fopen(argv[argn], READ_BINARY)) == NULL) { 284 if ((mapfile = fopen(argv[argn], READ_BINARY)) == NULL) {
275 fprintf(stderr, "%s: can't open %s\n", progname, argv[argn]); 285 fprintf(stderr, "%s: can't open %s\n", progname, argv[argn]);
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 jpeg_create_decompress(&cinfo); 458 jpeg_create_decompress(&cinfo);
449 /* Add some application-specific error messages (from cderror.h) */ 459 /* Add some application-specific error messages (from cderror.h) */
450 jerr.addon_message_table = cdjpeg_message_table; 460 jerr.addon_message_table = cdjpeg_message_table;
451 jerr.first_addon_message = JMSG_FIRSTADDONCODE; 461 jerr.first_addon_message = JMSG_FIRSTADDONCODE;
452 jerr.last_addon_message = JMSG_LASTADDONCODE; 462 jerr.last_addon_message = JMSG_LASTADDONCODE;
453 463
454 /* Insert custom marker processor for COM and APP12. 464 /* Insert custom marker processor for COM and APP12.
455 * APP12 is used by some digital camera makers for textual info, 465 * APP12 is used by some digital camera makers for textual info,
456 * so we provide the ability to display it as text. 466 * so we provide the ability to display it as text.
457 * If you like, additional APPn marker types can be selected for display, 467 * If you like, additional APPn marker types can be selected for display,
458 * but don't try to override APP0 or APP14 this way (see libjpeg.doc). 468 * but don't try to override APP0 or APP14 this way (see libjpeg.txt).
459 */ 469 */
460 jpeg_set_marker_processor(&cinfo, JPEG_COM, print_text_marker); 470 jpeg_set_marker_processor(&cinfo, JPEG_COM, print_text_marker);
461 jpeg_set_marker_processor(&cinfo, JPEG_APP0+12, print_text_marker); 471 jpeg_set_marker_processor(&cinfo, JPEG_APP0+12, print_text_marker);
462 472
463 /* Now safe to enable signal catcher. */ 473 /* Now safe to enable signal catcher. */
464 #ifdef NEED_SIGNAL_CATCHER 474 #ifdef NEED_SIGNAL_CATCHER
465 enable_signal_catcher((j_common_ptr) &cinfo); 475 enable_signal_catcher((j_common_ptr) &cinfo);
466 #endif 476 #endif
467 477
468 /* Scan command line to find file names. */ 478 /* Scan command line to find file names. */
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 fclose(output_file); 617 fclose(output_file);
608 618
609 #ifdef PROGRESS_REPORT 619 #ifdef PROGRESS_REPORT
610 end_progress_monitor((j_common_ptr) &cinfo); 620 end_progress_monitor((j_common_ptr) &cinfo);
611 #endif 621 #endif
612 622
613 /* All done. */ 623 /* All done. */
614 exit(jerr.num_warnings ? EXIT_WARNING : EXIT_SUCCESS); 624 exit(jerr.num_warnings ? EXIT_WARNING : EXIT_SUCCESS);
615 return 0; /* suppress no-return-value warnings */ 625 return 0; /* suppress no-return-value warnings */
616 } 626 }
OLDNEW
« no previous file with comments | « third_party/libjpeg_turbo/cjpeg.c ('k') | third_party/libjpeg_turbo/example.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698