entangledstate-isbn 1.4.0 → 1.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (290) hide show
  1. data/README +1 -1
  2. data/Rakefile +0 -18
  3. data/VERSION +1 -0
  4. data/isbn.gemspec +290 -7
  5. data/lib/isbn.rb +6 -6
  6. data/src/gocr-0.48/.cvsignore +6 -0
  7. data/src/gocr-0.48/AUTHORS +7 -0
  8. data/src/gocr-0.48/BUGS +55 -0
  9. data/src/gocr-0.48/CREDITS +17 -0
  10. data/src/gocr-0.48/HISTORY +243 -0
  11. data/src/gocr-0.48/INSTALL +83 -0
  12. data/src/gocr-0.48/Makefile +193 -0
  13. data/src/gocr-0.48/Makefile.in +193 -0
  14. data/src/gocr-0.48/README +165 -0
  15. data/src/gocr-0.48/READMEde.txt +80 -0
  16. data/src/gocr-0.48/REMARK.txt +18 -0
  17. data/src/gocr-0.48/REVIEW +538 -0
  18. data/src/gocr-0.48/TODO +65 -0
  19. data/src/gocr-0.48/bin/.cvsignore +2 -0
  20. data/src/gocr-0.48/bin/create_db +38 -0
  21. data/src/gocr-0.48/bin/gocr.tcl +527 -0
  22. data/src/gocr-0.48/bin/gocr_chk.sh +44 -0
  23. data/src/gocr-0.48/configure +4689 -0
  24. data/src/gocr-0.48/configure.in +71 -0
  25. data/src/gocr-0.48/doc/.#Makefile.1.6 +39 -0
  26. data/src/gocr-0.48/doc/.cvsignore +2 -0
  27. data/src/gocr-0.48/doc/Makefile +39 -0
  28. data/src/gocr-0.48/doc/Makefile.in +39 -0
  29. data/src/gocr-0.48/doc/example.dtd +53 -0
  30. data/src/gocr-0.48/doc/example.xml +21 -0
  31. data/src/gocr-0.48/doc/examples.txt +67 -0
  32. data/src/gocr-0.48/doc/gocr.html +578 -0
  33. data/src/gocr-0.48/doc/unicode.txt +57 -0
  34. data/src/gocr-0.48/examples/.#Makefile.1.22 +166 -0
  35. data/src/gocr-0.48/examples/4x6.png +0 -0
  36. data/src/gocr-0.48/examples/4x6.txt +2 -0
  37. data/src/gocr-0.48/examples/5x7.png +0 -0
  38. data/src/gocr-0.48/examples/5x7.png.txt +2 -0
  39. data/src/gocr-0.48/examples/5x8.png +0 -0
  40. data/src/gocr-0.48/examples/5x8.png.txt +2 -0
  41. data/src/gocr-0.48/examples/Makefile +166 -0
  42. data/src/gocr-0.48/examples/color.fig +20 -0
  43. data/src/gocr-0.48/examples/ex.fig +16 -0
  44. data/src/gocr-0.48/examples/font.tex +22 -0
  45. data/src/gocr-0.48/examples/font1.tex +46 -0
  46. data/src/gocr-0.48/examples/font2.fig +27 -0
  47. data/src/gocr-0.48/examples/font_nw.tex +24 -0
  48. data/src/gocr-0.48/examples/handwrt1.jpg +0 -0
  49. data/src/gocr-0.48/examples/handwrt1.txt +10 -0
  50. data/src/gocr-0.48/examples/inverse.fig +20 -0
  51. data/src/gocr-0.48/examples/matrix.jpg +0 -0
  52. data/src/gocr-0.48/examples/ocr-a-subset.png +0 -0
  53. data/src/gocr-0.48/examples/ocr-a-subset.png.txt +4 -0
  54. data/src/gocr-0.48/examples/ocr-a.png +0 -0
  55. data/src/gocr-0.48/examples/ocr-a.txt +6 -0
  56. data/src/gocr-0.48/examples/ocr-b.png +0 -0
  57. data/src/gocr-0.48/examples/ocr-b.png.txt +4 -0
  58. data/src/gocr-0.48/examples/polish.tex +28 -0
  59. data/src/gocr-0.48/examples/rotate45.fig +14 -0
  60. data/src/gocr-0.48/examples/score +36 -0
  61. data/src/gocr-0.48/examples/text.tex +28 -0
  62. data/src/gocr-0.48/gocr.spec +143 -0
  63. data/src/gocr-0.48/gpl.html +537 -0
  64. data/src/gocr-0.48/include/.cvsignore +2 -0
  65. data/src/gocr-0.48/include/config.h +36 -0
  66. data/src/gocr-0.48/include/config.h.in +36 -0
  67. data/src/gocr-0.48/include/version.h +2 -0
  68. data/src/gocr-0.48/install-sh +3 -0
  69. data/src/gocr-0.48/make.bat +57 -0
  70. data/src/gocr-0.48/man/.cvsignore +2 -0
  71. data/src/gocr-0.48/man/Makefile +29 -0
  72. data/src/gocr-0.48/man/Makefile.in +29 -0
  73. data/src/gocr-0.48/man/man1/gocr.1 +166 -0
  74. data/src/gocr-0.48/src/.cvsignore +4 -0
  75. data/src/gocr-0.48/src/Makefile +132 -0
  76. data/src/gocr-0.48/src/Makefile.in +132 -0
  77. data/src/gocr-0.48/src/amiga.h +31 -0
  78. data/src/gocr-0.48/src/barcode.c +846 -0
  79. data/src/gocr-0.48/src/barcode.c.orig +593 -0
  80. data/src/gocr-0.48/src/barcode.h +11 -0
  81. data/src/gocr-0.48/src/box.c +372 -0
  82. data/src/gocr-0.48/src/database.c +462 -0
  83. data/src/gocr-0.48/src/detect.c +943 -0
  84. data/src/gocr-0.48/src/gocr.c +373 -0
  85. data/src/gocr-0.48/src/gocr.h +288 -0
  86. data/src/gocr-0.48/src/jconv.c +168 -0
  87. data/src/gocr-0.48/src/job.c +84 -0
  88. data/src/gocr-0.48/src/lines.c +350 -0
  89. data/src/gocr-0.48/src/list.c +334 -0
  90. data/src/gocr-0.48/src/list.h +90 -0
  91. data/src/gocr-0.48/src/ocr0.c +6756 -0
  92. data/src/gocr-0.48/src/ocr0.h +63 -0
  93. data/src/gocr-0.48/src/ocr0n.c +1475 -0
  94. data/src/gocr-0.48/src/ocr1.c +85 -0
  95. data/src/gocr-0.48/src/ocr1.h +3 -0
  96. data/src/gocr-0.48/src/otsu.c +289 -0
  97. data/src/gocr-0.48/src/otsu.h +23 -0
  98. data/src/gocr-0.48/src/output.c +289 -0
  99. data/src/gocr-0.48/src/output.h +37 -0
  100. data/src/gocr-0.48/src/pcx.c +153 -0
  101. data/src/gocr-0.48/src/pcx.h +9 -0
  102. data/src/gocr-0.48/src/pgm2asc.c +2893 -0
  103. data/src/gocr-0.48/src/pgm2asc.h +105 -0
  104. data/src/gocr-0.48/src/pixel.c +537 -0
  105. data/src/gocr-0.48/src/pnm.c +533 -0
  106. data/src/gocr-0.48/src/pnm.h +35 -0
  107. data/src/gocr-0.48/src/progress.c +87 -0
  108. data/src/gocr-0.48/src/progress.h +42 -0
  109. data/src/gocr-0.48/src/remove.c +703 -0
  110. data/src/gocr-0.48/src/tga.c +87 -0
  111. data/src/gocr-0.48/src/tga.h +6 -0
  112. data/src/gocr-0.48/src/unicode.c +1314 -0
  113. data/src/gocr-0.48/src/unicode.h +1257 -0
  114. data/src/jpeg-7/Makefile.am +133 -0
  115. data/src/jpeg-7/Makefile.in +1089 -0
  116. data/src/jpeg-7/README +322 -0
  117. data/src/jpeg-7/aclocal.m4 +8990 -0
  118. data/src/jpeg-7/ansi2knr.1 +36 -0
  119. data/src/jpeg-7/ansi2knr.c +739 -0
  120. data/src/jpeg-7/cderror.h +132 -0
  121. data/src/jpeg-7/cdjpeg.c +181 -0
  122. data/src/jpeg-7/cdjpeg.h +187 -0
  123. data/src/jpeg-7/change.log +270 -0
  124. data/src/jpeg-7/cjpeg.1 +325 -0
  125. data/src/jpeg-7/cjpeg.c +616 -0
  126. data/src/jpeg-7/ckconfig.c +402 -0
  127. data/src/jpeg-7/coderules.txt +118 -0
  128. data/src/jpeg-7/config.guess +1561 -0
  129. data/src/jpeg-7/config.sub +1686 -0
  130. data/src/jpeg-7/configure +17139 -0
  131. data/src/jpeg-7/configure.ac +317 -0
  132. data/src/jpeg-7/depcomp +630 -0
  133. data/src/jpeg-7/djpeg.1 +251 -0
  134. data/src/jpeg-7/djpeg.c +617 -0
  135. data/src/jpeg-7/example.c +433 -0
  136. data/src/jpeg-7/filelist.txt +215 -0
  137. data/src/jpeg-7/install-sh +520 -0
  138. data/src/jpeg-7/install.txt +1097 -0
  139. data/src/jpeg-7/jaricom.c +148 -0
  140. data/src/jpeg-7/jcapimin.c +282 -0
  141. data/src/jpeg-7/jcapistd.c +161 -0
  142. data/src/jpeg-7/jcarith.c +921 -0
  143. data/src/jpeg-7/jccoefct.c +453 -0
  144. data/src/jpeg-7/jccolor.c +459 -0
  145. data/src/jpeg-7/jcdctmgr.c +482 -0
  146. data/src/jpeg-7/jchuff.c +1612 -0
  147. data/src/jpeg-7/jcinit.c +65 -0
  148. data/src/jpeg-7/jcmainct.c +293 -0
  149. data/src/jpeg-7/jcmarker.c +667 -0
  150. data/src/jpeg-7/jcmaster.c +770 -0
  151. data/src/jpeg-7/jcomapi.c +106 -0
  152. data/src/jpeg-7/jconfig.bcc +48 -0
  153. data/src/jpeg-7/jconfig.cfg +45 -0
  154. data/src/jpeg-7/jconfig.dj +38 -0
  155. data/src/jpeg-7/jconfig.mac +43 -0
  156. data/src/jpeg-7/jconfig.manx +43 -0
  157. data/src/jpeg-7/jconfig.mc6 +52 -0
  158. data/src/jpeg-7/jconfig.sas +43 -0
  159. data/src/jpeg-7/jconfig.st +42 -0
  160. data/src/jpeg-7/jconfig.txt +155 -0
  161. data/src/jpeg-7/jconfig.vc +45 -0
  162. data/src/jpeg-7/jconfig.vms +37 -0
  163. data/src/jpeg-7/jconfig.wat +38 -0
  164. data/src/jpeg-7/jcparam.c +632 -0
  165. data/src/jpeg-7/jcprepct.c +358 -0
  166. data/src/jpeg-7/jcsample.c +545 -0
  167. data/src/jpeg-7/jctrans.c +381 -0
  168. data/src/jpeg-7/jdapimin.c +396 -0
  169. data/src/jpeg-7/jdapistd.c +275 -0
  170. data/src/jpeg-7/jdarith.c +762 -0
  171. data/src/jpeg-7/jdatadst.c +151 -0
  172. data/src/jpeg-7/jdatasrc.c +212 -0
  173. data/src/jpeg-7/jdcoefct.c +736 -0
  174. data/src/jpeg-7/jdcolor.c +396 -0
  175. data/src/jpeg-7/jdct.h +393 -0
  176. data/src/jpeg-7/jddctmgr.c +382 -0
  177. data/src/jpeg-7/jdhuff.c +1309 -0
  178. data/src/jpeg-7/jdinput.c +384 -0
  179. data/src/jpeg-7/jdmainct.c +512 -0
  180. data/src/jpeg-7/jdmarker.c +1360 -0
  181. data/src/jpeg-7/jdmaster.c +663 -0
  182. data/src/jpeg-7/jdmerge.c +400 -0
  183. data/src/jpeg-7/jdpostct.c +290 -0
  184. data/src/jpeg-7/jdsample.c +361 -0
  185. data/src/jpeg-7/jdtrans.c +136 -0
  186. data/src/jpeg-7/jerror.c +252 -0
  187. data/src/jpeg-7/jerror.h +304 -0
  188. data/src/jpeg-7/jfdctflt.c +174 -0
  189. data/src/jpeg-7/jfdctfst.c +230 -0
  190. data/src/jpeg-7/jfdctint.c +4348 -0
  191. data/src/jpeg-7/jidctflt.c +242 -0
  192. data/src/jpeg-7/jidctfst.c +368 -0
  193. data/src/jpeg-7/jidctint.c +5137 -0
  194. data/src/jpeg-7/jinclude.h +91 -0
  195. data/src/jpeg-7/jmemansi.c +167 -0
  196. data/src/jpeg-7/jmemdos.c +638 -0
  197. data/src/jpeg-7/jmemdosa.asm +379 -0
  198. data/src/jpeg-7/jmemmac.c +289 -0
  199. data/src/jpeg-7/jmemmgr.c +1118 -0
  200. data/src/jpeg-7/jmemname.c +276 -0
  201. data/src/jpeg-7/jmemnobs.c +109 -0
  202. data/src/jpeg-7/jmemsys.h +198 -0
  203. data/src/jpeg-7/jmorecfg.h +369 -0
  204. data/src/jpeg-7/jpegint.h +395 -0
  205. data/src/jpeg-7/jpeglib.h +1135 -0
  206. data/src/jpeg-7/jpegtran.1 +272 -0
  207. data/src/jpeg-7/jpegtran.c +546 -0
  208. data/src/jpeg-7/jquant1.c +856 -0
  209. data/src/jpeg-7/jquant2.c +1310 -0
  210. data/src/jpeg-7/jutils.c +179 -0
  211. data/src/jpeg-7/jversion.h +14 -0
  212. data/src/jpeg-7/libjpeg.map +4 -0
  213. data/src/jpeg-7/libjpeg.txt +3067 -0
  214. data/src/jpeg-7/ltmain.sh +8406 -0
  215. data/src/jpeg-7/makcjpeg.st +36 -0
  216. data/src/jpeg-7/makdjpeg.st +36 -0
  217. data/src/jpeg-7/makeadsw.vc6 +77 -0
  218. data/src/jpeg-7/makeasln.vc9 +33 -0
  219. data/src/jpeg-7/makecdep.vc6 +82 -0
  220. data/src/jpeg-7/makecdsp.vc6 +130 -0
  221. data/src/jpeg-7/makecmak.vc6 +159 -0
  222. data/src/jpeg-7/makecvcp.vc9 +186 -0
  223. data/src/jpeg-7/makeddep.vc6 +82 -0
  224. data/src/jpeg-7/makeddsp.vc6 +130 -0
  225. data/src/jpeg-7/makedmak.vc6 +159 -0
  226. data/src/jpeg-7/makedvcp.vc9 +186 -0
  227. data/src/jpeg-7/makefile.ansi +220 -0
  228. data/src/jpeg-7/makefile.bcc +291 -0
  229. data/src/jpeg-7/makefile.dj +226 -0
  230. data/src/jpeg-7/makefile.manx +220 -0
  231. data/src/jpeg-7/makefile.mc6 +255 -0
  232. data/src/jpeg-7/makefile.mms +224 -0
  233. data/src/jpeg-7/makefile.sas +258 -0
  234. data/src/jpeg-7/makefile.unix +234 -0
  235. data/src/jpeg-7/makefile.vc +217 -0
  236. data/src/jpeg-7/makefile.vms +142 -0
  237. data/src/jpeg-7/makefile.wat +239 -0
  238. data/src/jpeg-7/makejdep.vc6 +423 -0
  239. data/src/jpeg-7/makejdsp.vc6 +285 -0
  240. data/src/jpeg-7/makejdsw.vc6 +29 -0
  241. data/src/jpeg-7/makejmak.vc6 +425 -0
  242. data/src/jpeg-7/makejsln.vc9 +17 -0
  243. data/src/jpeg-7/makejvcp.vc9 +328 -0
  244. data/src/jpeg-7/makeproj.mac +213 -0
  245. data/src/jpeg-7/makerdep.vc6 +6 -0
  246. data/src/jpeg-7/makerdsp.vc6 +78 -0
  247. data/src/jpeg-7/makermak.vc6 +110 -0
  248. data/src/jpeg-7/makervcp.vc9 +133 -0
  249. data/src/jpeg-7/maketdep.vc6 +43 -0
  250. data/src/jpeg-7/maketdsp.vc6 +122 -0
  251. data/src/jpeg-7/maketmak.vc6 +131 -0
  252. data/src/jpeg-7/maketvcp.vc9 +178 -0
  253. data/src/jpeg-7/makewdep.vc6 +6 -0
  254. data/src/jpeg-7/makewdsp.vc6 +78 -0
  255. data/src/jpeg-7/makewmak.vc6 +110 -0
  256. data/src/jpeg-7/makewvcp.vc9 +133 -0
  257. data/src/jpeg-7/makljpeg.st +68 -0
  258. data/src/jpeg-7/maktjpeg.st +30 -0
  259. data/src/jpeg-7/makvms.opt +4 -0
  260. data/src/jpeg-7/missing +376 -0
  261. data/src/jpeg-7/rdbmp.c +439 -0
  262. data/src/jpeg-7/rdcolmap.c +253 -0
  263. data/src/jpeg-7/rdgif.c +38 -0
  264. data/src/jpeg-7/rdjpgcom.1 +63 -0
  265. data/src/jpeg-7/rdjpgcom.c +515 -0
  266. data/src/jpeg-7/rdppm.c +459 -0
  267. data/src/jpeg-7/rdrle.c +387 -0
  268. data/src/jpeg-7/rdswitch.c +365 -0
  269. data/src/jpeg-7/rdtarga.c +500 -0
  270. data/src/jpeg-7/structure.txt +945 -0
  271. data/src/jpeg-7/testimg.bmp +0 -0
  272. data/src/jpeg-7/testimg.jpg +0 -0
  273. data/src/jpeg-7/testimg.ppm +4 -0
  274. data/src/jpeg-7/testimgp.jpg +0 -0
  275. data/src/jpeg-7/testorig.jpg +0 -0
  276. data/src/jpeg-7/testprog.jpg +0 -0
  277. data/src/jpeg-7/transupp.c +1533 -0
  278. data/src/jpeg-7/transupp.h +205 -0
  279. data/src/jpeg-7/usage.txt +605 -0
  280. data/src/jpeg-7/wizard.txt +211 -0
  281. data/src/jpeg-7/wrbmp.c +442 -0
  282. data/src/jpeg-7/wrgif.c +399 -0
  283. data/src/jpeg-7/wrjpgcom.1 +103 -0
  284. data/src/jpeg-7/wrjpgcom.c +583 -0
  285. data/src/jpeg-7/wrppm.c +269 -0
  286. data/src/jpeg-7/wrrle.c +305 -0
  287. data/src/jpeg-7/wrtarga.c +253 -0
  288. metadata +287 -6
  289. data/LICENSE +0 -20
  290. data/VERSION.yml +0 -4
