isbn 2.0.4 → 2.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/{README → README.md} +5 -11
- data/Rakefile +20 -14
- data/isbn.gemspec +23 -0
- data/lib/isbn.rb +2 -0
- data/test/isbn_spec.rb +1 -1
- metadata +29 -316
- data/VERSION +0 -1
- data/src/gocr-0.48/.cvsignore +0 -6
- data/src/gocr-0.48/AUTHORS +0 -7
- data/src/gocr-0.48/BUGS +0 -55
- data/src/gocr-0.48/CREDITS +0 -17
- data/src/gocr-0.48/HISTORY +0 -243
- data/src/gocr-0.48/INSTALL +0 -83
- data/src/gocr-0.48/Makefile +0 -193
- data/src/gocr-0.48/Makefile.in +0 -193
- data/src/gocr-0.48/README +0 -165
- data/src/gocr-0.48/READMEde.txt +0 -80
- data/src/gocr-0.48/REMARK.txt +0 -18
- data/src/gocr-0.48/REVIEW +0 -538
- data/src/gocr-0.48/TODO +0 -65
- data/src/gocr-0.48/bin/.cvsignore +0 -2
- data/src/gocr-0.48/bin/create_db +0 -38
- data/src/gocr-0.48/bin/gocr.tcl +0 -527
- data/src/gocr-0.48/bin/gocr_chk.sh +0 -44
- data/src/gocr-0.48/configure +0 -4689
- data/src/gocr-0.48/configure.in +0 -71
- data/src/gocr-0.48/doc/.#Makefile.1.6 +0 -39
- data/src/gocr-0.48/doc/.cvsignore +0 -2
- data/src/gocr-0.48/doc/Makefile +0 -39
- data/src/gocr-0.48/doc/Makefile.in +0 -39
- data/src/gocr-0.48/doc/example.dtd +0 -53
- data/src/gocr-0.48/doc/example.xml +0 -21
- data/src/gocr-0.48/doc/examples.txt +0 -67
- data/src/gocr-0.48/doc/gocr.html +0 -578
- data/src/gocr-0.48/doc/unicode.txt +0 -57
- data/src/gocr-0.48/examples/.#Makefile.1.22 +0 -166
- data/src/gocr-0.48/examples/4x6.png +0 -0
- data/src/gocr-0.48/examples/4x6.txt +0 -2
- data/src/gocr-0.48/examples/5x7.png +0 -0
- data/src/gocr-0.48/examples/5x7.png.txt +0 -2
- data/src/gocr-0.48/examples/5x8.png +0 -0
- data/src/gocr-0.48/examples/5x8.png.txt +0 -2
- data/src/gocr-0.48/examples/Makefile +0 -166
- data/src/gocr-0.48/examples/color.fig +0 -20
- data/src/gocr-0.48/examples/ex.fig +0 -16
- data/src/gocr-0.48/examples/font.tex +0 -22
- data/src/gocr-0.48/examples/font1.tex +0 -46
- data/src/gocr-0.48/examples/font2.fig +0 -27
- data/src/gocr-0.48/examples/font_nw.tex +0 -24
- data/src/gocr-0.48/examples/handwrt1.jpg +0 -0
- data/src/gocr-0.48/examples/handwrt1.txt +0 -10
- data/src/gocr-0.48/examples/inverse.fig +0 -20
- data/src/gocr-0.48/examples/matrix.jpg +0 -0
- data/src/gocr-0.48/examples/ocr-a-subset.png +0 -0
- data/src/gocr-0.48/examples/ocr-a-subset.png.txt +0 -4
- data/src/gocr-0.48/examples/ocr-a.png +0 -0
- data/src/gocr-0.48/examples/ocr-a.txt +0 -6
- data/src/gocr-0.48/examples/ocr-b.png +0 -0
- data/src/gocr-0.48/examples/ocr-b.png.txt +0 -4
- data/src/gocr-0.48/examples/polish.tex +0 -28
- data/src/gocr-0.48/examples/rotate45.fig +0 -14
- data/src/gocr-0.48/examples/score +0 -36
- data/src/gocr-0.48/examples/text.tex +0 -28
- data/src/gocr-0.48/gpl.html +0 -537
- data/src/gocr-0.48/include/.cvsignore +0 -2
- data/src/gocr-0.48/include/config.h +0 -36
- data/src/gocr-0.48/include/config.h.in +0 -36
- data/src/gocr-0.48/include/version.h +0 -2
- data/src/gocr-0.48/install-sh +0 -3
- data/src/gocr-0.48/make.bat +0 -57
- data/src/gocr-0.48/man/.cvsignore +0 -2
- data/src/gocr-0.48/man/Makefile +0 -29
- data/src/gocr-0.48/man/Makefile.in +0 -29
- data/src/gocr-0.48/man/man1/gocr.1 +0 -166
- data/src/gocr-0.48/src/.cvsignore +0 -4
- data/src/gocr-0.48/src/Makefile +0 -132
- data/src/gocr-0.48/src/Makefile.in +0 -132
- data/src/gocr-0.48/src/amiga.h +0 -31
- data/src/gocr-0.48/src/barcode.c +0 -846
- data/src/gocr-0.48/src/barcode.c.orig +0 -593
- data/src/gocr-0.48/src/barcode.h +0 -11
- data/src/gocr-0.48/src/box.c +0 -372
- data/src/gocr-0.48/src/database.c +0 -462
- data/src/gocr-0.48/src/detect.c +0 -943
- data/src/gocr-0.48/src/gocr.c +0 -373
- data/src/gocr-0.48/src/gocr.h +0 -288
- data/src/gocr-0.48/src/jconv.c +0 -168
- data/src/gocr-0.48/src/job.c +0 -84
- data/src/gocr-0.48/src/lines.c +0 -350
- data/src/gocr-0.48/src/list.c +0 -334
- data/src/gocr-0.48/src/list.h +0 -90
- data/src/gocr-0.48/src/ocr0.c +0 -6756
- data/src/gocr-0.48/src/ocr0.h +0 -63
- data/src/gocr-0.48/src/ocr0n.c +0 -1475
- data/src/gocr-0.48/src/ocr1.c +0 -85
- data/src/gocr-0.48/src/ocr1.h +0 -3
- data/src/gocr-0.48/src/otsu.c +0 -289
- data/src/gocr-0.48/src/otsu.h +0 -23
- data/src/gocr-0.48/src/output.c +0 -289
- data/src/gocr-0.48/src/output.h +0 -37
- data/src/gocr-0.48/src/pcx.c +0 -153
- data/src/gocr-0.48/src/pcx.h +0 -9
- data/src/gocr-0.48/src/pgm2asc.c +0 -2893
- data/src/gocr-0.48/src/pgm2asc.h +0 -105
- data/src/gocr-0.48/src/pixel.c +0 -537
- data/src/gocr-0.48/src/pnm.c +0 -533
- data/src/gocr-0.48/src/pnm.h +0 -35
- data/src/gocr-0.48/src/progress.c +0 -87
- data/src/gocr-0.48/src/progress.h +0 -42
- data/src/gocr-0.48/src/remove.c +0 -703
- data/src/gocr-0.48/src/tga.c +0 -87
- data/src/gocr-0.48/src/tga.h +0 -6
- data/src/gocr-0.48/src/unicode.c +0 -1314
- data/src/gocr-0.48/src/unicode.h +0 -1257
- data/src/jpeg-7/Makefile.am +0 -133
- data/src/jpeg-7/Makefile.in +0 -1089
- data/src/jpeg-7/README +0 -322
- data/src/jpeg-7/aclocal.m4 +0 -8990
- data/src/jpeg-7/ansi2knr.1 +0 -36
- data/src/jpeg-7/ansi2knr.c +0 -739
- data/src/jpeg-7/cderror.h +0 -132
- data/src/jpeg-7/cdjpeg.c +0 -181
- data/src/jpeg-7/cdjpeg.h +0 -187
- data/src/jpeg-7/change.log +0 -270
- data/src/jpeg-7/cjpeg.1 +0 -325
- data/src/jpeg-7/cjpeg.c +0 -616
- data/src/jpeg-7/ckconfig.c +0 -402
- data/src/jpeg-7/coderules.txt +0 -118
- data/src/jpeg-7/config.guess +0 -1561
- data/src/jpeg-7/config.sub +0 -1686
- data/src/jpeg-7/configure +0 -17139
- data/src/jpeg-7/configure.ac +0 -317
- data/src/jpeg-7/depcomp +0 -630
- data/src/jpeg-7/djpeg.1 +0 -251
- data/src/jpeg-7/djpeg.c +0 -617
- data/src/jpeg-7/example.c +0 -433
- data/src/jpeg-7/filelist.txt +0 -215
- data/src/jpeg-7/install-sh +0 -520
- data/src/jpeg-7/install.txt +0 -1097
- data/src/jpeg-7/jaricom.c +0 -148
- data/src/jpeg-7/jcapimin.c +0 -282
- data/src/jpeg-7/jcapistd.c +0 -161
- data/src/jpeg-7/jcarith.c +0 -921
- data/src/jpeg-7/jccoefct.c +0 -453
- data/src/jpeg-7/jccolor.c +0 -459
- data/src/jpeg-7/jcdctmgr.c +0 -482
- data/src/jpeg-7/jchuff.c +0 -1612
- data/src/jpeg-7/jcinit.c +0 -65
- data/src/jpeg-7/jcmainct.c +0 -293
- data/src/jpeg-7/jcmarker.c +0 -667
- data/src/jpeg-7/jcmaster.c +0 -770
- data/src/jpeg-7/jcomapi.c +0 -106
- data/src/jpeg-7/jconfig.bcc +0 -48
- data/src/jpeg-7/jconfig.cfg +0 -45
- data/src/jpeg-7/jconfig.dj +0 -38
- data/src/jpeg-7/jconfig.mac +0 -43
- data/src/jpeg-7/jconfig.manx +0 -43
- data/src/jpeg-7/jconfig.mc6 +0 -52
- data/src/jpeg-7/jconfig.sas +0 -43
- data/src/jpeg-7/jconfig.st +0 -42
- data/src/jpeg-7/jconfig.txt +0 -155
- data/src/jpeg-7/jconfig.vc +0 -45
- data/src/jpeg-7/jconfig.vms +0 -37
- data/src/jpeg-7/jconfig.wat +0 -38
- data/src/jpeg-7/jcparam.c +0 -632
- data/src/jpeg-7/jcprepct.c +0 -358
- data/src/jpeg-7/jcsample.c +0 -545
- data/src/jpeg-7/jctrans.c +0 -381
- data/src/jpeg-7/jdapimin.c +0 -396
- data/src/jpeg-7/jdapistd.c +0 -275
- data/src/jpeg-7/jdarith.c +0 -762
- data/src/jpeg-7/jdatadst.c +0 -151
- data/src/jpeg-7/jdatasrc.c +0 -212
- data/src/jpeg-7/jdcoefct.c +0 -736
- data/src/jpeg-7/jdcolor.c +0 -396
- data/src/jpeg-7/jdct.h +0 -393
- data/src/jpeg-7/jddctmgr.c +0 -382
- data/src/jpeg-7/jdhuff.c +0 -1309
- data/src/jpeg-7/jdinput.c +0 -384
- data/src/jpeg-7/jdmainct.c +0 -512
- data/src/jpeg-7/jdmarker.c +0 -1360
- data/src/jpeg-7/jdmaster.c +0 -663
- data/src/jpeg-7/jdmerge.c +0 -400
- data/src/jpeg-7/jdpostct.c +0 -290
- data/src/jpeg-7/jdsample.c +0 -361
- data/src/jpeg-7/jdtrans.c +0 -136
- data/src/jpeg-7/jerror.c +0 -252
- data/src/jpeg-7/jerror.h +0 -304
- data/src/jpeg-7/jfdctflt.c +0 -174
- data/src/jpeg-7/jfdctfst.c +0 -230
- data/src/jpeg-7/jfdctint.c +0 -4348
- data/src/jpeg-7/jidctflt.c +0 -242
- data/src/jpeg-7/jidctfst.c +0 -368
- data/src/jpeg-7/jidctint.c +0 -5137
- data/src/jpeg-7/jinclude.h +0 -91
- data/src/jpeg-7/jmemansi.c +0 -167
- data/src/jpeg-7/jmemdos.c +0 -638
- data/src/jpeg-7/jmemdosa.asm +0 -379
- data/src/jpeg-7/jmemmac.c +0 -289
- data/src/jpeg-7/jmemmgr.c +0 -1118
- data/src/jpeg-7/jmemname.c +0 -276
- data/src/jpeg-7/jmemnobs.c +0 -109
- data/src/jpeg-7/jmemsys.h +0 -198
- data/src/jpeg-7/jmorecfg.h +0 -369
- data/src/jpeg-7/jpegint.h +0 -395
- data/src/jpeg-7/jpeglib.h +0 -1135
- data/src/jpeg-7/jpegtran.1 +0 -272
- data/src/jpeg-7/jpegtran.c +0 -546
- data/src/jpeg-7/jquant1.c +0 -856
- data/src/jpeg-7/jquant2.c +0 -1310
- data/src/jpeg-7/jutils.c +0 -179
- data/src/jpeg-7/jversion.h +0 -14
- data/src/jpeg-7/libjpeg.map +0 -4
- data/src/jpeg-7/libjpeg.txt +0 -3067
- data/src/jpeg-7/ltmain.sh +0 -8406
- data/src/jpeg-7/makcjpeg.st +0 -36
- data/src/jpeg-7/makdjpeg.st +0 -36
- data/src/jpeg-7/makeadsw.vc6 +0 -77
- data/src/jpeg-7/makeasln.vc9 +0 -33
- data/src/jpeg-7/makecdep.vc6 +0 -82
- data/src/jpeg-7/makecdsp.vc6 +0 -130
- data/src/jpeg-7/makecmak.vc6 +0 -159
- data/src/jpeg-7/makecvcp.vc9 +0 -186
- data/src/jpeg-7/makeddep.vc6 +0 -82
- data/src/jpeg-7/makeddsp.vc6 +0 -130
- data/src/jpeg-7/makedmak.vc6 +0 -159
- data/src/jpeg-7/makedvcp.vc9 +0 -186
- data/src/jpeg-7/makefile.ansi +0 -220
- data/src/jpeg-7/makefile.bcc +0 -291
- data/src/jpeg-7/makefile.dj +0 -226
- data/src/jpeg-7/makefile.manx +0 -220
- data/src/jpeg-7/makefile.mc6 +0 -255
- data/src/jpeg-7/makefile.mms +0 -224
- data/src/jpeg-7/makefile.sas +0 -258
- data/src/jpeg-7/makefile.unix +0 -234
- data/src/jpeg-7/makefile.vc +0 -217
- data/src/jpeg-7/makefile.vms +0 -142
- data/src/jpeg-7/makefile.wat +0 -239
- data/src/jpeg-7/makejdep.vc6 +0 -423
- data/src/jpeg-7/makejdsp.vc6 +0 -285
- data/src/jpeg-7/makejdsw.vc6 +0 -29
- data/src/jpeg-7/makejmak.vc6 +0 -425
- data/src/jpeg-7/makejsln.vc9 +0 -17
- data/src/jpeg-7/makejvcp.vc9 +0 -328
- data/src/jpeg-7/makeproj.mac +0 -213
- data/src/jpeg-7/makerdep.vc6 +0 -6
- data/src/jpeg-7/makerdsp.vc6 +0 -78
- data/src/jpeg-7/makermak.vc6 +0 -110
- data/src/jpeg-7/makervcp.vc9 +0 -133
- data/src/jpeg-7/maketdep.vc6 +0 -43
- data/src/jpeg-7/maketdsp.vc6 +0 -122
- data/src/jpeg-7/maketmak.vc6 +0 -131
- data/src/jpeg-7/maketvcp.vc9 +0 -178
- data/src/jpeg-7/makewdep.vc6 +0 -6
- data/src/jpeg-7/makewdsp.vc6 +0 -78
- data/src/jpeg-7/makewmak.vc6 +0 -110
- data/src/jpeg-7/makewvcp.vc9 +0 -133
- data/src/jpeg-7/makljpeg.st +0 -68
- data/src/jpeg-7/maktjpeg.st +0 -30
- data/src/jpeg-7/makvms.opt +0 -4
- data/src/jpeg-7/missing +0 -376
- data/src/jpeg-7/rdbmp.c +0 -439
- data/src/jpeg-7/rdcolmap.c +0 -253
- data/src/jpeg-7/rdgif.c +0 -38
- data/src/jpeg-7/rdjpgcom.1 +0 -63
- data/src/jpeg-7/rdjpgcom.c +0 -515
- data/src/jpeg-7/rdppm.c +0 -459
- data/src/jpeg-7/rdrle.c +0 -387
- data/src/jpeg-7/rdswitch.c +0 -365
- data/src/jpeg-7/rdtarga.c +0 -500
- data/src/jpeg-7/structure.txt +0 -945
- data/src/jpeg-7/testimg.bmp +0 -0
- data/src/jpeg-7/testimg.jpg +0 -0
- data/src/jpeg-7/testimg.ppm +0 -4
- data/src/jpeg-7/testimgp.jpg +0 -0
- data/src/jpeg-7/testorig.jpg +0 -0
- data/src/jpeg-7/testprog.jpg +0 -0
- data/src/jpeg-7/transupp.c +0 -1533
- data/src/jpeg-7/transupp.h +0 -205
- data/src/jpeg-7/usage.txt +0 -605
- data/src/jpeg-7/wizard.txt +0 -211
- data/src/jpeg-7/wrbmp.c +0 -442
- data/src/jpeg-7/wrgif.c +0 -399
- data/src/jpeg-7/wrjpgcom.1 +0 -103
- data/src/jpeg-7/wrjpgcom.c +0 -583
- data/src/jpeg-7/wrppm.c +0 -269
- data/src/jpeg-7/wrrle.c +0 -305
- data/src/jpeg-7/wrtarga.c +0 -253
data/src/jpeg-7/cjpeg.c
DELETED
@@ -1,616 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* cjpeg.c
|
3
|
-
*
|
4
|
-
* Copyright (C) 1991-1998, Thomas G. Lane.
|
5
|
-
* Modified 2003-2008 by Guido Vollbeding.
|
6
|
-
* This file is part of the Independent JPEG Group's software.
|
7
|
-
* For conditions of distribution and use, see the accompanying README file.
|
8
|
-
*
|
9
|
-
* This file contains a command-line user interface for the JPEG compressor.
|
10
|
-
* It should work on any system with Unix- or MS-DOS-style command lines.
|
11
|
-
*
|
12
|
-
* Two different command line styles are permitted, depending on the
|
13
|
-
* compile-time switch TWO_FILE_COMMANDLINE:
|
14
|
-
* cjpeg [options] inputfile outputfile
|
15
|
-
* cjpeg [options] [inputfile]
|
16
|
-
* In the second style, output is always to standard output, which you'd
|
17
|
-
* normally redirect to a file or pipe to some other program. Input is
|
18
|
-
* either from a named file or from standard input (typically redirected).
|
19
|
-
* The second style is convenient on Unix but is unhelpful on systems that
|
20
|
-
* don't support pipes. Also, you MUST use the first style if your system
|
21
|
-
* doesn't do binary I/O to stdin/stdout.
|
22
|
-
* To simplify script writing, the "-outfile" switch is provided. The syntax
|
23
|
-
* cjpeg [options] -outfile outputfile inputfile
|
24
|
-
* works regardless of which command line style is used.
|
25
|
-
*/
|
26
|
-
|
27
|
-
#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */
|
28
|
-
#include "jversion.h" /* for version message */
|
29
|
-
|
30
|
-
#ifdef USE_CCOMMAND /* command-line reader for Macintosh */
|
31
|
-
#ifdef __MWERKS__
|
32
|
-
#include <SIOUX.h> /* Metrowerks needs this */
|
33
|
-
#include <console.h> /* ... and this */
|
34
|
-
#endif
|
35
|
-
#ifdef THINK_C
|
36
|
-
#include <console.h> /* Think declares it here */
|
37
|
-
#endif
|
38
|
-
#endif
|
39
|
-
|
40
|
-
|
41
|
-
/* Create the add-on message string table. */
|
42
|
-
|
43
|
-
#define JMESSAGE(code,string) string ,
|
44
|
-
|
45
|
-
static const char * const cdjpeg_message_table[] = {
|
46
|
-
#include "cderror.h"
|
47
|
-
NULL
|
48
|
-
};
|
49
|
-
|
50
|
-
|
51
|
-
/*
|
52
|
-
* This routine determines what format the input file is,
|
53
|
-
* and selects the appropriate input-reading module.
|
54
|
-
*
|
55
|
-
* To determine which family of input formats the file belongs to,
|
56
|
-
* we may look only at the first byte of the file, since C does not
|
57
|
-
* guarantee that more than one character can be pushed back with ungetc.
|
58
|
-
* Looking at additional bytes would require one of these approaches:
|
59
|
-
* 1) assume we can fseek() the input file (fails for piped input);
|
60
|
-
* 2) assume we can push back more than one character (works in
|
61
|
-
* some C implementations, but unportable);
|
62
|
-
* 3) provide our own buffering (breaks input readers that want to use
|
63
|
-
* stdio directly, such as the RLE library);
|
64
|
-
* or 4) don't put back the data, and modify the input_init methods to assume
|
65
|
-
* they start reading after the start of file (also breaks RLE library).
|
66
|
-
* #1 is attractive for MS-DOS but is untenable on Unix.
|
67
|
-
*
|
68
|
-
* The most portable solution for file types that can't be identified by their
|
69
|
-
* first byte is to make the user tell us what they are. This is also the
|
70
|
-
* only approach for "raw" file types that contain only arbitrary values.
|
71
|
-
* We presently apply this method for Targa files. Most of the time Targa
|
72
|
-
* files start with 0x00, so we recognize that case. Potentially, however,
|
73
|
-
* a Targa file could start with any byte value (byte 0 is the length of the
|
74
|
-
* seldom-used ID field), so we provide a switch to force Targa input mode.
|
75
|
-
*/
|
76
|
-
|
77
|
-
static boolean is_targa; /* records user -targa switch */
|
78
|
-
|
79
|
-
|
80
|
-
LOCAL(cjpeg_source_ptr)
|
81
|
-
select_file_type (j_compress_ptr cinfo, FILE * infile)
|
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
|
-
}
|
126
|
-
|
127
|
-
|
128
|
-
/*
|
129
|
-
* Argument-parsing code.
|
130
|
-
* The switch parser is designed to be useful with DOS-style command line
|
131
|
-
* syntax, ie, intermixed switches and file names, where only the switches
|
132
|
-
* to the left of a given file name affect processing of that file.
|
133
|
-
* The main program in this file doesn't actually use this capability...
|
134
|
-
*/
|
135
|
-
|
136
|
-
|
137
|
-
static const char * progname; /* program name for error messages */
|
138
|
-
static char * outfilename; /* for -outfile switch */
|
139
|
-
|
140
|
-
|
141
|
-
LOCAL(void)
|
142
|
-
usage (void)
|
143
|
-
/* complain about bad command line */
|
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
|
-
#ifdef ENTROPY_OPT_SUPPORTED
|
156
|
-
fprintf(stderr, " -optimize Optimize Huffman table (smaller file, but slow compression)\n");
|
157
|
-
#endif
|
158
|
-
#ifdef C_PROGRESSIVE_SUPPORTED
|
159
|
-
fprintf(stderr, " -progressive Create progressive JPEG file\n");
|
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
|
164
|
-
#ifdef TARGA_SUPPORTED
|
165
|
-
fprintf(stderr, " -targa Input file is Targa format (usually not needed)\n");
|
166
|
-
#endif
|
167
|
-
fprintf(stderr, "Switches for advanced users:\n");
|
168
|
-
#ifdef DCT_ISLOW_SUPPORTED
|
169
|
-
fprintf(stderr, " -dct int Use integer DCT method%s\n",
|
170
|
-
(JDCT_DEFAULT == JDCT_ISLOW ? " (default)" : ""));
|
171
|
-
#endif
|
172
|
-
#ifdef DCT_IFAST_SUPPORTED
|
173
|
-
fprintf(stderr, " -dct fast Use fast integer DCT (less accurate)%s\n",
|
174
|
-
(JDCT_DEFAULT == JDCT_IFAST ? " (default)" : ""));
|
175
|
-
#endif
|
176
|
-
#ifdef DCT_FLOAT_SUPPORTED
|
177
|
-
fprintf(stderr, " -dct float Use floating-point DCT method%s\n",
|
178
|
-
(JDCT_DEFAULT == JDCT_FLOAT ? " (default)" : ""));
|
179
|
-
#endif
|
180
|
-
fprintf(stderr, " -nosmooth Don't use high-quality downsampling\n");
|
181
|
-
fprintf(stderr, " -restart N Set restart interval in rows, or in blocks with B\n");
|
182
|
-
#ifdef INPUT_SMOOTHING_SUPPORTED
|
183
|
-
fprintf(stderr, " -smooth N Smooth dithered input (N=1..100 is strength)\n");
|
184
|
-
#endif
|
185
|
-
fprintf(stderr, " -maxmemory N Maximum memory to use (in kbytes)\n");
|
186
|
-
fprintf(stderr, " -outfile name Specify name for output file\n");
|
187
|
-
fprintf(stderr, " -verbose or -debug Emit debug output\n");
|
188
|
-
fprintf(stderr, "Switches for wizards:\n");
|
189
|
-
#ifdef C_ARITH_CODING_SUPPORTED
|
190
|
-
fprintf(stderr, " -arithmetic Use arithmetic coding\n");
|
191
|
-
#endif
|
192
|
-
fprintf(stderr, " -baseline Force baseline quantization tables\n");
|
193
|
-
fprintf(stderr, " -qtables file Use quantization tables given in file\n");
|
194
|
-
fprintf(stderr, " -qslots N[,...] Set component quantization tables\n");
|
195
|
-
fprintf(stderr, " -sample HxV[,...] Set component sampling factors\n");
|
196
|
-
#ifdef C_MULTISCAN_FILES_SUPPORTED
|
197
|
-
fprintf(stderr, " -scans file Create multi-scan JPEG per script file\n");
|
198
|
-
#endif
|
199
|
-
exit(EXIT_FAILURE);
|
200
|
-
}
|
201
|
-
|
202
|
-
|
203
|
-
LOCAL(int)
|
204
|
-
parse_switches (j_compress_ptr cinfo, int argc, char **argv,
|
205
|
-
int last_file_arg_seen, boolean for_real)
|
206
|
-
/* Parse optional switches.
|
207
|
-
* Returns argv[] index of first file-name argument (== argc if none).
|
208
|
-
* Any file names with indexes <= last_file_arg_seen are ignored;
|
209
|
-
* they have presumably been processed in a previous iteration.
|
210
|
-
* (Pass 0 for last_file_arg_seen on the first or only iteration.)
|
211
|
-
* for_real is FALSE on the first (dummy) pass; we may skip any expensive
|
212
|
-
* processing.
|
213
|
-
*/
|
214
|
-
{
|
215
|
-
int argn;
|
216
|
-
char * arg;
|
217
|
-
boolean force_baseline;
|
218
|
-
boolean simple_progressive;
|
219
|
-
char * qualityarg = NULL; /* saves -quality parm if any */
|
220
|
-
char * qtablefile = NULL; /* saves -qtables filename if any */
|
221
|
-
char * qslotsarg = NULL; /* saves -qslots parm if any */
|
222
|
-
char * samplearg = NULL; /* saves -sample parm if any */
|
223
|
-
char * scansarg = NULL; /* saves -scans parm if any */
|
224
|
-
|
225
|
-
/* Set up default JPEG parameters. */
|
226
|
-
|
227
|
-
force_baseline = FALSE; /* by default, allow 16-bit quantizers */
|
228
|
-
simple_progressive = FALSE;
|
229
|
-
is_targa = FALSE;
|
230
|
-
outfilename = NULL;
|
231
|
-
cinfo->err->trace_level = 0;
|
232
|
-
|
233
|
-
/* Scan command line options, adjust parameters */
|
234
|
-
|
235
|
-
for (argn = 1; argn < argc; argn++) {
|
236
|
-
arg = argv[argn];
|
237
|
-
if (*arg != '-') {
|
238
|
-
/* Not a switch, must be a file name argument */
|
239
|
-
if (argn <= last_file_arg_seen) {
|
240
|
-
outfilename = NULL; /* -outfile applies to just one input file */
|
241
|
-
continue; /* ignore this name if previously processed */
|
242
|
-
}
|
243
|
-
break; /* else done parsing switches */
|
244
|
-
}
|
245
|
-
arg++; /* advance past switch marker character */
|
246
|
-
|
247
|
-
if (keymatch(arg, "arithmetic", 1)) {
|
248
|
-
/* Use arithmetic coding. */
|
249
|
-
#ifdef C_ARITH_CODING_SUPPORTED
|
250
|
-
cinfo->arith_code = TRUE;
|
251
|
-
#else
|
252
|
-
fprintf(stderr, "%s: sorry, arithmetic coding not supported\n",
|
253
|
-
progname);
|
254
|
-
exit(EXIT_FAILURE);
|
255
|
-
#endif
|
256
|
-
|
257
|
-
} else if (keymatch(arg, "baseline", 1)) {
|
258
|
-
/* Force baseline-compatible output (8-bit quantizer values). */
|
259
|
-
force_baseline = TRUE;
|
260
|
-
|
261
|
-
} else if (keymatch(arg, "dct", 2)) {
|
262
|
-
/* Select DCT algorithm. */
|
263
|
-
if (++argn >= argc) /* advance to next argument */
|
264
|
-
usage();
|
265
|
-
if (keymatch(argv[argn], "int", 1)) {
|
266
|
-
cinfo->dct_method = JDCT_ISLOW;
|
267
|
-
} else if (keymatch(argv[argn], "fast", 2)) {
|
268
|
-
cinfo->dct_method = JDCT_IFAST;
|
269
|
-
} else if (keymatch(argv[argn], "float", 2)) {
|
270
|
-
cinfo->dct_method = JDCT_FLOAT;
|
271
|
-
} else
|
272
|
-
usage();
|
273
|
-
|
274
|
-
} else if (keymatch(arg, "debug", 1) || keymatch(arg, "verbose", 1)) {
|
275
|
-
/* Enable debug printouts. */
|
276
|
-
/* On first -d, print version identification */
|
277
|
-
static boolean printed_version = FALSE;
|
278
|
-
|
279
|
-
if (! printed_version) {
|
280
|
-
fprintf(stderr, "Independent JPEG Group's CJPEG, version %s\n%s\n",
|
281
|
-
JVERSION, JCOPYRIGHT);
|
282
|
-
printed_version = TRUE;
|
283
|
-
}
|
284
|
-
cinfo->err->trace_level++;
|
285
|
-
|
286
|
-
} else if (keymatch(arg, "grayscale", 2) || keymatch(arg, "greyscale",2)) {
|
287
|
-
/* Force a monochrome JPEG file to be generated. */
|
288
|
-
jpeg_set_colorspace(cinfo, JCS_GRAYSCALE);
|
289
|
-
|
290
|
-
} else if (keymatch(arg, "maxmemory", 3)) {
|
291
|
-
/* Maximum memory in Kb (or Mb with 'm'). */
|
292
|
-
long lval;
|
293
|
-
char ch = 'x';
|
294
|
-
|
295
|
-
if (++argn >= argc) /* advance to next argument */
|
296
|
-
usage();
|
297
|
-
if (sscanf(argv[argn], "%ld%c", &lval, &ch) < 1)
|
298
|
-
usage();
|
299
|
-
if (ch == 'm' || ch == 'M')
|
300
|
-
lval *= 1000L;
|
301
|
-
cinfo->mem->max_memory_to_use = lval * 1000L;
|
302
|
-
|
303
|
-
} else if (keymatch(arg, "nosmooth", 3)) {
|
304
|
-
/* Suppress fancy downsampling */
|
305
|
-
cinfo->do_fancy_downsampling = FALSE;
|
306
|
-
|
307
|
-
} else if (keymatch(arg, "optimize", 1) || keymatch(arg, "optimise", 1)) {
|
308
|
-
/* Enable entropy parm optimization. */
|
309
|
-
#ifdef ENTROPY_OPT_SUPPORTED
|
310
|
-
cinfo->optimize_coding = TRUE;
|
311
|
-
#else
|
312
|
-
fprintf(stderr, "%s: sorry, entropy optimization was not compiled\n",
|
313
|
-
progname);
|
314
|
-
exit(EXIT_FAILURE);
|
315
|
-
#endif
|
316
|
-
|
317
|
-
} else if (keymatch(arg, "outfile", 4)) {
|
318
|
-
/* Set output file name. */
|
319
|
-
if (++argn >= argc) /* advance to next argument */
|
320
|
-
usage();
|
321
|
-
outfilename = argv[argn]; /* save it away for later use */
|
322
|
-
|
323
|
-
} else if (keymatch(arg, "progressive", 1)) {
|
324
|
-
/* Select simple progressive mode. */
|
325
|
-
#ifdef C_PROGRESSIVE_SUPPORTED
|
326
|
-
simple_progressive = TRUE;
|
327
|
-
/* We must postpone execution until num_components is known. */
|
328
|
-
#else
|
329
|
-
fprintf(stderr, "%s: sorry, progressive output was not compiled\n",
|
330
|
-
progname);
|
331
|
-
exit(EXIT_FAILURE);
|
332
|
-
#endif
|
333
|
-
|
334
|
-
} else if (keymatch(arg, "quality", 1)) {
|
335
|
-
/* Quality ratings (quantization table scaling factors). */
|
336
|
-
if (++argn >= argc) /* advance to next argument */
|
337
|
-
usage();
|
338
|
-
qualityarg = argv[argn];
|
339
|
-
|
340
|
-
} else if (keymatch(arg, "qslots", 2)) {
|
341
|
-
/* Quantization table slot numbers. */
|
342
|
-
if (++argn >= argc) /* advance to next argument */
|
343
|
-
usage();
|
344
|
-
qslotsarg = argv[argn];
|
345
|
-
/* Must delay setting qslots until after we have processed any
|
346
|
-
* colorspace-determining switches, since jpeg_set_colorspace sets
|
347
|
-
* default quant table numbers.
|
348
|
-
*/
|
349
|
-
|
350
|
-
} else if (keymatch(arg, "qtables", 2)) {
|
351
|
-
/* Quantization tables fetched from file. */
|
352
|
-
if (++argn >= argc) /* advance to next argument */
|
353
|
-
usage();
|
354
|
-
qtablefile = argv[argn];
|
355
|
-
/* We postpone actually reading the file in case -quality comes later. */
|
356
|
-
|
357
|
-
} else if (keymatch(arg, "restart", 1)) {
|
358
|
-
/* Restart interval in MCU rows (or in MCUs with 'b'). */
|
359
|
-
long lval;
|
360
|
-
char ch = 'x';
|
361
|
-
|
362
|
-
if (++argn >= argc) /* advance to next argument */
|
363
|
-
usage();
|
364
|
-
if (sscanf(argv[argn], "%ld%c", &lval, &ch) < 1)
|
365
|
-
usage();
|
366
|
-
if (lval < 0 || lval > 65535L)
|
367
|
-
usage();
|
368
|
-
if (ch == 'b' || ch == 'B') {
|
369
|
-
cinfo->restart_interval = (unsigned int) lval;
|
370
|
-
cinfo->restart_in_rows = 0; /* else prior '-restart n' overrides me */
|
371
|
-
} else {
|
372
|
-
cinfo->restart_in_rows = (int) lval;
|
373
|
-
/* restart_interval will be computed during startup */
|
374
|
-
}
|
375
|
-
|
376
|
-
} else if (keymatch(arg, "sample", 2)) {
|
377
|
-
/* Set sampling factors. */
|
378
|
-
if (++argn >= argc) /* advance to next argument */
|
379
|
-
usage();
|
380
|
-
samplearg = argv[argn];
|
381
|
-
/* Must delay setting sample factors until after we have processed any
|
382
|
-
* colorspace-determining switches, since jpeg_set_colorspace sets
|
383
|
-
* default sampling factors.
|
384
|
-
*/
|
385
|
-
|
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)) {
|
395
|
-
/* Set scan script. */
|
396
|
-
#ifdef C_MULTISCAN_FILES_SUPPORTED
|
397
|
-
if (++argn >= argc) /* advance to next argument */
|
398
|
-
usage();
|
399
|
-
scansarg = argv[argn];
|
400
|
-
/* We must postpone reading the file in case -progressive appears. */
|
401
|
-
#else
|
402
|
-
fprintf(stderr, "%s: sorry, multi-scan output was not compiled\n",
|
403
|
-
progname);
|
404
|
-
exit(EXIT_FAILURE);
|
405
|
-
#endif
|
406
|
-
|
407
|
-
} else if (keymatch(arg, "smooth", 2)) {
|
408
|
-
/* Set input smoothing factor. */
|
409
|
-
int val;
|
410
|
-
|
411
|
-
if (++argn >= argc) /* advance to next argument */
|
412
|
-
usage();
|
413
|
-
if (sscanf(argv[argn], "%d", &val) != 1)
|
414
|
-
usage();
|
415
|
-
if (val < 0 || val > 100)
|
416
|
-
usage();
|
417
|
-
cinfo->smoothing_factor = val;
|
418
|
-
|
419
|
-
} else if (keymatch(arg, "targa", 1)) {
|
420
|
-
/* Input file is Targa format. */
|
421
|
-
is_targa = TRUE;
|
422
|
-
|
423
|
-
} else {
|
424
|
-
usage(); /* bogus switch */
|
425
|
-
}
|
426
|
-
}
|
427
|
-
|
428
|
-
/* Post-switch-scanning cleanup */
|
429
|
-
|
430
|
-
if (for_real) {
|
431
|
-
|
432
|
-
/* Set quantization tables for selected quality. */
|
433
|
-
/* Some or all may be overridden if -qtables is present. */
|
434
|
-
if (qualityarg != NULL) /* process -quality if it was present */
|
435
|
-
if (! set_quality_ratings(cinfo, qualityarg, force_baseline))
|
436
|
-
usage();
|
437
|
-
|
438
|
-
if (qtablefile != NULL) /* process -qtables if it was present */
|
439
|
-
if (! read_quant_tables(cinfo, qtablefile, force_baseline))
|
440
|
-
usage();
|
441
|
-
|
442
|
-
if (qslotsarg != NULL) /* process -qslots if it was present */
|
443
|
-
if (! set_quant_slots(cinfo, qslotsarg))
|
444
|
-
usage();
|
445
|
-
|
446
|
-
if (samplearg != NULL) /* process -sample if it was present */
|
447
|
-
if (! set_sample_factors(cinfo, samplearg))
|
448
|
-
usage();
|
449
|
-
|
450
|
-
#ifdef C_PROGRESSIVE_SUPPORTED
|
451
|
-
if (simple_progressive) /* process -progressive; -scans can override */
|
452
|
-
jpeg_simple_progression(cinfo);
|
453
|
-
#endif
|
454
|
-
|
455
|
-
#ifdef C_MULTISCAN_FILES_SUPPORTED
|
456
|
-
if (scansarg != NULL) /* process -scans if it was present */
|
457
|
-
if (! read_scan_script(cinfo, scansarg))
|
458
|
-
usage();
|
459
|
-
#endif
|
460
|
-
}
|
461
|
-
|
462
|
-
return argn; /* return index of next arg (file name) */
|
463
|
-
}
|
464
|
-
|
465
|
-
|
466
|
-
/*
|
467
|
-
* The main program.
|
468
|
-
*/
|
469
|
-
|
470
|
-
int
|
471
|
-
main (int argc, char **argv)
|
472
|
-
{
|
473
|
-
struct jpeg_compress_struct cinfo;
|
474
|
-
struct jpeg_error_mgr jerr;
|
475
|
-
#ifdef PROGRESS_REPORT
|
476
|
-
struct cdjpeg_progress_mgr progress;
|
477
|
-
#endif
|
478
|
-
int file_index;
|
479
|
-
cjpeg_source_ptr src_mgr;
|
480
|
-
FILE * input_file;
|
481
|
-
FILE * output_file;
|
482
|
-
JDIMENSION num_scanlines;
|
483
|
-
|
484
|
-
/* On Mac, fetch a command line. */
|
485
|
-
#ifdef USE_CCOMMAND
|
486
|
-
argc = ccommand(&argv);
|
487
|
-
#endif
|
488
|
-
|
489
|
-
progname = argv[0];
|
490
|
-
if (progname == NULL || progname[0] == 0)
|
491
|
-
progname = "cjpeg"; /* in case C library doesn't provide it */
|
492
|
-
|
493
|
-
/* Initialize the JPEG compression object with default error handling. */
|
494
|
-
cinfo.err = jpeg_std_error(&jerr);
|
495
|
-
jpeg_create_compress(&cinfo);
|
496
|
-
/* Add some application-specific error messages (from cderror.h) */
|
497
|
-
jerr.addon_message_table = cdjpeg_message_table;
|
498
|
-
jerr.first_addon_message = JMSG_FIRSTADDONCODE;
|
499
|
-
jerr.last_addon_message = JMSG_LASTADDONCODE;
|
500
|
-
|
501
|
-
/* Now safe to enable signal catcher. */
|
502
|
-
#ifdef NEED_SIGNAL_CATCHER
|
503
|
-
enable_signal_catcher((j_common_ptr) &cinfo);
|
504
|
-
#endif
|
505
|
-
|
506
|
-
/* Initialize JPEG parameters.
|
507
|
-
* Much of this may be overridden later.
|
508
|
-
* In particular, we don't yet know the input file's color space,
|
509
|
-
* but we need to provide some value for jpeg_set_defaults() to work.
|
510
|
-
*/
|
511
|
-
|
512
|
-
cinfo.in_color_space = JCS_RGB; /* arbitrary guess */
|
513
|
-
jpeg_set_defaults(&cinfo);
|
514
|
-
|
515
|
-
/* Scan command line to find file names.
|
516
|
-
* It is convenient to use just one switch-parsing routine, but the switch
|
517
|
-
* values read here are ignored; we will rescan the switches after opening
|
518
|
-
* the input file.
|
519
|
-
*/
|
520
|
-
|
521
|
-
file_index = parse_switches(&cinfo, argc, argv, 0, FALSE);
|
522
|
-
|
523
|
-
#ifdef TWO_FILE_COMMANDLINE
|
524
|
-
/* Must have either -outfile switch or explicit output file name */
|
525
|
-
if (outfilename == NULL) {
|
526
|
-
if (file_index != argc-2) {
|
527
|
-
fprintf(stderr, "%s: must name one input and one output file\n",
|
528
|
-
progname);
|
529
|
-
usage();
|
530
|
-
}
|
531
|
-
outfilename = argv[file_index+1];
|
532
|
-
} else {
|
533
|
-
if (file_index != argc-1) {
|
534
|
-
fprintf(stderr, "%s: must name one input and one output file\n",
|
535
|
-
progname);
|
536
|
-
usage();
|
537
|
-
}
|
538
|
-
}
|
539
|
-
#else
|
540
|
-
/* Unix style: expect zero or one file name */
|
541
|
-
if (file_index < argc-1) {
|
542
|
-
fprintf(stderr, "%s: only one input file\n", progname);
|
543
|
-
usage();
|
544
|
-
}
|
545
|
-
#endif /* TWO_FILE_COMMANDLINE */
|
546
|
-
|
547
|
-
/* Open the input file. */
|
548
|
-
if (file_index < argc) {
|
549
|
-
if ((input_file = fopen(argv[file_index], READ_BINARY)) == NULL) {
|
550
|
-
fprintf(stderr, "%s: can't open %s\n", progname, argv[file_index]);
|
551
|
-
exit(EXIT_FAILURE);
|
552
|
-
}
|
553
|
-
} else {
|
554
|
-
/* default input file is stdin */
|
555
|
-
input_file = read_stdin();
|
556
|
-
}
|
557
|
-
|
558
|
-
/* Open the output file. */
|
559
|
-
if (outfilename != NULL) {
|
560
|
-
if ((output_file = fopen(outfilename, WRITE_BINARY)) == NULL) {
|
561
|
-
fprintf(stderr, "%s: can't open %s\n", progname, outfilename);
|
562
|
-
exit(EXIT_FAILURE);
|
563
|
-
}
|
564
|
-
} else {
|
565
|
-
/* default output file is stdout */
|
566
|
-
output_file = write_stdout();
|
567
|
-
}
|
568
|
-
|
569
|
-
#ifdef PROGRESS_REPORT
|
570
|
-
start_progress_monitor((j_common_ptr) &cinfo, &progress);
|
571
|
-
#endif
|
572
|
-
|
573
|
-
/* Figure out the input file format, and set up to read it. */
|
574
|
-
src_mgr = select_file_type(&cinfo, input_file);
|
575
|
-
src_mgr->input_file = input_file;
|
576
|
-
|
577
|
-
/* Read the input file header to obtain file size & colorspace. */
|
578
|
-
(*src_mgr->start_input) (&cinfo, src_mgr);
|
579
|
-
|
580
|
-
/* Now that we know input colorspace, fix colorspace-dependent defaults */
|
581
|
-
jpeg_default_colorspace(&cinfo);
|
582
|
-
|
583
|
-
/* Adjust default compression parameters by re-parsing the options */
|
584
|
-
file_index = parse_switches(&cinfo, argc, argv, 0, TRUE);
|
585
|
-
|
586
|
-
/* Specify data destination for compression */
|
587
|
-
jpeg_stdio_dest(&cinfo, output_file);
|
588
|
-
|
589
|
-
/* Start compressor */
|
590
|
-
jpeg_start_compress(&cinfo, TRUE);
|
591
|
-
|
592
|
-
/* Process data */
|
593
|
-
while (cinfo.next_scanline < cinfo.image_height) {
|
594
|
-
num_scanlines = (*src_mgr->get_pixel_rows) (&cinfo, src_mgr);
|
595
|
-
(void) jpeg_write_scanlines(&cinfo, src_mgr->buffer, num_scanlines);
|
596
|
-
}
|
597
|
-
|
598
|
-
/* Finish compression and release memory */
|
599
|
-
(*src_mgr->finish_input) (&cinfo, src_mgr);
|
600
|
-
jpeg_finish_compress(&cinfo);
|
601
|
-
jpeg_destroy_compress(&cinfo);
|
602
|
-
|
603
|
-
/* Close files, if we opened them */
|
604
|
-
if (input_file != stdin)
|
605
|
-
fclose(input_file);
|
606
|
-
if (output_file != stdout)
|
607
|
-
fclose(output_file);
|
608
|
-
|
609
|
-
#ifdef PROGRESS_REPORT
|
610
|
-
end_progress_monitor((j_common_ptr) &cinfo);
|
611
|
-
#endif
|
612
|
-
|
613
|
-
/* All done. */
|
614
|
-
exit(jerr.num_warnings ? EXIT_WARNING : EXIT_SUCCESS);
|
615
|
-
return 0; /* suppress no-return-value warnings */
|
616
|
-
}
|