~cosme/ubuntu/precise/freeimage/freeimage-3.15.1

« back to all changes in this revision

Viewing changes to Source/LibJPEG/cjpeg.c

  • Committer: Bazaar Package Importer
  • Author(s): Cosme Domínguez Díaz
  • Date: 2010-07-20 13:42:15 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20100720134215-xt1454zaedv3b604
Tags: 3.13.1-0ubuntu1
* New upstream release. Closes: (LP: #607800)
 - Updated debian/freeimage-get-orig-source script.
 - Removing no longer necessary debian/patches/* and
   the patch system in debian/rules.
 - Updated debian/rules to work with the new Makefiles.
 - Drop from -O3 to -O2 and use lzma compression saves
   ~10 MB of free space. 
* lintian stuff
 - fixed debhelper-but-no-misc-depends
 - fixed ldconfig-symlink-missing-for-shlib

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 * cjpeg.c
3
3
 *
4
4
 * Copyright (C) 1991-1998, Thomas G. Lane.
 
5
 * Modified 2003-2008 by Guido Vollbeding.
5
6
 * This file is part of the Independent JPEG Group's software.
6
7
 * For conditions of distribution and use, see the accompanying README file.
7
8
 *
149
150
#endif
150
151
 
151
152
  fprintf(stderr, "Switches (names may be abbreviated):\n");
152
 
  fprintf(stderr, "  -quality N     Compression quality (0..100; 5-95 is useful range)\n");
 
153
  fprintf(stderr, "  -quality N[,...]   Compression quality (0..100; 5-95 is useful range)\n");
153
154
  fprintf(stderr, "  -grayscale     Create monochrome JPEG file\n");
154
155
#ifdef ENTROPY_OPT_SUPPORTED
155
156
  fprintf(stderr, "  -optimize      Optimize Huffman table (smaller file, but slow compression)\n");
157
158
#ifdef C_PROGRESSIVE_SUPPORTED
158
159
  fprintf(stderr, "  -progressive   Create progressive JPEG file\n");
159
160
#endif
 
161
#ifdef DCT_SCALING_SUPPORTED
 
162
  fprintf(stderr, "  -scale M/N     Scale image by fraction M/N, eg, 1/2\n");
 
163
#endif
160
164
#ifdef TARGA_SUPPORTED
161
165
  fprintf(stderr, "  -targa         Input file is Targa format (usually not needed)\n");
162
166
#endif
173
177
  fprintf(stderr, "  -dct float     Use floating-point DCT method%s\n",
174
178
          (JDCT_DEFAULT == JDCT_FLOAT ? " (default)" : ""));
175
179
#endif
 
180
  fprintf(stderr, "  -nosmooth      Don't use high-quality downsampling\n");
176
181
  fprintf(stderr, "  -restart N     Set restart interval in rows, or in blocks with B\n");
177
182
#ifdef INPUT_SMOOTHING_SUPPORTED
178
183
  fprintf(stderr, "  -smooth N      Smooth dithered input (N=1..100 is strength)\n");
209
214
{
210
215
  int argn;
211
216
  char * arg;
212
 
  int quality;                  /* -quality parameter */
213
 
  int q_scale_factor;           /* scaling percentage for -qtables */
214
217
  boolean force_baseline;
215
218
  boolean simple_progressive;
 
219
  char * qualityarg = NULL;     /* saves -quality parm if any */
216
220
  char * qtablefile = NULL;     /* saves -qtables filename if any */
217
221
  char * qslotsarg = NULL;      /* saves -qslots parm if any */
218
222
  char * samplearg = NULL;      /* saves -sample parm if any */
219
223
  char * scansarg = NULL;       /* saves -scans parm if any */
220
224
 
221
225
  /* Set up default JPEG parameters. */
222
 
  /* Note that default -quality level need not, and does not,
223
 
   * match the default scaling for an explicit -qtables argument.
224
 
   */
225
 
  quality = 75;                 /* default -quality value */
226
 
  q_scale_factor = 100;         /* default to no scaling for -qtables */
 
226
 
227
227
  force_baseline = FALSE;       /* by default, allow 16-bit quantizers */
228
228
  simple_progressive = FALSE;
229
229
  is_targa = FALSE;
300
300
        lval *= 1000L;
301
301
      cinfo->mem->max_memory_to_use = lval * 1000L;
302
302
 
 
303
    } else if (keymatch(arg, "nosmooth", 3)) {
 
304
      /* Suppress fancy downsampling */
 
305
      cinfo->do_fancy_downsampling = FALSE;
 
306
 
303
307
    } else if (keymatch(arg, "optimize", 1) || keymatch(arg, "optimise", 1)) {
304
308
      /* Enable entropy parm optimization. */
305
309
#ifdef ENTROPY_OPT_SUPPORTED
328
332
#endif
329
333
 
330
334
    } else if (keymatch(arg, "quality", 1)) {
331
 
      /* Quality factor (quantization table scaling factor). */
 
335
      /* Quality ratings (quantization table scaling factors). */
332
336
      if (++argn >= argc)       /* advance to next argument */
333
337
        usage();
334
 
      if (sscanf(argv[argn], "%d", &quality) != 1)
335
 
        usage();
336
 
      /* Change scale factor in case -qtables is present. */
337
 
      q_scale_factor = jpeg_quality_scaling(quality);
 
338
      qualityarg = argv[argn];
338
339
 
339
340
    } else if (keymatch(arg, "qslots", 2)) {
340
341
      /* Quantization table slot numbers. */
382
383
       * default sampling factors.
383
384
       */
384
385
 
385
 
    } else if (keymatch(arg, "scans", 2)) {
 
386
    } else if (keymatch(arg, "scale", 4)) {
 
387
      /* Scale the image by a fraction M/N. */
 
388
      if (++argn >= argc)       /* advance to next argument */
 
389
        usage();
 
390
      if (sscanf(argv[argn], "%d/%d",
 
391
                 &cinfo->scale_num, &cinfo->scale_denom) != 2)
 
392
        usage();
 
393
 
 
394
    } else if (keymatch(arg, "scans", 4)) {
386
395
      /* Set scan script. */
387
396
#ifdef C_MULTISCAN_FILES_SUPPORTED
388
397
      if (++argn >= argc)       /* advance to next argument */
422
431
 
423
432
    /* Set quantization tables for selected quality. */
424
433
    /* Some or all may be overridden if -qtables is present. */
425
 
    jpeg_set_quality(cinfo, quality, force_baseline);
 
434
    if (qualityarg != NULL)     /* process -quality if it was present */
 
435
      if (! set_quality_ratings(cinfo, qualityarg, force_baseline))
 
436
        usage();
426
437
 
427
438
    if (qtablefile != NULL)     /* process -qtables if it was present */
428
 
      if (! read_quant_tables(cinfo, qtablefile,
429
 
                              q_scale_factor, force_baseline))
 
439
      if (! read_quant_tables(cinfo, qtablefile, force_baseline))
430
440
        usage();
431
441
 
432
442
    if (qslotsarg != NULL)      /* process -qslots if it was present */