isbn 2.0.4 → 2.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (288) hide show
  1. data/{README → README.md} +5 -11
  2. data/Rakefile +20 -14
  3. data/isbn.gemspec +23 -0
  4. data/lib/isbn.rb +2 -0
  5. data/test/isbn_spec.rb +1 -1
  6. metadata +29 -316
  7. data/VERSION +0 -1
  8. data/src/gocr-0.48/.cvsignore +0 -6
  9. data/src/gocr-0.48/AUTHORS +0 -7
  10. data/src/gocr-0.48/BUGS +0 -55
  11. data/src/gocr-0.48/CREDITS +0 -17
  12. data/src/gocr-0.48/HISTORY +0 -243
  13. data/src/gocr-0.48/INSTALL +0 -83
  14. data/src/gocr-0.48/Makefile +0 -193
  15. data/src/gocr-0.48/Makefile.in +0 -193
  16. data/src/gocr-0.48/README +0 -165
  17. data/src/gocr-0.48/READMEde.txt +0 -80
  18. data/src/gocr-0.48/REMARK.txt +0 -18
  19. data/src/gocr-0.48/REVIEW +0 -538
  20. data/src/gocr-0.48/TODO +0 -65
  21. data/src/gocr-0.48/bin/.cvsignore +0 -2
  22. data/src/gocr-0.48/bin/create_db +0 -38
  23. data/src/gocr-0.48/bin/gocr.tcl +0 -527
  24. data/src/gocr-0.48/bin/gocr_chk.sh +0 -44
  25. data/src/gocr-0.48/configure +0 -4689
  26. data/src/gocr-0.48/configure.in +0 -71
  27. data/src/gocr-0.48/doc/.#Makefile.1.6 +0 -39
  28. data/src/gocr-0.48/doc/.cvsignore +0 -2
  29. data/src/gocr-0.48/doc/Makefile +0 -39
  30. data/src/gocr-0.48/doc/Makefile.in +0 -39
  31. data/src/gocr-0.48/doc/example.dtd +0 -53
  32. data/src/gocr-0.48/doc/example.xml +0 -21
  33. data/src/gocr-0.48/doc/examples.txt +0 -67
  34. data/src/gocr-0.48/doc/gocr.html +0 -578
  35. data/src/gocr-0.48/doc/unicode.txt +0 -57
  36. data/src/gocr-0.48/examples/.#Makefile.1.22 +0 -166
  37. data/src/gocr-0.48/examples/4x6.png +0 -0
  38. data/src/gocr-0.48/examples/4x6.txt +0 -2
  39. data/src/gocr-0.48/examples/5x7.png +0 -0
  40. data/src/gocr-0.48/examples/5x7.png.txt +0 -2
  41. data/src/gocr-0.48/examples/5x8.png +0 -0
  42. data/src/gocr-0.48/examples/5x8.png.txt +0 -2
  43. data/src/gocr-0.48/examples/Makefile +0 -166
  44. data/src/gocr-0.48/examples/color.fig +0 -20
  45. data/src/gocr-0.48/examples/ex.fig +0 -16
  46. data/src/gocr-0.48/examples/font.tex +0 -22
  47. data/src/gocr-0.48/examples/font1.tex +0 -46
  48. data/src/gocr-0.48/examples/font2.fig +0 -27
  49. data/src/gocr-0.48/examples/font_nw.tex +0 -24
  50. data/src/gocr-0.48/examples/handwrt1.jpg +0 -0
  51. data/src/gocr-0.48/examples/handwrt1.txt +0 -10
  52. data/src/gocr-0.48/examples/inverse.fig +0 -20
  53. data/src/gocr-0.48/examples/matrix.jpg +0 -0
  54. data/src/gocr-0.48/examples/ocr-a-subset.png +0 -0
  55. data/src/gocr-0.48/examples/ocr-a-subset.png.txt +0 -4
  56. data/src/gocr-0.48/examples/ocr-a.png +0 -0
  57. data/src/gocr-0.48/examples/ocr-a.txt +0 -6
  58. data/src/gocr-0.48/examples/ocr-b.png +0 -0
  59. data/src/gocr-0.48/examples/ocr-b.png.txt +0 -4
  60. data/src/gocr-0.48/examples/polish.tex +0 -28
  61. data/src/gocr-0.48/examples/rotate45.fig +0 -14
  62. data/src/gocr-0.48/examples/score +0 -36
  63. data/src/gocr-0.48/examples/text.tex +0 -28
  64. data/src/gocr-0.48/gpl.html +0 -537
  65. data/src/gocr-0.48/include/.cvsignore +0 -2
  66. data/src/gocr-0.48/include/config.h +0 -36
  67. data/src/gocr-0.48/include/config.h.in +0 -36
  68. data/src/gocr-0.48/include/version.h +0 -2
  69. data/src/gocr-0.48/install-sh +0 -3
  70. data/src/gocr-0.48/make.bat +0 -57
  71. data/src/gocr-0.48/man/.cvsignore +0 -2
  72. data/src/gocr-0.48/man/Makefile +0 -29
  73. data/src/gocr-0.48/man/Makefile.in +0 -29
  74. data/src/gocr-0.48/man/man1/gocr.1 +0 -166
  75. data/src/gocr-0.48/src/.cvsignore +0 -4
  76. data/src/gocr-0.48/src/Makefile +0 -132
  77. data/src/gocr-0.48/src/Makefile.in +0 -132
  78. data/src/gocr-0.48/src/amiga.h +0 -31
  79. data/src/gocr-0.48/src/barcode.c +0 -846
  80. data/src/gocr-0.48/src/barcode.c.orig +0 -593
  81. data/src/gocr-0.48/src/barcode.h +0 -11
  82. data/src/gocr-0.48/src/box.c +0 -372
  83. data/src/gocr-0.48/src/database.c +0 -462
  84. data/src/gocr-0.48/src/detect.c +0 -943
  85. data/src/gocr-0.48/src/gocr.c +0 -373
  86. data/src/gocr-0.48/src/gocr.h +0 -288
  87. data/src/gocr-0.48/src/jconv.c +0 -168
  88. data/src/gocr-0.48/src/job.c +0 -84
  89. data/src/gocr-0.48/src/lines.c +0 -350
  90. data/src/gocr-0.48/src/list.c +0 -334
  91. data/src/gocr-0.48/src/list.h +0 -90
  92. data/src/gocr-0.48/src/ocr0.c +0 -6756
  93. data/src/gocr-0.48/src/ocr0.h +0 -63
  94. data/src/gocr-0.48/src/ocr0n.c +0 -1475
  95. data/src/gocr-0.48/src/ocr1.c +0 -85
  96. data/src/gocr-0.48/src/ocr1.h +0 -3
  97. data/src/gocr-0.48/src/otsu.c +0 -289
  98. data/src/gocr-0.48/src/otsu.h +0 -23
  99. data/src/gocr-0.48/src/output.c +0 -289
  100. data/src/gocr-0.48/src/output.h +0 -37
  101. data/src/gocr-0.48/src/pcx.c +0 -153
  102. data/src/gocr-0.48/src/pcx.h +0 -9
  103. data/src/gocr-0.48/src/pgm2asc.c +0 -2893
  104. data/src/gocr-0.48/src/pgm2asc.h +0 -105
  105. data/src/gocr-0.48/src/pixel.c +0 -537
  106. data/src/gocr-0.48/src/pnm.c +0 -533
  107. data/src/gocr-0.48/src/pnm.h +0 -35
  108. data/src/gocr-0.48/src/progress.c +0 -87
  109. data/src/gocr-0.48/src/progress.h +0 -42
  110. data/src/gocr-0.48/src/remove.c +0 -703
  111. data/src/gocr-0.48/src/tga.c +0 -87
  112. data/src/gocr-0.48/src/tga.h +0 -6
  113. data/src/gocr-0.48/src/unicode.c +0 -1314
  114. data/src/gocr-0.48/src/unicode.h +0 -1257
  115. data/src/jpeg-7/Makefile.am +0 -133
  116. data/src/jpeg-7/Makefile.in +0 -1089
  117. data/src/jpeg-7/README +0 -322
  118. data/src/jpeg-7/aclocal.m4 +0 -8990
  119. data/src/jpeg-7/ansi2knr.1 +0 -36
  120. data/src/jpeg-7/ansi2knr.c +0 -739
  121. data/src/jpeg-7/cderror.h +0 -132
  122. data/src/jpeg-7/cdjpeg.c +0 -181
  123. data/src/jpeg-7/cdjpeg.h +0 -187
  124. data/src/jpeg-7/change.log +0 -270
  125. data/src/jpeg-7/cjpeg.1 +0 -325
  126. data/src/jpeg-7/cjpeg.c +0 -616
  127. data/src/jpeg-7/ckconfig.c +0 -402
  128. data/src/jpeg-7/coderules.txt +0 -118
  129. data/src/jpeg-7/config.guess +0 -1561
  130. data/src/jpeg-7/config.sub +0 -1686
  131. data/src/jpeg-7/configure +0 -17139
  132. data/src/jpeg-7/configure.ac +0 -317
  133. data/src/jpeg-7/depcomp +0 -630
  134. data/src/jpeg-7/djpeg.1 +0 -251
  135. data/src/jpeg-7/djpeg.c +0 -617
  136. data/src/jpeg-7/example.c +0 -433
  137. data/src/jpeg-7/filelist.txt +0 -215
  138. data/src/jpeg-7/install-sh +0 -520
  139. data/src/jpeg-7/install.txt +0 -1097
  140. data/src/jpeg-7/jaricom.c +0 -148
  141. data/src/jpeg-7/jcapimin.c +0 -282
  142. data/src/jpeg-7/jcapistd.c +0 -161
  143. data/src/jpeg-7/jcarith.c +0 -921
  144. data/src/jpeg-7/jccoefct.c +0 -453
  145. data/src/jpeg-7/jccolor.c +0 -459
  146. data/src/jpeg-7/jcdctmgr.c +0 -482
  147. data/src/jpeg-7/jchuff.c +0 -1612
  148. data/src/jpeg-7/jcinit.c +0 -65
  149. data/src/jpeg-7/jcmainct.c +0 -293
  150. data/src/jpeg-7/jcmarker.c +0 -667
  151. data/src/jpeg-7/jcmaster.c +0 -770
  152. data/src/jpeg-7/jcomapi.c +0 -106
  153. data/src/jpeg-7/jconfig.bcc +0 -48
  154. data/src/jpeg-7/jconfig.cfg +0 -45
  155. data/src/jpeg-7/jconfig.dj +0 -38
  156. data/src/jpeg-7/jconfig.mac +0 -43
  157. data/src/jpeg-7/jconfig.manx +0 -43
  158. data/src/jpeg-7/jconfig.mc6 +0 -52
  159. data/src/jpeg-7/jconfig.sas +0 -43
  160. data/src/jpeg-7/jconfig.st +0 -42
  161. data/src/jpeg-7/jconfig.txt +0 -155
  162. data/src/jpeg-7/jconfig.vc +0 -45
  163. data/src/jpeg-7/jconfig.vms +0 -37
  164. data/src/jpeg-7/jconfig.wat +0 -38
  165. data/src/jpeg-7/jcparam.c +0 -632
  166. data/src/jpeg-7/jcprepct.c +0 -358
  167. data/src/jpeg-7/jcsample.c +0 -545
  168. data/src/jpeg-7/jctrans.c +0 -381
  169. data/src/jpeg-7/jdapimin.c +0 -396
  170. data/src/jpeg-7/jdapistd.c +0 -275
  171. data/src/jpeg-7/jdarith.c +0 -762
  172. data/src/jpeg-7/jdatadst.c +0 -151
  173. data/src/jpeg-7/jdatasrc.c +0 -212
  174. data/src/jpeg-7/jdcoefct.c +0 -736
  175. data/src/jpeg-7/jdcolor.c +0 -396
  176. data/src/jpeg-7/jdct.h +0 -393
  177. data/src/jpeg-7/jddctmgr.c +0 -382
  178. data/src/jpeg-7/jdhuff.c +0 -1309
  179. data/src/jpeg-7/jdinput.c +0 -384
  180. data/src/jpeg-7/jdmainct.c +0 -512
  181. data/src/jpeg-7/jdmarker.c +0 -1360
  182. data/src/jpeg-7/jdmaster.c +0 -663
  183. data/src/jpeg-7/jdmerge.c +0 -400
  184. data/src/jpeg-7/jdpostct.c +0 -290
  185. data/src/jpeg-7/jdsample.c +0 -361
  186. data/src/jpeg-7/jdtrans.c +0 -136
  187. data/src/jpeg-7/jerror.c +0 -252
  188. data/src/jpeg-7/jerror.h +0 -304
  189. data/src/jpeg-7/jfdctflt.c +0 -174
  190. data/src/jpeg-7/jfdctfst.c +0 -230
  191. data/src/jpeg-7/jfdctint.c +0 -4348
  192. data/src/jpeg-7/jidctflt.c +0 -242
  193. data/src/jpeg-7/jidctfst.c +0 -368
  194. data/src/jpeg-7/jidctint.c +0 -5137
  195. data/src/jpeg-7/jinclude.h +0 -91
  196. data/src/jpeg-7/jmemansi.c +0 -167
  197. data/src/jpeg-7/jmemdos.c +0 -638
  198. data/src/jpeg-7/jmemdosa.asm +0 -379
  199. data/src/jpeg-7/jmemmac.c +0 -289
  200. data/src/jpeg-7/jmemmgr.c +0 -1118
  201. data/src/jpeg-7/jmemname.c +0 -276
  202. data/src/jpeg-7/jmemnobs.c +0 -109
  203. data/src/jpeg-7/jmemsys.h +0 -198
  204. data/src/jpeg-7/jmorecfg.h +0 -369
  205. data/src/jpeg-7/jpegint.h +0 -395
  206. data/src/jpeg-7/jpeglib.h +0 -1135
  207. data/src/jpeg-7/jpegtran.1 +0 -272
  208. data/src/jpeg-7/jpegtran.c +0 -546
  209. data/src/jpeg-7/jquant1.c +0 -856
  210. data/src/jpeg-7/jquant2.c +0 -1310
  211. data/src/jpeg-7/jutils.c +0 -179
  212. data/src/jpeg-7/jversion.h +0 -14
  213. data/src/jpeg-7/libjpeg.map +0 -4
  214. data/src/jpeg-7/libjpeg.txt +0 -3067
  215. data/src/jpeg-7/ltmain.sh +0 -8406
  216. data/src/jpeg-7/makcjpeg.st +0 -36
  217. data/src/jpeg-7/makdjpeg.st +0 -36
  218. data/src/jpeg-7/makeadsw.vc6 +0 -77
  219. data/src/jpeg-7/makeasln.vc9 +0 -33
  220. data/src/jpeg-7/makecdep.vc6 +0 -82
  221. data/src/jpeg-7/makecdsp.vc6 +0 -130
  222. data/src/jpeg-7/makecmak.vc6 +0 -159
  223. data/src/jpeg-7/makecvcp.vc9 +0 -186
  224. data/src/jpeg-7/makeddep.vc6 +0 -82
  225. data/src/jpeg-7/makeddsp.vc6 +0 -130
  226. data/src/jpeg-7/makedmak.vc6 +0 -159
  227. data/src/jpeg-7/makedvcp.vc9 +0 -186
  228. data/src/jpeg-7/makefile.ansi +0 -220
  229. data/src/jpeg-7/makefile.bcc +0 -291
  230. data/src/jpeg-7/makefile.dj +0 -226
  231. data/src/jpeg-7/makefile.manx +0 -220
  232. data/src/jpeg-7/makefile.mc6 +0 -255
  233. data/src/jpeg-7/makefile.mms +0 -224
  234. data/src/jpeg-7/makefile.sas +0 -258
  235. data/src/jpeg-7/makefile.unix +0 -234
  236. data/src/jpeg-7/makefile.vc +0 -217
  237. data/src/jpeg-7/makefile.vms +0 -142
  238. data/src/jpeg-7/makefile.wat +0 -239
  239. data/src/jpeg-7/makejdep.vc6 +0 -423
  240. data/src/jpeg-7/makejdsp.vc6 +0 -285
  241. data/src/jpeg-7/makejdsw.vc6 +0 -29
  242. data/src/jpeg-7/makejmak.vc6 +0 -425
  243. data/src/jpeg-7/makejsln.vc9 +0 -17
  244. data/src/jpeg-7/makejvcp.vc9 +0 -328
  245. data/src/jpeg-7/makeproj.mac +0 -213
  246. data/src/jpeg-7/makerdep.vc6 +0 -6
  247. data/src/jpeg-7/makerdsp.vc6 +0 -78
  248. data/src/jpeg-7/makermak.vc6 +0 -110
  249. data/src/jpeg-7/makervcp.vc9 +0 -133
  250. data/src/jpeg-7/maketdep.vc6 +0 -43
  251. data/src/jpeg-7/maketdsp.vc6 +0 -122
  252. data/src/jpeg-7/maketmak.vc6 +0 -131
  253. data/src/jpeg-7/maketvcp.vc9 +0 -178
  254. data/src/jpeg-7/makewdep.vc6 +0 -6
  255. data/src/jpeg-7/makewdsp.vc6 +0 -78
  256. data/src/jpeg-7/makewmak.vc6 +0 -110
  257. data/src/jpeg-7/makewvcp.vc9 +0 -133
  258. data/src/jpeg-7/makljpeg.st +0 -68
  259. data/src/jpeg-7/maktjpeg.st +0 -30
  260. data/src/jpeg-7/makvms.opt +0 -4
  261. data/src/jpeg-7/missing +0 -376
  262. data/src/jpeg-7/rdbmp.c +0 -439
  263. data/src/jpeg-7/rdcolmap.c +0 -253
  264. data/src/jpeg-7/rdgif.c +0 -38
  265. data/src/jpeg-7/rdjpgcom.1 +0 -63
  266. data/src/jpeg-7/rdjpgcom.c +0 -515
  267. data/src/jpeg-7/rdppm.c +0 -459
  268. data/src/jpeg-7/rdrle.c +0 -387
  269. data/src/jpeg-7/rdswitch.c +0 -365
  270. data/src/jpeg-7/rdtarga.c +0 -500
  271. data/src/jpeg-7/structure.txt +0 -945
  272. data/src/jpeg-7/testimg.bmp +0 -0
  273. data/src/jpeg-7/testimg.jpg +0 -0
  274. data/src/jpeg-7/testimg.ppm +0 -4
  275. data/src/jpeg-7/testimgp.jpg +0 -0
  276. data/src/jpeg-7/testorig.jpg +0 -0
  277. data/src/jpeg-7/testprog.jpg +0 -0
  278. data/src/jpeg-7/transupp.c +0 -1533
  279. data/src/jpeg-7/transupp.h +0 -205
  280. data/src/jpeg-7/usage.txt +0 -605
  281. data/src/jpeg-7/wizard.txt +0 -211
  282. data/src/jpeg-7/wrbmp.c +0 -442
  283. data/src/jpeg-7/wrgif.c +0 -399
  284. data/src/jpeg-7/wrjpgcom.1 +0 -103
  285. data/src/jpeg-7/wrjpgcom.c +0 -583
  286. data/src/jpeg-7/wrppm.c +0 -269
  287. data/src/jpeg-7/wrrle.c +0 -305
  288. data/src/jpeg-7/wrtarga.c +0 -253
