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,148 @@
|
|
1
|
+
/*
|
2
|
+
* jaricom.c
|
3
|
+
*
|
4
|
+
* Developed 1997 by Guido Vollbeding.
|
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 probability estimation tables for common use in
|
9
|
+
* arithmetic entropy encoding and decoding routines.
|
10
|
+
*
|
11
|
+
* This data represents Table D.2 in the JPEG spec (ISO/IEC IS 10918-1
|
12
|
+
* and CCITT Recommendation ITU-T T.81) and Table 24 in the JBIG spec
|
13
|
+
* (ISO/IEC IS 11544 and CCITT Recommendation ITU-T T.82).
|
14
|
+
*/
|
15
|
+
|
16
|
+
#define JPEG_INTERNALS
|
17
|
+
#include "jinclude.h"
|
18
|
+
#include "jpeglib.h"
|
19
|
+
|
20
|
+
/* The following #define specifies the packing of the four components
|
21
|
+
* into the compact INT32 representation.
|
22
|
+
* Note that this formula must match the actual arithmetic encoder
|
23
|
+
* and decoder implementation. The implementation has to be changed
|
24
|
+
* if this formula is changed.
|
25
|
+
* The current organization is leaned on Markus Kuhn's JBIG
|
26
|
+
* implementation (jbig_tab.c).
|
27
|
+
*/
|
28
|
+
|
29
|
+
#define V(a,b,c,d) (((INT32)a << 16) | ((INT32)c << 8) | ((INT32)d << 7) | b)
|
30
|
+
|
31
|
+
const INT32 jaritab[113] = {
|
32
|
+
/*
|
33
|
+
* Index, Qe_Value, Next_Index_LPS, Next_Index_MPS, Switch_MPS
|
34
|
+
*/
|
35
|
+
/* 0 */ V( 0x5a1d, 1, 1, 1 ),
|
36
|
+
/* 1 */ V( 0x2586, 14, 2, 0 ),
|
37
|
+
/* 2 */ V( 0x1114, 16, 3, 0 ),
|
38
|
+
/* 3 */ V( 0x080b, 18, 4, 0 ),
|
39
|
+
/* 4 */ V( 0x03d8, 20, 5, 0 ),
|
40
|
+
/* 5 */ V( 0x01da, 23, 6, 0 ),
|
41
|
+
/* 6 */ V( 0x00e5, 25, 7, 0 ),
|
42
|
+
/* 7 */ V( 0x006f, 28, 8, 0 ),
|
43
|
+
/* 8 */ V( 0x0036, 30, 9, 0 ),
|
44
|
+
/* 9 */ V( 0x001a, 33, 10, 0 ),
|
45
|
+
/* 10 */ V( 0x000d, 35, 11, 0 ),
|
46
|
+
/* 11 */ V( 0x0006, 9, 12, 0 ),
|
47
|
+
/* 12 */ V( 0x0003, 10, 13, 0 ),
|
48
|
+
/* 13 */ V( 0x0001, 12, 13, 0 ),
|
49
|
+
/* 14 */ V( 0x5a7f, 15, 15, 1 ),
|
50
|
+
/* 15 */ V( 0x3f25, 36, 16, 0 ),
|
51
|
+
/* 16 */ V( 0x2cf2, 38, 17, 0 ),
|
52
|
+
/* 17 */ V( 0x207c, 39, 18, 0 ),
|
53
|
+
/* 18 */ V( 0x17b9, 40, 19, 0 ),
|
54
|
+
/* 19 */ V( 0x1182, 42, 20, 0 ),
|
55
|
+
/* 20 */ V( 0x0cef, 43, 21, 0 ),
|
56
|
+
/* 21 */ V( 0x09a1, 45, 22, 0 ),
|
57
|
+
/* 22 */ V( 0x072f, 46, 23, 0 ),
|
58
|
+
/* 23 */ V( 0x055c, 48, 24, 0 ),
|
59
|
+
/* 24 */ V( 0x0406, 49, 25, 0 ),
|
60
|
+
/* 25 */ V( 0x0303, 51, 26, 0 ),
|
61
|
+
/* 26 */ V( 0x0240, 52, 27, 0 ),
|
62
|
+
/* 27 */ V( 0x01b1, 54, 28, 0 ),
|
63
|
+
/* 28 */ V( 0x0144, 56, 29, 0 ),
|
64
|
+
/* 29 */ V( 0x00f5, 57, 30, 0 ),
|
65
|
+
/* 30 */ V( 0x00b7, 59, 31, 0 ),
|
66
|
+
/* 31 */ V( 0x008a, 60, 32, 0 ),
|
67
|
+
/* 32 */ V( 0x0068, 62, 33, 0 ),
|
68
|
+
/* 33 */ V( 0x004e, 63, 34, 0 ),
|
69
|
+
/* 34 */ V( 0x003b, 32, 35, 0 ),
|
70
|
+
/* 35 */ V( 0x002c, 33, 9, 0 ),
|
71
|
+
/* 36 */ V( 0x5ae1, 37, 37, 1 ),
|
72
|
+
/* 37 */ V( 0x484c, 64, 38, 0 ),
|
73
|
+
/* 38 */ V( 0x3a0d, 65, 39, 0 ),
|
74
|
+
/* 39 */ V( 0x2ef1, 67, 40, 0 ),
|
75
|
+
/* 40 */ V( 0x261f, 68, 41, 0 ),
|
76
|
+
/* 41 */ V( 0x1f33, 69, 42, 0 ),
|
77
|
+
/* 42 */ V( 0x19a8, 70, 43, 0 ),
|
78
|
+
/* 43 */ V( 0x1518, 72, 44, 0 ),
|
79
|
+
/* 44 */ V( 0x1177, 73, 45, 0 ),
|
80
|
+
/* 45 */ V( 0x0e74, 74, 46, 0 ),
|
81
|
+
/* 46 */ V( 0x0bfb, 75, 47, 0 ),
|
82
|
+
/* 47 */ V( 0x09f8, 77, 48, 0 ),
|
83
|
+
/* 48 */ V( 0x0861, 78, 49, 0 ),
|
84
|
+
/* 49 */ V( 0x0706, 79, 50, 0 ),
|
85
|
+
/* 50 */ V( 0x05cd, 48, 51, 0 ),
|
86
|
+
/* 51 */ V( 0x04de, 50, 52, 0 ),
|
87
|
+
/* 52 */ V( 0x040f, 50, 53, 0 ),
|
88
|
+
/* 53 */ V( 0x0363, 51, 54, 0 ),
|
89
|
+
/* 54 */ V( 0x02d4, 52, 55, 0 ),
|
90
|
+
/* 55 */ V( 0x025c, 53, 56, 0 ),
|
91
|
+
/* 56 */ V( 0x01f8, 54, 57, 0 ),
|
92
|
+
/* 57 */ V( 0x01a4, 55, 58, 0 ),
|
93
|
+
/* 58 */ V( 0x0160, 56, 59, 0 ),
|
94
|
+
/* 59 */ V( 0x0125, 57, 60, 0 ),
|
95
|
+
/* 60 */ V( 0x00f6, 58, 61, 0 ),
|
96
|
+
/* 61 */ V( 0x00cb, 59, 62, 0 ),
|
97
|
+
/* 62 */ V( 0x00ab, 61, 63, 0 ),
|
98
|
+
/* 63 */ V( 0x008f, 61, 32, 0 ),
|
99
|
+
/* 64 */ V( 0x5b12, 65, 65, 1 ),
|
100
|
+
/* 65 */ V( 0x4d04, 80, 66, 0 ),
|
101
|
+
/* 66 */ V( 0x412c, 81, 67, 0 ),
|
102
|
+
/* 67 */ V( 0x37d8, 82, 68, 0 ),
|
103
|
+
/* 68 */ V( 0x2fe8, 83, 69, 0 ),
|
104
|
+
/* 69 */ V( 0x293c, 84, 70, 0 ),
|
105
|
+
/* 70 */ V( 0x2379, 86, 71, 0 ),
|
106
|
+
/* 71 */ V( 0x1edf, 87, 72, 0 ),
|
107
|
+
/* 72 */ V( 0x1aa9, 87, 73, 0 ),
|
108
|
+
/* 73 */ V( 0x174e, 72, 74, 0 ),
|
109
|
+
/* 74 */ V( 0x1424, 72, 75, 0 ),
|
110
|
+
/* 75 */ V( 0x119c, 74, 76, 0 ),
|
111
|
+
/* 76 */ V( 0x0f6b, 74, 77, 0 ),
|
112
|
+
/* 77 */ V( 0x0d51, 75, 78, 0 ),
|
113
|
+
/* 78 */ V( 0x0bb6, 77, 79, 0 ),
|
114
|
+
/* 79 */ V( 0x0a40, 77, 48, 0 ),
|
115
|
+
/* 80 */ V( 0x5832, 80, 81, 1 ),
|
116
|
+
/* 81 */ V( 0x4d1c, 88, 82, 0 ),
|
117
|
+
/* 82 */ V( 0x438e, 89, 83, 0 ),
|
118
|
+
/* 83 */ V( 0x3bdd, 90, 84, 0 ),
|
119
|
+
/* 84 */ V( 0x34ee, 91, 85, 0 ),
|
120
|
+
/* 85 */ V( 0x2eae, 92, 86, 0 ),
|
121
|
+
/* 86 */ V( 0x299a, 93, 87, 0 ),
|
122
|
+
/* 87 */ V( 0x2516, 86, 71, 0 ),
|
123
|
+
/* 88 */ V( 0x5570, 88, 89, 1 ),
|
124
|
+
/* 89 */ V( 0x4ca9, 95, 90, 0 ),
|
125
|
+
/* 90 */ V( 0x44d9, 96, 91, 0 ),
|
126
|
+
/* 91 */ V( 0x3e22, 97, 92, 0 ),
|
127
|
+
/* 92 */ V( 0x3824, 99, 93, 0 ),
|
128
|
+
/* 93 */ V( 0x32b4, 99, 94, 0 ),
|
129
|
+
/* 94 */ V( 0x2e17, 93, 86, 0 ),
|
130
|
+
/* 95 */ V( 0x56a8, 95, 96, 1 ),
|
131
|
+
/* 96 */ V( 0x4f46, 101, 97, 0 ),
|
132
|
+
/* 97 */ V( 0x47e5, 102, 98, 0 ),
|
133
|
+
/* 98 */ V( 0x41cf, 103, 99, 0 ),
|
134
|
+
/* 99 */ V( 0x3c3d, 104, 100, 0 ),
|
135
|
+
/* 100 */ V( 0x375e, 99, 93, 0 ),
|
136
|
+
/* 101 */ V( 0x5231, 105, 102, 0 ),
|
137
|
+
/* 102 */ V( 0x4c0f, 106, 103, 0 ),
|
138
|
+
/* 103 */ V( 0x4639, 107, 104, 0 ),
|
139
|
+
/* 104 */ V( 0x415e, 103, 99, 0 ),
|
140
|
+
/* 105 */ V( 0x5627, 105, 106, 1 ),
|
141
|
+
/* 106 */ V( 0x50e7, 108, 107, 0 ),
|
142
|
+
/* 107 */ V( 0x4b85, 109, 103, 0 ),
|
143
|
+
/* 108 */ V( 0x5597, 110, 109, 0 ),
|
144
|
+
/* 109 */ V( 0x504f, 111, 107, 0 ),
|
145
|
+
/* 110 */ V( 0x5a10, 110, 111, 1 ),
|
146
|
+
/* 111 */ V( 0x5522, 112, 109, 0 ),
|
147
|
+
/* 112 */ V( 0x59eb, 112, 111, 1 )
|
148
|
+
};
|
@@ -0,0 +1,282 @@
|
|
1
|
+
/*
|
2
|
+
* jcapimin.c
|
3
|
+
*
|
4
|
+
* Copyright (C) 1994-1998, 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 application interface code for the compression half
|
9
|
+
* of the JPEG library. These are the "minimum" API routines that may be
|
10
|
+
* needed in either the normal full-compression case or the transcoding-only
|
11
|
+
* case.
|
12
|
+
*
|
13
|
+
* Most of the routines intended to be called directly by an application
|
14
|
+
* are in this file or in jcapistd.c. But also see jcparam.c for
|
15
|
+
* parameter-setup helper routines, jcomapi.c for routines shared by
|
16
|
+
* compression and decompression, and jctrans.c for the transcoding case.
|
17
|
+
*/
|
18
|
+
|
19
|
+
#define JPEG_INTERNALS
|
20
|
+
#include "jinclude.h"
|
21
|
+
#include "jpeglib.h"
|
22
|
+
|
23
|
+
|
24
|
+
/*
|
25
|
+
* Initialization of a JPEG compression object.
|
26
|
+
* The error manager must already be set up (in case memory manager fails).
|
27
|
+
*/
|
28
|
+
|
29
|
+
GLOBAL(void)
|
30
|
+
jpeg_CreateCompress (j_compress_ptr cinfo, int version, size_t structsize)
|
31
|
+
{
|
32
|
+
int i;
|
33
|
+
|
34
|
+
/* Guard against version mismatches between library and caller. */
|
35
|
+
cinfo->mem = NULL; /* so jpeg_destroy knows mem mgr not called */
|
36
|
+
if (version != JPEG_LIB_VERSION)
|
37
|
+
ERREXIT2(cinfo, JERR_BAD_LIB_VERSION, JPEG_LIB_VERSION, version);
|
38
|
+
if (structsize != SIZEOF(struct jpeg_compress_struct))
|
39
|
+
ERREXIT2(cinfo, JERR_BAD_STRUCT_SIZE,
|
40
|
+
(int) SIZEOF(struct jpeg_compress_struct), (int) structsize);
|
41
|
+
|
42
|
+
/* For debugging purposes, we zero the whole master structure.
|
43
|
+
* But the application has already set the err pointer, and may have set
|
44
|
+
* client_data, so we have to save and restore those fields.
|
45
|
+
* Note: if application hasn't set client_data, tools like Purify may
|
46
|
+
* complain here.
|
47
|
+
*/
|
48
|
+
{
|
49
|
+
struct jpeg_error_mgr * err = cinfo->err;
|
50
|
+
void * client_data = cinfo->client_data; /* ignore Purify complaint here */
|
51
|
+
MEMZERO(cinfo, SIZEOF(struct jpeg_compress_struct));
|
52
|
+
cinfo->err = err;
|
53
|
+
cinfo->client_data = client_data;
|
54
|
+
}
|
55
|
+
cinfo->is_decompressor = FALSE;
|
56
|
+
|
57
|
+
/* Initialize a memory manager instance for this object */
|
58
|
+
jinit_memory_mgr((j_common_ptr) cinfo);
|
59
|
+
|
60
|
+
/* Zero out pointers to permanent structures. */
|
61
|
+
cinfo->progress = NULL;
|
62
|
+
cinfo->dest = NULL;
|
63
|
+
|
64
|
+
cinfo->comp_info = NULL;
|
65
|
+
|
66
|
+
for (i = 0; i < NUM_QUANT_TBLS; i++) {
|
67
|
+
cinfo->quant_tbl_ptrs[i] = NULL;
|
68
|
+
cinfo->q_scale_factor[i] = 100;
|
69
|
+
}
|
70
|
+
|
71
|
+
for (i = 0; i < NUM_HUFF_TBLS; i++) {
|
72
|
+
cinfo->dc_huff_tbl_ptrs[i] = NULL;
|
73
|
+
cinfo->ac_huff_tbl_ptrs[i] = NULL;
|
74
|
+
}
|
75
|
+
|
76
|
+
cinfo->script_space = NULL;
|
77
|
+
|
78
|
+
cinfo->input_gamma = 1.0; /* in case application forgets */
|
79
|
+
|
80
|
+
/* OK, I'm ready */
|
81
|
+
cinfo->global_state = CSTATE_START;
|
82
|
+
}
|
83
|
+
|
84
|
+
|
85
|
+
/*
|
86
|
+
* Destruction of a JPEG compression object
|
87
|
+
*/
|
88
|
+
|
89
|
+
GLOBAL(void)
|
90
|
+
jpeg_destroy_compress (j_compress_ptr cinfo)
|
91
|
+
{
|
92
|
+
jpeg_destroy((j_common_ptr) cinfo); /* use common routine */
|
93
|
+
}
|
94
|
+
|
95
|
+
|
96
|
+
/*
|
97
|
+
* Abort processing of a JPEG compression operation,
|
98
|
+
* but don't destroy the object itself.
|
99
|
+
*/
|
100
|
+
|
101
|
+
GLOBAL(void)
|
102
|
+
jpeg_abort_compress (j_compress_ptr cinfo)
|
103
|
+
{
|
104
|
+
jpeg_abort((j_common_ptr) cinfo); /* use common routine */
|
105
|
+
}
|
106
|
+
|
107
|
+
|
108
|
+
/*
|
109
|
+
* Forcibly suppress or un-suppress all quantization and Huffman tables.
|
110
|
+
* Marks all currently defined tables as already written (if suppress)
|
111
|
+
* or not written (if !suppress). This will control whether they get emitted
|
112
|
+
* by a subsequent jpeg_start_compress call.
|
113
|
+
*
|
114
|
+
* This routine is exported for use by applications that want to produce
|
115
|
+
* abbreviated JPEG datastreams. It logically belongs in jcparam.c, but
|
116
|
+
* since it is called by jpeg_start_compress, we put it here --- otherwise
|
117
|
+
* jcparam.o would be linked whether the application used it or not.
|
118
|
+
*/
|
119
|
+
|
120
|
+
GLOBAL(void)
|
121
|
+
jpeg_suppress_tables (j_compress_ptr cinfo, boolean suppress)
|
122
|
+
{
|
123
|
+
int i;
|
124
|
+
JQUANT_TBL * qtbl;
|
125
|
+
JHUFF_TBL * htbl;
|
126
|
+
|
127
|
+
for (i = 0; i < NUM_QUANT_TBLS; i++) {
|
128
|
+
if ((qtbl = cinfo->quant_tbl_ptrs[i]) != NULL)
|
129
|
+
qtbl->sent_table = suppress;
|
130
|
+
}
|
131
|
+
|
132
|
+
for (i = 0; i < NUM_HUFF_TBLS; i++) {
|
133
|
+
if ((htbl = cinfo->dc_huff_tbl_ptrs[i]) != NULL)
|
134
|
+
htbl->sent_table = suppress;
|
135
|
+
if ((htbl = cinfo->ac_huff_tbl_ptrs[i]) != NULL)
|
136
|
+
htbl->sent_table = suppress;
|
137
|
+
}
|
138
|
+
}
|
139
|
+
|
140
|
+
|
141
|
+
/*
|
142
|
+
* Finish JPEG compression.
|
143
|
+
*
|
144
|
+
* If a multipass operating mode was selected, this may do a great deal of
|
145
|
+
* work including most of the actual output.
|
146
|
+
*/
|
147
|
+
|
148
|
+
GLOBAL(void)
|
149
|
+
jpeg_finish_compress (j_compress_ptr cinfo)
|
150
|
+
{
|
151
|
+
JDIMENSION iMCU_row;
|
152
|
+
|
153
|
+
if (cinfo->global_state == CSTATE_SCANNING ||
|
154
|
+
cinfo->global_state == CSTATE_RAW_OK) {
|
155
|
+
/* Terminate first pass */
|
156
|
+
if (cinfo->next_scanline < cinfo->image_height)
|
157
|
+
ERREXIT(cinfo, JERR_TOO_LITTLE_DATA);
|
158
|
+
(*cinfo->master->finish_pass) (cinfo);
|
159
|
+
} else if (cinfo->global_state != CSTATE_WRCOEFS)
|
160
|
+
ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
|
161
|
+
/* Perform any remaining passes */
|
162
|
+
while (! cinfo->master->is_last_pass) {
|
163
|
+
(*cinfo->master->prepare_for_pass) (cinfo);
|
164
|
+
for (iMCU_row = 0; iMCU_row < cinfo->total_iMCU_rows; iMCU_row++) {
|
165
|
+
if (cinfo->progress != NULL) {
|
166
|
+
cinfo->progress->pass_counter = (long) iMCU_row;
|
167
|
+
cinfo->progress->pass_limit = (long) cinfo->total_iMCU_rows;
|
168
|
+
(*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);
|
169
|
+
}
|
170
|
+
/* We bypass the main controller and invoke coef controller directly;
|
171
|
+
* all work is being done from the coefficient buffer.
|
172
|
+
*/
|
173
|
+
if (! (*cinfo->coef->compress_data) (cinfo, (JSAMPIMAGE) NULL))
|
174
|
+
ERREXIT(cinfo, JERR_CANT_SUSPEND);
|
175
|
+
}
|
176
|
+
(*cinfo->master->finish_pass) (cinfo);
|
177
|
+
}
|
178
|
+
/* Write EOI, do final cleanup */
|
179
|
+
(*cinfo->marker->write_file_trailer) (cinfo);
|
180
|
+
(*cinfo->dest->term_destination) (cinfo);
|
181
|
+
/* We can use jpeg_abort to release memory and reset global_state */
|
182
|
+
jpeg_abort((j_common_ptr) cinfo);
|
183
|
+
}
|
184
|
+
|
185
|
+
|
186
|
+
/*
|
187
|
+
* Write a special marker.
|
188
|
+
* This is only recommended for writing COM or APPn markers.
|
189
|
+
* Must be called after jpeg_start_compress() and before
|
190
|
+
* first call to jpeg_write_scanlines() or jpeg_write_raw_data().
|
191
|
+
*/
|
192
|
+
|
193
|
+
GLOBAL(void)
|
194
|
+
jpeg_write_marker (j_compress_ptr cinfo, int marker,
|
195
|
+
const JOCTET *dataptr, unsigned int datalen)
|
196
|
+
{
|
197
|
+
JMETHOD(void, write_marker_byte, (j_compress_ptr info, int val));
|
198
|
+
|
199
|
+
if (cinfo->next_scanline != 0 ||
|
200
|
+
(cinfo->global_state != CSTATE_SCANNING &&
|
201
|
+
cinfo->global_state != CSTATE_RAW_OK &&
|
202
|
+
cinfo->global_state != CSTATE_WRCOEFS))
|
203
|
+
ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
|
204
|
+
|
205
|
+
(*cinfo->marker->write_marker_header) (cinfo, marker, datalen);
|
206
|
+
write_marker_byte = cinfo->marker->write_marker_byte; /* copy for speed */
|
207
|
+
while (datalen--) {
|
208
|
+
(*write_marker_byte) (cinfo, *dataptr);
|
209
|
+
dataptr++;
|
210
|
+
}
|
211
|
+
}
|
212
|
+
|
213
|
+
/* Same, but piecemeal. */
|
214
|
+
|
215
|
+
GLOBAL(void)
|
216
|
+
jpeg_write_m_header (j_compress_ptr cinfo, int marker, unsigned int datalen)
|
217
|
+
{
|
218
|
+
if (cinfo->next_scanline != 0 ||
|
219
|
+
(cinfo->global_state != CSTATE_SCANNING &&
|
220
|
+
cinfo->global_state != CSTATE_RAW_OK &&
|
221
|
+
cinfo->global_state != CSTATE_WRCOEFS))
|
222
|
+
ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
|
223
|
+
|
224
|
+
(*cinfo->marker->write_marker_header) (cinfo, marker, datalen);
|
225
|
+
}
|
226
|
+
|
227
|
+
GLOBAL(void)
|
228
|
+
jpeg_write_m_byte (j_compress_ptr cinfo, int val)
|
229
|
+
{
|
230
|
+
(*cinfo->marker->write_marker_byte) (cinfo, val);
|
231
|
+
}
|
232
|
+
|
233
|
+
|
234
|
+
/*
|
235
|
+
* Alternate compression function: just write an abbreviated table file.
|
236
|
+
* Before calling this, all parameters and a data destination must be set up.
|
237
|
+
*
|
238
|
+
* To produce a pair of files containing abbreviated tables and abbreviated
|
239
|
+
* image data, one would proceed as follows:
|
240
|
+
*
|
241
|
+
* initialize JPEG object
|
242
|
+
* set JPEG parameters
|
243
|
+
* set destination to table file
|
244
|
+
* jpeg_write_tables(cinfo);
|
245
|
+
* set destination to image file
|
246
|
+
* jpeg_start_compress(cinfo, FALSE);
|
247
|
+
* write data...
|
248
|
+
* jpeg_finish_compress(cinfo);
|
249
|
+
*
|
250
|
+
* jpeg_write_tables has the side effect of marking all tables written
|
251
|
+
* (same as jpeg_suppress_tables(..., TRUE)). Thus a subsequent start_compress
|
252
|
+
* will not re-emit the tables unless it is passed write_all_tables=TRUE.
|
253
|
+
*/
|
254
|
+
|
255
|
+
GLOBAL(void)
|
256
|
+
jpeg_write_tables (j_compress_ptr cinfo)
|
257
|
+
{
|
258
|
+
if (cinfo->global_state != CSTATE_START)
|
259
|
+
ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
|
260
|
+
|
261
|
+
/* (Re)initialize error mgr and destination modules */
|
262
|
+
(*cinfo->err->reset_error_mgr) ((j_common_ptr) cinfo);
|
263
|
+
(*cinfo->dest->init_destination) (cinfo);
|
264
|
+
/* Initialize the marker writer ... bit of a crock to do it here. */
|
265
|
+
jinit_marker_writer(cinfo);
|
266
|
+
/* Write them tables! */
|
267
|
+
(*cinfo->marker->write_tables_only) (cinfo);
|
268
|
+
/* And clean up. */
|
269
|
+
(*cinfo->dest->term_destination) (cinfo);
|
270
|
+
/*
|
271
|
+
* In library releases up through v6a, we called jpeg_abort() here to free
|
272
|
+
* any working memory allocated by the destination manager and marker
|
273
|
+
* writer. Some applications had a problem with that: they allocated space
|
274
|
+
* of their own from the library memory manager, and didn't want it to go
|
275
|
+
* away during write_tables. So now we do nothing. This will cause a
|
276
|
+
* memory leak if an app calls write_tables repeatedly without doing a full
|
277
|
+
* compression cycle or otherwise resetting the JPEG object. However, that
|
278
|
+
* seems less bad than unexpectedly freeing memory in the normal case.
|
279
|
+
* An app that prefers the old behavior can call jpeg_abort for itself after
|
280
|
+
* each call to jpeg_write_tables().
|
281
|
+
*/
|
282
|
+
}
|
@@ -0,0 +1,161 @@
|
|
1
|
+
/*
|
2
|
+
* jcapistd.c
|
3
|
+
*
|
4
|
+
* Copyright (C) 1994-1996, Thomas G. Lane.
|
5
|
+
* This file is part of the Independent JPEG Group's software.
|
6
|
+
* For conditions of distribution and use, see the accompanying README file.
|
7
|
+
*
|
8
|
+
* This file contains application interface code for the compression half
|
9
|
+
* of the JPEG library. These are the "standard" API routines that are
|
10
|
+
* used in the normal full-compression case. They are not used by a
|
11
|
+
* transcoding-only application. Note that if an application links in
|
12
|
+
* jpeg_start_compress, it will end up linking in the entire compressor.
|
13
|
+
* We thus must separate this file from jcapimin.c to avoid linking the
|
14
|
+
* whole compression library into a transcoder.
|
15
|
+
*/
|
16
|
+
|
17
|
+
#define JPEG_INTERNALS
|
18
|
+
#include "jinclude.h"
|
19
|
+
#include "jpeglib.h"
|
20
|
+
|
21
|
+
|
22
|
+
/*
|
23
|
+
* Compression initialization.
|
24
|
+
* Before calling this, all parameters and a data destination must be set up.
|
25
|
+
*
|
26
|
+
* We require a write_all_tables parameter as a failsafe check when writing
|
27
|
+
* multiple datastreams from the same compression object. Since prior runs
|
28
|
+
* will have left all the tables marked sent_table=TRUE, a subsequent run
|
29
|
+
* would emit an abbreviated stream (no tables) by default. This may be what
|
30
|
+
* is wanted, but for safety's sake it should not be the default behavior:
|
31
|
+
* programmers should have to make a deliberate choice to emit abbreviated
|
32
|
+
* images. Therefore the documentation and examples should encourage people
|
33
|
+
* to pass write_all_tables=TRUE; then it will take active thought to do the
|
34
|
+
* wrong thing.
|
35
|
+
*/
|
36
|
+
|
37
|
+
GLOBAL(void)
|
38
|
+
jpeg_start_compress (j_compress_ptr cinfo, boolean write_all_tables)
|
39
|
+
{
|
40
|
+
if (cinfo->global_state != CSTATE_START)
|
41
|
+
ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
|
42
|
+
|
43
|
+
if (write_all_tables)
|
44
|
+
jpeg_suppress_tables(cinfo, FALSE); /* mark all tables to be written */
|
45
|
+
|
46
|
+
/* (Re)initialize error mgr and destination modules */
|
47
|
+
(*cinfo->err->reset_error_mgr) ((j_common_ptr) cinfo);
|
48
|
+
(*cinfo->dest->init_destination) (cinfo);
|
49
|
+
/* Perform master selection of active modules */
|
50
|
+
jinit_compress_master(cinfo);
|
51
|
+
/* Set up for the first pass */
|
52
|
+
(*cinfo->master->prepare_for_pass) (cinfo);
|
53
|
+
/* Ready for application to drive first pass through jpeg_write_scanlines
|
54
|
+
* or jpeg_write_raw_data.
|
55
|
+
*/
|
56
|
+
cinfo->next_scanline = 0;
|
57
|
+
cinfo->global_state = (cinfo->raw_data_in ? CSTATE_RAW_OK : CSTATE_SCANNING);
|
58
|
+
}
|
59
|
+
|
60
|
+
|
61
|
+
/*
|
62
|
+
* Write some scanlines of data to the JPEG compressor.
|
63
|
+
*
|
64
|
+
* The return value will be the number of lines actually written.
|
65
|
+
* This should be less than the supplied num_lines only in case that
|
66
|
+
* the data destination module has requested suspension of the compressor,
|
67
|
+
* or if more than image_height scanlines are passed in.
|
68
|
+
*
|
69
|
+
* Note: we warn about excess calls to jpeg_write_scanlines() since
|
70
|
+
* this likely signals an application programmer error. However,
|
71
|
+
* excess scanlines passed in the last valid call are *silently* ignored,
|
72
|
+
* so that the application need not adjust num_lines for end-of-image
|
73
|
+
* when using a multiple-scanline buffer.
|
74
|
+
*/
|
75
|
+
|
76
|
+
GLOBAL(JDIMENSION)
|
77
|
+
jpeg_write_scanlines (j_compress_ptr cinfo, JSAMPARRAY scanlines,
|
78
|
+
JDIMENSION num_lines)
|
79
|
+
{
|
80
|
+
JDIMENSION row_ctr, rows_left;
|
81
|
+
|
82
|
+
if (cinfo->global_state != CSTATE_SCANNING)
|
83
|
+
ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
|
84
|
+
if (cinfo->next_scanline >= cinfo->image_height)
|
85
|
+
WARNMS(cinfo, JWRN_TOO_MUCH_DATA);
|
86
|
+
|
87
|
+
/* Call progress monitor hook if present */
|
88
|
+
if (cinfo->progress != NULL) {
|
89
|
+
cinfo->progress->pass_counter = (long) cinfo->next_scanline;
|
90
|
+
cinfo->progress->pass_limit = (long) cinfo->image_height;
|
91
|
+
(*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);
|
92
|
+
}
|
93
|
+
|
94
|
+
/* Give master control module another chance if this is first call to
|
95
|
+
* jpeg_write_scanlines. This lets output of the frame/scan headers be
|
96
|
+
* delayed so that application can write COM, etc, markers between
|
97
|
+
* jpeg_start_compress and jpeg_write_scanlines.
|
98
|
+
*/
|
99
|
+
if (cinfo->master->call_pass_startup)
|
100
|
+
(*cinfo->master->pass_startup) (cinfo);
|
101
|
+
|
102
|
+
/* Ignore any extra scanlines at bottom of image. */
|
103
|
+
rows_left = cinfo->image_height - cinfo->next_scanline;
|
104
|
+
if (num_lines > rows_left)
|
105
|
+
num_lines = rows_left;
|
106
|
+
|
107
|
+
row_ctr = 0;
|
108
|
+
(*cinfo->main->process_data) (cinfo, scanlines, &row_ctr, num_lines);
|
109
|
+
cinfo->next_scanline += row_ctr;
|
110
|
+
return row_ctr;
|
111
|
+
}
|
112
|
+
|
113
|
+
|
114
|
+
/*
|
115
|
+
* Alternate entry point to write raw data.
|
116
|
+
* Processes exactly one iMCU row per call, unless suspended.
|
117
|
+
*/
|
118
|
+
|
119
|
+
GLOBAL(JDIMENSION)
|
120
|
+
jpeg_write_raw_data (j_compress_ptr cinfo, JSAMPIMAGE data,
|
121
|
+
JDIMENSION num_lines)
|
122
|
+
{
|
123
|
+
JDIMENSION lines_per_iMCU_row;
|
124
|
+
|
125
|
+
if (cinfo->global_state != CSTATE_RAW_OK)
|
126
|
+
ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
|
127
|
+
if (cinfo->next_scanline >= cinfo->image_height) {
|
128
|
+
WARNMS(cinfo, JWRN_TOO_MUCH_DATA);
|
129
|
+
return 0;
|
130
|
+
}
|
131
|
+
|
132
|
+
/* Call progress monitor hook if present */
|
133
|
+
if (cinfo->progress != NULL) {
|
134
|
+
cinfo->progress->pass_counter = (long) cinfo->next_scanline;
|
135
|
+
cinfo->progress->pass_limit = (long) cinfo->image_height;
|
136
|
+
(*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);
|
137
|
+
}
|
138
|
+
|
139
|
+
/* Give master control module another chance if this is first call to
|
140
|
+
* jpeg_write_raw_data. This lets output of the frame/scan headers be
|
141
|
+
* delayed so that application can write COM, etc, markers between
|
142
|
+
* jpeg_start_compress and jpeg_write_raw_data.
|
143
|
+
*/
|
144
|
+
if (cinfo->master->call_pass_startup)
|
145
|
+
(*cinfo->master->pass_startup) (cinfo);
|
146
|
+
|
147
|
+
/* Verify that at least one iMCU row has been passed. */
|
148
|
+
lines_per_iMCU_row = cinfo->max_v_samp_factor * DCTSIZE;
|
149
|
+
if (num_lines < lines_per_iMCU_row)
|
150
|
+
ERREXIT(cinfo, JERR_BUFFER_SIZE);
|
151
|
+
|
152
|
+
/* Directly compress the row. */
|
153
|
+
if (! (*cinfo->coef->compress_data) (cinfo, data)) {
|
154
|
+
/* If compressor did not consume the whole row, suspend processing. */
|
155
|
+
return 0;
|
156
|
+
}
|
157
|
+
|
158
|
+
/* OK, we processed one iMCU row. */
|
159
|
+
cinfo->next_scanline += lines_per_iMCU_row;
|
160
|
+
return lines_per_iMCU_row;
|
161
|
+
}
|