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/rdgif.c
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* rdgif.c
|
3
|
-
*
|
4
|
-
* Copyright (C) 1991-1997, Thomas G. Lane.
|
5
|
-
* This file is part of the Independent JPEG Group's software.
|
6
|
-
* For conditions of distribution and use, see the accompanying README file.
|
7
|
-
*
|
8
|
-
* This file contains routines to read input images in GIF format.
|
9
|
-
*
|
10
|
-
*****************************************************************************
|
11
|
-
* NOTE: to avoid entanglements with Unisys' patent on LZW compression, *
|
12
|
-
* the ability to read GIF files has been removed from the IJG distribution. *
|
13
|
-
* Sorry about that. *
|
14
|
-
*****************************************************************************
|
15
|
-
*
|
16
|
-
* We are required to state that
|
17
|
-
* "The Graphics Interchange Format(c) is the Copyright property of
|
18
|
-
* CompuServe Incorporated. GIF(sm) is a Service Mark property of
|
19
|
-
* CompuServe Incorporated."
|
20
|
-
*/
|
21
|
-
|
22
|
-
#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */
|
23
|
-
|
24
|
-
#ifdef GIF_SUPPORTED
|
25
|
-
|
26
|
-
/*
|
27
|
-
* The module selection routine for GIF format input.
|
28
|
-
*/
|
29
|
-
|
30
|
-
GLOBAL(cjpeg_source_ptr)
|
31
|
-
jinit_read_gif (j_compress_ptr cinfo)
|
32
|
-
{
|
33
|
-
fprintf(stderr, "GIF input is unsupported for legal reasons. Sorry.\n");
|
34
|
-
exit(EXIT_FAILURE);
|
35
|
-
return NULL; /* keep compiler happy */
|
36
|
-
}
|
37
|
-
|
38
|
-
#endif /* GIF_SUPPORTED */
|
data/src/jpeg-7/rdjpgcom.1
DELETED
@@ -1,63 +0,0 @@
|
|
1
|
-
.TH RDJPGCOM 1 "02 April 2009"
|
2
|
-
.SH NAME
|
3
|
-
rdjpgcom \- display text comments from a JPEG file
|
4
|
-
.SH SYNOPSIS
|
5
|
-
.B rdjpgcom
|
6
|
-
[
|
7
|
-
.B \-raw
|
8
|
-
]
|
9
|
-
[
|
10
|
-
.B \-verbose
|
11
|
-
]
|
12
|
-
[
|
13
|
-
.I filename
|
14
|
-
]
|
15
|
-
.LP
|
16
|
-
.SH DESCRIPTION
|
17
|
-
.LP
|
18
|
-
.B rdjpgcom
|
19
|
-
reads the named JPEG/JFIF file, or the standard input if no file is named,
|
20
|
-
and prints any text comments found in the file on the standard output.
|
21
|
-
.PP
|
22
|
-
The JPEG standard allows "comment" (COM) blocks to occur within a JPEG file.
|
23
|
-
Although the standard doesn't actually define what COM blocks are for, they
|
24
|
-
are widely used to hold user-supplied text strings. This lets you add
|
25
|
-
annotations, titles, index terms, etc to your JPEG files, and later retrieve
|
26
|
-
them as text. COM blocks do not interfere with the image stored in the JPEG
|
27
|
-
file. The maximum size of a COM block is 64K, but you can have as many of
|
28
|
-
them as you like in one JPEG file.
|
29
|
-
.SH OPTIONS
|
30
|
-
.TP
|
31
|
-
.B \-raw
|
32
|
-
Normally
|
33
|
-
.B rdjpgcom
|
34
|
-
escapes non-printable characters in comments, for security reasons.
|
35
|
-
This option avoids that.
|
36
|
-
.PP
|
37
|
-
.B \-verbose
|
38
|
-
Causes
|
39
|
-
.B rdjpgcom
|
40
|
-
to also display the JPEG image dimensions.
|
41
|
-
.PP
|
42
|
-
Switch names may be abbreviated, and are not case sensitive.
|
43
|
-
.SH HINTS
|
44
|
-
.B rdjpgcom
|
45
|
-
does not depend on the IJG JPEG library. Its source code is intended as an
|
46
|
-
illustration of the minimum amount of code required to parse a JPEG file
|
47
|
-
header correctly.
|
48
|
-
.PP
|
49
|
-
In
|
50
|
-
.B \-verbose
|
51
|
-
mode,
|
52
|
-
.B rdjpgcom
|
53
|
-
will also attempt to print the contents of any "APP12" markers as text.
|
54
|
-
Some digital cameras produce APP12 markers containing useful textual
|
55
|
-
information. If you like, you can modify the source code to print
|
56
|
-
other APPn marker types as well.
|
57
|
-
.SH SEE ALSO
|
58
|
-
.BR cjpeg (1),
|
59
|
-
.BR djpeg (1),
|
60
|
-
.BR jpegtran (1),
|
61
|
-
.BR wrjpgcom (1)
|
62
|
-
.SH AUTHOR
|
63
|
-
Independent JPEG Group
|
data/src/jpeg-7/rdjpgcom.c
DELETED
@@ -1,515 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* rdjpgcom.c
|
3
|
-
*
|
4
|
-
* Copyright (C) 1994-1997, Thomas G. Lane.
|
5
|
-
* Modified 2009 by Bill Allombert, 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 very simple stand-alone application that displays
|
10
|
-
* the text in COM (comment) markers in a JFIF file.
|
11
|
-
* This may be useful as an example of the minimum logic needed to parse
|
12
|
-
* JPEG markers.
|
13
|
-
*/
|
14
|
-
|
15
|
-
#define JPEG_CJPEG_DJPEG /* to get the command-line config symbols */
|
16
|
-
#include "jinclude.h" /* get auto-config symbols, <stdio.h> */
|
17
|
-
|
18
|
-
#ifdef HAVE_LOCALE_H
|
19
|
-
#include <locale.h> /* Bill Allombert: use locale for isprint */
|
20
|
-
#endif
|
21
|
-
#include <ctype.h> /* to declare isupper(), tolower() */
|
22
|
-
#ifdef USE_SETMODE
|
23
|
-
#include <fcntl.h> /* to declare setmode()'s parameter macros */
|
24
|
-
/* If you have setmode() but not <io.h>, just delete this line: */
|
25
|
-
#include <io.h> /* to declare setmode() */
|
26
|
-
#endif
|
27
|
-
|
28
|
-
#ifdef USE_CCOMMAND /* command-line reader for Macintosh */
|
29
|
-
#ifdef __MWERKS__
|
30
|
-
#include <SIOUX.h> /* Metrowerks needs this */
|
31
|
-
#include <console.h> /* ... and this */
|
32
|
-
#endif
|
33
|
-
#ifdef THINK_C
|
34
|
-
#include <console.h> /* Think declares it here */
|
35
|
-
#endif
|
36
|
-
#endif
|
37
|
-
|
38
|
-
#ifdef DONT_USE_B_MODE /* define mode parameters for fopen() */
|
39
|
-
#define READ_BINARY "r"
|
40
|
-
#else
|
41
|
-
#ifdef VMS /* VMS is very nonstandard */
|
42
|
-
#define READ_BINARY "rb", "ctx=stm"
|
43
|
-
#else /* standard ANSI-compliant case */
|
44
|
-
#define READ_BINARY "rb"
|
45
|
-
#endif
|
46
|
-
#endif
|
47
|
-
|
48
|
-
#ifndef EXIT_FAILURE /* define exit() codes if not provided */
|
49
|
-
#define EXIT_FAILURE 1
|
50
|
-
#endif
|
51
|
-
#ifndef EXIT_SUCCESS
|
52
|
-
#ifdef VMS
|
53
|
-
#define EXIT_SUCCESS 1 /* VMS is very nonstandard */
|
54
|
-
#else
|
55
|
-
#define EXIT_SUCCESS 0
|
56
|
-
#endif
|
57
|
-
#endif
|
58
|
-
|
59
|
-
|
60
|
-
/*
|
61
|
-
* These macros are used to read the input file.
|
62
|
-
* To reuse this code in another application, you might need to change these.
|
63
|
-
*/
|
64
|
-
|
65
|
-
static FILE * infile; /* input JPEG file */
|
66
|
-
|
67
|
-
/* Return next input byte, or EOF if no more */
|
68
|
-
#define NEXTBYTE() getc(infile)
|
69
|
-
|
70
|
-
|
71
|
-
/* Error exit handler */
|
72
|
-
#define ERREXIT(msg) (fprintf(stderr, "%s\n", msg), exit(EXIT_FAILURE))
|
73
|
-
|
74
|
-
|
75
|
-
/* Read one byte, testing for EOF */
|
76
|
-
static int
|
77
|
-
read_1_byte (void)
|
78
|
-
{
|
79
|
-
int c;
|
80
|
-
|
81
|
-
c = NEXTBYTE();
|
82
|
-
if (c == EOF)
|
83
|
-
ERREXIT("Premature EOF in JPEG file");
|
84
|
-
return c;
|
85
|
-
}
|
86
|
-
|
87
|
-
/* Read 2 bytes, convert to unsigned int */
|
88
|
-
/* All 2-byte quantities in JPEG markers are MSB first */
|
89
|
-
static unsigned int
|
90
|
-
read_2_bytes (void)
|
91
|
-
{
|
92
|
-
int c1, c2;
|
93
|
-
|
94
|
-
c1 = NEXTBYTE();
|
95
|
-
if (c1 == EOF)
|
96
|
-
ERREXIT("Premature EOF in JPEG file");
|
97
|
-
c2 = NEXTBYTE();
|
98
|
-
if (c2 == EOF)
|
99
|
-
ERREXIT("Premature EOF in JPEG file");
|
100
|
-
return (((unsigned int) c1) << 8) + ((unsigned int) c2);
|
101
|
-
}
|
102
|
-
|
103
|
-
|
104
|
-
/*
|
105
|
-
* JPEG markers consist of one or more 0xFF bytes, followed by a marker
|
106
|
-
* code byte (which is not an FF). Here are the marker codes of interest
|
107
|
-
* in this program. (See jdmarker.c for a more complete list.)
|
108
|
-
*/
|
109
|
-
|
110
|
-
#define M_SOF0 0xC0 /* Start Of Frame N */
|
111
|
-
#define M_SOF1 0xC1 /* N indicates which compression process */
|
112
|
-
#define M_SOF2 0xC2 /* Only SOF0-SOF2 are now in common use */
|
113
|
-
#define M_SOF3 0xC3
|
114
|
-
#define M_SOF5 0xC5 /* NB: codes C4 and CC are NOT SOF markers */
|
115
|
-
#define M_SOF6 0xC6
|
116
|
-
#define M_SOF7 0xC7
|
117
|
-
#define M_SOF9 0xC9
|
118
|
-
#define M_SOF10 0xCA
|
119
|
-
#define M_SOF11 0xCB
|
120
|
-
#define M_SOF13 0xCD
|
121
|
-
#define M_SOF14 0xCE
|
122
|
-
#define M_SOF15 0xCF
|
123
|
-
#define M_SOI 0xD8 /* Start Of Image (beginning of datastream) */
|
124
|
-
#define M_EOI 0xD9 /* End Of Image (end of datastream) */
|
125
|
-
#define M_SOS 0xDA /* Start Of Scan (begins compressed data) */
|
126
|
-
#define M_APP0 0xE0 /* Application-specific marker, type N */
|
127
|
-
#define M_APP12 0xEC /* (we don't bother to list all 16 APPn's) */
|
128
|
-
#define M_COM 0xFE /* COMment */
|
129
|
-
|
130
|
-
|
131
|
-
/*
|
132
|
-
* Find the next JPEG marker and return its marker code.
|
133
|
-
* We expect at least one FF byte, possibly more if the compressor used FFs
|
134
|
-
* to pad the file.
|
135
|
-
* There could also be non-FF garbage between markers. The treatment of such
|
136
|
-
* garbage is unspecified; we choose to skip over it but emit a warning msg.
|
137
|
-
* NB: this routine must not be used after seeing SOS marker, since it will
|
138
|
-
* not deal correctly with FF/00 sequences in the compressed image data...
|
139
|
-
*/
|
140
|
-
|
141
|
-
static int
|
142
|
-
next_marker (void)
|
143
|
-
{
|
144
|
-
int c;
|
145
|
-
int discarded_bytes = 0;
|
146
|
-
|
147
|
-
/* Find 0xFF byte; count and skip any non-FFs. */
|
148
|
-
c = read_1_byte();
|
149
|
-
while (c != 0xFF) {
|
150
|
-
discarded_bytes++;
|
151
|
-
c = read_1_byte();
|
152
|
-
}
|
153
|
-
/* Get marker code byte, swallowing any duplicate FF bytes. Extra FFs
|
154
|
-
* are legal as pad bytes, so don't count them in discarded_bytes.
|
155
|
-
*/
|
156
|
-
do {
|
157
|
-
c = read_1_byte();
|
158
|
-
} while (c == 0xFF);
|
159
|
-
|
160
|
-
if (discarded_bytes != 0) {
|
161
|
-
fprintf(stderr, "Warning: garbage data found in JPEG file\n");
|
162
|
-
}
|
163
|
-
|
164
|
-
return c;
|
165
|
-
}
|
166
|
-
|
167
|
-
|
168
|
-
/*
|
169
|
-
* Read the initial marker, which should be SOI.
|
170
|
-
* For a JFIF file, the first two bytes of the file should be literally
|
171
|
-
* 0xFF M_SOI. To be more general, we could use next_marker, but if the
|
172
|
-
* input file weren't actually JPEG at all, next_marker might read the whole
|
173
|
-
* file and then return a misleading error message...
|
174
|
-
*/
|
175
|
-
|
176
|
-
static int
|
177
|
-
first_marker (void)
|
178
|
-
{
|
179
|
-
int c1, c2;
|
180
|
-
|
181
|
-
c1 = NEXTBYTE();
|
182
|
-
c2 = NEXTBYTE();
|
183
|
-
if (c1 != 0xFF || c2 != M_SOI)
|
184
|
-
ERREXIT("Not a JPEG file");
|
185
|
-
return c2;
|
186
|
-
}
|
187
|
-
|
188
|
-
|
189
|
-
/*
|
190
|
-
* Most types of marker are followed by a variable-length parameter segment.
|
191
|
-
* This routine skips over the parameters for any marker we don't otherwise
|
192
|
-
* want to process.
|
193
|
-
* Note that we MUST skip the parameter segment explicitly in order not to
|
194
|
-
* be fooled by 0xFF bytes that might appear within the parameter segment;
|
195
|
-
* such bytes do NOT introduce new markers.
|
196
|
-
*/
|
197
|
-
|
198
|
-
static void
|
199
|
-
skip_variable (void)
|
200
|
-
/* Skip over an unknown or uninteresting variable-length marker */
|
201
|
-
{
|
202
|
-
unsigned int length;
|
203
|
-
|
204
|
-
/* Get the marker parameter length count */
|
205
|
-
length = read_2_bytes();
|
206
|
-
/* Length includes itself, so must be at least 2 */
|
207
|
-
if (length < 2)
|
208
|
-
ERREXIT("Erroneous JPEG marker length");
|
209
|
-
length -= 2;
|
210
|
-
/* Skip over the remaining bytes */
|
211
|
-
while (length > 0) {
|
212
|
-
(void) read_1_byte();
|
213
|
-
length--;
|
214
|
-
}
|
215
|
-
}
|
216
|
-
|
217
|
-
|
218
|
-
/*
|
219
|
-
* Process a COM marker.
|
220
|
-
* We want to print out the marker contents as legible text;
|
221
|
-
* we must guard against non-text junk and varying newline representations.
|
222
|
-
*/
|
223
|
-
|
224
|
-
static void
|
225
|
-
process_COM (int raw)
|
226
|
-
{
|
227
|
-
unsigned int length;
|
228
|
-
int ch;
|
229
|
-
int lastch = 0;
|
230
|
-
|
231
|
-
/* Bill Allombert: set locale properly for isprint */
|
232
|
-
#ifdef HAVE_LOCALE_H
|
233
|
-
setlocale(LC_CTYPE, "");
|
234
|
-
#endif
|
235
|
-
|
236
|
-
/* Get the marker parameter length count */
|
237
|
-
length = read_2_bytes();
|
238
|
-
/* Length includes itself, so must be at least 2 */
|
239
|
-
if (length < 2)
|
240
|
-
ERREXIT("Erroneous JPEG marker length");
|
241
|
-
length -= 2;
|
242
|
-
|
243
|
-
while (length > 0) {
|
244
|
-
ch = read_1_byte();
|
245
|
-
if (raw) {
|
246
|
-
putc(ch, stdout);
|
247
|
-
/* Emit the character in a readable form.
|
248
|
-
* Nonprintables are converted to \nnn form,
|
249
|
-
* while \ is converted to \\.
|
250
|
-
* Newlines in CR, CR/LF, or LF form will be printed as one newline.
|
251
|
-
*/
|
252
|
-
} else if (ch == '\r') {
|
253
|
-
printf("\n");
|
254
|
-
} else if (ch == '\n') {
|
255
|
-
if (lastch != '\r')
|
256
|
-
printf("\n");
|
257
|
-
} else if (ch == '\\') {
|
258
|
-
printf("\\\\");
|
259
|
-
} else if (isprint(ch)) {
|
260
|
-
putc(ch, stdout);
|
261
|
-
} else {
|
262
|
-
printf("\\%03o", ch);
|
263
|
-
}
|
264
|
-
lastch = ch;
|
265
|
-
length--;
|
266
|
-
}
|
267
|
-
printf("\n");
|
268
|
-
|
269
|
-
/* Bill Allombert: revert to C locale */
|
270
|
-
#ifdef HAVE_LOCALE_H
|
271
|
-
setlocale(LC_CTYPE, "C");
|
272
|
-
#endif
|
273
|
-
}
|
274
|
-
|
275
|
-
|
276
|
-
/*
|
277
|
-
* Process a SOFn marker.
|
278
|
-
* This code is only needed if you want to know the image dimensions...
|
279
|
-
*/
|
280
|
-
|
281
|
-
static void
|
282
|
-
process_SOFn (int marker)
|
283
|
-
{
|
284
|
-
unsigned int length;
|
285
|
-
unsigned int image_height, image_width;
|
286
|
-
int data_precision, num_components;
|
287
|
-
const char * process;
|
288
|
-
int ci;
|
289
|
-
|
290
|
-
length = read_2_bytes(); /* usual parameter length count */
|
291
|
-
|
292
|
-
data_precision = read_1_byte();
|
293
|
-
image_height = read_2_bytes();
|
294
|
-
image_width = read_2_bytes();
|
295
|
-
num_components = read_1_byte();
|
296
|
-
|
297
|
-
switch (marker) {
|
298
|
-
case M_SOF0: process = "Baseline"; break;
|
299
|
-
case M_SOF1: process = "Extended sequential"; break;
|
300
|
-
case M_SOF2: process = "Progressive"; break;
|
301
|
-
case M_SOF3: process = "Lossless"; break;
|
302
|
-
case M_SOF5: process = "Differential sequential"; break;
|
303
|
-
case M_SOF6: process = "Differential progressive"; break;
|
304
|
-
case M_SOF7: process = "Differential lossless"; break;
|
305
|
-
case M_SOF9: process = "Extended sequential, arithmetic coding"; break;
|
306
|
-
case M_SOF10: process = "Progressive, arithmetic coding"; break;
|
307
|
-
case M_SOF11: process = "Lossless, arithmetic coding"; break;
|
308
|
-
case M_SOF13: process = "Differential sequential, arithmetic coding"; break;
|
309
|
-
case M_SOF14: process = "Differential progressive, arithmetic coding"; break;
|
310
|
-
case M_SOF15: process = "Differential lossless, arithmetic coding"; break;
|
311
|
-
default: process = "Unknown"; break;
|
312
|
-
}
|
313
|
-
|
314
|
-
printf("JPEG image is %uw * %uh, %d color components, %d bits per sample\n",
|
315
|
-
image_width, image_height, num_components, data_precision);
|
316
|
-
printf("JPEG process: %s\n", process);
|
317
|
-
|
318
|
-
if (length != (unsigned int) (8 + num_components * 3))
|
319
|
-
ERREXIT("Bogus SOF marker length");
|
320
|
-
|
321
|
-
for (ci = 0; ci < num_components; ci++) {
|
322
|
-
(void) read_1_byte(); /* Component ID code */
|
323
|
-
(void) read_1_byte(); /* H, V sampling factors */
|
324
|
-
(void) read_1_byte(); /* Quantization table number */
|
325
|
-
}
|
326
|
-
}
|
327
|
-
|
328
|
-
|
329
|
-
/*
|
330
|
-
* Parse the marker stream until SOS or EOI is seen;
|
331
|
-
* display any COM markers.
|
332
|
-
* While the companion program wrjpgcom will always insert COM markers before
|
333
|
-
* SOFn, other implementations might not, so we scan to SOS before stopping.
|
334
|
-
* If we were only interested in the image dimensions, we would stop at SOFn.
|
335
|
-
* (Conversely, if we only cared about COM markers, there would be no need
|
336
|
-
* for special code to handle SOFn; we could treat it like other markers.)
|
337
|
-
*/
|
338
|
-
|
339
|
-
static int
|
340
|
-
scan_JPEG_header (int verbose, int raw)
|
341
|
-
{
|
342
|
-
int marker;
|
343
|
-
|
344
|
-
/* Expect SOI at start of file */
|
345
|
-
if (first_marker() != M_SOI)
|
346
|
-
ERREXIT("Expected SOI marker first");
|
347
|
-
|
348
|
-
/* Scan miscellaneous markers until we reach SOS. */
|
349
|
-
for (;;) {
|
350
|
-
marker = next_marker();
|
351
|
-
switch (marker) {
|
352
|
-
/* Note that marker codes 0xC4, 0xC8, 0xCC are not, and must not be,
|
353
|
-
* treated as SOFn. C4 in particular is actually DHT.
|
354
|
-
*/
|
355
|
-
case M_SOF0: /* Baseline */
|
356
|
-
case M_SOF1: /* Extended sequential, Huffman */
|
357
|
-
case M_SOF2: /* Progressive, Huffman */
|
358
|
-
case M_SOF3: /* Lossless, Huffman */
|
359
|
-
case M_SOF5: /* Differential sequential, Huffman */
|
360
|
-
case M_SOF6: /* Differential progressive, Huffman */
|
361
|
-
case M_SOF7: /* Differential lossless, Huffman */
|
362
|
-
case M_SOF9: /* Extended sequential, arithmetic */
|
363
|
-
case M_SOF10: /* Progressive, arithmetic */
|
364
|
-
case M_SOF11: /* Lossless, arithmetic */
|
365
|
-
case M_SOF13: /* Differential sequential, arithmetic */
|
366
|
-
case M_SOF14: /* Differential progressive, arithmetic */
|
367
|
-
case M_SOF15: /* Differential lossless, arithmetic */
|
368
|
-
if (verbose)
|
369
|
-
process_SOFn(marker);
|
370
|
-
else
|
371
|
-
skip_variable();
|
372
|
-
break;
|
373
|
-
|
374
|
-
case M_SOS: /* stop before hitting compressed data */
|
375
|
-
return marker;
|
376
|
-
|
377
|
-
case M_EOI: /* in case it's a tables-only JPEG stream */
|
378
|
-
return marker;
|
379
|
-
|
380
|
-
case M_COM:
|
381
|
-
process_COM(raw);
|
382
|
-
break;
|
383
|
-
|
384
|
-
case M_APP12:
|
385
|
-
/* Some digital camera makers put useful textual information into
|
386
|
-
* APP12 markers, so we print those out too when in -verbose mode.
|
387
|
-
*/
|
388
|
-
if (verbose) {
|
389
|
-
printf("APP12 contains:\n");
|
390
|
-
process_COM(raw);
|
391
|
-
} else
|
392
|
-
skip_variable();
|
393
|
-
break;
|
394
|
-
|
395
|
-
default: /* Anything else just gets skipped */
|
396
|
-
skip_variable(); /* we assume it has a parameter count... */
|
397
|
-
break;
|
398
|
-
}
|
399
|
-
} /* end loop */
|
400
|
-
}
|
401
|
-
|
402
|
-
|
403
|
-
/* Command line parsing code */
|
404
|
-
|
405
|
-
static const char * progname; /* program name for error messages */
|
406
|
-
|
407
|
-
|
408
|
-
static void
|
409
|
-
usage (void)
|
410
|
-
/* complain about bad command line */
|
411
|
-
{
|
412
|
-
fprintf(stderr, "rdjpgcom displays any textual comments in a JPEG file.\n");
|
413
|
-
|
414
|
-
fprintf(stderr, "Usage: %s [switches] [inputfile]\n", progname);
|
415
|
-
|
416
|
-
fprintf(stderr, "Switches (names may be abbreviated):\n");
|
417
|
-
fprintf(stderr, " -raw Display non-printable characters in comments (unsafe)\n");
|
418
|
-
fprintf(stderr, " -verbose Also display dimensions of JPEG image\n");
|
419
|
-
|
420
|
-
exit(EXIT_FAILURE);
|
421
|
-
}
|
422
|
-
|
423
|
-
|
424
|
-
static int
|
425
|
-
keymatch (char * arg, const char * keyword, int minchars)
|
426
|
-
/* Case-insensitive matching of (possibly abbreviated) keyword switches. */
|
427
|
-
/* keyword is the constant keyword (must be lower case already), */
|
428
|
-
/* minchars is length of minimum legal abbreviation. */
|
429
|
-
{
|
430
|
-
register int ca, ck;
|
431
|
-
register int nmatched = 0;
|
432
|
-
|
433
|
-
while ((ca = *arg++) != '\0') {
|
434
|
-
if ((ck = *keyword++) == '\0')
|
435
|
-
return 0; /* arg longer than keyword, no good */
|
436
|
-
if (isupper(ca)) /* force arg to lcase (assume ck is already) */
|
437
|
-
ca = tolower(ca);
|
438
|
-
if (ca != ck)
|
439
|
-
return 0; /* no good */
|
440
|
-
nmatched++; /* count matched characters */
|
441
|
-
}
|
442
|
-
/* reached end of argument; fail if it's too short for unique abbrev */
|
443
|
-
if (nmatched < minchars)
|
444
|
-
return 0;
|
445
|
-
return 1; /* A-OK */
|
446
|
-
}
|
447
|
-
|
448
|
-
|
449
|
-
/*
|
450
|
-
* The main program.
|
451
|
-
*/
|
452
|
-
|
453
|
-
int
|
454
|
-
main (int argc, char **argv)
|
455
|
-
{
|
456
|
-
int argn;
|
457
|
-
char * arg;
|
458
|
-
int verbose = 0, raw = 0;
|
459
|
-
|
460
|
-
/* On Mac, fetch a command line. */
|
461
|
-
#ifdef USE_CCOMMAND
|
462
|
-
argc = ccommand(&argv);
|
463
|
-
#endif
|
464
|
-
|
465
|
-
progname = argv[0];
|
466
|
-
if (progname == NULL || progname[0] == 0)
|
467
|
-
progname = "rdjpgcom"; /* in case C library doesn't provide it */
|
468
|
-
|
469
|
-
/* Parse switches, if any */
|
470
|
-
for (argn = 1; argn < argc; argn++) {
|
471
|
-
arg = argv[argn];
|
472
|
-
if (arg[0] != '-')
|
473
|
-
break; /* not switch, must be file name */
|
474
|
-
arg++; /* advance over '-' */
|
475
|
-
if (keymatch(arg, "verbose", 1)) {
|
476
|
-
verbose++;
|
477
|
-
} else if (keymatch(arg, "raw", 1)) {
|
478
|
-
raw = 1;
|
479
|
-
} else
|
480
|
-
usage();
|
481
|
-
}
|
482
|
-
|
483
|
-
/* Open the input file. */
|
484
|
-
/* Unix style: expect zero or one file name */
|
485
|
-
if (argn < argc-1) {
|
486
|
-
fprintf(stderr, "%s: only one input file\n", progname);
|
487
|
-
usage();
|
488
|
-
}
|
489
|
-
if (argn < argc) {
|
490
|
-
if ((infile = fopen(argv[argn], READ_BINARY)) == NULL) {
|
491
|
-
fprintf(stderr, "%s: can't open %s\n", progname, argv[argn]);
|
492
|
-
exit(EXIT_FAILURE);
|
493
|
-
}
|
494
|
-
} else {
|
495
|
-
/* default input file is stdin */
|
496
|
-
#ifdef USE_SETMODE /* need to hack file mode? */
|
497
|
-
setmode(fileno(stdin), O_BINARY);
|
498
|
-
#endif
|
499
|
-
#ifdef USE_FDOPEN /* need to re-open in binary mode? */
|
500
|
-
if ((infile = fdopen(fileno(stdin), READ_BINARY)) == NULL) {
|
501
|
-
fprintf(stderr, "%s: can't open stdin\n", progname);
|
502
|
-
exit(EXIT_FAILURE);
|
503
|
-
}
|
504
|
-
#else
|
505
|
-
infile = stdin;
|
506
|
-
#endif
|
507
|
-
}
|
508
|
-
|
509
|
-
/* Scan the JPEG headers. */
|
510
|
-
(void) scan_JPEG_header(verbose, raw);
|
511
|
-
|
512
|
-
/* All done. */
|
513
|
-
exit(EXIT_SUCCESS);
|
514
|
-
return 0; /* suppress no-return-value warnings */
|
515
|
-
}
|