tesseract
5.0.0-alpha-619-ge9db
|
Go to the documentation of this file.
37 #define PRUNER_ANGLE 2
40 #define ANGLE_SHIFT (0.0)
44 #define MAX_PROTO_INDEX 24
45 #define BITS_PER_WERD static_cast<int>(8 * sizeof(uint32_t))
47 #define MAX_NUM_CONFIGS 64
48 #define MAX_NUM_PROTOS 512
49 #define PROTOS_PER_PROTO_SET 64
50 #define MAX_NUM_PROTO_SETS (MAX_NUM_PROTOS / PROTOS_PER_PROTO_SET)
51 #define NUM_PP_PARAMS 3
52 #define NUM_PP_BUCKETS 64
53 #define NUM_CP_BUCKETS 24
54 #define CLASSES_PER_CP 32
55 #define NUM_BITS_PER_CLASS 2
56 #define CLASS_PRUNER_CLASS_MASK (~(~0u << NUM_BITS_PER_CLASS))
57 #define CLASSES_PER_CP_WERD (CLASSES_PER_CP / NUM_BITS_PER_CLASS)
58 #define PROTOS_PER_PP_WERD BITS_PER_WERD
59 #define BITS_PER_CP_VECTOR (CLASSES_PER_CP * NUM_BITS_PER_CLASS)
60 #define MAX_NUM_CLASS_PRUNERS \
61 ((MAX_NUM_CLASSES + CLASSES_PER_CP - 1) / CLASSES_PER_CP)
62 #define WERDS_PER_CP_VECTOR (BITS_PER_CP_VECTOR / BITS_PER_WERD)
63 #define WERDS_PER_PP_VECTOR \
64 ((PROTOS_PER_PROTO_SET + BITS_PER_WERD - 1) / BITS_PER_WERD)
65 #define WERDS_PER_PP (NUM_PP_PARAMS * NUM_PP_BUCKETS * WERDS_PER_PP_VECTOR)
66 #define WERDS_PER_CP \
67 (NUM_CP_BUCKETS * NUM_CP_BUCKETS * NUM_CP_BUCKETS * WERDS_PER_CP_VECTOR)
68 #define WERDS_PER_CONFIG_VEC \
69 ((MAX_NUM_CONFIGS + BITS_PER_WERD - 1) / BITS_PER_WERD)
107 uint8_t NumProtoSets;
110 uint8_t* ProtoLengths;
129 #define MAX_NUM_INT_FEATURES 512
130 #define INT_CHAR_NORM_RANGE 256
165 #define MaxNumIntProtosIn(C) (C->NumProtoSets * PROTOS_PER_PROTO_SET)
166 #define SetForProto(P) (P / PROTOS_PER_PROTO_SET)
167 #define IndexForProto(P) (P % PROTOS_PER_PROTO_SET)
168 #define ProtoForProtoId(C, P) \
169 (&((C->ProtoSets[SetForProto(P)])->Protos[IndexForProto(P)]))
170 #define PPrunerWordIndexFor(I) \
171 (((I) % PROTOS_PER_PROTO_SET) / PROTOS_PER_PP_WERD)
172 #define PPrunerBitIndexFor(I) ((I) % PROTOS_PER_PP_WERD)
173 #define PPrunerMaskFor(I) (1 << PPrunerBitIndexFor(I))
175 #define MaxNumClassesIn(T) (T->NumClassPruners * CLASSES_PER_CP)
176 #define LegalClassId(c) ((c) >= 0 && (c) <= MAX_CLASS_ID)
177 #define UnusedClassIdIn(T, c) ((T)->Class[c] == nullptr)
178 #define ClassForClassId(T, c) ((T)->Class[c])
179 #define ClassPrunersFor(T) ((T)->ClassPruner)
180 #define CPrunerIdFor(c) ((c) / CLASSES_PER_CP)
181 #define CPrunerFor(T, c) ((T)->ClassPruners[CPrunerIdFor(c)])
182 #define CPrunerWordIndexFor(c) (((c) % CLASSES_PER_CP) / CLASSES_PER_CP_WERD)
183 #define CPrunerBitIndexFor(c) (((c) % CLASSES_PER_CP) % CLASSES_PER_CP_WERD)
184 #define CPrunerMaskFor(L, c) \
185 (((L) + 1) << CPrunerBitIndexFor(c) * NUM_BITS_PER_CLASS)
188 #define PRINT_MATCH_SUMMARY 0x001
189 #define DISPLAY_FEATURE_MATCHES 0x002
190 #define DISPLAY_PROTO_MATCHES 0x004
191 #define PRINT_FEATURE_MATCHES 0x008
192 #define PRINT_PROTO_MATCHES 0x010
193 #define CLIP_MATCH_EVIDENCE 0x020
195 #define MatchDebuggingOn(D) (D)
196 #define PrintMatchSummaryOn(D) ((D)&PRINT_MATCH_SUMMARY)
197 #define DisplayFeatureMatchesOn(D) ((D)&DISPLAY_FEATURE_MATCHES)
198 #define DisplayProtoMatchesOn(D) ((D)&DISPLAY_PROTO_MATCHES)
199 #define PrintFeatureMatchesOn(D) ((D)&PRINT_FEATURE_MATCHES)
200 #define PrintProtoMatchesOn(D) ((D)&PRINT_PROTO_MATCHES)
201 #define ClipMatchEvidenceOn(D) ((D)&CLIP_MATCH_EVIDENCE)
218 uint8_t
Bucket8For(
float param,
float offset,
int num_buckets);
219 uint16_t
Bucket16For(
float param,
float offset,
int num_buckets);
221 uint8_t
CircBucketFor(
float param,
float offset,
int num_buckets);
248 #ifndef GRAPHICS_DISABLED
261 #endif // GRAPHICS_DISABLED
uint32_t CONFIG_PRUNER[NUM_PP_PARAMS][NUM_PP_BUCKETS][4]
#define PROTOS_PER_PROTO_SET
INT_TEMPLATES NewIntTemplates()
void InitFeatureDisplayWindowIfReqd()
void RenderIntFeature(ScrollView *window, const INT_FEATURE_STRUCT *Feature, ScrollView::Color color)
struct INT_CLASS_STRUCT * INT_CLASS
#define MAX_NUM_PROTO_SETS
#define MAX_NUM_CLASS_PRUNERS
uint8_t Bucket8For(float param, float offset, int num_buckets)
void ConvertConfig(BIT_VECTOR Config, int ConfigId, INT_CLASS Class)
int AddIntProto(INT_CLASS Class)
uint16_t Bucket16For(float param, float offset, int num_buckets)
void DisplayIntProto(INT_CLASS Class, PROTO_ID ProtoId, float Evidence)
struct INT_PROTO_STRUCT * INT_PROTO
uint8_t CircBucketFor(float param, float offset, int num_buckets)
uint32_t PROTO_PRUNER[NUM_PP_PARAMS][NUM_PP_BUCKETS][WERDS_PER_PP_VECTOR]
#define MAX_NUM_INT_FEATURES
struct PROTO_SET_STRUCT * PROTO_SET
#define WERDS_PER_CONFIG_VEC
void free_int_templates(INT_TEMPLATES templates)
void AddIntClass(INT_TEMPLATES Templates, CLASS_ID ClassId, INT_CLASS Class)
ScrollView * CreateFeatureSpaceWindow(const char *name, int xpos, int ypos)
void AddProtoToProtoPruner(PROTO Proto, int ProtoId, INT_CLASS Class, bool debug)
int AddIntConfig(INT_CLASS Class)
INT_FEATURE_STRUCT INT_FEATURE_ARRAY[MAX_NUM_INT_FEATURES]
void InitIntMatchWindowIfReqd()
void DisplayIntFeature(const INT_FEATURE_STRUCT *Feature, float Evidence)
void AddProtoToClassPruner(PROTO Proto, CLASS_ID ClassId, INT_TEMPLATES Templates)
#define WERDS_PER_CP_VECTOR
DLLSYM void tprintf(const char *format,...)
uint32_t p[NUM_CP_BUCKETS][NUM_CP_BUCKETS][NUM_CP_BUCKETS][WERDS_PER_CP_VECTOR]
#define WERDS_PER_PP_VECTOR
void InitProtoDisplayWindowIfReqd()
void ClearFeatureSpaceWindow(NORM_METHOD norm_method, ScrollView *window)
INT_CLASS NewIntClass(int MaxNumProtos, int MaxNumConfigs)
struct INT_TEMPLATES_STRUCT * INT_TEMPLATES
void UpdateMatchDisplay()