mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-12-04 01:39:16 +08:00
Replace GenericVector<WordData> by std::vector<WordData>
This fixes an LGTM alert: This parameter of type WordData is 112 bytes - consider passing a const pointer/reference instead. It might also improve the performance. Signed-off-by: Stefan Weil <sw@weil.de>
This commit is contained in:
parent
fbc807ce99
commit
536a676250
@ -153,7 +153,7 @@ void Tesseract::SetupAllWordsPassN(int pass_n,
|
||||
const TBOX* target_word_box,
|
||||
const char* word_config,
|
||||
PAGE_RES* page_res,
|
||||
GenericVector<WordData>* words) {
|
||||
std::vector<WordData>* words) {
|
||||
// Prepare all the words.
|
||||
PAGE_RES_IT page_res_it(page_res);
|
||||
for (page_res_it.restart_page(); page_res_it.word() != nullptr;
|
||||
@ -210,7 +210,7 @@ void Tesseract::SetupWordPassN(int pass_n, WordData* word) {
|
||||
// Runs word recognition on all the words.
|
||||
bool Tesseract::RecogAllWordsPassN(int pass_n, ETEXT_DESC* monitor,
|
||||
PAGE_RES_IT* pr_it,
|
||||
GenericVector<WordData>* words) {
|
||||
std::vector<WordData>* words) {
|
||||
// TODO(rays) Before this loop can be parallelized (it would yield a massive
|
||||
// speed-up) all remaining member globals need to be converted to local/heap
|
||||
// (eg set_pass1 and set_pass2) and an intermediate adaption pass needs to be
|
||||
@ -336,7 +336,7 @@ bool Tesseract::recog_all_words(PAGE_RES* page_res,
|
||||
|
||||
// Set up all words ready for recognition, so that if parallelism is on
|
||||
// all the input and output classes are ready to run the classifier.
|
||||
GenericVector<WordData> words;
|
||||
std::vector<WordData> words;
|
||||
SetupAllWordsPassN(1, target_word_box, word_config, page_res, &words);
|
||||
#ifndef DISABLED_LEGACY_ENGINE
|
||||
if (tessedit_parallelize) {
|
||||
@ -386,7 +386,7 @@ bool Tesseract::recog_all_words(PAGE_RES* page_res,
|
||||
if (tessedit_tess_adaption_mode != 0x0 && !tessedit_test_adaption &&
|
||||
AnyTessLang()) {
|
||||
page_res_it.restart_page();
|
||||
GenericVector<WordData> words;
|
||||
std::vector<WordData> words;
|
||||
SetupAllWordsPassN(2, target_word_box, word_config, page_res, &words);
|
||||
if (tessedit_parallelize) {
|
||||
PrerecAllWordsPar(words);
|
||||
|
@ -35,7 +35,7 @@ struct BlobData {
|
||||
BLOB_CHOICE_LIST** choices = nullptr;
|
||||
};
|
||||
|
||||
void Tesseract::PrerecAllWordsPar(const GenericVector<WordData>& words) {
|
||||
void Tesseract::PrerecAllWordsPar(const std::vector<WordData>& words) {
|
||||
// Prepare all the blobs.
|
||||
GenericVector<BlobData> blobs;
|
||||
for (int w = 0; w < words.size(); ++w) {
|
||||
|
@ -334,7 +334,7 @@ class Tesseract : public Wordrec {
|
||||
OSResults* osr, TO_BLOCK_LIST* to_blocks, Pix** photo_mask_pix,
|
||||
Pix** music_mask_pix);
|
||||
// par_control.cpp
|
||||
void PrerecAllWordsPar(const GenericVector<WordData>& words);
|
||||
void PrerecAllWordsPar(const std::vector<WordData>& words);
|
||||
|
||||
//// linerec.cpp
|
||||
// Generates training data for training a line recognizer, eg LSTM.
|
||||
@ -380,12 +380,12 @@ class Tesseract : public Wordrec {
|
||||
// Sets up the words ready for whichever engine is to be run
|
||||
void SetupAllWordsPassN(int pass_n, const TBOX* target_word_box,
|
||||
const char* word_config, PAGE_RES* page_res,
|
||||
GenericVector<WordData>* words);
|
||||
std::vector<WordData>* words);
|
||||
// Sets up the single word ready for whichever engine is to be run.
|
||||
void SetupWordPassN(int pass_n, WordData* word);
|
||||
// Runs word recognition on all the words.
|
||||
bool RecogAllWordsPassN(int pass_n, ETEXT_DESC* monitor, PAGE_RES_IT* pr_it,
|
||||
GenericVector<WordData>* words);
|
||||
std::vector<WordData>* words);
|
||||
bool recog_all_words(PAGE_RES* page_res, ETEXT_DESC* monitor,
|
||||
const TBOX* target_word_box, const char* word_config,
|
||||
int dopasses);
|
||||
|
Loading…
Reference in New Issue
Block a user