ReactOS  0.4.14-dev-358-gbef841c
cjpeg.c File Reference
#include "cdjpeg.h"
#include "jversion.h"
#include "cderror.h"
Include dependency graph for cjpeg.c:

Go to the source code of this file.

Macros

#define JMESSAGE(code, string)   string ,
 

Functions

 select_file_type (j_compress_ptr cinfo, FILE *infile)
 
 usage (void)
 
 parse_switches (j_compress_ptr cinfo, int argc, char **argv, int last_file_arg_seen, boolean for_real)
 
int main (int argc, char **argv)
 

Variables

static const char *const cdjpeg_message_table []
 
static boolean is_targa
 
static const charprogname
 
static charoutfilename
 

Macro Definition Documentation

◆ JMESSAGE

#define JMESSAGE (   code,
  string 
)    string ,

Definition at line 43 of file cjpeg.c.

Function Documentation

◆ main()

int main ( int argc  ,
char **  argv 
)

Definition at line 519 of file cjpeg.c.

520 {
521  struct jpeg_compress_struct cinfo;
522  struct jpeg_error_mgr jerr;
523 #ifdef PROGRESS_REPORT
525 #endif
526  int file_index;
527  cjpeg_source_ptr src_mgr;
528  FILE * input_file;
529  FILE * output_file;
530  JDIMENSION num_scanlines;
531 
532  /* On Mac, fetch a command line. */
533 #ifdef USE_CCOMMAND
534  argc = ccommand(&argv);
535 #endif
536 
537  progname = argv[0];
538  if (progname == NULL || progname[0] == 0)
539  progname = "cjpeg"; /* in case C library doesn't provide it */
540 
541  /* Initialize the JPEG compression object with default error handling. */
542  cinfo.err = jpeg_std_error(&jerr);
543  jpeg_create_compress(&cinfo);
544  /* Add some application-specific error messages (from cderror.h) */
545  jerr.addon_message_table = cdjpeg_message_table;
546  jerr.first_addon_message = JMSG_FIRSTADDONCODE;
547  jerr.last_addon_message = JMSG_LASTADDONCODE;
548 
549  /* Now safe to enable signal catcher. */
550 #ifdef NEED_SIGNAL_CATCHER
551  enable_signal_catcher((j_common_ptr) &cinfo);
552 #endif
553 
554  /* Initialize JPEG parameters.
555  * Much of this may be overridden later.
556  * In particular, we don't yet know the input file's color space,
557  * but we need to provide some value for jpeg_set_defaults() to work.
558  */
559 
560  cinfo.in_color_space = JCS_RGB; /* arbitrary guess */
561  jpeg_set_defaults(&cinfo);
562 
563  /* Scan command line to find file names.
564  * It is convenient to use just one switch-parsing routine, but the switch
565  * values read here are ignored; we will rescan the switches after opening
566  * the input file.
567  */
568 
569  file_index = parse_switches(&cinfo, argc, argv, 0, FALSE);
570 
571 #ifdef TWO_FILE_COMMANDLINE
572  /* Must have either -outfile switch or explicit output file name */
573  if (outfilename == NULL) {
574  if (file_index != argc-2) {
575  fprintf(stderr, "%s: must name one input and one output file\n",
576  progname);
577  usage();
578  }
579  outfilename = argv[file_index+1];
580  } else {
581  if (file_index != argc-1) {
582  fprintf(stderr, "%s: must name one input and one output file\n",
583  progname);
584  usage();
585  }
586  }
587 #else
588  /* Unix style: expect zero or one file name */
589  if (file_index < argc-1) {
590  fprintf(stderr, "%s: only one input file\n", progname);
591  usage();
592  }
593 #endif /* TWO_FILE_COMMANDLINE */
594 
595  /* Open the input file. */
596  if (file_index < argc) {
597  if ((input_file = fopen(argv[file_index], READ_BINARY)) == NULL) {
598  fprintf(stderr, "%s: can't open %s\n", progname, argv[file_index]);
600  }
601  } else {
602  /* default input file is stdin */
603  input_file = read_stdin();
604  }
605 
606  /* Open the output file. */
607  if (outfilename != NULL) {
608  if ((output_file = fopen(outfilename, WRITE_BINARY)) == NULL) {
609  fprintf(stderr, "%s: can't open %s\n", progname, outfilename);
611  }
612  } else {
613  /* default output file is stdout */
614  output_file = write_stdout();
615  }
616 
617 #ifdef PROGRESS_REPORT
618  start_progress_monitor((j_common_ptr) &cinfo, &progress);
619 #endif
620 
621  /* Figure out the input file format, and set up to read it. */
622  src_mgr = select_file_type(&cinfo, input_file);
623  src_mgr->input_file = input_file;
624 
625  /* Read the input file header to obtain file size & colorspace. */
626  (*src_mgr->start_input) (&cinfo, src_mgr);
627 
628  /* Now that we know input colorspace, fix colorspace-dependent defaults */
629  jpeg_default_colorspace(&cinfo);
630 
631  /* Adjust default compression parameters by re-parsing the options */
632  file_index = parse_switches(&cinfo, argc, argv, 0, TRUE);
633 
634  /* Specify data destination for compression */
635  jpeg_stdio_dest(&cinfo, output_file);
636 
637  /* Start compressor */
638  jpeg_start_compress(&cinfo, TRUE);
639 
640  /* Process data */
641  while (cinfo.next_scanline < cinfo.image_height) {
642  num_scanlines = (*src_mgr->get_pixel_rows) (&cinfo, src_mgr);
643  (void) jpeg_write_scanlines(&cinfo, src_mgr->buffer, num_scanlines);
644  }
645 
646  /* Finish compression and release memory */
647  (*src_mgr->finish_input) (&cinfo, src_mgr);
648  jpeg_finish_compress(&cinfo);
649  jpeg_destroy_compress(&cinfo);
650 
651  /* Close files, if we opened them */
652  if (input_file != stdin)
653  fclose(input_file);
654  if (output_file != stdout)
655  fclose(output_file);
656 
657 #ifdef PROGRESS_REPORT
658  end_progress_monitor((j_common_ptr) &cinfo);
659 #endif
660 
661  /* All done. */
662  exit(jerr.num_warnings ? EXIT_WARNING : EXIT_SUCCESS);
663  return 0; /* suppress no-return-value warnings */
664 }
#define READ_BINARY
Definition: jmemdos.c:77
jpeg_default_colorspace(j_compress_ptr cinfo)
Definition: jcparam.c:386
static int argc
Definition: ServiceArgs.c:12
#define TRUE
Definition: types.h:120
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
jpeg_finish_compress(j_compress_ptr cinfo)
Definition: jcapimin.c:155
static char * outfilename
Definition: cjpeg.c:138
jpeg_destroy_compress(j_compress_ptr cinfo)
Definition: jcapimin.c:96
FILE * stdin
#define argv
Definition: mplay32.c:18
jpeg_stdio_dest(j_compress_ptr cinfo, FILE *outfile)
Definition: jdatadst.c:196
FILE * stdout
read_stdin(void)
Definition: cdjpeg.c:149
jpeg_start_compress(j_compress_ptr cinfo, boolean write_all_tables)
Definition: jcapistd.c:39
static const char * progname
Definition: cjpeg.c:137
#define EXIT_SUCCESS
Definition: rdjpgcom.c:55
select_file_type(j_compress_ptr cinfo, FILE *infile)
Definition: cjpeg.c:81
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
#define EXIT_WARNING
Definition: cdjpeg.h:185
parse_switches(j_compress_ptr cinfo, int argc, char **argv, int last_file_arg_seen, boolean for_real)
Definition: cjpeg.c:212
smooth NULL
Definition: ftsmooth.c:416
jpeg_write_scanlines(j_compress_ptr cinfo, JSAMPARRAY scanlines, JDIMENSION num_lines)
Definition: jcapistd.c:78
static const char *const cdjpeg_message_table[]
Definition: cjpeg.c:45
#define EXIT_FAILURE
Definition: jerror.c:33
JSAMPARRAY buffer
Definition: cdjpeg.h:36
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)
_Check_return_ _CRTIMP FILE *__cdecl fopen(_In_z_ const char *_Filename, _In_z_ const char *_Mode)
#define WRITE_BINARY
Definition: wrjpgcom.c:47
FILE * input_file
Definition: cdjpeg.h:34
#define jpeg_create_compress(cinfo)
Definition: jpeglib.h:958
usage(void)
Definition: cjpeg.c:142
cd_progress_ptr progress
Definition: cdjpeg.h:150
write_stdout(void)
Definition: cdjpeg.c:167
jpeg_set_defaults(j_compress_ptr cinfo)
Definition: jcparam.c:285
jpeg_std_error(struct jpeg_error_mgr *err)
Definition: jerror.c:232
unsigned int JDIMENSION
Definition: jmorecfg.h:229
FILE * stderr
void exit(int exitcode)
Definition: _exit.c:33