@@ -1,361 +0,0 @@
1
- /*
2
- * jdsample.c
3
- *
4
- * Copyright (C) 1991-1996, Thomas G. Lane.
5
- * Modified 2002-2008 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 upsampling routines.
10
- *
11
- * Upsampling input data is counted in "row groups". A row group
12
- * is defined to be (v_samp_factor * DCT_v_scaled_size / min_DCT_v_scaled_size)
13
- * sample rows of each component. Upsampling will normally produce
14
- * max_v_samp_factor pixel rows from each row group (but this could vary
15
- * if the upsampler is applying a scale factor of its own).
16
- *
17
- * An excellent reference for image resampling is
18
- * Digital Image Warping, George Wolberg, 1990.
19
- * Pub. by IEEE Computer Society Press, Los Alamitos, CA. ISBN 0-8186-8944-7.
20
- */
21
-
22
- #define JPEG_INTERNALS
23
- #include "jinclude.h"
24
- #include "jpeglib.h"
25
-
26
-
27
- /* Pointer to routine to upsample a single component */
28
- typedef JMETHOD(void, upsample1_ptr,
29
- (j_decompress_ptr cinfo, jpeg_component_info * compptr,
30
- JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr));
31
-
32
- /* Private subobject */
33
-
34
- typedef struct {
35
- struct jpeg_upsampler pub; /* public fields */
36
-
37
- /* Color conversion buffer. When using separate upsampling and color
38
- * conversion steps, this buffer holds one upsampled row group until it
39
- * has been color converted and output.
40
- * Note: we do not allocate any storage for component(s) which are full-size,
41
- * ie do not need rescaling. The corresponding entry of color_buf[] is
42
- * simply set to point to the input data array, thereby avoiding copying.
43
- */
44
- JSAMPARRAY color_buf[MAX_COMPONENTS];
45
-
46
- /* Per-component upsampling method pointers */
47
- upsample1_ptr methods[MAX_COMPONENTS];
48
-
49
- int next_row_out; /* counts rows emitted from color_buf */
50
- JDIMENSION rows_to_go; /* counts rows remaining in image */
51
-
52
- /* Height of an input row group for each component. */
53
- int rowgroup_height[MAX_COMPONENTS];
54
-
55
- /* These arrays save pixel expansion factors so that int_expand need not
56
- * recompute them each time. They are unused for other upsampling methods.
57
- */
58
- UINT8 h_expand[MAX_COMPONENTS];
59
- UINT8 v_expand[MAX_COMPONENTS];
60
- } my_upsampler;
61
-
62
- typedef my_upsampler * my_upsample_ptr;
63
-
64
-
65
- /*
66
- * Initialize for an upsampling pass.
67
- */
68
-
69
- METHODDEF(void)
70
- start_pass_upsample (j_decompress_ptr cinfo)
71
- {
72
- my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
73
-
74
- /* Mark the conversion buffer empty */
75
- upsample->next_row_out = cinfo->max_v_samp_factor;
76
- /* Initialize total-height counter for detecting bottom of image */
77
- upsample->rows_to_go = cinfo->output_height;
78
- }
79
-
80
-
81
- /*
82
- * Control routine to do upsampling (and color conversion).
83
- *
84
- * In this version we upsample each component independently.
85
- * We upsample one row group into the conversion buffer, then apply
86
- * color conversion a row at a time.
87
- */
88
-
89
- METHODDEF(void)
90
- sep_upsample (j_decompress_ptr cinfo,
91
- JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr,
92
- JDIMENSION in_row_groups_avail,
93
- JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
94
- JDIMENSION out_rows_avail)
95
- {
96
- my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
97
- int ci;
98
- jpeg_component_info * compptr;
99
- JDIMENSION num_rows;
100
-
101
- /* Fill the conversion buffer, if it's empty */
102
- if (upsample->next_row_out >= cinfo->max_v_samp_factor) {
103
- for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
104
- ci++, compptr++) {
105
- /* Invoke per-component upsample method. Notice we pass a POINTER
106
- * to color_buf[ci], so that fullsize_upsample can change it.
107
- */
108
- (*upsample->methods[ci]) (cinfo, compptr,
109
- input_buf[ci] + (*in_row_group_ctr * upsample->rowgroup_height[ci]),
110
- upsample->color_buf + ci);
111
- }
112
- upsample->next_row_out = 0;
113
- }
114
-
115
- /* Color-convert and emit rows */
116
-
117
- /* How many we have in the buffer: */
118
- num_rows = (JDIMENSION) (cinfo->max_v_samp_factor - upsample->next_row_out);
119
- /* Not more than the distance to the end of the image. Need this test
120
- * in case the image height is not a multiple of max_v_samp_factor:
121
- */
122
- if (num_rows > upsample->rows_to_go)
123
- num_rows = upsample->rows_to_go;
124
- /* And not more than what the client can accept: */
125
- out_rows_avail -= *out_row_ctr;
126
- if (num_rows > out_rows_avail)
127
- num_rows = out_rows_avail;
128
-
129
- (*cinfo->cconvert->color_convert) (cinfo, upsample->color_buf,
130
- (JDIMENSION) upsample->next_row_out,
131
- output_buf + *out_row_ctr,
132
- (int) num_rows);
133
-
134
- /* Adjust counts */
135
- *out_row_ctr += num_rows;
136
- upsample->rows_to_go -= num_rows;
137
- upsample->next_row_out += num_rows;
138
- /* When the buffer is emptied, declare this input row group consumed */
139
- if (upsample->next_row_out >= cinfo->max_v_samp_factor)
140
- (*in_row_group_ctr)++;
141
- }
142
-
143
-
144
- /*
145
- * These are the routines invoked by sep_upsample to upsample pixel values
146
- * of a single component. One row group is processed per call.
147
- */
148
-
149
-
150
- /*
151
- * For full-size components, we just make color_buf[ci] point at the
152
- * input buffer, and thus avoid copying any data. Note that this is
153
- * safe only because sep_upsample doesn't declare the input row group
154
- * "consumed" until we are done color converting and emitting it.
155
- */
156
-
157
- METHODDEF(void)
158
- fullsize_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr,
159
- JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)
160
- {
161
- *output_data_ptr = input_data;
162
- }
163
-
164
-
165
- /*
166
- * This is a no-op version used for "uninteresting" components.
167
- * These components will not be referenced by color conversion.
168
- */
169
-
170
- METHODDEF(void)
171
- noop_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr,
172
- JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)
173
- {
174
- *output_data_ptr = NULL; /* safety check */
175
- }
176
-
177
-
178
- /*
179
- * This version handles any integral sampling ratios.
180
- * This is not used for typical JPEG files, so it need not be fast.
181
- * Nor, for that matter, is it particularly accurate: the algorithm is
182
- * simple replication of the input pixel onto the corresponding output
183
- * pixels. The hi-falutin sampling literature refers to this as a
184
- * "box filter". A box filter tends to introduce visible artifacts,
185
- * so if you are actually going to use 3:1 or 4:1 sampling ratios
186
- * you would be well advised to improve this code.
187
- */
188
-
189
- METHODDEF(void)
190
- int_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr,
191
- JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)
192
- {
193
- my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
194
- JSAMPARRAY output_data = *output_data_ptr;
195
- register JSAMPROW inptr, outptr;
196
- register JSAMPLE invalue;
197
- register int h;
198
- JSAMPROW outend;
199
- int h_expand, v_expand;
200
- int inrow, outrow;
201
-
202
- h_expand = upsample->h_expand[compptr->component_index];
203
- v_expand = upsample->v_expand[compptr->component_index];
204
-
205
- inrow = outrow = 0;
206
- while (outrow < cinfo->max_v_samp_factor) {
207
- /* Generate one output row with proper horizontal expansion */
208
- inptr = input_data[inrow];
209
- outptr = output_data[outrow];
210
- outend = outptr + cinfo->output_width;
211
- while (outptr < outend) {
212
- invalue = *inptr++; /* don't need GETJSAMPLE() here */
213
- for (h = h_expand; h > 0; h--) {
214
- *outptr++ = invalue;
215
- }
216
- }
217
- /* Generate any additional output rows by duplicating the first one */
218
- if (v_expand > 1) {
219
- jcopy_sample_rows(output_data, outrow, output_data, outrow+1,
220
- v_expand-1, cinfo->output_width);
221
- }
222
- inrow++;
223
- outrow += v_expand;
224
- }
225
- }
226
-
227
-
228
- /*
229
- * Fast processing for the common case of 2:1 horizontal and 1:1 vertical.
230
- * It's still a box filter.
231
- */
232
-
233
- METHODDEF(void)
234
- h2v1_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr,
235
- JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)
236
- {
237
- JSAMPARRAY output_data = *output_data_ptr;
238
- register JSAMPROW inptr, outptr;
239
- register JSAMPLE invalue;
240
- JSAMPROW outend;
241
- int outrow;
242
-
243
- for (outrow = 0; outrow < cinfo->max_v_samp_factor; outrow++) {
244
- inptr = input_data[outrow];
245
- outptr = output_data[outrow];
246
- outend = outptr + cinfo->output_width;
247
- while (outptr < outend) {
248
- invalue = *inptr++; /* don't need GETJSAMPLE() here */
249
- *outptr++ = invalue;
250
- *outptr++ = invalue;
251
- }
252
- }
253
- }
254
-
255
-
256
- /*
257
- * Fast processing for the common case of 2:1 horizontal and 2:1 vertical.
258
- * It's still a box filter.
259
- */
260
-
261
- METHODDEF(void)
262
- h2v2_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr,
263
- JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)
264
- {
265
- JSAMPARRAY output_data = *output_data_ptr;
266
- register JSAMPROW inptr, outptr;
267
- register JSAMPLE invalue;
268
- JSAMPROW outend;
269
- int inrow, outrow;
270
-
271
- inrow = outrow = 0;
272
- while (outrow < cinfo->max_v_samp_factor) {
273
- inptr = input_data[inrow];
274
- outptr = output_data[outrow];
275
- outend = outptr + cinfo->output_width;
276
- while (outptr < outend) {
277
- invalue = *inptr++; /* don't need GETJSAMPLE() here */
278
- *outptr++ = invalue;
279
- *outptr++ = invalue;
280
- }
281
- jcopy_sample_rows(output_data, outrow, output_data, outrow+1,
282
- 1, cinfo->output_width);
283
- inrow++;
284
- outrow += 2;
285
- }
286
- }
287
-
288
-
289
- /*
290
- * Module initialization routine for upsampling.
291
- */
292
-
293
- GLOBAL(void)
294
- jinit_upsampler (j_decompress_ptr cinfo)
295
- {
296
- my_upsample_ptr upsample;
297
- int ci;
298
- jpeg_component_info * compptr;
299
- boolean need_buffer;
300
- int h_in_group, v_in_group, h_out_group, v_out_group;
301
-
302
- upsample = (my_upsample_ptr)
303
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
304
- SIZEOF(my_upsampler));
305
- cinfo->upsample = (struct jpeg_upsampler *) upsample;
306
- upsample->pub.start_pass = start_pass_upsample;
307
- upsample->pub.upsample = sep_upsample;
308
- upsample->pub.need_context_rows = FALSE; /* until we find out differently */
309
-
310
- if (cinfo->CCIR601_sampling) /* this isn't supported */
311
- ERREXIT(cinfo, JERR_CCIR601_NOTIMPL);
312
-
313
- /* Verify we can handle the sampling factors, select per-component methods,
314
- * and create storage as needed.
315
- */
316
- for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
317
- ci++, compptr++) {
318
- /* Compute size of an "input group" after IDCT scaling. This many samples
319
- * are to be converted to max_h_samp_factor * max_v_samp_factor pixels.
320
- */
321
- h_in_group = (compptr->h_samp_factor * compptr->DCT_h_scaled_size) /
322
- cinfo->min_DCT_h_scaled_size;
323
- v_in_group = (compptr->v_samp_factor * compptr->DCT_v_scaled_size) /
324
- cinfo->min_DCT_v_scaled_size;
325
- h_out_group = cinfo->max_h_samp_factor;
326
- v_out_group = cinfo->max_v_samp_factor;
327
- upsample->rowgroup_height[ci] = v_in_group; /* save for use later */
328
- need_buffer = TRUE;
329
- if (! compptr->component_needed) {
330
- /* Don't bother to upsample an uninteresting component. */
331
- upsample->methods[ci] = noop_upsample;
332
- need_buffer = FALSE;
333
- } else if (h_in_group == h_out_group && v_in_group == v_out_group) {
334
- /* Fullsize components can be processed without any work. */
335
- upsample->methods[ci] = fullsize_upsample;
336
- need_buffer = FALSE;
337
- } else if (h_in_group * 2 == h_out_group &&
338
- v_in_group == v_out_group) {
339
- /* Special case for 2h1v upsampling */
340
- upsample->methods[ci] = h2v1_upsample;
341
- } else if (h_in_group * 2 == h_out_group &&
342
- v_in_group * 2 == v_out_group) {
343
- /* Special case for 2h2v upsampling */
344
- upsample->methods[ci] = h2v2_upsample;
345
- } else if ((h_out_group % h_in_group) == 0 &&
346
- (v_out_group % v_in_group) == 0) {
347
- /* Generic integral-factors upsampling method */
348
- upsample->methods[ci] = int_upsample;
349
- upsample->h_expand[ci] = (UINT8) (h_out_group / h_in_group);
350
- upsample->v_expand[ci] = (UINT8) (v_out_group / v_in_group);
351
- } else
352
- ERREXIT(cinfo, JERR_FRACT_SAMPLE_NOTIMPL);
353
- if (need_buffer) {
354
- upsample->color_buf[ci] = (*cinfo->mem->alloc_sarray)
355
- ((j_common_ptr) cinfo, JPOOL_IMAGE,
356
- (JDIMENSION) jround_up((long) cinfo->output_width,
357
- (long) cinfo->max_h_samp_factor),
358
- (JDIMENSION) cinfo->max_v_samp_factor);
359
- }
360
- }
361
- }
data/src/jpeg-7/jdtrans.c DELETED
@@ -1,136 +0,0 @@
1
- /*
2
- * jdtrans.c
3
- *
4
- * Copyright (C) 1995-1997, Thomas G. Lane.
5
- * This file is part of the Independent JPEG Group's software.
6
- * For conditions of distribution and use, see the accompanying README file.
7
- *
8
- * This file contains library routines for transcoding decompression,
9
- * that is, reading raw DCT coefficient arrays from an input JPEG file.
10
- * The routines in jdapimin.c will also be needed by a transcoder.
11
- */
12
-
13
- #define JPEG_INTERNALS
14
- #include "jinclude.h"
15
- #include "jpeglib.h"
16
-
17
-
18
- /* Forward declarations */
19
- LOCAL(void) transdecode_master_selection JPP((j_decompress_ptr cinfo));
20
-
21
-
22
- /*
23
- * Read the coefficient arrays from a JPEG file.
24
- * jpeg_read_header must be completed before calling this.
25
- *
26
- * The entire image is read into a set of virtual coefficient-block arrays,
27
- * one per component. The return value is a pointer to the array of
28
- * virtual-array descriptors. These can be manipulated directly via the
29
- * JPEG memory manager, or handed off to jpeg_write_coefficients().
30
- * To release the memory occupied by the virtual arrays, call
31
- * jpeg_finish_decompress() when done with the data.
32
- *
33
- * An alternative usage is to simply obtain access to the coefficient arrays
34
- * during a buffered-image-mode decompression operation. This is allowed
35
- * after any jpeg_finish_output() call. The arrays can be accessed until
36
- * jpeg_finish_decompress() is called. (Note that any call to the library
37
- * may reposition the arrays, so don't rely on access_virt_barray() results
38
- * to stay valid across library calls.)
39
- *
40
- * Returns NULL if suspended. This case need be checked only if
41
- * a suspending data source is used.
42
- */
43
-
44
- GLOBAL(jvirt_barray_ptr *)
45
- jpeg_read_coefficients (j_decompress_ptr cinfo)
46
- {
47
- if (cinfo->global_state == DSTATE_READY) {
48
- /* First call: initialize active modules */
49
- transdecode_master_selection(cinfo);
50
- cinfo->global_state = DSTATE_RDCOEFS;
51
- }
52
- if (cinfo->global_state == DSTATE_RDCOEFS) {
53
- /* Absorb whole file into the coef buffer */
54
- for (;;) {
55
- int retcode;
56
- /* Call progress monitor hook if present */
57
- if (cinfo->progress != NULL)
58
- (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);
59
- /* Absorb some more input */
60
- retcode = (*cinfo->inputctl->consume_input) (cinfo);
61
- if (retcode == JPEG_SUSPENDED)
62
- return NULL;
63
- if (retcode == JPEG_REACHED_EOI)
64
- break;
65
- /* Advance progress counter if appropriate */
66
- if (cinfo->progress != NULL &&
67
- (retcode == JPEG_ROW_COMPLETED || retcode == JPEG_REACHED_SOS)) {
68
- if (++cinfo->progress->pass_counter >= cinfo->progress->pass_limit) {
69
- /* startup underestimated number of scans; ratchet up one scan */
70
- cinfo->progress->pass_limit += (long) cinfo->total_iMCU_rows;
71
- }
72
- }
73
- }
74
- /* Set state so that jpeg_finish_decompress does the right thing */
75
- cinfo->global_state = DSTATE_STOPPING;
76
- }
77
- /* At this point we should be in state DSTATE_STOPPING if being used
78
- * standalone, or in state DSTATE_BUFIMAGE if being invoked to get access
79
- * to the coefficients during a full buffered-image-mode decompression.
80
- */
81
- if ((cinfo->global_state == DSTATE_STOPPING ||
82
- cinfo->global_state == DSTATE_BUFIMAGE) && cinfo->buffered_image) {
83
- return cinfo->coef->coef_arrays;
84
- }
85
- /* Oops, improper usage */
86
- ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
87
- return NULL; /* keep compiler happy */
88
- }
89
-
90
-
91
- /*
92
- * Master selection of decompression modules for transcoding.
93
- * This substitutes for jdmaster.c's initialization of the full decompressor.
94
- */
95
-
96
- LOCAL(void)
97
- transdecode_master_selection (j_decompress_ptr cinfo)
98
- {
99
- /* This is effectively a buffered-image operation. */
100
- cinfo->buffered_image = TRUE;
101
-
102
- /* Entropy decoding: either Huffman or arithmetic coding. */
103
- if (cinfo->arith_code)
104
- jinit_arith_decoder(cinfo);
105
- else {
106
- jinit_huff_decoder(cinfo);
107
- }
108
-
109
- /* Always get a full-image coefficient buffer. */
110
- jinit_d_coef_controller(cinfo, TRUE);
111
-
112
- /* We can now tell the memory manager to allocate virtual arrays. */
113
- (*cinfo->mem->realize_virt_arrays) ((j_common_ptr) cinfo);
114
-
115
- /* Initialize input side of decompressor to consume first scan. */
116
- (*cinfo->inputctl->start_input_pass) (cinfo);
117
-
118
- /* Initialize progress monitoring. */
119
- if (cinfo->progress != NULL) {
120
- int nscans;
121
- /* Estimate number of scans to set pass_limit. */
122
- if (cinfo->progressive_mode) {
123
- /* Arbitrarily estimate 2 interleaved DC scans + 3 AC scans/component. */
124
- nscans = 2 + 3 * cinfo->num_components;
125
- } else if (cinfo->inputctl->has_multiple_scans) {
126
- /* For a nonprogressive multiscan file, estimate 1 scan per component. */
127
- nscans = cinfo->num_components;
128
- } else {
129
- nscans = 1;
130
- }
131
- cinfo->progress->pass_counter = 0L;
132
- cinfo->progress->pass_limit = (long) cinfo->total_iMCU_rows * nscans;
133
- cinfo->progress->completed_passes = 0;
134
- cinfo->progress->total_passes = 1;
135
- }
136
- }