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.
- data/README +1 -1
- data/Rakefile +0 -18
- data/VERSION +1 -0
- data/isbn.gemspec +290 -7
- data/lib/isbn.rb +6 -6
- data/src/gocr-0.48/.cvsignore +6 -0
- data/src/gocr-0.48/AUTHORS +7 -0
- data/src/gocr-0.48/BUGS +55 -0
- data/src/gocr-0.48/CREDITS +17 -0
- data/src/gocr-0.48/HISTORY +243 -0
- data/src/gocr-0.48/INSTALL +83 -0
- data/src/gocr-0.48/Makefile +193 -0
- data/src/gocr-0.48/Makefile.in +193 -0
- data/src/gocr-0.48/README +165 -0
- data/src/gocr-0.48/READMEde.txt +80 -0
- data/src/gocr-0.48/REMARK.txt +18 -0
- data/src/gocr-0.48/REVIEW +538 -0
- data/src/gocr-0.48/TODO +65 -0
- data/src/gocr-0.48/bin/.cvsignore +2 -0
- data/src/gocr-0.48/bin/create_db +38 -0
- data/src/gocr-0.48/bin/gocr.tcl +527 -0
- data/src/gocr-0.48/bin/gocr_chk.sh +44 -0
- data/src/gocr-0.48/configure +4689 -0
- data/src/gocr-0.48/configure.in +71 -0
- data/src/gocr-0.48/doc/.#Makefile.1.6 +39 -0
- data/src/gocr-0.48/doc/.cvsignore +2 -0
- data/src/gocr-0.48/doc/Makefile +39 -0
- data/src/gocr-0.48/doc/Makefile.in +39 -0
- data/src/gocr-0.48/doc/example.dtd +53 -0
- data/src/gocr-0.48/doc/example.xml +21 -0
- data/src/gocr-0.48/doc/examples.txt +67 -0
- data/src/gocr-0.48/doc/gocr.html +578 -0
- data/src/gocr-0.48/doc/unicode.txt +57 -0
- data/src/gocr-0.48/examples/.#Makefile.1.22 +166 -0
- data/src/gocr-0.48/examples/4x6.png +0 -0
- data/src/gocr-0.48/examples/4x6.txt +2 -0
- data/src/gocr-0.48/examples/5x7.png +0 -0
- data/src/gocr-0.48/examples/5x7.png.txt +2 -0
- data/src/gocr-0.48/examples/5x8.png +0 -0
- data/src/gocr-0.48/examples/5x8.png.txt +2 -0
- data/src/gocr-0.48/examples/Makefile +166 -0
- data/src/gocr-0.48/examples/color.fig +20 -0
- data/src/gocr-0.48/examples/ex.fig +16 -0
- data/src/gocr-0.48/examples/font.tex +22 -0
- data/src/gocr-0.48/examples/font1.tex +46 -0
- data/src/gocr-0.48/examples/font2.fig +27 -0
- data/src/gocr-0.48/examples/font_nw.tex +24 -0
- data/src/gocr-0.48/examples/handwrt1.jpg +0 -0
- data/src/gocr-0.48/examples/handwrt1.txt +10 -0
- data/src/gocr-0.48/examples/inverse.fig +20 -0
- data/src/gocr-0.48/examples/matrix.jpg +0 -0
- data/src/gocr-0.48/examples/ocr-a-subset.png +0 -0
- data/src/gocr-0.48/examples/ocr-a-subset.png.txt +4 -0
- data/src/gocr-0.48/examples/ocr-a.png +0 -0
- data/src/gocr-0.48/examples/ocr-a.txt +6 -0
- data/src/gocr-0.48/examples/ocr-b.png +0 -0
- data/src/gocr-0.48/examples/ocr-b.png.txt +4 -0
- data/src/gocr-0.48/examples/polish.tex +28 -0
- data/src/gocr-0.48/examples/rotate45.fig +14 -0
- data/src/gocr-0.48/examples/score +36 -0
- data/src/gocr-0.48/examples/text.tex +28 -0
- data/src/gocr-0.48/gocr.spec +143 -0
- data/src/gocr-0.48/gpl.html +537 -0
- data/src/gocr-0.48/include/.cvsignore +2 -0
- data/src/gocr-0.48/include/config.h +36 -0
- data/src/gocr-0.48/include/config.h.in +36 -0
- data/src/gocr-0.48/include/version.h +2 -0
- data/src/gocr-0.48/install-sh +3 -0
- data/src/gocr-0.48/make.bat +57 -0
- data/src/gocr-0.48/man/.cvsignore +2 -0
- data/src/gocr-0.48/man/Makefile +29 -0
- data/src/gocr-0.48/man/Makefile.in +29 -0
- data/src/gocr-0.48/man/man1/gocr.1 +166 -0
- data/src/gocr-0.48/src/.cvsignore +4 -0
- data/src/gocr-0.48/src/Makefile +132 -0
- data/src/gocr-0.48/src/Makefile.in +132 -0
- data/src/gocr-0.48/src/amiga.h +31 -0
- data/src/gocr-0.48/src/barcode.c +846 -0
- data/src/gocr-0.48/src/barcode.c.orig +593 -0
- data/src/gocr-0.48/src/barcode.h +11 -0
- data/src/gocr-0.48/src/box.c +372 -0
- data/src/gocr-0.48/src/database.c +462 -0
- data/src/gocr-0.48/src/detect.c +943 -0
- data/src/gocr-0.48/src/gocr.c +373 -0
- data/src/gocr-0.48/src/gocr.h +288 -0
- data/src/gocr-0.48/src/jconv.c +168 -0
- data/src/gocr-0.48/src/job.c +84 -0
- data/src/gocr-0.48/src/lines.c +350 -0
- data/src/gocr-0.48/src/list.c +334 -0
- data/src/gocr-0.48/src/list.h +90 -0
- data/src/gocr-0.48/src/ocr0.c +6756 -0
- data/src/gocr-0.48/src/ocr0.h +63 -0
- data/src/gocr-0.48/src/ocr0n.c +1475 -0
- data/src/gocr-0.48/src/ocr1.c +85 -0
- data/src/gocr-0.48/src/ocr1.h +3 -0
- data/src/gocr-0.48/src/otsu.c +289 -0
- data/src/gocr-0.48/src/otsu.h +23 -0
- data/src/gocr-0.48/src/output.c +289 -0
- data/src/gocr-0.48/src/output.h +37 -0
- data/src/gocr-0.48/src/pcx.c +153 -0
- data/src/gocr-0.48/src/pcx.h +9 -0
- data/src/gocr-0.48/src/pgm2asc.c +2893 -0
- data/src/gocr-0.48/src/pgm2asc.h +105 -0
- data/src/gocr-0.48/src/pixel.c +537 -0
- data/src/gocr-0.48/src/pnm.c +533 -0
- data/src/gocr-0.48/src/pnm.h +35 -0
- data/src/gocr-0.48/src/progress.c +87 -0
- data/src/gocr-0.48/src/progress.h +42 -0
- data/src/gocr-0.48/src/remove.c +703 -0
- data/src/gocr-0.48/src/tga.c +87 -0
- data/src/gocr-0.48/src/tga.h +6 -0
- data/src/gocr-0.48/src/unicode.c +1314 -0
- data/src/gocr-0.48/src/unicode.h +1257 -0
- data/src/jpeg-7/Makefile.am +133 -0
- data/src/jpeg-7/Makefile.in +1089 -0
- data/src/jpeg-7/README +322 -0
- data/src/jpeg-7/aclocal.m4 +8990 -0
- data/src/jpeg-7/ansi2knr.1 +36 -0
- data/src/jpeg-7/ansi2knr.c +739 -0
- data/src/jpeg-7/cderror.h +132 -0
- data/src/jpeg-7/cdjpeg.c +181 -0
- data/src/jpeg-7/cdjpeg.h +187 -0
- data/src/jpeg-7/change.log +270 -0
- data/src/jpeg-7/cjpeg.1 +325 -0
- data/src/jpeg-7/cjpeg.c +616 -0
- data/src/jpeg-7/ckconfig.c +402 -0
- data/src/jpeg-7/coderules.txt +118 -0
- data/src/jpeg-7/config.guess +1561 -0
- data/src/jpeg-7/config.sub +1686 -0
- data/src/jpeg-7/configure +17139 -0
- data/src/jpeg-7/configure.ac +317 -0
- data/src/jpeg-7/depcomp +630 -0
- data/src/jpeg-7/djpeg.1 +251 -0
- data/src/jpeg-7/djpeg.c +617 -0
- data/src/jpeg-7/example.c +433 -0
- data/src/jpeg-7/filelist.txt +215 -0
- data/src/jpeg-7/install-sh +520 -0
- data/src/jpeg-7/install.txt +1097 -0
- data/src/jpeg-7/jaricom.c +148 -0
- data/src/jpeg-7/jcapimin.c +282 -0
- data/src/jpeg-7/jcapistd.c +161 -0
- data/src/jpeg-7/jcarith.c +921 -0
- data/src/jpeg-7/jccoefct.c +453 -0
- data/src/jpeg-7/jccolor.c +459 -0
- data/src/jpeg-7/jcdctmgr.c +482 -0
- data/src/jpeg-7/jchuff.c +1612 -0
- data/src/jpeg-7/jcinit.c +65 -0
- data/src/jpeg-7/jcmainct.c +293 -0
- data/src/jpeg-7/jcmarker.c +667 -0
- data/src/jpeg-7/jcmaster.c +770 -0
- data/src/jpeg-7/jcomapi.c +106 -0
- data/src/jpeg-7/jconfig.bcc +48 -0
- data/src/jpeg-7/jconfig.cfg +45 -0
- data/src/jpeg-7/jconfig.dj +38 -0
- data/src/jpeg-7/jconfig.mac +43 -0
- data/src/jpeg-7/jconfig.manx +43 -0
- data/src/jpeg-7/jconfig.mc6 +52 -0
- data/src/jpeg-7/jconfig.sas +43 -0
- data/src/jpeg-7/jconfig.st +42 -0
- data/src/jpeg-7/jconfig.txt +155 -0
- data/src/jpeg-7/jconfig.vc +45 -0
- data/src/jpeg-7/jconfig.vms +37 -0
- data/src/jpeg-7/jconfig.wat +38 -0
- data/src/jpeg-7/jcparam.c +632 -0
- data/src/jpeg-7/jcprepct.c +358 -0
- data/src/jpeg-7/jcsample.c +545 -0
- data/src/jpeg-7/jctrans.c +381 -0
- data/src/jpeg-7/jdapimin.c +396 -0
- data/src/jpeg-7/jdapistd.c +275 -0
- data/src/jpeg-7/jdarith.c +762 -0
- data/src/jpeg-7/jdatadst.c +151 -0
- data/src/jpeg-7/jdatasrc.c +212 -0
- data/src/jpeg-7/jdcoefct.c +736 -0
- data/src/jpeg-7/jdcolor.c +396 -0
- data/src/jpeg-7/jdct.h +393 -0
- data/src/jpeg-7/jddctmgr.c +382 -0
- data/src/jpeg-7/jdhuff.c +1309 -0
- data/src/jpeg-7/jdinput.c +384 -0
- data/src/jpeg-7/jdmainct.c +512 -0
- data/src/jpeg-7/jdmarker.c +1360 -0
- data/src/jpeg-7/jdmaster.c +663 -0
- data/src/jpeg-7/jdmerge.c +400 -0
- data/src/jpeg-7/jdpostct.c +290 -0
- data/src/jpeg-7/jdsample.c +361 -0
- data/src/jpeg-7/jdtrans.c +136 -0
- data/src/jpeg-7/jerror.c +252 -0
- data/src/jpeg-7/jerror.h +304 -0
- data/src/jpeg-7/jfdctflt.c +174 -0
- data/src/jpeg-7/jfdctfst.c +230 -0
- data/src/jpeg-7/jfdctint.c +4348 -0
- data/src/jpeg-7/jidctflt.c +242 -0
- data/src/jpeg-7/jidctfst.c +368 -0
- data/src/jpeg-7/jidctint.c +5137 -0
- data/src/jpeg-7/jinclude.h +91 -0
- data/src/jpeg-7/jmemansi.c +167 -0
- data/src/jpeg-7/jmemdos.c +638 -0
- data/src/jpeg-7/jmemdosa.asm +379 -0
- data/src/jpeg-7/jmemmac.c +289 -0
- data/src/jpeg-7/jmemmgr.c +1118 -0
- data/src/jpeg-7/jmemname.c +276 -0
- data/src/jpeg-7/jmemnobs.c +109 -0
- data/src/jpeg-7/jmemsys.h +198 -0
- data/src/jpeg-7/jmorecfg.h +369 -0
- data/src/jpeg-7/jpegint.h +395 -0
- data/src/jpeg-7/jpeglib.h +1135 -0
- data/src/jpeg-7/jpegtran.1 +272 -0
- data/src/jpeg-7/jpegtran.c +546 -0
- data/src/jpeg-7/jquant1.c +856 -0
- data/src/jpeg-7/jquant2.c +1310 -0
- data/src/jpeg-7/jutils.c +179 -0
- data/src/jpeg-7/jversion.h +14 -0
- data/src/jpeg-7/libjpeg.map +4 -0
- data/src/jpeg-7/libjpeg.txt +3067 -0
- data/src/jpeg-7/ltmain.sh +8406 -0
- data/src/jpeg-7/makcjpeg.st +36 -0
- data/src/jpeg-7/makdjpeg.st +36 -0
- data/src/jpeg-7/makeadsw.vc6 +77 -0
- data/src/jpeg-7/makeasln.vc9 +33 -0
- data/src/jpeg-7/makecdep.vc6 +82 -0
- data/src/jpeg-7/makecdsp.vc6 +130 -0
- data/src/jpeg-7/makecmak.vc6 +159 -0
- data/src/jpeg-7/makecvcp.vc9 +186 -0
- data/src/jpeg-7/makeddep.vc6 +82 -0
- data/src/jpeg-7/makeddsp.vc6 +130 -0
- data/src/jpeg-7/makedmak.vc6 +159 -0
- data/src/jpeg-7/makedvcp.vc9 +186 -0
- data/src/jpeg-7/makefile.ansi +220 -0
- data/src/jpeg-7/makefile.bcc +291 -0
- data/src/jpeg-7/makefile.dj +226 -0
- data/src/jpeg-7/makefile.manx +220 -0
- data/src/jpeg-7/makefile.mc6 +255 -0
- data/src/jpeg-7/makefile.mms +224 -0
- data/src/jpeg-7/makefile.sas +258 -0
- data/src/jpeg-7/makefile.unix +234 -0
- data/src/jpeg-7/makefile.vc +217 -0
- data/src/jpeg-7/makefile.vms +142 -0
- data/src/jpeg-7/makefile.wat +239 -0
- data/src/jpeg-7/makejdep.vc6 +423 -0
- data/src/jpeg-7/makejdsp.vc6 +285 -0
- data/src/jpeg-7/makejdsw.vc6 +29 -0
- data/src/jpeg-7/makejmak.vc6 +425 -0
- data/src/jpeg-7/makejsln.vc9 +17 -0
- data/src/jpeg-7/makejvcp.vc9 +328 -0
- data/src/jpeg-7/makeproj.mac +213 -0
- data/src/jpeg-7/makerdep.vc6 +6 -0
- data/src/jpeg-7/makerdsp.vc6 +78 -0
- data/src/jpeg-7/makermak.vc6 +110 -0
- data/src/jpeg-7/makervcp.vc9 +133 -0
- data/src/jpeg-7/maketdep.vc6 +43 -0
- data/src/jpeg-7/maketdsp.vc6 +122 -0
- data/src/jpeg-7/maketmak.vc6 +131 -0
- data/src/jpeg-7/maketvcp.vc9 +178 -0
- data/src/jpeg-7/makewdep.vc6 +6 -0
- data/src/jpeg-7/makewdsp.vc6 +78 -0
- data/src/jpeg-7/makewmak.vc6 +110 -0
- data/src/jpeg-7/makewvcp.vc9 +133 -0
- data/src/jpeg-7/makljpeg.st +68 -0
- data/src/jpeg-7/maktjpeg.st +30 -0
- data/src/jpeg-7/makvms.opt +4 -0
- data/src/jpeg-7/missing +376 -0
- data/src/jpeg-7/rdbmp.c +439 -0
- data/src/jpeg-7/rdcolmap.c +253 -0
- data/src/jpeg-7/rdgif.c +38 -0
- data/src/jpeg-7/rdjpgcom.1 +63 -0
- data/src/jpeg-7/rdjpgcom.c +515 -0
- data/src/jpeg-7/rdppm.c +459 -0
- data/src/jpeg-7/rdrle.c +387 -0
- data/src/jpeg-7/rdswitch.c +365 -0
- data/src/jpeg-7/rdtarga.c +500 -0
- data/src/jpeg-7/structure.txt +945 -0
- data/src/jpeg-7/testimg.bmp +0 -0
- data/src/jpeg-7/testimg.jpg +0 -0
- data/src/jpeg-7/testimg.ppm +4 -0
- data/src/jpeg-7/testimgp.jpg +0 -0
- data/src/jpeg-7/testorig.jpg +0 -0
- data/src/jpeg-7/testprog.jpg +0 -0
- data/src/jpeg-7/transupp.c +1533 -0
- data/src/jpeg-7/transupp.h +205 -0
- data/src/jpeg-7/usage.txt +605 -0
- data/src/jpeg-7/wizard.txt +211 -0
- data/src/jpeg-7/wrbmp.c +442 -0
- data/src/jpeg-7/wrgif.c +399 -0
- data/src/jpeg-7/wrjpgcom.1 +103 -0
- data/src/jpeg-7/wrjpgcom.c +583 -0
- data/src/jpeg-7/wrppm.c +269 -0
- data/src/jpeg-7/wrrle.c +305 -0
- data/src/jpeg-7/wrtarga.c +253 -0
- metadata +287 -6
- data/LICENSE +0 -20
- data/VERSION.yml +0 -4
@@ -0,0 +1,369 @@
|
|
1
|
+
/*
|
2
|
+
* jmorecfg.h
|
3
|
+
*
|
4
|
+
* Copyright (C) 1991-1997, Thomas G. Lane.
|
5
|
+
* Modified 1997-2009 by Guido Vollbeding.
|
6
|
+
* This file is part of the Independent JPEG Group's software.
|
7
|
+
* For conditions of distribution and use, see the accompanying README file.
|
8
|
+
*
|
9
|
+
* This file contains additional configuration options that customize the
|
10
|
+
* JPEG software for special applications or support machine-dependent
|
11
|
+
* optimizations. Most users will not need to touch this file.
|
12
|
+
*/
|
13
|
+
|
14
|
+
|
15
|
+
/*
|
16
|
+
* Define BITS_IN_JSAMPLE as either
|
17
|
+
* 8 for 8-bit sample values (the usual setting)
|
18
|
+
* 12 for 12-bit sample values
|
19
|
+
* Only 8 and 12 are legal data precisions for lossy JPEG according to the
|
20
|
+
* JPEG standard, and the IJG code does not support anything else!
|
21
|
+
* We do not support run-time selection of data precision, sorry.
|
22
|
+
*/
|
23
|
+
|
24
|
+
#define BITS_IN_JSAMPLE 8 /* use 8 or 12 */
|
25
|
+
|
26
|
+
|
27
|
+
/*
|
28
|
+
* Maximum number of components (color channels) allowed in JPEG image.
|
29
|
+
* To meet the letter of the JPEG spec, set this to 255. However, darn
|
30
|
+
* few applications need more than 4 channels (maybe 5 for CMYK + alpha
|
31
|
+
* mask). We recommend 10 as a reasonable compromise; use 4 if you are
|
32
|
+
* really short on memory. (Each allowed component costs a hundred or so
|
33
|
+
* bytes of storage, whether actually used in an image or not.)
|
34
|
+
*/
|
35
|
+
|
36
|
+
#define MAX_COMPONENTS 10 /* maximum number of image components */
|
37
|
+
|
38
|
+
|
39
|
+
/*
|
40
|
+
* Basic data types.
|
41
|
+
* You may need to change these if you have a machine with unusual data
|
42
|
+
* type sizes; for example, "char" not 8 bits, "short" not 16 bits,
|
43
|
+
* or "long" not 32 bits. We don't care whether "int" is 16 or 32 bits,
|
44
|
+
* but it had better be at least 16.
|
45
|
+
*/
|
46
|
+
|
47
|
+
/* Representation of a single sample (pixel element value).
|
48
|
+
* We frequently allocate large arrays of these, so it's important to keep
|
49
|
+
* them small. But if you have memory to burn and access to char or short
|
50
|
+
* arrays is very slow on your hardware, you might want to change these.
|
51
|
+
*/
|
52
|
+
|
53
|
+
#if BITS_IN_JSAMPLE == 8
|
54
|
+
/* JSAMPLE should be the smallest type that will hold the values 0..255.
|
55
|
+
* You can use a signed char by having GETJSAMPLE mask it with 0xFF.
|
56
|
+
*/
|
57
|
+
|
58
|
+
#ifdef HAVE_UNSIGNED_CHAR
|
59
|
+
|
60
|
+
typedef unsigned char JSAMPLE;
|
61
|
+
#define GETJSAMPLE(value) ((int) (value))
|
62
|
+
|
63
|
+
#else /* not HAVE_UNSIGNED_CHAR */
|
64
|
+
|
65
|
+
typedef char JSAMPLE;
|
66
|
+
#ifdef CHAR_IS_UNSIGNED
|
67
|
+
#define GETJSAMPLE(value) ((int) (value))
|
68
|
+
#else
|
69
|
+
#define GETJSAMPLE(value) ((int) (value) & 0xFF)
|
70
|
+
#endif /* CHAR_IS_UNSIGNED */
|
71
|
+
|
72
|
+
#endif /* HAVE_UNSIGNED_CHAR */
|
73
|
+
|
74
|
+
#define MAXJSAMPLE 255
|
75
|
+
#define CENTERJSAMPLE 128
|
76
|
+
|
77
|
+
#endif /* BITS_IN_JSAMPLE == 8 */
|
78
|
+
|
79
|
+
|
80
|
+
#if BITS_IN_JSAMPLE == 12
|
81
|
+
/* JSAMPLE should be the smallest type that will hold the values 0..4095.
|
82
|
+
* On nearly all machines "short" will do nicely.
|
83
|
+
*/
|
84
|
+
|
85
|
+
typedef short JSAMPLE;
|
86
|
+
#define GETJSAMPLE(value) ((int) (value))
|
87
|
+
|
88
|
+
#define MAXJSAMPLE 4095
|
89
|
+
#define CENTERJSAMPLE 2048
|
90
|
+
|
91
|
+
#endif /* BITS_IN_JSAMPLE == 12 */
|
92
|
+
|
93
|
+
|
94
|
+
/* Representation of a DCT frequency coefficient.
|
95
|
+
* This should be a signed value of at least 16 bits; "short" is usually OK.
|
96
|
+
* Again, we allocate large arrays of these, but you can change to int
|
97
|
+
* if you have memory to burn and "short" is really slow.
|
98
|
+
*/
|
99
|
+
|
100
|
+
typedef short JCOEF;
|
101
|
+
|
102
|
+
|
103
|
+
/* Compressed datastreams are represented as arrays of JOCTET.
|
104
|
+
* These must be EXACTLY 8 bits wide, at least once they are written to
|
105
|
+
* external storage. Note that when using the stdio data source/destination
|
106
|
+
* managers, this is also the data type passed to fread/fwrite.
|
107
|
+
*/
|
108
|
+
|
109
|
+
#ifdef HAVE_UNSIGNED_CHAR
|
110
|
+
|
111
|
+
typedef unsigned char JOCTET;
|
112
|
+
#define GETJOCTET(value) (value)
|
113
|
+
|
114
|
+
#else /* not HAVE_UNSIGNED_CHAR */
|
115
|
+
|
116
|
+
typedef char JOCTET;
|
117
|
+
#ifdef CHAR_IS_UNSIGNED
|
118
|
+
#define GETJOCTET(value) (value)
|
119
|
+
#else
|
120
|
+
#define GETJOCTET(value) ((value) & 0xFF)
|
121
|
+
#endif /* CHAR_IS_UNSIGNED */
|
122
|
+
|
123
|
+
#endif /* HAVE_UNSIGNED_CHAR */
|
124
|
+
|
125
|
+
|
126
|
+
/* These typedefs are used for various table entries and so forth.
|
127
|
+
* They must be at least as wide as specified; but making them too big
|
128
|
+
* won't cost a huge amount of memory, so we don't provide special
|
129
|
+
* extraction code like we did for JSAMPLE. (In other words, these
|
130
|
+
* typedefs live at a different point on the speed/space tradeoff curve.)
|
131
|
+
*/
|
132
|
+
|
133
|
+
/* UINT8 must hold at least the values 0..255. */
|
134
|
+
|
135
|
+
#ifdef HAVE_UNSIGNED_CHAR
|
136
|
+
typedef unsigned char UINT8;
|
137
|
+
#else /* not HAVE_UNSIGNED_CHAR */
|
138
|
+
#ifdef CHAR_IS_UNSIGNED
|
139
|
+
typedef char UINT8;
|
140
|
+
#else /* not CHAR_IS_UNSIGNED */
|
141
|
+
typedef short UINT8;
|
142
|
+
#endif /* CHAR_IS_UNSIGNED */
|
143
|
+
#endif /* HAVE_UNSIGNED_CHAR */
|
144
|
+
|
145
|
+
/* UINT16 must hold at least the values 0..65535. */
|
146
|
+
|
147
|
+
#ifdef HAVE_UNSIGNED_SHORT
|
148
|
+
typedef unsigned short UINT16;
|
149
|
+
#else /* not HAVE_UNSIGNED_SHORT */
|
150
|
+
typedef unsigned int UINT16;
|
151
|
+
#endif /* HAVE_UNSIGNED_SHORT */
|
152
|
+
|
153
|
+
/* INT16 must hold at least the values -32768..32767. */
|
154
|
+
|
155
|
+
#ifndef XMD_H /* X11/xmd.h correctly defines INT16 */
|
156
|
+
typedef short INT16;
|
157
|
+
#endif
|
158
|
+
|
159
|
+
/* INT32 must hold at least signed 32-bit values. */
|
160
|
+
|
161
|
+
#ifndef XMD_H /* X11/xmd.h correctly defines INT32 */
|
162
|
+
#ifndef _BASETSD_H_ /* Microsoft defines it in basetsd.h */
|
163
|
+
#ifndef QGLOBAL_H /* Qt defines it in qglobal.h */
|
164
|
+
typedef long INT32;
|
165
|
+
#endif
|
166
|
+
#endif
|
167
|
+
#endif
|
168
|
+
|
169
|
+
/* Datatype used for image dimensions. The JPEG standard only supports
|
170
|
+
* images up to 64K*64K due to 16-bit fields in SOF markers. Therefore
|
171
|
+
* "unsigned int" is sufficient on all machines. However, if you need to
|
172
|
+
* handle larger images and you don't mind deviating from the spec, you
|
173
|
+
* can change this datatype.
|
174
|
+
*/
|
175
|
+
|
176
|
+
typedef unsigned int JDIMENSION;
|
177
|
+
|
178
|
+
#define JPEG_MAX_DIMENSION 65500L /* a tad under 64K to prevent overflows */
|
179
|
+
|
180
|
+
|
181
|
+
/* These macros are used in all function definitions and extern declarations.
|
182
|
+
* You could modify them if you need to change function linkage conventions;
|
183
|
+
* in particular, you'll need to do that to make the library a Windows DLL.
|
184
|
+
* Another application is to make all functions global for use with debuggers
|
185
|
+
* or code profilers that require it.
|
186
|
+
*/
|
187
|
+
|
188
|
+
/* a function called through method pointers: */
|
189
|
+
#define METHODDEF(type) static type
|
190
|
+
/* a function used only in its module: */
|
191
|
+
#define LOCAL(type) static type
|
192
|
+
/* a function referenced thru EXTERNs: */
|
193
|
+
#define GLOBAL(type) type
|
194
|
+
/* a reference to a GLOBAL function: */
|
195
|
+
#define EXTERN(type) extern type
|
196
|
+
|
197
|
+
|
198
|
+
/* This macro is used to declare a "method", that is, a function pointer.
|
199
|
+
* We want to supply prototype parameters if the compiler can cope.
|
200
|
+
* Note that the arglist parameter must be parenthesized!
|
201
|
+
* Again, you can customize this if you need special linkage keywords.
|
202
|
+
*/
|
203
|
+
|
204
|
+
#ifdef HAVE_PROTOTYPES
|
205
|
+
#define JMETHOD(type,methodname,arglist) type (*methodname) arglist
|
206
|
+
#else
|
207
|
+
#define JMETHOD(type,methodname,arglist) type (*methodname) ()
|
208
|
+
#endif
|
209
|
+
|
210
|
+
|
211
|
+
/* Here is the pseudo-keyword for declaring pointers that must be "far"
|
212
|
+
* on 80x86 machines. Most of the specialized coding for 80x86 is handled
|
213
|
+
* by just saying "FAR *" where such a pointer is needed. In a few places
|
214
|
+
* explicit coding is needed; see uses of the NEED_FAR_POINTERS symbol.
|
215
|
+
*/
|
216
|
+
|
217
|
+
#ifndef FAR
|
218
|
+
#ifdef NEED_FAR_POINTERS
|
219
|
+
#define FAR far
|
220
|
+
#else
|
221
|
+
#define FAR
|
222
|
+
#endif
|
223
|
+
#endif
|
224
|
+
|
225
|
+
|
226
|
+
/*
|
227
|
+
* On a few systems, type boolean and/or its values FALSE, TRUE may appear
|
228
|
+
* in standard header files. Or you may have conflicts with application-
|
229
|
+
* specific header files that you want to include together with these files.
|
230
|
+
* Defining HAVE_BOOLEAN before including jpeglib.h should make it work.
|
231
|
+
*/
|
232
|
+
|
233
|
+
#ifndef HAVE_BOOLEAN
|
234
|
+
typedef int boolean;
|
235
|
+
#endif
|
236
|
+
#ifndef FALSE /* in case these macros already exist */
|
237
|
+
#define FALSE 0 /* values of boolean */
|
238
|
+
#endif
|
239
|
+
#ifndef TRUE
|
240
|
+
#define TRUE 1
|
241
|
+
#endif
|
242
|
+
|
243
|
+
|
244
|
+
/*
|
245
|
+
* The remaining options affect code selection within the JPEG library,
|
246
|
+
* but they don't need to be visible to most applications using the library.
|
247
|
+
* To minimize application namespace pollution, the symbols won't be
|
248
|
+
* defined unless JPEG_INTERNALS or JPEG_INTERNAL_OPTIONS has been defined.
|
249
|
+
*/
|
250
|
+
|
251
|
+
#ifdef JPEG_INTERNALS
|
252
|
+
#define JPEG_INTERNAL_OPTIONS
|
253
|
+
#endif
|
254
|
+
|
255
|
+
#ifdef JPEG_INTERNAL_OPTIONS
|
256
|
+
|
257
|
+
|
258
|
+
/*
|
259
|
+
* These defines indicate whether to include various optional functions.
|
260
|
+
* Undefining some of these symbols will produce a smaller but less capable
|
261
|
+
* library. Note that you can leave certain source files out of the
|
262
|
+
* compilation/linking process if you've #undef'd the corresponding symbols.
|
263
|
+
* (You may HAVE to do that if your compiler doesn't like null source files.)
|
264
|
+
*/
|
265
|
+
|
266
|
+
/* Capability options common to encoder and decoder: */
|
267
|
+
|
268
|
+
#define DCT_ISLOW_SUPPORTED /* slow but accurate integer algorithm */
|
269
|
+
#define DCT_IFAST_SUPPORTED /* faster, less accurate integer method */
|
270
|
+
#define DCT_FLOAT_SUPPORTED /* floating-point: accurate, fast on fast HW */
|
271
|
+
|
272
|
+
/* Encoder capability options: */
|
273
|
+
|
274
|
+
#define C_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */
|
275
|
+
#define C_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */
|
276
|
+
#define C_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/
|
277
|
+
#define DCT_SCALING_SUPPORTED /* Input rescaling via DCT? (Requires DCT_ISLOW)*/
|
278
|
+
#define ENTROPY_OPT_SUPPORTED /* Optimization of entropy coding parms? */
|
279
|
+
/* Note: if you selected 12-bit data precision, it is dangerous to turn off
|
280
|
+
* ENTROPY_OPT_SUPPORTED. The standard Huffman tables are only good for 8-bit
|
281
|
+
* precision, so jchuff.c normally uses entropy optimization to compute
|
282
|
+
* usable tables for higher precision. If you don't want to do optimization,
|
283
|
+
* you'll have to supply different default Huffman tables.
|
284
|
+
* The exact same statements apply for progressive JPEG: the default tables
|
285
|
+
* don't work for progressive mode. (This may get fixed, however.)
|
286
|
+
*/
|
287
|
+
#define INPUT_SMOOTHING_SUPPORTED /* Input image smoothing option? */
|
288
|
+
|
289
|
+
/* Decoder capability options: */
|
290
|
+
|
291
|
+
#define D_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */
|
292
|
+
#define D_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */
|
293
|
+
#define D_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/
|
294
|
+
#define IDCT_SCALING_SUPPORTED /* Output rescaling via IDCT? */
|
295
|
+
#define SAVE_MARKERS_SUPPORTED /* jpeg_save_markers() needed? */
|
296
|
+
#define BLOCK_SMOOTHING_SUPPORTED /* Block smoothing? (Progressive only) */
|
297
|
+
#undef UPSAMPLE_SCALING_SUPPORTED /* Output rescaling at upsample stage? */
|
298
|
+
#define UPSAMPLE_MERGING_SUPPORTED /* Fast path for sloppy upsampling? */
|
299
|
+
#define QUANT_1PASS_SUPPORTED /* 1-pass color quantization? */
|
300
|
+
#define QUANT_2PASS_SUPPORTED /* 2-pass color quantization? */
|
301
|
+
|
302
|
+
/* more capability options later, no doubt */
|
303
|
+
|
304
|
+
|
305
|
+
/*
|
306
|
+
* Ordering of RGB data in scanlines passed to or from the application.
|
307
|
+
* If your application wants to deal with data in the order B,G,R, just
|
308
|
+
* change these macros. You can also deal with formats such as R,G,B,X
|
309
|
+
* (one extra byte per pixel) by changing RGB_PIXELSIZE. Note that changing
|
310
|
+
* the offsets will also change the order in which colormap data is organized.
|
311
|
+
* RESTRICTIONS:
|
312
|
+
* 1. The sample applications cjpeg,djpeg do NOT support modified RGB formats.
|
313
|
+
* 2. These macros only affect RGB<=>YCbCr color conversion, so they are not
|
314
|
+
* useful if you are using JPEG color spaces other than YCbCr or grayscale.
|
315
|
+
* 3. The color quantizer modules will not behave desirably if RGB_PIXELSIZE
|
316
|
+
* is not 3 (they don't understand about dummy color components!). So you
|
317
|
+
* can't use color quantization if you change that value.
|
318
|
+
*/
|
319
|
+
|
320
|
+
#define RGB_RED 0 /* Offset of Red in an RGB scanline element */
|
321
|
+
#define RGB_GREEN 1 /* Offset of Green */
|
322
|
+
#define RGB_BLUE 2 /* Offset of Blue */
|
323
|
+
#define RGB_PIXELSIZE 3 /* JSAMPLEs per RGB scanline element */
|
324
|
+
|
325
|
+
|
326
|
+
/* Definitions for speed-related optimizations. */
|
327
|
+
|
328
|
+
|
329
|
+
/* If your compiler supports inline functions, define INLINE
|
330
|
+
* as the inline keyword; otherwise define it as empty.
|
331
|
+
*/
|
332
|
+
|
333
|
+
#ifndef INLINE
|
334
|
+
#ifdef __GNUC__ /* for instance, GNU C knows about inline */
|
335
|
+
#define INLINE __inline__
|
336
|
+
#endif
|
337
|
+
#ifndef INLINE
|
338
|
+
#define INLINE /* default is to define it as empty */
|
339
|
+
#endif
|
340
|
+
#endif
|
341
|
+
|
342
|
+
|
343
|
+
/* On some machines (notably 68000 series) "int" is 32 bits, but multiplying
|
344
|
+
* two 16-bit shorts is faster than multiplying two ints. Define MULTIPLIER
|
345
|
+
* as short on such a machine. MULTIPLIER must be at least 16 bits wide.
|
346
|
+
*/
|
347
|
+
|
348
|
+
#ifndef MULTIPLIER
|
349
|
+
#define MULTIPLIER int /* type for fastest integer multiply */
|
350
|
+
#endif
|
351
|
+
|
352
|
+
|
353
|
+
/* FAST_FLOAT should be either float or double, whichever is done faster
|
354
|
+
* by your compiler. (Note that this type is only used in the floating point
|
355
|
+
* DCT routines, so it only matters if you've defined DCT_FLOAT_SUPPORTED.)
|
356
|
+
* Typically, float is faster in ANSI C compilers, while double is faster in
|
357
|
+
* pre-ANSI compilers (because they insist on converting to double anyway).
|
358
|
+
* The code below therefore chooses float if we have ANSI-style prototypes.
|
359
|
+
*/
|
360
|
+
|
361
|
+
#ifndef FAST_FLOAT
|
362
|
+
#ifdef HAVE_PROTOTYPES
|
363
|
+
#define FAST_FLOAT float
|
364
|
+
#else
|
365
|
+
#define FAST_FLOAT double
|
366
|
+
#endif
|
367
|
+
#endif
|
368
|
+
|
369
|
+
#endif /* JPEG_INTERNAL_OPTIONS */
|
@@ -0,0 +1,395 @@
|
|
1
|
+
/*
|
2
|
+
* jpegint.h
|
3
|
+
*
|
4
|
+
* Copyright (C) 1991-1997, Thomas G. Lane.
|
5
|
+
* Modified 1997-2009 by Guido Vollbeding.
|
6
|
+
* This file is part of the Independent JPEG Group's software.
|
7
|
+
* For conditions of distribution and use, see the accompanying README file.
|
8
|
+
*
|
9
|
+
* This file provides common declarations for the various JPEG modules.
|
10
|
+
* These declarations are considered internal to the JPEG library; most
|
11
|
+
* applications using the library shouldn't need to include this file.
|
12
|
+
*/
|
13
|
+
|
14
|
+
|
15
|
+
/* Declarations for both compression & decompression */
|
16
|
+
|
17
|
+
typedef enum { /* Operating modes for buffer controllers */
|
18
|
+
JBUF_PASS_THRU, /* Plain stripwise operation */
|
19
|
+
/* Remaining modes require a full-image buffer to have been created */
|
20
|
+
JBUF_SAVE_SOURCE, /* Run source subobject only, save output */
|
21
|
+
JBUF_CRANK_DEST, /* Run dest subobject only, using saved data */
|
22
|
+
JBUF_SAVE_AND_PASS /* Run both subobjects, save output */
|
23
|
+
} J_BUF_MODE;
|
24
|
+
|
25
|
+
/* Values of global_state field (jdapi.c has some dependencies on ordering!) */
|
26
|
+
#define CSTATE_START 100 /* after create_compress */
|
27
|
+
#define CSTATE_SCANNING 101 /* start_compress done, write_scanlines OK */
|
28
|
+
#define CSTATE_RAW_OK 102 /* start_compress done, write_raw_data OK */
|
29
|
+
#define CSTATE_WRCOEFS 103 /* jpeg_write_coefficients done */
|
30
|
+
#define DSTATE_START 200 /* after create_decompress */
|
31
|
+
#define DSTATE_INHEADER 201 /* reading header markers, no SOS yet */
|
32
|
+
#define DSTATE_READY 202 /* found SOS, ready for start_decompress */
|
33
|
+
#define DSTATE_PRELOAD 203 /* reading multiscan file in start_decompress*/
|
34
|
+
#define DSTATE_PRESCAN 204 /* performing dummy pass for 2-pass quant */
|
35
|
+
#define DSTATE_SCANNING 205 /* start_decompress done, read_scanlines OK */
|
36
|
+
#define DSTATE_RAW_OK 206 /* start_decompress done, read_raw_data OK */
|
37
|
+
#define DSTATE_BUFIMAGE 207 /* expecting jpeg_start_output */
|
38
|
+
#define DSTATE_BUFPOST 208 /* looking for SOS/EOI in jpeg_finish_output */
|
39
|
+
#define DSTATE_RDCOEFS 209 /* reading file in jpeg_read_coefficients */
|
40
|
+
#define DSTATE_STOPPING 210 /* looking for EOI in jpeg_finish_decompress */
|
41
|
+
|
42
|
+
|
43
|
+
/* Declarations for compression modules */
|
44
|
+
|
45
|
+
/* Master control module */
|
46
|
+
struct jpeg_comp_master {
|
47
|
+
JMETHOD(void, prepare_for_pass, (j_compress_ptr cinfo));
|
48
|
+
JMETHOD(void, pass_startup, (j_compress_ptr cinfo));
|
49
|
+
JMETHOD(void, finish_pass, (j_compress_ptr cinfo));
|
50
|
+
|
51
|
+
/* State variables made visible to other modules */
|
52
|
+
boolean call_pass_startup; /* True if pass_startup must be called */
|
53
|
+
boolean is_last_pass; /* True during last pass */
|
54
|
+
};
|
55
|
+
|
56
|
+
/* Main buffer control (downsampled-data buffer) */
|
57
|
+
struct jpeg_c_main_controller {
|
58
|
+
JMETHOD(void, start_pass, (j_compress_ptr cinfo, J_BUF_MODE pass_mode));
|
59
|
+
JMETHOD(void, process_data, (j_compress_ptr cinfo,
|
60
|
+
JSAMPARRAY input_buf, JDIMENSION *in_row_ctr,
|
61
|
+
JDIMENSION in_rows_avail));
|
62
|
+
};
|
63
|
+
|
64
|
+
/* Compression preprocessing (downsampling input buffer control) */
|
65
|
+
struct jpeg_c_prep_controller {
|
66
|
+
JMETHOD(void, start_pass, (j_compress_ptr cinfo, J_BUF_MODE pass_mode));
|
67
|
+
JMETHOD(void, pre_process_data, (j_compress_ptr cinfo,
|
68
|
+
JSAMPARRAY input_buf,
|
69
|
+
JDIMENSION *in_row_ctr,
|
70
|
+
JDIMENSION in_rows_avail,
|
71
|
+
JSAMPIMAGE output_buf,
|
72
|
+
JDIMENSION *out_row_group_ctr,
|
73
|
+
JDIMENSION out_row_groups_avail));
|
74
|
+
};
|
75
|
+
|
76
|
+
/* Coefficient buffer control */
|
77
|
+
struct jpeg_c_coef_controller {
|
78
|
+
JMETHOD(void, start_pass, (j_compress_ptr cinfo, J_BUF_MODE pass_mode));
|
79
|
+
JMETHOD(boolean, compress_data, (j_compress_ptr cinfo,
|
80
|
+
JSAMPIMAGE input_buf));
|
81
|
+
};
|
82
|
+
|
83
|
+
/* Colorspace conversion */
|
84
|
+
struct jpeg_color_converter {
|
85
|
+
JMETHOD(void, start_pass, (j_compress_ptr cinfo));
|
86
|
+
JMETHOD(void, color_convert, (j_compress_ptr cinfo,
|
87
|
+
JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
|
88
|
+
JDIMENSION output_row, int num_rows));
|
89
|
+
};
|
90
|
+
|
91
|
+
/* Downsampling */
|
92
|
+
struct jpeg_downsampler {
|
93
|
+
JMETHOD(void, start_pass, (j_compress_ptr cinfo));
|
94
|
+
JMETHOD(void, downsample, (j_compress_ptr cinfo,
|
95
|
+
JSAMPIMAGE input_buf, JDIMENSION in_row_index,
|
96
|
+
JSAMPIMAGE output_buf,
|
97
|
+
JDIMENSION out_row_group_index));
|
98
|
+
|
99
|
+
boolean need_context_rows; /* TRUE if need rows above & below */
|
100
|
+
};
|
101
|
+
|
102
|
+
/* Forward DCT (also controls coefficient quantization) */
|
103
|
+
typedef JMETHOD(void, forward_DCT_ptr,
|
104
|
+
(j_compress_ptr cinfo, jpeg_component_info * compptr,
|
105
|
+
JSAMPARRAY sample_data, JBLOCKROW coef_blocks,
|
106
|
+
JDIMENSION start_row, JDIMENSION start_col,
|
107
|
+
JDIMENSION num_blocks));
|
108
|
+
|
109
|
+
struct jpeg_forward_dct {
|
110
|
+
JMETHOD(void, start_pass, (j_compress_ptr cinfo));
|
111
|
+
/* It is useful to allow each component to have a separate FDCT method. */
|
112
|
+
forward_DCT_ptr forward_DCT[MAX_COMPONENTS];
|
113
|
+
};
|
114
|
+
|
115
|
+
/* Entropy encoding */
|
116
|
+
struct jpeg_entropy_encoder {
|
117
|
+
JMETHOD(void, start_pass, (j_compress_ptr cinfo, boolean gather_statistics));
|
118
|
+
JMETHOD(boolean, encode_mcu, (j_compress_ptr cinfo, JBLOCKROW *MCU_data));
|
119
|
+
JMETHOD(void, finish_pass, (j_compress_ptr cinfo));
|
120
|
+
};
|
121
|
+
|
122
|
+
/* Marker writing */
|
123
|
+
struct jpeg_marker_writer {
|
124
|
+
JMETHOD(void, write_file_header, (j_compress_ptr cinfo));
|
125
|
+
JMETHOD(void, write_frame_header, (j_compress_ptr cinfo));
|
126
|
+
JMETHOD(void, write_scan_header, (j_compress_ptr cinfo));
|
127
|
+
JMETHOD(void, write_file_trailer, (j_compress_ptr cinfo));
|
128
|
+
JMETHOD(void, write_tables_only, (j_compress_ptr cinfo));
|
129
|
+
/* These routines are exported to allow insertion of extra markers */
|
130
|
+
/* Probably only COM and APPn markers should be written this way */
|
131
|
+
JMETHOD(void, write_marker_header, (j_compress_ptr cinfo, int marker,
|
132
|
+
unsigned int datalen));
|
133
|
+
JMETHOD(void, write_marker_byte, (j_compress_ptr cinfo, int val));
|
134
|
+
};
|
135
|
+
|
136
|
+
|
137
|
+
/* Declarations for decompression modules */
|
138
|
+
|
139
|
+
/* Master control module */
|
140
|
+
struct jpeg_decomp_master {
|
141
|
+
JMETHOD(void, prepare_for_output_pass, (j_decompress_ptr cinfo));
|
142
|
+
JMETHOD(void, finish_output_pass, (j_decompress_ptr cinfo));
|
143
|
+
|
144
|
+
/* State variables made visible to other modules */
|
145
|
+
boolean is_dummy_pass; /* True during 1st pass for 2-pass quant */
|
146
|
+
};
|
147
|
+
|
148
|
+
/* Input control module */
|
149
|
+
struct jpeg_input_controller {
|
150
|
+
JMETHOD(int, consume_input, (j_decompress_ptr cinfo));
|
151
|
+
JMETHOD(void, reset_input_controller, (j_decompress_ptr cinfo));
|
152
|
+
JMETHOD(void, start_input_pass, (j_decompress_ptr cinfo));
|
153
|
+
JMETHOD(void, finish_input_pass, (j_decompress_ptr cinfo));
|
154
|
+
|
155
|
+
/* State variables made visible to other modules */
|
156
|
+
boolean has_multiple_scans; /* True if file has multiple scans */
|
157
|
+
boolean eoi_reached; /* True when EOI has been consumed */
|
158
|
+
};
|
159
|
+
|
160
|
+
/* Main buffer control (downsampled-data buffer) */
|
161
|
+
struct jpeg_d_main_controller {
|
162
|
+
JMETHOD(void, start_pass, (j_decompress_ptr cinfo, J_BUF_MODE pass_mode));
|
163
|
+
JMETHOD(void, process_data, (j_decompress_ptr cinfo,
|
164
|
+
JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
|
165
|
+
JDIMENSION out_rows_avail));
|
166
|
+
};
|
167
|
+
|
168
|
+
/* Coefficient buffer control */
|
169
|
+
struct jpeg_d_coef_controller {
|
170
|
+
JMETHOD(void, start_input_pass, (j_decompress_ptr cinfo));
|
171
|
+
JMETHOD(int, consume_data, (j_decompress_ptr cinfo));
|
172
|
+
JMETHOD(void, start_output_pass, (j_decompress_ptr cinfo));
|
173
|
+
JMETHOD(int, decompress_data, (j_decompress_ptr cinfo,
|
174
|
+
JSAMPIMAGE output_buf));
|
175
|
+
/* Pointer to array of coefficient virtual arrays, or NULL if none */
|
176
|
+
jvirt_barray_ptr *coef_arrays;
|
177
|
+
};
|
178
|
+
|
179
|
+
/* Decompression postprocessing (color quantization buffer control) */
|
180
|
+
struct jpeg_d_post_controller {
|
181
|
+
JMETHOD(void, start_pass, (j_decompress_ptr cinfo, J_BUF_MODE pass_mode));
|
182
|
+
JMETHOD(void, post_process_data, (j_decompress_ptr cinfo,
|
183
|
+
JSAMPIMAGE input_buf,
|
184
|
+
JDIMENSION *in_row_group_ctr,
|
185
|
+
JDIMENSION in_row_groups_avail,
|
186
|
+
JSAMPARRAY output_buf,
|
187
|
+
JDIMENSION *out_row_ctr,
|
188
|
+
JDIMENSION out_rows_avail));
|
189
|
+
};
|
190
|
+
|
191
|
+
/* Marker reading & parsing */
|
192
|
+
struct jpeg_marker_reader {
|
193
|
+
JMETHOD(void, reset_marker_reader, (j_decompress_ptr cinfo));
|
194
|
+
/* Read markers until SOS or EOI.
|
195
|
+
* Returns same codes as are defined for jpeg_consume_input:
|
196
|
+
* JPEG_SUSPENDED, JPEG_REACHED_SOS, or JPEG_REACHED_EOI.
|
197
|
+
*/
|
198
|
+
JMETHOD(int, read_markers, (j_decompress_ptr cinfo));
|
199
|
+
/* Read a restart marker --- exported for use by entropy decoder only */
|
200
|
+
jpeg_marker_parser_method read_restart_marker;
|
201
|
+
|
202
|
+
/* State of marker reader --- nominally internal, but applications
|
203
|
+
* supplying COM or APPn handlers might like to know the state.
|
204
|
+
*/
|
205
|
+
boolean saw_SOI; /* found SOI? */
|
206
|
+
boolean saw_SOF; /* found SOF? */
|
207
|
+
int next_restart_num; /* next restart number expected (0-7) */
|
208
|
+
unsigned int discarded_bytes; /* # of bytes skipped looking for a marker */
|
209
|
+
};
|
210
|
+
|
211
|
+
/* Entropy decoding */
|
212
|
+
struct jpeg_entropy_decoder {
|
213
|
+
JMETHOD(void, start_pass, (j_decompress_ptr cinfo));
|
214
|
+
JMETHOD(boolean, decode_mcu, (j_decompress_ptr cinfo,
|
215
|
+
JBLOCKROW *MCU_data));
|
216
|
+
|
217
|
+
/* This is here to share code between baseline and progressive decoders; */
|
218
|
+
/* other modules probably should not use it */
|
219
|
+
boolean insufficient_data; /* set TRUE after emitting warning */
|
220
|
+
};
|
221
|
+
|
222
|
+
/* Inverse DCT (also performs dequantization) */
|
223
|
+
typedef JMETHOD(void, inverse_DCT_method_ptr,
|
224
|
+
(j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
225
|
+
JCOEFPTR coef_block,
|
226
|
+
JSAMPARRAY output_buf, JDIMENSION output_col));
|
227
|
+
|
228
|
+
struct jpeg_inverse_dct {
|
229
|
+
JMETHOD(void, start_pass, (j_decompress_ptr cinfo));
|
230
|
+
/* It is useful to allow each component to have a separate IDCT method. */
|
231
|
+
inverse_DCT_method_ptr inverse_DCT[MAX_COMPONENTS];
|
232
|
+
};
|
233
|
+
|
234
|
+
/* Upsampling (note that upsampler must also call color converter) */
|
235
|
+
struct jpeg_upsampler {
|
236
|
+
JMETHOD(void, start_pass, (j_decompress_ptr cinfo));
|
237
|
+
JMETHOD(void, upsample, (j_decompress_ptr cinfo,
|
238
|
+
JSAMPIMAGE input_buf,
|
239
|
+
JDIMENSION *in_row_group_ctr,
|
240
|
+
JDIMENSION in_row_groups_avail,
|
241
|
+
JSAMPARRAY output_buf,
|
242
|
+
JDIMENSION *out_row_ctr,
|
243
|
+
JDIMENSION out_rows_avail));
|
244
|
+
|
245
|
+
boolean need_context_rows; /* TRUE if need rows above & below */
|
246
|
+
};
|
247
|
+
|
248
|
+
/* Colorspace conversion */
|
249
|
+
struct jpeg_color_deconverter {
|
250
|
+
JMETHOD(void, start_pass, (j_decompress_ptr cinfo));
|
251
|
+
JMETHOD(void, color_convert, (j_decompress_ptr cinfo,
|
252
|
+
JSAMPIMAGE input_buf, JDIMENSION input_row,
|
253
|
+
JSAMPARRAY output_buf, int num_rows));
|
254
|
+
};
|
255
|
+
|
256
|
+
/* Color quantization or color precision reduction */
|
257
|
+
struct jpeg_color_quantizer {
|
258
|
+
JMETHOD(void, start_pass, (j_decompress_ptr cinfo, boolean is_pre_scan));
|
259
|
+
JMETHOD(void, color_quantize, (j_decompress_ptr cinfo,
|
260
|
+
JSAMPARRAY input_buf, JSAMPARRAY output_buf,
|
261
|
+
int num_rows));
|
262
|
+
JMETHOD(void, finish_pass, (j_decompress_ptr cinfo));
|
263
|
+
JMETHOD(void, new_color_map, (j_decompress_ptr cinfo));
|
264
|
+
};
|
265
|
+
|
266
|
+
|
267
|
+
/* Miscellaneous useful macros */
|
268
|
+
|
269
|
+
#undef MAX
|
270
|
+
#define MAX(a,b) ((a) > (b) ? (a) : (b))
|
271
|
+
#undef MIN
|
272
|
+
#define MIN(a,b) ((a) < (b) ? (a) : (b))
|
273
|
+
|
274
|
+
|
275
|
+
/* We assume that right shift corresponds to signed division by 2 with
|
276
|
+
* rounding towards minus infinity. This is correct for typical "arithmetic
|
277
|
+
* shift" instructions that shift in copies of the sign bit. But some
|
278
|
+
* C compilers implement >> with an unsigned shift. For these machines you
|
279
|
+
* must define RIGHT_SHIFT_IS_UNSIGNED.
|
280
|
+
* RIGHT_SHIFT provides a proper signed right shift of an INT32 quantity.
|
281
|
+
* It is only applied with constant shift counts. SHIFT_TEMPS must be
|
282
|
+
* included in the variables of any routine using RIGHT_SHIFT.
|
283
|
+
*/
|
284
|
+
|
285
|
+
#ifdef RIGHT_SHIFT_IS_UNSIGNED
|
286
|
+
#define SHIFT_TEMPS INT32 shift_temp;
|
287
|
+
#define RIGHT_SHIFT(x,shft) \
|
288
|
+
((shift_temp = (x)) < 0 ? \
|
289
|
+
(shift_temp >> (shft)) | ((~((INT32) 0)) << (32-(shft))) : \
|
290
|
+
(shift_temp >> (shft)))
|
291
|
+
#else
|
292
|
+
#define SHIFT_TEMPS
|
293
|
+
#define RIGHT_SHIFT(x,shft) ((x) >> (shft))
|
294
|
+
#endif
|
295
|
+
|
296
|
+
|
297
|
+
/* Short forms of external names for systems with brain-damaged linkers. */
|
298
|
+
|
299
|
+
#ifdef NEED_SHORT_EXTERNAL_NAMES
|
300
|
+
#define jinit_compress_master jICompress
|
301
|
+
#define jinit_c_master_control jICMaster
|
302
|
+
#define jinit_c_main_controller jICMainC
|
303
|
+
#define jinit_c_prep_controller jICPrepC
|
304
|
+
#define jinit_c_coef_controller jICCoefC
|
305
|
+
#define jinit_color_converter jICColor
|
306
|
+
#define jinit_downsampler jIDownsampler
|
307
|
+
#define jinit_forward_dct jIFDCT
|
308
|
+
#define jinit_huff_encoder jIHEncoder
|
309
|
+
#define jinit_arith_encoder jIAEncoder
|
310
|
+
#define jinit_marker_writer jIMWriter
|
311
|
+
#define jinit_master_decompress jIDMaster
|
312
|
+
#define jinit_d_main_controller jIDMainC
|
313
|
+
#define jinit_d_coef_controller jIDCoefC
|
314
|
+
#define jinit_d_post_controller jIDPostC
|
315
|
+
#define jinit_input_controller jIInCtlr
|
316
|
+
#define jinit_marker_reader jIMReader
|
317
|
+
#define jinit_huff_decoder jIHDecoder
|
318
|
+
#define jinit_arith_decoder jIADecoder
|
319
|
+
#define jinit_inverse_dct jIIDCT
|
320
|
+
#define jinit_upsampler jIUpsampler
|
321
|
+
#define jinit_color_deconverter jIDColor
|
322
|
+
#define jinit_1pass_quantizer jI1Quant
|
323
|
+
#define jinit_2pass_quantizer jI2Quant
|
324
|
+
#define jinit_merged_upsampler jIMUpsampler
|
325
|
+
#define jinit_memory_mgr jIMemMgr
|
326
|
+
#define jdiv_round_up jDivRound
|
327
|
+
#define jround_up jRound
|
328
|
+
#define jcopy_sample_rows jCopySamples
|
329
|
+
#define jcopy_block_row jCopyBlocks
|
330
|
+
#define jzero_far jZeroFar
|
331
|
+
#define jpeg_zigzag_order jZIGTable
|
332
|
+
#define jpeg_natural_order jZAGTable
|
333
|
+
#endif /* NEED_SHORT_EXTERNAL_NAMES */
|
334
|
+
|
335
|
+
|
336
|
+
/* Compression module initialization routines */
|
337
|
+
EXTERN(void) jinit_compress_master JPP((j_compress_ptr cinfo));
|
338
|
+
EXTERN(void) jinit_c_master_control JPP((j_compress_ptr cinfo,
|
339
|
+
boolean transcode_only));
|
340
|
+
EXTERN(void) jinit_c_main_controller JPP((j_compress_ptr cinfo,
|
341
|
+
boolean need_full_buffer));
|
342
|
+
EXTERN(void) jinit_c_prep_controller JPP((j_compress_ptr cinfo,
|
343
|
+
boolean need_full_buffer));
|
344
|
+
EXTERN(void) jinit_c_coef_controller JPP((j_compress_ptr cinfo,
|
345
|
+
boolean need_full_buffer));
|
346
|
+
EXTERN(void) jinit_color_converter JPP((j_compress_ptr cinfo));
|
347
|
+
EXTERN(void) jinit_downsampler JPP((j_compress_ptr cinfo));
|
348
|
+
EXTERN(void) jinit_forward_dct JPP((j_compress_ptr cinfo));
|
349
|
+
EXTERN(void) jinit_huff_encoder JPP((j_compress_ptr cinfo));
|
350
|
+
EXTERN(void) jinit_arith_encoder JPP((j_compress_ptr cinfo));
|
351
|
+
EXTERN(void) jinit_marker_writer JPP((j_compress_ptr cinfo));
|
352
|
+
/* Decompression module initialization routines */
|
353
|
+
EXTERN(void) jinit_master_decompress JPP((j_decompress_ptr cinfo));
|
354
|
+
EXTERN(void) jinit_d_main_controller JPP((j_decompress_ptr cinfo,
|
355
|
+
boolean need_full_buffer));
|
356
|
+
EXTERN(void) jinit_d_coef_controller JPP((j_decompress_ptr cinfo,
|
357
|
+
boolean need_full_buffer));
|
358
|
+
EXTERN(void) jinit_d_post_controller JPP((j_decompress_ptr cinfo,
|
359
|
+
boolean need_full_buffer));
|
360
|
+
EXTERN(void) jinit_input_controller JPP((j_decompress_ptr cinfo));
|
361
|
+
EXTERN(void) jinit_marker_reader JPP((j_decompress_ptr cinfo));
|
362
|
+
EXTERN(void) jinit_huff_decoder JPP((j_decompress_ptr cinfo));
|
363
|
+
EXTERN(void) jinit_arith_decoder JPP((j_decompress_ptr cinfo));
|
364
|
+
EXTERN(void) jinit_inverse_dct JPP((j_decompress_ptr cinfo));
|
365
|
+
EXTERN(void) jinit_upsampler JPP((j_decompress_ptr cinfo));
|
366
|
+
EXTERN(void) jinit_color_deconverter JPP((j_decompress_ptr cinfo));
|
367
|
+
EXTERN(void) jinit_1pass_quantizer JPP((j_decompress_ptr cinfo));
|
368
|
+
EXTERN(void) jinit_2pass_quantizer JPP((j_decompress_ptr cinfo));
|
369
|
+
EXTERN(void) jinit_merged_upsampler JPP((j_decompress_ptr cinfo));
|
370
|
+
/* Memory manager initialization */
|
371
|
+
EXTERN(void) jinit_memory_mgr JPP((j_common_ptr cinfo));
|
372
|
+
|
373
|
+
/* Utility routines in jutils.c */
|
374
|
+
EXTERN(long) jdiv_round_up JPP((long a, long b));
|
375
|
+
EXTERN(long) jround_up JPP((long a, long b));
|
376
|
+
EXTERN(void) jcopy_sample_rows JPP((JSAMPARRAY input_array, int source_row,
|
377
|
+
JSAMPARRAY output_array, int dest_row,
|
378
|
+
int num_rows, JDIMENSION num_cols));
|
379
|
+
EXTERN(void) jcopy_block_row JPP((JBLOCKROW input_row, JBLOCKROW output_row,
|
380
|
+
JDIMENSION num_blocks));
|
381
|
+
EXTERN(void) jzero_far JPP((void FAR * target, size_t bytestozero));
|
382
|
+
/* Constant tables in jutils.c */
|
383
|
+
#if 0 /* This table is not actually needed in v6a */
|
384
|
+
extern const int jpeg_zigzag_order[]; /* natural coef order to zigzag order */
|
385
|
+
#endif
|
386
|
+
extern const int jpeg_natural_order[]; /* zigzag coef order to natural order */
|
387
|
+
|
388
|
+
/* Suppress undefined-structure complaints if necessary. */
|
389
|
+
|
390
|
+
#ifdef INCOMPLETE_TYPES_BROKEN
|
391
|
+
#ifndef AM_MEMORY_MANAGER /* only jmemmgr.c defines these */
|
392
|
+
struct jvirt_sarray_control { long dummy; };
|
393
|
+
struct jvirt_barray_control { long dummy; };
|
394
|
+
#endif
|
395
|
+
#endif /* INCOMPLETE_TYPES_BROKEN */
|