Commit 32899834 for tesseract
commit 32899834fa6929c03afc7ff02a560d8e75de0ae2
Author: Stefan Weil <sw@weilnetz.de>
Date: Sat Jun 20 16:22:47 2026 +0200
Remove unused function parameters
Signed-off-by: Stefan Weil <sw@weilnetz.de>
diff --git a/src/api/baseapi.cpp b/src/api/baseapi.cpp
index 02279022..0c162837 100644
--- a/src/api/baseapi.cpp
+++ b/src/api/baseapi.cpp
@@ -822,7 +822,7 @@ int TessBaseAPI::Recognize(ETEXT_DESC *monitor) {
} else if (tesseract_->tessedit_ambigs_training) {
FILE *training_output_file = tesseract_->init_recog_training(input_file_.c_str());
// OCR the page segmented into words by tesseract.
- tesseract_->recog_training_segmented(input_file_.c_str(), page_res_, monitor,
+ tesseract_->recog_training_segmented(input_file_.c_str(), page_res_,
training_output_file);
fclose(training_output_file);
#endif // ndef DISABLED_LEGACY_ENGINE
@@ -2139,7 +2139,7 @@ int TessBaseAPI::FindLines() {
// If Devanagari is being recognized, we use different images for page seg
// and for OCR.
- tesseract_->PrepareForTessOCR(block_list_, osd_tess, &osr);
+ tesseract_->PrepareForTessOCR(block_list_);
return 0;
}
diff --git a/src/ccmain/control.cpp b/src/ccmain/control.cpp
index a782393d..bb03492f 100644
--- a/src/ccmain/control.cpp
+++ b/src/ccmain/control.cpp
@@ -1417,7 +1417,7 @@ void Tesseract::classify_word_pass1(const WordData &word_data, WERD_RES **in_wor
#ifndef DISABLED_LEGACY_ENGINE
WERD_RES *word = *in_word;
- match_word_pass_n(1, word, row, block);
+ match_word_pass_n(1, word, row);
if (!word->tess_failed && !word->word->flag(W_REP_CHAR)) {
word->tess_would_adapt = AdaptableWord(word);
bool adapt_ok = word_adaptable(word, tessedit_tess_adaption_mode);
@@ -1506,7 +1506,7 @@ bool Tesseract::TestNewNormalization(int original_misfits, float baseline_shift,
new_x_ht_word.SetupForRecognition(unicharset, this, BestPix(), tessedit_ocr_engine_mode, nullptr,
classify_bln_numeric_mode, textord_use_cjk_fp_model,
poly_allow_detailed_fx, row, block);
- match_word_pass_n(2, &new_x_ht_word, row, block);
+ match_word_pass_n(2, &new_x_ht_word, row);
if (!new_x_ht_word.tess_failed) {
int new_misfits = CountMisfitTops(&new_x_ht_word);
if (debug_x_ht_level >= 1) {
@@ -1558,7 +1558,7 @@ void Tesseract::classify_word_pass2(const WordData &word_data, WERD_RES **in_wor
if (word->x_height == 0.0f) {
word->x_height = row->x_height();
}
- match_word_pass_n(2, word, row, block);
+ match_word_pass_n(2, word, row);
check_debug_pt(word, 40);
}
@@ -1593,7 +1593,7 @@ void Tesseract::classify_word_pass2(const WordData &word_data, WERD_RES **in_wor
*
* Baseline normalize the word and pass it to Tess.
*/
-void Tesseract::match_word_pass_n(int pass_n, WERD_RES *word, ROW *row, BLOCK *block) {
+void Tesseract::match_word_pass_n(int pass_n, WERD_RES *word, ROW *row) {
if (word->tess_failed) {
return;
}
@@ -1616,7 +1616,7 @@ void Tesseract::match_word_pass_n(int pass_n, WERD_RES *word, ROW *row, BLOCK *b
word->tess_accepted = tess_acceptable_word(word);
// Also sets word->done flag
- make_reject_map(word, row, pass_n);
+ make_reject_map(word, pass_n);
}
}
set_word_fonts(word);
diff --git a/src/ccmain/paragraphs.cpp b/src/ccmain/paragraphs.cpp
index bf802a61..12866ebc 100644
--- a/src/ccmain/paragraphs.cpp
+++ b/src/ccmain/paragraphs.cpp
@@ -866,7 +866,7 @@ static void CalculateTabStops(std::vector<RowScratchRegisters> *rows, int row_st
// We mark a line as short (end of paragraph) if the offside indent
// is greater than eop_threshold.
static void MarkRowsWithModel(std::vector<RowScratchRegisters> *rows, int row_start, int row_end,
- const ParagraphModel *model, bool ltr, int eop_threshold) {
+ const ParagraphModel *model, int eop_threshold) {
if (!AcceptableRowArgs(0, 0, __func__, rows, row_start, row_end)) {
return;
}
@@ -1099,7 +1099,7 @@ static void GeometricClassifyThreeTabStopTextBlock(int debug_level, GeometricCla
}
}
const ParagraphModel *model = theory->AddModel(s.Model());
- MarkRowsWithModel(s.rows, s.row_start, s.row_end, model, s.ltr, s.eop_threshold);
+ MarkRowsWithModel(s.rows, s.row_start, s.row_end, model, s.eop_threshold);
return;
}
@@ -1263,7 +1263,7 @@ static void GeometricClassify(int debug_level, std::vector<RowScratchRegisters>
}
}
}
- MarkRowsWithModel(rows, row_start, row_end, model, s.ltr, s.eop_threshold);
+ MarkRowsWithModel(rows, row_start, row_end, model, s.eop_threshold);
}
// =============== Implementation of ParagraphTheory =====================
@@ -1541,7 +1541,7 @@ static void DiscardUnusedModels(const std::vector<RowScratchRegisters> &rows,
// Comb backwards through the row scratch registers, and turn any
// sequences of body lines of equivalent type abutted against the beginning
// or a body or start line of a different type into a crown paragraph.
-static void DowngradeWeakestToCrowns(int debug_level, ParagraphTheory *theory,
+static void DowngradeWeakestToCrowns(ParagraphTheory *theory,
std::vector<RowScratchRegisters> *rows) {
int start;
for (int end = rows->size(); end > 0; end = start) {
@@ -2080,8 +2080,7 @@ static void SeparateSimpleLeaderLines(std::vector<RowScratchRegisters> *rows, in
// Collect sequences of unique hypotheses in row registers and create proper
// paragraphs for them, referencing the paragraphs in row_owners.
-static void ConvertHypothesizedModelRunsToParagraphs(int debug_level,
- std::vector<RowScratchRegisters> &rows,
+static void ConvertHypothesizedModelRunsToParagraphs(std::vector<RowScratchRegisters> &rows,
std::vector<PARA *> *row_owners,
ParagraphTheory *theory) {
int end = rows.size();
@@ -2377,7 +2376,7 @@ void DetectParagraphs(int debug_level, std::vector<RowInfo> *row_infos,
}
// Undo any flush models for which there's little evidence.
- DowngradeWeakestToCrowns(debug_level, &theory, &rows);
+ DowngradeWeakestToCrowns(&theory, &rows);
DebugDump(debug_level > 1, "End of Pass 3", theory, rows);
@@ -2393,7 +2392,7 @@ void DetectParagraphs(int debug_level, std::vector<RowInfo> *row_infos,
DebugDump(debug_level > 1, "End of Pass 4", theory, rows);
// Convert all of the unique hypothesis runs to PARAs.
- ConvertHypothesizedModelRunsToParagraphs(debug_level, rows, row_owners, &theory);
+ ConvertHypothesizedModelRunsToParagraphs(rows, row_owners, &theory);
DebugDump(debug_level > 0, "Final Paragraph Segmentation", theory, rows);
diff --git a/src/ccmain/recogtraining.cpp b/src/ccmain/recogtraining.cpp
index af63dec0..02c60a6d 100644
--- a/src/ccmain/recogtraining.cpp
+++ b/src/ccmain/recogtraining.cpp
@@ -84,7 +84,7 @@ static bool read_t(PAGE_RES_IT *page_res_it, TBOX *tbox) {
// single bounding box from the input box file) it outputs the ocred result,
// the correct label, rating and certainty.
void Tesseract::recog_training_segmented(const char *filename, PAGE_RES *page_res,
- volatile ETEXT_DESC *monitor, FILE *output_file) {
+ FILE *output_file) {
std::string box_fname = filename;
const char *lastdot = strrchr(box_fname.c_str(), '.');
if (lastdot != nullptr) {
diff --git a/src/ccmain/reject.cpp b/src/ccmain/reject.cpp
index a8164624..6e370f19 100644
--- a/src/ccmain/reject.cpp
+++ b/src/ccmain/reject.cpp
@@ -93,7 +93,7 @@ void Tesseract::set_done(WERD_RES *word, int16_t pass) {
*
* Sets a reject map for the word.
*************************************************************************/
-void Tesseract::make_reject_map(WERD_RES *word, ROW *row, int16_t pass) {
+void Tesseract::make_reject_map(WERD_RES *word, int16_t pass) {
flip_0O(word);
check_debug_pt(word, -1); // For trap only
set_done(word, pass); // Set acceptance
@@ -560,7 +560,7 @@ void Tesseract::reject_mostly_rejects(WERD_RES *word) {
}
}
-bool Tesseract::repeated_nonalphanum_wd(WERD_RES *word, ROW *row) {
+bool Tesseract::repeated_nonalphanum_wd(WERD_RES *word) {
if (word->best_choice->unichar_lengths().length() <= 1) {
return false;
}
diff --git a/src/ccmain/tessedit.cpp b/src/ccmain/tessedit.cpp
index c7518883..f5e7cce3 100644
--- a/src/ccmain/tessedit.cpp
+++ b/src/ccmain/tessedit.cpp
@@ -73,8 +73,7 @@ void Tesseract::read_config_file(const char *filename, SetParamConstraint constr
// from the language-specific config file (stored in [lang].traineddata), from
// the config files specified on the command line or left as the default
// OEM_TESSERACT_ONLY if none of the configs specify this variable.
-bool Tesseract::init_tesseract_lang_data(const std::string &arg0,
- const std::string &language, OcrEngineMode oem,
+bool Tesseract::init_tesseract_lang_data(const std::string &language, OcrEngineMode oem,
char **configs, int configs_size,
const std::vector<std::string> *vars_vec,
const std::vector<std::string> *vars_values,
@@ -398,7 +397,7 @@ int Tesseract::init_tesseract_internal(const std::string &arg0, const std::strin
const std::vector<std::string> *vars_vec,
const std::vector<std::string> *vars_values,
bool set_only_non_debug_params, TessdataManager *mgr) {
- if (!init_tesseract_lang_data(arg0, language, oem, configs, configs_size, vars_vec,
+ if (!init_tesseract_lang_data(language, oem, configs, configs_size, vars_vec,
vars_values, set_only_non_debug_params, mgr)) {
return -1;
}
diff --git a/src/ccmain/tesseractclass.cpp b/src/ccmain/tesseractclass.cpp
index bc81aefb..f1406913 100644
--- a/src/ccmain/tesseractclass.cpp
+++ b/src/ccmain/tesseractclass.cpp
@@ -589,7 +589,7 @@ void Tesseract::PrepareForPageseg() {
// Note that this method resets pix_binary_ to the original binarized image,
// which may be different from the image actually used for OCR depending on the
// value of devanagari_ocr_split_strategy.
-void Tesseract::PrepareForTessOCR(BLOCK_LIST *block_list, Tesseract *osd_tess, OSResults *osr) {
+void Tesseract::PrepareForTessOCR(BLOCK_LIST *block_list) {
// Find the max splitter strategy over all langs.
auto max_ocr_strategy = static_cast<ShiroRekhaSplitter::SplitStrategy>(
static_cast<int32_t>(ocr_devanagari_split_strategy));
diff --git a/src/ccmain/tesseractclass.h b/src/ccmain/tesseractclass.h
index 108d1cad..d68dae8d 100644
--- a/src/ccmain/tesseractclass.h
+++ b/src/ccmain/tesseractclass.h
@@ -326,7 +326,7 @@ public:
// Uses the strategy specified in the global variable
// ocr_devanagari_split_strategy for performing splitting while preparing for
// Tesseract ocr.
- void PrepareForTessOCR(BLOCK_LIST *block_list, Tesseract *osd_tess, OSResults *osr);
+ void PrepareForTessOCR(BLOCK_LIST *block_list);
int SegmentPage(const char *input_file, BLOCK_LIST *blocks, Tesseract *osd_tess, OSResults *osr);
void SetupWordScripts(BLOCK_LIST *blocks);
@@ -445,8 +445,8 @@ public:
ACCEPTABLE_WERD_TYPE acceptable_word_string(const UNICHARSET &char_set, const char *s,
const char *lengths);
ACCEPTABLE_WERD_TYPE check_abbreviation(const UNICHARSET &char_set, const char *s,
- const char *lengths, ACCEPTABLE_WERD_TYPE word_type);
- void match_word_pass_n(int pass_n, WERD_RES *word, ROW *row, BLOCK *block);
+ const char *lengths, ACCEPTABLE_WERD_TYPE word_type);
+ void match_word_pass_n(int pass_n, WERD_RES *word, ROW *row);
void classify_word_pass2(const WordData &word_data, WERD_RES **in_word,
PointerVector<WERD_RES> *out_words);
void ReportXhtFixResult(bool accept_new_word, float new_x_ht, WERD_RES *word, WERD_RES *new_word);
@@ -534,8 +534,7 @@ public:
void recognize_page(std::string &image_name);
void end_tesseract();
- bool init_tesseract_lang_data(const std::string &arg0,
- const std::string &language, OcrEngineMode oem, char **configs,
+ bool init_tesseract_lang_data(const std::string &language, OcrEngineMode oem, char **configs,
int configs_size, const std::vector<std::string> *vars_vec,
const std::vector<std::string> *vars_values,
bool set_only_non_debug_params, TessdataManager *mgr);
@@ -567,7 +566,7 @@ public:
void blob_feature_display(PAGE_RES *page_res, const TBOX &selection_box);
//// reject.h //////////////////////////////////////////////////////////
// make rej map for word
- void make_reject_map(WERD_RES *word, ROW *row, int16_t pass);
+ void make_reject_map(WERD_RES *word, int16_t pass);
bool one_ell_conflict(WERD_RES *word_res, bool update_map);
int16_t first_alphanum_index(const char *word, const char *word_lengths);
int16_t first_alphanum_offset(const char *word, const char *word_lengths);
@@ -579,7 +578,7 @@ public:
void flip_0O(WERD_RES *word);
bool non_0_digit(const UNICHARSET &ch_set, UNICHAR_ID unichar_id);
bool non_O_upper(const UNICHARSET &ch_set, UNICHAR_ID unichar_id);
- bool repeated_nonalphanum_wd(WERD_RES *word, ROW *row);
+ bool repeated_nonalphanum_wd(WERD_RES *word);
void nn_match_word( // Match a word
WERD_RES *word, ROW *row);
void nn_recover_rejects(WERD_RES *word, ROW *row);
@@ -973,7 +972,7 @@ public:
//// ambigsrecog.cpp /////////////////////////////////////////////////////////
FILE *init_recog_training(const char *filename);
void recog_training_segmented(const char *filename, PAGE_RES *page_res,
- volatile ETEXT_DESC *monitor, FILE *output_file);
+ FILE *output_file);
void ambigs_classify_and_output(const char *label, PAGE_RES_IT *pr_it, FILE *output_file);
private: