25 #include "genericvector.h" 26 #include "matchdefs.h" 27 #include "mfoutline.h" 29 #include "scrollview.h" 30 #include "unicharset.h" 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) 77 uint32_t
p[NUM_CP_BUCKETS][NUM_CP_BUCKETS][NUM_CP_BUCKETS]
78 [WERDS_PER_CP_VECTOR];
86 uint32_t Configs[WERDS_PER_CONFIG_VEC];
92 typedef uint32_t PROTO_PRUNER[NUM_PP_PARAMS][NUM_PP_BUCKETS]
93 [WERDS_PER_PP_VECTOR];
103 typedef uint32_t CONFIG_PRUNER[NUM_PP_PARAMS][NUM_PP_BUCKETS][4];
109 PROTO_SET ProtoSets[MAX_NUM_PROTO_SETS];
111 uint16_t ConfigLengths[MAX_NUM_CONFIGS];
121 INT_CLASS Class[MAX_NUM_CLASSES];
129 #define MAX_NUM_INT_FEATURES 512 130 #define INT_CHAR_NORM_RANGE 256 145 void print()
const { tprintf(
"(%d,%d):%d\n", X, Y, Theta); }
152 enum IntmatcherDebugAction {
163 #define MaxNumIntProtosIn(C) (C->NumProtoSets * PROTOS_PER_PROTO_SET) 164 #define SetForProto(P) (P / PROTOS_PER_PROTO_SET) 165 #define IndexForProto(P) (P % PROTOS_PER_PROTO_SET) 166 #define ProtoForProtoId(C, P) \ 167 (&((C->ProtoSets[SetForProto(P)])->Protos[IndexForProto(P)])) 168 #define PPrunerWordIndexFor(I) \ 169 (((I) % PROTOS_PER_PROTO_SET) / PROTOS_PER_PP_WERD) 170 #define PPrunerBitIndexFor(I) ((I) % PROTOS_PER_PP_WERD) 171 #define PPrunerMaskFor(I) (1 << PPrunerBitIndexFor(I)) 173 #define MaxNumClassesIn(T) (T->NumClassPruners * CLASSES_PER_CP) 174 #define LegalClassId(c) ((c) >= 0 && (c) <= MAX_CLASS_ID) 175 #define UnusedClassIdIn(T, c) ((T)->Class[c] == nullptr) 176 #define ClassForClassId(T, c) ((T)->Class[c]) 177 #define ClassPrunersFor(T) ((T)->ClassPruner) 178 #define CPrunerIdFor(c) ((c) / CLASSES_PER_CP) 179 #define CPrunerFor(T, c) ((T)->ClassPruners[CPrunerIdFor(c)]) 180 #define CPrunerWordIndexFor(c) (((c) % CLASSES_PER_CP) / CLASSES_PER_CP_WERD) 181 #define CPrunerBitIndexFor(c) (((c) % CLASSES_PER_CP) % CLASSES_PER_CP_WERD) 182 #define CPrunerMaskFor(L, c) \ 183 (((L) + 1) << CPrunerBitIndexFor(c) * NUM_BITS_PER_CLASS) 186 #define PRINT_MATCH_SUMMARY 0x001 187 #define DISPLAY_FEATURE_MATCHES 0x002 188 #define DISPLAY_PROTO_MATCHES 0x004 189 #define PRINT_FEATURE_MATCHES 0x008 190 #define PRINT_PROTO_MATCHES 0x010 191 #define CLIP_MATCH_EVIDENCE 0x020 193 #define MatchDebuggingOn(D) (D) 194 #define PrintMatchSummaryOn(D) ((D)&PRINT_MATCH_SUMMARY) 195 #define DisplayFeatureMatchesOn(D) ((D)&DISPLAY_FEATURE_MATCHES) 196 #define DisplayProtoMatchesOn(D) ((D)&DISPLAY_PROTO_MATCHES) 197 #define PrintFeatureMatchesOn(D) ((D)&PRINT_FEATURE_MATCHES) 198 #define PrintProtoMatchesOn(D) ((D)&PRINT_PROTO_MATCHES) 199 #define ClipMatchEvidenceOn(D) ((D)&CLIP_MATCH_EVIDENCE) 204 void AddIntClass(INT_TEMPLATES Templates, CLASS_ID ClassId, INT_CLASS Class);
206 int AddIntConfig(INT_CLASS Class);
208 int AddIntProto(INT_CLASS Class);
210 void AddProtoToClassPruner(
PROTO Proto, CLASS_ID ClassId,
211 INT_TEMPLATES Templates);
213 void AddProtoToProtoPruner(
PROTO Proto,
int ProtoId, INT_CLASS Class,
216 uint8_t Bucket8For(
float param,
float offset,
int num_buckets);
217 uint16_t Bucket16For(
float param,
float offset,
int num_buckets);
219 uint8_t CircBucketFor(
float param,
float offset,
int num_buckets);
221 void UpdateMatchDisplay();
223 void ConvertConfig(BIT_VECTOR Config,
int ConfigId, INT_CLASS Class);
227 void DisplayIntProto(INT_CLASS Class, PROTO_ID ProtoId,
float Evidence);
229 INT_CLASS NewIntClass(
int MaxNumProtos,
int MaxNumConfigs);
231 INT_TEMPLATES NewIntTemplates();
233 void free_int_templates(INT_TEMPLATES templates);
235 void ShowMatchDisplay();
241 void ClearFeatureSpaceWindow(NORM_METHOD norm_method,
ScrollView* window);
246 #ifndef GRAPHICS_DISABLED 250 void InitIntMatchWindowIfReqd();
252 void InitProtoDisplayWindowIfReqd();
254 void InitFeatureDisplayWindowIfReqd();
258 ScrollView* CreateFeatureSpaceWindow(
const char* name,
int xpos,
int ypos);
259 #endif // GRAPHICS_DISABLED int8_t C
Definition: intproto.h:84
INT_FEATURE_STRUCT()
Definition: intproto.h:133
void print() const
Definition: intproto.h:145
uint8_t NumProtoSets
Definition: intproto.h:107
int8_t CP_misses
Definition: intproto.h:143
uint8_t B
Definition: intproto.h:83
Definition: intproto.h:118
uint8_t Y
Definition: intproto.h:141
uint8_t NumConfigs
Definition: intproto.h:108
Definition: intproto.h:81
Definition: baseapi.cpp:94
Definition: intproto.h:95
uint32_t p[24][24][24][((32 *2)/static_cast< int >(8 *sizeof(uint32_t)))]
Definition: intproto.h:78
Definition: intproto.h:105
uint8_t X
Definition: intproto.h:140
int font_set_id
Definition: intproto.h:112
PROTO_PRUNER ProtoPruner
Definition: intproto.h:96
int8_t A
Definition: intproto.h:82
uint8_t * ProtoLengths
Definition: intproto.h:110
int NumClassPruners
Definition: intproto.h:120
uint8_t Theta
Definition: intproto.h:142
int NumClasses
Definition: intproto.h:119
Definition: intproto.h:132
Definition: intproto.h:76
uint8_t Angle
Definition: intproto.h:85
uint16_t NumProtos
Definition: intproto.h:106