#include <indexmapbidi.h>
Definition at line 102 of file indexmapbidi.h.
◆ ~IndexMapBiDi()
virtual tesseract::IndexMapBiDi::~IndexMapBiDi |
( |
| ) |
|
|
inlinevirtual |
◆ CompleteMerges()
void tesseract::IndexMapBiDi::CompleteMerges |
( |
| ) |
|
Definition at line 153 of file indexmapbidi.cpp.
155 int compact_size = 0;
156 for (
int i = 0; i < sparse_map_.
size(); ++i) {
157 int compact_index = MasterCompactIndex(sparse_map_[i]);
158 sparse_map_[i] = compact_index;
159 if (compact_index >= compact_size)
160 compact_size = compact_index + 1;
164 for (
int i = 0; i < sparse_map_.
size(); ++i) {
165 if (sparse_map_[i] >= 0) {
177 tmp_compact_map[i] = compact_size;
183 for (
int i = 0; i < sparse_map_.
size(); ++i) {
184 if (sparse_map_[i] >= 0) {
185 sparse_map_[i] = tmp_compact_map[sparse_map_[i]];
GenericVector< inT32 > compact_map_
void init_to_size(int size, T t)
◆ CopyFrom()
void tesseract::IndexMapBiDi::CopyFrom |
( |
const IndexMapBiDi & |
src | ) |
|
Definition at line 112 of file indexmapbidi.cpp.
113 sparse_map_ = src.sparse_map_;
GenericVector< inT32 > compact_map_
◆ DeSerialize()
bool tesseract::IndexMapBiDi::DeSerialize |
( |
bool |
swap, |
|
|
FILE * |
fp |
|
) |
| |
Definition at line 209 of file indexmapbidi.cpp.
212 if (!remaining_pairs.
DeSerialize(swap, fp))
return false;
217 for (
int i = 0; i < remaining_pairs.
size(); ++i) {
218 int sparse_index = remaining_pairs[i++];
219 sparse_map_[sparse_index] = remaining_pairs[i];
GenericVector< inT32 > compact_map_
bool DeSerialize(bool swap, FILE *fp)
void init_to_size(int size, T t)
bool DeSerialize(bool swap, FILE *fp)
◆ Init()
void tesseract::IndexMapBiDi::Init |
( |
int |
size, |
|
|
bool |
all_mapped |
|
) |
| |
Definition at line 79 of file indexmapbidi.cpp.
82 for (
int i = 0; i < size; ++i)
void init_to_size(int size, T t)
◆ InitAndSetupRange()
void tesseract::IndexMapBiDi::InitAndSetupRange |
( |
int |
sparse_size, |
|
|
int |
start, |
|
|
int |
end |
|
) |
| |
Definition at line 68 of file indexmapbidi.cpp.
69 Init(sparse_size,
false);
70 for (
int i = start; i < end; ++i)
void Init(int size, bool all_mapped)
void SetMap(int sparse_index, bool mapped)
◆ IsCompactDeleted()
bool tesseract::IndexMapBiDi::IsCompactDeleted |
( |
int |
index | ) |
const |
|
inline |
Definition at line 130 of file indexmapbidi.h.
131 return MasterCompactIndex(index) < 0;
◆ MapFeatures()
Definition at line 229 of file indexmapbidi.cpp.
232 int num_features = sparse.
size();
233 int missed_features = 0;
234 int prev_good_feature = -1;
235 for (
int f = 0; f < num_features; ++f) {
236 int feature = sparse_map_[sparse[f]];
238 if (feature != prev_good_feature) {
240 prev_good_feature = feature;
246 return missed_features;
◆ Merge()
bool tesseract::IndexMapBiDi::Merge |
( |
int |
compact_index1, |
|
|
int |
compact_index2 |
|
) |
| |
Definition at line 121 of file indexmapbidi.cpp.
123 compact_index1 = MasterCompactIndex(compact_index1);
124 compact_index2 = MasterCompactIndex(compact_index2);
126 if (compact_index1 > compact_index2) {
127 int tmp = compact_index1;
128 compact_index1 = compact_index2;
129 compact_index2 = tmp;
130 }
else if (compact_index1 == compact_index2) {
137 sparse_map_[
compact_map_[compact_index2]] = compact_index1;
138 if (compact_index1 >= 0)
GenericVector< inT32 > compact_map_
◆ Serialize()
bool tesseract::IndexMapBiDi::Serialize |
( |
FILE * |
fp | ) |
const |
Definition at line 191 of file indexmapbidi.cpp.
197 for (
int i = 0; i < sparse_map_.
size(); ++i) {
198 if (sparse_map_[i] >= 0 &&
compact_map_[sparse_map_[i]] != i) {
200 remaining_pairs.
push_back(sparse_map_[i]);
203 if (!remaining_pairs.
Serialize(fp))
return false;
bool Serialize(FILE *fp) const
bool Serialize(FILE *fp) const
GenericVector< inT32 > compact_map_
◆ SetMap()
void tesseract::IndexMapBiDi::SetMap |
( |
int |
sparse_index, |
|
|
bool |
mapped |
|
) |
| |
Definition at line 88 of file indexmapbidi.cpp.
89 sparse_map_[sparse_index] = mapped ? 0 : -1;
◆ Setup()
void tesseract::IndexMapBiDi::Setup |
( |
| ) |
|
Definition at line 95 of file indexmapbidi.cpp.
97 for (
int i = 0; i < sparse_map_.
size(); ++i) {
98 if (sparse_map_[i] >= 0) {
99 sparse_map_[i] = compact_size++;
103 for (
int i = 0; i < sparse_map_.
size(); ++i) {
104 if (sparse_map_[i] >= 0) {
GenericVector< inT32 > compact_map_
void init_to_size(int size, T t)
◆ SparseSize()
virtual int tesseract::IndexMapBiDi::SparseSize |
( |
| ) |
const |
|
inlinevirtual |
◆ SparseToCompact()
virtual int tesseract::IndexMapBiDi::SparseToCompact |
( |
int |
sparse_index | ) |
const |
|
inlinevirtual |
The documentation for this class was generated from the following files: