Debian Codegraph @

cuneiform_src/Kern/rimage/sources/main/deza/cdezabinarizator.h

raw
1 /*
2 Copyright (c) 1993-2008, Cognitive Technologies
3 All rights reserved.
4
5 Разрешается повторное распространение и использование как в виде исходного кода,
6 так и в двоичной форме, с изменениями или без, при соблюдении следующих условий:
7
8 * При повторном распространении исходного кода должны оставаться указанное
9 выше уведомление об авторском праве, этот список условий и последующий
10 отказ от гарантий.
11 * При повторном распространении двоичного кода в документации и/или в
12 других материалах, поставляемых при распространении, должны сохраняться
13 указанная выше информация об авторском праве, этот список условий и
14 последующий отказ от гарантий.
15 * Ни название Cognitive Technologies, ни имена ее сотрудников не могут
16 быть использованы в качестве средства поддержки и/или продвижения
17 продуктов, основанных на этом ПО, без предварительного письменного
18 разрешения.
19
20 ЭТА ПРОГРАММА ПРЕДОСТАВЛЕНА ВЛАДЕЛЬЦАМИ АВТОРСКИХ ПРАВ И/ИЛИ ДРУГИМИ ЛИЦАМИ "КАК
21 ОНА ЕСТЬ" БЕЗ КАКОГО-ЛИБО ВИДА ГАРАНТИЙ, ВЫРАЖЕННЫХ ЯВНО ИЛИ ПОДРАЗУМЕВАЕМЫХ,
22 ВКЛЮЧАЯ ГАРАНТИИ КОММЕРЧЕСКОЙ ЦЕННОСТИ И ПРИГОДНОСТИ ДЛЯ КОНКРЕТНОЙ ЦЕЛИ, НО НЕ
23 ОГРАНИЧИВАЯСЬ ИМИ. НИ ВЛАДЕЛЕЦ АВТОРСКИХ ПРАВ И НИ ОДНО ДРУГОЕ ЛИЦО, КОТОРОЕ
24 МОЖЕТ ИЗМЕНЯТЬ И/ИЛИ ПОВТОРНО РАСПРОСТРАНЯТЬ ПРОГРАММУ, НИ В КОЕМ СЛУЧАЕ НЕ
25 НЕСЁТ ОТВЕТСТВЕННОСТИ, ВКЛЮЧАЯ ЛЮБЫЕ ОБЩИЕ, СЛУЧАЙНЫЕ, СПЕЦИАЛЬНЫЕ ИЛИ
26 ПОСЛЕДОВАВШИЕ УБЫТКИ, СВЯЗАННЫЕ С ИСПОЛЬЗОВАНИЕМ ИЛИ ПОНЕСЕННЫЕ ВСЛЕДСТВИЕ
27 НЕВОЗМОЖНОСТИ ИСПОЛЬЗОВАНИЯ ПРОГРАММЫ (ВКЛЮЧАЯ ПОТЕРИ ДАННЫХ, ИЛИ ДАННЫЕ,
28 СТАВШИЕ НЕГОДНЫМИ, ИЛИ УБЫТКИ И/ИЛИ ПОТЕРИ ДОХОДОВ, ПОНЕСЕННЫЕ ИЗ-ЗА ДЕЙСТВИЙ
29 ТРЕТЬИХ ЛИЦ И/ИЛИ ОТКАЗА ПРОГРАММЫ РАБОТАТЬ СОВМЕСТНО С ДРУГИМИ ПРОГРАММАМИ,
30 НО НЕ ОГРАНИЧИВАЯСЬ ЭТИМИ СЛУЧАЯМИ), НО НЕ ОГРАНИЧИВАЯСЬ ИМИ, ДАЖЕ ЕСЛИ ТАКОЙ
31 ВЛАДЕЛЕЦ ИЛИ ДРУГОЕ ЛИЦО БЫЛИ ИЗВЕЩЕНЫ О ВОЗМОЖНОСТИ ТАКИХ УБЫТКОВ И ПОТЕРЬ.
32
33 Redistribution and use in source and binary forms, with or without modification,
34 are permitted provided that the following conditions are met:
35
36 * Redistributions of source code must retain the above copyright notice,
37 this list of conditions and the following disclaimer.
38 * Redistributions in binary form must reproduce the above copyright notice,
39 this list of conditions and the following disclaimer in the documentation
40 and/or other materials provided with the distribution.
41 * Neither the name of the Cognitive Technologies nor the names of its
42 contributors may be used to endorse or promote products derived from this
43 software without specific prior written permission.
44
45 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
46 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
47 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
48 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
49 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
50 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
51 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
52 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
53 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
54 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
55 */
56
57 // CDezaBinarizator.h: interface for the CDezaBinarizator class.
58 //
59 //////////////////////////////////////////////////////////////////////
60
61 #if !defined(_CDEZA_BINARIZATOR_H_)
62 #define _CDEZA_BINARIZATOR_H_
63
64 #if _MSC_VER > 1000
65 #pragma once
66 #endif // _MSC_VER > 1000
67
68 #include "stdlib.h"
69 #include "globus.h"
70 #include "crimemory.h"
71
72 ///////////////////////////////////////////////////////////////////////////////////////////////////
73 //
74 typedef struct tagTigerImageInfo
75 {
76 unsigned short int wImageHeight; /* Height of the image in lines */
77 unsigned short int wImageWidth; /* Width of the image in pixels */
78 unsigned short int wImageByteWidth; /* Size of the image line in bytes */
79 unsigned short int wImageDisplacement;
80 /* Displacement of the first pixel of image line in pixels, usually 0 */
81 unsigned short int wResolutionX; /* Resolution by X-axe */
82 unsigned short int wResolutionY; /* Resolution by Y-axe */
83 unsigned char bFotoMetrics; /* White pixel */
84 unsigned char bUnused; /* not used; for alignment purpose only */
85 unsigned short int wAddX;
86 unsigned short int wAddY;
87 } CTBINTigerImageInfo, *PCTBINTigerImageInfo;
88 ///////////////////////////////////////////////////////////////////////////////////////////////////
89 //
90 #define DB_MALLOC(a) RIMAGEAlloc(a)
91 #define DB_FREE(a) RIMAGEFree(a)
92 ///////////////////////////////////////////////////////////////////////////////////////////////////
93 //
94 ///////////////////////////////////////////////////////////////////////////////////////////////////
95 //
96 ///////////////////////////////////////////////////////////////////////////////////////////////////
97 //
98 class CRIBinarizator;
99 ///////////////////////////////////////////////////////////////////////////////////////////////////
100 //
101 class CDezaBinarizator
102 {
103 #define BUFS 3*1000
104 #define SB 256
105 #define LONGBUF 15L*4096L
106
107 public:
108 int32_t CloseTrackBin(void);
109 int32_t GetBinarized(puchar ptbl, uint32_t lenbl);
110 uint32_t OpenTrackBin(PCTBINTigerImageInfo Info, CRIBinarizator * pCaller, uint32_t wdezaFlag);
111 CDezaBinarizator();
112 virtual ~CDezaBinarizator();
113
114 private:
115 int32_t Get1(void);
116 int32_t Read_por_first(void);
117 int32_t Elem_st(void);
118 int32_t Grey_black(void);
119 int32_t Xygo(int32_t, int32_t);
120 int32_t Our1(int32_t);
121 puchar Black_file(puchar, int32_t);
122
123 private:
124 void Ras1_pred(int32_t);
125 void Raspred(int32_t);
126 void Stek(void);
127 void Left_str(void);
128 void Right_str(void);
129 int32_t bWhitePixel;
130 int32_t colall;
131 int32_t chet_color[SB];
132 uchar lg0;
133 puchar ptbtek;
134 puchar ptbosn;
135 puchar ptb;
136 puchar ptgrey;
137 uint32_t indend;
138 uint32_t indbeg;
139 int32_t nstrb;
140 int32_t nstr;
141 int32_t sy1;
142 int32_t sdvig;
143 int32_t lg0i;
144 int32_t spx2;
145 int32_t spx1;
146 int32_t spy;
147 int32_t spx;
148 int32_t bufmark[4];
149 int32_t sheds;
150 int32_t shed;
151 int32_t st[BUFS];
152 int32_t ypor;
153 int32_t tip;
154 int32_t indbl;
155 int32_t lgn;
156 int32_t lg;
157 int32_t xx;
158 int32_t y;
159 int32_t x;
160 int32_t urov[2];
161 CRIBinarizator * mpBinarizatorControl;
162 //////////////////////////////////////////////////////////////////////
163 #define DB_GREYREAD(a,b,c) mpBinarizatorControl->KronrodImageRead(a,b,c)
164 };
165 /////////////////////////////////////////////////////
166 //
167 typedef CDezaBinarizator *PCDezaBinarizator;
168 ///////////////////////////////////////////////////
169 //
170 #endif // !defined(_CDEZA_BINARIZATOR_H_)