@@ -0,0 +1,396 @@
1
+ /*
2
+ * jdcolor.c
3
+ *
4
+ * Copyright (C) 1991-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 output colorspace conversion routines.
9
+ */
10
+
11
+ #define JPEG_INTERNALS
12
+ #include "jinclude.h"
13
+ #include "jpeglib.h"
14
+
15
+
16
+ /* Private subobject */
17
+
18
+ typedef struct {
19
+ struct jpeg_color_deconverter pub; /* public fields */
20
+
21
+ /* Private state for YCC->RGB conversion */
22
+ int * Cr_r_tab; /* => table for Cr to R conversion */
23
+ int * Cb_b_tab; /* => table for Cb to B conversion */
24
+ INT32 * Cr_g_tab; /* => table for Cr to G conversion */
25
+ INT32 * Cb_g_tab; /* => table for Cb to G conversion */
26
+ } my_color_deconverter;
27
+
28
+ typedef my_color_deconverter * my_cconvert_ptr;
29
+
30
+
31
+ /**************** YCbCr -> RGB conversion: most common case **************/
32
+
33
+ /*
34
+ * YCbCr is defined per CCIR 601-1, except that Cb and Cr are
35
+ * normalized to the range 0..MAXJSAMPLE rather than -0.5 .. 0.5.
36
+ * The conversion equations to be implemented are therefore
37
+ * R = Y + 1.40200 * Cr
38
+ * G = Y - 0.34414 * Cb - 0.71414 * Cr
39
+ * B = Y + 1.77200 * Cb
40
+ * where Cb and Cr represent the incoming values less CENTERJSAMPLE.
41
+ * (These numbers are derived from TIFF 6.0 section 21, dated 3-June-92.)
42
+ *
43
+ * To avoid floating-point arithmetic, we represent the fractional constants
44
+ * as integers scaled up by 2^16 (about 4 digits precision); we have to divide
45
+ * the products by 2^16, with appropriate rounding, to get the correct answer.
46
+ * Notice that Y, being an integral input, does not contribute any fraction
47
+ * so it need not participate in the rounding.
48
+ *
49
+ * For even more speed, we avoid doing any multiplications in the inner loop
50
+ * by precalculating the constants times Cb and Cr for all possible values.
51
+ * For 8-bit JSAMPLEs this is very reasonable (only 256 entries per table);
52
+ * for 12-bit samples it is still acceptable. It's not very reasonable for
53
+ * 16-bit samples, but if you want lossless storage you shouldn't be changing
54
+ * colorspace anyway.
55
+ * The Cr=>R and Cb=>B values can be rounded to integers in advance; the
56
+ * values for the G calculation are left scaled up, since we must add them
57
+ * together before rounding.
58
+ */
59
+
60
+ #define SCALEBITS 16 /* speediest right-shift on some machines */
61
+ #define ONE_HALF ((INT32) 1 << (SCALEBITS-1))
62
+ #define FIX(x) ((INT32) ((x) * (1L<<SCALEBITS) + 0.5))
63
+
64
+
65
+ /*
66
+ * Initialize tables for YCC->RGB colorspace conversion.
67
+ */
68
+
69
+ LOCAL(void)
70
+ build_ycc_rgb_table (j_decompress_ptr cinfo)
71
+ {
72
+ my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
73
+ int i;
74
+ INT32 x;
75
+ SHIFT_TEMPS
76
+
77
+ cconvert->Cr_r_tab = (int *)
78
+ (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
79
+ (MAXJSAMPLE+1) * SIZEOF(int));
80
+ cconvert->Cb_b_tab = (int *)
81
+ (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
82
+ (MAXJSAMPLE+1) * SIZEOF(int));
83
+ cconvert->Cr_g_tab = (INT32 *)
84
+ (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
85
+ (MAXJSAMPLE+1) * SIZEOF(INT32));
86
+ cconvert->Cb_g_tab = (INT32 *)
87
+ (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
88
+ (MAXJSAMPLE+1) * SIZEOF(INT32));
89
+
90
+ for (i = 0, x = -CENTERJSAMPLE; i <= MAXJSAMPLE; i++, x++) {
91
+ /* i is the actual input pixel value, in the range 0..MAXJSAMPLE */
92
+ /* The Cb or Cr value we are thinking of is x = i - CENTERJSAMPLE */
93
+ /* Cr=>R value is nearest int to 1.40200 * x */
94
+ cconvert->Cr_r_tab[i] = (int)
95
+ RIGHT_SHIFT(FIX(1.40200) * x + ONE_HALF, SCALEBITS);
96
+ /* Cb=>B value is nearest int to 1.77200 * x */
97
+ cconvert->Cb_b_tab[i] = (int)
98
+ RIGHT_SHIFT(FIX(1.77200) * x + ONE_HALF, SCALEBITS);
99
+ /* Cr=>G value is scaled-up -0.71414 * x */
100
+ cconvert->Cr_g_tab[i] = (- FIX(0.71414)) * x;
101
+ /* Cb=>G value is scaled-up -0.34414 * x */
102
+ /* We also add in ONE_HALF so that need not do it in inner loop */
103
+ cconvert->Cb_g_tab[i] = (- FIX(0.34414)) * x + ONE_HALF;
104
+ }
105
+ }
106
+
107
+
108
+ /*
109
+ * Convert some rows of samples to the output colorspace.
110
+ *
111
+ * Note that we change from noninterleaved, one-plane-per-component format
112
+ * to interleaved-pixel format. The output buffer is therefore three times
113
+ * as wide as the input buffer.
114
+ * A starting row offset is provided only for the input buffer. The caller
115
+ * can easily adjust the passed output_buf value to accommodate any row
116
+ * offset required on that side.
117
+ */
118
+
119
+ METHODDEF(void)
120
+ ycc_rgb_convert (j_decompress_ptr cinfo,
121
+ JSAMPIMAGE input_buf, JDIMENSION input_row,
122
+ JSAMPARRAY output_buf, int num_rows)
123
+ {
124
+ my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
125
+ register int y, cb, cr;
126
+ register JSAMPROW outptr;
127
+ register JSAMPROW inptr0, inptr1, inptr2;
128
+ register JDIMENSION col;
129
+ JDIMENSION num_cols = cinfo->output_width;
130
+ /* copy these pointers into registers if possible */
131
+ register JSAMPLE * range_limit = cinfo->sample_range_limit;
132
+ register int * Crrtab = cconvert->Cr_r_tab;
133
+ register int * Cbbtab = cconvert->Cb_b_tab;
134
+ register INT32 * Crgtab = cconvert->Cr_g_tab;
135
+ register INT32 * Cbgtab = cconvert->Cb_g_tab;
136
+ SHIFT_TEMPS
137
+
138
+ while (--num_rows >= 0) {
139
+ inptr0 = input_buf[0][input_row];
140
+ inptr1 = input_buf[1][input_row];
141
+ inptr2 = input_buf[2][input_row];
142
+ input_row++;
143
+ outptr = *output_buf++;
144
+ for (col = 0; col < num_cols; col++) {
145
+ y = GETJSAMPLE(inptr0[col]);
146
+ cb = GETJSAMPLE(inptr1[col]);
147
+ cr = GETJSAMPLE(inptr2[col]);
148
+ /* Range-limiting is essential due to noise introduced by DCT losses. */
149
+ outptr[RGB_RED] = range_limit[y + Crrtab[cr]];
150
+ outptr[RGB_GREEN] = range_limit[y +
151
+ ((int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],
152
+ SCALEBITS))];
153
+ outptr[RGB_BLUE] = range_limit[y + Cbbtab[cb]];
154
+ outptr += RGB_PIXELSIZE;
155
+ }
156
+ }
157
+ }
158
+
159
+
160
+ /**************** Cases other than YCbCr -> RGB **************/
161
+
162
+
163
+ /*
164
+ * Color conversion for no colorspace change: just copy the data,
165
+ * converting from separate-planes to interleaved representation.
166
+ */
167
+
168
+ METHODDEF(void)
169
+ null_convert (j_decompress_ptr cinfo,
170
+ JSAMPIMAGE input_buf, JDIMENSION input_row,
171
+ JSAMPARRAY output_buf, int num_rows)
172
+ {
173
+ register JSAMPROW inptr, outptr;
174
+ register JDIMENSION count;
175
+ register int num_components = cinfo->num_components;
176
+ JDIMENSION num_cols = cinfo->output_width;
177
+ int ci;
178
+
179
+ while (--num_rows >= 0) {
180
+ for (ci = 0; ci < num_components; ci++) {
181
+ inptr = input_buf[ci][input_row];
182
+ outptr = output_buf[0] + ci;
183
+ for (count = num_cols; count > 0; count--) {
184
+ *outptr = *inptr++; /* needn't bother with GETJSAMPLE() here */
185
+ outptr += num_components;
186
+ }
187
+ }
188
+ input_row++;
189
+ output_buf++;
190
+ }
191
+ }
192
+
193
+
194
+ /*
195
+ * Color conversion for grayscale: just copy the data.
196
+ * This also works for YCbCr -> grayscale conversion, in which
197
+ * we just copy the Y (luminance) component and ignore chrominance.
198
+ */
199
+
200
+ METHODDEF(void)
201
+ grayscale_convert (j_decompress_ptr cinfo,
202
+ JSAMPIMAGE input_buf, JDIMENSION input_row,
203
+ JSAMPARRAY output_buf, int num_rows)
204
+ {
205
+ jcopy_sample_rows(input_buf[0], (int) input_row, output_buf, 0,
206
+ num_rows, cinfo->output_width);
207
+ }
208
+
209
+
210
+ /*
211
+ * Convert grayscale to RGB: just duplicate the graylevel three times.
212
+ * This is provided to support applications that don't want to cope
213
+ * with grayscale as a separate case.
214
+ */
215
+
216
+ METHODDEF(void)
217
+ gray_rgb_convert (j_decompress_ptr cinfo,
218
+ JSAMPIMAGE input_buf, JDIMENSION input_row,
219
+ JSAMPARRAY output_buf, int num_rows)
220
+ {
221
+ register JSAMPROW inptr, outptr;
222
+ register JDIMENSION col;
223
+ JDIMENSION num_cols = cinfo->output_width;
224
+
225
+ while (--num_rows >= 0) {
226
+ inptr = input_buf[0][input_row++];
227
+ outptr = *output_buf++;
228
+ for (col = 0; col < num_cols; col++) {
229
+ /* We can dispense with GETJSAMPLE() here */
230
+ outptr[RGB_RED] = outptr[RGB_GREEN] = outptr[RGB_BLUE] = inptr[col];
231
+ outptr += RGB_PIXELSIZE;
232
+ }
233
+ }
234
+ }
235
+
236
+
237
+ /*
238
+ * Adobe-style YCCK->CMYK conversion.
239
+ * We convert YCbCr to R=1-C, G=1-M, and B=1-Y using the same
240
+ * conversion as above, while passing K (black) unchanged.
241
+ * We assume build_ycc_rgb_table has been called.
242
+ */
243
+
244
+ METHODDEF(void)
245
+ ycck_cmyk_convert (j_decompress_ptr cinfo,
246
+ JSAMPIMAGE input_buf, JDIMENSION input_row,
247
+ JSAMPARRAY output_buf, int num_rows)
248
+ {
249
+ my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
250
+ register int y, cb, cr;
251
+ register JSAMPROW outptr;
252
+ register JSAMPROW inptr0, inptr1, inptr2, inptr3;
253
+ register JDIMENSION col;
254
+ JDIMENSION num_cols = cinfo->output_width;
255
+ /* copy these pointers into registers if possible */
256
+ register JSAMPLE * range_limit = cinfo->sample_range_limit;
257
+ register int * Crrtab = cconvert->Cr_r_tab;
258
+ register int * Cbbtab = cconvert->Cb_b_tab;
259
+ register INT32 * Crgtab = cconvert->Cr_g_tab;
260
+ register INT32 * Cbgtab = cconvert->Cb_g_tab;
261
+ SHIFT_TEMPS
262
+
263
+ while (--num_rows >= 0) {
264
+ inptr0 = input_buf[0][input_row];
265
+ inptr1 = input_buf[1][input_row];
266
+ inptr2 = input_buf[2][input_row];
267
+ inptr3 = input_buf[3][input_row];
268
+ input_row++;
269
+ outptr = *output_buf++;
270
+ for (col = 0; col < num_cols; col++) {
271
+ y = GETJSAMPLE(inptr0[col]);
272
+ cb = GETJSAMPLE(inptr1[col]);
273
+ cr = GETJSAMPLE(inptr2[col]);
274
+ /* Range-limiting is essential due to noise introduced by DCT losses. */
275
+ outptr[0] = range_limit[MAXJSAMPLE - (y + Crrtab[cr])]; /* red */
276
+ outptr[1] = range_limit[MAXJSAMPLE - (y + /* green */
277
+ ((int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],
278
+ SCALEBITS)))];
279
+ outptr[2] = range_limit[MAXJSAMPLE - (y + Cbbtab[cb])]; /* blue */
280
+ /* K passes through unchanged */
281
+ outptr[3] = inptr3[col]; /* don't need GETJSAMPLE here */
282
+ outptr += 4;
283
+ }
284
+ }
285
+ }
286
+
287
+
288
+ /*
289
+ * Empty method for start_pass.
290
+ */
291
+
292
+ METHODDEF(void)
293
+ start_pass_dcolor (j_decompress_ptr cinfo)
294
+ {
295
+ /* no work needed */
296
+ }
297
+
298
+
299
+ /*
300
+ * Module initialization routine for output colorspace conversion.
301
+ */
302
+
303
+ GLOBAL(void)
304
+ jinit_color_deconverter (j_decompress_ptr cinfo)
305
+ {
306
+ my_cconvert_ptr cconvert;
307
+ int ci;
308
+
309
+ cconvert = (my_cconvert_ptr)
310
+ (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
311
+ SIZEOF(my_color_deconverter));
312
+ cinfo->cconvert = (struct jpeg_color_deconverter *) cconvert;
313
+ cconvert->pub.start_pass = start_pass_dcolor;
314
+
315
+ /* Make sure num_components agrees with jpeg_color_space */
316
+ switch (cinfo->jpeg_color_space) {
317
+ case JCS_GRAYSCALE:
318
+ if (cinfo->num_components != 1)
319
+ ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
320
+ break;
321
+
322
+ case JCS_RGB:
323
+ case JCS_YCbCr:
324
+ if (cinfo->num_components != 3)
325
+ ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
326
+ break;
327
+
328
+ case JCS_CMYK:
329
+ case JCS_YCCK:
330
+ if (cinfo->num_components != 4)
331
+ ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
332
+ break;
333
+
334
+ default: /* JCS_UNKNOWN can be anything */
335
+ if (cinfo->num_components < 1)
336
+ ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
337
+ break;
338
+ }
339
+
340
+ /* Set out_color_components and conversion method based on requested space.
341
+ * Also clear the component_needed flags for any unused components,
342
+ * so that earlier pipeline stages can avoid useless computation.
343
+ */
344
+
345
+ switch (cinfo->out_color_space) {
346
+ case JCS_GRAYSCALE:
347
+ cinfo->out_color_components = 1;
348
+ if (cinfo->jpeg_color_space == JCS_GRAYSCALE ||
349
+ cinfo->jpeg_color_space == JCS_YCbCr) {
350
+ cconvert->pub.color_convert = grayscale_convert;
351
+ /* For color->grayscale conversion, only the Y (0) component is needed */
352
+ for (ci = 1; ci < cinfo->num_components; ci++)
353
+ cinfo->comp_info[ci].component_needed = FALSE;
354
+ } else
355
+ ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
356
+ break;
357
+
358
+ case JCS_RGB:
359
+ cinfo->out_color_components = RGB_PIXELSIZE;
360
+ if (cinfo->jpeg_color_space == JCS_YCbCr) {
361
+ cconvert->pub.color_convert = ycc_rgb_convert;
362
+ build_ycc_rgb_table(cinfo);
363
+ } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
364
+ cconvert->pub.color_convert = gray_rgb_convert;
365
+ } else if (cinfo->jpeg_color_space == JCS_RGB && RGB_PIXELSIZE == 3) {
366
+ cconvert->pub.color_convert = null_convert;
367
+ } else
368
+ ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
369
+ break;
370
+
371
+ case JCS_CMYK:
372
+ cinfo->out_color_components = 4;
373
+ if (cinfo->jpeg_color_space == JCS_YCCK) {
374
+ cconvert->pub.color_convert = ycck_cmyk_convert;
375
+ build_ycc_rgb_table(cinfo);
376
+ } else if (cinfo->jpeg_color_space == JCS_CMYK) {
377
+ cconvert->pub.color_convert = null_convert;
378
+ } else
379
+ ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
380
+ break;
381
+
382
+ default:
383
+ /* Permit null conversion to same output space */
384
+ if (cinfo->out_color_space == cinfo->jpeg_color_space) {
385
+ cinfo->out_color_components = cinfo->num_components;
386
+ cconvert->pub.color_convert = null_convert;
387
+ } else /* unsupported non-null conversion */
388
+ ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
389
+ break;
390
+ }
391
+
392
+ if (cinfo->quantize_colors)
393
+ cinfo->output_components = 1; /* single colormapped output component */
394
+ else
395
+ cinfo->output_components = cinfo->out_color_components;
396
+ }
@@ -0,0 +1,393 @@
1
+ /*
2
+ * jdct.h
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 include file contains common declarations for the forward and
9
+ * inverse DCT modules. These declarations are private to the DCT managers
10
+ * (jcdctmgr.c, jddctmgr.c) and the individual DCT algorithms.
11
+ * The individual DCT algorithms are kept in separate files to ease
12
+ * machine-dependent tuning (e.g., assembly coding).
13
+ */
14
+
15
+
16
+ /*
17
+ * A forward DCT routine is given a pointer to an input sample array and
18
+ * a pointer to a work area of type DCTELEM[]; the DCT is to be performed
19
+ * in-place in that buffer. Type DCTELEM is int for 8-bit samples, INT32
20
+ * for 12-bit samples. (NOTE: Floating-point DCT implementations use an
21
+ * array of type FAST_FLOAT, instead.)
22
+ * The input data is to be fetched from the sample array starting at a
23
+ * specified column. (Any row offset needed will be applied to the array
24
+ * pointer before it is passed to the FDCT code.)
25
+ * Note that the number of samples fetched by the FDCT routine is
26
+ * DCT_h_scaled_size * DCT_v_scaled_size.
27
+ * The DCT outputs are returned scaled up by a factor of 8; they therefore
28
+ * have a range of +-8K for 8-bit data, +-128K for 12-bit data. This
29
+ * convention improves accuracy in integer implementations and saves some
30
+ * work in floating-point ones.
31
+ * Quantization of the output coefficients is done by jcdctmgr.c.
32
+ */
33
+
34
+ #if BITS_IN_JSAMPLE == 8
35
+ typedef int DCTELEM; /* 16 or 32 bits is fine */
36
+ #else
37
+ typedef INT32 DCTELEM; /* must have 32 bits */
38
+ #endif
39
+
40
+ typedef JMETHOD(void, forward_DCT_method_ptr, (DCTELEM * data,
41
+ JSAMPARRAY sample_data,
42
+ JDIMENSION start_col));
43
+ typedef JMETHOD(void, float_DCT_method_ptr, (FAST_FLOAT * data,
44
+ JSAMPARRAY sample_data,
45
+ JDIMENSION start_col));
46
+
47
+
48
+ /*
49
+ * An inverse DCT routine is given a pointer to the input JBLOCK and a pointer
50
+ * to an output sample array. The routine must dequantize the input data as
51
+ * well as perform the IDCT; for dequantization, it uses the multiplier table
52
+ * pointed to by compptr->dct_table. The output data is to be placed into the
53
+ * sample array starting at a specified column. (Any row offset needed will
54
+ * be applied to the array pointer before it is passed to the IDCT code.)
55
+ * Note that the number of samples emitted by the IDCT routine is
56
+ * DCT_h_scaled_size * DCT_v_scaled_size.
57
+ */
58
+
59
+ /* typedef inverse_DCT_method_ptr is declared in jpegint.h */
60
+
61
+ /*
62
+ * Each IDCT routine has its own ideas about the best dct_table element type.
63
+ */
64
+
65
+ typedef MULTIPLIER ISLOW_MULT_TYPE; /* short or int, whichever is faster */
66
+ #if BITS_IN_JSAMPLE == 8
67
+ typedef MULTIPLIER IFAST_MULT_TYPE; /* 16 bits is OK, use short if faster */
68
+ #define IFAST_SCALE_BITS 2 /* fractional bits in scale factors */
69
+ #else
70
+ typedef INT32 IFAST_MULT_TYPE; /* need 32 bits for scaled quantizers */
71
+ #define IFAST_SCALE_BITS 13 /* fractional bits in scale factors */
72
+ #endif
73
+ typedef FAST_FLOAT FLOAT_MULT_TYPE; /* preferred floating type */
74
+
75
+
76
+ /*
77
+ * Each IDCT routine is responsible for range-limiting its results and
78
+ * converting them to unsigned form (0..MAXJSAMPLE). The raw outputs could
79
+ * be quite far out of range if the input data is corrupt, so a bulletproof
80
+ * range-limiting step is required. We use a mask-and-table-lookup method
81
+ * to do the combined operations quickly. See the comments with
82
+ * prepare_range_limit_table (in jdmaster.c) for more info.
83
+ */
84
+
85
+ #define IDCT_range_limit(cinfo) ((cinfo)->sample_range_limit + CENTERJSAMPLE)
86
+
87
+ #define RANGE_MASK (MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
88
+
89
+
90
+ /* Short forms of external names for systems with brain-damaged linkers. */
91
+
92
+ #ifdef NEED_SHORT_EXTERNAL_NAMES
93
+ #define jpeg_fdct_islow jFDislow
94
+ #define jpeg_fdct_ifast jFDifast
95
+ #define jpeg_fdct_float jFDfloat
96
+ #define jpeg_fdct_7x7 jFD7x7
97
+ #define jpeg_fdct_6x6 jFD6x6
98
+ #define jpeg_fdct_5x5 jFD5x5
99
+ #define jpeg_fdct_4x4 jFD4x4
100
+ #define jpeg_fdct_3x3 jFD3x3
101
+ #define jpeg_fdct_2x2 jFD2x2
102
+ #define jpeg_fdct_1x1 jFD1x1
103
+ #define jpeg_fdct_9x9 jFD9x9
104
+ #define jpeg_fdct_10x10 jFD10x10
105
+ #define jpeg_fdct_11x11 jFD11x11
106
+ #define jpeg_fdct_12x12 jFD12x12
107
+ #define jpeg_fdct_13x13 jFD13x13
108
+ #define jpeg_fdct_14x14 jFD14x14
109
+ #define jpeg_fdct_15x15 jFD15x15
110
+ #define jpeg_fdct_16x16 jFD16x16
111
+ #define jpeg_fdct_16x8 jFD16x8
112
+ #define jpeg_fdct_14x7 jFD14x7
113
+ #define jpeg_fdct_12x6 jFD12x6
114
+ #define jpeg_fdct_10x5 jFD10x5
115
+ #define jpeg_fdct_8x4 jFD8x4
116
+ #define jpeg_fdct_6x3 jFD6x3
117
+ #define jpeg_fdct_4x2 jFD4x2
118
+ #define jpeg_fdct_2x1 jFD2x1
119
+ #define jpeg_fdct_8x16 jFD8x16
120
+ #define jpeg_fdct_7x14 jFD7x14
121
+ #define jpeg_fdct_6x12 jFD6x12
122
+ #define jpeg_fdct_5x10 jFD5x10
123
+ #define jpeg_fdct_4x8 jFD4x8
124
+ #define jpeg_fdct_3x6 jFD3x6
125
+ #define jpeg_fdct_2x4 jFD2x4
126
+ #define jpeg_fdct_1x2 jFD1x2
127
+ #define jpeg_idct_islow jRDislow
128
+ #define jpeg_idct_ifast jRDifast
129
+ #define jpeg_idct_float jRDfloat
130
+ #define jpeg_idct_7x7 jRD7x7
131
+ #define jpeg_idct_6x6 jRD6x6
132
+ #define jpeg_idct_5x5 jRD5x5
133
+ #define jpeg_idct_4x4 jRD4x4
134
+ #define jpeg_idct_3x3 jRD3x3
135
+ #define jpeg_idct_2x2 jRD2x2
136
+ #define jpeg_idct_1x1 jRD1x1
137
+ #define jpeg_idct_9x9 jRD9x9
138
+ #define jpeg_idct_10x10 jRD10x10
139
+ #define jpeg_idct_11x11 jRD11x11
140
+ #define jpeg_idct_12x12 jRD12x12
141
+ #define jpeg_idct_13x13 jRD13x13
142
+ #define jpeg_idct_14x14 jRD14x14
143
+ #define jpeg_idct_15x15 jRD15x15
144
+ #define jpeg_idct_16x16 jRD16x16
145
+ #define jpeg_idct_16x8 jRD16x8
146
+ #define jpeg_idct_14x7 jRD14x7
147
+ #define jpeg_idct_12x6 jRD12x6
148
+ #define jpeg_idct_10x5 jRD10x5
149
+ #define jpeg_idct_8x4 jRD8x4
150
+ #define jpeg_idct_6x3 jRD6x3
151
+ #define jpeg_idct_4x2 jRD4x2
152
+ #define jpeg_idct_2x1 jRD2x1
153
+ #define jpeg_idct_8x16 jRD8x16
154
+ #define jpeg_idct_7x14 jRD7x14
155
+ #define jpeg_idct_6x12 jRD6x12
156
+ #define jpeg_idct_5x10 jRD5x10
157
+ #define jpeg_idct_4x8 jRD4x8
158
+ #define jpeg_idct_3x6 jRD3x8
159
+ #define jpeg_idct_2x4 jRD2x4
160
+ #define jpeg_idct_1x2 jRD1x2
161
+ #endif /* NEED_SHORT_EXTERNAL_NAMES */
162
+
163
+ /* Extern declarations for the forward and inverse DCT routines. */
164
+
165
+ EXTERN(void) jpeg_fdct_islow
166
+ JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
167
+ EXTERN(void) jpeg_fdct_ifast
168
+ JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
169
+ EXTERN(void) jpeg_fdct_float
170
+ JPP((FAST_FLOAT * data, JSAMPARRAY sample_data, JDIMENSION start_col));
171
+ EXTERN(void) jpeg_fdct_7x7
172
+ JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
173
+ EXTERN(void) jpeg_fdct_6x6
174
+ JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
175
+ EXTERN(void) jpeg_fdct_5x5
176
+ JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
177
+ EXTERN(void) jpeg_fdct_4x4
178
+ JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
179
+ EXTERN(void) jpeg_fdct_3x3
180
+ JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
181
+ EXTERN(void) jpeg_fdct_2x2
182
+ JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
183
+ EXTERN(void) jpeg_fdct_1x1
184
+ JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
185
+ EXTERN(void) jpeg_fdct_9x9
186
+ JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
187
+ EXTERN(void) jpeg_fdct_10x10
188
+ JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
189
+ EXTERN(void) jpeg_fdct_11x11
190
+ JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
191
+ EXTERN(void) jpeg_fdct_12x12
192
+ JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
193
+ EXTERN(void) jpeg_fdct_13x13
194
+ JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
195
+ EXTERN(void) jpeg_fdct_14x14
196
+ JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
197
+ EXTERN(void) jpeg_fdct_15x15
198
+ JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
199
+ EXTERN(void) jpeg_fdct_16x16
200
+ JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
201
+ EXTERN(void) jpeg_fdct_16x8
202
+ JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
203
+ EXTERN(void) jpeg_fdct_14x7
204
+ JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
205
+ EXTERN(void) jpeg_fdct_12x6
206
+ JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
207
+ EXTERN(void) jpeg_fdct_10x5
208
+ JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
209
+ EXTERN(void) jpeg_fdct_8x4
210
+ JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
211
+ EXTERN(void) jpeg_fdct_6x3
212
+ JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
213
+ EXTERN(void) jpeg_fdct_4x2
214
+ JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
215
+ EXTERN(void) jpeg_fdct_2x1
216
+ JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
217
+ EXTERN(void) jpeg_fdct_8x16
218
+ JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
219
+ EXTERN(void) jpeg_fdct_7x14
220
+ JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
221
+ EXTERN(void) jpeg_fdct_6x12
222
+ JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
223
+ EXTERN(void) jpeg_fdct_5x10
224
+ JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
225
+ EXTERN(void) jpeg_fdct_4x8
226
+ JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
227
+ EXTERN(void) jpeg_fdct_3x6
228
+ JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
229
+ EXTERN(void) jpeg_fdct_2x4
230
+ JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
231
+ EXTERN(void) jpeg_fdct_1x2
232
+ JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
233
+
234
+ EXTERN(void) jpeg_idct_islow
235
+ JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
236
+ JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
237
+ EXTERN(void) jpeg_idct_ifast
238
+ JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
239
+ JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
240
+ EXTERN(void) jpeg_idct_float
241
+ JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
242
+ JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
243
+ EXTERN(void) jpeg_idct_7x7
244
+ JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
245
+ JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
246
+ EXTERN(void) jpeg_idct_6x6
247
+ JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
248
+ JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
249
+ EXTERN(void) jpeg_idct_5x5
250
+ JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
251
+ JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
252
+ EXTERN(void) jpeg_idct_4x4
253
+ JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
254
+ JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
255
+ EXTERN(void) jpeg_idct_3x3
256
+ JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
257
+ JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
258
+ EXTERN(void) jpeg_idct_2x2
259
+ JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
260
+ JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
261
+ EXTERN(void) jpeg_idct_1x1
262
+ JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
263
+ JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
264
+ EXTERN(void) jpeg_idct_9x9
265
+ JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
266
+ JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
267
+ EXTERN(void) jpeg_idct_10x10
268
+ JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
269
+ JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
270
+ EXTERN(void) jpeg_idct_11x11
271
+ JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
272
+ JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
273
+ EXTERN(void) jpeg_idct_12x12
274
+ JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
275
+ JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
276
+ EXTERN(void) jpeg_idct_13x13
277
+ JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
278
+ JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
279
+ EXTERN(void) jpeg_idct_14x14
280
+ JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
281
+ JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
282
+ EXTERN(void) jpeg_idct_15x15
283
+ JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
284
+ JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
285
+ EXTERN(void) jpeg_idct_16x16
286
+ JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
287
+ JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
288
+ EXTERN(void) jpeg_idct_16x8
289
+ JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
290
+ JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
291
+ EXTERN(void) jpeg_idct_14x7
292
+ JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
293
+ JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
294
+ EXTERN(void) jpeg_idct_12x6
295
+ JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
296
+ JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
297
+ EXTERN(void) jpeg_idct_10x5
298
+ JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
299
+ JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
300
+ EXTERN(void) jpeg_idct_8x4
301
+ JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
302
+ JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
303
+ EXTERN(void) jpeg_idct_6x3
304
+ JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
305
+ JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
306
+ EXTERN(void) jpeg_idct_4x2
307
+ JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
308
+ JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
309
+ EXTERN(void) jpeg_idct_2x1
310
+ JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
311
+ JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
312
+ EXTERN(void) jpeg_idct_8x16
313
+ JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
314
+ JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
315
+ EXTERN(void) jpeg_idct_7x14
316
+ JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
317
+ JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
318
+ EXTERN(void) jpeg_idct_6x12
319
+ JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
320
+ JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
321
+ EXTERN(void) jpeg_idct_5x10
322
+ JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
323
+ JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
324
+ EXTERN(void) jpeg_idct_4x8
325
+ JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
326
+ JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
327
+ EXTERN(void) jpeg_idct_3x6
328
+ JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
329
+ JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
330
+ EXTERN(void) jpeg_idct_2x4
331
+ JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
332
+ JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
333
+ EXTERN(void) jpeg_idct_1x2
334
+ JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
335
+ JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
336
+
337
+
338
+ /*
339
+ * Macros for handling fixed-point arithmetic; these are used by many
340
+ * but not all of the DCT/IDCT modules.
341
+ *
342
+ * All values are expected to be of type INT32.
343
+ * Fractional constants are scaled left by CONST_BITS bits.
344
+ * CONST_BITS is defined within each module using these macros,
345
+ * and may differ from one module to the next.
346
+ */
347
+
348
+ #define ONE ((INT32) 1)
349
+ #define CONST_SCALE (ONE << CONST_BITS)
350
+
351
+ /* Convert a positive real constant to an integer scaled by CONST_SCALE.
352
+ * Caution: some C compilers fail to reduce "FIX(constant)" at compile time,
353
+ * thus causing a lot of useless floating-point operations at run time.
354
+ */
355
+
356
+ #define FIX(x) ((INT32) ((x) * CONST_SCALE + 0.5))
357
+
358
+ /* Descale and correctly round an INT32 value that's scaled by N bits.
359
+ * We assume RIGHT_SHIFT rounds towards minus infinity, so adding
360
+ * the fudge factor is correct for either sign of X.
361
+ */
362
+
363
+ #define DESCALE(x,n) RIGHT_SHIFT((x) + (ONE << ((n)-1)), n)
364
+
365
+ /* Multiply an INT32 variable by an INT32 constant to yield an INT32 result.
366
+ * This macro is used only when the two inputs will actually be no more than
367
+ * 16 bits wide, so that a 16x16->32 bit multiply can be used instead of a
368
+ * full 32x32 multiply. This provides a useful speedup on many machines.
369
+ * Unfortunately there is no way to specify a 16x16->32 multiply portably
370
+ * in C, but some C compilers will do the right thing if you provide the
371
+ * correct combination of casts.
372
+ */
373
+
374
+ #ifdef SHORTxSHORT_32 /* may work if 'int' is 32 bits */
375
+ #define MULTIPLY16C16(var,const) (((INT16) (var)) * ((INT16) (const)))
376
+ #endif
377
+ #ifdef SHORTxLCONST_32 /* known to work with Microsoft C 6.0 */
378
+ #define MULTIPLY16C16(var,const) (((INT16) (var)) * ((INT32) (const)))
379
+ #endif
380
+
381
+ #ifndef MULTIPLY16C16 /* default definition */
382
+ #define MULTIPLY16C16(var,const) ((var) * (const))
383
+ #endif
384
+
385
+ /* Same except both inputs are variables. */
386
+
387
+ #ifdef SHORTxSHORT_32 /* may work if 'int' is 32 bits */
388
+ #define MULTIPLY16V16(var1,var2) (((INT16) (var1)) * ((INT16) (var2)))
389
+ #endif
390
+
391
+ #ifndef MULTIPLY16V16 /* default definition */
392
+ #define MULTIPLY16V16(var1,var2) ((var1) * (var2))
393
+ #endif