tesseract v5.3.3.20231005
intproto.h File Reference
#include "matchdefs.h"
#include "mfoutline.h"
#include "protos.h"
#include "scrollview.h"
#include "unicharset.h"

Go to the source code of this file.

Classes

struct  tesseract::CLASS_PRUNER_STRUCT
 
struct  tesseract::INT_PROTO_STRUCT
 
struct  tesseract::PROTO_SET_STRUCT
 
struct  tesseract::INT_CLASS_STRUCT
 
struct  tesseract::INT_TEMPLATES_STRUCT
 
struct  tesseract::INT_FEATURE_STRUCT
 

Namespaces

namespace  tesseract
 

Macros

#define PRUNER_X   0
 
#define PRUNER_Y   1
 
#define PRUNER_ANGLE   2
 
#define ANGLE_SHIFT   (0.0)
 
#define X_SHIFT   (0.5)
 
#define Y_SHIFT   (0.5)
 
#define MAX_PROTO_INDEX   24
 
#define BITS_PER_WERD   static_cast<int>(8 * sizeof(uint32_t))
 
#define MAX_NUM_CONFIGS   64
 
#define MAX_NUM_PROTOS   512
 
#define PROTOS_PER_PROTO_SET   64
 
#define MAX_NUM_PROTO_SETS   (MAX_NUM_PROTOS / PROTOS_PER_PROTO_SET)
 
#define NUM_PP_PARAMS   3
 
#define NUM_PP_BUCKETS   64
 
#define NUM_CP_BUCKETS   24
 
#define CLASSES_PER_CP   32
 
#define NUM_BITS_PER_CLASS   2
 
#define CLASS_PRUNER_CLASS_MASK   (~(~0u << NUM_BITS_PER_CLASS))
 
#define CLASSES_PER_CP_WERD   (CLASSES_PER_CP / NUM_BITS_PER_CLASS)
 
#define PROTOS_PER_PP_WERD   BITS_PER_WERD
 
#define BITS_PER_CP_VECTOR   (CLASSES_PER_CP * NUM_BITS_PER_CLASS)
 
#define MAX_NUM_CLASS_PRUNERS   ((MAX_NUM_CLASSES + CLASSES_PER_CP - 1) / CLASSES_PER_CP)
 
#define WERDS_PER_CP_VECTOR   (BITS_PER_CP_VECTOR / BITS_PER_WERD)
 
#define WERDS_PER_PP_VECTOR   ((PROTOS_PER_PROTO_SET + BITS_PER_WERD - 1) / BITS_PER_WERD)
 
#define WERDS_PER_PP   (NUM_PP_PARAMS * NUM_PP_BUCKETS * WERDS_PER_PP_VECTOR)
 
#define WERDS_PER_CP   (NUM_CP_BUCKETS * NUM_CP_BUCKETS * NUM_CP_BUCKETS * WERDS_PER_CP_VECTOR)
 
#define WERDS_PER_CONFIG_VEC   ((MAX_NUM_CONFIGS + BITS_PER_WERD - 1) / BITS_PER_WERD)
 
#define MAX_NUM_INT_FEATURES   512
 
#define INT_CHAR_NORM_RANGE   256
 
#define MaxNumIntProtosIn(C)   (C->NumProtoSets * PROTOS_PER_PROTO_SET)
 
#define SetForProto(P)   (P / PROTOS_PER_PROTO_SET)
 
#define IndexForProto(P)   (P % PROTOS_PER_PROTO_SET)
 
#define ProtoForProtoId(C, P)   (&((C->ProtoSets[SetForProto(P)])->Protos[IndexForProto(P)]))
 
#define PPrunerWordIndexFor(I)   (((I) % PROTOS_PER_PROTO_SET) / PROTOS_PER_PP_WERD)
 
#define PPrunerBitIndexFor(I)   ((I) % PROTOS_PER_PP_WERD)
 
#define PPrunerMaskFor(I)   (1 << PPrunerBitIndexFor(I))
 
#define MaxNumClassesIn(T)   (T->NumClassPruners * CLASSES_PER_CP)
 
#define LegalClassId(c)   ((c) >= 0 && (c) < MAX_NUM_CLASSES)
 
#define UnusedClassIdIn(T, c)   ((T)->Class[c] == nullptr)
 
#define ClassForClassId(T, c)   ((T)->Class[c])
 
#define ClassPrunersFor(T)   ((T)->ClassPruner)
 
#define CPrunerIdFor(c)   ((c) / CLASSES_PER_CP)
 
#define CPrunerFor(T, c)   ((T)->ClassPruners[CPrunerIdFor(c)])
 
#define CPrunerWordIndexFor(c)   (((c) % CLASSES_PER_CP) / CLASSES_PER_CP_WERD)
 
