isbn 2.0.4 → 2.0.5

Sign up to get free protection for your applications and to get access to all the features.
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/wrppm.c DELETED
@@ -1,269 +0,0 @@
1
- /*
2
- * wrppm.c
3
- *
4
- * Copyright (C) 1991-1996, Thomas G. Lane.
5
- * Modified 2009 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 routines to write output images in PPM/PGM format.
10
- * The extended 2-byte-per-sample raw PPM/PGM formats are supported.
11
- * The PBMPLUS library is NOT required to compile this software
12
- * (but it is highly useful as a set of PPM image manipulation programs).
13
- *
14
- * These routines may need modification for non-Unix environments or
15
- * specialized applications. As they stand, they assume output to
16
- * an ordinary stdio stream.
17
- */
18
-
19
- #include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */
20
-
21
- #ifdef PPM_SUPPORTED
22
-
23
-
24
- /*
25
- * For 12-bit JPEG data, we either downscale the values to 8 bits
26
- * (to write standard byte-per-sample PPM/PGM files), or output
27
- * nonstandard word-per-sample PPM/PGM files. Downscaling is done
28
- * if PPM_NORAWWORD is defined (this can be done in the Makefile
29
- * or in jconfig.h).
30
- * (When the core library supports data precision reduction, a cleaner
31
- * implementation will be to ask for that instead.)
32
- */
33
-
34
- #if BITS_IN_JSAMPLE == 8
35
- #define PUTPPMSAMPLE(ptr,v) *ptr++ = (char) (v)
36
- #define BYTESPERSAMPLE 1
37
- #define PPM_MAXVAL 255
38
- #else
39
- #ifdef PPM_NORAWWORD
40
- #define PUTPPMSAMPLE(ptr,v) *ptr++ = (char) ((v) >> (BITS_IN_JSAMPLE-8))
41
- #define BYTESPERSAMPLE 1
42
- #define PPM_MAXVAL 255
43
- #else
44
- /* The word-per-sample format always puts the MSB first. */
45
- #define PUTPPMSAMPLE(ptr,v) \
46
- { register int val_ = v; \
47
- *ptr++ = (char) ((val_ >> 8) & 0xFF); \
48
- *ptr++ = (char) (val_ & 0xFF); \
49
- }
50
- #define BYTESPERSAMPLE 2
51
- #define PPM_MAXVAL ((1<<BITS_IN_JSAMPLE)-1)
52
- #endif
53
- #endif
54
-
55
-
56
- /*
57
- * When JSAMPLE is the same size as char, we can just fwrite() the
58
- * decompressed data to the PPM or PGM file. On PCs, in order to make this
59
- * work the output buffer must be allocated in near data space, because we are
60
- * assuming small-data memory model wherein fwrite() can't reach far memory.
61
- * If you need to process very wide images on a PC, you might have to compile
62
- * in large-memory model, or else replace fwrite() with a putc() loop ---
63
- * which will be much slower.
64
- */
65
-
66
-
67
- /* Private version of data destination object */
68
-
69
- typedef struct {
70
- struct djpeg_dest_struct pub; /* public fields */
71
-
72
- /* Usually these two pointers point to the same place: */
73
- char *iobuffer; /* fwrite's I/O buffer */
74
- JSAMPROW pixrow; /* decompressor output buffer */
75
- size_t buffer_width; /* width of I/O buffer */
76
- JDIMENSION samples_per_row; /* JSAMPLEs per output row */
77
- } ppm_dest_struct;
78
-
79
- typedef ppm_dest_struct * ppm_dest_ptr;
80
-
81
-
82
- /*
83
- * Write some pixel data.
84
- * In this module rows_supplied will always be 1.
85
- *
86
- * put_pixel_rows handles the "normal" 8-bit case where the decompressor
87
- * output buffer is physically the same as the fwrite buffer.
88
- */
89
-
90
- METHODDEF(void)
91
- put_pixel_rows (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo,
92
- JDIMENSION rows_supplied)
93
- {
94
- ppm_dest_ptr dest = (ppm_dest_ptr) dinfo;
95
-
96
- (void) JFWRITE(dest->pub.output_file, dest->iobuffer, dest->buffer_width);
97
- }
98
-
99
-
100
- /*
101
- * This code is used when we have to copy the data and apply a pixel
102
- * format translation. Typically this only happens in 12-bit mode.
103
- */
104
-
105
- METHODDEF(void)
106
- copy_pixel_rows (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo,
107
- JDIMENSION rows_supplied)
108
- {
109
- ppm_dest_ptr dest = (ppm_dest_ptr) dinfo;
110
- register char * bufferptr;
111
- register JSAMPROW ptr;
112
- register JDIMENSION col;
113
-
114
- ptr = dest->pub.buffer[0];
115
- bufferptr = dest->iobuffer;
116
- for (col = dest->samples_per_row; col > 0; col--) {
117
- PUTPPMSAMPLE(bufferptr, GETJSAMPLE(*ptr++));
118
- }
119
- (void) JFWRITE(dest->pub.output_file, dest->iobuffer, dest->buffer_width);
120
- }
121
-
122
-
123
- /*
124
- * Write some pixel data when color quantization is in effect.
125
- * We have to demap the color index values to straight data.
126
- */
127
-
128
- METHODDEF(void)
129
- put_demapped_rgb (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo,
130
- JDIMENSION rows_supplied)
131
- {
132
- ppm_dest_ptr dest = (ppm_dest_ptr) dinfo;
133
- register char * bufferptr;
134
- register int pixval;
135
- register JSAMPROW ptr;
136
- register JSAMPROW color_map0 = cinfo->colormap[0];
137
- register JSAMPROW color_map1 = cinfo->colormap[1];
138
- register JSAMPROW color_map2 = cinfo->colormap[2];
139
- register JDIMENSION col;
140
-
141
- ptr = dest->pub.buffer[0];
142
- bufferptr = dest->iobuffer;
143
- for (col = cinfo->output_width; col > 0; col--) {
144
- pixval = GETJSAMPLE(*ptr++);
145
- PUTPPMSAMPLE(bufferptr, GETJSAMPLE(color_map0[pixval]));
146
- PUTPPMSAMPLE(bufferptr, GETJSAMPLE(color_map1[pixval]));
147
- PUTPPMSAMPLE(bufferptr, GETJSAMPLE(color_map2[pixval]));
148
- }
149
- (void) JFWRITE(dest->pub.output_file, dest->iobuffer, dest->buffer_width);
150
- }
151
-
152
-
153
- METHODDEF(void)
154
- put_demapped_gray (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo,
155
- JDIMENSION rows_supplied)
156
- {
157
- ppm_dest_ptr dest = (ppm_dest_ptr) dinfo;
158
- register char * bufferptr;
159
- register JSAMPROW ptr;
160
- register JSAMPROW color_map = cinfo->colormap[0];
161
- register JDIMENSION col;
162
-
163
- ptr = dest->pub.buffer[0];
164
- bufferptr = dest->iobuffer;
165
- for (col = cinfo->output_width; col > 0; col--) {
166
- PUTPPMSAMPLE(bufferptr, GETJSAMPLE(color_map[GETJSAMPLE(*ptr++)]));
167
- }
168
- (void) JFWRITE(dest->pub.output_file, dest->iobuffer, dest->buffer_width);
169
- }
170
-
171
-
172
- /*
173
- * Startup: write the file header.
174
- */
175
-
176
- METHODDEF(void)
177
- start_output_ppm (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo)
178
- {
179
- ppm_dest_ptr dest = (ppm_dest_ptr) dinfo;
180
-
181
- /* Emit file header */
182
- switch (cinfo->out_color_space) {
183
- case JCS_GRAYSCALE:
184
- /* emit header for raw PGM format */
185
- fprintf(dest->pub.output_file, "P5\n%ld %ld\n%d\n",
186
- (long) cinfo->output_width, (long) cinfo->output_height,
187
- PPM_MAXVAL);
188
- break;
189
- case JCS_RGB:
190
- /* emit header for raw PPM format */
191
- fprintf(dest->pub.output_file, "P6\n%ld %ld\n%d\n",
192
- (long) cinfo->output_width, (long) cinfo->output_height,
193
- PPM_MAXVAL);
194
- break;
195
- default:
196
- ERREXIT(cinfo, JERR_PPM_COLORSPACE);
197
- }
198
- }
199
-
200
-
201
- /*
202
- * Finish up at the end of the file.
203
- */
204
-
205
- METHODDEF(void)
206
- finish_output_ppm (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo)
207
- {
208
- /* Make sure we wrote the output file OK */
209
- fflush(dinfo->output_file);
210
- if (ferror(dinfo->output_file))
211
- ERREXIT(cinfo, JERR_FILE_WRITE);
212
- }
213
-
214
-
215
- /*
216
- * The module selection routine for PPM format output.
217
- */
218
-
219
- GLOBAL(djpeg_dest_ptr)
220
- jinit_write_ppm (j_decompress_ptr cinfo)
221
- {
222
- ppm_dest_ptr dest;
223
-
224
- /* Create module interface object, fill in method pointers */
225
- dest = (ppm_dest_ptr)
226
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
227
- SIZEOF(ppm_dest_struct));
228
- dest->pub.start_output = start_output_ppm;
229
- dest->pub.finish_output = finish_output_ppm;
230
-
231
- /* Calculate output image dimensions so we can allocate space */
232
- jpeg_calc_output_dimensions(cinfo);
233
-
234
- /* Create physical I/O buffer. Note we make this near on a PC. */
235
- dest->samples_per_row = cinfo->output_width * cinfo->out_color_components;
236
- dest->buffer_width = dest->samples_per_row * (BYTESPERSAMPLE * SIZEOF(char));
237
- dest->iobuffer = (char *) (*cinfo->mem->alloc_small)
238
- ((j_common_ptr) cinfo, JPOOL_IMAGE, dest->buffer_width);
239
-
240
- if (cinfo->quantize_colors || BITS_IN_JSAMPLE != 8 ||
241
- SIZEOF(JSAMPLE) != SIZEOF(char)) {
242
- /* When quantizing, we need an output buffer for colormap indexes
243
- * that's separate from the physical I/O buffer. We also need a
244
- * separate buffer if pixel format translation must take place.
245
- */
246
- dest->pub.buffer = (*cinfo->mem->alloc_sarray)
247
- ((j_common_ptr) cinfo, JPOOL_IMAGE,
248
- cinfo->output_width * cinfo->output_components, (JDIMENSION) 1);
249
- dest->pub.buffer_height = 1;
250
- if (! cinfo->quantize_colors)
251
- dest->pub.put_pixel_rows = copy_pixel_rows;
252
- else if (cinfo->out_color_space == JCS_GRAYSCALE)
253
- dest->pub.put_pixel_rows = put_demapped_gray;
254
- else
255
- dest->pub.put_pixel_rows = put_demapped_rgb;
256
- } else {
257
- /* We will fwrite() directly from decompressor output buffer. */
258
- /* Synthesize a JSAMPARRAY pointer structure */
259
- /* Cast here implies near->far pointer conversion on PCs */
260
- dest->pixrow = (JSAMPROW) dest->iobuffer;
261
- dest->pub.buffer = & dest->pixrow;
262
- dest->pub.buffer_height = 1;
263
- dest->pub.put_pixel_rows = put_pixel_rows;
264
- }
265
-
266
- return (djpeg_dest_ptr) dest;
267
- }
268
-
269
- #endif /* PPM_SUPPORTED */
data/src/jpeg-7/wrrle.c DELETED
@@ -1,305 +0,0 @@
1
- /*
2
- * wrrle.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 write output images in 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 output to
13
- * an ordinary stdio stream.
14
- *
15
- * Based on code contributed by Mike Lijewski,
16
- * with updates from Robert Hutchinson.
17
- */
18
-
19
- #include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */
20
-
21
- #ifdef RLE_SUPPORTED
22
-
23
- /* rle.h is provided by the Utah Raster Toolkit. */
24
-
25
- #include <rle.h>
26
-
27
- /*
28
- * We assume that JSAMPLE has the same representation as rle_pixel,
29
- * to wit, "unsigned char". Hence we can't cope with 12- or 16-bit samples.
30
- */
31
-
32
- #if BITS_IN_JSAMPLE != 8
33
- Sorry, this code only copes with 8-bit JSAMPLEs. /* deliberate syntax err */
34
- #endif
35
-
36
-
37
- /*
38
- * Since RLE stores scanlines bottom-to-top, we have to invert the image
39
- * from JPEG's top-to-bottom order. To do this, we save the outgoing data
40
- * in a virtual array during put_pixel_row calls, then actually emit the
41
- * RLE file during finish_output.
42
- */
43
-
44
-
45
- /*
46
- * For now, if we emit an RLE color map then it is always 256 entries long,
47
- * though not all of the entries need be used.
48
- */
49
-
50
- #define CMAPBITS 8
51
- #define CMAPLENGTH (1<<(CMAPBITS))
52
-
53
- typedef struct {
54
- struct djpeg_dest_struct pub; /* public fields */
55
-
56
- jvirt_sarray_ptr image; /* virtual array to store the output image */
57
- rle_map *colormap; /* RLE-style color map, or NULL if none */
58
- rle_pixel **rle_row; /* To pass rows to rle_putrow() */
59
-
60
- } rle_dest_struct;
61
-
62
- typedef rle_dest_struct * rle_dest_ptr;
63
-
64
- /* Forward declarations */
65
- METHODDEF(void) rle_put_pixel_rows
66
- JPP((j_decompress_ptr cinfo, djpeg_dest_ptr dinfo,
67
- JDIMENSION rows_supplied));
68
-
69
-
70
- /*
71
- * Write the file header.
72
- *
73
- * In this module it's easier to wait till finish_output to write anything.
74
- */
75
-
76
- METHODDEF(void)
77
- start_output_rle (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo)
78
- {
79
- rle_dest_ptr dest = (rle_dest_ptr) dinfo;
80
- size_t cmapsize;
81
- int i, ci;
82
- #ifdef PROGRESS_REPORT
83
- cd_progress_ptr progress = (cd_progress_ptr) cinfo->progress;
84
- #endif
85
-
86
- /*
87
- * Make sure the image can be stored in RLE format.
88
- *
89
- * - RLE stores image dimensions as *signed* 16 bit integers. JPEG
90
- * uses unsigned, so we have to check the width.
91
- *
92
- * - Colorspace is expected to be grayscale or RGB.
93
- *
94
- * - The number of channels (components) is expected to be 1 (grayscale/
95
- * pseudocolor) or 3 (truecolor/directcolor).
96
- * (could be 2 or 4 if using an alpha channel, but we aren't)
97
- */
98
-
99
- if (cinfo->output_width > 32767 || cinfo->output_height > 32767)
100
- ERREXIT2(cinfo, JERR_RLE_DIMENSIONS, cinfo->output_width,
101
- cinfo->output_height);
102
-
103
- if (cinfo->out_color_space != JCS_GRAYSCALE &&
104
- cinfo->out_color_space != JCS_RGB)
105
- ERREXIT(cinfo, JERR_RLE_COLORSPACE);
106
-
107
- if (cinfo->output_components != 1 && cinfo->output_components != 3)
108
- ERREXIT1(cinfo, JERR_RLE_TOOMANYCHANNELS, cinfo->num_components);
109
-
110
- /* Convert colormap, if any, to RLE format. */
111
-
112
- dest->colormap = NULL;
113
-
114
- if (cinfo->quantize_colors) {
115
- /* Allocate storage for RLE-style cmap, zero any extra entries */
116
- cmapsize = cinfo->out_color_components * CMAPLENGTH * SIZEOF(rle_map);
117
- dest->colormap = (rle_map *) (*cinfo->mem->alloc_small)
118
- ((j_common_ptr) cinfo, JPOOL_IMAGE, cmapsize);
119
- MEMZERO(dest->colormap, cmapsize);
120
-
121
- /* Save away data in RLE format --- note 8-bit left shift! */
122
- /* Shifting would need adjustment for JSAMPLEs wider than 8 bits. */
123
- for (ci = 0; ci < cinfo->out_color_components; ci++) {
124
- for (i = 0; i < cinfo->actual_number_of_colors; i++) {
125
- dest->colormap[ci * CMAPLENGTH + i] =
126
- GETJSAMPLE(cinfo->colormap[ci][i]) << 8;
127
- }
128
- }
129
- }
130
-
131
- /* Set the output buffer to the first row */
132
- dest->pub.buffer = (*cinfo->mem->access_virt_sarray)
133
- ((j_common_ptr) cinfo, dest->image, (JDIMENSION) 0, (JDIMENSION) 1, TRUE);
134
- dest->pub.buffer_height = 1;
135
-
136
- dest->pub.put_pixel_rows = rle_put_pixel_rows;
137
-
138
- #ifdef PROGRESS_REPORT
139
- if (progress != NULL) {
140
- progress->total_extra_passes++; /* count file writing as separate pass */
141
- }
142
- #endif
143
- }
144
-
145
-
146
- /*
147
- * Write some pixel data.
148
- *
149
- * This routine just saves the data away in a virtual array.
150
- */
151
-
152
- METHODDEF(void)
153
- rle_put_pixel_rows (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo,
154
- JDIMENSION rows_supplied)
155
- {
156
- rle_dest_ptr dest = (rle_dest_ptr) dinfo;
157
-
158
- if (cinfo->output_scanline < cinfo->output_height) {
159
- dest->pub.buffer = (*cinfo->mem->access_virt_sarray)
160
- ((j_common_ptr) cinfo, dest->image,
161
- cinfo->output_scanline, (JDIMENSION) 1, TRUE);
162
- }
163
- }
164
-
165
- /*
166
- * Finish up at the end of the file.
167
- *
168
- * Here is where we really output the RLE file.
169
- */
170
-
171
- METHODDEF(void)
172
- finish_output_rle (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo)
173
- {
174
- rle_dest_ptr dest = (rle_dest_ptr) dinfo;
175
- rle_hdr header; /* Output file information */
176
- rle_pixel **rle_row, *red, *green, *blue;
177
- JSAMPROW output_row;
178
- char cmapcomment[80];
179
- int row, col;
180
- int ci;
181
- #ifdef PROGRESS_REPORT
182
- cd_progress_ptr progress = (cd_progress_ptr) cinfo->progress;
183
- #endif
184
-
185
- /* Initialize the header info */
186
- header = *rle_hdr_init(NULL);
187
- header.rle_file = dest->pub.output_file;
188
- header.xmin = 0;
189
- header.xmax = cinfo->output_width - 1;
190
- header.ymin = 0;
191
- header.ymax = cinfo->output_height - 1;
192
- header.alpha = 0;
193
- header.ncolors = cinfo->output_components;
194
- for (ci = 0; ci < cinfo->output_components; ci++) {
195
- RLE_SET_BIT(header, ci);
196
- }
197
- if (cinfo->quantize_colors) {
198
- header.ncmap = cinfo->out_color_components;
199
- header.cmaplen = CMAPBITS;
200
- header.cmap = dest->colormap;
201
- /* Add a comment to the output image with the true colormap length. */
202
- sprintf(cmapcomment, "color_map_length=%d", cinfo->actual_number_of_colors);
203
- rle_putcom(cmapcomment, &header);
204
- }
205
-
206
- /* Emit the RLE header and color map (if any) */
207
- rle_put_setup(&header);
208
-
209
- /* Now output the RLE data from our virtual array.
210
- * We assume here that (a) rle_pixel is represented the same as JSAMPLE,
211
- * and (b) we are not on a machine where FAR pointers differ from regular.
212
- */
213
-
214
- #ifdef PROGRESS_REPORT
215
- if (progress != NULL) {
216
- progress->pub.pass_limit = cinfo->output_height;
217
- progress->pub.pass_counter = 0;
218
- (*progress->pub.progress_monitor) ((j_common_ptr) cinfo);
219
- }
220
- #endif
221
-
222
- if (cinfo->output_components == 1) {
223
- for (row = cinfo->output_height-1; row >= 0; row--) {
224
- rle_row = (rle_pixel **) (*cinfo->mem->access_virt_sarray)
225
- ((j_common_ptr) cinfo, dest->image,
226
- (JDIMENSION) row, (JDIMENSION) 1, FALSE);
227
- rle_putrow(rle_row, (int) cinfo->output_width, &header);
228
- #ifdef PROGRESS_REPORT
229
- if (progress != NULL) {
230
- progress->pub.pass_counter++;
231
- (*progress->pub.progress_monitor) ((j_common_ptr) cinfo);
232
- }
233
- #endif
234
- }
235
- } else {
236
- for (row = cinfo->output_height-1; row >= 0; row--) {
237
- rle_row = (rle_pixel **) dest->rle_row;
238
- output_row = * (*cinfo->mem->access_virt_sarray)
239
- ((j_common_ptr) cinfo, dest->image,
240
- (JDIMENSION) row, (JDIMENSION) 1, FALSE);
241
- red = rle_row[0];
242
- green = rle_row[1];
243
- blue = rle_row[2];
244
- for (col = cinfo->output_width; col > 0; col--) {
245
- *red++ = GETJSAMPLE(*output_row++);
246
- *green++ = GETJSAMPLE(*output_row++);
247
- *blue++ = GETJSAMPLE(*output_row++);
248
- }
249
- rle_putrow(rle_row, (int) cinfo->output_width, &header);
250
- #ifdef PROGRESS_REPORT
251
- if (progress != NULL) {
252
- progress->pub.pass_counter++;
253
- (*progress->pub.progress_monitor) ((j_common_ptr) cinfo);
254
- }
255
- #endif
256
- }
257
- }
258
-
259
- #ifdef PROGRESS_REPORT
260
- if (progress != NULL)
261
- progress->completed_extra_passes++;
262
- #endif
263
-
264
- /* Emit file trailer */
265
- rle_puteof(&header);
266
- fflush(dest->pub.output_file);
267
- if (ferror(dest->pub.output_file))
268
- ERREXIT(cinfo, JERR_FILE_WRITE);
269
- }
270
-
271
-
272
- /*
273
- * The module selection routine for RLE format output.
274
- */
275
-
276
- GLOBAL(djpeg_dest_ptr)
277
- jinit_write_rle (j_decompress_ptr cinfo)
278
- {
279
- rle_dest_ptr dest;
280
-
281
- /* Create module interface object, fill in method pointers */
282
- dest = (rle_dest_ptr)
283
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
284
- SIZEOF(rle_dest_struct));
285
- dest->pub.start_output = start_output_rle;
286
- dest->pub.finish_output = finish_output_rle;
287
-
288
- /* Calculate output image dimensions so we can allocate space */
289
- jpeg_calc_output_dimensions(cinfo);
290
-
291
- /* Allocate a work array for output to the RLE library. */
292
- dest->rle_row = (*cinfo->mem->alloc_sarray)
293
- ((j_common_ptr) cinfo, JPOOL_IMAGE,
294
- cinfo->output_width, (JDIMENSION) cinfo->output_components);
295
-
296
- /* Allocate a virtual array to hold the image. */
297
- dest->image = (*cinfo->mem->request_virt_sarray)
298
- ((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE,
299
- (JDIMENSION) (cinfo->output_width * cinfo->output_components),
300
- cinfo->output_height, (JDIMENSION) 1);
301
-
302
- return (djpeg_dest_ptr) dest;
303
- }
304
-
305
- #endif /* RLE_SUPPORTED */