isbn 2.0.4 → 2.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (288) hide show
  1. data/{README → README.md} +5 -11
  2. data/Rakefile +20 -14
  3. data/isbn.gemspec +23 -0
  4. data/lib/isbn.rb +2 -0
  5. data/test/isbn_spec.rb +1 -1
  6. metadata +29 -316
  7. data/VERSION +0 -1
  8. data/src/gocr-0.48/.cvsignore +0 -6
  9. data/src/gocr-0.48/AUTHORS +0 -7
  10. data/src/gocr-0.48/BUGS +0 -55
  11. data/src/gocr-0.48/CREDITS +0 -17
  12. data/src/gocr-0.48/HISTORY +0 -243
  13. data/src/gocr-0.48/INSTALL +0 -83
  14. data/src/gocr-0.48/Makefile +0 -193
  15. data/src/gocr-0.48/Makefile.in +0 -193
  16. data/src/gocr-0.48/README +0 -165
  17. data/src/gocr-0.48/READMEde.txt +0 -80
  18. data/src/gocr-0.48/REMARK.txt +0 -18
  19. data/src/gocr-0.48/REVIEW +0 -538
  20. data/src/gocr-0.48/TODO +0 -65
  21. data/src/gocr-0.48/bin/.cvsignore +0 -2
  22. data/src/gocr-0.48/bin/create_db +0 -38
  23. data/src/gocr-0.48/bin/gocr.tcl +0 -527
  24. data/src/gocr-0.48/bin/gocr_chk.sh +0 -44
  25. data/src/gocr-0.48/configure +0 -4689
  26. data/src/gocr-0.48/configure.in +0 -71
  27. data/src/gocr-0.48/doc/.#Makefile.1.6 +0 -39
  28. data/src/gocr-0.48/doc/.cvsignore +0 -2
  29. data/src/gocr-0.48/doc/Makefile +0 -39
  30. data/src/gocr-0.48/doc/Makefile.in +0 -39
  31. data/src/gocr-0.48/doc/example.dtd +0 -53
  32. data/src/gocr-0.48/doc/example.xml +0 -21
  33. data/src/gocr-0.48/doc/examples.txt +0 -67
  34. data/src/gocr-0.48/doc/gocr.html +0 -578
  35. data/src/gocr-0.48/doc/unicode.txt +0 -57
  36. data/src/gocr-0.48/examples/.#Makefile.1.22 +0 -166
  37. data/src/gocr-0.48/examples/4x6.png +0 -0
  38. data/src/gocr-0.48/examples/4x6.txt +0 -2
  39. data/src/gocr-0.48/examples/5x7.png +0 -0
  40. data/src/gocr-0.48/examples/5x7.png.txt +0 -2
  41. data/src/gocr-0.48/examples/5x8.png +0 -0
  42. data/src/gocr-0.48/examples/5x8.png.txt +0 -2
  43. data/src/gocr-0.48/examples/Makefile +0 -166
  44. data/src/gocr-0.48/examples/color.fig +0 -20
  45. data/src/gocr-0.48/examples/ex.fig +0 -16
  46. data/src/gocr-0.48/examples/font.tex +0 -22
  47. data/src/gocr-0.48/examples/font1.tex +0 -46
  48. data/src/gocr-0.48/examples/font2.fig +0 -27
  49. data/src/gocr-0.48/examples/font_nw.tex +0 -24
  50. data/src/gocr-0.48/examples/handwrt1.jpg +0 -0
  51. data/src/gocr-0.48/examples/handwrt1.txt +0 -10
  52. data/src/gocr-0.48/examples/inverse.fig +0 -20
  53. data/src/gocr-0.48/examples/matrix.jpg +0 -0
  54. data/src/gocr-0.48/examples/ocr-a-subset.png +0 -0
  55. data/src/gocr-0.48/examples/ocr-a-subset.png.txt +0 -4
  56. data/src/gocr-0.48/examples/ocr-a.png +0 -0
  57. data/src/gocr-0.48/examples/ocr-a.txt +0 -6
  58. data/src/gocr-0.48/examples/ocr-b.png +0 -0
  59. data/src/gocr-0.48/examples/ocr-b.png.txt +0 -4
  60. data/src/gocr-0.48/examples/polish.tex +0 -28
  61. data/src/gocr-0.48/examples/rotate45.fig +0 -14
  62. data/src/gocr-0.48/examples/score +0 -36
  63. data/src/gocr-0.48/examples/text.tex +0 -28
  64. data/src/gocr-0.48/gpl.html +0 -537
  65. data/src/gocr-0.48/include/.cvsignore +0 -2
  66. data/src/gocr-0.48/include/config.h +0 -36
  67. data/src/gocr-0.48/include/config.h.in +0 -36
  68. data/src/gocr-0.48/include/version.h +0 -2
  69. data/src/gocr-0.48/install-sh +0 -3
  70. data/src/gocr-0.48/make.bat +0 -57
  71. data/src/gocr-0.48/man/.cvsignore +0 -2
  72. data/src/gocr-0.48/man/Makefile +0 -29
  73. data/src/gocr-0.48/man/Makefile.in +0 -29
  74. data/src/gocr-0.48/man/man1/gocr.1 +0 -166
  75. data/src/gocr-0.48/src/.cvsignore +0 -4
  76. data/src/gocr-0.48/src/Makefile +0 -132
  77. data/src/gocr-0.48/src/Makefile.in +0 -132
  78. data/src/gocr-0.48/src/amiga.h +0 -31
  79. data/src/gocr-0.48/src/barcode.c +0 -846
  80. data/src/gocr-0.48/src/barcode.c.orig +0 -593
  81. data/src/gocr-0.48/src/barcode.h +0 -11
  82. data/src/gocr-0.48/src/box.c +0 -372
  83. data/src/gocr-0.48/src/database.c +0 -462
  84. data/src/gocr-0.48/src/detect.c +0 -943
  85. data/src/gocr-0.48/src/gocr.c +0 -373
  86. data/src/gocr-0.48/src/gocr.h +0 -288
  87. data/src/gocr-0.48/src/jconv.c +0 -168
  88. data/src/gocr-0.48/src/job.c +0 -84
  89. data/src/gocr-0.48/src/lines.c +0 -350
  90. data/src/gocr-0.48/src/list.c +0 -334
  91. data/src/gocr-0.48/src/list.h +0 -90
  92. data/src/gocr-0.48/src/ocr0.c +0 -6756
  93. data/src/gocr-0.48/src/ocr0.h +0 -63
  94. data/src/gocr-0.48/src/ocr0n.c +0 -1475
  95. data/src/gocr-0.48/src/ocr1.c +0 -85
  96. data/src/gocr-0.48/src/ocr1.h +0 -3
  97. data/src/gocr-0.48/src/otsu.c +0 -289
  98. data/src/gocr-0.48/src/otsu.h +0 -23
  99. data/src/gocr-0.48/src/output.c +0 -289
  100. data/src/gocr-0.48/src/output.h +0 -37
  101. data/src/gocr-0.48/src/pcx.c +0 -153
  102. data/src/gocr-0.48/src/pcx.h +0 -9
  103. data/src/gocr-0.48/src/pgm2asc.c +0 -2893
  104. data/src/gocr-0.48/src/pgm2asc.h +0 -105
  105. data/src/gocr-0.48/src/pixel.c +0 -537
  106. data/src/gocr-0.48/src/pnm.c +0 -533
  107. data/src/gocr-0.48/src/pnm.h +0 -35
  108. data/src/gocr-0.48/src/progress.c +0 -87
  109. data/src/gocr-0.48/src/progress.h +0 -42
  110. data/src/gocr-0.48/src/remove.c +0 -703
  111. data/src/gocr-0.48/src/tga.c +0 -87
  112. data/src/gocr-0.48/src/tga.h +0 -6
  113. data/src/gocr-0.48/src/unicode.c +0 -1314
  114. data/src/gocr-0.48/src/unicode.h +0 -1257
  115. data/src/jpeg-7/Makefile.am +0 -133
  116. data/src/jpeg-7/Makefile.in +0 -1089
  117. data/src/jpeg-7/README +0 -322
  118. data/src/jpeg-7/aclocal.m4 +0 -8990
  119. data/src/jpeg-7/ansi2knr.1 +0 -36
  120. data/src/jpeg-7/ansi2knr.c +0 -739
  121. data/src/jpeg-7/cderror.h +0 -132
  122. data/src/jpeg-7/cdjpeg.c +0 -181
  123. data/src/jpeg-7/cdjpeg.h +0 -187
  124. data/src/jpeg-7/change.log +0 -270
  125. data/src/jpeg-7/cjpeg.1 +0 -325
  126. data/src/jpeg-7/cjpeg.c +0 -616
  127. data/src/jpeg-7/ckconfig.c +0 -402
  128. data/src/jpeg-7/coderules.txt +0 -118
  129. data/src/jpeg-7/config.guess +0 -1561
  130. data/src/jpeg-7/config.sub +0 -1686
  131. data/src/jpeg-7/configure +0 -17139
  132. data/src/jpeg-7/configure.ac +0 -317
  133. data/src/jpeg-7/depcomp +0 -630
  134. data/src/jpeg-7/djpeg.1 +0 -251
  135. data/src/jpeg-7/djpeg.c +0 -617
  136. data/src/jpeg-7/example.c +0 -433
  137. data/src/jpeg-7/filelist.txt +0 -215
  138. data/src/jpeg-7/install-sh +0 -520
  139. data/src/jpeg-7/install.txt +0 -1097
  140. data/src/jpeg-7/jaricom.c +0 -148
  141. data/src/jpeg-7/jcapimin.c +0 -282
  142. data/src/jpeg-7/jcapistd.c +0 -161
  143. data/src/jpeg-7/jcarith.c +0 -921
  144. data/src/jpeg-7/jccoefct.c +0 -453
  145. data/src/jpeg-7/jccolor.c +0 -459
  146. data/src/jpeg-7/jcdctmgr.c +0 -482
  147. data/src/jpeg-7/jchuff.c +0 -1612
  148. data/src/jpeg-7/jcinit.c +0 -65
  149. data/src/jpeg-7/jcmainct.c +0 -293
  150. data/src/jpeg-7/jcmarker.c +0 -667
  151. data/src/jpeg-7/jcmaster.c +0 -770
  152. data/src/jpeg-7/jcomapi.c +0 -106
  153. data/src/jpeg-7/jconfig.bcc +0 -48
  154. data/src/jpeg-7/jconfig.cfg +0 -45
  155. data/src/jpeg-7/jconfig.dj +0 -38
  156. data/src/jpeg-7/jconfig.mac +0 -43
  157. data/src/jpeg-7/jconfig.manx +0 -43
  158. data/src/jpeg-7/jconfig.mc6 +0 -52
  159. data/src/jpeg-7/jconfig.sas +0 -43
  160. data/src/jpeg-7/jconfig.st +0 -42
  161. data/src/jpeg-7/jconfig.txt +0 -155
  162. data/src/jpeg-7/jconfig.vc +0 -45
  163. data/src/jpeg-7/jconfig.vms +0 -37
  164. data/src/jpeg-7/jconfig.wat +0 -38
  165. data/src/jpeg-7/jcparam.c +0 -632
  166. data/src/jpeg-7/jcprepct.c +0 -358
  167. data/src/jpeg-7/jcsample.c +0 -545
  168. data/src/jpeg-7/jctrans.c +0 -381
  169. data/src/jpeg-7/jdapimin.c +0 -396
  170. data/src/jpeg-7/jdapistd.c +0 -275
  171. data/src/jpeg-7/jdarith.c +0 -762
  172. data/src/jpeg-7/jdatadst.c +0 -151
  173. data/src/jpeg-7/jdatasrc.c +0 -212
  174. data/src/jpeg-7/jdcoefct.c +0 -736
  175. data/src/jpeg-7/jdcolor.c +0 -396
  176. data/src/jpeg-7/jdct.h +0 -393
  177. data/src/jpeg-7/jddctmgr.c +0 -382
  178. data/src/jpeg-7/jdhuff.c +0 -1309
  179. data/src/jpeg-7/jdinput.c +0 -384
  180. data/src/jpeg-7/jdmainct.c +0 -512
  181. data/src/jpeg-7/jdmarker.c +0 -1360
  182. data/src/jpeg-7/jdmaster.c +0 -663
  183. data/src/jpeg-7/jdmerge.c +0 -400
  184. data/src/jpeg-7/jdpostct.c +0 -290
  185. data/src/jpeg-7/jdsample.c +0 -361
  186. data/src/jpeg-7/jdtrans.c +0 -136
  187. data/src/jpeg-7/jerror.c +0 -252
  188. data/src/jpeg-7/jerror.h +0 -304
  189. data/src/jpeg-7/jfdctflt.c +0 -174
  190. data/src/jpeg-7/jfdctfst.c +0 -230
  191. data/src/jpeg-7/jfdctint.c +0 -4348
  192. data/src/jpeg-7/jidctflt.c +0 -242
  193. data/src/jpeg-7/jidctfst.c +0 -368
  194. data/src/jpeg-7/jidctint.c +0 -5137
  195. data/src/jpeg-7/jinclude.h +0 -91
  196. data/src/jpeg-7/jmemansi.c +0 -167
  197. data/src/jpeg-7/jmemdos.c +0 -638
  198. data/src/jpeg-7/jmemdosa.asm +0 -379
  199. data/src/jpeg-7/jmemmac.c +0 -289
  200. data/src/jpeg-7/jmemmgr.c +0 -1118
  201. data/src/jpeg-7/jmemname.c +0 -276
  202. data/src/jpeg-7/jmemnobs.c +0 -109
  203. data/src/jpeg-7/jmemsys.h +0 -198
  204. data/src/jpeg-7/jmorecfg.h +0 -369
  205. data/src/jpeg-7/jpegint.h +0 -395
  206. data/src/jpeg-7/jpeglib.h +0 -1135
  207. data/src/jpeg-7/jpegtran.1 +0 -272
  208. data/src/jpeg-7/jpegtran.c +0 -546
  209. data/src/jpeg-7/jquant1.c +0 -856
  210. data/src/jpeg-7/jquant2.c +0 -1310
  211. data/src/jpeg-7/jutils.c +0 -179
  212. data/src/jpeg-7/jversion.h +0 -14
  213. data/src/jpeg-7/libjpeg.map +0 -4
  214. data/src/jpeg-7/libjpeg.txt +0 -3067
  215. data/src/jpeg-7/ltmain.sh +0 -8406
  216. data/src/jpeg-7/makcjpeg.st +0 -36
  217. data/src/jpeg-7/makdjpeg.st +0 -36
  218. data/src/jpeg-7/makeadsw.vc6 +0 -77
  219. data/src/jpeg-7/makeasln.vc9 +0 -33
  220. data/src/jpeg-7/makecdep.vc6 +0 -82
  221. data/src/jpeg-7/makecdsp.vc6 +0 -130
  222. data/src/jpeg-7/makecmak.vc6 +0 -159
  223. data/src/jpeg-7/makecvcp.vc9 +0 -186
  224. data/src/jpeg-7/makeddep.vc6 +0 -82
  225. data/src/jpeg-7/makeddsp.vc6 +0 -130
  226. data/src/jpeg-7/makedmak.vc6 +0 -159
  227. data/src/jpeg-7/makedvcp.vc9 +0 -186
  228. data/src/jpeg-7/makefile.ansi +0 -220
  229. data/src/jpeg-7/makefile.bcc +0 -291
  230. data/src/jpeg-7/makefile.dj +0 -226
  231. data/src/jpeg-7/makefile.manx +0 -220
  232. data/src/jpeg-7/makefile.mc6 +0 -255
  233. data/src/jpeg-7/makefile.mms +0 -224
  234. data/src/jpeg-7/makefile.sas +0 -258
  235. data/src/jpeg-7/makefile.unix +0 -234
  236. data/src/jpeg-7/makefile.vc +0 -217
  237. data/src/jpeg-7/makefile.vms +0 -142
  238. data/src/jpeg-7/makefile.wat +0 -239
  239. data/src/jpeg-7/makejdep.vc6 +0 -423
  240. data/src/jpeg-7/makejdsp.vc6 +0 -285
  241. data/src/jpeg-7/makejdsw.vc6 +0 -29
  242. data/src/jpeg-7/makejmak.vc6 +0 -425
  243. data/src/jpeg-7/makejsln.vc9 +0 -17
  244. data/src/jpeg-7/makejvcp.vc9 +0 -328
  245. data/src/jpeg-7/makeproj.mac +0 -213
  246. data/src/jpeg-7/makerdep.vc6 +0 -6
  247. data/src/jpeg-7/makerdsp.vc6 +0 -78
  248. data/src/jpeg-7/makermak.vc6 +0 -110
  249. data/src/jpeg-7/makervcp.vc9 +0 -133
  250. data/src/jpeg-7/maketdep.vc6 +0 -43
  251. data/src/jpeg-7/maketdsp.vc6 +0 -122
  252. data/src/jpeg-7/maketmak.vc6 +0 -131
  253. data/src/jpeg-7/maketvcp.vc9 +0 -178
  254. data/src/jpeg-7/makewdep.vc6 +0 -6
  255. data/src/jpeg-7/makewdsp.vc6 +0 -78
  256. data/src/jpeg-7/makewmak.vc6 +0 -110
  257. data/src/jpeg-7/makewvcp.vc9 +0 -133
  258. data/src/jpeg-7/makljpeg.st +0 -68
  259. data/src/jpeg-7/maktjpeg.st +0 -30
  260. data/src/jpeg-7/makvms.opt +0 -4
  261. data/src/jpeg-7/missing +0 -376
  262. data/src/jpeg-7/rdbmp.c +0 -439
  263. data/src/jpeg-7/rdcolmap.c +0 -253
  264. data/src/jpeg-7/rdgif.c +0 -38
  265. data/src/jpeg-7/rdjpgcom.1 +0 -63
  266. data/src/jpeg-7/rdjpgcom.c +0 -515
  267. data/src/jpeg-7/rdppm.c +0 -459
  268. data/src/jpeg-7/rdrle.c +0 -387
  269. data/src/jpeg-7/rdswitch.c +0 -365
  270. data/src/jpeg-7/rdtarga.c +0 -500
  271. data/src/jpeg-7/structure.txt +0 -945
  272. data/src/jpeg-7/testimg.bmp +0 -0
  273. data/src/jpeg-7/testimg.jpg +0 -0
  274. data/src/jpeg-7/testimg.ppm +0 -4
  275. data/src/jpeg-7/testimgp.jpg +0 -0
  276. data/src/jpeg-7/testorig.jpg +0 -0
  277. data/src/jpeg-7/testprog.jpg +0 -0
  278. data/src/jpeg-7/transupp.c +0 -1533
  279. data/src/jpeg-7/transupp.h +0 -205
  280. data/src/jpeg-7/usage.txt +0 -605
  281. data/src/jpeg-7/wizard.txt +0 -211
  282. data/src/jpeg-7/wrbmp.c +0 -442
  283. data/src/jpeg-7/wrgif.c +0 -399
  284. data/src/jpeg-7/wrjpgcom.1 +0 -103
  285. data/src/jpeg-7/wrjpgcom.c +0 -583
  286. data/src/jpeg-7/wrppm.c +0 -269
  287. data/src/jpeg-7/wrrle.c +0 -305
  288. data/src/jpeg-7/wrtarga.c +0 -253
data/src/jpeg-7/rdrle.c DELETED
@@ -1,387 +0,0 @@
1
- /*
2
- * rdrle.c
3
- *
4
- * Copyright (C) 1991-1996, 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 Utah RLE format.
9
- * The Utah Raster Toolkit library is required (version 3.1 or later).
10
- *
11
- * These routines may need modification for non-Unix environments or
12
- * specialized applications. As they stand, they assume input from
13
- * an ordinary stdio stream. They further assume that reading begins
14
- * at the start of the file; start_input may need work if the
15
- * user interface has already read some data (e.g., to determine that
16
- * the file is indeed RLE format).
17
- *
18
- * Based on code contributed by Mike Lijewski,
19
- * with updates from Robert Hutchinson.
20
- */
21
-
22
- #include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */
23
-
24
- #ifdef RLE_SUPPORTED
25
-
26
- /* rle.h is provided by the Utah Raster Toolkit. */
27
-
28
- #include <rle.h>
29
-
30
- /*
31
- * We assume that JSAMPLE has the same representation as rle_pixel,
32
- * to wit, "unsigned char". Hence we can't cope with 12- or 16-bit samples.
33
- */
34
-
35
- #if BITS_IN_JSAMPLE != 8
36
- Sorry, this code only copes with 8-bit JSAMPLEs. /* deliberate syntax err */
37
- #endif
38
-
39
- /*
40
- * We support the following types of RLE files:
41
- *
42
- * GRAYSCALE - 8 bits, no colormap
43
- * MAPPEDGRAY - 8 bits, 1 channel colomap
44
- * PSEUDOCOLOR - 8 bits, 3 channel colormap
45
- * TRUECOLOR - 24 bits, 3 channel colormap
46
- * DIRECTCOLOR - 24 bits, no colormap
47
- *
48
- * For now, we ignore any alpha channel in the image.
49
- */
50
-
51
- typedef enum
52
- { GRAYSCALE, MAPPEDGRAY, PSEUDOCOLOR, TRUECOLOR, DIRECTCOLOR } rle_kind;
53
-
54
-
55
- /*
56
- * Since RLE stores scanlines bottom-to-top, we have to invert the image
57
- * to conform to JPEG's top-to-bottom order. To do this, we read the
58
- * incoming image into a virtual array on the first get_pixel_rows call,
59
- * then fetch the required row from the virtual array on subsequent calls.
60
- */
61
-
62
- typedef struct _rle_source_struct * rle_source_ptr;
63
-
64
- typedef struct _rle_source_struct {
65
- struct cjpeg_source_struct pub; /* public fields */
66
-
67
- rle_kind visual; /* actual type of input file */
68
- jvirt_sarray_ptr image; /* virtual array to hold the image */
69
- JDIMENSION row; /* current row # in the virtual array */
70
- rle_hdr header; /* Input file information */
71
- rle_pixel** rle_row; /* holds a row returned by rle_getrow() */
72
-
73
- } rle_source_struct;
74
-
75
-
76
- /*
77
- * Read the file header; return image size and component count.
78
- */
79
-
80
- METHODDEF(void)
81
- start_input_rle (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
82
- {
83
- rle_source_ptr source = (rle_source_ptr) sinfo;
84
- JDIMENSION width, height;
85
- #ifdef PROGRESS_REPORT
86
- cd_progress_ptr progress = (cd_progress_ptr) cinfo->progress;
87
- #endif
88
-
89
- /* Use RLE library routine to get the header info */
90
- source->header = *rle_hdr_init(NULL);
91
- source->header.rle_file = source->pub.input_file;
92
- switch (rle_get_setup(&(source->header))) {
93
- case RLE_SUCCESS:
94
- /* A-OK */
95
- break;
96
- case RLE_NOT_RLE:
97
- ERREXIT(cinfo, JERR_RLE_NOT);
98
- break;
99
- case RLE_NO_SPACE:
100
- ERREXIT(cinfo, JERR_RLE_MEM);
101
- break;
102
- case RLE_EMPTY:
103
- ERREXIT(cinfo, JERR_RLE_EMPTY);
104
- break;
105
- case RLE_EOF:
106
- ERREXIT(cinfo, JERR_RLE_EOF);
107
- break;
108
- default:
109
- ERREXIT(cinfo, JERR_RLE_BADERROR);
110
- break;
111
- }
112
-
113
- /* Figure out what we have, set private vars and return values accordingly */
114
-
115
- width = source->header.xmax - source->header.xmin + 1;
116
- height = source->header.ymax - source->header.ymin + 1;
117
- source->header.xmin = 0; /* realign horizontally */
118
- source->header.xmax = width-1;
119
-
120
- cinfo->image_width = width;
121
- cinfo->image_height = height;
122
- cinfo->data_precision = 8; /* we can only handle 8 bit data */
123
-
124
- if (source->header.ncolors == 1 && source->header.ncmap == 0) {
125
- source->visual = GRAYSCALE;
126
- TRACEMS2(cinfo, 1, JTRC_RLE_GRAY, width, height);
127
- } else if (source->header.ncolors == 1 && source->header.ncmap == 1) {
128
- source->visual = MAPPEDGRAY;
129
- TRACEMS3(cinfo, 1, JTRC_RLE_MAPGRAY, width, height,
130
- 1 << source->header.cmaplen);
131
- } else if (source->header.ncolors == 1 && source->header.ncmap == 3) {
132
- source->visual = PSEUDOCOLOR;
133
- TRACEMS3(cinfo, 1, JTRC_RLE_MAPPED, width, height,
134
- 1 << source->header.cmaplen);
135
- } else if (source->header.ncolors == 3 && source->header.ncmap == 3) {
136
- source->visual = TRUECOLOR;
137
- TRACEMS3(cinfo, 1, JTRC_RLE_FULLMAP, width, height,
138
- 1 << source->header.cmaplen);
139
- } else if (source->header.ncolors == 3 && source->header.ncmap == 0) {
140
- source->visual = DIRECTCOLOR;
141
- TRACEMS2(cinfo, 1, JTRC_RLE, width, height);
142
- } else
143
- ERREXIT(cinfo, JERR_RLE_UNSUPPORTED);
144
-
145
- if (source->visual == GRAYSCALE || source->visual == MAPPEDGRAY) {
146
- cinfo->in_color_space = JCS_GRAYSCALE;
147
- cinfo->input_components = 1;
148
- } else {
149
- cinfo->in_color_space = JCS_RGB;
150
- cinfo->input_components = 3;
151
- }
152
-
153
- /*
154
- * A place to hold each scanline while it's converted.
155
- * (GRAYSCALE scanlines don't need converting)
156
- */
157
- if (source->visual != GRAYSCALE) {
158
- source->rle_row = (rle_pixel**) (*cinfo->mem->alloc_sarray)
159
- ((j_common_ptr) cinfo, JPOOL_IMAGE,
160
- (JDIMENSION) width, (JDIMENSION) cinfo->input_components);
161
- }
162
-
163
- /* request a virtual array to hold the image */
164
- source->image = (*cinfo->mem->request_virt_sarray)
165
- ((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE,
166
- (JDIMENSION) (width * source->header.ncolors),
167
- (JDIMENSION) height, (JDIMENSION) 1);
168
-
169
- #ifdef PROGRESS_REPORT
170
- if (progress != NULL) {
171
- /* count file input as separate pass */
172
- progress->total_extra_passes++;
173
- }
174
- #endif
175
-
176
- source->pub.buffer_height = 1;
177
- }
178
-
179
-
180
- /*
181
- * Read one row of pixels.
182
- * Called only after load_image has read the image into the virtual array.
183
- * Used for GRAYSCALE, MAPPEDGRAY, TRUECOLOR, and DIRECTCOLOR images.
184
- */
185
-
186
- METHODDEF(JDIMENSION)
187
- get_rle_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
188
- {
189
- rle_source_ptr source = (rle_source_ptr) sinfo;
190
-
191
- source->row--;
192
- source->pub.buffer = (*cinfo->mem->access_virt_sarray)
193
- ((j_common_ptr) cinfo, source->image, source->row, (JDIMENSION) 1, FALSE);
194
-
195
- return 1;
196
- }
197
-
198
- /*
199
- * Read one row of pixels.
200
- * Called only after load_image has read the image into the virtual array.
201
- * Used for PSEUDOCOLOR images.
202
- */
203
-
204
- METHODDEF(JDIMENSION)
205
- get_pseudocolor_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
206
- {
207
- rle_source_ptr source = (rle_source_ptr) sinfo;
208
- JSAMPROW src_row, dest_row;
209
- JDIMENSION col;
210
- rle_map *colormap;
211
- int val;
212
-
213
- colormap = source->header.cmap;
214
- dest_row = source->pub.buffer[0];
215
- source->row--;
216
- src_row = * (*cinfo->mem->access_virt_sarray)
217
- ((j_common_ptr) cinfo, source->image, source->row, (JDIMENSION) 1, FALSE);
218
-
219
- for (col = cinfo->image_width; col > 0; col--) {
220
- val = GETJSAMPLE(*src_row++);
221
- *dest_row++ = (JSAMPLE) (colormap[val ] >> 8);
222
- *dest_row++ = (JSAMPLE) (colormap[val + 256] >> 8);
223
- *dest_row++ = (JSAMPLE) (colormap[val + 512] >> 8);
224
- }
225
-
226
- return 1;
227
- }
228
-
229
-
230
- /*
231
- * Load the image into a virtual array. We have to do this because RLE
232
- * files start at the lower left while the JPEG standard has them starting
233
- * in the upper left. This is called the first time we want to get a row
234
- * of input. What we do is load the RLE data into the array and then call
235
- * the appropriate routine to read one row from the array. Before returning,
236
- * we set source->pub.get_pixel_rows so that subsequent calls go straight to
237
- * the appropriate row-reading routine.
238
- */
239
-
240
- METHODDEF(JDIMENSION)
241
- load_image (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
242
- {
243
- rle_source_ptr source = (rle_source_ptr) sinfo;
244
- JDIMENSION row, col;
245
- JSAMPROW scanline, red_ptr, green_ptr, blue_ptr;
246
- rle_pixel **rle_row;
247
- rle_map *colormap;
248
- char channel;
249
- #ifdef PROGRESS_REPORT
250
- cd_progress_ptr progress = (cd_progress_ptr) cinfo->progress;
251
- #endif
252
-
253
- colormap = source->header.cmap;
254
- rle_row = source->rle_row;
255
-
256
- /* Read the RLE data into our virtual array.
257
- * We assume here that (a) rle_pixel is represented the same as JSAMPLE,
258
- * and (b) we are not on a machine where FAR pointers differ from regular.
259
- */
260
- RLE_CLR_BIT(source->header, RLE_ALPHA); /* don't read the alpha channel */
261
-
262
- #ifdef PROGRESS_REPORT
263
- if (progress != NULL) {
264
- progress->pub.pass_limit = cinfo->image_height;
265
- progress->pub.pass_counter = 0;
266
- (*progress->pub.progress_monitor) ((j_common_ptr) cinfo);
267
- }
268
- #endif
269
-
270
- switch (source->visual) {
271
-
272
- case GRAYSCALE:
273
- case PSEUDOCOLOR:
274
- for (row = 0; row < cinfo->image_height; row++) {
275
- rle_row = (rle_pixel **) (*cinfo->mem->access_virt_sarray)
276
- ((j_common_ptr) cinfo, source->image, row, (JDIMENSION) 1, TRUE);
277
- rle_getrow(&source->header, rle_row);
278
- #ifdef PROGRESS_REPORT
279
- if (progress != NULL) {
280
- progress->pub.pass_counter++;
281
- (*progress->pub.progress_monitor) ((j_common_ptr) cinfo);
282
- }
283
- #endif
284
- }
285
- break;
286
-
287
- case MAPPEDGRAY:
288
- case TRUECOLOR:
289
- for (row = 0; row < cinfo->image_height; row++) {
290
- scanline = * (*cinfo->mem->access_virt_sarray)
291
- ((j_common_ptr) cinfo, source->image, row, (JDIMENSION) 1, TRUE);
292
- rle_row = source->rle_row;
293
- rle_getrow(&source->header, rle_row);
294
-
295
- for (col = 0; col < cinfo->image_width; col++) {
296
- for (channel = 0; channel < source->header.ncolors; channel++) {
297
- *scanline++ = (JSAMPLE)
298
- (colormap[GETJSAMPLE(rle_row[channel][col]) + 256 * channel] >> 8);
299
- }
300
- }
301
-
302
- #ifdef PROGRESS_REPORT
303
- if (progress != NULL) {
304
- progress->pub.pass_counter++;
305
- (*progress->pub.progress_monitor) ((j_common_ptr) cinfo);
306
- }
307
- #endif
308
- }
309
- break;
310
-
311
- case DIRECTCOLOR:
312
- for (row = 0; row < cinfo->image_height; row++) {
313
- scanline = * (*cinfo->mem->access_virt_sarray)
314
- ((j_common_ptr) cinfo, source->image, row, (JDIMENSION) 1, TRUE);
315
- rle_getrow(&source->header, rle_row);
316
-
317
- red_ptr = rle_row[0];
318
- green_ptr = rle_row[1];
319
- blue_ptr = rle_row[2];
320
-
321
- for (col = cinfo->image_width; col > 0; col--) {
322
- *scanline++ = *red_ptr++;
323
- *scanline++ = *green_ptr++;
324
- *scanline++ = *blue_ptr++;
325
- }
326
-
327
- #ifdef PROGRESS_REPORT
328
- if (progress != NULL) {
329
- progress->pub.pass_counter++;
330
- (*progress->pub.progress_monitor) ((j_common_ptr) cinfo);
331
- }
332
- #endif
333
- }
334
- }
335
-
336
- #ifdef PROGRESS_REPORT
337
- if (progress != NULL)
338
- progress->completed_extra_passes++;
339
- #endif
340
-
341
- /* Set up to call proper row-extraction routine in future */
342
- if (source->visual == PSEUDOCOLOR) {
343
- source->pub.buffer = source->rle_row;
344
- source->pub.get_pixel_rows = get_pseudocolor_row;
345
- } else {
346
- source->pub.get_pixel_rows = get_rle_row;
347
- }
348
- source->row = cinfo->image_height;
349
-
350
- /* And fetch the topmost (bottommost) row */
351
- return (*source->pub.get_pixel_rows) (cinfo, sinfo);
352
- }
353
-
354
-
355
- /*
356
- * Finish up at the end of the file.
357
- */
358
-
359
- METHODDEF(void)
360
- finish_input_rle (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
361
- {
362
- /* no work */
363
- }
364
-
365
-
366
- /*
367
- * The module selection routine for RLE format input.
368
- */
369
-
370
- GLOBAL(cjpeg_source_ptr)
371
- jinit_read_rle (j_compress_ptr cinfo)
372
- {
373
- rle_source_ptr source;
374
-
375
- /* Create module interface object */
376
- source = (rle_source_ptr)
377
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
378
- SIZEOF(rle_source_struct));
379
- /* Fill in method ptrs */
380
- source->pub.start_input = start_input_rle;
381
- source->pub.finish_input = finish_input_rle;
382
- source->pub.get_pixel_rows = load_image;
383
-
384
- return (cjpeg_source_ptr) source;
385
- }
386
-
387
- #endif /* RLE_SUPPORTED */
@@ -1,365 +0,0 @@
1
- /*
2
- * rdswitch.c
3
- *
4
- * Copyright (C) 1991-1996, 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 process some of cjpeg's more complicated
9
- * command-line switches. Switches processed here are:
10
- * -qtables file Read quantization tables from text file
11
- * -scans file Read scan script from text file
12
- * -quality N[,N,...] Set quality ratings
13
- * -qslots N[,N,...] Set component quantization table selectors
14
- * -sample HxV[,HxV,...] Set component sampling factors
15
- */
16
-
17
- #include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */
18
- #include <ctype.h> /* to declare isdigit(), isspace() */
19
-
20
-
21
- LOCAL(int)
22
- text_getc (FILE * file)
23
- /* Read next char, skipping over any comments (# to end of line) */
24
- /* A comment/newline sequence is returned as a newline */
25
- {
26
- register int ch;
27
-
28
- ch = getc(file);
29
- if (ch == '#') {
30
- do {
31
- ch = getc(file);
32
- } while (ch != '\n' && ch != EOF);
33
- }
34
- return ch;
35
- }
36
-
37
-
38
- LOCAL(boolean)
39
- read_text_integer (FILE * file, long * result, int * termchar)
40
- /* Read an unsigned decimal integer from a file, store it in result */
41
- /* Reads one trailing character after the integer; returns it in termchar */
42
- {
43
- register int ch;
44
- register long val;
45
-
46
- /* Skip any leading whitespace, detect EOF */
47
- do {
48
- ch = text_getc(file);
49
- if (ch == EOF) {
50
- *termchar = ch;
51
- return FALSE;
52
- }
53
- } while (isspace(ch));
54
-
55
- if (! isdigit(ch)) {
56
- *termchar = ch;
57
- return FALSE;
58
- }
59
-
60
- val = ch - '0';
61
- while ((ch = text_getc(file)) != EOF) {
62
- if (! isdigit(ch))
63
- break;
64
- val *= 10;
65
- val += ch - '0';
66
- }
67
- *result = val;
68
- *termchar = ch;
69
- return TRUE;
70
- }
71
-
72
-
73
- GLOBAL(boolean)
74
- read_quant_tables (j_compress_ptr cinfo, char * filename, boolean force_baseline)
75
- /* Read a set of quantization tables from the specified file.
76
- * The file is plain ASCII text: decimal numbers with whitespace between.
77
- * Comments preceded by '#' may be included in the file.
78
- * There may be one to NUM_QUANT_TBLS tables in the file, each of 64 values.
79
- * The tables are implicitly numbered 0,1,etc.
80
- * NOTE: does not affect the qslots mapping, which will default to selecting
81
- * table 0 for luminance (or primary) components, 1 for chrominance components.
82
- * You must use -qslots if you want a different component->table mapping.
83
- */
84
- {
85
- FILE * fp;
86
- int tblno, i, termchar;
87
- long val;
88
- unsigned int table[DCTSIZE2];
89
-
90
- if ((fp = fopen(filename, "r")) == NULL) {
91
- fprintf(stderr, "Can't open table file %s\n", filename);
92
- return FALSE;
93
- }
94
- tblno = 0;
95
-
96
- while (read_text_integer(fp, &val, &termchar)) { /* read 1st element of table */
97
- if (tblno >= NUM_QUANT_TBLS) {
98
- fprintf(stderr, "Too many tables in file %s\n", filename);
99
- fclose(fp);
100
- return FALSE;
101
- }
102
- table[0] = (unsigned int) val;
103
- for (i = 1; i < DCTSIZE2; i++) {
104
- if (! read_text_integer(fp, &val, &termchar)) {
105
- fprintf(stderr, "Invalid table data in file %s\n", filename);
106
- fclose(fp);
107
- return FALSE;
108
- }
109
- table[i] = (unsigned int) val;
110
- }
111
- jpeg_add_quant_table(cinfo, tblno, table, cinfo->q_scale_factor[tblno],
112
- force_baseline);
113
- tblno++;
114
- }
115
-
116
- if (termchar != EOF) {
117
- fprintf(stderr, "Non-numeric data in file %s\n", filename);
118
- fclose(fp);
119
- return FALSE;
120
- }
121
-
122
- fclose(fp);
123
- return TRUE;
124
- }
125
-
126
-
127
- #ifdef C_MULTISCAN_FILES_SUPPORTED
128
-
129
- LOCAL(boolean)
130
- read_scan_integer (FILE * file, long * result, int * termchar)
131
- /* Variant of read_text_integer that always looks for a non-space termchar;
132
- * this simplifies parsing of punctuation in scan scripts.
133
- */
134
- {
135
- register int ch;
136
-
137
- if (! read_text_integer(file, result, termchar))
138
- return FALSE;
139
- ch = *termchar;
140
- while (ch != EOF && isspace(ch))
141
- ch = text_getc(file);
142
- if (isdigit(ch)) { /* oops, put it back */
143
- if (ungetc(ch, file) == EOF)
144
- return FALSE;
145
- ch = ' ';
146
- } else {
147
- /* Any separators other than ';' and ':' are ignored;
148
- * this allows user to insert commas, etc, if desired.
149
- */
150
- if (ch != EOF && ch != ';' && ch != ':')
151
- ch = ' ';
152
- }
153
- *termchar = ch;
154
- return TRUE;
155
- }
156
-
157
-
158
- GLOBAL(boolean)
159
- read_scan_script (j_compress_ptr cinfo, char * filename)
160
- /* Read a scan script from the specified text file.
161
- * Each entry in the file defines one scan to be emitted.
162
- * Entries are separated by semicolons ';'.
163
- * An entry contains one to four component indexes,
164
- * optionally followed by a colon ':' and four progressive-JPEG parameters.
165
- * The component indexes denote which component(s) are to be transmitted
166
- * in the current scan. The first component has index 0.
167
- * Sequential JPEG is used if the progressive-JPEG parameters are omitted.
168
- * The file is free format text: any whitespace may appear between numbers
169
- * and the ':' and ';' punctuation marks. Also, other punctuation (such
170
- * as commas or dashes) can be placed between numbers if desired.
171
- * Comments preceded by '#' may be included in the file.
172
- * Note: we do very little validity checking here;
173
- * jcmaster.c will validate the script parameters.
174
- */
175
- {
176
- FILE * fp;
177
- int scanno, ncomps, termchar;
178
- long val;
179
- jpeg_scan_info * scanptr;
180
- #define MAX_SCANS 100 /* quite arbitrary limit */
181
- jpeg_scan_info scans[MAX_SCANS];
182
-
183
- if ((fp = fopen(filename, "r")) == NULL) {
184
- fprintf(stderr, "Can't open scan definition file %s\n", filename);
185
- return FALSE;
186
- }
187
- scanptr = scans;
188
- scanno = 0;
189
-
190
- while (read_scan_integer(fp, &val, &termchar)) {
191
- if (scanno >= MAX_SCANS) {
192
- fprintf(stderr, "Too many scans defined in file %s\n", filename);
193
- fclose(fp);
194
- return FALSE;
195
- }
196
- scanptr->component_index[0] = (int) val;
197
- ncomps = 1;
198
- while (termchar == ' ') {
199
- if (ncomps >= MAX_COMPS_IN_SCAN) {
200
- fprintf(stderr, "Too many components in one scan in file %s\n",
201
- filename);
202
- fclose(fp);
203
- return FALSE;
204
- }
205
- if (! read_scan_integer(fp, &val, &termchar))
206
- goto bogus;
207
- scanptr->component_index[ncomps] = (int) val;
208
- ncomps++;
209
- }
210
- scanptr->comps_in_scan = ncomps;
211
- if (termchar == ':') {
212
- if (! read_scan_integer(fp, &val, &termchar) || termchar != ' ')
213
- goto bogus;
214
- scanptr->Ss = (int) val;
215
- if (! read_scan_integer(fp, &val, &termchar) || termchar != ' ')
216
- goto bogus;
217
- scanptr->Se = (int) val;
218
- if (! read_scan_integer(fp, &val, &termchar) || termchar != ' ')
219
- goto bogus;
220
- scanptr->Ah = (int) val;
221
- if (! read_scan_integer(fp, &val, &termchar))
222
- goto bogus;
223
- scanptr->Al = (int) val;
224
- } else {
225
- /* set non-progressive parameters */
226
- scanptr->Ss = 0;
227
- scanptr->Se = DCTSIZE2-1;
228
- scanptr->Ah = 0;
229
- scanptr->Al = 0;
230
- }
231
- if (termchar != ';' && termchar != EOF) {
232
- bogus:
233
- fprintf(stderr, "Invalid scan entry format in file %s\n", filename);
234
- fclose(fp);
235
- return FALSE;
236
- }
237
- scanptr++, scanno++;
238
- }
239
-
240
- if (termchar != EOF) {
241
- fprintf(stderr, "Non-numeric data in file %s\n", filename);
242
- fclose(fp);
243
- return FALSE;
244
- }
245
-
246
- if (scanno > 0) {
247
- /* Stash completed scan list in cinfo structure.
248
- * NOTE: for cjpeg's use, JPOOL_IMAGE is the right lifetime for this data,
249
- * but if you want to compress multiple images you'd want JPOOL_PERMANENT.
250
- */
251
- scanptr = (jpeg_scan_info *)
252
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
253
- scanno * SIZEOF(jpeg_scan_info));
254
- MEMCOPY(scanptr, scans, scanno * SIZEOF(jpeg_scan_info));
255
- cinfo->scan_info = scanptr;
256
- cinfo->num_scans = scanno;
257
- }
258
-
259
- fclose(fp);
260
- return TRUE;
261
- }
262
-
263
- #endif /* C_MULTISCAN_FILES_SUPPORTED */
264
-
265
-
266
- GLOBAL(boolean)
267
- set_quality_ratings (j_compress_ptr cinfo, char *arg, boolean force_baseline)
268
- /* Process a quality-ratings parameter string, of the form
269
- * N[,N,...]
270
- * If there are more q-table slots than parameters, the last value is replicated.
271
- */
272
- {
273
- int val = 75; /* default value */
274
- int tblno;
275
- char ch;
276
-
277
- for (tblno = 0; tblno < NUM_QUANT_TBLS; tblno++) {
278
- if (*arg) {
279
- ch = ','; /* if not set by sscanf, will be ',' */
280
- if (sscanf(arg, "%d%c", &val, &ch) < 1)
281
- return FALSE;
282
- if (ch != ',') /* syntax check */
283
- return FALSE;
284
- /* Convert user 0-100 rating to percentage scaling */
285
- cinfo->q_scale_factor[tblno] = jpeg_quality_scaling(val);
286
- while (*arg && *arg++ != ',') /* advance to next segment of arg string */
287
- ;
288
- } else {
289
- /* reached end of parameter, set remaining factors to last value */
290
- cinfo->q_scale_factor[tblno] = jpeg_quality_scaling(val);
291
- }
292
- }
293
- jpeg_default_qtables(cinfo, force_baseline);
294
- return TRUE;
295
- }
296
-
297
-
298
- GLOBAL(boolean)
299
- set_quant_slots (j_compress_ptr cinfo, char *arg)
300
- /* Process a quantization-table-selectors parameter string, of the form
301
- * N[,N,...]
302
- * If there are more components than parameters, the last value is replicated.
303
- */
304
- {
305
- int val = 0; /* default table # */
306
- int ci;
307
- char ch;
308
-
309
- for (ci = 0; ci < MAX_COMPONENTS; ci++) {
310
- if (*arg) {
311
- ch = ','; /* if not set by sscanf, will be ',' */
312
- if (sscanf(arg, "%d%c", &val, &ch) < 1)
313
- return FALSE;
314
- if (ch != ',') /* syntax check */
315
- return FALSE;
316
- if (val < 0 || val >= NUM_QUANT_TBLS) {
317
- fprintf(stderr, "JPEG quantization tables are numbered 0..%d\n",
318
- NUM_QUANT_TBLS-1);
319
- return FALSE;
320
- }
321
- cinfo->comp_info[ci].quant_tbl_no = val;
322
- while (*arg && *arg++ != ',') /* advance to next segment of arg string */
323
- ;
324
- } else {
325
- /* reached end of parameter, set remaining components to last table */
326
- cinfo->comp_info[ci].quant_tbl_no = val;
327
- }
328
- }
329
- return TRUE;
330
- }
331
-
332
-
333
- GLOBAL(boolean)
334
- set_sample_factors (j_compress_ptr cinfo, char *arg)
335
- /* Process a sample-factors parameter string, of the form
336
- * HxV[,HxV,...]
337
- * If there are more components than parameters, "1x1" is assumed for the rest.
338
- */
339
- {
340
- int ci, val1, val2;
341
- char ch1, ch2;
342
-
343
- for (ci = 0; ci < MAX_COMPONENTS; ci++) {
344
- if (*arg) {
345
- ch2 = ','; /* if not set by sscanf, will be ',' */
346
- if (sscanf(arg, "%d%c%d%c", &val1, &ch1, &val2, &ch2) < 3)
347
- return FALSE;
348
- if ((ch1 != 'x' && ch1 != 'X') || ch2 != ',') /* syntax check */
349
- return FALSE;
350
- if (val1 <= 0 || val1 > 4 || val2 <= 0 || val2 > 4) {
351
- fprintf(stderr, "JPEG sampling factors must be 1..4\n");
352
- return FALSE;
353
- }
354
- cinfo->comp_info[ci].h_samp_factor = val1;
355
- cinfo->comp_info[ci].v_samp_factor = val2;
356
- while (*arg && *arg++ != ',') /* advance to next segment of arg string */
357
- ;
358
- } else {
359
- /* reached end of parameter, set remaining components to 1x1 sampling */
360
- cinfo->comp_info[ci].h_samp_factor = 1;
361
- cinfo->comp_info[ci].v_samp_factor = 1;
362
- }
363
- }
364
- return TRUE;
365
- }