Commit dd69fb30 for tesseract

commit dd69fb3068012fb7d38b5f1cebc448dae26e70e9
Author: Stefan Weil <sw@weilnetz.de>
Date:   Sun Jun 21 00:05:21 2026 +0200

    Remove more unused function parameters

    Signed-off-by: Stefan Weil <sw@weilnetz.de>

diff --git a/src/lstm/fullyconnected.cpp b/src/lstm/fullyconnected.cpp
index 85989f40..16204344 100644
--- a/src/lstm/fullyconnected.cpp
+++ b/src/lstm/fullyconnected.cpp
@@ -200,7 +200,7 @@ void FullyConnected::SetupForward(const NetworkIO &input, const TransposedArray
   }
 }

-void FullyConnected::ForwardTimeStep(int t, TFloat *output_line) {
+void FullyConnected::ForwardTimeStep(TFloat *output_line) {
   if (type_ == NT_TANH) {
     FuncInplace<GFunc>(no_, output_line);
   } else if (type_ == NT_LOGISTIC) {
@@ -224,13 +224,13 @@ void FullyConnected::ForwardTimeStep(const TFloat *d_input, int t, TFloat *outpu
     source_t_.WriteStrided(t, d_input);
   }
   weights_.MatrixDotVector(d_input, output_line);
-  ForwardTimeStep(t, output_line);
+  ForwardTimeStep(output_line);
 }

 void FullyConnected::ForwardTimeStep(const int8_t *i_input, int t, TFloat *output_line) {
   // input is copied to source_ line-by-line for cache coherency.
   weights_.MatrixDotVector(i_input, output_line);
-  ForwardTimeStep(t, output_line);
+  ForwardTimeStep(output_line);
 }

 // Runs backward propagation of errors on the deltas line.
diff --git a/src/lstm/fullyconnected.h b/src/lstm/fullyconnected.h
index 0dbd4605..599913a5 100644
--- a/src/lstm/fullyconnected.h
+++ b/src/lstm/fullyconnected.h
@@ -91,7 +91,7 @@ public:
                NetworkScratch *scratch, NetworkIO *output) override;
   // Components of Forward so FullyConnected can be reused inside LSTM.
   void SetupForward(const NetworkIO &input, const TransposedArray *input_transpose);
-  void ForwardTimeStep(int t, TFloat *output_line);
+  void ForwardTimeStep(TFloat *output_line);
   void ForwardTimeStep(const TFloat *d_input, int t, TFloat *output_line);
   void ForwardTimeStep(const int8_t *i_input, int t, TFloat *output_line);

diff --git a/src/lstm/input.cpp b/src/lstm/input.cpp
index 22cf09f4..06ebf803 100644
--- a/src/lstm/input.cpp
+++ b/src/lstm/input.cpp
@@ -79,7 +79,7 @@ bool Input::Backward(bool debug, const NetworkIO &fwd_deltas, NetworkScratch *sc
 // Returns nullptr on error.
 /* static */
 Image Input::PrepareLSTMInputs(const ImageData &image_data, const Network *network, int min_width,
-                              TRand *randomizer, float *image_scale) {
+                               float *image_scale) {
   // Note that NumInputs() is defined as input image height.
   int target_height = network->NumInputs();
   int width, height;
diff --git a/src/lstm/input.h b/src/lstm/input.h
index 4ec870d8..719ab2fc 100644
--- a/src/lstm/input.h
+++ b/src/lstm/input.h
@@ -83,7 +83,7 @@ public:
   /* static */
   static Image PrepareLSTMInputs(const ImageData &image_data,
                                  const Network *network, int min_width,
-                                 TRand *randomizer, float *image_scale);
+                                 float *image_scale);
   // Converts the given pix to a NetworkIO of height and depth appropriate to
   // the given StaticShape:
   // If depth == 3, convert to 24 bit color, otherwise normalized grey.
diff --git a/src/lstm/lstmrecognizer.cpp b/src/lstm/lstmrecognizer.cpp
index 43a18c36..f8e63505 100644
--- a/src/lstm/lstmrecognizer.cpp
+++ b/src/lstm/lstmrecognizer.cpp
@@ -261,13 +261,12 @@ void LSTMRecognizer::RecognizeLine(const ImageData &image_data,
   search_->excludedUnichars.clear();
   search_->Decode(outputs, kDictRatio, kCertOffset, worst_dict_cert, &GetUnicharset(),
                   lstm_choice_mode);
-  search_->ExtractBestPathAsWords(line_box, scale_factor, debug, &GetUnicharset(), words,
-                                  lstm_choice_mode);
+  search_->ExtractBestPathAsWords(line_box, scale_factor, debug, &GetUnicharset(), words);
   if (lstm_choice_mode) {
     search_->extractSymbolChoices(&GetUnicharset());
     for (int i = 0; i < lstm_choice_amount; ++i) {
       search_->DecodeSecondaryBeams(outputs, kDictRatio, kCertOffset, worst_dict_cert,
-                                    &GetUnicharset(), lstm_choice_mode);
+                                    &GetUnicharset());
       search_->extractSymbolChoices(&GetUnicharset());
     }
     search_->segmentTimestepsByCharacters();
@@ -325,7 +324,7 @@ bool LSTMRecognizer::RecognizeLine(const ImageData &image_data,
   // This ensures consistent recognition results.
   SetRandomSeed();
   int min_width = network_->XScaleFactor();
-  Image pix = Input::PrepareLSTMInputs(image_data, network_, min_width, &randomizer_, scale_factor);
+  Image pix = Input::PrepareLSTMInputs(image_data, network_, min_width, scale_factor);
   if (pix == nullptr) {
     tprintf("Line cannot be recognized!!\n");
     return false;
diff --git a/src/lstm/recodebeam.cpp b/src/lstm/recodebeam.cpp
index c3ca3250..448d3d8b 100644
--- a/src/lstm/recodebeam.cpp
+++ b/src/lstm/recodebeam.cpp
@@ -93,7 +93,7 @@ void RecodeBeamSearch::Decode(const NetworkIO &output, double dict_ratio,
     DecodeStep(output.f(t), t, dict_ratio, cert_offset, worst_dict_cert,
                charset);
     if (lstm_choice_mode) {
-      SaveMostCertainChoices(output.f(t), output.NumFeatures(), charset, t);
+      SaveMostCertainChoices(output.f(t), output.NumFeatures(), charset);
     }
   }
 }
@@ -111,7 +111,7 @@ void RecodeBeamSearch::Decode(const GENERIC_2D_ARRAY<float> &output,

 void RecodeBeamSearch::DecodeSecondaryBeams(
     const NetworkIO &output, double dict_ratio, double cert_offset,
-    double worst_dict_cert, const UNICHARSET *charset, int lstm_choice_mode) {
+    double worst_dict_cert, const UNICHARSET *charset) {
   for (auto data : secondary_beam_) {
     delete data;
   }
@@ -135,8 +135,7 @@ void RecodeBeamSearch::DecodeSecondaryBeams(

 void RecodeBeamSearch::SaveMostCertainChoices(const float *outputs,
                                               int num_outputs,
-                                              const UNICHARSET *charset,
-                                              int xCoord) {
+                                              const UNICHARSET *charset) {
   std::vector<std::pair<const char *, float>> choices;
   for (int i = 0; i < num_outputs; ++i) {
     if (outputs[i] >= 0.01f) {
@@ -239,8 +238,7 @@ void RecodeBeamSearch::ExtractBestPathAsUnicharIds(
 void RecodeBeamSearch::ExtractBestPathAsWords(const TBOX &line_box,
                                               float scale_factor, bool debug,
                                               const UNICHARSET *unicharset,
-                                              PointerVector<WERD_RES> *words,
-                                              int lstm_choice_mode) {
+                                              PointerVector<WERD_RES> *words) {
   words->truncate(0);
   std::vector<int> unichar_ids;
   std::vector<float> certs;
@@ -299,7 +297,7 @@ void RecodeBeamSearch::ExtractBestPathAsWords(const TBOX &line_box,
     WERD_RES *word_res =
         InitializeWord(leading_space, line_box, word_start, word_end,
                        std::min(space_cert, prev_space_cert), unicharset,
-                       xcoords, scale_factor);
+                       scale_factor);
     for (int i = word_start; i < word_end; ++i) {
       auto *choices = new BLOB_CHOICE_LIST;
       BLOB_CHOICE_IT bc_it(choices);
@@ -327,7 +325,7 @@ struct greater_than {
   }
 };

-void RecodeBeamSearch::PrintBeam2(bool uids, int num_outputs,
+void RecodeBeamSearch::PrintBeam2(bool uids,
                                   const UNICHARSET *charset,
                                   bool secondary) const {
   std::vector<std::vector<const RecodeNode *>> topology;
@@ -637,7 +635,6 @@ WERD_RES *RecodeBeamSearch::InitializeWord(bool leading_space,
                                            const TBOX &line_box, int word_start,
                                            int word_end, float space_certainty,
                                            const UNICHARSET *unicharset,
-                                           const std::vector<int> &xcoords,
                                            float scale_factor) {
   // Make a fake blob for each non-zero label.
   C_BLOB_LIST blobs;
diff --git a/src/lstm/recodebeam.h b/src/lstm/recodebeam.h
index 4017f3f8..ac8bc523 100644
--- a/src/lstm/recodebeam.h
+++ b/src/lstm/recodebeam.h
@@ -205,8 +205,7 @@ public:
               double worst_dict_cert, const UNICHARSET *charset);

   void DecodeSecondaryBeams(const NetworkIO &output, double dict_ratio, double cert_offset,
-                            double worst_dict_cert, const UNICHARSET *charset,
-                            int lstm_choice_mode = 0);
+                            double worst_dict_cert, const UNICHARSET *charset);

   // Returns the best path as labels/scores/xcoords similar to simple CTC.
   void ExtractBestPathAsLabels(std::vector<int> *labels, std::vector<int> *xcoords) const;
@@ -218,8 +217,7 @@ public:

   // Returns the best path as a set of WERD_RES.
   void ExtractBestPathAsWords(const TBOX &line_box, float scale_factor, bool debug,
-                              const UNICHARSET *unicharset, PointerVector<WERD_RES> *words,
-                              int lstm_choice_mode = 0);
+                              const UNICHARSET *unicharset, PointerVector<WERD_RES> *words);

   // Generates debug output of the content of the beams after a Decode.
   void DebugBeams(const UNICHARSET &unicharset) const;
@@ -232,7 +230,7 @@ public:
   void extractSymbolChoices(const UNICHARSET *unicharset);

   // Generates debug output of the content of the beams after a Decode.
-  void PrintBeam2(bool uids, int num_outputs, const UNICHARSET *charset, bool secondary) const;
+  void PrintBeam2(bool uids, const UNICHARSET *charset, bool secondary) const;
   // Segments the timestep bundle by the character_boundaries.
   void segmentTimestepsByCharacters();
   std::vector<std::vector<std::pair<const char *, float>>>
@@ -323,7 +321,7 @@ private:
   // right places.
   WERD_RES *InitializeWord(bool leading_space, const TBOX &line_box, int word_start, int word_end,
                            float space_certainty, const UNICHARSET *unicharset,
-                           const std::vector<int> &xcoords, float scale_factor);
+                           float scale_factor);

   // Fills top_n_flags_ with bools that are true iff the corresponding output
   // is one of the top_n.
@@ -342,8 +340,7 @@ private:
                            double worst_dict_cert, const UNICHARSET *charset, bool debug = false);

   // Saves the most certain choices for the current time-step.
-  void SaveMostCertainChoices(const float *outputs, int num_outputs, const UNICHARSET *charset,
-                              int xCoord);
+  void SaveMostCertainChoices(const float *outputs, int num_outputs, const UNICHARSET *charset);

   // Calculates more accurate character boundaries which can be used to
   // provide more accurate alternative symbol choices.