isbn 1.4.1

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 (291) hide show
  1. data/.gitignore +4 -0
  2. data/README +9 -0
  3. data/Rakefile +13 -0
  4. data/VERSION +1 -0
  5. data/isbn.gemspec +329 -0
  6. data/lib/isbn.rb +90 -0
  7. data/src/gocr-0.48/.cvsignore +6 -0
  8. data/src/gocr-0.48/AUTHORS +7 -0
  9. data/src/gocr-0.48/BUGS +55 -0
  10. data/src/gocr-0.48/CREDITS +17 -0
  11. data/src/gocr-0.48/HISTORY +243 -0
  12. data/src/gocr-0.48/INSTALL +83 -0
  13. data/src/gocr-0.48/Makefile +193 -0
  14. data/src/gocr-0.48/Makefile.in +193 -0
  15. data/src/gocr-0.48/README +165 -0
  16. data/src/gocr-0.48/READMEde.txt +80 -0
  17. data/src/gocr-0.48/REMARK.txt +18 -0
  18. data/src/gocr-0.48/REVIEW +538 -0
  19. data/src/gocr-0.48/TODO +65 -0
  20. data/src/gocr-0.48/bin/.cvsignore +2 -0
  21. data/src/gocr-0.48/bin/create_db +38 -0
  22. data/src/gocr-0.48/bin/gocr.tcl +527 -0
  23. data/src/gocr-0.48/bin/gocr_chk.sh +44 -0
  24. data/src/gocr-0.48/configure +4689 -0
  25. data/src/gocr-0.48/configure.in +71 -0
  26. data/src/gocr-0.48/doc/.#Makefile.1.6 +39 -0
  27. data/src/gocr-0.48/doc/.cvsignore +2 -0
  28. data/src/gocr-0.48/doc/Makefile +39 -0
  29. data/src/gocr-0.48/doc/Makefile.in +39 -0
  30. data/src/gocr-0.48/doc/example.dtd +53 -0
  31. data/src/gocr-0.48/doc/example.xml +21 -0
  32. data/src/gocr-0.48/doc/examples.txt +67 -0
  33. data/src/gocr-0.48/doc/gocr.html +578 -0
  34. data/src/gocr-0.48/doc/unicode.txt +57 -0
  35. data/src/gocr-0.48/examples/.#Makefile.1.22 +166 -0
  36. data/src/gocr-0.48/examples/4x6.png +0 -0
  37. data/src/gocr-0.48/examples/4x6.txt +2 -0
  38. data/src/gocr-0.48/examples/5x7.png +0 -0
  39. data/src/gocr-0.48/examples/5x7.png.txt +2 -0
  40. data/src/gocr-0.48/examples/5x8.png +0 -0
  41. data/src/gocr-0.48/examples/5x8.png.txt +2 -0
  42. data/src/gocr-0.48/examples/Makefile +166 -0
  43. data/src/gocr-0.48/examples/color.fig +20 -0
  44. data/src/gocr-0.48/examples/ex.fig +16 -0
  45. data/src/gocr-0.48/examples/font.tex +22 -0
  46. data/src/gocr-0.48/examples/font1.tex +46 -0
  47. data/src/gocr-0.48/examples/font2.fig +27 -0
  48. data/src/gocr-0.48/examples/font_nw.tex +24 -0
  49. data/src/gocr-0.48/examples/handwrt1.jpg +0 -0
  50. data/src/gocr-0.48/examples/handwrt1.txt +10 -0
  51. data/src/gocr-0.48/examples/inverse.fig +20 -0
  52. data/src/gocr-0.48/examples/matrix.jpg +0 -0
  53. data/src/gocr-0.48/examples/ocr-a-subset.png +0 -0
  54. data/src/gocr-0.48/examples/ocr-a-subset.png.txt +4 -0
  55. data/src/gocr-0.48/examples/ocr-a.png +0 -0
  56. data/src/gocr-0.48/examples/ocr-a.txt +6 -0
  57. data/src/gocr-0.48/examples/ocr-b.png +0 -0
  58. data/src/gocr-0.48/examples/ocr-b.png.txt +4 -0
  59. data/src/gocr-0.48/examples/polish.tex +28 -0
  60. data/src/gocr-0.48/examples/rotate45.fig +14 -0
  61. data/src/gocr-0.48/examples/score +36 -0
  62. data/src/gocr-0.48/examples/text.tex +28 -0
  63. data/src/gocr-0.48/gocr.spec +143 -0
  64. data/src/gocr-0.48/gpl.html +537 -0
  65. data/src/gocr-0.48/include/.cvsignore +2 -0
  66. data/src/gocr-0.48/include/config.h +36 -0
  67. data/src/gocr-0.48/include/config.h.in +36 -0
  68. data/src/gocr-0.48/include/version.h +2 -0
  69. data/src/gocr-0.48/install-sh +3 -0
  70. data/src/gocr-0.48/make.bat +57 -0
  71. data/src/gocr-0.48/man/.cvsignore +2 -0
  72. data/src/gocr-0.48/man/Makefile +29 -0
  73. data/src/gocr-0.48/man/Makefile.in +29 -0
  74. data/src/gocr-0.48/man/man1/gocr.1 +166 -0
  75. data/src/gocr-0.48/src/.cvsignore +4 -0
  76. data/src/gocr-0.48/src/Makefile +132 -0
  77. data/src/gocr-0.48/src/Makefile.in +132 -0
  78. data/src/gocr-0.48/src/amiga.h +31 -0
  79. data/src/gocr-0.48/src/barcode.c +846 -0
  80. data/src/gocr-0.48/src/barcode.c.orig +593 -0
  81. data/src/gocr-0.48/src/barcode.h +11 -0
  82. data/src/gocr-0.48/src/box.c +372 -0
  83. data/src/gocr-0.48/src/database.c +462 -0
  84. data/src/gocr-0.48/src/detect.c +943 -0
  85. data/src/gocr-0.48/src/gocr.c +373 -0
  86. data/src/gocr-0.48/src/gocr.h +288 -0
  87. data/src/gocr-0.48/src/jconv.c +168 -0
  88. data/src/gocr-0.48/src/job.c +84 -0
  89. data/src/gocr-0.48/src/lines.c +350 -0
  90. data/src/gocr-0.48/src/list.c +334 -0
  91. data/src/gocr-0.48/src/list.h +90 -0
  92. data/src/gocr-0.48/src/ocr0.c +6756 -0
  93. data/src/gocr-0.48/src/ocr0.h +63 -0
  94. data/src/gocr-0.48/src/ocr0n.c +1475 -0
  95. data/src/gocr-0.48/src/ocr1.c +85 -0
  96. data/src/gocr-0.48/src/ocr1.h +3 -0
  97. data/src/gocr-0.48/src/otsu.c +289 -0
  98. data/src/gocr-0.48/src/otsu.h +23 -0
  99. data/src/gocr-0.48/src/output.c +289 -0
  100. data/src/gocr-0.48/src/output.h +37 -0
  101. data/src/gocr-0.48/src/pcx.c +153 -0
  102. data/src/gocr-0.48/src/pcx.h +9 -0
  103. data/src/gocr-0.48/src/pgm2asc.c +2893 -0
  104. data/src/gocr-0.48/src/pgm2asc.h +105 -0
  105. data/src/gocr-0.48/src/pixel.c +537 -0
  106. data/src/gocr-0.48/src/pnm.c +533 -0
  107. data/src/gocr-0.48/src/pnm.h +35 -0
  108. data/src/gocr-0.48/src/progress.c +87 -0
  109. data/src/gocr-0.48/src/progress.h +42 -0
  110. data/src/gocr-0.48/src/remove.c +703 -0
  111. data/src/gocr-0.48/src/tga.c +87 -0
  112. data/src/gocr-0.48/src/tga.h +6 -0
  113. data/src/gocr-0.48/src/unicode.c +1314 -0
  114. data/src/gocr-0.48/src/unicode.h +1257 -0
  115. data/src/jpeg-7/Makefile.am +133 -0
  116. data/src/jpeg-7/Makefile.in +1089 -0
  117. data/src/jpeg-7/README +322 -0
  118. data/src/jpeg-7/aclocal.m4 +8990 -0
  119. data/src/jpeg-7/ansi2knr.1 +36 -0
  120. data/src/jpeg-7/ansi2knr.c +739 -0
  121. data/src/jpeg-7/cderror.h +132 -0
  122. data/src/jpeg-7/cdjpeg.c +181 -0
  123. data/src/jpeg-7/cdjpeg.h +187 -0
  124. data/src/jpeg-7/change.log +270 -0
  125. data/src/jpeg-7/cjpeg.1 +325 -0
  126. data/src/jpeg-7/cjpeg.c +616 -0
  127. data/src/jpeg-7/ckconfig.c +402 -0
  128. data/src/jpeg-7/coderules.txt +118 -0
  129. data/src/jpeg-7/config.guess +1561 -0
  130. data/src/jpeg-7/config.sub +1686 -0
  131. data/src/jpeg-7/configure +17139 -0
  132. data/src/jpeg-7/configure.ac +317 -0
  133. data/src/jpeg-7/depcomp +630 -0
  134. data/src/jpeg-7/djpeg.1 +251 -0
  135. data/src/jpeg-7/djpeg.c +617 -0
  136. data/src/jpeg-7/example.c +433 -0
  137. data/src/jpeg-7/filelist.txt +215 -0
  138. data/src/jpeg-7/install-sh +520 -0
  139. data/src/jpeg-7/install.txt +1097 -0
  140. data/src/jpeg-7/jaricom.c +148 -0
  141. data/src/jpeg-7/jcapimin.c +282 -0
  142. data/src/jpeg-7/jcapistd.c +161 -0
  143. data/src/jpeg-7/jcarith.c +921 -0
  144. data/src/jpeg-7/jccoefct.c +453 -0
  145. data/src/jpeg-7/jccolor.c +459 -0
  146. data/src/jpeg-7/jcdctmgr.c +482 -0
  147. data/src/jpeg-7/jchuff.c +1612 -0
  148. data/src/jpeg-7/jcinit.c +65 -0
  149. data/src/jpeg-7/jcmainct.c +293 -0
  150. data/src/jpeg-7/jcmarker.c +667 -0
  151. data/src/jpeg-7/jcmaster.c +770 -0
  152. data/src/jpeg-7/jcomapi.c +106 -0
  153. data/src/jpeg-7/jconfig.bcc +48 -0
  154. data/src/jpeg-7/jconfig.cfg +45 -0
  155. data/src/jpeg-7/jconfig.dj +38 -0
  156. data/src/jpeg-7/jconfig.mac +43 -0
  157. data/src/jpeg-7/jconfig.manx +43 -0
  158. data/src/jpeg-7/jconfig.mc6 +52 -0
  159. data/src/jpeg-7/jconfig.sas +43 -0
  160. data/src/jpeg-7/jconfig.st +42 -0
  161. data/src/jpeg-7/jconfig.txt +155 -0
  162. data/src/jpeg-7/jconfig.vc +45 -0
  163. data/src/jpeg-7/jconfig.vms +37 -0
  164. data/src/jpeg-7/jconfig.wat +38 -0
  165. data/src/jpeg-7/jcparam.c +632 -0
  166. data/src/jpeg-7/jcprepct.c +358 -0
  167. data/src/jpeg-7/jcsample.c +545 -0
  168. data/src/jpeg-7/jctrans.c +381 -0
  169. data/src/jpeg-7/jdapimin.c +396 -0
  170. data/src/jpeg-7/jdapistd.c +275 -0
  171. data/src/jpeg-7/jdarith.c +762 -0
  172. data/src/jpeg-7/jdatadst.c +151 -0
  173. data/src/jpeg-7/jdatasrc.c +212 -0
  174. data/src/jpeg-7/jdcoefct.c +736 -0
  175. data/src/jpeg-7/jdcolor.c +396 -0
  176. data/src/jpeg-7/jdct.h +393 -0
  177. data/src/jpeg-7/jddctmgr.c +382 -0
  178. data/src/jpeg-7/jdhuff.c +1309 -0
  179. data/src/jpeg-7/jdinput.c +384 -0
  180. data/src/jpeg-7/jdmainct.c +512 -0
  181. data/src/jpeg-7/jdmarker.c +1360 -0
  182. data/src/jpeg-7/jdmaster.c +663 -0
  183. data/src/jpeg-7/jdmerge.c +400 -0
  184. data/src/jpeg-7/jdpostct.c +290 -0
  185. data/src/jpeg-7/jdsample.c +361 -0
  186. data/src/jpeg-7/jdtrans.c +136 -0
  187. data/src/jpeg-7/jerror.c +252 -0
  188. data/src/jpeg-7/jerror.h +304 -0
  189. data/src/jpeg-7/jfdctflt.c +174 -0
  190. data/src/jpeg-7/jfdctfst.c +230 -0
  191. data/src/jpeg-7/jfdctint.c +4348 -0
  192. data/src/jpeg-7/jidctflt.c +242 -0
  193. data/src/jpeg-7/jidctfst.c +368 -0
  194. data/src/jpeg-7/jidctint.c +5137 -0
  195. data/src/jpeg-7/jinclude.h +91 -0
  196. data/src/jpeg-7/jmemansi.c +167 -0
  197. data/src/jpeg-7/jmemdos.c +638 -0
  198. data/src/jpeg-7/jmemdosa.asm +379 -0
  199. data/src/jpeg-7/jmemmac.c +289 -0
  200. data/src/jpeg-7/jmemmgr.c +1118 -0
  201. data/src/jpeg-7/jmemname.c +276 -0
  202. data/src/jpeg-7/jmemnobs.c +109 -0
  203. data/src/jpeg-7/jmemsys.h +198 -0
  204. data/src/jpeg-7/jmorecfg.h +369 -0
  205. data/src/jpeg-7/jpegint.h +395 -0
  206. data/src/jpeg-7/jpeglib.h +1135 -0
  207. data/src/jpeg-7/jpegtran.1 +272 -0
  208. data/src/jpeg-7/jpegtran.c +546 -0
  209. data/src/jpeg-7/jquant1.c +856 -0
  210. data/src/jpeg-7/jquant2.c +1310 -0
  211. data/src/jpeg-7/jutils.c +179 -0
  212. data/src/jpeg-7/jversion.h +14 -0
  213. data/src/jpeg-7/libjpeg.map +4 -0
  214. data/src/jpeg-7/libjpeg.txt +3067 -0
  215. data/src/jpeg-7/ltmain.sh +8406 -0
  216. data/src/jpeg-7/makcjpeg.st +36 -0
  217. data/src/jpeg-7/makdjpeg.st +36 -0
  218. data/src/jpeg-7/makeadsw.vc6 +77 -0
  219. data/src/jpeg-7/makeasln.vc9 +33 -0
  220. data/src/jpeg-7/makecdep.vc6 +82 -0
  221. data/src/jpeg-7/makecdsp.vc6 +130 -0
  222. data/src/jpeg-7/makecmak.vc6 +159 -0
  223. data/src/jpeg-7/makecvcp.vc9 +186 -0
  224. data/src/jpeg-7/makeddep.vc6 +82 -0
  225. data/src/jpeg-7/makeddsp.vc6 +130 -0
  226. data/src/jpeg-7/makedmak.vc6 +159 -0
  227. data/src/jpeg-7/makedvcp.vc9 +186 -0
  228. data/src/jpeg-7/makefile.ansi +220 -0
  229. data/src/jpeg-7/makefile.bcc +291 -0
  230. data/src/jpeg-7/makefile.dj +226 -0
  231. data/src/jpeg-7/makefile.manx +220 -0
  232. data/src/jpeg-7/makefile.mc6 +255 -0
  233. data/src/jpeg-7/makefile.mms +224 -0
  234. data/src/jpeg-7/makefile.sas +258 -0
  235. data/src/jpeg-7/makefile.unix +234 -0
  236. data/src/jpeg-7/makefile.vc +217 -0
  237. data/src/jpeg-7/makefile.vms +142 -0
  238. data/src/jpeg-7/makefile.wat +239 -0
  239. data/src/jpeg-7/makejdep.vc6 +423 -0
  240. data/src/jpeg-7/makejdsp.vc6 +285 -0
  241. data/src/jpeg-7/makejdsw.vc6 +29 -0
  242. data/src/jpeg-7/makejmak.vc6 +425 -0
  243. data/src/jpeg-7/makejsln.vc9 +17 -0
  244. data/src/jpeg-7/makejvcp.vc9 +328 -0
  245. data/src/jpeg-7/makeproj.mac +213 -0
  246. data/src/jpeg-7/makerdep.vc6 +6 -0
  247. data/src/jpeg-7/makerdsp.vc6 +78 -0
  248. data/src/jpeg-7/makermak.vc6 +110 -0
  249. data/src/jpeg-7/makervcp.vc9 +133 -0
  250. data/src/jpeg-7/maketdep.vc6 +43 -0
  251. data/src/jpeg-7/maketdsp.vc6 +122 -0
  252. data/src/jpeg-7/maketmak.vc6 +131 -0
  253. data/src/jpeg-7/maketvcp.vc9 +178 -0
  254. data/src/jpeg-7/makewdep.vc6 +6 -0
  255. data/src/jpeg-7/makewdsp.vc6 +78 -0
  256. data/src/jpeg-7/makewmak.vc6 +110 -0
  257. data/src/jpeg-7/makewvcp.vc9 +133 -0
  258. data/src/jpeg-7/makljpeg.st +68 -0
  259. data/src/jpeg-7/maktjpeg.st +30 -0
  260. data/src/jpeg-7/makvms.opt +4 -0
  261. data/src/jpeg-7/missing +376 -0
  262. data/src/jpeg-7/rdbmp.c +439 -0
  263. data/src/jpeg-7/rdcolmap.c +253 -0
  264. data/src/jpeg-7/rdgif.c +38 -0
  265. data/src/jpeg-7/rdjpgcom.1 +63 -0
  266. data/src/jpeg-7/rdjpgcom.c +515 -0
  267. data/src/jpeg-7/rdppm.c +459 -0
  268. data/src/jpeg-7/rdrle.c +387 -0
  269. data/src/jpeg-7/rdswitch.c +365 -0
  270. data/src/jpeg-7/rdtarga.c +500 -0
  271. data/src/jpeg-7/structure.txt +945 -0
  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 +4 -0
  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 +1533 -0
  279. data/src/jpeg-7/transupp.h +205 -0
  280. data/src/jpeg-7/usage.txt +605 -0
  281. data/src/jpeg-7/wizard.txt +211 -0
  282. data/src/jpeg-7/wrbmp.c +442 -0
  283. data/src/jpeg-7/wrgif.c +399 -0
  284. data/src/jpeg-7/wrjpgcom.1 +103 -0
  285. data/src/jpeg-7/wrjpgcom.c +583 -0
  286. data/src/jpeg-7/wrppm.c +269 -0
  287. data/src/jpeg-7/wrrle.c +305 -0
  288. data/src/jpeg-7/wrtarga.c +253 -0
  289. data/test/isbn_test.rb +7 -0
  290. data/test/test_helper.rb +7 -0
  291. metadata +345 -0
@@ -0,0 +1,211 @@
1
+ Advanced usage instructions for the Independent JPEG Group's JPEG software
2
+ ==========================================================================
3
+
4
+ This file describes cjpeg's "switches for wizards".
5
+
6
+ The "wizard" switches are intended for experimentation with JPEG by persons
7
+ who are reasonably knowledgeable about the JPEG standard. If you don't know
8
+ what you are doing, DON'T USE THESE SWITCHES. You'll likely produce files
9
+ with worse image quality and/or poorer compression than you'd get from the
10
+ default settings. Furthermore, these switches must be used with caution
11
+ when making files intended for general use, because not all JPEG decoders
12
+ will support unusual JPEG parameter settings.
13
+
14
+
15
+ Quantization Table Adjustment
16
+ -----------------------------
17
+
18
+ Ordinarily, cjpeg starts with a default set of tables (the same ones given
19
+ as examples in the JPEG standard) and scales them up or down according to
20
+ the -quality setting. The details of the scaling algorithm can be found in
21
+ jcparam.c. At very low quality settings, some quantization table entries
22
+ can get scaled up to values exceeding 255. Although 2-byte quantization
23
+ values are supported by the IJG software, this feature is not in baseline
24
+ JPEG and is not supported by all implementations. If you need to ensure
25
+ wide compatibility of low-quality files, you can constrain the scaled
26
+ quantization values to no more than 255 by giving the -baseline switch.
27
+ Note that use of -baseline will result in poorer quality for the same file
28
+ size, since more bits than necessary are expended on higher AC coefficients.
29
+
30
+ You can substitute a different set of quantization values by using the
31
+ -qtables switch:
32
+
33
+ -qtables file Use the quantization tables given in the named file.
34
+
35
+ The specified file should be a text file containing decimal quantization
36
+ values. The file should contain one to four tables, each of 64 elements.
37
+ The tables are implicitly numbered 0,1,etc. in order of appearance. Table
38
+ entries appear in normal array order (NOT in the zigzag order in which they
39
+ will be stored in the JPEG file).
40
+
41
+ Quantization table files are free format, in that arbitrary whitespace can
42
+ appear between numbers. Also, comments can be included: a comment starts
43
+ with '#' and extends to the end of the line. Here is an example file that
44
+ duplicates the default quantization tables:
45
+
46
+ # Quantization tables given in JPEG spec, section K.1
47
+
48
+ # This is table 0 (the luminance table):
49
+ 16 11 10 16 24 40 51 61
50
+ 12 12 14 19 26 58 60 55
51
+ 14 13 16 24 40 57 69 56
52
+ 14 17 22 29 51 87 80 62
53
+ 18 22 37 56 68 109 103 77
54
+ 24 35 55 64 81 104 113 92
55
+ 49 64 78 87 103 121 120 101
56
+ 72 92 95 98 112 100 103 99
57
+
58
+ # This is table 1 (the chrominance table):
59
+ 17 18 24 47 99 99 99 99
60
+ 18 21 26 66 99 99 99 99
61
+ 24 26 56 99 99 99 99 99
62
+ 47 66 99 99 99 99 99 99
63
+ 99 99 99 99 99 99 99 99
64
+ 99 99 99 99 99 99 99 99
65
+ 99 99 99 99 99 99 99 99
66
+ 99 99 99 99 99 99 99 99
67
+
68
+ If the -qtables switch is used without -quality, then the specified tables
69
+ are used exactly as-is. If both -qtables and -quality are used, then the
70
+ tables taken from the file are scaled in the same fashion that the default
71
+ tables would be scaled for that quality setting. If -baseline appears, then
72
+ the quantization values are constrained to the range 1-255.
73
+
74
+ By default, cjpeg will use quantization table 0 for luminance components and
75
+ table 1 for chrominance components. To override this choice, use the -qslots
76
+ switch:
77
+
78
+ -qslots N[,...] Select which quantization table to use for
79
+ each color component.
80
+
81
+ The -qslots switch specifies a quantization table number for each color
82
+ component, in the order in which the components appear in the JPEG SOF marker.
83
+ For example, to create a separate table for each of Y,Cb,Cr, you could
84
+ provide a -qtables file that defines three quantization tables and say
85
+ "-qslots 0,1,2". If -qslots gives fewer table numbers than there are color
86
+ components, then the last table number is repeated as necessary.
87
+
88
+
89
+ Sampling Factor Adjustment
90
+ --------------------------
91
+
92
+ By default, cjpeg uses 2:1 horizontal and vertical downsampling when
93
+ compressing YCbCr data, and no downsampling for all other color spaces.
94
+ You can override this default with the -sample switch:
95
+
96
+ -sample HxV[,...] Set JPEG sampling factors for each color
97
+ component.
98
+
99
+ The -sample switch specifies the JPEG sampling factors for each color
100
+ component, in the order in which they appear in the JPEG SOF marker.
101
+ If you specify fewer HxV pairs than there are components, the remaining
102
+ components are set to 1x1 sampling. For example, the default YCbCr setting
103
+ is equivalent to "-sample 2x2,1x1,1x1", which can be abbreviated to
104
+ "-sample 2x2".
105
+
106
+ There are still some JPEG decoders in existence that support only 2x1
107
+ sampling (also called 4:2:2 sampling). Compatibility with such decoders can
108
+ be achieved by specifying "-sample 2x1". This is not recommended unless
109
+ really necessary, since it increases file size and encoding/decoding time
110
+ with very little quality gain.
111
+
112
+
113
+ Multiple Scan / Progression Control
114
+ -----------------------------------
115
+
116
+ By default, cjpeg emits a single-scan sequential JPEG file. The
117
+ -progressive switch generates a progressive JPEG file using a default series
118
+ of progression parameters. You can create multiple-scan sequential JPEG
119
+ files or progressive JPEG files with custom progression parameters by using
120
+ the -scans switch:
121
+
122
+ -scans file Use the scan sequence given in the named file.
123
+
124
+ The specified file should be a text file containing a "scan script".
125
+ The script specifies the contents and ordering of the scans to be emitted.
126
+ Each entry in the script defines one scan. A scan definition specifies
127
+ the components to be included in the scan, and for progressive JPEG it also
128
+ specifies the progression parameters Ss,Se,Ah,Al for the scan. Scan
129
+ definitions are separated by semicolons (';'). A semicolon after the last
130
+ scan definition is optional.
131
+
132
+ Each scan definition contains one to four component indexes, optionally
133
+ followed by a colon (':') and the four progressive-JPEG parameters. The
134
+ component indexes denote which color component(s) are to be transmitted in
135
+ the scan. Components are numbered in the order in which they appear in the
136
+ JPEG SOF marker, with the first component being numbered 0. (Note that these
137
+ indexes are not the "component ID" codes assigned to the components, just
138
+ positional indexes.)
139
+
140
+ The progression parameters for each scan are:
141
+ Ss Zigzag index of first coefficient included in scan
142
+ Se Zigzag index of last coefficient included in scan
143
+ Ah Zero for first scan of a coefficient, else Al of prior scan
144
+ Al Successive approximation low bit position for scan
145
+ If the progression parameters are omitted, the values 0,63,0,0 are used,
146
+ producing a sequential JPEG file. cjpeg automatically determines whether
147
+ the script represents a progressive or sequential file, by observing whether
148
+ Ss and Se values other than 0 and 63 appear. (The -progressive switch is
149
+ not needed to specify this; in fact, it is ignored when -scans appears.)
150
+ The scan script must meet the JPEG restrictions on progression sequences.
151
+ (cjpeg checks that the spec's requirements are obeyed.)
152
+
153
+ Scan script files are free format, in that arbitrary whitespace can appear
154
+ between numbers and around punctuation. Also, comments can be included: a
155
+ comment starts with '#' and extends to the end of the line. For additional
156
+ legibility, commas or dashes can be placed between values. (Actually, any
157
+ single punctuation character other than ':' or ';' can be inserted.) For
158
+ example, the following two scan definitions are equivalent:
159
+ 0 1 2: 0 63 0 0;
160
+ 0,1,2 : 0-63, 0,0 ;
161
+
162
+ Here is an example of a scan script that generates a partially interleaved
163
+ sequential JPEG file:
164
+
165
+ 0; # Y only in first scan
166
+ 1 2; # Cb and Cr in second scan
167
+
168
+ Here is an example of a progressive scan script using only spectral selection
169
+ (no successive approximation):
170
+
171
+ # Interleaved DC scan for Y,Cb,Cr:
172
+ 0,1,2: 0-0, 0, 0 ;
173
+ # AC scans:
174
+ 0: 1-2, 0, 0 ; # First two Y AC coefficients
175
+ 0: 3-5, 0, 0 ; # Three more
176
+ 1: 1-63, 0, 0 ; # All AC coefficients for Cb
177
+ 2: 1-63, 0, 0 ; # All AC coefficients for Cr
178
+ 0: 6-9, 0, 0 ; # More Y coefficients
179
+ 0: 10-63, 0, 0 ; # Remaining Y coefficients
180
+
181
+ Here is an example of a successive-approximation script. This is equivalent
182
+ to the default script used by "cjpeg -progressive" for YCbCr images:
183
+
184
+ # Initial DC scan for Y,Cb,Cr (lowest bit not sent)
185
+ 0,1,2: 0-0, 0, 1 ;
186
+ # First AC scan: send first 5 Y AC coefficients, minus 2 lowest bits:
187
+ 0: 1-5, 0, 2 ;
188
+ # Send all Cr,Cb AC coefficients, minus lowest bit:
189
+ # (chroma data is usually too small to be worth subdividing further;
190
+ # but note we send Cr first since eye is least sensitive to Cb)
191
+ 2: 1-63, 0, 1 ;
192
+ 1: 1-63, 0, 1 ;
193
+ # Send remaining Y AC coefficients, minus 2 lowest bits:
194
+ 0: 6-63, 0, 2 ;
195
+ # Send next-to-lowest bit of all Y AC coefficients:
196
+ 0: 1-63, 2, 1 ;
197
+ # At this point we've sent all but the lowest bit of all coefficients.
198
+ # Send lowest bit of DC coefficients
199
+ 0,1,2: 0-0, 1, 0 ;
200
+ # Send lowest bit of AC coefficients
201
+ 2: 1-63, 1, 0 ;
202
+ 1: 1-63, 1, 0 ;
203
+ # Y AC lowest bit scan is last; it's usually the largest scan
204
+ 0: 1-63, 1, 0 ;
205
+
206
+ It may be worth pointing out that this script is tuned for quality settings
207
+ of around 50 to 75. For lower quality settings, you'd probably want to use
208
+ a script with fewer stages of successive approximation (otherwise the
209
+ initial scans will be really bad). For higher quality settings, you might
210
+ want to use more stages of successive approximation (so that the initial
211
+ scans are not too large).
@@ -0,0 +1,442 @@
1
+ /*
2
+ * wrbmp.c
3
+ *
4
+ * Copyright (C) 1994-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 Microsoft "BMP"
9
+ * format (MS Windows 3.x and OS/2 1.x flavors).
10
+ * Either 8-bit colormapped or 24-bit full-color format can be written.
11
+ * No compression is supported.
12
+ *
13
+ * These routines may need modification for non-Unix environments or
14
+ * specialized applications. As they stand, they assume output to
15
+ * an ordinary stdio stream.
16
+ *
17
+ * This code contributed by James Arthur Boucher.
18
+ */
19
+
20
+ #include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */
21
+
22
+ #ifdef BMP_SUPPORTED
23
+
24
+
25
+ /*
26
+ * To support 12-bit JPEG data, we'd have to scale output down to 8 bits.
27
+ * This is not yet implemented.
28
+ */
29
+
30
+ #if BITS_IN_JSAMPLE != 8
31
+ Sorry, this code only copes with 8-bit JSAMPLEs. /* deliberate syntax err */
32
+ #endif
33
+
34
+ /*
35
+ * Since BMP stores scanlines bottom-to-top, we have to invert the image
36
+ * from JPEG's top-to-bottom order. To do this, we save the outgoing data
37
+ * in a virtual array during put_pixel_row calls, then actually emit the
38
+ * BMP file during finish_output. The virtual array contains one JSAMPLE per
39
+ * pixel if the output is grayscale or colormapped, three if it is full color.
40
+ */
41
+
42
+ /* Private version of data destination object */
43
+
44
+ typedef struct {
45
+ struct djpeg_dest_struct pub; /* public fields */
46
+
47
+ boolean is_os2; /* saves the OS2 format request flag */
48
+
49
+ jvirt_sarray_ptr whole_image; /* needed to reverse row order */
50
+ JDIMENSION data_width; /* JSAMPLEs per row */
51
+ JDIMENSION row_width; /* physical width of one row in the BMP file */
52
+ int pad_bytes; /* number of padding bytes needed per row */
53
+ JDIMENSION cur_output_row; /* next row# to write to virtual array */
54
+ } bmp_dest_struct;
55
+
56
+ typedef bmp_dest_struct * bmp_dest_ptr;
57
+
58
+
59
+ /* Forward declarations */
60
+ LOCAL(void) write_colormap
61
+ JPP((j_decompress_ptr cinfo, bmp_dest_ptr dest,
62
+ int map_colors, int map_entry_size));
63
+
64
+
65
+ /*
66
+ * Write some pixel data.
67
+ * In this module rows_supplied will always be 1.
68
+ */
69
+
70
+ METHODDEF(void)
71
+ put_pixel_rows (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo,
72
+ JDIMENSION rows_supplied)
73
+ /* This version is for writing 24-bit pixels */
74
+ {
75
+ bmp_dest_ptr dest = (bmp_dest_ptr) dinfo;
76
+ JSAMPARRAY image_ptr;
77
+ register JSAMPROW inptr, outptr;
78
+ register JDIMENSION col;
79
+ int pad;
80
+
81
+ /* Access next row in virtual array */
82
+ image_ptr = (*cinfo->mem->access_virt_sarray)
83
+ ((j_common_ptr) cinfo, dest->whole_image,
84
+ dest->cur_output_row, (JDIMENSION) 1, TRUE);
85
+ dest->cur_output_row++;
86
+
87
+ /* Transfer data. Note destination values must be in BGR order
88
+ * (even though Microsoft's own documents say the opposite).
89
+ */
90
+ inptr = dest->pub.buffer[0];
91
+ outptr = image_ptr[0];
92
+ for (col = cinfo->output_width; col > 0; col--) {
93
+ outptr[2] = *inptr++; /* can omit GETJSAMPLE() safely */
94
+ outptr[1] = *inptr++;
95
+ outptr[0] = *inptr++;
96
+ outptr += 3;
97
+ }
98
+
99
+ /* Zero out the pad bytes. */
100
+ pad = dest->pad_bytes;
101
+ while (--pad >= 0)
102
+ *outptr++ = 0;
103
+ }
104
+
105
+ METHODDEF(void)
106
+ put_gray_rows (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo,
107
+ JDIMENSION rows_supplied)
108
+ /* This version is for grayscale OR quantized color output */
109
+ {
110
+ bmp_dest_ptr dest = (bmp_dest_ptr) dinfo;
111
+ JSAMPARRAY image_ptr;
112
+ register JSAMPROW inptr, outptr;
113
+ register JDIMENSION col;
114
+ int pad;
115
+
116
+ /* Access next row in virtual array */
117
+ image_ptr = (*cinfo->mem->access_virt_sarray)
118
+ ((j_common_ptr) cinfo, dest->whole_image,
119
+ dest->cur_output_row, (JDIMENSION) 1, TRUE);
120
+ dest->cur_output_row++;
121
+
122
+ /* Transfer data. */
123
+ inptr = dest->pub.buffer[0];
124
+ outptr = image_ptr[0];
125
+ for (col = cinfo->output_width; col > 0; col--) {
126
+ *outptr++ = *inptr++; /* can omit GETJSAMPLE() safely */
127
+ }
128
+
129
+ /* Zero out the pad bytes. */
130
+ pad = dest->pad_bytes;
131
+ while (--pad >= 0)
132
+ *outptr++ = 0;
133
+ }
134
+
135
+
136
+ /*
137
+ * Startup: normally writes the file header.
138
+ * In this module we may as well postpone everything until finish_output.
139
+ */
140
+
141
+ METHODDEF(void)
142
+ start_output_bmp (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo)
143
+ {
144
+ /* no work here */
145
+ }
146
+
147
+
148
+ /*
149
+ * Finish up at the end of the file.
150
+ *
151
+ * Here is where we really output the BMP file.
152
+ *
153
+ * First, routines to write the Windows and OS/2 variants of the file header.
154
+ */
155
+
156
+ LOCAL(void)
157
+ write_bmp_header (j_decompress_ptr cinfo, bmp_dest_ptr dest)
158
+ /* Write a Windows-style BMP file header, including colormap if needed */
159
+ {
160
+ char bmpfileheader[14];
161
+ char bmpinfoheader[40];
162
+ #define PUT_2B(array,offset,value) \
163
+ (array[offset] = (char) ((value) & 0xFF), \
164
+ array[offset+1] = (char) (((value) >> 8) & 0xFF))
165
+ #define PUT_4B(array,offset,value) \
166
+ (array[offset] = (char) ((value) & 0xFF), \
167
+ array[offset+1] = (char) (((value) >> 8) & 0xFF), \
168
+ array[offset+2] = (char) (((value) >> 16) & 0xFF), \
169
+ array[offset+3] = (char) (((value) >> 24) & 0xFF))
170
+ INT32 headersize, bfSize;
171
+ int bits_per_pixel, cmap_entries;
172
+
173
+ /* Compute colormap size and total file size */
174
+ if (cinfo->out_color_space == JCS_RGB) {
175
+ if (cinfo->quantize_colors) {
176
+ /* Colormapped RGB */
177
+ bits_per_pixel = 8;
178
+ cmap_entries = 256;
179
+ } else {
180
+ /* Unquantized, full color RGB */
181
+ bits_per_pixel = 24;
182
+ cmap_entries = 0;
183
+ }
184
+ } else {
185
+ /* Grayscale output. We need to fake a 256-entry colormap. */
186
+ bits_per_pixel = 8;
187
+ cmap_entries = 256;
188
+ }
189
+ /* File size */
190
+ headersize = 14 + 40 + cmap_entries * 4; /* Header and colormap */
191
+ bfSize = headersize + (INT32) dest->row_width * (INT32) cinfo->output_height;
192
+
193
+ /* Set unused fields of header to 0 */
194
+ MEMZERO(bmpfileheader, SIZEOF(bmpfileheader));
195
+ MEMZERO(bmpinfoheader, SIZEOF(bmpinfoheader));
196
+
197
+ /* Fill the file header */
198
+ bmpfileheader[0] = 0x42; /* first 2 bytes are ASCII 'B', 'M' */
199
+ bmpfileheader[1] = 0x4D;
200
+ PUT_4B(bmpfileheader, 2, bfSize); /* bfSize */
201
+ /* we leave bfReserved1 & bfReserved2 = 0 */
202
+ PUT_4B(bmpfileheader, 10, headersize); /* bfOffBits */
203
+
204
+ /* Fill the info header (Microsoft calls this a BITMAPINFOHEADER) */
205
+ PUT_2B(bmpinfoheader, 0, 40); /* biSize */
206
+ PUT_4B(bmpinfoheader, 4, cinfo->output_width); /* biWidth */
207
+ PUT_4B(bmpinfoheader, 8, cinfo->output_height); /* biHeight */
208
+ PUT_2B(bmpinfoheader, 12, 1); /* biPlanes - must be 1 */
209
+ PUT_2B(bmpinfoheader, 14, bits_per_pixel); /* biBitCount */
210
+ /* we leave biCompression = 0, for none */
211
+ /* we leave biSizeImage = 0; this is correct for uncompressed data */
212
+ if (cinfo->density_unit == 2) { /* if have density in dots/cm, then */
213
+ PUT_4B(bmpinfoheader, 24, (INT32) (cinfo->X_density*100)); /* XPels/M */
214
+ PUT_4B(bmpinfoheader, 28, (INT32) (cinfo->Y_density*100)); /* XPels/M */
215
+ }
216
+ PUT_2B(bmpinfoheader, 32, cmap_entries); /* biClrUsed */
217
+ /* we leave biClrImportant = 0 */
218
+
219
+ if (JFWRITE(dest->pub.output_file, bmpfileheader, 14) != (size_t) 14)
220
+ ERREXIT(cinfo, JERR_FILE_WRITE);
221
+ if (JFWRITE(dest->pub.output_file, bmpinfoheader, 40) != (size_t) 40)
222
+ ERREXIT(cinfo, JERR_FILE_WRITE);
223
+
224
+ if (cmap_entries > 0)
225
+ write_colormap(cinfo, dest, cmap_entries, 4);
226
+ }
227
+
228
+
229
+ LOCAL(void)
230
+ write_os2_header (j_decompress_ptr cinfo, bmp_dest_ptr dest)
231
+ /* Write an OS2-style BMP file header, including colormap if needed */
232
+ {
233
+ char bmpfileheader[14];
234
+ char bmpcoreheader[12];
235
+ INT32 headersize, bfSize;
236
+ int bits_per_pixel, cmap_entries;
237
+
238
+ /* Compute colormap size and total file size */
239
+ if (cinfo->out_color_space == JCS_RGB) {
240
+ if (cinfo->quantize_colors) {
241
+ /* Colormapped RGB */
242
+ bits_per_pixel = 8;
243
+ cmap_entries = 256;
244
+ } else {
245
+ /* Unquantized, full color RGB */
246
+ bits_per_pixel = 24;
247
+ cmap_entries = 0;
248
+ }
249
+ } else {
250
+ /* Grayscale output. We need to fake a 256-entry colormap. */
251
+ bits_per_pixel = 8;
252
+ cmap_entries = 256;
253
+ }
254
+ /* File size */
255
+ headersize = 14 + 12 + cmap_entries * 3; /* Header and colormap */
256
+ bfSize = headersize + (INT32) dest->row_width * (INT32) cinfo->output_height;
257
+
258
+ /* Set unused fields of header to 0 */
259
+ MEMZERO(bmpfileheader, SIZEOF(bmpfileheader));
260
+ MEMZERO(bmpcoreheader, SIZEOF(bmpcoreheader));
261
+
262
+ /* Fill the file header */
263
+ bmpfileheader[0] = 0x42; /* first 2 bytes are ASCII 'B', 'M' */
264
+ bmpfileheader[1] = 0x4D;
265
+ PUT_4B(bmpfileheader, 2, bfSize); /* bfSize */
266
+ /* we leave bfReserved1 & bfReserved2 = 0 */
267
+ PUT_4B(bmpfileheader, 10, headersize); /* bfOffBits */
268
+
269
+ /* Fill the info header (Microsoft calls this a BITMAPCOREHEADER) */
270
+ PUT_2B(bmpcoreheader, 0, 12); /* bcSize */
271
+ PUT_2B(bmpcoreheader, 4, cinfo->output_width); /* bcWidth */
272
+ PUT_2B(bmpcoreheader, 6, cinfo->output_height); /* bcHeight */
273
+ PUT_2B(bmpcoreheader, 8, 1); /* bcPlanes - must be 1 */
274
+ PUT_2B(bmpcoreheader, 10, bits_per_pixel); /* bcBitCount */
275
+
276
+ if (JFWRITE(dest->pub.output_file, bmpfileheader, 14) != (size_t) 14)
277
+ ERREXIT(cinfo, JERR_FILE_WRITE);
278
+ if (JFWRITE(dest->pub.output_file, bmpcoreheader, 12) != (size_t) 12)
279
+ ERREXIT(cinfo, JERR_FILE_WRITE);
280
+
281
+ if (cmap_entries > 0)
282
+ write_colormap(cinfo, dest, cmap_entries, 3);
283
+ }
284
+
285
+
286
+ /*
287
+ * Write the colormap.
288
+ * Windows uses BGR0 map entries; OS/2 uses BGR entries.
289
+ */
290
+
291
+ LOCAL(void)
292
+ write_colormap (j_decompress_ptr cinfo, bmp_dest_ptr dest,
293
+ int map_colors, int map_entry_size)
294
+ {
295
+ JSAMPARRAY colormap = cinfo->colormap;
296
+ int num_colors = cinfo->actual_number_of_colors;
297
+ FILE * outfile = dest->pub.output_file;
298
+ int i;
299
+
300
+ if (colormap != NULL) {
301
+ if (cinfo->out_color_components == 3) {
302
+ /* Normal case with RGB colormap */
303
+ for (i = 0; i < num_colors; i++) {
304
+ putc(GETJSAMPLE(colormap[2][i]), outfile);
305
+ putc(GETJSAMPLE(colormap[1][i]), outfile);
306
+ putc(GETJSAMPLE(colormap[0][i]), outfile);
307
+ if (map_entry_size == 4)
308
+ putc(0, outfile);
309
+ }
310
+ } else {
311
+ /* Grayscale colormap (only happens with grayscale quantization) */
312
+ for (i = 0; i < num_colors; i++) {
313
+ putc(GETJSAMPLE(colormap[0][i]), outfile);
314
+ putc(GETJSAMPLE(colormap[0][i]), outfile);
315
+ putc(GETJSAMPLE(colormap[0][i]), outfile);
316
+ if (map_entry_size == 4)
317
+ putc(0, outfile);
318
+ }
319
+ }
320
+ } else {
321
+ /* If no colormap, must be grayscale data. Generate a linear "map". */
322
+ for (i = 0; i < 256; i++) {
323
+ putc(i, outfile);
324
+ putc(i, outfile);
325
+ putc(i, outfile);
326
+ if (map_entry_size == 4)
327
+ putc(0, outfile);
328
+ }
329
+ }
330
+ /* Pad colormap with zeros to ensure specified number of colormap entries */
331
+ if (i > map_colors)
332
+ ERREXIT1(cinfo, JERR_TOO_MANY_COLORS, i);
333
+ for (; i < map_colors; i++) {
334
+ putc(0, outfile);
335
+ putc(0, outfile);
336
+ putc(0, outfile);
337
+ if (map_entry_size == 4)
338
+ putc(0, outfile);
339
+ }
340
+ }
341
+
342
+
343
+ METHODDEF(void)
344
+ finish_output_bmp (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo)
345
+ {
346
+ bmp_dest_ptr dest = (bmp_dest_ptr) dinfo;
347
+ register FILE * outfile = dest->pub.output_file;
348
+ JSAMPARRAY image_ptr;
349
+ register JSAMPROW data_ptr;
350
+ JDIMENSION row;
351
+ register JDIMENSION col;
352
+ cd_progress_ptr progress = (cd_progress_ptr) cinfo->progress;
353
+
354
+ /* Write the header and colormap */
355
+ if (dest->is_os2)
356
+ write_os2_header(cinfo, dest);
357
+ else
358
+ write_bmp_header(cinfo, dest);
359
+
360
+ /* Write the file body from our virtual array */
361
+ for (row = cinfo->output_height; row > 0; row--) {
362
+ if (progress != NULL) {
363
+ progress->pub.pass_counter = (long) (cinfo->output_height - row);
364
+ progress->pub.pass_limit = (long) cinfo->output_height;
365
+ (*progress->pub.progress_monitor) ((j_common_ptr) cinfo);
366
+ }
367
+ image_ptr = (*cinfo->mem->access_virt_sarray)
368
+ ((j_common_ptr) cinfo, dest->whole_image, row-1, (JDIMENSION) 1, FALSE);
369
+ data_ptr = image_ptr[0];
370
+ for (col = dest->row_width; col > 0; col--) {
371
+ putc(GETJSAMPLE(*data_ptr), outfile);
372
+ data_ptr++;
373
+ }
374
+ }
375
+ if (progress != NULL)
376
+ progress->completed_extra_passes++;
377
+
378
+ /* Make sure we wrote the output file OK */
379
+ fflush(outfile);
380
+ if (ferror(outfile))
381
+ ERREXIT(cinfo, JERR_FILE_WRITE);
382
+ }
383
+
384
+
385
+ /*
386
+ * The module selection routine for BMP format output.
387
+ */
388
+
389
+ GLOBAL(djpeg_dest_ptr)
390
+ jinit_write_bmp (j_decompress_ptr cinfo, boolean is_os2)
391
+ {
392
+ bmp_dest_ptr dest;
393
+ JDIMENSION row_width;
394
+
395
+ /* Create module interface object, fill in method pointers */
396
+ dest = (bmp_dest_ptr)
397
+ (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
398
+ SIZEOF(bmp_dest_struct));
399
+ dest->pub.start_output = start_output_bmp;
400
+ dest->pub.finish_output = finish_output_bmp;
401
+ dest->is_os2 = is_os2;
402
+
403
+ if (cinfo->out_color_space == JCS_GRAYSCALE) {
404
+ dest->pub.put_pixel_rows = put_gray_rows;
405
+ } else if (cinfo->out_color_space == JCS_RGB) {
406
+ if (cinfo->quantize_colors)
407
+ dest->pub.put_pixel_rows = put_gray_rows;
408
+ else
409
+ dest->pub.put_pixel_rows = put_pixel_rows;
410
+ } else {
411
+ ERREXIT(cinfo, JERR_BMP_COLORSPACE);
412
+ }
413
+
414
+ /* Calculate output image dimensions so we can allocate space */
415
+ jpeg_calc_output_dimensions(cinfo);
416
+
417
+ /* Determine width of rows in the BMP file (padded to 4-byte boundary). */
418
+ row_width = cinfo->output_width * cinfo->output_components;
419
+ dest->data_width = row_width;
420
+ while ((row_width & 3) != 0) row_width++;
421
+ dest->row_width = row_width;
422
+ dest->pad_bytes = (int) (row_width - dest->data_width);
423
+
424
+ /* Allocate space for inversion array, prepare for write pass */
425
+ dest->whole_image = (*cinfo->mem->request_virt_sarray)
426
+ ((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE,
427
+ row_width, cinfo->output_height, (JDIMENSION) 1);
428
+ dest->cur_output_row = 0;
429
+ if (cinfo->progress != NULL) {
430
+ cd_progress_ptr progress = (cd_progress_ptr) cinfo->progress;
431
+ progress->total_extra_passes++; /* count file input as separate pass */
432
+ }
433
+
434
+ /* Create decompressor output buffer. */
435
+ dest->pub.buffer = (*cinfo->mem->alloc_sarray)
436
+ ((j_common_ptr) cinfo, JPOOL_IMAGE, row_width, (JDIMENSION) 1);
437
+ dest->pub.buffer_height = 1;
438
+
439
+ return (djpeg_dest_ptr) dest;
440
+ }
441
+
442
+ #endif /* BMP_SUPPORTED */