◆ parse_switches()

parse_switches ( j_compress_ptr  cinfo,
int  argc,
char **  argv,
int  last_file_arg_seen,
boolean  for_real 
)

Definition at line 212 of file cjpeg.c.

222 {
223  int argn;
224  char * arg;
225  boolean force_baseline;
226  boolean simple_progressive;
227  char * qualityarg = NULL; /* saves -quality parm if any */
228  char * qtablefile = NULL; /* saves -qtables filename if any */
229  char * qslotsarg = NULL; /* saves -qslots parm if any */
230  char * samplearg = NULL; /* saves -sample parm if any */
231  char * scansarg = NULL; /* saves -scans parm if any */
232 
233  /* Set up default JPEG parameters. */
234 
235  force_baseline = FALSE; /* by default, allow 16-bit quantizers */
236  simple_progressive = FALSE;
237  is_targa = FALSE;
238  outfilename = NULL;
239  cinfo->err->trace_level = 0;
240 
241  /* Scan command line options, adjust parameters */
242 
243  for (argn = 1; argn < argc; argn++) {
244  arg = argv[argn];
245  if (*arg != '-') {
246  /* Not a switch, must be a file name argument */
247  if (argn <= last_file_arg_seen) {
248  outfilename = NULL; /* -outfile applies to just one input file */
249  continue; /* ignore this name if previously processed */
250  }
251  break; /* else done parsing switches */
252  }
253  arg++; /* advance past switch marker character */
254 
255  if (keymatch(arg, "arithmetic", 1)) {
256  /* Use arithmetic coding. */
257 #ifdef C_ARITH_CODING_SUPPORTED
258  cinfo->arith_code = TRUE;
259 #else
260  fprintf(stderr, "%s: sorry, arithmetic coding not supported\n",
261  progname);
263 #endif
264 
265  } else if (keymatch(arg, "baseline", 2)) {
266  /* Force baseline-compatible output (8-bit quantizer values). */
268 
269  } else if (keymatch(arg, "block", 2)) {
270  /* Set DCT block size. */
271 #if defined DCT_SCALING_SUPPORTED && JPEG_LIB_VERSION_MAJOR >= 8 && \
272  (JPEG_LIB_VERSION_MAJOR > 8 || JPEG_LIB_VERSION_MINOR >= 3)
273  int val;
274 
275  if (++argn >= argc) /* advance to next argument */
276  usage();
277  if (sscanf(argv[argn], "%d", &val) != 1)
278  usage();
279  if (val < 1 || val > 16)
280  usage();
281  cinfo->block_size = val;
282 #else
283  fprintf(stderr, "%s: sorry, block size setting not supported\n",
284  progname);
286 #endif
287 
288  } else if (keymatch(arg, "dct", 2)) {
289  /* Select DCT algorithm. */
290  if (++argn >= argc) /* advance to next argument */
291  usage();
292  if (keymatch(argv[argn], "int", 1)) {
293  cinfo->dct_method = JDCT_ISLOW;
294  } else if (keymatch(argv[argn], "fast", 2)) {
295  cinfo->dct_method = JDCT_IFAST;
296  } else if (keymatch(argv[argn], "float", 2)) {
297  cinfo->dct_method = JDCT_FLOAT;
298  } else
299  usage();
300 
301  } else if (keymatch(arg, "debug", 1) || keymatch(arg, "verbose", 1)) {
302  /* Enable debug printouts. */
303  /* On first -d, print version identification */
304  static boolean printed_version = FALSE;
305 
306  if (! printed_version) {
307  fprintf(stderr, "Independent JPEG Group's CJPEG, version %s\n%s\n",
309  printed_version = TRUE;
310  }
311  cinfo->err->trace_level++;
312 
313  } else if (keymatch(arg, "grayscale", 2) || keymatch(arg, "greyscale",2)) {
314  /* Force a monochrome JPEG file to be generated. */
316 
317  } else if (keymatch(arg, "rgb", 3) || keymatch(arg, "rgb1", 4)) {
318  /* Force an RGB JPEG file to be generated. */
319 #if JPEG_LIB_VERSION_MAJOR >= 9
320  /* Note: Entropy table assignment in jpeg_set_colorspace depends
321  * on color_transform.
322  */
324 #endif
326 
327  } else if (keymatch(arg, "bgycc", 5)) {
328  /* Force a big gamut YCC JPEG file to be generated. */
329 #if JPEG_LIB_VERSION_MAJOR >= 9 && \
330  (JPEG_LIB_VERSION_MAJOR > 9 || JPEG_LIB_VERSION_MINOR >= 1)
332 #else
333  fprintf(stderr, "%s: sorry, BG_YCC colorspace not supported\n",
334  progname);
336 #endif
337 
338  } else if (keymatch(arg, "maxmemory", 3)) {
339  /* Maximum memory in Kb (or Mb with 'm'). */
340  long lval;
341  char ch = 'x';
342 
343  if (++argn >= argc) /* advance to next argument */
344  usage();
345  if (sscanf(argv[argn], "%ld%c", &lval, &ch) < 1)
346  usage();
347  if (ch == 'm' || ch == 'M')
348  lval *= 1000L;
349  cinfo->mem->max_memory_to_use = lval * 1000L;
350 
351  } else if (keymatch(arg, "nosmooth", 3)) {
352  /* Suppress fancy downsampling. */
353  cinfo->do_fancy_downsampling = FALSE;
354 
355  } else if (keymatch(arg, "optimize", 1) || keymatch(arg, "optimise", 1)) {
356  /* Enable entropy parm optimization. */
357 #ifdef ENTROPY_OPT_SUPPORTED
358  cinfo->optimize_coding = TRUE;
359 #else
360  fprintf(stderr, "%s: sorry, entropy optimization was not compiled\n",
361  progname);
363 #endif
364 
365  } else if (keymatch(arg, "outfile", 4)) {
366  /* Set output file name. */
367  if (++argn >= argc) /* advance to next argument */
368  usage();
369  outfilename = argv[argn]; /* save it away for later use */
370 
371  } else if (keymatch(arg, "progressive", 1)) {
372  /* Select simple progressive mode. */
373 #ifdef C_PROGRESSIVE_SUPPORTED
374  simple_progressive = TRUE;
375  /* We must postpone execution until num_components is known. */
376 #else
377  fprintf(stderr, "%s: sorry, progressive output was not compiled\n",
378  progname);
380 #endif
381 
382  } else if (keymatch(arg, "quality", 1)) {
383  /* Quality ratings (quantization table scaling factors). */
384  if (++argn >= argc) /* advance to next argument */
385  usage();
386  qualityarg = argv[argn];
387 
388  } else if (keymatch(arg, "qslots", 2)) {
389  /* Quantization table slot numbers. */
390  if (++argn >= argc) /* advance to next argument */
391  usage();
392  qslotsarg = argv[argn];
393  /* Must delay setting qslots until after we have processed any
394  * colorspace-determining switches, since jpeg_set_colorspace sets
395  * default quant table numbers.
396  */
397 
398  } else if (keymatch(arg, "qtables", 2)) {
399  /* Quantization tables fetched from file. */
400  if (++argn >= argc) /* advance to next argument */
401  usage();
402  qtablefile = argv[argn];
403  /* We postpone actually reading the file in case -quality comes later. */
404 
405  } else if (keymatch(arg, "restart", 1)) {
406  /* Restart interval in MCU rows (or in MCUs with 'b'). */
407  long lval;
408  char ch = 'x';
409 
410  if (++argn >= argc) /* advance to next argument */
411  usage();
412  if (sscanf(argv[argn], "%ld%c", &lval, &ch) < 1)
413  usage();
414  if (lval < 0 || lval > 65535L)
415  usage();
416  if (ch == 'b' || ch == 'B') {
417  cinfo->restart_interval = (unsigned int) lval;
418  cinfo->restart_in_rows = 0; /* else prior '-restart n' overrides me */
419  } else {
420  cinfo->restart_in_rows = (int) lval;
421  /* restart_interval will be computed during startup */
422  }
423 
424  } else if (keymatch(arg, "sample", 2)) {
425  /* Set sampling factors. */
426  if (++argn >= argc) /* advance to next argument */
427  usage();
428  samplearg = argv[argn];
429  /* Must delay setting sample factors until after we have processed any
430  * colorspace-determining switches, since jpeg_set_colorspace sets
431  * default sampling factors.
432  */
433 
434  } else if (keymatch(arg, "scale", 4)) {
435  /* Scale the image by a fraction M/N. */
436  if (++argn >= argc) /* advance to next argument */
437  usage();
438  if (sscanf(argv[argn], "%u/%u",
439  &cinfo->scale_num, &cinfo->scale_denom) != 2)
440  usage();
441 
442  } else if (keymatch(arg, "scans", 4)) {
443  /* Set scan script. */
444 #ifdef C_MULTISCAN_FILES_SUPPORTED
445  if (++argn >= argc) /* advance to next argument */
446  usage();
447  scansarg = argv[argn];
448  /* We must postpone reading the file in case -progressive appears. */
449 #else
450  fprintf(stderr, "%s: sorry, multi-scan output was not compiled\n",
451  progname);
453 #endif
454 
455  } else if (keymatch(arg, "smooth", 2)) {
456  /* Set input smoothing factor. */
457  int val;
458 
459  if (++argn >= argc) /* advance to next argument */
460  usage();
461  if (sscanf(argv[argn], "%d", &val) != 1)
462  usage();
463  if (val < 0 || val > 100)
464  usage();
465  cinfo->smoothing_factor = val;
466 
467  } else if (keymatch(arg, "targa", 1)) {
468  /* Input file is Targa format. */
469  is_targa = TRUE;
470 
471  } else {
472  usage(); /* bogus switch */
473  }
474  }
475 
476  /* Post-switch-scanning cleanup */
477 
478  if (for_real) {
479 
480  /* Set quantization tables for selected quality. */
481  /* Some or all may be overridden if -qtables is present. */
482  if (qualityarg != NULL) /* process -quality if it was present */
483  if (! set_quality_ratings(cinfo, qualityarg, force_baseline))
484  usage();
485 
486  if (qtablefile != NULL) /* process -qtables if it was present */
487  if (! read_quant_tables(cinfo, qtablefile, force_baseline))
488  usage();
489 
490  if (qslotsarg != NULL) /* process -qslots if it was present */
491  if (! set_quant_slots(cinfo, qslotsarg))
492  usage();
493 
494  if (samplearg != NULL) /* process -sample if it was present */
495  if (! set_sample_factors(cinfo, samplearg))
496  usage();
497 
498 #ifdef C_PROGRESSIVE_SUPPORTED
499  if (simple_progressive) /* process -progressive; -scans can override */
500  jpeg_simple_progression(cinfo);
501 #endif
502 
503 #ifdef C_MULTISCAN_FILES_SUPPORTED
504  if (scansarg != NULL) /* process -scans if it was present */
505  if (! read_scan_script(cinfo, scansarg))
506  usage();
507 #endif
508  }
509 
510  return argn; /* return index of next arg (file name) */
511 }
set_quality_ratings(j_compress_ptr cinfo, char *arg, boolean force_baseline)
Definition: rdswitch.c:268
char boolean force_baseline
Definition: cdjpeg.h:134
static int argc
Definition: ServiceArgs.c:12
J_COLOR_TRANSFORM color_transform
Definition: jpeglib.h:387
#define TRUE
Definition: types.h:120
read_quant_tables(j_compress_ptr cinfo, char *filename, boolean force_baseline)
Definition: rdswitch.c:75
static char * outfilename
Definition: cjpeg.c:138
void * arg
Definition: msvc.h:12
#define argv
Definition: mplay32.c:18
static const char * progname
Definition: cjpeg.c:137
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
#define JCOPYRIGHT
Definition: jversion.h:14
smooth NULL
Definition: ftsmooth.c:416
_Check_return_ _CRTIMP int __cdecl sscanf(_In_z_ const char *_Src, _In_z_ _Scanf_format_string_ const char *_Format,...)
set_sample_factors(j_compress_ptr cinfo, char *arg)
Definition: rdswitch.c:335
keymatch(char *arg, const char *keyword, int minchars)
Definition: cdjpeg.c:122
unsigned int scale_denom
Definition: jpeglib.h:317
GLuint GLfloat * val
Definition: glext.h:7180
static boolean is_targa
Definition: cjpeg.c:77
#define EXIT_FAILURE
Definition: jerror.c:33
unsigned int restart_interval
Definition: jpeglib.h:370
static const WCHAR L[]
Definition: oid.c:1250
boolean arith_code
Definition: jpeglib.h:358
boolean do_fancy_downsampling
Definition: jpeglib.h:361
jpeg_set_colorspace(j_compress_ptr cinfo, J_COLOR_SPACE colorspace)
Definition: jcparam.c:425
unsigned int scale_num
Definition: jpeglib.h:317
J_DCT_METHOD dct_method
Definition: jpeglib.h:363
boolean optimize_coding
Definition: jpeglib.h:359
usage(void)
Definition: cjpeg.c:142
set_quant_slots(j_compress_ptr cinfo, char *arg)
Definition: rdswitch.c:300
FILE * stderr
void exit(int exitcode)
Definition: _exit.c:33
#define JVERSION
Definition: jversion.h:12
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31

Referenced by main().

◆ select_file_type()

select_file_type ( j_compress_ptr  cinfo,
FILE infile 
)

Definition at line 81 of file cjpeg.c.

82 {
83  int c;
84 
85  if (is_targa) {
86 #ifdef TARGA_SUPPORTED
87  return jinit_read_targa(cinfo);
88 #else
89  ERREXIT(cinfo, JERR_TGA_NOTCOMP);
90 #endif
91  }
92 
93  if ((c = getc(infile)) == EOF)
94  ERREXIT(cinfo, JERR_INPUT_EMPTY);
95  if (ungetc(c, infile) == EOF)
96  ERREXIT(cinfo, JERR_UNGETC_FAILED);
97 
98  switch (c) {
99 #ifdef BMP_SUPPORTED
100  case 'B':
101  return jinit_read_bmp(cinfo);
102 #endif
103 #ifdef GIF_SUPPORTED
104  case 'G':
105  return jinit_read_gif(cinfo);
106 #endif
107 #ifdef PPM_SUPPORTED
108  case 'P':
109  return jinit_read_ppm(cinfo);
110 #endif
111 #ifdef RLE_SUPPORTED
112  case 'R':
113  return jinit_read_rle(cinfo);
114 #endif
115 #ifdef TARGA_SUPPORTED
116  case 0x00:
117  return jinit_read_targa(cinfo);
118 #endif
119  default:
120  ERREXIT(cinfo, JERR_UNKNOWN_FORMAT);
121  break;
122  }
123 
124  return NULL; /* suppress compiler warnings */
125 }
#define ERREXIT(msg)
Definition: rdjpgcom.c:72
_Check_return_ _CRTIMP int __cdecl getc(_Inout_ FILE *_File)
static FILE * infile
Definition: rdjpgcom.c:65
smooth NULL
Definition: ftsmooth.c:416
_Check_return_opt_ _CRTIMP_ALT int __cdecl ungetc(_In_ int _Ch, _Inout_ FILE *_File)
static boolean is_targa
Definition: cjpeg.c:77
const GLubyte * c
Definition: glext.h:8905
#define EOF
Definition: stdio.h:24
#define c
Definition: ke_i.h:80

Referenced by main().

◆ usage()

usage ( void  )

Definition at line 142 of file cjpeg.c.

144 {
145  fprintf(stderr, "usage: %s [switches] ", progname);
146 #ifdef TWO_FILE_COMMANDLINE
147  fprintf(stderr, "inputfile outputfile\n");
148 #else
149  fprintf(stderr, "[inputfile]\n");
150 #endif
151 
152  fprintf(stderr, "Switches (names may be abbreviated):\n");
153  fprintf(stderr, " -quality N[,...] Compression quality (0..100; 5-95 is useful range)\n");
154  fprintf(stderr, " -grayscale Create monochrome JPEG file\n");
155  fprintf(stderr, " -rgb Create RGB JPEG file\n");
156 #ifdef ENTROPY_OPT_SUPPORTED
157  fprintf(stderr, " -optimize Optimize Huffman table (smaller file, but slow compression)\n");
158 #endif
159 #ifdef C_PROGRESSIVE_SUPPORTED
160  fprintf(stderr, " -progressive Create progressive JPEG file\n");
161 #endif
162 #ifdef DCT_SCALING_SUPPORTED
163  fprintf(stderr, " -scale M/N Scale image by fraction M/N, eg, 1/2\n");
164 #endif
165 #ifdef TARGA_SUPPORTED
166  fprintf(stderr, " -targa Input file is Targa format (usually not needed)\n");
167 #endif
168  fprintf(stderr, "Switches for advanced users:\n");
169 #ifdef C_ARITH_CODING_SUPPORTED
170  fprintf(stderr, " -arithmetic Use arithmetic coding\n");
171 #endif
172 #ifdef DCT_SCALING_SUPPORTED
173  fprintf(stderr, " -block N DCT block size (1..16; default is 8)\n");
174 #endif
175 #if JPEG_LIB_VERSION_MAJOR >= 9
176  fprintf(stderr, " -rgb1 Create RGB JPEG file with reversible color transform\n");
177  fprintf(stderr, " -bgycc Create big gamut YCC JPEG file\n");
178 #endif
179 #ifdef DCT_ISLOW_SUPPORTED
180  fprintf(stderr, " -dct int Use integer DCT method%s\n",
181  (JDCT_DEFAULT == JDCT_ISLOW ? " (default)" : ""));
182 #endif
183 #ifdef DCT_IFAST_SUPPORTED
184  fprintf(stderr, " -dct fast Use fast integer DCT (less accurate)%s\n",
185  (JDCT_DEFAULT == JDCT_IFAST ? " (default)" : ""));
186 #endif
187 #ifdef DCT_FLOAT_SUPPORTED
188  fprintf(stderr, " -dct float Use floating-point DCT method%s\n",
189  (JDCT_DEFAULT == JDCT_FLOAT ? " (default)" : ""));
190 #endif
191  fprintf(stderr, " -nosmooth Don't use high-quality downsampling\n");
192  fprintf(stderr, " -restart N Set restart interval in rows, or in blocks with B\n");
193 #ifdef INPUT_SMOOTHING_SUPPORTED
194  fprintf(stderr, " -smooth N Smooth dithered input (N=1..100 is strength)\n");
195 #endif
196  fprintf(stderr, " -maxmemory N Maximum memory to use (in kbytes)\n");
197  fprintf(stderr, " -outfile name Specify name for output file\n");
198  fprintf(stderr, " -verbose or -debug Emit debug output\n");
199  fprintf(stderr, "Switches for wizards:\n");
200  fprintf(stderr, " -baseline Force baseline quantization tables\n");
201  fprintf(stderr, " -qtables file Use quantization tables given in file\n");
202  fprintf(stderr, " -qslots N[,...] Set component quantization tables\n");
203  fprintf(stderr, " -sample HxV[,...] Set component sampling factors\n");
204 #ifdef C_MULTISCAN_FILES_SUPPORTED
205  fprintf(stderr, " -scans file Create multi-scan JPEG per script file\n");
206 #endif
208 }
#define JDCT_DEFAULT
Definition: jpeglib.h:247
static const char * progname
Definition: cjpeg.c:137
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
#define EXIT_FAILURE
Definition: jerror.c:33
FILE * stderr
void exit(int exitcode)
Definition: _exit.c:33

Referenced by main(), and parse_switches().

Variable Documentation

◆ cdjpeg_message_table

const char* const cdjpeg_message_table[]
static
Initial value:
= {
}
smooth NULL
Definition: ftsmooth.c:416

Definition at line 45 of file cjpeg.c.

Referenced by main().

◆ is_targa

boolean is_targa
static

Definition at line 77 of file cjpeg.c.

Referenced by parse_switches(), and select_file_type().

◆ outfilename

char* outfilename
static

Definition at line 138 of file cjpeg.c.

Referenced by main(), and parse_switches().

◆ progname

const char* progname
static

Definition at line 137 of file cjpeg.c.

Referenced by init_progname(), main(), parse_switches(), rpc_reg(), and usage().