Skip to content

Commit

Permalink
Merge pull request tesseract-ocr#3114 from stweil/globaloc
Browse files Browse the repository at this point in the history
Remove dummy functions from globaloc.cpp and related code
  • Loading branch information
zdenop authored Oct 5, 2020
2 parents 0ded9f3 + ac14ab3 commit 755e156
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 117 deletions.
2 changes: 0 additions & 2 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,6 @@ noinst_HEADERS += src/ccutil/elst.h
noinst_HEADERS += src/ccutil/errcode.h
noinst_HEADERS += src/ccutil/fileerr.h
noinst_HEADERS += src/ccutil/genericheap.h
noinst_HEADERS += src/ccutil/globaloc.h
noinst_HEADERS += src/ccutil/host.h
noinst_HEADERS += src/ccutil/kdpair.h
noinst_HEADERS += src/ccutil/lsterr.h
Expand Down Expand Up @@ -376,7 +375,6 @@ libtesseract_ccutil_la_SOURCES += src/ccutil/clst.cpp
libtesseract_ccutil_la_SOURCES += src/ccutil/elst2.cpp
libtesseract_ccutil_la_SOURCES += src/ccutil/elst.cpp
libtesseract_ccutil_la_SOURCES += src/ccutil/errcode.cpp
libtesseract_ccutil_la_SOURCES += src/ccutil/globaloc.cpp
libtesseract_ccutil_la_SOURCES += src/ccutil/mainblk.cpp
libtesseract_ccutil_la_SOURCES += src/ccutil/serialis.cpp
libtesseract_ccutil_la_SOURCES += src/ccutil/strngs.cpp
Expand Down
8 changes: 0 additions & 8 deletions src/ccmain/control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,6 @@ bool Tesseract::recog_all_words(PAGE_RES* page_res,
if (AnyTessLang() && !AnyLSTMLang()) {
// ****************** Pass 3 *******************
// Fix fuzzy spaces.
set_global_loc_code(LOC_FUZZY_SPACE);

if (!tessedit_test_adaption && tessedit_fix_fuzzy_spaces
&& !tessedit_word_for_word && !right_to_left())
Expand All @@ -425,7 +424,6 @@ bool Tesseract::recog_all_words(PAGE_RES* page_res,
#endif // ndef DISABLED_LEGACY_ENGINE

// Write results pass.
set_global_loc_code(LOC_WRITE_RESULTS);
// This is now redundant, but retained commented so show how to obtain
// bounding boxes and style information.

Expand Down Expand Up @@ -616,7 +614,6 @@ void Tesseract::rejection_passes(PAGE_RES* page_res,
// Gather statistics on rejects.
int word_index = 0;
while (!tessedit_test_adaption && page_res_it.word() != nullptr) {
set_global_loc_code(LOC_MM_ADAPT);
WERD_RES* word = page_res_it.word();
word_index++;
if (monitor != nullptr) {
Expand Down Expand Up @@ -697,7 +694,6 @@ void Tesseract::rejection_passes(PAGE_RES* page_res,
// ****************** Pass 6 *******************
// Do whole document or whole block rejection pass
if (!tessedit_test_adaption) {
set_global_loc_code(LOC_DOC_BLK_REJ);
quality_based_rejection(page_res_it, good_quality_doc);
}
}
Expand Down Expand Up @@ -1580,7 +1576,6 @@ void Tesseract::classify_word_pass2(const WordData& word_data,
prev_word_best_choice_ = word_data.prev_word != nullptr
? word_data.prev_word->word->best_choice : nullptr;

set_global_subloc_code(SUBLOC_NORM);
check_debug_pt(word, 30);
if (!word->done) {
word->caps_height = 0.0;
Expand All @@ -1598,8 +1593,6 @@ void Tesseract::classify_word_pass2(const WordData& word_data,
// Use the tops and bottoms since they are available.
TrainedXheightFix(word, block, row);
}

set_global_subloc_code(SUBLOC_NORM);
}
#ifndef GRAPHICS_DISABLED
if (tessedit_display_outwords) {
Expand All @@ -1613,7 +1606,6 @@ void Tesseract::classify_word_pass2(const WordData& word_data,
ScrollView::Update();
}
#endif
set_global_subloc_code(SUBLOC_NORM);
check_debug_pt(word, 50);
#endif // ndef DISABLED_LEGACY_ENGINE
}
Expand Down
38 changes: 0 additions & 38 deletions src/ccutil/errcode.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,36 +35,6 @@ enum TessErrorLogCode {
#define MEMORY_ABORT 2
#define FILE_ABORT 3

/* Location of code at error codes Reserve 0..2 (status codes 0..23 for UNLV)*/
#define LOC_UNUSED0 0
#define LOC_UNUSED1 1
#define LOC_UNUSED2 2
#define LOC_INIT 3
#define LOC_EDGE_PROG 4
#define LOC_TEXT_ORD_ROWS 5
#define LOC_TEXT_ORD_WORDS 6
#define LOC_PASS1 7
#define LOC_PASS2 8
/* Reserve up to 8..13 for adding subloc 0/3 plus subsubloc 0/1/2 */
#define LOC_FUZZY_SPACE 14
/* Reserve up to 14..20 for adding subloc 0/3 plus subsubloc 0/1/2 */
#define LOC_MM_ADAPT 21
#define LOC_DOC_BLK_REJ 22
#define LOC_WRITE_RESULTS 23
#define LOC_ADAPTIVE 24
/* DON'T DEFINE ANY LOCATION > 31 !!! */

/* Sub locatation determines whether pass2 was in normal mode or fix xht mode*/
#define SUBLOC_NORM 0
#define SUBLOC_FIX_XHT 3

/* Sub Sub locatation determines whether match_word_pass2 was in Tess
matcher, NN matcher or somewhere else */

#define SUBSUBLOC_OTHER 0
#define SUBSUBLOC_TESS 1
#define SUBSUBLOC_NN 2

class TESS_API ERRCODE { // error handler class
const char *message; // error message
public:
Expand Down Expand Up @@ -95,12 +65,4 @@ constexpr ERRCODE ASSERT_FAILED("Assert failed");
ASSERT_FAILED.error(#x, ABORT, "in file %s, line %d", __FILE__, __LINE__); \
}

void signal_exit(int signal_code);

void set_global_loc_code(int loc_code);

void set_global_subloc_code(int loc_code);

void set_global_subsubloc_code(int loc_code);

#endif
37 changes: 0 additions & 37 deletions src/ccutil/globaloc.cpp

This file was deleted.

29 changes: 0 additions & 29 deletions src/ccutil/globaloc.h

This file was deleted.

4 changes: 1 addition & 3 deletions src/textord/tordmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include "coutln.h" // for C_OUTLINE_IT, C_OUTLINE_LIST, C_OUTLINE
#include "drawtord.h" // for plot_box_list, to_win, create_to_win
#include "edgblob.h" // for extract_edges
#include "errcode.h" // for set_global_loc_code, ASSERT_HOST, LOC...
#include "errcode.h" // for ASSERT_HOST, ...
#include <tesseract/genericvector.h> // for PointerVector, GenericVector
#include "makerow.h" // for textord_test_x, textord_test_y, texto...
#include "morph.h" // for L_BOUNDARY_BG
Expand Down Expand Up @@ -225,8 +225,6 @@ void Textord::find_components(Pix* pix, BLOCK_LIST *blocks,
return; // Can't handle it.
}

set_global_loc_code(LOC_EDGE_PROG);

BLOCK_IT block_it(blocks); // iterator
for (block_it.mark_cycle_pt(); !block_it.cycled_list();
block_it.forward()) {
Expand Down

0 comments on commit 755e156

Please sign in to comment.