#define CPrunerBitIndexFor(c)   (((c) % CLASSES_PER_CP) % CLASSES_PER_CP_WERD)
 
#define CPrunerMaskFor(L, c)   (((L) + 1) << CPrunerBitIndexFor(c) * NUM_BITS_PER_CLASS)
 
#define PRINT_MATCH_SUMMARY   0x001
 
#define DISPLAY_FEATURE_MATCHES   0x002
 
#define DISPLAY_PROTO_MATCHES   0x004
 
#define PRINT_FEATURE_MATCHES   0x008
 
#define PRINT_PROTO_MATCHES   0x010
 
#define CLIP_MATCH_EVIDENCE   0x020
 
#define MatchDebuggingOn(D)   (D)
 
#define PrintMatchSummaryOn(D)   ((D)&PRINT_MATCH_SUMMARY)
 
#define DisplayFeatureMatchesOn(D)   ((D)&DISPLAY_FEATURE_MATCHES)
 
#define DisplayProtoMatchesOn(D)   ((D)&DISPLAY_PROTO_MATCHES)
 
#define PrintFeatureMatchesOn(D)   ((D)&PRINT_FEATURE_MATCHES)
 
#define PrintProtoMatchesOn(D)   ((D)&PRINT_PROTO_MATCHES)
 
#define ClipMatchEvidenceOn(D)   ((D)&CLIP_MATCH_EVIDENCE)
 

Typedefs

typedef uint32_t tesseract::PROTO_PRUNER[NUM_PP_PARAMS][NUM_PP_BUCKETS][WERDS_PER_PP_VECTOR]
 
typedef uint32_t tesseract::CONFIG_PRUNER[NUM_PP_PARAMS][NUM_PP_BUCKETS][4]
 
typedef INT_FEATURE_STRUCT tesseract::INT_FEATURE_ARRAY[MAX_NUM_INT_FEATURES]
 

Enumerations

enum  tesseract::IntmatcherDebugAction { tesseract::IDA_ADAPTIVE , tesseract::IDA_STATIC , tesseract::IDA_SHAPE_INDEX , tesseract::IDA_BOTH }
 

Functions

void tesseract::AddIntClass (INT_TEMPLATES_STRUCT *Templates, CLASS_ID ClassId, INT_CLASS_STRUCT *Class)
 
int tesseract::AddIntConfig (INT_CLASS_STRUCT *Class)
 
int tesseract::AddIntProto (INT_CLASS_STRUCT *Class)
 
void tesseract::AddProtoToClassPruner (PROTO_STRUCT *Proto, CLASS_ID ClassId, INT_TEMPLATES_STRUCT *Templates)
 
void tesseract::AddProtoToProtoPruner (PROTO_STRUCT *Proto, int ProtoId, INT_CLASS_STRUCT *Class, bool debug)
 
uint8_t tesseract::Bucket8For (float param, float offset, int num_buckets)
 
uint16_t tesseract::Bucket16For (float param, float offset, int num_buckets)
 
uint8_t tesseract::CircBucketFor (float param, float offset, int num_buckets)
 
void tesseract::UpdateMatchDisplay ()
 
void tesseract::ConvertConfig (BIT_VECTOR Config, int ConfigId, INT_CLASS_STRUCT *Class)
 
void tesseract::DisplayIntFeature (const INT_FEATURE_STRUCT *Feature, float Evidence)
 
void tesseract::DisplayIntProto (INT_CLASS_STRUCT *Class, PROTO_ID ProtoId, float Evidence)
 
void tesseract::ShowMatchDisplay ()
 
void tesseract::ClearFeatureSpaceWindow (NORM_METHOD norm_method, ScrollView *window)
 
void tesseract::RenderIntFeature (ScrollView *window, const INT_FEATURE_STRUCT *Feature, ScrollView::Color color)
 
void tesseract::InitIntMatchWindowIfReqd ()
 
void tesseract::InitProtoDisplayWindowIfReqd ()
 
void tesseract::InitFeatureDisplayWindowIfReqd ()
 
ScrollView * tesseract::CreateFeatureSpaceWindow (const char *name, int xpos, int ypos)
 

Macro Definition Documentation

◆ ANGLE_SHIFT

#define ANGLE_SHIFT   (0.0)

Definition at line 40 of file intproto.h.

◆ BITS_PER_CP_VECTOR

#define BITS_PER_CP_VECTOR   (CLASSES_PER_CP * NUM_BITS_PER_CLASS)

Definition at line 59 of file intproto.h.

◆ BITS_PER_WERD

#define BITS_PER_WERD   static_cast<int>(8 * sizeof(uint32_t))

Definition at line 45 of file intproto.h.

◆ CLASS_PRUNER_CLASS_MASK

#define CLASS_PRUNER_CLASS_MASK   (~(~0u << NUM_BITS_PER_CLASS))

Definition at line 56 of file intproto.h.

◆ CLASSES_PER_CP

#define CLASSES_PER_CP   32

Definition at line 54 of file intproto.h.

◆ CLASSES_PER_CP_WERD

#define CLASSES_PER_CP_WERD   (CLASSES_PER_CP / NUM_BITS_PER_CLASS)

Definition at line 57 of file intproto.h.

◆ ClassForClassId

#define ClassForClassId (   T,
 
)    ((T)->Class[c])

Definition at line 156 of file intproto.h.

◆ ClassPrunersFor

#define ClassPrunersFor (   T)    ((T)->ClassPruner)

Definition at line 157 of file intproto.h.

◆ CLIP_MATCH_EVIDENCE

#define CLIP_MATCH_EVIDENCE   0x020

Definition at line 170 of file intproto.h.

◆ ClipMatchEvidenceOn

#define ClipMatchEvidenceOn (   D)    ((D)&CLIP_MATCH_EVIDENCE)

Definition at line 178 of file intproto.h.

◆ CPrunerBitIndexFor

#define CPrunerBitIndexFor (   c)    (((c) % CLASSES_PER_CP) % CLASSES_PER_CP_WERD)

Definition at line 161 of file intproto.h.

◆ CPrunerFor

#define CPrunerFor (   T,
 
)    ((T)->ClassPruners[CPrunerIdFor(c)])

Definition at line 159 of file intproto.h.

◆ CPrunerIdFor

#define CPrunerIdFor (   c)    ((c) / CLASSES_PER_CP)

Definition at line 158 of file intproto.h.

◆ CPrunerMaskFor

#define CPrunerMaskFor (   L,
 
)    (((L) + 1) << CPrunerBitIndexFor(c) * NUM_BITS_PER_CLASS)

Definition at line 162 of file intproto.h.

◆ CPrunerWordIndexFor

#define CPrunerWordIndexFor (   c)    (((c) % CLASSES_PER_CP) / CLASSES_PER_CP_WERD)

Definition at line 160 of file intproto.h.

◆ DISPLAY_FEATURE_MATCHES

#define DISPLAY_FEATURE_MATCHES   0x002

Definition at line 166 of file intproto.h.

◆ DISPLAY_PROTO_MATCHES

#define DISPLAY_PROTO_MATCHES   0x004

Definition at line 167 of file intproto.h.

◆ DisplayFeatureMatchesOn

#define DisplayFeatureMatchesOn (   D)    ((D)&DISPLAY_FEATURE_MATCHES)

Definition at line 174 of file intproto.h.

◆ DisplayProtoMatchesOn

#define DisplayProtoMatchesOn (   D)    ((D)&DISPLAY_PROTO_MATCHES)

Definition at line 175 of file intproto.h.

◆ IndexForProto

#define IndexForProto (   P)    (P % PROTOS_PER_PROTO_SET)

Definition at line 147 of file intproto.h.

◆ INT_CHAR_NORM_RANGE

#define INT_CHAR_NORM_RANGE   256

Definition at line 117 of file intproto.h.

◆ LegalClassId

#define LegalClassId (   c)    ((c) >= 0 && (c) < MAX_NUM_CLASSES)

Definition at line 154 of file intproto.h.

◆ MatchDebuggingOn

#define MatchDebuggingOn (   D)    (D)

Definition at line 172 of file intproto.h.

◆ MAX_NUM_CLASS_PRUNERS

#define MAX_NUM_CLASS_PRUNERS   ((MAX_NUM_CLASSES + CLASSES_PER_CP - 1) / CLASSES_PER_CP)

Definition at line 60 of file intproto.h.

◆ MAX_NUM_CONFIGS

#define MAX_NUM_CONFIGS   64

Definition at line 47 of file intproto.h.

◆ MAX_NUM_INT_FEATURES

#define MAX_NUM_INT_FEATURES   512

Definition at line 116 of file intproto.h.

◆ MAX_NUM_PROTO_SETS

#define MAX_NUM_PROTO_SETS   (MAX_NUM_PROTOS / PROTOS_PER_PROTO_SET)

Definition at line 50 of file intproto.h.

◆ MAX_NUM_PROTOS

#define MAX_NUM_PROTOS   512

Definition at line 48 of file intproto.h.

◆ MAX_PROTO_INDEX

#define MAX_PROTO_INDEX   24

Definition at line 44 of file intproto.h.

◆ MaxNumClassesIn

#define MaxNumClassesIn (   T)    (T->NumClassPruners * CLASSES_PER_CP)

Definition at line 153 of file intproto.h.

◆ MaxNumIntProtosIn

#define MaxNumIntProtosIn (   C)    (C->NumProtoSets * PROTOS_PER_PROTO_SET)

Macros

Definition at line 145 of file intproto.h.

◆ NUM_BITS_PER_CLASS

#define NUM_BITS_PER_CLASS   2

Definition at line 55 of file intproto.h.

◆ NUM_CP_BUCKETS

#define NUM_CP_BUCKETS   24

Definition at line 53 of file intproto.h.

◆ NUM_PP_BUCKETS

#define NUM_PP_BUCKETS   64

Definition at line 52 of file intproto.h.

◆ NUM_PP_PARAMS

#define NUM_PP_PARAMS   3

Definition at line 51 of file intproto.h.

◆ PPrunerBitIndexFor

#define PPrunerBitIndexFor (   I)    ((I) % PROTOS_PER_PP_WERD)

Definition at line 150 of file intproto.h.

◆ PPrunerMaskFor

#define PPrunerMaskFor (   I)    (1 << PPrunerBitIndexFor(I))

Definition at line 151 of file intproto.h.

◆ PPrunerWordIndexFor

#define PPrunerWordIndexFor (   I)    (((I) % PROTOS_PER_PROTO_SET) / PROTOS_PER_PP_WERD)

Definition at line 149 of file intproto.h.

◆ PRINT_FEATURE_MATCHES

#define PRINT_FEATURE_MATCHES   0x008

Definition at line 168 of file intproto.h.

◆ PRINT_MATCH_SUMMARY

#define PRINT_MATCH_SUMMARY   0x001

Definition at line 165 of file intproto.h.

◆ PRINT_PROTO_MATCHES

#define PRINT_PROTO_MATCHES   0x010

Definition at line 169 of file intproto.h.

◆ PrintFeatureMatchesOn

#define PrintFeatureMatchesOn (   D)    ((D)&PRINT_FEATURE_MATCHES)

Definition at line 176 of file intproto.h.

◆ PrintMatchSummaryOn

#define PrintMatchSummaryOn (   D)    ((D)&PRINT_MATCH_SUMMARY)

Definition at line 173 of file intproto.h.

◆ PrintProtoMatchesOn

#define PrintProtoMatchesOn (   D)    ((D)&PRINT_PROTO_MATCHES)

Definition at line 177 of file intproto.h.

◆ ProtoForProtoId

#define ProtoForProtoId (   C,
 
)    (&((C->ProtoSets[SetForProto(P)])->Protos[IndexForProto(P)]))

Definition at line 148 of file intproto.h.

◆ PROTOS_PER_PP_WERD

#define PROTOS_PER_PP_WERD   BITS_PER_WERD

Definition at line 58 of file intproto.h.

◆ PROTOS_PER_PROTO_SET

#define PROTOS_PER_PROTO_SET   64

Definition at line 49 of file intproto.h.

◆ PRUNER_ANGLE

#define PRUNER_ANGLE   2

Definition at line 37 of file intproto.h.

◆ PRUNER_X

#define PRUNER_X   0

Definition at line 35 of file intproto.h.

◆ PRUNER_Y

#define PRUNER_Y   1

Definition at line 36 of file intproto.h.

◆ SetForProto

#define SetForProto (   P)    (P / PROTOS_PER_PROTO_SET)

Definition at line 146 of file intproto.h.

◆ UnusedClassIdIn

#define UnusedClassIdIn (   T,
 
)    ((T)->Class[c] == nullptr)

Definition at line 155 of file intproto.h.

◆ WERDS_PER_CONFIG_VEC

#define WERDS_PER_CONFIG_VEC   ((MAX_NUM_CONFIGS + BITS_PER_WERD - 1) / BITS_PER_WERD)

Definition at line 65 of file intproto.h.

◆ WERDS_PER_CP

Definition at line 64 of file intproto.h.

◆ WERDS_PER_CP_VECTOR

#define WERDS_PER_CP_VECTOR   (BITS_PER_CP_VECTOR / BITS_PER_WERD)

Definition at line 61 of file intproto.h.

◆ WERDS_PER_PP

#define WERDS_PER_PP   (NUM_PP_PARAMS * NUM_PP_BUCKETS * WERDS_PER_PP_VECTOR)

Definition at line 63 of file intproto.h.

◆ WERDS_PER_PP_VECTOR

#define WERDS_PER_PP_VECTOR   ((PROTOS_PER_PROTO_SET + BITS_PER_WERD - 1) / BITS_PER_WERD)

Definition at line 62 of file intproto.h.

◆ X_SHIFT

#define X_SHIFT   (0.5)

Definition at line 41 of file intproto.h.

◆ Y_SHIFT

#define Y_SHIFT   (0.5)

Definition at line 42 of file intproto.h.