mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-12-12 07:29:07 +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 TBOX* target_word_box,
|
||||||
const char* word_config,
|
const char* word_config,
|
||||||
PAGE_RES* page_res,
|
PAGE_RES* page_res,
|
||||||
GenericVector<WordData>* words) {
|
std::vector<WordData>* words) {
|
||||||
// Prepare all the words.
|
// Prepare all the words.
|
||||||
PAGE_RES_IT page_res_it(page_res);
|
PAGE_RES_IT page_res_it(page_res);
|
||||||
for (page_res_it.restart_page(); page_res_it.word() != nullptr;
|
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.
|
// Runs word recognition on all the words.
|
||||||
bool Tesseract::RecogAllWordsPassN(int pass_n, ETEXT_DESC* monitor,
|
bool Tesseract::RecogAllWordsPassN(int pass_n, ETEXT_DESC* monitor,
|
||||||
PAGE_RES_IT* pr_it,
|
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
|
// 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
|
// 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
|
// (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
|
// 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.
|
// 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);
|
SetupAllWordsPassN(1, target_word_box, word_config, page_res, &words);
|
||||||
#ifndef DISABLED_LEGACY_ENGINE
|
#ifndef DISABLED_LEGACY_ENGINE
|
||||||
if (tessedit_parallelize) {
|
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 &&
|
if (tessedit_tess_adaption_mode != 0x0 && !tessedit_test_adaption &&
|
||||||
AnyTessLang()) {
|
AnyTessLang()) {
|
||||||
page_res_it.restart_page();
|
page_res_it.restart_page();
|
||||||
GenericVector<WordData> words;
|
std::vector<WordData> words;
|
||||||
SetupAllWordsPassN(2, target_word_box, word_config, page_res, &words);
|
SetupAllWordsPassN(2, target_word_box, word_config, page_res, &words);
|
||||||
if (tessedit_parallelize) {
|
if (tessedit_parallelize) {
|
||||||
PrerecAllWordsPar(words);
|
PrerecAllWordsPar(words);
|
||||||
|
@ -35,7 +35,7 @@ struct BlobData {
|
|||||||
BLOB_CHOICE_LIST** choices = nullptr;
|
BLOB_CHOICE_LIST** choices = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
void Tesseract::PrerecAllWordsPar(const GenericVector<WordData>& words) {
|
void Tesseract::PrerecAllWordsPar(const std::vector<WordData>& words) {
|
||||||
// Prepare all the blobs.
|
// Prepare all the blobs.
|
||||||
GenericVector<BlobData> blobs;
|
GenericVector<BlobData> blobs;
|
||||||
for (int w = 0; w < words.size(); ++w) {
|
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,
|
OSResults* osr, TO_BLOCK_LIST* to_blocks, Pix** photo_mask_pix,
|
||||||
Pix** music_mask_pix);
|
Pix** music_mask_pix);
|
||||||
// par_control.cpp
|
// par_control.cpp
|
||||||
void PrerecAllWordsPar(const GenericVector<WordData>& words);
|
void PrerecAllWordsPar(const std::vector<WordData>& words);
|
||||||
|
|
||||||
//// linerec.cpp
|
//// linerec.cpp
|
||||||
// Generates training data for training a line recognizer, eg LSTM.
|
// 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
|
// Sets up the words ready for whichever engine is to be run
|
||||||
void SetupAllWordsPassN(int pass_n, const TBOX* target_word_box,
|
void SetupAllWordsPassN(int pass_n, const TBOX* target_word_box,
|
||||||
const char* word_config, PAGE_RES* page_res,
|
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.
|
// Sets up the single word ready for whichever engine is to be run.
|
||||||
void SetupWordPassN(int pass_n, WordData* word);
|
void SetupWordPassN(int pass_n, WordData* word);
|
||||||
// Runs word recognition on all the words.
|
// Runs word recognition on all the words.
|
||||||
bool RecogAllWordsPassN(int pass_n, ETEXT_DESC* monitor, PAGE_RES_IT* pr_it,
|
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,
|
bool recog_all_words(PAGE_RES* page_res, ETEXT_DESC* monitor,
|
||||||
const TBOX* target_word_box, const char* word_config,
|
const TBOX* target_word_box, const char* word_config,
|
||||||
int dopasses);
|
int dopasses);
|
||||||
|
Loading…
Reference in New Issue
Block a user