Merge pull request #3114 from stweil/globaloc

Remove dummy functions from globaloc.cpp and related code
This commit is contained in:
zdenop 2020-10-05 07:31:02 +02:00 committed by GitHub
commit 755e156c14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 1 additions and 117 deletions

View File

@ -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
@ -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

View File

@ -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())
@ -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.
@ -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) {
@ -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);
}
}
@ -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;
@ -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) {
@ -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
}

View File

@ -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:
@ -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

View File

@ -1,37 +0,0 @@
/**********************************************************************
* File: errcode.cpp (Formerly error.c)
* Description: Generic error handler function
* Author: Ray Smith
*
* (C) Copyright 1989, Hewlett-Packard Ltd.
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
** http://www.apache.org/licenses/LICENSE-2.0
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*
**********************************************************************/
#include "globaloc.h"
#include "allheaders.h"
#include "errcode.h"
#include "tprintf.h"
// TODO: remove empty function?
void set_global_loc_code(int loc_code) {
// global_loc_code = loc_code;
}
// TODO: remove empty function?
void set_global_subloc_code(int loc_code) {
// global_subloc_code = loc_code;
}
// TODO: remove empty function?
void set_global_subsubloc_code(int loc_code) {
// global_subsubloc_code = loc_code;
}

View File

@ -1,29 +0,0 @@
/**********************************************************************
* File: globaloc.h (Formerly error.h)
* Description: Header file for generic error handler class
* Author: Ray Smith
*
* (C) Copyright 1990, Hewlett-Packard Ltd.
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
** http://www.apache.org/licenses/LICENSE-2.0
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*
**********************************************************************/
#ifndef GLOBALOC_H
#define GLOBALOC_H
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

View File

@ -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
@ -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()) {