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/jdmerge.c DELETED
@@ -1,400 +0,0 @@
1
- /*
2
- * jdmerge.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 code for merged upsampling/color conversion.
9
- *
10
- * This file combines functions from jdsample.c and jdcolor.c;
11
- * read those files first to understand what's going on.
12
- *
13
- * When the chroma components are to be upsampled by simple replication
14
- * (ie, box filtering), we can save some work in color conversion by
15
- * calculating all the output pixels corresponding to a pair of chroma
16
- * samples at one time. In the conversion equations
17
- * R = Y + K1 * Cr
18
- * G = Y + K2 * Cb + K3 * Cr
19
- * B = Y + K4 * Cb
20
- * only the Y term varies among the group of pixels corresponding to a pair
21
- * of chroma samples, so the rest of the terms can be calculated just once.
22
- * At typical sampling ratios, this eliminates half or three-quarters of the
23
- * multiplications needed for color conversion.
24
- *
25
- * This file currently provides implementations for the following cases:
26
- * YCbCr => RGB color conversion only.
27
- * Sampling ratios of 2h1v or 2h2v.
28
- * No scaling needed at upsample time.
29
- * Corner-aligned (non-CCIR601) sampling alignment.
30
- * Other special cases could be added, but in most applications these are
31
- * the only common cases. (For uncommon cases we fall back on the more
32
- * general code in jdsample.c and jdcolor.c.)
33
- */
34
-
35
- #define JPEG_INTERNALS
36
- #include "jinclude.h"
37
- #include "jpeglib.h"
38
-
39
- #ifdef UPSAMPLE_MERGING_SUPPORTED
40
-
41
-
42
- /* Private subobject */
43
-
44
- typedef struct {
45
- struct jpeg_upsampler pub; /* public fields */
46
-
47
- /* Pointer to routine to do actual upsampling/conversion of one row group */
48
- JMETHOD(void, upmethod, (j_decompress_ptr cinfo,
49
- JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr,
50
- JSAMPARRAY output_buf));
51
-
52
- /* Private state for YCC->RGB conversion */
53
- int * Cr_r_tab; /* => table for Cr to R conversion */
54
- int * Cb_b_tab; /* => table for Cb to B conversion */
55
- INT32 * Cr_g_tab; /* => table for Cr to G conversion */
56
- INT32 * Cb_g_tab; /* => table for Cb to G conversion */
57
-
58
- /* For 2:1 vertical sampling, we produce two output rows at a time.
59
- * We need a "spare" row buffer to hold the second output row if the
60
- * application provides just a one-row buffer; we also use the spare
61
- * to discard the dummy last row if the image height is odd.
62
- */
63
- JSAMPROW spare_row;
64
- boolean spare_full; /* T if spare buffer is occupied */
65
-
66
- JDIMENSION out_row_width; /* samples per output row */
67
- JDIMENSION rows_to_go; /* counts rows remaining in image */
68
- } my_upsampler;
69
-
70
- typedef my_upsampler * my_upsample_ptr;
71
-
72
- #define SCALEBITS 16 /* speediest right-shift on some machines */
73
- #define ONE_HALF ((INT32) 1 << (SCALEBITS-1))
74
- #define FIX(x) ((INT32) ((x) * (1L<<SCALEBITS) + 0.5))
75
-
76
-
77
- /*
78
- * Initialize tables for YCC->RGB colorspace conversion.
79
- * This is taken directly from jdcolor.c; see that file for more info.
80
- */
81
-
82
- LOCAL(void)
83
- build_ycc_rgb_table (j_decompress_ptr cinfo)
84
- {
85
- my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
86
- int i;
87
- INT32 x;
88
- SHIFT_TEMPS
89
-
90
- upsample->Cr_r_tab = (int *)
91
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
92
- (MAXJSAMPLE+1) * SIZEOF(int));
93
- upsample->Cb_b_tab = (int *)
94
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
95
- (MAXJSAMPLE+1) * SIZEOF(int));
96
- upsample->Cr_g_tab = (INT32 *)
97
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
98
- (MAXJSAMPLE+1) * SIZEOF(INT32));
99
- upsample->Cb_g_tab = (INT32 *)
100
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
101
- (MAXJSAMPLE+1) * SIZEOF(INT32));
102
-
103
- for (i = 0, x = -CENTERJSAMPLE; i <= MAXJSAMPLE; i++, x++) {
104
- /* i is the actual input pixel value, in the range 0..MAXJSAMPLE */
105
- /* The Cb or Cr value we are thinking of is x = i - CENTERJSAMPLE */
106
- /* Cr=>R value is nearest int to 1.40200 * x */
107
- upsample->Cr_r_tab[i] = (int)
108
- RIGHT_SHIFT(FIX(1.40200) * x + ONE_HALF, SCALEBITS);
109
- /* Cb=>B value is nearest int to 1.77200 * x */
110
- upsample->Cb_b_tab[i] = (int)
111
- RIGHT_SHIFT(FIX(1.77200) * x + ONE_HALF, SCALEBITS);
112
- /* Cr=>G value is scaled-up -0.71414 * x */
113
- upsample->Cr_g_tab[i] = (- FIX(0.71414)) * x;
114
- /* Cb=>G value is scaled-up -0.34414 * x */
115
- /* We also add in ONE_HALF so that need not do it in inner loop */
116
- upsample->Cb_g_tab[i] = (- FIX(0.34414)) * x + ONE_HALF;
117
- }
118
- }
119
-
120
-
121
- /*
122
- * Initialize for an upsampling pass.
123
- */
124
-
125
- METHODDEF(void)
126
- start_pass_merged_upsample (j_decompress_ptr cinfo)
127
- {
128
- my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
129
-
130
- /* Mark the spare buffer empty */
131
- upsample->spare_full = FALSE;
132
- /* Initialize total-height counter for detecting bottom of image */
133
- upsample->rows_to_go = cinfo->output_height;
134
- }
135
-
136
-
137
- /*
138
- * Control routine to do upsampling (and color conversion).
139
- *
140
- * The control routine just handles the row buffering considerations.
141
- */
142
-
143
- METHODDEF(void)
144
- merged_2v_upsample (j_decompress_ptr cinfo,
145
- JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr,
146
- JDIMENSION in_row_groups_avail,
147
- JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
148
- JDIMENSION out_rows_avail)
149
- /* 2:1 vertical sampling case: may need a spare row. */
150
- {
151
- my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
152
- JSAMPROW work_ptrs[2];
153
- JDIMENSION num_rows; /* number of rows returned to caller */
154
-
155
- if (upsample->spare_full) {
156
- /* If we have a spare row saved from a previous cycle, just return it. */
157
- jcopy_sample_rows(& upsample->spare_row, 0, output_buf + *out_row_ctr, 0,
158
- 1, upsample->out_row_width);
159
- num_rows = 1;
160
- upsample->spare_full = FALSE;
161
- } else {
162
- /* Figure number of rows to return to caller. */
163
- num_rows = 2;
164
- /* Not more than the distance to the end of the image. */
165
- if (num_rows > upsample->rows_to_go)
166
- num_rows = upsample->rows_to_go;
167
- /* And not more than what the client can accept: */
168
- out_rows_avail -= *out_row_ctr;
169
- if (num_rows > out_rows_avail)
170
- num_rows = out_rows_avail;
171
- /* Create output pointer array for upsampler. */
172
- work_ptrs[0] = output_buf[*out_row_ctr];
173
- if (num_rows > 1) {
174
- work_ptrs[1] = output_buf[*out_row_ctr + 1];
175
- } else {
176
- work_ptrs[1] = upsample->spare_row;
177
- upsample->spare_full = TRUE;
178
- }
179
- /* Now do the upsampling. */
180
- (*upsample->upmethod) (cinfo, input_buf, *in_row_group_ctr, work_ptrs);
181
- }
182
-
183
- /* Adjust counts */
184
- *out_row_ctr += num_rows;
185
- upsample->rows_to_go -= num_rows;
186
- /* When the buffer is emptied, declare this input row group consumed */
187
- if (! upsample->spare_full)
188
- (*in_row_group_ctr)++;
189
- }
190
-
191
-
192
- METHODDEF(void)
193
- merged_1v_upsample (j_decompress_ptr cinfo,
194
- JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr,
195
- JDIMENSION in_row_groups_avail,
196
- JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
197
- JDIMENSION out_rows_avail)
198
- /* 1:1 vertical sampling case: much easier, never need a spare row. */
199
- {
200
- my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
201
-
202
- /* Just do the upsampling. */
203
- (*upsample->upmethod) (cinfo, input_buf, *in_row_group_ctr,
204
- output_buf + *out_row_ctr);
205
- /* Adjust counts */
206
- (*out_row_ctr)++;
207
- (*in_row_group_ctr)++;
208
- }
209
-
210
-
211
- /*
212
- * These are the routines invoked by the control routines to do
213
- * the actual upsampling/conversion. One row group is processed per call.
214
- *
215
- * Note: since we may be writing directly into application-supplied buffers,
216
- * we have to be honest about the output width; we can't assume the buffer
217
- * has been rounded up to an even width.
218
- */
219
-
220
-
221
- /*
222
- * Upsample and color convert for the case of 2:1 horizontal and 1:1 vertical.
223
- */
224
-
225
- METHODDEF(void)
226
- h2v1_merged_upsample (j_decompress_ptr cinfo,
227
- JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr,
228
- JSAMPARRAY output_buf)
229
- {
230
- my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
231
- register int y, cred, cgreen, cblue;
232
- int cb, cr;
233
- register JSAMPROW outptr;
234
- JSAMPROW inptr0, inptr1, inptr2;
235
- JDIMENSION col;
236
- /* copy these pointers into registers if possible */
237
- register JSAMPLE * range_limit = cinfo->sample_range_limit;
238
- int * Crrtab = upsample->Cr_r_tab;
239
- int * Cbbtab = upsample->Cb_b_tab;
240
- INT32 * Crgtab = upsample->Cr_g_tab;
241
- INT32 * Cbgtab = upsample->Cb_g_tab;
242
- SHIFT_TEMPS
243
-
244
- inptr0 = input_buf[0][in_row_group_ctr];
245
- inptr1 = input_buf[1][in_row_group_ctr];
246
- inptr2 = input_buf[2][in_row_group_ctr];
247
- outptr = output_buf[0];
248
- /* Loop for each pair of output pixels */
249
- for (col = cinfo->output_width >> 1; col > 0; col--) {
250
- /* Do the chroma part of the calculation */
251
- cb = GETJSAMPLE(*inptr1++);
252
- cr = GETJSAMPLE(*inptr2++);
253
- cred = Crrtab[cr];
254
- cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
255
- cblue = Cbbtab[cb];
256
- /* Fetch 2 Y values and emit 2 pixels */
257
- y = GETJSAMPLE(*inptr0++);
258
- outptr[RGB_RED] = range_limit[y + cred];
259
- outptr[RGB_GREEN] = range_limit[y + cgreen];
260
- outptr[RGB_BLUE] = range_limit[y + cblue];
261
- outptr += RGB_PIXELSIZE;
262
- y = GETJSAMPLE(*inptr0++);
263
- outptr[RGB_RED] = range_limit[y + cred];
264
- outptr[RGB_GREEN] = range_limit[y + cgreen];
265
- outptr[RGB_BLUE] = range_limit[y + cblue];
266
- outptr += RGB_PIXELSIZE;
267
- }
268
- /* If image width is odd, do the last output column separately */
269
- if (cinfo->output_width & 1) {
270
- cb = GETJSAMPLE(*inptr1);
271
- cr = GETJSAMPLE(*inptr2);
272
- cred = Crrtab[cr];
273
- cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
274
- cblue = Cbbtab[cb];
275
- y = GETJSAMPLE(*inptr0);
276
- outptr[RGB_RED] = range_limit[y + cred];
277
- outptr[RGB_GREEN] = range_limit[y + cgreen];
278
- outptr[RGB_BLUE] = range_limit[y + cblue];
279
- }
280
- }
281
-
282
-
283
- /*
284
- * Upsample and color convert for the case of 2:1 horizontal and 2:1 vertical.
285
- */
286
-
287
- METHODDEF(void)
288
- h2v2_merged_upsample (j_decompress_ptr cinfo,
289
- JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr,
290
- JSAMPARRAY output_buf)
291
- {
292
- my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
293
- register int y, cred, cgreen, cblue;
294
- int cb, cr;
295
- register JSAMPROW outptr0, outptr1;
296
- JSAMPROW inptr00, inptr01, inptr1, inptr2;
297
- JDIMENSION col;
298
- /* copy these pointers into registers if possible */
299
- register JSAMPLE * range_limit = cinfo->sample_range_limit;
300
- int * Crrtab = upsample->Cr_r_tab;
301
- int * Cbbtab = upsample->Cb_b_tab;
302
- INT32 * Crgtab = upsample->Cr_g_tab;
303
- INT32 * Cbgtab = upsample->Cb_g_tab;
304
- SHIFT_TEMPS
305
-
306
- inptr00 = input_buf[0][in_row_group_ctr*2];
307
- inptr01 = input_buf[0][in_row_group_ctr*2 + 1];
308
- inptr1 = input_buf[1][in_row_group_ctr];
309
- inptr2 = input_buf[2][in_row_group_ctr];
310
- outptr0 = output_buf[0];
311
- outptr1 = output_buf[1];
312
- /* Loop for each group of output pixels */
313
- for (col = cinfo->output_width >> 1; col > 0; col--) {
314
- /* Do the chroma part of the calculation */
315
- cb = GETJSAMPLE(*inptr1++);
316
- cr = GETJSAMPLE(*inptr2++);
317
- cred = Crrtab[cr];
318
- cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
319
- cblue = Cbbtab[cb];
320
- /* Fetch 4 Y values and emit 4 pixels */
321
- y = GETJSAMPLE(*inptr00++);
322
- outptr0[RGB_RED] = range_limit[y + cred];
323
- outptr0[RGB_GREEN] = range_limit[y + cgreen];
324
- outptr0[RGB_BLUE] = range_limit[y + cblue];
325
- outptr0 += RGB_PIXELSIZE;
326
- y = GETJSAMPLE(*inptr00++);
327
- outptr0[RGB_RED] = range_limit[y + cred];
328
- outptr0[RGB_GREEN] = range_limit[y + cgreen];
329
- outptr0[RGB_BLUE] = range_limit[y + cblue];
330
- outptr0 += RGB_PIXELSIZE;
331
- y = GETJSAMPLE(*inptr01++);
332
- outptr1[RGB_RED] = range_limit[y + cred];
333
- outptr1[RGB_GREEN] = range_limit[y + cgreen];
334
- outptr1[RGB_BLUE] = range_limit[y + cblue];
335
- outptr1 += RGB_PIXELSIZE;
336
- y = GETJSAMPLE(*inptr01++);
337
- outptr1[RGB_RED] = range_limit[y + cred];
338
- outptr1[RGB_GREEN] = range_limit[y + cgreen];
339
- outptr1[RGB_BLUE] = range_limit[y + cblue];
340
- outptr1 += RGB_PIXELSIZE;
341
- }
342
- /* If image width is odd, do the last output column separately */
343
- if (cinfo->output_width & 1) {
344
- cb = GETJSAMPLE(*inptr1);
345
- cr = GETJSAMPLE(*inptr2);
346
- cred = Crrtab[cr];
347
- cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
348
- cblue = Cbbtab[cb];
349
- y = GETJSAMPLE(*inptr00);
350
- outptr0[RGB_RED] = range_limit[y + cred];
351
- outptr0[RGB_GREEN] = range_limit[y + cgreen];
352
- outptr0[RGB_BLUE] = range_limit[y + cblue];
353
- y = GETJSAMPLE(*inptr01);
354
- outptr1[RGB_RED] = range_limit[y + cred];
355
- outptr1[RGB_GREEN] = range_limit[y + cgreen];
356
- outptr1[RGB_BLUE] = range_limit[y + cblue];
357
- }
358
- }
359
-
360
-
361
- /*
362
- * Module initialization routine for merged upsampling/color conversion.
363
- *
364
- * NB: this is called under the conditions determined by use_merged_upsample()
365
- * in jdmaster.c. That routine MUST correspond to the actual capabilities
366
- * of this module; no safety checks are made here.
367
- */
368
-
369
- GLOBAL(void)
370
- jinit_merged_upsampler (j_decompress_ptr cinfo)
371
- {
372
- my_upsample_ptr upsample;
373
-
374
- upsample = (my_upsample_ptr)
375
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
376
- SIZEOF(my_upsampler));
377
- cinfo->upsample = (struct jpeg_upsampler *) upsample;
378
- upsample->pub.start_pass = start_pass_merged_upsample;
379
- upsample->pub.need_context_rows = FALSE;
380
-
381
- upsample->out_row_width = cinfo->output_width * cinfo->out_color_components;
382
-
383
- if (cinfo->max_v_samp_factor == 2) {
384
- upsample->pub.upsample = merged_2v_upsample;
385
- upsample->upmethod = h2v2_merged_upsample;
386
- /* Allocate a spare row buffer */
387
- upsample->spare_row = (JSAMPROW)
388
- (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE,
389
- (size_t) (upsample->out_row_width * SIZEOF(JSAMPLE)));
390
- } else {
391
- upsample->pub.upsample = merged_1v_upsample;
392
- upsample->upmethod = h2v1_merged_upsample;
393
- /* No spare row needed */
394
- upsample->spare_row = NULL;
395
- }
396
-
397
- build_ycc_rgb_table(cinfo);
398
- }
399
-
400
- #endif /* UPSAMPLE_MERGING_SUPPORTED */
@@ -1,290 +0,0 @@
1
- /*
2
- * jdpostct.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 the decompression postprocessing controller.
9
- * This controller manages the upsampling, color conversion, and color
10
- * quantization/reduction steps; specifically, it controls the buffering
11
- * between upsample/color conversion and color quantization/reduction.
12
- *
13
- * If no color quantization/reduction is required, then this module has no
14
- * work to do, and it just hands off to the upsample/color conversion code.
15
- * An integrated upsample/convert/quantize process would replace this module
16
- * entirely.
17
- */
18
-
19
- #define JPEG_INTERNALS
20
- #include "jinclude.h"
21
- #include "jpeglib.h"
22
-
23
-
24
- /* Private buffer controller object */
25
-
26
- typedef struct {
27
- struct jpeg_d_post_controller pub; /* public fields */
28
-
29
- /* Color quantization source buffer: this holds output data from
30
- * the upsample/color conversion step to be passed to the quantizer.
31
- * For two-pass color quantization, we need a full-image buffer;
32
- * for one-pass operation, a strip buffer is sufficient.
33
- */
34
- jvirt_sarray_ptr whole_image; /* virtual array, or NULL if one-pass */
35
- JSAMPARRAY buffer; /* strip buffer, or current strip of virtual */
36
- JDIMENSION strip_height; /* buffer size in rows */
37
- /* for two-pass mode only: */
38
- JDIMENSION starting_row; /* row # of first row in current strip */
39
- JDIMENSION next_row; /* index of next row to fill/empty in strip */
40
- } my_post_controller;
41
-
42
- typedef my_post_controller * my_post_ptr;
43
-
44
-
45
- /* Forward declarations */
46
- METHODDEF(void) post_process_1pass
47
- JPP((j_decompress_ptr cinfo,
48
- JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr,
49
- JDIMENSION in_row_groups_avail,
50
- JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
51
- JDIMENSION out_rows_avail));
52
- #ifdef QUANT_2PASS_SUPPORTED
53
- METHODDEF(void) post_process_prepass
54
- JPP((j_decompress_ptr cinfo,
55
- JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr,
56
- JDIMENSION in_row_groups_avail,
57
- JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
58
- JDIMENSION out_rows_avail));
59
- METHODDEF(void) post_process_2pass
60
- JPP((j_decompress_ptr cinfo,
61
- JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr,
62
- JDIMENSION in_row_groups_avail,
63
- JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
64
- JDIMENSION out_rows_avail));
65
- #endif
66
-
67
-
68
- /*
69
- * Initialize for a processing pass.
70
- */
71
-
72
- METHODDEF(void)
73
- start_pass_dpost (j_decompress_ptr cinfo, J_BUF_MODE pass_mode)
74
- {
75
- my_post_ptr post = (my_post_ptr) cinfo->post;
76
-
77
- switch (pass_mode) {
78
- case JBUF_PASS_THRU:
79
- if (cinfo->quantize_colors) {
80
- /* Single-pass processing with color quantization. */
81
- post->pub.post_process_data = post_process_1pass;
82
- /* We could be doing buffered-image output before starting a 2-pass
83
- * color quantization; in that case, jinit_d_post_controller did not
84
- * allocate a strip buffer. Use the virtual-array buffer as workspace.
85
- */
86
- if (post->buffer == NULL) {
87
- post->buffer = (*cinfo->mem->access_virt_sarray)
88
- ((j_common_ptr) cinfo, post->whole_image,
89
- (JDIMENSION) 0, post->strip_height, TRUE);
90
- }
91
- } else {
92
- /* For single-pass processing without color quantization,
93
- * I have no work to do; just call the upsampler directly.
94
- */
95
- post->pub.post_process_data = cinfo->upsample->upsample;
96
- }
97
- break;
98
- #ifdef QUANT_2PASS_SUPPORTED
99
- case JBUF_SAVE_AND_PASS:
100
- /* First pass of 2-pass quantization */
101
- if (post->whole_image == NULL)
102
- ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
103
- post->pub.post_process_data = post_process_prepass;
104
- break;
105
- case JBUF_CRANK_DEST:
106
- /* Second pass of 2-pass quantization */
107
- if (post->whole_image == NULL)
108
- ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
109
- post->pub.post_process_data = post_process_2pass;
110
- break;
111
- #endif /* QUANT_2PASS_SUPPORTED */
112
- default:
113
- ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
114
- break;
115
- }
116
- post->starting_row = post->next_row = 0;
117
- }
118
-
119
-
120
- /*
121
- * Process some data in the one-pass (strip buffer) case.
122
- * This is used for color precision reduction as well as one-pass quantization.
123
- */
124
-
125
- METHODDEF(void)
126
- post_process_1pass (j_decompress_ptr cinfo,
127
- JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr,
128
- JDIMENSION in_row_groups_avail,
129
- JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
130
- JDIMENSION out_rows_avail)
131
- {
132
- my_post_ptr post = (my_post_ptr) cinfo->post;
133
- JDIMENSION num_rows, max_rows;
134
-
135
- /* Fill the buffer, but not more than what we can dump out in one go. */
136
- /* Note we rely on the upsampler to detect bottom of image. */
137
- max_rows = out_rows_avail - *out_row_ctr;
138
- if (max_rows > post->strip_height)
139
- max_rows = post->strip_height;
140
- num_rows = 0;
141
- (*cinfo->upsample->upsample) (cinfo,
142
- input_buf, in_row_group_ctr, in_row_groups_avail,
143
- post->buffer, &num_rows, max_rows);
144
- /* Quantize and emit data. */
145
- (*cinfo->cquantize->color_quantize) (cinfo,
146
- post->buffer, output_buf + *out_row_ctr, (int) num_rows);
147
- *out_row_ctr += num_rows;
148
- }
149
-
150
-
151
- #ifdef QUANT_2PASS_SUPPORTED
152
-
153
- /*
154
- * Process some data in the first pass of 2-pass quantization.
155
- */
156
-
157
- METHODDEF(void)
158
- post_process_prepass (j_decompress_ptr cinfo,
159
- JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr,
160
- JDIMENSION in_row_groups_avail,
161
- JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
162
- JDIMENSION out_rows_avail)
163
- {
164
- my_post_ptr post = (my_post_ptr) cinfo->post;
165
- JDIMENSION old_next_row, num_rows;
166
-
167
- /* Reposition virtual buffer if at start of strip. */
168
- if (post->next_row == 0) {
169
- post->buffer = (*cinfo->mem->access_virt_sarray)
170
- ((j_common_ptr) cinfo, post->whole_image,
171
- post->starting_row, post->strip_height, TRUE);
172
- }
173
-
174
- /* Upsample some data (up to a strip height's worth). */
175
- old_next_row = post->next_row;
176
- (*cinfo->upsample->upsample) (cinfo,
177
- input_buf, in_row_group_ctr, in_row_groups_avail,
178
- post->buffer, &post->next_row, post->strip_height);
179
-
180
- /* Allow quantizer to scan new data. No data is emitted, */
181
- /* but we advance out_row_ctr so outer loop can tell when we're done. */
182
- if (post->next_row > old_next_row) {
183
- num_rows = post->next_row - old_next_row;
184
- (*cinfo->cquantize->color_quantize) (cinfo, post->buffer + old_next_row,
185
- (JSAMPARRAY) NULL, (int) num_rows);
186
- *out_row_ctr += num_rows;
187
- }
188
-
189
- /* Advance if we filled the strip. */
190
- if (post->next_row >= post->strip_height) {
191
- post->starting_row += post->strip_height;
192
- post->next_row = 0;
193
- }
194
- }
195
-
196
-
197
- /*
198
- * Process some data in the second pass of 2-pass quantization.
199
- */
200
-
201
- METHODDEF(void)
202
- post_process_2pass (j_decompress_ptr cinfo,
203
- JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr,
204
- JDIMENSION in_row_groups_avail,
205
- JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
206
- JDIMENSION out_rows_avail)
207
- {
208
- my_post_ptr post = (my_post_ptr) cinfo->post;
209
- JDIMENSION num_rows, max_rows;
210
-
211
- /* Reposition virtual buffer if at start of strip. */
212
- if (post->next_row == 0) {
213
- post->buffer = (*cinfo->mem->access_virt_sarray)
214
- ((j_common_ptr) cinfo, post->whole_image,
215
- post->starting_row, post->strip_height, FALSE);
216
- }
217
-
218
- /* Determine number of rows to emit. */
219
- num_rows = post->strip_height - post->next_row; /* available in strip */
220
- max_rows = out_rows_avail - *out_row_ctr; /* available in output area */
221
- if (num_rows > max_rows)
222
- num_rows = max_rows;
223
- /* We have to check bottom of image here, can't depend on upsampler. */
224
- max_rows = cinfo->output_height - post->starting_row;
225
- if (num_rows > max_rows)
226
- num_rows = max_rows;
227
-
228
- /* Quantize and emit data. */
229
- (*cinfo->cquantize->color_quantize) (cinfo,
230
- post->buffer + post->next_row, output_buf + *out_row_ctr,
231
- (int) num_rows);
232
- *out_row_ctr += num_rows;
233
-
234
- /* Advance if we filled the strip. */
235
- post->next_row += num_rows;
236
- if (post->next_row >= post->strip_height) {
237
- post->starting_row += post->strip_height;
238
- post->next_row = 0;
239
- }
240
- }
241
-
242
- #endif /* QUANT_2PASS_SUPPORTED */
243
-
244
-
245
- /*
246
- * Initialize postprocessing controller.
247
- */
248
-
249
- GLOBAL(void)
250
- jinit_d_post_controller (j_decompress_ptr cinfo, boolean need_full_buffer)
251
- {
252
- my_post_ptr post;
253
-
254
- post = (my_post_ptr)
255
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
256
- SIZEOF(my_post_controller));
257
- cinfo->post = (struct jpeg_d_post_controller *) post;
258
- post->pub.start_pass = start_pass_dpost;
259
- post->whole_image = NULL; /* flag for no virtual arrays */
260
- post->buffer = NULL; /* flag for no strip buffer */
261
-
262
- /* Create the quantization buffer, if needed */
263
- if (cinfo->quantize_colors) {
264
- /* The buffer strip height is max_v_samp_factor, which is typically
265
- * an efficient number of rows for upsampling to return.
266
- * (In the presence of output rescaling, we might want to be smarter?)
267
- */
268
- post->strip_height = (JDIMENSION) cinfo->max_v_samp_factor;
269
- if (need_full_buffer) {
270
- /* Two-pass color quantization: need full-image storage. */
271
- /* We round up the number of rows to a multiple of the strip height. */
272
- #ifdef QUANT_2PASS_SUPPORTED
273
- post->whole_image = (*cinfo->mem->request_virt_sarray)
274
- ((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE,
275
- cinfo->output_width * cinfo->out_color_components,
276
- (JDIMENSION) jround_up((long) cinfo->output_height,
277
- (long) post->strip_height),
278
- post->strip_height);
279
- #else
280
- ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
281
- #endif /* QUANT_2PASS_SUPPORTED */
282
- } else {
283
- /* One-pass color quantization: just make a strip buffer. */
284
- post->buffer = (*cinfo->mem->alloc_sarray)
285
- ((j_common_ptr) cinfo, JPOOL_IMAGE,
286
- cinfo->output_width * cinfo->out_color_components,
287
- post->strip_height);
288
- }
289
- }
290
- }